1 /* ----------------------------------------------------------------------
\r
2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
\r
4 * $Date: 12. March 2014
\r
7 * Project: CMSIS DSP Library
\r
10 * Description: Public header file for CMSIS DSP Library
\r
12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
\r
14 * Redistribution and use in source and binary forms, with or without
\r
15 * modification, are permitted provided that the following conditions
\r
17 * - Redistributions of source code must retain the above copyright
\r
18 * notice, this list of conditions and the following disclaimer.
\r
19 * - Redistributions in binary form must reproduce the above copyright
\r
20 * notice, this list of conditions and the following disclaimer in
\r
21 * the documentation and/or other materials provided with the
\r
23 * - Neither the name of ARM LIMITED nor the names of its contributors
\r
24 * may be used to endorse or promote products derived from this
\r
25 * software without specific prior written permission.
\r
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
\r
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
\r
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
\r
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
\r
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
\r
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
\r
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
38 * POSSIBILITY OF SUCH DAMAGE.
\r
39 * -------------------------------------------------------------------- */
\r
42 \mainpage CMSIS DSP Software Library
\r
47 * This user manual describes the CMSIS DSP software library,
\r
48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
\r
50 * The library is divided into a number of functions each covering a specific category:
\r
51 * - Basic math functions
\r
52 * - Fast math functions
\r
53 * - Complex math functions
\r
55 * - Matrix functions
\r
57 * - Motor control functions
\r
58 * - Statistical functions
\r
59 * - Support functions
\r
60 * - Interpolation functions
\r
62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
\r
63 * 32-bit integer and 32-bit floating-point values.
\r
68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
\r
69 * - arm_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_CM7)
\r
287 #include "core_cm7.h"
\r
288 #elif defined (ARM_MATH_CM4)
\r
289 #include "core_cm4.h"
\r
290 #elif defined (ARM_MATH_CM3)
\r
291 #include "core_cm3.h"
\r
292 #elif defined (ARM_MATH_CM0)
\r
293 #include "core_cm0.h"
\r
294 #define ARM_MATH_CM0_FAMILY
\r
295 #elif defined (ARM_MATH_CM0PLUS)
\r
296 #include "core_cm0plus.h"
\r
297 #define ARM_MATH_CM0_FAMILY
\r
299 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
\r
302 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
\r
303 #include "string.h"
\r
312 * @brief Macros required for reciprocal calculation in Normalized LMS
\r
315 #define DELTA_Q31 (0x100)
\r
316 #define DELTA_Q15 0x5
\r
317 #define INDEX_MASK 0x0000003F
\r
319 #define PI 3.14159265358979f
\r
323 * @brief Macros required for SINE and COSINE Fast math approximations
\r
326 #define FAST_MATH_TABLE_SIZE 512
\r
327 #define FAST_MATH_Q31_SHIFT (32 - 10)
\r
328 #define FAST_MATH_Q15_SHIFT (16 - 10)
\r
329 #define CONTROLLER_Q31_SHIFT (32 - 9)
\r
330 #define TABLE_SIZE 256
\r
331 #define TABLE_SPACING_Q31 0x400000
\r
332 #define TABLE_SPACING_Q15 0x80
\r
335 * @brief Macros required for SINE and COSINE Controller functions
\r
337 /* 1.31(q31) Fixed value of 2/360 */
\r
338 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
\r
339 #define INPUT_SPACING 0xB60B61
\r
342 * @brief Macro for Unaligned Support
\r
344 #ifndef UNALIGNED_SUPPORT_DISABLE
\r
347 #if defined (__GNUC__)
\r
348 #define ALIGN4 __attribute__((aligned(4)))
\r
350 #define ALIGN4 __align(4)
\r
352 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
\r
355 * @brief Error status returned by some functions in the library.
\r
360 ARM_MATH_SUCCESS = 0, /**< No error */
\r
361 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
\r
362 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
\r
363 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
\r
364 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
\r
365 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
\r
366 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
\r
370 * @brief 8-bit fractional data type in 1.7 format.
\r
372 typedef int8_t q7_t;
\r
375 * @brief 16-bit fractional data type in 1.15 format.
\r
377 typedef int16_t q15_t;
\r
380 * @brief 32-bit fractional data type in 1.31 format.
\r
382 typedef int32_t q31_t;
\r
385 * @brief 64-bit fractional data type in 1.63 format.
\r
387 typedef int64_t q63_t;
\r
390 * @brief 32-bit floating-point type definition.
\r
392 typedef float float32_t;
\r
395 * @brief 64-bit floating-point type definition.
\r
397 typedef double float64_t;
\r
400 * @brief definition to read/write two 16 bit values.
\r
402 #if defined __CC_ARM
\r
403 #define __SIMD32_TYPE int32_t __packed
\r
404 #define CMSIS_UNUSED __attribute__((unused))
\r
405 #elif defined __ICCARM__
\r
406 #define CMSIS_UNUSED
\r
407 #define __SIMD32_TYPE int32_t __packed
\r
408 #elif defined __GNUC__
\r
409 #define __SIMD32_TYPE int32_t
\r
410 #define CMSIS_UNUSED __attribute__((unused))
\r
411 #elif defined __CSMC__ /* Cosmic */
\r
412 #define CMSIS_UNUSED
\r
413 #define __SIMD32_TYPE int32_t
\r
415 #error Unknown compiler
\r
418 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
\r
419 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
\r
421 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
\r
423 #define __SIMD64(addr) (*(int64_t **) & (addr))
\r
425 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
427 * @brief definition to pack two 16 bit values.
\r
429 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
\r
430 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
\r
431 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
\r
432 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
\r
438 * @brief definition to pack four 8 bit values.
\r
440 #ifndef ARM_MATH_BIG_ENDIAN
\r
442 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
\r
443 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
\r
444 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
\r
445 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
\r
448 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
\r
449 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
\r
450 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
\r
451 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
\r
457 * @brief Clips Q63 to Q31 values.
\r
459 static __INLINE q31_t clip_q63_to_q31(
\r
462 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
463 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
\r
467 * @brief Clips Q63 to Q15 values.
\r
469 static __INLINE q15_t clip_q63_to_q15(
\r
472 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
473 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
\r
477 * @brief Clips Q31 to Q7 values.
\r
479 static __INLINE q7_t clip_q31_to_q7(
\r
482 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
\r
483 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
\r
487 * @brief Clips Q31 to Q15 values.
\r
489 static __INLINE q15_t clip_q31_to_q15(
\r
492 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
\r
493 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
\r
497 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
\r
500 static __INLINE q63_t mult32x64(
\r
504 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
\r
505 (((q63_t) (x >> 32) * y)));
\r
509 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
\r
510 #define __CLZ __clz
\r
513 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
\r
515 static __INLINE uint32_t __CLZ(
\r
519 static __INLINE uint32_t __CLZ(
\r
522 uint32_t count = 0;
\r
523 uint32_t mask = 0x80000000;
\r
525 while((data & mask) == 0)
\r
538 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
\r
541 static __INLINE uint32_t arm_recip_q31(
\r
544 q31_t * pRecipTable)
\r
547 uint32_t out, tempVal;
\r
553 signBits = __CLZ(in) - 1;
\r
557 signBits = __CLZ(-in) - 1;
\r
560 /* Convert input sample to 1.31 format */
\r
561 in = in << signBits;
\r
563 /* calculation of index for initial approximated Val */
\r
564 index = (uint32_t) (in >> 24u);
\r
565 index = (index & INDEX_MASK);
\r
567 /* 1.31 with exp 1 */
\r
568 out = pRecipTable[index];
\r
570 /* calculation of reciprocal value */
\r
571 /* running approximation for two iterations */
\r
572 for (i = 0u; i < 2u; i++)
\r
574 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
\r
575 tempVal = 0x7FFFFFFF - tempVal;
\r
576 /* 1.31 with exp 1 */
\r
577 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
\r
578 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
\r
584 /* return num of signbits of out = 1/in value */
\r
585 return (signBits + 1u);
\r
590 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
\r
592 static __INLINE uint32_t arm_recip_q15(
\r
595 q15_t * pRecipTable)
\r
598 uint32_t out = 0, tempVal = 0;
\r
599 uint32_t index = 0, i = 0;
\r
600 uint32_t signBits = 0;
\r
604 signBits = __CLZ(in) - 17;
\r
608 signBits = __CLZ(-in) - 17;
\r
611 /* Convert input sample to 1.15 format */
\r
612 in = in << signBits;
\r
614 /* calculation of index for initial approximated Val */
\r
616 index = (index & INDEX_MASK);
\r
618 /* 1.15 with exp 1 */
\r
619 out = pRecipTable[index];
\r
621 /* calculation of reciprocal value */
\r
622 /* running approximation for two iterations */
\r
623 for (i = 0; i < 2; i++)
\r
625 tempVal = (q15_t) (((q31_t) in * out) >> 15);
\r
626 tempVal = 0x7FFF - tempVal;
\r
627 /* 1.15 with exp 1 */
\r
628 out = (q15_t) (((q31_t) out * tempVal) >> 14);
\r
634 /* return num of signbits of out = 1/in value */
\r
635 return (signBits + 1);
\r
641 * @brief C custom defined intrinisic function for only M0 processors
\r
643 #if defined(ARM_MATH_CM0_FAMILY)
\r
645 static __INLINE q31_t __SSAT(
\r
649 int32_t posMax, negMin;
\r
653 for (i = 0; i < (y - 1); i++)
\r
655 posMax = posMax * 2;
\r
660 posMax = (posMax - 1);
\r
681 #endif /* end of ARM_MATH_CM0_FAMILY */
\r
686 * @brief C custom defined intrinsic function for M3 and M0 processors
\r
688 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
\r
691 * @brief C custom defined QADD8 for M3 and M0 processors
\r
693 static __INLINE q31_t __QADD8(
\r
704 r = __SSAT((q31_t) (r + s), 8);
\r
705 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
\r
706 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
\r
707 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
\r
710 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
\r
711 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
\r
718 * @brief C custom defined QSUB8 for M3 and M0 processors
\r
720 static __INLINE q31_t __QSUB8(
\r
731 r = __SSAT((r - s), 8);
\r
732 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
\r
733 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
\r
734 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
\r
737 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
\r
744 * @brief C custom defined QADD16 for M3 and M0 processors
\r
748 * @brief C custom defined QADD16 for M3 and M0 processors
\r
750 static __INLINE q31_t __QADD16(
\r
761 r = __SSAT(r + s, 16);
\r
762 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
\r
764 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
771 * @brief C custom defined SHADD16 for M3 and M0 processors
\r
773 static __INLINE q31_t __SHADD16(
\r
784 r = ((r >> 1) + (s >> 1));
\r
785 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
\r
787 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
794 * @brief C custom defined QSUB16 for M3 and M0 processors
\r
796 static __INLINE q31_t __QSUB16(
\r
807 r = __SSAT(r - s, 16);
\r
808 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
\r
810 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
816 * @brief C custom defined SHSUB16 for M3 and M0 processors
\r
818 static __INLINE q31_t __SHSUB16(
\r
829 r = ((r >> 1) - (s >> 1));
\r
830 s = (((x >> 17) - (y >> 17)) << 16);
\r
832 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
838 * @brief C custom defined QASX for M3 and M0 processors
\r
840 static __INLINE q31_t __QASX(
\r
849 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
\r
850 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
\r
856 * @brief C custom defined SHASX for M3 and M0 processors
\r
858 static __INLINE q31_t __SHASX(
\r
869 r = ((r >> 1) - (y >> 17));
\r
870 s = (((x >> 17) + (s >> 1)) << 16);
\r
872 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
879 * @brief C custom defined QSAX for M3 and M0 processors
\r
881 static __INLINE q31_t __QSAX(
\r
890 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
\r
891 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
\r
897 * @brief C custom defined SHSAX for M3 and M0 processors
\r
899 static __INLINE q31_t __SHSAX(
\r
910 r = ((r >> 1) + (y >> 17));
\r
911 s = (((x >> 17) - (s >> 1)) << 16);
\r
913 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
\r
919 * @brief C custom defined SMUSDX for M3 and M0 processors
\r
921 static __INLINE q31_t __SMUSDX(
\r
926 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
\r
927 ((q15_t) (x >> 16) * (q15_t) y)));
\r
931 * @brief C custom defined SMUADX for M3 and M0 processors
\r
933 static __INLINE q31_t __SMUADX(
\r
938 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
\r
939 ((q15_t) (x >> 16) * (q15_t) y)));
\r
943 * @brief C custom defined QADD for M3 and M0 processors
\r
945 static __INLINE q31_t __QADD(
\r
949 return clip_q63_to_q31((q63_t) x + y);
\r
953 * @brief C custom defined QSUB for M3 and M0 processors
\r
955 static __INLINE q31_t __QSUB(
\r
959 return clip_q63_to_q31((q63_t) x - y);
\r
963 * @brief C custom defined SMLAD for M3 and M0 processors
\r
965 static __INLINE q31_t __SMLAD(
\r
971 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
972 ((q15_t) x * (q15_t) y));
\r
976 * @brief C custom defined SMLADX for M3 and M0 processors
\r
978 static __INLINE q31_t __SMLADX(
\r
984 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
985 ((q15_t) x * (q15_t) (y >> 16)));
\r
989 * @brief C custom defined SMLSDX for M3 and M0 processors
\r
991 static __INLINE q31_t __SMLSDX(
\r
997 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
\r
998 ((q15_t) x * (q15_t) (y >> 16)));
\r
1002 * @brief C custom defined SMLALD for M3 and M0 processors
\r
1004 static __INLINE q63_t __SMLALD(
\r
1010 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
\r
1011 ((q15_t) x * (q15_t) y));
\r
1015 * @brief C custom defined SMLALDX for M3 and M0 processors
\r
1017 static __INLINE q63_t __SMLALDX(
\r
1023 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
\r
1024 ((q15_t) x * (q15_t) (y >> 16));
\r
1028 * @brief C custom defined SMUAD for M3 and M0 processors
\r
1030 static __INLINE q31_t __SMUAD(
\r
1035 return (((x >> 16) * (y >> 16)) +
\r
1036 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1040 * @brief C custom defined SMUSD for M3 and M0 processors
\r
1042 static __INLINE q31_t __SMUSD(
\r
1047 return (-((x >> 16) * (y >> 16)) +
\r
1048 (((x << 16) >> 16) * ((y << 16) >> 16)));
\r
1053 * @brief C custom defined SXTB16 for M3 and M0 processors
\r
1055 static __INLINE q31_t __SXTB16(
\r
1059 return ((((x << 24) >> 24) & 0x0000FFFF) |
\r
1060 (((x << 8) >> 8) & 0xFFFF0000));
\r
1064 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
1068 * @brief Instance structure for the Q7 FIR filter.
\r
1072 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1073 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1074 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1075 } arm_fir_instance_q7;
\r
1078 * @brief Instance structure for the Q15 FIR filter.
\r
1082 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1083 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1084 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1085 } arm_fir_instance_q15;
\r
1088 * @brief Instance structure for the Q31 FIR filter.
\r
1092 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1093 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1094 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1095 } arm_fir_instance_q31;
\r
1098 * @brief Instance structure for the floating-point FIR filter.
\r
1102 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1103 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1104 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1105 } arm_fir_instance_f32;
\r
1109 * @brief Processing function for the Q7 FIR filter.
\r
1110 * @param[in] *S points to an instance of the Q7 FIR filter structure.
\r
1111 * @param[in] *pSrc points to the block of input data.
\r
1112 * @param[out] *pDst points to the block of output data.
\r
1113 * @param[in] blockSize number of samples to process.
\r
1117 const arm_fir_instance_q7 * S,
\r
1120 uint32_t blockSize);
\r
1124 * @brief Initialization function for the Q7 FIR filter.
\r
1125 * @param[in,out] *S points to an instance of the Q7 FIR structure.
\r
1126 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1127 * @param[in] *pCoeffs points to the filter coefficients.
\r
1128 * @param[in] *pState points to the state buffer.
\r
1129 * @param[in] blockSize number of samples that are processed.
\r
1132 void arm_fir_init_q7(
\r
1133 arm_fir_instance_q7 * S,
\r
1137 uint32_t blockSize);
\r
1141 * @brief Processing function for the Q15 FIR filter.
\r
1142 * @param[in] *S points to an instance of the Q15 FIR structure.
\r
1143 * @param[in] *pSrc points to the block of input data.
\r
1144 * @param[out] *pDst points to the block of output data.
\r
1145 * @param[in] blockSize number of samples to process.
\r
1149 const arm_fir_instance_q15 * S,
\r
1152 uint32_t blockSize);
\r
1155 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
\r
1156 * @param[in] *S points to an instance of the Q15 FIR filter structure.
\r
1157 * @param[in] *pSrc points to the block of input data.
\r
1158 * @param[out] *pDst points to the block of output data.
\r
1159 * @param[in] blockSize number of samples to process.
\r
1162 void arm_fir_fast_q15(
\r
1163 const arm_fir_instance_q15 * S,
\r
1166 uint32_t blockSize);
\r
1169 * @brief Initialization function for the Q15 FIR filter.
\r
1170 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
\r
1171 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
\r
1172 * @param[in] *pCoeffs points to the filter coefficients.
\r
1173 * @param[in] *pState points to the state buffer.
\r
1174 * @param[in] blockSize number of samples that are processed at a time.
\r
1175 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
\r
1176 * <code>numTaps</code> is not a supported value.
\r
1179 arm_status arm_fir_init_q15(
\r
1180 arm_fir_instance_q15 * S,
\r
1184 uint32_t blockSize);
\r
1187 * @brief Processing function for the Q31 FIR filter.
\r
1188 * @param[in] *S points to an instance of the Q31 FIR filter structure.
\r
1189 * @param[in] *pSrc points to the block of input data.
\r
1190 * @param[out] *pDst points to the block of output data.
\r
1191 * @param[in] blockSize number of samples to process.
\r
1195 const arm_fir_instance_q31 * S,
\r
1198 uint32_t blockSize);
\r
1201 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
\r
1202 * @param[in] *S points to an instance of the Q31 FIR structure.
\r
1203 * @param[in] *pSrc points to the block of input data.
\r
1204 * @param[out] *pDst points to the block of output data.
\r
1205 * @param[in] blockSize number of samples to process.
\r
1208 void arm_fir_fast_q31(
\r
1209 const arm_fir_instance_q31 * S,
\r
1212 uint32_t blockSize);
\r
1215 * @brief Initialization function for the Q31 FIR filter.
\r
1216 * @param[in,out] *S points to an instance of the Q31 FIR structure.
\r
1217 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1218 * @param[in] *pCoeffs points to the filter coefficients.
\r
1219 * @param[in] *pState points to the state buffer.
\r
1220 * @param[in] blockSize number of samples that are processed at a time.
\r
1223 void arm_fir_init_q31(
\r
1224 arm_fir_instance_q31 * S,
\r
1228 uint32_t blockSize);
\r
1231 * @brief Processing function for the floating-point FIR filter.
\r
1232 * @param[in] *S points to an instance of the floating-point FIR structure.
\r
1233 * @param[in] *pSrc points to the block of input data.
\r
1234 * @param[out] *pDst points to the block of output data.
\r
1235 * @param[in] blockSize number of samples to process.
\r
1239 const arm_fir_instance_f32 * S,
\r
1242 uint32_t blockSize);
\r
1245 * @brief Initialization function for the floating-point FIR filter.
\r
1246 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
\r
1247 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1248 * @param[in] *pCoeffs points to the filter coefficients.
\r
1249 * @param[in] *pState points to the state buffer.
\r
1250 * @param[in] blockSize number of samples that are processed at a time.
\r
1253 void arm_fir_init_f32(
\r
1254 arm_fir_instance_f32 * S,
\r
1256 float32_t * pCoeffs,
\r
1257 float32_t * pState,
\r
1258 uint32_t blockSize);
\r
1262 * @brief Instance structure for the Q15 Biquad cascade filter.
\r
1266 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1267 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1268 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1269 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1271 } arm_biquad_casd_df1_inst_q15;
\r
1275 * @brief Instance structure for the Q31 Biquad cascade filter.
\r
1279 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1280 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1281 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1282 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1284 } arm_biquad_casd_df1_inst_q31;
\r
1287 * @brief Instance structure for the floating-point Biquad cascade filter.
\r
1291 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1292 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1293 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1296 } arm_biquad_casd_df1_inst_f32;
\r
1301 * @brief Processing function for the Q15 Biquad cascade filter.
\r
1302 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1303 * @param[in] *pSrc points to the block of input data.
\r
1304 * @param[out] *pDst points to the block of output data.
\r
1305 * @param[in] blockSize number of samples to process.
\r
1309 void arm_biquad_cascade_df1_q15(
\r
1310 const arm_biquad_casd_df1_inst_q15 * S,
\r
1313 uint32_t blockSize);
\r
1316 * @brief Initialization function for the Q15 Biquad cascade filter.
\r
1317 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
\r
1318 * @param[in] numStages number of 2nd order stages in the filter.
\r
1319 * @param[in] *pCoeffs points to the filter coefficients.
\r
1320 * @param[in] *pState points to the state buffer.
\r
1321 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1325 void arm_biquad_cascade_df1_init_q15(
\r
1326 arm_biquad_casd_df1_inst_q15 * S,
\r
1327 uint8_t numStages,
\r
1330 int8_t postShift);
\r
1334 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1335 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
\r
1336 * @param[in] *pSrc points to the block of input data.
\r
1337 * @param[out] *pDst points to the block of output data.
\r
1338 * @param[in] blockSize number of samples to process.
\r
1342 void arm_biquad_cascade_df1_fast_q15(
\r
1343 const arm_biquad_casd_df1_inst_q15 * S,
\r
1346 uint32_t blockSize);
\r
1350 * @brief Processing function for the Q31 Biquad cascade filter
\r
1351 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1352 * @param[in] *pSrc points to the block of input data.
\r
1353 * @param[out] *pDst points to the block of output data.
\r
1354 * @param[in] blockSize number of samples to process.
\r
1358 void arm_biquad_cascade_df1_q31(
\r
1359 const arm_biquad_casd_df1_inst_q31 * S,
\r
1362 uint32_t blockSize);
\r
1365 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1366 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
\r
1367 * @param[in] *pSrc points to the block of input data.
\r
1368 * @param[out] *pDst points to the block of output data.
\r
1369 * @param[in] blockSize number of samples to process.
\r
1373 void arm_biquad_cascade_df1_fast_q31(
\r
1374 const arm_biquad_casd_df1_inst_q31 * S,
\r
1377 uint32_t blockSize);
\r
1380 * @brief Initialization function for the Q31 Biquad cascade filter.
\r
1381 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
\r
1382 * @param[in] numStages number of 2nd order stages in the filter.
\r
1383 * @param[in] *pCoeffs points to the filter coefficients.
\r
1384 * @param[in] *pState points to the state buffer.
\r
1385 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1389 void arm_biquad_cascade_df1_init_q31(
\r
1390 arm_biquad_casd_df1_inst_q31 * S,
\r
1391 uint8_t numStages,
\r
1394 int8_t postShift);
\r
1397 * @brief Processing function for the floating-point Biquad cascade filter.
\r
1398 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
\r
1399 * @param[in] *pSrc points to the block of input data.
\r
1400 * @param[out] *pDst points to the block of output data.
\r
1401 * @param[in] blockSize number of samples to process.
\r
1405 void arm_biquad_cascade_df1_f32(
\r
1406 const arm_biquad_casd_df1_inst_f32 * S,
\r
1409 uint32_t blockSize);
\r
1412 * @brief Initialization function for the floating-point Biquad cascade filter.
\r
1413 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
\r
1414 * @param[in] numStages number of 2nd order stages in the filter.
\r
1415 * @param[in] *pCoeffs points to the filter coefficients.
\r
1416 * @param[in] *pState points to the state buffer.
\r
1420 void arm_biquad_cascade_df1_init_f32(
\r
1421 arm_biquad_casd_df1_inst_f32 * S,
\r
1422 uint8_t numStages,
\r
1423 float32_t * pCoeffs,
\r
1424 float32_t * pState);
\r
1428 * @brief Instance structure for the floating-point matrix structure.
\r
1433 uint16_t numRows; /**< number of rows of the matrix. */
\r
1434 uint16_t numCols; /**< number of columns of the matrix. */
\r
1435 float32_t *pData; /**< points to the data of the matrix. */
\r
1436 } arm_matrix_instance_f32;
\r
1440 * @brief Instance structure for the floating-point matrix structure.
\r
1445 uint16_t numRows; /**< number of rows of the matrix. */
\r
1446 uint16_t numCols; /**< number of columns of the matrix. */
\r
1447 float64_t *pData; /**< points to the data of the matrix. */
\r
1448 } arm_matrix_instance_f64;
\r
1451 * @brief Instance structure for the Q15 matrix structure.
\r
1456 uint16_t numRows; /**< number of rows of the matrix. */
\r
1457 uint16_t numCols; /**< number of columns of the matrix. */
\r
1458 q15_t *pData; /**< points to the data of the matrix. */
\r
1460 } arm_matrix_instance_q15;
\r
1463 * @brief Instance structure for the Q31 matrix structure.
\r
1468 uint16_t numRows; /**< number of rows of the matrix. */
\r
1469 uint16_t numCols; /**< number of columns of the matrix. */
\r
1470 q31_t *pData; /**< points to the data of the matrix. */
\r
1472 } arm_matrix_instance_q31;
\r
1477 * @brief Floating-point matrix addition.
\r
1478 * @param[in] *pSrcA points to the first input matrix structure
\r
1479 * @param[in] *pSrcB points to the second input matrix structure
\r
1480 * @param[out] *pDst points to output matrix structure
\r
1481 * @return The function returns either
\r
1482 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1485 arm_status arm_mat_add_f32(
\r
1486 const arm_matrix_instance_f32 * pSrcA,
\r
1487 const arm_matrix_instance_f32 * pSrcB,
\r
1488 arm_matrix_instance_f32 * pDst);
\r
1491 * @brief Q15 matrix addition.
\r
1492 * @param[in] *pSrcA points to the first input matrix structure
\r
1493 * @param[in] *pSrcB points to the second input matrix structure
\r
1494 * @param[out] *pDst points to output matrix structure
\r
1495 * @return The function returns either
\r
1496 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1499 arm_status arm_mat_add_q15(
\r
1500 const arm_matrix_instance_q15 * pSrcA,
\r
1501 const arm_matrix_instance_q15 * pSrcB,
\r
1502 arm_matrix_instance_q15 * pDst);
\r
1505 * @brief Q31 matrix addition.
\r
1506 * @param[in] *pSrcA points to the first input matrix structure
\r
1507 * @param[in] *pSrcB points to the second input matrix structure
\r
1508 * @param[out] *pDst points to output matrix structure
\r
1509 * @return The function returns either
\r
1510 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1513 arm_status arm_mat_add_q31(
\r
1514 const arm_matrix_instance_q31 * pSrcA,
\r
1515 const arm_matrix_instance_q31 * pSrcB,
\r
1516 arm_matrix_instance_q31 * pDst);
\r
1519 * @brief Floating-point, complex, matrix multiplication.
\r
1520 * @param[in] *pSrcA points to the first input matrix structure
\r
1521 * @param[in] *pSrcB points to the second input matrix structure
\r
1522 * @param[out] *pDst points to output matrix structure
\r
1523 * @return The function returns either
\r
1524 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1527 arm_status arm_mat_cmplx_mult_f32(
\r
1528 const arm_matrix_instance_f32 * pSrcA,
\r
1529 const arm_matrix_instance_f32 * pSrcB,
\r
1530 arm_matrix_instance_f32 * pDst);
\r
1533 * @brief Q15, complex, matrix multiplication.
\r
1534 * @param[in] *pSrcA points to the first input matrix structure
\r
1535 * @param[in] *pSrcB points to the second input matrix structure
\r
1536 * @param[out] *pDst points to output matrix structure
\r
1537 * @return The function returns either
\r
1538 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1541 arm_status arm_mat_cmplx_mult_q15(
\r
1542 const arm_matrix_instance_q15 * pSrcA,
\r
1543 const arm_matrix_instance_q15 * pSrcB,
\r
1544 arm_matrix_instance_q15 * pDst,
\r
1545 q15_t * pScratch);
\r
1548 * @brief Q31, complex, matrix multiplication.
\r
1549 * @param[in] *pSrcA points to the first input matrix structure
\r
1550 * @param[in] *pSrcB points to the second input matrix structure
\r
1551 * @param[out] *pDst points to output matrix structure
\r
1552 * @return The function returns either
\r
1553 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1556 arm_status arm_mat_cmplx_mult_q31(
\r
1557 const arm_matrix_instance_q31 * pSrcA,
\r
1558 const arm_matrix_instance_q31 * pSrcB,
\r
1559 arm_matrix_instance_q31 * pDst);
\r
1563 * @brief Floating-point 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_f32(
\r
1571 const arm_matrix_instance_f32 * pSrc,
\r
1572 arm_matrix_instance_f32 * pDst);
\r
1576 * @brief Q15 matrix transpose.
\r
1577 * @param[in] *pSrc points to the input matrix
\r
1578 * @param[out] *pDst points to the output matrix
\r
1579 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1580 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1583 arm_status arm_mat_trans_q15(
\r
1584 const arm_matrix_instance_q15 * pSrc,
\r
1585 arm_matrix_instance_q15 * pDst);
\r
1588 * @brief Q31 matrix transpose.
\r
1589 * @param[in] *pSrc points to the input matrix
\r
1590 * @param[out] *pDst points to the output matrix
\r
1591 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1592 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1595 arm_status arm_mat_trans_q31(
\r
1596 const arm_matrix_instance_q31 * pSrc,
\r
1597 arm_matrix_instance_q31 * pDst);
\r
1601 * @brief Floating-point matrix multiplication
\r
1602 * @param[in] *pSrcA points to the first input matrix structure
\r
1603 * @param[in] *pSrcB points to the second input matrix structure
\r
1604 * @param[out] *pDst points to output matrix structure
\r
1605 * @return The function returns either
\r
1606 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1609 arm_status arm_mat_mult_f32(
\r
1610 const arm_matrix_instance_f32 * pSrcA,
\r
1611 const arm_matrix_instance_f32 * pSrcB,
\r
1612 arm_matrix_instance_f32 * pDst);
\r
1615 * @brief Q15 matrix multiplication
\r
1616 * @param[in] *pSrcA points to the first input matrix structure
\r
1617 * @param[in] *pSrcB points to the second input matrix structure
\r
1618 * @param[out] *pDst points to output matrix structure
\r
1619 * @param[in] *pState points to the array for storing intermediate results
\r
1620 * @return The function returns either
\r
1621 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1624 arm_status arm_mat_mult_q15(
\r
1625 const arm_matrix_instance_q15 * pSrcA,
\r
1626 const arm_matrix_instance_q15 * pSrcB,
\r
1627 arm_matrix_instance_q15 * pDst,
\r
1631 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1632 * @param[in] *pSrcA points to the first input matrix structure
\r
1633 * @param[in] *pSrcB points to the second input matrix structure
\r
1634 * @param[out] *pDst points to output matrix structure
\r
1635 * @param[in] *pState points to the array for storing intermediate results
\r
1636 * @return The function returns either
\r
1637 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1640 arm_status arm_mat_mult_fast_q15(
\r
1641 const arm_matrix_instance_q15 * pSrcA,
\r
1642 const arm_matrix_instance_q15 * pSrcB,
\r
1643 arm_matrix_instance_q15 * pDst,
\r
1647 * @brief Q31 matrix multiplication
\r
1648 * @param[in] *pSrcA points to the first input matrix structure
\r
1649 * @param[in] *pSrcB points to the second input matrix structure
\r
1650 * @param[out] *pDst points to output matrix structure
\r
1651 * @return The function returns either
\r
1652 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1655 arm_status arm_mat_mult_q31(
\r
1656 const arm_matrix_instance_q31 * pSrcA,
\r
1657 const arm_matrix_instance_q31 * pSrcB,
\r
1658 arm_matrix_instance_q31 * pDst);
\r
1661 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1662 * @param[in] *pSrcA points to the first input matrix structure
\r
1663 * @param[in] *pSrcB points to the second input matrix structure
\r
1664 * @param[out] *pDst points to output matrix structure
\r
1665 * @return The function returns either
\r
1666 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1669 arm_status arm_mat_mult_fast_q31(
\r
1670 const arm_matrix_instance_q31 * pSrcA,
\r
1671 const arm_matrix_instance_q31 * pSrcB,
\r
1672 arm_matrix_instance_q31 * pDst);
\r
1676 * @brief Floating-point matrix subtraction
\r
1677 * @param[in] *pSrcA points to the first input matrix structure
\r
1678 * @param[in] *pSrcB points to the second input matrix structure
\r
1679 * @param[out] *pDst points to output matrix structure
\r
1680 * @return The function returns either
\r
1681 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1684 arm_status arm_mat_sub_f32(
\r
1685 const arm_matrix_instance_f32 * pSrcA,
\r
1686 const arm_matrix_instance_f32 * pSrcB,
\r
1687 arm_matrix_instance_f32 * pDst);
\r
1690 * @brief Q15 matrix subtraction
\r
1691 * @param[in] *pSrcA points to the first input matrix structure
\r
1692 * @param[in] *pSrcB points to the second input matrix structure
\r
1693 * @param[out] *pDst points to output matrix structure
\r
1694 * @return The function returns either
\r
1695 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1698 arm_status arm_mat_sub_q15(
\r
1699 const arm_matrix_instance_q15 * pSrcA,
\r
1700 const arm_matrix_instance_q15 * pSrcB,
\r
1701 arm_matrix_instance_q15 * pDst);
\r
1704 * @brief Q31 matrix subtraction
\r
1705 * @param[in] *pSrcA points to the first input matrix structure
\r
1706 * @param[in] *pSrcB points to the second input matrix structure
\r
1707 * @param[out] *pDst points to output matrix structure
\r
1708 * @return The function returns either
\r
1709 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1712 arm_status arm_mat_sub_q31(
\r
1713 const arm_matrix_instance_q31 * pSrcA,
\r
1714 const arm_matrix_instance_q31 * pSrcB,
\r
1715 arm_matrix_instance_q31 * pDst);
\r
1718 * @brief Floating-point matrix scaling.
\r
1719 * @param[in] *pSrc points to the input matrix
\r
1720 * @param[in] scale scale factor
\r
1721 * @param[out] *pDst points to the output matrix
\r
1722 * @return The function returns either
\r
1723 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1726 arm_status arm_mat_scale_f32(
\r
1727 const arm_matrix_instance_f32 * pSrc,
\r
1729 arm_matrix_instance_f32 * pDst);
\r
1732 * @brief Q15 matrix scaling.
\r
1733 * @param[in] *pSrc points to input matrix
\r
1734 * @param[in] scaleFract fractional portion of the scale factor
\r
1735 * @param[in] shift number of bits to shift the result by
\r
1736 * @param[out] *pDst points to output matrix
\r
1737 * @return The function returns either
\r
1738 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1741 arm_status arm_mat_scale_q15(
\r
1742 const arm_matrix_instance_q15 * pSrc,
\r
1745 arm_matrix_instance_q15 * pDst);
\r
1748 * @brief Q31 matrix scaling.
\r
1749 * @param[in] *pSrc points to input matrix
\r
1750 * @param[in] scaleFract fractional portion of the scale factor
\r
1751 * @param[in] shift number of bits to shift the result by
\r
1752 * @param[out] *pDst points to output matrix structure
\r
1753 * @return The function returns either
\r
1754 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1757 arm_status arm_mat_scale_q31(
\r
1758 const arm_matrix_instance_q31 * pSrc,
\r
1761 arm_matrix_instance_q31 * pDst);
\r
1765 * @brief Q31 matrix initialization.
\r
1766 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1767 * @param[in] nRows number of rows in the matrix.
\r
1768 * @param[in] nColumns number of columns in the matrix.
\r
1769 * @param[in] *pData points to the matrix data array.
\r
1773 void arm_mat_init_q31(
\r
1774 arm_matrix_instance_q31 * S,
\r
1776 uint16_t nColumns,
\r
1780 * @brief Q15 matrix initialization.
\r
1781 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1782 * @param[in] nRows number of rows in the matrix.
\r
1783 * @param[in] nColumns number of columns in the matrix.
\r
1784 * @param[in] *pData points to the matrix data array.
\r
1788 void arm_mat_init_q15(
\r
1789 arm_matrix_instance_q15 * S,
\r
1791 uint16_t nColumns,
\r
1795 * @brief Floating-point matrix initialization.
\r
1796 * @param[in,out] *S points to an instance of the floating-point matrix structure.
\r
1797 * @param[in] nRows number of rows in the matrix.
\r
1798 * @param[in] nColumns number of columns in the matrix.
\r
1799 * @param[in] *pData points to the matrix data array.
\r
1803 void arm_mat_init_f32(
\r
1804 arm_matrix_instance_f32 * S,
\r
1806 uint16_t nColumns,
\r
1807 float32_t * pData);
\r
1812 * @brief Instance structure for the Q15 PID Control.
\r
1816 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1817 #ifdef ARM_MATH_CM0_FAMILY
\r
1821 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
\r
1823 q15_t state[3]; /**< The state array of length 3. */
\r
1824 q15_t Kp; /**< The proportional gain. */
\r
1825 q15_t Ki; /**< The integral gain. */
\r
1826 q15_t Kd; /**< The derivative gain. */
\r
1827 } arm_pid_instance_q15;
\r
1830 * @brief Instance structure for the Q31 PID Control.
\r
1834 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1835 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1836 q31_t A2; /**< The derived gain, A2 = Kd . */
\r
1837 q31_t state[3]; /**< The state array of length 3. */
\r
1838 q31_t Kp; /**< The proportional gain. */
\r
1839 q31_t Ki; /**< The integral gain. */
\r
1840 q31_t Kd; /**< The derivative gain. */
\r
1842 } arm_pid_instance_q31;
\r
1845 * @brief Instance structure for the floating-point PID Control.
\r
1849 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1850 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1851 float32_t A2; /**< The derived gain, A2 = Kd . */
\r
1852 float32_t state[3]; /**< The state array of length 3. */
\r
1853 float32_t Kp; /**< The proportional gain. */
\r
1854 float32_t Ki; /**< The integral gain. */
\r
1855 float32_t Kd; /**< The derivative gain. */
\r
1856 } arm_pid_instance_f32;
\r
1861 * @brief Initialization function for the floating-point PID Control.
\r
1862 * @param[in,out] *S points to an instance of the PID structure.
\r
1863 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1866 void arm_pid_init_f32(
\r
1867 arm_pid_instance_f32 * S,
\r
1868 int32_t resetStateFlag);
\r
1871 * @brief Reset function for the floating-point PID Control.
\r
1872 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
1875 void arm_pid_reset_f32(
\r
1876 arm_pid_instance_f32 * S);
\r
1880 * @brief Initialization function for the Q31 PID Control.
\r
1881 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1882 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1885 void arm_pid_init_q31(
\r
1886 arm_pid_instance_q31 * S,
\r
1887 int32_t resetStateFlag);
\r
1891 * @brief Reset function for the Q31 PID Control.
\r
1892 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
1896 void arm_pid_reset_q31(
\r
1897 arm_pid_instance_q31 * S);
\r
1900 * @brief Initialization function for the Q15 PID Control.
\r
1901 * @param[in,out] *S points to an instance of the Q15 PID structure.
\r
1902 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1905 void arm_pid_init_q15(
\r
1906 arm_pid_instance_q15 * S,
\r
1907 int32_t resetStateFlag);
\r
1910 * @brief Reset function for the Q15 PID Control.
\r
1911 * @param[in,out] *S points to an instance of the q15 PID Control structure
\r
1914 void arm_pid_reset_q15(
\r
1915 arm_pid_instance_q15 * S);
\r
1919 * @brief Instance structure for the floating-point Linear Interpolate function.
\r
1923 uint32_t nValues; /**< nValues */
\r
1924 float32_t x1; /**< x1 */
\r
1925 float32_t xSpacing; /**< xSpacing */
\r
1926 float32_t *pYData; /**< pointer to the table of Y values */
\r
1927 } arm_linear_interp_instance_f32;
\r
1930 * @brief Instance structure for the floating-point bilinear interpolation function.
\r
1935 uint16_t numRows; /**< number of rows in the data table. */
\r
1936 uint16_t numCols; /**< number of columns in the data table. */
\r
1937 float32_t *pData; /**< points to the data table. */
\r
1938 } arm_bilinear_interp_instance_f32;
\r
1941 * @brief Instance structure for the Q31 bilinear interpolation function.
\r
1946 uint16_t numRows; /**< number of rows in the data table. */
\r
1947 uint16_t numCols; /**< number of columns in the data table. */
\r
1948 q31_t *pData; /**< points to the data table. */
\r
1949 } arm_bilinear_interp_instance_q31;
\r
1952 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1957 uint16_t numRows; /**< number of rows in the data table. */
\r
1958 uint16_t numCols; /**< number of columns in the data table. */
\r
1959 q15_t *pData; /**< points to the data table. */
\r
1960 } arm_bilinear_interp_instance_q15;
\r
1963 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1968 uint16_t numRows; /**< number of rows in the data table. */
\r
1969 uint16_t numCols; /**< number of columns in the data table. */
\r
1970 q7_t *pData; /**< points to the data table. */
\r
1971 } arm_bilinear_interp_instance_q7;
\r
1975 * @brief Q7 vector multiplication.
\r
1976 * @param[in] *pSrcA points to the first input vector
\r
1977 * @param[in] *pSrcB points to the second input vector
\r
1978 * @param[out] *pDst points to the output vector
\r
1979 * @param[in] blockSize number of samples in each vector
\r
1987 uint32_t blockSize);
\r
1990 * @brief Q15 vector multiplication.
\r
1991 * @param[in] *pSrcA points to the first input vector
\r
1992 * @param[in] *pSrcB points to the second input vector
\r
1993 * @param[out] *pDst points to the output vector
\r
1994 * @param[in] blockSize number of samples in each vector
\r
1998 void arm_mult_q15(
\r
2002 uint32_t blockSize);
\r
2005 * @brief Q31 vector multiplication.
\r
2006 * @param[in] *pSrcA points to the first input vector
\r
2007 * @param[in] *pSrcB points to the second input vector
\r
2008 * @param[out] *pDst points to the output vector
\r
2009 * @param[in] blockSize number of samples in each vector
\r
2013 void arm_mult_q31(
\r
2017 uint32_t blockSize);
\r
2020 * @brief Floating-point vector multiplication.
\r
2021 * @param[in] *pSrcA points to the first input vector
\r
2022 * @param[in] *pSrcB points to the second input vector
\r
2023 * @param[out] *pDst points to the output vector
\r
2024 * @param[in] blockSize number of samples in each vector
\r
2028 void arm_mult_f32(
\r
2029 float32_t * pSrcA,
\r
2030 float32_t * pSrcB,
\r
2032 uint32_t blockSize);
\r
2040 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2045 uint16_t fftLen; /**< length of the FFT. */
\r
2046 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2047 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2048 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
\r
2049 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2050 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2051 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2052 } arm_cfft_radix2_instance_q15;
\r
2055 arm_status arm_cfft_radix2_init_q15(
\r
2056 arm_cfft_radix2_instance_q15 * S,
\r
2059 uint8_t bitReverseFlag);
\r
2062 void arm_cfft_radix2_q15(
\r
2063 const arm_cfft_radix2_instance_q15 * S,
\r
2069 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2074 uint16_t fftLen; /**< length of the FFT. */
\r
2075 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2076 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2077 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2078 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2079 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2080 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2081 } arm_cfft_radix4_instance_q15;
\r
2084 arm_status arm_cfft_radix4_init_q15(
\r
2085 arm_cfft_radix4_instance_q15 * S,
\r
2088 uint8_t bitReverseFlag);
\r
2091 void arm_cfft_radix4_q15(
\r
2092 const arm_cfft_radix4_instance_q15 * S,
\r
2096 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
\r
2101 uint16_t fftLen; /**< length of the FFT. */
\r
2102 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2103 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2104 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2105 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2106 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2107 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2108 } arm_cfft_radix2_instance_q31;
\r
2111 arm_status arm_cfft_radix2_init_q31(
\r
2112 arm_cfft_radix2_instance_q31 * S,
\r
2115 uint8_t bitReverseFlag);
\r
2118 void arm_cfft_radix2_q31(
\r
2119 const arm_cfft_radix2_instance_q31 * S,
\r
2123 * @brief Instance structure for the Q31 CFFT/CIFFT function.
\r
2128 uint16_t fftLen; /**< length of the FFT. */
\r
2129 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2130 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2131 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2132 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2133 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2134 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2135 } arm_cfft_radix4_instance_q31;
\r
2138 void arm_cfft_radix4_q31(
\r
2139 const arm_cfft_radix4_instance_q31 * S,
\r
2143 arm_status arm_cfft_radix4_init_q31(
\r
2144 arm_cfft_radix4_instance_q31 * S,
\r
2147 uint8_t bitReverseFlag);
\r
2150 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2155 uint16_t fftLen; /**< length of the FFT. */
\r
2156 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2157 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2158 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2159 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2160 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2161 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2162 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2163 } arm_cfft_radix2_instance_f32;
\r
2166 arm_status arm_cfft_radix2_init_f32(
\r
2167 arm_cfft_radix2_instance_f32 * S,
\r
2170 uint8_t bitReverseFlag);
\r
2173 void arm_cfft_radix2_f32(
\r
2174 const arm_cfft_radix2_instance_f32 * S,
\r
2175 float32_t * pSrc);
\r
2178 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2183 uint16_t fftLen; /**< length of the FFT. */
\r
2184 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2185 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2186 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2187 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2188 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2189 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2190 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2191 } arm_cfft_radix4_instance_f32;
\r
2194 arm_status arm_cfft_radix4_init_f32(
\r
2195 arm_cfft_radix4_instance_f32 * S,
\r
2198 uint8_t bitReverseFlag);
\r
2201 void arm_cfft_radix4_f32(
\r
2202 const arm_cfft_radix4_instance_f32 * S,
\r
2203 float32_t * pSrc);
\r
2206 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2211 uint16_t fftLen; /**< length of the FFT. */
\r
2212 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2213 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2214 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2215 } arm_cfft_instance_q15;
\r
2217 void arm_cfft_q15(
\r
2218 const arm_cfft_instance_q15 * S,
\r
2221 uint8_t bitReverseFlag);
\r
2224 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2229 uint16_t fftLen; /**< length of the FFT. */
\r
2230 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2231 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2232 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2233 } arm_cfft_instance_q31;
\r
2235 void arm_cfft_q31(
\r
2236 const arm_cfft_instance_q31 * S,
\r
2239 uint8_t bitReverseFlag);
\r
2242 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2247 uint16_t fftLen; /**< length of the FFT. */
\r
2248 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2249 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2250 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2251 } arm_cfft_instance_f32;
\r
2253 void arm_cfft_f32(
\r
2254 const arm_cfft_instance_f32 * S,
\r
2257 uint8_t bitReverseFlag);
\r
2260 * @brief Instance structure for the Q15 RFFT/RIFFT function.
\r
2265 uint32_t fftLenReal; /**< length of the real 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 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2270 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2271 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2272 } arm_rfft_instance_q15;
\r
2274 arm_status arm_rfft_init_q15(
\r
2275 arm_rfft_instance_q15 * S,
\r
2276 uint32_t fftLenReal,
\r
2277 uint32_t ifftFlagR,
\r
2278 uint32_t bitReverseFlag);
\r
2280 void arm_rfft_q15(
\r
2281 const arm_rfft_instance_q15 * S,
\r
2286 * @brief Instance structure for the Q31 RFFT/RIFFT function.
\r
2291 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2292 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2293 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2294 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2295 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2296 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2297 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2298 } arm_rfft_instance_q31;
\r
2300 arm_status arm_rfft_init_q31(
\r
2301 arm_rfft_instance_q31 * S,
\r
2302 uint32_t fftLenReal,
\r
2303 uint32_t ifftFlagR,
\r
2304 uint32_t bitReverseFlag);
\r
2306 void arm_rfft_q31(
\r
2307 const arm_rfft_instance_q31 * S,
\r
2312 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2317 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2318 uint16_t fftLenBy2; /**< length of the complex FFT. */
\r
2319 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2320 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2321 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2322 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2323 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2324 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2325 } arm_rfft_instance_f32;
\r
2327 arm_status arm_rfft_init_f32(
\r
2328 arm_rfft_instance_f32 * S,
\r
2329 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2330 uint32_t fftLenReal,
\r
2331 uint32_t ifftFlagR,
\r
2332 uint32_t bitReverseFlag);
\r
2334 void arm_rfft_f32(
\r
2335 const arm_rfft_instance_f32 * S,
\r
2337 float32_t * pDst);
\r
2340 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2345 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
\r
2346 uint16_t fftLenRFFT; /**< length of the real sequence */
\r
2347 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
\r
2348 } arm_rfft_fast_instance_f32 ;
\r
2350 arm_status arm_rfft_fast_init_f32 (
\r
2351 arm_rfft_fast_instance_f32 * S,
\r
2354 void arm_rfft_fast_f32(
\r
2355 arm_rfft_fast_instance_f32 * S,
\r
2356 float32_t * p, float32_t * pOut,
\r
2357 uint8_t ifftFlag);
\r
2360 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
\r
2365 uint16_t N; /**< length of the DCT4. */
\r
2366 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2367 float32_t normalize; /**< normalizing factor. */
\r
2368 float32_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2369 float32_t *pCosFactor; /**< points to the cosFactor table. */
\r
2370 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
\r
2371 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2372 } arm_dct4_instance_f32;
\r
2375 * @brief Initialization function for the floating-point DCT4/IDCT4.
\r
2376 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
\r
2377 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
\r
2378 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
\r
2379 * @param[in] N length of the DCT4.
\r
2380 * @param[in] Nby2 half of the length of the DCT4.
\r
2381 * @param[in] normalize normalizing factor.
\r
2382 * @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
2385 arm_status arm_dct4_init_f32(
\r
2386 arm_dct4_instance_f32 * S,
\r
2387 arm_rfft_instance_f32 * S_RFFT,
\r
2388 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2391 float32_t normalize);
\r
2394 * @brief Processing function for the floating-point DCT4/IDCT4.
\r
2395 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
\r
2396 * @param[in] *pState points to state buffer.
\r
2397 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2401 void arm_dct4_f32(
\r
2402 const arm_dct4_instance_f32 * S,
\r
2403 float32_t * pState,
\r
2404 float32_t * pInlineBuffer);
\r
2407 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
\r
2412 uint16_t N; /**< length of the DCT4. */
\r
2413 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2414 q31_t normalize; /**< normalizing factor. */
\r
2415 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2416 q31_t *pCosFactor; /**< points to the cosFactor table. */
\r
2417 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
\r
2418 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2419 } arm_dct4_instance_q31;
\r
2422 * @brief Initialization function for the Q31 DCT4/IDCT4.
\r
2423 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
\r
2424 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
\r
2425 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
\r
2426 * @param[in] N length of the DCT4.
\r
2427 * @param[in] Nby2 half of the length of the DCT4.
\r
2428 * @param[in] normalize normalizing factor.
\r
2429 * @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
2432 arm_status arm_dct4_init_q31(
\r
2433 arm_dct4_instance_q31 * S,
\r
2434 arm_rfft_instance_q31 * S_RFFT,
\r
2435 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2441 * @brief Processing function for the Q31 DCT4/IDCT4.
\r
2442 * @param[in] *S points to an instance of the Q31 DCT4 structure.
\r
2443 * @param[in] *pState points to state buffer.
\r
2444 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2448 void arm_dct4_q31(
\r
2449 const arm_dct4_instance_q31 * S,
\r
2451 q31_t * pInlineBuffer);
\r
2454 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
\r
2459 uint16_t N; /**< length of the DCT4. */
\r
2460 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2461 q15_t normalize; /**< normalizing factor. */
\r
2462 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2463 q15_t *pCosFactor; /**< points to the cosFactor table. */
\r
2464 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
\r
2465 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2466 } arm_dct4_instance_q15;
\r
2469 * @brief Initialization function for the Q15 DCT4/IDCT4.
\r
2470 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
\r
2471 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
\r
2472 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
\r
2473 * @param[in] N length of the DCT4.
\r
2474 * @param[in] Nby2 half of the length of the DCT4.
\r
2475 * @param[in] normalize normalizing factor.
\r
2476 * @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
2479 arm_status arm_dct4_init_q15(
\r
2480 arm_dct4_instance_q15 * S,
\r
2481 arm_rfft_instance_q15 * S_RFFT,
\r
2482 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2488 * @brief Processing function for the Q15 DCT4/IDCT4.
\r
2489 * @param[in] *S points to an instance of the Q15 DCT4 structure.
\r
2490 * @param[in] *pState points to state buffer.
\r
2491 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
\r
2495 void arm_dct4_q15(
\r
2496 const arm_dct4_instance_q15 * S,
\r
2498 q15_t * pInlineBuffer);
\r
2501 * @brief Floating-point vector addition.
\r
2502 * @param[in] *pSrcA points to the first input vector
\r
2503 * @param[in] *pSrcB points to the second input vector
\r
2504 * @param[out] *pDst points to the output vector
\r
2505 * @param[in] blockSize number of samples in each vector
\r
2510 float32_t * pSrcA,
\r
2511 float32_t * pSrcB,
\r
2513 uint32_t blockSize);
\r
2516 * @brief Q7 vector addition.
\r
2517 * @param[in] *pSrcA points to the first input vector
\r
2518 * @param[in] *pSrcB points to the second input vector
\r
2519 * @param[out] *pDst points to the output vector
\r
2520 * @param[in] blockSize number of samples in each vector
\r
2528 uint32_t blockSize);
\r
2531 * @brief Q15 vector addition.
\r
2532 * @param[in] *pSrcA points to the first input vector
\r
2533 * @param[in] *pSrcB points to the second input vector
\r
2534 * @param[out] *pDst points to the output vector
\r
2535 * @param[in] blockSize number of samples in each vector
\r
2543 uint32_t blockSize);
\r
2546 * @brief Q31 vector addition.
\r
2547 * @param[in] *pSrcA points to the first input vector
\r
2548 * @param[in] *pSrcB points to the second input vector
\r
2549 * @param[out] *pDst points to the output vector
\r
2550 * @param[in] blockSize number of samples in each vector
\r
2558 uint32_t blockSize);
\r
2561 * @brief Floating-point vector subtraction.
\r
2562 * @param[in] *pSrcA points to the first input vector
\r
2563 * @param[in] *pSrcB points to the second input vector
\r
2564 * @param[out] *pDst points to the output vector
\r
2565 * @param[in] blockSize number of samples in each vector
\r
2570 float32_t * pSrcA,
\r
2571 float32_t * pSrcB,
\r
2573 uint32_t blockSize);
\r
2576 * @brief Q7 vector subtraction.
\r
2577 * @param[in] *pSrcA points to the first input vector
\r
2578 * @param[in] *pSrcB points to the second input vector
\r
2579 * @param[out] *pDst points to the output vector
\r
2580 * @param[in] blockSize number of samples in each vector
\r
2588 uint32_t blockSize);
\r
2591 * @brief Q15 vector subtraction.
\r
2592 * @param[in] *pSrcA points to the first input vector
\r
2593 * @param[in] *pSrcB points to the second input vector
\r
2594 * @param[out] *pDst points to the output vector
\r
2595 * @param[in] blockSize number of samples in each vector
\r
2603 uint32_t blockSize);
\r
2606 * @brief Q31 vector subtraction.
\r
2607 * @param[in] *pSrcA points to the first input vector
\r
2608 * @param[in] *pSrcB points to the second input vector
\r
2609 * @param[out] *pDst points to the output vector
\r
2610 * @param[in] blockSize number of samples in each vector
\r
2618 uint32_t blockSize);
\r
2621 * @brief Multiplies a floating-point vector by a scalar.
\r
2622 * @param[in] *pSrc points to the input vector
\r
2623 * @param[in] scale scale factor to be applied
\r
2624 * @param[out] *pDst points to the output vector
\r
2625 * @param[in] blockSize number of samples in the vector
\r
2629 void arm_scale_f32(
\r
2633 uint32_t blockSize);
\r
2636 * @brief Multiplies a Q7 vector by a scalar.
\r
2637 * @param[in] *pSrc points to the input vector
\r
2638 * @param[in] scaleFract fractional portion of the scale value
\r
2639 * @param[in] shift number of bits to shift the result by
\r
2640 * @param[out] *pDst points to the output vector
\r
2641 * @param[in] blockSize number of samples in the vector
\r
2645 void arm_scale_q7(
\r
2650 uint32_t blockSize);
\r
2653 * @brief Multiplies a Q15 vector by a scalar.
\r
2654 * @param[in] *pSrc points to the input vector
\r
2655 * @param[in] scaleFract fractional portion of the scale value
\r
2656 * @param[in] shift number of bits to shift the result by
\r
2657 * @param[out] *pDst points to the output vector
\r
2658 * @param[in] blockSize number of samples in the vector
\r
2662 void arm_scale_q15(
\r
2667 uint32_t blockSize);
\r
2670 * @brief Multiplies a Q31 vector by a scalar.
\r
2671 * @param[in] *pSrc points to the input vector
\r
2672 * @param[in] scaleFract fractional portion of the scale value
\r
2673 * @param[in] shift number of bits to shift the result by
\r
2674 * @param[out] *pDst points to the output vector
\r
2675 * @param[in] blockSize number of samples in the vector
\r
2679 void arm_scale_q31(
\r
2684 uint32_t blockSize);
\r
2687 * @brief Q7 vector absolute value.
\r
2688 * @param[in] *pSrc points to the input buffer
\r
2689 * @param[out] *pDst points to the output buffer
\r
2690 * @param[in] blockSize number of samples in each vector
\r
2697 uint32_t blockSize);
\r
2700 * @brief Floating-point vector absolute value.
\r
2701 * @param[in] *pSrc points to the input buffer
\r
2702 * @param[out] *pDst points to the output buffer
\r
2703 * @param[in] blockSize number of samples in each vector
\r
2710 uint32_t blockSize);
\r
2713 * @brief Q15 vector absolute value.
\r
2714 * @param[in] *pSrc points to the input buffer
\r
2715 * @param[out] *pDst points to the output buffer
\r
2716 * @param[in] blockSize number of samples in each vector
\r
2723 uint32_t blockSize);
\r
2726 * @brief Q31 vector absolute value.
\r
2727 * @param[in] *pSrc points to the input buffer
\r
2728 * @param[out] *pDst points to the output buffer
\r
2729 * @param[in] blockSize number of samples in each vector
\r
2736 uint32_t blockSize);
\r
2739 * @brief Dot product of floating-point vectors.
\r
2740 * @param[in] *pSrcA points to the first input vector
\r
2741 * @param[in] *pSrcB points to the second input vector
\r
2742 * @param[in] blockSize number of samples in each vector
\r
2743 * @param[out] *result output result returned here
\r
2747 void arm_dot_prod_f32(
\r
2748 float32_t * pSrcA,
\r
2749 float32_t * pSrcB,
\r
2750 uint32_t blockSize,
\r
2751 float32_t * result);
\r
2754 * @brief Dot product of Q7 vectors.
\r
2755 * @param[in] *pSrcA points to the first input vector
\r
2756 * @param[in] *pSrcB points to the second input vector
\r
2757 * @param[in] blockSize number of samples in each vector
\r
2758 * @param[out] *result output result returned here
\r
2762 void arm_dot_prod_q7(
\r
2765 uint32_t blockSize,
\r
2769 * @brief Dot product of Q15 vectors.
\r
2770 * @param[in] *pSrcA points to the first input vector
\r
2771 * @param[in] *pSrcB points to the second input vector
\r
2772 * @param[in] blockSize number of samples in each vector
\r
2773 * @param[out] *result output result returned here
\r
2777 void arm_dot_prod_q15(
\r
2780 uint32_t blockSize,
\r
2784 * @brief Dot product of Q31 vectors.
\r
2785 * @param[in] *pSrcA points to the first input vector
\r
2786 * @param[in] *pSrcB points to the second input vector
\r
2787 * @param[in] blockSize number of samples in each vector
\r
2788 * @param[out] *result output result returned here
\r
2792 void arm_dot_prod_q31(
\r
2795 uint32_t blockSize,
\r
2799 * @brief Shifts the elements of a Q7 vector a specified number of bits.
\r
2800 * @param[in] *pSrc points to the input vector
\r
2801 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2802 * @param[out] *pDst points to the output vector
\r
2803 * @param[in] blockSize number of samples in the vector
\r
2807 void arm_shift_q7(
\r
2811 uint32_t blockSize);
\r
2814 * @brief Shifts the elements of a Q15 vector a specified number of bits.
\r
2815 * @param[in] *pSrc points to the input vector
\r
2816 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2817 * @param[out] *pDst points to the output vector
\r
2818 * @param[in] blockSize number of samples in the vector
\r
2822 void arm_shift_q15(
\r
2826 uint32_t blockSize);
\r
2829 * @brief Shifts the elements of a Q31 vector a specified number of bits.
\r
2830 * @param[in] *pSrc points to the input vector
\r
2831 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2832 * @param[out] *pDst points to the output vector
\r
2833 * @param[in] blockSize number of samples in the vector
\r
2837 void arm_shift_q31(
\r
2841 uint32_t blockSize);
\r
2844 * @brief Adds a constant offset to a floating-point vector.
\r
2845 * @param[in] *pSrc points to the input vector
\r
2846 * @param[in] offset is the offset to be added
\r
2847 * @param[out] *pDst points to the output vector
\r
2848 * @param[in] blockSize number of samples in the vector
\r
2852 void arm_offset_f32(
\r
2856 uint32_t blockSize);
\r
2859 * @brief Adds a constant offset to a Q7 vector.
\r
2860 * @param[in] *pSrc points to the input vector
\r
2861 * @param[in] offset is the offset to be added
\r
2862 * @param[out] *pDst points to the output vector
\r
2863 * @param[in] blockSize number of samples in the vector
\r
2867 void arm_offset_q7(
\r
2871 uint32_t blockSize);
\r
2874 * @brief Adds a constant offset to a Q15 vector.
\r
2875 * @param[in] *pSrc points to the input vector
\r
2876 * @param[in] offset is the offset to be added
\r
2877 * @param[out] *pDst points to the output vector
\r
2878 * @param[in] blockSize number of samples in the vector
\r
2882 void arm_offset_q15(
\r
2886 uint32_t blockSize);
\r
2889 * @brief Adds a constant offset to a Q31 vector.
\r
2890 * @param[in] *pSrc points to the input vector
\r
2891 * @param[in] offset is the offset to be added
\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_offset_q31(
\r
2901 uint32_t blockSize);
\r
2904 * @brief Negates the elements of a floating-point vector.
\r
2905 * @param[in] *pSrc points to the input vector
\r
2906 * @param[out] *pDst points to the output vector
\r
2907 * @param[in] blockSize number of samples in the vector
\r
2911 void arm_negate_f32(
\r
2914 uint32_t blockSize);
\r
2917 * @brief Negates the elements of a Q7 vector.
\r
2918 * @param[in] *pSrc points to the input vector
\r
2919 * @param[out] *pDst points to the output vector
\r
2920 * @param[in] blockSize number of samples in the vector
\r
2924 void arm_negate_q7(
\r
2927 uint32_t blockSize);
\r
2930 * @brief Negates the elements of a Q15 vector.
\r
2931 * @param[in] *pSrc points to the input vector
\r
2932 * @param[out] *pDst points to the output vector
\r
2933 * @param[in] blockSize number of samples in the vector
\r
2937 void arm_negate_q15(
\r
2940 uint32_t blockSize);
\r
2943 * @brief Negates the elements of a Q31 vector.
\r
2944 * @param[in] *pSrc points to the input vector
\r
2945 * @param[out] *pDst points to the output vector
\r
2946 * @param[in] blockSize number of samples in the vector
\r
2950 void arm_negate_q31(
\r
2953 uint32_t blockSize);
\r
2955 * @brief Copies the elements of a floating-point vector.
\r
2956 * @param[in] *pSrc input pointer
\r
2957 * @param[out] *pDst output pointer
\r
2958 * @param[in] blockSize number of samples to process
\r
2961 void arm_copy_f32(
\r
2964 uint32_t blockSize);
\r
2967 * @brief Copies the elements of a Q7 vector.
\r
2968 * @param[in] *pSrc input pointer
\r
2969 * @param[out] *pDst output pointer
\r
2970 * @param[in] blockSize number of samples to process
\r
2976 uint32_t blockSize);
\r
2979 * @brief Copies the elements of a Q15 vector.
\r
2980 * @param[in] *pSrc input pointer
\r
2981 * @param[out] *pDst output pointer
\r
2982 * @param[in] blockSize number of samples to process
\r
2985 void arm_copy_q15(
\r
2988 uint32_t blockSize);
\r
2991 * @brief Copies the elements of a Q31 vector.
\r
2992 * @param[in] *pSrc input pointer
\r
2993 * @param[out] *pDst output pointer
\r
2994 * @param[in] blockSize number of samples to process
\r
2997 void arm_copy_q31(
\r
3000 uint32_t blockSize);
\r
3002 * @brief Fills a constant value into a floating-point vector.
\r
3003 * @param[in] value input value to be filled
\r
3004 * @param[out] *pDst output pointer
\r
3005 * @param[in] blockSize number of samples to process
\r
3008 void arm_fill_f32(
\r
3011 uint32_t blockSize);
\r
3014 * @brief Fills a constant value into a Q7 vector.
\r
3015 * @param[in] value input value to be filled
\r
3016 * @param[out] *pDst output pointer
\r
3017 * @param[in] blockSize number of samples to process
\r
3023 uint32_t blockSize);
\r
3026 * @brief Fills a constant value into a Q15 vector.
\r
3027 * @param[in] value input value to be filled
\r
3028 * @param[out] *pDst output pointer
\r
3029 * @param[in] blockSize number of samples to process
\r
3032 void arm_fill_q15(
\r
3035 uint32_t blockSize);
\r
3038 * @brief Fills a constant value into a Q31 vector.
\r
3039 * @param[in] value input value to be filled
\r
3040 * @param[out] *pDst output pointer
\r
3041 * @param[in] blockSize number of samples to process
\r
3044 void arm_fill_q31(
\r
3047 uint32_t blockSize);
\r
3050 * @brief Convolution of floating-point sequences.
\r
3051 * @param[in] *pSrcA points to the first input sequence.
\r
3052 * @param[in] srcALen length of the first input sequence.
\r
3053 * @param[in] *pSrcB points to the second input sequence.
\r
3054 * @param[in] srcBLen length of the second input sequence.
\r
3055 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3059 void arm_conv_f32(
\r
3060 float32_t * pSrcA,
\r
3062 float32_t * pSrcB,
\r
3064 float32_t * pDst);
\r
3068 * @brief Convolution of Q15 sequences.
\r
3069 * @param[in] *pSrcA points to the first input sequence.
\r
3070 * @param[in] srcALen length of the first input sequence.
\r
3071 * @param[in] *pSrcB points to the second input sequence.
\r
3072 * @param[in] srcBLen length of the second input sequence.
\r
3073 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3074 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3075 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3080 void arm_conv_opt_q15(
\r
3086 q15_t * pScratch1,
\r
3087 q15_t * pScratch2);
\r
3091 * @brief Convolution of Q15 sequences.
\r
3092 * @param[in] *pSrcA points to the first input sequence.
\r
3093 * @param[in] srcALen length of the first input sequence.
\r
3094 * @param[in] *pSrcB points to the second input sequence.
\r
3095 * @param[in] srcBLen length of the second input sequence.
\r
3096 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3100 void arm_conv_q15(
\r
3108 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3109 * @param[in] *pSrcA points to the first input sequence.
\r
3110 * @param[in] srcALen length of the first input sequence.
\r
3111 * @param[in] *pSrcB points to the second input sequence.
\r
3112 * @param[in] srcBLen length of the second input sequence.
\r
3113 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3117 void arm_conv_fast_q15(
\r
3125 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3126 * @param[in] *pSrcA points to the first input sequence.
\r
3127 * @param[in] srcALen length of the first input sequence.
\r
3128 * @param[in] *pSrcB points to the second input sequence.
\r
3129 * @param[in] srcBLen length of the second input sequence.
\r
3130 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3131 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3132 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3136 void arm_conv_fast_opt_q15(
\r
3142 q15_t * pScratch1,
\r
3143 q15_t * pScratch2);
\r
3148 * @brief Convolution of Q31 sequences.
\r
3149 * @param[in] *pSrcA points to the first input sequence.
\r
3150 * @param[in] srcALen length of the first input sequence.
\r
3151 * @param[in] *pSrcB points to the second input sequence.
\r
3152 * @param[in] srcBLen length of the second input sequence.
\r
3153 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3157 void arm_conv_q31(
\r
3165 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3166 * @param[in] *pSrcA points to the first input sequence.
\r
3167 * @param[in] srcALen length of the first input sequence.
\r
3168 * @param[in] *pSrcB points to the second input sequence.
\r
3169 * @param[in] srcBLen length of the second input sequence.
\r
3170 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3174 void arm_conv_fast_q31(
\r
3183 * @brief Convolution of Q7 sequences.
\r
3184 * @param[in] *pSrcA points to the first input sequence.
\r
3185 * @param[in] srcALen length of the first input sequence.
\r
3186 * @param[in] *pSrcB points to the second input sequence.
\r
3187 * @param[in] srcBLen length of the second input sequence.
\r
3188 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3189 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3190 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3194 void arm_conv_opt_q7(
\r
3200 q15_t * pScratch1,
\r
3201 q15_t * pScratch2);
\r
3206 * @brief Convolution of Q7 sequences.
\r
3207 * @param[in] *pSrcA points to the first input sequence.
\r
3208 * @param[in] srcALen length of the first input sequence.
\r
3209 * @param[in] *pSrcB points to the second input sequence.
\r
3210 * @param[in] srcBLen length of the second input sequence.
\r
3211 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3224 * @brief Partial convolution of floating-point sequences.
\r
3225 * @param[in] *pSrcA points to the first input sequence.
\r
3226 * @param[in] srcALen length of the first input sequence.
\r
3227 * @param[in] *pSrcB points to the second input sequence.
\r
3228 * @param[in] srcBLen length of the second input sequence.
\r
3229 * @param[out] *pDst points to the block of output data
\r
3230 * @param[in] firstIndex is the first output sample to start with.
\r
3231 * @param[in] numPoints is the number of output points to be computed.
\r
3232 * @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
3235 arm_status arm_conv_partial_f32(
\r
3236 float32_t * pSrcA,
\r
3238 float32_t * pSrcB,
\r
3241 uint32_t firstIndex,
\r
3242 uint32_t numPoints);
\r
3245 * @brief Partial convolution of Q15 sequences.
\r
3246 * @param[in] *pSrcA points to the first input sequence.
\r
3247 * @param[in] srcALen length of the first input sequence.
\r
3248 * @param[in] *pSrcB points to the second input sequence.
\r
3249 * @param[in] srcBLen length of the second input sequence.
\r
3250 * @param[out] *pDst points to the block of output data
\r
3251 * @param[in] firstIndex is the first output sample to start with.
\r
3252 * @param[in] numPoints is the number of output points to be computed.
\r
3253 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3254 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3255 * @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
3258 arm_status arm_conv_partial_opt_q15(
\r
3264 uint32_t firstIndex,
\r
3265 uint32_t numPoints,
\r
3266 q15_t * pScratch1,
\r
3267 q15_t * pScratch2);
\r
3271 * @brief Partial convolution of Q15 sequences.
\r
3272 * @param[in] *pSrcA points to the first input sequence.
\r
3273 * @param[in] srcALen length of the first input sequence.
\r
3274 * @param[in] *pSrcB points to the second input sequence.
\r
3275 * @param[in] srcBLen length of the second input sequence.
\r
3276 * @param[out] *pDst points to the block of output data
\r
3277 * @param[in] firstIndex is the first output sample to start with.
\r
3278 * @param[in] numPoints is the number of output points to be computed.
\r
3279 * @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
3282 arm_status arm_conv_partial_q15(
\r
3288 uint32_t firstIndex,
\r
3289 uint32_t numPoints);
\r
3292 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3293 * @param[in] *pSrcA points to the first input sequence.
\r
3294 * @param[in] srcALen length of the first input sequence.
\r
3295 * @param[in] *pSrcB points to the second input sequence.
\r
3296 * @param[in] srcBLen length of the second input sequence.
\r
3297 * @param[out] *pDst points to the block of output data
\r
3298 * @param[in] firstIndex is the first output sample to start with.
\r
3299 * @param[in] numPoints is the number of output points to be computed.
\r
3300 * @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
3303 arm_status arm_conv_partial_fast_q15(
\r
3309 uint32_t firstIndex,
\r
3310 uint32_t numPoints);
\r
3314 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3315 * @param[in] *pSrcA points to the first input sequence.
\r
3316 * @param[in] srcALen length of the first input sequence.
\r
3317 * @param[in] *pSrcB points to the second input sequence.
\r
3318 * @param[in] srcBLen length of the second input sequence.
\r
3319 * @param[out] *pDst points to the block of output data
\r
3320 * @param[in] firstIndex is the first output sample to start with.
\r
3321 * @param[in] numPoints is the number of output points to be computed.
\r
3322 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3323 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3324 * @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
3327 arm_status arm_conv_partial_fast_opt_q15(
\r
3333 uint32_t firstIndex,
\r
3334 uint32_t numPoints,
\r
3335 q15_t * pScratch1,
\r
3336 q15_t * pScratch2);
\r
3340 * @brief Partial convolution of Q31 sequences.
\r
3341 * @param[in] *pSrcA points to the first input sequence.
\r
3342 * @param[in] srcALen length of the first input sequence.
\r
3343 * @param[in] *pSrcB points to the second input sequence.
\r
3344 * @param[in] srcBLen length of the second input sequence.
\r
3345 * @param[out] *pDst points to the block of output data
\r
3346 * @param[in] firstIndex is the first output sample to start with.
\r
3347 * @param[in] numPoints is the number of output points to be computed.
\r
3348 * @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
3351 arm_status arm_conv_partial_q31(
\r
3357 uint32_t firstIndex,
\r
3358 uint32_t numPoints);
\r
3362 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3363 * @param[in] *pSrcA points to the first input sequence.
\r
3364 * @param[in] srcALen length of the first input sequence.
\r
3365 * @param[in] *pSrcB points to the second input sequence.
\r
3366 * @param[in] srcBLen length of the second input sequence.
\r
3367 * @param[out] *pDst points to the block of output data
\r
3368 * @param[in] firstIndex is the first output sample to start with.
\r
3369 * @param[in] numPoints is the number of output points to be computed.
\r
3370 * @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
3373 arm_status arm_conv_partial_fast_q31(
\r
3379 uint32_t firstIndex,
\r
3380 uint32_t numPoints);
\r
3384 * @brief Partial convolution of Q7 sequences
\r
3385 * @param[in] *pSrcA points to the first input sequence.
\r
3386 * @param[in] srcALen length of the first input sequence.
\r
3387 * @param[in] *pSrcB points to the second input sequence.
\r
3388 * @param[in] srcBLen length of the second input sequence.
\r
3389 * @param[out] *pDst points to the block of output data
\r
3390 * @param[in] firstIndex is the first output sample to start with.
\r
3391 * @param[in] numPoints is the number of output points to be computed.
\r
3392 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3393 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3394 * @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
3397 arm_status arm_conv_partial_opt_q7(
\r
3403 uint32_t firstIndex,
\r
3404 uint32_t numPoints,
\r
3405 q15_t * pScratch1,
\r
3406 q15_t * pScratch2);
\r
3410 * @brief Partial convolution of Q7 sequences.
\r
3411 * @param[in] *pSrcA points to the first input sequence.
\r
3412 * @param[in] srcALen length of the first input sequence.
\r
3413 * @param[in] *pSrcB points to the second input sequence.
\r
3414 * @param[in] srcBLen length of the second input sequence.
\r
3415 * @param[out] *pDst points to the block of output data
\r
3416 * @param[in] firstIndex is the first output sample to start with.
\r
3417 * @param[in] numPoints is the number of output points to be computed.
\r
3418 * @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
3421 arm_status arm_conv_partial_q7(
\r
3427 uint32_t firstIndex,
\r
3428 uint32_t numPoints);
\r
3433 * @brief Instance structure for the Q15 FIR decimator.
\r
3438 uint8_t M; /**< decimation factor. */
\r
3439 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3440 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3441 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3442 } arm_fir_decimate_instance_q15;
\r
3445 * @brief Instance structure for the Q31 FIR decimator.
\r
3450 uint8_t M; /**< decimation factor. */
\r
3451 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3452 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3453 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3455 } arm_fir_decimate_instance_q31;
\r
3458 * @brief Instance structure for the floating-point FIR decimator.
\r
3463 uint8_t M; /**< decimation factor. */
\r
3464 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3465 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3466 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3468 } arm_fir_decimate_instance_f32;
\r
3473 * @brief Processing function for the floating-point FIR decimator.
\r
3474 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
\r
3475 * @param[in] *pSrc points to the block of input data.
\r
3476 * @param[out] *pDst points to the block of output data
\r
3477 * @param[in] blockSize number of input samples to process per call.
\r
3481 void arm_fir_decimate_f32(
\r
3482 const arm_fir_decimate_instance_f32 * S,
\r
3485 uint32_t blockSize);
\r
3489 * @brief Initialization function for the floating-point FIR decimator.
\r
3490 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
\r
3491 * @param[in] numTaps number of coefficients in the filter.
\r
3492 * @param[in] M decimation factor.
\r
3493 * @param[in] *pCoeffs points to the filter coefficients.
\r
3494 * @param[in] *pState points to the state buffer.
\r
3495 * @param[in] blockSize number of input samples to process per call.
\r
3496 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3497 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3500 arm_status arm_fir_decimate_init_f32(
\r
3501 arm_fir_decimate_instance_f32 * S,
\r
3504 float32_t * pCoeffs,
\r
3505 float32_t * pState,
\r
3506 uint32_t blockSize);
\r
3509 * @brief Processing function for the Q15 FIR decimator.
\r
3510 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3511 * @param[in] *pSrc points to the block of input data.
\r
3512 * @param[out] *pDst points to the block of output data
\r
3513 * @param[in] blockSize number of input samples to process per call.
\r
3517 void arm_fir_decimate_q15(
\r
3518 const arm_fir_decimate_instance_q15 * S,
\r
3521 uint32_t blockSize);
\r
3524 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3525 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
\r
3526 * @param[in] *pSrc points to the block of input data.
\r
3527 * @param[out] *pDst points to the block of output data
\r
3528 * @param[in] blockSize number of input samples to process per call.
\r
3532 void arm_fir_decimate_fast_q15(
\r
3533 const arm_fir_decimate_instance_q15 * S,
\r
3536 uint32_t blockSize);
\r
3541 * @brief Initialization function for the Q15 FIR decimator.
\r
3542 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
\r
3543 * @param[in] numTaps number of coefficients in the filter.
\r
3544 * @param[in] M decimation factor.
\r
3545 * @param[in] *pCoeffs points to the filter coefficients.
\r
3546 * @param[in] *pState points to the state buffer.
\r
3547 * @param[in] blockSize number of input samples to process per call.
\r
3548 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3549 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3552 arm_status arm_fir_decimate_init_q15(
\r
3553 arm_fir_decimate_instance_q15 * S,
\r
3558 uint32_t blockSize);
\r
3561 * @brief Processing function for the Q31 FIR decimator.
\r
3562 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3563 * @param[in] *pSrc points to the block of input data.
\r
3564 * @param[out] *pDst points to the block of output data
\r
3565 * @param[in] blockSize number of input samples to process per call.
\r
3569 void arm_fir_decimate_q31(
\r
3570 const arm_fir_decimate_instance_q31 * S,
\r
3573 uint32_t blockSize);
\r
3576 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3577 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
\r
3578 * @param[in] *pSrc points to the block of input data.
\r
3579 * @param[out] *pDst points to the block of output data
\r
3580 * @param[in] blockSize number of input samples to process per call.
\r
3584 void arm_fir_decimate_fast_q31(
\r
3585 arm_fir_decimate_instance_q31 * S,
\r
3588 uint32_t blockSize);
\r
3592 * @brief Initialization function for the Q31 FIR decimator.
\r
3593 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
\r
3594 * @param[in] numTaps number of coefficients in the filter.
\r
3595 * @param[in] M decimation factor.
\r
3596 * @param[in] *pCoeffs points to the filter coefficients.
\r
3597 * @param[in] *pState points to the state buffer.
\r
3598 * @param[in] blockSize number of input samples to process per call.
\r
3599 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3600 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3603 arm_status arm_fir_decimate_init_q31(
\r
3604 arm_fir_decimate_instance_q31 * S,
\r
3609 uint32_t blockSize);
\r
3614 * @brief Instance structure for the Q15 FIR interpolator.
\r
3619 uint8_t L; /**< upsample factor. */
\r
3620 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3621 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3622 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3623 } arm_fir_interpolate_instance_q15;
\r
3626 * @brief Instance structure for the Q31 FIR interpolator.
\r
3631 uint8_t L; /**< upsample factor. */
\r
3632 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3633 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3634 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3635 } arm_fir_interpolate_instance_q31;
\r
3638 * @brief Instance structure for the floating-point FIR interpolator.
\r
3643 uint8_t L; /**< upsample factor. */
\r
3644 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3645 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3646 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
\r
3647 } arm_fir_interpolate_instance_f32;
\r
3651 * @brief Processing function for the Q15 FIR interpolator.
\r
3652 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3653 * @param[in] *pSrc points to the block of input data.
\r
3654 * @param[out] *pDst points to the block of output data.
\r
3655 * @param[in] blockSize number of input samples to process per call.
\r
3659 void arm_fir_interpolate_q15(
\r
3660 const arm_fir_interpolate_instance_q15 * S,
\r
3663 uint32_t blockSize);
\r
3667 * @brief Initialization function for the Q15 FIR interpolator.
\r
3668 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
\r
3669 * @param[in] L upsample factor.
\r
3670 * @param[in] numTaps number of filter coefficients in the filter.
\r
3671 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3672 * @param[in] *pState points to the state buffer.
\r
3673 * @param[in] blockSize number of input samples to process per call.
\r
3674 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3675 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3678 arm_status arm_fir_interpolate_init_q15(
\r
3679 arm_fir_interpolate_instance_q15 * S,
\r
3684 uint32_t blockSize);
\r
3687 * @brief Processing function for the Q31 FIR interpolator.
\r
3688 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
\r
3689 * @param[in] *pSrc points to the block of input data.
\r
3690 * @param[out] *pDst points to the block of output data.
\r
3691 * @param[in] blockSize number of input samples to process per call.
\r
3695 void arm_fir_interpolate_q31(
\r
3696 const arm_fir_interpolate_instance_q31 * S,
\r
3699 uint32_t blockSize);
\r
3702 * @brief Initialization function for the Q31 FIR interpolator.
\r
3703 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
\r
3704 * @param[in] L upsample factor.
\r
3705 * @param[in] numTaps number of filter coefficients in the filter.
\r
3706 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3707 * @param[in] *pState points to the state buffer.
\r
3708 * @param[in] blockSize number of input samples to process per call.
\r
3709 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3710 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3713 arm_status arm_fir_interpolate_init_q31(
\r
3714 arm_fir_interpolate_instance_q31 * S,
\r
3719 uint32_t blockSize);
\r
3723 * @brief Processing function for the floating-point FIR interpolator.
\r
3724 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
\r
3725 * @param[in] *pSrc points to the block of input data.
\r
3726 * @param[out] *pDst points to the block of output data.
\r
3727 * @param[in] blockSize number of input samples to process per call.
\r
3731 void arm_fir_interpolate_f32(
\r
3732 const arm_fir_interpolate_instance_f32 * S,
\r
3735 uint32_t blockSize);
\r
3738 * @brief Initialization function for the floating-point FIR interpolator.
\r
3739 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
\r
3740 * @param[in] L upsample factor.
\r
3741 * @param[in] numTaps number of filter coefficients in the filter.
\r
3742 * @param[in] *pCoeffs points to the filter coefficient buffer.
\r
3743 * @param[in] *pState points to the state buffer.
\r
3744 * @param[in] blockSize number of input samples to process per call.
\r
3745 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3746 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3749 arm_status arm_fir_interpolate_init_f32(
\r
3750 arm_fir_interpolate_instance_f32 * S,
\r
3753 float32_t * pCoeffs,
\r
3754 float32_t * pState,
\r
3755 uint32_t blockSize);
\r
3758 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
\r
3763 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3764 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3765 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3766 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
\r
3768 } arm_biquad_cas_df1_32x64_ins_q31;
\r
3772 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3773 * @param[in] *pSrc points to the block of input data.
\r
3774 * @param[out] *pDst points to the block of output data
\r
3775 * @param[in] blockSize number of samples to process.
\r
3779 void arm_biquad_cas_df1_32x64_q31(
\r
3780 const arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3783 uint32_t blockSize);
\r
3787 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3788 * @param[in] numStages number of 2nd order stages in the filter.
\r
3789 * @param[in] *pCoeffs points to the filter coefficients.
\r
3790 * @param[in] *pState points to the state buffer.
\r
3791 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
\r
3795 void arm_biquad_cas_df1_32x64_init_q31(
\r
3796 arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3797 uint8_t numStages,
\r
3800 uint8_t postShift);
\r
3805 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3810 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3811 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3812 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3813 } arm_biquad_cascade_df2T_instance_f32;
\r
3818 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3823 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3824 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3825 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3826 } arm_biquad_cascade_stereo_df2T_instance_f32;
\r
3831 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3836 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3837 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3838 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3839 } arm_biquad_cascade_df2T_instance_f64;
\r
3843 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3844 * @param[in] *S points to an instance of the filter data structure.
\r
3845 * @param[in] *pSrc points to the block of input data.
\r
3846 * @param[out] *pDst points to the block of output data
\r
3847 * @param[in] blockSize number of samples to process.
\r
3851 void arm_biquad_cascade_df2T_f32(
\r
3852 const arm_biquad_cascade_df2T_instance_f32 * S,
\r
3855 uint32_t blockSize);
\r
3859 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
\r
3860 * @param[in] *S points to an instance of the filter data structure.
\r
3861 * @param[in] *pSrc points to the block of input data.
\r
3862 * @param[out] *pDst points to the block of output data
\r
3863 * @param[in] blockSize number of samples to process.
\r
3867 void arm_biquad_cascade_stereo_df2T_f32(
\r
3868 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3871 uint32_t blockSize);
\r
3874 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3875 * @param[in] *S points to an instance of the filter data structure.
\r
3876 * @param[in] *pSrc points to the block of input data.
\r
3877 * @param[out] *pDst points to the block of output data
\r
3878 * @param[in] blockSize number of samples to process.
\r
3882 void arm_biquad_cascade_df2T_f64(
\r
3883 const arm_biquad_cascade_df2T_instance_f64 * S,
\r
3886 uint32_t blockSize);
\r
3890 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3891 * @param[in,out] *S points to an instance of the filter data structure.
\r
3892 * @param[in] numStages number of 2nd order stages in the filter.
\r
3893 * @param[in] *pCoeffs points to the filter coefficients.
\r
3894 * @param[in] *pState points to the state buffer.
\r
3898 void arm_biquad_cascade_df2T_init_f32(
\r
3899 arm_biquad_cascade_df2T_instance_f32 * S,
\r
3900 uint8_t numStages,
\r
3901 float32_t * pCoeffs,
\r
3902 float32_t * pState);
\r
3906 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3907 * @param[in,out] *S points to an instance of the filter data structure.
\r
3908 * @param[in] numStages number of 2nd order stages in the filter.
\r
3909 * @param[in] *pCoeffs points to the filter coefficients.
\r
3910 * @param[in] *pState points to the state buffer.
\r
3914 void arm_biquad_cascade_stereo_df2T_init_f32(
\r
3915 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3916 uint8_t numStages,
\r
3917 float32_t * pCoeffs,
\r
3918 float32_t * pState);
\r
3922 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3923 * @param[in,out] *S points to an instance of the filter data structure.
\r
3924 * @param[in] numStages number of 2nd order stages in the filter.
\r
3925 * @param[in] *pCoeffs points to the filter coefficients.
\r
3926 * @param[in] *pState points to the state buffer.
\r
3930 void arm_biquad_cascade_df2T_init_f64(
\r
3931 arm_biquad_cascade_df2T_instance_f64 * S,
\r
3932 uint8_t numStages,
\r
3933 float64_t * pCoeffs,
\r
3934 float64_t * pState);
\r
3939 * @brief Instance structure for the Q15 FIR lattice filter.
\r
3944 uint16_t numStages; /**< number of filter stages. */
\r
3945 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3946 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3947 } arm_fir_lattice_instance_q15;
\r
3950 * @brief Instance structure for the Q31 FIR lattice filter.
\r
3955 uint16_t numStages; /**< number of filter stages. */
\r
3956 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3957 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3958 } arm_fir_lattice_instance_q31;
\r
3961 * @brief Instance structure for the floating-point FIR lattice filter.
\r
3966 uint16_t numStages; /**< number of filter stages. */
\r
3967 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3968 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3969 } arm_fir_lattice_instance_f32;
\r
3972 * @brief Initialization function for the Q15 FIR lattice filter.
\r
3973 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3974 * @param[in] numStages number of filter stages.
\r
3975 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3976 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
3980 void arm_fir_lattice_init_q15(
\r
3981 arm_fir_lattice_instance_q15 * S,
\r
3982 uint16_t numStages,
\r
3988 * @brief Processing function for the Q15 FIR lattice filter.
\r
3989 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
\r
3990 * @param[in] *pSrc points to the block of input data.
\r
3991 * @param[out] *pDst points to the block of output data.
\r
3992 * @param[in] blockSize number of samples to process.
\r
3995 void arm_fir_lattice_q15(
\r
3996 const arm_fir_lattice_instance_q15 * S,
\r
3999 uint32_t blockSize);
\r
4002 * @brief Initialization function for the Q31 FIR lattice filter.
\r
4003 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
4004 * @param[in] numStages number of filter stages.
\r
4005 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
4006 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
4010 void arm_fir_lattice_init_q31(
\r
4011 arm_fir_lattice_instance_q31 * S,
\r
4012 uint16_t numStages,
\r
4018 * @brief Processing function for the Q31 FIR lattice filter.
\r
4019 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
\r
4020 * @param[in] *pSrc points to the block of input data.
\r
4021 * @param[out] *pDst points to the block of output data
\r
4022 * @param[in] blockSize number of samples to process.
\r
4026 void arm_fir_lattice_q31(
\r
4027 const arm_fir_lattice_instance_q31 * S,
\r
4030 uint32_t blockSize);
\r
4033 * @brief Initialization function for the floating-point FIR lattice filter.
\r
4034 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
4035 * @param[in] numStages number of filter stages.
\r
4036 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
4037 * @param[in] *pState points to the state buffer. The array is of length numStages.
\r
4041 void arm_fir_lattice_init_f32(
\r
4042 arm_fir_lattice_instance_f32 * S,
\r
4043 uint16_t numStages,
\r
4044 float32_t * pCoeffs,
\r
4045 float32_t * pState);
\r
4048 * @brief Processing function for the floating-point FIR lattice filter.
\r
4049 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
\r
4050 * @param[in] *pSrc points to the block of input data.
\r
4051 * @param[out] *pDst points to the block of output data
\r
4052 * @param[in] blockSize number of samples to process.
\r
4056 void arm_fir_lattice_f32(
\r
4057 const arm_fir_lattice_instance_f32 * S,
\r
4060 uint32_t blockSize);
\r
4063 * @brief Instance structure for the Q15 IIR lattice filter.
\r
4067 uint16_t numStages; /**< number of stages in the filter. */
\r
4068 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4069 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4070 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4071 } arm_iir_lattice_instance_q15;
\r
4074 * @brief Instance structure for the Q31 IIR lattice filter.
\r
4078 uint16_t numStages; /**< number of stages in the filter. */
\r
4079 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4080 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4081 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4082 } arm_iir_lattice_instance_q31;
\r
4085 * @brief Instance structure for the floating-point IIR lattice filter.
\r
4089 uint16_t numStages; /**< number of stages in the filter. */
\r
4090 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
4091 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
4092 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
4093 } arm_iir_lattice_instance_f32;
\r
4096 * @brief Processing function for the floating-point IIR lattice filter.
\r
4097 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
4098 * @param[in] *pSrc points to the block of input data.
\r
4099 * @param[out] *pDst points to the block of output data.
\r
4100 * @param[in] blockSize number of samples to process.
\r
4104 void arm_iir_lattice_f32(
\r
4105 const arm_iir_lattice_instance_f32 * S,
\r
4108 uint32_t blockSize);
\r
4111 * @brief Initialization function for the floating-point IIR lattice filter.
\r
4112 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
\r
4113 * @param[in] numStages number of stages in the filter.
\r
4114 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4115 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4116 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
\r
4117 * @param[in] blockSize number of samples to process.
\r
4121 void arm_iir_lattice_init_f32(
\r
4122 arm_iir_lattice_instance_f32 * S,
\r
4123 uint16_t numStages,
\r
4124 float32_t * pkCoeffs,
\r
4125 float32_t * pvCoeffs,
\r
4126 float32_t * pState,
\r
4127 uint32_t blockSize);
\r
4131 * @brief Processing function for the Q31 IIR lattice filter.
\r
4132 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4133 * @param[in] *pSrc points to the block of input data.
\r
4134 * @param[out] *pDst points to the block of output data.
\r
4135 * @param[in] blockSize number of samples to process.
\r
4139 void arm_iir_lattice_q31(
\r
4140 const arm_iir_lattice_instance_q31 * S,
\r
4143 uint32_t blockSize);
\r
4147 * @brief Initialization function for the Q31 IIR lattice filter.
\r
4148 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
\r
4149 * @param[in] numStages number of stages in the filter.
\r
4150 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4151 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4152 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
\r
4153 * @param[in] blockSize number of samples to process.
\r
4157 void arm_iir_lattice_init_q31(
\r
4158 arm_iir_lattice_instance_q31 * S,
\r
4159 uint16_t numStages,
\r
4163 uint32_t blockSize);
\r
4167 * @brief Processing function for the Q15 IIR lattice filter.
\r
4168 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
\r
4169 * @param[in] *pSrc points to the block of input data.
\r
4170 * @param[out] *pDst points to the block of output data.
\r
4171 * @param[in] blockSize number of samples to process.
\r
4175 void arm_iir_lattice_q15(
\r
4176 const arm_iir_lattice_instance_q15 * S,
\r
4179 uint32_t blockSize);
\r
4183 * @brief Initialization function for the Q15 IIR lattice filter.
\r
4184 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
\r
4185 * @param[in] numStages number of stages in the filter.
\r
4186 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
\r
4187 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
\r
4188 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
\r
4189 * @param[in] blockSize number of samples to process per call.
\r
4193 void arm_iir_lattice_init_q15(
\r
4194 arm_iir_lattice_instance_q15 * S,
\r
4195 uint16_t numStages,
\r
4199 uint32_t blockSize);
\r
4202 * @brief Instance structure for the floating-point LMS filter.
\r
4207 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4208 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4209 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4210 float32_t mu; /**< step size that controls filter coefficient updates. */
\r
4211 } arm_lms_instance_f32;
\r
4214 * @brief Processing function for floating-point LMS filter.
\r
4215 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4216 * @param[in] *pSrc points to the block of input data.
\r
4217 * @param[in] *pRef points to the block of reference data.
\r
4218 * @param[out] *pOut points to the block of output data.
\r
4219 * @param[out] *pErr points to the block of error data.
\r
4220 * @param[in] blockSize number of samples to process.
\r
4225 const arm_lms_instance_f32 * S,
\r
4230 uint32_t blockSize);
\r
4233 * @brief Initialization function for floating-point LMS filter.
\r
4234 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4235 * @param[in] numTaps number of filter coefficients.
\r
4236 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4237 * @param[in] *pState points to state buffer.
\r
4238 * @param[in] mu step size that controls filter coefficient updates.
\r
4239 * @param[in] blockSize number of samples to process.
\r
4243 void arm_lms_init_f32(
\r
4244 arm_lms_instance_f32 * S,
\r
4246 float32_t * pCoeffs,
\r
4247 float32_t * pState,
\r
4249 uint32_t blockSize);
\r
4252 * @brief Instance structure for the Q15 LMS filter.
\r
4257 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4258 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4259 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4260 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4261 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4262 } arm_lms_instance_q15;
\r
4266 * @brief Initialization function for the Q15 LMS filter.
\r
4267 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4268 * @param[in] numTaps number of filter coefficients.
\r
4269 * @param[in] *pCoeffs points to the coefficient buffer.
\r
4270 * @param[in] *pState points to the state buffer.
\r
4271 * @param[in] mu step size that controls filter coefficient updates.
\r
4272 * @param[in] blockSize number of samples to process.
\r
4273 * @param[in] postShift bit shift applied to coefficients.
\r
4277 void arm_lms_init_q15(
\r
4278 arm_lms_instance_q15 * S,
\r
4283 uint32_t blockSize,
\r
4284 uint32_t postShift);
\r
4287 * @brief Processing function for Q15 LMS filter.
\r
4288 * @param[in] *S points to an instance of the Q15 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
4298 const arm_lms_instance_q15 * S,
\r
4303 uint32_t blockSize);
\r
4307 * @brief Instance structure for the Q31 LMS filter.
\r
4312 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4313 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4314 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4315 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4316 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4318 } arm_lms_instance_q31;
\r
4321 * @brief Processing function for Q31 LMS filter.
\r
4322 * @param[in] *S points to an instance of the Q15 LMS filter structure.
\r
4323 * @param[in] *pSrc points to the block of input data.
\r
4324 * @param[in] *pRef points to the block of reference data.
\r
4325 * @param[out] *pOut points to the block of output data.
\r
4326 * @param[out] *pErr points to the block of error data.
\r
4327 * @param[in] blockSize number of samples to process.
\r
4332 const arm_lms_instance_q31 * S,
\r
4337 uint32_t blockSize);
\r
4340 * @brief Initialization function for Q31 LMS filter.
\r
4341 * @param[in] *S points to an instance of the Q31 LMS filter structure.
\r
4342 * @param[in] numTaps number of filter coefficients.
\r
4343 * @param[in] *pCoeffs points to coefficient buffer.
\r
4344 * @param[in] *pState points to state buffer.
\r
4345 * @param[in] mu step size that controls filter coefficient updates.
\r
4346 * @param[in] blockSize number of samples to process.
\r
4347 * @param[in] postShift bit shift applied to coefficients.
\r
4351 void arm_lms_init_q31(
\r
4352 arm_lms_instance_q31 * S,
\r
4357 uint32_t blockSize,
\r
4358 uint32_t postShift);
\r
4361 * @brief Instance structure for the floating-point normalized LMS filter.
\r
4366 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4367 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4368 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4369 float32_t mu; /**< step size that control filter coefficient updates. */
\r
4370 float32_t energy; /**< saves previous frame energy. */
\r
4371 float32_t x0; /**< saves previous input sample. */
\r
4372 } arm_lms_norm_instance_f32;
\r
4375 * @brief Processing function for floating-point normalized LMS filter.
\r
4376 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
\r
4377 * @param[in] *pSrc points to the block of input data.
\r
4378 * @param[in] *pRef points to the block of reference data.
\r
4379 * @param[out] *pOut points to the block of output data.
\r
4380 * @param[out] *pErr points to the block of error data.
\r
4381 * @param[in] blockSize number of samples to process.
\r
4385 void arm_lms_norm_f32(
\r
4386 arm_lms_norm_instance_f32 * S,
\r
4391 uint32_t blockSize);
\r
4394 * @brief Initialization function for floating-point normalized LMS filter.
\r
4395 * @param[in] *S points to an instance of the floating-point LMS filter structure.
\r
4396 * @param[in] numTaps number of filter coefficients.
\r
4397 * @param[in] *pCoeffs points to coefficient buffer.
\r
4398 * @param[in] *pState points to state buffer.
\r
4399 * @param[in] mu step size that controls filter coefficient updates.
\r
4400 * @param[in] blockSize number of samples to process.
\r
4404 void arm_lms_norm_init_f32(
\r
4405 arm_lms_norm_instance_f32 * S,
\r
4407 float32_t * pCoeffs,
\r
4408 float32_t * pState,
\r
4410 uint32_t blockSize);
\r
4414 * @brief Instance structure for the Q31 normalized LMS filter.
\r
4418 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4419 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4420 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4421 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4422 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4423 q31_t *recipTable; /**< points to the reciprocal initial value table. */
\r
4424 q31_t energy; /**< saves previous frame energy. */
\r
4425 q31_t x0; /**< saves previous input sample. */
\r
4426 } arm_lms_norm_instance_q31;
\r
4429 * @brief Processing function for Q31 normalized LMS filter.
\r
4430 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4431 * @param[in] *pSrc points to the block of input data.
\r
4432 * @param[in] *pRef points to the block of reference data.
\r
4433 * @param[out] *pOut points to the block of output data.
\r
4434 * @param[out] *pErr points to the block of error data.
\r
4435 * @param[in] blockSize number of samples to process.
\r
4439 void arm_lms_norm_q31(
\r
4440 arm_lms_norm_instance_q31 * S,
\r
4445 uint32_t blockSize);
\r
4448 * @brief Initialization function for Q31 normalized LMS filter.
\r
4449 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
\r
4450 * @param[in] numTaps number of filter coefficients.
\r
4451 * @param[in] *pCoeffs points to coefficient buffer.
\r
4452 * @param[in] *pState points to state buffer.
\r
4453 * @param[in] mu step size that controls filter coefficient updates.
\r
4454 * @param[in] blockSize number of samples to process.
\r
4455 * @param[in] postShift bit shift applied to coefficients.
\r
4459 void arm_lms_norm_init_q31(
\r
4460 arm_lms_norm_instance_q31 * S,
\r
4465 uint32_t blockSize,
\r
4466 uint8_t postShift);
\r
4469 * @brief Instance structure for the Q15 normalized LMS filter.
\r
4474 uint16_t numTaps; /**< Number of coefficients in the filter. */
\r
4475 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4476 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4477 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4478 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4479 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
\r
4480 q15_t energy; /**< saves previous frame energy. */
\r
4481 q15_t x0; /**< saves previous input sample. */
\r
4482 } arm_lms_norm_instance_q15;
\r
4485 * @brief Processing function for Q15 normalized LMS filter.
\r
4486 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4487 * @param[in] *pSrc points to the block of input data.
\r
4488 * @param[in] *pRef points to the block of reference data.
\r
4489 * @param[out] *pOut points to the block of output data.
\r
4490 * @param[out] *pErr points to the block of error data.
\r
4491 * @param[in] blockSize number of samples to process.
\r
4495 void arm_lms_norm_q15(
\r
4496 arm_lms_norm_instance_q15 * S,
\r
4501 uint32_t blockSize);
\r
4505 * @brief Initialization function for Q15 normalized LMS filter.
\r
4506 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
\r
4507 * @param[in] numTaps number of filter coefficients.
\r
4508 * @param[in] *pCoeffs points to coefficient buffer.
\r
4509 * @param[in] *pState points to state buffer.
\r
4510 * @param[in] mu step size that controls filter coefficient updates.
\r
4511 * @param[in] blockSize number of samples to process.
\r
4512 * @param[in] postShift bit shift applied to coefficients.
\r
4516 void arm_lms_norm_init_q15(
\r
4517 arm_lms_norm_instance_q15 * S,
\r
4522 uint32_t blockSize,
\r
4523 uint8_t postShift);
\r
4526 * @brief Correlation of floating-point sequences.
\r
4527 * @param[in] *pSrcA points to the first input sequence.
\r
4528 * @param[in] srcALen length of the first input sequence.
\r
4529 * @param[in] *pSrcB points to the second input sequence.
\r
4530 * @param[in] srcBLen length of the second input sequence.
\r
4531 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4535 void arm_correlate_f32(
\r
4536 float32_t * pSrcA,
\r
4538 float32_t * pSrcB,
\r
4540 float32_t * pDst);
\r
4544 * @brief Correlation of Q15 sequences
\r
4545 * @param[in] *pSrcA points to the first input sequence.
\r
4546 * @param[in] srcALen length of the first input sequence.
\r
4547 * @param[in] *pSrcB points to the second input sequence.
\r
4548 * @param[in] srcBLen length of the second input sequence.
\r
4549 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4550 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4553 void arm_correlate_opt_q15(
\r
4559 q15_t * pScratch);
\r
4563 * @brief Correlation of Q15 sequences.
\r
4564 * @param[in] *pSrcA points to the first input sequence.
\r
4565 * @param[in] srcALen length of the first input sequence.
\r
4566 * @param[in] *pSrcB points to the second input sequence.
\r
4567 * @param[in] srcBLen length of the second input sequence.
\r
4568 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4572 void arm_correlate_q15(
\r
4580 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4581 * @param[in] *pSrcA points to the first input sequence.
\r
4582 * @param[in] srcALen length of the first input sequence.
\r
4583 * @param[in] *pSrcB points to the second input sequence.
\r
4584 * @param[in] srcBLen length of the second input sequence.
\r
4585 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4589 void arm_correlate_fast_q15(
\r
4599 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4600 * @param[in] *pSrcA points to the first input sequence.
\r
4601 * @param[in] srcALen length of the first input sequence.
\r
4602 * @param[in] *pSrcB points to the second input sequence.
\r
4603 * @param[in] srcBLen length of the second input sequence.
\r
4604 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4605 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4609 void arm_correlate_fast_opt_q15(
\r
4615 q15_t * pScratch);
\r
4618 * @brief Correlation of Q31 sequences.
\r
4619 * @param[in] *pSrcA points to the first input sequence.
\r
4620 * @param[in] srcALen length of the first input sequence.
\r
4621 * @param[in] *pSrcB points to the second input sequence.
\r
4622 * @param[in] srcBLen length of the second input sequence.
\r
4623 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4627 void arm_correlate_q31(
\r
4635 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
4636 * @param[in] *pSrcA points to the first input sequence.
\r
4637 * @param[in] srcALen length of the first input sequence.
\r
4638 * @param[in] *pSrcB points to the second input sequence.
\r
4639 * @param[in] srcBLen length of the second input sequence.
\r
4640 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4644 void arm_correlate_fast_q31(
\r
4654 * @brief Correlation of Q7 sequences.
\r
4655 * @param[in] *pSrcA points to the first input sequence.
\r
4656 * @param[in] srcALen length of the first input sequence.
\r
4657 * @param[in] *pSrcB points to the second input sequence.
\r
4658 * @param[in] srcBLen length of the second input sequence.
\r
4659 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4660 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4661 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
4665 void arm_correlate_opt_q7(
\r
4671 q15_t * pScratch1,
\r
4672 q15_t * pScratch2);
\r
4676 * @brief Correlation of Q7 sequences.
\r
4677 * @param[in] *pSrcA points to the first input sequence.
\r
4678 * @param[in] srcALen length of the first input sequence.
\r
4679 * @param[in] *pSrcB points to the second input sequence.
\r
4680 * @param[in] srcBLen length of the second input sequence.
\r
4681 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4685 void arm_correlate_q7(
\r
4694 * @brief Instance structure for the floating-point sparse FIR filter.
\r
4698 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4699 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4700 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4701 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4702 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4703 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4704 } arm_fir_sparse_instance_f32;
\r
4707 * @brief Instance structure for the Q31 sparse FIR filter.
\r
4712 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4713 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4714 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4715 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4716 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4717 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4718 } arm_fir_sparse_instance_q31;
\r
4721 * @brief Instance structure for the Q15 sparse FIR filter.
\r
4726 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4727 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4728 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4729 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4730 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4731 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4732 } arm_fir_sparse_instance_q15;
\r
4735 * @brief Instance structure for the Q7 sparse FIR filter.
\r
4740 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4741 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4742 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4743 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4744 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4745 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4746 } arm_fir_sparse_instance_q7;
\r
4749 * @brief Processing function for the floating-point sparse FIR filter.
\r
4750 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
\r
4751 * @param[in] *pSrc points to the block of input data.
\r
4752 * @param[out] *pDst points to the block of output data
\r
4753 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4754 * @param[in] blockSize number of input samples to process per call.
\r
4758 void arm_fir_sparse_f32(
\r
4759 arm_fir_sparse_instance_f32 * S,
\r
4762 float32_t * pScratchIn,
\r
4763 uint32_t blockSize);
\r
4766 * @brief Initialization function for the floating-point sparse FIR filter.
\r
4767 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
\r
4768 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4769 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4770 * @param[in] *pState points to the state buffer.
\r
4771 * @param[in] *pTapDelay points to the array of offset times.
\r
4772 * @param[in] maxDelay maximum offset time supported.
\r
4773 * @param[in] blockSize number of samples that will be processed per block.
\r
4777 void arm_fir_sparse_init_f32(
\r
4778 arm_fir_sparse_instance_f32 * S,
\r
4780 float32_t * pCoeffs,
\r
4781 float32_t * pState,
\r
4782 int32_t * pTapDelay,
\r
4783 uint16_t maxDelay,
\r
4784 uint32_t blockSize);
\r
4787 * @brief Processing function for the Q31 sparse FIR filter.
\r
4788 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
\r
4789 * @param[in] *pSrc points to the block of input data.
\r
4790 * @param[out] *pDst points to the block of output data
\r
4791 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4792 * @param[in] blockSize number of input samples to process per call.
\r
4796 void arm_fir_sparse_q31(
\r
4797 arm_fir_sparse_instance_q31 * S,
\r
4800 q31_t * pScratchIn,
\r
4801 uint32_t blockSize);
\r
4804 * @brief Initialization function for the Q31 sparse FIR filter.
\r
4805 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
\r
4806 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4807 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4808 * @param[in] *pState points to the state buffer.
\r
4809 * @param[in] *pTapDelay points to the array of offset times.
\r
4810 * @param[in] maxDelay maximum offset time supported.
\r
4811 * @param[in] blockSize number of samples that will be processed per block.
\r
4815 void arm_fir_sparse_init_q31(
\r
4816 arm_fir_sparse_instance_q31 * S,
\r
4820 int32_t * pTapDelay,
\r
4821 uint16_t maxDelay,
\r
4822 uint32_t blockSize);
\r
4825 * @brief Processing function for the Q15 sparse FIR filter.
\r
4826 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
\r
4827 * @param[in] *pSrc points to the block of input data.
\r
4828 * @param[out] *pDst points to the block of output data
\r
4829 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4830 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4831 * @param[in] blockSize number of input samples to process per call.
\r
4835 void arm_fir_sparse_q15(
\r
4836 arm_fir_sparse_instance_q15 * S,
\r
4839 q15_t * pScratchIn,
\r
4840 q31_t * pScratchOut,
\r
4841 uint32_t blockSize);
\r
4845 * @brief Initialization function for the Q15 sparse FIR filter.
\r
4846 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
\r
4847 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4848 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4849 * @param[in] *pState points to the state buffer.
\r
4850 * @param[in] *pTapDelay points to the array of offset times.
\r
4851 * @param[in] maxDelay maximum offset time supported.
\r
4852 * @param[in] blockSize number of samples that will be processed per block.
\r
4856 void arm_fir_sparse_init_q15(
\r
4857 arm_fir_sparse_instance_q15 * S,
\r
4861 int32_t * pTapDelay,
\r
4862 uint16_t maxDelay,
\r
4863 uint32_t blockSize);
\r
4866 * @brief Processing function for the Q7 sparse FIR filter.
\r
4867 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
\r
4868 * @param[in] *pSrc points to the block of input data.
\r
4869 * @param[out] *pDst points to the block of output data
\r
4870 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
\r
4871 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
\r
4872 * @param[in] blockSize number of input samples to process per call.
\r
4876 void arm_fir_sparse_q7(
\r
4877 arm_fir_sparse_instance_q7 * S,
\r
4880 q7_t * pScratchIn,
\r
4881 q31_t * pScratchOut,
\r
4882 uint32_t blockSize);
\r
4885 * @brief Initialization function for the Q7 sparse FIR filter.
\r
4886 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
\r
4887 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4888 * @param[in] *pCoeffs points to the array of filter coefficients.
\r
4889 * @param[in] *pState points to the state buffer.
\r
4890 * @param[in] *pTapDelay points to the array of offset times.
\r
4891 * @param[in] maxDelay maximum offset time supported.
\r
4892 * @param[in] blockSize number of samples that will be processed per block.
\r
4896 void arm_fir_sparse_init_q7(
\r
4897 arm_fir_sparse_instance_q7 * S,
\r
4901 int32_t * pTapDelay,
\r
4902 uint16_t maxDelay,
\r
4903 uint32_t blockSize);
\r
4907 * @brief Floating-point sin_cos function.
\r
4908 * @param[in] theta input value in degrees
\r
4909 * @param[out] *pSinVal points to the processed sine output.
\r
4910 * @param[out] *pCosVal points to the processed cos output.
\r
4914 void arm_sin_cos_f32(
\r
4916 float32_t * pSinVal,
\r
4917 float32_t * pCcosVal);
\r
4920 * @brief Q31 sin_cos function.
\r
4921 * @param[in] theta scaled input value in degrees
\r
4922 * @param[out] *pSinVal points to the processed sine output.
\r
4923 * @param[out] *pCosVal points to the processed cosine output.
\r
4927 void arm_sin_cos_q31(
\r
4934 * @brief Floating-point complex conjugate.
\r
4935 * @param[in] *pSrc points to the input vector
\r
4936 * @param[out] *pDst points to the output vector
\r
4937 * @param[in] numSamples number of complex samples in each vector
\r
4941 void arm_cmplx_conj_f32(
\r
4944 uint32_t numSamples);
\r
4947 * @brief Q31 complex conjugate.
\r
4948 * @param[in] *pSrc points to the input vector
\r
4949 * @param[out] *pDst points to the output vector
\r
4950 * @param[in] numSamples number of complex samples in each vector
\r
4954 void arm_cmplx_conj_q31(
\r
4957 uint32_t numSamples);
\r
4960 * @brief Q15 complex conjugate.
\r
4961 * @param[in] *pSrc points to the input vector
\r
4962 * @param[out] *pDst points to the output vector
\r
4963 * @param[in] numSamples number of complex samples in each vector
\r
4967 void arm_cmplx_conj_q15(
\r
4970 uint32_t numSamples);
\r
4975 * @brief Floating-point complex magnitude squared
\r
4976 * @param[in] *pSrc points to the complex input vector
\r
4977 * @param[out] *pDst points to the real output vector
\r
4978 * @param[in] numSamples number of complex samples in the input vector
\r
4982 void arm_cmplx_mag_squared_f32(
\r
4985 uint32_t numSamples);
\r
4988 * @brief Q31 complex magnitude squared
\r
4989 * @param[in] *pSrc points to the complex input vector
\r
4990 * @param[out] *pDst points to the real output vector
\r
4991 * @param[in] numSamples number of complex samples in the input vector
\r
4995 void arm_cmplx_mag_squared_q31(
\r
4998 uint32_t numSamples);
\r
5001 * @brief Q15 complex magnitude squared
\r
5002 * @param[in] *pSrc points to the complex input vector
\r
5003 * @param[out] *pDst points to the real output vector
\r
5004 * @param[in] numSamples number of complex samples in the input vector
\r
5008 void arm_cmplx_mag_squared_q15(
\r
5011 uint32_t numSamples);
\r
5015 * @ingroup groupController
\r
5019 * @defgroup PID PID Motor Control
\r
5021 * A Proportional Integral Derivative (PID) controller is a generic feedback control
\r
5022 * loop mechanism widely used in industrial control systems.
\r
5023 * A PID controller is the most commonly used type of feedback controller.
\r
5025 * This set of functions implements (PID) controllers
\r
5026 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
\r
5027 * of data and each call to the function returns a single processed value.
\r
5028 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
\r
5029 * is the input sample value. The functions return the output value.
\r
5033 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
\r
5034 * A0 = Kp + Ki + Kd
\r
5035 * A1 = (-Kp ) - (2 * Kd )
\r
5039 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
\r
5042 * \image html PID.gif "Proportional Integral Derivative Controller"
\r
5045 * The PID controller calculates an "error" value as the difference between
\r
5046 * the measured output and the reference input.
\r
5047 * The controller attempts to minimize the error by adjusting the process control inputs.
\r
5048 * The proportional value determines the reaction to the current error,
\r
5049 * the integral value determines the reaction based on the sum of recent errors,
\r
5050 * and the derivative value determines the reaction based on the rate at which the error has been changing.
\r
5052 * \par Instance Structure
\r
5053 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
\r
5054 * A separate instance structure must be defined for each PID Controller.
\r
5055 * There are separate instance structure declarations for each of the 3 supported data types.
\r
5057 * \par Reset Functions
\r
5058 * There is also an associated reset function for each data type which clears the state array.
\r
5060 * \par Initialization Functions
\r
5061 * There is also an associated initialization function for each data type.
\r
5062 * The initialization function performs the following operations:
\r
5063 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
\r
5064 * - Zeros out the values in the state buffer.
\r
5067 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
\r
5069 * \par Fixed-Point Behavior
\r
5070 * Care must be taken when using the fixed-point versions of the PID Controller functions.
\r
5071 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
\r
5072 * Refer to the function specific documentation below for usage guidelines.
\r
5081 * @brief Process function for the floating-point PID Control.
\r
5082 * @param[in,out] *S is an instance of the floating-point PID Control structure
\r
5083 * @param[in] in input sample to process
\r
5084 * @return out processed output sample.
\r
5088 static __INLINE float32_t arm_pid_f32(
\r
5089 arm_pid_instance_f32 * S,
\r
5094 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
\r
5095 out = (S->A0 * in) +
\r
5096 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
\r
5098 /* Update state */
\r
5099 S->state[1] = S->state[0];
\r
5101 S->state[2] = out;
\r
5103 /* return to application */
\r
5109 * @brief Process function for the Q31 PID Control.
\r
5110 * @param[in,out] *S points to an instance of the Q31 PID Control structure
\r
5111 * @param[in] in input sample to process
\r
5112 * @return out processed output sample.
\r
5114 * <b>Scaling and Overflow Behavior:</b>
\r
5116 * The function is implemented using an internal 64-bit accumulator.
\r
5117 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
\r
5118 * Thus, if the accumulator result overflows it wraps around rather than clip.
\r
5119 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
\r
5120 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
\r
5123 static __INLINE q31_t arm_pid_q31(
\r
5124 arm_pid_instance_q31 * S,
\r
5130 /* acc = A0 * x[n] */
\r
5131 acc = (q63_t) S->A0 * in;
\r
5133 /* acc += A1 * x[n-1] */
\r
5134 acc += (q63_t) S->A1 * S->state[0];
\r
5136 /* acc += A2 * x[n-2] */
\r
5137 acc += (q63_t) S->A2 * S->state[1];
\r
5139 /* convert output to 1.31 format to add y[n-1] */
\r
5140 out = (q31_t) (acc >> 31u);
\r
5142 /* out += y[n-1] */
\r
5143 out += S->state[2];
\r
5145 /* Update state */
\r
5146 S->state[1] = S->state[0];
\r
5148 S->state[2] = out;
\r
5150 /* return to application */
\r
5156 * @brief Process function for the Q15 PID Control.
\r
5157 * @param[in,out] *S points to an instance of the Q15 PID Control structure
\r
5158 * @param[in] in input sample to process
\r
5159 * @return out processed output sample.
\r
5161 * <b>Scaling and Overflow Behavior:</b>
\r
5163 * The function is implemented using a 64-bit internal accumulator.
\r
5164 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
\r
5165 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
\r
5166 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
\r
5167 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
\r
5168 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
\r
5171 static __INLINE q15_t arm_pid_q15(
\r
5172 arm_pid_instance_q15 * S,
\r
5178 #ifndef ARM_MATH_CM0_FAMILY
\r
5179 __SIMD32_TYPE *vstate;
\r
5181 /* Implementation of PID controller */
\r
5183 /* acc = A0 * x[n] */
\r
5184 acc = (q31_t) __SMUAD(S->A0, in);
\r
5186 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5187 vstate = __SIMD32_CONST(S->state);
\r
5188 acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
\r
5191 /* acc = A0 * x[n] */
\r
5192 acc = ((q31_t) S->A0) * in;
\r
5194 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
5195 acc += (q31_t) S->A1 * S->state[0];
\r
5196 acc += (q31_t) S->A2 * S->state[1];
\r
5200 /* acc += y[n-1] */
\r
5201 acc += (q31_t) S->state[2] << 15;
\r
5203 /* saturate the output */
\r
5204 out = (q15_t) (__SSAT((acc >> 15), 16));
\r
5206 /* Update state */
\r
5207 S->state[1] = S->state[0];
\r
5209 S->state[2] = out;
\r
5211 /* return to application */
\r
5217 * @} end of PID group
\r
5222 * @brief Floating-point matrix inverse.
\r
5223 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5224 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5225 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5226 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5229 arm_status arm_mat_inverse_f32(
\r
5230 const arm_matrix_instance_f32 * src,
\r
5231 arm_matrix_instance_f32 * dst);
\r
5235 * @brief Floating-point matrix inverse.
\r
5236 * @param[in] *src points to the instance of the input floating-point matrix structure.
\r
5237 * @param[out] *dst points to the instance of the output floating-point matrix structure.
\r
5238 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5239 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5242 arm_status arm_mat_inverse_f64(
\r
5243 const arm_matrix_instance_f64 * src,
\r
5244 arm_matrix_instance_f64 * dst);
\r
5249 * @ingroup groupController
\r
5254 * @defgroup clarke Vector Clarke Transform
\r
5255 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
\r
5256 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
\r
5257 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
\r
5258 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
\r
5259 * \image html clarke.gif Stator current space vector and its components in (a,b).
\r
5260 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
\r
5261 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
\r
5263 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5264 * The library provides separate functions for Q31 and floating-point data types.
\r
5266 * \image html clarkeFormula.gif
\r
5267 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
\r
5268 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
\r
5269 * \par Fixed-Point Behavior
\r
5270 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5271 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5272 * Refer to the function specific documentation below for usage guidelines.
\r
5276 * @addtogroup clarke
\r
5282 * @brief Floating-point Clarke transform
\r
5283 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5284 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5285 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5286 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5290 static __INLINE void arm_clarke_f32(
\r
5293 float32_t * pIalpha,
\r
5294 float32_t * pIbeta)
\r
5296 /* Calculate pIalpha using the equation, pIalpha = Ia */
\r
5299 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
\r
5301 ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
\r
5306 * @brief Clarke transform for Q31 version
\r
5307 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5308 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5309 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5310 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5313 * <b>Scaling and Overflow Behavior:</b>
\r
5315 * The function is implemented using an internal 32-bit accumulator.
\r
5316 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5317 * There is saturation on the addition, hence there is no risk of overflow.
\r
5320 static __INLINE void arm_clarke_q31(
\r
5326 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5328 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
\r
5331 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
\r
5332 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
\r
5334 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
\r
5335 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
\r
5337 /* pIbeta is calculated by adding the intermediate products */
\r
5338 *pIbeta = __QADD(product1, product2);
\r
5342 * @} end of clarke group
\r
5346 * @brief Converts the elements of the Q7 vector to Q31 vector.
\r
5347 * @param[in] *pSrc input pointer
\r
5348 * @param[out] *pDst output pointer
\r
5349 * @param[in] blockSize number of samples to process
\r
5352 void arm_q7_to_q31(
\r
5355 uint32_t blockSize);
\r
5361 * @ingroup groupController
\r
5365 * @defgroup inv_clarke Vector Inverse Clarke Transform
\r
5366 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
\r
5368 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5369 * The library provides separate functions for Q31 and floating-point data types.
\r
5371 * \image html clarkeInvFormula.gif
\r
5372 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
\r
5373 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
\r
5374 * \par Fixed-Point Behavior
\r
5375 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5376 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5377 * Refer to the function specific documentation below for usage guidelines.
\r
5381 * @addtogroup inv_clarke
\r
5386 * @brief Floating-point Inverse Clarke transform
\r
5387 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5388 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5389 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5390 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5395 static __INLINE void arm_inv_clarke_f32(
\r
5401 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5404 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
\r
5405 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
\r
5410 * @brief Inverse Clarke transform for Q31 version
\r
5411 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5412 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5413 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
\r
5414 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
\r
5417 * <b>Scaling and Overflow Behavior:</b>
\r
5419 * The function is implemented using an internal 32-bit accumulator.
\r
5420 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5421 * There is saturation on the subtraction, hence there is no risk of overflow.
\r
5424 static __INLINE void arm_inv_clarke_q31(
\r
5430 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5432 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5435 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
\r
5436 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
\r
5438 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
\r
5439 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
\r
5441 /* pIb is calculated by subtracting the products */
\r
5442 *pIb = __QSUB(product2, product1);
\r
5447 * @} end of inv_clarke group
\r
5451 * @brief Converts the elements of the Q7 vector to Q15 vector.
\r
5452 * @param[in] *pSrc input pointer
\r
5453 * @param[out] *pDst output pointer
\r
5454 * @param[in] blockSize number of samples to process
\r
5457 void arm_q7_to_q15(
\r
5460 uint32_t blockSize);
\r
5465 * @ingroup groupController
\r
5469 * @defgroup park Vector Park Transform
\r
5471 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
\r
5472 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
\r
5473 * from the stationary to the moving reference frame and control the spatial relationship between
\r
5474 * the stator vector current and rotor flux vector.
\r
5475 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
\r
5476 * current vector and the relationship from the two reference frames:
\r
5477 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
\r
5479 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5480 * The library provides separate functions for Q31 and floating-point data types.
\r
5482 * \image html parkFormula.gif
\r
5483 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
\r
5484 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5485 * cosine and sine values of theta (rotor flux position).
\r
5486 * \par Fixed-Point Behavior
\r
5487 * Care must be taken when using the Q31 version of the Park transform.
\r
5488 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5489 * Refer to the function specific documentation below for usage guidelines.
\r
5493 * @addtogroup park
\r
5498 * @brief Floating-point Park transform
\r
5499 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5500 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5501 * @param[out] *pId points to output rotor reference frame d
\r
5502 * @param[out] *pIq points to output rotor reference frame q
\r
5503 * @param[in] sinVal sine value of rotation angle theta
\r
5504 * @param[in] cosVal cosine value of rotation angle theta
\r
5507 * The function implements the forward Park transform.
\r
5511 static __INLINE void arm_park_f32(
\r
5519 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
\r
5520 *pId = Ialpha * cosVal + Ibeta * sinVal;
\r
5522 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
\r
5523 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
\r
5528 * @brief Park transform for Q31 version
\r
5529 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5530 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5531 * @param[out] *pId points to output rotor reference frame d
\r
5532 * @param[out] *pIq points to output rotor reference frame q
\r
5533 * @param[in] sinVal sine value of rotation angle theta
\r
5534 * @param[in] cosVal cosine value of rotation angle theta
\r
5537 * <b>Scaling and Overflow Behavior:</b>
\r
5539 * The function is implemented using an internal 32-bit accumulator.
\r
5540 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5541 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
\r
5545 static __INLINE void arm_park_q31(
\r
5553 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5554 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5556 /* Intermediate product is calculated by (Ialpha * cosVal) */
\r
5557 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
\r
5559 /* Intermediate product is calculated by (Ibeta * sinVal) */
\r
5560 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
\r
5563 /* Intermediate product is calculated by (Ialpha * sinVal) */
\r
5564 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
\r
5566 /* Intermediate product is calculated by (Ibeta * cosVal) */
\r
5567 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
\r
5569 /* Calculate pId by adding the two intermediate products 1 and 2 */
\r
5570 *pId = __QADD(product1, product2);
\r
5572 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
\r
5573 *pIq = __QSUB(product4, product3);
\r
5577 * @} end of park group
\r
5581 * @brief Converts the elements of the Q7 vector to floating-point vector.
\r
5582 * @param[in] *pSrc is input pointer
\r
5583 * @param[out] *pDst is output pointer
\r
5584 * @param[in] blockSize is the number of samples to process
\r
5587 void arm_q7_to_float(
\r
5590 uint32_t blockSize);
\r
5594 * @ingroup groupController
\r
5598 * @defgroup inv_park Vector Inverse Park transform
\r
5599 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
\r
5601 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5602 * The library provides separate functions for Q31 and floating-point data types.
\r
5604 * \image html parkInvFormula.gif
\r
5605 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
\r
5606 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5607 * cosine and sine values of theta (rotor flux position).
\r
5608 * \par Fixed-Point Behavior
\r
5609 * Care must be taken when using the Q31 version of the Park transform.
\r
5610 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5611 * Refer to the function specific documentation below for usage guidelines.
\r
5615 * @addtogroup inv_park
\r
5620 * @brief Floating-point Inverse Park transform
\r
5621 * @param[in] Id input coordinate of rotor reference frame d
\r
5622 * @param[in] Iq input coordinate of rotor reference frame q
\r
5623 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5624 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5625 * @param[in] sinVal sine value of rotation angle theta
\r
5626 * @param[in] cosVal cosine value of rotation angle theta
\r
5630 static __INLINE void arm_inv_park_f32(
\r
5633 float32_t * pIalpha,
\r
5634 float32_t * pIbeta,
\r
5638 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
\r
5639 *pIalpha = Id * cosVal - Iq * sinVal;
\r
5641 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
\r
5642 *pIbeta = Id * sinVal + Iq * cosVal;
\r
5648 * @brief Inverse Park transform for Q31 version
\r
5649 * @param[in] Id input coordinate of rotor reference frame d
\r
5650 * @param[in] Iq input coordinate of rotor reference frame q
\r
5651 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
\r
5652 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
\r
5653 * @param[in] sinVal sine value of rotation angle theta
\r
5654 * @param[in] cosVal cosine value of rotation angle theta
\r
5657 * <b>Scaling and Overflow Behavior:</b>
\r
5659 * The function is implemented using an internal 32-bit accumulator.
\r
5660 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5661 * There is saturation on the addition, hence there is no risk of overflow.
\r
5665 static __INLINE void arm_inv_park_q31(
\r
5673 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5674 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5676 /* Intermediate product is calculated by (Id * cosVal) */
\r
5677 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
\r
5679 /* Intermediate product is calculated by (Iq * sinVal) */
\r
5680 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
\r
5683 /* Intermediate product is calculated by (Id * sinVal) */
\r
5684 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
\r
5686 /* Intermediate product is calculated by (Iq * cosVal) */
\r
5687 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
\r
5689 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
\r
5690 *pIalpha = __QSUB(product1, product2);
\r
5692 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
\r
5693 *pIbeta = __QADD(product4, product3);
\r
5698 * @} end of Inverse park group
\r
5703 * @brief Converts the elements of the Q31 vector to floating-point vector.
\r
5704 * @param[in] *pSrc is input pointer
\r
5705 * @param[out] *pDst is output pointer
\r
5706 * @param[in] blockSize is the number of samples to process
\r
5709 void arm_q31_to_float(
\r
5712 uint32_t blockSize);
\r
5715 * @ingroup groupInterpolation
\r
5719 * @defgroup LinearInterpolate Linear Interpolation
\r
5721 * Linear interpolation is a method of curve fitting using linear polynomials.
\r
5722 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
\r
5725 * \image html LinearInterp.gif "Linear interpolation"
\r
5728 * A Linear Interpolate function calculates an output value(y), for the input(x)
\r
5729 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
\r
5733 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
\r
5734 * where x0, x1 are nearest values of input x
\r
5735 * y0, y1 are nearest values to output y
\r
5739 * This set of functions implements Linear interpolation process
\r
5740 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
\r
5741 * sample of data and each call to the function returns a single processed value.
\r
5742 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
\r
5743 * <code>x</code> is the input sample value. The functions returns the output value.
\r
5746 * if x is outside of the table boundary, Linear interpolation returns first value of the table
\r
5747 * if x is below input range and returns last value of table if x is above range.
\r
5751 * @addtogroup LinearInterpolate
\r
5756 * @brief Process function for the floating-point Linear Interpolation Function.
\r
5757 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
\r
5758 * @param[in] x input sample to process
\r
5759 * @return y processed output sample.
\r
5763 static __INLINE float32_t arm_linear_interp_f32(
\r
5764 arm_linear_interp_instance_f32 * S,
\r
5769 float32_t x0, x1; /* Nearest input values */
\r
5770 float32_t y0, y1; /* Nearest output values */
\r
5771 float32_t xSpacing = S->xSpacing; /* spacing between input values */
\r
5772 int32_t i; /* Index variable */
\r
5773 float32_t *pYData = S->pYData; /* pointer to output table */
\r
5775 /* Calculation of index */
\r
5776 i = (int32_t) ((x - S->x1) / xSpacing);
\r
5780 /* Iniatilize output for below specified range as least output value of table */
\r
5783 else if((uint32_t)i >= S->nValues)
\r
5785 /* Iniatilize output for above specified range as last output value of table */
\r
5786 y = pYData[S->nValues - 1];
\r
5790 /* Calculation of nearest input values */
\r
5791 x0 = S->x1 + i * xSpacing;
\r
5792 x1 = S->x1 + (i + 1) * xSpacing;
\r
5794 /* Read of nearest output values */
\r
5796 y1 = pYData[i + 1];
\r
5798 /* Calculation of output */
\r
5799 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
\r
5803 /* returns output value */
\r
5809 * @brief Process function for the Q31 Linear Interpolation Function.
\r
5810 * @param[in] *pYData pointer to Q31 Linear Interpolation table
\r
5811 * @param[in] x input sample to process
\r
5812 * @param[in] nValues number of table values
\r
5813 * @return y processed output sample.
\r
5816 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5817 * This function can support maximum of table size 2^12.
\r
5822 static __INLINE q31_t arm_linear_interp_q31(
\r
5827 q31_t y; /* output */
\r
5828 q31_t y0, y1; /* Nearest output values */
\r
5829 q31_t fract; /* fractional part */
\r
5830 int32_t index; /* Index to read nearest output values */
\r
5832 /* Input is in 12.20 format */
\r
5833 /* 12 bits for the table index */
\r
5834 /* Index value calculation */
\r
5835 index = ((x & 0xFFF00000) >> 20);
\r
5837 if(index >= (int32_t)(nValues - 1))
\r
5839 return (pYData[nValues - 1]);
\r
5841 else if(index < 0)
\r
5843 return (pYData[0]);
\r
5848 /* 20 bits for the fractional part */
\r
5849 /* shift left by 11 to keep fract in 1.31 format */
\r
5850 fract = (x & 0x000FFFFF) << 11;
\r
5852 /* Read two nearest output values from the index in 1.31(q31) format */
\r
5853 y0 = pYData[index];
\r
5854 y1 = pYData[index + 1u];
\r
5856 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
\r
5857 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
\r
5859 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
\r
5860 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
\r
5862 /* Convert y to 1.31 format */
\r
5871 * @brief Process function for the Q15 Linear Interpolation Function.
\r
5872 * @param[in] *pYData pointer to Q15 Linear Interpolation table
\r
5873 * @param[in] x input sample to process
\r
5874 * @param[in] nValues number of table values
\r
5875 * @return y processed output sample.
\r
5878 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5879 * This function can support maximum of table size 2^12.
\r
5884 static __INLINE q15_t arm_linear_interp_q15(
\r
5889 q63_t y; /* output */
\r
5890 q15_t y0, y1; /* Nearest output values */
\r
5891 q31_t fract; /* fractional part */
\r
5892 int32_t index; /* Index to read nearest output values */
\r
5894 /* Input is in 12.20 format */
\r
5895 /* 12 bits for the table index */
\r
5896 /* Index value calculation */
\r
5897 index = ((x & 0xFFF00000) >> 20u);
\r
5899 if(index >= (int32_t)(nValues - 1))
\r
5901 return (pYData[nValues - 1]);
\r
5903 else if(index < 0)
\r
5905 return (pYData[0]);
\r
5909 /* 20 bits for the fractional part */
\r
5910 /* fract is in 12.20 format */
\r
5911 fract = (x & 0x000FFFFF);
\r
5913 /* Read two nearest output values from the index */
\r
5914 y0 = pYData[index];
\r
5915 y1 = pYData[index + 1u];
\r
5917 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
\r
5918 y = ((q63_t) y0 * (0xFFFFF - fract));
\r
5920 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
\r
5921 y += ((q63_t) y1 * (fract));
\r
5923 /* convert y to 1.15 format */
\r
5932 * @brief Process function for the Q7 Linear Interpolation Function.
\r
5933 * @param[in] *pYData pointer to Q7 Linear Interpolation table
\r
5934 * @param[in] x input sample to process
\r
5935 * @param[in] nValues number of table values
\r
5936 * @return y processed output sample.
\r
5939 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5940 * This function can support maximum of table size 2^12.
\r
5944 static __INLINE q7_t arm_linear_interp_q7(
\r
5949 q31_t y; /* output */
\r
5950 q7_t y0, y1; /* Nearest output values */
\r
5951 q31_t fract; /* fractional part */
\r
5952 uint32_t index; /* Index to read nearest output values */
\r
5954 /* Input is in 12.20 format */
\r
5955 /* 12 bits for the table index */
\r
5956 /* Index value calculation */
\r
5959 return (pYData[0]);
\r
5961 index = (x >> 20) & 0xfff;
\r
5964 if(index >= (nValues - 1))
\r
5966 return (pYData[nValues - 1]);
\r
5971 /* 20 bits for the fractional part */
\r
5972 /* fract is in 12.20 format */
\r
5973 fract = (x & 0x000FFFFF);
\r
5975 /* Read two nearest output values from the index and are in 1.7(q7) format */
\r
5976 y0 = pYData[index];
\r
5977 y1 = pYData[index + 1u];
\r
5979 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
\r
5980 y = ((y0 * (0xFFFFF - fract)));
\r
5982 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
\r
5983 y += (y1 * fract);
\r
5985 /* convert y to 1.7(q7) format */
\r
5986 return (y >> 20u);
\r
5992 * @} end of LinearInterpolate group
\r
5996 * @brief Fast approximation to the trigonometric sine function for floating-point data.
\r
5997 * @param[in] x input value in radians.
\r
6001 float32_t arm_sin_f32(
\r
6005 * @brief Fast approximation to the trigonometric sine function for Q31 data.
\r
6006 * @param[in] x Scaled input value in radians.
\r
6010 q31_t arm_sin_q31(
\r
6014 * @brief Fast approximation to the trigonometric sine function for Q15 data.
\r
6015 * @param[in] x Scaled input value in radians.
\r
6019 q15_t arm_sin_q15(
\r
6023 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
\r
6024 * @param[in] x input value in radians.
\r
6028 float32_t arm_cos_f32(
\r
6032 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
\r
6033 * @param[in] x Scaled input value in radians.
\r
6037 q31_t arm_cos_q31(
\r
6041 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
\r
6042 * @param[in] x Scaled input value in radians.
\r
6046 q15_t arm_cos_q15(
\r
6051 * @ingroup groupFastMath
\r
6056 * @defgroup SQRT Square Root
\r
6058 * Computes the square root of a number.
\r
6059 * There are separate functions for Q15, Q31, and floating-point data types.
\r
6060 * The square root function is computed using the Newton-Raphson algorithm.
\r
6061 * This is an iterative algorithm of the form:
\r
6063 * x1 = x0 - f(x0)/f'(x0)
\r
6065 * where <code>x1</code> is the current estimate,
\r
6066 * <code>x0</code> is the previous estimate, and
\r
6067 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
\r
6068 * For the square root function, the algorithm reduces to:
\r
6070 * x0 = in/2 [initial guess]
\r
6071 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
\r
6077 * @addtogroup SQRT
\r
6082 * @brief Floating-point square root function.
\r
6083 * @param[in] in input value.
\r
6084 * @param[out] *pOut square root of input value.
\r
6085 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6086 * <code>in</code> is negative value and returns zero output for negative values.
\r
6089 static __INLINE arm_status arm_sqrt_f32(
\r
6097 #if (__FPU_USED == 1) && defined ( __CC_ARM )
\r
6098 *pOut = __sqrtf(in);
\r
6100 *pOut = sqrtf(in);
\r
6103 return (ARM_MATH_SUCCESS);
\r
6108 return (ARM_MATH_ARGUMENT_ERROR);
\r
6115 * @brief Q31 square root function.
\r
6116 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
\r
6117 * @param[out] *pOut square root of input value.
\r
6118 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6119 * <code>in</code> is negative value and returns zero output for negative values.
\r
6121 arm_status arm_sqrt_q31(
\r
6126 * @brief Q15 square root function.
\r
6127 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
\r
6128 * @param[out] *pOut square root of input value.
\r
6129 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
6130 * <code>in</code> is negative value and returns zero output for negative values.
\r
6132 arm_status arm_sqrt_q15(
\r
6137 * @} end of SQRT group
\r
6146 * @brief floating-point Circular write function.
\r
6149 static __INLINE void arm_circularWrite_f32(
\r
6150 int32_t * circBuffer,
\r
6152 uint16_t * writeOffset,
\r
6153 int32_t bufferInc,
\r
6154 const int32_t * src,
\r
6156 uint32_t blockSize)
\r
6161 /* Copy the value of Index pointer that points
\r
6162 * to the current location where the input samples to be copied */
\r
6163 wOffset = *writeOffset;
\r
6165 /* Loop over the blockSize */
\r
6170 /* copy the input sample to the circular buffer */
\r
6171 circBuffer[wOffset] = *src;
\r
6173 /* Update the input pointer */
\r
6176 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6177 wOffset += bufferInc;
\r
6181 /* Decrement the loop counter */
\r
6185 /* Update the index pointer */
\r
6186 *writeOffset = wOffset;
\r
6192 * @brief floating-point Circular Read function.
\r
6194 static __INLINE void arm_circularRead_f32(
\r
6195 int32_t * circBuffer,
\r
6197 int32_t * readOffset,
\r
6198 int32_t bufferInc,
\r
6200 int32_t * dst_base,
\r
6201 int32_t dst_length,
\r
6203 uint32_t blockSize)
\r
6206 int32_t rOffset, dst_end;
\r
6208 /* Copy the value of Index pointer that points
\r
6209 * to the current location from where the input samples to be read */
\r
6210 rOffset = *readOffset;
\r
6211 dst_end = (int32_t) (dst_base + dst_length);
\r
6213 /* Loop over the blockSize */
\r
6218 /* copy the sample from the circular buffer to the destination buffer */
\r
6219 *dst = circBuffer[rOffset];
\r
6221 /* Update the input pointer */
\r
6224 if(dst == (int32_t *) dst_end)
\r
6229 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6230 rOffset += bufferInc;
\r
6237 /* Decrement the loop counter */
\r
6241 /* Update the index pointer */
\r
6242 *readOffset = rOffset;
\r
6246 * @brief Q15 Circular write function.
\r
6249 static __INLINE void arm_circularWrite_q15(
\r
6250 q15_t * circBuffer,
\r
6252 uint16_t * writeOffset,
\r
6253 int32_t bufferInc,
\r
6254 const q15_t * src,
\r
6256 uint32_t blockSize)
\r
6261 /* Copy the value of Index pointer that points
\r
6262 * to the current location where the input samples to be copied */
\r
6263 wOffset = *writeOffset;
\r
6265 /* Loop over the blockSize */
\r
6270 /* copy the input sample to the circular buffer */
\r
6271 circBuffer[wOffset] = *src;
\r
6273 /* Update the input pointer */
\r
6276 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6277 wOffset += bufferInc;
\r
6281 /* Decrement the loop counter */
\r
6285 /* Update the index pointer */
\r
6286 *writeOffset = wOffset;
\r
6292 * @brief Q15 Circular Read function.
\r
6294 static __INLINE void arm_circularRead_q15(
\r
6295 q15_t * circBuffer,
\r
6297 int32_t * readOffset,
\r
6298 int32_t bufferInc,
\r
6301 int32_t dst_length,
\r
6303 uint32_t blockSize)
\r
6306 int32_t rOffset, dst_end;
\r
6308 /* Copy the value of Index pointer that points
\r
6309 * to the current location from where the input samples to be read */
\r
6310 rOffset = *readOffset;
\r
6312 dst_end = (int32_t) (dst_base + dst_length);
\r
6314 /* Loop over the blockSize */
\r
6319 /* copy the sample from the circular buffer to the destination buffer */
\r
6320 *dst = circBuffer[rOffset];
\r
6322 /* Update the input pointer */
\r
6325 if(dst == (q15_t *) dst_end)
\r
6330 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6331 rOffset += bufferInc;
\r
6338 /* Decrement the loop counter */
\r
6342 /* Update the index pointer */
\r
6343 *readOffset = rOffset;
\r
6348 * @brief Q7 Circular write function.
\r
6351 static __INLINE void arm_circularWrite_q7(
\r
6352 q7_t * circBuffer,
\r
6354 uint16_t * writeOffset,
\r
6355 int32_t bufferInc,
\r
6358 uint32_t blockSize)
\r
6363 /* Copy the value of Index pointer that points
\r
6364 * to the current location where the input samples to be copied */
\r
6365 wOffset = *writeOffset;
\r
6367 /* Loop over the blockSize */
\r
6372 /* copy the input sample to the circular buffer */
\r
6373 circBuffer[wOffset] = *src;
\r
6375 /* Update the input pointer */
\r
6378 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6379 wOffset += bufferInc;
\r
6383 /* Decrement the loop counter */
\r
6387 /* Update the index pointer */
\r
6388 *writeOffset = wOffset;
\r
6394 * @brief Q7 Circular Read function.
\r
6396 static __INLINE void arm_circularRead_q7(
\r
6397 q7_t * circBuffer,
\r
6399 int32_t * readOffset,
\r
6400 int32_t bufferInc,
\r
6403 int32_t dst_length,
\r
6405 uint32_t blockSize)
\r
6408 int32_t rOffset, dst_end;
\r
6410 /* Copy the value of Index pointer that points
\r
6411 * to the current location from where the input samples to be read */
\r
6412 rOffset = *readOffset;
\r
6414 dst_end = (int32_t) (dst_base + dst_length);
\r
6416 /* Loop over the blockSize */
\r
6421 /* copy the sample from the circular buffer to the destination buffer */
\r
6422 *dst = circBuffer[rOffset];
\r
6424 /* Update the input pointer */
\r
6427 if(dst == (q7_t *) dst_end)
\r
6432 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6433 rOffset += bufferInc;
\r
6440 /* Decrement the loop counter */
\r
6444 /* Update the index pointer */
\r
6445 *readOffset = rOffset;
\r
6450 * @brief Sum of the squares of the elements of a Q31 vector.
\r
6451 * @param[in] *pSrc is input pointer
\r
6452 * @param[in] blockSize is the number of samples to process
\r
6453 * @param[out] *pResult is output value.
\r
6457 void arm_power_q31(
\r
6459 uint32_t blockSize,
\r
6463 * @brief Sum of the squares of the elements of a floating-point vector.
\r
6464 * @param[in] *pSrc is input pointer
\r
6465 * @param[in] blockSize is the number of samples to process
\r
6466 * @param[out] *pResult is output value.
\r
6470 void arm_power_f32(
\r
6472 uint32_t blockSize,
\r
6473 float32_t * pResult);
\r
6476 * @brief Sum of the squares of the elements of a Q15 vector.
\r
6477 * @param[in] *pSrc is input pointer
\r
6478 * @param[in] blockSize is the number of samples to process
\r
6479 * @param[out] *pResult is output value.
\r
6483 void arm_power_q15(
\r
6485 uint32_t blockSize,
\r
6489 * @brief Sum of the squares of the elements of a Q7 vector.
\r
6490 * @param[in] *pSrc is input pointer
\r
6491 * @param[in] blockSize is the number of samples to process
\r
6492 * @param[out] *pResult is output value.
\r
6496 void arm_power_q7(
\r
6498 uint32_t blockSize,
\r
6502 * @brief Mean value of a Q7 vector.
\r
6503 * @param[in] *pSrc is input pointer
\r
6504 * @param[in] blockSize is the number of samples to process
\r
6505 * @param[out] *pResult is output value.
\r
6511 uint32_t blockSize,
\r
6515 * @brief Mean value of a Q15 vector.
\r
6516 * @param[in] *pSrc is input pointer
\r
6517 * @param[in] blockSize is the number of samples to process
\r
6518 * @param[out] *pResult is output value.
\r
6521 void arm_mean_q15(
\r
6523 uint32_t blockSize,
\r
6527 * @brief Mean value of a Q31 vector.
\r
6528 * @param[in] *pSrc is input pointer
\r
6529 * @param[in] blockSize is the number of samples to process
\r
6530 * @param[out] *pResult is output value.
\r
6533 void arm_mean_q31(
\r
6535 uint32_t blockSize,
\r
6539 * @brief Mean value of a floating-point vector.
\r
6540 * @param[in] *pSrc is input pointer
\r
6541 * @param[in] blockSize is the number of samples to process
\r
6542 * @param[out] *pResult is output value.
\r
6545 void arm_mean_f32(
\r
6547 uint32_t blockSize,
\r
6548 float32_t * pResult);
\r
6551 * @brief Variance of the elements of a floating-point vector.
\r
6552 * @param[in] *pSrc is input pointer
\r
6553 * @param[in] blockSize is the number of samples to process
\r
6554 * @param[out] *pResult is output value.
\r
6560 uint32_t blockSize,
\r
6561 float32_t * pResult);
\r
6564 * @brief Variance of the elements of a Q31 vector.
\r
6565 * @param[in] *pSrc is input pointer
\r
6566 * @param[in] blockSize is the number of samples to process
\r
6567 * @param[out] *pResult is output value.
\r
6573 uint32_t blockSize,
\r
6577 * @brief Variance of the elements of a Q15 vector.
\r
6578 * @param[in] *pSrc is input pointer
\r
6579 * @param[in] blockSize is the number of samples to process
\r
6580 * @param[out] *pResult is output value.
\r
6586 uint32_t blockSize,
\r
6590 * @brief Root Mean Square of the elements of a floating-point vector.
\r
6591 * @param[in] *pSrc is input pointer
\r
6592 * @param[in] blockSize is the number of samples to process
\r
6593 * @param[out] *pResult is output value.
\r
6599 uint32_t blockSize,
\r
6600 float32_t * pResult);
\r
6603 * @brief Root Mean Square of the elements of a Q31 vector.
\r
6604 * @param[in] *pSrc is input pointer
\r
6605 * @param[in] blockSize is the number of samples to process
\r
6606 * @param[out] *pResult is output value.
\r
6612 uint32_t blockSize,
\r
6616 * @brief Root Mean Square of the elements of a Q15 vector.
\r
6617 * @param[in] *pSrc is input pointer
\r
6618 * @param[in] blockSize is the number of samples to process
\r
6619 * @param[out] *pResult is output value.
\r
6625 uint32_t blockSize,
\r
6629 * @brief Standard deviation of the elements of a floating-point vector.
\r
6630 * @param[in] *pSrc is input pointer
\r
6631 * @param[in] blockSize is the number of samples to process
\r
6632 * @param[out] *pResult is output value.
\r
6638 uint32_t blockSize,
\r
6639 float32_t * pResult);
\r
6642 * @brief Standard deviation of the elements of a Q31 vector.
\r
6643 * @param[in] *pSrc is input pointer
\r
6644 * @param[in] blockSize is the number of samples to process
\r
6645 * @param[out] *pResult is output value.
\r
6651 uint32_t blockSize,
\r
6655 * @brief Standard deviation of the elements of a Q15 vector.
\r
6656 * @param[in] *pSrc is input pointer
\r
6657 * @param[in] blockSize is the number of samples to process
\r
6658 * @param[out] *pResult is output value.
\r
6664 uint32_t blockSize,
\r
6668 * @brief Floating-point complex magnitude
\r
6669 * @param[in] *pSrc points to the complex input vector
\r
6670 * @param[out] *pDst points to the real output vector
\r
6671 * @param[in] numSamples number of complex samples in the input vector
\r
6675 void arm_cmplx_mag_f32(
\r
6678 uint32_t numSamples);
\r
6681 * @brief Q31 complex magnitude
\r
6682 * @param[in] *pSrc points to the complex input vector
\r
6683 * @param[out] *pDst points to the real output vector
\r
6684 * @param[in] numSamples number of complex samples in the input vector
\r
6688 void arm_cmplx_mag_q31(
\r
6691 uint32_t numSamples);
\r
6694 * @brief Q15 complex magnitude
\r
6695 * @param[in] *pSrc points to the complex input vector
\r
6696 * @param[out] *pDst points to the real output vector
\r
6697 * @param[in] numSamples number of complex samples in the input vector
\r
6701 void arm_cmplx_mag_q15(
\r
6704 uint32_t numSamples);
\r
6707 * @brief Q15 complex dot product
\r
6708 * @param[in] *pSrcA points to the first input vector
\r
6709 * @param[in] *pSrcB points to the second input vector
\r
6710 * @param[in] numSamples number of complex samples in each vector
\r
6711 * @param[out] *realResult real part of the result returned here
\r
6712 * @param[out] *imagResult imaginary part of the result returned here
\r
6716 void arm_cmplx_dot_prod_q15(
\r
6719 uint32_t numSamples,
\r
6720 q31_t * realResult,
\r
6721 q31_t * imagResult);
\r
6724 * @brief Q31 complex dot product
\r
6725 * @param[in] *pSrcA points to the first input vector
\r
6726 * @param[in] *pSrcB points to the second input vector
\r
6727 * @param[in] numSamples number of complex samples in each vector
\r
6728 * @param[out] *realResult real part of the result returned here
\r
6729 * @param[out] *imagResult imaginary part of the result returned here
\r
6733 void arm_cmplx_dot_prod_q31(
\r
6736 uint32_t numSamples,
\r
6737 q63_t * realResult,
\r
6738 q63_t * imagResult);
\r
6741 * @brief Floating-point complex dot product
\r
6742 * @param[in] *pSrcA points to the first input vector
\r
6743 * @param[in] *pSrcB points to the second input vector
\r
6744 * @param[in] numSamples number of complex samples in each vector
\r
6745 * @param[out] *realResult real part of the result returned here
\r
6746 * @param[out] *imagResult imaginary part of the result returned here
\r
6750 void arm_cmplx_dot_prod_f32(
\r
6751 float32_t * pSrcA,
\r
6752 float32_t * pSrcB,
\r
6753 uint32_t numSamples,
\r
6754 float32_t * realResult,
\r
6755 float32_t * imagResult);
\r
6758 * @brief Q15 complex-by-real multiplication
\r
6759 * @param[in] *pSrcCmplx points to the complex input vector
\r
6760 * @param[in] *pSrcReal points to the real input vector
\r
6761 * @param[out] *pCmplxDst points to the complex output vector
\r
6762 * @param[in] numSamples number of samples in each vector
\r
6766 void arm_cmplx_mult_real_q15(
\r
6767 q15_t * pSrcCmplx,
\r
6769 q15_t * pCmplxDst,
\r
6770 uint32_t numSamples);
\r
6773 * @brief Q31 complex-by-real multiplication
\r
6774 * @param[in] *pSrcCmplx points to the complex input vector
\r
6775 * @param[in] *pSrcReal points to the real input vector
\r
6776 * @param[out] *pCmplxDst points to the complex output vector
\r
6777 * @param[in] numSamples number of samples in each vector
\r
6781 void arm_cmplx_mult_real_q31(
\r
6782 q31_t * pSrcCmplx,
\r
6784 q31_t * pCmplxDst,
\r
6785 uint32_t numSamples);
\r
6788 * @brief Floating-point complex-by-real multiplication
\r
6789 * @param[in] *pSrcCmplx points to the complex input vector
\r
6790 * @param[in] *pSrcReal points to the real input vector
\r
6791 * @param[out] *pCmplxDst points to the complex output vector
\r
6792 * @param[in] numSamples number of samples in each vector
\r
6796 void arm_cmplx_mult_real_f32(
\r
6797 float32_t * pSrcCmplx,
\r
6798 float32_t * pSrcReal,
\r
6799 float32_t * pCmplxDst,
\r
6800 uint32_t numSamples);
\r
6803 * @brief Minimum value of a Q7 vector.
\r
6804 * @param[in] *pSrc is input pointer
\r
6805 * @param[in] blockSize is the number of samples to process
\r
6806 * @param[out] *result is output pointer
\r
6807 * @param[in] index is the array index of the minimum value in the input buffer.
\r
6813 uint32_t blockSize,
\r
6815 uint32_t * index);
\r
6818 * @brief Minimum value of a Q15 vector.
\r
6819 * @param[in] *pSrc is input pointer
\r
6820 * @param[in] blockSize is the number of samples to process
\r
6821 * @param[out] *pResult is output pointer
\r
6822 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
\r
6828 uint32_t blockSize,
\r
6830 uint32_t * pIndex);
\r
6833 * @brief Minimum value of a Q31 vector.
\r
6834 * @param[in] *pSrc is input pointer
\r
6835 * @param[in] blockSize is the number of samples to process
\r
6836 * @param[out] *pResult is output pointer
\r
6837 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6842 uint32_t blockSize,
\r
6844 uint32_t * pIndex);
\r
6847 * @brief Minimum value of a floating-point vector.
\r
6848 * @param[in] *pSrc is input pointer
\r
6849 * @param[in] blockSize is the number of samples to process
\r
6850 * @param[out] *pResult is output pointer
\r
6851 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
\r
6857 uint32_t blockSize,
\r
6858 float32_t * pResult,
\r
6859 uint32_t * pIndex);
\r
6862 * @brief Maximum value of a Q7 vector.
\r
6863 * @param[in] *pSrc points to the input buffer
\r
6864 * @param[in] blockSize length of the input vector
\r
6865 * @param[out] *pResult maximum value returned here
\r
6866 * @param[out] *pIndex index of maximum value returned here
\r
6872 uint32_t blockSize,
\r
6874 uint32_t * pIndex);
\r
6877 * @brief Maximum value of a Q15 vector.
\r
6878 * @param[in] *pSrc points to the input buffer
\r
6879 * @param[in] blockSize length of the input vector
\r
6880 * @param[out] *pResult maximum value returned here
\r
6881 * @param[out] *pIndex index of maximum value returned here
\r
6887 uint32_t blockSize,
\r
6889 uint32_t * pIndex);
\r
6892 * @brief Maximum value of a Q31 vector.
\r
6893 * @param[in] *pSrc points to the input buffer
\r
6894 * @param[in] blockSize length of the input vector
\r
6895 * @param[out] *pResult maximum value returned here
\r
6896 * @param[out] *pIndex index of maximum value returned here
\r
6902 uint32_t blockSize,
\r
6904 uint32_t * pIndex);
\r
6907 * @brief Maximum value of a floating-point vector.
\r
6908 * @param[in] *pSrc points to the input buffer
\r
6909 * @param[in] blockSize length of the input vector
\r
6910 * @param[out] *pResult maximum value returned here
\r
6911 * @param[out] *pIndex index of maximum value returned here
\r
6917 uint32_t blockSize,
\r
6918 float32_t * pResult,
\r
6919 uint32_t * pIndex);
\r
6922 * @brief Q15 complex-by-complex multiplication
\r
6923 * @param[in] *pSrcA points to the first input vector
\r
6924 * @param[in] *pSrcB points to the second input vector
\r
6925 * @param[out] *pDst points to the output vector
\r
6926 * @param[in] numSamples number of complex samples in each vector
\r
6930 void arm_cmplx_mult_cmplx_q15(
\r
6934 uint32_t numSamples);
\r
6937 * @brief Q31 complex-by-complex multiplication
\r
6938 * @param[in] *pSrcA points to the first input vector
\r
6939 * @param[in] *pSrcB points to the second input vector
\r
6940 * @param[out] *pDst points to the output vector
\r
6941 * @param[in] numSamples number of complex samples in each vector
\r
6945 void arm_cmplx_mult_cmplx_q31(
\r
6949 uint32_t numSamples);
\r
6952 * @brief Floating-point complex-by-complex multiplication
\r
6953 * @param[in] *pSrcA points to the first input vector
\r
6954 * @param[in] *pSrcB points to the second input vector
\r
6955 * @param[out] *pDst points to the output vector
\r
6956 * @param[in] numSamples number of complex samples in each vector
\r
6960 void arm_cmplx_mult_cmplx_f32(
\r
6961 float32_t * pSrcA,
\r
6962 float32_t * pSrcB,
\r
6964 uint32_t numSamples);
\r
6967 * @brief Converts the elements of the floating-point vector to Q31 vector.
\r
6968 * @param[in] *pSrc points to the floating-point input vector
\r
6969 * @param[out] *pDst points to the Q31 output vector
\r
6970 * @param[in] blockSize length of the input vector
\r
6973 void arm_float_to_q31(
\r
6976 uint32_t blockSize);
\r
6979 * @brief Converts the elements of the floating-point vector to Q15 vector.
\r
6980 * @param[in] *pSrc points to the floating-point input vector
\r
6981 * @param[out] *pDst points to the Q15 output vector
\r
6982 * @param[in] blockSize length of the input vector
\r
6985 void arm_float_to_q15(
\r
6988 uint32_t blockSize);
\r
6991 * @brief Converts the elements of the floating-point vector to Q7 vector.
\r
6992 * @param[in] *pSrc points to the floating-point input vector
\r
6993 * @param[out] *pDst points to the Q7 output vector
\r
6994 * @param[in] blockSize length of the input vector
\r
6997 void arm_float_to_q7(
\r
7000 uint32_t blockSize);
\r
7004 * @brief Converts the elements of the Q31 vector to Q15 vector.
\r
7005 * @param[in] *pSrc is input pointer
\r
7006 * @param[out] *pDst is output pointer
\r
7007 * @param[in] blockSize is the number of samples to process
\r
7010 void arm_q31_to_q15(
\r
7013 uint32_t blockSize);
\r
7016 * @brief Converts the elements of the Q31 vector to Q7 vector.
\r
7017 * @param[in] *pSrc is input pointer
\r
7018 * @param[out] *pDst is output pointer
\r
7019 * @param[in] blockSize is the number of samples to process
\r
7022 void arm_q31_to_q7(
\r
7025 uint32_t blockSize);
\r
7028 * @brief Converts the elements of the Q15 vector to floating-point vector.
\r
7029 * @param[in] *pSrc is input pointer
\r
7030 * @param[out] *pDst is output pointer
\r
7031 * @param[in] blockSize is the number of samples to process
\r
7034 void arm_q15_to_float(
\r
7037 uint32_t blockSize);
\r
7041 * @brief Converts the elements of the Q15 vector to Q31 vector.
\r
7042 * @param[in] *pSrc is input pointer
\r
7043 * @param[out] *pDst is output pointer
\r
7044 * @param[in] blockSize is the number of samples to process
\r
7047 void arm_q15_to_q31(
\r
7050 uint32_t blockSize);
\r
7054 * @brief Converts the elements of the Q15 vector to Q7 vector.
\r
7055 * @param[in] *pSrc is input pointer
\r
7056 * @param[out] *pDst is output pointer
\r
7057 * @param[in] blockSize is the number of samples to process
\r
7060 void arm_q15_to_q7(
\r
7063 uint32_t blockSize);
\r
7067 * @ingroup groupInterpolation
\r
7071 * @defgroup BilinearInterpolate Bilinear Interpolation
\r
7073 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
\r
7074 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
\r
7075 * determines values between the grid points.
\r
7076 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
\r
7077 * Bilinear interpolation is often used in image processing to rescale images.
\r
7078 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
\r
7080 * <b>Algorithm</b>
\r
7082 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
\r
7083 * For floating-point, the instance structure is defined as:
\r
7087 * uint16_t numRows;
\r
7088 * uint16_t numCols;
\r
7089 * float32_t *pData;
\r
7090 * } arm_bilinear_interp_instance_f32;
\r
7094 * where <code>numRows</code> specifies the number of rows in the table;
\r
7095 * <code>numCols</code> specifies the number of columns in the table;
\r
7096 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
\r
7097 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
\r
7098 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
\r
7101 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
\r
7107 * The interpolated output point is computed as:
\r
7109 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
\r
7110 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
\r
7111 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
\r
7112 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
\r
7114 * Note that the coordinates (x, y) contain integer and fractional components.
\r
7115 * The integer components specify which portion of the table to use while the
\r
7116 * fractional components control the interpolation processor.
\r
7119 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
\r
7123 * @addtogroup BilinearInterpolate
\r
7129 * @brief Floating-point bilinear interpolation.
\r
7130 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7131 * @param[in] X interpolation coordinate.
\r
7132 * @param[in] Y interpolation coordinate.
\r
7133 * @return out interpolated value.
\r
7137 static __INLINE float32_t arm_bilinear_interp_f32(
\r
7138 const arm_bilinear_interp_instance_f32 * S,
\r
7143 float32_t f00, f01, f10, f11;
\r
7144 float32_t *pData = S->pData;
\r
7145 int32_t xIndex, yIndex, index;
\r
7146 float32_t xdiff, ydiff;
\r
7147 float32_t b1, b2, b3, b4;
\r
7149 xIndex = (int32_t) X;
\r
7150 yIndex = (int32_t) Y;
\r
7152 /* Care taken for table outside boundary */
\r
7153 /* Returns zero output when values are outside table boundary */
\r
7154 if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
\r
7155 || yIndex > (S->numCols - 1))
\r
7160 /* Calculation of index for two nearest points in X-direction */
\r
7161 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
\r
7164 /* Read two nearest points in X-direction */
\r
7165 f00 = pData[index];
\r
7166 f01 = pData[index + 1];
\r
7168 /* Calculation of index for two nearest points in Y-direction */
\r
7169 index = (xIndex - 1) + (yIndex) * S->numCols;
\r
7172 /* Read two nearest points in Y-direction */
\r
7173 f10 = pData[index];
\r
7174 f11 = pData[index + 1];
\r
7176 /* Calculation of intermediate values */
\r
7180 b4 = f00 - f01 - f10 + f11;
\r
7182 /* Calculation of fractional part in X */
\r
7183 xdiff = X - xIndex;
\r
7185 /* Calculation of fractional part in Y */
\r
7186 ydiff = Y - yIndex;
\r
7188 /* Calculation of bi-linear interpolated output */
\r
7189 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
\r
7191 /* return to application */
\r
7198 * @brief Q31 bilinear interpolation.
\r
7199 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7200 * @param[in] X interpolation coordinate in 12.20 format.
\r
7201 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7202 * @return out interpolated value.
\r
7205 static __INLINE q31_t arm_bilinear_interp_q31(
\r
7206 arm_bilinear_interp_instance_q31 * S,
\r
7210 q31_t out; /* Temporary output */
\r
7211 q31_t acc = 0; /* output */
\r
7212 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7213 q31_t x1, x2, y1, y2; /* Nearest output values */
\r
7214 int32_t rI, cI; /* Row and column indices */
\r
7215 q31_t *pYData = S->pData; /* pointer to output table values */
\r
7216 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) >> 20u);
\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) >> 20u);
\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 /* shift left xfract by 11 to keep 1.31 format */
\r
7238 xfract = (X & 0x000FFFFF) << 11u;
\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
7244 /* 20 bits for the fractional part */
\r
7245 /* shift left yfract by 11 to keep 1.31 format */
\r
7246 yfract = (Y & 0x000FFFFF) << 11u;
\r
7248 /* Read two nearest output values from the index */
\r
7249 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7250 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7252 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
\r
7253 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
\r
7254 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
\r
7256 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
\r
7257 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
\r
7258 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
\r
7260 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7261 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
\r
7262 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7264 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
7265 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
\r
7266 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
7268 /* Convert acc to 1.31(q31) format */
\r
7269 return (acc << 2u);
\r
7274 * @brief Q15 bilinear interpolation.
\r
7275 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7276 * @param[in] X interpolation coordinate in 12.20 format.
\r
7277 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7278 * @return out interpolated value.
\r
7281 static __INLINE q15_t arm_bilinear_interp_q15(
\r
7282 arm_bilinear_interp_instance_q15 * S,
\r
7286 q63_t acc = 0; /* output */
\r
7287 q31_t out; /* Temporary output */
\r
7288 q15_t x1, x2, y1, y2; /* Nearest output values */
\r
7289 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7290 int32_t rI, cI; /* Row and column indices */
\r
7291 q15_t *pYData = S->pData; /* pointer to output table values */
\r
7292 uint32_t nCols = S->numCols; /* num of rows */
\r
7294 /* Input is in 12.20 format */
\r
7295 /* 12 bits for the table index */
\r
7296 /* Index value calculation */
\r
7297 rI = ((X & 0xFFF00000) >> 20);
\r
7299 /* Input is in 12.20 format */
\r
7300 /* 12 bits for the table index */
\r
7301 /* Index value calculation */
\r
7302 cI = ((Y & 0xFFF00000) >> 20);
\r
7304 /* Care taken for table outside boundary */
\r
7305 /* Returns zero output when values are outside table boundary */
\r
7306 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7311 /* 20 bits for the fractional part */
\r
7312 /* xfract should be in 12.20 format */
\r
7313 xfract = (X & 0x000FFFFF);
\r
7315 /* Read two nearest output values from the index */
\r
7316 x1 = pYData[(rI) + nCols * (cI)];
\r
7317 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7320 /* 20 bits for the fractional part */
\r
7321 /* yfract should be in 12.20 format */
\r
7322 yfract = (Y & 0x000FFFFF);
\r
7324 /* Read two nearest output values from the index */
\r
7325 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7326 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7328 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
\r
7330 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
\r
7331 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
\r
7332 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
\r
7333 acc = ((q63_t) out * (0xFFFFF - yfract));
\r
7335 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
\r
7336 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
\r
7337 acc += ((q63_t) out * (xfract));
\r
7339 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
\r
7340 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
\r
7341 acc += ((q63_t) out * (yfract));
\r
7343 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
\r
7344 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
\r
7345 acc += ((q63_t) out * (yfract));
\r
7347 /* acc is in 13.51 format and down shift acc by 36 times */
\r
7348 /* Convert out to 1.15 format */
\r
7349 return (acc >> 36);
\r
7354 * @brief Q7 bilinear interpolation.
\r
7355 * @param[in,out] *S points to an instance of the interpolation structure.
\r
7356 * @param[in] X interpolation coordinate in 12.20 format.
\r
7357 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7358 * @return out interpolated value.
\r
7361 static __INLINE q7_t arm_bilinear_interp_q7(
\r
7362 arm_bilinear_interp_instance_q7 * S,
\r
7366 q63_t acc = 0; /* output */
\r
7367 q31_t out; /* Temporary output */
\r
7368 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7369 q7_t x1, x2, y1, y2; /* Nearest output values */
\r
7370 int32_t rI, cI; /* Row and column indices */
\r
7371 q7_t *pYData = S->pData; /* pointer to output table values */
\r
7372 uint32_t nCols = S->numCols; /* num of rows */
\r
7374 /* Input is in 12.20 format */
\r
7375 /* 12 bits for the table index */
\r
7376 /* Index value calculation */
\r
7377 rI = ((X & 0xFFF00000) >> 20);
\r
7379 /* Input is in 12.20 format */
\r
7380 /* 12 bits for the table index */
\r
7381 /* Index value calculation */
\r
7382 cI = ((Y & 0xFFF00000) >> 20);
\r
7384 /* Care taken for table outside boundary */
\r
7385 /* Returns zero output when values are outside table boundary */
\r
7386 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7391 /* 20 bits for the fractional part */
\r
7392 /* xfract should be in 12.20 format */
\r
7393 xfract = (X & 0x000FFFFF);
\r
7395 /* Read two nearest output values from the index */
\r
7396 x1 = pYData[(rI) + nCols * (cI)];
\r
7397 x2 = pYData[(rI) + nCols * (cI) + 1u];
\r
7400 /* 20 bits for the fractional part */
\r
7401 /* yfract should be in 12.20 format */
\r
7402 yfract = (Y & 0x000FFFFF);
\r
7404 /* Read two nearest output values from the index */
\r
7405 y1 = pYData[(rI) + nCols * (cI + 1)];
\r
7406 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
\r
7408 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
\r
7409 out = ((x1 * (0xFFFFF - xfract)));
\r
7410 acc = (((q63_t) out * (0xFFFFF - yfract)));
\r
7412 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
\r
7413 out = ((x2 * (0xFFFFF - yfract)));
\r
7414 acc += (((q63_t) out * (xfract)));
\r
7416 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
\r
7417 out = ((y1 * (0xFFFFF - xfract)));
\r
7418 acc += (((q63_t) out * (yfract)));
\r
7420 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
\r
7421 out = ((y2 * (yfract)));
\r
7422 acc += (((q63_t) out * (xfract)));
\r
7424 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
\r
7425 return (acc >> 40);
\r
7430 * @} end of BilinearInterpolate group
\r
7435 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7436 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7439 #define multSub_32x32_keep32_R(a, x, y) \
\r
7440 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7443 #define mult_32x32_keep32_R(a, x, y) \
\r
7444 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
\r
7447 #define multAcc_32x32_keep32(a, x, y) \
\r
7448 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7451 #define multSub_32x32_keep32(a, x, y) \
\r
7452 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7455 #define mult_32x32_keep32(a, x, y) \
\r
7456 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7459 #if defined ( __CC_ARM ) //Keil
\r
7461 //Enter low optimization region - place directly above function definition
\r
7462 #ifdef ARM_MATH_CM4
\r
7463 #define LOW_OPTIMIZATION_ENTER \
\r
7464 _Pragma ("push") \
\r
7467 #define LOW_OPTIMIZATION_ENTER
\r
7470 //Exit low optimization region - place directly after end of function definition
\r
7471 #ifdef ARM_MATH_CM4
\r
7472 #define LOW_OPTIMIZATION_EXIT \
\r
7475 #define LOW_OPTIMIZATION_EXIT
\r
7478 //Enter low optimization region - place directly above function definition
\r
7479 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7481 //Exit low optimization region - place directly after end of function definition
\r
7482 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7484 #elif defined(__ICCARM__) //IAR
\r
7486 //Enter low optimization region - place directly above function definition
\r
7487 #ifdef ARM_MATH_CM4
\r
7488 #define LOW_OPTIMIZATION_ENTER \
\r
7489 _Pragma ("optimize=low")
\r
7491 #define LOW_OPTIMIZATION_ENTER
\r
7494 //Exit low optimization region - place directly after end of function definition
\r
7495 #define LOW_OPTIMIZATION_EXIT
\r
7497 //Enter low optimization region - place directly above function definition
\r
7498 #ifdef ARM_MATH_CM4
\r
7499 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
\r
7500 _Pragma ("optimize=low")
\r
7502 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7505 //Exit low optimization region - place directly after end of function definition
\r
7506 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7508 #elif defined(__GNUC__)
\r
7510 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
\r
7512 #define LOW_OPTIMIZATION_EXIT
\r
7514 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7516 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7518 #elif defined(__CSMC__) // Cosmic
\r
7520 #define LOW_OPTIMIZATION_ENTER
\r
7521 #define LOW_OPTIMIZATION_EXIT
\r
7522 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7523 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7528 #ifdef __cplusplus
\r
7533 #endif /* _ARM_MATH_H */
\r