looking briefly, seems like my implementation of the highpass in
dsp/filter_2p is direct form I biquad, with some kind of funky refactoring to save a multiply when in highpass configuration (b2 == b0, b1 == -2*b0, using the a/b notation from
biquad.c. (NB: the posts below from earlevel use the opposite convention:
a for numerators/zeroes/feedforward,
b for denomiators/poles/feedback; there is no historical agreement on this but the convention in
biquad.c has been dominant in recent years.)
and it looks like the implementation in
dsp/biquad is also DF1, however the update function is generic, and conversely only the lowpass form of coefficient calculation is provided.
this could all be cleaned up and made more consistent. e.g. by just adding the other coefficient formulas to
biquad and ditching
filter_2p. the nice thnig about the generic form is it can change modes on the fly. but could also have a separate update func for each mode to save a multiply or at least replace a mult with a shift.
another thing is that
biquad.c uses 8.24 coefficients, which is smart and saves some scaling gymnastics. i’d be curious to look at disassembly for both these implementations.
earlevel.com has good rundowns of biquad formulas:
though for blackfin i think sticking to DF1 is the right choice.
also might be worth trying out the fract16 IIR functions from the blackfin DSP library:
void iirdf1_fr16 (const fract16 input, fract16 output, int length, iirdf1_fr16_state *filter_state)
i think if you poke around in the toolchain headers you can find some more description in the comments…