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
00111 void arm_iir_lattice_f32(
00112 const arm_iir_lattice_instance_f32 * S,
00113 float32_t * pSrc,
00114 float32_t * pDst,
00115 uint32_t blockSize)
00116 {
00117 float32_t fnext1, gcurr1, gnext;
00118 float32_t acc;
00119 uint32_t blkCnt, tapCnt;
00120 float32_t *px1, *px2, *pk, *pv;
00121 uint32_t numStages = S->numStages;
00122 float32_t *pState;
00123 float32_t *pStateCurnt;
00124 float32_t k1, k2;
00125 float32_t v1, v2, v3, v4;
00126 float32_t gcurr2;
00127 float32_t fnext2;
00128
00129
00130 blkCnt = blockSize;
00131
00132
00133 pState = &S->pState[0];
00134
00135
00136 while(blkCnt > 0u)
00137 {
00138
00139
00140 fnext2 = *pSrc++;
00141
00142
00143 pv = &S->pvCoeffs[0];
00144
00145 pk = &S->pkCoeffs[0];
00146
00147
00148 px1 = pState;
00149
00150 px2 = pState;
00151
00152
00153 acc = 0.0;
00154
00155
00156 tapCnt = (numStages) >> 2;
00157
00158 while(tapCnt > 0u)
00159 {
00160
00161 gcurr1 = *px1;
00162
00163
00164 k1 = *pk;
00165
00166
00167 fnext1 = fnext2 - (k1 * gcurr1);
00168
00169
00170 v1 = *pv;
00171
00172
00173 k2 = *(pk + 1u);
00174
00175
00176 gcurr2 = *(px1 + 1u);
00177
00178
00179 v2 = *(pv + 1u);
00180
00181
00182 fnext2 = fnext1 - (k2 * gcurr2);
00183
00184
00185 gnext = gcurr1 + (k1 * fnext1);
00186
00187
00188 k1 = *(pk + 2u);
00189
00190
00191 *px2++ = gnext;
00192
00193
00194 gcurr1 = *(px1 + 2u);
00195
00196
00197 acc += (gnext * v1);
00198
00199
00200 fnext1 = fnext2 - (k1 * gcurr1);
00201
00202
00203 gnext = gcurr2 + (k2 * fnext2);
00204
00205
00206 gcurr2 = *(px1 + 3u);
00207
00208
00209 acc += (gnext * v2);
00210
00211
00212 k2 = *(pk + 3u);
00213
00214
00215 *px2++ = gnext;
00216
00217
00218 fnext2 = fnext1 - (k2 * gcurr2);
00219
00220
00221 gnext = gcurr1 + (k1 * fnext1);
00222
00223
00224 v3 = *(pv + 2u);
00225
00226
00227 acc += (gnext * v3);
00228
00229
00230 *px2++ = gnext;
00231
00232
00233 pk += 4u;
00234
00235
00236 gnext = (fnext2 * k2) + gcurr2;
00237
00238
00239 v4 = *(pv + 3u);
00240
00241
00242 acc += (gnext * v4);
00243
00244
00245 *px2++ = gnext;
00246
00247
00248 px1 += 4u;
00249 pv += 4u;
00250
00251 tapCnt--;
00252
00253 }
00254
00255
00256 tapCnt = (numStages) % 0x4u;
00257
00258 while(tapCnt > 0u)
00259 {
00260 gcurr1 = *px1++;
00261
00262 fnext1 = fnext2 - ((*pk) * gcurr1);
00263 gnext = (fnext1 * (*pk++)) + gcurr1;
00264
00265 acc += (gnext * (*pv++));
00266 *px2++ = gnext;
00267 fnext2 = fnext1;
00268
00269 tapCnt--;
00270
00271 }
00272
00273
00274 acc += (fnext2 * (*pv));
00275
00276 *px2++ = fnext2;
00277
00278
00279 *pDst++ = acc;
00280
00281
00282 pState = pState + 1u;
00283
00284 blkCnt--;
00285
00286 }
00287
00288
00289
00290
00291
00292 pStateCurnt = &S->pState[0];
00293 pState = &S->pState[blockSize];
00294
00295 tapCnt = numStages >> 2u;
00296
00297
00298 while(tapCnt > 0u)
00299 {
00300 *pStateCurnt++ = *pState++;
00301 *pStateCurnt++ = *pState++;
00302 *pStateCurnt++ = *pState++;
00303 *pStateCurnt++ = *pState++;
00304
00305
00306 tapCnt--;
00307
00308 }
00309
00310
00311 tapCnt = (numStages) % 0x4u;
00312
00313
00314 while(tapCnt > 0u)
00315 {
00316 *pStateCurnt++ = *pState++;
00317
00318
00319 tapCnt--;
00320 }
00321
00322 }
00323
00324
00325
00326