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_32x64_init_q31.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_32x64_init_q31.c 00009 * 00010 * Description: High precision Q31 Biquad cascade 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_32x64 00049 * @{ 00050 */ 00051 00052 /** 00053 * @details 00054 * 00055 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. 00056 * @param[in] numStages number of 2nd order stages in the filter. 00057 * @param[in] *pCoeffs points to the filter coefficients. 00058 * @param[in] *pState points to the state buffer. 00059 * @param[in] postShift Shift to be applied after the accumulator. Varies according to the coefficients format. 00060 * @return none 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 * where <code>b1x</code> and <code>a1x</code> are the coefficients for the first stage, 00070 * <code>b2x</code> and <code>a2x</code> are the coefficients for the second stage, 00071 * and so on. The <code>pCoeffs</code> array contains a total of <code>5*numStages</code> values. 00072 * 00073 * \par 00074 * The <code>pState</code> points to state variables array and size of each state variable is 1.63 format. 00075 * Each Biquad stage has 4 state variables <code>x[n-1], x[n-2], y[n-1],</code> and <code>y[n-2]</code>. 00076 * The state variables are arranged in the state array as: 00077 * <pre> 00078 * {x[n-1], x[n-2], y[n-1], y[n-2]} 00079 * </pre> 00080 * The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on. 00081 * The state array has a total length of <code>4*numStages</code> values. 00082 * The state variables are updated after each block of data is processed; the coefficients are untouched. 00083 */ 00084 00085 void arm_biquad_cas_df1_32x64_init_q31 ( 00086 arm_biquad_cas_df1_32x64_ins_q31 * S, 00087 uint8_t numStages, 00088 q31_t * pCoeffs, 00089 q63_t * pState, 00090 uint8_t postShift) 00091 { 00092 /* Assign filter stages */ 00093 S->numStages = numStages; 00094 00095 /* Assign postShift to be applied to the output */ 00096 S->postShift = postShift; 00097 00098 /* Assign coefficient pointer */ 00099 S->pCoeffs = pCoeffs; 00100 00101 /* Clear state buffer and size is always 4 * numStages */ 00102 memset(pState, 0, (4u * (uint32_t) numStages) * sizeof(q63_t)); 00103 00104 /* Assign state pointer */ 00105 S->pState = pState; 00106 } 00107 00108 /** 00109 * @} end of BiquadCascadeDF1_32x64 group 00110 */
Generated on Tue Jul 12 2022 12:36:53 by 1.7.2