Table of Contents
Page 3 of 4
Ordering of Encoding
As well as the actual algorithm employed to compress an image, it is necessay to look at the way in which the JPEG standard orders the images which are to be transmitted or compressed. There are, for each image, three compressed streams of data. Two of these are for the chrominance channels and one is for the luminance channel. There has to be some set method which the system follows to order the compressed data streams.
Generally, the information, which can be observed as is shown in the diagrams, is placed into the data stream in a "raster-scan" order. This is given its name because the way in which a TV image is written to the screen is in this fashion, this is known as a raster scan also. Generally, the data is ordered form left-to-right and from top-to-bottom. This is shown in figure 1 below.
Figure 1. Raster - Scan Ordering of Source Image
It is also possible to interleave the data units so that one line of information is transmitted from each of the images at any one time. What this means, in terms of image reproduction at the decoding end, is that the image can be reproduced in a different manner from the raster scan approach.
1 of 3 28-Sep-98 9:03 AM
Compression Techniques Tutorial - JPEG Page 3 of 4 http://www.dcs.ed.ac.uk/home/djxs/project/jpeg3.html
When considering the interleaving method of control, there are a number of quantization tables and Huffman or entropy tables which need to be transmitted as well. JPEG decoders are able to store up to 4 different quantization tables and up to 4 different sets of entropy tables at any one time. It is essential that the decoder is able to store more than one table because it shall undoubtedly need to change between tables as the data which may be in the process of being decoded could come from a different matrix than the information which was being decoded a moment before. See Figure 2 for a diagramatic explanation of this.
Figure 2. Table and Matrix Switching in Interleave Process
Allthough splitting the image into a series of 8*8 blocks is useful for stages such as DCT, there is a strong possibility of losing scope for compression. Take, for instance, the case where you have three vertically sequential matrices. If there is a large area of colour in the image which spans the three matrices, it could be more effectively compressed if the matrix was larger, or was of variable dimensions other than 8*8.
Decompression Procedure
The decompression process simply reverses the compression process. The decompressor multiplies the reduced coefficients by the quantization table, which the decoder has in its possession, in order to produce the DCT coefficients. These newly produced DCT coefficients are obvioudly approximation to those which were encoded. This is due to the round-off error which was discussed earlier. Since these values are only approximate, the pixel values which are generated byt he next step of the decoding process are also approximate to the values which were originally encoding. As you can image the loss
2 of 3 28-Sep-98 9:03 AM
Compression Techniques Tutorial - JPEG Page 3 of 4 http://www.dcs.ed.ac.uk/home/djxs/project/jpeg3.html
on the image is building up gradually as the image is regenerated. However, due to the construction of the JPEG standard these losses can most of the time be seen as negligable - or not seen as the case may be!
Some high quality decompression systems are able to add smoothing staeps to the process which aim to reduce the pixel discontinuities and make the image seem much clearer for the user.
JPEG is not always ideal
Some reasons:-
JPEG does not fit every compression need. Large areas of a single colour do not compress very well with JPEG. Problems are also caused with sharp colour changes.
JPEG can be rather slow when implemented in software only. If fast decompression is required, a hardware based solution may be the best way to go.
JPEG is very difficult to implement. It is very difficult for an individual to write their own JPEG encoder/decoder. Libraries are available from various sources and throught he Internet.
JPEG is not supported by many file formats. The formats that do support JPEG are all fairly new and can be expected to be revised frequently.
Table of Contents
Table of Contents
Run Length Encoding | Statistical Encoding Huffman Coding | Lempel Ziv
Source Encoding Differential Encoding| JPEG | JPEG Page 2 | JPEG Page 3 | JPEG Page 4 |
MPEG
Derek Sansom
Last modified: Thu Mar 19 19:16:58 GMT 1998 Press Here for Help
3 of 3 28-Sep-98 9:03 AM
Compression Techniques Tutorial - JPEG Page 3 of 4 http://www.dcs.ed.ac.uk/home/djxs/project/jpeg3.html