1 /* ----------------------------------------------------------------------
2 * Project: CMSIS DSP Library
3 * Title: arm_biquad_cascade_df2T_init_f64.c
4 * Description: Initialization function for floating-point transposed direct form II Biquad cascade filter
5 *
6 * $Date: 23 April 2021
7 * $Revision: V1.9.0
8 *
9 * Target Processor: Cortex-M and Cortex-A cores
10 * -------------------------------------------------------------------- */
11 /*
12 * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
13 *
14 * SPDX-License-Identifier: Apache-2.0
15 *
16 * Licensed under the Apache License, Version 2.0 (the License); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 */
28
29 #include "dsp/filtering_functions.h"
30
31 /**
32 @ingroup groupFilters
33 */
34
35 /**
36 @addtogroup BiquadCascadeDF2T
37 @{
38 */
39
40 /**
41 @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
42 @param[in,out] S points to an instance of the filter data structure
43 @param[in] numStages number of 2nd order stages in the filter
44 @param[in] pCoeffs points to the filter coefficients
45 @param[in] pState points to the state buffer
46
47 @par Coefficient and State Ordering
48 The coefficients are stored in the array <code>pCoeffs</code> in the following order:
49 <pre>
50 {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...}
51 </pre>
52 @par
53 where <code>b1x</code> and <code>a1x</code> are the coefficients for the first stage,
54 <code>b2x</code> and <code>a2x</code> are the coefficients for the second stage,
55 and so on. The <code>pCoeffs</code> array contains a total of <code>5*numStages</code> values.
56 @par
57 The <code>pState</code> is a pointer to state array.
58 Each Biquad stage has 2 state variables <code>d1,</code> and <code>d2</code>.
59 The 2 state variables for stage 1 are first, then the 2 state variables for stage 2, and so on.
60 The state array has a total length of <code>2*numStages</code> values.
61 The state variables are updated after each block of data is processed; the coefficients are untouched.
62 */
63
arm_biquad_cascade_df2T_init_f64(arm_biquad_cascade_df2T_instance_f64 * S,uint8_t numStages,const float64_t * pCoeffs,float64_t * pState)64 ARM_DSP_ATTRIBUTE void arm_biquad_cascade_df2T_init_f64(
65 arm_biquad_cascade_df2T_instance_f64 * S,
66 uint8_t numStages,
67 const float64_t * pCoeffs,
68 float64_t * pState)
69 {
70 /* Assign filter stages */
71 S->numStages = numStages;
72
73 /* Assign coefficient pointer */
74 S->pCoeffs = pCoeffs;
75
76 /* Clear state buffer and size is always 2 * numStages */
77 memset(pState, 0, (2U * (uint32_t) numStages) * sizeof(float64_t));
78
79 /* Assign state pointer */
80 S->pState = pState;
81 }
82
83 /**
84 @} end of BiquadCascadeDF2T group
85 */
86