1 /* ----------------------------------------------------------------------
2 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
4 * $Date: 20. October 2015
7 * Project: CMSIS DSP Library
10 * Description: Public header file for CMSIS DSP Library
12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
17 * - Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * - Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in
21 * the documentation and/or other materials provided with the
23 * - Neither the name of ARM LIMITED nor the names of its contributors
24 * may be used to endorse or promote products derived from this
25 * software without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 * -------------------------------------------------------------------- */
42 \mainpage CMSIS DSP Software Library
47 * This user manual describes the CMSIS DSP software library,
48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
50 * The library is divided into a number of functions each covering a specific category:
51 * - Basic math functions
52 * - Fast math functions
53 * - Complex math functions
57 * - Motor control functions
58 * - Statistical functions
60 * - Interpolation functions
62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
63 * 32-bit integer and 32-bit floating-point values.
68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
69 * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
70 * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
71 * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
72 * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
73 * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
74 * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
75 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
76 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
77 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
78 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
79 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
80 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
81 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
82 * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
84 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
85 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
86 * public header file <code> arm_math.h</code> for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
87 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
88 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
93 * The library ships with a number of examples which demonstrate how to use the library functions.
98 * The library has been developed and tested with MDK-ARM version 5.14.0.0
99 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
101 * Building the Library
104 * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
105 * - arm_cortexM_math.uvprojx
108 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
110 * Pre-processor Macros
113 * Each library project have differant pre-processor macros.
115 * - UNALIGNED_SUPPORT_DISABLE:
117 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
119 * - ARM_MATH_BIG_ENDIAN:
121 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
123 * - ARM_MATH_MATRIX_CHECK:
125 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
127 * - ARM_MATH_ROUNDING:
129 * Define macro ARM_MATH_ROUNDING for rounding on support functions
133 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
134 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
135 * ARM_MATH_CM7 for building the library on cortex-M7.
139 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
142 * CMSIS-DSP in ARM::CMSIS Pack
143 * -----------------------------
145 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
146 * |File/Folder |Content |
147 * |------------------------------|------------------------------------------------------------------------|
148 * |\b CMSIS\\Documentation\\DSP | This documentation |
149 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
150 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
151 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
154 * Revision History of CMSIS-DSP
156 * Please refer to \ref ChangeLog_pg.
161 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
166 * @defgroup groupMath Basic Math Functions
170 * @defgroup groupFastMath Fast Math Functions
171 * This set of functions provides a fast approximation to sine, cosine, and square root.
172 * As compared to most of the other functions in the CMSIS math library, the fast math functions
173 * operate on individual values and not arrays.
174 * There are separate functions for Q15, Q31, and floating-point data.
179 * @defgroup groupCmplxMath Complex Math Functions
180 * This set of functions operates on complex data vectors.
181 * The data in the complex arrays is stored in an interleaved fashion
182 * (real, imag, real, imag, ...).
183 * In the API functions, the number of samples in a complex array refers
184 * to the number of complex values; the array contains twice this number of
189 * @defgroup groupFilters Filtering Functions
193 * @defgroup groupMatrix Matrix Functions
195 * This set of functions provides basic matrix math operations.
196 * The functions operate on matrix data structures. For example,
198 * definition for the floating-point matrix structure is shown
203 * uint16_t numRows; // number of rows of the matrix.
204 * uint16_t numCols; // number of columns of the matrix.
205 * float32_t *pData; // points to the data of the matrix.
206 * } arm_matrix_instance_f32;
208 * There are similar definitions for Q15 and Q31 data types.
210 * The structure specifies the size of the matrix and then points to
211 * an array of data. The array is of size <code>numRows X numCols</code>
212 * and the values are arranged in row order. That is, the
213 * matrix element (i, j) is stored at:
215 * pData[i*numCols + j]
218 * \par Init Functions
219 * There is an associated initialization function for each type of matrix
221 * The initialization function sets the values of the internal structure fields.
222 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
223 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
226 * Use of the initialization function is optional. However, if initialization function is used
227 * then the instance structure cannot be placed into a const data section.
228 * To place the instance structure in a const data
229 * section, manually initialize the data structure. For example:
231 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
232 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
233 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
235 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
236 * specifies the number of columns, and <code>pData</code> points to the
240 * By default all of the matrix functions perform size checking on the input and
241 * output matrices. For example, the matrix addition function verifies that the
242 * two input matrices and the output matrix all have the same number of rows and
243 * columns. If the size check fails the functions return:
245 * ARM_MATH_SIZE_MISMATCH
247 * Otherwise the functions return
251 * There is some overhead associated with this matrix size checking.
252 * The matrix size checking is enabled via the \#define
254 * ARM_MATH_MATRIX_CHECK
256 * within the library project settings. By default this macro is defined
257 * and size checking is enabled. By changing the project settings and
258 * undefining this macro size checking is eliminated and the functions
259 * run a bit faster. With size checking disabled the functions always
260 * return <code>ARM_MATH_SUCCESS</code>.
264 * @defgroup groupTransforms Transform Functions
268 * @defgroup groupController Controller Functions
272 * @defgroup groupStats Statistics Functions
275 * @defgroup groupSupport Support Functions
279 * @defgroup groupInterpolation Interpolation Functions
280 * These functions perform 1- and 2-dimensional interpolation of data.
281 * Linear interpolation is used for 1-dimensional data and
282 * bilinear interpolation is used for 2-dimensional data.
286 * @defgroup groupExamples Examples
291 /* ignore some GCC warnings */
292 #if defined ( __GNUC__ )
293 #pragma GCC diagnostic push
294 #pragma GCC diagnostic ignored "-Wsign-conversion"
295 #pragma GCC diagnostic ignored "-Wconversion"
296 #pragma GCC diagnostic ignored "-Wunused-parameter"
299 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
301 #if defined(ARM_MATH_CM7)
302 #include "core_cm7.h"
303 #elif defined (ARM_MATH_CM4)
304 #include "core_cm4.h"
305 #elif defined (ARM_MATH_CM3)
306 #include "core_cm3.h"
307 #elif defined (ARM_MATH_CM0)
308 #include "core_cm0.h"
309 #define ARM_MATH_CM0_FAMILY
310 #elif defined (ARM_MATH_CM0PLUS)
311 #include "core_cm0plus.h"
312 #define ARM_MATH_CM0_FAMILY
314 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
317 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
327 * @brief Macros required for reciprocal calculation in Normalized LMS
330 #define DELTA_Q31 (0x100)
331 #define DELTA_Q15 0x5
332 #define INDEX_MASK 0x0000003F
334 #define PI 3.14159265358979f
338 * @brief Macros required for SINE and COSINE Fast math approximations
341 #define FAST_MATH_TABLE_SIZE 512
342 #define FAST_MATH_Q31_SHIFT (32 - 10)
343 #define FAST_MATH_Q15_SHIFT (16 - 10)
344 #define CONTROLLER_Q31_SHIFT (32 - 9)
345 #define TABLE_SIZE 256
346 #define TABLE_SPACING_Q31 0x400000
347 #define TABLE_SPACING_Q15 0x80
350 * @brief Macros required for SINE and COSINE Controller functions
352 /* 1.31(q31) Fixed value of 2/360 */
353 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
354 #define INPUT_SPACING 0xB60B61
357 * @brief Macro for Unaligned Support
359 #ifndef UNALIGNED_SUPPORT_DISABLE
362 #if defined (__GNUC__)
363 #define ALIGN4 __attribute__((aligned(4)))
365 #define ALIGN4 __align(4)
367 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
370 * @brief Error status returned by some functions in the library.
375 ARM_MATH_SUCCESS
= 0, /**< No error */
376 ARM_MATH_ARGUMENT_ERROR
= -1, /**< One or more arguments are incorrect */
377 ARM_MATH_LENGTH_ERROR
= -2, /**< Length of data buffer is incorrect */
378 ARM_MATH_SIZE_MISMATCH
= -3, /**< Size of matrices is not compatible with the operation. */
379 ARM_MATH_NANINF
= -4, /**< Not-a-number (NaN) or infinity is generated */
380 ARM_MATH_SINGULAR
= -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
381 ARM_MATH_TEST_FAILURE
= -6 /**< Test Failed */
385 * @brief 8-bit fractional data type in 1.7 format.
390 * @brief 16-bit fractional data type in 1.15 format.
392 typedef int16_t q15_t
;
395 * @brief 32-bit fractional data type in 1.31 format.
397 typedef int32_t q31_t
;
400 * @brief 64-bit fractional data type in 1.63 format.
402 typedef int64_t q63_t
;
405 * @brief 32-bit floating-point type definition.
407 typedef float float32_t
;
410 * @brief 64-bit floating-point type definition.
412 typedef double float64_t
;
415 * @brief definition to read/write two 16 bit values.
418 #define __SIMD32_TYPE int32_t __packed
419 #define CMSIS_UNUSED __attribute__((unused))
421 #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
422 #define __SIMD32_TYPE int32_t
423 #define CMSIS_UNUSED __attribute__((unused))
425 #elif defined __GNUC__
426 #define __SIMD32_TYPE int32_t
427 #define CMSIS_UNUSED __attribute__((unused))
429 #elif defined __ICCARM__
430 #define __SIMD32_TYPE int32_t __packed
433 #elif defined __CSMC__
434 #define __SIMD32_TYPE int32_t
437 #elif defined __TASKING__
438 #define __SIMD32_TYPE __unaligned int32_t
442 #error Unknown compiler
445 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
446 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
447 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
448 #define __SIMD64(addr) (*(int64_t **) & (addr))
450 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
452 * @brief definition to pack two 16 bit values.
454 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
455 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
456 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
457 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
463 * @brief definition to pack four 8 bit values.
465 #ifndef ARM_MATH_BIG_ENDIAN
467 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
468 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
469 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
470 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
473 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
474 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
475 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
476 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
482 * @brief Clips Q63 to Q31 values.
484 static __INLINE q31_t
clip_q63_to_q31(
487 return ((q31_t
) (x
>> 32) != ((q31_t
) x
>> 31)) ?
488 ((0x7FFFFFFF ^ ((q31_t
) (x
>> 63)))) : (q31_t
) x
;
492 * @brief Clips Q63 to Q15 values.
494 static __INLINE q15_t
clip_q63_to_q15(
497 return ((q31_t
) (x
>> 32) != ((q31_t
) x
>> 31)) ?
498 ((0x7FFF ^ ((q15_t
) (x
>> 63)))) : (q15_t
) (x
>> 15);
502 * @brief Clips Q31 to Q7 values.
504 static __INLINE q7_t
clip_q31_to_q7(
507 return ((q31_t
) (x
>> 24) != ((q31_t
) x
>> 23)) ?
508 ((0x7F ^ ((q7_t
) (x
>> 31)))) : (q7_t
) x
;
512 * @brief Clips Q31 to Q15 values.
514 static __INLINE q15_t
clip_q31_to_q15(
517 return ((q31_t
) (x
>> 16) != ((q31_t
) x
>> 15)) ?
518 ((0x7FFF ^ ((q15_t
) (x
>> 31)))) : (q15_t
) x
;
522 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
525 static __INLINE q63_t
mult32x64(
529 return ((((q63_t
) (x
& 0x00000000FFFFFFFF) * y
) >> 32) +
530 (((q63_t
) (x
>> 32) * y
)));
534 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
538 /* note: function can be removed when all toolchain support __CLZ for Cortex-M0 */
539 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
540 static __INLINE
uint32_t __CLZ(
543 static __INLINE
uint32_t __CLZ(
547 uint32_t mask
= 0x80000000;
549 while((data
& mask
) == 0)
560 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
563 static __INLINE
uint32_t arm_recip_q31(
575 signBits
= ((uint32_t) (__CLZ( in
) - 1));
579 signBits
= ((uint32_t) (__CLZ(-in
) - 1));
582 /* Convert input sample to 1.31 format */
583 in
= (in
<< signBits
);
585 /* calculation of index for initial approximated Val */
586 index
= (uint32_t)(in
>> 24);
587 index
= (index
& INDEX_MASK
);
589 /* 1.31 with exp 1 */
590 out
= pRecipTable
[index
];
592 /* calculation of reciprocal value */
593 /* running approximation for two iterations */
594 for (i
= 0u; i
< 2u; i
++)
596 tempVal
= (uint32_t) (((q63_t
) in
* out
) >> 31);
597 tempVal
= 0x7FFFFFFFu
- tempVal
;
598 /* 1.31 with exp 1 */
599 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
600 out
= clip_q63_to_q31(((q63_t
) out
* tempVal
) >> 30);
606 /* return num of signbits of out = 1/in value */
607 return (signBits
+ 1u);
612 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
614 static __INLINE
uint32_t arm_recip_q15(
620 uint32_t tempVal
= 0;
621 uint32_t index
= 0, i
= 0;
622 uint32_t signBits
= 0;
626 signBits
= ((uint32_t)(__CLZ( in
) - 17));
630 signBits
= ((uint32_t)(__CLZ(-in
) - 17));
633 /* Convert input sample to 1.15 format */
634 in
= (in
<< signBits
);
636 /* calculation of index for initial approximated Val */
637 index
= (uint32_t)(in
>> 8);
638 index
= (index
& INDEX_MASK
);
640 /* 1.15 with exp 1 */
641 out
= pRecipTable
[index
];
643 /* calculation of reciprocal value */
644 /* running approximation for two iterations */
645 for (i
= 0u; i
< 2u; i
++)
647 tempVal
= (uint32_t) (((q31_t
) in
* out
) >> 15);
648 tempVal
= 0x7FFFu
- tempVal
;
649 /* 1.15 with exp 1 */
650 out
= (q15_t
) (((q31_t
) out
* tempVal
) >> 14);
651 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
657 /* return num of signbits of out = 1/in value */
658 return (signBits
+ 1);
663 * @brief C custom defined intrinisic function for only M0 processors
665 #if defined(ARM_MATH_CM0_FAMILY)
666 static __INLINE q31_t
__SSAT(
670 int32_t posMax
, negMin
;
674 for (i
= 0; i
< (y
- 1); i
++)
681 posMax
= (posMax
- 1);
699 #endif /* end of ARM_MATH_CM0_FAMILY */
703 * @brief C custom defined intrinsic function for M3 and M0 processors
705 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
708 * @brief C custom defined QADD8 for M3 and M0 processors
710 static __INLINE
uint32_t __QADD8(
716 r
= __SSAT(((((q31_t
)x
<< 24) >> 24) + (((q31_t
)y
<< 24) >> 24)), 8) & (int32_t)0x000000FF;
717 s
= __SSAT(((((q31_t
)x
<< 16) >> 24) + (((q31_t
)y
<< 16) >> 24)), 8) & (int32_t)0x000000FF;
718 t
= __SSAT(((((q31_t
)x
<< 8) >> 24) + (((q31_t
)y
<< 8) >> 24)), 8) & (int32_t)0x000000FF;
719 u
= __SSAT(((((q31_t
)x
) >> 24) + (((q31_t
)y
) >> 24)), 8) & (int32_t)0x000000FF;
721 return ((uint32_t)((u
<< 24) | (t
<< 16) | (s
<< 8) | (r
)));
726 * @brief C custom defined QSUB8 for M3 and M0 processors
728 static __INLINE
uint32_t __QSUB8(
734 r
= __SSAT(((((q31_t
)x
<< 24) >> 24) - (((q31_t
)y
<< 24) >> 24)), 8) & (int32_t)0x000000FF;
735 s
= __SSAT(((((q31_t
)x
<< 16) >> 24) - (((q31_t
)y
<< 16) >> 24)), 8) & (int32_t)0x000000FF;
736 t
= __SSAT(((((q31_t
)x
<< 8) >> 24) - (((q31_t
)y
<< 8) >> 24)), 8) & (int32_t)0x000000FF;
737 u
= __SSAT(((((q31_t
)x
) >> 24) - (((q31_t
)y
) >> 24)), 8) & (int32_t)0x000000FF;
739 return ((uint32_t)((u
<< 24) | (t
<< 16) | (s
<< 8) | (r
)));
744 * @brief C custom defined QADD16 for M3 and M0 processors
746 static __INLINE
uint32_t __QADD16(
750 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
753 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
754 s
= __SSAT(((((q31_t
)x
) >> 16) + (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
756 return ((uint32_t)((s
<< 16) | (r
)));
761 * @brief C custom defined SHADD16 for M3 and M0 processors
763 static __INLINE
uint32_t __SHADD16(
769 r
= (((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
770 s
= (((((q31_t
)x
) >> 16) + (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
772 return ((uint32_t)((s
<< 16) | (r
)));
777 * @brief C custom defined QSUB16 for M3 and M0 processors
779 static __INLINE
uint32_t __QSUB16(
785 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
786 s
= __SSAT(((((q31_t
)x
) >> 16) - (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
788 return ((uint32_t)((s
<< 16) | (r
)));
793 * @brief C custom defined SHSUB16 for M3 and M0 processors
795 static __INLINE
uint32_t __SHSUB16(
801 r
= (((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
802 s
= (((((q31_t
)x
) >> 16) - (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
804 return ((uint32_t)((s
<< 16) | (r
)));
809 * @brief C custom defined QASX for M3 and M0 processors
811 static __INLINE
uint32_t __QASX(
817 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
818 s
= __SSAT(((((q31_t
)x
) >> 16) + (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
820 return ((uint32_t)((s
<< 16) | (r
)));
825 * @brief C custom defined SHASX for M3 and M0 processors
827 static __INLINE
uint32_t __SHASX(
833 r
= (((((q31_t
)x
<< 16) >> 16) - (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
834 s
= (((((q31_t
)x
) >> 16) + (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
836 return ((uint32_t)((s
<< 16) | (r
)));
841 * @brief C custom defined QSAX for M3 and M0 processors
843 static __INLINE
uint32_t __QSAX(
849 r
= __SSAT(((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
) >> 16)), 16) & (int32_t)0x0000FFFF;
850 s
= __SSAT(((((q31_t
)x
) >> 16) - (((q31_t
)y
<< 16) >> 16)), 16) & (int32_t)0x0000FFFF;
852 return ((uint32_t)((s
<< 16) | (r
)));
857 * @brief C custom defined SHSAX for M3 and M0 processors
859 static __INLINE
uint32_t __SHSAX(
865 r
= (((((q31_t
)x
<< 16) >> 16) + (((q31_t
)y
) >> 16)) >> 1) & (int32_t)0x0000FFFF;
866 s
= (((((q31_t
)x
) >> 16) - (((q31_t
)y
<< 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
868 return ((uint32_t)((s
<< 16) | (r
)));
873 * @brief C custom defined SMUSDX for M3 and M0 processors
875 static __INLINE
uint32_t __SMUSDX(
879 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) -
880 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) ));
884 * @brief C custom defined SMUADX for M3 and M0 processors
886 static __INLINE
uint32_t __SMUADX(
890 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) +
891 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) ));
896 * @brief C custom defined QADD for M3 and M0 processors
898 static __INLINE
int32_t __QADD(
902 return ((int32_t)(clip_q63_to_q31((q63_t
)x
+ (q31_t
)y
)));
907 * @brief C custom defined QSUB for M3 and M0 processors
909 static __INLINE
int32_t __QSUB(
913 return ((int32_t)(clip_q63_to_q31((q63_t
)x
- (q31_t
)y
)));
918 * @brief C custom defined SMLAD for M3 and M0 processors
920 static __INLINE
uint32_t __SMLAD(
925 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
926 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) +
927 ( ((q31_t
)sum
) ) ));
932 * @brief C custom defined SMLADX for M3 and M0 processors
934 static __INLINE
uint32_t __SMLADX(
939 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) +
940 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
941 ( ((q31_t
)sum
) ) ));
946 * @brief C custom defined SMLSDX for M3 and M0 processors
948 static __INLINE
uint32_t __SMLSDX(
953 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) -
954 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
955 ( ((q31_t
)sum
) ) ));
960 * @brief C custom defined SMLALD for M3 and M0 processors
962 static __INLINE
uint64_t __SMLALD(
967 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
968 return ((uint64_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
969 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) +
970 ( ((q63_t
)sum
) ) ));
975 * @brief C custom defined SMLALDX for M3 and M0 processors
977 static __INLINE
uint64_t __SMLALDX(
982 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
983 return ((uint64_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
) >> 16)) +
984 ((((q31_t
)x
) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
985 ( ((q63_t
)sum
) ) ));
990 * @brief C custom defined SMUAD for M3 and M0 processors
992 static __INLINE
uint32_t __SMUAD(
996 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) +
997 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) ));
1002 * @brief C custom defined SMUSD for M3 and M0 processors
1004 static __INLINE
uint32_t __SMUSD(
1008 return ((uint32_t)(((((q31_t
)x
<< 16) >> 16) * (((q31_t
)y
<< 16) >> 16)) -
1009 ((((q31_t
)x
) >> 16) * (((q31_t
)y
) >> 16)) ));
1014 * @brief C custom defined SXTB16 for M3 and M0 processors
1016 static __INLINE
uint32_t __SXTB16(
1019 return ((uint32_t)(((((q31_t
)x
<< 24) >> 24) & (q31_t
)0x0000FFFF) |
1020 ((((q31_t
)x
<< 8) >> 8) & (q31_t
)0xFFFF0000) ));
1023 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
1027 * @brief Instance structure for the Q7 FIR filter.
1031 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1032 q7_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1033 q7_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
1034 } arm_fir_instance_q7
;
1037 * @brief Instance structure for the Q15 FIR filter.
1041 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1042 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1043 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
1044 } arm_fir_instance_q15
;
1047 * @brief Instance structure for the Q31 FIR filter.
1051 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1052 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1053 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
1054 } arm_fir_instance_q31
;
1057 * @brief Instance structure for the floating-point FIR filter.
1061 uint16_t numTaps
; /**< number of filter coefficients in the filter. */
1062 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
1063 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
1064 } arm_fir_instance_f32
;
1068 * @brief Processing function for the Q7 FIR filter.
1069 * @param[in] S points to an instance of the Q7 FIR filter structure.
1070 * @param[in] pSrc points to the block of input data.
1071 * @param[out] pDst points to the block of output data.
1072 * @param[in] blockSize number of samples to process.
1075 const arm_fir_instance_q7
* S
,
1078 uint32_t blockSize
);
1082 * @brief Initialization function for the Q7 FIR filter.
1083 * @param[in,out] S points to an instance of the Q7 FIR structure.
1084 * @param[in] numTaps Number of filter coefficients in the filter.
1085 * @param[in] pCoeffs points to the filter coefficients.
1086 * @param[in] pState points to the state buffer.
1087 * @param[in] blockSize number of samples that are processed.
1089 void arm_fir_init_q7(
1090 arm_fir_instance_q7
* S
,
1094 uint32_t blockSize
);
1098 * @brief Processing function for the Q15 FIR filter.
1099 * @param[in] S points to an instance of the Q15 FIR structure.
1100 * @param[in] pSrc points to the block of input data.
1101 * @param[out] pDst points to the block of output data.
1102 * @param[in] blockSize number of samples to process.
1105 const arm_fir_instance_q15
* S
,
1108 uint32_t blockSize
);
1112 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
1113 * @param[in] S points to an instance of the Q15 FIR filter structure.
1114 * @param[in] pSrc points to the block of input data.
1115 * @param[out] pDst points to the block of output data.
1116 * @param[in] blockSize number of samples to process.
1118 void arm_fir_fast_q15(
1119 const arm_fir_instance_q15
* S
,
1122 uint32_t blockSize
);
1126 * @brief Initialization function for the Q15 FIR filter.
1127 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
1128 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
1129 * @param[in] pCoeffs points to the filter coefficients.
1130 * @param[in] pState points to the state buffer.
1131 * @param[in] blockSize number of samples that are processed at a time.
1132 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
1133 * <code>numTaps</code> is not a supported value.
1135 arm_status
arm_fir_init_q15(
1136 arm_fir_instance_q15
* S
,
1140 uint32_t blockSize
);
1144 * @brief Processing function for the Q31 FIR filter.
1145 * @param[in] S points to an instance of the Q31 FIR filter structure.
1146 * @param[in] pSrc points to the block of input data.
1147 * @param[out] pDst points to the block of output data.
1148 * @param[in] blockSize number of samples to process.
1151 const arm_fir_instance_q31
* S
,
1154 uint32_t blockSize
);
1158 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
1159 * @param[in] S points to an instance of the Q31 FIR structure.
1160 * @param[in] pSrc points to the block of input data.
1161 * @param[out] pDst points to the block of output data.
1162 * @param[in] blockSize number of samples to process.
1164 void arm_fir_fast_q31(
1165 const arm_fir_instance_q31
* S
,
1168 uint32_t blockSize
);
1172 * @brief Initialization function for the Q31 FIR filter.
1173 * @param[in,out] S points to an instance of the Q31 FIR structure.
1174 * @param[in] numTaps Number of filter coefficients in the filter.
1175 * @param[in] pCoeffs points to the filter coefficients.
1176 * @param[in] pState points to the state buffer.
1177 * @param[in] blockSize number of samples that are processed at a time.
1179 void arm_fir_init_q31(
1180 arm_fir_instance_q31
* S
,
1184 uint32_t blockSize
);
1188 * @brief Processing function for the floating-point FIR filter.
1189 * @param[in] S points to an instance of the floating-point FIR structure.
1190 * @param[in] pSrc points to the block of input data.
1191 * @param[out] pDst points to the block of output data.
1192 * @param[in] blockSize number of samples to process.
1195 const arm_fir_instance_f32
* S
,
1198 uint32_t blockSize
);
1202 * @brief Initialization function for the floating-point FIR filter.
1203 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
1204 * @param[in] numTaps Number of filter coefficients in the filter.
1205 * @param[in] pCoeffs points to the filter coefficients.
1206 * @param[in] pState points to the state buffer.
1207 * @param[in] blockSize number of samples that are processed at a time.
1209 void arm_fir_init_f32(
1210 arm_fir_instance_f32
* S
,
1212 float32_t
* pCoeffs
,
1214 uint32_t blockSize
);
1218 * @brief Instance structure for the Q15 Biquad cascade filter.
1222 int8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1223 q15_t
*pState
; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1224 q15_t
*pCoeffs
; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1225 int8_t postShift
; /**< Additional shift, in bits, applied to each output sample. */
1226 } arm_biquad_casd_df1_inst_q15
;
1229 * @brief Instance structure for the Q31 Biquad cascade filter.
1233 uint32_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1234 q31_t
*pState
; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1235 q31_t
*pCoeffs
; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1236 uint8_t postShift
; /**< Additional shift, in bits, applied to each output sample. */
1237 } arm_biquad_casd_df1_inst_q31
;
1240 * @brief Instance structure for the floating-point Biquad cascade filter.
1244 uint32_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
1245 float32_t
*pState
; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
1246 float32_t
*pCoeffs
; /**< Points to the array of coefficients. The array is of length 5*numStages. */
1247 } arm_biquad_casd_df1_inst_f32
;
1251 * @brief Processing function for the Q15 Biquad cascade filter.
1252 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1253 * @param[in] pSrc points to the block of input data.
1254 * @param[out] pDst points to the block of output data.
1255 * @param[in] blockSize number of samples to process.
1257 void arm_biquad_cascade_df1_q15(
1258 const arm_biquad_casd_df1_inst_q15
* S
,
1261 uint32_t blockSize
);
1265 * @brief Initialization function for the Q15 Biquad cascade filter.
1266 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
1267 * @param[in] numStages number of 2nd order stages in the filter.
1268 * @param[in] pCoeffs points to the filter coefficients.
1269 * @param[in] pState points to the state buffer.
1270 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1272 void arm_biquad_cascade_df1_init_q15(
1273 arm_biquad_casd_df1_inst_q15
* S
,
1281 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1282 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
1283 * @param[in] pSrc points to the block of input data.
1284 * @param[out] pDst points to the block of output data.
1285 * @param[in] blockSize number of samples to process.
1287 void arm_biquad_cascade_df1_fast_q15(
1288 const arm_biquad_casd_df1_inst_q15
* S
,
1291 uint32_t blockSize
);
1295 * @brief Processing function for the Q31 Biquad cascade filter
1296 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1297 * @param[in] pSrc points to the block of input data.
1298 * @param[out] pDst points to the block of output data.
1299 * @param[in] blockSize number of samples to process.
1301 void arm_biquad_cascade_df1_q31(
1302 const arm_biquad_casd_df1_inst_q31
* S
,
1305 uint32_t blockSize
);
1309 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
1310 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
1311 * @param[in] pSrc points to the block of input data.
1312 * @param[out] pDst points to the block of output data.
1313 * @param[in] blockSize number of samples to process.
1315 void arm_biquad_cascade_df1_fast_q31(
1316 const arm_biquad_casd_df1_inst_q31
* S
,
1319 uint32_t blockSize
);
1323 * @brief Initialization function for the Q31 Biquad cascade filter.
1324 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
1325 * @param[in] numStages number of 2nd order stages in the filter.
1326 * @param[in] pCoeffs points to the filter coefficients.
1327 * @param[in] pState points to the state buffer.
1328 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
1330 void arm_biquad_cascade_df1_init_q31(
1331 arm_biquad_casd_df1_inst_q31
* S
,
1339 * @brief Processing function for the floating-point Biquad cascade filter.
1340 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
1341 * @param[in] pSrc points to the block of input data.
1342 * @param[out] pDst points to the block of output data.
1343 * @param[in] blockSize number of samples to process.
1345 void arm_biquad_cascade_df1_f32(
1346 const arm_biquad_casd_df1_inst_f32
* S
,
1349 uint32_t blockSize
);
1353 * @brief Initialization function for the floating-point Biquad cascade filter.
1354 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
1355 * @param[in] numStages number of 2nd order stages in the filter.
1356 * @param[in] pCoeffs points to the filter coefficients.
1357 * @param[in] pState points to the state buffer.
1359 void arm_biquad_cascade_df1_init_f32(
1360 arm_biquad_casd_df1_inst_f32
* S
,
1362 float32_t
* pCoeffs
,
1363 float32_t
* pState
);
1367 * @brief Instance structure for the floating-point matrix structure.
1371 uint16_t numRows
; /**< number of rows of the matrix. */
1372 uint16_t numCols
; /**< number of columns of the matrix. */
1373 float32_t
*pData
; /**< points to the data of the matrix. */
1374 } arm_matrix_instance_f32
;
1378 * @brief Instance structure for the floating-point matrix structure.
1382 uint16_t numRows
; /**< number of rows of the matrix. */
1383 uint16_t numCols
; /**< number of columns of the matrix. */
1384 float64_t
*pData
; /**< points to the data of the matrix. */
1385 } arm_matrix_instance_f64
;
1388 * @brief Instance structure for the Q15 matrix structure.
1392 uint16_t numRows
; /**< number of rows of the matrix. */
1393 uint16_t numCols
; /**< number of columns of the matrix. */
1394 q15_t
*pData
; /**< points to the data of the matrix. */
1395 } arm_matrix_instance_q15
;
1398 * @brief Instance structure for the Q31 matrix structure.
1402 uint16_t numRows
; /**< number of rows of the matrix. */
1403 uint16_t numCols
; /**< number of columns of the matrix. */
1404 q31_t
*pData
; /**< points to the data of the matrix. */
1405 } arm_matrix_instance_q31
;
1409 * @brief Floating-point matrix addition.
1410 * @param[in] pSrcA points to the first input matrix structure
1411 * @param[in] pSrcB points to the second input matrix structure
1412 * @param[out] pDst points to output matrix structure
1413 * @return The function returns either
1414 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1416 arm_status
arm_mat_add_f32(
1417 const arm_matrix_instance_f32
* pSrcA
,
1418 const arm_matrix_instance_f32
* pSrcB
,
1419 arm_matrix_instance_f32
* pDst
);
1423 * @brief Q15 matrix addition.
1424 * @param[in] pSrcA points to the first input matrix structure
1425 * @param[in] pSrcB points to the second input matrix structure
1426 * @param[out] pDst points to output matrix structure
1427 * @return The function returns either
1428 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1430 arm_status
arm_mat_add_q15(
1431 const arm_matrix_instance_q15
* pSrcA
,
1432 const arm_matrix_instance_q15
* pSrcB
,
1433 arm_matrix_instance_q15
* pDst
);
1437 * @brief Q31 matrix addition.
1438 * @param[in] pSrcA points to the first input matrix structure
1439 * @param[in] pSrcB points to the second input matrix structure
1440 * @param[out] pDst points to output matrix structure
1441 * @return The function returns either
1442 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1444 arm_status
arm_mat_add_q31(
1445 const arm_matrix_instance_q31
* pSrcA
,
1446 const arm_matrix_instance_q31
* pSrcB
,
1447 arm_matrix_instance_q31
* pDst
);
1451 * @brief Floating-point, complex, matrix multiplication.
1452 * @param[in] pSrcA points to the first input matrix structure
1453 * @param[in] pSrcB points to the second input matrix structure
1454 * @param[out] pDst points to output matrix structure
1455 * @return The function returns either
1456 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1458 arm_status
arm_mat_cmplx_mult_f32(
1459 const arm_matrix_instance_f32
* pSrcA
,
1460 const arm_matrix_instance_f32
* pSrcB
,
1461 arm_matrix_instance_f32
* pDst
);
1465 * @brief Q15, complex, matrix multiplication.
1466 * @param[in] pSrcA points to the first input matrix structure
1467 * @param[in] pSrcB points to the second input matrix structure
1468 * @param[out] pDst points to output matrix structure
1469 * @return The function returns either
1470 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1472 arm_status
arm_mat_cmplx_mult_q15(
1473 const arm_matrix_instance_q15
* pSrcA
,
1474 const arm_matrix_instance_q15
* pSrcB
,
1475 arm_matrix_instance_q15
* pDst
,
1480 * @brief Q31, complex, matrix multiplication.
1481 * @param[in] pSrcA points to the first input matrix structure
1482 * @param[in] pSrcB points to the second input matrix structure
1483 * @param[out] pDst points to output matrix structure
1484 * @return The function returns either
1485 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1487 arm_status
arm_mat_cmplx_mult_q31(
1488 const arm_matrix_instance_q31
* pSrcA
,
1489 const arm_matrix_instance_q31
* pSrcB
,
1490 arm_matrix_instance_q31
* pDst
);
1494 * @brief Floating-point matrix transpose.
1495 * @param[in] pSrc points to the input matrix
1496 * @param[out] pDst points to the output matrix
1497 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1498 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1500 arm_status
arm_mat_trans_f32(
1501 const arm_matrix_instance_f32
* pSrc
,
1502 arm_matrix_instance_f32
* pDst
);
1506 * @brief Q15 matrix transpose.
1507 * @param[in] pSrc points to the input matrix
1508 * @param[out] pDst points to the output matrix
1509 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1510 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1512 arm_status
arm_mat_trans_q15(
1513 const arm_matrix_instance_q15
* pSrc
,
1514 arm_matrix_instance_q15
* pDst
);
1518 * @brief Q31 matrix transpose.
1519 * @param[in] pSrc points to the input matrix
1520 * @param[out] pDst points to the output matrix
1521 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
1522 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1524 arm_status
arm_mat_trans_q31(
1525 const arm_matrix_instance_q31
* pSrc
,
1526 arm_matrix_instance_q31
* pDst
);
1530 * @brief Floating-point matrix multiplication
1531 * @param[in] pSrcA points to the first input matrix structure
1532 * @param[in] pSrcB points to the second input matrix structure
1533 * @param[out] pDst points to output matrix structure
1534 * @return The function returns either
1535 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1537 arm_status
arm_mat_mult_f32(
1538 const arm_matrix_instance_f32
* pSrcA
,
1539 const arm_matrix_instance_f32
* pSrcB
,
1540 arm_matrix_instance_f32
* pDst
);
1544 * @brief Q15 matrix multiplication
1545 * @param[in] pSrcA points to the first input matrix structure
1546 * @param[in] pSrcB points to the second input matrix structure
1547 * @param[out] pDst points to output matrix structure
1548 * @param[in] pState points to the array for storing intermediate results
1549 * @return The function returns either
1550 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1552 arm_status
arm_mat_mult_q15(
1553 const arm_matrix_instance_q15
* pSrcA
,
1554 const arm_matrix_instance_q15
* pSrcB
,
1555 arm_matrix_instance_q15
* pDst
,
1560 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1561 * @param[in] pSrcA points to the first input matrix structure
1562 * @param[in] pSrcB points to the second input matrix structure
1563 * @param[out] pDst points to output matrix structure
1564 * @param[in] pState points to the array for storing intermediate results
1565 * @return The function returns either
1566 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1568 arm_status
arm_mat_mult_fast_q15(
1569 const arm_matrix_instance_q15
* pSrcA
,
1570 const arm_matrix_instance_q15
* pSrcB
,
1571 arm_matrix_instance_q15
* pDst
,
1576 * @brief Q31 matrix multiplication
1577 * @param[in] pSrcA points to the first input matrix structure
1578 * @param[in] pSrcB points to the second input matrix structure
1579 * @param[out] pDst points to output matrix structure
1580 * @return The function returns either
1581 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1583 arm_status
arm_mat_mult_q31(
1584 const arm_matrix_instance_q31
* pSrcA
,
1585 const arm_matrix_instance_q31
* pSrcB
,
1586 arm_matrix_instance_q31
* pDst
);
1590 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
1591 * @param[in] pSrcA points to the first input matrix structure
1592 * @param[in] pSrcB points to the second input matrix structure
1593 * @param[out] pDst points to output matrix structure
1594 * @return The function returns either
1595 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1597 arm_status
arm_mat_mult_fast_q31(
1598 const arm_matrix_instance_q31
* pSrcA
,
1599 const arm_matrix_instance_q31
* pSrcB
,
1600 arm_matrix_instance_q31
* pDst
);
1604 * @brief Floating-point matrix subtraction
1605 * @param[in] pSrcA points to the first input matrix structure
1606 * @param[in] pSrcB points to the second input matrix structure
1607 * @param[out] pDst points to output matrix structure
1608 * @return The function returns either
1609 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1611 arm_status
arm_mat_sub_f32(
1612 const arm_matrix_instance_f32
* pSrcA
,
1613 const arm_matrix_instance_f32
* pSrcB
,
1614 arm_matrix_instance_f32
* pDst
);
1618 * @brief Q15 matrix subtraction
1619 * @param[in] pSrcA points to the first input matrix structure
1620 * @param[in] pSrcB points to the second input matrix structure
1621 * @param[out] pDst points to output matrix structure
1622 * @return The function returns either
1623 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1625 arm_status
arm_mat_sub_q15(
1626 const arm_matrix_instance_q15
* pSrcA
,
1627 const arm_matrix_instance_q15
* pSrcB
,
1628 arm_matrix_instance_q15
* pDst
);
1632 * @brief Q31 matrix subtraction
1633 * @param[in] pSrcA points to the first input matrix structure
1634 * @param[in] pSrcB points to the second input matrix structure
1635 * @param[out] pDst points to output matrix structure
1636 * @return The function returns either
1637 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1639 arm_status
arm_mat_sub_q31(
1640 const arm_matrix_instance_q31
* pSrcA
,
1641 const arm_matrix_instance_q31
* pSrcB
,
1642 arm_matrix_instance_q31
* pDst
);
1646 * @brief Floating-point matrix scaling.
1647 * @param[in] pSrc points to the input matrix
1648 * @param[in] scale scale factor
1649 * @param[out] pDst points to the output matrix
1650 * @return The function returns either
1651 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1653 arm_status
arm_mat_scale_f32(
1654 const arm_matrix_instance_f32
* pSrc
,
1656 arm_matrix_instance_f32
* pDst
);
1660 * @brief Q15 matrix scaling.
1661 * @param[in] pSrc points to input matrix
1662 * @param[in] scaleFract fractional portion of the scale factor
1663 * @param[in] shift number of bits to shift the result by
1664 * @param[out] pDst points to output matrix
1665 * @return The function returns either
1666 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1668 arm_status
arm_mat_scale_q15(
1669 const arm_matrix_instance_q15
* pSrc
,
1672 arm_matrix_instance_q15
* pDst
);
1676 * @brief Q31 matrix scaling.
1677 * @param[in] pSrc points to input matrix
1678 * @param[in] scaleFract fractional portion of the scale factor
1679 * @param[in] shift number of bits to shift the result by
1680 * @param[out] pDst points to output matrix structure
1681 * @return The function returns either
1682 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
1684 arm_status
arm_mat_scale_q31(
1685 const arm_matrix_instance_q31
* pSrc
,
1688 arm_matrix_instance_q31
* pDst
);
1692 * @brief Q31 matrix initialization.
1693 * @param[in,out] S points to an instance of the floating-point matrix structure.
1694 * @param[in] nRows number of rows in the matrix.
1695 * @param[in] nColumns number of columns in the matrix.
1696 * @param[in] pData points to the matrix data array.
1698 void arm_mat_init_q31(
1699 arm_matrix_instance_q31
* S
,
1706 * @brief Q15 matrix initialization.
1707 * @param[in,out] S points to an instance of the floating-point matrix structure.
1708 * @param[in] nRows number of rows in the matrix.
1709 * @param[in] nColumns number of columns in the matrix.
1710 * @param[in] pData points to the matrix data array.
1712 void arm_mat_init_q15(
1713 arm_matrix_instance_q15
* S
,
1720 * @brief Floating-point matrix initialization.
1721 * @param[in,out] S points to an instance of the floating-point matrix structure.
1722 * @param[in] nRows number of rows in the matrix.
1723 * @param[in] nColumns number of columns in the matrix.
1724 * @param[in] pData points to the matrix data array.
1726 void arm_mat_init_f32(
1727 arm_matrix_instance_f32
* S
,
1735 * @brief Instance structure for the Q15 PID Control.
1739 q15_t A0
; /**< The derived gain, A0 = Kp + Ki + Kd . */
1740 #ifdef ARM_MATH_CM0_FAMILY
1744 q31_t A1
; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
1746 q15_t state
[3]; /**< The state array of length 3. */
1747 q15_t Kp
; /**< The proportional gain. */
1748 q15_t Ki
; /**< The integral gain. */
1749 q15_t Kd
; /**< The derivative gain. */
1750 } arm_pid_instance_q15
;
1753 * @brief Instance structure for the Q31 PID Control.
1757 q31_t A0
; /**< The derived gain, A0 = Kp + Ki + Kd . */
1758 q31_t A1
; /**< The derived gain, A1 = -Kp - 2Kd. */
1759 q31_t A2
; /**< The derived gain, A2 = Kd . */
1760 q31_t state
[3]; /**< The state array of length 3. */
1761 q31_t Kp
; /**< The proportional gain. */
1762 q31_t Ki
; /**< The integral gain. */
1763 q31_t Kd
; /**< The derivative gain. */
1764 } arm_pid_instance_q31
;
1767 * @brief Instance structure for the floating-point PID Control.
1771 float32_t A0
; /**< The derived gain, A0 = Kp + Ki + Kd . */
1772 float32_t A1
; /**< The derived gain, A1 = -Kp - 2Kd. */
1773 float32_t A2
; /**< The derived gain, A2 = Kd . */
1774 float32_t state
[3]; /**< The state array of length 3. */
1775 float32_t Kp
; /**< The proportional gain. */
1776 float32_t Ki
; /**< The integral gain. */
1777 float32_t Kd
; /**< The derivative gain. */
1778 } arm_pid_instance_f32
;
1783 * @brief Initialization function for the floating-point PID Control.
1784 * @param[in,out] S points to an instance of the PID structure.
1785 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1787 void arm_pid_init_f32(
1788 arm_pid_instance_f32
* S
,
1789 int32_t resetStateFlag
);
1793 * @brief Reset function for the floating-point PID Control.
1794 * @param[in,out] S is an instance of the floating-point PID Control structure
1796 void arm_pid_reset_f32(
1797 arm_pid_instance_f32
* S
);
1801 * @brief Initialization function for the Q31 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_q31(
1806 arm_pid_instance_q31
* S
,
1807 int32_t resetStateFlag
);
1811 * @brief Reset function for the Q31 PID Control.
1812 * @param[in,out] S points to an instance of the Q31 PID Control structure
1815 void arm_pid_reset_q31(
1816 arm_pid_instance_q31
* S
);
1820 * @brief Initialization function for the Q15 PID Control.
1821 * @param[in,out] S points to an instance of the Q15 PID structure.
1822 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
1824 void arm_pid_init_q15(
1825 arm_pid_instance_q15
* S
,
1826 int32_t resetStateFlag
);
1830 * @brief Reset function for the Q15 PID Control.
1831 * @param[in,out] S points to an instance of the q15 PID Control structure
1833 void arm_pid_reset_q15(
1834 arm_pid_instance_q15
* S
);
1838 * @brief Instance structure for the floating-point Linear Interpolate function.
1842 uint32_t nValues
; /**< nValues */
1843 float32_t x1
; /**< x1 */
1844 float32_t xSpacing
; /**< xSpacing */
1845 float32_t
*pYData
; /**< pointer to the table of Y values */
1846 } arm_linear_interp_instance_f32
;
1849 * @brief Instance structure for the floating-point bilinear interpolation function.
1853 uint16_t numRows
; /**< number of rows in the data table. */
1854 uint16_t numCols
; /**< number of columns in the data table. */
1855 float32_t
*pData
; /**< points to the data table. */
1856 } arm_bilinear_interp_instance_f32
;
1859 * @brief Instance structure for the Q31 bilinear interpolation function.
1863 uint16_t numRows
; /**< number of rows in the data table. */
1864 uint16_t numCols
; /**< number of columns in the data table. */
1865 q31_t
*pData
; /**< points to the data table. */
1866 } arm_bilinear_interp_instance_q31
;
1869 * @brief Instance structure for the Q15 bilinear interpolation function.
1873 uint16_t numRows
; /**< number of rows in the data table. */
1874 uint16_t numCols
; /**< number of columns in the data table. */
1875 q15_t
*pData
; /**< points to the data table. */
1876 } arm_bilinear_interp_instance_q15
;
1879 * @brief Instance structure for the Q15 bilinear interpolation function.
1883 uint16_t numRows
; /**< number of rows in the data table. */
1884 uint16_t numCols
; /**< number of columns in the data table. */
1885 q7_t
*pData
; /**< points to the data table. */
1886 } arm_bilinear_interp_instance_q7
;
1890 * @brief Q7 vector multiplication.
1891 * @param[in] pSrcA points to the first input vector
1892 * @param[in] pSrcB points to the second input vector
1893 * @param[out] pDst points to the output vector
1894 * @param[in] blockSize number of samples in each vector
1900 uint32_t blockSize
);
1904 * @brief Q15 vector multiplication.
1905 * @param[in] pSrcA points to the first input vector
1906 * @param[in] pSrcB points to the second input vector
1907 * @param[out] pDst points to the output vector
1908 * @param[in] blockSize number of samples in each vector
1914 uint32_t blockSize
);
1918 * @brief Q31 vector multiplication.
1919 * @param[in] pSrcA points to the first input vector
1920 * @param[in] pSrcB points to the second input vector
1921 * @param[out] pDst points to the output vector
1922 * @param[in] blockSize number of samples in each vector
1928 uint32_t blockSize
);
1932 * @brief Floating-point vector multiplication.
1933 * @param[in] pSrcA points to the first input vector
1934 * @param[in] pSrcB points to the second input vector
1935 * @param[out] pDst points to the output vector
1936 * @param[in] blockSize number of samples in each vector
1942 uint32_t blockSize
);
1946 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1950 uint16_t fftLen
; /**< length of the FFT. */
1951 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1952 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1953 q15_t
*pTwiddle
; /**< points to the Sin twiddle factor table. */
1954 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
1955 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1956 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1957 } arm_cfft_radix2_instance_q15
;
1960 arm_status
arm_cfft_radix2_init_q15(
1961 arm_cfft_radix2_instance_q15
* S
,
1964 uint8_t bitReverseFlag
);
1967 void arm_cfft_radix2_q15(
1968 const arm_cfft_radix2_instance_q15
* S
,
1973 * @brief Instance structure for the Q15 CFFT/CIFFT function.
1977 uint16_t fftLen
; /**< length of the FFT. */
1978 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
1979 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
1980 q15_t
*pTwiddle
; /**< points to the twiddle factor table. */
1981 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
1982 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
1983 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
1984 } arm_cfft_radix4_instance_q15
;
1987 arm_status
arm_cfft_radix4_init_q15(
1988 arm_cfft_radix4_instance_q15
* S
,
1991 uint8_t bitReverseFlag
);
1994 void arm_cfft_radix4_q15(
1995 const arm_cfft_radix4_instance_q15
* S
,
1999 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
2003 uint16_t fftLen
; /**< length of the FFT. */
2004 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2005 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2006 q31_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2007 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2008 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2009 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2010 } arm_cfft_radix2_instance_q31
;
2013 arm_status
arm_cfft_radix2_init_q31(
2014 arm_cfft_radix2_instance_q31
* S
,
2017 uint8_t bitReverseFlag
);
2020 void arm_cfft_radix2_q31(
2021 const arm_cfft_radix2_instance_q31
* S
,
2025 * @brief Instance structure for the Q31 CFFT/CIFFT function.
2029 uint16_t fftLen
; /**< length of the FFT. */
2030 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2031 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2032 q31_t
*pTwiddle
; /**< points to the twiddle factor table. */
2033 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2034 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2035 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2036 } arm_cfft_radix4_instance_q31
;
2039 void arm_cfft_radix4_q31(
2040 const arm_cfft_radix4_instance_q31
* S
,
2044 arm_status
arm_cfft_radix4_init_q31(
2045 arm_cfft_radix4_instance_q31
* S
,
2048 uint8_t bitReverseFlag
);
2051 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2055 uint16_t fftLen
; /**< length of the FFT. */
2056 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2057 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2058 float32_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2059 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2060 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2061 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2062 float32_t onebyfftLen
; /**< value of 1/fftLen. */
2063 } arm_cfft_radix2_instance_f32
;
2066 arm_status
arm_cfft_radix2_init_f32(
2067 arm_cfft_radix2_instance_f32
* S
,
2070 uint8_t bitReverseFlag
);
2073 void arm_cfft_radix2_f32(
2074 const arm_cfft_radix2_instance_f32
* S
,
2078 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2082 uint16_t fftLen
; /**< length of the FFT. */
2083 uint8_t ifftFlag
; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
2084 uint8_t bitReverseFlag
; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
2085 float32_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2086 uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2087 uint16_t twidCoefModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2088 uint16_t bitRevFactor
; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
2089 float32_t onebyfftLen
; /**< value of 1/fftLen. */
2090 } arm_cfft_radix4_instance_f32
;
2093 arm_status
arm_cfft_radix4_init_f32(
2094 arm_cfft_radix4_instance_f32
* S
,
2097 uint8_t bitReverseFlag
);
2100 void arm_cfft_radix4_f32(
2101 const arm_cfft_radix4_instance_f32
* S
,
2105 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2109 uint16_t fftLen
; /**< length of the FFT. */
2110 const q15_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2111 const uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2112 uint16_t bitRevLength
; /**< bit reversal table length. */
2113 } arm_cfft_instance_q15
;
2116 const arm_cfft_instance_q15
* S
,
2119 uint8_t bitReverseFlag
);
2122 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
2126 uint16_t fftLen
; /**< length of the FFT. */
2127 const q31_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2128 const uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2129 uint16_t bitRevLength
; /**< bit reversal table length. */
2130 } arm_cfft_instance_q31
;
2133 const arm_cfft_instance_q31
* S
,
2136 uint8_t bitReverseFlag
);
2139 * @brief Instance structure for the floating-point CFFT/CIFFT function.
2143 uint16_t fftLen
; /**< length of the FFT. */
2144 const float32_t
*pTwiddle
; /**< points to the Twiddle factor table. */
2145 const uint16_t *pBitRevTable
; /**< points to the bit reversal table. */
2146 uint16_t bitRevLength
; /**< bit reversal table length. */
2147 } arm_cfft_instance_f32
;
2150 const arm_cfft_instance_f32
* S
,
2153 uint8_t bitReverseFlag
);
2156 * @brief Instance structure for the Q15 RFFT/RIFFT function.
2160 uint32_t fftLenReal
; /**< length of the real FFT. */
2161 uint8_t ifftFlagR
; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2162 uint8_t bitReverseFlagR
; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2163 uint32_t twidCoefRModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2164 q15_t
*pTwiddleAReal
; /**< points to the real twiddle factor table. */
2165 q15_t
*pTwiddleBReal
; /**< points to the imag twiddle factor table. */
2166 const arm_cfft_instance_q15
*pCfft
; /**< points to the complex FFT instance. */
2167 } arm_rfft_instance_q15
;
2169 arm_status
arm_rfft_init_q15(
2170 arm_rfft_instance_q15
* S
,
2171 uint32_t fftLenReal
,
2173 uint32_t bitReverseFlag
);
2176 const arm_rfft_instance_q15
* S
,
2181 * @brief Instance structure for the Q31 RFFT/RIFFT function.
2185 uint32_t fftLenReal
; /**< length of the real FFT. */
2186 uint8_t ifftFlagR
; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2187 uint8_t bitReverseFlagR
; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2188 uint32_t twidCoefRModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2189 q31_t
*pTwiddleAReal
; /**< points to the real twiddle factor table. */
2190 q31_t
*pTwiddleBReal
; /**< points to the imag twiddle factor table. */
2191 const arm_cfft_instance_q31
*pCfft
; /**< points to the complex FFT instance. */
2192 } arm_rfft_instance_q31
;
2194 arm_status
arm_rfft_init_q31(
2195 arm_rfft_instance_q31
* S
,
2196 uint32_t fftLenReal
,
2198 uint32_t bitReverseFlag
);
2201 const arm_rfft_instance_q31
* S
,
2206 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2210 uint32_t fftLenReal
; /**< length of the real FFT. */
2211 uint16_t fftLenBy2
; /**< length of the complex FFT. */
2212 uint8_t ifftFlagR
; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
2213 uint8_t bitReverseFlagR
; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
2214 uint32_t twidCoefRModifier
; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
2215 float32_t
*pTwiddleAReal
; /**< points to the real twiddle factor table. */
2216 float32_t
*pTwiddleBReal
; /**< points to the imag twiddle factor table. */
2217 arm_cfft_radix4_instance_f32
*pCfft
; /**< points to the complex FFT instance. */
2218 } arm_rfft_instance_f32
;
2220 arm_status
arm_rfft_init_f32(
2221 arm_rfft_instance_f32
* S
,
2222 arm_cfft_radix4_instance_f32
* S_CFFT
,
2223 uint32_t fftLenReal
,
2225 uint32_t bitReverseFlag
);
2228 const arm_rfft_instance_f32
* S
,
2233 * @brief Instance structure for the floating-point RFFT/RIFFT function.
2237 arm_cfft_instance_f32 Sint
; /**< Internal CFFT structure. */
2238 uint16_t fftLenRFFT
; /**< length of the real sequence */
2239 float32_t
* pTwiddleRFFT
; /**< Twiddle factors real stage */
2240 } arm_rfft_fast_instance_f32
;
2242 arm_status
arm_rfft_fast_init_f32 (
2243 arm_rfft_fast_instance_f32
* S
,
2246 void arm_rfft_fast_f32(
2247 arm_rfft_fast_instance_f32
* S
,
2248 float32_t
* p
, float32_t
* pOut
,
2252 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
2256 uint16_t N
; /**< length of the DCT4. */
2257 uint16_t Nby2
; /**< half of the length of the DCT4. */
2258 float32_t normalize
; /**< normalizing factor. */
2259 float32_t
*pTwiddle
; /**< points to the twiddle factor table. */
2260 float32_t
*pCosFactor
; /**< points to the cosFactor table. */
2261 arm_rfft_instance_f32
*pRfft
; /**< points to the real FFT instance. */
2262 arm_cfft_radix4_instance_f32
*pCfft
; /**< points to the complex FFT instance. */
2263 } arm_dct4_instance_f32
;
2267 * @brief Initialization function for the floating-point DCT4/IDCT4.
2268 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
2269 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
2270 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
2271 * @param[in] N length of the DCT4.
2272 * @param[in] Nby2 half of the length of the DCT4.
2273 * @param[in] normalize normalizing factor.
2274 * @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.
2276 arm_status
arm_dct4_init_f32(
2277 arm_dct4_instance_f32
* S
,
2278 arm_rfft_instance_f32
* S_RFFT
,
2279 arm_cfft_radix4_instance_f32
* S_CFFT
,
2282 float32_t normalize
);
2286 * @brief Processing function for the floating-point DCT4/IDCT4.
2287 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
2288 * @param[in] pState points to state buffer.
2289 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2292 const arm_dct4_instance_f32
* S
,
2294 float32_t
* pInlineBuffer
);
2298 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
2302 uint16_t N
; /**< length of the DCT4. */
2303 uint16_t Nby2
; /**< half of the length of the DCT4. */
2304 q31_t normalize
; /**< normalizing factor. */
2305 q31_t
*pTwiddle
; /**< points to the twiddle factor table. */
2306 q31_t
*pCosFactor
; /**< points to the cosFactor table. */
2307 arm_rfft_instance_q31
*pRfft
; /**< points to the real FFT instance. */
2308 arm_cfft_radix4_instance_q31
*pCfft
; /**< points to the complex FFT instance. */
2309 } arm_dct4_instance_q31
;
2313 * @brief Initialization function for the Q31 DCT4/IDCT4.
2314 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
2315 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
2316 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
2317 * @param[in] N length of the DCT4.
2318 * @param[in] Nby2 half of the length of the DCT4.
2319 * @param[in] normalize normalizing factor.
2320 * @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.
2322 arm_status
arm_dct4_init_q31(
2323 arm_dct4_instance_q31
* S
,
2324 arm_rfft_instance_q31
* S_RFFT
,
2325 arm_cfft_radix4_instance_q31
* S_CFFT
,
2332 * @brief Processing function for the Q31 DCT4/IDCT4.
2333 * @param[in] S points to an instance of the Q31 DCT4 structure.
2334 * @param[in] pState points to state buffer.
2335 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2338 const arm_dct4_instance_q31
* S
,
2340 q31_t
* pInlineBuffer
);
2344 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
2348 uint16_t N
; /**< length of the DCT4. */
2349 uint16_t Nby2
; /**< half of the length of the DCT4. */
2350 q15_t normalize
; /**< normalizing factor. */
2351 q15_t
*pTwiddle
; /**< points to the twiddle factor table. */
2352 q15_t
*pCosFactor
; /**< points to the cosFactor table. */
2353 arm_rfft_instance_q15
*pRfft
; /**< points to the real FFT instance. */
2354 arm_cfft_radix4_instance_q15
*pCfft
; /**< points to the complex FFT instance. */
2355 } arm_dct4_instance_q15
;
2359 * @brief Initialization function for the Q15 DCT4/IDCT4.
2360 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
2361 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
2362 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
2363 * @param[in] N length of the DCT4.
2364 * @param[in] Nby2 half of the length of the DCT4.
2365 * @param[in] normalize normalizing factor.
2366 * @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.
2368 arm_status
arm_dct4_init_q15(
2369 arm_dct4_instance_q15
* S
,
2370 arm_rfft_instance_q15
* S_RFFT
,
2371 arm_cfft_radix4_instance_q15
* S_CFFT
,
2378 * @brief Processing function for the Q15 DCT4/IDCT4.
2379 * @param[in] S points to an instance of the Q15 DCT4 structure.
2380 * @param[in] pState points to state buffer.
2381 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
2384 const arm_dct4_instance_q15
* S
,
2386 q15_t
* pInlineBuffer
);
2390 * @brief Floating-point vector addition.
2391 * @param[in] pSrcA points to the first input vector
2392 * @param[in] pSrcB points to the second input vector
2393 * @param[out] pDst points to the output vector
2394 * @param[in] blockSize number of samples in each vector
2400 uint32_t blockSize
);
2404 * @brief Q7 vector addition.
2405 * @param[in] pSrcA points to the first input vector
2406 * @param[in] pSrcB points to the second input vector
2407 * @param[out] pDst points to the output vector
2408 * @param[in] blockSize number of samples in each vector
2414 uint32_t blockSize
);
2418 * @brief Q15 vector addition.
2419 * @param[in] pSrcA points to the first input vector
2420 * @param[in] pSrcB points to the second input vector
2421 * @param[out] pDst points to the output vector
2422 * @param[in] blockSize number of samples in each vector
2428 uint32_t blockSize
);
2432 * @brief Q31 vector addition.
2433 * @param[in] pSrcA points to the first input vector
2434 * @param[in] pSrcB points to the second input vector
2435 * @param[out] pDst points to the output vector
2436 * @param[in] blockSize number of samples in each vector
2442 uint32_t blockSize
);
2446 * @brief Floating-point vector subtraction.
2447 * @param[in] pSrcA points to the first input vector
2448 * @param[in] pSrcB points to the second input vector
2449 * @param[out] pDst points to the output vector
2450 * @param[in] blockSize number of samples in each vector
2456 uint32_t blockSize
);
2460 * @brief Q7 vector subtraction.
2461 * @param[in] pSrcA points to the first input vector
2462 * @param[in] pSrcB points to the second input vector
2463 * @param[out] pDst points to the output vector
2464 * @param[in] blockSize number of samples in each vector
2470 uint32_t blockSize
);
2474 * @brief Q15 vector subtraction.
2475 * @param[in] pSrcA points to the first input vector
2476 * @param[in] pSrcB points to the second input vector
2477 * @param[out] pDst points to the output vector
2478 * @param[in] blockSize number of samples in each vector
2484 uint32_t blockSize
);
2488 * @brief Q31 vector subtraction.
2489 * @param[in] pSrcA points to the first input vector
2490 * @param[in] pSrcB points to the second input vector
2491 * @param[out] pDst points to the output vector
2492 * @param[in] blockSize number of samples in each vector
2498 uint32_t blockSize
);
2502 * @brief Multiplies a floating-point vector by a scalar.
2503 * @param[in] pSrc points to the input vector
2504 * @param[in] scale scale factor to be applied
2505 * @param[out] pDst points to the output vector
2506 * @param[in] blockSize number of samples in the vector
2512 uint32_t blockSize
);
2516 * @brief Multiplies a Q7 vector by a scalar.
2517 * @param[in] pSrc points to the input vector
2518 * @param[in] scaleFract fractional portion of the scale value
2519 * @param[in] shift number of bits to shift the result by
2520 * @param[out] pDst points to the output vector
2521 * @param[in] blockSize number of samples in the vector
2528 uint32_t blockSize
);
2532 * @brief Multiplies a Q15 vector by a scalar.
2533 * @param[in] pSrc points to the input vector
2534 * @param[in] scaleFract fractional portion of the scale value
2535 * @param[in] shift number of bits to shift the result by
2536 * @param[out] pDst points to the output vector
2537 * @param[in] blockSize number of samples in the vector
2544 uint32_t blockSize
);
2548 * @brief Multiplies a Q31 vector by a scalar.
2549 * @param[in] pSrc points to the input vector
2550 * @param[in] scaleFract fractional portion of the scale value
2551 * @param[in] shift number of bits to shift the result by
2552 * @param[out] pDst points to the output vector
2553 * @param[in] blockSize number of samples in the vector
2560 uint32_t blockSize
);
2564 * @brief Q7 vector absolute value.
2565 * @param[in] pSrc points to the input buffer
2566 * @param[out] pDst points to the output buffer
2567 * @param[in] blockSize number of samples in each vector
2572 uint32_t blockSize
);
2576 * @brief Floating-point vector absolute value.
2577 * @param[in] pSrc points to the input buffer
2578 * @param[out] pDst points to the output buffer
2579 * @param[in] blockSize number of samples in each vector
2584 uint32_t blockSize
);
2588 * @brief Q15 vector absolute value.
2589 * @param[in] pSrc points to the input buffer
2590 * @param[out] pDst points to the output buffer
2591 * @param[in] blockSize number of samples in each vector
2596 uint32_t blockSize
);
2600 * @brief Q31 vector absolute value.
2601 * @param[in] pSrc points to the input buffer
2602 * @param[out] pDst points to the output buffer
2603 * @param[in] blockSize number of samples in each vector
2608 uint32_t blockSize
);
2612 * @brief Dot product of floating-point vectors.
2613 * @param[in] pSrcA points to the first input vector
2614 * @param[in] pSrcB points to the second input vector
2615 * @param[in] blockSize number of samples in each vector
2616 * @param[out] result output result returned here
2618 void arm_dot_prod_f32(
2622 float32_t
* result
);
2626 * @brief Dot product of Q7 vectors.
2627 * @param[in] pSrcA points to the first input vector
2628 * @param[in] pSrcB points to the second input vector
2629 * @param[in] blockSize number of samples in each vector
2630 * @param[out] result output result returned here
2632 void arm_dot_prod_q7(
2640 * @brief Dot product of Q15 vectors.
2641 * @param[in] pSrcA points to the first input vector
2642 * @param[in] pSrcB points to the second input vector
2643 * @param[in] blockSize number of samples in each vector
2644 * @param[out] result output result returned here
2646 void arm_dot_prod_q15(
2654 * @brief Dot product of Q31 vectors.
2655 * @param[in] pSrcA points to the first input vector
2656 * @param[in] pSrcB points to the second input vector
2657 * @param[in] blockSize number of samples in each vector
2658 * @param[out] result output result returned here
2660 void arm_dot_prod_q31(
2668 * @brief Shifts the elements of a Q7 vector a specified number of bits.
2669 * @param[in] pSrc points to the input vector
2670 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2671 * @param[out] pDst points to the output vector
2672 * @param[in] blockSize number of samples in the vector
2678 uint32_t blockSize
);
2682 * @brief Shifts the elements of a Q15 vector a specified number of bits.
2683 * @param[in] pSrc points to the input vector
2684 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2685 * @param[out] pDst points to the output vector
2686 * @param[in] blockSize number of samples in the vector
2692 uint32_t blockSize
);
2696 * @brief Shifts the elements of a Q31 vector a specified number of bits.
2697 * @param[in] pSrc points to the input vector
2698 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
2699 * @param[out] pDst points to the output vector
2700 * @param[in] blockSize number of samples in the vector
2706 uint32_t blockSize
);
2710 * @brief Adds a constant offset to a floating-point vector.
2711 * @param[in] pSrc points to the input vector
2712 * @param[in] offset is the offset to be added
2713 * @param[out] pDst points to the output vector
2714 * @param[in] blockSize number of samples in the vector
2716 void arm_offset_f32(
2720 uint32_t blockSize
);
2724 * @brief Adds a constant offset to a Q7 vector.
2725 * @param[in] pSrc points to the input vector
2726 * @param[in] offset is the offset to be added
2727 * @param[out] pDst points to the output vector
2728 * @param[in] blockSize number of samples in the vector
2734 uint32_t blockSize
);
2738 * @brief Adds a constant offset to a Q15 vector.
2739 * @param[in] pSrc points to the input vector
2740 * @param[in] offset is the offset to be added
2741 * @param[out] pDst points to the output vector
2742 * @param[in] blockSize number of samples in the vector
2744 void arm_offset_q15(
2748 uint32_t blockSize
);
2752 * @brief Adds a constant offset to a Q31 vector.
2753 * @param[in] pSrc points to the input vector
2754 * @param[in] offset is the offset to be added
2755 * @param[out] pDst points to the output vector
2756 * @param[in] blockSize number of samples in the vector
2758 void arm_offset_q31(
2762 uint32_t blockSize
);
2766 * @brief Negates the elements of a floating-point vector.
2767 * @param[in] pSrc points to the input vector
2768 * @param[out] pDst points to the output vector
2769 * @param[in] blockSize number of samples in the vector
2771 void arm_negate_f32(
2774 uint32_t blockSize
);
2778 * @brief Negates the elements of a Q7 vector.
2779 * @param[in] pSrc points to the input vector
2780 * @param[out] pDst points to the output vector
2781 * @param[in] blockSize number of samples in the vector
2786 uint32_t blockSize
);
2790 * @brief Negates the elements of a Q15 vector.
2791 * @param[in] pSrc points to the input vector
2792 * @param[out] pDst points to the output vector
2793 * @param[in] blockSize number of samples in the vector
2795 void arm_negate_q15(
2798 uint32_t blockSize
);
2802 * @brief Negates the elements of a Q31 vector.
2803 * @param[in] pSrc points to the input vector
2804 * @param[out] pDst points to the output vector
2805 * @param[in] blockSize number of samples in the vector
2807 void arm_negate_q31(
2810 uint32_t blockSize
);
2814 * @brief Copies the elements of a floating-point vector.
2815 * @param[in] pSrc input pointer
2816 * @param[out] pDst output pointer
2817 * @param[in] blockSize number of samples to process
2822 uint32_t blockSize
);
2826 * @brief Copies the elements of a Q7 vector.
2827 * @param[in] pSrc input pointer
2828 * @param[out] pDst output pointer
2829 * @param[in] blockSize number of samples to process
2834 uint32_t blockSize
);
2838 * @brief Copies the elements of a Q15 vector.
2839 * @param[in] pSrc input pointer
2840 * @param[out] pDst output pointer
2841 * @param[in] blockSize number of samples to process
2846 uint32_t blockSize
);
2850 * @brief Copies the elements of a Q31 vector.
2851 * @param[in] pSrc input pointer
2852 * @param[out] pDst output pointer
2853 * @param[in] blockSize number of samples to process
2858 uint32_t blockSize
);
2862 * @brief Fills a constant value into a floating-point vector.
2863 * @param[in] value input value to be filled
2864 * @param[out] pDst output pointer
2865 * @param[in] blockSize number of samples to process
2870 uint32_t blockSize
);
2874 * @brief Fills a constant value into a Q7 vector.
2875 * @param[in] value input value to be filled
2876 * @param[out] pDst output pointer
2877 * @param[in] blockSize number of samples to process
2882 uint32_t blockSize
);
2886 * @brief Fills a constant value into a Q15 vector.
2887 * @param[in] value input value to be filled
2888 * @param[out] pDst output pointer
2889 * @param[in] blockSize number of samples to process
2894 uint32_t blockSize
);
2898 * @brief Fills a constant value into a Q31 vector.
2899 * @param[in] value input value to be filled
2900 * @param[out] pDst output pointer
2901 * @param[in] blockSize number of samples to process
2906 uint32_t blockSize
);
2910 * @brief Convolution of floating-point sequences.
2911 * @param[in] pSrcA points to the first input sequence.
2912 * @param[in] srcALen length of the first input sequence.
2913 * @param[in] pSrcB points to the second input sequence.
2914 * @param[in] srcBLen length of the second input sequence.
2915 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2926 * @brief Convolution of Q15 sequences.
2927 * @param[in] pSrcA points to the first input sequence.
2928 * @param[in] srcALen length of the first input sequence.
2929 * @param[in] pSrcB points to the second input sequence.
2930 * @param[in] srcBLen length of the second input sequence.
2931 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2932 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
2933 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
2935 void arm_conv_opt_q15(
2946 * @brief Convolution of Q15 sequences.
2947 * @param[in] pSrcA points to the first input sequence.
2948 * @param[in] srcALen length of the first input sequence.
2949 * @param[in] pSrcB points to the second input sequence.
2950 * @param[in] srcBLen length of the second input sequence.
2951 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
2962 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
2963 * @param[in] pSrcA points to the first input sequence.
2964 * @param[in] srcALen length of the first input sequence.
2965 * @param[in] pSrcB points to the second input sequence.
2966 * @param[in] srcBLen length of the second input sequence.
2967 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2969 void arm_conv_fast_q15(
2978 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
2979 * @param[in] pSrcA points to the first input sequence.
2980 * @param[in] srcALen length of the first input sequence.
2981 * @param[in] pSrcB points to the second input sequence.
2982 * @param[in] srcBLen length of the second input sequence.
2983 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
2984 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
2985 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
2987 void arm_conv_fast_opt_q15(
2998 * @brief Convolution of Q31 sequences.
2999 * @param[in] pSrcA points to the first input sequence.
3000 * @param[in] srcALen length of the first input sequence.
3001 * @param[in] pSrcB points to the second input sequence.
3002 * @param[in] srcBLen length of the second input sequence.
3003 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3014 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3015 * @param[in] pSrcA points to the first input sequence.
3016 * @param[in] srcALen length of the first input sequence.
3017 * @param[in] pSrcB points to the second input sequence.
3018 * @param[in] srcBLen length of the second input sequence.
3019 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3021 void arm_conv_fast_q31(
3030 * @brief Convolution of Q7 sequences.
3031 * @param[in] pSrcA points to the first input sequence.
3032 * @param[in] srcALen length of the first input sequence.
3033 * @param[in] pSrcB points to the second input sequence.
3034 * @param[in] srcBLen length of the second input sequence.
3035 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3036 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3037 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3039 void arm_conv_opt_q7(
3050 * @brief Convolution of Q7 sequences.
3051 * @param[in] pSrcA points to the first input sequence.
3052 * @param[in] srcALen length of the first input sequence.
3053 * @param[in] pSrcB points to the second input sequence.
3054 * @param[in] srcBLen length of the second input sequence.
3055 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
3066 * @brief Partial convolution of floating-point sequences.
3067 * @param[in] pSrcA points to the first input sequence.
3068 * @param[in] srcALen length of the first input sequence.
3069 * @param[in] pSrcB points to the second input sequence.
3070 * @param[in] srcBLen length of the second input sequence.
3071 * @param[out] pDst points to the block of output data
3072 * @param[in] firstIndex is the first output sample to start with.
3073 * @param[in] numPoints is the number of output points to be computed.
3074 * @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].
3076 arm_status
arm_conv_partial_f32(
3082 uint32_t firstIndex
,
3083 uint32_t numPoints
);
3087 * @brief Partial convolution of Q15 sequences.
3088 * @param[in] pSrcA points to the first input sequence.
3089 * @param[in] srcALen length of the first input sequence.
3090 * @param[in] pSrcB points to the second input sequence.
3091 * @param[in] srcBLen length of the second input sequence.
3092 * @param[out] pDst points to the block of output data
3093 * @param[in] firstIndex is the first output sample to start with.
3094 * @param[in] numPoints is the number of output points to be computed.
3095 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3096 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3097 * @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].
3099 arm_status
arm_conv_partial_opt_q15(
3105 uint32_t firstIndex
,
3112 * @brief Partial convolution of Q15 sequences.
3113 * @param[in] pSrcA points to the first input sequence.
3114 * @param[in] srcALen length of the first input sequence.
3115 * @param[in] pSrcB points to the second input sequence.
3116 * @param[in] srcBLen length of the second input sequence.
3117 * @param[out] pDst points to the block of output data
3118 * @param[in] firstIndex is the first output sample to start with.
3119 * @param[in] numPoints is the number of output points to be computed.
3120 * @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].
3122 arm_status
arm_conv_partial_q15(
3128 uint32_t firstIndex
,
3129 uint32_t numPoints
);
3133 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3134 * @param[in] pSrcA points to the first input sequence.
3135 * @param[in] srcALen length of the first input sequence.
3136 * @param[in] pSrcB points to the second input sequence.
3137 * @param[in] srcBLen length of the second input sequence.
3138 * @param[out] pDst points to the block of output data
3139 * @param[in] firstIndex is the first output sample to start with.
3140 * @param[in] numPoints is the number of output points to be computed.
3141 * @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].
3143 arm_status
arm_conv_partial_fast_q15(
3149 uint32_t firstIndex
,
3150 uint32_t numPoints
);
3154 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
3155 * @param[in] pSrcA points to the first input sequence.
3156 * @param[in] srcALen length of the first input sequence.
3157 * @param[in] pSrcB points to the second input sequence.
3158 * @param[in] srcBLen length of the second input sequence.
3159 * @param[out] pDst points to the block of output data
3160 * @param[in] firstIndex is the first output sample to start with.
3161 * @param[in] numPoints is the number of output points to be computed.
3162 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3163 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
3164 * @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].
3166 arm_status
arm_conv_partial_fast_opt_q15(
3172 uint32_t firstIndex
,
3179 * @brief Partial convolution of Q31 sequences.
3180 * @param[in] pSrcA points to the first input sequence.
3181 * @param[in] srcALen length of the first input sequence.
3182 * @param[in] pSrcB points to the second input sequence.
3183 * @param[in] srcBLen length of the second input sequence.
3184 * @param[out] pDst points to the block of output data
3185 * @param[in] firstIndex is the first output sample to start with.
3186 * @param[in] numPoints is the number of output points to be computed.
3187 * @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].
3189 arm_status
arm_conv_partial_q31(
3195 uint32_t firstIndex
,
3196 uint32_t numPoints
);
3200 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
3201 * @param[in] pSrcA points to the first input sequence.
3202 * @param[in] srcALen length of the first input sequence.
3203 * @param[in] pSrcB points to the second input sequence.
3204 * @param[in] srcBLen length of the second input sequence.
3205 * @param[out] pDst points to the block of output data
3206 * @param[in] firstIndex is the first output sample to start with.
3207 * @param[in] numPoints is the number of output points to be computed.
3208 * @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].
3210 arm_status
arm_conv_partial_fast_q31(
3216 uint32_t firstIndex
,
3217 uint32_t numPoints
);
3221 * @brief Partial convolution of Q7 sequences
3222 * @param[in] pSrcA points to the first input sequence.
3223 * @param[in] srcALen length of the first input sequence.
3224 * @param[in] pSrcB points to the second input sequence.
3225 * @param[in] srcBLen length of the second input sequence.
3226 * @param[out] pDst points to the block of output data
3227 * @param[in] firstIndex is the first output sample to start with.
3228 * @param[in] numPoints is the number of output points to be computed.
3229 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
3230 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
3231 * @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].
3233 arm_status
arm_conv_partial_opt_q7(
3239 uint32_t firstIndex
,
3246 * @brief Partial convolution of Q7 sequences.
3247 * @param[in] pSrcA points to the first input sequence.
3248 * @param[in] srcALen length of the first input sequence.
3249 * @param[in] pSrcB points to the second input sequence.
3250 * @param[in] srcBLen length of the second input sequence.
3251 * @param[out] pDst points to the block of output data
3252 * @param[in] firstIndex is the first output sample to start with.
3253 * @param[in] numPoints is the number of output points to be computed.
3254 * @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].
3256 arm_status
arm_conv_partial_q7(
3262 uint32_t firstIndex
,
3263 uint32_t numPoints
);
3267 * @brief Instance structure for the Q15 FIR decimator.
3271 uint8_t M
; /**< decimation factor. */
3272 uint16_t numTaps
; /**< number of coefficients in the filter. */
3273 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
3274 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3275 } arm_fir_decimate_instance_q15
;
3278 * @brief Instance structure for the Q31 FIR decimator.
3282 uint8_t M
; /**< decimation factor. */
3283 uint16_t numTaps
; /**< number of coefficients in the filter. */
3284 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
3285 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3286 } arm_fir_decimate_instance_q31
;
3289 * @brief Instance structure for the floating-point FIR decimator.
3293 uint8_t M
; /**< decimation factor. */
3294 uint16_t numTaps
; /**< number of coefficients in the filter. */
3295 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
3296 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3297 } arm_fir_decimate_instance_f32
;
3301 * @brief Processing function for the floating-point FIR decimator.
3302 * @param[in] S points to an instance of the floating-point FIR decimator structure.
3303 * @param[in] pSrc points to the block of input data.
3304 * @param[out] pDst points to the block of output data
3305 * @param[in] blockSize number of input samples to process per call.
3307 void arm_fir_decimate_f32(
3308 const arm_fir_decimate_instance_f32
* S
,
3311 uint32_t blockSize
);
3315 * @brief Initialization function for the floating-point FIR decimator.
3316 * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
3317 * @param[in] numTaps number of coefficients in the filter.
3318 * @param[in] M decimation factor.
3319 * @param[in] pCoeffs points to the filter coefficients.
3320 * @param[in] pState points to the state buffer.
3321 * @param[in] blockSize number of input samples to process per call.
3322 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3323 * <code>blockSize</code> is not a multiple of <code>M</code>.
3325 arm_status
arm_fir_decimate_init_f32(
3326 arm_fir_decimate_instance_f32
* S
,
3329 float32_t
* pCoeffs
,
3331 uint32_t blockSize
);
3335 * @brief Processing function for the Q15 FIR decimator.
3336 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3337 * @param[in] pSrc points to the block of input data.
3338 * @param[out] pDst points to the block of output data
3339 * @param[in] blockSize number of input samples to process per call.
3341 void arm_fir_decimate_q15(
3342 const arm_fir_decimate_instance_q15
* S
,
3345 uint32_t blockSize
);
3349 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3350 * @param[in] S points to an instance of the Q15 FIR decimator structure.
3351 * @param[in] pSrc points to the block of input data.
3352 * @param[out] pDst points to the block of output data
3353 * @param[in] blockSize number of input samples to process per call.
3355 void arm_fir_decimate_fast_q15(
3356 const arm_fir_decimate_instance_q15
* S
,
3359 uint32_t blockSize
);
3363 * @brief Initialization function for the Q15 FIR decimator.
3364 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
3365 * @param[in] numTaps number of coefficients in the filter.
3366 * @param[in] M decimation factor.
3367 * @param[in] pCoeffs points to the filter coefficients.
3368 * @param[in] pState points to the state buffer.
3369 * @param[in] blockSize number of input samples to process per call.
3370 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3371 * <code>blockSize</code> is not a multiple of <code>M</code>.
3373 arm_status
arm_fir_decimate_init_q15(
3374 arm_fir_decimate_instance_q15
* S
,
3379 uint32_t blockSize
);
3383 * @brief Processing function for the Q31 FIR decimator.
3384 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3385 * @param[in] pSrc points to the block of input data.
3386 * @param[out] pDst points to the block of output data
3387 * @param[in] blockSize number of input samples to process per call.
3389 void arm_fir_decimate_q31(
3390 const arm_fir_decimate_instance_q31
* S
,
3393 uint32_t blockSize
);
3396 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
3397 * @param[in] S points to an instance of the Q31 FIR decimator structure.
3398 * @param[in] pSrc points to the block of input data.
3399 * @param[out] pDst points to the block of output data
3400 * @param[in] blockSize number of input samples to process per call.
3402 void arm_fir_decimate_fast_q31(
3403 arm_fir_decimate_instance_q31
* S
,
3406 uint32_t blockSize
);
3410 * @brief Initialization function for the Q31 FIR decimator.
3411 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
3412 * @param[in] numTaps number of coefficients in the filter.
3413 * @param[in] M decimation factor.
3414 * @param[in] pCoeffs points to the filter coefficients.
3415 * @param[in] pState points to the state buffer.
3416 * @param[in] blockSize number of input samples to process per call.
3417 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3418 * <code>blockSize</code> is not a multiple of <code>M</code>.
3420 arm_status
arm_fir_decimate_init_q31(
3421 arm_fir_decimate_instance_q31
* S
,
3426 uint32_t blockSize
);
3430 * @brief Instance structure for the Q15 FIR interpolator.
3434 uint8_t L
; /**< upsample factor. */
3435 uint16_t phaseLength
; /**< length of each polyphase filter component. */
3436 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length L*phaseLength. */
3437 q15_t
*pState
; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3438 } arm_fir_interpolate_instance_q15
;
3441 * @brief Instance structure for the Q31 FIR interpolator.
3445 uint8_t L
; /**< upsample factor. */
3446 uint16_t phaseLength
; /**< length of each polyphase filter component. */
3447 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length L*phaseLength. */
3448 q31_t
*pState
; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
3449 } arm_fir_interpolate_instance_q31
;
3452 * @brief Instance structure for the floating-point FIR interpolator.
3456 uint8_t L
; /**< upsample factor. */
3457 uint16_t phaseLength
; /**< length of each polyphase filter component. */
3458 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length L*phaseLength. */
3459 float32_t
*pState
; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
3460 } arm_fir_interpolate_instance_f32
;
3464 * @brief Processing function for the Q15 FIR interpolator.
3465 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3466 * @param[in] pSrc points to the block of input data.
3467 * @param[out] pDst points to the block of output data.
3468 * @param[in] blockSize number of input samples to process per call.
3470 void arm_fir_interpolate_q15(
3471 const arm_fir_interpolate_instance_q15
* S
,
3474 uint32_t blockSize
);
3478 * @brief Initialization function for the Q15 FIR interpolator.
3479 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
3480 * @param[in] L upsample factor.
3481 * @param[in] numTaps number of filter coefficients in the filter.
3482 * @param[in] pCoeffs points to the filter coefficient buffer.
3483 * @param[in] pState points to the state buffer.
3484 * @param[in] blockSize number of input samples to process per call.
3485 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3486 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3488 arm_status
arm_fir_interpolate_init_q15(
3489 arm_fir_interpolate_instance_q15
* S
,
3494 uint32_t blockSize
);
3498 * @brief Processing function for the Q31 FIR interpolator.
3499 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
3500 * @param[in] pSrc points to the block of input data.
3501 * @param[out] pDst points to the block of output data.
3502 * @param[in] blockSize number of input samples to process per call.
3504 void arm_fir_interpolate_q31(
3505 const arm_fir_interpolate_instance_q31
* S
,
3508 uint32_t blockSize
);
3512 * @brief Initialization function for the Q31 FIR interpolator.
3513 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
3514 * @param[in] L upsample factor.
3515 * @param[in] numTaps number of filter coefficients in the filter.
3516 * @param[in] pCoeffs points to the filter coefficient buffer.
3517 * @param[in] pState points to the state buffer.
3518 * @param[in] blockSize number of input samples to process per call.
3519 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3520 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3522 arm_status
arm_fir_interpolate_init_q31(
3523 arm_fir_interpolate_instance_q31
* S
,
3528 uint32_t blockSize
);
3532 * @brief Processing function for the floating-point FIR interpolator.
3533 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
3534 * @param[in] pSrc points to the block of input data.
3535 * @param[out] pDst points to the block of output data.
3536 * @param[in] blockSize number of input samples to process per call.
3538 void arm_fir_interpolate_f32(
3539 const arm_fir_interpolate_instance_f32
* S
,
3542 uint32_t blockSize
);
3546 * @brief Initialization function for the floating-point FIR interpolator.
3547 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
3548 * @param[in] L upsample factor.
3549 * @param[in] numTaps number of filter coefficients in the filter.
3550 * @param[in] pCoeffs points to the filter coefficient buffer.
3551 * @param[in] pState points to the state buffer.
3552 * @param[in] blockSize number of input samples to process per call.
3553 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
3554 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
3556 arm_status
arm_fir_interpolate_init_f32(
3557 arm_fir_interpolate_instance_f32
* S
,
3560 float32_t
* pCoeffs
,
3562 uint32_t blockSize
);
3566 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
3570 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3571 q63_t
*pState
; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3572 q31_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3573 uint8_t postShift
; /**< additional shift, in bits, applied to each output sample. */
3574 } arm_biquad_cas_df1_32x64_ins_q31
;
3578 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3579 * @param[in] pSrc points to the block of input data.
3580 * @param[out] pDst points to the block of output data
3581 * @param[in] blockSize number of samples to process.
3583 void arm_biquad_cas_df1_32x64_q31(
3584 const arm_biquad_cas_df1_32x64_ins_q31
* S
,
3587 uint32_t blockSize
);
3591 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
3592 * @param[in] numStages number of 2nd order stages in the filter.
3593 * @param[in] pCoeffs points to the filter coefficients.
3594 * @param[in] pState points to the state buffer.
3595 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
3597 void arm_biquad_cas_df1_32x64_init_q31(
3598 arm_biquad_cas_df1_32x64_ins_q31
* S
,
3606 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3610 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3611 float32_t
*pState
; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3612 float32_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3613 } arm_biquad_cascade_df2T_instance_f32
;
3616 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3620 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3621 float32_t
*pState
; /**< points to the array of state coefficients. The array is of length 4*numStages. */
3622 float32_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3623 } arm_biquad_cascade_stereo_df2T_instance_f32
;
3626 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
3630 uint8_t numStages
; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
3631 float64_t
*pState
; /**< points to the array of state coefficients. The array is of length 2*numStages. */
3632 float64_t
*pCoeffs
; /**< points to the array of coefficients. The array is of length 5*numStages. */
3633 } arm_biquad_cascade_df2T_instance_f64
;
3637 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3638 * @param[in] S points to an instance of the filter data structure.
3639 * @param[in] pSrc points to the block of input data.
3640 * @param[out] pDst points to the block of output data
3641 * @param[in] blockSize number of samples to process.
3643 void arm_biquad_cascade_df2T_f32(
3644 const arm_biquad_cascade_df2T_instance_f32
* S
,
3647 uint32_t blockSize
);
3651 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
3652 * @param[in] S points to an instance of the filter data structure.
3653 * @param[in] pSrc points to the block of input data.
3654 * @param[out] pDst points to the block of output data
3655 * @param[in] blockSize number of samples to process.
3657 void arm_biquad_cascade_stereo_df2T_f32(
3658 const arm_biquad_cascade_stereo_df2T_instance_f32
* S
,
3661 uint32_t blockSize
);
3665 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
3666 * @param[in] S points to an instance of the filter data structure.
3667 * @param[in] pSrc points to the block of input data.
3668 * @param[out] pDst points to the block of output data
3669 * @param[in] blockSize number of samples to process.
3671 void arm_biquad_cascade_df2T_f64(
3672 const arm_biquad_cascade_df2T_instance_f64
* S
,
3675 uint32_t blockSize
);
3679 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3680 * @param[in,out] S points to an instance of the filter data structure.
3681 * @param[in] numStages number of 2nd order stages in the filter.
3682 * @param[in] pCoeffs points to the filter coefficients.
3683 * @param[in] pState points to the state buffer.
3685 void arm_biquad_cascade_df2T_init_f32(
3686 arm_biquad_cascade_df2T_instance_f32
* S
,
3688 float32_t
* pCoeffs
,
3689 float32_t
* pState
);
3693 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3694 * @param[in,out] S points to an instance of the filter data structure.
3695 * @param[in] numStages number of 2nd order stages in the filter.
3696 * @param[in] pCoeffs points to the filter coefficients.
3697 * @param[in] pState points to the state buffer.
3699 void arm_biquad_cascade_stereo_df2T_init_f32(
3700 arm_biquad_cascade_stereo_df2T_instance_f32
* S
,
3702 float32_t
* pCoeffs
,
3703 float32_t
* pState
);
3707 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
3708 * @param[in,out] S points to an instance of the filter data structure.
3709 * @param[in] numStages number of 2nd order stages in the filter.
3710 * @param[in] pCoeffs points to the filter coefficients.
3711 * @param[in] pState points to the state buffer.
3713 void arm_biquad_cascade_df2T_init_f64(
3714 arm_biquad_cascade_df2T_instance_f64
* S
,
3716 float64_t
* pCoeffs
,
3717 float64_t
* pState
);
3721 * @brief Instance structure for the Q15 FIR lattice filter.
3725 uint16_t numStages
; /**< number of filter stages. */
3726 q15_t
*pState
; /**< points to the state variable array. The array is of length numStages. */
3727 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numStages. */
3728 } arm_fir_lattice_instance_q15
;
3731 * @brief Instance structure for the Q31 FIR lattice filter.
3735 uint16_t numStages
; /**< number of filter stages. */
3736 q31_t
*pState
; /**< points to the state variable array. The array is of length numStages. */
3737 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numStages. */
3738 } arm_fir_lattice_instance_q31
;
3741 * @brief Instance structure for the floating-point FIR lattice filter.
3745 uint16_t numStages
; /**< number of filter stages. */
3746 float32_t
*pState
; /**< points to the state variable array. The array is of length numStages. */
3747 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numStages. */
3748 } arm_fir_lattice_instance_f32
;
3752 * @brief Initialization function for the Q15 FIR lattice filter.
3753 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3754 * @param[in] numStages number of filter stages.
3755 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3756 * @param[in] pState points to the state buffer. The array is of length numStages.
3758 void arm_fir_lattice_init_q15(
3759 arm_fir_lattice_instance_q15
* S
,
3766 * @brief Processing function for the Q15 FIR lattice filter.
3767 * @param[in] S points to an instance of the Q15 FIR lattice structure.
3768 * @param[in] pSrc points to the block of input data.
3769 * @param[out] pDst points to the block of output data.
3770 * @param[in] blockSize number of samples to process.
3772 void arm_fir_lattice_q15(
3773 const arm_fir_lattice_instance_q15
* S
,
3776 uint32_t blockSize
);
3780 * @brief Initialization function for the Q31 FIR lattice filter.
3781 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3782 * @param[in] numStages number of filter stages.
3783 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3784 * @param[in] pState points to the state buffer. The array is of length numStages.
3786 void arm_fir_lattice_init_q31(
3787 arm_fir_lattice_instance_q31
* S
,
3794 * @brief Processing function for the Q31 FIR lattice filter.
3795 * @param[in] S points to an instance of the Q31 FIR lattice structure.
3796 * @param[in] pSrc points to the block of input data.
3797 * @param[out] pDst points to the block of output data
3798 * @param[in] blockSize number of samples to process.
3800 void arm_fir_lattice_q31(
3801 const arm_fir_lattice_instance_q31
* S
,
3804 uint32_t blockSize
);
3808 * @brief Initialization function for the floating-point FIR lattice filter.
3809 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3810 * @param[in] numStages number of filter stages.
3811 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
3812 * @param[in] pState points to the state buffer. The array is of length numStages.
3814 void arm_fir_lattice_init_f32(
3815 arm_fir_lattice_instance_f32
* S
,
3817 float32_t
* pCoeffs
,
3818 float32_t
* pState
);
3822 * @brief Processing function for the floating-point FIR lattice filter.
3823 * @param[in] S points to an instance of the floating-point FIR lattice structure.
3824 * @param[in] pSrc points to the block of input data.
3825 * @param[out] pDst points to the block of output data
3826 * @param[in] blockSize number of samples to process.
3828 void arm_fir_lattice_f32(
3829 const arm_fir_lattice_instance_f32
* S
,
3832 uint32_t blockSize
);
3836 * @brief Instance structure for the Q15 IIR lattice filter.
3840 uint16_t numStages
; /**< number of stages in the filter. */
3841 q15_t
*pState
; /**< points to the state variable array. The array is of length numStages+blockSize. */
3842 q15_t
*pkCoeffs
; /**< points to the reflection coefficient array. The array is of length numStages. */
3843 q15_t
*pvCoeffs
; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3844 } arm_iir_lattice_instance_q15
;
3847 * @brief Instance structure for the Q31 IIR lattice filter.
3851 uint16_t numStages
; /**< number of stages in the filter. */
3852 q31_t
*pState
; /**< points to the state variable array. The array is of length numStages+blockSize. */
3853 q31_t
*pkCoeffs
; /**< points to the reflection coefficient array. The array is of length numStages. */
3854 q31_t
*pvCoeffs
; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3855 } arm_iir_lattice_instance_q31
;
3858 * @brief Instance structure for the floating-point IIR lattice filter.
3862 uint16_t numStages
; /**< number of stages in the filter. */
3863 float32_t
*pState
; /**< points to the state variable array. The array is of length numStages+blockSize. */
3864 float32_t
*pkCoeffs
; /**< points to the reflection coefficient array. The array is of length numStages. */
3865 float32_t
*pvCoeffs
; /**< points to the ladder coefficient array. The array is of length numStages+1. */
3866 } arm_iir_lattice_instance_f32
;
3870 * @brief Processing function for the floating-point IIR lattice filter.
3871 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3872 * @param[in] pSrc points to the block of input data.
3873 * @param[out] pDst points to the block of output data.
3874 * @param[in] blockSize number of samples to process.
3876 void arm_iir_lattice_f32(
3877 const arm_iir_lattice_instance_f32
* S
,
3880 uint32_t blockSize
);
3884 * @brief Initialization function for the floating-point IIR lattice filter.
3885 * @param[in] S points to an instance of the floating-point IIR lattice structure.
3886 * @param[in] numStages number of stages in the filter.
3887 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3888 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3889 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
3890 * @param[in] blockSize number of samples to process.
3892 void arm_iir_lattice_init_f32(
3893 arm_iir_lattice_instance_f32
* S
,
3895 float32_t
* pkCoeffs
,
3896 float32_t
* pvCoeffs
,
3898 uint32_t blockSize
);
3902 * @brief Processing function for the Q31 IIR lattice filter.
3903 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3904 * @param[in] pSrc points to the block of input data.
3905 * @param[out] pDst points to the block of output data.
3906 * @param[in] blockSize number of samples to process.
3908 void arm_iir_lattice_q31(
3909 const arm_iir_lattice_instance_q31
* S
,
3912 uint32_t blockSize
);
3916 * @brief Initialization function for the Q31 IIR lattice filter.
3917 * @param[in] S points to an instance of the Q31 IIR lattice structure.
3918 * @param[in] numStages number of stages in the filter.
3919 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
3920 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
3921 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
3922 * @param[in] blockSize number of samples to process.
3924 void arm_iir_lattice_init_q31(
3925 arm_iir_lattice_instance_q31
* S
,
3930 uint32_t blockSize
);
3934 * @brief Processing function for the Q15 IIR lattice filter.
3935 * @param[in] S points to an instance of the Q15 IIR lattice structure.
3936 * @param[in] pSrc points to the block of input data.
3937 * @param[out] pDst points to the block of output data.
3938 * @param[in] blockSize number of samples to process.
3940 void arm_iir_lattice_q15(
3941 const arm_iir_lattice_instance_q15
* S
,
3944 uint32_t blockSize
);
3948 * @brief Initialization function for the Q15 IIR lattice filter.
3949 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
3950 * @param[in] numStages number of stages in the filter.
3951 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
3952 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
3953 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
3954 * @param[in] blockSize number of samples to process per call.
3956 void arm_iir_lattice_init_q15(
3957 arm_iir_lattice_instance_q15
* S
,
3962 uint32_t blockSize
);
3966 * @brief Instance structure for the floating-point LMS filter.
3970 uint16_t numTaps
; /**< number of coefficients in the filter. */
3971 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
3972 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
3973 float32_t mu
; /**< step size that controls filter coefficient updates. */
3974 } arm_lms_instance_f32
;
3978 * @brief Processing function for floating-point LMS filter.
3979 * @param[in] S points to an instance of the floating-point LMS filter structure.
3980 * @param[in] pSrc points to the block of input data.
3981 * @param[in] pRef points to the block of reference data.
3982 * @param[out] pOut points to the block of output data.
3983 * @param[out] pErr points to the block of error data.
3984 * @param[in] blockSize number of samples to process.
3987 const arm_lms_instance_f32
* S
,
3992 uint32_t blockSize
);
3996 * @brief Initialization function for floating-point LMS filter.
3997 * @param[in] S points to an instance of the floating-point LMS filter structure.
3998 * @param[in] numTaps number of filter coefficients.
3999 * @param[in] pCoeffs points to the coefficient buffer.
4000 * @param[in] pState points to state buffer.
4001 * @param[in] mu step size that controls filter coefficient updates.
4002 * @param[in] blockSize number of samples to process.
4004 void arm_lms_init_f32(
4005 arm_lms_instance_f32
* S
,
4007 float32_t
* pCoeffs
,
4010 uint32_t blockSize
);
4014 * @brief Instance structure for the Q15 LMS filter.
4018 uint16_t numTaps
; /**< number of coefficients in the filter. */
4019 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4020 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4021 q15_t mu
; /**< step size that controls filter coefficient updates. */
4022 uint32_t postShift
; /**< bit shift applied to coefficients. */
4023 } arm_lms_instance_q15
;
4027 * @brief Initialization function for the Q15 LMS filter.
4028 * @param[in] S points to an instance of the Q15 LMS filter structure.
4029 * @param[in] numTaps number of filter coefficients.
4030 * @param[in] pCoeffs points to the coefficient buffer.
4031 * @param[in] pState points to the state buffer.
4032 * @param[in] mu step size that controls filter coefficient updates.
4033 * @param[in] blockSize number of samples to process.
4034 * @param[in] postShift bit shift applied to coefficients.
4036 void arm_lms_init_q15(
4037 arm_lms_instance_q15
* S
,
4043 uint32_t postShift
);
4047 * @brief Processing function for Q15 LMS filter.
4048 * @param[in] S points to an instance of the Q15 LMS filter structure.
4049 * @param[in] pSrc points to the block of input data.
4050 * @param[in] pRef points to the block of reference data.
4051 * @param[out] pOut points to the block of output data.
4052 * @param[out] pErr points to the block of error data.
4053 * @param[in] blockSize number of samples to process.
4056 const arm_lms_instance_q15
* S
,
4061 uint32_t blockSize
);
4065 * @brief Instance structure for the Q31 LMS filter.
4069 uint16_t numTaps
; /**< number of coefficients in the filter. */
4070 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4071 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4072 q31_t mu
; /**< step size that controls filter coefficient updates. */
4073 uint32_t postShift
; /**< bit shift applied to coefficients. */
4074 } arm_lms_instance_q31
;
4078 * @brief Processing function for Q31 LMS filter.
4079 * @param[in] S points to an instance of the Q15 LMS filter structure.
4080 * @param[in] pSrc points to the block of input data.
4081 * @param[in] pRef points to the block of reference data.
4082 * @param[out] pOut points to the block of output data.
4083 * @param[out] pErr points to the block of error data.
4084 * @param[in] blockSize number of samples to process.
4087 const arm_lms_instance_q31
* S
,
4092 uint32_t blockSize
);
4096 * @brief Initialization function for Q31 LMS filter.
4097 * @param[in] S points to an instance of the Q31 LMS filter structure.
4098 * @param[in] numTaps number of filter coefficients.
4099 * @param[in] pCoeffs points to coefficient buffer.
4100 * @param[in] pState points to state buffer.
4101 * @param[in] mu step size that controls filter coefficient updates.
4102 * @param[in] blockSize number of samples to process.
4103 * @param[in] postShift bit shift applied to coefficients.
4105 void arm_lms_init_q31(
4106 arm_lms_instance_q31
* S
,
4112 uint32_t postShift
);
4116 * @brief Instance structure for the floating-point normalized LMS filter.
4120 uint16_t numTaps
; /**< number of coefficients in the filter. */
4121 float32_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4122 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4123 float32_t mu
; /**< step size that control filter coefficient updates. */
4124 float32_t energy
; /**< saves previous frame energy. */
4125 float32_t x0
; /**< saves previous input sample. */
4126 } arm_lms_norm_instance_f32
;
4130 * @brief Processing function for floating-point normalized LMS filter.
4131 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
4132 * @param[in] pSrc points to the block of input data.
4133 * @param[in] pRef points to the block of reference data.
4134 * @param[out] pOut points to the block of output data.
4135 * @param[out] pErr points to the block of error data.
4136 * @param[in] blockSize number of samples to process.
4138 void arm_lms_norm_f32(
4139 arm_lms_norm_instance_f32
* S
,
4144 uint32_t blockSize
);
4148 * @brief Initialization function for floating-point normalized LMS filter.
4149 * @param[in] S points to an instance of the floating-point LMS filter structure.
4150 * @param[in] numTaps number of filter coefficients.
4151 * @param[in] pCoeffs points to coefficient buffer.
4152 * @param[in] pState points to state buffer.
4153 * @param[in] mu step size that controls filter coefficient updates.
4154 * @param[in] blockSize number of samples to process.
4156 void arm_lms_norm_init_f32(
4157 arm_lms_norm_instance_f32
* S
,
4159 float32_t
* pCoeffs
,
4162 uint32_t blockSize
);
4166 * @brief Instance structure for the Q31 normalized LMS filter.
4170 uint16_t numTaps
; /**< number of coefficients in the filter. */
4171 q31_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4172 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4173 q31_t mu
; /**< step size that controls filter coefficient updates. */
4174 uint8_t postShift
; /**< bit shift applied to coefficients. */
4175 q31_t
*recipTable
; /**< points to the reciprocal initial value table. */
4176 q31_t energy
; /**< saves previous frame energy. */
4177 q31_t x0
; /**< saves previous input sample. */
4178 } arm_lms_norm_instance_q31
;
4182 * @brief Processing function for Q31 normalized LMS filter.
4183 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4184 * @param[in] pSrc points to the block of input data.
4185 * @param[in] pRef points to the block of reference data.
4186 * @param[out] pOut points to the block of output data.
4187 * @param[out] pErr points to the block of error data.
4188 * @param[in] blockSize number of samples to process.
4190 void arm_lms_norm_q31(
4191 arm_lms_norm_instance_q31
* S
,
4196 uint32_t blockSize
);
4200 * @brief Initialization function for Q31 normalized LMS filter.
4201 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
4202 * @param[in] numTaps number of filter coefficients.
4203 * @param[in] pCoeffs points to coefficient buffer.
4204 * @param[in] pState points to state buffer.
4205 * @param[in] mu step size that controls filter coefficient updates.
4206 * @param[in] blockSize number of samples to process.
4207 * @param[in] postShift bit shift applied to coefficients.
4209 void arm_lms_norm_init_q31(
4210 arm_lms_norm_instance_q31
* S
,
4220 * @brief Instance structure for the Q15 normalized LMS filter.
4224 uint16_t numTaps
; /**< Number of coefficients in the filter. */
4225 q15_t
*pState
; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
4226 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps. */
4227 q15_t mu
; /**< step size that controls filter coefficient updates. */
4228 uint8_t postShift
; /**< bit shift applied to coefficients. */
4229 q15_t
*recipTable
; /**< Points to the reciprocal initial value table. */
4230 q15_t energy
; /**< saves previous frame energy. */
4231 q15_t x0
; /**< saves previous input sample. */
4232 } arm_lms_norm_instance_q15
;
4236 * @brief Processing function for Q15 normalized LMS filter.
4237 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4238 * @param[in] pSrc points to the block of input data.
4239 * @param[in] pRef points to the block of reference data.
4240 * @param[out] pOut points to the block of output data.
4241 * @param[out] pErr points to the block of error data.
4242 * @param[in] blockSize number of samples to process.
4244 void arm_lms_norm_q15(
4245 arm_lms_norm_instance_q15
* S
,
4250 uint32_t blockSize
);
4254 * @brief Initialization function for Q15 normalized LMS filter.
4255 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
4256 * @param[in] numTaps number of filter coefficients.
4257 * @param[in] pCoeffs points to coefficient buffer.
4258 * @param[in] pState points to state buffer.
4259 * @param[in] mu step size that controls filter coefficient updates.
4260 * @param[in] blockSize number of samples to process.
4261 * @param[in] postShift bit shift applied to coefficients.
4263 void arm_lms_norm_init_q15(
4264 arm_lms_norm_instance_q15
* S
,
4274 * @brief Correlation of floating-point sequences.
4275 * @param[in] pSrcA points to the first input sequence.
4276 * @param[in] srcALen length of the first input sequence.
4277 * @param[in] pSrcB points to the second input sequence.
4278 * @param[in] srcBLen length of the second input sequence.
4279 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4281 void arm_correlate_f32(
4290 * @brief Correlation of Q15 sequences
4291 * @param[in] pSrcA points to the first input sequence.
4292 * @param[in] srcALen length of the first input sequence.
4293 * @param[in] pSrcB points to the second input sequence.
4294 * @param[in] srcBLen length of the second input sequence.
4295 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4296 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4298 void arm_correlate_opt_q15(
4308 * @brief Correlation of Q15 sequences.
4309 * @param[in] pSrcA points to the first input sequence.
4310 * @param[in] srcALen length of the first input sequence.
4311 * @param[in] pSrcB points to the second input sequence.
4312 * @param[in] srcBLen length of the second input sequence.
4313 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4316 void arm_correlate_q15(
4325 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4326 * @param[in] pSrcA points to the first input sequence.
4327 * @param[in] srcALen length of the first input sequence.
4328 * @param[in] pSrcB points to the second input sequence.
4329 * @param[in] srcBLen length of the second input sequence.
4330 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4333 void arm_correlate_fast_q15(
4342 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
4343 * @param[in] pSrcA points to the first input sequence.
4344 * @param[in] srcALen length of the first input sequence.
4345 * @param[in] pSrcB points to the second input sequence.
4346 * @param[in] srcBLen length of the second input sequence.
4347 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4348 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4350 void arm_correlate_fast_opt_q15(
4360 * @brief Correlation of Q31 sequences.
4361 * @param[in] pSrcA points to the first input sequence.
4362 * @param[in] srcALen length of the first input sequence.
4363 * @param[in] pSrcB points to the second input sequence.
4364 * @param[in] srcBLen length of the second input sequence.
4365 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4367 void arm_correlate_q31(
4376 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
4377 * @param[in] pSrcA points to the first input sequence.
4378 * @param[in] srcALen length of the first input sequence.
4379 * @param[in] pSrcB points to the second input sequence.
4380 * @param[in] srcBLen length of the second input sequence.
4381 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4383 void arm_correlate_fast_q31(
4392 * @brief Correlation of Q7 sequences.
4393 * @param[in] pSrcA points to the first input sequence.
4394 * @param[in] srcALen length of the first input sequence.
4395 * @param[in] pSrcB points to the second input sequence.
4396 * @param[in] srcBLen length of the second input sequence.
4397 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4398 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
4399 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
4401 void arm_correlate_opt_q7(
4412 * @brief Correlation of Q7 sequences.
4413 * @param[in] pSrcA points to the first input sequence.
4414 * @param[in] srcALen length of the first input sequence.
4415 * @param[in] pSrcB points to the second input sequence.
4416 * @param[in] srcBLen length of the second input sequence.
4417 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
4419 void arm_correlate_q7(
4428 * @brief Instance structure for the floating-point sparse FIR filter.
4432 uint16_t numTaps
; /**< number of coefficients in the filter. */
4433 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4434 float32_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4435 float32_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4436 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4437 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4438 } arm_fir_sparse_instance_f32
;
4441 * @brief Instance structure for the Q31 sparse FIR filter.
4445 uint16_t numTaps
; /**< number of coefficients in the filter. */
4446 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4447 q31_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4448 q31_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4449 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4450 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4451 } arm_fir_sparse_instance_q31
;
4454 * @brief Instance structure for the Q15 sparse FIR filter.
4458 uint16_t numTaps
; /**< number of coefficients in the filter. */
4459 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4460 q15_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4461 q15_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4462 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4463 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4464 } arm_fir_sparse_instance_q15
;
4467 * @brief Instance structure for the Q7 sparse FIR filter.
4471 uint16_t numTaps
; /**< number of coefficients in the filter. */
4472 uint16_t stateIndex
; /**< state buffer index. Points to the oldest sample in the state buffer. */
4473 q7_t
*pState
; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
4474 q7_t
*pCoeffs
; /**< points to the coefficient array. The array is of length numTaps.*/
4475 uint16_t maxDelay
; /**< maximum offset specified by the pTapDelay array. */
4476 int32_t *pTapDelay
; /**< points to the array of delay values. The array is of length numTaps. */
4477 } arm_fir_sparse_instance_q7
;
4481 * @brief Processing function for the floating-point sparse FIR filter.
4482 * @param[in] S points to an instance of the floating-point sparse FIR structure.
4483 * @param[in] pSrc points to the block of input data.
4484 * @param[out] pDst points to the block of output data
4485 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4486 * @param[in] blockSize number of input samples to process per call.
4488 void arm_fir_sparse_f32(
4489 arm_fir_sparse_instance_f32
* S
,
4492 float32_t
* pScratchIn
,
4493 uint32_t blockSize
);
4497 * @brief Initialization function for the floating-point sparse FIR filter.
4498 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
4499 * @param[in] numTaps number of nonzero coefficients in the filter.
4500 * @param[in] pCoeffs points to the array of filter coefficients.
4501 * @param[in] pState points to the state buffer.
4502 * @param[in] pTapDelay points to the array of offset times.
4503 * @param[in] maxDelay maximum offset time supported.
4504 * @param[in] blockSize number of samples that will be processed per block.
4506 void arm_fir_sparse_init_f32(
4507 arm_fir_sparse_instance_f32
* S
,
4509 float32_t
* pCoeffs
,
4511 int32_t * pTapDelay
,
4513 uint32_t blockSize
);
4517 * @brief Processing function for the Q31 sparse FIR filter.
4518 * @param[in] S points to an instance of the Q31 sparse FIR structure.
4519 * @param[in] pSrc points to the block of input data.
4520 * @param[out] pDst points to the block of output data
4521 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4522 * @param[in] blockSize number of input samples to process per call.
4524 void arm_fir_sparse_q31(
4525 arm_fir_sparse_instance_q31
* S
,
4529 uint32_t blockSize
);
4533 * @brief Initialization function for the Q31 sparse FIR filter.
4534 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
4535 * @param[in] numTaps number of nonzero coefficients in the filter.
4536 * @param[in] pCoeffs points to the array of filter coefficients.
4537 * @param[in] pState points to the state buffer.
4538 * @param[in] pTapDelay points to the array of offset times.
4539 * @param[in] maxDelay maximum offset time supported.
4540 * @param[in] blockSize number of samples that will be processed per block.
4542 void arm_fir_sparse_init_q31(
4543 arm_fir_sparse_instance_q31
* S
,
4547 int32_t * pTapDelay
,
4549 uint32_t blockSize
);
4553 * @brief Processing function for the Q15 sparse FIR filter.
4554 * @param[in] S points to an instance of the Q15 sparse FIR structure.
4555 * @param[in] pSrc points to the block of input data.
4556 * @param[out] pDst points to the block of output data
4557 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4558 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4559 * @param[in] blockSize number of input samples to process per call.
4561 void arm_fir_sparse_q15(
4562 arm_fir_sparse_instance_q15
* S
,
4566 q31_t
* pScratchOut
,
4567 uint32_t blockSize
);
4571 * @brief Initialization function for the Q15 sparse FIR filter.
4572 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
4573 * @param[in] numTaps number of nonzero coefficients in the filter.
4574 * @param[in] pCoeffs points to the array of filter coefficients.
4575 * @param[in] pState points to the state buffer.
4576 * @param[in] pTapDelay points to the array of offset times.
4577 * @param[in] maxDelay maximum offset time supported.
4578 * @param[in] blockSize number of samples that will be processed per block.
4580 void arm_fir_sparse_init_q15(
4581 arm_fir_sparse_instance_q15
* S
,
4585 int32_t * pTapDelay
,
4587 uint32_t blockSize
);
4591 * @brief Processing function for the Q7 sparse FIR filter.
4592 * @param[in] S points to an instance of the Q7 sparse FIR structure.
4593 * @param[in] pSrc points to the block of input data.
4594 * @param[out] pDst points to the block of output data
4595 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
4596 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
4597 * @param[in] blockSize number of input samples to process per call.
4599 void arm_fir_sparse_q7(
4600 arm_fir_sparse_instance_q7
* S
,
4604 q31_t
* pScratchOut
,
4605 uint32_t blockSize
);
4609 * @brief Initialization function for the Q7 sparse FIR filter.
4610 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
4611 * @param[in] numTaps number of nonzero coefficients in the filter.
4612 * @param[in] pCoeffs points to the array of filter coefficients.
4613 * @param[in] pState points to the state buffer.
4614 * @param[in] pTapDelay points to the array of offset times.
4615 * @param[in] maxDelay maximum offset time supported.
4616 * @param[in] blockSize number of samples that will be processed per block.
4618 void arm_fir_sparse_init_q7(
4619 arm_fir_sparse_instance_q7
* S
,
4623 int32_t * pTapDelay
,
4625 uint32_t blockSize
);
4629 * @brief Floating-point sin_cos function.
4630 * @param[in] theta input value in degrees
4631 * @param[out] pSinVal points to the processed sine output.
4632 * @param[out] pCosVal points to the processed cos output.
4634 void arm_sin_cos_f32(
4636 float32_t
* pSinVal
,
4637 float32_t
* pCosVal
);
4641 * @brief Q31 sin_cos function.
4642 * @param[in] theta scaled input value in degrees
4643 * @param[out] pSinVal points to the processed sine output.
4644 * @param[out] pCosVal points to the processed cosine output.
4646 void arm_sin_cos_q31(
4653 * @brief Floating-point complex conjugate.
4654 * @param[in] pSrc points to the input vector
4655 * @param[out] pDst points to the output vector
4656 * @param[in] numSamples number of complex samples in each vector
4658 void arm_cmplx_conj_f32(
4661 uint32_t numSamples
);
4664 * @brief Q31 complex conjugate.
4665 * @param[in] pSrc points to the input vector
4666 * @param[out] pDst points to the output vector
4667 * @param[in] numSamples number of complex samples in each vector
4669 void arm_cmplx_conj_q31(
4672 uint32_t numSamples
);
4676 * @brief Q15 complex conjugate.
4677 * @param[in] pSrc points to the input vector
4678 * @param[out] pDst points to the output vector
4679 * @param[in] numSamples number of complex samples in each vector
4681 void arm_cmplx_conj_q15(
4684 uint32_t numSamples
);
4688 * @brief Floating-point complex magnitude squared
4689 * @param[in] pSrc points to the complex input vector
4690 * @param[out] pDst points to the real output vector
4691 * @param[in] numSamples number of complex samples in the input vector
4693 void arm_cmplx_mag_squared_f32(
4696 uint32_t numSamples
);
4700 * @brief Q31 complex magnitude squared
4701 * @param[in] pSrc points to the complex input vector
4702 * @param[out] pDst points to the real output vector
4703 * @param[in] numSamples number of complex samples in the input vector
4705 void arm_cmplx_mag_squared_q31(
4708 uint32_t numSamples
);
4712 * @brief Q15 complex magnitude squared
4713 * @param[in] pSrc points to the complex input vector
4714 * @param[out] pDst points to the real output vector
4715 * @param[in] numSamples number of complex samples in the input vector
4717 void arm_cmplx_mag_squared_q15(
4720 uint32_t numSamples
);
4724 * @ingroup groupController
4728 * @defgroup PID PID Motor Control
4730 * A Proportional Integral Derivative (PID) controller is a generic feedback control
4731 * loop mechanism widely used in industrial control systems.
4732 * A PID controller is the most commonly used type of feedback controller.
4734 * This set of functions implements (PID) controllers
4735 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
4736 * of data and each call to the function returns a single processed value.
4737 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
4738 * is the input sample value. The functions return the output value.
4742 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
4744 * A1 = (-Kp ) - (2 * Kd )
4748 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
4751 * \image html PID.gif "Proportional Integral Derivative Controller"
4754 * The PID controller calculates an "error" value as the difference between
4755 * the measured output and the reference input.
4756 * The controller attempts to minimize the error by adjusting the process control inputs.
4757 * The proportional value determines the reaction to the current error,
4758 * the integral value determines the reaction based on the sum of recent errors,
4759 * and the derivative value determines the reaction based on the rate at which the error has been changing.
4761 * \par Instance Structure
4762 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
4763 * A separate instance structure must be defined for each PID Controller.
4764 * There are separate instance structure declarations for each of the 3 supported data types.
4766 * \par Reset Functions
4767 * There is also an associated reset function for each data type which clears the state array.
4769 * \par Initialization Functions
4770 * There is also an associated initialization function for each data type.
4771 * The initialization function performs the following operations:
4772 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
4773 * - Zeros out the values in the state buffer.
4776 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
4778 * \par Fixed-Point Behavior
4779 * Care must be taken when using the fixed-point versions of the PID Controller functions.
4780 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
4781 * Refer to the function specific documentation below for usage guidelines.
4790 * @brief Process function for the floating-point PID Control.
4791 * @param[in,out] S is an instance of the floating-point PID Control structure
4792 * @param[in] in input sample to process
4793 * @return out processed output sample.
4795 static __INLINE float32_t
arm_pid_f32(
4796 arm_pid_instance_f32
* S
,
4801 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
4802 out
= (S
->A0
* in
) +
4803 (S
->A1
* S
->state
[0]) + (S
->A2
* S
->state
[1]) + (S
->state
[2]);
4806 S
->state
[1] = S
->state
[0];
4810 /* return to application */
4816 * @brief Process function for the Q31 PID Control.
4817 * @param[in,out] S points to an instance of the Q31 PID Control structure
4818 * @param[in] in input sample to process
4819 * @return out processed output sample.
4821 * <b>Scaling and Overflow Behavior:</b>
4823 * The function is implemented using an internal 64-bit accumulator.
4824 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
4825 * Thus, if the accumulator result overflows it wraps around rather than clip.
4826 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
4827 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
4829 static __INLINE q31_t
arm_pid_q31(
4830 arm_pid_instance_q31
* S
,
4836 /* acc = A0 * x[n] */
4837 acc
= (q63_t
) S
->A0
* in
;
4839 /* acc += A1 * x[n-1] */
4840 acc
+= (q63_t
) S
->A1
* S
->state
[0];
4842 /* acc += A2 * x[n-2] */
4843 acc
+= (q63_t
) S
->A2
* S
->state
[1];
4845 /* convert output to 1.31 format to add y[n-1] */
4846 out
= (q31_t
) (acc
>> 31u);
4852 S
->state
[1] = S
->state
[0];
4856 /* return to application */
4862 * @brief Process function for the Q15 PID Control.
4863 * @param[in,out] S points to an instance of the Q15 PID Control structure
4864 * @param[in] in input sample to process
4865 * @return out processed output sample.
4867 * <b>Scaling and Overflow Behavior:</b>
4869 * The function is implemented using a 64-bit internal accumulator.
4870 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
4871 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
4872 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
4873 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
4874 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
4876 static __INLINE q15_t
arm_pid_q15(
4877 arm_pid_instance_q15
* S
,
4883 #ifndef ARM_MATH_CM0_FAMILY
4884 __SIMD32_TYPE
*vstate
;
4886 /* Implementation of PID controller */
4888 /* acc = A0 * x[n] */
4889 acc
= (q31_t
) __SMUAD((uint32_t)S
->A0
, (uint32_t)in
);
4891 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4892 vstate
= __SIMD32_CONST(S
->state
);
4893 acc
= (q63_t
)__SMLALD((uint32_t)S
->A1
, (uint32_t)*vstate
, (uint64_t)acc
);
4895 /* acc = A0 * x[n] */
4896 acc
= ((q31_t
) S
->A0
) * in
;
4898 /* acc += A1 * x[n-1] + A2 * x[n-2] */
4899 acc
+= (q31_t
) S
->A1
* S
->state
[0];
4900 acc
+= (q31_t
) S
->A2
* S
->state
[1];
4904 acc
+= (q31_t
) S
->state
[2] << 15;
4906 /* saturate the output */
4907 out
= (q15_t
) (__SSAT((acc
>> 15), 16));
4910 S
->state
[1] = S
->state
[0];
4914 /* return to application */
4919 * @} end of PID group
4924 * @brief Floating-point matrix inverse.
4925 * @param[in] src points to the instance of the input floating-point matrix structure.
4926 * @param[out] dst points to the instance of the output floating-point matrix structure.
4927 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4928 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4930 arm_status
arm_mat_inverse_f32(
4931 const arm_matrix_instance_f32
* src
,
4932 arm_matrix_instance_f32
* dst
);
4936 * @brief Floating-point matrix inverse.
4937 * @param[in] src points to the instance of the input floating-point matrix structure.
4938 * @param[out] dst points to the instance of the output floating-point matrix structure.
4939 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
4940 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
4942 arm_status
arm_mat_inverse_f64(
4943 const arm_matrix_instance_f64
* src
,
4944 arm_matrix_instance_f64
* dst
);
4949 * @ingroup groupController
4953 * @defgroup clarke Vector Clarke Transform
4954 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
4955 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
4956 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
4957 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
4958 * \image html clarke.gif Stator current space vector and its components in (a,b).
4959 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
4960 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
4962 * The function operates on a single sample of data and each call to the function returns the processed output.
4963 * The library provides separate functions for Q31 and floating-point data types.
4965 * \image html clarkeFormula.gif
4966 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
4967 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
4968 * \par Fixed-Point Behavior
4969 * Care must be taken when using the Q31 version of the Clarke transform.
4970 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
4971 * Refer to the function specific documentation below for usage guidelines.
4975 * @addtogroup clarke
4981 * @brief Floating-point Clarke transform
4982 * @param[in] Ia input three-phase coordinate <code>a</code>
4983 * @param[in] Ib input three-phase coordinate <code>b</code>
4984 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
4985 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
4987 static __INLINE
void arm_clarke_f32(
4990 float32_t
* pIalpha
,
4993 /* Calculate pIalpha using the equation, pIalpha = Ia */
4996 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
4997 *pIbeta
= ((float32_t
) 0.57735026919 * Ia
+ (float32_t
) 1.15470053838 * Ib
);
5002 * @brief Clarke transform for Q31 version
5003 * @param[in] Ia input three-phase coordinate <code>a</code>
5004 * @param[in] Ib input three-phase coordinate <code>b</code>
5005 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5006 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5008 * <b>Scaling and Overflow Behavior:</b>
5010 * The function is implemented using an internal 32-bit accumulator.
5011 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5012 * There is saturation on the addition, hence there is no risk of overflow.
5014 static __INLINE
void arm_clarke_q31(
5020 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5022 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
5025 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
5026 product1
= (q31_t
) (((q63_t
) Ia
* 0x24F34E8B) >> 30);
5028 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
5029 product2
= (q31_t
) (((q63_t
) Ib
* 0x49E69D16) >> 30);
5031 /* pIbeta is calculated by adding the intermediate products */
5032 *pIbeta
= __QADD(product1
, product2
);
5036 * @} end of clarke group
5040 * @brief Converts the elements of the Q7 vector to Q31 vector.
5041 * @param[in] pSrc input pointer
5042 * @param[out] pDst output pointer
5043 * @param[in] blockSize number of samples to process
5048 uint32_t blockSize
);
5053 * @ingroup groupController
5057 * @defgroup inv_clarke Vector Inverse Clarke Transform
5058 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
5060 * The function operates on a single sample of data and each call to the function returns the processed output.
5061 * The library provides separate functions for Q31 and floating-point data types.
5063 * \image html clarkeInvFormula.gif
5064 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
5065 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
5066 * \par Fixed-Point Behavior
5067 * Care must be taken when using the Q31 version of the Clarke transform.
5068 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5069 * Refer to the function specific documentation below for usage guidelines.
5073 * @addtogroup inv_clarke
5078 * @brief Floating-point Inverse Clarke transform
5079 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5080 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5081 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5082 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5084 static __INLINE
void arm_inv_clarke_f32(
5090 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5093 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
5094 *pIb
= -0.5f
* Ialpha
+ 0.8660254039f
* Ibeta
;
5099 * @brief Inverse Clarke transform for Q31 version
5100 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
5101 * @param[in] Ibeta input two-phase orthogonal vector axis beta
5102 * @param[out] pIa points to output three-phase coordinate <code>a</code>
5103 * @param[out] pIb points to output three-phase coordinate <code>b</code>
5105 * <b>Scaling and Overflow Behavior:</b>
5107 * The function is implemented using an internal 32-bit accumulator.
5108 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5109 * There is saturation on the subtraction, hence there is no risk of overflow.
5111 static __INLINE
void arm_inv_clarke_q31(
5117 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5119 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
5122 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
5123 product1
= (q31_t
) (((q63_t
) (Ialpha
) * (0x40000000)) >> 31);
5125 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
5126 product2
= (q31_t
) (((q63_t
) (Ibeta
) * (0x6ED9EBA1)) >> 31);
5128 /* pIb is calculated by subtracting the products */
5129 *pIb
= __QSUB(product2
, product1
);
5133 * @} end of inv_clarke group
5137 * @brief Converts the elements of the Q7 vector to Q15 vector.
5138 * @param[in] pSrc input pointer
5139 * @param[out] pDst output pointer
5140 * @param[in] blockSize number of samples to process
5145 uint32_t blockSize
);
5150 * @ingroup groupController
5154 * @defgroup park Vector Park Transform
5156 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
5157 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
5158 * from the stationary to the moving reference frame and control the spatial relationship between
5159 * the stator vector current and rotor flux vector.
5160 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
5161 * current vector and the relationship from the two reference frames:
5162 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
5164 * The function operates on a single sample of data and each call to the function returns the processed output.
5165 * The library provides separate functions for Q31 and floating-point data types.
5167 * \image html parkFormula.gif
5168 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
5169 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5170 * cosine and sine values of theta (rotor flux position).
5171 * \par Fixed-Point Behavior
5172 * Care must be taken when using the Q31 version of the Park transform.
5173 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5174 * Refer to the function specific documentation below for usage guidelines.
5183 * @brief Floating-point Park transform
5184 * @param[in] Ialpha input two-phase vector coordinate alpha
5185 * @param[in] Ibeta input two-phase vector coordinate beta
5186 * @param[out] pId points to output rotor reference frame d
5187 * @param[out] pIq points to output rotor reference frame q
5188 * @param[in] sinVal sine value of rotation angle theta
5189 * @param[in] cosVal cosine value of rotation angle theta
5191 * The function implements the forward Park transform.
5194 static __INLINE
void arm_park_f32(
5202 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
5203 *pId
= Ialpha
* cosVal
+ Ibeta
* sinVal
;
5205 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
5206 *pIq
= -Ialpha
* sinVal
+ Ibeta
* cosVal
;
5211 * @brief Park transform for Q31 version
5212 * @param[in] Ialpha input two-phase vector coordinate alpha
5213 * @param[in] Ibeta input two-phase vector coordinate beta
5214 * @param[out] pId points to output rotor reference frame d
5215 * @param[out] pIq points to output rotor reference frame q
5216 * @param[in] sinVal sine value of rotation angle theta
5217 * @param[in] cosVal cosine value of rotation angle theta
5219 * <b>Scaling and Overflow Behavior:</b>
5221 * The function is implemented using an internal 32-bit accumulator.
5222 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5223 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
5225 static __INLINE
void arm_park_q31(
5233 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5234 q31_t product3
, product4
; /* Temporary variables used to store intermediate results */
5236 /* Intermediate product is calculated by (Ialpha * cosVal) */
5237 product1
= (q31_t
) (((q63_t
) (Ialpha
) * (cosVal
)) >> 31);
5239 /* Intermediate product is calculated by (Ibeta * sinVal) */
5240 product2
= (q31_t
) (((q63_t
) (Ibeta
) * (sinVal
)) >> 31);
5243 /* Intermediate product is calculated by (Ialpha * sinVal) */
5244 product3
= (q31_t
) (((q63_t
) (Ialpha
) * (sinVal
)) >> 31);
5246 /* Intermediate product is calculated by (Ibeta * cosVal) */
5247 product4
= (q31_t
) (((q63_t
) (Ibeta
) * (cosVal
)) >> 31);
5249 /* Calculate pId by adding the two intermediate products 1 and 2 */
5250 *pId
= __QADD(product1
, product2
);
5252 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
5253 *pIq
= __QSUB(product4
, product3
);
5257 * @} end of park group
5261 * @brief Converts the elements of the Q7 vector to floating-point vector.
5262 * @param[in] pSrc is input pointer
5263 * @param[out] pDst is output pointer
5264 * @param[in] blockSize is the number of samples to process
5266 void arm_q7_to_float(
5269 uint32_t blockSize
);
5273 * @ingroup groupController
5277 * @defgroup inv_park Vector Inverse Park transform
5278 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
5280 * The function operates on a single sample of data and each call to the function returns the processed output.
5281 * The library provides separate functions for Q31 and floating-point data types.
5283 * \image html parkInvFormula.gif
5284 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
5285 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
5286 * cosine and sine values of theta (rotor flux position).
5287 * \par Fixed-Point Behavior
5288 * Care must be taken when using the Q31 version of the Park transform.
5289 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
5290 * Refer to the function specific documentation below for usage guidelines.
5294 * @addtogroup inv_park
5299 * @brief Floating-point Inverse Park transform
5300 * @param[in] Id input coordinate of rotor reference frame d
5301 * @param[in] Iq input coordinate of rotor reference frame q
5302 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5303 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5304 * @param[in] sinVal sine value of rotation angle theta
5305 * @param[in] cosVal cosine value of rotation angle theta
5307 static __INLINE
void arm_inv_park_f32(
5310 float32_t
* pIalpha
,
5315 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
5316 *pIalpha
= Id
* cosVal
- Iq
* sinVal
;
5318 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
5319 *pIbeta
= Id
* sinVal
+ Iq
* cosVal
;
5324 * @brief Inverse Park transform for Q31 version
5325 * @param[in] Id input coordinate of rotor reference frame d
5326 * @param[in] Iq input coordinate of rotor reference frame q
5327 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
5328 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
5329 * @param[in] sinVal sine value of rotation angle theta
5330 * @param[in] cosVal cosine value of rotation angle theta
5332 * <b>Scaling and Overflow Behavior:</b>
5334 * The function is implemented using an internal 32-bit accumulator.
5335 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
5336 * There is saturation on the addition, hence there is no risk of overflow.
5338 static __INLINE
void arm_inv_park_q31(
5346 q31_t product1
, product2
; /* Temporary variables used to store intermediate results */
5347 q31_t product3
, product4
; /* Temporary variables used to store intermediate results */
5349 /* Intermediate product is calculated by (Id * cosVal) */
5350 product1
= (q31_t
) (((q63_t
) (Id
) * (cosVal
)) >> 31);
5352 /* Intermediate product is calculated by (Iq * sinVal) */
5353 product2
= (q31_t
) (((q63_t
) (Iq
) * (sinVal
)) >> 31);
5356 /* Intermediate product is calculated by (Id * sinVal) */
5357 product3
= (q31_t
) (((q63_t
) (Id
) * (sinVal
)) >> 31);
5359 /* Intermediate product is calculated by (Iq * cosVal) */
5360 product4
= (q31_t
) (((q63_t
) (Iq
) * (cosVal
)) >> 31);
5362 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
5363 *pIalpha
= __QSUB(product1
, product2
);
5365 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
5366 *pIbeta
= __QADD(product4
, product3
);
5370 * @} end of Inverse park group
5375 * @brief Converts the elements of the Q31 vector to floating-point vector.
5376 * @param[in] pSrc is input pointer
5377 * @param[out] pDst is output pointer
5378 * @param[in] blockSize is the number of samples to process
5380 void arm_q31_to_float(
5383 uint32_t blockSize
);
5386 * @ingroup groupInterpolation
5390 * @defgroup LinearInterpolate Linear Interpolation
5392 * Linear interpolation is a method of curve fitting using linear polynomials.
5393 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
5396 * \image html LinearInterp.gif "Linear interpolation"
5399 * A Linear Interpolate function calculates an output value(y), for the input(x)
5400 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
5404 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
5405 * where x0, x1 are nearest values of input x
5406 * y0, y1 are nearest values to output y
5410 * This set of functions implements Linear interpolation process
5411 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
5412 * sample of data and each call to the function returns a single processed value.
5413 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
5414 * <code>x</code> is the input sample value. The functions returns the output value.
5417 * if x is outside of the table boundary, Linear interpolation returns first value of the table
5418 * if x is below input range and returns last value of table if x is above range.
5422 * @addtogroup LinearInterpolate
5427 * @brief Process function for the floating-point Linear Interpolation Function.
5428 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
5429 * @param[in] x input sample to process
5430 * @return y processed output sample.
5433 static __INLINE float32_t
arm_linear_interp_f32(
5434 arm_linear_interp_instance_f32
* S
,
5438 float32_t x0
, x1
; /* Nearest input values */
5439 float32_t y0
, y1
; /* Nearest output values */
5440 float32_t xSpacing
= S
->xSpacing
; /* spacing between input values */
5441 int32_t i
; /* Index variable */
5442 float32_t
*pYData
= S
->pYData
; /* pointer to output table */
5444 /* Calculation of index */
5445 i
= (int32_t) ((x
- S
->x1
) / xSpacing
);
5449 /* Iniatilize output for below specified range as least output value of table */
5452 else if((uint32_t)i
>= S
->nValues
)
5454 /* Iniatilize output for above specified range as last output value of table */
5455 y
= pYData
[S
->nValues
- 1];
5459 /* Calculation of nearest input values */
5460 x0
= S
->x1
+ i
* xSpacing
;
5461 x1
= S
->x1
+ (i
+ 1) * xSpacing
;
5463 /* Read of nearest output values */
5467 /* Calculation of output */
5468 y
= y0
+ (x
- x0
) * ((y1
- y0
) / (x1
- x0
));
5472 /* returns output value */
5479 * @brief Process function for the Q31 Linear Interpolation Function.
5480 * @param[in] pYData pointer to Q31 Linear Interpolation table
5481 * @param[in] x input sample to process
5482 * @param[in] nValues number of table values
5483 * @return y processed output sample.
5486 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5487 * This function can support maximum of table size 2^12.
5490 static __INLINE q31_t
arm_linear_interp_q31(
5495 q31_t y
; /* output */
5496 q31_t y0
, y1
; /* Nearest output values */
5497 q31_t fract
; /* fractional part */
5498 int32_t index
; /* Index to read nearest output values */
5500 /* Input is in 12.20 format */
5501 /* 12 bits for the table index */
5502 /* Index value calculation */
5503 index
= ((x
& (q31_t
)0xFFF00000) >> 20);
5505 if(index
>= (int32_t)(nValues
- 1))
5507 return (pYData
[nValues
- 1]);
5515 /* 20 bits for the fractional part */
5516 /* shift left by 11 to keep fract in 1.31 format */
5517 fract
= (x
& 0x000FFFFF) << 11;
5519 /* Read two nearest output values from the index in 1.31(q31) format */
5521 y1
= pYData
[index
+ 1];
5523 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
5524 y
= ((q31_t
) ((q63_t
) y0
* (0x7FFFFFFF - fract
) >> 32));
5526 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
5527 y
+= ((q31_t
) (((q63_t
) y1
* fract
) >> 32));
5529 /* Convert y to 1.31 format */
5537 * @brief Process function for the Q15 Linear Interpolation Function.
5538 * @param[in] pYData pointer to Q15 Linear Interpolation table
5539 * @param[in] x input sample to process
5540 * @param[in] nValues number of table values
5541 * @return y processed output sample.
5544 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5545 * This function can support maximum of table size 2^12.
5548 static __INLINE q15_t
arm_linear_interp_q15(
5553 q63_t y
; /* output */
5554 q15_t y0
, y1
; /* Nearest output values */
5555 q31_t fract
; /* fractional part */
5556 int32_t index
; /* Index to read nearest output values */
5558 /* Input is in 12.20 format */
5559 /* 12 bits for the table index */
5560 /* Index value calculation */
5561 index
= ((x
& (int32_t)0xFFF00000) >> 20);
5563 if(index
>= (int32_t)(nValues
- 1))
5565 return (pYData
[nValues
- 1]);
5573 /* 20 bits for the fractional part */
5574 /* fract is in 12.20 format */
5575 fract
= (x
& 0x000FFFFF);
5577 /* Read two nearest output values from the index */
5579 y1
= pYData
[index
+ 1];
5581 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
5582 y
= ((q63_t
) y0
* (0xFFFFF - fract
));
5584 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
5585 y
+= ((q63_t
) y1
* (fract
));
5587 /* convert y to 1.15 format */
5588 return (q15_t
) (y
>> 20);
5595 * @brief Process function for the Q7 Linear Interpolation Function.
5596 * @param[in] pYData pointer to Q7 Linear Interpolation table
5597 * @param[in] x input sample to process
5598 * @param[in] nValues number of table values
5599 * @return y processed output sample.
5602 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
5603 * This function can support maximum of table size 2^12.
5605 static __INLINE q7_t
arm_linear_interp_q7(
5610 q31_t y
; /* output */
5611 q7_t y0
, y1
; /* Nearest output values */
5612 q31_t fract
; /* fractional part */
5613 uint32_t index
; /* Index to read nearest output values */
5615 /* Input is in 12.20 format */
5616 /* 12 bits for the table index */
5617 /* Index value calculation */
5622 index
= (x
>> 20) & 0xfff;
5624 if(index
>= (nValues
- 1))
5626 return (pYData
[nValues
- 1]);
5630 /* 20 bits for the fractional part */
5631 /* fract is in 12.20 format */
5632 fract
= (x
& 0x000FFFFF);
5634 /* Read two nearest output values from the index and are in 1.7(q7) format */
5636 y1
= pYData
[index
+ 1];
5638 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
5639 y
= ((y0
* (0xFFFFF - fract
)));
5641 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
5644 /* convert y to 1.7(q7) format */
5645 return (q7_t
) (y
>> 20);
5650 * @} end of LinearInterpolate group
5654 * @brief Fast approximation to the trigonometric sine function for floating-point data.
5655 * @param[in] x input value in radians.
5658 float32_t
arm_sin_f32(
5663 * @brief Fast approximation to the trigonometric sine function for Q31 data.
5664 * @param[in] x Scaled input value in radians.
5672 * @brief Fast approximation to the trigonometric sine function for Q15 data.
5673 * @param[in] x Scaled input value in radians.
5681 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
5682 * @param[in] x input value in radians.
5685 float32_t
arm_cos_f32(
5690 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
5691 * @param[in] x Scaled input value in radians.
5699 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
5700 * @param[in] x Scaled input value in radians.
5708 * @ingroup groupFastMath
5713 * @defgroup SQRT Square Root
5715 * Computes the square root of a number.
5716 * There are separate functions for Q15, Q31, and floating-point data types.
5717 * The square root function is computed using the Newton-Raphson algorithm.
5718 * This is an iterative algorithm of the form:
5720 * x1 = x0 - f(x0)/f'(x0)
5722 * where <code>x1</code> is the current estimate,
5723 * <code>x0</code> is the previous estimate, and
5724 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
5725 * For the square root function, the algorithm reduces to:
5727 * x0 = in/2 [initial guess]
5728 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
5739 * @brief Floating-point square root function.
5740 * @param[in] in input value.
5741 * @param[out] pOut square root of input value.
5742 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5743 * <code>in</code> is negative value and returns zero output for negative values.
5745 static __INLINE arm_status
arm_sqrt_f32(
5752 #if (__FPU_USED == 1) && defined ( __CC_ARM )
5753 *pOut
= __sqrtf(in
);
5754 #elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
5755 *pOut
= __builtin_sqrtf(in
);
5756 #elif (__FPU_USED == 1) && defined(__GNUC__)
5757 *pOut
= __builtin_sqrtf(in
);
5758 #elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
5759 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut
) : "t"(in
));
5764 return (ARM_MATH_SUCCESS
);
5769 return (ARM_MATH_ARGUMENT_ERROR
);
5775 * @brief Q31 square root function.
5776 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
5777 * @param[out] pOut square root of input value.
5778 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5779 * <code>in</code> is negative value and returns zero output for negative values.
5781 arm_status
arm_sqrt_q31(
5787 * @brief Q15 square root function.
5788 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
5789 * @param[out] pOut square root of input value.
5790 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
5791 * <code>in</code> is negative value and returns zero output for negative values.
5793 arm_status
arm_sqrt_q15(
5798 * @} end of SQRT group
5803 * @brief floating-point Circular write function.
5805 static __INLINE
void arm_circularWrite_f32(
5806 int32_t * circBuffer
,
5808 uint16_t * writeOffset
,
5810 const int32_t * src
,
5817 /* Copy the value of Index pointer that points
5818 * to the current location where the input samples to be copied */
5819 wOffset
= *writeOffset
;
5821 /* Loop over the blockSize */
5826 /* copy the input sample to the circular buffer */
5827 circBuffer
[wOffset
] = *src
;
5829 /* Update the input pointer */
5832 /* Circularly update wOffset. Watch out for positive and negative value */
5833 wOffset
+= bufferInc
;
5837 /* Decrement the loop counter */
5841 /* Update the index pointer */
5842 *writeOffset
= (uint16_t)wOffset
;
5848 * @brief floating-point Circular Read function.
5850 static __INLINE
void arm_circularRead_f32(
5851 int32_t * circBuffer
,
5853 int32_t * readOffset
,
5862 int32_t rOffset
, dst_end
;
5864 /* Copy the value of Index pointer that points
5865 * to the current location from where the input samples to be read */
5866 rOffset
= *readOffset
;
5867 dst_end
= (int32_t) (dst_base
+ dst_length
);
5869 /* Loop over the blockSize */
5874 /* copy the sample from the circular buffer to the destination buffer */
5875 *dst
= circBuffer
[rOffset
];
5877 /* Update the input pointer */
5880 if(dst
== (int32_t *) dst_end
)
5885 /* Circularly update rOffset. Watch out for positive and negative value */
5886 rOffset
+= bufferInc
;
5893 /* Decrement the loop counter */
5897 /* Update the index pointer */
5898 *readOffset
= rOffset
;
5903 * @brief Q15 Circular write function.
5905 static __INLINE
void arm_circularWrite_q15(
5908 uint16_t * writeOffset
,
5917 /* Copy the value of Index pointer that points
5918 * to the current location where the input samples to be copied */
5919 wOffset
= *writeOffset
;
5921 /* Loop over the blockSize */
5926 /* copy the input sample to the circular buffer */
5927 circBuffer
[wOffset
] = *src
;
5929 /* Update the input pointer */
5932 /* Circularly update wOffset. Watch out for positive and negative value */
5933 wOffset
+= bufferInc
;
5937 /* Decrement the loop counter */
5941 /* Update the index pointer */
5942 *writeOffset
= (uint16_t)wOffset
;
5947 * @brief Q15 Circular Read function.
5949 static __INLINE
void arm_circularRead_q15(
5952 int32_t * readOffset
,
5961 int32_t rOffset
, dst_end
;
5963 /* Copy the value of Index pointer that points
5964 * to the current location from where the input samples to be read */
5965 rOffset
= *readOffset
;
5967 dst_end
= (int32_t) (dst_base
+ dst_length
);
5969 /* Loop over the blockSize */
5974 /* copy the sample from the circular buffer to the destination buffer */
5975 *dst
= circBuffer
[rOffset
];
5977 /* Update the input pointer */
5980 if(dst
== (q15_t
*) dst_end
)
5985 /* Circularly update wOffset. Watch out for positive and negative value */
5986 rOffset
+= bufferInc
;
5993 /* Decrement the loop counter */
5997 /* Update the index pointer */
5998 *readOffset
= rOffset
;
6003 * @brief Q7 Circular write function.
6005 static __INLINE
void arm_circularWrite_q7(
6008 uint16_t * writeOffset
,
6017 /* Copy the value of Index pointer that points
6018 * to the current location where the input samples to be copied */
6019 wOffset
= *writeOffset
;
6021 /* Loop over the blockSize */
6026 /* copy the input sample to the circular buffer */
6027 circBuffer
[wOffset
] = *src
;
6029 /* Update the input pointer */
6032 /* Circularly update wOffset. Watch out for positive and negative value */
6033 wOffset
+= bufferInc
;
6037 /* Decrement the loop counter */
6041 /* Update the index pointer */
6042 *writeOffset
= (uint16_t)wOffset
;
6047 * @brief Q7 Circular Read function.
6049 static __INLINE
void arm_circularRead_q7(
6052 int32_t * readOffset
,
6061 int32_t rOffset
, dst_end
;
6063 /* Copy the value of Index pointer that points
6064 * to the current location from where the input samples to be read */
6065 rOffset
= *readOffset
;
6067 dst_end
= (int32_t) (dst_base
+ dst_length
);
6069 /* Loop over the blockSize */
6074 /* copy the sample from the circular buffer to the destination buffer */
6075 *dst
= circBuffer
[rOffset
];
6077 /* Update the input pointer */
6080 if(dst
== (q7_t
*) dst_end
)
6085 /* Circularly update rOffset. Watch out for positive and negative value */
6086 rOffset
+= bufferInc
;
6093 /* Decrement the loop counter */
6097 /* Update the index pointer */
6098 *readOffset
= rOffset
;
6103 * @brief Sum of the squares of the elements of a Q31 vector.
6104 * @param[in] pSrc is input pointer
6105 * @param[in] blockSize is the number of samples to process
6106 * @param[out] pResult is output value.
6115 * @brief Sum of the squares of the elements of a floating-point vector.
6116 * @param[in] pSrc is input pointer
6117 * @param[in] blockSize is the number of samples to process
6118 * @param[out] pResult is output value.
6123 float32_t
* pResult
);
6127 * @brief Sum of the squares of the elements of a Q15 vector.
6128 * @param[in] pSrc is input pointer
6129 * @param[in] blockSize is the number of samples to process
6130 * @param[out] pResult is output value.
6139 * @brief Sum of the squares of the elements of a Q7 vector.
6140 * @param[in] pSrc is input pointer
6141 * @param[in] blockSize is the number of samples to process
6142 * @param[out] pResult is output value.
6151 * @brief Mean value of a Q7 vector.
6152 * @param[in] pSrc is input pointer
6153 * @param[in] blockSize is the number of samples to process
6154 * @param[out] pResult is output value.
6163 * @brief Mean value of a Q15 vector.
6164 * @param[in] pSrc is input pointer
6165 * @param[in] blockSize is the number of samples to process
6166 * @param[out] pResult is output value.
6175 * @brief Mean value of a Q31 vector.
6176 * @param[in] pSrc is input pointer
6177 * @param[in] blockSize is the number of samples to process
6178 * @param[out] pResult is output value.
6187 * @brief Mean value of a floating-point vector.
6188 * @param[in] pSrc is input pointer
6189 * @param[in] blockSize is the number of samples to process
6190 * @param[out] pResult is output value.
6195 float32_t
* pResult
);
6199 * @brief Variance of the elements of a floating-point vector.
6200 * @param[in] pSrc is input pointer
6201 * @param[in] blockSize is the number of samples to process
6202 * @param[out] pResult is output value.
6207 float32_t
* pResult
);
6211 * @brief Variance of the elements of a Q31 vector.
6212 * @param[in] pSrc is input pointer
6213 * @param[in] blockSize is the number of samples to process
6214 * @param[out] pResult is output value.
6223 * @brief Variance of the elements of a Q15 vector.
6224 * @param[in] pSrc is input pointer
6225 * @param[in] blockSize is the number of samples to process
6226 * @param[out] pResult is output value.
6235 * @brief Root Mean Square of the elements of a floating-point vector.
6236 * @param[in] pSrc is input pointer
6237 * @param[in] blockSize is the number of samples to process
6238 * @param[out] pResult is output value.
6243 float32_t
* pResult
);
6247 * @brief Root Mean Square of the elements of a Q31 vector.
6248 * @param[in] pSrc is input pointer
6249 * @param[in] blockSize is the number of samples to process
6250 * @param[out] pResult is output value.
6259 * @brief Root Mean Square of the elements of a Q15 vector.
6260 * @param[in] pSrc is input pointer
6261 * @param[in] blockSize is the number of samples to process
6262 * @param[out] pResult is output value.
6271 * @brief Standard deviation of the elements of a floating-point vector.
6272 * @param[in] pSrc is input pointer
6273 * @param[in] blockSize is the number of samples to process
6274 * @param[out] pResult is output value.
6279 float32_t
* pResult
);
6283 * @brief Standard deviation of the elements of a Q31 vector.
6284 * @param[in] pSrc is input pointer
6285 * @param[in] blockSize is the number of samples to process
6286 * @param[out] pResult is output value.
6295 * @brief Standard deviation of the elements of a Q15 vector.
6296 * @param[in] pSrc is input pointer
6297 * @param[in] blockSize is the number of samples to process
6298 * @param[out] pResult is output value.
6307 * @brief Floating-point complex magnitude
6308 * @param[in] pSrc points to the complex input vector
6309 * @param[out] pDst points to the real output vector
6310 * @param[in] numSamples number of complex samples in the input vector
6312 void arm_cmplx_mag_f32(
6315 uint32_t numSamples
);
6319 * @brief Q31 complex magnitude
6320 * @param[in] pSrc points to the complex input vector
6321 * @param[out] pDst points to the real output vector
6322 * @param[in] numSamples number of complex samples in the input vector
6324 void arm_cmplx_mag_q31(
6327 uint32_t numSamples
);
6331 * @brief Q15 complex magnitude
6332 * @param[in] pSrc points to the complex input vector
6333 * @param[out] pDst points to the real output vector
6334 * @param[in] numSamples number of complex samples in the input vector
6336 void arm_cmplx_mag_q15(
6339 uint32_t numSamples
);
6343 * @brief Q15 complex dot product
6344 * @param[in] pSrcA points to the first input vector
6345 * @param[in] pSrcB points to the second input vector
6346 * @param[in] numSamples number of complex samples in each vector
6347 * @param[out] realResult real part of the result returned here
6348 * @param[out] imagResult imaginary part of the result returned here
6350 void arm_cmplx_dot_prod_q15(
6353 uint32_t numSamples
,
6355 q31_t
* imagResult
);
6359 * @brief Q31 complex dot product
6360 * @param[in] pSrcA points to the first input vector
6361 * @param[in] pSrcB points to the second input vector
6362 * @param[in] numSamples number of complex samples in each vector
6363 * @param[out] realResult real part of the result returned here
6364 * @param[out] imagResult imaginary part of the result returned here
6366 void arm_cmplx_dot_prod_q31(
6369 uint32_t numSamples
,
6371 q63_t
* imagResult
);
6375 * @brief Floating-point complex dot product
6376 * @param[in] pSrcA points to the first input vector
6377 * @param[in] pSrcB points to the second input vector
6378 * @param[in] numSamples number of complex samples in each vector
6379 * @param[out] realResult real part of the result returned here
6380 * @param[out] imagResult imaginary part of the result returned here
6382 void arm_cmplx_dot_prod_f32(
6385 uint32_t numSamples
,
6386 float32_t
* realResult
,
6387 float32_t
* imagResult
);
6391 * @brief Q15 complex-by-real multiplication
6392 * @param[in] pSrcCmplx points to the complex input vector
6393 * @param[in] pSrcReal points to the real input vector
6394 * @param[out] pCmplxDst points to the complex output vector
6395 * @param[in] numSamples number of samples in each vector
6397 void arm_cmplx_mult_real_q15(
6401 uint32_t numSamples
);
6405 * @brief Q31 complex-by-real multiplication
6406 * @param[in] pSrcCmplx points to the complex input vector
6407 * @param[in] pSrcReal points to the real input vector
6408 * @param[out] pCmplxDst points to the complex output vector
6409 * @param[in] numSamples number of samples in each vector
6411 void arm_cmplx_mult_real_q31(
6415 uint32_t numSamples
);
6419 * @brief Floating-point complex-by-real multiplication
6420 * @param[in] pSrcCmplx points to the complex input vector
6421 * @param[in] pSrcReal points to the real input vector
6422 * @param[out] pCmplxDst points to the complex output vector
6423 * @param[in] numSamples number of samples in each vector
6425 void arm_cmplx_mult_real_f32(
6426 float32_t
* pSrcCmplx
,
6427 float32_t
* pSrcReal
,
6428 float32_t
* pCmplxDst
,
6429 uint32_t numSamples
);
6433 * @brief Minimum value of a Q7 vector.
6434 * @param[in] pSrc is input pointer
6435 * @param[in] blockSize is the number of samples to process
6436 * @param[out] result is output pointer
6437 * @param[in] index is the array index of the minimum value in the input buffer.
6447 * @brief Minimum value of a Q15 vector.
6448 * @param[in] pSrc is input pointer
6449 * @param[in] blockSize is the number of samples to process
6450 * @param[out] pResult is output pointer
6451 * @param[in] pIndex is the array index of the minimum value in the input buffer.
6461 * @brief Minimum value of a Q31 vector.
6462 * @param[in] pSrc is input pointer
6463 * @param[in] blockSize is the number of samples to process
6464 * @param[out] pResult is output pointer
6465 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6475 * @brief Minimum value of a floating-point vector.
6476 * @param[in] pSrc is input pointer
6477 * @param[in] blockSize is the number of samples to process
6478 * @param[out] pResult is output pointer
6479 * @param[out] pIndex is the array index of the minimum value in the input buffer.
6484 float32_t
* pResult
,
6489 * @brief Maximum value of a Q7 vector.
6490 * @param[in] pSrc points to the input buffer
6491 * @param[in] blockSize length of the input vector
6492 * @param[out] pResult maximum value returned here
6493 * @param[out] pIndex index of maximum value returned here
6503 * @brief Maximum value of a Q15 vector.
6504 * @param[in] pSrc points to the input buffer
6505 * @param[in] blockSize length of the input vector
6506 * @param[out] pResult maximum value returned here
6507 * @param[out] pIndex index of maximum value returned here
6517 * @brief Maximum value of a Q31 vector.
6518 * @param[in] pSrc points to the input buffer
6519 * @param[in] blockSize length of the input vector
6520 * @param[out] pResult maximum value returned here
6521 * @param[out] pIndex index of maximum value returned here
6531 * @brief Maximum value of a floating-point vector.
6532 * @param[in] pSrc points to the input buffer
6533 * @param[in] blockSize length of the input vector
6534 * @param[out] pResult maximum value returned here
6535 * @param[out] pIndex index of maximum value returned here
6540 float32_t
* pResult
,
6545 * @brief Q15 complex-by-complex multiplication
6546 * @param[in] pSrcA points to the first input vector
6547 * @param[in] pSrcB points to the second input vector
6548 * @param[out] pDst points to the output vector
6549 * @param[in] numSamples number of complex samples in each vector
6551 void arm_cmplx_mult_cmplx_q15(
6555 uint32_t numSamples
);
6559 * @brief Q31 complex-by-complex multiplication
6560 * @param[in] pSrcA points to the first input vector
6561 * @param[in] pSrcB points to the second input vector
6562 * @param[out] pDst points to the output vector
6563 * @param[in] numSamples number of complex samples in each vector
6565 void arm_cmplx_mult_cmplx_q31(
6569 uint32_t numSamples
);
6573 * @brief Floating-point complex-by-complex multiplication
6574 * @param[in] pSrcA points to the first input vector
6575 * @param[in] pSrcB points to the second input vector
6576 * @param[out] pDst points to the output vector
6577 * @param[in] numSamples number of complex samples in each vector
6579 void arm_cmplx_mult_cmplx_f32(
6583 uint32_t numSamples
);
6587 * @brief Converts the elements of the floating-point vector to Q31 vector.
6588 * @param[in] pSrc points to the floating-point input vector
6589 * @param[out] pDst points to the Q31 output vector
6590 * @param[in] blockSize length of the input vector
6592 void arm_float_to_q31(
6595 uint32_t blockSize
);
6599 * @brief Converts the elements of the floating-point vector to Q15 vector.
6600 * @param[in] pSrc points to the floating-point input vector
6601 * @param[out] pDst points to the Q15 output vector
6602 * @param[in] blockSize length of the input vector
6604 void arm_float_to_q15(
6607 uint32_t blockSize
);
6611 * @brief Converts the elements of the floating-point vector to Q7 vector.
6612 * @param[in] pSrc points to the floating-point input vector
6613 * @param[out] pDst points to the Q7 output vector
6614 * @param[in] blockSize length of the input vector
6616 void arm_float_to_q7(
6619 uint32_t blockSize
);
6623 * @brief Converts the elements of the Q31 vector to Q15 vector.
6624 * @param[in] pSrc is input pointer
6625 * @param[out] pDst is output pointer
6626 * @param[in] blockSize is the number of samples to process
6628 void arm_q31_to_q15(
6631 uint32_t blockSize
);
6635 * @brief Converts the elements of the Q31 vector to Q7 vector.
6636 * @param[in] pSrc is input pointer
6637 * @param[out] pDst is output pointer
6638 * @param[in] blockSize is the number of samples to process
6643 uint32_t blockSize
);
6647 * @brief Converts the elements of the Q15 vector to floating-point vector.
6648 * @param[in] pSrc is input pointer
6649 * @param[out] pDst is output pointer
6650 * @param[in] blockSize is the number of samples to process
6652 void arm_q15_to_float(
6655 uint32_t blockSize
);
6659 * @brief Converts the elements of the Q15 vector to Q31 vector.
6660 * @param[in] pSrc is input pointer
6661 * @param[out] pDst is output pointer
6662 * @param[in] blockSize is the number of samples to process
6664 void arm_q15_to_q31(
6667 uint32_t blockSize
);
6671 * @brief Converts the elements of the Q15 vector to Q7 vector.
6672 * @param[in] pSrc is input pointer
6673 * @param[out] pDst is output pointer
6674 * @param[in] blockSize is the number of samples to process
6679 uint32_t blockSize
);
6683 * @ingroup groupInterpolation
6687 * @defgroup BilinearInterpolate Bilinear Interpolation
6689 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
6690 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
6691 * determines values between the grid points.
6692 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
6693 * Bilinear interpolation is often used in image processing to rescale images.
6694 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
6698 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
6699 * For floating-point, the instance structure is defined as:
6706 * } arm_bilinear_interp_instance_f32;
6710 * where <code>numRows</code> specifies the number of rows in the table;
6711 * <code>numCols</code> specifies the number of columns in the table;
6712 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
6713 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
6714 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
6717 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
6723 * The interpolated output point is computed as:
6725 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
6726 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
6727 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
6728 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
6730 * Note that the coordinates (x, y) contain integer and fractional components.
6731 * The integer components specify which portion of the table to use while the
6732 * fractional components control the interpolation processor.
6735 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
6739 * @addtogroup BilinearInterpolate
6746 * @brief Floating-point bilinear interpolation.
6747 * @param[in,out] S points to an instance of the interpolation structure.
6748 * @param[in] X interpolation coordinate.
6749 * @param[in] Y interpolation coordinate.
6750 * @return out interpolated value.
6752 static __INLINE float32_t
arm_bilinear_interp_f32(
6753 const arm_bilinear_interp_instance_f32
* S
,
6758 float32_t f00
, f01
, f10
, f11
;
6759 float32_t
*pData
= S
->pData
;
6760 int32_t xIndex
, yIndex
, index
;
6761 float32_t xdiff
, ydiff
;
6762 float32_t b1
, b2
, b3
, b4
;
6764 xIndex
= (int32_t) X
;
6765 yIndex
= (int32_t) Y
;
6767 /* Care taken for table outside boundary */
6768 /* Returns zero output when values are outside table boundary */
6769 if(xIndex
< 0 || xIndex
> (S
->numRows
- 1) || yIndex
< 0 || yIndex
> (S
->numCols
- 1))
6774 /* Calculation of index for two nearest points in X-direction */
6775 index
= (xIndex
- 1) + (yIndex
- 1) * S
->numCols
;
6778 /* Read two nearest points in X-direction */
6780 f01
= pData
[index
+ 1];
6782 /* Calculation of index for two nearest points in Y-direction */
6783 index
= (xIndex
- 1) + (yIndex
) * S
->numCols
;
6786 /* Read two nearest points in Y-direction */
6788 f11
= pData
[index
+ 1];
6790 /* Calculation of intermediate values */
6794 b4
= f00
- f01
- f10
+ f11
;
6796 /* Calculation of fractional part in X */
6799 /* Calculation of fractional part in Y */
6802 /* Calculation of bi-linear interpolated output */
6803 out
= b1
+ b2
* xdiff
+ b3
* ydiff
+ b4
* xdiff
* ydiff
;
6805 /* return to application */
6812 * @brief Q31 bilinear interpolation.
6813 * @param[in,out] S points to an instance of the interpolation structure.
6814 * @param[in] X interpolation coordinate in 12.20 format.
6815 * @param[in] Y interpolation coordinate in 12.20 format.
6816 * @return out interpolated value.
6818 static __INLINE q31_t
arm_bilinear_interp_q31(
6819 arm_bilinear_interp_instance_q31
* S
,
6823 q31_t out
; /* Temporary output */
6824 q31_t acc
= 0; /* output */
6825 q31_t xfract
, yfract
; /* X, Y fractional parts */
6826 q31_t x1
, x2
, y1
, y2
; /* Nearest output values */
6827 int32_t rI
, cI
; /* Row and column indices */
6828 q31_t
*pYData
= S
->pData
; /* pointer to output table values */
6829 uint32_t nCols
= S
->numCols
; /* num of rows */
6831 /* Input is in 12.20 format */
6832 /* 12 bits for the table index */
6833 /* Index value calculation */
6834 rI
= ((X
& (q31_t
)0xFFF00000) >> 20);
6836 /* Input is in 12.20 format */
6837 /* 12 bits for the table index */
6838 /* Index value calculation */
6839 cI
= ((Y
& (q31_t
)0xFFF00000) >> 20);
6841 /* Care taken for table outside boundary */
6842 /* Returns zero output when values are outside table boundary */
6843 if(rI
< 0 || rI
> (S
->numRows
- 1) || cI
< 0 || cI
> (S
->numCols
- 1))
6848 /* 20 bits for the fractional part */
6849 /* shift left xfract by 11 to keep 1.31 format */
6850 xfract
= (X
& 0x000FFFFF) << 11u;
6852 /* Read two nearest output values from the index */
6853 x1
= pYData
[(rI
) + (int32_t)nCols
* (cI
) ];
6854 x2
= pYData
[(rI
) + (int32_t)nCols
* (cI
) + 1];
6856 /* 20 bits for the fractional part */
6857 /* shift left yfract by 11 to keep 1.31 format */
6858 yfract
= (Y
& 0x000FFFFF) << 11u;
6860 /* Read two nearest output values from the index */
6861 y1
= pYData
[(rI
) + (int32_t)nCols
* (cI
+ 1) ];
6862 y2
= pYData
[(rI
) + (int32_t)nCols
* (cI
+ 1) + 1];
6864 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
6865 out
= ((q31_t
) (((q63_t
) x1
* (0x7FFFFFFF - xfract
)) >> 32));
6866 acc
= ((q31_t
) (((q63_t
) out
* (0x7FFFFFFF - yfract
)) >> 32));
6868 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
6869 out
= ((q31_t
) ((q63_t
) x2
* (0x7FFFFFFF - yfract
) >> 32));
6870 acc
+= ((q31_t
) ((q63_t
) out
* (xfract
) >> 32));
6872 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
6873 out
= ((q31_t
) ((q63_t
) y1
* (0x7FFFFFFF - xfract
) >> 32));
6874 acc
+= ((q31_t
) ((q63_t
) out
* (yfract
) >> 32));
6876 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
6877 out
= ((q31_t
) ((q63_t
) y2
* (xfract
) >> 32));
6878 acc
+= ((q31_t
) ((q63_t
) out
* (yfract
) >> 32));
6880 /* Convert acc to 1.31(q31) format */
6881 return ((q31_t
)(acc
<< 2));
6886 * @brief Q15 bilinear interpolation.
6887 * @param[in,out] S points to an instance of the interpolation structure.
6888 * @param[in] X interpolation coordinate in 12.20 format.
6889 * @param[in] Y interpolation coordinate in 12.20 format.
6890 * @return out interpolated value.
6892 static __INLINE q15_t
arm_bilinear_interp_q15(
6893 arm_bilinear_interp_instance_q15
* S
,
6897 q63_t acc
= 0; /* output */
6898 q31_t out
; /* Temporary output */
6899 q15_t x1
, x2
, y1
, y2
; /* Nearest output values */
6900 q31_t xfract
, yfract
; /* X, Y fractional parts */
6901 int32_t rI
, cI
; /* Row and column indices */
6902 q15_t
*pYData
= S
->pData
; /* pointer to output table values */
6903 uint32_t nCols
= S
->numCols
; /* num of rows */
6905 /* Input is in 12.20 format */
6906 /* 12 bits for the table index */
6907 /* Index value calculation */
6908 rI
= ((X
& (q31_t
)0xFFF00000) >> 20);
6910 /* Input is in 12.20 format */
6911 /* 12 bits for the table index */
6912 /* Index value calculation */
6913 cI
= ((Y
& (q31_t
)0xFFF00000) >> 20);
6915 /* Care taken for table outside boundary */
6916 /* Returns zero output when values are outside table boundary */
6917 if(rI
< 0 || rI
> (S
->numRows
- 1) || cI
< 0 || cI
> (S
->numCols
- 1))
6922 /* 20 bits for the fractional part */
6923 /* xfract should be in 12.20 format */
6924 xfract
= (X
& 0x000FFFFF);
6926 /* Read two nearest output values from the index */
6927 x1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) ];
6928 x2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) + 1];
6930 /* 20 bits for the fractional part */
6931 /* yfract should be in 12.20 format */
6932 yfract
= (Y
& 0x000FFFFF);
6934 /* Read two nearest output values from the index */
6935 y1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) ];
6936 y2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) + 1];
6938 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
6940 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
6941 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
6942 out
= (q31_t
) (((q63_t
) x1
* (0xFFFFF - xfract
)) >> 4u);
6943 acc
= ((q63_t
) out
* (0xFFFFF - yfract
));
6945 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
6946 out
= (q31_t
) (((q63_t
) x2
* (0xFFFFF - yfract
)) >> 4u);
6947 acc
+= ((q63_t
) out
* (xfract
));
6949 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
6950 out
= (q31_t
) (((q63_t
) y1
* (0xFFFFF - xfract
)) >> 4u);
6951 acc
+= ((q63_t
) out
* (yfract
));
6953 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
6954 out
= (q31_t
) (((q63_t
) y2
* (xfract
)) >> 4u);
6955 acc
+= ((q63_t
) out
* (yfract
));
6957 /* acc is in 13.51 format and down shift acc by 36 times */
6958 /* Convert out to 1.15 format */
6959 return ((q15_t
)(acc
>> 36));
6964 * @brief Q7 bilinear interpolation.
6965 * @param[in,out] S points to an instance of the interpolation structure.
6966 * @param[in] X interpolation coordinate in 12.20 format.
6967 * @param[in] Y interpolation coordinate in 12.20 format.
6968 * @return out interpolated value.
6970 static __INLINE q7_t
arm_bilinear_interp_q7(
6971 arm_bilinear_interp_instance_q7
* S
,
6975 q63_t acc
= 0; /* output */
6976 q31_t out
; /* Temporary output */
6977 q31_t xfract
, yfract
; /* X, Y fractional parts */
6978 q7_t x1
, x2
, y1
, y2
; /* Nearest output values */
6979 int32_t rI
, cI
; /* Row and column indices */
6980 q7_t
*pYData
= S
->pData
; /* pointer to output table values */
6981 uint32_t nCols
= S
->numCols
; /* num of rows */
6983 /* Input is in 12.20 format */
6984 /* 12 bits for the table index */
6985 /* Index value calculation */
6986 rI
= ((X
& (q31_t
)0xFFF00000) >> 20);
6988 /* Input is in 12.20 format */
6989 /* 12 bits for the table index */
6990 /* Index value calculation */
6991 cI
= ((Y
& (q31_t
)0xFFF00000) >> 20);
6993 /* Care taken for table outside boundary */
6994 /* Returns zero output when values are outside table boundary */
6995 if(rI
< 0 || rI
> (S
->numRows
- 1) || cI
< 0 || cI
> (S
->numCols
- 1))
7000 /* 20 bits for the fractional part */
7001 /* xfract should be in 12.20 format */
7002 xfract
= (X
& (q31_t
)0x000FFFFF);
7004 /* Read two nearest output values from the index */
7005 x1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) ];
7006 x2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
) + 1];
7008 /* 20 bits for the fractional part */
7009 /* yfract should be in 12.20 format */
7010 yfract
= (Y
& (q31_t
)0x000FFFFF);
7012 /* Read two nearest output values from the index */
7013 y1
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) ];
7014 y2
= pYData
[((uint32_t)rI
) + nCols
* ((uint32_t)cI
+ 1) + 1];
7016 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
7017 out
= ((x1
* (0xFFFFF - xfract
)));
7018 acc
= (((q63_t
) out
* (0xFFFFF - yfract
)));
7020 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
7021 out
= ((x2
* (0xFFFFF - yfract
)));
7022 acc
+= (((q63_t
) out
* (xfract
)));
7024 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
7025 out
= ((y1
* (0xFFFFF - xfract
)));
7026 acc
+= (((q63_t
) out
* (yfract
)));
7028 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
7029 out
= ((y2
* (yfract
)));
7030 acc
+= (((q63_t
) out
* (xfract
)));
7032 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
7033 return ((q7_t
)(acc
>> 40));
7037 * @} end of BilinearInterpolate group
7042 #define multAcc_32x32_keep32_R(a, x, y) \
7043 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
7046 #define multSub_32x32_keep32_R(a, x, y) \
7047 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
7050 #define mult_32x32_keep32_R(a, x, y) \
7051 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
7054 #define multAcc_32x32_keep32(a, x, y) \
7055 a += (q31_t) (((q63_t) x * y) >> 32)
7058 #define multSub_32x32_keep32(a, x, y) \
7059 a -= (q31_t) (((q63_t) x * y) >> 32)
7062 #define mult_32x32_keep32(a, x, y) \
7063 a = (q31_t) (((q63_t) x * y ) >> 32)
7066 #if defined ( __CC_ARM )
7067 /* Enter low optimization region - place directly above function definition */
7068 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
7069 #define LOW_OPTIMIZATION_ENTER \
7073 #define LOW_OPTIMIZATION_ENTER
7076 /* Exit low optimization region - place directly after end of function definition */
7077 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
7078 #define LOW_OPTIMIZATION_EXIT \
7081 #define LOW_OPTIMIZATION_EXIT
7084 /* Enter low optimization region - place directly above function definition */
7085 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7087 /* Exit low optimization region - place directly after end of function definition */
7088 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7090 #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
7091 #define LOW_OPTIMIZATION_ENTER
7092 #define LOW_OPTIMIZATION_EXIT
7093 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7094 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7096 #elif defined(__GNUC__)
7097 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
7098 #define LOW_OPTIMIZATION_EXIT
7099 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7100 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7102 #elif defined(__ICCARM__)
7103 /* Enter low optimization region - place directly above function definition */
7104 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
7105 #define LOW_OPTIMIZATION_ENTER \
7106 _Pragma ("optimize=low")
7108 #define LOW_OPTIMIZATION_ENTER
7111 /* Exit low optimization region - place directly after end of function definition */
7112 #define LOW_OPTIMIZATION_EXIT
7114 /* Enter low optimization region - place directly above function definition */
7115 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
7116 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
7117 _Pragma ("optimize=low")
7119 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7122 /* Exit low optimization region - place directly after end of function definition */
7123 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7125 #elif defined(__CSMC__)
7126 #define LOW_OPTIMIZATION_ENTER
7127 #define LOW_OPTIMIZATION_EXIT
7128 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7129 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7131 #elif defined(__TASKING__)
7132 #define LOW_OPTIMIZATION_ENTER
7133 #define LOW_OPTIMIZATION_EXIT
7134 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
7135 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
7145 #if defined ( __GNUC__ )
7146 #pragma GCC diagnostic pop
7149 #endif /* _ARM_MATH_H */