CMSIS DSP library

Dependents:   performance_timer Surfboard_ gps2rtty Capstone ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_biquad_cascade_stereo_df2T_init_f32.c Source File

arm_biquad_cascade_stereo_df2T_init_f32.c

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