1 /******************************************************************************
3 * @brief Public header file for CMSIS DSP Library
6 ******************************************************************************/
8 * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.
10 * SPDX-License-Identifier: Apache-2.0
12 * Licensed under the Apache License, Version 2.0 (the License); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
26 \mainpage CMSIS DSP Software Library
31 * This user manual describes the CMSIS DSP software library,
32 * a suite of common signal processing functions for use on Cortex-M processor based devices.
34 * The library is divided into a number of functions each covering a specific category:
35 * - Basic math functions
36 * - Fast math functions
37 * - Complex math functions
40 * - Transform functions
41 * - Motor control functions
42 * - Statistical functions
44 * - Interpolation functions
46 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
47 * 32-bit integer and 32-bit floating-point values.
52 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
53 * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
54 * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
55 * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
56 * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
57 * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
58 * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
59 * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
60 * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
61 * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
62 * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
63 * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
64 * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
65 * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
66 * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
67 * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
68 * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
69 * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
70 * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
71 * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
73 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
74 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
75 * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
81 * The library ships with a number of examples which demonstrate how to use the library functions.
86 * The library has been developed and tested with MDK version 5.14.0.0
87 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
89 * Building the Library
92 * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP\\Projects\\ARM</code> folder.
93 * - arm_cortexM_math.uvprojx
96 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above.
101 * Each library project have different preprocessor macros.
103 * - ARM_MATH_BIG_ENDIAN:
105 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
107 * - ARM_MATH_MATRIX_CHECK:
109 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
111 * - ARM_MATH_ROUNDING:
113 * Define macro ARM_MATH_ROUNDING for rounding on support functions
115 * - ARM_MATH_LOOPUNROLL:
117 * Define macro ARM_MATH_LOOPUNROLL to enable manual loop unrolling in DSP functions
120 * CMSIS-DSP in ARM::CMSIS Pack
121 * -----------------------------
123 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
124 * |File/Folder |Content |
125 * |---------------------------------|------------------------------------------------------------------------|
126 * |\b CMSIS\\Documentation\\DSP | This documentation |
127 * |\b CMSIS\\DSP\\DSP_Lib_TestSuite | DSP_Lib test suite |
128 * |\b CMSIS\\DSP\\Examples | Example projects demonstrating the usage of the library functions |
129 * |\b CMSIS\\DSP\\Include | DSP_Lib include files |
130 * |\b CMSIS\\DSP\\Lib | DSP_Lib binaries |
131 * |\b CMSIS\\DSP\\Projects | Projects to rebuild DSP_Lib binaries |
132 * |\b CMSIS\\DSP\\Source | DSP_Lib source files |
135 * Revision History of CMSIS-DSP
137 * Please refer to \ref ChangeLog_pg.
142 * @defgroup groupMath Basic Math Functions
146 * @defgroup groupFastMath Fast Math Functions
147 * This set of functions provides a fast approximation to sine, cosine, and square root.
148 * As compared to most of the other functions in the CMSIS math library, the fast math functions
149 * operate on individual values and not arrays.
150 * There are separate functions for Q15, Q31, and floating-point data.
155 * @defgroup groupCmplxMath Complex Math Functions
156 * This set of functions operates on complex data vectors.
157 * The data in the complex arrays is stored in an interleaved fashion
158 * (real, imag, real, imag, ...).
159 * In the API functions, the number of samples in a complex array refers
160 * to the number of complex values; the array contains twice this number of
165 * @defgroup groupFilters Filtering Functions
169 * @defgroup groupMatrix Matrix Functions
171 * This set of functions provides basic matrix math operations.
172 * The functions operate on matrix data structures. For example,
174 * definition for the floating-point matrix structure is shown
179 * uint16_t numRows; // number of rows of the matrix.
180 * uint16_t numCols; // number of columns of the matrix.
181 * float32_t *pData; // points to the data of the matrix.
182 * } arm_matrix_instance_f32;
184 * There are similar definitions for Q15 and Q31 data types.
186 * The structure specifies the size of the matrix and then points to
187 * an array of data. The array is of size <code>numRows X numCols</code>
188 * and the values are arranged in row order. That is, the
189 * matrix element (i, j) is stored at:
191 * pData[i*numCols + j]
194 * \par Init Functions
195 * There is an associated initialization function for each type of matrix
197 * The initialization function sets the values of the internal structure fields.
198 * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15()
199 * for floating-point, Q31 and Q15 types, respectively.
202 * Use of the initialization function is optional. However, if initialization function is used
203 * then the instance structure cannot be placed into a const data section.
204 * To place the instance structure in a const data
205 * section, manually initialize the data structure. For example:
207 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
208 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
209 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
211 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
212 * specifies the number of columns, and <code>pData</code> points to the
216 * By default all of the matrix functions perform size checking on the input and
217 * output matrices. For example, the matrix addition function verifies that the
218 * two input matrices and the output matrix all have the same number of rows and
219 * columns. If the size check fails the functions return:
221 * ARM_MATH_SIZE_MISMATCH
223 * Otherwise the functions return
227 * There is some overhead associated with this matrix size checking.
228 * The matrix size checking is enabled via the \#define
230 * ARM_MATH_MATRIX_CHECK
232 * within the library project settings. By default this macro is defined
233 * and size checking is enabled. By changing the project settings and
234 * undefining this macro size checking is eliminated and the functions
235 * run a bit faster. With size checking disabled the functions always
236 * return <code>ARM_MATH_SUCCESS</code>.
240 * @defgroup groupTransforms Transform Functions
244 * @defgroup groupController Controller Functions
248 * @defgroup groupStats Statistics Functions
252 * @defgroup groupSupport Support Functions
256 * @defgroup groupInterpolation Interpolation Functions
257 * These functions perform 1- and 2-dimensional interpolation of data.
258 * Linear interpolation is used for 1-dimensional data and
259 * bilinear interpolation is used for 2-dimensional data.
263 * @defgroup groupExamples Examples
270 /* Compiler specific diagnostic adjustment */
271 #if defined ( __CC_ARM )
273 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
275 #elif defined ( __GNUC__ )
276 #pragma GCC diagnostic push
277 #pragma GCC diagnostic ignored "-Wsign-conversion"
278 #pragma GCC diagnostic ignored "-Wconversion"
279 #pragma GCC diagnostic ignored "-Wunused-parameter"
281 #elif defined ( __ICCARM__ )
283 #elif defined ( __TI_ARM__ )
285 #elif defined ( __CSMC__ )
287 #elif defined ( __TASKING__ )
290 #error Unknown compiler
294 #include "cmsis_compiler.h"
298 /* evaluate ARM architecture */
299 #if defined (__ARM_ARCH_6M__)
300 #define ARM_MATH_CM0_FAMILY 1
301 #elif defined (__ARM_ARCH_7M__)
302 //#define ARM_MATH_CM0_FAMILY 0
303 #elif defined (__ARM_ARCH_7EM__)
304 //#define ARM_MATH_CM0_FAMILY 0
305 #elif defined (__ARM_ARCH_8M_BASE__)
306 #define ARM_MATH_CM0_FAMILY 1
307 #elif defined (__ARM_ARCH_8M_MAIN__)
308 //#define ARM_MATH_CM0_FAMILY 0
310 #error "Unknown Arm Architecture!"
313 /* evaluate ARM DSP feature */
314 #if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
315 #define ARM_MATH_DSP 1
328 * @brief Macros required for reciprocal calculation in Normalized LMS
331 #define DELTA_Q31 (0x100)
332 #define DELTA_Q15 0x5
333 #define INDEX_MASK 0x0000003F
335 #define PI 3.14159265358979f
339 * @brief Macros required for SINE and COSINE Fast math approximations
342 #define FAST_MATH_TABLE_SIZE 512
343 #define FAST_MATH_Q31_SHIFT (32 - 10)
344 #define FAST_MATH_Q15_SHIFT (16 - 10)
345 #define CONTROLLER_Q31_SHIFT (32 - 9)
346 #define TABLE_SPACING_Q31 0x400000
347 #define TABLE_SPACING_Q15 0x80
350 * @brief Macros required for SINE and COSINE Controller functions
352 /* 1.31(q31) Fixed value of 2/360 */
353 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
354 #define INPUT_SPACING 0xB60B61
358 * @brief Error status returned by some functions in the library.
363 ARM_MATH_SUCCESS = 0, /**< No error */
364 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
365 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
366 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation */
367 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
368 ARM_MATH_SINGULAR = -5, /**< Input matrix is singular and cannot be inverted */
369 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
373 * @brief 8-bit fractional data type in 1.7 format.
378 * @brief 16-bit fractional data type in 1.15 format.
380 typedef int16_t q15_t;
383 * @brief 32-bit fractional data type in 1.31 format.
385 typedef int32_t q31_t;
388 * @brief 64-bit fractional data type in 1.63 format.
390 typedef int64_t q63_t;
393 * @brief 32-bit floating-point type definition.
395 typedef float float32_t;
398 * @brief 64-bit floating-point type definition.
400 typedef double float64_t;
404 @brief definition to read/write two 16 bit values.
407 #if defined ( __CC_ARM )
408 #define __SIMD32_TYPE int32_t __packed
409 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
410 #define __SIMD32_TYPE int32_t
411 #elif defined ( __GNUC__ )
412 #define __SIMD32_TYPE int32_t
413 #elif defined ( __ICCARM__ )
414 #define __SIMD32_TYPE int32_t __packed
415 #elif defined ( __TI_ARM__ )
416 #define __SIMD32_TYPE int32_t
417 #elif defined ( __CSMC__ )
418 #define __SIMD32_TYPE int32_t
419 #elif defined ( __TASKING__ )
420 #define __SIMD32_TYPE __unaligned int32_t
422 #error Unknown compiler
425 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
426 #define __SIMD32_CONST(addr) ( (__SIMD32_TYPE * ) (addr))
427 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE * ) (addr))
428 #define __SIMD64(addr) (*( int64_t **) & (addr))
430 /* SIMD replacement */
433 @brief Read 2 Q15 from Q15 pointer.
434 @param[in] pQ15 points to input value
437 __STATIC_FORCEINLINE q31_t read_q15x2 (
442 memcpy (&val, pQ15, 4);
448 @brief Read 2 Q15 from Q15 pointer and increment pointer afterwards.
449 @param[in] pQ15 points to input value
452 __STATIC_FORCEINLINE q31_t read_q15x2_ia (
457 memcpy (&val, *pQ15, 4);
464 @brief Read 2 Q15 from Q15 pointer and decrement pointer afterwards.
465 @param[in] pQ15 points to input value
468 __STATIC_FORCEINLINE q31_t read_q15x2_da (
473 memcpy (&val, *pQ15, 4);
480 @brief Write 2 Q15 to Q15 pointer and increment pointer afterwards.
481 @param[in] pQ15 points to input value
482 @param[in] value Q31 value
485 __STATIC_FORCEINLINE void write_q15x2_ia (
491 memcpy (*pQ15, &val, 4);
496 @brief Write 2 Q15 to Q15 pointer.
497 @param[in] pQ15 points to input value
498 @param[in] value Q31 value
501 __STATIC_FORCEINLINE void write_q15x2 (
507 memcpy (pQ15, &val, 4);
512 @brief Read 4 Q7 from Q7 pointer and increment pointer afterwards.
513 @param[in] pQ7 points to input value
516 __STATIC_FORCEINLINE q31_t read_q7x4_ia (
521 memcpy (&val, *pQ7, 4);
528 @brief Read 4 Q7 from Q7 pointer and decrement pointer afterwards.
529 @param[in] pQ7 points to input value
532 __STATIC_FORCEINLINE q31_t read_q7x4_da (
537 memcpy (&val, *pQ7, 4);
544 @brief Write 4 Q7 to Q7 pointer and increment pointer afterwards.
545 @param[in] pQ7 points to input value
546 @param[in] value Q31 value
549 __STATIC_FORCEINLINE void write_q7x4_ia (
555 memcpy (*pQ7, &val, 4);
562 * @brief definition to pack two 16 bit values.
564 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
565 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
566 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
567 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
571 * @brief definition to pack four 8 bit values.
573 #ifndef ARM_MATH_BIG_ENDIAN
574 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
575 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
576 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
577 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
579 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
580 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
581 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
582 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
587 * @brief Clips Q63 to Q31 values.
589 __STATIC_FORCEINLINE q31_t clip_q63_to_q31(
592 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
593 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
597 * @brief Clips Q63 to Q15 values.
599 __STATIC_FORCEINLINE q15_t clip_q63_to_q15(
602 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
603 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
607 * @brief Clips Q31 to Q7 values.
609 __STATIC_FORCEINLINE q7_t clip_q31_to_q7(
612 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
613 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
617 * @brief Clips Q31 to Q15 values.
619 __STATIC_FORCEINLINE q15_t clip_q31_to_q15(
622 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
623 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
627 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
629 __STATIC_FORCEINLINE q63_t mult32x64(
633 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
634 (((q63_t) (x >> 32) * y) ) );
638 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
640 __STATIC_FORCEINLINE uint32_t arm_recip_q31(
643 const q31_t * pRecipTable)
652 signBits = ((uint32_t) (__CLZ( in) - 1));
656 signBits = ((uint32_t) (__CLZ(-in) - 1));
659 /* Convert input sample to 1.31 format */
660 in = (in << signBits);
662 /* calculation of index for initial approximated Val */
663 index = (uint32_t)(in >> 24);
664 index = (index & INDEX_MASK);
666 /* 1.31 with exp 1 */
667 out = pRecipTable[index];
669 /* calculation of reciprocal value */
670 /* running approximation for two iterations */
671 for (i = 0U; i < 2U; i++)
673 tempVal = (uint32_t) (((q63_t) in * out) >> 31);
674 tempVal = 0x7FFFFFFFu - tempVal;
675 /* 1.31 with exp 1 */
676 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
677 out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
683 /* return num of signbits of out = 1/in value */
684 return (signBits + 1U);
689 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
691 __STATIC_FORCEINLINE uint32_t arm_recip_q15(
694 const q15_t * pRecipTable)
697 uint32_t tempVal = 0;
698 uint32_t index = 0, i = 0;
699 uint32_t signBits = 0;
703 signBits = ((uint32_t)(__CLZ( in) - 17));
707 signBits = ((uint32_t)(__CLZ(-in) - 17));
710 /* Convert input sample to 1.15 format */
711 in = (in << signBits);
713 /* calculation of index for initial approximated Val */
714 index = (uint32_t)(in >> 8);
715 index = (index & INDEX_MASK);
717 /* 1.15 with exp 1 */
718 out = pRecipTable[index];
720 /* calculation of reciprocal value */
721 /* running approximation for two iterations */
722 for (i = 0U; i < 2U; i++)
724 tempVal = (uint32_t) (((q31_t) in * out) >> 15);
725 tempVal = 0x7FFFu - tempVal;
726 /* 1.15 with exp 1 */
727 out = (q15_t) (((q31_t) out * tempVal) >> 14);
728 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
734 /* return num of signbits of out = 1/in value */
735 return (signBits + 1);
740 * @brief C custom defined intrinsic functions
742 #if !defined (ARM_MATH_DSP)
745 * @brief C custom defined QADD8
747 __STATIC_FORCEINLINE uint32_t __QADD8(
753 r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
754 s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
755 t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
756 u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
758 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
763 * @brief C custom defined QSUB8
765 __STATIC_FORCEINLINE uint32_t __QSUB8(
771 r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
772 s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
773 t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
774 u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
776 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
781 * @brief C custom defined QADD16
783 __STATIC_FORCEINLINE uint32_t __QADD16(
787 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
790 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
791 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
793 return ((uint32_t)((s << 16) | (r )));
798 * @brief C custom defined SHADD16
800 __STATIC_FORCEINLINE uint32_t __SHADD16(
806 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
807 s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
809 return ((uint32_t)((s << 16) | (r )));
814 * @brief C custom defined QSUB16
816 __STATIC_FORCEINLINE uint32_t __QSUB16(
822 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
823 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
825 return ((uint32_t)((s << 16) | (r )));
830 * @brief C custom defined SHSUB16
832 __STATIC_FORCEINLINE uint32_t __SHSUB16(
838 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
839 s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
841 return ((uint32_t)((s << 16) | (r )));
846 * @brief C custom defined QASX
848 __STATIC_FORCEINLINE uint32_t __QASX(
854 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
855 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
857 return ((uint32_t)((s << 16) | (r )));
862 * @brief C custom defined SHASX
864 __STATIC_FORCEINLINE uint32_t __SHASX(
870 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
871 s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
873 return ((uint32_t)((s << 16) | (r )));
878 * @brief C custom defined QSAX
880 __STATIC_FORCEINLINE uint32_t __QSAX(
886 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
887 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
889 return ((uint32_t)((s << 16) | (r )));
894 * @brief C custom defined SHSAX
896 __STATIC_FORCEINLINE uint32_t __SHSAX(
902 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
903 s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
905 return ((uint32_t)((s << 16) | (r )));
910 * @brief C custom defined SMUSDX
912 __STATIC_FORCEINLINE uint32_t __SMUSDX(
916 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
917 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
921 * @brief C custom defined SMUADX
923 __STATIC_FORCEINLINE uint32_t __SMUADX(
927 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
928 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
933 * @brief C custom defined QADD
935 __STATIC_FORCEINLINE int32_t __QADD(
939 return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
944 * @brief C custom defined QSUB
946 __STATIC_FORCEINLINE int32_t __QSUB(
950 return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
955 * @brief C custom defined SMLAD
957 __STATIC_FORCEINLINE uint32_t __SMLAD(
962 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
963 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
964 ( ((q31_t)sum ) ) ));
969 * @brief C custom defined SMLADX
971 __STATIC_FORCEINLINE uint32_t __SMLADX(
976 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
977 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
978 ( ((q31_t)sum ) ) ));
983 * @brief C custom defined SMLSDX
985 __STATIC_FORCEINLINE uint32_t __SMLSDX(
990 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
991 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
992 ( ((q31_t)sum ) ) ));
997 * @brief C custom defined SMLALD
999 __STATIC_FORCEINLINE uint64_t __SMLALD(
1004 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
1005 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
1006 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
1007 ( ((q63_t)sum ) ) ));
1012 * @brief C custom defined SMLALDX
1014 __STATIC_FORCEINLINE uint64_t __SMLALDX(
1019 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
1020 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
1021 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
1022 ( ((q63_t)sum ) ) ));
1027 * @brief C custom defined SMUAD
1029 __STATIC_FORCEINLINE uint32_t __SMUAD(
1033 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
1034 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
1039 * @brief C custom defined SMUSD
1041 __STATIC_FORCEINLINE uint32_t __SMUSD(
1045 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
1046 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
1051 * @brief C custom defined SXTB16
1053 __STATIC_FORCEINLINE uint32_t __SXTB16(
1056 return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
1057 ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
1061 * @brief C custom defined SMMLA
1063 __STATIC_FORCEINLINE int32_t __SMMLA(
1068 return (sum + (int32_t) (((int64_t) x * y) >> 32));
1071 #endif /* !defined (ARM_MATH_DSP) */
1075 * @brief Instance structure for the Q7 FIR filter.
1079 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1080 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1081 const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
1082 } arm_fir_instance_q7;
1085 * @brief Instance structure for the Q15 FIR filter.
1089 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1090 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1091 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
1092 } arm_fir_instance_q15;
1095 * @brief Instance structure for the Q31 FIR filter.
1099 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1100 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1101 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
1102 } arm_fir_instance_q31;
1105 * @brief Instance structure for the floating-point FIR filter.
1109 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1110 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1111 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
1112 } arm_fir_instance_f32;
1115 * @brief Processing function for the Q7 FIR filter.
1116 * @param[in] S points to an instance of the Q7 FIR filter structure.
1117 * @param[in] pSrc points to the block of input data.
1118 * @param[out] pDst points to the block of output data.
1119 * @param[in] blockSize number of samples to process.
1122 const arm_fir_instance_q7 * S,
1125 uint32_t blockSize);
1128 * @brief Initialization function for the Q7 FIR filter.
1129 * @param[in,out] S points to an instance of the Q7 FIR structure.
1130 * @param[in] numTaps Number of filter coefficients in the filter.
1131 * @param[in] pCoeffs points to the filter coefficients.
1132 * @param[in] pState points to the state buffer.
1133 * @param[in] blockSize number of samples that are processed.
1135 void arm_fir_init_q7(
1136 arm_fir_instance_q7 * S,
1138 const q7_t * pCoeffs,
1140 uint32_t blockSize);
1143 * @brief Processing function for the Q15 FIR filter.
1144 * @param[in] S points to an instance of the Q15 FIR structure.
1145 * @param[in] pSrc points to the block of input data.
1146 * @param[out] pDst points to the block of output data.
1147 * @param[in] blockSize number of samples to process.
1150 const arm_fir_instance_q15 * S,
1153 uint32_t blockSize);
1156 * @brief Processing function for the fast Q15 FIR filter (fast version).
1157 * @param[in] S points to an instance of the Q15 FIR filter structure.
1158 * @param[in] pSrc points to the block of input data.
1159 * @param[out] pDst points to the block of output data.
1160 * @param[in] blockSize number of samples to process.
1162 void arm_fir_fast_q15(
1163 const arm_fir_instance_q15 * S,
1166 uint32_t blockSize);
1169 * @brief Initialization function for the Q15 FIR filter.
1170 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
1171 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
1172 * @param[in] pCoeffs points to the filter coefficients.
1173 * @param[in] pState points to the state buffer.
1174 * @param[in] blockSize number of samples that are processed at a time.
1175 * @return The function returns either
1176 * <code>ARM_MATH_SUCCESS</code> if initialization was successful or
1177 * <code>ARM_MATH_ARGUMENT_ERROR</code> if <code>numTaps</code> is not a supported value.
1179 arm_status arm_fir_init_q15(
1180 arm_fir_instance_q15 * S,
1182 const q15_t * pCoeffs,
1184 uint32_t blockSize);
1187 * @brief Processing function for the Q31 FIR filter.
1188 * @param[in] S points to an instance of the Q31 FIR filter structure.
1189 * @param[in] pSrc points to the block of input data.
1190 * @param[out] pDst points to the block of output data.
1191 * @param[in] blockSize number of samples to process.
1194 const arm_fir_instance_q31 * S,
1197 uint32_t blockSize);
1200 * @brief Processing function for the fast Q31 FIR filter (fast version).
1201 * @param[in] S points to an instance of the Q31 FIR filter structure.
1202 * @param[in] pSrc points to the block of input data.
1203 * @param[out] pDst points to the block of output data.
1204 * @param[in] blockSize number of samples to process.
1206 void arm_fir_fast_q31(
1207 const arm_fir_instance_q31 * S,
1210 uint32_t blockSize);
1213 * @brief Initialization function for the Q31 FIR filter.
1214 * @param[in,out] S points to an instance of the Q31 FIR structure.
1215 * @param[in] numTaps Number of filter coefficients in the filter.
1216 * @param[in] pCoeffs points to the filter coefficients.
1217 * @param[in] pState points to the state buffer.
1218 * @param[in] blockSize number of samples that are processed at a time.
1220 void arm_fir_init_q31(
1221 arm_fir_instance_q31 * S,
1223 const q31_t * pCoeffs,
1225 uint32_t blockSize);
1228 * @brief Processing function for the floating-point FIR filter.
1229 * @param[in] S points to an instance of the floating-point FIR structure.
1230 * @param[in] pSrc points to the block of input data.
1231 * @param[out] pDst points to the block of output data.
1232 * @param[in] blockSize number of samples to process.
1235 const arm_fir_instance_f32 * S,
1236 const float32_t * pSrc,
1238 uint32_t blockSize);
1241 * @brief Initialization function for the floating-point FIR filter.
1242 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
1243 * @param[in] numTaps Number of filter coefficients in the filter.
1244 * @param[in] pCoeffs points to the filter coefficients.
1245 * @param[in] pState points to the state buffer.
1246 * @param[in] blockSize number of samples that are processed at a time.
1248 void arm_fir_init_f32(
1249 arm_fir_instance_f32 * S,
1251 const float32_t * pCoeffs,
1253 uint32_t blockSize);
1256 * @brief Instance structure for the Q15 Biquad cascade filter.
1260 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1261 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1262 const q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1263 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
1264 } arm_biquad_casd_df1_inst_q15;
1267 * @brief Instance structure for the Q31 Biquad cascade filter.
1271 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1272 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1273 const q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1274 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
1275 } arm_biquad_casd_df1_inst_q31;
1278 * @brief Instance structure for the floating-point Biquad cascade filter.
1282 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1283 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1284 const float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1285 } arm_biquad_casd_df1_inst_f32;
1288 * @brief Processing function for the Q15 Biquad cascade filter.
1289 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1290 * @param[in] pSrc points to the block of input data.
1291 * @param[out] pDst points to the block of output data.
1292 * @param[in] blockSize number of samples to process.
1294 void arm_biquad_cascade_df1_q15(
1295 const arm_biquad_casd_df1_inst_q15 * S,
1298 uint32_t blockSize);
1301 * @brief Initialization function for the Q15 Biquad cascade filter.
1302 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
1303 * @param[in] numStages number of 2nd order stages in the filter.
1304 * @param[in] pCoeffs points to the filter coefficients.
1305 * @param[in] pState points to the state buffer.
1306 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1308 void arm_biquad_cascade_df1_init_q15(
1309 arm_biquad_casd_df1_inst_q15 * S,
1311 const q15_t * pCoeffs,
1316 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1317 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1318 * @param[in] pSrc points to the block of input data.
1319 * @param[out] pDst points to the block of output data.
1320 * @param[in] blockSize number of samples to process.
1322 void arm_biquad_cascade_df1_fast_q15(
1323 const arm_biquad_casd_df1_inst_q15 * S,
1326 uint32_t blockSize);
1329 * @brief Processing function for the Q31 Biquad cascade filter
1330 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1331 * @param[in] pSrc points to the block of input data.
1332 * @param[out] pDst points to the block of output data.
1333 * @param[in] blockSize number of samples to process.
1335 void arm_biquad_cascade_df1_q31(
1336 const arm_biquad_casd_df1_inst_q31 * S,
1339 uint32_t blockSize);
1342 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1343 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1344 * @param[in] pSrc points to the block of input data.
1345 * @param[out] pDst points to the block of output data.
1346 * @param[in] blockSize number of samples to process.
1348 void arm_biquad_cascade_df1_fast_q31(
1349 const arm_biquad_casd_df1_inst_q31 * S,
1352 uint32_t blockSize);
1355 * @brief Initialization function for the Q31 Biquad cascade filter.
1356 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
1357 * @param[in] numStages number of 2nd order stages in the filter.
1358 * @param[in] pCoeffs points to the filter coefficients.
1359 * @param[in] pState points to the state buffer.
1360 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1362 void arm_biquad_cascade_df1_init_q31(
1363 arm_biquad_casd_df1_inst_q31 * S,
1365 const q31_t * pCoeffs,
1370 * @brief Processing function for the floating-point Biquad cascade filter.
1371 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
1372 * @param[in] pSrc points to the block of input data.
1373 * @param[out] pDst points to the block of output data.
1374 * @param[in] blockSize number of samples to process.
1376 void arm_biquad_cascade_df1_f32(
1377 const arm_biquad_casd_df1_inst_f32 * S,
1378 const float32_t * pSrc,
1380 uint32_t blockSize);
1383 * @brief Initialization function for the floating-point Biquad cascade filter.
1384 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
1385 * @param[in] numStages number of 2nd order stages in the filter.
1386 * @param[in] pCoeffs points to the filter coefficients.
1387 * @param[in] pState points to the state buffer.
1389 void arm_biquad_cascade_df1_init_f32(
1390 arm_biquad_casd_df1_inst_f32 * S,
1392 const float32_t * pCoeffs,
1393 float32_t * pState);
1396 * @brief Instance structure for the floating-point matrix structure.
1400 uint16_t numRows; /**< number of rows of the matrix. */
1401 uint16_t numCols; /**< number of columns of the matrix. */
1402 float32_t *pData; /**< points to the data of the matrix. */
1403 } arm_matrix_instance_f32;
1407 * @brief Instance structure for the floating-point matrix structure.
1411 uint16_t numRows; /**< number of rows of the matrix. */
1412 uint16_t numCols; /**< number of columns of the matrix. */
1413 float64_t *pData; /**< points to the data of the matrix. */
1414 } arm_matrix_instance_f64;
1417 * @brief Instance structure for the Q15 matrix structure.
1421 uint16_t numRows; /**< number of rows of the matrix. */
1422 uint16_t numCols; /**< number of columns of the matrix. */
1423 q15_t *pData; /**< points to the data of the matrix. */
1424 } arm_matrix_instance_q15;
1427 * @brief Instance structure for the Q31 matrix structure.
1431 uint16_t numRows; /**< number of rows of the matrix. */
1432 uint16_t numCols; /**< number of columns of the matrix. */
1433 q31_t *pData; /**< points to the data of the matrix. */
1434 } arm_matrix_instance_q31;
1437 * @brief Floating-point matrix addition.
1438 * @param[in] pSrcA points to the first input matrix structure
1439 * @param[in] pSrcB points to the second input matrix structure
1440 * @param[out] pDst points to output matrix structure
1441 * @return The function returns either
1442 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1444 arm_status arm_mat_add_f32(
1445 const arm_matrix_instance_f32 * pSrcA,
1446 const arm_matrix_instance_f32 * pSrcB,
1447 arm_matrix_instance_f32 * pDst);
1450 * @brief Q15 matrix addition.
1451 * @param[in] pSrcA points to the first input matrix structure
1452 * @param[in] pSrcB points to the second input matrix structure
1453 * @param[out] pDst points to output matrix structure
1454 * @return The function returns either
1455 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1457 arm_status arm_mat_add_q15(
1458 const arm_matrix_instance_q15 * pSrcA,
1459 const arm_matrix_instance_q15 * pSrcB,
1460 arm_matrix_instance_q15 * pDst);
1463 * @brief Q31 matrix addition.
1464 * @param[in] pSrcA points to the first input matrix structure
1465 * @param[in] pSrcB points to the second input matrix structure
1466 * @param[out] pDst points to output matrix structure
1467 * @return The function returns either
1468 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1470 arm_status arm_mat_add_q31(
1471 const arm_matrix_instance_q31 * pSrcA,
1472 const arm_matrix_instance_q31 * pSrcB,
1473 arm_matrix_instance_q31 * pDst);
1476 * @brief Floating-point, complex, matrix multiplication.
1477 * @param[in] pSrcA points to the first input matrix structure
1478 * @param[in] pSrcB points to the second input matrix structure
1479 * @param[out] pDst points to output matrix structure
1480 * @return The function returns either
1481 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1483 arm_status arm_mat_cmplx_mult_f32(
1484 const arm_matrix_instance_f32 * pSrcA,
1485 const arm_matrix_instance_f32 * pSrcB,
1486 arm_matrix_instance_f32 * pDst);
1489 * @brief Q15, complex, matrix multiplication.
1490 * @param[in] pSrcA points to the first input matrix structure
1491 * @param[in] pSrcB points to the second input matrix structure
1492 * @param[out] pDst points to output matrix structure
1493 * @return The function returns either
1494 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1496 arm_status arm_mat_cmplx_mult_q15(
1497 const arm_matrix_instance_q15 * pSrcA,
1498 const arm_matrix_instance_q15 * pSrcB,
1499 arm_matrix_instance_q15 * pDst,
1503 * @brief Q31, complex, matrix multiplication.
1504 * @param[in] pSrcA points to the first input matrix structure
1505 * @param[in] pSrcB points to the second input matrix structure
1506 * @param[out] pDst points to output matrix structure
1507 * @return The function returns either
1508 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1510 arm_status arm_mat_cmplx_mult_q31(
1511 const arm_matrix_instance_q31 * pSrcA,
1512 const arm_matrix_instance_q31 * pSrcB,
1513 arm_matrix_instance_q31 * pDst);
1516 * @brief Floating-point matrix transpose.
1517 * @param[in] pSrc points to the input matrix
1518 * @param[out] pDst points to the output matrix
1519 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1520 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1522 arm_status arm_mat_trans_f32(
1523 const arm_matrix_instance_f32 * pSrc,
1524 arm_matrix_instance_f32 * pDst);
1527 * @brief Q15 matrix transpose.
1528 * @param[in] pSrc points to the input matrix
1529 * @param[out] pDst points to the output matrix
1530 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1531 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1533 arm_status arm_mat_trans_q15(
1534 const arm_matrix_instance_q15 * pSrc,
1535 arm_matrix_instance_q15 * pDst);
1538 * @brief Q31 matrix transpose.
1539 * @param[in] pSrc points to the input matrix
1540 * @param[out] pDst points to the output matrix
1541 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1542 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1544 arm_status arm_mat_trans_q31(
1545 const arm_matrix_instance_q31 * pSrc,
1546 arm_matrix_instance_q31 * pDst);
1549 * @brief Floating-point matrix multiplication
1550 * @param[in] pSrcA points to the first input matrix structure
1551 * @param[in] pSrcB points to the second input matrix structure
1552 * @param[out] pDst points to output matrix structure
1553 * @return The function returns either
1554 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1556 arm_status arm_mat_mult_f32(
1557 const arm_matrix_instance_f32 * pSrcA,
1558 const arm_matrix_instance_f32 * pSrcB,
1559 arm_matrix_instance_f32 * pDst);
1562 * @brief Q15 matrix multiplication
1563 * @param[in] pSrcA points to the first input matrix structure
1564 * @param[in] pSrcB points to the second input matrix structure
1565 * @param[out] pDst points to output matrix structure
1566 * @param[in] pState points to the array for storing intermediate results
1567 * @return The function returns either
1568 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1570 arm_status arm_mat_mult_q15(
1571 const arm_matrix_instance_q15 * pSrcA,
1572 const arm_matrix_instance_q15 * pSrcB,
1573 arm_matrix_instance_q15 * pDst,
1577 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1578 * @param[in] pSrcA points to the first input matrix structure
1579 * @param[in] pSrcB points to the second input matrix structure
1580 * @param[out] pDst points to output matrix structure
1581 * @param[in] pState points to the array for storing intermediate results
1582 * @return The function returns either
1583 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1585 arm_status arm_mat_mult_fast_q15(
1586 const arm_matrix_instance_q15 * pSrcA,
1587 const arm_matrix_instance_q15 * pSrcB,
1588 arm_matrix_instance_q15 * pDst,
1592 * @brief Q31 matrix multiplication
1593 * @param[in] pSrcA points to the first input matrix structure
1594 * @param[in] pSrcB points to the second input matrix structure
1595 * @param[out] pDst points to output matrix structure
1596 * @return The function returns either
1597 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1599 arm_status arm_mat_mult_q31(
1600 const arm_matrix_instance_q31 * pSrcA,
1601 const arm_matrix_instance_q31 * pSrcB,
1602 arm_matrix_instance_q31 * pDst);
1605 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1606 * @param[in] pSrcA points to the first input matrix structure
1607 * @param[in] pSrcB points to the second input matrix structure
1608 * @param[out] pDst points to output matrix structure
1609 * @return The function returns either
1610 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1612 arm_status arm_mat_mult_fast_q31(
1613 const arm_matrix_instance_q31 * pSrcA,
1614 const arm_matrix_instance_q31 * pSrcB,
1615 arm_matrix_instance_q31 * pDst);
1618 * @brief Floating-point matrix subtraction
1619 * @param[in] pSrcA points to the first input matrix structure
1620 * @param[in] pSrcB points to the second input matrix structure
1621 * @param[out] pDst points to output matrix structure
1622 * @return The function returns either
1623 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1625 arm_status arm_mat_sub_f32(
1626 const arm_matrix_instance_f32 * pSrcA,
1627 const arm_matrix_instance_f32 * pSrcB,
1628 arm_matrix_instance_f32 * pDst);
1631 * @brief Q15 matrix subtraction
1632 * @param[in] pSrcA points to the first input matrix structure
1633 * @param[in] pSrcB points to the second input matrix structure
1634 * @param[out] pDst points to output matrix structure
1635 * @return The function returns either
1636 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1638 arm_status arm_mat_sub_q15(
1639 const arm_matrix_instance_q15 * pSrcA,
1640 const arm_matrix_instance_q15 * pSrcB,
1641 arm_matrix_instance_q15 * pDst);
1644 * @brief Q31 matrix subtraction
1645 * @param[in] pSrcA points to the first input matrix structure
1646 * @param[in] pSrcB points to the second input matrix structure
1647 * @param[out] pDst points to output matrix structure
1648 * @return The function returns either
1649 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1651 arm_status arm_mat_sub_q31(
1652 const arm_matrix_instance_q31 * pSrcA,
1653 const arm_matrix_instance_q31 * pSrcB,
1654 arm_matrix_instance_q31 * pDst);
1657 * @brief Floating-point matrix scaling.
1658 * @param[in] pSrc points to the input matrix
1659 * @param[in] scale scale factor
1660 * @param[out] pDst points to the output matrix
1661 * @return The function returns either
1662 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1664 arm_status arm_mat_scale_f32(
1665 const arm_matrix_instance_f32 * pSrc,
1667 arm_matrix_instance_f32 * pDst);
1670 * @brief Q15 matrix scaling.
1671 * @param[in] pSrc points to input matrix
1672 * @param[in] scaleFract fractional portion of the scale factor
1673 * @param[in] shift number of bits to shift the result by
1674 * @param[out] pDst points to output matrix
1675 * @return The function returns either
1676 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1678 arm_status arm_mat_scale_q15(
1679 const arm_matrix_instance_q15 * pSrc,
1682 arm_matrix_instance_q15 * pDst);
1685 * @brief Q31 matrix scaling.
1686 * @param[in] pSrc points to input matrix
1687 * @param[in] scaleFract fractional portion of the scale factor
1688 * @param[in] shift number of bits to shift the result by
1689 * @param[out] pDst points to output matrix structure
1690 * @return The function returns either
1691 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1693 arm_status arm_mat_scale_q31(
1694 const arm_matrix_instance_q31 * pSrc,
1697 arm_matrix_instance_q31 * pDst);
1700 * @brief Q31 matrix initialization.
1701 * @param[in,out] S points to an instance of the floating-point matrix structure.
1702 * @param[in] nRows number of rows in the matrix.
1703 * @param[in] nColumns number of columns in the matrix.
1704 * @param[in] pData points to the matrix data array.
1706 void arm_mat_init_q31(
1707 arm_matrix_instance_q31 * S,
1713 * @brief Q15 matrix initialization.
1714 * @param[in,out] S points to an instance of the floating-point matrix structure.
1715 * @param[in] nRows number of rows in the matrix.
1716 * @param[in] nColumns number of columns in the matrix.
1717 * @param[in] pData points to the matrix data array.
1719 void arm_mat_init_q15(
1720 arm_matrix_instance_q15 * S,
1726 * @brief Floating-point matrix initialization.
1727 * @param[in,out] S points to an instance of the floating-point matrix structure.
1728 * @param[in] nRows number of rows in the matrix.
1729 * @param[in] nColumns number of columns in the matrix.
1730 * @param[in] pData points to the matrix data array.
1732 void arm_mat_init_f32(
1733 arm_matrix_instance_f32 * S,
1740 * @brief Instance structure for the Q15 PID Control.
1744 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1745 #if !defined (ARM_MATH_DSP)
1749 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
1751 q15_t state[3]; /**< The state array of length 3. */
1752 q15_t Kp; /**< The proportional gain. */
1753 q15_t Ki; /**< The integral gain. */
1754 q15_t Kd; /**< The derivative gain. */
1755 } arm_pid_instance_q15;
1758 * @brief Instance structure for the Q31 PID Control.
1762 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1763 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
1764 q31_t A2; /**< The derived gain, A2 = Kd . */
1765 q31_t state[3]; /**< The state array of length 3. */
1766 q31_t Kp; /**< The proportional gain. */
1767 q31_t Ki; /**< The integral gain. */
1768 q31_t Kd; /**< The derivative gain. */
1769 } arm_pid_instance_q31;
1772 * @brief Instance structure for the floating-point PID Control.
1776 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1777 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
1778 float32_t A2; /**< The derived gain, A2 = Kd . */
1779 float32_t state[3]; /**< The state array of length 3. */
1780 float32_t Kp; /**< The proportional gain. */
1781 float32_t Ki; /**< The integral gain. */
1782 float32_t Kd; /**< The derivative gain. */
1783 } arm_pid_instance_f32;
1788 * @brief Initialization function for the floating-point PID Control.
1789 * @param[in,out] S points to an instance of the PID structure.
1790 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1792 void arm_pid_init_f32(
1793 arm_pid_instance_f32 * S,
1794 int32_t resetStateFlag);
1798 * @brief Reset function for the floating-point PID Control.
1799 * @param[in,out] S is an instance of the floating-point PID Control structure
1801 void arm_pid_reset_f32(
1802 arm_pid_instance_f32 * S);
1806 * @brief Initialization function for the Q31 PID Control.
1807 * @param[in,out] S points to an instance of the Q15 PID structure.
1808 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1810 void arm_pid_init_q31(
1811 arm_pid_instance_q31 * S,
1812 int32_t resetStateFlag);
1816 * @brief Reset function for the Q31 PID Control.
1817 * @param[in,out] S points to an instance of the Q31 PID Control structure
1820 void arm_pid_reset_q31(
1821 arm_pid_instance_q31 * S);
1825 * @brief Initialization function for the Q15 PID Control.
1826 * @param[in,out] S points to an instance of the Q15 PID structure.
1827 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1829 void arm_pid_init_q15(
1830 arm_pid_instance_q15 * S,
1831 int32_t resetStateFlag);
1835 * @brief Reset function for the Q15 PID Control.
1836 * @param[in,out] S points to an instance of the q15 PID Control structure
1838 void arm_pid_reset_q15(
1839 arm_pid_instance_q15 * S);
1843 * @brief Instance structure for the floating-point Linear Interpolate function.
1847 uint32_t nValues; /**< nValues */
1848 float32_t x1; /**< x1 */
1849 float32_t xSpacing; /**< xSpacing */
1850 float32_t *pYData; /**< pointer to the table of Y values */
1851 } arm_linear_interp_instance_f32;
1854 * @brief Instance structure for the floating-point bilinear interpolation function.
1858 uint16_t numRows; /**< number of rows in the data table. */
1859 uint16_t numCols; /**< number of columns in the data table. */
1860 float32_t *pData; /**< points to the data table. */
1861 } arm_bilinear_interp_instance_f32;
1864 * @brief Instance structure for the Q31 bilinear interpolation function.
1868 uint16_t numRows; /**< number of rows in the data table. */
1869 uint16_t numCols; /**< number of columns in the data table. */
1870 q31_t *pData; /**< points to the data table. */
1871 } arm_bilinear_interp_instance_q31;
1874 * @brief Instance structure for the Q15 bilinear interpolation function.
1878 uint16_t numRows; /**< number of rows in the data table. */
1879 uint16_t numCols; /**< number of columns in the data table. */
1880 q15_t *pData; /**< points to the data table. */
1881 } arm_bilinear_interp_instance_q15;
1884 * @brief Instance structure for the Q15 bilinear interpolation function.
1888 uint16_t numRows; /**< number of rows in the data table. */
1889 uint16_t numCols; /**< number of columns in the data table. */
1890 q7_t *pData; /**< points to the data table. */
1891 } arm_bilinear_interp_instance_q7;
1895 * @brief Q7 vector multiplication.
1896 * @param[in] pSrcA points to the first input vector
1897 * @param[in] pSrcB points to the second input vector
1898 * @param[out] pDst points to the output vector
1899 * @param[in] blockSize number of samples in each vector
1905 uint32_t blockSize);
1909 * @brief Q15 vector multiplication.
1910 * @param[in] pSrcA points to the first input vector
1911 * @param[in] pSrcB points to the second input vector
1912 * @param[out] pDst points to the output vector
1913 * @param[in] blockSize number of samples in each vector
1916 const q15_t * pSrcA,
1917 const q15_t * pSrcB,
1919 uint32_t blockSize);
1923 * @brief Q31 vector multiplication.
1924 * @param[in] pSrcA points to the first input vector
1925 * @param[in] pSrcB points to the second input vector
1926 * @param[out] pDst points to the output vector
1927 * @param[in] blockSize number of samples in each vector
1930 const q31_t * pSrcA,
1931 const q31_t * pSrcB,
1933 uint32_t blockSize);
1937 * @brief Floating-point vector multiplication.
1938 * @param[in] pSrcA points to the first input vector
1939 * @param[in] pSrcB points to the second input vector
1940 * @param[out] pDst points to the output vector
1941 * @param[in] blockSize number of samples in each vector
1944 const float32_t * pSrcA,
1945 const float32_t * pSrcB,
1947 uint32_t blockSize);
1951 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1955 uint16_t fftLen; /**< length of the FFT. */
1956 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1957 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1958 const q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
1959 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
1960 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1961 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1962 } arm_cfft_radix2_instance_q15;
1965 arm_status arm_cfft_radix2_init_q15(
1966 arm_cfft_radix2_instance_q15 * S,
1969 uint8_t bitReverseFlag);
1972 void arm_cfft_radix2_q15(
1973 const arm_cfft_radix2_instance_q15 * S,
1978 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1982 uint16_t fftLen; /**< length of the FFT. */
1983 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1984 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1985 const q15_t *pTwiddle; /**< points to the twiddle factor table. */
1986 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
1987 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1988 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1989 } arm_cfft_radix4_instance_q15;
1992 arm_status arm_cfft_radix4_init_q15(
1993 arm_cfft_radix4_instance_q15 * S,
1996 uint8_t bitReverseFlag);
1999 void arm_cfft_radix4_q15(
2000 const arm_cfft_radix4_instance_q15 * S,
2004 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
2008 uint16_t fftLen; /**< length of the FFT. */
2009 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2010 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2011 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
2012 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2013 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2014 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2015 } arm_cfft_radix2_instance_q31;
2018 arm_status arm_cfft_radix2_init_q31(
2019 arm_cfft_radix2_instance_q31 * S,
2022 uint8_t bitReverseFlag);
2025 void arm_cfft_radix2_q31(
2026 const arm_cfft_radix2_instance_q31 * S,
2030 * @brief Instance structure for the Q31 CFFT/CIFFT function.
2034 uint16_t fftLen; /**< length of the FFT. */
2035 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2036 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2037 const q31_t *pTwiddle; /**< points to the twiddle factor table. */
2038 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2039 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2040 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2041 } arm_cfft_radix4_instance_q31;
2044 void arm_cfft_radix4_q31(
2045 const arm_cfft_radix4_instance_q31 * S,
2049 arm_status arm_cfft_radix4_init_q31(
2050 arm_cfft_radix4_instance_q31 * S,
2053 uint8_t bitReverseFlag);
2056 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2060 uint16_t fftLen; /**< length of the FFT. */
2061 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2062 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2063 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
2064 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2065 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2066 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2067 float32_t onebyfftLen; /**< value of 1/fftLen. */
2068 } arm_cfft_radix2_instance_f32;
2071 arm_status arm_cfft_radix2_init_f32(
2072 arm_cfft_radix2_instance_f32 * S,
2075 uint8_t bitReverseFlag);
2078 void arm_cfft_radix2_f32(
2079 const arm_cfft_radix2_instance_f32 * S,
2083 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2087 uint16_t fftLen; /**< length of the FFT. */
2088 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2089 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2090 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
2091 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2092 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2093 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2094 float32_t onebyfftLen; /**< value of 1/fftLen. */
2095 } arm_cfft_radix4_instance_f32;
2098 arm_status arm_cfft_radix4_init_f32(
2099 arm_cfft_radix4_instance_f32 * S,
2102 uint8_t bitReverseFlag);
2105 void arm_cfft_radix4_f32(
2106 const arm_cfft_radix4_instance_f32 * S,
2110 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2114 uint16_t fftLen; /**< length of the FFT. */
2115 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
2116 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2117 uint16_t bitRevLength; /**< bit reversal table length. */
2118 } arm_cfft_instance_q15;
2121 const arm_cfft_instance_q15 * S,
2124 uint8_t bitReverseFlag);
2127 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2131 uint16_t fftLen; /**< length of the FFT. */
2132 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
2133 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2134 uint16_t bitRevLength; /**< bit reversal table length. */
2135 } arm_cfft_instance_q31;
2138 const arm_cfft_instance_q31 * S,
2141 uint8_t bitReverseFlag);
2144 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2148 uint16_t fftLen; /**< length of the FFT. */
2149 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
2150 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2151 uint16_t bitRevLength; /**< bit reversal table length. */
2152 } arm_cfft_instance_f32;
2155 const arm_cfft_instance_f32 * S,
2158 uint8_t bitReverseFlag);
2161 * @brief Instance structure for the Q15 RFFT/RIFFT function.
2165 uint32_t fftLenReal; /**< length of the real FFT. */
2166 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2167 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2168 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2169 const q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2170 const q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2171 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
2172 } arm_rfft_instance_q15;
2174 arm_status arm_rfft_init_q15(
2175 arm_rfft_instance_q15 * S,
2176 uint32_t fftLenReal,
2178 uint32_t bitReverseFlag);
2181 const arm_rfft_instance_q15 * S,
2186 * @brief Instance structure for the Q31 RFFT/RIFFT function.
2190 uint32_t fftLenReal; /**< length of the real FFT. */
2191 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2192 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2193 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2194 const q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2195 const q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2196 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
2197 } arm_rfft_instance_q31;
2199 arm_status arm_rfft_init_q31(
2200 arm_rfft_instance_q31 * S,
2201 uint32_t fftLenReal,
2203 uint32_t bitReverseFlag);
2206 const arm_rfft_instance_q31 * S,
2211 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2215 uint32_t fftLenReal; /**< length of the real FFT. */
2216 uint16_t fftLenBy2; /**< length of the complex FFT. */
2217 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2218 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2219 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2220 const float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2221 const float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2222 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
2223 } arm_rfft_instance_f32;
2225 arm_status arm_rfft_init_f32(
2226 arm_rfft_instance_f32 * S,
2227 arm_cfft_radix4_instance_f32 * S_CFFT,
2228 uint32_t fftLenReal,
2230 uint32_t bitReverseFlag);
2233 const arm_rfft_instance_f32 * S,
2238 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2242 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
2243 uint16_t fftLenRFFT; /**< length of the real sequence */
2244 const float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
2245 } arm_rfft_fast_instance_f32 ;
2247 arm_status arm_rfft_fast_init_f32 (
2248 arm_rfft_fast_instance_f32 * S,
2251 arm_status arm_rfft_32_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2253 arm_status arm_rfft_64_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2255 arm_status arm_rfft_128_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2257 arm_status arm_rfft_256_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2259 arm_status arm_rfft_512_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2261 arm_status arm_rfft_1024_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2263 arm_status arm_rfft_2048_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2265 arm_status arm_rfft_4096_fast_init_f32 ( arm_rfft_fast_instance_f32 * S );
2268 void arm_rfft_fast_f32(
2269 arm_rfft_fast_instance_f32 * S,
2270 float32_t * p, float32_t * pOut,
2274 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
2278 uint16_t N; /**< length of the DCT4. */
2279 uint16_t Nby2; /**< half of the length of the DCT4. */
2280 float32_t normalize; /**< normalizing factor. */
2281 const float32_t *pTwiddle; /**< points to the twiddle factor table. */
2282 const float32_t *pCosFactor; /**< points to the cosFactor table. */
2283 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
2284 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
2285 } arm_dct4_instance_f32;
2289 * @brief Initialization function for the floating-point DCT4/IDCT4.
2290 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
2291 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
2292 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
2293 * @param[in] N length of the DCT4.
2294 * @param[in] Nby2 half of the length of the DCT4.
2295 * @param[in] normalize normalizing factor.
2296 * @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.
2298 arm_status arm_dct4_init_f32(
2299 arm_dct4_instance_f32 * S,
2300 arm_rfft_instance_f32 * S_RFFT,
2301 arm_cfft_radix4_instance_f32 * S_CFFT,
2304 float32_t normalize);
2308 * @brief Processing function for the floating-point DCT4/IDCT4.
2309 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
2310 * @param[in] pState points to state buffer.
2311 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2314 const arm_dct4_instance_f32 * S,
2316 float32_t * pInlineBuffer);
2320 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
2324 uint16_t N; /**< length of the DCT4. */
2325 uint16_t Nby2; /**< half of the length of the DCT4. */
2326 q31_t normalize; /**< normalizing factor. */
2327 const q31_t *pTwiddle; /**< points to the twiddle factor table. */
2328 const q31_t *pCosFactor; /**< points to the cosFactor table. */
2329 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
2330 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
2331 } arm_dct4_instance_q31;
2335 * @brief Initialization function for the Q31 DCT4/IDCT4.
2336 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
2337 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
2338 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
2339 * @param[in] N length of the DCT4.
2340 * @param[in] Nby2 half of the length of the DCT4.
2341 * @param[in] normalize normalizing factor.
2342 * @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.
2344 arm_status arm_dct4_init_q31(
2345 arm_dct4_instance_q31 * S,
2346 arm_rfft_instance_q31 * S_RFFT,
2347 arm_cfft_radix4_instance_q31 * S_CFFT,
2354 * @brief Processing function for the Q31 DCT4/IDCT4.
2355 * @param[in] S points to an instance of the Q31 DCT4 structure.
2356 * @param[in] pState points to state buffer.
2357 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2360 const arm_dct4_instance_q31 * S,
2362 q31_t * pInlineBuffer);
2366 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
2370 uint16_t N; /**< length of the DCT4. */
2371 uint16_t Nby2; /**< half of the length of the DCT4. */
2372 q15_t normalize; /**< normalizing factor. */
2373 const q15_t *pTwiddle; /**< points to the twiddle factor table. */
2374 const q15_t *pCosFactor; /**< points to the cosFactor table. */
2375 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
2376 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
2377 } arm_dct4_instance_q15;
2381 * @brief Initialization function for the Q15 DCT4/IDCT4.
2382 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
2383 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
2384 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
2385 * @param[in] N length of the DCT4.
2386 * @param[in] Nby2 half of the length of the DCT4.
2387 * @param[in] normalize normalizing factor.
2388 * @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.
2390 arm_status arm_dct4_init_q15(
2391 arm_dct4_instance_q15 * S,
2392 arm_rfft_instance_q15 * S_RFFT,
2393 arm_cfft_radix4_instance_q15 * S_CFFT,
2400 * @brief Processing function for the Q15 DCT4/IDCT4.
2401 * @param[in] S points to an instance of the Q15 DCT4 structure.
2402 * @param[in] pState points to state buffer.
2403 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2406 const arm_dct4_instance_q15 * S,
2408 q15_t * pInlineBuffer);
2412 * @brief Floating-point vector addition.
2413 * @param[in] pSrcA points to the first input vector
2414 * @param[in] pSrcB points to the second input vector
2415 * @param[out] pDst points to the output vector
2416 * @param[in] blockSize number of samples in each vector
2419 const float32_t * pSrcA,
2420 const float32_t * pSrcB,
2422 uint32_t blockSize);
2426 * @brief Q7 vector addition.
2427 * @param[in] pSrcA points to the first input vector
2428 * @param[in] pSrcB points to the second input vector
2429 * @param[out] pDst points to the output vector
2430 * @param[in] blockSize number of samples in each vector
2436 uint32_t blockSize);
2440 * @brief Q15 vector addition.
2441 * @param[in] pSrcA points to the first input vector
2442 * @param[in] pSrcB points to the second input vector
2443 * @param[out] pDst points to the output vector
2444 * @param[in] blockSize number of samples in each vector
2447 const q15_t * pSrcA,
2448 const q15_t * pSrcB,
2450 uint32_t blockSize);
2454 * @brief Q31 vector addition.
2455 * @param[in] pSrcA points to the first input vector
2456 * @param[in] pSrcB points to the second input vector
2457 * @param[out] pDst points to the output vector
2458 * @param[in] blockSize number of samples in each vector
2461 const q31_t * pSrcA,
2462 const q31_t * pSrcB,
2464 uint32_t blockSize);
2468 * @brief Floating-point vector subtraction.
2469 * @param[in] pSrcA points to the first input vector
2470 * @param[in] pSrcB points to the second input vector
2471 * @param[out] pDst points to the output vector
2472 * @param[in] blockSize number of samples in each vector
2475 const float32_t * pSrcA,
2476 const float32_t * pSrcB,
2478 uint32_t blockSize);
2482 * @brief Q7 vector subtraction.
2483 * @param[in] pSrcA points to the first input vector
2484 * @param[in] pSrcB points to the second input vector
2485 * @param[out] pDst points to the output vector
2486 * @param[in] blockSize number of samples in each vector
2492 uint32_t blockSize);
2496 * @brief Q15 vector subtraction.
2497 * @param[in] pSrcA points to the first input vector
2498 * @param[in] pSrcB points to the second input vector
2499 * @param[out] pDst points to the output vector
2500 * @param[in] blockSize number of samples in each vector
2503 const q15_t * pSrcA,
2504 const q15_t * pSrcB,
2506 uint32_t blockSize);
2510 * @brief Q31 vector subtraction.
2511 * @param[in] pSrcA points to the first input vector
2512 * @param[in] pSrcB points to the second input vector
2513 * @param[out] pDst points to the output vector
2514 * @param[in] blockSize number of samples in each vector
2517 const q31_t * pSrcA,
2518 const q31_t * pSrcB,
2520 uint32_t blockSize);
2524 * @brief Multiplies a floating-point vector by a scalar.
2525 * @param[in] pSrc points to the input vector
2526 * @param[in] scale scale factor to be applied
2527 * @param[out] pDst points to the output vector
2528 * @param[in] blockSize number of samples in the vector
2531 const float32_t * pSrc,
2534 uint32_t blockSize);
2538 * @brief Multiplies a Q7 vector by a scalar.
2539 * @param[in] pSrc points to the input vector
2540 * @param[in] scaleFract fractional portion of the scale value
2541 * @param[in] shift number of bits to shift the result by
2542 * @param[out] pDst points to the output vector
2543 * @param[in] blockSize number of samples in the vector
2550 uint32_t blockSize);
2554 * @brief Multiplies a Q15 vector by a scalar.
2555 * @param[in] pSrc points to the input vector
2556 * @param[in] scaleFract fractional portion of the scale value
2557 * @param[in] shift number of bits to shift the result by
2558 * @param[out] pDst points to the output vector
2559 * @param[in] blockSize number of samples in the vector
2566 uint32_t blockSize);
2570 * @brief Multiplies a Q31 vector by a scalar.
2571 * @param[in] pSrc points to the input vector
2572 * @param[in] scaleFract fractional portion of the scale value
2573 * @param[in] shift number of bits to shift the result by
2574 * @param[out] pDst points to the output vector
2575 * @param[in] blockSize number of samples in the vector
2582 uint32_t blockSize);
2586 * @brief Q7 vector absolute value.
2587 * @param[in] pSrc points to the input buffer
2588 * @param[out] pDst points to the output buffer
2589 * @param[in] blockSize number of samples in each vector
2594 uint32_t blockSize);
2598 * @brief Floating-point vector absolute value.
2599 * @param[in] pSrc points to the input buffer
2600 * @param[out] pDst points to the output buffer
2601 * @param[in] blockSize number of samples in each vector
2604 const float32_t * pSrc,
2606 uint32_t blockSize);
2610 * @brief Q15 vector absolute value.
2611 * @param[in] pSrc points to the input buffer
2612 * @param[out] pDst points to the output buffer
2613 * @param[in] blockSize number of samples in each vector
2618 uint32_t blockSize);
2622 * @brief Q31 vector absolute value.
2623 * @param[in] pSrc points to the input buffer
2624 * @param[out] pDst points to the output buffer
2625 * @param[in] blockSize number of samples in each vector
2630 uint32_t blockSize);
2634 * @brief Dot product of floating-point vectors.
2635 * @param[in] pSrcA points to the first input vector
2636 * @param[in] pSrcB points to the second input vector
2637 * @param[in] blockSize number of samples in each vector
2638 * @param[out] result output result returned here
2640 void arm_dot_prod_f32(
2641 const float32_t * pSrcA,
2642 const float32_t * pSrcB,
2644 float32_t * result);
2648 * @brief Dot product of Q7 vectors.
2649 * @param[in] pSrcA points to the first input vector
2650 * @param[in] pSrcB points to the second input vector
2651 * @param[in] blockSize number of samples in each vector
2652 * @param[out] result output result returned here
2654 void arm_dot_prod_q7(
2662 * @brief Dot product of Q15 vectors.
2663 * @param[in] pSrcA points to the first input vector
2664 * @param[in] pSrcB points to the second input vector
2665 * @param[in] blockSize number of samples in each vector
2666 * @param[out] result output result returned here
2668 void arm_dot_prod_q15(
2669 const q15_t * pSrcA,
2670 const q15_t * pSrcB,
2676 * @brief Dot product of Q31 vectors.
2677 * @param[in] pSrcA points to the first input vector
2678 * @param[in] pSrcB points to the second input vector
2679 * @param[in] blockSize number of samples in each vector
2680 * @param[out] result output result returned here
2682 void arm_dot_prod_q31(
2683 const q31_t * pSrcA,
2684 const q31_t * pSrcB,
2690 * @brief Shifts the elements of a Q7 vector a specified number of bits.
2691 * @param[in] pSrc points to the input vector
2692 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2693 * @param[out] pDst points to the output vector
2694 * @param[in] blockSize number of samples in the vector
2700 uint32_t blockSize);
2704 * @brief Shifts the elements of a Q15 vector a specified number of bits.
2705 * @param[in] pSrc points to the input vector
2706 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2707 * @param[out] pDst points to the output vector
2708 * @param[in] blockSize number of samples in the vector
2714 uint32_t blockSize);
2718 * @brief Shifts the elements of a Q31 vector a specified number of bits.
2719 * @param[in] pSrc points to the input vector
2720 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2721 * @param[out] pDst points to the output vector
2722 * @param[in] blockSize number of samples in the vector
2728 uint32_t blockSize);
2732 * @brief Adds a constant offset to a floating-point vector.
2733 * @param[in] pSrc points to the input vector
2734 * @param[in] offset is the offset to be added
2735 * @param[out] pDst points to the output vector
2736 * @param[in] blockSize number of samples in the vector
2738 void arm_offset_f32(
2739 const float32_t * pSrc,
2742 uint32_t blockSize);
2746 * @brief Adds a constant offset to a Q7 vector.
2747 * @param[in] pSrc points to the input vector
2748 * @param[in] offset is the offset to be added
2749 * @param[out] pDst points to the output vector
2750 * @param[in] blockSize number of samples in the vector
2756 uint32_t blockSize);
2760 * @brief Adds a constant offset to a Q15 vector.
2761 * @param[in] pSrc points to the input vector
2762 * @param[in] offset is the offset to be added
2763 * @param[out] pDst points to the output vector
2764 * @param[in] blockSize number of samples in the vector
2766 void arm_offset_q15(
2770 uint32_t blockSize);
2774 * @brief Adds a constant offset to a Q31 vector.
2775 * @param[in] pSrc points to the input vector
2776 * @param[in] offset is the offset to be added
2777 * @param[out] pDst points to the output vector
2778 * @param[in] blockSize number of samples in the vector
2780 void arm_offset_q31(
2784 uint32_t blockSize);
2788 * @brief Negates the elements of a floating-point vector.
2789 * @param[in] pSrc points to the input vector
2790 * @param[out] pDst points to the output vector
2791 * @param[in] blockSize number of samples in the vector
2793 void arm_negate_f32(
2794 const float32_t * pSrc,
2796 uint32_t blockSize);
2800 * @brief Negates the elements of a Q7 vector.
2801 * @param[in] pSrc points to the input vector
2802 * @param[out] pDst points to the output vector
2803 * @param[in] blockSize number of samples in the vector
2808 uint32_t blockSize);
2812 * @brief Negates the elements of a Q15 vector.
2813 * @param[in] pSrc points to the input vector
2814 * @param[out] pDst points to the output vector
2815 * @param[in] blockSize number of samples in the vector
2817 void arm_negate_q15(
2820 uint32_t blockSize);
2824 * @brief Negates the elements of a Q31 vector.
2825 * @param[in] pSrc points to the input vector
2826 * @param[out] pDst points to the output vector
2827 * @param[in] blockSize number of samples in the vector
2829 void arm_negate_q31(
2832 uint32_t blockSize);
2836 * @brief Copies the elements of a floating-point vector.
2837 * @param[in] pSrc input pointer
2838 * @param[out] pDst output pointer
2839 * @param[in] blockSize number of samples to process
2842 const float32_t * pSrc,
2844 uint32_t blockSize);
2848 * @brief Copies the elements of a Q7 vector.
2849 * @param[in] pSrc input pointer
2850 * @param[out] pDst output pointer
2851 * @param[in] blockSize number of samples to process
2856 uint32_t blockSize);
2860 * @brief Copies the elements of a Q15 vector.
2861 * @param[in] pSrc input pointer
2862 * @param[out] pDst output pointer
2863 * @param[in] blockSize number of samples to process
2868 uint32_t blockSize);
2872 * @brief Copies the elements of a Q31 vector.
2873 * @param[in] pSrc input pointer
2874 * @param[out] pDst output pointer
2875 * @param[in] blockSize number of samples to process
2880 uint32_t blockSize);
2884 * @brief Fills a constant value into a floating-point vector.
2885 * @param[in] value input value to be filled
2886 * @param[out] pDst output pointer
2887 * @param[in] blockSize number of samples to process
2892 uint32_t blockSize);
2896 * @brief Fills a constant value into a Q7 vector.
2897 * @param[in] value input value to be filled
2898 * @param[out] pDst output pointer
2899 * @param[in] blockSize number of samples to process
2904 uint32_t blockSize);
2908 * @brief Fills a constant value into a Q15 vector.
2909 * @param[in] value input value to be filled
2910 * @param[out] pDst output pointer
2911 * @param[in] blockSize number of samples to process
2916 uint32_t blockSize);
2920 * @brief Fills a constant value into a Q31 vector.
2921 * @param[in] value input value to be filled
2922 * @param[out] pDst output pointer
2923 * @param[in] blockSize number of samples to process
2928 uint32_t blockSize);
2932 * @brief Convolution of floating-point sequences.
2933 * @param[in] pSrcA points to the first input sequence.
2934 * @param[in] srcALen length of the first input sequence.
2935 * @param[in] pSrcB points to the second input sequence.
2936 * @param[in] srcBLen length of the second input sequence.
2937 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2940 const float32_t * pSrcA,
2942 const float32_t * pSrcB,
2948 * @brief Convolution of Q15 sequences.
2949 * @param[in] pSrcA points to the first input sequence.
2950 * @param[in] srcALen length of the first input sequence.
2951 * @param[in] pSrcB points to the second input sequence.
2952 * @param[in] srcBLen length of the second input sequence.
2953 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2954 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
2955 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
2957 void arm_conv_opt_q15(
2958 const q15_t * pSrcA,
2960 const q15_t * pSrcB,
2968 * @brief Convolution of Q15 sequences.
2969 * @param[in] pSrcA points to the first input sequence.
2970 * @param[in] srcALen length of the first input sequence.
2971 * @param[in] pSrcB points to the second input sequence.
2972 * @param[in] srcBLen length of the second input sequence.
2973 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2976 const q15_t * pSrcA,
2978 const q15_t * pSrcB,
2984 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
2985 * @param[in] pSrcA points to the first input sequence.
2986 * @param[in] srcALen length of the first input sequence.
2987 * @param[in] pSrcB points to the second input sequence.
2988 * @param[in] srcBLen length of the second input sequence.
2989 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2991 void arm_conv_fast_q15(
2992 const q15_t * pSrcA,
2994 const q15_t * pSrcB,
3000 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3001 * @param[in] pSrcA points to the first input sequence.
3002 * @param[in] srcALen length of the first input sequence.
3003 * @param[in] pSrcB points to the second input sequence.
3004 * @param[in] srcBLen length of the second input sequence.
3005 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3006 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3007 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3009 void arm_conv_fast_opt_q15(
3010 const q15_t * pSrcA,
3012 const q15_t * pSrcB,
3020 * @brief Convolution of Q31 sequences.
3021 * @param[in] pSrcA points to the first input sequence.
3022 * @param[in] srcALen length of the first input sequence.
3023 * @param[in] pSrcB points to the second input sequence.
3024 * @param[in] srcBLen length of the second input sequence.
3025 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3028 const q31_t * pSrcA,
3030 const q31_t * pSrcB,
3036 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3037 * @param[in] pSrcA points to the first input sequence.
3038 * @param[in] srcALen length of the first input sequence.
3039 * @param[in] pSrcB points to the second input sequence.
3040 * @param[in] srcBLen length of the second input sequence.
3041 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3043 void arm_conv_fast_q31(
3044 const q31_t * pSrcA,
3046 const q31_t * pSrcB,
3052 * @brief Convolution of Q7 sequences.
3053 * @param[in] pSrcA points to the first input sequence.
3054 * @param[in] srcALen length of the first input sequence.
3055 * @param[in] pSrcB points to the second input sequence.
3056 * @param[in] srcBLen length of the second input sequence.
3057 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3058 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3059 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3061 void arm_conv_opt_q7(
3072 * @brief Convolution of Q7 sequences.
3073 * @param[in] pSrcA points to the first input sequence.
3074 * @param[in] srcALen length of the first input sequence.
3075 * @param[in] pSrcB points to the second input sequence.
3076 * @param[in] srcBLen length of the second input sequence.
3077 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3088 * @brief Partial convolution of floating-point sequences.
3089 * @param[in] pSrcA points to the first input sequence.
3090 * @param[in] srcALen length of the first input sequence.
3091 * @param[in] pSrcB points to the second input sequence.
3092 * @param[in] srcBLen length of the second input sequence.
3093 * @param[out] pDst points to the block of output data
3094 * @param[in] firstIndex is the first output sample to start with.
3095 * @param[in] numPoints is the number of output points to be computed.
3096 * @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].
3098 arm_status arm_conv_partial_f32(
3099 const float32_t * pSrcA,
3101 const float32_t * pSrcB,
3104 uint32_t firstIndex,
3105 uint32_t numPoints);
3109 * @brief Partial convolution of Q15 sequences.
3110 * @param[in] pSrcA points to the first input sequence.
3111 * @param[in] srcALen length of the first input sequence.
3112 * @param[in] pSrcB points to the second input sequence.
3113 * @param[in] srcBLen length of the second input sequence.
3114 * @param[out] pDst points to the block of output data
3115 * @param[in] firstIndex is the first output sample to start with.
3116 * @param[in] numPoints is the number of output points to be computed.
3117 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3118 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3119 * @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].
3121 arm_status arm_conv_partial_opt_q15(
3122 const q15_t * pSrcA,
3124 const q15_t * pSrcB,
3127 uint32_t firstIndex,
3134 * @brief Partial convolution of Q15 sequences.
3135 * @param[in] pSrcA points to the first input sequence.
3136 * @param[in] srcALen length of the first input sequence.
3137 * @param[in] pSrcB points to the second input sequence.
3138 * @param[in] srcBLen length of the second input sequence.
3139 * @param[out] pDst points to the block of output data
3140 * @param[in] firstIndex is the first output sample to start with.
3141 * @param[in] numPoints is the number of output points to be computed.
3142 * @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].
3144 arm_status arm_conv_partial_q15(
3145 const q15_t * pSrcA,
3147 const q15_t * pSrcB,
3150 uint32_t firstIndex,
3151 uint32_t numPoints);
3155 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3156 * @param[in] pSrcA points to the first input sequence.
3157 * @param[in] srcALen length of the first input sequence.
3158 * @param[in] pSrcB points to the second input sequence.
3159 * @param[in] srcBLen length of the second input sequence.
3160 * @param[out] pDst points to the block of output data
3161 * @param[in] firstIndex is the first output sample to start with.
3162 * @param[in] numPoints is the number of output points to be computed.
3163 * @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].
3165 arm_status arm_conv_partial_fast_q15(
3166 const q15_t * pSrcA,
3168 const q15_t * pSrcB,
3171 uint32_t firstIndex,
3172 uint32_t numPoints);
3176 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3177 * @param[in] pSrcA points to the first input sequence.
3178 * @param[in] srcALen length of the first input sequence.
3179 * @param[in] pSrcB points to the second input sequence.
3180 * @param[in] srcBLen length of the second input sequence.
3181 * @param[out] pDst points to the block of output data
3182 * @param[in] firstIndex is the first output sample to start with.
3183 * @param[in] numPoints is the number of output points to be computed.
3184 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3185 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3186 * @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].
3188 arm_status arm_conv_partial_fast_opt_q15(
3189 const q15_t * pSrcA,
3191 const q15_t * pSrcB,
3194 uint32_t firstIndex,
3201 * @brief Partial convolution of Q31 sequences.
3202 * @param[in] pSrcA points to the first input sequence.
3203 * @param[in] srcALen length of the first input sequence.
3204 * @param[in] pSrcB points to the second input sequence.
3205 * @param[in] srcBLen length of the second input sequence.
3206 * @param[out] pDst points to the block of output data
3207 * @param[in] firstIndex is the first output sample to start with.
3208 * @param[in] numPoints is the number of output points to be computed.
3209 * @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].
3211 arm_status arm_conv_partial_q31(
3212 const q31_t * pSrcA,
3214 const q31_t * pSrcB,
3217 uint32_t firstIndex,
3218 uint32_t numPoints);
3222 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3223 * @param[in] pSrcA points to the first input sequence.
3224 * @param[in] srcALen length of the first input sequence.
3225 * @param[in] pSrcB points to the second input sequence.
3226 * @param[in] srcBLen length of the second input sequence.
3227 * @param[out] pDst points to the block of output data
3228 * @param[in] firstIndex is the first output sample to start with.
3229 * @param[in] numPoints is the number of output points to be computed.
3230 * @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].
3232 arm_status arm_conv_partial_fast_q31(
3233 const q31_t * pSrcA,
3235 const q31_t * pSrcB,
3238 uint32_t firstIndex,
3239 uint32_t numPoints);
3243 * @brief Partial convolution of Q7 sequences
3244 * @param[in] pSrcA points to the first input sequence.
3245 * @param[in] srcALen length of the first input sequence.
3246 * @param[in] pSrcB points to the second input sequence.
3247 * @param[in] srcBLen length of the second input sequence.
3248 * @param[out] pDst points to the block of output data
3249 * @param[in] firstIndex is the first output sample to start with.
3250 * @param[in] numPoints is the number of output points to be computed.
3251 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3252 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3253 * @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].
3255 arm_status arm_conv_partial_opt_q7(
3261 uint32_t firstIndex,
3268 * @brief Partial convolution of Q7 sequences.
3269 * @param[in] pSrcA points to the first input sequence.
3270 * @param[in] srcALen length of the first input sequence.
3271 * @param[in] pSrcB points to the second input sequence.
3272 * @param[in] srcBLen length of the second input sequence.
3273 * @param[out] pDst points to the block of output data
3274 * @param[in] firstIndex is the first output sample to start with.
3275 * @param[in] numPoints is the number of output points to be computed.
3276 * @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].
3278 arm_status arm_conv_partial_q7(
3284 uint32_t firstIndex,
3285 uint32_t numPoints);
3289 * @brief Instance structure for the Q15 FIR decimator.
3293 uint8_t M; /**< decimation factor. */
3294 uint16_t numTaps; /**< number of coefficients in the filter. */
3295 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3296 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3297 } arm_fir_decimate_instance_q15;
3300 * @brief Instance structure for the Q31 FIR decimator.
3304 uint8_t M; /**< decimation factor. */
3305 uint16_t numTaps; /**< number of coefficients in the filter. */
3306 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3307 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3308 } arm_fir_decimate_instance_q31;
3311 @brief Instance structure for floating-point FIR decimator.
3315 uint8_t M; /**< decimation factor. */
3316 uint16_t numTaps; /**< number of coefficients in the filter. */
3317 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3318 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3319 } arm_fir_decimate_instance_f32;
3323 @brief Processing function for floating-point FIR decimator.
3324 @param[in] S points to an instance of the floating-point FIR decimator structure
3325 @param[in] pSrc points to the block of input data
3326 @param[out] pDst points to the block of output data
3327 @param[in] blockSize number of samples to process
3329 void arm_fir_decimate_f32(
3330 const arm_fir_decimate_instance_f32 * S,
3331 const float32_t * pSrc,
3333 uint32_t blockSize);
3337 @brief Initialization function for the floating-point FIR decimator.
3338 @param[in,out] S points to an instance of the floating-point FIR decimator structure
3339 @param[in] numTaps number of coefficients in the filter
3340 @param[in] M decimation factor
3341 @param[in] pCoeffs points to the filter coefficients
3342 @param[in] pState points to the state buffer
3343 @param[in] blockSize number of input samples to process per call
3344 @return execution status
3345 - \ref ARM_MATH_SUCCESS : Operation successful
3346 - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code>
3348 arm_status arm_fir_decimate_init_f32(
3349 arm_fir_decimate_instance_f32 * S,
3352 const float32_t * pCoeffs,
3354 uint32_t blockSize);
3358 * @brief Processing function for the Q15 FIR decimator.
3359 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3360 * @param[in] pSrc points to the block of input data.
3361 * @param[out] pDst points to the block of output data
3362 * @param[in] blockSize number of input samples to process per call.
3364 void arm_fir_decimate_q15(
3365 const arm_fir_decimate_instance_q15 * S,
3368 uint32_t blockSize);
3372 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3373 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3374 * @param[in] pSrc points to the block of input data.
3375 * @param[out] pDst points to the block of output data
3376 * @param[in] blockSize number of input samples to process per call.
3378 void arm_fir_decimate_fast_q15(
3379 const arm_fir_decimate_instance_q15 * S,
3382 uint32_t blockSize);
3386 * @brief Initialization function for the Q15 FIR decimator.
3387 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
3388 * @param[in] numTaps number of coefficients in the filter.
3389 * @param[in] M decimation factor.
3390 * @param[in] pCoeffs points to the filter coefficients.
3391 * @param[in] pState points to the state buffer.
3392 * @param[in] blockSize number of input samples to process per call.
3393 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3394 * <code>blockSize</code> is not a multiple of <code>M</code>.
3396 arm_status arm_fir_decimate_init_q15(
3397 arm_fir_decimate_instance_q15 * S,
3400 const q15_t * pCoeffs,
3402 uint32_t blockSize);
3406 * @brief Processing function for the Q31 FIR decimator.
3407 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3408 * @param[in] pSrc points to the block of input data.
3409 * @param[out] pDst points to the block of output data
3410 * @param[in] blockSize number of input samples to process per call.
3412 void arm_fir_decimate_q31(
3413 const arm_fir_decimate_instance_q31 * S,
3416 uint32_t blockSize);
3419 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3420 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3421 * @param[in] pSrc points to the block of input data.
3422 * @param[out] pDst points to the block of output data
3423 * @param[in] blockSize number of input samples to process per call.
3425 void arm_fir_decimate_fast_q31(
3426 const arm_fir_decimate_instance_q31 * S,
3429 uint32_t blockSize);
3433 * @brief Initialization function for the Q31 FIR decimator.
3434 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
3435 * @param[in] numTaps number of coefficients in the filter.
3436 * @param[in] M decimation factor.
3437 * @param[in] pCoeffs points to the filter coefficients.
3438 * @param[in] pState points to the state buffer.
3439 * @param[in] blockSize number of input samples to process per call.
3440 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3441 * <code>blockSize</code> is not a multiple of <code>M</code>.
3443 arm_status arm_fir_decimate_init_q31(
3444 arm_fir_decimate_instance_q31 * S,
3447 const q31_t * pCoeffs,
3449 uint32_t blockSize);
3453 * @brief Instance structure for the Q15 FIR interpolator.
3457 uint8_t L; /**< upsample factor. */
3458 uint16_t phaseLength; /**< length of each polyphase filter component. */
3459 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3460 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3461 } arm_fir_interpolate_instance_q15;
3464 * @brief Instance structure for the Q31 FIR interpolator.
3468 uint8_t L; /**< upsample factor. */
3469 uint16_t phaseLength; /**< length of each polyphase filter component. */
3470 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3471 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3472 } arm_fir_interpolate_instance_q31;
3475 * @brief Instance structure for the floating-point FIR interpolator.
3479 uint8_t L; /**< upsample factor. */
3480 uint16_t phaseLength; /**< length of each polyphase filter component. */
3481 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3482 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
3483 } arm_fir_interpolate_instance_f32;
3487 * @brief Processing function for the Q15 FIR interpolator.
3488 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3489 * @param[in] pSrc points to the block of input data.
3490 * @param[out] pDst points to the block of output data.
3491 * @param[in] blockSize number of input samples to process per call.
3493 void arm_fir_interpolate_q15(
3494 const arm_fir_interpolate_instance_q15 * S,
3497 uint32_t blockSize);
3501 * @brief Initialization function for the Q15 FIR interpolator.
3502 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
3503 * @param[in] L upsample factor.
3504 * @param[in] numTaps number of filter coefficients in the filter.
3505 * @param[in] pCoeffs points to the filter coefficient buffer.
3506 * @param[in] pState points to the state buffer.
3507 * @param[in] blockSize number of input samples to process per call.
3508 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3509 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3511 arm_status arm_fir_interpolate_init_q15(
3512 arm_fir_interpolate_instance_q15 * S,
3515 const q15_t * pCoeffs,
3517 uint32_t blockSize);
3521 * @brief Processing function for the Q31 FIR interpolator.
3522 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3523 * @param[in] pSrc points to the block of input data.
3524 * @param[out] pDst points to the block of output data.
3525 * @param[in] blockSize number of input samples to process per call.
3527 void arm_fir_interpolate_q31(
3528 const arm_fir_interpolate_instance_q31 * S,
3531 uint32_t blockSize);
3535 * @brief Initialization function for the Q31 FIR interpolator.
3536 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
3537 * @param[in] L upsample factor.
3538 * @param[in] numTaps number of filter coefficients in the filter.
3539 * @param[in] pCoeffs points to the filter coefficient buffer.
3540 * @param[in] pState points to the state buffer.
3541 * @param[in] blockSize number of input samples to process per call.
3542 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3543 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3545 arm_status arm_fir_interpolate_init_q31(
3546 arm_fir_interpolate_instance_q31 * S,
3549 const q31_t * pCoeffs,
3551 uint32_t blockSize);
3555 * @brief Processing function for the floating-point FIR interpolator.
3556 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
3557 * @param[in] pSrc points to the block of input data.
3558 * @param[out] pDst points to the block of output data.
3559 * @param[in] blockSize number of input samples to process per call.
3561 void arm_fir_interpolate_f32(
3562 const arm_fir_interpolate_instance_f32 * S,
3563 const float32_t * pSrc,
3565 uint32_t blockSize);
3569 * @brief Initialization function for the floating-point FIR interpolator.
3570 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
3571 * @param[in] L upsample factor.
3572 * @param[in] numTaps number of filter coefficients in the filter.
3573 * @param[in] pCoeffs points to the filter coefficient buffer.
3574 * @param[in] pState points to the state buffer.
3575 * @param[in] blockSize number of input samples to process per call.
3576 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3577 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3579 arm_status arm_fir_interpolate_init_f32(
3580 arm_fir_interpolate_instance_f32 * S,
3583 const float32_t * pCoeffs,
3585 uint32_t blockSize);
3589 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
3593 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3594 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3595 const q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3596 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
3597 } arm_biquad_cas_df1_32x64_ins_q31;
3601 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3602 * @param[in] pSrc points to the block of input data.
3603 * @param[out] pDst points to the block of output data
3604 * @param[in] blockSize number of samples to process.
3606 void arm_biquad_cas_df1_32x64_q31(
3607 const arm_biquad_cas_df1_32x64_ins_q31 * S,
3610 uint32_t blockSize);
3614 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3615 * @param[in] numStages number of 2nd order stages in the filter.
3616 * @param[in] pCoeffs points to the filter coefficients.
3617 * @param[in] pState points to the state buffer.
3618 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
3620 void arm_biquad_cas_df1_32x64_init_q31(
3621 arm_biquad_cas_df1_32x64_ins_q31 * S,
3623 const q31_t * pCoeffs,
3629 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3633 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3634 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3635 const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3636 } arm_biquad_cascade_df2T_instance_f32;
3639 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3643 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3644 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3645 const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3646 } arm_biquad_cascade_stereo_df2T_instance_f32;
3649 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3653 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3654 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3655 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3656 } arm_biquad_cascade_df2T_instance_f64;
3660 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3661 * @param[in] S points to an instance of the filter data structure.
3662 * @param[in] pSrc points to the block of input data.
3663 * @param[out] pDst points to the block of output data
3664 * @param[in] blockSize number of samples to process.
3666 void arm_biquad_cascade_df2T_f32(
3667 const arm_biquad_cascade_df2T_instance_f32 * S,
3668 const float32_t * pSrc,
3670 uint32_t blockSize);
3674 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
3675 * @param[in] S points to an instance of the filter data structure.
3676 * @param[in] pSrc points to the block of input data.
3677 * @param[out] pDst points to the block of output data
3678 * @param[in] blockSize number of samples to process.
3680 void arm_biquad_cascade_stereo_df2T_f32(
3681 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
3682 const float32_t * pSrc,
3684 uint32_t blockSize);
3688 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3689 * @param[in] S points to an instance of the filter data structure.
3690 * @param[in] pSrc points to the block of input data.
3691 * @param[out] pDst points to the block of output data
3692 * @param[in] blockSize number of samples to process.
3694 void arm_biquad_cascade_df2T_f64(
3695 const arm_biquad_cascade_df2T_instance_f64 * S,
3698 uint32_t blockSize);
3702 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3703 * @param[in,out] S points to an instance of the filter data structure.
3704 * @param[in] numStages number of 2nd order stages in the filter.
3705 * @param[in] pCoeffs points to the filter coefficients.
3706 * @param[in] pState points to the state buffer.
3708 void arm_biquad_cascade_df2T_init_f32(
3709 arm_biquad_cascade_df2T_instance_f32 * S,
3711 const float32_t * pCoeffs,
3712 float32_t * pState);
3716 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3717 * @param[in,out] S points to an instance of the filter data structure.
3718 * @param[in] numStages number of 2nd order stages in the filter.
3719 * @param[in] pCoeffs points to the filter coefficients.
3720 * @param[in] pState points to the state buffer.
3722 void arm_biquad_cascade_stereo_df2T_init_f32(
3723 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
3725 const float32_t * pCoeffs,
3726 float32_t * pState);
3730 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3731 * @param[in,out] S points to an instance of the filter data structure.
3732 * @param[in] numStages number of 2nd order stages in the filter.
3733 * @param[in] pCoeffs points to the filter coefficients.
3734 * @param[in] pState points to the state buffer.
3736 void arm_biquad_cascade_df2T_init_f64(
3737 arm_biquad_cascade_df2T_instance_f64 * S,
3739 float64_t * pCoeffs,
3740 float64_t * pState);
3744 * @brief Instance structure for the Q15 FIR lattice filter.
3748 uint16_t numStages; /**< number of filter stages. */
3749 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
3750 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3751 } arm_fir_lattice_instance_q15;
3754 * @brief Instance structure for the Q31 FIR lattice filter.
3758 uint16_t numStages; /**< number of filter stages. */
3759 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
3760 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3761 } arm_fir_lattice_instance_q31;
3764 * @brief Instance structure for the floating-point FIR lattice filter.
3768 uint16_t numStages; /**< number of filter stages. */
3769 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
3770 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3771 } arm_fir_lattice_instance_f32;
3775 * @brief Initialization function for the Q15 FIR lattice filter.
3776 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3777 * @param[in] numStages number of filter stages.
3778 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3779 * @param[in] pState points to the state buffer. The array is of length numStages.
3781 void arm_fir_lattice_init_q15(
3782 arm_fir_lattice_instance_q15 * S,
3784 const q15_t * pCoeffs,
3789 * @brief Processing function for the Q15 FIR lattice filter.
3790 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3791 * @param[in] pSrc points to the block of input data.
3792 * @param[out] pDst points to the block of output data.
3793 * @param[in] blockSize number of samples to process.
3795 void arm_fir_lattice_q15(
3796 const arm_fir_lattice_instance_q15 * S,
3799 uint32_t blockSize);
3803 * @brief Initialization function for the Q31 FIR lattice filter.
3804 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3805 * @param[in] numStages number of filter stages.
3806 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3807 * @param[in] pState points to the state buffer. The array is of length numStages.
3809 void arm_fir_lattice_init_q31(
3810 arm_fir_lattice_instance_q31 * S,
3812 const q31_t * pCoeffs,
3817 * @brief Processing function for the Q31 FIR lattice filter.
3818 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3819 * @param[in] pSrc points to the block of input data.
3820 * @param[out] pDst points to the block of output data
3821 * @param[in] blockSize number of samples to process.
3823 void arm_fir_lattice_q31(
3824 const arm_fir_lattice_instance_q31 * S,
3827 uint32_t blockSize);
3831 * @brief Initialization function for the floating-point FIR lattice filter.
3832 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3833 * @param[in] numStages number of filter stages.
3834 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3835 * @param[in] pState points to the state buffer. The array is of length numStages.
3837 void arm_fir_lattice_init_f32(
3838 arm_fir_lattice_instance_f32 * S,
3840 const float32_t * pCoeffs,
3841 float32_t * pState);
3845 * @brief Processing function for the floating-point FIR lattice filter.
3846 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3847 * @param[in] pSrc points to the block of input data.
3848 * @param[out] pDst points to the block of output data
3849 * @param[in] blockSize number of samples to process.
3851 void arm_fir_lattice_f32(
3852 const arm_fir_lattice_instance_f32 * S,
3853 const float32_t * pSrc,
3855 uint32_t blockSize);
3859 * @brief Instance structure for the Q15 IIR lattice filter.
3863 uint16_t numStages; /**< number of stages in the filter. */
3864 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3865 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3866 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3867 } arm_iir_lattice_instance_q15;
3870 * @brief Instance structure for the Q31 IIR lattice filter.
3874 uint16_t numStages; /**< number of stages in the filter. */
3875 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3876 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3877 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3878 } arm_iir_lattice_instance_q31;
3881 * @brief Instance structure for the floating-point IIR lattice filter.
3885 uint16_t numStages; /**< number of stages in the filter. */
3886 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3887 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3888 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3889 } arm_iir_lattice_instance_f32;
3893 * @brief Processing function for the floating-point IIR lattice filter.
3894 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3895 * @param[in] pSrc points to the block of input data.
3896 * @param[out] pDst points to the block of output data.
3897 * @param[in] blockSize number of samples to process.
3899 void arm_iir_lattice_f32(
3900 const arm_iir_lattice_instance_f32 * S,
3901 const float32_t * pSrc,
3903 uint32_t blockSize);
3907 * @brief Initialization function for the floating-point IIR lattice filter.
3908 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3909 * @param[in] numStages number of stages in the filter.
3910 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3911 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3912 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
3913 * @param[in] blockSize number of samples to process.
3915 void arm_iir_lattice_init_f32(
3916 arm_iir_lattice_instance_f32 * S,
3918 float32_t * pkCoeffs,
3919 float32_t * pvCoeffs,
3921 uint32_t blockSize);
3925 * @brief Processing function for the Q31 IIR lattice filter.
3926 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3927 * @param[in] pSrc points to the block of input data.
3928 * @param[out] pDst points to the block of output data.
3929 * @param[in] blockSize number of samples to process.
3931 void arm_iir_lattice_q31(
3932 const arm_iir_lattice_instance_q31 * S,
3935 uint32_t blockSize);
3939 * @brief Initialization function for the Q31 IIR lattice filter.
3940 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3941 * @param[in] numStages number of stages in the filter.
3942 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3943 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3944 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
3945 * @param[in] blockSize number of samples to process.
3947 void arm_iir_lattice_init_q31(
3948 arm_iir_lattice_instance_q31 * S,
3953 uint32_t blockSize);
3957 * @brief Processing function for the Q15 IIR lattice filter.
3958 * @param[in] S points to an instance of the Q15 IIR lattice structure.
3959 * @param[in] pSrc points to the block of input data.
3960 * @param[out] pDst points to the block of output data.
3961 * @param[in] blockSize number of samples to process.
3963 void arm_iir_lattice_q15(
3964 const arm_iir_lattice_instance_q15 * S,
3967 uint32_t blockSize);
3971 * @brief Initialization function for the Q15 IIR lattice filter.
3972 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
3973 * @param[in] numStages number of stages in the filter.
3974 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
3975 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
3976 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
3977 * @param[in] blockSize number of samples to process per call.
3979 void arm_iir_lattice_init_q15(
3980 arm_iir_lattice_instance_q15 * S,
3985 uint32_t blockSize);
3989 * @brief Instance structure for the floating-point LMS filter.
3993 uint16_t numTaps; /**< number of coefficients in the filter. */
3994 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3995 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
3996 float32_t mu; /**< step size that controls filter coefficient updates. */
3997 } arm_lms_instance_f32;
4001 * @brief Processing function for floating-point LMS filter.
4002 * @param[in] S points to an instance of the floating-point LMS filter structure.
4003 * @param[in] pSrc points to the block of input data.
4004 * @param[in] pRef points to the block of reference data.
4005 * @param[out] pOut points to the block of output data.
4006 * @param[out] pErr points to the block of error data.
4007 * @param[in] blockSize number of samples to process.
4010 const arm_lms_instance_f32 * S,
4011 const float32_t * pSrc,
4015 uint32_t blockSize);
4019 * @brief Initialization function for floating-point LMS filter.
4020 * @param[in] S points to an instance of the floating-point LMS filter structure.
4021 * @param[in] numTaps number of filter coefficients.
4022 * @param[in] pCoeffs points to the coefficient buffer.
4023 * @param[in] pState points to state buffer.
4024 * @param[in] mu step size that controls filter coefficient updates.
4025 * @param[in] blockSize number of samples to process.
4027 void arm_lms_init_f32(
4028 arm_lms_instance_f32 * S,
4030 float32_t * pCoeffs,
4033 uint32_t blockSize);
4037 * @brief Instance structure for the Q15 LMS filter.
4041 uint16_t numTaps; /**< number of coefficients in the filter. */
4042 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4043 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4044 q15_t mu; /**< step size that controls filter coefficient updates. */
4045 uint32_t postShift; /**< bit shift applied to coefficients. */
4046 } arm_lms_instance_q15;
4050 * @brief Initialization function for the Q15 LMS filter.
4051 * @param[in] S points to an instance of the Q15 LMS filter structure.
4052 * @param[in] numTaps number of filter coefficients.
4053 * @param[in] pCoeffs points to the coefficient buffer.
4054 * @param[in] pState points to the state buffer.
4055 * @param[in] mu step size that controls filter coefficient updates.
4056 * @param[in] blockSize number of samples to process.
4057 * @param[in] postShift bit shift applied to coefficients.
4059 void arm_lms_init_q15(
4060 arm_lms_instance_q15 * S,
4066 uint32_t postShift);
4070 * @brief Processing function for Q15 LMS filter.
4071 * @param[in] S points to an instance of the Q15 LMS filter structure.
4072 * @param[in] pSrc points to the block of input data.
4073 * @param[in] pRef points to the block of reference data.
4074 * @param[out] pOut points to the block of output data.
4075 * @param[out] pErr points to the block of error data.
4076 * @param[in] blockSize number of samples to process.
4079 const arm_lms_instance_q15 * S,
4084 uint32_t blockSize);
4088 * @brief Instance structure for the Q31 LMS filter.
4092 uint16_t numTaps; /**< number of coefficients in the filter. */
4093 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4094 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4095 q31_t mu; /**< step size that controls filter coefficient updates. */
4096 uint32_t postShift; /**< bit shift applied to coefficients. */
4097 } arm_lms_instance_q31;
4101 * @brief Processing function for Q31 LMS filter.
4102 * @param[in] S points to an instance of the Q15 LMS filter structure.
4103 * @param[in] pSrc points to the block of input data.
4104 * @param[in] pRef points to the block of reference data.
4105 * @param[out] pOut points to the block of output data.
4106 * @param[out] pErr points to the block of error data.
4107 * @param[in] blockSize number of samples to process.
4110 const arm_lms_instance_q31 * S,
4115 uint32_t blockSize);
4119 * @brief Initialization function for Q31 LMS filter.
4120 * @param[in] S points to an instance of the Q31 LMS filter structure.
4121 * @param[in] numTaps number of filter coefficients.
4122 * @param[in] pCoeffs points to coefficient buffer.
4123 * @param[in] pState points to state buffer.
4124 * @param[in] mu step size that controls filter coefficient updates.
4125 * @param[in] blockSize number of samples to process.
4126 * @param[in] postShift bit shift applied to coefficients.
4128 void arm_lms_init_q31(
4129 arm_lms_instance_q31 * S,
4135 uint32_t postShift);
4139 * @brief Instance structure for the floating-point normalized LMS filter.
4143 uint16_t numTaps; /**< number of coefficients in the filter. */
4144 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4145 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4146 float32_t mu; /**< step size that control filter coefficient updates. */
4147 float32_t energy; /**< saves previous frame energy. */
4148 float32_t x0; /**< saves previous input sample. */
4149 } arm_lms_norm_instance_f32;
4153 * @brief Processing function for floating-point normalized LMS filter.
4154 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
4155 * @param[in] pSrc points to the block of input data.
4156 * @param[in] pRef points to the block of reference data.
4157 * @param[out] pOut points to the block of output data.
4158 * @param[out] pErr points to the block of error data.
4159 * @param[in] blockSize number of samples to process.
4161 void arm_lms_norm_f32(
4162 arm_lms_norm_instance_f32 * S,
4163 const float32_t * pSrc,
4167 uint32_t blockSize);
4171 * @brief Initialization function for floating-point normalized LMS filter.
4172 * @param[in] S points to an instance of the floating-point LMS filter structure.
4173 * @param[in] numTaps number of filter coefficients.
4174 * @param[in] pCoeffs points to coefficient buffer.
4175 * @param[in] pState points to state buffer.
4176 * @param[in] mu step size that controls filter coefficient updates.
4177 * @param[in] blockSize number of samples to process.
4179 void arm_lms_norm_init_f32(
4180 arm_lms_norm_instance_f32 * S,
4182 float32_t * pCoeffs,
4185 uint32_t blockSize);
4189 * @brief Instance structure for the Q31 normalized LMS filter.
4193 uint16_t numTaps; /**< number of coefficients in the filter. */
4194 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4195 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4196 q31_t mu; /**< step size that controls filter coefficient updates. */
4197 uint8_t postShift; /**< bit shift applied to coefficients. */
4198 const q31_t *recipTable; /**< points to the reciprocal initial value table. */
4199 q31_t energy; /**< saves previous frame energy. */
4200 q31_t x0; /**< saves previous input sample. */
4201 } arm_lms_norm_instance_q31;
4205 * @brief Processing function for Q31 normalized LMS filter.
4206 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4207 * @param[in] pSrc points to the block of input data.
4208 * @param[in] pRef points to the block of reference data.
4209 * @param[out] pOut points to the block of output data.
4210 * @param[out] pErr points to the block of error data.
4211 * @param[in] blockSize number of samples to process.
4213 void arm_lms_norm_q31(
4214 arm_lms_norm_instance_q31 * S,
4219 uint32_t blockSize);
4223 * @brief Initialization function for Q31 normalized LMS filter.
4224 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4225 * @param[in] numTaps number of filter coefficients.
4226 * @param[in] pCoeffs points to coefficient buffer.
4227 * @param[in] pState points to state buffer.
4228 * @param[in] mu step size that controls filter coefficient updates.
4229 * @param[in] blockSize number of samples to process.
4230 * @param[in] postShift bit shift applied to coefficients.
4232 void arm_lms_norm_init_q31(
4233 arm_lms_norm_instance_q31 * S,
4243 * @brief Instance structure for the Q15 normalized LMS filter.
4247 uint16_t numTaps; /**< Number of coefficients in the filter. */
4248 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4249 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4250 q15_t mu; /**< step size that controls filter coefficient updates. */
4251 uint8_t postShift; /**< bit shift applied to coefficients. */
4252 const q15_t *recipTable; /**< Points to the reciprocal initial value table. */
4253 q15_t energy; /**< saves previous frame energy. */
4254 q15_t x0; /**< saves previous input sample. */
4255 } arm_lms_norm_instance_q15;
4259 * @brief Processing function for Q15 normalized LMS filter.
4260 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4261 * @param[in] pSrc points to the block of input data.
4262 * @param[in] pRef points to the block of reference data.
4263 * @param[out] pOut points to the block of output data.
4264 * @param[out] pErr points to the block of error data.
4265 * @param[in] blockSize number of samples to process.
4267 void arm_lms_norm_q15(
4268 arm_lms_norm_instance_q15 * S,
4273 uint32_t blockSize);
4277 * @brief Initialization function for Q15 normalized LMS filter.
4278 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4279 * @param[in] numTaps number of filter coefficients.
4280 * @param[in] pCoeffs points to coefficient buffer.
4281 * @param[in] pState points to state buffer.
4282 * @param[in] mu step size that controls filter coefficient updates.
4283 * @param[in] blockSize number of samples to process.
4284 * @param[in] postShift bit shift applied to coefficients.
4286 void arm_lms_norm_init_q15(
4287 arm_lms_norm_instance_q15 * S,
4297 * @brief Correlation of floating-point sequences.
4298 * @param[in] pSrcA points to the first input sequence.
4299 * @param[in] srcALen length of the first input sequence.
4300 * @param[in] pSrcB points to the second input sequence.
4301 * @param[in] srcBLen length of the second input sequence.
4302 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4304 void arm_correlate_f32(
4305 const float32_t * pSrcA,
4307 const float32_t * pSrcB,
4313 @brief Correlation of Q15 sequences
4314 @param[in] pSrcA points to the first input sequence
4315 @param[in] srcALen length of the first input sequence
4316 @param[in] pSrcB points to the second input sequence
4317 @param[in] srcBLen length of the second input sequence
4318 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4319 @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4321 void arm_correlate_opt_q15(
4322 const q15_t * pSrcA,
4324 const q15_t * pSrcB,
4331 @brief Correlation of Q15 sequences.
4332 @param[in] pSrcA points to the first input sequence
4333 @param[in] srcALen length of the first input sequence
4334 @param[in] pSrcB points to the second input sequence
4335 @param[in] srcBLen length of the second input sequence
4336 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4338 void arm_correlate_q15(
4339 const q15_t * pSrcA,
4341 const q15_t * pSrcB,
4347 @brief Correlation of Q15 sequences (fast version).
4348 @param[in] pSrcA points to the first input sequence
4349 @param[in] srcALen length of the first input sequence
4350 @param[in] pSrcB points to the second input sequence
4351 @param[in] srcBLen length of the second input sequence
4352 @param[out] pDst points to the location where the output result is written. Length 2 * max(srcALen, srcBLen) - 1.
4355 void arm_correlate_fast_q15(
4356 const q15_t * pSrcA,
4358 const q15_t * pSrcB,
4364 @brief Correlation of Q15 sequences (fast version).
4365 @param[in] pSrcA points to the first input sequence.
4366 @param[in] srcALen length of the first input sequence.
4367 @param[in] pSrcB points to the second input sequence.
4368 @param[in] srcBLen length of the second input sequence.
4369 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4370 @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4372 void arm_correlate_fast_opt_q15(
4373 const q15_t * pSrcA,
4375 const q15_t * pSrcB,
4382 * @brief Correlation of Q31 sequences.
4383 * @param[in] pSrcA points to the first input sequence.
4384 * @param[in] srcALen length of the first input sequence.
4385 * @param[in] pSrcB points to the second input sequence.
4386 * @param[in] srcBLen length of the second input sequence.
4387 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4389 void arm_correlate_q31(
4390 const q31_t * pSrcA,
4392 const q31_t * pSrcB,
4398 @brief Correlation of Q31 sequences (fast version).
4399 @param[in] pSrcA points to the first input sequence
4400 @param[in] srcALen length of the first input sequence
4401 @param[in] pSrcB points to the second input sequence
4402 @param[in] srcBLen length of the second input sequence
4403 @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4405 void arm_correlate_fast_q31(
4406 const q31_t * pSrcA,
4408 const q31_t * pSrcB,
4414 * @brief Correlation of Q7 sequences.
4415 * @param[in] pSrcA points to the first input sequence.
4416 * @param[in] srcALen length of the first input sequence.
4417 * @param[in] pSrcB points to the second input sequence.
4418 * @param[in] srcBLen length of the second input sequence.
4419 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4420 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4421 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
4423 void arm_correlate_opt_q7(
4434 * @brief Correlation of Q7 sequences.
4435 * @param[in] pSrcA points to the first input sequence.
4436 * @param[in] srcALen length of the first input sequence.
4437 * @param[in] pSrcB points to the second input sequence.
4438 * @param[in] srcBLen length of the second input sequence.
4439 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4441 void arm_correlate_q7(
4450 * @brief Instance structure for the floating-point sparse FIR filter.
4454 uint16_t numTaps; /**< number of coefficients in the filter. */
4455 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4456 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4457 const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4458 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4459 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4460 } arm_fir_sparse_instance_f32;
4463 * @brief Instance structure for the Q31 sparse FIR filter.
4467 uint16_t numTaps; /**< number of coefficients in the filter. */
4468 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4469 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4470 const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4471 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4472 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4473 } arm_fir_sparse_instance_q31;
4476 * @brief Instance structure for the Q15 sparse FIR filter.
4480 uint16_t numTaps; /**< number of coefficients in the filter. */
4481 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4482 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4483 const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4484 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4485 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4486 } arm_fir_sparse_instance_q15;
4489 * @brief Instance structure for the Q7 sparse FIR filter.
4493 uint16_t numTaps; /**< number of coefficients in the filter. */
4494 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4495 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4496 const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4497 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4498 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4499 } arm_fir_sparse_instance_q7;
4503 * @brief Processing function for the floating-point sparse FIR filter.
4504 * @param[in] S points to an instance of the floating-point sparse FIR structure.
4505 * @param[in] pSrc points to the block of input data.
4506 * @param[out] pDst points to the block of output data
4507 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4508 * @param[in] blockSize number of input samples to process per call.
4510 void arm_fir_sparse_f32(
4511 arm_fir_sparse_instance_f32 * S,
4512 const float32_t * pSrc,
4514 float32_t * pScratchIn,
4515 uint32_t blockSize);
4519 * @brief Initialization function for the floating-point sparse FIR filter.
4520 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
4521 * @param[in] numTaps number of nonzero coefficients in the filter.
4522 * @param[in] pCoeffs points to the array of filter coefficients.
4523 * @param[in] pState points to the state buffer.
4524 * @param[in] pTapDelay points to the array of offset times.
4525 * @param[in] maxDelay maximum offset time supported.
4526 * @param[in] blockSize number of samples that will be processed per block.
4528 void arm_fir_sparse_init_f32(
4529 arm_fir_sparse_instance_f32 * S,
4531 const float32_t * pCoeffs,
4533 int32_t * pTapDelay,
4535 uint32_t blockSize);
4539 * @brief Processing function for the Q31 sparse FIR filter.
4540 * @param[in] S points to an instance of the Q31 sparse FIR structure.
4541 * @param[in] pSrc points to the block of input data.
4542 * @param[out] pDst points to the block of output data
4543 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4544 * @param[in] blockSize number of input samples to process per call.
4546 void arm_fir_sparse_q31(
4547 arm_fir_sparse_instance_q31 * S,
4551 uint32_t blockSize);
4555 * @brief Initialization function for the Q31 sparse FIR filter.
4556 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
4557 * @param[in] numTaps number of nonzero coefficients in the filter.
4558 * @param[in] pCoeffs points to the array of filter coefficients.
4559 * @param[in] pState points to the state buffer.
4560 * @param[in] pTapDelay points to the array of offset times.
4561 * @param[in] maxDelay maximum offset time supported.
4562 * @param[in] blockSize number of samples that will be processed per block.
4564 void arm_fir_sparse_init_q31(
4565 arm_fir_sparse_instance_q31 * S,
4567 const q31_t * pCoeffs,
4569 int32_t * pTapDelay,
4571 uint32_t blockSize);
4575 * @brief Processing function for the Q15 sparse FIR filter.
4576 * @param[in] S points to an instance of the Q15 sparse FIR structure.
4577 * @param[in] pSrc points to the block of input data.
4578 * @param[out] pDst points to the block of output data
4579 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4580 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4581 * @param[in] blockSize number of input samples to process per call.
4583 void arm_fir_sparse_q15(
4584 arm_fir_sparse_instance_q15 * S,
4588 q31_t * pScratchOut,
4589 uint32_t blockSize);
4593 * @brief Initialization function for the Q15 sparse FIR filter.
4594 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
4595 * @param[in] numTaps number of nonzero coefficients in the filter.
4596 * @param[in] pCoeffs points to the array of filter coefficients.
4597 * @param[in] pState points to the state buffer.
4598 * @param[in] pTapDelay points to the array of offset times.
4599 * @param[in] maxDelay maximum offset time supported.
4600 * @param[in] blockSize number of samples that will be processed per block.
4602 void arm_fir_sparse_init_q15(
4603 arm_fir_sparse_instance_q15 * S,
4605 const q15_t * pCoeffs,
4607 int32_t * pTapDelay,
4609 uint32_t blockSize);
4613 * @brief Processing function for the Q7 sparse FIR filter.
4614 * @param[in] S points to an instance of the Q7 sparse FIR structure.
4615 * @param[in] pSrc points to the block of input data.
4616 * @param[out] pDst points to the block of output data
4617 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4618 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4619 * @param[in] blockSize number of input samples to process per call.
4621 void arm_fir_sparse_q7(
4622 arm_fir_sparse_instance_q7 * S,
4626 q31_t * pScratchOut,
4627 uint32_t blockSize);
4631 * @brief Initialization function for the Q7 sparse FIR filter.
4632 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
4633 * @param[in] numTaps number of nonzero coefficients in the filter.
4634 * @param[in] pCoeffs points to the array of filter coefficients.
4635 * @param[in] pState points to the state buffer.
4636 * @param[in] pTapDelay points to the array of offset times.
4637 * @param[in] maxDelay maximum offset time supported.
4638 * @param[in] blockSize number of samples that will be processed per block.
4640 void arm_fir_sparse_init_q7(
4641 arm_fir_sparse_instance_q7 * S,
4643 const q7_t * pCoeffs,
4645 int32_t * pTapDelay,
4647 uint32_t blockSize);
4651 * @brief Floating-point sin_cos function.
4652 * @param[in] theta input value in degrees
4653 * @param[out] pSinVal points to the processed sine output.
4654 * @param[out] pCosVal points to the processed cos output.
4656 void arm_sin_cos_f32(
4658 float32_t * pSinVal,
4659 float32_t * pCosVal);
4663 * @brief Q31 sin_cos function.
4664 * @param[in] theta scaled input value in degrees
4665 * @param[out] pSinVal points to the processed sine output.
4666 * @param[out] pCosVal points to the processed cosine output.
4668 void arm_sin_cos_q31(
4675 * @brief Floating-point complex conjugate.
4676 * @param[in] pSrc points to the input vector
4677 * @param[out] pDst points to the output vector
4678 * @param[in] numSamples number of complex samples in each vector
4680 void arm_cmplx_conj_f32(
4681 const float32_t * pSrc,
4683 uint32_t numSamples);
4686 * @brief Q31 complex conjugate.
4687 * @param[in] pSrc points to the input vector
4688 * @param[out] pDst points to the output vector
4689 * @param[in] numSamples number of complex samples in each vector
4691 void arm_cmplx_conj_q31(
4694 uint32_t numSamples);
4698 * @brief Q15 complex conjugate.
4699 * @param[in] pSrc points to the input vector
4700 * @param[out] pDst points to the output vector
4701 * @param[in] numSamples number of complex samples in each vector
4703 void arm_cmplx_conj_q15(
4706 uint32_t numSamples);
4710 * @brief Floating-point complex magnitude squared
4711 * @param[in] pSrc points to the complex input vector
4712 * @param[out] pDst points to the real output vector
4713 * @param[in] numSamples number of complex samples in the input vector
4715 void arm_cmplx_mag_squared_f32(
4716 const float32_t * pSrc,
4718 uint32_t numSamples);
4722 * @brief Q31 complex magnitude squared
4723 * @param[in] pSrc points to the complex input vector
4724 * @param[out] pDst points to the real output vector
4725 * @param[in] numSamples number of complex samples in the input vector
4727 void arm_cmplx_mag_squared_q31(
4730 uint32_t numSamples);
4734 * @brief Q15 complex magnitude squared
4735 * @param[in] pSrc points to the complex input vector
4736 * @param[out] pDst points to the real output vector
4737 * @param[in] numSamples number of complex samples in the input vector
4739 void arm_cmplx_mag_squared_q15(
4742 uint32_t numSamples);
4746 * @ingroup groupController
4750 * @defgroup PID PID Motor Control
4752 * A Proportional Integral Derivative (PID) controller is a generic feedback control
4753 * loop mechanism widely used in industrial control systems.
4754 * A PID controller is the most commonly used type of feedback controller.
4756 * This set of functions implements (PID) controllers
4757 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
4758 * of data and each call to the function returns a single processed value.
4759 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
4760 * is the input sample value. The functions return the output value.
4764 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
4766 * A1 = (-Kp ) - (2 * Kd )
4771 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
4774 * \image html PID.gif "Proportional Integral Derivative Controller"
4777 * The PID controller calculates an "error" value as the difference between
4778 * the measured output and the reference input.
4779 * The controller attempts to minimize the error by adjusting the process control inputs.
4780 * The proportional value determines the reaction to the current error,
4781 * the integral value determines the reaction based on the sum of recent errors,
4782 * and the derivative value determines the reaction based on the rate at which the error has been changing.
4784 * \par Instance Structure
4785 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
4786 * A separate instance structure must be defined for each PID Controller.
4787 * There are separate instance structure declarations for each of the 3 supported data types.
4789 * \par Reset Functions
4790 * There is also an associated reset function for each data type which clears the state array.
4792 * \par Initialization Functions
4793 * There is also an associated initialization function for each data type.
4794 * The initialization function performs the following operations:
4795 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
4796 * - Zeros out the values in the state buffer.
4799 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
4801 * \par Fixed-Point Behavior
4802 * Care must be taken when using the fixed-point versions of the PID Controller functions.
4803 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
4804 * Refer to the function specific documentation below for usage guidelines.
4813 * @brief Process function for the floating-point PID Control.
4814 * @param[in,out] S is an instance of the floating-point PID Control structure
4815 * @param[in] in input sample to process
4816 * @return processed output sample.
4818 __STATIC_FORCEINLINE float32_t arm_pid_f32(
4819 arm_pid_instance_f32 * S,
4824 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
4825 out = (S->A0 * in) +
4826 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
4829 S->state[1] = S->state[0];
4833 /* return to application */
4839 @brief Process function for the Q31 PID Control.
4840 @param[in,out] S points to an instance of the Q31 PID Control structure
4841 @param[in] in input sample to process
4842 @return processed output sample.
4844 \par Scaling and Overflow Behavior
4845 The function is implemented using an internal 64-bit accumulator.
4846 The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
4847 Thus, if the accumulator result overflows it wraps around rather than clip.
4848 In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
4849 After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
4851 __STATIC_FORCEINLINE q31_t arm_pid_q31(
4852 arm_pid_instance_q31 * S,
4858 /* acc = A0 * x[n] */
4859 acc = (q63_t) S->A0 * in;
4861 /* acc += A1 * x[n-1] */
4862 acc += (q63_t) S->A1 * S->state[0];
4864 /* acc += A2 * x[n-2] */
4865 acc += (q63_t) S->A2 * S->state[1];
4867 /* convert output to 1.31 format to add y[n-1] */
4868 out = (q31_t) (acc >> 31U);
4874 S->state[1] = S->state[0];
4878 /* return to application */
4884 @brief Process function for the Q15 PID Control.
4885 @param[in,out] S points to an instance of the Q15 PID Control structure
4886 @param[in] in input sample to process
4887 @return processed output sample.
4889 \par Scaling and Overflow Behavior
4890 The function is implemented using a 64-bit internal accumulator.
4891 Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
4892 The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
4893 There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
4894 After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
4895 Lastly, the accumulator is saturated to yield a result in 1.15 format.
4897 __STATIC_FORCEINLINE q15_t arm_pid_q15(
4898 arm_pid_instance_q15 * S,
4904 #if defined (ARM_MATH_DSP)
4905 /* Implementation of PID controller */
4907 /* acc = A0 * x[n] */
4908 acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
4910 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4911 acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)read_q15x2 (S->state), (uint64_t)acc);
4913 /* acc = A0 * x[n] */
4914 acc = ((q31_t) S->A0) * in;
4916 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4917 acc += (q31_t) S->A1 * S->state[0];
4918 acc += (q31_t) S->A2 * S->state[1];
4922 acc += (q31_t) S->state[2] << 15;
4924 /* saturate the output */
4925 out = (q15_t) (__SSAT((acc >> 15), 16));
4928 S->state[1] = S->state[0];
4932 /* return to application */
4937 * @} end of PID group
4942 * @brief Floating-point matrix inverse.
4943 * @param[in] src points to the instance of the input floating-point matrix structure.
4944 * @param[out] dst points to the instance of the output floating-point matrix structure.
4945 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4946 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4948 arm_status arm_mat_inverse_f32(
4949 const arm_matrix_instance_f32 * src,
4950 arm_matrix_instance_f32 * dst);
4954 * @brief Floating-point matrix inverse.
4955 * @param[in] src points to the instance of the input floating-point matrix structure.
4956 * @param[out] dst points to the instance of the output floating-point matrix structure.
4957 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4958 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4960 arm_status arm_mat_inverse_f64(
4961 const arm_matrix_instance_f64 * src,
4962 arm_matrix_instance_f64 * dst);
4967 * @ingroup groupController
4971 * @defgroup clarke Vector Clarke Transform
4972 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
4973 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
4974 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
4975 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
4976 * \image html clarke.gif Stator current space vector and its components in (a,b).
4977 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
4978 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
4980 * The function operates on a single sample of data and each call to the function returns the processed output.
4981 * The library provides separate functions for Q31 and floating-point data types.
4983 * \image html clarkeFormula.gif
4984 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
4985 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
4986 * \par Fixed-Point Behavior
4987 * Care must be taken when using the Q31 version of the Clarke transform.
4988 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
4989 * Refer to the function specific documentation below for usage guidelines.
4993 * @addtogroup clarke
4999 * @brief Floating-point Clarke transform
5000 * @param[in] Ia input three-phase coordinate <code>a</code>
5001 * @param[in] Ib input three-phase coordinate <code>b</code>
5002 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5003 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5006 __STATIC_FORCEINLINE void arm_clarke_f32(
5009 float32_t * pIalpha,
5012 /* Calculate pIalpha using the equation, pIalpha = Ia */
5015 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
5016 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
5021 @brief Clarke transform for Q31 version
5022 @param[in] Ia input three-phase coordinate <code>a</code>
5023 @param[in] Ib input three-phase coordinate <code>b</code>
5024 @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5025 @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5028 \par Scaling and Overflow Behavior
5029 The function is implemented using an internal 32-bit accumulator.
5030 The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5031 There is saturation on the addition, hence there is no risk of overflow.
5033 __STATIC_FORCEINLINE void arm_clarke_q31(
5039 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5041 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
5044 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
5045 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
5047 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
5048 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
5050 /* pIbeta is calculated by adding the intermediate products */
5051 *pIbeta = __QADD(product1, product2);
5055 * @} end of clarke group
5060 * @ingroup groupController
5064 * @defgroup inv_clarke Vector Inverse Clarke Transform
5065 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
5067 * The function operates on a single sample of data and each call to the function returns the processed output.
5068 * The library provides separate functions for Q31 and floating-point data types.
5070 * \image html clarkeInvFormula.gif
5071 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
5072 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
5073 * \par Fixed-Point Behavior
5074 * Care must be taken when using the Q31 version of the Clarke transform.
5075 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5076 * Refer to the function specific documentation below for usage guidelines.
5080 * @addtogroup inv_clarke
5085 * @brief Floating-point Inverse Clarke transform
5086 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5087 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5088 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5089 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5092 __STATIC_FORCEINLINE void arm_inv_clarke_f32(
5098 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5101 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
5102 *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
5107 @brief Inverse Clarke transform for Q31 version
5108 @param[in] Ialpha input two-phase orthogonal vector axis alpha
5109 @param[in] Ibeta input two-phase orthogonal vector axis beta
5110 @param[out] pIa points to output three-phase coordinate <code>a</code>
5111 @param[out] pIb points to output three-phase coordinate <code>b</code>
5114 \par Scaling and Overflow Behavior
5115 The function is implemented using an internal 32-bit accumulator.
5116 The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5117 There is saturation on the subtraction, hence there is no risk of overflow.
5119 __STATIC_FORCEINLINE void arm_inv_clarke_q31(
5125 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5127 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5130 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
5131 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
5133 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
5134 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
5136 /* pIb is calculated by subtracting the products */
5137 *pIb = __QSUB(product2, product1);
5141 * @} end of inv_clarke group
5147 * @ingroup groupController
5151 * @defgroup park Vector Park Transform
5153 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
5154 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
5155 * from the stationary to the moving reference frame and control the spatial relationship between
5156 * the stator vector current and rotor flux vector.
5157 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
5158 * current vector and the relationship from the two reference frames:
5159 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
5161 * The function operates on a single sample of data and each call to the function returns the processed output.
5162 * The library provides separate functions for Q31 and floating-point data types.
5164 * \image html parkFormula.gif
5165 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
5166 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5167 * cosine and sine values of theta (rotor flux position).
5168 * \par Fixed-Point Behavior
5169 * Care must be taken when using the Q31 version of the Park transform.
5170 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5171 * Refer to the function specific documentation below for usage guidelines.
5180 * @brief Floating-point Park transform
5181 * @param[in] Ialpha input two-phase vector coordinate alpha
5182 * @param[in] Ibeta input two-phase vector coordinate beta
5183 * @param[out] pId points to output rotor reference frame d
5184 * @param[out] pIq points to output rotor reference frame q
5185 * @param[in] sinVal sine value of rotation angle theta
5186 * @param[in] cosVal cosine value of rotation angle theta
5189 * The function implements the forward Park transform.
5192 __STATIC_FORCEINLINE void arm_park_f32(
5200 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
5201 *pId = Ialpha * cosVal + Ibeta * sinVal;
5203 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
5204 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
5209 @brief Park transform for Q31 version
5210 @param[in] Ialpha input two-phase vector coordinate alpha
5211 @param[in] Ibeta input two-phase vector coordinate beta
5212 @param[out] pId points to output rotor reference frame d
5213 @param[out] pIq points to output rotor reference frame q
5214 @param[in] sinVal sine value of rotation angle theta
5215 @param[in] cosVal cosine value of rotation angle theta
5218 \par Scaling and Overflow Behavior
5219 The function is implemented using an internal 32-bit accumulator.
5220 The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5221 There is saturation on the addition and subtraction, hence there is no risk of overflow.
5223 __STATIC_FORCEINLINE void arm_park_q31(
5231 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5232 q31_t product3, product4; /* Temporary variables used to store intermediate results */
5234 /* Intermediate product is calculated by (Ialpha * cosVal) */
5235 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
5237 /* Intermediate product is calculated by (Ibeta * sinVal) */
5238 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
5241 /* Intermediate product is calculated by (Ialpha * sinVal) */
5242 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
5244 /* Intermediate product is calculated by (Ibeta * cosVal) */
5245 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
5247 /* Calculate pId by adding the two intermediate products 1 and 2 */
5248 *pId = __QADD(product1, product2);
5250 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
5251 *pIq = __QSUB(product4, product3);
5255 * @} end of park group
5260 * @ingroup groupController
5264 * @defgroup inv_park Vector Inverse Park transform
5265 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
5267 * The function operates on a single sample of data and each call to the function returns the processed output.
5268 * The library provides separate functions for Q31 and floating-point data types.
5270 * \image html parkInvFormula.gif
5271 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
5272 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5273 * cosine and sine values of theta (rotor flux position).
5274 * \par Fixed-Point Behavior
5275 * Care must be taken when using the Q31 version of the Park transform.
5276 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5277 * Refer to the function specific documentation below for usage guidelines.
5281 * @addtogroup inv_park
5286 * @brief Floating-point Inverse Park transform
5287 * @param[in] Id input coordinate of rotor reference frame d
5288 * @param[in] Iq input coordinate of rotor reference frame q
5289 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5290 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5291 * @param[in] sinVal sine value of rotation angle theta
5292 * @param[in] cosVal cosine value of rotation angle theta
5295 __STATIC_FORCEINLINE void arm_inv_park_f32(
5298 float32_t * pIalpha,
5303 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
5304 *pIalpha = Id * cosVal - Iq * sinVal;
5306 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
5307 *pIbeta = Id * sinVal + Iq * cosVal;
5312 @brief Inverse Park transform for Q31 version
5313 @param[in] Id input coordinate of rotor reference frame d
5314 @param[in] Iq input coordinate of rotor reference frame q
5315 @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5316 @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5317 @param[in] sinVal sine value of rotation angle theta
5318 @param[in] cosVal cosine value of rotation angle theta
5321 @par Scaling and Overflow Behavior
5322 The function is implemented using an internal 32-bit accumulator.
5323 The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5324 There is saturation on the addition, hence there is no risk of overflow.
5326 __STATIC_FORCEINLINE void arm_inv_park_q31(
5334 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5335 q31_t product3, product4; /* Temporary variables used to store intermediate results */
5337 /* Intermediate product is calculated by (Id * cosVal) */
5338 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
5340 /* Intermediate product is calculated by (Iq * sinVal) */
5341 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
5344 /* Intermediate product is calculated by (Id * sinVal) */
5345 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
5347 /* Intermediate product is calculated by (Iq * cosVal) */
5348 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
5350 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
5351 *pIalpha = __QSUB(product1, product2);
5353 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
5354 *pIbeta = __QADD(product4, product3);
5358 * @} end of Inverse park group
5363 * @ingroup groupInterpolation
5367 * @defgroup LinearInterpolate Linear Interpolation
5369 * Linear interpolation is a method of curve fitting using linear polynomials.
5370 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
5373 * \image html LinearInterp.gif "Linear interpolation"
5376 * A Linear Interpolate function calculates an output value(y), for the input(x)
5377 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
5381 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
5382 * where x0, x1 are nearest values of input x
5383 * y0, y1 are nearest values to output y
5387 * This set of functions implements Linear interpolation process
5388 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
5389 * sample of data and each call to the function returns a single processed value.
5390 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
5391 * <code>x</code> is the input sample value. The functions returns the output value.
5394 * if x is outside of the table boundary, Linear interpolation returns first value of the table
5395 * if x is below input range and returns last value of table if x is above range.
5399 * @addtogroup LinearInterpolate
5404 * @brief Process function for the floating-point Linear Interpolation Function.
5405 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
5406 * @param[in] x input sample to process
5407 * @return y processed output sample.
5410 __STATIC_FORCEINLINE float32_t arm_linear_interp_f32(
5411 arm_linear_interp_instance_f32 * S,
5415 float32_t x0, x1; /* Nearest input values */
5416 float32_t y0, y1; /* Nearest output values */
5417 float32_t xSpacing = S->xSpacing; /* spacing between input values */
5418 int32_t i; /* Index variable */
5419 float32_t *pYData = S->pYData; /* pointer to output table */
5421 /* Calculation of index */
5422 i = (int32_t) ((x - S->x1) / xSpacing);
5426 /* Iniatilize output for below specified range as least output value of table */
5429 else if ((uint32_t)i >= S->nValues)
5431 /* Iniatilize output for above specified range as last output value of table */
5432 y = pYData[S->nValues - 1];
5436 /* Calculation of nearest input values */
5437 x0 = S->x1 + i * xSpacing;
5438 x1 = S->x1 + (i + 1) * xSpacing;
5440 /* Read of nearest output values */
5444 /* Calculation of output */
5445 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
5449 /* returns output value */
5456 * @brief Process function for the Q31 Linear Interpolation Function.
5457 * @param[in] pYData pointer to Q31 Linear Interpolation table
5458 * @param[in] x input sample to process
5459 * @param[in] nValues number of table values
5460 * @return y processed output sample.
5463 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5464 * This function can support maximum of table size 2^12.
5467 __STATIC_FORCEINLINE q31_t arm_linear_interp_q31(
5472 q31_t y; /* output */
5473 q31_t y0, y1; /* Nearest output values */
5474 q31_t fract; /* fractional part */
5475 int32_t index; /* Index to read nearest output values */
5477 /* Input is in 12.20 format */
5478 /* 12 bits for the table index */
5479 /* Index value calculation */
5480 index = ((x & (q31_t)0xFFF00000) >> 20);
5482 if (index >= (int32_t)(nValues - 1))
5484 return (pYData[nValues - 1]);
5492 /* 20 bits for the fractional part */
5493 /* shift left by 11 to keep fract in 1.31 format */
5494 fract = (x & 0x000FFFFF) << 11;
5496 /* Read two nearest output values from the index in 1.31(q31) format */
5498 y1 = pYData[index + 1];
5500 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
5501 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
5503 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
5504 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
5506 /* Convert y to 1.31 format */
5514 * @brief Process function for the Q15 Linear Interpolation Function.
5515 * @param[in] pYData pointer to Q15 Linear Interpolation table
5516 * @param[in] x input sample to process
5517 * @param[in] nValues number of table values
5518 * @return y processed output sample.
5521 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5522 * This function can support maximum of table size 2^12.
5525 __STATIC_FORCEINLINE q15_t arm_linear_interp_q15(
5530 q63_t y; /* output */
5531 q15_t y0, y1; /* Nearest output values */
5532 q31_t fract; /* fractional part */
5533 int32_t index; /* Index to read nearest output values */
5535 /* Input is in 12.20 format */
5536 /* 12 bits for the table index */
5537 /* Index value calculation */
5538 index = ((x & (int32_t)0xFFF00000) >> 20);
5540 if (index >= (int32_t)(nValues - 1))
5542 return (pYData[nValues - 1]);
5550 /* 20 bits for the fractional part */
5551 /* fract is in 12.20 format */
5552 fract = (x & 0x000FFFFF);
5554 /* Read two nearest output values from the index */
5556 y1 = pYData[index + 1];
5558 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
5559 y = ((q63_t) y0 * (0xFFFFF - fract));
5561 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
5562 y += ((q63_t) y1 * (fract));
5564 /* convert y to 1.15 format */
5565 return (q15_t) (y >> 20);
5572 * @brief Process function for the Q7 Linear Interpolation Function.
5573 * @param[in] pYData pointer to Q7 Linear Interpolation table
5574 * @param[in] x input sample to process
5575 * @param[in] nValues number of table values
5576 * @return y processed output sample.
5579 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5580 * This function can support maximum of table size 2^12.
5582 __STATIC_FORCEINLINE q7_t arm_linear_interp_q7(
5587 q31_t y; /* output */
5588 q7_t y0, y1; /* Nearest output values */
5589 q31_t fract; /* fractional part */
5590 uint32_t index; /* Index to read nearest output values */
5592 /* Input is in 12.20 format */
5593 /* 12 bits for the table index */
5594 /* Index value calculation */
5599 index = (x >> 20) & 0xfff;
5601 if (index >= (nValues - 1))
5603 return (pYData[nValues - 1]);
5607 /* 20 bits for the fractional part */
5608 /* fract is in 12.20 format */
5609 fract = (x & 0x000FFFFF);
5611 /* Read two nearest output values from the index and are in 1.7(q7) format */
5613 y1 = pYData[index + 1];
5615 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
5616 y = ((y0 * (0xFFFFF - fract)));
5618 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
5621 /* convert y to 1.7(q7) format */
5622 return (q7_t) (y >> 20);
5627 * @} end of LinearInterpolate group
5631 * @brief Fast approximation to the trigonometric sine function for floating-point data.
5632 * @param[in] x input value in radians.
5635 float32_t arm_sin_f32(
5640 * @brief Fast approximation to the trigonometric sine function for Q31 data.
5641 * @param[in] x Scaled input value in radians.
5649 * @brief Fast approximation to the trigonometric sine function for Q15 data.
5650 * @param[in] x Scaled input value in radians.
5658 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
5659 * @param[in] x input value in radians.
5662 float32_t arm_cos_f32(
5667 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
5668 * @param[in] x Scaled input value in radians.
5676 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
5677 * @param[in] x Scaled input value in radians.
5685 * @ingroup groupFastMath
5690 * @defgroup SQRT Square Root
5692 * Computes the square root of a number.
5693 * There are separate functions for Q15, Q31, and floating-point data types.
5694 * The square root function is computed using the Newton-Raphson algorithm.
5695 * This is an iterative algorithm of the form:
5697 * x1 = x0 - f(x0)/f'(x0)
5699 * where <code>x1</code> is the current estimate,
5700 * <code>x0</code> is the previous estimate, and
5701 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
5702 * For the square root function, the algorithm reduces to:
5704 * x0 = in/2 [initial guess]
5705 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
5716 @brief Floating-point square root function.
5717 @param[in] in input value
5718 @param[out] pOut square root of input value
5719 @return execution status
5720 - \ref ARM_MATH_SUCCESS : input value is positive
5721 - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
5723 __STATIC_FORCEINLINE arm_status arm_sqrt_f32(
5729 #if defined ( __CC_ARM )
5730 #if defined __TARGET_FPU_VFP
5731 *pOut = __sqrtf(in);
5736 #elif defined ( __ICCARM__ )
5737 #if defined __ARMVFP__
5738 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
5747 return (ARM_MATH_SUCCESS);
5752 return (ARM_MATH_ARGUMENT_ERROR);
5758 @brief Q31 square root function.
5759 @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF
5760 @param[out] pOut points to square root of input value
5761 @return execution status
5762 - \ref ARM_MATH_SUCCESS : input value is positive
5763 - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
5765 arm_status arm_sqrt_q31(
5771 @brief Q15 square root function.
5772 @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF
5773 @param[out] pOut points to square root of input value
5774 @return execution status
5775 - \ref ARM_MATH_SUCCESS : input value is positive
5776 - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
5778 arm_status arm_sqrt_q15(
5783 * @} end of SQRT group
5788 * @brief floating-point Circular write function.
5790 __STATIC_FORCEINLINE void arm_circularWrite_f32(
5791 int32_t * circBuffer,
5793 uint16_t * writeOffset,
5795 const int32_t * src,
5802 /* Copy the value of Index pointer that points
5803 * to the current location where the input samples to be copied */
5804 wOffset = *writeOffset;
5806 /* Loop over the blockSize */
5811 /* copy the input sample to the circular buffer */
5812 circBuffer[wOffset] = *src;
5814 /* Update the input pointer */
5817 /* Circularly update wOffset. Watch out for positive and negative value */
5818 wOffset += bufferInc;
5822 /* Decrement the loop counter */
5826 /* Update the index pointer */
5827 *writeOffset = (uint16_t)wOffset;
5833 * @brief floating-point Circular Read function.
5835 __STATIC_FORCEINLINE void arm_circularRead_f32(
5836 int32_t * circBuffer,
5838 int32_t * readOffset,
5850 /* Copy the value of Index pointer that points
5851 * to the current location from where the input samples to be read */
5852 rOffset = *readOffset;
5853 dst_end = dst_base + dst_length;
5855 /* Loop over the blockSize */
5860 /* copy the sample from the circular buffer to the destination buffer */
5861 *dst = circBuffer[rOffset];
5863 /* Update the input pointer */
5871 /* Circularly update rOffset. Watch out for positive and negative value */
5872 rOffset += bufferInc;
5879 /* Decrement the loop counter */
5883 /* Update the index pointer */
5884 *readOffset = rOffset;
5889 * @brief Q15 Circular write function.
5891 __STATIC_FORCEINLINE void arm_circularWrite_q15(
5894 uint16_t * writeOffset,
5903 /* Copy the value of Index pointer that points
5904 * to the current location where the input samples to be copied */
5905 wOffset = *writeOffset;
5907 /* Loop over the blockSize */
5912 /* copy the input sample to the circular buffer */
5913 circBuffer[wOffset] = *src;
5915 /* Update the input pointer */
5918 /* Circularly update wOffset. Watch out for positive and negative value */
5919 wOffset += bufferInc;
5923 /* Decrement the loop counter */
5927 /* Update the index pointer */
5928 *writeOffset = (uint16_t)wOffset;
5933 * @brief Q15 Circular Read function.
5935 __STATIC_FORCEINLINE void arm_circularRead_q15(
5938 int32_t * readOffset,
5950 /* Copy the value of Index pointer that points
5951 * to the current location from where the input samples to be read */
5952 rOffset = *readOffset;
5954 dst_end = dst_base + dst_length;
5956 /* Loop over the blockSize */
5961 /* copy the sample from the circular buffer to the destination buffer */
5962 *dst = circBuffer[rOffset];
5964 /* Update the input pointer */
5972 /* Circularly update wOffset. Watch out for positive and negative value */
5973 rOffset += bufferInc;
5980 /* Decrement the loop counter */
5984 /* Update the index pointer */
5985 *readOffset = rOffset;
5990 * @brief Q7 Circular write function.
5992 __STATIC_FORCEINLINE void arm_circularWrite_q7(
5995 uint16_t * writeOffset,
6004 /* Copy the value of Index pointer that points
6005 * to the current location where the input samples to be copied */
6006 wOffset = *writeOffset;
6008 /* Loop over the blockSize */
6013 /* copy the input sample to the circular buffer */
6014 circBuffer[wOffset] = *src;
6016 /* Update the input pointer */
6019 /* Circularly update wOffset. Watch out for positive and negative value */
6020 wOffset += bufferInc;
6024 /* Decrement the loop counter */
6028 /* Update the index pointer */
6029 *writeOffset = (uint16_t)wOffset;
6034 * @brief Q7 Circular Read function.
6036 __STATIC_FORCEINLINE void arm_circularRead_q7(
6039 int32_t * readOffset,
6051 /* Copy the value of Index pointer that points
6052 * to the current location from where the input samples to be read */
6053 rOffset = *readOffset;
6055 dst_end = dst_base + dst_length;
6057 /* Loop over the blockSize */
6062 /* copy the sample from the circular buffer to the destination buffer */
6063 *dst = circBuffer[rOffset];
6065 /* Update the input pointer */
6073 /* Circularly update rOffset. Watch out for positive and negative value */
6074 rOffset += bufferInc;
6081 /* Decrement the loop counter */
6085 /* Update the index pointer */
6086 *readOffset = rOffset;
6091 * @brief Sum of the squares of the elements of a Q31 vector.
6092 * @param[in] pSrc is input pointer
6093 * @param[in] blockSize is the number of samples to process
6094 * @param[out] pResult is output value.
6103 * @brief Sum of the squares of the elements of a floating-point vector.
6104 * @param[in] pSrc is input pointer
6105 * @param[in] blockSize is the number of samples to process
6106 * @param[out] pResult is output value.
6109 const float32_t * pSrc,
6111 float32_t * pResult);
6115 * @brief Sum of the squares of the elements of a Q15 vector.
6116 * @param[in] pSrc is input pointer
6117 * @param[in] blockSize is the number of samples to process
6118 * @param[out] pResult is output value.
6127 * @brief Sum of the squares of the elements of a Q7 vector.
6128 * @param[in] pSrc is input pointer
6129 * @param[in] blockSize is the number of samples to process
6130 * @param[out] pResult is output value.
6139 * @brief Mean value of a Q7 vector.
6140 * @param[in] pSrc is input pointer
6141 * @param[in] blockSize is the number of samples to process
6142 * @param[out] pResult is output value.
6151 * @brief Mean value of a Q15 vector.
6152 * @param[in] pSrc is input pointer
6153 * @param[in] blockSize is the number of samples to process
6154 * @param[out] pResult is output value.
6163 * @brief Mean value of a Q31 vector.
6164 * @param[in] pSrc is input pointer
6165 * @param[in] blockSize is the number of samples to process
6166 * @param[out] pResult is output value.
6175 * @brief Mean value of a floating-point vector.
6176 * @param[in] pSrc is input pointer
6177 * @param[in] blockSize is the number of samples to process
6178 * @param[out] pResult is output value.
6181 const float32_t * pSrc,
6183 float32_t * pResult);
6187 * @brief Variance of the elements of a floating-point vector.
6188 * @param[in] pSrc is input pointer
6189 * @param[in] blockSize is the number of samples to process
6190 * @param[out] pResult is output value.
6193 const float32_t * pSrc,
6195 float32_t * pResult);
6199 * @brief Variance of the elements of a Q31 vector.
6200 * @param[in] pSrc is input pointer
6201 * @param[in] blockSize is the number of samples to process
6202 * @param[out] pResult is output value.
6211 * @brief Variance of the elements of a Q15 vector.
6212 * @param[in] pSrc is input pointer
6213 * @param[in] blockSize is the number of samples to process
6214 * @param[out] pResult is output value.
6223 * @brief Root Mean Square of the elements of a floating-point vector.
6224 * @param[in] pSrc is input pointer
6225 * @param[in] blockSize is the number of samples to process
6226 * @param[out] pResult is output value.
6229 const float32_t * pSrc,
6231 float32_t * pResult);
6235 * @brief Root Mean Square of the elements of a Q31 vector.
6236 * @param[in] pSrc is input pointer
6237 * @param[in] blockSize is the number of samples to process
6238 * @param[out] pResult is output value.
6247 * @brief Root Mean Square of the elements of a Q15 vector.
6248 * @param[in] pSrc is input pointer
6249 * @param[in] blockSize is the number of samples to process
6250 * @param[out] pResult is output value.
6259 * @brief Standard deviation of the elements of a floating-point vector.
6260 * @param[in] pSrc is input pointer
6261 * @param[in] blockSize is the number of samples to process
6262 * @param[out] pResult is output value.
6265 const float32_t * pSrc,
6267 float32_t * pResult);
6271 * @brief Standard deviation of the elements of a Q31 vector.
6272 * @param[in] pSrc is input pointer
6273 * @param[in] blockSize is the number of samples to process
6274 * @param[out] pResult is output value.
6283 * @brief Standard deviation of the elements of a Q15 vector.
6284 * @param[in] pSrc is input pointer
6285 * @param[in] blockSize is the number of samples to process
6286 * @param[out] pResult is output value.
6295 * @brief Floating-point complex magnitude
6296 * @param[in] pSrc points to the complex input vector
6297 * @param[out] pDst points to the real output vector
6298 * @param[in] numSamples number of complex samples in the input vector
6300 void arm_cmplx_mag_f32(
6301 const float32_t * pSrc,
6303 uint32_t numSamples);
6307 * @brief Q31 complex magnitude
6308 * @param[in] pSrc points to the complex input vector
6309 * @param[out] pDst points to the real output vector
6310 * @param[in] numSamples number of complex samples in the input vector
6312 void arm_cmplx_mag_q31(
6315 uint32_t numSamples);
6319 * @brief Q15 complex magnitude
6320 * @param[in] pSrc points to the complex input vector
6321 * @param[out] pDst points to the real output vector
6322 * @param[in] numSamples number of complex samples in the input vector
6324 void arm_cmplx_mag_q15(
6327 uint32_t numSamples);
6331 * @brief Q15 complex dot product
6332 * @param[in] pSrcA points to the first input vector
6333 * @param[in] pSrcB points to the second input vector
6334 * @param[in] numSamples number of complex samples in each vector
6335 * @param[out] realResult real part of the result returned here
6336 * @param[out] imagResult imaginary part of the result returned here
6338 void arm_cmplx_dot_prod_q15(
6339 const q15_t * pSrcA,
6340 const q15_t * pSrcB,
6341 uint32_t numSamples,
6343 q31_t * imagResult);
6347 * @brief Q31 complex dot product
6348 * @param[in] pSrcA points to the first input vector
6349 * @param[in] pSrcB points to the second input vector
6350 * @param[in] numSamples number of complex samples in each vector
6351 * @param[out] realResult real part of the result returned here
6352 * @param[out] imagResult imaginary part of the result returned here
6354 void arm_cmplx_dot_prod_q31(
6355 const q31_t * pSrcA,
6356 const q31_t * pSrcB,
6357 uint32_t numSamples,
6359 q63_t * imagResult);
6363 * @brief Floating-point complex dot product
6364 * @param[in] pSrcA points to the first input vector
6365 * @param[in] pSrcB points to the second input vector
6366 * @param[in] numSamples number of complex samples in each vector
6367 * @param[out] realResult real part of the result returned here
6368 * @param[out] imagResult imaginary part of the result returned here
6370 void arm_cmplx_dot_prod_f32(
6371 const float32_t * pSrcA,
6372 const float32_t * pSrcB,
6373 uint32_t numSamples,
6374 float32_t * realResult,
6375 float32_t * imagResult);
6379 * @brief Q15 complex-by-real multiplication
6380 * @param[in] pSrcCmplx points to the complex input vector
6381 * @param[in] pSrcReal points to the real input vector
6382 * @param[out] pCmplxDst points to the complex output vector
6383 * @param[in] numSamples number of samples in each vector
6385 void arm_cmplx_mult_real_q15(
6386 const q15_t * pSrcCmplx,
6387 const q15_t * pSrcReal,
6389 uint32_t numSamples);
6393 * @brief Q31 complex-by-real multiplication
6394 * @param[in] pSrcCmplx points to the complex input vector
6395 * @param[in] pSrcReal points to the real input vector
6396 * @param[out] pCmplxDst points to the complex output vector
6397 * @param[in] numSamples number of samples in each vector
6399 void arm_cmplx_mult_real_q31(
6400 const q31_t * pSrcCmplx,
6401 const q31_t * pSrcReal,
6403 uint32_t numSamples);
6407 * @brief Floating-point complex-by-real multiplication
6408 * @param[in] pSrcCmplx points to the complex input vector
6409 * @param[in] pSrcReal points to the real input vector
6410 * @param[out] pCmplxDst points to the complex output vector
6411 * @param[in] numSamples number of samples in each vector
6413 void arm_cmplx_mult_real_f32(
6414 const float32_t * pSrcCmplx,
6415 const float32_t * pSrcReal,
6416 float32_t * pCmplxDst,
6417 uint32_t numSamples);
6421 * @brief Minimum value of a Q7 vector.
6422 * @param[in] pSrc is input pointer
6423 * @param[in] blockSize is the number of samples to process
6424 * @param[out] result is output pointer
6425 * @param[in] index is the array index of the minimum value in the input buffer.
6435 * @brief Minimum value of a Q15 vector.
6436 * @param[in] pSrc is input pointer
6437 * @param[in] blockSize is the number of samples to process
6438 * @param[out] pResult is output pointer
6439 * @param[in] pIndex is the array index of the minimum value in the input buffer.
6449 * @brief Minimum value of a Q31 vector.
6450 * @param[in] pSrc is input pointer
6451 * @param[in] blockSize is the number of samples to process
6452 * @param[out] pResult is output pointer
6453 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6463 * @brief Minimum value of a floating-point vector.
6464 * @param[in] pSrc is input pointer
6465 * @param[in] blockSize is the number of samples to process
6466 * @param[out] pResult is output pointer
6467 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6470 const float32_t * pSrc,
6472 float32_t * pResult,
6477 * @brief Maximum value of a Q7 vector.
6478 * @param[in] pSrc points to the input buffer
6479 * @param[in] blockSize length of the input vector
6480 * @param[out] pResult maximum value returned here
6481 * @param[out] pIndex index of maximum value returned here
6491 * @brief Maximum value of a Q15 vector.
6492 * @param[in] pSrc points to the input buffer
6493 * @param[in] blockSize length of the input vector
6494 * @param[out] pResult maximum value returned here
6495 * @param[out] pIndex index of maximum value returned here
6505 * @brief Maximum value of a Q31 vector.
6506 * @param[in] pSrc points to the input buffer
6507 * @param[in] blockSize length of the input vector
6508 * @param[out] pResult maximum value returned here
6509 * @param[out] pIndex index of maximum value returned here
6519 * @brief Maximum value of a floating-point vector.
6520 * @param[in] pSrc points to the input buffer
6521 * @param[in] blockSize length of the input vector
6522 * @param[out] pResult maximum value returned here
6523 * @param[out] pIndex index of maximum value returned here
6526 const float32_t * pSrc,
6528 float32_t * pResult,
6533 * @brief Q15 complex-by-complex multiplication
6534 * @param[in] pSrcA points to the first input vector
6535 * @param[in] pSrcB points to the second input vector
6536 * @param[out] pDst points to the output vector
6537 * @param[in] numSamples number of complex samples in each vector
6539 void arm_cmplx_mult_cmplx_q15(
6540 const q15_t * pSrcA,
6541 const q15_t * pSrcB,
6543 uint32_t numSamples);
6547 * @brief Q31 complex-by-complex multiplication
6548 * @param[in] pSrcA points to the first input vector
6549 * @param[in] pSrcB points to the second input vector
6550 * @param[out] pDst points to the output vector
6551 * @param[in] numSamples number of complex samples in each vector
6553 void arm_cmplx_mult_cmplx_q31(
6554 const q31_t * pSrcA,
6555 const q31_t * pSrcB,
6557 uint32_t numSamples);
6561 * @brief Floating-point complex-by-complex multiplication
6562 * @param[in] pSrcA points to the first input vector
6563 * @param[in] pSrcB points to the second input vector
6564 * @param[out] pDst points to the output vector
6565 * @param[in] numSamples number of complex samples in each vector
6567 void arm_cmplx_mult_cmplx_f32(
6568 const float32_t * pSrcA,
6569 const float32_t * pSrcB,
6571 uint32_t numSamples);
6575 * @brief Converts the elements of the floating-point vector to Q31 vector.
6576 * @param[in] pSrc points to the floating-point input vector
6577 * @param[out] pDst points to the Q31 output vector
6578 * @param[in] blockSize length of the input vector
6580 void arm_float_to_q31(
6581 const float32_t * pSrc,
6583 uint32_t blockSize);
6587 * @brief Converts the elements of the floating-point vector to Q15 vector.
6588 * @param[in] pSrc points to the floating-point input vector
6589 * @param[out] pDst points to the Q15 output vector
6590 * @param[in] blockSize length of the input vector
6592 void arm_float_to_q15(
6593 const float32_t * pSrc,
6595 uint32_t blockSize);
6599 * @brief Converts the elements of the floating-point vector to Q7 vector.
6600 * @param[in] pSrc points to the floating-point input vector
6601 * @param[out] pDst points to the Q7 output vector
6602 * @param[in] blockSize length of the input vector
6604 void arm_float_to_q7(
6605 const float32_t * pSrc,
6607 uint32_t blockSize);
6611 * @brief Converts the elements of the Q31 vector to floating-point vector.
6612 * @param[in] pSrc is input pointer
6613 * @param[out] pDst is output pointer
6614 * @param[in] blockSize is the number of samples to process
6616 void arm_q31_to_float(
6619 uint32_t blockSize);
6623 * @brief Converts the elements of the Q31 vector to Q15 vector.
6624 * @param[in] pSrc is input pointer
6625 * @param[out] pDst is output pointer
6626 * @param[in] blockSize is the number of samples to process
6628 void arm_q31_to_q15(
6631 uint32_t blockSize);
6635 * @brief Converts the elements of the Q31 vector to Q7 vector.
6636 * @param[in] pSrc is input pointer
6637 * @param[out] pDst is output pointer
6638 * @param[in] blockSize is the number of samples to process
6643 uint32_t blockSize);
6647 * @brief Converts the elements of the Q15 vector to floating-point vector.
6648 * @param[in] pSrc is input pointer
6649 * @param[out] pDst is output pointer
6650 * @param[in] blockSize is the number of samples to process
6652 void arm_q15_to_float(
6655 uint32_t blockSize);
6659 * @brief Converts the elements of the Q15 vector to Q31 vector.
6660 * @param[in] pSrc is input pointer
6661 * @param[out] pDst is output pointer
6662 * @param[in] blockSize is the number of samples to process
6664 void arm_q15_to_q31(
6667 uint32_t blockSize);
6671 * @brief Converts the elements of the Q15 vector to Q7 vector.
6672 * @param[in] pSrc is input pointer
6673 * @param[out] pDst is output pointer
6674 * @param[in] blockSize is the number of samples to process
6679 uint32_t blockSize);
6683 * @brief Converts the elements of the Q7 vector to floating-point vector.
6684 * @param[in] pSrc is input pointer
6685 * @param[out] pDst is output pointer
6686 * @param[in] blockSize is the number of samples to process
6688 void arm_q7_to_float(
6691 uint32_t blockSize);
6695 * @brief Converts the elements of the Q7 vector to Q31 vector.
6696 * @param[in] pSrc input pointer
6697 * @param[out] pDst output pointer
6698 * @param[in] blockSize number of samples to process
6703 uint32_t blockSize);
6707 * @brief Converts the elements of the Q7 vector to Q15 vector.
6708 * @param[in] pSrc input pointer
6709 * @param[out] pDst output pointer
6710 * @param[in] blockSize number of samples to process
6715 uint32_t blockSize);
6719 * @ingroup groupInterpolation
6723 * @defgroup BilinearInterpolate Bilinear Interpolation
6725 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
6726 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
6727 * determines values between the grid points.
6728 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
6729 * Bilinear interpolation is often used in image processing to rescale images.
6730 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
6734 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
6735 * For floating-point, the instance structure is defined as:
6742 * } arm_bilinear_interp_instance_f32;
6746 * where <code>numRows</code> specifies the number of rows in the table;
6747 * <code>numCols</code> specifies the number of columns in the table;
6748 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
6749 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
6750 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
6753 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
6759 * The interpolated output point is computed as:
6761 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
6762 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
6763 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
6764 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
6766 * Note that the coordinates (x, y) contain integer and fractional components.
6767 * The integer components specify which portion of the table to use while the
6768 * fractional components control the interpolation processor.
6771 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
6776 * @addtogroup BilinearInterpolate
6781 * @brief Floating-point bilinear interpolation.
6782 * @param[in,out] S points to an instance of the interpolation structure.
6783 * @param[in] X interpolation coordinate.
6784 * @param[in] Y interpolation coordinate.
6785 * @return out interpolated value.
6787 __STATIC_FORCEINLINE float32_t arm_bilinear_interp_f32(
6788 const arm_bilinear_interp_instance_f32 * S,
6793 float32_t f00, f01, f10, f11;
6794 float32_t *pData = S->pData;
6795 int32_t xIndex, yIndex, index;
6796 float32_t xdiff, ydiff;
6797 float32_t b1, b2, b3, b4;
6799 xIndex = (int32_t) X;
6800 yIndex = (int32_t) Y;
6802 /* Care taken for table outside boundary */
6803 /* Returns zero output when values are outside table boundary */
6804 if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))
6809 /* Calculation of index for two nearest points in X-direction */
6810 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
6813 /* Read two nearest points in X-direction */
6815 f01 = pData[index + 1];
6817 /* Calculation of index for two nearest points in Y-direction */
6818 index = (xIndex - 1) + (yIndex) * S->numCols;
6821 /* Read two nearest points in Y-direction */
6823 f11 = pData[index + 1];
6825 /* Calculation of intermediate values */
6829 b4 = f00 - f01 - f10 + f11;
6831 /* Calculation of fractional part in X */
6834 /* Calculation of fractional part in Y */
6837 /* Calculation of bi-linear interpolated output */
6838 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
6840 /* return to application */
6846 * @brief Q31 bilinear interpolation.
6847 * @param[in,out] S points to an instance of the interpolation structure.
6848 * @param[in] X interpolation coordinate in 12.20 format.
6849 * @param[in] Y interpolation coordinate in 12.20 format.
6850 * @return out interpolated value.
6852 __STATIC_FORCEINLINE q31_t arm_bilinear_interp_q31(
6853 arm_bilinear_interp_instance_q31 * S,
6857 q31_t out; /* Temporary output */
6858 q31_t acc = 0; /* output */
6859 q31_t xfract, yfract; /* X, Y fractional parts */
6860 q31_t x1, x2, y1, y2; /* Nearest output values */
6861 int32_t rI, cI; /* Row and column indices */
6862 q31_t *pYData = S->pData; /* pointer to output table values */
6863 uint32_t nCols = S->numCols; /* num of rows */
6865 /* Input is in 12.20 format */
6866 /* 12 bits for the table index */
6867 /* Index value calculation */
6868 rI = ((X & (q31_t)0xFFF00000) >> 20);
6870 /* Input is in 12.20 format */
6871 /* 12 bits for the table index */
6872 /* Index value calculation */
6873 cI = ((Y & (q31_t)0xFFF00000) >> 20);
6875 /* Care taken for table outside boundary */
6876 /* Returns zero output when values are outside table boundary */
6877 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
6882 /* 20 bits for the fractional part */
6883 /* shift left xfract by 11 to keep 1.31 format */
6884 xfract = (X & 0x000FFFFF) << 11U;
6886 /* Read two nearest output values from the index */
6887 x1 = pYData[(rI) + (int32_t)nCols * (cI) ];
6888 x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
6890 /* 20 bits for the fractional part */
6891 /* shift left yfract by 11 to keep 1.31 format */
6892 yfract = (Y & 0x000FFFFF) << 11U;
6894 /* Read two nearest output values from the index */
6895 y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ];
6896 y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
6898 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
6899 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
6900 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
6902 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
6903 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
6904 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
6906 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
6907 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
6908 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
6910 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
6911 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
6912 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
6914 /* Convert acc to 1.31(q31) format */
6915 return ((q31_t)(acc << 2));
6920 * @brief Q15 bilinear interpolation.
6921 * @param[in,out] S points to an instance of the interpolation structure.
6922 * @param[in] X interpolation coordinate in 12.20 format.
6923 * @param[in] Y interpolation coordinate in 12.20 format.
6924 * @return out interpolated value.
6926 __STATIC_FORCEINLINE q15_t arm_bilinear_interp_q15(
6927 arm_bilinear_interp_instance_q15 * S,
6931 q63_t acc = 0; /* output */
6932 q31_t out; /* Temporary output */
6933 q15_t x1, x2, y1, y2; /* Nearest output values */
6934 q31_t xfract, yfract; /* X, Y fractional parts */
6935 int32_t rI, cI; /* Row and column indices */
6936 q15_t *pYData = S->pData; /* pointer to output table values */
6937 uint32_t nCols = S->numCols; /* num of rows */
6939 /* Input is in 12.20 format */
6940 /* 12 bits for the table index */
6941 /* Index value calculation */
6942 rI = ((X & (q31_t)0xFFF00000) >> 20);
6944 /* Input is in 12.20 format */
6945 /* 12 bits for the table index */
6946 /* Index value calculation */
6947 cI = ((Y & (q31_t)0xFFF00000) >> 20);
6949 /* Care taken for table outside boundary */
6950 /* Returns zero output when values are outside table boundary */
6951 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
6956 /* 20 bits for the fractional part */
6957 /* xfract should be in 12.20 format */
6958 xfract = (X & 0x000FFFFF);
6960 /* Read two nearest output values from the index */
6961 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
6962 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
6964 /* 20 bits for the fractional part */
6965 /* yfract should be in 12.20 format */
6966 yfract = (Y & 0x000FFFFF);
6968 /* Read two nearest output values from the index */
6969 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
6970 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
6972 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
6974 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
6975 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
6976 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4U);
6977 acc = ((q63_t) out * (0xFFFFF - yfract));
6979 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
6980 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4U);
6981 acc += ((q63_t) out * (xfract));
6983 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
6984 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4U);
6985 acc += ((q63_t) out * (yfract));
6987 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
6988 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U);
6989 acc += ((q63_t) out * (yfract));
6991 /* acc is in 13.51 format and down shift acc by 36 times */
6992 /* Convert out to 1.15 format */
6993 return ((q15_t)(acc >> 36));
6998 * @brief Q7 bilinear interpolation.
6999 * @param[in,out] S points to an instance of the interpolation structure.
7000 * @param[in] X interpolation coordinate in 12.20 format.
7001 * @param[in] Y interpolation coordinate in 12.20 format.
7002 * @return out interpolated value.
7004 __STATIC_FORCEINLINE q7_t arm_bilinear_interp_q7(
7005 arm_bilinear_interp_instance_q7 * S,
7009 q63_t acc = 0; /* output */
7010 q31_t out; /* Temporary output */
7011 q31_t xfract, yfract; /* X, Y fractional parts */
7012 q7_t x1, x2, y1, y2; /* Nearest output values */
7013 int32_t rI, cI; /* Row and column indices */
7014 q7_t *pYData = S->pData; /* pointer to output table values */
7015 uint32_t nCols = S->numCols; /* num of rows */
7017 /* Input is in 12.20 format */
7018 /* 12 bits for the table index */
7019 /* Index value calculation */
7020 rI = ((X & (q31_t)0xFFF00000) >> 20);
7022 /* Input is in 12.20 format */
7023 /* 12 bits for the table index */
7024 /* Index value calculation */
7025 cI = ((Y & (q31_t)0xFFF00000) >> 20);
7027 /* Care taken for table outside boundary */
7028 /* Returns zero output when values are outside table boundary */
7029 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
7034 /* 20 bits for the fractional part */
7035 /* xfract should be in 12.20 format */
7036 xfract = (X & (q31_t)0x000FFFFF);
7038 /* Read two nearest output values from the index */
7039 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
7040 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
7042 /* 20 bits for the fractional part */
7043 /* yfract should be in 12.20 format */
7044 yfract = (Y & (q31_t)0x000FFFFF);
7046 /* Read two nearest output values from the index */
7047 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
7048 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
7050 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
7051 out = ((x1 * (0xFFFFF - xfract)));
7052 acc = (((q63_t) out * (0xFFFFF - yfract)));
7054 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
7055 out = ((x2 * (0xFFFFF - yfract)));
7056 acc += (((q63_t) out * (xfract)));
7058 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
7059 out = ((y1 * (0xFFFFF - xfract)));
7060 acc += (((q63_t) out * (yfract)));
7062 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
7063 out = ((y2 * (yfract)));
7064 acc += (((q63_t) out * (xfract)));
7066 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
7067 return ((q7_t)(acc >> 40));
7071 * @} end of BilinearInterpolate group
7076 #define multAcc_32x32_keep32_R(a, x, y) \
7077 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
7080 #define multSub_32x32_keep32_R(a, x, y) \
7081 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
7084 #define mult_32x32_keep32_R(a, x, y) \
7085 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
7088 #define multAcc_32x32_keep32(a, x, y) \
7089 a += (q31_t) (((q63_t) x * y) >> 32)
7092 #define multSub_32x32_keep32(a, x, y) \
7093 a -= (q31_t) (((q63_t) x * y) >> 32)
7096 #define mult_32x32_keep32(a, x, y) \
7097 a = (q31_t) (((q63_t) x * y ) >> 32)
7100 #if defined ( __CC_ARM )
7101 /* Enter low optimization region - place directly above function definition */
7102 #if defined( __ARM_ARCH_7EM__ )
7103 #define LOW_OPTIMIZATION_ENTER \
7107 #define LOW_OPTIMIZATION_ENTER
7110 /* Exit low optimization region - place directly after end of function definition */
7111 #if defined ( __ARM_ARCH_7EM__ )
7112 #define LOW_OPTIMIZATION_EXIT \
7115 #define LOW_OPTIMIZATION_EXIT
7118 /* Enter low optimization region - place directly above function definition */
7119 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7121 /* Exit low optimization region - place directly after end of function definition */
7122 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7124 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
7125 #define LOW_OPTIMIZATION_ENTER
7126 #define LOW_OPTIMIZATION_EXIT
7127 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7128 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7130 #elif defined ( __GNUC__ )
7131 #define LOW_OPTIMIZATION_ENTER \
7132 __attribute__(( optimize("-O1") ))
7133 #define LOW_OPTIMIZATION_EXIT
7134 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7135 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7137 #elif defined ( __ICCARM__ )
7138 /* Enter low optimization region - place directly above function definition */
7139 #if defined ( __ARM_ARCH_7EM__ )
7140 #define LOW_OPTIMIZATION_ENTER \
7141 _Pragma ("optimize=low")
7143 #define LOW_OPTIMIZATION_ENTER
7146 /* Exit low optimization region - place directly after end of function definition */
7147 #define LOW_OPTIMIZATION_EXIT
7149 /* Enter low optimization region - place directly above function definition */
7150 #if defined ( __ARM_ARCH_7EM__ )
7151 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
7152 _Pragma ("optimize=low")
7154 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7157 /* Exit low optimization region - place directly after end of function definition */
7158 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7160 #elif defined ( __TI_ARM__ )
7161 #define LOW_OPTIMIZATION_ENTER
7162 #define LOW_OPTIMIZATION_EXIT
7163 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7164 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7166 #elif defined ( __CSMC__ )
7167 #define LOW_OPTIMIZATION_ENTER
7168 #define LOW_OPTIMIZATION_EXIT
7169 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7170 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7172 #elif defined ( __TASKING__ )
7173 #define LOW_OPTIMIZATION_ENTER
7174 #define LOW_OPTIMIZATION_EXIT
7175 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7176 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7185 /* Compiler specific diagnostic adjustment */
7186 #if defined ( __CC_ARM )
7188 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
7190 #elif defined ( __GNUC__ )
7191 #pragma GCC diagnostic pop
7193 #elif defined ( __ICCARM__ )
7195 #elif defined ( __TI_ARM__ )
7197 #elif defined ( __CSMC__ )
7199 #elif defined ( __TASKING__ )
7202 #error Unknown compiler
7205 #endif /* _ARM_MATH_H */