function F=decompress1(filename,K)

LG=90*135;
fid = fopen([filename '.bin'],'r');

num1=fread(fid,1,'ubit5');
enum1=fread(fid,1,'ubit5');

num2=fread(fid,1,'ubit5');
enum2=fread(fid,1,'ubit5');

num3=fread(fid,1,'ubit5');
enum3=fread(fid,1,'ubit5');

num=major_check(num1,num2,num3);
enum=major_check(enum1,enum2,enum3);

mM1=fread(fid,1,'bit16');
mC1=fread(fid,1,'bit16');
mc1=fread(fid,enum,'bit16');
F_bit1=fread(fid,1,'ubit5');
M_bit1=fread(fid,1,'ubit5');
C_bit1=fread(fid,1,'ubit5');
Label_bit1=fread(fid,1,'ubit5');
ms_bit1=fread(fid,1,'ubit5');
ms_min_bit1=fread(fid,1,'ubit5');
C1_bit1=fread(fid,enum,'ubit5');

mM2=fread(fid,1,'bit16');
mC2=fread(fid,1,'bit16');
mc2=fread(fid,enum,'bit16');
F_bit2=fread(fid,1,'ubit5');
M_bit2=fread(fid,1,'ubit5');
C_bit2=fread(fid,1,'ubit5');
Label_bit2=fread(fid,1,'ubit5');
ms_bit2=fread(fid,1,'ubit5');
ms_min_bit2=fread(fid,1,'ubit5');
C1_bit2=fread(fid,enum,'ubit5');

mM3=fread(fid,1,'bit16');
mC3=fread(fid,1,'bit16');
mc3=fread(fid,enum,'bit16');
F_bit3=fread(fid,1,'ubit5');
M_bit3=fread(fid,1,'ubit5');
C_bit3=fread(fid,1,'ubit5');
Label_bit3=fread(fid,1,'ubit5');
ms_bit3=fread(fid,1,'ubit5');
ms_min_bit3=fread(fid,1,'ubit5');
C1_bit3=fread(fid,enum,'ubit5');

mM=major_check(mM1,mM2,mM3);
mC=major_check(mC1,mC2,mC3);
for i=1:enum
mc(i)=major_check(mc1(i),mc2(i),mc3(i));
end
F_bit=major_check(F_bit1,F_bit2,F_bit3);
M_bit=major_check(M_bit1,M_bit2,M_bit3);
C_bit=major_check(C_bit1,C_bit2,C_bit3);
Label_bit=major_check(Label_bit1,Label_bit2,Label_bit3);
ms_bit=major_check(ms_bit1,ms_bit2,ms_bit3);
ms_min_bit=major_check(ms_min_bit1,ms_min_bit2,ms_min_bit3);
for i=1:enum
C1_bit(i)=major_check(C1_bit1(i),C1_bit2(i),C1_bit3(i));
end

c=['ubit' num2str(F_bit)];
Flag_mf=fread(fid,[K 1],'ubit1');
mf1=fread(fid,[K 1],c);
mf2=fread(fid,[K 1],c);
mf=mf1;
for k=1:K
    if mf1(k)~=mf2(k)
        flag1=parity_check(mf1(k));
        flag2=parity_check(mf2(k));
        if(flag1~=Flag_mf(k))
            mf(k)=mf2(k);
        end
    end
end


c=['ubit' num2str(M_bit)];
Flag_M=fread(fid,[K num],'ubit1');
M1=fread(fid,[K num],c);
M2=fread(fid,[K num],c);

M=M1;
for k=1:K
    for i=1:num
        if M1(k,i)~=M2(k,i)
            flag1=parity_check(M1(k,i));
            flag2=parity_check(M2(k,i));
            if(flag1~=Flag_M(k,i))
                M(k,i)=M2(k,i);
            end
        end
    end
end
M=M+mM;

FlagE=fread(fid,[K num],'ubit1');
E=fread(fid,[num K],'bit15');
E=10^(-4)*E';
for j=1:num
    E(:,j)=norm_check(E(:,j),K,FlagE(:,j));
end

c=['ubit' num2str(Label_bit)];

Label1=fread(fid,LG,c);
Label2=fread(fid,LG,c);
Label3=fread(fid,LG,c);
for i=1:LG
Label(i)=major_check(Label1(i),Label2(i),Label3(i));
end
Label=Label+1;

c=['ubit' num2str(C_bit)];
Flag_C=fread(fid,[1 LG],'ubit1');
C_1=fread(fid,[1 LG],c);
C_2=fread(fid,[1 LG],c);
C=C_1;
for k=1:LG
    if C_1(k)~=C_2(k)
        flag1=parity_check(C_1(k));
        flag2=parity_check(C_2(k));
        if(flag1~=Flag_C(k))
            C(k)=C_2(k);
        end
    end
end
C=C+mC;

FlagV=fread(fid,[K enum],'ubit1');
V1=fread(fid,[enum K],'bit15');
V1=10^(-4)*V1';
for j=1:enum
    V1(:,j)=norm_check(V1(:,j),K,FlagV(:,j));
end

C1=zeros(enum,LG);
for j=1:enum
    c=['ubit' num2str(C1_bit(j))];
    c1=fread(fid,[1 LG],c);
    C1(j,:)=c1+mc(j);
end

c=['ubit' num2str(ms_min_bit)];
ms_min=fread(fid,1,c);
Flag_ms=fread(fid,[1 LG],'ubit1');
c=['ubit' num2str(ms_bit)];
ms1=fread(fid,[1 LG],c);
ms2=fread(fid,[1 LG],c);

ms=ms1;
col_crash=LG+1;
for k=1:LG
    if ms1(k)~=ms2(k)
        flag1=parity_check(ms1(k));
        flag2=parity_check(ms2(k));
        if(flag1~=Flag_ms(k))
            if(flag2==Flag_ms(k))
                ms(k)=ms2(k);
            else
                col_crash=k;
            end
        end
    end
end
ms=ms+ms_min*ones(1,LG);

c=['ubit' num2str(F_bit)];

HL_bit1=fread(fid,1,c);
mR1=fread(fid,1,c);
MR1=fread(fid,1,c);

HL_bit2=fread(fid,1,c);
mR2=fread(fid,1,c);
MR2=fread(fid,1,c);

HL_bit3=fread(fid,1,c);
mR3=fread(fid,1,c);
MR3=fread(fid,1,c);

HL_bit=major_check(HL_bit1,HL_bit2,HL_bit3);
mR=major_check(mR1,mR2,mR3);
MR=major_check(MR1,MR2,MR3);

mR=-mR;

c=['ubit' num2str(HL_bit)];
huff_len=length(mR:MR);

HL_R1=fread(fid,[1 huff_len],c);
HL_R2=fread(fid,[1 huff_len],c);
HL_R3=fread(fid,[1 huff_len],c);

for i=1:huff_len
HL_R(i)=major_check(HL_R1(i),HL_R2(i),HL_R3(i));
end

A=fread(fid,'ubit1');
code=uint8(A);
fclose(fid);

HK=uint8(HuffCode(HL_R));
mH=max(HL_R);
ind=(1-mR)*ones(1,K*LG);
pos=0;
k=1;

while(k<=K*LG)
   flag=0;
   j=1;
   while(j<=mH & flag~=1)
      p=find(HL_R==j);
      i=1;
      while(i<=length(p) & flag~=1)
         if ( code(pos+1:pos+j)'==HK(p(i),1:HL_R(p(i))) )
            flag=1;
            pos=pos+j;
            ind(k)=p(i);
            k=k+1;
            j=0;
         else
            i=i+1;
         end
      end
      j=j+1;
   end
   k_col=ceil((k-1)/K);
   
   if k_col>=col_crash
       k=K*LG+1;
   end
       
   if flag==0
       pos=sum(ms(1:k_col));
   end
   if ( mod(k-1,K)==0 & pos ~= sum(ms(1:k_col)))
       pos=sum(ms(1:k_col));
   end
end

R=zeros(K,LG);
for j=1:LG
   R(:,j)=ind(K*(j-1)+1:j*K)'+mR-1;
end

F1=R+round(V1*C1);
for j=1:num
   J=find(Label==j);    
   m=M(:,j);
   v=E(:,j);
   F(:,J)=F1(:,J)+m*ones(1,length(J))+round(v*C(J));
end
F=F+mf*ones(1,LG);