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