Scan
After quantization, the DCT coefficients for a block are reordered to group together nonzero coefficients, enabling efficient representation of the remaining zero-valued quantized coefficients. The optimum reordering path (scan order) depends on the distribution of nonzero DCT coefficients. For a typical frame block a suitable scan order is a zigzag starting from the DC (top-left) coefficient. Nonzero coefficients tend to be grouped together at the start of the reordered array, followed by long sequences of zeros.
The zigzag scan may not be ideal for a field block because of the skewed coefficient distribution and a modified scan order
"
Run-Level Encoding
The output of the reordering process is an array that typically contains one or more clusters of nonzero coefficients near the start, followed by strings of zero coefficients. The large number of zero values may be encoded to represent them more compactly, for example by representing the array as a series of (run, level) pairs where run indicates the number of zeros preceding a nonzero coefficient and level indicates the magnitude of the nonzero coefficient.
Higher-frequency DCT coefficients are very often quantized to zero and so a reordered block will usually end in a run of zeros. A special case is required to indicate the fin nonzero coefficient in a block.
Example:
Input array: 16,0,0, -3,5,6,0,0,0,0, -7, . . .
Output values: (0,16),(2, -3),(0,5),(0,6),(4, -7). . .
In so-called "Two-dimensional" run-level encoding is used, each run-level pair is encoded as above and a separate code symbol, "last", indicates the end of the nonzero values.
If "Three-dimensional" run-level encoding is used, each symbol encodes three quantities, run, level and last. In the example above, if -7 is the fin nonzero coefficient, the 3D values are:
(0, 16, 0), (2, -3, 0), (0, 5, 0), (0, 6, 0), (4, -7, 1)
The 1 in the fin code indicates that this is the last nonzero coefficient in the block.
No comments:
Post a Comment