Logo
MSP DSP Library
Real IIR

Data Structures

struct  msp_biquad_df1_q15_coeffs
 Coefficients for direct form 1 biquad filter. More...
 
struct  msp_biquad_df1_q15_states
 States for direct form 1 biquad filter. More...
 
struct  msp_biquad_df1_q15_params
 Parameter structure for direct form 1 biquad filter. More...
 
struct  msp_biquad_cascade_df1_q15_params
 Parameter structure for cascaded direct form 1 biquad filter. More...
 
struct  msp_biquad_df2_q15_coeffs
 Coefficients for direct form 2 biquad filter. When using LEA these coefficients must be placed into shared RAM. More...
 
struct  msp_biquad_df2_q15_states
 States for direct form 2 biquad filter. More...
 
struct  msp_biquad_df2_q15_params
 Parameter structure for direct form 2 biquad filter. More...
 
struct  msp_biquad_cascade_df2_q15_params
 Parameter structure for cascaded direct form 2 biquad filter. More...
 
struct  msp_biquad_df2_ext_q15_coeffs
 Coefficients for extended direct form 2 biquad filter. When using LEA these coefficients must be placed into shared RAM. More...
 
struct  msp_biquad_df2_ext_q15_states
 States for extended direct form 2 biquad filter. More...
 
struct  msp_biquad_df2_ext_q15_params
 Parameter structure for extended direct form 2 biquad filter. More...
 
struct  msp_biquad_cascade_df2_ext_q15_params
 Parameter structure for cascaded extended direct form 2 biquad filter. More...
 

Functions

msp_status msp_biquad_df1_q15 (const msp_biquad_df1_q15_params *params, const _q15 *src, _q15 *dst)
 Second-order direct form 1 biquad filter. More...
 
msp_status msp_biquad_cascade_df1_q15 (const msp_biquad_cascade_df1_q15_params *params, const _q15 *src, _q15 *dst)
 Cascaded direct form 1 biquad filter. More...
 
msp_status msp_biquad_df2_q15 (const msp_biquad_df2_q15_params *params, const _q15 *src, _q15 *dst)
 Second-order direct form 2 biquad filter. More...
 
msp_status msp_biquad_cascade_df2_q15 (const msp_biquad_cascade_df2_q15_params *params, const _q15 *src, _q15 *dst)
 Cascaded direct form 2 biquad filter. More...
 
msp_status msp_biquad_df2_ext_q15 (const msp_biquad_df2_ext_q15_params *params, const _q15 *src, _q15 *dst)
 Second-order direct form 2 biquad filter extended with DC bias and minimum and maximum tracking. More...
 
msp_status msp_biquad_cascade_df2_ext_q15 (const msp_biquad_cascade_df2_ext_q15_params *params, const _q15 *src, _q15 *dst)
 Cascaded direct form 2 biquad filter extended with DC bias and minimum and maximum tracking. More...
 

Detailed Description

Functions for performing real Infinite Impulse Response (IIR) filters.

Function Documentation

msp_status msp_biquad_cascade_df1_q15 ( const msp_biquad_cascade_df1_q15_params params,
const _q15 src,
_q15 dst 
)

Cascaded direct form 1 biquad filter.

Details
Cascaded biquad filter with direct form 1 implementation. The coefficients are passed as an array of second-order sections (SOS matrix) and each section is passed to msp_biquad_df1_q15 to filter the input.
biquad_cascade_df1.svg
Example filter with three DF1 stages
LEA Support
This function is supported by LEA and requires data to be placed into shared LEA memory with 4-byte alignment.
Parameters
paramsPointer to the cascaded biquad direct form 1 parameter structure.
srcPointer to the source data to filter.
dstPointer to the destination vector.
Returns
Status of the operation.
Examples:
filter_ex3_biquad_cascade_df1_q15.c.
msp_status msp_biquad_cascade_df2_ext_q15 ( const msp_biquad_cascade_df2_ext_q15_params params,
const _q15 src,
_q15 dst 
)

Cascaded direct form 2 biquad filter extended with DC bias and minimum and maximum tracking.

Details
Cascaded biquad filter with direct form 2 implementation extended to include bias and minimum and maximum state tracking. The coefficients are passed as an array of second-order sections (SOS matrix) and each section is passed to msp_biquad_df2_ext_q15 to filter the input.
biquad_cascade_df2_ext.svg
Example filter with three DF2 stages
LEA Support
This function is supported by LEA and requires data to be placed into shared LEA memory with 4-byte alignment.
Parameters
paramsPointer to the cascaded biquad direct form 2 parameter structure.
srcPointer to the source data to filter.
dstPointer to the destination vector.
Returns
Status of the operation.
Examples:
filter_ex5_biquad_cascade_df2_ext_q15.c.
msp_status msp_biquad_cascade_df2_q15 ( const msp_biquad_cascade_df2_q15_params params,
const _q15 src,
_q15 dst 
)

Cascaded direct form 2 biquad filter.

Details
Cascaded biquad filter with direct form 2 implementation. The coefficients are passed as an array of second-order sections (SOS matrix) and each section is passed to msp_biquad_df1_q15 to filter the input.
biquad_cascade_df2.svg
Example filter with three DF2 stages
LEA Support
This function is supported by LEA and requires data to be placed into shared LEA memory with 4-byte alignment.
Parameters
paramsPointer to the cascaded biquad direct form 2 parameter structure.
srcPointer to the source data to filter.
dstPointer to the destination vector.
Returns
Status of the operation.
Examples:
filter_ex4_biquad_cascade_df2_q15.c.
msp_status msp_biquad_df1_q15 ( const msp_biquad_df1_q15_params params,
const _q15 src,
_q15 dst 
)

Second-order direct form 1 biquad filter.

Details
Second-order biquad filter with direct form 1 implementation. Q15 multiplication is performed with a 32-bit accumulator to avoid intermediate overflow with saturation to Q15 when storing the result.
biquad_df1.svg
Biquad DF1 structure
Pseudo code
y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2]
LEA Support
This function is supported by LEA and requires data to be placed into shared LEA memory with 4-byte alignment.
Parameters
paramsPointer to the biquad direct form 1 parameter structure.
srcPointer to the source data to filter.
dstPointer to the destination vector.
Returns
Status of the operation.
msp_status msp_biquad_df2_ext_q15 ( const msp_biquad_df2_ext_q15_params params,
const _q15 src,
_q15 dst 
)

Second-order direct form 2 biquad filter extended with DC bias and minimum and maximum tracking.

Details
Second-order direct form 2 biquad filter extended to include bias and minimum and maximum state tracking. Q15 multiplication is performed with a 32-bit accumulator to avoid intermediate overflow with saturation to Q15 when storing the result. The maximum and minimum of the intermediate states are stored in the state structure.
biquad_df2_ext.svg
Biquad DF2 structure (extended)
Pseudo code
y[n] = b0 * w[n] + b1 * w[n-1] + b2 * w[n-2]
w[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2]
LEA Support
This function is supported by LEA and requires data to be placed into shared LEA memory with 4-byte alignment.
Parameters
paramsPointer to the biquad direct form 2 parameter structure.
srcPointer to the source data to filter.
dstPointer to the destination vector.
Returns
Status of the operation.
msp_status msp_biquad_df2_q15 ( const msp_biquad_df2_q15_params params,
const _q15 src,
_q15 dst 
)

Second-order direct form 2 biquad filter.

Details
Second-order direct form 2 biquad filter. Q15 multiplication is performed with a 32-bit accumulator to avoid intermediate overflow with saturation to Q15 when storing the result.
biquad_df2.svg
Biquad DF2 structure
Pseudo code
y[n] = b0 * w[n] + b1 * w[n-1] + b2 * w[n-2]
w[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2]
LEA Support
This function is supported by LEA and requires data to be placed into shared LEA memory with 4-byte alignment.
Parameters
paramsPointer to the biquad direct form 2 parameter structure.
srcPointer to the source data to filter.
dstPointer to the destination vector.
Returns
Status of the operation.