Quantization
The next step is the quantization of the frequency coefficients. The coefficients are quantized (ie divided modulo the quantum step size) to reduce their magnitude and increase the number of zero-value coefficients. The step size is varied according to the coefficient location and tuned for each color component as Figures 1-2 and 1-3 show.

Quantization table uses individually weighted quantizers for each AC coefficient, based on measurements of limits of detection by human visual system. Quantization is linear. ie the quantizer is same for all magnitudes of an AC coefficient.

The compression/quality tradeoff is made by multiplying the AC quantizer by a user or application chosen factor. The higher the factor, the greater the compression, and the lower the quality.

Figure 1-3 illustrates two functional matrices that have been optimized for CCIR 601 imagery.

[004.bmp]
Figure 1-2 Quantizer Stepping (Uniform Quantization)

The coding model rearranges the quantized frequency coefficients into a zigzag pattern, with the lowest frequencies first and the highest frequencies last. The zigzag pattern (shown graphically in Figure 1-4 and numerically in Table 1-1) is used to increase the run-length of zero coefficients found in the block. The assumption is that the lower frequencies tend to have larger coefficients and the higher frequencies are (by the nature of most pictures) predominantly zero. As Figure 1-4 illustrates, the first coefficient (0,0) is called the DC coefficient and the remaining coefficients are AC coefficients. The AC coefficients are traversed by the zigzag pattern from the (0,1) location to the (7,7) location.

[005.bmp]
[006.bmp]
[007.bmp]
Fig 1.3 Weighting Functions for Luminance and Chrominance

[008.bmp]
Figure 1-4 Zigzag Reordering of the 8 x8 DCT Coeffecients

[009.bmp]
Table 1-1 Location of Original Coefficients in Reordered Block

The DC coefficients of subsequent blocks often vary only slightly. Therefore, differences between successive DC coefficients are small. The coding of the DC coefficient exploits this property through differential pulse code modulation (DPCM). This technique codes the difference (Delta) between the quantized DC coefficient of the current block and the DC coefficient of the previous block. The formula for the encoding of the DC code is as follows:

[00a.bmp] DCPM of DC Coefficient

The inverse calculation takes place at the decoder.