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_fir_decimate_q15.c
emh203 0:3d9c67d97d6f 9 *
emh203 0:3d9c67d97d6f 10 * Description: Q15 FIR Decimator.
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 FIR_decimate
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 Q15 FIR decimator.
emh203 0:3d9c67d97d6f 54 * @param[in] *S points to an instance of the Q15 FIR decimator 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 location where the output result is written.
emh203 0:3d9c67d97d6f 57 * @param[in] blockSize number of input samples to process per call.
emh203 0:3d9c67d97d6f 58 * @return none.
emh203 0:3d9c67d97d6f 59 *
emh203 0:3d9c67d97d6f 60 * <b>Scaling and Overflow Behavior:</b>
emh203 0:3d9c67d97d6f 61 * \par
emh203 0:3d9c67d97d6f 62 * The function is implemented using a 64-bit internal accumulator.
emh203 0:3d9c67d97d6f 63 * Both coefficients and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
emh203 0:3d9c67d97d6f 64 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
emh203 0:3d9c67d97d6f 65 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
emh203 0:3d9c67d97d6f 66 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
emh203 0:3d9c67d97d6f 67 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
emh203 0:3d9c67d97d6f 68 *
emh203 0:3d9c67d97d6f 69 * \par
emh203 0:3d9c67d97d6f 70 * Refer to the function <code>arm_fir_decimate_fast_q15()</code> for a faster but less precise implementation of this function for Cortex-M3 and Cortex-M4.
emh203 0:3d9c67d97d6f 71 */
emh203 0:3d9c67d97d6f 72
emh203 0:3d9c67d97d6f 73 #ifndef ARM_MATH_CM0_FAMILY
emh203 0:3d9c67d97d6f 74
emh203 0:3d9c67d97d6f 75 #ifndef UNALIGNED_SUPPORT_DISABLE
emh203 0:3d9c67d97d6f 76
emh203 0:3d9c67d97d6f 77 void arm_fir_decimate_q15(
emh203 0:3d9c67d97d6f 78 const arm_fir_decimate_instance_q15 * S,
emh203 0:3d9c67d97d6f 79 q15_t * pSrc,
emh203 0:3d9c67d97d6f 80 q15_t * pDst,
emh203 0:3d9c67d97d6f 81 uint32_t blockSize)
emh203 0:3d9c67d97d6f 82 {
emh203 0:3d9c67d97d6f 83 q15_t *pState = S->pState; /* State pointer */
emh203 0:3d9c67d97d6f 84 q15_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
emh203 0:3d9c67d97d6f 85 q15_t *pStateCurnt; /* Points to the current sample of the state */
emh203 0:3d9c67d97d6f 86 q15_t *px; /* Temporary pointer for state buffer */
emh203 0:3d9c67d97d6f 87 q15_t *pb; /* Temporary pointer coefficient buffer */
emh203 0:3d9c67d97d6f 88 q31_t x0, x1, c0, c1; /* Temporary variables to hold state and coefficient values */
emh203 0:3d9c67d97d6f 89 q63_t sum0; /* Accumulators */
emh203 0:3d9c67d97d6f 90 q63_t acc0, acc1;
emh203 0:3d9c67d97d6f 91 q15_t *px0, *px1;
emh203 0:3d9c67d97d6f 92 uint32_t blkCntN3;
emh203 0:3d9c67d97d6f 93 uint32_t numTaps = S->numTaps; /* Number of taps */
emh203 0:3d9c67d97d6f 94 uint32_t i, blkCnt, tapCnt, outBlockSize = blockSize / S->M; /* Loop counters */
emh203 0:3d9c67d97d6f 95
emh203 0:3d9c67d97d6f 96
emh203 0:3d9c67d97d6f 97 /* S->pState buffer contains previous frame (numTaps - 1) samples */
emh203 0:3d9c67d97d6f 98 /* pStateCurnt points to the location where the new input data should be written */
emh203 0:3d9c67d97d6f 99 pStateCurnt = S->pState + (numTaps - 1u);
emh203 0:3d9c67d97d6f 100
emh203 0:3d9c67d97d6f 101
emh203 0:3d9c67d97d6f 102 /* Total number of output samples to be computed */
emh203 0:3d9c67d97d6f 103 blkCnt = outBlockSize / 2;
emh203 0:3d9c67d97d6f 104 blkCntN3 = outBlockSize - (2 * blkCnt);
emh203 0:3d9c67d97d6f 105
emh203 0:3d9c67d97d6f 106
emh203 0:3d9c67d97d6f 107 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 108 {
emh203 0:3d9c67d97d6f 109 /* Copy decimation factor number of new input samples into the state buffer */
emh203 0:3d9c67d97d6f 110 i = 2 * S->M;
emh203 0:3d9c67d97d6f 111
emh203 0:3d9c67d97d6f 112 do
emh203 0:3d9c67d97d6f 113 {
emh203 0:3d9c67d97d6f 114 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 115
emh203 0:3d9c67d97d6f 116 } while(--i);
emh203 0:3d9c67d97d6f 117
emh203 0:3d9c67d97d6f 118 /* Set accumulator to zero */
emh203 0:3d9c67d97d6f 119 acc0 = 0;
emh203 0:3d9c67d97d6f 120 acc1 = 0;
emh203 0:3d9c67d97d6f 121
emh203 0:3d9c67d97d6f 122 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 123 px0 = pState;
emh203 0:3d9c67d97d6f 124
emh203 0:3d9c67d97d6f 125 px1 = pState + S->M;
emh203 0:3d9c67d97d6f 126
emh203 0:3d9c67d97d6f 127
emh203 0:3d9c67d97d6f 128 /* Initialize coeff pointer */
emh203 0:3d9c67d97d6f 129 pb = pCoeffs;
emh203 0:3d9c67d97d6f 130
emh203 0:3d9c67d97d6f 131 /* Loop unrolling. Process 4 taps at a time. */
emh203 0:3d9c67d97d6f 132 tapCnt = numTaps >> 2;
emh203 0:3d9c67d97d6f 133
emh203 0:3d9c67d97d6f 134 /* Loop over the number of taps. Unroll by a factor of 4.
emh203 0:3d9c67d97d6f 135 ** Repeat until we've computed numTaps-4 coefficients. */
emh203 0:3d9c67d97d6f 136 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 137 {
emh203 0:3d9c67d97d6f 138 /* Read the Read b[numTaps-1] and b[numTaps-2] coefficients */
emh203 0:3d9c67d97d6f 139 c0 = *__SIMD32(pb)++;
emh203 0:3d9c67d97d6f 140
emh203 0:3d9c67d97d6f 141 /* Read x[n-numTaps-1] and x[n-numTaps-2]sample */
emh203 0:3d9c67d97d6f 142 x0 = *__SIMD32(px0)++;
emh203 0:3d9c67d97d6f 143
emh203 0:3d9c67d97d6f 144 x1 = *__SIMD32(px1)++;
emh203 0:3d9c67d97d6f 145
emh203 0:3d9c67d97d6f 146 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 147 acc0 = __SMLALD(x0, c0, acc0);
emh203 0:3d9c67d97d6f 148
emh203 0:3d9c67d97d6f 149 acc1 = __SMLALD(x1, c0, acc1);
emh203 0:3d9c67d97d6f 150
emh203 0:3d9c67d97d6f 151 /* Read the b[numTaps-3] and b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 152 c0 = *__SIMD32(pb)++;
emh203 0:3d9c67d97d6f 153
emh203 0:3d9c67d97d6f 154 /* Read x[n-numTaps-2] and x[n-numTaps-3] sample */
emh203 0:3d9c67d97d6f 155 x0 = *__SIMD32(px0)++;
emh203 0:3d9c67d97d6f 156
emh203 0:3d9c67d97d6f 157 x1 = *__SIMD32(px1)++;
emh203 0:3d9c67d97d6f 158
emh203 0:3d9c67d97d6f 159 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 160 acc0 = __SMLALD(x0, c0, acc0);
emh203 0:3d9c67d97d6f 161
emh203 0:3d9c67d97d6f 162 acc1 = __SMLALD(x1, c0, acc1);
emh203 0:3d9c67d97d6f 163
emh203 0:3d9c67d97d6f 164 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 165 tapCnt--;
emh203 0:3d9c67d97d6f 166 }
emh203 0:3d9c67d97d6f 167
emh203 0:3d9c67d97d6f 168 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
emh203 0:3d9c67d97d6f 169 tapCnt = numTaps % 0x4u;
emh203 0:3d9c67d97d6f 170
emh203 0:3d9c67d97d6f 171 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 172 {
emh203 0:3d9c67d97d6f 173 /* Read coefficients */
emh203 0:3d9c67d97d6f 174 c0 = *pb++;
emh203 0:3d9c67d97d6f 175
emh203 0:3d9c67d97d6f 176 /* Fetch 1 state variable */
emh203 0:3d9c67d97d6f 177 x0 = *px0++;
emh203 0:3d9c67d97d6f 178
emh203 0:3d9c67d97d6f 179 x1 = *px1++;
emh203 0:3d9c67d97d6f 180
emh203 0:3d9c67d97d6f 181 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 182 acc0 = __SMLALD(x0, c0, acc0);
emh203 0:3d9c67d97d6f 183 acc1 = __SMLALD(x1, c0, acc1);
emh203 0:3d9c67d97d6f 184
emh203 0:3d9c67d97d6f 185 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 186 tapCnt--;
emh203 0:3d9c67d97d6f 187 }
emh203 0:3d9c67d97d6f 188
emh203 0:3d9c67d97d6f 189 /* Advance the state pointer by the decimation factor
emh203 0:3d9c67d97d6f 190 * to process the next group of decimation factor number samples */
emh203 0:3d9c67d97d6f 191 pState = pState + S->M * 2;
emh203 0:3d9c67d97d6f 192
emh203 0:3d9c67d97d6f 193 /* Store filter output, smlad returns the values in 2.14 format */
emh203 0:3d9c67d97d6f 194 /* so downsacle by 15 to get output in 1.15 */
emh203 0:3d9c67d97d6f 195 *pDst++ = (q15_t) (__SSAT((acc0 >> 15), 16));
emh203 0:3d9c67d97d6f 196 *pDst++ = (q15_t) (__SSAT((acc1 >> 15), 16));
emh203 0:3d9c67d97d6f 197
emh203 0:3d9c67d97d6f 198 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 199 blkCnt--;
emh203 0:3d9c67d97d6f 200 }
emh203 0:3d9c67d97d6f 201
emh203 0:3d9c67d97d6f 202
emh203 0:3d9c67d97d6f 203
emh203 0:3d9c67d97d6f 204 while(blkCntN3 > 0u)
emh203 0:3d9c67d97d6f 205 {
emh203 0:3d9c67d97d6f 206 /* Copy decimation factor number of new input samples into the state buffer */
emh203 0:3d9c67d97d6f 207 i = S->M;
emh203 0:3d9c67d97d6f 208
emh203 0:3d9c67d97d6f 209 do
emh203 0:3d9c67d97d6f 210 {
emh203 0:3d9c67d97d6f 211 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 212
emh203 0:3d9c67d97d6f 213 } while(--i);
emh203 0:3d9c67d97d6f 214
emh203 0:3d9c67d97d6f 215 /*Set sum to zero */
emh203 0:3d9c67d97d6f 216 sum0 = 0;
emh203 0:3d9c67d97d6f 217
emh203 0:3d9c67d97d6f 218 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 219 px = pState;
emh203 0:3d9c67d97d6f 220
emh203 0:3d9c67d97d6f 221 /* Initialize coeff pointer */
emh203 0:3d9c67d97d6f 222 pb = pCoeffs;
emh203 0:3d9c67d97d6f 223
emh203 0:3d9c67d97d6f 224 /* Loop unrolling. Process 4 taps at a time. */
emh203 0:3d9c67d97d6f 225 tapCnt = numTaps >> 2;
emh203 0:3d9c67d97d6f 226
emh203 0:3d9c67d97d6f 227 /* Loop over the number of taps. Unroll by a factor of 4.
emh203 0:3d9c67d97d6f 228 ** Repeat until we've computed numTaps-4 coefficients. */
emh203 0:3d9c67d97d6f 229 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 230 {
emh203 0:3d9c67d97d6f 231 /* Read the Read b[numTaps-1] and b[numTaps-2] coefficients */
emh203 0:3d9c67d97d6f 232 c0 = *__SIMD32(pb)++;
emh203 0:3d9c67d97d6f 233
emh203 0:3d9c67d97d6f 234 /* Read x[n-numTaps-1] and x[n-numTaps-2]sample */
emh203 0:3d9c67d97d6f 235 x0 = *__SIMD32(px)++;
emh203 0:3d9c67d97d6f 236
emh203 0:3d9c67d97d6f 237 /* Read the b[numTaps-3] and b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 238 c1 = *__SIMD32(pb)++;
emh203 0:3d9c67d97d6f 239
emh203 0:3d9c67d97d6f 240 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 241 sum0 = __SMLALD(x0, c0, sum0);
emh203 0:3d9c67d97d6f 242
emh203 0:3d9c67d97d6f 243 /* Read x[n-numTaps-2] and x[n-numTaps-3] sample */
emh203 0:3d9c67d97d6f 244 x0 = *__SIMD32(px)++;
emh203 0:3d9c67d97d6f 245
emh203 0:3d9c67d97d6f 246 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 247 sum0 = __SMLALD(x0, c1, sum0);
emh203 0:3d9c67d97d6f 248
emh203 0:3d9c67d97d6f 249 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 250 tapCnt--;
emh203 0:3d9c67d97d6f 251 }
emh203 0:3d9c67d97d6f 252
emh203 0:3d9c67d97d6f 253 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
emh203 0:3d9c67d97d6f 254 tapCnt = numTaps % 0x4u;
emh203 0:3d9c67d97d6f 255
emh203 0:3d9c67d97d6f 256 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 257 {
emh203 0:3d9c67d97d6f 258 /* Read coefficients */
emh203 0:3d9c67d97d6f 259 c0 = *pb++;
emh203 0:3d9c67d97d6f 260
emh203 0:3d9c67d97d6f 261 /* Fetch 1 state variable */
emh203 0:3d9c67d97d6f 262 x0 = *px++;
emh203 0:3d9c67d97d6f 263
emh203 0:3d9c67d97d6f 264 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 265 sum0 = __SMLALD(x0, c0, sum0);
emh203 0:3d9c67d97d6f 266
emh203 0:3d9c67d97d6f 267 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 268 tapCnt--;
emh203 0:3d9c67d97d6f 269 }
emh203 0:3d9c67d97d6f 270
emh203 0:3d9c67d97d6f 271 /* Advance the state pointer by the decimation factor
emh203 0:3d9c67d97d6f 272 * to process the next group of decimation factor number samples */
emh203 0:3d9c67d97d6f 273 pState = pState + S->M;
emh203 0:3d9c67d97d6f 274
emh203 0:3d9c67d97d6f 275 /* Store filter output, smlad returns the values in 2.14 format */
emh203 0:3d9c67d97d6f 276 /* so downsacle by 15 to get output in 1.15 */
emh203 0:3d9c67d97d6f 277 *pDst++ = (q15_t) (__SSAT((sum0 >> 15), 16));
emh203 0:3d9c67d97d6f 278
emh203 0:3d9c67d97d6f 279 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 280 blkCntN3--;
emh203 0:3d9c67d97d6f 281 }
emh203 0:3d9c67d97d6f 282
emh203 0:3d9c67d97d6f 283 /* Processing is complete.
emh203 0:3d9c67d97d6f 284 ** Now copy the last numTaps - 1 samples to the satrt of the state buffer.
emh203 0:3d9c67d97d6f 285 ** This prepares the state buffer for the next function call. */
emh203 0:3d9c67d97d6f 286
emh203 0:3d9c67d97d6f 287 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 288 pStateCurnt = S->pState;
emh203 0:3d9c67d97d6f 289
emh203 0:3d9c67d97d6f 290 i = (numTaps - 1u) >> 2u;
emh203 0:3d9c67d97d6f 291
emh203 0:3d9c67d97d6f 292 /* copy data */
emh203 0:3d9c67d97d6f 293 while(i > 0u)
emh203 0:3d9c67d97d6f 294 {
emh203 0:3d9c67d97d6f 295 *__SIMD32(pStateCurnt)++ = *__SIMD32(pState)++;
emh203 0:3d9c67d97d6f 296 *__SIMD32(pStateCurnt)++ = *__SIMD32(pState)++;
emh203 0:3d9c67d97d6f 297
emh203 0:3d9c67d97d6f 298 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 299 i--;
emh203 0:3d9c67d97d6f 300 }
emh203 0:3d9c67d97d6f 301
emh203 0:3d9c67d97d6f 302 i = (numTaps - 1u) % 0x04u;
emh203 0:3d9c67d97d6f 303
emh203 0:3d9c67d97d6f 304 /* copy data */
emh203 0:3d9c67d97d6f 305 while(i > 0u)
emh203 0:3d9c67d97d6f 306 {
emh203 0:3d9c67d97d6f 307 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 308
emh203 0:3d9c67d97d6f 309 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 310 i--;
emh203 0:3d9c67d97d6f 311 }
emh203 0:3d9c67d97d6f 312 }
emh203 0:3d9c67d97d6f 313
emh203 0:3d9c67d97d6f 314 #else
emh203 0:3d9c67d97d6f 315
emh203 0:3d9c67d97d6f 316
emh203 0:3d9c67d97d6f 317 void arm_fir_decimate_q15(
emh203 0:3d9c67d97d6f 318 const arm_fir_decimate_instance_q15 * S,
emh203 0:3d9c67d97d6f 319 q15_t * pSrc,
emh203 0:3d9c67d97d6f 320 q15_t * pDst,
emh203 0:3d9c67d97d6f 321 uint32_t blockSize)
emh203 0:3d9c67d97d6f 322 {
emh203 0:3d9c67d97d6f 323 q15_t *pState = S->pState; /* State pointer */
emh203 0:3d9c67d97d6f 324 q15_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
emh203 0:3d9c67d97d6f 325 q15_t *pStateCurnt; /* Points to the current sample of the state */
emh203 0:3d9c67d97d6f 326 q15_t *px; /* Temporary pointer for state buffer */
emh203 0:3d9c67d97d6f 327 q15_t *pb; /* Temporary pointer coefficient buffer */
emh203 0:3d9c67d97d6f 328 q15_t x0, x1, c0; /* Temporary variables to hold state and coefficient values */
emh203 0:3d9c67d97d6f 329 q63_t sum0; /* Accumulators */
emh203 0:3d9c67d97d6f 330 q63_t acc0, acc1;
emh203 0:3d9c67d97d6f 331 q15_t *px0, *px1;
emh203 0:3d9c67d97d6f 332 uint32_t blkCntN3;
emh203 0:3d9c67d97d6f 333 uint32_t numTaps = S->numTaps; /* Number of taps */
emh203 0:3d9c67d97d6f 334 uint32_t i, blkCnt, tapCnt, outBlockSize = blockSize / S->M; /* Loop counters */
emh203 0:3d9c67d97d6f 335
emh203 0:3d9c67d97d6f 336
emh203 0:3d9c67d97d6f 337 /* S->pState buffer contains previous frame (numTaps - 1) samples */
emh203 0:3d9c67d97d6f 338 /* pStateCurnt points to the location where the new input data should be written */
emh203 0:3d9c67d97d6f 339 pStateCurnt = S->pState + (numTaps - 1u);
emh203 0:3d9c67d97d6f 340
emh203 0:3d9c67d97d6f 341
emh203 0:3d9c67d97d6f 342 /* Total number of output samples to be computed */
emh203 0:3d9c67d97d6f 343 blkCnt = outBlockSize / 2;
emh203 0:3d9c67d97d6f 344 blkCntN3 = outBlockSize - (2 * blkCnt);
emh203 0:3d9c67d97d6f 345
emh203 0:3d9c67d97d6f 346 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 347 {
emh203 0:3d9c67d97d6f 348 /* Copy decimation factor number of new input samples into the state buffer */
emh203 0:3d9c67d97d6f 349 i = 2 * S->M;
emh203 0:3d9c67d97d6f 350
emh203 0:3d9c67d97d6f 351 do
emh203 0:3d9c67d97d6f 352 {
emh203 0:3d9c67d97d6f 353 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 354
emh203 0:3d9c67d97d6f 355 } while(--i);
emh203 0:3d9c67d97d6f 356
emh203 0:3d9c67d97d6f 357 /* Set accumulator to zero */
emh203 0:3d9c67d97d6f 358 acc0 = 0;
emh203 0:3d9c67d97d6f 359 acc1 = 0;
emh203 0:3d9c67d97d6f 360
emh203 0:3d9c67d97d6f 361 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 362 px0 = pState;
emh203 0:3d9c67d97d6f 363
emh203 0:3d9c67d97d6f 364 px1 = pState + S->M;
emh203 0:3d9c67d97d6f 365
emh203 0:3d9c67d97d6f 366
emh203 0:3d9c67d97d6f 367 /* Initialize coeff pointer */
emh203 0:3d9c67d97d6f 368 pb = pCoeffs;
emh203 0:3d9c67d97d6f 369
emh203 0:3d9c67d97d6f 370 /* Loop unrolling. Process 4 taps at a time. */
emh203 0:3d9c67d97d6f 371 tapCnt = numTaps >> 2;
emh203 0:3d9c67d97d6f 372
emh203 0:3d9c67d97d6f 373 /* Loop over the number of taps. Unroll by a factor of 4.
emh203 0:3d9c67d97d6f 374 ** Repeat until we've computed numTaps-4 coefficients. */
emh203 0:3d9c67d97d6f 375 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 376 {
emh203 0:3d9c67d97d6f 377 /* Read the Read b[numTaps-1] coefficients */
emh203 0:3d9c67d97d6f 378 c0 = *pb++;
emh203 0:3d9c67d97d6f 379
emh203 0:3d9c67d97d6f 380 /* Read x[n-numTaps-1] for sample 0 and for sample 1 */
emh203 0:3d9c67d97d6f 381 x0 = *px0++;
emh203 0:3d9c67d97d6f 382 x1 = *px1++;
emh203 0:3d9c67d97d6f 383
emh203 0:3d9c67d97d6f 384 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 385 acc0 += x0 * c0;
emh203 0:3d9c67d97d6f 386 acc1 += x1 * c0;
emh203 0:3d9c67d97d6f 387
emh203 0:3d9c67d97d6f 388 /* Read the b[numTaps-2] coefficient */
emh203 0:3d9c67d97d6f 389 c0 = *pb++;
emh203 0:3d9c67d97d6f 390
emh203 0:3d9c67d97d6f 391 /* Read x[n-numTaps-2] for sample 0 and sample 1 */
emh203 0:3d9c67d97d6f 392 x0 = *px0++;
emh203 0:3d9c67d97d6f 393 x1 = *px1++;
emh203 0:3d9c67d97d6f 394
emh203 0:3d9c67d97d6f 395 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 396 acc0 += x0 * c0;
emh203 0:3d9c67d97d6f 397 acc1 += x1 * c0;
emh203 0:3d9c67d97d6f 398
emh203 0:3d9c67d97d6f 399 /* Read the b[numTaps-3] coefficients */
emh203 0:3d9c67d97d6f 400 c0 = *pb++;
emh203 0:3d9c67d97d6f 401
emh203 0:3d9c67d97d6f 402 /* Read x[n-numTaps-3] for sample 0 and sample 1 */
emh203 0:3d9c67d97d6f 403 x0 = *px0++;
emh203 0:3d9c67d97d6f 404 x1 = *px1++;
emh203 0:3d9c67d97d6f 405
emh203 0:3d9c67d97d6f 406 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 407 acc0 += x0 * c0;
emh203 0:3d9c67d97d6f 408 acc1 += x1 * c0;
emh203 0:3d9c67d97d6f 409
emh203 0:3d9c67d97d6f 410 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 411 c0 = *pb++;
emh203 0:3d9c67d97d6f 412
emh203 0:3d9c67d97d6f 413 /* Read x[n-numTaps-4] for sample 0 and sample 1 */
emh203 0:3d9c67d97d6f 414 x0 = *px0++;
emh203 0:3d9c67d97d6f 415 x1 = *px1++;
emh203 0:3d9c67d97d6f 416
emh203 0:3d9c67d97d6f 417 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 418 acc0 += x0 * c0;
emh203 0:3d9c67d97d6f 419 acc1 += x1 * c0;
emh203 0:3d9c67d97d6f 420
emh203 0:3d9c67d97d6f 421 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 422 tapCnt--;
emh203 0:3d9c67d97d6f 423 }
emh203 0:3d9c67d97d6f 424
emh203 0:3d9c67d97d6f 425 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
emh203 0:3d9c67d97d6f 426 tapCnt = numTaps % 0x4u;
emh203 0:3d9c67d97d6f 427
emh203 0:3d9c67d97d6f 428 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 429 {
emh203 0:3d9c67d97d6f 430 /* Read coefficients */
emh203 0:3d9c67d97d6f 431 c0 = *pb++;
emh203 0:3d9c67d97d6f 432
emh203 0:3d9c67d97d6f 433 /* Fetch 1 state variable */
emh203 0:3d9c67d97d6f 434 x0 = *px0++;
emh203 0:3d9c67d97d6f 435 x1 = *px1++;
emh203 0:3d9c67d97d6f 436
emh203 0:3d9c67d97d6f 437 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 438 acc0 += x0 * c0;
emh203 0:3d9c67d97d6f 439 acc1 += x1 * c0;
emh203 0:3d9c67d97d6f 440
emh203 0:3d9c67d97d6f 441 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 442 tapCnt--;
emh203 0:3d9c67d97d6f 443 }
emh203 0:3d9c67d97d6f 444
emh203 0:3d9c67d97d6f 445 /* Advance the state pointer by the decimation factor
emh203 0:3d9c67d97d6f 446 * to process the next group of decimation factor number samples */
emh203 0:3d9c67d97d6f 447 pState = pState + S->M * 2;
emh203 0:3d9c67d97d6f 448
emh203 0:3d9c67d97d6f 449 /* Store filter output, smlad returns the values in 2.14 format */
emh203 0:3d9c67d97d6f 450 /* so downsacle by 15 to get output in 1.15 */
emh203 0:3d9c67d97d6f 451
emh203 0:3d9c67d97d6f 452 *pDst++ = (q15_t) (__SSAT((acc0 >> 15), 16));
emh203 0:3d9c67d97d6f 453 *pDst++ = (q15_t) (__SSAT((acc1 >> 15), 16));
emh203 0:3d9c67d97d6f 454
emh203 0:3d9c67d97d6f 455 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 456 blkCnt--;
emh203 0:3d9c67d97d6f 457 }
emh203 0:3d9c67d97d6f 458
emh203 0:3d9c67d97d6f 459 while(blkCntN3 > 0u)
emh203 0:3d9c67d97d6f 460 {
emh203 0:3d9c67d97d6f 461 /* Copy decimation factor number of new input samples into the state buffer */
emh203 0:3d9c67d97d6f 462 i = S->M;
emh203 0:3d9c67d97d6f 463
emh203 0:3d9c67d97d6f 464 do
emh203 0:3d9c67d97d6f 465 {
emh203 0:3d9c67d97d6f 466 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 467
emh203 0:3d9c67d97d6f 468 } while(--i);
emh203 0:3d9c67d97d6f 469
emh203 0:3d9c67d97d6f 470 /*Set sum to zero */
emh203 0:3d9c67d97d6f 471 sum0 = 0;
emh203 0:3d9c67d97d6f 472
emh203 0:3d9c67d97d6f 473 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 474 px = pState;
emh203 0:3d9c67d97d6f 475
emh203 0:3d9c67d97d6f 476 /* Initialize coeff pointer */
emh203 0:3d9c67d97d6f 477 pb = pCoeffs;
emh203 0:3d9c67d97d6f 478
emh203 0:3d9c67d97d6f 479 /* Loop unrolling. Process 4 taps at a time. */
emh203 0:3d9c67d97d6f 480 tapCnt = numTaps >> 2;
emh203 0:3d9c67d97d6f 481
emh203 0:3d9c67d97d6f 482 /* Loop over the number of taps. Unroll by a factor of 4.
emh203 0:3d9c67d97d6f 483 ** Repeat until we've computed numTaps-4 coefficients. */
emh203 0:3d9c67d97d6f 484 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 485 {
emh203 0:3d9c67d97d6f 486 /* Read the Read b[numTaps-1] coefficients */
emh203 0:3d9c67d97d6f 487 c0 = *pb++;
emh203 0:3d9c67d97d6f 488
emh203 0:3d9c67d97d6f 489 /* Read x[n-numTaps-1] and sample */
emh203 0:3d9c67d97d6f 490 x0 = *px++;
emh203 0:3d9c67d97d6f 491
emh203 0:3d9c67d97d6f 492 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 493 sum0 += x0 * c0;
emh203 0:3d9c67d97d6f 494
emh203 0:3d9c67d97d6f 495 /* Read the b[numTaps-2] coefficient */
emh203 0:3d9c67d97d6f 496 c0 = *pb++;
emh203 0:3d9c67d97d6f 497
emh203 0:3d9c67d97d6f 498 /* Read x[n-numTaps-2] and sample */
emh203 0:3d9c67d97d6f 499 x0 = *px++;
emh203 0:3d9c67d97d6f 500
emh203 0:3d9c67d97d6f 501 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 502 sum0 += x0 * c0;
emh203 0:3d9c67d97d6f 503
emh203 0:3d9c67d97d6f 504 /* Read the b[numTaps-3] coefficients */
emh203 0:3d9c67d97d6f 505 c0 = *pb++;
emh203 0:3d9c67d97d6f 506
emh203 0:3d9c67d97d6f 507 /* Read x[n-numTaps-3] sample */
emh203 0:3d9c67d97d6f 508 x0 = *px++;
emh203 0:3d9c67d97d6f 509
emh203 0:3d9c67d97d6f 510 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 511 sum0 += x0 * c0;
emh203 0:3d9c67d97d6f 512
emh203 0:3d9c67d97d6f 513 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 514 c0 = *pb++;
emh203 0:3d9c67d97d6f 515
emh203 0:3d9c67d97d6f 516 /* Read x[n-numTaps-4] sample */
emh203 0:3d9c67d97d6f 517 x0 = *px++;
emh203 0:3d9c67d97d6f 518
emh203 0:3d9c67d97d6f 519 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 520 sum0 += x0 * c0;
emh203 0:3d9c67d97d6f 521
emh203 0:3d9c67d97d6f 522 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 523 tapCnt--;
emh203 0:3d9c67d97d6f 524 }
emh203 0:3d9c67d97d6f 525
emh203 0:3d9c67d97d6f 526 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
emh203 0:3d9c67d97d6f 527 tapCnt = numTaps % 0x4u;
emh203 0:3d9c67d97d6f 528
emh203 0:3d9c67d97d6f 529 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 530 {
emh203 0:3d9c67d97d6f 531 /* Read coefficients */
emh203 0:3d9c67d97d6f 532 c0 = *pb++;
emh203 0:3d9c67d97d6f 533
emh203 0:3d9c67d97d6f 534 /* Fetch 1 state variable */
emh203 0:3d9c67d97d6f 535 x0 = *px++;
emh203 0:3d9c67d97d6f 536
emh203 0:3d9c67d97d6f 537 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 538 sum0 += x0 * c0;
emh203 0:3d9c67d97d6f 539
emh203 0:3d9c67d97d6f 540 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 541 tapCnt--;
emh203 0:3d9c67d97d6f 542 }
emh203 0:3d9c67d97d6f 543
emh203 0:3d9c67d97d6f 544 /* Advance the state pointer by the decimation factor
emh203 0:3d9c67d97d6f 545 * to process the next group of decimation factor number samples */
emh203 0:3d9c67d97d6f 546 pState = pState + S->M;
emh203 0:3d9c67d97d6f 547
emh203 0:3d9c67d97d6f 548 /* Store filter output, smlad returns the values in 2.14 format */
emh203 0:3d9c67d97d6f 549 /* so downsacle by 15 to get output in 1.15 */
emh203 0:3d9c67d97d6f 550 *pDst++ = (q15_t) (__SSAT((sum0 >> 15), 16));
emh203 0:3d9c67d97d6f 551
emh203 0:3d9c67d97d6f 552 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 553 blkCntN3--;
emh203 0:3d9c67d97d6f 554 }
emh203 0:3d9c67d97d6f 555
emh203 0:3d9c67d97d6f 556 /* Processing is complete.
emh203 0:3d9c67d97d6f 557 ** Now copy the last numTaps - 1 samples to the satrt of the state buffer.
emh203 0:3d9c67d97d6f 558 ** This prepares the state buffer for the next function call. */
emh203 0:3d9c67d97d6f 559
emh203 0:3d9c67d97d6f 560 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 561 pStateCurnt = S->pState;
emh203 0:3d9c67d97d6f 562
emh203 0:3d9c67d97d6f 563 i = (numTaps - 1u) >> 2u;
emh203 0:3d9c67d97d6f 564
emh203 0:3d9c67d97d6f 565 /* copy data */
emh203 0:3d9c67d97d6f 566 while(i > 0u)
emh203 0:3d9c67d97d6f 567 {
emh203 0:3d9c67d97d6f 568 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 569 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 570 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 571 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 572
emh203 0:3d9c67d97d6f 573 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 574 i--;
emh203 0:3d9c67d97d6f 575 }
emh203 0:3d9c67d97d6f 576
emh203 0:3d9c67d97d6f 577 i = (numTaps - 1u) % 0x04u;
emh203 0:3d9c67d97d6f 578
emh203 0:3d9c67d97d6f 579 /* copy data */
emh203 0:3d9c67d97d6f 580 while(i > 0u)
emh203 0:3d9c67d97d6f 581 {
emh203 0:3d9c67d97d6f 582 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 583
emh203 0:3d9c67d97d6f 584 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 585 i--;
emh203 0:3d9c67d97d6f 586 }
emh203 0:3d9c67d97d6f 587 }
emh203 0:3d9c67d97d6f 588
emh203 0:3d9c67d97d6f 589
emh203 0:3d9c67d97d6f 590 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
emh203 0:3d9c67d97d6f 591
emh203 0:3d9c67d97d6f 592 #else
emh203 0:3d9c67d97d6f 593
emh203 0:3d9c67d97d6f 594
emh203 0:3d9c67d97d6f 595 void arm_fir_decimate_q15(
emh203 0:3d9c67d97d6f 596 const arm_fir_decimate_instance_q15 * S,
emh203 0:3d9c67d97d6f 597 q15_t * pSrc,
emh203 0:3d9c67d97d6f 598 q15_t * pDst,
emh203 0:3d9c67d97d6f 599 uint32_t blockSize)
emh203 0:3d9c67d97d6f 600 {
emh203 0:3d9c67d97d6f 601 q15_t *pState = S->pState; /* State pointer */
emh203 0:3d9c67d97d6f 602 q15_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
emh203 0:3d9c67d97d6f 603 q15_t *pStateCurnt; /* Points to the current sample of the state */
emh203 0:3d9c67d97d6f 604 q15_t *px; /* Temporary pointer for state buffer */
emh203 0:3d9c67d97d6f 605 q15_t *pb; /* Temporary pointer coefficient buffer */
emh203 0:3d9c67d97d6f 606 q31_t x0, c0; /* Temporary variables to hold state and coefficient values */
emh203 0:3d9c67d97d6f 607 q63_t sum0; /* Accumulators */
emh203 0:3d9c67d97d6f 608 uint32_t numTaps = S->numTaps; /* Number of taps */
emh203 0:3d9c67d97d6f 609 uint32_t i, blkCnt, tapCnt, outBlockSize = blockSize / S->M; /* Loop counters */
emh203 0:3d9c67d97d6f 610
emh203 0:3d9c67d97d6f 611
emh203 0:3d9c67d97d6f 612
emh203 0:3d9c67d97d6f 613 /* Run the below code for Cortex-M0 */
emh203 0:3d9c67d97d6f 614
emh203 0:3d9c67d97d6f 615 /* S->pState buffer contains previous frame (numTaps - 1) samples */
emh203 0:3d9c67d97d6f 616 /* pStateCurnt points to the location where the new input data should be written */
emh203 0:3d9c67d97d6f 617 pStateCurnt = S->pState + (numTaps - 1u);
emh203 0:3d9c67d97d6f 618
emh203 0:3d9c67d97d6f 619 /* Total number of output samples to be computed */
emh203 0:3d9c67d97d6f 620 blkCnt = outBlockSize;
emh203 0:3d9c67d97d6f 621
emh203 0:3d9c67d97d6f 622 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 623 {
emh203 0:3d9c67d97d6f 624 /* Copy decimation factor number of new input samples into the state buffer */
emh203 0:3d9c67d97d6f 625 i = S->M;
emh203 0:3d9c67d97d6f 626
emh203 0:3d9c67d97d6f 627 do
emh203 0:3d9c67d97d6f 628 {
emh203 0:3d9c67d97d6f 629 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 630
emh203 0:3d9c67d97d6f 631 } while(--i);
emh203 0:3d9c67d97d6f 632
emh203 0:3d9c67d97d6f 633 /*Set sum to zero */
emh203 0:3d9c67d97d6f 634 sum0 = 0;
emh203 0:3d9c67d97d6f 635
emh203 0:3d9c67d97d6f 636 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 637 px = pState;
emh203 0:3d9c67d97d6f 638
emh203 0:3d9c67d97d6f 639 /* Initialize coeff pointer */
emh203 0:3d9c67d97d6f 640 pb = pCoeffs;
emh203 0:3d9c67d97d6f 641
emh203 0:3d9c67d97d6f 642 tapCnt = numTaps;
emh203 0:3d9c67d97d6f 643
emh203 0:3d9c67d97d6f 644 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 645 {
emh203 0:3d9c67d97d6f 646 /* Read coefficients */
emh203 0:3d9c67d97d6f 647 c0 = *pb++;
emh203 0:3d9c67d97d6f 648
emh203 0:3d9c67d97d6f 649 /* Fetch 1 state variable */
emh203 0:3d9c67d97d6f 650 x0 = *px++;
emh203 0:3d9c67d97d6f 651
emh203 0:3d9c67d97d6f 652 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 653 sum0 += (q31_t) x0 *c0;
emh203 0:3d9c67d97d6f 654
emh203 0:3d9c67d97d6f 655 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 656 tapCnt--;
emh203 0:3d9c67d97d6f 657 }
emh203 0:3d9c67d97d6f 658
emh203 0:3d9c67d97d6f 659 /* Advance the state pointer by the decimation factor
emh203 0:3d9c67d97d6f 660 * to process the next group of decimation factor number samples */
emh203 0:3d9c67d97d6f 661 pState = pState + S->M;
emh203 0:3d9c67d97d6f 662
emh203 0:3d9c67d97d6f 663 /*Store filter output , smlad will return the values in 2.14 format */
emh203 0:3d9c67d97d6f 664 /* so downsacle by 15 to get output in 1.15 */
emh203 0:3d9c67d97d6f 665 *pDst++ = (q15_t) (__SSAT((sum0 >> 15), 16));
emh203 0:3d9c67d97d6f 666
emh203 0:3d9c67d97d6f 667 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 668 blkCnt--;
emh203 0:3d9c67d97d6f 669 }
emh203 0:3d9c67d97d6f 670
emh203 0:3d9c67d97d6f 671 /* Processing is complete.
emh203 0:3d9c67d97d6f 672 ** Now copy the last numTaps - 1 samples to the start of the state buffer.
emh203 0:3d9c67d97d6f 673 ** This prepares the state buffer for the next function call. */
emh203 0:3d9c67d97d6f 674
emh203 0:3d9c67d97d6f 675 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 676 pStateCurnt = S->pState;
emh203 0:3d9c67d97d6f 677
emh203 0:3d9c67d97d6f 678 i = numTaps - 1u;
emh203 0:3d9c67d97d6f 679
emh203 0:3d9c67d97d6f 680 /* copy data */
emh203 0:3d9c67d97d6f 681 while(i > 0u)
emh203 0:3d9c67d97d6f 682 {
emh203 0:3d9c67d97d6f 683 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 684
emh203 0:3d9c67d97d6f 685 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 686 i--;
emh203 0:3d9c67d97d6f 687 }
emh203 0:3d9c67d97d6f 688
emh203 0:3d9c67d97d6f 689
emh203 0:3d9c67d97d6f 690 }
emh203 0:3d9c67d97d6f 691 #endif /* #ifndef ARM_MATH_CM0_FAMILY */
emh203 0:3d9c67d97d6f 692
emh203 0:3d9c67d97d6f 693
emh203 0:3d9c67d97d6f 694 /**
emh203 0:3d9c67d97d6f 695 * @} end of FIR_decimate group
emh203 0:3d9c67d97d6f 696 */