epifanio03_encoder

PURPOSE ^

QREREDCT (uniform) quantization of the linear reretransformada

SYNOPSIS ^

function [ristra,xdct2,prueba,DC] = epifanio03_encoder(imag,B,directorio,fichero)

DESCRIPTION ^

 QREREDCT (uniform) quantization of the linear reretransformada
 of the image blocks given, M may be a
 scalar or vector giving the maximum in each coefficient
 If it is a scalar, the same maximum gets on all coef.
 To get the maximum with those obtained in sacaesta, use maxcoef
 (H2 disregarding signs)

 USE: [imq, codq, E, Hi] = qreredct (im, B, 'c: \ tmp \ estarere' maximo_r'');
 Hi: Entropy computed earliest form, E: entropy calculated according e2 entroprova: all blocks

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % QREREDCT (uniform) quantization of the linear reretransformada
0002 % of the image blocks given, M may be a
0003 % scalar or vector giving the maximum in each coefficient
0004 % If it is a scalar, the same maximum gets on all coef.
0005 % To get the maximum with those obtained in sacaesta, use maxcoef
0006 % (H2 disregarding signs)
0007 %
0008 % USE: [imq, codq, E, Hi] = qreredct (im, B, 'c: \ tmp \ estarere' maximo_r'');
0009 % Hi: Entropy computed earliest form, E: entropy calculated according e2 entroprova: all blocks
0010 
0011 function [ristra,xdct2,prueba,DC] = epifanio03_encoder(imag,B,directorio,fichero)
0012 
0013 trayfich = 'estarereB';
0014 
0015 M = 10;
0016 
0017 tam = size(imag);
0018 
0019 load(trayfich);
0020 
0021 resol = 4;
0022 H = 0;
0023 Hi = 0;
0024 
0025 tamM = size(M);
0026 
0027 tam = tam(1);
0028 pto = [tam tam]/2;
0029 lados = [tam tam];
0030 lcuan = tam/(2^resol);
0031 posai = pto-round(lados/2);
0032 posbd = pto+round(lados/2);
0033 coorcuanai = floor([(posai(1)-1)/lcuan+1 (posai(2)-1)/lcuan+1]);
0034 coorcuanbd = floor([(posbd(1)-1)/lcuan+1 (posbd(2)-1)/lcuan+1]);
0035 
0036 if coorcuanai(1)<1
0037     coorcuanai(1)=1;
0038 end
0039 if coorcuanai(2)<1
0040     coorcuanai(2)=1;
0041 end
0042 if coorcuanbd(1)>(2^resol)
0043     coorcuanbd(1)=2^resol;
0044 end
0045 if coorcuanai(2)>(2^resol)
0046     coorcuanbd(2)=2^resol;
0047 end
0048 
0049 adctfglob = zeros(size(imag));
0050 
0051 xdct2 = dct2r(imag,resol);
0052 [xdctf,xLm] = contrast_2(xdct2,resol,[1 0]);
0053 adct = abs(xdctf);
0054 sdct = sign(xdct2);
0055 sdct(sdct==0) = 1;
0056 
0057 W = 1;
0058 
0059 val_r = 100;
0060 
0061 e = imdpcm(xLm,W,val_r);
0062 
0063 Nc = round(0.9 * 40);
0064 
0065 me = mini(e);
0066 Me = maxi(e);
0067 
0068 extr_err = [me Me];
0069 
0070 QE = round((Nc -1) * (e - me) / (Me - me));
0071 
0072 DC = xLm*16;
0073 L = V2'*grad;
0074 
0075 dctq = zeros(tam,tam);
0076 codq = dctq;
0077 
0078 codigazo = [];
0079 prueba = zeros(256,255);
0080 bloquecito = 1;
0081 
0082 for ii=coorcuanai(1):coorcuanbd(1)
0083 
0084     for jj=coorcuanai(2):coorcuanbd(2)
0085 
0086         iii = (ii-1)*lcuan+ceil(lcuan/2);
0087         jjj = (jj-1)*lcuan+ceil(lcuan/2);
0088         cub = sacasub(adct,[iii jjj],[lcuan lcuan],0);
0089         zcub = zigzag(cub);
0090         tzcub = L*(zcub) + consta;
0091 
0092         tzcub = tzcub(2:end);
0093 
0094         cod = round(2^B * tzcub ./ M);
0095 
0096         rrc = cod .* M / (2^B);
0097 
0098         signo1 = zigzag(sacasub(sdct,[iii jjj],[lcuan lcuan],0));
0099         signo1 = signo1(2:end);
0100 
0101         codigon = signo1 .* rrc;
0102         codigonint = signo1 .* abs(cod);
0103         prueba(bloquecito,:) = codigon;
0104 
0105         [codigo,ceros] = rle2(codigonint);
0106         codigazo = [codigazo codigo ceros];
0107 
0108         bloquecito = bloquecito + 1;
0109 
0110     end
0111 end
0112 
0113 ristra = [extr_err(:)' round(QE(:))' B round(codigazo)];
0114 
0115 cd(directorio);
0116 save_code_epifanio03(ristra,[fichero '.bin']);
0117 
0118 zip(fichero,[fichero '.bin']);
0119 
0120 delete([fichero '.bin']);

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