1 /****************************************************************************** 2 * @file filtering_functions.h 3 * @brief Public header file for CMSIS DSP Library 4 * @version V1.9.0 5 * @date 23 April 2021 6 * Target Processor: Cortex-M and Cortex-A cores 7 ******************************************************************************/ 8 /* 9 * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 10 * 11 * SPDX-License-Identifier: Apache-2.0 12 * 13 * Licensed under the Apache License, Version 2.0 (the License); you may 14 * not use this file except in compliance with the License. 15 * You may obtain a copy of the License at 16 * 17 * www.apache.org/licenses/LICENSE-2.0 18 * 19 * Unless required by applicable law or agreed to in writing, software 20 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the License for the specific language governing permissions and 23 * limitations under the License. 24 */ 25 26 27 #ifndef _FILTERING_FUNCTIONS_H_ 28 #define _FILTERING_FUNCTIONS_H_ 29 30 #include "arm_math_types.h" 31 #include "arm_math_memory.h" 32 33 #include "dsp/none.h" 34 #include "dsp/utils.h" 35 36 #include "dsp/support_functions.h" 37 #include "dsp/fast_math_functions.h" 38 39 #ifdef __cplusplus 40 extern "C" 41 { 42 #endif 43 44 45 46 #define DELTA_Q31 ((q31_t)(0x100)) 47 #define DELTA_Q15 ((q15_t)0x5) 48 49 /** 50 * @defgroup groupFilters Filtering Functions 51 */ 52 53 /** 54 * @brief Instance structure for the Q7 FIR filter. 55 */ 56 typedef struct 57 { 58 uint16_t numTaps; /**< number of filter coefficients in the filter. */ 59 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 60 const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 61 } arm_fir_instance_q7; 62 63 /** 64 * @brief Instance structure for the Q15 FIR filter. 65 */ 66 typedef struct 67 { 68 uint16_t numTaps; /**< number of filter coefficients in the filter. */ 69 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 70 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 71 } arm_fir_instance_q15; 72 73 /** 74 * @brief Instance structure for the Q31 FIR filter. 75 */ 76 typedef struct 77 { 78 uint16_t numTaps; /**< number of filter coefficients in the filter. */ 79 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 80 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 81 } arm_fir_instance_q31; 82 83 /** 84 * @brief Instance structure for the floating-point FIR filter. 85 */ 86 typedef struct 87 { 88 uint16_t numTaps; /**< number of filter coefficients in the filter. */ 89 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 90 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 91 } arm_fir_instance_f32; 92 93 /** 94 * @brief Processing function for the Q7 FIR filter. 95 * @param[in] S points to an instance of the Q7 FIR filter structure. 96 * @param[in] pSrc points to the block of input data. 97 * @param[out] pDst points to the block of output data. 98 * @param[in] blockSize number of samples to process. 99 */ 100 void arm_fir_q7( 101 const arm_fir_instance_q7 * S, 102 const q7_t * pSrc, 103 q7_t * pDst, 104 uint32_t blockSize); 105 106 /** 107 * @brief Initialization function for the Q7 FIR filter. 108 * @param[in,out] S points to an instance of the Q7 FIR structure. 109 * @param[in] numTaps Number of filter coefficients in the filter. 110 * @param[in] pCoeffs points to the filter coefficients. 111 * @param[in] pState points to the state buffer. 112 * @param[in] blockSize number of samples that are processed. 113 * 114 * For the MVE version, the coefficient length must be a multiple of 16. 115 * You can pad with zeros if you have less coefficients. 116 */ 117 void arm_fir_init_q7( 118 arm_fir_instance_q7 * S, 119 uint16_t numTaps, 120 const q7_t * pCoeffs, 121 q7_t * pState, 122 uint32_t blockSize); 123 124 /** 125 * @brief Processing function for the Q15 FIR filter. 126 * @param[in] S points to an instance of the Q15 FIR structure. 127 * @param[in] pSrc points to the block of input data. 128 * @param[out] pDst points to the block of output data. 129 * @param[in] blockSize number of samples to process. 130 */ 131 void arm_fir_q15( 132 const arm_fir_instance_q15 * S, 133 const q15_t * pSrc, 134 q15_t * pDst, 135 uint32_t blockSize); 136 137 /** 138 * @brief Processing function for the fast Q15 FIR filter (fast version). 139 * @param[in] S points to an instance of the Q15 FIR filter structure. 140 * @param[in] pSrc points to the block of input data. 141 * @param[out] pDst points to the block of output data. 142 * @param[in] blockSize number of samples to process. 143 */ 144 void arm_fir_fast_q15( 145 const arm_fir_instance_q15 * S, 146 const q15_t * pSrc, 147 q15_t * pDst, 148 uint32_t blockSize); 149 150 /** 151 * @brief Initialization function for the Q15 FIR filter. 152 * @param[in,out] S points to an instance of the Q15 FIR filter structure. 153 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. 154 * @param[in] pCoeffs points to the filter coefficients. 155 * @param[in] pState points to the state buffer. 156 * @param[in] blockSize number of samples that are processed at a time. 157 * @return The function returns either 158 * <code>ARM_MATH_SUCCESS</code> if initialization was successful or 159 * <code>ARM_MATH_ARGUMENT_ERROR</code> if <code>numTaps</code> is not a supported value. 160 * 161 * For the MVE version, the coefficient length must be a multiple of 8. 162 * You can pad with zeros if you have less coefficients. 163 * 164 */ 165 arm_status arm_fir_init_q15( 166 arm_fir_instance_q15 * S, 167 uint16_t numTaps, 168 const q15_t * pCoeffs, 169 q15_t * pState, 170 uint32_t blockSize); 171 172 /** 173 * @brief Processing function for the Q31 FIR filter. 174 * @param[in] S points to an instance of the Q31 FIR filter structure. 175 * @param[in] pSrc points to the block of input data. 176 * @param[out] pDst points to the block of output data. 177 * @param[in] blockSize number of samples to process. 178 */ 179 void arm_fir_q31( 180 const arm_fir_instance_q31 * S, 181 const q31_t * pSrc, 182 q31_t * pDst, 183 uint32_t blockSize); 184 185 /** 186 * @brief Processing function for the fast Q31 FIR filter (fast version). 187 * @param[in] S points to an instance of the Q31 FIR filter structure. 188 * @param[in] pSrc points to the block of input data. 189 * @param[out] pDst points to the block of output data. 190 * @param[in] blockSize number of samples to process. 191 */ 192 void arm_fir_fast_q31( 193 const arm_fir_instance_q31 * S, 194 const q31_t * pSrc, 195 q31_t * pDst, 196 uint32_t blockSize); 197 198 /** 199 * @brief Initialization function for the Q31 FIR filter. 200 * @param[in,out] S points to an instance of the Q31 FIR structure. 201 * @param[in] numTaps Number of filter coefficients in the filter. 202 * @param[in] pCoeffs points to the filter coefficients. 203 * @param[in] pState points to the state buffer. 204 * @param[in] blockSize number of samples that are processed at a time. 205 * 206 * For the MVE version, the coefficient length must be a multiple of 4. 207 * You can pad with zeros if you have less coefficients. 208 */ 209 void arm_fir_init_q31( 210 arm_fir_instance_q31 * S, 211 uint16_t numTaps, 212 const q31_t * pCoeffs, 213 q31_t * pState, 214 uint32_t blockSize); 215 216 /** 217 * @brief Processing function for the floating-point FIR filter. 218 * @param[in] S points to an instance of the floating-point FIR structure. 219 * @param[in] pSrc points to the block of input data. 220 * @param[out] pDst points to the block of output data. 221 * @param[in] blockSize number of samples to process. 222 */ 223 void arm_fir_f32( 224 const arm_fir_instance_f32 * S, 225 const float32_t * pSrc, 226 float32_t * pDst, 227 uint32_t blockSize); 228 229 /** 230 * @brief Initialization function for the floating-point FIR filter. 231 * @param[in,out] S points to an instance of the floating-point FIR filter structure. 232 * @param[in] numTaps Number of filter coefficients in the filter. 233 * @param[in] pCoeffs points to the filter coefficients. 234 * @param[in] pState points to the state buffer. 235 * @param[in] blockSize number of samples that are processed at a time. 236 */ 237 void arm_fir_init_f32( 238 arm_fir_instance_f32 * S, 239 uint16_t numTaps, 240 const float32_t * pCoeffs, 241 float32_t * pState, 242 uint32_t blockSize); 243 244 /** 245 * @brief Instance structure for the Q15 Biquad cascade filter. 246 */ 247 typedef struct 248 { 249 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 250 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ 251 const q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ 252 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ 253 } arm_biquad_casd_df1_inst_q15; 254 255 /** 256 * @brief Instance structure for the Q31 Biquad cascade filter. 257 */ 258 typedef struct 259 { 260 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 261 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ 262 const q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ 263 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ 264 } arm_biquad_casd_df1_inst_q31; 265 266 /** 267 * @brief Instance structure for the floating-point Biquad cascade filter. 268 */ 269 typedef struct 270 { 271 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 272 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ 273 const float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ 274 } arm_biquad_casd_df1_inst_f32; 275 276 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) 277 /** 278 * @brief Instance structure for the modified Biquad coefs required by vectorized code. 279 */ 280 typedef struct 281 { 282 float32_t coeffs[8][4]; /**< Points to the array of modified coefficients. The array is of length 32. There is one per stage */ 283 } arm_biquad_mod_coef_f32; 284 #endif 285 286 /** 287 * @brief Processing function for the Q15 Biquad cascade filter. 288 * @param[in] S points to an instance of the Q15 Biquad cascade structure. 289 * @param[in] pSrc points to the block of input data. 290 * @param[out] pDst points to the block of output data. 291 * @param[in] blockSize number of samples to process. 292 */ 293 void arm_biquad_cascade_df1_q15( 294 const arm_biquad_casd_df1_inst_q15 * S, 295 const q15_t * pSrc, 296 q15_t * pDst, 297 uint32_t blockSize); 298 299 /** 300 * @brief Initialization function for the Q15 Biquad cascade filter. 301 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure. 302 * @param[in] numStages number of 2nd order stages in the filter. 303 * @param[in] pCoeffs points to the filter coefficients. 304 * @param[in] pState points to the state buffer. 305 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format 306 */ 307 void arm_biquad_cascade_df1_init_q15( 308 arm_biquad_casd_df1_inst_q15 * S, 309 uint8_t numStages, 310 const q15_t * pCoeffs, 311 q15_t * pState, 312 int8_t postShift); 313 314 /** 315 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. 316 * @param[in] S points to an instance of the Q15 Biquad cascade structure. 317 * @param[in] pSrc points to the block of input data. 318 * @param[out] pDst points to the block of output data. 319 * @param[in] blockSize number of samples to process. 320 */ 321 void arm_biquad_cascade_df1_fast_q15( 322 const arm_biquad_casd_df1_inst_q15 * S, 323 const q15_t * pSrc, 324 q15_t * pDst, 325 uint32_t blockSize); 326 327 /** 328 * @brief Processing function for the Q31 Biquad cascade filter 329 * @param[in] S points to an instance of the Q31 Biquad cascade structure. 330 * @param[in] pSrc points to the block of input data. 331 * @param[out] pDst points to the block of output data. 332 * @param[in] blockSize number of samples to process. 333 */ 334 void arm_biquad_cascade_df1_q31( 335 const arm_biquad_casd_df1_inst_q31 * S, 336 const q31_t * pSrc, 337 q31_t * pDst, 338 uint32_t blockSize); 339 340 /** 341 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. 342 * @param[in] S points to an instance of the Q31 Biquad cascade structure. 343 * @param[in] pSrc points to the block of input data. 344 * @param[out] pDst points to the block of output data. 345 * @param[in] blockSize number of samples to process. 346 */ 347 void arm_biquad_cascade_df1_fast_q31( 348 const arm_biquad_casd_df1_inst_q31 * S, 349 const q31_t * pSrc, 350 q31_t * pDst, 351 uint32_t blockSize); 352 353 /** 354 * @brief Initialization function for the Q31 Biquad cascade filter. 355 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure. 356 * @param[in] numStages number of 2nd order stages in the filter. 357 * @param[in] pCoeffs points to the filter coefficients. 358 * @param[in] pState points to the state buffer. 359 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format 360 */ 361 void arm_biquad_cascade_df1_init_q31( 362 arm_biquad_casd_df1_inst_q31 * S, 363 uint8_t numStages, 364 const q31_t * pCoeffs, 365 q31_t * pState, 366 int8_t postShift); 367 368 /** 369 * @brief Processing function for the floating-point Biquad cascade filter. 370 * @param[in] S points to an instance of the floating-point Biquad cascade structure. 371 * @param[in] pSrc points to the block of input data. 372 * @param[out] pDst points to the block of output data. 373 * @param[in] blockSize number of samples to process. 374 */ 375 void arm_biquad_cascade_df1_f32( 376 const arm_biquad_casd_df1_inst_f32 * S, 377 const float32_t * pSrc, 378 float32_t * pDst, 379 uint32_t blockSize); 380 381 /** 382 * @brief Initialization function for the floating-point Biquad cascade filter. 383 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure. 384 * @param[in] numStages number of 2nd order stages in the filter. 385 * @param[in] pCoeffs points to the filter coefficients. 386 * @param[in] pCoeffsMod points to the modified filter coefficients (only MVE version). 387 * @param[in] pState points to the state buffer. 388 */ 389 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) 390 void arm_biquad_cascade_df1_mve_init_f32( 391 arm_biquad_casd_df1_inst_f32 * S, 392 uint8_t numStages, 393 const float32_t * pCoeffs, 394 arm_biquad_mod_coef_f32 * pCoeffsMod, 395 float32_t * pState); 396 #endif 397 398 void arm_biquad_cascade_df1_init_f32( 399 arm_biquad_casd_df1_inst_f32 * S, 400 uint8_t numStages, 401 const float32_t * pCoeffs, 402 float32_t * pState); 403 404 405 /** 406 * @brief Convolution of floating-point sequences. 407 * @param[in] pSrcA points to the first input sequence. 408 * @param[in] srcALen length of the first input sequence. 409 * @param[in] pSrcB points to the second input sequence. 410 * @param[in] srcBLen length of the second input sequence. 411 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. 412 */ 413 void arm_conv_f32( 414 const float32_t * pSrcA, 415 uint32_t srcALen, 416 const float32_t * pSrcB, 417 uint32_t srcBLen, 418 float32_t * pDst); 419 420 421 /** 422 * @brief Convolution of Q15 sequences. 423 * @param[in] pSrcA points to the first input sequence. 424 * @param[in] srcALen length of the first input sequence. 425 * @param[in] pSrcB points to the second input sequence. 426 * @param[in] srcBLen length of the second input sequence. 427 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 428 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 429 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). 430 */ 431 void arm_conv_opt_q15( 432 const q15_t * pSrcA, 433 uint32_t srcALen, 434 const q15_t * pSrcB, 435 uint32_t srcBLen, 436 q15_t * pDst, 437 q15_t * pScratch1, 438 q15_t * pScratch2); 439 440 441 /** 442 * @brief Convolution of Q15 sequences. 443 * @param[in] pSrcA points to the first input sequence. 444 * @param[in] srcALen length of the first input sequence. 445 * @param[in] pSrcB points to the second input sequence. 446 * @param[in] srcBLen length of the second input sequence. 447 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. 448 */ 449 void arm_conv_q15( 450 const q15_t * pSrcA, 451 uint32_t srcALen, 452 const q15_t * pSrcB, 453 uint32_t srcBLen, 454 q15_t * pDst); 455 456 457 /** 458 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 459 * @param[in] pSrcA points to the first input sequence. 460 * @param[in] srcALen length of the first input sequence. 461 * @param[in] pSrcB points to the second input sequence. 462 * @param[in] srcBLen length of the second input sequence. 463 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 464 */ 465 void arm_conv_fast_q15( 466 const q15_t * pSrcA, 467 uint32_t srcALen, 468 const q15_t * pSrcB, 469 uint32_t srcBLen, 470 q15_t * pDst); 471 472 473 /** 474 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 475 * @param[in] pSrcA points to the first input sequence. 476 * @param[in] srcALen length of the first input sequence. 477 * @param[in] pSrcB points to the second input sequence. 478 * @param[in] srcBLen length of the second input sequence. 479 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 480 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 481 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). 482 */ 483 void arm_conv_fast_opt_q15( 484 const q15_t * pSrcA, 485 uint32_t srcALen, 486 const q15_t * pSrcB, 487 uint32_t srcBLen, 488 q15_t * pDst, 489 q15_t * pScratch1, 490 q15_t * pScratch2); 491 492 493 /** 494 * @brief Convolution of Q31 sequences. 495 * @param[in] pSrcA points to the first input sequence. 496 * @param[in] srcALen length of the first input sequence. 497 * @param[in] pSrcB points to the second input sequence. 498 * @param[in] srcBLen length of the second input sequence. 499 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 500 */ 501 void arm_conv_q31( 502 const q31_t * pSrcA, 503 uint32_t srcALen, 504 const q31_t * pSrcB, 505 uint32_t srcBLen, 506 q31_t * pDst); 507 508 509 /** 510 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 511 * @param[in] pSrcA points to the first input sequence. 512 * @param[in] srcALen length of the first input sequence. 513 * @param[in] pSrcB points to the second input sequence. 514 * @param[in] srcBLen length of the second input sequence. 515 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 516 */ 517 void arm_conv_fast_q31( 518 const q31_t * pSrcA, 519 uint32_t srcALen, 520 const q31_t * pSrcB, 521 uint32_t srcBLen, 522 q31_t * pDst); 523 524 525 /** 526 * @brief Convolution of Q7 sequences. 527 * @param[in] pSrcA points to the first input sequence. 528 * @param[in] srcALen length of the first input sequence. 529 * @param[in] pSrcB points to the second input sequence. 530 * @param[in] srcBLen length of the second input sequence. 531 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 532 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 533 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). 534 */ 535 void arm_conv_opt_q7( 536 const q7_t * pSrcA, 537 uint32_t srcALen, 538 const q7_t * pSrcB, 539 uint32_t srcBLen, 540 q7_t * pDst, 541 q15_t * pScratch1, 542 q15_t * pScratch2); 543 544 545 /** 546 * @brief Convolution of Q7 sequences. 547 * @param[in] pSrcA points to the first input sequence. 548 * @param[in] srcALen length of the first input sequence. 549 * @param[in] pSrcB points to the second input sequence. 550 * @param[in] srcBLen length of the second input sequence. 551 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. 552 */ 553 void arm_conv_q7( 554 const q7_t * pSrcA, 555 uint32_t srcALen, 556 const q7_t * pSrcB, 557 uint32_t srcBLen, 558 q7_t * pDst); 559 560 561 /** 562 * @brief Partial convolution of floating-point sequences. 563 * @param[in] pSrcA points to the first input sequence. 564 * @param[in] srcALen length of the first input sequence. 565 * @param[in] pSrcB points to the second input sequence. 566 * @param[in] srcBLen length of the second input sequence. 567 * @param[out] pDst points to the block of output data 568 * @param[in] firstIndex is the first output sample to start with. 569 * @param[in] numPoints is the number of output points to be computed. 570 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 571 */ 572 arm_status arm_conv_partial_f32( 573 const float32_t * pSrcA, 574 uint32_t srcALen, 575 const float32_t * pSrcB, 576 uint32_t srcBLen, 577 float32_t * pDst, 578 uint32_t firstIndex, 579 uint32_t numPoints); 580 581 582 /** 583 * @brief Partial convolution of Q15 sequences. 584 * @param[in] pSrcA points to the first input sequence. 585 * @param[in] srcALen length of the first input sequence. 586 * @param[in] pSrcB points to the second input sequence. 587 * @param[in] srcBLen length of the second input sequence. 588 * @param[out] pDst points to the block of output data 589 * @param[in] firstIndex is the first output sample to start with. 590 * @param[in] numPoints is the number of output points to be computed. 591 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 592 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). 593 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 594 */ 595 arm_status arm_conv_partial_opt_q15( 596 const q15_t * pSrcA, 597 uint32_t srcALen, 598 const q15_t * pSrcB, 599 uint32_t srcBLen, 600 q15_t * pDst, 601 uint32_t firstIndex, 602 uint32_t numPoints, 603 q15_t * pScratch1, 604 q15_t * pScratch2); 605 606 607 /** 608 * @brief Partial convolution of Q15 sequences. 609 * @param[in] pSrcA points to the first input sequence. 610 * @param[in] srcALen length of the first input sequence. 611 * @param[in] pSrcB points to the second input sequence. 612 * @param[in] srcBLen length of the second input sequence. 613 * @param[out] pDst points to the block of output data 614 * @param[in] firstIndex is the first output sample to start with. 615 * @param[in] numPoints is the number of output points to be computed. 616 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 617 */ 618 arm_status arm_conv_partial_q15( 619 const q15_t * pSrcA, 620 uint32_t srcALen, 621 const q15_t * pSrcB, 622 uint32_t srcBLen, 623 q15_t * pDst, 624 uint32_t firstIndex, 625 uint32_t numPoints); 626 627 628 /** 629 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 630 * @param[in] pSrcA points to the first input sequence. 631 * @param[in] srcALen length of the first input sequence. 632 * @param[in] pSrcB points to the second input sequence. 633 * @param[in] srcBLen length of the second input sequence. 634 * @param[out] pDst points to the block of output data 635 * @param[in] firstIndex is the first output sample to start with. 636 * @param[in] numPoints is the number of output points to be computed. 637 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 638 */ 639 arm_status arm_conv_partial_fast_q15( 640 const q15_t * pSrcA, 641 uint32_t srcALen, 642 const q15_t * pSrcB, 643 uint32_t srcBLen, 644 q15_t * pDst, 645 uint32_t firstIndex, 646 uint32_t numPoints); 647 648 649 /** 650 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 651 * @param[in] pSrcA points to the first input sequence. 652 * @param[in] srcALen length of the first input sequence. 653 * @param[in] pSrcB points to the second input sequence. 654 * @param[in] srcBLen length of the second input sequence. 655 * @param[out] pDst points to the block of output data 656 * @param[in] firstIndex is the first output sample to start with. 657 * @param[in] numPoints is the number of output points to be computed. 658 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 659 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). 660 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 661 */ 662 arm_status arm_conv_partial_fast_opt_q15( 663 const q15_t * pSrcA, 664 uint32_t srcALen, 665 const q15_t * pSrcB, 666 uint32_t srcBLen, 667 q15_t * pDst, 668 uint32_t firstIndex, 669 uint32_t numPoints, 670 q15_t * pScratch1, 671 q15_t * pScratch2); 672 673 674 /** 675 * @brief Partial convolution of Q31 sequences. 676 * @param[in] pSrcA points to the first input sequence. 677 * @param[in] srcALen length of the first input sequence. 678 * @param[in] pSrcB points to the second input sequence. 679 * @param[in] srcBLen length of the second input sequence. 680 * @param[out] pDst points to the block of output data 681 * @param[in] firstIndex is the first output sample to start with. 682 * @param[in] numPoints is the number of output points to be computed. 683 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 684 */ 685 arm_status arm_conv_partial_q31( 686 const q31_t * pSrcA, 687 uint32_t srcALen, 688 const q31_t * pSrcB, 689 uint32_t srcBLen, 690 q31_t * pDst, 691 uint32_t firstIndex, 692 uint32_t numPoints); 693 694 695 /** 696 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 697 * @param[in] pSrcA points to the first input sequence. 698 * @param[in] srcALen length of the first input sequence. 699 * @param[in] pSrcB points to the second input sequence. 700 * @param[in] srcBLen length of the second input sequence. 701 * @param[out] pDst points to the block of output data 702 * @param[in] firstIndex is the first output sample to start with. 703 * @param[in] numPoints is the number of output points to be computed. 704 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 705 */ 706 arm_status arm_conv_partial_fast_q31( 707 const q31_t * pSrcA, 708 uint32_t srcALen, 709 const q31_t * pSrcB, 710 uint32_t srcBLen, 711 q31_t * pDst, 712 uint32_t firstIndex, 713 uint32_t numPoints); 714 715 716 /** 717 * @brief Partial convolution of Q7 sequences 718 * @param[in] pSrcA points to the first input sequence. 719 * @param[in] srcALen length of the first input sequence. 720 * @param[in] pSrcB points to the second input sequence. 721 * @param[in] srcBLen length of the second input sequence. 722 * @param[out] pDst points to the block of output data 723 * @param[in] firstIndex is the first output sample to start with. 724 * @param[in] numPoints is the number of output points to be computed. 725 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 726 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). 727 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 728 */ 729 arm_status arm_conv_partial_opt_q7( 730 const q7_t * pSrcA, 731 uint32_t srcALen, 732 const q7_t * pSrcB, 733 uint32_t srcBLen, 734 q7_t * pDst, 735 uint32_t firstIndex, 736 uint32_t numPoints, 737 q15_t * pScratch1, 738 q15_t * pScratch2); 739 740 741 /** 742 * @brief Partial convolution of Q7 sequences. 743 * @param[in] pSrcA points to the first input sequence. 744 * @param[in] srcALen length of the first input sequence. 745 * @param[in] pSrcB points to the second input sequence. 746 * @param[in] srcBLen length of the second input sequence. 747 * @param[out] pDst points to the block of output data 748 * @param[in] firstIndex is the first output sample to start with. 749 * @param[in] numPoints is the number of output points to be computed. 750 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. 751 */ 752 arm_status arm_conv_partial_q7( 753 const q7_t * pSrcA, 754 uint32_t srcALen, 755 const q7_t * pSrcB, 756 uint32_t srcBLen, 757 q7_t * pDst, 758 uint32_t firstIndex, 759 uint32_t numPoints); 760 761 762 /** 763 * @brief Instance structure for the Q15 FIR decimator. 764 */ 765 typedef struct 766 { 767 uint8_t M; /**< decimation factor. */ 768 uint16_t numTaps; /**< number of coefficients in the filter. */ 769 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 770 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 771 } arm_fir_decimate_instance_q15; 772 773 /** 774 * @brief Instance structure for the Q31 FIR decimator. 775 */ 776 typedef struct 777 { 778 uint8_t M; /**< decimation factor. */ 779 uint16_t numTaps; /**< number of coefficients in the filter. */ 780 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 781 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 782 } arm_fir_decimate_instance_q31; 783 784 /** 785 @brief Instance structure for floating-point FIR decimator. 786 */ 787 typedef struct 788 { 789 uint8_t M; /**< decimation factor. */ 790 uint16_t numTaps; /**< number of coefficients in the filter. */ 791 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 792 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 793 } arm_fir_decimate_instance_f32; 794 795 796 /** 797 @brief Processing function for floating-point FIR decimator. 798 @param[in] S points to an instance of the floating-point FIR decimator structure 799 @param[in] pSrc points to the block of input data 800 @param[out] pDst points to the block of output data 801 @param[in] blockSize number of samples to process 802 */ 803 void arm_fir_decimate_f32( 804 const arm_fir_decimate_instance_f32 * S, 805 const float32_t * pSrc, 806 float32_t * pDst, 807 uint32_t blockSize); 808 809 810 /** 811 @brief Initialization function for the floating-point FIR decimator. 812 @param[in,out] S points to an instance of the floating-point FIR decimator structure 813 @param[in] numTaps number of coefficients in the filter 814 @param[in] M decimation factor 815 @param[in] pCoeffs points to the filter coefficients 816 @param[in] pState points to the state buffer 817 @param[in] blockSize number of input samples to process per call 818 @return execution status 819 - \ref ARM_MATH_SUCCESS : Operation successful 820 - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code> 821 */ 822 arm_status arm_fir_decimate_init_f32( 823 arm_fir_decimate_instance_f32 * S, 824 uint16_t numTaps, 825 uint8_t M, 826 const float32_t * pCoeffs, 827 float32_t * pState, 828 uint32_t blockSize); 829 830 831 /** 832 * @brief Processing function for the Q15 FIR decimator. 833 * @param[in] S points to an instance of the Q15 FIR decimator structure. 834 * @param[in] pSrc points to the block of input data. 835 * @param[out] pDst points to the block of output data 836 * @param[in] blockSize number of input samples to process per call. 837 */ 838 void arm_fir_decimate_q15( 839 const arm_fir_decimate_instance_q15 * S, 840 const q15_t * pSrc, 841 q15_t * pDst, 842 uint32_t blockSize); 843 844 845 /** 846 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. 847 * @param[in] S points to an instance of the Q15 FIR decimator structure. 848 * @param[in] pSrc points to the block of input data. 849 * @param[out] pDst points to the block of output data 850 * @param[in] blockSize number of input samples to process per call. 851 */ 852 void arm_fir_decimate_fast_q15( 853 const arm_fir_decimate_instance_q15 * S, 854 const q15_t * pSrc, 855 q15_t * pDst, 856 uint32_t blockSize); 857 858 859 /** 860 * @brief Initialization function for the Q15 FIR decimator. 861 * @param[in,out] S points to an instance of the Q15 FIR decimator structure. 862 * @param[in] numTaps number of coefficients in the filter. 863 * @param[in] M decimation factor. 864 * @param[in] pCoeffs points to the filter coefficients. 865 * @param[in] pState points to the state buffer. 866 * @param[in] blockSize number of input samples to process per call. 867 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if 868 * <code>blockSize</code> is not a multiple of <code>M</code>. 869 */ 870 arm_status arm_fir_decimate_init_q15( 871 arm_fir_decimate_instance_q15 * S, 872 uint16_t numTaps, 873 uint8_t M, 874 const q15_t * pCoeffs, 875 q15_t * pState, 876 uint32_t blockSize); 877 878 879 /** 880 * @brief Processing function for the Q31 FIR decimator. 881 * @param[in] S points to an instance of the Q31 FIR decimator structure. 882 * @param[in] pSrc points to the block of input data. 883 * @param[out] pDst points to the block of output data 884 * @param[in] blockSize number of input samples to process per call. 885 */ 886 void arm_fir_decimate_q31( 887 const arm_fir_decimate_instance_q31 * S, 888 const q31_t * pSrc, 889 q31_t * pDst, 890 uint32_t blockSize); 891 892 /** 893 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. 894 * @param[in] S points to an instance of the Q31 FIR decimator structure. 895 * @param[in] pSrc points to the block of input data. 896 * @param[out] pDst points to the block of output data 897 * @param[in] blockSize number of input samples to process per call. 898 */ 899 void arm_fir_decimate_fast_q31( 900 const arm_fir_decimate_instance_q31 * S, 901 const q31_t * pSrc, 902 q31_t * pDst, 903 uint32_t blockSize); 904 905 906 /** 907 * @brief Initialization function for the Q31 FIR decimator. 908 * @param[in,out] S points to an instance of the Q31 FIR decimator structure. 909 * @param[in] numTaps number of coefficients in the filter. 910 * @param[in] M decimation factor. 911 * @param[in] pCoeffs points to the filter coefficients. 912 * @param[in] pState points to the state buffer. 913 * @param[in] blockSize number of input samples to process per call. 914 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if 915 * <code>blockSize</code> is not a multiple of <code>M</code>. 916 */ 917 arm_status arm_fir_decimate_init_q31( 918 arm_fir_decimate_instance_q31 * S, 919 uint16_t numTaps, 920 uint8_t M, 921 const q31_t * pCoeffs, 922 q31_t * pState, 923 uint32_t blockSize); 924 925 926 /** 927 * @brief Instance structure for the Q15 FIR interpolator. 928 */ 929 typedef struct 930 { 931 uint8_t L; /**< upsample factor. */ 932 uint16_t phaseLength; /**< length of each polyphase filter component. */ 933 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ 934 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ 935 } arm_fir_interpolate_instance_q15; 936 937 /** 938 * @brief Instance structure for the Q31 FIR interpolator. 939 */ 940 typedef struct 941 { 942 uint8_t L; /**< upsample factor. */ 943 uint16_t phaseLength; /**< length of each polyphase filter component. */ 944 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ 945 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ 946 } arm_fir_interpolate_instance_q31; 947 948 /** 949 * @brief Instance structure for the floating-point FIR interpolator. 950 */ 951 typedef struct 952 { 953 uint8_t L; /**< upsample factor. */ 954 uint16_t phaseLength; /**< length of each polyphase filter component. */ 955 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ 956 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ 957 } arm_fir_interpolate_instance_f32; 958 959 960 /** 961 * @brief Processing function for the Q15 FIR interpolator. 962 * @param[in] S points to an instance of the Q15 FIR interpolator structure. 963 * @param[in] pSrc points to the block of input data. 964 * @param[out] pDst points to the block of output data. 965 * @param[in] blockSize number of input samples to process per call. 966 */ 967 void arm_fir_interpolate_q15( 968 const arm_fir_interpolate_instance_q15 * S, 969 const q15_t * pSrc, 970 q15_t * pDst, 971 uint32_t blockSize); 972 973 974 /** 975 * @brief Initialization function for the Q15 FIR interpolator. 976 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure. 977 * @param[in] L upsample factor. 978 * @param[in] numTaps number of filter coefficients in the filter. 979 * @param[in] pCoeffs points to the filter coefficient buffer. 980 * @param[in] pState points to the state buffer. 981 * @param[in] blockSize number of input samples to process per call. 982 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if 983 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. 984 */ 985 arm_status arm_fir_interpolate_init_q15( 986 arm_fir_interpolate_instance_q15 * S, 987 uint8_t L, 988 uint16_t numTaps, 989 const q15_t * pCoeffs, 990 q15_t * pState, 991 uint32_t blockSize); 992 993 994 /** 995 * @brief Processing function for the Q31 FIR interpolator. 996 * @param[in] S points to an instance of the Q15 FIR interpolator structure. 997 * @param[in] pSrc points to the block of input data. 998 * @param[out] pDst points to the block of output data. 999 * @param[in] blockSize number of input samples to process per call. 1000 */ 1001 void arm_fir_interpolate_q31( 1002 const arm_fir_interpolate_instance_q31 * S, 1003 const q31_t * pSrc, 1004 q31_t * pDst, 1005 uint32_t blockSize); 1006 1007 1008 /** 1009 * @brief Initialization function for the Q31 FIR interpolator. 1010 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure. 1011 * @param[in] L upsample factor. 1012 * @param[in] numTaps number of filter coefficients in the filter. 1013 * @param[in] pCoeffs points to the filter coefficient buffer. 1014 * @param[in] pState points to the state buffer. 1015 * @param[in] blockSize number of input samples to process per call. 1016 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if 1017 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. 1018 */ 1019 arm_status arm_fir_interpolate_init_q31( 1020 arm_fir_interpolate_instance_q31 * S, 1021 uint8_t L, 1022 uint16_t numTaps, 1023 const q31_t * pCoeffs, 1024 q31_t * pState, 1025 uint32_t blockSize); 1026 1027 1028 /** 1029 * @brief Processing function for the floating-point FIR interpolator. 1030 * @param[in] S points to an instance of the floating-point FIR interpolator structure. 1031 * @param[in] pSrc points to the block of input data. 1032 * @param[out] pDst points to the block of output data. 1033 * @param[in] blockSize number of input samples to process per call. 1034 */ 1035 void arm_fir_interpolate_f32( 1036 const arm_fir_interpolate_instance_f32 * S, 1037 const float32_t * pSrc, 1038 float32_t * pDst, 1039 uint32_t blockSize); 1040 1041 1042 /** 1043 * @brief Initialization function for the floating-point FIR interpolator. 1044 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure. 1045 * @param[in] L upsample factor. 1046 * @param[in] numTaps number of filter coefficients in the filter. 1047 * @param[in] pCoeffs points to the filter coefficient buffer. 1048 * @param[in] pState points to the state buffer. 1049 * @param[in] blockSize number of input samples to process per call. 1050 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if 1051 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. 1052 */ 1053 arm_status arm_fir_interpolate_init_f32( 1054 arm_fir_interpolate_instance_f32 * S, 1055 uint8_t L, 1056 uint16_t numTaps, 1057 const float32_t * pCoeffs, 1058 float32_t * pState, 1059 uint32_t blockSize); 1060 1061 1062 /** 1063 * @brief Instance structure for the high precision Q31 Biquad cascade filter. 1064 */ 1065 typedef struct 1066 { 1067 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 1068 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ 1069 const q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ 1070 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ 1071 } arm_biquad_cas_df1_32x64_ins_q31; 1072 1073 1074 /** 1075 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure. 1076 * @param[in] pSrc points to the block of input data. 1077 * @param[out] pDst points to the block of output data 1078 * @param[in] blockSize number of samples to process. 1079 */ 1080 void arm_biquad_cas_df1_32x64_q31( 1081 const arm_biquad_cas_df1_32x64_ins_q31 * S, 1082 const q31_t * pSrc, 1083 q31_t * pDst, 1084 uint32_t blockSize); 1085 1086 1087 /** 1088 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure. 1089 * @param[in] numStages number of 2nd order stages in the filter. 1090 * @param[in] pCoeffs points to the filter coefficients. 1091 * @param[in] pState points to the state buffer. 1092 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format 1093 */ 1094 void arm_biquad_cas_df1_32x64_init_q31( 1095 arm_biquad_cas_df1_32x64_ins_q31 * S, 1096 uint8_t numStages, 1097 const q31_t * pCoeffs, 1098 q63_t * pState, 1099 uint8_t postShift); 1100 1101 1102 /** 1103 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. 1104 */ 1105 typedef struct 1106 { 1107 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 1108 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ 1109 const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ 1110 } arm_biquad_cascade_df2T_instance_f32; 1111 1112 /** 1113 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. 1114 */ 1115 typedef struct 1116 { 1117 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 1118 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ 1119 const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ 1120 } arm_biquad_cascade_stereo_df2T_instance_f32; 1121 1122 /** 1123 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. 1124 */ 1125 typedef struct 1126 { 1127 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ 1128 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ 1129 const float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ 1130 } arm_biquad_cascade_df2T_instance_f64; 1131 1132 1133 /** 1134 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 1135 * @param[in] S points to an instance of the filter data structure. 1136 * @param[in] pSrc points to the block of input data. 1137 * @param[out] pDst points to the block of output data 1138 * @param[in] blockSize number of samples to process. 1139 */ 1140 void arm_biquad_cascade_df2T_f32( 1141 const arm_biquad_cascade_df2T_instance_f32 * S, 1142 const float32_t * pSrc, 1143 float32_t * pDst, 1144 uint32_t blockSize); 1145 1146 1147 /** 1148 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels 1149 * @param[in] S points to an instance of the filter data structure. 1150 * @param[in] pSrc points to the block of input data. 1151 * @param[out] pDst points to the block of output data 1152 * @param[in] blockSize number of samples to process. 1153 */ 1154 void arm_biquad_cascade_stereo_df2T_f32( 1155 const arm_biquad_cascade_stereo_df2T_instance_f32 * S, 1156 const float32_t * pSrc, 1157 float32_t * pDst, 1158 uint32_t blockSize); 1159 1160 1161 /** 1162 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 1163 * @param[in] S points to an instance of the filter data structure. 1164 * @param[in] pSrc points to the block of input data. 1165 * @param[out] pDst points to the block of output data 1166 * @param[in] blockSize number of samples to process. 1167 */ 1168 void arm_biquad_cascade_df2T_f64( 1169 const arm_biquad_cascade_df2T_instance_f64 * S, 1170 const float64_t * pSrc, 1171 float64_t * pDst, 1172 uint32_t blockSize); 1173 1174 1175 #if defined(ARM_MATH_NEON) 1176 void arm_biquad_cascade_df2T_compute_coefs_f32( 1177 arm_biquad_cascade_df2T_instance_f32 * S, 1178 uint8_t numStages, 1179 float32_t * pCoeffs); 1180 #endif 1181 /** 1182 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. 1183 * @param[in,out] S points to an instance of the filter data structure. 1184 * @param[in] numStages number of 2nd order stages in the filter. 1185 * @param[in] pCoeffs points to the filter coefficients. 1186 * @param[in] pState points to the state buffer. 1187 */ 1188 void arm_biquad_cascade_df2T_init_f32( 1189 arm_biquad_cascade_df2T_instance_f32 * S, 1190 uint8_t numStages, 1191 const float32_t * pCoeffs, 1192 float32_t * pState); 1193 1194 1195 /** 1196 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. 1197 * @param[in,out] S points to an instance of the filter data structure. 1198 * @param[in] numStages number of 2nd order stages in the filter. 1199 * @param[in] pCoeffs points to the filter coefficients. 1200 * @param[in] pState points to the state buffer. 1201 */ 1202 void arm_biquad_cascade_stereo_df2T_init_f32( 1203 arm_biquad_cascade_stereo_df2T_instance_f32 * S, 1204 uint8_t numStages, 1205 const float32_t * pCoeffs, 1206 float32_t * pState); 1207 1208 1209 /** 1210 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. 1211 * @param[in,out] S points to an instance of the filter data structure. 1212 * @param[in] numStages number of 2nd order stages in the filter. 1213 * @param[in] pCoeffs points to the filter coefficients. 1214 * @param[in] pState points to the state buffer. 1215 */ 1216 void arm_biquad_cascade_df2T_init_f64( 1217 arm_biquad_cascade_df2T_instance_f64 * S, 1218 uint8_t numStages, 1219 const float64_t * pCoeffs, 1220 float64_t * pState); 1221 1222 1223 /** 1224 * @brief Instance structure for the Q15 FIR lattice filter. 1225 */ 1226 typedef struct 1227 { 1228 uint16_t numStages; /**< number of filter stages. */ 1229 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ 1230 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ 1231 } arm_fir_lattice_instance_q15; 1232 1233 /** 1234 * @brief Instance structure for the Q31 FIR lattice filter. 1235 */ 1236 typedef struct 1237 { 1238 uint16_t numStages; /**< number of filter stages. */ 1239 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ 1240 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ 1241 } arm_fir_lattice_instance_q31; 1242 1243 /** 1244 * @brief Instance structure for the floating-point FIR lattice filter. 1245 */ 1246 typedef struct 1247 { 1248 uint16_t numStages; /**< number of filter stages. */ 1249 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ 1250 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ 1251 } arm_fir_lattice_instance_f32; 1252 1253 1254 /** 1255 * @brief Initialization function for the Q15 FIR lattice filter. 1256 * @param[in] S points to an instance of the Q15 FIR lattice structure. 1257 * @param[in] numStages number of filter stages. 1258 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. 1259 * @param[in] pState points to the state buffer. The array is of length numStages. 1260 */ 1261 void arm_fir_lattice_init_q15( 1262 arm_fir_lattice_instance_q15 * S, 1263 uint16_t numStages, 1264 const q15_t * pCoeffs, 1265 q15_t * pState); 1266 1267 1268 /** 1269 * @brief Processing function for the Q15 FIR lattice filter. 1270 * @param[in] S points to an instance of the Q15 FIR lattice structure. 1271 * @param[in] pSrc points to the block of input data. 1272 * @param[out] pDst points to the block of output data. 1273 * @param[in] blockSize number of samples to process. 1274 */ 1275 void arm_fir_lattice_q15( 1276 const arm_fir_lattice_instance_q15 * S, 1277 const q15_t * pSrc, 1278 q15_t * pDst, 1279 uint32_t blockSize); 1280 1281 1282 /** 1283 * @brief Initialization function for the Q31 FIR lattice filter. 1284 * @param[in] S points to an instance of the Q31 FIR lattice structure. 1285 * @param[in] numStages number of filter stages. 1286 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. 1287 * @param[in] pState points to the state buffer. The array is of length numStages. 1288 */ 1289 void arm_fir_lattice_init_q31( 1290 arm_fir_lattice_instance_q31 * S, 1291 uint16_t numStages, 1292 const q31_t * pCoeffs, 1293 q31_t * pState); 1294 1295 1296 /** 1297 * @brief Processing function for the Q31 FIR lattice filter. 1298 * @param[in] S points to an instance of the Q31 FIR lattice structure. 1299 * @param[in] pSrc points to the block of input data. 1300 * @param[out] pDst points to the block of output data 1301 * @param[in] blockSize number of samples to process. 1302 */ 1303 void arm_fir_lattice_q31( 1304 const arm_fir_lattice_instance_q31 * S, 1305 const q31_t * pSrc, 1306 q31_t * pDst, 1307 uint32_t blockSize); 1308 1309 1310 /** 1311 * @brief Initialization function for the floating-point FIR lattice filter. 1312 * @param[in] S points to an instance of the floating-point FIR lattice structure. 1313 * @param[in] numStages number of filter stages. 1314 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. 1315 * @param[in] pState points to the state buffer. The array is of length numStages. 1316 */ 1317 void arm_fir_lattice_init_f32( 1318 arm_fir_lattice_instance_f32 * S, 1319 uint16_t numStages, 1320 const float32_t * pCoeffs, 1321 float32_t * pState); 1322 1323 1324 /** 1325 * @brief Processing function for the floating-point FIR lattice filter. 1326 * @param[in] S points to an instance of the floating-point FIR lattice structure. 1327 * @param[in] pSrc points to the block of input data. 1328 * @param[out] pDst points to the block of output data 1329 * @param[in] blockSize number of samples to process. 1330 */ 1331 void arm_fir_lattice_f32( 1332 const arm_fir_lattice_instance_f32 * S, 1333 const float32_t * pSrc, 1334 float32_t * pDst, 1335 uint32_t blockSize); 1336 1337 1338 /** 1339 * @brief Instance structure for the Q15 IIR lattice filter. 1340 */ 1341 typedef struct 1342 { 1343 uint16_t numStages; /**< number of stages in the filter. */ 1344 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ 1345 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ 1346 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ 1347 } arm_iir_lattice_instance_q15; 1348 1349 /** 1350 * @brief Instance structure for the Q31 IIR lattice filter. 1351 */ 1352 typedef struct 1353 { 1354 uint16_t numStages; /**< number of stages in the filter. */ 1355 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ 1356 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ 1357 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ 1358 } arm_iir_lattice_instance_q31; 1359 1360 /** 1361 * @brief Instance structure for the floating-point IIR lattice filter. 1362 */ 1363 typedef struct 1364 { 1365 uint16_t numStages; /**< number of stages in the filter. */ 1366 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ 1367 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ 1368 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ 1369 } arm_iir_lattice_instance_f32; 1370 1371 1372 /** 1373 * @brief Processing function for the floating-point IIR lattice filter. 1374 * @param[in] S points to an instance of the floating-point IIR lattice structure. 1375 * @param[in] pSrc points to the block of input data. 1376 * @param[out] pDst points to the block of output data. 1377 * @param[in] blockSize number of samples to process. 1378 */ 1379 void arm_iir_lattice_f32( 1380 const arm_iir_lattice_instance_f32 * S, 1381 const float32_t * pSrc, 1382 float32_t * pDst, 1383 uint32_t blockSize); 1384 1385 1386 /** 1387 * @brief Initialization function for the floating-point IIR lattice filter. 1388 * @param[in] S points to an instance of the floating-point IIR lattice structure. 1389 * @param[in] numStages number of stages in the filter. 1390 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. 1391 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. 1392 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1. 1393 * @param[in] blockSize number of samples to process. 1394 */ 1395 void arm_iir_lattice_init_f32( 1396 arm_iir_lattice_instance_f32 * S, 1397 uint16_t numStages, 1398 float32_t * pkCoeffs, 1399 float32_t * pvCoeffs, 1400 float32_t * pState, 1401 uint32_t blockSize); 1402 1403 1404 /** 1405 * @brief Processing function for the Q31 IIR lattice filter. 1406 * @param[in] S points to an instance of the Q31 IIR lattice structure. 1407 * @param[in] pSrc points to the block of input data. 1408 * @param[out] pDst points to the block of output data. 1409 * @param[in] blockSize number of samples to process. 1410 */ 1411 void arm_iir_lattice_q31( 1412 const arm_iir_lattice_instance_q31 * S, 1413 const q31_t * pSrc, 1414 q31_t * pDst, 1415 uint32_t blockSize); 1416 1417 1418 /** 1419 * @brief Initialization function for the Q31 IIR lattice filter. 1420 * @param[in] S points to an instance of the Q31 IIR lattice structure. 1421 * @param[in] numStages number of stages in the filter. 1422 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. 1423 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. 1424 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize. 1425 * @param[in] blockSize number of samples to process. 1426 */ 1427 void arm_iir_lattice_init_q31( 1428 arm_iir_lattice_instance_q31 * S, 1429 uint16_t numStages, 1430 q31_t * pkCoeffs, 1431 q31_t * pvCoeffs, 1432 q31_t * pState, 1433 uint32_t blockSize); 1434 1435 1436 /** 1437 * @brief Processing function for the Q15 IIR lattice filter. 1438 * @param[in] S points to an instance of the Q15 IIR lattice structure. 1439 * @param[in] pSrc points to the block of input data. 1440 * @param[out] pDst points to the block of output data. 1441 * @param[in] blockSize number of samples to process. 1442 */ 1443 void arm_iir_lattice_q15( 1444 const arm_iir_lattice_instance_q15 * S, 1445 const q15_t * pSrc, 1446 q15_t * pDst, 1447 uint32_t blockSize); 1448 1449 1450 /** 1451 * @brief Initialization function for the Q15 IIR lattice filter. 1452 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure. 1453 * @param[in] numStages number of stages in the filter. 1454 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages. 1455 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. 1456 * @param[in] pState points to state buffer. The array is of length numStages+blockSize. 1457 * @param[in] blockSize number of samples to process per call. 1458 */ 1459 void arm_iir_lattice_init_q15( 1460 arm_iir_lattice_instance_q15 * S, 1461 uint16_t numStages, 1462 q15_t * pkCoeffs, 1463 q15_t * pvCoeffs, 1464 q15_t * pState, 1465 uint32_t blockSize); 1466 1467 1468 /** 1469 * @brief Instance structure for the floating-point LMS filter. 1470 */ 1471 typedef struct 1472 { 1473 uint16_t numTaps; /**< number of coefficients in the filter. */ 1474 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 1475 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 1476 float32_t mu; /**< step size that controls filter coefficient updates. */ 1477 } arm_lms_instance_f32; 1478 1479 1480 /** 1481 * @brief Processing function for floating-point LMS filter. 1482 * @param[in] S points to an instance of the floating-point LMS filter structure. 1483 * @param[in] pSrc points to the block of input data. 1484 * @param[in] pRef points to the block of reference data. 1485 * @param[out] pOut points to the block of output data. 1486 * @param[out] pErr points to the block of error data. 1487 * @param[in] blockSize number of samples to process. 1488 */ 1489 void arm_lms_f32( 1490 const arm_lms_instance_f32 * S, 1491 const float32_t * pSrc, 1492 float32_t * pRef, 1493 float32_t * pOut, 1494 float32_t * pErr, 1495 uint32_t blockSize); 1496 1497 1498 /** 1499 * @brief Initialization function for floating-point LMS filter. 1500 * @param[in] S points to an instance of the floating-point LMS filter structure. 1501 * @param[in] numTaps number of filter coefficients. 1502 * @param[in] pCoeffs points to the coefficient buffer. 1503 * @param[in] pState points to state buffer. 1504 * @param[in] mu step size that controls filter coefficient updates. 1505 * @param[in] blockSize number of samples to process. 1506 */ 1507 void arm_lms_init_f32( 1508 arm_lms_instance_f32 * S, 1509 uint16_t numTaps, 1510 float32_t * pCoeffs, 1511 float32_t * pState, 1512 float32_t mu, 1513 uint32_t blockSize); 1514 1515 1516 /** 1517 * @brief Instance structure for the Q15 LMS filter. 1518 */ 1519 typedef struct 1520 { 1521 uint16_t numTaps; /**< number of coefficients in the filter. */ 1522 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 1523 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 1524 q15_t mu; /**< step size that controls filter coefficient updates. */ 1525 uint32_t postShift; /**< bit shift applied to coefficients. */ 1526 } arm_lms_instance_q15; 1527 1528 1529 /** 1530 * @brief Initialization function for the Q15 LMS filter. 1531 * @param[in] S points to an instance of the Q15 LMS filter structure. 1532 * @param[in] numTaps number of filter coefficients. 1533 * @param[in] pCoeffs points to the coefficient buffer. 1534 * @param[in] pState points to the state buffer. 1535 * @param[in] mu step size that controls filter coefficient updates. 1536 * @param[in] blockSize number of samples to process. 1537 * @param[in] postShift bit shift applied to coefficients. 1538 */ 1539 void arm_lms_init_q15( 1540 arm_lms_instance_q15 * S, 1541 uint16_t numTaps, 1542 q15_t * pCoeffs, 1543 q15_t * pState, 1544 q15_t mu, 1545 uint32_t blockSize, 1546 uint32_t postShift); 1547 1548 1549 /** 1550 * @brief Processing function for Q15 LMS filter. 1551 * @param[in] S points to an instance of the Q15 LMS filter structure. 1552 * @param[in] pSrc points to the block of input data. 1553 * @param[in] pRef points to the block of reference data. 1554 * @param[out] pOut points to the block of output data. 1555 * @param[out] pErr points to the block of error data. 1556 * @param[in] blockSize number of samples to process. 1557 */ 1558 void arm_lms_q15( 1559 const arm_lms_instance_q15 * S, 1560 const q15_t * pSrc, 1561 q15_t * pRef, 1562 q15_t * pOut, 1563 q15_t * pErr, 1564 uint32_t blockSize); 1565 1566 1567 /** 1568 * @brief Instance structure for the Q31 LMS filter. 1569 */ 1570 typedef struct 1571 { 1572 uint16_t numTaps; /**< number of coefficients in the filter. */ 1573 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 1574 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 1575 q31_t mu; /**< step size that controls filter coefficient updates. */ 1576 uint32_t postShift; /**< bit shift applied to coefficients. */ 1577 } arm_lms_instance_q31; 1578 1579 1580 /** 1581 * @brief Processing function for Q31 LMS filter. 1582 * @param[in] S points to an instance of the Q15 LMS filter structure. 1583 * @param[in] pSrc points to the block of input data. 1584 * @param[in] pRef points to the block of reference data. 1585 * @param[out] pOut points to the block of output data. 1586 * @param[out] pErr points to the block of error data. 1587 * @param[in] blockSize number of samples to process. 1588 */ 1589 void arm_lms_q31( 1590 const arm_lms_instance_q31 * S, 1591 const q31_t * pSrc, 1592 q31_t * pRef, 1593 q31_t * pOut, 1594 q31_t * pErr, 1595 uint32_t blockSize); 1596 1597 1598 /** 1599 * @brief Initialization function for Q31 LMS filter. 1600 * @param[in] S points to an instance of the Q31 LMS filter structure. 1601 * @param[in] numTaps number of filter coefficients. 1602 * @param[in] pCoeffs points to coefficient buffer. 1603 * @param[in] pState points to state buffer. 1604 * @param[in] mu step size that controls filter coefficient updates. 1605 * @param[in] blockSize number of samples to process. 1606 * @param[in] postShift bit shift applied to coefficients. 1607 */ 1608 void arm_lms_init_q31( 1609 arm_lms_instance_q31 * S, 1610 uint16_t numTaps, 1611 q31_t * pCoeffs, 1612 q31_t * pState, 1613 q31_t mu, 1614 uint32_t blockSize, 1615 uint32_t postShift); 1616 1617 1618 /** 1619 * @brief Instance structure for the floating-point normalized LMS filter. 1620 */ 1621 typedef struct 1622 { 1623 uint16_t numTaps; /**< number of coefficients in the filter. */ 1624 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 1625 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 1626 float32_t mu; /**< step size that control filter coefficient updates. */ 1627 float32_t energy; /**< saves previous frame energy. */ 1628 float32_t x0; /**< saves previous input sample. */ 1629 } arm_lms_norm_instance_f32; 1630 1631 1632 /** 1633 * @brief Processing function for floating-point normalized LMS filter. 1634 * @param[in] S points to an instance of the floating-point normalized LMS filter structure. 1635 * @param[in] pSrc points to the block of input data. 1636 * @param[in] pRef points to the block of reference data. 1637 * @param[out] pOut points to the block of output data. 1638 * @param[out] pErr points to the block of error data. 1639 * @param[in] blockSize number of samples to process. 1640 */ 1641 void arm_lms_norm_f32( 1642 arm_lms_norm_instance_f32 * S, 1643 const float32_t * pSrc, 1644 float32_t * pRef, 1645 float32_t * pOut, 1646 float32_t * pErr, 1647 uint32_t blockSize); 1648 1649 1650 /** 1651 * @brief Initialization function for floating-point normalized LMS filter. 1652 * @param[in] S points to an instance of the floating-point LMS filter structure. 1653 * @param[in] numTaps number of filter coefficients. 1654 * @param[in] pCoeffs points to coefficient buffer. 1655 * @param[in] pState points to state buffer. 1656 * @param[in] mu step size that controls filter coefficient updates. 1657 * @param[in] blockSize number of samples to process. 1658 */ 1659 void arm_lms_norm_init_f32( 1660 arm_lms_norm_instance_f32 * S, 1661 uint16_t numTaps, 1662 float32_t * pCoeffs, 1663 float32_t * pState, 1664 float32_t mu, 1665 uint32_t blockSize); 1666 1667 1668 /** 1669 * @brief Instance structure for the Q31 normalized LMS filter. 1670 */ 1671 typedef struct 1672 { 1673 uint16_t numTaps; /**< number of coefficients in the filter. */ 1674 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 1675 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 1676 q31_t mu; /**< step size that controls filter coefficient updates. */ 1677 uint8_t postShift; /**< bit shift applied to coefficients. */ 1678 const q31_t *recipTable; /**< points to the reciprocal initial value table. */ 1679 q31_t energy; /**< saves previous frame energy. */ 1680 q31_t x0; /**< saves previous input sample. */ 1681 } arm_lms_norm_instance_q31; 1682 1683 1684 /** 1685 * @brief Processing function for Q31 normalized LMS filter. 1686 * @param[in] S points to an instance of the Q31 normalized LMS filter structure. 1687 * @param[in] pSrc points to the block of input data. 1688 * @param[in] pRef points to the block of reference data. 1689 * @param[out] pOut points to the block of output data. 1690 * @param[out] pErr points to the block of error data. 1691 * @param[in] blockSize number of samples to process. 1692 */ 1693 void arm_lms_norm_q31( 1694 arm_lms_norm_instance_q31 * S, 1695 const q31_t * pSrc, 1696 q31_t * pRef, 1697 q31_t * pOut, 1698 q31_t * pErr, 1699 uint32_t blockSize); 1700 1701 1702 /** 1703 * @brief Initialization function for Q31 normalized LMS filter. 1704 * @param[in] S points to an instance of the Q31 normalized LMS filter structure. 1705 * @param[in] numTaps number of filter coefficients. 1706 * @param[in] pCoeffs points to coefficient buffer. 1707 * @param[in] pState points to state buffer. 1708 * @param[in] mu step size that controls filter coefficient updates. 1709 * @param[in] blockSize number of samples to process. 1710 * @param[in] postShift bit shift applied to coefficients. 1711 */ 1712 void arm_lms_norm_init_q31( 1713 arm_lms_norm_instance_q31 * S, 1714 uint16_t numTaps, 1715 q31_t * pCoeffs, 1716 q31_t * pState, 1717 q31_t mu, 1718 uint32_t blockSize, 1719 uint8_t postShift); 1720 1721 1722 /** 1723 * @brief Instance structure for the Q15 normalized LMS filter. 1724 */ 1725 typedef struct 1726 { 1727 uint16_t numTaps; /**< Number of coefficients in the filter. */ 1728 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ 1729 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ 1730 q15_t mu; /**< step size that controls filter coefficient updates. */ 1731 uint8_t postShift; /**< bit shift applied to coefficients. */ 1732 const q15_t *recipTable; /**< Points to the reciprocal initial value table. */ 1733 q15_t energy; /**< saves previous frame energy. */ 1734 q15_t x0; /**< saves previous input sample. */ 1735 } arm_lms_norm_instance_q15; 1736 1737 1738 /** 1739 * @brief Processing function for Q15 normalized LMS filter. 1740 * @param[in] S points to an instance of the Q15 normalized LMS filter structure. 1741 * @param[in] pSrc points to the block of input data. 1742 * @param[in] pRef points to the block of reference data. 1743 * @param[out] pOut points to the block of output data. 1744 * @param[out] pErr points to the block of error data. 1745 * @param[in] blockSize number of samples to process. 1746 */ 1747 void arm_lms_norm_q15( 1748 arm_lms_norm_instance_q15 * S, 1749 const q15_t * pSrc, 1750 q15_t * pRef, 1751 q15_t * pOut, 1752 q15_t * pErr, 1753 uint32_t blockSize); 1754 1755 1756 /** 1757 * @brief Initialization function for Q15 normalized LMS filter. 1758 * @param[in] S points to an instance of the Q15 normalized LMS filter structure. 1759 * @param[in] numTaps number of filter coefficients. 1760 * @param[in] pCoeffs points to coefficient buffer. 1761 * @param[in] pState points to state buffer. 1762 * @param[in] mu step size that controls filter coefficient updates. 1763 * @param[in] blockSize number of samples to process. 1764 * @param[in] postShift bit shift applied to coefficients. 1765 */ 1766 void arm_lms_norm_init_q15( 1767 arm_lms_norm_instance_q15 * S, 1768 uint16_t numTaps, 1769 q15_t * pCoeffs, 1770 q15_t * pState, 1771 q15_t mu, 1772 uint32_t blockSize, 1773 uint8_t postShift); 1774 1775 1776 /** 1777 * @brief Correlation of floating-point sequences. 1778 * @param[in] pSrcA points to the first input sequence. 1779 * @param[in] srcALen length of the first input sequence. 1780 * @param[in] pSrcB points to the second input sequence. 1781 * @param[in] srcBLen length of the second input sequence. 1782 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1783 */ 1784 void arm_correlate_f32( 1785 const float32_t * pSrcA, 1786 uint32_t srcALen, 1787 const float32_t * pSrcB, 1788 uint32_t srcBLen, 1789 float32_t * pDst); 1790 1791 1792 /** 1793 @brief Correlation of Q15 sequences 1794 @param[in] pSrcA points to the first input sequence 1795 @param[in] srcALen length of the first input sequence 1796 @param[in] pSrcB points to the second input sequence 1797 @param[in] srcBLen length of the second input sequence 1798 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1799 @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 1800 */ 1801 void arm_correlate_opt_q15( 1802 const q15_t * pSrcA, 1803 uint32_t srcALen, 1804 const q15_t * pSrcB, 1805 uint32_t srcBLen, 1806 q15_t * pDst, 1807 q15_t * pScratch); 1808 1809 1810 /** 1811 @brief Correlation of Q15 sequences. 1812 @param[in] pSrcA points to the first input sequence 1813 @param[in] srcALen length of the first input sequence 1814 @param[in] pSrcB points to the second input sequence 1815 @param[in] srcBLen length of the second input sequence 1816 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1817 */ 1818 void arm_correlate_q15( 1819 const q15_t * pSrcA, 1820 uint32_t srcALen, 1821 const q15_t * pSrcB, 1822 uint32_t srcBLen, 1823 q15_t * pDst); 1824 1825 1826 /** 1827 @brief Correlation of Q15 sequences (fast version). 1828 @param[in] pSrcA points to the first input sequence 1829 @param[in] srcALen length of the first input sequence 1830 @param[in] pSrcB points to the second input sequence 1831 @param[in] srcBLen length of the second input sequence 1832 @param[out] pDst points to the location where the output result is written. Length 2 * max(srcALen, srcBLen) - 1. 1833 @return none 1834 */ 1835 void arm_correlate_fast_q15( 1836 const q15_t * pSrcA, 1837 uint32_t srcALen, 1838 const q15_t * pSrcB, 1839 uint32_t srcBLen, 1840 q15_t * pDst); 1841 1842 1843 /** 1844 @brief Correlation of Q15 sequences (fast version). 1845 @param[in] pSrcA points to the first input sequence. 1846 @param[in] srcALen length of the first input sequence. 1847 @param[in] pSrcB points to the second input sequence. 1848 @param[in] srcBLen length of the second input sequence. 1849 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1850 @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 1851 */ 1852 void arm_correlate_fast_opt_q15( 1853 const q15_t * pSrcA, 1854 uint32_t srcALen, 1855 const q15_t * pSrcB, 1856 uint32_t srcBLen, 1857 q15_t * pDst, 1858 q15_t * pScratch); 1859 1860 1861 /** 1862 * @brief Correlation of Q31 sequences. 1863 * @param[in] pSrcA points to the first input sequence. 1864 * @param[in] srcALen length of the first input sequence. 1865 * @param[in] pSrcB points to the second input sequence. 1866 * @param[in] srcBLen length of the second input sequence. 1867 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1868 */ 1869 void arm_correlate_q31( 1870 const q31_t * pSrcA, 1871 uint32_t srcALen, 1872 const q31_t * pSrcB, 1873 uint32_t srcBLen, 1874 q31_t * pDst); 1875 1876 1877 /** 1878 @brief Correlation of Q31 sequences (fast version). 1879 @param[in] pSrcA points to the first input sequence 1880 @param[in] srcALen length of the first input sequence 1881 @param[in] pSrcB points to the second input sequence 1882 @param[in] srcBLen length of the second input sequence 1883 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1884 */ 1885 void arm_correlate_fast_q31( 1886 const q31_t * pSrcA, 1887 uint32_t srcALen, 1888 const q31_t * pSrcB, 1889 uint32_t srcBLen, 1890 q31_t * pDst); 1891 1892 1893 /** 1894 * @brief Correlation of Q7 sequences. 1895 * @param[in] pSrcA points to the first input sequence. 1896 * @param[in] srcALen length of the first input sequence. 1897 * @param[in] pSrcB points to the second input sequence. 1898 * @param[in] srcBLen length of the second input sequence. 1899 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1900 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. 1901 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). 1902 */ 1903 void arm_correlate_opt_q7( 1904 const q7_t * pSrcA, 1905 uint32_t srcALen, 1906 const q7_t * pSrcB, 1907 uint32_t srcBLen, 1908 q7_t * pDst, 1909 q15_t * pScratch1, 1910 q15_t * pScratch2); 1911 1912 1913 /** 1914 * @brief Correlation of Q7 sequences. 1915 * @param[in] pSrcA points to the first input sequence. 1916 * @param[in] srcALen length of the first input sequence. 1917 * @param[in] pSrcB points to the second input sequence. 1918 * @param[in] srcBLen length of the second input sequence. 1919 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. 1920 */ 1921 void arm_correlate_q7( 1922 const q7_t * pSrcA, 1923 uint32_t srcALen, 1924 const q7_t * pSrcB, 1925 uint32_t srcBLen, 1926 q7_t * pDst); 1927 1928 1929 /** 1930 * @brief Instance structure for the floating-point sparse FIR filter. 1931 */ 1932 typedef struct 1933 { 1934 uint16_t numTaps; /**< number of coefficients in the filter. */ 1935 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ 1936 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ 1937 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 1938 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ 1939 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ 1940 } arm_fir_sparse_instance_f32; 1941 1942 /** 1943 * @brief Instance structure for the Q31 sparse FIR filter. 1944 */ 1945 typedef struct 1946 { 1947 uint16_t numTaps; /**< number of coefficients in the filter. */ 1948 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ 1949 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ 1950 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 1951 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ 1952 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ 1953 } arm_fir_sparse_instance_q31; 1954 1955 /** 1956 * @brief Instance structure for the Q15 sparse FIR filter. 1957 */ 1958 typedef struct 1959 { 1960 uint16_t numTaps; /**< number of coefficients in the filter. */ 1961 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ 1962 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ 1963 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 1964 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ 1965 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ 1966 } arm_fir_sparse_instance_q15; 1967 1968 /** 1969 * @brief Instance structure for the Q7 sparse FIR filter. 1970 */ 1971 typedef struct 1972 { 1973 uint16_t numTaps; /**< number of coefficients in the filter. */ 1974 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ 1975 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ 1976 const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ 1977 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ 1978 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ 1979 } arm_fir_sparse_instance_q7; 1980 1981 1982 /** 1983 * @brief Processing function for the floating-point sparse FIR filter. 1984 * @param[in] S points to an instance of the floating-point sparse FIR structure. 1985 * @param[in] pSrc points to the block of input data. 1986 * @param[out] pDst points to the block of output data 1987 * @param[in] pScratchIn points to a temporary buffer of size blockSize. 1988 * @param[in] blockSize number of input samples to process per call. 1989 */ 1990 void arm_fir_sparse_f32( 1991 arm_fir_sparse_instance_f32 * S, 1992 const float32_t * pSrc, 1993 float32_t * pDst, 1994 float32_t * pScratchIn, 1995 uint32_t blockSize); 1996 1997 1998 /** 1999 * @brief Initialization function for the floating-point sparse FIR filter. 2000 * @param[in,out] S points to an instance of the floating-point sparse FIR structure. 2001 * @param[in] numTaps number of nonzero coefficients in the filter. 2002 * @param[in] pCoeffs points to the array of filter coefficients. 2003 * @param[in] pState points to the state buffer. 2004 * @param[in] pTapDelay points to the array of offset times. 2005 * @param[in] maxDelay maximum offset time supported. 2006 * @param[in] blockSize number of samples that will be processed per block. 2007 */ 2008 void arm_fir_sparse_init_f32( 2009 arm_fir_sparse_instance_f32 * S, 2010 uint16_t numTaps, 2011 const float32_t * pCoeffs, 2012 float32_t * pState, 2013 int32_t * pTapDelay, 2014 uint16_t maxDelay, 2015 uint32_t blockSize); 2016 2017 2018 /** 2019 * @brief Processing function for the Q31 sparse FIR filter. 2020 * @param[in] S points to an instance of the Q31 sparse FIR structure. 2021 * @param[in] pSrc points to the block of input data. 2022 * @param[out] pDst points to the block of output data 2023 * @param[in] pScratchIn points to a temporary buffer of size blockSize. 2024 * @param[in] blockSize number of input samples to process per call. 2025 */ 2026 void arm_fir_sparse_q31( 2027 arm_fir_sparse_instance_q31 * S, 2028 const q31_t * pSrc, 2029 q31_t * pDst, 2030 q31_t * pScratchIn, 2031 uint32_t blockSize); 2032 2033 2034 /** 2035 * @brief Initialization function for the Q31 sparse FIR filter. 2036 * @param[in,out] S points to an instance of the Q31 sparse FIR structure. 2037 * @param[in] numTaps number of nonzero coefficients in the filter. 2038 * @param[in] pCoeffs points to the array of filter coefficients. 2039 * @param[in] pState points to the state buffer. 2040 * @param[in] pTapDelay points to the array of offset times. 2041 * @param[in] maxDelay maximum offset time supported. 2042 * @param[in] blockSize number of samples that will be processed per block. 2043 */ 2044 void arm_fir_sparse_init_q31( 2045 arm_fir_sparse_instance_q31 * S, 2046 uint16_t numTaps, 2047 const q31_t * pCoeffs, 2048 q31_t * pState, 2049 int32_t * pTapDelay, 2050 uint16_t maxDelay, 2051 uint32_t blockSize); 2052 2053 2054 /** 2055 * @brief Processing function for the Q15 sparse FIR filter. 2056 * @param[in] S points to an instance of the Q15 sparse FIR structure. 2057 * @param[in] pSrc points to the block of input data. 2058 * @param[out] pDst points to the block of output data 2059 * @param[in] pScratchIn points to a temporary buffer of size blockSize. 2060 * @param[in] pScratchOut points to a temporary buffer of size blockSize. 2061 * @param[in] blockSize number of input samples to process per call. 2062 */ 2063 void arm_fir_sparse_q15( 2064 arm_fir_sparse_instance_q15 * S, 2065 const q15_t * pSrc, 2066 q15_t * pDst, 2067 q15_t * pScratchIn, 2068 q31_t * pScratchOut, 2069 uint32_t blockSize); 2070 2071 2072 /** 2073 * @brief Initialization function for the Q15 sparse FIR filter. 2074 * @param[in,out] S points to an instance of the Q15 sparse FIR structure. 2075 * @param[in] numTaps number of nonzero coefficients in the filter. 2076 * @param[in] pCoeffs points to the array of filter coefficients. 2077 * @param[in] pState points to the state buffer. 2078 * @param[in] pTapDelay points to the array of offset times. 2079 * @param[in] maxDelay maximum offset time supported. 2080 * @param[in] blockSize number of samples that will be processed per block. 2081 */ 2082 void arm_fir_sparse_init_q15( 2083 arm_fir_sparse_instance_q15 * S, 2084 uint16_t numTaps, 2085 const q15_t * pCoeffs, 2086 q15_t * pState, 2087 int32_t * pTapDelay, 2088 uint16_t maxDelay, 2089 uint32_t blockSize); 2090 2091 2092 /** 2093 * @brief Processing function for the Q7 sparse FIR filter. 2094 * @param[in] S points to an instance of the Q7 sparse FIR structure. 2095 * @param[in] pSrc points to the block of input data. 2096 * @param[out] pDst points to the block of output data 2097 * @param[in] pScratchIn points to a temporary buffer of size blockSize. 2098 * @param[in] pScratchOut points to a temporary buffer of size blockSize. 2099 * @param[in] blockSize number of input samples to process per call. 2100 */ 2101 void arm_fir_sparse_q7( 2102 arm_fir_sparse_instance_q7 * S, 2103 const q7_t * pSrc, 2104 q7_t * pDst, 2105 q7_t * pScratchIn, 2106 q31_t * pScratchOut, 2107 uint32_t blockSize); 2108 2109 2110 /** 2111 * @brief Initialization function for the Q7 sparse FIR filter. 2112 * @param[in,out] S points to an instance of the Q7 sparse FIR structure. 2113 * @param[in] numTaps number of nonzero coefficients in the filter. 2114 * @param[in] pCoeffs points to the array of filter coefficients. 2115 * @param[in] pState points to the state buffer. 2116 * @param[in] pTapDelay points to the array of offset times. 2117 * @param[in] maxDelay maximum offset time supported. 2118 * @param[in] blockSize number of samples that will be processed per block. 2119 */ 2120 void arm_fir_sparse_init_q7( 2121 arm_fir_sparse_instance_q7 * S, 2122 uint16_t numTaps, 2123 const q7_t * pCoeffs, 2124 q7_t * pState, 2125 int32_t * pTapDelay, 2126 uint16_t maxDelay, 2127 uint32_t blockSize); 2128 2129 2130 2131 2132 2133 2134 /** 2135 * @brief floating-point Circular write function. 2136 */ arm_circularWrite_f32(int32_t * circBuffer,int32_t L,uint16_t * writeOffset,int32_t bufferInc,const int32_t * src,int32_t srcInc,uint32_t blockSize)2137 __STATIC_FORCEINLINE void arm_circularWrite_f32( 2138 int32_t * circBuffer, 2139 int32_t L, 2140 uint16_t * writeOffset, 2141 int32_t bufferInc, 2142 const int32_t * src, 2143 int32_t srcInc, 2144 uint32_t blockSize) 2145 { 2146 uint32_t i = 0U; 2147 int32_t wOffset; 2148 2149 /* Copy the value of Index pointer that points 2150 * to the current location where the input samples to be copied */ 2151 wOffset = *writeOffset; 2152 2153 /* Loop over the blockSize */ 2154 i = blockSize; 2155 2156 while (i > 0U) 2157 { 2158 /* copy the input sample to the circular buffer */ 2159 circBuffer[wOffset] = *src; 2160 2161 /* Update the input pointer */ 2162 src += srcInc; 2163 2164 /* Circularly update wOffset. Watch out for positive and negative value */ 2165 wOffset += bufferInc; 2166 if (wOffset >= L) 2167 wOffset -= L; 2168 2169 /* Decrement the loop counter */ 2170 i--; 2171 } 2172 2173 /* Update the index pointer */ 2174 *writeOffset = (uint16_t)wOffset; 2175 } 2176 2177 2178 2179 /** 2180 * @brief floating-point Circular Read function. 2181 */ arm_circularRead_f32(int32_t * circBuffer,int32_t L,int32_t * readOffset,int32_t bufferInc,int32_t * dst,int32_t * dst_base,int32_t dst_length,int32_t dstInc,uint32_t blockSize)2182 __STATIC_FORCEINLINE void arm_circularRead_f32( 2183 int32_t * circBuffer, 2184 int32_t L, 2185 int32_t * readOffset, 2186 int32_t bufferInc, 2187 int32_t * dst, 2188 int32_t * dst_base, 2189 int32_t dst_length, 2190 int32_t dstInc, 2191 uint32_t blockSize) 2192 { 2193 uint32_t i = 0U; 2194 int32_t rOffset; 2195 int32_t* dst_end; 2196 2197 /* Copy the value of Index pointer that points 2198 * to the current location from where the input samples to be read */ 2199 rOffset = *readOffset; 2200 dst_end = dst_base + dst_length; 2201 2202 /* Loop over the blockSize */ 2203 i = blockSize; 2204 2205 while (i > 0U) 2206 { 2207 /* copy the sample from the circular buffer to the destination buffer */ 2208 *dst = circBuffer[rOffset]; 2209 2210 /* Update the input pointer */ 2211 dst += dstInc; 2212 2213 if (dst == dst_end) 2214 { 2215 dst = dst_base; 2216 } 2217 2218 /* Circularly update rOffset. Watch out for positive and negative value */ 2219 rOffset += bufferInc; 2220 2221 if (rOffset >= L) 2222 { 2223 rOffset -= L; 2224 } 2225 2226 /* Decrement the loop counter */ 2227 i--; 2228 } 2229 2230 /* Update the index pointer */ 2231 *readOffset = rOffset; 2232 } 2233 2234 2235 /** 2236 * @brief Q15 Circular write function. 2237 */ arm_circularWrite_q15(q15_t * circBuffer,int32_t L,uint16_t * writeOffset,int32_t bufferInc,const q15_t * src,int32_t srcInc,uint32_t blockSize)2238 __STATIC_FORCEINLINE void arm_circularWrite_q15( 2239 q15_t * circBuffer, 2240 int32_t L, 2241 uint16_t * writeOffset, 2242 int32_t bufferInc, 2243 const q15_t * src, 2244 int32_t srcInc, 2245 uint32_t blockSize) 2246 { 2247 uint32_t i = 0U; 2248 int32_t wOffset; 2249 2250 /* Copy the value of Index pointer that points 2251 * to the current location where the input samples to be copied */ 2252 wOffset = *writeOffset; 2253 2254 /* Loop over the blockSize */ 2255 i = blockSize; 2256 2257 while (i > 0U) 2258 { 2259 /* copy the input sample to the circular buffer */ 2260 circBuffer[wOffset] = *src; 2261 2262 /* Update the input pointer */ 2263 src += srcInc; 2264 2265 /* Circularly update wOffset. Watch out for positive and negative value */ 2266 wOffset += bufferInc; 2267 if (wOffset >= L) 2268 wOffset -= L; 2269 2270 /* Decrement the loop counter */ 2271 i--; 2272 } 2273 2274 /* Update the index pointer */ 2275 *writeOffset = (uint16_t)wOffset; 2276 } 2277 2278 2279 /** 2280 * @brief Q15 Circular Read function. 2281 */ arm_circularRead_q15(q15_t * circBuffer,int32_t L,int32_t * readOffset,int32_t bufferInc,q15_t * dst,q15_t * dst_base,int32_t dst_length,int32_t dstInc,uint32_t blockSize)2282 __STATIC_FORCEINLINE void arm_circularRead_q15( 2283 q15_t * circBuffer, 2284 int32_t L, 2285 int32_t * readOffset, 2286 int32_t bufferInc, 2287 q15_t * dst, 2288 q15_t * dst_base, 2289 int32_t dst_length, 2290 int32_t dstInc, 2291 uint32_t blockSize) 2292 { 2293 uint32_t i = 0; 2294 int32_t rOffset; 2295 q15_t* dst_end; 2296 2297 /* Copy the value of Index pointer that points 2298 * to the current location from where the input samples to be read */ 2299 rOffset = *readOffset; 2300 2301 dst_end = dst_base + dst_length; 2302 2303 /* Loop over the blockSize */ 2304 i = blockSize; 2305 2306 while (i > 0U) 2307 { 2308 /* copy the sample from the circular buffer to the destination buffer */ 2309 *dst = circBuffer[rOffset]; 2310 2311 /* Update the input pointer */ 2312 dst += dstInc; 2313 2314 if (dst == dst_end) 2315 { 2316 dst = dst_base; 2317 } 2318 2319 /* Circularly update wOffset. Watch out for positive and negative value */ 2320 rOffset += bufferInc; 2321 2322 if (rOffset >= L) 2323 { 2324 rOffset -= L; 2325 } 2326 2327 /* Decrement the loop counter */ 2328 i--; 2329 } 2330 2331 /* Update the index pointer */ 2332 *readOffset = rOffset; 2333 } 2334 2335 2336 /** 2337 * @brief Q7 Circular write function. 2338 */ arm_circularWrite_q7(q7_t * circBuffer,int32_t L,uint16_t * writeOffset,int32_t bufferInc,const q7_t * src,int32_t srcInc,uint32_t blockSize)2339 __STATIC_FORCEINLINE void arm_circularWrite_q7( 2340 q7_t * circBuffer, 2341 int32_t L, 2342 uint16_t * writeOffset, 2343 int32_t bufferInc, 2344 const q7_t * src, 2345 int32_t srcInc, 2346 uint32_t blockSize) 2347 { 2348 uint32_t i = 0U; 2349 int32_t wOffset; 2350 2351 /* Copy the value of Index pointer that points 2352 * to the current location where the input samples to be copied */ 2353 wOffset = *writeOffset; 2354 2355 /* Loop over the blockSize */ 2356 i = blockSize; 2357 2358 while (i > 0U) 2359 { 2360 /* copy the input sample to the circular buffer */ 2361 circBuffer[wOffset] = *src; 2362 2363 /* Update the input pointer */ 2364 src += srcInc; 2365 2366 /* Circularly update wOffset. Watch out for positive and negative value */ 2367 wOffset += bufferInc; 2368 if (wOffset >= L) 2369 wOffset -= L; 2370 2371 /* Decrement the loop counter */ 2372 i--; 2373 } 2374 2375 /* Update the index pointer */ 2376 *writeOffset = (uint16_t)wOffset; 2377 } 2378 2379 2380 /** 2381 * @brief Q7 Circular Read function. 2382 */ arm_circularRead_q7(q7_t * circBuffer,int32_t L,int32_t * readOffset,int32_t bufferInc,q7_t * dst,q7_t * dst_base,int32_t dst_length,int32_t dstInc,uint32_t blockSize)2383 __STATIC_FORCEINLINE void arm_circularRead_q7( 2384 q7_t * circBuffer, 2385 int32_t L, 2386 int32_t * readOffset, 2387 int32_t bufferInc, 2388 q7_t * dst, 2389 q7_t * dst_base, 2390 int32_t dst_length, 2391 int32_t dstInc, 2392 uint32_t blockSize) 2393 { 2394 uint32_t i = 0; 2395 int32_t rOffset; 2396 q7_t* dst_end; 2397 2398 /* Copy the value of Index pointer that points 2399 * to the current location from where the input samples to be read */ 2400 rOffset = *readOffset; 2401 2402 dst_end = dst_base + dst_length; 2403 2404 /* Loop over the blockSize */ 2405 i = blockSize; 2406 2407 while (i > 0U) 2408 { 2409 /* copy the sample from the circular buffer to the destination buffer */ 2410 *dst = circBuffer[rOffset]; 2411 2412 /* Update the input pointer */ 2413 dst += dstInc; 2414 2415 if (dst == dst_end) 2416 { 2417 dst = dst_base; 2418 } 2419 2420 /* Circularly update rOffset. Watch out for positive and negative value */ 2421 rOffset += bufferInc; 2422 2423 if (rOffset >= L) 2424 { 2425 rOffset -= L; 2426 } 2427 2428 /* Decrement the loop counter */ 2429 i--; 2430 } 2431 2432 /* Update the index pointer */ 2433 *readOffset = rOffset; 2434 } 2435 2436 2437 /** 2438 @brief Levinson Durbin 2439 @param[in] phi autocovariance vector starting with lag 0 (length is nbCoefs + 1) 2440 @param[out] a autoregressive coefficients 2441 @param[out] err prediction error (variance) 2442 @param[in] nbCoefs number of autoregressive coefficients 2443 @return none 2444 */ 2445 void arm_levinson_durbin_f32(const float32_t *phi, 2446 float32_t *a, 2447 float32_t *err, 2448 int nbCoefs); 2449 2450 2451 /** 2452 @brief Levinson Durbin 2453 @param[in] phi autocovariance vector starting with lag 0 (length is nbCoefs + 1) 2454 @param[out] a autoregressive coefficients 2455 @param[out] err prediction error (variance) 2456 @param[in] nbCoefs number of autoregressive coefficients 2457 @return none 2458 */ 2459 void arm_levinson_durbin_q31(const q31_t *phi, 2460 q31_t *a, 2461 q31_t *err, 2462 int nbCoefs); 2463 2464 #ifdef __cplusplus 2465 } 2466 #endif 2467 2468 #endif /* ifndef _FILTERING_FUNCTIONS_H_ */ 2469