ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission (10-19-06) Image Compression Review of Basics Huffman coding run length coding Quantization.

Slides:



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

Data Compression CS 147 Minh Nguyen.
Sampling and Pulse Code Modulation
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Information Theory EE322 Al-Sanie.
Quantization Prof. Siripong Potisuk.
Chapter 6 Information Theory
Compression & Huffman Codes
School of Computing Science Simon Fraser University
ENEE631 Digital Image Processing (Spring'04) Basics on Image Compression Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland, College Park.
Department of Computer Engineering University of California at Santa Cruz Data Compression (1) Hai Tao.
Spatial and Temporal Data Mining
SWE 423: Multimedia Systems Chapter 7: Data Compression (2)
Computer Science 335 Data Compression.
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 건국대학교 인터넷미디어공학부 임 창 훈.
2015/7/12VLC 2008 PART 1 Introduction on Video Coding StandardsVLC 2008 PART 1 Variable Length Coding  Information entropy  Huffman code vs. arithmetic.
Noise, Information Theory, and Entropy
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.
Speech coding. What’s the need for speech coding ? Necessary in order to represent human speech in a digital form Applications: mobile/telephone communication,
©2003/04 Alessandro Bogliolo Background Information theory Probability theory Algorithms.
Chapter 2 Source Coding (part 2)
Computer Vision – Compression(2) Hanyang University Jong-Il Park.
Chapter 6 Basics of Digital Audio
 Coding efficiency/Compression ratio:  The loss of information or distortion measure:
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2011.
Prof. Amr Goneid Department of Computer Science & Engineering
CE Digital Signal Processing Fall 1992 Waveform Coding Hossein Sameti Department of Computer Engineering Sharif University of Technology.
CIS679: Multimedia Basics r Multimedia data type r Basic compression techniques.
1 PCM & DPCM & DM. 2 Pulse-Code Modulation (PCM) : In PCM each sample of the signal is quantized to one of the amplitude levels, where B is the number.
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.
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:
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part 8. Greedy Algorithms.
Design of Novel Two-Level Quantizer with Extended Huffman Coding for Laplacian Source Lazar Velimirović, Miomir Stanković, Zoran Perić, Jelena Nikolić,
Huffman Code and Data Decomposition Pranav Shah CS157B.
Outline Transmitters (Chapters 3 and 4, Source Coding and Modulation) (week 1 and 2) Receivers (Chapter 5) (week 3 and 4) Received Signal Synchronization.
Chapter 8 Image Compression. Portable bit map Family (BMP, Lena 66,616B) Graphics interchange Format (GIF, Lena 70,458B) Tag image file format (TIFF/TIF,
Source Coding Efficient Data Representation A.J. Han Vinck.
PCM & DPCM & DM.
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 Lecture 34: Different Coding Techniques.
Wiener Filtering for Image Restoration & Basics on Image Compression
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission ( ) Image Compression Quantization independent samples uniform and optimum correlated.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 4 ECE-C490 Winter 2004 Image Processing Architecture Lecture 4, 1/20/2004 Principles.
Chapter 8 Lossy Compression Algorithms. Fundamentals of Multimedia, Chapter Introduction Lossless compression algorithms do not deliver compression.
Multi-media Data compression
Image Processing and Coding 1. Image  Rich info. from visual data  Examples of images around us natural photographic images; artistic and engineering.
1 Data Compression Hae-sun Jung CS146 Dr. Sin-Min Lee Spring 2004.
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.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2012.
Fundamentals of Multimedia Chapter 6 Basics of Digital Audio Ze-Nian Li and Mark S. Drew 건국대학교 인터넷미디어공학부 임 창 훈.
Dr. Hadi AL Saadi Image Compression. Goal of Image Compression Digital images require huge amounts of space for storage and large bandwidths for transmission.
UNIT I. Entropy and Uncertainty Entropy is the irreducible complexity below which a signal cannot be compressed. Entropy is the irreducible complexity.
Submitted To-: Submitted By-: Mrs.Sushma Rani (HOD) Aashish Kr. Goyal (IT-7th) Deepak Soni (IT-8 th )
Chapter 8 Lossy Compression Algorithms
EE465: Introduction to Digital Image Processing
Data Compression.
Data Compression.
Huffman Coding, Arithmetic Coding, and JBIG2
Data Compression CS 147 Minh Nguyen.
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.
PCM & DPCM & DM.
Speech coding.
Presentation transcript:

ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission ( ) Image Compression Review of Basics Huffman coding run length coding Quantization independent samples uniform and optimum correlated samples vector quantization 10/19/06

ELE 488 F06 Why Compression? Storage and transmission –Large size of uncompressed multimedia data –High bandwidth to send uncompressed video in real time. Slow access to storage devices does not allow real time play back of uncompressed content –1 x CD-ROM transfer rate ~ 150 kB/s –320 x 240 x 24 fps video ~ 5.5MB/s => 36 seconds to transfer 1-sec uncompressed video from CD UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Example: Storing An Encyclopedia –500,000 pages of text (2kB/page) ~ 1GB => 2:1 3,000 color pictures (640  480  24bits) ~ 3GB => 15:1 –500 maps (640  480  16bits=0.6MB/map) ~ 0.3GB => 10:1 –60 minutes of stereo sound (176kB/s) ~ 0.6GB => 6:1 –30 animations with average 2 minutes long (640  320  16bits  16frames/s=6.5MB/s) ~ 23.4GB => 50:1 –50 digitized movies with average 1 minute long (640  480  24bits  30frames/s = 27.6MB/s) ~ 82.8GB => 50:1 Require a total of 111.1GB storage capacity without compression Reduce to 2.96GB with compression From Ken Lam’s DCT talk 2001 (HK Polytech) UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Sampling and Quantization Signal is sampled Each sample quantized to B bits (uniform steps)  B bit per sample How many samples? –Nyquist –In practice? B = ? –Signal to noise ratio: 6 dB per bit –Meaning in practice? CD music: 44100x2x16 = 1.41 Mb/sec – raw data rate Observations: –Not all quantization levels occur equally likely Should B bits be used for the frequently occurred samples as well as less likely occurred samples? –Why uniform quantization? sampler + quantizer encoder image capture

ELE 488 F06 Variable Length Codes Quantized PCM values may not occur with equal probability –Is it best to use same # of bits for each sample? Example: 4 levels with probabilities: P(level 1)=0.125, P(level 2)=0.5, P(level 3)=0.25, P(level 4)=0.125 –Need 2 bits to code each symbol IF using same # bits –If use less bits for levels with high probability and more bits for low probability (Variable Length Codes – VLC) level 2 => [0], level 3 => [10], level 1 => [110], and level 4 => [111 ] Average code length is  i p i l i =1.75 bits < 2 bits Compression ration = 2/1.75 UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Entropy Coding Use fewer bits for commonly occurred values Minimum # of bits for each level determined by “entropy of source” –Entropy is a measure of information of a source Definition: H =  i p i log 2 (1 / p i ) bits (entropy of previous example is 1.75) Can represent a source perfectly with avg. H+  bits per sample (Shannon Lossless Coding Theorem) –“Compressability” depends on the sources Need to design a codebook to decode the encoded stream efficiently and without ambiguity Huffman Coding – assigns ~ log 2 (1/p i ) bits for the i th symbol UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

ELE 488 F06 Huffman Coding S0 S1 S2 S3 S4 S5 S6 S PCM Huffman (trace from root) UMCP ENEE631 Slides (created by M.Wu © 2001) Step 1 – Arrange pi in decreasing order Step 2 – Merge two nodes with smallest prob to a new node and sum up prob. Arbitrarily assign 1 and 0 to each pair of merging branch Step-3 – Repeat until only one node left Read out codeword sequentially from root to leaf

ELE 488 F06 Huffman Coding: Pros & Cons Pro –Simple to implement (table lookup) –Gives best coding efficiency Con –Need source statistics –Integer code length for each symbol  average code length usually larger than min (entropy) Improvement –Code groups of symbols –Arithmetic coding –Lempel-Ziv coding or LZW algorithm “universal”, no need to estimate source statistics fix-length codeword for variable-length source symbols UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Run-Length Coding How to efficiently encode a string of binary symbols (2 levels)? “ w w w w w w w b b w w w b w b w w w w w w b b b....” Run-length coding (RLC) –Code lengths of runs of w and of b good if often getting frequent large runs of “0” and sparse “1” –For the example (7w) (1b) (3w) (1b) (1w) (1b) (6w) (3b)... –Assign fixed-length codeword to run-lengths in a range (e.g. <7) –Or use variable-length code (Huffman) to obtain further improvement RLC also applicable to general a data sequence with many consecutive “w” or “b” UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Facsimile

ELE 488 F06 Probability Model of Run-Length Coding Assume w occurs independently with probability p Calculate prob of runs of length L. Restrict L to L=0,1, …, M P( L = l ) = p L (1 – p) for 0  l  M –1 (geometric distribution) P( L = M ) = p M (when having M or more “0”) Avg. # binary symbols per zero-run –S avg =  L (L+1) p L (1-p) + M p M = (1 – p M ) / ( 1 – p ) Compression ratio C = S avg / log 2 (M+1) = (1 – p M ) / [( 1–p ) log 2 (M+1)] Example –p = 0.9, M=15  S avg = 7.94, C = 1.985, H = bpp –Avg. run-length coding rate B avg = 4 bit / 7.94 ~ bpp –Coding efficiency = H / B avg ~ 91% UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Sampling and Quantization Signal is sampled Each sample quantized to B bits (uniform steps)  B bit per sample How many samples? –Nyquist –In practice? B = ? –Signal to noise ratio: 6 dB per bit –Meaning in practice? CD music: 44100x2x16 = 1.41 Mb/sec – raw data rate Observations: –Not all quantization levels occur equally likely Should B bits be used for the frequently occurred samples as well as less likely occurred samples? –Why uniform quantization? sampler + quantizer encoder image capture

ELE 488 F06 Quantization Quantizer x ↔ u correction

ELE 488 F06 Quantization Quantizer …

ELE 488 F06 Mean Square Error Mean square error: Optimization problem: Solution gives optimum thresholds (t k ) and reconstruction values (r k )

ELE 488 F06 Solution r k conditional mean (centroid)

ELE 488 F06 The Lloyd-Max Quantizer Optimal mean square error quantizer: Nonlinear equations. Closed form solution only for simple p(x). Resort to numerical solution in general.

ELE 488 F06 Numerical Solution of the LM Equations Iterative algorithm: a. Pick initial values for t (e.g. uniform grid) b. Find r values using (1). ( numerical integration) c. Find new t values using (2) d. Go to line b until the t and r values converge OR: Start with a=t1 and r1. Determine t2 using (1). Then determine r2 using (2) …. If tL>b, repeat with smaller r1. If tL < b, repeat with larger r1.

ELE 488 F06 Observations on the optimal quanitizer

ELE 488 F06 Example: Uniform Density Uniform quantizer is the optimal mean square quantizer

ELE 488 F06 Uniform Density, cont. Uniform density of interval:

ELE 488 F06 Example: Triangle Start with uniform quantizer Use iterative algorithm. optimum thresholds (red) reconstruction values (blue)

ELE 488 F06 Example: Gaussian Start with uniform quantizer Use iterative algorithm. optimum thresholds (red) and reconstruction values (blue)

ELE 488 F06 Example: Triangle 2 Start with uniform quantizer Use iterative algorithm. optimum thresholds (red) and reconstruction values (blue)

ELE 488 F06 Example: Gaussian Mixture Start with uniform quantizer Use iterative algorithm. optimum thresholds (red) and reconstruction values (blue)

ELE 488 F06 (Jain’s Fig.4.17) Piecewise Constant Approximation Approximation of Optimum Quantizer for Large L

ELE 488 F06 Implement Nonuniform Quantizer Using Companding Compressor-Expander –Uniform quantizer proceeded and followed by nonlinear operations Why use compandor? –Smaller values suffer more distortion under uniform quantizer –Nonlinearity in perceived luminance small difference in low luminance is more visible –Overall companding system may approximate Lloyd-Max quantizer f(.) compressor g(.) expander Uniform quantizer u w yu’ UMCP ENEE631 Slides (created by M.Wu © 2001)

ELE 488 F06 Compandor Nonlinear transformation –To make overall system approximate Lloyd-Max quantizer –Without iterative process to determine parameters (Jain’s Fig.4.19) UMCP ENEE631 Slides (created by M.Wu © 2001)