1 /*-----------------------------------------------------------------------------
2 * Copyright (C) 2010 ARM Limited. All rights reserved.
7 * Project: CMSIS DSP Library
8 * Title: arm_biquad_cascade_df1_init_f32.c
10 * Description: floating-point Biquad cascade DirectFormI(DF1) filter initialization function.
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
14 * Version 1.0.10 2011/7/15
15 * Big Endian support added and Merged M0 and M3/M4 Source code.
17 * Version 1.0.3 2010/11/29
18 * Re-organized the CMSIS folders and updated documentation.
20 * Version 1.0.2 2010/11/11
21 * Documentation updated.
23 * Version 1.0.1 2010/10/05
24 * Production release and review comments incorporated.
26 * Version 1.0.0 2010/09/20
27 * Production release and review comments incorporated.
29 * Version 0.0.5 2010/04/26
30 * incorporated review comments and updated with latest CMSIS layer
32 * Version 0.0.3 2010/03/10
34 * ---------------------------------------------------------------------------*/
39 * @ingroup groupFilters
43 * @addtogroup BiquadCascadeDF1
49 * @brief Initialization function for the floating-point Biquad cascade filter.
50 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
51 * @param[in] numStages number of 2nd order stages in the filter.
52 * @param[in] *pCoeffs points to the filter coefficients array.
53 * @param[in] *pState points to the state array.
57 * <b>Coefficient and State Ordering:</b>
60 * The coefficients are stored in the array <code>pCoeffs</code> in the following order:
62 * {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...}
66 * where <code>b1x</code> and <code>a1x</code> are the coefficients for the first stage,
67 * <code>b2x</code> and <code>a2x</code> are the coefficients for the second stage,
68 * and so on. The <code>pCoeffs</code> array contains a total of <code>5*numStages</code> values.
71 * The <code>pState</code> is a pointer to state array.
72 * Each Biquad stage has 4 state variables <code>x[n-1], x[n-2], y[n-1],</code> and <code>y[n-2]</code>.
73 * The state variables are arranged in the <code>pState</code> array as:
75 * {x[n-1], x[n-2], y[n-1], y[n-2]}
77 * The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on.
78 * The state array has a total length of <code>4*numStages</code> values.
79 * The state variables are updated after each block of data is processed; the coefficients are untouched.
83 void arm_biquad_cascade_df1_init_f32(
84 arm_biquad_casd_df1_inst_f32 * S,
89 /* Assign filter stages */
90 S->numStages = numStages;
92 /* Assign coefficient pointer */
95 /* Clear state buffer and size is always 4 * numStages */
96 memset(pState, 0, (4u * (uint32_t) numStages) * sizeof(float32_t));
98 /* Assign state pointer */
103 * @} end of BiquadCascadeDF1 group