1 /* ----------------------------------------------------------------------
\r
2 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
\r
4 * $Date: 19. March 2015
\r
7 * Project: CMSIS DSP Library
\r
10 * Description: Public header file for CMSIS DSP Library
\r
12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
\r
14 * Redistribution and use in source and binary forms, with or without
\r
15 * modification, are permitted provided that the following conditions
\r
17 * - Redistributions of source code must retain the above copyright
\r
18 * notice, this list of conditions and the following disclaimer.
\r
19 * - Redistributions in binary form must reproduce the above copyright
\r
20 * notice, this list of conditions and the following disclaimer in
\r
21 * the documentation and/or other materials provided with the
\r
23 * - Neither the name of ARM LIMITED nor the names of its contributors
\r
24 * may be used to endorse or promote products derived from this
\r
25 * software without specific prior written permission.
\r
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
\r
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
\r
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
\r
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
\r
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
\r
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
\r
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
38 * POSSIBILITY OF SUCH DAMAGE.
\r
39 * -------------------------------------------------------------------- */
\r
42 \mainpage CMSIS DSP Software Library
\r
47 * This user manual describes the CMSIS DSP software library,
\r
48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
\r
50 * The library is divided into a number of functions each covering a specific category:
\r
51 * - Basic math functions
\r
52 * - Fast math functions
\r
53 * - Complex math functions
\r
55 * - Matrix functions
\r
57 * - Motor control functions
\r
58 * - Statistical functions
\r
59 * - Support functions
\r
60 * - Interpolation functions
\r
62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
\r
63 * 32-bit integer and 32-bit floating-point values.
\r
68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
\r
69 * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
\r
70 * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
\r
71 * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
\r
72 * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
\r
73 * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
\r
74 * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
\r
75 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
\r
76 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
\r
77 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
\r
78 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
\r
79 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
\r
80 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
\r
81 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
\r
82 * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
\r
84 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
\r
85 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
\r
86 * public header file <code> arm_math.h</code> for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
\r
87 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
\r
88 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
\r
93 * The library ships with a number of examples which demonstrate how to use the library functions.
\r
98 * The library has been developed and tested with MDK-ARM version 5.14.0.0
\r
99 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
\r
101 * Building the Library
\r
104 * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
\r
105 * - arm_cortexM_math.uvprojx
\r
108 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
\r
110 * Pre-processor Macros
\r
113 * Each library project have differant pre-processor macros.
\r
115 * - UNALIGNED_SUPPORT_DISABLE:
\r
117 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
\r
119 * - ARM_MATH_BIG_ENDIAN:
\r
121 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
\r
123 * - ARM_MATH_MATRIX_CHECK:
\r
125 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
\r
127 * - ARM_MATH_ROUNDING:
\r
129 * Define macro ARM_MATH_ROUNDING for rounding on support functions
\r
133 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
\r
134 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
\r
135 * ARM_MATH_CM7 for building the library on cortex-M7.
\r
139 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
\r
142 * CMSIS-DSP in ARM::CMSIS Pack
\r
143 * -----------------------------
\r
145 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
\r
146 * |File/Folder |Content |
\r
147 * |------------------------------|------------------------------------------------------------------------|
\r
148 * |\b CMSIS\\Documentation\\DSP | This documentation |
\r
149 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
\r
150 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
\r
151 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
\r
154 * Revision History of CMSIS-DSP
\r
156 * Please refer to \ref ChangeLog_pg.
\r
161 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
\r
166 * @defgroup groupMath Basic Math Functions
\r
170 * @defgroup groupFastMath Fast Math Functions
\r
171 * This set of functions provides a fast approximation to sine, cosine, and square root.
\r
172 * As compared to most of the other functions in the CMSIS math library, the fast math functions
\r
173 * operate on individual values and not arrays.
\r
174 * There are separate functions for Q15, Q31, and floating-point data.
\r
179 * @defgroup groupCmplxMath Complex Math Functions
\r
180 * This set of functions operates on complex data vectors.
\r
181 * The data in the complex arrays is stored in an interleaved fashion
\r
182 * (real, imag, real, imag, ...).
\r
183 * In the API functions, the number of samples in a complex array refers
\r
184 * to the number of complex values; the array contains twice this number of
\r
189 * @defgroup groupFilters Filtering Functions
\r
193 * @defgroup groupMatrix Matrix Functions
\r
195 * This set of functions provides basic matrix math operations.
\r
196 * The functions operate on matrix data structures. For example,
\r
198 * definition for the floating-point matrix structure is shown
\r
203 * uint16_t numRows; // number of rows of the matrix.
\r
204 * uint16_t numCols; // number of columns of the matrix.
\r
205 * float32_t *pData; // points to the data of the matrix.
\r
206 * } arm_matrix_instance_f32;
\r
208 * There are similar definitions for Q15 and Q31 data types.
\r
210 * The structure specifies the size of the matrix and then points to
\r
211 * an array of data. The array is of size <code>numRows X numCols</code>
\r
212 * and the values are arranged in row order. That is, the
\r
213 * matrix element (i, j) is stored at:
\r
215 * pData[i*numCols + j]
\r
218 * \par Init Functions
\r
219 * There is an associated initialization function for each type of matrix
\r
221 * The initialization function sets the values of the internal structure fields.
\r
222 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
\r
223 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
\r
226 * Use of the initialization function is optional. However, if initialization function is used
\r
227 * then the instance structure cannot be placed into a const data section.
\r
228 * To place the instance structure in a const data
\r
229 * section, manually initialize the data structure. For example:
\r
231 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
\r
232 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
\r
233 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
\r
235 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
\r
236 * specifies the number of columns, and <code>pData</code> points to the
\r
239 * \par Size Checking
\r
240 * By default all of the matrix functions perform size checking on the input and
\r
241 * output matrices. For example, the matrix addition function verifies that the
\r
242 * two input matrices and the output matrix all have the same number of rows and
\r
243 * columns. If the size check fails the functions return:
\r
245 * ARM_MATH_SIZE_MISMATCH
\r
247 * Otherwise the functions return
\r
251 * There is some overhead associated with this matrix size checking.
\r
252 * The matrix size checking is enabled via the \#define
\r
254 * ARM_MATH_MATRIX_CHECK
\r
256 * within the library project settings. By default this macro is defined
\r
257 * and size checking is enabled. By changing the project settings and
\r
258 * undefining this macro size checking is eliminated and the functions
\r
259 * run a bit faster. With size checking disabled the functions always
\r
260 * return <code>ARM_MATH_SUCCESS</code>.
\r
264 * @defgroup groupTransforms Transform Functions
\r
268 * @defgroup groupController Controller Functions
\r
272 * @defgroup groupStats Statistics Functions
\r
275 * @defgroup groupSupport Support Functions
\r
279 * @defgroup groupInterpolation Interpolation Functions
\r
280 * These functions perform 1- and 2-dimensional interpolation of data.
\r
281 * Linear interpolation is used for 1-dimensional data and
\r
282 * bilinear interpolation is used for 2-dimensional data.
\r
286 * @defgroup groupExamples Examples
\r
288 #ifndef _ARM_MATH_H
\r
289 #define _ARM_MATH_H
\r
291 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
\r
293 #if defined(ARM_MATH_CM7)
\r
294 #include "core_cm7.h"
\r
295 #elif defined (ARM_MATH_CM4)
\r
296 #include "core_cm4.h"
\r
297 #elif defined (ARM_MATH_CM3)
\r
298 #include "core_cm3.h"
\r
299 #elif defined (ARM_MATH_CM0)
\r
300 #include "core_cm0.h"
\r
301 #define ARM_MATH_CM0_FAMILY
\r
302 #elif defined (ARM_MATH_CM0PLUS)
\r
303 #include "core_cm0plus.h"
\r
304 #define ARM_MATH_CM0_FAMILY
\r
306 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
\r
309 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
\r
310 #include "string.h"
\r
319 * @brief Macros required for reciprocal calculation in Normalized LMS
\r
322 #define DELTA_Q31 (0x100)
\r
323 #define DELTA_Q15 0x5
\r
324 #define INDEX_MASK 0x0000003F
\r
326 #define PI 3.14159265358979f
\r
330 * @brief Macros required for SINE and COSINE Fast math approximations
\r
333 #define FAST_MATH_TABLE_SIZE 512
\r
334 #define FAST_MATH_Q31_SHIFT (32 - 10)
\r
335 #define FAST_MATH_Q15_SHIFT (16 - 10)
\r
336 #define CONTROLLER_Q31_SHIFT (32 - 9)
\r
337 #define TABLE_SIZE 256
\r
338 #define TABLE_SPACING_Q31 0x400000
\r
339 #define TABLE_SPACING_Q15 0x80
\r
342 * @brief Macros required for SINE and COSINE Controller functions
\r
344 /* 1.31(q31) Fixed value of 2/360 */
\r
345 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
\r
346 #define INPUT_SPACING 0xB60B61
\r
349 * @brief Macro for Unaligned Support
\r
351 #ifndef UNALIGNED_SUPPORT_DISABLE
\r
354 #if defined (__GNUC__)
\r
355 #define ALIGN4 __attribute__((aligned(4)))
\r
357 #define ALIGN4 __align(4)
\r
359 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
\r
362 * @brief Error status returned by some functions in the library.
\r
367 ARM_MATH_SUCCESS = 0, /**< No error */
\r
368 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
\r
369 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
\r
370 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
\r
371 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
\r
372 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
\r
373 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
\r
377 * @brief 8-bit fractional data type in 1.7 format.
\r
379 typedef int8_t q7_t;
\r
382 * @brief 16-bit fractional data type in 1.15 format.
\r
384 typedef int16_t q15_t;
\r
387 * @brief 32-bit fractional data type in 1.31 format.
\r
389 typedef int32_t q31_t;
\r
392 * @brief 64-bit fractional data type in 1.63 format.
\r
394 typedef int64_t q63_t;
\r
397 * @brief 32-bit floating-point type definition.
\r
399 typedef float float32_t;
\r
402 * @brief 64-bit floating-point type definition.
\r
404 typedef double float64_t;
\r
407 * @brief definition to read/write two 16 bit values.
\r
409 #if defined __CC_ARM
\r
410 #define __SIMD32_TYPE int32_t __packed
\r
411 #define CMSIS_UNUSED __attribute__((unused))
\r
412 #elif defined __ICCARM__
\r
413 #define __SIMD32_TYPE int32_t __packed
\r
414 #define CMSIS_UNUSED
\r
415 #elif defined __GNUC__
\r
416 #define __SIMD32_TYPE int32_t
\r
417 #define CMSIS_UNUSED __attribute__((unused))
\r
418 #elif defined __CSMC__ /* Cosmic */
\r
419 #define __SIMD32_TYPE int32_t
\r
420 #define CMSIS_UNUSED
\r
421 #elif defined __TASKING__
\r
422 #define __SIMD32_TYPE __unaligned int32_t
\r
423 #define CMSIS_UNUSED
\r
425 #error Unknown compiler
\r
428 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
\r
429 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
\r
431 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
\r
433 #define __SIMD64(addr) (*(int64_t **) & (addr))
\r
435 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
437 * @brief definition to pack two 16 bit values.
\r
439 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
\r
440 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
\r
441 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
\r
442 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
\r
448 * @brief definition to pack four 8 bit values.
\r
450 #ifndef ARM_MATH_BIG_ENDIAN
\r
452 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
\r
453 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
\r
454 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
\r
455 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
\r
458 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
\r
459 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
\r
460 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
\r
461 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
\r
467 * @brief Clips Q63 to Q31 values.
\r
469 static __INLINE q31_t clip_q63_to_q31(
\r
472 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
473 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
\r
477 * @brief Clips Q63 to Q15 values.
\r
479 static __INLINE q15_t clip_q63_to_q15(
\r
482 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
483 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
\r
487 * @brief Clips Q31 to Q7 values.
\r
489 static __INLINE q7_t clip_q31_to_q7(
\r
492 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
\r
493 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
\r
497 * @brief Clips Q31 to Q15 values.
\r
499 static __INLINE q15_t clip_q31_to_q15(
\r
502 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
\r
503 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
\r
507 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
\r
510 static __INLINE q63_t mult32x64(
\r
514 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
\r
515 (((q63_t) (x >> 32) * y)));
\r
519 //#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
\r
520 //#define __CLZ __clz
\r
523 //note: function can be removed when all toolchain support __CLZ for Cortex-M0
\r
524 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
\r
526 static __INLINE uint32_t __CLZ(
\r
530 static __INLINE uint32_t __CLZ(
\r
533 uint32_t count = 0;
\r
534 uint32_t mask = 0x80000000;
\r
536 while((data & mask) == 0)
\r
549 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
\r
552 static __INLINE uint32_t arm_recip_q31(
\r
555 q31_t * pRecipTable)
\r
558 uint32_t out, tempVal;
\r
564 signBits = __CLZ(in) - 1;
\r
568 signBits = __CLZ(-in) - 1;
\r
571 /* Convert input sample to 1.31 format */
\r
572 in = in << signBits;
\r
574 /* calculation of index for initial approximated Val */
\r
575 index = (uint32_t) (in >> 24u);
\r
576 index = (index & INDEX_MASK);
\r
578 /* 1.31 with exp 1 */
\r
579 out = pRecipTable[index];
\r
581 /* calculation of reciprocal value */
\r
582 /* running approximation for two iterations */
\r
583 for (i = 0u; i < 2u; i++)
\r
585 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
\r
586 tempVal = 0x7FFFFFFF - tempVal;
\r
587 /* 1.31 with exp 1 */
\r
588 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
\r
589 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
\r
595 /* return num of signbits of out = 1/in value */
\r
596 return (signBits + 1u);
\r
601 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
\r
603 static __INLINE uint32_t arm_recip_q15(
\r
606 q15_t * pRecipTable)
\r
609 uint32_t out = 0, tempVal = 0;
\r
610 uint32_t index = 0, i = 0;
\r
611 uint32_t signBits = 0;
\r
615 signBits = __CLZ(in) - 17;
\r
619 signBits = __CLZ(-in) - 17;
\r
622 /* Convert input sample to 1.15 format */
\r
623 in = in << signBits;
\r
625 /* calculation of index for initial approximated Val */
\r
627 index = (index & INDEX_MASK);
\r
629 /* 1.15 with exp 1 */
\r
630 out = pRecipTable[index];
\r
632 /* calculation of reciprocal value */
\r
633 /* running approximation for two iterations */
\r
634 for (i = 0; i < 2; i++)
\r
636 tempVal = (q15_t) (((q31_t) in * out) >> 15);
\r
637 tempVal = 0x7FFF - tempVal;
\r
638 /* 1.15 with exp 1 */
\r
639 out = (q15_t) (((q31_t) out * tempVal) >> 14);
\r
645 /* return num of signbits of out = 1/in value */
\r
646 return (signBits + 1);
\r
652 * @brief C custom defined intrinisic function for only M0 processors
\r
654 #if defined(ARM_MATH_CM0_FAMILY)
\r
656 static __INLINE q31_t __SSAT(
\r
660 int32_t posMax, negMin;
\r
664 for (i = 0; i < (y - 1); i++)
\r
666 posMax = posMax * 2;
\r
671 posMax = (posMax - 1);
\r
692 #endif /* end of ARM_MATH_CM0_FAMILY */
\r
697 * @brief C custom defined intrinsic function for M3 and M0 processors
\r
699 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
702 * @brief C custom defined QADD8 for M3 and M0 processors
\r
704 static __INLINE q31_t __QADD8(
\r
715 r = __SSAT((q31_t) (r + s), 8);
\r
716 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
\r
717 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
\r
718 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
\r
721 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
\r
722 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
\r
729 * @brief C custom defined QSUB8 for M3 and M0 processors
\r
731 static __INLINE q31_t __QSUB8(
\r
742 r = __SSAT((r - s), 8);
\r
743 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
\r
744 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
\r
745 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
\r
748 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
\r
755 * @brief C custom defined QADD16 for M3 and M0 processors
\r
759 * @brief C custom defined QADD16 for M3 and M0 processors
\r
761 static __INLINE q31_t __QADD16(
\r
772 r = __SSAT(r + s, 16);
\r
773 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
\r
775 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
782 * @brief C custom defined SHADD16 for M3 and M0 processors
\r
784 static __INLINE q31_t __SHADD16(
\r
795 r = ((r >> 1) + (s >> 1));
\r
796 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
\r
798 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
805 * @brief C custom defined QSUB16 for M3 and M0 processors
\r
807 static __INLINE q31_t __QSUB16(
\r
818 r = __SSAT(r - s, 16);
\r
819 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
\r
821 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
827 * @brief C custom defined SHSUB16 for M3 and M0 processors
\r
829 static __INLINE q31_t __SHSUB16(
\r
840 r = ((r >> 1) - (s >> 1));
\r
841 s = (((x >> 17) - (y >> 17)) << 16);
\r
843 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
849 * @brief C custom defined QASX for M3 and M0 processors
\r
851 static __INLINE q31_t __QASX(
\r
860 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
\r
861 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
\r
867 * @brief C custom defined SHASX for M3 and M0 processors
\r
869 static __INLINE q31_t __SHASX(
\r
880 r = ((r >> 1) - (y >> 17));
\r
881 s = (((x >> 17) + (s >> 1)) << 16);
\r
883 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
890 * @brief C custom defined QSAX for M3 and M0 processors
\r
892 static __INLINE q31_t __QSAX(
\r
901 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
\r
902 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
\r
908 * @brief C custom defined SHSAX for M3 and M0 processors
\r
910 static __INLINE q31_t __SHSAX(
\r
921 r = ((r >> 1) + (y >> 17));
\r
922 s = (((x >> 17) - (s >> 1)) << 16);
\r
924 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
930 * @brief C custom defined SMUSDX for M3 and M0 processors
\r
932 static __INLINE q31_t __SMUSDX(
\r
937 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
\r
938 ((q15_t) (x >> 16) * (q15_t) y)));
\r
942 * @brief C custom defined SMUADX for M3 and M0 processors
\r
944 static __INLINE q31_t __SMUADX(
\r
949 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
\r
950 ((q15_t) (x >> 16) * (q15_t) y)));
\r
954 * @brief C custom defined QADD for M3 and M0 processors
\r
956 static __INLINE q31_t __QADD(
\r
960 return clip_q63_to_q31((q63_t) x + y);
\r
964 * @brief C custom defined QSUB for M3 and M0 processors
\r
966 static __INLINE q31_t __QSUB(
\r
970 return clip_q63_to_q31((q63_t) x - y);
\r
974 * @brief C custom defined SMLAD for M3 and M0 processors
\r
976 static __INLINE q31_t __SMLAD(
\r
982 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
983 ((q15_t) x * (q15_t) y));
\r
987 * @brief C custom defined SMLADX for M3 and M0 processors
\r
989 static __INLINE q31_t __SMLADX(
\r
995 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
996 ((q15_t) x * (q15_t) (y >> 16)));
\r
1000 * @brief C custom defined SMLSDX for M3 and M0 processors
\r
1002 static __INLINE q31_t __SMLSDX(
\r
1008 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
1009 ((q15_t) x * (q15_t) (y >> 16)));
\r
1013 * @brief C custom defined SMLALD for M3 and M0 processors
\r
1015 static __INLINE q63_t __SMLALD(
\r
1021 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
1022 ((q15_t) x * (q15_t) y));
\r
1026 * @brief C custom defined SMLALDX for M3 and M0 processors
\r
1028 static __INLINE q63_t __SMLALDX(
\r
1034 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
\r
1035 ((q15_t) x * (q15_t) (y >> 16));
\r
1039 * @brief C custom defined SMUAD for M3 and M0 processors
\r
1041 static __INLINE q31_t __SMUAD(
\r
1046 return (((x >> 16) * (y >> 16)) +
\r
1047 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1051 * @brief C custom defined SMUSD for M3 and M0 processors
\r
1053 static __INLINE q31_t __SMUSD(
\r
1058 return (-((x >> 16) * (y >> 16)) +
\r
1059 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1064 * @brief C custom defined SXTB16 for M3 and M0 processors
\r
1066 static __INLINE q31_t __SXTB16(
\r
1070 return ((((x << 24) >> 24) & 0x0000FFFF) |
\r
1071 (((x << 8) >> 8) & 0xFFFF0000));
\r
1075 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
1079 * @brief Instance structure for the Q7 FIR filter.
\r
1083 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1084 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1085 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1086 } arm_fir_instance_q7;
\r
1089 * @brief Instance structure for the Q15 FIR filter.
\r
1093 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1094 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1095 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1096 } arm_fir_instance_q15;
\r
1099 * @brief Instance structure for the Q31 FIR filter.
\r
1103 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1104 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1105 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1106 } arm_fir_instance_q31;
\r
1109 * @brief Instance structure for the floating-point FIR filter.
\r
1113 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1114 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1115 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1116 } arm_fir_instance_f32;
\r
1120 * @brief Processing function for the Q7 FIR filter.
\r
1121 * @param[in] *S points to an instance of the Q7 FIR filter structure.
\r
1122 * @param[in] *pSrc points to the block of input data.
\r
1123 * @param[out] *pDst points to the block of output data.
\r
1124 * @param[in] blockSize number of samples to process.
\r
1128 const arm_fir_instance_q7 * S,
\r
1131 uint32_t blockSize);
\r
1135 * @brief Initialization function for the Q7 FIR filter.
\r
1136 * @param[in,out] *S points to an instance of the Q7 FIR structure.
\r
1137 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1138 * @param[in] *pCoeffs points to the filter coefficients.
\r
1139 * @param[in] *pState points to the state buffer.
\r
1140 * @param[in] blockSize number of samples that are processed.
\r
1143 void arm_fir_init_q7(
\r
1144 arm_fir_instance_q7 * S,
\r
1148 uint32_t blockSize);
\r
1152 * @brief Processing function for the Q15 FIR filter.
\r
1153 * @param[in] *S points to an instance of the Q15 FIR structure.
\r
1154 * @param[in] *pSrc points to the block of input data.
\r
1155 * @param[out] *pDst points to the block of output data.
\r
1156 * @param[in] blockSize number of samples to process.
\r
1160 const arm_fir_instance_q15 * S,
\r
1163 uint32_t blockSize);
\r
1166 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
\r
1167 * @param[in] *S points to an instance of the Q15 FIR filter structure.
\r
1168 * @param[in] *pSrc points to the block of input data.
\r
1169 * @param[out] *pDst points to the block of output data.
\r
1170 * @param[in] blockSize number of samples to process.
\r
1173 void arm_fir_fast_q15(
\r
1174 const arm_fir_instance_q15 * S,
\r
1177 uint32_t blockSize);
\r
1180 * @brief Initialization function for the Q15 FIR filter.
\r
1181 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
\r
1182 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
\r
1183 * @param[in] *pCoeffs points to the filter coefficients.
\r
1184 * @param[in] *pState points to the state buffer.
\r
1185 * @param[in] blockSize number of samples that are processed at a time.
\r
1186 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
\r
1187 * <code>numTaps</code> is not a supported value.
\r
1190 arm_status arm_fir_init_q15(
\r
1191 arm_fir_instance_q15 * S,
\r
1195 uint32_t blockSize);
\r
1198 * @brief Processing function for the Q31 FIR filter.
\r
1199 * @param[in] *S points to an instance of the Q31 FIR filter structure.
\r
1200 * @param[in] *pSrc points to the block of input data.
\r
1201 * @param[out] *pDst points to the block of output data.
\r
1202 * @param[in] blockSize number of samples to process.
\r
1206 const arm_fir_instance_q31 * S,
\r
1209 uint32_t blockSize);
\r
1212 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
\r
1213 * @param[in] *S points to an instance of the Q31 FIR structure.
\r
1214 * @param[in] *pSrc points to the block of input data.
\r
1215 * @param[out] *pDst points to the block of output data.
\r
1216 * @param[in] blockSize number of samples to process.
\r
1219 void arm_fir_fast_q31(
\r
1220 const arm_fir_instance_q31 * S,
\r
1223 uint32_t blockSize);
\r
1226 * @brief Initialization function for the Q31 FIR filter.
\r
1227 * @param[in,out] *S points to an instance of the Q31 FIR structure.
\r
1228 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1229 * @param[in] *pCoeffs points to the filter coefficients.
\r
1230 * @param[in] *pState points to the state buffer.
\r
1231 * @param[in] blockSize number of samples that are processed at a time.
\r
1234 void arm_fir_init_q31(
\r
1235 arm_fir_instance_q31 * S,
\r
1239 uint32_t blockSize);
\r
1242 * @brief Processing function for the floating-point FIR filter.
\r
1243 * @param[in] *S points to an instance of the floating-point FIR structure.
\r
1244 * @param[in] *pSrc points to the block of input data.
\r
1245 * @param[out] *pDst points to the block of output data.
\r
1246 * @param[in] blockSize number of samples to process.
\r
1250 const arm_fir_instance_f32 * S,
\r
1253 uint32_t blockSize);
\r
1256 * @brief Initialization function for the floating-point FIR filter.
\r
1257 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
\r
1258 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1259 * @param[in] *pCoeffs points to the filter coefficients.
\r
1260 * @param[in] *pState points to the state buffer.
\r
1261 * @param[in] blockSize number of samples that are processed at a time.
\r
1264 void arm_fir_init_f32(
\r
1265 arm_fir_instance_f32 * S,
\r
1267 float32_t * pCoeffs,
\r
1268 float32_t * pState,
\r
1269 uint32_t blockSize);
\r
1273 * @brief Instance structure for the Q15 Biquad cascade filter.
\r
1277 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1278 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1279 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1280 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1282 } arm_biquad_casd_df1_inst_q15;
\r
1286 * @brief Instance structure for the Q31 Biquad cascade filter.
\r
1290 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1291 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1292 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1293 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1295 } arm_biquad_casd_df1_inst_q31;
\r
1298 * @brief Instance structure for the floating-point Biquad cascade filter.
\r
1302 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1303 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1304 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1307 } arm_biquad_casd_df1_inst_f32;
\r
1312 * @brief Processing function for the Q15 Biquad cascade filter.
\r
1313 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1314 * @param[in] *pSrc points to the block of input data.
\r
1315 * @param[out] *pDst points to the block of output data.
\r
1316 * @param[in] blockSize number of samples to process.
\r
1320 void arm_biquad_cascade_df1_q15(
\r
1321 const arm_biquad_casd_df1_inst_q15 * S,
\r
1324 uint32_t blockSize);
\r
1327 * @brief Initialization function for the Q15 Biquad cascade filter.
\r
1328 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
\r
1329 * @param[in] numStages number of 2nd order stages in the filter.
\r
1330 * @param[in] *pCoeffs points to the filter coefficients.
\r
1331 * @param[in] *pState points to the state buffer.
\r
1332 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1336 void arm_biquad_cascade_df1_init_q15(
\r
1337 arm_biquad_casd_df1_inst_q15 * S,
\r
1338 uint8_t numStages,
\r
1341 int8_t postShift);
\r
1345 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1346 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1347 * @param[in] *pSrc points to the block of input data.
\r
1348 * @param[out] *pDst points to the block of output data.
\r
1349 * @param[in] blockSize number of samples to process.
\r
1353 void arm_biquad_cascade_df1_fast_q15(
\r
1354 const arm_biquad_casd_df1_inst_q15 * S,
\r
1357 uint32_t blockSize);
\r
1361 * @brief Processing function for the Q31 Biquad cascade filter
\r
1362 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1363 * @param[in] *pSrc points to the block of input data.
\r
1364 * @param[out] *pDst points to the block of output data.
\r
1365 * @param[in] blockSize number of samples to process.
\r
1369 void arm_biquad_cascade_df1_q31(
\r
1370 const arm_biquad_casd_df1_inst_q31 * S,
\r
1373 uint32_t blockSize);
\r
1376 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1377 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1378 * @param[in] *pSrc points to the block of input data.
\r
1379 * @param[out] *pDst points to the block of output data.
\r
1380 * @param[in] blockSize number of samples to process.
\r
1384 void arm_biquad_cascade_df1_fast_q31(
\r
1385 const arm_biquad_casd_df1_inst_q31 * S,
\r
1388 uint32_t blockSize);
\r
1391 * @brief Initialization function for the Q31 Biquad cascade filter.
\r
1392 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
\r
1393 * @param[in] numStages number of 2nd order stages in the filter.
\r
1394 * @param[in] *pCoeffs points to the filter coefficients.
\r
1395 * @param[in] *pState points to the state buffer.
\r
1396 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1400 void arm_biquad_cascade_df1_init_q31(
\r
1401 arm_biquad_casd_df1_inst_q31 * S,
\r
1402 uint8_t numStages,
\r
1405 int8_t postShift);
\r
1408 * @brief Processing function for the floating-point Biquad cascade filter.
\r
1409 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
\r
1410 * @param[in] *pSrc points to the block of input data.
\r
1411 * @param[out] *pDst points to the block of output data.
\r
1412 * @param[in] blockSize number of samples to process.
\r
1416 void arm_biquad_cascade_df1_f32(
\r
1417 const arm_biquad_casd_df1_inst_f32 * S,
\r
1420 uint32_t blockSize);
\r
1423 * @brief Initialization function for the floating-point Biquad cascade filter.
\r
1424 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
\r
1425 * @param[in] numStages number of 2nd order stages in the filter.
\r
1426 * @param[in] *pCoeffs points to the filter coefficients.
\r
1427 * @param[in] *pState points to the state buffer.
\r
1431 void arm_biquad_cascade_df1_init_f32(
\r
1432 arm_biquad_casd_df1_inst_f32 * S,
\r
1433 uint8_t numStages,
\r
1434 float32_t * pCoeffs,
\r
1435 float32_t * pState);
\r
1439 * @brief Instance structure for the floating-point matrix structure.
\r
1444 uint16_t numRows; /**< number of rows of the matrix. */
\r
1445 uint16_t numCols; /**< number of columns of the matrix. */
\r
1446 float32_t *pData; /**< points to the data of the matrix. */
\r
1447 } arm_matrix_instance_f32;
\r
1451 * @brief Instance structure for the floating-point matrix structure.
\r
1456 uint16_t numRows; /**< number of rows of the matrix. */
\r
1457 uint16_t numCols; /**< number of columns of the matrix. */
\r
1458 float64_t *pData; /**< points to the data of the matrix. */
\r
1459 } arm_matrix_instance_f64;
\r
1462 * @brief Instance structure for the Q15 matrix structure.
\r
1467 uint16_t numRows; /**< number of rows of the matrix. */
\r
1468 uint16_t numCols; /**< number of columns of the matrix. */
\r
1469 q15_t *pData; /**< points to the data of the matrix. */
\r
1471 } arm_matrix_instance_q15;
\r
1474 * @brief Instance structure for the Q31 matrix structure.
\r
1479 uint16_t numRows; /**< number of rows of the matrix. */
\r
1480 uint16_t numCols; /**< number of columns of the matrix. */
\r
1481 q31_t *pData; /**< points to the data of the matrix. */
\r
1483 } arm_matrix_instance_q31;
\r
1488 * @brief Floating-point matrix addition.
\r
1489 * @param[in] *pSrcA points to the first input matrix structure
\r
1490 * @param[in] *pSrcB points to the second input matrix structure
\r
1491 * @param[out] *pDst points to output matrix structure
\r
1492 * @return The function returns either
\r
1493 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1496 arm_status arm_mat_add_f32(
\r
1497 const arm_matrix_instance_f32 * pSrcA,
\r
1498 const arm_matrix_instance_f32 * pSrcB,
\r
1499 arm_matrix_instance_f32 * pDst);
\r
1502 * @brief Q15 matrix addition.
\r
1503 * @param[in] *pSrcA points to the first input matrix structure
\r
1504 * @param[in] *pSrcB points to the second input matrix structure
\r
1505 * @param[out] *pDst points to output matrix structure
\r
1506 * @return The function returns either
\r
1507 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1510 arm_status arm_mat_add_q15(
\r
1511 const arm_matrix_instance_q15 * pSrcA,
\r
1512 const arm_matrix_instance_q15 * pSrcB,
\r
1513 arm_matrix_instance_q15 * pDst);
\r
1516 * @brief Q31 matrix addition.
\r
1517 * @param[in] *pSrcA points to the first input matrix structure
\r
1518 * @param[in] *pSrcB points to the second input matrix structure
\r
1519 * @param[out] *pDst points to output matrix structure
\r
1520 * @return The function returns either
\r
1521 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1524 arm_status arm_mat_add_q31(
\r
1525 const arm_matrix_instance_q31 * pSrcA,
\r
1526 const arm_matrix_instance_q31 * pSrcB,
\r
1527 arm_matrix_instance_q31 * pDst);
\r
1530 * @brief Floating-point, complex, matrix multiplication.
\r
1531 * @param[in] *pSrcA points to the first input matrix structure
\r
1532 * @param[in] *pSrcB points to the second input matrix structure
\r
1533 * @param[out] *pDst points to output matrix structure
\r
1534 * @return The function returns either
\r
1535 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1538 arm_status arm_mat_cmplx_mult_f32(
\r
1539 const arm_matrix_instance_f32 * pSrcA,
\r
1540 const arm_matrix_instance_f32 * pSrcB,
\r
1541 arm_matrix_instance_f32 * pDst);
\r
1544 * @brief Q15, complex, matrix multiplication.
\r
1545 * @param[in] *pSrcA points to the first input matrix structure
\r
1546 * @param[in] *pSrcB points to the second input matrix structure
\r
1547 * @param[out] *pDst points to output matrix structure
\r
1548 * @return The function returns either
\r
1549 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1552 arm_status arm_mat_cmplx_mult_q15(
\r
1553 const arm_matrix_instance_q15 * pSrcA,
\r
1554 const arm_matrix_instance_q15 * pSrcB,
\r
1555 arm_matrix_instance_q15 * pDst,
\r
1556 q15_t * pScratch);
\r
1559 * @brief Q31, complex, matrix multiplication.
\r
1560 * @param[in] *pSrcA points to the first input matrix structure
\r
1561 * @param[in] *pSrcB points to the second input matrix structure
\r
1562 * @param[out] *pDst points to output matrix structure
\r
1563 * @return The function returns either
\r
1564 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1567 arm_status arm_mat_cmplx_mult_q31(
\r
1568 const arm_matrix_instance_q31 * pSrcA,
\r
1569 const arm_matrix_instance_q31 * pSrcB,
\r
1570 arm_matrix_instance_q31 * pDst);
\r
1574 * @brief Floating-point matrix transpose.
\r
1575 * @param[in] *pSrc points to the input matrix
\r
1576 * @param[out] *pDst points to the output matrix
\r
1577 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1578 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1581 arm_status arm_mat_trans_f32(
\r
1582 const arm_matrix_instance_f32 * pSrc,
\r
1583 arm_matrix_instance_f32 * pDst);
\r
1587 * @brief Q15 matrix transpose.
\r
1588 * @param[in] *pSrc points to the input matrix
\r
1589 * @param[out] *pDst points to the output matrix
\r
1590 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1591 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1594 arm_status arm_mat_trans_q15(
\r
1595 const arm_matrix_instance_q15 * pSrc,
\r
1596 arm_matrix_instance_q15 * pDst);
\r
1599 * @brief Q31 matrix transpose.
\r
1600 * @param[in] *pSrc points to the input matrix
\r
1601 * @param[out] *pDst points to the output matrix
\r
1602 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1603 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1606 arm_status arm_mat_trans_q31(
\r
1607 const arm_matrix_instance_q31 * pSrc,
\r
1608 arm_matrix_instance_q31 * pDst);
\r
1612 * @brief Floating-point matrix multiplication
\r
1613 * @param[in] *pSrcA points to the first input matrix structure
\r
1614 * @param[in] *pSrcB points to the second input matrix structure
\r
1615 * @param[out] *pDst points to output matrix structure
\r
1616 * @return The function returns either
\r
1617 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1620 arm_status arm_mat_mult_f32(
\r
1621 const arm_matrix_instance_f32 * pSrcA,
\r
1622 const arm_matrix_instance_f32 * pSrcB,
\r
1623 arm_matrix_instance_f32 * pDst);
\r
1626 * @brief Q15 matrix multiplication
\r
1627 * @param[in] *pSrcA points to the first input matrix structure
\r
1628 * @param[in] *pSrcB points to the second input matrix structure
\r
1629 * @param[out] *pDst points to output matrix structure
\r
1630 * @param[in] *pState points to the array for storing intermediate results
\r
1631 * @return The function returns either
\r
1632 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1635 arm_status arm_mat_mult_q15(
\r
1636 const arm_matrix_instance_q15 * pSrcA,
\r
1637 const arm_matrix_instance_q15 * pSrcB,
\r
1638 arm_matrix_instance_q15 * pDst,
\r
1642 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1643 * @param[in] *pSrcA points to the first input matrix structure
\r
1644 * @param[in] *pSrcB points to the second input matrix structure
\r
1645 * @param[out] *pDst points to output matrix structure
\r
1646 * @param[in] *pState points to the array for storing intermediate results
\r
1647 * @return The function returns either
\r
1648 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1651 arm_status arm_mat_mult_fast_q15(
\r
1652 const arm_matrix_instance_q15 * pSrcA,
\r
1653 const arm_matrix_instance_q15 * pSrcB,
\r
1654 arm_matrix_instance_q15 * pDst,
\r
1658 * @brief Q31 matrix multiplication
\r
1659 * @param[in] *pSrcA points to the first input matrix structure
\r
1660 * @param[in] *pSrcB points to the second input matrix structure
\r
1661 * @param[out] *pDst points to output matrix structure
\r
1662 * @return The function returns either
\r
1663 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1666 arm_status arm_mat_mult_q31(
\r
1667 const arm_matrix_instance_q31 * pSrcA,
\r
1668 const arm_matrix_instance_q31 * pSrcB,
\r
1669 arm_matrix_instance_q31 * pDst);
\r
1672 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1673 * @param[in] *pSrcA points to the first input matrix structure
\r
1674 * @param[in] *pSrcB points to the second input matrix structure
\r
1675 * @param[out] *pDst points to output matrix structure
\r
1676 * @return The function returns either
\r
1677 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1680 arm_status arm_mat_mult_fast_q31(
\r
1681 const arm_matrix_instance_q31 * pSrcA,
\r
1682 const arm_matrix_instance_q31 * pSrcB,
\r
1683 arm_matrix_instance_q31 * pDst);
\r
1687 * @brief Floating-point matrix subtraction
\r
1688 * @param[in] *pSrcA points to the first input matrix structure
\r
1689 * @param[in] *pSrcB points to the second input matrix structure
\r
1690 * @param[out] *pDst points to output matrix structure
\r
1691 * @return The function returns either
\r
1692 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1695 arm_status arm_mat_sub_f32(
\r
1696 const arm_matrix_instance_f32 * pSrcA,
\r
1697 const arm_matrix_instance_f32 * pSrcB,
\r
1698 arm_matrix_instance_f32 * pDst);
\r
1701 * @brief Q15 matrix subtraction
\r
1702 * @param[in] *pSrcA points to the first input matrix structure
\r
1703 * @param[in] *pSrcB points to the second input matrix structure
\r
1704 * @param[out] *pDst points to output matrix structure
\r
1705 * @return The function returns either
\r
1706 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1709 arm_status arm_mat_sub_q15(
\r
1710 const arm_matrix_instance_q15 * pSrcA,
\r
1711 const arm_matrix_instance_q15 * pSrcB,
\r
1712 arm_matrix_instance_q15 * pDst);
\r
1715 * @brief Q31 matrix subtraction
\r
1716 * @param[in] *pSrcA points to the first input matrix structure
\r
1717 * @param[in] *pSrcB points to the second input matrix structure
\r
1718 * @param[out] *pDst points to output matrix structure
\r
1719 * @return The function returns either
\r
1720 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1723 arm_status arm_mat_sub_q31(
\r
1724 const arm_matrix_instance_q31 * pSrcA,
\r
1725 const arm_matrix_instance_q31 * pSrcB,
\r
1726 arm_matrix_instance_q31 * pDst);
\r
1729 * @brief Floating-point matrix scaling.
\r
1730 * @param[in] *pSrc points to the input matrix
\r
1731 * @param[in] scale scale factor
\r
1732 * @param[out] *pDst points to the output matrix
\r
1733 * @return The function returns either
\r
1734 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1737 arm_status arm_mat_scale_f32(
\r
1738 const arm_matrix_instance_f32 * pSrc,
\r
1740 arm_matrix_instance_f32 * pDst);
\r
1743 * @brief Q15 matrix scaling.
\r
1744 * @param[in] *pSrc points to input matrix
\r
1745 * @param[in] scaleFract fractional portion of the scale factor
\r
1746 * @param[in] shift number of bits to shift the result by
\r
1747 * @param[out] *pDst points to output matrix
\r
1748 * @return The function returns either
\r
1749 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1752 arm_status arm_mat_scale_q15(
\r
1753 const arm_matrix_instance_q15 * pSrc,
\r
1756 arm_matrix_instance_q15 * pDst);
\r
1759 * @brief Q31 matrix scaling.
\r
1760 * @param[in] *pSrc points to input matrix
\r
1761 * @param[in] scaleFract fractional portion of the scale factor
\r
1762 * @param[in] shift number of bits to shift the result by
\r
1763 * @param[out] *pDst points to output matrix structure
\r
1764 * @return The function returns either
\r
1765 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1768 arm_status arm_mat_scale_q31(
\r
1769 const arm_matrix_instance_q31 * pSrc,
\r
1772 arm_matrix_instance_q31 * pDst);
\r
1776 * @brief Q31 matrix initialization.
\r
1777 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1778 * @param[in] nRows number of rows in the matrix.
\r
1779 * @param[in] nColumns number of columns in the matrix.
\r
1780 * @param[in] *pData points to the matrix data array.
\r
1784 void arm_mat_init_q31(
\r
1785 arm_matrix_instance_q31 * S,
\r
1787 uint16_t nColumns,
\r
1791 * @brief Q15 matrix initialization.
\r
1792 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1793 * @param[in] nRows number of rows in the matrix.
\r
1794 * @param[in] nColumns number of columns in the matrix.
\r
1795 * @param[in] *pData points to the matrix data array.
\r
1799 void arm_mat_init_q15(
\r
1800 arm_matrix_instance_q15 * S,
\r
1802 uint16_t nColumns,
\r
1806 * @brief Floating-point matrix initialization.
\r
1807 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1808 * @param[in] nRows number of rows in the matrix.
\r
1809 * @param[in] nColumns number of columns in the matrix.
\r
1810 * @param[in] *pData points to the matrix data array.
\r
1814 void arm_mat_init_f32(
\r
1815 arm_matrix_instance_f32 * S,
\r
1817 uint16_t nColumns,
\r
1818 float32_t * pData);
\r
1823 * @brief Instance structure for the Q15 PID Control.
\r
1827 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1828 #ifdef ARM_MATH_CM0_FAMILY
\r
1832 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
\r
1834 q15_t state[3]; /**< The state array of length 3. */
\r
1835 q15_t Kp; /**< The proportional gain. */
\r
1836 q15_t Ki; /**< The integral gain. */
\r
1837 q15_t Kd; /**< The derivative gain. */
\r
1838 } arm_pid_instance_q15;
\r
1841 * @brief Instance structure for the Q31 PID Control.
\r
1845 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1846 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1847 q31_t A2; /**< The derived gain, A2 = Kd . */
\r
1848 q31_t state[3]; /**< The state array of length 3. */
\r
1849 q31_t Kp; /**< The proportional gain. */
\r
1850 q31_t Ki; /**< The integral gain. */
\r
1851 q31_t Kd; /**< The derivative gain. */
\r
1853 } arm_pid_instance_q31;
\r
1856 * @brief Instance structure for the floating-point PID Control.
\r
1860 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1861 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1862 float32_t A2; /**< The derived gain, A2 = Kd . */
\r
1863 float32_t state[3]; /**< The state array of length 3. */
\r
1864 float32_t Kp; /**< The proportional gain. */
\r
1865 float32_t Ki; /**< The integral gain. */
\r
1866 float32_t Kd; /**< The derivative gain. */
\r
1867 } arm_pid_instance_f32;
\r
1872 * @brief Initialization function for the floating-point PID Control.
\r
1873 * @param[in,out] *S points to an instance of the PID structure.
\r
1874 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1877 void arm_pid_init_f32(
\r
1878 arm_pid_instance_f32 * S,
\r
1879 int32_t resetStateFlag);
\r
1882 * @brief Reset function for the floating-point PID Control.
\r
1883 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
1886 void arm_pid_reset_f32(
\r
1887 arm_pid_instance_f32 * S);
\r
1891 * @brief Initialization function for the Q31 PID Control.
\r
1892 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1893 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1896 void arm_pid_init_q31(
\r
1897 arm_pid_instance_q31 * S,
\r
1898 int32_t resetStateFlag);
\r
1902 * @brief Reset function for the Q31 PID Control.
\r
1903 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
1907 void arm_pid_reset_q31(
\r
1908 arm_pid_instance_q31 * S);
\r
1911 * @brief Initialization function for the Q15 PID Control.
\r
1912 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1913 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1916 void arm_pid_init_q15(
\r
1917 arm_pid_instance_q15 * S,
\r
1918 int32_t resetStateFlag);
\r
1921 * @brief Reset function for the Q15 PID Control.
\r
1922 * @param[in,out] *S points to an instance of the q15 PID Control structure
\r
1925 void arm_pid_reset_q15(
\r
1926 arm_pid_instance_q15 * S);
\r
1930 * @brief Instance structure for the floating-point Linear Interpolate function.
\r
1934 uint32_t nValues; /**< nValues */
\r
1935 float32_t x1; /**< x1 */
\r
1936 float32_t xSpacing; /**< xSpacing */
\r
1937 float32_t *pYData; /**< pointer to the table of Y values */
\r
1938 } arm_linear_interp_instance_f32;
\r
1941 * @brief Instance structure for the floating-point bilinear interpolation function.
\r
1946 uint16_t numRows; /**< number of rows in the data table. */
\r
1947 uint16_t numCols; /**< number of columns in the data table. */
\r
1948 float32_t *pData; /**< points to the data table. */
\r
1949 } arm_bilinear_interp_instance_f32;
\r
1952 * @brief Instance structure for the Q31 bilinear interpolation function.
\r
1957 uint16_t numRows; /**< number of rows in the data table. */
\r
1958 uint16_t numCols; /**< number of columns in the data table. */
\r
1959 q31_t *pData; /**< points to the data table. */
\r
1960 } arm_bilinear_interp_instance_q31;
\r
1963 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1968 uint16_t numRows; /**< number of rows in the data table. */
\r
1969 uint16_t numCols; /**< number of columns in the data table. */
\r
1970 q15_t *pData; /**< points to the data table. */
\r
1971 } arm_bilinear_interp_instance_q15;
\r
1974 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1979 uint16_t numRows; /**< number of rows in the data table. */
\r
1980 uint16_t numCols; /**< number of columns in the data table. */
\r
1981 q7_t *pData; /**< points to the data table. */
\r
1982 } arm_bilinear_interp_instance_q7;
\r
1986 * @brief Q7 vector multiplication.
\r
1987 * @param[in] *pSrcA points to the first input vector
\r
1988 * @param[in] *pSrcB points to the second input vector
\r
1989 * @param[out] *pDst points to the output vector
\r
1990 * @param[in] blockSize number of samples in each vector
\r
1998 uint32_t blockSize);
\r
2001 * @brief Q15 vector multiplication.
\r
2002 * @param[in] *pSrcA points to the first input vector
\r
2003 * @param[in] *pSrcB points to the second input vector
\r
2004 * @param[out] *pDst points to the output vector
\r
2005 * @param[in] blockSize number of samples in each vector
\r
2009 void arm_mult_q15(
\r
2013 uint32_t blockSize);
\r
2016 * @brief Q31 vector multiplication.
\r
2017 * @param[in] *pSrcA points to the first input vector
\r
2018 * @param[in] *pSrcB points to the second input vector
\r
2019 * @param[out] *pDst points to the output vector
\r
2020 * @param[in] blockSize number of samples in each vector
\r
2024 void arm_mult_q31(
\r
2028 uint32_t blockSize);
\r
2031 * @brief Floating-point vector multiplication.
\r
2032 * @param[in] *pSrcA points to the first input vector
\r
2033 * @param[in] *pSrcB points to the second input vector
\r
2034 * @param[out] *pDst points to the output vector
\r
2035 * @param[in] blockSize number of samples in each vector
\r
2039 void arm_mult_f32(
\r
2040 float32_t * pSrcA,
\r
2041 float32_t * pSrcB,
\r
2043 uint32_t blockSize);
\r
2051 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2056 uint16_t fftLen; /**< length of the FFT. */
\r
2057 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2058 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2059 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
\r
2060 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2061 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2062 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2063 } arm_cfft_radix2_instance_q15;
\r
2066 arm_status arm_cfft_radix2_init_q15(
\r
2067 arm_cfft_radix2_instance_q15 * S,
\r
2070 uint8_t bitReverseFlag);
\r
2073 void arm_cfft_radix2_q15(
\r
2074 const arm_cfft_radix2_instance_q15 * S,
\r
2080 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2085 uint16_t fftLen; /**< length of the FFT. */
\r
2086 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2087 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2088 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2089 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2090 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2091 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2092 } arm_cfft_radix4_instance_q15;
\r
2095 arm_status arm_cfft_radix4_init_q15(
\r
2096 arm_cfft_radix4_instance_q15 * S,
\r
2099 uint8_t bitReverseFlag);
\r
2102 void arm_cfft_radix4_q15(
\r
2103 const arm_cfft_radix4_instance_q15 * S,
\r
2107 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
\r
2112 uint16_t fftLen; /**< length of the FFT. */
\r
2113 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2114 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2115 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2116 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2117 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2118 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2119 } arm_cfft_radix2_instance_q31;
\r
2122 arm_status arm_cfft_radix2_init_q31(
\r
2123 arm_cfft_radix2_instance_q31 * S,
\r
2126 uint8_t bitReverseFlag);
\r
2129 void arm_cfft_radix2_q31(
\r
2130 const arm_cfft_radix2_instance_q31 * S,
\r
2134 * @brief Instance structure for the Q31 CFFT/CIFFT function.
\r
2139 uint16_t fftLen; /**< length of the FFT. */
\r
2140 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2141 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2142 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2143 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2144 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2145 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2146 } arm_cfft_radix4_instance_q31;
\r
2149 void arm_cfft_radix4_q31(
\r
2150 const arm_cfft_radix4_instance_q31 * S,
\r
2154 arm_status arm_cfft_radix4_init_q31(
\r
2155 arm_cfft_radix4_instance_q31 * S,
\r
2158 uint8_t bitReverseFlag);
\r
2161 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2166 uint16_t fftLen; /**< length of the FFT. */
\r
2167 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2168 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2169 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2170 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2171 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2172 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2173 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2174 } arm_cfft_radix2_instance_f32;
\r
2177 arm_status arm_cfft_radix2_init_f32(
\r
2178 arm_cfft_radix2_instance_f32 * S,
\r
2181 uint8_t bitReverseFlag);
\r
2184 void arm_cfft_radix2_f32(
\r
2185 const arm_cfft_radix2_instance_f32 * S,
\r
2186 float32_t * pSrc);
\r
2189 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2194 uint16_t fftLen; /**< length of the FFT. */
\r
2195 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2196 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2197 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2198 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2199 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2200 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2201 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2202 } arm_cfft_radix4_instance_f32;
\r
2205 arm_status arm_cfft_radix4_init_f32(
\r
2206 arm_cfft_radix4_instance_f32 * S,
\r
2209 uint8_t bitReverseFlag);
\r
2212 void arm_cfft_radix4_f32(
\r
2213 const arm_cfft_radix4_instance_f32 * S,
\r
2214 float32_t * pSrc);
\r
2217 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2222 uint16_t fftLen; /**< length of the FFT. */
\r
2223 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2224 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2225 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2226 } arm_cfft_instance_q15;
\r
2228 void arm_cfft_q15(
\r
2229 const arm_cfft_instance_q15 * S,
\r
2232 uint8_t bitReverseFlag);
\r
2235 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2240 uint16_t fftLen; /**< length of the FFT. */
\r
2241 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2242 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2243 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2244 } arm_cfft_instance_q31;
\r
2246 void arm_cfft_q31(
\r
2247 const arm_cfft_instance_q31 * S,
\r
2250 uint8_t bitReverseFlag);
\r
2253 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2258 uint16_t fftLen; /**< length of the FFT. */
\r
2259 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2260 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2261 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2262 } arm_cfft_instance_f32;
\r
2264 void arm_cfft_f32(
\r
2265 const arm_cfft_instance_f32 * S,
\r
2268 uint8_t bitReverseFlag);
\r
2271 * @brief Instance structure for the Q15 RFFT/RIFFT function.
\r
2276 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2277 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2278 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2279 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2280 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2281 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2282 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2283 } arm_rfft_instance_q15;
\r
2285 arm_status arm_rfft_init_q15(
\r
2286 arm_rfft_instance_q15 * S,
\r
2287 uint32_t fftLenReal,
\r
2288 uint32_t ifftFlagR,
\r
2289 uint32_t bitReverseFlag);
\r
2291 void arm_rfft_q15(
\r
2292 const arm_rfft_instance_q15 * S,
\r
2297 * @brief Instance structure for the Q31 RFFT/RIFFT function.
\r
2302 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2303 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2304 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2305 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2306 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2307 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2308 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2309 } arm_rfft_instance_q31;
\r
2311 arm_status arm_rfft_init_q31(
\r
2312 arm_rfft_instance_q31 * S,
\r
2313 uint32_t fftLenReal,
\r
2314 uint32_t ifftFlagR,
\r
2315 uint32_t bitReverseFlag);
\r
2317 void arm_rfft_q31(
\r
2318 const arm_rfft_instance_q31 * S,
\r
2323 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2328 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2329 uint16_t fftLenBy2; /**< length of the complex FFT. */
\r
2330 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2331 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2332 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2333 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2334 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2335 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2336 } arm_rfft_instance_f32;
\r
2338 arm_status arm_rfft_init_f32(
\r
2339 arm_rfft_instance_f32 * S,
\r
2340 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2341 uint32_t fftLenReal,
\r
2342 uint32_t ifftFlagR,
\r
2343 uint32_t bitReverseFlag);
\r
2345 void arm_rfft_f32(
\r
2346 const arm_rfft_instance_f32 * S,
\r
2348 float32_t * pDst);
\r
2351 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2356 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
\r
2357 uint16_t fftLenRFFT; /**< length of the real sequence */
\r
2358 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
\r
2359 } arm_rfft_fast_instance_f32 ;
\r
2361 arm_status arm_rfft_fast_init_f32 (
\r
2362 arm_rfft_fast_instance_f32 * S,
\r
2365 void arm_rfft_fast_f32(
\r
2366 arm_rfft_fast_instance_f32 * S,
\r
2367 float32_t * p, float32_t * pOut,
\r
2368 uint8_t ifftFlag);
\r
2371 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
\r
2376 uint16_t N; /**< length of the DCT4. */
\r
2377 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2378 float32_t normalize; /**< normalizing factor. */
\r
2379 float32_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2380 float32_t *pCosFactor; /**< points to the cosFactor table. */
\r
2381 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
\r
2382 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2383 } arm_dct4_instance_f32;
\r
2386 * @brief Initialization function for the floating-point DCT4/IDCT4.
\r
2387 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
\r
2388 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
\r
2389 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
\r
2390 * @param[in] N length of the DCT4.
\r
2391 * @param[in] Nby2 half of the length of the DCT4.
\r
2392 * @param[in] normalize normalizing factor.
\r
2393 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.
\r
2396 arm_status arm_dct4_init_f32(
\r
2397 arm_dct4_instance_f32 * S,
\r
2398 arm_rfft_instance_f32 * S_RFFT,
\r
2399 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2402 float32_t normalize);
\r
2405 * @brief Processing function for the floating-point DCT4/IDCT4.
\r
2406 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
\r
2407 * @param[in] *pState points to state buffer.
\r
2408 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2412 void arm_dct4_f32(
\r
2413 const arm_dct4_instance_f32 * S,
\r
2414 float32_t * pState,
\r
2415 float32_t * pInlineBuffer);
\r
2418 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
\r
2423 uint16_t N; /**< length of the DCT4. */
\r
2424 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2425 q31_t normalize; /**< normalizing factor. */
\r
2426 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2427 q31_t *pCosFactor; /**< points to the cosFactor table. */
\r
2428 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
\r
2429 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2430 } arm_dct4_instance_q31;
\r
2433 * @brief Initialization function for the Q31 DCT4/IDCT4.
\r
2434 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
\r
2435 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
\r
2436 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
\r
2437 * @param[in] N length of the DCT4.
\r
2438 * @param[in] Nby2 half of the length of the DCT4.
\r
2439 * @param[in] normalize normalizing factor.
\r
2440 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
\r
2443 arm_status arm_dct4_init_q31(
\r
2444 arm_dct4_instance_q31 * S,
\r
2445 arm_rfft_instance_q31 * S_RFFT,
\r
2446 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2452 * @brief Processing function for the Q31 DCT4/IDCT4.
\r
2453 * @param[in] *S points to an instance of the Q31 DCT4 structure.
\r
2454 * @param[in] *pState points to state buffer.
\r
2455 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2459 void arm_dct4_q31(
\r
2460 const arm_dct4_instance_q31 * S,
\r
2462 q31_t * pInlineBuffer);
\r
2465 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
\r
2470 uint16_t N; /**< length of the DCT4. */
\r
2471 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2472 q15_t normalize; /**< normalizing factor. */
\r
2473 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2474 q15_t *pCosFactor; /**< points to the cosFactor table. */
\r
2475 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
\r
2476 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2477 } arm_dct4_instance_q15;
\r
2480 * @brief Initialization function for the Q15 DCT4/IDCT4.
\r
2481 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
\r
2482 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
\r
2483 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
\r
2484 * @param[in] N length of the DCT4.
\r
2485 * @param[in] Nby2 half of the length of the DCT4.
\r
2486 * @param[in] normalize normalizing factor.
\r
2487 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
\r
2490 arm_status arm_dct4_init_q15(
\r
2491 arm_dct4_instance_q15 * S,
\r
2492 arm_rfft_instance_q15 * S_RFFT,
\r
2493 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2499 * @brief Processing function for the Q15 DCT4/IDCT4.
\r
2500 * @param[in] *S points to an instance of the Q15 DCT4 structure.
\r
2501 * @param[in] *pState points to state buffer.
\r
2502 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2506 void arm_dct4_q15(
\r
2507 const arm_dct4_instance_q15 * S,
\r
2509 q15_t * pInlineBuffer);
\r
2512 * @brief Floating-point vector addition.
\r
2513 * @param[in] *pSrcA points to the first input vector
\r
2514 * @param[in] *pSrcB points to the second input vector
\r
2515 * @param[out] *pDst points to the output vector
\r
2516 * @param[in] blockSize number of samples in each vector
\r
2521 float32_t * pSrcA,
\r
2522 float32_t * pSrcB,
\r
2524 uint32_t blockSize);
\r
2527 * @brief Q7 vector addition.
\r
2528 * @param[in] *pSrcA points to the first input vector
\r
2529 * @param[in] *pSrcB points to the second input vector
\r
2530 * @param[out] *pDst points to the output vector
\r
2531 * @param[in] blockSize number of samples in each vector
\r
2539 uint32_t blockSize);
\r
2542 * @brief Q15 vector addition.
\r
2543 * @param[in] *pSrcA points to the first input vector
\r
2544 * @param[in] *pSrcB points to the second input vector
\r
2545 * @param[out] *pDst points to the output vector
\r
2546 * @param[in] blockSize number of samples in each vector
\r
2554 uint32_t blockSize);
\r
2557 * @brief Q31 vector addition.
\r
2558 * @param[in] *pSrcA points to the first input vector
\r
2559 * @param[in] *pSrcB points to the second input vector
\r
2560 * @param[out] *pDst points to the output vector
\r
2561 * @param[in] blockSize number of samples in each vector
\r
2569 uint32_t blockSize);
\r
2572 * @brief Floating-point vector subtraction.
\r
2573 * @param[in] *pSrcA points to the first input vector
\r
2574 * @param[in] *pSrcB points to the second input vector
\r
2575 * @param[out] *pDst points to the output vector
\r
2576 * @param[in] blockSize number of samples in each vector
\r
2581 float32_t * pSrcA,
\r
2582 float32_t * pSrcB,
\r
2584 uint32_t blockSize);
\r
2587 * @brief Q7 vector subtraction.
\r
2588 * @param[in] *pSrcA points to the first input vector
\r
2589 * @param[in] *pSrcB points to the second input vector
\r
2590 * @param[out] *pDst points to the output vector
\r
2591 * @param[in] blockSize number of samples in each vector
\r
2599 uint32_t blockSize);
\r
2602 * @brief Q15 vector subtraction.
\r
2603 * @param[in] *pSrcA points to the first input vector
\r
2604 * @param[in] *pSrcB points to the second input vector
\r
2605 * @param[out] *pDst points to the output vector
\r
2606 * @param[in] blockSize number of samples in each vector
\r
2614 uint32_t blockSize);
\r
2617 * @brief Q31 vector subtraction.
\r
2618 * @param[in] *pSrcA points to the first input vector
\r
2619 * @param[in] *pSrcB points to the second input vector
\r
2620 * @param[out] *pDst points to the output vector
\r
2621 * @param[in] blockSize number of samples in each vector
\r
2629 uint32_t blockSize);
\r
2632 * @brief Multiplies a floating-point vector by a scalar.
\r
2633 * @param[in] *pSrc points to the input vector
\r
2634 * @param[in] scale scale factor to be applied
\r
2635 * @param[out] *pDst points to the output vector
\r
2636 * @param[in] blockSize number of samples in the vector
\r
2640 void arm_scale_f32(
\r
2644 uint32_t blockSize);
\r
2647 * @brief Multiplies a Q7 vector by a scalar.
\r
2648 * @param[in] *pSrc points to the input vector
\r
2649 * @param[in] scaleFract fractional portion of the scale value
\r
2650 * @param[in] shift number of bits to shift the result by
\r
2651 * @param[out] *pDst points to the output vector
\r
2652 * @param[in] blockSize number of samples in the vector
\r
2656 void arm_scale_q7(
\r
2661 uint32_t blockSize);
\r
2664 * @brief Multiplies a Q15 vector by a scalar.
\r
2665 * @param[in] *pSrc points to the input vector
\r
2666 * @param[in] scaleFract fractional portion of the scale value
\r
2667 * @param[in] shift number of bits to shift the result by
\r
2668 * @param[out] *pDst points to the output vector
\r
2669 * @param[in] blockSize number of samples in the vector
\r
2673 void arm_scale_q15(
\r
2678 uint32_t blockSize);
\r
2681 * @brief Multiplies a Q31 vector by a scalar.
\r
2682 * @param[in] *pSrc points to the input vector
\r
2683 * @param[in] scaleFract fractional portion of the scale value
\r
2684 * @param[in] shift number of bits to shift the result by
\r
2685 * @param[out] *pDst points to the output vector
\r
2686 * @param[in] blockSize number of samples in the vector
\r
2690 void arm_scale_q31(
\r
2695 uint32_t blockSize);
\r
2698 * @brief Q7 vector absolute value.
\r
2699 * @param[in] *pSrc points to the input buffer
\r
2700 * @param[out] *pDst points to the output buffer
\r
2701 * @param[in] blockSize number of samples in each vector
\r
2708 uint32_t blockSize);
\r
2711 * @brief Floating-point vector absolute value.
\r
2712 * @param[in] *pSrc points to the input buffer
\r
2713 * @param[out] *pDst points to the output buffer
\r
2714 * @param[in] blockSize number of samples in each vector
\r
2721 uint32_t blockSize);
\r
2724 * @brief Q15 vector absolute value.
\r
2725 * @param[in] *pSrc points to the input buffer
\r
2726 * @param[out] *pDst points to the output buffer
\r
2727 * @param[in] blockSize number of samples in each vector
\r
2734 uint32_t blockSize);
\r
2737 * @brief Q31 vector absolute value.
\r
2738 * @param[in] *pSrc points to the input buffer
\r
2739 * @param[out] *pDst points to the output buffer
\r
2740 * @param[in] blockSize number of samples in each vector
\r
2747 uint32_t blockSize);
\r
2750 * @brief Dot product of floating-point vectors.
\r
2751 * @param[in] *pSrcA points to the first input vector
\r
2752 * @param[in] *pSrcB points to the second input vector
\r
2753 * @param[in] blockSize number of samples in each vector
\r
2754 * @param[out] *result output result returned here
\r
2758 void arm_dot_prod_f32(
\r
2759 float32_t * pSrcA,
\r
2760 float32_t * pSrcB,
\r
2761 uint32_t blockSize,
\r
2762 float32_t * result);
\r
2765 * @brief Dot product of Q7 vectors.
\r
2766 * @param[in] *pSrcA points to the first input vector
\r
2767 * @param[in] *pSrcB points to the second input vector
\r
2768 * @param[in] blockSize number of samples in each vector
\r
2769 * @param[out] *result output result returned here
\r
2773 void arm_dot_prod_q7(
\r
2776 uint32_t blockSize,
\r
2780 * @brief Dot product of Q15 vectors.
\r
2781 * @param[in] *pSrcA points to the first input vector
\r
2782 * @param[in] *pSrcB points to the second input vector
\r
2783 * @param[in] blockSize number of samples in each vector
\r
2784 * @param[out] *result output result returned here
\r
2788 void arm_dot_prod_q15(
\r
2791 uint32_t blockSize,
\r
2795 * @brief Dot product of Q31 vectors.
\r
2796 * @param[in] *pSrcA points to the first input vector
\r
2797 * @param[in] *pSrcB points to the second input vector
\r
2798 * @param[in] blockSize number of samples in each vector
\r
2799 * @param[out] *result output result returned here
\r
2803 void arm_dot_prod_q31(
\r
2806 uint32_t blockSize,
\r
2810 * @brief Shifts the elements of a Q7 vector a specified number of bits.
\r
2811 * @param[in] *pSrc points to the input vector
\r
2812 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2813 * @param[out] *pDst points to the output vector
\r
2814 * @param[in] blockSize number of samples in the vector
\r
2818 void arm_shift_q7(
\r
2822 uint32_t blockSize);
\r
2825 * @brief Shifts the elements of a Q15 vector a specified number of bits.
\r
2826 * @param[in] *pSrc points to the input vector
\r
2827 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2828 * @param[out] *pDst points to the output vector
\r
2829 * @param[in] blockSize number of samples in the vector
\r
2833 void arm_shift_q15(
\r
2837 uint32_t blockSize);
\r
2840 * @brief Shifts the elements of a Q31 vector a specified number of bits.
\r
2841 * @param[in] *pSrc points to the input vector
\r
2842 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2843 * @param[out] *pDst points to the output vector
\r
2844 * @param[in] blockSize number of samples in the vector
\r
2848 void arm_shift_q31(
\r
2852 uint32_t blockSize);
\r
2855 * @brief Adds a constant offset to a floating-point vector.
\r
2856 * @param[in] *pSrc points to the input vector
\r
2857 * @param[in] offset is the offset to be added
\r
2858 * @param[out] *pDst points to the output vector
\r
2859 * @param[in] blockSize number of samples in the vector
\r
2863 void arm_offset_f32(
\r
2867 uint32_t blockSize);
\r
2870 * @brief Adds a constant offset to a Q7 vector.
\r
2871 * @param[in] *pSrc points to the input vector
\r
2872 * @param[in] offset is the offset to be added
\r
2873 * @param[out] *pDst points to the output vector
\r
2874 * @param[in] blockSize number of samples in the vector
\r
2878 void arm_offset_q7(
\r
2882 uint32_t blockSize);
\r
2885 * @brief Adds a constant offset to a Q15 vector.
\r
2886 * @param[in] *pSrc points to the input vector
\r
2887 * @param[in] offset is the offset to be added
\r
2888 * @param[out] *pDst points to the output vector
\r
2889 * @param[in] blockSize number of samples in the vector
\r
2893 void arm_offset_q15(
\r
2897 uint32_t blockSize);
\r
2900 * @brief Adds a constant offset to a Q31 vector.
\r
2901 * @param[in] *pSrc points to the input vector
\r
2902 * @param[in] offset is the offset to be added
\r
2903 * @param[out] *pDst points to the output vector
\r
2904 * @param[in] blockSize number of samples in the vector
\r
2908 void arm_offset_q31(
\r
2912 uint32_t blockSize);
\r
2915 * @brief Negates the elements of a floating-point vector.
\r
2916 * @param[in] *pSrc points to the input vector
\r
2917 * @param[out] *pDst points to the output vector
\r
2918 * @param[in] blockSize number of samples in the vector
\r
2922 void arm_negate_f32(
\r
2925 uint32_t blockSize);
\r
2928 * @brief Negates the elements of a Q7 vector.
\r
2929 * @param[in] *pSrc points to the input vector
\r
2930 * @param[out] *pDst points to the output vector
\r
2931 * @param[in] blockSize number of samples in the vector
\r
2935 void arm_negate_q7(
\r
2938 uint32_t blockSize);
\r
2941 * @brief Negates the elements of a Q15 vector.
\r
2942 * @param[in] *pSrc points to the input vector
\r
2943 * @param[out] *pDst points to the output vector
\r
2944 * @param[in] blockSize number of samples in the vector
\r
2948 void arm_negate_q15(
\r
2951 uint32_t blockSize);
\r
2954 * @brief Negates the elements of a Q31 vector.
\r
2955 * @param[in] *pSrc points to the input vector
\r
2956 * @param[out] *pDst points to the output vector
\r
2957 * @param[in] blockSize number of samples in the vector
\r
2961 void arm_negate_q31(
\r
2964 uint32_t blockSize);
\r
2966 * @brief Copies the elements of a floating-point vector.
\r
2967 * @param[in] *pSrc input pointer
\r
2968 * @param[out] *pDst output pointer
\r
2969 * @param[in] blockSize number of samples to process
\r
2972 void arm_copy_f32(
\r
2975 uint32_t blockSize);
\r
2978 * @brief Copies the elements of a Q7 vector.
\r
2979 * @param[in] *pSrc input pointer
\r
2980 * @param[out] *pDst output pointer
\r
2981 * @param[in] blockSize number of samples to process
\r
2987 uint32_t blockSize);
\r
2990 * @brief Copies the elements of a Q15 vector.
\r
2991 * @param[in] *pSrc input pointer
\r
2992 * @param[out] *pDst output pointer
\r
2993 * @param[in] blockSize number of samples to process
\r
2996 void arm_copy_q15(
\r
2999 uint32_t blockSize);
\r
3002 * @brief Copies the elements of a Q31 vector.
\r
3003 * @param[in] *pSrc input pointer
\r
3004 * @param[out] *pDst output pointer
\r
3005 * @param[in] blockSize number of samples to process
\r
3008 void arm_copy_q31(
\r
3011 uint32_t blockSize);
\r
3013 * @brief Fills a constant value into a floating-point vector.
\r
3014 * @param[in] value input value to be filled
\r
3015 * @param[out] *pDst output pointer
\r
3016 * @param[in] blockSize number of samples to process
\r
3019 void arm_fill_f32(
\r
3022 uint32_t blockSize);
\r
3025 * @brief Fills a constant value into a Q7 vector.
\r
3026 * @param[in] value input value to be filled
\r
3027 * @param[out] *pDst output pointer
\r
3028 * @param[in] blockSize number of samples to process
\r
3034 uint32_t blockSize);
\r
3037 * @brief Fills a constant value into a Q15 vector.
\r
3038 * @param[in] value input value to be filled
\r
3039 * @param[out] *pDst output pointer
\r
3040 * @param[in] blockSize number of samples to process
\r
3043 void arm_fill_q15(
\r
3046 uint32_t blockSize);
\r
3049 * @brief Fills a constant value into a Q31 vector.
\r
3050 * @param[in] value input value to be filled
\r
3051 * @param[out] *pDst output pointer
\r
3052 * @param[in] blockSize number of samples to process
\r
3055 void arm_fill_q31(
\r
3058 uint32_t blockSize);
\r
3061 * @brief Convolution of floating-point sequences.
\r
3062 * @param[in] *pSrcA points to the first input sequence.
\r
3063 * @param[in] srcALen length of the first input sequence.
\r
3064 * @param[in] *pSrcB points to the second input sequence.
\r
3065 * @param[in] srcBLen length of the second input sequence.
\r
3066 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3070 void arm_conv_f32(
\r
3071 float32_t * pSrcA,
\r
3073 float32_t * pSrcB,
\r
3075 float32_t * pDst);
\r
3079 * @brief Convolution of Q15 sequences.
\r
3080 * @param[in] *pSrcA points to the first input sequence.
\r
3081 * @param[in] srcALen length of the first input sequence.
\r
3082 * @param[in] *pSrcB points to the second input sequence.
\r
3083 * @param[in] srcBLen length of the second input sequence.
\r
3084 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3085 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3086 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3091 void arm_conv_opt_q15(
\r
3097 q15_t * pScratch1,
\r
3098 q15_t * pScratch2);
\r
3102 * @brief Convolution of Q15 sequences.
\r
3103 * @param[in] *pSrcA points to the first input sequence.
\r
3104 * @param[in] srcALen length of the first input sequence.
\r
3105 * @param[in] *pSrcB points to the second input sequence.
\r
3106 * @param[in] srcBLen length of the second input sequence.
\r
3107 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3111 void arm_conv_q15(
\r
3119 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3120 * @param[in] *pSrcA points to the first input sequence.
\r
3121 * @param[in] srcALen length of the first input sequence.
\r
3122 * @param[in] *pSrcB points to the second input sequence.
\r
3123 * @param[in] srcBLen length of the second input sequence.
\r
3124 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3128 void arm_conv_fast_q15(
\r
3136 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3137 * @param[in] *pSrcA points to the first input sequence.
\r
3138 * @param[in] srcALen length of the first input sequence.
\r
3139 * @param[in] *pSrcB points to the second input sequence.
\r
3140 * @param[in] srcBLen length of the second input sequence.
\r
3141 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3142 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3143 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3147 void arm_conv_fast_opt_q15(
\r
3153 q15_t * pScratch1,
\r
3154 q15_t * pScratch2);
\r
3159 * @brief Convolution of Q31 sequences.
\r
3160 * @param[in] *pSrcA points to the first input sequence.
\r
3161 * @param[in] srcALen length of the first input sequence.
\r
3162 * @param[in] *pSrcB points to the second input sequence.
\r
3163 * @param[in] srcBLen length of the second input sequence.
\r
3164 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3168 void arm_conv_q31(
\r
3176 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3177 * @param[in] *pSrcA points to the first input sequence.
\r
3178 * @param[in] srcALen length of the first input sequence.
\r
3179 * @param[in] *pSrcB points to the second input sequence.
\r
3180 * @param[in] srcBLen length of the second input sequence.
\r
3181 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3185 void arm_conv_fast_q31(
\r
3194 * @brief Convolution of Q7 sequences.
\r
3195 * @param[in] *pSrcA points to the first input sequence.
\r
3196 * @param[in] srcALen length of the first input sequence.
\r
3197 * @param[in] *pSrcB points to the second input sequence.
\r
3198 * @param[in] srcBLen length of the second input sequence.
\r
3199 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3200 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3201 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3205 void arm_conv_opt_q7(
\r
3211 q15_t * pScratch1,
\r
3212 q15_t * pScratch2);
\r
3217 * @brief Convolution of Q7 sequences.
\r
3218 * @param[in] *pSrcA points to the first input sequence.
\r
3219 * @param[in] srcALen length of the first input sequence.
\r
3220 * @param[in] *pSrcB points to the second input sequence.
\r
3221 * @param[in] srcBLen length of the second input sequence.
\r
3222 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3235 * @brief Partial convolution of floating-point sequences.
\r
3236 * @param[in] *pSrcA points to the first input sequence.
\r
3237 * @param[in] srcALen length of the first input sequence.
\r
3238 * @param[in] *pSrcB points to the second input sequence.
\r
3239 * @param[in] srcBLen length of the second input sequence.
\r
3240 * @param[out] *pDst points to the block of output data
\r
3241 * @param[in] firstIndex is the first output sample to start with.
\r
3242 * @param[in] numPoints is the number of output points to be computed.
\r
3243 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3246 arm_status arm_conv_partial_f32(
\r
3247 float32_t * pSrcA,
\r
3249 float32_t * pSrcB,
\r
3252 uint32_t firstIndex,
\r
3253 uint32_t numPoints);
\r
3256 * @brief Partial convolution of Q15 sequences.
\r
3257 * @param[in] *pSrcA points to the first input sequence.
\r
3258 * @param[in] srcALen length of the first input sequence.
\r
3259 * @param[in] *pSrcB points to the second input sequence.
\r
3260 * @param[in] srcBLen length of the second input sequence.
\r
3261 * @param[out] *pDst points to the block of output data
\r
3262 * @param[in] firstIndex is the first output sample to start with.
\r
3263 * @param[in] numPoints is the number of output points to be computed.
\r
3264 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3265 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3266 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3269 arm_status arm_conv_partial_opt_q15(
\r
3275 uint32_t firstIndex,
\r
3276 uint32_t numPoints,
\r
3277 q15_t * pScratch1,
\r
3278 q15_t * pScratch2);
\r
3282 * @brief Partial convolution of Q15 sequences.
\r
3283 * @param[in] *pSrcA points to the first input sequence.
\r
3284 * @param[in] srcALen length of the first input sequence.
\r
3285 * @param[in] *pSrcB points to the second input sequence.
\r
3286 * @param[in] srcBLen length of the second input sequence.
\r
3287 * @param[out] *pDst points to the block of output data
\r
3288 * @param[in] firstIndex is the first output sample to start with.
\r
3289 * @param[in] numPoints is the number of output points to be computed.
\r
3290 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3293 arm_status arm_conv_partial_q15(
\r
3299 uint32_t firstIndex,
\r
3300 uint32_t numPoints);
\r
3303 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3304 * @param[in] *pSrcA points to the first input sequence.
\r
3305 * @param[in] srcALen length of the first input sequence.
\r
3306 * @param[in] *pSrcB points to the second input sequence.
\r
3307 * @param[in] srcBLen length of the second input sequence.
\r
3308 * @param[out] *pDst points to the block of output data
\r
3309 * @param[in] firstIndex is the first output sample to start with.
\r
3310 * @param[in] numPoints is the number of output points to be computed.
\r
3311 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3314 arm_status arm_conv_partial_fast_q15(
\r
3320 uint32_t firstIndex,
\r
3321 uint32_t numPoints);
\r
3325 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3326 * @param[in] *pSrcA points to the first input sequence.
\r
3327 * @param[in] srcALen length of the first input sequence.
\r
3328 * @param[in] *pSrcB points to the second input sequence.
\r
3329 * @param[in] srcBLen length of the second input sequence.
\r
3330 * @param[out] *pDst points to the block of output data
\r
3331 * @param[in] firstIndex is the first output sample to start with.
\r
3332 * @param[in] numPoints is the number of output points to be computed.
\r
3333 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3334 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3335 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3338 arm_status arm_conv_partial_fast_opt_q15(
\r
3344 uint32_t firstIndex,
\r
3345 uint32_t numPoints,
\r
3346 q15_t * pScratch1,
\r
3347 q15_t * pScratch2);
\r
3351 * @brief Partial convolution of Q31 sequences.
\r
3352 * @param[in] *pSrcA points to the first input sequence.
\r
3353 * @param[in] srcALen length of the first input sequence.
\r
3354 * @param[in] *pSrcB points to the second input sequence.
\r
3355 * @param[in] srcBLen length of the second input sequence.
\r
3356 * @param[out] *pDst points to the block of output data
\r
3357 * @param[in] firstIndex is the first output sample to start with.
\r
3358 * @param[in] numPoints is the number of output points to be computed.
\r
3359 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3362 arm_status arm_conv_partial_q31(
\r
3368 uint32_t firstIndex,
\r
3369 uint32_t numPoints);
\r
3373 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3374 * @param[in] *pSrcA points to the first input sequence.
\r
3375 * @param[in] srcALen length of the first input sequence.
\r
3376 * @param[in] *pSrcB points to the second input sequence.
\r
3377 * @param[in] srcBLen length of the second input sequence.
\r
3378 * @param[out] *pDst points to the block of output data
\r
3379 * @param[in] firstIndex is the first output sample to start with.
\r
3380 * @param[in] numPoints is the number of output points to be computed.
\r
3381 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3384 arm_status arm_conv_partial_fast_q31(
\r
3390 uint32_t firstIndex,
\r
3391 uint32_t numPoints);
\r
3395 * @brief Partial convolution of Q7 sequences
\r
3396 * @param[in] *pSrcA points to the first input sequence.
\r
3397 * @param[in] srcALen length of the first input sequence.
\r
3398 * @param[in] *pSrcB points to the second input sequence.
\r
3399 * @param[in] srcBLen length of the second input sequence.
\r
3400 * @param[out] *pDst points to the block of output data
\r
3401 * @param[in] firstIndex is the first output sample to start with.
\r
3402 * @param[in] numPoints is the number of output points to be computed.
\r
3403 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3404 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3405 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3408 arm_status arm_conv_partial_opt_q7(
\r
3414 uint32_t firstIndex,
\r
3415 uint32_t numPoints,
\r
3416 q15_t * pScratch1,
\r
3417 q15_t * pScratch2);
\r
3421 * @brief Partial convolution of Q7 sequences.
\r
3422 * @param[in] *pSrcA points to the first input sequence.
\r
3423 * @param[in] srcALen length of the first input sequence.
\r
3424 * @param[in] *pSrcB points to the second input sequence.
\r
3425 * @param[in] srcBLen length of the second input sequence.
\r
3426 * @param[out] *pDst points to the block of output data
\r
3427 * @param[in] firstIndex is the first output sample to start with.
\r
3428 * @param[in] numPoints is the number of output points to be computed.
\r
3429 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3432 arm_status arm_conv_partial_q7(
\r
3438 uint32_t firstIndex,
\r
3439 uint32_t numPoints);
\r
3444 * @brief Instance structure for the Q15 FIR decimator.
\r
3449 uint8_t M; /**< decimation factor. */
\r
3450 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3451 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3452 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3453 } arm_fir_decimate_instance_q15;
\r
3456 * @brief Instance structure for the Q31 FIR decimator.
\r
3461 uint8_t M; /**< decimation factor. */
\r
3462 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3463 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3464 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3466 } arm_fir_decimate_instance_q31;
\r
3469 * @brief Instance structure for the floating-point FIR decimator.
\r
3474 uint8_t M; /**< decimation factor. */
\r
3475 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3476 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3477 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3479 } arm_fir_decimate_instance_f32;
\r
3484 * @brief Processing function for the floating-point FIR decimator.
\r
3485 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
\r
3486 * @param[in] *pSrc points to the block of input data.
\r
3487 * @param[out] *pDst points to the block of output data
\r
3488 * @param[in] blockSize number of input samples to process per call.
\r
3492 void arm_fir_decimate_f32(
\r
3493 const arm_fir_decimate_instance_f32 * S,
\r
3496 uint32_t blockSize);
\r
3500 * @brief Initialization function for the floating-point FIR decimator.
\r
3501 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
\r
3502 * @param[in] numTaps number of coefficients in the filter.
\r
3503 * @param[in] M decimation factor.
\r
3504 * @param[in] *pCoeffs points to the filter coefficients.
\r
3505 * @param[in] *pState points to the state buffer.
\r
3506 * @param[in] blockSize number of input samples to process per call.
\r
3507 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3508 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3511 arm_status arm_fir_decimate_init_f32(
\r
3512 arm_fir_decimate_instance_f32 * S,
\r
3515 float32_t * pCoeffs,
\r
3516 float32_t * pState,
\r
3517 uint32_t blockSize);
\r
3520 * @brief Processing function for the Q15 FIR decimator.
\r
3521 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3522 * @param[in] *pSrc points to the block of input data.
\r
3523 * @param[out] *pDst points to the block of output data
\r
3524 * @param[in] blockSize number of input samples to process per call.
\r
3528 void arm_fir_decimate_q15(
\r
3529 const arm_fir_decimate_instance_q15 * S,
\r
3532 uint32_t blockSize);
\r
3535 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3536 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3537 * @param[in] *pSrc points to the block of input data.
\r
3538 * @param[out] *pDst points to the block of output data
\r
3539 * @param[in] blockSize number of input samples to process per call.
\r
3543 void arm_fir_decimate_fast_q15(
\r
3544 const arm_fir_decimate_instance_q15 * S,
\r
3547 uint32_t blockSize);
\r
3552 * @brief Initialization function for the Q15 FIR decimator.
\r
3553 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
\r
3554 * @param[in] numTaps number of coefficients in the filter.
\r
3555 * @param[in] M decimation factor.
\r
3556 * @param[in] *pCoeffs points to the filter coefficients.
\r
3557 * @param[in] *pState points to the state buffer.
\r
3558 * @param[in] blockSize number of input samples to process per call.
\r
3559 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3560 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3563 arm_status arm_fir_decimate_init_q15(
\r
3564 arm_fir_decimate_instance_q15 * S,
\r
3569 uint32_t blockSize);
\r
3572 * @brief Processing function for the Q31 FIR decimator.
\r
3573 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3574 * @param[in] *pSrc points to the block of input data.
\r
3575 * @param[out] *pDst points to the block of output data
\r
3576 * @param[in] blockSize number of input samples to process per call.
\r
3580 void arm_fir_decimate_q31(
\r
3581 const arm_fir_decimate_instance_q31 * S,
\r
3584 uint32_t blockSize);
\r
3587 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3588 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3589 * @param[in] *pSrc points to the block of input data.
\r
3590 * @param[out] *pDst points to the block of output data
\r
3591 * @param[in] blockSize number of input samples to process per call.
\r
3595 void arm_fir_decimate_fast_q31(
\r
3596 arm_fir_decimate_instance_q31 * S,
\r
3599 uint32_t blockSize);
\r
3603 * @brief Initialization function for the Q31 FIR decimator.
\r
3604 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
\r
3605 * @param[in] numTaps number of coefficients in the filter.
\r
3606 * @param[in] M decimation factor.
\r
3607 * @param[in] *pCoeffs points to the filter coefficients.
\r
3608 * @param[in] *pState points to the state buffer.
\r
3609 * @param[in] blockSize number of input samples to process per call.
\r
3610 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3611 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3614 arm_status arm_fir_decimate_init_q31(
\r
3615 arm_fir_decimate_instance_q31 * S,
\r
3620 uint32_t blockSize);
\r
3625 * @brief Instance structure for the Q15 FIR interpolator.
\r
3630 uint8_t L; /**< upsample factor. */
\r
3631 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3632 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3633 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3634 } arm_fir_interpolate_instance_q15;
\r
3637 * @brief Instance structure for the Q31 FIR interpolator.
\r
3642 uint8_t L; /**< upsample factor. */
\r
3643 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3644 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3645 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3646 } arm_fir_interpolate_instance_q31;
\r
3649 * @brief Instance structure for the floating-point FIR interpolator.
\r
3654 uint8_t L; /**< upsample factor. */
\r
3655 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3656 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3657 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
\r
3658 } arm_fir_interpolate_instance_f32;
\r
3662 * @brief Processing function for the Q15 FIR interpolator.
\r
3663 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3664 * @param[in] *pSrc points to the block of input data.
\r
3665 * @param[out] *pDst points to the block of output data.
\r
3666 * @param[in] blockSize number of input samples to process per call.
\r
3670 void arm_fir_interpolate_q15(
\r
3671 const arm_fir_interpolate_instance_q15 * S,
\r
3674 uint32_t blockSize);
\r
3678 * @brief Initialization function for the Q15 FIR interpolator.
\r
3679 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
\r
3680 * @param[in] L upsample factor.
\r
3681 * @param[in] numTaps number of filter coefficients in the filter.
\r
3682 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3683 * @param[in] *pState points to the state buffer.
\r
3684 * @param[in] blockSize number of input samples to process per call.
\r
3685 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3686 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3689 arm_status arm_fir_interpolate_init_q15(
\r
3690 arm_fir_interpolate_instance_q15 * S,
\r
3695 uint32_t blockSize);
\r
3698 * @brief Processing function for the Q31 FIR interpolator.
\r
3699 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3700 * @param[in] *pSrc points to the block of input data.
\r
3701 * @param[out] *pDst points to the block of output data.
\r
3702 * @param[in] blockSize number of input samples to process per call.
\r
3706 void arm_fir_interpolate_q31(
\r
3707 const arm_fir_interpolate_instance_q31 * S,
\r
3710 uint32_t blockSize);
\r
3713 * @brief Initialization function for the Q31 FIR interpolator.
\r
3714 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
\r
3715 * @param[in] L upsample factor.
\r
3716 * @param[in] numTaps number of filter coefficients in the filter.
\r
3717 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3718 * @param[in] *pState points to the state buffer.
\r
3719 * @param[in] blockSize number of input samples to process per call.
\r
3720 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3721 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3724 arm_status arm_fir_interpolate_init_q31(
\r
3725 arm_fir_interpolate_instance_q31 * S,
\r
3730 uint32_t blockSize);
\r
3734 * @brief Processing function for the floating-point FIR interpolator.
\r
3735 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
\r
3736 * @param[in] *pSrc points to the block of input data.
\r
3737 * @param[out] *pDst points to the block of output data.
\r
3738 * @param[in] blockSize number of input samples to process per call.
\r
3742 void arm_fir_interpolate_f32(
\r
3743 const arm_fir_interpolate_instance_f32 * S,
\r
3746 uint32_t blockSize);
\r
3749 * @brief Initialization function for the floating-point FIR interpolator.
\r
3750 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
\r
3751 * @param[in] L upsample factor.
\r
3752 * @param[in] numTaps number of filter coefficients in the filter.
\r
3753 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3754 * @param[in] *pState points to the state buffer.
\r
3755 * @param[in] blockSize number of input samples to process per call.
\r
3756 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3757 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3760 arm_status arm_fir_interpolate_init_f32(
\r
3761 arm_fir_interpolate_instance_f32 * S,
\r
3764 float32_t * pCoeffs,
\r
3765 float32_t * pState,
\r
3766 uint32_t blockSize);
\r
3769 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
\r
3774 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3775 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3776 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3777 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
\r
3779 } arm_biquad_cas_df1_32x64_ins_q31;
\r
3783 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3784 * @param[in] *pSrc points to the block of input data.
\r
3785 * @param[out] *pDst points to the block of output data
\r
3786 * @param[in] blockSize number of samples to process.
\r
3790 void arm_biquad_cas_df1_32x64_q31(
\r
3791 const arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3794 uint32_t blockSize);
\r
3798 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3799 * @param[in] numStages number of 2nd order stages in the filter.
\r
3800 * @param[in] *pCoeffs points to the filter coefficients.
\r
3801 * @param[in] *pState points to the state buffer.
\r
3802 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
\r
3806 void arm_biquad_cas_df1_32x64_init_q31(
\r
3807 arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3808 uint8_t numStages,
\r
3811 uint8_t postShift);
\r
3816 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3821 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3822 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3823 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3824 } arm_biquad_cascade_df2T_instance_f32;
\r
3829 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3834 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3835 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3836 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3837 } arm_biquad_cascade_stereo_df2T_instance_f32;
\r
3842 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3847 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3848 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3849 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3850 } arm_biquad_cascade_df2T_instance_f64;
\r
3854 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3855 * @param[in] *S points to an instance of the filter data structure.
\r
3856 * @param[in] *pSrc points to the block of input data.
\r
3857 * @param[out] *pDst points to the block of output data
\r
3858 * @param[in] blockSize number of samples to process.
\r
3862 void arm_biquad_cascade_df2T_f32(
\r
3863 const arm_biquad_cascade_df2T_instance_f32 * S,
\r
3866 uint32_t blockSize);
\r
3870 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
\r
3871 * @param[in] *S points to an instance of the filter data structure.
\r
3872 * @param[in] *pSrc points to the block of input data.
\r
3873 * @param[out] *pDst points to the block of output data
\r
3874 * @param[in] blockSize number of samples to process.
\r
3878 void arm_biquad_cascade_stereo_df2T_f32(
\r
3879 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3882 uint32_t blockSize);
\r
3885 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3886 * @param[in] *S points to an instance of the filter data structure.
\r
3887 * @param[in] *pSrc points to the block of input data.
\r
3888 * @param[out] *pDst points to the block of output data
\r
3889 * @param[in] blockSize number of samples to process.
\r
3893 void arm_biquad_cascade_df2T_f64(
\r
3894 const arm_biquad_cascade_df2T_instance_f64 * S,
\r
3897 uint32_t blockSize);
\r
3901 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3902 * @param[in,out] *S points to an instance of the filter data structure.
\r
3903 * @param[in] numStages number of 2nd order stages in the filter.
\r
3904 * @param[in] *pCoeffs points to the filter coefficients.
\r
3905 * @param[in] *pState points to the state buffer.
\r
3909 void arm_biquad_cascade_df2T_init_f32(
\r
3910 arm_biquad_cascade_df2T_instance_f32 * S,
\r
3911 uint8_t numStages,
\r
3912 float32_t * pCoeffs,
\r
3913 float32_t * pState);
\r
3917 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3918 * @param[in,out] *S points to an instance of the filter data structure.
\r
3919 * @param[in] numStages number of 2nd order stages in the filter.
\r
3920 * @param[in] *pCoeffs points to the filter coefficients.
\r
3921 * @param[in] *pState points to the state buffer.
\r
3925 void arm_biquad_cascade_stereo_df2T_init_f32(
\r
3926 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3927 uint8_t numStages,
\r
3928 float32_t * pCoeffs,
\r
3929 float32_t * pState);
\r
3933 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3934 * @param[in,out] *S points to an instance of the filter data structure.
\r
3935 * @param[in] numStages number of 2nd order stages in the filter.
\r
3936 * @param[in] *pCoeffs points to the filter coefficients.
\r
3937 * @param[in] *pState points to the state buffer.
\r
3941 void arm_biquad_cascade_df2T_init_f64(
\r
3942 arm_biquad_cascade_df2T_instance_f64 * S,
\r
3943 uint8_t numStages,
\r
3944 float64_t * pCoeffs,
\r
3945 float64_t * pState);
\r
3950 * @brief Instance structure for the Q15 FIR lattice filter.
\r
3955 uint16_t numStages; /**< number of filter stages. */
\r
3956 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3957 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3958 } arm_fir_lattice_instance_q15;
\r
3961 * @brief Instance structure for the Q31 FIR lattice filter.
\r
3966 uint16_t numStages; /**< number of filter stages. */
\r
3967 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3968 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3969 } arm_fir_lattice_instance_q31;
\r
3972 * @brief Instance structure for the floating-point FIR lattice filter.
\r
3977 uint16_t numStages; /**< number of filter stages. */
\r
3978 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3979 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3980 } arm_fir_lattice_instance_f32;
\r
3983 * @brief Initialization function for the Q15 FIR lattice filter.
\r
3984 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3985 * @param[in] numStages number of filter stages.
\r
3986 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3987 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
3991 void arm_fir_lattice_init_q15(
\r
3992 arm_fir_lattice_instance_q15 * S,
\r
3993 uint16_t numStages,
\r
3999 * @brief Processing function for the Q15 FIR lattice filter.
\r
4000 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
4001 * @param[in] *pSrc points to the block of input data.
\r
4002 * @param[out] *pDst points to the block of output data.
\r
4003 * @param[in] blockSize number of samples to process.
\r
4006 void arm_fir_lattice_q15(
\r
4007 const arm_fir_lattice_instance_q15 * S,
\r
4010 uint32_t blockSize);
\r
4013 * @brief Initialization function for the Q31 FIR lattice filter.
\r
4014 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
4015 * @param[in] numStages number of filter stages.
\r
4016 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
4017 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
4021 void arm_fir_lattice_init_q31(
\r
4022 arm_fir_lattice_instance_q31 * S,
\r
4023 uint16_t numStages,
\r
4029 * @brief Processing function for the Q31 FIR lattice filter.
\r
4030 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
4031 * @param[in] *pSrc points to the block of input data.
\r
4032 * @param[out] *pDst points to the block of output data
\r
4033 * @param[in] blockSize number of samples to process.
\r
4037 void arm_fir_lattice_q31(
\r
4038 const arm_fir_lattice_instance_q31 * S,
\r
4041 uint32_t blockSize);
\r
4044 * @brief Initialization function for the floating-point FIR lattice filter.
\r
4045 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
4046 * @param[in] numStages number of filter stages.
\r
4047 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
4048 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
4052 void arm_fir_lattice_init_f32(
\r
4053 arm_fir_lattice_instance_f32 * S,
\r
4054 uint16_t numStages,
\r
4055 float32_t * pCoeffs,
\r
4056 float32_t * pState);
\r
4059 * @brief Processing function for the floating-point FIR lattice filter.
\r
4060 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
4061 * @param[in] *pSrc points to the block of input data.
\r
4062 * @param[out] *pDst points to the block of output data
\r
4063 * @param[in] blockSize number of samples to process.
\r
4067 void arm_fir_lattice_f32(
\r
4068 const arm_fir_lattice_instance_f32 * S,
\r
4071 uint32_t blockSize);
\r
4074 * @brief Instance structure for the Q15 IIR lattice filter.
\r
4078 uint16_t numStages; /**< number of stages in the filter. */
\r
4079 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4080 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4081 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4082 } arm_iir_lattice_instance_q15;
\r
4085 * @brief Instance structure for the Q31 IIR lattice filter.
\r
4089 uint16_t numStages; /**< number of stages in the filter. */
\r
4090 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4091 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4092 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4093 } arm_iir_lattice_instance_q31;
\r
4096 * @brief Instance structure for the floating-point IIR lattice filter.
\r
4100 uint16_t numStages; /**< number of stages in the filter. */
\r
4101 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4102 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4103 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4104 } arm_iir_lattice_instance_f32;
\r
4107 * @brief Processing function for the floating-point IIR lattice filter.
\r
4108 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
4109 * @param[in] *pSrc points to the block of input data.
\r
4110 * @param[out] *pDst points to the block of output data.
\r
4111 * @param[in] blockSize number of samples to process.
\r
4115 void arm_iir_lattice_f32(
\r
4116 const arm_iir_lattice_instance_f32 * S,
\r
4119 uint32_t blockSize);
\r
4122 * @brief Initialization function for the floating-point IIR lattice filter.
\r
4123 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
4124 * @param[in] numStages number of stages in the filter.
\r
4125 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4126 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4127 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
\r
4128 * @param[in] blockSize number of samples to process.
\r
4132 void arm_iir_lattice_init_f32(
\r
4133 arm_iir_lattice_instance_f32 * S,
\r
4134 uint16_t numStages,
\r
4135 float32_t * pkCoeffs,
\r
4136 float32_t * pvCoeffs,
\r
4137 float32_t * pState,
\r
4138 uint32_t blockSize);
\r
4142 * @brief Processing function for the Q31 IIR lattice filter.
\r
4143 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4144 * @param[in] *pSrc points to the block of input data.
\r
4145 * @param[out] *pDst points to the block of output data.
\r
4146 * @param[in] blockSize number of samples to process.
\r
4150 void arm_iir_lattice_q31(
\r
4151 const arm_iir_lattice_instance_q31 * S,
\r
4154 uint32_t blockSize);
\r
4158 * @brief Initialization function for the Q31 IIR lattice filter.
\r
4159 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4160 * @param[in] numStages number of stages in the filter.
\r
4161 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4162 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4163 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
\r
4164 * @param[in] blockSize number of samples to process.
\r
4168 void arm_iir_lattice_init_q31(
\r
4169 arm_iir_lattice_instance_q31 * S,
\r
4170 uint16_t numStages,
\r
4174 uint32_t blockSize);
\r
4178 * @brief Processing function for the Q15 IIR lattice filter.
\r
4179 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
\r
4180 * @param[in] *pSrc points to the block of input data.
\r
4181 * @param[out] *pDst points to the block of output data.
\r
4182 * @param[in] blockSize number of samples to process.
\r
4186 void arm_iir_lattice_q15(
\r
4187 const arm_iir_lattice_instance_q15 * S,
\r
4190 uint32_t blockSize);
\r
4194 * @brief Initialization function for the Q15 IIR lattice filter.
\r
4195 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
\r
4196 * @param[in] numStages number of stages in the filter.
\r
4197 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
\r
4198 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
\r
4199 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
\r
4200 * @param[in] blockSize number of samples to process per call.
\r
4204 void arm_iir_lattice_init_q15(
\r
4205 arm_iir_lattice_instance_q15 * S,
\r
4206 uint16_t numStages,
\r
4210 uint32_t blockSize);
\r
4213 * @brief Instance structure for the floating-point LMS filter.
\r
4218 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4219 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4220 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4221 float32_t mu; /**< step size that controls filter coefficient updates. */
\r
4222 } arm_lms_instance_f32;
\r
4225 * @brief Processing function for floating-point LMS filter.
\r
4226 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4227 * @param[in] *pSrc points to the block of input data.
\r
4228 * @param[in] *pRef points to the block of reference data.
\r
4229 * @param[out] *pOut points to the block of output data.
\r
4230 * @param[out] *pErr points to the block of error data.
\r
4231 * @param[in] blockSize number of samples to process.
\r
4236 const arm_lms_instance_f32 * S,
\r
4241 uint32_t blockSize);
\r
4244 * @brief Initialization function for floating-point LMS filter.
\r
4245 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4246 * @param[in] numTaps number of filter coefficients.
\r
4247 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4248 * @param[in] *pState points to state buffer.
\r
4249 * @param[in] mu step size that controls filter coefficient updates.
\r
4250 * @param[in] blockSize number of samples to process.
\r
4254 void arm_lms_init_f32(
\r
4255 arm_lms_instance_f32 * S,
\r
4257 float32_t * pCoeffs,
\r
4258 float32_t * pState,
\r
4260 uint32_t blockSize);
\r
4263 * @brief Instance structure for the Q15 LMS filter.
\r
4268 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4269 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4270 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4271 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4272 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4273 } arm_lms_instance_q15;
\r
4277 * @brief Initialization function for the Q15 LMS filter.
\r
4278 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4279 * @param[in] numTaps number of filter coefficients.
\r
4280 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4281 * @param[in] *pState points to the state buffer.
\r
4282 * @param[in] mu step size that controls filter coefficient updates.
\r
4283 * @param[in] blockSize number of samples to process.
\r
4284 * @param[in] postShift bit shift applied to coefficients.
\r
4288 void arm_lms_init_q15(
\r
4289 arm_lms_instance_q15 * S,
\r
4294 uint32_t blockSize,
\r
4295 uint32_t postShift);
\r
4298 * @brief Processing function for Q15 LMS filter.
\r
4299 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4300 * @param[in] *pSrc points to the block of input data.
\r
4301 * @param[in] *pRef points to the block of reference data.
\r
4302 * @param[out] *pOut points to the block of output data.
\r
4303 * @param[out] *pErr points to the block of error data.
\r
4304 * @param[in] blockSize number of samples to process.
\r
4309 const arm_lms_instance_q15 * S,
\r
4314 uint32_t blockSize);
\r
4318 * @brief Instance structure for the Q31 LMS filter.
\r
4323 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4324 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4325 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4326 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4327 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4329 } arm_lms_instance_q31;
\r
4332 * @brief Processing function for Q31 LMS filter.
\r
4333 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4334 * @param[in] *pSrc points to the block of input data.
\r
4335 * @param[in] *pRef points to the block of reference data.
\r
4336 * @param[out] *pOut points to the block of output data.
\r
4337 * @param[out] *pErr points to the block of error data.
\r
4338 * @param[in] blockSize number of samples to process.
\r
4343 const arm_lms_instance_q31 * S,
\r
4348 uint32_t blockSize);
\r
4351 * @brief Initialization function for Q31 LMS filter.
\r
4352 * @param[in] *S points to an instance of the Q31 LMS filter structure.
\r
4353 * @param[in] numTaps number of filter coefficients.
\r
4354 * @param[in] *pCoeffs points to coefficient buffer.
\r
4355 * @param[in] *pState points to state buffer.
\r
4356 * @param[in] mu step size that controls filter coefficient updates.
\r
4357 * @param[in] blockSize number of samples to process.
\r
4358 * @param[in] postShift bit shift applied to coefficients.
\r
4362 void arm_lms_init_q31(
\r
4363 arm_lms_instance_q31 * S,
\r
4368 uint32_t blockSize,
\r
4369 uint32_t postShift);
\r
4372 * @brief Instance structure for the floating-point normalized LMS filter.
\r
4377 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4378 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4379 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4380 float32_t mu; /**< step size that control filter coefficient updates. */
\r
4381 float32_t energy; /**< saves previous frame energy. */
\r
4382 float32_t x0; /**< saves previous input sample. */
\r
4383 } arm_lms_norm_instance_f32;
\r
4386 * @brief Processing function for floating-point normalized LMS filter.
\r
4387 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
\r
4388 * @param[in] *pSrc points to the block of input data.
\r
4389 * @param[in] *pRef points to the block of reference data.
\r
4390 * @param[out] *pOut points to the block of output data.
\r
4391 * @param[out] *pErr points to the block of error data.
\r
4392 * @param[in] blockSize number of samples to process.
\r
4396 void arm_lms_norm_f32(
\r
4397 arm_lms_norm_instance_f32 * S,
\r
4402 uint32_t blockSize);
\r
4405 * @brief Initialization function for floating-point normalized LMS filter.
\r
4406 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4407 * @param[in] numTaps number of filter coefficients.
\r
4408 * @param[in] *pCoeffs points to coefficient buffer.
\r
4409 * @param[in] *pState points to state buffer.
\r
4410 * @param[in] mu step size that controls filter coefficient updates.
\r
4411 * @param[in] blockSize number of samples to process.
\r
4415 void arm_lms_norm_init_f32(
\r
4416 arm_lms_norm_instance_f32 * S,
\r
4418 float32_t * pCoeffs,
\r
4419 float32_t * pState,
\r
4421 uint32_t blockSize);
\r
4425 * @brief Instance structure for the Q31 normalized LMS filter.
\r
4429 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4430 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4431 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4432 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4433 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4434 q31_t *recipTable; /**< points to the reciprocal initial value table. */
\r
4435 q31_t energy; /**< saves previous frame energy. */
\r
4436 q31_t x0; /**< saves previous input sample. */
\r
4437 } arm_lms_norm_instance_q31;
\r
4440 * @brief Processing function for Q31 normalized LMS filter.
\r
4441 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4442 * @param[in] *pSrc points to the block of input data.
\r
4443 * @param[in] *pRef points to the block of reference data.
\r
4444 * @param[out] *pOut points to the block of output data.
\r
4445 * @param[out] *pErr points to the block of error data.
\r
4446 * @param[in] blockSize number of samples to process.
\r
4450 void arm_lms_norm_q31(
\r
4451 arm_lms_norm_instance_q31 * S,
\r
4456 uint32_t blockSize);
\r
4459 * @brief Initialization function for Q31 normalized LMS filter.
\r
4460 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4461 * @param[in] numTaps number of filter coefficients.
\r
4462 * @param[in] *pCoeffs points to coefficient buffer.
\r
4463 * @param[in] *pState points to state buffer.
\r
4464 * @param[in] mu step size that controls filter coefficient updates.
\r
4465 * @param[in] blockSize number of samples to process.
\r
4466 * @param[in] postShift bit shift applied to coefficients.
\r
4470 void arm_lms_norm_init_q31(
\r
4471 arm_lms_norm_instance_q31 * S,
\r
4476 uint32_t blockSize,
\r
4477 uint8_t postShift);
\r
4480 * @brief Instance structure for the Q15 normalized LMS filter.
\r
4485 uint16_t numTaps; /**< Number of coefficients in the filter. */
\r
4486 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4487 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4488 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4489 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4490 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
\r
4491 q15_t energy; /**< saves previous frame energy. */
\r
4492 q15_t x0; /**< saves previous input sample. */
\r
4493 } arm_lms_norm_instance_q15;
\r
4496 * @brief Processing function for Q15 normalized LMS filter.
\r
4497 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4498 * @param[in] *pSrc points to the block of input data.
\r
4499 * @param[in] *pRef points to the block of reference data.
\r
4500 * @param[out] *pOut points to the block of output data.
\r
4501 * @param[out] *pErr points to the block of error data.
\r
4502 * @param[in] blockSize number of samples to process.
\r
4506 void arm_lms_norm_q15(
\r
4507 arm_lms_norm_instance_q15 * S,
\r
4512 uint32_t blockSize);
\r
4516 * @brief Initialization function for Q15 normalized LMS filter.
\r
4517 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4518 * @param[in] numTaps number of filter coefficients.
\r
4519 * @param[in] *pCoeffs points to coefficient buffer.
\r
4520 * @param[in] *pState points to state buffer.
\r
4521 * @param[in] mu step size that controls filter coefficient updates.
\r
4522 * @param[in] blockSize number of samples to process.
\r
4523 * @param[in] postShift bit shift applied to coefficients.
\r
4527 void arm_lms_norm_init_q15(
\r
4528 arm_lms_norm_instance_q15 * S,
\r
4533 uint32_t blockSize,
\r
4534 uint8_t postShift);
\r
4537 * @brief Correlation of floating-point sequences.
\r
4538 * @param[in] *pSrcA points to the first input sequence.
\r
4539 * @param[in] srcALen length of the first input sequence.
\r
4540 * @param[in] *pSrcB points to the second input sequence.
\r
4541 * @param[in] srcBLen length of the second input sequence.
\r
4542 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4546 void arm_correlate_f32(
\r
4547 float32_t * pSrcA,
\r
4549 float32_t * pSrcB,
\r
4551 float32_t * pDst);
\r
4555 * @brief Correlation of Q15 sequences
\r
4556 * @param[in] *pSrcA points to the first input sequence.
\r
4557 * @param[in] srcALen length of the first input sequence.
\r
4558 * @param[in] *pSrcB points to the second input sequence.
\r
4559 * @param[in] srcBLen length of the second input sequence.
\r
4560 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4561 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4564 void arm_correlate_opt_q15(
\r
4570 q15_t * pScratch);
\r
4574 * @brief Correlation of Q15 sequences.
\r
4575 * @param[in] *pSrcA points to the first input sequence.
\r
4576 * @param[in] srcALen length of the first input sequence.
\r
4577 * @param[in] *pSrcB points to the second input sequence.
\r
4578 * @param[in] srcBLen length of the second input sequence.
\r
4579 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4583 void arm_correlate_q15(
\r
4591 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4592 * @param[in] *pSrcA points to the first input sequence.
\r
4593 * @param[in] srcALen length of the first input sequence.
\r
4594 * @param[in] *pSrcB points to the second input sequence.
\r
4595 * @param[in] srcBLen length of the second input sequence.
\r
4596 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4600 void arm_correlate_fast_q15(
\r
4610 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4611 * @param[in] *pSrcA points to the first input sequence.
\r
4612 * @param[in] srcALen length of the first input sequence.
\r
4613 * @param[in] *pSrcB points to the second input sequence.
\r
4614 * @param[in] srcBLen length of the second input sequence.
\r
4615 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4616 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4620 void arm_correlate_fast_opt_q15(
\r
4626 q15_t * pScratch);
\r
4629 * @brief Correlation of Q31 sequences.
\r
4630 * @param[in] *pSrcA points to the first input sequence.
\r
4631 * @param[in] srcALen length of the first input sequence.
\r
4632 * @param[in] *pSrcB points to the second input sequence.
\r
4633 * @param[in] srcBLen length of the second input sequence.
\r
4634 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4638 void arm_correlate_q31(
\r
4646 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
4647 * @param[in] *pSrcA points to the first input sequence.
\r
4648 * @param[in] srcALen length of the first input sequence.
\r
4649 * @param[in] *pSrcB points to the second input sequence.
\r
4650 * @param[in] srcBLen length of the second input sequence.
\r
4651 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4655 void arm_correlate_fast_q31(
\r
4665 * @brief Correlation of Q7 sequences.
\r
4666 * @param[in] *pSrcA points to the first input sequence.
\r
4667 * @param[in] srcALen length of the first input sequence.
\r
4668 * @param[in] *pSrcB points to the second input sequence.
\r
4669 * @param[in] srcBLen length of the second input sequence.
\r
4670 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4671 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4672 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
4676 void arm_correlate_opt_q7(
\r
4682 q15_t * pScratch1,
\r
4683 q15_t * pScratch2);
\r
4687 * @brief Correlation of Q7 sequences.
\r
4688 * @param[in] *pSrcA points to the first input sequence.
\r
4689 * @param[in] srcALen length of the first input sequence.
\r
4690 * @param[in] *pSrcB points to the second input sequence.
\r
4691 * @param[in] srcBLen length of the second input sequence.
\r
4692 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4696 void arm_correlate_q7(
\r
4705 * @brief Instance structure for the floating-point sparse FIR filter.
\r
4709 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4710 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4711 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4712 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4713 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4714 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4715 } arm_fir_sparse_instance_f32;
\r
4718 * @brief Instance structure for the Q31 sparse FIR filter.
\r
4723 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4724 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4725 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4726 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4727 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4728 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4729 } arm_fir_sparse_instance_q31;
\r
4732 * @brief Instance structure for the Q15 sparse FIR filter.
\r
4737 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4738 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4739 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4740 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4741 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4742 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4743 } arm_fir_sparse_instance_q15;
\r
4746 * @brief Instance structure for the Q7 sparse FIR filter.
\r
4751 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4752 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4753 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4754 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4755 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4756 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4757 } arm_fir_sparse_instance_q7;
\r
4760 * @brief Processing function for the floating-point sparse FIR filter.
\r
4761 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
\r
4762 * @param[in] *pSrc points to the block of input data.
\r
4763 * @param[out] *pDst points to the block of output data
\r
4764 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4765 * @param[in] blockSize number of input samples to process per call.
\r
4769 void arm_fir_sparse_f32(
\r
4770 arm_fir_sparse_instance_f32 * S,
\r
4773 float32_t * pScratchIn,
\r
4774 uint32_t blockSize);
\r
4777 * @brief Initialization function for the floating-point sparse FIR filter.
\r
4778 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
\r
4779 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4780 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4781 * @param[in] *pState points to the state buffer.
\r
4782 * @param[in] *pTapDelay points to the array of offset times.
\r
4783 * @param[in] maxDelay maximum offset time supported.
\r
4784 * @param[in] blockSize number of samples that will be processed per block.
\r
4788 void arm_fir_sparse_init_f32(
\r
4789 arm_fir_sparse_instance_f32 * S,
\r
4791 float32_t * pCoeffs,
\r
4792 float32_t * pState,
\r
4793 int32_t * pTapDelay,
\r
4794 uint16_t maxDelay,
\r
4795 uint32_t blockSize);
\r
4798 * @brief Processing function for the Q31 sparse FIR filter.
\r
4799 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
\r
4800 * @param[in] *pSrc points to the block of input data.
\r
4801 * @param[out] *pDst points to the block of output data
\r
4802 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4803 * @param[in] blockSize number of input samples to process per call.
\r
4807 void arm_fir_sparse_q31(
\r
4808 arm_fir_sparse_instance_q31 * S,
\r
4811 q31_t * pScratchIn,
\r
4812 uint32_t blockSize);
\r
4815 * @brief Initialization function for the Q31 sparse FIR filter.
\r
4816 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
\r
4817 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4818 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4819 * @param[in] *pState points to the state buffer.
\r
4820 * @param[in] *pTapDelay points to the array of offset times.
\r
4821 * @param[in] maxDelay maximum offset time supported.
\r
4822 * @param[in] blockSize number of samples that will be processed per block.
\r
4826 void arm_fir_sparse_init_q31(
\r
4827 arm_fir_sparse_instance_q31 * S,
\r
4831 int32_t * pTapDelay,
\r
4832 uint16_t maxDelay,
\r
4833 uint32_t blockSize);
\r
4836 * @brief Processing function for the Q15 sparse FIR filter.
\r
4837 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
\r
4838 * @param[in] *pSrc points to the block of input data.
\r
4839 * @param[out] *pDst points to the block of output data
\r
4840 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4841 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4842 * @param[in] blockSize number of input samples to process per call.
\r
4846 void arm_fir_sparse_q15(
\r
4847 arm_fir_sparse_instance_q15 * S,
\r
4850 q15_t * pScratchIn,
\r
4851 q31_t * pScratchOut,
\r
4852 uint32_t blockSize);
\r
4856 * @brief Initialization function for the Q15 sparse FIR filter.
\r
4857 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
\r
4858 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4859 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4860 * @param[in] *pState points to the state buffer.
\r
4861 * @param[in] *pTapDelay points to the array of offset times.
\r
4862 * @param[in] maxDelay maximum offset time supported.
\r
4863 * @param[in] blockSize number of samples that will be processed per block.
\r
4867 void arm_fir_sparse_init_q15(
\r
4868 arm_fir_sparse_instance_q15 * S,
\r
4872 int32_t * pTapDelay,
\r
4873 uint16_t maxDelay,
\r
4874 uint32_t blockSize);
\r
4877 * @brief Processing function for the Q7 sparse FIR filter.
\r
4878 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
\r
4879 * @param[in] *pSrc points to the block of input data.
\r
4880 * @param[out] *pDst points to the block of output data
\r
4881 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4882 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4883 * @param[in] blockSize number of input samples to process per call.
\r
4887 void arm_fir_sparse_q7(
\r
4888 arm_fir_sparse_instance_q7 * S,
\r
4891 q7_t * pScratchIn,
\r
4892 q31_t * pScratchOut,
\r
4893 uint32_t blockSize);
\r
4896 * @brief Initialization function for the Q7 sparse FIR filter.
\r
4897 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
\r
4898 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4899 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4900 * @param[in] *pState points to the state buffer.
\r
4901 * @param[in] *pTapDelay points to the array of offset times.
\r
4902 * @param[in] maxDelay maximum offset time supported.
\r
4903 * @param[in] blockSize number of samples that will be processed per block.
\r
4907 void arm_fir_sparse_init_q7(
\r
4908 arm_fir_sparse_instance_q7 * S,
\r
4912 int32_t * pTapDelay,
\r
4913 uint16_t maxDelay,
\r
4914 uint32_t blockSize);
\r
4918 * @brief Floating-point sin_cos function.
\r
4919 * @param[in] theta input value in degrees
\r
4920 * @param[out] *pSinVal points to the processed sine output.
\r
4921 * @param[out] *pCosVal points to the processed cos output.
\r
4925 void arm_sin_cos_f32(
\r
4927 float32_t * pSinVal,
\r
4928 float32_t * pCcosVal);
\r
4931 * @brief Q31 sin_cos function.
\r
4932 * @param[in] theta scaled input value in degrees
\r
4933 * @param[out] *pSinVal points to the processed sine output.
\r
4934 * @param[out] *pCosVal points to the processed cosine output.
\r
4938 void arm_sin_cos_q31(
\r
4945 * @brief Floating-point complex conjugate.
\r
4946 * @param[in] *pSrc points to the input vector
\r
4947 * @param[out] *pDst points to the output vector
\r
4948 * @param[in] numSamples number of complex samples in each vector
\r
4952 void arm_cmplx_conj_f32(
\r
4955 uint32_t numSamples);
\r
4958 * @brief Q31 complex conjugate.
\r
4959 * @param[in] *pSrc points to the input vector
\r
4960 * @param[out] *pDst points to the output vector
\r
4961 * @param[in] numSamples number of complex samples in each vector
\r
4965 void arm_cmplx_conj_q31(
\r
4968 uint32_t numSamples);
\r
4971 * @brief Q15 complex conjugate.
\r
4972 * @param[in] *pSrc points to the input vector
\r
4973 * @param[out] *pDst points to the output vector
\r
4974 * @param[in] numSamples number of complex samples in each vector
\r
4978 void arm_cmplx_conj_q15(
\r
4981 uint32_t numSamples);
\r
4986 * @brief Floating-point complex magnitude squared
\r
4987 * @param[in] *pSrc points to the complex input vector
\r
4988 * @param[out] *pDst points to the real output vector
\r
4989 * @param[in] numSamples number of complex samples in the input vector
\r
4993 void arm_cmplx_mag_squared_f32(
\r
4996 uint32_t numSamples);
\r
4999 * @brief Q31 complex magnitude squared
\r
5000 * @param[in] *pSrc points to the complex input vector
\r
5001 * @param[out] *pDst points to the real output vector
\r
5002 * @param[in] numSamples number of complex samples in the input vector
\r
5006 void arm_cmplx_mag_squared_q31(
\r
5009 uint32_t numSamples);
\r
5012 * @brief Q15 complex magnitude squared
\r
5013 * @param[in] *pSrc points to the complex input vector
\r
5014 * @param[out] *pDst points to the real output vector
\r
5015 * @param[in] numSamples number of complex samples in the input vector
\r
5019 void arm_cmplx_mag_squared_q15(
\r
5022 uint32_t numSamples);
\r
5026 * @ingroup groupController
\r
5030 * @defgroup PID PID Motor Control
\r
5032 * A Proportional Integral Derivative (PID) controller is a generic feedback control
\r
5033 * loop mechanism widely used in industrial control systems.
\r
5034 * A PID controller is the most commonly used type of feedback controller.
\r
5036 * This set of functions implements (PID) controllers
\r
5037 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
\r
5038 * of data and each call to the function returns a single processed value.
\r
5039 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
\r
5040 * is the input sample value. The functions return the output value.
\r
5044 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
\r
5045 * A0 = Kp + Ki + Kd
\r
5046 * A1 = (-Kp ) - (2 * Kd )
\r
5050 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
\r
5053 * \image html PID.gif "Proportional Integral Derivative Controller"
\r
5056 * The PID controller calculates an "error" value as the difference between
\r
5057 * the measured output and the reference input.
\r
5058 * The controller attempts to minimize the error by adjusting the process control inputs.
\r
5059 * The proportional value determines the reaction to the current error,
\r
5060 * the integral value determines the reaction based on the sum of recent errors,
\r
5061 * and the derivative value determines the reaction based on the rate at which the error has been changing.
\r
5063 * \par Instance Structure
\r
5064 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
\r
5065 * A separate instance structure must be defined for each PID Controller.
\r
5066 * There are separate instance structure declarations for each of the 3 supported data types.
\r
5068 * \par Reset Functions
\r
5069 * There is also an associated reset function for each data type which clears the state array.
\r
5071 * \par Initialization Functions
\r
5072 * There is also an associated initialization function for each data type.
\r
5073 * The initialization function performs the following operations:
\r
5074 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
\r
5075 * - Zeros out the values in the state buffer.
\r
5078 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
\r
5080 * \par Fixed-Point Behavior
\r
5081 * Care must be taken when using the fixed-point versions of the PID Controller functions.
\r
5082 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
\r
5083 * Refer to the function specific documentation below for usage guidelines.
\r
5092 * @brief Process function for the floating-point PID Control.
\r
5093 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
5094 * @param[in] in input sample to process
\r
5095 * @return out processed output sample.
\r
5099 static __INLINE float32_t arm_pid_f32(
\r
5100 arm_pid_instance_f32 * S,
\r
5105 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
\r
5106 out = (S->A0 * in) +
\r
5107 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
\r
5109 /* Update state */
\r
5110 S->state[1] = S->state[0];
\r
5112 S->state[2] = out;
\r
5114 /* return to application */
\r
5120 * @brief Process function for the Q31 PID Control.
\r
5121 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
5122 * @param[in] in input sample to process
\r
5123 * @return out processed output sample.
\r
5125 * <b>Scaling and Overflow Behavior:</b>
\r
5127 * The function is implemented using an internal 64-bit accumulator.
\r
5128 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
\r
5129 * Thus, if the accumulator result overflows it wraps around rather than clip.
\r
5130 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
\r
5131 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
\r
5134 static __INLINE q31_t arm_pid_q31(
\r
5135 arm_pid_instance_q31 * S,
\r
5141 /* acc = A0 * x[n] */
\r
5142 acc = (q63_t) S->A0 * in;
\r
5144 /* acc += A1 * x[n-1] */
\r
5145 acc += (q63_t) S->A1 * S->state[0];
\r
5147 /* acc += A2 * x[n-2] */
\r
5148 acc += (q63_t) S->A2 * S->state[1];
\r
5150 /* convert output to 1.31 format to add y[n-1] */
\r
5151 out = (q31_t) (acc >> 31u);
\r
5153 /* out += y[n-1] */
\r
5154 out += S->state[2];
\r
5156 /* Update state */
\r
5157 S->state[1] = S->state[0];
\r
5159 S->state[2] = out;
\r
5161 /* return to application */
\r
5167 * @brief Process function for the Q15 PID Control.
\r
5168 * @param[in,out] *S points to an instance of the Q15 PID Control structure
\r
5169 * @param[in] in input sample to process
\r
5170 * @return out processed output sample.
\r
5172 * <b>Scaling and Overflow Behavior:</b>
\r
5174 * The function is implemented using a 64-bit internal accumulator.
\r
5175 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
\r
5176 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
\r
5177 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
\r
5178 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
\r
5179 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
\r
5182 static __INLINE q15_t arm_pid_q15(
\r
5183 arm_pid_instance_q15 * S,
\r
5189 #ifndef ARM_MATH_CM0_FAMILY
\r
5190 __SIMD32_TYPE *vstate;
\r
5192 /* Implementation of PID controller */
\r
5194 /* acc = A0 * x[n] */
\r
5195 acc = (q31_t) __SMUAD(S->A0, in);
\r
5197 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5198 vstate = __SIMD32_CONST(S->state);
\r
5199 acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
\r
5202 /* acc = A0 * x[n] */
\r
5203 acc = ((q31_t) S->A0) * in;
\r
5205 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5206 acc += (q31_t) S->A1 * S->state[0];
\r
5207 acc += (q31_t) S->A2 * S->state[1];
\r
5211 /* acc += y[n-1] */
\r
5212 acc += (q31_t) S->state[2] << 15;
\r
5214 /* saturate the output */
\r
5215 out = (q15_t) (__SSAT((acc >> 15), 16));
\r
5217 /* Update state */
\r
5218 S->state[1] = S->state[0];
\r
5220 S->state[2] = out;
\r
5222 /* return to application */
\r
5228 * @} end of PID group
\r
5233 * @brief Floating-point matrix inverse.
\r
5234 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5235 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5236 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5237 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5240 arm_status arm_mat_inverse_f32(
\r
5241 const arm_matrix_instance_f32 * src,
\r
5242 arm_matrix_instance_f32 * dst);
\r
5246 * @brief Floating-point matrix inverse.
\r
5247 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5248 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5249 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5250 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5253 arm_status arm_mat_inverse_f64(
\r
5254 const arm_matrix_instance_f64 * src,
\r
5255 arm_matrix_instance_f64 * dst);
\r
5260 * @ingroup groupController
\r
5265 * @defgroup clarke Vector Clarke Transform
\r
5266 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
\r
5267 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
\r
5268 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
\r
5269 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
\r
5270 * \image html clarke.gif Stator current space vector and its components in (a,b).
\r
5271 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
\r
5272 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
\r
5274 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5275 * The library provides separate functions for Q31 and floating-point data types.
\r
5277 * \image html clarkeFormula.gif
\r
5278 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
\r
5279 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
\r
5280 * \par Fixed-Point Behavior
\r
5281 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5282 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5283 * Refer to the function specific documentation below for usage guidelines.
\r
5287 * @addtogroup clarke
\r
5293 * @brief Floating-point Clarke transform
\r
5294 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5295 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5296 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5297 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5301 static __INLINE void arm_clarke_f32(
\r
5304 float32_t * pIalpha,
\r
5305 float32_t * pIbeta)
\r
5307 /* Calculate pIalpha using the equation, pIalpha = Ia */
\r
5310 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
\r
5312 ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
\r
5317 * @brief Clarke transform for Q31 version
\r
5318 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5319 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5320 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5321 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5324 * <b>Scaling and Overflow Behavior:</b>
\r
5326 * The function is implemented using an internal 32-bit accumulator.
\r
5327 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5328 * There is saturation on the addition, hence there is no risk of overflow.
\r
5331 static __INLINE void arm_clarke_q31(
\r
5337 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5339 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
\r
5342 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
\r
5343 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
\r
5345 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
\r
5346 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
\r
5348 /* pIbeta is calculated by adding the intermediate products */
\r
5349 *pIbeta = __QADD(product1, product2);
\r
5353 * @} end of clarke group
\r
5357 * @brief Converts the elements of the Q7 vector to Q31 vector.
\r
5358 * @param[in] *pSrc input pointer
\r
5359 * @param[out] *pDst output pointer
\r
5360 * @param[in] blockSize number of samples to process
\r
5363 void arm_q7_to_q31(
\r
5366 uint32_t blockSize);
\r
5372 * @ingroup groupController
\r
5376 * @defgroup inv_clarke Vector Inverse Clarke Transform
\r
5377 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
\r
5379 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5380 * The library provides separate functions for Q31 and floating-point data types.
\r
5382 * \image html clarkeInvFormula.gif
\r
5383 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
\r
5384 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
\r
5385 * \par Fixed-Point Behavior
\r
5386 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5387 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5388 * Refer to the function specific documentation below for usage guidelines.
\r
5392 * @addtogroup inv_clarke
\r
5397 * @brief Floating-point Inverse Clarke transform
\r
5398 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5399 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5400 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5401 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5406 static __INLINE void arm_inv_clarke_f32(
\r
5412 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5415 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
\r
5416 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
\r
5421 * @brief Inverse Clarke transform for Q31 version
\r
5422 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5423 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5424 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5425 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5428 * <b>Scaling and Overflow Behavior:</b>
\r
5430 * The function is implemented using an internal 32-bit accumulator.
\r
5431 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5432 * There is saturation on the subtraction, hence there is no risk of overflow.
\r
5435 static __INLINE void arm_inv_clarke_q31(
\r
5441 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5443 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5446 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
\r
5447 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
\r
5449 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
\r
5450 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
\r
5452 /* pIb is calculated by subtracting the products */
\r
5453 *pIb = __QSUB(product2, product1);
\r
5458 * @} end of inv_clarke group
\r
5462 * @brief Converts the elements of the Q7 vector to Q15 vector.
\r
5463 * @param[in] *pSrc input pointer
\r
5464 * @param[out] *pDst output pointer
\r
5465 * @param[in] blockSize number of samples to process
\r
5468 void arm_q7_to_q15(
\r
5471 uint32_t blockSize);
\r
5476 * @ingroup groupController
\r
5480 * @defgroup park Vector Park Transform
\r
5482 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
\r
5483 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
\r
5484 * from the stationary to the moving reference frame and control the spatial relationship between
\r
5485 * the stator vector current and rotor flux vector.
\r
5486 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
\r
5487 * current vector and the relationship from the two reference frames:
\r
5488 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
\r
5490 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5491 * The library provides separate functions for Q31 and floating-point data types.
\r
5493 * \image html parkFormula.gif
\r
5494 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
\r
5495 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5496 * cosine and sine values of theta (rotor flux position).
\r
5497 * \par Fixed-Point Behavior
\r
5498 * Care must be taken when using the Q31 version of the Park transform.
\r
5499 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5500 * Refer to the function specific documentation below for usage guidelines.
\r
5504 * @addtogroup park
\r
5509 * @brief Floating-point Park transform
\r
5510 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5511 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5512 * @param[out] *pId points to output rotor reference frame d
\r
5513 * @param[out] *pIq points to output rotor reference frame q
\r
5514 * @param[in] sinVal sine value of rotation angle theta
\r
5515 * @param[in] cosVal cosine value of rotation angle theta
\r
5518 * The function implements the forward Park transform.
\r
5522 static __INLINE void arm_park_f32(
\r
5530 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
\r
5531 *pId = Ialpha * cosVal + Ibeta * sinVal;
\r
5533 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
\r
5534 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
\r
5539 * @brief Park transform for Q31 version
\r
5540 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5541 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5542 * @param[out] *pId points to output rotor reference frame d
\r
5543 * @param[out] *pIq points to output rotor reference frame q
\r
5544 * @param[in] sinVal sine value of rotation angle theta
\r
5545 * @param[in] cosVal cosine value of rotation angle theta
\r
5548 * <b>Scaling and Overflow Behavior:</b>
\r
5550 * The function is implemented using an internal 32-bit accumulator.
\r
5551 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5552 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
\r
5556 static __INLINE void arm_park_q31(
\r
5564 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5565 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5567 /* Intermediate product is calculated by (Ialpha * cosVal) */
\r
5568 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
\r
5570 /* Intermediate product is calculated by (Ibeta * sinVal) */
\r
5571 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
\r
5574 /* Intermediate product is calculated by (Ialpha * sinVal) */
\r
5575 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
\r
5577 /* Intermediate product is calculated by (Ibeta * cosVal) */
\r
5578 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
\r
5580 /* Calculate pId by adding the two intermediate products 1 and 2 */
\r
5581 *pId = __QADD(product1, product2);
\r
5583 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
\r
5584 *pIq = __QSUB(product4, product3);
\r
5588 * @} end of park group
\r
5592 * @brief Converts the elements of the Q7 vector to floating-point vector.
\r
5593 * @param[in] *pSrc is input pointer
\r
5594 * @param[out] *pDst is output pointer
\r
5595 * @param[in] blockSize is the number of samples to process
\r
5598 void arm_q7_to_float(
\r
5601 uint32_t blockSize);
\r
5605 * @ingroup groupController
\r
5609 * @defgroup inv_park Vector Inverse Park transform
\r
5610 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
\r
5612 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5613 * The library provides separate functions for Q31 and floating-point data types.
\r
5615 * \image html parkInvFormula.gif
\r
5616 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
\r
5617 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5618 * cosine and sine values of theta (rotor flux position).
\r
5619 * \par Fixed-Point Behavior
\r
5620 * Care must be taken when using the Q31 version of the Park transform.
\r
5621 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5622 * Refer to the function specific documentation below for usage guidelines.
\r
5626 * @addtogroup inv_park
\r
5631 * @brief Floating-point Inverse Park transform
\r
5632 * @param[in] Id input coordinate of rotor reference frame d
\r
5633 * @param[in] Iq input coordinate of rotor reference frame q
\r
5634 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5635 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5636 * @param[in] sinVal sine value of rotation angle theta
\r
5637 * @param[in] cosVal cosine value of rotation angle theta
\r
5641 static __INLINE void arm_inv_park_f32(
\r
5644 float32_t * pIalpha,
\r
5645 float32_t * pIbeta,
\r
5649 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
\r
5650 *pIalpha = Id * cosVal - Iq * sinVal;
\r
5652 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
\r
5653 *pIbeta = Id * sinVal + Iq * cosVal;
\r
5659 * @brief Inverse Park transform for Q31 version
\r
5660 * @param[in] Id input coordinate of rotor reference frame d
\r
5661 * @param[in] Iq input coordinate of rotor reference frame q
\r
5662 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5663 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5664 * @param[in] sinVal sine value of rotation angle theta
\r
5665 * @param[in] cosVal cosine value of rotation angle theta
\r
5668 * <b>Scaling and Overflow Behavior:</b>
\r
5670 * The function is implemented using an internal 32-bit accumulator.
\r
5671 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5672 * There is saturation on the addition, hence there is no risk of overflow.
\r
5676 static __INLINE void arm_inv_park_q31(
\r
5684 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5685 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5687 /* Intermediate product is calculated by (Id * cosVal) */
\r
5688 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
\r
5690 /* Intermediate product is calculated by (Iq * sinVal) */
\r
5691 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
\r
5694 /* Intermediate product is calculated by (Id * sinVal) */
\r
5695 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
\r
5697 /* Intermediate product is calculated by (Iq * cosVal) */
\r
5698 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
\r
5700 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
\r
5701 *pIalpha = __QSUB(product1, product2);
\r
5703 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
\r
5704 *pIbeta = __QADD(product4, product3);
\r
5709 * @} end of Inverse park group
\r
5714 * @brief Converts the elements of the Q31 vector to floating-point vector.
\r
5715 * @param[in] *pSrc is input pointer
\r
5716 * @param[out] *pDst is output pointer
\r
5717 * @param[in] blockSize is the number of samples to process
\r
5720 void arm_q31_to_float(
\r
5723 uint32_t blockSize);
\r
5726 * @ingroup groupInterpolation
\r
5730 * @defgroup LinearInterpolate Linear Interpolation
\r
5732 * Linear interpolation is a method of curve fitting using linear polynomials.
\r
5733 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
\r
5736 * \image html LinearInterp.gif "Linear interpolation"
\r
5739 * A Linear Interpolate function calculates an output value(y), for the input(x)
\r
5740 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
\r
5744 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
\r
5745 * where x0, x1 are nearest values of input x
\r
5746 * y0, y1 are nearest values to output y
\r
5750 * This set of functions implements Linear interpolation process
\r
5751 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
\r
5752 * sample of data and each call to the function returns a single processed value.
\r
5753 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
\r
5754 * <code>x</code> is the input sample value. The functions returns the output value.
\r
5757 * if x is outside of the table boundary, Linear interpolation returns first value of the table
\r
5758 * if x is below input range and returns last value of table if x is above range.
\r
5762 * @addtogroup LinearInterpolate
\r
5767 * @brief Process function for the floating-point Linear Interpolation Function.
\r
5768 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
\r
5769 * @param[in] x input sample to process
\r
5770 * @return y processed output sample.
\r
5774 static __INLINE float32_t arm_linear_interp_f32(
\r
5775 arm_linear_interp_instance_f32 * S,
\r
5780 float32_t x0, x1; /* Nearest input values */
\r
5781 float32_t y0, y1; /* Nearest output values */
\r
5782 float32_t xSpacing = S->xSpacing; /* spacing between input values */
\r
5783 int32_t i; /* Index variable */
\r
5784 float32_t *pYData = S->pYData; /* pointer to output table */
\r
5786 /* Calculation of index */
\r
5787 i = (int32_t) ((x - S->x1) / xSpacing);
\r
5791 /* Iniatilize output for below specified range as least output value of table */
\r
5794 else if((uint32_t)i >= S->nValues)
\r
5796 /* Iniatilize output for above specified range as last output value of table */
\r
5797 y = pYData[S->nValues - 1];
\r
5801 /* Calculation of nearest input values */
\r
5802 x0 = S->x1 + i * xSpacing;
\r
5803 x1 = S->x1 + (i + 1) * xSpacing;
\r
5805 /* Read of nearest output values */
\r
5807 y1 = pYData[i + 1];
\r
5809 /* Calculation of output */
\r
5810 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
\r
5814 /* returns output value */
\r
5820 * @brief Process function for the Q31 Linear Interpolation Function.
\r
5821 * @param[in] *pYData pointer to Q31 Linear Interpolation table
\r
5822 * @param[in] x input sample to process
\r
5823 * @param[in] nValues number of table values
\r
5824 * @return y processed output sample.
\r
5827 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5828 * This function can support maximum of table size 2^12.
\r
5833 static __INLINE q31_t arm_linear_interp_q31(
\r
5838 q31_t y; /* output */
\r
5839 q31_t y0, y1; /* Nearest output values */
\r
5840 q31_t fract; /* fractional part */
\r
5841 int32_t index; /* Index to read nearest output values */
\r
5843 /* Input is in 12.20 format */
\r
5844 /* 12 bits for the table index */
\r
5845 /* Index value calculation */
\r
5846 index = ((x & 0xFFF00000) >> 20);
\r
5848 if(index >= (int32_t)(nValues - 1))
\r
5850 return (pYData[nValues - 1]);
\r
5852 else if(index < 0)
\r
5854 return (pYData[0]);
\r
5859 /* 20 bits for the fractional part */
\r
5860 /* shift left by 11 to keep fract in 1.31 format */
\r
5861 fract = (x & 0x000FFFFF) << 11;
\r
5863 /* Read two nearest output values from the index in 1.31(q31) format */
\r
5864 y0 = pYData[index];
\r
5865 y1 = pYData[index + 1u];
\r
5867 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
\r
5868 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
\r
5870 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
\r
5871 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
\r
5873 /* Convert y to 1.31 format */
\r
5882 * @brief Process function for the Q15 Linear Interpolation Function.
\r
5883 * @param[in] *pYData pointer to Q15 Linear Interpolation table
\r
5884 * @param[in] x input sample to process
\r
5885 * @param[in] nValues number of table values
\r
5886 * @return y processed output sample.
\r
5889 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5890 * This function can support maximum of table size 2^12.
\r
5895 static __INLINE q15_t arm_linear_interp_q15(
\r
5900 q63_t y; /* output */
\r
5901 q15_t y0, y1; /* Nearest output values */
\r
5902 q31_t fract; /* fractional part */
\r
5903 int32_t index; /* Index to read nearest output values */
\r
5905 /* Input is in 12.20 format */
\r
5906 /* 12 bits for the table index */
\r
5907 /* Index value calculation */
\r
5908 index = ((x & 0xFFF00000) >> 20u);
\r
5910 if(index >= (int32_t)(nValues - 1))
\r
5912 return (pYData[nValues - 1]);
\r
5914 else if(index < 0)
\r
5916 return (pYData[0]);
\r
5920 /* 20 bits for the fractional part */
\r
5921 /* fract is in 12.20 format */
\r
5922 fract = (x & 0x000FFFFF);
\r
5924 /* Read two nearest output values from the index */
\r
5925 y0 = pYData[index];
\r
5926 y1 = pYData[index + 1u];
\r
5928 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
\r
5929 y = ((q63_t) y0 * (0xFFFFF - fract));
\r
5931 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
\r
5932 y += ((q63_t) y1 * (fract));
\r
5934 /* convert y to 1.15 format */
\r
5943 * @brief Process function for the Q7 Linear Interpolation Function.
\r
5944 * @param[in] *pYData pointer to Q7 Linear Interpolation table
\r
5945 * @param[in] x input sample to process
\r
5946 * @param[in] nValues number of table values
\r
5947 * @return y processed output sample.
\r
5950 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5951 * This function can support maximum of table size 2^12.
\r
5955 static __INLINE q7_t arm_linear_interp_q7(
\r
5960 q31_t y; /* output */
\r
5961 q7_t y0, y1; /* Nearest output values */
\r
5962 q31_t fract; /* fractional part */
\r
5963 uint32_t index; /* Index to read nearest output values */
\r
5965 /* Input is in 12.20 format */
\r
5966 /* 12 bits for the table index */
\r
5967 /* Index value calculation */
\r
5970 return (pYData[0]);
\r
5972 index = (x >> 20) & 0xfff;
\r
5975 if(index >= (nValues - 1))
\r
5977 return (pYData[nValues - 1]);
\r
5982 /* 20 bits for the fractional part */
\r
5983 /* fract is in 12.20 format */
\r
5984 fract = (x & 0x000FFFFF);
\r
5986 /* Read two nearest output values from the index and are in 1.7(q7) format */
\r
5987 y0 = pYData[index];
\r
5988 y1 = pYData[index + 1u];
\r
5990 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
\r
5991 y = ((y0 * (0xFFFFF - fract)));
\r
5993 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
\r
5994 y += (y1 * fract);
\r
5996 /* convert y to 1.7(q7) format */
\r
5997 return (y >> 20u);
\r
6003 * @} end of LinearInterpolate group
\r
6007 * @brief Fast approximation to the trigonometric sine function for floating-point data.
\r
6008 * @param[in] x input value in radians.
\r
6012 float32_t arm_sin_f32(
\r
6016 * @brief Fast approximation to the trigonometric sine function for Q31 data.
\r
6017 * @param[in] x Scaled input value in radians.
\r
6021 q31_t arm_sin_q31(
\r
6025 * @brief Fast approximation to the trigonometric sine function for Q15 data.
\r
6026 * @param[in] x Scaled input value in radians.
\r
6030 q15_t arm_sin_q15(
\r
6034 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
\r
6035 * @param[in] x input value in radians.
\r
6039 float32_t arm_cos_f32(
\r
6043 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
\r
6044 * @param[in] x Scaled input value in radians.
\r
6048 q31_t arm_cos_q31(
\r
6052 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
\r
6053 * @param[in] x Scaled input value in radians.
\r
6057 q15_t arm_cos_q15(
\r
6062 * @ingroup groupFastMath
\r
6067 * @defgroup SQRT Square Root
\r
6069 * Computes the square root of a number.
\r
6070 * There are separate functions for Q15, Q31, and floating-point data types.
\r
6071 * The square root function is computed using the Newton-Raphson algorithm.
\r
6072 * This is an iterative algorithm of the form:
\r
6074 * x1 = x0 - f(x0)/f'(x0)
\r
6076 * where <code>x1</code> is the current estimate,
\r
6077 * <code>x0</code> is the previous estimate, and
\r
6078 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
\r
6079 * For the square root function, the algorithm reduces to:
\r
6081 * x0 = in/2 [initial guess]
\r
6082 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
\r
6088 * @addtogroup SQRT
\r
6093 * @brief Floating-point square root function.
\r
6094 * @param[in] in input value.
\r
6095 * @param[out] *pOut square root of input value.
\r
6096 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6097 * <code>in</code> is negative value and returns zero output for negative values.
\r
6100 static __INLINE arm_status arm_sqrt_f32(
\r
6108 #if (__FPU_USED == 1) && defined ( __CC_ARM )
\r
6109 *pOut = __sqrtf(in);
\r
6111 *pOut = sqrtf(in);
\r
6114 return (ARM_MATH_SUCCESS);
\r
6119 return (ARM_MATH_ARGUMENT_ERROR);
\r
6126 * @brief Q31 square root function.
\r
6127 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
\r
6128 * @param[out] *pOut square root of input value.
\r
6129 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6130 * <code>in</code> is negative value and returns zero output for negative values.
\r
6132 arm_status arm_sqrt_q31(
\r
6137 * @brief Q15 square root function.
\r
6138 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
\r
6139 * @param[out] *pOut square root of input value.
\r
6140 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6141 * <code>in</code> is negative value and returns zero output for negative values.
\r
6143 arm_status arm_sqrt_q15(
\r
6148 * @} end of SQRT group
\r
6157 * @brief floating-point Circular write function.
\r
6160 static __INLINE void arm_circularWrite_f32(
\r
6161 int32_t * circBuffer,
\r
6163 uint16_t * writeOffset,
\r
6164 int32_t bufferInc,
\r
6165 const int32_t * src,
\r
6167 uint32_t blockSize)
\r
6172 /* Copy the value of Index pointer that points
\r
6173 * to the current location where the input samples to be copied */
\r
6174 wOffset = *writeOffset;
\r
6176 /* Loop over the blockSize */
\r
6181 /* copy the input sample to the circular buffer */
\r
6182 circBuffer[wOffset] = *src;
\r
6184 /* Update the input pointer */
\r
6187 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6188 wOffset += bufferInc;
\r
6192 /* Decrement the loop counter */
\r
6196 /* Update the index pointer */
\r
6197 *writeOffset = wOffset;
\r
6203 * @brief floating-point Circular Read function.
\r
6205 static __INLINE void arm_circularRead_f32(
\r
6206 int32_t * circBuffer,
\r
6208 int32_t * readOffset,
\r
6209 int32_t bufferInc,
\r
6211 int32_t * dst_base,
\r
6212 int32_t dst_length,
\r
6214 uint32_t blockSize)
\r
6217 int32_t rOffset, dst_end;
\r
6219 /* Copy the value of Index pointer that points
\r
6220 * to the current location from where the input samples to be read */
\r
6221 rOffset = *readOffset;
\r
6222 dst_end = (int32_t) (dst_base + dst_length);
\r
6224 /* Loop over the blockSize */
\r
6229 /* copy the sample from the circular buffer to the destination buffer */
\r
6230 *dst = circBuffer[rOffset];
\r
6232 /* Update the input pointer */
\r
6235 if(dst == (int32_t *) dst_end)
\r
6240 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6241 rOffset += bufferInc;
\r
6248 /* Decrement the loop counter */
\r
6252 /* Update the index pointer */
\r
6253 *readOffset = rOffset;
\r
6257 * @brief Q15 Circular write function.
\r
6260 static __INLINE void arm_circularWrite_q15(
\r
6261 q15_t * circBuffer,
\r
6263 uint16_t * writeOffset,
\r
6264 int32_t bufferInc,
\r
6265 const q15_t * src,
\r
6267 uint32_t blockSize)
\r
6272 /* Copy the value of Index pointer that points
\r
6273 * to the current location where the input samples to be copied */
\r
6274 wOffset = *writeOffset;
\r
6276 /* Loop over the blockSize */
\r
6281 /* copy the input sample to the circular buffer */
\r
6282 circBuffer[wOffset] = *src;
\r
6284 /* Update the input pointer */
\r
6287 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6288 wOffset += bufferInc;
\r
6292 /* Decrement the loop counter */
\r
6296 /* Update the index pointer */
\r
6297 *writeOffset = wOffset;
\r
6303 * @brief Q15 Circular Read function.
\r
6305 static __INLINE void arm_circularRead_q15(
\r
6306 q15_t * circBuffer,
\r
6308 int32_t * readOffset,
\r
6309 int32_t bufferInc,
\r
6312 int32_t dst_length,
\r
6314 uint32_t blockSize)
\r
6317 int32_t rOffset, dst_end;
\r
6319 /* Copy the value of Index pointer that points
\r
6320 * to the current location from where the input samples to be read */
\r
6321 rOffset = *readOffset;
\r
6323 dst_end = (int32_t) (dst_base + dst_length);
\r
6325 /* Loop over the blockSize */
\r
6330 /* copy the sample from the circular buffer to the destination buffer */
\r
6331 *dst = circBuffer[rOffset];
\r
6333 /* Update the input pointer */
\r
6336 if(dst == (q15_t *) dst_end)
\r
6341 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6342 rOffset += bufferInc;
\r
6349 /* Decrement the loop counter */
\r
6353 /* Update the index pointer */
\r
6354 *readOffset = rOffset;
\r
6359 * @brief Q7 Circular write function.
\r
6362 static __INLINE void arm_circularWrite_q7(
\r
6363 q7_t * circBuffer,
\r
6365 uint16_t * writeOffset,
\r
6366 int32_t bufferInc,
\r
6369 uint32_t blockSize)
\r
6374 /* Copy the value of Index pointer that points
\r
6375 * to the current location where the input samples to be copied */
\r
6376 wOffset = *writeOffset;
\r
6378 /* Loop over the blockSize */
\r
6383 /* copy the input sample to the circular buffer */
\r
6384 circBuffer[wOffset] = *src;
\r
6386 /* Update the input pointer */
\r
6389 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6390 wOffset += bufferInc;
\r
6394 /* Decrement the loop counter */
\r
6398 /* Update the index pointer */
\r
6399 *writeOffset = wOffset;
\r
6405 * @brief Q7 Circular Read function.
\r
6407 static __INLINE void arm_circularRead_q7(
\r
6408 q7_t * circBuffer,
\r
6410 int32_t * readOffset,
\r
6411 int32_t bufferInc,
\r
6414 int32_t dst_length,
\r
6416 uint32_t blockSize)
\r
6419 int32_t rOffset, dst_end;
\r
6421 /* Copy the value of Index pointer that points
\r
6422 * to the current location from where the input samples to be read */
\r
6423 rOffset = *readOffset;
\r
6425 dst_end = (int32_t) (dst_base + dst_length);
\r
6427 /* Loop over the blockSize */
\r
6432 /* copy the sample from the circular buffer to the destination buffer */
\r
6433 *dst = circBuffer[rOffset];
\r
6435 /* Update the input pointer */
\r
6438 if(dst == (q7_t *) dst_end)
\r
6443 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6444 rOffset += bufferInc;
\r
6451 /* Decrement the loop counter */
\r
6455 /* Update the index pointer */
\r
6456 *readOffset = rOffset;
\r
6461 * @brief Sum of the squares of the elements of a Q31 vector.
\r
6462 * @param[in] *pSrc is input pointer
\r
6463 * @param[in] blockSize is the number of samples to process
\r
6464 * @param[out] *pResult is output value.
\r
6468 void arm_power_q31(
\r
6470 uint32_t blockSize,
\r
6474 * @brief Sum of the squares of the elements of a floating-point vector.
\r
6475 * @param[in] *pSrc is input pointer
\r
6476 * @param[in] blockSize is the number of samples to process
\r
6477 * @param[out] *pResult is output value.
\r
6481 void arm_power_f32(
\r
6483 uint32_t blockSize,
\r
6484 float32_t * pResult);
\r
6487 * @brief Sum of the squares of the elements of a Q15 vector.
\r
6488 * @param[in] *pSrc is input pointer
\r
6489 * @param[in] blockSize is the number of samples to process
\r
6490 * @param[out] *pResult is output value.
\r
6494 void arm_power_q15(
\r
6496 uint32_t blockSize,
\r
6500 * @brief Sum of the squares of the elements of a Q7 vector.
\r
6501 * @param[in] *pSrc is input pointer
\r
6502 * @param[in] blockSize is the number of samples to process
\r
6503 * @param[out] *pResult is output value.
\r
6507 void arm_power_q7(
\r
6509 uint32_t blockSize,
\r
6513 * @brief Mean value of a Q7 vector.
\r
6514 * @param[in] *pSrc is input pointer
\r
6515 * @param[in] blockSize is the number of samples to process
\r
6516 * @param[out] *pResult is output value.
\r
6522 uint32_t blockSize,
\r
6526 * @brief Mean value of a Q15 vector.
\r
6527 * @param[in] *pSrc is input pointer
\r
6528 * @param[in] blockSize is the number of samples to process
\r
6529 * @param[out] *pResult is output value.
\r
6532 void arm_mean_q15(
\r
6534 uint32_t blockSize,
\r
6538 * @brief Mean value of a Q31 vector.
\r
6539 * @param[in] *pSrc is input pointer
\r
6540 * @param[in] blockSize is the number of samples to process
\r
6541 * @param[out] *pResult is output value.
\r
6544 void arm_mean_q31(
\r
6546 uint32_t blockSize,
\r
6550 * @brief Mean value of a floating-point vector.
\r
6551 * @param[in] *pSrc is input pointer
\r
6552 * @param[in] blockSize is the number of samples to process
\r
6553 * @param[out] *pResult is output value.
\r
6556 void arm_mean_f32(
\r
6558 uint32_t blockSize,
\r
6559 float32_t * pResult);
\r
6562 * @brief Variance of the elements of a floating-point vector.
\r
6563 * @param[in] *pSrc is input pointer
\r
6564 * @param[in] blockSize is the number of samples to process
\r
6565 * @param[out] *pResult is output value.
\r
6571 uint32_t blockSize,
\r
6572 float32_t * pResult);
\r
6575 * @brief Variance of the elements of a Q31 vector.
\r
6576 * @param[in] *pSrc is input pointer
\r
6577 * @param[in] blockSize is the number of samples to process
\r
6578 * @param[out] *pResult is output value.
\r
6584 uint32_t blockSize,
\r
6588 * @brief Variance of the elements of a Q15 vector.
\r
6589 * @param[in] *pSrc is input pointer
\r
6590 * @param[in] blockSize is the number of samples to process
\r
6591 * @param[out] *pResult is output value.
\r
6597 uint32_t blockSize,
\r
6601 * @brief Root Mean Square of the elements of a floating-point vector.
\r
6602 * @param[in] *pSrc is input pointer
\r
6603 * @param[in] blockSize is the number of samples to process
\r
6604 * @param[out] *pResult is output value.
\r
6610 uint32_t blockSize,
\r
6611 float32_t * pResult);
\r
6614 * @brief Root Mean Square of the elements of a Q31 vector.
\r
6615 * @param[in] *pSrc is input pointer
\r
6616 * @param[in] blockSize is the number of samples to process
\r
6617 * @param[out] *pResult is output value.
\r
6623 uint32_t blockSize,
\r
6627 * @brief Root Mean Square of the elements of a Q15 vector.
\r
6628 * @param[in] *pSrc is input pointer
\r
6629 * @param[in] blockSize is the number of samples to process
\r
6630 * @param[out] *pResult is output value.
\r
6636 uint32_t blockSize,
\r
6640 * @brief Standard deviation of the elements of a floating-point vector.
\r
6641 * @param[in] *pSrc is input pointer
\r
6642 * @param[in] blockSize is the number of samples to process
\r
6643 * @param[out] *pResult is output value.
\r
6649 uint32_t blockSize,
\r
6650 float32_t * pResult);
\r
6653 * @brief Standard deviation of the elements of a Q31 vector.
\r
6654 * @param[in] *pSrc is input pointer
\r
6655 * @param[in] blockSize is the number of samples to process
\r
6656 * @param[out] *pResult is output value.
\r
6662 uint32_t blockSize,
\r
6666 * @brief Standard deviation of the elements of a Q15 vector.
\r
6667 * @param[in] *pSrc is input pointer
\r
6668 * @param[in] blockSize is the number of samples to process
\r
6669 * @param[out] *pResult is output value.
\r
6675 uint32_t blockSize,
\r
6679 * @brief Floating-point complex magnitude
\r
6680 * @param[in] *pSrc points to the complex input vector
\r
6681 * @param[out] *pDst points to the real output vector
\r
6682 * @param[in] numSamples number of complex samples in the input vector
\r
6686 void arm_cmplx_mag_f32(
\r
6689 uint32_t numSamples);
\r
6692 * @brief Q31 complex magnitude
\r
6693 * @param[in] *pSrc points to the complex input vector
\r
6694 * @param[out] *pDst points to the real output vector
\r
6695 * @param[in] numSamples number of complex samples in the input vector
\r
6699 void arm_cmplx_mag_q31(
\r
6702 uint32_t numSamples);
\r
6705 * @brief Q15 complex magnitude
\r
6706 * @param[in] *pSrc points to the complex input vector
\r
6707 * @param[out] *pDst points to the real output vector
\r
6708 * @param[in] numSamples number of complex samples in the input vector
\r
6712 void arm_cmplx_mag_q15(
\r
6715 uint32_t numSamples);
\r
6718 * @brief Q15 complex dot product
\r
6719 * @param[in] *pSrcA points to the first input vector
\r
6720 * @param[in] *pSrcB points to the second input vector
\r
6721 * @param[in] numSamples number of complex samples in each vector
\r
6722 * @param[out] *realResult real part of the result returned here
\r
6723 * @param[out] *imagResult imaginary part of the result returned here
\r
6727 void arm_cmplx_dot_prod_q15(
\r
6730 uint32_t numSamples,
\r
6731 q31_t * realResult,
\r
6732 q31_t * imagResult);
\r
6735 * @brief Q31 complex dot product
\r
6736 * @param[in] *pSrcA points to the first input vector
\r
6737 * @param[in] *pSrcB points to the second input vector
\r
6738 * @param[in] numSamples number of complex samples in each vector
\r
6739 * @param[out] *realResult real part of the result returned here
\r
6740 * @param[out] *imagResult imaginary part of the result returned here
\r
6744 void arm_cmplx_dot_prod_q31(
\r
6747 uint32_t numSamples,
\r
6748 q63_t * realResult,
\r
6749 q63_t * imagResult);
\r
6752 * @brief Floating-point complex dot product
\r
6753 * @param[in] *pSrcA points to the first input vector
\r
6754 * @param[in] *pSrcB points to the second input vector
\r
6755 * @param[in] numSamples number of complex samples in each vector
\r
6756 * @param[out] *realResult real part of the result returned here
\r
6757 * @param[out] *imagResult imaginary part of the result returned here
\r
6761 void arm_cmplx_dot_prod_f32(
\r
6762 float32_t * pSrcA,
\r
6763 float32_t * pSrcB,
\r
6764 uint32_t numSamples,
\r
6765 float32_t * realResult,
\r
6766 float32_t * imagResult);
\r
6769 * @brief Q15 complex-by-real multiplication
\r
6770 * @param[in] *pSrcCmplx points to the complex input vector
\r
6771 * @param[in] *pSrcReal points to the real input vector
\r
6772 * @param[out] *pCmplxDst points to the complex output vector
\r
6773 * @param[in] numSamples number of samples in each vector
\r
6777 void arm_cmplx_mult_real_q15(
\r
6778 q15_t * pSrcCmplx,
\r
6780 q15_t * pCmplxDst,
\r
6781 uint32_t numSamples);
\r
6784 * @brief Q31 complex-by-real multiplication
\r
6785 * @param[in] *pSrcCmplx points to the complex input vector
\r
6786 * @param[in] *pSrcReal points to the real input vector
\r
6787 * @param[out] *pCmplxDst points to the complex output vector
\r
6788 * @param[in] numSamples number of samples in each vector
\r
6792 void arm_cmplx_mult_real_q31(
\r
6793 q31_t * pSrcCmplx,
\r
6795 q31_t * pCmplxDst,
\r
6796 uint32_t numSamples);
\r
6799 * @brief Floating-point complex-by-real multiplication
\r
6800 * @param[in] *pSrcCmplx points to the complex input vector
\r
6801 * @param[in] *pSrcReal points to the real input vector
\r
6802 * @param[out] *pCmplxDst points to the complex output vector
\r
6803 * @param[in] numSamples number of samples in each vector
\r
6807 void arm_cmplx_mult_real_f32(
\r
6808 float32_t * pSrcCmplx,
\r
6809 float32_t * pSrcReal,
\r
6810 float32_t * pCmplxDst,
\r
6811 uint32_t numSamples);
\r
6814 * @brief Minimum value of a Q7 vector.
\r
6815 * @param[in] *pSrc is input pointer
\r
6816 * @param[in] blockSize is the number of samples to process
\r
6817 * @param[out] *result is output pointer
\r
6818 * @param[in] index is the array index of the minimum value in the input buffer.
\r
6824 uint32_t blockSize,
\r
6826 uint32_t * index);
\r
6829 * @brief Minimum value of a Q15 vector.
\r
6830 * @param[in] *pSrc is input pointer
\r
6831 * @param[in] blockSize is the number of samples to process
\r
6832 * @param[out] *pResult is output pointer
\r
6833 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
\r
6839 uint32_t blockSize,
\r
6841 uint32_t * pIndex);
\r
6844 * @brief Minimum value of a Q31 vector.
\r
6845 * @param[in] *pSrc is input pointer
\r
6846 * @param[in] blockSize is the number of samples to process
\r
6847 * @param[out] *pResult is output pointer
\r
6848 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6853 uint32_t blockSize,
\r
6855 uint32_t * pIndex);
\r
6858 * @brief Minimum value of a floating-point vector.
\r
6859 * @param[in] *pSrc is input pointer
\r
6860 * @param[in] blockSize is the number of samples to process
\r
6861 * @param[out] *pResult is output pointer
\r
6862 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6868 uint32_t blockSize,
\r
6869 float32_t * pResult,
\r
6870 uint32_t * pIndex);
\r
6873 * @brief Maximum value of a Q7 vector.
\r
6874 * @param[in] *pSrc points to the input buffer
\r
6875 * @param[in] blockSize length of the input vector
\r
6876 * @param[out] *pResult maximum value returned here
\r
6877 * @param[out] *pIndex index of maximum value returned here
\r
6883 uint32_t blockSize,
\r
6885 uint32_t * pIndex);
\r
6888 * @brief Maximum value of a Q15 vector.
\r
6889 * @param[in] *pSrc points to the input buffer
\r
6890 * @param[in] blockSize length of the input vector
\r
6891 * @param[out] *pResult maximum value returned here
\r
6892 * @param[out] *pIndex index of maximum value returned here
\r
6898 uint32_t blockSize,
\r
6900 uint32_t * pIndex);
\r
6903 * @brief Maximum value of a Q31 vector.
\r
6904 * @param[in] *pSrc points to the input buffer
\r
6905 * @param[in] blockSize length of the input vector
\r
6906 * @param[out] *pResult maximum value returned here
\r
6907 * @param[out] *pIndex index of maximum value returned here
\r
6913 uint32_t blockSize,
\r
6915 uint32_t * pIndex);
\r
6918 * @brief Maximum value of a floating-point vector.
\r
6919 * @param[in] *pSrc points to the input buffer
\r
6920 * @param[in] blockSize length of the input vector
\r
6921 * @param[out] *pResult maximum value returned here
\r
6922 * @param[out] *pIndex index of maximum value returned here
\r
6928 uint32_t blockSize,
\r
6929 float32_t * pResult,
\r
6930 uint32_t * pIndex);
\r
6933 * @brief Q15 complex-by-complex multiplication
\r
6934 * @param[in] *pSrcA points to the first input vector
\r
6935 * @param[in] *pSrcB points to the second input vector
\r
6936 * @param[out] *pDst points to the output vector
\r
6937 * @param[in] numSamples number of complex samples in each vector
\r
6941 void arm_cmplx_mult_cmplx_q15(
\r
6945 uint32_t numSamples);
\r
6948 * @brief Q31 complex-by-complex multiplication
\r
6949 * @param[in] *pSrcA points to the first input vector
\r
6950 * @param[in] *pSrcB points to the second input vector
\r
6951 * @param[out] *pDst points to the output vector
\r
6952 * @param[in] numSamples number of complex samples in each vector
\r
6956 void arm_cmplx_mult_cmplx_q31(
\r
6960 uint32_t numSamples);
\r
6963 * @brief Floating-point complex-by-complex multiplication
\r
6964 * @param[in] *pSrcA points to the first input vector
\r
6965 * @param[in] *pSrcB points to the second input vector
\r
6966 * @param[out] *pDst points to the output vector
\r
6967 * @param[in] numSamples number of complex samples in each vector
\r
6971 void arm_cmplx_mult_cmplx_f32(
\r
6972 float32_t * pSrcA,
\r
6973 float32_t * pSrcB,
\r
6975 uint32_t numSamples);
\r
6978 * @brief Converts the elements of the floating-point vector to Q31 vector.
\r
6979 * @param[in] *pSrc points to the floating-point input vector
\r
6980 * @param[out] *pDst points to the Q31 output vector
\r
6981 * @param[in] blockSize length of the input vector
\r
6984 void arm_float_to_q31(
\r
6987 uint32_t blockSize);
\r
6990 * @brief Converts the elements of the floating-point vector to Q15 vector.
\r
6991 * @param[in] *pSrc points to the floating-point input vector
\r
6992 * @param[out] *pDst points to the Q15 output vector
\r
6993 * @param[in] blockSize length of the input vector
\r
6996 void arm_float_to_q15(
\r
6999 uint32_t blockSize);
\r
7002 * @brief Converts the elements of the floating-point vector to Q7 vector.
\r
7003 * @param[in] *pSrc points to the floating-point input vector
\r
7004 * @param[out] *pDst points to the Q7 output vector
\r
7005 * @param[in] blockSize length of the input vector
\r
7008 void arm_float_to_q7(
\r
7011 uint32_t blockSize);
\r
7015 * @brief Converts the elements of the Q31 vector to Q15 vector.
\r
7016 * @param[in] *pSrc is input pointer
\r
7017 * @param[out] *pDst is output pointer
\r
7018 * @param[in] blockSize is the number of samples to process
\r
7021 void arm_q31_to_q15(
\r
7024 uint32_t blockSize);
\r
7027 * @brief Converts the elements of the Q31 vector to Q7 vector.
\r
7028 * @param[in] *pSrc is input pointer
\r
7029 * @param[out] *pDst is output pointer
\r
7030 * @param[in] blockSize is the number of samples to process
\r
7033 void arm_q31_to_q7(
\r
7036 uint32_t blockSize);
\r
7039 * @brief Converts the elements of the Q15 vector to floating-point vector.
\r
7040 * @param[in] *pSrc is input pointer
\r
7041 * @param[out] *pDst is output pointer
\r
7042 * @param[in] blockSize is the number of samples to process
\r
7045 void arm_q15_to_float(
\r
7048 uint32_t blockSize);
\r
7052 * @brief Converts the elements of the Q15 vector to Q31 vector.
\r
7053 * @param[in] *pSrc is input pointer
\r
7054 * @param[out] *pDst is output pointer
\r
7055 * @param[in] blockSize is the number of samples to process
\r
7058 void arm_q15_to_q31(
\r
7061 uint32_t blockSize);
\r
7065 * @brief Converts the elements of the Q15 vector to Q7 vector.
\r
7066 * @param[in] *pSrc is input pointer
\r
7067 * @param[out] *pDst is output pointer
\r
7068 * @param[in] blockSize is the number of samples to process
\r
7071 void arm_q15_to_q7(
\r
7074 uint32_t blockSize);
\r
7078 * @ingroup groupInterpolation
\r
7082 * @defgroup BilinearInterpolate Bilinear Interpolation
\r
7084 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
\r
7085 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
\r
7086 * determines values between the grid points.
\r
7087 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
\r
7088 * Bilinear interpolation is often used in image processing to rescale images.
\r
7089 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
\r
7091 * <b>Algorithm</b>
\r
7093 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
\r
7094 * For floating-point, the instance structure is defined as:
\r
7098 * uint16_t numRows;
\r
7099 * uint16_t numCols;
\r
7100 * float32_t *pData;
\r
7101 * } arm_bilinear_interp_instance_f32;
\r
7105 * where <code>numRows</code> specifies the number of rows in the table;
\r
7106 * <code>numCols</code> specifies the number of columns in the table;
\r
7107 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
\r
7108 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
\r
7109 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
\r
7112 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
\r
7118 * The interpolated output point is computed as:
\r
7120 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
\r
7121 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
\r
7122 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
\r
7123 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
\r
7125 * Note that the coordinates (x, y) contain integer and fractional components.
\r
7126 * The integer components specify which portion of the table to use while the
\r
7127 * fractional components control the interpolation processor.
\r
7130 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
\r
7134 * @addtogroup BilinearInterpolate
\r
7140 * @brief Floating-point bilinear interpolation.
\r
7141 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7142 * @param[in] X interpolation coordinate.
\r
7143 * @param[in] Y interpolation coordinate.
\r
7144 * @return out interpolated value.
\r
7148 static __INLINE float32_t arm_bilinear_interp_f32(
\r
7149 const arm_bilinear_interp_instance_f32 * S,
\r
7154 float32_t f00, f01, f10, f11;
\r
7155 float32_t *pData = S->pData;
\r
7156 int32_t xIndex, yIndex, index;
\r
7157 float32_t xdiff, ydiff;
\r
7158 float32_t b1, b2, b3, b4;
\r
7160 xIndex = (int32_t) X;
\r
7161 yIndex = (int32_t) Y;
\r
7163 /* Care taken for table outside boundary */
\r
7164 /* Returns zero output when values are outside table boundary */
\r
7165 if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
\r
7166 || yIndex > (S->numCols - 1))
\r
7171 /* Calculation of index for two nearest points in X-direction */
\r
7172 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
\r
7175 /* Read two nearest points in X-direction */
\r
7176 f00 = pData[index];
\r
7177 f01 = pData[index + 1];
\r
7179 /* Calculation of index for two nearest points in Y-direction */
\r
7180 index = (xIndex - 1) + (yIndex) * S->numCols;
\r
7183 /* Read two nearest points in Y-direction */
\r
7184 f10 = pData[index];
\r
7185 f11 = pData[index + 1];
\r
7187 /* Calculation of intermediate values */
\r
7191 b4 = f00 - f01 - f10 + f11;
\r
7193 /* Calculation of fractional part in X */
\r
7194 xdiff = X - xIndex;
\r
7196 /* Calculation of fractional part in Y */
\r
7197 ydiff = Y - yIndex;
\r
7199 /* Calculation of bi-linear interpolated output */
\r
7200 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
\r
7202 /* return to application */
\r
7209 * @brief Q31 bilinear interpolation.
\r
7210 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7211 * @param[in] X interpolation coordinate in 12.20 format.
\r
7212 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7213 * @return out interpolated value.
\r
7216 static __INLINE q31_t arm_bilinear_interp_q31(
\r
7217 arm_bilinear_interp_instance_q31 * S,
\r
7221 q31_t out; /* Temporary output */
\r
7222 q31_t acc = 0; /* output */
\r
7223 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7224 q31_t x1, x2, y1, y2; /* Nearest output values */
\r
7225 int32_t rI, cI; /* Row and column indices */
\r
7226 q31_t *pYData = S->pData; /* pointer to output table values */
\r
7227 uint32_t nCols = S->numCols; /* num of rows */
\r
7230 /* Input is in 12.20 format */
\r
7231 /* 12 bits for the table index */
\r
7232 /* Index value calculation */
\r
7233 rI = ((X & 0xFFF00000) >> 20u);
\r
7235 /* Input is in 12.20 format */
\r
7236 /* 12 bits for the table index */
\r
7237 /* Index value calculation */
\r
7238 cI = ((Y & 0xFFF00000) >> 20u);
\r
7240 /* Care taken for table outside boundary */
\r
7241 /* Returns zero output when values are outside table boundary */
\r
7242 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7247 /* 20 bits for the fractional part */
\r
7248 /* shift left xfract by 11 to keep 1.31 format */
\r
7249 xfract = (X & 0x000FFFFF) << 11u;
\r
7251 /* Read two nearest output values from the index */
\r
7252 x1 = pYData[(rI) + nCols * (cI)];
\r
7253 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7255 /* 20 bits for the fractional part */
\r
7256 /* shift left yfract by 11 to keep 1.31 format */
\r
7257 yfract = (Y & 0x000FFFFF) << 11u;
\r
7259 /* Read two nearest output values from the index */
\r
7260 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7261 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7263 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
\r
7264 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
\r
7265 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
\r
7267 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
\r
7268 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
\r
7269 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
\r
7271 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7272 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
\r
7273 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7275 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7276 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
\r
7277 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7279 /* Convert acc to 1.31(q31) format */
\r
7280 return (acc << 2u);
\r
7285 * @brief Q15 bilinear interpolation.
\r
7286 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7287 * @param[in] X interpolation coordinate in 12.20 format.
\r
7288 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7289 * @return out interpolated value.
\r
7292 static __INLINE q15_t arm_bilinear_interp_q15(
\r
7293 arm_bilinear_interp_instance_q15 * S,
\r
7297 q63_t acc = 0; /* output */
\r
7298 q31_t out; /* Temporary output */
\r
7299 q15_t x1, x2, y1, y2; /* Nearest output values */
\r
7300 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7301 int32_t rI, cI; /* Row and column indices */
\r
7302 q15_t *pYData = S->pData; /* pointer to output table values */
\r
7303 uint32_t nCols = S->numCols; /* num of rows */
\r
7305 /* Input is in 12.20 format */
\r
7306 /* 12 bits for the table index */
\r
7307 /* Index value calculation */
\r
7308 rI = ((X & 0xFFF00000) >> 20);
\r
7310 /* Input is in 12.20 format */
\r
7311 /* 12 bits for the table index */
\r
7312 /* Index value calculation */
\r
7313 cI = ((Y & 0xFFF00000) >> 20);
\r
7315 /* Care taken for table outside boundary */
\r
7316 /* Returns zero output when values are outside table boundary */
\r
7317 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7322 /* 20 bits for the fractional part */
\r
7323 /* xfract should be in 12.20 format */
\r
7324 xfract = (X & 0x000FFFFF);
\r
7326 /* Read two nearest output values from the index */
\r
7327 x1 = pYData[(rI) + nCols * (cI)];
\r
7328 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7331 /* 20 bits for the fractional part */
\r
7332 /* yfract should be in 12.20 format */
\r
7333 yfract = (Y & 0x000FFFFF);
\r
7335 /* Read two nearest output values from the index */
\r
7336 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7337 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7339 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
\r
7341 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
\r
7342 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
\r
7343 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
\r
7344 acc = ((q63_t) out * (0xFFFFF - yfract));
\r
7346 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
\r
7347 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
\r
7348 acc += ((q63_t) out * (xfract));
\r
7350 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
\r
7351 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
\r
7352 acc += ((q63_t) out * (yfract));
\r
7354 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
\r
7355 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
\r
7356 acc += ((q63_t) out * (yfract));
\r
7358 /* acc is in 13.51 format and down shift acc by 36 times */
\r
7359 /* Convert out to 1.15 format */
\r
7360 return (acc >> 36);
\r
7365 * @brief Q7 bilinear interpolation.
\r
7366 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7367 * @param[in] X interpolation coordinate in 12.20 format.
\r
7368 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7369 * @return out interpolated value.
\r
7372 static __INLINE q7_t arm_bilinear_interp_q7(
\r
7373 arm_bilinear_interp_instance_q7 * S,
\r
7377 q63_t acc = 0; /* output */
\r
7378 q31_t out; /* Temporary output */
\r
7379 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7380 q7_t x1, x2, y1, y2; /* Nearest output values */
\r
7381 int32_t rI, cI; /* Row and column indices */
\r
7382 q7_t *pYData = S->pData; /* pointer to output table values */
\r
7383 uint32_t nCols = S->numCols; /* num of rows */
\r
7385 /* Input is in 12.20 format */
\r
7386 /* 12 bits for the table index */
\r
7387 /* Index value calculation */
\r
7388 rI = ((X & 0xFFF00000) >> 20);
\r
7390 /* Input is in 12.20 format */
\r
7391 /* 12 bits for the table index */
\r
7392 /* Index value calculation */
\r
7393 cI = ((Y & 0xFFF00000) >> 20);
\r
7395 /* Care taken for table outside boundary */
\r
7396 /* Returns zero output when values are outside table boundary */
\r
7397 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7402 /* 20 bits for the fractional part */
\r
7403 /* xfract should be in 12.20 format */
\r
7404 xfract = (X & 0x000FFFFF);
\r
7406 /* Read two nearest output values from the index */
\r
7407 x1 = pYData[(rI) + nCols * (cI)];
\r
7408 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7411 /* 20 bits for the fractional part */
\r
7412 /* yfract should be in 12.20 format */
\r
7413 yfract = (Y & 0x000FFFFF);
\r
7415 /* Read two nearest output values from the index */
\r
7416 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7417 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7419 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
\r
7420 out = ((x1 * (0xFFFFF - xfract)));
\r
7421 acc = (((q63_t) out * (0xFFFFF - yfract)));
\r
7423 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
\r
7424 out = ((x2 * (0xFFFFF - yfract)));
\r
7425 acc += (((q63_t) out * (xfract)));
\r
7427 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
\r
7428 out = ((y1 * (0xFFFFF - xfract)));
\r
7429 acc += (((q63_t) out * (yfract)));
\r
7431 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
\r
7432 out = ((y2 * (yfract)));
\r
7433 acc += (((q63_t) out * (xfract)));
\r
7435 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
\r
7436 return (acc >> 40);
\r
7441 * @} end of BilinearInterpolate group
\r
7446 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7447 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7450 #define multSub_32x32_keep32_R(a, x, y) \
\r
7451 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7454 #define mult_32x32_keep32_R(a, x, y) \
\r
7455 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
\r
7458 #define multAcc_32x32_keep32(a, x, y) \
\r
7459 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7462 #define multSub_32x32_keep32(a, x, y) \
\r
7463 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7466 #define mult_32x32_keep32(a, x, y) \
\r
7467 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7470 #if defined ( __CC_ARM ) //Keil
\r
7472 //Enter low optimization region - place directly above function definition
\r
7473 #ifdef ARM_MATH_CM4
\r
7474 #define LOW_OPTIMIZATION_ENTER \
\r
7475 _Pragma ("push") \
\r
7478 #define LOW_OPTIMIZATION_ENTER
\r
7481 //Exit low optimization region - place directly after end of function definition
\r
7482 #ifdef ARM_MATH_CM4
\r
7483 #define LOW_OPTIMIZATION_EXIT \
\r
7486 #define LOW_OPTIMIZATION_EXIT
\r
7489 //Enter low optimization region - place directly above function definition
\r
7490 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7492 //Exit low optimization region - place directly after end of function definition
\r
7493 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7495 #elif defined(__ICCARM__) //IAR
\r
7497 //Enter low optimization region - place directly above function definition
\r
7498 #ifdef ARM_MATH_CM4
\r
7499 #define LOW_OPTIMIZATION_ENTER \
\r
7500 _Pragma ("optimize=low")
\r
7502 #define LOW_OPTIMIZATION_ENTER
\r
7505 //Exit low optimization region - place directly after end of function definition
\r
7506 #define LOW_OPTIMIZATION_EXIT
\r
7508 //Enter low optimization region - place directly above function definition
\r
7509 #ifdef ARM_MATH_CM4
\r
7510 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
\r
7511 _Pragma ("optimize=low")
\r
7513 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7516 //Exit low optimization region - place directly after end of function definition
\r
7517 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7519 #elif defined(__GNUC__)
\r
7521 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
\r
7523 #define LOW_OPTIMIZATION_EXIT
\r
7525 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7527 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7529 #elif defined(__CSMC__) // Cosmic
\r
7531 #define LOW_OPTIMIZATION_ENTER
\r
7532 #define LOW_OPTIMIZATION_EXIT
\r
7533 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7534 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7536 #elif defined(__TASKING__) // TASKING
\r
7538 #define LOW_OPTIMIZATION_ENTER
\r
7539 #define LOW_OPTIMIZATION_EXIT
\r
7540 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7541 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7546 #ifdef __cplusplus
\r
7551 #endif /* _ARM_MATH_H */
\r