Transcript I-frame

Fundamentals of Multimedia
Chapter 10
Basic Video Compression Techniques
Ze-Nian Li & Mark S. Drew
건국대학교 인터넷미디어공학부
임창훈
Outline
10.1 Introduction to Video Compression
10.2 Video Compression with Motion Compensation
10.3 Search for Motion Vectors
10.4 H.261
10.5 H.263
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
2
10.1 Introduction to Video Compression
 A video consists of a time-ordered sequence of frames,
i.e., images.
 An obvious solution to video compression would be
predictive coding based on previous frames.
 Compression proceeds by subtracting images:
subtract in time order and code the residual error.
 It can be done even better by searching for just the
right parts of the image to subtract from the previous
frame.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
3
10.2 Video Compression with Motion Compensation
 Consecutive frames in a video are similar
- temporal redundancy exists.
 Temporal redundancy is exploited so that not every
frame of the video needs to be coded independently
as a new image.
 The difference between the current frame and other
frame(s) in the sequence will be coded
- small values and low entropy, good for compression.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
4
Video Compression with Motion Compensation
 Steps of Video compression based on
Motion Compensation (MC):
1. Motion estimation (motion vector search).
2. MC-based Prediction.
3. Derivation of the prediction error, i.e., the difference.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
5
Motion Compensation
 Each image is divided into macroblocks of size N×N.
• By default, N = 16 for luminance images.
• For chrominance images, N = 8 if 4:2:0 chroma
subsampling is adopted.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
6
Motion Compensation
 Motion compensation is performed at the
macroblock level.
• The current image frame is referred to as
Target Frame.
• A match is sought between the macroblock in the
Target Frame and the most similar macroblock in
previous and/or future frame(s) (Reference frame(s)).
• The displacement of the reference macroblock to the
target macroblock is called a motion vector (MV).
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
7
Fig. 10.1: Macroblocks and Motion Vector in Video Compression.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
8
 Figure 10.1 shows the case of forward prediction in
which the Reference frame is taken to be a previous
frame.
 MV search is usually limited to a small immediate
neighborhood – both horizontal and vertical
displacements in the range [−p, p]:
This makes a search window of size (2p+1)×(2p+1).
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
9
10.4 H.261
 H.261: An earlier digital video compression standard,
its principle of MC-based compression is retained in
all later video compression standards.
• The video codec supports bit-rates of p x 64 kbps,
where p ranges from 1 to 30.
• Require that the delay of the video encoder be less
than 150 msec so that the video can be used for realtime bidirectional video conferencing.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
10
Fig. 10.4: H.261 Frame Sequence.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
11
H.261 Frame Sequence
 Two types of image frames are defined: Intra-frames
(I-frames) and Inter-frames (P-frames):
 I-frames are treated as independent images.
Transform coding method similar to JPEG is applied
within each I-frame, hence “Intra".
 P-frames are not independent: coded by a forward
predictive coding method (prediction from a previous
P-frame is allowed - not just from a previous I-frame).
 Temporal redundancy removal is included in P-frame
coding, whereas I-frame coding performs only spatial
redundancy removal.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
12
Intra-frame (I-frame) Coding
Fig. 10.5: I-frame Coding.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
13
Inter-frame (P-frame) Coding
Fig. 10.6: H.261 P-frame Coding Based on Motion Compensation.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
14
H.261 Encoder and Decoder
 Fig. 10.7 shows a relatively complete picture of how
the H.261 encoder and decoder work.
• A scenario is used where frames I, P1, and P2 are
encoded and then decoded.
 Note: decoded frames (not the original frames) are
used as reference frames in motion estimation.
 The data that goes through the observation points
indicated by the circled numbers are summarized in
Tables 10.3 and 10.4.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
15
I
0
I
I
I
original image
I
decoded image
Fig. 10.6(a): H.261 Encoder (I-frame).
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
16
I
decoded image
0
I
I
Fig. 10.6(b): H.261 Decoder (I-frame).
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
17
P1 D1
D1  P1  P1'
P1'
D1
P1
P1'
P1
P1  D1  P1'
original image
P1'
prediction
D1
prediction error
P1
decoded image
D1
decoded prediction error
Fig. 10.6(a): H.261 Encoder (P-frame).
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
18
P1'
prediction
P1'
D1
P1
P1'
D1
decoded prediction error
P1
decoded (reconstructed) image
Fig. 10.6(b): H.261 Decoder (P-frame).
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
19
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
20
P1'
P1
I
P1
Fig. 10.1: Macroblocks and Motion Vector in Video Compression.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
21
P1
I
P1
D1
P1'
Fig. 10.6: H.261 P-frame Coding Based on Motion Compensation.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
22
Half-Pixel Precision
 In order to reduce the prediction error, half-pixel
precision is supported in H.263 vs. full-pixel precision
only in H.261.
• The default range for both the horizontal and vertical
components u and v of MV(u, v) are now [−16, 15.5].
• The pixel values needed at half-pixel positions are
generated by a simple bilinear interpolation method,
as shown in Fig. 10.12.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
23
Fig. 10.12: Half-pixel Prediction by Bilinear Interpolation in H.263.
Chap 10 Basic Video Compression Techniques
Li & Drew; 인터넷미디어공학부 임창훈
24