0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 function [ImR] = svr_dct_decoder(H,directorio,fichero)
0012 Lb = 16;
0013 Li = 256;
0014
0015 cd(directorio)
0016 unzip([fichero '.zip']);
0017 ristra = read_code_svr_dct([fichero '.bin']);
0018
0019 delete([fichero '.bin']);
0020 TheCode = zeros(256,255);
0021
0022 normaliz = [3 ristra(1)];
0023 extr_err = ristra(2:3);
0024 QE = reshape(ristra(4:3+256),16,16);
0025 bits = ristra(260) / 10;
0026
0027 ristra = ristra(261:end);
0028
0029 [TheCode] = inv_rle(ristra);
0030
0031 NumNiv = 2^bits;
0032 MM = 0.8;
0033
0034 TheRealCode = TheCode * MM / NumNiv;
0035
0036 N = round(0.9 * 40);
0037 qe = (extr_err(2) - extr_err(1)) * QE / (N - 1) + extr_err(1);
0038
0039 Lmq = iimdpcm(qe,1,100);
0040
0041 fprintf('Recovering the image:\n');
0042 fprintf(' Inverting from SVM weights to dct\n');
0043 z=1;
0044 dctc1 = zeros(Li,Li);
0045
0046 for i=1:Lb:Li
0047 for j=1:Lb:Li
0048
0049 y = H * TheRealCode(z,:)';
0050
0051 y = abs(y);
0052 signosr = TheRealCode(z,:) < 0;
0053 signosr = signosr';
0054 y = y.*(signosr == 0) - y.*(signosr > 0);
0055 y = [0; y];
0056 A = dezigzag(y);
0057 dctc1(i:(i+(Lb-1)),j:(j+(Lb-1))) = A;
0058
0059 z = z+1;
0060 end
0061 end
0062 fprintf(' Inverting from dct to spatial domain\n');
0063
0064 dctc1i = icontra2(dctc1,Lmq,4,normaliz);
0065
0066 ImR = real(idct2r(dctc1i,4));