Professional Documents
Culture Documents
The Joint Photographic Experts Group forms the basis of most video compression algorithms
2-D matrix is required to store the required set of 8-bit grey-level values that represent the image
For the colour image if a CLUT is used then a single matrix of values is required If the image is represented in R, G, B format then three matrices are required If the Y, Cr, Cb format is used then the matrix size for the chrominance components is smaller than the Y matrix ( Reduced representation)
Once the source image format has been selected and prepared (four alternative forms of representation), the set values in each matrix are compressed separately using the DCT
The values are first centred around zero by substracting 128 from each intensity/luminance value
Block preparation is necessary since computing the transformed value for each position in a matrix requires the values in all the locations to be processed
Since the values in all the other locations of the transformed matrix have a frequency coefficient associated with them they are known as AC coefficients
Using DCT there is very little loss of information during the DCT phase
The losses are due to the use of fixed point arithmetic
The main source of information loss occurs during the quantization and entropy encoding stages where the compression takes place The human eye responds primarily to the DC coefficient and the lower frequency coefficients (The higher frequency coefficients below a certain threshold will not be detected by the human eye)
This property is exploited by dropping the spatial frequency coefficients in the transformed matrix (dropped coefficients cannot be retrieved during decoding)
In addition to classifying the spatial frequency components the quantization process aims to reduce the size of the DC and AC coefficients so that less bandwidth is required for their transmission (by using a divisor)
The sensitivity of the eye varies with spatial frequency and hence the amplitude threshold below which the eye will detect a particular frequency also varies The threshold values vary for each of the 64 DCT coefficients and these are held in a 2-D matrix known as the quantization table with the threshold value to be used with a particular DCT coefficient in the corresponding position in the matrix
The choice of threshold value is a compromise between the level of compression that is required and the resulting amount of information loss that is acceptable
JPEG standard has two quantization tables for the luminance and the chrominance coefficients. However, customized tables are allowed and can be sent with the compressed image
Vectoring The entropy encoding operates on a onedimensional string of values (vector). However the output of the quantization is a 2-D matrix and hence this has to be represented in a 1-D form. This is known as vectoring
In order to exploit the presence of the large number of zeros in the quantized matrix, a zig-zag of the matrix is used
number of zeros in the run and value is the next non-zero coefficient
- the quantization table of values that have been used to encode each component
Each scan comprises one or more segments each of which can contain a group of (8X8) blocks preceded by a header This contains the set of Huffman codewords for each block
A JPEG decoder is made up of a number of stages which are simply the corresponding decoder sections of those used in the encoder
JPEG decoding
The JPEG decoder is made up of a number of stages which are the corresponding decoder sections of those used in the encoder
The frame decoder first identifies the encoded bitstream and its associated control information and tables within the various headers It then loads the contents of each table into the related table and passes the control information to the image builder
Then the Huffman decoder carries out the decompression operation using preloaded or the default tables of codewords
JPEG decoding
The two decompressed streams containing the DC and AC coefficients of each block are then passed to the differential and run-length decoders
The resulting matrix of values is then dequantized using either the default or the preloaded values in the quantization table Each resulting block of 8X8 spatial frequency coefficient is passed in turn to the inverse DCT which in turn transforms it back to their spatial form
The image builder then reconstructs the image from these blocks using the control information passed to it by the frame decoder
JPEG Summary
Although complex using JPEG compression ratios of 20:1 can be obtained while still retaining a good quality image This level (20:1) is applied for images with few colour transitions For more complicated images compression ratios of 10:1 are more common Like GIF images it is possible to encode and rebuild the image in a progressive manner. This can be achieved by two different modes progressive mode and hierarchical mode
JPEG Summary
Progressive mode First the DC and low-frequency coefficients of each block are sent and then the highfrequency coefficients
hierarchial mode in this mode, the total image is first sent using a low resolution e.g 320 X 240 and then at a higher resolution 640 X 480