QUOTE(ChiGung @ Oct 21 2005, 07:03 PM)
QUOTE(SebastianG @ Oct 21 2005, 06:14 PM)
This is probably what i would do in this situation:
Interesting to hear how this is done more properly.
Is there a benefit from applying the biquad process to the sequence at 22KHz rather than 11Khz (for twice as much computation)?
Does the upsampling improve accuracy or more the clarity of algorythm?
I mean could the upsampling be factored out of the stream and be squeezed into the action 'so to speak.
No. Since 11 kHz is not a multiple of 8 kHz you need to somehow interpolate things. And this "upsampling" must be at least done implicitely. If you have 16 kHz to begin with, you could just do a lowpass filter to avoid aliasing followed by throwing every 2nd sample away. (Since you throw every 2nd sample away you only need to calculate every 2nd filtered sample if possible)
If you want to do things right you actually need to "zero-stuff" the 11 kHz signal to the smallest common multiple of 8 kHz and 11 kHz (which is 88 kHz) apply a lowpass filter and output only every 11th sample.
This all can be done in one step using a FIR filter. Because of the many zeros in the 88kHz signal (zero stuffing is dead simple)

and the fact that you only need every 11th sample it's possible to speed-optimize the whole thing. (With a good filter you need around 40 MACs (multiply and accumulate) per output sample in this case).
However, the idea I described in my first replay might be a bit faster. I actually did not think it through completely. Let's do it now:
- zero stuffing (0 MULs, 0 ADDs)
- bidirectionally applied IIR filter using the biquad factorization (22/8x2x3x(3 MULs+4 ADDs) = 49,5 MULs + 66 ADDs)
- linear interpolation (1 MUL, 2 ADDs)
=> 50 MULs, 68 ADDs per output sample
Well, it looks like the old-school approach is slightly better in this case (in terms of speed, quality and simplicity) ;-)
Why is that ? The thing with IIR filters is: I can apply cool IIR filters with few MACs whereas applying similar FIR filters would require significantly more MACs.
But: Here we're only interested in a subset of the filtered samples (every nth sample) and many on the filter input samples are zero (due to the zero-stuffing). This can only be utilized by a FIR convolver. I underestimated this possible speed-improvement in this case.
edit:
The "old-school" approach boils down to something very similar to what you described, ChiGung -- only with larger window. For example:
outwav[lp*8+t] = inwav[lp*11-20]*c1 + inwav[lp*11-19]*c2 + ... + inwav[lp*11+30]*c51
where for each t in 0<=t<8 there's a special coefficient set c1...c51.
Sebi