CMPT 365 Multimedia Systems. Media Compression - Video

Similar documents
Chapter 10. Basic Video Compression Techniques Introduction to Video Compression 10.2 Video Compression with Motion Compensation

Using animation to motivate motion

10.2 Video Compression with Motion Compensation 10.4 H H.263

LECTURE VIII: BASIC VIDEO COMPRESSION TECHNIQUE DR. OUIEM BCHIR

Welcome Back to Fundamentals of Multimedia (MR412) Fall, 2012 Chapter 10 ZHU Yongxin, Winson

Week 14. Video Compression. Ref: Fundamentals of Multimedia

CMPT 365 Multimedia Systems. Media Compression - Video Coding Standards

Digital Video Processing

Interframe coding A video scene captured as a sequence of frames can be efficiently coded by estimating and compensating for motion between frames pri

CMPT 365 Multimedia Systems. Media Compression - Image

2014 Summer School on MPEG/VCEG Video. Video Coding Concept

In the name of Allah. the compassionate, the merciful

Lec 08 Video Signal Processing I

MPEG-4: Simple Profile (SP)

Chapter 11.3 MPEG-2. MPEG-2: For higher quality video at a bit-rate of more than 4 Mbps Defined seven profiles aimed at different applications:

Comparative Study of Partial Closed-loop Versus Open-loop Motion Estimation for Coding of HDTV

Lecture 5: Error Resilience & Scalability

Review and Implementation of DWT based Scalable Video Coding with Scalable Motion Coding.

Lecture 6: Compression II. This Week s Schedule

Lec 08 Video Signal Processing I

ECE 417 Guest Lecture Video Compression in MPEG-1/2/4. Min-Hsuan Tsai Apr 02, 2013

Ch. 4: Video Compression Multimedia Systems

Multimedia Systems Video II (Video Coding) Mahdi Amiri April 2012 Sharif University of Technology

Outline Introduction MPEG-2 MPEG-4. Video Compression. Introduction to MPEG. Prof. Pratikgiri Goswami

High Efficiency Video Coding. Li Li 2016/10/18

Module 7 VIDEO CODING AND MOTION ESTIMATION

Video Compression Standards (II) A/Prof. Jian Zhang

Wireless Communication

Video coding. Concepts and notations.

MPEG-2. And Scalability Support. Nimrod Peleg Update: July.2004

MPEG-2. ISO/IEC (or ITU-T H.262)

DIGITAL TELEVISION 1. DIGITAL VIDEO FUNDAMENTALS

Laboratoire d'informatique, de Robotique et de Microélectronique de Montpellier Montpellier Cedex 5 France

Compression of Stereo Images using a Huffman-Zip Scheme

5LSE0 - Mod 10 Part 1. MPEG Motion Compensation and Video Coding. MPEG Video / Temporal Prediction (1)

Anatomy of a Video Codec

Rate Distortion Optimization in Video Compression

VIDEO AND IMAGE PROCESSING USING DSP AND PFGA. Chapter 3: Video Processing

Video Compression MPEG-4. Market s requirements for Video compression standard

Video Codecs. National Chiao Tung University Chun-Jen Tsai 1/5/2015

A real-time SNR scalable transcoder for MPEG-2 video streams

Introduction to Video Compression

Stereo Image Compression

Multimedia Systems Image III (Image Compression, JPEG) Mahdi Amiri April 2011 Sharif University of Technology

Lecture 4: Video Compression Standards (Part1) Tutorial 2 : Image/video Coding Techniques. Basic Transform coding Tutorial 2

The Basics of Video Compression

Video Compression An Introduction

Video Coding Standards. Yao Wang Polytechnic University, Brooklyn, NY11201 http: //eeweb.poly.edu/~yao

Frequency Band Coding Mode Selection for Key Frames of Wyner-Ziv Video Coding

Multimedia Signals and Systems Motion Picture Compression - MPEG

Multimedia Standards

Lecture 13 Video Coding H.264 / MPEG4 AVC

International Journal of Emerging Technology and Advanced Engineering Website: (ISSN , Volume 2, Issue 4, April 2012)

The Scope of Picture and Video Coding Standardization

EE 5359 H.264 to VC 1 Transcoding

IN the early 1980 s, video compression made the leap from

Efficient support for interactive operations in multi-resolution video servers

Zonal MPEG-2. Cheng-Hsiung Hsieh *, Chen-Wei Fu and Wei-Lung Hung

OVERVIEW OF IEEE 1857 VIDEO CODING STANDARD

Features. Sequential encoding. Progressive encoding. Hierarchical encoding. Lossless encoding using a different strategy

VC 12/13 T16 Video Compression

Lecture 3 Image and Video (MPEG) Coding

MPEG-4 departs from its predecessors in adopting a new object-based coding:

Advanced Video Coding: The new H.264 video compression standard

SIGNAL COMPRESSION. 9. Lossy image compression: SPIHT and S+P

TKT-2431 SoC design. Introduction to exercises

H.264/AVC und MPEG-4 SVC - die nächsten Generationen der Videokompression

System Modeling and Implementation of MPEG-4. Encoder under Fine-Granular-Scalability Framework

Introduction to Video Encoding

COMP 249 Advanced Distributed Systems Multimedia Networking. The Video Data Type Coding & Compression Basics

Lec 10 Video Coding Standard and System - HEVC

Georgios Tziritas Computer Science Department

Lecture 3: Image & Video Coding Techniques (II) & Standards (I) A/Prof. Jian Zhang

Compression II: Images (JPEG)

Index. 1. Motivation 2. Background 3. JPEG Compression The Discrete Cosine Transformation Quantization Coding 4. MPEG 5.

Interactive Progressive Encoding System For Transmission of Complex Images

A New Fast Motion Search Algorithm for Block Based Video Encoders

H.264 STANDARD BASED SIDE INFORMATION GENERATION IN WYNER-ZIV CODING

TKT-2431 SoC design. Introduction to exercises. SoC design / September 10

SINGLE PASS DEPENDENT BIT ALLOCATION FOR SPATIAL SCALABILITY CODING OF H.264/SVC

Standard Codecs. Image compression to advanced video coding. Mohammed Ghanbari. 3rd Edition. The Institution of Engineering and Technology

06/12/2017. Image compression. Image compression. Image compression. Image compression. Coding redundancy: image 1 has four gray levels

CS 260: Seminar in Computer Science: Multimedia Networking

Mesh Based Interpolative Coding (MBIC)

Video Coding Standards

Lecture 5: Video Compression Standards (Part2) Tutorial 3 : Introduction to Histogram

Compressed-Domain Video Processing and Transcoding

Fundamentals of Video Compression. Video Compression

Lecture 7, Video Coding, Motion Compensation Accuracy

4G WIRELESS VIDEO COMMUNICATIONS

THE H.264 ADVANCED VIDEO COMPRESSION STANDARD

Multimedia Communications: Coding, Systems, and Networking. Prof. Tsuhan Chen H.261

VIDEO COMPRESSION STANDARDS

EFFICIENT DEISGN OF LOW AREA BASED H.264 COMPRESSOR AND DECOMPRESSOR WITH H.264 INTEGER TRANSFORM

Cross Layer Protocol Design

Motion Estimation for Video Coding Standards

LIST OF TABLES. Table 5.1 Specification of mapping of idx to cij for zig-zag scan 46. Table 5.2 Macroblock types 46

Module 7 VIDEO CODING AND MOTION ESTIMATION

Introduction to Video Encoding

DigiPoints Volume 1. Student Workbook. Module 8 Digital Compression

Transcription:

CMPT 365 Multimedia Systems Media Compression - Video Spring 2017 Edited from slides by Dr. Jiangchuan Liu CMPT365 Multimedia Systems 1

Introduction What s video? a time-ordered sequence of frames, i.e., images. Why to compress? A billionaire problem How to compress? Spatial redundancy compression on each individual image (Motion JPEG) Temporal redundancy prediction based on previous images CMPT365 Multimedia Systems 2

Temporal Redundancy Characteristics of typical videos: A lot of similarities between adjacent frames Differences caused by object or camera motion Frame 1 Frame 2 Direct Difference CMPT365 Multimedia Systems 3

Key Idea in Video Coding Predict each frame from the previous frame and only encode the prediction error: Pred. error has smaller energy and is easier to compress Intra-coded I-frame Predicted P-frame CMPT365 Multimedia Systems 4

Motion? Previous frame Current Frame CMPT365 Multimedia Systems 5

Motion Estimation (ME) For each block, find the best match in the previous frame (reference frame) Upper-left corner of the block being encoded: (x0, y0) Upper-left corner of the matched block in the reference frame: (x1, y1) Motion vector (dx, dy): the offset of the two blocks: (dx, dy) = (x1 x0, y1 y0) (x0, y0) + (dx, dy) = (x1, y1) Motion vector need to be sent to the decoder. (x1, y1) (x0, y0) CMPT365 Multimedia Systems 6

Motion Estimation Example Reference Current Frame Plotted by quiver( ) in Matlab. CMPT365 Multimedia Systems 7

Motion Compensation (MC) Given reference frame and the motion vector, can obtain a prediction of the current frame Prediction error: Difference between the current frame and the prediction. The prediction error will be coded by DCT, quantization, and entropy coding. CMPT365 Multimedia Systems 8

GOP, I, P, and B Frames I P P P P P P I P P P P P P GOP GOP GOP: Group of pictures (frames). I frames (Key frames): Intra-coded frame, coded as a still image. Can be decoded directly. Used for GOP head, or at scene changes. I frames also improve the error resilience. P frames: (Inter-coded frames) Predication-based coding, based on previous frames. CMPT365 Multimedia Systems 9

GOP, I, P, and B Frames B frames: Bi-directional interpolated prediction frames Predicted from both the previous frame and the next frame: more flexibilities è better prediction. B frames are not used as reference for future frames: B frames can be coded with lower quality or can be discarded without affecting future frames. Encoding order: 1 4 2 3 7 5 6 Decoding order: 1 4 2 3 7 5 6 Display order: 1 2 3 4 5 6 7 Need more buffers Need buffer manipulations to display the correct order. 1 2 3 4 5 6 7 I B B P B B P CMPT365 Multimedia Systems 10

Input frame Basic Encoder Block Diagram Intra DCT Q Inter Pred. error Q -1 Entropy Coding Intra Inter Prediction Prediction MC I DCT Recon Pred error Memory Recon. Motion vectors ME Reconstructed Previous frame Use reconstructed error in the loop to prevent drifting. Original input is not available to the decoder. Need a buffer to keep the reference frame. CMPT365 Multimedia Systems 11

Basic Decoder Block Diagram Entropy Decoding Q -1 I DCT Recon Pred error Intra Inter Prediction MC Reconstructed frame Memory Motion vectors Decoder is simpler than the encoder: No need to do motion estimation. Reconstructed Previous frame CMPT365 Multimedia Systems 12

Formulation: Motion Estimation - Revisit Find (i, j) in a search window (-p, p) that minimizes N- 1N- 1 1 e(, ij) = C x k, y l Rx i k, y j l 2 ÂÂ + + - + + + + N k= 0 l= 0 Mean square error (MSE) If z=2 Mean absolute distance (MAD): If z = 1. # of search candidates: (2p+1) x (2p + 1) ( ) ( ) z CMPT365 Multimedia Systems 13

MAD-based Motion Estimation Objective Find vector (i, j) as the motion vector MV = (u;v), such that MAD(i,j) is minimum CMPT365 Multimedia Systems 14

Naive Method Sequential search (Full search): - sequentially search the whole (2p+1) (2p+1) window in the Reference frame a macroblock centered at each of the positions within the window is compared to the macroblock in the Target frame, pixel by pixel respective MAD is derived vector (i, j) that offers the least MAD is designated as the MV (u, v) for the macroblock in the target frame CMPT365 Multimedia Systems 15

Fast Motion Estimation Full-search motion estimation is time consuming: Each (i, j) candidate: N 2 summations If search window size is W 2, need W 2 x N 2 comparisions / MB W=2p+1=31, N=16: è 246016 comparisons / MB! Each comparison three operations (subtraction, absolute value, addition) Fast motion estimation is desired: Lower the number of search candidates Many methods CMPT365 Multimedia Systems 16

2-D Log Search Logarithmic search: a cheaper version suboptimal but still usually effective. Procedure similar to a binary search Initially, only nine locations in the search window are used as seeds for a MAD-based search; 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. CMPT365 Multimedia Systems 17

Log Search CMPT365 Multimedia Systems 18

W=2p+1=31, N=16 (p=15) Computations 10496 Comparison per Macroblock CMPT365 Multimedia Systems 19

Hierarchical Search Hierarchical search: W 2 x N 2 : Comparison Per macroblock for sequential search The search can benefit from a hierarchical (multiresolution) approach in which initial estimation of the motion vector can be obtained from images with a significantly reduced resolution. Since the size of the macroblock is smaller and p can also be proportionally reduced, the number of operations required is greatly reduced. CMPT365 Multimedia Systems 20

Fig. 10.3: A Three-level Hierarchical Search for Motion Vectors. CMPT365 Multimedia Systems 21

Hierarchical Search (Cont d) Given the estimated motion vector (u k, v k ) at Level k, a 3 x 3 neighborhood centered at (2 u k, 2 v k ) at Level k 1 is searched for the refined motion vector. The refinement is such that at Level k 1 the motion vector (u k 1, v k 1 ) satisfies: (2u k 1 u k 1 2u k +1, 2v k 1 v k 1 2v k +1) Let (x k 0, y k 0) denote the center of the macroblock at Level k in the target frame. The procedure for hierarchical motion vector search for the macroblock centered at (x 0 0, y 0 0) in the Target frame can be outlined as follows: CMPT365 Multimedia Systems 22

PROCEDURE 10.3 Motion-vector:hierarchical-search BEGIN // Get macroblock center position at the lowest resolution Level k x k 0 = x 0 0 /2 k ; y k 0 = y 0 0 / 2 k ; Use Sequential (or 2D Logarithmic) search method to get initial estimated MV(u k, v k ) at Level k; WHILE last TRUE { Find one of the nine macroblocks that yields minimum MAD at Level k 1 centered at (2(x k 0+u k ) 1 x 2(x k 0+u k ) + 1; 2(y k 0+v k ) 1 y 2(y k 0 +v k ) + 1 ); IF k = 1 THEN last = TRUE; k = k 1; Assign (x k 0; y k 0 ) and (u k, v k ) with the new center location and MV; } END CMPT365 Multimedia Systems 23

Computations W=2p+1=31, N=16 (p=15) Reduced size 4176 Comparison per Macroblock CMPT365 Multimedia Systems 24

Intra-frame (I-frame) Coding Fig. 10.5: I-frame Coding. Macroblocks are of size 16 x 16 pixels for the Y frame, and 8 x 8 for Cb and Cr frames, since 4:2:0 chroma subsampling is employed. A macroblock consists of four Y, one Cb, and one Cr 8 x 8 blocks. For each 8 x 8 block a DCT transform is applied, the DCT coefficients then go through quantization zigzag scan and entropy coding. CMPT365 Multimedia Systems 25

Inter-frame (P-frame) Predictive Coding Figure 10.6 shows the H.261 P-frame coding scheme based on motion compensation: - For each macroblock in the Target frame, a motion vector is allocated by one of the search methods discussed earlier. - After the prediction, a difference macroblock is derived to measure the prediction error. - Each of these 8 x 8 blocks go through DCT, quantization, zigzag scan and entropy coding procedures. CMPT365 Multimedia Systems 26

Fig. 10.6: H.261 P-frame Coding Based on Motion Compensation CMPT365 Multimedia Systems 27

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 a certain 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 a motion vector, the difference MVD is sent for entropy coding: MVD = MV Preceding MV Current (10.3) CMPT365 Multimedia Systems 28

Quantization in H.261 The quantization in H.261 uses a constant step_size, for all DCT coefficients within a macroblock. If we use DCT and QDCT to denote the DCT coefficients before and after the quantization, then for DC coefficients in Intra mode: ( DCT ) æ DCT ö QDCT = round ç = round step _ size è ø 8 (10.4) for all other coefficients: QDCT ê DCT ú = ê DCT ú ê = ë step _ sizeú û ê ë 2* scale ú û (10.5) scale an integer in the range of [1, 31]. CMPT365 Multimedia Systems 29

Further Exploration Textbook Chapter 10 Other sources A Java H.263 decoder by A.M. Tekalp Digital Video and HDTV Algorithms and Interfaces by C.A. Poynton Image and Video Compression Standards by V. Bhaskaran and K. Konstantinides Video Coding: An introduction to standard codecs by M. Ghanbari Video processing and communications by Y. Wang et al. CMPT365 Multimedia Systems 30