Scalar Quantization – Mathematical Model Multimedia Compression דחיסת מולטימדיה January 27, 2009 Lecture 9A: Scalar Quantization – Mathematical Model
Definition of Quantization Quantization: a process of representing a large – possible infinite – set of values with a much smaller set. Scalar quantization: a mapping of an input value x into a finite number of output values, y: Q:x ® y One of the most simplest and most general idea in lossy compression.
Definition of Quantization (Cont.) Many of the fundamental ideas of quantization and compression are most easily introduced in the simple context of scalar quantization. Any real number x can be rounded off to the nearest integer, say q(x) = round(x) Maps the real line R (a continuous space) into a discrete space.
An example of uniform quantization
Input vs. Output
Quantization
Example of a Quantized Waveform
Noise Quantization resulting quantization error (‘noise’) so that
Quantizer definition The design of the quantizer has a significant impact on the amount of compression obtained and loss incurred in a lossy compression scheme. Quantizer: encoder mapping and decode mapping. Encoder mapping – The encoder divides the range of source into a number of intervals – Each interval is represented by a distinct codeword Decoder mapping – For each received codeword, the decoder generates a reconstruct value
Quantization operation – Let M be the number of reconstruction levels where the decision boundaries are and the reconstruction levels are
Quantization Problem MSQE (mean squared quantization error) If the quantization operation is Q Suppose the input is modeled by a random variable X with pdf fX(x). The MSQE is
Quantization Problem Rate of the quantizer The average number of bits required to represent a single quantizer output –For fixed-length coding, the rate R is: For variable-length coding, the rate will depend on the probability of occurrence of the outputs
Quantization Problem Quantizer design problem Fixed -length coding Variable-length coding If li is the length of the codeword corresponding to the output yi, and the probability of occurrence of yi is: The rate is given by:
Uniform Quantization
Quantization Levels
Quantizer: Midtreader vs. Midrizer
Quantizer: Uniform vs. Nonuniform
Uniform Quantizer Zero is one of the output levels M is odd Zero is not one of the output levels M is even
Uniform Quantization of A Uniformly Distributed Source
Uniform Quantization of A Uniformly Distributed Source
Uniform Quantization of A Non-uniformly Distributed Source
Image Compression Original 8bits/pixel 3bits/pixel
Image Compression 2bits/pixel 1bit/pixel
Lloyd-Max Quantization Problem : For a signal u with given pdf pu(u) find a quantizer with N representative levels such that Solution : Lloid-Max quantizer (Lloid, 1967; Max, 1960) N-1 decision thresholds exactly half way between representative levels N representative levels in the centroid of the pdf between two successive decision thresholds
Lloid-Max Quantizer vs. Best Uniform Quantizer
Optimal Quantization squares error (MMSE) sense The optimal reconstruction levels, {rj }, in minimum mean squares error (MMSE) sense
Optimal Quantization (Cont.) If J is large p(f) p(rj) for optimal If p(f) is uniformly distributed:
Optimal Quantization (Cont.) In general To minimize D, with d0 = -, dL = Max-Lloid Quantizer:
Optimal Quantization (Cont.) The integration can be replaced by summation if f is discrete valued In practice, various distributions ( e.g., uniform, Gaussian, or Laplacian) are used to model the source p(f). If p(f) is unknown, histogram can be used to obtain p(f), after normalization
Uniform and Optimal Quantization Uniform Quantization The error Eq is unifirmly distributed with zero mean and variance - Let the range of f be A. Its variance is - The signal-to-noise ratio for a uniform quantizer is 2