1 /* ----------------------------------------------------------------------
2 * Copyright (C) 2010 ARM Limited. All rights reserved.
7 * Project: CMSIS DSP Library
10 * Description: Public header file for CMSIS DSP Library
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
14 * Version 1.0.10 2011/7/15
15 * Big Endian support added and Merged M0 and M3/M4 Source code.
17 * Version 1.0.3 2010/11/29
18 * Re-organized the CMSIS folders and updated documentation.
20 * Version 1.0.2 2010/11/11
21 * Documentation updated.
23 * Version 1.0.1 2010/10/05
24 * Production release and review comments incorporated.
26 * Version 1.0.0 2010/09/20
27 * Production release and review comments incorporated.
28 * -------------------------------------------------------------------- */
31 \mainpage CMSIS DSP Software Library
35 * This user manual describes the CMSIS DSP software library,
36 * a suite of common signal processing functions for use on Cortex-M processor based devices.
38 * The library is divided into a number of modules each covering a specific category:
39 * - Basic math functions
40 * - Fast math functions
41 * - Complex math functions
45 * - Motor control functions
46 * - Statistical functions
48 * - Interpolation functions
50 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
51 * 32-bit integer and 32-bit floating-point values.
53 * <b>Processor Support</b>
55 * The library is completely written in C and is fully CMSIS compliant.
56 * High performance is achieved through maximum use of Cortex-M4 intrinsics.
58 * The supplied library source code also builds and runs on the Cortex-M3 and Cortex-M0 processor,
59 * with the DSP intrinsics being emulated through software.
62 * <b>Toolchain Support</b>
64 * The library has been developed and tested with MDK-ARM version 4.21.
65 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
67 * <b>Using the Library</b>
69 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
70 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
71 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
72 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
73 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
74 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
75 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
76 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
77 * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
79 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
80 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
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.
82 * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
83 * ARM_MATH_CM0 depending on the target processor in the application.
87 * The library ships with a number of examples which demonstrate how to use the library functions.
89 * <b>Building the Library</b>
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.
92 * - arm_cortexM0b_math.uvproj
93 * - arm_cortexM0l_math.uvproj
94 * - arm_cortexM3b_math.uvproj
95 * - arm_cortexM3l_math.uvproj
96 * - arm_cortexM4b_math.uvproj
97 * - arm_cortexM4l_math.uvproj
98 * - arm_cortexM4bf_math.uvproj
99 * - arm_cortexM4lf_math.uvproj
101 * Each library project have differant pre-processor macros.
103 * <b>ARM_MATH_CMx:</b>
104 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
105 * and ARM_MATH_CM0 for building library on cortex-M0 target.
107 * <b>ARM_MATH_BIG_ENDIAN:</b>
108 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
110 * <b>ARM_MATH_MATRIX_CHECK:</b>
111 * Define macro for checking on the input and output sizes of matrices
113 * <b>ARM_MATH_ROUNDING:</b>
114 * Define macro for rounding on support functions
116 * <b>__FPU_PRESENT:</b>
117 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
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.
122 * <b>Copyright Notice</b>
124 * Copyright (C) 2010 ARM Limited. All rights reserved.
129 * @defgroup groupMath Basic Math Functions
133 * @defgroup groupFastMath Fast Math Functions
134 * This set of functions provides a fast approximation to sine, cosine, and square root.
135 * As compared to most of the other functions in the CMSIS math library, the fast math functions
136 * operate on individual values and not arrays.
137 * There are separate functions for Q15, Q31, and floating-point data.
142 * @defgroup groupCmplxMath Complex Math Functions
143 * This set of functions operates on complex data vectors.
144 * The data in the complex arrays is stored in an interleaved fashion
145 * (real, imag, real, imag, ...).
146 * In the API functions, the number of samples in a complex array refers
147 * to the number of complex values; the array contains twice this number of
152 * @defgroup groupFilters Filtering Functions
156 * @defgroup groupMatrix Matrix Functions
158 * This set of functions provides basic matrix math operations.
159 * The functions operate on matrix data structures. For example,
161 * definition for the floating-point matrix structure is shown
166 * uint16_t numRows; // number of rows of the matrix.
167 * uint16_t numCols; // number of columns of the matrix.
168 * float32_t *pData; // points to the data of the matrix.
169 * } arm_matrix_instance_f32;
171 * There are similar definitions for Q15 and Q31 data types.
173 * The structure specifies the size of the matrix and then points to
174 * an array of data. The array is of size <code>numRows X numCols</code>
175 * and the values are arranged in row order. That is, the
176 * matrix element (i, j) is stored at:
178 * pData[i*numCols + j]
181 * \par Init Functions
182 * There is an associated initialization function for each type of matrix
184 * The initialization function sets the values of the internal structure fields.
185 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
186 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
189 * Use of the initialization function is optional. However, if initialization function is used
190 * then the instance structure cannot be placed into a const data section.
191 * To place the instance structure in a const data
192 * section, manually initialize the data structure. For example:
194 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
195 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
196 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
198 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
199 * specifies the number of columns, and <code>pData</code> points to the
203 * By default all of the matrix functions perform size checking on the input and
204 * output matrices. For example, the matrix addition function verifies that the
205 * two input matrices and the output matrix all have the same number of rows and
206 * columns. If the size check fails the functions return:
208 * ARM_MATH_SIZE_MISMATCH
210 * Otherwise the functions return
214 * There is some overhead associated with this matrix size checking.
215 * The matrix size checking is enabled via the #define
217 * ARM_MATH_MATRIX_CHECK
219 * within the library project settings. By default this macro is defined
220 * and size checking is enabled. By changing the project settings and
221 * undefining this macro size checking is eliminated and the functions
222 * run a bit faster. With size checking disabled the functions always
223 * return <code>ARM_MATH_SUCCESS</code>.
227 * @defgroup groupTransforms Transform Functions
231 * @defgroup groupController Controller Functions
235 * @defgroup groupStats Statistics Functions
238 * @defgroup groupSupport Support Functions
242 * @defgroup groupInterpolation Interpolation Functions
243 * These functions perform 1- and 2-dimensional interpolation of data.
244 * Linear interpolation is used for 1-dimensional data and
245 * bilinear interpolation is used for 2-dimensional data.
249 * @defgroup groupExamples Examples
254 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
256 #if defined (ARM_MATH_CM4)
257 #include "core_cm4.h"
258 #elif defined (ARM_MATH_CM3)
259 #include "core_cm3.h"
260 #elif defined (ARM_MATH_CM0)
261 #include "core_cm0.h"
264 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
267 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
277 * @brief Macros required for reciprocal calculation in Normalized LMS
280 #define DELTA_Q31 (0x100)
281 #define DELTA_Q15 0x5
282 #define INDEX_MASK 0x0000003F
283 #define PI 3.14159265358979f
286 * @brief Macros required for SINE and COSINE Fast math approximations
289 #define TABLE_SIZE 256
290 #define TABLE_SPACING_Q31 0x800000
291 #define TABLE_SPACING_Q15 0x80
294 * @brief Macros required for SINE and COSINE Controller functions
296 /* 1.31(q31) Fixed value of 2/360 */
297 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
298 #define INPUT_SPACING 0xB60B61
302 * @brief Error status returned by some functions in the library.
307 ARM_MATH_SUCCESS = 0, /**< No error */
308 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
309 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
310 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
311 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
312 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
313 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
317 * @brief 8-bit fractional data type in 1.7 format.
322 * @brief 16-bit fractional data type in 1.15 format.
324 typedef int16_t q15_t;
327 * @brief 32-bit fractional data type in 1.31 format.
329 typedef int32_t q31_t;
332 * @brief 64-bit fractional data type in 1.63 format.
334 typedef int64_t q63_t;
337 * @brief 32-bit floating-point type definition.
339 typedef float float32_t;
342 * @brief 64-bit floating-point type definition.
344 typedef double float64_t;
347 * @brief definition to read/write two 16 bit values.
349 #define __SIMD32(addr) (*(int32_t **) & (addr))
351 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
353 * @brief definition to pack two 16 bit values.
355 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
356 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
362 * @brief definition to pack four 8 bit values.
364 #ifndef ARM_MATH_BIG_ENDIAN
366 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
367 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
368 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
369 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
372 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
373 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
374 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
375 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
381 * @brief Clips Q63 to Q31 values.
383 static __INLINE q31_t clip_q63_to_q31(
386 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
387 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
391 * @brief Clips Q63 to Q15 values.
393 static __INLINE q15_t clip_q63_to_q15(
396 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
397 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
401 * @brief Clips Q31 to Q7 values.
403 static __INLINE q7_t clip_q31_to_q7(
406 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
407 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
411 * @brief Clips Q31 to Q15 values.
413 static __INLINE q15_t clip_q31_to_q15(
416 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
417 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
421 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
424 static __INLINE q63_t mult32x64(
428 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
429 (((q63_t) (x >> 32) * y)));
433 #if defined (ARM_MATH_CM0) && defined ( __CC_ARM )
437 #if defined (ARM_MATH_CM0) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
439 static __INLINE uint32_t __CLZ(q31_t data);
442 static __INLINE uint32_t __CLZ(q31_t data)
445 uint32_t mask = 0x80000000;
447 while((data & mask) == 0)
460 * @brief Function to Calculates 1/in(reciprocal) value of Q31 Data type.
463 static __INLINE uint32_t arm_recip_q31(
469 uint32_t out, tempVal;
475 signBits = __CLZ(in) - 1;
479 signBits = __CLZ(-in) - 1;
482 /* Convert input sample to 1.31 format */
485 /* calculation of index for initial approximated Val */
486 index = (uint32_t) (in >> 24u);
487 index = (index & INDEX_MASK);
489 /* 1.31 with exp 1 */
490 out = pRecipTable[index];
492 /* calculation of reciprocal value */
493 /* running approximation for two iterations */
494 for (i = 0u; i < 2u; i++)
496 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
497 tempVal = 0x7FFFFFFF - tempVal;
498 /* 1.31 with exp 1 */
499 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
500 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
506 /* return num of signbits of out = 1/in value */
507 return (signBits + 1u);
512 * @brief Function to Calculates 1/in(reciprocal) value of Q15 Data type.
514 static __INLINE uint32_t arm_recip_q15(
520 uint32_t out = 0, tempVal = 0;
521 uint32_t index = 0, i = 0;
522 uint32_t signBits = 0;
526 signBits = __CLZ(in) - 17;
530 signBits = __CLZ(-in) - 17;
533 /* Convert input sample to 1.15 format */
536 /* calculation of index for initial approximated Val */
538 index = (index & INDEX_MASK);
540 /* 1.15 with exp 1 */
541 out = pRecipTable[index];
543 /* calculation of reciprocal value */
544 /* running approximation for two iterations */
545 for (i = 0; i < 2; i++)
547 tempVal = (q15_t) (((q31_t) in * out) >> 15);
548 tempVal = 0x7FFF - tempVal;
549 /* 1.15 with exp 1 */
550 out = (q15_t) (((q31_t) out * tempVal) >> 14);
556 /* return num of signbits of out = 1/in value */
557 return (signBits + 1);
563 * @brief C custom defined intrinisic function for only M0 processors
565 #if defined(ARM_MATH_CM0)
567 static __INLINE q31_t __SSAT(
571 int32_t posMax, negMin;
575 for (i = 0; i < (y - 1); i++)
582 posMax = (posMax - 1);
603 #endif /* end of ARM_MATH_CM0 */
608 * @brief C custom defined intrinsic function for M3 and M0 processors
610 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
613 * @brief C custom defined QADD8 for M3 and M0 processors
615 static __INLINE q31_t __QADD8(
626 r = __SSAT((q31_t) (r + s), 8);
627 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
628 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
629 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
631 sum = (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
632 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
639 * @brief C custom defined QSUB8 for M3 and M0 processors
641 static __INLINE q31_t __QSUB8(
652 r = __SSAT((r - s), 8);
653 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
654 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
655 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
658 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & 0x000000FF);
664 * @brief C custom defined QADD16 for M3 and M0 processors
668 * @brief C custom defined QADD16 for M3 and M0 processors
670 static __INLINE q31_t __QADD16(
681 r = __SSAT(r + s, 16);
682 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
684 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
691 * @brief C custom defined SHADD16 for M3 and M0 processors
693 static __INLINE q31_t __SHADD16(
704 r = ((r >> 1) + (s >> 1));
705 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
707 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
714 * @brief C custom defined QSUB16 for M3 and M0 processors
716 static __INLINE q31_t __QSUB16(
727 r = __SSAT(r - s, 16);
728 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
730 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
736 * @brief C custom defined SHSUB16 for M3 and M0 processors
738 static __INLINE q31_t __SHSUB16(
749 r = ((r >> 1) - (s >> 1));
750 s = (((x >> 17) - (y >> 17)) << 16);
752 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
758 * @brief C custom defined QASX for M3 and M0 processors
760 static __INLINE q31_t __QASX(
767 sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) +
768 clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16)));
774 * @brief C custom defined SHASX for M3 and M0 processors
776 static __INLINE q31_t __SHASX(
787 r = ((r >> 1) - (y >> 17));
788 s = (((x >> 17) + (s >> 1)) << 16);
790 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
797 * @brief C custom defined QSAX for M3 and M0 processors
799 static __INLINE q31_t __QSAX(
806 sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) +
807 clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16)));
813 * @brief C custom defined SHSAX for M3 and M0 processors
815 static __INLINE q31_t __SHSAX(
826 r = ((r >> 1) + (y >> 17));
827 s = (((x >> 17) - (s >> 1)) << 16);
829 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
835 * @brief C custom defined SMUSDX for M3 and M0 processors
837 static __INLINE q31_t __SMUSDX(
842 return ((q31_t)(((short) x * (short) (y >> 16)) -
843 ((short) (x >> 16) * (short) y)));
847 * @brief C custom defined SMUADX for M3 and M0 processors
849 static __INLINE q31_t __SMUADX(
854 return ((q31_t)(((short) x * (short) (y >> 16)) +
855 ((short) (x >> 16) * (short) y)));
859 * @brief C custom defined QADD for M3 and M0 processors
861 static __INLINE q31_t __QADD(
865 return clip_q63_to_q31((q63_t) x + y);
869 * @brief C custom defined QSUB for M3 and M0 processors
871 static __INLINE q31_t __QSUB(
875 return clip_q63_to_q31((q63_t) x - y);
879 * @brief C custom defined SMLAD for M3 and M0 processors
881 static __INLINE q31_t __SMLAD(
887 return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
888 ((short) x * (short) y));
892 * @brief C custom defined SMLADX for M3 and M0 processors
894 static __INLINE q31_t __SMLADX(
900 return (sum + ((short) (x >> 16) * (short) (y)) +
901 ((short) x * (short) (y >> 16)));
905 * @brief C custom defined SMLSDX for M3 and M0 processors
907 static __INLINE q31_t __SMLSDX(
913 return (sum - ((short) (x >> 16) * (short) (y)) +
914 ((short) x * (short) (y >> 16)));
918 * @brief C custom defined SMLALD for M3 and M0 processors
920 static __INLINE q63_t __SMLALD(
926 return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
927 ((short) x * (short) y));
931 * @brief C custom defined SMLALDX for M3 and M0 processors
933 static __INLINE q63_t __SMLALDX(
939 return (sum + ((short) (x >> 16) * (short) y)) +
940 ((short) x * (short) (y >> 16));
944 * @brief C custom defined SMUAD for M3 and M0 processors
946 static __INLINE q31_t __SMUAD(
951 return (((x >> 16) * (y >> 16)) +
952 (((x << 16) >> 16) * ((y << 16) >> 16)));
956 * @brief C custom defined SMUSD for M3 and M0 processors
958 static __INLINE q31_t __SMUSD(
963 return (-((x >> 16) * (y >> 16)) +
964 (((x << 16) >> 16) * ((y << 16) >> 16)));
970 #endif /* (ARM_MATH_CM3) || defined (ARM_MATH_CM0) */
974 * @brief Instance structure for the Q7 FIR filter.
978 uint16_t numTaps; /**< number of filter coefficients in the filter. */
979 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
980 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
981 } arm_fir_instance_q7;
984 * @brief Instance structure for the Q15 FIR filter.
988 uint16_t numTaps; /**< number of filter coefficients in the filter. */
989 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
990 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
991 } arm_fir_instance_q15;
994 * @brief Instance structure for the Q31 FIR filter.
998 uint16_t numTaps; /**< number of filter coefficients in the filter. */
999 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1000 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
1001 } arm_fir_instance_q31;
1004 * @brief Instance structure for the floating-point FIR filter.
1008 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1009 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1010 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
1011 } arm_fir_instance_f32;
1015 * @brief Processing function for the Q7 FIR filter.
1016 * @param[in] *S points to an instance of the Q7 FIR filter structure.
1017 * @param[in] *pSrc points to the block of input data.
1018 * @param[out] *pDst points to the block of output data.
1019 * @param[in] blockSize number of samples to process.
1023 const arm_fir_instance_q7 * S,
1026 uint32_t blockSize);
1030 * @brief Initialization function for the Q7 FIR filter.
1031 * @param[in,out] *S points to an instance of the Q7 FIR structure.
1032 * @param[in] numTaps Number of filter coefficients in the filter.
1033 * @param[in] *pCoeffs points to the filter coefficients.
1034 * @param[in] *pState points to the state buffer.
1035 * @param[in] blockSize number of samples that are processed.
1038 void arm_fir_init_q7(
1039 arm_fir_instance_q7 * S,
1043 uint32_t blockSize);
1047 * @brief Processing function for the Q15 FIR filter.
1048 * @param[in] *S points to an instance of the Q15 FIR structure.
1049 * @param[in] *pSrc points to the block of input data.
1050 * @param[out] *pDst points to the block of output data.
1051 * @param[in] blockSize number of samples to process.
1055 const arm_fir_instance_q15 * S,
1058 uint32_t blockSize);
1061 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
1062 * @param[in] *S points to an instance of the Q15 FIR filter structure.
1063 * @param[in] *pSrc points to the block of input data.
1064 * @param[out] *pDst points to the block of output data.
1065 * @param[in] blockSize number of samples to process.
1068 void arm_fir_fast_q15(
1069 const arm_fir_instance_q15 * S,
1072 uint32_t blockSize);
1075 * @brief Initialization function for the Q15 FIR filter.
1076 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
1077 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
1078 * @param[in] *pCoeffs points to the filter coefficients.
1079 * @param[in] *pState points to the state buffer.
1080 * @param[in] blockSize number of samples that are processed at a time.
1081 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
1082 * <code>numTaps</code> is not a supported value.
1085 arm_status arm_fir_init_q15(
1086 arm_fir_instance_q15 * S,
1090 uint32_t blockSize);
1093 * @brief Processing function for the Q31 FIR filter.
1094 * @param[in] *S points to an instance of the Q31 FIR filter structure.
1095 * @param[in] *pSrc points to the block of input data.
1096 * @param[out] *pDst points to the block of output data.
1097 * @param[in] blockSize number of samples to process.
1101 const arm_fir_instance_q31 * S,
1104 uint32_t blockSize);
1107 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
1108 * @param[in] *S points to an instance of the Q31 FIR structure.
1109 * @param[in] *pSrc points to the block of input data.
1110 * @param[out] *pDst points to the block of output data.
1111 * @param[in] blockSize number of samples to process.
1114 void arm_fir_fast_q31(
1115 const arm_fir_instance_q31 * S,
1118 uint32_t blockSize);
1121 * @brief Initialization function for the Q31 FIR filter.
1122 * @param[in,out] *S points to an instance of the Q31 FIR structure.
1123 * @param[in] numTaps Number of filter coefficients in the filter.
1124 * @param[in] *pCoeffs points to the filter coefficients.
1125 * @param[in] *pState points to the state buffer.
1126 * @param[in] blockSize number of samples that are processed at a time.
1129 void arm_fir_init_q31(
1130 arm_fir_instance_q31 * S,
1134 uint32_t blockSize);
1137 * @brief Processing function for the floating-point FIR filter.
1138 * @param[in] *S points to an instance of the floating-point FIR structure.
1139 * @param[in] *pSrc points to the block of input data.
1140 * @param[out] *pDst points to the block of output data.
1141 * @param[in] blockSize number of samples to process.
1145 const arm_fir_instance_f32 * S,
1148 uint32_t blockSize);
1151 * @brief Initialization function for the floating-point FIR filter.
1152 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
1153 * @param[in] numTaps Number of filter coefficients in the filter.
1154 * @param[in] *pCoeffs points to the filter coefficients.
1155 * @param[in] *pState points to the state buffer.
1156 * @param[in] blockSize number of samples that are processed at a time.
1159 void arm_fir_init_f32(
1160 arm_fir_instance_f32 * S,
1162 float32_t * pCoeffs,
1164 uint32_t blockSize);
1168 * @brief Instance structure for the Q15 Biquad cascade filter.
1172 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1173 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1174 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1175 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
1177 } arm_biquad_casd_df1_inst_q15;
1181 * @brief Instance structure for the Q31 Biquad cascade filter.
1185 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1186 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1187 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1188 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
1190 } arm_biquad_casd_df1_inst_q31;
1193 * @brief Instance structure for the floating-point Biquad cascade filter.
1197 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1198 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1199 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1202 } arm_biquad_casd_df1_inst_f32;
1207 * @brief Processing function for the Q15 Biquad cascade filter.
1208 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
1209 * @param[in] *pSrc points to the block of input data.
1210 * @param[out] *pDst points to the block of output data.
1211 * @param[in] blockSize number of samples to process.
1215 void arm_biquad_cascade_df1_q15(
1216 const arm_biquad_casd_df1_inst_q15 * S,
1219 uint32_t blockSize);
1222 * @brief Initialization function for the Q15 Biquad cascade filter.
1223 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
1224 * @param[in] numStages number of 2nd order stages in the filter.
1225 * @param[in] *pCoeffs points to the filter coefficients.
1226 * @param[in] *pState points to the state buffer.
1227 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1231 void arm_biquad_cascade_df1_init_q15(
1232 arm_biquad_casd_df1_inst_q15 * S,
1240 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1241 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
1242 * @param[in] *pSrc points to the block of input data.
1243 * @param[out] *pDst points to the block of output data.
1244 * @param[in] blockSize number of samples to process.
1248 void arm_biquad_cascade_df1_fast_q15(
1249 const arm_biquad_casd_df1_inst_q15 * S,
1252 uint32_t blockSize);
1256 * @brief Processing function for the Q31 Biquad cascade filter
1257 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
1258 * @param[in] *pSrc points to the block of input data.
1259 * @param[out] *pDst points to the block of output data.
1260 * @param[in] blockSize number of samples to process.
1264 void arm_biquad_cascade_df1_q31(
1265 const arm_biquad_casd_df1_inst_q31 * S,
1268 uint32_t blockSize);
1271 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1272 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
1273 * @param[in] *pSrc points to the block of input data.
1274 * @param[out] *pDst points to the block of output data.
1275 * @param[in] blockSize number of samples to process.
1279 void arm_biquad_cascade_df1_fast_q31(
1280 const arm_biquad_casd_df1_inst_q31 * S,
1283 uint32_t blockSize);
1286 * @brief Initialization function for the Q31 Biquad cascade filter.
1287 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
1288 * @param[in] numStages number of 2nd order stages in the filter.
1289 * @param[in] *pCoeffs points to the filter coefficients.
1290 * @param[in] *pState points to the state buffer.
1291 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1295 void arm_biquad_cascade_df1_init_q31(
1296 arm_biquad_casd_df1_inst_q31 * S,
1303 * @brief Processing function for the floating-point Biquad cascade filter.
1304 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
1305 * @param[in] *pSrc points to the block of input data.
1306 * @param[out] *pDst points to the block of output data.
1307 * @param[in] blockSize number of samples to process.
1311 void arm_biquad_cascade_df1_f32(
1312 const arm_biquad_casd_df1_inst_f32 * S,
1315 uint32_t blockSize);
1318 * @brief Initialization function for the floating-point Biquad cascade filter.
1319 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
1320 * @param[in] numStages number of 2nd order stages in the filter.
1321 * @param[in] *pCoeffs points to the filter coefficients.
1322 * @param[in] *pState points to the state buffer.
1326 void arm_biquad_cascade_df1_init_f32(
1327 arm_biquad_casd_df1_inst_f32 * S,
1329 float32_t * pCoeffs,
1330 float32_t * pState);
1334 * @brief Instance structure for the floating-point matrix structure.
1339 uint16_t numRows; /**< number of rows of the matrix. */
1340 uint16_t numCols; /**< number of columns of the matrix. */
1341 float32_t *pData; /**< points to the data of the matrix. */
1342 } arm_matrix_instance_f32;
1345 * @brief Instance structure for the Q15 matrix structure.
1350 uint16_t numRows; /**< number of rows of the matrix. */
1351 uint16_t numCols; /**< number of columns of the matrix. */
1352 q15_t *pData; /**< points to the data of the matrix. */
1354 } arm_matrix_instance_q15;
1357 * @brief Instance structure for the Q31 matrix structure.
1362 uint16_t numRows; /**< number of rows of the matrix. */
1363 uint16_t numCols; /**< number of columns of the matrix. */
1364 q31_t *pData; /**< points to the data of the matrix. */
1366 } arm_matrix_instance_q31;
1371 * @brief Floating-point matrix addition.
1372 * @param[in] *pSrcA points to the first input matrix structure
1373 * @param[in] *pSrcB points to the second input matrix structure
1374 * @param[out] *pDst points to output matrix structure
1375 * @return The function returns either
1376 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1379 arm_status arm_mat_add_f32(
1380 const arm_matrix_instance_f32 * pSrcA,
1381 const arm_matrix_instance_f32 * pSrcB,
1382 arm_matrix_instance_f32 * pDst);
1385 * @brief Q15 matrix addition.
1386 * @param[in] *pSrcA points to the first input matrix structure
1387 * @param[in] *pSrcB points to the second input matrix structure
1388 * @param[out] *pDst points to output matrix structure
1389 * @return The function returns either
1390 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1393 arm_status arm_mat_add_q15(
1394 const arm_matrix_instance_q15 * pSrcA,
1395 const arm_matrix_instance_q15 * pSrcB,
1396 arm_matrix_instance_q15 * pDst);
1399 * @brief Q31 matrix addition.
1400 * @param[in] *pSrcA points to the first input matrix structure
1401 * @param[in] *pSrcB points to the second input matrix structure
1402 * @param[out] *pDst points to output matrix structure
1403 * @return The function returns either
1404 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1407 arm_status arm_mat_add_q31(
1408 const arm_matrix_instance_q31 * pSrcA,
1409 const arm_matrix_instance_q31 * pSrcB,
1410 arm_matrix_instance_q31 * pDst);
1414 * @brief Floating-point matrix transpose.
1415 * @param[in] *pSrc points to the input matrix
1416 * @param[out] *pDst points to the output matrix
1417 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1418 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1421 arm_status arm_mat_trans_f32(
1422 const arm_matrix_instance_f32 * pSrc,
1423 arm_matrix_instance_f32 * pDst);
1427 * @brief Q15 matrix transpose.
1428 * @param[in] *pSrc points to the input matrix
1429 * @param[out] *pDst points to the output matrix
1430 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1431 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1434 arm_status arm_mat_trans_q15(
1435 const arm_matrix_instance_q15 * pSrc,
1436 arm_matrix_instance_q15 * pDst);
1439 * @brief Q31 matrix transpose.
1440 * @param[in] *pSrc points to the input matrix
1441 * @param[out] *pDst points to the output matrix
1442 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1443 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1446 arm_status arm_mat_trans_q31(
1447 const arm_matrix_instance_q31 * pSrc,
1448 arm_matrix_instance_q31 * pDst);
1452 * @brief Floating-point matrix multiplication
1453 * @param[in] *pSrcA points to the first input matrix structure
1454 * @param[in] *pSrcB points to the second input matrix structure
1455 * @param[out] *pDst points to output matrix structure
1456 * @return The function returns either
1457 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1460 arm_status arm_mat_mult_f32(
1461 const arm_matrix_instance_f32 * pSrcA,
1462 const arm_matrix_instance_f32 * pSrcB,
1463 arm_matrix_instance_f32 * pDst);
1466 * @brief Q15 matrix multiplication
1467 * @param[in] *pSrcA points to the first input matrix structure
1468 * @param[in] *pSrcB points to the second input matrix structure
1469 * @param[out] *pDst points to output matrix structure
1470 * @return The function returns either
1471 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1474 arm_status arm_mat_mult_q15(
1475 const arm_matrix_instance_q15 * pSrcA,
1476 const arm_matrix_instance_q15 * pSrcB,
1477 arm_matrix_instance_q15 * pDst,
1481 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1482 * @param[in] *pSrcA points to the first input matrix structure
1483 * @param[in] *pSrcB points to the second input matrix structure
1484 * @param[out] *pDst points to output matrix structure
1485 * @param[in] *pState points to the array for storing intermediate results
1486 * @return The function returns either
1487 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1490 arm_status arm_mat_mult_fast_q15(
1491 const arm_matrix_instance_q15 * pSrcA,
1492 const arm_matrix_instance_q15 * pSrcB,
1493 arm_matrix_instance_q15 * pDst,
1497 * @brief Q31 matrix multiplication
1498 * @param[in] *pSrcA points to the first input matrix structure
1499 * @param[in] *pSrcB points to the second input matrix structure
1500 * @param[out] *pDst points to output matrix structure
1501 * @return The function returns either
1502 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1505 arm_status arm_mat_mult_q31(
1506 const arm_matrix_instance_q31 * pSrcA,
1507 const arm_matrix_instance_q31 * pSrcB,
1508 arm_matrix_instance_q31 * pDst);
1511 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1512 * @param[in] *pSrcA points to the first input matrix structure
1513 * @param[in] *pSrcB points to the second input matrix structure
1514 * @param[out] *pDst points to output matrix structure
1515 * @return The function returns either
1516 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1519 arm_status arm_mat_mult_fast_q31(
1520 const arm_matrix_instance_q31 * pSrcA,
1521 const arm_matrix_instance_q31 * pSrcB,
1522 arm_matrix_instance_q31 * pDst);
1526 * @brief Floating-point matrix subtraction
1527 * @param[in] *pSrcA points to the first input matrix structure
1528 * @param[in] *pSrcB points to the second input matrix structure
1529 * @param[out] *pDst points to output matrix structure
1530 * @return The function returns either
1531 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1534 arm_status arm_mat_sub_f32(
1535 const arm_matrix_instance_f32 * pSrcA,
1536 const arm_matrix_instance_f32 * pSrcB,
1537 arm_matrix_instance_f32 * pDst);
1540 * @brief Q15 matrix subtraction
1541 * @param[in] *pSrcA points to the first input matrix structure
1542 * @param[in] *pSrcB points to the second input matrix structure
1543 * @param[out] *pDst points to output matrix structure
1544 * @return The function returns either
1545 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1548 arm_status arm_mat_sub_q15(
1549 const arm_matrix_instance_q15 * pSrcA,
1550 const arm_matrix_instance_q15 * pSrcB,
1551 arm_matrix_instance_q15 * pDst);
1554 * @brief Q31 matrix subtraction
1555 * @param[in] *pSrcA points to the first input matrix structure
1556 * @param[in] *pSrcB points to the second input matrix structure
1557 * @param[out] *pDst points to output matrix structure
1558 * @return The function returns either
1559 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1562 arm_status arm_mat_sub_q31(
1563 const arm_matrix_instance_q31 * pSrcA,
1564 const arm_matrix_instance_q31 * pSrcB,
1565 arm_matrix_instance_q31 * pDst);
1568 * @brief Floating-point matrix scaling.
1569 * @param[in] *pSrc points to the input matrix
1570 * @param[in] scale scale factor
1571 * @param[out] *pDst points to the output matrix
1572 * @return The function returns either
1573 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1576 arm_status arm_mat_scale_f32(
1577 const arm_matrix_instance_f32 * pSrc,
1579 arm_matrix_instance_f32 * pDst);
1582 * @brief Q15 matrix scaling.
1583 * @param[in] *pSrc points to input matrix
1584 * @param[in] scaleFract fractional portion of the scale factor
1585 * @param[in] shift number of bits to shift the result by
1586 * @param[out] *pDst points to output matrix
1587 * @return The function returns either
1588 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1591 arm_status arm_mat_scale_q15(
1592 const arm_matrix_instance_q15 * pSrc,
1595 arm_matrix_instance_q15 * pDst);
1598 * @brief Q31 matrix scaling.
1599 * @param[in] *pSrc points to input matrix
1600 * @param[in] scaleFract fractional portion of the scale factor
1601 * @param[in] shift number of bits to shift the result by
1602 * @param[out] *pDst points to output matrix structure
1603 * @return The function returns either
1604 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1607 arm_status arm_mat_scale_q31(
1608 const arm_matrix_instance_q31 * pSrc,
1611 arm_matrix_instance_q31 * pDst);
1615 * @brief Q31 matrix initialization.
1616 * @param[in,out] *S points to an instance of the floating-point matrix structure.
1617 * @param[in] nRows number of rows in the matrix.
1618 * @param[in] nColumns number of columns in the matrix.
1619 * @param[in] *pData points to the matrix data array.
1623 void arm_mat_init_q31(
1624 arm_matrix_instance_q31 * S,
1630 * @brief Q15 matrix initialization.
1631 * @param[in,out] *S points to an instance of the floating-point matrix structure.
1632 * @param[in] nRows number of rows in the matrix.
1633 * @param[in] nColumns number of columns in the matrix.
1634 * @param[in] *pData points to the matrix data array.
1638 void arm_mat_init_q15(
1639 arm_matrix_instance_q15 * S,
1645 * @brief Floating-point matrix initialization.
1646 * @param[in,out] *S points to an instance of the floating-point matrix structure.
1647 * @param[in] nRows number of rows in the matrix.
1648 * @param[in] nColumns number of columns in the matrix.
1649 * @param[in] *pData points to the matrix data array.
1653 void arm_mat_init_f32(
1654 arm_matrix_instance_f32 * S,
1662 * @brief Instance structure for the Q15 PID Control.
1666 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1671 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
1673 q15_t state[3]; /**< The state array of length 3. */
1674 q15_t Kp; /**< The proportional gain. */
1675 q15_t Ki; /**< The integral gain. */
1676 q15_t Kd; /**< The derivative gain. */
1677 } arm_pid_instance_q15;
1680 * @brief Instance structure for the Q31 PID Control.
1684 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1685 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
1686 q31_t A2; /**< The derived gain, A2 = Kd . */
1687 q31_t state[3]; /**< The state array of length 3. */
1688 q31_t Kp; /**< The proportional gain. */
1689 q31_t Ki; /**< The integral gain. */
1690 q31_t Kd; /**< The derivative gain. */
1692 } arm_pid_instance_q31;
1695 * @brief Instance structure for the floating-point PID Control.
1699 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1700 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
1701 float32_t A2; /**< The derived gain, A2 = Kd . */
1702 float32_t state[3]; /**< The state array of length 3. */
1703 float32_t Kp; /**< The proportional gain. */
1704 float32_t Ki; /**< The integral gain. */
1705 float32_t Kd; /**< The derivative gain. */
1706 } arm_pid_instance_f32;
1711 * @brief Initialization function for the floating-point PID Control.
1712 * @param[in,out] *S points to an instance of the PID structure.
1713 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1716 void arm_pid_init_f32(
1717 arm_pid_instance_f32 * S,
1718 int32_t resetStateFlag);
1721 * @brief Reset function for the floating-point PID Control.
1722 * @param[in,out] *S is an instance of the floating-point PID Control structure
1725 void arm_pid_reset_f32(
1726 arm_pid_instance_f32 * S);
1730 * @brief Initialization function for the Q31 PID Control.
1731 * @param[in,out] *S points to an instance of the Q15 PID structure.
1732 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1735 void arm_pid_init_q31(
1736 arm_pid_instance_q31 * S,
1737 int32_t resetStateFlag);
1741 * @brief Reset function for the Q31 PID Control.
1742 * @param[in,out] *S points to an instance of the Q31 PID Control structure
1746 void arm_pid_reset_q31(
1747 arm_pid_instance_q31 * S);
1750 * @brief Initialization function for the Q15 PID Control.
1751 * @param[in,out] *S points to an instance of the Q15 PID structure.
1752 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1755 void arm_pid_init_q15(
1756 arm_pid_instance_q15 * S,
1757 int32_t resetStateFlag);
1760 * @brief Reset function for the Q15 PID Control.
1761 * @param[in,out] *S points to an instance of the q15 PID Control structure
1764 void arm_pid_reset_q15(
1765 arm_pid_instance_q15 * S);
1769 * @brief Instance structure for the floating-point Linear Interpolate function.
1776 float32_t *pYData; /**< pointer to the table of Y values */
1777 } arm_linear_interp_instance_f32;
1780 * @brief Instance structure for the floating-point bilinear interpolation function.
1785 uint16_t numRows; /**< number of rows in the data table. */
1786 uint16_t numCols; /**< number of columns in the data table. */
1787 float32_t *pData; /**< points to the data table. */
1788 } arm_bilinear_interp_instance_f32;
1791 * @brief Instance structure for the Q31 bilinear interpolation function.
1796 uint16_t numRows; /**< number of rows in the data table. */
1797 uint16_t numCols; /**< number of columns in the data table. */
1798 q31_t *pData; /**< points to the data table. */
1799 } arm_bilinear_interp_instance_q31;
1802 * @brief Instance structure for the Q15 bilinear interpolation function.
1807 uint16_t numRows; /**< number of rows in the data table. */
1808 uint16_t numCols; /**< number of columns in the data table. */
1809 q15_t *pData; /**< points to the data table. */
1810 } arm_bilinear_interp_instance_q15;
1813 * @brief Instance structure for the Q15 bilinear interpolation function.
1818 uint16_t numRows; /**< number of rows in the data table. */
1819 uint16_t numCols; /**< number of columns in the data table. */
1820 q7_t *pData; /**< points to the data table. */
1821 } arm_bilinear_interp_instance_q7;
1825 * @brief Q7 vector multiplication.
1826 * @param[in] *pSrcA points to the first input vector
1827 * @param[in] *pSrcB points to the second input vector
1828 * @param[out] *pDst points to the output vector
1829 * @param[in] blockSize number of samples in each vector
1837 uint32_t blockSize);
1840 * @brief Q15 vector multiplication.
1841 * @param[in] *pSrcA points to the first input vector
1842 * @param[in] *pSrcB points to the second input vector
1843 * @param[out] *pDst points to the output vector
1844 * @param[in] blockSize number of samples in each vector
1852 uint32_t blockSize);
1855 * @brief Q31 vector multiplication.
1856 * @param[in] *pSrcA points to the first input vector
1857 * @param[in] *pSrcB points to the second input vector
1858 * @param[out] *pDst points to the output vector
1859 * @param[in] blockSize number of samples in each vector
1867 uint32_t blockSize);
1870 * @brief Floating-point vector multiplication.
1871 * @param[in] *pSrcA points to the first input vector
1872 * @param[in] *pSrcB points to the second input vector
1873 * @param[out] *pDst points to the output vector
1874 * @param[in] blockSize number of samples in each vector
1882 uint32_t blockSize);
1886 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1891 uint16_t fftLen; /**< length of the FFT. */
1892 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1893 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1894 q15_t *pTwiddle; /**< points to the twiddle factor table. */
1895 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
1896 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1897 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1898 } arm_cfft_radix4_instance_q15;
1901 * @brief Instance structure for the Q31 CFFT/CIFFT function.
1906 uint16_t fftLen; /**< length of the FFT. */
1907 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1908 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1909 q31_t *pTwiddle; /**< points to the twiddle factor table. */
1910 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
1911 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1912 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1913 } arm_cfft_radix4_instance_q31;
1916 * @brief Instance structure for the floating-point CFFT/CIFFT function.
1921 uint16_t fftLen; /**< length of the FFT. */
1922 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1923 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1924 float32_t *pTwiddle; /**< points to the twiddle factor table. */
1925 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
1926 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1927 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1928 float32_t onebyfftLen; /**< value of 1/fftLen. */
1929 } arm_cfft_radix4_instance_f32;
1932 * @brief Processing function for the Q15 CFFT/CIFFT.
1933 * @param[in] *S points to an instance of the Q15 CFFT/CIFFT structure.
1934 * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
1938 void arm_cfft_radix4_q15(
1939 const arm_cfft_radix4_instance_q15 * S,
1943 * @brief Initialization function for the Q15 CFFT/CIFFT.
1944 * @param[in,out] *S points to an instance of the Q15 CFFT/CIFFT structure.
1945 * @param[in] fftLen length of the FFT.
1946 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
1947 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
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.
1951 arm_status arm_cfft_radix4_init_q15(
1952 arm_cfft_radix4_instance_q15 * S,
1955 uint8_t bitReverseFlag);
1958 * @brief Processing function for the Q31 CFFT/CIFFT.
1959 * @param[in] *S points to an instance of the Q31 CFFT/CIFFT structure.
1960 * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
1964 void arm_cfft_radix4_q31(
1965 const arm_cfft_radix4_instance_q31 * S,
1969 * @brief Initialization function for the Q31 CFFT/CIFFT.
1970 * @param[in,out] *S points to an instance of the Q31 CFFT/CIFFT structure.
1971 * @param[in] fftLen length of the FFT.
1972 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
1973 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
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.
1977 arm_status arm_cfft_radix4_init_q31(
1978 arm_cfft_radix4_instance_q31 * S,
1981 uint8_t bitReverseFlag);
1984 * @brief Processing function for the floating-point CFFT/CIFFT.
1985 * @param[in] *S points to an instance of the floating-point CFFT/CIFFT structure.
1986 * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
1990 void arm_cfft_radix4_f32(
1991 const arm_cfft_radix4_instance_f32 * S,
1995 * @brief Initialization function for the floating-point CFFT/CIFFT.
1996 * @param[in,out] *S points to an instance of the floating-point CFFT/CIFFT structure.
1997 * @param[in] fftLen length of the FFT.
1998 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
1999 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
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.
2003 arm_status arm_cfft_radix4_init_f32(
2004 arm_cfft_radix4_instance_f32 * S,
2007 uint8_t bitReverseFlag);
2011 /*----------------------------------------------------------------------
2012 * Internal functions prototypes FFT function
2013 ----------------------------------------------------------------------*/
2016 * @brief Core function for the floating-point CFFT butterfly process.
2017 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
2018 * @param[in] fftLen length of the FFT.
2019 * @param[in] *pCoef points to the twiddle coefficient buffer.
2020 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
2024 void arm_radix4_butterfly_f32(
2028 uint16_t twidCoefModifier);
2031 * @brief Core function for the floating-point CIFFT butterfly process.
2032 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
2033 * @param[in] fftLen length of the FFT.
2034 * @param[in] *pCoef points to twiddle coefficient buffer.
2035 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
2036 * @param[in] onebyfftLen value of 1/fftLen.
2040 void arm_radix4_butterfly_inverse_f32(
2044 uint16_t twidCoefModifier,
2045 float32_t onebyfftLen);
2048 * @brief In-place bit reversal function.
2049 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
2050 * @param[in] fftSize length of the FFT.
2051 * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table.
2052 * @param[in] *pBitRevTab points to the bit reversal table.
2056 void arm_bitreversal_f32(
2059 uint16_t bitRevFactor,
2060 uint16_t *pBitRevTab);
2063 * @brief Core function for the Q31 CFFT butterfly process.
2064 * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
2065 * @param[in] fftLen length of the FFT.
2066 * @param[in] *pCoef points to twiddle coefficient buffer.
2067 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
2071 void arm_radix4_butterfly_q31(
2075 uint32_t twidCoefModifier);
2078 * @brief Core function for the Q31 CIFFT butterfly process.
2079 * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
2080 * @param[in] fftLen length of the FFT.
2081 * @param[in] *pCoef points to twiddle coefficient buffer.
2082 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
2086 void arm_radix4_butterfly_inverse_q31(
2090 uint32_t twidCoefModifier);
2093 * @brief In-place bit reversal function.
2094 * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
2095 * @param[in] fftLen length of the FFT.
2096 * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
2097 * @param[in] *pBitRevTab points to bit reversal table.
2101 void arm_bitreversal_q31(
2104 uint16_t bitRevFactor,
2105 uint16_t *pBitRevTab);
2108 * @brief Core function for the Q15 CFFT butterfly process.
2109 * @param[in, out] *pSrc16 points to the in-place buffer of Q15 data type.
2110 * @param[in] fftLen length of the FFT.
2111 * @param[in] *pCoef16 points to twiddle coefficient buffer.
2112 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
2116 void arm_radix4_butterfly_q15(
2120 uint32_t twidCoefModifier);
2123 * @brief Core function for the Q15 CIFFT butterfly process.
2124 * @param[in, out] *pSrc16 points to the in-place buffer of Q15 data type.
2125 * @param[in] fftLen length of the FFT.
2126 * @param[in] *pCoef16 points to twiddle coefficient buffer.
2127 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
2131 void arm_radix4_butterfly_inverse_q15(
2135 uint32_t twidCoefModifier);
2138 * @brief In-place bit reversal function.
2139 * @param[in, out] *pSrc points to the in-place buffer of Q15 data type.
2140 * @param[in] fftLen length of the FFT.
2141 * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
2142 * @param[in] *pBitRevTab points to bit reversal table.
2146 void arm_bitreversal_q15(
2149 uint16_t bitRevFactor,
2150 uint16_t *pBitRevTab);
2153 * @brief Instance structure for the Q15 RFFT/RIFFT function.
2158 uint32_t fftLenReal; /**< length of the real FFT. */
2159 uint32_t fftLenBy2; /**< length of the complex FFT. */
2160 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2161 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2162 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2163 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2164 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2165 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
2166 } arm_rfft_instance_q15;
2169 * @brief Instance structure for the Q31 RFFT/RIFFT function.
2174 uint32_t fftLenReal; /**< length of the real FFT. */
2175 uint32_t fftLenBy2; /**< length of the complex FFT. */
2176 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2177 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2178 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2179 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2180 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2181 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
2182 } arm_rfft_instance_q31;
2185 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2190 uint32_t fftLenReal; /**< length of the real FFT. */
2191 uint16_t fftLenBy2; /**< length of the complex FFT. */
2192 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2193 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2194 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2195 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2196 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2197 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
2198 } arm_rfft_instance_f32;
2201 * @brief Processing function for the Q15 RFFT/RIFFT.
2202 * @param[in] *S points to an instance of the Q15 RFFT/RIFFT structure.
2203 * @param[in] *pSrc points to the input buffer.
2204 * @param[out] *pDst points to the output buffer.
2209 const arm_rfft_instance_q15 * S,
2214 * @brief Initialization function for the Q15 RFFT/RIFFT.
2215 * @param[in, out] *S points to an instance of the Q15 RFFT/RIFFT structure.
2216 * @param[in] *S_CFFT points to an instance of the Q15 CFFT/CIFFT structure.
2217 * @param[in] fftLenReal length of the FFT.
2218 * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
2219 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
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.
2223 arm_status arm_rfft_init_q15(
2224 arm_rfft_instance_q15 * S,
2225 arm_cfft_radix4_instance_q15 * S_CFFT,
2226 uint32_t fftLenReal,
2228 uint32_t bitReverseFlag);
2231 * @brief Processing function for the Q31 RFFT/RIFFT.
2232 * @param[in] *S points to an instance of the Q31 RFFT/RIFFT structure.
2233 * @param[in] *pSrc points to the input buffer.
2234 * @param[out] *pDst points to the output buffer.
2239 const arm_rfft_instance_q31 * S,
2244 * @brief Initialization function for the Q31 RFFT/RIFFT.
2245 * @param[in, out] *S points to an instance of the Q31 RFFT/RIFFT structure.
2246 * @param[in, out] *S_CFFT points to an instance of the Q31 CFFT/CIFFT structure.
2247 * @param[in] fftLenReal length of the FFT.
2248 * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
2249 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
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.
2253 arm_status arm_rfft_init_q31(
2254 arm_rfft_instance_q31 * S,
2255 arm_cfft_radix4_instance_q31 * S_CFFT,
2256 uint32_t fftLenReal,
2258 uint32_t bitReverseFlag);
2261 * @brief Initialization function for the floating-point RFFT/RIFFT.
2262 * @param[in,out] *S points to an instance of the floating-point RFFT/RIFFT structure.
2263 * @param[in,out] *S_CFFT points to an instance of the floating-point CFFT/CIFFT structure.
2264 * @param[in] fftLenReal length of the FFT.
2265 * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
2266 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
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.
2270 arm_status arm_rfft_init_f32(
2271 arm_rfft_instance_f32 * S,
2272 arm_cfft_radix4_instance_f32 * S_CFFT,
2273 uint32_t fftLenReal,
2275 uint32_t bitReverseFlag);
2278 * @brief Processing function for the floating-point RFFT/RIFFT.
2279 * @param[in] *S points to an instance of the floating-point RFFT/RIFFT structure.
2280 * @param[in] *pSrc points to the input buffer.
2281 * @param[out] *pDst points to the output buffer.
2286 const arm_rfft_instance_f32 * S,
2291 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
2296 uint16_t N; /**< length of the DCT4. */
2297 uint16_t Nby2; /**< half of the length of the DCT4. */
2298 float32_t normalize; /**< normalizing factor. */
2299 float32_t *pTwiddle; /**< points to the twiddle factor table. */
2300 float32_t *pCosFactor; /**< points to the cosFactor table. */
2301 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
2302 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
2303 } arm_dct4_instance_f32;
2306 * @brief Initialization function for the floating-point DCT4/IDCT4.
2307 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
2308 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
2309 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
2310 * @param[in] N length of the DCT4.
2311 * @param[in] Nby2 half of the length of the DCT4.
2312 * @param[in] normalize normalizing factor.
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.
2316 arm_status arm_dct4_init_f32(
2317 arm_dct4_instance_f32 * S,
2318 arm_rfft_instance_f32 * S_RFFT,
2319 arm_cfft_radix4_instance_f32 * S_CFFT,
2322 float32_t normalize);
2325 * @brief Processing function for the floating-point DCT4/IDCT4.
2326 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
2327 * @param[in] *pState points to state buffer.
2328 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
2333 const arm_dct4_instance_f32 * S,
2335 float32_t * pInlineBuffer);
2338 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
2343 uint16_t N; /**< length of the DCT4. */
2344 uint16_t Nby2; /**< half of the length of the DCT4. */
2345 q31_t normalize; /**< normalizing factor. */
2346 q31_t *pTwiddle; /**< points to the twiddle factor table. */
2347 q31_t *pCosFactor; /**< points to the cosFactor table. */
2348 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
2349 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
2350 } arm_dct4_instance_q31;
2353 * @brief Initialization function for the Q31 DCT4/IDCT4.
2354 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
2355 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
2356 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
2357 * @param[in] N length of the DCT4.
2358 * @param[in] Nby2 half of the length of the DCT4.
2359 * @param[in] normalize normalizing factor.
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.
2363 arm_status arm_dct4_init_q31(
2364 arm_dct4_instance_q31 * S,
2365 arm_rfft_instance_q31 * S_RFFT,
2366 arm_cfft_radix4_instance_q31 * S_CFFT,
2372 * @brief Processing function for the Q31 DCT4/IDCT4.
2373 * @param[in] *S points to an instance of the Q31 DCT4 structure.
2374 * @param[in] *pState points to state buffer.
2375 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
2380 const arm_dct4_instance_q31 * S,
2382 q31_t * pInlineBuffer);
2385 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
2390 uint16_t N; /**< length of the DCT4. */
2391 uint16_t Nby2; /**< half of the length of the DCT4. */
2392 q15_t normalize; /**< normalizing factor. */
2393 q15_t *pTwiddle; /**< points to the twiddle factor table. */
2394 q15_t *pCosFactor; /**< points to the cosFactor table. */
2395 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
2396 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
2397 } arm_dct4_instance_q15;
2400 * @brief Initialization function for the Q15 DCT4/IDCT4.
2401 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
2402 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
2403 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
2404 * @param[in] N length of the DCT4.
2405 * @param[in] Nby2 half of the length of the DCT4.
2406 * @param[in] normalize normalizing factor.
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.
2410 arm_status arm_dct4_init_q15(
2411 arm_dct4_instance_q15 * S,
2412 arm_rfft_instance_q15 * S_RFFT,
2413 arm_cfft_radix4_instance_q15 * S_CFFT,
2419 * @brief Processing function for the Q15 DCT4/IDCT4.
2420 * @param[in] *S points to an instance of the Q15 DCT4 structure.
2421 * @param[in] *pState points to state buffer.
2422 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
2427 const arm_dct4_instance_q15 * S,
2429 q15_t * pInlineBuffer);
2432 * @brief Floating-point vector addition.
2433 * @param[in] *pSrcA points to the first input vector
2434 * @param[in] *pSrcB points to the second input vector
2435 * @param[out] *pDst points to the output vector
2436 * @param[in] blockSize number of samples in each vector
2444 uint32_t blockSize);
2447 * @brief Q7 vector addition.
2448 * @param[in] *pSrcA points to the first input vector
2449 * @param[in] *pSrcB points to the second input vector
2450 * @param[out] *pDst points to the output vector
2451 * @param[in] blockSize number of samples in each vector
2459 uint32_t blockSize);
2462 * @brief Q15 vector addition.
2463 * @param[in] *pSrcA points to the first input vector
2464 * @param[in] *pSrcB points to the second input vector
2465 * @param[out] *pDst points to the output vector
2466 * @param[in] blockSize number of samples in each vector
2474 uint32_t blockSize);
2477 * @brief Q31 vector addition.
2478 * @param[in] *pSrcA points to the first input vector
2479 * @param[in] *pSrcB points to the second input vector
2480 * @param[out] *pDst points to the output vector
2481 * @param[in] blockSize number of samples in each vector
2489 uint32_t blockSize);
2492 * @brief Floating-point vector subtraction.
2493 * @param[in] *pSrcA points to the first input vector
2494 * @param[in] *pSrcB points to the second input vector
2495 * @param[out] *pDst points to the output vector
2496 * @param[in] blockSize number of samples in each vector
2504 uint32_t blockSize);
2507 * @brief Q7 vector subtraction.
2508 * @param[in] *pSrcA points to the first input vector
2509 * @param[in] *pSrcB points to the second input vector
2510 * @param[out] *pDst points to the output vector
2511 * @param[in] blockSize number of samples in each vector
2519 uint32_t blockSize);
2522 * @brief Q15 vector subtraction.
2523 * @param[in] *pSrcA points to the first input vector
2524 * @param[in] *pSrcB points to the second input vector
2525 * @param[out] *pDst points to the output vector
2526 * @param[in] blockSize number of samples in each vector
2534 uint32_t blockSize);
2537 * @brief Q31 vector subtraction.
2538 * @param[in] *pSrcA points to the first input vector
2539 * @param[in] *pSrcB points to the second input vector
2540 * @param[out] *pDst points to the output vector
2541 * @param[in] blockSize number of samples in each vector
2549 uint32_t blockSize);
2552 * @brief Multiplies a floating-point vector by a scalar.
2553 * @param[in] *pSrc points to the input vector
2554 * @param[in] scale scale factor to be applied
2555 * @param[out] *pDst points to the output vector
2556 * @param[in] blockSize number of samples in the vector
2564 uint32_t blockSize);
2567 * @brief Multiplies a Q7 vector by a scalar.
2568 * @param[in] *pSrc points to the input vector
2569 * @param[in] scaleFract fractional portion of the scale value
2570 * @param[in] shift number of bits to shift the result by
2571 * @param[out] *pDst points to the output vector
2572 * @param[in] blockSize number of samples in the vector
2581 uint32_t blockSize);
2584 * @brief Multiplies a Q15 vector by a scalar.
2585 * @param[in] *pSrc points to the input vector
2586 * @param[in] scaleFract fractional portion of the scale value
2587 * @param[in] shift number of bits to shift the result by
2588 * @param[out] *pDst points to the output vector
2589 * @param[in] blockSize number of samples in the vector
2598 uint32_t blockSize);
2601 * @brief Multiplies a Q31 vector by a scalar.
2602 * @param[in] *pSrc points to the input vector
2603 * @param[in] scaleFract fractional portion of the scale value
2604 * @param[in] shift number of bits to shift the result by
2605 * @param[out] *pDst points to the output vector
2606 * @param[in] blockSize number of samples in the vector
2615 uint32_t blockSize);
2618 * @brief Q7 vector absolute value.
2619 * @param[in] *pSrc points to the input buffer
2620 * @param[out] *pDst points to the output buffer
2621 * @param[in] blockSize number of samples in each vector
2628 uint32_t blockSize);
2631 * @brief Floating-point vector absolute value.
2632 * @param[in] *pSrc points to the input buffer
2633 * @param[out] *pDst points to the output buffer
2634 * @param[in] blockSize number of samples in each vector
2641 uint32_t blockSize);
2644 * @brief Q15 vector absolute value.
2645 * @param[in] *pSrc points to the input buffer
2646 * @param[out] *pDst points to the output buffer
2647 * @param[in] blockSize number of samples in each vector
2654 uint32_t blockSize);
2657 * @brief Q31 vector absolute value.
2658 * @param[in] *pSrc points to the input buffer
2659 * @param[out] *pDst points to the output buffer
2660 * @param[in] blockSize number of samples in each vector
2667 uint32_t blockSize);
2670 * @brief Dot product of floating-point vectors.
2671 * @param[in] *pSrcA points to the first input vector
2672 * @param[in] *pSrcB points to the second input vector
2673 * @param[in] blockSize number of samples in each vector
2674 * @param[out] *result output result returned here
2678 void arm_dot_prod_f32(
2682 float32_t * result);
2685 * @brief Dot product of Q7 vectors.
2686 * @param[in] *pSrcA points to the first input vector
2687 * @param[in] *pSrcB points to the second input vector
2688 * @param[in] blockSize number of samples in each vector
2689 * @param[out] *result output result returned here
2693 void arm_dot_prod_q7(
2700 * @brief Dot product of Q15 vectors.
2701 * @param[in] *pSrcA points to the first input vector
2702 * @param[in] *pSrcB points to the second input vector
2703 * @param[in] blockSize number of samples in each vector
2704 * @param[out] *result output result returned here
2708 void arm_dot_prod_q15(
2715 * @brief Dot product of Q31 vectors.
2716 * @param[in] *pSrcA points to the first input vector
2717 * @param[in] *pSrcB points to the second input vector
2718 * @param[in] blockSize number of samples in each vector
2719 * @param[out] *result output result returned here
2723 void arm_dot_prod_q31(
2730 * @brief Shifts the elements of a Q7 vector a specified number of bits.
2731 * @param[in] *pSrc points to the input vector
2732 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2733 * @param[out] *pDst points to the output vector
2734 * @param[in] blockSize number of samples in the vector
2742 uint32_t blockSize);
2745 * @brief Shifts the elements of a Q15 vector a specified number of bits.
2746 * @param[in] *pSrc points to the input vector
2747 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2748 * @param[out] *pDst points to the output vector
2749 * @param[in] blockSize number of samples in the vector
2757 uint32_t blockSize);
2760 * @brief Shifts the elements of a Q31 vector a specified number of bits.
2761 * @param[in] *pSrc points to the input vector
2762 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2763 * @param[out] *pDst points to the output vector
2764 * @param[in] blockSize number of samples in the vector
2772 uint32_t blockSize);
2775 * @brief Adds a constant offset to a floating-point vector.
2776 * @param[in] *pSrc points to the input vector
2777 * @param[in] offset is the offset to be added
2778 * @param[out] *pDst points to the output vector
2779 * @param[in] blockSize number of samples in the vector
2783 void arm_offset_f32(
2787 uint32_t blockSize);
2790 * @brief Adds a constant offset to a Q7 vector.
2791 * @param[in] *pSrc points to the input vector
2792 * @param[in] offset is the offset to be added
2793 * @param[out] *pDst points to the output vector
2794 * @param[in] blockSize number of samples in the vector
2802 uint32_t blockSize);
2805 * @brief Adds a constant offset to a Q15 vector.
2806 * @param[in] *pSrc points to the input vector
2807 * @param[in] offset is the offset to be added
2808 * @param[out] *pDst points to the output vector
2809 * @param[in] blockSize number of samples in the vector
2813 void arm_offset_q15(
2817 uint32_t blockSize);
2820 * @brief Adds a constant offset to a Q31 vector.
2821 * @param[in] *pSrc points to the input vector
2822 * @param[in] offset is the offset to be added
2823 * @param[out] *pDst points to the output vector
2824 * @param[in] blockSize number of samples in the vector
2828 void arm_offset_q31(
2832 uint32_t blockSize);
2835 * @brief Negates the elements of a floating-point vector.
2836 * @param[in] *pSrc points to the input vector
2837 * @param[out] *pDst points to the output vector
2838 * @param[in] blockSize number of samples in the vector
2842 void arm_negate_f32(
2845 uint32_t blockSize);
2848 * @brief Negates the elements of a Q7 vector.
2849 * @param[in] *pSrc points to the input vector
2850 * @param[out] *pDst points to the output vector
2851 * @param[in] blockSize number of samples in the vector
2858 uint32_t blockSize);
2861 * @brief Negates the elements of a Q15 vector.
2862 * @param[in] *pSrc points to the input vector
2863 * @param[out] *pDst points to the output vector
2864 * @param[in] blockSize number of samples in the vector
2868 void arm_negate_q15(
2871 uint32_t blockSize);
2874 * @brief Negates the elements of a Q31 vector.
2875 * @param[in] *pSrc points to the input vector
2876 * @param[out] *pDst points to the output vector
2877 * @param[in] blockSize number of samples in the vector
2881 void arm_negate_q31(
2884 uint32_t blockSize);
2886 * @brief Copies the elements of a floating-point vector.
2887 * @param[in] *pSrc input pointer
2888 * @param[out] *pDst output pointer
2889 * @param[in] blockSize number of samples to process
2895 uint32_t blockSize);
2898 * @brief Copies the elements of a Q7 vector.
2899 * @param[in] *pSrc input pointer
2900 * @param[out] *pDst output pointer
2901 * @param[in] blockSize number of samples to process
2907 uint32_t blockSize);
2910 * @brief Copies the elements of a Q15 vector.
2911 * @param[in] *pSrc input pointer
2912 * @param[out] *pDst output pointer
2913 * @param[in] blockSize number of samples to process
2919 uint32_t blockSize);
2922 * @brief Copies the elements of a Q31 vector.
2923 * @param[in] *pSrc input pointer
2924 * @param[out] *pDst output pointer
2925 * @param[in] blockSize number of samples to process
2931 uint32_t blockSize);
2933 * @brief Fills a constant value into a floating-point vector.
2934 * @param[in] value input value to be filled
2935 * @param[out] *pDst output pointer
2936 * @param[in] blockSize number of samples to process
2942 uint32_t blockSize);
2945 * @brief Fills a constant value into a Q7 vector.
2946 * @param[in] value input value to be filled
2947 * @param[out] *pDst output pointer
2948 * @param[in] blockSize number of samples to process
2954 uint32_t blockSize);
2957 * @brief Fills a constant value into a Q15 vector.
2958 * @param[in] value input value to be filled
2959 * @param[out] *pDst output pointer
2960 * @param[in] blockSize number of samples to process
2966 uint32_t blockSize);
2969 * @brief Fills a constant value into a Q31 vector.
2970 * @param[in] value input value to be filled
2971 * @param[out] *pDst output pointer
2972 * @param[in] blockSize number of samples to process
2978 uint32_t blockSize);
2981 * @brief Convolution of floating-point sequences.
2982 * @param[in] *pSrcA points to the first input sequence.
2983 * @param[in] srcALen length of the first input sequence.
2984 * @param[in] *pSrcB points to the second input sequence.
2985 * @param[in] srcBLen length of the second input sequence.
2986 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2998 * @brief Convolution of Q15 sequences.
2999 * @param[in] *pSrcA points to the first input sequence.
3000 * @param[in] srcALen length of the first input sequence.
3001 * @param[in] *pSrcB points to the second input sequence.
3002 * @param[in] srcBLen length of the second input sequence.
3003 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
3015 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3016 * @param[in] *pSrcA points to the first input sequence.
3017 * @param[in] srcALen length of the first input sequence.
3018 * @param[in] *pSrcB points to the second input sequence.
3019 * @param[in] srcBLen length of the second input sequence.
3020 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
3024 void arm_conv_fast_q15(
3032 * @brief Convolution of Q31 sequences.
3033 * @param[in] *pSrcA points to the first input sequence.
3034 * @param[in] srcALen length of the first input sequence.
3035 * @param[in] *pSrcB points to the second input sequence.
3036 * @param[in] srcBLen length of the second input sequence.
3037 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
3049 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3050 * @param[in] *pSrcA points to the first input sequence.
3051 * @param[in] srcALen length of the first input sequence.
3052 * @param[in] *pSrcB points to the second input sequence.
3053 * @param[in] srcBLen length of the second input sequence.
3054 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
3058 void arm_conv_fast_q31(
3066 * @brief Convolution of Q7 sequences.
3067 * @param[in] *pSrcA points to the first input sequence.
3068 * @param[in] srcALen length of the first input sequence.
3069 * @param[in] *pSrcB points to the second input sequence.
3070 * @param[in] srcBLen length of the second input sequence.
3071 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
3083 * @brief Partial convolution of floating-point sequences.
3084 * @param[in] *pSrcA points to the first input sequence.
3085 * @param[in] srcALen length of the first input sequence.
3086 * @param[in] *pSrcB points to the second input sequence.
3087 * @param[in] srcBLen length of the second input sequence.
3088 * @param[out] *pDst points to the block of output data
3089 * @param[in] firstIndex is the first output sample to start with.
3090 * @param[in] numPoints is the number of output points to be computed.
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].
3094 arm_status arm_conv_partial_f32(
3100 uint32_t firstIndex,
3101 uint32_t numPoints);
3104 * @brief Partial convolution of Q15 sequences.
3105 * @param[in] *pSrcA points to the first input sequence.
3106 * @param[in] srcALen length of the first input sequence.
3107 * @param[in] *pSrcB points to the second input sequence.
3108 * @param[in] srcBLen length of the second input sequence.
3109 * @param[out] *pDst points to the block of output data
3110 * @param[in] firstIndex is the first output sample to start with.
3111 * @param[in] numPoints is the number of output points to be computed.
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].
3115 arm_status arm_conv_partial_q15(
3121 uint32_t firstIndex,
3122 uint32_t numPoints);
3125 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3126 * @param[in] *pSrcA points to the first input sequence.
3127 * @param[in] srcALen length of the first input sequence.
3128 * @param[in] *pSrcB points to the second input sequence.
3129 * @param[in] srcBLen length of the second input sequence.
3130 * @param[out] *pDst points to the block of output data
3131 * @param[in] firstIndex is the first output sample to start with.
3132 * @param[in] numPoints is the number of output points to be computed.
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].
3136 arm_status arm_conv_partial_fast_q15(
3142 uint32_t firstIndex,
3143 uint32_t numPoints);
3146 * @brief Partial convolution of Q31 sequences.
3147 * @param[in] *pSrcA points to the first input sequence.
3148 * @param[in] srcALen length of the first input sequence.
3149 * @param[in] *pSrcB points to the second input sequence.
3150 * @param[in] srcBLen length of the second input sequence.
3151 * @param[out] *pDst points to the block of output data
3152 * @param[in] firstIndex is the first output sample to start with.
3153 * @param[in] numPoints is the number of output points to be computed.
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].
3157 arm_status arm_conv_partial_q31(
3163 uint32_t firstIndex,
3164 uint32_t numPoints);
3168 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3169 * @param[in] *pSrcA points to the first input sequence.
3170 * @param[in] srcALen length of the first input sequence.
3171 * @param[in] *pSrcB points to the second input sequence.
3172 * @param[in] srcBLen length of the second input sequence.
3173 * @param[out] *pDst points to the block of output data
3174 * @param[in] firstIndex is the first output sample to start with.
3175 * @param[in] numPoints is the number of output points to be computed.
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].
3179 arm_status arm_conv_partial_fast_q31(
3185 uint32_t firstIndex,
3186 uint32_t numPoints);
3189 * @brief Partial convolution of Q7 sequences.
3190 * @param[in] *pSrcA points to the first input sequence.
3191 * @param[in] srcALen length of the first input sequence.
3192 * @param[in] *pSrcB points to the second input sequence.
3193 * @param[in] srcBLen length of the second input sequence.
3194 * @param[out] *pDst points to the block of output data
3195 * @param[in] firstIndex is the first output sample to start with.
3196 * @param[in] numPoints is the number of output points to be computed.
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].
3200 arm_status arm_conv_partial_q7(
3206 uint32_t firstIndex,
3207 uint32_t numPoints);
3211 * @brief Instance structure for the Q15 FIR decimator.
3216 uint8_t M; /**< decimation factor. */
3217 uint16_t numTaps; /**< number of coefficients in the filter. */
3218 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3219 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3220 } arm_fir_decimate_instance_q15;
3223 * @brief Instance structure for the Q31 FIR decimator.
3228 uint8_t M; /**< decimation factor. */
3229 uint16_t numTaps; /**< number of coefficients in the filter. */
3230 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3231 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3233 } arm_fir_decimate_instance_q31;
3236 * @brief Instance structure for the floating-point FIR decimator.
3241 uint8_t M; /**< decimation factor. */
3242 uint16_t numTaps; /**< number of coefficients in the filter. */
3243 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3244 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3246 } arm_fir_decimate_instance_f32;
3251 * @brief Processing function for the floating-point FIR decimator.
3252 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
3253 * @param[in] *pSrc points to the block of input data.
3254 * @param[out] *pDst points to the block of output data
3255 * @param[in] blockSize number of input samples to process per call.
3259 void arm_fir_decimate_f32(
3260 const arm_fir_decimate_instance_f32 * S,
3263 uint32_t blockSize);
3267 * @brief Initialization function for the floating-point FIR decimator.
3268 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
3269 * @param[in] numTaps number of coefficients in the filter.
3270 * @param[in] M decimation factor.
3271 * @param[in] *pCoeffs points to the filter coefficients.
3272 * @param[in] *pState points to the state buffer.
3273 * @param[in] blockSize number of input samples to process per call.
3274 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3275 * <code>blockSize</code> is not a multiple of <code>M</code>.
3278 arm_status arm_fir_decimate_init_f32(
3279 arm_fir_decimate_instance_f32 * S,
3282 float32_t * pCoeffs,
3284 uint32_t blockSize);
3287 * @brief Processing function for the Q15 FIR decimator.
3288 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
3289 * @param[in] *pSrc points to the block of input data.
3290 * @param[out] *pDst points to the block of output data
3291 * @param[in] blockSize number of input samples to process per call.
3295 void arm_fir_decimate_q15(
3296 const arm_fir_decimate_instance_q15 * S,
3299 uint32_t blockSize);
3302 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3303 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
3304 * @param[in] *pSrc points to the block of input data.
3305 * @param[out] *pDst points to the block of output data
3306 * @param[in] blockSize number of input samples to process per call.
3310 void arm_fir_decimate_fast_q15(
3311 const arm_fir_decimate_instance_q15 * S,
3314 uint32_t blockSize);
3319 * @brief Initialization function for the Q15 FIR decimator.
3320 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
3321 * @param[in] numTaps number of coefficients in the filter.
3322 * @param[in] M decimation factor.
3323 * @param[in] *pCoeffs points to the filter coefficients.
3324 * @param[in] *pState points to the state buffer.
3325 * @param[in] blockSize number of input samples to process per call.
3326 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3327 * <code>blockSize</code> is not a multiple of <code>M</code>.
3330 arm_status arm_fir_decimate_init_q15(
3331 arm_fir_decimate_instance_q15 * S,
3336 uint32_t blockSize);
3339 * @brief Processing function for the Q31 FIR decimator.
3340 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
3341 * @param[in] *pSrc points to the block of input data.
3342 * @param[out] *pDst points to the block of output data
3343 * @param[in] blockSize number of input samples to process per call.
3347 void arm_fir_decimate_q31(
3348 const arm_fir_decimate_instance_q31 * S,
3351 uint32_t blockSize);
3354 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3355 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
3356 * @param[in] *pSrc points to the block of input data.
3357 * @param[out] *pDst points to the block of output data
3358 * @param[in] blockSize number of input samples to process per call.
3362 void arm_fir_decimate_fast_q31(
3363 arm_fir_decimate_instance_q31 * S,
3366 uint32_t blockSize);
3370 * @brief Initialization function for the Q31 FIR decimator.
3371 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
3372 * @param[in] numTaps number of coefficients in the filter.
3373 * @param[in] M decimation factor.
3374 * @param[in] *pCoeffs points to the filter coefficients.
3375 * @param[in] *pState points to the state buffer.
3376 * @param[in] blockSize number of input samples to process per call.
3377 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3378 * <code>blockSize</code> is not a multiple of <code>M</code>.
3381 arm_status arm_fir_decimate_init_q31(
3382 arm_fir_decimate_instance_q31 * S,
3387 uint32_t blockSize);
3392 * @brief Instance structure for the Q15 FIR interpolator.
3397 uint8_t L; /**< upsample factor. */
3398 uint16_t phaseLength; /**< length of each polyphase filter component. */
3399 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3400 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3401 } arm_fir_interpolate_instance_q15;
3404 * @brief Instance structure for the Q31 FIR interpolator.
3409 uint8_t L; /**< upsample factor. */
3410 uint16_t phaseLength; /**< length of each polyphase filter component. */
3411 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3412 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3413 } arm_fir_interpolate_instance_q31;
3416 * @brief Instance structure for the floating-point FIR interpolator.
3421 uint8_t L; /**< upsample factor. */
3422 uint16_t phaseLength; /**< length of each polyphase filter component. */
3423 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3424 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
3425 } arm_fir_interpolate_instance_f32;
3429 * @brief Processing function for the Q15 FIR interpolator.
3430 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
3431 * @param[in] *pSrc points to the block of input data.
3432 * @param[out] *pDst points to the block of output data.
3433 * @param[in] blockSize number of input samples to process per call.
3437 void arm_fir_interpolate_q15(
3438 const arm_fir_interpolate_instance_q15 * S,
3441 uint32_t blockSize);
3445 * @brief Initialization function for the Q15 FIR interpolator.
3446 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
3447 * @param[in] L upsample factor.
3448 * @param[in] numTaps number of filter coefficients in the filter.
3449 * @param[in] *pCoeffs points to the filter coefficient buffer.
3450 * @param[in] *pState points to the state buffer.
3451 * @param[in] blockSize number of input samples to process per call.
3452 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3453 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3456 arm_status arm_fir_interpolate_init_q15(
3457 arm_fir_interpolate_instance_q15 * S,
3462 uint32_t blockSize);
3465 * @brief Processing function for the Q31 FIR interpolator.
3466 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
3467 * @param[in] *pSrc points to the block of input data.
3468 * @param[out] *pDst points to the block of output data.
3469 * @param[in] blockSize number of input samples to process per call.
3473 void arm_fir_interpolate_q31(
3474 const arm_fir_interpolate_instance_q31 * S,
3477 uint32_t blockSize);
3480 * @brief Initialization function for the Q31 FIR interpolator.
3481 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
3482 * @param[in] L upsample factor.
3483 * @param[in] numTaps number of filter coefficients in the filter.
3484 * @param[in] *pCoeffs points to the filter coefficient buffer.
3485 * @param[in] *pState points to the state buffer.
3486 * @param[in] blockSize number of input samples to process per call.
3487 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3488 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3491 arm_status arm_fir_interpolate_init_q31(
3492 arm_fir_interpolate_instance_q31 * S,
3497 uint32_t blockSize);
3501 * @brief Processing function for the floating-point FIR interpolator.
3502 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
3503 * @param[in] *pSrc points to the block of input data.
3504 * @param[out] *pDst points to the block of output data.
3505 * @param[in] blockSize number of input samples to process per call.
3509 void arm_fir_interpolate_f32(
3510 const arm_fir_interpolate_instance_f32 * S,
3513 uint32_t blockSize);
3516 * @brief Initialization function for the floating-point FIR interpolator.
3517 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
3518 * @param[in] L upsample factor.
3519 * @param[in] numTaps number of filter coefficients in the filter.
3520 * @param[in] *pCoeffs points to the filter coefficient buffer.
3521 * @param[in] *pState points to the state buffer.
3522 * @param[in] blockSize number of input samples to process per call.
3523 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3524 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3527 arm_status arm_fir_interpolate_init_f32(
3528 arm_fir_interpolate_instance_f32 * S,
3531 float32_t * pCoeffs,
3533 uint32_t blockSize);
3536 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
3541 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3542 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3543 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3544 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
3546 } arm_biquad_cas_df1_32x64_ins_q31;
3550 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
3551 * @param[in] *pSrc points to the block of input data.
3552 * @param[out] *pDst points to the block of output data
3553 * @param[in] blockSize number of samples to process.
3557 void arm_biquad_cas_df1_32x64_q31(
3558 const arm_biquad_cas_df1_32x64_ins_q31 * S,
3561 uint32_t blockSize);
3565 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
3566 * @param[in] numStages number of 2nd order stages in the filter.
3567 * @param[in] *pCoeffs points to the filter coefficients.
3568 * @param[in] *pState points to the state buffer.
3569 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
3573 void arm_biquad_cas_df1_32x64_init_q31(
3574 arm_biquad_cas_df1_32x64_ins_q31 * S,
3583 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3588 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3589 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3590 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3591 } arm_biquad_cascade_df2T_instance_f32;
3595 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3596 * @param[in] *S points to an instance of the filter data structure.
3597 * @param[in] *pSrc points to the block of input data.
3598 * @param[out] *pDst points to the block of output data
3599 * @param[in] blockSize number of samples to process.
3603 void arm_biquad_cascade_df2T_f32(
3604 const arm_biquad_cascade_df2T_instance_f32 * S,
3607 uint32_t blockSize);
3611 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3612 * @param[in,out] *S points to an instance of the filter data structure.
3613 * @param[in] numStages number of 2nd order stages in the filter.
3614 * @param[in] *pCoeffs points to the filter coefficients.
3615 * @param[in] *pState points to the state buffer.
3619 void arm_biquad_cascade_df2T_init_f32(
3620 arm_biquad_cascade_df2T_instance_f32 * S,
3622 float32_t * pCoeffs,
3623 float32_t * pState);
3628 * @brief Instance structure for the Q15 FIR lattice filter.
3633 uint16_t numStages; /**< number of filter stages. */
3634 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
3635 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3636 } arm_fir_lattice_instance_q15;
3639 * @brief Instance structure for the Q31 FIR lattice filter.
3644 uint16_t numStages; /**< number of filter stages. */
3645 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
3646 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3647 } arm_fir_lattice_instance_q31;
3650 * @brief Instance structure for the floating-point FIR lattice filter.
3655 uint16_t numStages; /**< number of filter stages. */
3656 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
3657 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3658 } arm_fir_lattice_instance_f32;
3661 * @brief Initialization function for the Q15 FIR lattice filter.
3662 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
3663 * @param[in] numStages number of filter stages.
3664 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
3665 * @param[in] *pState points to the state buffer. The array is of length numStages.
3669 void arm_fir_lattice_init_q15(
3670 arm_fir_lattice_instance_q15 * S,
3677 * @brief Processing function for the Q15 FIR lattice filter.
3678 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
3679 * @param[in] *pSrc points to the block of input data.
3680 * @param[out] *pDst points to the block of output data.
3681 * @param[in] blockSize number of samples to process.
3684 void arm_fir_lattice_q15(
3685 const arm_fir_lattice_instance_q15 * S,
3688 uint32_t blockSize);
3691 * @brief Initialization function for the Q31 FIR lattice filter.
3692 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
3693 * @param[in] numStages number of filter stages.
3694 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
3695 * @param[in] *pState points to the state buffer. The array is of length numStages.
3699 void arm_fir_lattice_init_q31(
3700 arm_fir_lattice_instance_q31 * S,
3707 * @brief Processing function for the Q31 FIR lattice filter.
3708 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
3709 * @param[in] *pSrc points to the block of input data.
3710 * @param[out] *pDst points to the block of output data
3711 * @param[in] blockSize number of samples to process.
3715 void arm_fir_lattice_q31(
3716 const arm_fir_lattice_instance_q31 * S,
3719 uint32_t blockSize);
3722 * @brief Initialization function for the floating-point FIR lattice filter.
3723 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
3724 * @param[in] numStages number of filter stages.
3725 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
3726 * @param[in] *pState points to the state buffer. The array is of length numStages.
3730 void arm_fir_lattice_init_f32(
3731 arm_fir_lattice_instance_f32 * S,
3733 float32_t * pCoeffs,
3734 float32_t * pState);
3737 * @brief Processing function for the floating-point FIR lattice filter.
3738 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
3739 * @param[in] *pSrc points to the block of input data.
3740 * @param[out] *pDst points to the block of output data
3741 * @param[in] blockSize number of samples to process.
3745 void arm_fir_lattice_f32(
3746 const arm_fir_lattice_instance_f32 * S,
3749 uint32_t blockSize);
3752 * @brief Instance structure for the Q15 IIR lattice filter.
3756 uint16_t numStages; /**< number of stages in the filter. */
3757 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3758 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3759 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3760 } arm_iir_lattice_instance_q15;
3763 * @brief Instance structure for the Q31 IIR lattice filter.
3767 uint16_t numStages; /**< number of stages in the filter. */
3768 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3769 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3770 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3771 } arm_iir_lattice_instance_q31;
3774 * @brief Instance structure for the floating-point IIR lattice filter.
3778 uint16_t numStages; /**< number of stages in the filter. */
3779 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3780 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3781 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3782 } arm_iir_lattice_instance_f32;
3785 * @brief Processing function for the floating-point IIR lattice filter.
3786 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
3787 * @param[in] *pSrc points to the block of input data.
3788 * @param[out] *pDst points to the block of output data.
3789 * @param[in] blockSize number of samples to process.
3793 void arm_iir_lattice_f32(
3794 const arm_iir_lattice_instance_f32 * S,
3797 uint32_t blockSize);
3800 * @brief Initialization function for the floating-point IIR lattice filter.
3801 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
3802 * @param[in] numStages number of stages in the filter.
3803 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3804 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3805 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
3806 * @param[in] blockSize number of samples to process.
3810 void arm_iir_lattice_init_f32(
3811 arm_iir_lattice_instance_f32 * S,
3813 float32_t *pkCoeffs,
3814 float32_t *pvCoeffs,
3816 uint32_t blockSize);
3820 * @brief Processing function for the Q31 IIR lattice filter.
3821 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
3822 * @param[in] *pSrc points to the block of input data.
3823 * @param[out] *pDst points to the block of output data.
3824 * @param[in] blockSize number of samples to process.
3828 void arm_iir_lattice_q31(
3829 const arm_iir_lattice_instance_q31 * S,
3832 uint32_t blockSize);
3836 * @brief Initialization function for the Q31 IIR lattice filter.
3837 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
3838 * @param[in] numStages number of stages in the filter.
3839 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3840 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3841 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
3842 * @param[in] blockSize number of samples to process.
3846 void arm_iir_lattice_init_q31(
3847 arm_iir_lattice_instance_q31 * S,
3852 uint32_t blockSize);
3856 * @brief Processing function for the Q15 IIR lattice filter.
3857 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
3858 * @param[in] *pSrc points to the block of input data.
3859 * @param[out] *pDst points to the block of output data.
3860 * @param[in] blockSize number of samples to process.
3864 void arm_iir_lattice_q15(
3865 const arm_iir_lattice_instance_q15 * S,
3868 uint32_t blockSize);
3872 * @brief Initialization function for the Q15 IIR lattice filter.
3873 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
3874 * @param[in] numStages number of stages in the filter.
3875 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
3876 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
3877 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
3878 * @param[in] blockSize number of samples to process per call.
3882 void arm_iir_lattice_init_q15(
3883 arm_iir_lattice_instance_q15 * S,
3888 uint32_t blockSize);
3891 * @brief Instance structure for the floating-point LMS filter.
3896 uint16_t numTaps; /**< number of coefficients in the filter. */
3897 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3898 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
3899 float32_t mu; /**< step size that controls filter coefficient updates. */
3900 } arm_lms_instance_f32;
3903 * @brief Processing function for floating-point LMS filter.
3904 * @param[in] *S points to an instance of the floating-point LMS filter structure.
3905 * @param[in] *pSrc points to the block of input data.
3906 * @param[in] *pRef points to the block of reference data.
3907 * @param[out] *pOut points to the block of output data.
3908 * @param[out] *pErr points to the block of error data.
3909 * @param[in] blockSize number of samples to process.
3914 const arm_lms_instance_f32 * S,
3919 uint32_t blockSize);
3922 * @brief Initialization function for floating-point LMS filter.
3923 * @param[in] *S points to an instance of the floating-point LMS filter structure.
3924 * @param[in] numTaps number of filter coefficients.
3925 * @param[in] *pCoeffs points to the coefficient buffer.
3926 * @param[in] *pState points to state buffer.
3927 * @param[in] mu step size that controls filter coefficient updates.
3928 * @param[in] blockSize number of samples to process.
3932 void arm_lms_init_f32(
3933 arm_lms_instance_f32 * S,
3935 float32_t * pCoeffs,
3938 uint32_t blockSize);
3941 * @brief Instance structure for the Q15 LMS filter.
3946 uint16_t numTaps; /**< number of coefficients in the filter. */
3947 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3948 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
3949 q15_t mu; /**< step size that controls filter coefficient updates. */
3950 uint32_t postShift; /**< bit shift applied to coefficients. */
3951 } arm_lms_instance_q15;
3955 * @brief Initialization function for the Q15 LMS filter.
3956 * @param[in] *S points to an instance of the Q15 LMS filter structure.
3957 * @param[in] numTaps number of filter coefficients.
3958 * @param[in] *pCoeffs points to the coefficient buffer.
3959 * @param[in] *pState points to the state buffer.
3960 * @param[in] mu step size that controls filter coefficient updates.
3961 * @param[in] blockSize number of samples to process.
3962 * @param[in] postShift bit shift applied to coefficients.
3966 void arm_lms_init_q15(
3967 arm_lms_instance_q15 * S,
3973 uint32_t postShift);
3976 * @brief Processing function for Q15 LMS filter.
3977 * @param[in] *S points to an instance of the Q15 LMS filter structure.
3978 * @param[in] *pSrc points to the block of input data.
3979 * @param[in] *pRef points to the block of reference data.
3980 * @param[out] *pOut points to the block of output data.
3981 * @param[out] *pErr points to the block of error data.
3982 * @param[in] blockSize number of samples to process.
3987 const arm_lms_instance_q15 * S,
3992 uint32_t blockSize);
3996 * @brief Instance structure for the Q31 LMS filter.
4001 uint16_t numTaps; /**< number of coefficients in the filter. */
4002 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4003 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4004 q31_t mu; /**< step size that controls filter coefficient updates. */
4005 uint32_t postShift; /**< bit shift applied to coefficients. */
4007 } arm_lms_instance_q31;
4010 * @brief Processing function for Q31 LMS filter.
4011 * @param[in] *S points to an instance of the Q15 LMS filter structure.
4012 * @param[in] *pSrc points to the block of input data.
4013 * @param[in] *pRef points to the block of reference data.
4014 * @param[out] *pOut points to the block of output data.
4015 * @param[out] *pErr points to the block of error data.
4016 * @param[in] blockSize number of samples to process.
4021 const arm_lms_instance_q31 * S,
4026 uint32_t blockSize);
4029 * @brief Initialization function for Q31 LMS filter.
4030 * @param[in] *S points to an instance of the Q31 LMS filter structure.
4031 * @param[in] numTaps number of filter coefficients.
4032 * @param[in] *pCoeffs points to coefficient buffer.
4033 * @param[in] *pState points to state buffer.
4034 * @param[in] mu step size that controls filter coefficient updates.
4035 * @param[in] blockSize number of samples to process.
4036 * @param[in] postShift bit shift applied to coefficients.
4040 void arm_lms_init_q31(
4041 arm_lms_instance_q31 * S,
4047 uint32_t postShift);
4050 * @brief Instance structure for the floating-point normalized LMS filter.
4055 uint16_t numTaps; /**< number of coefficients in the filter. */
4056 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4057 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4058 float32_t mu; /**< step size that control filter coefficient updates. */
4059 float32_t energy; /**< saves previous frame energy. */
4060 float32_t x0; /**< saves previous input sample. */
4061 } arm_lms_norm_instance_f32;
4064 * @brief Processing function for floating-point normalized LMS filter.
4065 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
4066 * @param[in] *pSrc points to the block of input data.
4067 * @param[in] *pRef points to the block of reference data.
4068 * @param[out] *pOut points to the block of output data.
4069 * @param[out] *pErr points to the block of error data.
4070 * @param[in] blockSize number of samples to process.
4074 void arm_lms_norm_f32(
4075 arm_lms_norm_instance_f32 * S,
4080 uint32_t blockSize);
4083 * @brief Initialization function for floating-point normalized LMS filter.
4084 * @param[in] *S points to an instance of the floating-point LMS filter structure.
4085 * @param[in] numTaps number of filter coefficients.
4086 * @param[in] *pCoeffs points to coefficient buffer.
4087 * @param[in] *pState points to state buffer.
4088 * @param[in] mu step size that controls filter coefficient updates.
4089 * @param[in] blockSize number of samples to process.
4093 void arm_lms_norm_init_f32(
4094 arm_lms_norm_instance_f32 * S,
4096 float32_t * pCoeffs,
4099 uint32_t blockSize);
4103 * @brief Instance structure for the Q31 normalized LMS filter.
4107 uint16_t numTaps; /**< number of coefficients in the filter. */
4108 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4109 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4110 q31_t mu; /**< step size that controls filter coefficient updates. */
4111 uint8_t postShift; /**< bit shift applied to coefficients. */
4112 q31_t *recipTable; /**< points to the reciprocal initial value table. */
4113 q31_t energy; /**< saves previous frame energy. */
4114 q31_t x0; /**< saves previous input sample. */
4115 } arm_lms_norm_instance_q31;
4118 * @brief Processing function for Q31 normalized LMS filter.
4119 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
4120 * @param[in] *pSrc points to the block of input data.
4121 * @param[in] *pRef points to the block of reference data.
4122 * @param[out] *pOut points to the block of output data.
4123 * @param[out] *pErr points to the block of error data.
4124 * @param[in] blockSize number of samples to process.
4128 void arm_lms_norm_q31(
4129 arm_lms_norm_instance_q31 * S,
4134 uint32_t blockSize);
4137 * @brief Initialization function for Q31 normalized LMS filter.
4138 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
4139 * @param[in] numTaps number of filter coefficients.
4140 * @param[in] *pCoeffs points to coefficient buffer.
4141 * @param[in] *pState points to state buffer.
4142 * @param[in] mu step size that controls filter coefficient updates.
4143 * @param[in] blockSize number of samples to process.
4144 * @param[in] postShift bit shift applied to coefficients.
4148 void arm_lms_norm_init_q31(
4149 arm_lms_norm_instance_q31 * S,
4158 * @brief Instance structure for the Q15 normalized LMS filter.
4163 uint16_t numTaps; /**< Number of coefficients in the filter. */
4164 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4165 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4166 q15_t mu; /**< step size that controls filter coefficient updates. */
4167 uint8_t postShift; /**< bit shift applied to coefficients. */
4168 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
4169 q15_t energy; /**< saves previous frame energy. */
4170 q15_t x0; /**< saves previous input sample. */
4171 } arm_lms_norm_instance_q15;
4174 * @brief Processing function for Q15 normalized LMS filter.
4175 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
4176 * @param[in] *pSrc points to the block of input data.
4177 * @param[in] *pRef points to the block of reference data.
4178 * @param[out] *pOut points to the block of output data.
4179 * @param[out] *pErr points to the block of error data.
4180 * @param[in] blockSize number of samples to process.
4184 void arm_lms_norm_q15(
4185 arm_lms_norm_instance_q15 * S,
4190 uint32_t blockSize);
4194 * @brief Initialization function for Q15 normalized LMS filter.
4195 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
4196 * @param[in] numTaps number of filter coefficients.
4197 * @param[in] *pCoeffs points to coefficient buffer.
4198 * @param[in] *pState points to state buffer.
4199 * @param[in] mu step size that controls filter coefficient updates.
4200 * @param[in] blockSize number of samples to process.
4201 * @param[in] postShift bit shift applied to coefficients.
4205 void arm_lms_norm_init_q15(
4206 arm_lms_norm_instance_q15 * S,
4215 * @brief Correlation of floating-point sequences.
4216 * @param[in] *pSrcA points to the first input sequence.
4217 * @param[in] srcALen length of the first input sequence.
4218 * @param[in] *pSrcB points to the second input sequence.
4219 * @param[in] srcBLen length of the second input sequence.
4220 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4224 void arm_correlate_f32(
4232 * @brief Correlation of Q15 sequences.
4233 * @param[in] *pSrcA points to the first input sequence.
4234 * @param[in] srcALen length of the first input sequence.
4235 * @param[in] *pSrcB points to the second input sequence.
4236 * @param[in] srcBLen length of the second input sequence.
4237 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4241 void arm_correlate_q15(
4249 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4250 * @param[in] *pSrcA points to the first input sequence.
4251 * @param[in] srcALen length of the first input sequence.
4252 * @param[in] *pSrcB points to the second input sequence.
4253 * @param[in] srcBLen length of the second input sequence.
4254 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4258 void arm_correlate_fast_q15(
4266 * @brief Correlation of Q31 sequences.
4267 * @param[in] *pSrcA points to the first input sequence.
4268 * @param[in] srcALen length of the first input sequence.
4269 * @param[in] *pSrcB points to the second input sequence.
4270 * @param[in] srcBLen length of the second input sequence.
4271 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4275 void arm_correlate_q31(
4283 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
4284 * @param[in] *pSrcA points to the first input sequence.
4285 * @param[in] srcALen length of the first input sequence.
4286 * @param[in] *pSrcB points to the second input sequence.
4287 * @param[in] srcBLen length of the second input sequence.
4288 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4292 void arm_correlate_fast_q31(
4300 * @brief Correlation of Q7 sequences.
4301 * @param[in] *pSrcA points to the first input sequence.
4302 * @param[in] srcALen length of the first input sequence.
4303 * @param[in] *pSrcB points to the second input sequence.
4304 * @param[in] srcBLen length of the second input sequence.
4305 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4309 void arm_correlate_q7(
4317 * @brief Instance structure for the floating-point sparse FIR filter.
4321 uint16_t numTaps; /**< number of coefficients in the filter. */
4322 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4323 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4324 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4325 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4326 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4327 } arm_fir_sparse_instance_f32;
4330 * @brief Instance structure for the Q31 sparse FIR filter.
4335 uint16_t numTaps; /**< number of coefficients in the filter. */
4336 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4337 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4338 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4339 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4340 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4341 } arm_fir_sparse_instance_q31;
4344 * @brief Instance structure for the Q15 sparse FIR filter.
4349 uint16_t numTaps; /**< number of coefficients in the filter. */
4350 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4351 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4352 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4353 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4354 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4355 } arm_fir_sparse_instance_q15;
4358 * @brief Instance structure for the Q7 sparse FIR filter.
4363 uint16_t numTaps; /**< number of coefficients in the filter. */
4364 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4365 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4366 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4367 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4368 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4369 } arm_fir_sparse_instance_q7;
4372 * @brief Processing function for the floating-point sparse FIR filter.
4373 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
4374 * @param[in] *pSrc points to the block of input data.
4375 * @param[out] *pDst points to the block of output data
4376 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
4377 * @param[in] blockSize number of input samples to process per call.
4381 void arm_fir_sparse_f32(
4382 arm_fir_sparse_instance_f32 * S,
4385 float32_t * pScratchIn,
4386 uint32_t blockSize);
4389 * @brief Initialization function for the floating-point sparse FIR filter.
4390 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
4391 * @param[in] numTaps number of nonzero coefficients in the filter.
4392 * @param[in] *pCoeffs points to the array of filter coefficients.
4393 * @param[in] *pState points to the state buffer.
4394 * @param[in] *pTapDelay points to the array of offset times.
4395 * @param[in] maxDelay maximum offset time supported.
4396 * @param[in] blockSize number of samples that will be processed per block.
4400 void arm_fir_sparse_init_f32(
4401 arm_fir_sparse_instance_f32 * S,
4403 float32_t * pCoeffs,
4405 int32_t * pTapDelay,
4407 uint32_t blockSize);
4410 * @brief Processing function for the Q31 sparse FIR filter.
4411 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
4412 * @param[in] *pSrc points to the block of input data.
4413 * @param[out] *pDst points to the block of output data
4414 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
4415 * @param[in] blockSize number of input samples to process per call.
4419 void arm_fir_sparse_q31(
4420 arm_fir_sparse_instance_q31 * S,
4424 uint32_t blockSize);
4427 * @brief Initialization function for the Q31 sparse FIR filter.
4428 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
4429 * @param[in] numTaps number of nonzero coefficients in the filter.
4430 * @param[in] *pCoeffs points to the array of filter coefficients.
4431 * @param[in] *pState points to the state buffer.
4432 * @param[in] *pTapDelay points to the array of offset times.
4433 * @param[in] maxDelay maximum offset time supported.
4434 * @param[in] blockSize number of samples that will be processed per block.
4438 void arm_fir_sparse_init_q31(
4439 arm_fir_sparse_instance_q31 * S,
4443 int32_t * pTapDelay,
4445 uint32_t blockSize);
4448 * @brief Processing function for the Q15 sparse FIR filter.
4449 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
4450 * @param[in] *pSrc points to the block of input data.
4451 * @param[out] *pDst points to the block of output data
4452 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
4453 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
4454 * @param[in] blockSize number of input samples to process per call.
4458 void arm_fir_sparse_q15(
4459 arm_fir_sparse_instance_q15 * S,
4463 q31_t * pScratchOut,
4464 uint32_t blockSize);
4468 * @brief Initialization function for the Q15 sparse FIR filter.
4469 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
4470 * @param[in] numTaps number of nonzero coefficients in the filter.
4471 * @param[in] *pCoeffs points to the array of filter coefficients.
4472 * @param[in] *pState points to the state buffer.
4473 * @param[in] *pTapDelay points to the array of offset times.
4474 * @param[in] maxDelay maximum offset time supported.
4475 * @param[in] blockSize number of samples that will be processed per block.
4479 void arm_fir_sparse_init_q15(
4480 arm_fir_sparse_instance_q15 * S,
4484 int32_t * pTapDelay,
4486 uint32_t blockSize);
4489 * @brief Processing function for the Q7 sparse FIR filter.
4490 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
4491 * @param[in] *pSrc points to the block of input data.
4492 * @param[out] *pDst points to the block of output data
4493 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
4494 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
4495 * @param[in] blockSize number of input samples to process per call.
4499 void arm_fir_sparse_q7(
4500 arm_fir_sparse_instance_q7 * S,
4504 q31_t * pScratchOut,
4505 uint32_t blockSize);
4508 * @brief Initialization function for the Q7 sparse FIR filter.
4509 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
4510 * @param[in] numTaps number of nonzero coefficients in the filter.
4511 * @param[in] *pCoeffs points to the array of filter coefficients.
4512 * @param[in] *pState points to the state buffer.
4513 * @param[in] *pTapDelay points to the array of offset times.
4514 * @param[in] maxDelay maximum offset time supported.
4515 * @param[in] blockSize number of samples that will be processed per block.
4519 void arm_fir_sparse_init_q7(
4520 arm_fir_sparse_instance_q7 * S,
4526 uint32_t blockSize);
4530 * @brief Floating-point sin_cos function.
4531 * @param[in] theta input value in degrees
4532 * @param[out] *pSinVal points to the processed sine output.
4533 * @param[out] *pCosVal points to the processed cos output.
4537 void arm_sin_cos_f32(
4540 float32_t *pCcosVal);
4543 * @brief Q31 sin_cos function.
4544 * @param[in] theta scaled input value in degrees
4545 * @param[out] *pSinVal points to the processed sine output.
4546 * @param[out] *pCosVal points to the processed cosine output.
4550 void arm_sin_cos_q31(
4557 * @brief Floating-point complex conjugate.
4558 * @param[in] *pSrc points to the input vector
4559 * @param[out] *pDst points to the output vector
4560 * @param[in] numSamples number of complex samples in each vector
4564 void arm_cmplx_conj_f32(
4567 uint32_t numSamples);
4570 * @brief Q31 complex conjugate.
4571 * @param[in] *pSrc points to the input vector
4572 * @param[out] *pDst points to the output vector
4573 * @param[in] numSamples number of complex samples in each vector
4577 void arm_cmplx_conj_q31(
4580 uint32_t numSamples);
4583 * @brief Q15 complex conjugate.
4584 * @param[in] *pSrc points to the input vector
4585 * @param[out] *pDst points to the output vector
4586 * @param[in] numSamples number of complex samples in each vector
4590 void arm_cmplx_conj_q15(
4593 uint32_t numSamples);
4598 * @brief Floating-point complex magnitude squared
4599 * @param[in] *pSrc points to the complex input vector
4600 * @param[out] *pDst points to the real output vector
4601 * @param[in] numSamples number of complex samples in the input vector
4605 void arm_cmplx_mag_squared_f32(
4608 uint32_t numSamples);
4611 * @brief Q31 complex magnitude squared
4612 * @param[in] *pSrc points to the complex input vector
4613 * @param[out] *pDst points to the real output vector
4614 * @param[in] numSamples number of complex samples in the input vector
4618 void arm_cmplx_mag_squared_q31(
4621 uint32_t numSamples);
4624 * @brief Q15 complex magnitude squared
4625 * @param[in] *pSrc points to the complex input vector
4626 * @param[out] *pDst points to the real output vector
4627 * @param[in] numSamples number of complex samples in the input vector
4631 void arm_cmplx_mag_squared_q15(
4634 uint32_t numSamples);
4638 * @ingroup groupController
4642 * @defgroup PID PID Motor Control
4644 * A Proportional Integral Derivative (PID) controller is a generic feedback control
4645 * loop mechanism widely used in industrial control systems.
4646 * A PID controller is the most commonly used type of feedback controller.
4648 * This set of functions implements (PID) controllers
4649 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
4650 * of data and each call to the function returns a single processed value.
4651 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
4652 * is the input sample value. The functions return the output value.
4656 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
4658 * A1 = (-Kp ) - (2 * Kd )
4662 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
4665 * \image html PID.gif "Proportional Integral Derivative Controller"
4668 * The PID controller calculates an "error" value as the difference between
4669 * the measured output and the reference input.
4670 * The controller attempts to minimize the error by adjusting the process control inputs.
4671 * The proportional value determines the reaction to the current error,
4672 * the integral value determines the reaction based on the sum of recent errors,
4673 * and the derivative value determines the reaction based on the rate at which the error has been changing.
4675 * \par Instance Structure
4676 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
4677 * A separate instance structure must be defined for each PID Controller.
4678 * There are separate instance structure declarations for each of the 3 supported data types.
4680 * \par Reset Functions
4681 * There is also an associated reset function for each data type which clears the state array.
4683 * \par Initialization Functions
4684 * There is also an associated initialization function for each data type.
4685 * The initialization function performs the following operations:
4686 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
4687 * - Zeros out the values in the state buffer.
4690 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
4692 * \par Fixed-Point Behavior
4693 * Care must be taken when using the fixed-point versions of the PID Controller functions.
4694 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
4695 * Refer to the function specific documentation below for usage guidelines.
4704 * @brief Process function for the floating-point PID Control.
4705 * @param[in,out] *S is an instance of the floating-point PID Control structure
4706 * @param[in] in input sample to process
4707 * @return out processed output sample.
4711 static __INLINE float32_t arm_pid_f32(
4712 arm_pid_instance_f32 * S,
4717 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
4718 out = (S->A0 * in) +
4719 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
4722 S->state[1] = S->state[0];
4726 /* return to application */
4732 * @brief Process function for the Q31 PID Control.
4733 * @param[in,out] *S points to an instance of the Q31 PID Control structure
4734 * @param[in] in input sample to process
4735 * @return out processed output sample.
4737 * <b>Scaling and Overflow Behavior:</b>
4739 * The function is implemented using an internal 64-bit accumulator.
4740 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
4741 * Thus, if the accumulator result overflows it wraps around rather than clip.
4742 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
4743 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
4746 static __INLINE q31_t arm_pid_q31(
4747 arm_pid_instance_q31 * S,
4753 /* acc = A0 * x[n] */
4754 acc = (q63_t) S->A0 * in;
4756 /* acc += A1 * x[n-1] */
4757 acc += (q63_t) S->A1 * S->state[0];
4759 /* acc += A2 * x[n-2] */
4760 acc += (q63_t) S->A2 * S->state[1];
4762 /* convert output to 1.31 format to add y[n-1] */
4763 out = (q31_t) (acc >> 31u);
4769 S->state[1] = S->state[0];
4773 /* return to application */
4779 * @brief Process function for the Q15 PID Control.
4780 * @param[in,out] *S points to an instance of the Q15 PID Control structure
4781 * @param[in] in input sample to process
4782 * @return out processed output sample.
4784 * <b>Scaling and Overflow Behavior:</b>
4786 * The function is implemented using a 64-bit internal accumulator.
4787 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
4788 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
4789 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
4790 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
4791 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
4794 static __INLINE q15_t arm_pid_q15(
4795 arm_pid_instance_q15 * S,
4801 /* Implementation of PID controller */
4805 /* acc = A0 * x[n] */
4806 acc = ((q31_t) S->A0 )* in ;
4810 /* acc = A0 * x[n] */
4811 acc = (q31_t) __SMUAD(S->A0, in);
4817 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4818 acc += (q31_t) S->A1 * S->state[0] ;
4819 acc += (q31_t) S->A2 * S->state[1] ;
4823 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4824 acc = __SMLALD(S->A1, (q31_t)__SIMD32(S->state), acc);
4829 acc += (q31_t) S->state[2] << 15;
4831 /* saturate the output */
4832 out = (q15_t) (__SSAT((acc >> 15), 16));
4835 S->state[1] = S->state[0];
4839 /* return to application */
4845 * @} end of PID group
4850 * @brief Floating-point matrix inverse.
4851 * @param[in] *src points to the instance of the input floating-point matrix structure.
4852 * @param[out] *dst points to the instance of the output floating-point matrix structure.
4853 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4854 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4857 arm_status arm_mat_inverse_f32(
4858 const arm_matrix_instance_f32 * src,
4859 arm_matrix_instance_f32 * dst);
4864 * @ingroup groupController
4869 * @defgroup clarke Vector Clarke Transform
4870 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
4871 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
4872 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
4873 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
4874 * \image html clarke.gif Stator current space vector and its components in (a,b).
4875 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
4876 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
4878 * The function operates on a single sample of data and each call to the function returns the processed output.
4879 * The library provides separate functions for Q31 and floating-point data types.
4881 * \image html clarkeFormula.gif
4882 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
4883 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
4884 * \par Fixed-Point Behavior
4885 * Care must be taken when using the Q31 version of the Clarke transform.
4886 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
4887 * Refer to the function specific documentation below for usage guidelines.
4891 * @addtogroup clarke
4897 * @brief Floating-point Clarke transform
4898 * @param[in] Ia input three-phase coordinate <code>a</code>
4899 * @param[in] Ib input three-phase coordinate <code>b</code>
4900 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
4901 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
4905 static __INLINE void arm_clarke_f32(
4908 float32_t * pIalpha,
4911 /* Calculate pIalpha using the equation, pIalpha = Ia */
4914 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
4915 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
4920 * @brief Clarke transform for Q31 version
4921 * @param[in] Ia input three-phase coordinate <code>a</code>
4922 * @param[in] Ib input three-phase coordinate <code>b</code>
4923 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
4924 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
4927 * <b>Scaling and Overflow Behavior:</b>
4929 * The function is implemented using an internal 32-bit accumulator.
4930 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
4931 * There is saturation on the addition, hence there is no risk of overflow.
4934 static __INLINE void arm_clarke_q31(
4940 q31_t product1, product2; /* Temporary variables used to store intermediate results */
4942 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
4945 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
4946 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
4948 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
4949 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
4951 /* pIbeta is calculated by adding the intermediate products */
4952 *pIbeta = __QADD(product1, product2);
4956 * @} end of clarke group
4960 * @brief Converts the elements of the Q7 vector to Q31 vector.
4961 * @param[in] *pSrc input pointer
4962 * @param[out] *pDst output pointer
4963 * @param[in] blockSize number of samples to process
4969 uint32_t blockSize);
4975 * @ingroup groupController
4979 * @defgroup inv_clarke Vector Inverse Clarke Transform
4980 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
4982 * The function operates on a single sample of data and each call to the function returns the processed output.
4983 * The library provides separate functions for Q31 and floating-point data types.
4985 * \image html clarkeInvFormula.gif
4986 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
4987 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
4988 * \par Fixed-Point Behavior
4989 * Care must be taken when using the Q31 version of the Clarke transform.
4990 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
4991 * Refer to the function specific documentation below for usage guidelines.
4995 * @addtogroup inv_clarke
5000 * @brief Floating-point Inverse Clarke transform
5001 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5002 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5003 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
5004 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
5009 static __INLINE void arm_inv_clarke_f32(
5015 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5018 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
5019 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
5024 * @brief Inverse Clarke transform for Q31 version
5025 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5026 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5027 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
5028 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
5031 * <b>Scaling and Overflow Behavior:</b>
5033 * The function is implemented using an internal 32-bit accumulator.
5034 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5035 * There is saturation on the subtraction, hence there is no risk of overflow.
5038 static __INLINE void arm_inv_clarke_q31(
5044 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5046 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5049 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
5050 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
5052 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
5053 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
5055 /* pIb is calculated by subtracting the products */
5056 *pIb = __QSUB(product2, product1);
5061 * @} end of inv_clarke group
5065 * @brief Converts the elements of the Q7 vector to Q15 vector.
5066 * @param[in] *pSrc input pointer
5067 * @param[out] *pDst output pointer
5068 * @param[in] blockSize number of samples to process
5074 uint32_t blockSize);
5079 * @ingroup groupController
5083 * @defgroup park Vector Park Transform
5085 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
5086 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
5087 * from the stationary to the moving reference frame and control the spatial relationship between
5088 * the stator vector current and rotor flux vector.
5089 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
5090 * current vector and the relationship from the two reference frames:
5091 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
5093 * The function operates on a single sample of data and each call to the function returns the processed output.
5094 * The library provides separate functions for Q31 and floating-point data types.
5096 * \image html parkFormula.gif
5097 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
5098 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5099 * cosine and sine values of theta (rotor flux position).
5100 * \par Fixed-Point Behavior
5101 * Care must be taken when using the Q31 version of the Park transform.
5102 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5103 * Refer to the function specific documentation below for usage guidelines.
5112 * @brief Floating-point Park transform
5113 * @param[in] Ialpha input two-phase vector coordinate alpha
5114 * @param[in] Ibeta input two-phase vector coordinate beta
5115 * @param[out] *pId points to output rotor reference frame d
5116 * @param[out] *pIq points to output rotor reference frame q
5117 * @param[in] sinVal sine value of rotation angle theta
5118 * @param[in] cosVal cosine value of rotation angle theta
5121 * The function implements the forward Park transform.
5125 static __INLINE void arm_park_f32(
5133 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
5134 *pId = Ialpha * cosVal + Ibeta * sinVal;
5136 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
5137 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
5142 * @brief Park transform for Q31 version
5143 * @param[in] Ialpha input two-phase vector coordinate alpha
5144 * @param[in] Ibeta input two-phase vector coordinate beta
5145 * @param[out] *pId points to output rotor reference frame d
5146 * @param[out] *pIq points to output rotor reference frame q
5147 * @param[in] sinVal sine value of rotation angle theta
5148 * @param[in] cosVal cosine value of rotation angle theta
5151 * <b>Scaling and Overflow Behavior:</b>
5153 * The function is implemented using an internal 32-bit accumulator.
5154 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5155 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
5159 static __INLINE void arm_park_q31(
5167 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5168 q31_t product3, product4; /* Temporary variables used to store intermediate results */
5170 /* Intermediate product is calculated by (Ialpha * cosVal) */
5171 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
5173 /* Intermediate product is calculated by (Ibeta * sinVal) */
5174 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
5177 /* Intermediate product is calculated by (Ialpha * sinVal) */
5178 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
5180 /* Intermediate product is calculated by (Ibeta * cosVal) */
5181 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
5183 /* Calculate pId by adding the two intermediate products 1 and 2 */
5184 *pId = __QADD(product1, product2);
5186 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
5187 *pIq = __QSUB(product4, product3);
5191 * @} end of park group
5195 * @brief Converts the elements of the Q7 vector to floating-point vector.
5196 * @param[in] *pSrc is input pointer
5197 * @param[out] *pDst is output pointer
5198 * @param[in] blockSize is the number of samples to process
5201 void arm_q7_to_float(
5204 uint32_t blockSize);
5208 * @ingroup groupController
5212 * @defgroup inv_park Vector Inverse Park transform
5213 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
5215 * The function operates on a single sample of data and each call to the function returns the processed output.
5216 * The library provides separate functions for Q31 and floating-point data types.
5218 * \image html parkInvFormula.gif
5219 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
5220 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5221 * cosine and sine values of theta (rotor flux position).
5222 * \par Fixed-Point Behavior
5223 * Care must be taken when using the Q31 version of the Park transform.
5224 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5225 * Refer to the function specific documentation below for usage guidelines.
5229 * @addtogroup inv_park
5234 * @brief Floating-point Inverse Park transform
5235 * @param[in] Id input coordinate of rotor reference frame d
5236 * @param[in] Iq input coordinate of rotor reference frame q
5237 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
5238 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
5239 * @param[in] sinVal sine value of rotation angle theta
5240 * @param[in] cosVal cosine value of rotation angle theta
5244 static __INLINE void arm_inv_park_f32(
5247 float32_t * pIalpha,
5252 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
5253 *pIalpha = Id * cosVal - Iq * sinVal;
5255 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
5256 *pIbeta = Id * sinVal + Iq * cosVal;
5262 * @brief Inverse Park transform for Q31 version
5263 * @param[in] Id input coordinate of rotor reference frame d
5264 * @param[in] Iq input coordinate of rotor reference frame q
5265 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
5266 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
5267 * @param[in] sinVal sine value of rotation angle theta
5268 * @param[in] cosVal cosine value of rotation angle theta
5271 * <b>Scaling and Overflow Behavior:</b>
5273 * The function is implemented using an internal 32-bit accumulator.
5274 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5275 * There is saturation on the addition, hence there is no risk of overflow.
5279 static __INLINE void arm_inv_park_q31(
5287 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5288 q31_t product3, product4; /* Temporary variables used to store intermediate results */
5290 /* Intermediate product is calculated by (Id * cosVal) */
5291 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
5293 /* Intermediate product is calculated by (Iq * sinVal) */
5294 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
5297 /* Intermediate product is calculated by (Id * sinVal) */
5298 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
5300 /* Intermediate product is calculated by (Iq * cosVal) */
5301 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
5303 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
5304 *pIalpha = __QSUB(product1, product2);
5306 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
5307 *pIbeta = __QADD(product4, product3);
5312 * @} end of Inverse park group
5317 * @brief Converts the elements of the Q31 vector to floating-point vector.
5318 * @param[in] *pSrc is input pointer
5319 * @param[out] *pDst is output pointer
5320 * @param[in] blockSize is the number of samples to process
5323 void arm_q31_to_float(
5326 uint32_t blockSize);
5329 * @ingroup groupInterpolation
5333 * @defgroup LinearInterpolate Linear Interpolation
5335 * Linear interpolation is a method of curve fitting using linear polynomials.
5336 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
5339 * \image html LinearInterp.gif "Linear interpolation"
5342 * A Linear Interpolate function calculates an output value(y), for the input(x)
5343 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
5347 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
5348 * where x0, x1 are nearest values of input x
5349 * y0, y1 are nearest values to output y
5353 * This set of functions implements Linear interpolation process
5354 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
5355 * sample of data and each call to the function returns a single processed value.
5356 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
5357 * <code>x</code> is the input sample value. The functions returns the output value.
5360 * if x is outside of the table boundary, Linear interpolation returns first value of the table
5361 * if x is below input range and returns last value of table if x is above range.
5365 * @addtogroup LinearInterpolate
5370 * @brief Process function for the floating-point Linear Interpolation Function.
5371 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
5372 * @param[in] x input sample to process
5373 * @return y processed output sample.
5377 static __INLINE float32_t arm_linear_interp_f32(
5378 arm_linear_interp_instance_f32 * S,
5383 float32_t x0, x1; /* Nearest input values */
5384 float32_t y0, y1; /* Nearest output values */
5385 float32_t xSpacing = S->xSpacing; /* spacing between input values */
5386 int32_t i; /* Index variable */
5387 float32_t *pYData = S->pYData; /* pointer to output table */
5389 /* Calculation of index */
5390 i = (x - S->x1) / xSpacing;
5394 /* Iniatilize output for below specified range as least output value of table */
5397 else if(i >= S->nValues)
5399 /* Iniatilize output for above specified range as last output value of table */
5400 y = pYData[S->nValues-1];
5404 /* Calculation of nearest input values */
5405 x0 = S->x1 + i * xSpacing;
5406 x1 = S->x1 + (i +1) * xSpacing;
5408 /* Read of nearest output values */
5412 /* Calculation of output */
5413 y = y0 + (x - x0) * ((y1 - y0)/(x1-x0));
5417 /* returns output value */
5423 * @brief Process function for the Q31 Linear Interpolation Function.
5424 * @param[in] *pYData pointer to Q31 Linear Interpolation table
5425 * @param[in] x input sample to process
5426 * @param[in] nValues number of table values
5427 * @return y processed output sample.
5430 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5431 * This function can support maximum of table size 2^12.
5436 static __INLINE q31_t arm_linear_interp_q31(q31_t *pYData,
5437 q31_t x, uint32_t nValues)
5439 q31_t y; /* output */
5440 q31_t y0, y1; /* Nearest output values */
5441 q31_t fract; /* fractional part */
5442 int32_t index; /* Index to read nearest output values */
5444 /* Input is in 12.20 format */
5445 /* 12 bits for the table index */
5446 /* Index value calculation */
5447 index = ((x & 0xFFF00000) >> 20);
5449 if(index >= (nValues - 1))
5451 return(pYData[nValues - 1]);
5460 /* 20 bits for the fractional part */
5461 /* shift left by 11 to keep fract in 1.31 format */
5462 fract = (x & 0x000FFFFF) << 11;
5464 /* Read two nearest output values from the index in 1.31(q31) format */
5466 y1 = pYData[index + 1u];
5468 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
5469 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
5471 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
5472 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
5474 /* Convert y to 1.31 format */
5483 * @brief Process function for the Q15 Linear Interpolation Function.
5484 * @param[in] *pYData pointer to Q15 Linear Interpolation table
5485 * @param[in] x input sample to process
5486 * @param[in] nValues number of table values
5487 * @return y processed output sample.
5490 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5491 * This function can support maximum of table size 2^12.
5496 static __INLINE q15_t arm_linear_interp_q15(q15_t *pYData, q31_t x, uint32_t nValues)
5498 q63_t y; /* output */
5499 q15_t y0, y1; /* Nearest output values */
5500 q31_t fract; /* fractional part */
5501 int32_t index; /* Index to read nearest output values */
5503 /* Input is in 12.20 format */
5504 /* 12 bits for the table index */
5505 /* Index value calculation */
5506 index = ((x & 0xFFF00000) >> 20u);
5508 if(index >= (nValues - 1))
5510 return(pYData[nValues - 1]);
5518 /* 20 bits for the fractional part */
5519 /* fract is in 12.20 format */
5520 fract = (x & 0x000FFFFF);
5522 /* Read two nearest output values from the index */
5524 y1 = pYData[index + 1u];
5526 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
5527 y = ((q63_t) y0 * (0xFFFFF - fract));
5529 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
5530 y += ((q63_t) y1 * (fract));
5532 /* convert y to 1.15 format */
5541 * @brief Process function for the Q7 Linear Interpolation Function.
5542 * @param[in] *pYData pointer to Q7 Linear Interpolation table
5543 * @param[in] x input sample to process
5544 * @param[in] nValues number of table values
5545 * @return y processed output sample.
5548 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5549 * This function can support maximum of table size 2^12.
5553 static __INLINE q7_t arm_linear_interp_q7(q7_t *pYData, q31_t x, uint32_t nValues)
5555 q31_t y; /* output */
5556 q7_t y0, y1; /* Nearest output values */
5557 q31_t fract; /* fractional part */
5558 int32_t index; /* Index to read nearest output values */
5560 /* Input is in 12.20 format */
5561 /* 12 bits for the table index */
5562 /* Index value calculation */
5563 index = ((x & 0xFFF00000) >> 20u);
5566 if(index >= (nValues - 1))
5568 return(pYData[nValues - 1]);
5577 /* 20 bits for the fractional part */
5578 /* fract is in 12.20 format */
5579 fract = (x & 0x000FFFFF);
5581 /* Read two nearest output values from the index and are in 1.7(q7) format */
5583 y1 = pYData[index + 1u];
5585 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
5586 y = ((y0 * (0xFFFFF - fract)));
5588 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
5591 /* convert y to 1.7(q7) format */
5598 * @} end of LinearInterpolate group
5602 * @brief Fast approximation to the trigonometric sine function for floating-point data.
5603 * @param[in] x input value in radians.
5607 float32_t arm_sin_f32(
5611 * @brief Fast approximation to the trigonometric sine function for Q31 data.
5612 * @param[in] x Scaled input value in radians.
5620 * @brief Fast approximation to the trigonometric sine function for Q15 data.
5621 * @param[in] x Scaled input value in radians.
5629 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
5630 * @param[in] x input value in radians.
5634 float32_t arm_cos_f32(
5638 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
5639 * @param[in] x Scaled input value in radians.
5647 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
5648 * @param[in] x Scaled input value in radians.
5657 * @ingroup groupFastMath
5662 * @defgroup SQRT Square Root
5664 * Computes the square root of a number.
5665 * There are separate functions for Q15, Q31, and floating-point data types.
5666 * The square root function is computed using the Newton-Raphson algorithm.
5667 * This is an iterative algorithm of the form:
5669 * x1 = x0 - f(x0)/f'(x0)
5671 * where <code>x1</code> is the current estimate,
5672 * <code>x0</code> is the previous estimate and
5673 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
5674 * For the square root function, the algorithm reduces to:
5676 * x0 = in/2 [initial guess]
5677 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
5688 * @brief Floating-point square root function.
5689 * @param[in] in input value.
5690 * @param[out] *pOut square root of input value.
5691 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5692 * <code>in</code> is negative value and returns zero output for negative values.
5695 static __INLINE arm_status arm_sqrt_f32(
5696 float32_t in, float32_t *pOut)
5702 #if (__FPU_USED == 1) && defined ( __CC_ARM )
5703 *pOut = __sqrtf(in);
5708 return (ARM_MATH_SUCCESS);
5713 return (ARM_MATH_ARGUMENT_ERROR);
5720 * @brief Q31 square root function.
5721 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
5722 * @param[out] *pOut square root of input value.
5723 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5724 * <code>in</code> is negative value and returns zero output for negative values.
5726 arm_status arm_sqrt_q31(
5727 q31_t in, q31_t *pOut);
5730 * @brief Q15 square root function.
5731 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
5732 * @param[out] *pOut square root of input value.
5733 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5734 * <code>in</code> is negative value and returns zero output for negative values.
5736 arm_status arm_sqrt_q15(
5737 q15_t in, q15_t *pOut);
5740 * @} end of SQRT group
5749 * @brief floating-point Circular write function.
5752 static __INLINE void arm_circularWrite_f32(
5753 int32_t * circBuffer,
5755 uint16_t * writeOffset,
5757 const int32_t * src,
5764 /* Copy the value of Index pointer that points
5765 * to the current location where the input samples to be copied */
5766 wOffset = *writeOffset;
5768 /* Loop over the blockSize */
5773 /* copy the input sample to the circular buffer */
5774 circBuffer[wOffset] = *src;
5776 /* Update the input pointer */
5779 /* Circularly update wOffset. Watch out for positive and negative value */
5780 wOffset += bufferInc;
5784 /* Decrement the loop counter */
5788 /* Update the index pointer */
5789 *writeOffset = wOffset;
5795 * @brief floating-point Circular Read function.
5797 static __INLINE void arm_circularRead_f32(
5798 int32_t * circBuffer,
5800 int32_t * readOffset,
5809 int32_t rOffset, dst_end;
5811 /* Copy the value of Index pointer that points
5812 * to the current location from where the input samples to be read */
5813 rOffset = *readOffset;
5814 dst_end = (int32_t) (dst_base + dst_length);
5816 /* Loop over the blockSize */
5821 /* copy the sample from the circular buffer to the destination buffer */
5822 *dst = circBuffer[rOffset];
5824 /* Update the input pointer */
5827 if(dst == (int32_t *) dst_end)
5832 /* Circularly update rOffset. Watch out for positive and negative value */
5833 rOffset += bufferInc;
5840 /* Decrement the loop counter */
5844 /* Update the index pointer */
5845 *readOffset = rOffset;
5849 * @brief Q15 Circular write function.
5852 static __INLINE void arm_circularWrite_q15(
5855 uint16_t * writeOffset,
5864 /* Copy the value of Index pointer that points
5865 * to the current location where the input samples to be copied */
5866 wOffset = *writeOffset;
5868 /* Loop over the blockSize */
5873 /* copy the input sample to the circular buffer */
5874 circBuffer[wOffset] = *src;
5876 /* Update the input pointer */
5879 /* Circularly update wOffset. Watch out for positive and negative value */
5880 wOffset += bufferInc;
5884 /* Decrement the loop counter */
5888 /* Update the index pointer */
5889 *writeOffset = wOffset;
5895 * @brief Q15 Circular Read function.
5897 static __INLINE void arm_circularRead_q15(
5900 int32_t * readOffset,
5909 int32_t rOffset, dst_end;
5911 /* Copy the value of Index pointer that points
5912 * to the current location from where the input samples to be read */
5913 rOffset = *readOffset;
5915 dst_end = (int32_t) (dst_base + dst_length);
5917 /* Loop over the blockSize */
5922 /* copy the sample from the circular buffer to the destination buffer */
5923 *dst = circBuffer[rOffset];
5925 /* Update the input pointer */
5928 if(dst == (q15_t *) dst_end)
5933 /* Circularly update wOffset. Watch out for positive and negative value */
5934 rOffset += bufferInc;
5941 /* Decrement the loop counter */
5945 /* Update the index pointer */
5946 *readOffset = rOffset;
5951 * @brief Q7 Circular write function.
5954 static __INLINE void arm_circularWrite_q7(
5957 uint16_t * writeOffset,
5966 /* Copy the value of Index pointer that points
5967 * to the current location where the input samples to be copied */
5968 wOffset = *writeOffset;
5970 /* Loop over the blockSize */
5975 /* copy the input sample to the circular buffer */
5976 circBuffer[wOffset] = *src;
5978 /* Update the input pointer */
5981 /* Circularly update wOffset. Watch out for positive and negative value */
5982 wOffset += bufferInc;
5986 /* Decrement the loop counter */
5990 /* Update the index pointer */
5991 *writeOffset = wOffset;
5997 * @brief Q7 Circular Read function.
5999 static __INLINE void arm_circularRead_q7(
6002 int32_t * readOffset,
6011 int32_t rOffset, dst_end;
6013 /* Copy the value of Index pointer that points
6014 * to the current location from where the input samples to be read */
6015 rOffset = *readOffset;
6017 dst_end = (int32_t) (dst_base + dst_length);
6019 /* Loop over the blockSize */
6024 /* copy the sample from the circular buffer to the destination buffer */
6025 *dst = circBuffer[rOffset];
6027 /* Update the input pointer */
6030 if(dst == (q7_t *) dst_end)
6035 /* Circularly update rOffset. Watch out for positive and negative value */
6036 rOffset += bufferInc;
6043 /* Decrement the loop counter */
6047 /* Update the index pointer */
6048 *readOffset = rOffset;
6053 * @brief Sum of the squares of the elements of a Q31 vector.
6054 * @param[in] *pSrc is input pointer
6055 * @param[in] blockSize is the number of samples to process
6056 * @param[out] *pResult is output value.
6066 * @brief Sum of the squares of the elements of a floating-point vector.
6067 * @param[in] *pSrc is input pointer
6068 * @param[in] blockSize is the number of samples to process
6069 * @param[out] *pResult is output value.
6076 float32_t * pResult);
6079 * @brief Sum of the squares of the elements of a Q15 vector.
6080 * @param[in] *pSrc is input pointer
6081 * @param[in] blockSize is the number of samples to process
6082 * @param[out] *pResult is output value.
6092 * @brief Sum of the squares of the elements of a Q7 vector.
6093 * @param[in] *pSrc is input pointer
6094 * @param[in] blockSize is the number of samples to process
6095 * @param[out] *pResult is output value.
6105 * @brief Mean value of a Q7 vector.
6106 * @param[in] *pSrc is input pointer
6107 * @param[in] blockSize is the number of samples to process
6108 * @param[out] *pResult is output value.
6118 * @brief Mean value of a Q15 vector.
6119 * @param[in] *pSrc is input pointer
6120 * @param[in] blockSize is the number of samples to process
6121 * @param[out] *pResult is output value.
6130 * @brief Mean value of a Q31 vector.
6131 * @param[in] *pSrc is input pointer
6132 * @param[in] blockSize is the number of samples to process
6133 * @param[out] *pResult is output value.
6142 * @brief Mean value of a floating-point vector.
6143 * @param[in] *pSrc is input pointer
6144 * @param[in] blockSize is the number of samples to process
6145 * @param[out] *pResult is output value.
6151 float32_t * pResult);
6154 * @brief Variance of the elements of a floating-point vector.
6155 * @param[in] *pSrc is input pointer
6156 * @param[in] blockSize is the number of samples to process
6157 * @param[out] *pResult is output value.
6164 float32_t * pResult);
6167 * @brief Variance of the elements of a Q31 vector.
6168 * @param[in] *pSrc is input pointer
6169 * @param[in] blockSize is the number of samples to process
6170 * @param[out] *pResult is output value.
6180 * @brief Variance of the elements of a Q15 vector.
6181 * @param[in] *pSrc is input pointer
6182 * @param[in] blockSize is the number of samples to process
6183 * @param[out] *pResult is output value.
6193 * @brief Root Mean Square of the elements of a floating-point vector.
6194 * @param[in] *pSrc is input pointer
6195 * @param[in] blockSize is the number of samples to process
6196 * @param[out] *pResult is output value.
6203 float32_t * pResult);
6206 * @brief Root Mean Square of the elements of a Q31 vector.
6207 * @param[in] *pSrc is input pointer
6208 * @param[in] blockSize is the number of samples to process
6209 * @param[out] *pResult is output value.
6219 * @brief Root Mean Square of the elements of a Q15 vector.
6220 * @param[in] *pSrc is input pointer
6221 * @param[in] blockSize is the number of samples to process
6222 * @param[out] *pResult is output value.
6232 * @brief Standard deviation of the elements of a floating-point vector.
6233 * @param[in] *pSrc is input pointer
6234 * @param[in] blockSize is the number of samples to process
6235 * @param[out] *pResult is output value.
6242 float32_t * pResult);
6245 * @brief Standard deviation of the elements of a Q31 vector.
6246 * @param[in] *pSrc is input pointer
6247 * @param[in] blockSize is the number of samples to process
6248 * @param[out] *pResult is output value.
6258 * @brief Standard deviation of the elements of a Q15 vector.
6259 * @param[in] *pSrc is input pointer
6260 * @param[in] blockSize is the number of samples to process
6261 * @param[out] *pResult is output value.
6271 * @brief Floating-point complex magnitude
6272 * @param[in] *pSrc points to the complex input vector
6273 * @param[out] *pDst points to the real output vector
6274 * @param[in] numSamples number of complex samples in the input vector
6278 void arm_cmplx_mag_f32(
6281 uint32_t numSamples);
6284 * @brief Q31 complex magnitude
6285 * @param[in] *pSrc points to the complex input vector
6286 * @param[out] *pDst points to the real output vector
6287 * @param[in] numSamples number of complex samples in the input vector
6291 void arm_cmplx_mag_q31(
6294 uint32_t numSamples);
6297 * @brief Q15 complex magnitude
6298 * @param[in] *pSrc points to the complex input vector
6299 * @param[out] *pDst points to the real output vector
6300 * @param[in] numSamples number of complex samples in the input vector
6304 void arm_cmplx_mag_q15(
6307 uint32_t numSamples);
6310 * @brief Q15 complex dot product
6311 * @param[in] *pSrcA points to the first input vector
6312 * @param[in] *pSrcB points to the second input vector
6313 * @param[in] numSamples number of complex samples in each vector
6314 * @param[out] *realResult real part of the result returned here
6315 * @param[out] *imagResult imaginary part of the result returned here
6319 void arm_cmplx_dot_prod_q15(
6322 uint32_t numSamples,
6324 q31_t * imagResult);
6327 * @brief Q31 complex dot product
6328 * @param[in] *pSrcA points to the first input vector
6329 * @param[in] *pSrcB points to the second input vector
6330 * @param[in] numSamples number of complex samples in each vector
6331 * @param[out] *realResult real part of the result returned here
6332 * @param[out] *imagResult imaginary part of the result returned here
6336 void arm_cmplx_dot_prod_q31(
6339 uint32_t numSamples,
6341 q63_t * imagResult);
6344 * @brief Floating-point complex dot product
6345 * @param[in] *pSrcA points to the first input vector
6346 * @param[in] *pSrcB points to the second input vector
6347 * @param[in] numSamples number of complex samples in each vector
6348 * @param[out] *realResult real part of the result returned here
6349 * @param[out] *imagResult imaginary part of the result returned here
6353 void arm_cmplx_dot_prod_f32(
6356 uint32_t numSamples,
6357 float32_t * realResult,
6358 float32_t * imagResult);
6361 * @brief Q15 complex-by-real multiplication
6362 * @param[in] *pSrcCmplx points to the complex input vector
6363 * @param[in] *pSrcReal points to the real input vector
6364 * @param[out] *pCmplxDst points to the complex output vector
6365 * @param[in] numSamples number of samples in each vector
6369 void arm_cmplx_mult_real_q15(
6373 uint32_t numSamples);
6376 * @brief Q31 complex-by-real multiplication
6377 * @param[in] *pSrcCmplx points to the complex input vector
6378 * @param[in] *pSrcReal points to the real input vector
6379 * @param[out] *pCmplxDst points to the complex output vector
6380 * @param[in] numSamples number of samples in each vector
6384 void arm_cmplx_mult_real_q31(
6388 uint32_t numSamples);
6391 * @brief Floating-point complex-by-real multiplication
6392 * @param[in] *pSrcCmplx points to the complex input vector
6393 * @param[in] *pSrcReal points to the real input vector
6394 * @param[out] *pCmplxDst points to the complex output vector
6395 * @param[in] numSamples number of samples in each vector
6399 void arm_cmplx_mult_real_f32(
6400 float32_t * pSrcCmplx,
6401 float32_t * pSrcReal,
6402 float32_t * pCmplxDst,
6403 uint32_t numSamples);
6406 * @brief Minimum value of a Q7 vector.
6407 * @param[in] *pSrc is input pointer
6408 * @param[in] blockSize is the number of samples to process
6409 * @param[out] *result is output pointer
6410 * @param[in] index is the array index of the minimum value in the input buffer.
6421 * @brief Minimum value of a Q15 vector.
6422 * @param[in] *pSrc is input pointer
6423 * @param[in] blockSize is the number of samples to process
6424 * @param[out] *pResult is output pointer
6425 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
6436 * @brief Minimum value of a Q31 vector.
6437 * @param[in] *pSrc is input pointer
6438 * @param[in] blockSize is the number of samples to process
6439 * @param[out] *pResult is output pointer
6440 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
6450 * @brief Minimum value of a floating-point vector.
6451 * @param[in] *pSrc is input pointer
6452 * @param[in] blockSize is the number of samples to process
6453 * @param[out] *pResult is output pointer
6454 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
6461 float32_t * pResult,
6465 * @brief Maximum value of a Q7 vector.
6466 * @param[in] *pSrc points to the input buffer
6467 * @param[in] blockSize length of the input vector
6468 * @param[out] *pResult maximum value returned here
6469 * @param[out] *pIndex index of maximum value returned here
6480 * @brief Maximum value of a Q15 vector.
6481 * @param[in] *pSrc points to the input buffer
6482 * @param[in] blockSize length of the input vector
6483 * @param[out] *pResult maximum value returned here
6484 * @param[out] *pIndex index of maximum value returned here
6495 * @brief Maximum value of a Q31 vector.
6496 * @param[in] *pSrc points to the input buffer
6497 * @param[in] blockSize length of the input vector
6498 * @param[out] *pResult maximum value returned here
6499 * @param[out] *pIndex index of maximum value returned here
6510 * @brief Maximum value of a floating-point vector.
6511 * @param[in] *pSrc points to the input buffer
6512 * @param[in] blockSize length of the input vector
6513 * @param[out] *pResult maximum value returned here
6514 * @param[out] *pIndex index of maximum value returned here
6521 float32_t * pResult,
6525 * @brief Q15 complex-by-complex multiplication
6526 * @param[in] *pSrcA points to the first input vector
6527 * @param[in] *pSrcB points to the second input vector
6528 * @param[out] *pDst points to the output vector
6529 * @param[in] numSamples number of complex samples in each vector
6533 void arm_cmplx_mult_cmplx_q15(
6537 uint32_t numSamples);
6540 * @brief Q31 complex-by-complex multiplication
6541 * @param[in] *pSrcA points to the first input vector
6542 * @param[in] *pSrcB points to the second input vector
6543 * @param[out] *pDst points to the output vector
6544 * @param[in] numSamples number of complex samples in each vector
6548 void arm_cmplx_mult_cmplx_q31(
6552 uint32_t numSamples);
6555 * @brief Floating-point complex-by-complex multiplication
6556 * @param[in] *pSrcA points to the first input vector
6557 * @param[in] *pSrcB points to the second input vector
6558 * @param[out] *pDst points to the output vector
6559 * @param[in] numSamples number of complex samples in each vector
6563 void arm_cmplx_mult_cmplx_f32(
6567 uint32_t numSamples);
6570 * @brief Converts the elements of the floating-point vector to Q31 vector.
6571 * @param[in] *pSrc points to the floating-point input vector
6572 * @param[out] *pDst points to the Q31 output vector
6573 * @param[in] blockSize length of the input vector
6576 void arm_float_to_q31(
6579 uint32_t blockSize);
6582 * @brief Converts the elements of the floating-point vector to Q15 vector.
6583 * @param[in] *pSrc points to the floating-point input vector
6584 * @param[out] *pDst points to the Q15 output vector
6585 * @param[in] blockSize length of the input vector
6588 void arm_float_to_q15(
6591 uint32_t blockSize);
6594 * @brief Converts the elements of the floating-point vector to Q7 vector.
6595 * @param[in] *pSrc points to the floating-point input vector
6596 * @param[out] *pDst points to the Q7 output vector
6597 * @param[in] blockSize length of the input vector
6600 void arm_float_to_q7(
6603 uint32_t blockSize);
6607 * @brief Converts the elements of the Q31 vector to Q15 vector.
6608 * @param[in] *pSrc is input pointer
6609 * @param[out] *pDst is output pointer
6610 * @param[in] blockSize is the number of samples to process
6613 void arm_q31_to_q15(
6616 uint32_t blockSize);
6619 * @brief Converts the elements of the Q31 vector to Q7 vector.
6620 * @param[in] *pSrc is input pointer
6621 * @param[out] *pDst is output pointer
6622 * @param[in] blockSize is the number of samples to process
6628 uint32_t blockSize);
6631 * @brief Converts the elements of the Q15 vector to floating-point vector.
6632 * @param[in] *pSrc is input pointer
6633 * @param[out] *pDst is output pointer
6634 * @param[in] blockSize is the number of samples to process
6637 void arm_q15_to_float(
6640 uint32_t blockSize);
6644 * @brief Converts the elements of the Q15 vector to Q31 vector.
6645 * @param[in] *pSrc is input pointer
6646 * @param[out] *pDst is output pointer
6647 * @param[in] blockSize is the number of samples to process
6650 void arm_q15_to_q31(
6653 uint32_t blockSize);
6657 * @brief Converts the elements of the Q15 vector to Q7 vector.
6658 * @param[in] *pSrc is input pointer
6659 * @param[out] *pDst is output pointer
6660 * @param[in] blockSize is the number of samples to process
6666 uint32_t blockSize);
6670 * @ingroup groupInterpolation
6674 * @defgroup BilinearInterpolate Bilinear Interpolation
6676 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
6677 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
6678 * determines values between the grid points.
6679 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
6680 * Bilinear interpolation is often used in image processing to rescale images.
6681 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
6685 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
6686 * For floating-point, the instance structure is defined as:
6693 * } arm_bilinear_interp_instance_f32;
6697 * where <code>numRows</code> specifies the number of rows in the table;
6698 * <code>numCols</code> specifies the number of columns in the table;
6699 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
6700 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
6701 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
6704 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
6710 * The interpolated output point is computed as:
6712 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
6713 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
6714 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
6715 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
6717 * Note that the coordinates (x, y) contain integer and fractional components.
6718 * The integer components specify which portion of the table to use while the
6719 * fractional components control the interpolation processor.
6722 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
6726 * @addtogroup BilinearInterpolate
6732 * @brief Floating-point bilinear interpolation.
6733 * @param[in,out] *S points to an instance of the interpolation structure.
6734 * @param[in] X interpolation coordinate.
6735 * @param[in] Y interpolation coordinate.
6736 * @return out interpolated value.
6740 static __INLINE float32_t arm_bilinear_interp_f32(
6741 const arm_bilinear_interp_instance_f32 * S,
6746 float32_t f00, f01, f10, f11;
6747 float32_t *pData = S->pData;
6748 int32_t xIndex, yIndex, index;
6749 float32_t xdiff, ydiff;
6750 float32_t b1, b2, b3, b4;
6752 xIndex = (int32_t) X;
6753 yIndex = (int32_t) Y;
6755 /* Care taken for table outside boundary */
6756 /* Returns zero output when values are outside table boundary */
6757 if(xIndex < 0 || xIndex > (S->numRows-1) || yIndex < 0 || yIndex > ( S->numCols-1))
6762 /* Calculation of index for two nearest points in X-direction */
6763 index = (xIndex - 1) + (yIndex-1) * S->numCols ;
6766 /* Read two nearest points in X-direction */
6768 f01 = pData[index + 1];
6770 /* Calculation of index for two nearest points in Y-direction */
6771 index = (xIndex-1) + (yIndex) * S->numCols;
6774 /* Read two nearest points in Y-direction */
6776 f11 = pData[index + 1];
6778 /* Calculation of intermediate values */
6782 b4 = f00 - f01 - f10 + f11;
6784 /* Calculation of fractional part in X */
6787 /* Calculation of fractional part in Y */
6790 /* Calculation of bi-linear interpolated output */
6791 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
6793 /* return to application */
6800 * @brief Q31 bilinear interpolation.
6801 * @param[in,out] *S points to an instance of the interpolation structure.
6802 * @param[in] X interpolation coordinate in 12.20 format.
6803 * @param[in] Y interpolation coordinate in 12.20 format.
6804 * @return out interpolated value.
6807 static __INLINE q31_t arm_bilinear_interp_q31(
6808 arm_bilinear_interp_instance_q31 * S,
6812 q31_t out; /* Temporary output */
6813 q31_t acc = 0; /* output */
6814 q31_t xfract, yfract; /* X, Y fractional parts */
6815 q31_t x1, x2, y1, y2; /* Nearest output values */
6816 int32_t rI, cI; /* Row and column indices */
6817 q31_t *pYData = S->pData; /* pointer to output table values */
6818 uint32_t nCols = S->numCols; /* num of rows */
6821 /* Input is in 12.20 format */
6822 /* 12 bits for the table index */
6823 /* Index value calculation */
6824 rI = ((X & 0xFFF00000) >> 20u);
6826 /* Input is in 12.20 format */
6827 /* 12 bits for the table index */
6828 /* Index value calculation */
6829 cI = ((Y & 0xFFF00000) >> 20u);
6831 /* Care taken for table outside boundary */
6832 /* Returns zero output when values are outside table boundary */
6833 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
6838 /* 20 bits for the fractional part */
6839 /* shift left xfract by 11 to keep 1.31 format */
6840 xfract = (X & 0x000FFFFF) << 11u;
6842 /* Read two nearest output values from the index */
6843 x1 = pYData[(rI) + nCols * (cI)];
6844 x2 = pYData[(rI) + nCols * (cI) + 1u];
6846 /* 20 bits for the fractional part */
6847 /* shift left yfract by 11 to keep 1.31 format */
6848 yfract = (Y & 0x000FFFFF) << 11u;
6850 /* Read two nearest output values from the index */
6851 y1 = pYData[(rI) + nCols * (cI + 1)];
6852 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
6854 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
6855 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
6856 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
6858 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
6859 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
6860 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
6862 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
6863 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
6864 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
6866 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
6867 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
6868 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
6870 /* Convert acc to 1.31(q31) format */
6876 * @brief Q15 bilinear interpolation.
6877 * @param[in,out] *S points to an instance of the interpolation structure.
6878 * @param[in] X interpolation coordinate in 12.20 format.
6879 * @param[in] Y interpolation coordinate in 12.20 format.
6880 * @return out interpolated value.
6883 static __INLINE q15_t arm_bilinear_interp_q15(
6884 arm_bilinear_interp_instance_q15 * S,
6888 q63_t acc = 0; /* output */
6889 q31_t out; /* Temporary output */
6890 q15_t x1, x2, y1, y2; /* Nearest output values */
6891 q31_t xfract, yfract; /* X, Y fractional parts */
6892 int32_t rI, cI; /* Row and column indices */
6893 q15_t *pYData = S->pData; /* pointer to output table values */
6894 uint32_t nCols = S->numCols; /* num of rows */
6896 /* Input is in 12.20 format */
6897 /* 12 bits for the table index */
6898 /* Index value calculation */
6899 rI = ((X & 0xFFF00000) >> 20);
6901 /* Input is in 12.20 format */
6902 /* 12 bits for the table index */
6903 /* Index value calculation */
6904 cI = ((Y & 0xFFF00000) >> 20);
6906 /* Care taken for table outside boundary */
6907 /* Returns zero output when values are outside table boundary */
6908 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
6913 /* 20 bits for the fractional part */
6914 /* xfract should be in 12.20 format */
6915 xfract = (X & 0x000FFFFF);
6917 /* Read two nearest output values from the index */
6918 x1 = pYData[(rI) + nCols * (cI)];
6919 x2 = pYData[(rI) + nCols * (cI) + 1u];
6922 /* 20 bits for the fractional part */
6923 /* yfract should be in 12.20 format */
6924 yfract = (Y & 0x000FFFFF);
6926 /* Read two nearest output values from the index */
6927 y1 = pYData[(rI) + nCols * (cI + 1)];
6928 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
6930 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
6932 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
6933 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
6934 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
6935 acc = ((q63_t) out * (0xFFFFF - yfract));
6937 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
6938 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
6939 acc += ((q63_t) out * (xfract));
6941 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
6942 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
6943 acc += ((q63_t) out * (yfract));
6945 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
6946 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
6947 acc += ((q63_t) out * (yfract));
6949 /* acc is in 13.51 format and down shift acc by 36 times */
6950 /* Convert out to 1.15 format */
6956 * @brief Q7 bilinear interpolation.
6957 * @param[in,out] *S points to an instance of the interpolation structure.
6958 * @param[in] X interpolation coordinate in 12.20 format.
6959 * @param[in] Y interpolation coordinate in 12.20 format.
6960 * @return out interpolated value.
6963 static __INLINE q7_t arm_bilinear_interp_q7(
6964 arm_bilinear_interp_instance_q7 * S,
6968 q63_t acc = 0; /* output */
6969 q31_t out; /* Temporary output */
6970 q31_t xfract, yfract; /* X, Y fractional parts */
6971 q7_t x1, x2, y1, y2; /* Nearest output values */
6972 int32_t rI, cI; /* Row and column indices */
6973 q7_t *pYData = S->pData; /* pointer to output table values */
6974 uint32_t nCols = S->numCols; /* num of rows */
6976 /* Input is in 12.20 format */
6977 /* 12 bits for the table index */
6978 /* Index value calculation */
6979 rI = ((X & 0xFFF00000) >> 20);
6981 /* Input is in 12.20 format */
6982 /* 12 bits for the table index */
6983 /* Index value calculation */
6984 cI = ((Y & 0xFFF00000) >> 20);
6986 /* Care taken for table outside boundary */
6987 /* Returns zero output when values are outside table boundary */
6988 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
6993 /* 20 bits for the fractional part */
6994 /* xfract should be in 12.20 format */
6995 xfract = (X & 0x000FFFFF);
6997 /* Read two nearest output values from the index */
6998 x1 = pYData[(rI) + nCols * (cI)];
6999 x2 = pYData[(rI) + nCols * (cI) + 1u];
7002 /* 20 bits for the fractional part */
7003 /* yfract should be in 12.20 format */
7004 yfract = (Y & 0x000FFFFF);
7006 /* Read two nearest output values from the index */
7007 y1 = pYData[(rI) + nCols * (cI + 1)];
7008 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
7010 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
7011 out = ((x1 * (0xFFFFF - xfract)));
7012 acc = (((q63_t) out * (0xFFFFF - yfract)));
7014 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
7015 out = ((x2 * (0xFFFFF - yfract)));
7016 acc += (((q63_t) out * (xfract)));
7018 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
7019 out = ((y1 * (0xFFFFF - xfract)));
7020 acc += (((q63_t) out * (yfract)));
7022 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
7023 out = ((y2 * (yfract)));
7024 acc += (((q63_t) out * (xfract)));
7026 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
7032 * @} end of BilinearInterpolate group
7045 #endif /* _ARM_MATH_H */