Download (direct link):
1. Sequential Lossless Mode: Compress the image in a single scan and the decoded image is an exact replica of the original image.
2. Sequential DCT-based Mode: Compress the image in a single scan using DCT-based lossy compression technique. As a result, the decoded image is not an exact replica, but an approximation of the original image.
JPEG: STILL IMAGE COMPRESSION STANDARD
3. Progressive DCT-based Mode: Compress the image in multiple scans and also decompress the image in multiple scans with each successive scan producing a better-quality image.
4. Hierarchical Mode: Compress the image at multiple resolutions for display on different devices.
The three DCT-based modes (2, 3, and 4) in JPEG provide lossy compression because precision limitation to digitally compute DCT (and its inverse) and the quantization process introduce distortion in the reconstructed image. For sequential lossless mode of compression, predictive coding is used instead of the DCT-based transformation, and also there is no quantization involved in this mode. The hierarchical mode uses extensions of either the DCT-based coding or predictive coding techniques. The simplest form of the sequential DCT-based JPEG algorithm is called the baseline JPEG algorithm, which is based on Huffman coding for entropy encoding. The other form of sequential DCT-based JPEG algorithm is based on arithmetic coding for entropy encoding. The baseline JPEG algorithm is widely used in practice. We shall describe the JPEG lossless algorithm and the baseline JPEG algorithm in greater detail in this chapter.
People often mention Motion JPEG for compression of moving pictures. This is not really a standard. Although it is not specifically defined as part of the standard, JPEG can be used to compress image sequence in video on the basis that video clips can be considered as a sequence of still image frames and each image frame can be compressed independently using the JPEG algorithm. This process of image sequence compression is popularly known as Motion JPEG in the industry.
JPEG standard does not specify any inherent file format. It defines only the syntax of the compressed bitstream. This caused creation of a number of file formats to store the JPEG compressed images such as JFIF (JPEG File Interchange Format), JPEG extension to TIFF 6.0, FlashPix, etc. But none of them is considered to be an official international standard defined under the auspices of an international standards committee.
3.2 THE JPEG LOSSLESS CODING ALGORITHM
The lossless JPEG compression is based on the principles of predictive coding. Since the adjacent pixels in a typical image are highly correlated, it is possible to extract a great deal of information about a pixel from its neighboring pixel values. Predictive coding is a simple method for spatial redundancy reduction. In this method, a pixel value is predicted by a set of previously encoded adjacent pixels using a suitable prediction model. For an ideal prediction model, the predicted value of the pixel can be equal to the actual value. But that is not the case in reality. Using an effective prediction model, we can
THE JPEG LOSSLESS CODING ALGORITHM
predict the pixel value, which is very close to its actual value and hence error of prediction can be very small.
A practical approach to the prediction model is to take a linear combination of the previously encoded immediate neighboring adjacent pixels. The reason for taking the previously encoded pixel values is that the same values will be available to the decoder when it decodes the pixels in the same order they were encoded by the encoder. The difference between the actual pixel value and the predicted value is called the differential or the prediction error value. The prediction error is then entropy encoded using a variable-length encoding technique to generate compressed image. This method is popularly known as Differential Pulse Code Modulation (DPCM).
In lossless JPEG algorithm, the value of a pixel in any pixel location in the image is first predicted by using one or more of the previously encoded adjacent pixels A, B, and C as shown in Figure 3.1(a) to predict pixel X. It then encodes the difference between the pixel and its predicted value, usually called the prediction error or prediction residual, by either Huffman coding or arithmetic coding.
Fig. 3.1 (a) Three-pixel prediction neighborhood, (b) Encoder diagram in lossless mode.
There are eight possible options for prediction as shown in Table 3.1. The No prediction option 0 in Table 3.1 is available only for differential coding in the JPEG hierarchical mode. We briefly discuss the essence of the hierarchical mode of coding later in this chapter. Options 1 to 3 are one-dimensional predictors and options 4 to 7 are two-dimensional predictors. Depending on the nature of the image, one predictor may yield better compression results compared to any other predictor. However, experimental results for various