partie 2 :DeCompression :
Décompression JPEG
function decompression_jpeg(code,file_dest,type_huff,Y_dico,CB_dico,CR_dico)
%Fait la décompression JPEG
% option ='RLE' > codage RLE sans Huffman
% option ='HUFF1' > codage RLE + HUFFMAN
% option = 'HUFF2 > codage RLE + HUFFMAN2
% traite le mode nuance de gris et le mode rvb
if nargin==2 || nargin==3 % mode rle
x=code{end-1};
if strcmp(x,'r') %rvb
matrice3=decodrle_rvb (code);
else
matrice3=decodrle_gris (code); % nuance de gris
end % end if
end % end if
if nargin==4 % mode huffman nuance de gris
if strcmp(type_huff,'HUFF1') || strcmp(type_huff,'huff1')
matrice3=decodhuff_gris (code,Y_dico);
else if strcmp(type_huff,'HUFF2') || strcmp(type_huff,'huff2')
matrice3=decodhuff2_gris (code,Y_dico);
else error('TYPE Huffman invalid!!');
end % end if
end % end if
end % end if
if nargin==6
if strcmp(type_huff,'HUFF1') || strcmp(type_huff,'huff1')
matrice3=decodhuff_rvb (code,Y_dico,CB_dico,CR_dico);
else if strcmp(type_huff,'HUFF2') || strcmp(type_huff,'huff2')
matrice3=decodhuff2_rvb (code,Y_dico,CB_dico,CR_dico);
else error('TYPE Huffman invalid!!');
end % end if
end % end if
end % end if
matrice3=uint8(matrice3); % Forcer le codage sur 8 bits
fichier=[file_dest '.jpg'];
imwrite(matrice3,fichier,'jpeg','quality','100');