3.The encoding of the data to minimize the entropy of the quantized DCT coefficients.
The entropy encoding is done with a Huffman variable-word-length encoder.
![[001.bmp]](00000001.gif)
Fig 1-1 Basic Image Compression Scheme for Coder and Decoder
Although color conversion is a part of the redundancy removal process, it is not
part of the JPEG algorithm. It is the goal of JPEG to be independent of the color
space. JPEG handles colors as separate components. Therefore, it can be used to
compress data from different color spaces such as RGB, YCbCr, and CMYK.
However, the best compression results are achieved if the color components are independent
(noncorrelated), such as in YCbCr, where most of the information is concentrated
in the luminance and less in the chrominance. RGB color components can be converted
via a linear transformation into YCbCr components as the equation below shows.
![[003.bmp]](00000003.gif)
Conversion from RGB to YUV
Another advantage of using the YCbCr color space comes from reducing the spatial
resolution of the Cb and Cr chrominance components. Because chrominance does not
need to be specified as frequently as luminance, every other Cb element and every
other Cr element can be discarded. As a consequence, a data reduction of 3:2 is
obtained by transforming RGB, 4:4:4 format into YCbCr 4:2:2 format. The conversion
in color space is a first step toward compressing the image.