Professional Documents
Culture Documents
Quantization, Non Linear Quantization PDF
Quantization, Non Linear Quantization PDF
In general, the apparent frequency of a sinusoid is the lowest frequency of a sinusoid that
has exactly the same samples as the input sinusoid. Figure 6.5 shows the relationship of the
apparent frequency to the input (true) frequency.
V~ I V· I
SNR -IOI
- sIgna -201
ogIO ~2~~ - SIgna
agIO ~~- (6.2)
~Joise V/Joise
The power in a signal is proportional to the square of the voltage. For example, if the signal
voltage Vsigllal is 10 times the noise, the SNR is 20 x logIO(lO) = 20 dB.
In terms of power, if the squeaking we hear from ten violins playing is ten times the
squeaking we hear from one violin playing, then lher-atio of power is given in terms of
decibels as 10 dB, or, in other words, 1 Bel. Notice that decibels are always defined in
teans of a ratio. The term "decibels" as applied to sounds in our environment usually is
in comparison to a just-audible sound with frequency 1 kHz. The levels of sound we hear
around us are described in teans of decibels, as a ratio to the quietest sound we are capable
of hearing. Table 6.1 shows approxi~ate levels for these sounds.
Threshold of hearing 0
Rustle of leaves 10
Very quiet room 20
Average room 40
Conversation 60
Busy street 70
Loud radio 80
Train through station 90
Riveter 100
Threshold of discomfort 120
Threshold of pain 140
Damage to eardnnn 160
Aside from any noise that may have been present in the original analog signal, additional
error results from quantization. That is, if voltages are in the range of 0 to I but we have
only 8 bits in which to store values, we effectively force all continuous values of voltage
into only 256 different values. Inevitably, this introduces a roundoff error. Although it is
not really "noise," it is called quantization noise (or quantization error). The association
with the concept of noise is that such errors will essentially occur randomly from sample to
sample.
The quality of the quantization is characterized by the signal-to-quantization-noise ratio
(SQNR). Quantization noise is defined as the difference between the value of the analog
signal, for the particular sampling time, and the nearest quantization interval value. At
most, this error can be as much as half of the interval.
For a quantization accuracy of N bits per sample, the range of the digital signal is ~2N-l
to 2 N - 1 - 1. Thus, if the actual analog signal is in the range from - v,Jlax to +V,llGX, each
quantization level represents a voltage of 2 Vmax /2 N , or VlIlax /2 N -1. SQNR can be simply
expressed in terms of the peak signal, which is mapped to the level Vsignal of about 2 N - 1 ,
and the SQNR has as denominator the maximum VquaJlJlOise of 1/2. The ratio of the two is
a simple definition of the SQNR;1
V 2N~1
SQNR 20 1agiO signal
=
20 IagIO -1-
VqClaJlJloise 2:
20 x N x log2 = 6.02N(dB) (6.3)
In other words, each bit adds about 6 dB ofresolution, so 16 bits provide a maximum SQNR
of96 dB.
1This ratio is actually the peak signal~to-quantization-noise ratio, or PSQNR.
We have examined the worst case. If, on the other hand, we assume that the input signal
is sinusoidal, that quantization error is statistically independent, and that its magnitude is
unifOlmly distributed between 0 and half the interval, we can show ([2], p. 37) that the
expression for the SQNR becomes
Since larger is better, this shows that a more realistic approximation gives a better charac-
terization number for the quality of a system.
Typical digital audio sample precision is either 8 bits per sample, equivalent to about
telephone quality, or 16 bits, for CD quality. In fact, 12 bits or so would likely do fine for
adequate sound reproduction.
This means that, for example, if we can feel an increase in weight from 10 to 11 pounds,
then if instead we start at 20 pounds, it would take 22 pounds for us to feel an increase in
weight.
Inserting a constant of proportionality k, we have a differential equation that states
dr = kO/s) ds (6.6)
r==klns+C (6.7)
r == kInes/so) (6.8)
where So is the lowest level of stimulus that causes a response (1' = 0 when s = so).
Thus, nonuniform quantization schemes that take advantage of this perceptual charac-
teristic make use of logarithms. The idea is that in a log plot derived from Equation (6.8), if
we simply take uniform steps along the s axis, we are not mirroring the nonlinear response
along the l' axis.
Instead, we would like to take uniform steps along the r axis. Thus, nonlinear quantization
works by first transfonning an analog signal from the raw s space into the theoretical r space,
then uniformly quantizing the resulting values. The result is that for steps near the low end
of the signal, quantization steps are effectively more concentrated on the s axis, whereas for
large values of s, one quantization step in r encompasses a wide range of s values.
Such a law for audio is called fL-Iaw encoding, or II-law, since it's easier to write. A very
similar rule, called A -law, is used in telephony in Europe.
The equations for these similar encodings are as follows:
fL-Iaw:
r= sgn(s) In { 1+fL-
In(1+ p.,)
Is
sp
11 , I:J ~ 1
(6.9)
A-law:
sgn(s) [1
HluA
+ InA \..£..\J
Sp ,
Sp -
-1<1..£..\<1
A - Sp -
A
(6.10)
Figure 6.6 depicts these curves. The parameter of the fL-law encoder is usually set to
fL = 100 or fL = 255, while the parameter for the A-law encoder is usually set to A = 87.6.
Here, s p is the peak signal vallie and s is the current signal value. So far, this simply
means that we wish to deal with s / sp, in the range -1 to 1.
The idea of using this type oflaw is that if s/ s p is first transformed to values r as above and
then r is quantized uniformly before transmitting or storing the signal, most of the available
bits will be used to store information where changes in the signal are most apparent to a
human listener, because of our perceptual nonuniforrnity.
To see this, consider a small change in Is / sp I near the value 1.0, where the curve in
Figure 6.6 is flattest. Clearly, the change in s has to be much larger in the flat area than
near the origin to be registered by a change in the quantized r value. And it is at the quiet,
low end of our hearing that we can best discern small changes in s. The p.,-law transfonn
concentrates the available information at that end.
First we carry out the f-t-law transformation, then we quantize the resulting value, which is
. a nonlinear trarsform away from the input. The logarithmic steps represent low-amplitude,
quiet signals wilh more accuracy than loud, high-amplitude ones. What this means for
signals that are then encoded as a fixed number of bits is that for low-amplitude, quiet
signals, the amount of noise ~ the error in representing the signal - is a smaller number
than for high-amplitude signals. Therefore, the It-law transform effectively makes the
signal-to-noise ratio more uniform across the range of input signals.
/.L-law or A-law
1.--.---,------r---.---,------.-~-____,,_-_._:===_"
0.8
0.6
-0.4
-0.6
-0.8
-1 '---'='=--'------_----'------_----'----_----'-_----'----_-----'--_-----1_ _'-_-'----------'
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8
slsp