V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

Committer:
emh203
Date:
Mon Jul 28 15:03:15 2014 +0000
Revision:
0:3d9c67d97d6f
1st working commit.   Had to remove arm_bitreversal2.s     arm_cfft_f32.c and arm_rfft_fast_f32.c.    The .s will not assemble.      For now I removed these functions so we could at least have a library for the other functions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:3d9c67d97d6f 1 /* ----------------------------------------------------------------------
emh203 0:3d9c67d97d6f 2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
emh203 0:3d9c67d97d6f 3 *
emh203 0:3d9c67d97d6f 4 * $Date: 12. March 2014
emh203 0:3d9c67d97d6f 5 * $Revision: V1.4.3
emh203 0:3d9c67d97d6f 6 *
emh203 0:3d9c67d97d6f 7 * Project: CMSIS DSP Library
emh203 0:3d9c67d97d6f 8 * Title: arm_iir_lattice_q31.c
emh203 0:3d9c67d97d6f 9 *
emh203 0:3d9c67d97d6f 10 * Description: Q31 IIR lattice filter processing function.
emh203 0:3d9c67d97d6f 11 *
emh203 0:3d9c67d97d6f 12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
emh203 0:3d9c67d97d6f 13 *
emh203 0:3d9c67d97d6f 14 * Redistribution and use in source and binary forms, with or without
emh203 0:3d9c67d97d6f 15 * modification, are permitted provided that the following conditions
emh203 0:3d9c67d97d6f 16 * are met:
emh203 0:3d9c67d97d6f 17 * - Redistributions of source code must retain the above copyright
emh203 0:3d9c67d97d6f 18 * notice, this list of conditions and the following disclaimer.
emh203 0:3d9c67d97d6f 19 * - Redistributions in binary form must reproduce the above copyright
emh203 0:3d9c67d97d6f 20 * notice, this list of conditions and the following disclaimer in
emh203 0:3d9c67d97d6f 21 * the documentation and/or other materials provided with the
emh203 0:3d9c67d97d6f 22 * distribution.
emh203 0:3d9c67d97d6f 23 * - Neither the name of ARM LIMITED nor the names of its contributors
emh203 0:3d9c67d97d6f 24 * may be used to endorse or promote products derived from this
emh203 0:3d9c67d97d6f 25 * software without specific prior written permission.
emh203 0:3d9c67d97d6f 26 *
emh203 0:3d9c67d97d6f 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
emh203 0:3d9c67d97d6f 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
emh203 0:3d9c67d97d6f 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
emh203 0:3d9c67d97d6f 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
emh203 0:3d9c67d97d6f 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
emh203 0:3d9c67d97d6f 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
emh203 0:3d9c67d97d6f 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
emh203 0:3d9c67d97d6f 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emh203 0:3d9c67d97d6f 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
emh203 0:3d9c67d97d6f 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
emh203 0:3d9c67d97d6f 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
emh203 0:3d9c67d97d6f 38 * POSSIBILITY OF SUCH DAMAGE.
emh203 0:3d9c67d97d6f 39 * -------------------------------------------------------------------- */
emh203 0:3d9c67d97d6f 40
emh203 0:3d9c67d97d6f 41 #include "arm_math.h"
emh203 0:3d9c67d97d6f 42
emh203 0:3d9c67d97d6f 43 /**
emh203 0:3d9c67d97d6f 44 * @ingroup groupFilters
emh203 0:3d9c67d97d6f 45 */
emh203 0:3d9c67d97d6f 46
emh203 0:3d9c67d97d6f 47 /**
emh203 0:3d9c67d97d6f 48 * @addtogroup IIR_Lattice
emh203 0:3d9c67d97d6f 49 * @{
emh203 0:3d9c67d97d6f 50 */
emh203 0:3d9c67d97d6f 51
emh203 0:3d9c67d97d6f 52 /**
emh203 0:3d9c67d97d6f 53 * @brief Processing function for the Q31 IIR lattice filter.
emh203 0:3d9c67d97d6f 54 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
emh203 0:3d9c67d97d6f 55 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 56 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 57 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 58 * @return none.
emh203 0:3d9c67d97d6f 59 *
emh203 0:3d9c67d97d6f 60 * @details
emh203 0:3d9c67d97d6f 61 * <b>Scaling and Overflow Behavior:</b>
emh203 0:3d9c67d97d6f 62 * \par
emh203 0:3d9c67d97d6f 63 * The function is implemented using an internal 64-bit accumulator.
emh203 0:3d9c67d97d6f 64 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
emh203 0:3d9c67d97d6f 65 * Thus, if the accumulator result overflows it wraps around rather than clip.
emh203 0:3d9c67d97d6f 66 * In order to avoid overflows completely the input signal must be scaled down by 2*log2(numStages) bits.
emh203 0:3d9c67d97d6f 67 * After all multiply-accumulates are performed, the 2.62 accumulator is saturated to 1.32 format and then truncated to 1.31 format.
emh203 0:3d9c67d97d6f 68 */
emh203 0:3d9c67d97d6f 69
emh203 0:3d9c67d97d6f 70 void arm_iir_lattice_q31(
emh203 0:3d9c67d97d6f 71 const arm_iir_lattice_instance_q31 * S,
emh203 0:3d9c67d97d6f 72 q31_t * pSrc,
emh203 0:3d9c67d97d6f 73 q31_t * pDst,
emh203 0:3d9c67d97d6f 74 uint32_t blockSize)
emh203 0:3d9c67d97d6f 75 {
emh203 0:3d9c67d97d6f 76 q31_t fcurr, fnext = 0, gcurr = 0, gnext; /* Temporary variables for lattice stages */
emh203 0:3d9c67d97d6f 77 q63_t acc; /* Accumlator */
emh203 0:3d9c67d97d6f 78 uint32_t blkCnt, tapCnt; /* Temporary variables for counts */
emh203 0:3d9c67d97d6f 79 q31_t *px1, *px2, *pk, *pv; /* Temporary pointers for state and coef */
emh203 0:3d9c67d97d6f 80 uint32_t numStages = S->numStages; /* number of stages */
emh203 0:3d9c67d97d6f 81 q31_t *pState; /* State pointer */
emh203 0:3d9c67d97d6f 82 q31_t *pStateCurnt; /* State current pointer */
emh203 0:3d9c67d97d6f 83
emh203 0:3d9c67d97d6f 84 blkCnt = blockSize;
emh203 0:3d9c67d97d6f 85
emh203 0:3d9c67d97d6f 86 pState = &S->pState[0];
emh203 0:3d9c67d97d6f 87
emh203 0:3d9c67d97d6f 88
emh203 0:3d9c67d97d6f 89 #ifndef ARM_MATH_CM0_FAMILY
emh203 0:3d9c67d97d6f 90
emh203 0:3d9c67d97d6f 91 /* Run the below code for Cortex-M4 and Cortex-M3 */
emh203 0:3d9c67d97d6f 92
emh203 0:3d9c67d97d6f 93 /* Sample processing */
emh203 0:3d9c67d97d6f 94 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 95 {
emh203 0:3d9c67d97d6f 96 /* Read Sample from input buffer */
emh203 0:3d9c67d97d6f 97 /* fN(n) = x(n) */
emh203 0:3d9c67d97d6f 98 fcurr = *pSrc++;
emh203 0:3d9c67d97d6f 99
emh203 0:3d9c67d97d6f 100 /* Initialize state read pointer */
emh203 0:3d9c67d97d6f 101 px1 = pState;
emh203 0:3d9c67d97d6f 102 /* Initialize state write pointer */
emh203 0:3d9c67d97d6f 103 px2 = pState;
emh203 0:3d9c67d97d6f 104 /* Set accumulator to zero */
emh203 0:3d9c67d97d6f 105 acc = 0;
emh203 0:3d9c67d97d6f 106 /* Initialize Ladder coeff pointer */
emh203 0:3d9c67d97d6f 107 pv = &S->pvCoeffs[0];
emh203 0:3d9c67d97d6f 108 /* Initialize Reflection coeff pointer */
emh203 0:3d9c67d97d6f 109 pk = &S->pkCoeffs[0];
emh203 0:3d9c67d97d6f 110
emh203 0:3d9c67d97d6f 111
emh203 0:3d9c67d97d6f 112 /* Process sample for first tap */
emh203 0:3d9c67d97d6f 113 gcurr = *px1++;
emh203 0:3d9c67d97d6f 114 /* fN-1(n) = fN(n) - kN * gN-1(n-1) */
emh203 0:3d9c67d97d6f 115 fnext = __QSUB(fcurr, (q31_t) (((q63_t) gcurr * (*pk)) >> 31));
emh203 0:3d9c67d97d6f 116 /* gN(n) = kN * fN-1(n) + gN-1(n-1) */
emh203 0:3d9c67d97d6f 117 gnext = __QADD(gcurr, (q31_t) (((q63_t) fnext * (*pk++)) >> 31));
emh203 0:3d9c67d97d6f 118 /* write gN-1(n-1) into state for next sample processing */
emh203 0:3d9c67d97d6f 119 *px2++ = gnext;
emh203 0:3d9c67d97d6f 120 /* y(n) += gN(n) * vN */
emh203 0:3d9c67d97d6f 121 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 122
emh203 0:3d9c67d97d6f 123 /* Update f values for next coefficient processing */
emh203 0:3d9c67d97d6f 124 fcurr = fnext;
emh203 0:3d9c67d97d6f 125
emh203 0:3d9c67d97d6f 126 /* Loop unrolling. Process 4 taps at a time. */
emh203 0:3d9c67d97d6f 127 tapCnt = (numStages - 1u) >> 2;
emh203 0:3d9c67d97d6f 128
emh203 0:3d9c67d97d6f 129 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 130 {
emh203 0:3d9c67d97d6f 131
emh203 0:3d9c67d97d6f 132 /* Process sample for 2nd, 6th .. taps */
emh203 0:3d9c67d97d6f 133 /* Read gN-2(n-1) from state buffer */
emh203 0:3d9c67d97d6f 134 gcurr = *px1++;
emh203 0:3d9c67d97d6f 135 /* fN-2(n) = fN-1(n) - kN-1 * gN-2(n-1) */
emh203 0:3d9c67d97d6f 136 fnext = __QSUB(fcurr, (q31_t) (((q63_t) gcurr * (*pk)) >> 31));
emh203 0:3d9c67d97d6f 137 /* gN-1(n) = kN-1 * fN-2(n) + gN-2(n-1) */
emh203 0:3d9c67d97d6f 138 gnext = __QADD(gcurr, (q31_t) (((q63_t) fnext * (*pk++)) >> 31));
emh203 0:3d9c67d97d6f 139 /* y(n) += gN-1(n) * vN-1 */
emh203 0:3d9c67d97d6f 140 /* process for gN-5(n) * vN-5, gN-9(n) * vN-9 ... */
emh203 0:3d9c67d97d6f 141 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 142 /* write gN-1(n) into state for next sample processing */
emh203 0:3d9c67d97d6f 143 *px2++ = gnext;
emh203 0:3d9c67d97d6f 144
emh203 0:3d9c67d97d6f 145 /* Process sample for 3nd, 7th ...taps */
emh203 0:3d9c67d97d6f 146 /* Read gN-3(n-1) from state buffer */
emh203 0:3d9c67d97d6f 147 gcurr = *px1++;
emh203 0:3d9c67d97d6f 148 /* Process sample for 3rd, 7th .. taps */
emh203 0:3d9c67d97d6f 149 /* fN-3(n) = fN-2(n) - kN-2 * gN-3(n-1) */
emh203 0:3d9c67d97d6f 150 fcurr = __QSUB(fnext, (q31_t) (((q63_t) gcurr * (*pk)) >> 31));
emh203 0:3d9c67d97d6f 151 /* gN-2(n) = kN-2 * fN-3(n) + gN-3(n-1) */
emh203 0:3d9c67d97d6f 152 gnext = __QADD(gcurr, (q31_t) (((q63_t) fcurr * (*pk++)) >> 31));
emh203 0:3d9c67d97d6f 153 /* y(n) += gN-2(n) * vN-2 */
emh203 0:3d9c67d97d6f 154 /* process for gN-6(n) * vN-6, gN-10(n) * vN-10 ... */
emh203 0:3d9c67d97d6f 155 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 156 /* write gN-2(n) into state for next sample processing */
emh203 0:3d9c67d97d6f 157 *px2++ = gnext;
emh203 0:3d9c67d97d6f 158
emh203 0:3d9c67d97d6f 159
emh203 0:3d9c67d97d6f 160 /* Process sample for 4th, 8th ...taps */
emh203 0:3d9c67d97d6f 161 /* Read gN-4(n-1) from state buffer */
emh203 0:3d9c67d97d6f 162 gcurr = *px1++;
emh203 0:3d9c67d97d6f 163 /* Process sample for 4th, 8th .. taps */
emh203 0:3d9c67d97d6f 164 /* fN-4(n) = fN-3(n) - kN-3 * gN-4(n-1) */
emh203 0:3d9c67d97d6f 165 fnext = __QSUB(fcurr, (q31_t) (((q63_t) gcurr * (*pk)) >> 31));
emh203 0:3d9c67d97d6f 166 /* gN-3(n) = kN-3 * fN-4(n) + gN-4(n-1) */
emh203 0:3d9c67d97d6f 167 gnext = __QADD(gcurr, (q31_t) (((q63_t) fnext * (*pk++)) >> 31));
emh203 0:3d9c67d97d6f 168 /* y(n) += gN-3(n) * vN-3 */
emh203 0:3d9c67d97d6f 169 /* process for gN-7(n) * vN-7, gN-11(n) * vN-11 ... */
emh203 0:3d9c67d97d6f 170 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 171 /* write gN-3(n) into state for next sample processing */
emh203 0:3d9c67d97d6f 172 *px2++ = gnext;
emh203 0:3d9c67d97d6f 173
emh203 0:3d9c67d97d6f 174
emh203 0:3d9c67d97d6f 175 /* Process sample for 5th, 9th ...taps */
emh203 0:3d9c67d97d6f 176 /* Read gN-5(n-1) from state buffer */
emh203 0:3d9c67d97d6f 177 gcurr = *px1++;
emh203 0:3d9c67d97d6f 178 /* Process sample for 5th, 9th .. taps */
emh203 0:3d9c67d97d6f 179 /* fN-5(n) = fN-4(n) - kN-4 * gN-1(n-1) */
emh203 0:3d9c67d97d6f 180 fcurr = __QSUB(fnext, (q31_t) (((q63_t) gcurr * (*pk)) >> 31));
emh203 0:3d9c67d97d6f 181 /* gN-4(n) = kN-4 * fN-5(n) + gN-5(n-1) */
emh203 0:3d9c67d97d6f 182 gnext = __QADD(gcurr, (q31_t) (((q63_t) fcurr * (*pk++)) >> 31));
emh203 0:3d9c67d97d6f 183 /* y(n) += gN-4(n) * vN-4 */
emh203 0:3d9c67d97d6f 184 /* process for gN-8(n) * vN-8, gN-12(n) * vN-12 ... */
emh203 0:3d9c67d97d6f 185 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 186 /* write gN-4(n) into state for next sample processing */
emh203 0:3d9c67d97d6f 187 *px2++ = gnext;
emh203 0:3d9c67d97d6f 188
emh203 0:3d9c67d97d6f 189 tapCnt--;
emh203 0:3d9c67d97d6f 190
emh203 0:3d9c67d97d6f 191 }
emh203 0:3d9c67d97d6f 192
emh203 0:3d9c67d97d6f 193 fnext = fcurr;
emh203 0:3d9c67d97d6f 194
emh203 0:3d9c67d97d6f 195 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
emh203 0:3d9c67d97d6f 196 tapCnt = (numStages - 1u) % 0x4u;
emh203 0:3d9c67d97d6f 197
emh203 0:3d9c67d97d6f 198 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 199 {
emh203 0:3d9c67d97d6f 200 gcurr = *px1++;
emh203 0:3d9c67d97d6f 201 /* Process sample for last taps */
emh203 0:3d9c67d97d6f 202 fnext = __QSUB(fcurr, (q31_t) (((q63_t) gcurr * (*pk)) >> 31));
emh203 0:3d9c67d97d6f 203 gnext = __QADD(gcurr, (q31_t) (((q63_t) fnext * (*pk++)) >> 31));
emh203 0:3d9c67d97d6f 204 /* Output samples for last taps */
emh203 0:3d9c67d97d6f 205 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 206 *px2++ = gnext;
emh203 0:3d9c67d97d6f 207 fcurr = fnext;
emh203 0:3d9c67d97d6f 208
emh203 0:3d9c67d97d6f 209 tapCnt--;
emh203 0:3d9c67d97d6f 210
emh203 0:3d9c67d97d6f 211 }
emh203 0:3d9c67d97d6f 212
emh203 0:3d9c67d97d6f 213 /* y(n) += g0(n) * v0 */
emh203 0:3d9c67d97d6f 214 acc += (q63_t) fnext *(
emh203 0:3d9c67d97d6f 215 *pv++);
emh203 0:3d9c67d97d6f 216
emh203 0:3d9c67d97d6f 217 *px2++ = fnext;
emh203 0:3d9c67d97d6f 218
emh203 0:3d9c67d97d6f 219 /* write out into pDst */
emh203 0:3d9c67d97d6f 220 *pDst++ = (q31_t) (acc >> 31u);
emh203 0:3d9c67d97d6f 221
emh203 0:3d9c67d97d6f 222 /* Advance the state pointer by 4 to process the next group of 4 samples */
emh203 0:3d9c67d97d6f 223 pState = pState + 1u;
emh203 0:3d9c67d97d6f 224 blkCnt--;
emh203 0:3d9c67d97d6f 225
emh203 0:3d9c67d97d6f 226 }
emh203 0:3d9c67d97d6f 227
emh203 0:3d9c67d97d6f 228 /* Processing is complete. Now copy last S->numStages samples to start of the buffer
emh203 0:3d9c67d97d6f 229 for the preperation of next frame process */
emh203 0:3d9c67d97d6f 230
emh203 0:3d9c67d97d6f 231 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 232 pStateCurnt = &S->pState[0];
emh203 0:3d9c67d97d6f 233 pState = &S->pState[blockSize];
emh203 0:3d9c67d97d6f 234
emh203 0:3d9c67d97d6f 235 tapCnt = numStages >> 2u;
emh203 0:3d9c67d97d6f 236
emh203 0:3d9c67d97d6f 237 /* copy data */
emh203 0:3d9c67d97d6f 238 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 239 {
emh203 0:3d9c67d97d6f 240 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 241 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 242 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 243 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 244
emh203 0:3d9c67d97d6f 245 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 246 tapCnt--;
emh203 0:3d9c67d97d6f 247
emh203 0:3d9c67d97d6f 248 }
emh203 0:3d9c67d97d6f 249
emh203 0:3d9c67d97d6f 250 /* Calculate remaining number of copies */
emh203 0:3d9c67d97d6f 251 tapCnt = (numStages) % 0x4u;
emh203 0:3d9c67d97d6f 252
emh203 0:3d9c67d97d6f 253 /* Copy the remaining q31_t data */
emh203 0:3d9c67d97d6f 254 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 255 {
emh203 0:3d9c67d97d6f 256 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 257
emh203 0:3d9c67d97d6f 258 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 259 tapCnt--;
emh203 0:3d9c67d97d6f 260 };
emh203 0:3d9c67d97d6f 261
emh203 0:3d9c67d97d6f 262 #else
emh203 0:3d9c67d97d6f 263
emh203 0:3d9c67d97d6f 264 /* Run the below code for Cortex-M0 */
emh203 0:3d9c67d97d6f 265 /* Sample processing */
emh203 0:3d9c67d97d6f 266 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 267 {
emh203 0:3d9c67d97d6f 268 /* Read Sample from input buffer */
emh203 0:3d9c67d97d6f 269 /* fN(n) = x(n) */
emh203 0:3d9c67d97d6f 270 fcurr = *pSrc++;
emh203 0:3d9c67d97d6f 271
emh203 0:3d9c67d97d6f 272 /* Initialize state read pointer */
emh203 0:3d9c67d97d6f 273 px1 = pState;
emh203 0:3d9c67d97d6f 274 /* Initialize state write pointer */
emh203 0:3d9c67d97d6f 275 px2 = pState;
emh203 0:3d9c67d97d6f 276 /* Set accumulator to zero */
emh203 0:3d9c67d97d6f 277 acc = 0;
emh203 0:3d9c67d97d6f 278 /* Initialize Ladder coeff pointer */
emh203 0:3d9c67d97d6f 279 pv = &S->pvCoeffs[0];
emh203 0:3d9c67d97d6f 280 /* Initialize Reflection coeff pointer */
emh203 0:3d9c67d97d6f 281 pk = &S->pkCoeffs[0];
emh203 0:3d9c67d97d6f 282
emh203 0:3d9c67d97d6f 283 tapCnt = numStages;
emh203 0:3d9c67d97d6f 284
emh203 0:3d9c67d97d6f 285 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 286 {
emh203 0:3d9c67d97d6f 287 gcurr = *px1++;
emh203 0:3d9c67d97d6f 288 /* Process sample */
emh203 0:3d9c67d97d6f 289 /* fN-1(n) = fN(n) - kN * gN-1(n-1) */
emh203 0:3d9c67d97d6f 290 fnext =
emh203 0:3d9c67d97d6f 291 clip_q63_to_q31(((q63_t) fcurr -
emh203 0:3d9c67d97d6f 292 ((q31_t) (((q63_t) gcurr * (*pk)) >> 31))));
emh203 0:3d9c67d97d6f 293 /* gN(n) = kN * fN-1(n) + gN-1(n-1) */
emh203 0:3d9c67d97d6f 294 gnext =
emh203 0:3d9c67d97d6f 295 clip_q63_to_q31(((q63_t) gcurr +
emh203 0:3d9c67d97d6f 296 ((q31_t) (((q63_t) fnext * (*pk++)) >> 31))));
emh203 0:3d9c67d97d6f 297 /* Output samples */
emh203 0:3d9c67d97d6f 298 /* y(n) += gN(n) * vN */
emh203 0:3d9c67d97d6f 299 acc += ((q63_t) gnext * *pv++);
emh203 0:3d9c67d97d6f 300 /* write gN-1(n-1) into state for next sample processing */
emh203 0:3d9c67d97d6f 301 *px2++ = gnext;
emh203 0:3d9c67d97d6f 302 /* Update f values for next coefficient processing */
emh203 0:3d9c67d97d6f 303 fcurr = fnext;
emh203 0:3d9c67d97d6f 304
emh203 0:3d9c67d97d6f 305 tapCnt--;
emh203 0:3d9c67d97d6f 306 }
emh203 0:3d9c67d97d6f 307
emh203 0:3d9c67d97d6f 308 /* y(n) += g0(n) * v0 */
emh203 0:3d9c67d97d6f 309 acc += (q63_t) fnext *(
emh203 0:3d9c67d97d6f 310 *pv++);
emh203 0:3d9c67d97d6f 311
emh203 0:3d9c67d97d6f 312 *px2++ = fnext;
emh203 0:3d9c67d97d6f 313
emh203 0:3d9c67d97d6f 314 /* write out into pDst */
emh203 0:3d9c67d97d6f 315 *pDst++ = (q31_t) (acc >> 31u);
emh203 0:3d9c67d97d6f 316
emh203 0:3d9c67d97d6f 317 /* Advance the state pointer by 1 to process the next group of samples */
emh203 0:3d9c67d97d6f 318 pState = pState + 1u;
emh203 0:3d9c67d97d6f 319 blkCnt--;
emh203 0:3d9c67d97d6f 320
emh203 0:3d9c67d97d6f 321 }
emh203 0:3d9c67d97d6f 322
emh203 0:3d9c67d97d6f 323 /* Processing is complete. Now copy last S->numStages samples to start of the buffer
emh203 0:3d9c67d97d6f 324 for the preperation of next frame process */
emh203 0:3d9c67d97d6f 325
emh203 0:3d9c67d97d6f 326 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 327 pStateCurnt = &S->pState[0];
emh203 0:3d9c67d97d6f 328 pState = &S->pState[blockSize];
emh203 0:3d9c67d97d6f 329
emh203 0:3d9c67d97d6f 330 tapCnt = numStages;
emh203 0:3d9c67d97d6f 331
emh203 0:3d9c67d97d6f 332 /* Copy the remaining q31_t data */
emh203 0:3d9c67d97d6f 333 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 334 {
emh203 0:3d9c67d97d6f 335 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 336
emh203 0:3d9c67d97d6f 337 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 338 tapCnt--;
emh203 0:3d9c67d97d6f 339 }
emh203 0:3d9c67d97d6f 340
emh203 0:3d9c67d97d6f 341 #endif /* #ifndef ARM_MATH_CM0_FAMILY */
emh203 0:3d9c67d97d6f 342
emh203 0:3d9c67d97d6f 343 }
emh203 0:3d9c67d97d6f 344
emh203 0:3d9c67d97d6f 345
emh203 0:3d9c67d97d6f 346
emh203 0:3d9c67d97d6f 347
emh203 0:3d9c67d97d6f 348 /**
emh203 0:3d9c67d97d6f 349 * @} end of IIR_Lattice group
emh203 0:3d9c67d97d6f 350 */