Quantization (signal processing)
In mathematics and digital signal processing, quantization is the process of mapping input values from a large set to output values in a smaller set, often with a finite number of elements. Rounding and truncation are typical examples of quantization processes. Quantization is involved to some degree in nearly all digital signal processing, as the process of representing a signal in digital form ordinarily involves rounding. Quantization also forms the core of essentially all lossy compression algorithms.
The difference between an input value and its quantized value is referred to as quantization error, noise or distortion. A device or algorithmic function that performs quantization is called a quantizer. An analog-to-digital converter is an example of a quantizer.
Example
For example, rounding a real number to the nearest integer value forms a very basic type of quantizer – a uniform one. A typical uniform quantizer with a quantization step size equal to some value can be expressed aswhere the notation denotes the floor function.
Alternatively, the same quantizer may be expressed in terms of the ceiling function, as
.
The essential property of a quantizer is having a countable set of possible output values smaller than the set of possible input values. The members of the set of output values may have integer, rational, or real values. For simple rounding to the nearest integer, the step size is equal to 1. With or with equal to any other integer value, this quantizer has real-valued inputs and integer-valued outputs.
When the quantization step size is small relative to the variation in the signal being quantized, it is relatively simple to show that the mean squared error produced by such a rounding operation will be approximately. Mean squared error is also called the quantization noise power. Adding one bit to the quantizer halves the value of Δ, which reduces the noise power by the factor. In terms of decibels, the noise power change is
Because the set of possible output values of a quantizer is countable, any quantizer can be decomposed into two distinct stages, which can be referred to as the classification stage and the reconstruction stage, where the classification stage maps the input value to an integer quantization index and the reconstruction stage maps the index to the reconstruction value that is the output approximation of the input value. For the example uniform quantizer described above, the forward quantization stage can be expressed as
and the reconstruction stage for this example quantizer is simply
This decomposition is useful for the design and analysis of quantization behavior, and it illustrates how the quantized data can be communicated over a communication channel – a source encoder can perform the forward quantization stage and send the index information through a communication channel, and a decoder can perform the reconstruction stage to produce the output approximation of the original input data. In general, the forward quantization stage may use any function that maps the input data to the integer space of the quantization index data, and the inverse quantization stage can conceptually be a table look-up operation to map each quantization index to a corresponding reconstruction value. This two-stage decomposition applies equally well to vector as well as scalar quantizers.
Mathematical properties
Because quantization is a many-to-few mapping, it is an inherently non-linear and irreversible process.The set of possible input values may be infinitely large, and may possibly be continuous and therefore uncountable. The set of possible output values may be finite or countably infinite. The input and output sets involved in quantization can be defined in a rather general way. For example, vector quantization is the application of quantization to multi-dimensional input data.
Types
Analog-to-digital converter
An analog-to-digital converter can be modeled as two processes: sampling and quantization. Sampling converts a time-varying voltage signal into a discrete-time signal, a sequence of real numbers. Quantization replaces each real number with an approximation from a finite set of discrete values. Most commonly, these discrete values are represented as fixed-point words. Though any number of quantization levels is possible, common word lengths are 8-bit, 16-bit and 24-bit. Quantizing a sequence of numbers produces a sequence of quantization errors, which is sometimes modeled as an additive random signal called quantization noise because of its stochastic behavior. The more levels a quantizer uses, the lower is its quantization noise power.Rate–distortion optimization
Rate–distortion optimized quantization is encountered in source coding for lossy data compression algorithms, where the purpose is to manage distortion within the limits of the bit rate supported by a communication channel or storage medium. The analysis of quantization in this context involves studying the amount of data that is used to represent the output of the quantizer and studying the loss of precision that is introduced by the quantization process.Mid-riser and mid-tread uniform quantizers
Most uniform quantizers for signed input data can be classified as being of one of two types: mid-riser and mid-tread. The terminology is based on what happens in the region around the value 0, and uses the analogy of viewing the input-output function of the quantizer as a stairway. Mid-tread quantizers have a zero-valued reconstruction level, while mid-riser quantizers have a zero-valued classification threshold.Mid-tread quantization involves rounding. The formulas for mid-tread uniform quantization are provided in the previous section.
Mid-riser quantization involves truncation. The input-output formula for a mid-riser uniform quantizer is given by:
where the classification rule is given by
and the reconstruction rule is
Note that mid-riser uniform quantizers do not have a zero output value – their minimum output magnitude is half the step size. In contrast, mid-tread quantizers do have a zero output level. For some applications, having a zero output signal representation may be a necessity.
In general, a mid-riser or mid-tread quantizer may not actually be a uniform quantizer – i.e., the size of the quantizer's classification intervals may not all be the same, or the spacing between its possible output values may not all be the same. The distinguishing characteristic of a mid-riser quantizer is that it has a classification threshold value that is exactly zero, and the distinguishing characteristic of a mid-tread quantizer is that is it has a reconstruction value that is exactly zero.
Dead-zone quantizers
A dead-zone quantizer is a type of mid-tread quantizer with symmetric behavior around 0. The region around the zero output value of such a quantizer is referred to as the dead zone or deadband. The dead zone can sometimes serve the same purpose as a noise gate or squelch function. Especially for compression applications, the dead-zone may be given a different width than that for the other steps. For an otherwise-uniform quantizer, the dead-zone width can be set to any value by using the forward quantization rulewhere the function is the sign function. The general reconstruction rule for such a dead-zone quantizer is given by
where is a reconstruction offset value in the range of 0 to 1 as a fraction of the step size. Ordinarily, when quantizing input data with a typical probability density function that is symmetric around zero and reaches its peak value at zero. Although may depend on in general and can be chosen to fulfill the optimality condition described below, it is often simply set to a constant, such as.
A very commonly used special case is to set and for all. In this case, the dead-zone quantizer is also a uniform quantizer, since the central dead-zone of this quantizer has the same width as all of its other steps, and all of its reconstruction values are equally spaced as well.
Noise and error characteristics
Additive noise model
A common assumption for the analysis of quantization error is that it affects a signal processing system in a similar manner to that of additive white noise – having negligible correlation with the signal and an approximately flat power spectral density. The additive noise model is commonly used for the analysis of quantization error effects in digital filtering systems, and it can be very useful in such analysis. It has been shown to be a valid model in cases of high-resolution quantization with smooth PDFs.Additive noise behavior is not always a valid assumption. Quantization error is deterministically related to the signal and not entirely independent of it. Thus, periodic signals can create periodic quantization noise. And in some cases, it can even cause limit cycles to appear in digital signal processing systems. One way to ensure effective independence of the quantization error from the source signal is to perform dithered quantization, which involves adding random noise to the signal prior to quantization.
Quantization error models
In the typical case, the original signal is much larger than one least significant bit. When this is the case, the quantization error is not significantly correlated with the signal and has an approximately uniform distribution. When rounding is used to quantize, the quantization error has a mean of zero and the root mean square value is the standard deviation of this distribution, given by. When truncation is used, the error has a non-zero mean of and the RMS value is. Although rounding yields less RMS error than truncation, the difference is only due to the static term ofAt lower amplitudes, the quantization error becomes dependent on the input signal, resulting in distortion. This distortion is created after the anti-aliasing filter, and if these distortions are above 1/2 the sample rate, they will alias back into the band of interest. In order to make the quantization error independent of the input signal, the signal is dithered by adding noise to the signal. This slightly reduces signal-to-noise ratio, but can completely eliminate the distortion.