0% found this document useful (0 votes)
54 views8 pages

An Overview of The Mpeg Compression Algorithm: Technical Note

gkhgk

Uploaded by

jhfjfj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views8 pages

An Overview of The Mpeg Compression Algorithm: Technical Note

gkhgk

Uploaded by

jhfjfj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

TECHNICAL NOTE

AN OVERVIEW OF THE MPEG COMPRESSION ALGORITHM

CONTENTS Page
I MPEG-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
I.1 ALGORITHM STRUCTURE AND TERMINOLOGY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
I.2 MPEG-1 COMPRESSION ALGORITHM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
I.3 TEMPORAL COMPRESSION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
I.4 PREDICTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
I.5 INTERPOLATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
I.6 SPATIAL COMPRESSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
II MPEG-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
II.1 FIELD PREDICTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.2 DUAL-PRIME PREDICTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.3 EXTENDED MOTION VECTOR RANGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.4 FRAME/FIELD DCT CODING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.5 CONCEALMENT MOTION VECTORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.6 ALTERNATIVE ZIG-ZAG SCAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.7 INCREASED DCT COEFFICIENT PRECISION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.8 ALTERNATIVE INTRA VLCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.9 NON-LINEAR QUANTIZER SCALE MAPPING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.10 ALTERNATIVE IDCT MISMATCH CONTROL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
II.11 PAN-SCAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

There are now two MPEG standards, MPEG-1 and TV systems, compressing fully interlaced TV
MPEG-2. resolution pictures to a bitrate up to around
The MPEG-1 standard was developed in response 20Mbps.
to industry needs for an efficient way of storing and A version of MPEG-2 will also be used for the next
retrieving video information on digital storage me- generation of HDTV systems.
dia. One inexpensive medium is the CD-ROM Two other relevant international standards were
which can deliver data at approximately 1.2Mbps, also being developed during the work of the MPEG
the MPEG-1 standard was subsequently aimed at committee : H.261 by CCITT aimed at telecommu-
this data rate, in fact the data rate is variable and nications applications and ISO 10918 by the ISO
all decoders must be able to decode at rates up to JPEG committee aimed at the coding of still pic-
1.856Mbps. Although the standard was developed tures. Elements of both standards were incorpo-
with CD-ROM in mind, other storage and transmis- rated into the MPEG standard, but subsequent
sion media can include DAT, Winchester Disk, Op- development work by the committee resulted in
tical Disk, ISDN and LAN. It is also important to say coding elements found in neither.
that it is common for double speed CD-ROMs to be Some of the participants in the MPEG committee
used nowadays and it is genarally accepted that include : I NTEL, BELLCORE, DEC, IBM,
any MPEG-1 decoder system should be able to JVC Corp, PHILIPS CE, SGS-THOMSON, TCE,
decode at up to 3Mbps. SONY Corp, NEC Corp and MATSUSHITA IEC.
The MPEG-2 standard was conceived to support These may not be the most important members
the need for Digital Video Broadcating. The of the committee but it gives an indication of the
standard has been generally accepted for Digital relevant importance of the MPEG standard.

AN652/0294 1/6
MPEG VIDEO OVERVIEW

I - MPEG-1
Although the MPEG-1 standard is quite flexible, the applied at this block level. Each block contains 64
basic algorithms have been tuned to work well at component Pixels arranged in an 8x8 array (Fig-
data rates from 1 to 1.5 Mbps, at resolutions of ure 3).
about 350 by 250 Pixels at picture rates of up to 25 There are four picture types : I pictures or INTRA
or 30 pictures per second. MPEG-1 codes progres- pictures, which are coded without reference to any
sively-scanned images and does not recognise the other pictures; P pictures or PREDICTED pictures
concept of interlace, interlaced source video must which are coded using motion compensation from
be converted to a non interlace format prior to a previous picture; B pictures or BIDIRECTION-
encoding. The format of the coded video allows ALLY predicted pictures which are coded using
forward play and pause, typical coding and decod- interpolation from a previous and a future picture
ing methods allow random access, fast forward and and D pictures or DC pictures in which only the low
reverse play also, the requirements for these func- frequency component is coded and which are only
tions are very much application dependent and intended for fast forward search mode. B and P
different encoding techniques will include varying pictures are often called Inter pictures. Some other
levels of flexibility to account for these functions. terminology that is often used are the terms M and
Compression of the digitised video comes from the N, M+1 represents the number of frames between
use of several techniques : Sub sampling of the successive I and P pictures whereas N+1 repre-
chroma information to match the human visual sents the number of frames between successive I
system, differential coding to exploit spatial redun- pictures. M and N can be varied according to
dancy, motion compensation to exploit temporal different applications and requirements such as
redundancy, Discrete Cosine Transform (DCT) to fast random access.
match typical image statistics, quantization, vari- A typical coding scheme will contain a mix of I,P
able length coding, entropy coding and use of and B pictures. A typical scheme will have an I
interpolated pictures. picture every 10 to 15 pictures and two B pictures
between succesive I and P pictures (Figure 4).
I.1 - Algorithm Structure and Terminology
The MPEG hierarchy is arranged into layers (Fig- I.2 - MPEG-1 Compression Algorithm
ure 1). This layered structure is designed for flexi- The MPEG-1 algorithm is based around two key
bility and management efficiency, each layer is techniques : -temporal compression and spatial
intended to support a specific function i.e. the compression. Temporal compression relies upon
sequence layer specifies sequence parameters similarity between successive pictures using pre-
such as picture size, aspect ratio, picture rate, bit diction and motion compensation whereas spatial
rate etcetera , whereas the picture layer defines compression relies upon redundancy within small
parameters such as the temporal reference and areas of a picture and is based around the DCT
picture type. This layered structure improves ro- transform, quantization and entropy coding tech-
bustness and reduces susceptibility to data corrup- niques.
tion.
For convenience of coding, macroblocks are di- I.3 - Temporal Compression
vided into six blocks of component Pixels - four Inter (B and P) pictures are coded using motion
luma and two chroma (Cr and Cb) (Figure 2). compensation, primarily prediction and interpola-
Blocks are the basic coding unit and the DCT is tion.

2/6
MPEG VIDEO OVERVIEW

Figure 1 : MPEG Bistream Hierarchy

Picture and aspect ratio


Picture rate
Bit rate
Minimum decoder buffer size
Sequence Constrained parameters flag
(Intra quantization table)
(Non-intra quantization table)
(User data)

Time Code
Group of Picture Closed GOP flag
Broken link flag
(User data)

Temporal Reference
Picture type (I/P/B/D)
Picture Decoder buffer initial occupancy
(Forward motion vector resolution and range)
(Backward motion vector resolution and range)
(User data)

Slice vertical position


Slice
Quantizer scale

(Stuffing)
Address increment (VLC)
Macroblock type (VLC)
Macroblock (Quantizer scale)
(Forward motion vector) (VLC)
(Backward motion vector) (VLC)
AN652-01.EPS

(Coded block pattern) (VLC)


(DCT coefficients for up to 6 blocks) (VLC)

3/6
MPEG VIDEO OVERVIEW

Figure 2 : Macroblock Structure Figure 3 : Block Structure

0 1 4 5

2 3

AN652-03.EPS
AN652-02.EPS
Y Cr Cb

Figure 4 : Typical sequence of pictures in display order

I P B

AN652-04.EPS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

I.4 - Prediction macroblock level).


The predicted picture is the previous picture modi- Pictures are not transmitted in display order but in
fied by motion compensation. Motion vectors are the order in which the decoder requires them to
calculated for each macroblock. The motion vector decode the bitstream (the decoder must of course
is applied to all four luminance blocks in the macro have the reference picture(s) before any interpo-
block. The motion vector for both chrominance lated or predicted pictures can be decoded).
blocks is calculated from the luma vector. This
technique relies upon the assumption that within a Figure 5 : Make up of I, B and P pictures
macroblock the difference between successive pic- I B B P
tures can be represented simply as a vector trans-
form (i.e. there is very little difference between
successive pictures, the key difference being in
position of the Pixels) (Figure 5).

I.5 - Interpolation
Interpolation (or bidirectional prediction) generates
AN652-05.EPS

high compression in that the picture is represented


simply as an interpolation between the past and
future I or P pictures (again this is performed on a

Figure 6 : Typical sequence of pictures in transmission order


AN652-06.EPS

0 3 1 2 6 4 5 9 7 8 12 10 11 15 13 14

4/6
MPEG VIDEO OVERVIEW

I.6 - Spatial Compression II - MPEG-2


The spatial compression techniques are similar to MPEG-2 was developed in response to the growing
those of JPEG , DCT, Quantization and entropy need for a generic coding method of moving pic-
coding. The compression algorithm takes advan- tures and associated sound for various applications
tage of the redundancy within each block (8 x 8 such as digital storage media and TV broadcasting.
Pixels). The key applications targetted by MPEG-2 are :
The resulting compressed datastream is made up CATV, DBS and DAB.
of a combination of spatial and temporal compres-
sion techniques which best suit the type of picture Within the standard, there are various "levels" and
being compressed. Decoding is controlled through "profiles", these are essentially a set of constraints
the use of MPEG system codes which are put into imposed on parameters of the bistream, it is not
the data stream explaining how to reconstruct spe- practical today to develop systems with the ability
cific areas of picture - as shown in Figure 1. to decode pictures as large as 2E14 pixels wide
Through a combination of techniques, MPEG-1 by 2E14 lines high (these sizes are within the
compression is designed to give good quality (typi- standard). The development of the profiles and
cally similar or better quality to VHS) images from levels allows constrained MPEG-2 compatible sys-
such storage media as CD-ROM. The quality is tems, the key levels and profiles in todays systems
however, dependent upon the type of picture com- are : MAIN PROFILE@MAINLEVEL (MP@ML),
pressed and the level of redundancy within the MAIN PROFILE@LOW LEVEL (MP@LL), SIMPLE
sequence coded. Picture quality will also depend PROFILE@MAIN LEVEL (SP@ML) and SIMPLE
upon how well the sequence has been coded and PROFILE@LOW LEVEL (SP@LL). The typical pic-
which features are required - For Example : For fast ture resolution of these images are 720x576x30fps
random access, N will tend towards zero hence the and lower. These profiles and levels, ensure
quality of compression will deteriorate, if random MPEG-2 compatibility between all decoders and
access is not required then the number of P and B encoders.
frames can increase, hence increasing the poten- MPEG-2 is different from MPEG-1 in that it sup-
tial quality. The standard does not specify a method ports interlaced modes and more complex sam-
of compression but a syntax for the compressed pling structures (Figure 7).
data, this allows for differing compression tech-
The compression theory of MPEG-2 is the same as
niques depending upon differing requirements. The in MPEG-1, compression is achieved through the
decoding techniques are defined due to the nature
same techniques.
of the compressed data stream.
This method allows for true flexibility in coding The inclusion of fields (i.e. interlaced frames) in
whilst retaining the format and hierarchy ensuring MPEG-2 means that the Prediction modes in
compatibility in the datastream and hence uniform MPEG-2 are far more complex than in MPEG-1, it
readability. is here where most of the differences lie.
Figure 7 : Frame Pictures and Field Pictures
MPEG2 sequence

progressive
non-progressive
( pictures are frames )

field picture(s) frame picture(s)

top
bottom
AN652-07.EPS

5/6
MPEG VIDEO OVERVIEW

Relevant MPEG-2 Modes are as follows : taining data from a single field.

II.1 - Field Prediction II.7 - Increased DCT Coefficient Precision


With fied prediction, the predictors in each field are MPEG-2 decoders must be able to handle DCT
independent. In a P frame picture with field predic- coefficients in the range -2047 to 2048 (12 bits).
tion, the prediction is from two fields of the most The range in MPEG-1 is -256 to 255.
recently decoded I- or P- frame. Picture prediction
of a B- frame picture requires up to 4 vectors. The II.8 - Alternative Intra VLCs
predictions for each field are formed by averaging The precision to which the DC coefficients of intra-
the forward and backward predictors. coded blocks are coded can be changed every
picture. Values of 8, 9 or 10 bits are allowed in
II.2 - Dual-prime Prediction MPEG-2 MP@ML (the precision is fixed at 8 bits in
This prediction mode is applicable to sequences in MPEG-1). There is also the option in MPEG-2 to
which there are no B-pictures. Only one vector, select at the picture layer an alternative, more
plus a small differential vector, is sent with every efficient, VLC table for coding the intra DCT coeffi-
macroblock. All necessary vectors are derived from cients. This selection is independent of the intra DC
these. precision selection.

II.3 - Extended Motion Vector Range II.9 - Non-Linear Quantizer Scale Mapping
In MPEG-1 the maximum motion vector range is Two mappings are defined between the 5-bit quan-
-1024 to 1023 for full-pel resolution, and -512 tizer scale code transmitted in the bistream and
to 511.5 for half-pel resolution. MPEG-2 specifies the actual quantizer scale. The first mapping is
a maximum range of -2048 to 2047.5 at half-pel linear, as in MPEG-1. The alternative mapping is
resolution ; full-pel resolution is not defined. MPEG- non-linear and is designed to give a finer control of
2 MP@ML specifies a vertical range of -128 to quantizer scale when the values are low. Which
127.5 and horizontal range of -1024 to 1023.5. mapping is used is defined at the picture layer of
the bistream.
II.4 - Frame/Field DCT Coding
II.10 - Alternative IDCT Mismatch Control
The luminance part of macroblock data may be
The coefficients at the input to the IDCT are modi-
reordered before the IDCT is performed on the fied in order to avoid certain patterns of data.
blocks. The frame ordering is the same as that used
This operation reduces the mismatch of outputs
in MPEG-1.
between different IDCT implementations, specifi-
cally in the encoder and decoder. In MPEG-1 the
II.5 - Concealment Motion Vectors dequantized AC coefficients are forced to be odd
The option exits in MPEG-2 to transmit motion before saturation. In MPEG-2 all of the coefficients
vectors with intra macroblocks. This additional in- of a block are summed after the saturation stage.
formation is intended to be used when data is lost If this sum even, the the last coefficient is changed
due to errors in the bitsteam. In this case the lost by 1.
macroblocks are reconstructed as if they were
skipped macroblocks in a forward predicted field or II.11 - Pan-Scan
frame. The motion vectors are those which have Information is transmitted in the bistream which
been stored by the decoder in the previous row of defines the dimensions and location of the display-
macroblocks. able region within the encoded picture. The position
of this window can be changed every field. This
II.6 - Alternative Zig-Zag Scan feature is useful, for example, when displaying part
MPEG-2 allows two zig-zag block scanning pat- of a 16/9-format coded picture on a 4/3-format
terns. Which one is used is specified in the picture display. The MPEG-2 standard does not specify
layer of the bistream. The second pattern is in- what should be done with this information, since it
tended to maximise the run lenghts of blocks con- affects the display and not the decoding process.

6/6
Information furnished is believed to be accurate and reliable. However, SGS-THOMSON Microelectronics assumes no responsibility
for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result
from its use. No licence is granted by implication or otherwise under any patent or patent rights of SGS-THOMSON Microelectronics.
Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all
information previously supplied. SGS-THOMSON Microelectronics products are not authorized for use as critical components in life
support devices or systems without express written approval of SGS-THOMSON Microelectronics.

© 1994 SGS-THOMSON Microelectronics - All Rights Reserved

Purchase of I2C Components of SGS-THOMSON Microelectronics, conveys a license under the Philips
I2C Patent. Rights to use these components in a I2C system, is granted provided that the system conforms to
the I2C Standard Specifications as defined by Philips.

SGS-THOMSON Microelectronics GROUP OF COMPANIES


Australia - Brazil - China - France - Germany - Hong Kong - Italy - Japan - Korea - Malaysia - Malta - Morocco
The Netherlands - Singapore - Spain - Sweden - Switzerland - Taiwan - Thailand - United Kingdom - U.S.A.
This datasheet has been download from:

www.datasheetcatalog.com

Datasheets for electronics components.

You might also like