1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * SpanDSP - a series of DSP components for telephony
5 * biquad.h - General telephony bi-quad section routines (currently this just
6 * handles canonic/type 2 form)
8 * Written by Steve Underwood <steveu@coppice.org>
10 * Copyright (C) 2001 Steve Underwood
12 * All rights reserved.
15 struct biquad2_state
{
26 static inline void biquad2_init(struct biquad2_state
*bq
,
27 int32_t gain
, int32_t a1
, int32_t a2
, int32_t b1
, int32_t b2
)
39 static inline int16_t biquad2(struct biquad2_state
*bq
, int16_t sample
)
44 z0
= sample
* bq
->gain
+ bq
->z1
* bq
->a1
+ bq
->z2
* bq
->a2
;
45 y
= z0
+ bq
->z1
* bq
->b1
+ bq
->z2
* bq
->b2
;