LIBDSP Version 4.1.9
LIBDSP Software Library
Loading...
Searching...
No Matches
High Precision Q31 Biquad Cascade Filter
Collaboration diagram for High Precision Q31 Biquad Cascade Filter:

Functions

void tpt_biquad_cascade_df1_32x64_init_q31 (tpt_biquad_cascade_df1_32x64_q31_t *aFilter, uint8_t uStages, const q31_t *pCoeffs, q63_t *pState, uint8_t pShift)
 Initialization function for the Q31 Biquad cascade 32x64 filter.

Detailed Description

This function implements a high precision Biquad cascade filter which operates on Q31 data values. The filter coefficients are in 1.31 format and the state variables are in 1.63 format. The double precision state variables reduce quantization noise in the filter and provide a cleaner output. These filters are particularly useful when implementing filters in which the singularities are close to the unit circle. This is common for low pass or high pass filters with very low cutoff frequencies.

The function operates on blocks of input and output data and each call to the function processes blockSize samples through the filter. pSrc and pDst points to input and output arrays containing blockSize Q31 values.

Function Documentation

◆ tpt_biquad_cascade_df1_32x64_init_q31()

void tpt_biquad_cascade_df1_32x64_init_q31 ( tpt_biquad_cascade_df1_32x64_q31_t * aFilter,
uint8_t uStages,
const q31_t * pCoeffs,
q63_t * pState,
uint8_t pShift )

Initialization function for the Q31 Biquad cascade 32x64 filter.

Parameters
[in,out]aFilterpoints to an instance of the high precision Q31 Biquad cascade filter structure
[in]uStagesnumber of 2nd order stages in the filter
[in]pCoeffspoints to the filter coefficients
[in]pStatepoints to the state buffer
[in]pShiftShift to be applied after the accumulator. Varies according to the coefficients format
Returns
none
Coefficient and State Ordering
The coefficients are stored in the array pCoeffs in the following order: pre> {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} /pre> where b1x and a1x are the coefficients for the first stage, b2x and a2x are the coefficients for the second stage, and so on. The pCoeffs array contains a total of 5*numStages values.
The pState points to state variables array and size of each state variable is 1.63 format. Each Biquad stage has 4 state variables x[n-1], x[n-2], y[n-1], and y[n-2]. The state variables are arranged in the state array as: pre> {x[n-1], x[n-2], y[n-1], y[n-2]} /pre> The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on. The state array has a total length of 4*numStages values. The state variables are updated after each block of data is processed; the coefficients are untouched.