Download Basic Video Compression Techniques: H.261, MPEG-1, and MPEG-2 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!
ECE Lecture 10 1
ECE160 / CMPS
Multimedia
Lecture 10: Spring 2008
Basic Video Compression Techniques
H.261, MPEG-1 and MPEG-
ECE Lecture 10 2
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.
ECE Lecture 10 4 Motion Compensation
- Each image is divided into macroblocks of size NxN.
- By default, N = 16 for luminance images. For chrominance images, N = 8 if 4:2:0 chroma subsampling is adopted.
- Motion compensation operates 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) (referred to as Reference frame(s) ).
- The displacement of the reference macroblock to the target macroblock is called a motion vector MV.
ECE Lecture 10 5 Motion Compensation
- Macroblocks and Motion Vector in Video Compression.
- 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 (2 p +1)(2 p +1).
ECE Lecture 10 7 Sequential Search
- Sequential search : sequentially search the whole (2 p +1)x(2 p +1) window in the Reference frame (also referred to as Full search).
- A macroblock centered at each of the positions within the window is compared to the macroblock in the Target frame pixel by pixel and their respective MAD is then derived using the equation above.
- The vector ( i,j ) that offers the least MAD is designated as the MV ( u,v ) for the macroblock in the Target frame.
- Sequential search method is very costly - assuming each pixel comparison requires three operations (subtraction, absolute value, addition), the cost for obtaining a motion vector for a single macroblock is (2 p +1).(2 p +1). N 2 .3 ) => O ( p 2 N 2 ).
ECE Lecture 10 8 Logarithmic Search
- Logarithmic search : a cheaper version, that is
suboptimal but still usually effective.
- The procedure for 2D Logarithmic Search of
motion vectors takes several iterations and is
akin to a binary search:
- As illustrated in the Figure below, initially only nine locations in the search window are used as seeds for a MAD-based search; they are marked as `1'.
- After the one that yields the minimum MAD is located, the center of the new search region is moved to it and the step-size ("offset") is reduced to half.
- In the next iteration, the nine new locations are marked as `2', and so on.
ECE Lecture 10 10 Hierarchical Search
- The search can benefit from a hierarchical (multiresolution) approach in which initial estimation of the motion vector is obtained from images with a significantly reduced resolution.
- The Figure below shows a three-level hierarchical search in which the original image is at Level 0, images at Levels 1 and 2 are obtained by down- sampling from the previous levels by a factor of 2, and the initial search is conducted at Level 2.
- Since the size of the macroblock is smaller and p can also be proportionally reduced, the number of operations required is greatly reduced.
ECE Lecture 10 11 Three-level Hierarchical Search for Motion Vectors
ECE Lecture 10 13 Comparison of Computational Cost of Motion Vector Search
ECE Lecture 10 14 H. H.261 : An earlier digital video compression standard, its principle of MC-based compression is retained in all later video compression standards.
- The standard was designed for videophone, video conferencing and other audiovisual services over ISDN.
- The video codec supports bit-rates of px 64 kbps, where p ranges from 1 to 30 (Hence also known as px 64).
- Require that the delay of the video encoder be less than 150 msec so that the video can be used for real-time bidirectional video conferencing.
ECE Lecture 10 16 Video Formats Supported by H.
ECE Lecture 10 17 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.
- To avoid propagation of coding errors, an I-frame is usually sent a couple of times in each second of the video.
- Motion vectors in H.261 are always measured in units of full pixel and they have a limited range of 15 pixels, i.e., p = 15.
ECE Lecture 10 19 Inter-frame (P-frame) Predictive Coding
- For each macroblock in the Target frame, a motion vector is found by one of the search methods discussed earlier.
- After the prediction, a difference macroblock is derived to measure the prediction error.
- Each of these 8x8 blocks go through DCT, quantization, zigzag scan and entropy coding procedures.
- The P-frame coding encodes the difference macroblock (not the Target macroblock itself).
- Sometimes, a good match cannot be found, i.e., the prediction error exceeds an acceptable level. - The MB itself is then encoded (treated as an Intra MB) and in this case it is termed a non-motion compensated MB.
- For motion vector, the difference MVD is sent for entropy coding: MVD = MV Preceding − MV Current
ECE Lecture 10 20 P-frame Coding based on Motion Compensation.