partie 2 :DeCompression :

 

Traitement RLE pour un bloc de pixels en RVB

function [r,v,b]=traitement_rle_inverse(codey,codecb,codecr,qualite)

%Récupérer les matrices R,V et B à partir des codes RLE

%Enlever le 'e' qui marque la fin du code

codey=codey(1:end-1);codey=cell2mat(codey);

codecb=codecb(1:end-1);codecb=cell2mat(codecb);

codecr=codecr(1:end-1);codecr=cell2mat(codecr); 

%Décodage rle

y=decodage_rle (codey);

cb=decodage_rle (codecb);

cr=decodage_rle (codecr);

%Zigzag

yquan=zigzaginv (y);

cbquan=zigzaginv (cb);

crquan=zigzaginv (cr);

%Quantification inverse

ydct=quantificationinverse (yquan,qualite,0);

cbdct=quantificationinverse (cbquan,qualite,1);

crdct=quantificationinverse (crquan,qualite,1);

%DCT inverse

y=dct2diminv (ydct);

cb=dct2diminv (cbdct);

cr=dct2diminv (crdct);

y=y+128;cb=cb+128;cr=cr+128;

% transformation de couleurs inverse

[r,v,b]=torvb (y,cb,cr);