In mathematics and digital signal processing, quantization is the process of mapping input values from a large set (often a continuous set) to output values in a (countable) 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 (such as round-off error) 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 x {\displaystyle x} to the nearest integer value forms a very basic type of quantizer – a uniform one. A typical (mid-tread) uniform quantizer with a quantization step size equal to some value Δ {\displaystyle \Delta } can be expressed as
Q ( x ) = Δ ⋅ ⌊ x Δ + 1 2 ⌋ {\displaystyle Q(x)=\Delta \cdot \left\lfloor {\frac {x}{\Delta }}+{\frac {1}{2}}\right\rfloor } , where the notation ⌊ ⌋ {\displaystyle \lfloor \ \rfloor } denotes the floor function. Alternatively, the same quantizer may be expressed in terms of the ceiling function, as
Q ( x ) = Δ ⋅ ⌈ x Δ − 1 2 ⌉ {\displaystyle Q(x)=\Delta \cdot \left\lceil {\frac {x}{\Delta }}-{\frac {1}{2}}\right\rceil } . (The notation ⌈ ⌉ {\displaystyle \lceil \ \rceil } denotes the ceiling function). 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 Δ {\displaystyle \Delta } is equal to 1. With Δ = 1 {\displaystyle \Delta =1} or with Δ {\displaystyle \Delta } 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 Δ 2 / 12 {\displaystyle \Delta ^{2}/12} . 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 1/4. In terms of decibels, the noise power change is 10 ⋅ log 10 ( 1 / 4 ) ≈ − 6 d B . {\displaystyle \scriptstyle 10\cdot \log _{10}(1/4)\ \approx \ -6\ \mathrm {dB} .}
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 (or forward quantization stage) and the reconstruction stage (or inverse quantization stage), where the classification stage maps the input value to an integer quantization index k {\displaystyle k} and the reconstruction stage maps the index k {\displaystyle k} to the reconstruction value y k {\displaystyle y_{k}} that is the output approximation of the input value. For the example uniform quantizer described above, the forward quantization stage can be expressed as
k = ⌊ x Δ + 1 2 ⌋ {\displaystyle k=\left\lfloor {\frac {x}{\Delta }}+{\frac {1}{2}}\right\rfloor } , and the reconstruction stage for this example quantizer is simply
… excerpt ends here. Continue reading the full article.


![Quantization (signal processing): 2-bit resolution with four levels of quantization compared to analog[8]](https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/2-bit_resolution_analog_comparison.png/500px-2-bit_resolution_analog_comparison.png?utm_source=en.wikipedia.org&utm_campaign=parser&utm_content=thumbnail)


