malo06_ucp_distortion

PURPOSE ^

MALO06: image transform coding by using a non-linearly transformed DCT

SYNOPSIS ^

function [Results] = malo06_ucp_distortion(Im,exp,param,B_inicial,variable);

DESCRIPTION ^

 MALO06: image transform coding by using a non-linearly transformed DCT
 using divisive normalization (see Malo et al. 06)

 MALO06 encodes 256*256 images by first transforming each 16*16 image block
 into a non-linear domain (DCT+divisive normalization) that simultaneously
 reduces the statistical and the perceptual relations among coefficients.
 Then, each transformed block is quantized using uniform bit allocation and uniform
 quantizers because the non-linear domain is Euclidean from the perceptual point
 of view.

 Two versions of the algorithm are available. These versions differ in the
 parameters of the non-linear perceptual transform (the divisive normalization).
 The different versions can be selected using the parameter 'exp':

    exp = 1    Parameter set with robust inverse
    exp = 2    Parameter set with better results at high compression (less than 0.3 bpp)
               but more unstable inverse

 (see qdct65.m for details)

 In this implementation the allocated bits are controlled by the
 control parameter, CP.
 Increasing CP reduces the quantization step sizes, increasing the entropy,
 and reducing the distortion.

 The algorithm starts by using a CP value provided by the user, uCP.
 This CP value is iteratively modified till the desired entropy is achieved.

 USE: [Results] = malo06_2(Im,exp,parametro,B,variable)

 INPUT:

 Im        -> Image
 parametro -> Distortion parameter value
 B         -> Control parameter
 variable  -> Text string to choose the distortion parameter

 OUTPUT:

 Results   -> Struct with the information a bout results
              to the diostortion parameter:
              struct('uCP',B,'Image',ImR,'Entropy',H)
              Results.SNR, Results.MSE, Results.SSIM, Results.MPE_lineal,
              Results.MPE_no_lineal, Results.MPE_no_linea_JMLR

 REFERENCE:

    Malo et al., IEEE Tr. Im. Proc., 2006.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 % MALO06: image transform coding by using a non-linearly transformed DCT
0003 % using divisive normalization (see Malo et al. 06)
0004 %
0005 % MALO06 encodes 256*256 images by first transforming each 16*16 image block
0006 % into a non-linear domain (DCT+divisive normalization) that simultaneously
0007 % reduces the statistical and the perceptual relations among coefficients.
0008 % Then, each transformed block is quantized using uniform bit allocation and uniform
0009 % quantizers because the non-linear domain is Euclidean from the perceptual point
0010 % of view.
0011 %
0012 % Two versions of the algorithm are available. These versions differ in the
0013 % parameters of the non-linear perceptual transform (the divisive normalization).
0014 % The different versions can be selected using the parameter 'exp':
0015 %
0016 %    exp = 1    Parameter set with robust inverse
0017 %    exp = 2    Parameter set with better results at high compression (less than 0.3 bpp)
0018 %               but more unstable inverse
0019 %
0020 % (see qdct65.m for details)
0021 %
0022 % In this implementation the allocated bits are controlled by the
0023 % control parameter, CP.
0024 % Increasing CP reduces the quantization step sizes, increasing the entropy,
0025 % and reducing the distortion.
0026 %
0027 % The algorithm starts by using a CP value provided by the user, uCP.
0028 % This CP value is iteratively modified till the desired entropy is achieved.
0029 %
0030 % USE: [Results] = malo06_2(Im,exp,parametro,B,variable)
0031 %
0032 % INPUT:
0033 %
0034 % Im        -> Image
0035 % parametro -> Distortion parameter value
0036 % B         -> Control parameter
0037 % variable  -> Text string to choose the distortion parameter
0038 %
0039 % OUTPUT:
0040 %
0041 % Results   -> Struct with the information a bout results
0042 %              to the diostortion parameter:
0043 %              struct('uCP',B,'Image',ImR,'Entropy',H)
0044 %              Results.SNR, Results.MSE, Results.SSIM, Results.MPE_lineal,
0045 %              Results.MPE_no_lineal, Results.MPE_no_linea_JMLR
0046 %
0047 % REFERENCE:
0048 %
0049 %    Malo et al., IEEE Tr. Im. Proc., 2006.
0050 %
0051 
0052 function [Results] = malo06_ucp_distortion(Im,exp,param,B_inicial,variable);
0053 
0054 Im=double(Im);
0055 
0056 Maximo=0.8;
0057 cero=1;
0058 blo=[];
0059 for i=1:16
0060     for j=1:16
0061         blo=[blo;i j];
0062     end
0063 end
0064 norma=[3 mean(mean(Im))];
0065 calc_eig=0;
0066 calc_eig_sin_q=0;
0067 
0068 Results=[];
0069 
0070 contador = 0;
0071 
0072 for parametro = param
0073 
0074     disp(['Adjustment of uCP to reach desired ' variable ':   ' num2str(parametro)]);
0075 
0076     switch(variable)
0077         case 'SNR', parametro_actual = 1; umbral = 0.05;
0078         case 'MSE', parametro_actual = 1; umbral = 0.5;
0079         case 'SSIM', parametro_actual = 0; umbral = 0.001;
0080         case 'MPE lineal', parametro_actual = 100; umbral = 0.01;
0081         case 'MPE no lineal', parametro_actual = 100; umbral = 0.01;
0082         case 'MPE no lineal JMLR', parametro_actual = 100; umbral = 0.1;
0083     end
0084 
0085     iter = 0;
0086 
0087     B = 0;
0088 
0089     porcentaje = 1;
0090 
0091     if(isequal(variable,'SSIM'))
0092         sentido = 1;
0093     else
0094         sentido = 0;
0095     end
0096 
0097     no_results = 0;
0098 
0099     l_min = 0;
0100     l_max = 100000;
0101 
0102     while(abs(parametro - parametro_actual) > umbral) & (iter < 30)
0103 
0104         iter = iter + 1;
0105 
0106         if(iter ~= 1 & iter ~= 2)
0107             switch(variable)
0108                 case 'SNR',
0109                     [B, l_min, l_max, porcentaje, sentido] = fitting_uCP_SSIM(parametro, parametro_actual, B, l_min, l_max, porcentaje, sentido);
0110                 case 'MSE',
0111                     [B, l_min, l_max, porcentaje, sentido] = fitting_uCP(parametro, parametro_actual, B, l_min, l_max, porcentaje, sentido);
0112                 case 'SSIM',
0113                     [B, l_min, l_max, porcentaje, sentido] = fitting_uCP_SSIM(parametro, parametro_actual, B, l_min, l_max, porcentaje, sentido);
0114                 case 'MPE lineal',
0115                     [B, l_min, l_max, porcentaje, sentido] = fitting_uCP(parametro, parametro_actual, B, l_min, l_max, porcentaje, sentido);
0116                 case 'MPE no lineal',
0117                     [B, l_min, l_max, porcentaje, sentido] = fitting_uCP(parametro, parametro_actual, B, l_min, l_max, porcentaje, sentido);
0118                 case 'MPE no lineal JMLR',
0119                     [B, l_min, l_max, porcentaje, sentido] = fitting_uCP(parametro, parametro_actual, B, l_min, l_max, porcentaje, sentido);
0120             end
0121         end
0122 
0123         [imq1,imq2,codig,signos,codigo,nceros,DC,Hp,Hi,meig,mceig,values,valuesc]=qdct65(Im,B,Maximo,norma,blo,exp,cero,calc_eig,calc_eig_sin_q);
0124         ImR = real(imq1);
0125 
0126         switch(variable)
0127             case 'SNR',
0128                 [mse,SNRi] = emse2(Im,ImR);
0129                 fprintf('   It. =
0130                 parametro_actual = SNRi;
0131             case 'MSE',
0132                 [mse,SNRi] = emse2(Im,ImR);
0133                 fprintf('   It. =
0134                 parametro_actual = mse;
0135             case 'SSIM',
0136                 esesim = ssim_index(Im,ImR);
0137                 fprintf('   It. =
0138                 parametro_actual = esesim;
0139             case 'MPE lineal',
0140                 [MSE,d_l,dx0,MPEx0,MPEoo0,MPEexpesp0] = disdis_lineal(Im,ImR,2,[3 mean(mean(Im))],2,2);
0141                 mpelin = d_l;
0142                 fprintf('   It. =
0143                 parametro_actual = mpelin;
0144             case 'MPE no lineal',
0145                 [MSE,d,dx,MPEx,MPEoo,MPEexpesp] = disdis7(Im,ImR,[3 mean(mean(Im))],2,1,2,2);
0146                 mpenonlin= d;
0147                 fprintf('   It. =
0148                 parametro_actual = mpenonlin;
0149             case 'MPE no lineal JMLR',
0150                 [MSE,d,dx,MPEx,MPEoo,MPEexpesp] = disdis7(Im,ImR,[3 mean(mean(Im))],1,0.5,2,2);
0151                 mpenonlinJMLR = d;
0152                 fprintf('   It. =
0153                 parametro_actual = mpenonlinJMLR;
0154         end
0155 
0156         if(~isequal(variable,'SSIM') & (iter == 1) & (parametro - parametro_actual > 0) & (B == 0))
0157             no_results = 1;
0158             disp('No se puede ajustar el uCP para esta distorsion');
0159             break;
0160 
0161         elseif(isequal(variable,'SSIM') & (iter == 1) & (parametro - parametro_actual < 0) & (B == 0))
0162             no_results = 1;
0163             disp('No se puede ajustar el uCP para esta distorsion');
0164             break;
0165 
0166         elseif((iter == 1) & (abs(parametro - parametro_actual) <= umbral) & (B == 0))
0167             no_results = 1;
0168             disp('No se puede ajustar el uCP para esta distorsion');
0169             break;
0170 
0171         elseif(iter == 1)
0172             B = B_inicial;
0173         end
0174     end
0175 
0176     if(no_results == 0)
0177 
0178         contador = contador + 1;
0179 
0180         H = Hi/(size(Im,1) * size(Im,2));
0181 
0182         Results(contador).uCP = B;
0183         Results(contador).Image = ImR;
0184         Results(contador).Entropy = H;
0185 
0186         switch(variable)
0187             case 'SNR',
0188                 Results(contador).SNR = SNRi;
0189             case 'MSE',
0190                 Results(contador).MSE = mse;
0191             case 'SSIM',
0192                 Results(contador).SSIM = esesim;
0193             case 'MPE lineal',
0194                 Results(contador).MPE_lineal = mpelin;
0195             case 'MPE no lineal',
0196                 Results(contador).MPE_no_lineal = mpenonlin;
0197             case 'MPE no lineal JMLR',
0198                 Results(contador).MPE_no_lineal_JMLR = mpenonlinJMLR;
0199         end
0200     end
0201 end

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