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