Quantization (signal processing): Difference between revisions

Content deleted Content added
m removed no source/no copyright status image as per new CSD criteria
Cat5nap (talk | contribs)
Mathematical description: Adding mid-rise/mid-tread discussion (note that this is necessary to make the SNR formula correct).
Line 20:
The integer value <math>i</math> is the representation that is typically stored or transmitted, and then the final interpretation is constructed using <math>g(i)</math> when the data is later interpreted. The integer value <math>i</math> is sometimes referred to as the ''quantization index''.
 
In computer audio and most other applications, a method known as ''uniform quantization'' is the most common. IfThere <math>x</math>are istwo acommon real-valuedvariations number between -1 and 1, aof uniform quantization, operatorcalled that''mid-rise'' usesand ''Mmid-tread'' bits of precision to represent each quantization index can be expresseduniform asquantizers.
 
If <math>x</math> is a real-valued number between -1 and 1, a mid-rise uniform quantization operator that uses ''M'' bits of precision to represent each quantization index can be expressed as
:<math>Q(x) = \frac{\left\lfloor 2^{M-1}x \right\rfloor}{2^{M-1}}</math>.
 
:<math>Q(x) = \frac{\left\lfloor 2^{M-1}x \right\rfloor+0.5}{2^{M-1}}</math>.
In this case the <math>f(x)</math> and <math>g(i)</math> operators are just multiplying scale factors (one multiplier being the inverse of the other). The value <math>2^{-(M-1)}</math> is often referred to as the ''quantization step size''. Using this quantization law and assuming that quantization noise is approximately [[uniform distribution (continuous)|uniformly distributed]] over the quantization step size (an assumption typically accurate for rapidly varying <math>x</math> or high <math>M</math>) and assuming that the input signal <math>x</math> to be quantized is approximately uniformly distributed over the entire interval from -1 to 1, the [[signal to noise ratio]] (SNR) of the quantization can be computed as
 
In this case the <math>f(x)</math> and <math>g(i)</math> operators are just multiplying scale factors (one multiplier being the inverse of the other) along with an offset in ''g''(''i'') function to place the representation value in the middle of the input region for each quantization index. The value <math>2^{-(M-1)}</math> is often referred to as the ''quantization step size''. Using this quantization law and assuming that quantization noise is approximately [[uniform distribution (continuous)|uniformly distributed]] over the quantization step size (an assumption typically accurate for rapidly varying <math>x</math> or high <math>M</math>) and further assuming that the input signal <math>x</math> to be quantized is approximately uniformly distributed over the entire interval from -1 to 1, the [[signal to noise ratio]] (SNR) of the quantization can be computed as
 
:<math>
Line 32 ⟶ 34:
 
From this equation, it is often said that the SNR is approximately 6 [[decibel|dB]] per [[bit]].
 
For mid-tread uniform quantization, the offset of 0.5 would be added within the floor function instead of outside of it.
 
Sometimes, mid-rise quantization is used without adding the offset of 0.5. This reduces the signal to noise ratio by approximately 6.02 dB, but may be acceptable for the sake of simplicity when the step size is small.
 
In digital [[telephone|telephony]], two popular quantization schemes are the '[[A-law algorithm|A-law]]' (dominant in [[Europe]]) and '[[Mu-law algorithm|&mu;-law]]' (dominant in [[North America]] and [[Japan]]). These schemes map discrete analog values to an 8-bit scale that is nearly linear for small values and then increases logarithmically as amplitude grows. Because the human ear's perception of [[loudness]] is roughly logarithmic, this provides a higher signal to noise ratio over the range of audible sound intensities for a given number of bits.