MPEG Video Compression Standard

An MPEG compressed video bitstream cannot stand alone. Aside from the fact that video alone is not considered a valid bitstream, the presentation time information coded in the system layer is essential to meet real time compliance requirements. Even though both audio and video are needed for many applications, the video and system layers together do make up a complete MPEG stream. This relationship between video and systems is even stronger in MPEG-2.
This chapter reviews the MPEG systems standard. An overview is presented first; this is followed by detailed pseudocode and flowcharts for the system syntax.
The system and video layers contain unique byte-aligned 32-bit patterns called start codes. These codes, as the name would suggest, start certain high-level segments of the bitstream. With some care to avoid accidental emulation in some types of data, these start codes can be located without parsing the bitstream.
The start codes all have a three-byte prefix of 23 zero bits followed by a 1 bit; the final byte (called the start code value in MPEG-2) then identifies the particular start code. Start codes may be preceded with as many zero bytes (or zero bits) as desired. The byte alignment is easily maintained in the system layer because the headers are always multiples of bytes, regardless of the combinations of optional fields.
The byte alignment of start codes is achieved by stuffing as many 0 bits as needed to get to byte alignment. Zero...