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