Scalar and Vector Quantization. National Chiao Tung University Chun-Jen Tsai 11/06/2014

Similar documents
C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung University

Multimedia Communications. Scalar Quantization

Gaussian source Assumptions d = (x-y) 2, given D, find lower bound of I(X;Y)

Quantization 2.1 QUANTIZATION AND THE SOURCE ENCODER

Pulse-Code Modulation (PCM) :

EE-597 Notes Quantization

The Secrets of Quantization. Nimrod Peleg Update: Sept. 2009

Example: for source

Multimedia Systems Giorgio Leonardi A.A Lecture 4 -> 6 : Quantization

at Some sort of quantization is necessary to represent continuous signals in digital form

Review of Quantization. Quantization. Bring in Probability Distribution. L-level Quantization. Uniform partition

CS578- Speech Signal Processing

Vector Quantization and Subband Coding

EE368B Image and Video Compression

Ch. 10 Vector Quantization. Advantages & Design

The information loss in quantization

Vector Quantization Encoder Decoder Original Form image Minimize distortion Table Channel Image Vectors Look-up (X, X i ) X may be a block of l

CODING SAMPLE DIFFERENCES ATTEMPT 1: NAIVE DIFFERENTIAL CODING

Being edited by Prof. Sumana Gupta 1. only symmetric quantizers ie the input and output levels in the 3rd quadrant are negative

Principles of Communications

1. Probability density function for speech samples. Gamma. Laplacian. 2. Coding paradigms. =(2X max /2 B ) for a B-bit quantizer Δ Δ Δ Δ Δ

Module 3 LOSSY IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur

Coding for Discrete Source

Compression methods: the 1 st generation

Vector Quantization. Institut Mines-Telecom. Marco Cagnazzo, MN910 Advanced Compression

Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi

ON SCALABLE CODING OF HIDDEN MARKOV SOURCES. Mehdi Salehifar, Tejaswi Nanjundaswamy, and Kenneth Rose

SCALABLE AUDIO CODING USING WATERMARKING

Multimedia Communications. Differential Coding

Lecture 20: Quantization and Rate-Distortion

EE67I Multimedia Communication Systems

On Optimal Coding of Hidden Markov Sources

A Lossless Image Coder With Context Classification, Adaptive Prediction and Adaptive Entropy Coding

An Effective Method for Initialization of Lloyd Max s Algorithm of Optimal Scalar Quantization for Laplacian Source

E303: Communication Systems

Soft-Output Trellis Waveform Coding

Introduction p. 1 Compression Techniques p. 3 Lossless Compression p. 4 Lossy Compression p. 5 Measures of Performance p. 5 Modeling and Coding p.

Optimization of Variable-length Code for Data. Compression of memoryless Laplacian source

Finite Word Length Effects and Quantisation Noise. Professors A G Constantinides & L R Arnaut

Selective Use Of Multiple Entropy Models In Audio Coding

PCM Reference Chapter 12.1, Communication Systems, Carlson. PCM.1

Digital Signal Processing 2/ Advanced Digital Signal Processing Lecture 3, SNR, non-linear Quantisation Gerald Schuller, TU Ilmenau

CHAPTER 3. Transformed Vector Quantization with Orthogonal Polynomials Introduction Vector quantization

Quantization. Introduction. Roadmap. Optimal Quantizer Uniform Quantizer Non Uniform Quantizer Rate Distorsion Theory. Source coding.

Predictive Coding. Lossy or lossless. Feedforward or feedback. Intraframe or interframe. Fixed or Adaptive

Design of Optimal Quantizers for Distributed Source Coding

Class of waveform coders can be represented in this manner

Objectives of Image Coding

Digital Signal Processing

Lloyd-Max Quantization of Correlated Processes: How to Obtain Gains by Receiver-Sided Time-Variant Codebooks

Performance Analysis and Code Optimization of Low Density Parity-Check Codes on Rayleigh Fading Channels

CMPT 365 Multimedia Systems. Final Review - 1

Audio /Video Signal Processing. Lecture 2, Quantization, SNR Gerald Schuller, TU Ilmenau

4. Quantization and Data Compression. ECE 302 Spring 2012 Purdue University, School of ECE Prof. Ilya Pollak

Predictive Coding. Prediction

Predictive Coding. Prediction Prediction in Images

Joint Optimum Bitwise Decomposition of any. Memoryless Source to be Sent over a BSC. Ecole Nationale Superieure des Telecommunications URA CNRS 820

Analysis of methods for speech signals quantization

Proyecto final de carrera

SIGNAL COMPRESSION. 8. Lossy image compression: Principle of embedding

Module 3. Quantization and Coding. Version 2, ECE IIT, Kharagpur

Analysis of Rate-distortion Functions and Congestion Control in Scalable Internet Video Streaming

CHAPITRE I-5 ETUDE THEORIQUE DE LA ROBUSTESSE DU QUANTIFICATEUR UNIFORME OPTIMUM

Problem Set III Quantization

LATTICE VECTOR QUANTIZATION FOR IMAGE CODING USING EXPANSION OF CODEBOOK

OPTIMUM fixed-rate scalar quantizers, introduced by Max

Overview. Analog capturing device (camera, microphone) PCM encoded or raw signal ( wav, bmp, ) A/D CONVERTER. Compressed bit stream (mp3, jpg, )

Time-domain representations

THE dictionary (Random House) definition of quantization

EXAMPLE OF SCALAR AND VECTOR QUANTIZATION

ECE533 Digital Image Processing. Embedded Zerotree Wavelet Image Codec

Enhanced Stochastic Bit Reshuffling for Fine Granular Scalable Video Coding

HARMONIC VECTOR QUANTIZATION

Fuzzy quantization of Bandlet coefficients for image compression

L11: Pattern recognition principles

Multimedia Networking ECE 599

Source Coding for Compression

Chapter 10 Applications in Communications

Wavelet Scalable Video Codec Part 1: image compression by JPEG2000

MARKOV CHAINS A finite state Markov chain is a sequence of discrete cv s from a finite alphabet where is a pmf on and for

Statistical Analysis and Distortion Modeling of MPEG-4 FGS

Lecture 18: Gaussian Channel

On Compression Encrypted Data part 2. Prof. Ja-Ling Wu The Graduate Institute of Networking and Multimedia National Taiwan University

SPEECH ANALYSIS AND SYNTHESIS

' 3480 University, Montreal, Quebec H3A 2A7. QUANTIZERS FOR SYMMETRIC GAMMA DISTRIBUTIONS. 3. Uniqueness. 1. Introduction. INRS- TtlCeommunicationr

DISTRIBUTED ZERO-DELAY JOINT SOURCE-CHANNEL CODING FOR A BI-VARIATE GAUSSIAN ON A GAUSSIAN MAC

Basic Principles of Video Coding

Fractal Dimension and Vector Quantization

Consider the joint probability, P(x,y), shown as the contours in the figure above. P(x) is given by the integral of P(x,y) over all values of y.

Data Converter Fundamentals

4 An Introduction to Channel Coding and Decoding over BSC

EE 121: Introduction to Digital Communication Systems. 1. Consider the following discrete-time communication system. There are two equallly likely

Optimum Soft Decision Decoding of Linear Block Codes

IMAGE COMPRESSION OF DIGITIZED NDE X-RAY RADIOGRAPHS. Brian K. LoveweIl and John P. Basart

Maximum mutual information vector quantization of log-likelihood ratios for memory efficient HARQ implementations

Lecture 5 Channel Coding over Continuous Channels

Encoder Decoder Design for Feedback Control over the Binary Symmetric Channel

Implementation of Lossless Huffman Coding: Image compression using K-Means algorithm and comparison vs. Random numbers and Message source

Run-length & Entropy Coding. Redundancy Removal. Sampling. Quantization. Perform inverse operations at the receiver EEE

Fast Progressive Wavelet Coding

Transcription:

Scalar and Vector Quantization National Chiao Tung University Chun-Jen Tsai 11/06/014

Basic Concept of Quantization Quantization is the process of representing a large, possibly infinite, set of values with a smaller set Eample: real-to-integer conversion Source: real numbers in the range [ 10.0, 10.0] Quantizer: Q() = + 0.5 [ 10.0, 10.0] { 10, 9,, 1, 0, 1,,, 9, 10} The set of inputs and outputs of a quantizer can be scalars (scalar quantizer) or vectors (vector quantizer) /55

The Quantization Problem Encoder mapping Map a range of values to a codeword Irreversible mapping If source is analog A/D converter Decoder mapping Map the codeword to a (fied) value representing the range Knowledge of the source distribution can help us pick a better value representing each range If output is analog D/A converter Informally, the encoder mapping is called the quantization process, and the decoder mapping is called the inverse quantization process 3/55

Quantization Eamples 3-bit Quantizer Encoder (A/D) Decoder (D/A) Digitizing a sine wave 4/55

Quantization Function A quantizer describes the relation between the encoder input values and the decoder output values Eample of a quantization function: 5/55

Quantization Problem Formulation Input: X random variable f X () probability density function (pdf) Output: {b i } i = 0..M decision boundaries {y i } i = 1..M reconstruction levels Discrete processes are often approimated by continuous distributions Eample: Laplacian model of piel differences If source is unbounded, then the first and the last decision boundaries = ± (they are often called saturation values) 6/55

Quantization Error If the quantization operation is denoted by Q( ), then Q() = y i iff b i 1 < b i. The mean squared quantization error (MSQE) is then σ q = = M i= 1 ( Q( ) ) b b i i 1 ( y ) Quantization error is also called quantization noise or quantizer distortion, e.g., additive noise model: i Quantization noise f f X X d d Quantizer input + Quantizer output 7/55

Quantized Bitrate with FLC If the number of quantizer output is M, then the rate (per symbol) of the quantizer output is R = log M Eample: M = 8 R = 3 Quantizer design problem: Given an input pdf f X () and the number of levels M in the quantizer, find the decision boundaries {b i } and the reconstruction levels {y i } so as to minimize the mean squared quantization error 8/55

Quantized Bitrate with VLC For VLC representation of quantization intervals, the bitrate depends on decision boundary selection Eample: eight-level quantizer: y 1 1110 y 1100 y 3 100 y 4 00 y 5 01 y 6 101 y 7 1101 y 8 1111 R = = M i= 1 M l i i= 1 l P( y ) i b b i i 1 i f X ( ) d 9/55

Optimization of Quantization Rate-optimized quantization Given: Distortion constraint σ q D* Find: { b i }, { y i } binary codes Such that: R is minimized Distortion-optimized quantization Given: Rate constraint R R* Find: { b i }, { y i } binary codes Such that: σ q is minimized 10/55

Uniform Quantizer All intervals are of the same size Boundaries are evenly spaced (step size: ), ecept for outmost intervals Reconstruction Usually the midpoint is selected as the representing value Quantizer types: Midrise quantizer: zero is not an output level Midtread quantizer: zero is an output level 11/55

Midrise vs. Midtread Quantizer Midrise Midtread 1/55

Uniform Quantization of Uniform Source If the source is uniformly distributed in [ X ma, X ma ], the output is quantized by an M-level uniform quantizer, then the quantization step size is and the distortion is = X ma M, σ M / i i 1 1 = q d = ( i 1) i= 1 X ma 1. 13/55

Alternative MSQE Derivation We can also compute the power of quantization error q = Q(), q [ /, /] by: σ q 1 / = q dq = / 1. 14/55

The SNR of Quantization For n-bit uniform quantization of an uniform source of [ X ma, X ma ], the SNR is 6.0n db, where n = log M: 10log 10 σ s σ q = 10log 10 (X 1 ma ) 1 = 10log = 0log 10 10 (X 1 n ma ) 1 X M = 6.0n db. ma = 10log 10 M 15/55

Eample: Quantization of Sena Darkening and contouring effects of quantization 8 bits / piel 1 bits / piel bits / piel 3 bits / piel 16/55

Quantization of Non-uniform Sources Given a non-uniform source, [ 100, 100], P( [ 1, 1]) = 0.95, and we want to design an 8-level (3-bit) quantizer. A naïve approach uses uniform quantizer ( = 5): 95% of sample values represented by only two numbers: 1.5 and 1.5, with a maimal quantization error of 1.5 and minimal error of 11.5 If we use = 0.3 (two end-intervals would be huge) Ma error is now 98.95 (i.e. 100 1.05), however, 95% of the time the error is less than 0.15 17/55

18/55 Optimal that minimizes MSQE Given pdf f X () of the source, let s design an M-level mid-rise uniform quantizer that minimizes MSQE:. ) ( 1 ) ( 1 1 1 1 1) ( = + = M X i i i X q d f M d f i M σ Granular error Overload error Q() Overload error Granular error

19/55 Solving for Optimum Step Sizes Given an f X () and M, we can solve for numerically: Optimal uniform quantizer for different sources: 0. ) ( 1 1) ( ) ( 1 1) ( 1 1 1 1) ( = = = M X i i i X q d f M M d f i i d d M σ

Overload/Granular Regions Selection of the step size must trade off between overload noise and granular noise 0/55

Variance Mismatch Effects (1/) Effect of variance mismatch on the performance of a 4 bit uniform quantizer 1/55

Variance Mismatch Effects (/) The MSQE as a function of variance mismatch with a 4 bit uniform quantizer /55

Distribution Mismatch Effects Given 3-bit quantizer, the effect of distribution mismatch for different sources (SNR errors in db): Form left-to-right, we assume that the sources are uniform, Gaussian, Laplacian, and Gamma, and compute the optimum MSQE step size for uniform quantizer The resulting gets larger from left-to-right if there is a mismatch, larger than optimum gives better performance 3-bit quantizer is too coarse 3/55

Adaptive Quantization We can adapt the quantizer to the statistics of the input (mean, variance, pdf) Forward adaptive (encoder-side analysis) Divide input source in blocks Analyze block statistics Set quantization scheme Send the scheme to the decoder via side channel Backward adaptive (decoder-side analysis) Adaptation based on quantizer output only Adjust accordingly (encoder-decoder in sync) No side channel necessary 4/55

Forward Adaptive Quantization (FAQ) Choosing analysis block size is a major issue Block size too large Not enough resolution Increased latency Block size too small More side channel information Assuming a mean of zero, signal variance is estimated by N 1 1 ˆ σ = q n + i. N i= 0 5/55

Speech Quantization Eample (1/) 16-bit speech samples 3-bit fied quantization 6/55

Speech Quantization Eample (/) 16-bit speech samples 3-bit FAQ Block = 18 samples 8-bit variance quantization 7/55

FAQ Refinement So far, we assumed uniform pdf over maimal ranges, we can refine it by computing the range of distribution adaptively for each block Eample: Sena image, 8 8 blocks, 8-bit for range per block, 3-bit quantizer Original 8 bits/piel Quantized 3.5 bits/piel 8/55

Backward Adaptive Quantization (BAQ) Key idea: only encoder sees input source, if we do not want to use side channel to tell the decoder how to adapt the quantizer, we can only use quantized output to adapt the quantizer Possible solution: Observe the number of output values that falls in outer levels and inner levels If they match the assumed pdf, is good If too many values fall in outer levels, should be enlarged, otherwise, should be reduced Issue: estimation of pdf requires large observations? 9/55

Jayant Quantizer N. S. Jayant showed in 1973 that adjustment based on few observations still works fine: If current input falls in the outer levels, epand step size If current input falls in the inner levels, contract step size The total product of epansions and contraction should be 1 Each decision interval k has a multiplier M k If input s n 1 falls in the k th interval, step size is multiplied by M k Inner-level M k < 1, outer-level M k > 1 Step size adaptation rule: = n M l ( n 1) n where l(n 1) is the quantization interval at time n 1. 1, 30/55

Output Levels of 3-bit Jayant Quantizer The multipliers are symmetric: M 0 = M 4, M 1 = M 5, M = M 6, M 3 = M 7 31/55

Eample: Jayant Quantizer M 0 = M 4 = 0.8, M 1 = M 5 = 0.9 M = M 6 = 1.0, M 3 = M 7 = 1., 0 = 0.5 Input: 0.1, 0., 0., 0.1, 0.3, 0.1, 0., 0.5, 0.9, 1.5 3/55

Picking Jayant Multipliers We must select min and ma to prevent underflow and overflow of step sizes Selection of multipliers Total production of epansion/contractions should be 1 Π k = 0 = 1. Scaled to probability of events in each interval, we have Pick γ > 1, and let M k = γ l k, we have M M n k k n N M P k Π = 1, where =, = M M k k Pk N k =0 k =0 M k = 0 l k P k = 0, γ and l k are chosen, P k is known. n k. 33/55

Eample: Ringing Problem Use a -bit Jayant quantizer to quantize a square wave P 0 = 0.8, P 1 = 0. pick l 0 = 1, l 1 = 4, γ ~ 1. 34/55

Jayant Quantizer Performance To avoid overload errors, we should epand rapidly and contracts moderately Robustness over changing input statistics Jayant is about 1dB lower than fied quantizer 35/55

Non-uniform Quantization For uniform quantizer, decision boundaries are determined by a single parameter. We can certainly reduce quantization errors further if each decision boundaries can be selected freely 36/55

pdf-optimized Quantization Given f X (), we can try to minimize MSQE: σ q = M i= 1 b b i i 1 ( y ) f ( ) d. i X Set derivative of σ q w.r.t. y j to zero and solve for y j, we have: b j f X ( ) d b j 1 y y j =. j is the center of mass of b j f X in [b j 1, b j ) f ( ) d b j 1 X If y j are determined, the b j s can be selected as: j ( y y )/. b + = j+ 1 j 37/55

Lloyd-Ma Algorithm (1/3) Lloyd-Ma algorithm solves y j and b j iteratively until an acceptable solution is found Eample: For midrise quantizer, b 0 = 0, b M/ is the largest input, we only have to find { b 1, b,, b M/ 1 } and { y 1, y,, y M/ 1 }. 38/55

Lloyd-Ma Algorithm (/3) Begin with j = 1, we want to find b 1 and y 1 by y = b1 b 1 f ( ) X d b b 0 ( ) d. Pick a value for y 1 (e.g. y 1 = 1), solve for b 1 and compute y by y = b 1 + y 1, and b by y = b b f ( ) X d b b 1 0 1 Continue the process until all {b j } and {y j } are found 1 f X f X ( ) d. 39/55

Lloyd-Ma Algorithm (3/3) If the initial guess of y 1 does not fulfills the termination condition: y M ˆ / y M / ε, where yˆ = + M / bm / 1 ym / 1, y b M / b / = ( ) M f X d b b M / 1 ( ) d. we must pick a different y 1 and repeat the process. M / M / 1 f X 40/55

Eample: pdf-optimized Quantizers We can achieve gain over the uniform quantizer (9.4) (7.05) (1.18) (9.56) (14.7) (11.39) 41/55

Mismatch Effects Non-uniform quantizers also suffer mismatch effects. To reduce the effect, one can use an adaptive nonuniform quantizer, or an adaptive uniform quantizer plus companded quantization techniques Variance mismatch on a 4-bit Laplacian non-uniform quantizer. 4/55

Companded Quantization (CQ) In companded quantization, we adjust (i.e. re-scale) the intervals so that the size of each interval is in proportion to the probability of inputs in each interval equivalent to a non-uniform quantizer 43/55

44/55 Eample: CQ (1/) The compressor function: The uniform quantizer: step size = 1.0. 1 1 1 1 if ) ( 3 4 3 3 4 3 < > + = c

45/55 Eample: CQ (/) The epander function: The equivalent non-uniform quantizer. if ) ( 3 3 1 < + > = c

Remarks on CQ If the level of quantizer is large and the input is bounded by ma, it is possible to choose a c() such that the SNR of CQ is independent to the input pdf: SNR = 10 log 10 (3M ) 0log 10 α, where c () = ma / (α ) and a is a constant. Two popular CQ for telephones: µ-law and A-law µ-law compressor A-law compressor c( ) = ma A 1+ ln A ln(1 + µ ) ma c( ) = ma sgn( ). ln(1 + µ ) 1+ ln sgn( ), A ma 1+ ln A sgn( ), 0 1 A ma ma 1 A. 1 46/55

Entropy Coding of Quantizer Outputs The levels of the quantizer is the alphabet of entropy coders, for M-level quantizer, FLC needs log M bits per output Eample of VLC coded output of minimum MSQE quantizers: Note: non-uniform quantizer has higher entropies since high probability regions uses smaller step sizes 47/55

Vector Quantization Vector quantization groups source data into vectors A vector quantizer maintains a set of vectors called the codebook. Each vector in the codebook is assigned an inde. 48/55

Why Vector Quantization (1/)? Correlated multi-dimensional data have limited valid ranges useless useless 49/55

Why Vector Quantization (/)? Looking at the data from a higher dimension allow us to better fit the quantizer structure to the joint pdf Eample: quantize the Laplacian source data two at a time: 11.44 db 11.73 db 50/55

Vector Quantization Rule Vector quantization (VQ) of X may be viewed as the classification of X into a discrete number of sets Each set is represented by a vector output Y j Given a distance measure d(, y), we have VQ output: Q(X) = Y j iff d(x, Y j ) < d(x, Y i ), i j. Quantization region: V j = { X: d(x, Y j ) < d(x, Y i ), i j}. V j Y j 1 51/55

Codebook Design The set of quantizer output points in VQ is called the codebook of the quantizer, and the process of placing these output points is often referred to as the codebook design The k-means algorithm is often used to classify the outputs Given a large set of output vectors from the source, known as the training set, and an initial set of k representative patterns Assign each element of the training set to the closest representative pattern After an element is assigned, the representative pattern is updated by computing the centroid of the training set vectors assigned to it When the assignment process is complete, we will have k groups of vectors clustered around each of the output points The idea is the same as the scalar quantization problem in Stuart P. Lloyd, Least Squares Quantization in PCM, IEEE Trans. on Information Theory, Vol. 8, No., March 198. 5/55

The Linde-Buzo-Gray Algorithm 1. Start with an initial set of reconstruction values {Y i (0) } i=1..m and a set of training vectors {X n } n=1..n. Set k = 0, D (0) = 0. Select threshold ε.. The quantization regions {V i (k) } i=1..m are given by V j (k) = {X n : d(x n, Y i ) < d(x n, Y j ), j i}, i = 1,,, M. 3. Compute the average distortion D (k) between the training vectors and the representative value 4. If (D (k) D (k 1) )/D (k) < ε, stop; otherwise, continue 5. Let k = k + 1. Update {Y i (k) } i=1..m with the average value of each quantization region V i (k 1). Go to step. 53/55

Eample: Codebook Design Initial state Final state 54/55

Impact of Training Set The training sets used to construct the codebook have significant impact on the performance of VQ Images quantized at 0.5 bits/piel, codebook size 56 55/55