User Guide

312 Appendix E, Digital Compression
Run-Length Encoding The combination of DCT and quantization results in many of the
frequency coefficients being zero, especially the coefficients for high spatial frequencies. To
take maximum advantage of this, the coefficients are organized in a zig-zag order to produce
long runs of zeros.
The coefficients are then converted to a series of run-amplitude pairs, each pair indicating a
number of zero coefficients and the amplitude of a non-zero coefficient. These run-
amplitude pairs are then coded with a variable-length code, which uses shorter codes for
commonly occurring pairs and longer codes for less common pairs.
Some blocks of pixels need to be coded more accurately than other. For example, blocks
with smooth intensity gradients need accurate coding to avoid visible block boundaries. To
deal with this inequality between blocks, the MPEG algorithm allows the amount of
quantization to be modified for each 16 × 16 block of pixels. This mechanism can also be
used to provide smooth adaptation to a particular bit rate: