1 /* ----------------------------------------------------------------------
2 * Copyright (C) 2010 ARM Limited. All rights reserved.
7 * Project: CMSIS DSP Library
8 * Title: arm_biquad_cascade_df1_32x64_init_q31.c
10 * Description: High precision Q31 Biquad cascade 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.7 2010/06/10
30 * Misra-C changes done
31 * -------------------------------------------------------------------- */
36 * @ingroup groupFilters
40 * @addtogroup BiquadCascadeDF1_32x64
47 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
48 * @param[in] numStages number of 2nd order stages in the filter.
49 * @param[in] *pCoeffs points to the filter coefficients.
50 * @param[in] *pState points to the state buffer.
51 * @param[in] postShift Shift to be applied after the accumulator. Varies according to the coefficients format.
54 * <b>Coefficient and State Ordering:</b>
57 * The coefficients are stored in the array <code>pCoeffs</code> in the following order:
59 * {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...}
61 * where <code>b1x</code> and <code>a1x</code> are the coefficients for the first stage,
62 * <code>b2x</code> and <code>a2x</code> are the coefficients for the second stage,
63 * and so on. The <code>pCoeffs</code> array contains a total of <code>5*numStages</code> values.
66 * The <code>pState</code> points to state variables array and size of each state variable is 1.63 format.
67 * Each Biquad stage has 4 state variables <code>x[n-1], x[n-2], y[n-1],</code> and <code>y[n-2]</code>.
68 * The state variables are arranged in the state array as:
70 * {x[n-1], x[n-2], y[n-1], y[n-2]}
72 * The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on.
73 * The state array has a total length of <code>4*numStages</code> values.
74 * The state variables are updated after each block of data is processed; the coefficients are untouched.
77 void arm_biquad_cas_df1_32x64_init_q31(
78 arm_biquad_cas_df1_32x64_ins_q31 * S,
84 /* Assign filter stages */
85 S->numStages = numStages;
87 /* Assign postShift to be applied to the output */
88 S->postShift = postShift;
90 /* Assign coefficient pointer */
93 /* Clear state buffer and size is always 4 * numStages */
94 memset(pState, 0, (4u * (uint32_t) numStages) * sizeof(q63_t));
96 /* Assign state pointer */
101 * @} end of BiquadCascadeDF1_32x64 group