DSPRelated.com
Forums

IIR Filter Realizations

Started by naebad October 1, 2006
In most books, block diagram realizations of IIR filters are shown -
these include Direct form1  and Direct form II also, transposed
realization and so on. I was wondering what the point is. Essentially
these are all state-space type realizations but in implmenting a filter
we just use the difference equation. I can see that if you were
implmenting in hardware then you would gain by for example only having
one set of delays rather than II but is this of importance? I expect
FPGA realization may benefit.


Naebad

naebad wrote:
> In most books, block diagram realizations of IIR filters are shown - > these include Direct form1 and Direct form II also, transposed > realization and so on. I was wondering what the point is. Essentially > these are all state-space type realizations but in implmenting a filter > we just use the difference equation. I can see that if you were > implmenting in hardware then you would gain by for example only having > one set of delays rather than II but is this of importance? I expect > FPGA realization may benefit.
Two sets of delays take twice as long to process and consume twice as much variable space. With hardware, the delays run in parallel, but in software they are sequential. Is that enough? There can be numerical issues as well; some forms are better behaved than others. Jerry -- "The rights of the best of men are secured only as the rights of the vilest and most abhorrent are protected." - Chief Justice Charles Evans Hughes, 1927 ���������������������������������������������������������������������
naebad wrote:
> In most books, block diagram realizations of IIR filters are shown - > these include Direct form1 and Direct form II also, transposed > realization and so on. I was wondering what the point is. Essentially > these are all state-space type realizations but in implmenting a filter > we just use the difference equation.
there are different difference equations for the DF1 vs. DF2 vs. transposed DF1/2 or the lattice or ladder filters. when you do this with finite precision words, there are practical differences.
> I can see that if you were > implmenting in hardware then you would gain by for example only having > one set of delays rather than II but is this of importance? I expect > FPGA realization may benefit.
doesn't matter whether it's FPGA or software. in both cases you have finite precision words. we've discussed this before multiple times on comp.dsp. suppose you have a high Q filter but one where the output gain is still 0 dB or less. (then you have a pair of poles very close to the unit circle, but in between the poles and the unit circle are zeros that are even closer to the unit circle) if you have fixed-point words, the DF2 will essentially boost your signal first (with the poles) and then cut your signal. but there will be clipping between the boost and the cut. there are two adders and two quantization points for the DF2. if it's DF1 and your one-and-only adder is double precision all 5 feedback and feedforward paths can be added before the single quantization. there is no clipping because your zeros happened before the poles. r b-j
"naebad" <minnaebad@yahoo.co.uk> wrote in message 
news:1159751598.411833.97300@m73g2000cwd.googlegroups.com...
> In most books, block diagram realizations of IIR filters > are shown - > these include Direct form1 and Direct form II also, > transposed > realization and so on. I was wondering what the point is. > Essentially > these are all state-space type realizations but in > implmenting a filter > we just use the difference equation. I can see that if you > were > implmenting in hardware then you would gain by for example > only having > one set of delays rather than II but is this of > importance? I expect > FPGA realization may benefit. >
I'm not sure what your "Direct Form" I and II look like but my reference shows two diagrams: "Direct" and "Canonic" implementations. Looking quickly at the "Direct" diagram, one could be forgiven for concluding that the delays corresponding to the zeroes are added to the delays corresponding to the poles. On closer inspection, it becomes clear that, from the incoming signal's point of view, the zeroes and poles are processed in parallel. Consequently, the delay in the "direct" form is governed by the greater of the number of poles or zeroes, just as in the "canonic" form. The main reason for preferring canonic over direct is higher stability and lower internal generation of noise caused by round-off error in finite precision implementations. There may also be a minor performance difference since one has to manage only half as many delay elements in the canonic form. One of the reasons for the improved noise performance of the canonic form is that the signal is first processed by the poles, then by the zeroes. In the direct form, noise generated by the zeroes is introduced to the poles, which recirculate it over and over (IIR) through their inherent feedback mechanism.

naebad wrote:

> In most books, block diagram realizations of IIR filters are shown - > these include Direct form1 and Direct form II also, transposed > realization and so on. I was wondering what the point is.
There are the different requirements for the storage memory and for the arithmetic precision. Also, the different IIR structures may be more or less convenient depending on the specific hardware. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
John E. Hadstate wrote:
> > I'm not sure what your "Direct Form" I and II look like but > my reference shows two diagrams: "Direct" and "Canonic" > implementations.
the word "canonic" had been used for architectures where the number of states is equal to the order of the filter. DF2 is canonic, the DF1 is not.
> Looking quickly at the "Direct" diagram, one could be > forgiven for concluding that the delays corresponding to the > zeroes are added to the delays corresponding to the poles. > On closer inspection, it becomes clear that, from the > incoming signal's point of view, the zeroes and poles are > processed in parallel.
DF1: y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2] which can be rewritten as: v[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] y[n] = v[n] - a1*y[n-1] - a2*y[n-2] the sub-filter with zeros processes x[n] to v[n] and that is followed by a sub-filter with poles that processes v[n] to y[n]. if there is no quantization imposed upon v[n] (and that is trivial with a typical fixed-point DSP like the 56K or the fixed-point portion of the SHArC, all you need to do is keep your double precision word until y[n] is computed), then the boost from the 2nd sub-filter (the one with the poles) will boost no quantization noise. in contrast, the DF2 is: v[n] = x[n] - a1*v[n-1] - a2*v[n-2] y[n] = b0*v[n] + b1*v[n-1] + b2*v[n-2] the poles come first, then the zeros.
> The main reason for preferring canonic over direct is higher > stability and lower internal generation of noise caused by > round-off error in finite precision implementations.
John, it's the opposite. you do a DF2 in fixed-point and, if you have enough Q in your biquad to make it useful for anything interesting, the poles will result in a lot of gain which will cause saturation at frequencies close to the resonant frequency and even though the following zeros will beat that gain back down, the damage of the saturation remains. then, too avoid such saturation you would have to crank down the input gain which will decrease S/N. it's the DF1 (the non-canonical form) that is preferred in a fixed-point context.
> There > may also be a minor performance difference since one has to > manage only half as many delay elements in the canonic form. > > One of the reasons for the improved noise performance of the > canonic form is that the signal is first processed by the > poles, then by the zeroes.
it's the opposite, John. doing the polse first causes saturation. to avoid the saturation you have to crank down the input. but the quantization noise is not going down with it. that decreases S/N.
> In the direct form, noise > generated by the zeroes is introduced to the poles, which > recirculate it over and over (IIR) through their inherent > feedback mechanism.
quantizers generate noise, zeros and poles do not. r b-j
"robert bristow-johnson" <rbj@audioimagination.com> wrote in 
message 
news:1159821032.691362.12240@m73g2000cwd.googlegroups.com...

> quantizers generate noise, zeros and poles do not. >
I'm sorry. You are mistaken, and all of your conclusions about canonic vs. direct-form IIR's are wrong. Moreover, I proved this more than thirty years ago.
> r b-j >
"John E. Hadstate" <jh113355@hotmail.com> writes:
> [...] > I'm sorry. You are mistaken, and all of your conclusions > about canonic vs. direct-form IIR's are wrong. Moreover, I > proved this more than thirty years ago.
Reference? -- % Randy Yates % "...the answer lies within your soul %% Fuquay-Varina, NC % 'cause no one knows which side %%% 919-577-9882 % the coin will fall." %%%% <yates@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO http://home.earthlink.net/~yatescr
robert bristow-johnson wrote:
> John E. Hadstate wrote: >> I'm not sure what your "Direct Form" I and II look like but >> my reference shows two diagrams: "Direct" and "Canonic" >> implementations. > > the word "canonic" had been used for architectures where the number of > states is equal to the order of the filter. DF2 is canonic, the DF1 is > not.
Sadly you can use a term like canonic to mean pretty much anything you want. It lacks a well standardised definition. Most books just say something is a canonic form, without justifying the term at all. I remember at college when we first heard the term applied to something. We were wondering how religion got into electronics. :-) When we asked our very capable lecturer about the exact meaning of the term, he fudged this issue. Steve
Steve Underwood skrev:
> robert bristow-johnson wrote: > > John E. Hadstate wrote: > >> I'm not sure what your "Direct Form" I and II look like but > >> my reference shows two diagrams: "Direct" and "Canonic" > >> implementations. > > > > the word "canonic" had been used for architectures where the number of > > states is equal to the order of the filter. DF2 is canonic, the DF1 is > > not. > > Sadly you can use a term like canonic to mean pretty much anything you > want. It lacks a well standardised definition. Most books just say > something is a canonic form, without justifying the term at all. I > remember at college when we first heard the term applied to something. > We were wondering how religion got into electronics. :-) When we asked > our very capable lecturer about the exact meaning of the term, he fudged > this issue.
>From http://www.thefreedictionary.com/canonic, item 3:
canonic - reduced to the simplest and most significant form possible without loss of generality; Rune