Professional Documents
Culture Documents
Ligjerata 3 + 4
Ligjerata 3 + 4
Outline
Review the three process of A to D conversion Quantization
Uniform Non-uniform
Mu-law
Binary encoding
Bit rate of digital signals
EE3414:Quantization
Sampling
Quantization
Binary Encoding
xc(t)
Sampling Period
T
x[n] = xc(nT)
Quantization Interval Q
x[n]
Binary codebook
c[n]
Binary Encoding
Convert each quantized value into a binary codeword
EE3414:Quantization
-0.5
A2D_plot.m
-1 0 0.2 0.4 0.6 0.8 1
EE3414:Quantization
Q depends on the dynamic range of the signal amplitude and perceptual sensitivity
Q and the signal range D determine bits/sample R
2R=D/Q For speech: R = 8 bits; For music: R =16 bits;
EE3414:Quantization
Uniform Quantization
Applicable when the signal is in a finite range (fmin, fmax) The entire data range is divided into L equal intervals of length Q (known as quantization interval or
quantization step-size)
Q=(fmax-fmin)/L Interval i is mapped to the middle value of this interval We store/send only the index of quantized value
f f min Index of quantized value = Qi ( f ) = Q Quantized value = Q ( f ) = Qi ( f )Q + Q / 2 + f min
EE3414:Quantization 6
EE3414:Quantization
EE3414:Quantization
Example
For the following sequence {1.2,-0.2,-0.5,0.4,0.89,1.3}, Quantize it using a uniform quantizer in the range of (-1.5,1.5) with 4 levels, and write the quantized sequence. Solution: Q=3/4=0.75. Quantizer is illustrated below.
-1.125 -0.375 0.375 1.125
-1.5
-0.75
0.75
1.5
Yellow dots indicate the partition levels (boundaries between separate quantization intervals) Red dots indicate the reconstruction levels (middle of each interval) 1.2 fall between 0.75 and 1.5, and hence is quantized to 1.125
Quantized sequence:
{1.125,-0.375,-0.375,0.375,1.125,1.125}
EE3414:Quantization
Q=0.5
0.4
EE3414:Quantization
10
Original Mozart.wav
0.015
0.01
Quantized Mozart_q16.wav
0.005
-0.005
-0.01 2 2.002 2.004 2.006 2.008 2.01 2.012 2.014 2.016 2.018 2.02
4
x 10
EE3414:Quantization
11
0.015
0.01
0.01
0.005
0.005
-0.005
-0.005
-0.01
2.01
2.02
4
-0.01
2.01
2.02
4
x 10
x 10
Quantized Mozart_q16.wav
Quantized Mozart_q64.wav
EE3414:Quantization
12
Non-Uniform Quantization
Problems with uniform quantization
Only optimal for uniformly distributed signal Real audio signals (speech and music) are more concentrated near zeros Human ear is more sensitive to quantization errors at small values
Solution
Using non-uniform quantization
quantization interval is smaller near zero
EE3414:Quantization
13
Quantization levels : L Partition values : bl Partition regions : Bl = [bl 1 , bl ) Reconstruction values : g l Quantized Index : Qi ( f ) = l , if f Bl Quantizer value : Q( f ) = g l , if f Bl
Yao Wang, 2006 EE3414:Quantization 14
Function Representation
Q ( f ) = gl , if f Bl
Yao Wang, 2006 EE3414:Quantization 15
EE3414:Quantization
16
-Law Quantization
EE3414:Quantization
17
Quantize the transformed value using a uniform quantizer: y->y^ Transform the quantized value back using inverse -law: y^->x^
EE3414:Quantization
18
EE3414:Quantization
19
Example
For the following sequence {1.2,-0.2,-0.5,0.4,0.89,1.3}, Quantize it using a mu-law quantizer in the range of (-1.5,1.5) with 4 levels, and write the quantized sequence. Solution (indirect method):
apply the inverse formula to the partition and reconstruction levels found for the previous uniform quantizer example. Because the mu-law mapping is symmetric, we only need to find the inverse values for y=0.375,0.75,1.125
=9, x_max=1.5, 0.375->0.1297, 0.75->0.3604, 1.125->0.7706
Then quantize each sample using the above partition and reconstruction levels.
EE3414:Quantization
20
Example (cntd)
-1.125 -0.375 0.375 1.125
-1.5
-0.75
0.75
1.5
Inverse -law
-0.77
-0.13
0.13
0.77
-1.5
-0.36
0.36
1.5
With -law, small values are represented more accurately, but large values are represented more coarsely.
EE3414:Quantization
22
-0.01
2.01
2.02 x 10
4
-0.01
2.01
2.02 x 10
4
Mozart_q32_m4.wav 0
0
Mozart_q32_m16.wav
-0.01
2.01
2.02 x 10
4
-0.01
2.01
2.02 x 10
4
1 N
( x(n) x(n))
n
where N is the number of samples in the sequence. 1 2 x is the variance of the original signal, z2 = ( x(n)) 2 N n
Yao Wang, 2006 EE3414:Quantization 24
EE3414:Quantization
25
Binary Encoding
Convert each quantized level index into a codeword consisting of binary bits Ex: natural binary encoding for 8 levels:
000,001,010,011,100,101,110,111
EE3414:Quantization
26
-1.5
-0.75
0.75
1.5
EE3414:Quantization
27
-1.5
-0.75
0.75
1.5
Inverse -law
codewords 00 -0.77 01 -0.13 10 0.13 11 0.77
-1.5
-0.36
0.36
1.5
Data rate of a multimedia signal can be reduced significantly through lossy compression w/o affecting the perceptual quality.
To be covered later.
EE3414:Quantization
29
0.5
-0.5 0 10 20 30 40 50 60
EE3414:Quantization
30
EE3414:Quantization
31
EE3414:Quantization
32
References
Y. Wang, Lab Manual for Multimedia Lab, Experiment on Speech and Audio Compression. Sec. 1-2.1. (copies provided).
EE3414:Quantization
33