]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/NXP_Code/CMSIS/arm_math.h
Add MPU demo project for LPC54018 board.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_LPC54018_MCUXpresso / NXP_Code / CMSIS / arm_math.h
1 /******************************************************************************\r
2  * @file     arm_math.h\r
3  * @brief    Public header file for CMSIS DSP Library\r
4  * @version  V1.6.0\r
5  * @date     18. March 2019\r
6  ******************************************************************************/\r
7 /*\r
8  * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.\r
9  *\r
10  * SPDX-License-Identifier: Apache-2.0\r
11  *\r
12  * Licensed under the Apache License, Version 2.0 (the License); you may\r
13  * not use this file except in compliance with the License.\r
14  * You may obtain a copy of the License at\r
15  *\r
16  * www.apache.org/licenses/LICENSE-2.0\r
17  *\r
18  * Unless required by applicable law or agreed to in writing, software\r
19  * distributed under the License is distributed on an AS IS BASIS, WITHOUT\r
20  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
21  * See the License for the specific language governing permissions and\r
22  * limitations under the License.\r
23  */\r
24 \r
25 /**\r
26    \mainpage CMSIS DSP Software Library\r
27    *\r
28    * Introduction\r
29    * ------------\r
30    *\r
31    * This user manual describes the CMSIS DSP software library,\r
32    * a suite of common signal processing functions for use on Cortex-M processor based devices.\r
33    *\r
34    * The library is divided into a number of functions each covering a specific category:\r
35    * - Basic math functions\r
36    * - Fast math functions\r
37    * - Complex math functions\r
38    * - Filters\r
39    * - Matrix functions\r
40    * - Transform functions\r
41    * - Motor control functions\r
42    * - Statistical functions\r
43    * - Support functions\r
44    * - Interpolation functions\r
45    *\r
46    * The library has separate functions for operating on 8-bit integers, 16-bit integers,\r
47    * 32-bit integer and 32-bit floating-point values.\r
48    *\r
49    * Using the Library\r
50    * ------------\r
51    *\r
52    * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.\r
53    * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)\r
54    * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)\r
55    * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)\r
56    * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)\r
57    * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)\r
58    * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)\r
59    * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)\r
60    * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)\r
61    * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)\r
62    * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)\r
63    * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)\r
64    * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)\r
65    * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)\r
66    * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)\r
67    * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)\r
68    * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)\r
69    * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)\r
70    * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)\r
71    * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)\r
72    *\r
73    * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.\r
74    * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single\r
75    * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.\r
76    *\r
77    *\r
78    * Examples\r
79    * --------\r
80    *\r
81    * The library ships with a number of examples which demonstrate how to use the library functions.\r
82    *\r
83    * Toolchain Support\r
84    * ------------\r
85    *\r
86    * The library has been developed and tested with MDK version 5.14.0.0\r
87    * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.\r
88    *\r
89    * Building the Library\r
90    * ------------\r
91    *\r
92    * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP\\Projects\\ARM</code> folder.\r
93    * - arm_cortexM_math.uvprojx\r
94    *\r
95    *\r
96    * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above.\r
97    *\r
98    * Preprocessor Macros\r
99    * ------------\r
100    *\r
101    * Each library project have different preprocessor macros.\r
102    *\r
103    * - ARM_MATH_BIG_ENDIAN:\r
104    *\r
105    * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.\r
106    *\r
107    * - ARM_MATH_MATRIX_CHECK:\r
108    *\r
109    * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices\r
110    *\r
111    * - ARM_MATH_ROUNDING:\r
112    *\r
113    * Define macro ARM_MATH_ROUNDING for rounding on support functions\r
114    *\r
115    * - ARM_MATH_LOOPUNROLL:\r
116    *\r
117    * Define macro ARM_MATH_LOOPUNROLL to enable manual loop unrolling in DSP functions\r
118    *\r
119    * <hr>\r
120    * CMSIS-DSP in ARM::CMSIS Pack\r
121    * -----------------------------\r
122    *\r
123    * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:\r
124    * |File/Folder                      |Content                                                                 |\r
125    * |---------------------------------|------------------------------------------------------------------------|\r
126    * |\b CMSIS\\Documentation\\DSP     | This documentation                                                     |\r
127    * |\b CMSIS\\DSP\\DSP_Lib_TestSuite | DSP_Lib test suite                                                     |\r
128    * |\b CMSIS\\DSP\\Examples          | Example projects demonstrating the usage of the library functions      |\r
129    * |\b CMSIS\\DSP\\Include           | DSP_Lib include files                                                  |\r
130    * |\b CMSIS\\DSP\\Lib               | DSP_Lib binaries                                                       |\r
131    * |\b CMSIS\\DSP\\Projects          | Projects to rebuild DSP_Lib binaries                                   |\r
132    * |\b CMSIS\\DSP\\Source            | DSP_Lib source files                                                   |\r
133    *\r
134    * <hr>\r
135    * Revision History of CMSIS-DSP\r
136    * ------------\r
137    * Please refer to \ref ChangeLog_pg.\r
138    */\r
139 \r
140 \r
141 /**\r
142  * @defgroup groupMath Basic Math Functions\r
143  */\r
144 \r
145 /**\r
146  * @defgroup groupFastMath Fast Math Functions\r
147  * This set of functions provides a fast approximation to sine, cosine, and square root.\r
148  * As compared to most of the other functions in the CMSIS math library, the fast math functions\r
149  * operate on individual values and not arrays.\r
150  * There are separate functions for Q15, Q31, and floating-point data.\r
151  *\r
152  */\r
153 \r
154 /**\r
155  * @defgroup groupCmplxMath Complex Math Functions\r
156  * This set of functions operates on complex data vectors.\r
157  * The data in the complex arrays is stored in an interleaved fashion\r
158  * (real, imag, real, imag, ...).\r
159  * In the API functions, the number of samples in a complex array refers\r
160  * to the number of complex values; the array contains twice this number of\r
161  * real values.\r
162  */\r
163 \r
164 /**\r
165  * @defgroup groupFilters Filtering Functions\r
166  */\r
167 \r
168 /**\r
169  * @defgroup groupMatrix Matrix Functions\r
170  *\r
171  * This set of functions provides basic matrix math operations.\r
172  * The functions operate on matrix data structures.  For example,\r
173  * the type\r
174  * definition for the floating-point matrix structure is shown\r
175  * below:\r
176  * <pre>\r
177  *     typedef struct\r
178  *     {\r
179  *       uint16_t numRows;     // number of rows of the matrix.\r
180  *       uint16_t numCols;     // number of columns of the matrix.\r
181  *       float32_t *pData;     // points to the data of the matrix.\r
182  *     } arm_matrix_instance_f32;\r
183  * </pre>\r
184  * There are similar definitions for Q15 and Q31 data types.\r
185  *\r
186  * The structure specifies the size of the matrix and then points to\r
187  * an array of data.  The array is of size <code>numRows X numCols</code>\r
188  * and the values are arranged in row order.  That is, the\r
189  * matrix element (i, j) is stored at:\r
190  * <pre>\r
191  *     pData[i*numCols + j]\r
192  * </pre>\r
193  *\r
194  * \par Init Functions\r
195  * There is an associated initialization function for each type of matrix\r
196  * data structure.\r
197  * The initialization function sets the values of the internal structure fields.\r
198  * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15()\r
199  * for floating-point, Q31 and Q15 types,  respectively.\r
200  *\r
201  * \par\r
202  * Use of the initialization function is optional. However, if initialization function is used\r
203  * then the instance structure cannot be placed into a const data section.\r
204  * To place the instance structure in a const data\r
205  * section, manually initialize the data structure.  For example:\r
206  * <pre>\r
207  * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>\r
208  * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>\r
209  * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>\r
210  * </pre>\r
211  * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>\r
212  * specifies the number of columns, and <code>pData</code> points to the\r
213  * data array.\r
214  *\r
215  * \par Size Checking\r
216  * By default all of the matrix functions perform size checking on the input and\r
217  * output matrices. For example, the matrix addition function verifies that the\r
218  * two input matrices and the output matrix all have the same number of rows and\r
219  * columns. If the size check fails the functions return:\r
220  * <pre>\r
221  *     ARM_MATH_SIZE_MISMATCH\r
222  * </pre>\r
223  * Otherwise the functions return\r
224  * <pre>\r
225  *     ARM_MATH_SUCCESS\r
226  * </pre>\r
227  * There is some overhead associated with this matrix size checking.\r
228  * The matrix size checking is enabled via the \#define\r
229  * <pre>\r
230  *     ARM_MATH_MATRIX_CHECK\r
231  * </pre>\r
232  * within the library project settings.  By default this macro is defined\r
233  * and size checking is enabled. By changing the project settings and\r
234  * undefining this macro size checking is eliminated and the functions\r
235  * run a bit faster. With size checking disabled the functions always\r
236  * return <code>ARM_MATH_SUCCESS</code>.\r
237  */\r
238 \r
239 /**\r
240  * @defgroup groupTransforms Transform Functions\r
241  */\r
242 \r
243 /**\r
244  * @defgroup groupController Controller Functions\r
245  */\r
246 \r
247 /**\r
248  * @defgroup groupStats Statistics Functions\r
249  */\r
250 \r
251 /**\r
252  * @defgroup groupSupport Support Functions\r
253  */\r
254 \r
255 /**\r
256  * @defgroup groupInterpolation Interpolation Functions\r
257  * These functions perform 1- and 2-dimensional interpolation of data.\r
258  * Linear interpolation is used for 1-dimensional data and\r
259  * bilinear interpolation is used for 2-dimensional data.\r
260  */\r
261 \r
262 /**\r
263  * @defgroup groupExamples Examples\r
264  */\r
265 \r
266 \r
267 #ifndef _ARM_MATH_H\r
268 #define _ARM_MATH_H\r
269 \r
270 /* Compiler specific diagnostic adjustment */\r
271 #if   defined ( __CC_ARM )\r
272 \r
273 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )\r
274 \r
275 #elif defined ( __GNUC__ )\r
276   #pragma GCC diagnostic push\r
277   #pragma GCC diagnostic ignored "-Wsign-conversion"\r
278   #pragma GCC diagnostic ignored "-Wconversion"\r
279   #pragma GCC diagnostic ignored "-Wunused-parameter"\r
280 \r
281 #elif defined ( __ICCARM__ )\r
282 \r
283 #elif defined ( __TI_ARM__ )\r
284 \r
285 #elif defined ( __CSMC__ )\r
286 \r
287 #elif defined ( __TASKING__ )\r
288 \r
289 #else\r
290   #error Unknown compiler\r
291 #endif\r
292 \r
293 \r
294 #include "cmsis_compiler.h"\r
295 #include "string.h"\r
296 #include "math.h"\r
297 \r
298 /* evaluate ARM architecture */\r
299 #if   defined (__ARM_ARCH_6M__)\r
300   #define ARM_MATH_CM0_FAMILY            1\r
301 #elif defined (__ARM_ARCH_7M__)\r
302 //#define ARM_MATH_CM0_FAMILY            0\r
303 #elif defined (__ARM_ARCH_7EM__)\r
304 //#define ARM_MATH_CM0_FAMILY            0\r
305 #elif defined (__ARM_ARCH_8M_BASE__)\r
306   #define ARM_MATH_CM0_FAMILY            1\r
307 #elif defined (__ARM_ARCH_8M_MAIN__)\r
308 //#define ARM_MATH_CM0_FAMILY            0\r
309 #else\r
310   #error "Unknown Arm Architecture!"\r
311 #endif\r
312 \r
313 /* evaluate ARM DSP feature */\r
314 #if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))\r
315   #define ARM_MATH_DSP                   1\r
316 #endif\r
317 \r
318 \r
319 \r
320 \r
321 #ifdef   __cplusplus\r
322 extern "C"\r
323 {\r
324 #endif\r
325 \r
326 \r
327   /**\r
328    * @brief Macros required for reciprocal calculation in Normalized LMS\r
329    */\r
330 \r
331 #define DELTA_Q31          (0x100)\r
332 #define DELTA_Q15          0x5\r
333 #define INDEX_MASK         0x0000003F\r
334 #ifndef PI\r
335   #define PI               3.14159265358979f\r
336 #endif\r
337 \r
338   /**\r
339    * @brief Macros required for SINE and COSINE Fast math approximations\r
340    */\r
341 \r
342 #define FAST_MATH_TABLE_SIZE  512\r
343 #define FAST_MATH_Q31_SHIFT   (32 - 10)\r
344 #define FAST_MATH_Q15_SHIFT   (16 - 10)\r
345 #define CONTROLLER_Q31_SHIFT  (32 - 9)\r
346 #define TABLE_SPACING_Q31     0x400000\r
347 #define TABLE_SPACING_Q15     0x80\r
348 \r
349   /**\r
350    * @brief Macros required for SINE and COSINE Controller functions\r
351    */\r
352   /* 1.31(q31) Fixed value of 2/360 */\r
353   /* -1 to +1 is divided into 360 values so total spacing is (2/360) */\r
354 #define INPUT_SPACING         0xB60B61\r
355 \r
356 \r
357   /**\r
358    * @brief Error status returned by some functions in the library.\r
359    */\r
360 \r
361   typedef enum\r
362   {\r
363     ARM_MATH_SUCCESS        =  0,        /**< No error */\r
364     ARM_MATH_ARGUMENT_ERROR = -1,        /**< One or more arguments are incorrect */\r
365     ARM_MATH_LENGTH_ERROR   = -2,        /**< Length of data buffer is incorrect */\r
366     ARM_MATH_SIZE_MISMATCH  = -3,        /**< Size of matrices is not compatible with the operation */\r
367     ARM_MATH_NANINF         = -4,        /**< Not-a-number (NaN) or infinity is generated */\r
368     ARM_MATH_SINGULAR       = -5,        /**< Input matrix is singular and cannot be inverted */\r
369     ARM_MATH_TEST_FAILURE   = -6         /**< Test Failed */\r
370   } arm_status;\r
371 \r
372   /**\r
373    * @brief 8-bit fractional data type in 1.7 format.\r
374    */\r
375   typedef int8_t q7_t;\r
376 \r
377   /**\r
378    * @brief 16-bit fractional data type in 1.15 format.\r
379    */\r
380   typedef int16_t q15_t;\r
381 \r
382   /**\r
383    * @brief 32-bit fractional data type in 1.31 format.\r
384    */\r
385   typedef int32_t q31_t;\r
386 \r
387   /**\r
388    * @brief 64-bit fractional data type in 1.63 format.\r
389    */\r
390   typedef int64_t q63_t;\r
391 \r
392   /**\r
393    * @brief 32-bit floating-point type definition.\r
394    */\r
395   typedef float float32_t;\r
396 \r
397   /**\r
398    * @brief 64-bit floating-point type definition.\r
399    */\r
400   typedef double float64_t;\r
401 \r
402 \r
403 /**\r
404   @brief definition to read/write two 16 bit values.\r
405   @deprecated\r
406  */\r
407 #if   defined ( __CC_ARM )\r
408   #define __SIMD32_TYPE int32_t __packed\r
409 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )\r
410   #define __SIMD32_TYPE int32_t\r
411 #elif defined ( __GNUC__ )\r
412   #define __SIMD32_TYPE int32_t\r
413 #elif defined ( __ICCARM__ )\r
414   #define __SIMD32_TYPE int32_t __packed\r
415 #elif defined ( __TI_ARM__ )\r
416   #define __SIMD32_TYPE int32_t\r
417 #elif defined ( __CSMC__ )\r
418   #define __SIMD32_TYPE int32_t\r
419 #elif defined ( __TASKING__ )\r
420   #define __SIMD32_TYPE __unaligned int32_t\r
421 #else\r
422   #error Unknown compiler\r
423 #endif\r
424 \r
425 #define __SIMD32(addr)        (*(__SIMD32_TYPE **) & (addr))\r
426 #define __SIMD32_CONST(addr)  ( (__SIMD32_TYPE * )   (addr))\r
427 #define _SIMD32_OFFSET(addr)  (*(__SIMD32_TYPE * )   (addr))\r
428 #define __SIMD64(addr)        (*(      int64_t **) & (addr))\r
429 \r
430 /* SIMD replacement */\r
431 \r
432 /**\r
433   @brief         Read 2 Q15 from Q15 pointer.\r
434   @param[in]     pQ15      points to input value\r
435   @return        Q31 value\r
436  */\r
437 __STATIC_FORCEINLINE q31_t read_q15x2 (\r
438   q15_t * pQ15)\r
439 {\r
440   q31_t val;\r
441 \r
442   memcpy (&val, pQ15, 4);\r
443 \r
444   return (val);\r
445 }\r
446 \r
447 /**\r
448   @brief         Read 2 Q15 from Q15 pointer and increment pointer afterwards.\r
449   @param[in]     pQ15      points to input value\r
450   @return        Q31 value\r
451  */\r
452 __STATIC_FORCEINLINE q31_t read_q15x2_ia (\r
453   q15_t ** pQ15)\r
454 {\r
455   q31_t val;\r
456 \r
457   memcpy (&val, *pQ15, 4);\r
458   *pQ15 += 2;\r
459 \r
460   return (val);\r
461 }\r
462 \r
463 /**\r
464   @brief         Read 2 Q15 from Q15 pointer and decrement pointer afterwards.\r
465   @param[in]     pQ15      points to input value\r
466   @return        Q31 value\r
467  */\r
468 __STATIC_FORCEINLINE q31_t read_q15x2_da (\r
469   q15_t ** pQ15)\r
470 {\r
471   q31_t val;\r
472 \r
473   memcpy (&val, *pQ15, 4);\r
474   *pQ15 -= 2;\r
475 \r
476   return (val);\r
477 }\r
478 \r
479 /**\r
480   @brief         Write 2 Q15 to Q15 pointer and increment pointer afterwards.\r
481   @param[in]     pQ15      points to input value\r
482   @param[in]     value     Q31 value\r
483   @return        none\r
484  */\r
485 __STATIC_FORCEINLINE void write_q15x2_ia (\r
486   q15_t ** pQ15,\r
487   q31_t    value)\r
488 {\r
489   q31_t val = value;\r
490 \r
491   memcpy (*pQ15, &val, 4);\r
492   *pQ15 += 2;\r
493 }\r
494 \r
495 /**\r
496   @brief         Write 2 Q15 to Q15 pointer.\r
497   @param[in]     pQ15      points to input value\r
498   @param[in]     value     Q31 value\r
499   @return        none\r
500  */\r
501 __STATIC_FORCEINLINE void write_q15x2 (\r
502   q15_t * pQ15,\r
503   q31_t   value)\r
504 {\r
505   q31_t val = value;\r
506 \r
507   memcpy (pQ15, &val, 4);\r
508 }\r
509 \r
510 \r
511 /**\r
512   @brief         Read 4 Q7 from Q7 pointer and increment pointer afterwards.\r
513   @param[in]     pQ7       points to input value\r
514   @return        Q31 value\r
515  */\r
516 __STATIC_FORCEINLINE q31_t read_q7x4_ia (\r
517   q7_t ** pQ7)\r
518 {\r
519   q31_t val;\r
520 \r
521   memcpy (&val, *pQ7, 4);\r
522   *pQ7 += 4;\r
523 \r
524   return (val);\r
525 }\r
526 \r
527 /**\r
528   @brief         Read 4 Q7 from Q7 pointer and decrement pointer afterwards.\r
529   @param[in]     pQ7       points to input value\r
530   @return        Q31 value\r
531  */\r
532 __STATIC_FORCEINLINE q31_t read_q7x4_da (\r
533   q7_t ** pQ7)\r
534 {\r
535   q31_t val;\r
536 \r
537   memcpy (&val, *pQ7, 4);\r
538   *pQ7 -= 4;\r
539 \r
540   return (val);\r
541 }\r
542 \r
543 /**\r
544   @brief         Write 4 Q7 to Q7 pointer and increment pointer afterwards.\r
545   @param[in]     pQ7       points to input value\r
546   @param[in]     value     Q31 value\r
547   @return        none\r
548  */\r
549 __STATIC_FORCEINLINE void write_q7x4_ia (\r
550   q7_t ** pQ7,\r
551   q31_t   value)\r
552 {\r
553   q31_t val = value;\r
554 \r
555   memcpy (*pQ7, &val, 4);\r
556   *pQ7 += 4;\r
557 }\r
558 \r
559 \r
560 #ifndef ARM_MATH_DSP\r
561   /**\r
562    * @brief definition to pack two 16 bit values.\r
563    */\r
564   #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) <<    0) & (int32_t)0x0000FFFF) | \\r
565                                       (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )\r
566   #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) <<    0) & (int32_t)0xFFFF0000) | \\r
567                                       (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF)  )\r
568 #endif\r
569 \r
570    /**\r
571    * @brief definition to pack four 8 bit values.\r
572    */\r
573 #ifndef ARM_MATH_BIG_ENDIAN\r
574   #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) | \\r
575                                   (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) | \\r
576                                   (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \\r
577                                   (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )\r
578 #else\r
579   #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) <<  0) & (int32_t)0x000000FF) | \\r
580                                   (((int32_t)(v2) <<  8) & (int32_t)0x0000FF00) | \\r
581                                   (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \\r
582                                   (((int32_t)(v0) << 24) & (int32_t)0xFF000000)  )\r
583 #endif\r
584 \r
585 \r
586   /**\r
587    * @brief Clips Q63 to Q31 values.\r
588    */\r
589   __STATIC_FORCEINLINE q31_t clip_q63_to_q31(\r
590   q63_t x)\r
591   {\r
592     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?\r
593       ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;\r
594   }\r
595 \r
596   /**\r
597    * @brief Clips Q63 to Q15 values.\r
598    */\r
599   __STATIC_FORCEINLINE q15_t clip_q63_to_q15(\r
600   q63_t x)\r
601   {\r
602     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?\r
603       ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);\r
604   }\r
605 \r
606   /**\r
607    * @brief Clips Q31 to Q7 values.\r
608    */\r
609   __STATIC_FORCEINLINE q7_t clip_q31_to_q7(\r
610   q31_t x)\r
611   {\r
612     return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?\r
613       ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;\r
614   }\r
615 \r
616   /**\r
617    * @brief Clips Q31 to Q15 values.\r
618    */\r
619   __STATIC_FORCEINLINE q15_t clip_q31_to_q15(\r
620   q31_t x)\r
621   {\r
622     return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?\r
623       ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;\r
624   }\r
625 \r
626   /**\r
627    * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.\r
628    */\r
629   __STATIC_FORCEINLINE q63_t mult32x64(\r
630   q63_t x,\r
631   q31_t y)\r
632   {\r
633     return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +\r
634             (((q63_t) (x >> 32)                * y)      )  );\r
635   }\r
636 \r
637   /**\r
638    * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.\r
639    */\r
640   __STATIC_FORCEINLINE uint32_t arm_recip_q31(\r
641         q31_t in,\r
642         q31_t * dst,\r
643   const q31_t * pRecipTable)\r
644   {\r
645     q31_t out;\r
646     uint32_t tempVal;\r
647     uint32_t index, i;\r
648     uint32_t signBits;\r
649 \r
650     if (in > 0)\r
651     {\r
652       signBits = ((uint32_t) (__CLZ( in) - 1));\r
653     }\r
654     else\r
655     {\r
656       signBits = ((uint32_t) (__CLZ(-in) - 1));\r
657     }\r
658 \r
659     /* Convert input sample to 1.31 format */\r
660     in = (in << signBits);\r
661 \r
662     /* calculation of index for initial approximated Val */\r
663     index = (uint32_t)(in >> 24);\r
664     index = (index & INDEX_MASK);\r
665 \r
666     /* 1.31 with exp 1 */\r
667     out = pRecipTable[index];\r
668 \r
669     /* calculation of reciprocal value */\r
670     /* running approximation for two iterations */\r
671     for (i = 0U; i < 2U; i++)\r
672     {\r
673       tempVal = (uint32_t) (((q63_t) in * out) >> 31);\r
674       tempVal = 0x7FFFFFFFu - tempVal;\r
675       /*      1.31 with exp 1 */\r
676       /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */\r
677       out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);\r
678     }\r
679 \r
680     /* write output */\r
681     *dst = out;\r
682 \r
683     /* return num of signbits of out = 1/in value */\r
684     return (signBits + 1U);\r
685   }\r
686 \r
687 \r
688   /**\r
689    * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.\r
690    */\r
691   __STATIC_FORCEINLINE uint32_t arm_recip_q15(\r
692         q15_t in,\r
693         q15_t * dst,\r
694   const q15_t * pRecipTable)\r
695   {\r
696     q15_t out = 0;\r
697     uint32_t tempVal = 0;\r
698     uint32_t index = 0, i = 0;\r
699     uint32_t signBits = 0;\r
700 \r
701     if (in > 0)\r
702     {\r
703       signBits = ((uint32_t)(__CLZ( in) - 17));\r
704     }\r
705     else\r
706     {\r
707       signBits = ((uint32_t)(__CLZ(-in) - 17));\r
708     }\r
709 \r
710     /* Convert input sample to 1.15 format */\r
711     in = (in << signBits);\r
712 \r
713     /* calculation of index for initial approximated Val */\r
714     index = (uint32_t)(in >>  8);\r
715     index = (index & INDEX_MASK);\r
716 \r
717     /*      1.15 with exp 1  */\r
718     out = pRecipTable[index];\r
719 \r
720     /* calculation of reciprocal value */\r
721     /* running approximation for two iterations */\r
722     for (i = 0U; i < 2U; i++)\r
723     {\r
724       tempVal = (uint32_t) (((q31_t) in * out) >> 15);\r
725       tempVal = 0x7FFFu - tempVal;\r
726       /*      1.15 with exp 1 */\r
727       out = (q15_t) (((q31_t) out * tempVal) >> 14);\r
728       /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */\r
729     }\r
730 \r
731     /* write output */\r
732     *dst = out;\r
733 \r
734     /* return num of signbits of out = 1/in value */\r
735     return (signBits + 1);\r
736   }\r
737 \r
738 \r
739 /*\r
740  * @brief C custom defined intrinsic functions\r
741  */\r
742 #if !defined (ARM_MATH_DSP)\r
743 \r
744   /*\r
745    * @brief C custom defined QADD8\r
746    */\r
747   __STATIC_FORCEINLINE uint32_t __QADD8(\r
748   uint32_t x,\r
749   uint32_t y)\r
750   {\r
751     q31_t r, s, t, u;\r
752 \r
753     r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;\r
754     s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;\r
755     t = __SSAT(((((q31_t)x <<  8) >> 24) + (((q31_t)y <<  8) >> 24)), 8) & (int32_t)0x000000FF;\r
756     u = __SSAT(((((q31_t)x      ) >> 24) + (((q31_t)y      ) >> 24)), 8) & (int32_t)0x000000FF;\r
757 \r
758     return ((uint32_t)((u << 24) | (t << 16) | (s <<  8) | (r      )));\r
759   }\r
760 \r
761 \r
762   /*\r
763    * @brief C custom defined QSUB8\r
764    */\r
765   __STATIC_FORCEINLINE uint32_t __QSUB8(\r
766   uint32_t x,\r
767   uint32_t y)\r
768   {\r
769     q31_t r, s, t, u;\r
770 \r
771     r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;\r
772     s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;\r
773     t = __SSAT(((((q31_t)x <<  8) >> 24) - (((q31_t)y <<  8) >> 24)), 8) & (int32_t)0x000000FF;\r
774     u = __SSAT(((((q31_t)x      ) >> 24) - (((q31_t)y      ) >> 24)), 8) & (int32_t)0x000000FF;\r
775 \r
776     return ((uint32_t)((u << 24) | (t << 16) | (s <<  8) | (r      )));\r
777   }\r
778 \r
779 \r
780   /*\r
781    * @brief C custom defined QADD16\r
782    */\r
783   __STATIC_FORCEINLINE uint32_t __QADD16(\r
784   uint32_t x,\r
785   uint32_t y)\r
786   {\r
787 /*  q31_t r,     s;  without initialisation 'arm_offset_q15 test' fails  but 'intrinsic' tests pass! for armCC */\r
788     q31_t r = 0, s = 0;\r
789 \r
790     r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;\r
791     s = __SSAT(((((q31_t)x      ) >> 16) + (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;\r
792 \r
793     return ((uint32_t)((s << 16) | (r      )));\r
794   }\r
795 \r
796 \r
797   /*\r
798    * @brief C custom defined SHADD16\r
799    */\r
800   __STATIC_FORCEINLINE uint32_t __SHADD16(\r
801   uint32_t x,\r
802   uint32_t y)\r
803   {\r
804     q31_t r, s;\r
805 \r
806     r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
807     s = (((((q31_t)x      ) >> 16) + (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
808 \r
809     return ((uint32_t)((s << 16) | (r      )));\r
810   }\r
811 \r
812 \r
813   /*\r
814    * @brief C custom defined QSUB16\r
815    */\r
816   __STATIC_FORCEINLINE uint32_t __QSUB16(\r
817   uint32_t x,\r
818   uint32_t y)\r
819   {\r
820     q31_t r, s;\r
821 \r
822     r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;\r
823     s = __SSAT(((((q31_t)x      ) >> 16) - (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;\r
824 \r
825     return ((uint32_t)((s << 16) | (r      )));\r
826   }\r
827 \r
828 \r
829   /*\r
830    * @brief C custom defined SHSUB16\r
831    */\r
832   __STATIC_FORCEINLINE uint32_t __SHSUB16(\r
833   uint32_t x,\r
834   uint32_t y)\r
835   {\r
836     q31_t r, s;\r
837 \r
838     r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
839     s = (((((q31_t)x      ) >> 16) - (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
840 \r
841     return ((uint32_t)((s << 16) | (r      )));\r
842   }\r
843 \r
844 \r
845   /*\r
846    * @brief C custom defined QASX\r
847    */\r
848   __STATIC_FORCEINLINE uint32_t __QASX(\r
849   uint32_t x,\r
850   uint32_t y)\r
851   {\r
852     q31_t r, s;\r
853 \r
854     r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;\r
855     s = __SSAT(((((q31_t)x      ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;\r
856 \r
857     return ((uint32_t)((s << 16) | (r      )));\r
858   }\r
859 \r
860 \r
861   /*\r
862    * @brief C custom defined SHASX\r
863    */\r
864   __STATIC_FORCEINLINE uint32_t __SHASX(\r
865   uint32_t x,\r
866   uint32_t y)\r
867   {\r
868     q31_t r, s;\r
869 \r
870     r = (((((q31_t)x << 16) >> 16) - (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
871     s = (((((q31_t)x      ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
872 \r
873     return ((uint32_t)((s << 16) | (r      )));\r
874   }\r
875 \r
876 \r
877   /*\r
878    * @brief C custom defined QSAX\r
879    */\r
880   __STATIC_FORCEINLINE uint32_t __QSAX(\r
881   uint32_t x,\r
882   uint32_t y)\r
883   {\r
884     q31_t r, s;\r
885 \r
886     r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;\r
887     s = __SSAT(((((q31_t)x      ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;\r
888 \r
889     return ((uint32_t)((s << 16) | (r      )));\r
890   }\r
891 \r
892 \r
893   /*\r
894    * @brief C custom defined SHSAX\r
895    */\r
896   __STATIC_FORCEINLINE uint32_t __SHSAX(\r
897   uint32_t x,\r
898   uint32_t y)\r
899   {\r
900     q31_t r, s;\r
901 \r
902     r = (((((q31_t)x << 16) >> 16) + (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
903     s = (((((q31_t)x      ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;\r
904 \r
905     return ((uint32_t)((s << 16) | (r      )));\r
906   }\r
907 \r
908 \r
909   /*\r
910    * @brief C custom defined SMUSDX\r
911    */\r
912   __STATIC_FORCEINLINE uint32_t __SMUSDX(\r
913   uint32_t x,\r
914   uint32_t y)\r
915   {\r
916     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) -\r
917                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16))   ));\r
918   }\r
919 \r
920   /*\r
921    * @brief C custom defined SMUADX\r
922    */\r
923   __STATIC_FORCEINLINE uint32_t __SMUADX(\r
924   uint32_t x,\r
925   uint32_t y)\r
926   {\r
927     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) +\r
928                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16))   ));\r
929   }\r
930 \r
931 \r
932   /*\r
933    * @brief C custom defined QADD\r
934    */\r
935   __STATIC_FORCEINLINE int32_t __QADD(\r
936   int32_t x,\r
937   int32_t y)\r
938   {\r
939     return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));\r
940   }\r
941 \r
942 \r
943   /*\r
944    * @brief C custom defined QSUB\r
945    */\r
946   __STATIC_FORCEINLINE int32_t __QSUB(\r
947   int32_t x,\r
948   int32_t y)\r
949   {\r
950     return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));\r
951   }\r
952 \r
953 \r
954   /*\r
955    * @brief C custom defined SMLAD\r
956    */\r
957   __STATIC_FORCEINLINE uint32_t __SMLAD(\r
958   uint32_t x,\r
959   uint32_t y,\r
960   uint32_t sum)\r
961   {\r
962     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +\r
963                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16)) +\r
964                        ( ((q31_t)sum    )                                  )   ));\r
965   }\r
966 \r
967 \r
968   /*\r
969    * @brief C custom defined SMLADX\r
970    */\r
971   __STATIC_FORCEINLINE uint32_t __SMLADX(\r
972   uint32_t x,\r
973   uint32_t y,\r
974   uint32_t sum)\r
975   {\r
976     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) +\r
977                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16)) +\r
978                        ( ((q31_t)sum    )                                  )   ));\r
979   }\r
980 \r
981 \r
982   /*\r
983    * @brief C custom defined SMLSDX\r
984    */\r
985   __STATIC_FORCEINLINE uint32_t __SMLSDX(\r
986   uint32_t x,\r
987   uint32_t y,\r
988   uint32_t sum)\r
989   {\r
990     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) -\r
991                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16)) +\r
992                        ( ((q31_t)sum    )                                  )   ));\r
993   }\r
994 \r
995 \r
996   /*\r
997    * @brief C custom defined SMLALD\r
998    */\r
999   __STATIC_FORCEINLINE uint64_t __SMLALD(\r
1000   uint32_t x,\r
1001   uint32_t y,\r
1002   uint64_t sum)\r
1003   {\r
1004 /*  return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */\r
1005     return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +\r
1006                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16)) +\r
1007                        ( ((q63_t)sum    )                                  )   ));\r
1008   }\r
1009 \r
1010 \r
1011   /*\r
1012    * @brief C custom defined SMLALDX\r
1013    */\r
1014   __STATIC_FORCEINLINE uint64_t __SMLALDX(\r
1015   uint32_t x,\r
1016   uint32_t y,\r
1017   uint64_t sum)\r
1018   {\r
1019 /*  return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */\r
1020     return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) +\r
1021                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16)) +\r
1022                        ( ((q63_t)sum    )                                  )   ));\r
1023   }\r
1024 \r
1025 \r
1026   /*\r
1027    * @brief C custom defined SMUAD\r
1028    */\r
1029   __STATIC_FORCEINLINE uint32_t __SMUAD(\r
1030   uint32_t x,\r
1031   uint32_t y)\r
1032   {\r
1033     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +\r
1034                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16))   ));\r
1035   }\r
1036 \r
1037 \r
1038   /*\r
1039    * @brief C custom defined SMUSD\r
1040    */\r
1041   __STATIC_FORCEINLINE uint32_t __SMUSD(\r
1042   uint32_t x,\r
1043   uint32_t y)\r
1044   {\r
1045     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -\r
1046                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16))   ));\r
1047   }\r
1048 \r
1049 \r
1050   /*\r
1051    * @brief C custom defined SXTB16\r
1052    */\r
1053   __STATIC_FORCEINLINE uint32_t __SXTB16(\r
1054   uint32_t x)\r
1055   {\r
1056     return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |\r
1057                        ((((q31_t)x <<  8) >>  8) & (q31_t)0xFFFF0000)  ));\r
1058   }\r
1059 \r
1060   /*\r
1061    * @brief C custom defined SMMLA\r
1062    */\r
1063   __STATIC_FORCEINLINE int32_t __SMMLA(\r
1064   int32_t x,\r
1065   int32_t y,\r
1066   int32_t sum)\r
1067   {\r
1068     return (sum + (int32_t) (((int64_t) x * y) >> 32));\r
1069   }\r
1070 \r
1071 #endif /* !defined (ARM_MATH_DSP) */\r
1072 \r
1073 \r
1074   /**\r
1075    * @brief Instance structure for the Q7 FIR filter.\r
1076    */\r
1077   typedef struct\r
1078   {\r
1079           uint16_t numTaps;        /**< number of filter coefficients in the filter. */\r
1080           q7_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1081     const q7_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/\r
1082   } arm_fir_instance_q7;\r
1083 \r
1084   /**\r
1085    * @brief Instance structure for the Q15 FIR filter.\r
1086    */\r
1087   typedef struct\r
1088   {\r
1089           uint16_t numTaps;         /**< number of filter coefficients in the filter. */\r
1090           q15_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1091     const q15_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/\r
1092   } arm_fir_instance_q15;\r
1093 \r
1094   /**\r
1095    * @brief Instance structure for the Q31 FIR filter.\r
1096    */\r
1097   typedef struct\r
1098   {\r
1099           uint16_t numTaps;         /**< number of filter coefficients in the filter. */\r
1100           q31_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1101     const q31_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps. */\r
1102   } arm_fir_instance_q31;\r
1103 \r
1104   /**\r
1105    * @brief Instance structure for the floating-point FIR filter.\r
1106    */\r
1107   typedef struct\r
1108   {\r
1109           uint16_t numTaps;     /**< number of filter coefficients in the filter. */\r
1110           float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1111     const float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */\r
1112   } arm_fir_instance_f32;\r
1113 \r
1114   /**\r
1115    * @brief Processing function for the Q7 FIR filter.\r
1116    * @param[in]  S          points to an instance of the Q7 FIR filter structure.\r
1117    * @param[in]  pSrc       points to the block of input data.\r
1118    * @param[out] pDst       points to the block of output data.\r
1119    * @param[in]  blockSize  number of samples to process.\r
1120    */\r
1121   void arm_fir_q7(\r
1122   const arm_fir_instance_q7 * S,\r
1123   const q7_t * pSrc,\r
1124         q7_t * pDst,\r
1125         uint32_t blockSize);\r
1126 \r
1127   /**\r
1128    * @brief  Initialization function for the Q7 FIR filter.\r
1129    * @param[in,out] S          points to an instance of the Q7 FIR structure.\r
1130    * @param[in]     numTaps    Number of filter coefficients in the filter.\r
1131    * @param[in]     pCoeffs    points to the filter coefficients.\r
1132    * @param[in]     pState     points to the state buffer.\r
1133    * @param[in]     blockSize  number of samples that are processed.\r
1134    */\r
1135   void arm_fir_init_q7(\r
1136         arm_fir_instance_q7 * S,\r
1137         uint16_t numTaps,\r
1138   const q7_t * pCoeffs,\r
1139         q7_t * pState,\r
1140         uint32_t blockSize);\r
1141 \r
1142   /**\r
1143    * @brief Processing function for the Q15 FIR filter.\r
1144    * @param[in]  S          points to an instance of the Q15 FIR structure.\r
1145    * @param[in]  pSrc       points to the block of input data.\r
1146    * @param[out] pDst       points to the block of output data.\r
1147    * @param[in]  blockSize  number of samples to process.\r
1148    */\r
1149   void arm_fir_q15(\r
1150   const arm_fir_instance_q15 * S,\r
1151   const q15_t * pSrc,\r
1152         q15_t * pDst,\r
1153         uint32_t blockSize);\r
1154 \r
1155   /**\r
1156    * @brief Processing function for the fast Q15 FIR filter (fast version).\r
1157    * @param[in]  S          points to an instance of the Q15 FIR filter structure.\r
1158    * @param[in]  pSrc       points to the block of input data.\r
1159    * @param[out] pDst       points to the block of output data.\r
1160    * @param[in]  blockSize  number of samples to process.\r
1161    */\r
1162   void arm_fir_fast_q15(\r
1163   const arm_fir_instance_q15 * S,\r
1164   const q15_t * pSrc,\r
1165         q15_t * pDst,\r
1166         uint32_t blockSize);\r
1167 \r
1168   /**\r
1169    * @brief  Initialization function for the Q15 FIR filter.\r
1170    * @param[in,out] S          points to an instance of the Q15 FIR filter structure.\r
1171    * @param[in]     numTaps    Number of filter coefficients in the filter. Must be even and greater than or equal to 4.\r
1172    * @param[in]     pCoeffs    points to the filter coefficients.\r
1173    * @param[in]     pState     points to the state buffer.\r
1174    * @param[in]     blockSize  number of samples that are processed at a time.\r
1175    * @return     The function returns either\r
1176    * <code>ARM_MATH_SUCCESS</code> if initialization was successful or\r
1177    * <code>ARM_MATH_ARGUMENT_ERROR</code> if <code>numTaps</code> is not a supported value.\r
1178    */\r
1179   arm_status arm_fir_init_q15(\r
1180         arm_fir_instance_q15 * S,\r
1181         uint16_t numTaps,\r
1182   const q15_t * pCoeffs,\r
1183         q15_t * pState,\r
1184         uint32_t blockSize);\r
1185 \r
1186   /**\r
1187    * @brief Processing function for the Q31 FIR filter.\r
1188    * @param[in]  S          points to an instance of the Q31 FIR filter structure.\r
1189    * @param[in]  pSrc       points to the block of input data.\r
1190    * @param[out] pDst       points to the block of output data.\r
1191    * @param[in]  blockSize  number of samples to process.\r
1192    */\r
1193   void arm_fir_q31(\r
1194   const arm_fir_instance_q31 * S,\r
1195   const q31_t * pSrc,\r
1196         q31_t * pDst,\r
1197         uint32_t blockSize);\r
1198 \r
1199   /**\r
1200    * @brief Processing function for the fast Q31 FIR filter (fast version).\r
1201    * @param[in]  S          points to an instance of the Q31 FIR filter structure.\r
1202    * @param[in]  pSrc       points to the block of input data.\r
1203    * @param[out] pDst       points to the block of output data.\r
1204    * @param[in]  blockSize  number of samples to process.\r
1205    */\r
1206   void arm_fir_fast_q31(\r
1207   const arm_fir_instance_q31 * S,\r
1208   const q31_t * pSrc,\r
1209         q31_t * pDst,\r
1210         uint32_t blockSize);\r
1211 \r
1212   /**\r
1213    * @brief  Initialization function for the Q31 FIR filter.\r
1214    * @param[in,out] S          points to an instance of the Q31 FIR structure.\r
1215    * @param[in]     numTaps    Number of filter coefficients in the filter.\r
1216    * @param[in]     pCoeffs    points to the filter coefficients.\r
1217    * @param[in]     pState     points to the state buffer.\r
1218    * @param[in]     blockSize  number of samples that are processed at a time.\r
1219    */\r
1220   void arm_fir_init_q31(\r
1221         arm_fir_instance_q31 * S,\r
1222         uint16_t numTaps,\r
1223   const q31_t * pCoeffs,\r
1224         q31_t * pState,\r
1225         uint32_t blockSize);\r
1226 \r
1227   /**\r
1228    * @brief Processing function for the floating-point FIR filter.\r
1229    * @param[in]  S          points to an instance of the floating-point FIR structure.\r
1230    * @param[in]  pSrc       points to the block of input data.\r
1231    * @param[out] pDst       points to the block of output data.\r
1232    * @param[in]  blockSize  number of samples to process.\r
1233    */\r
1234   void arm_fir_f32(\r
1235   const arm_fir_instance_f32 * S,\r
1236   const float32_t * pSrc,\r
1237         float32_t * pDst,\r
1238         uint32_t blockSize);\r
1239 \r
1240   /**\r
1241    * @brief  Initialization function for the floating-point FIR filter.\r
1242    * @param[in,out] S          points to an instance of the floating-point FIR filter structure.\r
1243    * @param[in]     numTaps    Number of filter coefficients in the filter.\r
1244    * @param[in]     pCoeffs    points to the filter coefficients.\r
1245    * @param[in]     pState     points to the state buffer.\r
1246    * @param[in]     blockSize  number of samples that are processed at a time.\r
1247    */\r
1248   void arm_fir_init_f32(\r
1249         arm_fir_instance_f32 * S,\r
1250         uint16_t numTaps,\r
1251   const float32_t * pCoeffs,\r
1252         float32_t * pState,\r
1253         uint32_t blockSize);\r
1254 \r
1255   /**\r
1256    * @brief Instance structure for the Q15 Biquad cascade filter.\r
1257    */\r
1258   typedef struct\r
1259   {\r
1260           int8_t numStages;        /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
1261           q15_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */\r
1262     const q15_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */\r
1263           int8_t postShift;        /**< Additional shift, in bits, applied to each output sample. */\r
1264   } arm_biquad_casd_df1_inst_q15;\r
1265 \r
1266   /**\r
1267    * @brief Instance structure for the Q31 Biquad cascade filter.\r
1268    */\r
1269   typedef struct\r
1270   {\r
1271           uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
1272           q31_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */\r
1273     const q31_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */\r
1274           uint8_t postShift;       /**< Additional shift, in bits, applied to each output sample. */\r
1275   } arm_biquad_casd_df1_inst_q31;\r
1276 \r
1277   /**\r
1278    * @brief Instance structure for the floating-point Biquad cascade filter.\r
1279    */\r
1280   typedef struct\r
1281   {\r
1282           uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
1283           float32_t *pState;       /**< Points to the array of state coefficients.  The array is of length 4*numStages. */\r
1284     const float32_t *pCoeffs;      /**< Points to the array of coefficients.  The array is of length 5*numStages. */\r
1285   } arm_biquad_casd_df1_inst_f32;\r
1286 \r
1287   /**\r
1288    * @brief Processing function for the Q15 Biquad cascade filter.\r
1289    * @param[in]  S          points to an instance of the Q15 Biquad cascade structure.\r
1290    * @param[in]  pSrc       points to the block of input data.\r
1291    * @param[out] pDst       points to the block of output data.\r
1292    * @param[in]  blockSize  number of samples to process.\r
1293    */\r
1294   void arm_biquad_cascade_df1_q15(\r
1295   const arm_biquad_casd_df1_inst_q15 * S,\r
1296   const q15_t * pSrc,\r
1297         q15_t * pDst,\r
1298         uint32_t blockSize);\r
1299 \r
1300   /**\r
1301    * @brief  Initialization function for the Q15 Biquad cascade filter.\r
1302    * @param[in,out] S          points to an instance of the Q15 Biquad cascade structure.\r
1303    * @param[in]     numStages  number of 2nd order stages in the filter.\r
1304    * @param[in]     pCoeffs    points to the filter coefficients.\r
1305    * @param[in]     pState     points to the state buffer.\r
1306    * @param[in]     postShift  Shift to be applied to the output. Varies according to the coefficients format\r
1307    */\r
1308   void arm_biquad_cascade_df1_init_q15(\r
1309         arm_biquad_casd_df1_inst_q15 * S,\r
1310         uint8_t numStages,\r
1311   const q15_t * pCoeffs,\r
1312         q15_t * pState,\r
1313         int8_t postShift);\r
1314 \r
1315   /**\r
1316    * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.\r
1317    * @param[in]  S          points to an instance of the Q15 Biquad cascade structure.\r
1318    * @param[in]  pSrc       points to the block of input data.\r
1319    * @param[out] pDst       points to the block of output data.\r
1320    * @param[in]  blockSize  number of samples to process.\r
1321    */\r
1322   void arm_biquad_cascade_df1_fast_q15(\r
1323   const arm_biquad_casd_df1_inst_q15 * S,\r
1324   const q15_t * pSrc,\r
1325         q15_t * pDst,\r
1326         uint32_t blockSize);\r
1327 \r
1328   /**\r
1329    * @brief Processing function for the Q31 Biquad cascade filter\r
1330    * @param[in]  S          points to an instance of the Q31 Biquad cascade structure.\r
1331    * @param[in]  pSrc       points to the block of input data.\r
1332    * @param[out] pDst       points to the block of output data.\r
1333    * @param[in]  blockSize  number of samples to process.\r
1334    */\r
1335   void arm_biquad_cascade_df1_q31(\r
1336   const arm_biquad_casd_df1_inst_q31 * S,\r
1337   const q31_t * pSrc,\r
1338         q31_t * pDst,\r
1339         uint32_t blockSize);\r
1340 \r
1341   /**\r
1342    * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.\r
1343    * @param[in]  S          points to an instance of the Q31 Biquad cascade structure.\r
1344    * @param[in]  pSrc       points to the block of input data.\r
1345    * @param[out] pDst       points to the block of output data.\r
1346    * @param[in]  blockSize  number of samples to process.\r
1347    */\r
1348   void arm_biquad_cascade_df1_fast_q31(\r
1349   const arm_biquad_casd_df1_inst_q31 * S,\r
1350   const q31_t * pSrc,\r
1351         q31_t * pDst,\r
1352         uint32_t blockSize);\r
1353 \r
1354   /**\r
1355    * @brief  Initialization function for the Q31 Biquad cascade filter.\r
1356    * @param[in,out] S          points to an instance of the Q31 Biquad cascade structure.\r
1357    * @param[in]     numStages  number of 2nd order stages in the filter.\r
1358    * @param[in]     pCoeffs    points to the filter coefficients.\r
1359    * @param[in]     pState     points to the state buffer.\r
1360    * @param[in]     postShift  Shift to be applied to the output. Varies according to the coefficients format\r
1361    */\r
1362   void arm_biquad_cascade_df1_init_q31(\r
1363         arm_biquad_casd_df1_inst_q31 * S,\r
1364         uint8_t numStages,\r
1365   const q31_t * pCoeffs,\r
1366         q31_t * pState,\r
1367         int8_t postShift);\r
1368 \r
1369   /**\r
1370    * @brief Processing function for the floating-point Biquad cascade filter.\r
1371    * @param[in]  S          points to an instance of the floating-point Biquad cascade structure.\r
1372    * @param[in]  pSrc       points to the block of input data.\r
1373    * @param[out] pDst       points to the block of output data.\r
1374    * @param[in]  blockSize  number of samples to process.\r
1375    */\r
1376   void arm_biquad_cascade_df1_f32(\r
1377   const arm_biquad_casd_df1_inst_f32 * S,\r
1378   const float32_t * pSrc,\r
1379         float32_t * pDst,\r
1380         uint32_t blockSize);\r
1381 \r
1382   /**\r
1383    * @brief  Initialization function for the floating-point Biquad cascade filter.\r
1384    * @param[in,out] S          points to an instance of the floating-point Biquad cascade structure.\r
1385    * @param[in]     numStages  number of 2nd order stages in the filter.\r
1386    * @param[in]     pCoeffs    points to the filter coefficients.\r
1387    * @param[in]     pState     points to the state buffer.\r
1388    */\r
1389   void arm_biquad_cascade_df1_init_f32(\r
1390         arm_biquad_casd_df1_inst_f32 * S,\r
1391         uint8_t numStages,\r
1392   const float32_t * pCoeffs,\r
1393         float32_t * pState);\r
1394 \r
1395   /**\r
1396    * @brief Instance structure for the floating-point matrix structure.\r
1397    */\r
1398   typedef struct\r
1399   {\r
1400     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1401     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1402     float32_t *pData;     /**< points to the data of the matrix. */\r
1403   } arm_matrix_instance_f32;\r
1404 \r
1405 \r
1406   /**\r
1407    * @brief Instance structure for the floating-point matrix structure.\r
1408    */\r
1409   typedef struct\r
1410   {\r
1411     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1412     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1413     float64_t *pData;     /**< points to the data of the matrix. */\r
1414   } arm_matrix_instance_f64;\r
1415 \r
1416   /**\r
1417    * @brief Instance structure for the Q15 matrix structure.\r
1418    */\r
1419   typedef struct\r
1420   {\r
1421     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1422     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1423     q15_t *pData;         /**< points to the data of the matrix. */\r
1424   } arm_matrix_instance_q15;\r
1425 \r
1426   /**\r
1427    * @brief Instance structure for the Q31 matrix structure.\r
1428    */\r
1429   typedef struct\r
1430   {\r
1431     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1432     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1433     q31_t *pData;         /**< points to the data of the matrix. */\r
1434   } arm_matrix_instance_q31;\r
1435 \r
1436   /**\r
1437    * @brief Floating-point matrix addition.\r
1438    * @param[in]  pSrcA  points to the first input matrix structure\r
1439    * @param[in]  pSrcB  points to the second input matrix structure\r
1440    * @param[out] pDst   points to output matrix structure\r
1441    * @return     The function returns either\r
1442    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1443    */\r
1444 arm_status arm_mat_add_f32(\r
1445   const arm_matrix_instance_f32 * pSrcA,\r
1446   const arm_matrix_instance_f32 * pSrcB,\r
1447         arm_matrix_instance_f32 * pDst);\r
1448 \r
1449   /**\r
1450    * @brief Q15 matrix addition.\r
1451    * @param[in]   pSrcA  points to the first input matrix structure\r
1452    * @param[in]   pSrcB  points to the second input matrix structure\r
1453    * @param[out]  pDst   points to output matrix structure\r
1454    * @return     The function returns either\r
1455    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1456    */\r
1457 arm_status arm_mat_add_q15(\r
1458   const arm_matrix_instance_q15 * pSrcA,\r
1459   const arm_matrix_instance_q15 * pSrcB,\r
1460         arm_matrix_instance_q15 * pDst);\r
1461 \r
1462   /**\r
1463    * @brief Q31 matrix addition.\r
1464    * @param[in]  pSrcA  points to the first input matrix structure\r
1465    * @param[in]  pSrcB  points to the second input matrix structure\r
1466    * @param[out] pDst   points to output matrix structure\r
1467    * @return     The function returns either\r
1468    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1469    */\r
1470 arm_status arm_mat_add_q31(\r
1471   const arm_matrix_instance_q31 * pSrcA,\r
1472   const arm_matrix_instance_q31 * pSrcB,\r
1473         arm_matrix_instance_q31 * pDst);\r
1474 \r
1475   /**\r
1476    * @brief Floating-point, complex, matrix multiplication.\r
1477    * @param[in]  pSrcA  points to the first input matrix structure\r
1478    * @param[in]  pSrcB  points to the second input matrix structure\r
1479    * @param[out] pDst   points to output matrix structure\r
1480    * @return     The function returns either\r
1481    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1482    */\r
1483 arm_status arm_mat_cmplx_mult_f32(\r
1484   const arm_matrix_instance_f32 * pSrcA,\r
1485   const arm_matrix_instance_f32 * pSrcB,\r
1486         arm_matrix_instance_f32 * pDst);\r
1487 \r
1488   /**\r
1489    * @brief Q15, complex,  matrix multiplication.\r
1490    * @param[in]  pSrcA  points to the first input matrix structure\r
1491    * @param[in]  pSrcB  points to the second input matrix structure\r
1492    * @param[out] pDst   points to output matrix structure\r
1493    * @return     The function returns either\r
1494    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1495    */\r
1496 arm_status arm_mat_cmplx_mult_q15(\r
1497   const arm_matrix_instance_q15 * pSrcA,\r
1498   const arm_matrix_instance_q15 * pSrcB,\r
1499         arm_matrix_instance_q15 * pDst,\r
1500         q15_t * pScratch);\r
1501 \r
1502   /**\r
1503    * @brief Q31, complex, matrix multiplication.\r
1504    * @param[in]  pSrcA  points to the first input matrix structure\r
1505    * @param[in]  pSrcB  points to the second input matrix structure\r
1506    * @param[out] pDst   points to output matrix structure\r
1507    * @return     The function returns either\r
1508    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1509    */\r
1510 arm_status arm_mat_cmplx_mult_q31(\r
1511   const arm_matrix_instance_q31 * pSrcA,\r
1512   const arm_matrix_instance_q31 * pSrcB,\r
1513         arm_matrix_instance_q31 * pDst);\r
1514 \r
1515   /**\r
1516    * @brief Floating-point matrix transpose.\r
1517    * @param[in]  pSrc  points to the input matrix\r
1518    * @param[out] pDst  points to the output matrix\r
1519    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>\r
1520    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1521    */\r
1522 arm_status arm_mat_trans_f32(\r
1523   const arm_matrix_instance_f32 * pSrc,\r
1524         arm_matrix_instance_f32 * pDst);\r
1525 \r
1526   /**\r
1527    * @brief Q15 matrix transpose.\r
1528    * @param[in]  pSrc  points to the input matrix\r
1529    * @param[out] pDst  points to the output matrix\r
1530    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>\r
1531    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1532    */\r
1533 arm_status arm_mat_trans_q15(\r
1534   const arm_matrix_instance_q15 * pSrc,\r
1535         arm_matrix_instance_q15 * pDst);\r
1536 \r
1537   /**\r
1538    * @brief Q31 matrix transpose.\r
1539    * @param[in]  pSrc  points to the input matrix\r
1540    * @param[out] pDst  points to the output matrix\r
1541    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>\r
1542    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1543    */\r
1544 arm_status arm_mat_trans_q31(\r
1545   const arm_matrix_instance_q31 * pSrc,\r
1546         arm_matrix_instance_q31 * pDst);\r
1547 \r
1548   /**\r
1549    * @brief Floating-point matrix multiplication\r
1550    * @param[in]  pSrcA  points to the first input matrix structure\r
1551    * @param[in]  pSrcB  points to the second input matrix structure\r
1552    * @param[out] pDst   points to output matrix structure\r
1553    * @return     The function returns either\r
1554    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1555    */\r
1556 arm_status arm_mat_mult_f32(\r
1557   const arm_matrix_instance_f32 * pSrcA,\r
1558   const arm_matrix_instance_f32 * pSrcB,\r
1559         arm_matrix_instance_f32 * pDst);\r
1560 \r
1561   /**\r
1562    * @brief Q15 matrix multiplication\r
1563    * @param[in]  pSrcA   points to the first input matrix structure\r
1564    * @param[in]  pSrcB   points to the second input matrix structure\r
1565    * @param[out] pDst    points to output matrix structure\r
1566    * @param[in]  pState  points to the array for storing intermediate results\r
1567    * @return     The function returns either\r
1568    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1569    */\r
1570 arm_status arm_mat_mult_q15(\r
1571   const arm_matrix_instance_q15 * pSrcA,\r
1572   const arm_matrix_instance_q15 * pSrcB,\r
1573         arm_matrix_instance_q15 * pDst,\r
1574         q15_t * pState);\r
1575 \r
1576   /**\r
1577    * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4\r
1578    * @param[in]  pSrcA   points to the first input matrix structure\r
1579    * @param[in]  pSrcB   points to the second input matrix structure\r
1580    * @param[out] pDst    points to output matrix structure\r
1581    * @param[in]  pState  points to the array for storing intermediate results\r
1582    * @return     The function returns either\r
1583    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1584    */\r
1585 arm_status arm_mat_mult_fast_q15(\r
1586   const arm_matrix_instance_q15 * pSrcA,\r
1587   const arm_matrix_instance_q15 * pSrcB,\r
1588         arm_matrix_instance_q15 * pDst,\r
1589         q15_t * pState);\r
1590 \r
1591   /**\r
1592    * @brief Q31 matrix multiplication\r
1593    * @param[in]  pSrcA  points to the first input matrix structure\r
1594    * @param[in]  pSrcB  points to the second input matrix structure\r
1595    * @param[out] pDst   points to output matrix structure\r
1596    * @return     The function returns either\r
1597    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1598    */\r
1599 arm_status arm_mat_mult_q31(\r
1600   const arm_matrix_instance_q31 * pSrcA,\r
1601   const arm_matrix_instance_q31 * pSrcB,\r
1602         arm_matrix_instance_q31 * pDst);\r
1603 \r
1604   /**\r
1605    * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4\r
1606    * @param[in]  pSrcA  points to the first input matrix structure\r
1607    * @param[in]  pSrcB  points to the second input matrix structure\r
1608    * @param[out] pDst   points to output matrix structure\r
1609    * @return     The function returns either\r
1610    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1611    */\r
1612 arm_status arm_mat_mult_fast_q31(\r
1613   const arm_matrix_instance_q31 * pSrcA,\r
1614   const arm_matrix_instance_q31 * pSrcB,\r
1615         arm_matrix_instance_q31 * pDst);\r
1616 \r
1617   /**\r
1618    * @brief Floating-point matrix subtraction\r
1619    * @param[in]  pSrcA  points to the first input matrix structure\r
1620    * @param[in]  pSrcB  points to the second input matrix structure\r
1621    * @param[out] pDst   points to output matrix structure\r
1622    * @return     The function returns either\r
1623    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1624    */\r
1625 arm_status arm_mat_sub_f32(\r
1626   const arm_matrix_instance_f32 * pSrcA,\r
1627   const arm_matrix_instance_f32 * pSrcB,\r
1628         arm_matrix_instance_f32 * pDst);\r
1629 \r
1630   /**\r
1631    * @brief Q15 matrix subtraction\r
1632    * @param[in]  pSrcA  points to the first input matrix structure\r
1633    * @param[in]  pSrcB  points to the second input matrix structure\r
1634    * @param[out] pDst   points to output matrix structure\r
1635    * @return     The function returns either\r
1636    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1637    */\r
1638 arm_status arm_mat_sub_q15(\r
1639   const arm_matrix_instance_q15 * pSrcA,\r
1640   const arm_matrix_instance_q15 * pSrcB,\r
1641         arm_matrix_instance_q15 * pDst);\r
1642 \r
1643   /**\r
1644    * @brief Q31 matrix subtraction\r
1645    * @param[in]  pSrcA  points to the first input matrix structure\r
1646    * @param[in]  pSrcB  points to the second input matrix structure\r
1647    * @param[out] pDst   points to output matrix structure\r
1648    * @return     The function returns either\r
1649    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1650    */\r
1651 arm_status arm_mat_sub_q31(\r
1652   const arm_matrix_instance_q31 * pSrcA,\r
1653   const arm_matrix_instance_q31 * pSrcB,\r
1654         arm_matrix_instance_q31 * pDst);\r
1655 \r
1656   /**\r
1657    * @brief Floating-point matrix scaling.\r
1658    * @param[in]  pSrc   points to the input matrix\r
1659    * @param[in]  scale  scale factor\r
1660    * @param[out] pDst   points to the output matrix\r
1661    * @return     The function returns either\r
1662    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1663    */\r
1664 arm_status arm_mat_scale_f32(\r
1665   const arm_matrix_instance_f32 * pSrc,\r
1666         float32_t scale,\r
1667         arm_matrix_instance_f32 * pDst);\r
1668 \r
1669   /**\r
1670    * @brief Q15 matrix scaling.\r
1671    * @param[in]  pSrc        points to input matrix\r
1672    * @param[in]  scaleFract  fractional portion of the scale factor\r
1673    * @param[in]  shift       number of bits to shift the result by\r
1674    * @param[out] pDst        points to output matrix\r
1675    * @return     The function returns either\r
1676    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1677    */\r
1678 arm_status arm_mat_scale_q15(\r
1679   const arm_matrix_instance_q15 * pSrc,\r
1680         q15_t scaleFract,\r
1681         int32_t shift,\r
1682         arm_matrix_instance_q15 * pDst);\r
1683 \r
1684   /**\r
1685    * @brief Q31 matrix scaling.\r
1686    * @param[in]  pSrc        points to input matrix\r
1687    * @param[in]  scaleFract  fractional portion of the scale factor\r
1688    * @param[in]  shift       number of bits to shift the result by\r
1689    * @param[out] pDst        points to output matrix structure\r
1690    * @return     The function returns either\r
1691    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1692    */\r
1693 arm_status arm_mat_scale_q31(\r
1694   const arm_matrix_instance_q31 * pSrc,\r
1695         q31_t scaleFract,\r
1696         int32_t shift,\r
1697         arm_matrix_instance_q31 * pDst);\r
1698 \r
1699   /**\r
1700    * @brief  Q31 matrix initialization.\r
1701    * @param[in,out] S         points to an instance of the floating-point matrix structure.\r
1702    * @param[in]     nRows     number of rows in the matrix.\r
1703    * @param[in]     nColumns  number of columns in the matrix.\r
1704    * @param[in]     pData     points to the matrix data array.\r
1705    */\r
1706 void arm_mat_init_q31(\r
1707         arm_matrix_instance_q31 * S,\r
1708         uint16_t nRows,\r
1709         uint16_t nColumns,\r
1710         q31_t * pData);\r
1711 \r
1712   /**\r
1713    * @brief  Q15 matrix initialization.\r
1714    * @param[in,out] S         points to an instance of the floating-point matrix structure.\r
1715    * @param[in]     nRows     number of rows in the matrix.\r
1716    * @param[in]     nColumns  number of columns in the matrix.\r
1717    * @param[in]     pData     points to the matrix data array.\r
1718    */\r
1719 void arm_mat_init_q15(\r
1720         arm_matrix_instance_q15 * S,\r
1721         uint16_t nRows,\r
1722         uint16_t nColumns,\r
1723         q15_t * pData);\r
1724 \r
1725   /**\r
1726    * @brief  Floating-point matrix initialization.\r
1727    * @param[in,out] S         points to an instance of the floating-point matrix structure.\r
1728    * @param[in]     nRows     number of rows in the matrix.\r
1729    * @param[in]     nColumns  number of columns in the matrix.\r
1730    * @param[in]     pData     points to the matrix data array.\r
1731    */\r
1732 void arm_mat_init_f32(\r
1733         arm_matrix_instance_f32 * S,\r
1734         uint16_t nRows,\r
1735         uint16_t nColumns,\r
1736         float32_t * pData);\r
1737 \r
1738 \r
1739   /**\r
1740    * @brief Instance structure for the Q15 PID Control.\r
1741    */\r
1742   typedef struct\r
1743   {\r
1744           q15_t A0;           /**< The derived gain, A0 = Kp + Ki + Kd . */\r
1745 #if !defined (ARM_MATH_DSP)\r
1746           q15_t A1;\r
1747           q15_t A2;\r
1748 #else\r
1749           q31_t A1;           /**< The derived gain A1 = -Kp - 2Kd | Kd.*/\r
1750 #endif\r
1751           q15_t state[3];     /**< The state array of length 3. */\r
1752           q15_t Kp;           /**< The proportional gain. */\r
1753           q15_t Ki;           /**< The integral gain. */\r
1754           q15_t Kd;           /**< The derivative gain. */\r
1755   } arm_pid_instance_q15;\r
1756 \r
1757   /**\r
1758    * @brief Instance structure for the Q31 PID Control.\r
1759    */\r
1760   typedef struct\r
1761   {\r
1762           q31_t A0;            /**< The derived gain, A0 = Kp + Ki + Kd . */\r
1763           q31_t A1;            /**< The derived gain, A1 = -Kp - 2Kd. */\r
1764           q31_t A2;            /**< The derived gain, A2 = Kd . */\r
1765           q31_t state[3];      /**< The state array of length 3. */\r
1766           q31_t Kp;            /**< The proportional gain. */\r
1767           q31_t Ki;            /**< The integral gain. */\r
1768           q31_t Kd;            /**< The derivative gain. */\r
1769   } arm_pid_instance_q31;\r
1770 \r
1771   /**\r
1772    * @brief Instance structure for the floating-point PID Control.\r
1773    */\r
1774   typedef struct\r
1775   {\r
1776           float32_t A0;          /**< The derived gain, A0 = Kp + Ki + Kd . */\r
1777           float32_t A1;          /**< The derived gain, A1 = -Kp - 2Kd. */\r
1778           float32_t A2;          /**< The derived gain, A2 = Kd . */\r
1779           float32_t state[3];    /**< The state array of length 3. */\r
1780           float32_t Kp;          /**< The proportional gain. */\r
1781           float32_t Ki;          /**< The integral gain. */\r
1782           float32_t Kd;          /**< The derivative gain. */\r
1783   } arm_pid_instance_f32;\r
1784 \r
1785 \r
1786 \r
1787   /**\r
1788    * @brief  Initialization function for the floating-point PID Control.\r
1789    * @param[in,out] S               points to an instance of the PID structure.\r
1790    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.\r
1791    */\r
1792   void arm_pid_init_f32(\r
1793         arm_pid_instance_f32 * S,\r
1794         int32_t resetStateFlag);\r
1795 \r
1796 \r
1797   /**\r
1798    * @brief  Reset function for the floating-point PID Control.\r
1799    * @param[in,out] S  is an instance of the floating-point PID Control structure\r
1800    */\r
1801   void arm_pid_reset_f32(\r
1802         arm_pid_instance_f32 * S);\r
1803 \r
1804 \r
1805   /**\r
1806    * @brief  Initialization function for the Q31 PID Control.\r
1807    * @param[in,out] S               points to an instance of the Q15 PID structure.\r
1808    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.\r
1809    */\r
1810   void arm_pid_init_q31(\r
1811         arm_pid_instance_q31 * S,\r
1812         int32_t resetStateFlag);\r
1813 \r
1814 \r
1815   /**\r
1816    * @brief  Reset function for the Q31 PID Control.\r
1817    * @param[in,out] S   points to an instance of the Q31 PID Control structure\r
1818    */\r
1819 \r
1820   void arm_pid_reset_q31(\r
1821         arm_pid_instance_q31 * S);\r
1822 \r
1823 \r
1824   /**\r
1825    * @brief  Initialization function for the Q15 PID Control.\r
1826    * @param[in,out] S               points to an instance of the Q15 PID structure.\r
1827    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.\r
1828    */\r
1829   void arm_pid_init_q15(\r
1830         arm_pid_instance_q15 * S,\r
1831         int32_t resetStateFlag);\r
1832 \r
1833 \r
1834   /**\r
1835    * @brief  Reset function for the Q15 PID Control.\r
1836    * @param[in,out] S  points to an instance of the q15 PID Control structure\r
1837    */\r
1838   void arm_pid_reset_q15(\r
1839         arm_pid_instance_q15 * S);\r
1840 \r
1841 \r
1842   /**\r
1843    * @brief Instance structure for the floating-point Linear Interpolate function.\r
1844    */\r
1845   typedef struct\r
1846   {\r
1847           uint32_t nValues;           /**< nValues */\r
1848           float32_t x1;               /**< x1 */\r
1849           float32_t xSpacing;         /**< xSpacing */\r
1850           float32_t *pYData;          /**< pointer to the table of Y values */\r
1851   } arm_linear_interp_instance_f32;\r
1852 \r
1853   /**\r
1854    * @brief Instance structure for the floating-point bilinear interpolation function.\r
1855    */\r
1856   typedef struct\r
1857   {\r
1858           uint16_t numRows;   /**< number of rows in the data table. */\r
1859           uint16_t numCols;   /**< number of columns in the data table. */\r
1860           float32_t *pData;   /**< points to the data table. */\r
1861   } arm_bilinear_interp_instance_f32;\r
1862 \r
1863    /**\r
1864    * @brief Instance structure for the Q31 bilinear interpolation function.\r
1865    */\r
1866   typedef struct\r
1867   {\r
1868           uint16_t numRows;   /**< number of rows in the data table. */\r
1869           uint16_t numCols;   /**< number of columns in the data table. */\r
1870           q31_t *pData;       /**< points to the data table. */\r
1871   } arm_bilinear_interp_instance_q31;\r
1872 \r
1873    /**\r
1874    * @brief Instance structure for the Q15 bilinear interpolation function.\r
1875    */\r
1876   typedef struct\r
1877   {\r
1878           uint16_t numRows;   /**< number of rows in the data table. */\r
1879           uint16_t numCols;   /**< number of columns in the data table. */\r
1880           q15_t *pData;       /**< points to the data table. */\r
1881   } arm_bilinear_interp_instance_q15;\r
1882 \r
1883    /**\r
1884    * @brief Instance structure for the Q15 bilinear interpolation function.\r
1885    */\r
1886   typedef struct\r
1887   {\r
1888           uint16_t numRows;   /**< number of rows in the data table. */\r
1889           uint16_t numCols;   /**< number of columns in the data table. */\r
1890           q7_t *pData;        /**< points to the data table. */\r
1891   } arm_bilinear_interp_instance_q7;\r
1892 \r
1893 \r
1894   /**\r
1895    * @brief Q7 vector multiplication.\r
1896    * @param[in]  pSrcA      points to the first input vector\r
1897    * @param[in]  pSrcB      points to the second input vector\r
1898    * @param[out] pDst       points to the output vector\r
1899    * @param[in]  blockSize  number of samples in each vector\r
1900    */\r
1901   void arm_mult_q7(\r
1902   const q7_t * pSrcA,\r
1903   const q7_t * pSrcB,\r
1904         q7_t * pDst,\r
1905         uint32_t blockSize);\r
1906 \r
1907 \r
1908   /**\r
1909    * @brief Q15 vector multiplication.\r
1910    * @param[in]  pSrcA      points to the first input vector\r
1911    * @param[in]  pSrcB      points to the second input vector\r
1912    * @param[out] pDst       points to the output vector\r
1913    * @param[in]  blockSize  number of samples in each vector\r
1914    */\r
1915   void arm_mult_q15(\r
1916   const q15_t * pSrcA,\r
1917   const q15_t * pSrcB,\r
1918         q15_t * pDst,\r
1919         uint32_t blockSize);\r
1920 \r
1921 \r
1922   /**\r
1923    * @brief Q31 vector multiplication.\r
1924    * @param[in]  pSrcA      points to the first input vector\r
1925    * @param[in]  pSrcB      points to the second input vector\r
1926    * @param[out] pDst       points to the output vector\r
1927    * @param[in]  blockSize  number of samples in each vector\r
1928    */\r
1929   void arm_mult_q31(\r
1930   const q31_t * pSrcA,\r
1931   const q31_t * pSrcB,\r
1932         q31_t * pDst,\r
1933         uint32_t blockSize);\r
1934 \r
1935 \r
1936   /**\r
1937    * @brief Floating-point vector multiplication.\r
1938    * @param[in]  pSrcA      points to the first input vector\r
1939    * @param[in]  pSrcB      points to the second input vector\r
1940    * @param[out] pDst       points to the output vector\r
1941    * @param[in]  blockSize  number of samples in each vector\r
1942    */\r
1943   void arm_mult_f32(\r
1944   const float32_t * pSrcA,\r
1945   const float32_t * pSrcB,\r
1946         float32_t * pDst,\r
1947         uint32_t blockSize);\r
1948 \r
1949 \r
1950   /**\r
1951    * @brief Instance structure for the Q15 CFFT/CIFFT function.\r
1952    */\r
1953   typedef struct\r
1954   {\r
1955           uint16_t fftLen;                 /**< length of the FFT. */\r
1956           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
1957           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
1958     const q15_t *pTwiddle;                 /**< points to the Sin twiddle factor table. */\r
1959     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
1960           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
1961           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
1962   } arm_cfft_radix2_instance_q15;\r
1963 \r
1964 /* Deprecated */\r
1965   arm_status arm_cfft_radix2_init_q15(\r
1966         arm_cfft_radix2_instance_q15 * S,\r
1967         uint16_t fftLen,\r
1968         uint8_t ifftFlag,\r
1969         uint8_t bitReverseFlag);\r
1970 \r
1971 /* Deprecated */\r
1972   void arm_cfft_radix2_q15(\r
1973   const arm_cfft_radix2_instance_q15 * S,\r
1974         q15_t * pSrc);\r
1975 \r
1976 \r
1977   /**\r
1978    * @brief Instance structure for the Q15 CFFT/CIFFT function.\r
1979    */\r
1980   typedef struct\r
1981   {\r
1982           uint16_t fftLen;                 /**< length of the FFT. */\r
1983           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
1984           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
1985     const q15_t *pTwiddle;                 /**< points to the twiddle factor table. */\r
1986     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
1987           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
1988           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
1989   } arm_cfft_radix4_instance_q15;\r
1990 \r
1991 /* Deprecated */\r
1992   arm_status arm_cfft_radix4_init_q15(\r
1993         arm_cfft_radix4_instance_q15 * S,\r
1994         uint16_t fftLen,\r
1995         uint8_t ifftFlag,\r
1996         uint8_t bitReverseFlag);\r
1997 \r
1998 /* Deprecated */\r
1999   void arm_cfft_radix4_q15(\r
2000   const arm_cfft_radix4_instance_q15 * S,\r
2001         q15_t * pSrc);\r
2002 \r
2003   /**\r
2004    * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.\r
2005    */\r
2006   typedef struct\r
2007   {\r
2008           uint16_t fftLen;                 /**< length of the FFT. */\r
2009           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2010           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2011     const q31_t *pTwiddle;                 /**< points to the Twiddle factor table. */\r
2012     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
2013           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2014           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2015   } arm_cfft_radix2_instance_q31;\r
2016 \r
2017 /* Deprecated */\r
2018   arm_status arm_cfft_radix2_init_q31(\r
2019         arm_cfft_radix2_instance_q31 * S,\r
2020         uint16_t fftLen,\r
2021         uint8_t ifftFlag,\r
2022         uint8_t bitReverseFlag);\r
2023 \r
2024 /* Deprecated */\r
2025   void arm_cfft_radix2_q31(\r
2026   const arm_cfft_radix2_instance_q31 * S,\r
2027         q31_t * pSrc);\r
2028 \r
2029   /**\r
2030    * @brief Instance structure for the Q31 CFFT/CIFFT function.\r
2031    */\r
2032   typedef struct\r
2033   {\r
2034           uint16_t fftLen;                 /**< length of the FFT. */\r
2035           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2036           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2037     const q31_t *pTwiddle;                 /**< points to the twiddle factor table. */\r
2038     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
2039           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2040           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2041   } arm_cfft_radix4_instance_q31;\r
2042 \r
2043 /* Deprecated */\r
2044   void arm_cfft_radix4_q31(\r
2045   const arm_cfft_radix4_instance_q31 * S,\r
2046         q31_t * pSrc);\r
2047 \r
2048 /* Deprecated */\r
2049   arm_status arm_cfft_radix4_init_q31(\r
2050         arm_cfft_radix4_instance_q31 * S,\r
2051         uint16_t fftLen,\r
2052         uint8_t ifftFlag,\r
2053         uint8_t bitReverseFlag);\r
2054 \r
2055   /**\r
2056    * @brief Instance structure for the floating-point CFFT/CIFFT function.\r
2057    */\r
2058   typedef struct\r
2059   {\r
2060           uint16_t fftLen;                   /**< length of the FFT. */\r
2061           uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2062           uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2063     const float32_t *pTwiddle;               /**< points to the Twiddle factor table. */\r
2064     const uint16_t *pBitRevTable;            /**< points to the bit reversal table. */\r
2065           uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2066           uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2067           float32_t onebyfftLen;             /**< value of 1/fftLen. */\r
2068   } arm_cfft_radix2_instance_f32;\r
2069 \r
2070 /* Deprecated */\r
2071   arm_status arm_cfft_radix2_init_f32(\r
2072         arm_cfft_radix2_instance_f32 * S,\r
2073         uint16_t fftLen,\r
2074         uint8_t ifftFlag,\r
2075         uint8_t bitReverseFlag);\r
2076 \r
2077 /* Deprecated */\r
2078   void arm_cfft_radix2_f32(\r
2079   const arm_cfft_radix2_instance_f32 * S,\r
2080         float32_t * pSrc);\r
2081 \r
2082   /**\r
2083    * @brief Instance structure for the floating-point CFFT/CIFFT function.\r
2084    */\r
2085   typedef struct\r
2086   {\r
2087           uint16_t fftLen;                   /**< length of the FFT. */\r
2088           uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2089           uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2090     const float32_t *pTwiddle;               /**< points to the Twiddle factor table. */\r
2091     const uint16_t *pBitRevTable;            /**< points to the bit reversal table. */\r
2092           uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2093           uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2094           float32_t onebyfftLen;             /**< value of 1/fftLen. */\r
2095   } arm_cfft_radix4_instance_f32;\r
2096 \r
2097 /* Deprecated */\r
2098   arm_status arm_cfft_radix4_init_f32(\r
2099         arm_cfft_radix4_instance_f32 * S,\r
2100         uint16_t fftLen,\r
2101         uint8_t ifftFlag,\r
2102         uint8_t bitReverseFlag);\r
2103 \r
2104 /* Deprecated */\r
2105   void arm_cfft_radix4_f32(\r
2106   const arm_cfft_radix4_instance_f32 * S,\r
2107         float32_t * pSrc);\r
2108 \r
2109   /**\r
2110    * @brief Instance structure for the fixed-point CFFT/CIFFT function.\r
2111    */\r
2112   typedef struct\r
2113   {\r
2114           uint16_t fftLen;                   /**< length of the FFT. */\r
2115     const q15_t *pTwiddle;             /**< points to the Twiddle factor table. */\r
2116     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */\r
2117           uint16_t bitRevLength;             /**< bit reversal table length. */\r
2118   } arm_cfft_instance_q15;\r
2119 \r
2120 void arm_cfft_q15(\r
2121     const arm_cfft_instance_q15 * S,\r
2122           q15_t * p1,\r
2123           uint8_t ifftFlag,\r
2124           uint8_t bitReverseFlag);\r
2125 \r
2126   /**\r
2127    * @brief Instance structure for the fixed-point CFFT/CIFFT function.\r
2128    */\r
2129   typedef struct\r
2130   {\r
2131           uint16_t fftLen;                   /**< length of the FFT. */\r
2132     const q31_t *pTwiddle;             /**< points to the Twiddle factor table. */\r
2133     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */\r
2134           uint16_t bitRevLength;             /**< bit reversal table length. */\r
2135   } arm_cfft_instance_q31;\r
2136 \r
2137 void arm_cfft_q31(\r
2138     const arm_cfft_instance_q31 * S,\r
2139           q31_t * p1,\r
2140           uint8_t ifftFlag,\r
2141           uint8_t bitReverseFlag);\r
2142 \r
2143   /**\r
2144    * @brief Instance structure for the floating-point CFFT/CIFFT function.\r
2145    */\r
2146   typedef struct\r
2147   {\r
2148           uint16_t fftLen;                   /**< length of the FFT. */\r
2149     const float32_t *pTwiddle;         /**< points to the Twiddle factor table. */\r
2150     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */\r
2151           uint16_t bitRevLength;             /**< bit reversal table length. */\r
2152   } arm_cfft_instance_f32;\r
2153 \r
2154   void arm_cfft_f32(\r
2155   const arm_cfft_instance_f32 * S,\r
2156         float32_t * p1,\r
2157         uint8_t ifftFlag,\r
2158         uint8_t bitReverseFlag);\r
2159 \r
2160   /**\r
2161    * @brief Instance structure for the Q15 RFFT/RIFFT function.\r
2162    */\r
2163   typedef struct\r
2164   {\r
2165           uint32_t fftLenReal;                      /**< length of the real FFT. */\r
2166           uint8_t ifftFlagR;                        /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */\r
2167           uint8_t bitReverseFlagR;                  /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */\r
2168           uint32_t twidCoefRModifier;               /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2169     const q15_t *pTwiddleAReal;                     /**< points to the real twiddle factor table. */\r
2170     const q15_t *pTwiddleBReal;                     /**< points to the imag twiddle factor table. */\r
2171     const arm_cfft_instance_q15 *pCfft;       /**< points to the complex FFT instance. */\r
2172   } arm_rfft_instance_q15;\r
2173 \r
2174   arm_status arm_rfft_init_q15(\r
2175         arm_rfft_instance_q15 * S,\r
2176         uint32_t fftLenReal,\r
2177         uint32_t ifftFlagR,\r
2178         uint32_t bitReverseFlag);\r
2179 \r
2180   void arm_rfft_q15(\r
2181   const arm_rfft_instance_q15 * S,\r
2182         q15_t * pSrc,\r
2183         q15_t * pDst);\r
2184 \r
2185   /**\r
2186    * @brief Instance structure for the Q31 RFFT/RIFFT function.\r
2187    */\r
2188   typedef struct\r
2189   {\r
2190           uint32_t fftLenReal;                        /**< length of the real FFT. */\r
2191           uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */\r
2192           uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */\r
2193           uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2194     const q31_t *pTwiddleAReal;                       /**< points to the real twiddle factor table. */\r
2195     const q31_t *pTwiddleBReal;                       /**< points to the imag twiddle factor table. */\r
2196     const arm_cfft_instance_q31 *pCfft;         /**< points to the complex FFT instance. */\r
2197   } arm_rfft_instance_q31;\r
2198 \r
2199   arm_status arm_rfft_init_q31(\r
2200         arm_rfft_instance_q31 * S,\r
2201         uint32_t fftLenReal,\r
2202         uint32_t ifftFlagR,\r
2203         uint32_t bitReverseFlag);\r
2204 \r
2205   void arm_rfft_q31(\r
2206   const arm_rfft_instance_q31 * S,\r
2207         q31_t * pSrc,\r
2208         q31_t * pDst);\r
2209 \r
2210   /**\r
2211    * @brief Instance structure for the floating-point RFFT/RIFFT function.\r
2212    */\r
2213   typedef struct\r
2214   {\r
2215           uint32_t fftLenReal;                        /**< length of the real FFT. */\r
2216           uint16_t fftLenBy2;                         /**< length of the complex FFT. */\r
2217           uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */\r
2218           uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */\r
2219           uint32_t twidCoefRModifier;                     /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2220     const float32_t *pTwiddleAReal;                   /**< points to the real twiddle factor table. */\r
2221     const float32_t *pTwiddleBReal;                   /**< points to the imag twiddle factor table. */\r
2222           arm_cfft_radix4_instance_f32 *pCfft;        /**< points to the complex FFT instance. */\r
2223   } arm_rfft_instance_f32;\r
2224 \r
2225   arm_status arm_rfft_init_f32(\r
2226         arm_rfft_instance_f32 * S,\r
2227         arm_cfft_radix4_instance_f32 * S_CFFT,\r
2228         uint32_t fftLenReal,\r
2229         uint32_t ifftFlagR,\r
2230         uint32_t bitReverseFlag);\r
2231 \r
2232   void arm_rfft_f32(\r
2233   const arm_rfft_instance_f32 * S,\r
2234         float32_t * pSrc,\r
2235         float32_t * pDst);\r
2236 \r
2237   /**\r
2238    * @brief Instance structure for the floating-point RFFT/RIFFT function.\r
2239    */\r
2240 typedef struct\r
2241   {\r
2242           arm_cfft_instance_f32 Sint;      /**< Internal CFFT structure. */\r
2243           uint16_t fftLenRFFT;             /**< length of the real sequence */\r
2244     const float32_t * pTwiddleRFFT;        /**< Twiddle factors real stage  */\r
2245   } arm_rfft_fast_instance_f32 ;\r
2246 \r
2247 arm_status arm_rfft_fast_init_f32 (\r
2248          arm_rfft_fast_instance_f32 * S,\r
2249          uint16_t fftLen);\r
2250 \r
2251 arm_status arm_rfft_32_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2252 \r
2253 arm_status arm_rfft_64_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2254 \r
2255 arm_status arm_rfft_128_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2256 \r
2257 arm_status arm_rfft_256_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2258 \r
2259 arm_status arm_rfft_512_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2260 \r
2261 arm_status arm_rfft_1024_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2262 \r
2263 arm_status arm_rfft_2048_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2264 \r
2265 arm_status arm_rfft_4096_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );\r
2266 \r
2267 \r
2268   void arm_rfft_fast_f32(\r
2269         arm_rfft_fast_instance_f32 * S,\r
2270         float32_t * p, float32_t * pOut,\r
2271         uint8_t ifftFlag);\r
2272 \r
2273   /**\r
2274    * @brief Instance structure for the floating-point DCT4/IDCT4 function.\r
2275    */\r
2276   typedef struct\r
2277   {\r
2278           uint16_t N;                          /**< length of the DCT4. */\r
2279           uint16_t Nby2;                       /**< half of the length of the DCT4. */\r
2280           float32_t normalize;                 /**< normalizing factor. */\r
2281     const float32_t *pTwiddle;                 /**< points to the twiddle factor table. */\r
2282     const float32_t *pCosFactor;               /**< points to the cosFactor table. */\r
2283           arm_rfft_instance_f32 *pRfft;        /**< points to the real FFT instance. */\r
2284           arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */\r
2285   } arm_dct4_instance_f32;\r
2286 \r
2287 \r
2288   /**\r
2289    * @brief  Initialization function for the floating-point DCT4/IDCT4.\r
2290    * @param[in,out] S          points to an instance of floating-point DCT4/IDCT4 structure.\r
2291    * @param[in]     S_RFFT     points to an instance of floating-point RFFT/RIFFT structure.\r
2292    * @param[in]     S_CFFT     points to an instance of floating-point CFFT/CIFFT structure.\r
2293    * @param[in]     N          length of the DCT4.\r
2294    * @param[in]     Nby2       half of the length of the DCT4.\r
2295    * @param[in]     normalize  normalizing factor.\r
2296    * @return      arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.\r
2297    */\r
2298   arm_status arm_dct4_init_f32(\r
2299         arm_dct4_instance_f32 * S,\r
2300         arm_rfft_instance_f32 * S_RFFT,\r
2301         arm_cfft_radix4_instance_f32 * S_CFFT,\r
2302         uint16_t N,\r
2303         uint16_t Nby2,\r
2304         float32_t normalize);\r
2305 \r
2306 \r
2307   /**\r
2308    * @brief Processing function for the floating-point DCT4/IDCT4.\r
2309    * @param[in]     S              points to an instance of the floating-point DCT4/IDCT4 structure.\r
2310    * @param[in]     pState         points to state buffer.\r
2311    * @param[in,out] pInlineBuffer  points to the in-place input and output buffer.\r
2312    */\r
2313   void arm_dct4_f32(\r
2314   const arm_dct4_instance_f32 * S,\r
2315         float32_t * pState,\r
2316         float32_t * pInlineBuffer);\r
2317 \r
2318 \r
2319   /**\r
2320    * @brief Instance structure for the Q31 DCT4/IDCT4 function.\r
2321    */\r
2322   typedef struct\r
2323   {\r
2324           uint16_t N;                          /**< length of the DCT4. */\r
2325           uint16_t Nby2;                       /**< half of the length of the DCT4. */\r
2326           q31_t normalize;                     /**< normalizing factor. */\r
2327     const q31_t *pTwiddle;                     /**< points to the twiddle factor table. */\r
2328     const q31_t *pCosFactor;                   /**< points to the cosFactor table. */\r
2329           arm_rfft_instance_q31 *pRfft;        /**< points to the real FFT instance. */\r
2330           arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */\r
2331   } arm_dct4_instance_q31;\r
2332 \r
2333 \r
2334   /**\r
2335    * @brief  Initialization function for the Q31 DCT4/IDCT4.\r
2336    * @param[in,out] S          points to an instance of Q31 DCT4/IDCT4 structure.\r
2337    * @param[in]     S_RFFT     points to an instance of Q31 RFFT/RIFFT structure\r
2338    * @param[in]     S_CFFT     points to an instance of Q31 CFFT/CIFFT structure\r
2339    * @param[in]     N          length of the DCT4.\r
2340    * @param[in]     Nby2       half of the length of the DCT4.\r
2341    * @param[in]     normalize  normalizing factor.\r
2342    * @return      arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.\r
2343    */\r
2344   arm_status arm_dct4_init_q31(\r
2345         arm_dct4_instance_q31 * S,\r
2346         arm_rfft_instance_q31 * S_RFFT,\r
2347         arm_cfft_radix4_instance_q31 * S_CFFT,\r
2348         uint16_t N,\r
2349         uint16_t Nby2,\r
2350         q31_t normalize);\r
2351 \r
2352 \r
2353   /**\r
2354    * @brief Processing function for the Q31 DCT4/IDCT4.\r
2355    * @param[in]     S              points to an instance of the Q31 DCT4 structure.\r
2356    * @param[in]     pState         points to state buffer.\r
2357    * @param[in,out] pInlineBuffer  points to the in-place input and output buffer.\r
2358    */\r
2359   void arm_dct4_q31(\r
2360   const arm_dct4_instance_q31 * S,\r
2361         q31_t * pState,\r
2362         q31_t * pInlineBuffer);\r
2363 \r
2364 \r
2365   /**\r
2366    * @brief Instance structure for the Q15 DCT4/IDCT4 function.\r
2367    */\r
2368   typedef struct\r
2369   {\r
2370           uint16_t N;                          /**< length of the DCT4. */\r
2371           uint16_t Nby2;                       /**< half of the length of the DCT4. */\r
2372           q15_t normalize;                     /**< normalizing factor. */\r
2373     const q15_t *pTwiddle;                     /**< points to the twiddle factor table. */\r
2374     const q15_t *pCosFactor;                   /**< points to the cosFactor table. */\r
2375           arm_rfft_instance_q15 *pRfft;        /**< points to the real FFT instance. */\r
2376           arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */\r
2377   } arm_dct4_instance_q15;\r
2378 \r
2379 \r
2380   /**\r
2381    * @brief  Initialization function for the Q15 DCT4/IDCT4.\r
2382    * @param[in,out] S          points to an instance of Q15 DCT4/IDCT4 structure.\r
2383    * @param[in]     S_RFFT     points to an instance of Q15 RFFT/RIFFT structure.\r
2384    * @param[in]     S_CFFT     points to an instance of Q15 CFFT/CIFFT structure.\r
2385    * @param[in]     N          length of the DCT4.\r
2386    * @param[in]     Nby2       half of the length of the DCT4.\r
2387    * @param[in]     normalize  normalizing factor.\r
2388    * @return      arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.\r
2389    */\r
2390   arm_status arm_dct4_init_q15(\r
2391         arm_dct4_instance_q15 * S,\r
2392         arm_rfft_instance_q15 * S_RFFT,\r
2393         arm_cfft_radix4_instance_q15 * S_CFFT,\r
2394         uint16_t N,\r
2395         uint16_t Nby2,\r
2396         q15_t normalize);\r
2397 \r
2398 \r
2399   /**\r
2400    * @brief Processing function for the Q15 DCT4/IDCT4.\r
2401    * @param[in]     S              points to an instance of the Q15 DCT4 structure.\r
2402    * @param[in]     pState         points to state buffer.\r
2403    * @param[in,out] pInlineBuffer  points to the in-place input and output buffer.\r
2404    */\r
2405   void arm_dct4_q15(\r
2406   const arm_dct4_instance_q15 * S,\r
2407         q15_t * pState,\r
2408         q15_t * pInlineBuffer);\r
2409 \r
2410 \r
2411   /**\r
2412    * @brief Floating-point vector addition.\r
2413    * @param[in]  pSrcA      points to the first input vector\r
2414    * @param[in]  pSrcB      points to the second input vector\r
2415    * @param[out] pDst       points to the output vector\r
2416    * @param[in]  blockSize  number of samples in each vector\r
2417    */\r
2418   void arm_add_f32(\r
2419   const float32_t * pSrcA,\r
2420   const float32_t * pSrcB,\r
2421         float32_t * pDst,\r
2422         uint32_t blockSize);\r
2423 \r
2424 \r
2425   /**\r
2426    * @brief Q7 vector addition.\r
2427    * @param[in]  pSrcA      points to the first input vector\r
2428    * @param[in]  pSrcB      points to the second input vector\r
2429    * @param[out] pDst       points to the output vector\r
2430    * @param[in]  blockSize  number of samples in each vector\r
2431    */\r
2432   void arm_add_q7(\r
2433   const q7_t * pSrcA,\r
2434   const q7_t * pSrcB,\r
2435         q7_t * pDst,\r
2436         uint32_t blockSize);\r
2437 \r
2438 \r
2439   /**\r
2440    * @brief Q15 vector addition.\r
2441    * @param[in]  pSrcA      points to the first input vector\r
2442    * @param[in]  pSrcB      points to the second input vector\r
2443    * @param[out] pDst       points to the output vector\r
2444    * @param[in]  blockSize  number of samples in each vector\r
2445    */\r
2446   void arm_add_q15(\r
2447   const q15_t * pSrcA,\r
2448   const q15_t * pSrcB,\r
2449         q15_t * pDst,\r
2450         uint32_t blockSize);\r
2451 \r
2452 \r
2453   /**\r
2454    * @brief Q31 vector addition.\r
2455    * @param[in]  pSrcA      points to the first input vector\r
2456    * @param[in]  pSrcB      points to the second input vector\r
2457    * @param[out] pDst       points to the output vector\r
2458    * @param[in]  blockSize  number of samples in each vector\r
2459    */\r
2460   void arm_add_q31(\r
2461   const q31_t * pSrcA,\r
2462   const q31_t * pSrcB,\r
2463         q31_t * pDst,\r
2464         uint32_t blockSize);\r
2465 \r
2466 \r
2467   /**\r
2468    * @brief Floating-point vector subtraction.\r
2469    * @param[in]  pSrcA      points to the first input vector\r
2470    * @param[in]  pSrcB      points to the second input vector\r
2471    * @param[out] pDst       points to the output vector\r
2472    * @param[in]  blockSize  number of samples in each vector\r
2473    */\r
2474   void arm_sub_f32(\r
2475   const float32_t * pSrcA,\r
2476   const float32_t * pSrcB,\r
2477         float32_t * pDst,\r
2478         uint32_t blockSize);\r
2479 \r
2480 \r
2481   /**\r
2482    * @brief Q7 vector subtraction.\r
2483    * @param[in]  pSrcA      points to the first input vector\r
2484    * @param[in]  pSrcB      points to the second input vector\r
2485    * @param[out] pDst       points to the output vector\r
2486    * @param[in]  blockSize  number of samples in each vector\r
2487    */\r
2488   void arm_sub_q7(\r
2489   const q7_t * pSrcA,\r
2490   const q7_t * pSrcB,\r
2491         q7_t * pDst,\r
2492         uint32_t blockSize);\r
2493 \r
2494 \r
2495   /**\r
2496    * @brief Q15 vector subtraction.\r
2497    * @param[in]  pSrcA      points to the first input vector\r
2498    * @param[in]  pSrcB      points to the second input vector\r
2499    * @param[out] pDst       points to the output vector\r
2500    * @param[in]  blockSize  number of samples in each vector\r
2501    */\r
2502   void arm_sub_q15(\r
2503   const q15_t * pSrcA,\r
2504   const q15_t * pSrcB,\r
2505         q15_t * pDst,\r
2506         uint32_t blockSize);\r
2507 \r
2508 \r
2509   /**\r
2510    * @brief Q31 vector subtraction.\r
2511    * @param[in]  pSrcA      points to the first input vector\r
2512    * @param[in]  pSrcB      points to the second input vector\r
2513    * @param[out] pDst       points to the output vector\r
2514    * @param[in]  blockSize  number of samples in each vector\r
2515    */\r
2516   void arm_sub_q31(\r
2517   const q31_t * pSrcA,\r
2518   const q31_t * pSrcB,\r
2519         q31_t * pDst,\r
2520         uint32_t blockSize);\r
2521 \r
2522 \r
2523   /**\r
2524    * @brief Multiplies a floating-point vector by a scalar.\r
2525    * @param[in]  pSrc       points to the input vector\r
2526    * @param[in]  scale      scale factor to be applied\r
2527    * @param[out] pDst       points to the output vector\r
2528    * @param[in]  blockSize  number of samples in the vector\r
2529    */\r
2530   void arm_scale_f32(\r
2531   const float32_t * pSrc,\r
2532         float32_t scale,\r
2533         float32_t * pDst,\r
2534         uint32_t blockSize);\r
2535 \r
2536 \r
2537   /**\r
2538    * @brief Multiplies a Q7 vector by a scalar.\r
2539    * @param[in]  pSrc        points to the input vector\r
2540    * @param[in]  scaleFract  fractional portion of the scale value\r
2541    * @param[in]  shift       number of bits to shift the result by\r
2542    * @param[out] pDst        points to the output vector\r
2543    * @param[in]  blockSize   number of samples in the vector\r
2544    */\r
2545   void arm_scale_q7(\r
2546   const q7_t * pSrc,\r
2547         q7_t scaleFract,\r
2548         int8_t shift,\r
2549         q7_t * pDst,\r
2550         uint32_t blockSize);\r
2551 \r
2552 \r
2553   /**\r
2554    * @brief Multiplies a Q15 vector by a scalar.\r
2555    * @param[in]  pSrc        points to the input vector\r
2556    * @param[in]  scaleFract  fractional portion of the scale value\r
2557    * @param[in]  shift       number of bits to shift the result by\r
2558    * @param[out] pDst        points to the output vector\r
2559    * @param[in]  blockSize   number of samples in the vector\r
2560    */\r
2561   void arm_scale_q15(\r
2562   const q15_t * pSrc,\r
2563         q15_t scaleFract,\r
2564         int8_t shift,\r
2565         q15_t * pDst,\r
2566         uint32_t blockSize);\r
2567 \r
2568 \r
2569   /**\r
2570    * @brief Multiplies a Q31 vector by a scalar.\r
2571    * @param[in]  pSrc        points to the input vector\r
2572    * @param[in]  scaleFract  fractional portion of the scale value\r
2573    * @param[in]  shift       number of bits to shift the result by\r
2574    * @param[out] pDst        points to the output vector\r
2575    * @param[in]  blockSize   number of samples in the vector\r
2576    */\r
2577   void arm_scale_q31(\r
2578   const q31_t * pSrc,\r
2579         q31_t scaleFract,\r
2580         int8_t shift,\r
2581         q31_t * pDst,\r
2582         uint32_t blockSize);\r
2583 \r
2584 \r
2585   /**\r
2586    * @brief Q7 vector absolute value.\r
2587    * @param[in]  pSrc       points to the input buffer\r
2588    * @param[out] pDst       points to the output buffer\r
2589    * @param[in]  blockSize  number of samples in each vector\r
2590    */\r
2591   void arm_abs_q7(\r
2592   const q7_t * pSrc,\r
2593         q7_t * pDst,\r
2594         uint32_t blockSize);\r
2595 \r
2596 \r
2597   /**\r
2598    * @brief Floating-point vector absolute value.\r
2599    * @param[in]  pSrc       points to the input buffer\r
2600    * @param[out] pDst       points to the output buffer\r
2601    * @param[in]  blockSize  number of samples in each vector\r
2602    */\r
2603   void arm_abs_f32(\r
2604   const float32_t * pSrc,\r
2605         float32_t * pDst,\r
2606         uint32_t blockSize);\r
2607 \r
2608 \r
2609   /**\r
2610    * @brief Q15 vector absolute value.\r
2611    * @param[in]  pSrc       points to the input buffer\r
2612    * @param[out] pDst       points to the output buffer\r
2613    * @param[in]  blockSize  number of samples in each vector\r
2614    */\r
2615   void arm_abs_q15(\r
2616   const q15_t * pSrc,\r
2617         q15_t * pDst,\r
2618         uint32_t blockSize);\r
2619 \r
2620 \r
2621   /**\r
2622    * @brief Q31 vector absolute value.\r
2623    * @param[in]  pSrc       points to the input buffer\r
2624    * @param[out] pDst       points to the output buffer\r
2625    * @param[in]  blockSize  number of samples in each vector\r
2626    */\r
2627   void arm_abs_q31(\r
2628   const q31_t * pSrc,\r
2629         q31_t * pDst,\r
2630         uint32_t blockSize);\r
2631 \r
2632 \r
2633   /**\r
2634    * @brief Dot product of floating-point vectors.\r
2635    * @param[in]  pSrcA      points to the first input vector\r
2636    * @param[in]  pSrcB      points to the second input vector\r
2637    * @param[in]  blockSize  number of samples in each vector\r
2638    * @param[out] result     output result returned here\r
2639    */\r
2640   void arm_dot_prod_f32(\r
2641   const float32_t * pSrcA,\r
2642   const float32_t * pSrcB,\r
2643         uint32_t blockSize,\r
2644         float32_t * result);\r
2645 \r
2646 \r
2647   /**\r
2648    * @brief Dot product of Q7 vectors.\r
2649    * @param[in]  pSrcA      points to the first input vector\r
2650    * @param[in]  pSrcB      points to the second input vector\r
2651    * @param[in]  blockSize  number of samples in each vector\r
2652    * @param[out] result     output result returned here\r
2653    */\r
2654   void arm_dot_prod_q7(\r
2655   const q7_t * pSrcA,\r
2656   const q7_t * pSrcB,\r
2657         uint32_t blockSize,\r
2658         q31_t * result);\r
2659 \r
2660 \r
2661   /**\r
2662    * @brief Dot product of Q15 vectors.\r
2663    * @param[in]  pSrcA      points to the first input vector\r
2664    * @param[in]  pSrcB      points to the second input vector\r
2665    * @param[in]  blockSize  number of samples in each vector\r
2666    * @param[out] result     output result returned here\r
2667    */\r
2668   void arm_dot_prod_q15(\r
2669   const q15_t * pSrcA,\r
2670   const q15_t * pSrcB,\r
2671         uint32_t blockSize,\r
2672         q63_t * result);\r
2673 \r
2674 \r
2675   /**\r
2676    * @brief Dot product of Q31 vectors.\r
2677    * @param[in]  pSrcA      points to the first input vector\r
2678    * @param[in]  pSrcB      points to the second input vector\r
2679    * @param[in]  blockSize  number of samples in each vector\r
2680    * @param[out] result     output result returned here\r
2681    */\r
2682   void arm_dot_prod_q31(\r
2683   const q31_t * pSrcA,\r
2684   const q31_t * pSrcB,\r
2685         uint32_t blockSize,\r
2686         q63_t * result);\r
2687 \r
2688 \r
2689   /**\r
2690    * @brief  Shifts the elements of a Q7 vector a specified number of bits.\r
2691    * @param[in]  pSrc       points to the input vector\r
2692    * @param[in]  shiftBits  number of bits to shift.  A positive value shifts left; a negative value shifts right.\r
2693    * @param[out] pDst       points to the output vector\r
2694    * @param[in]  blockSize  number of samples in the vector\r
2695    */\r
2696   void arm_shift_q7(\r
2697   const q7_t * pSrc,\r
2698         int8_t shiftBits,\r
2699         q7_t * pDst,\r
2700         uint32_t blockSize);\r
2701 \r
2702 \r
2703   /**\r
2704    * @brief  Shifts the elements of a Q15 vector a specified number of bits.\r
2705    * @param[in]  pSrc       points to the input vector\r
2706    * @param[in]  shiftBits  number of bits to shift.  A positive value shifts left; a negative value shifts right.\r
2707    * @param[out] pDst       points to the output vector\r
2708    * @param[in]  blockSize  number of samples in the vector\r
2709    */\r
2710   void arm_shift_q15(\r
2711   const q15_t * pSrc,\r
2712         int8_t shiftBits,\r
2713         q15_t * pDst,\r
2714         uint32_t blockSize);\r
2715 \r
2716 \r
2717   /**\r
2718    * @brief  Shifts the elements of a Q31 vector a specified number of bits.\r
2719    * @param[in]  pSrc       points to the input vector\r
2720    * @param[in]  shiftBits  number of bits to shift.  A positive value shifts left; a negative value shifts right.\r
2721    * @param[out] pDst       points to the output vector\r
2722    * @param[in]  blockSize  number of samples in the vector\r
2723    */\r
2724   void arm_shift_q31(\r
2725   const q31_t * pSrc,\r
2726         int8_t shiftBits,\r
2727         q31_t * pDst,\r
2728         uint32_t blockSize);\r
2729 \r
2730 \r
2731   /**\r
2732    * @brief  Adds a constant offset to a floating-point vector.\r
2733    * @param[in]  pSrc       points to the input vector\r
2734    * @param[in]  offset     is the offset to be added\r
2735    * @param[out] pDst       points to the output vector\r
2736    * @param[in]  blockSize  number of samples in the vector\r
2737    */\r
2738   void arm_offset_f32(\r
2739   const float32_t * pSrc,\r
2740         float32_t offset,\r
2741         float32_t * pDst,\r
2742         uint32_t blockSize);\r
2743 \r
2744 \r
2745   /**\r
2746    * @brief  Adds a constant offset to a Q7 vector.\r
2747    * @param[in]  pSrc       points to the input vector\r
2748    * @param[in]  offset     is the offset to be added\r
2749    * @param[out] pDst       points to the output vector\r
2750    * @param[in]  blockSize  number of samples in the vector\r
2751    */\r
2752   void arm_offset_q7(\r
2753   const q7_t * pSrc,\r
2754         q7_t offset,\r
2755         q7_t * pDst,\r
2756         uint32_t blockSize);\r
2757 \r
2758 \r
2759   /**\r
2760    * @brief  Adds a constant offset to a Q15 vector.\r
2761    * @param[in]  pSrc       points to the input vector\r
2762    * @param[in]  offset     is the offset to be added\r
2763    * @param[out] pDst       points to the output vector\r
2764    * @param[in]  blockSize  number of samples in the vector\r
2765    */\r
2766   void arm_offset_q15(\r
2767   const q15_t * pSrc,\r
2768         q15_t offset,\r
2769         q15_t * pDst,\r
2770         uint32_t blockSize);\r
2771 \r
2772 \r
2773   /**\r
2774    * @brief  Adds a constant offset to a Q31 vector.\r
2775    * @param[in]  pSrc       points to the input vector\r
2776    * @param[in]  offset     is the offset to be added\r
2777    * @param[out] pDst       points to the output vector\r
2778    * @param[in]  blockSize  number of samples in the vector\r
2779    */\r
2780   void arm_offset_q31(\r
2781   const q31_t * pSrc,\r
2782         q31_t offset,\r
2783         q31_t * pDst,\r
2784         uint32_t blockSize);\r
2785 \r
2786 \r
2787   /**\r
2788    * @brief  Negates the elements of a floating-point vector.\r
2789    * @param[in]  pSrc       points to the input vector\r
2790    * @param[out] pDst       points to the output vector\r
2791    * @param[in]  blockSize  number of samples in the vector\r
2792    */\r
2793   void arm_negate_f32(\r
2794   const float32_t * pSrc,\r
2795         float32_t * pDst,\r
2796         uint32_t blockSize);\r
2797 \r
2798 \r
2799   /**\r
2800    * @brief  Negates the elements of a Q7 vector.\r
2801    * @param[in]  pSrc       points to the input vector\r
2802    * @param[out] pDst       points to the output vector\r
2803    * @param[in]  blockSize  number of samples in the vector\r
2804    */\r
2805   void arm_negate_q7(\r
2806   const q7_t * pSrc,\r
2807         q7_t * pDst,\r
2808         uint32_t blockSize);\r
2809 \r
2810 \r
2811   /**\r
2812    * @brief  Negates the elements of a Q15 vector.\r
2813    * @param[in]  pSrc       points to the input vector\r
2814    * @param[out] pDst       points to the output vector\r
2815    * @param[in]  blockSize  number of samples in the vector\r
2816    */\r
2817   void arm_negate_q15(\r
2818   const q15_t * pSrc,\r
2819         q15_t * pDst,\r
2820         uint32_t blockSize);\r
2821 \r
2822 \r
2823   /**\r
2824    * @brief  Negates the elements of a Q31 vector.\r
2825    * @param[in]  pSrc       points to the input vector\r
2826    * @param[out] pDst       points to the output vector\r
2827    * @param[in]  blockSize  number of samples in the vector\r
2828    */\r
2829   void arm_negate_q31(\r
2830   const q31_t * pSrc,\r
2831         q31_t * pDst,\r
2832         uint32_t blockSize);\r
2833 \r
2834 \r
2835   /**\r
2836    * @brief  Copies the elements of a floating-point vector.\r
2837    * @param[in]  pSrc       input pointer\r
2838    * @param[out] pDst       output pointer\r
2839    * @param[in]  blockSize  number of samples to process\r
2840    */\r
2841   void arm_copy_f32(\r
2842   const float32_t * pSrc,\r
2843         float32_t * pDst,\r
2844         uint32_t blockSize);\r
2845 \r
2846 \r
2847   /**\r
2848    * @brief  Copies the elements of a Q7 vector.\r
2849    * @param[in]  pSrc       input pointer\r
2850    * @param[out] pDst       output pointer\r
2851    * @param[in]  blockSize  number of samples to process\r
2852    */\r
2853   void arm_copy_q7(\r
2854   const q7_t * pSrc,\r
2855         q7_t * pDst,\r
2856         uint32_t blockSize);\r
2857 \r
2858 \r
2859   /**\r
2860    * @brief  Copies the elements of a Q15 vector.\r
2861    * @param[in]  pSrc       input pointer\r
2862    * @param[out] pDst       output pointer\r
2863    * @param[in]  blockSize  number of samples to process\r
2864    */\r
2865   void arm_copy_q15(\r
2866   const q15_t * pSrc,\r
2867         q15_t * pDst,\r
2868         uint32_t blockSize);\r
2869 \r
2870 \r
2871   /**\r
2872    * @brief  Copies the elements of a Q31 vector.\r
2873    * @param[in]  pSrc       input pointer\r
2874    * @param[out] pDst       output pointer\r
2875    * @param[in]  blockSize  number of samples to process\r
2876    */\r
2877   void arm_copy_q31(\r
2878   const q31_t * pSrc,\r
2879         q31_t * pDst,\r
2880         uint32_t blockSize);\r
2881 \r
2882 \r
2883   /**\r
2884    * @brief  Fills a constant value into a floating-point vector.\r
2885    * @param[in]  value      input value to be filled\r
2886    * @param[out] pDst       output pointer\r
2887    * @param[in]  blockSize  number of samples to process\r
2888    */\r
2889   void arm_fill_f32(\r
2890         float32_t value,\r
2891         float32_t * pDst,\r
2892         uint32_t blockSize);\r
2893 \r
2894 \r
2895   /**\r
2896    * @brief  Fills a constant value into a Q7 vector.\r
2897    * @param[in]  value      input value to be filled\r
2898    * @param[out] pDst       output pointer\r
2899    * @param[in]  blockSize  number of samples to process\r
2900    */\r
2901   void arm_fill_q7(\r
2902         q7_t value,\r
2903         q7_t * pDst,\r
2904         uint32_t blockSize);\r
2905 \r
2906 \r
2907   /**\r
2908    * @brief  Fills a constant value into a Q15 vector.\r
2909    * @param[in]  value      input value to be filled\r
2910    * @param[out] pDst       output pointer\r
2911    * @param[in]  blockSize  number of samples to process\r
2912    */\r
2913   void arm_fill_q15(\r
2914         q15_t value,\r
2915         q15_t * pDst,\r
2916         uint32_t blockSize);\r
2917 \r
2918 \r
2919   /**\r
2920    * @brief  Fills a constant value into a Q31 vector.\r
2921    * @param[in]  value      input value to be filled\r
2922    * @param[out] pDst       output pointer\r
2923    * @param[in]  blockSize  number of samples to process\r
2924    */\r
2925   void arm_fill_q31(\r
2926         q31_t value,\r
2927         q31_t * pDst,\r
2928         uint32_t blockSize);\r
2929 \r
2930 \r
2931 /**\r
2932  * @brief Convolution of floating-point sequences.\r
2933  * @param[in]  pSrcA    points to the first input sequence.\r
2934  * @param[in]  srcALen  length of the first input sequence.\r
2935  * @param[in]  pSrcB    points to the second input sequence.\r
2936  * @param[in]  srcBLen  length of the second input sequence.\r
2937  * @param[out] pDst     points to the location where the output result is written.  Length srcALen+srcBLen-1.\r
2938  */\r
2939   void arm_conv_f32(\r
2940   const float32_t * pSrcA,\r
2941         uint32_t srcALen,\r
2942   const float32_t * pSrcB,\r
2943         uint32_t srcBLen,\r
2944         float32_t * pDst);\r
2945 \r
2946 \r
2947   /**\r
2948    * @brief Convolution of Q15 sequences.\r
2949    * @param[in]  pSrcA      points to the first input sequence.\r
2950    * @param[in]  srcALen    length of the first input sequence.\r
2951    * @param[in]  pSrcB      points to the second input sequence.\r
2952    * @param[in]  srcBLen    length of the second input sequence.\r
2953    * @param[out] pDst       points to the block of output data  Length srcALen+srcBLen-1.\r
2954    * @param[in]  pScratch1  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
2955    * @param[in]  pScratch2  points to scratch buffer of size min(srcALen, srcBLen).\r
2956    */\r
2957   void arm_conv_opt_q15(\r
2958   const q15_t * pSrcA,\r
2959         uint32_t srcALen,\r
2960   const q15_t * pSrcB,\r
2961         uint32_t srcBLen,\r
2962         q15_t * pDst,\r
2963         q15_t * pScratch1,\r
2964         q15_t * pScratch2);\r
2965 \r
2966 \r
2967 /**\r
2968  * @brief Convolution of Q15 sequences.\r
2969  * @param[in]  pSrcA    points to the first input sequence.\r
2970  * @param[in]  srcALen  length of the first input sequence.\r
2971  * @param[in]  pSrcB    points to the second input sequence.\r
2972  * @param[in]  srcBLen  length of the second input sequence.\r
2973  * @param[out] pDst     points to the location where the output result is written.  Length srcALen+srcBLen-1.\r
2974  */\r
2975   void arm_conv_q15(\r
2976   const q15_t * pSrcA,\r
2977         uint32_t srcALen,\r
2978   const q15_t * pSrcB,\r
2979         uint32_t srcBLen,\r
2980         q15_t * pDst);\r
2981 \r
2982 \r
2983   /**\r
2984    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
2985    * @param[in]  pSrcA    points to the first input sequence.\r
2986    * @param[in]  srcALen  length of the first input sequence.\r
2987    * @param[in]  pSrcB    points to the second input sequence.\r
2988    * @param[in]  srcBLen  length of the second input sequence.\r
2989    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.\r
2990    */\r
2991   void arm_conv_fast_q15(\r
2992   const q15_t * pSrcA,\r
2993         uint32_t srcALen,\r
2994   const q15_t * pSrcB,\r
2995         uint32_t srcBLen,\r
2996         q15_t * pDst);\r
2997 \r
2998 \r
2999   /**\r
3000    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3001    * @param[in]  pSrcA      points to the first input sequence.\r
3002    * @param[in]  srcALen    length of the first input sequence.\r
3003    * @param[in]  pSrcB      points to the second input sequence.\r
3004    * @param[in]  srcBLen    length of the second input sequence.\r
3005    * @param[out] pDst       points to the block of output data  Length srcALen+srcBLen-1.\r
3006    * @param[in]  pScratch1  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3007    * @param[in]  pScratch2  points to scratch buffer of size min(srcALen, srcBLen).\r
3008    */\r
3009   void arm_conv_fast_opt_q15(\r
3010   const q15_t * pSrcA,\r
3011         uint32_t srcALen,\r
3012   const q15_t * pSrcB,\r
3013         uint32_t srcBLen,\r
3014         q15_t * pDst,\r
3015         q15_t * pScratch1,\r
3016         q15_t * pScratch2);\r
3017 \r
3018 \r
3019   /**\r
3020    * @brief Convolution of Q31 sequences.\r
3021    * @param[in]  pSrcA    points to the first input sequence.\r
3022    * @param[in]  srcALen  length of the first input sequence.\r
3023    * @param[in]  pSrcB    points to the second input sequence.\r
3024    * @param[in]  srcBLen  length of the second input sequence.\r
3025    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.\r
3026    */\r
3027   void arm_conv_q31(\r
3028   const q31_t * pSrcA,\r
3029         uint32_t srcALen,\r
3030   const q31_t * pSrcB,\r
3031         uint32_t srcBLen,\r
3032         q31_t * pDst);\r
3033 \r
3034 \r
3035   /**\r
3036    * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3037    * @param[in]  pSrcA    points to the first input sequence.\r
3038    * @param[in]  srcALen  length of the first input sequence.\r
3039    * @param[in]  pSrcB    points to the second input sequence.\r
3040    * @param[in]  srcBLen  length of the second input sequence.\r
3041    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.\r
3042    */\r
3043   void arm_conv_fast_q31(\r
3044   const q31_t * pSrcA,\r
3045         uint32_t srcALen,\r
3046   const q31_t * pSrcB,\r
3047         uint32_t srcBLen,\r
3048         q31_t * pDst);\r
3049 \r
3050 \r
3051     /**\r
3052    * @brief Convolution of Q7 sequences.\r
3053    * @param[in]  pSrcA      points to the first input sequence.\r
3054    * @param[in]  srcALen    length of the first input sequence.\r
3055    * @param[in]  pSrcB      points to the second input sequence.\r
3056    * @param[in]  srcBLen    length of the second input sequence.\r
3057    * @param[out] pDst       points to the block of output data  Length srcALen+srcBLen-1.\r
3058    * @param[in]  pScratch1  points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3059    * @param[in]  pScratch2  points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).\r
3060    */\r
3061   void arm_conv_opt_q7(\r
3062   const q7_t * pSrcA,\r
3063         uint32_t srcALen,\r
3064   const q7_t * pSrcB,\r
3065         uint32_t srcBLen,\r
3066         q7_t * pDst,\r
3067         q15_t * pScratch1,\r
3068         q15_t * pScratch2);\r
3069 \r
3070 \r
3071   /**\r
3072    * @brief Convolution of Q7 sequences.\r
3073    * @param[in]  pSrcA    points to the first input sequence.\r
3074    * @param[in]  srcALen  length of the first input sequence.\r
3075    * @param[in]  pSrcB    points to the second input sequence.\r
3076    * @param[in]  srcBLen  length of the second input sequence.\r
3077    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.\r
3078    */\r
3079   void arm_conv_q7(\r
3080   const q7_t * pSrcA,\r
3081         uint32_t srcALen,\r
3082   const q7_t * pSrcB,\r
3083         uint32_t srcBLen,\r
3084         q7_t * pDst);\r
3085 \r
3086 \r
3087   /**\r
3088    * @brief Partial convolution of floating-point sequences.\r
3089    * @param[in]  pSrcA       points to the first input sequence.\r
3090    * @param[in]  srcALen     length of the first input sequence.\r
3091    * @param[in]  pSrcB       points to the second input sequence.\r
3092    * @param[in]  srcBLen     length of the second input sequence.\r
3093    * @param[out] pDst        points to the block of output data\r
3094    * @param[in]  firstIndex  is the first output sample to start with.\r
3095    * @param[in]  numPoints   is the number of output points to be computed.\r
3096    * @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].\r
3097    */\r
3098   arm_status arm_conv_partial_f32(\r
3099   const float32_t * pSrcA,\r
3100         uint32_t srcALen,\r
3101   const float32_t * pSrcB,\r
3102         uint32_t srcBLen,\r
3103         float32_t * pDst,\r
3104         uint32_t firstIndex,\r
3105         uint32_t numPoints);\r
3106 \r
3107 \r
3108   /**\r
3109    * @brief Partial convolution of Q15 sequences.\r
3110    * @param[in]  pSrcA       points to the first input sequence.\r
3111    * @param[in]  srcALen     length of the first input sequence.\r
3112    * @param[in]  pSrcB       points to the second input sequence.\r
3113    * @param[in]  srcBLen     length of the second input sequence.\r
3114    * @param[out] pDst        points to the block of output data\r
3115    * @param[in]  firstIndex  is the first output sample to start with.\r
3116    * @param[in]  numPoints   is the number of output points to be computed.\r
3117    * @param[in]  pScratch1   points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3118    * @param[in]  pScratch2   points to scratch buffer of size min(srcALen, srcBLen).\r
3119    * @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].\r
3120    */\r
3121   arm_status arm_conv_partial_opt_q15(\r
3122   const q15_t * pSrcA,\r
3123         uint32_t srcALen,\r
3124   const q15_t * pSrcB,\r
3125         uint32_t srcBLen,\r
3126         q15_t * pDst,\r
3127         uint32_t firstIndex,\r
3128         uint32_t numPoints,\r
3129         q15_t * pScratch1,\r
3130         q15_t * pScratch2);\r
3131 \r
3132 \r
3133   /**\r
3134    * @brief Partial convolution of Q15 sequences.\r
3135    * @param[in]  pSrcA       points to the first input sequence.\r
3136    * @param[in]  srcALen     length of the first input sequence.\r
3137    * @param[in]  pSrcB       points to the second input sequence.\r
3138    * @param[in]  srcBLen     length of the second input sequence.\r
3139    * @param[out] pDst        points to the block of output data\r
3140    * @param[in]  firstIndex  is the first output sample to start with.\r
3141    * @param[in]  numPoints   is the number of output points to be computed.\r
3142    * @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].\r
3143    */\r
3144   arm_status arm_conv_partial_q15(\r
3145   const q15_t * pSrcA,\r
3146         uint32_t srcALen,\r
3147   const q15_t * pSrcB,\r
3148         uint32_t srcBLen,\r
3149         q15_t * pDst,\r
3150         uint32_t firstIndex,\r
3151         uint32_t numPoints);\r
3152 \r
3153 \r
3154   /**\r
3155    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3156    * @param[in]  pSrcA       points to the first input sequence.\r
3157    * @param[in]  srcALen     length of the first input sequence.\r
3158    * @param[in]  pSrcB       points to the second input sequence.\r
3159    * @param[in]  srcBLen     length of the second input sequence.\r
3160    * @param[out] pDst        points to the block of output data\r
3161    * @param[in]  firstIndex  is the first output sample to start with.\r
3162    * @param[in]  numPoints   is the number of output points to be computed.\r
3163    * @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].\r
3164    */\r
3165   arm_status arm_conv_partial_fast_q15(\r
3166   const q15_t * pSrcA,\r
3167         uint32_t srcALen,\r
3168   const q15_t * pSrcB,\r
3169         uint32_t srcBLen,\r
3170         q15_t * pDst,\r
3171         uint32_t firstIndex,\r
3172         uint32_t numPoints);\r
3173 \r
3174 \r
3175   /**\r
3176    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3177    * @param[in]  pSrcA       points to the first input sequence.\r
3178    * @param[in]  srcALen     length of the first input sequence.\r
3179    * @param[in]  pSrcB       points to the second input sequence.\r
3180    * @param[in]  srcBLen     length of the second input sequence.\r
3181    * @param[out] pDst        points to the block of output data\r
3182    * @param[in]  firstIndex  is the first output sample to start with.\r
3183    * @param[in]  numPoints   is the number of output points to be computed.\r
3184    * @param[in]  pScratch1   points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3185    * @param[in]  pScratch2   points to scratch buffer of size min(srcALen, srcBLen).\r
3186    * @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].\r
3187    */\r
3188   arm_status arm_conv_partial_fast_opt_q15(\r
3189   const q15_t * pSrcA,\r
3190         uint32_t srcALen,\r
3191   const q15_t * pSrcB,\r
3192         uint32_t srcBLen,\r
3193         q15_t * pDst,\r
3194         uint32_t firstIndex,\r
3195         uint32_t numPoints,\r
3196         q15_t * pScratch1,\r
3197         q15_t * pScratch2);\r
3198 \r
3199 \r
3200   /**\r
3201    * @brief Partial convolution of Q31 sequences.\r
3202    * @param[in]  pSrcA       points to the first input sequence.\r
3203    * @param[in]  srcALen     length of the first input sequence.\r
3204    * @param[in]  pSrcB       points to the second input sequence.\r
3205    * @param[in]  srcBLen     length of the second input sequence.\r
3206    * @param[out] pDst        points to the block of output data\r
3207    * @param[in]  firstIndex  is the first output sample to start with.\r
3208    * @param[in]  numPoints   is the number of output points to be computed.\r
3209    * @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].\r
3210    */\r
3211   arm_status arm_conv_partial_q31(\r
3212   const q31_t * pSrcA,\r
3213         uint32_t srcALen,\r
3214   const q31_t * pSrcB,\r
3215         uint32_t srcBLen,\r
3216         q31_t * pDst,\r
3217         uint32_t firstIndex,\r
3218         uint32_t numPoints);\r
3219 \r
3220 \r
3221   /**\r
3222    * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3223    * @param[in]  pSrcA       points to the first input sequence.\r
3224    * @param[in]  srcALen     length of the first input sequence.\r
3225    * @param[in]  pSrcB       points to the second input sequence.\r
3226    * @param[in]  srcBLen     length of the second input sequence.\r
3227    * @param[out] pDst        points to the block of output data\r
3228    * @param[in]  firstIndex  is the first output sample to start with.\r
3229    * @param[in]  numPoints   is the number of output points to be computed.\r
3230    * @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].\r
3231    */\r
3232   arm_status arm_conv_partial_fast_q31(\r
3233   const q31_t * pSrcA,\r
3234         uint32_t srcALen,\r
3235   const q31_t * pSrcB,\r
3236         uint32_t srcBLen,\r
3237         q31_t * pDst,\r
3238         uint32_t firstIndex,\r
3239         uint32_t numPoints);\r
3240 \r
3241 \r
3242   /**\r
3243    * @brief Partial convolution of Q7 sequences\r
3244    * @param[in]  pSrcA       points to the first input sequence.\r
3245    * @param[in]  srcALen     length of the first input sequence.\r
3246    * @param[in]  pSrcB       points to the second input sequence.\r
3247    * @param[in]  srcBLen     length of the second input sequence.\r
3248    * @param[out] pDst        points to the block of output data\r
3249    * @param[in]  firstIndex  is the first output sample to start with.\r
3250    * @param[in]  numPoints   is the number of output points to be computed.\r
3251    * @param[in]  pScratch1   points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3252    * @param[in]  pScratch2   points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).\r
3253    * @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].\r
3254    */\r
3255   arm_status arm_conv_partial_opt_q7(\r
3256   const q7_t * pSrcA,\r
3257         uint32_t srcALen,\r
3258   const q7_t * pSrcB,\r
3259         uint32_t srcBLen,\r
3260         q7_t * pDst,\r
3261         uint32_t firstIndex,\r
3262         uint32_t numPoints,\r
3263         q15_t * pScratch1,\r
3264         q15_t * pScratch2);\r
3265 \r
3266 \r
3267 /**\r
3268    * @brief Partial convolution of Q7 sequences.\r
3269    * @param[in]  pSrcA       points to the first input sequence.\r
3270    * @param[in]  srcALen     length of the first input sequence.\r
3271    * @param[in]  pSrcB       points to the second input sequence.\r
3272    * @param[in]  srcBLen     length of the second input sequence.\r
3273    * @param[out] pDst        points to the block of output data\r
3274    * @param[in]  firstIndex  is the first output sample to start with.\r
3275    * @param[in]  numPoints   is the number of output points to be computed.\r
3276    * @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].\r
3277    */\r
3278   arm_status arm_conv_partial_q7(\r
3279   const q7_t * pSrcA,\r
3280         uint32_t srcALen,\r
3281   const q7_t * pSrcB,\r
3282         uint32_t srcBLen,\r
3283         q7_t * pDst,\r
3284         uint32_t firstIndex,\r
3285         uint32_t numPoints);\r
3286 \r
3287 \r
3288   /**\r
3289    * @brief Instance structure for the Q15 FIR decimator.\r
3290    */\r
3291   typedef struct\r
3292   {\r
3293           uint8_t M;                  /**< decimation factor. */\r
3294           uint16_t numTaps;           /**< number of coefficients in the filter. */\r
3295     const q15_t *pCoeffs;             /**< points to the coefficient array. The array is of length numTaps.*/\r
3296           q15_t *pState;              /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3297   } arm_fir_decimate_instance_q15;\r
3298 \r
3299   /**\r
3300    * @brief Instance structure for the Q31 FIR decimator.\r
3301    */\r
3302   typedef struct\r
3303   {\r
3304           uint8_t M;                  /**< decimation factor. */\r
3305           uint16_t numTaps;           /**< number of coefficients in the filter. */\r
3306     const q31_t *pCoeffs;             /**< points to the coefficient array. The array is of length numTaps.*/\r
3307           q31_t *pState;              /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3308   } arm_fir_decimate_instance_q31;\r
3309 \r
3310 /**\r
3311   @brief Instance structure for floating-point FIR decimator.\r
3312  */\r
3313 typedef struct\r
3314   {\r
3315           uint8_t M;                  /**< decimation factor. */\r
3316           uint16_t numTaps;           /**< number of coefficients in the filter. */\r
3317     const float32_t *pCoeffs;         /**< points to the coefficient array. The array is of length numTaps.*/\r
3318           float32_t *pState;          /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3319   } arm_fir_decimate_instance_f32;\r
3320 \r
3321 \r
3322 /**\r
3323   @brief         Processing function for floating-point FIR decimator.\r
3324   @param[in]     S         points to an instance of the floating-point FIR decimator structure\r
3325   @param[in]     pSrc      points to the block of input data\r
3326   @param[out]    pDst      points to the block of output data\r
3327   @param[in]     blockSize number of samples to process\r
3328  */\r
3329 void arm_fir_decimate_f32(\r
3330   const arm_fir_decimate_instance_f32 * S,\r
3331   const float32_t * pSrc,\r
3332         float32_t * pDst,\r
3333         uint32_t blockSize);\r
3334 \r
3335 \r
3336 /**\r
3337   @brief         Initialization function for the floating-point FIR decimator.\r
3338   @param[in,out] S          points to an instance of the floating-point FIR decimator structure\r
3339   @param[in]     numTaps    number of coefficients in the filter\r
3340   @param[in]     M          decimation factor\r
3341   @param[in]     pCoeffs    points to the filter coefficients\r
3342   @param[in]     pState     points to the state buffer\r
3343   @param[in]     blockSize  number of input samples to process per call\r
3344   @return        execution status\r
3345                    - \ref ARM_MATH_SUCCESS      : Operation successful\r
3346                    - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code>\r
3347  */\r
3348 arm_status arm_fir_decimate_init_f32(\r
3349         arm_fir_decimate_instance_f32 * S,\r
3350         uint16_t numTaps,\r
3351         uint8_t M,\r
3352   const float32_t * pCoeffs,\r
3353         float32_t * pState,\r
3354         uint32_t blockSize);\r
3355 \r
3356 \r
3357   /**\r
3358    * @brief Processing function for the Q15 FIR decimator.\r
3359    * @param[in]  S          points to an instance of the Q15 FIR decimator structure.\r
3360    * @param[in]  pSrc       points to the block of input data.\r
3361    * @param[out] pDst       points to the block of output data\r
3362    * @param[in]  blockSize  number of input samples to process per call.\r
3363    */\r
3364   void arm_fir_decimate_q15(\r
3365   const arm_fir_decimate_instance_q15 * S,\r
3366   const q15_t * pSrc,\r
3367         q15_t * pDst,\r
3368         uint32_t blockSize);\r
3369 \r
3370 \r
3371   /**\r
3372    * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.\r
3373    * @param[in]  S          points to an instance of the Q15 FIR decimator structure.\r
3374    * @param[in]  pSrc       points to the block of input data.\r
3375    * @param[out] pDst       points to the block of output data\r
3376    * @param[in]  blockSize  number of input samples to process per call.\r
3377    */\r
3378   void arm_fir_decimate_fast_q15(\r
3379   const arm_fir_decimate_instance_q15 * S,\r
3380   const q15_t * pSrc,\r
3381         q15_t * pDst,\r
3382         uint32_t blockSize);\r
3383 \r
3384 \r
3385   /**\r
3386    * @brief  Initialization function for the Q15 FIR decimator.\r
3387    * @param[in,out] S          points to an instance of the Q15 FIR decimator structure.\r
3388    * @param[in]     numTaps    number of coefficients in the filter.\r
3389    * @param[in]     M          decimation factor.\r
3390    * @param[in]     pCoeffs    points to the filter coefficients.\r
3391    * @param[in]     pState     points to the state buffer.\r
3392    * @param[in]     blockSize  number of input samples to process per call.\r
3393    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3394    * <code>blockSize</code> is not a multiple of <code>M</code>.\r
3395    */\r
3396   arm_status arm_fir_decimate_init_q15(\r
3397         arm_fir_decimate_instance_q15 * S,\r
3398         uint16_t numTaps,\r
3399         uint8_t M,\r
3400   const q15_t * pCoeffs,\r
3401         q15_t * pState,\r
3402         uint32_t blockSize);\r
3403 \r
3404 \r
3405   /**\r
3406    * @brief Processing function for the Q31 FIR decimator.\r
3407    * @param[in]  S     points to an instance of the Q31 FIR decimator structure.\r
3408    * @param[in]  pSrc  points to the block of input data.\r
3409    * @param[out] pDst  points to the block of output data\r
3410    * @param[in] blockSize number of input samples to process per call.\r
3411    */\r
3412   void arm_fir_decimate_q31(\r
3413   const arm_fir_decimate_instance_q31 * S,\r
3414   const q31_t * pSrc,\r
3415         q31_t * pDst,\r
3416         uint32_t blockSize);\r
3417 \r
3418   /**\r
3419    * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.\r
3420    * @param[in]  S          points to an instance of the Q31 FIR decimator structure.\r
3421    * @param[in]  pSrc       points to the block of input data.\r
3422    * @param[out] pDst       points to the block of output data\r
3423    * @param[in]  blockSize  number of input samples to process per call.\r
3424    */\r
3425   void arm_fir_decimate_fast_q31(\r
3426   const arm_fir_decimate_instance_q31 * S,\r
3427   const q31_t * pSrc,\r
3428         q31_t * pDst,\r
3429         uint32_t blockSize);\r
3430 \r
3431 \r
3432   /**\r
3433    * @brief  Initialization function for the Q31 FIR decimator.\r
3434    * @param[in,out] S          points to an instance of the Q31 FIR decimator structure.\r
3435    * @param[in]     numTaps    number of coefficients in the filter.\r
3436    * @param[in]     M          decimation factor.\r
3437    * @param[in]     pCoeffs    points to the filter coefficients.\r
3438    * @param[in]     pState     points to the state buffer.\r
3439    * @param[in]     blockSize  number of input samples to process per call.\r
3440    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3441    * <code>blockSize</code> is not a multiple of <code>M</code>.\r
3442    */\r
3443   arm_status arm_fir_decimate_init_q31(\r
3444         arm_fir_decimate_instance_q31 * S,\r
3445         uint16_t numTaps,\r
3446         uint8_t M,\r
3447   const q31_t * pCoeffs,\r
3448         q31_t * pState,\r
3449         uint32_t blockSize);\r
3450 \r
3451 \r
3452   /**\r
3453    * @brief Instance structure for the Q15 FIR interpolator.\r
3454    */\r
3455   typedef struct\r
3456   {\r
3457         uint8_t L;                      /**< upsample factor. */\r
3458         uint16_t phaseLength;           /**< length of each polyphase filter component. */\r
3459   const q15_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */\r
3460         q15_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */\r
3461   } arm_fir_interpolate_instance_q15;\r
3462 \r
3463   /**\r
3464    * @brief Instance structure for the Q31 FIR interpolator.\r
3465    */\r
3466   typedef struct\r
3467   {\r
3468         uint8_t L;                      /**< upsample factor. */\r
3469         uint16_t phaseLength;           /**< length of each polyphase filter component. */\r
3470   const q31_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */\r
3471         q31_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */\r
3472   } arm_fir_interpolate_instance_q31;\r
3473 \r
3474   /**\r
3475    * @brief Instance structure for the floating-point FIR interpolator.\r
3476    */\r
3477   typedef struct\r
3478   {\r
3479         uint8_t L;                     /**< upsample factor. */\r
3480         uint16_t phaseLength;          /**< length of each polyphase filter component. */\r
3481   const float32_t *pCoeffs;            /**< points to the coefficient array. The array is of length L*phaseLength. */\r
3482         float32_t *pState;             /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */\r
3483   } arm_fir_interpolate_instance_f32;\r
3484 \r
3485 \r
3486   /**\r
3487    * @brief Processing function for the Q15 FIR interpolator.\r
3488    * @param[in]  S          points to an instance of the Q15 FIR interpolator structure.\r
3489    * @param[in]  pSrc       points to the block of input data.\r
3490    * @param[out] pDst       points to the block of output data.\r
3491    * @param[in]  blockSize  number of input samples to process per call.\r
3492    */\r
3493   void arm_fir_interpolate_q15(\r
3494   const arm_fir_interpolate_instance_q15 * S,\r
3495   const q15_t * pSrc,\r
3496         q15_t * pDst,\r
3497         uint32_t blockSize);\r
3498 \r
3499 \r
3500   /**\r
3501    * @brief  Initialization function for the Q15 FIR interpolator.\r
3502    * @param[in,out] S          points to an instance of the Q15 FIR interpolator structure.\r
3503    * @param[in]     L          upsample factor.\r
3504    * @param[in]     numTaps    number of filter coefficients in the filter.\r
3505    * @param[in]     pCoeffs    points to the filter coefficient buffer.\r
3506    * @param[in]     pState     points to the state buffer.\r
3507    * @param[in]     blockSize  number of input samples to process per call.\r
3508    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3509    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.\r
3510    */\r
3511   arm_status arm_fir_interpolate_init_q15(\r
3512         arm_fir_interpolate_instance_q15 * S,\r
3513         uint8_t L,\r
3514         uint16_t numTaps,\r
3515   const q15_t * pCoeffs,\r
3516         q15_t * pState,\r
3517         uint32_t blockSize);\r
3518 \r
3519 \r
3520   /**\r
3521    * @brief Processing function for the Q31 FIR interpolator.\r
3522    * @param[in]  S          points to an instance of the Q15 FIR interpolator structure.\r
3523    * @param[in]  pSrc       points to the block of input data.\r
3524    * @param[out] pDst       points to the block of output data.\r
3525    * @param[in]  blockSize  number of input samples to process per call.\r
3526    */\r
3527   void arm_fir_interpolate_q31(\r
3528   const arm_fir_interpolate_instance_q31 * S,\r
3529   const q31_t * pSrc,\r
3530         q31_t * pDst,\r
3531         uint32_t blockSize);\r
3532 \r
3533 \r
3534   /**\r
3535    * @brief  Initialization function for the Q31 FIR interpolator.\r
3536    * @param[in,out] S          points to an instance of the Q31 FIR interpolator structure.\r
3537    * @param[in]     L          upsample factor.\r
3538    * @param[in]     numTaps    number of filter coefficients in the filter.\r
3539    * @param[in]     pCoeffs    points to the filter coefficient buffer.\r
3540    * @param[in]     pState     points to the state buffer.\r
3541    * @param[in]     blockSize  number of input samples to process per call.\r
3542    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3543    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.\r
3544    */\r
3545   arm_status arm_fir_interpolate_init_q31(\r
3546         arm_fir_interpolate_instance_q31 * S,\r
3547         uint8_t L,\r
3548         uint16_t numTaps,\r
3549   const q31_t * pCoeffs,\r
3550         q31_t * pState,\r
3551         uint32_t blockSize);\r
3552 \r
3553 \r
3554   /**\r
3555    * @brief Processing function for the floating-point FIR interpolator.\r
3556    * @param[in]  S          points to an instance of the floating-point FIR interpolator structure.\r
3557    * @param[in]  pSrc       points to the block of input data.\r
3558    * @param[out] pDst       points to the block of output data.\r
3559    * @param[in]  blockSize  number of input samples to process per call.\r
3560    */\r
3561   void arm_fir_interpolate_f32(\r
3562   const arm_fir_interpolate_instance_f32 * S,\r
3563   const float32_t * pSrc,\r
3564         float32_t * pDst,\r
3565         uint32_t blockSize);\r
3566 \r
3567 \r
3568   /**\r
3569    * @brief  Initialization function for the floating-point FIR interpolator.\r
3570    * @param[in,out] S          points to an instance of the floating-point FIR interpolator structure.\r
3571    * @param[in]     L          upsample factor.\r
3572    * @param[in]     numTaps    number of filter coefficients in the filter.\r
3573    * @param[in]     pCoeffs    points to the filter coefficient buffer.\r
3574    * @param[in]     pState     points to the state buffer.\r
3575    * @param[in]     blockSize  number of input samples to process per call.\r
3576    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3577    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.\r
3578    */\r
3579   arm_status arm_fir_interpolate_init_f32(\r
3580         arm_fir_interpolate_instance_f32 * S,\r
3581         uint8_t L,\r
3582         uint16_t numTaps,\r
3583   const float32_t * pCoeffs,\r
3584         float32_t * pState,\r
3585         uint32_t blockSize);\r
3586 \r
3587 \r
3588   /**\r
3589    * @brief Instance structure for the high precision Q31 Biquad cascade filter.\r
3590    */\r
3591   typedef struct\r
3592   {\r
3593           uint8_t numStages;       /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
3594           q63_t *pState;           /**< points to the array of state coefficients.  The array is of length 4*numStages. */\r
3595     const q31_t *pCoeffs;          /**< points to the array of coefficients.  The array is of length 5*numStages. */\r
3596           uint8_t postShift;       /**< additional shift, in bits, applied to each output sample. */\r
3597   } arm_biquad_cas_df1_32x64_ins_q31;\r
3598 \r
3599 \r
3600   /**\r
3601    * @param[in]  S          points to an instance of the high precision Q31 Biquad cascade filter structure.\r
3602    * @param[in]  pSrc       points to the block of input data.\r
3603    * @param[out] pDst       points to the block of output data\r
3604    * @param[in]  blockSize  number of samples to process.\r
3605    */\r
3606   void arm_biquad_cas_df1_32x64_q31(\r
3607   const arm_biquad_cas_df1_32x64_ins_q31 * S,\r
3608         q31_t * pSrc,\r
3609         q31_t * pDst,\r
3610         uint32_t blockSize);\r
3611 \r
3612 \r
3613   /**\r
3614    * @param[in,out] S          points to an instance of the high precision Q31 Biquad cascade filter structure.\r
3615    * @param[in]     numStages  number of 2nd order stages in the filter.\r
3616    * @param[in]     pCoeffs    points to the filter coefficients.\r
3617    * @param[in]     pState     points to the state buffer.\r
3618    * @param[in]     postShift  shift to be applied to the output. Varies according to the coefficients format\r
3619    */\r
3620   void arm_biquad_cas_df1_32x64_init_q31(\r
3621         arm_biquad_cas_df1_32x64_ins_q31 * S,\r
3622         uint8_t numStages,\r
3623   const q31_t * pCoeffs,\r
3624         q63_t * pState,\r
3625         uint8_t postShift);\r
3626 \r
3627 \r
3628   /**\r
3629    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.\r
3630    */\r
3631   typedef struct\r
3632   {\r
3633           uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
3634           float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */\r
3635     const float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */\r
3636   } arm_biquad_cascade_df2T_instance_f32;\r
3637 \r
3638   /**\r
3639    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.\r
3640    */\r
3641   typedef struct\r
3642   {\r
3643           uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
3644           float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 4*numStages. */\r
3645     const float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */\r
3646   } arm_biquad_cascade_stereo_df2T_instance_f32;\r
3647 \r
3648   /**\r
3649    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.\r
3650    */\r
3651   typedef struct\r
3652   {\r
3653           uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
3654           float64_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */\r
3655           float64_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */\r
3656   } arm_biquad_cascade_df2T_instance_f64;\r
3657 \r
3658 \r
3659   /**\r
3660    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.\r
3661    * @param[in]  S          points to an instance of the filter data structure.\r
3662    * @param[in]  pSrc       points to the block of input data.\r
3663    * @param[out] pDst       points to the block of output data\r
3664    * @param[in]  blockSize  number of samples to process.\r
3665    */\r
3666   void arm_biquad_cascade_df2T_f32(\r
3667   const arm_biquad_cascade_df2T_instance_f32 * S,\r
3668   const float32_t * pSrc,\r
3669         float32_t * pDst,\r
3670         uint32_t blockSize);\r
3671 \r
3672 \r
3673   /**\r
3674    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels\r
3675    * @param[in]  S          points to an instance of the filter data structure.\r
3676    * @param[in]  pSrc       points to the block of input data.\r
3677    * @param[out] pDst       points to the block of output data\r
3678    * @param[in]  blockSize  number of samples to process.\r
3679    */\r
3680   void arm_biquad_cascade_stereo_df2T_f32(\r
3681   const arm_biquad_cascade_stereo_df2T_instance_f32 * S,\r
3682   const float32_t * pSrc,\r
3683         float32_t * pDst,\r
3684         uint32_t blockSize);\r
3685 \r
3686 \r
3687   /**\r
3688    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.\r
3689    * @param[in]  S          points to an instance of the filter data structure.\r
3690    * @param[in]  pSrc       points to the block of input data.\r
3691    * @param[out] pDst       points to the block of output data\r
3692    * @param[in]  blockSize  number of samples to process.\r
3693    */\r
3694   void arm_biquad_cascade_df2T_f64(\r
3695   const arm_biquad_cascade_df2T_instance_f64 * S,\r
3696         float64_t * pSrc,\r
3697         float64_t * pDst,\r
3698         uint32_t blockSize);\r
3699 \r
3700 \r
3701   /**\r
3702    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.\r
3703    * @param[in,out] S          points to an instance of the filter data structure.\r
3704    * @param[in]     numStages  number of 2nd order stages in the filter.\r
3705    * @param[in]     pCoeffs    points to the filter coefficients.\r
3706    * @param[in]     pState     points to the state buffer.\r
3707    */\r
3708   void arm_biquad_cascade_df2T_init_f32(\r
3709         arm_biquad_cascade_df2T_instance_f32 * S,\r
3710         uint8_t numStages,\r
3711   const float32_t * pCoeffs,\r
3712         float32_t * pState);\r
3713 \r
3714 \r
3715   /**\r
3716    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.\r
3717    * @param[in,out] S          points to an instance of the filter data structure.\r
3718    * @param[in]     numStages  number of 2nd order stages in the filter.\r
3719    * @param[in]     pCoeffs    points to the filter coefficients.\r
3720    * @param[in]     pState     points to the state buffer.\r
3721    */\r
3722   void arm_biquad_cascade_stereo_df2T_init_f32(\r
3723         arm_biquad_cascade_stereo_df2T_instance_f32 * S,\r
3724         uint8_t numStages,\r
3725   const float32_t * pCoeffs,\r
3726         float32_t * pState);\r
3727 \r
3728 \r
3729   /**\r
3730    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.\r
3731    * @param[in,out] S          points to an instance of the filter data structure.\r
3732    * @param[in]     numStages  number of 2nd order stages in the filter.\r
3733    * @param[in]     pCoeffs    points to the filter coefficients.\r
3734    * @param[in]     pState     points to the state buffer.\r
3735    */\r
3736   void arm_biquad_cascade_df2T_init_f64(\r
3737         arm_biquad_cascade_df2T_instance_f64 * S,\r
3738         uint8_t numStages,\r
3739         float64_t * pCoeffs,\r
3740         float64_t * pState);\r
3741 \r
3742 \r
3743   /**\r
3744    * @brief Instance structure for the Q15 FIR lattice filter.\r
3745    */\r
3746   typedef struct\r
3747   {\r
3748           uint16_t numStages;                  /**< number of filter stages. */\r
3749           q15_t *pState;                       /**< points to the state variable array. The array is of length numStages. */\r
3750     const q15_t *pCoeffs;                      /**< points to the coefficient array. The array is of length numStages. */\r
3751   } arm_fir_lattice_instance_q15;\r
3752 \r
3753   /**\r
3754    * @brief Instance structure for the Q31 FIR lattice filter.\r
3755    */\r
3756   typedef struct\r
3757   {\r
3758           uint16_t numStages;                  /**< number of filter stages. */\r
3759           q31_t *pState;                       /**< points to the state variable array. The array is of length numStages. */\r
3760     const q31_t *pCoeffs;                      /**< points to the coefficient array. The array is of length numStages. */\r
3761   } arm_fir_lattice_instance_q31;\r
3762 \r
3763   /**\r
3764    * @brief Instance structure for the floating-point FIR lattice filter.\r
3765    */\r
3766   typedef struct\r
3767   {\r
3768           uint16_t numStages;                  /**< number of filter stages. */\r
3769           float32_t *pState;                   /**< points to the state variable array. The array is of length numStages. */\r
3770     const float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numStages. */\r
3771   } arm_fir_lattice_instance_f32;\r
3772 \r
3773 \r
3774   /**\r
3775    * @brief Initialization function for the Q15 FIR lattice filter.\r
3776    * @param[in] S          points to an instance of the Q15 FIR lattice structure.\r
3777    * @param[in] numStages  number of filter stages.\r
3778    * @param[in] pCoeffs    points to the coefficient buffer.  The array is of length numStages.\r
3779    * @param[in] pState     points to the state buffer.  The array is of length numStages.\r
3780    */\r
3781   void arm_fir_lattice_init_q15(\r
3782         arm_fir_lattice_instance_q15 * S,\r
3783         uint16_t numStages,\r
3784   const q15_t * pCoeffs,\r
3785         q15_t * pState);\r
3786 \r
3787 \r
3788   /**\r
3789    * @brief Processing function for the Q15 FIR lattice filter.\r
3790    * @param[in]  S          points to an instance of the Q15 FIR lattice structure.\r
3791    * @param[in]  pSrc       points to the block of input data.\r
3792    * @param[out] pDst       points to the block of output data.\r
3793    * @param[in]  blockSize  number of samples to process.\r
3794    */\r
3795   void arm_fir_lattice_q15(\r
3796   const arm_fir_lattice_instance_q15 * S,\r
3797   const q15_t * pSrc,\r
3798         q15_t * pDst,\r
3799         uint32_t blockSize);\r
3800 \r
3801 \r
3802   /**\r
3803    * @brief Initialization function for the Q31 FIR lattice filter.\r
3804    * @param[in] S          points to an instance of the Q31 FIR lattice structure.\r
3805    * @param[in] numStages  number of filter stages.\r
3806    * @param[in] pCoeffs    points to the coefficient buffer.  The array is of length numStages.\r
3807    * @param[in] pState     points to the state buffer.   The array is of length numStages.\r
3808    */\r
3809   void arm_fir_lattice_init_q31(\r
3810         arm_fir_lattice_instance_q31 * S,\r
3811         uint16_t numStages,\r
3812   const q31_t * pCoeffs,\r
3813         q31_t * pState);\r
3814 \r
3815 \r
3816   /**\r
3817    * @brief Processing function for the Q31 FIR lattice filter.\r
3818    * @param[in]  S          points to an instance of the Q31 FIR lattice structure.\r
3819    * @param[in]  pSrc       points to the block of input data.\r
3820    * @param[out] pDst       points to the block of output data\r
3821    * @param[in]  blockSize  number of samples to process.\r
3822    */\r
3823   void arm_fir_lattice_q31(\r
3824   const arm_fir_lattice_instance_q31 * S,\r
3825   const q31_t * pSrc,\r
3826         q31_t * pDst,\r
3827         uint32_t blockSize);\r
3828 \r
3829 \r
3830 /**\r
3831  * @brief Initialization function for the floating-point FIR lattice filter.\r
3832  * @param[in] S          points to an instance of the floating-point FIR lattice structure.\r
3833  * @param[in] numStages  number of filter stages.\r
3834  * @param[in] pCoeffs    points to the coefficient buffer.  The array is of length numStages.\r
3835  * @param[in] pState     points to the state buffer.  The array is of length numStages.\r
3836  */\r
3837   void arm_fir_lattice_init_f32(\r
3838         arm_fir_lattice_instance_f32 * S,\r
3839         uint16_t numStages,\r
3840   const float32_t * pCoeffs,\r
3841         float32_t * pState);\r
3842 \r
3843 \r
3844   /**\r
3845    * @brief Processing function for the floating-point FIR lattice filter.\r
3846    * @param[in]  S          points to an instance of the floating-point FIR lattice structure.\r
3847    * @param[in]  pSrc       points to the block of input data.\r
3848    * @param[out] pDst       points to the block of output data\r
3849    * @param[in]  blockSize  number of samples to process.\r
3850    */\r
3851   void arm_fir_lattice_f32(\r
3852   const arm_fir_lattice_instance_f32 * S,\r
3853   const float32_t * pSrc,\r
3854         float32_t * pDst,\r
3855         uint32_t blockSize);\r
3856 \r
3857 \r
3858   /**\r
3859    * @brief Instance structure for the Q15 IIR lattice filter.\r
3860    */\r
3861   typedef struct\r
3862   {\r
3863           uint16_t numStages;                  /**< number of stages in the filter. */\r
3864           q15_t *pState;                       /**< points to the state variable array. The array is of length numStages+blockSize. */\r
3865           q15_t *pkCoeffs;                     /**< points to the reflection coefficient array. The array is of length numStages. */\r
3866           q15_t *pvCoeffs;                     /**< points to the ladder coefficient array. The array is of length numStages+1. */\r
3867   } arm_iir_lattice_instance_q15;\r
3868 \r
3869   /**\r
3870    * @brief Instance structure for the Q31 IIR lattice filter.\r
3871    */\r
3872   typedef struct\r
3873   {\r
3874           uint16_t numStages;                  /**< number of stages in the filter. */\r
3875           q31_t *pState;                       /**< points to the state variable array. The array is of length numStages+blockSize. */\r
3876           q31_t *pkCoeffs;                     /**< points to the reflection coefficient array. The array is of length numStages. */\r
3877           q31_t *pvCoeffs;                     /**< points to the ladder coefficient array. The array is of length numStages+1. */\r
3878   } arm_iir_lattice_instance_q31;\r
3879 \r
3880   /**\r
3881    * @brief Instance structure for the floating-point IIR lattice filter.\r
3882    */\r
3883   typedef struct\r
3884   {\r
3885           uint16_t numStages;                  /**< number of stages in the filter. */\r
3886           float32_t *pState;                   /**< points to the state variable array. The array is of length numStages+blockSize. */\r
3887           float32_t *pkCoeffs;                 /**< points to the reflection coefficient array. The array is of length numStages. */\r
3888           float32_t *pvCoeffs;                 /**< points to the ladder coefficient array. The array is of length numStages+1. */\r
3889   } arm_iir_lattice_instance_f32;\r
3890 \r
3891 \r
3892   /**\r
3893    * @brief Processing function for the floating-point IIR lattice filter.\r
3894    * @param[in]  S          points to an instance of the floating-point IIR lattice structure.\r
3895    * @param[in]  pSrc       points to the block of input data.\r
3896    * @param[out] pDst       points to the block of output data.\r
3897    * @param[in]  blockSize  number of samples to process.\r
3898    */\r
3899   void arm_iir_lattice_f32(\r
3900   const arm_iir_lattice_instance_f32 * S,\r
3901   const float32_t * pSrc,\r
3902         float32_t * pDst,\r
3903         uint32_t blockSize);\r
3904 \r
3905 \r
3906   /**\r
3907    * @brief Initialization function for the floating-point IIR lattice filter.\r
3908    * @param[in] S          points to an instance of the floating-point IIR lattice structure.\r
3909    * @param[in] numStages  number of stages in the filter.\r
3910    * @param[in] pkCoeffs   points to the reflection coefficient buffer.  The array is of length numStages.\r
3911    * @param[in] pvCoeffs   points to the ladder coefficient buffer.  The array is of length numStages+1.\r
3912    * @param[in] pState     points to the state buffer.  The array is of length numStages+blockSize-1.\r
3913    * @param[in] blockSize  number of samples to process.\r
3914    */\r
3915   void arm_iir_lattice_init_f32(\r
3916         arm_iir_lattice_instance_f32 * S,\r
3917         uint16_t numStages,\r
3918         float32_t * pkCoeffs,\r
3919         float32_t * pvCoeffs,\r
3920         float32_t * pState,\r
3921         uint32_t blockSize);\r
3922 \r
3923 \r
3924   /**\r
3925    * @brief Processing function for the Q31 IIR lattice filter.\r
3926    * @param[in]  S          points to an instance of the Q31 IIR lattice structure.\r
3927    * @param[in]  pSrc       points to the block of input data.\r
3928    * @param[out] pDst       points to the block of output data.\r
3929    * @param[in]  blockSize  number of samples to process.\r
3930    */\r
3931   void arm_iir_lattice_q31(\r
3932   const arm_iir_lattice_instance_q31 * S,\r
3933   const q31_t * pSrc,\r
3934         q31_t * pDst,\r
3935         uint32_t blockSize);\r
3936 \r
3937 \r
3938   /**\r
3939    * @brief Initialization function for the Q31 IIR lattice filter.\r
3940    * @param[in] S          points to an instance of the Q31 IIR lattice structure.\r
3941    * @param[in] numStages  number of stages in the filter.\r
3942    * @param[in] pkCoeffs   points to the reflection coefficient buffer.  The array is of length numStages.\r
3943    * @param[in] pvCoeffs   points to the ladder coefficient buffer.  The array is of length numStages+1.\r
3944    * @param[in] pState     points to the state buffer.  The array is of length numStages+blockSize.\r
3945    * @param[in] blockSize  number of samples to process.\r
3946    */\r
3947   void arm_iir_lattice_init_q31(\r
3948         arm_iir_lattice_instance_q31 * S,\r
3949         uint16_t numStages,\r
3950         q31_t * pkCoeffs,\r
3951         q31_t * pvCoeffs,\r
3952         q31_t * pState,\r
3953         uint32_t blockSize);\r
3954 \r
3955 \r
3956   /**\r
3957    * @brief Processing function for the Q15 IIR lattice filter.\r
3958    * @param[in]  S          points to an instance of the Q15 IIR lattice structure.\r
3959    * @param[in]  pSrc       points to the block of input data.\r
3960    * @param[out] pDst       points to the block of output data.\r
3961    * @param[in]  blockSize  number of samples to process.\r
3962    */\r
3963   void arm_iir_lattice_q15(\r
3964   const arm_iir_lattice_instance_q15 * S,\r
3965   const q15_t * pSrc,\r
3966         q15_t * pDst,\r
3967         uint32_t blockSize);\r
3968 \r
3969 \r
3970 /**\r
3971  * @brief Initialization function for the Q15 IIR lattice filter.\r
3972  * @param[in] S          points to an instance of the fixed-point Q15 IIR lattice structure.\r
3973  * @param[in] numStages  number of stages in the filter.\r
3974  * @param[in] pkCoeffs   points to reflection coefficient buffer.  The array is of length numStages.\r
3975  * @param[in] pvCoeffs   points to ladder coefficient buffer.  The array is of length numStages+1.\r
3976  * @param[in] pState     points to state buffer.  The array is of length numStages+blockSize.\r
3977  * @param[in] blockSize  number of samples to process per call.\r
3978  */\r
3979   void arm_iir_lattice_init_q15(\r
3980         arm_iir_lattice_instance_q15 * S,\r
3981         uint16_t numStages,\r
3982         q15_t * pkCoeffs,\r
3983         q15_t * pvCoeffs,\r
3984         q15_t * pState,\r
3985         uint32_t blockSize);\r
3986 \r
3987 \r
3988   /**\r
3989    * @brief Instance structure for the floating-point LMS filter.\r
3990    */\r
3991   typedef struct\r
3992   {\r
3993           uint16_t numTaps;    /**< number of coefficients in the filter. */\r
3994           float32_t *pState;   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3995           float32_t *pCoeffs;  /**< points to the coefficient array. The array is of length numTaps. */\r
3996           float32_t mu;        /**< step size that controls filter coefficient updates. */\r
3997   } arm_lms_instance_f32;\r
3998 \r
3999 \r
4000   /**\r
4001    * @brief Processing function for floating-point LMS filter.\r
4002    * @param[in]  S          points to an instance of the floating-point LMS filter structure.\r
4003    * @param[in]  pSrc       points to the block of input data.\r
4004    * @param[in]  pRef       points to the block of reference data.\r
4005    * @param[out] pOut       points to the block of output data.\r
4006    * @param[out] pErr       points to the block of error data.\r
4007    * @param[in]  blockSize  number of samples to process.\r
4008    */\r
4009   void arm_lms_f32(\r
4010   const arm_lms_instance_f32 * S,\r
4011   const float32_t * pSrc,\r
4012         float32_t * pRef,\r
4013         float32_t * pOut,\r
4014         float32_t * pErr,\r
4015         uint32_t blockSize);\r
4016 \r
4017 \r
4018   /**\r
4019    * @brief Initialization function for floating-point LMS filter.\r
4020    * @param[in] S          points to an instance of the floating-point LMS filter structure.\r
4021    * @param[in] numTaps    number of filter coefficients.\r
4022    * @param[in] pCoeffs    points to the coefficient buffer.\r
4023    * @param[in] pState     points to state buffer.\r
4024    * @param[in] mu         step size that controls filter coefficient updates.\r
4025    * @param[in] blockSize  number of samples to process.\r
4026    */\r
4027   void arm_lms_init_f32(\r
4028         arm_lms_instance_f32 * S,\r
4029         uint16_t numTaps,\r
4030         float32_t * pCoeffs,\r
4031         float32_t * pState,\r
4032         float32_t mu,\r
4033         uint32_t blockSize);\r
4034 \r
4035 \r
4036   /**\r
4037    * @brief Instance structure for the Q15 LMS filter.\r
4038    */\r
4039   typedef struct\r
4040   {\r
4041           uint16_t numTaps;    /**< number of coefficients in the filter. */\r
4042           q15_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4043           q15_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */\r
4044           q15_t mu;            /**< step size that controls filter coefficient updates. */\r
4045           uint32_t postShift;  /**< bit shift applied to coefficients. */\r
4046   } arm_lms_instance_q15;\r
4047 \r
4048 \r
4049   /**\r
4050    * @brief Initialization function for the Q15 LMS filter.\r
4051    * @param[in] S          points to an instance of the Q15 LMS filter structure.\r
4052    * @param[in] numTaps    number of filter coefficients.\r
4053    * @param[in] pCoeffs    points to the coefficient buffer.\r
4054    * @param[in] pState     points to the state buffer.\r
4055    * @param[in] mu         step size that controls filter coefficient updates.\r
4056    * @param[in] blockSize  number of samples to process.\r
4057    * @param[in] postShift  bit shift applied to coefficients.\r
4058    */\r
4059   void arm_lms_init_q15(\r
4060         arm_lms_instance_q15 * S,\r
4061         uint16_t numTaps,\r
4062         q15_t * pCoeffs,\r
4063         q15_t * pState,\r
4064         q15_t mu,\r
4065         uint32_t blockSize,\r
4066         uint32_t postShift);\r
4067 \r
4068 \r
4069   /**\r
4070    * @brief Processing function for Q15 LMS filter.\r
4071    * @param[in]  S          points to an instance of the Q15 LMS filter structure.\r
4072    * @param[in]  pSrc       points to the block of input data.\r
4073    * @param[in]  pRef       points to the block of reference data.\r
4074    * @param[out] pOut       points to the block of output data.\r
4075    * @param[out] pErr       points to the block of error data.\r
4076    * @param[in]  blockSize  number of samples to process.\r
4077    */\r
4078   void arm_lms_q15(\r
4079   const arm_lms_instance_q15 * S,\r
4080   const q15_t * pSrc,\r
4081         q15_t * pRef,\r
4082         q15_t * pOut,\r
4083         q15_t * pErr,\r
4084         uint32_t blockSize);\r
4085 \r
4086 \r
4087   /**\r
4088    * @brief Instance structure for the Q31 LMS filter.\r
4089    */\r
4090   typedef struct\r
4091   {\r
4092           uint16_t numTaps;    /**< number of coefficients in the filter. */\r
4093           q31_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4094           q31_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */\r
4095           q31_t mu;            /**< step size that controls filter coefficient updates. */\r
4096           uint32_t postShift;  /**< bit shift applied to coefficients. */\r
4097   } arm_lms_instance_q31;\r
4098 \r
4099 \r
4100   /**\r
4101    * @brief Processing function for Q31 LMS filter.\r
4102    * @param[in]  S          points to an instance of the Q15 LMS filter structure.\r
4103    * @param[in]  pSrc       points to the block of input data.\r
4104    * @param[in]  pRef       points to the block of reference data.\r
4105    * @param[out] pOut       points to the block of output data.\r
4106    * @param[out] pErr       points to the block of error data.\r
4107    * @param[in]  blockSize  number of samples to process.\r
4108    */\r
4109   void arm_lms_q31(\r
4110   const arm_lms_instance_q31 * S,\r
4111   const q31_t * pSrc,\r
4112         q31_t * pRef,\r
4113         q31_t * pOut,\r
4114         q31_t * pErr,\r
4115         uint32_t blockSize);\r
4116 \r
4117 \r
4118   /**\r
4119    * @brief Initialization function for Q31 LMS filter.\r
4120    * @param[in] S          points to an instance of the Q31 LMS filter structure.\r
4121    * @param[in] numTaps    number of filter coefficients.\r
4122    * @param[in] pCoeffs    points to coefficient buffer.\r
4123    * @param[in] pState     points to state buffer.\r
4124    * @param[in] mu         step size that controls filter coefficient updates.\r
4125    * @param[in] blockSize  number of samples to process.\r
4126    * @param[in] postShift  bit shift applied to coefficients.\r
4127    */\r
4128   void arm_lms_init_q31(\r
4129         arm_lms_instance_q31 * S,\r
4130         uint16_t numTaps,\r
4131         q31_t * pCoeffs,\r
4132         q31_t * pState,\r
4133         q31_t mu,\r
4134         uint32_t blockSize,\r
4135         uint32_t postShift);\r
4136 \r
4137 \r
4138   /**\r
4139    * @brief Instance structure for the floating-point normalized LMS filter.\r
4140    */\r
4141   typedef struct\r
4142   {\r
4143           uint16_t numTaps;     /**< number of coefficients in the filter. */\r
4144           float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4145           float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */\r
4146           float32_t mu;         /**< step size that control filter coefficient updates. */\r
4147           float32_t energy;     /**< saves previous frame energy. */\r
4148           float32_t x0;         /**< saves previous input sample. */\r
4149   } arm_lms_norm_instance_f32;\r
4150 \r
4151 \r
4152   /**\r
4153    * @brief Processing function for floating-point normalized LMS filter.\r
4154    * @param[in]  S          points to an instance of the floating-point normalized LMS filter structure.\r
4155    * @param[in]  pSrc       points to the block of input data.\r
4156    * @param[in]  pRef       points to the block of reference data.\r
4157    * @param[out] pOut       points to the block of output data.\r
4158    * @param[out] pErr       points to the block of error data.\r
4159    * @param[in]  blockSize  number of samples to process.\r
4160    */\r
4161   void arm_lms_norm_f32(\r
4162         arm_lms_norm_instance_f32 * S,\r
4163   const float32_t * pSrc,\r
4164         float32_t * pRef,\r
4165         float32_t * pOut,\r
4166         float32_t * pErr,\r
4167         uint32_t blockSize);\r
4168 \r
4169 \r
4170   /**\r
4171    * @brief Initialization function for floating-point normalized LMS filter.\r
4172    * @param[in] S          points to an instance of the floating-point LMS filter structure.\r
4173    * @param[in] numTaps    number of filter coefficients.\r
4174    * @param[in] pCoeffs    points to coefficient buffer.\r
4175    * @param[in] pState     points to state buffer.\r
4176    * @param[in] mu         step size that controls filter coefficient updates.\r
4177    * @param[in] blockSize  number of samples to process.\r
4178    */\r
4179   void arm_lms_norm_init_f32(\r
4180         arm_lms_norm_instance_f32 * S,\r
4181         uint16_t numTaps,\r
4182         float32_t * pCoeffs,\r
4183         float32_t * pState,\r
4184         float32_t mu,\r
4185         uint32_t blockSize);\r
4186 \r
4187 \r
4188   /**\r
4189    * @brief Instance structure for the Q31 normalized LMS filter.\r
4190    */\r
4191   typedef struct\r
4192   {\r
4193           uint16_t numTaps;     /**< number of coefficients in the filter. */\r
4194           q31_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4195           q31_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */\r
4196           q31_t mu;             /**< step size that controls filter coefficient updates. */\r
4197           uint8_t postShift;    /**< bit shift applied to coefficients. */\r
4198     const q31_t *recipTable;    /**< points to the reciprocal initial value table. */\r
4199           q31_t energy;         /**< saves previous frame energy. */\r
4200           q31_t x0;             /**< saves previous input sample. */\r
4201   } arm_lms_norm_instance_q31;\r
4202 \r
4203 \r
4204   /**\r
4205    * @brief Processing function for Q31 normalized LMS filter.\r
4206    * @param[in]  S          points to an instance of the Q31 normalized LMS filter structure.\r
4207    * @param[in]  pSrc       points to the block of input data.\r
4208    * @param[in]  pRef       points to the block of reference data.\r
4209    * @param[out] pOut       points to the block of output data.\r
4210    * @param[out] pErr       points to the block of error data.\r
4211    * @param[in]  blockSize  number of samples to process.\r
4212    */\r
4213   void arm_lms_norm_q31(\r
4214         arm_lms_norm_instance_q31 * S,\r
4215   const q31_t * pSrc,\r
4216         q31_t * pRef,\r
4217         q31_t * pOut,\r
4218         q31_t * pErr,\r
4219         uint32_t blockSize);\r
4220 \r
4221 \r
4222   /**\r
4223    * @brief Initialization function for Q31 normalized LMS filter.\r
4224    * @param[in] S          points to an instance of the Q31 normalized LMS filter structure.\r
4225    * @param[in] numTaps    number of filter coefficients.\r
4226    * @param[in] pCoeffs    points to coefficient buffer.\r
4227    * @param[in] pState     points to state buffer.\r
4228    * @param[in] mu         step size that controls filter coefficient updates.\r
4229    * @param[in] blockSize  number of samples to process.\r
4230    * @param[in] postShift  bit shift applied to coefficients.\r
4231    */\r
4232   void arm_lms_norm_init_q31(\r
4233         arm_lms_norm_instance_q31 * S,\r
4234         uint16_t numTaps,\r
4235         q31_t * pCoeffs,\r
4236         q31_t * pState,\r
4237         q31_t mu,\r
4238         uint32_t blockSize,\r
4239         uint8_t postShift);\r
4240 \r
4241 \r
4242   /**\r
4243    * @brief Instance structure for the Q15 normalized LMS filter.\r
4244    */\r
4245   typedef struct\r
4246   {\r
4247           uint16_t numTaps;     /**< Number of coefficients in the filter. */\r
4248           q15_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4249           q15_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */\r
4250           q15_t mu;             /**< step size that controls filter coefficient updates. */\r
4251           uint8_t postShift;    /**< bit shift applied to coefficients. */\r
4252     const q15_t *recipTable;    /**< Points to the reciprocal initial value table. */\r
4253           q15_t energy;         /**< saves previous frame energy. */\r
4254           q15_t x0;             /**< saves previous input sample. */\r
4255   } arm_lms_norm_instance_q15;\r
4256 \r
4257 \r
4258   /**\r
4259    * @brief Processing function for Q15 normalized LMS filter.\r
4260    * @param[in]  S          points to an instance of the Q15 normalized LMS filter structure.\r
4261    * @param[in]  pSrc       points to the block of input data.\r
4262    * @param[in]  pRef       points to the block of reference data.\r
4263    * @param[out] pOut       points to the block of output data.\r
4264    * @param[out] pErr       points to the block of error data.\r
4265    * @param[in]  blockSize  number of samples to process.\r
4266    */\r
4267   void arm_lms_norm_q15(\r
4268         arm_lms_norm_instance_q15 * S,\r
4269   const q15_t * pSrc,\r
4270         q15_t * pRef,\r
4271         q15_t * pOut,\r
4272         q15_t * pErr,\r
4273         uint32_t blockSize);\r
4274 \r
4275 \r
4276   /**\r
4277    * @brief Initialization function for Q15 normalized LMS filter.\r
4278    * @param[in] S          points to an instance of the Q15 normalized LMS filter structure.\r
4279    * @param[in] numTaps    number of filter coefficients.\r
4280    * @param[in] pCoeffs    points to coefficient buffer.\r
4281    * @param[in] pState     points to state buffer.\r
4282    * @param[in] mu         step size that controls filter coefficient updates.\r
4283    * @param[in] blockSize  number of samples to process.\r
4284    * @param[in] postShift  bit shift applied to coefficients.\r
4285    */\r
4286   void arm_lms_norm_init_q15(\r
4287         arm_lms_norm_instance_q15 * S,\r
4288         uint16_t numTaps,\r
4289         q15_t * pCoeffs,\r
4290         q15_t * pState,\r
4291         q15_t mu,\r
4292         uint32_t blockSize,\r
4293         uint8_t postShift);\r
4294 \r
4295 \r
4296   /**\r
4297    * @brief Correlation of floating-point sequences.\r
4298    * @param[in]  pSrcA    points to the first input sequence.\r
4299    * @param[in]  srcALen  length of the first input sequence.\r
4300    * @param[in]  pSrcB    points to the second input sequence.\r
4301    * @param[in]  srcBLen  length of the second input sequence.\r
4302    * @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4303    */\r
4304   void arm_correlate_f32(\r
4305   const float32_t * pSrcA,\r
4306         uint32_t srcALen,\r
4307   const float32_t * pSrcB,\r
4308         uint32_t srcBLen,\r
4309         float32_t * pDst);\r
4310 \r
4311 \r
4312 /**\r
4313  @brief Correlation of Q15 sequences\r
4314  @param[in]  pSrcA     points to the first input sequence\r
4315  @param[in]  srcALen   length of the first input sequence\r
4316  @param[in]  pSrcB     points to the second input sequence\r
4317  @param[in]  srcBLen   length of the second input sequence\r
4318  @param[out] pDst      points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4319  @param[in]  pScratch  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
4320 */\r
4321 void arm_correlate_opt_q15(\r
4322   const q15_t * pSrcA,\r
4323         uint32_t srcALen,\r
4324   const q15_t * pSrcB,\r
4325         uint32_t srcBLen,\r
4326         q15_t * pDst,\r
4327         q15_t * pScratch);\r
4328 \r
4329 \r
4330 /**\r
4331   @brief Correlation of Q15 sequences.\r
4332   @param[in]  pSrcA    points to the first input sequence\r
4333   @param[in]  srcALen  length of the first input sequence\r
4334   @param[in]  pSrcB    points to the second input sequence\r
4335   @param[in]  srcBLen  length of the second input sequence\r
4336   @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4337  */\r
4338   void arm_correlate_q15(\r
4339   const q15_t * pSrcA,\r
4340         uint32_t srcALen,\r
4341   const q15_t * pSrcB,\r
4342         uint32_t srcBLen,\r
4343         q15_t * pDst);\r
4344 \r
4345 \r
4346 /**\r
4347   @brief         Correlation of Q15 sequences (fast version).\r
4348   @param[in]     pSrcA      points to the first input sequence\r
4349   @param[in]     srcALen    length of the first input sequence\r
4350   @param[in]     pSrcB      points to the second input sequence\r
4351   @param[in]     srcBLen    length of the second input sequence\r
4352   @param[out]    pDst       points to the location where the output result is written.  Length 2 * max(srcALen, srcBLen) - 1.\r
4353   @return        none\r
4354  */\r
4355 void arm_correlate_fast_q15(\r
4356   const q15_t * pSrcA,\r
4357         uint32_t srcALen,\r
4358   const q15_t * pSrcB,\r
4359         uint32_t srcBLen,\r
4360         q15_t * pDst);\r
4361 \r
4362 \r
4363 /**\r
4364   @brief Correlation of Q15 sequences (fast version).\r
4365   @param[in]  pSrcA     points to the first input sequence.\r
4366   @param[in]  srcALen   length of the first input sequence.\r
4367   @param[in]  pSrcB     points to the second input sequence.\r
4368   @param[in]  srcBLen   length of the second input sequence.\r
4369   @param[out] pDst      points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4370   @param[in]  pScratch  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
4371  */\r
4372 void arm_correlate_fast_opt_q15(\r
4373   const q15_t * pSrcA,\r
4374         uint32_t srcALen,\r
4375   const q15_t * pSrcB,\r
4376         uint32_t srcBLen,\r
4377         q15_t * pDst,\r
4378         q15_t * pScratch);\r
4379 \r
4380 \r
4381   /**\r
4382    * @brief Correlation of Q31 sequences.\r
4383    * @param[in]  pSrcA    points to the first input sequence.\r
4384    * @param[in]  srcALen  length of the first input sequence.\r
4385    * @param[in]  pSrcB    points to the second input sequence.\r
4386    * @param[in]  srcBLen  length of the second input sequence.\r
4387    * @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4388    */\r
4389   void arm_correlate_q31(\r
4390   const q31_t * pSrcA,\r
4391         uint32_t srcALen,\r
4392   const q31_t * pSrcB,\r
4393         uint32_t srcBLen,\r
4394         q31_t * pDst);\r
4395 \r
4396 \r
4397 /**\r
4398   @brief Correlation of Q31 sequences (fast version).\r
4399   @param[in]  pSrcA    points to the first input sequence\r
4400   @param[in]  srcALen  length of the first input sequence\r
4401   @param[in]  pSrcB    points to the second input sequence\r
4402   @param[in]  srcBLen  length of the second input sequence\r
4403   @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4404  */\r
4405 void arm_correlate_fast_q31(\r
4406   const q31_t * pSrcA,\r
4407         uint32_t srcALen,\r
4408   const q31_t * pSrcB,\r
4409         uint32_t srcBLen,\r
4410         q31_t * pDst);\r
4411 \r
4412 \r
4413  /**\r
4414    * @brief Correlation of Q7 sequences.\r
4415    * @param[in]  pSrcA      points to the first input sequence.\r
4416    * @param[in]  srcALen    length of the first input sequence.\r
4417    * @param[in]  pSrcB      points to the second input sequence.\r
4418    * @param[in]  srcBLen    length of the second input sequence.\r
4419    * @param[out] pDst       points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4420    * @param[in]  pScratch1  points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
4421    * @param[in]  pScratch2  points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).\r
4422    */\r
4423   void arm_correlate_opt_q7(\r
4424   const q7_t * pSrcA,\r
4425         uint32_t srcALen,\r
4426   const q7_t * pSrcB,\r
4427         uint32_t srcBLen,\r
4428         q7_t * pDst,\r
4429         q15_t * pScratch1,\r
4430         q15_t * pScratch2);\r
4431 \r
4432 \r
4433   /**\r
4434    * @brief Correlation of Q7 sequences.\r
4435    * @param[in]  pSrcA    points to the first input sequence.\r
4436    * @param[in]  srcALen  length of the first input sequence.\r
4437    * @param[in]  pSrcB    points to the second input sequence.\r
4438    * @param[in]  srcBLen  length of the second input sequence.\r
4439    * @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4440    */\r
4441   void arm_correlate_q7(\r
4442   const q7_t * pSrcA,\r
4443         uint32_t srcALen,\r
4444   const q7_t * pSrcB,\r
4445         uint32_t srcBLen,\r
4446         q7_t * pDst);\r
4447 \r
4448 \r
4449   /**\r
4450    * @brief Instance structure for the floating-point sparse FIR filter.\r
4451    */\r
4452   typedef struct\r
4453   {\r
4454           uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4455           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4456           float32_t *pState;            /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4457     const float32_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/\r
4458           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4459           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4460   } arm_fir_sparse_instance_f32;\r
4461 \r
4462   /**\r
4463    * @brief Instance structure for the Q31 sparse FIR filter.\r
4464    */\r
4465   typedef struct\r
4466   {\r
4467           uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4468           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4469           q31_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4470     const q31_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/\r
4471           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4472           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4473   } arm_fir_sparse_instance_q31;\r
4474 \r
4475   /**\r
4476    * @brief Instance structure for the Q15 sparse FIR filter.\r
4477    */\r
4478   typedef struct\r
4479   {\r
4480           uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4481           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4482           q15_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4483     const q15_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/\r
4484           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4485           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4486   } arm_fir_sparse_instance_q15;\r
4487 \r
4488   /**\r
4489    * @brief Instance structure for the Q7 sparse FIR filter.\r
4490    */\r
4491   typedef struct\r
4492   {\r
4493           uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4494           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4495           q7_t *pState;                 /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4496     const q7_t *pCoeffs;                /**< points to the coefficient array. The array is of length numTaps.*/\r
4497           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4498           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4499   } arm_fir_sparse_instance_q7;\r
4500 \r
4501 \r
4502   /**\r
4503    * @brief Processing function for the floating-point sparse FIR filter.\r
4504    * @param[in]  S           points to an instance of the floating-point sparse FIR structure.\r
4505    * @param[in]  pSrc        points to the block of input data.\r
4506    * @param[out] pDst        points to the block of output data\r
4507    * @param[in]  pScratchIn  points to a temporary buffer of size blockSize.\r
4508    * @param[in]  blockSize   number of input samples to process per call.\r
4509    */\r
4510   void arm_fir_sparse_f32(\r
4511         arm_fir_sparse_instance_f32 * S,\r
4512   const float32_t * pSrc,\r
4513         float32_t * pDst,\r
4514         float32_t * pScratchIn,\r
4515         uint32_t blockSize);\r
4516 \r
4517 \r
4518   /**\r
4519    * @brief  Initialization function for the floating-point sparse FIR filter.\r
4520    * @param[in,out] S          points to an instance of the floating-point sparse FIR structure.\r
4521    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4522    * @param[in]     pCoeffs    points to the array of filter coefficients.\r
4523    * @param[in]     pState     points to the state buffer.\r
4524    * @param[in]     pTapDelay  points to the array of offset times.\r
4525    * @param[in]     maxDelay   maximum offset time supported.\r
4526    * @param[in]     blockSize  number of samples that will be processed per block.\r
4527    */\r
4528   void arm_fir_sparse_init_f32(\r
4529         arm_fir_sparse_instance_f32 * S,\r
4530         uint16_t numTaps,\r
4531   const float32_t * pCoeffs,\r
4532         float32_t * pState,\r
4533         int32_t * pTapDelay,\r
4534         uint16_t maxDelay,\r
4535         uint32_t blockSize);\r
4536 \r
4537 \r
4538   /**\r
4539    * @brief Processing function for the Q31 sparse FIR filter.\r
4540    * @param[in]  S           points to an instance of the Q31 sparse FIR structure.\r
4541    * @param[in]  pSrc        points to the block of input data.\r
4542    * @param[out] pDst        points to the block of output data\r
4543    * @param[in]  pScratchIn  points to a temporary buffer of size blockSize.\r
4544    * @param[in]  blockSize   number of input samples to process per call.\r
4545    */\r
4546   void arm_fir_sparse_q31(\r
4547         arm_fir_sparse_instance_q31 * S,\r
4548   const q31_t * pSrc,\r
4549         q31_t * pDst,\r
4550         q31_t * pScratchIn,\r
4551         uint32_t blockSize);\r
4552 \r
4553 \r
4554   /**\r
4555    * @brief  Initialization function for the Q31 sparse FIR filter.\r
4556    * @param[in,out] S          points to an instance of the Q31 sparse FIR structure.\r
4557    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4558    * @param[in]     pCoeffs    points to the array of filter coefficients.\r
4559    * @param[in]     pState     points to the state buffer.\r
4560    * @param[in]     pTapDelay  points to the array of offset times.\r
4561    * @param[in]     maxDelay   maximum offset time supported.\r
4562    * @param[in]     blockSize  number of samples that will be processed per block.\r
4563    */\r
4564   void arm_fir_sparse_init_q31(\r
4565         arm_fir_sparse_instance_q31 * S,\r
4566         uint16_t numTaps,\r
4567   const q31_t * pCoeffs,\r
4568         q31_t * pState,\r
4569         int32_t * pTapDelay,\r
4570         uint16_t maxDelay,\r
4571         uint32_t blockSize);\r
4572 \r
4573 \r
4574   /**\r
4575    * @brief Processing function for the Q15 sparse FIR filter.\r
4576    * @param[in]  S            points to an instance of the Q15 sparse FIR structure.\r
4577    * @param[in]  pSrc         points to the block of input data.\r
4578    * @param[out] pDst         points to the block of output data\r
4579    * @param[in]  pScratchIn   points to a temporary buffer of size blockSize.\r
4580    * @param[in]  pScratchOut  points to a temporary buffer of size blockSize.\r
4581    * @param[in]  blockSize    number of input samples to process per call.\r
4582    */\r
4583   void arm_fir_sparse_q15(\r
4584         arm_fir_sparse_instance_q15 * S,\r
4585   const q15_t * pSrc,\r
4586         q15_t * pDst,\r
4587         q15_t * pScratchIn,\r
4588         q31_t * pScratchOut,\r
4589         uint32_t blockSize);\r
4590 \r
4591 \r
4592   /**\r
4593    * @brief  Initialization function for the Q15 sparse FIR filter.\r
4594    * @param[in,out] S          points to an instance of the Q15 sparse FIR structure.\r
4595    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4596    * @param[in]     pCoeffs    points to the array of filter coefficients.\r
4597    * @param[in]     pState     points to the state buffer.\r
4598    * @param[in]     pTapDelay  points to the array of offset times.\r
4599    * @param[in]     maxDelay   maximum offset time supported.\r
4600    * @param[in]     blockSize  number of samples that will be processed per block.\r
4601    */\r
4602   void arm_fir_sparse_init_q15(\r
4603         arm_fir_sparse_instance_q15 * S,\r
4604         uint16_t numTaps,\r
4605   const q15_t * pCoeffs,\r
4606         q15_t * pState,\r
4607         int32_t * pTapDelay,\r
4608         uint16_t maxDelay,\r
4609         uint32_t blockSize);\r
4610 \r
4611 \r
4612   /**\r
4613    * @brief Processing function for the Q7 sparse FIR filter.\r
4614    * @param[in]  S            points to an instance of the Q7 sparse FIR structure.\r
4615    * @param[in]  pSrc         points to the block of input data.\r
4616    * @param[out] pDst         points to the block of output data\r
4617    * @param[in]  pScratchIn   points to a temporary buffer of size blockSize.\r
4618    * @param[in]  pScratchOut  points to a temporary buffer of size blockSize.\r
4619    * @param[in]  blockSize    number of input samples to process per call.\r
4620    */\r
4621   void arm_fir_sparse_q7(\r
4622         arm_fir_sparse_instance_q7 * S,\r
4623   const q7_t * pSrc,\r
4624         q7_t * pDst,\r
4625         q7_t * pScratchIn,\r
4626         q31_t * pScratchOut,\r
4627         uint32_t blockSize);\r
4628 \r
4629 \r
4630   /**\r
4631    * @brief  Initialization function for the Q7 sparse FIR filter.\r
4632    * @param[in,out] S          points to an instance of the Q7 sparse FIR structure.\r
4633    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4634    * @param[in]     pCoeffs    points to the array of filter coefficients.\r
4635    * @param[in]     pState     points to the state buffer.\r
4636    * @param[in]     pTapDelay  points to the array of offset times.\r
4637    * @param[in]     maxDelay   maximum offset time supported.\r
4638    * @param[in]     blockSize  number of samples that will be processed per block.\r
4639    */\r
4640   void arm_fir_sparse_init_q7(\r
4641         arm_fir_sparse_instance_q7 * S,\r
4642         uint16_t numTaps,\r
4643   const q7_t * pCoeffs,\r
4644         q7_t * pState,\r
4645         int32_t * pTapDelay,\r
4646         uint16_t maxDelay,\r
4647         uint32_t blockSize);\r
4648 \r
4649 \r
4650   /**\r
4651    * @brief  Floating-point sin_cos function.\r
4652    * @param[in]  theta   input value in degrees\r
4653    * @param[out] pSinVal  points to the processed sine output.\r
4654    * @param[out] pCosVal  points to the processed cos output.\r
4655    */\r
4656   void arm_sin_cos_f32(\r
4657         float32_t theta,\r
4658         float32_t * pSinVal,\r
4659         float32_t * pCosVal);\r
4660 \r
4661 \r
4662   /**\r
4663    * @brief  Q31 sin_cos function.\r
4664    * @param[in]  theta    scaled input value in degrees\r
4665    * @param[out] pSinVal  points to the processed sine output.\r
4666    * @param[out] pCosVal  points to the processed cosine output.\r
4667    */\r
4668   void arm_sin_cos_q31(\r
4669         q31_t theta,\r
4670         q31_t * pSinVal,\r
4671         q31_t * pCosVal);\r
4672 \r
4673 \r
4674   /**\r
4675    * @brief  Floating-point complex conjugate.\r
4676    * @param[in]  pSrc        points to the input vector\r
4677    * @param[out] pDst        points to the output vector\r
4678    * @param[in]  numSamples  number of complex samples in each vector\r
4679    */\r
4680   void arm_cmplx_conj_f32(\r
4681   const float32_t * pSrc,\r
4682         float32_t * pDst,\r
4683         uint32_t numSamples);\r
4684 \r
4685   /**\r
4686    * @brief  Q31 complex conjugate.\r
4687    * @param[in]  pSrc        points to the input vector\r
4688    * @param[out] pDst        points to the output vector\r
4689    * @param[in]  numSamples  number of complex samples in each vector\r
4690    */\r
4691   void arm_cmplx_conj_q31(\r
4692   const q31_t * pSrc,\r
4693         q31_t * pDst,\r
4694         uint32_t numSamples);\r
4695 \r
4696 \r
4697   /**\r
4698    * @brief  Q15 complex conjugate.\r
4699    * @param[in]  pSrc        points to the input vector\r
4700    * @param[out] pDst        points to the output vector\r
4701    * @param[in]  numSamples  number of complex samples in each vector\r
4702    */\r
4703   void arm_cmplx_conj_q15(\r
4704   const q15_t * pSrc,\r
4705         q15_t * pDst,\r
4706         uint32_t numSamples);\r
4707 \r
4708 \r
4709   /**\r
4710    * @brief  Floating-point complex magnitude squared\r
4711    * @param[in]  pSrc        points to the complex input vector\r
4712    * @param[out] pDst        points to the real output vector\r
4713    * @param[in]  numSamples  number of complex samples in the input vector\r
4714    */\r
4715   void arm_cmplx_mag_squared_f32(\r
4716   const float32_t * pSrc,\r
4717         float32_t * pDst,\r
4718         uint32_t numSamples);\r
4719 \r
4720 \r
4721   /**\r
4722    * @brief  Q31 complex magnitude squared\r
4723    * @param[in]  pSrc        points to the complex input vector\r
4724    * @param[out] pDst        points to the real output vector\r
4725    * @param[in]  numSamples  number of complex samples in the input vector\r
4726    */\r
4727   void arm_cmplx_mag_squared_q31(\r
4728   const q31_t * pSrc,\r
4729         q31_t * pDst,\r
4730         uint32_t numSamples);\r
4731 \r
4732 \r
4733   /**\r
4734    * @brief  Q15 complex magnitude squared\r
4735    * @param[in]  pSrc        points to the complex input vector\r
4736    * @param[out] pDst        points to the real output vector\r
4737    * @param[in]  numSamples  number of complex samples in the input vector\r
4738    */\r
4739   void arm_cmplx_mag_squared_q15(\r
4740   const q15_t * pSrc,\r
4741         q15_t * pDst,\r
4742         uint32_t numSamples);\r
4743 \r
4744 \r
4745  /**\r
4746    * @ingroup groupController\r
4747    */\r
4748 \r
4749   /**\r
4750    * @defgroup PID PID Motor Control\r
4751    *\r
4752    * A Proportional Integral Derivative (PID) controller is a generic feedback control\r
4753    * loop mechanism widely used in industrial control systems.\r
4754    * A PID controller is the most commonly used type of feedback controller.\r
4755    *\r
4756    * This set of functions implements (PID) controllers\r
4757    * for Q15, Q31, and floating-point data types.  The functions operate on a single sample\r
4758    * of data and each call to the function returns a single processed value.\r
4759    * <code>S</code> points to an instance of the PID control data structure.  <code>in</code>\r
4760    * is the input sample value. The functions return the output value.\r
4761    *\r
4762    * \par Algorithm:\r
4763    * <pre>\r
4764    *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]\r
4765    *    A0 = Kp + Ki + Kd\r
4766    *    A1 = (-Kp ) - (2 * Kd )\r
4767    *    A2 = Kd\r
4768    * </pre>\r
4769    *\r
4770    * \par\r
4771    * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant\r
4772    *\r
4773    * \par\r
4774    * \image html PID.gif "Proportional Integral Derivative Controller"\r
4775    *\r
4776    * \par\r
4777    * The PID controller calculates an "error" value as the difference between\r
4778    * the measured output and the reference input.\r
4779    * The controller attempts to minimize the error by adjusting the process control inputs.\r
4780    * The proportional value determines the reaction to the current error,\r
4781    * the integral value determines the reaction based on the sum of recent errors,\r
4782    * and the derivative value determines the reaction based on the rate at which the error has been changing.\r
4783    *\r
4784    * \par Instance Structure\r
4785    * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.\r
4786    * A separate instance structure must be defined for each PID Controller.\r
4787    * There are separate instance structure declarations for each of the 3 supported data types.\r
4788    *\r
4789    * \par Reset Functions\r
4790    * There is also an associated reset function for each data type which clears the state array.\r
4791    *\r
4792    * \par Initialization Functions\r
4793    * There is also an associated initialization function for each data type.\r
4794    * The initialization function performs the following operations:\r
4795    * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.\r
4796    * - Zeros out the values in the state buffer.\r
4797    *\r
4798    * \par\r
4799    * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.\r
4800    *\r
4801    * \par Fixed-Point Behavior\r
4802    * Care must be taken when using the fixed-point versions of the PID Controller functions.\r
4803    * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.\r
4804    * Refer to the function specific documentation below for usage guidelines.\r
4805    */\r
4806 \r
4807   /**\r
4808    * @addtogroup PID\r
4809    * @{\r
4810    */\r
4811 \r
4812   /**\r
4813    * @brief         Process function for the floating-point PID Control.\r
4814    * @param[in,out] S   is an instance of the floating-point PID Control structure\r
4815    * @param[in]     in  input sample to process\r
4816    * @return        processed output sample.\r
4817    */\r
4818   __STATIC_FORCEINLINE float32_t arm_pid_f32(\r
4819   arm_pid_instance_f32 * S,\r
4820   float32_t in)\r
4821   {\r
4822     float32_t out;\r
4823 \r
4824     /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */\r
4825     out = (S->A0 * in) +\r
4826       (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);\r
4827 \r
4828     /* Update state */\r
4829     S->state[1] = S->state[0];\r
4830     S->state[0] = in;\r
4831     S->state[2] = out;\r
4832 \r
4833     /* return to application */\r
4834     return (out);\r
4835 \r
4836   }\r
4837 \r
4838 /**\r
4839   @brief         Process function for the Q31 PID Control.\r
4840   @param[in,out] S  points to an instance of the Q31 PID Control structure\r
4841   @param[in]     in  input sample to process\r
4842   @return        processed output sample.\r
4843 \r
4844   \par Scaling and Overflow Behavior\r
4845          The function is implemented using an internal 64-bit accumulator.\r
4846          The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.\r
4847          Thus, if the accumulator result overflows it wraps around rather than clip.\r
4848          In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.\r
4849          After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.\r
4850  */\r
4851 __STATIC_FORCEINLINE q31_t arm_pid_q31(\r
4852   arm_pid_instance_q31 * S,\r
4853   q31_t in)\r
4854   {\r
4855     q63_t acc;\r
4856     q31_t out;\r
4857 \r
4858     /* acc = A0 * x[n]  */\r
4859     acc = (q63_t) S->A0 * in;\r
4860 \r
4861     /* acc += A1 * x[n-1] */\r
4862     acc += (q63_t) S->A1 * S->state[0];\r
4863 \r
4864     /* acc += A2 * x[n-2]  */\r
4865     acc += (q63_t) S->A2 * S->state[1];\r
4866 \r
4867     /* convert output to 1.31 format to add y[n-1] */\r
4868     out = (q31_t) (acc >> 31U);\r
4869 \r
4870     /* out += y[n-1] */\r
4871     out += S->state[2];\r
4872 \r
4873     /* Update state */\r
4874     S->state[1] = S->state[0];\r
4875     S->state[0] = in;\r
4876     S->state[2] = out;\r
4877 \r
4878     /* return to application */\r
4879     return (out);\r
4880   }\r
4881 \r
4882 \r
4883 /**\r
4884   @brief         Process function for the Q15 PID Control.\r
4885   @param[in,out] S   points to an instance of the Q15 PID Control structure\r
4886   @param[in]     in  input sample to process\r
4887   @return        processed output sample.\r
4888 \r
4889   \par Scaling and Overflow Behavior\r
4890          The function is implemented using a 64-bit internal accumulator.\r
4891          Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.\r
4892          The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.\r
4893          There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.\r
4894          After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.\r
4895          Lastly, the accumulator is saturated to yield a result in 1.15 format.\r
4896  */\r
4897 __STATIC_FORCEINLINE q15_t arm_pid_q15(\r
4898   arm_pid_instance_q15 * S,\r
4899   q15_t in)\r
4900   {\r
4901     q63_t acc;\r
4902     q15_t out;\r
4903 \r
4904 #if defined (ARM_MATH_DSP)\r
4905     /* Implementation of PID controller */\r
4906 \r
4907     /* acc = A0 * x[n]  */\r
4908     acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);\r
4909 \r
4910     /* acc += A1 * x[n-1] + A2 * x[n-2]  */\r
4911     acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)read_q15x2 (S->state), (uint64_t)acc);\r
4912 #else\r
4913     /* acc = A0 * x[n]  */\r
4914     acc = ((q31_t) S->A0) * in;\r
4915 \r
4916     /* acc += A1 * x[n-1] + A2 * x[n-2]  */\r
4917     acc += (q31_t) S->A1 * S->state[0];\r
4918     acc += (q31_t) S->A2 * S->state[1];\r
4919 #endif\r
4920 \r
4921     /* acc += y[n-1] */\r
4922     acc += (q31_t) S->state[2] << 15;\r
4923 \r
4924     /* saturate the output */\r
4925     out = (q15_t) (__SSAT((acc >> 15), 16));\r
4926 \r
4927     /* Update state */\r
4928     S->state[1] = S->state[0];\r
4929     S->state[0] = in;\r
4930     S->state[2] = out;\r
4931 \r
4932     /* return to application */\r
4933     return (out);\r
4934   }\r
4935 \r
4936   /**\r
4937    * @} end of PID group\r
4938    */\r
4939 \r
4940 \r
4941   /**\r
4942    * @brief Floating-point matrix inverse.\r
4943    * @param[in]  src   points to the instance of the input floating-point matrix structure.\r
4944    * @param[out] dst   points to the instance of the output floating-point matrix structure.\r
4945    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.\r
4946    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.\r
4947    */\r
4948   arm_status arm_mat_inverse_f32(\r
4949   const arm_matrix_instance_f32 * src,\r
4950   arm_matrix_instance_f32 * dst);\r
4951 \r
4952 \r
4953   /**\r
4954    * @brief Floating-point matrix inverse.\r
4955    * @param[in]  src   points to the instance of the input floating-point matrix structure.\r
4956    * @param[out] dst   points to the instance of the output floating-point matrix structure.\r
4957    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.\r
4958    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.\r
4959    */\r
4960   arm_status arm_mat_inverse_f64(\r
4961   const arm_matrix_instance_f64 * src,\r
4962   arm_matrix_instance_f64 * dst);\r
4963 \r
4964 \r
4965 \r
4966   /**\r
4967    * @ingroup groupController\r
4968    */\r
4969 \r
4970   /**\r
4971    * @defgroup clarke Vector Clarke Transform\r
4972    * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.\r
4973    * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents\r
4974    * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.\r
4975    * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below\r
4976    * \image html clarke.gif Stator current space vector and its components in (a,b).\r
4977    * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>\r
4978    * can be calculated using only <code>Ia</code> and <code>Ib</code>.\r
4979    *\r
4980    * The function operates on a single sample of data and each call to the function returns the processed output.\r
4981    * The library provides separate functions for Q31 and floating-point data types.\r
4982    * \par Algorithm\r
4983    * \image html clarkeFormula.gif\r
4984    * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and\r
4985    * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.\r
4986    * \par Fixed-Point Behavior\r
4987    * Care must be taken when using the Q31 version of the Clarke transform.\r
4988    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
4989    * Refer to the function specific documentation below for usage guidelines.\r
4990    */\r
4991 \r
4992   /**\r
4993    * @addtogroup clarke\r
4994    * @{\r
4995    */\r
4996 \r
4997   /**\r
4998    *\r
4999    * @brief  Floating-point Clarke transform\r
5000    * @param[in]  Ia       input three-phase coordinate <code>a</code>\r
5001    * @param[in]  Ib       input three-phase coordinate <code>b</code>\r
5002    * @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha\r
5003    * @param[out] pIbeta   points to output two-phase orthogonal vector axis beta\r
5004    * @return        none\r
5005    */\r
5006   __STATIC_FORCEINLINE void arm_clarke_f32(\r
5007   float32_t Ia,\r
5008   float32_t Ib,\r
5009   float32_t * pIalpha,\r
5010   float32_t * pIbeta)\r
5011   {\r
5012     /* Calculate pIalpha using the equation, pIalpha = Ia */\r
5013     *pIalpha = Ia;\r
5014 \r
5015     /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */\r
5016     *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);\r
5017   }\r
5018 \r
5019 \r
5020 /**\r
5021   @brief  Clarke transform for Q31 version\r
5022   @param[in]  Ia       input three-phase coordinate <code>a</code>\r
5023   @param[in]  Ib       input three-phase coordinate <code>b</code>\r
5024   @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha\r
5025   @param[out] pIbeta   points to output two-phase orthogonal vector axis beta\r
5026   @return     none\r
5027 \r
5028   \par Scaling and Overflow Behavior\r
5029          The function is implemented using an internal 32-bit accumulator.\r
5030          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5031          There is saturation on the addition, hence there is no risk of overflow.\r
5032  */\r
5033 __STATIC_FORCEINLINE void arm_clarke_q31(\r
5034   q31_t Ia,\r
5035   q31_t Ib,\r
5036   q31_t * pIalpha,\r
5037   q31_t * pIbeta)\r
5038   {\r
5039     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5040 \r
5041     /* Calculating pIalpha from Ia by equation pIalpha = Ia */\r
5042     *pIalpha = Ia;\r
5043 \r
5044     /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */\r
5045     product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);\r
5046 \r
5047     /* Intermediate product is calculated by (2/sqrt(3) * Ib) */\r
5048     product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);\r
5049 \r
5050     /* pIbeta is calculated by adding the intermediate products */\r
5051     *pIbeta = __QADD(product1, product2);\r
5052   }\r
5053 \r
5054   /**\r
5055    * @} end of clarke group\r
5056    */\r
5057 \r
5058 \r
5059   /**\r
5060    * @ingroup groupController\r
5061    */\r
5062 \r
5063   /**\r
5064    * @defgroup inv_clarke Vector Inverse Clarke Transform\r
5065    * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.\r
5066    *\r
5067    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5068    * The library provides separate functions for Q31 and floating-point data types.\r
5069    * \par Algorithm\r
5070    * \image html clarkeInvFormula.gif\r
5071    * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and\r
5072    * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.\r
5073    * \par Fixed-Point Behavior\r
5074    * Care must be taken when using the Q31 version of the Clarke transform.\r
5075    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5076    * Refer to the function specific documentation below for usage guidelines.\r
5077    */\r
5078 \r
5079   /**\r
5080    * @addtogroup inv_clarke\r
5081    * @{\r
5082    */\r
5083 \r
5084    /**\r
5085    * @brief  Floating-point Inverse Clarke transform\r
5086    * @param[in]  Ialpha  input two-phase orthogonal vector axis alpha\r
5087    * @param[in]  Ibeta   input two-phase orthogonal vector axis beta\r
5088    * @param[out] pIa     points to output three-phase coordinate <code>a</code>\r
5089    * @param[out] pIb     points to output three-phase coordinate <code>b</code>\r
5090    * @return     none\r
5091    */\r
5092   __STATIC_FORCEINLINE void arm_inv_clarke_f32(\r
5093   float32_t Ialpha,\r
5094   float32_t Ibeta,\r
5095   float32_t * pIa,\r
5096   float32_t * pIb)\r
5097   {\r
5098     /* Calculating pIa from Ialpha by equation pIa = Ialpha */\r
5099     *pIa = Ialpha;\r
5100 \r
5101     /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */\r
5102     *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;\r
5103   }\r
5104 \r
5105 \r
5106 /**\r
5107   @brief  Inverse Clarke transform for Q31 version\r
5108   @param[in]  Ialpha  input two-phase orthogonal vector axis alpha\r
5109   @param[in]  Ibeta   input two-phase orthogonal vector axis beta\r
5110   @param[out] pIa     points to output three-phase coordinate <code>a</code>\r
5111   @param[out] pIb     points to output three-phase coordinate <code>b</code>\r
5112   @return     none\r
5113 \r
5114   \par Scaling and Overflow Behavior\r
5115          The function is implemented using an internal 32-bit accumulator.\r
5116          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5117          There is saturation on the subtraction, hence there is no risk of overflow.\r
5118  */\r
5119 __STATIC_FORCEINLINE void arm_inv_clarke_q31(\r
5120   q31_t Ialpha,\r
5121   q31_t Ibeta,\r
5122   q31_t * pIa,\r
5123   q31_t * pIb)\r
5124   {\r
5125     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5126 \r
5127     /* Calculating pIa from Ialpha by equation pIa = Ialpha */\r
5128     *pIa = Ialpha;\r
5129 \r
5130     /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */\r
5131     product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);\r
5132 \r
5133     /* Intermediate product is calculated by (1/sqrt(3) * pIb) */\r
5134     product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);\r
5135 \r
5136     /* pIb is calculated by subtracting the products */\r
5137     *pIb = __QSUB(product2, product1);\r
5138   }\r
5139 \r
5140   /**\r
5141    * @} end of inv_clarke group\r
5142    */\r
5143 \r
5144 \r
5145 \r
5146   /**\r
5147    * @ingroup groupController\r
5148    */\r
5149 \r
5150   /**\r
5151    * @defgroup park Vector Park Transform\r
5152    *\r
5153    * Forward Park transform converts the input two-coordinate vector to flux and torque components.\r
5154    * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents\r
5155    * from the stationary to the moving reference frame and control the spatial relationship between\r
5156    * the stator vector current and rotor flux vector.\r
5157    * If we consider the d axis aligned with the rotor flux, the diagram below shows the\r
5158    * current vector and the relationship from the two reference frames:\r
5159    * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"\r
5160    *\r
5161    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5162    * The library provides separate functions for Q31 and floating-point data types.\r
5163    * \par Algorithm\r
5164    * \image html parkFormula.gif\r
5165    * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,\r
5166    * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the\r
5167    * cosine and sine values of theta (rotor flux position).\r
5168    * \par Fixed-Point Behavior\r
5169    * Care must be taken when using the Q31 version of the Park transform.\r
5170    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5171    * Refer to the function specific documentation below for usage guidelines.\r
5172    */\r
5173 \r
5174   /**\r
5175    * @addtogroup park\r
5176    * @{\r
5177    */\r
5178 \r
5179   /**\r
5180    * @brief Floating-point Park transform\r
5181    * @param[in]  Ialpha  input two-phase vector coordinate alpha\r
5182    * @param[in]  Ibeta   input two-phase vector coordinate beta\r
5183    * @param[out] pId     points to output   rotor reference frame d\r
5184    * @param[out] pIq     points to output   rotor reference frame q\r
5185    * @param[in]  sinVal  sine value of rotation angle theta\r
5186    * @param[in]  cosVal  cosine value of rotation angle theta\r
5187    * @return     none\r
5188    *\r
5189    * The function implements the forward Park transform.\r
5190    *\r
5191    */\r
5192   __STATIC_FORCEINLINE void arm_park_f32(\r
5193   float32_t Ialpha,\r
5194   float32_t Ibeta,\r
5195   float32_t * pId,\r
5196   float32_t * pIq,\r
5197   float32_t sinVal,\r
5198   float32_t cosVal)\r
5199   {\r
5200     /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */\r
5201     *pId = Ialpha * cosVal + Ibeta * sinVal;\r
5202 \r
5203     /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */\r
5204     *pIq = -Ialpha * sinVal + Ibeta * cosVal;\r
5205   }\r
5206 \r
5207 \r
5208 /**\r
5209   @brief  Park transform for Q31 version\r
5210   @param[in]  Ialpha  input two-phase vector coordinate alpha\r
5211   @param[in]  Ibeta   input two-phase vector coordinate beta\r
5212   @param[out] pId     points to output rotor reference frame d\r
5213   @param[out] pIq     points to output rotor reference frame q\r
5214   @param[in]  sinVal  sine value of rotation angle theta\r
5215   @param[in]  cosVal  cosine value of rotation angle theta\r
5216   @return     none\r
5217 \r
5218   \par Scaling and Overflow Behavior\r
5219          The function is implemented using an internal 32-bit accumulator.\r
5220          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5221          There is saturation on the addition and subtraction, hence there is no risk of overflow.\r
5222  */\r
5223 __STATIC_FORCEINLINE void arm_park_q31(\r
5224   q31_t Ialpha,\r
5225   q31_t Ibeta,\r
5226   q31_t * pId,\r
5227   q31_t * pIq,\r
5228   q31_t sinVal,\r
5229   q31_t cosVal)\r
5230   {\r
5231     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5232     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */\r
5233 \r
5234     /* Intermediate product is calculated by (Ialpha * cosVal) */\r
5235     product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);\r
5236 \r
5237     /* Intermediate product is calculated by (Ibeta * sinVal) */\r
5238     product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);\r
5239 \r
5240 \r
5241     /* Intermediate product is calculated by (Ialpha * sinVal) */\r
5242     product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);\r
5243 \r
5244     /* Intermediate product is calculated by (Ibeta * cosVal) */\r
5245     product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);\r
5246 \r
5247     /* Calculate pId by adding the two intermediate products 1 and 2 */\r
5248     *pId = __QADD(product1, product2);\r
5249 \r
5250     /* Calculate pIq by subtracting the two intermediate products 3 from 4 */\r
5251     *pIq = __QSUB(product4, product3);\r
5252   }\r
5253 \r
5254   /**\r
5255    * @} end of park group\r
5256    */\r
5257 \r
5258 \r
5259   /**\r
5260    * @ingroup groupController\r
5261    */\r
5262 \r
5263   /**\r
5264    * @defgroup inv_park Vector Inverse Park transform\r
5265    * Inverse Park transform converts the input flux and torque components to two-coordinate vector.\r
5266    *\r
5267    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5268    * The library provides separate functions for Q31 and floating-point data types.\r
5269    * \par Algorithm\r
5270    * \image html parkInvFormula.gif\r
5271    * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,\r
5272    * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the\r
5273    * cosine and sine values of theta (rotor flux position).\r
5274    * \par Fixed-Point Behavior\r
5275    * Care must be taken when using the Q31 version of the Park transform.\r
5276    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5277    * Refer to the function specific documentation below for usage guidelines.\r
5278    */\r
5279 \r
5280   /**\r
5281    * @addtogroup inv_park\r
5282    * @{\r
5283    */\r
5284 \r
5285    /**\r
5286    * @brief  Floating-point Inverse Park transform\r
5287    * @param[in]  Id       input coordinate of rotor reference frame d\r
5288    * @param[in]  Iq       input coordinate of rotor reference frame q\r
5289    * @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha\r
5290    * @param[out] pIbeta   points to output two-phase orthogonal vector axis beta\r
5291    * @param[in]  sinVal   sine value of rotation angle theta\r
5292    * @param[in]  cosVal   cosine value of rotation angle theta\r
5293    * @return     none\r
5294    */\r
5295   __STATIC_FORCEINLINE void arm_inv_park_f32(\r
5296   float32_t Id,\r
5297   float32_t Iq,\r
5298   float32_t * pIalpha,\r
5299   float32_t * pIbeta,\r
5300   float32_t sinVal,\r
5301   float32_t cosVal)\r
5302   {\r
5303     /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */\r
5304     *pIalpha = Id * cosVal - Iq * sinVal;\r
5305 \r
5306     /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */\r
5307     *pIbeta = Id * sinVal + Iq * cosVal;\r
5308   }\r
5309 \r
5310 \r
5311 /**\r
5312   @brief  Inverse Park transform for   Q31 version\r
5313   @param[in]  Id       input coordinate of rotor reference frame d\r
5314   @param[in]  Iq       input coordinate of rotor reference frame q\r
5315   @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha\r
5316   @param[out] pIbeta   points to output two-phase orthogonal vector axis beta\r
5317   @param[in]  sinVal   sine value of rotation angle theta\r
5318   @param[in]  cosVal   cosine value of rotation angle theta\r
5319   @return     none\r
5320 \r
5321   @par Scaling and Overflow Behavior\r
5322          The function is implemented using an internal 32-bit accumulator.\r
5323          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5324          There is saturation on the addition, hence there is no risk of overflow.\r
5325  */\r
5326 __STATIC_FORCEINLINE void arm_inv_park_q31(\r
5327   q31_t Id,\r
5328   q31_t Iq,\r
5329   q31_t * pIalpha,\r
5330   q31_t * pIbeta,\r
5331   q31_t sinVal,\r
5332   q31_t cosVal)\r
5333   {\r
5334     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5335     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */\r
5336 \r
5337     /* Intermediate product is calculated by (Id * cosVal) */\r
5338     product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);\r
5339 \r
5340     /* Intermediate product is calculated by (Iq * sinVal) */\r
5341     product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);\r
5342 \r
5343 \r
5344     /* Intermediate product is calculated by (Id * sinVal) */\r
5345     product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);\r
5346 \r
5347     /* Intermediate product is calculated by (Iq * cosVal) */\r
5348     product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);\r
5349 \r
5350     /* Calculate pIalpha by using the two intermediate products 1 and 2 */\r
5351     *pIalpha = __QSUB(product1, product2);\r
5352 \r
5353     /* Calculate pIbeta by using the two intermediate products 3 and 4 */\r
5354     *pIbeta = __QADD(product4, product3);\r
5355   }\r
5356 \r
5357   /**\r
5358    * @} end of Inverse park group\r
5359    */\r
5360 \r
5361 \r
5362   /**\r
5363    * @ingroup groupInterpolation\r
5364    */\r
5365 \r
5366   /**\r
5367    * @defgroup LinearInterpolate Linear Interpolation\r
5368    *\r
5369    * Linear interpolation is a method of curve fitting using linear polynomials.\r
5370    * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line\r
5371    *\r
5372    * \par\r
5373    * \image html LinearInterp.gif "Linear interpolation"\r
5374    *\r
5375    * \par\r
5376    * A  Linear Interpolate function calculates an output value(y), for the input(x)\r
5377    * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)\r
5378    *\r
5379    * \par Algorithm:\r
5380    * <pre>\r
5381    *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))\r
5382    *       where x0, x1 are nearest values of input x\r
5383    *             y0, y1 are nearest values to output y\r
5384    * </pre>\r
5385    *\r
5386    * \par\r
5387    * This set of functions implements Linear interpolation process\r
5388    * for Q7, Q15, Q31, and floating-point data types.  The functions operate on a single\r
5389    * sample of data and each call to the function returns a single processed value.\r
5390    * <code>S</code> points to an instance of the Linear Interpolate function data structure.\r
5391    * <code>x</code> is the input sample value. The functions returns the output value.\r
5392    *\r
5393    * \par\r
5394    * if x is outside of the table boundary, Linear interpolation returns first value of the table\r
5395    * if x is below input range and returns last value of table if x is above range.\r
5396    */\r
5397 \r
5398   /**\r
5399    * @addtogroup LinearInterpolate\r
5400    * @{\r
5401    */\r
5402 \r
5403   /**\r
5404    * @brief  Process function for the floating-point Linear Interpolation Function.\r
5405    * @param[in,out] S  is an instance of the floating-point Linear Interpolation structure\r
5406    * @param[in]     x  input sample to process\r
5407    * @return y processed output sample.\r
5408    *\r
5409    */\r
5410   __STATIC_FORCEINLINE float32_t arm_linear_interp_f32(\r
5411   arm_linear_interp_instance_f32 * S,\r
5412   float32_t x)\r
5413   {\r
5414     float32_t y;\r
5415     float32_t x0, x1;                            /* Nearest input values */\r
5416     float32_t y0, y1;                            /* Nearest output values */\r
5417     float32_t xSpacing = S->xSpacing;            /* spacing between input values */\r
5418     int32_t i;                                   /* Index variable */\r
5419     float32_t *pYData = S->pYData;               /* pointer to output table */\r
5420 \r
5421     /* Calculation of index */\r
5422     i = (int32_t) ((x - S->x1) / xSpacing);\r
5423 \r
5424     if (i < 0)\r
5425     {\r
5426       /* Iniatilize output for below specified range as least output value of table */\r
5427       y = pYData[0];\r
5428     }\r
5429     else if ((uint32_t)i >= S->nValues)\r
5430     {\r
5431       /* Iniatilize output for above specified range as last output value of table */\r
5432       y = pYData[S->nValues - 1];\r
5433     }\r
5434     else\r
5435     {\r
5436       /* Calculation of nearest input values */\r
5437       x0 = S->x1 +  i      * xSpacing;\r
5438       x1 = S->x1 + (i + 1) * xSpacing;\r
5439 \r
5440       /* Read of nearest output values */\r
5441       y0 = pYData[i];\r
5442       y1 = pYData[i + 1];\r
5443 \r
5444       /* Calculation of output */\r
5445       y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));\r
5446 \r
5447     }\r
5448 \r
5449     /* returns output value */\r
5450     return (y);\r
5451   }\r
5452 \r
5453 \r
5454    /**\r
5455    *\r
5456    * @brief  Process function for the Q31 Linear Interpolation Function.\r
5457    * @param[in] pYData   pointer to Q31 Linear Interpolation table\r
5458    * @param[in] x        input sample to process\r
5459    * @param[in] nValues  number of table values\r
5460    * @return y processed output sample.\r
5461    *\r
5462    * \par\r
5463    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.\r
5464    * This function can support maximum of table size 2^12.\r
5465    *\r
5466    */\r
5467   __STATIC_FORCEINLINE q31_t arm_linear_interp_q31(\r
5468   q31_t * pYData,\r
5469   q31_t x,\r
5470   uint32_t nValues)\r
5471   {\r
5472     q31_t y;                                     /* output */\r
5473     q31_t y0, y1;                                /* Nearest output values */\r
5474     q31_t fract;                                 /* fractional part */\r
5475     int32_t index;                               /* Index to read nearest output values */\r
5476 \r
5477     /* Input is in 12.20 format */\r
5478     /* 12 bits for the table index */\r
5479     /* Index value calculation */\r
5480     index = ((x & (q31_t)0xFFF00000) >> 20);\r
5481 \r
5482     if (index >= (int32_t)(nValues - 1))\r
5483     {\r
5484       return (pYData[nValues - 1]);\r
5485     }\r
5486     else if (index < 0)\r
5487     {\r
5488       return (pYData[0]);\r
5489     }\r
5490     else\r
5491     {\r
5492       /* 20 bits for the fractional part */\r
5493       /* shift left by 11 to keep fract in 1.31 format */\r
5494       fract = (x & 0x000FFFFF) << 11;\r
5495 \r
5496       /* Read two nearest output values from the index in 1.31(q31) format */\r
5497       y0 = pYData[index];\r
5498       y1 = pYData[index + 1];\r
5499 \r
5500       /* Calculation of y0 * (1-fract) and y is in 2.30 format */\r
5501       y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));\r
5502 \r
5503       /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */\r
5504       y += ((q31_t) (((q63_t) y1 * fract) >> 32));\r
5505 \r
5506       /* Convert y to 1.31 format */\r
5507       return (y << 1U);\r
5508     }\r
5509   }\r
5510 \r
5511 \r
5512   /**\r
5513    *\r
5514    * @brief  Process function for the Q15 Linear Interpolation Function.\r
5515    * @param[in] pYData   pointer to Q15 Linear Interpolation table\r
5516    * @param[in] x        input sample to process\r
5517    * @param[in] nValues  number of table values\r
5518    * @return y processed output sample.\r
5519    *\r
5520    * \par\r
5521    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.\r
5522    * This function can support maximum of table size 2^12.\r
5523    *\r
5524    */\r
5525   __STATIC_FORCEINLINE q15_t arm_linear_interp_q15(\r
5526   q15_t * pYData,\r
5527   q31_t x,\r
5528   uint32_t nValues)\r
5529   {\r
5530     q63_t y;                                     /* output */\r
5531     q15_t y0, y1;                                /* Nearest output values */\r
5532     q31_t fract;                                 /* fractional part */\r
5533     int32_t index;                               /* Index to read nearest output values */\r
5534 \r
5535     /* Input is in 12.20 format */\r
5536     /* 12 bits for the table index */\r
5537     /* Index value calculation */\r
5538     index = ((x & (int32_t)0xFFF00000) >> 20);\r
5539 \r
5540     if (index >= (int32_t)(nValues - 1))\r
5541     {\r
5542       return (pYData[nValues - 1]);\r
5543     }\r
5544     else if (index < 0)\r
5545     {\r
5546       return (pYData[0]);\r
5547     }\r
5548     else\r
5549     {\r
5550       /* 20 bits for the fractional part */\r
5551       /* fract is in 12.20 format */\r
5552       fract = (x & 0x000FFFFF);\r
5553 \r
5554       /* Read two nearest output values from the index */\r
5555       y0 = pYData[index];\r
5556       y1 = pYData[index + 1];\r
5557 \r
5558       /* Calculation of y0 * (1-fract) and y is in 13.35 format */\r
5559       y = ((q63_t) y0 * (0xFFFFF - fract));\r
5560 \r
5561       /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */\r
5562       y += ((q63_t) y1 * (fract));\r
5563 \r
5564       /* convert y to 1.15 format */\r
5565       return (q15_t) (y >> 20);\r
5566     }\r
5567   }\r
5568 \r
5569 \r
5570   /**\r
5571    *\r
5572    * @brief  Process function for the Q7 Linear Interpolation Function.\r
5573    * @param[in] pYData   pointer to Q7 Linear Interpolation table\r
5574    * @param[in] x        input sample to process\r
5575    * @param[in] nValues  number of table values\r
5576    * @return y processed output sample.\r
5577    *\r
5578    * \par\r
5579    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.\r
5580    * This function can support maximum of table size 2^12.\r
5581    */\r
5582   __STATIC_FORCEINLINE q7_t arm_linear_interp_q7(\r
5583   q7_t * pYData,\r
5584   q31_t x,\r
5585   uint32_t nValues)\r
5586   {\r
5587     q31_t y;                                     /* output */\r
5588     q7_t y0, y1;                                 /* Nearest output values */\r
5589     q31_t fract;                                 /* fractional part */\r
5590     uint32_t index;                              /* Index to read nearest output values */\r
5591 \r
5592     /* Input is in 12.20 format */\r
5593     /* 12 bits for the table index */\r
5594     /* Index value calculation */\r
5595     if (x < 0)\r
5596     {\r
5597       return (pYData[0]);\r
5598     }\r
5599     index = (x >> 20) & 0xfff;\r
5600 \r
5601     if (index >= (nValues - 1))\r
5602     {\r
5603       return (pYData[nValues - 1]);\r
5604     }\r
5605     else\r
5606     {\r
5607       /* 20 bits for the fractional part */\r
5608       /* fract is in 12.20 format */\r
5609       fract = (x & 0x000FFFFF);\r
5610 \r
5611       /* Read two nearest output values from the index and are in 1.7(q7) format */\r
5612       y0 = pYData[index];\r
5613       y1 = pYData[index + 1];\r
5614 \r
5615       /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */\r
5616       y = ((y0 * (0xFFFFF - fract)));\r
5617 \r
5618       /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */\r
5619       y += (y1 * fract);\r
5620 \r
5621       /* convert y to 1.7(q7) format */\r
5622       return (q7_t) (y >> 20);\r
5623      }\r
5624   }\r
5625 \r
5626   /**\r
5627    * @} end of LinearInterpolate group\r
5628    */\r
5629 \r
5630   /**\r
5631    * @brief  Fast approximation to the trigonometric sine function for floating-point data.\r
5632    * @param[in] x  input value in radians.\r
5633    * @return  sin(x).\r
5634    */\r
5635   float32_t arm_sin_f32(\r
5636   float32_t x);\r
5637 \r
5638 \r
5639   /**\r
5640    * @brief  Fast approximation to the trigonometric sine function for Q31 data.\r
5641    * @param[in] x  Scaled input value in radians.\r
5642    * @return  sin(x).\r
5643    */\r
5644   q31_t arm_sin_q31(\r
5645   q31_t x);\r
5646 \r
5647 \r
5648   /**\r
5649    * @brief  Fast approximation to the trigonometric sine function for Q15 data.\r
5650    * @param[in] x  Scaled input value in radians.\r
5651    * @return  sin(x).\r
5652    */\r
5653   q15_t arm_sin_q15(\r
5654   q15_t x);\r
5655 \r
5656 \r
5657   /**\r
5658    * @brief  Fast approximation to the trigonometric cosine function for floating-point data.\r
5659    * @param[in] x  input value in radians.\r
5660    * @return  cos(x).\r
5661    */\r
5662   float32_t arm_cos_f32(\r
5663   float32_t x);\r
5664 \r
5665 \r
5666   /**\r
5667    * @brief Fast approximation to the trigonometric cosine function for Q31 data.\r
5668    * @param[in] x  Scaled input value in radians.\r
5669    * @return  cos(x).\r
5670    */\r
5671   q31_t arm_cos_q31(\r
5672   q31_t x);\r
5673 \r
5674 \r
5675   /**\r
5676    * @brief  Fast approximation to the trigonometric cosine function for Q15 data.\r
5677    * @param[in] x  Scaled input value in radians.\r
5678    * @return  cos(x).\r
5679    */\r
5680   q15_t arm_cos_q15(\r
5681   q15_t x);\r
5682 \r
5683 \r
5684   /**\r
5685    * @ingroup groupFastMath\r
5686    */\r
5687 \r
5688 \r
5689   /**\r
5690    * @defgroup SQRT Square Root\r
5691    *\r
5692    * Computes the square root of a number.\r
5693    * There are separate functions for Q15, Q31, and floating-point data types.\r
5694    * The square root function is computed using the Newton-Raphson algorithm.\r
5695    * This is an iterative algorithm of the form:\r
5696    * <pre>\r
5697    *      x1 = x0 - f(x0)/f'(x0)\r
5698    * </pre>\r
5699    * where <code>x1</code> is the current estimate,\r
5700    * <code>x0</code> is the previous estimate, and\r
5701    * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.\r
5702    * For the square root function, the algorithm reduces to:\r
5703    * <pre>\r
5704    *     x0 = in/2                         [initial guess]\r
5705    *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]\r
5706    * </pre>\r
5707    */\r
5708 \r
5709 \r
5710   /**\r
5711    * @addtogroup SQRT\r
5712    * @{\r
5713    */\r
5714 \r
5715 /**\r
5716   @brief         Floating-point square root function.\r
5717   @param[in]     in    input value\r
5718   @param[out]    pOut  square root of input value\r
5719   @return        execution status\r
5720                    - \ref ARM_MATH_SUCCESS        : input value is positive\r
5721                    - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0\r
5722  */\r
5723 __STATIC_FORCEINLINE arm_status arm_sqrt_f32(\r
5724   float32_t in,\r
5725   float32_t * pOut)\r
5726   {\r
5727     if (in >= 0.0f)\r
5728     {\r
5729 #if defined ( __CC_ARM )\r
5730   #if defined __TARGET_FPU_VFP\r
5731       *pOut = __sqrtf(in);\r
5732   #else\r
5733       *pOut = sqrtf(in);\r
5734   #endif\r
5735 \r
5736 #elif defined ( __ICCARM__ )\r
5737   #if defined __ARMVFP__\r
5738       __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));\r
5739   #else\r
5740       *pOut = sqrtf(in);\r
5741   #endif\r
5742 \r
5743 #else\r
5744       *pOut = sqrtf(in);\r
5745 #endif\r
5746 \r
5747       return (ARM_MATH_SUCCESS);\r
5748     }\r
5749     else\r
5750     {\r
5751       *pOut = 0.0f;\r
5752       return (ARM_MATH_ARGUMENT_ERROR);\r
5753     }\r
5754   }\r
5755 \r
5756 \r
5757 /**\r
5758   @brief         Q31 square root function.\r
5759   @param[in]     in    input value.  The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF\r
5760   @param[out]    pOut  points to square root of input value\r
5761   @return        execution status\r
5762                    - \ref ARM_MATH_SUCCESS        : input value is positive\r
5763                    - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0\r
5764  */\r
5765 arm_status arm_sqrt_q31(\r
5766   q31_t in,\r
5767   q31_t * pOut);\r
5768 \r
5769 \r
5770 /**\r
5771   @brief         Q15 square root function.\r
5772   @param[in]     in    input value.  The range of the input value is [0 +1) or 0x0000 to 0x7FFF\r
5773   @param[out]    pOut  points to square root of input value\r
5774   @return        execution status\r
5775                    - \ref ARM_MATH_SUCCESS        : input value is positive\r
5776                    - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0\r
5777  */\r
5778 arm_status arm_sqrt_q15(\r
5779   q15_t in,\r
5780   q15_t * pOut);\r
5781 \r
5782   /**\r
5783    * @} end of SQRT group\r
5784    */\r
5785 \r
5786 \r
5787   /**\r
5788    * @brief floating-point Circular write function.\r
5789    */\r
5790   __STATIC_FORCEINLINE void arm_circularWrite_f32(\r
5791   int32_t * circBuffer,\r
5792   int32_t L,\r
5793   uint16_t * writeOffset,\r
5794   int32_t bufferInc,\r
5795   const int32_t * src,\r
5796   int32_t srcInc,\r
5797   uint32_t blockSize)\r
5798   {\r
5799     uint32_t i = 0U;\r
5800     int32_t wOffset;\r
5801 \r
5802     /* Copy the value of Index pointer that points\r
5803      * to the current location where the input samples to be copied */\r
5804     wOffset = *writeOffset;\r
5805 \r
5806     /* Loop over the blockSize */\r
5807     i = blockSize;\r
5808 \r
5809     while (i > 0U)\r
5810     {\r
5811       /* copy the input sample to the circular buffer */\r
5812       circBuffer[wOffset] = *src;\r
5813 \r
5814       /* Update the input pointer */\r
5815       src += srcInc;\r
5816 \r
5817       /* Circularly update wOffset.  Watch out for positive and negative value */\r
5818       wOffset += bufferInc;\r
5819       if (wOffset >= L)\r
5820         wOffset -= L;\r
5821 \r
5822       /* Decrement the loop counter */\r
5823       i--;\r
5824     }\r
5825 \r
5826     /* Update the index pointer */\r
5827     *writeOffset = (uint16_t)wOffset;\r
5828   }\r
5829 \r
5830 \r
5831 \r
5832   /**\r
5833    * @brief floating-point Circular Read function.\r
5834    */\r
5835   __STATIC_FORCEINLINE void arm_circularRead_f32(\r
5836   int32_t * circBuffer,\r
5837   int32_t L,\r
5838   int32_t * readOffset,\r
5839   int32_t bufferInc,\r
5840   int32_t * dst,\r
5841   int32_t * dst_base,\r
5842   int32_t dst_length,\r
5843   int32_t dstInc,\r
5844   uint32_t blockSize)\r
5845   {\r
5846     uint32_t i = 0U;\r
5847     int32_t rOffset;\r
5848     int32_t* dst_end;\r
5849 \r
5850     /* Copy the value of Index pointer that points\r
5851      * to the current location from where the input samples to be read */\r
5852     rOffset = *readOffset;\r
5853     dst_end = dst_base + dst_length;\r
5854 \r
5855     /* Loop over the blockSize */\r
5856     i = blockSize;\r
5857 \r
5858     while (i > 0U)\r
5859     {\r
5860       /* copy the sample from the circular buffer to the destination buffer */\r
5861       *dst = circBuffer[rOffset];\r
5862 \r
5863       /* Update the input pointer */\r
5864       dst += dstInc;\r
5865 \r
5866       if (dst == dst_end)\r
5867       {\r
5868         dst = dst_base;\r
5869       }\r
5870 \r
5871       /* Circularly update rOffset.  Watch out for positive and negative value  */\r
5872       rOffset += bufferInc;\r
5873 \r
5874       if (rOffset >= L)\r
5875       {\r
5876         rOffset -= L;\r
5877       }\r
5878 \r
5879       /* Decrement the loop counter */\r
5880       i--;\r
5881     }\r
5882 \r
5883     /* Update the index pointer */\r
5884     *readOffset = rOffset;\r
5885   }\r
5886 \r
5887 \r
5888   /**\r
5889    * @brief Q15 Circular write function.\r
5890    */\r
5891   __STATIC_FORCEINLINE void arm_circularWrite_q15(\r
5892   q15_t * circBuffer,\r
5893   int32_t L,\r
5894   uint16_t * writeOffset,\r
5895   int32_t bufferInc,\r
5896   const q15_t * src,\r
5897   int32_t srcInc,\r
5898   uint32_t blockSize)\r
5899   {\r
5900     uint32_t i = 0U;\r
5901     int32_t wOffset;\r
5902 \r
5903     /* Copy the value of Index pointer that points\r
5904      * to the current location where the input samples to be copied */\r
5905     wOffset = *writeOffset;\r
5906 \r
5907     /* Loop over the blockSize */\r
5908     i = blockSize;\r
5909 \r
5910     while (i > 0U)\r
5911     {\r
5912       /* copy the input sample to the circular buffer */\r
5913       circBuffer[wOffset] = *src;\r
5914 \r
5915       /* Update the input pointer */\r
5916       src += srcInc;\r
5917 \r
5918       /* Circularly update wOffset.  Watch out for positive and negative value */\r
5919       wOffset += bufferInc;\r
5920       if (wOffset >= L)\r
5921         wOffset -= L;\r
5922 \r
5923       /* Decrement the loop counter */\r
5924       i--;\r
5925     }\r
5926 \r
5927     /* Update the index pointer */\r
5928     *writeOffset = (uint16_t)wOffset;\r
5929   }\r
5930 \r
5931 \r
5932   /**\r
5933    * @brief Q15 Circular Read function.\r
5934    */\r
5935   __STATIC_FORCEINLINE void arm_circularRead_q15(\r
5936   q15_t * circBuffer,\r
5937   int32_t L,\r
5938   int32_t * readOffset,\r
5939   int32_t bufferInc,\r
5940   q15_t * dst,\r
5941   q15_t * dst_base,\r
5942   int32_t dst_length,\r
5943   int32_t dstInc,\r
5944   uint32_t blockSize)\r
5945   {\r
5946     uint32_t i = 0;\r
5947     int32_t rOffset;\r
5948     q15_t* dst_end;\r
5949 \r
5950     /* Copy the value of Index pointer that points\r
5951      * to the current location from where the input samples to be read */\r
5952     rOffset = *readOffset;\r
5953 \r
5954     dst_end = dst_base + dst_length;\r
5955 \r
5956     /* Loop over the blockSize */\r
5957     i = blockSize;\r
5958 \r
5959     while (i > 0U)\r
5960     {\r
5961       /* copy the sample from the circular buffer to the destination buffer */\r
5962       *dst = circBuffer[rOffset];\r
5963 \r
5964       /* Update the input pointer */\r
5965       dst += dstInc;\r
5966 \r
5967       if (dst == dst_end)\r
5968       {\r
5969         dst = dst_base;\r
5970       }\r
5971 \r
5972       /* Circularly update wOffset.  Watch out for positive and negative value */\r
5973       rOffset += bufferInc;\r
5974 \r
5975       if (rOffset >= L)\r
5976       {\r
5977         rOffset -= L;\r
5978       }\r
5979 \r
5980       /* Decrement the loop counter */\r
5981       i--;\r
5982     }\r
5983 \r
5984     /* Update the index pointer */\r
5985     *readOffset = rOffset;\r
5986   }\r
5987 \r
5988 \r
5989   /**\r
5990    * @brief Q7 Circular write function.\r
5991    */\r
5992   __STATIC_FORCEINLINE void arm_circularWrite_q7(\r
5993   q7_t * circBuffer,\r
5994   int32_t L,\r
5995   uint16_t * writeOffset,\r
5996   int32_t bufferInc,\r
5997   const q7_t * src,\r
5998   int32_t srcInc,\r
5999   uint32_t blockSize)\r
6000   {\r
6001     uint32_t i = 0U;\r
6002     int32_t wOffset;\r
6003 \r
6004     /* Copy the value of Index pointer that points\r
6005      * to the current location where the input samples to be copied */\r
6006     wOffset = *writeOffset;\r
6007 \r
6008     /* Loop over the blockSize */\r
6009     i = blockSize;\r
6010 \r
6011     while (i > 0U)\r
6012     {\r
6013       /* copy the input sample to the circular buffer */\r
6014       circBuffer[wOffset] = *src;\r
6015 \r
6016       /* Update the input pointer */\r
6017       src += srcInc;\r
6018 \r
6019       /* Circularly update wOffset.  Watch out for positive and negative value */\r
6020       wOffset += bufferInc;\r
6021       if (wOffset >= L)\r
6022         wOffset -= L;\r
6023 \r
6024       /* Decrement the loop counter */\r
6025       i--;\r
6026     }\r
6027 \r
6028     /* Update the index pointer */\r
6029     *writeOffset = (uint16_t)wOffset;\r
6030   }\r
6031 \r
6032 \r
6033   /**\r
6034    * @brief Q7 Circular Read function.\r
6035    */\r
6036   __STATIC_FORCEINLINE void arm_circularRead_q7(\r
6037   q7_t * circBuffer,\r
6038   int32_t L,\r
6039   int32_t * readOffset,\r
6040   int32_t bufferInc,\r
6041   q7_t * dst,\r
6042   q7_t * dst_base,\r
6043   int32_t dst_length,\r
6044   int32_t dstInc,\r
6045   uint32_t blockSize)\r
6046   {\r
6047     uint32_t i = 0;\r
6048     int32_t rOffset;\r
6049     q7_t* dst_end;\r
6050 \r
6051     /* Copy the value of Index pointer that points\r
6052      * to the current location from where the input samples to be read */\r
6053     rOffset = *readOffset;\r
6054 \r
6055     dst_end = dst_base + dst_length;\r
6056 \r
6057     /* Loop over the blockSize */\r
6058     i = blockSize;\r
6059 \r
6060     while (i > 0U)\r
6061     {\r
6062       /* copy the sample from the circular buffer to the destination buffer */\r
6063       *dst = circBuffer[rOffset];\r
6064 \r
6065       /* Update the input pointer */\r
6066       dst += dstInc;\r
6067 \r
6068       if (dst == dst_end)\r
6069       {\r
6070         dst = dst_base;\r
6071       }\r
6072 \r
6073       /* Circularly update rOffset.  Watch out for positive and negative value */\r
6074       rOffset += bufferInc;\r
6075 \r
6076       if (rOffset >= L)\r
6077       {\r
6078         rOffset -= L;\r
6079       }\r
6080 \r
6081       /* Decrement the loop counter */\r
6082       i--;\r
6083     }\r
6084 \r
6085     /* Update the index pointer */\r
6086     *readOffset = rOffset;\r
6087   }\r
6088 \r
6089 \r
6090   /**\r
6091    * @brief  Sum of the squares of the elements of a Q31 vector.\r
6092    * @param[in]  pSrc       is input pointer\r
6093    * @param[in]  blockSize  is the number of samples to process\r
6094    * @param[out] pResult    is output value.\r
6095    */\r
6096   void arm_power_q31(\r
6097   const q31_t * pSrc,\r
6098         uint32_t blockSize,\r
6099         q63_t * pResult);\r
6100 \r
6101 \r
6102   /**\r
6103    * @brief  Sum of the squares of the elements of a floating-point vector.\r
6104    * @param[in]  pSrc       is input pointer\r
6105    * @param[in]  blockSize  is the number of samples to process\r
6106    * @param[out] pResult    is output value.\r
6107    */\r
6108   void arm_power_f32(\r
6109   const float32_t * pSrc,\r
6110         uint32_t blockSize,\r
6111         float32_t * pResult);\r
6112 \r
6113 \r
6114   /**\r
6115    * @brief  Sum of the squares of the elements of a Q15 vector.\r
6116    * @param[in]  pSrc       is input pointer\r
6117    * @param[in]  blockSize  is the number of samples to process\r
6118    * @param[out] pResult    is output value.\r
6119    */\r
6120   void arm_power_q15(\r
6121   const q15_t * pSrc,\r
6122         uint32_t blockSize,\r
6123         q63_t * pResult);\r
6124 \r
6125 \r
6126   /**\r
6127    * @brief  Sum of the squares of the elements of a Q7 vector.\r
6128    * @param[in]  pSrc       is input pointer\r
6129    * @param[in]  blockSize  is the number of samples to process\r
6130    * @param[out] pResult    is output value.\r
6131    */\r
6132   void arm_power_q7(\r
6133   const q7_t * pSrc,\r
6134         uint32_t blockSize,\r
6135         q31_t * pResult);\r
6136 \r
6137 \r
6138   /**\r
6139    * @brief  Mean value of a Q7 vector.\r
6140    * @param[in]  pSrc       is input pointer\r
6141    * @param[in]  blockSize  is the number of samples to process\r
6142    * @param[out] pResult    is output value.\r
6143    */\r
6144   void arm_mean_q7(\r
6145   const q7_t * pSrc,\r
6146         uint32_t blockSize,\r
6147         q7_t * pResult);\r
6148 \r
6149 \r
6150   /**\r
6151    * @brief  Mean value of a Q15 vector.\r
6152    * @param[in]  pSrc       is input pointer\r
6153    * @param[in]  blockSize  is the number of samples to process\r
6154    * @param[out] pResult    is output value.\r
6155    */\r
6156   void arm_mean_q15(\r
6157   const q15_t * pSrc,\r
6158         uint32_t blockSize,\r
6159         q15_t * pResult);\r
6160 \r
6161 \r
6162   /**\r
6163    * @brief  Mean value of a Q31 vector.\r
6164    * @param[in]  pSrc       is input pointer\r
6165    * @param[in]  blockSize  is the number of samples to process\r
6166    * @param[out] pResult    is output value.\r
6167    */\r
6168   void arm_mean_q31(\r
6169   const q31_t * pSrc,\r
6170         uint32_t blockSize,\r
6171         q31_t * pResult);\r
6172 \r
6173 \r
6174   /**\r
6175    * @brief  Mean value of a floating-point vector.\r
6176    * @param[in]  pSrc       is input pointer\r
6177    * @param[in]  blockSize  is the number of samples to process\r
6178    * @param[out] pResult    is output value.\r
6179    */\r
6180   void arm_mean_f32(\r
6181   const float32_t * pSrc,\r
6182         uint32_t blockSize,\r
6183         float32_t * pResult);\r
6184 \r
6185 \r
6186   /**\r
6187    * @brief  Variance of the elements of a floating-point vector.\r
6188    * @param[in]  pSrc       is input pointer\r
6189    * @param[in]  blockSize  is the number of samples to process\r
6190    * @param[out] pResult    is output value.\r
6191    */\r
6192   void arm_var_f32(\r
6193   const float32_t * pSrc,\r
6194         uint32_t blockSize,\r
6195         float32_t * pResult);\r
6196 \r
6197 \r
6198   /**\r
6199    * @brief  Variance of the elements of a Q31 vector.\r
6200    * @param[in]  pSrc       is input pointer\r
6201    * @param[in]  blockSize  is the number of samples to process\r
6202    * @param[out] pResult    is output value.\r
6203    */\r
6204   void arm_var_q31(\r
6205   const q31_t * pSrc,\r
6206         uint32_t blockSize,\r
6207         q31_t * pResult);\r
6208 \r
6209 \r
6210   /**\r
6211    * @brief  Variance of the elements of a Q15 vector.\r
6212    * @param[in]  pSrc       is input pointer\r
6213    * @param[in]  blockSize  is the number of samples to process\r
6214    * @param[out] pResult    is output value.\r
6215    */\r
6216   void arm_var_q15(\r
6217   const q15_t * pSrc,\r
6218         uint32_t blockSize,\r
6219         q15_t * pResult);\r
6220 \r
6221 \r
6222   /**\r
6223    * @brief  Root Mean Square of the elements of a floating-point vector.\r
6224    * @param[in]  pSrc       is input pointer\r
6225    * @param[in]  blockSize  is the number of samples to process\r
6226    * @param[out] pResult    is output value.\r
6227    */\r
6228   void arm_rms_f32(\r
6229   const float32_t * pSrc,\r
6230         uint32_t blockSize,\r
6231         float32_t * pResult);\r
6232 \r
6233 \r
6234   /**\r
6235    * @brief  Root Mean Square of the elements of a Q31 vector.\r
6236    * @param[in]  pSrc       is input pointer\r
6237    * @param[in]  blockSize  is the number of samples to process\r
6238    * @param[out] pResult    is output value.\r
6239    */\r
6240   void arm_rms_q31(\r
6241   const q31_t * pSrc,\r
6242         uint32_t blockSize,\r
6243         q31_t * pResult);\r
6244 \r
6245 \r
6246   /**\r
6247    * @brief  Root Mean Square of the elements of a Q15 vector.\r
6248    * @param[in]  pSrc       is input pointer\r
6249    * @param[in]  blockSize  is the number of samples to process\r
6250    * @param[out] pResult    is output value.\r
6251    */\r
6252   void arm_rms_q15(\r
6253   const q15_t * pSrc,\r
6254         uint32_t blockSize,\r
6255         q15_t * pResult);\r
6256 \r
6257 \r
6258   /**\r
6259    * @brief  Standard deviation of the elements of a floating-point vector.\r
6260    * @param[in]  pSrc       is input pointer\r
6261    * @param[in]  blockSize  is the number of samples to process\r
6262    * @param[out] pResult    is output value.\r
6263    */\r
6264   void arm_std_f32(\r
6265   const float32_t * pSrc,\r
6266         uint32_t blockSize,\r
6267         float32_t * pResult);\r
6268 \r
6269 \r
6270   /**\r
6271    * @brief  Standard deviation of the elements of a Q31 vector.\r
6272    * @param[in]  pSrc       is input pointer\r
6273    * @param[in]  blockSize  is the number of samples to process\r
6274    * @param[out] pResult    is output value.\r
6275    */\r
6276   void arm_std_q31(\r
6277   const q31_t * pSrc,\r
6278         uint32_t blockSize,\r
6279         q31_t * pResult);\r
6280 \r
6281 \r
6282   /**\r
6283    * @brief  Standard deviation of the elements of a Q15 vector.\r
6284    * @param[in]  pSrc       is input pointer\r
6285    * @param[in]  blockSize  is the number of samples to process\r
6286    * @param[out] pResult    is output value.\r
6287    */\r
6288   void arm_std_q15(\r
6289   const q15_t * pSrc,\r
6290         uint32_t blockSize,\r
6291         q15_t * pResult);\r
6292 \r
6293 \r
6294   /**\r
6295    * @brief  Floating-point complex magnitude\r
6296    * @param[in]  pSrc        points to the complex input vector\r
6297    * @param[out] pDst        points to the real output vector\r
6298    * @param[in]  numSamples  number of complex samples in the input vector\r
6299    */\r
6300   void arm_cmplx_mag_f32(\r
6301   const float32_t * pSrc,\r
6302         float32_t * pDst,\r
6303         uint32_t numSamples);\r
6304 \r
6305 \r
6306   /**\r
6307    * @brief  Q31 complex magnitude\r
6308    * @param[in]  pSrc        points to the complex input vector\r
6309    * @param[out] pDst        points to the real output vector\r
6310    * @param[in]  numSamples  number of complex samples in the input vector\r
6311    */\r
6312   void arm_cmplx_mag_q31(\r
6313   const q31_t * pSrc,\r
6314         q31_t * pDst,\r
6315         uint32_t numSamples);\r
6316 \r
6317 \r
6318   /**\r
6319    * @brief  Q15 complex magnitude\r
6320    * @param[in]  pSrc        points to the complex input vector\r
6321    * @param[out] pDst        points to the real output vector\r
6322    * @param[in]  numSamples  number of complex samples in the input vector\r
6323    */\r
6324   void arm_cmplx_mag_q15(\r
6325   const q15_t * pSrc,\r
6326         q15_t * pDst,\r
6327         uint32_t numSamples);\r
6328 \r
6329 \r
6330   /**\r
6331    * @brief  Q15 complex dot product\r
6332    * @param[in]  pSrcA       points to the first input vector\r
6333    * @param[in]  pSrcB       points to the second input vector\r
6334    * @param[in]  numSamples  number of complex samples in each vector\r
6335    * @param[out] realResult  real part of the result returned here\r
6336    * @param[out] imagResult  imaginary part of the result returned here\r
6337    */\r
6338   void arm_cmplx_dot_prod_q15(\r
6339   const q15_t * pSrcA,\r
6340   const q15_t * pSrcB,\r
6341         uint32_t numSamples,\r
6342         q31_t * realResult,\r
6343         q31_t * imagResult);\r
6344 \r
6345 \r
6346   /**\r
6347    * @brief  Q31 complex dot product\r
6348    * @param[in]  pSrcA       points to the first input vector\r
6349    * @param[in]  pSrcB       points to the second input vector\r
6350    * @param[in]  numSamples  number of complex samples in each vector\r
6351    * @param[out] realResult  real part of the result returned here\r
6352    * @param[out] imagResult  imaginary part of the result returned here\r
6353    */\r
6354   void arm_cmplx_dot_prod_q31(\r
6355   const q31_t * pSrcA,\r
6356   const q31_t * pSrcB,\r
6357         uint32_t numSamples,\r
6358         q63_t * realResult,\r
6359         q63_t * imagResult);\r
6360 \r
6361 \r
6362   /**\r
6363    * @brief  Floating-point complex dot product\r
6364    * @param[in]  pSrcA       points to the first input vector\r
6365    * @param[in]  pSrcB       points to the second input vector\r
6366    * @param[in]  numSamples  number of complex samples in each vector\r
6367    * @param[out] realResult  real part of the result returned here\r
6368    * @param[out] imagResult  imaginary part of the result returned here\r
6369    */\r
6370   void arm_cmplx_dot_prod_f32(\r
6371   const float32_t * pSrcA,\r
6372   const float32_t * pSrcB,\r
6373         uint32_t numSamples,\r
6374         float32_t * realResult,\r
6375         float32_t * imagResult);\r
6376 \r
6377 \r
6378   /**\r
6379    * @brief  Q15 complex-by-real multiplication\r
6380    * @param[in]  pSrcCmplx   points to the complex input vector\r
6381    * @param[in]  pSrcReal    points to the real input vector\r
6382    * @param[out] pCmplxDst   points to the complex output vector\r
6383    * @param[in]  numSamples  number of samples in each vector\r
6384    */\r
6385   void arm_cmplx_mult_real_q15(\r
6386   const q15_t * pSrcCmplx,\r
6387   const q15_t * pSrcReal,\r
6388         q15_t * pCmplxDst,\r
6389         uint32_t numSamples);\r
6390 \r
6391 \r
6392   /**\r
6393    * @brief  Q31 complex-by-real multiplication\r
6394    * @param[in]  pSrcCmplx   points to the complex input vector\r
6395    * @param[in]  pSrcReal    points to the real input vector\r
6396    * @param[out] pCmplxDst   points to the complex output vector\r
6397    * @param[in]  numSamples  number of samples in each vector\r
6398    */\r
6399   void arm_cmplx_mult_real_q31(\r
6400   const q31_t * pSrcCmplx,\r
6401   const q31_t * pSrcReal,\r
6402         q31_t * pCmplxDst,\r
6403         uint32_t numSamples);\r
6404 \r
6405 \r
6406   /**\r
6407    * @brief  Floating-point complex-by-real multiplication\r
6408    * @param[in]  pSrcCmplx   points to the complex input vector\r
6409    * @param[in]  pSrcReal    points to the real input vector\r
6410    * @param[out] pCmplxDst   points to the complex output vector\r
6411    * @param[in]  numSamples  number of samples in each vector\r
6412    */\r
6413   void arm_cmplx_mult_real_f32(\r
6414   const float32_t * pSrcCmplx,\r
6415   const float32_t * pSrcReal,\r
6416         float32_t * pCmplxDst,\r
6417         uint32_t numSamples);\r
6418 \r
6419 \r
6420   /**\r
6421    * @brief  Minimum value of a Q7 vector.\r
6422    * @param[in]  pSrc       is input pointer\r
6423    * @param[in]  blockSize  is the number of samples to process\r
6424    * @param[out] result     is output pointer\r
6425    * @param[in]  index      is the array index of the minimum value in the input buffer.\r
6426    */\r
6427   void arm_min_q7(\r
6428   const q7_t * pSrc,\r
6429         uint32_t blockSize,\r
6430         q7_t * result,\r
6431         uint32_t * index);\r
6432 \r
6433 \r
6434   /**\r
6435    * @brief  Minimum value of a Q15 vector.\r
6436    * @param[in]  pSrc       is input pointer\r
6437    * @param[in]  blockSize  is the number of samples to process\r
6438    * @param[out] pResult    is output pointer\r
6439    * @param[in]  pIndex     is the array index of the minimum value in the input buffer.\r
6440    */\r
6441   void arm_min_q15(\r
6442   const q15_t * pSrc,\r
6443         uint32_t blockSize,\r
6444         q15_t * pResult,\r
6445         uint32_t * pIndex);\r
6446 \r
6447 \r
6448   /**\r
6449    * @brief  Minimum value of a Q31 vector.\r
6450    * @param[in]  pSrc       is input pointer\r
6451    * @param[in]  blockSize  is the number of samples to process\r
6452    * @param[out] pResult    is output pointer\r
6453    * @param[out] pIndex     is the array index of the minimum value in the input buffer.\r
6454    */\r
6455   void arm_min_q31(\r
6456   const q31_t * pSrc,\r
6457         uint32_t blockSize,\r
6458         q31_t * pResult,\r
6459         uint32_t * pIndex);\r
6460 \r
6461 \r
6462   /**\r
6463    * @brief  Minimum value of a floating-point vector.\r
6464    * @param[in]  pSrc       is input pointer\r
6465    * @param[in]  blockSize  is the number of samples to process\r
6466    * @param[out] pResult    is output pointer\r
6467    * @param[out] pIndex     is the array index of the minimum value in the input buffer.\r
6468    */\r
6469   void arm_min_f32(\r
6470   const float32_t * pSrc,\r
6471         uint32_t blockSize,\r
6472         float32_t * pResult,\r
6473         uint32_t * pIndex);\r
6474 \r
6475 \r
6476 /**\r
6477  * @brief Maximum value of a Q7 vector.\r
6478  * @param[in]  pSrc       points to the input buffer\r
6479  * @param[in]  blockSize  length of the input vector\r
6480  * @param[out] pResult    maximum value returned here\r
6481  * @param[out] pIndex     index of maximum value returned here\r
6482  */\r
6483   void arm_max_q7(\r
6484   const q7_t * pSrc,\r
6485         uint32_t blockSize,\r
6486         q7_t * pResult,\r
6487         uint32_t * pIndex);\r
6488 \r
6489 \r
6490 /**\r
6491  * @brief Maximum value of a Q15 vector.\r
6492  * @param[in]  pSrc       points to the input buffer\r
6493  * @param[in]  blockSize  length of the input vector\r
6494  * @param[out] pResult    maximum value returned here\r
6495  * @param[out] pIndex     index of maximum value returned here\r
6496  */\r
6497   void arm_max_q15(\r
6498   const q15_t * pSrc,\r
6499         uint32_t blockSize,\r
6500         q15_t * pResult,\r
6501         uint32_t * pIndex);\r
6502 \r
6503 \r
6504 /**\r
6505  * @brief Maximum value of a Q31 vector.\r
6506  * @param[in]  pSrc       points to the input buffer\r
6507  * @param[in]  blockSize  length of the input vector\r
6508  * @param[out] pResult    maximum value returned here\r
6509  * @param[out] pIndex     index of maximum value returned here\r
6510  */\r
6511   void arm_max_q31(\r
6512   const q31_t * pSrc,\r
6513         uint32_t blockSize,\r
6514         q31_t * pResult,\r
6515         uint32_t * pIndex);\r
6516 \r
6517 \r
6518 /**\r
6519  * @brief Maximum value of a floating-point vector.\r
6520  * @param[in]  pSrc       points to the input buffer\r
6521  * @param[in]  blockSize  length of the input vector\r
6522  * @param[out] pResult    maximum value returned here\r
6523  * @param[out] pIndex     index of maximum value returned here\r
6524  */\r
6525   void arm_max_f32(\r
6526   const float32_t * pSrc,\r
6527         uint32_t blockSize,\r
6528         float32_t * pResult,\r
6529         uint32_t * pIndex);\r
6530 \r
6531 \r
6532   /**\r
6533    * @brief  Q15 complex-by-complex multiplication\r
6534    * @param[in]  pSrcA       points to the first input vector\r
6535    * @param[in]  pSrcB       points to the second input vector\r
6536    * @param[out] pDst        points to the output vector\r
6537    * @param[in]  numSamples  number of complex samples in each vector\r
6538    */\r
6539   void arm_cmplx_mult_cmplx_q15(\r
6540   const q15_t * pSrcA,\r
6541   const q15_t * pSrcB,\r
6542         q15_t * pDst,\r
6543         uint32_t numSamples);\r
6544 \r
6545 \r
6546   /**\r
6547    * @brief  Q31 complex-by-complex multiplication\r
6548    * @param[in]  pSrcA       points to the first input vector\r
6549    * @param[in]  pSrcB       points to the second input vector\r
6550    * @param[out] pDst        points to the output vector\r
6551    * @param[in]  numSamples  number of complex samples in each vector\r
6552    */\r
6553   void arm_cmplx_mult_cmplx_q31(\r
6554   const q31_t * pSrcA,\r
6555   const q31_t * pSrcB,\r
6556         q31_t * pDst,\r
6557         uint32_t numSamples);\r
6558 \r
6559 \r
6560   /**\r
6561    * @brief  Floating-point complex-by-complex multiplication\r
6562    * @param[in]  pSrcA       points to the first input vector\r
6563    * @param[in]  pSrcB       points to the second input vector\r
6564    * @param[out] pDst        points to the output vector\r
6565    * @param[in]  numSamples  number of complex samples in each vector\r
6566    */\r
6567   void arm_cmplx_mult_cmplx_f32(\r
6568   const float32_t * pSrcA,\r
6569   const float32_t * pSrcB,\r
6570         float32_t * pDst,\r
6571         uint32_t numSamples);\r
6572 \r
6573 \r
6574   /**\r
6575    * @brief Converts the elements of the floating-point vector to Q31 vector.\r
6576    * @param[in]  pSrc       points to the floating-point input vector\r
6577    * @param[out] pDst       points to the Q31 output vector\r
6578    * @param[in]  blockSize  length of the input vector\r
6579    */\r
6580   void arm_float_to_q31(\r
6581   const float32_t * pSrc,\r
6582         q31_t * pDst,\r
6583         uint32_t blockSize);\r
6584 \r
6585 \r
6586   /**\r
6587    * @brief Converts the elements of the floating-point vector to Q15 vector.\r
6588    * @param[in]  pSrc       points to the floating-point input vector\r
6589    * @param[out] pDst       points to the Q15 output vector\r
6590    * @param[in]  blockSize  length of the input vector\r
6591    */\r
6592   void arm_float_to_q15(\r
6593   const float32_t * pSrc,\r
6594         q15_t * pDst,\r
6595         uint32_t blockSize);\r
6596 \r
6597 \r
6598   /**\r
6599    * @brief Converts the elements of the floating-point vector to Q7 vector.\r
6600    * @param[in]  pSrc       points to the floating-point input vector\r
6601    * @param[out] pDst       points to the Q7 output vector\r
6602    * @param[in]  blockSize  length of the input vector\r
6603    */\r
6604   void arm_float_to_q7(\r
6605   const float32_t * pSrc,\r
6606         q7_t * pDst,\r
6607         uint32_t blockSize);\r
6608 \r
6609 \r
6610   /**\r
6611    * @brief  Converts the elements of the Q31 vector to floating-point vector.\r
6612    * @param[in]  pSrc       is input pointer\r
6613    * @param[out] pDst       is output pointer\r
6614    * @param[in]  blockSize  is the number of samples to process\r
6615    */\r
6616   void arm_q31_to_float(\r
6617   const q31_t * pSrc,\r
6618         float32_t * pDst,\r
6619         uint32_t blockSize);\r
6620 \r
6621 \r
6622   /**\r
6623    * @brief  Converts the elements of the Q31 vector to Q15 vector.\r
6624    * @param[in]  pSrc       is input pointer\r
6625    * @param[out] pDst       is output pointer\r
6626    * @param[in]  blockSize  is the number of samples to process\r
6627    */\r
6628   void arm_q31_to_q15(\r
6629   const q31_t * pSrc,\r
6630         q15_t * pDst,\r
6631         uint32_t blockSize);\r
6632 \r
6633 \r
6634   /**\r
6635    * @brief  Converts the elements of the Q31 vector to Q7 vector.\r
6636    * @param[in]  pSrc       is input pointer\r
6637    * @param[out] pDst       is output pointer\r
6638    * @param[in]  blockSize  is the number of samples to process\r
6639    */\r
6640   void arm_q31_to_q7(\r
6641   const q31_t * pSrc,\r
6642         q7_t * pDst,\r
6643         uint32_t blockSize);\r
6644 \r
6645 \r
6646   /**\r
6647    * @brief  Converts the elements of the Q15 vector to floating-point vector.\r
6648    * @param[in]  pSrc       is input pointer\r
6649    * @param[out] pDst       is output pointer\r
6650    * @param[in]  blockSize  is the number of samples to process\r
6651    */\r
6652   void arm_q15_to_float(\r
6653   const q15_t * pSrc,\r
6654         float32_t * pDst,\r
6655         uint32_t blockSize);\r
6656 \r
6657 \r
6658   /**\r
6659    * @brief  Converts the elements of the Q15 vector to Q31 vector.\r
6660    * @param[in]  pSrc       is input pointer\r
6661    * @param[out] pDst       is output pointer\r
6662    * @param[in]  blockSize  is the number of samples to process\r
6663    */\r
6664   void arm_q15_to_q31(\r
6665   const q15_t * pSrc,\r
6666         q31_t * pDst,\r
6667         uint32_t blockSize);\r
6668 \r
6669 \r
6670   /**\r
6671    * @brief  Converts the elements of the Q15 vector to Q7 vector.\r
6672    * @param[in]  pSrc       is input pointer\r
6673    * @param[out] pDst       is output pointer\r
6674    * @param[in]  blockSize  is the number of samples to process\r
6675    */\r
6676   void arm_q15_to_q7(\r
6677   const q15_t * pSrc,\r
6678         q7_t * pDst,\r
6679         uint32_t blockSize);\r
6680 \r
6681 \r
6682   /**\r
6683    * @brief  Converts the elements of the Q7 vector to floating-point vector.\r
6684    * @param[in]  pSrc       is input pointer\r
6685    * @param[out] pDst       is output pointer\r
6686    * @param[in]  blockSize  is the number of samples to process\r
6687    */\r
6688   void arm_q7_to_float(\r
6689   const q7_t * pSrc,\r
6690         float32_t * pDst,\r
6691         uint32_t blockSize);\r
6692 \r
6693 \r
6694   /**\r
6695    * @brief  Converts the elements of the Q7 vector to Q31 vector.\r
6696    * @param[in]  pSrc       input pointer\r
6697    * @param[out] pDst       output pointer\r
6698    * @param[in]  blockSize  number of samples to process\r
6699    */\r
6700   void arm_q7_to_q31(\r
6701   const q7_t * pSrc,\r
6702         q31_t * pDst,\r
6703         uint32_t blockSize);\r
6704 \r
6705 \r
6706   /**\r
6707    * @brief  Converts the elements of the Q7 vector to Q15 vector.\r
6708    * @param[in]  pSrc       input pointer\r
6709    * @param[out] pDst       output pointer\r
6710    * @param[in]  blockSize  number of samples to process\r
6711    */\r
6712   void arm_q7_to_q15(\r
6713   const q7_t * pSrc,\r
6714         q15_t * pDst,\r
6715         uint32_t blockSize);\r
6716 \r
6717 \r
6718   /**\r
6719    * @ingroup groupInterpolation\r
6720    */\r
6721 \r
6722   /**\r
6723    * @defgroup BilinearInterpolate Bilinear Interpolation\r
6724    *\r
6725    * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.\r
6726    * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process\r
6727    * determines values between the grid points.\r
6728    * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.\r
6729    * Bilinear interpolation is often used in image processing to rescale images.\r
6730    * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.\r
6731    *\r
6732    * <b>Algorithm</b>\r
6733    * \par\r
6734    * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.\r
6735    * For floating-point, the instance structure is defined as:\r
6736    * <pre>\r
6737    *   typedef struct\r
6738    *   {\r
6739    *     uint16_t numRows;\r
6740    *     uint16_t numCols;\r
6741    *     float32_t *pData;\r
6742    * } arm_bilinear_interp_instance_f32;\r
6743    * </pre>\r
6744    *\r
6745    * \par\r
6746    * where <code>numRows</code> specifies the number of rows in the table;\r
6747    * <code>numCols</code> specifies the number of columns in the table;\r
6748    * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.\r
6749    * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.\r
6750    * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.\r
6751    *\r
6752    * \par\r
6753    * Let <code>(x, y)</code> specify the desired interpolation point.  Then define:\r
6754    * <pre>\r
6755    *     XF = floor(x)\r
6756    *     YF = floor(y)\r
6757    * </pre>\r
6758    * \par\r
6759    * The interpolated output point is computed as:\r
6760    * <pre>\r
6761    *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))\r
6762    *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))\r
6763    *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)\r
6764    *           + f(XF+1, YF+1) * (x-XF)*(y-YF)\r
6765    * </pre>\r
6766    * Note that the coordinates (x, y) contain integer and fractional components.\r
6767    * The integer components specify which portion of the table to use while the\r
6768    * fractional components control the interpolation processor.\r
6769    *\r
6770    * \par\r
6771    * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.\r
6772    */\r
6773 \r
6774 \r
6775   /**\r
6776    * @addtogroup BilinearInterpolate\r
6777    * @{\r
6778    */\r
6779 \r
6780   /**\r
6781   * @brief  Floating-point bilinear interpolation.\r
6782   * @param[in,out] S  points to an instance of the interpolation structure.\r
6783   * @param[in]     X  interpolation coordinate.\r
6784   * @param[in]     Y  interpolation coordinate.\r
6785   * @return out interpolated value.\r
6786   */\r
6787   __STATIC_FORCEINLINE float32_t arm_bilinear_interp_f32(\r
6788   const arm_bilinear_interp_instance_f32 * S,\r
6789   float32_t X,\r
6790   float32_t Y)\r
6791   {\r
6792     float32_t out;\r
6793     float32_t f00, f01, f10, f11;\r
6794     float32_t *pData = S->pData;\r
6795     int32_t xIndex, yIndex, index;\r
6796     float32_t xdiff, ydiff;\r
6797     float32_t b1, b2, b3, b4;\r
6798 \r
6799     xIndex = (int32_t) X;\r
6800     yIndex = (int32_t) Y;\r
6801 \r
6802     /* Care taken for table outside boundary */\r
6803     /* Returns zero output when values are outside table boundary */\r
6804     if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))\r
6805     {\r
6806       return (0);\r
6807     }\r
6808 \r
6809     /* Calculation of index for two nearest points in X-direction */\r
6810     index = (xIndex - 1) + (yIndex - 1) * S->numCols;\r
6811 \r
6812 \r
6813     /* Read two nearest points in X-direction */\r
6814     f00 = pData[index];\r
6815     f01 = pData[index + 1];\r
6816 \r
6817     /* Calculation of index for two nearest points in Y-direction */\r
6818     index = (xIndex - 1) + (yIndex) * S->numCols;\r
6819 \r
6820 \r
6821     /* Read two nearest points in Y-direction */\r
6822     f10 = pData[index];\r
6823     f11 = pData[index + 1];\r
6824 \r
6825     /* Calculation of intermediate values */\r
6826     b1 = f00;\r
6827     b2 = f01 - f00;\r
6828     b3 = f10 - f00;\r
6829     b4 = f00 - f01 - f10 + f11;\r
6830 \r
6831     /* Calculation of fractional part in X */\r
6832     xdiff = X - xIndex;\r
6833 \r
6834     /* Calculation of fractional part in Y */\r
6835     ydiff = Y - yIndex;\r
6836 \r
6837     /* Calculation of bi-linear interpolated output */\r
6838     out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;\r
6839 \r
6840     /* return to application */\r
6841     return (out);\r
6842   }\r
6843 \r
6844 \r
6845   /**\r
6846   * @brief  Q31 bilinear interpolation.\r
6847   * @param[in,out] S  points to an instance of the interpolation structure.\r
6848   * @param[in]     X  interpolation coordinate in 12.20 format.\r
6849   * @param[in]     Y  interpolation coordinate in 12.20 format.\r
6850   * @return out interpolated value.\r
6851   */\r
6852   __STATIC_FORCEINLINE q31_t arm_bilinear_interp_q31(\r
6853   arm_bilinear_interp_instance_q31 * S,\r
6854   q31_t X,\r
6855   q31_t Y)\r
6856   {\r
6857     q31_t out;                                   /* Temporary output */\r
6858     q31_t acc = 0;                               /* output */\r
6859     q31_t xfract, yfract;                        /* X, Y fractional parts */\r
6860     q31_t x1, x2, y1, y2;                        /* Nearest output values */\r
6861     int32_t rI, cI;                              /* Row and column indices */\r
6862     q31_t *pYData = S->pData;                    /* pointer to output table values */\r
6863     uint32_t nCols = S->numCols;                 /* num of rows */\r
6864 \r
6865     /* Input is in 12.20 format */\r
6866     /* 12 bits for the table index */\r
6867     /* Index value calculation */\r
6868     rI = ((X & (q31_t)0xFFF00000) >> 20);\r
6869 \r
6870     /* Input is in 12.20 format */\r
6871     /* 12 bits for the table index */\r
6872     /* Index value calculation */\r
6873     cI = ((Y & (q31_t)0xFFF00000) >> 20);\r
6874 \r
6875     /* Care taken for table outside boundary */\r
6876     /* Returns zero output when values are outside table boundary */\r
6877     if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))\r
6878     {\r
6879       return (0);\r
6880     }\r
6881 \r
6882     /* 20 bits for the fractional part */\r
6883     /* shift left xfract by 11 to keep 1.31 format */\r
6884     xfract = (X & 0x000FFFFF) << 11U;\r
6885 \r
6886     /* Read two nearest output values from the index */\r
6887     x1 = pYData[(rI) + (int32_t)nCols * (cI)    ];\r
6888     x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];\r
6889 \r
6890     /* 20 bits for the fractional part */\r
6891     /* shift left yfract by 11 to keep 1.31 format */\r
6892     yfract = (Y & 0x000FFFFF) << 11U;\r
6893 \r
6894     /* Read two nearest output values from the index */\r
6895     y1 = pYData[(rI) + (int32_t)nCols * (cI + 1)    ];\r
6896     y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];\r
6897 \r
6898     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */\r
6899     out = ((q31_t) (((q63_t) x1  * (0x7FFFFFFF - xfract)) >> 32));\r
6900     acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));\r
6901 \r
6902     /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */\r
6903     out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));\r
6904     acc += ((q31_t) ((q63_t) out * (xfract) >> 32));\r
6905 \r
6906     /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */\r
6907     out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));\r
6908     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));\r
6909 \r
6910     /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */\r
6911     out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));\r
6912     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));\r
6913 \r
6914     /* Convert acc to 1.31(q31) format */\r
6915     return ((q31_t)(acc << 2));\r
6916   }\r
6917 \r
6918 \r
6919   /**\r
6920   * @brief  Q15 bilinear interpolation.\r
6921   * @param[in,out] S  points to an instance of the interpolation structure.\r
6922   * @param[in]     X  interpolation coordinate in 12.20 format.\r
6923   * @param[in]     Y  interpolation coordinate in 12.20 format.\r
6924   * @return out interpolated value.\r
6925   */\r
6926   __STATIC_FORCEINLINE q15_t arm_bilinear_interp_q15(\r
6927   arm_bilinear_interp_instance_q15 * S,\r
6928   q31_t X,\r
6929   q31_t Y)\r
6930   {\r
6931     q63_t acc = 0;                               /* output */\r
6932     q31_t out;                                   /* Temporary output */\r
6933     q15_t x1, x2, y1, y2;                        /* Nearest output values */\r
6934     q31_t xfract, yfract;                        /* X, Y fractional parts */\r
6935     int32_t rI, cI;                              /* Row and column indices */\r
6936     q15_t *pYData = S->pData;                    /* pointer to output table values */\r
6937     uint32_t nCols = S->numCols;                 /* num of rows */\r
6938 \r
6939     /* Input is in 12.20 format */\r
6940     /* 12 bits for the table index */\r
6941     /* Index value calculation */\r
6942     rI = ((X & (q31_t)0xFFF00000) >> 20);\r
6943 \r
6944     /* Input is in 12.20 format */\r
6945     /* 12 bits for the table index */\r
6946     /* Index value calculation */\r
6947     cI = ((Y & (q31_t)0xFFF00000) >> 20);\r
6948 \r
6949     /* Care taken for table outside boundary */\r
6950     /* Returns zero output when values are outside table boundary */\r
6951     if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))\r
6952     {\r
6953       return (0);\r
6954     }\r
6955 \r
6956     /* 20 bits for the fractional part */\r
6957     /* xfract should be in 12.20 format */\r
6958     xfract = (X & 0x000FFFFF);\r
6959 \r
6960     /* Read two nearest output values from the index */\r
6961     x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI)    ];\r
6962     x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];\r
6963 \r
6964     /* 20 bits for the fractional part */\r
6965     /* yfract should be in 12.20 format */\r
6966     yfract = (Y & 0x000FFFFF);\r
6967 \r
6968     /* Read two nearest output values from the index */\r
6969     y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1)    ];\r
6970     y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];\r
6971 \r
6972     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */\r
6973 \r
6974     /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */\r
6975     /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */\r
6976     out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4U);\r
6977     acc = ((q63_t) out * (0xFFFFF - yfract));\r
6978 \r
6979     /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */\r
6980     out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4U);\r
6981     acc += ((q63_t) out * (xfract));\r
6982 \r
6983     /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */\r
6984     out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4U);\r
6985     acc += ((q63_t) out * (yfract));\r
6986 \r
6987     /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */\r
6988     out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U);\r
6989     acc += ((q63_t) out * (yfract));\r
6990 \r
6991     /* acc is in 13.51 format and down shift acc by 36 times */\r
6992     /* Convert out to 1.15 format */\r
6993     return ((q15_t)(acc >> 36));\r
6994   }\r
6995 \r
6996 \r
6997   /**\r
6998   * @brief  Q7 bilinear interpolation.\r
6999   * @param[in,out] S  points to an instance of the interpolation structure.\r
7000   * @param[in]     X  interpolation coordinate in 12.20 format.\r
7001   * @param[in]     Y  interpolation coordinate in 12.20 format.\r
7002   * @return out interpolated value.\r
7003   */\r
7004   __STATIC_FORCEINLINE q7_t arm_bilinear_interp_q7(\r
7005   arm_bilinear_interp_instance_q7 * S,\r
7006   q31_t X,\r
7007   q31_t Y)\r
7008   {\r
7009     q63_t acc = 0;                               /* output */\r
7010     q31_t out;                                   /* Temporary output */\r
7011     q31_t xfract, yfract;                        /* X, Y fractional parts */\r
7012     q7_t x1, x2, y1, y2;                         /* Nearest output values */\r
7013     int32_t rI, cI;                              /* Row and column indices */\r
7014     q7_t *pYData = S->pData;                     /* pointer to output table values */\r
7015     uint32_t nCols = S->numCols;                 /* num of rows */\r
7016 \r
7017     /* Input is in 12.20 format */\r
7018     /* 12 bits for the table index */\r
7019     /* Index value calculation */\r
7020     rI = ((X & (q31_t)0xFFF00000) >> 20);\r
7021 \r
7022     /* Input is in 12.20 format */\r
7023     /* 12 bits for the table index */\r
7024     /* Index value calculation */\r
7025     cI = ((Y & (q31_t)0xFFF00000) >> 20);\r
7026 \r
7027     /* Care taken for table outside boundary */\r
7028     /* Returns zero output when values are outside table boundary */\r
7029     if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))\r
7030     {\r
7031       return (0);\r
7032     }\r
7033 \r
7034     /* 20 bits for the fractional part */\r
7035     /* xfract should be in 12.20 format */\r
7036     xfract = (X & (q31_t)0x000FFFFF);\r
7037 \r
7038     /* Read two nearest output values from the index */\r
7039     x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI)    ];\r
7040     x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];\r
7041 \r
7042     /* 20 bits for the fractional part */\r
7043     /* yfract should be in 12.20 format */\r
7044     yfract = (Y & (q31_t)0x000FFFFF);\r
7045 \r
7046     /* Read two nearest output values from the index */\r
7047     y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1)    ];\r
7048     y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];\r
7049 \r
7050     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */\r
7051     out = ((x1 * (0xFFFFF - xfract)));\r
7052     acc = (((q63_t) out * (0xFFFFF - yfract)));\r
7053 \r
7054     /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */\r
7055     out = ((x2 * (0xFFFFF - yfract)));\r
7056     acc += (((q63_t) out * (xfract)));\r
7057 \r
7058     /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */\r
7059     out = ((y1 * (0xFFFFF - xfract)));\r
7060     acc += (((q63_t) out * (yfract)));\r
7061 \r
7062     /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */\r
7063     out = ((y2 * (yfract)));\r
7064     acc += (((q63_t) out * (xfract)));\r
7065 \r
7066     /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */\r
7067     return ((q7_t)(acc >> 40));\r
7068   }\r
7069 \r
7070   /**\r
7071    * @} end of BilinearInterpolate group\r
7072    */\r
7073 \r
7074 \r
7075 /* SMMLAR */\r
7076 #define multAcc_32x32_keep32_R(a, x, y) \\r
7077     a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)\r
7078 \r
7079 /* SMMLSR */\r
7080 #define multSub_32x32_keep32_R(a, x, y) \\r
7081     a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)\r
7082 \r
7083 /* SMMULR */\r
7084 #define mult_32x32_keep32_R(a, x, y) \\r
7085     a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)\r
7086 \r
7087 /* SMMLA */\r
7088 #define multAcc_32x32_keep32(a, x, y) \\r
7089     a += (q31_t) (((q63_t) x * y) >> 32)\r
7090 \r
7091 /* SMMLS */\r
7092 #define multSub_32x32_keep32(a, x, y) \\r
7093     a -= (q31_t) (((q63_t) x * y) >> 32)\r
7094 \r
7095 /* SMMUL */\r
7096 #define mult_32x32_keep32(a, x, y) \\r
7097     a = (q31_t) (((q63_t) x * y ) >> 32)\r
7098 \r
7099 \r
7100 #if   defined ( __CC_ARM )\r
7101   /* Enter low optimization region - place directly above function definition */\r
7102   #if defined( __ARM_ARCH_7EM__ )\r
7103     #define LOW_OPTIMIZATION_ENTER \\r
7104        _Pragma ("push")         \\r
7105        _Pragma ("O1")\r
7106   #else\r
7107     #define LOW_OPTIMIZATION_ENTER\r
7108   #endif\r
7109 \r
7110   /* Exit low optimization region - place directly after end of function definition */\r
7111   #if defined ( __ARM_ARCH_7EM__ )\r
7112     #define LOW_OPTIMIZATION_EXIT \\r
7113        _Pragma ("pop")\r
7114   #else\r
7115     #define LOW_OPTIMIZATION_EXIT\r
7116   #endif\r
7117 \r
7118   /* Enter low optimization region - place directly above function definition */\r
7119   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7120 \r
7121   /* Exit low optimization region - place directly after end of function definition */\r
7122   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7123 \r
7124 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )\r
7125   #define LOW_OPTIMIZATION_ENTER\r
7126   #define LOW_OPTIMIZATION_EXIT\r
7127   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7128   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7129 \r
7130 #elif defined ( __GNUC__ )\r
7131   #define LOW_OPTIMIZATION_ENTER \\r
7132        __attribute__(( optimize("-O1") ))\r
7133   #define LOW_OPTIMIZATION_EXIT\r
7134   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7135   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7136 \r
7137 #elif defined ( __ICCARM__ )\r
7138   /* Enter low optimization region - place directly above function definition */\r
7139   #if defined ( __ARM_ARCH_7EM__ )\r
7140     #define LOW_OPTIMIZATION_ENTER \\r
7141        _Pragma ("optimize=low")\r
7142   #else\r
7143     #define LOW_OPTIMIZATION_ENTER\r
7144   #endif\r
7145 \r
7146   /* Exit low optimization region - place directly after end of function definition */\r
7147   #define LOW_OPTIMIZATION_EXIT\r
7148 \r
7149   /* Enter low optimization region - place directly above function definition */\r
7150   #if defined ( __ARM_ARCH_7EM__ )\r
7151     #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \\r
7152        _Pragma ("optimize=low")\r
7153   #else\r
7154     #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7155   #endif\r
7156 \r
7157   /* Exit low optimization region - place directly after end of function definition */\r
7158   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7159 \r
7160 #elif defined ( __TI_ARM__ )\r
7161   #define LOW_OPTIMIZATION_ENTER\r
7162   #define LOW_OPTIMIZATION_EXIT\r
7163   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7164   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7165 \r
7166 #elif defined ( __CSMC__ )\r
7167   #define LOW_OPTIMIZATION_ENTER\r
7168   #define LOW_OPTIMIZATION_EXIT\r
7169   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7170   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7171 \r
7172 #elif defined ( __TASKING__ )\r
7173   #define LOW_OPTIMIZATION_ENTER\r
7174   #define LOW_OPTIMIZATION_EXIT\r
7175   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7176   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7177 \r
7178 #endif\r
7179 \r
7180 \r
7181 #ifdef   __cplusplus\r
7182 }\r
7183 #endif\r
7184 \r
7185 /* Compiler specific diagnostic adjustment */\r
7186 #if   defined ( __CC_ARM )\r
7187 \r
7188 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )\r
7189 \r
7190 #elif defined ( __GNUC__ )\r
7191 #pragma GCC diagnostic pop\r
7192 \r
7193 #elif defined ( __ICCARM__ )\r
7194 \r
7195 #elif defined ( __TI_ARM__ )\r
7196 \r
7197 #elif defined ( __CSMC__ )\r
7198 \r
7199 #elif defined ( __TASKING__ )\r
7200 \r
7201 #else\r
7202   #error Unknown compiler\r
7203 #endif\r
7204 \r
7205 #endif /* _ARM_MATH_H */\r
7206 \r
7207 /**\r
7208  *\r
7209  * End of file.\r
7210  */\r