The CMSIS DSP 5 library

Dependents:   Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more

Committer:
xorjoep
Date:
Thu Jun 21 11:56:27 2018 +0000
Revision:
3:4098b9d3d571
Parent:
1:24714b45cd1b
headers is a folder not a library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
xorjoep 1:24714b45cd1b 1 /* ----------------------------------------------------------------------
xorjoep 1:24714b45cd1b 2 * Project: CMSIS DSP Library
xorjoep 1:24714b45cd1b 3 * Title: arm_lms_q31.c
xorjoep 1:24714b45cd1b 4 * Description: Processing function for the Q31 LMS filter
xorjoep 1:24714b45cd1b 5 *
xorjoep 1:24714b45cd1b 6 * $Date: 27. January 2017
xorjoep 1:24714b45cd1b 7 * $Revision: V.1.5.1
xorjoep 1:24714b45cd1b 8 *
xorjoep 1:24714b45cd1b 9 * Target Processor: Cortex-M cores
xorjoep 1:24714b45cd1b 10 * -------------------------------------------------------------------- */
xorjoep 1:24714b45cd1b 11 /*
xorjoep 1:24714b45cd1b 12 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
xorjoep 1:24714b45cd1b 13 *
xorjoep 1:24714b45cd1b 14 * SPDX-License-Identifier: Apache-2.0
xorjoep 1:24714b45cd1b 15 *
xorjoep 1:24714b45cd1b 16 * Licensed under the Apache License, Version 2.0 (the License); you may
xorjoep 1:24714b45cd1b 17 * not use this file except in compliance with the License.
xorjoep 1:24714b45cd1b 18 * You may obtain a copy of the License at
xorjoep 1:24714b45cd1b 19 *
xorjoep 1:24714b45cd1b 20 * www.apache.org/licenses/LICENSE-2.0
xorjoep 1:24714b45cd1b 21 *
xorjoep 1:24714b45cd1b 22 * Unless required by applicable law or agreed to in writing, software
xorjoep 1:24714b45cd1b 23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
xorjoep 1:24714b45cd1b 24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
xorjoep 1:24714b45cd1b 25 * See the License for the specific language governing permissions and
xorjoep 1:24714b45cd1b 26 * limitations under the License.
xorjoep 1:24714b45cd1b 27 */
xorjoep 1:24714b45cd1b 28
xorjoep 1:24714b45cd1b 29 #include "arm_math.h"
xorjoep 1:24714b45cd1b 30 /**
xorjoep 1:24714b45cd1b 31 * @ingroup groupFilters
xorjoep 1:24714b45cd1b 32 */
xorjoep 1:24714b45cd1b 33
xorjoep 1:24714b45cd1b 34 /**
xorjoep 1:24714b45cd1b 35 * @addtogroup LMS
xorjoep 1:24714b45cd1b 36 * @{
xorjoep 1:24714b45cd1b 37 */
xorjoep 1:24714b45cd1b 38
xorjoep 1:24714b45cd1b 39 /**
xorjoep 1:24714b45cd1b 40 * @brief Processing function for Q31 LMS filter.
xorjoep 1:24714b45cd1b 41 * @param[in] *S points to an instance of the Q15 LMS filter structure.
xorjoep 1:24714b45cd1b 42 * @param[in] *pSrc points to the block of input data.
xorjoep 1:24714b45cd1b 43 * @param[in] *pRef points to the block of reference data.
xorjoep 1:24714b45cd1b 44 * @param[out] *pOut points to the block of output data.
xorjoep 1:24714b45cd1b 45 * @param[out] *pErr points to the block of error data.
xorjoep 1:24714b45cd1b 46 * @param[in] blockSize number of samples to process.
xorjoep 1:24714b45cd1b 47 * @return none.
xorjoep 1:24714b45cd1b 48 *
xorjoep 1:24714b45cd1b 49 * \par Scaling and Overflow Behavior:
xorjoep 1:24714b45cd1b 50 * The function is implemented using an internal 64-bit accumulator.
xorjoep 1:24714b45cd1b 51 * The accumulator has a 2.62 format and maintains full precision of the intermediate
xorjoep 1:24714b45cd1b 52 * multiplication results but provides only a single guard bit.
xorjoep 1:24714b45cd1b 53 * Thus, if the accumulator result overflows it wraps around rather than clips.
xorjoep 1:24714b45cd1b 54 * In order to avoid overflows completely the input signal must be scaled down by
xorjoep 1:24714b45cd1b 55 * log2(numTaps) bits.
xorjoep 1:24714b45cd1b 56 * The reference signal should not be scaled down.
xorjoep 1:24714b45cd1b 57 * After all multiply-accumulates are performed, the 2.62 accumulator is shifted
xorjoep 1:24714b45cd1b 58 * and saturated to 1.31 format to yield the final result.
xorjoep 1:24714b45cd1b 59 * The output signal and error signal are in 1.31 format.
xorjoep 1:24714b45cd1b 60 *
xorjoep 1:24714b45cd1b 61 * \par
xorjoep 1:24714b45cd1b 62 * In this filter, filter coefficients are updated for each sample and the updation of filter cofficients are saturted.
xorjoep 1:24714b45cd1b 63 */
xorjoep 1:24714b45cd1b 64
xorjoep 1:24714b45cd1b 65 void arm_lms_q31(
xorjoep 1:24714b45cd1b 66 const arm_lms_instance_q31 * S,
xorjoep 1:24714b45cd1b 67 q31_t * pSrc,
xorjoep 1:24714b45cd1b 68 q31_t * pRef,
xorjoep 1:24714b45cd1b 69 q31_t * pOut,
xorjoep 1:24714b45cd1b 70 q31_t * pErr,
xorjoep 1:24714b45cd1b 71 uint32_t blockSize)
xorjoep 1:24714b45cd1b 72 {
xorjoep 1:24714b45cd1b 73 q31_t *pState = S->pState; /* State pointer */
xorjoep 1:24714b45cd1b 74 uint32_t numTaps = S->numTaps; /* Number of filter coefficients in the filter */
xorjoep 1:24714b45cd1b 75 q31_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
xorjoep 1:24714b45cd1b 76 q31_t *pStateCurnt; /* Points to the current sample of the state */
xorjoep 1:24714b45cd1b 77 q31_t mu = S->mu; /* Adaptive factor */
xorjoep 1:24714b45cd1b 78 q31_t *px; /* Temporary pointer for state */
xorjoep 1:24714b45cd1b 79 q31_t *pb; /* Temporary pointer for coefficient buffer */
xorjoep 1:24714b45cd1b 80 uint32_t tapCnt, blkCnt; /* Loop counters */
xorjoep 1:24714b45cd1b 81 q63_t acc; /* Accumulator */
xorjoep 1:24714b45cd1b 82 q31_t e = 0; /* error of data sample */
xorjoep 1:24714b45cd1b 83 q31_t alpha; /* Intermediate constant for taps update */
xorjoep 1:24714b45cd1b 84 q31_t coef; /* Temporary variable for coef */
xorjoep 1:24714b45cd1b 85 q31_t acc_l, acc_h; /* temporary input */
xorjoep 1:24714b45cd1b 86 uint32_t uShift = ((uint32_t) S->postShift + 1U);
xorjoep 1:24714b45cd1b 87 uint32_t lShift = 32U - uShift; /* Shift to be applied to the output */
xorjoep 1:24714b45cd1b 88
xorjoep 1:24714b45cd1b 89 /* S->pState points to buffer which contains previous frame (numTaps - 1) samples */
xorjoep 1:24714b45cd1b 90 /* pStateCurnt points to the location where the new input data should be written */
xorjoep 1:24714b45cd1b 91 pStateCurnt = &(S->pState[(numTaps - 1U)]);
xorjoep 1:24714b45cd1b 92
xorjoep 1:24714b45cd1b 93 /* Initializing blkCnt with blockSize */
xorjoep 1:24714b45cd1b 94 blkCnt = blockSize;
xorjoep 1:24714b45cd1b 95
xorjoep 1:24714b45cd1b 96
xorjoep 1:24714b45cd1b 97 #if defined (ARM_MATH_DSP)
xorjoep 1:24714b45cd1b 98
xorjoep 1:24714b45cd1b 99 /* Run the below code for Cortex-M4 and Cortex-M3 */
xorjoep 1:24714b45cd1b 100
xorjoep 1:24714b45cd1b 101 while (blkCnt > 0U)
xorjoep 1:24714b45cd1b 102 {
xorjoep 1:24714b45cd1b 103 /* Copy the new input sample into the state buffer */
xorjoep 1:24714b45cd1b 104 *pStateCurnt++ = *pSrc++;
xorjoep 1:24714b45cd1b 105
xorjoep 1:24714b45cd1b 106 /* Initialize state pointer */
xorjoep 1:24714b45cd1b 107 px = pState;
xorjoep 1:24714b45cd1b 108
xorjoep 1:24714b45cd1b 109 /* Initialize coefficient pointer */
xorjoep 1:24714b45cd1b 110 pb = pCoeffs;
xorjoep 1:24714b45cd1b 111
xorjoep 1:24714b45cd1b 112 /* Set the accumulator to zero */
xorjoep 1:24714b45cd1b 113 acc = 0;
xorjoep 1:24714b45cd1b 114
xorjoep 1:24714b45cd1b 115 /* Loop unrolling. Process 4 taps at a time. */
xorjoep 1:24714b45cd1b 116 tapCnt = numTaps >> 2;
xorjoep 1:24714b45cd1b 117
xorjoep 1:24714b45cd1b 118 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 119 {
xorjoep 1:24714b45cd1b 120 /* Perform the multiply-accumulate */
xorjoep 1:24714b45cd1b 121 /* acc += b[N] * x[n-N] */
xorjoep 1:24714b45cd1b 122 acc += ((q63_t) (*px++)) * (*pb++);
xorjoep 1:24714b45cd1b 123
xorjoep 1:24714b45cd1b 124 /* acc += b[N-1] * x[n-N-1] */
xorjoep 1:24714b45cd1b 125 acc += ((q63_t) (*px++)) * (*pb++);
xorjoep 1:24714b45cd1b 126
xorjoep 1:24714b45cd1b 127 /* acc += b[N-2] * x[n-N-2] */
xorjoep 1:24714b45cd1b 128 acc += ((q63_t) (*px++)) * (*pb++);
xorjoep 1:24714b45cd1b 129
xorjoep 1:24714b45cd1b 130 /* acc += b[N-3] * x[n-N-3] */
xorjoep 1:24714b45cd1b 131 acc += ((q63_t) (*px++)) * (*pb++);
xorjoep 1:24714b45cd1b 132
xorjoep 1:24714b45cd1b 133 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 134 tapCnt--;
xorjoep 1:24714b45cd1b 135 }
xorjoep 1:24714b45cd1b 136
xorjoep 1:24714b45cd1b 137 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
xorjoep 1:24714b45cd1b 138 tapCnt = numTaps % 0x4U;
xorjoep 1:24714b45cd1b 139
xorjoep 1:24714b45cd1b 140 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 141 {
xorjoep 1:24714b45cd1b 142 /* Perform the multiply-accumulate */
xorjoep 1:24714b45cd1b 143 acc += ((q63_t) (*px++)) * (*pb++);
xorjoep 1:24714b45cd1b 144
xorjoep 1:24714b45cd1b 145 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 146 tapCnt--;
xorjoep 1:24714b45cd1b 147 }
xorjoep 1:24714b45cd1b 148
xorjoep 1:24714b45cd1b 149 /* Converting the result to 1.31 format */
xorjoep 1:24714b45cd1b 150 /* Calc lower part of acc */
xorjoep 1:24714b45cd1b 151 acc_l = acc & 0xffffffff;
xorjoep 1:24714b45cd1b 152
xorjoep 1:24714b45cd1b 153 /* Calc upper part of acc */
xorjoep 1:24714b45cd1b 154 acc_h = (acc >> 32) & 0xffffffff;
xorjoep 1:24714b45cd1b 155
xorjoep 1:24714b45cd1b 156 acc = (uint32_t) acc_l >> lShift | acc_h << uShift;
xorjoep 1:24714b45cd1b 157
xorjoep 1:24714b45cd1b 158 /* Store the result from accumulator into the destination buffer. */
xorjoep 1:24714b45cd1b 159 *pOut++ = (q31_t) acc;
xorjoep 1:24714b45cd1b 160
xorjoep 1:24714b45cd1b 161 /* Compute and store error */
xorjoep 1:24714b45cd1b 162 e = *pRef++ - (q31_t) acc;
xorjoep 1:24714b45cd1b 163
xorjoep 1:24714b45cd1b 164 *pErr++ = (q31_t) e;
xorjoep 1:24714b45cd1b 165
xorjoep 1:24714b45cd1b 166 /* Compute alpha i.e. intermediate constant for taps update */
xorjoep 1:24714b45cd1b 167 alpha = (q31_t) (((q63_t) e * mu) >> 31);
xorjoep 1:24714b45cd1b 168
xorjoep 1:24714b45cd1b 169 /* Initialize state pointer */
xorjoep 1:24714b45cd1b 170 /* Advance state pointer by 1 for the next sample */
xorjoep 1:24714b45cd1b 171 px = pState++;
xorjoep 1:24714b45cd1b 172
xorjoep 1:24714b45cd1b 173 /* Initialize coefficient pointer */
xorjoep 1:24714b45cd1b 174 pb = pCoeffs;
xorjoep 1:24714b45cd1b 175
xorjoep 1:24714b45cd1b 176 /* Loop unrolling. Process 4 taps at a time. */
xorjoep 1:24714b45cd1b 177 tapCnt = numTaps >> 2;
xorjoep 1:24714b45cd1b 178
xorjoep 1:24714b45cd1b 179 /* Update filter coefficients */
xorjoep 1:24714b45cd1b 180 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 181 {
xorjoep 1:24714b45cd1b 182 /* coef is in 2.30 format */
xorjoep 1:24714b45cd1b 183 coef = (q31_t) (((q63_t) alpha * (*px++)) >> (32));
xorjoep 1:24714b45cd1b 184 /* get coef in 1.31 format by left shifting */
xorjoep 1:24714b45cd1b 185 *pb = clip_q63_to_q31((q63_t) * pb + (coef << 1U));
xorjoep 1:24714b45cd1b 186 /* update coefficient buffer to next coefficient */
xorjoep 1:24714b45cd1b 187 pb++;
xorjoep 1:24714b45cd1b 188
xorjoep 1:24714b45cd1b 189 coef = (q31_t) (((q63_t) alpha * (*px++)) >> (32));
xorjoep 1:24714b45cd1b 190 *pb = clip_q63_to_q31((q63_t) * pb + (coef << 1U));
xorjoep 1:24714b45cd1b 191 pb++;
xorjoep 1:24714b45cd1b 192
xorjoep 1:24714b45cd1b 193 coef = (q31_t) (((q63_t) alpha * (*px++)) >> (32));
xorjoep 1:24714b45cd1b 194 *pb = clip_q63_to_q31((q63_t) * pb + (coef << 1U));
xorjoep 1:24714b45cd1b 195 pb++;
xorjoep 1:24714b45cd1b 196
xorjoep 1:24714b45cd1b 197 coef = (q31_t) (((q63_t) alpha * (*px++)) >> (32));
xorjoep 1:24714b45cd1b 198 *pb = clip_q63_to_q31((q63_t) * pb + (coef << 1U));
xorjoep 1:24714b45cd1b 199 pb++;
xorjoep 1:24714b45cd1b 200
xorjoep 1:24714b45cd1b 201 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 202 tapCnt--;
xorjoep 1:24714b45cd1b 203 }
xorjoep 1:24714b45cd1b 204
xorjoep 1:24714b45cd1b 205 /* If the filter length is not a multiple of 4, compute the remaining filter taps */
xorjoep 1:24714b45cd1b 206 tapCnt = numTaps % 0x4U;
xorjoep 1:24714b45cd1b 207
xorjoep 1:24714b45cd1b 208 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 209 {
xorjoep 1:24714b45cd1b 210 /* Perform the multiply-accumulate */
xorjoep 1:24714b45cd1b 211 coef = (q31_t) (((q63_t) alpha * (*px++)) >> (32));
xorjoep 1:24714b45cd1b 212 *pb = clip_q63_to_q31((q63_t) * pb + (coef << 1U));
xorjoep 1:24714b45cd1b 213 pb++;
xorjoep 1:24714b45cd1b 214
xorjoep 1:24714b45cd1b 215 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 216 tapCnt--;
xorjoep 1:24714b45cd1b 217 }
xorjoep 1:24714b45cd1b 218
xorjoep 1:24714b45cd1b 219 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 220 blkCnt--;
xorjoep 1:24714b45cd1b 221 }
xorjoep 1:24714b45cd1b 222
xorjoep 1:24714b45cd1b 223 /* Processing is complete. Now copy the last numTaps - 1 samples to the
xorjoep 1:24714b45cd1b 224 satrt of the state buffer. This prepares the state buffer for the
xorjoep 1:24714b45cd1b 225 next function call. */
xorjoep 1:24714b45cd1b 226
xorjoep 1:24714b45cd1b 227 /* Points to the start of the pState buffer */
xorjoep 1:24714b45cd1b 228 pStateCurnt = S->pState;
xorjoep 1:24714b45cd1b 229
xorjoep 1:24714b45cd1b 230 /* Loop unrolling for (numTaps - 1U) samples copy */
xorjoep 1:24714b45cd1b 231 tapCnt = (numTaps - 1U) >> 2U;
xorjoep 1:24714b45cd1b 232
xorjoep 1:24714b45cd1b 233 /* copy data */
xorjoep 1:24714b45cd1b 234 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 235 {
xorjoep 1:24714b45cd1b 236 *pStateCurnt++ = *pState++;
xorjoep 1:24714b45cd1b 237 *pStateCurnt++ = *pState++;
xorjoep 1:24714b45cd1b 238 *pStateCurnt++ = *pState++;
xorjoep 1:24714b45cd1b 239 *pStateCurnt++ = *pState++;
xorjoep 1:24714b45cd1b 240
xorjoep 1:24714b45cd1b 241 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 242 tapCnt--;
xorjoep 1:24714b45cd1b 243 }
xorjoep 1:24714b45cd1b 244
xorjoep 1:24714b45cd1b 245 /* Calculate remaining number of copies */
xorjoep 1:24714b45cd1b 246 tapCnt = (numTaps - 1U) % 0x4U;
xorjoep 1:24714b45cd1b 247
xorjoep 1:24714b45cd1b 248 /* Copy the remaining q31_t data */
xorjoep 1:24714b45cd1b 249 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 250 {
xorjoep 1:24714b45cd1b 251 *pStateCurnt++ = *pState++;
xorjoep 1:24714b45cd1b 252
xorjoep 1:24714b45cd1b 253 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 254 tapCnt--;
xorjoep 1:24714b45cd1b 255 }
xorjoep 1:24714b45cd1b 256
xorjoep 1:24714b45cd1b 257 #else
xorjoep 1:24714b45cd1b 258
xorjoep 1:24714b45cd1b 259 /* Run the below code for Cortex-M0 */
xorjoep 1:24714b45cd1b 260
xorjoep 1:24714b45cd1b 261 while (blkCnt > 0U)
xorjoep 1:24714b45cd1b 262 {
xorjoep 1:24714b45cd1b 263 /* Copy the new input sample into the state buffer */
xorjoep 1:24714b45cd1b 264 *pStateCurnt++ = *pSrc++;
xorjoep 1:24714b45cd1b 265
xorjoep 1:24714b45cd1b 266 /* Initialize pState pointer */
xorjoep 1:24714b45cd1b 267 px = pState;
xorjoep 1:24714b45cd1b 268
xorjoep 1:24714b45cd1b 269 /* Initialize pCoeffs pointer */
xorjoep 1:24714b45cd1b 270 pb = pCoeffs;
xorjoep 1:24714b45cd1b 271
xorjoep 1:24714b45cd1b 272 /* Set the accumulator to zero */
xorjoep 1:24714b45cd1b 273 acc = 0;
xorjoep 1:24714b45cd1b 274
xorjoep 1:24714b45cd1b 275 /* Loop over numTaps number of values */
xorjoep 1:24714b45cd1b 276 tapCnt = numTaps;
xorjoep 1:24714b45cd1b 277
xorjoep 1:24714b45cd1b 278 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 279 {
xorjoep 1:24714b45cd1b 280 /* Perform the multiply-accumulate */
xorjoep 1:24714b45cd1b 281 acc += ((q63_t) (*px++)) * (*pb++);
xorjoep 1:24714b45cd1b 282
xorjoep 1:24714b45cd1b 283 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 284 tapCnt--;
xorjoep 1:24714b45cd1b 285 }
xorjoep 1:24714b45cd1b 286
xorjoep 1:24714b45cd1b 287 /* Converting the result to 1.31 format */
xorjoep 1:24714b45cd1b 288 /* Store the result from accumulator into the destination buffer. */
xorjoep 1:24714b45cd1b 289 /* Calc lower part of acc */
xorjoep 1:24714b45cd1b 290 acc_l = acc & 0xffffffff;
xorjoep 1:24714b45cd1b 291
xorjoep 1:24714b45cd1b 292 /* Calc upper part of acc */
xorjoep 1:24714b45cd1b 293 acc_h = (acc >> 32) & 0xffffffff;
xorjoep 1:24714b45cd1b 294
xorjoep 1:24714b45cd1b 295 acc = (uint32_t) acc_l >> lShift | acc_h << uShift;
xorjoep 1:24714b45cd1b 296
xorjoep 1:24714b45cd1b 297 *pOut++ = (q31_t) acc;
xorjoep 1:24714b45cd1b 298
xorjoep 1:24714b45cd1b 299 /* Compute and store error */
xorjoep 1:24714b45cd1b 300 e = *pRef++ - (q31_t) acc;
xorjoep 1:24714b45cd1b 301
xorjoep 1:24714b45cd1b 302 *pErr++ = (q31_t) e;
xorjoep 1:24714b45cd1b 303
xorjoep 1:24714b45cd1b 304 /* Weighting factor for the LMS version */
xorjoep 1:24714b45cd1b 305 alpha = (q31_t) (((q63_t) e * mu) >> 31);
xorjoep 1:24714b45cd1b 306
xorjoep 1:24714b45cd1b 307 /* Initialize pState pointer */
xorjoep 1:24714b45cd1b 308 /* Advance state pointer by 1 for the next sample */
xorjoep 1:24714b45cd1b 309 px = pState++;
xorjoep 1:24714b45cd1b 310
xorjoep 1:24714b45cd1b 311 /* Initialize pCoeffs pointer */
xorjoep 1:24714b45cd1b 312 pb = pCoeffs;
xorjoep 1:24714b45cd1b 313
xorjoep 1:24714b45cd1b 314 /* Loop over numTaps number of values */
xorjoep 1:24714b45cd1b 315 tapCnt = numTaps;
xorjoep 1:24714b45cd1b 316
xorjoep 1:24714b45cd1b 317 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 318 {
xorjoep 1:24714b45cd1b 319 /* Perform the multiply-accumulate */
xorjoep 1:24714b45cd1b 320 coef = (q31_t) (((q63_t) alpha * (*px++)) >> (32));
xorjoep 1:24714b45cd1b 321 *pb = clip_q63_to_q31((q63_t) * pb + (coef << 1U));
xorjoep 1:24714b45cd1b 322 pb++;
xorjoep 1:24714b45cd1b 323
xorjoep 1:24714b45cd1b 324 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 325 tapCnt--;
xorjoep 1:24714b45cd1b 326 }
xorjoep 1:24714b45cd1b 327
xorjoep 1:24714b45cd1b 328 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 329 blkCnt--;
xorjoep 1:24714b45cd1b 330 }
xorjoep 1:24714b45cd1b 331
xorjoep 1:24714b45cd1b 332 /* Processing is complete. Now copy the last numTaps - 1 samples to the
xorjoep 1:24714b45cd1b 333 start of the state buffer. This prepares the state buffer for the
xorjoep 1:24714b45cd1b 334 next function call. */
xorjoep 1:24714b45cd1b 335
xorjoep 1:24714b45cd1b 336 /* Points to the start of the pState buffer */
xorjoep 1:24714b45cd1b 337 pStateCurnt = S->pState;
xorjoep 1:24714b45cd1b 338
xorjoep 1:24714b45cd1b 339 /* Copy (numTaps - 1U) samples */
xorjoep 1:24714b45cd1b 340 tapCnt = (numTaps - 1U);
xorjoep 1:24714b45cd1b 341
xorjoep 1:24714b45cd1b 342 /* Copy the data */
xorjoep 1:24714b45cd1b 343 while (tapCnt > 0U)
xorjoep 1:24714b45cd1b 344 {
xorjoep 1:24714b45cd1b 345 *pStateCurnt++ = *pState++;
xorjoep 1:24714b45cd1b 346
xorjoep 1:24714b45cd1b 347 /* Decrement the loop counter */
xorjoep 1:24714b45cd1b 348 tapCnt--;
xorjoep 1:24714b45cd1b 349 }
xorjoep 1:24714b45cd1b 350
xorjoep 1:24714b45cd1b 351 #endif /* #if defined (ARM_MATH_DSP) */
xorjoep 1:24714b45cd1b 352
xorjoep 1:24714b45cd1b 353 }
xorjoep 1:24714b45cd1b 354
xorjoep 1:24714b45cd1b 355 /**
xorjoep 1:24714b45cd1b 356 * @} end of LMS group
xorjoep 1:24714b45cd1b 357 */