+ All Categories
Home > Documents > Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint -...

Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint -...

Date post: 05-Aug-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
31
Motion Estimation and Intra Frame Prediction in H.264/AVC Encoder Rahul Vanam University of Washington
Transcript
Page 1: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

Motion Estimation and

Intra Frame Prediction in

H.264/AVC Encoder

Rahul Vanam

University of Washington

Page 2: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

2

Motion Estimation

H.264/AVC Encoder [2]

Page 3: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

3

Motion Estimation

• H.264 does block based coding.

• Each frame is divided into blocks of 16x16 pixels called macroblocks (MB).

• Each MB can be encoded using blocks of pixels that are

already encoded within the current frame - Intra frame coding.

• MBs can be coded using blocks of pixels in previous or future encoded frames - Inter frame coding.

• The process of finding a match of pixel blocks in inter frame coding is called Motion Estimation.

Page 4: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

4

Macroblock Partitions

16x16

8x8 8x8

8x8 8x8

16x8 16x8

8x16

8x16

16x16 16x16

8x8

4x4

4x44x4

4x4

8x4 8x4

8x8

4x8

4x8

8x8

16x16 blocks can

be broken into

blocks of sizes

8x8, 16x8, or 8x16.

8x8 blocks can be

broken into blocks

of sizes 4x4, 4x8,

or 8x4.

Page 5: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

5

Sub-pixel Motion Estimation

• Compute the block distortion at each pixel position within the search

window

Integer pixel search

Page 6: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

6

Sub-pixel Motion Estimation

Integer pixel search

Center of best

match

• Find the position corresponding to the minimum block distortion

Page 7: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

7

Sub-pixel Motion Estimation

Half pixel search

Center of

the best

match

• Half pixel motion estimation is then done where the best match was

found in the integer pixel search step.

Page 8: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

8

Sub-pixel Motion Estimation

Quarter

pixel search

Center of

the best

match

• Finally, quarter pixel motion estimation is done where the bestmatch was found from the half pixel search step, giving us the final motion vector.

Page 9: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

9

Motion Estimation

• Motion estimation is computationally expensive since

– search is done at every pixel position

– over different reference frames

• There are several different fast integer search methods – diamond search, hexagon search, Simplified Uneven Multihexagon search (UMH), etc.

Page 10: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

10

Diamond Search Algorithm

• It uses large diamond search pattern of radius 2 and small diamond search pattern of radius 1.

S. Zhu and K. K. Ma, IEEE CSVT 2000

Large diamond search pattern Small diamond search pattern

Page 11: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

11

Diamond Search Algorithm

Apply large diamond to

the center of the search

window

Page 12: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

12

Diamond Search Algorithm

Compute the block

distortions corresponding

to all positions and

check if the center

position has the minimum

distortion.?

Page 13: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

13

Diamond Search Algorithm

Minimum distortion

position

Page 14: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

14

Diamond Search Algorithm

The minimum point in the

previous step is the

center position of this

step.

Apply large diamond to

the new center position.

Find the new minimum

block distortion.

If the center is not the

minimum, move the

center to the minimum

point and reapply the

large diamond pattern.

Past search points Current search points

Points that overlap

Page 15: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

15

Diamond Search Algorithm

If the center is the

minimum block distortion

position, then apply a

small diamond.

Page 16: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

16

Diamond Search Algorithm

The minimum block

distortion position in this

step gives the final motion

vector.

Final motion vector (3,0)Starting point

(0,0)

Page 17: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

17

Hexagon Search Algorithm

• It consists of large hexagon pattern of radius 2 in horizontal and vertical direction, and small hexagon (or

diamond) pattern of radius 1.

• The search approach is similar to Diamond search.

C. Zhu, X. Lin and L-P. Chau, IEEE CSVT, 2002

Large hexagon pattern Small hexagon pattern

Page 18: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

18

Hexagon Search Algorithm

Apply large hexagon to

the center of the search

window.

Compute the block

distortions

corresponding to all

positions and

check if the center

position has the

minimum distortion.

?

Page 19: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

19

Hexagon Search Algorithm

Minimum distortion

position

Page 20: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

20

Hexagon Search Algorithm

The minimum point in the

previous step is the

center position of this

step.

Apply large hexagon to

the new center position.

Find the new minimum

block distortion.

If the center is not the

minimum, move the

center to the minimum

point and reapply the

large hexagon pattern.

Past search points Current search points

Points that overlap

Page 21: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

21

Hexagon Search Algorithm

If the center is the

minimum block

distortion position,

then apply a small

hexagon.

Page 22: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

22

Hexagon Search Algorithm

The minimum block

distortion position in this

step gives the final

motion vector.

Final motion vector (3,0)

(0,0)

Page 23: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

23

Hexagon Search Algorithm (HEXS)

Comparison with Diamond search (DS)

– HEXS uses fewer search points compared to

diamond search (DS). In our example, HEXS

requires 14 search points while DS requires

18 search points.

– HEXS gives higher savings in searches for

larger motion vectors.

– HEXS results in slightly higher mean

distortion compared to DS.

Page 24: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

24

Intra-Frame Prediction

H.264/AVC Encoder [2]

Page 25: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

25

Intra-Frame Prediction

• Intra modes for Luma samples

– 9 modes for 4x4 blocks

– 4 modes for 8x8 blocks

• Intra modes for Chroma samples

– 4 modes for 8x8 blocks

Page 26: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

26

Intra Luma Prediction for 4x4

blocks

• Samples a, b, …, p are predicted from samples

A,…, M that have been encoded previously.

n

j

f

b

pomL

lkiK

hgeJ

dcaI

G HFEDCBAM

Samples to be

intra predicted

Samples that are

already encoded

Page 27: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

27

Intra Luma Prediction for 4x4

blocks

• The direction of prediction for 8 modes are shown above [2].

• In Mode 2, the samples a,..,p are predicted using average of

samples A,..,D and I,…,L.

Page 28: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

28

Intra Luma Prediction for 4x4

blocks

Five of the 9 intra 4x4 modes [3]

Page 29: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

29

Intra Luma Prediction for 16x16

blocks

• There are 4 modes

– Mode 0: vertical prediction

– Mode 1: horizontal prediction

– Mode 2: DC prediction

– Mode 4: Plane prediction

• Intra chroma prediction has the same modes as above, but prediction is done for 8x8 chroma blocks.

Page 30: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

30

Mode Decision16x16 luma Macroblock

Intra Modes

(For all frames)

Inter Modes (Only

for P and B-frames)

• Nine 4x4 Modes

• Four 16x16 Modes

• Macroblock partitions:

16x16,16x8,8x16,

8x8,8x4,4x8,4x4

• Use of reference frames

• Use of integer, half and

quarter pixel motion

estimation

• Each mode (inter or intra) has an associated Rate-Distortion (RD)

cost.

• Encoder performs mode decision to select the mode having the least

RD cost. This process is computationally intensive.

Page 31: Motion Estimation and Intra Frame Prediction in H.264/AVC ... · Microsoft PowerPoint - cse590_rahul_lecture_2.ppt Created Date: 11/29/2007 4:43:28 PM ...

31

References

1. I.E.Richardson, “H.264 and MPEG-4 video compression,” Wiley, 2003.

2. G. J. Sullivan, P. Topiwala, and A. Luthra, “The H.264/AVC Advanced Video Coding

Standard:Overview and Introduction to the Fidelity

Range Extensions,” SPIE Conference on Applications of Digital Image Processing XXVII, August, 2004

3. T. Wiegand, G. J. Sullivan, G. Bjøntegaard, and A. Luthra, “Overview of the H.264/AVC Video Coding

Standard,” IEEE CSVT, Vol.13, pp. 560-576, July 2003.


Recommended