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-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_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
\r
70 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
\r
71 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
\r
72 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
\r
73 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
\r
74 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
\r
75 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
\r
76 * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
\r
78 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
\r
79 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
\r
80 * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
\r
81 * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
\r
82 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
\r
87 * The library ships with a number of examples which demonstrate how to use the library functions.
\r
92 * The library has been developed and tested with MDK-ARM version 4.60.
\r
93 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
\r
95 * Building the Library
\r
98 * 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
99 * - arm_cortexM_math.uvproj
\r
102 * 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
104 * Pre-processor Macros
\r
107 * Each library project have differant pre-processor macros.
\r
109 * - UNALIGNED_SUPPORT_DISABLE:
\r
111 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
\r
113 * - ARM_MATH_BIG_ENDIAN:
\r
115 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
\r
117 * - ARM_MATH_MATRIX_CHECK:
\r
119 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
\r
121 * - ARM_MATH_ROUNDING:
\r
123 * Define macro ARM_MATH_ROUNDING for rounding on support functions
\r
127 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
\r
128 * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target.
\r
132 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
\r
135 * CMSIS-DSP in ARM::CMSIS Pack
\r
136 * -----------------------------
\r
138 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
\r
139 * |File/Folder |Content |
\r
140 * |------------------------------|------------------------------------------------------------------------|
\r
141 * |\b CMSIS\\Documentation\\DSP | This documentation |
\r
142 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
\r
143 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
\r
144 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
\r
147 * Revision History of CMSIS-DSP
\r
149 * Please refer to \ref ChangeLog_pg.
\r
154 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
\r
159 * @defgroup groupMath Basic Math Functions
\r
163 * @defgroup groupFastMath Fast Math Functions
\r
164 * This set of functions provides a fast approximation to sine, cosine, and square root.
\r
165 * As compared to most of the other functions in the CMSIS math library, the fast math functions
\r
166 * operate on individual values and not arrays.
\r
167 * There are separate functions for Q15, Q31, and floating-point data.
\r
172 * @defgroup groupCmplxMath Complex Math Functions
\r
173 * This set of functions operates on complex data vectors.
\r
174 * The data in the complex arrays is stored in an interleaved fashion
\r
175 * (real, imag, real, imag, ...).
\r
176 * In the API functions, the number of samples in a complex array refers
\r
177 * to the number of complex values; the array contains twice this number of
\r
182 * @defgroup groupFilters Filtering Functions
\r
186 * @defgroup groupMatrix Matrix Functions
\r
188 * This set of functions provides basic matrix math operations.
\r
189 * The functions operate on matrix data structures. For example,
\r
191 * definition for the floating-point matrix structure is shown
\r
196 * uint16_t numRows; // number of rows of the matrix.
\r
197 * uint16_t numCols; // number of columns of the matrix.
\r
198 * float32_t *pData; // points to the data of the matrix.
\r
199 * } arm_matrix_instance_f32;
\r
201 * There are similar definitions for Q15 and Q31 data types.
\r
203 * The structure specifies the size of the matrix and then points to
\r
204 * an array of data. The array is of size <code>numRows X numCols</code>
\r
205 * and the values are arranged in row order. That is, the
\r
206 * matrix element (i, j) is stored at:
\r
208 * pData[i*numCols + j]
\r
211 * \par Init Functions
\r
212 * There is an associated initialization function for each type of matrix
\r
214 * The initialization function sets the values of the internal structure fields.
\r
215 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
\r
216 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
\r
219 * Use of the initialization function is optional. However, if initialization function is used
\r
220 * then the instance structure cannot be placed into a const data section.
\r
221 * To place the instance structure in a const data
\r
222 * section, manually initialize the data structure. For example:
\r
224 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
\r
225 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
\r
226 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
\r
228 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
\r
229 * specifies the number of columns, and <code>pData</code> points to the
\r
232 * \par Size Checking
\r
233 * By default all of the matrix functions perform size checking on the input and
\r
234 * output matrices. For example, the matrix addition function verifies that the
\r
235 * two input matrices and the output matrix all have the same number of rows and
\r
236 * columns. If the size check fails the functions return:
\r
238 * ARM_MATH_SIZE_MISMATCH
\r
240 * Otherwise the functions return
\r
244 * There is some overhead associated with this matrix size checking.
\r
245 * The matrix size checking is enabled via the \#define
\r
247 * ARM_MATH_MATRIX_CHECK
\r
249 * within the library project settings. By default this macro is defined
\r
250 * and size checking is enabled. By changing the project settings and
\r
251 * undefining this macro size checking is eliminated and the functions
\r
252 * run a bit faster. With size checking disabled the functions always
\r
253 * return <code>ARM_MATH_SUCCESS</code>.
\r
257 * @defgroup groupTransforms Transform Functions
\r
261 * @defgroup groupController Controller Functions
\r
265 * @defgroup groupStats Statistics Functions
\r
268 * @defgroup groupSupport Support Functions
\r
272 * @defgroup groupInterpolation Interpolation Functions
\r
273 * These functions perform 1- and 2-dimensional interpolation of data.
\r
274 * Linear interpolation is used for 1-dimensional data and
\r
275 * bilinear interpolation is used for 2-dimensional data.
\r
279 * @defgroup groupExamples Examples
\r
281 #ifndef _ARM_MATH_H
\r
282 #define _ARM_MATH_H
\r
284 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
\r
286 #if defined (ARM_MATH_CM4)
\r
287 #include "core_cm4.h"
\r
288 #elif defined (ARM_MATH_CM3)
\r
289 #include "core_cm3.h"
\r
290 #elif defined (ARM_MATH_CM0)
\r
291 #include "core_cm0.h"
\r
292 #define ARM_MATH_CM0_FAMILY
\r
293 #elif defined (ARM_MATH_CM0PLUS)
\r
294 #include "core_cm0plus.h"
\r
295 #define ARM_MATH_CM0_FAMILY
\r
297 #include "ARMCM4.h"
\r
298 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
\r
301 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
\r
302 #include "string.h"
\r
311 * @brief Macros required for reciprocal calculation in Normalized LMS
\r
314 #define DELTA_Q31 (0x100)
\r
315 #define DELTA_Q15 0x5
\r
316 #define INDEX_MASK 0x0000003F
\r
318 #define PI 3.14159265358979f
\r
322 * @brief Macros required for SINE and COSINE Fast math approximations
\r
325 #define FAST_MATH_TABLE_SIZE 512
\r
326 #define FAST_MATH_Q31_SHIFT (32 - 10)
\r
327 #define FAST_MATH_Q15_SHIFT (16 - 10)
\r
328 #define CONTROLLER_Q31_SHIFT (32 - 9)
\r
329 #define TABLE_SIZE 256
\r
330 #define TABLE_SPACING_Q31 0x400000
\r
331 #define TABLE_SPACING_Q15 0x80
\r
334 * @brief Macros required for SINE and COSINE Controller functions
\r
336 /* 1.31(q31) Fixed value of 2/360 */
\r
337 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
\r
338 #define INPUT_SPACING 0xB60B61
\r
341 * @brief Macro for Unaligned Support
\r
343 #ifndef UNALIGNED_SUPPORT_DISABLE
\r
346 #if defined (__GNUC__)
\r
347 #define ALIGN4 __attribute__((aligned(4)))
\r
349 #define ALIGN4 __align(4)
\r
351 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
\r
354 * @brief Error status returned by some functions in the library.
\r
359 ARM_MATH_SUCCESS = 0, /**< No error */
\r
360 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
\r
361 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
\r
362 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
\r
363 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
\r
364 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
\r
365 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
\r
369 * @brief 8-bit fractional data type in 1.7 format.
\r
371 typedef int8_t q7_t;
\r
374 * @brief 16-bit fractional data type in 1.15 format.
\r
376 typedef int16_t q15_t;
\r
379 * @brief 32-bit fractional data type in 1.31 format.
\r
381 typedef int32_t q31_t;
\r
384 * @brief 64-bit fractional data type in 1.63 format.
\r
386 typedef int64_t q63_t;
\r
389 * @brief 32-bit floating-point type definition.
\r
391 typedef float float32_t;
\r
394 * @brief 64-bit floating-point type definition.
\r
396 typedef double float64_t;
\r
399 * @brief definition to read/write two 16 bit values.
\r
401 #if defined __CC_ARM
\r
402 #define __SIMD32_TYPE int32_t __packed
\r
403 #define CMSIS_UNUSED __attribute__((unused))
\r
404 #elif defined __ICCARM__
\r
405 #define CMSIS_UNUSED
\r
406 #define __SIMD32_TYPE int32_t __packed
\r
407 #elif defined __GNUC__
\r
408 #define __SIMD32_TYPE int32_t
\r
409 #define CMSIS_UNUSED __attribute__((unused))
\r
410 #elif defined __CSMC__ /* Cosmic */
\r
411 #define CMSIS_UNUSED
\r
412 #define __SIMD32_TYPE int32_t
\r
414 #error Unknown compiler
\r
417 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
\r
418 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
\r
420 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
\r
422 #define __SIMD64(addr) (*(int64_t **) & (addr))
\r
424 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
426 * @brief definition to pack two 16 bit values.
\r
428 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
\r
429 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
\r
430 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
\r
431 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
\r
437 * @brief definition to pack four 8 bit values.
\r
439 #ifndef ARM_MATH_BIG_ENDIAN
\r
441 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
\r
442 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
\r
443 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
\r
444 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
\r
447 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
\r
448 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
\r
449 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
\r
450 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
\r
456 * @brief Clips Q63 to Q31 values.
\r
458 static __INLINE q31_t clip_q63_to_q31(
\r
461 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
462 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
\r
466 * @brief Clips Q63 to Q15 values.
\r
468 static __INLINE q15_t clip_q63_to_q15(
\r
471 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
472 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
\r
476 * @brief Clips Q31 to Q7 values.
\r
478 static __INLINE q7_t clip_q31_to_q7(
\r
481 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
\r
482 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
\r
486 * @brief Clips Q31 to Q15 values.
\r
488 static __INLINE q15_t clip_q31_to_q15(
\r
491 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
\r
492 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
\r
496 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
\r
499 static __INLINE q63_t mult32x64(
\r
503 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
\r
504 (((q63_t) (x >> 32) * y)));
\r
508 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
\r
509 #define __CLZ __clz
\r
512 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
\r
514 static __INLINE uint32_t __CLZ(
\r
518 static __INLINE uint32_t __CLZ(
\r
521 uint32_t count = 0;
\r
522 uint32_t mask = 0x80000000;
\r
524 while((data & mask) == 0)
\r
537 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
\r
540 static __INLINE uint32_t arm_recip_q31(
\r
543 q31_t * pRecipTable)
\r
546 uint32_t out, tempVal;
\r
552 signBits = __CLZ(in) - 1;
\r
556 signBits = __CLZ(-in) - 1;
\r
559 /* Convert input sample to 1.31 format */
\r
560 in = in << signBits;
\r
562 /* calculation of index for initial approximated Val */
\r
563 index = (uint32_t) (in >> 24u);
\r
564 index = (index & INDEX_MASK);
\r
566 /* 1.31 with exp 1 */
\r
567 out = pRecipTable[index];
\r
569 /* calculation of reciprocal value */
\r
570 /* running approximation for two iterations */
\r
571 for (i = 0u; i < 2u; i++)
\r
573 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
\r
574 tempVal = 0x7FFFFFFF - tempVal;
\r
575 /* 1.31 with exp 1 */
\r
576 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
\r
577 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
\r
583 /* return num of signbits of out = 1/in value */
\r
584 return (signBits + 1u);
\r
589 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
\r
591 static __INLINE uint32_t arm_recip_q15(
\r
594 q15_t * pRecipTable)
\r
597 uint32_t out = 0, tempVal = 0;
\r
598 uint32_t index = 0, i = 0;
\r
599 uint32_t signBits = 0;
\r
603 signBits = __CLZ(in) - 17;
\r
607 signBits = __CLZ(-in) - 17;
\r
610 /* Convert input sample to 1.15 format */
\r
611 in = in << signBits;
\r
613 /* calculation of index for initial approximated Val */
\r
615 index = (index & INDEX_MASK);
\r
617 /* 1.15 with exp 1 */
\r
618 out = pRecipTable[index];
\r
620 /* calculation of reciprocal value */
\r
621 /* running approximation for two iterations */
\r
622 for (i = 0; i < 2; i++)
\r
624 tempVal = (q15_t) (((q31_t) in * out) >> 15);
\r
625 tempVal = 0x7FFF - tempVal;
\r
626 /* 1.15 with exp 1 */
\r
627 out = (q15_t) (((q31_t) out * tempVal) >> 14);
\r
633 /* return num of signbits of out = 1/in value */
\r
634 return (signBits + 1);
\r
640 * @brief C custom defined intrinisic function for only M0 processors
\r
642 #if defined(ARM_MATH_CM0_FAMILY)
\r
644 static __INLINE q31_t __SSAT(
\r
648 int32_t posMax, negMin;
\r
652 for (i = 0; i < (y - 1); i++)
\r
654 posMax = posMax * 2;
\r
659 posMax = (posMax - 1);
\r
680 #endif /* end of ARM_MATH_CM0_FAMILY */
\r
685 * @brief C custom defined intrinsic function for M3 and M0 processors
\r
687 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
690 * @brief C custom defined QADD8 for M3 and M0 processors
\r
692 static __INLINE q31_t __QADD8(
\r
703 r = __SSAT((q31_t) (r + s), 8);
\r
704 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
\r
705 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
\r
706 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
\r
709 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
\r
710 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
\r
717 * @brief C custom defined QSUB8 for M3 and M0 processors
\r
719 static __INLINE q31_t __QSUB8(
\r
730 r = __SSAT((r - s), 8);
\r
731 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
\r
732 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
\r
733 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
\r
736 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
\r
743 * @brief C custom defined QADD16 for M3 and M0 processors
\r
747 * @brief C custom defined QADD16 for M3 and M0 processors
\r
749 static __INLINE q31_t __QADD16(
\r
760 r = __SSAT(r + s, 16);
\r
761 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
\r
763 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
770 * @brief C custom defined SHADD16 for M3 and M0 processors
\r
772 static __INLINE q31_t __SHADD16(
\r
783 r = ((r >> 1) + (s >> 1));
\r
784 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
\r
786 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
793 * @brief C custom defined QSUB16 for M3 and M0 processors
\r
795 static __INLINE q31_t __QSUB16(
\r
806 r = __SSAT(r - s, 16);
\r
807 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
\r
809 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
815 * @brief C custom defined SHSUB16 for M3 and M0 processors
\r
817 static __INLINE q31_t __SHSUB16(
\r
828 r = ((r >> 1) - (s >> 1));
\r
829 s = (((x >> 17) - (y >> 17)) << 16);
\r
831 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
837 * @brief C custom defined QASX for M3 and M0 processors
\r
839 static __INLINE q31_t __QASX(
\r
848 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
\r
849 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
\r
855 * @brief C custom defined SHASX for M3 and M0 processors
\r
857 static __INLINE q31_t __SHASX(
\r
868 r = ((r >> 1) - (y >> 17));
\r
869 s = (((x >> 17) + (s >> 1)) << 16);
\r
871 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
878 * @brief C custom defined QSAX for M3 and M0 processors
\r
880 static __INLINE q31_t __QSAX(
\r
889 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
\r
890 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
\r
896 * @brief C custom defined SHSAX for M3 and M0 processors
\r
898 static __INLINE q31_t __SHSAX(
\r
909 r = ((r >> 1) + (y >> 17));
\r
910 s = (((x >> 17) - (s >> 1)) << 16);
\r
912 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
918 * @brief C custom defined SMUSDX for M3 and M0 processors
\r
920 static __INLINE q31_t __SMUSDX(
\r
925 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
\r
926 ((q15_t) (x >> 16) * (q15_t) y)));
\r
930 * @brief C custom defined SMUADX for M3 and M0 processors
\r
932 static __INLINE q31_t __SMUADX(
\r
937 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
\r
938 ((q15_t) (x >> 16) * (q15_t) y)));
\r
942 * @brief C custom defined QADD for M3 and M0 processors
\r
944 static __INLINE q31_t __QADD(
\r
948 return clip_q63_to_q31((q63_t) x + y);
\r
952 * @brief C custom defined QSUB for M3 and M0 processors
\r
954 static __INLINE q31_t __QSUB(
\r
958 return clip_q63_to_q31((q63_t) x - y);
\r
962 * @brief C custom defined SMLAD for M3 and M0 processors
\r
964 static __INLINE q31_t __SMLAD(
\r
970 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
971 ((q15_t) x * (q15_t) y));
\r
975 * @brief C custom defined SMLADX for M3 and M0 processors
\r
977 static __INLINE q31_t __SMLADX(
\r
983 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
984 ((q15_t) x * (q15_t) (y >> 16)));
\r
988 * @brief C custom defined SMLSDX for M3 and M0 processors
\r
990 static __INLINE q31_t __SMLSDX(
\r
996 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
997 ((q15_t) x * (q15_t) (y >> 16)));
\r
1001 * @brief C custom defined SMLALD for M3 and M0 processors
\r
1003 static __INLINE q63_t __SMLALD(
\r
1009 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
1010 ((q15_t) x * (q15_t) y));
\r
1014 * @brief C custom defined SMLALDX for M3 and M0 processors
\r
1016 static __INLINE q63_t __SMLALDX(
\r
1022 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
\r
1023 ((q15_t) x * (q15_t) (y >> 16));
\r
1027 * @brief C custom defined SMUAD for M3 and M0 processors
\r
1029 static __INLINE q31_t __SMUAD(
\r
1034 return (((x >> 16) * (y >> 16)) +
\r
1035 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1039 * @brief C custom defined SMUSD for M3 and M0 processors
\r
1041 static __INLINE q31_t __SMUSD(
\r
1046 return (-((x >> 16) * (y >> 16)) +
\r
1047 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1052 * @brief C custom defined SXTB16 for M3 and M0 processors
\r
1054 static __INLINE q31_t __SXTB16(
\r
1058 return ((((x << 24) >> 24) & 0x0000FFFF) |
\r
1059 (((x << 8) >> 8) & 0xFFFF0000));
\r
1063 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
1067 * @brief Instance structure for the Q7 FIR filter.
\r
1071 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1072 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1073 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1074 } arm_fir_instance_q7;
\r
1077 * @brief Instance structure for the Q15 FIR filter.
\r
1081 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1082 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1083 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1084 } arm_fir_instance_q15;
\r
1087 * @brief Instance structure for the Q31 FIR filter.
\r
1091 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1092 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1093 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1094 } arm_fir_instance_q31;
\r
1097 * @brief Instance structure for the floating-point FIR filter.
\r
1101 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1102 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1103 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1104 } arm_fir_instance_f32;
\r
1108 * @brief Processing function for the Q7 FIR filter.
\r
1109 * @param[in] *S points to an instance of the Q7 FIR filter structure.
\r
1110 * @param[in] *pSrc points to the block of input data.
\r
1111 * @param[out] *pDst points to the block of output data.
\r
1112 * @param[in] blockSize number of samples to process.
\r
1116 const arm_fir_instance_q7 * S,
\r
1119 uint32_t blockSize);
\r
1123 * @brief Initialization function for the Q7 FIR filter.
\r
1124 * @param[in,out] *S points to an instance of the Q7 FIR structure.
\r
1125 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1126 * @param[in] *pCoeffs points to the filter coefficients.
\r
1127 * @param[in] *pState points to the state buffer.
\r
1128 * @param[in] blockSize number of samples that are processed.
\r
1131 void arm_fir_init_q7(
\r
1132 arm_fir_instance_q7 * S,
\r
1136 uint32_t blockSize);
\r
1140 * @brief Processing function for the Q15 FIR filter.
\r
1141 * @param[in] *S points to an instance of the Q15 FIR structure.
\r
1142 * @param[in] *pSrc points to the block of input data.
\r
1143 * @param[out] *pDst points to the block of output data.
\r
1144 * @param[in] blockSize number of samples to process.
\r
1148 const arm_fir_instance_q15 * S,
\r
1151 uint32_t blockSize);
\r
1154 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
\r
1155 * @param[in] *S points to an instance of the Q15 FIR filter structure.
\r
1156 * @param[in] *pSrc points to the block of input data.
\r
1157 * @param[out] *pDst points to the block of output data.
\r
1158 * @param[in] blockSize number of samples to process.
\r
1161 void arm_fir_fast_q15(
\r
1162 const arm_fir_instance_q15 * S,
\r
1165 uint32_t blockSize);
\r
1168 * @brief Initialization function for the Q15 FIR filter.
\r
1169 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
\r
1170 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
\r
1171 * @param[in] *pCoeffs points to the filter coefficients.
\r
1172 * @param[in] *pState points to the state buffer.
\r
1173 * @param[in] blockSize number of samples that are processed at a time.
\r
1174 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
\r
1175 * <code>numTaps</code> is not a supported value.
\r
1178 arm_status arm_fir_init_q15(
\r
1179 arm_fir_instance_q15 * S,
\r
1183 uint32_t blockSize);
\r
1186 * @brief Processing function for the Q31 FIR filter.
\r
1187 * @param[in] *S points to an instance of the Q31 FIR filter structure.
\r
1188 * @param[in] *pSrc points to the block of input data.
\r
1189 * @param[out] *pDst points to the block of output data.
\r
1190 * @param[in] blockSize number of samples to process.
\r
1194 const arm_fir_instance_q31 * S,
\r
1197 uint32_t blockSize);
\r
1200 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
\r
1201 * @param[in] *S points to an instance of the Q31 FIR structure.
\r
1202 * @param[in] *pSrc points to the block of input data.
\r
1203 * @param[out] *pDst points to the block of output data.
\r
1204 * @param[in] blockSize number of samples to process.
\r
1207 void arm_fir_fast_q31(
\r
1208 const arm_fir_instance_q31 * S,
\r
1211 uint32_t blockSize);
\r
1214 * @brief Initialization function for the Q31 FIR filter.
\r
1215 * @param[in,out] *S points to an instance of the Q31 FIR structure.
\r
1216 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1217 * @param[in] *pCoeffs points to the filter coefficients.
\r
1218 * @param[in] *pState points to the state buffer.
\r
1219 * @param[in] blockSize number of samples that are processed at a time.
\r
1222 void arm_fir_init_q31(
\r
1223 arm_fir_instance_q31 * S,
\r
1227 uint32_t blockSize);
\r
1230 * @brief Processing function for the floating-point FIR filter.
\r
1231 * @param[in] *S points to an instance of the floating-point FIR structure.
\r
1232 * @param[in] *pSrc points to the block of input data.
\r
1233 * @param[out] *pDst points to the block of output data.
\r
1234 * @param[in] blockSize number of samples to process.
\r
1238 const arm_fir_instance_f32 * S,
\r
1241 uint32_t blockSize);
\r
1244 * @brief Initialization function for the floating-point FIR filter.
\r
1245 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
\r
1246 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1247 * @param[in] *pCoeffs points to the filter coefficients.
\r
1248 * @param[in] *pState points to the state buffer.
\r
1249 * @param[in] blockSize number of samples that are processed at a time.
\r
1252 void arm_fir_init_f32(
\r
1253 arm_fir_instance_f32 * S,
\r
1255 float32_t * pCoeffs,
\r
1256 float32_t * pState,
\r
1257 uint32_t blockSize);
\r
1261 * @brief Instance structure for the Q15 Biquad cascade filter.
\r
1265 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1266 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1267 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1268 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1270 } arm_biquad_casd_df1_inst_q15;
\r
1274 * @brief Instance structure for the Q31 Biquad cascade filter.
\r
1278 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1279 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1280 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1281 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1283 } arm_biquad_casd_df1_inst_q31;
\r
1286 * @brief Instance structure for the floating-point Biquad cascade filter.
\r
1290 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1291 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1292 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1295 } arm_biquad_casd_df1_inst_f32;
\r
1300 * @brief Processing function for the Q15 Biquad cascade filter.
\r
1301 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1302 * @param[in] *pSrc points to the block of input data.
\r
1303 * @param[out] *pDst points to the block of output data.
\r
1304 * @param[in] blockSize number of samples to process.
\r
1308 void arm_biquad_cascade_df1_q15(
\r
1309 const arm_biquad_casd_df1_inst_q15 * S,
\r
1312 uint32_t blockSize);
\r
1315 * @brief Initialization function for the Q15 Biquad cascade filter.
\r
1316 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
\r
1317 * @param[in] numStages number of 2nd order stages in the filter.
\r
1318 * @param[in] *pCoeffs points to the filter coefficients.
\r
1319 * @param[in] *pState points to the state buffer.
\r
1320 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1324 void arm_biquad_cascade_df1_init_q15(
\r
1325 arm_biquad_casd_df1_inst_q15 * S,
\r
1326 uint8_t numStages,
\r
1329 int8_t postShift);
\r
1333 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1334 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1335 * @param[in] *pSrc points to the block of input data.
\r
1336 * @param[out] *pDst points to the block of output data.
\r
1337 * @param[in] blockSize number of samples to process.
\r
1341 void arm_biquad_cascade_df1_fast_q15(
\r
1342 const arm_biquad_casd_df1_inst_q15 * S,
\r
1345 uint32_t blockSize);
\r
1349 * @brief Processing function for the Q31 Biquad cascade filter
\r
1350 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1351 * @param[in] *pSrc points to the block of input data.
\r
1352 * @param[out] *pDst points to the block of output data.
\r
1353 * @param[in] blockSize number of samples to process.
\r
1357 void arm_biquad_cascade_df1_q31(
\r
1358 const arm_biquad_casd_df1_inst_q31 * S,
\r
1361 uint32_t blockSize);
\r
1364 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1365 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1366 * @param[in] *pSrc points to the block of input data.
\r
1367 * @param[out] *pDst points to the block of output data.
\r
1368 * @param[in] blockSize number of samples to process.
\r
1372 void arm_biquad_cascade_df1_fast_q31(
\r
1373 const arm_biquad_casd_df1_inst_q31 * S,
\r
1376 uint32_t blockSize);
\r
1379 * @brief Initialization function for the Q31 Biquad cascade filter.
\r
1380 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
\r
1381 * @param[in] numStages number of 2nd order stages in the filter.
\r
1382 * @param[in] *pCoeffs points to the filter coefficients.
\r
1383 * @param[in] *pState points to the state buffer.
\r
1384 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1388 void arm_biquad_cascade_df1_init_q31(
\r
1389 arm_biquad_casd_df1_inst_q31 * S,
\r
1390 uint8_t numStages,
\r
1393 int8_t postShift);
\r
1396 * @brief Processing function for the floating-point Biquad cascade filter.
\r
1397 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
\r
1398 * @param[in] *pSrc points to the block of input data.
\r
1399 * @param[out] *pDst points to the block of output data.
\r
1400 * @param[in] blockSize number of samples to process.
\r
1404 void arm_biquad_cascade_df1_f32(
\r
1405 const arm_biquad_casd_df1_inst_f32 * S,
\r
1408 uint32_t blockSize);
\r
1411 * @brief Initialization function for the floating-point Biquad cascade filter.
\r
1412 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
\r
1413 * @param[in] numStages number of 2nd order stages in the filter.
\r
1414 * @param[in] *pCoeffs points to the filter coefficients.
\r
1415 * @param[in] *pState points to the state buffer.
\r
1419 void arm_biquad_cascade_df1_init_f32(
\r
1420 arm_biquad_casd_df1_inst_f32 * S,
\r
1421 uint8_t numStages,
\r
1422 float32_t * pCoeffs,
\r
1423 float32_t * pState);
\r
1427 * @brief Instance structure for the floating-point matrix structure.
\r
1432 uint16_t numRows; /**< number of rows of the matrix. */
\r
1433 uint16_t numCols; /**< number of columns of the matrix. */
\r
1434 float32_t *pData; /**< points to the data of the matrix. */
\r
1435 } arm_matrix_instance_f32;
\r
1438 * @brief Instance structure for the Q15 matrix structure.
\r
1443 uint16_t numRows; /**< number of rows of the matrix. */
\r
1444 uint16_t numCols; /**< number of columns of the matrix. */
\r
1445 q15_t *pData; /**< points to the data of the matrix. */
\r
1447 } arm_matrix_instance_q15;
\r
1450 * @brief Instance structure for the Q31 matrix structure.
\r
1455 uint16_t numRows; /**< number of rows of the matrix. */
\r
1456 uint16_t numCols; /**< number of columns of the matrix. */
\r
1457 q31_t *pData; /**< points to the data of the matrix. */
\r
1459 } arm_matrix_instance_q31;
\r
1464 * @brief Floating-point matrix addition.
\r
1465 * @param[in] *pSrcA points to the first input matrix structure
\r
1466 * @param[in] *pSrcB points to the second input matrix structure
\r
1467 * @param[out] *pDst points to output matrix structure
\r
1468 * @return The function returns either
\r
1469 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1472 arm_status arm_mat_add_f32(
\r
1473 const arm_matrix_instance_f32 * pSrcA,
\r
1474 const arm_matrix_instance_f32 * pSrcB,
\r
1475 arm_matrix_instance_f32 * pDst);
\r
1478 * @brief Q15 matrix addition.
\r
1479 * @param[in] *pSrcA points to the first input matrix structure
\r
1480 * @param[in] *pSrcB points to the second input matrix structure
\r
1481 * @param[out] *pDst points to output matrix structure
\r
1482 * @return The function returns either
\r
1483 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1486 arm_status arm_mat_add_q15(
\r
1487 const arm_matrix_instance_q15 * pSrcA,
\r
1488 const arm_matrix_instance_q15 * pSrcB,
\r
1489 arm_matrix_instance_q15 * pDst);
\r
1492 * @brief Q31 matrix addition.
\r
1493 * @param[in] *pSrcA points to the first input matrix structure
\r
1494 * @param[in] *pSrcB points to the second input matrix structure
\r
1495 * @param[out] *pDst points to output matrix structure
\r
1496 * @return The function returns either
\r
1497 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1500 arm_status arm_mat_add_q31(
\r
1501 const arm_matrix_instance_q31 * pSrcA,
\r
1502 const arm_matrix_instance_q31 * pSrcB,
\r
1503 arm_matrix_instance_q31 * pDst);
\r
1506 * @brief Floating-point, complex, matrix multiplication.
\r
1507 * @param[in] *pSrcA points to the first input matrix structure
\r
1508 * @param[in] *pSrcB points to the second input matrix structure
\r
1509 * @param[out] *pDst points to output matrix structure
\r
1510 * @return The function returns either
\r
1511 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1514 arm_status arm_mat_cmplx_mult_f32(
\r
1515 const arm_matrix_instance_f32 * pSrcA,
\r
1516 const arm_matrix_instance_f32 * pSrcB,
\r
1517 arm_matrix_instance_f32 * pDst);
\r
1520 * @brief Q15, complex, matrix multiplication.
\r
1521 * @param[in] *pSrcA points to the first input matrix structure
\r
1522 * @param[in] *pSrcB points to the second input matrix structure
\r
1523 * @param[out] *pDst points to output matrix structure
\r
1524 * @return The function returns either
\r
1525 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1528 arm_status arm_mat_cmplx_mult_q15(
\r
1529 const arm_matrix_instance_q15 * pSrcA,
\r
1530 const arm_matrix_instance_q15 * pSrcB,
\r
1531 arm_matrix_instance_q15 * pDst,
\r
1532 q15_t * pScratch);
\r
1535 * @brief Q31, complex, matrix multiplication.
\r
1536 * @param[in] *pSrcA points to the first input matrix structure
\r
1537 * @param[in] *pSrcB points to the second input matrix structure
\r
1538 * @param[out] *pDst points to output matrix structure
\r
1539 * @return The function returns either
\r
1540 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1543 arm_status arm_mat_cmplx_mult_q31(
\r
1544 const arm_matrix_instance_q31 * pSrcA,
\r
1545 const arm_matrix_instance_q31 * pSrcB,
\r
1546 arm_matrix_instance_q31 * pDst);
\r
1550 * @brief Floating-point matrix transpose.
\r
1551 * @param[in] *pSrc points to the input matrix
\r
1552 * @param[out] *pDst points to the output matrix
\r
1553 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1554 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1557 arm_status arm_mat_trans_f32(
\r
1558 const arm_matrix_instance_f32 * pSrc,
\r
1559 arm_matrix_instance_f32 * pDst);
\r
1563 * @brief Q15 matrix transpose.
\r
1564 * @param[in] *pSrc points to the input matrix
\r
1565 * @param[out] *pDst points to the output matrix
\r
1566 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1567 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1570 arm_status arm_mat_trans_q15(
\r
1571 const arm_matrix_instance_q15 * pSrc,
\r
1572 arm_matrix_instance_q15 * pDst);
\r
1575 * @brief Q31 matrix transpose.
\r
1576 * @param[in] *pSrc points to the input matrix
\r
1577 * @param[out] *pDst points to the output matrix
\r
1578 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1579 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1582 arm_status arm_mat_trans_q31(
\r
1583 const arm_matrix_instance_q31 * pSrc,
\r
1584 arm_matrix_instance_q31 * pDst);
\r
1588 * @brief Floating-point matrix multiplication
\r
1589 * @param[in] *pSrcA points to the first input matrix structure
\r
1590 * @param[in] *pSrcB points to the second input matrix structure
\r
1591 * @param[out] *pDst points to output matrix structure
\r
1592 * @return The function returns either
\r
1593 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1596 arm_status arm_mat_mult_f32(
\r
1597 const arm_matrix_instance_f32 * pSrcA,
\r
1598 const arm_matrix_instance_f32 * pSrcB,
\r
1599 arm_matrix_instance_f32 * pDst);
\r
1602 * @brief Q15 matrix multiplication
\r
1603 * @param[in] *pSrcA points to the first input matrix structure
\r
1604 * @param[in] *pSrcB points to the second input matrix structure
\r
1605 * @param[out] *pDst points to output matrix structure
\r
1606 * @param[in] *pState points to the array for storing intermediate results
\r
1607 * @return The function returns either
\r
1608 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1611 arm_status arm_mat_mult_q15(
\r
1612 const arm_matrix_instance_q15 * pSrcA,
\r
1613 const arm_matrix_instance_q15 * pSrcB,
\r
1614 arm_matrix_instance_q15 * pDst,
\r
1618 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1619 * @param[in] *pSrcA points to the first input matrix structure
\r
1620 * @param[in] *pSrcB points to the second input matrix structure
\r
1621 * @param[out] *pDst points to output matrix structure
\r
1622 * @param[in] *pState points to the array for storing intermediate results
\r
1623 * @return The function returns either
\r
1624 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1627 arm_status arm_mat_mult_fast_q15(
\r
1628 const arm_matrix_instance_q15 * pSrcA,
\r
1629 const arm_matrix_instance_q15 * pSrcB,
\r
1630 arm_matrix_instance_q15 * pDst,
\r
1634 * @brief Q31 matrix multiplication
\r
1635 * @param[in] *pSrcA points to the first input matrix structure
\r
1636 * @param[in] *pSrcB points to the second input matrix structure
\r
1637 * @param[out] *pDst points to output matrix structure
\r
1638 * @return The function returns either
\r
1639 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1642 arm_status arm_mat_mult_q31(
\r
1643 const arm_matrix_instance_q31 * pSrcA,
\r
1644 const arm_matrix_instance_q31 * pSrcB,
\r
1645 arm_matrix_instance_q31 * pDst);
\r
1648 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1649 * @param[in] *pSrcA points to the first input matrix structure
\r
1650 * @param[in] *pSrcB points to the second input matrix structure
\r
1651 * @param[out] *pDst points to output matrix structure
\r
1652 * @return The function returns either
\r
1653 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1656 arm_status arm_mat_mult_fast_q31(
\r
1657 const arm_matrix_instance_q31 * pSrcA,
\r
1658 const arm_matrix_instance_q31 * pSrcB,
\r
1659 arm_matrix_instance_q31 * pDst);
\r
1663 * @brief Floating-point matrix subtraction
\r
1664 * @param[in] *pSrcA points to the first input matrix structure
\r
1665 * @param[in] *pSrcB points to the second input matrix structure
\r
1666 * @param[out] *pDst points to output matrix structure
\r
1667 * @return The function returns either
\r
1668 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1671 arm_status arm_mat_sub_f32(
\r
1672 const arm_matrix_instance_f32 * pSrcA,
\r
1673 const arm_matrix_instance_f32 * pSrcB,
\r
1674 arm_matrix_instance_f32 * pDst);
\r
1677 * @brief Q15 matrix subtraction
\r
1678 * @param[in] *pSrcA points to the first input matrix structure
\r
1679 * @param[in] *pSrcB points to the second input matrix structure
\r
1680 * @param[out] *pDst points to output matrix structure
\r
1681 * @return The function returns either
\r
1682 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1685 arm_status arm_mat_sub_q15(
\r
1686 const arm_matrix_instance_q15 * pSrcA,
\r
1687 const arm_matrix_instance_q15 * pSrcB,
\r
1688 arm_matrix_instance_q15 * pDst);
\r
1691 * @brief Q31 matrix subtraction
\r
1692 * @param[in] *pSrcA points to the first input matrix structure
\r
1693 * @param[in] *pSrcB points to the second input matrix structure
\r
1694 * @param[out] *pDst points to output matrix structure
\r
1695 * @return The function returns either
\r
1696 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1699 arm_status arm_mat_sub_q31(
\r
1700 const arm_matrix_instance_q31 * pSrcA,
\r
1701 const arm_matrix_instance_q31 * pSrcB,
\r
1702 arm_matrix_instance_q31 * pDst);
\r
1705 * @brief Floating-point matrix scaling.
\r
1706 * @param[in] *pSrc points to the input matrix
\r
1707 * @param[in] scale scale factor
\r
1708 * @param[out] *pDst points to the output matrix
\r
1709 * @return The function returns either
\r
1710 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1713 arm_status arm_mat_scale_f32(
\r
1714 const arm_matrix_instance_f32 * pSrc,
\r
1716 arm_matrix_instance_f32 * pDst);
\r
1719 * @brief Q15 matrix scaling.
\r
1720 * @param[in] *pSrc points to input matrix
\r
1721 * @param[in] scaleFract fractional portion of the scale factor
\r
1722 * @param[in] shift number of bits to shift the result by
\r
1723 * @param[out] *pDst points to output matrix
\r
1724 * @return The function returns either
\r
1725 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1728 arm_status arm_mat_scale_q15(
\r
1729 const arm_matrix_instance_q15 * pSrc,
\r
1732 arm_matrix_instance_q15 * pDst);
\r
1735 * @brief Q31 matrix scaling.
\r
1736 * @param[in] *pSrc points to input matrix
\r
1737 * @param[in] scaleFract fractional portion of the scale factor
\r
1738 * @param[in] shift number of bits to shift the result by
\r
1739 * @param[out] *pDst points to output matrix structure
\r
1740 * @return The function returns either
\r
1741 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1744 arm_status arm_mat_scale_q31(
\r
1745 const arm_matrix_instance_q31 * pSrc,
\r
1748 arm_matrix_instance_q31 * pDst);
\r
1752 * @brief Q31 matrix initialization.
\r
1753 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1754 * @param[in] nRows number of rows in the matrix.
\r
1755 * @param[in] nColumns number of columns in the matrix.
\r
1756 * @param[in] *pData points to the matrix data array.
\r
1760 void arm_mat_init_q31(
\r
1761 arm_matrix_instance_q31 * S,
\r
1763 uint16_t nColumns,
\r
1767 * @brief Q15 matrix initialization.
\r
1768 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1769 * @param[in] nRows number of rows in the matrix.
\r
1770 * @param[in] nColumns number of columns in the matrix.
\r
1771 * @param[in] *pData points to the matrix data array.
\r
1775 void arm_mat_init_q15(
\r
1776 arm_matrix_instance_q15 * S,
\r
1778 uint16_t nColumns,
\r
1782 * @brief Floating-point matrix initialization.
\r
1783 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1784 * @param[in] nRows number of rows in the matrix.
\r
1785 * @param[in] nColumns number of columns in the matrix.
\r
1786 * @param[in] *pData points to the matrix data array.
\r
1790 void arm_mat_init_f32(
\r
1791 arm_matrix_instance_f32 * S,
\r
1793 uint16_t nColumns,
\r
1794 float32_t * pData);
\r
1799 * @brief Instance structure for the Q15 PID Control.
\r
1803 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1804 #ifdef ARM_MATH_CM0_FAMILY
\r
1808 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
\r
1810 q15_t state[3]; /**< The state array of length 3. */
\r
1811 q15_t Kp; /**< The proportional gain. */
\r
1812 q15_t Ki; /**< The integral gain. */
\r
1813 q15_t Kd; /**< The derivative gain. */
\r
1814 } arm_pid_instance_q15;
\r
1817 * @brief Instance structure for the Q31 PID Control.
\r
1821 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1822 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1823 q31_t A2; /**< The derived gain, A2 = Kd . */
\r
1824 q31_t state[3]; /**< The state array of length 3. */
\r
1825 q31_t Kp; /**< The proportional gain. */
\r
1826 q31_t Ki; /**< The integral gain. */
\r
1827 q31_t Kd; /**< The derivative gain. */
\r
1829 } arm_pid_instance_q31;
\r
1832 * @brief Instance structure for the floating-point PID Control.
\r
1836 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1837 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1838 float32_t A2; /**< The derived gain, A2 = Kd . */
\r
1839 float32_t state[3]; /**< The state array of length 3. */
\r
1840 float32_t Kp; /**< The proportional gain. */
\r
1841 float32_t Ki; /**< The integral gain. */
\r
1842 float32_t Kd; /**< The derivative gain. */
\r
1843 } arm_pid_instance_f32;
\r
1848 * @brief Initialization function for the floating-point PID Control.
\r
1849 * @param[in,out] *S points to an instance of the PID structure.
\r
1850 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1853 void arm_pid_init_f32(
\r
1854 arm_pid_instance_f32 * S,
\r
1855 int32_t resetStateFlag);
\r
1858 * @brief Reset function for the floating-point PID Control.
\r
1859 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
1862 void arm_pid_reset_f32(
\r
1863 arm_pid_instance_f32 * S);
\r
1867 * @brief Initialization function for the Q31 PID Control.
\r
1868 * @param[in,out] *S points to an instance of the Q15 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_q31(
\r
1873 arm_pid_instance_q31 * S,
\r
1874 int32_t resetStateFlag);
\r
1878 * @brief Reset function for the Q31 PID Control.
\r
1879 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
1883 void arm_pid_reset_q31(
\r
1884 arm_pid_instance_q31 * S);
\r
1887 * @brief Initialization function for the Q15 PID Control.
\r
1888 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1889 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1892 void arm_pid_init_q15(
\r
1893 arm_pid_instance_q15 * S,
\r
1894 int32_t resetStateFlag);
\r
1897 * @brief Reset function for the Q15 PID Control.
\r
1898 * @param[in,out] *S points to an instance of the q15 PID Control structure
\r
1901 void arm_pid_reset_q15(
\r
1902 arm_pid_instance_q15 * S);
\r
1906 * @brief Instance structure for the floating-point Linear Interpolate function.
\r
1910 uint32_t nValues; /**< nValues */
\r
1911 float32_t x1; /**< x1 */
\r
1912 float32_t xSpacing; /**< xSpacing */
\r
1913 float32_t *pYData; /**< pointer to the table of Y values */
\r
1914 } arm_linear_interp_instance_f32;
\r
1917 * @brief Instance structure for the floating-point bilinear interpolation function.
\r
1922 uint16_t numRows; /**< number of rows in the data table. */
\r
1923 uint16_t numCols; /**< number of columns in the data table. */
\r
1924 float32_t *pData; /**< points to the data table. */
\r
1925 } arm_bilinear_interp_instance_f32;
\r
1928 * @brief Instance structure for the Q31 bilinear interpolation function.
\r
1933 uint16_t numRows; /**< number of rows in the data table. */
\r
1934 uint16_t numCols; /**< number of columns in the data table. */
\r
1935 q31_t *pData; /**< points to the data table. */
\r
1936 } arm_bilinear_interp_instance_q31;
\r
1939 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1944 uint16_t numRows; /**< number of rows in the data table. */
\r
1945 uint16_t numCols; /**< number of columns in the data table. */
\r
1946 q15_t *pData; /**< points to the data table. */
\r
1947 } arm_bilinear_interp_instance_q15;
\r
1950 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1955 uint16_t numRows; /**< number of rows in the data table. */
\r
1956 uint16_t numCols; /**< number of columns in the data table. */
\r
1957 q7_t *pData; /**< points to the data table. */
\r
1958 } arm_bilinear_interp_instance_q7;
\r
1962 * @brief Q7 vector multiplication.
\r
1963 * @param[in] *pSrcA points to the first input vector
\r
1964 * @param[in] *pSrcB points to the second input vector
\r
1965 * @param[out] *pDst points to the output vector
\r
1966 * @param[in] blockSize number of samples in each vector
\r
1974 uint32_t blockSize);
\r
1977 * @brief Q15 vector multiplication.
\r
1978 * @param[in] *pSrcA points to the first input vector
\r
1979 * @param[in] *pSrcB points to the second input vector
\r
1980 * @param[out] *pDst points to the output vector
\r
1981 * @param[in] blockSize number of samples in each vector
\r
1985 void arm_mult_q15(
\r
1989 uint32_t blockSize);
\r
1992 * @brief Q31 vector multiplication.
\r
1993 * @param[in] *pSrcA points to the first input vector
\r
1994 * @param[in] *pSrcB points to the second input vector
\r
1995 * @param[out] *pDst points to the output vector
\r
1996 * @param[in] blockSize number of samples in each vector
\r
2000 void arm_mult_q31(
\r
2004 uint32_t blockSize);
\r
2007 * @brief Floating-point vector multiplication.
\r
2008 * @param[in] *pSrcA points to the first input vector
\r
2009 * @param[in] *pSrcB points to the second input vector
\r
2010 * @param[out] *pDst points to the output vector
\r
2011 * @param[in] blockSize number of samples in each vector
\r
2015 void arm_mult_f32(
\r
2016 float32_t * pSrcA,
\r
2017 float32_t * pSrcB,
\r
2019 uint32_t blockSize);
\r
2027 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2032 uint16_t fftLen; /**< length of the FFT. */
\r
2033 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2034 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2035 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
\r
2036 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2037 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2038 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2039 } arm_cfft_radix2_instance_q15;
\r
2041 arm_status arm_cfft_radix2_init_q15(
\r
2042 arm_cfft_radix2_instance_q15 * S,
\r
2045 uint8_t bitReverseFlag);
\r
2047 void arm_cfft_radix2_q15(
\r
2048 const arm_cfft_radix2_instance_q15 * S,
\r
2054 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2059 uint16_t fftLen; /**< length of the FFT. */
\r
2060 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2061 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2062 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2063 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2064 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2065 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2066 } arm_cfft_radix4_instance_q15;
\r
2068 arm_status arm_cfft_radix4_init_q15(
\r
2069 arm_cfft_radix4_instance_q15 * S,
\r
2072 uint8_t bitReverseFlag);
\r
2074 void arm_cfft_radix4_q15(
\r
2075 const arm_cfft_radix4_instance_q15 * S,
\r
2079 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
\r
2084 uint16_t fftLen; /**< length of the FFT. */
\r
2085 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2086 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2087 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2088 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2089 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2090 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2091 } arm_cfft_radix2_instance_q31;
\r
2093 arm_status arm_cfft_radix2_init_q31(
\r
2094 arm_cfft_radix2_instance_q31 * S,
\r
2097 uint8_t bitReverseFlag);
\r
2099 void arm_cfft_radix2_q31(
\r
2100 const arm_cfft_radix2_instance_q31 * S,
\r
2104 * @brief Instance structure for the Q31 CFFT/CIFFT function.
\r
2109 uint16_t fftLen; /**< length of the FFT. */
\r
2110 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2111 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2112 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2113 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2114 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2115 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2116 } arm_cfft_radix4_instance_q31;
\r
2118 void arm_cfft_radix4_q31(
\r
2119 const arm_cfft_radix4_instance_q31 * S,
\r
2122 arm_status arm_cfft_radix4_init_q31(
\r
2123 arm_cfft_radix4_instance_q31 * S,
\r
2126 uint8_t bitReverseFlag);
\r
2129 * @brief Instance structure for the floating-point 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 float32_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 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2142 } arm_cfft_radix2_instance_f32;
\r
2145 arm_status arm_cfft_radix2_init_f32(
\r
2146 arm_cfft_radix2_instance_f32 * S,
\r
2149 uint8_t bitReverseFlag);
\r
2152 void arm_cfft_radix2_f32(
\r
2153 const arm_cfft_radix2_instance_f32 * S,
\r
2154 float32_t * pSrc);
\r
2157 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2162 uint16_t fftLen; /**< length of the FFT. */
\r
2163 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2164 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2165 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2166 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2167 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2168 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2169 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2170 } arm_cfft_radix4_instance_f32;
\r
2173 arm_status arm_cfft_radix4_init_f32(
\r
2174 arm_cfft_radix4_instance_f32 * S,
\r
2177 uint8_t bitReverseFlag);
\r
2180 void arm_cfft_radix4_f32(
\r
2181 const arm_cfft_radix4_instance_f32 * S,
\r
2182 float32_t * pSrc);
\r
2185 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2190 uint16_t fftLen; /**< length of the FFT. */
\r
2191 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2192 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2193 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2194 } arm_cfft_instance_f32;
\r
2196 void arm_cfft_f32(
\r
2197 const arm_cfft_instance_f32 * S,
\r
2200 uint8_t bitReverseFlag);
\r
2203 * @brief Instance structure for the Q15 RFFT/RIFFT function.
\r
2208 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2209 uint32_t fftLenBy2; /**< length of the complex FFT. */
\r
2210 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2211 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2212 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2213 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2214 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2215 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2216 } arm_rfft_instance_q15;
\r
2218 arm_status arm_rfft_init_q15(
\r
2219 arm_rfft_instance_q15 * S,
\r
2220 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2221 uint32_t fftLenReal,
\r
2222 uint32_t ifftFlagR,
\r
2223 uint32_t bitReverseFlag);
\r
2225 void arm_rfft_q15(
\r
2226 const arm_rfft_instance_q15 * S,
\r
2231 * @brief Instance structure for the Q31 RFFT/RIFFT function.
\r
2236 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2237 uint32_t fftLenBy2; /**< length of the complex FFT. */
\r
2238 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2239 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2240 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2241 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2242 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2243 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2244 } arm_rfft_instance_q31;
\r
2246 arm_status arm_rfft_init_q31(
\r
2247 arm_rfft_instance_q31 * S,
\r
2248 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2249 uint32_t fftLenReal,
\r
2250 uint32_t ifftFlagR,
\r
2251 uint32_t bitReverseFlag);
\r
2253 void arm_rfft_q31(
\r
2254 const arm_rfft_instance_q31 * S,
\r
2259 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2264 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2265 uint16_t fftLenBy2; /**< length of the complex FFT. */
\r
2266 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2267 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2268 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2269 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2270 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2271 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2272 } arm_rfft_instance_f32;
\r
2274 arm_status arm_rfft_init_f32(
\r
2275 arm_rfft_instance_f32 * S,
\r
2276 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2277 uint32_t fftLenReal,
\r
2278 uint32_t ifftFlagR,
\r
2279 uint32_t bitReverseFlag);
\r
2281 void arm_rfft_f32(
\r
2282 const arm_rfft_instance_f32 * S,
\r
2284 float32_t * pDst);
\r
2287 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2292 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
\r
2293 uint16_t fftLenRFFT; /**< length of the real sequence */
\r
2294 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
\r
2295 } arm_rfft_fast_instance_f32 ;
\r
2297 arm_status arm_rfft_fast_init_f32 (
\r
2298 arm_rfft_fast_instance_f32 * S,
\r
2301 void arm_rfft_fast_f32(
\r
2302 arm_rfft_fast_instance_f32 * S,
\r
2303 float32_t * p, float32_t * pOut,
\r
2304 uint8_t ifftFlag);
\r
2307 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
\r
2312 uint16_t N; /**< length of the DCT4. */
\r
2313 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2314 float32_t normalize; /**< normalizing factor. */
\r
2315 float32_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2316 float32_t *pCosFactor; /**< points to the cosFactor table. */
\r
2317 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
\r
2318 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2319 } arm_dct4_instance_f32;
\r
2322 * @brief Initialization function for the floating-point DCT4/IDCT4.
\r
2323 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
\r
2324 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
\r
2325 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
\r
2326 * @param[in] N length of the DCT4.
\r
2327 * @param[in] Nby2 half of the length of the DCT4.
\r
2328 * @param[in] normalize normalizing factor.
\r
2329 * @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
2332 arm_status arm_dct4_init_f32(
\r
2333 arm_dct4_instance_f32 * S,
\r
2334 arm_rfft_instance_f32 * S_RFFT,
\r
2335 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2338 float32_t normalize);
\r
2341 * @brief Processing function for the floating-point DCT4/IDCT4.
\r
2342 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
\r
2343 * @param[in] *pState points to state buffer.
\r
2344 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2348 void arm_dct4_f32(
\r
2349 const arm_dct4_instance_f32 * S,
\r
2350 float32_t * pState,
\r
2351 float32_t * pInlineBuffer);
\r
2354 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
\r
2359 uint16_t N; /**< length of the DCT4. */
\r
2360 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2361 q31_t normalize; /**< normalizing factor. */
\r
2362 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2363 q31_t *pCosFactor; /**< points to the cosFactor table. */
\r
2364 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
\r
2365 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2366 } arm_dct4_instance_q31;
\r
2369 * @brief Initialization function for the Q31 DCT4/IDCT4.
\r
2370 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
\r
2371 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
\r
2372 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
\r
2373 * @param[in] N length of the DCT4.
\r
2374 * @param[in] Nby2 half of the length of the DCT4.
\r
2375 * @param[in] normalize normalizing factor.
\r
2376 * @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
2379 arm_status arm_dct4_init_q31(
\r
2380 arm_dct4_instance_q31 * S,
\r
2381 arm_rfft_instance_q31 * S_RFFT,
\r
2382 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2388 * @brief Processing function for the Q31 DCT4/IDCT4.
\r
2389 * @param[in] *S points to an instance of the Q31 DCT4 structure.
\r
2390 * @param[in] *pState points to state buffer.
\r
2391 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2395 void arm_dct4_q31(
\r
2396 const arm_dct4_instance_q31 * S,
\r
2398 q31_t * pInlineBuffer);
\r
2401 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
\r
2406 uint16_t N; /**< length of the DCT4. */
\r
2407 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2408 q15_t normalize; /**< normalizing factor. */
\r
2409 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2410 q15_t *pCosFactor; /**< points to the cosFactor table. */
\r
2411 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
\r
2412 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2413 } arm_dct4_instance_q15;
\r
2416 * @brief Initialization function for the Q15 DCT4/IDCT4.
\r
2417 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
\r
2418 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
\r
2419 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
\r
2420 * @param[in] N length of the DCT4.
\r
2421 * @param[in] Nby2 half of the length of the DCT4.
\r
2422 * @param[in] normalize normalizing factor.
\r
2423 * @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
2426 arm_status arm_dct4_init_q15(
\r
2427 arm_dct4_instance_q15 * S,
\r
2428 arm_rfft_instance_q15 * S_RFFT,
\r
2429 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2435 * @brief Processing function for the Q15 DCT4/IDCT4.
\r
2436 * @param[in] *S points to an instance of the Q15 DCT4 structure.
\r
2437 * @param[in] *pState points to state buffer.
\r
2438 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2442 void arm_dct4_q15(
\r
2443 const arm_dct4_instance_q15 * S,
\r
2445 q15_t * pInlineBuffer);
\r
2448 * @brief Floating-point vector addition.
\r
2449 * @param[in] *pSrcA points to the first input vector
\r
2450 * @param[in] *pSrcB points to the second input vector
\r
2451 * @param[out] *pDst points to the output vector
\r
2452 * @param[in] blockSize number of samples in each vector
\r
2457 float32_t * pSrcA,
\r
2458 float32_t * pSrcB,
\r
2460 uint32_t blockSize);
\r
2463 * @brief Q7 vector addition.
\r
2464 * @param[in] *pSrcA points to the first input vector
\r
2465 * @param[in] *pSrcB points to the second input vector
\r
2466 * @param[out] *pDst points to the output vector
\r
2467 * @param[in] blockSize number of samples in each vector
\r
2475 uint32_t blockSize);
\r
2478 * @brief Q15 vector addition.
\r
2479 * @param[in] *pSrcA points to the first input vector
\r
2480 * @param[in] *pSrcB points to the second input vector
\r
2481 * @param[out] *pDst points to the output vector
\r
2482 * @param[in] blockSize number of samples in each vector
\r
2490 uint32_t blockSize);
\r
2493 * @brief Q31 vector addition.
\r
2494 * @param[in] *pSrcA points to the first input vector
\r
2495 * @param[in] *pSrcB points to the second input vector
\r
2496 * @param[out] *pDst points to the output vector
\r
2497 * @param[in] blockSize number of samples in each vector
\r
2505 uint32_t blockSize);
\r
2508 * @brief Floating-point vector subtraction.
\r
2509 * @param[in] *pSrcA points to the first input vector
\r
2510 * @param[in] *pSrcB points to the second input vector
\r
2511 * @param[out] *pDst points to the output vector
\r
2512 * @param[in] blockSize number of samples in each vector
\r
2517 float32_t * pSrcA,
\r
2518 float32_t * pSrcB,
\r
2520 uint32_t blockSize);
\r
2523 * @brief Q7 vector subtraction.
\r
2524 * @param[in] *pSrcA points to the first input vector
\r
2525 * @param[in] *pSrcB points to the second input vector
\r
2526 * @param[out] *pDst points to the output vector
\r
2527 * @param[in] blockSize number of samples in each vector
\r
2535 uint32_t blockSize);
\r
2538 * @brief Q15 vector subtraction.
\r
2539 * @param[in] *pSrcA points to the first input vector
\r
2540 * @param[in] *pSrcB points to the second input vector
\r
2541 * @param[out] *pDst points to the output vector
\r
2542 * @param[in] blockSize number of samples in each vector
\r
2550 uint32_t blockSize);
\r
2553 * @brief Q31 vector subtraction.
\r
2554 * @param[in] *pSrcA points to the first input vector
\r
2555 * @param[in] *pSrcB points to the second input vector
\r
2556 * @param[out] *pDst points to the output vector
\r
2557 * @param[in] blockSize number of samples in each vector
\r
2565 uint32_t blockSize);
\r
2568 * @brief Multiplies a floating-point vector by a scalar.
\r
2569 * @param[in] *pSrc points to the input vector
\r
2570 * @param[in] scale scale factor to be applied
\r
2571 * @param[out] *pDst points to the output vector
\r
2572 * @param[in] blockSize number of samples in the vector
\r
2576 void arm_scale_f32(
\r
2580 uint32_t blockSize);
\r
2583 * @brief Multiplies a Q7 vector by a scalar.
\r
2584 * @param[in] *pSrc points to the input vector
\r
2585 * @param[in] scaleFract fractional portion of the scale value
\r
2586 * @param[in] shift number of bits to shift the result by
\r
2587 * @param[out] *pDst points to the output vector
\r
2588 * @param[in] blockSize number of samples in the vector
\r
2592 void arm_scale_q7(
\r
2597 uint32_t blockSize);
\r
2600 * @brief Multiplies a Q15 vector by a scalar.
\r
2601 * @param[in] *pSrc points to the input vector
\r
2602 * @param[in] scaleFract fractional portion of the scale value
\r
2603 * @param[in] shift number of bits to shift the result by
\r
2604 * @param[out] *pDst points to the output vector
\r
2605 * @param[in] blockSize number of samples in the vector
\r
2609 void arm_scale_q15(
\r
2614 uint32_t blockSize);
\r
2617 * @brief Multiplies a Q31 vector by a scalar.
\r
2618 * @param[in] *pSrc points to the input vector
\r
2619 * @param[in] scaleFract fractional portion of the scale value
\r
2620 * @param[in] shift number of bits to shift the result by
\r
2621 * @param[out] *pDst points to the output vector
\r
2622 * @param[in] blockSize number of samples in the vector
\r
2626 void arm_scale_q31(
\r
2631 uint32_t blockSize);
\r
2634 * @brief Q7 vector absolute value.
\r
2635 * @param[in] *pSrc points to the input buffer
\r
2636 * @param[out] *pDst points to the output buffer
\r
2637 * @param[in] blockSize number of samples in each vector
\r
2644 uint32_t blockSize);
\r
2647 * @brief Floating-point vector absolute value.
\r
2648 * @param[in] *pSrc points to the input buffer
\r
2649 * @param[out] *pDst points to the output buffer
\r
2650 * @param[in] blockSize number of samples in each vector
\r
2657 uint32_t blockSize);
\r
2660 * @brief Q15 vector absolute value.
\r
2661 * @param[in] *pSrc points to the input buffer
\r
2662 * @param[out] *pDst points to the output buffer
\r
2663 * @param[in] blockSize number of samples in each vector
\r
2670 uint32_t blockSize);
\r
2673 * @brief Q31 vector absolute value.
\r
2674 * @param[in] *pSrc points to the input buffer
\r
2675 * @param[out] *pDst points to the output buffer
\r
2676 * @param[in] blockSize number of samples in each vector
\r
2683 uint32_t blockSize);
\r
2686 * @brief Dot product of floating-point vectors.
\r
2687 * @param[in] *pSrcA points to the first input vector
\r
2688 * @param[in] *pSrcB points to the second input vector
\r
2689 * @param[in] blockSize number of samples in each vector
\r
2690 * @param[out] *result output result returned here
\r
2694 void arm_dot_prod_f32(
\r
2695 float32_t * pSrcA,
\r
2696 float32_t * pSrcB,
\r
2697 uint32_t blockSize,
\r
2698 float32_t * result);
\r
2701 * @brief Dot product of Q7 vectors.
\r
2702 * @param[in] *pSrcA points to the first input vector
\r
2703 * @param[in] *pSrcB points to the second input vector
\r
2704 * @param[in] blockSize number of samples in each vector
\r
2705 * @param[out] *result output result returned here
\r
2709 void arm_dot_prod_q7(
\r
2712 uint32_t blockSize,
\r
2716 * @brief Dot product of Q15 vectors.
\r
2717 * @param[in] *pSrcA points to the first input vector
\r
2718 * @param[in] *pSrcB points to the second input vector
\r
2719 * @param[in] blockSize number of samples in each vector
\r
2720 * @param[out] *result output result returned here
\r
2724 void arm_dot_prod_q15(
\r
2727 uint32_t blockSize,
\r
2731 * @brief Dot product of Q31 vectors.
\r
2732 * @param[in] *pSrcA points to the first input vector
\r
2733 * @param[in] *pSrcB points to the second input vector
\r
2734 * @param[in] blockSize number of samples in each vector
\r
2735 * @param[out] *result output result returned here
\r
2739 void arm_dot_prod_q31(
\r
2742 uint32_t blockSize,
\r
2746 * @brief Shifts the elements of a Q7 vector a specified number of bits.
\r
2747 * @param[in] *pSrc points to the input vector
\r
2748 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2749 * @param[out] *pDst points to the output vector
\r
2750 * @param[in] blockSize number of samples in the vector
\r
2754 void arm_shift_q7(
\r
2758 uint32_t blockSize);
\r
2761 * @brief Shifts the elements of a Q15 vector a specified number of bits.
\r
2762 * @param[in] *pSrc points to the input vector
\r
2763 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2764 * @param[out] *pDst points to the output vector
\r
2765 * @param[in] blockSize number of samples in the vector
\r
2769 void arm_shift_q15(
\r
2773 uint32_t blockSize);
\r
2776 * @brief Shifts the elements of a Q31 vector a specified number of bits.
\r
2777 * @param[in] *pSrc points to the input vector
\r
2778 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2779 * @param[out] *pDst points to the output vector
\r
2780 * @param[in] blockSize number of samples in the vector
\r
2784 void arm_shift_q31(
\r
2788 uint32_t blockSize);
\r
2791 * @brief Adds a constant offset to a floating-point vector.
\r
2792 * @param[in] *pSrc points to the input vector
\r
2793 * @param[in] offset is the offset to be added
\r
2794 * @param[out] *pDst points to the output vector
\r
2795 * @param[in] blockSize number of samples in the vector
\r
2799 void arm_offset_f32(
\r
2803 uint32_t blockSize);
\r
2806 * @brief Adds a constant offset to a Q7 vector.
\r
2807 * @param[in] *pSrc points to the input vector
\r
2808 * @param[in] offset is the offset to be added
\r
2809 * @param[out] *pDst points to the output vector
\r
2810 * @param[in] blockSize number of samples in the vector
\r
2814 void arm_offset_q7(
\r
2818 uint32_t blockSize);
\r
2821 * @brief Adds a constant offset to a Q15 vector.
\r
2822 * @param[in] *pSrc points to the input vector
\r
2823 * @param[in] offset is the offset to be added
\r
2824 * @param[out] *pDst points to the output vector
\r
2825 * @param[in] blockSize number of samples in the vector
\r
2829 void arm_offset_q15(
\r
2833 uint32_t blockSize);
\r
2836 * @brief Adds a constant offset to a Q31 vector.
\r
2837 * @param[in] *pSrc points to the input vector
\r
2838 * @param[in] offset is the offset to be added
\r
2839 * @param[out] *pDst points to the output vector
\r
2840 * @param[in] blockSize number of samples in the vector
\r
2844 void arm_offset_q31(
\r
2848 uint32_t blockSize);
\r
2851 * @brief Negates the elements of a floating-point vector.
\r
2852 * @param[in] *pSrc points to the input vector
\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_negate_f32(
\r
2861 uint32_t blockSize);
\r
2864 * @brief Negates the elements of a Q7 vector.
\r
2865 * @param[in] *pSrc points to the input vector
\r
2866 * @param[out] *pDst points to the output vector
\r
2867 * @param[in] blockSize number of samples in the vector
\r
2871 void arm_negate_q7(
\r
2874 uint32_t blockSize);
\r
2877 * @brief Negates the elements of a Q15 vector.
\r
2878 * @param[in] *pSrc points to the input vector
\r
2879 * @param[out] *pDst points to the output vector
\r
2880 * @param[in] blockSize number of samples in the vector
\r
2884 void arm_negate_q15(
\r
2887 uint32_t blockSize);
\r
2890 * @brief Negates the elements of a Q31 vector.
\r
2891 * @param[in] *pSrc points to the input vector
\r
2892 * @param[out] *pDst points to the output vector
\r
2893 * @param[in] blockSize number of samples in the vector
\r
2897 void arm_negate_q31(
\r
2900 uint32_t blockSize);
\r
2902 * @brief Copies the elements of a floating-point vector.
\r
2903 * @param[in] *pSrc input pointer
\r
2904 * @param[out] *pDst output pointer
\r
2905 * @param[in] blockSize number of samples to process
\r
2908 void arm_copy_f32(
\r
2911 uint32_t blockSize);
\r
2914 * @brief Copies the elements of a Q7 vector.
\r
2915 * @param[in] *pSrc input pointer
\r
2916 * @param[out] *pDst output pointer
\r
2917 * @param[in] blockSize number of samples to process
\r
2923 uint32_t blockSize);
\r
2926 * @brief Copies the elements of a Q15 vector.
\r
2927 * @param[in] *pSrc input pointer
\r
2928 * @param[out] *pDst output pointer
\r
2929 * @param[in] blockSize number of samples to process
\r
2932 void arm_copy_q15(
\r
2935 uint32_t blockSize);
\r
2938 * @brief Copies the elements of a Q31 vector.
\r
2939 * @param[in] *pSrc input pointer
\r
2940 * @param[out] *pDst output pointer
\r
2941 * @param[in] blockSize number of samples to process
\r
2944 void arm_copy_q31(
\r
2947 uint32_t blockSize);
\r
2949 * @brief Fills a constant value into a floating-point vector.
\r
2950 * @param[in] value input value to be filled
\r
2951 * @param[out] *pDst output pointer
\r
2952 * @param[in] blockSize number of samples to process
\r
2955 void arm_fill_f32(
\r
2958 uint32_t blockSize);
\r
2961 * @brief Fills a constant value into a Q7 vector.
\r
2962 * @param[in] value input value to be filled
\r
2963 * @param[out] *pDst output pointer
\r
2964 * @param[in] blockSize number of samples to process
\r
2970 uint32_t blockSize);
\r
2973 * @brief Fills a constant value into a Q15 vector.
\r
2974 * @param[in] value input value to be filled
\r
2975 * @param[out] *pDst output pointer
\r
2976 * @param[in] blockSize number of samples to process
\r
2979 void arm_fill_q15(
\r
2982 uint32_t blockSize);
\r
2985 * @brief Fills a constant value into a Q31 vector.
\r
2986 * @param[in] value input value to be filled
\r
2987 * @param[out] *pDst output pointer
\r
2988 * @param[in] blockSize number of samples to process
\r
2991 void arm_fill_q31(
\r
2994 uint32_t blockSize);
\r
2997 * @brief Convolution of floating-point sequences.
\r
2998 * @param[in] *pSrcA points to the first input sequence.
\r
2999 * @param[in] srcALen length of the first input sequence.
\r
3000 * @param[in] *pSrcB points to the second input sequence.
\r
3001 * @param[in] srcBLen length of the second input sequence.
\r
3002 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3006 void arm_conv_f32(
\r
3007 float32_t * pSrcA,
\r
3009 float32_t * pSrcB,
\r
3011 float32_t * pDst);
\r
3015 * @brief Convolution of Q15 sequences.
\r
3016 * @param[in] *pSrcA points to the first input sequence.
\r
3017 * @param[in] srcALen length of the first input sequence.
\r
3018 * @param[in] *pSrcB points to the second input sequence.
\r
3019 * @param[in] srcBLen length of the second input sequence.
\r
3020 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3021 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3022 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3027 void arm_conv_opt_q15(
\r
3033 q15_t * pScratch1,
\r
3034 q15_t * pScratch2);
\r
3038 * @brief Convolution of Q15 sequences.
\r
3039 * @param[in] *pSrcA points to the first input sequence.
\r
3040 * @param[in] srcALen length of the first input sequence.
\r
3041 * @param[in] *pSrcB points to the second input sequence.
\r
3042 * @param[in] srcBLen length of the second input sequence.
\r
3043 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3047 void arm_conv_q15(
\r
3055 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3056 * @param[in] *pSrcA points to the first input sequence.
\r
3057 * @param[in] srcALen length of the first input sequence.
\r
3058 * @param[in] *pSrcB points to the second input sequence.
\r
3059 * @param[in] srcBLen length of the second input sequence.
\r
3060 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3064 void arm_conv_fast_q15(
\r
3072 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3073 * @param[in] *pSrcA points to the first input sequence.
\r
3074 * @param[in] srcALen length of the first input sequence.
\r
3075 * @param[in] *pSrcB points to the second input sequence.
\r
3076 * @param[in] srcBLen length of the second input sequence.
\r
3077 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3078 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3079 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3083 void arm_conv_fast_opt_q15(
\r
3089 q15_t * pScratch1,
\r
3090 q15_t * pScratch2);
\r
3095 * @brief Convolution of Q31 sequences.
\r
3096 * @param[in] *pSrcA points to the first input sequence.
\r
3097 * @param[in] srcALen length of the first input sequence.
\r
3098 * @param[in] *pSrcB points to the second input sequence.
\r
3099 * @param[in] srcBLen length of the second input sequence.
\r
3100 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3104 void arm_conv_q31(
\r
3112 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3113 * @param[in] *pSrcA points to the first input sequence.
\r
3114 * @param[in] srcALen length of the first input sequence.
\r
3115 * @param[in] *pSrcB points to the second input sequence.
\r
3116 * @param[in] srcBLen length of the second input sequence.
\r
3117 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3121 void arm_conv_fast_q31(
\r
3130 * @brief Convolution of Q7 sequences.
\r
3131 * @param[in] *pSrcA points to the first input sequence.
\r
3132 * @param[in] srcALen length of the first input sequence.
\r
3133 * @param[in] *pSrcB points to the second input sequence.
\r
3134 * @param[in] srcBLen length of the second input sequence.
\r
3135 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3136 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3137 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3141 void arm_conv_opt_q7(
\r
3147 q15_t * pScratch1,
\r
3148 q15_t * pScratch2);
\r
3153 * @brief Convolution of Q7 sequences.
\r
3154 * @param[in] *pSrcA points to the first input sequence.
\r
3155 * @param[in] srcALen length of the first input sequence.
\r
3156 * @param[in] *pSrcB points to the second input sequence.
\r
3157 * @param[in] srcBLen length of the second input sequence.
\r
3158 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3171 * @brief Partial convolution of floating-point sequences.
\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
\r
3177 * @param[in] firstIndex is the first output sample to start with.
\r
3178 * @param[in] numPoints is the number of output points to be computed.
\r
3179 * @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
3182 arm_status arm_conv_partial_f32(
\r
3183 float32_t * pSrcA,
\r
3185 float32_t * pSrcB,
\r
3188 uint32_t firstIndex,
\r
3189 uint32_t numPoints);
\r
3192 * @brief Partial convolution of Q15 sequences.
\r
3193 * @param[in] *pSrcA points to the first input sequence.
\r
3194 * @param[in] srcALen length of the first input sequence.
\r
3195 * @param[in] *pSrcB points to the second input sequence.
\r
3196 * @param[in] srcBLen length of the second input sequence.
\r
3197 * @param[out] *pDst points to the block of output data
\r
3198 * @param[in] firstIndex is the first output sample to start with.
\r
3199 * @param[in] numPoints is the number of output points to be computed.
\r
3200 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3201 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3202 * @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
3205 arm_status arm_conv_partial_opt_q15(
\r
3211 uint32_t firstIndex,
\r
3212 uint32_t numPoints,
\r
3213 q15_t * pScratch1,
\r
3214 q15_t * pScratch2);
\r
3218 * @brief Partial convolution of Q15 sequences.
\r
3219 * @param[in] *pSrcA points to the first input sequence.
\r
3220 * @param[in] srcALen length of the first input sequence.
\r
3221 * @param[in] *pSrcB points to the second input sequence.
\r
3222 * @param[in] srcBLen length of the second input sequence.
\r
3223 * @param[out] *pDst points to the block of output data
\r
3224 * @param[in] firstIndex is the first output sample to start with.
\r
3225 * @param[in] numPoints is the number of output points to be computed.
\r
3226 * @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
3229 arm_status arm_conv_partial_q15(
\r
3235 uint32_t firstIndex,
\r
3236 uint32_t numPoints);
\r
3239 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3240 * @param[in] *pSrcA points to the first input sequence.
\r
3241 * @param[in] srcALen length of the first input sequence.
\r
3242 * @param[in] *pSrcB points to the second input sequence.
\r
3243 * @param[in] srcBLen length of the second input sequence.
\r
3244 * @param[out] *pDst points to the block of output data
\r
3245 * @param[in] firstIndex is the first output sample to start with.
\r
3246 * @param[in] numPoints is the number of output points to be computed.
\r
3247 * @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
3250 arm_status arm_conv_partial_fast_q15(
\r
3256 uint32_t firstIndex,
\r
3257 uint32_t numPoints);
\r
3261 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3262 * @param[in] *pSrcA points to the first input sequence.
\r
3263 * @param[in] srcALen length of the first input sequence.
\r
3264 * @param[in] *pSrcB points to the second input sequence.
\r
3265 * @param[in] srcBLen length of the second input sequence.
\r
3266 * @param[out] *pDst points to the block of output data
\r
3267 * @param[in] firstIndex is the first output sample to start with.
\r
3268 * @param[in] numPoints is the number of output points to be computed.
\r
3269 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3270 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3271 * @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
3274 arm_status arm_conv_partial_fast_opt_q15(
\r
3280 uint32_t firstIndex,
\r
3281 uint32_t numPoints,
\r
3282 q15_t * pScratch1,
\r
3283 q15_t * pScratch2);
\r
3287 * @brief Partial convolution of Q31 sequences.
\r
3288 * @param[in] *pSrcA points to the first input sequence.
\r
3289 * @param[in] srcALen length of the first input sequence.
\r
3290 * @param[in] *pSrcB points to the second input sequence.
\r
3291 * @param[in] srcBLen length of the second input sequence.
\r
3292 * @param[out] *pDst points to the block of output data
\r
3293 * @param[in] firstIndex is the first output sample to start with.
\r
3294 * @param[in] numPoints is the number of output points to be computed.
\r
3295 * @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
3298 arm_status arm_conv_partial_q31(
\r
3304 uint32_t firstIndex,
\r
3305 uint32_t numPoints);
\r
3309 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3310 * @param[in] *pSrcA points to the first input sequence.
\r
3311 * @param[in] srcALen length of the first input sequence.
\r
3312 * @param[in] *pSrcB points to the second input sequence.
\r
3313 * @param[in] srcBLen length of the second input sequence.
\r
3314 * @param[out] *pDst points to the block of output data
\r
3315 * @param[in] firstIndex is the first output sample to start with.
\r
3316 * @param[in] numPoints is the number of output points to be computed.
\r
3317 * @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
3320 arm_status arm_conv_partial_fast_q31(
\r
3326 uint32_t firstIndex,
\r
3327 uint32_t numPoints);
\r
3331 * @brief Partial convolution of Q7 sequences
\r
3332 * @param[in] *pSrcA points to the first input sequence.
\r
3333 * @param[in] srcALen length of the first input sequence.
\r
3334 * @param[in] *pSrcB points to the second input sequence.
\r
3335 * @param[in] srcBLen length of the second input sequence.
\r
3336 * @param[out] *pDst points to the block of output data
\r
3337 * @param[in] firstIndex is the first output sample to start with.
\r
3338 * @param[in] numPoints is the number of output points to be computed.
\r
3339 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3340 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3341 * @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
3344 arm_status arm_conv_partial_opt_q7(
\r
3350 uint32_t firstIndex,
\r
3351 uint32_t numPoints,
\r
3352 q15_t * pScratch1,
\r
3353 q15_t * pScratch2);
\r
3357 * @brief Partial convolution of Q7 sequences.
\r
3358 * @param[in] *pSrcA points to the first input sequence.
\r
3359 * @param[in] srcALen length of the first input sequence.
\r
3360 * @param[in] *pSrcB points to the second input sequence.
\r
3361 * @param[in] srcBLen length of the second input sequence.
\r
3362 * @param[out] *pDst points to the block of output data
\r
3363 * @param[in] firstIndex is the first output sample to start with.
\r
3364 * @param[in] numPoints is the number of output points to be computed.
\r
3365 * @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
3368 arm_status arm_conv_partial_q7(
\r
3374 uint32_t firstIndex,
\r
3375 uint32_t numPoints);
\r
3380 * @brief Instance structure for the Q15 FIR decimator.
\r
3385 uint8_t M; /**< decimation factor. */
\r
3386 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3387 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3388 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3389 } arm_fir_decimate_instance_q15;
\r
3392 * @brief Instance structure for the Q31 FIR decimator.
\r
3397 uint8_t M; /**< decimation factor. */
\r
3398 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3399 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3400 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3402 } arm_fir_decimate_instance_q31;
\r
3405 * @brief Instance structure for the floating-point FIR decimator.
\r
3410 uint8_t M; /**< decimation factor. */
\r
3411 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3412 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3413 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3415 } arm_fir_decimate_instance_f32;
\r
3420 * @brief Processing function for the floating-point FIR decimator.
\r
3421 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
\r
3422 * @param[in] *pSrc points to the block of input data.
\r
3423 * @param[out] *pDst points to the block of output data
\r
3424 * @param[in] blockSize number of input samples to process per call.
\r
3428 void arm_fir_decimate_f32(
\r
3429 const arm_fir_decimate_instance_f32 * S,
\r
3432 uint32_t blockSize);
\r
3436 * @brief Initialization function for the floating-point FIR decimator.
\r
3437 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
\r
3438 * @param[in] numTaps number of coefficients in the filter.
\r
3439 * @param[in] M decimation factor.
\r
3440 * @param[in] *pCoeffs points to the filter coefficients.
\r
3441 * @param[in] *pState points to the state buffer.
\r
3442 * @param[in] blockSize number of input samples to process per call.
\r
3443 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3444 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3447 arm_status arm_fir_decimate_init_f32(
\r
3448 arm_fir_decimate_instance_f32 * S,
\r
3451 float32_t * pCoeffs,
\r
3452 float32_t * pState,
\r
3453 uint32_t blockSize);
\r
3456 * @brief Processing function for the Q15 FIR decimator.
\r
3457 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3458 * @param[in] *pSrc points to the block of input data.
\r
3459 * @param[out] *pDst points to the block of output data
\r
3460 * @param[in] blockSize number of input samples to process per call.
\r
3464 void arm_fir_decimate_q15(
\r
3465 const arm_fir_decimate_instance_q15 * S,
\r
3468 uint32_t blockSize);
\r
3471 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3472 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3473 * @param[in] *pSrc points to the block of input data.
\r
3474 * @param[out] *pDst points to the block of output data
\r
3475 * @param[in] blockSize number of input samples to process per call.
\r
3479 void arm_fir_decimate_fast_q15(
\r
3480 const arm_fir_decimate_instance_q15 * S,
\r
3483 uint32_t blockSize);
\r
3488 * @brief Initialization function for the Q15 FIR decimator.
\r
3489 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
\r
3490 * @param[in] numTaps number of coefficients in the filter.
\r
3491 * @param[in] M decimation factor.
\r
3492 * @param[in] *pCoeffs points to the filter coefficients.
\r
3493 * @param[in] *pState points to the state buffer.
\r
3494 * @param[in] blockSize number of input samples to process per call.
\r
3495 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3496 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3499 arm_status arm_fir_decimate_init_q15(
\r
3500 arm_fir_decimate_instance_q15 * S,
\r
3505 uint32_t blockSize);
\r
3508 * @brief Processing function for the Q31 FIR decimator.
\r
3509 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3510 * @param[in] *pSrc points to the block of input data.
\r
3511 * @param[out] *pDst points to the block of output data
\r
3512 * @param[in] blockSize number of input samples to process per call.
\r
3516 void arm_fir_decimate_q31(
\r
3517 const arm_fir_decimate_instance_q31 * S,
\r
3520 uint32_t blockSize);
\r
3523 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3524 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3525 * @param[in] *pSrc points to the block of input data.
\r
3526 * @param[out] *pDst points to the block of output data
\r
3527 * @param[in] blockSize number of input samples to process per call.
\r
3531 void arm_fir_decimate_fast_q31(
\r
3532 arm_fir_decimate_instance_q31 * S,
\r
3535 uint32_t blockSize);
\r
3539 * @brief Initialization function for the Q31 FIR decimator.
\r
3540 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
\r
3541 * @param[in] numTaps number of coefficients in the filter.
\r
3542 * @param[in] M decimation factor.
\r
3543 * @param[in] *pCoeffs points to the filter coefficients.
\r
3544 * @param[in] *pState points to the state buffer.
\r
3545 * @param[in] blockSize number of input samples to process per call.
\r
3546 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3547 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3550 arm_status arm_fir_decimate_init_q31(
\r
3551 arm_fir_decimate_instance_q31 * S,
\r
3556 uint32_t blockSize);
\r
3561 * @brief Instance structure for the Q15 FIR interpolator.
\r
3566 uint8_t L; /**< upsample factor. */
\r
3567 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3568 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3569 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3570 } arm_fir_interpolate_instance_q15;
\r
3573 * @brief Instance structure for the Q31 FIR interpolator.
\r
3578 uint8_t L; /**< upsample factor. */
\r
3579 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3580 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3581 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3582 } arm_fir_interpolate_instance_q31;
\r
3585 * @brief Instance structure for the floating-point FIR interpolator.
\r
3590 uint8_t L; /**< upsample factor. */
\r
3591 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3592 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3593 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
\r
3594 } arm_fir_interpolate_instance_f32;
\r
3598 * @brief Processing function for the Q15 FIR interpolator.
\r
3599 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3600 * @param[in] *pSrc points to the block of input data.
\r
3601 * @param[out] *pDst points to the block of output data.
\r
3602 * @param[in] blockSize number of input samples to process per call.
\r
3606 void arm_fir_interpolate_q15(
\r
3607 const arm_fir_interpolate_instance_q15 * S,
\r
3610 uint32_t blockSize);
\r
3614 * @brief Initialization function for the Q15 FIR interpolator.
\r
3615 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
\r
3616 * @param[in] L upsample factor.
\r
3617 * @param[in] numTaps number of filter coefficients in the filter.
\r
3618 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3619 * @param[in] *pState points to the state buffer.
\r
3620 * @param[in] blockSize number of input samples to process per call.
\r
3621 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3622 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3625 arm_status arm_fir_interpolate_init_q15(
\r
3626 arm_fir_interpolate_instance_q15 * S,
\r
3631 uint32_t blockSize);
\r
3634 * @brief Processing function for the Q31 FIR interpolator.
\r
3635 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3636 * @param[in] *pSrc points to the block of input data.
\r
3637 * @param[out] *pDst points to the block of output data.
\r
3638 * @param[in] blockSize number of input samples to process per call.
\r
3642 void arm_fir_interpolate_q31(
\r
3643 const arm_fir_interpolate_instance_q31 * S,
\r
3646 uint32_t blockSize);
\r
3649 * @brief Initialization function for the Q31 FIR interpolator.
\r
3650 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
\r
3651 * @param[in] L upsample factor.
\r
3652 * @param[in] numTaps number of filter coefficients in the filter.
\r
3653 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3654 * @param[in] *pState points to the state buffer.
\r
3655 * @param[in] blockSize number of input samples to process per call.
\r
3656 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3657 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3660 arm_status arm_fir_interpolate_init_q31(
\r
3661 arm_fir_interpolate_instance_q31 * S,
\r
3666 uint32_t blockSize);
\r
3670 * @brief Processing function for the floating-point FIR interpolator.
\r
3671 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
\r
3672 * @param[in] *pSrc points to the block of input data.
\r
3673 * @param[out] *pDst points to the block of output data.
\r
3674 * @param[in] blockSize number of input samples to process per call.
\r
3678 void arm_fir_interpolate_f32(
\r
3679 const arm_fir_interpolate_instance_f32 * S,
\r
3682 uint32_t blockSize);
\r
3685 * @brief Initialization function for the floating-point FIR interpolator.
\r
3686 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
\r
3687 * @param[in] L upsample factor.
\r
3688 * @param[in] numTaps number of filter coefficients in the filter.
\r
3689 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3690 * @param[in] *pState points to the state buffer.
\r
3691 * @param[in] blockSize number of input samples to process per call.
\r
3692 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3693 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3696 arm_status arm_fir_interpolate_init_f32(
\r
3697 arm_fir_interpolate_instance_f32 * S,
\r
3700 float32_t * pCoeffs,
\r
3701 float32_t * pState,
\r
3702 uint32_t blockSize);
\r
3705 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
\r
3710 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3711 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3712 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3713 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
\r
3715 } arm_biquad_cas_df1_32x64_ins_q31;
\r
3719 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3720 * @param[in] *pSrc points to the block of input data.
\r
3721 * @param[out] *pDst points to the block of output data
\r
3722 * @param[in] blockSize number of samples to process.
\r
3726 void arm_biquad_cas_df1_32x64_q31(
\r
3727 const arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3730 uint32_t blockSize);
\r
3734 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3735 * @param[in] numStages number of 2nd order stages in the filter.
\r
3736 * @param[in] *pCoeffs points to the filter coefficients.
\r
3737 * @param[in] *pState points to the state buffer.
\r
3738 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
\r
3742 void arm_biquad_cas_df1_32x64_init_q31(
\r
3743 arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3744 uint8_t numStages,
\r
3747 uint8_t postShift);
\r
3752 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3757 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3758 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3759 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3760 } arm_biquad_cascade_df2T_instance_f32;
\r
3764 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3765 * @param[in] *S points to an instance of the filter data structure.
\r
3766 * @param[in] *pSrc points to the block of input data.
\r
3767 * @param[out] *pDst points to the block of output data
\r
3768 * @param[in] blockSize number of samples to process.
\r
3772 void arm_biquad_cascade_df2T_f32(
\r
3773 const arm_biquad_cascade_df2T_instance_f32 * S,
\r
3776 uint32_t blockSize);
\r
3780 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3781 * @param[in,out] *S points to an instance of the filter data structure.
\r
3782 * @param[in] numStages number of 2nd order stages in the filter.
\r
3783 * @param[in] *pCoeffs points to the filter coefficients.
\r
3784 * @param[in] *pState points to the state buffer.
\r
3788 void arm_biquad_cascade_df2T_init_f32(
\r
3789 arm_biquad_cascade_df2T_instance_f32 * S,
\r
3790 uint8_t numStages,
\r
3791 float32_t * pCoeffs,
\r
3792 float32_t * pState);
\r
3797 * @brief Instance structure for the Q15 FIR lattice filter.
\r
3802 uint16_t numStages; /**< number of filter stages. */
\r
3803 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3804 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3805 } arm_fir_lattice_instance_q15;
\r
3808 * @brief Instance structure for the Q31 FIR lattice filter.
\r
3813 uint16_t numStages; /**< number of filter stages. */
\r
3814 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3815 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3816 } arm_fir_lattice_instance_q31;
\r
3819 * @brief Instance structure for the floating-point FIR lattice filter.
\r
3824 uint16_t numStages; /**< number of filter stages. */
\r
3825 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3826 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3827 } arm_fir_lattice_instance_f32;
\r
3830 * @brief Initialization function for the Q15 FIR lattice filter.
\r
3831 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3832 * @param[in] numStages number of filter stages.
\r
3833 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3834 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
3838 void arm_fir_lattice_init_q15(
\r
3839 arm_fir_lattice_instance_q15 * S,
\r
3840 uint16_t numStages,
\r
3846 * @brief Processing function for the Q15 FIR lattice filter.
\r
3847 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3848 * @param[in] *pSrc points to the block of input data.
\r
3849 * @param[out] *pDst points to the block of output data.
\r
3850 * @param[in] blockSize number of samples to process.
\r
3853 void arm_fir_lattice_q15(
\r
3854 const arm_fir_lattice_instance_q15 * S,
\r
3857 uint32_t blockSize);
\r
3860 * @brief Initialization function for the Q31 FIR lattice filter.
\r
3861 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
3862 * @param[in] numStages number of filter stages.
\r
3863 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3864 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
3868 void arm_fir_lattice_init_q31(
\r
3869 arm_fir_lattice_instance_q31 * S,
\r
3870 uint16_t numStages,
\r
3876 * @brief Processing function for the Q31 FIR lattice filter.
\r
3877 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
3878 * @param[in] *pSrc points to the block of input data.
\r
3879 * @param[out] *pDst points to the block of output data
\r
3880 * @param[in] blockSize number of samples to process.
\r
3884 void arm_fir_lattice_q31(
\r
3885 const arm_fir_lattice_instance_q31 * S,
\r
3888 uint32_t blockSize);
\r
3891 * @brief Initialization function for the floating-point FIR lattice filter.
\r
3892 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
3893 * @param[in] numStages number of filter stages.
\r
3894 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3895 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
3899 void arm_fir_lattice_init_f32(
\r
3900 arm_fir_lattice_instance_f32 * S,
\r
3901 uint16_t numStages,
\r
3902 float32_t * pCoeffs,
\r
3903 float32_t * pState);
\r
3906 * @brief Processing function for the floating-point FIR lattice filter.
\r
3907 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
3908 * @param[in] *pSrc points to the block of input data.
\r
3909 * @param[out] *pDst points to the block of output data
\r
3910 * @param[in] blockSize number of samples to process.
\r
3914 void arm_fir_lattice_f32(
\r
3915 const arm_fir_lattice_instance_f32 * S,
\r
3918 uint32_t blockSize);
\r
3921 * @brief Instance structure for the Q15 IIR lattice filter.
\r
3925 uint16_t numStages; /**< number of stages in the filter. */
\r
3926 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3927 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3928 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3929 } arm_iir_lattice_instance_q15;
\r
3932 * @brief Instance structure for the Q31 IIR lattice filter.
\r
3936 uint16_t numStages; /**< number of stages in the filter. */
\r
3937 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3938 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3939 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3940 } arm_iir_lattice_instance_q31;
\r
3943 * @brief Instance structure for the floating-point IIR lattice filter.
\r
3947 uint16_t numStages; /**< number of stages in the filter. */
\r
3948 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3949 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3950 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3951 } arm_iir_lattice_instance_f32;
\r
3954 * @brief Processing function for the floating-point IIR lattice filter.
\r
3955 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
3956 * @param[in] *pSrc points to the block of input data.
\r
3957 * @param[out] *pDst points to the block of output data.
\r
3958 * @param[in] blockSize number of samples to process.
\r
3962 void arm_iir_lattice_f32(
\r
3963 const arm_iir_lattice_instance_f32 * S,
\r
3966 uint32_t blockSize);
\r
3969 * @brief Initialization function for the floating-point IIR lattice filter.
\r
3970 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
3971 * @param[in] numStages number of stages in the filter.
\r
3972 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
3973 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
3974 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
\r
3975 * @param[in] blockSize number of samples to process.
\r
3979 void arm_iir_lattice_init_f32(
\r
3980 arm_iir_lattice_instance_f32 * S,
\r
3981 uint16_t numStages,
\r
3982 float32_t * pkCoeffs,
\r
3983 float32_t * pvCoeffs,
\r
3984 float32_t * pState,
\r
3985 uint32_t blockSize);
\r
3989 * @brief Processing function for the Q31 IIR lattice filter.
\r
3990 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
3991 * @param[in] *pSrc points to the block of input data.
\r
3992 * @param[out] *pDst points to the block of output data.
\r
3993 * @param[in] blockSize number of samples to process.
\r
3997 void arm_iir_lattice_q31(
\r
3998 const arm_iir_lattice_instance_q31 * S,
\r
4001 uint32_t blockSize);
\r
4005 * @brief Initialization function for the Q31 IIR lattice filter.
\r
4006 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4007 * @param[in] numStages number of stages in the filter.
\r
4008 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4009 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4010 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
\r
4011 * @param[in] blockSize number of samples to process.
\r
4015 void arm_iir_lattice_init_q31(
\r
4016 arm_iir_lattice_instance_q31 * S,
\r
4017 uint16_t numStages,
\r
4021 uint32_t blockSize);
\r
4025 * @brief Processing function for the Q15 IIR lattice filter.
\r
4026 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
\r
4027 * @param[in] *pSrc points to the block of input data.
\r
4028 * @param[out] *pDst points to the block of output data.
\r
4029 * @param[in] blockSize number of samples to process.
\r
4033 void arm_iir_lattice_q15(
\r
4034 const arm_iir_lattice_instance_q15 * S,
\r
4037 uint32_t blockSize);
\r
4041 * @brief Initialization function for the Q15 IIR lattice filter.
\r
4042 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
\r
4043 * @param[in] numStages number of stages in the filter.
\r
4044 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
\r
4045 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
\r
4046 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
\r
4047 * @param[in] blockSize number of samples to process per call.
\r
4051 void arm_iir_lattice_init_q15(
\r
4052 arm_iir_lattice_instance_q15 * S,
\r
4053 uint16_t numStages,
\r
4057 uint32_t blockSize);
\r
4060 * @brief Instance structure for the floating-point LMS filter.
\r
4065 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4066 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4067 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4068 float32_t mu; /**< step size that controls filter coefficient updates. */
\r
4069 } arm_lms_instance_f32;
\r
4072 * @brief Processing function for floating-point LMS filter.
\r
4073 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4074 * @param[in] *pSrc points to the block of input data.
\r
4075 * @param[in] *pRef points to the block of reference data.
\r
4076 * @param[out] *pOut points to the block of output data.
\r
4077 * @param[out] *pErr points to the block of error data.
\r
4078 * @param[in] blockSize number of samples to process.
\r
4083 const arm_lms_instance_f32 * S,
\r
4088 uint32_t blockSize);
\r
4091 * @brief Initialization function for floating-point LMS filter.
\r
4092 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4093 * @param[in] numTaps number of filter coefficients.
\r
4094 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4095 * @param[in] *pState points to state buffer.
\r
4096 * @param[in] mu step size that controls filter coefficient updates.
\r
4097 * @param[in] blockSize number of samples to process.
\r
4101 void arm_lms_init_f32(
\r
4102 arm_lms_instance_f32 * S,
\r
4104 float32_t * pCoeffs,
\r
4105 float32_t * pState,
\r
4107 uint32_t blockSize);
\r
4110 * @brief Instance structure for the Q15 LMS filter.
\r
4115 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4116 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4117 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4118 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4119 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4120 } arm_lms_instance_q15;
\r
4124 * @brief Initialization function for the Q15 LMS filter.
\r
4125 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4126 * @param[in] numTaps number of filter coefficients.
\r
4127 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4128 * @param[in] *pState points to the state buffer.
\r
4129 * @param[in] mu step size that controls filter coefficient updates.
\r
4130 * @param[in] blockSize number of samples to process.
\r
4131 * @param[in] postShift bit shift applied to coefficients.
\r
4135 void arm_lms_init_q15(
\r
4136 arm_lms_instance_q15 * S,
\r
4141 uint32_t blockSize,
\r
4142 uint32_t postShift);
\r
4145 * @brief Processing function for Q15 LMS filter.
\r
4146 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4147 * @param[in] *pSrc points to the block of input data.
\r
4148 * @param[in] *pRef points to the block of reference data.
\r
4149 * @param[out] *pOut points to the block of output data.
\r
4150 * @param[out] *pErr points to the block of error data.
\r
4151 * @param[in] blockSize number of samples to process.
\r
4156 const arm_lms_instance_q15 * S,
\r
4161 uint32_t blockSize);
\r
4165 * @brief Instance structure for the Q31 LMS filter.
\r
4170 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4171 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4172 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4173 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4174 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4176 } arm_lms_instance_q31;
\r
4179 * @brief Processing function for Q31 LMS filter.
\r
4180 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4181 * @param[in] *pSrc points to the block of input data.
\r
4182 * @param[in] *pRef points to the block of reference data.
\r
4183 * @param[out] *pOut points to the block of output data.
\r
4184 * @param[out] *pErr points to the block of error data.
\r
4185 * @param[in] blockSize number of samples to process.
\r
4190 const arm_lms_instance_q31 * S,
\r
4195 uint32_t blockSize);
\r
4198 * @brief Initialization function for Q31 LMS filter.
\r
4199 * @param[in] *S points to an instance of the Q31 LMS filter structure.
\r
4200 * @param[in] numTaps number of filter coefficients.
\r
4201 * @param[in] *pCoeffs points to coefficient buffer.
\r
4202 * @param[in] *pState points to state buffer.
\r
4203 * @param[in] mu step size that controls filter coefficient updates.
\r
4204 * @param[in] blockSize number of samples to process.
\r
4205 * @param[in] postShift bit shift applied to coefficients.
\r
4209 void arm_lms_init_q31(
\r
4210 arm_lms_instance_q31 * S,
\r
4215 uint32_t blockSize,
\r
4216 uint32_t postShift);
\r
4219 * @brief Instance structure for the floating-point normalized LMS filter.
\r
4224 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4225 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4226 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4227 float32_t mu; /**< step size that control filter coefficient updates. */
\r
4228 float32_t energy; /**< saves previous frame energy. */
\r
4229 float32_t x0; /**< saves previous input sample. */
\r
4230 } arm_lms_norm_instance_f32;
\r
4233 * @brief Processing function for floating-point normalized LMS filter.
\r
4234 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
\r
4235 * @param[in] *pSrc points to the block of input data.
\r
4236 * @param[in] *pRef points to the block of reference data.
\r
4237 * @param[out] *pOut points to the block of output data.
\r
4238 * @param[out] *pErr points to the block of error data.
\r
4239 * @param[in] blockSize number of samples to process.
\r
4243 void arm_lms_norm_f32(
\r
4244 arm_lms_norm_instance_f32 * S,
\r
4249 uint32_t blockSize);
\r
4252 * @brief Initialization function for floating-point normalized LMS filter.
\r
4253 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4254 * @param[in] numTaps number of filter coefficients.
\r
4255 * @param[in] *pCoeffs points to coefficient buffer.
\r
4256 * @param[in] *pState points to state buffer.
\r
4257 * @param[in] mu step size that controls filter coefficient updates.
\r
4258 * @param[in] blockSize number of samples to process.
\r
4262 void arm_lms_norm_init_f32(
\r
4263 arm_lms_norm_instance_f32 * S,
\r
4265 float32_t * pCoeffs,
\r
4266 float32_t * pState,
\r
4268 uint32_t blockSize);
\r
4272 * @brief Instance structure for the Q31 normalized LMS filter.
\r
4276 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4277 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4278 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4279 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4280 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4281 q31_t *recipTable; /**< points to the reciprocal initial value table. */
\r
4282 q31_t energy; /**< saves previous frame energy. */
\r
4283 q31_t x0; /**< saves previous input sample. */
\r
4284 } arm_lms_norm_instance_q31;
\r
4287 * @brief Processing function for Q31 normalized LMS filter.
\r
4288 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4289 * @param[in] *pSrc points to the block of input data.
\r
4290 * @param[in] *pRef points to the block of reference data.
\r
4291 * @param[out] *pOut points to the block of output data.
\r
4292 * @param[out] *pErr points to the block of error data.
\r
4293 * @param[in] blockSize number of samples to process.
\r
4297 void arm_lms_norm_q31(
\r
4298 arm_lms_norm_instance_q31 * S,
\r
4303 uint32_t blockSize);
\r
4306 * @brief Initialization function for Q31 normalized LMS filter.
\r
4307 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4308 * @param[in] numTaps number of filter coefficients.
\r
4309 * @param[in] *pCoeffs points to coefficient buffer.
\r
4310 * @param[in] *pState points to state buffer.
\r
4311 * @param[in] mu step size that controls filter coefficient updates.
\r
4312 * @param[in] blockSize number of samples to process.
\r
4313 * @param[in] postShift bit shift applied to coefficients.
\r
4317 void arm_lms_norm_init_q31(
\r
4318 arm_lms_norm_instance_q31 * S,
\r
4323 uint32_t blockSize,
\r
4324 uint8_t postShift);
\r
4327 * @brief Instance structure for the Q15 normalized LMS filter.
\r
4332 uint16_t numTaps; /**< Number of coefficients in the filter. */
\r
4333 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4334 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4335 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4336 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4337 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
\r
4338 q15_t energy; /**< saves previous frame energy. */
\r
4339 q15_t x0; /**< saves previous input sample. */
\r
4340 } arm_lms_norm_instance_q15;
\r
4343 * @brief Processing function for Q15 normalized LMS filter.
\r
4344 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4345 * @param[in] *pSrc points to the block of input data.
\r
4346 * @param[in] *pRef points to the block of reference data.
\r
4347 * @param[out] *pOut points to the block of output data.
\r
4348 * @param[out] *pErr points to the block of error data.
\r
4349 * @param[in] blockSize number of samples to process.
\r
4353 void arm_lms_norm_q15(
\r
4354 arm_lms_norm_instance_q15 * S,
\r
4359 uint32_t blockSize);
\r
4363 * @brief Initialization function for Q15 normalized LMS filter.
\r
4364 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4365 * @param[in] numTaps number of filter coefficients.
\r
4366 * @param[in] *pCoeffs points to coefficient buffer.
\r
4367 * @param[in] *pState points to state buffer.
\r
4368 * @param[in] mu step size that controls filter coefficient updates.
\r
4369 * @param[in] blockSize number of samples to process.
\r
4370 * @param[in] postShift bit shift applied to coefficients.
\r
4374 void arm_lms_norm_init_q15(
\r
4375 arm_lms_norm_instance_q15 * S,
\r
4380 uint32_t blockSize,
\r
4381 uint8_t postShift);
\r
4384 * @brief Correlation of floating-point sequences.
\r
4385 * @param[in] *pSrcA points to the first input sequence.
\r
4386 * @param[in] srcALen length of the first input sequence.
\r
4387 * @param[in] *pSrcB points to the second input sequence.
\r
4388 * @param[in] srcBLen length of the second input sequence.
\r
4389 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4393 void arm_correlate_f32(
\r
4394 float32_t * pSrcA,
\r
4396 float32_t * pSrcB,
\r
4398 float32_t * pDst);
\r
4402 * @brief Correlation of Q15 sequences
\r
4403 * @param[in] *pSrcA points to the first input sequence.
\r
4404 * @param[in] srcALen length of the first input sequence.
\r
4405 * @param[in] *pSrcB points to the second input sequence.
\r
4406 * @param[in] srcBLen length of the second input sequence.
\r
4407 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4408 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4411 void arm_correlate_opt_q15(
\r
4417 q15_t * pScratch);
\r
4421 * @brief Correlation of Q15 sequences.
\r
4422 * @param[in] *pSrcA points to the first input sequence.
\r
4423 * @param[in] srcALen length of the first input sequence.
\r
4424 * @param[in] *pSrcB points to the second input sequence.
\r
4425 * @param[in] srcBLen length of the second input sequence.
\r
4426 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4430 void arm_correlate_q15(
\r
4438 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4439 * @param[in] *pSrcA points to the first input sequence.
\r
4440 * @param[in] srcALen length of the first input sequence.
\r
4441 * @param[in] *pSrcB points to the second input sequence.
\r
4442 * @param[in] srcBLen length of the second input sequence.
\r
4443 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4447 void arm_correlate_fast_q15(
\r
4457 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4458 * @param[in] *pSrcA points to the first input sequence.
\r
4459 * @param[in] srcALen length of the first input sequence.
\r
4460 * @param[in] *pSrcB points to the second input sequence.
\r
4461 * @param[in] srcBLen length of the second input sequence.
\r
4462 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4463 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4467 void arm_correlate_fast_opt_q15(
\r
4473 q15_t * pScratch);
\r
4476 * @brief Correlation of Q31 sequences.
\r
4477 * @param[in] *pSrcA points to the first input sequence.
\r
4478 * @param[in] srcALen length of the first input sequence.
\r
4479 * @param[in] *pSrcB points to the second input sequence.
\r
4480 * @param[in] srcBLen length of the second input sequence.
\r
4481 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4485 void arm_correlate_q31(
\r
4493 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
4494 * @param[in] *pSrcA points to the first input sequence.
\r
4495 * @param[in] srcALen length of the first input sequence.
\r
4496 * @param[in] *pSrcB points to the second input sequence.
\r
4497 * @param[in] srcBLen length of the second input sequence.
\r
4498 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4502 void arm_correlate_fast_q31(
\r
4512 * @brief Correlation of Q7 sequences.
\r
4513 * @param[in] *pSrcA points to the first input sequence.
\r
4514 * @param[in] srcALen length of the first input sequence.
\r
4515 * @param[in] *pSrcB points to the second input sequence.
\r
4516 * @param[in] srcBLen length of the second input sequence.
\r
4517 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4518 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4519 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
4523 void arm_correlate_opt_q7(
\r
4529 q15_t * pScratch1,
\r
4530 q15_t * pScratch2);
\r
4534 * @brief Correlation of Q7 sequences.
\r
4535 * @param[in] *pSrcA points to the first input sequence.
\r
4536 * @param[in] srcALen length of the first input sequence.
\r
4537 * @param[in] *pSrcB points to the second input sequence.
\r
4538 * @param[in] srcBLen length of the second input sequence.
\r
4539 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4543 void arm_correlate_q7(
\r
4552 * @brief Instance structure for the floating-point sparse FIR filter.
\r
4556 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4557 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4558 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4559 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4560 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4561 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4562 } arm_fir_sparse_instance_f32;
\r
4565 * @brief Instance structure for the Q31 sparse FIR filter.
\r
4570 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4571 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4572 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4573 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4574 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4575 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4576 } arm_fir_sparse_instance_q31;
\r
4579 * @brief Instance structure for the Q15 sparse FIR filter.
\r
4584 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4585 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4586 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4587 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4588 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4589 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4590 } arm_fir_sparse_instance_q15;
\r
4593 * @brief Instance structure for the Q7 sparse FIR filter.
\r
4598 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4599 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4600 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4601 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4602 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4603 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4604 } arm_fir_sparse_instance_q7;
\r
4607 * @brief Processing function for the floating-point sparse FIR filter.
\r
4608 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
\r
4609 * @param[in] *pSrc points to the block of input data.
\r
4610 * @param[out] *pDst points to the block of output data
\r
4611 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4612 * @param[in] blockSize number of input samples to process per call.
\r
4616 void arm_fir_sparse_f32(
\r
4617 arm_fir_sparse_instance_f32 * S,
\r
4620 float32_t * pScratchIn,
\r
4621 uint32_t blockSize);
\r
4624 * @brief Initialization function for the floating-point sparse FIR filter.
\r
4625 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
\r
4626 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4627 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4628 * @param[in] *pState points to the state buffer.
\r
4629 * @param[in] *pTapDelay points to the array of offset times.
\r
4630 * @param[in] maxDelay maximum offset time supported.
\r
4631 * @param[in] blockSize number of samples that will be processed per block.
\r
4635 void arm_fir_sparse_init_f32(
\r
4636 arm_fir_sparse_instance_f32 * S,
\r
4638 float32_t * pCoeffs,
\r
4639 float32_t * pState,
\r
4640 int32_t * pTapDelay,
\r
4641 uint16_t maxDelay,
\r
4642 uint32_t blockSize);
\r
4645 * @brief Processing function for the Q31 sparse FIR filter.
\r
4646 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
\r
4647 * @param[in] *pSrc points to the block of input data.
\r
4648 * @param[out] *pDst points to the block of output data
\r
4649 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4650 * @param[in] blockSize number of input samples to process per call.
\r
4654 void arm_fir_sparse_q31(
\r
4655 arm_fir_sparse_instance_q31 * S,
\r
4658 q31_t * pScratchIn,
\r
4659 uint32_t blockSize);
\r
4662 * @brief Initialization function for the Q31 sparse FIR filter.
\r
4663 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
\r
4664 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4665 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4666 * @param[in] *pState points to the state buffer.
\r
4667 * @param[in] *pTapDelay points to the array of offset times.
\r
4668 * @param[in] maxDelay maximum offset time supported.
\r
4669 * @param[in] blockSize number of samples that will be processed per block.
\r
4673 void arm_fir_sparse_init_q31(
\r
4674 arm_fir_sparse_instance_q31 * S,
\r
4678 int32_t * pTapDelay,
\r
4679 uint16_t maxDelay,
\r
4680 uint32_t blockSize);
\r
4683 * @brief Processing function for the Q15 sparse FIR filter.
\r
4684 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
\r
4685 * @param[in] *pSrc points to the block of input data.
\r
4686 * @param[out] *pDst points to the block of output data
\r
4687 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4688 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4689 * @param[in] blockSize number of input samples to process per call.
\r
4693 void arm_fir_sparse_q15(
\r
4694 arm_fir_sparse_instance_q15 * S,
\r
4697 q15_t * pScratchIn,
\r
4698 q31_t * pScratchOut,
\r
4699 uint32_t blockSize);
\r
4703 * @brief Initialization function for the Q15 sparse FIR filter.
\r
4704 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
\r
4705 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4706 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4707 * @param[in] *pState points to the state buffer.
\r
4708 * @param[in] *pTapDelay points to the array of offset times.
\r
4709 * @param[in] maxDelay maximum offset time supported.
\r
4710 * @param[in] blockSize number of samples that will be processed per block.
\r
4714 void arm_fir_sparse_init_q15(
\r
4715 arm_fir_sparse_instance_q15 * S,
\r
4719 int32_t * pTapDelay,
\r
4720 uint16_t maxDelay,
\r
4721 uint32_t blockSize);
\r
4724 * @brief Processing function for the Q7 sparse FIR filter.
\r
4725 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
\r
4726 * @param[in] *pSrc points to the block of input data.
\r
4727 * @param[out] *pDst points to the block of output data
\r
4728 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4729 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4730 * @param[in] blockSize number of input samples to process per call.
\r
4734 void arm_fir_sparse_q7(
\r
4735 arm_fir_sparse_instance_q7 * S,
\r
4738 q7_t * pScratchIn,
\r
4739 q31_t * pScratchOut,
\r
4740 uint32_t blockSize);
\r
4743 * @brief Initialization function for the Q7 sparse FIR filter.
\r
4744 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
\r
4745 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4746 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4747 * @param[in] *pState points to the state buffer.
\r
4748 * @param[in] *pTapDelay points to the array of offset times.
\r
4749 * @param[in] maxDelay maximum offset time supported.
\r
4750 * @param[in] blockSize number of samples that will be processed per block.
\r
4754 void arm_fir_sparse_init_q7(
\r
4755 arm_fir_sparse_instance_q7 * S,
\r
4759 int32_t * pTapDelay,
\r
4760 uint16_t maxDelay,
\r
4761 uint32_t blockSize);
\r
4765 * @brief Floating-point sin_cos function.
\r
4766 * @param[in] theta input value in degrees
\r
4767 * @param[out] *pSinVal points to the processed sine output.
\r
4768 * @param[out] *pCosVal points to the processed cos output.
\r
4772 void arm_sin_cos_f32(
\r
4774 float32_t * pSinVal,
\r
4775 float32_t * pCcosVal);
\r
4778 * @brief Q31 sin_cos function.
\r
4779 * @param[in] theta scaled input value in degrees
\r
4780 * @param[out] *pSinVal points to the processed sine output.
\r
4781 * @param[out] *pCosVal points to the processed cosine output.
\r
4785 void arm_sin_cos_q31(
\r
4792 * @brief Floating-point complex conjugate.
\r
4793 * @param[in] *pSrc points to the input vector
\r
4794 * @param[out] *pDst points to the output vector
\r
4795 * @param[in] numSamples number of complex samples in each vector
\r
4799 void arm_cmplx_conj_f32(
\r
4802 uint32_t numSamples);
\r
4805 * @brief Q31 complex conjugate.
\r
4806 * @param[in] *pSrc points to the input vector
\r
4807 * @param[out] *pDst points to the output vector
\r
4808 * @param[in] numSamples number of complex samples in each vector
\r
4812 void arm_cmplx_conj_q31(
\r
4815 uint32_t numSamples);
\r
4818 * @brief Q15 complex conjugate.
\r
4819 * @param[in] *pSrc points to the input vector
\r
4820 * @param[out] *pDst points to the output vector
\r
4821 * @param[in] numSamples number of complex samples in each vector
\r
4825 void arm_cmplx_conj_q15(
\r
4828 uint32_t numSamples);
\r
4833 * @brief Floating-point complex magnitude squared
\r
4834 * @param[in] *pSrc points to the complex input vector
\r
4835 * @param[out] *pDst points to the real output vector
\r
4836 * @param[in] numSamples number of complex samples in the input vector
\r
4840 void arm_cmplx_mag_squared_f32(
\r
4843 uint32_t numSamples);
\r
4846 * @brief Q31 complex magnitude squared
\r
4847 * @param[in] *pSrc points to the complex input vector
\r
4848 * @param[out] *pDst points to the real output vector
\r
4849 * @param[in] numSamples number of complex samples in the input vector
\r
4853 void arm_cmplx_mag_squared_q31(
\r
4856 uint32_t numSamples);
\r
4859 * @brief Q15 complex magnitude squared
\r
4860 * @param[in] *pSrc points to the complex input vector
\r
4861 * @param[out] *pDst points to the real output vector
\r
4862 * @param[in] numSamples number of complex samples in the input vector
\r
4866 void arm_cmplx_mag_squared_q15(
\r
4869 uint32_t numSamples);
\r
4873 * @ingroup groupController
\r
4877 * @defgroup PID PID Motor Control
\r
4879 * A Proportional Integral Derivative (PID) controller is a generic feedback control
\r
4880 * loop mechanism widely used in industrial control systems.
\r
4881 * A PID controller is the most commonly used type of feedback controller.
\r
4883 * This set of functions implements (PID) controllers
\r
4884 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
\r
4885 * of data and each call to the function returns a single processed value.
\r
4886 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
\r
4887 * is the input sample value. The functions return the output value.
\r
4891 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
\r
4892 * A0 = Kp + Ki + Kd
\r
4893 * A1 = (-Kp ) - (2 * Kd )
\r
4897 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
\r
4900 * \image html PID.gif "Proportional Integral Derivative Controller"
\r
4903 * The PID controller calculates an "error" value as the difference between
\r
4904 * the measured output and the reference input.
\r
4905 * The controller attempts to minimize the error by adjusting the process control inputs.
\r
4906 * The proportional value determines the reaction to the current error,
\r
4907 * the integral value determines the reaction based on the sum of recent errors,
\r
4908 * and the derivative value determines the reaction based on the rate at which the error has been changing.
\r
4910 * \par Instance Structure
\r
4911 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
\r
4912 * A separate instance structure must be defined for each PID Controller.
\r
4913 * There are separate instance structure declarations for each of the 3 supported data types.
\r
4915 * \par Reset Functions
\r
4916 * There is also an associated reset function for each data type which clears the state array.
\r
4918 * \par Initialization Functions
\r
4919 * There is also an associated initialization function for each data type.
\r
4920 * The initialization function performs the following operations:
\r
4921 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
\r
4922 * - Zeros out the values in the state buffer.
\r
4925 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
\r
4927 * \par Fixed-Point Behavior
\r
4928 * Care must be taken when using the fixed-point versions of the PID Controller functions.
\r
4929 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
\r
4930 * Refer to the function specific documentation below for usage guidelines.
\r
4939 * @brief Process function for the floating-point PID Control.
\r
4940 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
4941 * @param[in] in input sample to process
\r
4942 * @return out processed output sample.
\r
4946 static __INLINE float32_t arm_pid_f32(
\r
4947 arm_pid_instance_f32 * S,
\r
4952 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
\r
4953 out = (S->A0 * in) +
\r
4954 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
\r
4956 /* Update state */
\r
4957 S->state[1] = S->state[0];
\r
4959 S->state[2] = out;
\r
4961 /* return to application */
\r
4967 * @brief Process function for the Q31 PID Control.
\r
4968 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
4969 * @param[in] in input sample to process
\r
4970 * @return out processed output sample.
\r
4972 * <b>Scaling and Overflow Behavior:</b>
\r
4974 * The function is implemented using an internal 64-bit accumulator.
\r
4975 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
\r
4976 * Thus, if the accumulator result overflows it wraps around rather than clip.
\r
4977 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
\r
4978 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
\r
4981 static __INLINE q31_t arm_pid_q31(
\r
4982 arm_pid_instance_q31 * S,
\r
4988 /* acc = A0 * x[n] */
\r
4989 acc = (q63_t) S->A0 * in;
\r
4991 /* acc += A1 * x[n-1] */
\r
4992 acc += (q63_t) S->A1 * S->state[0];
\r
4994 /* acc += A2 * x[n-2] */
\r
4995 acc += (q63_t) S->A2 * S->state[1];
\r
4997 /* convert output to 1.31 format to add y[n-1] */
\r
4998 out = (q31_t) (acc >> 31u);
\r
5000 /* out += y[n-1] */
\r
5001 out += S->state[2];
\r
5003 /* Update state */
\r
5004 S->state[1] = S->state[0];
\r
5006 S->state[2] = out;
\r
5008 /* return to application */
\r
5014 * @brief Process function for the Q15 PID Control.
\r
5015 * @param[in,out] *S points to an instance of the Q15 PID Control structure
\r
5016 * @param[in] in input sample to process
\r
5017 * @return out processed output sample.
\r
5019 * <b>Scaling and Overflow Behavior:</b>
\r
5021 * The function is implemented using a 64-bit internal accumulator.
\r
5022 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
\r
5023 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
\r
5024 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
\r
5025 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
\r
5026 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
\r
5029 static __INLINE q15_t arm_pid_q15(
\r
5030 arm_pid_instance_q15 * S,
\r
5036 #ifndef ARM_MATH_CM0_FAMILY
\r
5037 __SIMD32_TYPE *vstate;
\r
5039 /* Implementation of PID controller */
\r
5041 /* acc = A0 * x[n] */
\r
5042 acc = (q31_t) __SMUAD(S->A0, in);
\r
5044 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5045 vstate = __SIMD32_CONST(S->state);
\r
5046 acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
\r
5049 /* acc = A0 * x[n] */
\r
5050 acc = ((q31_t) S->A0) * in;
\r
5052 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5053 acc += (q31_t) S->A1 * S->state[0];
\r
5054 acc += (q31_t) S->A2 * S->state[1];
\r
5058 /* acc += y[n-1] */
\r
5059 acc += (q31_t) S->state[2] << 15;
\r
5061 /* saturate the output */
\r
5062 out = (q15_t) (__SSAT((acc >> 15), 16));
\r
5064 /* Update state */
\r
5065 S->state[1] = S->state[0];
\r
5067 S->state[2] = out;
\r
5069 /* return to application */
\r
5075 * @} end of PID group
\r
5080 * @brief Floating-point matrix inverse.
\r
5081 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5082 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5083 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5084 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5087 arm_status arm_mat_inverse_f32(
\r
5088 const arm_matrix_instance_f32 * src,
\r
5089 arm_matrix_instance_f32 * dst);
\r
5094 * @ingroup groupController
\r
5099 * @defgroup clarke Vector Clarke Transform
\r
5100 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
\r
5101 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
\r
5102 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
\r
5103 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
\r
5104 * \image html clarke.gif Stator current space vector and its components in (a,b).
\r
5105 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
\r
5106 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
\r
5108 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5109 * The library provides separate functions for Q31 and floating-point data types.
\r
5111 * \image html clarkeFormula.gif
\r
5112 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
\r
5113 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
\r
5114 * \par Fixed-Point Behavior
\r
5115 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5116 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5117 * Refer to the function specific documentation below for usage guidelines.
\r
5121 * @addtogroup clarke
\r
5127 * @brief Floating-point Clarke transform
\r
5128 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5129 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5130 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5131 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5135 static __INLINE void arm_clarke_f32(
\r
5138 float32_t * pIalpha,
\r
5139 float32_t * pIbeta)
\r
5141 /* Calculate pIalpha using the equation, pIalpha = Ia */
\r
5144 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
\r
5146 ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
\r
5151 * @brief Clarke transform for Q31 version
\r
5152 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5153 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5154 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5155 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5158 * <b>Scaling and Overflow Behavior:</b>
\r
5160 * The function is implemented using an internal 32-bit accumulator.
\r
5161 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5162 * There is saturation on the addition, hence there is no risk of overflow.
\r
5165 static __INLINE void arm_clarke_q31(
\r
5171 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5173 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
\r
5176 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
\r
5177 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
\r
5179 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
\r
5180 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
\r
5182 /* pIbeta is calculated by adding the intermediate products */
\r
5183 *pIbeta = __QADD(product1, product2);
\r
5187 * @} end of clarke group
\r
5191 * @brief Converts the elements of the Q7 vector to Q31 vector.
\r
5192 * @param[in] *pSrc input pointer
\r
5193 * @param[out] *pDst output pointer
\r
5194 * @param[in] blockSize number of samples to process
\r
5197 void arm_q7_to_q31(
\r
5200 uint32_t blockSize);
\r
5206 * @ingroup groupController
\r
5210 * @defgroup inv_clarke Vector Inverse Clarke Transform
\r
5211 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
\r
5213 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5214 * The library provides separate functions for Q31 and floating-point data types.
\r
5216 * \image html clarkeInvFormula.gif
\r
5217 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
\r
5218 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
\r
5219 * \par Fixed-Point Behavior
\r
5220 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5221 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5222 * Refer to the function specific documentation below for usage guidelines.
\r
5226 * @addtogroup inv_clarke
\r
5231 * @brief Floating-point Inverse Clarke transform
\r
5232 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5233 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5234 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5235 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5240 static __INLINE void arm_inv_clarke_f32(
\r
5246 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5249 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
\r
5250 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
\r
5255 * @brief Inverse Clarke transform for Q31 version
\r
5256 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5257 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5258 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5259 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5262 * <b>Scaling and Overflow Behavior:</b>
\r
5264 * The function is implemented using an internal 32-bit accumulator.
\r
5265 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5266 * There is saturation on the subtraction, hence there is no risk of overflow.
\r
5269 static __INLINE void arm_inv_clarke_q31(
\r
5275 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5277 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5280 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
\r
5281 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
\r
5283 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
\r
5284 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
\r
5286 /* pIb is calculated by subtracting the products */
\r
5287 *pIb = __QSUB(product2, product1);
\r
5292 * @} end of inv_clarke group
\r
5296 * @brief Converts the elements of the Q7 vector to Q15 vector.
\r
5297 * @param[in] *pSrc input pointer
\r
5298 * @param[out] *pDst output pointer
\r
5299 * @param[in] blockSize number of samples to process
\r
5302 void arm_q7_to_q15(
\r
5305 uint32_t blockSize);
\r
5310 * @ingroup groupController
\r
5314 * @defgroup park Vector Park Transform
\r
5316 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
\r
5317 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
\r
5318 * from the stationary to the moving reference frame and control the spatial relationship between
\r
5319 * the stator vector current and rotor flux vector.
\r
5320 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
\r
5321 * current vector and the relationship from the two reference frames:
\r
5322 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
\r
5324 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5325 * The library provides separate functions for Q31 and floating-point data types.
\r
5327 * \image html parkFormula.gif
\r
5328 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
\r
5329 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5330 * cosine and sine values of theta (rotor flux position).
\r
5331 * \par Fixed-Point Behavior
\r
5332 * Care must be taken when using the Q31 version of the Park transform.
\r
5333 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5334 * Refer to the function specific documentation below for usage guidelines.
\r
5338 * @addtogroup park
\r
5343 * @brief Floating-point Park transform
\r
5344 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5345 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5346 * @param[out] *pId points to output rotor reference frame d
\r
5347 * @param[out] *pIq points to output rotor reference frame q
\r
5348 * @param[in] sinVal sine value of rotation angle theta
\r
5349 * @param[in] cosVal cosine value of rotation angle theta
\r
5352 * The function implements the forward Park transform.
\r
5356 static __INLINE void arm_park_f32(
\r
5364 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
\r
5365 *pId = Ialpha * cosVal + Ibeta * sinVal;
\r
5367 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
\r
5368 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
\r
5373 * @brief Park transform for Q31 version
\r
5374 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5375 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5376 * @param[out] *pId points to output rotor reference frame d
\r
5377 * @param[out] *pIq points to output rotor reference frame q
\r
5378 * @param[in] sinVal sine value of rotation angle theta
\r
5379 * @param[in] cosVal cosine value of rotation angle theta
\r
5382 * <b>Scaling and Overflow Behavior:</b>
\r
5384 * The function is implemented using an internal 32-bit accumulator.
\r
5385 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5386 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
\r
5390 static __INLINE void arm_park_q31(
\r
5398 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5399 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5401 /* Intermediate product is calculated by (Ialpha * cosVal) */
\r
5402 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
\r
5404 /* Intermediate product is calculated by (Ibeta * sinVal) */
\r
5405 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
\r
5408 /* Intermediate product is calculated by (Ialpha * sinVal) */
\r
5409 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
\r
5411 /* Intermediate product is calculated by (Ibeta * cosVal) */
\r
5412 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
\r
5414 /* Calculate pId by adding the two intermediate products 1 and 2 */
\r
5415 *pId = __QADD(product1, product2);
\r
5417 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
\r
5418 *pIq = __QSUB(product4, product3);
\r
5422 * @} end of park group
\r
5426 * @brief Converts the elements of the Q7 vector to floating-point vector.
\r
5427 * @param[in] *pSrc is input pointer
\r
5428 * @param[out] *pDst is output pointer
\r
5429 * @param[in] blockSize is the number of samples to process
\r
5432 void arm_q7_to_float(
\r
5435 uint32_t blockSize);
\r
5439 * @ingroup groupController
\r
5443 * @defgroup inv_park Vector Inverse Park transform
\r
5444 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
\r
5446 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5447 * The library provides separate functions for Q31 and floating-point data types.
\r
5449 * \image html parkInvFormula.gif
\r
5450 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
\r
5451 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5452 * cosine and sine values of theta (rotor flux position).
\r
5453 * \par Fixed-Point Behavior
\r
5454 * Care must be taken when using the Q31 version of the Park transform.
\r
5455 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5456 * Refer to the function specific documentation below for usage guidelines.
\r
5460 * @addtogroup inv_park
\r
5465 * @brief Floating-point Inverse Park transform
\r
5466 * @param[in] Id input coordinate of rotor reference frame d
\r
5467 * @param[in] Iq input coordinate of rotor reference frame q
\r
5468 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5469 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5470 * @param[in] sinVal sine value of rotation angle theta
\r
5471 * @param[in] cosVal cosine value of rotation angle theta
\r
5475 static __INLINE void arm_inv_park_f32(
\r
5478 float32_t * pIalpha,
\r
5479 float32_t * pIbeta,
\r
5483 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
\r
5484 *pIalpha = Id * cosVal - Iq * sinVal;
\r
5486 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
\r
5487 *pIbeta = Id * sinVal + Iq * cosVal;
\r
5493 * @brief Inverse Park transform for Q31 version
\r
5494 * @param[in] Id input coordinate of rotor reference frame d
\r
5495 * @param[in] Iq input coordinate of rotor reference frame q
\r
5496 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5497 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5498 * @param[in] sinVal sine value of rotation angle theta
\r
5499 * @param[in] cosVal cosine value of rotation angle theta
\r
5502 * <b>Scaling and Overflow Behavior:</b>
\r
5504 * The function is implemented using an internal 32-bit accumulator.
\r
5505 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5506 * There is saturation on the addition, hence there is no risk of overflow.
\r
5510 static __INLINE void arm_inv_park_q31(
\r
5518 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5519 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5521 /* Intermediate product is calculated by (Id * cosVal) */
\r
5522 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
\r
5524 /* Intermediate product is calculated by (Iq * sinVal) */
\r
5525 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
\r
5528 /* Intermediate product is calculated by (Id * sinVal) */
\r
5529 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
\r
5531 /* Intermediate product is calculated by (Iq * cosVal) */
\r
5532 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
\r
5534 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
\r
5535 *pIalpha = __QSUB(product1, product2);
\r
5537 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
\r
5538 *pIbeta = __QADD(product4, product3);
\r
5543 * @} end of Inverse park group
\r
5548 * @brief Converts the elements of the Q31 vector to floating-point vector.
\r
5549 * @param[in] *pSrc is input pointer
\r
5550 * @param[out] *pDst is output pointer
\r
5551 * @param[in] blockSize is the number of samples to process
\r
5554 void arm_q31_to_float(
\r
5557 uint32_t blockSize);
\r
5560 * @ingroup groupInterpolation
\r
5564 * @defgroup LinearInterpolate Linear Interpolation
\r
5566 * Linear interpolation is a method of curve fitting using linear polynomials.
\r
5567 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
\r
5570 * \image html LinearInterp.gif "Linear interpolation"
\r
5573 * A Linear Interpolate function calculates an output value(y), for the input(x)
\r
5574 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
\r
5578 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
\r
5579 * where x0, x1 are nearest values of input x
\r
5580 * y0, y1 are nearest values to output y
\r
5584 * This set of functions implements Linear interpolation process
\r
5585 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
\r
5586 * sample of data and each call to the function returns a single processed value.
\r
5587 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
\r
5588 * <code>x</code> is the input sample value. The functions returns the output value.
\r
5591 * if x is outside of the table boundary, Linear interpolation returns first value of the table
\r
5592 * if x is below input range and returns last value of table if x is above range.
\r
5596 * @addtogroup LinearInterpolate
\r
5601 * @brief Process function for the floating-point Linear Interpolation Function.
\r
5602 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
\r
5603 * @param[in] x input sample to process
\r
5604 * @return y processed output sample.
\r
5608 static __INLINE float32_t arm_linear_interp_f32(
\r
5609 arm_linear_interp_instance_f32 * S,
\r
5614 float32_t x0, x1; /* Nearest input values */
\r
5615 float32_t y0, y1; /* Nearest output values */
\r
5616 float32_t xSpacing = S->xSpacing; /* spacing between input values */
\r
5617 int32_t i; /* Index variable */
\r
5618 float32_t *pYData = S->pYData; /* pointer to output table */
\r
5620 /* Calculation of index */
\r
5621 i = (int32_t) ((x - S->x1) / xSpacing);
\r
5625 /* Iniatilize output for below specified range as least output value of table */
\r
5628 else if((uint32_t)i >= S->nValues)
\r
5630 /* Iniatilize output for above specified range as last output value of table */
\r
5631 y = pYData[S->nValues - 1];
\r
5635 /* Calculation of nearest input values */
\r
5636 x0 = S->x1 + i * xSpacing;
\r
5637 x1 = S->x1 + (i + 1) * xSpacing;
\r
5639 /* Read of nearest output values */
\r
5641 y1 = pYData[i + 1];
\r
5643 /* Calculation of output */
\r
5644 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
\r
5648 /* returns output value */
\r
5654 * @brief Process function for the Q31 Linear Interpolation Function.
\r
5655 * @param[in] *pYData pointer to Q31 Linear Interpolation table
\r
5656 * @param[in] x input sample to process
\r
5657 * @param[in] nValues number of table values
\r
5658 * @return y processed output sample.
\r
5661 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5662 * This function can support maximum of table size 2^12.
\r
5667 static __INLINE q31_t arm_linear_interp_q31(
\r
5672 q31_t y; /* output */
\r
5673 q31_t y0, y1; /* Nearest output values */
\r
5674 q31_t fract; /* fractional part */
\r
5675 int32_t index; /* Index to read nearest output values */
\r
5677 /* Input is in 12.20 format */
\r
5678 /* 12 bits for the table index */
\r
5679 /* Index value calculation */
\r
5680 index = ((x & 0xFFF00000) >> 20);
\r
5682 if(index >= (int32_t)(nValues - 1))
\r
5684 return (pYData[nValues - 1]);
\r
5686 else if(index < 0)
\r
5688 return (pYData[0]);
\r
5693 /* 20 bits for the fractional part */
\r
5694 /* shift left by 11 to keep fract in 1.31 format */
\r
5695 fract = (x & 0x000FFFFF) << 11;
\r
5697 /* Read two nearest output values from the index in 1.31(q31) format */
\r
5698 y0 = pYData[index];
\r
5699 y1 = pYData[index + 1u];
\r
5701 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
\r
5702 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
\r
5704 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
\r
5705 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
\r
5707 /* Convert y to 1.31 format */
\r
5716 * @brief Process function for the Q15 Linear Interpolation Function.
\r
5717 * @param[in] *pYData pointer to Q15 Linear Interpolation table
\r
5718 * @param[in] x input sample to process
\r
5719 * @param[in] nValues number of table values
\r
5720 * @return y processed output sample.
\r
5723 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5724 * This function can support maximum of table size 2^12.
\r
5729 static __INLINE q15_t arm_linear_interp_q15(
\r
5734 q63_t y; /* output */
\r
5735 q15_t y0, y1; /* Nearest output values */
\r
5736 q31_t fract; /* fractional part */
\r
5737 int32_t index; /* Index to read nearest output values */
\r
5739 /* Input is in 12.20 format */
\r
5740 /* 12 bits for the table index */
\r
5741 /* Index value calculation */
\r
5742 index = ((x & 0xFFF00000) >> 20u);
\r
5744 if(index >= (int32_t)(nValues - 1))
\r
5746 return (pYData[nValues - 1]);
\r
5748 else if(index < 0)
\r
5750 return (pYData[0]);
\r
5754 /* 20 bits for the fractional part */
\r
5755 /* fract is in 12.20 format */
\r
5756 fract = (x & 0x000FFFFF);
\r
5758 /* Read two nearest output values from the index */
\r
5759 y0 = pYData[index];
\r
5760 y1 = pYData[index + 1u];
\r
5762 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
\r
5763 y = ((q63_t) y0 * (0xFFFFF - fract));
\r
5765 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
\r
5766 y += ((q63_t) y1 * (fract));
\r
5768 /* convert y to 1.15 format */
\r
5777 * @brief Process function for the Q7 Linear Interpolation Function.
\r
5778 * @param[in] *pYData pointer to Q7 Linear Interpolation table
\r
5779 * @param[in] x input sample to process
\r
5780 * @param[in] nValues number of table values
\r
5781 * @return y processed output sample.
\r
5784 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5785 * This function can support maximum of table size 2^12.
\r
5789 static __INLINE q7_t arm_linear_interp_q7(
\r
5794 q31_t y; /* output */
\r
5795 q7_t y0, y1; /* Nearest output values */
\r
5796 q31_t fract; /* fractional part */
\r
5797 uint32_t index; /* Index to read nearest output values */
\r
5799 /* Input is in 12.20 format */
\r
5800 /* 12 bits for the table index */
\r
5801 /* Index value calculation */
\r
5804 return (pYData[0]);
\r
5806 index = (x >> 20) & 0xfff;
\r
5809 if(index >= (nValues - 1))
\r
5811 return (pYData[nValues - 1]);
\r
5816 /* 20 bits for the fractional part */
\r
5817 /* fract is in 12.20 format */
\r
5818 fract = (x & 0x000FFFFF);
\r
5820 /* Read two nearest output values from the index and are in 1.7(q7) format */
\r
5821 y0 = pYData[index];
\r
5822 y1 = pYData[index + 1u];
\r
5824 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
\r
5825 y = ((y0 * (0xFFFFF - fract)));
\r
5827 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
\r
5828 y += (y1 * fract);
\r
5830 /* convert y to 1.7(q7) format */
\r
5831 return (y >> 20u);
\r
5837 * @} end of LinearInterpolate group
\r
5841 * @brief Fast approximation to the trigonometric sine function for floating-point data.
\r
5842 * @param[in] x input value in radians.
\r
5846 float32_t arm_sin_f32(
\r
5850 * @brief Fast approximation to the trigonometric sine function for Q31 data.
\r
5851 * @param[in] x Scaled input value in radians.
\r
5855 q31_t arm_sin_q31(
\r
5859 * @brief Fast approximation to the trigonometric sine function for Q15 data.
\r
5860 * @param[in] x Scaled input value in radians.
\r
5864 q15_t arm_sin_q15(
\r
5868 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
\r
5869 * @param[in] x input value in radians.
\r
5873 float32_t arm_cos_f32(
\r
5877 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
\r
5878 * @param[in] x Scaled input value in radians.
\r
5882 q31_t arm_cos_q31(
\r
5886 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
\r
5887 * @param[in] x Scaled input value in radians.
\r
5891 q15_t arm_cos_q15(
\r
5896 * @ingroup groupFastMath
\r
5901 * @defgroup SQRT Square Root
\r
5903 * Computes the square root of a number.
\r
5904 * There are separate functions for Q15, Q31, and floating-point data types.
\r
5905 * The square root function is computed using the Newton-Raphson algorithm.
\r
5906 * This is an iterative algorithm of the form:
\r
5908 * x1 = x0 - f(x0)/f'(x0)
\r
5910 * where <code>x1</code> is the current estimate,
\r
5911 * <code>x0</code> is the previous estimate, and
\r
5912 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
\r
5913 * For the square root function, the algorithm reduces to:
\r
5915 * x0 = in/2 [initial guess]
\r
5916 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
\r
5922 * @addtogroup SQRT
\r
5927 * @brief Floating-point square root function.
\r
5928 * @param[in] in input value.
\r
5929 * @param[out] *pOut square root of input value.
\r
5930 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5931 * <code>in</code> is negative value and returns zero output for negative values.
\r
5934 static __INLINE arm_status arm_sqrt_f32(
\r
5942 #if (__FPU_USED == 1) && defined ( __CC_ARM )
\r
5943 *pOut = __sqrtf(in);
\r
5945 *pOut = sqrtf(in);
\r
5948 return (ARM_MATH_SUCCESS);
\r
5953 return (ARM_MATH_ARGUMENT_ERROR);
\r
5960 * @brief Q31 square root function.
\r
5961 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
\r
5962 * @param[out] *pOut square root of input value.
\r
5963 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5964 * <code>in</code> is negative value and returns zero output for negative values.
\r
5966 arm_status arm_sqrt_q31(
\r
5971 * @brief Q15 square root function.
\r
5972 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
\r
5973 * @param[out] *pOut square root of input value.
\r
5974 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5975 * <code>in</code> is negative value and returns zero output for negative values.
\r
5977 arm_status arm_sqrt_q15(
\r
5982 * @} end of SQRT group
\r
5991 * @brief floating-point Circular write function.
\r
5994 static __INLINE void arm_circularWrite_f32(
\r
5995 int32_t * circBuffer,
\r
5997 uint16_t * writeOffset,
\r
5998 int32_t bufferInc,
\r
5999 const int32_t * src,
\r
6001 uint32_t blockSize)
\r
6006 /* Copy the value of Index pointer that points
\r
6007 * to the current location where the input samples to be copied */
\r
6008 wOffset = *writeOffset;
\r
6010 /* Loop over the blockSize */
\r
6015 /* copy the input sample to the circular buffer */
\r
6016 circBuffer[wOffset] = *src;
\r
6018 /* Update the input pointer */
\r
6021 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6022 wOffset += bufferInc;
\r
6026 /* Decrement the loop counter */
\r
6030 /* Update the index pointer */
\r
6031 *writeOffset = wOffset;
\r
6037 * @brief floating-point Circular Read function.
\r
6039 static __INLINE void arm_circularRead_f32(
\r
6040 int32_t * circBuffer,
\r
6042 int32_t * readOffset,
\r
6043 int32_t bufferInc,
\r
6045 int32_t * dst_base,
\r
6046 int32_t dst_length,
\r
6048 uint32_t blockSize)
\r
6051 int32_t rOffset, dst_end;
\r
6053 /* Copy the value of Index pointer that points
\r
6054 * to the current location from where the input samples to be read */
\r
6055 rOffset = *readOffset;
\r
6056 dst_end = (int32_t) (dst_base + dst_length);
\r
6058 /* Loop over the blockSize */
\r
6063 /* copy the sample from the circular buffer to the destination buffer */
\r
6064 *dst = circBuffer[rOffset];
\r
6066 /* Update the input pointer */
\r
6069 if(dst == (int32_t *) dst_end)
\r
6074 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6075 rOffset += bufferInc;
\r
6082 /* Decrement the loop counter */
\r
6086 /* Update the index pointer */
\r
6087 *readOffset = rOffset;
\r
6091 * @brief Q15 Circular write function.
\r
6094 static __INLINE void arm_circularWrite_q15(
\r
6095 q15_t * circBuffer,
\r
6097 uint16_t * writeOffset,
\r
6098 int32_t bufferInc,
\r
6099 const q15_t * src,
\r
6101 uint32_t blockSize)
\r
6106 /* Copy the value of Index pointer that points
\r
6107 * to the current location where the input samples to be copied */
\r
6108 wOffset = *writeOffset;
\r
6110 /* Loop over the blockSize */
\r
6115 /* copy the input sample to the circular buffer */
\r
6116 circBuffer[wOffset] = *src;
\r
6118 /* Update the input pointer */
\r
6121 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6122 wOffset += bufferInc;
\r
6126 /* Decrement the loop counter */
\r
6130 /* Update the index pointer */
\r
6131 *writeOffset = wOffset;
\r
6137 * @brief Q15 Circular Read function.
\r
6139 static __INLINE void arm_circularRead_q15(
\r
6140 q15_t * circBuffer,
\r
6142 int32_t * readOffset,
\r
6143 int32_t bufferInc,
\r
6146 int32_t dst_length,
\r
6148 uint32_t blockSize)
\r
6151 int32_t rOffset, dst_end;
\r
6153 /* Copy the value of Index pointer that points
\r
6154 * to the current location from where the input samples to be read */
\r
6155 rOffset = *readOffset;
\r
6157 dst_end = (int32_t) (dst_base + dst_length);
\r
6159 /* Loop over the blockSize */
\r
6164 /* copy the sample from the circular buffer to the destination buffer */
\r
6165 *dst = circBuffer[rOffset];
\r
6167 /* Update the input pointer */
\r
6170 if(dst == (q15_t *) dst_end)
\r
6175 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6176 rOffset += bufferInc;
\r
6183 /* Decrement the loop counter */
\r
6187 /* Update the index pointer */
\r
6188 *readOffset = rOffset;
\r
6193 * @brief Q7 Circular write function.
\r
6196 static __INLINE void arm_circularWrite_q7(
\r
6197 q7_t * circBuffer,
\r
6199 uint16_t * writeOffset,
\r
6200 int32_t bufferInc,
\r
6203 uint32_t blockSize)
\r
6208 /* Copy the value of Index pointer that points
\r
6209 * to the current location where the input samples to be copied */
\r
6210 wOffset = *writeOffset;
\r
6212 /* Loop over the blockSize */
\r
6217 /* copy the input sample to the circular buffer */
\r
6218 circBuffer[wOffset] = *src;
\r
6220 /* Update the input pointer */
\r
6223 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6224 wOffset += bufferInc;
\r
6228 /* Decrement the loop counter */
\r
6232 /* Update the index pointer */
\r
6233 *writeOffset = wOffset;
\r
6239 * @brief Q7 Circular Read function.
\r
6241 static __INLINE void arm_circularRead_q7(
\r
6242 q7_t * circBuffer,
\r
6244 int32_t * readOffset,
\r
6245 int32_t bufferInc,
\r
6248 int32_t dst_length,
\r
6250 uint32_t blockSize)
\r
6253 int32_t rOffset, dst_end;
\r
6255 /* Copy the value of Index pointer that points
\r
6256 * to the current location from where the input samples to be read */
\r
6257 rOffset = *readOffset;
\r
6259 dst_end = (int32_t) (dst_base + dst_length);
\r
6261 /* Loop over the blockSize */
\r
6266 /* copy the sample from the circular buffer to the destination buffer */
\r
6267 *dst = circBuffer[rOffset];
\r
6269 /* Update the input pointer */
\r
6272 if(dst == (q7_t *) dst_end)
\r
6277 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6278 rOffset += bufferInc;
\r
6285 /* Decrement the loop counter */
\r
6289 /* Update the index pointer */
\r
6290 *readOffset = rOffset;
\r
6295 * @brief Sum of the squares of the elements of a Q31 vector.
\r
6296 * @param[in] *pSrc is input pointer
\r
6297 * @param[in] blockSize is the number of samples to process
\r
6298 * @param[out] *pResult is output value.
\r
6302 void arm_power_q31(
\r
6304 uint32_t blockSize,
\r
6308 * @brief Sum of the squares of the elements of a floating-point vector.
\r
6309 * @param[in] *pSrc is input pointer
\r
6310 * @param[in] blockSize is the number of samples to process
\r
6311 * @param[out] *pResult is output value.
\r
6315 void arm_power_f32(
\r
6317 uint32_t blockSize,
\r
6318 float32_t * pResult);
\r
6321 * @brief Sum of the squares of the elements of a Q15 vector.
\r
6322 * @param[in] *pSrc is input pointer
\r
6323 * @param[in] blockSize is the number of samples to process
\r
6324 * @param[out] *pResult is output value.
\r
6328 void arm_power_q15(
\r
6330 uint32_t blockSize,
\r
6334 * @brief Sum of the squares of the elements of a Q7 vector.
\r
6335 * @param[in] *pSrc is input pointer
\r
6336 * @param[in] blockSize is the number of samples to process
\r
6337 * @param[out] *pResult is output value.
\r
6341 void arm_power_q7(
\r
6343 uint32_t blockSize,
\r
6347 * @brief Mean value of a Q7 vector.
\r
6348 * @param[in] *pSrc is input pointer
\r
6349 * @param[in] blockSize is the number of samples to process
\r
6350 * @param[out] *pResult is output value.
\r
6356 uint32_t blockSize,
\r
6360 * @brief Mean value of a Q15 vector.
\r
6361 * @param[in] *pSrc is input pointer
\r
6362 * @param[in] blockSize is the number of samples to process
\r
6363 * @param[out] *pResult is output value.
\r
6366 void arm_mean_q15(
\r
6368 uint32_t blockSize,
\r
6372 * @brief Mean value of a Q31 vector.
\r
6373 * @param[in] *pSrc is input pointer
\r
6374 * @param[in] blockSize is the number of samples to process
\r
6375 * @param[out] *pResult is output value.
\r
6378 void arm_mean_q31(
\r
6380 uint32_t blockSize,
\r
6384 * @brief Mean value of a floating-point vector.
\r
6385 * @param[in] *pSrc is input pointer
\r
6386 * @param[in] blockSize is the number of samples to process
\r
6387 * @param[out] *pResult is output value.
\r
6390 void arm_mean_f32(
\r
6392 uint32_t blockSize,
\r
6393 float32_t * pResult);
\r
6396 * @brief Variance of the elements of a floating-point vector.
\r
6397 * @param[in] *pSrc is input pointer
\r
6398 * @param[in] blockSize is the number of samples to process
\r
6399 * @param[out] *pResult is output value.
\r
6405 uint32_t blockSize,
\r
6406 float32_t * pResult);
\r
6409 * @brief Variance of the elements of a Q31 vector.
\r
6410 * @param[in] *pSrc is input pointer
\r
6411 * @param[in] blockSize is the number of samples to process
\r
6412 * @param[out] *pResult is output value.
\r
6418 uint32_t blockSize,
\r
6422 * @brief Variance of the elements of a Q15 vector.
\r
6423 * @param[in] *pSrc is input pointer
\r
6424 * @param[in] blockSize is the number of samples to process
\r
6425 * @param[out] *pResult is output value.
\r
6431 uint32_t blockSize,
\r
6435 * @brief Root Mean Square of the elements of a floating-point vector.
\r
6436 * @param[in] *pSrc is input pointer
\r
6437 * @param[in] blockSize is the number of samples to process
\r
6438 * @param[out] *pResult is output value.
\r
6444 uint32_t blockSize,
\r
6445 float32_t * pResult);
\r
6448 * @brief Root Mean Square of the elements of a Q31 vector.
\r
6449 * @param[in] *pSrc is input pointer
\r
6450 * @param[in] blockSize is the number of samples to process
\r
6451 * @param[out] *pResult is output value.
\r
6457 uint32_t blockSize,
\r
6461 * @brief Root Mean Square of the elements of a Q15 vector.
\r
6462 * @param[in] *pSrc is input pointer
\r
6463 * @param[in] blockSize is the number of samples to process
\r
6464 * @param[out] *pResult is output value.
\r
6470 uint32_t blockSize,
\r
6474 * @brief Standard deviation of the elements of a floating-point vector.
\r
6475 * @param[in] *pSrc is input pointer
\r
6476 * @param[in] blockSize is the number of samples to process
\r
6477 * @param[out] *pResult is output value.
\r
6483 uint32_t blockSize,
\r
6484 float32_t * pResult);
\r
6487 * @brief Standard deviation of the elements of a Q31 vector.
\r
6488 * @param[in] *pSrc is input pointer
\r
6489 * @param[in] blockSize is the number of samples to process
\r
6490 * @param[out] *pResult is output value.
\r
6496 uint32_t blockSize,
\r
6500 * @brief Standard deviation of the elements of a Q15 vector.
\r
6501 * @param[in] *pSrc is input pointer
\r
6502 * @param[in] blockSize is the number of samples to process
\r
6503 * @param[out] *pResult is output value.
\r
6509 uint32_t blockSize,
\r
6513 * @brief Floating-point complex magnitude
\r
6514 * @param[in] *pSrc points to the complex input vector
\r
6515 * @param[out] *pDst points to the real output vector
\r
6516 * @param[in] numSamples number of complex samples in the input vector
\r
6520 void arm_cmplx_mag_f32(
\r
6523 uint32_t numSamples);
\r
6526 * @brief Q31 complex magnitude
\r
6527 * @param[in] *pSrc points to the complex input vector
\r
6528 * @param[out] *pDst points to the real output vector
\r
6529 * @param[in] numSamples number of complex samples in the input vector
\r
6533 void arm_cmplx_mag_q31(
\r
6536 uint32_t numSamples);
\r
6539 * @brief Q15 complex magnitude
\r
6540 * @param[in] *pSrc points to the complex input vector
\r
6541 * @param[out] *pDst points to the real output vector
\r
6542 * @param[in] numSamples number of complex samples in the input vector
\r
6546 void arm_cmplx_mag_q15(
\r
6549 uint32_t numSamples);
\r
6552 * @brief Q15 complex dot product
\r
6553 * @param[in] *pSrcA points to the first input vector
\r
6554 * @param[in] *pSrcB points to the second input vector
\r
6555 * @param[in] numSamples number of complex samples in each vector
\r
6556 * @param[out] *realResult real part of the result returned here
\r
6557 * @param[out] *imagResult imaginary part of the result returned here
\r
6561 void arm_cmplx_dot_prod_q15(
\r
6564 uint32_t numSamples,
\r
6565 q31_t * realResult,
\r
6566 q31_t * imagResult);
\r
6569 * @brief Q31 complex dot product
\r
6570 * @param[in] *pSrcA points to the first input vector
\r
6571 * @param[in] *pSrcB points to the second input vector
\r
6572 * @param[in] numSamples number of complex samples in each vector
\r
6573 * @param[out] *realResult real part of the result returned here
\r
6574 * @param[out] *imagResult imaginary part of the result returned here
\r
6578 void arm_cmplx_dot_prod_q31(
\r
6581 uint32_t numSamples,
\r
6582 q63_t * realResult,
\r
6583 q63_t * imagResult);
\r
6586 * @brief Floating-point complex dot product
\r
6587 * @param[in] *pSrcA points to the first input vector
\r
6588 * @param[in] *pSrcB points to the second input vector
\r
6589 * @param[in] numSamples number of complex samples in each vector
\r
6590 * @param[out] *realResult real part of the result returned here
\r
6591 * @param[out] *imagResult imaginary part of the result returned here
\r
6595 void arm_cmplx_dot_prod_f32(
\r
6596 float32_t * pSrcA,
\r
6597 float32_t * pSrcB,
\r
6598 uint32_t numSamples,
\r
6599 float32_t * realResult,
\r
6600 float32_t * imagResult);
\r
6603 * @brief Q15 complex-by-real multiplication
\r
6604 * @param[in] *pSrcCmplx points to the complex input vector
\r
6605 * @param[in] *pSrcReal points to the real input vector
\r
6606 * @param[out] *pCmplxDst points to the complex output vector
\r
6607 * @param[in] numSamples number of samples in each vector
\r
6611 void arm_cmplx_mult_real_q15(
\r
6612 q15_t * pSrcCmplx,
\r
6614 q15_t * pCmplxDst,
\r
6615 uint32_t numSamples);
\r
6618 * @brief Q31 complex-by-real multiplication
\r
6619 * @param[in] *pSrcCmplx points to the complex input vector
\r
6620 * @param[in] *pSrcReal points to the real input vector
\r
6621 * @param[out] *pCmplxDst points to the complex output vector
\r
6622 * @param[in] numSamples number of samples in each vector
\r
6626 void arm_cmplx_mult_real_q31(
\r
6627 q31_t * pSrcCmplx,
\r
6629 q31_t * pCmplxDst,
\r
6630 uint32_t numSamples);
\r
6633 * @brief Floating-point complex-by-real multiplication
\r
6634 * @param[in] *pSrcCmplx points to the complex input vector
\r
6635 * @param[in] *pSrcReal points to the real input vector
\r
6636 * @param[out] *pCmplxDst points to the complex output vector
\r
6637 * @param[in] numSamples number of samples in each vector
\r
6641 void arm_cmplx_mult_real_f32(
\r
6642 float32_t * pSrcCmplx,
\r
6643 float32_t * pSrcReal,
\r
6644 float32_t * pCmplxDst,
\r
6645 uint32_t numSamples);
\r
6648 * @brief Minimum value of a Q7 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] *result is output pointer
\r
6652 * @param[in] index is the array index of the minimum value in the input buffer.
\r
6658 uint32_t blockSize,
\r
6660 uint32_t * index);
\r
6663 * @brief Minimum value of a Q15 vector.
\r
6664 * @param[in] *pSrc is input pointer
\r
6665 * @param[in] blockSize is the number of samples to process
\r
6666 * @param[out] *pResult is output pointer
\r
6667 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
\r
6673 uint32_t blockSize,
\r
6675 uint32_t * pIndex);
\r
6678 * @brief Minimum value of a Q31 vector.
\r
6679 * @param[in] *pSrc is input pointer
\r
6680 * @param[in] blockSize is the number of samples to process
\r
6681 * @param[out] *pResult is output pointer
\r
6682 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6687 uint32_t blockSize,
\r
6689 uint32_t * pIndex);
\r
6692 * @brief Minimum value of a floating-point vector.
\r
6693 * @param[in] *pSrc is input pointer
\r
6694 * @param[in] blockSize is the number of samples to process
\r
6695 * @param[out] *pResult is output pointer
\r
6696 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6702 uint32_t blockSize,
\r
6703 float32_t * pResult,
\r
6704 uint32_t * pIndex);
\r
6707 * @brief Maximum value of a Q7 vector.
\r
6708 * @param[in] *pSrc points to the input buffer
\r
6709 * @param[in] blockSize length of the input vector
\r
6710 * @param[out] *pResult maximum value returned here
\r
6711 * @param[out] *pIndex index of maximum value returned here
\r
6717 uint32_t blockSize,
\r
6719 uint32_t * pIndex);
\r
6722 * @brief Maximum value of a Q15 vector.
\r
6723 * @param[in] *pSrc points to the input buffer
\r
6724 * @param[in] blockSize length of the input vector
\r
6725 * @param[out] *pResult maximum value returned here
\r
6726 * @param[out] *pIndex index of maximum value returned here
\r
6732 uint32_t blockSize,
\r
6734 uint32_t * pIndex);
\r
6737 * @brief Maximum value of a Q31 vector.
\r
6738 * @param[in] *pSrc points to the input buffer
\r
6739 * @param[in] blockSize length of the input vector
\r
6740 * @param[out] *pResult maximum value returned here
\r
6741 * @param[out] *pIndex index of maximum value returned here
\r
6747 uint32_t blockSize,
\r
6749 uint32_t * pIndex);
\r
6752 * @brief Maximum value of a floating-point vector.
\r
6753 * @param[in] *pSrc points to the input buffer
\r
6754 * @param[in] blockSize length of the input vector
\r
6755 * @param[out] *pResult maximum value returned here
\r
6756 * @param[out] *pIndex index of maximum value returned here
\r
6762 uint32_t blockSize,
\r
6763 float32_t * pResult,
\r
6764 uint32_t * pIndex);
\r
6767 * @brief Q15 complex-by-complex multiplication
\r
6768 * @param[in] *pSrcA points to the first input vector
\r
6769 * @param[in] *pSrcB points to the second input vector
\r
6770 * @param[out] *pDst points to the output vector
\r
6771 * @param[in] numSamples number of complex samples in each vector
\r
6775 void arm_cmplx_mult_cmplx_q15(
\r
6779 uint32_t numSamples);
\r
6782 * @brief Q31 complex-by-complex multiplication
\r
6783 * @param[in] *pSrcA points to the first input vector
\r
6784 * @param[in] *pSrcB points to the second input vector
\r
6785 * @param[out] *pDst points to the output vector
\r
6786 * @param[in] numSamples number of complex samples in each vector
\r
6790 void arm_cmplx_mult_cmplx_q31(
\r
6794 uint32_t numSamples);
\r
6797 * @brief Floating-point complex-by-complex multiplication
\r
6798 * @param[in] *pSrcA points to the first input vector
\r
6799 * @param[in] *pSrcB points to the second input vector
\r
6800 * @param[out] *pDst points to the output vector
\r
6801 * @param[in] numSamples number of complex samples in each vector
\r
6805 void arm_cmplx_mult_cmplx_f32(
\r
6806 float32_t * pSrcA,
\r
6807 float32_t * pSrcB,
\r
6809 uint32_t numSamples);
\r
6812 * @brief Converts the elements of the floating-point vector to Q31 vector.
\r
6813 * @param[in] *pSrc points to the floating-point input vector
\r
6814 * @param[out] *pDst points to the Q31 output vector
\r
6815 * @param[in] blockSize length of the input vector
\r
6818 void arm_float_to_q31(
\r
6821 uint32_t blockSize);
\r
6824 * @brief Converts the elements of the floating-point vector to Q15 vector.
\r
6825 * @param[in] *pSrc points to the floating-point input vector
\r
6826 * @param[out] *pDst points to the Q15 output vector
\r
6827 * @param[in] blockSize length of the input vector
\r
6830 void arm_float_to_q15(
\r
6833 uint32_t blockSize);
\r
6836 * @brief Converts the elements of the floating-point vector to Q7 vector.
\r
6837 * @param[in] *pSrc points to the floating-point input vector
\r
6838 * @param[out] *pDst points to the Q7 output vector
\r
6839 * @param[in] blockSize length of the input vector
\r
6842 void arm_float_to_q7(
\r
6845 uint32_t blockSize);
\r
6849 * @brief Converts the elements of the Q31 vector to Q15 vector.
\r
6850 * @param[in] *pSrc is input pointer
\r
6851 * @param[out] *pDst is output pointer
\r
6852 * @param[in] blockSize is the number of samples to process
\r
6855 void arm_q31_to_q15(
\r
6858 uint32_t blockSize);
\r
6861 * @brief Converts the elements of the Q31 vector to Q7 vector.
\r
6862 * @param[in] *pSrc is input pointer
\r
6863 * @param[out] *pDst is output pointer
\r
6864 * @param[in] blockSize is the number of samples to process
\r
6867 void arm_q31_to_q7(
\r
6870 uint32_t blockSize);
\r
6873 * @brief Converts the elements of the Q15 vector to floating-point vector.
\r
6874 * @param[in] *pSrc is input pointer
\r
6875 * @param[out] *pDst is output pointer
\r
6876 * @param[in] blockSize is the number of samples to process
\r
6879 void arm_q15_to_float(
\r
6882 uint32_t blockSize);
\r
6886 * @brief Converts the elements of the Q15 vector to Q31 vector.
\r
6887 * @param[in] *pSrc is input pointer
\r
6888 * @param[out] *pDst is output pointer
\r
6889 * @param[in] blockSize is the number of samples to process
\r
6892 void arm_q15_to_q31(
\r
6895 uint32_t blockSize);
\r
6899 * @brief Converts the elements of the Q15 vector to Q7 vector.
\r
6900 * @param[in] *pSrc is input pointer
\r
6901 * @param[out] *pDst is output pointer
\r
6902 * @param[in] blockSize is the number of samples to process
\r
6905 void arm_q15_to_q7(
\r
6908 uint32_t blockSize);
\r
6912 * @ingroup groupInterpolation
\r
6916 * @defgroup BilinearInterpolate Bilinear Interpolation
\r
6918 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
\r
6919 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
\r
6920 * determines values between the grid points.
\r
6921 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
\r
6922 * Bilinear interpolation is often used in image processing to rescale images.
\r
6923 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
\r
6925 * <b>Algorithm</b>
\r
6927 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
\r
6928 * For floating-point, the instance structure is defined as:
\r
6932 * uint16_t numRows;
\r
6933 * uint16_t numCols;
\r
6934 * float32_t *pData;
\r
6935 * } arm_bilinear_interp_instance_f32;
\r
6939 * where <code>numRows</code> specifies the number of rows in the table;
\r
6940 * <code>numCols</code> specifies the number of columns in the table;
\r
6941 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
\r
6942 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
\r
6943 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
\r
6946 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
\r
6952 * The interpolated output point is computed as:
\r
6954 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
\r
6955 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
\r
6956 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
\r
6957 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
\r
6959 * Note that the coordinates (x, y) contain integer and fractional components.
\r
6960 * The integer components specify which portion of the table to use while the
\r
6961 * fractional components control the interpolation processor.
\r
6964 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
\r
6968 * @addtogroup BilinearInterpolate
\r
6974 * @brief Floating-point bilinear interpolation.
\r
6975 * @param[in,out] *S points to an instance of the interpolation structure.
\r
6976 * @param[in] X interpolation coordinate.
\r
6977 * @param[in] Y interpolation coordinate.
\r
6978 * @return out interpolated value.
\r
6982 static __INLINE float32_t arm_bilinear_interp_f32(
\r
6983 const arm_bilinear_interp_instance_f32 * S,
\r
6988 float32_t f00, f01, f10, f11;
\r
6989 float32_t *pData = S->pData;
\r
6990 int32_t xIndex, yIndex, index;
\r
6991 float32_t xdiff, ydiff;
\r
6992 float32_t b1, b2, b3, b4;
\r
6994 xIndex = (int32_t) X;
\r
6995 yIndex = (int32_t) Y;
\r
6997 /* Care taken for table outside boundary */
\r
6998 /* Returns zero output when values are outside table boundary */
\r
6999 if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
\r
7000 || yIndex > (S->numCols - 1))
\r
7005 /* Calculation of index for two nearest points in X-direction */
\r
7006 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
\r
7009 /* Read two nearest points in X-direction */
\r
7010 f00 = pData[index];
\r
7011 f01 = pData[index + 1];
\r
7013 /* Calculation of index for two nearest points in Y-direction */
\r
7014 index = (xIndex - 1) + (yIndex) * S->numCols;
\r
7017 /* Read two nearest points in Y-direction */
\r
7018 f10 = pData[index];
\r
7019 f11 = pData[index + 1];
\r
7021 /* Calculation of intermediate values */
\r
7025 b4 = f00 - f01 - f10 + f11;
\r
7027 /* Calculation of fractional part in X */
\r
7028 xdiff = X - xIndex;
\r
7030 /* Calculation of fractional part in Y */
\r
7031 ydiff = Y - yIndex;
\r
7033 /* Calculation of bi-linear interpolated output */
\r
7034 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
\r
7036 /* return to application */
\r
7043 * @brief Q31 bilinear interpolation.
\r
7044 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7045 * @param[in] X interpolation coordinate in 12.20 format.
\r
7046 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7047 * @return out interpolated value.
\r
7050 static __INLINE q31_t arm_bilinear_interp_q31(
\r
7051 arm_bilinear_interp_instance_q31 * S,
\r
7055 q31_t out; /* Temporary output */
\r
7056 q31_t acc = 0; /* output */
\r
7057 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7058 q31_t x1, x2, y1, y2; /* Nearest output values */
\r
7059 int32_t rI, cI; /* Row and column indices */
\r
7060 q31_t *pYData = S->pData; /* pointer to output table values */
\r
7061 uint32_t nCols = S->numCols; /* num of rows */
\r
7064 /* Input is in 12.20 format */
\r
7065 /* 12 bits for the table index */
\r
7066 /* Index value calculation */
\r
7067 rI = ((X & 0xFFF00000) >> 20u);
\r
7069 /* Input is in 12.20 format */
\r
7070 /* 12 bits for the table index */
\r
7071 /* Index value calculation */
\r
7072 cI = ((Y & 0xFFF00000) >> 20u);
\r
7074 /* Care taken for table outside boundary */
\r
7075 /* Returns zero output when values are outside table boundary */
\r
7076 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7081 /* 20 bits for the fractional part */
\r
7082 /* shift left xfract by 11 to keep 1.31 format */
\r
7083 xfract = (X & 0x000FFFFF) << 11u;
\r
7085 /* Read two nearest output values from the index */
\r
7086 x1 = pYData[(rI) + nCols * (cI)];
\r
7087 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7089 /* 20 bits for the fractional part */
\r
7090 /* shift left yfract by 11 to keep 1.31 format */
\r
7091 yfract = (Y & 0x000FFFFF) << 11u;
\r
7093 /* Read two nearest output values from the index */
\r
7094 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7095 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7097 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
\r
7098 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
\r
7099 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
\r
7101 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
\r
7102 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
\r
7103 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
\r
7105 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7106 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
\r
7107 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7109 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7110 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
\r
7111 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7113 /* Convert acc to 1.31(q31) format */
\r
7114 return (acc << 2u);
\r
7119 * @brief Q15 bilinear interpolation.
\r
7120 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7121 * @param[in] X interpolation coordinate in 12.20 format.
\r
7122 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7123 * @return out interpolated value.
\r
7126 static __INLINE q15_t arm_bilinear_interp_q15(
\r
7127 arm_bilinear_interp_instance_q15 * S,
\r
7131 q63_t acc = 0; /* output */
\r
7132 q31_t out; /* Temporary output */
\r
7133 q15_t x1, x2, y1, y2; /* Nearest output values */
\r
7134 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7135 int32_t rI, cI; /* Row and column indices */
\r
7136 q15_t *pYData = S->pData; /* pointer to output table values */
\r
7137 uint32_t nCols = S->numCols; /* num of rows */
\r
7139 /* Input is in 12.20 format */
\r
7140 /* 12 bits for the table index */
\r
7141 /* Index value calculation */
\r
7142 rI = ((X & 0xFFF00000) >> 20);
\r
7144 /* Input is in 12.20 format */
\r
7145 /* 12 bits for the table index */
\r
7146 /* Index value calculation */
\r
7147 cI = ((Y & 0xFFF00000) >> 20);
\r
7149 /* Care taken for table outside boundary */
\r
7150 /* Returns zero output when values are outside table boundary */
\r
7151 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7156 /* 20 bits for the fractional part */
\r
7157 /* xfract should be in 12.20 format */
\r
7158 xfract = (X & 0x000FFFFF);
\r
7160 /* Read two nearest output values from the index */
\r
7161 x1 = pYData[(rI) + nCols * (cI)];
\r
7162 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7165 /* 20 bits for the fractional part */
\r
7166 /* yfract should be in 12.20 format */
\r
7167 yfract = (Y & 0x000FFFFF);
\r
7169 /* Read two nearest output values from the index */
\r
7170 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7171 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7173 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
\r
7175 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
\r
7176 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
\r
7177 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
\r
7178 acc = ((q63_t) out * (0xFFFFF - yfract));
\r
7180 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
\r
7181 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
\r
7182 acc += ((q63_t) out * (xfract));
\r
7184 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
\r
7185 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
\r
7186 acc += ((q63_t) out * (yfract));
\r
7188 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
\r
7189 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
\r
7190 acc += ((q63_t) out * (yfract));
\r
7192 /* acc is in 13.51 format and down shift acc by 36 times */
\r
7193 /* Convert out to 1.15 format */
\r
7194 return (acc >> 36);
\r
7199 * @brief Q7 bilinear interpolation.
\r
7200 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7201 * @param[in] X interpolation coordinate in 12.20 format.
\r
7202 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7203 * @return out interpolated value.
\r
7206 static __INLINE q7_t arm_bilinear_interp_q7(
\r
7207 arm_bilinear_interp_instance_q7 * S,
\r
7211 q63_t acc = 0; /* output */
\r
7212 q31_t out; /* Temporary output */
\r
7213 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7214 q7_t x1, x2, y1, y2; /* Nearest output values */
\r
7215 int32_t rI, cI; /* Row and column indices */
\r
7216 q7_t *pYData = S->pData; /* pointer to output table values */
\r
7217 uint32_t nCols = S->numCols; /* num of rows */
\r
7219 /* Input is in 12.20 format */
\r
7220 /* 12 bits for the table index */
\r
7221 /* Index value calculation */
\r
7222 rI = ((X & 0xFFF00000) >> 20);
\r
7224 /* Input is in 12.20 format */
\r
7225 /* 12 bits for the table index */
\r
7226 /* Index value calculation */
\r
7227 cI = ((Y & 0xFFF00000) >> 20);
\r
7229 /* Care taken for table outside boundary */
\r
7230 /* Returns zero output when values are outside table boundary */
\r
7231 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7236 /* 20 bits for the fractional part */
\r
7237 /* xfract should be in 12.20 format */
\r
7238 xfract = (X & 0x000FFFFF);
\r
7240 /* Read two nearest output values from the index */
\r
7241 x1 = pYData[(rI) + nCols * (cI)];
\r
7242 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7245 /* 20 bits for the fractional part */
\r
7246 /* yfract should be in 12.20 format */
\r
7247 yfract = (Y & 0x000FFFFF);
\r
7249 /* Read two nearest output values from the index */
\r
7250 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7251 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7253 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
\r
7254 out = ((x1 * (0xFFFFF - xfract)));
\r
7255 acc = (((q63_t) out * (0xFFFFF - yfract)));
\r
7257 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
\r
7258 out = ((x2 * (0xFFFFF - yfract)));
\r
7259 acc += (((q63_t) out * (xfract)));
\r
7261 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
\r
7262 out = ((y1 * (0xFFFFF - xfract)));
\r
7263 acc += (((q63_t) out * (yfract)));
\r
7265 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
\r
7266 out = ((y2 * (yfract)));
\r
7267 acc += (((q63_t) out * (xfract)));
\r
7269 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
\r
7270 return (acc >> 40);
\r
7275 * @} end of BilinearInterpolate group
\r
7279 #if defined ( __CC_ARM ) //Keil
\r
7281 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7282 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7285 #define multSub_32x32_keep32_R(a, x, y) \
\r
7286 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7289 #define mult_32x32_keep32_R(a, x, y) \
\r
7290 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
\r
7292 //Enter low optimization region - place directly above function definition
\r
7293 #define LOW_OPTIMIZATION_ENTER \
\r
7294 _Pragma ("push") \
\r
7297 //Exit low optimization region - place directly after end of function definition
\r
7298 #define LOW_OPTIMIZATION_EXIT \
\r
7301 //Enter low optimization region - place directly above function definition
\r
7302 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7304 //Exit low optimization region - place directly after end of function definition
\r
7305 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7307 #elif defined(__ICCARM__) //IAR
\r
7309 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7310 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7313 #define multSub_32x32_keep32_R(a, x, y) \
\r
7314 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7317 #define mult_32x32_keep32_R(a, x, y) \
\r
7318 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7320 //Enter low optimization region - place directly above function definition
\r
7321 #define LOW_OPTIMIZATION_ENTER \
\r
7322 _Pragma ("optimize=low")
\r
7324 //Exit low optimization region - place directly after end of function definition
\r
7325 #define LOW_OPTIMIZATION_EXIT
\r
7327 //Enter low optimization region - place directly above function definition
\r
7328 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
\r
7329 _Pragma ("optimize=low")
\r
7331 //Exit low optimization region - place directly after end of function definition
\r
7332 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7334 #elif defined(__GNUC__)
\r
7336 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7337 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7340 #define multSub_32x32_keep32_R(a, x, y) \
\r
7341 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7344 #define mult_32x32_keep32_R(a, x, y) \
\r
7345 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7347 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
\r
7349 #define LOW_OPTIMIZATION_EXIT
\r
7351 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7353 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7355 #elif defined(__CSMC__) // Cosmic
\r
7357 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7358 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7361 #define multSub_32x32_keep32_R(a, x, y) \
\r
7362 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7365 #define mult_32x32_keep32_R(a, x, y) \
\r
7366 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7368 #define LOW_OPTIMIZATION_ENTER
\r
7369 #define LOW_OPTIMIZATION_EXIT
\r
7370 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7371 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7379 #ifdef __cplusplus
\r
7384 #endif /* _ARM_MATH_H */
\r