CMSIS DSP library
Dependents: KL25Z_FFT_Demo Hat_Board_v5_1 KL25Z_FFT_Demo_tony KL25Z_FFT_Demo_tony ... more
Fork of mbed-dsp by
arm_biquad_cascade_df1_init_f32.c
00001 /*----------------------------------------------------------------------------- 00002 * Copyright (C) 2010-2013 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 17. January 2013 00005 * $Revision: V1.4.1 00006 * 00007 * Project: CMSIS DSP Library 00008 * Title: arm_biquad_cascade_df1_init_f32.c 00009 * 00010 * Description: floating-point Biquad cascade DirectFormI(DF1) filter initialization function. 00011 * 00012 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions 00016 * are met: 00017 * - Redistributions of source code must retain the above copyright 00018 * notice, this list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright 00020 * notice, this list of conditions and the following disclaimer in 00021 * the documentation and/or other materials provided with the 00022 * distribution. 00023 * - Neither the name of ARM LIMITED nor the names of its contributors 00024 * may be used to endorse or promote products derived from this 00025 * software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00028 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00029 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00030 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00031 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00032 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00033 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00034 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00035 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00036 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00037 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00038 * POSSIBILITY OF SUCH DAMAGE. 00039 * ---------------------------------------------------------------------------*/ 00040 00041 #include "arm_math.h" 00042 00043 /** 00044 * @ingroup groupFilters 00045 */ 00046 00047 /** 00048 * @addtogroup BiquadCascadeDF1 00049 * @{ 00050 */ 00051 00052 /** 00053 * @details 00054 * @brief Initialization function for the floating-point Biquad cascade filter. 00055 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. 00056 * @param[in] numStages number of 2nd order stages in the filter. 00057 * @param[in] *pCoeffs points to the filter coefficients array. 00058 * @param[in] *pState points to the state array. 00059 * @return none 00060 * 00061 * 00062 * <b>Coefficient and State Ordering:</b> 00063 * 00064 * \par 00065 * The coefficients are stored in the array <code>pCoeffs</code> in the following order: 00066 * <pre> 00067 * {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} 00068 * </pre> 00069 * 00070 * \par 00071 * where <code>b1x</code> and <code>a1x</code> are the coefficients for the first stage, 00072 * <code>b2x</code> and <code>a2x</code> are the coefficients for the second stage, 00073 * and so on. The <code>pCoeffs</code> array contains a total of <code>5*numStages</code> values. 00074 * 00075 * \par 00076 * The <code>pState</code> is a pointer to state array. 00077 * Each Biquad stage has 4 state variables <code>x[n-1], x[n-2], y[n-1],</code> and <code>y[n-2]</code>. 00078 * The state variables are arranged in the <code>pState</code> array as: 00079 * <pre> 00080 * {x[n-1], x[n-2], y[n-1], y[n-2]} 00081 * </pre> 00082 * The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on. 00083 * The state array has a total length of <code>4*numStages</code> values. 00084 * The state variables are updated after each block of data is processed; the coefficients are untouched. 00085 * 00086 */ 00087 00088 void arm_biquad_cascade_df1_init_f32( 00089 arm_biquad_casd_df1_inst_f32 * S, 00090 uint8_t numStages, 00091 float32_t * pCoeffs, 00092 float32_t * pState) 00093 { 00094 /* Assign filter stages */ 00095 S->numStages = numStages; 00096 00097 /* Assign coefficient pointer */ 00098 S->pCoeffs = pCoeffs; 00099 00100 /* Clear state buffer and size is always 4 * numStages */ 00101 memset(pState, 0, (4u * (uint32_t) numStages) * sizeof(float32_t)); 00102 00103 /* Assign state pointer */ 00104 S->pState = pState; 00105 } 00106 00107 /** 00108 * @} end of BiquadCascadeDF1 group 00109 */
Generated on Tue Jul 12 2022 12:36:53 by 1.7.2