Quantization Heejune AHN Embedded Communications Laboratory Seoul National Univ. of Technology Fall 2013 Last updated 2013. 9. 24.

Slides:



Advertisements
Similar presentations
Multimedia Data Compression
Advertisements

Object Specific Compressed Sensing by minimizing a weighted L2-norm A. Mahalanobis.
2806 Neural Computation Self-Organizing Maps Lecture Ari Visa.
Sampling and Pulse Code Modulation
Computer vision: models, learning and inference Chapter 13 Image preprocessing and feature extraction.
Technion - IIT Dept. of Electrical Engineering Signal and Image Processing lab Transrating and Transcoding of Coded Video Signals David Malah Ran Bar-Sella.
ECE 8443 – Pattern Recognition ECE 8423 – Adaptive Signal Processing Objectives: Newton’s Method Application to LMS Recursive Least Squares Exponentially-Weighted.
Visual Recognition Tutorial
School of Computing Science Simon Fraser University
CSE 589 Applied Algorithms Spring 1999 Image Compression Vector Quantization Nearest Neighbor Search.
Spatial and Temporal Data Mining
Digital Image Processing Chapter 5: Image Restoration.
Location Estimation in Sensor Networks Moshe Mishali.
CSc 461/561 Multimedia Systems Part B: 2. Lossy Compression
Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.
Frederic Payan, Marc Antonini
© 2005, it - instituto de telecomunicações. Todos os direitos reservados. Gerhard Maierbacher Scalable Coding Solutions for Wireless Sensor Networks IT.
Image (and Video) Coding and Processing Lecture: DCT Compression and JPEG Wade Trappe Again: Thanks to Min Wu for allowing me to borrow many of her slides.
CS :: Fall 2003 MPEG-1 Video (Part 1) Ketan Mayer-Patel.
1 A Unified Rate-Distortion Analysis Framework for Transform Coding Student : Ho-Chang Wu Student : Ho-Chang Wu Advisor : Prof. David W. Lin Advisor :
Lattices for Distributed Source Coding - Reconstruction of a Linear function of Jointly Gaussian Sources -D. Krithivasan and S. Sandeep Pradhan - University.
Chapter 11 Multiple Regression.
1 Image and Video Compression: An Overview Jayanta Mukhopadhyay Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur,
Introduction to Optimization (Part 1)
Normalised Least Mean-Square Adaptive Filtering
Lossy Compression Based on spatial redundancy Measure of spatial redundancy: 2D covariance Cov X (i,j)=  2 e -  (i*i+j*j) Vertical correlation   
Pulse Modulation 1. Introduction In Continuous Modulation C.M. a parameter in the sinusoidal signal is proportional to m(t) In Pulse Modulation P.M. a.
©2003/04 Alessandro Bogliolo Background Information theory Probability theory Algorithms.
Computer Vision – Compression(2) Hanyang University Jong-Il Park.
Encoding Stereo Images Christopher Li, Idoia Ochoa and Nima Soltani.
 Coding efficiency/Compression ratio:  The loss of information or distortion measure:
Transform Coding Heejune AHN Embedded Communications Laboratory
IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction
Frame by Frame Bit Allocation for Motion-Compensated Video Michael Ringenburg May 9, 2003.
CMPT 365 Multimedia Systems
Digital image processing Chapter 3. Image sampling and quantization IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction 2. Sampling in the two-dimensional.
Computational Intelligence: Methods and Applications Lecture 23 Logistic discrimination and support vectors Włodzisław Duch Dept. of Informatics, UMK Google:
Image Denoising Using Wavelets
Advances in digital image compression techniques Guojun Lu, Computer Communications, Vol. 16, No. 4, Apr, 1993, pp
Outline Transmitters (Chapters 3 and 4, Source Coding and Modulation) (week 1 and 2) Receivers (Chapter 5) (week 3 and 4) Received Signal Synchronization.
Quantization Watermarking Design and Analysis of Digital Watermarking, Information Embedding, and Data Hiding Systems Brian Chen, Ph. D. Dissertation,
Project 11: Determining the Intrinsic Dimensionality of a Distribution Okke Formsma, Nicolas Roussis and Per Løwenborg.
HMM - Part 2 The EM algorithm Continuous density HMM.
1  The Problem: Consider a two class task with ω 1, ω 2   LINEAR CLASSIFIERS.
1 Source Coding and Compression Dr.-Ing. Khaled Shawky Hassan Room: C3-222, ext: 1204, Lecture 10 Rate-Distortion.
Professors: Eng. Diego Barral Eng. Mariano Llamedo Soria Julian Bruno
Rate-Control in Video Codec Heejune AHN Embedded Communications Laboratory Seoul National Univ. of Technology Fall 2008 Last updated
Autoregressive (AR) Spectral Estimation
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission ( ) Image Compression Quantization independent samples uniform and optimum correlated.
Block-based coding Multimedia Systems and Standards S2 IF Telkom University.
Baseband Receiver Receiver Design: Demodulation Matched Filter Correlator Receiver Detection Max. Likelihood Detector Probability of Error.
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission ( ) Image Compression Review of Basics Huffman coding run length coding Quantization.
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.
Colorado Center for Astrodynamics Research The University of Colorado 1 STATISTICAL ORBIT DETERMINATION Kalman Filter with Process Noise Gauss- Markov.
Fundamentals of Multimedia Chapter 6 Basics of Digital Audio Ze-Nian Li and Mark S. Drew 건국대학교 인터넷미디어공학부 임 창 훈.
RECONSTRUCTION OF MULTI- SPECTRAL IMAGES USING MAP Gaurav.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 5 ECEC 453 Image Processing Architecture Lecture 5, 1/22/2004 Rate-Distortion Theory,
MP3 and AAC Trac D. Tran ECE Department The Johns Hopkins University Baltimore MD
Signal Prediction and Transformation Trac D. Tran ECE Department The Johns Hopkins University Baltimore MD
PATTERN RECOGNITION AND MACHINE LEARNING CHAPTER 1: INTRODUCTION.
Chapter 8 Lossy Compression Algorithms
Pyramid Vector Quantization
The Johns Hopkins University
Analog to digital conversion
Outline Introduction Signal, random variable, random process and spectra Analog modulation Analog to digital conversion Digital transmission through baseband.
Sampling rate conversion by a rational factor
Scalar Quantization – Mathematical Model
Roberto Battiti, Mauro Brunato
Foundation of Video Coding Part II: Scalar and Vector Quantization
Presentation transcript:

Quantization Heejune AHN Embedded Communications Laboratory Seoul National Univ. of Technology Fall 2013 Last updated

Heejune AHN: Image and Video Compressionp. 2 Outline Quantization Concept Quantizer Design Quantizer in Video Coding Vector Quantizer Rate-distortion optimization Concept Lagrangian Method Appendix Detail for Lloyd-max Quantization Algorithm

Heejune AHN: Image and Video Compressionp Quantization Reduce representation set N large points ([0 ~ N large ]) to N small points ([0, … N small ]) Inevitable when Analog to Digital Conversion Not Reversible ! Original (digital/analog) ADC/Quant Quanitzed Levels ReScale

Heejune AHN: Image and Video Compressionp. 4 Scalar Quantizer Quantize a single value (single input & single output) In contrast to VQ (Vector Quantizer, to be discussed later) Mapping function {[x i-1, x i ) => y i } Decision levels to reconstruction level Quantizer input Quantizer output x i-1 xixi yiyi Output : { y i } Input : x Q q Q q

Heejune AHN: Image and Video Compressionp. 5 Quantizer’s Effects + Bit Rate Reduction Bits required to represent the values: (E1bits=> E2 bits) N large (= 2 E1 )points ([0 ~ N]) to N small (= 2 E2 )points ([0, … N small ]) Bit reduction = E2 - E1 = log 2 (N Large /N small ) - Distortion e = y i - x (in [x i-1, x i )) MSE (mean squared error) Trade-off problem

Heejune AHN: Image and Video Compressionp Quantization Design Distortion Quantization error = difference original (x) and quantized (y i ) Distortion Measure Quantizer design parameters Step size (N) decision level (x i ) reconstruction level (y i ) Distortion depends on Input signal distribution (f(x)) Optimization Problem How to set the ranges and reconstruction values, i.e., { y i & [x i-1, x i )} for i =0, … N, so that the resulting MSE is minimized.

Heejune AHN: Image and Video Compressionp. 7 Optimal Quantizer Solutions Note performance depends on the input statistics. Simpler design Uniform (Fixed quant step) quantizer With/Without dead-zone near zero Lloyd-Max algorithm a optimal quantizer design algorithm More levels for dense region, Less levels for sparse region. (non-linear quantizer)

Heejune AHN: Image and Video Compressionp. 8 Uniform Quantizers Properties x i and y i are spaced evenly (so, uniform), with space Δ (step size) Mid-tread (odd # of recon. levels) vs Mid-rise (no zero recon. ) mid-tread is more popular than mid-rise. ∆ 2∆ 3∆ Input -3∆ -2∆ -∆ Reconstruction 3.5∆ 2.5∆ 1.5∆ 0.5 ∆ -0.5 ∆ -1.5∆ -2.5∆ -3.5∆ Uniform Midrise Quantizer -2.5 ∆ -1.5 ∆ -0.5 ∆ Reconstruction 3∆3∆ 2∆2∆ ∆ -∆-∆ -2∆ -3∆ Uniform Midtread Quantizer 0.5 ∆ 1.5 ∆ 2.5 ∆ Input What will be the mathematical representation for quant/inverse?

Heejune AHN: Image and Video Compressionp. 9

Heejune AHN: Image and Video Compressionp. 10 Uniform Quantizer Performance For Uniform dist. Input, Uniform quantizer is optimal Can you prove this? Uniform Input X ~ U(-A,A) Error signal e = y – x ~ U(-Δ/2, Δ/2)

Heejune AHN: Image and Video Compressionp. 11 Signal Power (variance) MSE SNR Note If one bit added, Δ is halved, noise variance reduces to 1/4, SNR increases by 6 dB. SNR does not depends on input range, MSE does.

Heejune AHN: Image and Video Compressionp. 12 Non-uniform Quantizer Issue Many data are non-uniformly distributed and even unbounded Concept General Intuition: Dense Levels for Dense Input region Boundness: Use saturation Post filter for unbounded input Generally no closed-form expression for MSE. Range and Reconstruction Level is cross-related

Heejune AHN: Image and Video Compressionp. 13 Lloyd-Max Algorithm Algorithm Iteration algorithm with decision level (x i ) and recon. level (y i ) Run until code book does not change any more Step 1: find Near Region R i ((x i-1, x i ]) R i = {x | d(x,y i ) <= d(x,y j ), for all j =\= I } Step 2: find level y i y i = E[X| x in R i ] centroid calculation range update

Heejune AHN: Image and Video Compressionp. 14 where T k is the k th interval [t k,t k+1 ) Lloyd-Max Algorithm Minimize mean squared error.

Heejune AHN: Image and Video Compressionp. 15 Example Quantization and Quality (Lloyd-Max applied) Original (8bpp) vs 6 bpp (spatial domain)

Heejune AHN: Image and Video Compressionp. 16 Original (8bpp) vs 4 bpp (spatial domain)

Heejune AHN: Image and Video Compressionp. 17 Original (8bpp) vs 2 bpp (spatial domain)

Heejune AHN: Image and Video Compressionp. 18 High Density Quantization conditional pdf of in the interval High Quality Condition Observation Slow change (Constant) over the quantization region Approximate with Uniform distribution

Heejune AHN: Image and Video Compressionp. 19 Quantization in Video Coding UTQ (uniform Threshold Quantization) often is used Difficult in adaptive design (a LM quantizer design) Video quantizers are high quality ones Quantization in VC Input signal: quantize the (DCT) coefficients Parameters q (Δ): quantization scale factor ( 2 ~ 62, usu. q = 2QUANT, 1 ~31 ) Index (Level) : index for the reconstruction values Note: index, not reconstruction values are transmitted E.g. Index: I (n,m) = floor(F(n,m)/q) = floor(F(n,m)/2QUANT) –i.e. [i-1, i) *q => i Reconstruction: F’(n.m) = (I(n,m) + ½) x q = (2*I(n,m) +1)xQUANT –i.e. i => (i +1/2) q (i.e, middle of range [i -1, i)*q) Note: with QUANT, no 1/2 in expression.

Heejune AHN: Image and Video Compressionp. 20 Uniform Threshold Quantizer Threshold (dead zone) for reducing dct coeff. Intra DC (zero threshold), Intra AC, inter DC, AC (non-zero) 2*Q(UANT) = q Quantizer input Quantizer output q/2 -q/2 q 2q -q -2q -q -2q -3q 2q 3q q -3q Quantizer input Quantizer output 2Q 3Q -2Q -3Q -Q -3Q -5Q 3Q 5Q q -5Q AC (With Threshold) DC (without Threshold, q = 8 ) dead zone

Heejune AHN: Image and Video Compressionp Quantization in Video Coding Applied on the Transform Coefficients Key Throttle for Bit-Rate and Quality Very Important Trade-off in Video coding Estimation (MC, IntraP) X orig Transform (e.g. DCT) e = X orig - X est Y = T(e) Quantizati on Entrophy Coding Y q = Q(Y)VLC(Y q)

Heejune AHN: Image and Video Compressionp. 22 Example #1 Example #2: Comparison with Coarse and Fine Quant See Textbook Table 7.4 Q(8) Zig-zag scan Transformed 8x8 block

Heejune AHN: Image and Video Compressionp. 23 DCT Coef. Quantization Human visual weight coarse quant to High frequency components NDZ-UTQ to Intra DC, DZ-UTQ to all others Intra block Case I (n,m) = round(F(n,m)/(q*W(n,n))/8 ) F’(n.m) = (I(n,m) + ½) x q x W(n,m)/ intra 16 inter

Heejune AHN: Image and Video Compressionp. 24 Quantizer Example MPEG-4 example Inverse Quantization only Defined if LEVEL = 0, REC = 0 Else If QUANT is ODD |REC| = QUANT *(2 |LEVEL| +1) Else |REC| = QUANT *(2|LEVEL| +1) : Dead-zone (sorry, I cannot explain why odd/even) Quantization is not defined Why? Examples Q= Len = 14 > Len = 14 > 8 Un-biased biased

Heejune AHN: Image and Video Compressionp Vector Quantizater Vector Quantizer Use statistical correlation of N dimension Input

Heejune AHN: Image and Video Compressionp. 26 Vector Quantizer Design Generalized Loyd-Max Algorithm Why Not Vector Quantization in Video Standards Transform Coding utilizes the “Correlation”, the remaining signal does not has Correlation much.

Heejune AHN: Image and Video Compressionp. 27

Heejune AHN: Image and Video Compressionp. 28 Performance of VQ

Heejune AHN: Image and Video Compressionp. 29 Embedded quantizers Motivation: “scalability” – decoding of compressed bitstreams at different rates (with different qualities) Nested quantization intervals In general, only one quantizer can be optimum (exception: uniform quantizers) Q0 Q1 Q2 x

Heejune AHN: Image and Video Compressionp. 30 Rate Distortion Theory Rate vs Distortion Inverse relation between Information/Data Rate and Distortion Revisit to a uniform distributed r.v. with a uniform quantizer Plot it ! Exponential decreasing Proportional to Complexity of source in statistics

Heejune AHN: Image and Video Compressionp. 31 Rate Distortion Theory Rate-distortion Function and Theroy Inverse relation between Information/Data Rate and Distortion Example with Gaussian R.V.

Heejune AHN: Image and Video Compressionp. 32 Rate-Distortion Optimization Motivation Image coding Condition: we can use 10KBytes for a whole picture Each part has different complexity (i.e, simpler and complex, variance) Which parts I have to assign more bits? Analogy to school score Students are evaluated sum of Math and English grade. I gets 90pts in Math, 50pts in Eng. Which subject I have to study? (natural assumption: 90 to 100 is much harder than 50 to 60) simpler blocks More complex blocks

Heejune AHN: Image and Video Compressionp. 33 Lagrange multiplier Constrained Optimization Problem Minimize distortion with bits no larger than max bits Cannot use partial differential for minima and maxima Lagrange Multiplier technique Insert one more imaginary variable (called Lagrange) We have multivariable minimization problem

Heejune AHN: Image and Video Compressionp. 34 Side note: why not partial differential Simple example min subject to Solution By substitution minimum ½ at x = y = 1/sqrt(2) Wrong Solution With complex constraints, we cannot use substitution of variable method We cannot change partial different with ordinary difference If we check, x = y = 0 ? 1 1

Heejune AHN: Image and Video Compressionp. 35 An Example: Lagrange Multiplier Optimization Problem multiple independent Gaussian variables Lagrange multiplier optimization

Heejune AHN: Image and Video Compressionp. 36 Solution Multiplying M equations, and take M-square Lagrange value Bit-allocation Large variance, then more bit allocation But the increment is logarithmic (not linear)

Appendix Lloyd-Max Algorithm Details

Heejune AHN: Image and Video Compressionp. 38 Lloyd-Max scalar quantizer Problem : For a signal x with given PDF find a quantizer with M representative levels such that Solution : Lloyd-Max quantizer [Lloyd,1957] [Max,1960] M-1 decision thresholds exactly half-way between representative levels. M representative levels in the centroid of the PDF between two successive decision thresholds. Necessary (but not sufficient) conditions

Heejune AHN: Image and Video Compressionp. 39 Iterative Lloyd-Max quantizer design  Guess initial set of representative levels  Calculate decision thresholds  Calculate new representative levels  Repeat 2. and 3. until no further distortion reduction

Heejune AHN: Image and Video Compressionp. 40 Example of use of the Lloyd algorithm (I) X zero-mean, unit-variance Gaussian r.v. Design scalar quantizer with 4 quantization indices with minimum expected distortion D* Optimum quantizer, obtained with the Lloyd algorithm Decision thresholds -0.98, 0, 0.98 Representative levels –1.51, -0.45, 0.45, 1.51 D* =0.12=9.30 dB Boundary Reconstruction

Heejune AHN: Image and Video Compressionp. 41 Example of use of the Lloyd algorithm (II) Convergence Initial quantizer A: decision thresholds –3, 0 3 Initial quantizer B: decision thresholds –½, 0, ½ After 6 iterations, in both cases, (D-D*)/D*<1%

Heejune AHN: Image and Video Compressionp. 42 Example of use of the Lloyd algorithm (III) X zero-mean, unit-variance Laplacian r.v. Design scalar quantizer with 4 quantization indices with minimum expected distortion D* Optimum quantizer, obtained with the Lloyd algorithm Decision thresholds -1.13, 0, 1.13 Representative levels -1.83, -0.42, 0.42, 1.83 D* =0.18=7.54 dB Threshold Representative

Heejune AHN: Image and Video Compressionp. 43 Example of use of the Lloyd algorithm (IV) Convergence Initial quantizer A, decision thresholds –3, 0 3 Initial quantizer B, decision thresholds –½, 0, ½ After 6 iterations, in both cases, (D-D*)/D*<1%

Heejune AHN: Image and Video Compressionp. 44 Lloyd algorithm with training data  Guess initial set of representative levels  Assign each sample x i in training set T to closest representative  Calculate new representative levels  Repeat 2. and 3. until no further distortion reduction

Heejune AHN: Image and Video Compressionp. 45 Lloyd-Max quantizer properties Zero-mean quantization error Quantization error and reconstruction decorrelated Variance subtraction property