Quantization

15
Quantization

description

Quantization. Quantization. Signal x(t) is quantized in a finite number of levels Assume that x is in the dynamic range [-1,1[ and we quantize it with b+1 bits -> 2 b+1 levels Quantization introduces an error : e = Q[x] - x. Rounding versus truncation. Truncation: -2 -b < Q[x] – x

Transcript of Quantization

Page 1: Quantization

Quantization

Page 2: Quantization

27 March 2003 2

Quantization

• Signal x(t) is quantized in a finite number of levels

• Assume that x is in the dynamic range [-1,1[ and we quantize it with b+1 bits -> 2b+1 levels

• Quantization introduces an error: e = Q[x] - x

Q[.]x(t) xq(t)

Page 3: Quantization

27 March 2003 3

Rounding versus truncation

x

Q(x)

2-b-1

2-b

x

Q(x)

2-b

2-b

Rounding: -2-b/2 < Q[x] – x <= 2-b/2Example: 010111 ->0110

Truncation: -2-b < Q[x] – x <= 0Example: 010111 -> 0101

Page 4: Quantization

27 March 2003 4

Statistical model

• Additive error model: The quantized signal is the sum of the original signal and a quantization noise signal e(t)

Q[.]x(t) xq(t)

x(t) xq(t)

e(t)

Page 5: Quantization

27 March 2003 5

Fixed point representation

• Two’s complement fractional representation:

• Dynamic range:

• Advantage of fractional:

Multiplier can not overflow (except for (-1).(-1))

2-b2-1 2-2 2-3

b bits

0 if positif1 if negatif

[-1,1[ ∈ x :ionapproximat

]2-1 [-1, ∈x -b

[-1,1] ∈x.y → 1[ [-1, ∈y x,

)4

7→ 2 Mod

4

7→

4

1- :(example 2 + x = 2 Mod 2)+(x→ [-1,0[ ∈x

)4

1→ 2 Mod

4

9→

4

1 :(example x = 2 Mod 2)+(x→ [0,1]∈x

2 Mod 2)+(x

Page 6: Quantization

27 March 2003 6

Two’s complement fractional

• Example b=3

7/8 0111

6/8 0110

5/8 0101

4/8 0100

3/8 0011

2/8 0010

1/8 0001

0 0000

-1/8 1111

-2/8 1110

-3/8 1101

-4/8 1100

-5/8 1011

-6/8 1010

-7/8 1001

-1 1000

Page 7: Quantization

27 March 2003 7

Two’s complement arithmetic (1)

• Addition: • Addition can lead to an overflow. Need to scale the input.• If no overflow x+y can be represented exactly with b+1

bits. Example

• In a filter check the scaling (max/min signal values) at the output of each adder.

• An adder does not inject quantization noise

- 6/8 1010

+ 1/8 0001

= - 5/8 1011

[-2,2[∈ y)+(x→ [-1,1[∈y x,

Page 8: Quantization

27 March 2003 8

Two’s complement arithmetic's (2)• Multiplication:

• If coefficient is not –1, multiplier can not overflow

• x,y represented with b+1 bits -> x.y is exactly represented with 2b+1 bits

Example:

• If the multiplier output is forced into a register of lenght < 2b+1 it introduces a quantization noise whose max amplitude is 1 lsb (truncation) or +- ½ lsb (rounding).

7/8 0111

x 1/8 0001

= 7/64 0000111

[-1,1]∈ y).(x→ [-1,1[∈y x,

Page 9: Quantization

27 March 2003 9

Multiplier model

• If b3 <b1+b2-1 the truncation or rounding of the multiplier output is modeled as an additive noise e(n)

X

a

x(n) y(n)

b1 bits

b2 bits

b3 bitsX

a

x(n) y(n)

e(n)

b3 bits

Page 10: Quantization

27 March 2003 10

First-order IIR example

• Feedback path -> register size at multiplier output can not be increased at each iteration! Problem with IIR filters

• Noise e2(n) is amplified by the feedback loop (a is close to 1). We will choose b2 >b1

• Filter design: compute the PSD at the filter output due to each quantization noise. Statistics on e(n) needed

Xa

x(n) y(n)

b2 bits

ADCideal

x(t) b1 bits

e1(n)

Real ADC

e2(n)

Realmultiplier

b2 bits

z-1

++

1-az-1

1 = H(z)

Page 11: Quantization

27 March 2003 11

First order statistics (1)• e(n) is a random process = signal that can, for each time

index n, be described as a random variable e

• Probability Density Function pe(u)

pe(u).e = probability that the random variable e be in the interval [u,u+u]

• Uniform PDF: pe(u) is constant over a range W and zero elsewhere. Recall that the total area underneath pe(u) must integrate to 1

Area = 1Area = 1

u

pe(u)

2-b

2b

u

pe(u)

-2-b-1

2b

2-b-10

Truncation

Rounding

Page 12: Quantization

27 March 2003 12

First order statistics (2)• The hypothesis that the quantization error is uniform

does not hold if the input signal covers less than 1 lsb! It is assumed valid if the signals in all registers of the filter cover a significant portion of the register dynamic range.

• Mean:

DC component of the noise

• Variance:

total AC power of the noise

(rounding) 0 =

n)(truncatio 2- =.du (u)u.p = m 1-b-∞+

∞-ee ∫

rounding)or n (truncatio 12

2 =.du (u).p)m-(u = σ

-2b∞+

∞-e

2e

2e ∫

Page 13: Quantization

27 March 2003 13

Second order statistics

• Power Spectral Density of a random process e(n):

See(ejω) d ωpower in the band d ω centered at ω

In z domain, power spectral density PSD when there is only one noise input is defined as:

PSD, when there are K noise inputs, is

)()SH( )H( )(S ee1

ff zzzz

K

izzzz

1 ee1

iiff )()S(H )(H )(S

Page 14: Quantization

27 March 2003 14

Quantization noise• One noise source e(n) is fed into a linear filter and the

output is f(n)

• Mean:

• Power Spectrum:

h(n)e(n) f(n)

-k

e0j

ef h(k) m)H(e m m

)(S .)H(e )(S jee

2jjff

ee

)(S , , m jee

2ee

e )(S , , m jff

2ff

e

Page 15: Quantization

27 March 2003 15

Quantization noise

• Variance:

• Special case if e(n) is white

We will assume that the quantization noise e(n) is white

d . )(S .)H(e ∫0

jee

2j2f

e

2j2e

jff

∞- k

2k

2e

2f

0

2j2e

2f

2e

jee

)H(e . )(S and

h theorem)s(Parseval'or d)H(e

→ )(S

∑∫

e

e