1 /* ----------------------------------------------------------------------
2 * Project: CMSIS DSP Library
4 * Description: Public header file for CMSIS DSP Library
6 * $Date: 27. January 2017
9 * Target Processor: Cortex-M cores
10 * -------------------------------------------------------------------- */
12 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
14 * SPDX-License-Identifier: Apache-2.0
16 * Licensed under the Apache License, Version 2.0 (the License); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
20 * www.apache.org/licenses/LICENSE-2.0
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
30 \mainpage CMSIS DSP Software Library
35 * This user manual describes the CMSIS DSP software library,
36 * a suite of common signal processing functions for use on Cortex-M processor based devices.
38 * The library is divided into a number of functions each covering a specific category:
39 * - Basic math functions
40 * - Fast math functions
41 * - Complex math functions
45 * - Motor control functions
46 * - Statistical functions
48 * - Interpolation functions
50 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
51 * 32-bit integer and 32-bit floating-point values.
56 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
57 * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
58 * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
59 * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
60 * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
61 * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
62 * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
63 * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
64 * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
65 * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
66 * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
67 * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
68 * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
69 * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
70 * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
71 * - arm_ARMv8MBLl_math.lib (ARMv8M Baseline, Little endian)
72 * - arm_ARMv8MMLl_math.lib (ARMv8M Mainline, Little endian)
73 * - arm_ARMv8MMLlfsp_math.lib (ARMv8M Mainline, Little endian, Single Precision Floating Point Unit)
74 * - arm_ARMv8MMLld_math.lib (ARMv8M Mainline, Little endian, DSP instructions)
75 * - arm_ARMv8MMLldfsp_math.lib (ARMv8M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
77 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
78 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
79 * 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.
80 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
81 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
82 * For ARMv8M cores define pre processor MACRO ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML.
83 * Set Pre processor MACRO __DSP_PRESENT if ARMv8M Mainline core supports DSP instructions.
89 * The library ships with a number of examples which demonstrate how to use the library functions.
94 * The library has been developed and tested with MDK-ARM version 5.14.0.0
95 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
97 * Building the Library
100 * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
101 * - arm_cortexM_math.uvprojx
104 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
106 * Pre-processor Macros
109 * Each library project have differant pre-processor macros.
111 * - UNALIGNED_SUPPORT_DISABLE:
113 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
115 * - ARM_MATH_BIG_ENDIAN:
117 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
119 * - ARM_MATH_MATRIX_CHECK:
121 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
123 * - ARM_MATH_ROUNDING:
125 * Define macro ARM_MATH_ROUNDING for rounding on support functions
129 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
130 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
131 * ARM_MATH_CM7 for building the library on cortex-M7.
133 * - ARM_MATH_ARMV8MxL:
135 * Define macro ARM_MATH_ARMV8MBL for building the library on ARMv8M Baseline target, ARM_MATH_ARMV8MBL for building library
136 * on ARMv8M Mainline target.
140 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries.
144 * Initialize macro __DSP_PRESENT = 1 when ARMv8M Mainline core supports DSP instructions.
147 * CMSIS-DSP in ARM::CMSIS Pack
148 * -----------------------------
150 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
151 * |File/Folder |Content |
152 * |------------------------------|------------------------------------------------------------------------|
153 * |\b CMSIS\\Documentation\\DSP | This documentation |
154 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
155 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
156 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
159 * Revision History of CMSIS-DSP
161 * Please refer to \ref ChangeLog_pg.
166 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
171 * @defgroup groupMath Basic Math Functions
175 * @defgroup groupFastMath Fast Math Functions
176 * This set of functions provides a fast approximation to sine, cosine, and square root.
177 * As compared to most of the other functions in the CMSIS math library, the fast math functions
178 * operate on individual values and not arrays.
179 * There are separate functions for Q15, Q31, and floating-point data.
184 * @defgroup groupCmplxMath Complex Math Functions
185 * This set of functions operates on complex data vectors.
186 * The data in the complex arrays is stored in an interleaved fashion
187 * (real, imag, real, imag, ...).
188 * In the API functions, the number of samples in a complex array refers
189 * to the number of complex values; the array contains twice this number of
194 * @defgroup groupFilters Filtering Functions
198 * @defgroup groupMatrix Matrix Functions
200 * This set of functions provides basic matrix math operations.
201 * The functions operate on matrix data structures. For example,
203 * definition for the floating-point matrix structure is shown
208 * uint16_t numRows; // number of rows of the matrix.
209 * uint16_t numCols; // number of columns of the matrix.
210 * float32_t *pData; // points to the data of the matrix.
211 * } arm_matrix_instance_f32;
213 * There are similar definitions for Q15 and Q31 data types.
215 * The structure specifies the size of the matrix and then points to
216 * an array of data. The array is of size <code>numRows X numCols</code>
217 * and the values are arranged in row order. That is, the
218 * matrix element (i, j) is stored at:
220 * pData[i*numCols + j]
223 * \par Init Functions
224 * There is an associated initialization function for each type of matrix
226 * The initialization function sets the values of the internal structure fields.
227 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
228 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
231 * Use of the initialization function is optional. However, if initialization function is used
232 * then the instance structure cannot be placed into a const data section.
233 * To place the instance structure in a const data
234 * section, manually initialize the data structure. For example:
236 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
237 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
238 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
240 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
241 * specifies the number of columns, and <code>pData</code> points to the
245 * By default all of the matrix functions perform size checking on the input and
246 * output matrices. For example, the matrix addition function verifies that the
247 * two input matrices and the output matrix all have the same number of rows and
248 * columns. If the size check fails the functions return:
250 * ARM_MATH_SIZE_MISMATCH
252 * Otherwise the functions return
256 * There is some overhead associated with this matrix size checking.
257 * The matrix size checking is enabled via the \#define
259 * ARM_MATH_MATRIX_CHECK
261 * within the library project settings. By default this macro is defined
262 * and size checking is enabled. By changing the project settings and
263 * undefining this macro size checking is eliminated and the functions
264 * run a bit faster. With size checking disabled the functions always
265 * return <code>ARM_MATH_SUCCESS</code>.
269 * @defgroup groupTransforms Transform Functions
273 * @defgroup groupController Controller Functions
277 * @defgroup groupStats Statistics Functions
280 * @defgroup groupSupport Support Functions
284 * @defgroup groupInterpolation Interpolation Functions
285 * These functions perform 1- and 2-dimensional interpolation of data.
286 * Linear interpolation is used for 1-dimensional data and
287 * bilinear interpolation is used for 2-dimensional data.
291 * @defgroup groupExamples Examples
296 /* ignore some GCC warnings */
297 #if defined ( __GNUC__ )
298 #pragma GCC diagnostic push
299 #pragma GCC diagnostic ignored "-Wsign-conversion"
300 #pragma GCC diagnostic ignored "-Wconversion"
301 #pragma GCC diagnostic ignored "-Wunused-parameter"
304 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
306 #if defined(ARM_MATH_CM7)
307 #include "core_cm7.h"
309 #elif defined (ARM_MATH_CM4)
310 #include "core_cm4.h"
312 #elif defined (ARM_MATH_CM3)
313 #include "core_cm3.h"
314 #elif defined (ARM_MATH_CM0)
315 #include "core_cm0.h"
316 #define ARM_MATH_CM0_FAMILY
317 #elif defined (ARM_MATH_CM0PLUS)
318 #include "core_cm0plus.h"
319 #define ARM_MATH_CM0_FAMILY
320 #elif defined (ARM_MATH_ARMV8MBL)
321 #include "core_armv8mbl.h"
322 #define ARM_MATH_CM0_FAMILY
323 #elif defined (ARM_MATH_ARMV8MML)
324 #include "core_armv8mml.h"
325 #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1))
329 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
332 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
342 * @brief Macros required for reciprocal calculation in Normalized LMS
345 #define DELTA_Q31 (0x100)
346 #define DELTA_Q15 0x5
347 #define INDEX_MASK 0x0000003F
349 #define PI 3.14159265358979f
353 * @brief Macros required for SINE and COSINE Fast math approximations
356 #define FAST_MATH_TABLE_SIZE 512
357 #define FAST_MATH_Q31_SHIFT (32 - 10)
358 #define FAST_MATH_Q15_SHIFT (16 - 10)
359 #define CONTROLLER_Q31_SHIFT (32 - 9)
360 #define TABLE_SPACING_Q31 0x400000
361 #define TABLE_SPACING_Q15 0x80
364 * @brief Macros required for SINE and COSINE Controller functions
366 /* 1.31(q31) Fixed value of 2/360 */
367 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
368 #define INPUT_SPACING 0xB60B61
371 * @brief Macro for Unaligned Support
373 #ifndef UNALIGNED_SUPPORT_DISABLE
376 #if defined (__GNUC__)
377 #define ALIGN4 __attribute__((aligned(4)))
379 #define ALIGN4 __align(4)
381 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
384 * @brief Error status returned by some functions in the library.
389 ARM_MATH_SUCCESS = 0, /**< No error */
390 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
391 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
392 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
393 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
394 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
395 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
399 * @brief 8-bit fractional data type in 1.7 format.
404 * @brief 16-bit fractional data type in 1.15 format.
406 typedef int16_t q15_t;
409 * @brief 32-bit fractional data type in 1.31 format.
411 typedef int32_t q31_t;
414 * @brief 64-bit fractional data type in 1.63 format.
416 typedef int64_t q63_t;
419 * @brief 32-bit floating-point type definition.
421 typedef float float32_t;
424 * @brief 64-bit floating-point type definition.
426 typedef double float64_t;
429 * @brief definition to read/write two 16 bit values.
431 #if defined ( __CC_ARM )
432 #define __SIMD32_TYPE int32_t __packed
433 #define CMSIS_UNUSED __attribute__((unused))
434 #define CMSIS_INLINE __attribute__((always_inline))
436 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
437 #define __SIMD32_TYPE int32_t
438 #define CMSIS_UNUSED __attribute__((unused))
439 #define CMSIS_INLINE __attribute__((always_inline))
441 #elif defined ( __GNUC__ )
442 #define __SIMD32_TYPE int32_t
443 #define CMSIS_UNUSED __attribute__((unused))
444 #define CMSIS_INLINE __attribute__((always_inline))
446 #elif defined ( __ICCARM__ )
447 #define __SIMD32_TYPE int32_t __packed
451 #elif defined ( __TI_ARM__ )
452 #define __SIMD32_TYPE int32_t
453 #define CMSIS_UNUSED __attribute__((unused))
456 #elif defined ( __CSMC__ )
457 #define __SIMD32_TYPE int32_t
461 #elif defined ( __TASKING__ )
462 #define __SIMD32_TYPE __unaligned int32_t
467 #error Unknown compiler
470 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
471 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
472 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
473 #define __SIMD64(addr) (*(int64_t **) & (addr))
475 /* #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
476 #if !defined (ARM_MATH_DSP)
478 * @brief definition to pack two 16 bit values.
480 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
481 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
482 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
483 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
485 /* #endif // defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
486 #endif /* !defined (ARM_MATH_DSP) */
489 * @brief definition to pack four 8 bit values.
491 #ifndef ARM_MATH_BIG_ENDIAN
493 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
494 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
495 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
496 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
499 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
500 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
501 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
502 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
508 * @brief Clips Q63 to Q31 values.
510 CMSIS_INLINE __STATIC_INLINE q31_t clip_q63_to_q31(
513 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
514 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
518 * @brief Clips Q63 to Q15 values.
520 CMSIS_INLINE __STATIC_INLINE q15_t clip_q63_to_q15(
523 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
524 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
528 * @brief Clips Q31 to Q7 values.
530 CMSIS_INLINE __STATIC_INLINE q7_t clip_q31_to_q7(
533 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
534 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
538 * @brief Clips Q31 to Q15 values.
540 CMSIS_INLINE __STATIC_INLINE q15_t clip_q31_to_q15(
543 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
544 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
548 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
551 CMSIS_INLINE __STATIC_INLINE q63_t mult32x64(
555 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
556 (((q63_t) (x >> 32) * y)));
560 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
564 /* note: function can be removed when all toolchain support __CLZ for Cortex-M0 */
565 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
566 CMSIS_INLINE __STATIC_INLINE uint32_t __CLZ(
569 CMSIS_INLINE __STATIC_INLINE uint32_t __CLZ(
573 uint32_t mask = 0x80000000;
575 while ((data & mask) == 0)
586 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
589 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q31(
601 signBits = ((uint32_t) (__CLZ( in) - 1));
605 signBits = ((uint32_t) (__CLZ(-in) - 1));
608 /* Convert input sample to 1.31 format */
609 in = (in << signBits);
611 /* calculation of index for initial approximated Val */
612 index = (uint32_t)(in >> 24);
613 index = (index & INDEX_MASK);
615 /* 1.31 with exp 1 */
616 out = pRecipTable[index];
618 /* calculation of reciprocal value */
619 /* running approximation for two iterations */
620 for (i = 0u; i < 2u; i++)
622 tempVal = (uint32_t) (((q63_t) in * out) >> 31);
623 tempVal = 0x7FFFFFFFu - tempVal;
624 /* 1.31 with exp 1 */
625 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
626 out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
632 /* return num of signbits of out = 1/in value */
633 return (signBits + 1u);
638 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
640 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q15(
646 uint32_t tempVal = 0;
647 uint32_t index = 0, i = 0;
648 uint32_t signBits = 0;
652 signBits = ((uint32_t)(__CLZ( in) - 17));
656 signBits = ((uint32_t)(__CLZ(-in) - 17));
659 /* Convert input sample to 1.15 format */
660 in = (in << signBits);
662 /* calculation of index for initial approximated Val */
663 index = (uint32_t)(in >> 8);
664 index = (index & INDEX_MASK);
666 /* 1.15 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) (((q31_t) in * out) >> 15);
674 tempVal = 0x7FFFu - tempVal;
675 /* 1.15 with exp 1 */
676 out = (q15_t) (((q31_t) out * tempVal) >> 14);
677 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
683 /* return num of signbits of out = 1/in value */
684 return (signBits + 1);
689 * @brief C custom defined intrinisic function for only M0 processors
691 #if defined(ARM_MATH_CM0_FAMILY)
692 CMSIS_INLINE __STATIC_INLINE q31_t __SSAT(
696 int32_t posMax, negMin;
700 for (i = 0; i < (y - 1); i++)
707 posMax = (posMax - 1);
725 #endif /* end of ARM_MATH_CM0_FAMILY */
729 * @brief C custom defined intrinsic function for M3 and M0 processors
731 /* #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
732 #if !defined (ARM_MATH_DSP)
735 * @brief C custom defined QADD8 for M3 and M0 processors
737 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD8(
743 r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
744 s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
745 t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
746 u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
748 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
753 * @brief C custom defined QSUB8 for M3 and M0 processors
755 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB8(
761 r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
762 s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
763 t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
764 u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
766 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
771 * @brief C custom defined QADD16 for M3 and M0 processors
773 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD16(
777 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
780 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
781 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
783 return ((uint32_t)((s << 16) | (r )));
788 * @brief C custom defined SHADD16 for M3 and M0 processors
790 CMSIS_INLINE __STATIC_INLINE uint32_t __SHADD16(
796 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
797 s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
799 return ((uint32_t)((s << 16) | (r )));
804 * @brief C custom defined QSUB16 for M3 and M0 processors
806 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB16(
812 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
813 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
815 return ((uint32_t)((s << 16) | (r )));
820 * @brief C custom defined SHSUB16 for M3 and M0 processors
822 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSUB16(
828 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
829 s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
831 return ((uint32_t)((s << 16) | (r )));
836 * @brief C custom defined QASX for M3 and M0 processors
838 CMSIS_INLINE __STATIC_INLINE uint32_t __QASX(
844 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
845 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
847 return ((uint32_t)((s << 16) | (r )));
852 * @brief C custom defined SHASX for M3 and M0 processors
854 CMSIS_INLINE __STATIC_INLINE uint32_t __SHASX(
860 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
861 s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
863 return ((uint32_t)((s << 16) | (r )));
868 * @brief C custom defined QSAX for M3 and M0 processors
870 CMSIS_INLINE __STATIC_INLINE uint32_t __QSAX(
876 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
877 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
879 return ((uint32_t)((s << 16) | (r )));
884 * @brief C custom defined SHSAX for M3 and M0 processors
886 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSAX(
892 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
893 s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
895 return ((uint32_t)((s << 16) | (r )));
900 * @brief C custom defined SMUSDX for M3 and M0 processors
902 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSDX(
906 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
907 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
911 * @brief C custom defined SMUADX for M3 and M0 processors
913 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUADX(
917 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
918 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
923 * @brief C custom defined QADD for M3 and M0 processors
925 CMSIS_INLINE __STATIC_INLINE int32_t __QADD(
929 return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
934 * @brief C custom defined QSUB for M3 and M0 processors
936 CMSIS_INLINE __STATIC_INLINE int32_t __QSUB(
940 return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
945 * @brief C custom defined SMLAD for M3 and M0 processors
947 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLAD(
952 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
953 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
954 ( ((q31_t)sum ) ) ));
959 * @brief C custom defined SMLADX for M3 and M0 processors
961 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLADX(
966 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
967 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
968 ( ((q31_t)sum ) ) ));
973 * @brief C custom defined SMLSDX for M3 and M0 processors
975 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLSDX(
980 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
981 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
982 ( ((q31_t)sum ) ) ));
987 * @brief C custom defined SMLALD for M3 and M0 processors
989 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALD(
994 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
995 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
996 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
997 ( ((q63_t)sum ) ) ));
1002 * @brief C custom defined SMLALDX for M3 and M0 processors
1004 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALDX(
1009 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
1010 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
1011 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
1012 ( ((q63_t)sum ) ) ));
1017 * @brief C custom defined SMUAD for M3 and M0 processors
1019 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUAD(
1023 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
1024 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
1029 * @brief C custom defined SMUSD for M3 and M0 processors
1031 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSD(
1035 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
1036 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
1041 * @brief C custom defined SXTB16 for M3 and M0 processors
1043 CMSIS_INLINE __STATIC_INLINE uint32_t __SXTB16(
1046 return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
1047 ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
1051 * @brief C custom defined SMMLA for M3 and M0 processors
1053 CMSIS_INLINE __STATIC_INLINE int32_t __SMMLA(
1058 return (sum + (int32_t) (((int64_t) x * y) >> 32));
1063 * @brief C custom defined PKHBT for unavailable DSP extension
1065 CMSIS_INLINE __STATIC_INLINE uint32_t __PKHBT(
1070 return ( ((x ) & 0x0000FFFFUL) |
1071 ((y << leftshift) & 0xFFFF0000UL) );
1075 * @brief C custom defined PKHTB for unavailable DSP extension
1077 CMSIS_INLINE __STATIC_INLINE uint32_t __PKHTB(
1080 uint32_t rightshift)
1082 return ( ((x ) & 0xFFFF0000UL) |
1083 ((y >> rightshift) & 0x0000FFFFUL) );
1087 /* #endif // defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
1088 #endif /* !defined (ARM_MATH_DSP) */
1092 * @brief Instance structure for the Q7 FIR filter.
1096 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1097 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1098 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
1099 } arm_fir_instance_q7;
1102 * @brief Instance structure for the Q15 FIR filter.
1106 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1107 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1108 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
1109 } arm_fir_instance_q15;
1112 * @brief Instance structure for the Q31 FIR filter.
1116 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1117 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1118 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
1119 } arm_fir_instance_q31;
1122 * @brief Instance structure for the floating-point FIR filter.
1126 uint16_t numTaps; /**< number of filter coefficients in the filter. */
1127 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1128 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
1129 } arm_fir_instance_f32;
1133 * @brief Processing function for the Q7 FIR filter.
1134 * @param[in] S points to an instance of the Q7 FIR filter structure.
1135 * @param[in] pSrc points to the block of input data.
1136 * @param[out] pDst points to the block of output data.
1137 * @param[in] blockSize number of samples to process.
1140 const arm_fir_instance_q7 * S,
1143 uint32_t blockSize);
1147 * @brief Initialization function for the Q7 FIR filter.
1148 * @param[in,out] S points to an instance of the Q7 FIR structure.
1149 * @param[in] numTaps Number of filter coefficients in the filter.
1150 * @param[in] pCoeffs points to the filter coefficients.
1151 * @param[in] pState points to the state buffer.
1152 * @param[in] blockSize number of samples that are processed.
1154 void arm_fir_init_q7(
1155 arm_fir_instance_q7 * S,
1159 uint32_t blockSize);
1163 * @brief Processing function for the Q15 FIR filter.
1164 * @param[in] S points to an instance of the Q15 FIR structure.
1165 * @param[in] pSrc points to the block of input data.
1166 * @param[out] pDst points to the block of output data.
1167 * @param[in] blockSize number of samples to process.
1170 const arm_fir_instance_q15 * S,
1173 uint32_t blockSize);
1177 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
1178 * @param[in] S points to an instance of the Q15 FIR filter structure.
1179 * @param[in] pSrc points to the block of input data.
1180 * @param[out] pDst points to the block of output data.
1181 * @param[in] blockSize number of samples to process.
1183 void arm_fir_fast_q15(
1184 const arm_fir_instance_q15 * S,
1187 uint32_t blockSize);
1191 * @brief Initialization function for the Q15 FIR filter.
1192 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
1193 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
1194 * @param[in] pCoeffs points to the filter coefficients.
1195 * @param[in] pState points to the state buffer.
1196 * @param[in] blockSize number of samples that are processed at a time.
1197 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
1198 * <code>numTaps</code> is not a supported value.
1200 arm_status arm_fir_init_q15(
1201 arm_fir_instance_q15 * S,
1205 uint32_t blockSize);
1209 * @brief Processing function for the Q31 FIR filter.
1210 * @param[in] S points to an instance of the Q31 FIR filter structure.
1211 * @param[in] pSrc points to the block of input data.
1212 * @param[out] pDst points to the block of output data.
1213 * @param[in] blockSize number of samples to process.
1216 const arm_fir_instance_q31 * S,
1219 uint32_t blockSize);
1223 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
1224 * @param[in] S points to an instance of the Q31 FIR structure.
1225 * @param[in] pSrc points to the block of input data.
1226 * @param[out] pDst points to the block of output data.
1227 * @param[in] blockSize number of samples to process.
1229 void arm_fir_fast_q31(
1230 const arm_fir_instance_q31 * S,
1233 uint32_t blockSize);
1237 * @brief Initialization function for the Q31 FIR filter.
1238 * @param[in,out] S points to an instance of the Q31 FIR structure.
1239 * @param[in] numTaps Number of filter coefficients in the filter.
1240 * @param[in] pCoeffs points to the filter coefficients.
1241 * @param[in] pState points to the state buffer.
1242 * @param[in] blockSize number of samples that are processed at a time.
1244 void arm_fir_init_q31(
1245 arm_fir_instance_q31 * S,
1249 uint32_t blockSize);
1253 * @brief Processing function for the floating-point FIR filter.
1254 * @param[in] S points to an instance of the floating-point FIR structure.
1255 * @param[in] pSrc points to the block of input data.
1256 * @param[out] pDst points to the block of output data.
1257 * @param[in] blockSize number of samples to process.
1260 const arm_fir_instance_f32 * S,
1263 uint32_t blockSize);
1267 * @brief Initialization function for the floating-point FIR filter.
1268 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
1269 * @param[in] numTaps Number of filter coefficients in the filter.
1270 * @param[in] pCoeffs points to the filter coefficients.
1271 * @param[in] pState points to the state buffer.
1272 * @param[in] blockSize number of samples that are processed at a time.
1274 void arm_fir_init_f32(
1275 arm_fir_instance_f32 * S,
1277 float32_t * pCoeffs,
1279 uint32_t blockSize);
1283 * @brief Instance structure for the Q15 Biquad cascade filter.
1287 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1288 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1289 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1290 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
1291 } arm_biquad_casd_df1_inst_q15;
1294 * @brief Instance structure for the Q31 Biquad cascade filter.
1298 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1299 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1300 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1301 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
1302 } arm_biquad_casd_df1_inst_q31;
1305 * @brief Instance structure for the floating-point Biquad cascade filter.
1309 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1310 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1311 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1312 } arm_biquad_casd_df1_inst_f32;
1316 * @brief Processing function for the Q15 Biquad cascade filter.
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_q15(
1323 const arm_biquad_casd_df1_inst_q15 * S,
1326 uint32_t blockSize);
1330 * @brief Initialization function for the Q15 Biquad cascade filter.
1331 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
1332 * @param[in] numStages number of 2nd order stages in the filter.
1333 * @param[in] pCoeffs points to the filter coefficients.
1334 * @param[in] pState points to the state buffer.
1335 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1337 void arm_biquad_cascade_df1_init_q15(
1338 arm_biquad_casd_df1_inst_q15 * S,
1346 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1347 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1348 * @param[in] pSrc points to the block of input data.
1349 * @param[out] pDst points to the block of output data.
1350 * @param[in] blockSize number of samples to process.
1352 void arm_biquad_cascade_df1_fast_q15(
1353 const arm_biquad_casd_df1_inst_q15 * S,
1356 uint32_t blockSize);
1360 * @brief Processing function for the Q31 Biquad cascade filter
1361 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1362 * @param[in] pSrc points to the block of input data.
1363 * @param[out] pDst points to the block of output data.
1364 * @param[in] blockSize number of samples to process.
1366 void arm_biquad_cascade_df1_q31(
1367 const arm_biquad_casd_df1_inst_q31 * S,
1370 uint32_t blockSize);
1374 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1375 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1376 * @param[in] pSrc points to the block of input data.
1377 * @param[out] pDst points to the block of output data.
1378 * @param[in] blockSize number of samples to process.
1380 void arm_biquad_cascade_df1_fast_q31(
1381 const arm_biquad_casd_df1_inst_q31 * S,
1384 uint32_t blockSize);
1388 * @brief Initialization function for the Q31 Biquad cascade filter.
1389 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
1390 * @param[in] numStages number of 2nd order stages in the filter.
1391 * @param[in] pCoeffs points to the filter coefficients.
1392 * @param[in] pState points to the state buffer.
1393 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1395 void arm_biquad_cascade_df1_init_q31(
1396 arm_biquad_casd_df1_inst_q31 * S,
1404 * @brief Processing function for the floating-point Biquad cascade filter.
1405 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
1406 * @param[in] pSrc points to the block of input data.
1407 * @param[out] pDst points to the block of output data.
1408 * @param[in] blockSize number of samples to process.
1410 void arm_biquad_cascade_df1_f32(
1411 const arm_biquad_casd_df1_inst_f32 * S,
1414 uint32_t blockSize);
1418 * @brief Initialization function for the floating-point Biquad cascade filter.
1419 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
1420 * @param[in] numStages number of 2nd order stages in the filter.
1421 * @param[in] pCoeffs points to the filter coefficients.
1422 * @param[in] pState points to the state buffer.
1424 void arm_biquad_cascade_df1_init_f32(
1425 arm_biquad_casd_df1_inst_f32 * S,
1427 float32_t * pCoeffs,
1428 float32_t * pState);
1432 * @brief Instance structure for the floating-point matrix structure.
1436 uint16_t numRows; /**< number of rows of the matrix. */
1437 uint16_t numCols; /**< number of columns of the matrix. */
1438 float32_t *pData; /**< points to the data of the matrix. */
1439 } arm_matrix_instance_f32;
1443 * @brief Instance structure for the floating-point matrix structure.
1447 uint16_t numRows; /**< number of rows of the matrix. */
1448 uint16_t numCols; /**< number of columns of the matrix. */
1449 float64_t *pData; /**< points to the data of the matrix. */
1450 } arm_matrix_instance_f64;
1453 * @brief Instance structure for the Q15 matrix structure.
1457 uint16_t numRows; /**< number of rows of the matrix. */
1458 uint16_t numCols; /**< number of columns of the matrix. */
1459 q15_t *pData; /**< points to the data of the matrix. */
1460 } arm_matrix_instance_q15;
1463 * @brief Instance structure for the Q31 matrix structure.
1467 uint16_t numRows; /**< number of rows of the matrix. */
1468 uint16_t numCols; /**< number of columns of the matrix. */
1469 q31_t *pData; /**< points to the data of the matrix. */
1470 } arm_matrix_instance_q31;
1474 * @brief Floating-point matrix addition.
1475 * @param[in] pSrcA points to the first input matrix structure
1476 * @param[in] pSrcB points to the second input matrix structure
1477 * @param[out] pDst points to output matrix structure
1478 * @return The function returns either
1479 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1481 arm_status arm_mat_add_f32(
1482 const arm_matrix_instance_f32 * pSrcA,
1483 const arm_matrix_instance_f32 * pSrcB,
1484 arm_matrix_instance_f32 * pDst);
1488 * @brief Q15 matrix addition.
1489 * @param[in] pSrcA points to the first input matrix structure
1490 * @param[in] pSrcB points to the second input matrix structure
1491 * @param[out] pDst points to output matrix structure
1492 * @return The function returns either
1493 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1495 arm_status arm_mat_add_q15(
1496 const arm_matrix_instance_q15 * pSrcA,
1497 const arm_matrix_instance_q15 * pSrcB,
1498 arm_matrix_instance_q15 * pDst);
1502 * @brief Q31 matrix addition.
1503 * @param[in] pSrcA points to the first input matrix structure
1504 * @param[in] pSrcB points to the second input matrix structure
1505 * @param[out] pDst points to output matrix structure
1506 * @return The function returns either
1507 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1509 arm_status arm_mat_add_q31(
1510 const arm_matrix_instance_q31 * pSrcA,
1511 const arm_matrix_instance_q31 * pSrcB,
1512 arm_matrix_instance_q31 * pDst);
1516 * @brief Floating-point, complex, matrix multiplication.
1517 * @param[in] pSrcA points to the first input matrix structure
1518 * @param[in] pSrcB points to the second input matrix structure
1519 * @param[out] pDst points to output matrix structure
1520 * @return The function returns either
1521 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1523 arm_status arm_mat_cmplx_mult_f32(
1524 const arm_matrix_instance_f32 * pSrcA,
1525 const arm_matrix_instance_f32 * pSrcB,
1526 arm_matrix_instance_f32 * pDst);
1530 * @brief Q15, complex, matrix multiplication.
1531 * @param[in] pSrcA points to the first input matrix structure
1532 * @param[in] pSrcB points to the second input matrix structure
1533 * @param[out] pDst points to output matrix structure
1534 * @return The function returns either
1535 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1537 arm_status arm_mat_cmplx_mult_q15(
1538 const arm_matrix_instance_q15 * pSrcA,
1539 const arm_matrix_instance_q15 * pSrcB,
1540 arm_matrix_instance_q15 * pDst,
1545 * @brief Q31, complex, matrix multiplication.
1546 * @param[in] pSrcA points to the first input matrix structure
1547 * @param[in] pSrcB points to the second input matrix structure
1548 * @param[out] pDst points to output matrix structure
1549 * @return The function returns either
1550 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1552 arm_status arm_mat_cmplx_mult_q31(
1553 const arm_matrix_instance_q31 * pSrcA,
1554 const arm_matrix_instance_q31 * pSrcB,
1555 arm_matrix_instance_q31 * pDst);
1559 * @brief Floating-point matrix transpose.
1560 * @param[in] pSrc points to the input matrix
1561 * @param[out] pDst points to the output matrix
1562 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1563 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1565 arm_status arm_mat_trans_f32(
1566 const arm_matrix_instance_f32 * pSrc,
1567 arm_matrix_instance_f32 * pDst);
1571 * @brief Q15 matrix transpose.
1572 * @param[in] pSrc points to the input matrix
1573 * @param[out] pDst points to the output matrix
1574 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1575 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1577 arm_status arm_mat_trans_q15(
1578 const arm_matrix_instance_q15 * pSrc,
1579 arm_matrix_instance_q15 * pDst);
1583 * @brief Q31 matrix transpose.
1584 * @param[in] pSrc points to the input matrix
1585 * @param[out] pDst points to the output matrix
1586 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1587 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1589 arm_status arm_mat_trans_q31(
1590 const arm_matrix_instance_q31 * pSrc,
1591 arm_matrix_instance_q31 * pDst);
1595 * @brief Floating-point matrix multiplication
1596 * @param[in] pSrcA points to the first input matrix structure
1597 * @param[in] pSrcB points to the second input matrix structure
1598 * @param[out] pDst points to output matrix structure
1599 * @return The function returns either
1600 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1602 arm_status arm_mat_mult_f32(
1603 const arm_matrix_instance_f32 * pSrcA,
1604 const arm_matrix_instance_f32 * pSrcB,
1605 arm_matrix_instance_f32 * pDst);
1609 * @brief Q15 matrix multiplication
1610 * @param[in] pSrcA points to the first input matrix structure
1611 * @param[in] pSrcB points to the second input matrix structure
1612 * @param[out] pDst points to output matrix structure
1613 * @param[in] pState points to the array for storing intermediate results
1614 * @return The function returns either
1615 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1617 arm_status arm_mat_mult_q15(
1618 const arm_matrix_instance_q15 * pSrcA,
1619 const arm_matrix_instance_q15 * pSrcB,
1620 arm_matrix_instance_q15 * pDst,
1625 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1626 * @param[in] pSrcA points to the first input matrix structure
1627 * @param[in] pSrcB points to the second input matrix structure
1628 * @param[out] pDst points to output matrix structure
1629 * @param[in] pState points to the array for storing intermediate results
1630 * @return The function returns either
1631 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1633 arm_status arm_mat_mult_fast_q15(
1634 const arm_matrix_instance_q15 * pSrcA,
1635 const arm_matrix_instance_q15 * pSrcB,
1636 arm_matrix_instance_q15 * pDst,
1641 * @brief Q31 matrix multiplication
1642 * @param[in] pSrcA points to the first input matrix structure
1643 * @param[in] pSrcB points to the second input matrix structure
1644 * @param[out] pDst points to output matrix structure
1645 * @return The function returns either
1646 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1648 arm_status arm_mat_mult_q31(
1649 const arm_matrix_instance_q31 * pSrcA,
1650 const arm_matrix_instance_q31 * pSrcB,
1651 arm_matrix_instance_q31 * pDst);
1655 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1656 * @param[in] pSrcA points to the first input matrix structure
1657 * @param[in] pSrcB points to the second input matrix structure
1658 * @param[out] pDst points to output matrix structure
1659 * @return The function returns either
1660 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1662 arm_status arm_mat_mult_fast_q31(
1663 const arm_matrix_instance_q31 * pSrcA,
1664 const arm_matrix_instance_q31 * pSrcB,
1665 arm_matrix_instance_q31 * pDst);
1669 * @brief Floating-point matrix subtraction
1670 * @param[in] pSrcA points to the first input matrix structure
1671 * @param[in] pSrcB points to the second input matrix structure
1672 * @param[out] pDst points to output matrix structure
1673 * @return The function returns either
1674 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1676 arm_status arm_mat_sub_f32(
1677 const arm_matrix_instance_f32 * pSrcA,
1678 const arm_matrix_instance_f32 * pSrcB,
1679 arm_matrix_instance_f32 * pDst);
1683 * @brief Q15 matrix subtraction
1684 * @param[in] pSrcA points to the first input matrix structure
1685 * @param[in] pSrcB points to the second input matrix structure
1686 * @param[out] pDst points to output matrix structure
1687 * @return The function returns either
1688 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1690 arm_status arm_mat_sub_q15(
1691 const arm_matrix_instance_q15 * pSrcA,
1692 const arm_matrix_instance_q15 * pSrcB,
1693 arm_matrix_instance_q15 * pDst);
1697 * @brief Q31 matrix subtraction
1698 * @param[in] pSrcA points to the first input matrix structure
1699 * @param[in] pSrcB points to the second input matrix structure
1700 * @param[out] pDst points to output matrix structure
1701 * @return The function returns either
1702 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1704 arm_status arm_mat_sub_q31(
1705 const arm_matrix_instance_q31 * pSrcA,
1706 const arm_matrix_instance_q31 * pSrcB,
1707 arm_matrix_instance_q31 * pDst);
1711 * @brief Floating-point matrix scaling.
1712 * @param[in] pSrc points to the input matrix
1713 * @param[in] scale scale factor
1714 * @param[out] pDst points to the output matrix
1715 * @return The function returns either
1716 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1718 arm_status arm_mat_scale_f32(
1719 const arm_matrix_instance_f32 * pSrc,
1721 arm_matrix_instance_f32 * pDst);
1725 * @brief Q15 matrix scaling.
1726 * @param[in] pSrc points to input matrix
1727 * @param[in] scaleFract fractional portion of the scale factor
1728 * @param[in] shift number of bits to shift the result by
1729 * @param[out] pDst points to output matrix
1730 * @return The function returns either
1731 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1733 arm_status arm_mat_scale_q15(
1734 const arm_matrix_instance_q15 * pSrc,
1737 arm_matrix_instance_q15 * pDst);
1741 * @brief Q31 matrix scaling.
1742 * @param[in] pSrc points to input matrix
1743 * @param[in] scaleFract fractional portion of the scale factor
1744 * @param[in] shift number of bits to shift the result by
1745 * @param[out] pDst points to output matrix structure
1746 * @return The function returns either
1747 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1749 arm_status arm_mat_scale_q31(
1750 const arm_matrix_instance_q31 * pSrc,
1753 arm_matrix_instance_q31 * pDst);
1757 * @brief Q31 matrix initialization.
1758 * @param[in,out] S points to an instance of the floating-point matrix structure.
1759 * @param[in] nRows number of rows in the matrix.
1760 * @param[in] nColumns number of columns in the matrix.
1761 * @param[in] pData points to the matrix data array.
1763 void arm_mat_init_q31(
1764 arm_matrix_instance_q31 * S,
1771 * @brief Q15 matrix initialization.
1772 * @param[in,out] S points to an instance of the floating-point matrix structure.
1773 * @param[in] nRows number of rows in the matrix.
1774 * @param[in] nColumns number of columns in the matrix.
1775 * @param[in] pData points to the matrix data array.
1777 void arm_mat_init_q15(
1778 arm_matrix_instance_q15 * S,
1785 * @brief Floating-point matrix initialization.
1786 * @param[in,out] S points to an instance of the floating-point matrix structure.
1787 * @param[in] nRows number of rows in the matrix.
1788 * @param[in] nColumns number of columns in the matrix.
1789 * @param[in] pData points to the matrix data array.
1791 void arm_mat_init_f32(
1792 arm_matrix_instance_f32 * S,
1800 * @brief Instance structure for the Q15 PID Control.
1804 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1805 #if !defined (ARM_MATH_DSP)
1809 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
1811 q15_t state[3]; /**< The state array of length 3. */
1812 q15_t Kp; /**< The proportional gain. */
1813 q15_t Ki; /**< The integral gain. */
1814 q15_t Kd; /**< The derivative gain. */
1815 } arm_pid_instance_q15;
1818 * @brief Instance structure for the Q31 PID Control.
1822 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1823 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
1824 q31_t A2; /**< The derived gain, A2 = Kd . */
1825 q31_t state[3]; /**< The state array of length 3. */
1826 q31_t Kp; /**< The proportional gain. */
1827 q31_t Ki; /**< The integral gain. */
1828 q31_t Kd; /**< The derivative gain. */
1829 } arm_pid_instance_q31;
1832 * @brief Instance structure for the floating-point PID Control.
1836 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
1837 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
1838 float32_t A2; /**< The derived gain, A2 = Kd . */
1839 float32_t state[3]; /**< The state array of length 3. */
1840 float32_t Kp; /**< The proportional gain. */
1841 float32_t Ki; /**< The integral gain. */
1842 float32_t Kd; /**< The derivative gain. */
1843 } arm_pid_instance_f32;
1848 * @brief Initialization function for the floating-point PID Control.
1849 * @param[in,out] S points to an instance of the PID structure.
1850 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1852 void arm_pid_init_f32(
1853 arm_pid_instance_f32 * S,
1854 int32_t resetStateFlag);
1858 * @brief Reset function for the floating-point PID Control.
1859 * @param[in,out] S is an instance of the floating-point PID Control structure
1861 void arm_pid_reset_f32(
1862 arm_pid_instance_f32 * S);
1866 * @brief Initialization function for the Q31 PID Control.
1867 * @param[in,out] S points to an instance of the Q15 PID structure.
1868 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1870 void arm_pid_init_q31(
1871 arm_pid_instance_q31 * S,
1872 int32_t resetStateFlag);
1876 * @brief Reset function for the Q31 PID Control.
1877 * @param[in,out] S points to an instance of the Q31 PID Control structure
1880 void arm_pid_reset_q31(
1881 arm_pid_instance_q31 * S);
1885 * @brief Initialization function for the Q15 PID Control.
1886 * @param[in,out] S points to an instance of the Q15 PID structure.
1887 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1889 void arm_pid_init_q15(
1890 arm_pid_instance_q15 * S,
1891 int32_t resetStateFlag);
1895 * @brief Reset function for the Q15 PID Control.
1896 * @param[in,out] S points to an instance of the q15 PID Control structure
1898 void arm_pid_reset_q15(
1899 arm_pid_instance_q15 * S);
1903 * @brief Instance structure for the floating-point Linear Interpolate function.
1907 uint32_t nValues; /**< nValues */
1908 float32_t x1; /**< x1 */
1909 float32_t xSpacing; /**< xSpacing */
1910 float32_t *pYData; /**< pointer to the table of Y values */
1911 } arm_linear_interp_instance_f32;
1914 * @brief Instance structure for the floating-point bilinear interpolation function.
1918 uint16_t numRows; /**< number of rows in the data table. */
1919 uint16_t numCols; /**< number of columns in the data table. */
1920 float32_t *pData; /**< points to the data table. */
1921 } arm_bilinear_interp_instance_f32;
1924 * @brief Instance structure for the Q31 bilinear interpolation function.
1928 uint16_t numRows; /**< number of rows in the data table. */
1929 uint16_t numCols; /**< number of columns in the data table. */
1930 q31_t *pData; /**< points to the data table. */
1931 } arm_bilinear_interp_instance_q31;
1934 * @brief Instance structure for the Q15 bilinear interpolation function.
1938 uint16_t numRows; /**< number of rows in the data table. */
1939 uint16_t numCols; /**< number of columns in the data table. */
1940 q15_t *pData; /**< points to the data table. */
1941 } arm_bilinear_interp_instance_q15;
1944 * @brief Instance structure for the Q15 bilinear interpolation function.
1948 uint16_t numRows; /**< number of rows in the data table. */
1949 uint16_t numCols; /**< number of columns in the data table. */
1950 q7_t *pData; /**< points to the data table. */
1951 } arm_bilinear_interp_instance_q7;
1955 * @brief Q7 vector multiplication.
1956 * @param[in] pSrcA points to the first input vector
1957 * @param[in] pSrcB points to the second input vector
1958 * @param[out] pDst points to the output vector
1959 * @param[in] blockSize number of samples in each vector
1965 uint32_t blockSize);
1969 * @brief Q15 vector multiplication.
1970 * @param[in] pSrcA points to the first input vector
1971 * @param[in] pSrcB points to the second input vector
1972 * @param[out] pDst points to the output vector
1973 * @param[in] blockSize number of samples in each vector
1979 uint32_t blockSize);
1983 * @brief Q31 vector multiplication.
1984 * @param[in] pSrcA points to the first input vector
1985 * @param[in] pSrcB points to the second input vector
1986 * @param[out] pDst points to the output vector
1987 * @param[in] blockSize number of samples in each vector
1993 uint32_t blockSize);
1997 * @brief Floating-point vector multiplication.
1998 * @param[in] pSrcA points to the first input vector
1999 * @param[in] pSrcB points to the second input vector
2000 * @param[out] pDst points to the output vector
2001 * @param[in] blockSize number of samples in each vector
2007 uint32_t blockSize);
2011 * @brief Instance structure for the Q15 CFFT/CIFFT function.
2015 uint16_t fftLen; /**< length of the FFT. */
2016 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2017 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2018 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
2019 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2020 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2021 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2022 } arm_cfft_radix2_instance_q15;
2025 arm_status arm_cfft_radix2_init_q15(
2026 arm_cfft_radix2_instance_q15 * S,
2029 uint8_t bitReverseFlag);
2032 void arm_cfft_radix2_q15(
2033 const arm_cfft_radix2_instance_q15 * S,
2038 * @brief Instance structure for the Q15 CFFT/CIFFT function.
2042 uint16_t fftLen; /**< length of the FFT. */
2043 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2044 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2045 q15_t *pTwiddle; /**< points to the twiddle factor table. */
2046 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2047 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2048 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2049 } arm_cfft_radix4_instance_q15;
2052 arm_status arm_cfft_radix4_init_q15(
2053 arm_cfft_radix4_instance_q15 * S,
2056 uint8_t bitReverseFlag);
2059 void arm_cfft_radix4_q15(
2060 const arm_cfft_radix4_instance_q15 * S,
2064 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
2068 uint16_t fftLen; /**< length of the FFT. */
2069 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2070 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2071 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
2072 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2073 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2074 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2075 } arm_cfft_radix2_instance_q31;
2078 arm_status arm_cfft_radix2_init_q31(
2079 arm_cfft_radix2_instance_q31 * S,
2082 uint8_t bitReverseFlag);
2085 void arm_cfft_radix2_q31(
2086 const arm_cfft_radix2_instance_q31 * S,
2090 * @brief Instance structure for the Q31 CFFT/CIFFT function.
2094 uint16_t fftLen; /**< length of the FFT. */
2095 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2096 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2097 q31_t *pTwiddle; /**< points to the twiddle factor table. */
2098 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2099 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2100 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2101 } arm_cfft_radix4_instance_q31;
2104 void arm_cfft_radix4_q31(
2105 const arm_cfft_radix4_instance_q31 * S,
2109 arm_status arm_cfft_radix4_init_q31(
2110 arm_cfft_radix4_instance_q31 * S,
2113 uint8_t bitReverseFlag);
2116 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2120 uint16_t fftLen; /**< length of the FFT. */
2121 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2122 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2123 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
2124 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2125 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2126 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2127 float32_t onebyfftLen; /**< value of 1/fftLen. */
2128 } arm_cfft_radix2_instance_f32;
2131 arm_status arm_cfft_radix2_init_f32(
2132 arm_cfft_radix2_instance_f32 * S,
2135 uint8_t bitReverseFlag);
2138 void arm_cfft_radix2_f32(
2139 const arm_cfft_radix2_instance_f32 * S,
2143 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2147 uint16_t fftLen; /**< length of the FFT. */
2148 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2149 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2150 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
2151 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2152 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2153 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2154 float32_t onebyfftLen; /**< value of 1/fftLen. */
2155 } arm_cfft_radix4_instance_f32;
2158 arm_status arm_cfft_radix4_init_f32(
2159 arm_cfft_radix4_instance_f32 * S,
2162 uint8_t bitReverseFlag);
2165 void arm_cfft_radix4_f32(
2166 const arm_cfft_radix4_instance_f32 * S,
2170 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2174 uint16_t fftLen; /**< length of the FFT. */
2175 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
2176 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2177 uint16_t bitRevLength; /**< bit reversal table length. */
2178 } arm_cfft_instance_q15;
2181 const arm_cfft_instance_q15 * S,
2184 uint8_t bitReverseFlag);
2187 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2191 uint16_t fftLen; /**< length of the FFT. */
2192 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
2193 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2194 uint16_t bitRevLength; /**< bit reversal table length. */
2195 } arm_cfft_instance_q31;
2198 const arm_cfft_instance_q31 * S,
2201 uint8_t bitReverseFlag);
2204 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2208 uint16_t fftLen; /**< length of the FFT. */
2209 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
2210 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
2211 uint16_t bitRevLength; /**< bit reversal table length. */
2212 } arm_cfft_instance_f32;
2215 const arm_cfft_instance_f32 * S,
2218 uint8_t bitReverseFlag);
2221 * @brief Instance structure for the Q15 RFFT/RIFFT function.
2225 uint32_t fftLenReal; /**< length of the real FFT. */
2226 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2227 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2228 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2229 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2230 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2231 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
2232 } arm_rfft_instance_q15;
2234 arm_status arm_rfft_init_q15(
2235 arm_rfft_instance_q15 * S,
2236 uint32_t fftLenReal,
2238 uint32_t bitReverseFlag);
2241 const arm_rfft_instance_q15 * S,
2246 * @brief Instance structure for the Q31 RFFT/RIFFT function.
2250 uint32_t fftLenReal; /**< length of the real FFT. */
2251 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2252 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2253 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2254 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2255 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2256 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
2257 } arm_rfft_instance_q31;
2259 arm_status arm_rfft_init_q31(
2260 arm_rfft_instance_q31 * S,
2261 uint32_t fftLenReal,
2263 uint32_t bitReverseFlag);
2266 const arm_rfft_instance_q31 * S,
2271 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2275 uint32_t fftLenReal; /**< length of the real FFT. */
2276 uint16_t fftLenBy2; /**< length of the complex FFT. */
2277 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2278 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2279 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2280 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
2281 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
2282 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
2283 } arm_rfft_instance_f32;
2285 arm_status arm_rfft_init_f32(
2286 arm_rfft_instance_f32 * S,
2287 arm_cfft_radix4_instance_f32 * S_CFFT,
2288 uint32_t fftLenReal,
2290 uint32_t bitReverseFlag);
2293 const arm_rfft_instance_f32 * S,
2298 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2302 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
2303 uint16_t fftLenRFFT; /**< length of the real sequence */
2304 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
2305 } arm_rfft_fast_instance_f32 ;
2307 arm_status arm_rfft_fast_init_f32 (
2308 arm_rfft_fast_instance_f32 * S,
2311 void arm_rfft_fast_f32(
2312 arm_rfft_fast_instance_f32 * S,
2313 float32_t * p, float32_t * pOut,
2317 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
2321 uint16_t N; /**< length of the DCT4. */
2322 uint16_t Nby2; /**< half of the length of the DCT4. */
2323 float32_t normalize; /**< normalizing factor. */
2324 float32_t *pTwiddle; /**< points to the twiddle factor table. */
2325 float32_t *pCosFactor; /**< points to the cosFactor table. */
2326 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
2327 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
2328 } arm_dct4_instance_f32;
2332 * @brief Initialization function for the floating-point DCT4/IDCT4.
2333 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
2334 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
2335 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
2336 * @param[in] N length of the DCT4.
2337 * @param[in] Nby2 half of the length of the DCT4.
2338 * @param[in] normalize normalizing factor.
2339 * @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.
2341 arm_status arm_dct4_init_f32(
2342 arm_dct4_instance_f32 * S,
2343 arm_rfft_instance_f32 * S_RFFT,
2344 arm_cfft_radix4_instance_f32 * S_CFFT,
2347 float32_t normalize);
2351 * @brief Processing function for the floating-point DCT4/IDCT4.
2352 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
2353 * @param[in] pState points to state buffer.
2354 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2357 const arm_dct4_instance_f32 * S,
2359 float32_t * pInlineBuffer);
2363 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
2367 uint16_t N; /**< length of the DCT4. */
2368 uint16_t Nby2; /**< half of the length of the DCT4. */
2369 q31_t normalize; /**< normalizing factor. */
2370 q31_t *pTwiddle; /**< points to the twiddle factor table. */
2371 q31_t *pCosFactor; /**< points to the cosFactor table. */
2372 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
2373 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
2374 } arm_dct4_instance_q31;
2378 * @brief Initialization function for the Q31 DCT4/IDCT4.
2379 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
2380 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
2381 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
2382 * @param[in] N length of the DCT4.
2383 * @param[in] Nby2 half of the length of the DCT4.
2384 * @param[in] normalize normalizing factor.
2385 * @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.
2387 arm_status arm_dct4_init_q31(
2388 arm_dct4_instance_q31 * S,
2389 arm_rfft_instance_q31 * S_RFFT,
2390 arm_cfft_radix4_instance_q31 * S_CFFT,
2397 * @brief Processing function for the Q31 DCT4/IDCT4.
2398 * @param[in] S points to an instance of the Q31 DCT4 structure.
2399 * @param[in] pState points to state buffer.
2400 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2403 const arm_dct4_instance_q31 * S,
2405 q31_t * pInlineBuffer);
2409 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
2413 uint16_t N; /**< length of the DCT4. */
2414 uint16_t Nby2; /**< half of the length of the DCT4. */
2415 q15_t normalize; /**< normalizing factor. */
2416 q15_t *pTwiddle; /**< points to the twiddle factor table. */
2417 q15_t *pCosFactor; /**< points to the cosFactor table. */
2418 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
2419 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
2420 } arm_dct4_instance_q15;
2424 * @brief Initialization function for the Q15 DCT4/IDCT4.
2425 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
2426 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
2427 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
2428 * @param[in] N length of the DCT4.
2429 * @param[in] Nby2 half of the length of the DCT4.
2430 * @param[in] normalize normalizing factor.
2431 * @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.
2433 arm_status arm_dct4_init_q15(
2434 arm_dct4_instance_q15 * S,
2435 arm_rfft_instance_q15 * S_RFFT,
2436 arm_cfft_radix4_instance_q15 * S_CFFT,
2443 * @brief Processing function for the Q15 DCT4/IDCT4.
2444 * @param[in] S points to an instance of the Q15 DCT4 structure.
2445 * @param[in] pState points to state buffer.
2446 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2449 const arm_dct4_instance_q15 * S,
2451 q15_t * pInlineBuffer);
2455 * @brief Floating-point vector addition.
2456 * @param[in] pSrcA points to the first input vector
2457 * @param[in] pSrcB points to the second input vector
2458 * @param[out] pDst points to the output vector
2459 * @param[in] blockSize number of samples in each vector
2465 uint32_t blockSize);
2469 * @brief Q7 vector addition.
2470 * @param[in] pSrcA points to the first input vector
2471 * @param[in] pSrcB points to the second input vector
2472 * @param[out] pDst points to the output vector
2473 * @param[in] blockSize number of samples in each vector
2479 uint32_t blockSize);
2483 * @brief Q15 vector addition.
2484 * @param[in] pSrcA points to the first input vector
2485 * @param[in] pSrcB points to the second input vector
2486 * @param[out] pDst points to the output vector
2487 * @param[in] blockSize number of samples in each vector
2493 uint32_t blockSize);
2497 * @brief Q31 vector addition.
2498 * @param[in] pSrcA points to the first input vector
2499 * @param[in] pSrcB points to the second input vector
2500 * @param[out] pDst points to the output vector
2501 * @param[in] blockSize number of samples in each vector
2507 uint32_t blockSize);
2511 * @brief Floating-point vector subtraction.
2512 * @param[in] pSrcA points to the first input vector
2513 * @param[in] pSrcB points to the second input vector
2514 * @param[out] pDst points to the output vector
2515 * @param[in] blockSize number of samples in each vector
2521 uint32_t blockSize);
2525 * @brief Q7 vector subtraction.
2526 * @param[in] pSrcA points to the first input vector
2527 * @param[in] pSrcB points to the second input vector
2528 * @param[out] pDst points to the output vector
2529 * @param[in] blockSize number of samples in each vector
2535 uint32_t blockSize);
2539 * @brief Q15 vector subtraction.
2540 * @param[in] pSrcA points to the first input vector
2541 * @param[in] pSrcB points to the second input vector
2542 * @param[out] pDst points to the output vector
2543 * @param[in] blockSize number of samples in each vector
2549 uint32_t blockSize);
2553 * @brief Q31 vector subtraction.
2554 * @param[in] pSrcA points to the first input vector
2555 * @param[in] pSrcB points to the second input vector
2556 * @param[out] pDst points to the output vector
2557 * @param[in] blockSize number of samples in each vector
2563 uint32_t blockSize);
2567 * @brief Multiplies a floating-point vector by a scalar.
2568 * @param[in] pSrc points to the input vector
2569 * @param[in] scale scale factor to be applied
2570 * @param[out] pDst points to the output vector
2571 * @param[in] blockSize number of samples in the vector
2577 uint32_t blockSize);
2581 * @brief Multiplies a Q7 vector by a scalar.
2582 * @param[in] pSrc points to the input vector
2583 * @param[in] scaleFract fractional portion of the scale value
2584 * @param[in] shift number of bits to shift the result by
2585 * @param[out] pDst points to the output vector
2586 * @param[in] blockSize number of samples in the vector
2593 uint32_t blockSize);
2597 * @brief Multiplies a Q15 vector by a scalar.
2598 * @param[in] pSrc points to the input vector
2599 * @param[in] scaleFract fractional portion of the scale value
2600 * @param[in] shift number of bits to shift the result by
2601 * @param[out] pDst points to the output vector
2602 * @param[in] blockSize number of samples in the vector
2609 uint32_t blockSize);
2613 * @brief Multiplies a Q31 vector by a scalar.
2614 * @param[in] pSrc points to the input vector
2615 * @param[in] scaleFract fractional portion of the scale value
2616 * @param[in] shift number of bits to shift the result by
2617 * @param[out] pDst points to the output vector
2618 * @param[in] blockSize number of samples in the vector
2625 uint32_t blockSize);
2629 * @brief Q7 vector absolute value.
2630 * @param[in] pSrc points to the input buffer
2631 * @param[out] pDst points to the output buffer
2632 * @param[in] blockSize number of samples in each vector
2637 uint32_t blockSize);
2641 * @brief Floating-point vector absolute value.
2642 * @param[in] pSrc points to the input buffer
2643 * @param[out] pDst points to the output buffer
2644 * @param[in] blockSize number of samples in each vector
2649 uint32_t blockSize);
2653 * @brief Q15 vector absolute value.
2654 * @param[in] pSrc points to the input buffer
2655 * @param[out] pDst points to the output buffer
2656 * @param[in] blockSize number of samples in each vector
2661 uint32_t blockSize);
2665 * @brief Q31 vector absolute value.
2666 * @param[in] pSrc points to the input buffer
2667 * @param[out] pDst points to the output buffer
2668 * @param[in] blockSize number of samples in each vector
2673 uint32_t blockSize);
2677 * @brief Dot product of floating-point vectors.
2678 * @param[in] pSrcA points to the first input vector
2679 * @param[in] pSrcB points to the second input vector
2680 * @param[in] blockSize number of samples in each vector
2681 * @param[out] result output result returned here
2683 void arm_dot_prod_f32(
2687 float32_t * result);
2691 * @brief Dot product of Q7 vectors.
2692 * @param[in] pSrcA points to the first input vector
2693 * @param[in] pSrcB points to the second input vector
2694 * @param[in] blockSize number of samples in each vector
2695 * @param[out] result output result returned here
2697 void arm_dot_prod_q7(
2705 * @brief Dot product of Q15 vectors.
2706 * @param[in] pSrcA points to the first input vector
2707 * @param[in] pSrcB points to the second input vector
2708 * @param[in] blockSize number of samples in each vector
2709 * @param[out] result output result returned here
2711 void arm_dot_prod_q15(
2719 * @brief Dot product of Q31 vectors.
2720 * @param[in] pSrcA points to the first input vector
2721 * @param[in] pSrcB points to the second input vector
2722 * @param[in] blockSize number of samples in each vector
2723 * @param[out] result output result returned here
2725 void arm_dot_prod_q31(
2733 * @brief Shifts the elements of a Q7 vector a specified number of bits.
2734 * @param[in] pSrc points to the input vector
2735 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2736 * @param[out] pDst points to the output vector
2737 * @param[in] blockSize number of samples in the vector
2743 uint32_t blockSize);
2747 * @brief Shifts the elements of a Q15 vector a specified number of bits.
2748 * @param[in] pSrc points to the input vector
2749 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2750 * @param[out] pDst points to the output vector
2751 * @param[in] blockSize number of samples in the vector
2757 uint32_t blockSize);
2761 * @brief Shifts the elements of a Q31 vector a specified number of bits.
2762 * @param[in] pSrc points to the input vector
2763 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2764 * @param[out] pDst points to the output vector
2765 * @param[in] blockSize number of samples in the vector
2771 uint32_t blockSize);
2775 * @brief Adds a constant offset to a floating-point vector.
2776 * @param[in] pSrc points to the input vector
2777 * @param[in] offset is the offset to be added
2778 * @param[out] pDst points to the output vector
2779 * @param[in] blockSize number of samples in the vector
2781 void arm_offset_f32(
2785 uint32_t blockSize);
2789 * @brief Adds a constant offset to a Q7 vector.
2790 * @param[in] pSrc points to the input vector
2791 * @param[in] offset is the offset to be added
2792 * @param[out] pDst points to the output vector
2793 * @param[in] blockSize number of samples in the vector
2799 uint32_t blockSize);
2803 * @brief Adds a constant offset to a Q15 vector.
2804 * @param[in] pSrc points to the input vector
2805 * @param[in] offset is the offset to be added
2806 * @param[out] pDst points to the output vector
2807 * @param[in] blockSize number of samples in the vector
2809 void arm_offset_q15(
2813 uint32_t blockSize);
2817 * @brief Adds a constant offset to a Q31 vector.
2818 * @param[in] pSrc points to the input vector
2819 * @param[in] offset is the offset to be added
2820 * @param[out] pDst points to the output vector
2821 * @param[in] blockSize number of samples in the vector
2823 void arm_offset_q31(
2827 uint32_t blockSize);
2831 * @brief Negates the elements of a floating-point vector.
2832 * @param[in] pSrc points to the input vector
2833 * @param[out] pDst points to the output vector
2834 * @param[in] blockSize number of samples in the vector
2836 void arm_negate_f32(
2839 uint32_t blockSize);
2843 * @brief Negates the elements of a Q7 vector.
2844 * @param[in] pSrc points to the input vector
2845 * @param[out] pDst points to the output vector
2846 * @param[in] blockSize number of samples in the vector
2851 uint32_t blockSize);
2855 * @brief Negates the elements of a Q15 vector.
2856 * @param[in] pSrc points to the input vector
2857 * @param[out] pDst points to the output vector
2858 * @param[in] blockSize number of samples in the vector
2860 void arm_negate_q15(
2863 uint32_t blockSize);
2867 * @brief Negates the elements of a Q31 vector.
2868 * @param[in] pSrc points to the input vector
2869 * @param[out] pDst points to the output vector
2870 * @param[in] blockSize number of samples in the vector
2872 void arm_negate_q31(
2875 uint32_t blockSize);
2879 * @brief Copies the elements of a floating-point vector.
2880 * @param[in] pSrc input pointer
2881 * @param[out] pDst output pointer
2882 * @param[in] blockSize number of samples to process
2887 uint32_t blockSize);
2891 * @brief Copies the elements of a Q7 vector.
2892 * @param[in] pSrc input pointer
2893 * @param[out] pDst output pointer
2894 * @param[in] blockSize number of samples to process
2899 uint32_t blockSize);
2903 * @brief Copies the elements of a Q15 vector.
2904 * @param[in] pSrc input pointer
2905 * @param[out] pDst output pointer
2906 * @param[in] blockSize number of samples to process
2911 uint32_t blockSize);
2915 * @brief Copies the elements of a Q31 vector.
2916 * @param[in] pSrc input pointer
2917 * @param[out] pDst output pointer
2918 * @param[in] blockSize number of samples to process
2923 uint32_t blockSize);
2927 * @brief Fills a constant value into a floating-point vector.
2928 * @param[in] value input value to be filled
2929 * @param[out] pDst output pointer
2930 * @param[in] blockSize number of samples to process
2935 uint32_t blockSize);
2939 * @brief Fills a constant value into a Q7 vector.
2940 * @param[in] value input value to be filled
2941 * @param[out] pDst output pointer
2942 * @param[in] blockSize number of samples to process
2947 uint32_t blockSize);
2951 * @brief Fills a constant value into a Q15 vector.
2952 * @param[in] value input value to be filled
2953 * @param[out] pDst output pointer
2954 * @param[in] blockSize number of samples to process
2959 uint32_t blockSize);
2963 * @brief Fills a constant value into a Q31 vector.
2964 * @param[in] value input value to be filled
2965 * @param[out] pDst output pointer
2966 * @param[in] blockSize number of samples to process
2971 uint32_t blockSize);
2975 * @brief Convolution of floating-point sequences.
2976 * @param[in] pSrcA points to the first input sequence.
2977 * @param[in] srcALen length of the first input sequence.
2978 * @param[in] pSrcB points to the second input sequence.
2979 * @param[in] srcBLen length of the second input sequence.
2980 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2991 * @brief Convolution of Q15 sequences.
2992 * @param[in] pSrcA points to the first input sequence.
2993 * @param[in] srcALen length of the first input sequence.
2994 * @param[in] pSrcB points to the second input sequence.
2995 * @param[in] srcBLen length of the second input sequence.
2996 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2997 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
2998 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3000 void arm_conv_opt_q15(
3011 * @brief Convolution of Q15 sequences.
3012 * @param[in] pSrcA points to the first input sequence.
3013 * @param[in] srcALen length of the first input sequence.
3014 * @param[in] pSrcB points to the second input sequence.
3015 * @param[in] srcBLen length of the second input sequence.
3016 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
3027 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3028 * @param[in] pSrcA points to the first input sequence.
3029 * @param[in] srcALen length of the first input sequence.
3030 * @param[in] pSrcB points to the second input sequence.
3031 * @param[in] srcBLen length of the second input sequence.
3032 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3034 void arm_conv_fast_q15(
3043 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3044 * @param[in] pSrcA points to the first input sequence.
3045 * @param[in] srcALen length of the first input sequence.
3046 * @param[in] pSrcB points to the second input sequence.
3047 * @param[in] srcBLen length of the second input sequence.
3048 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3049 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3050 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3052 void arm_conv_fast_opt_q15(
3063 * @brief Convolution of Q31 sequences.
3064 * @param[in] pSrcA points to the first input sequence.
3065 * @param[in] srcALen length of the first input sequence.
3066 * @param[in] pSrcB points to the second input sequence.
3067 * @param[in] srcBLen length of the second input sequence.
3068 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3079 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3080 * @param[in] pSrcA points to the first input sequence.
3081 * @param[in] srcALen length of the first input sequence.
3082 * @param[in] pSrcB points to the second input sequence.
3083 * @param[in] srcBLen length of the second input sequence.
3084 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3086 void arm_conv_fast_q31(
3095 * @brief Convolution of Q7 sequences.
3096 * @param[in] pSrcA points to the first input sequence.
3097 * @param[in] srcALen length of the first input sequence.
3098 * @param[in] pSrcB points to the second input sequence.
3099 * @param[in] srcBLen length of the second input sequence.
3100 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3101 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3102 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3104 void arm_conv_opt_q7(
3115 * @brief Convolution of Q7 sequences.
3116 * @param[in] pSrcA points to the first input sequence.
3117 * @param[in] srcALen length of the first input sequence.
3118 * @param[in] pSrcB points to the second input sequence.
3119 * @param[in] srcBLen length of the second input sequence.
3120 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3131 * @brief Partial convolution of floating-point sequences.
3132 * @param[in] pSrcA points to the first input sequence.
3133 * @param[in] srcALen length of the first input sequence.
3134 * @param[in] pSrcB points to the second input sequence.
3135 * @param[in] srcBLen length of the second input sequence.
3136 * @param[out] pDst points to the block of output data
3137 * @param[in] firstIndex is the first output sample to start with.
3138 * @param[in] numPoints is the number of output points to be computed.
3139 * @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].
3141 arm_status arm_conv_partial_f32(
3147 uint32_t firstIndex,
3148 uint32_t numPoints);
3152 * @brief Partial convolution of Q15 sequences.
3153 * @param[in] pSrcA points to the first input sequence.
3154 * @param[in] srcALen length of the first input sequence.
3155 * @param[in] pSrcB points to the second input sequence.
3156 * @param[in] srcBLen length of the second input sequence.
3157 * @param[out] pDst points to the block of output data
3158 * @param[in] firstIndex is the first output sample to start with.
3159 * @param[in] numPoints is the number of output points to be computed.
3160 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3161 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3162 * @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].
3164 arm_status arm_conv_partial_opt_q15(
3170 uint32_t firstIndex,
3177 * @brief Partial convolution of Q15 sequences.
3178 * @param[in] pSrcA points to the first input sequence.
3179 * @param[in] srcALen length of the first input sequence.
3180 * @param[in] pSrcB points to the second input sequence.
3181 * @param[in] srcBLen length of the second input sequence.
3182 * @param[out] pDst points to the block of output data
3183 * @param[in] firstIndex is the first output sample to start with.
3184 * @param[in] numPoints is the number of output points to be computed.
3185 * @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].
3187 arm_status arm_conv_partial_q15(
3193 uint32_t firstIndex,
3194 uint32_t numPoints);
3198 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3199 * @param[in] pSrcA points to the first input sequence.
3200 * @param[in] srcALen length of the first input sequence.
3201 * @param[in] pSrcB points to the second input sequence.
3202 * @param[in] srcBLen length of the second input sequence.
3203 * @param[out] pDst points to the block of output data
3204 * @param[in] firstIndex is the first output sample to start with.
3205 * @param[in] numPoints is the number of output points to be computed.
3206 * @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].
3208 arm_status arm_conv_partial_fast_q15(
3214 uint32_t firstIndex,
3215 uint32_t numPoints);
3219 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3220 * @param[in] pSrcA points to the first input sequence.
3221 * @param[in] srcALen length of the first input sequence.
3222 * @param[in] pSrcB points to the second input sequence.
3223 * @param[in] srcBLen length of the second input sequence.
3224 * @param[out] pDst points to the block of output data
3225 * @param[in] firstIndex is the first output sample to start with.
3226 * @param[in] numPoints is the number of output points to be computed.
3227 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3228 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3229 * @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].
3231 arm_status arm_conv_partial_fast_opt_q15(
3237 uint32_t firstIndex,
3244 * @brief Partial convolution of Q31 sequences.
3245 * @param[in] pSrcA points to the first input sequence.
3246 * @param[in] srcALen length of the first input sequence.
3247 * @param[in] pSrcB points to the second input sequence.
3248 * @param[in] srcBLen length of the second input sequence.
3249 * @param[out] pDst points to the block of output data
3250 * @param[in] firstIndex is the first output sample to start with.
3251 * @param[in] numPoints is the number of output points to be computed.
3252 * @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].
3254 arm_status arm_conv_partial_q31(
3260 uint32_t firstIndex,
3261 uint32_t numPoints);
3265 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3266 * @param[in] pSrcA points to the first input sequence.
3267 * @param[in] srcALen length of the first input sequence.
3268 * @param[in] pSrcB points to the second input sequence.
3269 * @param[in] srcBLen length of the second input sequence.
3270 * @param[out] pDst points to the block of output data
3271 * @param[in] firstIndex is the first output sample to start with.
3272 * @param[in] numPoints is the number of output points to be computed.
3273 * @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].
3275 arm_status arm_conv_partial_fast_q31(
3281 uint32_t firstIndex,
3282 uint32_t numPoints);
3286 * @brief Partial convolution of Q7 sequences
3287 * @param[in] pSrcA points to the first input sequence.
3288 * @param[in] srcALen length of the first input sequence.
3289 * @param[in] pSrcB points to the second input sequence.
3290 * @param[in] srcBLen length of the second input sequence.
3291 * @param[out] pDst points to the block of output data
3292 * @param[in] firstIndex is the first output sample to start with.
3293 * @param[in] numPoints is the number of output points to be computed.
3294 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3295 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3296 * @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].
3298 arm_status arm_conv_partial_opt_q7(
3304 uint32_t firstIndex,
3311 * @brief Partial convolution of Q7 sequences.
3312 * @param[in] pSrcA points to the first input sequence.
3313 * @param[in] srcALen length of the first input sequence.
3314 * @param[in] pSrcB points to the second input sequence.
3315 * @param[in] srcBLen length of the second input sequence.
3316 * @param[out] pDst points to the block of output data
3317 * @param[in] firstIndex is the first output sample to start with.
3318 * @param[in] numPoints is the number of output points to be computed.
3319 * @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].
3321 arm_status arm_conv_partial_q7(
3327 uint32_t firstIndex,
3328 uint32_t numPoints);
3332 * @brief Instance structure for the Q15 FIR decimator.
3336 uint8_t M; /**< decimation factor. */
3337 uint16_t numTaps; /**< number of coefficients in the filter. */
3338 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3339 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3340 } arm_fir_decimate_instance_q15;
3343 * @brief Instance structure for the Q31 FIR decimator.
3347 uint8_t M; /**< decimation factor. */
3348 uint16_t numTaps; /**< number of coefficients in the filter. */
3349 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3350 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3351 } arm_fir_decimate_instance_q31;
3354 * @brief Instance structure for the floating-point FIR decimator.
3358 uint8_t M; /**< decimation factor. */
3359 uint16_t numTaps; /**< number of coefficients in the filter. */
3360 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
3361 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3362 } arm_fir_decimate_instance_f32;
3366 * @brief Processing function for the floating-point FIR decimator.
3367 * @param[in] S points to an instance of the floating-point FIR decimator structure.
3368 * @param[in] pSrc points to the block of input data.
3369 * @param[out] pDst points to the block of output data
3370 * @param[in] blockSize number of input samples to process per call.
3372 void arm_fir_decimate_f32(
3373 const arm_fir_decimate_instance_f32 * S,
3376 uint32_t blockSize);
3380 * @brief Initialization function for the floating-point FIR decimator.
3381 * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
3382 * @param[in] numTaps number of coefficients in the filter.
3383 * @param[in] M decimation factor.
3384 * @param[in] pCoeffs points to the filter coefficients.
3385 * @param[in] pState points to the state buffer.
3386 * @param[in] blockSize number of input samples to process per call.
3387 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3388 * <code>blockSize</code> is not a multiple of <code>M</code>.
3390 arm_status arm_fir_decimate_init_f32(
3391 arm_fir_decimate_instance_f32 * S,
3394 float32_t * pCoeffs,
3396 uint32_t blockSize);
3400 * @brief Processing function for the Q15 FIR decimator.
3401 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3402 * @param[in] pSrc points to the block of input data.
3403 * @param[out] pDst points to the block of output data
3404 * @param[in] blockSize number of input samples to process per call.
3406 void arm_fir_decimate_q15(
3407 const arm_fir_decimate_instance_q15 * S,
3410 uint32_t blockSize);
3414 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3415 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3416 * @param[in] pSrc points to the block of input data.
3417 * @param[out] pDst points to the block of output data
3418 * @param[in] blockSize number of input samples to process per call.
3420 void arm_fir_decimate_fast_q15(
3421 const arm_fir_decimate_instance_q15 * S,
3424 uint32_t blockSize);
3428 * @brief Initialization function for the Q15 FIR decimator.
3429 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
3430 * @param[in] numTaps number of coefficients in the filter.
3431 * @param[in] M decimation factor.
3432 * @param[in] pCoeffs points to the filter coefficients.
3433 * @param[in] pState points to the state buffer.
3434 * @param[in] blockSize number of input samples to process per call.
3435 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3436 * <code>blockSize</code> is not a multiple of <code>M</code>.
3438 arm_status arm_fir_decimate_init_q15(
3439 arm_fir_decimate_instance_q15 * S,
3444 uint32_t blockSize);
3448 * @brief Processing function for the Q31 FIR decimator.
3449 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3450 * @param[in] pSrc points to the block of input data.
3451 * @param[out] pDst points to the block of output data
3452 * @param[in] blockSize number of input samples to process per call.
3454 void arm_fir_decimate_q31(
3455 const arm_fir_decimate_instance_q31 * S,
3458 uint32_t blockSize);
3461 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3462 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3463 * @param[in] pSrc points to the block of input data.
3464 * @param[out] pDst points to the block of output data
3465 * @param[in] blockSize number of input samples to process per call.
3467 void arm_fir_decimate_fast_q31(
3468 arm_fir_decimate_instance_q31 * S,
3471 uint32_t blockSize);
3475 * @brief Initialization function for the Q31 FIR decimator.
3476 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
3477 * @param[in] numTaps number of coefficients in the filter.
3478 * @param[in] M decimation factor.
3479 * @param[in] pCoeffs points to the filter coefficients.
3480 * @param[in] pState points to the state buffer.
3481 * @param[in] blockSize number of input samples to process per call.
3482 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3483 * <code>blockSize</code> is not a multiple of <code>M</code>.
3485 arm_status arm_fir_decimate_init_q31(
3486 arm_fir_decimate_instance_q31 * S,
3491 uint32_t blockSize);
3495 * @brief Instance structure for the Q15 FIR interpolator.
3499 uint8_t L; /**< upsample factor. */
3500 uint16_t phaseLength; /**< length of each polyphase filter component. */
3501 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3502 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3503 } arm_fir_interpolate_instance_q15;
3506 * @brief Instance structure for the Q31 FIR interpolator.
3510 uint8_t L; /**< upsample factor. */
3511 uint16_t phaseLength; /**< length of each polyphase filter component. */
3512 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3513 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3514 } arm_fir_interpolate_instance_q31;
3517 * @brief Instance structure for the floating-point FIR interpolator.
3521 uint8_t L; /**< upsample factor. */
3522 uint16_t phaseLength; /**< length of each polyphase filter component. */
3523 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
3524 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
3525 } arm_fir_interpolate_instance_f32;
3529 * @brief Processing function for the Q15 FIR interpolator.
3530 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3531 * @param[in] pSrc points to the block of input data.
3532 * @param[out] pDst points to the block of output data.
3533 * @param[in] blockSize number of input samples to process per call.
3535 void arm_fir_interpolate_q15(
3536 const arm_fir_interpolate_instance_q15 * S,
3539 uint32_t blockSize);
3543 * @brief Initialization function for the Q15 FIR interpolator.
3544 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
3545 * @param[in] L upsample factor.
3546 * @param[in] numTaps number of filter coefficients in the filter.
3547 * @param[in] pCoeffs points to the filter coefficient buffer.
3548 * @param[in] pState points to the state buffer.
3549 * @param[in] blockSize number of input samples to process per call.
3550 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3551 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3553 arm_status arm_fir_interpolate_init_q15(
3554 arm_fir_interpolate_instance_q15 * S,
3559 uint32_t blockSize);
3563 * @brief Processing function for the Q31 FIR interpolator.
3564 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3565 * @param[in] pSrc points to the block of input data.
3566 * @param[out] pDst points to the block of output data.
3567 * @param[in] blockSize number of input samples to process per call.
3569 void arm_fir_interpolate_q31(
3570 const arm_fir_interpolate_instance_q31 * S,
3573 uint32_t blockSize);
3577 * @brief Initialization function for the Q31 FIR interpolator.
3578 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
3579 * @param[in] L upsample factor.
3580 * @param[in] numTaps number of filter coefficients in the filter.
3581 * @param[in] pCoeffs points to the filter coefficient buffer.
3582 * @param[in] pState points to the state buffer.
3583 * @param[in] blockSize number of input samples to process per call.
3584 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3585 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3587 arm_status arm_fir_interpolate_init_q31(
3588 arm_fir_interpolate_instance_q31 * S,
3593 uint32_t blockSize);
3597 * @brief Processing function for the floating-point FIR interpolator.
3598 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
3599 * @param[in] pSrc points to the block of input data.
3600 * @param[out] pDst points to the block of output data.
3601 * @param[in] blockSize number of input samples to process per call.
3603 void arm_fir_interpolate_f32(
3604 const arm_fir_interpolate_instance_f32 * S,
3607 uint32_t blockSize);
3611 * @brief Initialization function for the floating-point FIR interpolator.
3612 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
3613 * @param[in] L upsample factor.
3614 * @param[in] numTaps number of filter coefficients in the filter.
3615 * @param[in] pCoeffs points to the filter coefficient buffer.
3616 * @param[in] pState points to the state buffer.
3617 * @param[in] blockSize number of input samples to process per call.
3618 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3619 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3621 arm_status arm_fir_interpolate_init_f32(
3622 arm_fir_interpolate_instance_f32 * S,
3625 float32_t * pCoeffs,
3627 uint32_t blockSize);
3631 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
3635 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3636 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3637 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3638 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
3639 } arm_biquad_cas_df1_32x64_ins_q31;
3643 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3644 * @param[in] pSrc points to the block of input data.
3645 * @param[out] pDst points to the block of output data
3646 * @param[in] blockSize number of samples to process.
3648 void arm_biquad_cas_df1_32x64_q31(
3649 const arm_biquad_cas_df1_32x64_ins_q31 * S,
3652 uint32_t blockSize);
3656 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3657 * @param[in] numStages number of 2nd order stages in the filter.
3658 * @param[in] pCoeffs points to the filter coefficients.
3659 * @param[in] pState points to the state buffer.
3660 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
3662 void arm_biquad_cas_df1_32x64_init_q31(
3663 arm_biquad_cas_df1_32x64_ins_q31 * S,
3671 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3675 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3676 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3677 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3678 } arm_biquad_cascade_df2T_instance_f32;
3681 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3685 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3686 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3687 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3688 } arm_biquad_cascade_stereo_df2T_instance_f32;
3691 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3695 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3696 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3697 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
3698 } arm_biquad_cascade_df2T_instance_f64;
3702 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3703 * @param[in] S points to an instance of the filter data structure.
3704 * @param[in] pSrc points to the block of input data.
3705 * @param[out] pDst points to the block of output data
3706 * @param[in] blockSize number of samples to process.
3708 void arm_biquad_cascade_df2T_f32(
3709 const arm_biquad_cascade_df2T_instance_f32 * S,
3712 uint32_t blockSize);
3716 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
3717 * @param[in] S points to an instance of the filter data structure.
3718 * @param[in] pSrc points to the block of input data.
3719 * @param[out] pDst points to the block of output data
3720 * @param[in] blockSize number of samples to process.
3722 void arm_biquad_cascade_stereo_df2T_f32(
3723 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
3726 uint32_t blockSize);
3730 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3731 * @param[in] S points to an instance of the filter data structure.
3732 * @param[in] pSrc points to the block of input data.
3733 * @param[out] pDst points to the block of output data
3734 * @param[in] blockSize number of samples to process.
3736 void arm_biquad_cascade_df2T_f64(
3737 const arm_biquad_cascade_df2T_instance_f64 * S,
3740 uint32_t blockSize);
3744 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3745 * @param[in,out] S points to an instance of the filter data structure.
3746 * @param[in] numStages number of 2nd order stages in the filter.
3747 * @param[in] pCoeffs points to the filter coefficients.
3748 * @param[in] pState points to the state buffer.
3750 void arm_biquad_cascade_df2T_init_f32(
3751 arm_biquad_cascade_df2T_instance_f32 * S,
3753 float32_t * pCoeffs,
3754 float32_t * pState);
3758 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3759 * @param[in,out] S points to an instance of the filter data structure.
3760 * @param[in] numStages number of 2nd order stages in the filter.
3761 * @param[in] pCoeffs points to the filter coefficients.
3762 * @param[in] pState points to the state buffer.
3764 void arm_biquad_cascade_stereo_df2T_init_f32(
3765 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
3767 float32_t * pCoeffs,
3768 float32_t * pState);
3772 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3773 * @param[in,out] S points to an instance of the filter data structure.
3774 * @param[in] numStages number of 2nd order stages in the filter.
3775 * @param[in] pCoeffs points to the filter coefficients.
3776 * @param[in] pState points to the state buffer.
3778 void arm_biquad_cascade_df2T_init_f64(
3779 arm_biquad_cascade_df2T_instance_f64 * S,
3781 float64_t * pCoeffs,
3782 float64_t * pState);
3786 * @brief Instance structure for the Q15 FIR lattice filter.
3790 uint16_t numStages; /**< number of filter stages. */
3791 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
3792 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3793 } arm_fir_lattice_instance_q15;
3796 * @brief Instance structure for the Q31 FIR lattice filter.
3800 uint16_t numStages; /**< number of filter stages. */
3801 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
3802 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3803 } arm_fir_lattice_instance_q31;
3806 * @brief Instance structure for the floating-point FIR lattice filter.
3810 uint16_t numStages; /**< number of filter stages. */
3811 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
3812 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
3813 } arm_fir_lattice_instance_f32;
3817 * @brief Initialization function for the Q15 FIR lattice filter.
3818 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3819 * @param[in] numStages number of filter stages.
3820 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3821 * @param[in] pState points to the state buffer. The array is of length numStages.
3823 void arm_fir_lattice_init_q15(
3824 arm_fir_lattice_instance_q15 * S,
3831 * @brief Processing function for the Q15 FIR lattice filter.
3832 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3833 * @param[in] pSrc points to the block of input data.
3834 * @param[out] pDst points to the block of output data.
3835 * @param[in] blockSize number of samples to process.
3837 void arm_fir_lattice_q15(
3838 const arm_fir_lattice_instance_q15 * S,
3841 uint32_t blockSize);
3845 * @brief Initialization function for the Q31 FIR lattice filter.
3846 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3847 * @param[in] numStages number of filter stages.
3848 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3849 * @param[in] pState points to the state buffer. The array is of length numStages.
3851 void arm_fir_lattice_init_q31(
3852 arm_fir_lattice_instance_q31 * S,
3859 * @brief Processing function for the Q31 FIR lattice filter.
3860 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3861 * @param[in] pSrc points to the block of input data.
3862 * @param[out] pDst points to the block of output data
3863 * @param[in] blockSize number of samples to process.
3865 void arm_fir_lattice_q31(
3866 const arm_fir_lattice_instance_q31 * S,
3869 uint32_t blockSize);
3873 * @brief Initialization function for the floating-point FIR lattice filter.
3874 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3875 * @param[in] numStages number of filter stages.
3876 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3877 * @param[in] pState points to the state buffer. The array is of length numStages.
3879 void arm_fir_lattice_init_f32(
3880 arm_fir_lattice_instance_f32 * S,
3882 float32_t * pCoeffs,
3883 float32_t * pState);
3887 * @brief Processing function for the floating-point FIR lattice filter.
3888 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3889 * @param[in] pSrc points to the block of input data.
3890 * @param[out] pDst points to the block of output data
3891 * @param[in] blockSize number of samples to process.
3893 void arm_fir_lattice_f32(
3894 const arm_fir_lattice_instance_f32 * S,
3897 uint32_t blockSize);
3901 * @brief Instance structure for the Q15 IIR lattice filter.
3905 uint16_t numStages; /**< number of stages in the filter. */
3906 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3907 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3908 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3909 } arm_iir_lattice_instance_q15;
3912 * @brief Instance structure for the Q31 IIR lattice filter.
3916 uint16_t numStages; /**< number of stages in the filter. */
3917 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3918 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3919 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3920 } arm_iir_lattice_instance_q31;
3923 * @brief Instance structure for the floating-point IIR lattice filter.
3927 uint16_t numStages; /**< number of stages in the filter. */
3928 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
3929 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
3930 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3931 } arm_iir_lattice_instance_f32;
3935 * @brief Processing function for the floating-point IIR lattice filter.
3936 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3937 * @param[in] pSrc points to the block of input data.
3938 * @param[out] pDst points to the block of output data.
3939 * @param[in] blockSize number of samples to process.
3941 void arm_iir_lattice_f32(
3942 const arm_iir_lattice_instance_f32 * S,
3945 uint32_t blockSize);
3949 * @brief Initialization function for the floating-point IIR lattice filter.
3950 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3951 * @param[in] numStages number of stages in the filter.
3952 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3953 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3954 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
3955 * @param[in] blockSize number of samples to process.
3957 void arm_iir_lattice_init_f32(
3958 arm_iir_lattice_instance_f32 * S,
3960 float32_t * pkCoeffs,
3961 float32_t * pvCoeffs,
3963 uint32_t blockSize);
3967 * @brief Processing function for the Q31 IIR lattice filter.
3968 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3969 * @param[in] pSrc points to the block of input data.
3970 * @param[out] pDst points to the block of output data.
3971 * @param[in] blockSize number of samples to process.
3973 void arm_iir_lattice_q31(
3974 const arm_iir_lattice_instance_q31 * S,
3977 uint32_t blockSize);
3981 * @brief Initialization function for the Q31 IIR lattice filter.
3982 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3983 * @param[in] numStages number of stages in the filter.
3984 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3985 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3986 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
3987 * @param[in] blockSize number of samples to process.
3989 void arm_iir_lattice_init_q31(
3990 arm_iir_lattice_instance_q31 * S,
3995 uint32_t blockSize);
3999 * @brief Processing function for the Q15 IIR lattice filter.
4000 * @param[in] S points to an instance of the Q15 IIR lattice structure.
4001 * @param[in] pSrc points to the block of input data.
4002 * @param[out] pDst points to the block of output data.
4003 * @param[in] blockSize number of samples to process.
4005 void arm_iir_lattice_q15(
4006 const arm_iir_lattice_instance_q15 * S,
4009 uint32_t blockSize);
4013 * @brief Initialization function for the Q15 IIR lattice filter.
4014 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
4015 * @param[in] numStages number of stages in the filter.
4016 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
4017 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
4018 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
4019 * @param[in] blockSize number of samples to process per call.
4021 void arm_iir_lattice_init_q15(
4022 arm_iir_lattice_instance_q15 * S,
4027 uint32_t blockSize);
4031 * @brief Instance structure for the floating-point LMS filter.
4035 uint16_t numTaps; /**< number of coefficients in the filter. */
4036 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4037 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4038 float32_t mu; /**< step size that controls filter coefficient updates. */
4039 } arm_lms_instance_f32;
4043 * @brief Processing function for floating-point LMS filter.
4044 * @param[in] S points to an instance of the floating-point LMS filter structure.
4045 * @param[in] pSrc points to the block of input data.
4046 * @param[in] pRef points to the block of reference data.
4047 * @param[out] pOut points to the block of output data.
4048 * @param[out] pErr points to the block of error data.
4049 * @param[in] blockSize number of samples to process.
4052 const arm_lms_instance_f32 * S,
4057 uint32_t blockSize);
4061 * @brief Initialization function for floating-point LMS filter.
4062 * @param[in] S points to an instance of the floating-point LMS filter structure.
4063 * @param[in] numTaps number of filter coefficients.
4064 * @param[in] pCoeffs points to the coefficient buffer.
4065 * @param[in] pState points to state buffer.
4066 * @param[in] mu step size that controls filter coefficient updates.
4067 * @param[in] blockSize number of samples to process.
4069 void arm_lms_init_f32(
4070 arm_lms_instance_f32 * S,
4072 float32_t * pCoeffs,
4075 uint32_t blockSize);
4079 * @brief Instance structure for the Q15 LMS filter.
4083 uint16_t numTaps; /**< number of coefficients in the filter. */
4084 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4085 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4086 q15_t mu; /**< step size that controls filter coefficient updates. */
4087 uint32_t postShift; /**< bit shift applied to coefficients. */
4088 } arm_lms_instance_q15;
4092 * @brief Initialization function for the Q15 LMS filter.
4093 * @param[in] S points to an instance of the Q15 LMS filter structure.
4094 * @param[in] numTaps number of filter coefficients.
4095 * @param[in] pCoeffs points to the coefficient buffer.
4096 * @param[in] pState points to the state buffer.
4097 * @param[in] mu step size that controls filter coefficient updates.
4098 * @param[in] blockSize number of samples to process.
4099 * @param[in] postShift bit shift applied to coefficients.
4101 void arm_lms_init_q15(
4102 arm_lms_instance_q15 * S,
4108 uint32_t postShift);
4112 * @brief Processing function for Q15 LMS filter.
4113 * @param[in] S points to an instance of the Q15 LMS filter structure.
4114 * @param[in] pSrc points to the block of input data.
4115 * @param[in] pRef points to the block of reference data.
4116 * @param[out] pOut points to the block of output data.
4117 * @param[out] pErr points to the block of error data.
4118 * @param[in] blockSize number of samples to process.
4121 const arm_lms_instance_q15 * S,
4126 uint32_t blockSize);
4130 * @brief Instance structure for the Q31 LMS filter.
4134 uint16_t numTaps; /**< number of coefficients in the filter. */
4135 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4136 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4137 q31_t mu; /**< step size that controls filter coefficient updates. */
4138 uint32_t postShift; /**< bit shift applied to coefficients. */
4139 } arm_lms_instance_q31;
4143 * @brief Processing function for Q31 LMS filter.
4144 * @param[in] S points to an instance of the Q15 LMS filter structure.
4145 * @param[in] pSrc points to the block of input data.
4146 * @param[in] pRef points to the block of reference data.
4147 * @param[out] pOut points to the block of output data.
4148 * @param[out] pErr points to the block of error data.
4149 * @param[in] blockSize number of samples to process.
4152 const arm_lms_instance_q31 * S,
4157 uint32_t blockSize);
4161 * @brief Initialization function for Q31 LMS filter.
4162 * @param[in] S points to an instance of the Q31 LMS filter structure.
4163 * @param[in] numTaps number of filter coefficients.
4164 * @param[in] pCoeffs points to coefficient buffer.
4165 * @param[in] pState points to state buffer.
4166 * @param[in] mu step size that controls filter coefficient updates.
4167 * @param[in] blockSize number of samples to process.
4168 * @param[in] postShift bit shift applied to coefficients.
4170 void arm_lms_init_q31(
4171 arm_lms_instance_q31 * S,
4177 uint32_t postShift);
4181 * @brief Instance structure for the floating-point normalized LMS filter.
4185 uint16_t numTaps; /**< number of coefficients in the filter. */
4186 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4187 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4188 float32_t mu; /**< step size that control filter coefficient updates. */
4189 float32_t energy; /**< saves previous frame energy. */
4190 float32_t x0; /**< saves previous input sample. */
4191 } arm_lms_norm_instance_f32;
4195 * @brief Processing function for floating-point normalized LMS filter.
4196 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
4197 * @param[in] pSrc points to the block of input data.
4198 * @param[in] pRef points to the block of reference data.
4199 * @param[out] pOut points to the block of output data.
4200 * @param[out] pErr points to the block of error data.
4201 * @param[in] blockSize number of samples to process.
4203 void arm_lms_norm_f32(
4204 arm_lms_norm_instance_f32 * S,
4209 uint32_t blockSize);
4213 * @brief Initialization function for floating-point normalized LMS filter.
4214 * @param[in] S points to an instance of the floating-point LMS filter structure.
4215 * @param[in] numTaps number of filter coefficients.
4216 * @param[in] pCoeffs points to coefficient buffer.
4217 * @param[in] pState points to state buffer.
4218 * @param[in] mu step size that controls filter coefficient updates.
4219 * @param[in] blockSize number of samples to process.
4221 void arm_lms_norm_init_f32(
4222 arm_lms_norm_instance_f32 * S,
4224 float32_t * pCoeffs,
4227 uint32_t blockSize);
4231 * @brief Instance structure for the Q31 normalized LMS filter.
4235 uint16_t numTaps; /**< number of coefficients in the filter. */
4236 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4237 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4238 q31_t mu; /**< step size that controls filter coefficient updates. */
4239 uint8_t postShift; /**< bit shift applied to coefficients. */
4240 q31_t *recipTable; /**< points to the reciprocal initial value table. */
4241 q31_t energy; /**< saves previous frame energy. */
4242 q31_t x0; /**< saves previous input sample. */
4243 } arm_lms_norm_instance_q31;
4247 * @brief Processing function for Q31 normalized LMS filter.
4248 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4249 * @param[in] pSrc points to the block of input data.
4250 * @param[in] pRef points to the block of reference data.
4251 * @param[out] pOut points to the block of output data.
4252 * @param[out] pErr points to the block of error data.
4253 * @param[in] blockSize number of samples to process.
4255 void arm_lms_norm_q31(
4256 arm_lms_norm_instance_q31 * S,
4261 uint32_t blockSize);
4265 * @brief Initialization function for Q31 normalized LMS filter.
4266 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4267 * @param[in] numTaps number of filter coefficients.
4268 * @param[in] pCoeffs points to coefficient buffer.
4269 * @param[in] pState points to state buffer.
4270 * @param[in] mu step size that controls filter coefficient updates.
4271 * @param[in] blockSize number of samples to process.
4272 * @param[in] postShift bit shift applied to coefficients.
4274 void arm_lms_norm_init_q31(
4275 arm_lms_norm_instance_q31 * S,
4285 * @brief Instance structure for the Q15 normalized LMS filter.
4289 uint16_t numTaps; /**< Number of coefficients in the filter. */
4290 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4291 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
4292 q15_t mu; /**< step size that controls filter coefficient updates. */
4293 uint8_t postShift; /**< bit shift applied to coefficients. */
4294 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
4295 q15_t energy; /**< saves previous frame energy. */
4296 q15_t x0; /**< saves previous input sample. */
4297 } arm_lms_norm_instance_q15;
4301 * @brief Processing function for Q15 normalized LMS filter.
4302 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4303 * @param[in] pSrc points to the block of input data.
4304 * @param[in] pRef points to the block of reference data.
4305 * @param[out] pOut points to the block of output data.
4306 * @param[out] pErr points to the block of error data.
4307 * @param[in] blockSize number of samples to process.
4309 void arm_lms_norm_q15(
4310 arm_lms_norm_instance_q15 * S,
4315 uint32_t blockSize);
4319 * @brief Initialization function for Q15 normalized LMS filter.
4320 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4321 * @param[in] numTaps number of filter coefficients.
4322 * @param[in] pCoeffs points to coefficient buffer.
4323 * @param[in] pState points to state buffer.
4324 * @param[in] mu step size that controls filter coefficient updates.
4325 * @param[in] blockSize number of samples to process.
4326 * @param[in] postShift bit shift applied to coefficients.
4328 void arm_lms_norm_init_q15(
4329 arm_lms_norm_instance_q15 * S,
4339 * @brief Correlation of floating-point sequences.
4340 * @param[in] pSrcA points to the first input sequence.
4341 * @param[in] srcALen length of the first input sequence.
4342 * @param[in] pSrcB points to the second input sequence.
4343 * @param[in] srcBLen length of the second input sequence.
4344 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4346 void arm_correlate_f32(
4355 * @brief Correlation of Q15 sequences
4356 * @param[in] pSrcA points to the first input sequence.
4357 * @param[in] srcALen length of the first input sequence.
4358 * @param[in] pSrcB points to the second input sequence.
4359 * @param[in] srcBLen length of the second input sequence.
4360 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4361 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4363 void arm_correlate_opt_q15(
4373 * @brief Correlation of Q15 sequences.
4374 * @param[in] pSrcA points to the first input sequence.
4375 * @param[in] srcALen length of the first input sequence.
4376 * @param[in] pSrcB points to the second input sequence.
4377 * @param[in] srcBLen length of the second input sequence.
4378 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4381 void arm_correlate_q15(
4390 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4391 * @param[in] pSrcA points to the first input sequence.
4392 * @param[in] srcALen length of the first input sequence.
4393 * @param[in] pSrcB points to the second input sequence.
4394 * @param[in] srcBLen length of the second input sequence.
4395 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4398 void arm_correlate_fast_q15(
4407 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4408 * @param[in] pSrcA points to the first input sequence.
4409 * @param[in] srcALen length of the first input sequence.
4410 * @param[in] pSrcB points to the second input sequence.
4411 * @param[in] srcBLen length of the second input sequence.
4412 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4413 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4415 void arm_correlate_fast_opt_q15(
4425 * @brief Correlation of Q31 sequences.
4426 * @param[in] pSrcA points to the first input sequence.
4427 * @param[in] srcALen length of the first input sequence.
4428 * @param[in] pSrcB points to the second input sequence.
4429 * @param[in] srcBLen length of the second input sequence.
4430 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4432 void arm_correlate_q31(
4441 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
4442 * @param[in] pSrcA points to the first input sequence.
4443 * @param[in] srcALen length of the first input sequence.
4444 * @param[in] pSrcB points to the second input sequence.
4445 * @param[in] srcBLen length of the second input sequence.
4446 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4448 void arm_correlate_fast_q31(
4457 * @brief Correlation of Q7 sequences.
4458 * @param[in] pSrcA points to the first input sequence.
4459 * @param[in] srcALen length of the first input sequence.
4460 * @param[in] pSrcB points to the second input sequence.
4461 * @param[in] srcBLen length of the second input sequence.
4462 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4463 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4464 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
4466 void arm_correlate_opt_q7(
4477 * @brief Correlation of Q7 sequences.
4478 * @param[in] pSrcA points to the first input sequence.
4479 * @param[in] srcALen length of the first input sequence.
4480 * @param[in] pSrcB points to the second input sequence.
4481 * @param[in] srcBLen length of the second input sequence.
4482 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4484 void arm_correlate_q7(
4493 * @brief Instance structure for the floating-point sparse FIR filter.
4497 uint16_t numTaps; /**< number of coefficients in the filter. */
4498 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4499 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4500 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4501 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4502 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4503 } arm_fir_sparse_instance_f32;
4506 * @brief Instance structure for the Q31 sparse FIR filter.
4510 uint16_t numTaps; /**< number of coefficients in the filter. */
4511 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4512 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4513 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4514 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4515 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4516 } arm_fir_sparse_instance_q31;
4519 * @brief Instance structure for the Q15 sparse FIR filter.
4523 uint16_t numTaps; /**< number of coefficients in the filter. */
4524 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4525 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4526 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4527 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4528 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4529 } arm_fir_sparse_instance_q15;
4532 * @brief Instance structure for the Q7 sparse FIR filter.
4536 uint16_t numTaps; /**< number of coefficients in the filter. */
4537 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
4538 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4539 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
4540 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
4541 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
4542 } arm_fir_sparse_instance_q7;
4546 * @brief Processing function for the floating-point sparse FIR filter.
4547 * @param[in] S points to an instance of the floating-point sparse FIR structure.
4548 * @param[in] pSrc points to the block of input data.
4549 * @param[out] pDst points to the block of output data
4550 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4551 * @param[in] blockSize number of input samples to process per call.
4553 void arm_fir_sparse_f32(
4554 arm_fir_sparse_instance_f32 * S,
4557 float32_t * pScratchIn,
4558 uint32_t blockSize);
4562 * @brief Initialization function for the floating-point sparse FIR filter.
4563 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
4564 * @param[in] numTaps number of nonzero coefficients in the filter.
4565 * @param[in] pCoeffs points to the array of filter coefficients.
4566 * @param[in] pState points to the state buffer.
4567 * @param[in] pTapDelay points to the array of offset times.
4568 * @param[in] maxDelay maximum offset time supported.
4569 * @param[in] blockSize number of samples that will be processed per block.
4571 void arm_fir_sparse_init_f32(
4572 arm_fir_sparse_instance_f32 * S,
4574 float32_t * pCoeffs,
4576 int32_t * pTapDelay,
4578 uint32_t blockSize);
4582 * @brief Processing function for the Q31 sparse FIR filter.
4583 * @param[in] S points to an instance of the Q31 sparse FIR structure.
4584 * @param[in] pSrc points to the block of input data.
4585 * @param[out] pDst points to the block of output data
4586 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4587 * @param[in] blockSize number of input samples to process per call.
4589 void arm_fir_sparse_q31(
4590 arm_fir_sparse_instance_q31 * S,
4594 uint32_t blockSize);
4598 * @brief Initialization function for the Q31 sparse FIR filter.
4599 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
4600 * @param[in] numTaps number of nonzero coefficients in the filter.
4601 * @param[in] pCoeffs points to the array of filter coefficients.
4602 * @param[in] pState points to the state buffer.
4603 * @param[in] pTapDelay points to the array of offset times.
4604 * @param[in] maxDelay maximum offset time supported.
4605 * @param[in] blockSize number of samples that will be processed per block.
4607 void arm_fir_sparse_init_q31(
4608 arm_fir_sparse_instance_q31 * S,
4612 int32_t * pTapDelay,
4614 uint32_t blockSize);
4618 * @brief Processing function for the Q15 sparse FIR filter.
4619 * @param[in] S points to an instance of the Q15 sparse FIR structure.
4620 * @param[in] pSrc points to the block of input data.
4621 * @param[out] pDst points to the block of output data
4622 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4623 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4624 * @param[in] blockSize number of input samples to process per call.
4626 void arm_fir_sparse_q15(
4627 arm_fir_sparse_instance_q15 * S,
4631 q31_t * pScratchOut,
4632 uint32_t blockSize);
4636 * @brief Initialization function for the Q15 sparse FIR filter.
4637 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
4638 * @param[in] numTaps number of nonzero coefficients in the filter.
4639 * @param[in] pCoeffs points to the array of filter coefficients.
4640 * @param[in] pState points to the state buffer.
4641 * @param[in] pTapDelay points to the array of offset times.
4642 * @param[in] maxDelay maximum offset time supported.
4643 * @param[in] blockSize number of samples that will be processed per block.
4645 void arm_fir_sparse_init_q15(
4646 arm_fir_sparse_instance_q15 * S,
4650 int32_t * pTapDelay,
4652 uint32_t blockSize);
4656 * @brief Processing function for the Q7 sparse FIR filter.
4657 * @param[in] S points to an instance of the Q7 sparse FIR structure.
4658 * @param[in] pSrc points to the block of input data.
4659 * @param[out] pDst points to the block of output data
4660 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4661 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4662 * @param[in] blockSize number of input samples to process per call.
4664 void arm_fir_sparse_q7(
4665 arm_fir_sparse_instance_q7 * S,
4669 q31_t * pScratchOut,
4670 uint32_t blockSize);
4674 * @brief Initialization function for the Q7 sparse FIR filter.
4675 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
4676 * @param[in] numTaps number of nonzero coefficients in the filter.
4677 * @param[in] pCoeffs points to the array of filter coefficients.
4678 * @param[in] pState points to the state buffer.
4679 * @param[in] pTapDelay points to the array of offset times.
4680 * @param[in] maxDelay maximum offset time supported.
4681 * @param[in] blockSize number of samples that will be processed per block.
4683 void arm_fir_sparse_init_q7(
4684 arm_fir_sparse_instance_q7 * S,
4688 int32_t * pTapDelay,
4690 uint32_t blockSize);
4694 * @brief Floating-point sin_cos function.
4695 * @param[in] theta input value in degrees
4696 * @param[out] pSinVal points to the processed sine output.
4697 * @param[out] pCosVal points to the processed cos output.
4699 void arm_sin_cos_f32(
4701 float32_t * pSinVal,
4702 float32_t * pCosVal);
4706 * @brief Q31 sin_cos function.
4707 * @param[in] theta scaled input value in degrees
4708 * @param[out] pSinVal points to the processed sine output.
4709 * @param[out] pCosVal points to the processed cosine output.
4711 void arm_sin_cos_q31(
4718 * @brief Floating-point complex conjugate.
4719 * @param[in] pSrc points to the input vector
4720 * @param[out] pDst points to the output vector
4721 * @param[in] numSamples number of complex samples in each vector
4723 void arm_cmplx_conj_f32(
4726 uint32_t numSamples);
4729 * @brief Q31 complex conjugate.
4730 * @param[in] pSrc points to the input vector
4731 * @param[out] pDst points to the output vector
4732 * @param[in] numSamples number of complex samples in each vector
4734 void arm_cmplx_conj_q31(
4737 uint32_t numSamples);
4741 * @brief Q15 complex conjugate.
4742 * @param[in] pSrc points to the input vector
4743 * @param[out] pDst points to the output vector
4744 * @param[in] numSamples number of complex samples in each vector
4746 void arm_cmplx_conj_q15(
4749 uint32_t numSamples);
4753 * @brief Floating-point complex magnitude squared
4754 * @param[in] pSrc points to the complex input vector
4755 * @param[out] pDst points to the real output vector
4756 * @param[in] numSamples number of complex samples in the input vector
4758 void arm_cmplx_mag_squared_f32(
4761 uint32_t numSamples);
4765 * @brief Q31 complex magnitude squared
4766 * @param[in] pSrc points to the complex input vector
4767 * @param[out] pDst points to the real output vector
4768 * @param[in] numSamples number of complex samples in the input vector
4770 void arm_cmplx_mag_squared_q31(
4773 uint32_t numSamples);
4777 * @brief Q15 complex magnitude squared
4778 * @param[in] pSrc points to the complex input vector
4779 * @param[out] pDst points to the real output vector
4780 * @param[in] numSamples number of complex samples in the input vector
4782 void arm_cmplx_mag_squared_q15(
4785 uint32_t numSamples);
4789 * @ingroup groupController
4793 * @defgroup PID PID Motor Control
4795 * A Proportional Integral Derivative (PID) controller is a generic feedback control
4796 * loop mechanism widely used in industrial control systems.
4797 * A PID controller is the most commonly used type of feedback controller.
4799 * This set of functions implements (PID) controllers
4800 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
4801 * of data and each call to the function returns a single processed value.
4802 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
4803 * is the input sample value. The functions return the output value.
4807 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
4809 * A1 = (-Kp ) - (2 * Kd )
4813 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
4816 * \image html PID.gif "Proportional Integral Derivative Controller"
4819 * The PID controller calculates an "error" value as the difference between
4820 * the measured output and the reference input.
4821 * The controller attempts to minimize the error by adjusting the process control inputs.
4822 * The proportional value determines the reaction to the current error,
4823 * the integral value determines the reaction based on the sum of recent errors,
4824 * and the derivative value determines the reaction based on the rate at which the error has been changing.
4826 * \par Instance Structure
4827 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
4828 * A separate instance structure must be defined for each PID Controller.
4829 * There are separate instance structure declarations for each of the 3 supported data types.
4831 * \par Reset Functions
4832 * There is also an associated reset function for each data type which clears the state array.
4834 * \par Initialization Functions
4835 * There is also an associated initialization function for each data type.
4836 * The initialization function performs the following operations:
4837 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
4838 * - Zeros out the values in the state buffer.
4841 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
4843 * \par Fixed-Point Behavior
4844 * Care must be taken when using the fixed-point versions of the PID Controller functions.
4845 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
4846 * Refer to the function specific documentation below for usage guidelines.
4855 * @brief Process function for the floating-point PID Control.
4856 * @param[in,out] S is an instance of the floating-point PID Control structure
4857 * @param[in] in input sample to process
4858 * @return out processed output sample.
4860 CMSIS_INLINE __STATIC_INLINE float32_t arm_pid_f32(
4861 arm_pid_instance_f32 * S,
4866 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
4867 out = (S->A0 * in) +
4868 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
4871 S->state[1] = S->state[0];
4875 /* return to application */
4881 * @brief Process function for the Q31 PID Control.
4882 * @param[in,out] S points to an instance of the Q31 PID Control structure
4883 * @param[in] in input sample to process
4884 * @return out processed output sample.
4886 * <b>Scaling and Overflow Behavior:</b>
4888 * The function is implemented using an internal 64-bit accumulator.
4889 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
4890 * Thus, if the accumulator result overflows it wraps around rather than clip.
4891 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
4892 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
4894 CMSIS_INLINE __STATIC_INLINE q31_t arm_pid_q31(
4895 arm_pid_instance_q31 * S,
4901 /* acc = A0 * x[n] */
4902 acc = (q63_t) S->A0 * in;
4904 /* acc += A1 * x[n-1] */
4905 acc += (q63_t) S->A1 * S->state[0];
4907 /* acc += A2 * x[n-2] */
4908 acc += (q63_t) S->A2 * S->state[1];
4910 /* convert output to 1.31 format to add y[n-1] */
4911 out = (q31_t) (acc >> 31u);
4917 S->state[1] = S->state[0];
4921 /* return to application */
4927 * @brief Process function for the Q15 PID Control.
4928 * @param[in,out] S points to an instance of the Q15 PID Control structure
4929 * @param[in] in input sample to process
4930 * @return out processed output sample.
4932 * <b>Scaling and Overflow Behavior:</b>
4934 * The function is implemented using a 64-bit internal accumulator.
4935 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
4936 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
4937 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
4938 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
4939 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
4941 CMSIS_INLINE __STATIC_INLINE q15_t arm_pid_q15(
4942 arm_pid_instance_q15 * S,
4948 #if defined (ARM_MATH_DSP)
4949 __SIMD32_TYPE *vstate;
4951 /* Implementation of PID controller */
4953 /* acc = A0 * x[n] */
4954 acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
4956 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4957 vstate = __SIMD32_CONST(S->state);
4958 acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc);
4960 /* acc = A0 * x[n] */
4961 acc = ((q31_t) S->A0) * in;
4963 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4964 acc += (q31_t) S->A1 * S->state[0];
4965 acc += (q31_t) S->A2 * S->state[1];
4969 acc += (q31_t) S->state[2] << 15;
4971 /* saturate the output */
4972 out = (q15_t) (__SSAT((acc >> 15), 16));
4975 S->state[1] = S->state[0];
4979 /* return to application */
4984 * @} end of PID group
4989 * @brief Floating-point matrix inverse.
4990 * @param[in] src points to the instance of the input floating-point matrix structure.
4991 * @param[out] dst points to the instance of the output floating-point matrix structure.
4992 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4993 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4995 arm_status arm_mat_inverse_f32(
4996 const arm_matrix_instance_f32 * src,
4997 arm_matrix_instance_f32 * dst);
5001 * @brief Floating-point matrix inverse.
5002 * @param[in] src points to the instance of the input floating-point matrix structure.
5003 * @param[out] dst points to the instance of the output floating-point matrix structure.
5004 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
5005 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
5007 arm_status arm_mat_inverse_f64(
5008 const arm_matrix_instance_f64 * src,
5009 arm_matrix_instance_f64 * dst);
5014 * @ingroup groupController
5018 * @defgroup clarke Vector Clarke Transform
5019 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
5020 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
5021 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
5022 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
5023 * \image html clarke.gif Stator current space vector and its components in (a,b).
5024 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
5025 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
5027 * The function operates on a single sample of data and each call to the function returns the processed output.
5028 * The library provides separate functions for Q31 and floating-point data types.
5030 * \image html clarkeFormula.gif
5031 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
5032 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
5033 * \par Fixed-Point Behavior
5034 * Care must be taken when using the Q31 version of the Clarke transform.
5035 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5036 * Refer to the function specific documentation below for usage guidelines.
5040 * @addtogroup clarke
5046 * @brief Floating-point Clarke transform
5047 * @param[in] Ia input three-phase coordinate <code>a</code>
5048 * @param[in] Ib input three-phase coordinate <code>b</code>
5049 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5050 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5052 CMSIS_INLINE __STATIC_INLINE void arm_clarke_f32(
5055 float32_t * pIalpha,
5058 /* Calculate pIalpha using the equation, pIalpha = Ia */
5061 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
5062 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
5067 * @brief Clarke transform for Q31 version
5068 * @param[in] Ia input three-phase coordinate <code>a</code>
5069 * @param[in] Ib input three-phase coordinate <code>b</code>
5070 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5071 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5073 * <b>Scaling and Overflow Behavior:</b>
5075 * The function is implemented using an internal 32-bit accumulator.
5076 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5077 * There is saturation on the addition, hence there is no risk of overflow.
5079 CMSIS_INLINE __STATIC_INLINE void arm_clarke_q31(
5085 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5087 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
5090 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
5091 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
5093 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
5094 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
5096 /* pIbeta is calculated by adding the intermediate products */
5097 *pIbeta = __QADD(product1, product2);
5101 * @} end of clarke group
5105 * @brief Converts the elements of the Q7 vector to Q31 vector.
5106 * @param[in] pSrc input pointer
5107 * @param[out] pDst output pointer
5108 * @param[in] blockSize number of samples to process
5113 uint32_t blockSize);
5118 * @ingroup groupController
5122 * @defgroup inv_clarke Vector Inverse Clarke Transform
5123 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
5125 * The function operates on a single sample of data and each call to the function returns the processed output.
5126 * The library provides separate functions for Q31 and floating-point data types.
5128 * \image html clarkeInvFormula.gif
5129 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
5130 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
5131 * \par Fixed-Point Behavior
5132 * Care must be taken when using the Q31 version of the Clarke transform.
5133 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5134 * Refer to the function specific documentation below for usage guidelines.
5138 * @addtogroup inv_clarke
5143 * @brief Floating-point Inverse Clarke transform
5144 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5145 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5146 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5147 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5149 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_f32(
5155 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5158 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
5159 *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
5164 * @brief Inverse Clarke transform for Q31 version
5165 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5166 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5167 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5168 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5170 * <b>Scaling and Overflow Behavior:</b>
5172 * The function is implemented using an internal 32-bit accumulator.
5173 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5174 * There is saturation on the subtraction, hence there is no risk of overflow.
5176 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_q31(
5182 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5184 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5187 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
5188 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
5190 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
5191 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
5193 /* pIb is calculated by subtracting the products */
5194 *pIb = __QSUB(product2, product1);
5198 * @} end of inv_clarke group
5202 * @brief Converts the elements of the Q7 vector to Q15 vector.
5203 * @param[in] pSrc input pointer
5204 * @param[out] pDst output pointer
5205 * @param[in] blockSize number of samples to process
5210 uint32_t blockSize);
5215 * @ingroup groupController
5219 * @defgroup park Vector Park Transform
5221 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
5222 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
5223 * from the stationary to the moving reference frame and control the spatial relationship between
5224 * the stator vector current and rotor flux vector.
5225 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
5226 * current vector and the relationship from the two reference frames:
5227 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
5229 * The function operates on a single sample of data and each call to the function returns the processed output.
5230 * The library provides separate functions for Q31 and floating-point data types.
5232 * \image html parkFormula.gif
5233 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
5234 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5235 * cosine and sine values of theta (rotor flux position).
5236 * \par Fixed-Point Behavior
5237 * Care must be taken when using the Q31 version of the Park transform.
5238 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5239 * Refer to the function specific documentation below for usage guidelines.
5248 * @brief Floating-point Park transform
5249 * @param[in] Ialpha input two-phase vector coordinate alpha
5250 * @param[in] Ibeta input two-phase vector coordinate beta
5251 * @param[out] pId points to output rotor reference frame d
5252 * @param[out] pIq points to output rotor reference frame q
5253 * @param[in] sinVal sine value of rotation angle theta
5254 * @param[in] cosVal cosine value of rotation angle theta
5256 * The function implements the forward Park transform.
5259 CMSIS_INLINE __STATIC_INLINE void arm_park_f32(
5267 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
5268 *pId = Ialpha * cosVal + Ibeta * sinVal;
5270 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
5271 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
5276 * @brief Park transform for Q31 version
5277 * @param[in] Ialpha input two-phase vector coordinate alpha
5278 * @param[in] Ibeta input two-phase vector coordinate beta
5279 * @param[out] pId points to output rotor reference frame d
5280 * @param[out] pIq points to output rotor reference frame q
5281 * @param[in] sinVal sine value of rotation angle theta
5282 * @param[in] cosVal cosine value of rotation angle theta
5284 * <b>Scaling and Overflow Behavior:</b>
5286 * The function is implemented using an internal 32-bit accumulator.
5287 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5288 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
5290 CMSIS_INLINE __STATIC_INLINE void arm_park_q31(
5298 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5299 q31_t product3, product4; /* Temporary variables used to store intermediate results */
5301 /* Intermediate product is calculated by (Ialpha * cosVal) */
5302 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
5304 /* Intermediate product is calculated by (Ibeta * sinVal) */
5305 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
5308 /* Intermediate product is calculated by (Ialpha * sinVal) */
5309 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
5311 /* Intermediate product is calculated by (Ibeta * cosVal) */
5312 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
5314 /* Calculate pId by adding the two intermediate products 1 and 2 */
5315 *pId = __QADD(product1, product2);
5317 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
5318 *pIq = __QSUB(product4, product3);
5322 * @} end of park group
5326 * @brief Converts the elements of the Q7 vector to floating-point vector.
5327 * @param[in] pSrc is input pointer
5328 * @param[out] pDst is output pointer
5329 * @param[in] blockSize is the number of samples to process
5331 void arm_q7_to_float(
5334 uint32_t blockSize);
5338 * @ingroup groupController
5342 * @defgroup inv_park Vector Inverse Park transform
5343 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
5345 * The function operates on a single sample of data and each call to the function returns the processed output.
5346 * The library provides separate functions for Q31 and floating-point data types.
5348 * \image html parkInvFormula.gif
5349 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
5350 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5351 * cosine and sine values of theta (rotor flux position).
5352 * \par Fixed-Point Behavior
5353 * Care must be taken when using the Q31 version of the Park transform.
5354 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5355 * Refer to the function specific documentation below for usage guidelines.
5359 * @addtogroup inv_park
5364 * @brief Floating-point Inverse Park transform
5365 * @param[in] Id input coordinate of rotor reference frame d
5366 * @param[in] Iq input coordinate of rotor reference frame q
5367 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5368 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5369 * @param[in] sinVal sine value of rotation angle theta
5370 * @param[in] cosVal cosine value of rotation angle theta
5372 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_f32(
5375 float32_t * pIalpha,
5380 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
5381 *pIalpha = Id * cosVal - Iq * sinVal;
5383 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
5384 *pIbeta = Id * sinVal + Iq * cosVal;
5389 * @brief Inverse Park transform for Q31 version
5390 * @param[in] Id input coordinate of rotor reference frame d
5391 * @param[in] Iq input coordinate of rotor reference frame q
5392 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5393 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5394 * @param[in] sinVal sine value of rotation angle theta
5395 * @param[in] cosVal cosine value of rotation angle theta
5397 * <b>Scaling and Overflow Behavior:</b>
5399 * The function is implemented using an internal 32-bit accumulator.
5400 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5401 * There is saturation on the addition, hence there is no risk of overflow.
5403 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_q31(
5411 q31_t product1, product2; /* Temporary variables used to store intermediate results */
5412 q31_t product3, product4; /* Temporary variables used to store intermediate results */
5414 /* Intermediate product is calculated by (Id * cosVal) */
5415 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
5417 /* Intermediate product is calculated by (Iq * sinVal) */
5418 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
5421 /* Intermediate product is calculated by (Id * sinVal) */
5422 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
5424 /* Intermediate product is calculated by (Iq * cosVal) */
5425 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
5427 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
5428 *pIalpha = __QSUB(product1, product2);
5430 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
5431 *pIbeta = __QADD(product4, product3);
5435 * @} end of Inverse park group
5440 * @brief Converts the elements of the Q31 vector to floating-point vector.
5441 * @param[in] pSrc is input pointer
5442 * @param[out] pDst is output pointer
5443 * @param[in] blockSize is the number of samples to process
5445 void arm_q31_to_float(
5448 uint32_t blockSize);
5451 * @ingroup groupInterpolation
5455 * @defgroup LinearInterpolate Linear Interpolation
5457 * Linear interpolation is a method of curve fitting using linear polynomials.
5458 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
5461 * \image html LinearInterp.gif "Linear interpolation"
5464 * A Linear Interpolate function calculates an output value(y), for the input(x)
5465 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
5469 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
5470 * where x0, x1 are nearest values of input x
5471 * y0, y1 are nearest values to output y
5475 * This set of functions implements Linear interpolation process
5476 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
5477 * sample of data and each call to the function returns a single processed value.
5478 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
5479 * <code>x</code> is the input sample value. The functions returns the output value.
5482 * if x is outside of the table boundary, Linear interpolation returns first value of the table
5483 * if x is below input range and returns last value of table if x is above range.
5487 * @addtogroup LinearInterpolate
5492 * @brief Process function for the floating-point Linear Interpolation Function.
5493 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
5494 * @param[in] x input sample to process
5495 * @return y processed output sample.
5498 CMSIS_INLINE __STATIC_INLINE float32_t arm_linear_interp_f32(
5499 arm_linear_interp_instance_f32 * S,
5503 float32_t x0, x1; /* Nearest input values */
5504 float32_t y0, y1; /* Nearest output values */
5505 float32_t xSpacing = S->xSpacing; /* spacing between input values */
5506 int32_t i; /* Index variable */
5507 float32_t *pYData = S->pYData; /* pointer to output table */
5509 /* Calculation of index */
5510 i = (int32_t) ((x - S->x1) / xSpacing);
5514 /* Iniatilize output for below specified range as least output value of table */
5517 else if ((uint32_t)i >= S->nValues)
5519 /* Iniatilize output for above specified range as last output value of table */
5520 y = pYData[S->nValues - 1];
5524 /* Calculation of nearest input values */
5525 x0 = S->x1 + i * xSpacing;
5526 x1 = S->x1 + (i + 1) * xSpacing;
5528 /* Read of nearest output values */
5532 /* Calculation of output */
5533 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
5537 /* returns output value */
5544 * @brief Process function for the Q31 Linear Interpolation Function.
5545 * @param[in] pYData pointer to Q31 Linear Interpolation table
5546 * @param[in] x input sample to process
5547 * @param[in] nValues number of table values
5548 * @return y processed output sample.
5551 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5552 * This function can support maximum of table size 2^12.
5555 CMSIS_INLINE __STATIC_INLINE q31_t arm_linear_interp_q31(
5560 q31_t y; /* output */
5561 q31_t y0, y1; /* Nearest output values */
5562 q31_t fract; /* fractional part */
5563 int32_t index; /* Index to read nearest output values */
5565 /* Input is in 12.20 format */
5566 /* 12 bits for the table index */
5567 /* Index value calculation */
5568 index = ((x & (q31_t)0xFFF00000) >> 20);
5570 if (index >= (int32_t)(nValues - 1))
5572 return (pYData[nValues - 1]);
5580 /* 20 bits for the fractional part */
5581 /* shift left by 11 to keep fract in 1.31 format */
5582 fract = (x & 0x000FFFFF) << 11;
5584 /* Read two nearest output values from the index in 1.31(q31) format */
5586 y1 = pYData[index + 1];
5588 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
5589 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
5591 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
5592 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
5594 /* Convert y to 1.31 format */
5602 * @brief Process function for the Q15 Linear Interpolation Function.
5603 * @param[in] pYData pointer to Q15 Linear Interpolation table
5604 * @param[in] x input sample to process
5605 * @param[in] nValues number of table values
5606 * @return y processed output sample.
5609 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5610 * This function can support maximum of table size 2^12.
5613 CMSIS_INLINE __STATIC_INLINE q15_t arm_linear_interp_q15(
5618 q63_t y; /* output */
5619 q15_t y0, y1; /* Nearest output values */
5620 q31_t fract; /* fractional part */
5621 int32_t index; /* Index to read nearest output values */
5623 /* Input is in 12.20 format */
5624 /* 12 bits for the table index */
5625 /* Index value calculation */
5626 index = ((x & (int32_t)0xFFF00000) >> 20);
5628 if (index >= (int32_t)(nValues - 1))
5630 return (pYData[nValues - 1]);
5638 /* 20 bits for the fractional part */
5639 /* fract is in 12.20 format */
5640 fract = (x & 0x000FFFFF);
5642 /* Read two nearest output values from the index */
5644 y1 = pYData[index + 1];
5646 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
5647 y = ((q63_t) y0 * (0xFFFFF - fract));
5649 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
5650 y += ((q63_t) y1 * (fract));
5652 /* convert y to 1.15 format */
5653 return (q15_t) (y >> 20);
5660 * @brief Process function for the Q7 Linear Interpolation Function.
5661 * @param[in] pYData pointer to Q7 Linear Interpolation table
5662 * @param[in] x input sample to process
5663 * @param[in] nValues number of table values
5664 * @return y processed output sample.
5667 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5668 * This function can support maximum of table size 2^12.
5670 CMSIS_INLINE __STATIC_INLINE q7_t arm_linear_interp_q7(
5675 q31_t y; /* output */
5676 q7_t y0, y1; /* Nearest output values */
5677 q31_t fract; /* fractional part */
5678 uint32_t index; /* Index to read nearest output values */
5680 /* Input is in 12.20 format */
5681 /* 12 bits for the table index */
5682 /* Index value calculation */
5687 index = (x >> 20) & 0xfff;
5689 if (index >= (nValues - 1))
5691 return (pYData[nValues - 1]);
5695 /* 20 bits for the fractional part */
5696 /* fract is in 12.20 format */
5697 fract = (x & 0x000FFFFF);
5699 /* Read two nearest output values from the index and are in 1.7(q7) format */
5701 y1 = pYData[index + 1];
5703 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
5704 y = ((y0 * (0xFFFFF - fract)));
5706 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
5709 /* convert y to 1.7(q7) format */
5710 return (q7_t) (y >> 20);
5715 * @} end of LinearInterpolate group
5719 * @brief Fast approximation to the trigonometric sine function for floating-point data.
5720 * @param[in] x input value in radians.
5723 float32_t arm_sin_f32(
5728 * @brief Fast approximation to the trigonometric sine function for Q31 data.
5729 * @param[in] x Scaled input value in radians.
5737 * @brief Fast approximation to the trigonometric sine function for Q15 data.
5738 * @param[in] x Scaled input value in radians.
5746 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
5747 * @param[in] x input value in radians.
5750 float32_t arm_cos_f32(
5755 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
5756 * @param[in] x Scaled input value in radians.
5764 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
5765 * @param[in] x Scaled input value in radians.
5773 * @ingroup groupFastMath
5778 * @defgroup SQRT Square Root
5780 * Computes the square root of a number.
5781 * There are separate functions for Q15, Q31, and floating-point data types.
5782 * The square root function is computed using the Newton-Raphson algorithm.
5783 * This is an iterative algorithm of the form:
5785 * x1 = x0 - f(x0)/f'(x0)
5787 * where <code>x1</code> is the current estimate,
5788 * <code>x0</code> is the previous estimate, and
5789 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
5790 * For the square root function, the algorithm reduces to:
5792 * x0 = in/2 [initial guess]
5793 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
5804 * @brief Floating-point square root function.
5805 * @param[in] in input value.
5806 * @param[out] pOut square root of input value.
5807 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5808 * <code>in</code> is negative value and returns zero output for negative values.
5810 CMSIS_INLINE __STATIC_INLINE arm_status arm_sqrt_f32(
5817 #if (__FPU_USED == 1) && defined ( __CC_ARM )
5818 *pOut = __sqrtf(in);
5819 #elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
5820 *pOut = __builtin_sqrtf(in);
5821 #elif (__FPU_USED == 1) && defined(__GNUC__)
5822 *pOut = __builtin_sqrtf(in);
5823 #elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
5824 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
5829 return (ARM_MATH_SUCCESS);
5834 return (ARM_MATH_ARGUMENT_ERROR);
5840 * @brief Q31 square root function.
5841 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
5842 * @param[out] pOut square root of input value.
5843 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5844 * <code>in</code> is negative value and returns zero output for negative values.
5846 arm_status arm_sqrt_q31(
5852 * @brief Q15 square root function.
5853 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
5854 * @param[out] pOut square root of input value.
5855 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5856 * <code>in</code> is negative value and returns zero output for negative values.
5858 arm_status arm_sqrt_q15(
5863 * @} end of SQRT group
5868 * @brief floating-point Circular write function.
5870 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_f32(
5871 int32_t * circBuffer,
5873 uint16_t * writeOffset,
5875 const int32_t * src,
5882 /* Copy the value of Index pointer that points
5883 * to the current location where the input samples to be copied */
5884 wOffset = *writeOffset;
5886 /* Loop over the blockSize */
5891 /* copy the input sample to the circular buffer */
5892 circBuffer[wOffset] = *src;
5894 /* Update the input pointer */
5897 /* Circularly update wOffset. Watch out for positive and negative value */
5898 wOffset += bufferInc;
5902 /* Decrement the loop counter */
5906 /* Update the index pointer */
5907 *writeOffset = (uint16_t)wOffset;
5913 * @brief floating-point Circular Read function.
5915 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_f32(
5916 int32_t * circBuffer,
5918 int32_t * readOffset,
5927 int32_t rOffset, dst_end;
5929 /* Copy the value of Index pointer that points
5930 * to the current location from where the input samples to be read */
5931 rOffset = *readOffset;
5932 dst_end = (int32_t) (dst_base + dst_length);
5934 /* Loop over the blockSize */
5939 /* copy the sample from the circular buffer to the destination buffer */
5940 *dst = circBuffer[rOffset];
5942 /* Update the input pointer */
5945 if (dst == (int32_t *) dst_end)
5950 /* Circularly update rOffset. Watch out for positive and negative value */
5951 rOffset += bufferInc;
5958 /* Decrement the loop counter */
5962 /* Update the index pointer */
5963 *readOffset = rOffset;
5968 * @brief Q15 Circular write function.
5970 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q15(
5973 uint16_t * writeOffset,
5982 /* Copy the value of Index pointer that points
5983 * to the current location where the input samples to be copied */
5984 wOffset = *writeOffset;
5986 /* Loop over the blockSize */
5991 /* copy the input sample to the circular buffer */
5992 circBuffer[wOffset] = *src;
5994 /* Update the input pointer */
5997 /* Circularly update wOffset. Watch out for positive and negative value */
5998 wOffset += bufferInc;
6002 /* Decrement the loop counter */
6006 /* Update the index pointer */
6007 *writeOffset = (uint16_t)wOffset;
6012 * @brief Q15 Circular Read function.
6014 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q15(
6017 int32_t * readOffset,
6026 int32_t rOffset, dst_end;
6028 /* Copy the value of Index pointer that points
6029 * to the current location from where the input samples to be read */
6030 rOffset = *readOffset;
6032 dst_end = (int32_t) (dst_base + dst_length);
6034 /* Loop over the blockSize */
6039 /* copy the sample from the circular buffer to the destination buffer */
6040 *dst = circBuffer[rOffset];
6042 /* Update the input pointer */
6045 if (dst == (q15_t *) dst_end)
6050 /* Circularly update wOffset. Watch out for positive and negative value */
6051 rOffset += bufferInc;
6058 /* Decrement the loop counter */
6062 /* Update the index pointer */
6063 *readOffset = rOffset;
6068 * @brief Q7 Circular write function.
6070 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q7(
6073 uint16_t * writeOffset,
6082 /* Copy the value of Index pointer that points
6083 * to the current location where the input samples to be copied */
6084 wOffset = *writeOffset;
6086 /* Loop over the blockSize */
6091 /* copy the input sample to the circular buffer */
6092 circBuffer[wOffset] = *src;
6094 /* Update the input pointer */
6097 /* Circularly update wOffset. Watch out for positive and negative value */
6098 wOffset += bufferInc;
6102 /* Decrement the loop counter */
6106 /* Update the index pointer */
6107 *writeOffset = (uint16_t)wOffset;
6112 * @brief Q7 Circular Read function.
6114 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q7(
6117 int32_t * readOffset,
6126 int32_t rOffset, dst_end;
6128 /* Copy the value of Index pointer that points
6129 * to the current location from where the input samples to be read */
6130 rOffset = *readOffset;
6132 dst_end = (int32_t) (dst_base + dst_length);
6134 /* Loop over the blockSize */
6139 /* copy the sample from the circular buffer to the destination buffer */
6140 *dst = circBuffer[rOffset];
6142 /* Update the input pointer */
6145 if (dst == (q7_t *) dst_end)
6150 /* Circularly update rOffset. Watch out for positive and negative value */
6151 rOffset += bufferInc;
6158 /* Decrement the loop counter */
6162 /* Update the index pointer */
6163 *readOffset = rOffset;
6168 * @brief Sum of the squares of the elements of a Q31 vector.
6169 * @param[in] pSrc is input pointer
6170 * @param[in] blockSize is the number of samples to process
6171 * @param[out] pResult is output value.
6180 * @brief Sum of the squares of the elements of a floating-point vector.
6181 * @param[in] pSrc is input pointer
6182 * @param[in] blockSize is the number of samples to process
6183 * @param[out] pResult is output value.
6188 float32_t * pResult);
6192 * @brief Sum of the squares of the elements of a Q15 vector.
6193 * @param[in] pSrc is input pointer
6194 * @param[in] blockSize is the number of samples to process
6195 * @param[out] pResult is output value.
6204 * @brief Sum of the squares of the elements of a Q7 vector.
6205 * @param[in] pSrc is input pointer
6206 * @param[in] blockSize is the number of samples to process
6207 * @param[out] pResult is output value.
6216 * @brief Mean value of a Q7 vector.
6217 * @param[in] pSrc is input pointer
6218 * @param[in] blockSize is the number of samples to process
6219 * @param[out] pResult is output value.
6228 * @brief Mean value of a Q15 vector.
6229 * @param[in] pSrc is input pointer
6230 * @param[in] blockSize is the number of samples to process
6231 * @param[out] pResult is output value.
6240 * @brief Mean value of a Q31 vector.
6241 * @param[in] pSrc is input pointer
6242 * @param[in] blockSize is the number of samples to process
6243 * @param[out] pResult is output value.
6252 * @brief Mean value of a floating-point vector.
6253 * @param[in] pSrc is input pointer
6254 * @param[in] blockSize is the number of samples to process
6255 * @param[out] pResult is output value.
6260 float32_t * pResult);
6264 * @brief Variance of the elements of a floating-point vector.
6265 * @param[in] pSrc is input pointer
6266 * @param[in] blockSize is the number of samples to process
6267 * @param[out] pResult is output value.
6272 float32_t * pResult);
6276 * @brief Variance of the elements of a Q31 vector.
6277 * @param[in] pSrc is input pointer
6278 * @param[in] blockSize is the number of samples to process
6279 * @param[out] pResult is output value.
6288 * @brief Variance of the elements of a Q15 vector.
6289 * @param[in] pSrc is input pointer
6290 * @param[in] blockSize is the number of samples to process
6291 * @param[out] pResult is output value.
6300 * @brief Root Mean Square of the elements of a floating-point vector.
6301 * @param[in] pSrc is input pointer
6302 * @param[in] blockSize is the number of samples to process
6303 * @param[out] pResult is output value.
6308 float32_t * pResult);
6312 * @brief Root Mean Square of the elements of a Q31 vector.
6313 * @param[in] pSrc is input pointer
6314 * @param[in] blockSize is the number of samples to process
6315 * @param[out] pResult is output value.
6324 * @brief Root Mean Square of the elements of a Q15 vector.
6325 * @param[in] pSrc is input pointer
6326 * @param[in] blockSize is the number of samples to process
6327 * @param[out] pResult is output value.
6336 * @brief Standard deviation of the elements of a floating-point vector.
6337 * @param[in] pSrc is input pointer
6338 * @param[in] blockSize is the number of samples to process
6339 * @param[out] pResult is output value.
6344 float32_t * pResult);
6348 * @brief Standard deviation of the elements of a Q31 vector.
6349 * @param[in] pSrc is input pointer
6350 * @param[in] blockSize is the number of samples to process
6351 * @param[out] pResult is output value.
6360 * @brief Standard deviation of the elements of a Q15 vector.
6361 * @param[in] pSrc is input pointer
6362 * @param[in] blockSize is the number of samples to process
6363 * @param[out] pResult is output value.
6372 * @brief Floating-point complex magnitude
6373 * @param[in] pSrc points to the complex input vector
6374 * @param[out] pDst points to the real output vector
6375 * @param[in] numSamples number of complex samples in the input vector
6377 void arm_cmplx_mag_f32(
6380 uint32_t numSamples);
6384 * @brief Q31 complex magnitude
6385 * @param[in] pSrc points to the complex input vector
6386 * @param[out] pDst points to the real output vector
6387 * @param[in] numSamples number of complex samples in the input vector
6389 void arm_cmplx_mag_q31(
6392 uint32_t numSamples);
6396 * @brief Q15 complex magnitude
6397 * @param[in] pSrc points to the complex input vector
6398 * @param[out] pDst points to the real output vector
6399 * @param[in] numSamples number of complex samples in the input vector
6401 void arm_cmplx_mag_q15(
6404 uint32_t numSamples);
6408 * @brief Q15 complex dot product
6409 * @param[in] pSrcA points to the first input vector
6410 * @param[in] pSrcB points to the second input vector
6411 * @param[in] numSamples number of complex samples in each vector
6412 * @param[out] realResult real part of the result returned here
6413 * @param[out] imagResult imaginary part of the result returned here
6415 void arm_cmplx_dot_prod_q15(
6418 uint32_t numSamples,
6420 q31_t * imagResult);
6424 * @brief Q31 complex dot product
6425 * @param[in] pSrcA points to the first input vector
6426 * @param[in] pSrcB points to the second input vector
6427 * @param[in] numSamples number of complex samples in each vector
6428 * @param[out] realResult real part of the result returned here
6429 * @param[out] imagResult imaginary part of the result returned here
6431 void arm_cmplx_dot_prod_q31(
6434 uint32_t numSamples,
6436 q63_t * imagResult);
6440 * @brief Floating-point complex dot product
6441 * @param[in] pSrcA points to the first input vector
6442 * @param[in] pSrcB points to the second input vector
6443 * @param[in] numSamples number of complex samples in each vector
6444 * @param[out] realResult real part of the result returned here
6445 * @param[out] imagResult imaginary part of the result returned here
6447 void arm_cmplx_dot_prod_f32(
6450 uint32_t numSamples,
6451 float32_t * realResult,
6452 float32_t * imagResult);
6456 * @brief Q15 complex-by-real multiplication
6457 * @param[in] pSrcCmplx points to the complex input vector
6458 * @param[in] pSrcReal points to the real input vector
6459 * @param[out] pCmplxDst points to the complex output vector
6460 * @param[in] numSamples number of samples in each vector
6462 void arm_cmplx_mult_real_q15(
6466 uint32_t numSamples);
6470 * @brief Q31 complex-by-real multiplication
6471 * @param[in] pSrcCmplx points to the complex input vector
6472 * @param[in] pSrcReal points to the real input vector
6473 * @param[out] pCmplxDst points to the complex output vector
6474 * @param[in] numSamples number of samples in each vector
6476 void arm_cmplx_mult_real_q31(
6480 uint32_t numSamples);
6484 * @brief Floating-point complex-by-real multiplication
6485 * @param[in] pSrcCmplx points to the complex input vector
6486 * @param[in] pSrcReal points to the real input vector
6487 * @param[out] pCmplxDst points to the complex output vector
6488 * @param[in] numSamples number of samples in each vector
6490 void arm_cmplx_mult_real_f32(
6491 float32_t * pSrcCmplx,
6492 float32_t * pSrcReal,
6493 float32_t * pCmplxDst,
6494 uint32_t numSamples);
6498 * @brief Minimum value of a Q7 vector.
6499 * @param[in] pSrc is input pointer
6500 * @param[in] blockSize is the number of samples to process
6501 * @param[out] result is output pointer
6502 * @param[in] index is the array index of the minimum value in the input buffer.
6512 * @brief Minimum value of a Q15 vector.
6513 * @param[in] pSrc is input pointer
6514 * @param[in] blockSize is the number of samples to process
6515 * @param[out] pResult is output pointer
6516 * @param[in] pIndex is the array index of the minimum value in the input buffer.
6526 * @brief Minimum value of a Q31 vector.
6527 * @param[in] pSrc is input pointer
6528 * @param[in] blockSize is the number of samples to process
6529 * @param[out] pResult is output pointer
6530 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6540 * @brief Minimum value of a floating-point vector.
6541 * @param[in] pSrc is input pointer
6542 * @param[in] blockSize is the number of samples to process
6543 * @param[out] pResult is output pointer
6544 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6549 float32_t * pResult,
6554 * @brief Maximum value of a Q7 vector.
6555 * @param[in] pSrc points to the input buffer
6556 * @param[in] blockSize length of the input vector
6557 * @param[out] pResult maximum value returned here
6558 * @param[out] pIndex index of maximum value returned here
6568 * @brief Maximum value of a Q15 vector.
6569 * @param[in] pSrc points to the input buffer
6570 * @param[in] blockSize length of the input vector
6571 * @param[out] pResult maximum value returned here
6572 * @param[out] pIndex index of maximum value returned here
6582 * @brief Maximum value of a Q31 vector.
6583 * @param[in] pSrc points to the input buffer
6584 * @param[in] blockSize length of the input vector
6585 * @param[out] pResult maximum value returned here
6586 * @param[out] pIndex index of maximum value returned here
6596 * @brief Maximum value of a floating-point vector.
6597 * @param[in] pSrc points to the input buffer
6598 * @param[in] blockSize length of the input vector
6599 * @param[out] pResult maximum value returned here
6600 * @param[out] pIndex index of maximum value returned here
6605 float32_t * pResult,
6610 * @brief Q15 complex-by-complex multiplication
6611 * @param[in] pSrcA points to the first input vector
6612 * @param[in] pSrcB points to the second input vector
6613 * @param[out] pDst points to the output vector
6614 * @param[in] numSamples number of complex samples in each vector
6616 void arm_cmplx_mult_cmplx_q15(
6620 uint32_t numSamples);
6624 * @brief Q31 complex-by-complex multiplication
6625 * @param[in] pSrcA points to the first input vector
6626 * @param[in] pSrcB points to the second input vector
6627 * @param[out] pDst points to the output vector
6628 * @param[in] numSamples number of complex samples in each vector
6630 void arm_cmplx_mult_cmplx_q31(
6634 uint32_t numSamples);
6638 * @brief Floating-point complex-by-complex multiplication
6639 * @param[in] pSrcA points to the first input vector
6640 * @param[in] pSrcB points to the second input vector
6641 * @param[out] pDst points to the output vector
6642 * @param[in] numSamples number of complex samples in each vector
6644 void arm_cmplx_mult_cmplx_f32(
6648 uint32_t numSamples);
6652 * @brief Converts the elements of the floating-point vector to Q31 vector.
6653 * @param[in] pSrc points to the floating-point input vector
6654 * @param[out] pDst points to the Q31 output vector
6655 * @param[in] blockSize length of the input vector
6657 void arm_float_to_q31(
6660 uint32_t blockSize);
6664 * @brief Converts the elements of the floating-point vector to Q15 vector.
6665 * @param[in] pSrc points to the floating-point input vector
6666 * @param[out] pDst points to the Q15 output vector
6667 * @param[in] blockSize length of the input vector
6669 void arm_float_to_q15(
6672 uint32_t blockSize);
6676 * @brief Converts the elements of the floating-point vector to Q7 vector.
6677 * @param[in] pSrc points to the floating-point input vector
6678 * @param[out] pDst points to the Q7 output vector
6679 * @param[in] blockSize length of the input vector
6681 void arm_float_to_q7(
6684 uint32_t blockSize);
6688 * @brief Converts the elements of the Q31 vector to Q15 vector.
6689 * @param[in] pSrc is input pointer
6690 * @param[out] pDst is output pointer
6691 * @param[in] blockSize is the number of samples to process
6693 void arm_q31_to_q15(
6696 uint32_t blockSize);
6700 * @brief Converts the elements of the Q31 vector to Q7 vector.
6701 * @param[in] pSrc is input pointer
6702 * @param[out] pDst is output pointer
6703 * @param[in] blockSize is the number of samples to process
6708 uint32_t blockSize);
6712 * @brief Converts the elements of the Q15 vector to floating-point vector.
6713 * @param[in] pSrc is input pointer
6714 * @param[out] pDst is output pointer
6715 * @param[in] blockSize is the number of samples to process
6717 void arm_q15_to_float(
6720 uint32_t blockSize);
6724 * @brief Converts the elements of the Q15 vector to Q31 vector.
6725 * @param[in] pSrc is input pointer
6726 * @param[out] pDst is output pointer
6727 * @param[in] blockSize is the number of samples to process
6729 void arm_q15_to_q31(
6732 uint32_t blockSize);
6736 * @brief Converts the elements of the Q15 vector to Q7 vector.
6737 * @param[in] pSrc is input pointer
6738 * @param[out] pDst is output pointer
6739 * @param[in] blockSize is the number of samples to process
6744 uint32_t blockSize);
6748 * @ingroup groupInterpolation
6752 * @defgroup BilinearInterpolate Bilinear Interpolation
6754 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
6755 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
6756 * determines values between the grid points.
6757 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
6758 * Bilinear interpolation is often used in image processing to rescale images.
6759 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
6763 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
6764 * For floating-point, the instance structure is defined as:
6771 * } arm_bilinear_interp_instance_f32;
6775 * where <code>numRows</code> specifies the number of rows in the table;
6776 * <code>numCols</code> specifies the number of columns in the table;
6777 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
6778 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
6779 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
6782 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
6788 * The interpolated output point is computed as:
6790 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
6791 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
6792 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
6793 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
6795 * Note that the coordinates (x, y) contain integer and fractional components.
6796 * The integer components specify which portion of the table to use while the
6797 * fractional components control the interpolation processor.
6800 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
6804 * @addtogroup BilinearInterpolate
6811 * @brief Floating-point bilinear interpolation.
6812 * @param[in,out] S points to an instance of the interpolation structure.
6813 * @param[in] X interpolation coordinate.
6814 * @param[in] Y interpolation coordinate.
6815 * @return out interpolated value.
6817 CMSIS_INLINE __STATIC_INLINE float32_t arm_bilinear_interp_f32(
6818 const arm_bilinear_interp_instance_f32 * S,
6823 float32_t f00, f01, f10, f11;
6824 float32_t *pData = S->pData;
6825 int32_t xIndex, yIndex, index;
6826 float32_t xdiff, ydiff;
6827 float32_t b1, b2, b3, b4;
6829 xIndex = (int32_t) X;
6830 yIndex = (int32_t) Y;
6832 /* Care taken for table outside boundary */
6833 /* Returns zero output when values are outside table boundary */
6834 if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))
6839 /* Calculation of index for two nearest points in X-direction */
6840 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
6843 /* Read two nearest points in X-direction */
6845 f01 = pData[index + 1];
6847 /* Calculation of index for two nearest points in Y-direction */
6848 index = (xIndex - 1) + (yIndex) * S->numCols;
6851 /* Read two nearest points in Y-direction */
6853 f11 = pData[index + 1];
6855 /* Calculation of intermediate values */
6859 b4 = f00 - f01 - f10 + f11;
6861 /* Calculation of fractional part in X */
6864 /* Calculation of fractional part in Y */
6867 /* Calculation of bi-linear interpolated output */
6868 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
6870 /* return to application */
6877 * @brief Q31 bilinear interpolation.
6878 * @param[in,out] S points to an instance of the interpolation structure.
6879 * @param[in] X interpolation coordinate in 12.20 format.
6880 * @param[in] Y interpolation coordinate in 12.20 format.
6881 * @return out interpolated value.
6883 CMSIS_INLINE __STATIC_INLINE q31_t arm_bilinear_interp_q31(
6884 arm_bilinear_interp_instance_q31 * S,
6888 q31_t out; /* Temporary output */
6889 q31_t acc = 0; /* output */
6890 q31_t xfract, yfract; /* X, Y fractional parts */
6891 q31_t x1, x2, y1, y2; /* Nearest output values */
6892 int32_t rI, cI; /* Row and column indices */
6893 q31_t *pYData = S->pData; /* pointer to output table values */
6894 uint32_t nCols = S->numCols; /* num of rows */
6896 /* Input is in 12.20 format */
6897 /* 12 bits for the table index */
6898 /* Index value calculation */
6899 rI = ((X & (q31_t)0xFFF00000) >> 20);
6901 /* Input is in 12.20 format */
6902 /* 12 bits for the table index */
6903 /* Index value calculation */
6904 cI = ((Y & (q31_t)0xFFF00000) >> 20);
6906 /* Care taken for table outside boundary */
6907 /* Returns zero output when values are outside table boundary */
6908 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
6913 /* 20 bits for the fractional part */
6914 /* shift left xfract by 11 to keep 1.31 format */
6915 xfract = (X & 0x000FFFFF) << 11u;
6917 /* Read two nearest output values from the index */
6918 x1 = pYData[(rI) + (int32_t)nCols * (cI) ];
6919 x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
6921 /* 20 bits for the fractional part */
6922 /* shift left yfract by 11 to keep 1.31 format */
6923 yfract = (Y & 0x000FFFFF) << 11u;
6925 /* Read two nearest output values from the index */
6926 y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ];
6927 y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
6929 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
6930 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
6931 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
6933 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
6934 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
6935 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
6937 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
6938 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
6939 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
6941 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
6942 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
6943 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
6945 /* Convert acc to 1.31(q31) format */
6946 return ((q31_t)(acc << 2));
6951 * @brief Q15 bilinear interpolation.
6952 * @param[in,out] S points to an instance of the interpolation structure.
6953 * @param[in] X interpolation coordinate in 12.20 format.
6954 * @param[in] Y interpolation coordinate in 12.20 format.
6955 * @return out interpolated value.
6957 CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(
6958 arm_bilinear_interp_instance_q15 * S,
6962 q63_t acc = 0; /* output */
6963 q31_t out; /* Temporary output */
6964 q15_t x1, x2, y1, y2; /* Nearest output values */
6965 q31_t xfract, yfract; /* X, Y fractional parts */
6966 int32_t rI, cI; /* Row and column indices */
6967 q15_t *pYData = S->pData; /* pointer to output table values */
6968 uint32_t nCols = S->numCols; /* num of rows */
6970 /* Input is in 12.20 format */
6971 /* 12 bits for the table index */
6972 /* Index value calculation */
6973 rI = ((X & (q31_t)0xFFF00000) >> 20);
6975 /* Input is in 12.20 format */
6976 /* 12 bits for the table index */
6977 /* Index value calculation */
6978 cI = ((Y & (q31_t)0xFFF00000) >> 20);
6980 /* Care taken for table outside boundary */
6981 /* Returns zero output when values are outside table boundary */
6982 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
6987 /* 20 bits for the fractional part */
6988 /* xfract should be in 12.20 format */
6989 xfract = (X & 0x000FFFFF);
6991 /* Read two nearest output values from the index */
6992 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
6993 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
6995 /* 20 bits for the fractional part */
6996 /* yfract should be in 12.20 format */
6997 yfract = (Y & 0x000FFFFF);
6999 /* Read two nearest output values from the index */
7000 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
7001 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
7003 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
7005 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
7006 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
7007 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
7008 acc = ((q63_t) out * (0xFFFFF - yfract));
7010 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
7011 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
7012 acc += ((q63_t) out * (xfract));
7014 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
7015 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
7016 acc += ((q63_t) out * (yfract));
7018 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
7019 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
7020 acc += ((q63_t) out * (yfract));
7022 /* acc is in 13.51 format and down shift acc by 36 times */
7023 /* Convert out to 1.15 format */
7024 return ((q15_t)(acc >> 36));
7029 * @brief Q7 bilinear interpolation.
7030 * @param[in,out] S points to an instance of the interpolation structure.
7031 * @param[in] X interpolation coordinate in 12.20 format.
7032 * @param[in] Y interpolation coordinate in 12.20 format.
7033 * @return out interpolated value.
7035 CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7(
7036 arm_bilinear_interp_instance_q7 * S,
7040 q63_t acc = 0; /* output */
7041 q31_t out; /* Temporary output */
7042 q31_t xfract, yfract; /* X, Y fractional parts */
7043 q7_t x1, x2, y1, y2; /* Nearest output values */
7044 int32_t rI, cI; /* Row and column indices */
7045 q7_t *pYData = S->pData; /* pointer to output table values */
7046 uint32_t nCols = S->numCols; /* num of rows */
7048 /* Input is in 12.20 format */
7049 /* 12 bits for the table index */
7050 /* Index value calculation */
7051 rI = ((X & (q31_t)0xFFF00000) >> 20);
7053 /* Input is in 12.20 format */
7054 /* 12 bits for the table index */
7055 /* Index value calculation */
7056 cI = ((Y & (q31_t)0xFFF00000) >> 20);
7058 /* Care taken for table outside boundary */
7059 /* Returns zero output when values are outside table boundary */
7060 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
7065 /* 20 bits for the fractional part */
7066 /* xfract should be in 12.20 format */
7067 xfract = (X & (q31_t)0x000FFFFF);
7069 /* Read two nearest output values from the index */
7070 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
7071 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
7073 /* 20 bits for the fractional part */
7074 /* yfract should be in 12.20 format */
7075 yfract = (Y & (q31_t)0x000FFFFF);
7077 /* Read two nearest output values from the index */
7078 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
7079 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
7081 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
7082 out = ((x1 * (0xFFFFF - xfract)));
7083 acc = (((q63_t) out * (0xFFFFF - yfract)));
7085 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
7086 out = ((x2 * (0xFFFFF - yfract)));
7087 acc += (((q63_t) out * (xfract)));
7089 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
7090 out = ((y1 * (0xFFFFF - xfract)));
7091 acc += (((q63_t) out * (yfract)));
7093 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
7094 out = ((y2 * (yfract)));
7095 acc += (((q63_t) out * (xfract)));
7097 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
7098 return ((q7_t)(acc >> 40));
7102 * @} end of BilinearInterpolate group
7107 #define multAcc_32x32_keep32_R(a, x, y) \
7108 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
7111 #define multSub_32x32_keep32_R(a, x, y) \
7112 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
7115 #define mult_32x32_keep32_R(a, x, y) \
7116 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
7119 #define multAcc_32x32_keep32(a, x, y) \
7120 a += (q31_t) (((q63_t) x * y) >> 32)
7123 #define multSub_32x32_keep32(a, x, y) \
7124 a -= (q31_t) (((q63_t) x * y) >> 32)
7127 #define mult_32x32_keep32(a, x, y) \
7128 a = (q31_t) (((q63_t) x * y ) >> 32)
7131 #if defined ( __CC_ARM )
7132 /* Enter low optimization region - place directly above function definition */
7133 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
7134 #define LOW_OPTIMIZATION_ENTER \
7138 #define LOW_OPTIMIZATION_ENTER
7141 /* Exit low optimization region - place directly after end of function definition */
7142 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
7143 #define LOW_OPTIMIZATION_EXIT \
7146 #define LOW_OPTIMIZATION_EXIT
7149 /* Enter low optimization region - place directly above function definition */
7150 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7152 /* Exit low optimization region - place directly after end of function definition */
7153 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7155 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
7156 #define LOW_OPTIMIZATION_ENTER
7157 #define LOW_OPTIMIZATION_EXIT
7158 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7159 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7161 #elif defined ( __GNUC__ )
7162 #define LOW_OPTIMIZATION_ENTER \
7163 __attribute__(( optimize("-O1") ))
7164 #define LOW_OPTIMIZATION_EXIT
7165 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7166 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7168 #elif defined ( __ICCARM__ )
7169 /* Enter low optimization region - place directly above function definition */
7170 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
7171 #define LOW_OPTIMIZATION_ENTER \
7172 _Pragma ("optimize=low")
7174 #define LOW_OPTIMIZATION_ENTER
7177 /* Exit low optimization region - place directly after end of function definition */
7178 #define LOW_OPTIMIZATION_EXIT
7180 /* Enter low optimization region - place directly above function definition */
7181 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
7182 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
7183 _Pragma ("optimize=low")
7185 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7188 /* Exit low optimization region - place directly after end of function definition */
7189 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7191 #elif defined ( __TI_ARM__ )
7192 #define LOW_OPTIMIZATION_ENTER
7193 #define LOW_OPTIMIZATION_EXIT
7194 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7195 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7197 #elif defined ( __CSMC__ )
7198 #define LOW_OPTIMIZATION_ENTER
7199 #define LOW_OPTIMIZATION_EXIT
7200 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7201 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7203 #elif defined ( __TASKING__ )
7204 #define LOW_OPTIMIZATION_ENTER
7205 #define LOW_OPTIMIZATION_EXIT
7206 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7207 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7217 #if defined ( __GNUC__ )
7218 #pragma GCC diagnostic pop
7221 #endif /* _ARM_MATH_H */