1 /* ----------------------------------------------------------------------
\r
2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
\r
4 * $Date: 12. March 2014
\r
7 * Project: CMSIS DSP Library
\r
10 * Description: Public header file for CMSIS DSP Library
\r
12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
\r
14 * Redistribution and use in source and binary forms, with or without
\r
15 * modification, are permitted provided that the following conditions
\r
17 * - Redistributions of source code must retain the above copyright
\r
18 * notice, this list of conditions and the following disclaimer.
\r
19 * - Redistributions in binary form must reproduce the above copyright
\r
20 * notice, this list of conditions and the following disclaimer in
\r
21 * the documentation and/or other materials provided with the
\r
23 * - Neither the name of ARM LIMITED nor the names of its contributors
\r
24 * may be used to endorse or promote products derived from this
\r
25 * software without specific prior written permission.
\r
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
\r
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
\r
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
\r
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
\r
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
\r
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
\r
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
38 * POSSIBILITY OF SUCH DAMAGE.
\r
39 * -------------------------------------------------------------------- */
\r
42 \mainpage CMSIS DSP Software Library
\r
47 * This user manual describes the CMSIS DSP software library,
\r
48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
\r
50 * The library is divided into a number of functions each covering a specific category:
\r
51 * - Basic math functions
\r
52 * - Fast math functions
\r
53 * - Complex math functions
\r
55 * - Matrix functions
\r
57 * - Motor control functions
\r
58 * - Statistical functions
\r
59 * - Support functions
\r
60 * - Interpolation functions
\r
62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
\r
63 * 32-bit integer and 32-bit floating-point values.
\r
68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
\r
69 * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
\r
70 * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
\r
71 * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
\r
72 * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
\r
73 * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
\r
74 * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
\r
75 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
\r
76 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
\r
77 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
\r
78 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
\r
79 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
\r
80 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
\r
81 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
\r
82 * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
\r
84 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
\r
85 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
\r
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.
\r
87 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
\r
88 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
\r
93 * The library ships with a number of examples which demonstrate how to use the library functions.
\r
98 * The library has been developed and tested with MDK-ARM version 4.60.
\r
99 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
\r
101 * Building the Library
\r
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.
\r
105 * - arm_cortexM_math.uvproj
\r
108 * The libraries can be built by opening the arm_cortexM_math.uvproj project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
\r
110 * Pre-processor Macros
\r
113 * Each library project have differant pre-processor macros.
\r
115 * - UNALIGNED_SUPPORT_DISABLE:
\r
117 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
\r
119 * - ARM_MATH_BIG_ENDIAN:
\r
121 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
\r
123 * - ARM_MATH_MATRIX_CHECK:
\r
125 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
\r
127 * - ARM_MATH_ROUNDING:
\r
129 * Define macro ARM_MATH_ROUNDING for rounding on support functions
\r
133 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
\r
134 * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target.
\r
138 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
\r
141 * CMSIS-DSP in ARM::CMSIS Pack
\r
142 * -----------------------------
\r
144 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
\r
145 * |File/Folder |Content |
\r
146 * |------------------------------|------------------------------------------------------------------------|
\r
147 * |\b CMSIS\\Documentation\\DSP | This documentation |
\r
148 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
\r
149 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
\r
150 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
\r
153 * Revision History of CMSIS-DSP
\r
155 * Please refer to \ref ChangeLog_pg.
\r
160 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
\r
165 * @defgroup groupMath Basic Math Functions
\r
169 * @defgroup groupFastMath Fast Math Functions
\r
170 * This set of functions provides a fast approximation to sine, cosine, and square root.
\r
171 * As compared to most of the other functions in the CMSIS math library, the fast math functions
\r
172 * operate on individual values and not arrays.
\r
173 * There are separate functions for Q15, Q31, and floating-point data.
\r
178 * @defgroup groupCmplxMath Complex Math Functions
\r
179 * This set of functions operates on complex data vectors.
\r
180 * The data in the complex arrays is stored in an interleaved fashion
\r
181 * (real, imag, real, imag, ...).
\r
182 * In the API functions, the number of samples in a complex array refers
\r
183 * to the number of complex values; the array contains twice this number of
\r
188 * @defgroup groupFilters Filtering Functions
\r
192 * @defgroup groupMatrix Matrix Functions
\r
194 * This set of functions provides basic matrix math operations.
\r
195 * The functions operate on matrix data structures. For example,
\r
197 * definition for the floating-point matrix structure is shown
\r
202 * uint16_t numRows; // number of rows of the matrix.
\r
203 * uint16_t numCols; // number of columns of the matrix.
\r
204 * float32_t *pData; // points to the data of the matrix.
\r
205 * } arm_matrix_instance_f32;
\r
207 * There are similar definitions for Q15 and Q31 data types.
\r
209 * The structure specifies the size of the matrix and then points to
\r
210 * an array of data. The array is of size <code>numRows X numCols</code>
\r
211 * and the values are arranged in row order. That is, the
\r
212 * matrix element (i, j) is stored at:
\r
214 * pData[i*numCols + j]
\r
217 * \par Init Functions
\r
218 * There is an associated initialization function for each type of matrix
\r
220 * The initialization function sets the values of the internal structure fields.
\r
221 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
\r
222 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
\r
225 * Use of the initialization function is optional. However, if initialization function is used
\r
226 * then the instance structure cannot be placed into a const data section.
\r
227 * To place the instance structure in a const data
\r
228 * section, manually initialize the data structure. For example:
\r
230 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
\r
231 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
\r
232 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
\r
234 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
\r
235 * specifies the number of columns, and <code>pData</code> points to the
\r
238 * \par Size Checking
\r
239 * By default all of the matrix functions perform size checking on the input and
\r
240 * output matrices. For example, the matrix addition function verifies that the
\r
241 * two input matrices and the output matrix all have the same number of rows and
\r
242 * columns. If the size check fails the functions return:
\r
244 * ARM_MATH_SIZE_MISMATCH
\r
246 * Otherwise the functions return
\r
250 * There is some overhead associated with this matrix size checking.
\r
251 * The matrix size checking is enabled via the \#define
\r
253 * ARM_MATH_MATRIX_CHECK
\r
255 * within the library project settings. By default this macro is defined
\r
256 * and size checking is enabled. By changing the project settings and
\r
257 * undefining this macro size checking is eliminated and the functions
\r
258 * run a bit faster. With size checking disabled the functions always
\r
259 * return <code>ARM_MATH_SUCCESS</code>.
\r
263 * @defgroup groupTransforms Transform Functions
\r
267 * @defgroup groupController Controller Functions
\r
271 * @defgroup groupStats Statistics Functions
\r
274 * @defgroup groupSupport Support Functions
\r
278 * @defgroup groupInterpolation Interpolation Functions
\r
279 * These functions perform 1- and 2-dimensional interpolation of data.
\r
280 * Linear interpolation is used for 1-dimensional data and
\r
281 * bilinear interpolation is used for 2-dimensional data.
\r
285 * @defgroup groupExamples Examples
\r
287 #ifndef _ARM_MATH_H
\r
288 #define _ARM_MATH_H
\r
290 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
\r
292 #if defined(ARM_MATH_CM7)
\r
293 #include "core_cm7.h"
\r
294 #elif defined (ARM_MATH_CM4)
\r
295 #include "core_cm4.h"
\r
296 #elif defined (ARM_MATH_CM3)
\r
297 #include "core_cm3.h"
\r
298 #elif defined (ARM_MATH_CM0)
\r
299 #include "core_cm0.h"
\r
300 #define ARM_MATH_CM0_FAMILY
\r
301 #elif defined (ARM_MATH_CM0PLUS)
\r
302 #include "core_cm0plus.h"
\r
303 #define ARM_MATH_CM0_FAMILY
\r
305 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
\r
308 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
\r
309 #include "string.h"
\r
318 * @brief Macros required for reciprocal calculation in Normalized LMS
\r
321 #define DELTA_Q31 (0x100)
\r
322 #define DELTA_Q15 0x5
\r
323 #define INDEX_MASK 0x0000003F
\r
325 #define PI 3.14159265358979f
\r
329 * @brief Macros required for SINE and COSINE Fast math approximations
\r
332 #define FAST_MATH_TABLE_SIZE 512
\r
333 #define FAST_MATH_Q31_SHIFT (32 - 10)
\r
334 #define FAST_MATH_Q15_SHIFT (16 - 10)
\r
335 #define CONTROLLER_Q31_SHIFT (32 - 9)
\r
336 #define TABLE_SIZE 256
\r
337 #define TABLE_SPACING_Q31 0x400000
\r
338 #define TABLE_SPACING_Q15 0x80
\r
341 * @brief Macros required for SINE and COSINE Controller functions
\r
343 /* 1.31(q31) Fixed value of 2/360 */
\r
344 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
\r
345 #define INPUT_SPACING 0xB60B61
\r
348 * @brief Macro for Unaligned Support
\r
350 #ifndef UNALIGNED_SUPPORT_DISABLE
\r
353 #if defined (__GNUC__)
\r
354 #define ALIGN4 __attribute__((aligned(4)))
\r
356 #define ALIGN4 __align(4)
\r
358 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
\r
361 * @brief Error status returned by some functions in the library.
\r
366 ARM_MATH_SUCCESS = 0, /**< No error */
\r
367 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
\r
368 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
\r
369 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
\r
370 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
\r
371 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
\r
372 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
\r
376 * @brief 8-bit fractional data type in 1.7 format.
\r
378 typedef int8_t q7_t;
\r
381 * @brief 16-bit fractional data type in 1.15 format.
\r
383 typedef int16_t q15_t;
\r
386 * @brief 32-bit fractional data type in 1.31 format.
\r
388 typedef int32_t q31_t;
\r
391 * @brief 64-bit fractional data type in 1.63 format.
\r
393 typedef int64_t q63_t;
\r
396 * @brief 32-bit floating-point type definition.
\r
398 typedef float float32_t;
\r
401 * @brief 64-bit floating-point type definition.
\r
403 typedef double float64_t;
\r
406 * @brief definition to read/write two 16 bit values.
\r
408 #if defined __CC_ARM
\r
409 #define __SIMD32_TYPE int32_t __packed
\r
410 #define CMSIS_UNUSED __attribute__((unused))
\r
411 #elif defined __ICCARM__
\r
412 #define CMSIS_UNUSED
\r
413 #define __SIMD32_TYPE int32_t __packed
\r
414 #elif defined __GNUC__
\r
415 #define __SIMD32_TYPE int32_t
\r
416 #define CMSIS_UNUSED __attribute__((unused))
\r
417 #elif defined __CSMC__ /* Cosmic */
\r
418 #define CMSIS_UNUSED
\r
419 #define __SIMD32_TYPE int32_t
\r
421 #error Unknown compiler
\r
424 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
\r
425 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
\r
427 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
\r
429 #define __SIMD64(addr) (*(int64_t **) & (addr))
\r
431 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
433 * @brief definition to pack two 16 bit values.
\r
435 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
\r
436 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
\r
437 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
\r
438 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
\r
444 * @brief definition to pack four 8 bit values.
\r
446 #ifndef ARM_MATH_BIG_ENDIAN
\r
448 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
\r
449 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
\r
450 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
\r
451 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
\r
454 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
\r
455 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
\r
456 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
\r
457 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
\r
463 * @brief Clips Q63 to Q31 values.
\r
465 static __INLINE q31_t clip_q63_to_q31(
\r
468 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
469 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
\r
473 * @brief Clips Q63 to Q15 values.
\r
475 static __INLINE q15_t clip_q63_to_q15(
\r
478 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
479 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
\r
483 * @brief Clips Q31 to Q7 values.
\r
485 static __INLINE q7_t clip_q31_to_q7(
\r
488 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
\r
489 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
\r
493 * @brief Clips Q31 to Q15 values.
\r
495 static __INLINE q15_t clip_q31_to_q15(
\r
498 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
\r
499 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
\r
503 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
\r
506 static __INLINE q63_t mult32x64(
\r
510 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
\r
511 (((q63_t) (x >> 32) * y)));
\r
515 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
\r
516 #define __CLZ __clz
\r
519 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
\r
521 static __INLINE uint32_t __CLZ(
\r
525 static __INLINE uint32_t __CLZ(
\r
528 uint32_t count = 0;
\r
529 uint32_t mask = 0x80000000;
\r
531 while((data & mask) == 0)
\r
544 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
\r
547 static __INLINE uint32_t arm_recip_q31(
\r
550 q31_t * pRecipTable)
\r
553 uint32_t out, tempVal;
\r
559 signBits = __CLZ(in) - 1;
\r
563 signBits = __CLZ(-in) - 1;
\r
566 /* Convert input sample to 1.31 format */
\r
567 in = in << signBits;
\r
569 /* calculation of index for initial approximated Val */
\r
570 index = (uint32_t) (in >> 24u);
\r
571 index = (index & INDEX_MASK);
\r
573 /* 1.31 with exp 1 */
\r
574 out = pRecipTable[index];
\r
576 /* calculation of reciprocal value */
\r
577 /* running approximation for two iterations */
\r
578 for (i = 0u; i < 2u; i++)
\r
580 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
\r
581 tempVal = 0x7FFFFFFF - tempVal;
\r
582 /* 1.31 with exp 1 */
\r
583 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
\r
584 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
\r
590 /* return num of signbits of out = 1/in value */
\r
591 return (signBits + 1u);
\r
596 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
\r
598 static __INLINE uint32_t arm_recip_q15(
\r
601 q15_t * pRecipTable)
\r
604 uint32_t out = 0, tempVal = 0;
\r
605 uint32_t index = 0, i = 0;
\r
606 uint32_t signBits = 0;
\r
610 signBits = __CLZ(in) - 17;
\r
614 signBits = __CLZ(-in) - 17;
\r
617 /* Convert input sample to 1.15 format */
\r
618 in = in << signBits;
\r
620 /* calculation of index for initial approximated Val */
\r
622 index = (index & INDEX_MASK);
\r
624 /* 1.15 with exp 1 */
\r
625 out = pRecipTable[index];
\r
627 /* calculation of reciprocal value */
\r
628 /* running approximation for two iterations */
\r
629 for (i = 0; i < 2; i++)
\r
631 tempVal = (q15_t) (((q31_t) in * out) >> 15);
\r
632 tempVal = 0x7FFF - tempVal;
\r
633 /* 1.15 with exp 1 */
\r
634 out = (q15_t) (((q31_t) out * tempVal) >> 14);
\r
640 /* return num of signbits of out = 1/in value */
\r
641 return (signBits + 1);
\r
647 * @brief C custom defined intrinisic function for only M0 processors
\r
649 #if defined(ARM_MATH_CM0_FAMILY)
\r
651 static __INLINE q31_t __SSAT(
\r
655 int32_t posMax, negMin;
\r
659 for (i = 0; i < (y - 1); i++)
\r
661 posMax = posMax * 2;
\r
666 posMax = (posMax - 1);
\r
687 #endif /* end of ARM_MATH_CM0_FAMILY */
\r
692 * @brief C custom defined intrinsic function for M3 and M0 processors
\r
694 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
697 * @brief C custom defined QADD8 for M3 and M0 processors
\r
699 static __INLINE q31_t __QADD8(
\r
710 r = __SSAT((q31_t) (r + s), 8);
\r
711 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
\r
712 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
\r
713 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
\r
716 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
\r
717 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
\r
724 * @brief C custom defined QSUB8 for M3 and M0 processors
\r
726 static __INLINE q31_t __QSUB8(
\r
737 r = __SSAT((r - s), 8);
\r
738 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
\r
739 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
\r
740 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
\r
743 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
\r
750 * @brief C custom defined QADD16 for M3 and M0 processors
\r
754 * @brief C custom defined QADD16 for M3 and M0 processors
\r
756 static __INLINE q31_t __QADD16(
\r
767 r = __SSAT(r + s, 16);
\r
768 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
\r
770 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
777 * @brief C custom defined SHADD16 for M3 and M0 processors
\r
779 static __INLINE q31_t __SHADD16(
\r
790 r = ((r >> 1) + (s >> 1));
\r
791 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
\r
793 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
800 * @brief C custom defined QSUB16 for M3 and M0 processors
\r
802 static __INLINE q31_t __QSUB16(
\r
813 r = __SSAT(r - s, 16);
\r
814 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
\r
816 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
822 * @brief C custom defined SHSUB16 for M3 and M0 processors
\r
824 static __INLINE q31_t __SHSUB16(
\r
835 r = ((r >> 1) - (s >> 1));
\r
836 s = (((x >> 17) - (y >> 17)) << 16);
\r
838 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
844 * @brief C custom defined QASX for M3 and M0 processors
\r
846 static __INLINE q31_t __QASX(
\r
855 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
\r
856 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
\r
862 * @brief C custom defined SHASX for M3 and M0 processors
\r
864 static __INLINE q31_t __SHASX(
\r
875 r = ((r >> 1) - (y >> 17));
\r
876 s = (((x >> 17) + (s >> 1)) << 16);
\r
878 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
885 * @brief C custom defined QSAX for M3 and M0 processors
\r
887 static __INLINE q31_t __QSAX(
\r
896 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
\r
897 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
\r
903 * @brief C custom defined SHSAX for M3 and M0 processors
\r
905 static __INLINE q31_t __SHSAX(
\r
916 r = ((r >> 1) + (y >> 17));
\r
917 s = (((x >> 17) - (s >> 1)) << 16);
\r
919 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
925 * @brief C custom defined SMUSDX for M3 and M0 processors
\r
927 static __INLINE q31_t __SMUSDX(
\r
932 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
\r
933 ((q15_t) (x >> 16) * (q15_t) y)));
\r
937 * @brief C custom defined SMUADX for M3 and M0 processors
\r
939 static __INLINE q31_t __SMUADX(
\r
944 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
\r
945 ((q15_t) (x >> 16) * (q15_t) y)));
\r
949 * @brief C custom defined QADD for M3 and M0 processors
\r
951 static __INLINE q31_t __QADD(
\r
955 return clip_q63_to_q31((q63_t) x + y);
\r
959 * @brief C custom defined QSUB for M3 and M0 processors
\r
961 static __INLINE q31_t __QSUB(
\r
965 return clip_q63_to_q31((q63_t) x - y);
\r
969 * @brief C custom defined SMLAD for M3 and M0 processors
\r
971 static __INLINE q31_t __SMLAD(
\r
977 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
978 ((q15_t) x * (q15_t) y));
\r
982 * @brief C custom defined SMLADX for M3 and M0 processors
\r
984 static __INLINE q31_t __SMLADX(
\r
990 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
991 ((q15_t) x * (q15_t) (y >> 16)));
\r
995 * @brief C custom defined SMLSDX for M3 and M0 processors
\r
997 static __INLINE q31_t __SMLSDX(
\r
1003 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
1004 ((q15_t) x * (q15_t) (y >> 16)));
\r
1008 * @brief C custom defined SMLALD for M3 and M0 processors
\r
1010 static __INLINE q63_t __SMLALD(
\r
1016 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
1017 ((q15_t) x * (q15_t) y));
\r
1021 * @brief C custom defined SMLALDX for M3 and M0 processors
\r
1023 static __INLINE q63_t __SMLALDX(
\r
1029 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
\r
1030 ((q15_t) x * (q15_t) (y >> 16));
\r
1034 * @brief C custom defined SMUAD for M3 and M0 processors
\r
1036 static __INLINE q31_t __SMUAD(
\r
1041 return (((x >> 16) * (y >> 16)) +
\r
1042 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1046 * @brief C custom defined SMUSD for M3 and M0 processors
\r
1048 static __INLINE q31_t __SMUSD(
\r
1053 return (-((x >> 16) * (y >> 16)) +
\r
1054 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1059 * @brief C custom defined SXTB16 for M3 and M0 processors
\r
1061 static __INLINE q31_t __SXTB16(
\r
1065 return ((((x << 24) >> 24) & 0x0000FFFF) |
\r
1066 (((x << 8) >> 8) & 0xFFFF0000));
\r
1070 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
1074 * @brief Instance structure for the Q7 FIR filter.
\r
1078 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1079 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1080 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1081 } arm_fir_instance_q7;
\r
1084 * @brief Instance structure for the Q15 FIR filter.
\r
1088 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1089 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1090 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1091 } arm_fir_instance_q15;
\r
1094 * @brief Instance structure for the Q31 FIR filter.
\r
1098 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1099 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1100 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1101 } arm_fir_instance_q31;
\r
1104 * @brief Instance structure for the floating-point FIR filter.
\r
1108 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1109 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1110 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1111 } arm_fir_instance_f32;
\r
1115 * @brief Processing function for the Q7 FIR filter.
\r
1116 * @param[in] *S points to an instance of the Q7 FIR filter structure.
\r
1117 * @param[in] *pSrc points to the block of input data.
\r
1118 * @param[out] *pDst points to the block of output data.
\r
1119 * @param[in] blockSize number of samples to process.
\r
1123 const arm_fir_instance_q7 * S,
\r
1126 uint32_t blockSize);
\r
1130 * @brief Initialization function for the Q7 FIR filter.
\r
1131 * @param[in,out] *S points to an instance of the Q7 FIR structure.
\r
1132 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1133 * @param[in] *pCoeffs points to the filter coefficients.
\r
1134 * @param[in] *pState points to the state buffer.
\r
1135 * @param[in] blockSize number of samples that are processed.
\r
1138 void arm_fir_init_q7(
\r
1139 arm_fir_instance_q7 * S,
\r
1143 uint32_t blockSize);
\r
1147 * @brief Processing function for the Q15 FIR filter.
\r
1148 * @param[in] *S points to an instance of the Q15 FIR structure.
\r
1149 * @param[in] *pSrc points to the block of input data.
\r
1150 * @param[out] *pDst points to the block of output data.
\r
1151 * @param[in] blockSize number of samples to process.
\r
1155 const arm_fir_instance_q15 * S,
\r
1158 uint32_t blockSize);
\r
1161 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
\r
1162 * @param[in] *S points to an instance of the Q15 FIR filter structure.
\r
1163 * @param[in] *pSrc points to the block of input data.
\r
1164 * @param[out] *pDst points to the block of output data.
\r
1165 * @param[in] blockSize number of samples to process.
\r
1168 void arm_fir_fast_q15(
\r
1169 const arm_fir_instance_q15 * S,
\r
1172 uint32_t blockSize);
\r
1175 * @brief Initialization function for the Q15 FIR filter.
\r
1176 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
\r
1177 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
\r
1178 * @param[in] *pCoeffs points to the filter coefficients.
\r
1179 * @param[in] *pState points to the state buffer.
\r
1180 * @param[in] blockSize number of samples that are processed at a time.
\r
1181 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
\r
1182 * <code>numTaps</code> is not a supported value.
\r
1185 arm_status arm_fir_init_q15(
\r
1186 arm_fir_instance_q15 * S,
\r
1190 uint32_t blockSize);
\r
1193 * @brief Processing function for the Q31 FIR filter.
\r
1194 * @param[in] *S points to an instance of the Q31 FIR filter structure.
\r
1195 * @param[in] *pSrc points to the block of input data.
\r
1196 * @param[out] *pDst points to the block of output data.
\r
1197 * @param[in] blockSize number of samples to process.
\r
1201 const arm_fir_instance_q31 * S,
\r
1204 uint32_t blockSize);
\r
1207 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
\r
1208 * @param[in] *S points to an instance of the Q31 FIR structure.
\r
1209 * @param[in] *pSrc points to the block of input data.
\r
1210 * @param[out] *pDst points to the block of output data.
\r
1211 * @param[in] blockSize number of samples to process.
\r
1214 void arm_fir_fast_q31(
\r
1215 const arm_fir_instance_q31 * S,
\r
1218 uint32_t blockSize);
\r
1221 * @brief Initialization function for the Q31 FIR filter.
\r
1222 * @param[in,out] *S points to an instance of the Q31 FIR structure.
\r
1223 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1224 * @param[in] *pCoeffs points to the filter coefficients.
\r
1225 * @param[in] *pState points to the state buffer.
\r
1226 * @param[in] blockSize number of samples that are processed at a time.
\r
1229 void arm_fir_init_q31(
\r
1230 arm_fir_instance_q31 * S,
\r
1234 uint32_t blockSize);
\r
1237 * @brief Processing function for the floating-point FIR filter.
\r
1238 * @param[in] *S points to an instance of the floating-point FIR structure.
\r
1239 * @param[in] *pSrc points to the block of input data.
\r
1240 * @param[out] *pDst points to the block of output data.
\r
1241 * @param[in] blockSize number of samples to process.
\r
1245 const arm_fir_instance_f32 * S,
\r
1248 uint32_t blockSize);
\r
1251 * @brief Initialization function for the floating-point FIR filter.
\r
1252 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
\r
1253 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1254 * @param[in] *pCoeffs points to the filter coefficients.
\r
1255 * @param[in] *pState points to the state buffer.
\r
1256 * @param[in] blockSize number of samples that are processed at a time.
\r
1259 void arm_fir_init_f32(
\r
1260 arm_fir_instance_f32 * S,
\r
1262 float32_t * pCoeffs,
\r
1263 float32_t * pState,
\r
1264 uint32_t blockSize);
\r
1268 * @brief Instance structure for the Q15 Biquad cascade filter.
\r
1272 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1273 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1274 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1275 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1277 } arm_biquad_casd_df1_inst_q15;
\r
1281 * @brief Instance structure for the Q31 Biquad cascade filter.
\r
1285 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1286 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1287 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1288 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1290 } arm_biquad_casd_df1_inst_q31;
\r
1293 * @brief Instance structure for the floating-point Biquad cascade filter.
\r
1297 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1298 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1299 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1302 } arm_biquad_casd_df1_inst_f32;
\r
1307 * @brief Processing function for the Q15 Biquad cascade filter.
\r
1308 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1309 * @param[in] *pSrc points to the block of input data.
\r
1310 * @param[out] *pDst points to the block of output data.
\r
1311 * @param[in] blockSize number of samples to process.
\r
1315 void arm_biquad_cascade_df1_q15(
\r
1316 const arm_biquad_casd_df1_inst_q15 * S,
\r
1319 uint32_t blockSize);
\r
1322 * @brief Initialization function for the Q15 Biquad cascade filter.
\r
1323 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
\r
1324 * @param[in] numStages number of 2nd order stages in the filter.
\r
1325 * @param[in] *pCoeffs points to the filter coefficients.
\r
1326 * @param[in] *pState points to the state buffer.
\r
1327 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1331 void arm_biquad_cascade_df1_init_q15(
\r
1332 arm_biquad_casd_df1_inst_q15 * S,
\r
1333 uint8_t numStages,
\r
1336 int8_t postShift);
\r
1340 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1341 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1342 * @param[in] *pSrc points to the block of input data.
\r
1343 * @param[out] *pDst points to the block of output data.
\r
1344 * @param[in] blockSize number of samples to process.
\r
1348 void arm_biquad_cascade_df1_fast_q15(
\r
1349 const arm_biquad_casd_df1_inst_q15 * S,
\r
1352 uint32_t blockSize);
\r
1356 * @brief Processing function for the Q31 Biquad cascade filter
\r
1357 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1358 * @param[in] *pSrc points to the block of input data.
\r
1359 * @param[out] *pDst points to the block of output data.
\r
1360 * @param[in] blockSize number of samples to process.
\r
1364 void arm_biquad_cascade_df1_q31(
\r
1365 const arm_biquad_casd_df1_inst_q31 * S,
\r
1368 uint32_t blockSize);
\r
1371 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1372 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1373 * @param[in] *pSrc points to the block of input data.
\r
1374 * @param[out] *pDst points to the block of output data.
\r
1375 * @param[in] blockSize number of samples to process.
\r
1379 void arm_biquad_cascade_df1_fast_q31(
\r
1380 const arm_biquad_casd_df1_inst_q31 * S,
\r
1383 uint32_t blockSize);
\r
1386 * @brief Initialization function for the Q31 Biquad cascade filter.
\r
1387 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
\r
1388 * @param[in] numStages number of 2nd order stages in the filter.
\r
1389 * @param[in] *pCoeffs points to the filter coefficients.
\r
1390 * @param[in] *pState points to the state buffer.
\r
1391 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1395 void arm_biquad_cascade_df1_init_q31(
\r
1396 arm_biquad_casd_df1_inst_q31 * S,
\r
1397 uint8_t numStages,
\r
1400 int8_t postShift);
\r
1403 * @brief Processing function for the floating-point Biquad cascade filter.
\r
1404 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
\r
1405 * @param[in] *pSrc points to the block of input data.
\r
1406 * @param[out] *pDst points to the block of output data.
\r
1407 * @param[in] blockSize number of samples to process.
\r
1411 void arm_biquad_cascade_df1_f32(
\r
1412 const arm_biquad_casd_df1_inst_f32 * S,
\r
1415 uint32_t blockSize);
\r
1418 * @brief Initialization function for the floating-point Biquad cascade filter.
\r
1419 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
\r
1420 * @param[in] numStages number of 2nd order stages in the filter.
\r
1421 * @param[in] *pCoeffs points to the filter coefficients.
\r
1422 * @param[in] *pState points to the state buffer.
\r
1426 void arm_biquad_cascade_df1_init_f32(
\r
1427 arm_biquad_casd_df1_inst_f32 * S,
\r
1428 uint8_t numStages,
\r
1429 float32_t * pCoeffs,
\r
1430 float32_t * pState);
\r
1434 * @brief Instance structure for the floating-point matrix structure.
\r
1439 uint16_t numRows; /**< number of rows of the matrix. */
\r
1440 uint16_t numCols; /**< number of columns of the matrix. */
\r
1441 float32_t *pData; /**< points to the data of the matrix. */
\r
1442 } arm_matrix_instance_f32;
\r
1446 * @brief Instance structure for the floating-point matrix structure.
\r
1451 uint16_t numRows; /**< number of rows of the matrix. */
\r
1452 uint16_t numCols; /**< number of columns of the matrix. */
\r
1453 float64_t *pData; /**< points to the data of the matrix. */
\r
1454 } arm_matrix_instance_f64;
\r
1457 * @brief Instance structure for the Q15 matrix structure.
\r
1462 uint16_t numRows; /**< number of rows of the matrix. */
\r
1463 uint16_t numCols; /**< number of columns of the matrix. */
\r
1464 q15_t *pData; /**< points to the data of the matrix. */
\r
1466 } arm_matrix_instance_q15;
\r
1469 * @brief Instance structure for the Q31 matrix structure.
\r
1474 uint16_t numRows; /**< number of rows of the matrix. */
\r
1475 uint16_t numCols; /**< number of columns of the matrix. */
\r
1476 q31_t *pData; /**< points to the data of the matrix. */
\r
1478 } arm_matrix_instance_q31;
\r
1483 * @brief Floating-point matrix addition.
\r
1484 * @param[in] *pSrcA points to the first input matrix structure
\r
1485 * @param[in] *pSrcB points to the second input matrix structure
\r
1486 * @param[out] *pDst points to output matrix structure
\r
1487 * @return The function returns either
\r
1488 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1491 arm_status arm_mat_add_f32(
\r
1492 const arm_matrix_instance_f32 * pSrcA,
\r
1493 const arm_matrix_instance_f32 * pSrcB,
\r
1494 arm_matrix_instance_f32 * pDst);
\r
1497 * @brief Q15 matrix addition.
\r
1498 * @param[in] *pSrcA points to the first input matrix structure
\r
1499 * @param[in] *pSrcB points to the second input matrix structure
\r
1500 * @param[out] *pDst points to output matrix structure
\r
1501 * @return The function returns either
\r
1502 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1505 arm_status arm_mat_add_q15(
\r
1506 const arm_matrix_instance_q15 * pSrcA,
\r
1507 const arm_matrix_instance_q15 * pSrcB,
\r
1508 arm_matrix_instance_q15 * pDst);
\r
1511 * @brief Q31 matrix addition.
\r
1512 * @param[in] *pSrcA points to the first input matrix structure
\r
1513 * @param[in] *pSrcB points to the second input matrix structure
\r
1514 * @param[out] *pDst points to output matrix structure
\r
1515 * @return The function returns either
\r
1516 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1519 arm_status arm_mat_add_q31(
\r
1520 const arm_matrix_instance_q31 * pSrcA,
\r
1521 const arm_matrix_instance_q31 * pSrcB,
\r
1522 arm_matrix_instance_q31 * pDst);
\r
1525 * @brief Floating-point, complex, matrix multiplication.
\r
1526 * @param[in] *pSrcA points to the first input matrix structure
\r
1527 * @param[in] *pSrcB points to the second input matrix structure
\r
1528 * @param[out] *pDst points to output matrix structure
\r
1529 * @return The function returns either
\r
1530 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1533 arm_status arm_mat_cmplx_mult_f32(
\r
1534 const arm_matrix_instance_f32 * pSrcA,
\r
1535 const arm_matrix_instance_f32 * pSrcB,
\r
1536 arm_matrix_instance_f32 * pDst);
\r
1539 * @brief Q15, complex, matrix multiplication.
\r
1540 * @param[in] *pSrcA points to the first input matrix structure
\r
1541 * @param[in] *pSrcB points to the second input matrix structure
\r
1542 * @param[out] *pDst points to output matrix structure
\r
1543 * @return The function returns either
\r
1544 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1547 arm_status arm_mat_cmplx_mult_q15(
\r
1548 const arm_matrix_instance_q15 * pSrcA,
\r
1549 const arm_matrix_instance_q15 * pSrcB,
\r
1550 arm_matrix_instance_q15 * pDst,
\r
1551 q15_t * pScratch);
\r
1554 * @brief Q31, complex, matrix multiplication.
\r
1555 * @param[in] *pSrcA points to the first input matrix structure
\r
1556 * @param[in] *pSrcB points to the second input matrix structure
\r
1557 * @param[out] *pDst points to output matrix structure
\r
1558 * @return The function returns either
\r
1559 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1562 arm_status arm_mat_cmplx_mult_q31(
\r
1563 const arm_matrix_instance_q31 * pSrcA,
\r
1564 const arm_matrix_instance_q31 * pSrcB,
\r
1565 arm_matrix_instance_q31 * pDst);
\r
1569 * @brief Floating-point matrix transpose.
\r
1570 * @param[in] *pSrc points to the input matrix
\r
1571 * @param[out] *pDst points to the output matrix
\r
1572 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1573 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1576 arm_status arm_mat_trans_f32(
\r
1577 const arm_matrix_instance_f32 * pSrc,
\r
1578 arm_matrix_instance_f32 * pDst);
\r
1582 * @brief Q15 matrix transpose.
\r
1583 * @param[in] *pSrc points to the input matrix
\r
1584 * @param[out] *pDst points to the output matrix
\r
1585 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1586 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1589 arm_status arm_mat_trans_q15(
\r
1590 const arm_matrix_instance_q15 * pSrc,
\r
1591 arm_matrix_instance_q15 * pDst);
\r
1594 * @brief Q31 matrix transpose.
\r
1595 * @param[in] *pSrc points to the input matrix
\r
1596 * @param[out] *pDst points to the output matrix
\r
1597 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1598 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1601 arm_status arm_mat_trans_q31(
\r
1602 const arm_matrix_instance_q31 * pSrc,
\r
1603 arm_matrix_instance_q31 * pDst);
\r
1607 * @brief Floating-point matrix multiplication
\r
1608 * @param[in] *pSrcA points to the first input matrix structure
\r
1609 * @param[in] *pSrcB points to the second input matrix structure
\r
1610 * @param[out] *pDst points to output matrix structure
\r
1611 * @return The function returns either
\r
1612 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1615 arm_status arm_mat_mult_f32(
\r
1616 const arm_matrix_instance_f32 * pSrcA,
\r
1617 const arm_matrix_instance_f32 * pSrcB,
\r
1618 arm_matrix_instance_f32 * pDst);
\r
1621 * @brief Q15 matrix multiplication
\r
1622 * @param[in] *pSrcA points to the first input matrix structure
\r
1623 * @param[in] *pSrcB points to the second input matrix structure
\r
1624 * @param[out] *pDst points to output matrix structure
\r
1625 * @param[in] *pState points to the array for storing intermediate results
\r
1626 * @return The function returns either
\r
1627 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1630 arm_status arm_mat_mult_q15(
\r
1631 const arm_matrix_instance_q15 * pSrcA,
\r
1632 const arm_matrix_instance_q15 * pSrcB,
\r
1633 arm_matrix_instance_q15 * pDst,
\r
1637 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1638 * @param[in] *pSrcA points to the first input matrix structure
\r
1639 * @param[in] *pSrcB points to the second input matrix structure
\r
1640 * @param[out] *pDst points to output matrix structure
\r
1641 * @param[in] *pState points to the array for storing intermediate results
\r
1642 * @return The function returns either
\r
1643 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1646 arm_status arm_mat_mult_fast_q15(
\r
1647 const arm_matrix_instance_q15 * pSrcA,
\r
1648 const arm_matrix_instance_q15 * pSrcB,
\r
1649 arm_matrix_instance_q15 * pDst,
\r
1653 * @brief Q31 matrix multiplication
\r
1654 * @param[in] *pSrcA points to the first input matrix structure
\r
1655 * @param[in] *pSrcB points to the second input matrix structure
\r
1656 * @param[out] *pDst points to output matrix structure
\r
1657 * @return The function returns either
\r
1658 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1661 arm_status arm_mat_mult_q31(
\r
1662 const arm_matrix_instance_q31 * pSrcA,
\r
1663 const arm_matrix_instance_q31 * pSrcB,
\r
1664 arm_matrix_instance_q31 * pDst);
\r
1667 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1668 * @param[in] *pSrcA points to the first input matrix structure
\r
1669 * @param[in] *pSrcB points to the second input matrix structure
\r
1670 * @param[out] *pDst points to output matrix structure
\r
1671 * @return The function returns either
\r
1672 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1675 arm_status arm_mat_mult_fast_q31(
\r
1676 const arm_matrix_instance_q31 * pSrcA,
\r
1677 const arm_matrix_instance_q31 * pSrcB,
\r
1678 arm_matrix_instance_q31 * pDst);
\r
1682 * @brief Floating-point matrix subtraction
\r
1683 * @param[in] *pSrcA points to the first input matrix structure
\r
1684 * @param[in] *pSrcB points to the second input matrix structure
\r
1685 * @param[out] *pDst points to output matrix structure
\r
1686 * @return The function returns either
\r
1687 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1690 arm_status arm_mat_sub_f32(
\r
1691 const arm_matrix_instance_f32 * pSrcA,
\r
1692 const arm_matrix_instance_f32 * pSrcB,
\r
1693 arm_matrix_instance_f32 * pDst);
\r
1696 * @brief Q15 matrix subtraction
\r
1697 * @param[in] *pSrcA points to the first input matrix structure
\r
1698 * @param[in] *pSrcB points to the second input matrix structure
\r
1699 * @param[out] *pDst points to output matrix structure
\r
1700 * @return The function returns either
\r
1701 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1704 arm_status arm_mat_sub_q15(
\r
1705 const arm_matrix_instance_q15 * pSrcA,
\r
1706 const arm_matrix_instance_q15 * pSrcB,
\r
1707 arm_matrix_instance_q15 * pDst);
\r
1710 * @brief Q31 matrix subtraction
\r
1711 * @param[in] *pSrcA points to the first input matrix structure
\r
1712 * @param[in] *pSrcB points to the second input matrix structure
\r
1713 * @param[out] *pDst points to output matrix structure
\r
1714 * @return The function returns either
\r
1715 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1718 arm_status arm_mat_sub_q31(
\r
1719 const arm_matrix_instance_q31 * pSrcA,
\r
1720 const arm_matrix_instance_q31 * pSrcB,
\r
1721 arm_matrix_instance_q31 * pDst);
\r
1724 * @brief Floating-point matrix scaling.
\r
1725 * @param[in] *pSrc points to the input matrix
\r
1726 * @param[in] scale scale factor
\r
1727 * @param[out] *pDst points to the output matrix
\r
1728 * @return The function returns either
\r
1729 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1732 arm_status arm_mat_scale_f32(
\r
1733 const arm_matrix_instance_f32 * pSrc,
\r
1735 arm_matrix_instance_f32 * pDst);
\r
1738 * @brief Q15 matrix scaling.
\r
1739 * @param[in] *pSrc points to input matrix
\r
1740 * @param[in] scaleFract fractional portion of the scale factor
\r
1741 * @param[in] shift number of bits to shift the result by
\r
1742 * @param[out] *pDst points to output matrix
\r
1743 * @return The function returns either
\r
1744 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1747 arm_status arm_mat_scale_q15(
\r
1748 const arm_matrix_instance_q15 * pSrc,
\r
1751 arm_matrix_instance_q15 * pDst);
\r
1754 * @brief Q31 matrix scaling.
\r
1755 * @param[in] *pSrc points to input matrix
\r
1756 * @param[in] scaleFract fractional portion of the scale factor
\r
1757 * @param[in] shift number of bits to shift the result by
\r
1758 * @param[out] *pDst points to output matrix structure
\r
1759 * @return The function returns either
\r
1760 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1763 arm_status arm_mat_scale_q31(
\r
1764 const arm_matrix_instance_q31 * pSrc,
\r
1767 arm_matrix_instance_q31 * pDst);
\r
1771 * @brief Q31 matrix initialization.
\r
1772 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1773 * @param[in] nRows number of rows in the matrix.
\r
1774 * @param[in] nColumns number of columns in the matrix.
\r
1775 * @param[in] *pData points to the matrix data array.
\r
1779 void arm_mat_init_q31(
\r
1780 arm_matrix_instance_q31 * S,
\r
1782 uint16_t nColumns,
\r
1786 * @brief Q15 matrix initialization.
\r
1787 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1788 * @param[in] nRows number of rows in the matrix.
\r
1789 * @param[in] nColumns number of columns in the matrix.
\r
1790 * @param[in] *pData points to the matrix data array.
\r
1794 void arm_mat_init_q15(
\r
1795 arm_matrix_instance_q15 * S,
\r
1797 uint16_t nColumns,
\r
1801 * @brief Floating-point matrix initialization.
\r
1802 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1803 * @param[in] nRows number of rows in the matrix.
\r
1804 * @param[in] nColumns number of columns in the matrix.
\r
1805 * @param[in] *pData points to the matrix data array.
\r
1809 void arm_mat_init_f32(
\r
1810 arm_matrix_instance_f32 * S,
\r
1812 uint16_t nColumns,
\r
1813 float32_t * pData);
\r
1818 * @brief Instance structure for the Q15 PID Control.
\r
1822 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1823 #ifdef ARM_MATH_CM0_FAMILY
\r
1827 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
\r
1829 q15_t state[3]; /**< The state array of length 3. */
\r
1830 q15_t Kp; /**< The proportional gain. */
\r
1831 q15_t Ki; /**< The integral gain. */
\r
1832 q15_t Kd; /**< The derivative gain. */
\r
1833 } arm_pid_instance_q15;
\r
1836 * @brief Instance structure for the Q31 PID Control.
\r
1840 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1841 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1842 q31_t A2; /**< The derived gain, A2 = Kd . */
\r
1843 q31_t state[3]; /**< The state array of length 3. */
\r
1844 q31_t Kp; /**< The proportional gain. */
\r
1845 q31_t Ki; /**< The integral gain. */
\r
1846 q31_t Kd; /**< The derivative gain. */
\r
1848 } arm_pid_instance_q31;
\r
1851 * @brief Instance structure for the floating-point PID Control.
\r
1855 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1856 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1857 float32_t A2; /**< The derived gain, A2 = Kd . */
\r
1858 float32_t state[3]; /**< The state array of length 3. */
\r
1859 float32_t Kp; /**< The proportional gain. */
\r
1860 float32_t Ki; /**< The integral gain. */
\r
1861 float32_t Kd; /**< The derivative gain. */
\r
1862 } arm_pid_instance_f32;
\r
1867 * @brief Initialization function for the floating-point PID Control.
\r
1868 * @param[in,out] *S points to an instance of the PID structure.
\r
1869 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1872 void arm_pid_init_f32(
\r
1873 arm_pid_instance_f32 * S,
\r
1874 int32_t resetStateFlag);
\r
1877 * @brief Reset function for the floating-point PID Control.
\r
1878 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
1881 void arm_pid_reset_f32(
\r
1882 arm_pid_instance_f32 * S);
\r
1886 * @brief Initialization function for the Q31 PID Control.
\r
1887 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1888 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1891 void arm_pid_init_q31(
\r
1892 arm_pid_instance_q31 * S,
\r
1893 int32_t resetStateFlag);
\r
1897 * @brief Reset function for the Q31 PID Control.
\r
1898 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
1902 void arm_pid_reset_q31(
\r
1903 arm_pid_instance_q31 * S);
\r
1906 * @brief Initialization function for the Q15 PID Control.
\r
1907 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1908 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1911 void arm_pid_init_q15(
\r
1912 arm_pid_instance_q15 * S,
\r
1913 int32_t resetStateFlag);
\r
1916 * @brief Reset function for the Q15 PID Control.
\r
1917 * @param[in,out] *S points to an instance of the q15 PID Control structure
\r
1920 void arm_pid_reset_q15(
\r
1921 arm_pid_instance_q15 * S);
\r
1925 * @brief Instance structure for the floating-point Linear Interpolate function.
\r
1929 uint32_t nValues; /**< nValues */
\r
1930 float32_t x1; /**< x1 */
\r
1931 float32_t xSpacing; /**< xSpacing */
\r
1932 float32_t *pYData; /**< pointer to the table of Y values */
\r
1933 } arm_linear_interp_instance_f32;
\r
1936 * @brief Instance structure for the floating-point bilinear interpolation function.
\r
1941 uint16_t numRows; /**< number of rows in the data table. */
\r
1942 uint16_t numCols; /**< number of columns in the data table. */
\r
1943 float32_t *pData; /**< points to the data table. */
\r
1944 } arm_bilinear_interp_instance_f32;
\r
1947 * @brief Instance structure for the Q31 bilinear interpolation function.
\r
1952 uint16_t numRows; /**< number of rows in the data table. */
\r
1953 uint16_t numCols; /**< number of columns in the data table. */
\r
1954 q31_t *pData; /**< points to the data table. */
\r
1955 } arm_bilinear_interp_instance_q31;
\r
1958 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1963 uint16_t numRows; /**< number of rows in the data table. */
\r
1964 uint16_t numCols; /**< number of columns in the data table. */
\r
1965 q15_t *pData; /**< points to the data table. */
\r
1966 } arm_bilinear_interp_instance_q15;
\r
1969 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1974 uint16_t numRows; /**< number of rows in the data table. */
\r
1975 uint16_t numCols; /**< number of columns in the data table. */
\r
1976 q7_t *pData; /**< points to the data table. */
\r
1977 } arm_bilinear_interp_instance_q7;
\r
1981 * @brief Q7 vector multiplication.
\r
1982 * @param[in] *pSrcA points to the first input vector
\r
1983 * @param[in] *pSrcB points to the second input vector
\r
1984 * @param[out] *pDst points to the output vector
\r
1985 * @param[in] blockSize number of samples in each vector
\r
1993 uint32_t blockSize);
\r
1996 * @brief Q15 vector multiplication.
\r
1997 * @param[in] *pSrcA points to the first input vector
\r
1998 * @param[in] *pSrcB points to the second input vector
\r
1999 * @param[out] *pDst points to the output vector
\r
2000 * @param[in] blockSize number of samples in each vector
\r
2004 void arm_mult_q15(
\r
2008 uint32_t blockSize);
\r
2011 * @brief Q31 vector multiplication.
\r
2012 * @param[in] *pSrcA points to the first input vector
\r
2013 * @param[in] *pSrcB points to the second input vector
\r
2014 * @param[out] *pDst points to the output vector
\r
2015 * @param[in] blockSize number of samples in each vector
\r
2019 void arm_mult_q31(
\r
2023 uint32_t blockSize);
\r
2026 * @brief Floating-point vector multiplication.
\r
2027 * @param[in] *pSrcA points to the first input vector
\r
2028 * @param[in] *pSrcB points to the second input vector
\r
2029 * @param[out] *pDst points to the output vector
\r
2030 * @param[in] blockSize number of samples in each vector
\r
2034 void arm_mult_f32(
\r
2035 float32_t * pSrcA,
\r
2036 float32_t * pSrcB,
\r
2038 uint32_t blockSize);
\r
2046 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2051 uint16_t fftLen; /**< length of the FFT. */
\r
2052 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2053 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2054 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
\r
2055 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2056 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2057 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2058 } arm_cfft_radix2_instance_q15;
\r
2061 arm_status arm_cfft_radix2_init_q15(
\r
2062 arm_cfft_radix2_instance_q15 * S,
\r
2065 uint8_t bitReverseFlag);
\r
2068 void arm_cfft_radix2_q15(
\r
2069 const arm_cfft_radix2_instance_q15 * S,
\r
2075 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2080 uint16_t fftLen; /**< length of the FFT. */
\r
2081 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2082 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2083 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2084 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2085 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2086 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2087 } arm_cfft_radix4_instance_q15;
\r
2090 arm_status arm_cfft_radix4_init_q15(
\r
2091 arm_cfft_radix4_instance_q15 * S,
\r
2094 uint8_t bitReverseFlag);
\r
2097 void arm_cfft_radix4_q15(
\r
2098 const arm_cfft_radix4_instance_q15 * S,
\r
2102 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
\r
2107 uint16_t fftLen; /**< length of the FFT. */
\r
2108 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2109 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2110 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2111 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2112 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2113 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2114 } arm_cfft_radix2_instance_q31;
\r
2117 arm_status arm_cfft_radix2_init_q31(
\r
2118 arm_cfft_radix2_instance_q31 * S,
\r
2121 uint8_t bitReverseFlag);
\r
2124 void arm_cfft_radix2_q31(
\r
2125 const arm_cfft_radix2_instance_q31 * S,
\r
2129 * @brief Instance structure for the Q31 CFFT/CIFFT function.
\r
2134 uint16_t fftLen; /**< length of the FFT. */
\r
2135 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2136 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2137 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2138 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2139 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2140 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2141 } arm_cfft_radix4_instance_q31;
\r
2144 void arm_cfft_radix4_q31(
\r
2145 const arm_cfft_radix4_instance_q31 * S,
\r
2149 arm_status arm_cfft_radix4_init_q31(
\r
2150 arm_cfft_radix4_instance_q31 * S,
\r
2153 uint8_t bitReverseFlag);
\r
2156 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2161 uint16_t fftLen; /**< length of the FFT. */
\r
2162 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2163 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2164 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2165 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2166 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2167 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2168 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2169 } arm_cfft_radix2_instance_f32;
\r
2172 arm_status arm_cfft_radix2_init_f32(
\r
2173 arm_cfft_radix2_instance_f32 * S,
\r
2176 uint8_t bitReverseFlag);
\r
2179 void arm_cfft_radix2_f32(
\r
2180 const arm_cfft_radix2_instance_f32 * S,
\r
2181 float32_t * pSrc);
\r
2184 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2189 uint16_t fftLen; /**< length of the FFT. */
\r
2190 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2191 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2192 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2193 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2194 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2195 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2196 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2197 } arm_cfft_radix4_instance_f32;
\r
2200 arm_status arm_cfft_radix4_init_f32(
\r
2201 arm_cfft_radix4_instance_f32 * S,
\r
2204 uint8_t bitReverseFlag);
\r
2207 void arm_cfft_radix4_f32(
\r
2208 const arm_cfft_radix4_instance_f32 * S,
\r
2209 float32_t * pSrc);
\r
2212 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2217 uint16_t fftLen; /**< length of the FFT. */
\r
2218 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2219 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2220 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2221 } arm_cfft_instance_q15;
\r
2223 void arm_cfft_q15(
\r
2224 const arm_cfft_instance_q15 * S,
\r
2227 uint8_t bitReverseFlag);
\r
2230 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2235 uint16_t fftLen; /**< length of the FFT. */
\r
2236 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2237 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2238 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2239 } arm_cfft_instance_q31;
\r
2241 void arm_cfft_q31(
\r
2242 const arm_cfft_instance_q31 * S,
\r
2245 uint8_t bitReverseFlag);
\r
2248 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2253 uint16_t fftLen; /**< length of the FFT. */
\r
2254 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2255 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2256 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2257 } arm_cfft_instance_f32;
\r
2259 void arm_cfft_f32(
\r
2260 const arm_cfft_instance_f32 * S,
\r
2263 uint8_t bitReverseFlag);
\r
2266 * @brief Instance structure for the Q15 RFFT/RIFFT function.
\r
2271 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2272 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2273 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2274 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2275 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2276 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2277 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2278 } arm_rfft_instance_q15;
\r
2280 arm_status arm_rfft_init_q15(
\r
2281 arm_rfft_instance_q15 * S,
\r
2282 uint32_t fftLenReal,
\r
2283 uint32_t ifftFlagR,
\r
2284 uint32_t bitReverseFlag);
\r
2286 void arm_rfft_q15(
\r
2287 const arm_rfft_instance_q15 * S,
\r
2292 * @brief Instance structure for the Q31 RFFT/RIFFT function.
\r
2297 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2298 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2299 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2300 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2301 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2302 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2303 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2304 } arm_rfft_instance_q31;
\r
2306 arm_status arm_rfft_init_q31(
\r
2307 arm_rfft_instance_q31 * S,
\r
2308 uint32_t fftLenReal,
\r
2309 uint32_t ifftFlagR,
\r
2310 uint32_t bitReverseFlag);
\r
2312 void arm_rfft_q31(
\r
2313 const arm_rfft_instance_q31 * S,
\r
2318 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2323 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2324 uint16_t fftLenBy2; /**< length of the complex FFT. */
\r
2325 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2326 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2327 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2328 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2329 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2330 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2331 } arm_rfft_instance_f32;
\r
2333 arm_status arm_rfft_init_f32(
\r
2334 arm_rfft_instance_f32 * S,
\r
2335 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2336 uint32_t fftLenReal,
\r
2337 uint32_t ifftFlagR,
\r
2338 uint32_t bitReverseFlag);
\r
2340 void arm_rfft_f32(
\r
2341 const arm_rfft_instance_f32 * S,
\r
2343 float32_t * pDst);
\r
2346 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2351 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
\r
2352 uint16_t fftLenRFFT; /**< length of the real sequence */
\r
2353 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
\r
2354 } arm_rfft_fast_instance_f32 ;
\r
2356 arm_status arm_rfft_fast_init_f32 (
\r
2357 arm_rfft_fast_instance_f32 * S,
\r
2360 void arm_rfft_fast_f32(
\r
2361 arm_rfft_fast_instance_f32 * S,
\r
2362 float32_t * p, float32_t * pOut,
\r
2363 uint8_t ifftFlag);
\r
2366 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
\r
2371 uint16_t N; /**< length of the DCT4. */
\r
2372 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2373 float32_t normalize; /**< normalizing factor. */
\r
2374 float32_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2375 float32_t *pCosFactor; /**< points to the cosFactor table. */
\r
2376 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
\r
2377 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2378 } arm_dct4_instance_f32;
\r
2381 * @brief Initialization function for the floating-point DCT4/IDCT4.
\r
2382 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
\r
2383 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
\r
2384 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
\r
2385 * @param[in] N length of the DCT4.
\r
2386 * @param[in] Nby2 half of the length of the DCT4.
\r
2387 * @param[in] normalize normalizing factor.
\r
2388 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.
\r
2391 arm_status arm_dct4_init_f32(
\r
2392 arm_dct4_instance_f32 * S,
\r
2393 arm_rfft_instance_f32 * S_RFFT,
\r
2394 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2397 float32_t normalize);
\r
2400 * @brief Processing function for the floating-point DCT4/IDCT4.
\r
2401 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
\r
2402 * @param[in] *pState points to state buffer.
\r
2403 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2407 void arm_dct4_f32(
\r
2408 const arm_dct4_instance_f32 * S,
\r
2409 float32_t * pState,
\r
2410 float32_t * pInlineBuffer);
\r
2413 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
\r
2418 uint16_t N; /**< length of the DCT4. */
\r
2419 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2420 q31_t normalize; /**< normalizing factor. */
\r
2421 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2422 q31_t *pCosFactor; /**< points to the cosFactor table. */
\r
2423 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
\r
2424 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2425 } arm_dct4_instance_q31;
\r
2428 * @brief Initialization function for the Q31 DCT4/IDCT4.
\r
2429 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
\r
2430 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
\r
2431 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
\r
2432 * @param[in] N length of the DCT4.
\r
2433 * @param[in] Nby2 half of the length of the DCT4.
\r
2434 * @param[in] normalize normalizing factor.
\r
2435 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
\r
2438 arm_status arm_dct4_init_q31(
\r
2439 arm_dct4_instance_q31 * S,
\r
2440 arm_rfft_instance_q31 * S_RFFT,
\r
2441 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2447 * @brief Processing function for the Q31 DCT4/IDCT4.
\r
2448 * @param[in] *S points to an instance of the Q31 DCT4 structure.
\r
2449 * @param[in] *pState points to state buffer.
\r
2450 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2454 void arm_dct4_q31(
\r
2455 const arm_dct4_instance_q31 * S,
\r
2457 q31_t * pInlineBuffer);
\r
2460 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
\r
2465 uint16_t N; /**< length of the DCT4. */
\r
2466 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2467 q15_t normalize; /**< normalizing factor. */
\r
2468 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2469 q15_t *pCosFactor; /**< points to the cosFactor table. */
\r
2470 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
\r
2471 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2472 } arm_dct4_instance_q15;
\r
2475 * @brief Initialization function for the Q15 DCT4/IDCT4.
\r
2476 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
\r
2477 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
\r
2478 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
\r
2479 * @param[in] N length of the DCT4.
\r
2480 * @param[in] Nby2 half of the length of the DCT4.
\r
2481 * @param[in] normalize normalizing factor.
\r
2482 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
\r
2485 arm_status arm_dct4_init_q15(
\r
2486 arm_dct4_instance_q15 * S,
\r
2487 arm_rfft_instance_q15 * S_RFFT,
\r
2488 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2494 * @brief Processing function for the Q15 DCT4/IDCT4.
\r
2495 * @param[in] *S points to an instance of the Q15 DCT4 structure.
\r
2496 * @param[in] *pState points to state buffer.
\r
2497 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2501 void arm_dct4_q15(
\r
2502 const arm_dct4_instance_q15 * S,
\r
2504 q15_t * pInlineBuffer);
\r
2507 * @brief Floating-point vector addition.
\r
2508 * @param[in] *pSrcA points to the first input vector
\r
2509 * @param[in] *pSrcB points to the second input vector
\r
2510 * @param[out] *pDst points to the output vector
\r
2511 * @param[in] blockSize number of samples in each vector
\r
2516 float32_t * pSrcA,
\r
2517 float32_t * pSrcB,
\r
2519 uint32_t blockSize);
\r
2522 * @brief Q7 vector addition.
\r
2523 * @param[in] *pSrcA points to the first input vector
\r
2524 * @param[in] *pSrcB points to the second input vector
\r
2525 * @param[out] *pDst points to the output vector
\r
2526 * @param[in] blockSize number of samples in each vector
\r
2534 uint32_t blockSize);
\r
2537 * @brief Q15 vector addition.
\r
2538 * @param[in] *pSrcA points to the first input vector
\r
2539 * @param[in] *pSrcB points to the second input vector
\r
2540 * @param[out] *pDst points to the output vector
\r
2541 * @param[in] blockSize number of samples in each vector
\r
2549 uint32_t blockSize);
\r
2552 * @brief Q31 vector addition.
\r
2553 * @param[in] *pSrcA points to the first input vector
\r
2554 * @param[in] *pSrcB points to the second input vector
\r
2555 * @param[out] *pDst points to the output vector
\r
2556 * @param[in] blockSize number of samples in each vector
\r
2564 uint32_t blockSize);
\r
2567 * @brief Floating-point vector subtraction.
\r
2568 * @param[in] *pSrcA points to the first input vector
\r
2569 * @param[in] *pSrcB points to the second input vector
\r
2570 * @param[out] *pDst points to the output vector
\r
2571 * @param[in] blockSize number of samples in each vector
\r
2576 float32_t * pSrcA,
\r
2577 float32_t * pSrcB,
\r
2579 uint32_t blockSize);
\r
2582 * @brief Q7 vector subtraction.
\r
2583 * @param[in] *pSrcA points to the first input vector
\r
2584 * @param[in] *pSrcB points to the second input vector
\r
2585 * @param[out] *pDst points to the output vector
\r
2586 * @param[in] blockSize number of samples in each vector
\r
2594 uint32_t blockSize);
\r
2597 * @brief Q15 vector subtraction.
\r
2598 * @param[in] *pSrcA points to the first input vector
\r
2599 * @param[in] *pSrcB points to the second input vector
\r
2600 * @param[out] *pDst points to the output vector
\r
2601 * @param[in] blockSize number of samples in each vector
\r
2609 uint32_t blockSize);
\r
2612 * @brief Q31 vector subtraction.
\r
2613 * @param[in] *pSrcA points to the first input vector
\r
2614 * @param[in] *pSrcB points to the second input vector
\r
2615 * @param[out] *pDst points to the output vector
\r
2616 * @param[in] blockSize number of samples in each vector
\r
2624 uint32_t blockSize);
\r
2627 * @brief Multiplies a floating-point vector by a scalar.
\r
2628 * @param[in] *pSrc points to the input vector
\r
2629 * @param[in] scale scale factor to be applied
\r
2630 * @param[out] *pDst points to the output vector
\r
2631 * @param[in] blockSize number of samples in the vector
\r
2635 void arm_scale_f32(
\r
2639 uint32_t blockSize);
\r
2642 * @brief Multiplies a Q7 vector by a scalar.
\r
2643 * @param[in] *pSrc points to the input vector
\r
2644 * @param[in] scaleFract fractional portion of the scale value
\r
2645 * @param[in] shift number of bits to shift the result by
\r
2646 * @param[out] *pDst points to the output vector
\r
2647 * @param[in] blockSize number of samples in the vector
\r
2651 void arm_scale_q7(
\r
2656 uint32_t blockSize);
\r
2659 * @brief Multiplies a Q15 vector by a scalar.
\r
2660 * @param[in] *pSrc points to the input vector
\r
2661 * @param[in] scaleFract fractional portion of the scale value
\r
2662 * @param[in] shift number of bits to shift the result by
\r
2663 * @param[out] *pDst points to the output vector
\r
2664 * @param[in] blockSize number of samples in the vector
\r
2668 void arm_scale_q15(
\r
2673 uint32_t blockSize);
\r
2676 * @brief Multiplies a Q31 vector by a scalar.
\r
2677 * @param[in] *pSrc points to the input vector
\r
2678 * @param[in] scaleFract fractional portion of the scale value
\r
2679 * @param[in] shift number of bits to shift the result by
\r
2680 * @param[out] *pDst points to the output vector
\r
2681 * @param[in] blockSize number of samples in the vector
\r
2685 void arm_scale_q31(
\r
2690 uint32_t blockSize);
\r
2693 * @brief Q7 vector absolute value.
\r
2694 * @param[in] *pSrc points to the input buffer
\r
2695 * @param[out] *pDst points to the output buffer
\r
2696 * @param[in] blockSize number of samples in each vector
\r
2703 uint32_t blockSize);
\r
2706 * @brief Floating-point vector absolute value.
\r
2707 * @param[in] *pSrc points to the input buffer
\r
2708 * @param[out] *pDst points to the output buffer
\r
2709 * @param[in] blockSize number of samples in each vector
\r
2716 uint32_t blockSize);
\r
2719 * @brief Q15 vector absolute value.
\r
2720 * @param[in] *pSrc points to the input buffer
\r
2721 * @param[out] *pDst points to the output buffer
\r
2722 * @param[in] blockSize number of samples in each vector
\r
2729 uint32_t blockSize);
\r
2732 * @brief Q31 vector absolute value.
\r
2733 * @param[in] *pSrc points to the input buffer
\r
2734 * @param[out] *pDst points to the output buffer
\r
2735 * @param[in] blockSize number of samples in each vector
\r
2742 uint32_t blockSize);
\r
2745 * @brief Dot product of floating-point vectors.
\r
2746 * @param[in] *pSrcA points to the first input vector
\r
2747 * @param[in] *pSrcB points to the second input vector
\r
2748 * @param[in] blockSize number of samples in each vector
\r
2749 * @param[out] *result output result returned here
\r
2753 void arm_dot_prod_f32(
\r
2754 float32_t * pSrcA,
\r
2755 float32_t * pSrcB,
\r
2756 uint32_t blockSize,
\r
2757 float32_t * result);
\r
2760 * @brief Dot product of Q7 vectors.
\r
2761 * @param[in] *pSrcA points to the first input vector
\r
2762 * @param[in] *pSrcB points to the second input vector
\r
2763 * @param[in] blockSize number of samples in each vector
\r
2764 * @param[out] *result output result returned here
\r
2768 void arm_dot_prod_q7(
\r
2771 uint32_t blockSize,
\r
2775 * @brief Dot product of Q15 vectors.
\r
2776 * @param[in] *pSrcA points to the first input vector
\r
2777 * @param[in] *pSrcB points to the second input vector
\r
2778 * @param[in] blockSize number of samples in each vector
\r
2779 * @param[out] *result output result returned here
\r
2783 void arm_dot_prod_q15(
\r
2786 uint32_t blockSize,
\r
2790 * @brief Dot product of Q31 vectors.
\r
2791 * @param[in] *pSrcA points to the first input vector
\r
2792 * @param[in] *pSrcB points to the second input vector
\r
2793 * @param[in] blockSize number of samples in each vector
\r
2794 * @param[out] *result output result returned here
\r
2798 void arm_dot_prod_q31(
\r
2801 uint32_t blockSize,
\r
2805 * @brief Shifts the elements of a Q7 vector a specified number of bits.
\r
2806 * @param[in] *pSrc points to the input vector
\r
2807 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2808 * @param[out] *pDst points to the output vector
\r
2809 * @param[in] blockSize number of samples in the vector
\r
2813 void arm_shift_q7(
\r
2817 uint32_t blockSize);
\r
2820 * @brief Shifts the elements of a Q15 vector a specified number of bits.
\r
2821 * @param[in] *pSrc points to the input vector
\r
2822 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2823 * @param[out] *pDst points to the output vector
\r
2824 * @param[in] blockSize number of samples in the vector
\r
2828 void arm_shift_q15(
\r
2832 uint32_t blockSize);
\r
2835 * @brief Shifts the elements of a Q31 vector a specified number of bits.
\r
2836 * @param[in] *pSrc points to the input vector
\r
2837 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2838 * @param[out] *pDst points to the output vector
\r
2839 * @param[in] blockSize number of samples in the vector
\r
2843 void arm_shift_q31(
\r
2847 uint32_t blockSize);
\r
2850 * @brief Adds a constant offset to a floating-point vector.
\r
2851 * @param[in] *pSrc points to the input vector
\r
2852 * @param[in] offset is the offset to be added
\r
2853 * @param[out] *pDst points to the output vector
\r
2854 * @param[in] blockSize number of samples in the vector
\r
2858 void arm_offset_f32(
\r
2862 uint32_t blockSize);
\r
2865 * @brief Adds a constant offset to a Q7 vector.
\r
2866 * @param[in] *pSrc points to the input vector
\r
2867 * @param[in] offset is the offset to be added
\r
2868 * @param[out] *pDst points to the output vector
\r
2869 * @param[in] blockSize number of samples in the vector
\r
2873 void arm_offset_q7(
\r
2877 uint32_t blockSize);
\r
2880 * @brief Adds a constant offset to a Q15 vector.
\r
2881 * @param[in] *pSrc points to the input vector
\r
2882 * @param[in] offset is the offset to be added
\r
2883 * @param[out] *pDst points to the output vector
\r
2884 * @param[in] blockSize number of samples in the vector
\r
2888 void arm_offset_q15(
\r
2892 uint32_t blockSize);
\r
2895 * @brief Adds a constant offset to a Q31 vector.
\r
2896 * @param[in] *pSrc points to the input vector
\r
2897 * @param[in] offset is the offset to be added
\r
2898 * @param[out] *pDst points to the output vector
\r
2899 * @param[in] blockSize number of samples in the vector
\r
2903 void arm_offset_q31(
\r
2907 uint32_t blockSize);
\r
2910 * @brief Negates the elements of a floating-point vector.
\r
2911 * @param[in] *pSrc points to the input vector
\r
2912 * @param[out] *pDst points to the output vector
\r
2913 * @param[in] blockSize number of samples in the vector
\r
2917 void arm_negate_f32(
\r
2920 uint32_t blockSize);
\r
2923 * @brief Negates the elements of a Q7 vector.
\r
2924 * @param[in] *pSrc points to the input vector
\r
2925 * @param[out] *pDst points to the output vector
\r
2926 * @param[in] blockSize number of samples in the vector
\r
2930 void arm_negate_q7(
\r
2933 uint32_t blockSize);
\r
2936 * @brief Negates the elements of a Q15 vector.
\r
2937 * @param[in] *pSrc points to the input vector
\r
2938 * @param[out] *pDst points to the output vector
\r
2939 * @param[in] blockSize number of samples in the vector
\r
2943 void arm_negate_q15(
\r
2946 uint32_t blockSize);
\r
2949 * @brief Negates the elements of a Q31 vector.
\r
2950 * @param[in] *pSrc points to the input vector
\r
2951 * @param[out] *pDst points to the output vector
\r
2952 * @param[in] blockSize number of samples in the vector
\r
2956 void arm_negate_q31(
\r
2959 uint32_t blockSize);
\r
2961 * @brief Copies the elements of a floating-point vector.
\r
2962 * @param[in] *pSrc input pointer
\r
2963 * @param[out] *pDst output pointer
\r
2964 * @param[in] blockSize number of samples to process
\r
2967 void arm_copy_f32(
\r
2970 uint32_t blockSize);
\r
2973 * @brief Copies the elements of a Q7 vector.
\r
2974 * @param[in] *pSrc input pointer
\r
2975 * @param[out] *pDst output pointer
\r
2976 * @param[in] blockSize number of samples to process
\r
2982 uint32_t blockSize);
\r
2985 * @brief Copies the elements of a Q15 vector.
\r
2986 * @param[in] *pSrc input pointer
\r
2987 * @param[out] *pDst output pointer
\r
2988 * @param[in] blockSize number of samples to process
\r
2991 void arm_copy_q15(
\r
2994 uint32_t blockSize);
\r
2997 * @brief Copies the elements of a Q31 vector.
\r
2998 * @param[in] *pSrc input pointer
\r
2999 * @param[out] *pDst output pointer
\r
3000 * @param[in] blockSize number of samples to process
\r
3003 void arm_copy_q31(
\r
3006 uint32_t blockSize);
\r
3008 * @brief Fills a constant value into a floating-point vector.
\r
3009 * @param[in] value input value to be filled
\r
3010 * @param[out] *pDst output pointer
\r
3011 * @param[in] blockSize number of samples to process
\r
3014 void arm_fill_f32(
\r
3017 uint32_t blockSize);
\r
3020 * @brief Fills a constant value into a Q7 vector.
\r
3021 * @param[in] value input value to be filled
\r
3022 * @param[out] *pDst output pointer
\r
3023 * @param[in] blockSize number of samples to process
\r
3029 uint32_t blockSize);
\r
3032 * @brief Fills a constant value into a Q15 vector.
\r
3033 * @param[in] value input value to be filled
\r
3034 * @param[out] *pDst output pointer
\r
3035 * @param[in] blockSize number of samples to process
\r
3038 void arm_fill_q15(
\r
3041 uint32_t blockSize);
\r
3044 * @brief Fills a constant value into a Q31 vector.
\r
3045 * @param[in] value input value to be filled
\r
3046 * @param[out] *pDst output pointer
\r
3047 * @param[in] blockSize number of samples to process
\r
3050 void arm_fill_q31(
\r
3053 uint32_t blockSize);
\r
3056 * @brief Convolution of floating-point sequences.
\r
3057 * @param[in] *pSrcA points to the first input sequence.
\r
3058 * @param[in] srcALen length of the first input sequence.
\r
3059 * @param[in] *pSrcB points to the second input sequence.
\r
3060 * @param[in] srcBLen length of the second input sequence.
\r
3061 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3065 void arm_conv_f32(
\r
3066 float32_t * pSrcA,
\r
3068 float32_t * pSrcB,
\r
3070 float32_t * pDst);
\r
3074 * @brief Convolution of Q15 sequences.
\r
3075 * @param[in] *pSrcA points to the first input sequence.
\r
3076 * @param[in] srcALen length of the first input sequence.
\r
3077 * @param[in] *pSrcB points to the second input sequence.
\r
3078 * @param[in] srcBLen length of the second input sequence.
\r
3079 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3080 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3081 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3086 void arm_conv_opt_q15(
\r
3092 q15_t * pScratch1,
\r
3093 q15_t * pScratch2);
\r
3097 * @brief Convolution of Q15 sequences.
\r
3098 * @param[in] *pSrcA points to the first input sequence.
\r
3099 * @param[in] srcALen length of the first input sequence.
\r
3100 * @param[in] *pSrcB points to the second input sequence.
\r
3101 * @param[in] srcBLen length of the second input sequence.
\r
3102 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3106 void arm_conv_q15(
\r
3114 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3115 * @param[in] *pSrcA points to the first input sequence.
\r
3116 * @param[in] srcALen length of the first input sequence.
\r
3117 * @param[in] *pSrcB points to the second input sequence.
\r
3118 * @param[in] srcBLen length of the second input sequence.
\r
3119 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3123 void arm_conv_fast_q15(
\r
3131 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3132 * @param[in] *pSrcA points to the first input sequence.
\r
3133 * @param[in] srcALen length of the first input sequence.
\r
3134 * @param[in] *pSrcB points to the second input sequence.
\r
3135 * @param[in] srcBLen length of the second input sequence.
\r
3136 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3137 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3138 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3142 void arm_conv_fast_opt_q15(
\r
3148 q15_t * pScratch1,
\r
3149 q15_t * pScratch2);
\r
3154 * @brief Convolution of Q31 sequences.
\r
3155 * @param[in] *pSrcA points to the first input sequence.
\r
3156 * @param[in] srcALen length of the first input sequence.
\r
3157 * @param[in] *pSrcB points to the second input sequence.
\r
3158 * @param[in] srcBLen length of the second input sequence.
\r
3159 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3163 void arm_conv_q31(
\r
3171 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3172 * @param[in] *pSrcA points to the first input sequence.
\r
3173 * @param[in] srcALen length of the first input sequence.
\r
3174 * @param[in] *pSrcB points to the second input sequence.
\r
3175 * @param[in] srcBLen length of the second input sequence.
\r
3176 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3180 void arm_conv_fast_q31(
\r
3189 * @brief Convolution of Q7 sequences.
\r
3190 * @param[in] *pSrcA points to the first input sequence.
\r
3191 * @param[in] srcALen length of the first input sequence.
\r
3192 * @param[in] *pSrcB points to the second input sequence.
\r
3193 * @param[in] srcBLen length of the second input sequence.
\r
3194 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3195 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3196 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3200 void arm_conv_opt_q7(
\r
3206 q15_t * pScratch1,
\r
3207 q15_t * pScratch2);
\r
3212 * @brief Convolution of Q7 sequences.
\r
3213 * @param[in] *pSrcA points to the first input sequence.
\r
3214 * @param[in] srcALen length of the first input sequence.
\r
3215 * @param[in] *pSrcB points to the second input sequence.
\r
3216 * @param[in] srcBLen length of the second input sequence.
\r
3217 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3230 * @brief Partial convolution of floating-point sequences.
\r
3231 * @param[in] *pSrcA points to the first input sequence.
\r
3232 * @param[in] srcALen length of the first input sequence.
\r
3233 * @param[in] *pSrcB points to the second input sequence.
\r
3234 * @param[in] srcBLen length of the second input sequence.
\r
3235 * @param[out] *pDst points to the block of output data
\r
3236 * @param[in] firstIndex is the first output sample to start with.
\r
3237 * @param[in] numPoints is the number of output points to be computed.
\r
3238 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3241 arm_status arm_conv_partial_f32(
\r
3242 float32_t * pSrcA,
\r
3244 float32_t * pSrcB,
\r
3247 uint32_t firstIndex,
\r
3248 uint32_t numPoints);
\r
3251 * @brief Partial convolution of Q15 sequences.
\r
3252 * @param[in] *pSrcA points to the first input sequence.
\r
3253 * @param[in] srcALen length of the first input sequence.
\r
3254 * @param[in] *pSrcB points to the second input sequence.
\r
3255 * @param[in] srcBLen length of the second input sequence.
\r
3256 * @param[out] *pDst points to the block of output data
\r
3257 * @param[in] firstIndex is the first output sample to start with.
\r
3258 * @param[in] numPoints is the number of output points to be computed.
\r
3259 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3260 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3261 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3264 arm_status arm_conv_partial_opt_q15(
\r
3270 uint32_t firstIndex,
\r
3271 uint32_t numPoints,
\r
3272 q15_t * pScratch1,
\r
3273 q15_t * pScratch2);
\r
3277 * @brief Partial convolution of Q15 sequences.
\r
3278 * @param[in] *pSrcA points to the first input sequence.
\r
3279 * @param[in] srcALen length of the first input sequence.
\r
3280 * @param[in] *pSrcB points to the second input sequence.
\r
3281 * @param[in] srcBLen length of the second input sequence.
\r
3282 * @param[out] *pDst points to the block of output data
\r
3283 * @param[in] firstIndex is the first output sample to start with.
\r
3284 * @param[in] numPoints is the number of output points to be computed.
\r
3285 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3288 arm_status arm_conv_partial_q15(
\r
3294 uint32_t firstIndex,
\r
3295 uint32_t numPoints);
\r
3298 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3299 * @param[in] *pSrcA points to the first input sequence.
\r
3300 * @param[in] srcALen length of the first input sequence.
\r
3301 * @param[in] *pSrcB points to the second input sequence.
\r
3302 * @param[in] srcBLen length of the second input sequence.
\r
3303 * @param[out] *pDst points to the block of output data
\r
3304 * @param[in] firstIndex is the first output sample to start with.
\r
3305 * @param[in] numPoints is the number of output points to be computed.
\r
3306 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3309 arm_status arm_conv_partial_fast_q15(
\r
3315 uint32_t firstIndex,
\r
3316 uint32_t numPoints);
\r
3320 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3321 * @param[in] *pSrcA points to the first input sequence.
\r
3322 * @param[in] srcALen length of the first input sequence.
\r
3323 * @param[in] *pSrcB points to the second input sequence.
\r
3324 * @param[in] srcBLen length of the second input sequence.
\r
3325 * @param[out] *pDst points to the block of output data
\r
3326 * @param[in] firstIndex is the first output sample to start with.
\r
3327 * @param[in] numPoints is the number of output points to be computed.
\r
3328 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3329 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3330 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3333 arm_status arm_conv_partial_fast_opt_q15(
\r
3339 uint32_t firstIndex,
\r
3340 uint32_t numPoints,
\r
3341 q15_t * pScratch1,
\r
3342 q15_t * pScratch2);
\r
3346 * @brief Partial convolution of Q31 sequences.
\r
3347 * @param[in] *pSrcA points to the first input sequence.
\r
3348 * @param[in] srcALen length of the first input sequence.
\r
3349 * @param[in] *pSrcB points to the second input sequence.
\r
3350 * @param[in] srcBLen length of the second input sequence.
\r
3351 * @param[out] *pDst points to the block of output data
\r
3352 * @param[in] firstIndex is the first output sample to start with.
\r
3353 * @param[in] numPoints is the number of output points to be computed.
\r
3354 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3357 arm_status arm_conv_partial_q31(
\r
3363 uint32_t firstIndex,
\r
3364 uint32_t numPoints);
\r
3368 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3369 * @param[in] *pSrcA points to the first input sequence.
\r
3370 * @param[in] srcALen length of the first input sequence.
\r
3371 * @param[in] *pSrcB points to the second input sequence.
\r
3372 * @param[in] srcBLen length of the second input sequence.
\r
3373 * @param[out] *pDst points to the block of output data
\r
3374 * @param[in] firstIndex is the first output sample to start with.
\r
3375 * @param[in] numPoints is the number of output points to be computed.
\r
3376 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3379 arm_status arm_conv_partial_fast_q31(
\r
3385 uint32_t firstIndex,
\r
3386 uint32_t numPoints);
\r
3390 * @brief Partial convolution of Q7 sequences
\r
3391 * @param[in] *pSrcA points to the first input sequence.
\r
3392 * @param[in] srcALen length of the first input sequence.
\r
3393 * @param[in] *pSrcB points to the second input sequence.
\r
3394 * @param[in] srcBLen length of the second input sequence.
\r
3395 * @param[out] *pDst points to the block of output data
\r
3396 * @param[in] firstIndex is the first output sample to start with.
\r
3397 * @param[in] numPoints is the number of output points to be computed.
\r
3398 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3399 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3400 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3403 arm_status arm_conv_partial_opt_q7(
\r
3409 uint32_t firstIndex,
\r
3410 uint32_t numPoints,
\r
3411 q15_t * pScratch1,
\r
3412 q15_t * pScratch2);
\r
3416 * @brief Partial convolution of Q7 sequences.
\r
3417 * @param[in] *pSrcA points to the first input sequence.
\r
3418 * @param[in] srcALen length of the first input sequence.
\r
3419 * @param[in] *pSrcB points to the second input sequence.
\r
3420 * @param[in] srcBLen length of the second input sequence.
\r
3421 * @param[out] *pDst points to the block of output data
\r
3422 * @param[in] firstIndex is the first output sample to start with.
\r
3423 * @param[in] numPoints is the number of output points to be computed.
\r
3424 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3427 arm_status arm_conv_partial_q7(
\r
3433 uint32_t firstIndex,
\r
3434 uint32_t numPoints);
\r
3439 * @brief Instance structure for the Q15 FIR decimator.
\r
3444 uint8_t M; /**< decimation factor. */
\r
3445 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3446 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3447 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3448 } arm_fir_decimate_instance_q15;
\r
3451 * @brief Instance structure for the Q31 FIR decimator.
\r
3456 uint8_t M; /**< decimation factor. */
\r
3457 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3458 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3459 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3461 } arm_fir_decimate_instance_q31;
\r
3464 * @brief Instance structure for the floating-point FIR decimator.
\r
3469 uint8_t M; /**< decimation factor. */
\r
3470 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3471 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3472 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3474 } arm_fir_decimate_instance_f32;
\r
3479 * @brief Processing function for the floating-point FIR decimator.
\r
3480 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
\r
3481 * @param[in] *pSrc points to the block of input data.
\r
3482 * @param[out] *pDst points to the block of output data
\r
3483 * @param[in] blockSize number of input samples to process per call.
\r
3487 void arm_fir_decimate_f32(
\r
3488 const arm_fir_decimate_instance_f32 * S,
\r
3491 uint32_t blockSize);
\r
3495 * @brief Initialization function for the floating-point FIR decimator.
\r
3496 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
\r
3497 * @param[in] numTaps number of coefficients in the filter.
\r
3498 * @param[in] M decimation factor.
\r
3499 * @param[in] *pCoeffs points to the filter coefficients.
\r
3500 * @param[in] *pState points to the state buffer.
\r
3501 * @param[in] blockSize number of input samples to process per call.
\r
3502 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3503 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3506 arm_status arm_fir_decimate_init_f32(
\r
3507 arm_fir_decimate_instance_f32 * S,
\r
3510 float32_t * pCoeffs,
\r
3511 float32_t * pState,
\r
3512 uint32_t blockSize);
\r
3515 * @brief Processing function for the Q15 FIR decimator.
\r
3516 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3517 * @param[in] *pSrc points to the block of input data.
\r
3518 * @param[out] *pDst points to the block of output data
\r
3519 * @param[in] blockSize number of input samples to process per call.
\r
3523 void arm_fir_decimate_q15(
\r
3524 const arm_fir_decimate_instance_q15 * S,
\r
3527 uint32_t blockSize);
\r
3530 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3531 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3532 * @param[in] *pSrc points to the block of input data.
\r
3533 * @param[out] *pDst points to the block of output data
\r
3534 * @param[in] blockSize number of input samples to process per call.
\r
3538 void arm_fir_decimate_fast_q15(
\r
3539 const arm_fir_decimate_instance_q15 * S,
\r
3542 uint32_t blockSize);
\r
3547 * @brief Initialization function for the Q15 FIR decimator.
\r
3548 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
\r
3549 * @param[in] numTaps number of coefficients in the filter.
\r
3550 * @param[in] M decimation factor.
\r
3551 * @param[in] *pCoeffs points to the filter coefficients.
\r
3552 * @param[in] *pState points to the state buffer.
\r
3553 * @param[in] blockSize number of input samples to process per call.
\r
3554 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3555 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3558 arm_status arm_fir_decimate_init_q15(
\r
3559 arm_fir_decimate_instance_q15 * S,
\r
3564 uint32_t blockSize);
\r
3567 * @brief Processing function for the Q31 FIR decimator.
\r
3568 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3569 * @param[in] *pSrc points to the block of input data.
\r
3570 * @param[out] *pDst points to the block of output data
\r
3571 * @param[in] blockSize number of input samples to process per call.
\r
3575 void arm_fir_decimate_q31(
\r
3576 const arm_fir_decimate_instance_q31 * S,
\r
3579 uint32_t blockSize);
\r
3582 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3583 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3584 * @param[in] *pSrc points to the block of input data.
\r
3585 * @param[out] *pDst points to the block of output data
\r
3586 * @param[in] blockSize number of input samples to process per call.
\r
3590 void arm_fir_decimate_fast_q31(
\r
3591 arm_fir_decimate_instance_q31 * S,
\r
3594 uint32_t blockSize);
\r
3598 * @brief Initialization function for the Q31 FIR decimator.
\r
3599 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
\r
3600 * @param[in] numTaps number of coefficients in the filter.
\r
3601 * @param[in] M decimation factor.
\r
3602 * @param[in] *pCoeffs points to the filter coefficients.
\r
3603 * @param[in] *pState points to the state buffer.
\r
3604 * @param[in] blockSize number of input samples to process per call.
\r
3605 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3606 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3609 arm_status arm_fir_decimate_init_q31(
\r
3610 arm_fir_decimate_instance_q31 * S,
\r
3615 uint32_t blockSize);
\r
3620 * @brief Instance structure for the Q15 FIR interpolator.
\r
3625 uint8_t L; /**< upsample factor. */
\r
3626 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3627 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3628 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3629 } arm_fir_interpolate_instance_q15;
\r
3632 * @brief Instance structure for the Q31 FIR interpolator.
\r
3637 uint8_t L; /**< upsample factor. */
\r
3638 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3639 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3640 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3641 } arm_fir_interpolate_instance_q31;
\r
3644 * @brief Instance structure for the floating-point FIR interpolator.
\r
3649 uint8_t L; /**< upsample factor. */
\r
3650 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3651 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3652 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
\r
3653 } arm_fir_interpolate_instance_f32;
\r
3657 * @brief Processing function for the Q15 FIR interpolator.
\r
3658 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3659 * @param[in] *pSrc points to the block of input data.
\r
3660 * @param[out] *pDst points to the block of output data.
\r
3661 * @param[in] blockSize number of input samples to process per call.
\r
3665 void arm_fir_interpolate_q15(
\r
3666 const arm_fir_interpolate_instance_q15 * S,
\r
3669 uint32_t blockSize);
\r
3673 * @brief Initialization function for the Q15 FIR interpolator.
\r
3674 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
\r
3675 * @param[in] L upsample factor.
\r
3676 * @param[in] numTaps number of filter coefficients in the filter.
\r
3677 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3678 * @param[in] *pState points to the state buffer.
\r
3679 * @param[in] blockSize number of input samples to process per call.
\r
3680 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3681 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3684 arm_status arm_fir_interpolate_init_q15(
\r
3685 arm_fir_interpolate_instance_q15 * S,
\r
3690 uint32_t blockSize);
\r
3693 * @brief Processing function for the Q31 FIR interpolator.
\r
3694 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3695 * @param[in] *pSrc points to the block of input data.
\r
3696 * @param[out] *pDst points to the block of output data.
\r
3697 * @param[in] blockSize number of input samples to process per call.
\r
3701 void arm_fir_interpolate_q31(
\r
3702 const arm_fir_interpolate_instance_q31 * S,
\r
3705 uint32_t blockSize);
\r
3708 * @brief Initialization function for the Q31 FIR interpolator.
\r
3709 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
\r
3710 * @param[in] L upsample factor.
\r
3711 * @param[in] numTaps number of filter coefficients in the filter.
\r
3712 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3713 * @param[in] *pState points to the state buffer.
\r
3714 * @param[in] blockSize number of input samples to process per call.
\r
3715 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3716 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3719 arm_status arm_fir_interpolate_init_q31(
\r
3720 arm_fir_interpolate_instance_q31 * S,
\r
3725 uint32_t blockSize);
\r
3729 * @brief Processing function for the floating-point FIR interpolator.
\r
3730 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
\r
3731 * @param[in] *pSrc points to the block of input data.
\r
3732 * @param[out] *pDst points to the block of output data.
\r
3733 * @param[in] blockSize number of input samples to process per call.
\r
3737 void arm_fir_interpolate_f32(
\r
3738 const arm_fir_interpolate_instance_f32 * S,
\r
3741 uint32_t blockSize);
\r
3744 * @brief Initialization function for the floating-point FIR interpolator.
\r
3745 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
\r
3746 * @param[in] L upsample factor.
\r
3747 * @param[in] numTaps number of filter coefficients in the filter.
\r
3748 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3749 * @param[in] *pState points to the state buffer.
\r
3750 * @param[in] blockSize number of input samples to process per call.
\r
3751 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3752 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3755 arm_status arm_fir_interpolate_init_f32(
\r
3756 arm_fir_interpolate_instance_f32 * S,
\r
3759 float32_t * pCoeffs,
\r
3760 float32_t * pState,
\r
3761 uint32_t blockSize);
\r
3764 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
\r
3769 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3770 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3771 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3772 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
\r
3774 } arm_biquad_cas_df1_32x64_ins_q31;
\r
3778 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3779 * @param[in] *pSrc points to the block of input data.
\r
3780 * @param[out] *pDst points to the block of output data
\r
3781 * @param[in] blockSize number of samples to process.
\r
3785 void arm_biquad_cas_df1_32x64_q31(
\r
3786 const arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3789 uint32_t blockSize);
\r
3793 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3794 * @param[in] numStages number of 2nd order stages in the filter.
\r
3795 * @param[in] *pCoeffs points to the filter coefficients.
\r
3796 * @param[in] *pState points to the state buffer.
\r
3797 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
\r
3801 void arm_biquad_cas_df1_32x64_init_q31(
\r
3802 arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3803 uint8_t numStages,
\r
3806 uint8_t postShift);
\r
3811 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3816 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3817 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3818 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3819 } arm_biquad_cascade_df2T_instance_f32;
\r
3824 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3829 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3830 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3831 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3832 } arm_biquad_cascade_stereo_df2T_instance_f32;
\r
3837 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3842 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3843 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3844 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3845 } arm_biquad_cascade_df2T_instance_f64;
\r
3849 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3850 * @param[in] *S points to an instance of the filter data structure.
\r
3851 * @param[in] *pSrc points to the block of input data.
\r
3852 * @param[out] *pDst points to the block of output data
\r
3853 * @param[in] blockSize number of samples to process.
\r
3857 void arm_biquad_cascade_df2T_f32(
\r
3858 const arm_biquad_cascade_df2T_instance_f32 * S,
\r
3861 uint32_t blockSize);
\r
3865 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
\r
3866 * @param[in] *S points to an instance of the filter data structure.
\r
3867 * @param[in] *pSrc points to the block of input data.
\r
3868 * @param[out] *pDst points to the block of output data
\r
3869 * @param[in] blockSize number of samples to process.
\r
3873 void arm_biquad_cascade_stereo_df2T_f32(
\r
3874 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3877 uint32_t blockSize);
\r
3880 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3881 * @param[in] *S points to an instance of the filter data structure.
\r
3882 * @param[in] *pSrc points to the block of input data.
\r
3883 * @param[out] *pDst points to the block of output data
\r
3884 * @param[in] blockSize number of samples to process.
\r
3888 void arm_biquad_cascade_df2T_f64(
\r
3889 const arm_biquad_cascade_df2T_instance_f64 * S,
\r
3892 uint32_t blockSize);
\r
3896 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3897 * @param[in,out] *S points to an instance of the filter data structure.
\r
3898 * @param[in] numStages number of 2nd order stages in the filter.
\r
3899 * @param[in] *pCoeffs points to the filter coefficients.
\r
3900 * @param[in] *pState points to the state buffer.
\r
3904 void arm_biquad_cascade_df2T_init_f32(
\r
3905 arm_biquad_cascade_df2T_instance_f32 * S,
\r
3906 uint8_t numStages,
\r
3907 float32_t * pCoeffs,
\r
3908 float32_t * pState);
\r
3912 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3913 * @param[in,out] *S points to an instance of the filter data structure.
\r
3914 * @param[in] numStages number of 2nd order stages in the filter.
\r
3915 * @param[in] *pCoeffs points to the filter coefficients.
\r
3916 * @param[in] *pState points to the state buffer.
\r
3920 void arm_biquad_cascade_stereo_df2T_init_f32(
\r
3921 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3922 uint8_t numStages,
\r
3923 float32_t * pCoeffs,
\r
3924 float32_t * pState);
\r
3928 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3929 * @param[in,out] *S points to an instance of the filter data structure.
\r
3930 * @param[in] numStages number of 2nd order stages in the filter.
\r
3931 * @param[in] *pCoeffs points to the filter coefficients.
\r
3932 * @param[in] *pState points to the state buffer.
\r
3936 void arm_biquad_cascade_df2T_init_f64(
\r
3937 arm_biquad_cascade_df2T_instance_f64 * S,
\r
3938 uint8_t numStages,
\r
3939 float64_t * pCoeffs,
\r
3940 float64_t * pState);
\r
3945 * @brief Instance structure for the Q15 FIR lattice filter.
\r
3950 uint16_t numStages; /**< number of filter stages. */
\r
3951 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3952 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3953 } arm_fir_lattice_instance_q15;
\r
3956 * @brief Instance structure for the Q31 FIR lattice filter.
\r
3961 uint16_t numStages; /**< number of filter stages. */
\r
3962 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3963 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3964 } arm_fir_lattice_instance_q31;
\r
3967 * @brief Instance structure for the floating-point FIR lattice filter.
\r
3972 uint16_t numStages; /**< number of filter stages. */
\r
3973 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3974 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3975 } arm_fir_lattice_instance_f32;
\r
3978 * @brief Initialization function for the Q15 FIR lattice filter.
\r
3979 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3980 * @param[in] numStages number of filter stages.
\r
3981 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3982 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
3986 void arm_fir_lattice_init_q15(
\r
3987 arm_fir_lattice_instance_q15 * S,
\r
3988 uint16_t numStages,
\r
3994 * @brief Processing function for the Q15 FIR lattice filter.
\r
3995 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3996 * @param[in] *pSrc points to the block of input data.
\r
3997 * @param[out] *pDst points to the block of output data.
\r
3998 * @param[in] blockSize number of samples to process.
\r
4001 void arm_fir_lattice_q15(
\r
4002 const arm_fir_lattice_instance_q15 * S,
\r
4005 uint32_t blockSize);
\r
4008 * @brief Initialization function for the Q31 FIR lattice filter.
\r
4009 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
4010 * @param[in] numStages number of filter stages.
\r
4011 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
4012 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
4016 void arm_fir_lattice_init_q31(
\r
4017 arm_fir_lattice_instance_q31 * S,
\r
4018 uint16_t numStages,
\r
4024 * @brief Processing function for the Q31 FIR lattice filter.
\r
4025 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
4026 * @param[in] *pSrc points to the block of input data.
\r
4027 * @param[out] *pDst points to the block of output data
\r
4028 * @param[in] blockSize number of samples to process.
\r
4032 void arm_fir_lattice_q31(
\r
4033 const arm_fir_lattice_instance_q31 * S,
\r
4036 uint32_t blockSize);
\r
4039 * @brief Initialization function for the floating-point FIR lattice filter.
\r
4040 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
4041 * @param[in] numStages number of filter stages.
\r
4042 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
4043 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
4047 void arm_fir_lattice_init_f32(
\r
4048 arm_fir_lattice_instance_f32 * S,
\r
4049 uint16_t numStages,
\r
4050 float32_t * pCoeffs,
\r
4051 float32_t * pState);
\r
4054 * @brief Processing function for the floating-point FIR lattice filter.
\r
4055 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
4056 * @param[in] *pSrc points to the block of input data.
\r
4057 * @param[out] *pDst points to the block of output data
\r
4058 * @param[in] blockSize number of samples to process.
\r
4062 void arm_fir_lattice_f32(
\r
4063 const arm_fir_lattice_instance_f32 * S,
\r
4066 uint32_t blockSize);
\r
4069 * @brief Instance structure for the Q15 IIR lattice filter.
\r
4073 uint16_t numStages; /**< number of stages in the filter. */
\r
4074 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4075 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4076 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4077 } arm_iir_lattice_instance_q15;
\r
4080 * @brief Instance structure for the Q31 IIR lattice filter.
\r
4084 uint16_t numStages; /**< number of stages in the filter. */
\r
4085 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4086 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4087 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4088 } arm_iir_lattice_instance_q31;
\r
4091 * @brief Instance structure for the floating-point IIR lattice filter.
\r
4095 uint16_t numStages; /**< number of stages in the filter. */
\r
4096 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4097 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4098 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4099 } arm_iir_lattice_instance_f32;
\r
4102 * @brief Processing function for the floating-point IIR lattice filter.
\r
4103 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
4104 * @param[in] *pSrc points to the block of input data.
\r
4105 * @param[out] *pDst points to the block of output data.
\r
4106 * @param[in] blockSize number of samples to process.
\r
4110 void arm_iir_lattice_f32(
\r
4111 const arm_iir_lattice_instance_f32 * S,
\r
4114 uint32_t blockSize);
\r
4117 * @brief Initialization function for the floating-point IIR lattice filter.
\r
4118 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
4119 * @param[in] numStages number of stages in the filter.
\r
4120 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4121 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4122 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
\r
4123 * @param[in] blockSize number of samples to process.
\r
4127 void arm_iir_lattice_init_f32(
\r
4128 arm_iir_lattice_instance_f32 * S,
\r
4129 uint16_t numStages,
\r
4130 float32_t * pkCoeffs,
\r
4131 float32_t * pvCoeffs,
\r
4132 float32_t * pState,
\r
4133 uint32_t blockSize);
\r
4137 * @brief Processing function for the Q31 IIR lattice filter.
\r
4138 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4139 * @param[in] *pSrc points to the block of input data.
\r
4140 * @param[out] *pDst points to the block of output data.
\r
4141 * @param[in] blockSize number of samples to process.
\r
4145 void arm_iir_lattice_q31(
\r
4146 const arm_iir_lattice_instance_q31 * S,
\r
4149 uint32_t blockSize);
\r
4153 * @brief Initialization function for the Q31 IIR lattice filter.
\r
4154 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4155 * @param[in] numStages number of stages in the filter.
\r
4156 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4157 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4158 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
\r
4159 * @param[in] blockSize number of samples to process.
\r
4163 void arm_iir_lattice_init_q31(
\r
4164 arm_iir_lattice_instance_q31 * S,
\r
4165 uint16_t numStages,
\r
4169 uint32_t blockSize);
\r
4173 * @brief Processing function for the Q15 IIR lattice filter.
\r
4174 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
\r
4175 * @param[in] *pSrc points to the block of input data.
\r
4176 * @param[out] *pDst points to the block of output data.
\r
4177 * @param[in] blockSize number of samples to process.
\r
4181 void arm_iir_lattice_q15(
\r
4182 const arm_iir_lattice_instance_q15 * S,
\r
4185 uint32_t blockSize);
\r
4189 * @brief Initialization function for the Q15 IIR lattice filter.
\r
4190 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
\r
4191 * @param[in] numStages number of stages in the filter.
\r
4192 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
\r
4193 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
\r
4194 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
\r
4195 * @param[in] blockSize number of samples to process per call.
\r
4199 void arm_iir_lattice_init_q15(
\r
4200 arm_iir_lattice_instance_q15 * S,
\r
4201 uint16_t numStages,
\r
4205 uint32_t blockSize);
\r
4208 * @brief Instance structure for the floating-point LMS filter.
\r
4213 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4214 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4215 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4216 float32_t mu; /**< step size that controls filter coefficient updates. */
\r
4217 } arm_lms_instance_f32;
\r
4220 * @brief Processing function for floating-point LMS filter.
\r
4221 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4222 * @param[in] *pSrc points to the block of input data.
\r
4223 * @param[in] *pRef points to the block of reference data.
\r
4224 * @param[out] *pOut points to the block of output data.
\r
4225 * @param[out] *pErr points to the block of error data.
\r
4226 * @param[in] blockSize number of samples to process.
\r
4231 const arm_lms_instance_f32 * S,
\r
4236 uint32_t blockSize);
\r
4239 * @brief Initialization function for floating-point LMS filter.
\r
4240 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4241 * @param[in] numTaps number of filter coefficients.
\r
4242 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4243 * @param[in] *pState points to state buffer.
\r
4244 * @param[in] mu step size that controls filter coefficient updates.
\r
4245 * @param[in] blockSize number of samples to process.
\r
4249 void arm_lms_init_f32(
\r
4250 arm_lms_instance_f32 * S,
\r
4252 float32_t * pCoeffs,
\r
4253 float32_t * pState,
\r
4255 uint32_t blockSize);
\r
4258 * @brief Instance structure for the Q15 LMS filter.
\r
4263 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4264 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4265 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4266 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4267 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4268 } arm_lms_instance_q15;
\r
4272 * @brief Initialization function for the Q15 LMS filter.
\r
4273 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4274 * @param[in] numTaps number of filter coefficients.
\r
4275 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4276 * @param[in] *pState points to the state buffer.
\r
4277 * @param[in] mu step size that controls filter coefficient updates.
\r
4278 * @param[in] blockSize number of samples to process.
\r
4279 * @param[in] postShift bit shift applied to coefficients.
\r
4283 void arm_lms_init_q15(
\r
4284 arm_lms_instance_q15 * S,
\r
4289 uint32_t blockSize,
\r
4290 uint32_t postShift);
\r
4293 * @brief Processing function for Q15 LMS filter.
\r
4294 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4295 * @param[in] *pSrc points to the block of input data.
\r
4296 * @param[in] *pRef points to the block of reference data.
\r
4297 * @param[out] *pOut points to the block of output data.
\r
4298 * @param[out] *pErr points to the block of error data.
\r
4299 * @param[in] blockSize number of samples to process.
\r
4304 const arm_lms_instance_q15 * S,
\r
4309 uint32_t blockSize);
\r
4313 * @brief Instance structure for the Q31 LMS filter.
\r
4318 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4319 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4320 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4321 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4322 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4324 } arm_lms_instance_q31;
\r
4327 * @brief Processing function for Q31 LMS filter.
\r
4328 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4329 * @param[in] *pSrc points to the block of input data.
\r
4330 * @param[in] *pRef points to the block of reference data.
\r
4331 * @param[out] *pOut points to the block of output data.
\r
4332 * @param[out] *pErr points to the block of error data.
\r
4333 * @param[in] blockSize number of samples to process.
\r
4338 const arm_lms_instance_q31 * S,
\r
4343 uint32_t blockSize);
\r
4346 * @brief Initialization function for Q31 LMS filter.
\r
4347 * @param[in] *S points to an instance of the Q31 LMS filter structure.
\r
4348 * @param[in] numTaps number of filter coefficients.
\r
4349 * @param[in] *pCoeffs points to coefficient buffer.
\r
4350 * @param[in] *pState points to state buffer.
\r
4351 * @param[in] mu step size that controls filter coefficient updates.
\r
4352 * @param[in] blockSize number of samples to process.
\r
4353 * @param[in] postShift bit shift applied to coefficients.
\r
4357 void arm_lms_init_q31(
\r
4358 arm_lms_instance_q31 * S,
\r
4363 uint32_t blockSize,
\r
4364 uint32_t postShift);
\r
4367 * @brief Instance structure for the floating-point normalized LMS filter.
\r
4372 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4373 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4374 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4375 float32_t mu; /**< step size that control filter coefficient updates. */
\r
4376 float32_t energy; /**< saves previous frame energy. */
\r
4377 float32_t x0; /**< saves previous input sample. */
\r
4378 } arm_lms_norm_instance_f32;
\r
4381 * @brief Processing function for floating-point normalized LMS filter.
\r
4382 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
\r
4383 * @param[in] *pSrc points to the block of input data.
\r
4384 * @param[in] *pRef points to the block of reference data.
\r
4385 * @param[out] *pOut points to the block of output data.
\r
4386 * @param[out] *pErr points to the block of error data.
\r
4387 * @param[in] blockSize number of samples to process.
\r
4391 void arm_lms_norm_f32(
\r
4392 arm_lms_norm_instance_f32 * S,
\r
4397 uint32_t blockSize);
\r
4400 * @brief Initialization function for floating-point normalized LMS filter.
\r
4401 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4402 * @param[in] numTaps number of filter coefficients.
\r
4403 * @param[in] *pCoeffs points to coefficient buffer.
\r
4404 * @param[in] *pState points to state buffer.
\r
4405 * @param[in] mu step size that controls filter coefficient updates.
\r
4406 * @param[in] blockSize number of samples to process.
\r
4410 void arm_lms_norm_init_f32(
\r
4411 arm_lms_norm_instance_f32 * S,
\r
4413 float32_t * pCoeffs,
\r
4414 float32_t * pState,
\r
4416 uint32_t blockSize);
\r
4420 * @brief Instance structure for the Q31 normalized LMS filter.
\r
4424 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4425 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4426 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4427 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4428 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4429 q31_t *recipTable; /**< points to the reciprocal initial value table. */
\r
4430 q31_t energy; /**< saves previous frame energy. */
\r
4431 q31_t x0; /**< saves previous input sample. */
\r
4432 } arm_lms_norm_instance_q31;
\r
4435 * @brief Processing function for Q31 normalized LMS filter.
\r
4436 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4437 * @param[in] *pSrc points to the block of input data.
\r
4438 * @param[in] *pRef points to the block of reference data.
\r
4439 * @param[out] *pOut points to the block of output data.
\r
4440 * @param[out] *pErr points to the block of error data.
\r
4441 * @param[in] blockSize number of samples to process.
\r
4445 void arm_lms_norm_q31(
\r
4446 arm_lms_norm_instance_q31 * S,
\r
4451 uint32_t blockSize);
\r
4454 * @brief Initialization function for Q31 normalized LMS filter.
\r
4455 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4456 * @param[in] numTaps number of filter coefficients.
\r
4457 * @param[in] *pCoeffs points to coefficient buffer.
\r
4458 * @param[in] *pState points to state buffer.
\r
4459 * @param[in] mu step size that controls filter coefficient updates.
\r
4460 * @param[in] blockSize number of samples to process.
\r
4461 * @param[in] postShift bit shift applied to coefficients.
\r
4465 void arm_lms_norm_init_q31(
\r
4466 arm_lms_norm_instance_q31 * S,
\r
4471 uint32_t blockSize,
\r
4472 uint8_t postShift);
\r
4475 * @brief Instance structure for the Q15 normalized LMS filter.
\r
4480 uint16_t numTaps; /**< Number of coefficients in the filter. */
\r
4481 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4482 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4483 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4484 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4485 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
\r
4486 q15_t energy; /**< saves previous frame energy. */
\r
4487 q15_t x0; /**< saves previous input sample. */
\r
4488 } arm_lms_norm_instance_q15;
\r
4491 * @brief Processing function for Q15 normalized LMS filter.
\r
4492 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4493 * @param[in] *pSrc points to the block of input data.
\r
4494 * @param[in] *pRef points to the block of reference data.
\r
4495 * @param[out] *pOut points to the block of output data.
\r
4496 * @param[out] *pErr points to the block of error data.
\r
4497 * @param[in] blockSize number of samples to process.
\r
4501 void arm_lms_norm_q15(
\r
4502 arm_lms_norm_instance_q15 * S,
\r
4507 uint32_t blockSize);
\r
4511 * @brief Initialization function for Q15 normalized LMS filter.
\r
4512 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4513 * @param[in] numTaps number of filter coefficients.
\r
4514 * @param[in] *pCoeffs points to coefficient buffer.
\r
4515 * @param[in] *pState points to state buffer.
\r
4516 * @param[in] mu step size that controls filter coefficient updates.
\r
4517 * @param[in] blockSize number of samples to process.
\r
4518 * @param[in] postShift bit shift applied to coefficients.
\r
4522 void arm_lms_norm_init_q15(
\r
4523 arm_lms_norm_instance_q15 * S,
\r
4528 uint32_t blockSize,
\r
4529 uint8_t postShift);
\r
4532 * @brief Correlation of floating-point sequences.
\r
4533 * @param[in] *pSrcA points to the first input sequence.
\r
4534 * @param[in] srcALen length of the first input sequence.
\r
4535 * @param[in] *pSrcB points to the second input sequence.
\r
4536 * @param[in] srcBLen length of the second input sequence.
\r
4537 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4541 void arm_correlate_f32(
\r
4542 float32_t * pSrcA,
\r
4544 float32_t * pSrcB,
\r
4546 float32_t * pDst);
\r
4550 * @brief Correlation of Q15 sequences
\r
4551 * @param[in] *pSrcA points to the first input sequence.
\r
4552 * @param[in] srcALen length of the first input sequence.
\r
4553 * @param[in] *pSrcB points to the second input sequence.
\r
4554 * @param[in] srcBLen length of the second input sequence.
\r
4555 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4556 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4559 void arm_correlate_opt_q15(
\r
4565 q15_t * pScratch);
\r
4569 * @brief Correlation of Q15 sequences.
\r
4570 * @param[in] *pSrcA points to the first input sequence.
\r
4571 * @param[in] srcALen length of the first input sequence.
\r
4572 * @param[in] *pSrcB points to the second input sequence.
\r
4573 * @param[in] srcBLen length of the second input sequence.
\r
4574 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4578 void arm_correlate_q15(
\r
4586 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4587 * @param[in] *pSrcA points to the first input sequence.
\r
4588 * @param[in] srcALen length of the first input sequence.
\r
4589 * @param[in] *pSrcB points to the second input sequence.
\r
4590 * @param[in] srcBLen length of the second input sequence.
\r
4591 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4595 void arm_correlate_fast_q15(
\r
4605 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4606 * @param[in] *pSrcA points to the first input sequence.
\r
4607 * @param[in] srcALen length of the first input sequence.
\r
4608 * @param[in] *pSrcB points to the second input sequence.
\r
4609 * @param[in] srcBLen length of the second input sequence.
\r
4610 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4611 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4615 void arm_correlate_fast_opt_q15(
\r
4621 q15_t * pScratch);
\r
4624 * @brief Correlation of Q31 sequences.
\r
4625 * @param[in] *pSrcA points to the first input sequence.
\r
4626 * @param[in] srcALen length of the first input sequence.
\r
4627 * @param[in] *pSrcB points to the second input sequence.
\r
4628 * @param[in] srcBLen length of the second input sequence.
\r
4629 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4633 void arm_correlate_q31(
\r
4641 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
4642 * @param[in] *pSrcA points to the first input sequence.
\r
4643 * @param[in] srcALen length of the first input sequence.
\r
4644 * @param[in] *pSrcB points to the second input sequence.
\r
4645 * @param[in] srcBLen length of the second input sequence.
\r
4646 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4650 void arm_correlate_fast_q31(
\r
4660 * @brief Correlation of Q7 sequences.
\r
4661 * @param[in] *pSrcA points to the first input sequence.
\r
4662 * @param[in] srcALen length of the first input sequence.
\r
4663 * @param[in] *pSrcB points to the second input sequence.
\r
4664 * @param[in] srcBLen length of the second input sequence.
\r
4665 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4666 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4667 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
4671 void arm_correlate_opt_q7(
\r
4677 q15_t * pScratch1,
\r
4678 q15_t * pScratch2);
\r
4682 * @brief Correlation of Q7 sequences.
\r
4683 * @param[in] *pSrcA points to the first input sequence.
\r
4684 * @param[in] srcALen length of the first input sequence.
\r
4685 * @param[in] *pSrcB points to the second input sequence.
\r
4686 * @param[in] srcBLen length of the second input sequence.
\r
4687 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4691 void arm_correlate_q7(
\r
4700 * @brief Instance structure for the floating-point sparse FIR filter.
\r
4704 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4705 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4706 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4707 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4708 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4709 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4710 } arm_fir_sparse_instance_f32;
\r
4713 * @brief Instance structure for the Q31 sparse FIR filter.
\r
4718 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4719 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4720 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4721 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4722 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4723 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4724 } arm_fir_sparse_instance_q31;
\r
4727 * @brief Instance structure for the Q15 sparse FIR filter.
\r
4732 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4733 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4734 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4735 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4736 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4737 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4738 } arm_fir_sparse_instance_q15;
\r
4741 * @brief Instance structure for the Q7 sparse FIR filter.
\r
4746 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4747 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4748 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4749 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4750 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4751 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4752 } arm_fir_sparse_instance_q7;
\r
4755 * @brief Processing function for the floating-point sparse FIR filter.
\r
4756 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
\r
4757 * @param[in] *pSrc points to the block of input data.
\r
4758 * @param[out] *pDst points to the block of output data
\r
4759 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4760 * @param[in] blockSize number of input samples to process per call.
\r
4764 void arm_fir_sparse_f32(
\r
4765 arm_fir_sparse_instance_f32 * S,
\r
4768 float32_t * pScratchIn,
\r
4769 uint32_t blockSize);
\r
4772 * @brief Initialization function for the floating-point sparse FIR filter.
\r
4773 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
\r
4774 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4775 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4776 * @param[in] *pState points to the state buffer.
\r
4777 * @param[in] *pTapDelay points to the array of offset times.
\r
4778 * @param[in] maxDelay maximum offset time supported.
\r
4779 * @param[in] blockSize number of samples that will be processed per block.
\r
4783 void arm_fir_sparse_init_f32(
\r
4784 arm_fir_sparse_instance_f32 * S,
\r
4786 float32_t * pCoeffs,
\r
4787 float32_t * pState,
\r
4788 int32_t * pTapDelay,
\r
4789 uint16_t maxDelay,
\r
4790 uint32_t blockSize);
\r
4793 * @brief Processing function for the Q31 sparse FIR filter.
\r
4794 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
\r
4795 * @param[in] *pSrc points to the block of input data.
\r
4796 * @param[out] *pDst points to the block of output data
\r
4797 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4798 * @param[in] blockSize number of input samples to process per call.
\r
4802 void arm_fir_sparse_q31(
\r
4803 arm_fir_sparse_instance_q31 * S,
\r
4806 q31_t * pScratchIn,
\r
4807 uint32_t blockSize);
\r
4810 * @brief Initialization function for the Q31 sparse FIR filter.
\r
4811 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
\r
4812 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4813 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4814 * @param[in] *pState points to the state buffer.
\r
4815 * @param[in] *pTapDelay points to the array of offset times.
\r
4816 * @param[in] maxDelay maximum offset time supported.
\r
4817 * @param[in] blockSize number of samples that will be processed per block.
\r
4821 void arm_fir_sparse_init_q31(
\r
4822 arm_fir_sparse_instance_q31 * S,
\r
4826 int32_t * pTapDelay,
\r
4827 uint16_t maxDelay,
\r
4828 uint32_t blockSize);
\r
4831 * @brief Processing function for the Q15 sparse FIR filter.
\r
4832 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
\r
4833 * @param[in] *pSrc points to the block of input data.
\r
4834 * @param[out] *pDst points to the block of output data
\r
4835 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4836 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4837 * @param[in] blockSize number of input samples to process per call.
\r
4841 void arm_fir_sparse_q15(
\r
4842 arm_fir_sparse_instance_q15 * S,
\r
4845 q15_t * pScratchIn,
\r
4846 q31_t * pScratchOut,
\r
4847 uint32_t blockSize);
\r
4851 * @brief Initialization function for the Q15 sparse FIR filter.
\r
4852 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
\r
4853 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4854 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4855 * @param[in] *pState points to the state buffer.
\r
4856 * @param[in] *pTapDelay points to the array of offset times.
\r
4857 * @param[in] maxDelay maximum offset time supported.
\r
4858 * @param[in] blockSize number of samples that will be processed per block.
\r
4862 void arm_fir_sparse_init_q15(
\r
4863 arm_fir_sparse_instance_q15 * S,
\r
4867 int32_t * pTapDelay,
\r
4868 uint16_t maxDelay,
\r
4869 uint32_t blockSize);
\r
4872 * @brief Processing function for the Q7 sparse FIR filter.
\r
4873 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
\r
4874 * @param[in] *pSrc points to the block of input data.
\r
4875 * @param[out] *pDst points to the block of output data
\r
4876 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4877 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4878 * @param[in] blockSize number of input samples to process per call.
\r
4882 void arm_fir_sparse_q7(
\r
4883 arm_fir_sparse_instance_q7 * S,
\r
4886 q7_t * pScratchIn,
\r
4887 q31_t * pScratchOut,
\r
4888 uint32_t blockSize);
\r
4891 * @brief Initialization function for the Q7 sparse FIR filter.
\r
4892 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
\r
4893 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4894 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4895 * @param[in] *pState points to the state buffer.
\r
4896 * @param[in] *pTapDelay points to the array of offset times.
\r
4897 * @param[in] maxDelay maximum offset time supported.
\r
4898 * @param[in] blockSize number of samples that will be processed per block.
\r
4902 void arm_fir_sparse_init_q7(
\r
4903 arm_fir_sparse_instance_q7 * S,
\r
4907 int32_t * pTapDelay,
\r
4908 uint16_t maxDelay,
\r
4909 uint32_t blockSize);
\r
4913 * @brief Floating-point sin_cos function.
\r
4914 * @param[in] theta input value in degrees
\r
4915 * @param[out] *pSinVal points to the processed sine output.
\r
4916 * @param[out] *pCosVal points to the processed cos output.
\r
4920 void arm_sin_cos_f32(
\r
4922 float32_t * pSinVal,
\r
4923 float32_t * pCcosVal);
\r
4926 * @brief Q31 sin_cos function.
\r
4927 * @param[in] theta scaled input value in degrees
\r
4928 * @param[out] *pSinVal points to the processed sine output.
\r
4929 * @param[out] *pCosVal points to the processed cosine output.
\r
4933 void arm_sin_cos_q31(
\r
4940 * @brief Floating-point complex conjugate.
\r
4941 * @param[in] *pSrc points to the input vector
\r
4942 * @param[out] *pDst points to the output vector
\r
4943 * @param[in] numSamples number of complex samples in each vector
\r
4947 void arm_cmplx_conj_f32(
\r
4950 uint32_t numSamples);
\r
4953 * @brief Q31 complex conjugate.
\r
4954 * @param[in] *pSrc points to the input vector
\r
4955 * @param[out] *pDst points to the output vector
\r
4956 * @param[in] numSamples number of complex samples in each vector
\r
4960 void arm_cmplx_conj_q31(
\r
4963 uint32_t numSamples);
\r
4966 * @brief Q15 complex conjugate.
\r
4967 * @param[in] *pSrc points to the input vector
\r
4968 * @param[out] *pDst points to the output vector
\r
4969 * @param[in] numSamples number of complex samples in each vector
\r
4973 void arm_cmplx_conj_q15(
\r
4976 uint32_t numSamples);
\r
4981 * @brief Floating-point complex magnitude squared
\r
4982 * @param[in] *pSrc points to the complex input vector
\r
4983 * @param[out] *pDst points to the real output vector
\r
4984 * @param[in] numSamples number of complex samples in the input vector
\r
4988 void arm_cmplx_mag_squared_f32(
\r
4991 uint32_t numSamples);
\r
4994 * @brief Q31 complex magnitude squared
\r
4995 * @param[in] *pSrc points to the complex input vector
\r
4996 * @param[out] *pDst points to the real output vector
\r
4997 * @param[in] numSamples number of complex samples in the input vector
\r
5001 void arm_cmplx_mag_squared_q31(
\r
5004 uint32_t numSamples);
\r
5007 * @brief Q15 complex magnitude squared
\r
5008 * @param[in] *pSrc points to the complex input vector
\r
5009 * @param[out] *pDst points to the real output vector
\r
5010 * @param[in] numSamples number of complex samples in the input vector
\r
5014 void arm_cmplx_mag_squared_q15(
\r
5017 uint32_t numSamples);
\r
5021 * @ingroup groupController
\r
5025 * @defgroup PID PID Motor Control
\r
5027 * A Proportional Integral Derivative (PID) controller is a generic feedback control
\r
5028 * loop mechanism widely used in industrial control systems.
\r
5029 * A PID controller is the most commonly used type of feedback controller.
\r
5031 * This set of functions implements (PID) controllers
\r
5032 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
\r
5033 * of data and each call to the function returns a single processed value.
\r
5034 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
\r
5035 * is the input sample value. The functions return the output value.
\r
5039 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
\r
5040 * A0 = Kp + Ki + Kd
\r
5041 * A1 = (-Kp ) - (2 * Kd )
\r
5045 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
\r
5048 * \image html PID.gif "Proportional Integral Derivative Controller"
\r
5051 * The PID controller calculates an "error" value as the difference between
\r
5052 * the measured output and the reference input.
\r
5053 * The controller attempts to minimize the error by adjusting the process control inputs.
\r
5054 * The proportional value determines the reaction to the current error,
\r
5055 * the integral value determines the reaction based on the sum of recent errors,
\r
5056 * and the derivative value determines the reaction based on the rate at which the error has been changing.
\r
5058 * \par Instance Structure
\r
5059 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
\r
5060 * A separate instance structure must be defined for each PID Controller.
\r
5061 * There are separate instance structure declarations for each of the 3 supported data types.
\r
5063 * \par Reset Functions
\r
5064 * There is also an associated reset function for each data type which clears the state array.
\r
5066 * \par Initialization Functions
\r
5067 * There is also an associated initialization function for each data type.
\r
5068 * The initialization function performs the following operations:
\r
5069 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
\r
5070 * - Zeros out the values in the state buffer.
\r
5073 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
\r
5075 * \par Fixed-Point Behavior
\r
5076 * Care must be taken when using the fixed-point versions of the PID Controller functions.
\r
5077 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
\r
5078 * Refer to the function specific documentation below for usage guidelines.
\r
5087 * @brief Process function for the floating-point PID Control.
\r
5088 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
5089 * @param[in] in input sample to process
\r
5090 * @return out processed output sample.
\r
5094 static __INLINE float32_t arm_pid_f32(
\r
5095 arm_pid_instance_f32 * S,
\r
5100 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
\r
5101 out = (S->A0 * in) +
\r
5102 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
\r
5104 /* Update state */
\r
5105 S->state[1] = S->state[0];
\r
5107 S->state[2] = out;
\r
5109 /* return to application */
\r
5115 * @brief Process function for the Q31 PID Control.
\r
5116 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
5117 * @param[in] in input sample to process
\r
5118 * @return out processed output sample.
\r
5120 * <b>Scaling and Overflow Behavior:</b>
\r
5122 * The function is implemented using an internal 64-bit accumulator.
\r
5123 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
\r
5124 * Thus, if the accumulator result overflows it wraps around rather than clip.
\r
5125 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
\r
5126 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
\r
5129 static __INLINE q31_t arm_pid_q31(
\r
5130 arm_pid_instance_q31 * S,
\r
5136 /* acc = A0 * x[n] */
\r
5137 acc = (q63_t) S->A0 * in;
\r
5139 /* acc += A1 * x[n-1] */
\r
5140 acc += (q63_t) S->A1 * S->state[0];
\r
5142 /* acc += A2 * x[n-2] */
\r
5143 acc += (q63_t) S->A2 * S->state[1];
\r
5145 /* convert output to 1.31 format to add y[n-1] */
\r
5146 out = (q31_t) (acc >> 31u);
\r
5148 /* out += y[n-1] */
\r
5149 out += S->state[2];
\r
5151 /* Update state */
\r
5152 S->state[1] = S->state[0];
\r
5154 S->state[2] = out;
\r
5156 /* return to application */
\r
5162 * @brief Process function for the Q15 PID Control.
\r
5163 * @param[in,out] *S points to an instance of the Q15 PID Control structure
\r
5164 * @param[in] in input sample to process
\r
5165 * @return out processed output sample.
\r
5167 * <b>Scaling and Overflow Behavior:</b>
\r
5169 * The function is implemented using a 64-bit internal accumulator.
\r
5170 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
\r
5171 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
\r
5172 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
\r
5173 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
\r
5174 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
\r
5177 static __INLINE q15_t arm_pid_q15(
\r
5178 arm_pid_instance_q15 * S,
\r
5184 #ifndef ARM_MATH_CM0_FAMILY
\r
5185 __SIMD32_TYPE *vstate;
\r
5187 /* Implementation of PID controller */
\r
5189 /* acc = A0 * x[n] */
\r
5190 acc = (q31_t) __SMUAD(S->A0, in);
\r
5192 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5193 vstate = __SIMD32_CONST(S->state);
\r
5194 acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
\r
5197 /* acc = A0 * x[n] */
\r
5198 acc = ((q31_t) S->A0) * in;
\r
5200 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5201 acc += (q31_t) S->A1 * S->state[0];
\r
5202 acc += (q31_t) S->A2 * S->state[1];
\r
5206 /* acc += y[n-1] */
\r
5207 acc += (q31_t) S->state[2] << 15;
\r
5209 /* saturate the output */
\r
5210 out = (q15_t) (__SSAT((acc >> 15), 16));
\r
5212 /* Update state */
\r
5213 S->state[1] = S->state[0];
\r
5215 S->state[2] = out;
\r
5217 /* return to application */
\r
5223 * @} end of PID group
\r
5228 * @brief Floating-point matrix inverse.
\r
5229 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5230 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5231 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5232 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5235 arm_status arm_mat_inverse_f32(
\r
5236 const arm_matrix_instance_f32 * src,
\r
5237 arm_matrix_instance_f32 * dst);
\r
5241 * @brief Floating-point matrix inverse.
\r
5242 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5243 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5244 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5245 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5248 arm_status arm_mat_inverse_f64(
\r
5249 const arm_matrix_instance_f64 * src,
\r
5250 arm_matrix_instance_f64 * dst);
\r
5255 * @ingroup groupController
\r
5260 * @defgroup clarke Vector Clarke Transform
\r
5261 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
\r
5262 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
\r
5263 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
\r
5264 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
\r
5265 * \image html clarke.gif Stator current space vector and its components in (a,b).
\r
5266 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
\r
5267 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
\r
5269 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5270 * The library provides separate functions for Q31 and floating-point data types.
\r
5272 * \image html clarkeFormula.gif
\r
5273 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
\r
5274 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
\r
5275 * \par Fixed-Point Behavior
\r
5276 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5277 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5278 * Refer to the function specific documentation below for usage guidelines.
\r
5282 * @addtogroup clarke
\r
5288 * @brief Floating-point Clarke transform
\r
5289 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5290 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5291 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5292 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5296 static __INLINE void arm_clarke_f32(
\r
5299 float32_t * pIalpha,
\r
5300 float32_t * pIbeta)
\r
5302 /* Calculate pIalpha using the equation, pIalpha = Ia */
\r
5305 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
\r
5307 ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
\r
5312 * @brief Clarke transform for Q31 version
\r
5313 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5314 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5315 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5316 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5319 * <b>Scaling and Overflow Behavior:</b>
\r
5321 * The function is implemented using an internal 32-bit accumulator.
\r
5322 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5323 * There is saturation on the addition, hence there is no risk of overflow.
\r
5326 static __INLINE void arm_clarke_q31(
\r
5332 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5334 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
\r
5337 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
\r
5338 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
\r
5340 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
\r
5341 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
\r
5343 /* pIbeta is calculated by adding the intermediate products */
\r
5344 *pIbeta = __QADD(product1, product2);
\r
5348 * @} end of clarke group
\r
5352 * @brief Converts the elements of the Q7 vector to Q31 vector.
\r
5353 * @param[in] *pSrc input pointer
\r
5354 * @param[out] *pDst output pointer
\r
5355 * @param[in] blockSize number of samples to process
\r
5358 void arm_q7_to_q31(
\r
5361 uint32_t blockSize);
\r
5367 * @ingroup groupController
\r
5371 * @defgroup inv_clarke Vector Inverse Clarke Transform
\r
5372 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
\r
5374 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5375 * The library provides separate functions for Q31 and floating-point data types.
\r
5377 * \image html clarkeInvFormula.gif
\r
5378 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
\r
5379 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
\r
5380 * \par Fixed-Point Behavior
\r
5381 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5382 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5383 * Refer to the function specific documentation below for usage guidelines.
\r
5387 * @addtogroup inv_clarke
\r
5392 * @brief Floating-point Inverse Clarke transform
\r
5393 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5394 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5395 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5396 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5401 static __INLINE void arm_inv_clarke_f32(
\r
5407 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5410 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
\r
5411 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
\r
5416 * @brief Inverse Clarke transform for Q31 version
\r
5417 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5418 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5419 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5420 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5423 * <b>Scaling and Overflow Behavior:</b>
\r
5425 * The function is implemented using an internal 32-bit accumulator.
\r
5426 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5427 * There is saturation on the subtraction, hence there is no risk of overflow.
\r
5430 static __INLINE void arm_inv_clarke_q31(
\r
5436 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5438 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5441 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
\r
5442 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
\r
5444 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
\r
5445 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
\r
5447 /* pIb is calculated by subtracting the products */
\r
5448 *pIb = __QSUB(product2, product1);
\r
5453 * @} end of inv_clarke group
\r
5457 * @brief Converts the elements of the Q7 vector to Q15 vector.
\r
5458 * @param[in] *pSrc input pointer
\r
5459 * @param[out] *pDst output pointer
\r
5460 * @param[in] blockSize number of samples to process
\r
5463 void arm_q7_to_q15(
\r
5466 uint32_t blockSize);
\r
5471 * @ingroup groupController
\r
5475 * @defgroup park Vector Park Transform
\r
5477 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
\r
5478 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
\r
5479 * from the stationary to the moving reference frame and control the spatial relationship between
\r
5480 * the stator vector current and rotor flux vector.
\r
5481 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
\r
5482 * current vector and the relationship from the two reference frames:
\r
5483 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
\r
5485 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5486 * The library provides separate functions for Q31 and floating-point data types.
\r
5488 * \image html parkFormula.gif
\r
5489 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
\r
5490 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5491 * cosine and sine values of theta (rotor flux position).
\r
5492 * \par Fixed-Point Behavior
\r
5493 * Care must be taken when using the Q31 version of the Park transform.
\r
5494 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5495 * Refer to the function specific documentation below for usage guidelines.
\r
5499 * @addtogroup park
\r
5504 * @brief Floating-point Park transform
\r
5505 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5506 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5507 * @param[out] *pId points to output rotor reference frame d
\r
5508 * @param[out] *pIq points to output rotor reference frame q
\r
5509 * @param[in] sinVal sine value of rotation angle theta
\r
5510 * @param[in] cosVal cosine value of rotation angle theta
\r
5513 * The function implements the forward Park transform.
\r
5517 static __INLINE void arm_park_f32(
\r
5525 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
\r
5526 *pId = Ialpha * cosVal + Ibeta * sinVal;
\r
5528 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
\r
5529 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
\r
5534 * @brief Park transform for Q31 version
\r
5535 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5536 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5537 * @param[out] *pId points to output rotor reference frame d
\r
5538 * @param[out] *pIq points to output rotor reference frame q
\r
5539 * @param[in] sinVal sine value of rotation angle theta
\r
5540 * @param[in] cosVal cosine value of rotation angle theta
\r
5543 * <b>Scaling and Overflow Behavior:</b>
\r
5545 * The function is implemented using an internal 32-bit accumulator.
\r
5546 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5547 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
\r
5551 static __INLINE void arm_park_q31(
\r
5559 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5560 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5562 /* Intermediate product is calculated by (Ialpha * cosVal) */
\r
5563 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
\r
5565 /* Intermediate product is calculated by (Ibeta * sinVal) */
\r
5566 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
\r
5569 /* Intermediate product is calculated by (Ialpha * sinVal) */
\r
5570 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
\r
5572 /* Intermediate product is calculated by (Ibeta * cosVal) */
\r
5573 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
\r
5575 /* Calculate pId by adding the two intermediate products 1 and 2 */
\r
5576 *pId = __QADD(product1, product2);
\r
5578 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
\r
5579 *pIq = __QSUB(product4, product3);
\r
5583 * @} end of park group
\r
5587 * @brief Converts the elements of the Q7 vector to floating-point vector.
\r
5588 * @param[in] *pSrc is input pointer
\r
5589 * @param[out] *pDst is output pointer
\r
5590 * @param[in] blockSize is the number of samples to process
\r
5593 void arm_q7_to_float(
\r
5596 uint32_t blockSize);
\r
5600 * @ingroup groupController
\r
5604 * @defgroup inv_park Vector Inverse Park transform
\r
5605 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
\r
5607 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5608 * The library provides separate functions for Q31 and floating-point data types.
\r
5610 * \image html parkInvFormula.gif
\r
5611 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
\r
5612 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5613 * cosine and sine values of theta (rotor flux position).
\r
5614 * \par Fixed-Point Behavior
\r
5615 * Care must be taken when using the Q31 version of the Park transform.
\r
5616 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5617 * Refer to the function specific documentation below for usage guidelines.
\r
5621 * @addtogroup inv_park
\r
5626 * @brief Floating-point Inverse Park transform
\r
5627 * @param[in] Id input coordinate of rotor reference frame d
\r
5628 * @param[in] Iq input coordinate of rotor reference frame q
\r
5629 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5630 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5631 * @param[in] sinVal sine value of rotation angle theta
\r
5632 * @param[in] cosVal cosine value of rotation angle theta
\r
5636 static __INLINE void arm_inv_park_f32(
\r
5639 float32_t * pIalpha,
\r
5640 float32_t * pIbeta,
\r
5644 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
\r
5645 *pIalpha = Id * cosVal - Iq * sinVal;
\r
5647 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
\r
5648 *pIbeta = Id * sinVal + Iq * cosVal;
\r
5654 * @brief Inverse Park transform for Q31 version
\r
5655 * @param[in] Id input coordinate of rotor reference frame d
\r
5656 * @param[in] Iq input coordinate of rotor reference frame q
\r
5657 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5658 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5659 * @param[in] sinVal sine value of rotation angle theta
\r
5660 * @param[in] cosVal cosine value of rotation angle theta
\r
5663 * <b>Scaling and Overflow Behavior:</b>
\r
5665 * The function is implemented using an internal 32-bit accumulator.
\r
5666 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5667 * There is saturation on the addition, hence there is no risk of overflow.
\r
5671 static __INLINE void arm_inv_park_q31(
\r
5679 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5680 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5682 /* Intermediate product is calculated by (Id * cosVal) */
\r
5683 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
\r
5685 /* Intermediate product is calculated by (Iq * sinVal) */
\r
5686 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
\r
5689 /* Intermediate product is calculated by (Id * sinVal) */
\r
5690 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
\r
5692 /* Intermediate product is calculated by (Iq * cosVal) */
\r
5693 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
\r
5695 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
\r
5696 *pIalpha = __QSUB(product1, product2);
\r
5698 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
\r
5699 *pIbeta = __QADD(product4, product3);
\r
5704 * @} end of Inverse park group
\r
5709 * @brief Converts the elements of the Q31 vector to floating-point vector.
\r
5710 * @param[in] *pSrc is input pointer
\r
5711 * @param[out] *pDst is output pointer
\r
5712 * @param[in] blockSize is the number of samples to process
\r
5715 void arm_q31_to_float(
\r
5718 uint32_t blockSize);
\r
5721 * @ingroup groupInterpolation
\r
5725 * @defgroup LinearInterpolate Linear Interpolation
\r
5727 * Linear interpolation is a method of curve fitting using linear polynomials.
\r
5728 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
\r
5731 * \image html LinearInterp.gif "Linear interpolation"
\r
5734 * A Linear Interpolate function calculates an output value(y), for the input(x)
\r
5735 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
\r
5739 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
\r
5740 * where x0, x1 are nearest values of input x
\r
5741 * y0, y1 are nearest values to output y
\r
5745 * This set of functions implements Linear interpolation process
\r
5746 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
\r
5747 * sample of data and each call to the function returns a single processed value.
\r
5748 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
\r
5749 * <code>x</code> is the input sample value. The functions returns the output value.
\r
5752 * if x is outside of the table boundary, Linear interpolation returns first value of the table
\r
5753 * if x is below input range and returns last value of table if x is above range.
\r
5757 * @addtogroup LinearInterpolate
\r
5762 * @brief Process function for the floating-point Linear Interpolation Function.
\r
5763 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
\r
5764 * @param[in] x input sample to process
\r
5765 * @return y processed output sample.
\r
5769 static __INLINE float32_t arm_linear_interp_f32(
\r
5770 arm_linear_interp_instance_f32 * S,
\r
5775 float32_t x0, x1; /* Nearest input values */
\r
5776 float32_t y0, y1; /* Nearest output values */
\r
5777 float32_t xSpacing = S->xSpacing; /* spacing between input values */
\r
5778 int32_t i; /* Index variable */
\r
5779 float32_t *pYData = S->pYData; /* pointer to output table */
\r
5781 /* Calculation of index */
\r
5782 i = (int32_t) ((x - S->x1) / xSpacing);
\r
5786 /* Iniatilize output for below specified range as least output value of table */
\r
5789 else if((uint32_t)i >= S->nValues)
\r
5791 /* Iniatilize output for above specified range as last output value of table */
\r
5792 y = pYData[S->nValues - 1];
\r
5796 /* Calculation of nearest input values */
\r
5797 x0 = S->x1 + i * xSpacing;
\r
5798 x1 = S->x1 + (i + 1) * xSpacing;
\r
5800 /* Read of nearest output values */
\r
5802 y1 = pYData[i + 1];
\r
5804 /* Calculation of output */
\r
5805 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
\r
5809 /* returns output value */
\r
5815 * @brief Process function for the Q31 Linear Interpolation Function.
\r
5816 * @param[in] *pYData pointer to Q31 Linear Interpolation table
\r
5817 * @param[in] x input sample to process
\r
5818 * @param[in] nValues number of table values
\r
5819 * @return y processed output sample.
\r
5822 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5823 * This function can support maximum of table size 2^12.
\r
5828 static __INLINE q31_t arm_linear_interp_q31(
\r
5833 q31_t y; /* output */
\r
5834 q31_t y0, y1; /* Nearest output values */
\r
5835 q31_t fract; /* fractional part */
\r
5836 int32_t index; /* Index to read nearest output values */
\r
5838 /* Input is in 12.20 format */
\r
5839 /* 12 bits for the table index */
\r
5840 /* Index value calculation */
\r
5841 index = ((x & 0xFFF00000) >> 20);
\r
5843 if(index >= (int32_t)(nValues - 1))
\r
5845 return (pYData[nValues - 1]);
\r
5847 else if(index < 0)
\r
5849 return (pYData[0]);
\r
5854 /* 20 bits for the fractional part */
\r
5855 /* shift left by 11 to keep fract in 1.31 format */
\r
5856 fract = (x & 0x000FFFFF) << 11;
\r
5858 /* Read two nearest output values from the index in 1.31(q31) format */
\r
5859 y0 = pYData[index];
\r
5860 y1 = pYData[index + 1u];
\r
5862 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
\r
5863 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
\r
5865 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
\r
5866 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
\r
5868 /* Convert y to 1.31 format */
\r
5877 * @brief Process function for the Q15 Linear Interpolation Function.
\r
5878 * @param[in] *pYData pointer to Q15 Linear Interpolation table
\r
5879 * @param[in] x input sample to process
\r
5880 * @param[in] nValues number of table values
\r
5881 * @return y processed output sample.
\r
5884 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5885 * This function can support maximum of table size 2^12.
\r
5890 static __INLINE q15_t arm_linear_interp_q15(
\r
5895 q63_t y; /* output */
\r
5896 q15_t y0, y1; /* Nearest output values */
\r
5897 q31_t fract; /* fractional part */
\r
5898 int32_t index; /* Index to read nearest output values */
\r
5900 /* Input is in 12.20 format */
\r
5901 /* 12 bits for the table index */
\r
5902 /* Index value calculation */
\r
5903 index = ((x & 0xFFF00000) >> 20u);
\r
5905 if(index >= (int32_t)(nValues - 1))
\r
5907 return (pYData[nValues - 1]);
\r
5909 else if(index < 0)
\r
5911 return (pYData[0]);
\r
5915 /* 20 bits for the fractional part */
\r
5916 /* fract is in 12.20 format */
\r
5917 fract = (x & 0x000FFFFF);
\r
5919 /* Read two nearest output values from the index */
\r
5920 y0 = pYData[index];
\r
5921 y1 = pYData[index + 1u];
\r
5923 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
\r
5924 y = ((q63_t) y0 * (0xFFFFF - fract));
\r
5926 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
\r
5927 y += ((q63_t) y1 * (fract));
\r
5929 /* convert y to 1.15 format */
\r
5938 * @brief Process function for the Q7 Linear Interpolation Function.
\r
5939 * @param[in] *pYData pointer to Q7 Linear Interpolation table
\r
5940 * @param[in] x input sample to process
\r
5941 * @param[in] nValues number of table values
\r
5942 * @return y processed output sample.
\r
5945 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5946 * This function can support maximum of table size 2^12.
\r
5950 static __INLINE q7_t arm_linear_interp_q7(
\r
5955 q31_t y; /* output */
\r
5956 q7_t y0, y1; /* Nearest output values */
\r
5957 q31_t fract; /* fractional part */
\r
5958 uint32_t index; /* Index to read nearest output values */
\r
5960 /* Input is in 12.20 format */
\r
5961 /* 12 bits for the table index */
\r
5962 /* Index value calculation */
\r
5965 return (pYData[0]);
\r
5967 index = (x >> 20) & 0xfff;
\r
5970 if(index >= (nValues - 1))
\r
5972 return (pYData[nValues - 1]);
\r
5977 /* 20 bits for the fractional part */
\r
5978 /* fract is in 12.20 format */
\r
5979 fract = (x & 0x000FFFFF);
\r
5981 /* Read two nearest output values from the index and are in 1.7(q7) format */
\r
5982 y0 = pYData[index];
\r
5983 y1 = pYData[index + 1u];
\r
5985 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
\r
5986 y = ((y0 * (0xFFFFF - fract)));
\r
5988 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
\r
5989 y += (y1 * fract);
\r
5991 /* convert y to 1.7(q7) format */
\r
5992 return (y >> 20u);
\r
5998 * @} end of LinearInterpolate group
\r
6002 * @brief Fast approximation to the trigonometric sine function for floating-point data.
\r
6003 * @param[in] x input value in radians.
\r
6007 float32_t arm_sin_f32(
\r
6011 * @brief Fast approximation to the trigonometric sine function for Q31 data.
\r
6012 * @param[in] x Scaled input value in radians.
\r
6016 q31_t arm_sin_q31(
\r
6020 * @brief Fast approximation to the trigonometric sine function for Q15 data.
\r
6021 * @param[in] x Scaled input value in radians.
\r
6025 q15_t arm_sin_q15(
\r
6029 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
\r
6030 * @param[in] x input value in radians.
\r
6034 float32_t arm_cos_f32(
\r
6038 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
\r
6039 * @param[in] x Scaled input value in radians.
\r
6043 q31_t arm_cos_q31(
\r
6047 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
\r
6048 * @param[in] x Scaled input value in radians.
\r
6052 q15_t arm_cos_q15(
\r
6057 * @ingroup groupFastMath
\r
6062 * @defgroup SQRT Square Root
\r
6064 * Computes the square root of a number.
\r
6065 * There are separate functions for Q15, Q31, and floating-point data types.
\r
6066 * The square root function is computed using the Newton-Raphson algorithm.
\r
6067 * This is an iterative algorithm of the form:
\r
6069 * x1 = x0 - f(x0)/f'(x0)
\r
6071 * where <code>x1</code> is the current estimate,
\r
6072 * <code>x0</code> is the previous estimate, and
\r
6073 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
\r
6074 * For the square root function, the algorithm reduces to:
\r
6076 * x0 = in/2 [initial guess]
\r
6077 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
\r
6083 * @addtogroup SQRT
\r
6088 * @brief Floating-point square root function.
\r
6089 * @param[in] in input value.
\r
6090 * @param[out] *pOut square root of input value.
\r
6091 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6092 * <code>in</code> is negative value and returns zero output for negative values.
\r
6095 static __INLINE arm_status arm_sqrt_f32(
\r
6103 #if (__FPU_USED == 1) && defined ( __CC_ARM )
\r
6104 *pOut = __sqrtf(in);
\r
6106 *pOut = sqrtf(in);
\r
6109 return (ARM_MATH_SUCCESS);
\r
6114 return (ARM_MATH_ARGUMENT_ERROR);
\r
6121 * @brief Q31 square root function.
\r
6122 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
\r
6123 * @param[out] *pOut square root of input value.
\r
6124 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6125 * <code>in</code> is negative value and returns zero output for negative values.
\r
6127 arm_status arm_sqrt_q31(
\r
6132 * @brief Q15 square root function.
\r
6133 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
\r
6134 * @param[out] *pOut square root of input value.
\r
6135 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6136 * <code>in</code> is negative value and returns zero output for negative values.
\r
6138 arm_status arm_sqrt_q15(
\r
6143 * @} end of SQRT group
\r
6152 * @brief floating-point Circular write function.
\r
6155 static __INLINE void arm_circularWrite_f32(
\r
6156 int32_t * circBuffer,
\r
6158 uint16_t * writeOffset,
\r
6159 int32_t bufferInc,
\r
6160 const int32_t * src,
\r
6162 uint32_t blockSize)
\r
6167 /* Copy the value of Index pointer that points
\r
6168 * to the current location where the input samples to be copied */
\r
6169 wOffset = *writeOffset;
\r
6171 /* Loop over the blockSize */
\r
6176 /* copy the input sample to the circular buffer */
\r
6177 circBuffer[wOffset] = *src;
\r
6179 /* Update the input pointer */
\r
6182 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6183 wOffset += bufferInc;
\r
6187 /* Decrement the loop counter */
\r
6191 /* Update the index pointer */
\r
6192 *writeOffset = wOffset;
\r
6198 * @brief floating-point Circular Read function.
\r
6200 static __INLINE void arm_circularRead_f32(
\r
6201 int32_t * circBuffer,
\r
6203 int32_t * readOffset,
\r
6204 int32_t bufferInc,
\r
6206 int32_t * dst_base,
\r
6207 int32_t dst_length,
\r
6209 uint32_t blockSize)
\r
6212 int32_t rOffset, dst_end;
\r
6214 /* Copy the value of Index pointer that points
\r
6215 * to the current location from where the input samples to be read */
\r
6216 rOffset = *readOffset;
\r
6217 dst_end = (int32_t) (dst_base + dst_length);
\r
6219 /* Loop over the blockSize */
\r
6224 /* copy the sample from the circular buffer to the destination buffer */
\r
6225 *dst = circBuffer[rOffset];
\r
6227 /* Update the input pointer */
\r
6230 if(dst == (int32_t *) dst_end)
\r
6235 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6236 rOffset += bufferInc;
\r
6243 /* Decrement the loop counter */
\r
6247 /* Update the index pointer */
\r
6248 *readOffset = rOffset;
\r
6252 * @brief Q15 Circular write function.
\r
6255 static __INLINE void arm_circularWrite_q15(
\r
6256 q15_t * circBuffer,
\r
6258 uint16_t * writeOffset,
\r
6259 int32_t bufferInc,
\r
6260 const q15_t * src,
\r
6262 uint32_t blockSize)
\r
6267 /* Copy the value of Index pointer that points
\r
6268 * to the current location where the input samples to be copied */
\r
6269 wOffset = *writeOffset;
\r
6271 /* Loop over the blockSize */
\r
6276 /* copy the input sample to the circular buffer */
\r
6277 circBuffer[wOffset] = *src;
\r
6279 /* Update the input pointer */
\r
6282 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6283 wOffset += bufferInc;
\r
6287 /* Decrement the loop counter */
\r
6291 /* Update the index pointer */
\r
6292 *writeOffset = wOffset;
\r
6298 * @brief Q15 Circular Read function.
\r
6300 static __INLINE void arm_circularRead_q15(
\r
6301 q15_t * circBuffer,
\r
6303 int32_t * readOffset,
\r
6304 int32_t bufferInc,
\r
6307 int32_t dst_length,
\r
6309 uint32_t blockSize)
\r
6312 int32_t rOffset, dst_end;
\r
6314 /* Copy the value of Index pointer that points
\r
6315 * to the current location from where the input samples to be read */
\r
6316 rOffset = *readOffset;
\r
6318 dst_end = (int32_t) (dst_base + dst_length);
\r
6320 /* Loop over the blockSize */
\r
6325 /* copy the sample from the circular buffer to the destination buffer */
\r
6326 *dst = circBuffer[rOffset];
\r
6328 /* Update the input pointer */
\r
6331 if(dst == (q15_t *) dst_end)
\r
6336 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6337 rOffset += bufferInc;
\r
6344 /* Decrement the loop counter */
\r
6348 /* Update the index pointer */
\r
6349 *readOffset = rOffset;
\r
6354 * @brief Q7 Circular write function.
\r
6357 static __INLINE void arm_circularWrite_q7(
\r
6358 q7_t * circBuffer,
\r
6360 uint16_t * writeOffset,
\r
6361 int32_t bufferInc,
\r
6364 uint32_t blockSize)
\r
6369 /* Copy the value of Index pointer that points
\r
6370 * to the current location where the input samples to be copied */
\r
6371 wOffset = *writeOffset;
\r
6373 /* Loop over the blockSize */
\r
6378 /* copy the input sample to the circular buffer */
\r
6379 circBuffer[wOffset] = *src;
\r
6381 /* Update the input pointer */
\r
6384 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6385 wOffset += bufferInc;
\r
6389 /* Decrement the loop counter */
\r
6393 /* Update the index pointer */
\r
6394 *writeOffset = wOffset;
\r
6400 * @brief Q7 Circular Read function.
\r
6402 static __INLINE void arm_circularRead_q7(
\r
6403 q7_t * circBuffer,
\r
6405 int32_t * readOffset,
\r
6406 int32_t bufferInc,
\r
6409 int32_t dst_length,
\r
6411 uint32_t blockSize)
\r
6414 int32_t rOffset, dst_end;
\r
6416 /* Copy the value of Index pointer that points
\r
6417 * to the current location from where the input samples to be read */
\r
6418 rOffset = *readOffset;
\r
6420 dst_end = (int32_t) (dst_base + dst_length);
\r
6422 /* Loop over the blockSize */
\r
6427 /* copy the sample from the circular buffer to the destination buffer */
\r
6428 *dst = circBuffer[rOffset];
\r
6430 /* Update the input pointer */
\r
6433 if(dst == (q7_t *) dst_end)
\r
6438 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6439 rOffset += bufferInc;
\r
6446 /* Decrement the loop counter */
\r
6450 /* Update the index pointer */
\r
6451 *readOffset = rOffset;
\r
6456 * @brief Sum of the squares of the elements of a Q31 vector.
\r
6457 * @param[in] *pSrc is input pointer
\r
6458 * @param[in] blockSize is the number of samples to process
\r
6459 * @param[out] *pResult is output value.
\r
6463 void arm_power_q31(
\r
6465 uint32_t blockSize,
\r
6469 * @brief Sum of the squares of the elements of a floating-point vector.
\r
6470 * @param[in] *pSrc is input pointer
\r
6471 * @param[in] blockSize is the number of samples to process
\r
6472 * @param[out] *pResult is output value.
\r
6476 void arm_power_f32(
\r
6478 uint32_t blockSize,
\r
6479 float32_t * pResult);
\r
6482 * @brief Sum of the squares of the elements of a Q15 vector.
\r
6483 * @param[in] *pSrc is input pointer
\r
6484 * @param[in] blockSize is the number of samples to process
\r
6485 * @param[out] *pResult is output value.
\r
6489 void arm_power_q15(
\r
6491 uint32_t blockSize,
\r
6495 * @brief Sum of the squares of the elements of a Q7 vector.
\r
6496 * @param[in] *pSrc is input pointer
\r
6497 * @param[in] blockSize is the number of samples to process
\r
6498 * @param[out] *pResult is output value.
\r
6502 void arm_power_q7(
\r
6504 uint32_t blockSize,
\r
6508 * @brief Mean value of a Q7 vector.
\r
6509 * @param[in] *pSrc is input pointer
\r
6510 * @param[in] blockSize is the number of samples to process
\r
6511 * @param[out] *pResult is output value.
\r
6517 uint32_t blockSize,
\r
6521 * @brief Mean value of a Q15 vector.
\r
6522 * @param[in] *pSrc is input pointer
\r
6523 * @param[in] blockSize is the number of samples to process
\r
6524 * @param[out] *pResult is output value.
\r
6527 void arm_mean_q15(
\r
6529 uint32_t blockSize,
\r
6533 * @brief Mean value of a Q31 vector.
\r
6534 * @param[in] *pSrc is input pointer
\r
6535 * @param[in] blockSize is the number of samples to process
\r
6536 * @param[out] *pResult is output value.
\r
6539 void arm_mean_q31(
\r
6541 uint32_t blockSize,
\r
6545 * @brief Mean value of a floating-point vector.
\r
6546 * @param[in] *pSrc is input pointer
\r
6547 * @param[in] blockSize is the number of samples to process
\r
6548 * @param[out] *pResult is output value.
\r
6551 void arm_mean_f32(
\r
6553 uint32_t blockSize,
\r
6554 float32_t * pResult);
\r
6557 * @brief Variance of the elements of a floating-point vector.
\r
6558 * @param[in] *pSrc is input pointer
\r
6559 * @param[in] blockSize is the number of samples to process
\r
6560 * @param[out] *pResult is output value.
\r
6566 uint32_t blockSize,
\r
6567 float32_t * pResult);
\r
6570 * @brief Variance of the elements of a Q31 vector.
\r
6571 * @param[in] *pSrc is input pointer
\r
6572 * @param[in] blockSize is the number of samples to process
\r
6573 * @param[out] *pResult is output value.
\r
6579 uint32_t blockSize,
\r
6583 * @brief Variance of the elements of a Q15 vector.
\r
6584 * @param[in] *pSrc is input pointer
\r
6585 * @param[in] blockSize is the number of samples to process
\r
6586 * @param[out] *pResult is output value.
\r
6592 uint32_t blockSize,
\r
6596 * @brief Root Mean Square of the elements of a floating-point vector.
\r
6597 * @param[in] *pSrc is input pointer
\r
6598 * @param[in] blockSize is the number of samples to process
\r
6599 * @param[out] *pResult is output value.
\r
6605 uint32_t blockSize,
\r
6606 float32_t * pResult);
\r
6609 * @brief Root Mean Square of the elements of a Q31 vector.
\r
6610 * @param[in] *pSrc is input pointer
\r
6611 * @param[in] blockSize is the number of samples to process
\r
6612 * @param[out] *pResult is output value.
\r
6618 uint32_t blockSize,
\r
6622 * @brief Root Mean Square of the elements of a Q15 vector.
\r
6623 * @param[in] *pSrc is input pointer
\r
6624 * @param[in] blockSize is the number of samples to process
\r
6625 * @param[out] *pResult is output value.
\r
6631 uint32_t blockSize,
\r
6635 * @brief Standard deviation of the elements of a floating-point vector.
\r
6636 * @param[in] *pSrc is input pointer
\r
6637 * @param[in] blockSize is the number of samples to process
\r
6638 * @param[out] *pResult is output value.
\r
6644 uint32_t blockSize,
\r
6645 float32_t * pResult);
\r
6648 * @brief Standard deviation of the elements of a Q31 vector.
\r
6649 * @param[in] *pSrc is input pointer
\r
6650 * @param[in] blockSize is the number of samples to process
\r
6651 * @param[out] *pResult is output value.
\r
6657 uint32_t blockSize,
\r
6661 * @brief Standard deviation of the elements of a Q15 vector.
\r
6662 * @param[in] *pSrc is input pointer
\r
6663 * @param[in] blockSize is the number of samples to process
\r
6664 * @param[out] *pResult is output value.
\r
6670 uint32_t blockSize,
\r
6674 * @brief Floating-point complex magnitude
\r
6675 * @param[in] *pSrc points to the complex input vector
\r
6676 * @param[out] *pDst points to the real output vector
\r
6677 * @param[in] numSamples number of complex samples in the input vector
\r
6681 void arm_cmplx_mag_f32(
\r
6684 uint32_t numSamples);
\r
6687 * @brief Q31 complex magnitude
\r
6688 * @param[in] *pSrc points to the complex input vector
\r
6689 * @param[out] *pDst points to the real output vector
\r
6690 * @param[in] numSamples number of complex samples in the input vector
\r
6694 void arm_cmplx_mag_q31(
\r
6697 uint32_t numSamples);
\r
6700 * @brief Q15 complex magnitude
\r
6701 * @param[in] *pSrc points to the complex input vector
\r
6702 * @param[out] *pDst points to the real output vector
\r
6703 * @param[in] numSamples number of complex samples in the input vector
\r
6707 void arm_cmplx_mag_q15(
\r
6710 uint32_t numSamples);
\r
6713 * @brief Q15 complex dot product
\r
6714 * @param[in] *pSrcA points to the first input vector
\r
6715 * @param[in] *pSrcB points to the second input vector
\r
6716 * @param[in] numSamples number of complex samples in each vector
\r
6717 * @param[out] *realResult real part of the result returned here
\r
6718 * @param[out] *imagResult imaginary part of the result returned here
\r
6722 void arm_cmplx_dot_prod_q15(
\r
6725 uint32_t numSamples,
\r
6726 q31_t * realResult,
\r
6727 q31_t * imagResult);
\r
6730 * @brief Q31 complex dot product
\r
6731 * @param[in] *pSrcA points to the first input vector
\r
6732 * @param[in] *pSrcB points to the second input vector
\r
6733 * @param[in] numSamples number of complex samples in each vector
\r
6734 * @param[out] *realResult real part of the result returned here
\r
6735 * @param[out] *imagResult imaginary part of the result returned here
\r
6739 void arm_cmplx_dot_prod_q31(
\r
6742 uint32_t numSamples,
\r
6743 q63_t * realResult,
\r
6744 q63_t * imagResult);
\r
6747 * @brief Floating-point complex dot product
\r
6748 * @param[in] *pSrcA points to the first input vector
\r
6749 * @param[in] *pSrcB points to the second input vector
\r
6750 * @param[in] numSamples number of complex samples in each vector
\r
6751 * @param[out] *realResult real part of the result returned here
\r
6752 * @param[out] *imagResult imaginary part of the result returned here
\r
6756 void arm_cmplx_dot_prod_f32(
\r
6757 float32_t * pSrcA,
\r
6758 float32_t * pSrcB,
\r
6759 uint32_t numSamples,
\r
6760 float32_t * realResult,
\r
6761 float32_t * imagResult);
\r
6764 * @brief Q15 complex-by-real multiplication
\r
6765 * @param[in] *pSrcCmplx points to the complex input vector
\r
6766 * @param[in] *pSrcReal points to the real input vector
\r
6767 * @param[out] *pCmplxDst points to the complex output vector
\r
6768 * @param[in] numSamples number of samples in each vector
\r
6772 void arm_cmplx_mult_real_q15(
\r
6773 q15_t * pSrcCmplx,
\r
6775 q15_t * pCmplxDst,
\r
6776 uint32_t numSamples);
\r
6779 * @brief Q31 complex-by-real multiplication
\r
6780 * @param[in] *pSrcCmplx points to the complex input vector
\r
6781 * @param[in] *pSrcReal points to the real input vector
\r
6782 * @param[out] *pCmplxDst points to the complex output vector
\r
6783 * @param[in] numSamples number of samples in each vector
\r
6787 void arm_cmplx_mult_real_q31(
\r
6788 q31_t * pSrcCmplx,
\r
6790 q31_t * pCmplxDst,
\r
6791 uint32_t numSamples);
\r
6794 * @brief Floating-point complex-by-real multiplication
\r
6795 * @param[in] *pSrcCmplx points to the complex input vector
\r
6796 * @param[in] *pSrcReal points to the real input vector
\r
6797 * @param[out] *pCmplxDst points to the complex output vector
\r
6798 * @param[in] numSamples number of samples in each vector
\r
6802 void arm_cmplx_mult_real_f32(
\r
6803 float32_t * pSrcCmplx,
\r
6804 float32_t * pSrcReal,
\r
6805 float32_t * pCmplxDst,
\r
6806 uint32_t numSamples);
\r
6809 * @brief Minimum value of a Q7 vector.
\r
6810 * @param[in] *pSrc is input pointer
\r
6811 * @param[in] blockSize is the number of samples to process
\r
6812 * @param[out] *result is output pointer
\r
6813 * @param[in] index is the array index of the minimum value in the input buffer.
\r
6819 uint32_t blockSize,
\r
6821 uint32_t * index);
\r
6824 * @brief Minimum value of a Q15 vector.
\r
6825 * @param[in] *pSrc is input pointer
\r
6826 * @param[in] blockSize is the number of samples to process
\r
6827 * @param[out] *pResult is output pointer
\r
6828 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
\r
6834 uint32_t blockSize,
\r
6836 uint32_t * pIndex);
\r
6839 * @brief Minimum value of a Q31 vector.
\r
6840 * @param[in] *pSrc is input pointer
\r
6841 * @param[in] blockSize is the number of samples to process
\r
6842 * @param[out] *pResult is output pointer
\r
6843 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6848 uint32_t blockSize,
\r
6850 uint32_t * pIndex);
\r
6853 * @brief Minimum value of a floating-point vector.
\r
6854 * @param[in] *pSrc is input pointer
\r
6855 * @param[in] blockSize is the number of samples to process
\r
6856 * @param[out] *pResult is output pointer
\r
6857 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6863 uint32_t blockSize,
\r
6864 float32_t * pResult,
\r
6865 uint32_t * pIndex);
\r
6868 * @brief Maximum value of a Q7 vector.
\r
6869 * @param[in] *pSrc points to the input buffer
\r
6870 * @param[in] blockSize length of the input vector
\r
6871 * @param[out] *pResult maximum value returned here
\r
6872 * @param[out] *pIndex index of maximum value returned here
\r
6878 uint32_t blockSize,
\r
6880 uint32_t * pIndex);
\r
6883 * @brief Maximum value of a Q15 vector.
\r
6884 * @param[in] *pSrc points to the input buffer
\r
6885 * @param[in] blockSize length of the input vector
\r
6886 * @param[out] *pResult maximum value returned here
\r
6887 * @param[out] *pIndex index of maximum value returned here
\r
6893 uint32_t blockSize,
\r
6895 uint32_t * pIndex);
\r
6898 * @brief Maximum value of a Q31 vector.
\r
6899 * @param[in] *pSrc points to the input buffer
\r
6900 * @param[in] blockSize length of the input vector
\r
6901 * @param[out] *pResult maximum value returned here
\r
6902 * @param[out] *pIndex index of maximum value returned here
\r
6908 uint32_t blockSize,
\r
6910 uint32_t * pIndex);
\r
6913 * @brief Maximum value of a floating-point vector.
\r
6914 * @param[in] *pSrc points to the input buffer
\r
6915 * @param[in] blockSize length of the input vector
\r
6916 * @param[out] *pResult maximum value returned here
\r
6917 * @param[out] *pIndex index of maximum value returned here
\r
6923 uint32_t blockSize,
\r
6924 float32_t * pResult,
\r
6925 uint32_t * pIndex);
\r
6928 * @brief Q15 complex-by-complex multiplication
\r
6929 * @param[in] *pSrcA points to the first input vector
\r
6930 * @param[in] *pSrcB points to the second input vector
\r
6931 * @param[out] *pDst points to the output vector
\r
6932 * @param[in] numSamples number of complex samples in each vector
\r
6936 void arm_cmplx_mult_cmplx_q15(
\r
6940 uint32_t numSamples);
\r
6943 * @brief Q31 complex-by-complex multiplication
\r
6944 * @param[in] *pSrcA points to the first input vector
\r
6945 * @param[in] *pSrcB points to the second input vector
\r
6946 * @param[out] *pDst points to the output vector
\r
6947 * @param[in] numSamples number of complex samples in each vector
\r
6951 void arm_cmplx_mult_cmplx_q31(
\r
6955 uint32_t numSamples);
\r
6958 * @brief Floating-point complex-by-complex multiplication
\r
6959 * @param[in] *pSrcA points to the first input vector
\r
6960 * @param[in] *pSrcB points to the second input vector
\r
6961 * @param[out] *pDst points to the output vector
\r
6962 * @param[in] numSamples number of complex samples in each vector
\r
6966 void arm_cmplx_mult_cmplx_f32(
\r
6967 float32_t * pSrcA,
\r
6968 float32_t * pSrcB,
\r
6970 uint32_t numSamples);
\r
6973 * @brief Converts the elements of the floating-point vector to Q31 vector.
\r
6974 * @param[in] *pSrc points to the floating-point input vector
\r
6975 * @param[out] *pDst points to the Q31 output vector
\r
6976 * @param[in] blockSize length of the input vector
\r
6979 void arm_float_to_q31(
\r
6982 uint32_t blockSize);
\r
6985 * @brief Converts the elements of the floating-point vector to Q15 vector.
\r
6986 * @param[in] *pSrc points to the floating-point input vector
\r
6987 * @param[out] *pDst points to the Q15 output vector
\r
6988 * @param[in] blockSize length of the input vector
\r
6991 void arm_float_to_q15(
\r
6994 uint32_t blockSize);
\r
6997 * @brief Converts the elements of the floating-point vector to Q7 vector.
\r
6998 * @param[in] *pSrc points to the floating-point input vector
\r
6999 * @param[out] *pDst points to the Q7 output vector
\r
7000 * @param[in] blockSize length of the input vector
\r
7003 void arm_float_to_q7(
\r
7006 uint32_t blockSize);
\r
7010 * @brief Converts the elements of the Q31 vector to Q15 vector.
\r
7011 * @param[in] *pSrc is input pointer
\r
7012 * @param[out] *pDst is output pointer
\r
7013 * @param[in] blockSize is the number of samples to process
\r
7016 void arm_q31_to_q15(
\r
7019 uint32_t blockSize);
\r
7022 * @brief Converts the elements of the Q31 vector to Q7 vector.
\r
7023 * @param[in] *pSrc is input pointer
\r
7024 * @param[out] *pDst is output pointer
\r
7025 * @param[in] blockSize is the number of samples to process
\r
7028 void arm_q31_to_q7(
\r
7031 uint32_t blockSize);
\r
7034 * @brief Converts the elements of the Q15 vector to floating-point vector.
\r
7035 * @param[in] *pSrc is input pointer
\r
7036 * @param[out] *pDst is output pointer
\r
7037 * @param[in] blockSize is the number of samples to process
\r
7040 void arm_q15_to_float(
\r
7043 uint32_t blockSize);
\r
7047 * @brief Converts the elements of the Q15 vector to Q31 vector.
\r
7048 * @param[in] *pSrc is input pointer
\r
7049 * @param[out] *pDst is output pointer
\r
7050 * @param[in] blockSize is the number of samples to process
\r
7053 void arm_q15_to_q31(
\r
7056 uint32_t blockSize);
\r
7060 * @brief Converts the elements of the Q15 vector to Q7 vector.
\r
7061 * @param[in] *pSrc is input pointer
\r
7062 * @param[out] *pDst is output pointer
\r
7063 * @param[in] blockSize is the number of samples to process
\r
7066 void arm_q15_to_q7(
\r
7069 uint32_t blockSize);
\r
7073 * @ingroup groupInterpolation
\r
7077 * @defgroup BilinearInterpolate Bilinear Interpolation
\r
7079 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
\r
7080 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
\r
7081 * determines values between the grid points.
\r
7082 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
\r
7083 * Bilinear interpolation is often used in image processing to rescale images.
\r
7084 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
\r
7086 * <b>Algorithm</b>
\r
7088 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
\r
7089 * For floating-point, the instance structure is defined as:
\r
7093 * uint16_t numRows;
\r
7094 * uint16_t numCols;
\r
7095 * float32_t *pData;
\r
7096 * } arm_bilinear_interp_instance_f32;
\r
7100 * where <code>numRows</code> specifies the number of rows in the table;
\r
7101 * <code>numCols</code> specifies the number of columns in the table;
\r
7102 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
\r
7103 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
\r
7104 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
\r
7107 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
\r
7113 * The interpolated output point is computed as:
\r
7115 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
\r
7116 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
\r
7117 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
\r
7118 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
\r
7120 * Note that the coordinates (x, y) contain integer and fractional components.
\r
7121 * The integer components specify which portion of the table to use while the
\r
7122 * fractional components control the interpolation processor.
\r
7125 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
\r
7129 * @addtogroup BilinearInterpolate
\r
7135 * @brief Floating-point bilinear interpolation.
\r
7136 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7137 * @param[in] X interpolation coordinate.
\r
7138 * @param[in] Y interpolation coordinate.
\r
7139 * @return out interpolated value.
\r
7143 static __INLINE float32_t arm_bilinear_interp_f32(
\r
7144 const arm_bilinear_interp_instance_f32 * S,
\r
7149 float32_t f00, f01, f10, f11;
\r
7150 float32_t *pData = S->pData;
\r
7151 int32_t xIndex, yIndex, index;
\r
7152 float32_t xdiff, ydiff;
\r
7153 float32_t b1, b2, b3, b4;
\r
7155 xIndex = (int32_t) X;
\r
7156 yIndex = (int32_t) Y;
\r
7158 /* Care taken for table outside boundary */
\r
7159 /* Returns zero output when values are outside table boundary */
\r
7160 if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
\r
7161 || yIndex > (S->numCols - 1))
\r
7166 /* Calculation of index for two nearest points in X-direction */
\r
7167 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
\r
7170 /* Read two nearest points in X-direction */
\r
7171 f00 = pData[index];
\r
7172 f01 = pData[index + 1];
\r
7174 /* Calculation of index for two nearest points in Y-direction */
\r
7175 index = (xIndex - 1) + (yIndex) * S->numCols;
\r
7178 /* Read two nearest points in Y-direction */
\r
7179 f10 = pData[index];
\r
7180 f11 = pData[index + 1];
\r
7182 /* Calculation of intermediate values */
\r
7186 b4 = f00 - f01 - f10 + f11;
\r
7188 /* Calculation of fractional part in X */
\r
7189 xdiff = X - xIndex;
\r
7191 /* Calculation of fractional part in Y */
\r
7192 ydiff = Y - yIndex;
\r
7194 /* Calculation of bi-linear interpolated output */
\r
7195 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
\r
7197 /* return to application */
\r
7204 * @brief Q31 bilinear interpolation.
\r
7205 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7206 * @param[in] X interpolation coordinate in 12.20 format.
\r
7207 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7208 * @return out interpolated value.
\r
7211 static __INLINE q31_t arm_bilinear_interp_q31(
\r
7212 arm_bilinear_interp_instance_q31 * S,
\r
7216 q31_t out; /* Temporary output */
\r
7217 q31_t acc = 0; /* output */
\r
7218 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7219 q31_t x1, x2, y1, y2; /* Nearest output values */
\r
7220 int32_t rI, cI; /* Row and column indices */
\r
7221 q31_t *pYData = S->pData; /* pointer to output table values */
\r
7222 uint32_t nCols = S->numCols; /* num of rows */
\r
7225 /* Input is in 12.20 format */
\r
7226 /* 12 bits for the table index */
\r
7227 /* Index value calculation */
\r
7228 rI = ((X & 0xFFF00000) >> 20u);
\r
7230 /* Input is in 12.20 format */
\r
7231 /* 12 bits for the table index */
\r
7232 /* Index value calculation */
\r
7233 cI = ((Y & 0xFFF00000) >> 20u);
\r
7235 /* Care taken for table outside boundary */
\r
7236 /* Returns zero output when values are outside table boundary */
\r
7237 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7242 /* 20 bits for the fractional part */
\r
7243 /* shift left xfract by 11 to keep 1.31 format */
\r
7244 xfract = (X & 0x000FFFFF) << 11u;
\r
7246 /* Read two nearest output values from the index */
\r
7247 x1 = pYData[(rI) + nCols * (cI)];
\r
7248 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7250 /* 20 bits for the fractional part */
\r
7251 /* shift left yfract by 11 to keep 1.31 format */
\r
7252 yfract = (Y & 0x000FFFFF) << 11u;
\r
7254 /* Read two nearest output values from the index */
\r
7255 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7256 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7258 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
\r
7259 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
\r
7260 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
\r
7262 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
\r
7263 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
\r
7264 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
\r
7266 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7267 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
\r
7268 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7270 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7271 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
\r
7272 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7274 /* Convert acc to 1.31(q31) format */
\r
7275 return (acc << 2u);
\r
7280 * @brief Q15 bilinear interpolation.
\r
7281 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7282 * @param[in] X interpolation coordinate in 12.20 format.
\r
7283 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7284 * @return out interpolated value.
\r
7287 static __INLINE q15_t arm_bilinear_interp_q15(
\r
7288 arm_bilinear_interp_instance_q15 * S,
\r
7292 q63_t acc = 0; /* output */
\r
7293 q31_t out; /* Temporary output */
\r
7294 q15_t x1, x2, y1, y2; /* Nearest output values */
\r
7295 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7296 int32_t rI, cI; /* Row and column indices */
\r
7297 q15_t *pYData = S->pData; /* pointer to output table values */
\r
7298 uint32_t nCols = S->numCols; /* num of rows */
\r
7300 /* Input is in 12.20 format */
\r
7301 /* 12 bits for the table index */
\r
7302 /* Index value calculation */
\r
7303 rI = ((X & 0xFFF00000) >> 20);
\r
7305 /* Input is in 12.20 format */
\r
7306 /* 12 bits for the table index */
\r
7307 /* Index value calculation */
\r
7308 cI = ((Y & 0xFFF00000) >> 20);
\r
7310 /* Care taken for table outside boundary */
\r
7311 /* Returns zero output when values are outside table boundary */
\r
7312 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7317 /* 20 bits for the fractional part */
\r
7318 /* xfract should be in 12.20 format */
\r
7319 xfract = (X & 0x000FFFFF);
\r
7321 /* Read two nearest output values from the index */
\r
7322 x1 = pYData[(rI) + nCols * (cI)];
\r
7323 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7326 /* 20 bits for the fractional part */
\r
7327 /* yfract should be in 12.20 format */
\r
7328 yfract = (Y & 0x000FFFFF);
\r
7330 /* Read two nearest output values from the index */
\r
7331 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7332 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7334 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
\r
7336 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
\r
7337 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
\r
7338 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
\r
7339 acc = ((q63_t) out * (0xFFFFF - yfract));
\r
7341 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
\r
7342 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
\r
7343 acc += ((q63_t) out * (xfract));
\r
7345 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
\r
7346 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
\r
7347 acc += ((q63_t) out * (yfract));
\r
7349 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
\r
7350 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
\r
7351 acc += ((q63_t) out * (yfract));
\r
7353 /* acc is in 13.51 format and down shift acc by 36 times */
\r
7354 /* Convert out to 1.15 format */
\r
7355 return (acc >> 36);
\r
7360 * @brief Q7 bilinear interpolation.
\r
7361 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7362 * @param[in] X interpolation coordinate in 12.20 format.
\r
7363 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7364 * @return out interpolated value.
\r
7367 static __INLINE q7_t arm_bilinear_interp_q7(
\r
7368 arm_bilinear_interp_instance_q7 * S,
\r
7372 q63_t acc = 0; /* output */
\r
7373 q31_t out; /* Temporary output */
\r
7374 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7375 q7_t x1, x2, y1, y2; /* Nearest output values */
\r
7376 int32_t rI, cI; /* Row and column indices */
\r
7377 q7_t *pYData = S->pData; /* pointer to output table values */
\r
7378 uint32_t nCols = S->numCols; /* num of rows */
\r
7380 /* Input is in 12.20 format */
\r
7381 /* 12 bits for the table index */
\r
7382 /* Index value calculation */
\r
7383 rI = ((X & 0xFFF00000) >> 20);
\r
7385 /* Input is in 12.20 format */
\r
7386 /* 12 bits for the table index */
\r
7387 /* Index value calculation */
\r
7388 cI = ((Y & 0xFFF00000) >> 20);
\r
7390 /* Care taken for table outside boundary */
\r
7391 /* Returns zero output when values are outside table boundary */
\r
7392 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7397 /* 20 bits for the fractional part */
\r
7398 /* xfract should be in 12.20 format */
\r
7399 xfract = (X & 0x000FFFFF);
\r
7401 /* Read two nearest output values from the index */
\r
7402 x1 = pYData[(rI) + nCols * (cI)];
\r
7403 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7406 /* 20 bits for the fractional part */
\r
7407 /* yfract should be in 12.20 format */
\r
7408 yfract = (Y & 0x000FFFFF);
\r
7410 /* Read two nearest output values from the index */
\r
7411 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7412 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7414 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
\r
7415 out = ((x1 * (0xFFFFF - xfract)));
\r
7416 acc = (((q63_t) out * (0xFFFFF - yfract)));
\r
7418 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
\r
7419 out = ((x2 * (0xFFFFF - yfract)));
\r
7420 acc += (((q63_t) out * (xfract)));
\r
7422 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
\r
7423 out = ((y1 * (0xFFFFF - xfract)));
\r
7424 acc += (((q63_t) out * (yfract)));
\r
7426 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
\r
7427 out = ((y2 * (yfract)));
\r
7428 acc += (((q63_t) out * (xfract)));
\r
7430 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
\r
7431 return (acc >> 40);
\r
7436 * @} end of BilinearInterpolate group
\r
7441 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7442 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7445 #define multSub_32x32_keep32_R(a, x, y) \
\r
7446 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7449 #define mult_32x32_keep32_R(a, x, y) \
\r
7450 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
\r
7453 #define multAcc_32x32_keep32(a, x, y) \
\r
7454 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7457 #define multSub_32x32_keep32(a, x, y) \
\r
7458 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7461 #define mult_32x32_keep32(a, x, y) \
\r
7462 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7465 #if defined ( __CC_ARM ) //Keil
\r
7467 //Enter low optimization region - place directly above function definition
\r
7468 #ifdef ARM_MATH_CM4
\r
7469 #define LOW_OPTIMIZATION_ENTER \
\r
7470 _Pragma ("push") \
\r
7473 #define LOW_OPTIMIZATION_ENTER
\r
7476 //Exit low optimization region - place directly after end of function definition
\r
7477 #ifdef ARM_MATH_CM4
\r
7478 #define LOW_OPTIMIZATION_EXIT \
\r
7481 #define LOW_OPTIMIZATION_EXIT
\r
7484 //Enter low optimization region - place directly above function definition
\r
7485 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7487 //Exit low optimization region - place directly after end of function definition
\r
7488 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7490 #elif defined(__ICCARM__) //IAR
\r
7492 //Enter low optimization region - place directly above function definition
\r
7493 #ifdef ARM_MATH_CM4
\r
7494 #define LOW_OPTIMIZATION_ENTER \
\r
7495 _Pragma ("optimize=low")
\r
7497 #define LOW_OPTIMIZATION_ENTER
\r
7500 //Exit low optimization region - place directly after end of function definition
\r
7501 #define LOW_OPTIMIZATION_EXIT
\r
7503 //Enter low optimization region - place directly above function definition
\r
7504 #ifdef ARM_MATH_CM4
\r
7505 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
\r
7506 _Pragma ("optimize=low")
\r
7508 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7511 //Exit low optimization region - place directly after end of function definition
\r
7512 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7514 #elif defined(__GNUC__)
\r
7516 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
\r
7518 #define LOW_OPTIMIZATION_EXIT
\r
7520 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7522 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7524 #elif defined(__CSMC__) // Cosmic
\r
7526 #define LOW_OPTIMIZATION_ENTER
\r
7527 #define LOW_OPTIMIZATION_EXIT
\r
7528 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7529 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7534 #ifdef __cplusplus
\r
7539 #endif /* _ARM_MATH_H */
\r