partie 2 :DeCompression :

 

Décodage Huffman 2 pour une image en grayscale

 

function G=decodhuff2_gris(code_huffman,dico)

% Décodage HUFFMAN2 pour gris

%Récupérer la qualité

qualite=dico{end};

code_huffman=code_huffman(1:end-1); %enlever le dernier 'g'

%Récupération des blocs

G=code_huffman;

x=1;t=1;

for i=1:length(G)

    if strcmp(G{i},'e')==1

    eval([ 'g' num2str(x)  '=G(t:i);']);     %G=code

    t=i+1;x=x+1;

    end % end if

end % end for

save fichiers_mat/vect;

x=1;t=1;f=1;oo=1;

for i=1:length(dico)

    if strcmp(dico{1,i},'#')==1

       for f=t:i

           variable{1,f}=dico{1,f};

           variable{2,f}=dico{2,f};

       end % end for

      variable=enlever_vide (variable);       //cliquez sur enlever_vide() pour afficher son code

      eval([ 'd' num2str(x)  '=variable;']);

      t=i+1; x=x+1; clear variable;

    end % end if

end % end for 

save fichiers_mat/vect;

%Application sur chaque bloc

x=x-1;load fichiers_mat/vect;i=1;

while i<x

    codeG=eval([ 'g' num2str(i)]);

    ddico=eval([ 'd' num2str(i)]);

    [A]=traitement_huff2_gris_inverse (ddico,codeG,qualite); //cliquez sur traitement_....

    eval([ 'z' num2str(i) '=A;']);

i=i+1;

end % end while

load fichiers_mat/dim;load fichiers_mat/matrices;

u=xx;P=nn/8;

GG=ret_bloc ('z',u,P,'G');  //cliquez sur ret_bloc() pour afficher son code

G=eval(['[' GG ']']);

%Redimensionner l'image

load fichiers_mat/indices

G=decomp_block (G,indL,indC);