lecture 13 large
TRANSCRIPT
-
8/22/2019 Lecture 13 Large
1/34
CSEP 590Data Compression
Autumn 2007
Video Compression
-
8/22/2019 Lecture 13 Large
2/34
CSEP 590 - Lecture 13 - Autumn 2007 2
Human Perception of Video
30 frames per second seems to allow the
visual system to integrate the discrete framesinto continuous perception. Even 10 framesper second is acceptable.
If distorted, nearby frames in the same sceneshould have only small details wrong. A difference in average intensity is noticeable
Compression choice when reducing bit rate skipped frames cause stop action
lower fidelity frames may be better
-
8/22/2019 Lecture 13 Large
3/34
CSEP 590 - Lecture 13 - Autumn 2007 3
Applications of Digital Video
Teleconference or video phone
Real-time video Very low delay (1/10 second is a standard)
Live Broadcast Video
Modest delay is tolerable (seconds is normal)
Error tolerance is needed.
Video-in-a-can (DVD, Video-on-Demand)
Random access to compressed data is desired
Encoding can take a lot of time Decoding must always be at at least the frame rate.
-
8/22/2019 Lecture 13 Large
4/34
CSEP 590 - Lecture 13 - Autumn 2007 4
Video Encoding
Encoder
Frame-by-Frame coding
video frames
Encoder
video frames coded groups of framesno interdependencies
Group-of-Frames coding
decoding each frame
requires the previous frame
444 3444 21FramesofGroup
-
8/22/2019 Lecture 13 Large
5/34
CSEP 590 - Lecture 13 - Autumn 2007 5
Coding Techniques
Frame-by-frame coding with prediction
Very low bit rates
low delay
Not error resilient
Group-of-frames coding Higher bit rates within a group prediction is used
Error resilient
Random Access Higher delay
-
8/22/2019 Lecture 13 Large
6/34
CSEP 590 - Lecture 13 - Autumn 2007 6
Digital Video Data
CCIR 601 (4,2,2 scheme)
13.5 MHz sample rate for luminance channel 6.75 MHz sample rate for each of two chrominance channels
8 bits per sample is a bit rate of 27 x 8 = 216 Mb per second
MPEG-SIF sample rate for luminance and for
chrominance 81 Mb per second CIF (Common Interchange Format)
288 x 352 pixels per frame for luminance channel
144 x 176 pixels per frame for each of two chrominance
8 bits per pixel and 30 frames per second gives 48.7 Mb persecond
QCIF (Quarter - CIF) is the data or 12.2 Mb per second.
-
8/22/2019 Lecture 13 Large
7/34
CSEP 590 - Lecture 13 - Autumn 2007 7
High Compression Ratios Possible
Nearby frames are highly correlated. Use the
previous frame to predict the current one. Need to take advantage of the fact that
usually objects move very little in 1/30 th of a
second. Video coders use motion compensation as part of
prediction
-
8/22/2019 Lecture 13 Large
8/34
CSEP 590 - Lecture 13 - Autumn 2007 8
Motion Compensation
Previous Frame Frame
-
8/22/2019 Lecture 13 Large
9/34
CSEP 590 - Lecture 13 - Autumn 2007 9
Block Based Motion Compensation
motion compensation blocks
-
8/22/2019 Lecture 13 Large
10/34
CSEP 590 - Lecture 13 - Autumn 2007 10
Motion Vectors
motion vector = (0,0)
-
8/22/2019 Lecture 13 Large
11/34
CSEP 590 - Lecture 13 - Autumn 2007 11
Motion Vectors
motion vector = (20,5)20 down and 5 to right
-
8/22/2019 Lecture 13 Large
12/34
CSEP 590 - Lecture 13 - Autumn 2007 12
Motion Compensation
For each motion compensation block
Find the block in the previous decoded frame thatgives the least distortion.
If the distortion is too high then code the block
independently. (intra block) Otherwise code the difference (inter block)
The previous decoded frame is used because
both the encoder and decoder have access to it.
-
8/22/2019 Lecture 13 Large
13/34
CSEP 590 - Lecture 13 - Autumn 2007 13
Issues Distortion measured in squared error or absolute
error
Absolute error is quicker to calculate
Block size Too small then too many motion vectors
Too large then there may be no good match
Searching range to find best block Too large a search range is time consuming
Too small then may be better matches
Prediction can help.
Prediction resolution Full pixel, half-pixel, quarter-pixel resolution
Higher resolution takes longer, but better prediction results
-
8/22/2019 Lecture 13 Large
14/34
CSEP 590 - Lecture 13 - Autumn 2007 14
Fractional Motion Compensation
Half or quarter pixel motion compensation may achieve betterpredictions.
Fractional motion compensation is achieved by linearinterpolation.
previous frame current frame
Half pixel motion compensation
-
8/22/2019 Lecture 13 Large
15/34
CSEP 590 - Lecture 13 - Autumn 2007 15
Linear Interpolation
Calculate an interpolated pixel as the average ofoverlapping pixels.
Better interpolation methods exist.
a1
a3
a2
a4
a
a1
a3
a2
a4
a
4
a
4
a
4
a
4
a 4321a +++=
16
3a
16
a
16
9a
16
3a 4321
a +++=
Half
Quarter
-
8/22/2019 Lecture 13 Large
16/34
CSEP 590 - Lecture 13 - Autumn 2007 16
Rate Control
Buffer is filled at a constant rate (almost).
Buffer is emptied at a variable rate.
Decoder player
bufferEncoded
frames
frame
-
8/22/2019 Lecture 13 Large
17/34
CSEP 590 - Lecture 13 - Autumn 2007 17
Underflow Problem
Set up
Constant rate channel at C bits per second Frame rate F in frames per second.
bi is the number of bits in compressed frame i
Initial occupancy of buffer B Bi is the number of bits in the buffer at frame i
Buffer should never empty Bi > 0 for all i
ii1i
0
bC/FBB
BB
+=
=
+
-
8/22/2019 Lecture 13 Large
18/34
CSEP 590 - Lecture 13 - Autumn 2007 18
Example
Decoder
buffer
10020
C/F = 60
Decoder20
initial
2040
60 bits in this frame not yet arrived
60 bits that arrived
Decoder100 20
-
8/22/2019 Lecture 13 Large
19/34
CSEP 590 - Lecture 13 - Autumn 2007 19
Example
Decoder100 20
Decoder10020202080
Decoder202020 80
Decoder100 202020
-
8/22/2019 Lecture 13 Large
20/34
CSEP 590 - Lecture 13 - Autumn 2007 20
Rate Control
The rate control buffer is seeded to allow for
variability in number of bits per frame andvariability in channel rate.
Causes of variability in bits per frame. Encoder does not predict well how many bits will
be used in a frame - scalar quantization.
Encoder allocates more bits in frames that arehard to encode because they are not predictedwell - scene changes.
Causes of channel rate variability Congestion on the internet
-
8/22/2019 Lecture 13 Large
21/34
CSEP 590 - Lecture 13 - Autumn 2007 21
Rate Control Algorithms
On-line solution
Send a few frames to seed the buffer Encoder simulates the buffer, should the buffer
threaten to empty start sending more frames atlower fidelity or skip frames (decoder will
interpolate skipped frames). Off-line solution
Attempt to allocate bits to frames to assure evenfidelity.
Seed the buffer with enough frames to preventunderflow.
-
8/22/2019 Lecture 13 Large
22/34
CSEP 590 - Lecture 13 - Autumn 2007 22
H.261
Application low bit rate streaming video
Frame-by-frame encoder DCT based with 8x8 coding block
Uses JPEG style coding
Motion compensation based on 16x16macroblocks.
Half pixel motion compensation
-
8/22/2019 Lecture 13 Large
23/34
CSEP 590 - Lecture 13 - Autumn 2007 23
H.261
I-Frame
P-Frame
-
8/22/2019 Lecture 13 Large
24/34
CSEP 590 - Lecture 13 - Autumn 2007 24
H.261(QCIF)
144
pixels
176 pixelsBlock
Macroblock
99 motion
vectors
-
8/22/2019 Lecture 13 Large
25/34
CSEP 590 - Lecture 13 - Autumn 2007 25
H.261
Within a group of blocks (GOB) prediction is
used with motion vectors for coding.
GOB
Also called a slice
-
8/22/2019 Lecture 13 Large
26/34
CSEP 590 - Lecture 13 - Autumn 2007 26
H.261 Organization
Block
Macroblock
Group of
Blocks
PictureFrame
GOB 1
GOB 2
GOB 9
MB 1 MB 2 MB 11
176
144
Y1 Y2
Y3 Y4 Cb Cr
Picture Header
GOBHeader
MB
Header
EOB JPEG style run length code
-
8/22/2019 Lecture 13 Large
27/34
CSEP 590 - Lecture 13 - Autumn 2007 27
P-Frame
Inter
Intra
-
8/22/2019 Lecture 13 Large
28/34
CSEP 590 - Lecture 13 - Autumn 2007 28
Intra-Macroblock Distribution
Forman Video
-
8/22/2019 Lecture 13 Large
29/34
CSEP 590 - Lecture 13 - Autumn 2007 29
MPEG-1
Application Video coding for random access
Group-of-frames encoder DCT based with 8x8 coding block
Uses JPEG style coding
Motion compensation based on 16x16macroblocks.
Forward and Backward Prediction within a
group of frames
-
8/22/2019 Lecture 13 Large
30/34
CSEP 590 - Lecture 13 - Autumn 2007 30
MPEG-1
I-Frame
P-Frame
B-Frame
P-frames predicted by I-framesor P-frames B-frames predicted by I-framesand P-frames
-
8/22/2019 Lecture 13 Large
31/34
CSEP 590 - Lecture 13 - Autumn 2007 31
Orders
10 9 8 7 6 5 4 3 2 1
Display Order
9 8 10 6 5 7 3 2 4 1
Coding/Decoding Order
Added delay is one frame time
-
8/22/2019 Lecture 13 Large
32/34
CSEP 590 - Lecture 13 - Autumn 2007 32
MPEG-1 Notes
Random access unit = Group-of-Frames
Called GOP for group-of-pictures Error resilient
B-frames can be damaged without propagation
Added delay Coding order different than display order
Encoding time consuming
Suitable for non-interactive applications
-
8/22/2019 Lecture 13 Large
33/34
CSEP 590 - Lecture 13 - Autumn 2007 33
Beyond MPEG-1
MPEG-2
Application independent standard MPEG-4
Multimedia applications
Model based coding H.263
More error resilience
-
8/22/2019 Lecture 13 Large
34/34
CSEP 590 - Lecture 13 - Autumn 2007 34
Newest Trends
H.264 Just out in 2003, many new features
Quarter pixel motion compensation
Variable size motion blocks
Multiple frame prediction
3-D Wavelet Coding Third dimension is time
3-D SPIHT has been implemented
Delay is large because GOP is large
GTV Group testing for video Bits per frame can be controlled enabling off-line rate control
to succeed.