[Graphic] MPEG-2 compression coding technology principle application (1)

Source: Internet
Author: User
Tags coding standards

 

Guo Bin, Professor of the Department of television engineering, Beijing Broadcasting Institute


MPEG is a motion image Expert Group (Moving Picture Experts)
The abbreviation of group is essentially named 29th of the Joint Technical Committee (JTC) 1 of the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC ).
Sub-committee working group 11th, namely ISO/IEC
JTC1/sc29/wg11, founded in 1988. Its task is to develop world-wide video and audio coding standards. Because the massive amount of data produced by the digitalization of broadcast and television,
Processing capability and spectrum resource utilization rate put forward unrealistic requirements, making it difficult to achieve digitalization. Therefore, the Expert Group is based on the spatial correlation between adjacent pixels and adjacent lines of the intra-frame images and the motion images between adjacent frames.
Time Correlation: compression encoding technology is used to discard things and redundant components that are less important to human visual images and human ears. This reduces the amount of data stored, transmitted, and processed, improves spectrum resources
Utilization rate. A series of MPEG standards are developed as shown in table 1, making digitization a reality. Among them, MPEG-2 is a set of international standards for video and audio compression encoding and data stream format. It defines
Coding and decoding technology and data stream transmission protocol; develop a common standard between MPEG-2 Decoder (there is no common standard between MPEG-2 encoder ). In this paper, the MPEG-2 system, MPEG-
2, and the application of MPEG-2, discuss the MPEG-2 compression coding technology.

1. MPEG-2 System

1. system definition


A MPEG-2 system combines one or more basic streams of video, audio, and other data into one or more data streams suitable for storage or transmission, as shown in 1. As shown in figure 1, it conforms to the ITU-R.
The 601 standard and frame sequence are i1b2b3p4b5b6p7b8b9i10 digital video data and digital audio data conforming to the AEs/EBU standard are respectively encoded by image encoding and sound encoding.
The generation order is i1p4b2b3 p7b5b6i10.
B8b9 basic video streams (ES) and audio es. A time benchmark is also added to the video es, that is, the 27mhz clock retrieved from the video signal is added. Then, they are formed through their respective data packets.
To package the corresponding es into a basic stream (PES) package and the PES package. Finally, program multiplexing and transmission multiplexing combine the video PES and audio PES into corresponding program streams.
The (PS) package and the Transfer Stream (TS) package, and the PS package and the TS package. Obviously, PES cannot be transmitted directly, but only PS and TS can be transmitted; PES can only be converted to ts or
The intermediate step or bridge between TS and PS is the logical structure of MPEG data stream interchange and cannot be involved in switching and interoperability. The task of the MPEG-2 system is known by the definition of the system.


2. System Tasks


The MPEG-2 standard consists of 8 files as shown in table 2, and the MPEG-2 system is a key part of it. MPEG is interconnected with Open Systems (OSI-Open System)
And strive for global standardization. Based on the detailed description of the audio and video encoding algorithm, a unified entry is created for the transmission and exchange of encoding data streams (bit streams, code streams, streams ).
. In order to facilitate the reconstruction of the receiver, the data stream is "packaged" to a certain extent according to the established parameters ". Therefore, the MPEG-2 system should complete the following tasks:

● Protocol for data transmission in package mode;
● Create conditions for synchronization of data streams between the sending and receiving ends;
● Determine the principles of merging and separating multiple data streams (that is, reusing and reusing;
● Provides a possibility of encrypted data transmission.

From the system task, we can see the foundation of the system to complete the task.

3. Key points of the system


According to the mechanism that the amount of information in digital communication can be transmitted one by one, the encoded data stream is divided into the smallest Information Unit that cannot be subdivided in a certain repeating cycle at a time. This minimum information unit is defined as a data packet, quantity
A small packet (data packet) can be packaged into a large packet (Data
Pack ). The advantage of data packet transmission is that the information in the network can occupy different connection lines and simple temporary storage; multiple data streams can be combined (reused) into a new data stream through data packet intertwined; this facilitates decoder to press
The camera should arrange the data packets flexibly in sequence. Thus, data packets lay the foundation for data stream synchronization and reuse. Therefore, the MPEG-2 system specification not only uses ps, TS and PES data packets
It also involves two data streams that can be converted from PS to ts. Apparently, data stream storage and transmission in the form of data packets is the key point of the MPEG-2 system. To this end, the MPEG-2 System Specification defines three types of data
Package and two data streams:

1) package the basic stream (PES)

Video basic streams (ES-elementary) encoded by compressing MPEG-2
Stream) data is grouped into packets with Variable Length, called PES-packetized elementary
Stream ). Broadly speaking, PES is a package of specialized video, audio, Data, synchronization, and identification information data channels. Elasticsearch is a data stream that contains only one source encoder. That is, ES is encoded.
Video data streams, audio data streams encoded, or other encoded data streams. Each ES is composed of several access units (Au-access ).
Unit). Each video AU or audio au consists of the header and the encoded data. Set the frame sequence to i1p4b2b3p7b5b6.
By packaging, ES is converted into PES Packages containing only one type of elasticsearch. For example, PES Packages containing only video elasticsearch and PES Packages containing only audio elasticsearch, PES packages that only contain other elasticsearch instances. PES
The package composition is shown in figure 2.

As shown in figure 2, one PES package consists of three parts: Baotou, elasticsearch-specific information, and pack data. Because the unique information of Baotou and ES can combine one data header, one PES packet is considered to be composed of two parts: Data header and package data (payload.


The header consists of the starting code prefix, data stream recognition, and PES packet length information. The prefix of the package start code is composed of 23 consecutive "0" and 1 "1". It is used to identify data streams of useful information types.
An integer of 8 bits. A Dedicated Packet start code is synthesized from the two to identify the nature and serial number of the data stream (video, audio, or other) to which the data packet belongs. For example:

Bit Order 1 1 0 x is the MPEG-2 audio data stream with the number x;
Bit Order 1 1 1 0 x is the number of x number of the MPEG-2 video data stream.


The PES package length is used for packet length identification, indicating the number of bytes after this field. For example, the PES package length is identified as 2 B, that is, 2 × 8 = 16 bit word width, and the total package length is 216-1 = 65535
B. distributed to data header 9 B (packet header 6 B + elasticsearch-specific information 3 B). The maximum data capacity of a variable-length package is 65526 B. Although the maximum length of the PES package can reach (216
-1) = 65535
B (byte), but generally it is the length of one au consisting of the header and the encoded data in several AU s that constitute es. One AU is equivalent to one video image or one audio.
Frame, see the es to PES in the upper-right corner of Figure 2. It can also be said that each Au is actually the display unit of the encoded data stream, that is, the sampling of a decoded video image or an audio frame.


Elasticsearch-specific information is the PES packet control information consisting of the PES packet header identification mark, PES packet header length information, information area, and padding byte used to adjust the variable packet length in the information area. PES header Recognition
The logo consists of 12 parts: PES Disturbance Control Information, PES priority indication, data adapter positioning indicator, copyright indication, original or copy indication, and whether the time mark is displayed (PTS-
Presentation Time Stamp)/decoding time mark (DTS-Decode time)
Stamp) flag and PES headers whether there are basic stream clock benchmarks (ESCR-elementary stream clock
Reference) Information Mark, PES header, basic stream rate information mark, digital storage media (DSM) stunt mode information mark, additional copy information mark, PES Header
No cyclic redundancy check (CRC-cyclic redundancy)
Check) Information flag and PES extension flag. There is an extension flag, indicating that other information exists. For example, when there is a transmission error code, the data packet counter is used to enable the acceptor to accurately recover data.
Stream, or identify whether data packets are lost during transmission with the help of the counter status.


The existence of the PTS/DTS mark is the key to solving synchronous display of video and audio and preventing overflow or underflow of the decoder input cache. Because PTS indicates that the display unit appears in the system target Decoder
(STD-system target decoder) Time,
DTS indicates the time when all the bytes of the access unit are removed from the es decoder cache of STD. The es of the video encoding image frame sequence i1p4b2b3p7b5b6i10b8b9.
After pts/DTS, package them into video PES packages. Each PES package has a header that defines the data content in PES and provides scheduled data. Each I, P, and B frame has a header
PTS and DTS, but PTS and DTs are the same for B frames and do not need to mark the data transmission of B frames. Before I and P frames are displayed, they must be stored in the re-Sort cache of the video decoder.
(Re-sorting) and then display, must indicate PTS and DTS respectively. For example, if the frame sequence of the image input by the decoder is i1p4b2b3p7b5b6i10b8b9
In sequence, P4 must be earlier than B2 and B3, but when it is displayed, P4 must be later than B2 and B3, that is, P4 must be guided by the time mark in the data stream inserted in advance, reordered by the cache to re-encode the front view
Frequency frame sequence i1b2b3p4b5b6p7b8b9i10. Obviously, the PTS/DTS logo indicates the existence of a dedicated time scale for determining events or determining Information Decoding. by using a dedicated time scale decoder, you can
Know the time when the event or information is decoded or displayed. For example, the PTS/DTS mark can be used to determine the encoding, multiplexing, decoding, and reconstruction time. (To be continued)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.