entropy_ucp

PURPOSE ^

SYNOPSIS ^

function [Results] = entropy_ucp(algoritmo,entropias,Im,uCP_ini,exponente,directorio,ficherin,N_it)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Results] = entropy_ucp(algoritmo,entropias,Im,uCP_ini,exponente,directorio,ficherin,N_it)
0002 
0003 you_are_here=pwd;
0004 
0005 RMSEs = [];
0006 SSIMs = [];
0007 MPEls = [];
0008 MPEnls = [];
0009 Results = [];
0010 
0011 umbral = 0.005;
0012 
0013 N = length(Im);
0014 if algoritmo==8
0015     fprintf('\n');
0016     disp('Sorry: Epifanio 03 algorithm is not available at the moment (coming soon)')
0017     Results=0;
0018 else
0019     for i = 1:length(entropias)
0020 
0021         ImR = [];
0022         disp(['uCP iteration for desired rate:   ' num2str(entropias(i))]);
0023 
0024         uCP = 0;
0025 
0026         iter = 0;
0027 
0028         no_results = 0;
0029 
0030         porcentaje = 1;
0031 
0032         sentido = 1;
0033 
0034         l_min = 0;
0035         l_max = 32;
0036 
0037         entropia_actual = 0;
0038         while((abs(entropias(i) - entropia_actual) > umbral) & (iter < N_it))
0039             iter = iter + 1;
0040 
0041             if(iter ~= 1 & iter ~= 2)
0042                 [uCP,l_min,l_max,porcentaje,sentido] = fitting_uCP_entropy(entropias(i),entropia_actual,uCP,l_min,l_max,porcentaje,sentido);
0043             end
0044 
0045             switch(algoritmo)
0046                 case 6,
0047                     fichero = [ficherin '_jpeg91_entropy'];
0048                     jpeg91_encoder(Im,uCP,directorio,[fichero '_' num2str(i)]);
0049                 case 7,
0050                     fichero = [ficherin '_malo99_entropy'];
0051                     malo99_encoder(Im,uCP,directorio,[fichero '_' num2str(i)]);
0052                 case 8,
0053                 case 9,
0054                     fichero = [ficherin '_malo06_entropy'];
0055                     if exist('RESP','var')
0056                         RESP=malo06_encoder(Im,uCP,exponente,directorio,[fichero '_' num2str(i)],RESP);
0057                     else
0058                         RESP=malo06_encoder(Im,uCP,exponente,directorio,[fichero '_' num2str(i)]);
0059                     end
0060                 case 10,
0061                     fichero = [ficherin '_malo06_2_entropy'];
0062                     if exist('RESP','var')
0063                         RESP=malo06_encoder(Im,uCP,exponente,directorio,[fichero '_' num2str(i)],RESP);
0064                     else
0065                         RESP=malo06_encoder(Im,uCP,exponente,directorio,[fichero '_' num2str(i)]);
0066                     end
0067             end
0068 
0069             D = dir([directorio fichero '_' num2str(i) '.zip']);
0070             tamanyo = 8 * D.bytes;
0071 
0072             entropia_actual = tamanyo / N^2;
0073 
0074             disp(['Iterat:  ' num2str(iter) '   Rate:  ' num2str(entropia_actual) ' bpp   uCP:  ' num2str(uCP)]);
0075 
0076             if((iter == 1) & (entropias(i) - entropia_actual < 0) & (uCP == 0))
0077                 disp('The selected entropy is too small to be reached.');
0078                 no_results = 1;
0079                 break;
0080 
0081             elseif(iter == 1)
0082 
0083                 uCP = uCP_ini(i);
0084             end
0085         end
0086         if(no_results == 0)
0087 
0088             cd(directorio)
0089             unzip([fichero '_' num2str(i) '.zip']);
0090             switch(algoritmo)
0091                 case 6,
0092                     ristra = read_code_jpeg91([fichero '_' num2str(i) '.bin']);
0093                 case 7,
0094                     ristra = read_code_malo99([fichero '_' num2str(i) '.bin']);
0095                 case 8,
0096                 case 9,
0097                     ristra = read_code_malo06([fichero '_' num2str(i) '.bin']);
0098                 case 10,
0099                     ristra = read_code_malo06([fichero '_' num2str(i) '.bin']);
0100             end
0101 
0102             delete([fichero '_' num2str(i) '.bin']);
0103 
0104             switch(algoritmo)
0105                 case 6,
0106                     [ImR] = jpeg91_decoder(directorio,[fichero '_' num2str(i)]);
0107                 case 7,
0108                     [ImR] = malo99_decoder(directorio,[fichero '_' num2str(i)]);
0109                 case 8,
0110                 case 9,
0111                     [ImR] = malo06_decoder(exponente,directorio,[fichero '_' num2str(i)]);
0112                 case 10,
0113                     [ImR] = malo06_decoder(exponente,directorio,[fichero '_' num2str(i)]);
0114             end
0115 
0116             [RMSEs(i),SSIMs(i),MPEls(i),MPEnls(i)] = computing_distortions(Im,ImR);
0117 
0118             if(algoritmo == 9 | algoritmo == 10)
0119                 Results(i).Exponente = exponente;
0120             end
0121             Results(i).RMSE = RMSEs(i);
0122             Results(i).SSIM = SSIMs(i);
0123             Results(i).MPE_linear = MPEls(i);
0124             Results(i).MPE_non_linear = MPEnls(i);
0125             Results(i).Entropy = entropia_actual;
0126             Results(i).Image = ImR;
0127         end
0128     end
0129 end
0130 cd(you_are_here);

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