Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "arm_math.h"
00025
00112 void arm_fir_lattice_f32(
00113 const arm_fir_lattice_instance_f32 * S,
00114 float32_t * pSrc,
00115 float32_t * pDst,
00116 uint32_t blockSize)
00117 {
00118 float32_t *pState;
00119 float32_t *pCoeffs = S->pCoeffs;
00120 float32_t *px;
00121 float32_t *pk, k;
00122 float32_t fcurr1, fnext1, gcurr1, gnext1;
00123 float32_t fcurr2, fnext2, gnext2;
00124 float32_t fcurr3, fnext3, gnext3;
00125 float32_t fcurr4, fnext4, gnext4;
00126 uint32_t numStages = S->numStages;
00127 uint32_t blkCnt, stageCnt;
00128
00129 pState = &S->pState[0];
00130
00131 blkCnt = blockSize >> 2;
00132
00133
00134
00135 while(blkCnt > 0u)
00136 {
00137
00138
00139
00140 fcurr1 = *pSrc++;
00141 fcurr2 = *pSrc++;
00142
00143
00144 pk = (pCoeffs);
00145
00146
00147 px = pState;
00148
00149 k = *pk++;
00150
00151
00152 gcurr1 = *px;
00153
00154
00155
00156 fnext1 = fcurr1 + (k * gcurr1);
00157
00158
00159 gnext1 = (fcurr1 * k) + gcurr1;
00160
00161
00162
00163 fnext2 = fcurr2 + (k * fcurr1);
00164 gnext2 = (fcurr2 * k) + fcurr1;
00165
00166
00167
00168 fcurr3 = *pSrc++;
00169 fcurr4 = *pSrc++;
00170
00171
00172
00173 *px++ = fcurr4;
00174
00175
00176 fnext3 = fcurr3 + (k * fcurr2);
00177 gnext3 = (fcurr3 * k) + fcurr2;
00178
00179
00180 fnext4 = fcurr4 + (k * fcurr3);
00181 gnext4 = (fcurr4 * k) + fcurr3;
00182
00183
00184 fcurr1 = fnext1;
00185 fcurr2 = fnext2;
00186 fcurr3 = fnext3;
00187 fcurr4 = fnext4;
00188
00189
00190 stageCnt = (numStages - 1u) >> 2u;
00191
00192
00193
00194
00195
00196 while(stageCnt > 0u)
00197 {
00198
00199 gcurr1 = *px;
00200
00201
00202 k = *pk;
00203
00204
00205 *px++ = gnext4;
00206
00207
00208
00209
00210 fnext1 = fcurr1 + (k * gcurr1);
00211
00212
00213 fnext2 = fcurr2 + (k * gnext1);
00214
00215 fnext3 = fcurr3 + (k * gnext2);
00216
00217 fnext4 = fcurr4 + (k * gnext3);
00218
00219
00220
00221 gnext4 = (fcurr4 * k) + gnext3;
00222 gnext3 = (fcurr3 * k) + gnext2;
00223 gnext2 = (fcurr2 * k) + gnext1;
00224 gnext1 = (fcurr1 * k) + gcurr1;
00225
00226
00227
00228 gcurr1 = *px;
00229
00230
00231 k = *(pk + 1u);
00232
00233
00234 *px++ = gnext4;
00235
00236
00237
00238
00239 fcurr1 = fnext1 + (k * gcurr1);
00240
00241 fcurr2 = fnext2 + (k * gnext1);
00242
00243 fcurr3 = fnext3 + (k * gnext2);
00244
00245 fcurr4 = fnext4 + (k * gnext3);
00246
00247
00248
00249 gnext4 = (fnext4 * k) + gnext3;
00250 gnext3 = (fnext3 * k) + gnext2;
00251 gnext2 = (fnext2 * k) + gnext1;
00252 gnext1 = (fnext1 * k) + gcurr1;
00253
00254
00255
00256 gcurr1 = *px;
00257
00258
00259 k = *(pk + 2u);
00260
00261
00262 *px++ = gnext4;
00263
00264
00265
00266
00267 fnext1 = fcurr1 + (k * gcurr1);
00268
00269
00270 fnext2 = fcurr2 + (k * gnext1);
00271
00272 fnext3 = fcurr3 + (k * gnext2);
00273
00274 fnext4 = fcurr4 + (k * gnext3);
00275
00276
00277
00278 gnext4 = (fcurr4 * k) + gnext3;
00279 gnext3 = (fcurr3 * k) + gnext2;
00280 gnext2 = (fcurr2 * k) + gnext1;
00281 gnext1 = (fcurr1 * k) + gcurr1;
00282
00283
00284 gcurr1 = *px;
00285
00286
00287 k = *(pk + 3u);
00288
00289
00290 *px++ = gnext4;
00291
00292
00293 pk += 4u;
00294
00295
00296
00297
00298 fcurr1 = fnext1 + (k * gcurr1);
00299
00300 fcurr2 = fnext2 + (k * gnext1);
00301
00302 fcurr3 = fnext3 + (k * gnext2);
00303
00304 fcurr4 = fnext4 + (k * gnext3);
00305
00306
00307
00308 gnext4 = (fnext4 * k) + gnext3;
00309 gnext3 = (fnext3 * k) + gnext2;
00310 gnext2 = (fnext2 * k) + gnext1;
00311 gnext1 = (fnext1 * k) + gcurr1;
00312
00313
00314
00315 stageCnt--;
00316 }
00317
00318
00319 stageCnt = (numStages - 1u) % 0x4u;
00320
00321 while(stageCnt > 0u)
00322 {
00323 gcurr1 = *px;
00324
00325
00326 *px++ = gnext4;
00327
00328
00329 k = (*pk++);
00330
00331
00332 fnext1 = fcurr1 + (k * gcurr1);
00333 fnext2 = fcurr2 + (k * gnext1);
00334 fnext3 = fcurr3 + (k * gnext2);
00335 fnext4 = fcurr4 + (k * gnext3);
00336
00337
00338 gnext4 = (fcurr4 * k) + gnext3;
00339 gnext3 = (fcurr3 * k) + gnext2;
00340 gnext2 = (fcurr2 * k) + gnext1;
00341 gnext1 = (fcurr1 * k) + gcurr1;
00342
00343
00344 fcurr1 = fnext1;
00345 fcurr2 = fnext2;
00346 fcurr3 = fnext3;
00347 fcurr4 = fnext4;
00348
00349 stageCnt--;
00350
00351 }
00352
00353
00354
00355 *pDst++ = fcurr1;
00356 *pDst++ = fcurr2;
00357 *pDst++ = fcurr3;
00358 *pDst++ = fcurr4;
00359
00360 blkCnt--;
00361 }
00362
00363
00364
00365 blkCnt = blockSize % 0x4u;
00366
00367 while(blkCnt > 0u)
00368 {
00369
00370 fcurr1 = *pSrc++;
00371
00372
00373 pk = (pCoeffs);
00374
00375
00376 px = pState;
00377
00378
00379 gcurr1 = *px;
00380
00381
00382 k = (*pk++);
00383
00384
00385
00386 fnext1 = fcurr1 + (k * gcurr1);
00387
00388 gnext1 = (fcurr1 * k) + gcurr1;
00389
00390
00391 *px++ = fcurr1;
00392
00393
00394
00395 fcurr1 = fnext1;
00396
00397 stageCnt = (numStages - 1u);
00398
00399
00400 while(stageCnt > 0u)
00401 {
00402
00403 gcurr1 = *px;
00404
00405
00406 k = (*pk++);
00407
00408
00409 *px++ = gnext1;
00410
00411
00412
00413 fnext1 = fcurr1 + (k * gcurr1);
00414
00415 gnext1 = (fcurr1 * k) + gcurr1;
00416
00417
00418
00419 fcurr1 = fnext1;
00420
00421 stageCnt--;
00422
00423 }
00424
00425
00426 *pDst++ = fcurr1;
00427
00428 blkCnt--;
00429
00430 }
00431 }
00432