Information Technology Reference
In-Depth Information
Figure 5.33: Run-length and variable-length coding simultaneously compresses runs of zero-valued coefficients
and describes the wordlength of a non-zero coefficient.
In the case where the zero-run-length exceeds 14, a code of 15/0 is used signifying that there are fifteen zero-
valued coefficients. This is then followed by another run/size parameter whose run-length value is added to the
previous fifteen.
The run/size parameters contain redundancy because some combinations are more common than others. Figure
5.33(b) shows that each run/ size value is converted to a variable-length Huffman codeword for transmission. As
was shown in section 1.5 , the Huffman codes are designed so that short codes are never a prefix of long codes so
that the decoder can deduce the parsing by testing an increasing number of bits until a match with the look-up table
is found. Having parsed and decoded the Huffman run/size code, the decoder then knows what the coefficient
wordlength will be and can correctly parse that.
The variable-length coefficient code has to describe a bipolar coefficient, i.e one which can be positive or negative.
Figure 5.33(c) shows that for a particular size, the coding scale has a certain gap in it. For example, all values from
- 7 to + 7 can be sent by a size 3 code, so a size 4 code only has to send the values of - 15 to - 8 and + 8 to + 15.
The coefficient code is sent as a pure binary number whose value ranges from all zeros to all ones where the
maximum value is a function of the size. The number range is divided into two, the lower half of the codes
specifying negative values and the upper half specifying positive.
In the case of positive numbers, the transmitted binary value is the actual coefficient value, whereas in the case of
negative numbers a constant must be subtracted which is a function of the size. In the case of a size 4 code, the
constant is 15 10 . Thus a size 4 parameter of 0111 2 (7 10 ) would be interpreted as 7 - 15 = - 8. A size of 5 has a
constant of 31 so a transmitted coded of 01010 2 (10 2 ) would be interpreted as 10 - 31 = -21.
This technique saves a bit because, for example, 63 values from - 31 to + 31 are coded with only five bits having
only 32 combinations. This is possible because that extra bit is effectively encoded into the run/size parameter.
Figure 5.34 shows the entire MPEG-1 and MPEG-2 spatial coding subsystem. Macroblocks are subdivided into
DCT blocks and the DCT is calculated. The resulting coefficients are multiplied by the weighting matrix and then
requantized. The coefficients are then reordered by the zig-zag scan so that full advantage can be taken of run-
length and variable-length coding. The last non-zero coefficient in the scan is followed by the EOB symbol.
Figure 5.34: A complete spatial coding system which can compress an I picture or the prediction error in P and B
pictures. See text for details.
In predictive coding, sometimes the motion-compensated prediction is nearly exact and so the prediction error will
be almost zero. This can also happen on still parts of the scene. MPEG takes advantage of this by sending a code
to tell the decoder there is no prediction error data for the macroblock concerned.
Search WWH ::




Custom Search