disp 2003 lecture 6 – part 2 digital filters 4 coefficient quantization zero input limit cycle how...
TRANSCRIPT
![Page 1: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/1.jpg)
DISP 2003Lecture 6 – Part 2
Digital Filters 4
Coefficient quantizationZero input limit cycleHow about using float?
Philippe Baudrenghien, AB-RF
![Page 2: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/2.jpg)
27 March 2003 P Baudrenghien AB/RF 2
Quantization of coefficients
• The coefficients ak and br must be quantized into our two’s complement fractional
• This creates a distortion in the achieved frequency response
• We measure the sensitivity to coefficient quantization by comparing the poles/zeros of the infinite precision and finite precision realizations
∑
∑N
0=k
k-k
M
0=r
r-r
z a
z b
=X(z)
Y(z)=H(z)
![Page 3: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/3.jpg)
27 March 2003 P Baudrenghien AB/RF 3
Displacement of the poles (1)• Our transfer function has N poles p0, p1, …, pN-1 defined by
the zeros of the denominator (Nth order polynomial with coefficients a0, a1, …, aN)
• Let us introduce an error am on the coefficient am
• This displaces all poles: p0 -> p0 + p0 , p1 -> p1 + p1 , …
• The displacement pn of the nth pole due to the error am is given by
∏N
n≠r 1,=rrn
m-Nn
mn
)p-(p
p aΔ - =pΔ
![Page 4: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/4.jpg)
27 March 2003 P Baudrenghien AB/RF 4
Displacement of the poles (2)
• High sensitivity if the filter has many poles. High order some poles are close together
• Potentially unstable if one pole is displaced outside the unit circle
• Conclusions use cascade of biquads (only 2 poles per transfer function) beware of poles close to the unit circle
∏N
n≠r 1,=rrn
m-Nn
mn
)p-(p
p aΔ - =pΔ
![Page 5: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/5.jpg)
27 March 2003 P Baudrenghien AB/RF 5
Elliptic IIR. Direct Form (1)• Consider the fourth order
Elliptic IIR LPF (Example 4, slide 11 in lecture 5, Part II)
• Direct Form II implementation (slide 15 in lecture 5, Part II)
• Quantize its coefficients with 8 bits …
• … and the filter becomes unstable. Two poles are moved outside the unit circle
Pole/zero plot of the infinite precision (blue) and finite precision (red) Elliptic IIR. Direct Form II, 8 bits coefficients.
![Page 6: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/6.jpg)
27 March 2003 P Baudrenghien AB/RF 6
Elliptic IIR. Direct Form (2)• … so we increase the
number of bits: 9 bits coefficients …
• … and it is stable but the frequency response shows severe distortion
Pole/zero plot of the infinite precision (blue) and finite precision (red) Elliptic IIR.Comparison of the achieved frequency response (green) with the reference (blue). Direct Form II, 9 bits coefficients.
![Page 7: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/7.jpg)
27 March 2003 P Baudrenghien AB/RF 7
Elliptic IIR. Direct Form (3)
• …we have to use 12 bits coefficients to obtain a reasonable result
• … but there still is a big ripple at the end of the Pass-band
Comparison of the achieved frequency response (green) with the reference (blue). Direct Form II, 12 bits coefficients
![Page 8: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/8.jpg)
27 March 2003 P Baudrenghien AB/RF 8
Elliptic IIR. Cascade of biquads • We now implement the IIR
with a cascade of 2 biquads (slide 16, lecture 5, Part II)
• The realization is now stable with only 8 bits coefficients
• The frequency response is a reasonable match to the reference
Comparison of the achieved frequency response (green) with the reference (blue). Cascade of two biquads, 8 bits coefficients
Lesson: Always use a cascade of biquads!
![Page 9: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/9.jpg)
27 March 2003 P Baudrenghien AB/RF 9
Equiripple FIR (1)• Coefficient quantization
displaces the zeros as well and the FIR response will also suffer distortion
• Consider the 31 coefficients Equiripple FIR (slide 17, lecture 5, Part I)
• First use 8 bits coefficients. The result is quite good
Pole/zero plot of the infinite precision (blue) and finite precision (red) Equiripple FIR.Comparison of the achieved frequency response (green) with the reference (blue). 8 bits coefficients.
![Page 10: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/10.jpg)
27 March 2003 P Baudrenghien AB/RF 10
Equiripple FIR (2)• So we decrease the
resolution further: 5 bits coefficients…
• … the impulse response is much distorted …
• … the zeros are not displaced much …
Impulse response of infinite precision (blue dots) and finite precision (green squares). Pole/zero plot of the infinite precision (blue) and finite precision (red). Equiripple FIR.5 bits coefficients
![Page 11: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/11.jpg)
27 March 2003 P Baudrenghien AB/RF 11
Equiripple FIR (3)• … and the
frequency response is still acceptable. It is actually almost within specs …
Comparison of the achieved frequency response (green) with the reference (blue). Equiripple FIR. 5 bits coefficients.
Lesson: FIR are much less sensitive to coefficient quantization
![Page 12: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/12.jpg)
27 March 2003 P Baudrenghien AB/RF 12
Zero Input Limit Cycle
• Back to the quantization of data
• So far (Part I) we have considered that the quantization noise sources (e1(n),e2(n),…) were white and independent of the input data x(n). This does not hold if the data covers a very small portion of the dynamic range
![Page 13: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/13.jpg)
27 March 2003 P Baudrenghien AB/RF 13
Zero Input Limit Cycle. Rounding• First order system
• We have
IC: y(0)=1 switch input off: x(n) = 0 precision = 1 decimal digit a = -0.9
• Rounding (downwards) to the first fractional digit
a
y(n)
z-1
++
X
Q[.]quantizer
X
1-a
x(n)Q[.]
Precision Finite x(n)]a)-Q[(1 + 1)]-y(n Q[a = y(n)
Precision Infinite x(n)a)-(1 + 1)-y(n a = y(n)
= y(10)
0.4- = Q[-0.36] = 0.4] x Q[-0.9 = y(9)
0.4 = Q[0.36] = 0.4]- x Q[-0.9 = y(8)
0.4- = Q[-0.36] = 0.4] x Q[-0.9 = y(7)
0.4 = Q[0.45] = 0.5]- x Q[-0.9 = y(6)
0.5- = Q[-0.54] = 0.6] x Q[-0.9 = y(5)
0.6 = Q[0.63] = 0.7]- x Q[-0.9 = y(4)
0.7- = Q[-0.72] = 0.8] x Q[-0.9 = y(3)
0.8 = Q[0.81] = 0.9]- x Q[-0.9 = y(2)
0.9- = Q[-0.9] = 1] x Q[-0.9 = y(1)
1=y(0)
Limit cycle of frequency ½ and amplitude 0.4
![Page 14: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/14.jpg)
27 March 2003 P Baudrenghien AB/RF 14
Zero Input Limit Cycle. Truncation• Truncation• With zero input, an oscillation
can be present at the output of a first order filter if rounding is used. For second and higher order filters a zero input limit cycle can appear with both rounding and truncation.
• The frequency of the limit cycle is close to the frequency where the filter has maximum response
No limit cycle 0 = Q[0] = 0] x Q[-0.9 = y(19)
0 = Q[0.09] = 0.1]- x Q[-0.9 = y(18)
0.1- = Q[-0.09] = 0.1] x Q[-0.9 = y(17)
0.1 = Q[0.18] = 0.2]- x Q[-0.9 = y(16)
0.2- = Q[-0.18] = 0.2] x Q[-0.9 = y(15)
0.2 = Q[0.27] = 0.3]- x Q[-0.9 = y(14)
0.3- = Q[-0.27] = 0.3] x Q[-0.9 = y(13)
0.3 = Q[0.36] = 0.4]- x Q[-0.9 = y(12)
0.4- = Q[-0.36] = 0.4] x Q[-0.9 = y(11)
0.4 = Q[0.45] = 0.5]- x Q[-0.9 = y(10)
0.5- = Q[-0.45] = 0.5] x Q[-0.9 = y(9)
0.5 = Q[0.54] = 0.6]- x Q[-0.9 = y(8)
0.6- = Q[-0.54] = 0.6] x Q[-0.9 = y(7)
0.6 = Q[0.63] = 0.7]- x Q[-0.9 = y(6)
0.7- = Q[-0.63] = 0.7] x Q[-0.9 = y(5)
0.7 = Q[0.72] = 0.8]- x Q[-0.9 = y(4)
0.8- = Q[-0.72] = 0.8] x Q[-0.9 = y(3)
0.8 = Q[0.81] = 0.9]- x Q[-0.9 = y(2)
0.9- = Q[-0.9] = 1] x Q[-0.9 = y(1)
1=y(0)
![Page 15: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/15.jpg)
27 March 2003 P Baudrenghien AB/RF 15
Bound on Zero Input Limit Cycle
• Let h(n) be the impulse response from the quantization noise e(n) to the filter output f(n), we have:
• This bound is often largely over-estimated.
∑
∑∑
∑
∞
∞- =k
1-b-
∞
∞- =k
b-∞
∞- =kmax max
∞
∞- =k
(Rounding) 2 |h(k)|=
n)(Truncatio 2 |h(k)| = |e| |h(k)| =|f(n)|
k)-e(n h(k) = f(n)
![Page 16: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/16.jpg)
27 March 2003 P Baudrenghien AB/RF 16
Floating Point Format
• IEEE 32 bits standard
• No need for scaling … Dynamic range covers 77 decades!
1.f22 - f0s e7 - e0
8 bits exponent
sign bit
23 bits mantissa
hidden bit
![Page 17: DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF](https://reader036.vdocument.in/reader036/viewer/2022081603/56649eda5503460f94bea102/html5/thumbnails/17.jpg)
27 March 2003 P Baudrenghien AB/RF 17
Quantization error with float• Quantization error introduced by both additions and
multiplications
• By rounding (or truncating) the mantissa of x(n) to the b+1 bits format, we get Q[x(n)]
where
• The quantization noise is an additive error term
(n)ε x(n).+ x(n)= (n))ε + (1 x(n)= Q[x(n)]-b-b 2 ≤(n)ε<2-
(n) x(n).e(n)
The noise is proportional to the signal (constant SNR) and the overall performance is much better