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