clear all

NomFich='../../Images/Lena_RGB____04.jpg';

JPEGObj=jpeg_read(NomFich);

coef1 = dequantize(JPEGObj.coef_arrays{1},...
    JPEGObj.quant_tables{JPEGObj.comp_info(1).quant_tbl_no});
Y=ibdct(coef1)+128;

coef2 = dequantize(JPEGObj.coef_arrays{2},...
    JPEGObj.quant_tables{JPEGObj.comp_info(2).quant_tbl_no});
Cr=ibdct(coef2);
Cr=kron(Cr,ones(2,2));


coef3 = dequantize(JPEGObj.coef_arrays{3},...
    JPEGObj.quant_tables{JPEGObj.comp_info(3).quant_tbl_no});
Cb=ibdct(coef3);
Cb=kron(Cb,ones(2,2));


ImageRGB = YCC2RGB(Y, Cr, Cb);

ImageRGB(ImageRGB<0)=0;
ImageRGB(ImageRGB>255)=255;

