Realtime fixed point IIR filter implementation in C
Although this seems like a remarkably simple questions, it requires a remarkably complicated answer.
I don't think there is a &quot;one-size&quot; fits all solution. The best choice of algorithm will depend on what noise you can tolerate and the type of low pass (steepness &amp; frequency). For example at 44.1 KHz sample rate a 4th order Butterworth at 10 kHz is fairly straight forward, whereas a lowpass at a 100Hz is a royal pain. In essence it depends on how close your poles are to the unit circle.
Quantization and rounding error of IIR filters are usually transfered to the output weighed by the pole-only transfer function. A 4th order Butterworth 10 kHz low pass filter has a worst case noise amplification of only 5dB, so that is not much of a problem.
However at a 100 Hz low pass (again 4th order BW) the noise gets amplified by a whopping 75 dB. If you use Q15 math, your basic noise floor is maybe at -100dB or so. After the filter, your signal to noise ratio will only be 25 dB.
That's one of the reasons why fixed point IIR filters are fairly complicated. IF you need low cutoff frequencies and half way decent signal to noise ratio, then the basic algorithms will not work. You need to look into double precision math and/or error spectrum shaping or related methods.