0% found this document useful (0 votes)
52 views

DSP Chapter2

Kk

Uploaded by

viethung2004z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

DSP Chapter2

Kk

Uploaded by

viethung2004z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Chapter 2

Quantization
Nguyen Thanh Tuan, Click
M.Eng.
to edit Master subtitle style
Nguyen Khanh Loi, M.Eng.
Department of Telecommunications (113B3)
Ho Chi Minh City University of Technology [email protected]
Email: [email protected]
1. Quantization process

Fig: Analog to digital conversion

v The quantized sample xQ(nT) is represented by B bit, which can take


2B possible values.

v An A/D is characterized by a full-scale range R which is divided


into 2B quantization levels. Typical values of R in practice are
between 1-10 volts.

Digital Signal Processing 2 Quantization


1. Quantization process

Fig: Signal quantization


R
v Quantizer resolution or quantization width (step) Q =
2B
R R
v A bipolar ADC - £ xQ (nT ) <
2 2
v A unipolar ADC 0 £ xQ (nT ) < R

Digital Signal Processing 3 Quantization


1. Quantization process

v Quantization by rounding: replace each value x(nT) by the nearest


quantization level.

v Quantization by truncation: replace each value x(nT) by its below


nearest quantization level.
v Quantization error: e(nT ) = xQ (nT ) - x(nT )
Q Q
v Consider rounding quantization: - £e£
2 2

Fig: Uniform probability density of quantization error


Digital Signal Processing 4 Quantization
1. Quantization process

Q /2 Q /2
1
v The mean value of quantization error e = ò
- Q /2
ep (e)de = ò
- Q /2
e
Q
de =0

Q /2 Q /2 2
1 Q
v The mean-square error s q 2 = e 2 = ò ( e - e ) 2 p( e)de = ò e 2 de =
Q 12
(power) - Q /2 - Q /2

Q
v Root-mean-square (rms) error: erms = s q = e2 =
12
v R and Q are the ranges of the signal and quantization noise, then
the signal to noise ratio (SNR) or dynamic range of the
quantizer is defined as
æ s x2 ö æRö
SNR dB = 10log10 ç 2 ÷ = 20log10 ç ÷ = 20log10 (2 B ) = 6 B dB
çs ÷ èQø
è qø
which is referred to as 6 dB bit rule.
Digital Signal Processing 5 Quantization
1. Quantization process

v The increase in the number of quantization levels leads to the


decrease of distortion.

Digital Signal Processing 6 Quantization


Example 1

v In a digital audio application, the signal is sampled at a rate of 44


KHz and each sample quantized using an A/D converter having a
full-scale range of 10 volts. Determine the number of bits B if the
rms quantization error must be kept below 50 microvolts. Then,
determine the actual rms error and the bit rate in bits per second.

Digital Signal Processing 7 Quantization


2. Digital to Analog Converters (DACs)

Fig: B-bit D/A converter

v Vector B input bits : b=[b1, b2,…,bB]. Note that bB is the least


significant bit (LSB) while b1 is the most significant bit (MSB).
v For unipolar signal, xQ є [0, R); for bipolar xQ є [-R/2, R/2).

Digital Signal Processing 9 Quantization


2. DACs

Rf
v Full scale R=VREF, B=4 bit
åI i

2Rf 4Rf 8Rf 16Rf xQ=Vout


MSB
bB
b1
LSB
-VREF
Fig: DAC using binary weighted resistor

æ b1 b2 b3 b4 ö
å REF ç 2 R 4 R 8R 16 R
I = V ç + + + ÷÷
è f f f f ø
æ b1 b2 b3 b4 ö
xQ = VOUT = å I × R f = VREF ç + + + ÷
è 2 4 8 16 ø
xQ = R 2-4 ( b1 2-3 + b2 2-2 + b3 2-1 + b4 20 ) = Q ( b1 2-3 + b2 2-2 + b3 2-1 + b4 20 )

Digital Signal Processing 10 Quantization


2. DACs

v Unipolar natural binary xQ = R(b1 2-1 + b2 2-2 + ... + bB 2- B ) = Qm

where m is the integer whose binary representation is b=[b1, b2,…,bB].


m = b1 2 B -1 + b2 2 B - 2 + ... + bB 20

v Bipolar offset binary: obtained by shifting the xQ of unipolar natural


binary converter by half-scale R/2:
-1 -2 R-B R
xQ = R (b1 2 + b2 2 + ... + bB 2 ) - = Qm -
2 2
v Two’s complement code: obtained from the offset binary code by
complementing the most significant bit, i.e., replacing b1 by b1 = 1 - b1 .
-1 -2 R -B
xQ = R (b1 2 + b2 2 + ... + bB 2 ) -
2
Digital Signal Processing 11 Quantization
Example 2

v A 4-bit D/A converter has a full-scale R=10 volts. Find the quantized
analog values for the following cases ?
a) Natural binary with the input bits b=[1001] ?
b) Offset binary with the input bits b=[1011] ?
c) Two’s complement binary with the input bits b=[1101] ?

Digital Signal Processing 12 Quantization


3. A/D converters

v A/D converters quantize an analog value x so that is is represented


by B bits b=[b1, b2,…,bB].

Fig: B-bit A/D converter

Digital Signal Processing 13 Quantization


3. A/D converters

v One of the most popular converters is the successive approximation


A/D converter

Fig: Successive approximation A/D converter

v After B tests, the successive approximation register (SAR) will hold


the correct bit vector b.

Digital Signal Processing 14 Quantization


3. A/D converters
v Successive approximation algorithm

Truncation quantization Rounding quantization

where the unit-step function is defined by


ì1 if x ³ 0
u ( x) = í
î0 if x < 0

Two’s complement
Digital Signal Processing 15 Quantization
3. A/D converters

Converter codes for B = 4 bits, R = 10 volts.


Digital Signal Processing 16 Quantization
Example 3

v Consider a 4-bit ADC with the full-scale R=10 volts. Using the
successive approximation algorithm to find offset binary of
truncation quantization for the analog values x=3.5 volts and x=-1.5
volts.

Test b1b2b3b4 xQ C = u(x – Test b1b2b3b4 xQ C = u(x – xQ)


xQ)
b1
1000 0,000 1
b1 1000 0,0 0
b2
1100 2,500 1
b2 0100 -2,5 1
b3
1110 3,750 0
b3
0110 -1,25 0 b4
1101 3,125 1
b4
0101 -1,875 1
1101 3,125
0101 -1,875
Digital Signal Processing 17 Quantization
Example 4

v Consider a 4-bit ADC with the full-scale R=10 volts. Using the
successive approximation algorithm to find offset and two’s
complement of rounding quantization for the analog values x=3.5
volts.

Digital Signal Processing 19 Quantization


4. Oversampling and Noise shaping

Because the white noise is equally distributed over the Nyquist


interval with an unchanged total average power, the noise
power per unit frequency interval will be reduced if the Nyquist
interval is enlarged.

Xs(f)

See(f)

-fs/2 fs/2

Xs(f)

See(f)

-fs/2 fs/2

Digital Signal Processing 20 Quantization


4. Oversampling and Noise shaping

The noise power within any Nyquist subinterval [fa, fb] of width Δf
= fb - fa is given by:

As expected, the total power over the entire interval Δf = fs will be

Digital Signal Processing 21 Quantization


4. Oversampling and Noise shaping

Consider two cases, one with sampling rate fs and B bits per
sample, and the other with higher sampling rate fs’ and B’ bits
per sample.
L: Over sampling ratio

To maintain the same quality in the two cases, we require that


the power spectral densities remain the same:

L = 4 → ΔB = 1
L = 16 → ΔB = 2

Digital Signal Processing 22 Quantization


4. Oversampling and Noise shaping

Noise shaping quantizers reshape the spectrum of the


quantization noise into a more convenient shape

Digital Signal Processing 23 Quantization


4. Oversampling and Noise shaping

Oversampling with Noise shaping

A noise shaping quantizer operating at the higher rate fs’ can reshape the flat noise
spectrum so that most of the power is squeezed out of the fs Nyquist interval and
moved into the outside of that interval.

Digital Signal Processing 24 Quantization


4. Oversampling and Noise shaping

Digital Signal Processing 25 Quantization


Uniform and non-uniform quantization

Digital Signal Processing 27 Quantization


Mid-riser and mid-tread quantization

Digital Signal Processing 28 Quantization


Bonus 2.1

v Write a program to simulate DAC.

MSB
b1
b2
b3
xQ
DAC

bB
LSB
R (full-scale range)

Digital Signal Processing 29 Quantization


Bonus 2.2

v Write a program to simulate ADC.


MSB
b1
b2
x(n) b3
ADC

bB
LSB
R (full-scale range)

Digital Signal Processing 30 Quantization


Homework 1

v Cho bộ lượng tử và mã hóa nhị phân tự nhiên B = 5 bit hoạt động


theo nguyên tắc làm tròn gần nhất (rounding) với khoảng lượng tử
đều Q = 1.1 (biết 0 là giá trị lượng tử nhỏ nhất).
a) Xác định giá trị lượng tử lớn nhất?
b) Kiểm tra xem liệu giá trị 20.10 có là giá trị lượng tử hay không?
c) Xác định giá trị lượng tử tương ứng với từ mã 10011?
d) Xác định từ mã của mẫu tín hiệu ngõ vào 20.10?
e) Làm lại câu d trong trường hợp B = 8 bit?

Digital Signal Processing 33 Quantization


Homework 2

v Cho bộ lượng tử và mã hóa nhị phân tự nhiên 8 bit hoạt động theo
nguyên tắc làm tròn gần nhất (rounding) với khoảng lượng tử đều
Q = 0.4 (biết 0 là giá trị lượng tử nhỏ nhất).
a) Xác định giá trị lượng tử lớn nhất?
b) Kiểm tra xem liệu giá trị 24.04 có là giá trị lượng tử hay không?
c) Xác định giá trị lượng tử tương ứng với từ mã 00111101?
d) Xác định từ mã của mẫu tín hiệu ngõ vào 20.13?
e) Dùng giải thuật test bit, xác định từ mã của mẫu tín hiệu ngõ vào
25.03?
f) Đề xuất 1 giải pháp để thực hiện lượng tử theo nguyên tắc rút bớt
(làm tròn xuống) trong trường hợp vẫn sử dụng bộ lượng tử và mã
hóa hoạt động theo nguyên tắc làm tròn trên?

Digital Signal Processing 35 Quantization


Homework 3

v Cho bộ lượng tử và mã hóa nhị phân tự nhiên 8 bit hoạt động theo
nguyên tắc làm tròn với khoảng lượng tử đều Q = 0.1 (biết 0 là giá
trị lượng tử nhỏ nhất).
a) Xác định giá trị lượng tử lớn nhất?
b) Xác định giá trị lượng tử tương ứng với từ mã 11100011?
c) Xác định từ mã của mẫu tín hiệu ngõ vào 22.07?
d) Dùng giải thuật test bit, xác định từ mã của mẫu tín hiệu ngõ vào
9.05?
e) Giả sử tín hiệu phân bố đều trong tầm hoạt động, tính tỉ số công
suất tín hiệu trên nhiễu SNR của bộ lượng tử trên?

Digital Signal Processing 36 Quantization


Homework 4

v Cho bộ lượng tử lưỡng cực đối xứng hoạt động theo nguyên tắc
làm tròn với khoảng lượng tử đều Q = 0.2 (biết 0 là một giá trị
lượng tử) và mã hóa nhị phân 8 bit dạng bù 2.
a) Xác định giá trị lượng tử lớn nhất và nhỏ nhất?
b) Xác định giá trị lượng tử tương ứng với từ mã 10001000?
c) Xác định từ mã của mẫu tín hiệu ngõ vào 1.64?
d) Dùng giải thuật test bit, xác định giá trị lượng tử của mẫu tín hiệu
ngõ vào 1.64?

Digital Signal Processing 38 Quantization


Homework 5

v Một tín hiệu rời rạc được lượng tử và mã hóa bằng bộ chuyển
đổi A/D 4 bit có tầm toàn thang R=1@ V dùng giải thuật xấp xỉ
liên tiếp làm tròn xuống (truncation).
a) Hãy xác định khoảng lượng tử Q?
b) Tìm giá trị lượng tử xQ cho giá trị rời rạc x=2.75 V và từ mã
b=[b1 b2 b3 b4] tương ứng cho mã offset?
c) Lặp lại câu b) cho mã bù hai?

Digital Signal Processing 39 Quantization

You might also like