ESE532: System-on-a-Chip Architecture

Slides:



Advertisements
Similar presentations
Multimedia System Video
Advertisements

JPEG Compresses real images Standard set by the Joint Photographic Experts Group in 1991.
T.Sharon-A.Frank 1 Multimedia Compression Basics.
Data Compression CS 147 Minh Nguyen.
Time-Frequency Analysis Analyzing sounds as a sequence of frames
INTERNATIONAL CONFERENCE ON TELECOMMUNICATIONS, ICT '09. TAREK OUNI WALID AYEDI MOHAMED ABID NATIONAL ENGINEERING SCHOOL OF SFAX New Low Complexity.
Chapter 7 End-to-End Data
CS :: Fall 2003 MPEG-1 Video (Part 1) Ketan Mayer-Patel.
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
Department of Computer Engineering University of California at Santa Cruz Data Compression (2) Hai Tao.
CS430 © 2006 Ray S. Babcock Lossy Compression Examples JPEG MPEG JPEG MPEG.
5. 1 JPEG “ JPEG ” is Joint Photographic Experts Group. compresses pictures which don't have sharp changes e.g. landscape pictures. May lose some of the.
Roger Cheng (JPEG slides courtesy of Brian Bailey) Spring 2007
Video Compression Concepts Nimrod Peleg Update: Dec
CSE679: MPEG r MPEG-1 r MPEG-2. MPEG r MPEG: Motion Pictures Experts Group r Standard for encoding videos/movies/motion pictures r Evolving set of standards.
Image Compression: JPEG Multimedia Systems (Module 4 Lesson 1)
Image and Video Compression
Image Compression - JPEG. Video Compression MPEG –Audio compression Lossy / perceptually lossless / lossless 3 layers Models based on speech generation.
Trevor McCasland Arch Kelley.  Goal: reduce the size of stored files and data while retaining all necessary perceptual information  Used to create an.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
ECE472/572 - Lecture 12 Image Compression – Lossy Compression Techniques 11/10/11.
1 Image Compression. 2 GIF: Graphics Interchange Format Basic mode Dynamic mode A LZW method.
MPEG-1 and MPEG-2 Digital Video Coding Standards Author: Thomas Sikora Presenter: Chaojun Liang.
Klara Nahrstedt Spring 2011
D ATA C OMMUNICATIONS Compression Techniques. D ATA C OMPRESSION Whether data, fax, video, audio, etc., compression can work wonders Compression can be.
Image Processing and Computer Vision: 91. Image and Video Coding Compressing data to a smaller volume without losing (too much) information.
CIS679: Multimedia Basics r Multimedia data type r Basic compression techniques.
Chapter 7 – End-to-End Data Two main topics Presentation formatting Compression We will go over the main issues in presentation formatting, but not much.
Image Compression Supervised By: Mr.Nael Alian Student: Anwaar Ahmed Abu-AlQomboz ID: IT College “Multimedia”
1 Classification of Compression Methods. 2 Data Compression  A means of reducing the size of blocks of data by removing  Unused material: e.g.) silence.
Understanding JPEG MIT-CETI Xi’an ‘99 Lecture 10 Ben Walter, Lan Chen, Wei Hu.
Compression video overview 演講者:林崇元. Outline Introduction Fundamentals of video compression Picture type Signal quality measure Video encoder and decoder.
An introduction to audio/video compression Dr. Malcolm Wilson.
Spring 2000CS 4611 Multimedia Outline Compression RTP Scheduling.
JPEG.
CS654: Digital Image Analysis
Page 11/28/2016 CSE 40373/60373: Multimedia Systems Quantization  F(u, v) represents a DCT coefficient, Q(u, v) is a “quantization matrix” entry, and.
Block-based coding Multimedia Systems and Standards S2 IF Telkom University.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Introduction to JPEG m Akram Ben Ahmed
MPEG CODING PROCESS. Contents  What is MPEG Encoding?  Why MPEG Encoding?  Types of frames in MPEG 1  Layer of MPEG1 Video  MPEG 1 Intra frame Encoding.
Chapter 13 Discrete Image Transforms
An introduction to audio/video compression Prepared by :: Bhatt shivani ( )
Complexity varying intra prediction in H.264 Supervisors: Dr. Ofer Hadar, Mr. Evgeny Kaminsky Students: Amit David, Yoav Galon.
JPEG Compression What is JPEG? Motivation
Chapter 9 Image Compression Standards
Data Compression.
Multimedia Outline Compression RTP Scheduling Spring 2000 CS 461.
Algorithms in the Real World
Digital Image Processing Lecture 21: Lossy Compression May 18, 2005
Digital Image Processing Lecture 21: Lossy Compression
Last update on June 15, 2010 Doug Young Suh
Discrete Cosine Transform
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
JPEG.
Data Compression.
Chapter 7.2: Layer 5: Compression
Data Compression CS 147 Minh Nguyen.
CMPT 365 Multimedia Systems
Why Compress? To reduce the volume of data to be transmitted (text, fax, images) To reduce the bandwidth required for transmission and to reduce storage.
CIS679: MPEG MPEG.
Standards Presentation ECE 8873 – Data Compression and Modeling
ESE532: System-on-a-Chip Architecture
MPEG4 Natural Video Coding
Judith Molka-Danielsen, Oct. 02, 2000
JPEG Still Image Data Compression Standard
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Chapter 8 – Compression Aims: Outline the objectives of compression.
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Presentation transcript:

ESE532: System-on-a-Chip Architecture Day 16: March 20, 2017 MPEG Encoding Penn ESE532 Spring 2017 -- DeHon

Today MPEG Encoding Project Motion Estimation DCT Entropy Encoding Penn ESE532 Spring 2017 -- DeHon

Message Compression is about exploiting (eliminating) Redundancy (lossless) Things humans don’t notice much (lossy) Redundancy in video Temporal: data repeated frame-to-frame Spatial: frequency patterns Quantize: high frequencies Entropy encode values (e.g. frequencies) Penn ESE532 Spring 2017 -- DeHon

Project Continue to work with MPEG Encoder Speed up as much as possible on Zynq Estimate custom design to achieve real-time for 1080p30: 1920x1080 at 30 fps Groups of 2 – you select partners Next 5 weeks: project report 4/21 Weekly milestones Penn ESE532 Spring 2017 -- DeHon

Why MPEG Encode? Original intent: different problem Experience: MPEG harder than intended for first half warmup Probably right complexity for project Avoid giving you a project too complex Want you to succeed at accelerating Penn ESE532 Spring 2017 -- DeHon

Expect You will need to rewrite more of the code than you have so far C written for reference not organized or written correctly for acceleration Penn ESE532 Spring 2017 -- DeHon

Why not do this before? Expected wouldn’t need to get this deep into it for the homework series. Could focus on bottleneck pieces and small snippets …as we did for HW3 was familiar Penn ESE532 Spring 2017 -- DeHon

MPEG Encode Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Temporal Redundancy Penn ESE532 Spring 2017 -- DeHon

Frame-to-Frame How are two immediately adjacent video frames likely to be related? Common cases Fixed camera (e.g. security camera) Panning camera Object moving left to right Penn ESE532 Spring 2017 -- DeHon

Idea: Temporal Coding If part of frame not change Avoid resending If something moves in frame Identify where to find in previous frame Penn ESE532 Spring 2017 -- DeHon

MPEG Simplification Break image into 16x16 macroblocks Try to find macroblock in previous frame (or subsequent frame) Ideal Find perfect match Only send location of match Penn ESE532 Spring 2017 -- DeHon

Preclass 1 How big is pointer for 1920x1080 frame? How much cheaper than sending 16x16 macroblock with 8b pixels? Penn ESE532 Spring 2017 -- DeHon

Macroblock Match Finding “identical” macroblock: Where is this likely to work? What complicates? Penn ESE532 Spring 2017 -- DeHon

Challenge May not be exactly identical Shadows change Something moves over part of macroblock Thing in macroblock distorts Person talks, turns, rotates Object moves toward/away from camera Penn ESE532 Spring 2017 -- DeHon

Not Identical Send difference Maybe less information than new macroblock E.g. background occluded (exposed) on side Eye opens (closes) Penn ESE532 Spring 2017 -- DeHon

Finding Find matching macroblock How go about finding? Or best matching (hence dist) How go about finding? Penn ESE532 Spring 2017 -- DeHon

Local Search Hypothesize that the macroblock is nearby in previous image. Why might be good hypothesis? Simple Exhaustively search within some distance Why expensive? Penn ESE532 Spring 2017 -- DeHon

Limited Motion After a number of frames, less likely to find in previous frame New objects, turns, rotation, scale… Send new, non-motion coded reference Penn ESE532 Spring 2017 -- DeHon

MPEG Frames Interleave I, P, and B frames E.g. (IBBPBBPBBPBB)* I – not motion coded P – forward prediction frames Predict from previous frame B – backward prediction frames Predict from future frames E.g. (IBBPBBPBBPBB)* Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Spatial Redundancy Can code more efficiently in frequency domain Humans notice low frequency components more than high frequency Can use fewer bits for high frequency components Penn ESE532 Spring 2017 -- DeHon

Fourier Transform Identify spectral components Day 14 Fourier Transform Identify spectral components Convert between Time-domain to Frequency-domain E.g. tones from data samples Central to audio coding – e.g. MP3 audio Penn ESE532 Spring 2017 -- DeHon

Discrete Cosine Transform Similar to FFT Only uses Cosine (real part) (boundary condition) Penn ESE532 Spring 2017 -- DeHon

2D-DCT Basis Actually compute 2D-DCT DCT in each spatial dimension On 8x8 blocks Can be viewed as a basis transform Re-expressing the 8x8 block in terms of 8x8 selection of x and y frequencies Penn ESE532 Spring 2017 -- DeHon

2D-DCT Basis Basis vectors, so all 64 components are orthogonal Any 8x8 spatial is a weighted sum of these 64 components Penn ESE532 Spring 2017 -- DeHon

Preclass 2 Represent all 23 pixel block? Non-zeros for horizontal stripes? Non-zeros for vertical stripes? Penn ESE532 Spring 2017 -- DeHon

DCT Benefits Concentrates weight in low frequency components (upper left) High frequency components can be dropped or represented with few bits Not matter so much to human perception Penn ESE532 Spring 2017 -- DeHon

DCT Example Source: http://img.tomshardware.com/us/1999/09/24/video_guide_part_3/dct.gif Penn ESE532 Spring 2017 -- DeHon

2D DCT Calculation Brute force like this O(n4) n2 entries Each require n2 terms Penn ESE532 Spring 2017 -- DeHon

2D DCT Calculation fdct Decompose, like FFT Perform 1D DCT across rows O(n3) n2 results, each O(n) Perform 1D DCT across columns O(n3) Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Quantize EXTERN unsigned char default_intra_quantizer_matrix[64] #ifdef GLOBAL = { 8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, 22, 26, 27, 29, 32, 35, 40, 48, 26, 27, 29, 32, 35, 40, 48, 58, 26, 27, 29, 34, 38, 46, 56, 69, 27, 29, 35, 38, 46, 56, 69, 83 } #endif Penn ESE532 Spring 2017 -- DeHon

Quantize Divide by entry in quantizer matrix before change to integer EXTERN unsigned char default_intra_quantizer_matrix[64] #ifdef GLOBAL = { 8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, 22, 26, 27, 29, 32, 35, 40, 48, 26, 27, 29, 32, 35, 40, 48, 58, 26, 27, 29, 34, 38, 46, 56, 69, 27, 29, 35, 38, 46, 56, 69, 83 } #endif Divide by entry in quantizer matrix before change to integer Most bits to upper left Few bits to lower right More things threshold to zero Penn ESE532 Spring 2017 -- DeHon

Quantize and Precision EXTERN unsigned char default_intra_quantizer_matrix[64] #ifdef GLOBAL = { 8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, 22, 26, 27, 29, 32, 35, 40, 48, 26, 27, 29, 32, 35, 40, 48, 58, 26, 27, 29, 34, 38, 46, 56, 69, 27, 29, 35, 38, 46, 56, 69, 83 } #endif What does quantization mean for DCT precisions? Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Value Diminish to Lower Right Source: http://img.tomshardware.com/us/1999/09/24/video_guide_part_3/dct.gif Penn ESE532 Spring 2017 -- DeHon

Zig-Zag Order Groups zeros (and small constants) together at end Source: https://en.wikipedia.org/wiki/JPEG#/media/File:JPEG_ZigZag.svg Penn ESE532 Spring 2017 -- DeHon

Value Diminish to Lower Right Source: http://img.tomshardware.com/us/1999/09/24/video_guide_part_3/dct.gif Source: https://en.wikipedia.org/wiki/JPEG#/media/File:JPEG_ZigZag.svg Penn ESE532 Spring 2017 -- DeHon

Value Diminish to Lower Right 45 -5 12 0 0 0 -4 -3 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 …. Source: http://img.tomshardware.com/us/1999/09/24/video_guide_part_3/dct.gif Source: https://en.wikipedia.org/wiki/JPEG#/media/File:JPEG_ZigZag.svg Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Preclass 3 How many numbers in the Run-Length encoding? 45 -5 12 0 0 0 -4 -3 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 …. Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Preclass 4 How many bits to Huffman encode? Compare to 8b encoding of RLE? Penn ESE532 Spring 2017 -- DeHon

Huffman void putbits(val,n) { mask = 1 << (n-1); /* selects first (leftmost) bit */ for (i=0; i<n; i++) outbfr <<= 1; if (val & mask) outbfr|= 1; mask >>= 1; /* select next bit */ outcnt--; if (outcnt==0) /* 8 bit buffer full */ output_buf[bytecnt] = outbfr; outcnt = 8; bytecnt++; if (bytecnt == OUTPUT_BUF_SIZE) error("Output buffer too small."); } Bit twiddling for Huffman coding inefficient on word-wide processor Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

MPEG Encoder Penn ESE532 Spring 2017 -- DeHon

Big Ideas Compression is about exploiting (eliminating) Redundancy (lossless) Things humans don’t notice much (lossy) Redundancy in video Temporal: data repeat frame-to-frame Spatial: frequency patterns Quantize: high frequencies Entropy encode values (e.g. frequencies) Penn ESE532 Spring 2017 -- DeHon

Admin Project and Project Analysis Milestone out Project Analysis Milestone due Friday Including teaming Penn ESE532 Spring 2017 -- DeHon