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