video compression standardscs778/jeffay/lecture4.pdf · 2002. 2. 25. · u video can be (trivially)...

26
1 COMP 249 Advanced Distributed Systems Multimedia Networking http://www.cs.unc.edu/~jeffay/courses/comp249f99 Video Compression Standards Kevin Jeffay Department of Computer Science University of North Carolina at Chapel Hill [email protected] September 14, 1999 2 The Video Data Type Compression Standards u Basic compression techniques » Truncation, CLUT, run-length coding » sub-sampling & interpolation » DPCM » DCT » Huffman coding u Common algorithms » JPEG/MJPEG » H.261/H.263 » MPEG-1,-2

Upload: others

Post on 22-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

1

COMP 249 Advanced Distributed SystemsMultimedia Networking

http://www.cs.unc.edu/~jeffay/courses/comp249f99

Video Compression Standards

Kevin JeffayDepartment of Computer Science

University of North Carolina at Chapel [email protected]

September 14, 1999

2

The Video Data TypeCompression Standards

u Basic compression techniques» Truncation, CLUT, run-length coding

» sub-sampling & interpolation

» DPCM

» DCT

» Huffman coding

u Common algorithms» JPEG/MJPEG

» H.261/H.263

» MPEG-1,-2

Page 2: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

3

Compression AlgorithmsJPEG

u A still image (“continuous tone”) compression standard» DCT-based

u 4 Modes of compression» sequential — image components coded in order scanned

v Baseline — “default compression”

» progressive — image coded in multiple passes so partialimages can be displayed during decoding

» lossless — guaranteed no loss

» hierarchical — image encoded at multiple resolutions

u Typical results» 24:1 compression (1 bpp)

4

JPEG CompressionEncoder architecture — sequential mode

u Inputs are 8 or 12-bit samples» baseline = 8-bit samples

u Image components are compressed separately» DCT operates on 8x8 pixel blocks

Digitized still image(or video frame)

Color-SpaceConvertor

Color-SpaceConvertor

RGB YUV

Compressedcomponentbit-stream

JPEGEncoder

JPEGEncoder

Bit-StreamFormatting

Bit-StreamFormatting

To fileor

network

DCTEncoder

QuantizerEntropyEncoder

LevelShifting

Page 3: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

5

JPEG CompressionQuantization

u DCT coefficient quantization is the key to compression» Quantize according to the visual important of each coefficient

u The application specifies a quantization table» A table of step-sizes from 1-255» Default tables specified for the baseline coder

Step-sizetable

Image Store

DCTEncoder

DCTEncoder QuantizerQuantizer...

17221-9-10-8440

-18-34-86-2-2-3-8

1524-4-5-3-4-4-4

-8-8645653

23-10-5-4-3-462

-911443431

-1414324214

197-116-110

DCTcoefficients

47101316192225

710131619222528

1013161922252831

1316192225283134

1619222528313437

1922252831343740

2225283134374043

2528313437404346

6

JPEG CompressionQuantization example

Image Store

DCTEncoder

DCTEncoder QuantizerQuantizer...

17221-9-10-8440

-18-34-86-2-2-3-8

1524-4-5-3-4-4-4

-8-8645653

23-10-5-4-3-462

-911443431

-1414324214

197-116-110

DCTcoefficients

47101316192225

710131619222528

1013161922252831

1316192225283134

1619222528313437

1922252831343740

2225283134374043

2528313437404346

Step-sizetable

433111000

33100000

22000000

11000000

10000000

00000000

00000000

00000000

u Step-size table can be scaled tocontrol degree of compression» Scaling factor called the

“q-factor”

Page 4: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

7

JPEG CompressionCoding coefficients

u DC coefficients difference-coded» DC coefficients from adjacent 8x8 blocks strongly correlated

u AC coefficients run-length and Huffman coded

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Encoder

EntropyEncoder

Image Store

...

Quantized DCTcoefficients

433111000

33100000

22000000

11000000

10000000

00000000

00000000

00000000

8

372111100

31200000

21000000

10000000

00000000

00000000

00000000

00000000

JPEG CompressionCoding DC coefficients

u DC coefficients DPCM coded and recoded using avariable length entropy (Huffman) code

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Encoder

EntropyEncoder

Image Store

...

391210000

43100000

21000000

00000000

00000000

00000000

00000000

00000000

... ...

... (43-39), ac, ac, ac, ..., (39-37), ac, ac, ac, ...

433110000

33000000

22000000

00000000

00000000

00000000

00000000

00000000

Page 5: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

9

u “Zig-zag” order the AC coefficients toincrease effectiveness of run-lengthcoding» DC,

AC01, AC10,

AC02, AC11, AC20,

AC03, AC12, AC21, AC30,

...

u Run-length code the stream» Each non-zero coefficient encoded as a pair:

JPEG CompressionCoding AC coefficients

...

(run-length of preceding zero coefficients, amplitude of non-zero coefficient)

0 1 2 3 4 5 6 7

0

1

2

3

4

5

6

7

DC AC

AC

...

10

JPEG CompressionCoding AC coefficients

u Each coefficient encoded as a variable length “pair”» ([run length, size], amplitude)

u First element coded using a variable-length Huffman code» A coding table (“code book”) must be provided

v Can be generated on-the-fly with an additional pass over the coefficients

v Up to four code books per image may be specified

v The codebook becomes part of the coded bit-stream

u Second element coded as a variable length integer» whose length is specified in the previous “symbol”

Page 6: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

11

Sequential JPEG Compression SummaryComplete compression pipeline

u Compression comes from:» Chrominance subsampling» DCT coefficient quantization» Difference coding DC

coefficients» Statistical & run-length

coding of AC coefficients

CompressedImage

bit-stream(1 component)

ImageStore

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Encoder

EntropyEncoder

LevelShifting

LevelShifting

Color-SpaceConvertor

Color-SpaceConvertor

000001010011100101110111

...

...

...

...

...

...

...

...

Step-sizeTable

HuffmanCode-book

u Qualitative results:» 0.25 - 0.5 bpp — ok for some

applications» 0.5 - 0.75 bpp — ok for many» 0.75 - 1.5 bpp — excellent» 1.5 - 2.0 — indistinguishable

47101316192225

710131619222528

1013161922252831

1316192225283134

1619222528313437

1922252831343740

2225283134374043

2528313437404346

12

JPEG CompressionExamples of quality v. bpp

4.4 bpp 1.4 bpp 0.9 bpp

0.7 bpp 0.5 bpp 0.4 bpp

Page 7: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

13

JPEG CompressionExamples of quality v. bpp

4.4 bpp 0.7 bpp

14

JPEG CompressionExamples of quality v. bpp

0.7 bpp 0.5 bpp

Page 8: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

15

JPEG CompressionOther modes of operation

u Lossy compression modes» sequential — image components coded in order scanned

v Default mode

» progressive — image coded in multiple passes so partialimages can be displayed during decodingv Useful for transmission of images over slow communications links

» hierarchical — image encoded at multiple resolutionsv Useful for images that will be displayed on heterogeneous displays

u Lossless mode» Guaranteed lossless

» Uses DPCM encoding rather than DCT

16

JPEG Compression ModesLoseless mode operation

u Uses prediction instead of the DCT» Each pixel’s value is expressed as a function of neighboring

pixels

» A code word identifies the predictor being used

A B

C ?

PredictorPrediction

Code

0CBA

C + B – AC + (B – A)/2B + (C – A)/2

(C + B)/2

01234567

Page 9: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

17

JPEG Compression ModesLoseless mode operation

u Predicted samples are DPCM encoded

u Differences are entropy coded as before

u Achieves approximately 2:1 compression

CompressedImage

bit-stream

ImageStore

PredictorPredictor

EntropyEncoder

EntropyEncoder

000001010011100101110111

...

...

...

...

...

...

...

...

HuffmanCode-book

DPCMEncoder

DPCMEncoder

PredictionCodewords

18

JPEG Compression ModesProgressive mode operation

u Encode the image in scans to enable the display of aseries of progressively refined images» Requires an image-sized coefficient buffer between quantizer

& entropy coder» Scans of image components are also interleaved in bit-stream

CompressedImage

bit-stream(n components)

ImageStore

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Encoder

EntropyEncoder

LevelShifting

LevelShifting

Color-SpaceConvertor

Color-SpaceConvertor

________

________

________

________

________

________

________

________

CoefficientBuffer

Page 10: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

19

JPEG Compression ModesProgressive mode operation

u Scan the coefficient buffer in multiple passes» Transmit portions of each coefficient

8x8

pixe

l bloc

ks

Coefficientvalue (bits)

01::

6263

7 6 ... 1 0

DC

T c

oeffi

cien

ts

12

3...

...

...

...

...

......

Transmissionorder First scan

(Most significant bits)

01::

6263

7 6 5

12

3...

...... ...

4Second

scan

...Sequential Encoding “Successive approximation”

...

Thirdscan

3

...

20

JPEG Compression ModesProgressive mode operation

u Scan the coefficient buffer in multiple passes» Transmit portions of each coefficient

8x8

pixe

l bloc

ks

Coefficientvalue (bits)

01::

6263

7 6 ... 1 0

DC

T c

oeffi

cien

ts

12

3...

...

...

...

...

......

Transmissionorder

Sequential Encoding “Spectral selection”

7 6 ... 1 0

First scan

012

12

3...

...

...

...

345 ...

...

...

Second scan

...

Page 11: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

21

JPEG Compression ModeHierarchical mode operation

u Encode the image at multipleresolutions» Each image differs from the previous

by a factor of 2 in either the verticalor horizontal dimension

» Images created by filtering andsubsampling

u Each resolution encoded by eitherthe sequential or progressivealgorithm

22

JPEG Compression ModeHierarchical mode operation

u Start with the lowest desired resolution & iterativelyencode until the full image resolution has been coded» Each iteration encodes an image with a factor of 2 higher

resolution in one dimension

ImageStore

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Encoder

EntropyEncoder

Filter &Down Sample

Filter &Down Sample

DCTDecoder

DCTDecoder

InverseQuantizer

InverseQuantizer

Filter &Up Sample

Filter &Up Sample

DPCMEncoder

DPCMEncoder

Lowest resolution

image

Page 12: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

23

Motion JPEGApplying JPEG to moving images

u Video can be (trivially) encoded as a sequence ofstills» This practice is routine in the digital video editing

world

u The issue is how to encode and transmit “sideinformation”» Quantization tables, Huffman code-book may/may not

change between frames

24

The Video Data TypeCompression Standards

u Basic compression techniques» Truncation, CLUT, run-length coding

» sub-sampling & interpolation

» DPCM

» DCT

» Huffman coding

u Common algorithms» JPEG/MJPEG

» H.261/H.263

» MPEG-1,-2

Page 13: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

25

Compression AlgorithmsH.261 (px64)

u A telecommunications (ITU) standard for audio & videotransmission over digital phone lines (ISDN)

u H.261 primarily intended for interactive video applications» Design of the standard driven by a 150 ms maximum

encoding/decoding delay goal

u A scalable coding architecture capable of generating bitstreams from 64 kbps (“1x64”) to 1,920 kbps (“30x64”)in 64 kbps increments» p = 1, 2 produces a low res “videophone”

(Common use is for ISDN BRI — 112 kbps video, 16 kbps audio)» p ≥ 6 produces an acceptable videoconference and allows

multipoint communication

26

H.261Video formats

u Inputs» 525 or 625 line

composite video» 8 bits/sample» 30 frames/second

u Color space» Y, Cr, Cb

u Outputs» CIF or QCIF

NTSC (440x480)

CIF (352x288)

QCIF (176x144)

» 30, 15, 10, or 7.5 frames/second

Page 14: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

27

H.261Video frame representation

u Chrominance components are subsampled 2:1 horizontally& vertically

u Each video frame is subdivided into 16x16 macroblocks

Y component: 4 8x8 blocks Cr component: 1 8x8 block(same for Cb)

28

H.261Video compression pipeline

u Two compression modes, selectable on a frame-by-framebasis» INTRA-frame mode — DCT-based compression á la JPEG

v video is treated as a sequence of stills

» INTER-frame mode — Incorporates motion estimation & DPCMpredictionv temporal redundancy is eliminated to further improve compression

FrameStore

Color-SpaceConvertor

Color-SpaceConvertor

DCTEncoder

QuantizerEntropy Coder

MotionPredictor

DPCMEncoder

CompressionMode

?

INTER-frame Pipeline INTRA-frame Pipeline

Page 15: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

29

H.261 Video CompressionINTRA-frame mode

u Compression is similar to JPEG» DCT encoding» linear quantization» entropy coding

u Quantization is uniform across all AC coefficients» But is adaptive and driven by the space remaining in a

transmission buffer

LuminanceMacroblock

(16x16 pixel block)DCT

Encoder

DCTEncoder QuantizerQuantizer Entropy

Coder

Entropy Coder

StepSize

StepSize

XmissionControl

XmissionControl

MacroblockBuffer

MacroblockBuffer

8x8pixel

blocks

ChrominanceMacroblocks

(8x8 pixel block)

30

H.261 INTER-Frame ModeMotion estimation & prediction

u Motion estimation is performed only on luminance macroblocks» Compare a luminance macroblock with its neighbors in the

previous frame

» If the difference is small, do not compress the block, only recordlocation of matching block

» If the difference is “large” send the difference between thismacroblock and a previous neighboring macroblock into the DCTcompression pipeline

Framen

Framen–1

Page 16: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

31

H.261 INTER-Frame ModeMotion estimation & prediction

u Finding a predictor is the process of finding the minimallydifferent adjacent 16x16 block in the previous frame» Construct a “motion vector” — a relative displacement w for

block b that minimizes the mean absolute distortion (MAD):

Σ Σ framen[16bx+i, 16by+j] – framen–1[(16bx+wx)+i, (16by+wy)+j]i=0j=0

15 15

Framen

Framen–1

(16bx, 16by)

(16bx+wx, 16by+wy)

1256

(wx, wy)

32

H.261 INTER-Frame ModeMotion compensated prediction

LuminanceMacroblock

MotionVectors

PreviousFrame

PreviousFrame +

FromDCT decode

pipeline

ToDCT encode

pipeline

ThresholdThreshold

no

Motion VectorSearch

DPCMEncoder

Motion Estimation

16x16Difference

Block

16x16Predicted

Block

≤yes

MotionAccuracy

Computation

MotionAccuracy

Computation

Page 17: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

33

LoopFilter

LoopFilter

H.261 INTER-frame ModeComplete pipeline

LuminanceMacroblock

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Coder

Entropy Coder

MotionVectors

PreviousFrame

PreviousFrame

no

yes

StepSize

StepSize Step-Size

Adjustment

+ DCTDecoder

DCTDecoder

XmissionControl

XmissionControl

InverseQuantizer

InverseQuantizer

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Coder

Entropy Coder

StepSize

StepSize

ChrominanceMacroblocks

(8x8 pixel block)

MacroblockBuffer

MacroblockBuffer

= video frame buffer

= 16x16 pixel block

= 8x8 pixel block

= control data

8x8pixelblock

MotionEstimatorMotion

Estimator

34

51 2 3 4 6 7 8 10

23 24 25 26 27 28 29 30 31 32 33

12 13 14 15 16 17 18 19 20 21 22

H.261Video frame representation

u Macroblocks combined into groups of blocks (GOBs)» An 11 by 3 array of macroblocks

176 pixels

48pixels

CIF Image: 12 GOBs

1 23 45 67 89 1011 12

352 pixels

288pixels

QCIF Image: 3 GOBs

135

176 pixels

144pixels

9 11

Page 18: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

35

picture header

H.261 Data TransmissionBit-stream format

u Picture data is hierarchically transmitted

= fixed-length

= variable-length

Group ofBlocksLayer

GOB header MB1 data MB33 data...

PictureLayer GOB1 data ... GOB12 data

BlockLayer EOBDCT coeff DCT coeff...

MacroblockLayer block6 dataMB headerblock1 data ...

36

ITU H.320 Teleconferencing StandardsTeleconferencing over ISDN

u H.261 — Video communications at px64 kbps

u H.221 — Syntax for multiplexing audio and videopackets

u H.230 — Protocol for call setup and negotiation ofend-system (“terminal”) capabilities

u H.242 — Conference control protocol

u G.711 — ISDN audio coding standard at 64 kbps

u G.722 — High-quality audio at 64 kbps

u G.728 — Reduced quality speech at 16 kbps

Page 19: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

37

H.263 Video CompressionLow-bitrate video compression for data networks

u Based on H.261 (& MPEG-1, -2)

u Includes new image formats:

ImageSizeFormat Maximum Number

of coded bits/picture

128 x 96176 x 144352 x 288704 x 576

1,408 x 1,152

sub-QCIFQCIFCIF4CIF16CIF

64642565121024

u Added coding efficiency from:» Unrestricted motion vectors» Bi-directional motion estimation/prediction» Arithmetic coding of AC coefficients

38

H.263 Video CompressionCompanion standards

u H.263 — “Low bit-rate” video coding

u H.324 — Terminal systems

u H.245 — Conference control

u H.223 — Audio/video multiplexing

u G.723 — Audio coding 5.3 and 6.3 kbps

u For Internet conferencing there is also the relatedT.120 Document Conferencing standards family

Page 20: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

39

The Video Data TypeCompression Standards

u Basic compression techniques» Truncation, CLUT, run-length coding

» sub-sampling & interpolation

» DPCM

» DCT

» Huffman coding

u Common algorithms» JPEG/MJPEG

» H.261/H.263

» MPEG-1,-2

40

Compression AlgorithmsMPEG

u A family of audio/video coding schemes» MPEG-1 —A video coding standard for digital storage/

retrieval devicesv “VHS quality” video coded at approximately 1.5 Mbps

» MPEG-2 — Video coding for digital televisionv SIF/CIF to HDTV resolutions at data rates up to 100 Mbps

» MPEG-4 — Coding of audio/visual “objects” for multimediaapplicationsv Coding of natural & synthetic images

v Object-based encoding for content access & manipulation

» MPEG-7 — A content/meta-data representation standard forcontent search and retrieval

Page 21: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

41

MPEG-1 Video CompressionRequirements

u MPEG intended primarily for stored video applications» A “generic” standard

» But a basic assumption is that video will be coded once andplayed multiple times

u Support for VCR-like operations» Fast forward/forward scan

» Rewind/reverse scan

» Direct random access

» ...

42

MPEG-1 Video CompressionRelation to H.261

u … but with more aggressive motion compensation:» prediction — approximately the same as in H.261» interpolation (bi-directional prediction)» DPCM encoding of motion vectors

16x16Macro-block

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Coder

Entropy Coder

MotionVectors

PreviousFrame

PreviousFrame + DCT

Decoder

DCTDecoder

InverseQuantizer

InverseQuantizer

MacroblockBuffer

MacroblockBuffer

8x8pixelblockMotion

EstimatorMotion

Estimator

u Similar to H.261...» INTER and INTRA picture types, entropy encoded, motion

compensated, DCT-based compression...

Page 22: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

43

MPEG-1 Video CompressionRelation to JPEG

u Non-uniform quantization for intra-coded pictures» Uniform quantization for inter-coded pictures

16x16Macro-block

DCTEncoder

DCTEncoder QuantizerQuantizer Entropy

Coder

Entropy Coder

MotionVectors

PreviousFrame

PreviousFrame + DCT

Decoder

DCTDecoder

InverseQuantizer

InverseQuantizer

MacroblockBuffer

MacroblockBuffer

8x8pixelblockMotion

EstimatorMotion

Estimator

Step-sizetable

816192222262627

1619222226272729

1922262627292935

2224272729323438

2627292932353846

2729343435404656

2934343740485669

3437384048586983

44

MPEG Video CompressionMotion compensated prediction

u The predictor search space is not specified in the standard» Implementations can perform as exhaustive a search as they

desire

u Find the motion vector w that minimizes some costfunction f

Σ Σ f(framen[16bx+i, 16by+j] – framen–1[16bx+wx+i, 16bx+wy+j])i=0j=0

15 15

w

Framen

Framen–k

Page 23: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

45

MPEG Motion Compensated PredictionBi-directional prediction

u Besides simple prediction, interpolation (bi-directionalprediction) is used to achieve further compression

u A future frame and a past frame are used to predict thecurrent frame» Deals effectively with scene changes and new object appearances

» Produces predictors (pairs) with better statistical properties

Frame n+k2

Frame n–k1

Frame n

46

MPEG Motion Compensated PredictionBi-directional prediction

u MPEG defines three picture (frame) types:» I — intracoded pictures coded as a still image

» P — predicted pictures predicted from the previous I or P picture» B — interpolated pictures predicted from the previous I or P

picture and the next I or P picture

I B B B P B B B I

Page 24: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

47

MPEG Motion Compensated PredictionBi-directional prediction

u Directional prediction implies that frames cannot beencoded or transmitted in the order they are scanned

u Encoding & transmission order:» I1 P5 B2 B3 B4 I9 B6 B7 B8 P13 B10 B11 B12 I17 B14 B15 B16 ...

I B B B P B B B I

1 2 3 4 5 6 7 8 9

48

MPEG Motion Compensated PredictionBi-directional prediction

u Bi-directional prediction modes are selectable on amacroblock by macroblock basis within a B picture

u Macroblocks can be predicted by:» themselves: frame'n[i, j] = framen[i, j]» a previous frame: frame'n[i, j] = framen–y[i+wx, j+wy]» a future frame: frame'n[i, j] = framen+x[i+wx, j+wy]» a previous & future frame:

frame'n[i, j] = (framen–y[i+wx, j+wy] + framen+x[i+w'x, j+w'y])/2

I or P picture(frame n+x)

I or P picture(frame n–y)

B picture(frame n)

Page 25: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

49

Bi-Directional Motion CompensationCompression rates

u Some prototypical results for 2 movies encoded at320x240, 30 fps and constant quality

“Crocodile Dundee” “ET”

50

StreamDemultiplexor

StreamDemultiplexor

MacroblockBuffer

MacroblockBuffer

InverseQuantizer

InverseQuantizer

StepSize

StepSize

MPEG Video CompressionDecoder architecture

16x16Macroblocks

DCTDecoder

DCTDecoder

Entropy Decoder

Entropy Decoder

MotionVectors

+

8x8pixel

block data

DPCMDecoder

DPCMDecoder

= video frame

= 16x16 pixel block

= 8x8 pixel block

= control data

PredictionControl

PredictionControl

FutureReference

Frame

FutureReference

Frame

PastReference

Frame

PastReference

Frame

DecodedPictureBuffer

DecodedPictureBuffer

MacroblockType

Page 26: Video Compression Standardscs778/jeffay/Lecture4.pdf · 2002. 2. 25. · u Video can be (trivially) encoded as a sequence of stills » This practice is routine in the digital video

51

MPEG Video CompressionCoded bit-stream

u MPEG has a layered bit-stream similar to H.261

u There are seven layers:» Sequence Layer

v decoding parameters (bit-rate, buffer size, picture resolution, framerate, ...)

» Group of Pictures Layerv a random access point

» Picture Layerv picture type and reference picture information

» Slice Layerv position and state information for decoder resynchronization

» Macroblock Layerv coded motion vectors

» Block Layerv coded DCT coefficients, quantizer step size, etc.

52

MPEG-2“New & Improved” MPEG-1

u A coding standard for the broadcast industry» Coding for video that originates from cameras

» Offers little benefit for material originally recorded on film

u But included is support for:» Higher (chrominance) sampling rates

» Resilience to transmission errors

» ...

u More mature and powerful coding/compressiontechnology is used» Unrestricted motion search with 1/2 pel resolution for

motion vectors