partie 2 :DeCompression :
Décodage Huffman1 pour image en grayscale
function G=decodhuff_gris(code_huffman,dico)
% Récupérer la matrice de pixels après la décompression HUFFMAN1
%Récupérer la qualité
qualite=dico{end};
code_huffman=code_huffman(1:end-1); %enlever le dernier 'g'
%Récupérer le code
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;
%Récupérer le dictionnaire
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);
eval([ 'd' num2str(x) '=variable;']);
t=i+1;x=x+1; clear variable;
end % end if
end
save fichiers_mat/vect;
%Récupérer les blocs de pixels
x=x-1;load fichiers_mat/vect;i=1;
while i<x
codeG=eval([ 'g' num2str(i)]);
ddico=eval([ 'd' num2str(i)]);
[A]=traitement_huff_gris_inverse (ddico,codeG,qualite);
eval([ 'z' num2str(i) '=A;']);
i=i+1;
end % end while
%Recoller les blocs
load fichiers_mat/dim;load fichiers_mat/matrices;
u=xx;P=nn/8;
GG=ret_bloc ('z',u,P);
G=eval(['[' GG ']']);
load fichiers_mat/indices
G=decomp_block (G,indL,indC);