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