1 /******************************************************************************
\r
3 * @brief Public header file for CMSIS DSP LibraryU
\r
5 * @date 10. January 2018
\r
6 ******************************************************************************/
\r
8 * Copyright (c) 2010-2018 Arm Limited or its affiliates. All rights reserved.
\r
10 * SPDX-License-Identifier: Apache-2.0
\r
12 * Licensed under the Apache License, Version 2.0 (the License); you may
\r
13 * not use this file except in compliance with the License.
\r
14 * You may obtain a copy of the License at
\r
16 * www.apache.org/licenses/LICENSE-2.0
\r
18 * Unless required by applicable law or agreed to in writing, software
\r
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
\r
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
21 * See the License for the specific language governing permissions and
\r
22 * limitations under the License.
\r
26 \mainpage CMSIS DSP Software Library
\r
31 * This user manual describes the CMSIS DSP software library,
\r
32 * a suite of common signal processing functions for use on Cortex-M processor based devices.
\r
34 * The library is divided into a number of functions each covering a specific category:
\r
35 * - Basic math functions
\r
36 * - Fast math functions
\r
37 * - Complex math functions
\r
39 * - Matrix functions
\r
41 * - Motor control functions
\r
42 * - Statistical functions
\r
43 * - Support functions
\r
44 * - Interpolation functions
\r
46 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
\r
47 * 32-bit integer and 32-bit floating-point values.
\r
52 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
\r
53 * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
\r
54 * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
\r
55 * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
\r
56 * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
\r
57 * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
\r
58 * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
\r
59 * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
\r
60 * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
\r
61 * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
\r
62 * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
\r
63 * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
\r
64 * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
\r
65 * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
\r
66 * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
\r
67 * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
\r
68 * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
\r
69 * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
\r
70 * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
\r
71 * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
\r
73 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
\r
74 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
\r
75 * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
\r
76 * Define the appropriate preprocessor macro ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
\r
77 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
\r
78 * For Armv8-M cores define preprocessor macro ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML.
\r
79 * Set preprocessor macro __DSP_PRESENT if Armv8-M Mainline core supports DSP instructions.
\r
85 * The library ships with a number of examples which demonstrate how to use the library functions.
\r
90 * The library has been developed and tested with MDK version 5.14.0.0
\r
91 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
\r
93 * Building the Library
\r
96 * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
\r
97 * - arm_cortexM_math.uvprojx
\r
100 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above.
\r
102 * Preprocessor Macros
\r
105 * Each library project have different preprocessor macros.
\r
107 * - UNALIGNED_SUPPORT_DISABLE:
\r
109 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
\r
111 * - ARM_MATH_BIG_ENDIAN:
\r
113 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
\r
115 * - ARM_MATH_MATRIX_CHECK:
\r
117 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
\r
119 * - ARM_MATH_ROUNDING:
\r
121 * Define macro ARM_MATH_ROUNDING for rounding on support functions
\r
125 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
\r
126 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
\r
127 * ARM_MATH_CM7 for building the library on cortex-M7.
\r
129 * - ARM_MATH_ARMV8MxL:
\r
131 * Define macro ARM_MATH_ARMV8MBL for building the library on Armv8-M Baseline target, ARM_MATH_ARMV8MML for building library
\r
132 * on Armv8-M Mainline target.
\r
136 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries.
\r
140 * Initialize macro __DSP_PRESENT = 1 when Armv8-M Mainline core supports DSP instructions.
\r
143 * CMSIS-DSP in ARM::CMSIS Pack
\r
144 * -----------------------------
\r
146 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
\r
147 * |File/Folder |Content |
\r
148 * |------------------------------|------------------------------------------------------------------------|
\r
149 * |\b CMSIS\\Documentation\\DSP | This documentation |
\r
150 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
\r
151 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
\r
152 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
\r
155 * Revision History of CMSIS-DSP
\r
157 * Please refer to \ref ChangeLog_pg.
\r
162 * Copyright (C) 2010-2015 Arm Limited. All rights reserved.
\r
167 * @defgroup groupMath Basic Math Functions
\r
171 * @defgroup groupFastMath Fast Math Functions
\r
172 * This set of functions provides a fast approximation to sine, cosine, and square root.
\r
173 * As compared to most of the other functions in the CMSIS math library, the fast math functions
\r
174 * operate on individual values and not arrays.
\r
175 * There are separate functions for Q15, Q31, and floating-point data.
\r
180 * @defgroup groupCmplxMath Complex Math Functions
\r
181 * This set of functions operates on complex data vectors.
\r
182 * The data in the complex arrays is stored in an interleaved fashion
\r
183 * (real, imag, real, imag, ...).
\r
184 * In the API functions, the number of samples in a complex array refers
\r
185 * to the number of complex values; the array contains twice this number of
\r
190 * @defgroup groupFilters Filtering Functions
\r
194 * @defgroup groupMatrix Matrix Functions
\r
196 * This set of functions provides basic matrix math operations.
\r
197 * The functions operate on matrix data structures. For example,
\r
199 * definition for the floating-point matrix structure is shown
\r
204 * uint16_t numRows; // number of rows of the matrix.
\r
205 * uint16_t numCols; // number of columns of the matrix.
\r
206 * float32_t *pData; // points to the data of the matrix.
\r
207 * } arm_matrix_instance_f32;
\r
209 * There are similar definitions for Q15 and Q31 data types.
\r
211 * The structure specifies the size of the matrix and then points to
\r
212 * an array of data. The array is of size <code>numRows X numCols</code>
\r
213 * and the values are arranged in row order. That is, the
\r
214 * matrix element (i, j) is stored at:
\r
216 * pData[i*numCols + j]
\r
219 * \par Init Functions
\r
220 * There is an associated initialization function for each type of matrix
\r
222 * The initialization function sets the values of the internal structure fields.
\r
223 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
\r
224 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
\r
227 * Use of the initialization function is optional. However, if initialization function is used
\r
228 * then the instance structure cannot be placed into a const data section.
\r
229 * To place the instance structure in a const data
\r
230 * section, manually initialize the data structure. For example:
\r
232 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
\r
233 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
\r
234 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
\r
236 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
\r
237 * specifies the number of columns, and <code>pData</code> points to the
\r
240 * \par Size Checking
\r
241 * By default all of the matrix functions perform size checking on the input and
\r
242 * output matrices. For example, the matrix addition function verifies that the
\r
243 * two input matrices and the output matrix all have the same number of rows and
\r
244 * columns. If the size check fails the functions return:
\r
246 * ARM_MATH_SIZE_MISMATCH
\r
248 * Otherwise the functions return
\r
252 * There is some overhead associated with this matrix size checking.
\r
253 * The matrix size checking is enabled via the \#define
\r
255 * ARM_MATH_MATRIX_CHECK
\r
257 * within the library project settings. By default this macro is defined
\r
258 * and size checking is enabled. By changing the project settings and
\r
259 * undefining this macro size checking is eliminated and the functions
\r
260 * run a bit faster. With size checking disabled the functions always
\r
261 * return <code>ARM_MATH_SUCCESS</code>.
\r
265 * @defgroup groupTransforms Transform Functions
\r
269 * @defgroup groupController Controller Functions
\r
273 * @defgroup groupStats Statistics Functions
\r
276 * @defgroup groupSupport Support Functions
\r
280 * @defgroup groupInterpolation Interpolation Functions
\r
281 * These functions perform 1- and 2-dimensional interpolation of data.
\r
282 * Linear interpolation is used for 1-dimensional data and
\r
283 * bilinear interpolation is used for 2-dimensional data.
\r
287 * @defgroup groupExamples Examples
\r
289 #ifndef _ARM_MATH_H
\r
290 #define _ARM_MATH_H
\r
292 /* Compiler specific diagnostic adjustment */
\r
293 #if defined ( __CC_ARM )
\r
295 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
297 #elif defined ( __GNUC__ )
\r
298 #pragma GCC diagnostic push
\r
299 #pragma GCC diagnostic ignored "-Wsign-conversion"
\r
300 #pragma GCC diagnostic ignored "-Wconversion"
\r
301 #pragma GCC diagnostic ignored "-Wunused-parameter"
\r
303 #elif defined ( __ICCARM__ )
\r
305 #elif defined ( __TI_ARM__ )
\r
307 #elif defined ( __CSMC__ )
\r
309 #elif defined ( __TASKING__ )
\r
312 #error Unknown compiler
\r
316 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
\r
318 #if defined(ARM_MATH_CM7)
\r
319 #include "core_cm7.h"
\r
320 #define ARM_MATH_DSP
\r
321 #elif defined (ARM_MATH_CM4)
\r
322 #include "core_cm4.h"
\r
323 #define ARM_MATH_DSP
\r
324 #elif defined (ARM_MATH_CM33)
\r
325 #include "core_cm33.h"
\r
326 #define ARM_MATH_DSP
\r
327 #elif defined (ARM_MATH_CM3)
\r
328 #include "core_cm3.h"
\r
329 #elif defined (ARM_MATH_CM0)
\r
330 #include "core_cm0.h"
\r
331 #define ARM_MATH_CM0_FAMILY
\r
332 #elif defined (ARM_MATH_CM0PLUS)
\r
333 #include "core_cm0plus.h"
\r
334 #define ARM_MATH_CM0_FAMILY
\r
335 #elif defined (ARM_MATH_ARMV8MBL)
\r
336 #include "core_armv8mbl.h"
\r
337 #define ARM_MATH_CM0_FAMILY
\r
338 #elif defined (ARM_MATH_ARMV8MML)
\r
339 #include "core_armv8mml.h"
\r
340 #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1))
\r
341 #define ARM_MATH_DSP
\r
344 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
\r
347 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
\r
348 #include "string.h"
\r
357 * @brief Macros required for reciprocal calculation in Normalized LMS
\r
360 #define DELTA_Q31 (0x100)
\r
361 #define DELTA_Q15 0x5
\r
362 #define INDEX_MASK 0x0000003F
\r
364 #define PI 3.14159265358979f
\r
368 * @brief Macros required for SINE and COSINE Fast math approximations
\r
371 #define FAST_MATH_TABLE_SIZE 512
\r
372 #define FAST_MATH_Q31_SHIFT (32 - 10)
\r
373 #define FAST_MATH_Q15_SHIFT (16 - 10)
\r
374 #define CONTROLLER_Q31_SHIFT (32 - 9)
\r
375 #define TABLE_SPACING_Q31 0x400000
\r
376 #define TABLE_SPACING_Q15 0x80
\r
379 * @brief Macros required for SINE and COSINE Controller functions
\r
381 /* 1.31(q31) Fixed value of 2/360 */
\r
382 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
\r
383 #define INPUT_SPACING 0xB60B61
\r
386 * @brief Macro for Unaligned Support
\r
388 #ifndef UNALIGNED_SUPPORT_DISABLE
\r
391 #if defined (__GNUC__)
\r
392 #define ALIGN4 __attribute__((aligned(4)))
\r
394 #define ALIGN4 __align(4)
\r
396 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
\r
399 * @brief Error status returned by some functions in the library.
\r
404 ARM_MATH_SUCCESS = 0, /**< No error */
\r
405 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
\r
406 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
\r
407 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
\r
408 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
\r
409 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
\r
410 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
\r
414 * @brief 8-bit fractional data type in 1.7 format.
\r
416 typedef int8_t q7_t;
\r
419 * @brief 16-bit fractional data type in 1.15 format.
\r
421 typedef int16_t q15_t;
\r
424 * @brief 32-bit fractional data type in 1.31 format.
\r
426 typedef int32_t q31_t;
\r
429 * @brief 64-bit fractional data type in 1.63 format.
\r
431 typedef int64_t q63_t;
\r
434 * @brief 32-bit floating-point type definition.
\r
436 typedef float float32_t;
\r
439 * @brief 64-bit floating-point type definition.
\r
441 typedef double float64_t;
\r
444 * @brief definition to read/write two 16 bit values.
\r
446 #if defined ( __CC_ARM )
\r
447 #define __SIMD32_TYPE int32_t __packed
\r
448 #define CMSIS_UNUSED __attribute__((unused))
\r
449 #define CMSIS_INLINE __attribute__((always_inline))
\r
451 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
452 #define __SIMD32_TYPE int32_t
\r
453 #define CMSIS_UNUSED __attribute__((unused))
\r
454 #define CMSIS_INLINE __attribute__((always_inline))
\r
456 #elif defined ( __GNUC__ )
\r
457 #define __SIMD32_TYPE int32_t
\r
458 #define CMSIS_UNUSED __attribute__((unused))
\r
459 #define CMSIS_INLINE __attribute__((always_inline))
\r
461 #elif defined ( __ICCARM__ )
\r
462 #define __SIMD32_TYPE int32_t __packed
\r
463 #define CMSIS_UNUSED
\r
464 #define CMSIS_INLINE
\r
466 #elif defined ( __TI_ARM__ )
\r
467 #define __SIMD32_TYPE int32_t
\r
468 #define CMSIS_UNUSED __attribute__((unused))
\r
469 #define CMSIS_INLINE
\r
471 #elif defined ( __CSMC__ )
\r
472 #define __SIMD32_TYPE int32_t
\r
473 #define CMSIS_UNUSED
\r
474 #define CMSIS_INLINE
\r
476 #elif defined ( __TASKING__ )
\r
477 #define __SIMD32_TYPE __unaligned int32_t
\r
478 #define CMSIS_UNUSED
\r
479 #define CMSIS_INLINE
\r
482 #error Unknown compiler
\r
485 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
\r
486 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
\r
487 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
\r
488 #define __SIMD64(addr) (*(int64_t **) & (addr))
\r
490 #if !defined (ARM_MATH_DSP)
\r
492 * @brief definition to pack two 16 bit values.
\r
494 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
\r
495 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
\r
496 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
\r
497 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
\r
499 #endif /* !defined (ARM_MATH_DSP) */
\r
502 * @brief definition to pack four 8 bit values.
\r
504 #ifndef ARM_MATH_BIG_ENDIAN
\r
506 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
\r
507 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
\r
508 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
\r
509 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
\r
512 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
\r
513 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
\r
514 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
\r
515 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
\r
521 * @brief Clips Q63 to Q31 values.
\r
523 CMSIS_INLINE __STATIC_INLINE q31_t clip_q63_to_q31(
\r
526 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
527 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
\r
531 * @brief Clips Q63 to Q15 values.
\r
533 CMSIS_INLINE __STATIC_INLINE q15_t clip_q63_to_q15(
\r
536 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
537 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
\r
541 * @brief Clips Q31 to Q7 values.
\r
543 CMSIS_INLINE __STATIC_INLINE q7_t clip_q31_to_q7(
\r
546 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
\r
547 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
\r
551 * @brief Clips Q31 to Q15 values.
\r
553 CMSIS_INLINE __STATIC_INLINE q15_t clip_q31_to_q15(
\r
556 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
\r
557 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
\r
561 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
\r
564 CMSIS_INLINE __STATIC_INLINE q63_t mult32x64(
\r
568 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
\r
569 (((q63_t) (x >> 32) * y)));
\r
573 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
\r
576 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q31(
\r
579 q31_t * pRecipTable)
\r
588 signBits = ((uint32_t) (__CLZ( in) - 1));
\r
592 signBits = ((uint32_t) (__CLZ(-in) - 1));
\r
595 /* Convert input sample to 1.31 format */
\r
596 in = (in << signBits);
\r
598 /* calculation of index for initial approximated Val */
\r
599 index = (uint32_t)(in >> 24);
\r
600 index = (index & INDEX_MASK);
\r
602 /* 1.31 with exp 1 */
\r
603 out = pRecipTable[index];
\r
605 /* calculation of reciprocal value */
\r
606 /* running approximation for two iterations */
\r
607 for (i = 0U; i < 2U; i++)
\r
609 tempVal = (uint32_t) (((q63_t) in * out) >> 31);
\r
610 tempVal = 0x7FFFFFFFu - tempVal;
\r
611 /* 1.31 with exp 1 */
\r
612 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
\r
613 out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
\r
619 /* return num of signbits of out = 1/in value */
\r
620 return (signBits + 1U);
\r
625 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
\r
627 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q15(
\r
630 q15_t * pRecipTable)
\r
633 uint32_t tempVal = 0;
\r
634 uint32_t index = 0, i = 0;
\r
635 uint32_t signBits = 0;
\r
639 signBits = ((uint32_t)(__CLZ( in) - 17));
\r
643 signBits = ((uint32_t)(__CLZ(-in) - 17));
\r
646 /* Convert input sample to 1.15 format */
\r
647 in = (in << signBits);
\r
649 /* calculation of index for initial approximated Val */
\r
650 index = (uint32_t)(in >> 8);
\r
651 index = (index & INDEX_MASK);
\r
653 /* 1.15 with exp 1 */
\r
654 out = pRecipTable[index];
\r
656 /* calculation of reciprocal value */
\r
657 /* running approximation for two iterations */
\r
658 for (i = 0U; i < 2U; i++)
\r
660 tempVal = (uint32_t) (((q31_t) in * out) >> 15);
\r
661 tempVal = 0x7FFFu - tempVal;
\r
662 /* 1.15 with exp 1 */
\r
663 out = (q15_t) (((q31_t) out * tempVal) >> 14);
\r
664 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
\r
670 /* return num of signbits of out = 1/in value */
\r
671 return (signBits + 1);
\r
676 * @brief C custom defined intrinsic function for M3 and M0 processors
\r
678 #if !defined (ARM_MATH_DSP)
\r
681 * @brief C custom defined QADD8 for M3 and M0 processors
\r
683 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD8(
\r
689 r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
\r
690 s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
\r
691 t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
\r
692 u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
\r
694 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
\r
699 * @brief C custom defined QSUB8 for M3 and M0 processors
\r
701 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB8(
\r
707 r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
\r
708 s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
\r
709 t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
\r
710 u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
\r
712 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
\r
717 * @brief C custom defined QADD16 for M3 and M0 processors
\r
719 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD16(
\r
723 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
\r
724 q31_t r = 0, s = 0;
\r
726 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
727 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
729 return ((uint32_t)((s << 16) | (r )));
\r
734 * @brief C custom defined SHADD16 for M3 and M0 processors
\r
736 CMSIS_INLINE __STATIC_INLINE uint32_t __SHADD16(
\r
742 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
743 s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
745 return ((uint32_t)((s << 16) | (r )));
\r
750 * @brief C custom defined QSUB16 for M3 and M0 processors
\r
752 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB16(
\r
758 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
759 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
761 return ((uint32_t)((s << 16) | (r )));
\r
766 * @brief C custom defined SHSUB16 for M3 and M0 processors
\r
768 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSUB16(
\r
774 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
775 s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
777 return ((uint32_t)((s << 16) | (r )));
\r
782 * @brief C custom defined QASX for M3 and M0 processors
\r
784 CMSIS_INLINE __STATIC_INLINE uint32_t __QASX(
\r
790 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
791 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
793 return ((uint32_t)((s << 16) | (r )));
\r
798 * @brief C custom defined SHASX for M3 and M0 processors
\r
800 CMSIS_INLINE __STATIC_INLINE uint32_t __SHASX(
\r
806 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
807 s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
809 return ((uint32_t)((s << 16) | (r )));
\r
814 * @brief C custom defined QSAX for M3 and M0 processors
\r
816 CMSIS_INLINE __STATIC_INLINE uint32_t __QSAX(
\r
822 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
823 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
825 return ((uint32_t)((s << 16) | (r )));
\r
830 * @brief C custom defined SHSAX for M3 and M0 processors
\r
832 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSAX(
\r
838 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
839 s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
841 return ((uint32_t)((s << 16) | (r )));
\r
846 * @brief C custom defined SMUSDX for M3 and M0 processors
\r
848 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSDX(
\r
852 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
\r
853 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
\r
857 * @brief C custom defined SMUADX for M3 and M0 processors
\r
859 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUADX(
\r
863 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
\r
864 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
\r
869 * @brief C custom defined QADD for M3 and M0 processors
\r
871 CMSIS_INLINE __STATIC_INLINE int32_t __QADD(
\r
875 return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
\r
880 * @brief C custom defined QSUB for M3 and M0 processors
\r
882 CMSIS_INLINE __STATIC_INLINE int32_t __QSUB(
\r
886 return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
\r
891 * @brief C custom defined SMLAD for M3 and M0 processors
\r
893 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLAD(
\r
898 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
899 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
\r
900 ( ((q31_t)sum ) ) ));
\r
905 * @brief C custom defined SMLADX for M3 and M0 processors
\r
907 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLADX(
\r
912 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
\r
913 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
914 ( ((q31_t)sum ) ) ));
\r
919 * @brief C custom defined SMLSDX for M3 and M0 processors
\r
921 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLSDX(
\r
926 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
\r
927 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
928 ( ((q31_t)sum ) ) ));
\r
933 * @brief C custom defined SMLALD for M3 and M0 processors
\r
935 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALD(
\r
940 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
\r
941 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
942 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
\r
943 ( ((q63_t)sum ) ) ));
\r
948 * @brief C custom defined SMLALDX for M3 and M0 processors
\r
950 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALDX(
\r
955 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
\r
956 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
\r
957 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
958 ( ((q63_t)sum ) ) ));
\r
963 * @brief C custom defined SMUAD for M3 and M0 processors
\r
965 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUAD(
\r
969 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
970 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
\r
975 * @brief C custom defined SMUSD for M3 and M0 processors
\r
977 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSD(
\r
981 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
\r
982 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
\r
987 * @brief C custom defined SXTB16 for M3 and M0 processors
\r
989 CMSIS_INLINE __STATIC_INLINE uint32_t __SXTB16(
\r
992 return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
\r
993 ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
\r
997 * @brief C custom defined SMMLA for M3 and M0 processors
\r
999 CMSIS_INLINE __STATIC_INLINE int32_t __SMMLA(
\r
1004 return (sum + (int32_t) (((int64_t) x * y) >> 32));
\r
1007 #endif /* !defined (ARM_MATH_DSP) */
\r
1011 * @brief Instance structure for the Q7 FIR filter.
\r
1015 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1016 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1017 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1018 } arm_fir_instance_q7;
\r
1021 * @brief Instance structure for the Q15 FIR filter.
\r
1025 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1026 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1027 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1028 } arm_fir_instance_q15;
\r
1031 * @brief Instance structure for the Q31 FIR filter.
\r
1035 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1036 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1037 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1038 } arm_fir_instance_q31;
\r
1041 * @brief Instance structure for the floating-point FIR filter.
\r
1045 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1046 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1047 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1048 } arm_fir_instance_f32;
\r
1052 * @brief Processing function for the Q7 FIR filter.
\r
1053 * @param[in] S points to an instance of the Q7 FIR filter structure.
\r
1054 * @param[in] pSrc points to the block of input data.
\r
1055 * @param[out] pDst points to the block of output data.
\r
1056 * @param[in] blockSize number of samples to process.
\r
1059 const arm_fir_instance_q7 * S,
\r
1062 uint32_t blockSize);
\r
1066 * @brief Initialization function for the Q7 FIR filter.
\r
1067 * @param[in,out] S points to an instance of the Q7 FIR structure.
\r
1068 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1069 * @param[in] pCoeffs points to the filter coefficients.
\r
1070 * @param[in] pState points to the state buffer.
\r
1071 * @param[in] blockSize number of samples that are processed.
\r
1073 void arm_fir_init_q7(
\r
1074 arm_fir_instance_q7 * S,
\r
1078 uint32_t blockSize);
\r
1082 * @brief Processing function for the Q15 FIR filter.
\r
1083 * @param[in] S points to an instance of the Q15 FIR structure.
\r
1084 * @param[in] pSrc points to the block of input data.
\r
1085 * @param[out] pDst points to the block of output data.
\r
1086 * @param[in] blockSize number of samples to process.
\r
1089 const arm_fir_instance_q15 * S,
\r
1092 uint32_t blockSize);
\r
1096 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
\r
1097 * @param[in] S points to an instance of the Q15 FIR filter structure.
\r
1098 * @param[in] pSrc points to the block of input data.
\r
1099 * @param[out] pDst points to the block of output data.
\r
1100 * @param[in] blockSize number of samples to process.
\r
1102 void arm_fir_fast_q15(
\r
1103 const arm_fir_instance_q15 * S,
\r
1106 uint32_t blockSize);
\r
1110 * @brief Initialization function for the Q15 FIR filter.
\r
1111 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
\r
1112 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
\r
1113 * @param[in] pCoeffs points to the filter coefficients.
\r
1114 * @param[in] pState points to the state buffer.
\r
1115 * @param[in] blockSize number of samples that are processed at a time.
\r
1116 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
\r
1117 * <code>numTaps</code> is not a supported value.
\r
1119 arm_status arm_fir_init_q15(
\r
1120 arm_fir_instance_q15 * S,
\r
1124 uint32_t blockSize);
\r
1128 * @brief Processing function for the Q31 FIR filter.
\r
1129 * @param[in] S points to an instance of the Q31 FIR filter structure.
\r
1130 * @param[in] pSrc points to the block of input data.
\r
1131 * @param[out] pDst points to the block of output data.
\r
1132 * @param[in] blockSize number of samples to process.
\r
1135 const arm_fir_instance_q31 * S,
\r
1138 uint32_t blockSize);
\r
1142 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
\r
1143 * @param[in] S points to an instance of the Q31 FIR structure.
\r
1144 * @param[in] pSrc points to the block of input data.
\r
1145 * @param[out] pDst points to the block of output data.
\r
1146 * @param[in] blockSize number of samples to process.
\r
1148 void arm_fir_fast_q31(
\r
1149 const arm_fir_instance_q31 * S,
\r
1152 uint32_t blockSize);
\r
1156 * @brief Initialization function for the Q31 FIR filter.
\r
1157 * @param[in,out] S points to an instance of the Q31 FIR structure.
\r
1158 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1159 * @param[in] pCoeffs points to the filter coefficients.
\r
1160 * @param[in] pState points to the state buffer.
\r
1161 * @param[in] blockSize number of samples that are processed at a time.
\r
1163 void arm_fir_init_q31(
\r
1164 arm_fir_instance_q31 * S,
\r
1168 uint32_t blockSize);
\r
1172 * @brief Processing function for the floating-point FIR filter.
\r
1173 * @param[in] S points to an instance of the floating-point FIR structure.
\r
1174 * @param[in] pSrc points to the block of input data.
\r
1175 * @param[out] pDst points to the block of output data.
\r
1176 * @param[in] blockSize number of samples to process.
\r
1179 const arm_fir_instance_f32 * S,
\r
1182 uint32_t blockSize);
\r
1186 * @brief Initialization function for the floating-point FIR filter.
\r
1187 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
\r
1188 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1189 * @param[in] pCoeffs points to the filter coefficients.
\r
1190 * @param[in] pState points to the state buffer.
\r
1191 * @param[in] blockSize number of samples that are processed at a time.
\r
1193 void arm_fir_init_f32(
\r
1194 arm_fir_instance_f32 * S,
\r
1196 float32_t * pCoeffs,
\r
1197 float32_t * pState,
\r
1198 uint32_t blockSize);
\r
1202 * @brief Instance structure for the Q15 Biquad cascade filter.
\r
1206 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1207 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1208 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1209 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1210 } arm_biquad_casd_df1_inst_q15;
\r
1213 * @brief Instance structure for the Q31 Biquad cascade filter.
\r
1217 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1218 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1219 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1220 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1221 } arm_biquad_casd_df1_inst_q31;
\r
1224 * @brief Instance structure for the floating-point Biquad cascade filter.
\r
1228 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1229 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1230 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1231 } arm_biquad_casd_df1_inst_f32;
\r
1235 * @brief Processing function for the Q15 Biquad cascade filter.
\r
1236 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
\r
1237 * @param[in] pSrc points to the block of input data.
\r
1238 * @param[out] pDst points to the block of output data.
\r
1239 * @param[in] blockSize number of samples to process.
\r
1241 void arm_biquad_cascade_df1_q15(
\r
1242 const arm_biquad_casd_df1_inst_q15 * S,
\r
1245 uint32_t blockSize);
\r
1249 * @brief Initialization function for the Q15 Biquad cascade filter.
\r
1250 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
\r
1251 * @param[in] numStages number of 2nd order stages in the filter.
\r
1252 * @param[in] pCoeffs points to the filter coefficients.
\r
1253 * @param[in] pState points to the state buffer.
\r
1254 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1256 void arm_biquad_cascade_df1_init_q15(
\r
1257 arm_biquad_casd_df1_inst_q15 * S,
\r
1258 uint8_t numStages,
\r
1261 int8_t postShift);
\r
1265 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1266 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
\r
1267 * @param[in] pSrc points to the block of input data.
\r
1268 * @param[out] pDst points to the block of output data.
\r
1269 * @param[in] blockSize number of samples to process.
\r
1271 void arm_biquad_cascade_df1_fast_q15(
\r
1272 const arm_biquad_casd_df1_inst_q15 * S,
\r
1275 uint32_t blockSize);
\r
1279 * @brief Processing function for the Q31 Biquad cascade filter
\r
1280 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
\r
1281 * @param[in] pSrc points to the block of input data.
\r
1282 * @param[out] pDst points to the block of output data.
\r
1283 * @param[in] blockSize number of samples to process.
\r
1285 void arm_biquad_cascade_df1_q31(
\r
1286 const arm_biquad_casd_df1_inst_q31 * S,
\r
1289 uint32_t blockSize);
\r
1293 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1294 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
\r
1295 * @param[in] pSrc points to the block of input data.
\r
1296 * @param[out] pDst points to the block of output data.
\r
1297 * @param[in] blockSize number of samples to process.
\r
1299 void arm_biquad_cascade_df1_fast_q31(
\r
1300 const arm_biquad_casd_df1_inst_q31 * S,
\r
1303 uint32_t blockSize);
\r
1307 * @brief Initialization function for the Q31 Biquad cascade filter.
\r
1308 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
\r
1309 * @param[in] numStages number of 2nd order stages in the filter.
\r
1310 * @param[in] pCoeffs points to the filter coefficients.
\r
1311 * @param[in] pState points to the state buffer.
\r
1312 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1314 void arm_biquad_cascade_df1_init_q31(
\r
1315 arm_biquad_casd_df1_inst_q31 * S,
\r
1316 uint8_t numStages,
\r
1319 int8_t postShift);
\r
1323 * @brief Processing function for the floating-point Biquad cascade filter.
\r
1324 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
\r
1325 * @param[in] pSrc points to the block of input data.
\r
1326 * @param[out] pDst points to the block of output data.
\r
1327 * @param[in] blockSize number of samples to process.
\r
1329 void arm_biquad_cascade_df1_f32(
\r
1330 const arm_biquad_casd_df1_inst_f32 * S,
\r
1333 uint32_t blockSize);
\r
1337 * @brief Initialization function for the floating-point Biquad cascade filter.
\r
1338 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
\r
1339 * @param[in] numStages number of 2nd order stages in the filter.
\r
1340 * @param[in] pCoeffs points to the filter coefficients.
\r
1341 * @param[in] pState points to the state buffer.
\r
1343 void arm_biquad_cascade_df1_init_f32(
\r
1344 arm_biquad_casd_df1_inst_f32 * S,
\r
1345 uint8_t numStages,
\r
1346 float32_t * pCoeffs,
\r
1347 float32_t * pState);
\r
1351 * @brief Instance structure for the floating-point matrix structure.
\r
1355 uint16_t numRows; /**< number of rows of the matrix. */
\r
1356 uint16_t numCols; /**< number of columns of the matrix. */
\r
1357 float32_t *pData; /**< points to the data of the matrix. */
\r
1358 } arm_matrix_instance_f32;
\r
1362 * @brief Instance structure for the floating-point matrix structure.
\r
1366 uint16_t numRows; /**< number of rows of the matrix. */
\r
1367 uint16_t numCols; /**< number of columns of the matrix. */
\r
1368 float64_t *pData; /**< points to the data of the matrix. */
\r
1369 } arm_matrix_instance_f64;
\r
1372 * @brief Instance structure for the Q15 matrix structure.
\r
1376 uint16_t numRows; /**< number of rows of the matrix. */
\r
1377 uint16_t numCols; /**< number of columns of the matrix. */
\r
1378 q15_t *pData; /**< points to the data of the matrix. */
\r
1379 } arm_matrix_instance_q15;
\r
1382 * @brief Instance structure for the Q31 matrix structure.
\r
1386 uint16_t numRows; /**< number of rows of the matrix. */
\r
1387 uint16_t numCols; /**< number of columns of the matrix. */
\r
1388 q31_t *pData; /**< points to the data of the matrix. */
\r
1389 } arm_matrix_instance_q31;
\r
1393 * @brief Floating-point matrix addition.
\r
1394 * @param[in] pSrcA points to the first input matrix structure
\r
1395 * @param[in] pSrcB points to the second input matrix structure
\r
1396 * @param[out] pDst points to output matrix structure
\r
1397 * @return The function returns either
\r
1398 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1400 arm_status arm_mat_add_f32(
\r
1401 const arm_matrix_instance_f32 * pSrcA,
\r
1402 const arm_matrix_instance_f32 * pSrcB,
\r
1403 arm_matrix_instance_f32 * pDst);
\r
1407 * @brief Q15 matrix addition.
\r
1408 * @param[in] pSrcA points to the first input matrix structure
\r
1409 * @param[in] pSrcB points to the second input matrix structure
\r
1410 * @param[out] pDst points to output matrix structure
\r
1411 * @return The function returns either
\r
1412 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1414 arm_status arm_mat_add_q15(
\r
1415 const arm_matrix_instance_q15 * pSrcA,
\r
1416 const arm_matrix_instance_q15 * pSrcB,
\r
1417 arm_matrix_instance_q15 * pDst);
\r
1421 * @brief Q31 matrix addition.
\r
1422 * @param[in] pSrcA points to the first input matrix structure
\r
1423 * @param[in] pSrcB points to the second input matrix structure
\r
1424 * @param[out] pDst points to output matrix structure
\r
1425 * @return The function returns either
\r
1426 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1428 arm_status arm_mat_add_q31(
\r
1429 const arm_matrix_instance_q31 * pSrcA,
\r
1430 const arm_matrix_instance_q31 * pSrcB,
\r
1431 arm_matrix_instance_q31 * pDst);
\r
1435 * @brief Floating-point, complex, matrix multiplication.
\r
1436 * @param[in] pSrcA points to the first input matrix structure
\r
1437 * @param[in] pSrcB points to the second input matrix structure
\r
1438 * @param[out] pDst points to output matrix structure
\r
1439 * @return The function returns either
\r
1440 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1442 arm_status arm_mat_cmplx_mult_f32(
\r
1443 const arm_matrix_instance_f32 * pSrcA,
\r
1444 const arm_matrix_instance_f32 * pSrcB,
\r
1445 arm_matrix_instance_f32 * pDst);
\r
1449 * @brief Q15, complex, matrix multiplication.
\r
1450 * @param[in] pSrcA points to the first input matrix structure
\r
1451 * @param[in] pSrcB points to the second input matrix structure
\r
1452 * @param[out] pDst points to output matrix structure
\r
1453 * @return The function returns either
\r
1454 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1456 arm_status arm_mat_cmplx_mult_q15(
\r
1457 const arm_matrix_instance_q15 * pSrcA,
\r
1458 const arm_matrix_instance_q15 * pSrcB,
\r
1459 arm_matrix_instance_q15 * pDst,
\r
1460 q15_t * pScratch);
\r
1464 * @brief Q31, complex, matrix multiplication.
\r
1465 * @param[in] pSrcA points to the first input matrix structure
\r
1466 * @param[in] pSrcB points to the second input matrix structure
\r
1467 * @param[out] pDst points to output matrix structure
\r
1468 * @return The function returns either
\r
1469 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1471 arm_status arm_mat_cmplx_mult_q31(
\r
1472 const arm_matrix_instance_q31 * pSrcA,
\r
1473 const arm_matrix_instance_q31 * pSrcB,
\r
1474 arm_matrix_instance_q31 * pDst);
\r
1478 * @brief Floating-point matrix transpose.
\r
1479 * @param[in] pSrc points to the input matrix
\r
1480 * @param[out] pDst points to the output matrix
\r
1481 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1482 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1484 arm_status arm_mat_trans_f32(
\r
1485 const arm_matrix_instance_f32 * pSrc,
\r
1486 arm_matrix_instance_f32 * pDst);
\r
1490 * @brief Q15 matrix transpose.
\r
1491 * @param[in] pSrc points to the input matrix
\r
1492 * @param[out] pDst points to the output matrix
\r
1493 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1494 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1496 arm_status arm_mat_trans_q15(
\r
1497 const arm_matrix_instance_q15 * pSrc,
\r
1498 arm_matrix_instance_q15 * pDst);
\r
1502 * @brief Q31 matrix transpose.
\r
1503 * @param[in] pSrc points to the input matrix
\r
1504 * @param[out] pDst points to the output matrix
\r
1505 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1506 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1508 arm_status arm_mat_trans_q31(
\r
1509 const arm_matrix_instance_q31 * pSrc,
\r
1510 arm_matrix_instance_q31 * pDst);
\r
1514 * @brief Floating-point matrix multiplication
\r
1515 * @param[in] pSrcA points to the first input matrix structure
\r
1516 * @param[in] pSrcB points to the second input matrix structure
\r
1517 * @param[out] pDst points to output matrix structure
\r
1518 * @return The function returns either
\r
1519 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1521 arm_status arm_mat_mult_f32(
\r
1522 const arm_matrix_instance_f32 * pSrcA,
\r
1523 const arm_matrix_instance_f32 * pSrcB,
\r
1524 arm_matrix_instance_f32 * pDst);
\r
1528 * @brief Q15 matrix multiplication
\r
1529 * @param[in] pSrcA points to the first input matrix structure
\r
1530 * @param[in] pSrcB points to the second input matrix structure
\r
1531 * @param[out] pDst points to output matrix structure
\r
1532 * @param[in] pState points to the array for storing intermediate results
\r
1533 * @return The function returns either
\r
1534 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1536 arm_status arm_mat_mult_q15(
\r
1537 const arm_matrix_instance_q15 * pSrcA,
\r
1538 const arm_matrix_instance_q15 * pSrcB,
\r
1539 arm_matrix_instance_q15 * pDst,
\r
1544 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1545 * @param[in] pSrcA points to the first input matrix structure
\r
1546 * @param[in] pSrcB points to the second input matrix structure
\r
1547 * @param[out] pDst points to output matrix structure
\r
1548 * @param[in] pState points to the array for storing intermediate results
\r
1549 * @return The function returns either
\r
1550 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1552 arm_status arm_mat_mult_fast_q15(
\r
1553 const arm_matrix_instance_q15 * pSrcA,
\r
1554 const arm_matrix_instance_q15 * pSrcB,
\r
1555 arm_matrix_instance_q15 * pDst,
\r
1560 * @brief Q31 matrix multiplication
\r
1561 * @param[in] pSrcA points to the first input matrix structure
\r
1562 * @param[in] pSrcB points to the second input matrix structure
\r
1563 * @param[out] pDst points to output matrix structure
\r
1564 * @return The function returns either
\r
1565 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1567 arm_status arm_mat_mult_q31(
\r
1568 const arm_matrix_instance_q31 * pSrcA,
\r
1569 const arm_matrix_instance_q31 * pSrcB,
\r
1570 arm_matrix_instance_q31 * pDst);
\r
1574 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1575 * @param[in] pSrcA points to the first input matrix structure
\r
1576 * @param[in] pSrcB points to the second input matrix structure
\r
1577 * @param[out] pDst points to output matrix structure
\r
1578 * @return The function returns either
\r
1579 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1581 arm_status arm_mat_mult_fast_q31(
\r
1582 const arm_matrix_instance_q31 * pSrcA,
\r
1583 const arm_matrix_instance_q31 * pSrcB,
\r
1584 arm_matrix_instance_q31 * pDst);
\r
1588 * @brief Floating-point matrix subtraction
\r
1589 * @param[in] pSrcA points to the first input matrix structure
\r
1590 * @param[in] pSrcB points to the second input matrix structure
\r
1591 * @param[out] pDst points to output matrix structure
\r
1592 * @return The function returns either
\r
1593 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1595 arm_status arm_mat_sub_f32(
\r
1596 const arm_matrix_instance_f32 * pSrcA,
\r
1597 const arm_matrix_instance_f32 * pSrcB,
\r
1598 arm_matrix_instance_f32 * pDst);
\r
1602 * @brief Q15 matrix subtraction
\r
1603 * @param[in] pSrcA points to the first input matrix structure
\r
1604 * @param[in] pSrcB points to the second input matrix structure
\r
1605 * @param[out] pDst points to output matrix structure
\r
1606 * @return The function returns either
\r
1607 * <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_sub_q15(
\r
1610 const arm_matrix_instance_q15 * pSrcA,
\r
1611 const arm_matrix_instance_q15 * pSrcB,
\r
1612 arm_matrix_instance_q15 * pDst);
\r
1616 * @brief Q31 matrix subtraction
\r
1617 * @param[in] pSrcA points to the first input matrix structure
\r
1618 * @param[in] pSrcB points to the second input matrix structure
\r
1619 * @param[out] pDst points to output matrix structure
\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
1623 arm_status arm_mat_sub_q31(
\r
1624 const arm_matrix_instance_q31 * pSrcA,
\r
1625 const arm_matrix_instance_q31 * pSrcB,
\r
1626 arm_matrix_instance_q31 * pDst);
\r
1630 * @brief Floating-point matrix scaling.
\r
1631 * @param[in] pSrc points to the input matrix
\r
1632 * @param[in] scale scale factor
\r
1633 * @param[out] pDst points to the output matrix
\r
1634 * @return The function returns either
\r
1635 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1637 arm_status arm_mat_scale_f32(
\r
1638 const arm_matrix_instance_f32 * pSrc,
\r
1640 arm_matrix_instance_f32 * pDst);
\r
1644 * @brief Q15 matrix scaling.
\r
1645 * @param[in] pSrc points to input matrix
\r
1646 * @param[in] scaleFract fractional portion of the scale factor
\r
1647 * @param[in] shift number of bits to shift the result by
\r
1648 * @param[out] pDst points to output matrix
\r
1649 * @return The function returns either
\r
1650 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1652 arm_status arm_mat_scale_q15(
\r
1653 const arm_matrix_instance_q15 * pSrc,
\r
1656 arm_matrix_instance_q15 * pDst);
\r
1660 * @brief Q31 matrix scaling.
\r
1661 * @param[in] pSrc points to input matrix
\r
1662 * @param[in] scaleFract fractional portion of the scale factor
\r
1663 * @param[in] shift number of bits to shift the result by
\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
1668 arm_status arm_mat_scale_q31(
\r
1669 const arm_matrix_instance_q31 * pSrc,
\r
1672 arm_matrix_instance_q31 * pDst);
\r
1676 * @brief Q31 matrix initialization.
\r
1677 * @param[in,out] S points to an instance of the floating-point matrix structure.
\r
1678 * @param[in] nRows number of rows in the matrix.
\r
1679 * @param[in] nColumns number of columns in the matrix.
\r
1680 * @param[in] pData points to the matrix data array.
\r
1682 void arm_mat_init_q31(
\r
1683 arm_matrix_instance_q31 * S,
\r
1685 uint16_t nColumns,
\r
1690 * @brief Q15 matrix initialization.
\r
1691 * @param[in,out] S points to an instance of the floating-point matrix structure.
\r
1692 * @param[in] nRows number of rows in the matrix.
\r
1693 * @param[in] nColumns number of columns in the matrix.
\r
1694 * @param[in] pData points to the matrix data array.
\r
1696 void arm_mat_init_q15(
\r
1697 arm_matrix_instance_q15 * S,
\r
1699 uint16_t nColumns,
\r
1704 * @brief Floating-point matrix initialization.
\r
1705 * @param[in,out] S points to an instance of the floating-point matrix structure.
\r
1706 * @param[in] nRows number of rows in the matrix.
\r
1707 * @param[in] nColumns number of columns in the matrix.
\r
1708 * @param[in] pData points to the matrix data array.
\r
1710 void arm_mat_init_f32(
\r
1711 arm_matrix_instance_f32 * S,
\r
1713 uint16_t nColumns,
\r
1714 float32_t * pData);
\r
1719 * @brief Instance structure for the Q15 PID Control.
\r
1723 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1724 #if !defined (ARM_MATH_DSP)
\r
1728 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
\r
1730 q15_t state[3]; /**< The state array of length 3. */
\r
1731 q15_t Kp; /**< The proportional gain. */
\r
1732 q15_t Ki; /**< The integral gain. */
\r
1733 q15_t Kd; /**< The derivative gain. */
\r
1734 } arm_pid_instance_q15;
\r
1737 * @brief Instance structure for the Q31 PID Control.
\r
1741 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1742 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1743 q31_t A2; /**< The derived gain, A2 = Kd . */
\r
1744 q31_t state[3]; /**< The state array of length 3. */
\r
1745 q31_t Kp; /**< The proportional gain. */
\r
1746 q31_t Ki; /**< The integral gain. */
\r
1747 q31_t Kd; /**< The derivative gain. */
\r
1748 } arm_pid_instance_q31;
\r
1751 * @brief Instance structure for the floating-point PID Control.
\r
1755 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1756 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1757 float32_t A2; /**< The derived gain, A2 = Kd . */
\r
1758 float32_t state[3]; /**< The state array of length 3. */
\r
1759 float32_t Kp; /**< The proportional gain. */
\r
1760 float32_t Ki; /**< The integral gain. */
\r
1761 float32_t Kd; /**< The derivative gain. */
\r
1762 } arm_pid_instance_f32;
\r
1767 * @brief Initialization function for the floating-point PID Control.
\r
1768 * @param[in,out] S points to an instance of the PID structure.
\r
1769 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1771 void arm_pid_init_f32(
\r
1772 arm_pid_instance_f32 * S,
\r
1773 int32_t resetStateFlag);
\r
1777 * @brief Reset function for the floating-point PID Control.
\r
1778 * @param[in,out] S is an instance of the floating-point PID Control structure
\r
1780 void arm_pid_reset_f32(
\r
1781 arm_pid_instance_f32 * S);
\r
1785 * @brief Initialization function for the Q31 PID Control.
\r
1786 * @param[in,out] S points to an instance of the Q15 PID structure.
\r
1787 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1789 void arm_pid_init_q31(
\r
1790 arm_pid_instance_q31 * S,
\r
1791 int32_t resetStateFlag);
\r
1795 * @brief Reset function for the Q31 PID Control.
\r
1796 * @param[in,out] S points to an instance of the Q31 PID Control structure
\r
1799 void arm_pid_reset_q31(
\r
1800 arm_pid_instance_q31 * S);
\r
1804 * @brief Initialization function for the Q15 PID Control.
\r
1805 * @param[in,out] S points to an instance of the Q15 PID structure.
\r
1806 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1808 void arm_pid_init_q15(
\r
1809 arm_pid_instance_q15 * S,
\r
1810 int32_t resetStateFlag);
\r
1814 * @brief Reset function for the Q15 PID Control.
\r
1815 * @param[in,out] S points to an instance of the q15 PID Control structure
\r
1817 void arm_pid_reset_q15(
\r
1818 arm_pid_instance_q15 * S);
\r
1822 * @brief Instance structure for the floating-point Linear Interpolate function.
\r
1826 uint32_t nValues; /**< nValues */
\r
1827 float32_t x1; /**< x1 */
\r
1828 float32_t xSpacing; /**< xSpacing */
\r
1829 float32_t *pYData; /**< pointer to the table of Y values */
\r
1830 } arm_linear_interp_instance_f32;
\r
1833 * @brief Instance structure for the floating-point bilinear interpolation function.
\r
1837 uint16_t numRows; /**< number of rows in the data table. */
\r
1838 uint16_t numCols; /**< number of columns in the data table. */
\r
1839 float32_t *pData; /**< points to the data table. */
\r
1840 } arm_bilinear_interp_instance_f32;
\r
1843 * @brief Instance structure for the Q31 bilinear interpolation function.
\r
1847 uint16_t numRows; /**< number of rows in the data table. */
\r
1848 uint16_t numCols; /**< number of columns in the data table. */
\r
1849 q31_t *pData; /**< points to the data table. */
\r
1850 } arm_bilinear_interp_instance_q31;
\r
1853 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1857 uint16_t numRows; /**< number of rows in the data table. */
\r
1858 uint16_t numCols; /**< number of columns in the data table. */
\r
1859 q15_t *pData; /**< points to the data table. */
\r
1860 } arm_bilinear_interp_instance_q15;
\r
1863 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1867 uint16_t numRows; /**< number of rows in the data table. */
\r
1868 uint16_t numCols; /**< number of columns in the data table. */
\r
1869 q7_t *pData; /**< points to the data table. */
\r
1870 } arm_bilinear_interp_instance_q7;
\r
1874 * @brief Q7 vector multiplication.
\r
1875 * @param[in] pSrcA points to the first input vector
\r
1876 * @param[in] pSrcB points to the second input vector
\r
1877 * @param[out] pDst points to the output vector
\r
1878 * @param[in] blockSize number of samples in each vector
\r
1884 uint32_t blockSize);
\r
1888 * @brief Q15 vector multiplication.
\r
1889 * @param[in] pSrcA points to the first input vector
\r
1890 * @param[in] pSrcB points to the second input vector
\r
1891 * @param[out] pDst points to the output vector
\r
1892 * @param[in] blockSize number of samples in each vector
\r
1894 void arm_mult_q15(
\r
1898 uint32_t blockSize);
\r
1902 * @brief Q31 vector multiplication.
\r
1903 * @param[in] pSrcA points to the first input vector
\r
1904 * @param[in] pSrcB points to the second input vector
\r
1905 * @param[out] pDst points to the output vector
\r
1906 * @param[in] blockSize number of samples in each vector
\r
1908 void arm_mult_q31(
\r
1912 uint32_t blockSize);
\r
1916 * @brief Floating-point vector multiplication.
\r
1917 * @param[in] pSrcA points to the first input vector
\r
1918 * @param[in] pSrcB points to the second input vector
\r
1919 * @param[out] pDst points to the output vector
\r
1920 * @param[in] blockSize number of samples in each vector
\r
1922 void arm_mult_f32(
\r
1923 float32_t * pSrcA,
\r
1924 float32_t * pSrcB,
\r
1926 uint32_t blockSize);
\r
1930 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
1934 uint16_t fftLen; /**< length of the FFT. */
\r
1935 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
1936 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
1937 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
\r
1938 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
1939 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
1940 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
1941 } arm_cfft_radix2_instance_q15;
\r
1944 arm_status arm_cfft_radix2_init_q15(
\r
1945 arm_cfft_radix2_instance_q15 * S,
\r
1948 uint8_t bitReverseFlag);
\r
1951 void arm_cfft_radix2_q15(
\r
1952 const arm_cfft_radix2_instance_q15 * S,
\r
1957 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
1961 uint16_t fftLen; /**< length of the FFT. */
\r
1962 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
1963 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
1964 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
1965 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
1966 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
1967 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
1968 } arm_cfft_radix4_instance_q15;
\r
1971 arm_status arm_cfft_radix4_init_q15(
\r
1972 arm_cfft_radix4_instance_q15 * S,
\r
1975 uint8_t bitReverseFlag);
\r
1978 void arm_cfft_radix4_q15(
\r
1979 const arm_cfft_radix4_instance_q15 * S,
\r
1983 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
\r
1987 uint16_t fftLen; /**< length of the FFT. */
\r
1988 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
1989 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
1990 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
1991 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
1992 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
1993 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
1994 } arm_cfft_radix2_instance_q31;
\r
1997 arm_status arm_cfft_radix2_init_q31(
\r
1998 arm_cfft_radix2_instance_q31 * S,
\r
2001 uint8_t bitReverseFlag);
\r
2004 void arm_cfft_radix2_q31(
\r
2005 const arm_cfft_radix2_instance_q31 * S,
\r
2009 * @brief Instance structure for the Q31 CFFT/CIFFT function.
\r
2013 uint16_t fftLen; /**< length of the FFT. */
\r
2014 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2015 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2016 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2017 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2018 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2019 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2020 } arm_cfft_radix4_instance_q31;
\r
2023 void arm_cfft_radix4_q31(
\r
2024 const arm_cfft_radix4_instance_q31 * S,
\r
2028 arm_status arm_cfft_radix4_init_q31(
\r
2029 arm_cfft_radix4_instance_q31 * S,
\r
2032 uint8_t bitReverseFlag);
\r
2035 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2039 uint16_t fftLen; /**< length of the FFT. */
\r
2040 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2041 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2042 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2043 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2044 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2045 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2046 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2047 } arm_cfft_radix2_instance_f32;
\r
2050 arm_status arm_cfft_radix2_init_f32(
\r
2051 arm_cfft_radix2_instance_f32 * S,
\r
2054 uint8_t bitReverseFlag);
\r
2057 void arm_cfft_radix2_f32(
\r
2058 const arm_cfft_radix2_instance_f32 * S,
\r
2059 float32_t * pSrc);
\r
2062 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2066 uint16_t fftLen; /**< length of the FFT. */
\r
2067 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2068 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2069 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2070 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2071 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2072 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2073 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2074 } arm_cfft_radix4_instance_f32;
\r
2077 arm_status arm_cfft_radix4_init_f32(
\r
2078 arm_cfft_radix4_instance_f32 * S,
\r
2081 uint8_t bitReverseFlag);
\r
2084 void arm_cfft_radix4_f32(
\r
2085 const arm_cfft_radix4_instance_f32 * S,
\r
2086 float32_t * pSrc);
\r
2089 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2093 uint16_t fftLen; /**< length of the FFT. */
\r
2094 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2095 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2096 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2097 } arm_cfft_instance_q15;
\r
2099 void arm_cfft_q15(
\r
2100 const arm_cfft_instance_q15 * S,
\r
2103 uint8_t bitReverseFlag);
\r
2106 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2110 uint16_t fftLen; /**< length of the FFT. */
\r
2111 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2112 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2113 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2114 } arm_cfft_instance_q31;
\r
2116 void arm_cfft_q31(
\r
2117 const arm_cfft_instance_q31 * S,
\r
2120 uint8_t bitReverseFlag);
\r
2123 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2127 uint16_t fftLen; /**< length of the FFT. */
\r
2128 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2129 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2130 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2131 } arm_cfft_instance_f32;
\r
2133 void arm_cfft_f32(
\r
2134 const arm_cfft_instance_f32 * S,
\r
2137 uint8_t bitReverseFlag);
\r
2140 * @brief Instance structure for the Q15 RFFT/RIFFT function.
\r
2144 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2145 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2146 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2147 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2148 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2149 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2150 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2151 } arm_rfft_instance_q15;
\r
2153 arm_status arm_rfft_init_q15(
\r
2154 arm_rfft_instance_q15 * S,
\r
2155 uint32_t fftLenReal,
\r
2156 uint32_t ifftFlagR,
\r
2157 uint32_t bitReverseFlag);
\r
2159 void arm_rfft_q15(
\r
2160 const arm_rfft_instance_q15 * S,
\r
2165 * @brief Instance structure for the Q31 RFFT/RIFFT function.
\r
2169 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2170 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2171 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2172 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2173 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2174 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2175 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2176 } arm_rfft_instance_q31;
\r
2178 arm_status arm_rfft_init_q31(
\r
2179 arm_rfft_instance_q31 * S,
\r
2180 uint32_t fftLenReal,
\r
2181 uint32_t ifftFlagR,
\r
2182 uint32_t bitReverseFlag);
\r
2184 void arm_rfft_q31(
\r
2185 const arm_rfft_instance_q31 * S,
\r
2190 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2194 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2195 uint16_t fftLenBy2; /**< length of the complex FFT. */
\r
2196 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2197 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2198 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2199 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2200 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2201 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2202 } arm_rfft_instance_f32;
\r
2204 arm_status arm_rfft_init_f32(
\r
2205 arm_rfft_instance_f32 * S,
\r
2206 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2207 uint32_t fftLenReal,
\r
2208 uint32_t ifftFlagR,
\r
2209 uint32_t bitReverseFlag);
\r
2211 void arm_rfft_f32(
\r
2212 const arm_rfft_instance_f32 * S,
\r
2214 float32_t * pDst);
\r
2217 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2221 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
\r
2222 uint16_t fftLenRFFT; /**< length of the real sequence */
\r
2223 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
\r
2224 } arm_rfft_fast_instance_f32 ;
\r
2226 arm_status arm_rfft_fast_init_f32 (
\r
2227 arm_rfft_fast_instance_f32 * S,
\r
2230 void arm_rfft_fast_f32(
\r
2231 arm_rfft_fast_instance_f32 * S,
\r
2232 float32_t * p, float32_t * pOut,
\r
2233 uint8_t ifftFlag);
\r
2236 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
\r
2240 uint16_t N; /**< length of the DCT4. */
\r
2241 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2242 float32_t normalize; /**< normalizing factor. */
\r
2243 float32_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2244 float32_t *pCosFactor; /**< points to the cosFactor table. */
\r
2245 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
\r
2246 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2247 } arm_dct4_instance_f32;
\r
2251 * @brief Initialization function for the floating-point DCT4/IDCT4.
\r
2252 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
\r
2253 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
\r
2254 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
\r
2255 * @param[in] N length of the DCT4.
\r
2256 * @param[in] Nby2 half of the length of the DCT4.
\r
2257 * @param[in] normalize normalizing factor.
\r
2258 * @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
2260 arm_status arm_dct4_init_f32(
\r
2261 arm_dct4_instance_f32 * S,
\r
2262 arm_rfft_instance_f32 * S_RFFT,
\r
2263 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2266 float32_t normalize);
\r
2270 * @brief Processing function for the floating-point DCT4/IDCT4.
\r
2271 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
\r
2272 * @param[in] pState points to state buffer.
\r
2273 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
\r
2275 void arm_dct4_f32(
\r
2276 const arm_dct4_instance_f32 * S,
\r
2277 float32_t * pState,
\r
2278 float32_t * pInlineBuffer);
\r
2282 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
\r
2286 uint16_t N; /**< length of the DCT4. */
\r
2287 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2288 q31_t normalize; /**< normalizing factor. */
\r
2289 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2290 q31_t *pCosFactor; /**< points to the cosFactor table. */
\r
2291 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
\r
2292 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2293 } arm_dct4_instance_q31;
\r
2297 * @brief Initialization function for the Q31 DCT4/IDCT4.
\r
2298 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
\r
2299 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
\r
2300 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
\r
2301 * @param[in] N length of the DCT4.
\r
2302 * @param[in] Nby2 half of the length of the DCT4.
\r
2303 * @param[in] normalize normalizing factor.
\r
2304 * @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
2306 arm_status arm_dct4_init_q31(
\r
2307 arm_dct4_instance_q31 * S,
\r
2308 arm_rfft_instance_q31 * S_RFFT,
\r
2309 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2316 * @brief Processing function for the Q31 DCT4/IDCT4.
\r
2317 * @param[in] S points to an instance of the Q31 DCT4 structure.
\r
2318 * @param[in] pState points to state buffer.
\r
2319 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
\r
2321 void arm_dct4_q31(
\r
2322 const arm_dct4_instance_q31 * S,
\r
2324 q31_t * pInlineBuffer);
\r
2328 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
\r
2332 uint16_t N; /**< length of the DCT4. */
\r
2333 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2334 q15_t normalize; /**< normalizing factor. */
\r
2335 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2336 q15_t *pCosFactor; /**< points to the cosFactor table. */
\r
2337 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
\r
2338 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2339 } arm_dct4_instance_q15;
\r
2343 * @brief Initialization function for the Q15 DCT4/IDCT4.
\r
2344 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
\r
2345 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
\r
2346 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
\r
2347 * @param[in] N length of the DCT4.
\r
2348 * @param[in] Nby2 half of the length of the DCT4.
\r
2349 * @param[in] normalize normalizing factor.
\r
2350 * @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
2352 arm_status arm_dct4_init_q15(
\r
2353 arm_dct4_instance_q15 * S,
\r
2354 arm_rfft_instance_q15 * S_RFFT,
\r
2355 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2362 * @brief Processing function for the Q15 DCT4/IDCT4.
\r
2363 * @param[in] S points to an instance of the Q15 DCT4 structure.
\r
2364 * @param[in] pState points to state buffer.
\r
2365 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
\r
2367 void arm_dct4_q15(
\r
2368 const arm_dct4_instance_q15 * S,
\r
2370 q15_t * pInlineBuffer);
\r
2374 * @brief Floating-point vector addition.
\r
2375 * @param[in] pSrcA points to the first input vector
\r
2376 * @param[in] pSrcB points to the second input vector
\r
2377 * @param[out] pDst points to the output vector
\r
2378 * @param[in] blockSize number of samples in each vector
\r
2381 float32_t * pSrcA,
\r
2382 float32_t * pSrcB,
\r
2384 uint32_t blockSize);
\r
2388 * @brief Q7 vector addition.
\r
2389 * @param[in] pSrcA points to the first input vector
\r
2390 * @param[in] pSrcB points to the second input vector
\r
2391 * @param[out] pDst points to the output vector
\r
2392 * @param[in] blockSize number of samples in each vector
\r
2398 uint32_t blockSize);
\r
2402 * @brief Q15 vector addition.
\r
2403 * @param[in] pSrcA points to the first input vector
\r
2404 * @param[in] pSrcB points to the second input vector
\r
2405 * @param[out] pDst points to the output vector
\r
2406 * @param[in] blockSize number of samples in each vector
\r
2412 uint32_t blockSize);
\r
2416 * @brief Q31 vector addition.
\r
2417 * @param[in] pSrcA points to the first input vector
\r
2418 * @param[in] pSrcB points to the second input vector
\r
2419 * @param[out] pDst points to the output vector
\r
2420 * @param[in] blockSize number of samples in each vector
\r
2426 uint32_t blockSize);
\r
2430 * @brief Floating-point vector subtraction.
\r
2431 * @param[in] pSrcA points to the first input vector
\r
2432 * @param[in] pSrcB points to the second input vector
\r
2433 * @param[out] pDst points to the output vector
\r
2434 * @param[in] blockSize number of samples in each vector
\r
2437 float32_t * pSrcA,
\r
2438 float32_t * pSrcB,
\r
2440 uint32_t blockSize);
\r
2444 * @brief Q7 vector subtraction.
\r
2445 * @param[in] pSrcA points to the first input vector
\r
2446 * @param[in] pSrcB points to the second input vector
\r
2447 * @param[out] pDst points to the output vector
\r
2448 * @param[in] blockSize number of samples in each vector
\r
2454 uint32_t blockSize);
\r
2458 * @brief Q15 vector subtraction.
\r
2459 * @param[in] pSrcA points to the first input vector
\r
2460 * @param[in] pSrcB points to the second input vector
\r
2461 * @param[out] pDst points to the output vector
\r
2462 * @param[in] blockSize number of samples in each vector
\r
2468 uint32_t blockSize);
\r
2472 * @brief Q31 vector subtraction.
\r
2473 * @param[in] pSrcA points to the first input vector
\r
2474 * @param[in] pSrcB points to the second input vector
\r
2475 * @param[out] pDst points to the output vector
\r
2476 * @param[in] blockSize number of samples in each vector
\r
2482 uint32_t blockSize);
\r
2486 * @brief Multiplies a floating-point vector by a scalar.
\r
2487 * @param[in] pSrc points to the input vector
\r
2488 * @param[in] scale scale factor to be applied
\r
2489 * @param[out] pDst points to the output vector
\r
2490 * @param[in] blockSize number of samples in the vector
\r
2492 void arm_scale_f32(
\r
2496 uint32_t blockSize);
\r
2500 * @brief Multiplies a Q7 vector by a scalar.
\r
2501 * @param[in] pSrc points to the input vector
\r
2502 * @param[in] scaleFract fractional portion of the scale value
\r
2503 * @param[in] shift number of bits to shift the result by
\r
2504 * @param[out] pDst points to the output vector
\r
2505 * @param[in] blockSize number of samples in the vector
\r
2507 void arm_scale_q7(
\r
2512 uint32_t blockSize);
\r
2516 * @brief Multiplies a Q15 vector by a scalar.
\r
2517 * @param[in] pSrc points to the input vector
\r
2518 * @param[in] scaleFract fractional portion of the scale value
\r
2519 * @param[in] shift number of bits to shift the result by
\r
2520 * @param[out] pDst points to the output vector
\r
2521 * @param[in] blockSize number of samples in the vector
\r
2523 void arm_scale_q15(
\r
2528 uint32_t blockSize);
\r
2532 * @brief Multiplies a Q31 vector by a scalar.
\r
2533 * @param[in] pSrc points to the input vector
\r
2534 * @param[in] scaleFract fractional portion of the scale value
\r
2535 * @param[in] shift number of bits to shift the result by
\r
2536 * @param[out] pDst points to the output vector
\r
2537 * @param[in] blockSize number of samples in the vector
\r
2539 void arm_scale_q31(
\r
2544 uint32_t blockSize);
\r
2548 * @brief Q7 vector absolute value.
\r
2549 * @param[in] pSrc points to the input buffer
\r
2550 * @param[out] pDst points to the output buffer
\r
2551 * @param[in] blockSize number of samples in each vector
\r
2556 uint32_t blockSize);
\r
2560 * @brief Floating-point vector absolute value.
\r
2561 * @param[in] pSrc points to the input buffer
\r
2562 * @param[out] pDst points to the output buffer
\r
2563 * @param[in] blockSize number of samples in each vector
\r
2568 uint32_t blockSize);
\r
2572 * @brief Q15 vector absolute value.
\r
2573 * @param[in] pSrc points to the input buffer
\r
2574 * @param[out] pDst points to the output buffer
\r
2575 * @param[in] blockSize number of samples in each vector
\r
2580 uint32_t blockSize);
\r
2584 * @brief Q31 vector absolute value.
\r
2585 * @param[in] pSrc points to the input buffer
\r
2586 * @param[out] pDst points to the output buffer
\r
2587 * @param[in] blockSize number of samples in each vector
\r
2592 uint32_t blockSize);
\r
2596 * @brief Dot product of floating-point vectors.
\r
2597 * @param[in] pSrcA points to the first input vector
\r
2598 * @param[in] pSrcB points to the second input vector
\r
2599 * @param[in] blockSize number of samples in each vector
\r
2600 * @param[out] result output result returned here
\r
2602 void arm_dot_prod_f32(
\r
2603 float32_t * pSrcA,
\r
2604 float32_t * pSrcB,
\r
2605 uint32_t blockSize,
\r
2606 float32_t * result);
\r
2610 * @brief Dot product of Q7 vectors.
\r
2611 * @param[in] pSrcA points to the first input vector
\r
2612 * @param[in] pSrcB points to the second input vector
\r
2613 * @param[in] blockSize number of samples in each vector
\r
2614 * @param[out] result output result returned here
\r
2616 void arm_dot_prod_q7(
\r
2619 uint32_t blockSize,
\r
2624 * @brief Dot product of Q15 vectors.
\r
2625 * @param[in] pSrcA points to the first input vector
\r
2626 * @param[in] pSrcB points to the second input vector
\r
2627 * @param[in] blockSize number of samples in each vector
\r
2628 * @param[out] result output result returned here
\r
2630 void arm_dot_prod_q15(
\r
2633 uint32_t blockSize,
\r
2638 * @brief Dot product of Q31 vectors.
\r
2639 * @param[in] pSrcA points to the first input vector
\r
2640 * @param[in] pSrcB points to the second input vector
\r
2641 * @param[in] blockSize number of samples in each vector
\r
2642 * @param[out] result output result returned here
\r
2644 void arm_dot_prod_q31(
\r
2647 uint32_t blockSize,
\r
2652 * @brief Shifts the elements of a Q7 vector a specified number of bits.
\r
2653 * @param[in] pSrc points to the input vector
\r
2654 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2655 * @param[out] pDst points to the output vector
\r
2656 * @param[in] blockSize number of samples in the vector
\r
2658 void arm_shift_q7(
\r
2662 uint32_t blockSize);
\r
2666 * @brief Shifts the elements of a Q15 vector a specified number of bits.
\r
2667 * @param[in] pSrc points to the input vector
\r
2668 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2669 * @param[out] pDst points to the output vector
\r
2670 * @param[in] blockSize number of samples in the vector
\r
2672 void arm_shift_q15(
\r
2676 uint32_t blockSize);
\r
2680 * @brief Shifts the elements of a Q31 vector a specified number of bits.
\r
2681 * @param[in] pSrc points to the input vector
\r
2682 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2683 * @param[out] pDst points to the output vector
\r
2684 * @param[in] blockSize number of samples in the vector
\r
2686 void arm_shift_q31(
\r
2690 uint32_t blockSize);
\r
2694 * @brief Adds a constant offset to a floating-point vector.
\r
2695 * @param[in] pSrc points to the input vector
\r
2696 * @param[in] offset is the offset to be added
\r
2697 * @param[out] pDst points to the output vector
\r
2698 * @param[in] blockSize number of samples in the vector
\r
2700 void arm_offset_f32(
\r
2704 uint32_t blockSize);
\r
2708 * @brief Adds a constant offset to a Q7 vector.
\r
2709 * @param[in] pSrc points to the input vector
\r
2710 * @param[in] offset is the offset to be added
\r
2711 * @param[out] pDst points to the output vector
\r
2712 * @param[in] blockSize number of samples in the vector
\r
2714 void arm_offset_q7(
\r
2718 uint32_t blockSize);
\r
2722 * @brief Adds a constant offset to a Q15 vector.
\r
2723 * @param[in] pSrc points to the input vector
\r
2724 * @param[in] offset is the offset to be added
\r
2725 * @param[out] pDst points to the output vector
\r
2726 * @param[in] blockSize number of samples in the vector
\r
2728 void arm_offset_q15(
\r
2732 uint32_t blockSize);
\r
2736 * @brief Adds a constant offset to a Q31 vector.
\r
2737 * @param[in] pSrc points to the input vector
\r
2738 * @param[in] offset is the offset to be added
\r
2739 * @param[out] pDst points to the output vector
\r
2740 * @param[in] blockSize number of samples in the vector
\r
2742 void arm_offset_q31(
\r
2746 uint32_t blockSize);
\r
2750 * @brief Negates the elements of a floating-point vector.
\r
2751 * @param[in] pSrc points to the input vector
\r
2752 * @param[out] pDst points to the output vector
\r
2753 * @param[in] blockSize number of samples in the vector
\r
2755 void arm_negate_f32(
\r
2758 uint32_t blockSize);
\r
2762 * @brief Negates the elements of a Q7 vector.
\r
2763 * @param[in] pSrc points to the input vector
\r
2764 * @param[out] pDst points to the output vector
\r
2765 * @param[in] blockSize number of samples in the vector
\r
2767 void arm_negate_q7(
\r
2770 uint32_t blockSize);
\r
2774 * @brief Negates the elements of a Q15 vector.
\r
2775 * @param[in] pSrc points to the input vector
\r
2776 * @param[out] pDst points to the output vector
\r
2777 * @param[in] blockSize number of samples in the vector
\r
2779 void arm_negate_q15(
\r
2782 uint32_t blockSize);
\r
2786 * @brief Negates the elements of a Q31 vector.
\r
2787 * @param[in] pSrc points to the input vector
\r
2788 * @param[out] pDst points to the output vector
\r
2789 * @param[in] blockSize number of samples in the vector
\r
2791 void arm_negate_q31(
\r
2794 uint32_t blockSize);
\r
2798 * @brief Copies the elements of a floating-point vector.
\r
2799 * @param[in] pSrc input pointer
\r
2800 * @param[out] pDst output pointer
\r
2801 * @param[in] blockSize number of samples to process
\r
2803 void arm_copy_f32(
\r
2806 uint32_t blockSize);
\r
2810 * @brief Copies the elements of a Q7 vector.
\r
2811 * @param[in] pSrc input pointer
\r
2812 * @param[out] pDst output pointer
\r
2813 * @param[in] blockSize number of samples to process
\r
2818 uint32_t blockSize);
\r
2822 * @brief Copies the elements of a Q15 vector.
\r
2823 * @param[in] pSrc input pointer
\r
2824 * @param[out] pDst output pointer
\r
2825 * @param[in] blockSize number of samples to process
\r
2827 void arm_copy_q15(
\r
2830 uint32_t blockSize);
\r
2834 * @brief Copies the elements of a Q31 vector.
\r
2835 * @param[in] pSrc input pointer
\r
2836 * @param[out] pDst output pointer
\r
2837 * @param[in] blockSize number of samples to process
\r
2839 void arm_copy_q31(
\r
2842 uint32_t blockSize);
\r
2846 * @brief Fills a constant value into a floating-point vector.
\r
2847 * @param[in] value input value to be filled
\r
2848 * @param[out] pDst output pointer
\r
2849 * @param[in] blockSize number of samples to process
\r
2851 void arm_fill_f32(
\r
2854 uint32_t blockSize);
\r
2858 * @brief Fills a constant value into a Q7 vector.
\r
2859 * @param[in] value input value to be filled
\r
2860 * @param[out] pDst output pointer
\r
2861 * @param[in] blockSize number of samples to process
\r
2866 uint32_t blockSize);
\r
2870 * @brief Fills a constant value into a Q15 vector.
\r
2871 * @param[in] value input value to be filled
\r
2872 * @param[out] pDst output pointer
\r
2873 * @param[in] blockSize number of samples to process
\r
2875 void arm_fill_q15(
\r
2878 uint32_t blockSize);
\r
2882 * @brief Fills a constant value into a Q31 vector.
\r
2883 * @param[in] value input value to be filled
\r
2884 * @param[out] pDst output pointer
\r
2885 * @param[in] blockSize number of samples to process
\r
2887 void arm_fill_q31(
\r
2890 uint32_t blockSize);
\r
2894 * @brief Convolution of floating-point sequences.
\r
2895 * @param[in] pSrcA points to the first input sequence.
\r
2896 * @param[in] srcALen length of the first input sequence.
\r
2897 * @param[in] pSrcB points to the second input sequence.
\r
2898 * @param[in] srcBLen length of the second input sequence.
\r
2899 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
2901 void arm_conv_f32(
\r
2902 float32_t * pSrcA,
\r
2904 float32_t * pSrcB,
\r
2906 float32_t * pDst);
\r
2910 * @brief Convolution of Q15 sequences.
\r
2911 * @param[in] pSrcA points to the first input sequence.
\r
2912 * @param[in] srcALen length of the first input sequence.
\r
2913 * @param[in] pSrcB points to the second input sequence.
\r
2914 * @param[in] srcBLen length of the second input sequence.
\r
2915 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
2916 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
2917 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
2919 void arm_conv_opt_q15(
\r
2925 q15_t * pScratch1,
\r
2926 q15_t * pScratch2);
\r
2930 * @brief Convolution of Q15 sequences.
\r
2931 * @param[in] pSrcA points to the first input sequence.
\r
2932 * @param[in] srcALen length of the first input sequence.
\r
2933 * @param[in] pSrcB points to the second input sequence.
\r
2934 * @param[in] srcBLen length of the second input sequence.
\r
2935 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
2937 void arm_conv_q15(
\r
2946 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
2947 * @param[in] pSrcA points to the first input sequence.
\r
2948 * @param[in] srcALen length of the first input sequence.
\r
2949 * @param[in] pSrcB points to the second input sequence.
\r
2950 * @param[in] srcBLen length of the second input sequence.
\r
2951 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
2953 void arm_conv_fast_q15(
\r
2962 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
2963 * @param[in] pSrcA points to the first input sequence.
\r
2964 * @param[in] srcALen length of the first input sequence.
\r
2965 * @param[in] pSrcB points to the second input sequence.
\r
2966 * @param[in] srcBLen length of the second input sequence.
\r
2967 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
2968 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
2969 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
2971 void arm_conv_fast_opt_q15(
\r
2977 q15_t * pScratch1,
\r
2978 q15_t * pScratch2);
\r
2982 * @brief Convolution of Q31 sequences.
\r
2983 * @param[in] pSrcA points to the first input sequence.
\r
2984 * @param[in] srcALen length of the first input sequence.
\r
2985 * @param[in] pSrcB points to the second input sequence.
\r
2986 * @param[in] srcBLen length of the second input sequence.
\r
2987 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
2989 void arm_conv_q31(
\r
2998 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
2999 * @param[in] pSrcA points to the first input sequence.
\r
3000 * @param[in] srcALen length of the first input sequence.
\r
3001 * @param[in] pSrcB points to the second input sequence.
\r
3002 * @param[in] srcBLen length of the second input sequence.
\r
3003 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3005 void arm_conv_fast_q31(
\r
3014 * @brief Convolution of Q7 sequences.
\r
3015 * @param[in] pSrcA points to the first input sequence.
\r
3016 * @param[in] srcALen length of the first input sequence.
\r
3017 * @param[in] pSrcB points to the second input sequence.
\r
3018 * @param[in] srcBLen length of the second input sequence.
\r
3019 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3020 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3021 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3023 void arm_conv_opt_q7(
\r
3029 q15_t * pScratch1,
\r
3030 q15_t * pScratch2);
\r
3034 * @brief Convolution of Q7 sequences.
\r
3035 * @param[in] pSrcA points to the first input sequence.
\r
3036 * @param[in] srcALen length of the first input sequence.
\r
3037 * @param[in] pSrcB points to the second input sequence.
\r
3038 * @param[in] srcBLen length of the second input sequence.
\r
3039 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3050 * @brief Partial 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 block of output data
\r
3056 * @param[in] firstIndex is the first output sample to start with.
\r
3057 * @param[in] numPoints is the number of output points to be computed.
\r
3058 * @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
3060 arm_status arm_conv_partial_f32(
\r
3061 float32_t * pSrcA,
\r
3063 float32_t * pSrcB,
\r
3066 uint32_t firstIndex,
\r
3067 uint32_t numPoints);
\r
3071 * @brief Partial convolution of Q15 sequences.
\r
3072 * @param[in] pSrcA points to the first input sequence.
\r
3073 * @param[in] srcALen length of the first input sequence.
\r
3074 * @param[in] pSrcB points to the second input sequence.
\r
3075 * @param[in] srcBLen length of the second input sequence.
\r
3076 * @param[out] pDst points to the block of output data
\r
3077 * @param[in] firstIndex is the first output sample to start with.
\r
3078 * @param[in] numPoints is the number of output points to be computed.
\r
3079 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3080 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3081 * @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
3083 arm_status arm_conv_partial_opt_q15(
\r
3089 uint32_t firstIndex,
\r
3090 uint32_t numPoints,
\r
3091 q15_t * pScratch1,
\r
3092 q15_t * pScratch2);
\r
3096 * @brief Partial convolution of Q15 sequences.
\r
3097 * @param[in] pSrcA points to the first input sequence.
\r
3098 * @param[in] srcALen length of the first input sequence.
\r
3099 * @param[in] pSrcB points to the second input sequence.
\r
3100 * @param[in] srcBLen length of the second input sequence.
\r
3101 * @param[out] pDst points to the block of output data
\r
3102 * @param[in] firstIndex is the first output sample to start with.
\r
3103 * @param[in] numPoints is the number of output points to be computed.
\r
3104 * @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
3106 arm_status arm_conv_partial_q15(
\r
3112 uint32_t firstIndex,
\r
3113 uint32_t numPoints);
\r
3117 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3118 * @param[in] pSrcA points to the first input sequence.
\r
3119 * @param[in] srcALen length of the first input sequence.
\r
3120 * @param[in] pSrcB points to the second input sequence.
\r
3121 * @param[in] srcBLen length of the second input sequence.
\r
3122 * @param[out] pDst points to the block of output data
\r
3123 * @param[in] firstIndex is the first output sample to start with.
\r
3124 * @param[in] numPoints is the number of output points to be computed.
\r
3125 * @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
3127 arm_status arm_conv_partial_fast_q15(
\r
3133 uint32_t firstIndex,
\r
3134 uint32_t numPoints);
\r
3138 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3139 * @param[in] pSrcA points to the first input sequence.
\r
3140 * @param[in] srcALen length of the first input sequence.
\r
3141 * @param[in] pSrcB points to the second input sequence.
\r
3142 * @param[in] srcBLen length of the second input sequence.
\r
3143 * @param[out] pDst points to the block of output data
\r
3144 * @param[in] firstIndex is the first output sample to start with.
\r
3145 * @param[in] numPoints is the number of output points to be computed.
\r
3146 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3147 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3148 * @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
3150 arm_status arm_conv_partial_fast_opt_q15(
\r
3156 uint32_t firstIndex,
\r
3157 uint32_t numPoints,
\r
3158 q15_t * pScratch1,
\r
3159 q15_t * pScratch2);
\r
3163 * @brief Partial convolution of Q31 sequences.
\r
3164 * @param[in] pSrcA points to the first input sequence.
\r
3165 * @param[in] srcALen length of the first input sequence.
\r
3166 * @param[in] pSrcB points to the second input sequence.
\r
3167 * @param[in] srcBLen length of the second input sequence.
\r
3168 * @param[out] pDst points to the block of output data
\r
3169 * @param[in] firstIndex is the first output sample to start with.
\r
3170 * @param[in] numPoints is the number of output points to be computed.
\r
3171 * @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
3173 arm_status arm_conv_partial_q31(
\r
3179 uint32_t firstIndex,
\r
3180 uint32_t numPoints);
\r
3184 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3185 * @param[in] pSrcA points to the first input sequence.
\r
3186 * @param[in] srcALen length of the first input sequence.
\r
3187 * @param[in] pSrcB points to the second input sequence.
\r
3188 * @param[in] srcBLen length of the second input sequence.
\r
3189 * @param[out] pDst points to the block of output data
\r
3190 * @param[in] firstIndex is the first output sample to start with.
\r
3191 * @param[in] numPoints is the number of output points to be computed.
\r
3192 * @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
3194 arm_status arm_conv_partial_fast_q31(
\r
3200 uint32_t firstIndex,
\r
3201 uint32_t numPoints);
\r
3205 * @brief Partial convolution of Q7 sequences
\r
3206 * @param[in] pSrcA points to the first input sequence.
\r
3207 * @param[in] srcALen length of the first input sequence.
\r
3208 * @param[in] pSrcB points to the second input sequence.
\r
3209 * @param[in] srcBLen length of the second input sequence.
\r
3210 * @param[out] pDst points to the block of output data
\r
3211 * @param[in] firstIndex is the first output sample to start with.
\r
3212 * @param[in] numPoints is the number of output points to be computed.
\r
3213 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3214 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3215 * @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
3217 arm_status arm_conv_partial_opt_q7(
\r
3223 uint32_t firstIndex,
\r
3224 uint32_t numPoints,
\r
3225 q15_t * pScratch1,
\r
3226 q15_t * pScratch2);
\r
3230 * @brief Partial convolution of Q7 sequences.
\r
3231 * @param[in] pSrcA points to the first input sequence.
\r
3232 * @param[in] srcALen length of the first input sequence.
\r
3233 * @param[in] pSrcB points to the second input sequence.
\r
3234 * @param[in] srcBLen length of the second input sequence.
\r
3235 * @param[out] pDst points to the block of output data
\r
3236 * @param[in] firstIndex is the first output sample to start with.
\r
3237 * @param[in] numPoints is the number of output points to be computed.
\r
3238 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
\r
3240 arm_status arm_conv_partial_q7(
\r
3246 uint32_t firstIndex,
\r
3247 uint32_t numPoints);
\r
3251 * @brief Instance structure for the Q15 FIR decimator.
\r
3255 uint8_t M; /**< decimation factor. */
\r
3256 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3257 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3258 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3259 } arm_fir_decimate_instance_q15;
\r
3262 * @brief Instance structure for the Q31 FIR decimator.
\r
3266 uint8_t M; /**< decimation factor. */
\r
3267 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3268 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3269 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3270 } arm_fir_decimate_instance_q31;
\r
3273 * @brief Instance structure for the floating-point FIR decimator.
\r
3277 uint8_t M; /**< decimation factor. */
\r
3278 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3279 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3280 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3281 } arm_fir_decimate_instance_f32;
\r
3285 * @brief Processing function for the floating-point FIR decimator.
\r
3286 * @param[in] S points to an instance of the floating-point FIR decimator structure.
\r
3287 * @param[in] pSrc points to the block of input data.
\r
3288 * @param[out] pDst points to the block of output data
\r
3289 * @param[in] blockSize number of input samples to process per call.
\r
3291 void arm_fir_decimate_f32(
\r
3292 const arm_fir_decimate_instance_f32 * S,
\r
3295 uint32_t blockSize);
\r
3299 * @brief Initialization function for the floating-point FIR decimator.
\r
3300 * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
\r
3301 * @param[in] numTaps number of coefficients in the filter.
\r
3302 * @param[in] M decimation factor.
\r
3303 * @param[in] pCoeffs points to the filter coefficients.
\r
3304 * @param[in] pState points to the state buffer.
\r
3305 * @param[in] blockSize number of input samples to process per call.
\r
3306 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3307 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3309 arm_status arm_fir_decimate_init_f32(
\r
3310 arm_fir_decimate_instance_f32 * S,
\r
3313 float32_t * pCoeffs,
\r
3314 float32_t * pState,
\r
3315 uint32_t blockSize);
\r
3319 * @brief Processing function for the Q15 FIR decimator.
\r
3320 * @param[in] S points to an instance of the Q15 FIR decimator structure.
\r
3321 * @param[in] pSrc points to the block of input data.
\r
3322 * @param[out] pDst points to the block of output data
\r
3323 * @param[in] blockSize number of input samples to process per call.
\r
3325 void arm_fir_decimate_q15(
\r
3326 const arm_fir_decimate_instance_q15 * S,
\r
3329 uint32_t blockSize);
\r
3333 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3334 * @param[in] S points to an instance of the Q15 FIR decimator structure.
\r
3335 * @param[in] pSrc points to the block of input data.
\r
3336 * @param[out] pDst points to the block of output data
\r
3337 * @param[in] blockSize number of input samples to process per call.
\r
3339 void arm_fir_decimate_fast_q15(
\r
3340 const arm_fir_decimate_instance_q15 * S,
\r
3343 uint32_t blockSize);
\r
3347 * @brief Initialization function for the Q15 FIR decimator.
\r
3348 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
\r
3349 * @param[in] numTaps number of coefficients in the filter.
\r
3350 * @param[in] M decimation factor.
\r
3351 * @param[in] pCoeffs points to the filter coefficients.
\r
3352 * @param[in] pState points to the state buffer.
\r
3353 * @param[in] blockSize number of input samples to process per call.
\r
3354 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3355 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3357 arm_status arm_fir_decimate_init_q15(
\r
3358 arm_fir_decimate_instance_q15 * S,
\r
3363 uint32_t blockSize);
\r
3367 * @brief Processing function for the Q31 FIR decimator.
\r
3368 * @param[in] S points to an instance of the Q31 FIR decimator structure.
\r
3369 * @param[in] pSrc points to the block of input data.
\r
3370 * @param[out] pDst points to the block of output data
\r
3371 * @param[in] blockSize number of input samples to process per call.
\r
3373 void arm_fir_decimate_q31(
\r
3374 const arm_fir_decimate_instance_q31 * S,
\r
3377 uint32_t blockSize);
\r
3380 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3381 * @param[in] S points to an instance of the Q31 FIR decimator structure.
\r
3382 * @param[in] pSrc points to the block of input data.
\r
3383 * @param[out] pDst points to the block of output data
\r
3384 * @param[in] blockSize number of input samples to process per call.
\r
3386 void arm_fir_decimate_fast_q31(
\r
3387 arm_fir_decimate_instance_q31 * S,
\r
3390 uint32_t blockSize);
\r
3394 * @brief Initialization function for the Q31 FIR decimator.
\r
3395 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
\r
3396 * @param[in] numTaps number of coefficients in the filter.
\r
3397 * @param[in] M decimation factor.
\r
3398 * @param[in] pCoeffs points to the filter coefficients.
\r
3399 * @param[in] pState points to the state buffer.
\r
3400 * @param[in] blockSize number of input samples to process per call.
\r
3401 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3402 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3404 arm_status arm_fir_decimate_init_q31(
\r
3405 arm_fir_decimate_instance_q31 * S,
\r
3410 uint32_t blockSize);
\r
3414 * @brief Instance structure for the Q15 FIR interpolator.
\r
3418 uint8_t L; /**< upsample factor. */
\r
3419 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3420 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3421 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3422 } arm_fir_interpolate_instance_q15;
\r
3425 * @brief Instance structure for the Q31 FIR interpolator.
\r
3429 uint8_t L; /**< upsample factor. */
\r
3430 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3431 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3432 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3433 } arm_fir_interpolate_instance_q31;
\r
3436 * @brief Instance structure for the floating-point FIR interpolator.
\r
3440 uint8_t L; /**< upsample factor. */
\r
3441 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3442 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3443 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
\r
3444 } arm_fir_interpolate_instance_f32;
\r
3448 * @brief Processing function for the Q15 FIR interpolator.
\r
3449 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
\r
3450 * @param[in] pSrc points to the block of input data.
\r
3451 * @param[out] pDst points to the block of output data.
\r
3452 * @param[in] blockSize number of input samples to process per call.
\r
3454 void arm_fir_interpolate_q15(
\r
3455 const arm_fir_interpolate_instance_q15 * S,
\r
3458 uint32_t blockSize);
\r
3462 * @brief Initialization function for the Q15 FIR interpolator.
\r
3463 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
\r
3464 * @param[in] L upsample factor.
\r
3465 * @param[in] numTaps number of filter coefficients in the filter.
\r
3466 * @param[in] pCoeffs points to the filter coefficient buffer.
\r
3467 * @param[in] pState points to the state buffer.
\r
3468 * @param[in] blockSize number of input samples to process per call.
\r
3469 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3470 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3472 arm_status arm_fir_interpolate_init_q15(
\r
3473 arm_fir_interpolate_instance_q15 * S,
\r
3478 uint32_t blockSize);
\r
3482 * @brief Processing function for the Q31 FIR interpolator.
\r
3483 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
\r
3484 * @param[in] pSrc points to the block of input data.
\r
3485 * @param[out] pDst points to the block of output data.
\r
3486 * @param[in] blockSize number of input samples to process per call.
\r
3488 void arm_fir_interpolate_q31(
\r
3489 const arm_fir_interpolate_instance_q31 * S,
\r
3492 uint32_t blockSize);
\r
3496 * @brief Initialization function for the Q31 FIR interpolator.
\r
3497 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
\r
3498 * @param[in] L upsample factor.
\r
3499 * @param[in] numTaps number of filter coefficients in the filter.
\r
3500 * @param[in] pCoeffs points to the filter coefficient buffer.
\r
3501 * @param[in] pState points to the state buffer.
\r
3502 * @param[in] blockSize number of input samples to process per call.
\r
3503 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3504 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3506 arm_status arm_fir_interpolate_init_q31(
\r
3507 arm_fir_interpolate_instance_q31 * S,
\r
3512 uint32_t blockSize);
\r
3516 * @brief Processing function for the floating-point FIR interpolator.
\r
3517 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
\r
3518 * @param[in] pSrc points to the block of input data.
\r
3519 * @param[out] pDst points to the block of output data.
\r
3520 * @param[in] blockSize number of input samples to process per call.
\r
3522 void arm_fir_interpolate_f32(
\r
3523 const arm_fir_interpolate_instance_f32 * S,
\r
3526 uint32_t blockSize);
\r
3530 * @brief Initialization function for the floating-point FIR interpolator.
\r
3531 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
\r
3532 * @param[in] L upsample factor.
\r
3533 * @param[in] numTaps number of filter coefficients in the filter.
\r
3534 * @param[in] pCoeffs points to the filter coefficient buffer.
\r
3535 * @param[in] pState points to the state buffer.
\r
3536 * @param[in] blockSize number of input samples to process per call.
\r
3537 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3538 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3540 arm_status arm_fir_interpolate_init_f32(
\r
3541 arm_fir_interpolate_instance_f32 * S,
\r
3544 float32_t * pCoeffs,
\r
3545 float32_t * pState,
\r
3546 uint32_t blockSize);
\r
3550 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
\r
3554 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3555 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3556 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3557 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
\r
3558 } arm_biquad_cas_df1_32x64_ins_q31;
\r
3562 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter 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 samples to process.
\r
3567 void arm_biquad_cas_df1_32x64_q31(
\r
3568 const arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3571 uint32_t blockSize);
\r
3575 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3576 * @param[in] numStages number of 2nd order stages in the filter.
\r
3577 * @param[in] pCoeffs points to the filter coefficients.
\r
3578 * @param[in] pState points to the state buffer.
\r
3579 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
\r
3581 void arm_biquad_cas_df1_32x64_init_q31(
\r
3582 arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3583 uint8_t numStages,
\r
3586 uint8_t postShift);
\r
3590 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3594 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3595 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3596 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3597 } arm_biquad_cascade_df2T_instance_f32;
\r
3600 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3604 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3605 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3606 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3607 } arm_biquad_cascade_stereo_df2T_instance_f32;
\r
3610 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3614 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3615 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3616 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3617 } arm_biquad_cascade_df2T_instance_f64;
\r
3621 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3622 * @param[in] S points to an instance of the filter data structure.
\r
3623 * @param[in] pSrc points to the block of input data.
\r
3624 * @param[out] pDst points to the block of output data
\r
3625 * @param[in] blockSize number of samples to process.
\r
3627 void arm_biquad_cascade_df2T_f32(
\r
3628 const arm_biquad_cascade_df2T_instance_f32 * S,
\r
3631 uint32_t blockSize);
\r
3635 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
\r
3636 * @param[in] S points to an instance of the filter data structure.
\r
3637 * @param[in] pSrc points to the block of input data.
\r
3638 * @param[out] pDst points to the block of output data
\r
3639 * @param[in] blockSize number of samples to process.
\r
3641 void arm_biquad_cascade_stereo_df2T_f32(
\r
3642 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3645 uint32_t blockSize);
\r
3649 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3650 * @param[in] S points to an instance of the filter data structure.
\r
3651 * @param[in] pSrc points to the block of input data.
\r
3652 * @param[out] pDst points to the block of output data
\r
3653 * @param[in] blockSize number of samples to process.
\r
3655 void arm_biquad_cascade_df2T_f64(
\r
3656 const arm_biquad_cascade_df2T_instance_f64 * S,
\r
3659 uint32_t blockSize);
\r
3663 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3664 * @param[in,out] S points to an instance of the filter data structure.
\r
3665 * @param[in] numStages number of 2nd order stages in the filter.
\r
3666 * @param[in] pCoeffs points to the filter coefficients.
\r
3667 * @param[in] pState points to the state buffer.
\r
3669 void arm_biquad_cascade_df2T_init_f32(
\r
3670 arm_biquad_cascade_df2T_instance_f32 * S,
\r
3671 uint8_t numStages,
\r
3672 float32_t * pCoeffs,
\r
3673 float32_t * pState);
\r
3677 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3678 * @param[in,out] S points to an instance of the filter data structure.
\r
3679 * @param[in] numStages number of 2nd order stages in the filter.
\r
3680 * @param[in] pCoeffs points to the filter coefficients.
\r
3681 * @param[in] pState points to the state buffer.
\r
3683 void arm_biquad_cascade_stereo_df2T_init_f32(
\r
3684 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3685 uint8_t numStages,
\r
3686 float32_t * pCoeffs,
\r
3687 float32_t * pState);
\r
3691 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3692 * @param[in,out] S points to an instance of the filter data structure.
\r
3693 * @param[in] numStages number of 2nd order stages in the filter.
\r
3694 * @param[in] pCoeffs points to the filter coefficients.
\r
3695 * @param[in] pState points to the state buffer.
\r
3697 void arm_biquad_cascade_df2T_init_f64(
\r
3698 arm_biquad_cascade_df2T_instance_f64 * S,
\r
3699 uint8_t numStages,
\r
3700 float64_t * pCoeffs,
\r
3701 float64_t * pState);
\r
3705 * @brief Instance structure for the Q15 FIR lattice filter.
\r
3709 uint16_t numStages; /**< number of filter stages. */
\r
3710 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3711 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3712 } arm_fir_lattice_instance_q15;
\r
3715 * @brief Instance structure for the Q31 FIR lattice filter.
\r
3719 uint16_t numStages; /**< number of filter stages. */
\r
3720 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3721 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3722 } arm_fir_lattice_instance_q31;
\r
3725 * @brief Instance structure for the floating-point FIR lattice filter.
\r
3729 uint16_t numStages; /**< number of filter stages. */
\r
3730 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3731 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3732 } arm_fir_lattice_instance_f32;
\r
3736 * @brief Initialization function for the Q15 FIR lattice filter.
\r
3737 * @param[in] S points to an instance of the Q15 FIR lattice structure.
\r
3738 * @param[in] numStages number of filter stages.
\r
3739 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3740 * @param[in] pState points to the state buffer. The array is of length numStages.
\r
3742 void arm_fir_lattice_init_q15(
\r
3743 arm_fir_lattice_instance_q15 * S,
\r
3744 uint16_t numStages,
\r
3750 * @brief Processing function for the Q15 FIR lattice filter.
\r
3751 * @param[in] S points to an instance of the Q15 FIR lattice structure.
\r
3752 * @param[in] pSrc points to the block of input data.
\r
3753 * @param[out] pDst points to the block of output data.
\r
3754 * @param[in] blockSize number of samples to process.
\r
3756 void arm_fir_lattice_q15(
\r
3757 const arm_fir_lattice_instance_q15 * S,
\r
3760 uint32_t blockSize);
\r
3764 * @brief Initialization function for the Q31 FIR lattice filter.
\r
3765 * @param[in] S points to an instance of the Q31 FIR lattice structure.
\r
3766 * @param[in] numStages number of filter stages.
\r
3767 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3768 * @param[in] pState points to the state buffer. The array is of length numStages.
\r
3770 void arm_fir_lattice_init_q31(
\r
3771 arm_fir_lattice_instance_q31 * S,
\r
3772 uint16_t numStages,
\r
3778 * @brief Processing function for the Q31 FIR lattice filter.
\r
3779 * @param[in] S points to an instance of the Q31 FIR lattice structure.
\r
3780 * @param[in] pSrc points to the block of input data.
\r
3781 * @param[out] pDst points to the block of output data
\r
3782 * @param[in] blockSize number of samples to process.
\r
3784 void arm_fir_lattice_q31(
\r
3785 const arm_fir_lattice_instance_q31 * S,
\r
3788 uint32_t blockSize);
\r
3792 * @brief Initialization function for the floating-point FIR lattice filter.
\r
3793 * @param[in] S points to an instance of the floating-point FIR lattice structure.
\r
3794 * @param[in] numStages number of filter stages.
\r
3795 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3796 * @param[in] pState points to the state buffer. The array is of length numStages.
\r
3798 void arm_fir_lattice_init_f32(
\r
3799 arm_fir_lattice_instance_f32 * S,
\r
3800 uint16_t numStages,
\r
3801 float32_t * pCoeffs,
\r
3802 float32_t * pState);
\r
3806 * @brief Processing function for the floating-point FIR lattice filter.
\r
3807 * @param[in] S points to an instance of the floating-point FIR lattice structure.
\r
3808 * @param[in] pSrc points to the block of input data.
\r
3809 * @param[out] pDst points to the block of output data
\r
3810 * @param[in] blockSize number of samples to process.
\r
3812 void arm_fir_lattice_f32(
\r
3813 const arm_fir_lattice_instance_f32 * S,
\r
3816 uint32_t blockSize);
\r
3820 * @brief Instance structure for the Q15 IIR lattice filter.
\r
3824 uint16_t numStages; /**< number of stages in the filter. */
\r
3825 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3826 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3827 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3828 } arm_iir_lattice_instance_q15;
\r
3831 * @brief Instance structure for the Q31 IIR lattice filter.
\r
3835 uint16_t numStages; /**< number of stages in the filter. */
\r
3836 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3837 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3838 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3839 } arm_iir_lattice_instance_q31;
\r
3842 * @brief Instance structure for the floating-point IIR lattice filter.
\r
3846 uint16_t numStages; /**< number of stages in the filter. */
\r
3847 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3848 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3849 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3850 } arm_iir_lattice_instance_f32;
\r
3854 * @brief Processing function for the floating-point IIR lattice filter.
\r
3855 * @param[in] S points to an instance of the floating-point IIR lattice structure.
\r
3856 * @param[in] pSrc points to the block of input data.
\r
3857 * @param[out] pDst points to the block of output data.
\r
3858 * @param[in] blockSize number of samples to process.
\r
3860 void arm_iir_lattice_f32(
\r
3861 const arm_iir_lattice_instance_f32 * S,
\r
3864 uint32_t blockSize);
\r
3868 * @brief Initialization function for the floating-point IIR lattice filter.
\r
3869 * @param[in] S points to an instance of the floating-point IIR lattice structure.
\r
3870 * @param[in] numStages number of stages in the filter.
\r
3871 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
3872 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
3873 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
\r
3874 * @param[in] blockSize number of samples to process.
\r
3876 void arm_iir_lattice_init_f32(
\r
3877 arm_iir_lattice_instance_f32 * S,
\r
3878 uint16_t numStages,
\r
3879 float32_t * pkCoeffs,
\r
3880 float32_t * pvCoeffs,
\r
3881 float32_t * pState,
\r
3882 uint32_t blockSize);
\r
3886 * @brief Processing function for the Q31 IIR lattice filter.
\r
3887 * @param[in] S points to an instance of the Q31 IIR lattice structure.
\r
3888 * @param[in] pSrc points to the block of input data.
\r
3889 * @param[out] pDst points to the block of output data.
\r
3890 * @param[in] blockSize number of samples to process.
\r
3892 void arm_iir_lattice_q31(
\r
3893 const arm_iir_lattice_instance_q31 * S,
\r
3896 uint32_t blockSize);
\r
3900 * @brief Initialization function for the Q31 IIR lattice filter.
\r
3901 * @param[in] S points to an instance of the Q31 IIR lattice structure.
\r
3902 * @param[in] numStages number of stages in the filter.
\r
3903 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
3904 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
3905 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
\r
3906 * @param[in] blockSize number of samples to process.
\r
3908 void arm_iir_lattice_init_q31(
\r
3909 arm_iir_lattice_instance_q31 * S,
\r
3910 uint16_t numStages,
\r
3914 uint32_t blockSize);
\r
3918 * @brief Processing function for the Q15 IIR lattice filter.
\r
3919 * @param[in] S points to an instance of the Q15 IIR lattice structure.
\r
3920 * @param[in] pSrc points to the block of input data.
\r
3921 * @param[out] pDst points to the block of output data.
\r
3922 * @param[in] blockSize number of samples to process.
\r
3924 void arm_iir_lattice_q15(
\r
3925 const arm_iir_lattice_instance_q15 * S,
\r
3928 uint32_t blockSize);
\r
3932 * @brief Initialization function for the Q15 IIR lattice filter.
\r
3933 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
\r
3934 * @param[in] numStages number of stages in the filter.
\r
3935 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
\r
3936 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
\r
3937 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
\r
3938 * @param[in] blockSize number of samples to process per call.
\r
3940 void arm_iir_lattice_init_q15(
\r
3941 arm_iir_lattice_instance_q15 * S,
\r
3942 uint16_t numStages,
\r
3946 uint32_t blockSize);
\r
3950 * @brief Instance structure for the floating-point LMS filter.
\r
3954 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3955 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3956 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
3957 float32_t mu; /**< step size that controls filter coefficient updates. */
\r
3958 } arm_lms_instance_f32;
\r
3962 * @brief Processing function for floating-point LMS filter.
\r
3963 * @param[in] S points to an instance of the floating-point LMS filter structure.
\r
3964 * @param[in] pSrc points to the block of input data.
\r
3965 * @param[in] pRef points to the block of reference data.
\r
3966 * @param[out] pOut points to the block of output data.
\r
3967 * @param[out] pErr points to the block of error data.
\r
3968 * @param[in] blockSize number of samples to process.
\r
3971 const arm_lms_instance_f32 * S,
\r
3976 uint32_t blockSize);
\r
3980 * @brief Initialization function for floating-point LMS filter.
\r
3981 * @param[in] S points to an instance of the floating-point LMS filter structure.
\r
3982 * @param[in] numTaps number of filter coefficients.
\r
3983 * @param[in] pCoeffs points to the coefficient buffer.
\r
3984 * @param[in] pState points to state buffer.
\r
3985 * @param[in] mu step size that controls filter coefficient updates.
\r
3986 * @param[in] blockSize number of samples to process.
\r
3988 void arm_lms_init_f32(
\r
3989 arm_lms_instance_f32 * S,
\r
3991 float32_t * pCoeffs,
\r
3992 float32_t * pState,
\r
3994 uint32_t blockSize);
\r
3998 * @brief Instance structure for the Q15 LMS filter.
\r
4002 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4003 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4004 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4005 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4006 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4007 } arm_lms_instance_q15;
\r
4011 * @brief Initialization function for the Q15 LMS filter.
\r
4012 * @param[in] S points to an instance of the Q15 LMS filter structure.
\r
4013 * @param[in] numTaps number of filter coefficients.
\r
4014 * @param[in] pCoeffs points to the coefficient buffer.
\r
4015 * @param[in] pState points to the state buffer.
\r
4016 * @param[in] mu step size that controls filter coefficient updates.
\r
4017 * @param[in] blockSize number of samples to process.
\r
4018 * @param[in] postShift bit shift applied to coefficients.
\r
4020 void arm_lms_init_q15(
\r
4021 arm_lms_instance_q15 * S,
\r
4026 uint32_t blockSize,
\r
4027 uint32_t postShift);
\r
4031 * @brief Processing function for Q15 LMS filter.
\r
4032 * @param[in] S points to an instance of the Q15 LMS filter structure.
\r
4033 * @param[in] pSrc points to the block of input data.
\r
4034 * @param[in] pRef points to the block of reference data.
\r
4035 * @param[out] pOut points to the block of output data.
\r
4036 * @param[out] pErr points to the block of error data.
\r
4037 * @param[in] blockSize number of samples to process.
\r
4040 const arm_lms_instance_q15 * S,
\r
4045 uint32_t blockSize);
\r
4049 * @brief Instance structure for the Q31 LMS filter.
\r
4053 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4054 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4055 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4056 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4057 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4058 } arm_lms_instance_q31;
\r
4062 * @brief Processing function for Q31 LMS filter.
\r
4063 * @param[in] S points to an instance of the Q15 LMS filter structure.
\r
4064 * @param[in] pSrc points to the block of input data.
\r
4065 * @param[in] pRef points to the block of reference data.
\r
4066 * @param[out] pOut points to the block of output data.
\r
4067 * @param[out] pErr points to the block of error data.
\r
4068 * @param[in] blockSize number of samples to process.
\r
4071 const arm_lms_instance_q31 * S,
\r
4076 uint32_t blockSize);
\r
4080 * @brief Initialization function for Q31 LMS filter.
\r
4081 * @param[in] S points to an instance of the Q31 LMS filter structure.
\r
4082 * @param[in] numTaps number of filter coefficients.
\r
4083 * @param[in] pCoeffs points to coefficient buffer.
\r
4084 * @param[in] pState points to state buffer.
\r
4085 * @param[in] mu step size that controls filter coefficient updates.
\r
4086 * @param[in] blockSize number of samples to process.
\r
4087 * @param[in] postShift bit shift applied to coefficients.
\r
4089 void arm_lms_init_q31(
\r
4090 arm_lms_instance_q31 * S,
\r
4095 uint32_t blockSize,
\r
4096 uint32_t postShift);
\r
4100 * @brief Instance structure for the floating-point normalized LMS filter.
\r
4104 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4105 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4106 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4107 float32_t mu; /**< step size that control filter coefficient updates. */
\r
4108 float32_t energy; /**< saves previous frame energy. */
\r
4109 float32_t x0; /**< saves previous input sample. */
\r
4110 } arm_lms_norm_instance_f32;
\r
4114 * @brief Processing function for floating-point normalized LMS filter.
\r
4115 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
\r
4116 * @param[in] pSrc points to the block of input data.
\r
4117 * @param[in] pRef points to the block of reference data.
\r
4118 * @param[out] pOut points to the block of output data.
\r
4119 * @param[out] pErr points to the block of error data.
\r
4120 * @param[in] blockSize number of samples to process.
\r
4122 void arm_lms_norm_f32(
\r
4123 arm_lms_norm_instance_f32 * S,
\r
4128 uint32_t blockSize);
\r
4132 * @brief Initialization function for floating-point normalized LMS filter.
\r
4133 * @param[in] S points to an instance of the floating-point LMS filter structure.
\r
4134 * @param[in] numTaps number of filter coefficients.
\r
4135 * @param[in] pCoeffs points to coefficient buffer.
\r
4136 * @param[in] pState points to state buffer.
\r
4137 * @param[in] mu step size that controls filter coefficient updates.
\r
4138 * @param[in] blockSize number of samples to process.
\r
4140 void arm_lms_norm_init_f32(
\r
4141 arm_lms_norm_instance_f32 * S,
\r
4143 float32_t * pCoeffs,
\r
4144 float32_t * pState,
\r
4146 uint32_t blockSize);
\r
4150 * @brief Instance structure for the Q31 normalized LMS filter.
\r
4154 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4155 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4156 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4157 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4158 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4159 q31_t *recipTable; /**< points to the reciprocal initial value table. */
\r
4160 q31_t energy; /**< saves previous frame energy. */
\r
4161 q31_t x0; /**< saves previous input sample. */
\r
4162 } arm_lms_norm_instance_q31;
\r
4166 * @brief Processing function for Q31 normalized LMS filter.
\r
4167 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
\r
4168 * @param[in] pSrc points to the block of input data.
\r
4169 * @param[in] pRef points to the block of reference data.
\r
4170 * @param[out] pOut points to the block of output data.
\r
4171 * @param[out] pErr points to the block of error data.
\r
4172 * @param[in] blockSize number of samples to process.
\r
4174 void arm_lms_norm_q31(
\r
4175 arm_lms_norm_instance_q31 * S,
\r
4180 uint32_t blockSize);
\r
4184 * @brief Initialization function for Q31 normalized LMS filter.
\r
4185 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
\r
4186 * @param[in] numTaps number of filter coefficients.
\r
4187 * @param[in] pCoeffs points to coefficient buffer.
\r
4188 * @param[in] pState points to state buffer.
\r
4189 * @param[in] mu step size that controls filter coefficient updates.
\r
4190 * @param[in] blockSize number of samples to process.
\r
4191 * @param[in] postShift bit shift applied to coefficients.
\r
4193 void arm_lms_norm_init_q31(
\r
4194 arm_lms_norm_instance_q31 * S,
\r
4199 uint32_t blockSize,
\r
4200 uint8_t postShift);
\r
4204 * @brief Instance structure for the Q15 normalized LMS filter.
\r
4208 uint16_t numTaps; /**< Number of coefficients in the filter. */
\r
4209 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4210 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4211 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4212 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4213 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
\r
4214 q15_t energy; /**< saves previous frame energy. */
\r
4215 q15_t x0; /**< saves previous input sample. */
\r
4216 } arm_lms_norm_instance_q15;
\r
4220 * @brief Processing function for Q15 normalized LMS filter.
\r
4221 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
\r
4222 * @param[in] pSrc points to the block of input data.
\r
4223 * @param[in] pRef points to the block of reference data.
\r
4224 * @param[out] pOut points to the block of output data.
\r
4225 * @param[out] pErr points to the block of error data.
\r
4226 * @param[in] blockSize number of samples to process.
\r
4228 void arm_lms_norm_q15(
\r
4229 arm_lms_norm_instance_q15 * S,
\r
4234 uint32_t blockSize);
\r
4238 * @brief Initialization function for Q15 normalized LMS filter.
\r
4239 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
\r
4240 * @param[in] numTaps number of filter coefficients.
\r
4241 * @param[in] pCoeffs points to coefficient buffer.
\r
4242 * @param[in] pState points to state buffer.
\r
4243 * @param[in] mu step size that controls filter coefficient updates.
\r
4244 * @param[in] blockSize number of samples to process.
\r
4245 * @param[in] postShift bit shift applied to coefficients.
\r
4247 void arm_lms_norm_init_q15(
\r
4248 arm_lms_norm_instance_q15 * S,
\r
4253 uint32_t blockSize,
\r
4254 uint8_t postShift);
\r
4258 * @brief Correlation of floating-point sequences.
\r
4259 * @param[in] pSrcA points to the first input sequence.
\r
4260 * @param[in] srcALen length of the first input sequence.
\r
4261 * @param[in] pSrcB points to the second input sequence.
\r
4262 * @param[in] srcBLen length of the second input sequence.
\r
4263 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4265 void arm_correlate_f32(
\r
4266 float32_t * pSrcA,
\r
4268 float32_t * pSrcB,
\r
4270 float32_t * pDst);
\r
4274 * @brief Correlation of Q15 sequences
\r
4275 * @param[in] pSrcA points to the first input sequence.
\r
4276 * @param[in] srcALen length of the first input sequence.
\r
4277 * @param[in] pSrcB points to the second input sequence.
\r
4278 * @param[in] srcBLen length of the second input sequence.
\r
4279 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4280 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4282 void arm_correlate_opt_q15(
\r
4288 q15_t * pScratch);
\r
4292 * @brief Correlation of Q15 sequences.
\r
4293 * @param[in] pSrcA points to the first input sequence.
\r
4294 * @param[in] srcALen length of the first input sequence.
\r
4295 * @param[in] pSrcB points to the second input sequence.
\r
4296 * @param[in] srcBLen length of the second input sequence.
\r
4297 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4300 void arm_correlate_q15(
\r
4309 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4310 * @param[in] pSrcA points to the first input sequence.
\r
4311 * @param[in] srcALen length of the first input sequence.
\r
4312 * @param[in] pSrcB points to the second input sequence.
\r
4313 * @param[in] srcBLen length of the second input sequence.
\r
4314 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4317 void arm_correlate_fast_q15(
\r
4326 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4327 * @param[in] pSrcA points to the first input sequence.
\r
4328 * @param[in] srcALen length of the first input sequence.
\r
4329 * @param[in] pSrcB points to the second input sequence.
\r
4330 * @param[in] srcBLen length of the second input sequence.
\r
4331 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4332 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4334 void arm_correlate_fast_opt_q15(
\r
4340 q15_t * pScratch);
\r
4344 * @brief Correlation of Q31 sequences.
\r
4345 * @param[in] pSrcA points to the first input sequence.
\r
4346 * @param[in] srcALen length of the first input sequence.
\r
4347 * @param[in] pSrcB points to the second input sequence.
\r
4348 * @param[in] srcBLen length of the second input sequence.
\r
4349 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4351 void arm_correlate_q31(
\r
4360 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
4361 * @param[in] pSrcA points to the first input sequence.
\r
4362 * @param[in] srcALen length of the first input sequence.
\r
4363 * @param[in] pSrcB points to the second input sequence.
\r
4364 * @param[in] srcBLen length of the second input sequence.
\r
4365 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4367 void arm_correlate_fast_q31(
\r
4376 * @brief Correlation of Q7 sequences.
\r
4377 * @param[in] pSrcA points to the first input sequence.
\r
4378 * @param[in] srcALen length of the first input sequence.
\r
4379 * @param[in] pSrcB points to the second input sequence.
\r
4380 * @param[in] srcBLen length of the second input sequence.
\r
4381 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4382 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4383 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
4385 void arm_correlate_opt_q7(
\r
4391 q15_t * pScratch1,
\r
4392 q15_t * pScratch2);
\r
4396 * @brief Correlation of Q7 sequences.
\r
4397 * @param[in] pSrcA points to the first input sequence.
\r
4398 * @param[in] srcALen length of the first input sequence.
\r
4399 * @param[in] pSrcB points to the second input sequence.
\r
4400 * @param[in] srcBLen length of the second input sequence.
\r
4401 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4403 void arm_correlate_q7(
\r
4412 * @brief Instance structure for the floating-point sparse FIR filter.
\r
4416 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4417 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4418 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4419 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4420 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4421 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4422 } arm_fir_sparse_instance_f32;
\r
4425 * @brief Instance structure for the Q31 sparse FIR filter.
\r
4429 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4430 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4431 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4432 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4433 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4434 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4435 } arm_fir_sparse_instance_q31;
\r
4438 * @brief Instance structure for the Q15 sparse FIR filter.
\r
4442 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4443 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4444 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4445 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4446 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4447 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4448 } arm_fir_sparse_instance_q15;
\r
4451 * @brief Instance structure for the Q7 sparse FIR filter.
\r
4455 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4456 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4457 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4458 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4459 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4460 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4461 } arm_fir_sparse_instance_q7;
\r
4465 * @brief Processing function for the floating-point sparse FIR filter.
\r
4466 * @param[in] S points to an instance of the floating-point sparse FIR structure.
\r
4467 * @param[in] pSrc points to the block of input data.
\r
4468 * @param[out] pDst points to the block of output data
\r
4469 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4470 * @param[in] blockSize number of input samples to process per call.
\r
4472 void arm_fir_sparse_f32(
\r
4473 arm_fir_sparse_instance_f32 * S,
\r
4476 float32_t * pScratchIn,
\r
4477 uint32_t blockSize);
\r
4481 * @brief Initialization function for the floating-point sparse FIR filter.
\r
4482 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
\r
4483 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4484 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4485 * @param[in] pState points to the state buffer.
\r
4486 * @param[in] pTapDelay points to the array of offset times.
\r
4487 * @param[in] maxDelay maximum offset time supported.
\r
4488 * @param[in] blockSize number of samples that will be processed per block.
\r
4490 void arm_fir_sparse_init_f32(
\r
4491 arm_fir_sparse_instance_f32 * S,
\r
4493 float32_t * pCoeffs,
\r
4494 float32_t * pState,
\r
4495 int32_t * pTapDelay,
\r
4496 uint16_t maxDelay,
\r
4497 uint32_t blockSize);
\r
4501 * @brief Processing function for the Q31 sparse FIR filter.
\r
4502 * @param[in] S points to an instance of the Q31 sparse FIR structure.
\r
4503 * @param[in] pSrc points to the block of input data.
\r
4504 * @param[out] pDst points to the block of output data
\r
4505 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4506 * @param[in] blockSize number of input samples to process per call.
\r
4508 void arm_fir_sparse_q31(
\r
4509 arm_fir_sparse_instance_q31 * S,
\r
4512 q31_t * pScratchIn,
\r
4513 uint32_t blockSize);
\r
4517 * @brief Initialization function for the Q31 sparse FIR filter.
\r
4518 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
\r
4519 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4520 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4521 * @param[in] pState points to the state buffer.
\r
4522 * @param[in] pTapDelay points to the array of offset times.
\r
4523 * @param[in] maxDelay maximum offset time supported.
\r
4524 * @param[in] blockSize number of samples that will be processed per block.
\r
4526 void arm_fir_sparse_init_q31(
\r
4527 arm_fir_sparse_instance_q31 * S,
\r
4531 int32_t * pTapDelay,
\r
4532 uint16_t maxDelay,
\r
4533 uint32_t blockSize);
\r
4537 * @brief Processing function for the Q15 sparse FIR filter.
\r
4538 * @param[in] S points to an instance of the Q15 sparse FIR structure.
\r
4539 * @param[in] pSrc points to the block of input data.
\r
4540 * @param[out] pDst points to the block of output data
\r
4541 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4542 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
\r
4543 * @param[in] blockSize number of input samples to process per call.
\r
4545 void arm_fir_sparse_q15(
\r
4546 arm_fir_sparse_instance_q15 * S,
\r
4549 q15_t * pScratchIn,
\r
4550 q31_t * pScratchOut,
\r
4551 uint32_t blockSize);
\r
4555 * @brief Initialization function for the Q15 sparse FIR filter.
\r
4556 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
\r
4557 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4558 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4559 * @param[in] pState points to the state buffer.
\r
4560 * @param[in] pTapDelay points to the array of offset times.
\r
4561 * @param[in] maxDelay maximum offset time supported.
\r
4562 * @param[in] blockSize number of samples that will be processed per block.
\r
4564 void arm_fir_sparse_init_q15(
\r
4565 arm_fir_sparse_instance_q15 * S,
\r
4569 int32_t * pTapDelay,
\r
4570 uint16_t maxDelay,
\r
4571 uint32_t blockSize);
\r
4575 * @brief Processing function for the Q7 sparse FIR filter.
\r
4576 * @param[in] S points to an instance of the Q7 sparse FIR structure.
\r
4577 * @param[in] pSrc points to the block of input data.
\r
4578 * @param[out] pDst points to the block of output data
\r
4579 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4580 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
\r
4581 * @param[in] blockSize number of input samples to process per call.
\r
4583 void arm_fir_sparse_q7(
\r
4584 arm_fir_sparse_instance_q7 * S,
\r
4587 q7_t * pScratchIn,
\r
4588 q31_t * pScratchOut,
\r
4589 uint32_t blockSize);
\r
4593 * @brief Initialization function for the Q7 sparse FIR filter.
\r
4594 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
\r
4595 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4596 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4597 * @param[in] pState points to the state buffer.
\r
4598 * @param[in] pTapDelay points to the array of offset times.
\r
4599 * @param[in] maxDelay maximum offset time supported.
\r
4600 * @param[in] blockSize number of samples that will be processed per block.
\r
4602 void arm_fir_sparse_init_q7(
\r
4603 arm_fir_sparse_instance_q7 * S,
\r
4607 int32_t * pTapDelay,
\r
4608 uint16_t maxDelay,
\r
4609 uint32_t blockSize);
\r
4613 * @brief Floating-point sin_cos function.
\r
4614 * @param[in] theta input value in degrees
\r
4615 * @param[out] pSinVal points to the processed sine output.
\r
4616 * @param[out] pCosVal points to the processed cos output.
\r
4618 void arm_sin_cos_f32(
\r
4620 float32_t * pSinVal,
\r
4621 float32_t * pCosVal);
\r
4625 * @brief Q31 sin_cos function.
\r
4626 * @param[in] theta scaled input value in degrees
\r
4627 * @param[out] pSinVal points to the processed sine output.
\r
4628 * @param[out] pCosVal points to the processed cosine output.
\r
4630 void arm_sin_cos_q31(
\r
4637 * @brief Floating-point complex conjugate.
\r
4638 * @param[in] pSrc points to the input vector
\r
4639 * @param[out] pDst points to the output vector
\r
4640 * @param[in] numSamples number of complex samples in each vector
\r
4642 void arm_cmplx_conj_f32(
\r
4645 uint32_t numSamples);
\r
4648 * @brief Q31 complex conjugate.
\r
4649 * @param[in] pSrc points to the input vector
\r
4650 * @param[out] pDst points to the output vector
\r
4651 * @param[in] numSamples number of complex samples in each vector
\r
4653 void arm_cmplx_conj_q31(
\r
4656 uint32_t numSamples);
\r
4660 * @brief Q15 complex conjugate.
\r
4661 * @param[in] pSrc points to the input vector
\r
4662 * @param[out] pDst points to the output vector
\r
4663 * @param[in] numSamples number of complex samples in each vector
\r
4665 void arm_cmplx_conj_q15(
\r
4668 uint32_t numSamples);
\r
4672 * @brief Floating-point complex magnitude squared
\r
4673 * @param[in] pSrc points to the complex input vector
\r
4674 * @param[out] pDst points to the real output vector
\r
4675 * @param[in] numSamples number of complex samples in the input vector
\r
4677 void arm_cmplx_mag_squared_f32(
\r
4680 uint32_t numSamples);
\r
4684 * @brief Q31 complex magnitude squared
\r
4685 * @param[in] pSrc points to the complex input vector
\r
4686 * @param[out] pDst points to the real output vector
\r
4687 * @param[in] numSamples number of complex samples in the input vector
\r
4689 void arm_cmplx_mag_squared_q31(
\r
4692 uint32_t numSamples);
\r
4696 * @brief Q15 complex magnitude squared
\r
4697 * @param[in] pSrc points to the complex input vector
\r
4698 * @param[out] pDst points to the real output vector
\r
4699 * @param[in] numSamples number of complex samples in the input vector
\r
4701 void arm_cmplx_mag_squared_q15(
\r
4704 uint32_t numSamples);
\r
4708 * @ingroup groupController
\r
4712 * @defgroup PID PID Motor Control
\r
4714 * A Proportional Integral Derivative (PID) controller is a generic feedback control
\r
4715 * loop mechanism widely used in industrial control systems.
\r
4716 * A PID controller is the most commonly used type of feedback controller.
\r
4718 * This set of functions implements (PID) controllers
\r
4719 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
\r
4720 * of data and each call to the function returns a single processed value.
\r
4721 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
\r
4722 * is the input sample value. The functions return the output value.
\r
4726 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
\r
4727 * A0 = Kp + Ki + Kd
\r
4728 * A1 = (-Kp ) - (2 * Kd )
\r
4732 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
\r
4735 * \image html PID.gif "Proportional Integral Derivative Controller"
\r
4738 * The PID controller calculates an "error" value as the difference between
\r
4739 * the measured output and the reference input.
\r
4740 * The controller attempts to minimize the error by adjusting the process control inputs.
\r
4741 * The proportional value determines the reaction to the current error,
\r
4742 * the integral value determines the reaction based on the sum of recent errors,
\r
4743 * and the derivative value determines the reaction based on the rate at which the error has been changing.
\r
4745 * \par Instance Structure
\r
4746 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
\r
4747 * A separate instance structure must be defined for each PID Controller.
\r
4748 * There are separate instance structure declarations for each of the 3 supported data types.
\r
4750 * \par Reset Functions
\r
4751 * There is also an associated reset function for each data type which clears the state array.
\r
4753 * \par Initialization Functions
\r
4754 * There is also an associated initialization function for each data type.
\r
4755 * The initialization function performs the following operations:
\r
4756 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
\r
4757 * - Zeros out the values in the state buffer.
\r
4760 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
\r
4762 * \par Fixed-Point Behavior
\r
4763 * Care must be taken when using the fixed-point versions of the PID Controller functions.
\r
4764 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
\r
4765 * Refer to the function specific documentation below for usage guidelines.
\r
4774 * @brief Process function for the floating-point PID Control.
\r
4775 * @param[in,out] S is an instance of the floating-point PID Control structure
\r
4776 * @param[in] in input sample to process
\r
4777 * @return out processed output sample.
\r
4779 CMSIS_INLINE __STATIC_INLINE float32_t arm_pid_f32(
\r
4780 arm_pid_instance_f32 * S,
\r
4785 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
\r
4786 out = (S->A0 * in) +
\r
4787 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
\r
4789 /* Update state */
\r
4790 S->state[1] = S->state[0];
\r
4792 S->state[2] = out;
\r
4794 /* return to application */
\r
4800 * @brief Process function for the Q31 PID Control.
\r
4801 * @param[in,out] S points to an instance of the Q31 PID Control structure
\r
4802 * @param[in] in input sample to process
\r
4803 * @return out processed output sample.
\r
4805 * <b>Scaling and Overflow Behavior:</b>
\r
4807 * The function is implemented using an internal 64-bit accumulator.
\r
4808 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
\r
4809 * Thus, if the accumulator result overflows it wraps around rather than clip.
\r
4810 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
\r
4811 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
\r
4813 CMSIS_INLINE __STATIC_INLINE q31_t arm_pid_q31(
\r
4814 arm_pid_instance_q31 * S,
\r
4820 /* acc = A0 * x[n] */
\r
4821 acc = (q63_t) S->A0 * in;
\r
4823 /* acc += A1 * x[n-1] */
\r
4824 acc += (q63_t) S->A1 * S->state[0];
\r
4826 /* acc += A2 * x[n-2] */
\r
4827 acc += (q63_t) S->A2 * S->state[1];
\r
4829 /* convert output to 1.31 format to add y[n-1] */
\r
4830 out = (q31_t) (acc >> 31U);
\r
4832 /* out += y[n-1] */
\r
4833 out += S->state[2];
\r
4835 /* Update state */
\r
4836 S->state[1] = S->state[0];
\r
4838 S->state[2] = out;
\r
4840 /* return to application */
\r
4846 * @brief Process function for the Q15 PID Control.
\r
4847 * @param[in,out] S points to an instance of the Q15 PID Control structure
\r
4848 * @param[in] in input sample to process
\r
4849 * @return out processed output sample.
\r
4851 * <b>Scaling and Overflow Behavior:</b>
\r
4853 * The function is implemented using a 64-bit internal accumulator.
\r
4854 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
\r
4855 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
\r
4856 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
\r
4857 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
\r
4858 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
\r
4860 CMSIS_INLINE __STATIC_INLINE q15_t arm_pid_q15(
\r
4861 arm_pid_instance_q15 * S,
\r
4867 #if defined (ARM_MATH_DSP)
\r
4868 __SIMD32_TYPE *vstate;
\r
4870 /* Implementation of PID controller */
\r
4872 /* acc = A0 * x[n] */
\r
4873 acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
\r
4875 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
4876 vstate = __SIMD32_CONST(S->state);
\r
4877 acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc);
\r
4879 /* acc = A0 * x[n] */
\r
4880 acc = ((q31_t) S->A0) * in;
\r
4882 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
4883 acc += (q31_t) S->A1 * S->state[0];
\r
4884 acc += (q31_t) S->A2 * S->state[1];
\r
4887 /* acc += y[n-1] */
\r
4888 acc += (q31_t) S->state[2] << 15;
\r
4890 /* saturate the output */
\r
4891 out = (q15_t) (__SSAT((acc >> 15), 16));
\r
4893 /* Update state */
\r
4894 S->state[1] = S->state[0];
\r
4896 S->state[2] = out;
\r
4898 /* return to application */
\r
4903 * @} end of PID group
\r
4908 * @brief Floating-point matrix inverse.
\r
4909 * @param[in] src points to the instance of the input floating-point matrix structure.
\r
4910 * @param[out] dst points to the instance of the output floating-point matrix structure.
\r
4911 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
4912 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
4914 arm_status arm_mat_inverse_f32(
\r
4915 const arm_matrix_instance_f32 * src,
\r
4916 arm_matrix_instance_f32 * dst);
\r
4920 * @brief Floating-point matrix inverse.
\r
4921 * @param[in] src points to the instance of the input floating-point matrix structure.
\r
4922 * @param[out] dst points to the instance of the output floating-point matrix structure.
\r
4923 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
4924 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
4926 arm_status arm_mat_inverse_f64(
\r
4927 const arm_matrix_instance_f64 * src,
\r
4928 arm_matrix_instance_f64 * dst);
\r
4933 * @ingroup groupController
\r
4937 * @defgroup clarke Vector Clarke Transform
\r
4938 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
\r
4939 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
\r
4940 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
\r
4941 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
\r
4942 * \image html clarke.gif Stator current space vector and its components in (a,b).
\r
4943 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
\r
4944 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
\r
4946 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
4947 * The library provides separate functions for Q31 and floating-point data types.
\r
4949 * \image html clarkeFormula.gif
\r
4950 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
\r
4951 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
\r
4952 * \par Fixed-Point Behavior
\r
4953 * Care must be taken when using the Q31 version of the Clarke transform.
\r
4954 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
4955 * Refer to the function specific documentation below for usage guidelines.
\r
4959 * @addtogroup clarke
\r
4965 * @brief Floating-point Clarke transform
\r
4966 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
4967 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
4968 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
4969 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
4971 CMSIS_INLINE __STATIC_INLINE void arm_clarke_f32(
\r
4974 float32_t * pIalpha,
\r
4975 float32_t * pIbeta)
\r
4977 /* Calculate pIalpha using the equation, pIalpha = Ia */
\r
4980 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
\r
4981 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
\r
4986 * @brief Clarke transform for Q31 version
\r
4987 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
4988 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
4989 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
4990 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
4992 * <b>Scaling and Overflow Behavior:</b>
\r
4994 * The function is implemented using an internal 32-bit accumulator.
\r
4995 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
4996 * There is saturation on the addition, hence there is no risk of overflow.
\r
4998 CMSIS_INLINE __STATIC_INLINE void arm_clarke_q31(
\r
5004 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5006 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
\r
5009 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
\r
5010 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
\r
5012 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
\r
5013 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
\r
5015 /* pIbeta is calculated by adding the intermediate products */
\r
5016 *pIbeta = __QADD(product1, product2);
\r
5020 * @} end of clarke group
\r
5024 * @brief Converts the elements of the Q7 vector to Q31 vector.
\r
5025 * @param[in] pSrc input pointer
\r
5026 * @param[out] pDst output pointer
\r
5027 * @param[in] blockSize number of samples to process
\r
5029 void arm_q7_to_q31(
\r
5032 uint32_t blockSize);
\r
5037 * @ingroup groupController
\r
5041 * @defgroup inv_clarke Vector Inverse Clarke Transform
\r
5042 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
\r
5044 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5045 * The library provides separate functions for Q31 and floating-point data types.
\r
5047 * \image html clarkeInvFormula.gif
\r
5048 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
\r
5049 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
\r
5050 * \par Fixed-Point Behavior
\r
5051 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5052 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5053 * Refer to the function specific documentation below for usage guidelines.
\r
5057 * @addtogroup inv_clarke
\r
5062 * @brief Floating-point Inverse Clarke transform
\r
5063 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5064 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5065 * @param[out] pIa points to output three-phase coordinate <code>a</code>
\r
5066 * @param[out] pIb points to output three-phase coordinate <code>b</code>
\r
5068 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_f32(
\r
5074 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5077 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
\r
5078 *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
\r
5083 * @brief Inverse Clarke transform for Q31 version
\r
5084 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5085 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5086 * @param[out] pIa points to output three-phase coordinate <code>a</code>
\r
5087 * @param[out] pIb points to output three-phase coordinate <code>b</code>
\r
5089 * <b>Scaling and Overflow Behavior:</b>
\r
5091 * The function is implemented using an internal 32-bit accumulator.
\r
5092 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5093 * There is saturation on the subtraction, hence there is no risk of overflow.
\r
5095 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_q31(
\r
5101 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5103 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5106 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
\r
5107 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
\r
5109 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
\r
5110 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
\r
5112 /* pIb is calculated by subtracting the products */
\r
5113 *pIb = __QSUB(product2, product1);
\r
5117 * @} end of inv_clarke group
\r
5121 * @brief Converts the elements of the Q7 vector to Q15 vector.
\r
5122 * @param[in] pSrc input pointer
\r
5123 * @param[out] pDst output pointer
\r
5124 * @param[in] blockSize number of samples to process
\r
5126 void arm_q7_to_q15(
\r
5129 uint32_t blockSize);
\r
5134 * @ingroup groupController
\r
5138 * @defgroup park Vector Park Transform
\r
5140 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
\r
5141 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
\r
5142 * from the stationary to the moving reference frame and control the spatial relationship between
\r
5143 * the stator vector current and rotor flux vector.
\r
5144 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
\r
5145 * current vector and the relationship from the two reference frames:
\r
5146 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
\r
5148 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5149 * The library provides separate functions for Q31 and floating-point data types.
\r
5151 * \image html parkFormula.gif
\r
5152 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
\r
5153 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5154 * cosine and sine values of theta (rotor flux position).
\r
5155 * \par Fixed-Point Behavior
\r
5156 * Care must be taken when using the Q31 version of the Park transform.
\r
5157 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5158 * Refer to the function specific documentation below for usage guidelines.
\r
5162 * @addtogroup park
\r
5167 * @brief Floating-point Park transform
\r
5168 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5169 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5170 * @param[out] pId points to output rotor reference frame d
\r
5171 * @param[out] pIq points to output rotor reference frame q
\r
5172 * @param[in] sinVal sine value of rotation angle theta
\r
5173 * @param[in] cosVal cosine value of rotation angle theta
\r
5175 * The function implements the forward Park transform.
\r
5178 CMSIS_INLINE __STATIC_INLINE void arm_park_f32(
\r
5186 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
\r
5187 *pId = Ialpha * cosVal + Ibeta * sinVal;
\r
5189 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
\r
5190 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
\r
5195 * @brief Park transform for Q31 version
\r
5196 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5197 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5198 * @param[out] pId points to output rotor reference frame d
\r
5199 * @param[out] pIq points to output rotor reference frame q
\r
5200 * @param[in] sinVal sine value of rotation angle theta
\r
5201 * @param[in] cosVal cosine value of rotation angle theta
\r
5203 * <b>Scaling and Overflow Behavior:</b>
\r
5205 * The function is implemented using an internal 32-bit accumulator.
\r
5206 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5207 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
\r
5209 CMSIS_INLINE __STATIC_INLINE void arm_park_q31(
\r
5217 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5218 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5220 /* Intermediate product is calculated by (Ialpha * cosVal) */
\r
5221 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
\r
5223 /* Intermediate product is calculated by (Ibeta * sinVal) */
\r
5224 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
\r
5227 /* Intermediate product is calculated by (Ialpha * sinVal) */
\r
5228 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
\r
5230 /* Intermediate product is calculated by (Ibeta * cosVal) */
\r
5231 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
\r
5233 /* Calculate pId by adding the two intermediate products 1 and 2 */
\r
5234 *pId = __QADD(product1, product2);
\r
5236 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
\r
5237 *pIq = __QSUB(product4, product3);
\r
5241 * @} end of park group
\r
5245 * @brief Converts the elements of the Q7 vector to floating-point vector.
\r
5246 * @param[in] pSrc is input pointer
\r
5247 * @param[out] pDst is output pointer
\r
5248 * @param[in] blockSize is the number of samples to process
\r
5250 void arm_q7_to_float(
\r
5253 uint32_t blockSize);
\r
5257 * @ingroup groupController
\r
5261 * @defgroup inv_park Vector Inverse Park transform
\r
5262 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
\r
5264 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5265 * The library provides separate functions for Q31 and floating-point data types.
\r
5267 * \image html parkInvFormula.gif
\r
5268 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
\r
5269 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5270 * cosine and sine values of theta (rotor flux position).
\r
5271 * \par Fixed-Point Behavior
\r
5272 * Care must be taken when using the Q31 version of the Park transform.
\r
5273 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5274 * Refer to the function specific documentation below for usage guidelines.
\r
5278 * @addtogroup inv_park
\r
5283 * @brief Floating-point Inverse Park transform
\r
5284 * @param[in] Id input coordinate of rotor reference frame d
\r
5285 * @param[in] Iq input coordinate of rotor reference frame q
\r
5286 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
5287 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
5288 * @param[in] sinVal sine value of rotation angle theta
\r
5289 * @param[in] cosVal cosine value of rotation angle theta
\r
5291 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_f32(
\r
5294 float32_t * pIalpha,
\r
5295 float32_t * pIbeta,
\r
5299 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
\r
5300 *pIalpha = Id * cosVal - Iq * sinVal;
\r
5302 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
\r
5303 *pIbeta = Id * sinVal + Iq * cosVal;
\r
5308 * @brief Inverse Park transform for Q31 version
\r
5309 * @param[in] Id input coordinate of rotor reference frame d
\r
5310 * @param[in] Iq input coordinate of rotor reference frame q
\r
5311 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
5312 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
5313 * @param[in] sinVal sine value of rotation angle theta
\r
5314 * @param[in] cosVal cosine value of rotation angle theta
\r
5316 * <b>Scaling and Overflow Behavior:</b>
\r
5318 * The function is implemented using an internal 32-bit accumulator.
\r
5319 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5320 * There is saturation on the addition, hence there is no risk of overflow.
\r
5322 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_q31(
\r
5330 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5331 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5333 /* Intermediate product is calculated by (Id * cosVal) */
\r
5334 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
\r
5336 /* Intermediate product is calculated by (Iq * sinVal) */
\r
5337 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
\r
5340 /* Intermediate product is calculated by (Id * sinVal) */
\r
5341 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
\r
5343 /* Intermediate product is calculated by (Iq * cosVal) */
\r
5344 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
\r
5346 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
\r
5347 *pIalpha = __QSUB(product1, product2);
\r
5349 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
\r
5350 *pIbeta = __QADD(product4, product3);
\r
5354 * @} end of Inverse park group
\r
5359 * @brief Converts the elements of the Q31 vector to floating-point vector.
\r
5360 * @param[in] pSrc is input pointer
\r
5361 * @param[out] pDst is output pointer
\r
5362 * @param[in] blockSize is the number of samples to process
\r
5364 void arm_q31_to_float(
\r
5367 uint32_t blockSize);
\r
5370 * @ingroup groupInterpolation
\r
5374 * @defgroup LinearInterpolate Linear Interpolation
\r
5376 * Linear interpolation is a method of curve fitting using linear polynomials.
\r
5377 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
\r
5380 * \image html LinearInterp.gif "Linear interpolation"
\r
5383 * A Linear Interpolate function calculates an output value(y), for the input(x)
\r
5384 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
\r
5388 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
\r
5389 * where x0, x1 are nearest values of input x
\r
5390 * y0, y1 are nearest values to output y
\r
5394 * This set of functions implements Linear interpolation process
\r
5395 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
\r
5396 * sample of data and each call to the function returns a single processed value.
\r
5397 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
\r
5398 * <code>x</code> is the input sample value. The functions returns the output value.
\r
5401 * if x is outside of the table boundary, Linear interpolation returns first value of the table
\r
5402 * if x is below input range and returns last value of table if x is above range.
\r
5406 * @addtogroup LinearInterpolate
\r
5411 * @brief Process function for the floating-point Linear Interpolation Function.
\r
5412 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
\r
5413 * @param[in] x input sample to process
\r
5414 * @return y processed output sample.
\r
5417 CMSIS_INLINE __STATIC_INLINE float32_t arm_linear_interp_f32(
\r
5418 arm_linear_interp_instance_f32 * S,
\r
5422 float32_t x0, x1; /* Nearest input values */
\r
5423 float32_t y0, y1; /* Nearest output values */
\r
5424 float32_t xSpacing = S->xSpacing; /* spacing between input values */
\r
5425 int32_t i; /* Index variable */
\r
5426 float32_t *pYData = S->pYData; /* pointer to output table */
\r
5428 /* Calculation of index */
\r
5429 i = (int32_t) ((x - S->x1) / xSpacing);
\r
5433 /* Iniatilize output for below specified range as least output value of table */
\r
5436 else if ((uint32_t)i >= S->nValues)
\r
5438 /* Iniatilize output for above specified range as last output value of table */
\r
5439 y = pYData[S->nValues - 1];
\r
5443 /* Calculation of nearest input values */
\r
5444 x0 = S->x1 + i * xSpacing;
\r
5445 x1 = S->x1 + (i + 1) * xSpacing;
\r
5447 /* Read of nearest output values */
\r
5449 y1 = pYData[i + 1];
\r
5451 /* Calculation of output */
\r
5452 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
\r
5456 /* returns output value */
\r
5463 * @brief Process function for the Q31 Linear Interpolation Function.
\r
5464 * @param[in] pYData pointer to Q31 Linear Interpolation table
\r
5465 * @param[in] x input sample to process
\r
5466 * @param[in] nValues number of table values
\r
5467 * @return y processed output sample.
\r
5470 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5471 * This function can support maximum of table size 2^12.
\r
5474 CMSIS_INLINE __STATIC_INLINE q31_t arm_linear_interp_q31(
\r
5479 q31_t y; /* output */
\r
5480 q31_t y0, y1; /* Nearest output values */
\r
5481 q31_t fract; /* fractional part */
\r
5482 int32_t index; /* Index to read nearest output values */
\r
5484 /* Input is in 12.20 format */
\r
5485 /* 12 bits for the table index */
\r
5486 /* Index value calculation */
\r
5487 index = ((x & (q31_t)0xFFF00000) >> 20);
\r
5489 if (index >= (int32_t)(nValues - 1))
\r
5491 return (pYData[nValues - 1]);
\r
5493 else if (index < 0)
\r
5495 return (pYData[0]);
\r
5499 /* 20 bits for the fractional part */
\r
5500 /* shift left by 11 to keep fract in 1.31 format */
\r
5501 fract = (x & 0x000FFFFF) << 11;
\r
5503 /* Read two nearest output values from the index in 1.31(q31) format */
\r
5504 y0 = pYData[index];
\r
5505 y1 = pYData[index + 1];
\r
5507 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
\r
5508 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
\r
5510 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
\r
5511 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
\r
5513 /* Convert y to 1.31 format */
\r
5521 * @brief Process function for the Q15 Linear Interpolation Function.
\r
5522 * @param[in] pYData pointer to Q15 Linear Interpolation table
\r
5523 * @param[in] x input sample to process
\r
5524 * @param[in] nValues number of table values
\r
5525 * @return y processed output sample.
\r
5528 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5529 * This function can support maximum of table size 2^12.
\r
5532 CMSIS_INLINE __STATIC_INLINE q15_t arm_linear_interp_q15(
\r
5537 q63_t y; /* output */
\r
5538 q15_t y0, y1; /* Nearest output values */
\r
5539 q31_t fract; /* fractional part */
\r
5540 int32_t index; /* Index to read nearest output values */
\r
5542 /* Input is in 12.20 format */
\r
5543 /* 12 bits for the table index */
\r
5544 /* Index value calculation */
\r
5545 index = ((x & (int32_t)0xFFF00000) >> 20);
\r
5547 if (index >= (int32_t)(nValues - 1))
\r
5549 return (pYData[nValues - 1]);
\r
5551 else if (index < 0)
\r
5553 return (pYData[0]);
\r
5557 /* 20 bits for the fractional part */
\r
5558 /* fract is in 12.20 format */
\r
5559 fract = (x & 0x000FFFFF);
\r
5561 /* Read two nearest output values from the index */
\r
5562 y0 = pYData[index];
\r
5563 y1 = pYData[index + 1];
\r
5565 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
\r
5566 y = ((q63_t) y0 * (0xFFFFF - fract));
\r
5568 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
\r
5569 y += ((q63_t) y1 * (fract));
\r
5571 /* convert y to 1.15 format */
\r
5572 return (q15_t) (y >> 20);
\r
5579 * @brief Process function for the Q7 Linear Interpolation Function.
\r
5580 * @param[in] pYData pointer to Q7 Linear Interpolation table
\r
5581 * @param[in] x input sample to process
\r
5582 * @param[in] nValues number of table values
\r
5583 * @return y processed output sample.
\r
5586 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5587 * This function can support maximum of table size 2^12.
\r
5589 CMSIS_INLINE __STATIC_INLINE q7_t arm_linear_interp_q7(
\r
5594 q31_t y; /* output */
\r
5595 q7_t y0, y1; /* Nearest output values */
\r
5596 q31_t fract; /* fractional part */
\r
5597 uint32_t index; /* Index to read nearest output values */
\r
5599 /* Input is in 12.20 format */
\r
5600 /* 12 bits for the table index */
\r
5601 /* Index value calculation */
\r
5604 return (pYData[0]);
\r
5606 index = (x >> 20) & 0xfff;
\r
5608 if (index >= (nValues - 1))
\r
5610 return (pYData[nValues - 1]);
\r
5614 /* 20 bits for the fractional part */
\r
5615 /* fract is in 12.20 format */
\r
5616 fract = (x & 0x000FFFFF);
\r
5618 /* Read two nearest output values from the index and are in 1.7(q7) format */
\r
5619 y0 = pYData[index];
\r
5620 y1 = pYData[index + 1];
\r
5622 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
\r
5623 y = ((y0 * (0xFFFFF - fract)));
\r
5625 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
\r
5626 y += (y1 * fract);
\r
5628 /* convert y to 1.7(q7) format */
\r
5629 return (q7_t) (y >> 20);
\r
5634 * @} end of LinearInterpolate group
\r
5638 * @brief Fast approximation to the trigonometric sine function for floating-point data.
\r
5639 * @param[in] x input value in radians.
\r
5642 float32_t arm_sin_f32(
\r
5647 * @brief Fast approximation to the trigonometric sine function for Q31 data.
\r
5648 * @param[in] x Scaled input value in radians.
\r
5651 q31_t arm_sin_q31(
\r
5656 * @brief Fast approximation to the trigonometric sine function for Q15 data.
\r
5657 * @param[in] x Scaled input value in radians.
\r
5660 q15_t arm_sin_q15(
\r
5665 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
\r
5666 * @param[in] x input value in radians.
\r
5669 float32_t arm_cos_f32(
\r
5674 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
\r
5675 * @param[in] x Scaled input value in radians.
\r
5678 q31_t arm_cos_q31(
\r
5683 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
\r
5684 * @param[in] x Scaled input value in radians.
\r
5687 q15_t arm_cos_q15(
\r
5692 * @ingroup groupFastMath
\r
5697 * @defgroup SQRT Square Root
\r
5699 * Computes the square root of a number.
\r
5700 * There are separate functions for Q15, Q31, and floating-point data types.
\r
5701 * The square root function is computed using the Newton-Raphson algorithm.
\r
5702 * This is an iterative algorithm of the form:
\r
5704 * x1 = x0 - f(x0)/f'(x0)
\r
5706 * where <code>x1</code> is the current estimate,
\r
5707 * <code>x0</code> is the previous estimate, and
\r
5708 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
\r
5709 * For the square root function, the algorithm reduces to:
\r
5711 * x0 = in/2 [initial guess]
\r
5712 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
\r
5718 * @addtogroup SQRT
\r
5723 * @brief Floating-point square root function.
\r
5724 * @param[in] in input value.
\r
5725 * @param[out] pOut square root of input value.
\r
5726 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5727 * <code>in</code> is negative value and returns zero output for negative values.
\r
5729 CMSIS_INLINE __STATIC_INLINE arm_status arm_sqrt_f32(
\r
5736 #if (__FPU_USED == 1) && defined ( __CC_ARM )
\r
5737 *pOut = __sqrtf(in);
\r
5738 #elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
\r
5739 *pOut = __builtin_sqrtf(in);
\r
5740 #elif (__FPU_USED == 1) && defined(__GNUC__)
\r
5741 *pOut = __builtin_sqrtf(in);
\r
5742 #elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
\r
5743 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
\r
5745 *pOut = sqrtf(in);
\r
5748 return (ARM_MATH_SUCCESS);
\r
5753 return (ARM_MATH_ARGUMENT_ERROR);
\r
5759 * @brief Q31 square root function.
\r
5760 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
\r
5761 * @param[out] pOut square root of input value.
\r
5762 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5763 * <code>in</code> is negative value and returns zero output for negative values.
\r
5765 arm_status arm_sqrt_q31(
\r
5771 * @brief Q15 square root function.
\r
5772 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
\r
5773 * @param[out] pOut square root of input value.
\r
5774 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5775 * <code>in</code> is negative value and returns zero output for negative values.
\r
5777 arm_status arm_sqrt_q15(
\r
5782 * @} end of SQRT group
\r
5787 * @brief floating-point Circular write function.
\r
5789 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_f32(
\r
5790 int32_t * circBuffer,
\r
5792 uint16_t * writeOffset,
\r
5793 int32_t bufferInc,
\r
5794 const int32_t * src,
\r
5796 uint32_t blockSize)
\r
5801 /* Copy the value of Index pointer that points
\r
5802 * to the current location where the input samples to be copied */
\r
5803 wOffset = *writeOffset;
\r
5805 /* Loop over the blockSize */
\r
5810 /* copy the input sample to the circular buffer */
\r
5811 circBuffer[wOffset] = *src;
\r
5813 /* Update the input pointer */
\r
5816 /* Circularly update wOffset. Watch out for positive and negative value */
\r
5817 wOffset += bufferInc;
\r
5821 /* Decrement the loop counter */
\r
5825 /* Update the index pointer */
\r
5826 *writeOffset = (uint16_t)wOffset;
\r
5832 * @brief floating-point Circular Read function.
\r
5834 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_f32(
\r
5835 int32_t * circBuffer,
\r
5837 int32_t * readOffset,
\r
5838 int32_t bufferInc,
\r
5840 int32_t * dst_base,
\r
5841 int32_t dst_length,
\r
5843 uint32_t blockSize)
\r
5846 int32_t rOffset, dst_end;
\r
5848 /* Copy the value of Index pointer that points
\r
5849 * to the current location from where the input samples to be read */
\r
5850 rOffset = *readOffset;
\r
5851 dst_end = (int32_t) (dst_base + dst_length);
\r
5853 /* Loop over the blockSize */
\r
5858 /* copy the sample from the circular buffer to the destination buffer */
\r
5859 *dst = circBuffer[rOffset];
\r
5861 /* Update the input pointer */
\r
5864 if (dst == (int32_t *) dst_end)
\r
5869 /* Circularly update rOffset. Watch out for positive and negative value */
\r
5870 rOffset += bufferInc;
\r
5877 /* Decrement the loop counter */
\r
5881 /* Update the index pointer */
\r
5882 *readOffset = rOffset;
\r
5887 * @brief Q15 Circular write function.
\r
5889 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q15(
\r
5890 q15_t * circBuffer,
\r
5892 uint16_t * writeOffset,
\r
5893 int32_t bufferInc,
\r
5894 const q15_t * src,
\r
5896 uint32_t blockSize)
\r
5901 /* Copy the value of Index pointer that points
\r
5902 * to the current location where the input samples to be copied */
\r
5903 wOffset = *writeOffset;
\r
5905 /* Loop over the blockSize */
\r
5910 /* copy the input sample to the circular buffer */
\r
5911 circBuffer[wOffset] = *src;
\r
5913 /* Update the input pointer */
\r
5916 /* Circularly update wOffset. Watch out for positive and negative value */
\r
5917 wOffset += bufferInc;
\r
5921 /* Decrement the loop counter */
\r
5925 /* Update the index pointer */
\r
5926 *writeOffset = (uint16_t)wOffset;
\r
5931 * @brief Q15 Circular Read function.
\r
5933 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q15(
\r
5934 q15_t * circBuffer,
\r
5936 int32_t * readOffset,
\r
5937 int32_t bufferInc,
\r
5940 int32_t dst_length,
\r
5942 uint32_t blockSize)
\r
5945 int32_t rOffset, dst_end;
\r
5947 /* Copy the value of Index pointer that points
\r
5948 * to the current location from where the input samples to be read */
\r
5949 rOffset = *readOffset;
\r
5951 dst_end = (int32_t) (dst_base + dst_length);
\r
5953 /* Loop over the blockSize */
\r
5958 /* copy the sample from the circular buffer to the destination buffer */
\r
5959 *dst = circBuffer[rOffset];
\r
5961 /* Update the input pointer */
\r
5964 if (dst == (q15_t *) dst_end)
\r
5969 /* Circularly update wOffset. Watch out for positive and negative value */
\r
5970 rOffset += bufferInc;
\r
5977 /* Decrement the loop counter */
\r
5981 /* Update the index pointer */
\r
5982 *readOffset = rOffset;
\r
5987 * @brief Q7 Circular write function.
\r
5989 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q7(
\r
5990 q7_t * circBuffer,
\r
5992 uint16_t * writeOffset,
\r
5993 int32_t bufferInc,
\r
5996 uint32_t blockSize)
\r
6001 /* Copy the value of Index pointer that points
\r
6002 * to the current location where the input samples to be copied */
\r
6003 wOffset = *writeOffset;
\r
6005 /* Loop over the blockSize */
\r
6010 /* copy the input sample to the circular buffer */
\r
6011 circBuffer[wOffset] = *src;
\r
6013 /* Update the input pointer */
\r
6016 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6017 wOffset += bufferInc;
\r
6021 /* Decrement the loop counter */
\r
6025 /* Update the index pointer */
\r
6026 *writeOffset = (uint16_t)wOffset;
\r
6031 * @brief Q7 Circular Read function.
\r
6033 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q7(
\r
6034 q7_t * circBuffer,
\r
6036 int32_t * readOffset,
\r
6037 int32_t bufferInc,
\r
6040 int32_t dst_length,
\r
6042 uint32_t blockSize)
\r
6045 int32_t rOffset, dst_end;
\r
6047 /* Copy the value of Index pointer that points
\r
6048 * to the current location from where the input samples to be read */
\r
6049 rOffset = *readOffset;
\r
6051 dst_end = (int32_t) (dst_base + dst_length);
\r
6053 /* Loop over the blockSize */
\r
6058 /* copy the sample from the circular buffer to the destination buffer */
\r
6059 *dst = circBuffer[rOffset];
\r
6061 /* Update the input pointer */
\r
6064 if (dst == (q7_t *) dst_end)
\r
6069 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6070 rOffset += bufferInc;
\r
6077 /* Decrement the loop counter */
\r
6081 /* Update the index pointer */
\r
6082 *readOffset = rOffset;
\r
6087 * @brief Sum of the squares of the elements of a Q31 vector.
\r
6088 * @param[in] pSrc is input pointer
\r
6089 * @param[in] blockSize is the number of samples to process
\r
6090 * @param[out] pResult is output value.
\r
6092 void arm_power_q31(
\r
6094 uint32_t blockSize,
\r
6099 * @brief Sum of the squares of the elements of a floating-point vector.
\r
6100 * @param[in] pSrc is input pointer
\r
6101 * @param[in] blockSize is the number of samples to process
\r
6102 * @param[out] pResult is output value.
\r
6104 void arm_power_f32(
\r
6106 uint32_t blockSize,
\r
6107 float32_t * pResult);
\r
6111 * @brief Sum of the squares of the elements of a Q15 vector.
\r
6112 * @param[in] pSrc is input pointer
\r
6113 * @param[in] blockSize is the number of samples to process
\r
6114 * @param[out] pResult is output value.
\r
6116 void arm_power_q15(
\r
6118 uint32_t blockSize,
\r
6123 * @brief Sum of the squares of the elements of a Q7 vector.
\r
6124 * @param[in] pSrc is input pointer
\r
6125 * @param[in] blockSize is the number of samples to process
\r
6126 * @param[out] pResult is output value.
\r
6128 void arm_power_q7(
\r
6130 uint32_t blockSize,
\r
6135 * @brief Mean value of a Q7 vector.
\r
6136 * @param[in] pSrc is input pointer
\r
6137 * @param[in] blockSize is the number of samples to process
\r
6138 * @param[out] pResult is output value.
\r
6142 uint32_t blockSize,
\r
6147 * @brief Mean value of a Q15 vector.
\r
6148 * @param[in] pSrc is input pointer
\r
6149 * @param[in] blockSize is the number of samples to process
\r
6150 * @param[out] pResult is output value.
\r
6152 void arm_mean_q15(
\r
6154 uint32_t blockSize,
\r
6159 * @brief Mean value of a Q31 vector.
\r
6160 * @param[in] pSrc is input pointer
\r
6161 * @param[in] blockSize is the number of samples to process
\r
6162 * @param[out] pResult is output value.
\r
6164 void arm_mean_q31(
\r
6166 uint32_t blockSize,
\r
6171 * @brief Mean value of a floating-point vector.
\r
6172 * @param[in] pSrc is input pointer
\r
6173 * @param[in] blockSize is the number of samples to process
\r
6174 * @param[out] pResult is output value.
\r
6176 void arm_mean_f32(
\r
6178 uint32_t blockSize,
\r
6179 float32_t * pResult);
\r
6183 * @brief Variance of the elements of a floating-point vector.
\r
6184 * @param[in] pSrc is input pointer
\r
6185 * @param[in] blockSize is the number of samples to process
\r
6186 * @param[out] pResult is output value.
\r
6190 uint32_t blockSize,
\r
6191 float32_t * pResult);
\r
6195 * @brief Variance of the elements of a Q31 vector.
\r
6196 * @param[in] pSrc is input pointer
\r
6197 * @param[in] blockSize is the number of samples to process
\r
6198 * @param[out] pResult is output value.
\r
6202 uint32_t blockSize,
\r
6207 * @brief Variance of the elements of a Q15 vector.
\r
6208 * @param[in] pSrc is input pointer
\r
6209 * @param[in] blockSize is the number of samples to process
\r
6210 * @param[out] pResult is output value.
\r
6214 uint32_t blockSize,
\r
6219 * @brief Root Mean Square of the elements of a floating-point vector.
\r
6220 * @param[in] pSrc is input pointer
\r
6221 * @param[in] blockSize is the number of samples to process
\r
6222 * @param[out] pResult is output value.
\r
6226 uint32_t blockSize,
\r
6227 float32_t * pResult);
\r
6231 * @brief Root Mean Square of the elements of a Q31 vector.
\r
6232 * @param[in] pSrc is input pointer
\r
6233 * @param[in] blockSize is the number of samples to process
\r
6234 * @param[out] pResult is output value.
\r
6238 uint32_t blockSize,
\r
6243 * @brief Root Mean Square of the elements of a Q15 vector.
\r
6244 * @param[in] pSrc is input pointer
\r
6245 * @param[in] blockSize is the number of samples to process
\r
6246 * @param[out] pResult is output value.
\r
6250 uint32_t blockSize,
\r
6255 * @brief Standard deviation of the elements of a floating-point vector.
\r
6256 * @param[in] pSrc is input pointer
\r
6257 * @param[in] blockSize is the number of samples to process
\r
6258 * @param[out] pResult is output value.
\r
6262 uint32_t blockSize,
\r
6263 float32_t * pResult);
\r
6267 * @brief Standard deviation of the elements of a Q31 vector.
\r
6268 * @param[in] pSrc is input pointer
\r
6269 * @param[in] blockSize is the number of samples to process
\r
6270 * @param[out] pResult is output value.
\r
6274 uint32_t blockSize,
\r
6279 * @brief Standard deviation of the elements of a Q15 vector.
\r
6280 * @param[in] pSrc is input pointer
\r
6281 * @param[in] blockSize is the number of samples to process
\r
6282 * @param[out] pResult is output value.
\r
6286 uint32_t blockSize,
\r
6291 * @brief Floating-point complex magnitude
\r
6292 * @param[in] pSrc points to the complex input vector
\r
6293 * @param[out] pDst points to the real output vector
\r
6294 * @param[in] numSamples number of complex samples in the input vector
\r
6296 void arm_cmplx_mag_f32(
\r
6299 uint32_t numSamples);
\r
6303 * @brief Q31 complex magnitude
\r
6304 * @param[in] pSrc points to the complex input vector
\r
6305 * @param[out] pDst points to the real output vector
\r
6306 * @param[in] numSamples number of complex samples in the input vector
\r
6308 void arm_cmplx_mag_q31(
\r
6311 uint32_t numSamples);
\r
6315 * @brief Q15 complex magnitude
\r
6316 * @param[in] pSrc points to the complex input vector
\r
6317 * @param[out] pDst points to the real output vector
\r
6318 * @param[in] numSamples number of complex samples in the input vector
\r
6320 void arm_cmplx_mag_q15(
\r
6323 uint32_t numSamples);
\r
6327 * @brief Q15 complex dot product
\r
6328 * @param[in] pSrcA points to the first input vector
\r
6329 * @param[in] pSrcB points to the second input vector
\r
6330 * @param[in] numSamples number of complex samples in each vector
\r
6331 * @param[out] realResult real part of the result returned here
\r
6332 * @param[out] imagResult imaginary part of the result returned here
\r
6334 void arm_cmplx_dot_prod_q15(
\r
6337 uint32_t numSamples,
\r
6338 q31_t * realResult,
\r
6339 q31_t * imagResult);
\r
6343 * @brief Q31 complex dot product
\r
6344 * @param[in] pSrcA points to the first input vector
\r
6345 * @param[in] pSrcB points to the second input vector
\r
6346 * @param[in] numSamples number of complex samples in each vector
\r
6347 * @param[out] realResult real part of the result returned here
\r
6348 * @param[out] imagResult imaginary part of the result returned here
\r
6350 void arm_cmplx_dot_prod_q31(
\r
6353 uint32_t numSamples,
\r
6354 q63_t * realResult,
\r
6355 q63_t * imagResult);
\r
6359 * @brief Floating-point complex dot product
\r
6360 * @param[in] pSrcA points to the first input vector
\r
6361 * @param[in] pSrcB points to the second input vector
\r
6362 * @param[in] numSamples number of complex samples in each vector
\r
6363 * @param[out] realResult real part of the result returned here
\r
6364 * @param[out] imagResult imaginary part of the result returned here
\r
6366 void arm_cmplx_dot_prod_f32(
\r
6367 float32_t * pSrcA,
\r
6368 float32_t * pSrcB,
\r
6369 uint32_t numSamples,
\r
6370 float32_t * realResult,
\r
6371 float32_t * imagResult);
\r
6375 * @brief Q15 complex-by-real multiplication
\r
6376 * @param[in] pSrcCmplx points to the complex input vector
\r
6377 * @param[in] pSrcReal points to the real input vector
\r
6378 * @param[out] pCmplxDst points to the complex output vector
\r
6379 * @param[in] numSamples number of samples in each vector
\r
6381 void arm_cmplx_mult_real_q15(
\r
6382 q15_t * pSrcCmplx,
\r
6384 q15_t * pCmplxDst,
\r
6385 uint32_t numSamples);
\r
6389 * @brief Q31 complex-by-real multiplication
\r
6390 * @param[in] pSrcCmplx points to the complex input vector
\r
6391 * @param[in] pSrcReal points to the real input vector
\r
6392 * @param[out] pCmplxDst points to the complex output vector
\r
6393 * @param[in] numSamples number of samples in each vector
\r
6395 void arm_cmplx_mult_real_q31(
\r
6396 q31_t * pSrcCmplx,
\r
6398 q31_t * pCmplxDst,
\r
6399 uint32_t numSamples);
\r
6403 * @brief Floating-point complex-by-real multiplication
\r
6404 * @param[in] pSrcCmplx points to the complex input vector
\r
6405 * @param[in] pSrcReal points to the real input vector
\r
6406 * @param[out] pCmplxDst points to the complex output vector
\r
6407 * @param[in] numSamples number of samples in each vector
\r
6409 void arm_cmplx_mult_real_f32(
\r
6410 float32_t * pSrcCmplx,
\r
6411 float32_t * pSrcReal,
\r
6412 float32_t * pCmplxDst,
\r
6413 uint32_t numSamples);
\r
6417 * @brief Minimum value of a Q7 vector.
\r
6418 * @param[in] pSrc is input pointer
\r
6419 * @param[in] blockSize is the number of samples to process
\r
6420 * @param[out] result is output pointer
\r
6421 * @param[in] index is the array index of the minimum value in the input buffer.
\r
6425 uint32_t blockSize,
\r
6427 uint32_t * index);
\r
6431 * @brief Minimum value of a Q15 vector.
\r
6432 * @param[in] pSrc is input pointer
\r
6433 * @param[in] blockSize is the number of samples to process
\r
6434 * @param[out] pResult is output pointer
\r
6435 * @param[in] pIndex is the array index of the minimum value in the input buffer.
\r
6439 uint32_t blockSize,
\r
6441 uint32_t * pIndex);
\r
6445 * @brief Minimum value of a Q31 vector.
\r
6446 * @param[in] pSrc is input pointer
\r
6447 * @param[in] blockSize is the number of samples to process
\r
6448 * @param[out] pResult is output pointer
\r
6449 * @param[out] pIndex is the array index of the minimum value in the input buffer.
\r
6453 uint32_t blockSize,
\r
6455 uint32_t * pIndex);
\r
6459 * @brief Minimum value of a floating-point vector.
\r
6460 * @param[in] pSrc is input pointer
\r
6461 * @param[in] blockSize is the number of samples to process
\r
6462 * @param[out] pResult is output pointer
\r
6463 * @param[out] pIndex is the array index of the minimum value in the input buffer.
\r
6467 uint32_t blockSize,
\r
6468 float32_t * pResult,
\r
6469 uint32_t * pIndex);
\r
6473 * @brief Maximum value of a Q7 vector.
\r
6474 * @param[in] pSrc points to the input buffer
\r
6475 * @param[in] blockSize length of the input vector
\r
6476 * @param[out] pResult maximum value returned here
\r
6477 * @param[out] pIndex index of maximum value returned here
\r
6481 uint32_t blockSize,
\r
6483 uint32_t * pIndex);
\r
6487 * @brief Maximum value of a Q15 vector.
\r
6488 * @param[in] pSrc points to the input buffer
\r
6489 * @param[in] blockSize length of the input vector
\r
6490 * @param[out] pResult maximum value returned here
\r
6491 * @param[out] pIndex index of maximum value returned here
\r
6495 uint32_t blockSize,
\r
6497 uint32_t * pIndex);
\r
6501 * @brief Maximum value of a Q31 vector.
\r
6502 * @param[in] pSrc points to the input buffer
\r
6503 * @param[in] blockSize length of the input vector
\r
6504 * @param[out] pResult maximum value returned here
\r
6505 * @param[out] pIndex index of maximum value returned here
\r
6509 uint32_t blockSize,
\r
6511 uint32_t * pIndex);
\r
6515 * @brief Maximum value of a floating-point vector.
\r
6516 * @param[in] pSrc points to the input buffer
\r
6517 * @param[in] blockSize length of the input vector
\r
6518 * @param[out] pResult maximum value returned here
\r
6519 * @param[out] pIndex index of maximum value returned here
\r
6523 uint32_t blockSize,
\r
6524 float32_t * pResult,
\r
6525 uint32_t * pIndex);
\r
6529 * @brief Q15 complex-by-complex multiplication
\r
6530 * @param[in] pSrcA points to the first input vector
\r
6531 * @param[in] pSrcB points to the second input vector
\r
6532 * @param[out] pDst points to the output vector
\r
6533 * @param[in] numSamples number of complex samples in each vector
\r
6535 void arm_cmplx_mult_cmplx_q15(
\r
6539 uint32_t numSamples);
\r
6543 * @brief Q31 complex-by-complex multiplication
\r
6544 * @param[in] pSrcA points to the first input vector
\r
6545 * @param[in] pSrcB points to the second input vector
\r
6546 * @param[out] pDst points to the output vector
\r
6547 * @param[in] numSamples number of complex samples in each vector
\r
6549 void arm_cmplx_mult_cmplx_q31(
\r
6553 uint32_t numSamples);
\r
6557 * @brief Floating-point complex-by-complex multiplication
\r
6558 * @param[in] pSrcA points to the first input vector
\r
6559 * @param[in] pSrcB points to the second input vector
\r
6560 * @param[out] pDst points to the output vector
\r
6561 * @param[in] numSamples number of complex samples in each vector
\r
6563 void arm_cmplx_mult_cmplx_f32(
\r
6564 float32_t * pSrcA,
\r
6565 float32_t * pSrcB,
\r
6567 uint32_t numSamples);
\r
6571 * @brief Converts the elements of the floating-point vector to Q31 vector.
\r
6572 * @param[in] pSrc points to the floating-point input vector
\r
6573 * @param[out] pDst points to the Q31 output vector
\r
6574 * @param[in] blockSize length of the input vector
\r
6576 void arm_float_to_q31(
\r
6579 uint32_t blockSize);
\r
6583 * @brief Converts the elements of the floating-point vector to Q15 vector.
\r
6584 * @param[in] pSrc points to the floating-point input vector
\r
6585 * @param[out] pDst points to the Q15 output vector
\r
6586 * @param[in] blockSize length of the input vector
\r
6588 void arm_float_to_q15(
\r
6591 uint32_t blockSize);
\r
6595 * @brief Converts the elements of the floating-point vector to Q7 vector.
\r
6596 * @param[in] pSrc points to the floating-point input vector
\r
6597 * @param[out] pDst points to the Q7 output vector
\r
6598 * @param[in] blockSize length of the input vector
\r
6600 void arm_float_to_q7(
\r
6603 uint32_t blockSize);
\r
6607 * @brief Converts the elements of the Q31 vector to Q15 vector.
\r
6608 * @param[in] pSrc is input pointer
\r
6609 * @param[out] pDst is output pointer
\r
6610 * @param[in] blockSize is the number of samples to process
\r
6612 void arm_q31_to_q15(
\r
6615 uint32_t blockSize);
\r
6619 * @brief Converts the elements of the Q31 vector to Q7 vector.
\r
6620 * @param[in] pSrc is input pointer
\r
6621 * @param[out] pDst is output pointer
\r
6622 * @param[in] blockSize is the number of samples to process
\r
6624 void arm_q31_to_q7(
\r
6627 uint32_t blockSize);
\r
6631 * @brief Converts the elements of the Q15 vector to floating-point vector.
\r
6632 * @param[in] pSrc is input pointer
\r
6633 * @param[out] pDst is output pointer
\r
6634 * @param[in] blockSize is the number of samples to process
\r
6636 void arm_q15_to_float(
\r
6639 uint32_t blockSize);
\r
6643 * @brief Converts the elements of the Q15 vector to Q31 vector.
\r
6644 * @param[in] pSrc is input pointer
\r
6645 * @param[out] pDst is output pointer
\r
6646 * @param[in] blockSize is the number of samples to process
\r
6648 void arm_q15_to_q31(
\r
6651 uint32_t blockSize);
\r
6655 * @brief Converts the elements of the Q15 vector to Q7 vector.
\r
6656 * @param[in] pSrc is input pointer
\r
6657 * @param[out] pDst is output pointer
\r
6658 * @param[in] blockSize is the number of samples to process
\r
6660 void arm_q15_to_q7(
\r
6663 uint32_t blockSize);
\r
6667 * @ingroup groupInterpolation
\r
6671 * @defgroup BilinearInterpolate Bilinear Interpolation
\r
6673 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
\r
6674 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
\r
6675 * determines values between the grid points.
\r
6676 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
\r
6677 * Bilinear interpolation is often used in image processing to rescale images.
\r
6678 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
\r
6680 * <b>Algorithm</b>
\r
6682 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
\r
6683 * For floating-point, the instance structure is defined as:
\r
6687 * uint16_t numRows;
\r
6688 * uint16_t numCols;
\r
6689 * float32_t *pData;
\r
6690 * } arm_bilinear_interp_instance_f32;
\r
6694 * where <code>numRows</code> specifies the number of rows in the table;
\r
6695 * <code>numCols</code> specifies the number of columns in the table;
\r
6696 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
\r
6697 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
\r
6698 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
\r
6701 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
\r
6707 * The interpolated output point is computed as:
\r
6709 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
\r
6710 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
\r
6711 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
\r
6712 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
\r
6714 * Note that the coordinates (x, y) contain integer and fractional components.
\r
6715 * The integer components specify which portion of the table to use while the
\r
6716 * fractional components control the interpolation processor.
\r
6719 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
\r
6723 * @addtogroup BilinearInterpolate
\r
6730 * @brief Floating-point bilinear interpolation.
\r
6731 * @param[in,out] S points to an instance of the interpolation structure.
\r
6732 * @param[in] X interpolation coordinate.
\r
6733 * @param[in] Y interpolation coordinate.
\r
6734 * @return out interpolated value.
\r
6736 CMSIS_INLINE __STATIC_INLINE float32_t arm_bilinear_interp_f32(
\r
6737 const arm_bilinear_interp_instance_f32 * S,
\r
6742 float32_t f00, f01, f10, f11;
\r
6743 float32_t *pData = S->pData;
\r
6744 int32_t xIndex, yIndex, index;
\r
6745 float32_t xdiff, ydiff;
\r
6746 float32_t b1, b2, b3, b4;
\r
6748 xIndex = (int32_t) X;
\r
6749 yIndex = (int32_t) Y;
\r
6751 /* Care taken for table outside boundary */
\r
6752 /* Returns zero output when values are outside table boundary */
\r
6753 if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))
\r
6758 /* Calculation of index for two nearest points in X-direction */
\r
6759 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
\r
6762 /* Read two nearest points in X-direction */
\r
6763 f00 = pData[index];
\r
6764 f01 = pData[index + 1];
\r
6766 /* Calculation of index for two nearest points in Y-direction */
\r
6767 index = (xIndex - 1) + (yIndex) * S->numCols;
\r
6770 /* Read two nearest points in Y-direction */
\r
6771 f10 = pData[index];
\r
6772 f11 = pData[index + 1];
\r
6774 /* Calculation of intermediate values */
\r
6778 b4 = f00 - f01 - f10 + f11;
\r
6780 /* Calculation of fractional part in X */
\r
6781 xdiff = X - xIndex;
\r
6783 /* Calculation of fractional part in Y */
\r
6784 ydiff = Y - yIndex;
\r
6786 /* Calculation of bi-linear interpolated output */
\r
6787 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
\r
6789 /* return to application */
\r
6796 * @brief Q31 bilinear interpolation.
\r
6797 * @param[in,out] S points to an instance of the interpolation structure.
\r
6798 * @param[in] X interpolation coordinate in 12.20 format.
\r
6799 * @param[in] Y interpolation coordinate in 12.20 format.
\r
6800 * @return out interpolated value.
\r
6802 CMSIS_INLINE __STATIC_INLINE q31_t arm_bilinear_interp_q31(
\r
6803 arm_bilinear_interp_instance_q31 * S,
\r
6807 q31_t out; /* Temporary output */
\r
6808 q31_t acc = 0; /* output */
\r
6809 q31_t xfract, yfract; /* X, Y fractional parts */
\r
6810 q31_t x1, x2, y1, y2; /* Nearest output values */
\r
6811 int32_t rI, cI; /* Row and column indices */
\r
6812 q31_t *pYData = S->pData; /* pointer to output table values */
\r
6813 uint32_t nCols = S->numCols; /* num of rows */
\r
6815 /* Input is in 12.20 format */
\r
6816 /* 12 bits for the table index */
\r
6817 /* Index value calculation */
\r
6818 rI = ((X & (q31_t)0xFFF00000) >> 20);
\r
6820 /* Input is in 12.20 format */
\r
6821 /* 12 bits for the table index */
\r
6822 /* Index value calculation */
\r
6823 cI = ((Y & (q31_t)0xFFF00000) >> 20);
\r
6825 /* Care taken for table outside boundary */
\r
6826 /* Returns zero output when values are outside table boundary */
\r
6827 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
6832 /* 20 bits for the fractional part */
\r
6833 /* shift left xfract by 11 to keep 1.31 format */
\r
6834 xfract = (X & 0x000FFFFF) << 11U;
\r
6836 /* Read two nearest output values from the index */
\r
6837 x1 = pYData[(rI) + (int32_t)nCols * (cI) ];
\r
6838 x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
\r
6840 /* 20 bits for the fractional part */
\r
6841 /* shift left yfract by 11 to keep 1.31 format */
\r
6842 yfract = (Y & 0x000FFFFF) << 11U;
\r
6844 /* Read two nearest output values from the index */
\r
6845 y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ];
\r
6846 y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
\r
6848 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
\r
6849 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
\r
6850 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
\r
6852 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
\r
6853 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
\r
6854 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
\r
6856 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
6857 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
\r
6858 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
6860 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
6861 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
\r
6862 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
6864 /* Convert acc to 1.31(q31) format */
\r
6865 return ((q31_t)(acc << 2));
\r
6870 * @brief Q15 bilinear interpolation.
\r
6871 * @param[in,out] S points to an instance of the interpolation structure.
\r
6872 * @param[in] X interpolation coordinate in 12.20 format.
\r
6873 * @param[in] Y interpolation coordinate in 12.20 format.
\r
6874 * @return out interpolated value.
\r
6876 CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(
\r
6877 arm_bilinear_interp_instance_q15 * S,
\r
6881 q63_t acc = 0; /* output */
\r
6882 q31_t out; /* Temporary output */
\r
6883 q15_t x1, x2, y1, y2; /* Nearest output values */
\r
6884 q31_t xfract, yfract; /* X, Y fractional parts */
\r
6885 int32_t rI, cI; /* Row and column indices */
\r
6886 q15_t *pYData = S->pData; /* pointer to output table values */
\r
6887 uint32_t nCols = S->numCols; /* num of rows */
\r
6889 /* Input is in 12.20 format */
\r
6890 /* 12 bits for the table index */
\r
6891 /* Index value calculation */
\r
6892 rI = ((X & (q31_t)0xFFF00000) >> 20);
\r
6894 /* Input is in 12.20 format */
\r
6895 /* 12 bits for the table index */
\r
6896 /* Index value calculation */
\r
6897 cI = ((Y & (q31_t)0xFFF00000) >> 20);
\r
6899 /* Care taken for table outside boundary */
\r
6900 /* Returns zero output when values are outside table boundary */
\r
6901 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
6906 /* 20 bits for the fractional part */
\r
6907 /* xfract should be in 12.20 format */
\r
6908 xfract = (X & 0x000FFFFF);
\r
6910 /* Read two nearest output values from the index */
\r
6911 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
\r
6912 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
\r
6914 /* 20 bits for the fractional part */
\r
6915 /* yfract should be in 12.20 format */
\r
6916 yfract = (Y & 0x000FFFFF);
\r
6918 /* Read two nearest output values from the index */
\r
6919 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
\r
6920 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
\r
6922 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
\r
6924 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
\r
6925 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
\r
6926 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4U);
\r
6927 acc = ((q63_t) out * (0xFFFFF - yfract));
\r
6929 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
\r
6930 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4U);
\r
6931 acc += ((q63_t) out * (xfract));
\r
6933 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
\r
6934 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4U);
\r
6935 acc += ((q63_t) out * (yfract));
\r
6937 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
\r
6938 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U);
\r
6939 acc += ((q63_t) out * (yfract));
\r
6941 /* acc is in 13.51 format and down shift acc by 36 times */
\r
6942 /* Convert out to 1.15 format */
\r
6943 return ((q15_t)(acc >> 36));
\r
6948 * @brief Q7 bilinear interpolation.
\r
6949 * @param[in,out] S points to an instance of the interpolation structure.
\r
6950 * @param[in] X interpolation coordinate in 12.20 format.
\r
6951 * @param[in] Y interpolation coordinate in 12.20 format.
\r
6952 * @return out interpolated value.
\r
6954 CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7(
\r
6955 arm_bilinear_interp_instance_q7 * S,
\r
6959 q63_t acc = 0; /* output */
\r
6960 q31_t out; /* Temporary output */
\r
6961 q31_t xfract, yfract; /* X, Y fractional parts */
\r
6962 q7_t x1, x2, y1, y2; /* Nearest output values */
\r
6963 int32_t rI, cI; /* Row and column indices */
\r
6964 q7_t *pYData = S->pData; /* pointer to output table values */
\r
6965 uint32_t nCols = S->numCols; /* num of rows */
\r
6967 /* Input is in 12.20 format */
\r
6968 /* 12 bits for the table index */
\r
6969 /* Index value calculation */
\r
6970 rI = ((X & (q31_t)0xFFF00000) >> 20);
\r
6972 /* Input is in 12.20 format */
\r
6973 /* 12 bits for the table index */
\r
6974 /* Index value calculation */
\r
6975 cI = ((Y & (q31_t)0xFFF00000) >> 20);
\r
6977 /* Care taken for table outside boundary */
\r
6978 /* Returns zero output when values are outside table boundary */
\r
6979 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
6984 /* 20 bits for the fractional part */
\r
6985 /* xfract should be in 12.20 format */
\r
6986 xfract = (X & (q31_t)0x000FFFFF);
\r
6988 /* Read two nearest output values from the index */
\r
6989 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
\r
6990 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
\r
6992 /* 20 bits for the fractional part */
\r
6993 /* yfract should be in 12.20 format */
\r
6994 yfract = (Y & (q31_t)0x000FFFFF);
\r
6996 /* Read two nearest output values from the index */
\r
6997 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
\r
6998 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
\r
7000 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
\r
7001 out = ((x1 * (0xFFFFF - xfract)));
\r
7002 acc = (((q63_t) out * (0xFFFFF - yfract)));
\r
7004 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
\r
7005 out = ((x2 * (0xFFFFF - yfract)));
\r
7006 acc += (((q63_t) out * (xfract)));
\r
7008 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
\r
7009 out = ((y1 * (0xFFFFF - xfract)));
\r
7010 acc += (((q63_t) out * (yfract)));
\r
7012 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
\r
7013 out = ((y2 * (yfract)));
\r
7014 acc += (((q63_t) out * (xfract)));
\r
7016 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
\r
7017 return ((q7_t)(acc >> 40));
\r
7021 * @} end of BilinearInterpolate group
\r
7026 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7027 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7030 #define multSub_32x32_keep32_R(a, x, y) \
\r
7031 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7034 #define mult_32x32_keep32_R(a, x, y) \
\r
7035 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
\r
7038 #define multAcc_32x32_keep32(a, x, y) \
\r
7039 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7042 #define multSub_32x32_keep32(a, x, y) \
\r
7043 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7046 #define mult_32x32_keep32(a, x, y) \
\r
7047 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7050 #if defined ( __CC_ARM )
\r
7051 /* Enter low optimization region - place directly above function definition */
\r
7052 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
\r
7053 #define LOW_OPTIMIZATION_ENTER \
\r
7054 _Pragma ("push") \
\r
7057 #define LOW_OPTIMIZATION_ENTER
\r
7060 /* Exit low optimization region - place directly after end of function definition */
\r
7061 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
\r
7062 #define LOW_OPTIMIZATION_EXIT \
\r
7065 #define LOW_OPTIMIZATION_EXIT
\r
7068 /* Enter low optimization region - place directly above function definition */
\r
7069 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7071 /* Exit low optimization region - place directly after end of function definition */
\r
7072 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7074 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
7075 #define LOW_OPTIMIZATION_ENTER
\r
7076 #define LOW_OPTIMIZATION_EXIT
\r
7077 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7078 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7080 #elif defined ( __GNUC__ )
\r
7081 #define LOW_OPTIMIZATION_ENTER \
\r
7082 __attribute__(( optimize("-O1") ))
\r
7083 #define LOW_OPTIMIZATION_EXIT
\r
7084 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7085 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7087 #elif defined ( __ICCARM__ )
\r
7088 /* Enter low optimization region - place directly above function definition */
\r
7089 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
\r
7090 #define LOW_OPTIMIZATION_ENTER \
\r
7091 _Pragma ("optimize=low")
\r
7093 #define LOW_OPTIMIZATION_ENTER
\r
7096 /* Exit low optimization region - place directly after end of function definition */
\r
7097 #define LOW_OPTIMIZATION_EXIT
\r
7099 /* Enter low optimization region - place directly above function definition */
\r
7100 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
\r
7101 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
\r
7102 _Pragma ("optimize=low")
\r
7104 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7107 /* Exit low optimization region - place directly after end of function definition */
\r
7108 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7110 #elif defined ( __TI_ARM__ )
\r
7111 #define LOW_OPTIMIZATION_ENTER
\r
7112 #define LOW_OPTIMIZATION_EXIT
\r
7113 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7114 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7116 #elif defined ( __CSMC__ )
\r
7117 #define LOW_OPTIMIZATION_ENTER
\r
7118 #define LOW_OPTIMIZATION_EXIT
\r
7119 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7120 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7122 #elif defined ( __TASKING__ )
\r
7123 #define LOW_OPTIMIZATION_ENTER
\r
7124 #define LOW_OPTIMIZATION_EXIT
\r
7125 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7126 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7131 #ifdef __cplusplus
\r
7135 /* Compiler specific diagnostic adjustment */
\r
7136 #if defined ( __CC_ARM )
\r
7138 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
7140 #elif defined ( __GNUC__ )
\r
7141 #pragma GCC diagnostic pop
\r
7143 #elif defined ( __ICCARM__ )
\r
7145 #elif defined ( __TI_ARM__ )
\r
7147 #elif defined ( __CSMC__ )
\r
7149 #elif defined ( __TASKING__ )
\r
7152 #error Unknown compiler
\r
7155 #endif /* _ARM_MATH_H */
\r