DSPRelated.com
Forums

IIR Form to prevent Limit Cycles?

Started by sparafucile17 December 18, 2007
On Dec 19, 1:51 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
> robert bristow-johnson wrote: > > > > i still think that fraction saving is the cheapest means to solve the > > specific problem of limit-cycles in an IIR causing your output to be > > stuck to a non-zero value even when dead silence is going in. unless > > your hardware is designed to do "round-toward-zero", > > The noise shaping has to be done at every biquad stage. The nonlinear > thing or a noise gate can be done only once for the whole system, hence > it could be simpler.
in audio, often the filters are a single resonant biquad. but nonetheless, the nonlinear thingie or noise gate thingie might be something that leaves audible artifacts (when the gate opens and closes, whatever) when all we want is a nice and quiet filter that, when silence goes in, the output VU meter goes to -inf dB rather than getting stuck on -65 dB.
> But usually the problem with IIRs is not only because of the limit > cycles.
it's a common problem, at least in audio. a *very* common problem. at least limit cycles with spurious DC in the output. that's a very, very common scourge of IIR filters in audio. as far as i am concerned, when at all possible (some special purpose signal flow architectures make this difficult or impossible), either dither or this noise-shaping should be used in every fixed-point IIR filter for audio use. and this "fraction saving" (a specific kind of noise shaping applied to "round-to-negative-infinity" truncation) is cheaper than nearly any other decent solution. i might apply triangular p.d.f. dither (and further quantize, perhaps to 16 bit) at the back end of the algorithm, but this fraction saving can be and should be applied to each quantization point in the IIR filter. that is one per biquad in cascade.
> The loss of precision is bad, and the only way to deal with that > is the noise shaping. BTW, BlackFin architecture is very inconvenient > for that purpose.
a long time ago, before there was the "Sigma DSP", i was looking at Blackfin and decided that, unless one were using the sheer speed of the chip to do double-precision processing, that it was not really a good choice for audio. r b-j

robert bristow-johnson wrote:

>>The noise shaping has to be done at every biquad stage. The nonlinear >>thing or a noise gate can be done only once for the whole system, hence >>it could be simpler. > > > in audio, often the filters are a single resonant biquad. but > nonetheless, the nonlinear thingie or noise gate thingie might be > something that leaves audible artifacts
Agreed. But quite often there is a tradeoff about how to do it right vs what fits the bill.
>>But usually the problem with IIRs is not only because of the limit >>cycles. > > it's a common problem, at least in audio. a *very* common problem. > at least limit cycles with spurious DC in the output. that's a very, > very common scourge of IIR filters in audio.
Exactly. The people who didn't work with the audio don't realize how serious this problem can be.
>>BTW, BlackFin architecture is very inconvenient >>for that purpose. > > > a long time ago, before there was the "Sigma DSP", i was looking at > Blackfin and decided that, unless one were using the sheer speed of > the chip to do double-precision processing, that it was not really a > good choice for audio.
I would rather characterize the speed of BlackFin as moderate, since it is barely adequate for the real time video unpacking. As for the audio, Blackfin can efficiently do MACs with 31 x 31 = 31 bit precision. But for the noise shaping you need all 64 bits of the result, and this is difficult with BlackFin. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
>i don't know your instruction set (is this the ADI Sigma DSP?) but >fraction saving really *is* cheap. consider this as pseudo-code >(since i dunno the instruction set) > > CLEAR ACCUM-HI (perhaps this won't be necessary) > RESTORE ACCUM-LO (whatever you stored at the last sample) > MAC B0 > MAC B1 > MAC B2 > MAC A1 > MAC A2 > STORE ACCUM-HI (this truncated word is your output sample) > STORE ACCUM-LO > >that's it. that's all you have to do to implement "fraction saving". > > >r b-j >
WOW... That's creepy. How'd you know it was a Sigma DSP?! I didn't think anyone in the world knew about this part other than me. Do you know Bob Adams or something? When you say that you "RESTORE ACCUM-LO" is this the lower 28-bits of the last y[n]? And what about cascaded IIR's, how would you carry this through each biquad stage? - Jeff

sparafucile17 wrote:


> WOW... That's creepy. How'd you know it was a Sigma DSP?! I didn't think > anyone in the world knew about this part other than me.
It is obvious to anyone who works with the audio. There are only few so-called DAPs from AD, TI, AKM, Cirrus Logic, NXP. I prefer working with the true general purpose DSP though. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Dec 19, 4:08 pm, "sparafucile17" <sparafucil...@hotmail.com> wrote:
> >i don't know your instruction set (is this the ADI Sigma DSP?) but > >fraction saving really *is* cheap. consider this as pseudo-code > >(since i dunno the instruction set) > > > CLEAR ACCUM-HI (perhaps this won't be necessary) > > RESTORE ACCUM-LO (whatever you stored at the last sample) > > MAC B0 > > MAC B1 > > MAC B2 > > MAC A1 > > MAC A2 > > STORE ACCUM-HI (this truncated word is your output sample) > > STORE ACCUM-LO > > >that's it. that's all you have to do to implement "fraction saving". > > >r b-j > > WOW... That's creepy. How'd you know it was a Sigma DSP?!
i think i heard you mention "28-bit". but the fact is, i didn't know and i was hedging my bets with "pseudocode".
> I didn't think > anyone in the world knew about this part other than me. Do you know Bob > Adams or something?
i guess so. but i would s'pose other users of the Sigma DSP would recognize the syntax. BTW, even though i looked at the data from ADI a little, i have never used or coded or anything for a Sigma DSP.
> When you say that you "RESTORE ACCUM-LO" is this the lower 28-bits of the > last y[n]?
no, it's crappy pseudocode from someone who doesn't know the Sigma DSP. i dunno how the indexing works in the Sigma, maybe the STORE ACCUM-LO and RESTORE ACCUM-LO instructions have to work with a different buffer (and index) than whatever those MAC instructions are using.
> And what about cascaded IIR's, how would you carry this > through each biquad stage?
even for (especially for) cascaded IIRs, you need to quantize at the output of every section (i, and i think Bob, would recommend cascaded Direct Form 1 sections) at least for the feedback states, but also for the input to the next section. so this fraction saving should be employed at every stage. i remember a couple of years ago stopping at the ADI booth at the AES and Bob showing me this. someone else had coded a double-precision IIR kernel for it, and i was trying to explain the difference between "fraction saving" and "double precision" (since fraction saving *does* store a double precision result, but it deals with the high word and low word differently than double precision). anyway, i can't remember who this ADI person was, but i remember that i was not successful at explaining the difference to this person at that time. Jeff, can you tell me how many simultaneous buffers (or buffer pointers) you can have with the Sigma DSP? you might need a couple extra for noise states, if you do noise shaping. r b-j
On Dec 19, 4:17 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
> sparafucile17 wrote: > > WOW... That's creepy. How'd you know it was a Sigma DSP?! I didn't think > > anyone in the world knew about this part other than me. > > It is obvious to anyone who works with the audio. There are only few > so-called DAPs from AD, TI, AKM, Cirrus Logic, NXP. I prefer working > with the true general purpose DSP though.
at least (with the genuine, bona fide general purpose DSP - which one would that be?) you get a conditional IF-THEN-ELSE control of program flow. when you don't have a simple branch instruction, it becomes pretty clear how necessary they are to do anything decent. r b-j
>On Dec 19, 4:17 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> >wrote: >> sparafucile17 wrote: >> > WOW... That's creepy. How'd you know it was a Sigma DSP?! I didn't
think
>> > anyone in the world knew about this part other than me. >> >> It is obvious to anyone who works with the audio. There are only few >> so-called DAPs from AD, TI, AKM, Cirrus Logic, NXP. I prefer working >> with the true general purpose DSP though. > >at least (with the genuine, bona fide general purpose DSP - which one >would that be?) you get a conditional IF-THEN-ELSE control of program >flow. when you don't have a simple branch instruction, it becomes >pretty clear how necessary they are to do anything decent. > >r b-j >
Rick, I agree, conditionals are almost always a performance killer on any DSP. I personally prefer to work on audio processors than general purpose parts because they are simple and fast. Too me it gets back to the basics of DSP coding: one interrupt loop and raw assembly code. This type of design is efficient and honed to the application. You don't always need DMA/RTOS/C-complier/EBIU/cache/etc for simple filtering/delay/mixing applications. And this is what a lot of audio applications are. Plus you can't beat the cost. Audio processors can be $3-$4 and GP DSPs can range from $5-$10 for the basic ones! I personally know that my company has won business by beating the competitors price by less than 50 cents! So in a market like this, several dollars of savings means everything! ;) ------------------- Back to original thread... Rick, can you answer my previous question about the fraction-saving you proposed? "When you say that you "RESTORE ACCUM-LO" is this the lower 28-bits of the last y[n]? And what about cascaded IIR's, how would you carry this through each biquad stage?" Thanks, Jeff

robert bristow-johnson wrote:


>>>WOW... That's creepy. How'd you know it was a Sigma DSP?! I didn't think >>>anyone in the world knew about this part other than me. >> >>It is obvious to anyone who works with the audio. There are only few >>so-called DAPs from AD, TI, AKM, Cirrus Logic, NXP. I prefer working >>with the true general purpose DSP though. > > > at least (with the genuine, bona fide general purpose DSP - which one > would that be?)
My current workhorse is BlackFin, although all modern DSPs are about the same sort of crap.
> you get a conditional IF-THEN-ELSE control of program > flow. when you don't have a simple branch instruction, it becomes > pretty clear how necessary they are to do anything decent.
Exactly. With the stupid DAPs, you have to do all of the processing at once, and there is only the limited number of things that you can do. VLV
Vladimir Vassilevsky wrote:
>> you get a conditional IF-THEN-ELSE control of program >> flow. when you don't have a simple branch instruction, it becomes >> pretty clear how necessary they are to do anything decent. > > Exactly. With the stupid DAPs, you have to do all of the processing at > once, and there is only the limited number of things that you can do.
There's only a limited number of things the volume users want them to do. :-) Steve
On Dec 20, 8:16 am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
> ... although all modern DSPs are about the > same sort of crap.
So what would you do differently in a DSP chip's design so that you wouldn't label it as some sort of excrement?