Information Technology Reference
In-Depth Information
Figure 5.41: The structure of an elementary stream. MPEG defines the syntax precisely.
Several GOPs form a sequence which begins with a sequence header containing important data to help the
decoder. It is possible to repeat the header within a sequence, and this helps lock-up in random access
applications. The sequence header describes the MPEG-2 profile and level, whether the video is progressive or
interlaced, whether the chroma is 4:2:0 or 4:2:2, the size of the picture and the aspect ratio of the pixels. The
quantizing matrix used in the spatial coder can also be sent. The sequence begins with a standardized bit pattern
which is detected by a decoder to synchronize the deserialization.
5.18 An MPEG-2 decoder
The decoder is only defined by implication from the definitions of syntax and any decoder which can correctly
interpret all combinations of syntax at a particular profile will be deemed compliant however it works. Compliant
MPEG-2 decoders must be able to decode an MPEG-1 elementary stream. This is not particularly difficult as
MPEG-2 uses all the tools of MPEG-1 and simply adds more of its own. Consequently an MPEG-1 bitstream can
be thought of as a subset of an MPEG-2 bitstream.
The first problem a decoder has is that the input is an endless bitstream which contains a huge range of
parameters many of which have variable length. Unique synchronizing patterns must be placed periodically
throughout the bitstream so that the decoder can identify known starting points. The pictures which can be sent
under MPEG are so flexible that the decoder must first find a sequence header so that it can establish the size of
the picture, the frame rate, the colour coding used, etc.
The decoder must also be supplied with a 27 MHz system clock. In a DVD player, this would come from a crystal,
but in a transmission system this would be provided by a numerically locked loop running from a clock reference
parameter in the bitstream (see Chapter 6 ). Until this loop has achieved lock the decoder cannot function properly.
Figure 5.42 shows a bidirectional decoder. The decoder can only begin decoding with an I picture and as this only
uses intra-coding there will be no vectors. An I picture is transmitted as a series of slices which begin with
subsidiary synchronizing patterns. The first macroblock in the slice contains an absolute DC coefficient, but the
remaining macroblocks code the DC coefficient differentially so the decoder must subtract the differential values
from the previous value to obtain the absolute value.
The AC coefficients are sent as Huffman coded run/size parameters followed by coefficient value codes. The
variable-length Huffman codes are decoded by using a look-up table and extending the number of bits considered
until a match is obtained. This allows the zero-run-length and the coefficient size to be established. The right
number of bits is taken from the bitstream corresponding to the coefficient code and this is decoded to the actual
coefficient using the size parameter.
If the correct number of bits has been taken from the stream, the next bit must be the beginning of the next run/size
code and so on until the EOB symbol is reached. The decoder uses the coefficient values and the zero-run-lengths
to populate a DCT coefficient block following the appropriate zig-zag scanning sequence. Following EOB, the
bitstream then continues with the next DCT block. Clearly this Huffman decoding will work perfectly or not at all. A
single bit slippage in synchronism or a single corrupted data bit can cause a spectacular failure.
Once a complete DCT coefficient block has been received, the coefficients need to be inverse quantized and
inverse weighted. Then an inverse DCT can be performed and this will result in an 8 x 8 pixel block. A series of
DCT blocks will allow the luminance and colour information for an entire macroblock to be decoded and this can be
 
Search WWH ::




Custom Search