1 /******************************************************************************
3 * @brief Public header file for CMSIS DSP LibraryU
5 * @date 10. January 2018
6 ******************************************************************************/
8 * Copyright (c) 2010-2018 Arm Limited or its affiliates. All rights reserved.
10 * SPDX-License-Identifier: Apache-2.0
12 * Licensed under the Apache License, Version 2.0 (the License); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
26 \mainpage CMSIS DSP Software Library
31 * This user manual describes the CMSIS DSP software library,
32 * a suite of common signal processing functions for use on Cortex-M processor based devices.
34 * The library is divided into a number of functions each covering a specific category:
35 * - Basic math functions
36 * - Fast math functions
37 * - Complex math functions
41 * - Motor control functions
42 * - Statistical functions
44 * - Interpolation functions
46 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
47 * 32-bit integer and 32-bit floating-point values.
52 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
53 * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
54 * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
55 * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
56 * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
57 * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
58 * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
59 * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
60 * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
61 * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
62 * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
63 * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
64 * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
65 * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
66 * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
67 * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
68 * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
69 * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
70 * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
71 * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
73 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
74 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
75 * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
76 * Define the appropriate preprocessor macro ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
77 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
78 * For Armv8-M cores define preprocessor macro ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML.
79 * Set preprocessor macro __DSP_PRESENT if Armv8-M Mainline core supports DSP instructions.
85 * The library ships with a number of examples which demonstrate how to use the library functions.
90 * The library has been developed and tested with MDK version 5.14.0.0
91 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
93 * Building the Library
96 * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
97 * - arm_cortexM_math.uvprojx
100 * 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.
102 * Preprocessor Macros
105 * Each library project have different preprocessor macros.
107 * - UNALIGNED_SUPPORT_DISABLE:
109 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
111 * - ARM_MATH_BIG_ENDIAN:
113 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
115 * - ARM_MATH_MATRIX_CHECK:
117 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
119 * - ARM_MATH_ROUNDING:
121 * Define macro ARM_MATH_ROUNDING for rounding on support functions
125 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
126 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
127 * ARM_MATH_CM7 for building the library on cortex-M7.
129 * - ARM_MATH_ARMV8MxL:
131 * Define macro ARM_MATH_ARMV8MBL for building the library on Armv8-M Baseline target, ARM_MATH_ARMV8MML for building library
132 * on Armv8-M Mainline target.
136 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries.
140 * Initialize macro __DSP_PRESENT = 1 when Armv8-M Mainline core supports DSP instructions.
143 * CMSIS-DSP in ARM::CMSIS Pack
144 * -----------------------------
146 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
147 * |File/Folder |Content |
148 * |------------------------------|------------------------------------------------------------------------|
149 * |\b CMSIS\\Documentation\\DSP | This documentation |
150 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
151 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
152 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
155 * Revision History of CMSIS-DSP
157 * Please refer to \ref ChangeLog_pg.
162 * Copyright (C) 2010-2015 Arm Limited. All rights reserved.
167 * @defgroup groupMath Basic Math Functions
171 * @defgroup groupFastMath Fast Math Functions
172 * This set of functions provides a fast approximation to sine, cosine, and square root.
173 * As compared to most of the other functions in the CMSIS math library, the fast math functions
174 * operate on individual values and not arrays.
175 * There are separate functions for Q15, Q31, and floating-point data.
180 * @defgroup groupCmplxMath Complex Math Functions
181 * This set of functions operates on complex data vectors.
182 * The data in the complex arrays is stored in an interleaved fashion
183 * (real, imag, real, imag, ...).
184 * In the API functions, the number of samples in a complex array refers
185 * to the number of complex values; the array contains twice this number of
190 * @defgroup groupFilters Filtering Functions
194 * @defgroup groupMatrix Matrix Functions
196 * This set of functions provides basic matrix math operations.
197 * The functions operate on matrix data structures. For example,
199 * definition for the floating-point matrix structure is shown
204 * uint16_t numRows; // number of rows of the matrix.
205 * uint16_t numCols; // number of columns of the matrix.
206 * float32_t *pData; // points to the data of the matrix.
207 * } arm_matrix_instance_f32;
209 * There are similar definitions for Q15 and Q31 data types.
211 * The structure specifies the size of the matrix and then points to
212 * an array of data. The array is of size <code>numRows X numCols</code>
213 * and the values are arranged in row order. That is, the
214 * matrix element (i, j) is stored at:
216 * pData[i*numCols + j]
219 * \par Init Functions
220 * There is an associated initialization function for each type of matrix
222 * The initialization function sets the values of the internal structure fields.
223 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
224 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
227 * Use of the initialization function is optional. However, if initialization function is used
228 * then the instance structure cannot be placed into a const data section.
229 * To place the instance structure in a const data
230 * section, manually initialize the data structure. For example:
232 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
233 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
234 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
236 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
237 * specifies the number of columns, and <code>pData</code> points to the
241 * By default all of the matrix functions perform size checking on the input and
242 * output matrices. For example, the matrix addition function verifies that the
243 * two input matrices and the output matrix all have the same number of rows and
244 * columns. If the size check fails the functions return:
246 * ARM_MATH_SIZE_MISMATCH
248 * Otherwise the functions return
252 * There is some overhead associated with this matrix size checking.
253 * The matrix size checking is enabled via the \#define
255 * ARM_MATH_MATRIX_CHECK
257 * within the library project settings. By default this macro is defined
258 * and size checking is enabled. By changing the project settings and
259 * undefining this macro size checking is eliminated and the functions
260 * run a bit faster. With size checking disabled the functions always
261 * return <code>ARM_MATH_SUCCESS</code>.
265 * @defgroup groupTransforms Transform Functions
269 * @defgroup groupController Controller Functions
273 * @defgroup groupStats Statistics Functions
276 * @defgroup groupSupport Support Functions
280 * @defgroup groupInterpolation Interpolation Functions
281 * These functions perform 1- and 2-dimensional interpolation of data.
282 * Linear interpolation is used for 1-dimensional data and
283 * bilinear interpolation is used for 2-dimensional data.
287 * @defgroup groupExamples Examples
292 /* Compiler specific diagnostic adjustment */
293 #if defined ( __CC_ARM )
295 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
297 #elif defined ( __GNUC__ )
298 #pragma GCC diagnostic push
299 #pragma GCC diagnostic ignored "-Wsign-conversion"
300 #pragma GCC diagnostic ignored "-Wconversion"
301 #pragma GCC diagnostic ignored "-Wunused-parameter"
303 #elif defined ( __ICCARM__ )
305 #elif defined ( __TI_ARM__ )
307 #elif defined ( __CSMC__ )
309 #elif defined ( __TASKING__ )
312 #error Unknown compiler
316 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
318 #if defined(ARM_MATH_CM7)
319 #include "core_cm7.h"
321 #elif defined (ARM_MATH_CM4)
322 #include "core_cm4.h"
324 #elif defined (ARM_MATH_CM3)
325 #include "core_cm3.h"
326 #elif defined (ARM_MATH_CM0)
327 #include "core_cm0.h"
328 #define ARM_MATH_CM0_FAMILY
329 #elif defined (ARM_MATH_CM0PLUS)
330 #include "core_cm0plus.h"
331 #define ARM_MATH_CM0_FAMILY
332 #elif defined (ARM_MATH_ARMV8MBL)
333 #include "core_armv8mbl.h"
334 #define ARM_MATH_CM0_FAMILY
335 #elif defined (ARM_MATH_ARMV8MML)
336 #include "core_armv8mml.h"
337 #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1))
341 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
344 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
354 * @brief Macros required for reciprocal calculation in Normalized LMS
357 #define DELTA_Q31 (0x100)
358 #define DELTA_Q15 0x5
359 #define INDEX_MASK 0x0000003F
361 #define PI 3.14159265358979f
365 * @brief Macros required for SINE and COSINE Fast math approximations
368 #define FAST_MATH_TABLE_SIZE 512
369 #define FAST_MATH_Q31_SHIFT (32 - 10)
370 #define FAST_MATH_Q15_SHIFT (16 - 10)
371 #define CONTROLLER_Q31_SHIFT (32 - 9)
372 #define TABLE_SPACING_Q31 0x400000
373 #define TABLE_SPACING_Q15 0x80
376 * @brief Macros required for SINE and COSINE Controller functions
378 /* 1.31(q31) Fixed value of 2/360 */
379 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
380 #define INPUT_SPACING 0xB60B61
383 * @brief Macro for Unaligned Support
385 #ifndef UNALIGNED_SUPPORT_DISABLE
388 #if defined (__GNUC__)
389 #define ALIGN4 __attribute__((aligned(4)))
391 #define ALIGN4 __align(4)
393 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
396 * @brief Error status returned by some functions in the library.
401 ARM_MATH_SUCCESS
= 0, /**< No error */
402 ARM_MATH_ARGUMENT_ERROR
= -1, /**< One or more arguments are incorrect */
403 ARM_MATH_LENGTH_ERROR
= -2, /**< Length of data buffer is incorrect */
404 ARM_MATH_SIZE_MISMATCH
= -3, /**< Size of matrices is not compatible with the operation. */
405 ARM_MATH_NANINF
= -4, /**< Not-a-number (NaN) or infinity is generated */
406 ARM_MATH_SINGULAR
= -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
407 ARM_MATH_TEST_FAILURE
= -6 /**< Test Failed */
411 * @brief 8-bit fractional data type in 1.7 format.
416 * @brief 16-bit fractional data type in 1.15 format.
418 typedef int16_t q15_t
;
421 * @brief 32-bit fractional data type in 1.31 format.
423 typedef int32_t q31_t
;
426 * @brief 64-bit fractional data type in 1.63 format.
428 typedef int64_t q63_t
;
431 * @brief 32-bit floating-point type definition.
433 typedef float float32_t
;
436 * @brief 64-bit floating-point type definition.
438 typedef double float64_t
;
441 * @brief definition to read/write two 16 bit values.
443 #if defined ( __CC_ARM )
444 #define __SIMD32_TYPE int32_t __packed
445 #define CMSIS_UNUSED __attribute__((unused))
446 #define CMSIS_INLINE __attribute__((always_inline))
448 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
449 #define __SIMD32_TYPE int32_t
450 #define CMSIS_UNUSED __attribute__((unused))
451 #define CMSIS_INLINE __attribute__((always_inline))
453 #elif defined ( __GNUC__ )
454 #define __SIMD32_TYPE int32_t
455 #define CMSIS_UNUSED __attribute__((unused))
456 #define CMSIS_INLINE __attribute__((always_inline))
458 #elif defined ( __ICCARM__ )
459 #define __SIMD32_TYPE int32_t __packed
463 #elif defined ( __TI_ARM__ )
464 #define __SIMD32_TYPE int32_t
465 #define CMSIS_UNUSED __attribute__((unused))
468 #elif defined ( __CSMC__ )
469 #define __SIMD32_TYPE int32_t
473 #elif defined ( __TASKING__ )
474 #define __SIMD32_TYPE __unaligned int32_t
479 #error Unknown compiler
482 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
483 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
484 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
485 #define __SIMD64(addr) (*(int64_t **) & (addr))
487 #if !defined (ARM_MATH_DSP)
489 * @brief definition to pack two 16 bit values.
491 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
492 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
493 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
494 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
496 #endif /* !defined (ARM_MATH_DSP) */
499 * @brief definition to pack four 8 bit values.
501 #ifndef ARM_MATH_BIG_ENDIAN
503 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
504 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
505 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
506 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
509 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
510 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
511 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
512 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
518 * @brief Clips Q63 to Q31 values.
520 CMSIS_INLINE __STATIC_INLINE q31_t
clip_q63_to_q31(
523 return ((q31_t
) (x
>> 32) != ((q31_t
) x
>> 31)) ?
524 ((0x7FFFFFFF ^ ((q31_t
) (x
>> 63)))) : (q31_t
) x
;
528 * @brief Clips Q63 to Q15 values.
530 CMSIS_INLINE __STATIC_INLINE q15_t
clip_q63_to_q15(
533 return ((q31_t
) (x
>> 32) != ((q31_t
) x
>> 31)) ?
534 ((0x7FFF ^ ((q15_t
) (x
>> 63)))) : (q15_t
) (x
>> 15);
538 * @brief Clips Q31 to Q7 values.
540 CMSIS_INLINE __STATIC_INLINE q7_t
clip_q31_to_q7(
543 return ((q31_t
) (x
>> 24) != ((q31_t
) x
>> 23)) ?
544 ((0x7F ^ ((q7_t
) (x
>> 31)))) : (q7_t
) x
;
548 * @brief Clips Q31 to Q15 values.
550 CMSIS_INLINE __STATIC_INLINE q15_t
clip_q31_to_q15(
553 return ((q31_t
) (x
>> 16) != ((q31_t
) x
>> 15)) ?
554 ((0x7FFF ^ ((q15_t
) (x
>> 31)))) : (q15_t
) x
;
558 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
561 CMSIS_INLINE __STATIC_INLINE q63_t
mult32x64(
565 return ((((q63_t
) (x
& 0x00000000FFFFFFFF) * y
) >> 32) +
566 (((q63_t
) (x
>> 32) * y
)));
570 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
573 CMSIS_INLINE __STATIC_INLINE
uint32_t arm_recip_q31(
585 signBits
= ((uint32_t) (__CLZ( in
) - 1));
589 signBits
= ((uint32_t) (__CLZ(-in
) - 1));
592 /* Convert input sample to 1.31 format */
593 in
= (in
<< signBits
);
595 /* calculation of index for initial approximated Val */
596 index
= (uint32_t)(in
>> 24);
597 index
= (index
& INDEX_MASK
);
599 /* 1.31 with exp 1 */
600 out
= pRecipTable
[index
];
602 /* calculation of reciprocal value */
603 /* running approximation for two iterations */
604 for (i
= 0U; i
< 2U; i
++)
606 tempVal
= (uint32_t) (((q63_t
) in
* out
) >> 31);
607 tempVal
= 0x7FFFFFFFu
- tempVal
;
608 /* 1.31 with exp 1 */
609 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
610 out
= clip_q63_to_q31(((q63_t
) out
* tempVal
) >> 30);
616 /* return num of signbits of out = 1/in value */
617 return (signBits
+ 1U);
622 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
624 CMSIS_INLINE __STATIC_INLINE
uint32_t arm_recip_q15(
630 uint32_t tempVal
= 0;
631 uint32_t index
= 0, i
= 0;
632 uint32_t signBits
= 0;
636 signBits
= ((uint32_t)(__CLZ( in
) - 17));
640 signBits
= ((uint32_t)(__CLZ(-in
) - 17));
643 /* Convert input sample to 1.15 format */
644 in
= (in
<< signBits
);
646 /* calculation of index for initial approximated Val */
647 index
= (uint32_t)(in
>> 8);
648 index
= (index
& INDEX_MASK
);
650 /* 1.15 with exp 1 */
651 out
= pRecipTable
[index
];
653 /* calculation of reciprocal value */
654 /* running approximation for two iterations */
655 for (i
= 0U; i
< 2U; i
++)
657 tempVal
= (uint32_t) (((q31_t
) in
* out
) >> 15);
658 tempVal
= 0x7FFFu
- tempVal
;
659 /* 1.15 with exp 1 */
660 out
= (q15_t
) (((q31_t
) out
* tempVal
) >> 14);
661 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
667 /* return num of signbits of out = 1/in value */
668 return (signBits
+ 1);
673 * @brief C custom defined intrinsic function for M3 and M0 processors
675 #if !defined (ARM_MATH_DSP)
678 * @brief C custom defined QADD8 for M3 and M0 processors
680 CMSIS_INLINE __STATIC_INLINE
uint32_t __QADD8(
686 r
= __SSAT(((((q31_t
)x
<< 24) >> 24) + (((q31_t
)y
<< 24) >> 24)), 8) & (int32_t)0x000000FF;
687 s
= __SSAT(((((q31_t
)x
<< 16) >> 24) + (((q31_t
)y
<< 16) >> 24)), 8) & (int32_t)0x000000FF;
688 t
= __SSAT(((((q31_t
)x
<< 8) >> 24) + (((q31_t
)y
<< 8) >> 24)), 8) & (int32_t)0x000000FF;
689 u
= __SSAT(((((q31_t
)x
) >> 24) + (((q31_t
)y
) >> 24)), 8) & (int32_t)0x000000FF;
691 return ((uint32_t)((u
<< 24) | (t
<< 16) | (s
<< 8) | (r
)));
696 * @brief C custom defined QSUB8 for M3 and M0 processors
698 CMSIS_INLINE __STATIC_INLINE
uint32_t __QSUB8(
704 r
= __SSAT(((((q31_t
)x
<< 24) >> 24) - (((q31_t
)y
<< 24) >> 24)), 8) & (int32_t)0x000000FF;
705 s
= __SSAT(((((q31_t
)x
<< 16) >> 24) - (((q31_t
)y
<< 16) >> 24)), 8) & (int32_t)0x000000FF;
706 t
= __SSAT(((((q31_t
)x
<< 8) >> 24) - (((q31_t
)y
<< 8) >> 24)), 8) & (int32_t)0x000000FF;
707 u
= __SSAT(((((q31_t
)x
) >> 24) - (((q31_t
)y
) >> 24)), 8) & (int32_t)0x000000FF;
709 return ((uint32_t)((u
<< 24) | (t
<< 16) | (s
<< 8) | (r
)));
714 * @brief C custom defined QADD16 for M3 and M0 processors
716 CMSIS_INLINE __STATIC_INLINE
uint32_t __QADD16(
720 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
723 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
724 s
= __SSAT(((((q31_t
)x
) >> 16) + (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
726 return ((uint32_t)((s
<< 16) | (r
)));
731 * @brief C custom defined SHADD16 for M3 and M0 processors
733 CMSIS_INLINE __STATIC_INLINE
uint32_t __SHADD16(
739 r
= (((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
740 s
= (((((q31_t
)x
) >> 16) + (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
742 return ((uint32_t)((s
<< 16) | (r
)));
747 * @brief C custom defined QSUB16 for M3 and M0 processors
749 CMSIS_INLINE __STATIC_INLINE
uint32_t __QSUB16(
755 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
756 s
= __SSAT(((((q31_t
)x
) >> 16) - (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
758 return ((uint32_t)((s
<< 16) | (r
)));
763 * @brief C custom defined SHSUB16 for M3 and M0 processors
765 CMSIS_INLINE __STATIC_INLINE
uint32_t __SHSUB16(
771 r
= (((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
772 s
= (((((q31_t
)x
) >> 16) - (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
774 return ((uint32_t)((s
<< 16) | (r
)));
779 * @brief C custom defined QASX for M3 and M0 processors
781 CMSIS_INLINE __STATIC_INLINE
uint32_t __QASX(
787 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
788 s
= __SSAT(((((q31_t
)x
) >> 16) + (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
790 return ((uint32_t)((s
<< 16) | (r
)));
795 * @brief C custom defined SHASX for M3 and M0 processors
797 CMSIS_INLINE __STATIC_INLINE
uint32_t __SHASX(
803 r
= (((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
804 s
= (((((q31_t
)x
) >> 16) + (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
806 return ((uint32_t)((s
<< 16) | (r
)));
811 * @brief C custom defined QSAX for M3 and M0 processors
813 CMSIS_INLINE __STATIC_INLINE
uint32_t __QSAX(
819 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
820 s
= __SSAT(((((q31_t
)x
) >> 16) - (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
822 return ((uint32_t)((s
<< 16) | (r
)));
827 * @brief C custom defined SHSAX for M3 and M0 processors
829 CMSIS_INLINE __STATIC_INLINE
uint32_t __SHSAX(
835 r
= (((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
836 s
= (((((q31_t
)x
) >> 16) - (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
838 return ((uint32_t)((s
<< 16) | (r
)));
843 * @brief C custom defined SMUSDX for M3 and M0 processors
845 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMUSDX(
849 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) -
850 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) ));
854 * @brief C custom defined SMUADX for M3 and M0 processors
856 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMUADX(
860 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) +
861 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) ));
866 * @brief C custom defined QADD for M3 and M0 processors
868 CMSIS_INLINE __STATIC_INLINE
int32_t __QADD(
872 return ((int32_t)(clip_q63_to_q31((q63_t
)x
+ (q31_t
)y
)));
877 * @brief C custom defined QSUB for M3 and M0 processors
879 CMSIS_INLINE __STATIC_INLINE
int32_t __QSUB(
883 return ((int32_t)(clip_q63_to_q31((q63_t
)x
- (q31_t
)y
)));
888 * @brief C custom defined SMLAD for M3 and M0 processors
890 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMLAD(
895 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
896 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) +
897 ( ((q31_t
)sum
) ) ));
902 * @brief C custom defined SMLADX for M3 and M0 processors
904 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMLADX(
909 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) +
910 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
911 ( ((q31_t
)sum
) ) ));
916 * @brief C custom defined SMLSDX for M3 and M0 processors
918 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMLSDX(
923 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) -
924 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
925 ( ((q31_t
)sum
) ) ));
930 * @brief C custom defined SMLALD for M3 and M0 processors
932 CMSIS_INLINE __STATIC_INLINE
uint64_t __SMLALD(
937 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
938 return ((uint64_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
939 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) +
940 ( ((q63_t
)sum
) ) ));
945 * @brief C custom defined SMLALDX for M3 and M0 processors
947 CMSIS_INLINE __STATIC_INLINE
uint64_t __SMLALDX(
952 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
953 return ((uint64_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) +
954 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
955 ( ((q63_t
)sum
) ) ));
960 * @brief C custom defined SMUAD for M3 and M0 processors
962 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMUAD(
966 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
967 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) ));
972 * @brief C custom defined SMUSD for M3 and M0 processors
974 CMSIS_INLINE __STATIC_INLINE
uint32_t __SMUSD(
978 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) -
979 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) ));
984 * @brief C custom defined SXTB16 for M3 and M0 processors
986 CMSIS_INLINE __STATIC_INLINE
uint32_t __SXTB16(
989 return ((uint32_t)(((((q31_t
)x
<< 24) >> 24) & (q31_t
)0x0000FFFF) |
990 ((((q31_t
)x
<< 8) >> 8) & (q31_t
)0xFFFF0000) ));
994 * @brief C custom defined SMMLA for M3 and M0 processors
996 CMSIS_INLINE __STATIC_INLINE
int32_t __SMMLA(
1001 return (sum
+ (int32_t) (((int64_t) x
* y
) >> 32));
1004 #endif /* !defined (ARM_MATH_DSP) */
1008 * @brief Instance structure for the Q7 FIR filter.
1012 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1013 q7_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1014 q7_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
1015 } arm_fir_instance_q7
;
1018 * @brief Instance structure for the Q15 FIR filter.
1022 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1023 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1024 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
1025 } arm_fir_instance_q15
;
1028 * @brief Instance structure for the Q31 FIR filter.
1032 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1033 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1034 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
1035 } arm_fir_instance_q31
;
1038 * @brief Instance structure for the floating-point FIR filter.
1042 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1043 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1044 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
1045 } arm_fir_instance_f32
;
1049 * @brief Processing function for the Q7 FIR filter.
1050 * @param[in] S points to an instance of the Q7 FIR filter structure.
1051 * @param[in] pSrc points to the block of input data.
1052 * @param[out] pDst points to the block of output data.
1053 * @param[in] blockSize number of samples to process.
1056 const arm_fir_instance_q7
* S
,
1059 uint32_t blockSize
);
1063 * @brief Initialization function for the Q7 FIR filter.
1064 * @param[in,out] S points to an instance of the Q7 FIR structure.
1065 * @param[in] numTaps Number of filter coefficients in the filter.
1066 * @param[in] pCoeffs points to the filter coefficients.
1067 * @param[in] pState points to the state buffer.
1068 * @param[in] blockSize number of samples that are processed.
1070 void arm_fir_init_q7(
1071 arm_fir_instance_q7
* S
,
1075 uint32_t blockSize
);
1079 * @brief Processing function for the Q15 FIR filter.
1080 * @param[in] S points to an instance of the Q15 FIR structure.
1081 * @param[in] pSrc points to the block of input data.
1082 * @param[out] pDst points to the block of output data.
1083 * @param[in] blockSize number of samples to process.
1086 const arm_fir_instance_q15
* S
,
1089 uint32_t blockSize
);
1093 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
1094 * @param[in] S points to an instance of the Q15 FIR filter structure.
1095 * @param[in] pSrc points to the block of input data.
1096 * @param[out] pDst points to the block of output data.
1097 * @param[in] blockSize number of samples to process.
1099 void arm_fir_fast_q15(
1100 const arm_fir_instance_q15
* S
,
1103 uint32_t blockSize
);
1107 * @brief Initialization function for the Q15 FIR filter.
1108 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
1109 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
1110 * @param[in] pCoeffs points to the filter coefficients.
1111 * @param[in] pState points to the state buffer.
1112 * @param[in] blockSize number of samples that are processed at a time.
1113 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
1114 * <code>numTaps</code> is not a supported value.
1116 arm_status
arm_fir_init_q15(
1117 arm_fir_instance_q15
* S
,
1121 uint32_t blockSize
);
1125 * @brief Processing function for the Q31 FIR filter.
1126 * @param[in] S points to an instance of the Q31 FIR filter structure.
1127 * @param[in] pSrc points to the block of input data.
1128 * @param[out] pDst points to the block of output data.
1129 * @param[in] blockSize number of samples to process.
1132 const arm_fir_instance_q31
* S
,
1135 uint32_t blockSize
);
1139 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
1140 * @param[in] S points to an instance of the Q31 FIR structure.
1141 * @param[in] pSrc points to the block of input data.
1142 * @param[out] pDst points to the block of output data.
1143 * @param[in] blockSize number of samples to process.
1145 void arm_fir_fast_q31(
1146 const arm_fir_instance_q31
* S
,
1149 uint32_t blockSize
);
1153 * @brief Initialization function for the Q31 FIR filter.
1154 * @param[in,out] S points to an instance of the Q31 FIR structure.
1155 * @param[in] numTaps Number of filter coefficients in the filter.
1156 * @param[in] pCoeffs points to the filter coefficients.
1157 * @param[in] pState points to the state buffer.
1158 * @param[in] blockSize number of samples that are processed at a time.
1160 void arm_fir_init_q31(
1161 arm_fir_instance_q31
* S
,
1165 uint32_t blockSize
);
1169 * @brief Processing function for the floating-point FIR filter.
1170 * @param[in] S points to an instance of the floating-point FIR structure.
1171 * @param[in] pSrc points to the block of input data.
1172 * @param[out] pDst points to the block of output data.
1173 * @param[in] blockSize number of samples to process.
1176 const arm_fir_instance_f32
* S
,
1179 uint32_t blockSize
);
1183 * @brief Initialization function for the floating-point FIR filter.
1184 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
1185 * @param[in] numTaps Number of filter coefficients in the filter.
1186 * @param[in] pCoeffs points to the filter coefficients.
1187 * @param[in] pState points to the state buffer.
1188 * @param[in] blockSize number of samples that are processed at a time.
1190 void arm_fir_init_f32(
1191 arm_fir_instance_f32
* S
,
1193 float32_t
* pCoeffs
,
1195 uint32_t blockSize
);
1199 * @brief Instance structure for the Q15 Biquad cascade filter.
1203 int8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1204 q15_t
*pState
; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1205 q15_t
*pCoeffs
; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1206 int8_t postShift
; /**< Additional shift, in bits, applied to each output sample. */
1207 } arm_biquad_casd_df1_inst_q15
;
1210 * @brief Instance structure for the Q31 Biquad cascade filter.
1214 uint32_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1215 q31_t
*pState
; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1216 q31_t
*pCoeffs
; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1217 uint8_t postShift
; /**< Additional shift, in bits, applied to each output sample. */
1218 } arm_biquad_casd_df1_inst_q31
;
1221 * @brief Instance structure for the floating-point Biquad cascade filter.
1225 uint32_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1226 float32_t
*pState
; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1227 float32_t
*pCoeffs
; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1228 } arm_biquad_casd_df1_inst_f32
;
1232 * @brief Processing function for the Q15 Biquad cascade filter.
1233 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1234 * @param[in] pSrc points to the block of input data.
1235 * @param[out] pDst points to the block of output data.
1236 * @param[in] blockSize number of samples to process.
1238 void arm_biquad_cascade_df1_q15(
1239 const arm_biquad_casd_df1_inst_q15
* S
,
1242 uint32_t blockSize
);
1246 * @brief Initialization function for the Q15 Biquad cascade filter.
1247 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
1248 * @param[in] numStages number of 2nd order stages in the filter.
1249 * @param[in] pCoeffs points to the filter coefficients.
1250 * @param[in] pState points to the state buffer.
1251 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1253 void arm_biquad_cascade_df1_init_q15(
1254 arm_biquad_casd_df1_inst_q15
* S
,
1262 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1263 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1264 * @param[in] pSrc points to the block of input data.
1265 * @param[out] pDst points to the block of output data.
1266 * @param[in] blockSize number of samples to process.
1268 void arm_biquad_cascade_df1_fast_q15(
1269 const arm_biquad_casd_df1_inst_q15
* S
,
1272 uint32_t blockSize
);
1276 * @brief Processing function for the Q31 Biquad cascade filter
1277 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1278 * @param[in] pSrc points to the block of input data.
1279 * @param[out] pDst points to the block of output data.
1280 * @param[in] blockSize number of samples to process.
1282 void arm_biquad_cascade_df1_q31(
1283 const arm_biquad_casd_df1_inst_q31
* S
,
1286 uint32_t blockSize
);
1290 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1291 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1292 * @param[in] pSrc points to the block of input data.
1293 * @param[out] pDst points to the block of output data.
1294 * @param[in] blockSize number of samples to process.
1296 void arm_biquad_cascade_df1_fast_q31(
1297 const arm_biquad_casd_df1_inst_q31
* S
,
1300 uint32_t blockSize
);
1304 * @brief Initialization function for the Q31 Biquad cascade filter.
1305 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
1306 * @param[in] numStages number of 2nd order stages in the filter.
1307 * @param[in] pCoeffs points to the filter coefficients.
1308 * @param[in] pState points to the state buffer.
1309 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1311 void arm_biquad_cascade_df1_init_q31(
1312 arm_biquad_casd_df1_inst_q31
* S
,
1320 * @brief Processing function for the floating-point Biquad cascade filter.
1321 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
1322 * @param[in] pSrc points to the block of input data.
1323 * @param[out] pDst points to the block of output data.
1324 * @param[in] blockSize number of samples to process.
1326 void arm_biquad_cascade_df1_f32(
1327 const arm_biquad_casd_df1_inst_f32
* S
,
1330 uint32_t blockSize
);
1334 * @brief Initialization function for the floating-point Biquad cascade filter.
1335 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
1336 * @param[in] numStages number of 2nd order stages in the filter.
1337 * @param[in] pCoeffs points to the filter coefficients.
1338 * @param[in] pState points to the state buffer.
1340 void arm_biquad_cascade_df1_init_f32(
1341 arm_biquad_casd_df1_inst_f32
* S
,
1343 float32_t
* pCoeffs
,
1344 float32_t
* pState
);
1348 * @brief Instance structure for the floating-point matrix structure.
1352 uint16_t numRows
; /**< number of rows of the matrix. */
1353 uint16_t numCols
; /**< number of columns of the matrix. */
1354 float32_t
*pData
; /**< points to the data of the matrix. */
1355 } arm_matrix_instance_f32
;
1359 * @brief Instance structure for the floating-point matrix structure.
1363 uint16_t numRows
; /**< number of rows of the matrix. */
1364 uint16_t numCols
; /**< number of columns of the matrix. */
1365 float64_t
*pData
; /**< points to the data of the matrix. */
1366 } arm_matrix_instance_f64
;
1369 * @brief Instance structure for the Q15 matrix structure.
1373 uint16_t numRows
; /**< number of rows of the matrix. */
1374 uint16_t numCols
; /**< number of columns of the matrix. */
1375 q15_t
*pData
; /**< points to the data of the matrix. */
1376 } arm_matrix_instance_q15
;
1379 * @brief Instance structure for the Q31 matrix structure.
1383 uint16_t numRows
; /**< number of rows of the matrix. */
1384 uint16_t numCols
; /**< number of columns of the matrix. */
1385 q31_t
*pData
; /**< points to the data of the matrix. */
1386 } arm_matrix_instance_q31
;
1390 * @brief Floating-point matrix addition.
1391 * @param[in] pSrcA points to the first input matrix structure
1392 * @param[in] pSrcB points to the second input matrix structure
1393 * @param[out] pDst points to output matrix structure
1394 * @return The function returns either
1395 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1397 arm_status
arm_mat_add_f32(
1398 const arm_matrix_instance_f32
* pSrcA
,
1399 const arm_matrix_instance_f32
* pSrcB
,
1400 arm_matrix_instance_f32
* pDst
);
1404 * @brief Q15 matrix addition.
1405 * @param[in] pSrcA points to the first input matrix structure
1406 * @param[in] pSrcB points to the second input matrix structure
1407 * @param[out] pDst points to output matrix structure
1408 * @return The function returns either
1409 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1411 arm_status
arm_mat_add_q15(
1412 const arm_matrix_instance_q15
* pSrcA
,
1413 const arm_matrix_instance_q15
* pSrcB
,
1414 arm_matrix_instance_q15
* pDst
);
1418 * @brief Q31 matrix addition.
1419 * @param[in] pSrcA points to the first input matrix structure
1420 * @param[in] pSrcB points to the second input matrix structure
1421 * @param[out] pDst points to output matrix structure
1422 * @return The function returns either
1423 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1425 arm_status
arm_mat_add_q31(
1426 const arm_matrix_instance_q31
* pSrcA
,
1427 const arm_matrix_instance_q31
* pSrcB
,
1428 arm_matrix_instance_q31
* pDst
);
1432 * @brief Floating-point, complex, matrix multiplication.
1433 * @param[in] pSrcA points to the first input matrix structure
1434 * @param[in] pSrcB points to the second input matrix structure
1435 * @param[out] pDst points to output matrix structure
1436 * @return The function returns either
1437 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1439 arm_status
arm_mat_cmplx_mult_f32(
1440 const arm_matrix_instance_f32
* pSrcA
,
1441 const arm_matrix_instance_f32
* pSrcB
,
1442 arm_matrix_instance_f32
* pDst
);
1446 * @brief Q15, complex, matrix multiplication.
1447 * @param[in] pSrcA points to the first input matrix structure
1448 * @param[in] pSrcB points to the second input matrix structure
1449 * @param[out] pDst points to output matrix structure
1450 * @return The function returns either
1451 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1453 arm_status
arm_mat_cmplx_mult_q15(
1454 const arm_matrix_instance_q15
* pSrcA
,
1455 const arm_matrix_instance_q15
* pSrcB
,
1456 arm_matrix_instance_q15
* pDst
,
1461 * @brief Q31, complex, matrix multiplication.
1462 * @param[in] pSrcA points to the first input matrix structure
1463 * @param[in] pSrcB points to the second input matrix structure
1464 * @param[out] pDst points to output matrix structure
1465 * @return The function returns either
1466 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1468 arm_status
arm_mat_cmplx_mult_q31(
1469 const arm_matrix_instance_q31
* pSrcA
,
1470 const arm_matrix_instance_q31
* pSrcB
,
1471 arm_matrix_instance_q31
* pDst
);
1475 * @brief Floating-point matrix transpose.
1476 * @param[in] pSrc points to the input matrix
1477 * @param[out] pDst points to the output matrix
1478 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1479 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1481 arm_status
arm_mat_trans_f32(
1482 const arm_matrix_instance_f32
* pSrc
,
1483 arm_matrix_instance_f32
* pDst
);
1487 * @brief Q15 matrix transpose.
1488 * @param[in] pSrc points to the input matrix
1489 * @param[out] pDst points to the output matrix
1490 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1491 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1493 arm_status
arm_mat_trans_q15(
1494 const arm_matrix_instance_q15
* pSrc
,
1495 arm_matrix_instance_q15
* pDst
);
1499 * @brief Q31 matrix transpose.
1500 * @param[in] pSrc points to the input matrix
1501 * @param[out] pDst points to the output matrix
1502 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1503 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1505 arm_status
arm_mat_trans_q31(
1506 const arm_matrix_instance_q31
* pSrc
,
1507 arm_matrix_instance_q31
* pDst
);
1511 * @brief Floating-point matrix multiplication
1512 * @param[in] pSrcA points to the first input matrix structure
1513 * @param[in] pSrcB points to the second input matrix structure
1514 * @param[out] pDst points to output matrix structure
1515 * @return The function returns either
1516 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1518 arm_status
arm_mat_mult_f32(
1519 const arm_matrix_instance_f32
* pSrcA
,
1520 const arm_matrix_instance_f32
* pSrcB
,
1521 arm_matrix_instance_f32
* pDst
);
1525 * @brief Q15 matrix multiplication
1526 * @param[in] pSrcA points to the first input matrix structure
1527 * @param[in] pSrcB points to the second input matrix structure
1528 * @param[out] pDst points to output matrix structure
1529 * @param[in] pState points to the array for storing intermediate results
1530 * @return The function returns either
1531 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1533 arm_status
arm_mat_mult_q15(
1534 const arm_matrix_instance_q15
* pSrcA
,
1535 const arm_matrix_instance_q15
* pSrcB
,
1536 arm_matrix_instance_q15
* pDst
,
1541 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1542 * @param[in] pSrcA points to the first input matrix structure
1543 * @param[in] pSrcB points to the second input matrix structure
1544 * @param[out] pDst points to output matrix structure
1545 * @param[in] pState points to the array for storing intermediate results
1546 * @return The function returns either
1547 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1549 arm_status
arm_mat_mult_fast_q15(
1550 const arm_matrix_instance_q15
* pSrcA
,
1551 const arm_matrix_instance_q15
* pSrcB
,
1552 arm_matrix_instance_q15
* pDst
,
1557 * @brief Q31 matrix multiplication
1558 * @param[in] pSrcA points to the first input matrix structure
1559 * @param[in] pSrcB points to the second input matrix structure
1560 * @param[out] pDst points to output matrix structure
1561 * @return The function returns either
1562 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1564 arm_status
arm_mat_mult_q31(
1565 const arm_matrix_instance_q31
* pSrcA
,
1566 const arm_matrix_instance_q31
* pSrcB
,
1567 arm_matrix_instance_q31
* pDst
);
1571 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1572 * @param[in] pSrcA points to the first input matrix structure
1573 * @param[in] pSrcB points to the second input matrix structure
1574 * @param[out] pDst points to output matrix structure
1575 * @return The function returns either
1576 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1578 arm_status
arm_mat_mult_fast_q31(
1579 const arm_matrix_instance_q31
* pSrcA
,
1580 const arm_matrix_instance_q31
* pSrcB
,
1581 arm_matrix_instance_q31
* pDst
);
1585 * @brief Floating-point matrix subtraction
1586 * @param[in] pSrcA points to the first input matrix structure
1587 * @param[in] pSrcB points to the second input matrix structure
1588 * @param[out] pDst points to output matrix structure
1589 * @return The function returns either
1590 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1592 arm_status
arm_mat_sub_f32(
1593 const arm_matrix_instance_f32
* pSrcA
,
1594 const arm_matrix_instance_f32
* pSrcB
,
1595 arm_matrix_instance_f32
* pDst
);
1599 * @brief Q15 matrix subtraction
1600 * @param[in] pSrcA points to the first input matrix structure
1601 * @param[in] pSrcB points to the second input matrix structure
1602 * @param[out] pDst points to output matrix structure
1603 * @return The function returns either
1604 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1606 arm_status
arm_mat_sub_q15(
1607 const arm_matrix_instance_q15
* pSrcA
,
1608 const arm_matrix_instance_q15
* pSrcB
,
1609 arm_matrix_instance_q15
* pDst
);
1613 * @brief Q31 matrix subtraction
1614 * @param[in] pSrcA points to the first input matrix structure
1615 * @param[in] pSrcB points to the second input matrix structure
1616 * @param[out] pDst points to output matrix structure
1617 * @return The function returns either
1618 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1620 arm_status
arm_mat_sub_q31(
1621 const arm_matrix_instance_q31
* pSrcA
,
1622 const arm_matrix_instance_q31
* pSrcB
,
1623 arm_matrix_instance_q31
* pDst
);
1627 * @brief Floating-point matrix scaling.
1628 * @param[in] pSrc points to the input matrix
1629 * @param[in] scale scale factor
1630 * @param[out] pDst points to the output matrix
1631 * @return The function returns either
1632 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1634 arm_status
arm_mat_scale_f32(
1635 const arm_matrix_instance_f32
* pSrc
,
1637 arm_matrix_instance_f32
* pDst
);
1641 * @brief Q15 matrix scaling.
1642 * @param[in] pSrc points to input matrix
1643 * @param[in] scaleFract fractional portion of the scale factor
1644 * @param[in] shift number of bits to shift the result by
1645 * @param[out] pDst points to output matrix
1646 * @return The function returns either
1647 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1649 arm_status
arm_mat_scale_q15(
1650 const arm_matrix_instance_q15
* pSrc
,
1653 arm_matrix_instance_q15
* pDst
);
1657 * @brief Q31 matrix scaling.
1658 * @param[in] pSrc points to input matrix
1659 * @param[in] scaleFract fractional portion of the scale factor
1660 * @param[in] shift number of bits to shift the result by
1661 * @param[out] pDst points to output matrix structure
1662 * @return The function returns either
1663 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1665 arm_status
arm_mat_scale_q31(
1666 const arm_matrix_instance_q31
* pSrc
,
1669 arm_matrix_instance_q31
* pDst
);
1673 * @brief Q31 matrix initialization.
1674 * @param[in,out] S points to an instance of the floating-point matrix structure.
1675 * @param[in] nRows number of rows in the matrix.
1676 * @param[in] nColumns number of columns in the matrix.
1677 * @param[in] pData points to the matrix data array.
1679 void arm_mat_init_q31(
1680 arm_matrix_instance_q31
* S
,
1687 * @brief Q15 matrix initialization.
1688 * @param[in,out] S points to an instance of the floating-point matrix structure.
1689 * @param[in] nRows number of rows in the matrix.
1690 * @param[in] nColumns number of columns in the matrix.
1691 * @param[in] pData points to the matrix data array.
1693 void arm_mat_init_q15(
1694 arm_matrix_instance_q15
* S
,
1701 * @brief Floating-point matrix initialization.
1702 * @param[in,out] S points to an instance of the floating-point matrix structure.
1703 * @param[in] nRows number of rows in the matrix.
1704 * @param[in] nColumns number of columns in the matrix.
1705 * @param[in] pData points to the matrix data array.
1707 void arm_mat_init_f32(
1708 arm_matrix_instance_f32
* S
,
1716 * @brief Instance structure for the Q15 PID Control.
1720 q15_t A0
; /**< The derived gain, A0 = Kp + Ki + Kd . */
1721 #if !defined (ARM_MATH_DSP)
1725 q31_t A1
; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
1727 q15_t state
[3]; /**< The state array of length 3. */
1728 q15_t Kp
; /**< The proportional gain. */
1729 q15_t Ki
; /**< The integral gain. */
1730 q15_t Kd
; /**< The derivative gain. */
1731 } arm_pid_instance_q15
;
1734 * @brief Instance structure for the Q31 PID Control.
1738 q31_t A0
; /**< The derived gain, A0 = Kp + Ki + Kd . */
1739 q31_t A1
; /**< The derived gain, A1 = -Kp - 2Kd. */
1740 q31_t A2
; /**< The derived gain, A2 = Kd . */
1741 q31_t state
[3]; /**< The state array of length 3. */
1742 q31_t Kp
; /**< The proportional gain. */
1743 q31_t Ki
; /**< The integral gain. */
1744 q31_t Kd
; /**< The derivative gain. */
1745 } arm_pid_instance_q31
;
1748 * @brief Instance structure for the floating-point PID Control.
1752 float32_t A0
; /**< The derived gain, A0 = Kp + Ki + Kd . */
1753 float32_t A1
; /**< The derived gain, A1 = -Kp - 2Kd. */
1754 float32_t A2
; /**< The derived gain, A2 = Kd . */
1755 float32_t state
[3]; /**< The state array of length 3. */
1756 float32_t Kp
; /**< The proportional gain. */
1757 float32_t Ki
; /**< The integral gain. */
1758 float32_t Kd
; /**< The derivative gain. */
1759 } arm_pid_instance_f32
;
1764 * @brief Initialization function for the floating-point PID Control.
1765 * @param[in,out] S points to an instance of the PID structure.
1766 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1768 void arm_pid_init_f32(
1769 arm_pid_instance_f32
* S
,
1770 int32_t resetStateFlag
);
1774 * @brief Reset function for the floating-point PID Control.
1775 * @param[in,out] S is an instance of the floating-point PID Control structure
1777 void arm_pid_reset_f32(
1778 arm_pid_instance_f32
* S
);
1782 * @brief Initialization function for the Q31 PID Control.
1783 * @param[in,out] S points to an instance of the Q15 PID structure.
1784 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1786 void arm_pid_init_q31(
1787 arm_pid_instance_q31
* S
,
1788 int32_t resetStateFlag
);
1792 * @brief Reset function for the Q31 PID Control.
1793 * @param[in,out] S points to an instance of the Q31 PID Control structure
1796 void arm_pid_reset_q31(
1797 arm_pid_instance_q31
* S
);
1801 * @brief Initialization function for the Q15 PID Control.
1802 * @param[in,out] S points to an instance of the Q15 PID structure.
1803 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1805 void arm_pid_init_q15(
1806 arm_pid_instance_q15
* S
,
1807 int32_t resetStateFlag
);
1811 * @brief Reset function for the Q15 PID Control.
1812 * @param[in,out] S points to an instance of the q15 PID Control structure
1814 void arm_pid_reset_q15(
1815 arm_pid_instance_q15
* S
);
1819 * @brief Instance structure for the floating-point Linear Interpolate function.
1823 uint32_t nValues
; /**< nValues */
1824 float32_t x1
; /**< x1 */
1825 float32_t xSpacing
; /**< xSpacing */
1826 float32_t
*pYData
; /**< pointer to the table of Y values */
1827 } arm_linear_interp_instance_f32
;
1830 * @brief Instance structure for the floating-point bilinear interpolation function.
1834 uint16_t numRows
; /**< number of rows in the data table. */
1835 uint16_t numCols
; /**< number of columns in the data table. */
1836 float32_t
*pData
; /**< points to the data table. */
1837 } arm_bilinear_interp_instance_f32
;
1840 * @brief Instance structure for the Q31 bilinear interpolation function.
1844 uint16_t numRows
; /**< number of rows in the data table. */
1845 uint16_t numCols
; /**< number of columns in the data table. */
1846 q31_t
*pData
; /**< points to the data table. */
1847 } arm_bilinear_interp_instance_q31
;
1850 * @brief Instance structure for the Q15 bilinear interpolation function.
1854 uint16_t numRows
; /**< number of rows in the data table. */
1855 uint16_t numCols
; /**< number of columns in the data table. */
1856 q15_t
*pData
; /**< points to the data table. */
1857 } arm_bilinear_interp_instance_q15
;
1860 * @brief Instance structure for the Q15 bilinear interpolation function.
1864 uint16_t numRows
; /**< number of rows in the data table. */
1865 uint16_t numCols
; /**< number of columns in the data table. */
1866 q7_t
*pData
; /**< points to the data table. */
1867 } arm_bilinear_interp_instance_q7
;
1871 * @brief Q7 vector multiplication.
1872 * @param[in] pSrcA points to the first input vector
1873 * @param[in] pSrcB points to the second input vector
1874 * @param[out] pDst points to the output vector
1875 * @param[in] blockSize number of samples in each vector
1881 uint32_t blockSize
);
1885 * @brief Q15 vector multiplication.
1886 * @param[in] pSrcA points to the first input vector
1887 * @param[in] pSrcB points to the second input vector
1888 * @param[out] pDst points to the output vector
1889 * @param[in] blockSize number of samples in each vector
1895 uint32_t blockSize
);
1899 * @brief Q31 vector multiplication.
1900 * @param[in] pSrcA points to the first input vector
1901 * @param[in] pSrcB points to the second input vector
1902 * @param[out] pDst points to the output vector
1903 * @param[in] blockSize number of samples in each vector
1909 uint32_t blockSize
);
1913 * @brief Floating-point vector multiplication.
1914 * @param[in] pSrcA points to the first input vector
1915 * @param[in] pSrcB points to the second input vector
1916 * @param[out] pDst points to the output vector
1917 * @param[in] blockSize number of samples in each vector
1923 uint32_t blockSize
);
1927 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1931 uint16_t fftLen
; /**< length of the FFT. */
1932 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1933 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1934 q15_t
*pTwiddle
; /**< points to the Sin twiddle factor table. */
1935 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
1936 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1937 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1938 } arm_cfft_radix2_instance_q15
;
1941 arm_status
arm_cfft_radix2_init_q15(
1942 arm_cfft_radix2_instance_q15
* S
,
1945 uint8_t bitReverseFlag
);
1948 void arm_cfft_radix2_q15(
1949 const arm_cfft_radix2_instance_q15
* S
,
1954 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1958 uint16_t fftLen
; /**< length of the FFT. */
1959 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1960 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1961 q15_t
*pTwiddle
; /**< points to the twiddle factor table. */
1962 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
1963 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1964 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1965 } arm_cfft_radix4_instance_q15
;
1968 arm_status
arm_cfft_radix4_init_q15(
1969 arm_cfft_radix4_instance_q15
* S
,
1972 uint8_t bitReverseFlag
);
1975 void arm_cfft_radix4_q15(
1976 const arm_cfft_radix4_instance_q15
* S
,
1980 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
1984 uint16_t fftLen
; /**< length of the FFT. */
1985 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1986 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1987 q31_t
*pTwiddle
; /**< points to the Twiddle factor table. */
1988 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
1989 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1990 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1991 } arm_cfft_radix2_instance_q31
;
1994 arm_status
arm_cfft_radix2_init_q31(
1995 arm_cfft_radix2_instance_q31
* S
,
1998 uint8_t bitReverseFlag
);
2001 void arm_cfft_radix2_q31(
2002 const arm_cfft_radix2_instance_q31
* S
,
2006 * @brief Instance structure for the Q31 CFFT/CIFFT function.
2010 uint16_t fftLen
; /**< length of the FFT. */
2011 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2012 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2013 q31_t
*pTwiddle
; /**< points to the twiddle factor table. */
2014 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2015 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2016 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2017 } arm_cfft_radix4_instance_q31
;
2020 void arm_cfft_radix4_q31(
2021 const arm_cfft_radix4_instance_q31
* S
,
2025 arm_status
arm_cfft_radix4_init_q31(
2026 arm_cfft_radix4_instance_q31
* S
,
2029 uint8_t bitReverseFlag
);
2032 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2036 uint16_t fftLen
; /**< length of the FFT. */
2037 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2038 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2039 float32_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2040 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2041 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2042 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2043 float32_t onebyfftLen
; /**< value of 1/fftLen. */
2044 } arm_cfft_radix2_instance_f32
;
2047 arm_status
arm_cfft_radix2_init_f32(
2048 arm_cfft_radix2_instance_f32
* S
,
2051 uint8_t bitReverseFlag
);
2054 void arm_cfft_radix2_f32(
2055 const arm_cfft_radix2_instance_f32
* S
,
2059 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2063 uint16_t fftLen
; /**< length of the FFT. */
2064 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2065 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2066 float32_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2067 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2068 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2069 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2070 float32_t onebyfftLen
; /**< value of 1/fftLen. */
2071 } arm_cfft_radix4_instance_f32
;
2074 arm_status
arm_cfft_radix4_init_f32(
2075 arm_cfft_radix4_instance_f32
* S
,
2078 uint8_t bitReverseFlag
);
2081 void arm_cfft_radix4_f32(
2082 const arm_cfft_radix4_instance_f32
* S
,
2086 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2090 uint16_t fftLen
; /**< length of the FFT. */
2091 const q15_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2092 const uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2093 uint16_t bitRevLength
; /**< bit reversal table length. */
2094 } arm_cfft_instance_q15
;
2097 const arm_cfft_instance_q15
* S
,
2100 uint8_t bitReverseFlag
);
2103 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2107 uint16_t fftLen
; /**< length of the FFT. */
2108 const q31_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2109 const uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2110 uint16_t bitRevLength
; /**< bit reversal table length. */
2111 } arm_cfft_instance_q31
;
2114 const arm_cfft_instance_q31
* S
,
2117 uint8_t bitReverseFlag
);
2120 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2124 uint16_t fftLen
; /**< length of the FFT. */
2125 const float32_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2126 const uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2127 uint16_t bitRevLength
; /**< bit reversal table length. */
2128 } arm_cfft_instance_f32
;
2131 const arm_cfft_instance_f32
* S
,
2134 uint8_t bitReverseFlag
);
2137 * @brief Instance structure for the Q15 RFFT/RIFFT function.
2141 uint32_t fftLenReal
; /**< length of the real FFT. */
2142 uint8_t ifftFlagR
; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2143 uint8_t bitReverseFlagR
; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2144 uint32_t twidCoefRModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2145 q15_t
*pTwiddleAReal
; /**< points to the real twiddle factor table. */
2146 q15_t
*pTwiddleBReal
; /**< points to the imag twiddle factor table. */
2147 const arm_cfft_instance_q15
*pCfft
; /**< points to the complex FFT instance. */
2148 } arm_rfft_instance_q15
;
2150 arm_status
arm_rfft_init_q15(
2151 arm_rfft_instance_q15
* S
,
2152 uint32_t fftLenReal
,
2154 uint32_t bitReverseFlag
);
2157 const arm_rfft_instance_q15
* S
,
2162 * @brief Instance structure for the Q31 RFFT/RIFFT function.
2166 uint32_t fftLenReal
; /**< length of the real FFT. */
2167 uint8_t ifftFlagR
; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2168 uint8_t bitReverseFlagR
; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2169 uint32_t twidCoefRModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2170 q31_t
*pTwiddleAReal
; /**< points to the real twiddle factor table. */
2171 q31_t
*pTwiddleBReal
; /**< points to the imag twiddle factor table. */
2172 const arm_cfft_instance_q31
*pCfft
; /**< points to the complex FFT instance. */
2173 } arm_rfft_instance_q31
;
2175 arm_status
arm_rfft_init_q31(
2176 arm_rfft_instance_q31
* S
,
2177 uint32_t fftLenReal
,
2179 uint32_t bitReverseFlag
);
2182 const arm_rfft_instance_q31
* S
,
2187 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2191 uint32_t fftLenReal
; /**< length of the real FFT. */
2192 uint16_t fftLenBy2
; /**< length of the complex FFT. */
2193 uint8_t ifftFlagR
; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2194 uint8_t bitReverseFlagR
; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2195 uint32_t twidCoefRModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2196 float32_t
*pTwiddleAReal
; /**< points to the real twiddle factor table. */
2197 float32_t
*pTwiddleBReal
; /**< points to the imag twiddle factor table. */
2198 arm_cfft_radix4_instance_f32
*pCfft
; /**< points to the complex FFT instance. */
2199 } arm_rfft_instance_f32
;
2201 arm_status
arm_rfft_init_f32(
2202 arm_rfft_instance_f32
* S
,
2203 arm_cfft_radix4_instance_f32
* S_CFFT
,
2204 uint32_t fftLenReal
,
2206 uint32_t bitReverseFlag
);
2209 const arm_rfft_instance_f32
* S
,
2214 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2218 arm_cfft_instance_f32 Sint
; /**< Internal CFFT structure. */
2219 uint16_t fftLenRFFT
; /**< length of the real sequence */
2220 float32_t
* pTwiddleRFFT
; /**< Twiddle factors real stage */
2221 } arm_rfft_fast_instance_f32
;
2223 arm_status
arm_rfft_fast_init_f32 (
2224 arm_rfft_fast_instance_f32
* S
,
2227 void arm_rfft_fast_f32(
2228 arm_rfft_fast_instance_f32
* S
,
2229 float32_t
* p
, float32_t
* pOut
,
2233 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
2237 uint16_t N
; /**< length of the DCT4. */
2238 uint16_t Nby2
; /**< half of the length of the DCT4. */
2239 float32_t normalize
; /**< normalizing factor. */
2240 float32_t
*pTwiddle
; /**< points to the twiddle factor table. */
2241 float32_t
*pCosFactor
; /**< points to the cosFactor table. */
2242 arm_rfft_instance_f32
*pRfft
; /**< points to the real FFT instance. */
2243 arm_cfft_radix4_instance_f32
*pCfft
; /**< points to the complex FFT instance. */
2244 } arm_dct4_instance_f32
;
2248 * @brief Initialization function for the floating-point DCT4/IDCT4.
2249 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
2250 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
2251 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
2252 * @param[in] N length of the DCT4.
2253 * @param[in] Nby2 half of the length of the DCT4.
2254 * @param[in] normalize normalizing factor.
2255 * @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.
2257 arm_status
arm_dct4_init_f32(
2258 arm_dct4_instance_f32
* S
,
2259 arm_rfft_instance_f32
* S_RFFT
,
2260 arm_cfft_radix4_instance_f32
* S_CFFT
,
2263 float32_t normalize
);
2267 * @brief Processing function for the floating-point DCT4/IDCT4.
2268 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
2269 * @param[in] pState points to state buffer.
2270 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2273 const arm_dct4_instance_f32
* S
,
2275 float32_t
* pInlineBuffer
);
2279 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
2283 uint16_t N
; /**< length of the DCT4. */
2284 uint16_t Nby2
; /**< half of the length of the DCT4. */
2285 q31_t normalize
; /**< normalizing factor. */
2286 q31_t
*pTwiddle
; /**< points to the twiddle factor table. */
2287 q31_t
*pCosFactor
; /**< points to the cosFactor table. */
2288 arm_rfft_instance_q31
*pRfft
; /**< points to the real FFT instance. */
2289 arm_cfft_radix4_instance_q31
*pCfft
; /**< points to the complex FFT instance. */
2290 } arm_dct4_instance_q31
;
2294 * @brief Initialization function for the Q31 DCT4/IDCT4.
2295 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
2296 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
2297 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
2298 * @param[in] N length of the DCT4.
2299 * @param[in] Nby2 half of the length of the DCT4.
2300 * @param[in] normalize normalizing factor.
2301 * @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.
2303 arm_status
arm_dct4_init_q31(
2304 arm_dct4_instance_q31
* S
,
2305 arm_rfft_instance_q31
* S_RFFT
,
2306 arm_cfft_radix4_instance_q31
* S_CFFT
,
2313 * @brief Processing function for the Q31 DCT4/IDCT4.
2314 * @param[in] S points to an instance of the Q31 DCT4 structure.
2315 * @param[in] pState points to state buffer.
2316 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2319 const arm_dct4_instance_q31
* S
,
2321 q31_t
* pInlineBuffer
);
2325 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
2329 uint16_t N
; /**< length of the DCT4. */
2330 uint16_t Nby2
; /**< half of the length of the DCT4. */
2331 q15_t normalize
; /**< normalizing factor. */
2332 q15_t
*pTwiddle
; /**< points to the twiddle factor table. */
2333 q15_t
*pCosFactor
; /**< points to the cosFactor table. */
2334 arm_rfft_instance_q15
*pRfft
; /**< points to the real FFT instance. */
2335 arm_cfft_radix4_instance_q15
*pCfft
; /**< points to the complex FFT instance. */
2336 } arm_dct4_instance_q15
;
2340 * @brief Initialization function for the Q15 DCT4/IDCT4.
2341 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
2342 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
2343 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
2344 * @param[in] N length of the DCT4.
2345 * @param[in] Nby2 half of the length of the DCT4.
2346 * @param[in] normalize normalizing factor.
2347 * @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.
2349 arm_status
arm_dct4_init_q15(
2350 arm_dct4_instance_q15
* S
,
2351 arm_rfft_instance_q15
* S_RFFT
,
2352 arm_cfft_radix4_instance_q15
* S_CFFT
,
2359 * @brief Processing function for the Q15 DCT4/IDCT4.
2360 * @param[in] S points to an instance of the Q15 DCT4 structure.
2361 * @param[in] pState points to state buffer.
2362 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2365 const arm_dct4_instance_q15
* S
,
2367 q15_t
* pInlineBuffer
);
2371 * @brief Floating-point vector addition.
2372 * @param[in] pSrcA points to the first input vector
2373 * @param[in] pSrcB points to the second input vector
2374 * @param[out] pDst points to the output vector
2375 * @param[in] blockSize number of samples in each vector
2381 uint32_t blockSize
);
2385 * @brief Q7 vector addition.
2386 * @param[in] pSrcA points to the first input vector
2387 * @param[in] pSrcB points to the second input vector
2388 * @param[out] pDst points to the output vector
2389 * @param[in] blockSize number of samples in each vector
2395 uint32_t blockSize
);
2399 * @brief Q15 vector addition.
2400 * @param[in] pSrcA points to the first input vector
2401 * @param[in] pSrcB points to the second input vector
2402 * @param[out] pDst points to the output vector
2403 * @param[in] blockSize number of samples in each vector
2409 uint32_t blockSize
);
2413 * @brief Q31 vector addition.
2414 * @param[in] pSrcA points to the first input vector
2415 * @param[in] pSrcB points to the second input vector
2416 * @param[out] pDst points to the output vector
2417 * @param[in] blockSize number of samples in each vector
2423 uint32_t blockSize
);
2427 * @brief Floating-point vector subtraction.
2428 * @param[in] pSrcA points to the first input vector
2429 * @param[in] pSrcB points to the second input vector
2430 * @param[out] pDst points to the output vector
2431 * @param[in] blockSize number of samples in each vector
2437 uint32_t blockSize
);
2441 * @brief Q7 vector subtraction.
2442 * @param[in] pSrcA points to the first input vector
2443 * @param[in] pSrcB points to the second input vector
2444 * @param[out] pDst points to the output vector
2445 * @param[in] blockSize number of samples in each vector
2451 uint32_t blockSize
);
2455 * @brief Q15 vector subtraction.
2456 * @param[in] pSrcA points to the first input vector
2457 * @param[in] pSrcB points to the second input vector
2458 * @param[out] pDst points to the output vector
2459 * @param[in] blockSize number of samples in each vector
2465 uint32_t blockSize
);
2469 * @brief Q31 vector subtraction.
2470 * @param[in] pSrcA points to the first input vector
2471 * @param[in] pSrcB points to the second input vector
2472 * @param[out] pDst points to the output vector
2473 * @param[in] blockSize number of samples in each vector
2479 uint32_t blockSize
);
2483 * @brief Multiplies a floating-point vector by a scalar.
2484 * @param[in] pSrc points to the input vector
2485 * @param[in] scale scale factor to be applied
2486 * @param[out] pDst points to the output vector
2487 * @param[in] blockSize number of samples in the vector
2493 uint32_t blockSize
);
2497 * @brief Multiplies a Q7 vector by a scalar.
2498 * @param[in] pSrc points to the input vector
2499 * @param[in] scaleFract fractional portion of the scale value
2500 * @param[in] shift number of bits to shift the result by
2501 * @param[out] pDst points to the output vector
2502 * @param[in] blockSize number of samples in the vector
2509 uint32_t blockSize
);
2513 * @brief Multiplies a Q15 vector by a scalar.
2514 * @param[in] pSrc points to the input vector
2515 * @param[in] scaleFract fractional portion of the scale value
2516 * @param[in] shift number of bits to shift the result by
2517 * @param[out] pDst points to the output vector
2518 * @param[in] blockSize number of samples in the vector
2525 uint32_t blockSize
);
2529 * @brief Multiplies a Q31 vector by a scalar.
2530 * @param[in] pSrc points to the input vector
2531 * @param[in] scaleFract fractional portion of the scale value
2532 * @param[in] shift number of bits to shift the result by
2533 * @param[out] pDst points to the output vector
2534 * @param[in] blockSize number of samples in the vector
2541 uint32_t blockSize
);
2545 * @brief Q7 vector absolute value.
2546 * @param[in] pSrc points to the input buffer
2547 * @param[out] pDst points to the output buffer
2548 * @param[in] blockSize number of samples in each vector
2553 uint32_t blockSize
);
2557 * @brief Floating-point vector absolute value.
2558 * @param[in] pSrc points to the input buffer
2559 * @param[out] pDst points to the output buffer
2560 * @param[in] blockSize number of samples in each vector
2565 uint32_t blockSize
);
2569 * @brief Q15 vector absolute value.
2570 * @param[in] pSrc points to the input buffer
2571 * @param[out] pDst points to the output buffer
2572 * @param[in] blockSize number of samples in each vector
2577 uint32_t blockSize
);
2581 * @brief Q31 vector absolute value.
2582 * @param[in] pSrc points to the input buffer
2583 * @param[out] pDst points to the output buffer
2584 * @param[in] blockSize number of samples in each vector
2589 uint32_t blockSize
);
2593 * @brief Dot product of floating-point vectors.
2594 * @param[in] pSrcA points to the first input vector
2595 * @param[in] pSrcB points to the second input vector
2596 * @param[in] blockSize number of samples in each vector
2597 * @param[out] result output result returned here
2599 void arm_dot_prod_f32(
2603 float32_t
* result
);
2607 * @brief Dot product of Q7 vectors.
2608 * @param[in] pSrcA points to the first input vector
2609 * @param[in] pSrcB points to the second input vector
2610 * @param[in] blockSize number of samples in each vector
2611 * @param[out] result output result returned here
2613 void arm_dot_prod_q7(
2621 * @brief Dot product of Q15 vectors.
2622 * @param[in] pSrcA points to the first input vector
2623 * @param[in] pSrcB points to the second input vector
2624 * @param[in] blockSize number of samples in each vector
2625 * @param[out] result output result returned here
2627 void arm_dot_prod_q15(
2635 * @brief Dot product of Q31 vectors.
2636 * @param[in] pSrcA points to the first input vector
2637 * @param[in] pSrcB points to the second input vector
2638 * @param[in] blockSize number of samples in each vector
2639 * @param[out] result output result returned here
2641 void arm_dot_prod_q31(
2649 * @brief Shifts the elements of a Q7 vector a specified number of bits.
2650 * @param[in] pSrc points to the input vector
2651 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2652 * @param[out] pDst points to the output vector
2653 * @param[in] blockSize number of samples in the vector
2659 uint32_t blockSize
);
2663 * @brief Shifts the elements of a Q15 vector a specified number of bits.
2664 * @param[in] pSrc points to the input vector
2665 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2666 * @param[out] pDst points to the output vector
2667 * @param[in] blockSize number of samples in the vector
2673 uint32_t blockSize
);
2677 * @brief Shifts the elements of a Q31 vector a specified number of bits.
2678 * @param[in] pSrc points to the input vector
2679 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2680 * @param[out] pDst points to the output vector
2681 * @param[in] blockSize number of samples in the vector
2687 uint32_t blockSize
);
2691 * @brief Adds a constant offset to a floating-point vector.
2692 * @param[in] pSrc points to the input vector
2693 * @param[in] offset is the offset to be added
2694 * @param[out] pDst points to the output vector
2695 * @param[in] blockSize number of samples in the vector
2697 void arm_offset_f32(
2701 uint32_t blockSize
);
2705 * @brief Adds a constant offset to a Q7 vector.
2706 * @param[in] pSrc points to the input vector
2707 * @param[in] offset is the offset to be added
2708 * @param[out] pDst points to the output vector
2709 * @param[in] blockSize number of samples in the vector
2715 uint32_t blockSize
);
2719 * @brief Adds a constant offset to a Q15 vector.
2720 * @param[in] pSrc points to the input vector
2721 * @param[in] offset is the offset to be added
2722 * @param[out] pDst points to the output vector
2723 * @param[in] blockSize number of samples in the vector
2725 void arm_offset_q15(
2729 uint32_t blockSize
);
2733 * @brief Adds a constant offset to a Q31 vector.
2734 * @param[in] pSrc points to the input vector
2735 * @param[in] offset is the offset to be added
2736 * @param[out] pDst points to the output vector
2737 * @param[in] blockSize number of samples in the vector
2739 void arm_offset_q31(
2743 uint32_t blockSize
);
2747 * @brief Negates the elements of a floating-point vector.
2748 * @param[in] pSrc points to the input vector
2749 * @param[out] pDst points to the output vector
2750 * @param[in] blockSize number of samples in the vector
2752 void arm_negate_f32(
2755 uint32_t blockSize
);
2759 * @brief Negates the elements of a Q7 vector.
2760 * @param[in] pSrc points to the input vector
2761 * @param[out] pDst points to the output vector
2762 * @param[in] blockSize number of samples in the vector
2767 uint32_t blockSize
);
2771 * @brief Negates the elements of a Q15 vector.
2772 * @param[in] pSrc points to the input vector
2773 * @param[out] pDst points to the output vector
2774 * @param[in] blockSize number of samples in the vector
2776 void arm_negate_q15(
2779 uint32_t blockSize
);
2783 * @brief Negates the elements of a Q31 vector.
2784 * @param[in] pSrc points to the input vector
2785 * @param[out] pDst points to the output vector
2786 * @param[in] blockSize number of samples in the vector
2788 void arm_negate_q31(
2791 uint32_t blockSize
);
2795 * @brief Copies the elements of a floating-point vector.
2796 * @param[in] pSrc input pointer
2797 * @param[out] pDst output pointer
2798 * @param[in] blockSize number of samples to process
2803 uint32_t blockSize
);
2807 * @brief Copies the elements of a Q7 vector.
2808 * @param[in] pSrc input pointer
2809 * @param[out] pDst output pointer
2810 * @param[in] blockSize number of samples to process
2815 uint32_t blockSize
);
2819 * @brief Copies the elements of a Q15 vector.
2820 * @param[in] pSrc input pointer
2821 * @param[out] pDst output pointer
2822 * @param[in] blockSize number of samples to process
2827 uint32_t blockSize
);
2831 * @brief Copies the elements of a Q31 vector.
2832 * @param[in] pSrc input pointer
2833 * @param[out] pDst output pointer
2834 * @param[in] blockSize number of samples to process
2839 uint32_t blockSize
);
2843 * @brief Fills a constant value into a floating-point vector.
2844 * @param[in] value input value to be filled
2845 * @param[out] pDst output pointer
2846 * @param[in] blockSize number of samples to process
2851 uint32_t blockSize
);
2855 * @brief Fills a constant value into a Q7 vector.
2856 * @param[in] value input value to be filled
2857 * @param[out] pDst output pointer
2858 * @param[in] blockSize number of samples to process
2863 uint32_t blockSize
);
2867 * @brief Fills a constant value into a Q15 vector.
2868 * @param[in] value input value to be filled
2869 * @param[out] pDst output pointer
2870 * @param[in] blockSize number of samples to process
2875 uint32_t blockSize
);
2879 * @brief Fills a constant value into a Q31 vector.
2880 * @param[in] value input value to be filled
2881 * @param[out] pDst output pointer
2882 * @param[in] blockSize number of samples to process
2887 uint32_t blockSize
);
2891 * @brief Convolution of floating-point sequences.
2892 * @param[in] pSrcA points to the first input sequence.
2893 * @param[in] srcALen length of the first input sequence.
2894 * @param[in] pSrcB points to the second input sequence.
2895 * @param[in] srcBLen length of the second input sequence.
2896 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2907 * @brief Convolution of Q15 sequences.
2908 * @param[in] pSrcA points to the first input sequence.
2909 * @param[in] srcALen length of the first input sequence.
2910 * @param[in] pSrcB points to the second input sequence.
2911 * @param[in] srcBLen length of the second input sequence.
2912 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2913 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
2914 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
2916 void arm_conv_opt_q15(
2927 * @brief Convolution of Q15 sequences.
2928 * @param[in] pSrcA points to the first input sequence.
2929 * @param[in] srcALen length of the first input sequence.
2930 * @param[in] pSrcB points to the second input sequence.
2931 * @param[in] srcBLen length of the second input sequence.
2932 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2943 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
2944 * @param[in] pSrcA points to the first input sequence.
2945 * @param[in] srcALen length of the first input sequence.
2946 * @param[in] pSrcB points to the second input sequence.
2947 * @param[in] srcBLen length of the second input sequence.
2948 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2950 void arm_conv_fast_q15(
2959 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
2960 * @param[in] pSrcA points to the first input sequence.
2961 * @param[in] srcALen length of the first input sequence.
2962 * @param[in] pSrcB points to the second input sequence.
2963 * @param[in] srcBLen length of the second input sequence.
2964 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2965 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
2966 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
2968 void arm_conv_fast_opt_q15(
2979 * @brief Convolution of Q31 sequences.
2980 * @param[in] pSrcA points to the first input sequence.
2981 * @param[in] srcALen length of the first input sequence.
2982 * @param[in] pSrcB points to the second input sequence.
2983 * @param[in] srcBLen length of the second input sequence.
2984 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2995 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
2996 * @param[in] pSrcA points to the first input sequence.
2997 * @param[in] srcALen length of the first input sequence.
2998 * @param[in] pSrcB points to the second input sequence.
2999 * @param[in] srcBLen length of the second input sequence.
3000 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3002 void arm_conv_fast_q31(
3011 * @brief Convolution of Q7 sequences.
3012 * @param[in] pSrcA points to the first input sequence.
3013 * @param[in] srcALen length of the first input sequence.
3014 * @param[in] pSrcB points to the second input sequence.
3015 * @param[in] srcBLen length of the second input sequence.
3016 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3017 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3018 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3020 void arm_conv_opt_q7(
3031 * @brief Convolution of Q7 sequences.
3032 * @param[in] pSrcA points to the first input sequence.
3033 * @param[in] srcALen length of the first input sequence.
3034 * @param[in] pSrcB points to the second input sequence.
3035 * @param[in] srcBLen length of the second input sequence.
3036 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3047 * @brief Partial convolution of floating-point sequences.
3048 * @param[in] pSrcA points to the first input sequence.
3049 * @param[in] srcALen length of the first input sequence.
3050 * @param[in] pSrcB points to the second input sequence.
3051 * @param[in] srcBLen length of the second input sequence.
3052 * @param[out] pDst points to the block of output data
3053 * @param[in] firstIndex is the first output sample to start with.
3054 * @param[in] numPoints is the number of output points to be computed.
3055 * @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].
3057 arm_status
arm_conv_partial_f32(
3063 uint32_t firstIndex
,
3064 uint32_t numPoints
);
3068 * @brief Partial convolution of Q15 sequences.
3069 * @param[in] pSrcA points to the first input sequence.
3070 * @param[in] srcALen length of the first input sequence.
3071 * @param[in] pSrcB points to the second input sequence.
3072 * @param[in] srcBLen length of the second input sequence.
3073 * @param[out] pDst points to the block of output data
3074 * @param[in] firstIndex is the first output sample to start with.
3075 * @param[in] numPoints is the number of output points to be computed.
3076 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3077 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3078 * @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].
3080 arm_status
arm_conv_partial_opt_q15(
3086 uint32_t firstIndex
,
3093 * @brief Partial convolution of Q15 sequences.
3094 * @param[in] pSrcA points to the first input sequence.
3095 * @param[in] srcALen length of the first input sequence.
3096 * @param[in] pSrcB points to the second input sequence.
3097 * @param[in] srcBLen length of the second input sequence.
3098 * @param[out] pDst points to the block of output data
3099 * @param[in] firstIndex is the first output sample to start with.
3100 * @param[in] numPoints is the number of output points to be computed.
3101 * @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].
3103 arm_status
arm_conv_partial_q15(
3109 uint32_t firstIndex
,
3110 uint32_t numPoints
);
3114 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3115 * @param[in] pSrcA points to the first input sequence.
3116 * @param[in] srcALen length of the first input sequence.
3117 * @param[in] pSrcB points to the second input sequence.
3118 * @param[in] srcBLen length of the second input sequence.
3119 * @param[out] pDst points to the block of output data
3120 * @param[in] firstIndex is the first output sample to start with.
3121 * @param[in] numPoints is the number of output points to be computed.
3122 * @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].
3124 arm_status
arm_conv_partial_fast_q15(
3130 uint32_t firstIndex
,
3131 uint32_t numPoints
);
3135 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3136 * @param[in] pSrcA points to the first input sequence.
3137 * @param[in] srcALen length of the first input sequence.
3138 * @param[in] pSrcB points to the second input sequence.
3139 * @param[in] srcBLen length of the second input sequence.
3140 * @param[out] pDst points to the block of output data
3141 * @param[in] firstIndex is the first output sample to start with.
3142 * @param[in] numPoints is the number of output points to be computed.
3143 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3144 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3145 * @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].
3147 arm_status
arm_conv_partial_fast_opt_q15(
3153 uint32_t firstIndex
,
3160 * @brief Partial convolution of Q31 sequences.
3161 * @param[in] pSrcA points to the first input sequence.
3162 * @param[in] srcALen length of the first input sequence.
3163 * @param[in] pSrcB points to the second input sequence.
3164 * @param[in] srcBLen length of the second input sequence.
3165 * @param[out] pDst points to the block of output data
3166 * @param[in] firstIndex is the first output sample to start with.
3167 * @param[in] numPoints is the number of output points to be computed.
3168 * @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].
3170 arm_status
arm_conv_partial_q31(
3176 uint32_t firstIndex
,
3177 uint32_t numPoints
);
3181 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3182 * @param[in] pSrcA points to the first input sequence.
3183 * @param[in] srcALen length of the first input sequence.
3184 * @param[in] pSrcB points to the second input sequence.
3185 * @param[in] srcBLen length of the second input sequence.
3186 * @param[out] pDst points to the block of output data
3187 * @param[in] firstIndex is the first output sample to start with.
3188 * @param[in] numPoints is the number of output points to be computed.
3189 * @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].
3191 arm_status
arm_conv_partial_fast_q31(
3197 uint32_t firstIndex
,
3198 uint32_t numPoints
);
3202 * @brief Partial convolution of Q7 sequences
3203 * @param[in] pSrcA points to the first input sequence.
3204 * @param[in] srcALen length of the first input sequence.
3205 * @param[in] pSrcB points to the second input sequence.
3206 * @param[in] srcBLen length of the second input sequence.
3207 * @param[out] pDst points to the block of output data
3208 * @param[in] firstIndex is the first output sample to start with.
3209 * @param[in] numPoints is the number of output points to be computed.
3210 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3211 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3212 * @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].
3214 arm_status
arm_conv_partial_opt_q7(
3220 uint32_t firstIndex
,
3227 * @brief Partial convolution of Q7 sequences.
3228 * @param[in] pSrcA points to the first input sequence.
3229 * @param[in] srcALen length of the first input sequence.
3230 * @param[in] pSrcB points to the second input sequence.
3231 * @param[in] srcBLen length of the second input sequence.
3232 * @param[out] pDst points to the block of output data
3233 * @param[in] firstIndex is the first output sample to start with.
3234 * @param[in] numPoints is the number of output points to be computed.
3235 * @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].
3237 arm_status
arm_conv_partial_q7(
3243 uint32_t firstIndex
,
3244 uint32_t numPoints
);
3248 * @brief Instance structure for the Q15 FIR decimator.
3252 uint8_t M
; /**< decimation factor. */
3253 uint16_t numTaps
; /**< number of coefficients in the filter. */
3254 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
3255 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3256 } arm_fir_decimate_instance_q15
;
3259 * @brief Instance structure for the Q31 FIR decimator.
3263 uint8_t M
; /**< decimation factor. */
3264 uint16_t numTaps
; /**< number of coefficients in the filter. */
3265 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
3266 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3267 } arm_fir_decimate_instance_q31
;
3270 * @brief Instance structure for the floating-point FIR decimator.
3274 uint8_t M
; /**< decimation factor. */
3275 uint16_t numTaps
; /**< number of coefficients in the filter. */
3276 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
3277 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3278 } arm_fir_decimate_instance_f32
;
3282 * @brief Processing function for the floating-point FIR decimator.
3283 * @param[in] S points to an instance of the floating-point FIR decimator structure.
3284 * @param[in] pSrc points to the block of input data.
3285 * @param[out] pDst points to the block of output data
3286 * @param[in] blockSize number of input samples to process per call.
3288 void arm_fir_decimate_f32(
3289 const arm_fir_decimate_instance_f32
* S
,
3292 uint32_t blockSize
);
3296 * @brief Initialization function for the floating-point FIR decimator.
3297 * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
3298 * @param[in] numTaps number of coefficients in the filter.
3299 * @param[in] M decimation factor.
3300 * @param[in] pCoeffs points to the filter coefficients.
3301 * @param[in] pState points to the state buffer.
3302 * @param[in] blockSize number of input samples to process per call.
3303 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3304 * <code>blockSize</code> is not a multiple of <code>M</code>.
3306 arm_status
arm_fir_decimate_init_f32(
3307 arm_fir_decimate_instance_f32
* S
,
3310 float32_t
* pCoeffs
,
3312 uint32_t blockSize
);
3316 * @brief Processing function for the Q15 FIR decimator.
3317 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3318 * @param[in] pSrc points to the block of input data.
3319 * @param[out] pDst points to the block of output data
3320 * @param[in] blockSize number of input samples to process per call.
3322 void arm_fir_decimate_q15(
3323 const arm_fir_decimate_instance_q15
* S
,
3326 uint32_t blockSize
);
3330 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3331 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3332 * @param[in] pSrc points to the block of input data.
3333 * @param[out] pDst points to the block of output data
3334 * @param[in] blockSize number of input samples to process per call.
3336 void arm_fir_decimate_fast_q15(
3337 const arm_fir_decimate_instance_q15
* S
,
3340 uint32_t blockSize
);
3344 * @brief Initialization function for the Q15 FIR decimator.
3345 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
3346 * @param[in] numTaps number of coefficients in the filter.
3347 * @param[in] M decimation factor.
3348 * @param[in] pCoeffs points to the filter coefficients.
3349 * @param[in] pState points to the state buffer.
3350 * @param[in] blockSize number of input samples to process per call.
3351 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3352 * <code>blockSize</code> is not a multiple of <code>M</code>.
3354 arm_status
arm_fir_decimate_init_q15(
3355 arm_fir_decimate_instance_q15
* S
,
3360 uint32_t blockSize
);
3364 * @brief Processing function for the Q31 FIR decimator.
3365 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3366 * @param[in] pSrc points to the block of input data.
3367 * @param[out] pDst points to the block of output data
3368 * @param[in] blockSize number of input samples to process per call.
3370 void arm_fir_decimate_q31(
3371 const arm_fir_decimate_instance_q31
* S
,
3374 uint32_t blockSize
);
3377 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3378 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3379 * @param[in] pSrc points to the block of input data.
3380 * @param[out] pDst points to the block of output data
3381 * @param[in] blockSize number of input samples to process per call.
3383 void arm_fir_decimate_fast_q31(
3384 arm_fir_decimate_instance_q31
* S
,
3387 uint32_t blockSize
);
3391 * @brief Initialization function for the Q31 FIR decimator.
3392 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
3393 * @param[in] numTaps number of coefficients in the filter.
3394 * @param[in] M decimation factor.
3395 * @param[in] pCoeffs points to the filter coefficients.
3396 * @param[in] pState points to the state buffer.
3397 * @param[in] blockSize number of input samples to process per call.
3398 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3399 * <code>blockSize</code> is not a multiple of <code>M</code>.
3401 arm_status
arm_fir_decimate_init_q31(
3402 arm_fir_decimate_instance_q31
* S
,
3407 uint32_t blockSize
);
3411 * @brief Instance structure for the Q15 FIR interpolator.
3415 uint8_t L
; /**< upsample factor. */
3416 uint16_t phaseLength
; /**< length of each polyphase filter component. */
3417 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length L*phaseLength. */
3418 q15_t
*pState
; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3419 } arm_fir_interpolate_instance_q15
;
3422 * @brief Instance structure for the Q31 FIR interpolator.
3426 uint8_t L
; /**< upsample factor. */
3427 uint16_t phaseLength
; /**< length of each polyphase filter component. */
3428 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length L*phaseLength. */
3429 q31_t
*pState
; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3430 } arm_fir_interpolate_instance_q31
;
3433 * @brief Instance structure for the floating-point FIR interpolator.
3437 uint8_t L
; /**< upsample factor. */
3438 uint16_t phaseLength
; /**< length of each polyphase filter component. */
3439 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length L*phaseLength. */
3440 float32_t
*pState
; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
3441 } arm_fir_interpolate_instance_f32
;
3445 * @brief Processing function for the Q15 FIR interpolator.
3446 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3447 * @param[in] pSrc points to the block of input data.
3448 * @param[out] pDst points to the block of output data.
3449 * @param[in] blockSize number of input samples to process per call.
3451 void arm_fir_interpolate_q15(
3452 const arm_fir_interpolate_instance_q15
* S
,
3455 uint32_t blockSize
);
3459 * @brief Initialization function for the Q15 FIR interpolator.
3460 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
3461 * @param[in] L upsample factor.
3462 * @param[in] numTaps number of filter coefficients in the filter.
3463 * @param[in] pCoeffs points to the filter coefficient buffer.
3464 * @param[in] pState points to the state buffer.
3465 * @param[in] blockSize number of input samples to process per call.
3466 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3467 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3469 arm_status
arm_fir_interpolate_init_q15(
3470 arm_fir_interpolate_instance_q15
* S
,
3475 uint32_t blockSize
);
3479 * @brief Processing function for the Q31 FIR interpolator.
3480 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3481 * @param[in] pSrc points to the block of input data.
3482 * @param[out] pDst points to the block of output data.
3483 * @param[in] blockSize number of input samples to process per call.
3485 void arm_fir_interpolate_q31(
3486 const arm_fir_interpolate_instance_q31
* S
,
3489 uint32_t blockSize
);
3493 * @brief Initialization function for the Q31 FIR interpolator.
3494 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
3495 * @param[in] L upsample factor.
3496 * @param[in] numTaps number of filter coefficients in the filter.
3497 * @param[in] pCoeffs points to the filter coefficient buffer.
3498 * @param[in] pState points to the state buffer.
3499 * @param[in] blockSize number of input samples to process per call.
3500 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3501 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3503 arm_status
arm_fir_interpolate_init_q31(
3504 arm_fir_interpolate_instance_q31
* S
,
3509 uint32_t blockSize
);
3513 * @brief Processing function for the floating-point FIR interpolator.
3514 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
3515 * @param[in] pSrc points to the block of input data.
3516 * @param[out] pDst points to the block of output data.
3517 * @param[in] blockSize number of input samples to process per call.
3519 void arm_fir_interpolate_f32(
3520 const arm_fir_interpolate_instance_f32
* S
,
3523 uint32_t blockSize
);
3527 * @brief Initialization function for the floating-point FIR interpolator.
3528 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
3529 * @param[in] L upsample factor.
3530 * @param[in] numTaps number of filter coefficients in the filter.
3531 * @param[in] pCoeffs points to the filter coefficient buffer.
3532 * @param[in] pState points to the state buffer.
3533 * @param[in] blockSize number of input samples to process per call.
3534 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3535 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3537 arm_status
arm_fir_interpolate_init_f32(
3538 arm_fir_interpolate_instance_f32
* S
,
3541 float32_t
* pCoeffs
,
3543 uint32_t blockSize
);
3547 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
3551 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3552 q63_t
*pState
; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3553 q31_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3554 uint8_t postShift
; /**< additional shift, in bits, applied to each output sample. */
3555 } arm_biquad_cas_df1_32x64_ins_q31
;
3559 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3560 * @param[in] pSrc points to the block of input data.
3561 * @param[out] pDst points to the block of output data
3562 * @param[in] blockSize number of samples to process.
3564 void arm_biquad_cas_df1_32x64_q31(
3565 const arm_biquad_cas_df1_32x64_ins_q31
* S
,
3568 uint32_t blockSize
);
3572 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3573 * @param[in] numStages number of 2nd order stages in the filter.
3574 * @param[in] pCoeffs points to the filter coefficients.
3575 * @param[in] pState points to the state buffer.
3576 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
3578 void arm_biquad_cas_df1_32x64_init_q31(
3579 arm_biquad_cas_df1_32x64_ins_q31
* S
,
3587 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3591 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3592 float32_t
*pState
; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3593 float32_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3594 } arm_biquad_cascade_df2T_instance_f32
;
3597 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3601 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3602 float32_t
*pState
; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3603 float32_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3604 } arm_biquad_cascade_stereo_df2T_instance_f32
;
3607 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3611 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3612 float64_t
*pState
; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3613 float64_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3614 } arm_biquad_cascade_df2T_instance_f64
;
3618 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3619 * @param[in] S points to an instance of the filter data structure.
3620 * @param[in] pSrc points to the block of input data.
3621 * @param[out] pDst points to the block of output data
3622 * @param[in] blockSize number of samples to process.
3624 void arm_biquad_cascade_df2T_f32(
3625 const arm_biquad_cascade_df2T_instance_f32
* S
,
3628 uint32_t blockSize
);
3632 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
3633 * @param[in] S points to an instance of the filter data structure.
3634 * @param[in] pSrc points to the block of input data.
3635 * @param[out] pDst points to the block of output data
3636 * @param[in] blockSize number of samples to process.
3638 void arm_biquad_cascade_stereo_df2T_f32(
3639 const arm_biquad_cascade_stereo_df2T_instance_f32
* S
,
3642 uint32_t blockSize
);
3646 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3647 * @param[in] S points to an instance of the filter data structure.
3648 * @param[in] pSrc points to the block of input data.
3649 * @param[out] pDst points to the block of output data
3650 * @param[in] blockSize number of samples to process.
3652 void arm_biquad_cascade_df2T_f64(
3653 const arm_biquad_cascade_df2T_instance_f64
* S
,
3656 uint32_t blockSize
);
3660 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3661 * @param[in,out] S points to an instance of the filter data structure.
3662 * @param[in] numStages number of 2nd order stages in the filter.
3663 * @param[in] pCoeffs points to the filter coefficients.
3664 * @param[in] pState points to the state buffer.
3666 void arm_biquad_cascade_df2T_init_f32(
3667 arm_biquad_cascade_df2T_instance_f32
* S
,
3669 float32_t
* pCoeffs
,
3670 float32_t
* pState
);
3674 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3675 * @param[in,out] S points to an instance of the filter data structure.
3676 * @param[in] numStages number of 2nd order stages in the filter.
3677 * @param[in] pCoeffs points to the filter coefficients.
3678 * @param[in] pState points to the state buffer.
3680 void arm_biquad_cascade_stereo_df2T_init_f32(
3681 arm_biquad_cascade_stereo_df2T_instance_f32
* S
,
3683 float32_t
* pCoeffs
,
3684 float32_t
* pState
);
3688 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3689 * @param[in,out] S points to an instance of the filter data structure.
3690 * @param[in] numStages number of 2nd order stages in the filter.
3691 * @param[in] pCoeffs points to the filter coefficients.
3692 * @param[in] pState points to the state buffer.
3694 void arm_biquad_cascade_df2T_init_f64(
3695 arm_biquad_cascade_df2T_instance_f64
* S
,
3697 float64_t
* pCoeffs
,
3698 float64_t
* pState
);
3702 * @brief Instance structure for the Q15 FIR lattice filter.
3706 uint16_t numStages
; /**< number of filter stages. */
3707 q15_t
*pState
; /**< points to the state variable array. The array is of length numStages. */
3708 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numStages. */
3709 } arm_fir_lattice_instance_q15
;
3712 * @brief Instance structure for the Q31 FIR lattice filter.
3716 uint16_t numStages
; /**< number of filter stages. */
3717 q31_t
*pState
; /**< points to the state variable array. The array is of length numStages. */
3718 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numStages. */
3719 } arm_fir_lattice_instance_q31
;
3722 * @brief Instance structure for the floating-point FIR lattice filter.
3726 uint16_t numStages
; /**< number of filter stages. */
3727 float32_t
*pState
; /**< points to the state variable array. The array is of length numStages. */
3728 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numStages. */
3729 } arm_fir_lattice_instance_f32
;
3733 * @brief Initialization function for the Q15 FIR lattice filter.
3734 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3735 * @param[in] numStages number of filter stages.
3736 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3737 * @param[in] pState points to the state buffer. The array is of length numStages.
3739 void arm_fir_lattice_init_q15(
3740 arm_fir_lattice_instance_q15
* S
,
3747 * @brief Processing function for the Q15 FIR lattice filter.
3748 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3749 * @param[in] pSrc points to the block of input data.
3750 * @param[out] pDst points to the block of output data.
3751 * @param[in] blockSize number of samples to process.
3753 void arm_fir_lattice_q15(
3754 const arm_fir_lattice_instance_q15
* S
,
3757 uint32_t blockSize
);
3761 * @brief Initialization function for the Q31 FIR lattice filter.
3762 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3763 * @param[in] numStages number of filter stages.
3764 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3765 * @param[in] pState points to the state buffer. The array is of length numStages.
3767 void arm_fir_lattice_init_q31(
3768 arm_fir_lattice_instance_q31
* S
,
3775 * @brief Processing function for the Q31 FIR lattice filter.
3776 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3777 * @param[in] pSrc points to the block of input data.
3778 * @param[out] pDst points to the block of output data
3779 * @param[in] blockSize number of samples to process.
3781 void arm_fir_lattice_q31(
3782 const arm_fir_lattice_instance_q31
* S
,
3785 uint32_t blockSize
);
3789 * @brief Initialization function for the floating-point FIR lattice filter.
3790 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3791 * @param[in] numStages number of filter stages.
3792 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3793 * @param[in] pState points to the state buffer. The array is of length numStages.
3795 void arm_fir_lattice_init_f32(
3796 arm_fir_lattice_instance_f32
* S
,
3798 float32_t
* pCoeffs
,
3799 float32_t
* pState
);
3803 * @brief Processing function for the floating-point FIR lattice filter.
3804 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3805 * @param[in] pSrc points to the block of input data.
3806 * @param[out] pDst points to the block of output data
3807 * @param[in] blockSize number of samples to process.
3809 void arm_fir_lattice_f32(
3810 const arm_fir_lattice_instance_f32
* S
,
3813 uint32_t blockSize
);
3817 * @brief Instance structure for the Q15 IIR lattice filter.
3821 uint16_t numStages
; /**< number of stages in the filter. */
3822 q15_t
*pState
; /**< points to the state variable array. The array is of length numStages+blockSize. */
3823 q15_t
*pkCoeffs
; /**< points to the reflection coefficient array. The array is of length numStages. */
3824 q15_t
*pvCoeffs
; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3825 } arm_iir_lattice_instance_q15
;
3828 * @brief Instance structure for the Q31 IIR lattice filter.
3832 uint16_t numStages
; /**< number of stages in the filter. */
3833 q31_t
*pState
; /**< points to the state variable array. The array is of length numStages+blockSize. */
3834 q31_t
*pkCoeffs
; /**< points to the reflection coefficient array. The array is of length numStages. */
3835 q31_t
*pvCoeffs
; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3836 } arm_iir_lattice_instance_q31
;
3839 * @brief Instance structure for the floating-point IIR lattice filter.
3843 uint16_t numStages
; /**< number of stages in the filter. */
3844 float32_t
*pState
; /**< points to the state variable array. The array is of length numStages+blockSize. */
3845 float32_t
*pkCoeffs
; /**< points to the reflection coefficient array. The array is of length numStages. */
3846 float32_t
*pvCoeffs
; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3847 } arm_iir_lattice_instance_f32
;
3851 * @brief Processing function for the floating-point IIR lattice filter.
3852 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3853 * @param[in] pSrc points to the block of input data.
3854 * @param[out] pDst points to the block of output data.
3855 * @param[in] blockSize number of samples to process.
3857 void arm_iir_lattice_f32(
3858 const arm_iir_lattice_instance_f32
* S
,
3861 uint32_t blockSize
);
3865 * @brief Initialization function for the floating-point IIR lattice filter.
3866 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3867 * @param[in] numStages number of stages in the filter.
3868 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3869 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3870 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
3871 * @param[in] blockSize number of samples to process.
3873 void arm_iir_lattice_init_f32(
3874 arm_iir_lattice_instance_f32
* S
,
3876 float32_t
* pkCoeffs
,
3877 float32_t
* pvCoeffs
,
3879 uint32_t blockSize
);
3883 * @brief Processing function for the Q31 IIR lattice filter.
3884 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3885 * @param[in] pSrc points to the block of input data.
3886 * @param[out] pDst points to the block of output data.
3887 * @param[in] blockSize number of samples to process.
3889 void arm_iir_lattice_q31(
3890 const arm_iir_lattice_instance_q31
* S
,
3893 uint32_t blockSize
);
3897 * @brief Initialization function for the Q31 IIR lattice filter.
3898 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3899 * @param[in] numStages number of stages in the filter.
3900 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3901 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3902 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
3903 * @param[in] blockSize number of samples to process.
3905 void arm_iir_lattice_init_q31(
3906 arm_iir_lattice_instance_q31
* S
,
3911 uint32_t blockSize
);
3915 * @brief Processing function for the Q15 IIR lattice filter.
3916 * @param[in] S points to an instance of the Q15 IIR lattice structure.
3917 * @param[in] pSrc points to the block of input data.
3918 * @param[out] pDst points to the block of output data.
3919 * @param[in] blockSize number of samples to process.
3921 void arm_iir_lattice_q15(
3922 const arm_iir_lattice_instance_q15
* S
,
3925 uint32_t blockSize
);
3929 * @brief Initialization function for the Q15 IIR lattice filter.
3930 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
3931 * @param[in] numStages number of stages in the filter.
3932 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
3933 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
3934 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
3935 * @param[in] blockSize number of samples to process per call.
3937 void arm_iir_lattice_init_q15(
3938 arm_iir_lattice_instance_q15
* S
,
3943 uint32_t blockSize
);
3947 * @brief Instance structure for the floating-point LMS filter.
3951 uint16_t numTaps
; /**< number of coefficients in the filter. */
3952 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3953 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
3954 float32_t mu
; /**< step size that controls filter coefficient updates. */
3955 } arm_lms_instance_f32
;
3959 * @brief Processing function for floating-point LMS filter.
3960 * @param[in] S points to an instance of the floating-point LMS filter structure.
3961 * @param[in] pSrc points to the block of input data.
3962 * @param[in] pRef points to the block of reference data.
3963 * @param[out] pOut points to the block of output data.
3964 * @param[out] pErr points to the block of error data.
3965 * @param[in] blockSize number of samples to process.
3968 const arm_lms_instance_f32
* S
,
3973 uint32_t blockSize
);
3977 * @brief Initialization function for floating-point LMS filter.
3978 * @param[in] S points to an instance of the floating-point LMS filter structure.
3979 * @param[in] numTaps number of filter coefficients.
3980 * @param[in] pCoeffs points to the coefficient buffer.
3981 * @param[in] pState points to state buffer.
3982 * @param[in] mu step size that controls filter coefficient updates.
3983 * @param[in] blockSize number of samples to process.
3985 void arm_lms_init_f32(
3986 arm_lms_instance_f32
* S
,
3988 float32_t
* pCoeffs
,
3991 uint32_t blockSize
);
3995 * @brief Instance structure for the Q15 LMS filter.
3999 uint16_t numTaps
; /**< number of coefficients in the filter. */
4000 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4001 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4002 q15_t mu
; /**< step size that controls filter coefficient updates. */
4003 uint32_t postShift
; /**< bit shift applied to coefficients. */
4004 } arm_lms_instance_q15
;
4008 * @brief Initialization function for the Q15 LMS filter.
4009 * @param[in] S points to an instance of the Q15 LMS filter structure.
4010 * @param[in] numTaps number of filter coefficients.
4011 * @param[in] pCoeffs points to the coefficient buffer.
4012 * @param[in] pState points to the state buffer.
4013 * @param[in] mu step size that controls filter coefficient updates.
4014 * @param[in] blockSize number of samples to process.
4015 * @param[in] postShift bit shift applied to coefficients.
4017 void arm_lms_init_q15(
4018 arm_lms_instance_q15
* S
,
4024 uint32_t postShift
);
4028 * @brief Processing function for Q15 LMS filter.
4029 * @param[in] S points to an instance of the Q15 LMS filter structure.
4030 * @param[in] pSrc points to the block of input data.
4031 * @param[in] pRef points to the block of reference data.
4032 * @param[out] pOut points to the block of output data.
4033 * @param[out] pErr points to the block of error data.
4034 * @param[in] blockSize number of samples to process.
4037 const arm_lms_instance_q15
* S
,
4042 uint32_t blockSize
);
4046 * @brief Instance structure for the Q31 LMS filter.
4050 uint16_t numTaps
; /**< number of coefficients in the filter. */
4051 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4052 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4053 q31_t mu
; /**< step size that controls filter coefficient updates. */
4054 uint32_t postShift
; /**< bit shift applied to coefficients. */
4055 } arm_lms_instance_q31
;
4059 * @brief Processing function for Q31 LMS filter.
4060 * @param[in] S points to an instance of the Q15 LMS filter structure.
4061 * @param[in] pSrc points to the block of input data.
4062 * @param[in] pRef points to the block of reference data.
4063 * @param[out] pOut points to the block of output data.
4064 * @param[out] pErr points to the block of error data.
4065 * @param[in] blockSize number of samples to process.
4068 const arm_lms_instance_q31
* S
,
4073 uint32_t blockSize
);
4077 * @brief Initialization function for Q31 LMS filter.
4078 * @param[in] S points to an instance of the Q31 LMS filter structure.
4079 * @param[in] numTaps number of filter coefficients.
4080 * @param[in] pCoeffs points to coefficient buffer.
4081 * @param[in] pState points to state buffer.
4082 * @param[in] mu step size that controls filter coefficient updates.
4083 * @param[in] blockSize number of samples to process.
4084 * @param[in] postShift bit shift applied to coefficients.
4086 void arm_lms_init_q31(
4087 arm_lms_instance_q31
* S
,
4093 uint32_t postShift
);
4097 * @brief Instance structure for the floating-point normalized LMS filter.
4101 uint16_t numTaps
; /**< number of coefficients in the filter. */
4102 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4103 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4104 float32_t mu
; /**< step size that control filter coefficient updates. */
4105 float32_t energy
; /**< saves previous frame energy. */
4106 float32_t x0
; /**< saves previous input sample. */
4107 } arm_lms_norm_instance_f32
;
4111 * @brief Processing function for floating-point normalized LMS filter.
4112 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
4113 * @param[in] pSrc points to the block of input data.
4114 * @param[in] pRef points to the block of reference data.
4115 * @param[out] pOut points to the block of output data.
4116 * @param[out] pErr points to the block of error data.
4117 * @param[in] blockSize number of samples to process.
4119 void arm_lms_norm_f32(
4120 arm_lms_norm_instance_f32
* S
,
4125 uint32_t blockSize
);
4129 * @brief Initialization function for floating-point normalized LMS filter.
4130 * @param[in] S points to an instance of the floating-point LMS filter structure.
4131 * @param[in] numTaps number of filter coefficients.
4132 * @param[in] pCoeffs points to coefficient buffer.
4133 * @param[in] pState points to state buffer.
4134 * @param[in] mu step size that controls filter coefficient updates.
4135 * @param[in] blockSize number of samples to process.
4137 void arm_lms_norm_init_f32(
4138 arm_lms_norm_instance_f32
* S
,
4140 float32_t
* pCoeffs
,
4143 uint32_t blockSize
);
4147 * @brief Instance structure for the Q31 normalized LMS filter.
4151 uint16_t numTaps
; /**< number of coefficients in the filter. */
4152 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4153 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4154 q31_t mu
; /**< step size that controls filter coefficient updates. */
4155 uint8_t postShift
; /**< bit shift applied to coefficients. */
4156 q31_t
*recipTable
; /**< points to the reciprocal initial value table. */
4157 q31_t energy
; /**< saves previous frame energy. */
4158 q31_t x0
; /**< saves previous input sample. */
4159 } arm_lms_norm_instance_q31
;
4163 * @brief Processing function for Q31 normalized LMS filter.
4164 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4165 * @param[in] pSrc points to the block of input data.
4166 * @param[in] pRef points to the block of reference data.
4167 * @param[out] pOut points to the block of output data.
4168 * @param[out] pErr points to the block of error data.
4169 * @param[in] blockSize number of samples to process.
4171 void arm_lms_norm_q31(
4172 arm_lms_norm_instance_q31
* S
,
4177 uint32_t blockSize
);
4181 * @brief Initialization function for Q31 normalized LMS filter.
4182 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4183 * @param[in] numTaps number of filter coefficients.
4184 * @param[in] pCoeffs points to coefficient buffer.
4185 * @param[in] pState points to state buffer.
4186 * @param[in] mu step size that controls filter coefficient updates.
4187 * @param[in] blockSize number of samples to process.
4188 * @param[in] postShift bit shift applied to coefficients.
4190 void arm_lms_norm_init_q31(
4191 arm_lms_norm_instance_q31
* S
,
4201 * @brief Instance structure for the Q15 normalized LMS filter.
4205 uint16_t numTaps
; /**< Number of coefficients in the filter. */
4206 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4207 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4208 q15_t mu
; /**< step size that controls filter coefficient updates. */
4209 uint8_t postShift
; /**< bit shift applied to coefficients. */
4210 q15_t
*recipTable
; /**< Points to the reciprocal initial value table. */
4211 q15_t energy
; /**< saves previous frame energy. */
4212 q15_t x0
; /**< saves previous input sample. */
4213 } arm_lms_norm_instance_q15
;
4217 * @brief Processing function for Q15 normalized LMS filter.
4218 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4219 * @param[in] pSrc points to the block of input data.
4220 * @param[in] pRef points to the block of reference data.
4221 * @param[out] pOut points to the block of output data.
4222 * @param[out] pErr points to the block of error data.
4223 * @param[in] blockSize number of samples to process.
4225 void arm_lms_norm_q15(
4226 arm_lms_norm_instance_q15
* S
,
4231 uint32_t blockSize
);
4235 * @brief Initialization function for Q15 normalized LMS filter.
4236 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4237 * @param[in] numTaps number of filter coefficients.
4238 * @param[in] pCoeffs points to coefficient buffer.
4239 * @param[in] pState points to state buffer.
4240 * @param[in] mu step size that controls filter coefficient updates.
4241 * @param[in] blockSize number of samples to process.
4242 * @param[in] postShift bit shift applied to coefficients.
4244 void arm_lms_norm_init_q15(
4245 arm_lms_norm_instance_q15
* S
,
4255 * @brief Correlation of floating-point sequences.
4256 * @param[in] pSrcA points to the first input sequence.
4257 * @param[in] srcALen length of the first input sequence.
4258 * @param[in] pSrcB points to the second input sequence.
4259 * @param[in] srcBLen length of the second input sequence.
4260 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4262 void arm_correlate_f32(
4271 * @brief Correlation of Q15 sequences
4272 * @param[in] pSrcA points to the first input sequence.
4273 * @param[in] srcALen length of the first input sequence.
4274 * @param[in] pSrcB points to the second input sequence.
4275 * @param[in] srcBLen length of the second input sequence.
4276 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4277 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4279 void arm_correlate_opt_q15(
4289 * @brief Correlation of Q15 sequences.
4290 * @param[in] pSrcA points to the first input sequence.
4291 * @param[in] srcALen length of the first input sequence.
4292 * @param[in] pSrcB points to the second input sequence.
4293 * @param[in] srcBLen length of the second input sequence.
4294 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4297 void arm_correlate_q15(
4306 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4307 * @param[in] pSrcA points to the first input sequence.
4308 * @param[in] srcALen length of the first input sequence.
4309 * @param[in] pSrcB points to the second input sequence.
4310 * @param[in] srcBLen length of the second input sequence.
4311 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4314 void arm_correlate_fast_q15(
4323 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4324 * @param[in] pSrcA points to the first input sequence.
4325 * @param[in] srcALen length of the first input sequence.
4326 * @param[in] pSrcB points to the second input sequence.
4327 * @param[in] srcBLen length of the second input sequence.
4328 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4329 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4331 void arm_correlate_fast_opt_q15(
4341 * @brief Correlation of Q31 sequences.
4342 * @param[in] pSrcA points to the first input sequence.
4343 * @param[in] srcALen length of the first input sequence.
4344 * @param[in] pSrcB points to the second input sequence.
4345 * @param[in] srcBLen length of the second input sequence.
4346 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4348 void arm_correlate_q31(
4357 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
4358 * @param[in] pSrcA points to the first input sequence.
4359 * @param[in] srcALen length of the first input sequence.
4360 * @param[in] pSrcB points to the second input sequence.
4361 * @param[in] srcBLen length of the second input sequence.
4362 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4364 void arm_correlate_fast_q31(
4373 * @brief Correlation of Q7 sequences.
4374 * @param[in] pSrcA points to the first input sequence.
4375 * @param[in] srcALen length of the first input sequence.
4376 * @param[in] pSrcB points to the second input sequence.
4377 * @param[in] srcBLen length of the second input sequence.
4378 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4379 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4380 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
4382 void arm_correlate_opt_q7(
4393 * @brief Correlation of Q7 sequences.
4394 * @param[in] pSrcA points to the first input sequence.
4395 * @param[in] srcALen length of the first input sequence.
4396 * @param[in] pSrcB points to the second input sequence.
4397 * @param[in] srcBLen length of the second input sequence.
4398 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4400 void arm_correlate_q7(
4409 * @brief Instance structure for the floating-point sparse FIR filter.
4413 uint16_t numTaps
; /**< number of coefficients in the filter. */
4414 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4415 float32_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4416 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4417 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4418 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4419 } arm_fir_sparse_instance_f32
;
4422 * @brief Instance structure for the Q31 sparse FIR filter.
4426 uint16_t numTaps
; /**< number of coefficients in the filter. */
4427 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4428 q31_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4429 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4430 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4431 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4432 } arm_fir_sparse_instance_q31
;
4435 * @brief Instance structure for the Q15 sparse FIR filter.
4439 uint16_t numTaps
; /**< number of coefficients in the filter. */
4440 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4441 q15_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4442 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4443 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4444 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4445 } arm_fir_sparse_instance_q15
;
4448 * @brief Instance structure for the Q7 sparse FIR filter.
4452 uint16_t numTaps
; /**< number of coefficients in the filter. */
4453 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4454 q7_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4455 q7_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4456 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4457 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4458 } arm_fir_sparse_instance_q7
;
4462 * @brief Processing function for the floating-point sparse FIR filter.
4463 * @param[in] S points to an instance of the floating-point sparse FIR structure.
4464 * @param[in] pSrc points to the block of input data.
4465 * @param[out] pDst points to the block of output data
4466 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4467 * @param[in] blockSize number of input samples to process per call.
4469 void arm_fir_sparse_f32(
4470 arm_fir_sparse_instance_f32
* S
,
4473 float32_t
* pScratchIn
,
4474 uint32_t blockSize
);
4478 * @brief Initialization function for the floating-point sparse FIR filter.
4479 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
4480 * @param[in] numTaps number of nonzero coefficients in the filter.
4481 * @param[in] pCoeffs points to the array of filter coefficients.
4482 * @param[in] pState points to the state buffer.
4483 * @param[in] pTapDelay points to the array of offset times.
4484 * @param[in] maxDelay maximum offset time supported.
4485 * @param[in] blockSize number of samples that will be processed per block.
4487 void arm_fir_sparse_init_f32(
4488 arm_fir_sparse_instance_f32
* S
,
4490 float32_t
* pCoeffs
,
4492 int32_t * pTapDelay
,
4494 uint32_t blockSize
);
4498 * @brief Processing function for the Q31 sparse FIR filter.
4499 * @param[in] S points to an instance of the Q31 sparse FIR structure.
4500 * @param[in] pSrc points to the block of input data.
4501 * @param[out] pDst points to the block of output data
4502 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4503 * @param[in] blockSize number of input samples to process per call.
4505 void arm_fir_sparse_q31(
4506 arm_fir_sparse_instance_q31
* S
,
4510 uint32_t blockSize
);
4514 * @brief Initialization function for the Q31 sparse FIR filter.
4515 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
4516 * @param[in] numTaps number of nonzero coefficients in the filter.
4517 * @param[in] pCoeffs points to the array of filter coefficients.
4518 * @param[in] pState points to the state buffer.
4519 * @param[in] pTapDelay points to the array of offset times.
4520 * @param[in] maxDelay maximum offset time supported.
4521 * @param[in] blockSize number of samples that will be processed per block.
4523 void arm_fir_sparse_init_q31(
4524 arm_fir_sparse_instance_q31
* S
,
4528 int32_t * pTapDelay
,
4530 uint32_t blockSize
);
4534 * @brief Processing function for the Q15 sparse FIR filter.
4535 * @param[in] S points to an instance of the Q15 sparse FIR structure.
4536 * @param[in] pSrc points to the block of input data.
4537 * @param[out] pDst points to the block of output data
4538 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4539 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4540 * @param[in] blockSize number of input samples to process per call.
4542 void arm_fir_sparse_q15(
4543 arm_fir_sparse_instance_q15
* S
,
4547 q31_t
* pScratchOut
,
4548 uint32_t blockSize
);
4552 * @brief Initialization function for the Q15 sparse FIR filter.
4553 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
4554 * @param[in] numTaps number of nonzero coefficients in the filter.
4555 * @param[in] pCoeffs points to the array of filter coefficients.
4556 * @param[in] pState points to the state buffer.
4557 * @param[in] pTapDelay points to the array of offset times.
4558 * @param[in] maxDelay maximum offset time supported.
4559 * @param[in] blockSize number of samples that will be processed per block.
4561 void arm_fir_sparse_init_q15(
4562 arm_fir_sparse_instance_q15
* S
,
4566 int32_t * pTapDelay
,
4568 uint32_t blockSize
);
4572 * @brief Processing function for the Q7 sparse FIR filter.
4573 * @param[in] S points to an instance of the Q7 sparse FIR structure.
4574 * @param[in] pSrc points to the block of input data.
4575 * @param[out] pDst points to the block of output data
4576 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4577 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4578 * @param[in] blockSize number of input samples to process per call.
4580 void arm_fir_sparse_q7(
4581 arm_fir_sparse_instance_q7
* S
,
4585 q31_t
* pScratchOut
,
4586 uint32_t blockSize
);
4590 * @brief Initialization function for the Q7 sparse FIR filter.
4591 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
4592 * @param[in] numTaps number of nonzero coefficients in the filter.
4593 * @param[in] pCoeffs points to the array of filter coefficients.
4594 * @param[in] pState points to the state buffer.
4595 * @param[in] pTapDelay points to the array of offset times.
4596 * @param[in] maxDelay maximum offset time supported.
4597 * @param[in] blockSize number of samples that will be processed per block.
4599 void arm_fir_sparse_init_q7(
4600 arm_fir_sparse_instance_q7
* S
,
4604 int32_t * pTapDelay
,
4606 uint32_t blockSize
);
4610 * @brief Floating-point sin_cos function.
4611 * @param[in] theta input value in degrees
4612 * @param[out] pSinVal points to the processed sine output.
4613 * @param[out] pCosVal points to the processed cos output.
4615 void arm_sin_cos_f32(
4617 float32_t
* pSinVal
,
4618 float32_t
* pCosVal
);
4622 * @brief Q31 sin_cos function.
4623 * @param[in] theta scaled input value in degrees
4624 * @param[out] pSinVal points to the processed sine output.
4625 * @param[out] pCosVal points to the processed cosine output.
4627 void arm_sin_cos_q31(
4634 * @brief Floating-point complex conjugate.
4635 * @param[in] pSrc points to the input vector
4636 * @param[out] pDst points to the output vector
4637 * @param[in] numSamples number of complex samples in each vector
4639 void arm_cmplx_conj_f32(
4642 uint32_t numSamples
);
4645 * @brief Q31 complex conjugate.
4646 * @param[in] pSrc points to the input vector
4647 * @param[out] pDst points to the output vector
4648 * @param[in] numSamples number of complex samples in each vector
4650 void arm_cmplx_conj_q31(
4653 uint32_t numSamples
);
4657 * @brief Q15 complex conjugate.
4658 * @param[in] pSrc points to the input vector
4659 * @param[out] pDst points to the output vector
4660 * @param[in] numSamples number of complex samples in each vector
4662 void arm_cmplx_conj_q15(
4665 uint32_t numSamples
);
4669 * @brief Floating-point complex magnitude squared
4670 * @param[in] pSrc points to the complex input vector
4671 * @param[out] pDst points to the real output vector
4672 * @param[in] numSamples number of complex samples in the input vector
4674 void arm_cmplx_mag_squared_f32(
4677 uint32_t numSamples
);
4681 * @brief Q31 complex magnitude squared
4682 * @param[in] pSrc points to the complex input vector
4683 * @param[out] pDst points to the real output vector
4684 * @param[in] numSamples number of complex samples in the input vector
4686 void arm_cmplx_mag_squared_q31(
4689 uint32_t numSamples
);
4693 * @brief Q15 complex magnitude squared
4694 * @param[in] pSrc points to the complex input vector
4695 * @param[out] pDst points to the real output vector
4696 * @param[in] numSamples number of complex samples in the input vector
4698 void arm_cmplx_mag_squared_q15(
4701 uint32_t numSamples
);
4705 * @ingroup groupController
4709 * @defgroup PID PID Motor Control
4711 * A Proportional Integral Derivative (PID) controller is a generic feedback control
4712 * loop mechanism widely used in industrial control systems.
4713 * A PID controller is the most commonly used type of feedback controller.
4715 * This set of functions implements (PID) controllers
4716 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
4717 * of data and each call to the function returns a single processed value.
4718 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
4719 * is the input sample value. The functions return the output value.
4723 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
4725 * A1 = (-Kp ) - (2 * Kd )
4729 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
4732 * \image html PID.gif "Proportional Integral Derivative Controller"
4735 * The PID controller calculates an "error" value as the difference between
4736 * the measured output and the reference input.
4737 * The controller attempts to minimize the error by adjusting the process control inputs.
4738 * The proportional value determines the reaction to the current error,
4739 * the integral value determines the reaction based on the sum of recent errors,
4740 * and the derivative value determines the reaction based on the rate at which the error has been changing.
4742 * \par Instance Structure
4743 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
4744 * A separate instance structure must be defined for each PID Controller.
4745 * There are separate instance structure declarations for each of the 3 supported data types.
4747 * \par Reset Functions
4748 * There is also an associated reset function for each data type which clears the state array.
4750 * \par Initialization Functions
4751 * There is also an associated initialization function for each data type.
4752 * The initialization function performs the following operations:
4753 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
4754 * - Zeros out the values in the state buffer.
4757 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
4759 * \par Fixed-Point Behavior
4760 * Care must be taken when using the fixed-point versions of the PID Controller functions.
4761 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
4762 * Refer to the function specific documentation below for usage guidelines.
4771 * @brief Process function for the floating-point PID Control.
4772 * @param[in,out] S is an instance of the floating-point PID Control structure
4773 * @param[in] in input sample to process
4774 * @return out processed output sample.
4776 CMSIS_INLINE __STATIC_INLINE float32_t
arm_pid_f32(
4777 arm_pid_instance_f32
* S
,
4782 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
4783 out
= (S
->A0
* in
) +
4784 (S
->A1
* S
->state
[0]) + (S
->A2
* S
->state
[1]) + (S
->state
[2]);
4787 S
->state
[1] = S
->state
[0];
4791 /* return to application */
4797 * @brief Process function for the Q31 PID Control.
4798 * @param[in,out] S points to an instance of the Q31 PID Control structure
4799 * @param[in] in input sample to process
4800 * @return out processed output sample.
4802 * <b>Scaling and Overflow Behavior:</b>
4804 * The function is implemented using an internal 64-bit accumulator.
4805 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
4806 * Thus, if the accumulator result overflows it wraps around rather than clip.
4807 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
4808 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
4810 CMSIS_INLINE __STATIC_INLINE q31_t
arm_pid_q31(
4811 arm_pid_instance_q31
* S
,
4817 /* acc = A0 * x[n] */
4818 acc
= (q63_t
) S
->A0
* in
;
4820 /* acc += A1 * x[n-1] */
4821 acc
+= (q63_t
) S
->A1
* S
->state
[0];
4823 /* acc += A2 * x[n-2] */
4824 acc
+= (q63_t
) S
->A2
* S
->state
[1];
4826 /* convert output to 1.31 format to add y[n-1] */
4827 out
= (q31_t
) (acc
>> 31U);
4833 S
->state
[1] = S
->state
[0];
4837 /* return to application */
4843 * @brief Process function for the Q15 PID Control.
4844 * @param[in,out] S points to an instance of the Q15 PID Control structure
4845 * @param[in] in input sample to process
4846 * @return out processed output sample.
4848 * <b>Scaling and Overflow Behavior:</b>
4850 * The function is implemented using a 64-bit internal accumulator.
4851 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
4852 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
4853 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
4854 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
4855 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
4857 CMSIS_INLINE __STATIC_INLINE q15_t
arm_pid_q15(
4858 arm_pid_instance_q15
* S
,
4864 #if defined (ARM_MATH_DSP)
4865 __SIMD32_TYPE
*vstate
;
4867 /* Implementation of PID controller */
4869 /* acc = A0 * x[n] */
4870 acc
= (q31_t
) __SMUAD((uint32_t)S
->A0
, (uint32_t)in
);
4872 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4873 vstate
= __SIMD32_CONST(S
->state
);
4874 acc
= (q63_t
)__SMLALD((uint32_t)S
->A1
, (uint32_t)*vstate
, (uint64_t)acc
);
4876 /* acc = A0 * x[n] */
4877 acc
= ((q31_t
) S
->A0
) * in
;
4879 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4880 acc
+= (q31_t
) S
->A1
* S
->state
[0];
4881 acc
+= (q31_t
) S
->A2
* S
->state
[1];
4885 acc
+= (q31_t
) S
->state
[2] << 15;
4887 /* saturate the output */
4888 out
= (q15_t
) (__SSAT((acc
>> 15), 16));
4891 S
->state
[1] = S
->state
[0];
4895 /* return to application */
4900 * @} end of PID group
4905 * @brief Floating-point matrix inverse.
4906 * @param[in] src points to the instance of the input floating-point matrix structure.
4907 * @param[out] dst points to the instance of the output floating-point matrix structure.
4908 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4909 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4911 arm_status
arm_mat_inverse_f32(
4912 const arm_matrix_instance_f32
* src
,
4913 arm_matrix_instance_f32
* dst
);
4917 * @brief Floating-point matrix inverse.
4918 * @param[in] src points to the instance of the input floating-point matrix structure.
4919 * @param[out] dst points to the instance of the output floating-point matrix structure.
4920 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4921 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4923 arm_status
arm_mat_inverse_f64(
4924 const arm_matrix_instance_f64
* src
,
4925 arm_matrix_instance_f64
* dst
);
4930 * @ingroup groupController
4934 * @defgroup clarke Vector Clarke Transform
4935 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
4936 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
4937 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
4938 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
4939 * \image html clarke.gif Stator current space vector and its components in (a,b).
4940 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
4941 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
4943 * The function operates on a single sample of data and each call to the function returns the processed output.
4944 * The library provides separate functions for Q31 and floating-point data types.
4946 * \image html clarkeFormula.gif
4947 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
4948 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
4949 * \par Fixed-Point Behavior
4950 * Care must be taken when using the Q31 version of the Clarke transform.
4951 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
4952 * Refer to the function specific documentation below for usage guidelines.
4956 * @addtogroup clarke
4962 * @brief Floating-point Clarke transform
4963 * @param[in] Ia input three-phase coordinate <code>a</code>
4964 * @param[in] Ib input three-phase coordinate <code>b</code>
4965 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
4966 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
4968 CMSIS_INLINE __STATIC_INLINE
void arm_clarke_f32(
4971 float32_t
* pIalpha
,
4974 /* Calculate pIalpha using the equation, pIalpha = Ia */
4977 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
4978 *pIbeta
= ((float32_t
) 0.57735026919 * Ia
+ (float32_t
) 1.15470053838 * Ib
);
4983 * @brief Clarke transform for Q31 version
4984 * @param[in] Ia input three-phase coordinate <code>a</code>
4985 * @param[in] Ib input three-phase coordinate <code>b</code>
4986 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
4987 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
4989 * <b>Scaling and Overflow Behavior:</b>
4991 * The function is implemented using an internal 32-bit accumulator.
4992 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
4993 * There is saturation on the addition, hence there is no risk of overflow.
4995 CMSIS_INLINE __STATIC_INLINE
void arm_clarke_q31(
5001 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5003 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
5006 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
5007 product1
= (q31_t
) (((q63_t
) Ia
* 0x24F34E8B) >> 30);
5009 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
5010 product2
= (q31_t
) (((q63_t
) Ib
* 0x49E69D16) >> 30);
5012 /* pIbeta is calculated by adding the intermediate products */
5013 *pIbeta
= __QADD(product1
, product2
);
5017 * @} end of clarke group
5021 * @brief Converts the elements of the Q7 vector to Q31 vector.
5022 * @param[in] pSrc input pointer
5023 * @param[out] pDst output pointer
5024 * @param[in] blockSize number of samples to process
5029 uint32_t blockSize
);
5034 * @ingroup groupController
5038 * @defgroup inv_clarke Vector Inverse Clarke Transform
5039 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
5041 * The function operates on a single sample of data and each call to the function returns the processed output.
5042 * The library provides separate functions for Q31 and floating-point data types.
5044 * \image html clarkeInvFormula.gif
5045 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
5046 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
5047 * \par Fixed-Point Behavior
5048 * Care must be taken when using the Q31 version of the Clarke transform.
5049 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5050 * Refer to the function specific documentation below for usage guidelines.
5054 * @addtogroup inv_clarke
5059 * @brief Floating-point Inverse Clarke transform
5060 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5061 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5062 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5063 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5065 CMSIS_INLINE __STATIC_INLINE
void arm_inv_clarke_f32(
5071 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5074 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
5075 *pIb
= -0.5f
* Ialpha
+ 0.8660254039f
* Ibeta
;
5080 * @brief Inverse Clarke transform for Q31 version
5081 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5082 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5083 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5084 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5086 * <b>Scaling and Overflow Behavior:</b>
5088 * The function is implemented using an internal 32-bit accumulator.
5089 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5090 * There is saturation on the subtraction, hence there is no risk of overflow.
5092 CMSIS_INLINE __STATIC_INLINE
void arm_inv_clarke_q31(
5098 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5100 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5103 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
5104 product1
= (q31_t
) (((q63_t
) (Ialpha
) * (0x40000000)) >> 31);
5106 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
5107 product2
= (q31_t
) (((q63_t
) (Ibeta
) * (0x6ED9EBA1)) >> 31);
5109 /* pIb is calculated by subtracting the products */
5110 *pIb
= __QSUB(product2
, product1
);
5114 * @} end of inv_clarke group
5118 * @brief Converts the elements of the Q7 vector to Q15 vector.
5119 * @param[in] pSrc input pointer
5120 * @param[out] pDst output pointer
5121 * @param[in] blockSize number of samples to process
5126 uint32_t blockSize
);
5131 * @ingroup groupController
5135 * @defgroup park Vector Park Transform
5137 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
5138 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
5139 * from the stationary to the moving reference frame and control the spatial relationship between
5140 * the stator vector current and rotor flux vector.
5141 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
5142 * current vector and the relationship from the two reference frames:
5143 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
5145 * The function operates on a single sample of data and each call to the function returns the processed output.
5146 * The library provides separate functions for Q31 and floating-point data types.
5148 * \image html parkFormula.gif
5149 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
5150 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5151 * cosine and sine values of theta (rotor flux position).
5152 * \par Fixed-Point Behavior
5153 * Care must be taken when using the Q31 version of the Park transform.
5154 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5155 * Refer to the function specific documentation below for usage guidelines.
5164 * @brief Floating-point Park transform
5165 * @param[in] Ialpha input two-phase vector coordinate alpha
5166 * @param[in] Ibeta input two-phase vector coordinate beta
5167 * @param[out] pId points to output rotor reference frame d
5168 * @param[out] pIq points to output rotor reference frame q
5169 * @param[in] sinVal sine value of rotation angle theta
5170 * @param[in] cosVal cosine value of rotation angle theta
5172 * The function implements the forward Park transform.
5175 CMSIS_INLINE __STATIC_INLINE
void arm_park_f32(
5183 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
5184 *pId
= Ialpha
* cosVal
+ Ibeta
* sinVal
;
5186 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
5187 *pIq
= -Ialpha
* sinVal
+ Ibeta
* cosVal
;
5192 * @brief Park transform for Q31 version
5193 * @param[in] Ialpha input two-phase vector coordinate alpha
5194 * @param[in] Ibeta input two-phase vector coordinate beta
5195 * @param[out] pId points to output rotor reference frame d
5196 * @param[out] pIq points to output rotor reference frame q
5197 * @param[in] sinVal sine value of rotation angle theta
5198 * @param[in] cosVal cosine value of rotation angle theta
5200 * <b>Scaling and Overflow Behavior:</b>
5202 * The function is implemented using an internal 32-bit accumulator.
5203 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5204 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
5206 CMSIS_INLINE __STATIC_INLINE
void arm_park_q31(
5214 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5215 q31_t product3
, product4
; /* Temporary variables used to store intermediate results */
5217 /* Intermediate product is calculated by (Ialpha * cosVal) */
5218 product1
= (q31_t
) (((q63_t
) (Ialpha
) * (cosVal
)) >> 31);
5220 /* Intermediate product is calculated by (Ibeta * sinVal) */
5221 product2
= (q31_t
) (((q63_t
) (Ibeta
) * (sinVal
)) >> 31);
5224 /* Intermediate product is calculated by (Ialpha * sinVal) */
5225 product3
= (q31_t
) (((q63_t
) (Ialpha
) * (sinVal
)) >> 31);
5227 /* Intermediate product is calculated by (Ibeta * cosVal) */
5228 product4
= (q31_t
) (((q63_t
) (Ibeta
) * (cosVal
)) >> 31);
5230 /* Calculate pId by adding the two intermediate products 1 and 2 */
5231 *pId
= __QADD(product1
, product2
);
5233 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
5234 *pIq
= __QSUB(product4
, product3
);
5238 * @} end of park group
5242 * @brief Converts the elements of the Q7 vector to floating-point vector.
5243 * @param[in] pSrc is input pointer
5244 * @param[out] pDst is output pointer
5245 * @param[in] blockSize is the number of samples to process
5247 void arm_q7_to_float(
5250 uint32_t blockSize
);
5254 * @ingroup groupController
5258 * @defgroup inv_park Vector Inverse Park transform
5259 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
5261 * The function operates on a single sample of data and each call to the function returns the processed output.
5262 * The library provides separate functions for Q31 and floating-point data types.
5264 * \image html parkInvFormula.gif
5265 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
5266 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5267 * cosine and sine values of theta (rotor flux position).
5268 * \par Fixed-Point Behavior
5269 * Care must be taken when using the Q31 version of the Park transform.
5270 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5271 * Refer to the function specific documentation below for usage guidelines.
5275 * @addtogroup inv_park
5280 * @brief Floating-point Inverse Park transform
5281 * @param[in] Id input coordinate of rotor reference frame d
5282 * @param[in] Iq input coordinate of rotor reference frame q
5283 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5284 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5285 * @param[in] sinVal sine value of rotation angle theta
5286 * @param[in] cosVal cosine value of rotation angle theta
5288 CMSIS_INLINE __STATIC_INLINE
void arm_inv_park_f32(
5291 float32_t
* pIalpha
,
5296 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
5297 *pIalpha
= Id
* cosVal
- Iq
* sinVal
;
5299 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
5300 *pIbeta
= Id
* sinVal
+ Iq
* cosVal
;
5305 * @brief Inverse Park transform for Q31 version
5306 * @param[in] Id input coordinate of rotor reference frame d
5307 * @param[in] Iq input coordinate of rotor reference frame q
5308 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5309 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5310 * @param[in] sinVal sine value of rotation angle theta
5311 * @param[in] cosVal cosine value of rotation angle theta
5313 * <b>Scaling and Overflow Behavior:</b>
5315 * The function is implemented using an internal 32-bit accumulator.
5316 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5317 * There is saturation on the addition, hence there is no risk of overflow.
5319 CMSIS_INLINE __STATIC_INLINE
void arm_inv_park_q31(
5327 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5328 q31_t product3
, product4
; /* Temporary variables used to store intermediate results */
5330 /* Intermediate product is calculated by (Id * cosVal) */
5331 product1
= (q31_t
) (((q63_t
) (Id
) * (cosVal
)) >> 31);
5333 /* Intermediate product is calculated by (Iq * sinVal) */
5334 product2
= (q31_t
) (((q63_t
) (Iq
) * (sinVal
)) >> 31);
5337 /* Intermediate product is calculated by (Id * sinVal) */
5338 product3
= (q31_t
) (((q63_t
) (Id
) * (sinVal
)) >> 31);
5340 /* Intermediate product is calculated by (Iq * cosVal) */
5341 product4
= (q31_t
) (((q63_t
) (Iq
) * (cosVal
)) >> 31);
5343 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
5344 *pIalpha
= __QSUB(product1
, product2
);
5346 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
5347 *pIbeta
= __QADD(product4
, product3
);
5351 * @} end of Inverse park group
5356 * @brief Converts the elements of the Q31 vector to floating-point vector.
5357 * @param[in] pSrc is input pointer
5358 * @param[out] pDst is output pointer
5359 * @param[in] blockSize is the number of samples to process
5361 void arm_q31_to_float(
5364 uint32_t blockSize
);
5367 * @ingroup groupInterpolation
5371 * @defgroup LinearInterpolate Linear Interpolation
5373 * Linear interpolation is a method of curve fitting using linear polynomials.
5374 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
5377 * \image html LinearInterp.gif "Linear interpolation"
5380 * A Linear Interpolate function calculates an output value(y), for the input(x)
5381 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
5385 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
5386 * where x0, x1 are nearest values of input x
5387 * y0, y1 are nearest values to output y
5391 * This set of functions implements Linear interpolation process
5392 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
5393 * sample of data and each call to the function returns a single processed value.
5394 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
5395 * <code>x</code> is the input sample value. The functions returns the output value.
5398 * if x is outside of the table boundary, Linear interpolation returns first value of the table
5399 * if x is below input range and returns last value of table if x is above range.
5403 * @addtogroup LinearInterpolate
5408 * @brief Process function for the floating-point Linear Interpolation Function.
5409 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
5410 * @param[in] x input sample to process
5411 * @return y processed output sample.
5414 CMSIS_INLINE __STATIC_INLINE float32_t
arm_linear_interp_f32(
5415 arm_linear_interp_instance_f32
* S
,
5419 float32_t x0
, x1
; /* Nearest input values */
5420 float32_t y0
, y1
; /* Nearest output values */
5421 float32_t xSpacing
= S
->xSpacing
; /* spacing between input values */
5422 int32_t i
; /* Index variable */
5423 float32_t
*pYData
= S
->pYData
; /* pointer to output table */
5425 /* Calculation of index */
5426 i
= (int32_t) ((x
- S
->x1
) / xSpacing
);
5430 /* Iniatilize output for below specified range as least output value of table */
5433 else if ((uint32_t)i
>= S
->nValues
)
5435 /* Iniatilize output for above specified range as last output value of table */
5436 y
= pYData
[S
->nValues
- 1];
5440 /* Calculation of nearest input values */
5441 x0
= S
->x1
+ i
* xSpacing
;
5442 x1
= S
->x1
+ (i
+ 1) * xSpacing
;
5444 /* Read of nearest output values */
5448 /* Calculation of output */
5449 y
= y0
+ (x
- x0
) * ((y1
- y0
) / (x1
- x0
));
5453 /* returns output value */
5460 * @brief Process function for the Q31 Linear Interpolation Function.
5461 * @param[in] pYData pointer to Q31 Linear Interpolation table
5462 * @param[in] x input sample to process
5463 * @param[in] nValues number of table values
5464 * @return y processed output sample.
5467 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5468 * This function can support maximum of table size 2^12.
5471 CMSIS_INLINE __STATIC_INLINE q31_t
arm_linear_interp_q31(
5476 q31_t y
; /* output */
5477 q31_t y0
, y1
; /* Nearest output values */
5478 q31_t fract
; /* fractional part */
5479 int32_t index
; /* Index to read nearest output values */
5481 /* Input is in 12.20 format */
5482 /* 12 bits for the table index */
5483 /* Index value calculation */
5484 index
= ((x
& (q31_t
)0xFFF00000) >> 20);
5486 if (index
>= (int32_t)(nValues
- 1))
5488 return (pYData
[nValues
- 1]);
5496 /* 20 bits for the fractional part */
5497 /* shift left by 11 to keep fract in 1.31 format */
5498 fract
= (x
& 0x000FFFFF) << 11;
5500 /* Read two nearest output values from the index in 1.31(q31) format */
5502 y1
= pYData
[index
+ 1];
5504 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
5505 y
= ((q31_t
) ((q63_t
) y0
* (0x7FFFFFFF - fract
) >> 32));
5507 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
5508 y
+= ((q31_t
) (((q63_t
) y1
* fract
) >> 32));
5510 /* Convert y to 1.31 format */
5518 * @brief Process function for the Q15 Linear Interpolation Function.
5519 * @param[in] pYData pointer to Q15 Linear Interpolation table
5520 * @param[in] x input sample to process
5521 * @param[in] nValues number of table values
5522 * @return y processed output sample.
5525 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5526 * This function can support maximum of table size 2^12.
5529 CMSIS_INLINE __STATIC_INLINE q15_t
arm_linear_interp_q15(
5534 q63_t y
; /* output */
5535 q15_t y0
, y1
; /* Nearest output values */
5536 q31_t fract
; /* fractional part */
5537 int32_t index
; /* Index to read nearest output values */
5539 /* Input is in 12.20 format */
5540 /* 12 bits for the table index */
5541 /* Index value calculation */
5542 index
= ((x
& (int32_t)0xFFF00000) >> 20);
5544 if (index
>= (int32_t)(nValues
- 1))
5546 return (pYData
[nValues
- 1]);
5554 /* 20 bits for the fractional part */
5555 /* fract is in 12.20 format */
5556 fract
= (x
& 0x000FFFFF);
5558 /* Read two nearest output values from the index */
5560 y1
= pYData
[index
+ 1];
5562 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
5563 y
= ((q63_t
) y0
* (0xFFFFF - fract
));
5565 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
5566 y
+= ((q63_t
) y1
* (fract
));
5568 /* convert y to 1.15 format */
5569 return (q15_t
) (y
>> 20);
5576 * @brief Process function for the Q7 Linear Interpolation Function.
5577 * @param[in] pYData pointer to Q7 Linear Interpolation table
5578 * @param[in] x input sample to process
5579 * @param[in] nValues number of table values
5580 * @return y processed output sample.
5583 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5584 * This function can support maximum of table size 2^12.
5586 CMSIS_INLINE __STATIC_INLINE q7_t
arm_linear_interp_q7(
5591 q31_t y
; /* output */
5592 q7_t y0
, y1
; /* Nearest output values */
5593 q31_t fract
; /* fractional part */
5594 uint32_t index
; /* Index to read nearest output values */
5596 /* Input is in 12.20 format */
5597 /* 12 bits for the table index */
5598 /* Index value calculation */
5603 index
= (x
>> 20) & 0xfff;
5605 if (index
>= (nValues
- 1))
5607 return (pYData
[nValues
- 1]);
5611 /* 20 bits for the fractional part */
5612 /* fract is in 12.20 format */
5613 fract
= (x
& 0x000FFFFF);
5615 /* Read two nearest output values from the index and are in 1.7(q7) format */
5617 y1
= pYData
[index
+ 1];
5619 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
5620 y
= ((y0
* (0xFFFFF - fract
)));
5622 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
5625 /* convert y to 1.7(q7) format */
5626 return (q7_t
) (y
>> 20);
5631 * @} end of LinearInterpolate group
5635 * @brief Fast approximation to the trigonometric sine function for floating-point data.
5636 * @param[in] x input value in radians.
5639 float32_t
arm_sin_f32(
5644 * @brief Fast approximation to the trigonometric sine function for Q31 data.
5645 * @param[in] x Scaled input value in radians.
5653 * @brief Fast approximation to the trigonometric sine function for Q15 data.
5654 * @param[in] x Scaled input value in radians.
5662 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
5663 * @param[in] x input value in radians.
5666 float32_t
arm_cos_f32(
5671 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
5672 * @param[in] x Scaled input value in radians.
5680 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
5681 * @param[in] x Scaled input value in radians.
5689 * @ingroup groupFastMath
5694 * @defgroup SQRT Square Root
5696 * Computes the square root of a number.
5697 * There are separate functions for Q15, Q31, and floating-point data types.
5698 * The square root function is computed using the Newton-Raphson algorithm.
5699 * This is an iterative algorithm of the form:
5701 * x1 = x0 - f(x0)/f'(x0)
5703 * where <code>x1</code> is the current estimate,
5704 * <code>x0</code> is the previous estimate, and
5705 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
5706 * For the square root function, the algorithm reduces to:
5708 * x0 = in/2 [initial guess]
5709 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
5720 * @brief Floating-point square root function.
5721 * @param[in] in input value.
5722 * @param[out] pOut square root of input value.
5723 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5724 * <code>in</code> is negative value and returns zero output for negative values.
5726 CMSIS_INLINE __STATIC_INLINE arm_status
arm_sqrt_f32(
5733 #if (__FPU_USED == 1) && defined ( __CC_ARM )
5734 *pOut
= __sqrtf(in
);
5735 #elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
5736 *pOut
= __builtin_sqrtf(in
);
5737 #elif (__FPU_USED == 1) && defined(__GNUC__)
5738 *pOut
= __builtin_sqrtf(in
);
5739 #elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
5740 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut
) : "t"(in
));
5745 return (ARM_MATH_SUCCESS
);
5750 return (ARM_MATH_ARGUMENT_ERROR
);
5756 * @brief Q31 square root function.
5757 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
5758 * @param[out] pOut square root of input value.
5759 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5760 * <code>in</code> is negative value and returns zero output for negative values.
5762 arm_status
arm_sqrt_q31(
5768 * @brief Q15 square root function.
5769 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
5770 * @param[out] pOut square root of input value.
5771 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5772 * <code>in</code> is negative value and returns zero output for negative values.
5774 arm_status
arm_sqrt_q15(
5779 * @} end of SQRT group
5784 * @brief floating-point Circular write function.
5786 CMSIS_INLINE __STATIC_INLINE
void arm_circularWrite_f32(
5787 int32_t * circBuffer
,
5789 uint16_t * writeOffset
,
5791 const int32_t * src
,
5798 /* Copy the value of Index pointer that points
5799 * to the current location where the input samples to be copied */
5800 wOffset
= *writeOffset
;
5802 /* Loop over the blockSize */
5807 /* copy the input sample to the circular buffer */
5808 circBuffer
[wOffset
] = *src
;
5810 /* Update the input pointer */
5813 /* Circularly update wOffset. Watch out for positive and negative value */
5814 wOffset
+= bufferInc
;
5818 /* Decrement the loop counter */
5822 /* Update the index pointer */
5823 *writeOffset
= (uint16_t)wOffset
;
5829 * @brief floating-point Circular Read function.
5831 CMSIS_INLINE __STATIC_INLINE
void arm_circularRead_f32(
5832 int32_t * circBuffer
,
5834 int32_t * readOffset
,
5843 int32_t rOffset
, dst_end
;
5845 /* Copy the value of Index pointer that points
5846 * to the current location from where the input samples to be read */
5847 rOffset
= *readOffset
;
5848 dst_end
= (int32_t) (dst_base
+ dst_length
);
5850 /* Loop over the blockSize */
5855 /* copy the sample from the circular buffer to the destination buffer */
5856 *dst
= circBuffer
[rOffset
];
5858 /* Update the input pointer */
5861 if (dst
== (int32_t *) dst_end
)
5866 /* Circularly update rOffset. Watch out for positive and negative value */
5867 rOffset
+= bufferInc
;
5874 /* Decrement the loop counter */
5878 /* Update the index pointer */
5879 *readOffset
= rOffset
;
5884 * @brief Q15 Circular write function.
5886 CMSIS_INLINE __STATIC_INLINE
void arm_circularWrite_q15(
5889 uint16_t * writeOffset
,
5898 /* Copy the value of Index pointer that points
5899 * to the current location where the input samples to be copied */
5900 wOffset
= *writeOffset
;
5902 /* Loop over the blockSize */
5907 /* copy the input sample to the circular buffer */
5908 circBuffer
[wOffset
] = *src
;
5910 /* Update the input pointer */
5913 /* Circularly update wOffset. Watch out for positive and negative value */
5914 wOffset
+= bufferInc
;
5918 /* Decrement the loop counter */
5922 /* Update the index pointer */
5923 *writeOffset
= (uint16_t)wOffset
;
5928 * @brief Q15 Circular Read function.
5930 CMSIS_INLINE __STATIC_INLINE
void arm_circularRead_q15(
5933 int32_t * readOffset
,
5942 int32_t rOffset
, dst_end
;
5944 /* Copy the value of Index pointer that points
5945 * to the current location from where the input samples to be read */
5946 rOffset
= *readOffset
;
5948 dst_end
= (int32_t) (dst_base
+ dst_length
);
5950 /* Loop over the blockSize */
5955 /* copy the sample from the circular buffer to the destination buffer */
5956 *dst
= circBuffer
[rOffset
];
5958 /* Update the input pointer */
5961 if (dst
== (q15_t
*) dst_end
)
5966 /* Circularly update wOffset. Watch out for positive and negative value */
5967 rOffset
+= bufferInc
;
5974 /* Decrement the loop counter */
5978 /* Update the index pointer */
5979 *readOffset
= rOffset
;
5984 * @brief Q7 Circular write function.
5986 CMSIS_INLINE __STATIC_INLINE
void arm_circularWrite_q7(
5989 uint16_t * writeOffset
,
5998 /* Copy the value of Index pointer that points
5999 * to the current location where the input samples to be copied */
6000 wOffset
= *writeOffset
;
6002 /* Loop over the blockSize */
6007 /* copy the input sample to the circular buffer */
6008 circBuffer
[wOffset
] = *src
;
6010 /* Update the input pointer */
6013 /* Circularly update wOffset. Watch out for positive and negative value */
6014 wOffset
+= bufferInc
;
6018 /* Decrement the loop counter */
6022 /* Update the index pointer */
6023 *writeOffset
= (uint16_t)wOffset
;
6028 * @brief Q7 Circular Read function.
6030 CMSIS_INLINE __STATIC_INLINE
void arm_circularRead_q7(
6033 int32_t * readOffset
,
6042 int32_t rOffset
, dst_end
;
6044 /* Copy the value of Index pointer that points
6045 * to the current location from where the input samples to be read */
6046 rOffset
= *readOffset
;
6048 dst_end
= (int32_t) (dst_base
+ dst_length
);
6050 /* Loop over the blockSize */
6055 /* copy the sample from the circular buffer to the destination buffer */
6056 *dst
= circBuffer
[rOffset
];
6058 /* Update the input pointer */
6061 if (dst
== (q7_t
*) dst_end
)
6066 /* Circularly update rOffset. Watch out for positive and negative value */
6067 rOffset
+= bufferInc
;
6074 /* Decrement the loop counter */
6078 /* Update the index pointer */
6079 *readOffset
= rOffset
;
6084 * @brief Sum of the squares of the elements of a Q31 vector.
6085 * @param[in] pSrc is input pointer
6086 * @param[in] blockSize is the number of samples to process
6087 * @param[out] pResult is output value.
6096 * @brief Sum of the squares of the elements of a floating-point vector.
6097 * @param[in] pSrc is input pointer
6098 * @param[in] blockSize is the number of samples to process
6099 * @param[out] pResult is output value.
6104 float32_t
* pResult
);
6108 * @brief Sum of the squares of the elements of a Q15 vector.
6109 * @param[in] pSrc is input pointer
6110 * @param[in] blockSize is the number of samples to process
6111 * @param[out] pResult is output value.
6120 * @brief Sum of the squares of the elements of a Q7 vector.
6121 * @param[in] pSrc is input pointer
6122 * @param[in] blockSize is the number of samples to process
6123 * @param[out] pResult is output value.
6132 * @brief Mean value of a Q7 vector.
6133 * @param[in] pSrc is input pointer
6134 * @param[in] blockSize is the number of samples to process
6135 * @param[out] pResult is output value.
6144 * @brief Mean value of a Q15 vector.
6145 * @param[in] pSrc is input pointer
6146 * @param[in] blockSize is the number of samples to process
6147 * @param[out] pResult is output value.
6156 * @brief Mean value of a Q31 vector.
6157 * @param[in] pSrc is input pointer
6158 * @param[in] blockSize is the number of samples to process
6159 * @param[out] pResult is output value.
6168 * @brief Mean value of a floating-point vector.
6169 * @param[in] pSrc is input pointer
6170 * @param[in] blockSize is the number of samples to process
6171 * @param[out] pResult is output value.
6176 float32_t
* pResult
);
6180 * @brief Variance of the elements of a floating-point vector.
6181 * @param[in] pSrc is input pointer
6182 * @param[in] blockSize is the number of samples to process
6183 * @param[out] pResult is output value.
6188 float32_t
* pResult
);
6192 * @brief Variance of the elements of a Q31 vector.
6193 * @param[in] pSrc is input pointer
6194 * @param[in] blockSize is the number of samples to process
6195 * @param[out] pResult is output value.
6204 * @brief Variance of the elements of a Q15 vector.
6205 * @param[in] pSrc is input pointer
6206 * @param[in] blockSize is the number of samples to process
6207 * @param[out] pResult is output value.
6216 * @brief Root Mean Square of the elements of a floating-point vector.
6217 * @param[in] pSrc is input pointer
6218 * @param[in] blockSize is the number of samples to process
6219 * @param[out] pResult is output value.
6224 float32_t
* pResult
);
6228 * @brief Root Mean Square of the elements of a Q31 vector.
6229 * @param[in] pSrc is input pointer
6230 * @param[in] blockSize is the number of samples to process
6231 * @param[out] pResult is output value.
6240 * @brief Root Mean Square of the elements of a Q15 vector.
6241 * @param[in] pSrc is input pointer
6242 * @param[in] blockSize is the number of samples to process
6243 * @param[out] pResult is output value.
6252 * @brief Standard deviation of the elements of a floating-point vector.
6253 * @param[in] pSrc is input pointer
6254 * @param[in] blockSize is the number of samples to process
6255 * @param[out] pResult is output value.
6260 float32_t
* pResult
);
6264 * @brief Standard deviation of the elements of a Q31 vector.
6265 * @param[in] pSrc is input pointer
6266 * @param[in] blockSize is the number of samples to process
6267 * @param[out] pResult is output value.
6276 * @brief Standard deviation of the elements of a Q15 vector.
6277 * @param[in] pSrc is input pointer
6278 * @param[in] blockSize is the number of samples to process
6279 * @param[out] pResult is output value.
6288 * @brief Floating-point complex magnitude
6289 * @param[in] pSrc points to the complex input vector
6290 * @param[out] pDst points to the real output vector
6291 * @param[in] numSamples number of complex samples in the input vector
6293 void arm_cmplx_mag_f32(
6296 uint32_t numSamples
);
6300 * @brief Q31 complex magnitude
6301 * @param[in] pSrc points to the complex input vector
6302 * @param[out] pDst points to the real output vector
6303 * @param[in] numSamples number of complex samples in the input vector
6305 void arm_cmplx_mag_q31(
6308 uint32_t numSamples
);
6312 * @brief Q15 complex magnitude
6313 * @param[in] pSrc points to the complex input vector
6314 * @param[out] pDst points to the real output vector
6315 * @param[in] numSamples number of complex samples in the input vector
6317 void arm_cmplx_mag_q15(
6320 uint32_t numSamples
);
6324 * @brief Q15 complex dot product
6325 * @param[in] pSrcA points to the first input vector
6326 * @param[in] pSrcB points to the second input vector
6327 * @param[in] numSamples number of complex samples in each vector
6328 * @param[out] realResult real part of the result returned here
6329 * @param[out] imagResult imaginary part of the result returned here
6331 void arm_cmplx_dot_prod_q15(
6334 uint32_t numSamples
,
6336 q31_t
* imagResult
);
6340 * @brief Q31 complex dot product
6341 * @param[in] pSrcA points to the first input vector
6342 * @param[in] pSrcB points to the second input vector
6343 * @param[in] numSamples number of complex samples in each vector
6344 * @param[out] realResult real part of the result returned here
6345 * @param[out] imagResult imaginary part of the result returned here
6347 void arm_cmplx_dot_prod_q31(
6350 uint32_t numSamples
,
6352 q63_t
* imagResult
);
6356 * @brief Floating-point complex dot product
6357 * @param[in] pSrcA points to the first input vector
6358 * @param[in] pSrcB points to the second input vector
6359 * @param[in] numSamples number of complex samples in each vector
6360 * @param[out] realResult real part of the result returned here
6361 * @param[out] imagResult imaginary part of the result returned here
6363 void arm_cmplx_dot_prod_f32(
6366 uint32_t numSamples
,
6367 float32_t
* realResult
,
6368 float32_t
* imagResult
);
6372 * @brief Q15 complex-by-real multiplication
6373 * @param[in] pSrcCmplx points to the complex input vector
6374 * @param[in] pSrcReal points to the real input vector
6375 * @param[out] pCmplxDst points to the complex output vector
6376 * @param[in] numSamples number of samples in each vector
6378 void arm_cmplx_mult_real_q15(
6382 uint32_t numSamples
);
6386 * @brief Q31 complex-by-real multiplication
6387 * @param[in] pSrcCmplx points to the complex input vector
6388 * @param[in] pSrcReal points to the real input vector
6389 * @param[out] pCmplxDst points to the complex output vector
6390 * @param[in] numSamples number of samples in each vector
6392 void arm_cmplx_mult_real_q31(
6396 uint32_t numSamples
);
6400 * @brief Floating-point complex-by-real multiplication
6401 * @param[in] pSrcCmplx points to the complex input vector
6402 * @param[in] pSrcReal points to the real input vector
6403 * @param[out] pCmplxDst points to the complex output vector
6404 * @param[in] numSamples number of samples in each vector
6406 void arm_cmplx_mult_real_f32(
6407 float32_t
* pSrcCmplx
,
6408 float32_t
* pSrcReal
,
6409 float32_t
* pCmplxDst
,
6410 uint32_t numSamples
);
6414 * @brief Minimum value of a Q7 vector.
6415 * @param[in] pSrc is input pointer
6416 * @param[in] blockSize is the number of samples to process
6417 * @param[out] result is output pointer
6418 * @param[in] index is the array index of the minimum value in the input buffer.
6428 * @brief Minimum value of a Q15 vector.
6429 * @param[in] pSrc is input pointer
6430 * @param[in] blockSize is the number of samples to process
6431 * @param[out] pResult is output pointer
6432 * @param[in] pIndex is the array index of the minimum value in the input buffer.
6442 * @brief Minimum value of a Q31 vector.
6443 * @param[in] pSrc is input pointer
6444 * @param[in] blockSize is the number of samples to process
6445 * @param[out] pResult is output pointer
6446 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6456 * @brief Minimum value of a floating-point vector.
6457 * @param[in] pSrc is input pointer
6458 * @param[in] blockSize is the number of samples to process
6459 * @param[out] pResult is output pointer
6460 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6465 float32_t
* pResult
,
6470 * @brief Maximum value of a Q7 vector.
6471 * @param[in] pSrc points to the input buffer
6472 * @param[in] blockSize length of the input vector
6473 * @param[out] pResult maximum value returned here
6474 * @param[out] pIndex index of maximum value returned here
6484 * @brief Maximum value of a Q15 vector.
6485 * @param[in] pSrc points to the input buffer
6486 * @param[in] blockSize length of the input vector
6487 * @param[out] pResult maximum value returned here
6488 * @param[out] pIndex index of maximum value returned here
6498 * @brief Maximum value of a Q31 vector.
6499 * @param[in] pSrc points to the input buffer
6500 * @param[in] blockSize length of the input vector
6501 * @param[out] pResult maximum value returned here
6502 * @param[out] pIndex index of maximum value returned here
6512 * @brief Maximum value of a floating-point vector.
6513 * @param[in] pSrc points to the input buffer
6514 * @param[in] blockSize length of the input vector
6515 * @param[out] pResult maximum value returned here
6516 * @param[out] pIndex index of maximum value returned here
6521 float32_t
* pResult
,
6526 * @brief Q15 complex-by-complex multiplication
6527 * @param[in] pSrcA points to the first input vector
6528 * @param[in] pSrcB points to the second input vector
6529 * @param[out] pDst points to the output vector
6530 * @param[in] numSamples number of complex samples in each vector
6532 void arm_cmplx_mult_cmplx_q15(
6536 uint32_t numSamples
);
6540 * @brief Q31 complex-by-complex multiplication
6541 * @param[in] pSrcA points to the first input vector
6542 * @param[in] pSrcB points to the second input vector
6543 * @param[out] pDst points to the output vector
6544 * @param[in] numSamples number of complex samples in each vector
6546 void arm_cmplx_mult_cmplx_q31(
6550 uint32_t numSamples
);
6554 * @brief Floating-point complex-by-complex multiplication
6555 * @param[in] pSrcA points to the first input vector
6556 * @param[in] pSrcB points to the second input vector
6557 * @param[out] pDst points to the output vector
6558 * @param[in] numSamples number of complex samples in each vector
6560 void arm_cmplx_mult_cmplx_f32(
6564 uint32_t numSamples
);
6568 * @brief Converts the elements of the floating-point vector to Q31 vector.
6569 * @param[in] pSrc points to the floating-point input vector
6570 * @param[out] pDst points to the Q31 output vector
6571 * @param[in] blockSize length of the input vector
6573 void arm_float_to_q31(
6576 uint32_t blockSize
);
6580 * @brief Converts the elements of the floating-point vector to Q15 vector.
6581 * @param[in] pSrc points to the floating-point input vector
6582 * @param[out] pDst points to the Q15 output vector
6583 * @param[in] blockSize length of the input vector
6585 void arm_float_to_q15(
6588 uint32_t blockSize
);
6592 * @brief Converts the elements of the floating-point vector to Q7 vector.
6593 * @param[in] pSrc points to the floating-point input vector
6594 * @param[out] pDst points to the Q7 output vector
6595 * @param[in] blockSize length of the input vector
6597 void arm_float_to_q7(
6600 uint32_t blockSize
);
6604 * @brief Converts the elements of the Q31 vector to Q15 vector.
6605 * @param[in] pSrc is input pointer
6606 * @param[out] pDst is output pointer
6607 * @param[in] blockSize is the number of samples to process
6609 void arm_q31_to_q15(
6612 uint32_t blockSize
);
6616 * @brief Converts the elements of the Q31 vector to Q7 vector.
6617 * @param[in] pSrc is input pointer
6618 * @param[out] pDst is output pointer
6619 * @param[in] blockSize is the number of samples to process
6624 uint32_t blockSize
);
6628 * @brief Converts the elements of the Q15 vector to floating-point vector.
6629 * @param[in] pSrc is input pointer
6630 * @param[out] pDst is output pointer
6631 * @param[in] blockSize is the number of samples to process
6633 void arm_q15_to_float(
6636 uint32_t blockSize
);
6640 * @brief Converts the elements of the Q15 vector to Q31 vector.
6641 * @param[in] pSrc is input pointer
6642 * @param[out] pDst is output pointer
6643 * @param[in] blockSize is the number of samples to process
6645 void arm_q15_to_q31(
6648 uint32_t blockSize
);
6652 * @brief Converts the elements of the Q15 vector to Q7 vector.
6653 * @param[in] pSrc is input pointer
6654 * @param[out] pDst is output pointer
6655 * @param[in] blockSize is the number of samples to process
6660 uint32_t blockSize
);
6664 * @ingroup groupInterpolation
6668 * @defgroup BilinearInterpolate Bilinear Interpolation
6670 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
6671 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
6672 * determines values between the grid points.
6673 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
6674 * Bilinear interpolation is often used in image processing to rescale images.
6675 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
6679 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
6680 * For floating-point, the instance structure is defined as:
6687 * } arm_bilinear_interp_instance_f32;
6691 * where <code>numRows</code> specifies the number of rows in the table;
6692 * <code>numCols</code> specifies the number of columns in the table;
6693 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
6694 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
6695 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
6698 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
6704 * The interpolated output point is computed as:
6706 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
6707 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
6708 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
6709 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
6711 * Note that the coordinates (x, y) contain integer and fractional components.
6712 * The integer components specify which portion of the table to use while the
6713 * fractional components control the interpolation processor.
6716 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
6720 * @addtogroup BilinearInterpolate
6727 * @brief Floating-point bilinear interpolation.
6728 * @param[in,out] S points to an instance of the interpolation structure.
6729 * @param[in] X interpolation coordinate.
6730 * @param[in] Y interpolation coordinate.
6731 * @return out interpolated value.
6733 CMSIS_INLINE __STATIC_INLINE float32_t
arm_bilinear_interp_f32(
6734 const arm_bilinear_interp_instance_f32
* S
,
6739 float32_t f00
, f01
, f10
, f11
;
6740 float32_t
*pData
= S
->pData
;
6741 int32_t xIndex
, yIndex
, index
;
6742 float32_t xdiff
, ydiff
;
6743 float32_t b1
, b2
, b3
, b4
;
6745 xIndex
= (int32_t) X
;
6746 yIndex
= (int32_t) Y
;
6748 /* Care taken for table outside boundary */
6749 /* Returns zero output when values are outside table boundary */
6750 if (xIndex
< 0 || xIndex
> (S
->numRows
- 1) || yIndex
< 0 || yIndex
> (S
->numCols
- 1))
6755 /* Calculation of index for two nearest points in X-direction */
6756 index
= (xIndex
- 1) + (yIndex
- 1) * S
->numCols
;
6759 /* Read two nearest points in X-direction */
6761 f01
= pData
[index
+ 1];
6763 /* Calculation of index for two nearest points in Y-direction */
6764 index
= (xIndex
- 1) + (yIndex
) * S
->numCols
;
6767 /* Read two nearest points in Y-direction */
6769 f11
= pData
[index
+ 1];
6771 /* Calculation of intermediate values */
6775 b4
= f00
- f01
- f10
+ f11
;
6777 /* Calculation of fractional part in X */
6780 /* Calculation of fractional part in Y */
6783 /* Calculation of bi-linear interpolated output */
6784 out
= b1
+ b2
* xdiff
+ b3
* ydiff
+ b4
* xdiff
* ydiff
;
6786 /* return to application */
6793 * @brief Q31 bilinear interpolation.
6794 * @param[in,out] S points to an instance of the interpolation structure.
6795 * @param[in] X interpolation coordinate in 12.20 format.
6796 * @param[in] Y interpolation coordinate in 12.20 format.
6797 * @return out interpolated value.
6799 CMSIS_INLINE __STATIC_INLINE q31_t
arm_bilinear_interp_q31(
6800 arm_bilinear_interp_instance_q31
* S
,
6804 q31_t out
; /* Temporary output */
6805 q31_t acc
= 0; /* output */
6806 q31_t xfract
, yfract
; /* X, Y fractional parts */
6807 q31_t x1
, x2
, y1
, y2
; /* Nearest output values */
6808 int32_t rI
, cI
; /* Row and column indices */
6809 q31_t
*pYData
= S
->pData
; /* pointer to output table values */
6810 uint32_t nCols
= S
->numCols
; /* num of rows */
6812 /* Input is in 12.20 format */
6813 /* 12 bits for the table index */
6814 /* Index value calculation */
6815 rI
= ((X
& (q31_t
)0xFFF00000) >> 20);
6817 /* Input is in 12.20 format */
6818 /* 12 bits for the table index */
6819 /* Index value calculation */
6820 cI
= ((Y
& (q31_t
)0xFFF00000) >> 20);
6822 /* Care taken for table outside boundary */
6823 /* Returns zero output when values are outside table boundary */
6824 if (rI
< 0 || rI
> (S
->numRows
- 1) || cI
< 0 || cI
> (S
->numCols
- 1))
6829 /* 20 bits for the fractional part */
6830 /* shift left xfract by 11 to keep 1.31 format */
6831 xfract
= (X
& 0x000FFFFF) << 11U;
6833 /* Read two nearest output values from the index */
6834 x1
= pYData
[(rI
) + (int32_t)nCols
* (cI
) ];
6835 x2
= pYData
[(rI
) + (int32_t)nCols
* (cI
) + 1];
6837 /* 20 bits for the fractional part */
6838 /* shift left yfract by 11 to keep 1.31 format */
6839 yfract
= (Y
& 0x000FFFFF) << 11U;
6841 /* Read two nearest output values from the index */
6842 y1
= pYData
[(rI
) + (int32_t)nCols
* (cI
+ 1) ];
6843 y2
= pYData
[(rI
) + (int32_t)nCols
* (cI
+ 1) + 1];
6845 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
6846 out
= ((q31_t
) (((q63_t
) x1
* (0x7FFFFFFF - xfract
)) >> 32));
6847 acc
= ((q31_t
) (((q63_t
) out
* (0x7FFFFFFF - yfract
)) >> 32));
6849 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
6850 out
= ((q31_t
) ((q63_t
) x2
* (0x7FFFFFFF - yfract
) >> 32));
6851 acc
+= ((q31_t
) ((q63_t
) out
* (xfract
) >> 32));
6853 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
6854 out
= ((q31_t
) ((q63_t
) y1
* (0x7FFFFFFF - xfract
) >> 32));
6855 acc
+= ((q31_t
) ((q63_t
) out
* (yfract
) >> 32));
6857 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
6858 out
= ((q31_t
) ((q63_t
) y2
* (xfract
) >> 32));
6859 acc
+= ((q31_t
) ((q63_t
) out
* (yfract
) >> 32));
6861 /* Convert acc to 1.31(q31) format */
6862 return ((q31_t
)(acc
<< 2));
6867 * @brief Q15 bilinear interpolation.
6868 * @param[in,out] S points to an instance of the interpolation structure.
6869 * @param[in] X interpolation coordinate in 12.20 format.
6870 * @param[in] Y interpolation coordinate in 12.20 format.
6871 * @return out interpolated value.
6873 CMSIS_INLINE __STATIC_INLINE q15_t
arm_bilinear_interp_q15(
6874 arm_bilinear_interp_instance_q15
* S
,
6878 q63_t acc
= 0; /* output */
6879 q31_t out
; /* Temporary output */
6880 q15_t x1
, x2
, y1
, y2
; /* Nearest output values */
6881 q31_t xfract
, yfract
; /* X, Y fractional parts */
6882 int32_t rI
, cI
; /* Row and column indices */
6883 q15_t
*pYData
= S
->pData
; /* pointer to output table values */
6884 uint32_t nCols
= S
->numCols
; /* num of rows */
6886 /* Input is in 12.20 format */
6887 /* 12 bits for the table index */
6888 /* Index value calculation */
6889 rI
= ((X
& (q31_t
)0xFFF00000) >> 20);
6891 /* Input is in 12.20 format */
6892 /* 12 bits for the table index */
6893 /* Index value calculation */
6894 cI
= ((Y
& (q31_t
)0xFFF00000) >> 20);
6896 /* Care taken for table outside boundary */
6897 /* Returns zero output when values are outside table boundary */
6898 if (rI
< 0 || rI
> (S
->numRows
- 1) || cI
< 0 || cI
> (S
->numCols
- 1))
6903 /* 20 bits for the fractional part */
6904 /* xfract should be in 12.20 format */
6905 xfract
= (X
& 0x000FFFFF);
6907 /* Read two nearest output values from the index */
6908 x1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) ];
6909 x2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) + 1];
6911 /* 20 bits for the fractional part */
6912 /* yfract should be in 12.20 format */
6913 yfract
= (Y
& 0x000FFFFF);
6915 /* Read two nearest output values from the index */
6916 y1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) ];
6917 y2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) + 1];
6919 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
6921 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
6922 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
6923 out
= (q31_t
) (((q63_t
) x1
* (0xFFFFF - xfract
)) >> 4U);
6924 acc
= ((q63_t
) out
* (0xFFFFF - yfract
));
6926 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
6927 out
= (q31_t
) (((q63_t
) x2
* (0xFFFFF - yfract
)) >> 4U);
6928 acc
+= ((q63_t
) out
* (xfract
));
6930 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
6931 out
= (q31_t
) (((q63_t
) y1
* (0xFFFFF - xfract
)) >> 4U);
6932 acc
+= ((q63_t
) out
* (yfract
));
6934 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
6935 out
= (q31_t
) (((q63_t
) y2
* (xfract
)) >> 4U);
6936 acc
+= ((q63_t
) out
* (yfract
));
6938 /* acc is in 13.51 format and down shift acc by 36 times */
6939 /* Convert out to 1.15 format */
6940 return ((q15_t
)(acc
>> 36));
6945 * @brief Q7 bilinear interpolation.
6946 * @param[in,out] S points to an instance of the interpolation structure.
6947 * @param[in] X interpolation coordinate in 12.20 format.
6948 * @param[in] Y interpolation coordinate in 12.20 format.
6949 * @return out interpolated value.
6951 CMSIS_INLINE __STATIC_INLINE q7_t
arm_bilinear_interp_q7(
6952 arm_bilinear_interp_instance_q7
* S
,
6956 q63_t acc
= 0; /* output */
6957 q31_t out
; /* Temporary output */
6958 q31_t xfract
, yfract
; /* X, Y fractional parts */
6959 q7_t x1
, x2
, y1
, y2
; /* Nearest output values */
6960 int32_t rI
, cI
; /* Row and column indices */
6961 q7_t
*pYData
= S
->pData
; /* pointer to output table values */
6962 uint32_t nCols
= S
->numCols
; /* num of rows */
6964 /* Input is in 12.20 format */
6965 /* 12 bits for the table index */
6966 /* Index value calculation */
6967 rI
= ((X
& (q31_t
)0xFFF00000) >> 20);
6969 /* Input is in 12.20 format */
6970 /* 12 bits for the table index */
6971 /* Index value calculation */
6972 cI
= ((Y
& (q31_t
)0xFFF00000) >> 20);
6974 /* Care taken for table outside boundary */
6975 /* Returns zero output when values are outside table boundary */
6976 if (rI
< 0 || rI
> (S
->numRows
- 1) || cI
< 0 || cI
> (S
->numCols
- 1))
6981 /* 20 bits for the fractional part */
6982 /* xfract should be in 12.20 format */
6983 xfract
= (X
& (q31_t
)0x000FFFFF);
6985 /* Read two nearest output values from the index */
6986 x1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) ];
6987 x2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) + 1];
6989 /* 20 bits for the fractional part */
6990 /* yfract should be in 12.20 format */
6991 yfract
= (Y
& (q31_t
)0x000FFFFF);
6993 /* Read two nearest output values from the index */
6994 y1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) ];
6995 y2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) + 1];
6997 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
6998 out
= ((x1
* (0xFFFFF - xfract
)));
6999 acc
= (((q63_t
) out
* (0xFFFFF - yfract
)));
7001 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
7002 out
= ((x2
* (0xFFFFF - yfract
)));
7003 acc
+= (((q63_t
) out
* (xfract
)));
7005 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
7006 out
= ((y1
* (0xFFFFF - xfract
)));
7007 acc
+= (((q63_t
) out
* (yfract
)));
7009 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
7010 out
= ((y2
* (yfract
)));
7011 acc
+= (((q63_t
) out
* (xfract
)));
7013 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
7014 return ((q7_t
)(acc
>> 40));
7018 * @} end of BilinearInterpolate group
7023 #define multAcc_32x32_keep32_R(a, x, y) \
7024 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
7027 #define multSub_32x32_keep32_R(a, x, y) \
7028 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
7031 #define mult_32x32_keep32_R(a, x, y) \
7032 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
7035 #define multAcc_32x32_keep32(a, x, y) \
7036 a += (q31_t) (((q63_t) x * y) >> 32)
7039 #define multSub_32x32_keep32(a, x, y) \
7040 a -= (q31_t) (((q63_t) x * y) >> 32)
7043 #define mult_32x32_keep32(a, x, y) \
7044 a = (q31_t) (((q63_t) x * y ) >> 32)
7047 #if defined ( __CC_ARM )
7048 /* Enter low optimization region - place directly above function definition */
7049 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
7050 #define LOW_OPTIMIZATION_ENTER \
7054 #define LOW_OPTIMIZATION_ENTER
7057 /* Exit low optimization region - place directly after end of function definition */
7058 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
7059 #define LOW_OPTIMIZATION_EXIT \
7062 #define LOW_OPTIMIZATION_EXIT
7065 /* Enter low optimization region - place directly above function definition */
7066 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7068 /* Exit low optimization region - place directly after end of function definition */
7069 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7071 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
7072 #define LOW_OPTIMIZATION_ENTER
7073 #define LOW_OPTIMIZATION_EXIT
7074 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7075 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7077 #elif defined ( __GNUC__ )
7078 #define LOW_OPTIMIZATION_ENTER \
7079 __attribute__(( optimize("-O1") ))
7080 #define LOW_OPTIMIZATION_EXIT
7081 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7082 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7084 #elif defined ( __ICCARM__ )
7085 /* Enter low optimization region - place directly above function definition */
7086 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
7087 #define LOW_OPTIMIZATION_ENTER \
7088 _Pragma ("optimize=low")
7090 #define LOW_OPTIMIZATION_ENTER
7093 /* Exit low optimization region - place directly after end of function definition */
7094 #define LOW_OPTIMIZATION_EXIT
7096 /* Enter low optimization region - place directly above function definition */
7097 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
7098 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
7099 _Pragma ("optimize=low")
7101 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7104 /* Exit low optimization region - place directly after end of function definition */
7105 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7107 #elif defined ( __TI_ARM__ )
7108 #define LOW_OPTIMIZATION_ENTER
7109 #define LOW_OPTIMIZATION_EXIT
7110 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7111 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7113 #elif defined ( __CSMC__ )
7114 #define LOW_OPTIMIZATION_ENTER
7115 #define LOW_OPTIMIZATION_EXIT
7116 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7117 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7119 #elif defined ( __TASKING__ )
7120 #define LOW_OPTIMIZATION_ENTER
7121 #define LOW_OPTIMIZATION_EXIT
7122 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7123 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7132 /* Compiler specific diagnostic adjustment */
7133 #if defined ( __CC_ARM )
7135 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
7137 #elif defined ( __GNUC__ )
7138 #pragma GCC diagnostic pop
7140 #elif defined ( __ICCARM__ )
7142 #elif defined ( __TI_ARM__ )
7144 #elif defined ( __CSMC__ )
7146 #elif defined ( __TASKING__ )
7149 #error Unknown compiler
7152 #endif /* _ARM_MATH_H */