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