JPEG Compression

I have essentially tried to implement as closely as possible the Joint Photographic Experts Group (JPEG)'s baseline compression model.

The various step involved are :-

1. Change the colourspace of the image from RGB to YCbCr.
2. Perform a downsampling of the chrominance components.
3. Center the intensity values.
4. Do a 8x8 block DCT on the image.
5. Use the standard JPEG quantization matrices to quantize the luminance and chrominance components.
6. Linearize the resulting matrix and do Runlength Encoding on it.
7. Perform Huffman Encoding.

Features typical to my Implemmentation :

1. The colorspace conversion formulae I have used are as follows
   RGB to YCbCr :

   Y  =  0.29900 * R + 0.58700 * G + 0.11400 * B;
   Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B;
   Cr =  0.50000 * R - 0.41869 * G - 0.08131 * B;

   YCbCr to RGB (used during decompression) :

   R = Y + 1.40200 * V;
   G = Y - 0.34414 * U - 0.71414 * V;
   B = Y + 1.77200 * U;

2. I have not done any downsampling.
3. The DCT is a Fast DCT essentially using an auxillary function and the FFT.
4. I have not implemented the Huffman encoding on my own.

I performed various tests. I have put up results of two set of tests one for a grayscale image and another for a colour one.

A). GrayScale Image test
B). Colour Image test
 
 

Improvements possible :
1. Encoding the Huffman encoder/decoder myself.
2. Implement the JPEG2000 standard which uses wavelet based image compression rather than DCT.




Page last updated on 28 January, 2004. pialpharhoalphagammaAT cse.iitd.ac.in © Parag Chaudhuri , 2009
DCSE, IIT Delhi Valid HTML 4.0! Valid CSS! yahoo