JPEG COMPRESSION STEPS
Step 1 (Transformation): Color images are transformed from RGB into a
luminance/chrominance image (Eye is sensitive to luminance, not chrominance,
so that chrominance part can lose much data and thus can be highly compressed.
Step 2 (Down Sampling): The down sampling is done for colored component
and not for luminance component .Down sampling is done either at a ratio 2:1
horizontally and 1:1 vertically (2h 1 V). Thus the image reduces in size since the
‘y’ component is not touched, there is no noticeable loss of image quality.
Step 3 (Organizing in Groups): The pixels of each color component are
organized in groups of 8×2 pixels called “ data units” if number of rows or column
is not a multiple of 8, the bottom row and rightmost columns are duplicated.
Step 4 ( Discrete Cosine Transform): Discrete Cosine Transform ( DCT) is then
applied to each data unit to create 8×8 map of transformed components.DCT
involves some loss of information due to the limited precision of computer
arithmetic. This means that even without the map there will be some loss of image
quality but it is normally small.
Step 5 (Quantization): Each of the 64 transformed components in the data unit
is divided by a separate number called its ‘Quantization Coefficient (QC)’ and
then rounded to an integer. This is where information is lost irretrievably, Large
QC cause more loss. In general, the most JPEG implements allow use QC tables
recommended by the JPEG standard.
Step 6 (Encoding): The 64 quantized transformed coefficients ( Which are now
integers) of each data unit are encoded using a combination of RLE and Huffman
coding.
Step 7 (Adding Header): The last step adds header and all the JPEG parameters
used and output the result.
The compressed file may be in one of the 3 formats:
1. Interchange Format: In which the file contains compressed image and all
the tables needed by the decoder. (Quantization table and Huffman code
table).
2. Abbreviated Format: Where the file contains compressed image and may
contain first a few table. (Since the same encoder-decoder pair is used and
they have some tables built in)
3. Abbreviated format for table and specification data: Where the file
contains just tables and number of compressed images. Since images
compressed by same encoder and same tables, hence when it is to be
decoded, they are sent to decoder preceded by one file with table
specification data).
The JPEG decoder performs the reverse steps. Thus JPEG is a symmetric
compression method.