CS 414 - Spring 2012 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2012.

Slides:



Advertisements
Similar presentations
T.Sharon-A.Frank 1 Multimedia Compression Basics.
Advertisements

Data Compression CS 147 Minh Nguyen.
Multimedia Communications EG 371 and EG 348
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Huffman code and ID3 Prof. Sin-Min Lee Department of Computer Science.
Data Compression Michael J. Watts
Spring 2003CS 4611 Multimedia Outline Compression RTP Scheduling.
Introduction to Data Compression
Lecture 6: Huffman Code Thinh Nguyen Oregon State University.
SWE 423: Multimedia Systems
Department of Computer Engineering University of California at Santa Cruz Data Compression (1) Hai Tao.
Spatial and Temporal Data Mining
Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.
Data Compression Basics
Klara Nahrstedt Spring 2014
Fundamentals of Multimedia Chapter 7 Lossless Compression Algorithms Ze-Nian Li and Mark S. Drew 건국대학교 인터넷미디어공학부 임 창 훈.
Department of Computer Engineering University of California at Santa Cruz Data Compression (2) Hai Tao.
2007Theo Schouten1 Compression "lossless" : f[x,y]  { g[x,y] = Decompress ( Compress ( f[x,y] ) | “lossy” : quality measures e 2 rms = 1/MN  ( g[x,y]
Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.
Data Compression Basics & Huffman Coding
Noise, Information Theory, and Entropy
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.
1 Lossless Compression Multimedia Systems (Module 2) r Lesson 1: m Minimum Redundancy Coding based on Information Theory: Shannon-Fano Coding Huffman Coding.
Spring 2015 Mathematics in Management Science Binary Linear Codes Two Examples.
Image Compression - JPEG. Video Compression MPEG –Audio compression Lossy / perceptually lossless / lossless 3 layers Models based on speech generation.
Noise, Information Theory, and Entropy
8. Compression. 2 Video and Audio Compression Video and Audio files are very large. Unless we develop and maintain very high bandwidth networks (Gigabytes.
Computer Vision – Compression(2) Hanyang University Jong-Il Park.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
Algorithm Design & Analysis – CS632 Group Project Group Members Bijay Nepal James Hansen-Quartey Winter
MULTIMEDIA TECHNOLOGY SMM 3001 DATA COMPRESSION. In this chapter The basic principles for compressing data The basic principles for compressing data Data.
Klara Nahrstedt Spring 2011
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2011.
Page 110/6/2015 CSE 40373/60373: Multimedia Systems So far  Audio (scalar values with time), image (2-D data) and video (2-D with time)  Higher fidelity.
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 6 – Basics of Compression (Part 1) Klara Nahrstedt Spring 2010.
Multimedia Specification Design and Production 2012 / Semester 1 / L3 Lecturer: Dr. Nikos Gazepidis
CIS679: Multimedia Basics r Multimedia data type r Basic compression techniques.
Image Compression (Chapter 8) CSC 446 Lecturer: Nada ALZaben.
Compression.  Compression ratio: how much is the size reduced?  Symmetric/asymmetric: time difference to compress, decompress?  Lossless; lossy: any.
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.
Addressing Image Compression Techniques on current Internet Technologies By: Eduardo J. Moreira & Onyeka Ezenwoye CIS-6931 Term Paper.
Lossless Compression CIS 465 Multimedia. Compression Compression: the process of coding that will effectively reduce the total number of bits needed to.
COMPRESSION. Compression in General: Why Compress? So Many Bits, So Little Time (Space) CD audio rate: 2 * 2 * 8 * = 1,411,200 bps CD audio storage:
Huffman coding Content 1 Encoding and decoding messages Fixed-length coding Variable-length coding 2 Huffman coding.
Huffman Code and Data Decomposition Pranav Shah CS157B.
Spring 2000CS 4611 Multimedia Outline Compression RTP Scheduling.
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014.
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 6 – Basics of Compression (Part 1) Klara Nahrstedt Spring 2011.
Lecture 4: Lossless Compression(1) Hongli Luo Fall 2011.
CS654: Digital Image Analysis
CS654: Digital Image Analysis Lecture 34: Different Coding Techniques.
Digital Image Processing Lecture 22: Image Compression
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Lossless Decomposition and Huffman Codes Sophia Soohoo CS 157B.
Multi-media Data compression
Chapter 7 Lossless Compression Algorithms 7.1 Introduction 7.2 Basics of Information Theory 7.3 Run-Length Coding 7.4 Variable-Length Coding (VLC) 7.5.
Huffman code and Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 19 – Multimedia Transport Subsystem (Part 2) + Midterm Review Klara Nahrstedt Spring 2014.
Lecture 12 Huffman Coding King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department.
Dr. Hadi AL Saadi Image Compression. Goal of Image Compression Digital images require huge amounts of space for storage and large bandwidths for transmission.
Submitted To-: Submitted By-: Mrs.Sushma Rani (HOD) Aashish Kr. Goyal (IT-7th) Deepak Soni (IT-8 th )
Digital Image Processing Lecture 20: Image Compression May 16, 2005
Data Compression.
Multimedia Outline Compression RTP Scheduling Spring 2000 CS 461.
Image Compression The still image and motion images can be compressed by lossless coding or lossy coding. Principle of compression: - reduce the redundant.
Data Compression.
Data Compression CS 147 Minh Nguyen.
UNIT IV.
Judith Molka-Danielsen, Oct. 02, 2000
Presentation transcript:

CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2012

CS Spring 2012 Administrative MP1 is posted  Leasing Web cameras + check cameras  Check group directories Reading: “Media Coding and Content Processing”, for Compression - Chapter 7  Basic Coding – Chapter  JPEG – Chapter 7.5  MPEG – Chapter 7.7  JPEG 2000 and H.264 – see lectures and links in the lectures

Comments on Reading for Audio, Video, Images Content Reading: “Media Coding and Content Processing” Audio Technology: Chapter 3  Chapters Lectures Images: Chapter 4  Chapters Lectures and links in the lectures Video: Chapter 5 (all + lectures) CS Spring 2012

Statistical Entropy Coding  Huffman coding  Arithmetic coding Hybrid Coding Steps  Picture preparation  Quantization  Entropy coding CS Spring 2012 Today Discussed Topics

Huffman Encoding Statistical encoding To determine Huffman code, it is useful to construct a binary tree Leaves are characters to be encoded Nodes carry occurrence probabilities of the characters belonging to the sub-tree CS Spring 2012 Source: images.search.yahoo.com (D. Huffman)

Huffman Encoding (Example) P(C) = 0.09P(E) = 0.11 P(D) = 0.13 P(A)=0.16 P(B) = 0.51 Step 1 : Sort all Symbols according to their probabilities (left to right) from Smallest to largest these are the leaves of the Huffman tree CS Spring 2012

Huffman Encoding (Example) P(C) = 0.09P(E) = 0.11 P(D) = 0.13 P(A)=0.16 P(B) = 0.51 P(CE) = 0.20 P(DA) = 0.29 P(CEDA) = 0.49 P(CEDAB) = 1 Step 2: Build a binary tree from left to Right Policy: always connect two smaller nodes together (e.g., P(CE) and P(DA) had both Probabilities that were smaller than P(B), Hence those two did connect first CS Spring 2012

Huffman Encoding (Example) P(C) = 0.09P(E) = 0.11 P(D) = 0.13 P(A)=0.16 P(B) = 0.51 P(CE) = 0.20 P(DA) = 0.29 P(CEDA) = 0.49 P(CEDAB) = Step 3: label left branches of the tree With 0 and right branches of the tree With CS Spring 2012

Huffman Encoding (Example) P(C) = 0.09P(E) = 0.11 P(D) = 0.13 P(A)=0.16 P(B) = 0.51 P(CE) = 0.20 P(DA) = 0.29 P(CEDA) = 0.49 P(CEDAB) = Step 4: Create Huffman Code Symbol A = 011 Symbol B = 1 Symbol C = 000 Symbol D = 010 Symbol E = CS Spring 2012

Huffman Decoding Assume Huffman Table Symbol Code X 0 Y 10 Z 11 Consider encoded bitstream: CS Spring 2012 What is the decoded string?

Huffman Example Construct the Huffman coding tree (in class) Symbol (S)P(S) A0.25 B0.30 C0.12 D0.15 E0.18

Characteristics of Solution Symbol (S)Code A01 B11 C100 D101 E00 CS Spring 2012

Example Encoding/Decoding Encode “BEAD”   Decode “ ” Symbol (S)Code A01 B11 C100 D101 E00 CS Spring 2012

Entropy (Theoretical Limit) = -.25 * log * log * log * log * log 2.18 H = 2.24 bits SymbolP(S)Code A B C D E0.1800

Average Codeword Length =.25(2) +.30(2) +.12(3) +.15(3) +.18(2) L = 2.27 bits SymbolP(S)Code A B C D E0.1800

Code Length Relative to Entropy Huffman reaches entropy limit when all probabilities are negative powers of 2  i.e., 1/2; 1/4; 1/8; 1/16; etc. H ≤Code Length ≤ H + 1 CS Spring 2012

Example H = -.01*log *log 2.99 =.08 L =.01(1) +.99(1) = 1 SymbolP(S)Code A0.011 B0.990 CS Spring 2012

Group Exercise Compute Entropy (H) Build Huffman tree Compute average code length Code “BCCADE” Symbol (S)P(S) A0.1 B0.2 C0.4 D0.2 E0.1 CS Spring 2012

Limitations Diverges from lower limit when probability of a particular symbol becomes high  always uses an integral number of bits Must send code book with the data  lowers overall efficiency Must determine frequency distribution  must remain stable over the data set CS Spring 2012

Arithmetic Coding Optimal algorithm as Huffman coding wrt compression ratio Better algorithm than Huffman wrt transmitted amount of information  Huffman – needs to transmit Huffman tables with compressed data  Arithmetic – needs to transmit length of encoded string with compressed data CS Spring 2012

Arithmetic Coding Each symbol is coded by considering the prior data Encoded data must be read from the beginning, there is no random access possible Each real number (< 1) is represented as binary fraction  0.5 = 2 -1 (binary fraction = 0.1); 0.25 = 2 -2 (binary fraction = 0.01), = (binary fraction = 0.101) …. CS Spring 2012

Adaptive Encoding (Adaptive Huffman) Huffman code changes according to usage of new words  New probabilities can be assigned to individual letters If Huffman tables adapt, they must be transmitted to receiver side CS Spring 2012

Adaptive Huffman Coding Example SymbolCodeOriginal probabilities A001P(A) = 0.16 B1P(B) = 0.51 C011P( C) = 0.09 D000P(D) = 0.13 E010P(E) = 0.11 SymbolCodeNew Probabilities (based on new word BACAAB) A1P(A) = 0.5 B01P(B) = 1/3 C001P(C ) = 1/6 D0000P(D) = 0 E0001P(E) = 0 CS Spring 2012

Usage of Entropy Coding in Hybrid Coding Schemes CS Spring 2012 RLE, Huffman or Arithmetic Coding Lossy Coding Lossless Coding

Picture Preparation Generation of appropriate digital representation  Image division into 8x8 blocks  Fix number of bits per pixel (first level quantization – mapping from real numbers to bit representation) CS Spring 2012

Other Compression Steps Picture processing (Source Coding)  Transformation from time to frequency domain (e.g., use Discrete Cosine Transform)  Motion vector computation in video Quantization  Reduction of precision, e.g., cut least significant bits  Quantization matrix, quantization values Entropy Coding  Huffman Coding + RLE CS Spring 2012

Audio Compression and Formats MPEG-3 (uses Huffman) ADPCM u-Law Real Audio Windows Media (.wma) Sun (.au) Apple (.aif) Microsoft (.wav) CS Spring 2012

Image Compression and Formats Image Compression uses  RLE, Huffman, LZW – Lempel-Ziv-Welch (lossless data compression) Example Formats: GIF, JPEG / JPEG (Hybrid Coding), TIFF, BMP, etc. CS Spring 2012

Video Compression and Formats H.261/H.263/H.264 Cinepak (early 1992 Apple’s video codec in Quick-time video suite) Sorensen (Sorenson Media, used in Quick-time and Macromedia flash) Indeo (early 1992 Intel video codec) Real Video (1997 RealNetworks) MPEG-1, MPEG-2, MPEG-4, etc. QuickTime, AVI, WMV (Windows Media Video) CS Spring 2012

Summary Important Lossless (Entropy) Coders  RLE, Huffman Coding and Arithmetic Coding Important Lossy (Source ) Coders  Quantization Differential PCM (DPCM) – calculate difference from previous values – one has fewer values to encode Loss occurs during quantization of sample values, hence loss on difference precision occurs as well CS Spring 2012

Solution to Group Exercise Compute Entropy (H)  H = 2.1 bits Build Huffman tree Compute code length  L = 2.2 bits Code “BCCADE” => SymbolP(S)Code A B C0.40 D E CS Spring 2012