# Direct form 1 filter equation for a biquad filter

In general, we all know that the direct form 1 equation for a biquad filter is given by

$$y(n) = b_0x(n) + b_1x(n-1) + b_2x(n-2) - a_1y(n-1) - a_2y(n-2)$$

But when it comes to practical applications like for audio processing applications, I have seen many people using

$$y(n) = b_0x(n) + 2b_1x(n-1) + b_2x(n-2) - 2a_1y(n-1) - a_2y(n-2)$$

as the filter equation in their codes.

So, I just want to know the reason why we need to multiply $$a_1$$ and $$b_1$$ coefficients by 2?

• I've never seen that, can you maybe link to an example of such code? quite possibly, it's computationally advantageous? – Marcus Müller Jun 28 '20 at 13:22

This may be a misunderstanding based on a fixed point implementation. Fixed point implementations can benefit from "fractional multiplies" which requires a number format where all absolute values are 1 or less. In Q notation that would be Q15.0 for a signed 16-bit integer. Many processors have a dedicated hardware instruction for this operation, which makes it fast and efficient.

Assuming that all poles and zeros are inside the unit circle, we have $$|b_0|, |b_2|, |a_2| < 1$$ but $$|b_1|, |a_1| < 2$$. In order to avoid shifting associated with mixed Q notation, the $$b_1$$ and $$a_1$$ coefficients are split in have, so numbers can be kept in the same Q. Hence it would be implemented as

$$y[n] = b_0 \cdot x[n] + b_1/2 \cdot x[n-1] + b_1/2 \cdot x[n-1] + b_2 \cdot x[n-1] ...$$

or

$$y[n] = b_0 \cdot x[n] + (b_1/2 \cdot x[n-1]) \ll 1 + b_2 \cdot x[n-1] ...$$

where $$\ll$$ is the left-shift operator.

This may looks like the coefficient is multiplied by two but in reality it's first split in half to make it's magnitude smaller than $$1$$, so the same type of fixed point multiplication can be used for all operations.