malo99_decoder

PURPOSE ^

It decompress a file created using 'malo99_encoder' and it recovers the image

SYNOPSIS ^

function [ImR] = malo99_decoder(directorio,fichero)

DESCRIPTION ^

 It decompress a file created using 'malo99_encoder' and it recovers the image

 USE: [ImR] = malo99_decoder(directorio,fichero)

 where:

 directorio -> Folder where the file to decompress is
 fichero    -> Name of the .zip file (whithout extension) to decompress

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % It decompress a file created using 'malo99_encoder' and it recovers the image
0002 %
0003 % USE: [ImR] = malo99_decoder(directorio,fichero)
0004 %
0005 % where:
0006 %
0007 % directorio -> Folder where the file to decompress is
0008 % fichero    -> Name of the .zip file (whithout extension) to decompress
0009 
0010 function [ImR] = malo99_decoder(directorio,fichero)
0011 Lb = 16;
0012 Li = 256;
0013 
0014 cd(directorio)
0015 unzip([fichero '.zip']);
0016 ristra = read_code_malo99([fichero '.bin']);
0017 
0018 delete([fichero '.bin']);
0019 TheCode = zeros(256,255);
0020 
0021 norm = [3 ristra(1)];
0022 extr_err = ristra(2:3);
0023 QE = reshape(ristra(4:3+256),16,16);
0024 B = ristra(260);
0025 
0026 ristra = ristra(261:end);
0027 
0028 [TheCode] = inv_rle(ristra);
0029 
0030 NumNiv = 2^B;
0031 MM = 0.8;
0032 
0033 TheRealCode = TheCode * MM / NumNiv;
0034 
0035 Nc = round(0.9 * 40);
0036 qe = (extr_err(2) - extr_err(1)) * QE / (Nc - 1) + extr_err(1);
0037 
0038 Lmq = iimdpcm(qe,1,100);
0039 
0040 fprintf('Recovering the image:\n');
0041 fprintf('  Inverting from r to dct\n');
0042 z = 1;
0043 dctc1 = zeros(Li,Li);
0044 for i = 1:Lb:(Li-1)
0045     for j = 1:Lb:(Li-1)
0046 
0047         b = TheRealCode(z,:)';
0048         b = [0; b];
0049         b = dezigzag(b);
0050 
0051         dctc1(i:(i+(Lb-1)),j:(j+(Lb-1))) = b;
0052         z = z + 1;
0053     end
0054 end
0055 
0056 dctc1i = icontra2(dctc1,Lmq,4,norm);
0057 
0058 ImR = real(idct2r(dctc1i,4));

Generated on Fri 07-Mar-2014 13:29:20 by m2html © 2005