1 /* ----------------------------------------------------------------------
\r
2 * Project: CMSIS DSP Library
\r
4 * Description: Public header file for CMSIS DSP Library
\r
6 * $Date: 27. January 2017
\r
9 * Target Processor: Cortex-M cores
\r
10 * -------------------------------------------------------------------- */
\r
12 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
\r
14 * SPDX-License-Identifier: Apache-2.0
\r
16 * Licensed under the Apache License, Version 2.0 (the License); you may
\r
17 * not use this file except in compliance with the License.
\r
18 * You may obtain a copy of the License at
\r
20 * www.apache.org/licenses/LICENSE-2.0
\r
22 * Unless required by applicable law or agreed to in writing, software
\r
23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
\r
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
25 * See the License for the specific language governing permissions and
\r
26 * limitations under the License.
\r
30 \mainpage CMSIS DSP Software Library
\r
35 * This user manual describes the CMSIS DSP software library,
\r
36 * a suite of common signal processing functions for use on Cortex-M processor based devices.
\r
38 * The library is divided into a number of functions each covering a specific category:
\r
39 * - Basic math functions
\r
40 * - Fast math functions
\r
41 * - Complex math functions
\r
43 * - Matrix functions
\r
45 * - Motor control functions
\r
46 * - Statistical functions
\r
47 * - Support functions
\r
48 * - Interpolation functions
\r
50 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
\r
51 * 32-bit integer and 32-bit floating-point values.
\r
56 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
\r
57 * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
\r
58 * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
\r
59 * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
\r
60 * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
\r
61 * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
\r
62 * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
\r
63 * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
\r
64 * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
\r
65 * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
\r
66 * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
\r
67 * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
\r
68 * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
\r
69 * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
\r
70 * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
\r
71 * - arm_ARMv8MBLl_math.lib (ARMv8M Baseline, Little endian)
\r
72 * - arm_ARMv8MMLl_math.lib (ARMv8M Mainline, Little endian)
\r
73 * - arm_ARMv8MMLlfsp_math.lib (ARMv8M Mainline, Little endian, Single Precision Floating Point Unit)
\r
74 * - arm_ARMv8MMLld_math.lib (ARMv8M Mainline, Little endian, DSP instructions)
\r
75 * - arm_ARMv8MMLldfsp_math.lib (ARMv8M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
\r
77 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
\r
78 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
\r
79 * 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
80 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
\r
81 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
\r
82 * For ARMv8M cores define pre processor MACRO ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML.
\r
83 * Set Pre processor MACRO __DSP_PRESENT if ARMv8M Mainline core supports DSP instructions.
\r
89 * The library ships with a number of examples which demonstrate how to use the library functions.
\r
94 * The library has been developed and tested with MDK-ARM version 5.14.0.0
\r
95 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
\r
97 * Building the Library
\r
100 * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
\r
101 * - arm_cortexM_math.uvprojx
\r
104 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
\r
106 * Pre-processor Macros
\r
109 * Each library project have differant pre-processor macros.
\r
111 * - UNALIGNED_SUPPORT_DISABLE:
\r
113 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
\r
115 * - ARM_MATH_BIG_ENDIAN:
\r
117 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
\r
119 * - ARM_MATH_MATRIX_CHECK:
\r
121 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
\r
123 * - ARM_MATH_ROUNDING:
\r
125 * Define macro ARM_MATH_ROUNDING for rounding on support functions
\r
129 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
\r
130 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
\r
131 * ARM_MATH_CM7 for building the library on cortex-M7.
\r
133 * - ARM_MATH_ARMV8MxL:
\r
135 * Define macro ARM_MATH_ARMV8MBL for building the library on ARMv8M Baseline target, ARM_MATH_ARMV8MBL for building library
\r
136 * on ARMv8M Mainline target.
\r
140 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries.
\r
144 * Initialize macro __DSP_PRESENT = 1 when ARMv8M Mainline core supports DSP instructions.
\r
147 * CMSIS-DSP in ARM::CMSIS Pack
\r
148 * -----------------------------
\r
150 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
\r
151 * |File/Folder |Content |
\r
152 * |------------------------------|------------------------------------------------------------------------|
\r
153 * |\b CMSIS\\Documentation\\DSP | This documentation |
\r
154 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
\r
155 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
\r
156 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
\r
159 * Revision History of CMSIS-DSP
\r
161 * Please refer to \ref ChangeLog_pg.
\r
166 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
\r
171 * @defgroup groupMath Basic Math Functions
\r
175 * @defgroup groupFastMath Fast Math Functions
\r
176 * This set of functions provides a fast approximation to sine, cosine, and square root.
\r
177 * As compared to most of the other functions in the CMSIS math library, the fast math functions
\r
178 * operate on individual values and not arrays.
\r
179 * There are separate functions for Q15, Q31, and floating-point data.
\r
184 * @defgroup groupCmplxMath Complex Math Functions
\r
185 * This set of functions operates on complex data vectors.
\r
186 * The data in the complex arrays is stored in an interleaved fashion
\r
187 * (real, imag, real, imag, ...).
\r
188 * In the API functions, the number of samples in a complex array refers
\r
189 * to the number of complex values; the array contains twice this number of
\r
194 * @defgroup groupFilters Filtering Functions
\r
198 * @defgroup groupMatrix Matrix Functions
\r
200 * This set of functions provides basic matrix math operations.
\r
201 * The functions operate on matrix data structures. For example,
\r
203 * definition for the floating-point matrix structure is shown
\r
208 * uint16_t numRows; // number of rows of the matrix.
\r
209 * uint16_t numCols; // number of columns of the matrix.
\r
210 * float32_t *pData; // points to the data of the matrix.
\r
211 * } arm_matrix_instance_f32;
\r
213 * There are similar definitions for Q15 and Q31 data types.
\r
215 * The structure specifies the size of the matrix and then points to
\r
216 * an array of data. The array is of size <code>numRows X numCols</code>
\r
217 * and the values are arranged in row order. That is, the
\r
218 * matrix element (i, j) is stored at:
\r
220 * pData[i*numCols + j]
\r
223 * \par Init Functions
\r
224 * There is an associated initialization function for each type of matrix
\r
226 * The initialization function sets the values of the internal structure fields.
\r
227 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
\r
228 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
\r
231 * Use of the initialization function is optional. However, if initialization function is used
\r
232 * then the instance structure cannot be placed into a const data section.
\r
233 * To place the instance structure in a const data
\r
234 * section, manually initialize the data structure. For example:
\r
236 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
\r
237 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
\r
238 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
\r
240 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
\r
241 * specifies the number of columns, and <code>pData</code> points to the
\r
244 * \par Size Checking
\r
245 * By default all of the matrix functions perform size checking on the input and
\r
246 * output matrices. For example, the matrix addition function verifies that the
\r
247 * two input matrices and the output matrix all have the same number of rows and
\r
248 * columns. If the size check fails the functions return:
\r
250 * ARM_MATH_SIZE_MISMATCH
\r
252 * Otherwise the functions return
\r
256 * There is some overhead associated with this matrix size checking.
\r
257 * The matrix size checking is enabled via the \#define
\r
259 * ARM_MATH_MATRIX_CHECK
\r
261 * within the library project settings. By default this macro is defined
\r
262 * and size checking is enabled. By changing the project settings and
\r
263 * undefining this macro size checking is eliminated and the functions
\r
264 * run a bit faster. With size checking disabled the functions always
\r
265 * return <code>ARM_MATH_SUCCESS</code>.
\r
269 * @defgroup groupTransforms Transform Functions
\r
273 * @defgroup groupController Controller Functions
\r
277 * @defgroup groupStats Statistics Functions
\r
280 * @defgroup groupSupport Support Functions
\r
284 * @defgroup groupInterpolation Interpolation Functions
\r
285 * These functions perform 1- and 2-dimensional interpolation of data.
\r
286 * Linear interpolation is used for 1-dimensional data and
\r
287 * bilinear interpolation is used for 2-dimensional data.
\r
291 * @defgroup groupExamples Examples
\r
293 #ifndef _ARM_MATH_H
\r
294 #define _ARM_MATH_H
\r
296 /* Compiler specific diagnostic adjustment */
\r
297 #if defined ( __CC_ARM )
\r
299 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
301 #elif defined ( __GNUC__ )
\r
302 #pragma GCC diagnostic push
\r
303 #pragma GCC diagnostic ignored "-Wsign-conversion"
\r
304 #pragma GCC diagnostic ignored "-Wconversion"
\r
305 #pragma GCC diagnostic ignored "-Wunused-parameter"
\r
307 #elif defined ( __ICCARM__ )
\r
309 #elif defined ( __TI_ARM__ )
\r
311 #elif defined ( __CSMC__ )
\r
313 #elif defined ( __TASKING__ )
\r
316 #error Unknown compiler
\r
320 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
\r
322 #if defined(ARM_MATH_CM7)
\r
323 #include "core_cm7.h"
\r
324 #define ARM_MATH_DSP
\r
325 #elif defined (ARM_MATH_CM4)
\r
326 #include "core_cm4.h"
\r
327 #define ARM_MATH_DSP
\r
328 #elif defined (ARM_MATH_CM3)
\r
329 #include "core_cm3.h"
\r
330 #elif defined (ARM_MATH_CM0)
\r
331 #include "core_cm0.h"
\r
332 #define ARM_MATH_CM0_FAMILY
\r
333 #elif defined (ARM_MATH_CM0PLUS)
\r
334 #include "core_cm0plus.h"
\r
335 #define ARM_MATH_CM0_FAMILY
\r
336 #elif defined (ARM_MATH_ARMV8MBL)
\r
337 #include "core_armv8mbl.h"
\r
338 #define ARM_MATH_CM0_FAMILY
\r
339 #elif defined (ARM_MATH_ARMV8MML)
\r
340 #include "core_armv8mml.h"
\r
341 #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1))
\r
342 #define ARM_MATH_DSP
\r
345 #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
348 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
\r
349 #include "string.h"
\r
358 * @brief Macros required for reciprocal calculation in Normalized LMS
\r
361 #define DELTA_Q31 (0x100)
\r
362 #define DELTA_Q15 0x5
\r
363 #define INDEX_MASK 0x0000003F
\r
365 #define PI 3.14159265358979f
\r
369 * @brief Macros required for SINE and COSINE Fast math approximations
\r
372 #define FAST_MATH_TABLE_SIZE 512
\r
373 #define FAST_MATH_Q31_SHIFT (32 - 10)
\r
374 #define FAST_MATH_Q15_SHIFT (16 - 10)
\r
375 #define CONTROLLER_Q31_SHIFT (32 - 9)
\r
376 #define TABLE_SPACING_Q31 0x400000
\r
377 #define TABLE_SPACING_Q15 0x80
\r
380 * @brief Macros required for SINE and COSINE Controller functions
\r
382 /* 1.31(q31) Fixed value of 2/360 */
\r
383 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
\r
384 #define INPUT_SPACING 0xB60B61
\r
387 * @brief Macro for Unaligned Support
\r
389 #ifndef UNALIGNED_SUPPORT_DISABLE
\r
392 #if defined (__GNUC__)
\r
393 #define ALIGN4 __attribute__((aligned(4)))
\r
395 #define ALIGN4 __align(4)
\r
397 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
\r
400 * @brief Error status returned by some functions in the library.
\r
405 ARM_MATH_SUCCESS = 0, /**< No error */
\r
406 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
\r
407 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
\r
408 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
\r
409 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
\r
410 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
\r
411 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
\r
415 * @brief 8-bit fractional data type in 1.7 format.
\r
417 typedef int8_t q7_t;
\r
420 * @brief 16-bit fractional data type in 1.15 format.
\r
422 typedef int16_t q15_t;
\r
425 * @brief 32-bit fractional data type in 1.31 format.
\r
427 typedef int32_t q31_t;
\r
430 * @brief 64-bit fractional data type in 1.63 format.
\r
432 typedef int64_t q63_t;
\r
435 * @brief 32-bit floating-point type definition.
\r
437 typedef float float32_t;
\r
440 * @brief 64-bit floating-point type definition.
\r
442 typedef double float64_t;
\r
445 * @brief definition to read/write two 16 bit values.
\r
447 #if defined ( __CC_ARM )
\r
448 #define __SIMD32_TYPE int32_t __packed
\r
449 #define CMSIS_UNUSED __attribute__((unused))
\r
450 #define CMSIS_INLINE __attribute__((always_inline))
\r
452 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
453 #define __SIMD32_TYPE int32_t
\r
454 #define CMSIS_UNUSED __attribute__((unused))
\r
455 #define CMSIS_INLINE __attribute__((always_inline))
\r
457 #elif defined ( __GNUC__ )
\r
458 #define __SIMD32_TYPE int32_t
\r
459 #define CMSIS_UNUSED __attribute__((unused))
\r
460 #define CMSIS_INLINE __attribute__((always_inline))
\r
462 #elif defined ( __ICCARM__ )
\r
463 #define __SIMD32_TYPE int32_t __packed
\r
464 #define CMSIS_UNUSED
\r
465 #define CMSIS_INLINE
\r
467 #elif defined ( __TI_ARM__ )
\r
468 #define __SIMD32_TYPE int32_t
\r
469 #define CMSIS_UNUSED __attribute__((unused))
\r
470 #define CMSIS_INLINE
\r
472 #elif defined ( __CSMC__ )
\r
473 #define __SIMD32_TYPE int32_t
\r
474 #define CMSIS_UNUSED
\r
475 #define CMSIS_INLINE
\r
477 #elif defined ( __TASKING__ )
\r
478 #define __SIMD32_TYPE __unaligned int32_t
\r
479 #define CMSIS_UNUSED
\r
480 #define CMSIS_INLINE
\r
483 #error Unknown compiler
\r
486 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
\r
487 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
\r
488 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
\r
489 #define __SIMD64(addr) (*(int64_t **) & (addr))
\r
491 /* #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
492 #if !defined (ARM_MATH_DSP)
\r
494 * @brief definition to pack two 16 bit values.
\r
496 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
\r
497 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
\r
498 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
\r
499 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
\r
501 /* #endif // defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
502 #endif /* !defined (ARM_MATH_DSP) */
\r
505 * @brief definition to pack four 8 bit values.
\r
507 #ifndef ARM_MATH_BIG_ENDIAN
\r
509 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
\r
510 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
\r
511 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
\r
512 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
\r
515 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
\r
516 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
\r
517 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
\r
518 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
\r
524 * @brief Clips Q63 to Q31 values.
\r
526 CMSIS_INLINE __STATIC_INLINE q31_t clip_q63_to_q31(
\r
529 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
530 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
\r
534 * @brief Clips Q63 to Q15 values.
\r
536 CMSIS_INLINE __STATIC_INLINE q15_t clip_q63_to_q15(
\r
539 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
\r
540 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
\r
544 * @brief Clips Q31 to Q7 values.
\r
546 CMSIS_INLINE __STATIC_INLINE q7_t clip_q31_to_q7(
\r
549 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
\r
550 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
\r
554 * @brief Clips Q31 to Q15 values.
\r
556 CMSIS_INLINE __STATIC_INLINE q15_t clip_q31_to_q15(
\r
559 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
\r
560 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
\r
564 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
\r
567 CMSIS_INLINE __STATIC_INLINE q63_t mult32x64(
\r
571 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
\r
572 (((q63_t) (x >> 32) * y)));
\r
576 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
\r
577 #define __CLZ __clz
\r
580 /* note: function can be removed when all toolchain support __CLZ for Cortex-M0 */
\r
581 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
\r
582 CMSIS_INLINE __STATIC_INLINE uint32_t __CLZ(
\r
585 CMSIS_INLINE __STATIC_INLINE uint32_t __CLZ(
\r
588 uint32_t count = 0;
\r
589 uint32_t mask = 0x80000000;
\r
591 while ((data & mask) == 0)
\r
602 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
\r
605 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q31(
\r
608 q31_t * pRecipTable)
\r
617 signBits = ((uint32_t) (__CLZ( in) - 1));
\r
621 signBits = ((uint32_t) (__CLZ(-in) - 1));
\r
624 /* Convert input sample to 1.31 format */
\r
625 in = (in << signBits);
\r
627 /* calculation of index for initial approximated Val */
\r
628 index = (uint32_t)(in >> 24);
\r
629 index = (index & INDEX_MASK);
\r
631 /* 1.31 with exp 1 */
\r
632 out = pRecipTable[index];
\r
634 /* calculation of reciprocal value */
\r
635 /* running approximation for two iterations */
\r
636 for (i = 0u; i < 2u; i++)
\r
638 tempVal = (uint32_t) (((q63_t) in * out) >> 31);
\r
639 tempVal = 0x7FFFFFFFu - tempVal;
\r
640 /* 1.31 with exp 1 */
\r
641 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
\r
642 out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
\r
648 /* return num of signbits of out = 1/in value */
\r
649 return (signBits + 1u);
\r
654 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
\r
656 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q15(
\r
659 q15_t * pRecipTable)
\r
662 uint32_t tempVal = 0;
\r
663 uint32_t index = 0, i = 0;
\r
664 uint32_t signBits = 0;
\r
668 signBits = ((uint32_t)(__CLZ( in) - 17));
\r
672 signBits = ((uint32_t)(__CLZ(-in) - 17));
\r
675 /* Convert input sample to 1.15 format */
\r
676 in = (in << signBits);
\r
678 /* calculation of index for initial approximated Val */
\r
679 index = (uint32_t)(in >> 8);
\r
680 index = (index & INDEX_MASK);
\r
682 /* 1.15 with exp 1 */
\r
683 out = pRecipTable[index];
\r
685 /* calculation of reciprocal value */
\r
686 /* running approximation for two iterations */
\r
687 for (i = 0u; i < 2u; i++)
\r
689 tempVal = (uint32_t) (((q31_t) in * out) >> 15);
\r
690 tempVal = 0x7FFFu - tempVal;
\r
691 /* 1.15 with exp 1 */
\r
692 out = (q15_t) (((q31_t) out * tempVal) >> 14);
\r
693 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
\r
699 /* return num of signbits of out = 1/in value */
\r
700 return (signBits + 1);
\r
705 * @brief C custom defined intrinisic function for only M0 processors
\r
707 #if defined(ARM_MATH_CM0_FAMILY)
\r
708 CMSIS_INLINE __STATIC_INLINE q31_t __SSAT(
\r
712 int32_t posMax, negMin;
\r
716 for (i = 0; i < (y - 1); i++)
\r
718 posMax = posMax * 2;
\r
723 posMax = (posMax - 1);
\r
741 #endif /* end of ARM_MATH_CM0_FAMILY */
\r
745 * @brief C custom defined intrinsic function for M3 and M0 processors
\r
747 /* #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
748 #if !defined (ARM_MATH_DSP)
\r
751 * @brief C custom defined QADD8 for M3 and M0 processors
\r
753 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD8(
\r
759 r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
\r
760 s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
\r
761 t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
\r
762 u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
\r
764 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
\r
769 * @brief C custom defined QSUB8 for M3 and M0 processors
\r
771 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB8(
\r
777 r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
\r
778 s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
\r
779 t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
\r
780 u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
\r
782 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
\r
787 * @brief C custom defined QADD16 for M3 and M0 processors
\r
789 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD16(
\r
793 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
\r
794 q31_t r = 0, s = 0;
\r
796 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
797 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
799 return ((uint32_t)((s << 16) | (r )));
\r
804 * @brief C custom defined SHADD16 for M3 and M0 processors
\r
806 CMSIS_INLINE __STATIC_INLINE uint32_t __SHADD16(
\r
812 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
813 s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
815 return ((uint32_t)((s << 16) | (r )));
\r
820 * @brief C custom defined QSUB16 for M3 and M0 processors
\r
822 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB16(
\r
828 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
829 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
831 return ((uint32_t)((s << 16) | (r )));
\r
836 * @brief C custom defined SHSUB16 for M3 and M0 processors
\r
838 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSUB16(
\r
844 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
845 s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
847 return ((uint32_t)((s << 16) | (r )));
\r
852 * @brief C custom defined QASX for M3 and M0 processors
\r
854 CMSIS_INLINE __STATIC_INLINE uint32_t __QASX(
\r
860 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
861 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
863 return ((uint32_t)((s << 16) | (r )));
\r
868 * @brief C custom defined SHASX for M3 and M0 processors
\r
870 CMSIS_INLINE __STATIC_INLINE uint32_t __SHASX(
\r
876 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
877 s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
879 return ((uint32_t)((s << 16) | (r )));
\r
884 * @brief C custom defined QSAX for M3 and M0 processors
\r
886 CMSIS_INLINE __STATIC_INLINE uint32_t __QSAX(
\r
892 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
893 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
\r
895 return ((uint32_t)((s << 16) | (r )));
\r
900 * @brief C custom defined SHSAX for M3 and M0 processors
\r
902 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSAX(
\r
908 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
909 s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
\r
911 return ((uint32_t)((s << 16) | (r )));
\r
916 * @brief C custom defined SMUSDX for M3 and M0 processors
\r
918 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSDX(
\r
922 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
\r
923 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
\r
927 * @brief C custom defined SMUADX for M3 and M0 processors
\r
929 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUADX(
\r
933 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
\r
934 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
\r
939 * @brief C custom defined QADD for M3 and M0 processors
\r
941 CMSIS_INLINE __STATIC_INLINE int32_t __QADD(
\r
945 return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
\r
950 * @brief C custom defined QSUB for M3 and M0 processors
\r
952 CMSIS_INLINE __STATIC_INLINE int32_t __QSUB(
\r
956 return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
\r
961 * @brief C custom defined SMLAD for M3 and M0 processors
\r
963 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLAD(
\r
968 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
969 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
\r
970 ( ((q31_t)sum ) ) ));
\r
975 * @brief C custom defined SMLADX for M3 and M0 processors
\r
977 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLADX(
\r
982 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
\r
983 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
984 ( ((q31_t)sum ) ) ));
\r
989 * @brief C custom defined SMLSDX for M3 and M0 processors
\r
991 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLSDX(
\r
996 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
\r
997 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
998 ( ((q31_t)sum ) ) ));
\r
1003 * @brief C custom defined SMLALD for M3 and M0 processors
\r
1005 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALD(
\r
1010 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
\r
1011 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
1012 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
\r
1013 ( ((q63_t)sum ) ) ));
\r
1018 * @brief C custom defined SMLALDX for M3 and M0 processors
\r
1020 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALDX(
\r
1025 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
\r
1026 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
\r
1027 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
1028 ( ((q63_t)sum ) ) ));
\r
1033 * @brief C custom defined SMUAD for M3 and M0 processors
\r
1035 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUAD(
\r
1039 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
\r
1040 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
\r
1045 * @brief C custom defined SMUSD for M3 and M0 processors
\r
1047 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSD(
\r
1051 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
\r
1052 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
\r
1057 * @brief C custom defined SXTB16 for M3 and M0 processors
\r
1059 CMSIS_INLINE __STATIC_INLINE uint32_t __SXTB16(
\r
1062 return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
\r
1063 ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
\r
1067 * @brief C custom defined SMMLA for M3 and M0 processors
\r
1069 CMSIS_INLINE __STATIC_INLINE int32_t __SMMLA(
\r
1074 return (sum + (int32_t) (((int64_t) x * y) >> 32));
\r
1079 * @brief C custom defined PKHBT for unavailable DSP extension
\r
1081 CMSIS_INLINE __STATIC_INLINE uint32_t __PKHBT(
\r
1084 uint32_t leftshift)
\r
1086 return ( ((x ) & 0x0000FFFFUL) |
\r
1087 ((y << leftshift) & 0xFFFF0000UL) );
\r
1091 * @brief C custom defined PKHTB for unavailable DSP extension
\r
1093 CMSIS_INLINE __STATIC_INLINE uint32_t __PKHTB(
\r
1096 uint32_t rightshift)
\r
1098 return ( ((x ) & 0xFFFF0000UL) |
\r
1099 ((y >> rightshift) & 0x0000FFFFUL) );
\r
1103 /* #endif // defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
\r
1104 #endif /* !defined (ARM_MATH_DSP) */
\r
1108 * @brief Instance structure for the Q7 FIR filter.
\r
1112 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1113 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1114 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1115 } arm_fir_instance_q7;
\r
1118 * @brief Instance structure for the Q15 FIR filter.
\r
1122 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1123 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1124 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
1125 } arm_fir_instance_q15;
\r
1128 * @brief Instance structure for the Q31 FIR filter.
\r
1132 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1133 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1134 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1135 } arm_fir_instance_q31;
\r
1138 * @brief Instance structure for the floating-point FIR filter.
\r
1142 uint16_t numTaps; /**< number of filter coefficients in the filter. */
\r
1143 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
1144 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
1145 } arm_fir_instance_f32;
\r
1149 * @brief Processing function for the Q7 FIR filter.
\r
1150 * @param[in] S points to an instance of the Q7 FIR filter structure.
\r
1151 * @param[in] pSrc points to the block of input data.
\r
1152 * @param[out] pDst points to the block of output data.
\r
1153 * @param[in] blockSize number of samples to process.
\r
1156 const arm_fir_instance_q7 * S,
\r
1159 uint32_t blockSize);
\r
1163 * @brief Initialization function for the Q7 FIR filter.
\r
1164 * @param[in,out] S points to an instance of the Q7 FIR structure.
\r
1165 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1166 * @param[in] pCoeffs points to the filter coefficients.
\r
1167 * @param[in] pState points to the state buffer.
\r
1168 * @param[in] blockSize number of samples that are processed.
\r
1170 void arm_fir_init_q7(
\r
1171 arm_fir_instance_q7 * S,
\r
1175 uint32_t blockSize);
\r
1179 * @brief Processing function for the Q15 FIR filter.
\r
1180 * @param[in] S points to an instance of the Q15 FIR structure.
\r
1181 * @param[in] pSrc points to the block of input data.
\r
1182 * @param[out] pDst points to the block of output data.
\r
1183 * @param[in] blockSize number of samples to process.
\r
1186 const arm_fir_instance_q15 * S,
\r
1189 uint32_t blockSize);
\r
1193 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
\r
1194 * @param[in] S points to an instance of the Q15 FIR filter structure.
\r
1195 * @param[in] pSrc points to the block of input data.
\r
1196 * @param[out] pDst points to the block of output data.
\r
1197 * @param[in] blockSize number of samples to process.
\r
1199 void arm_fir_fast_q15(
\r
1200 const arm_fir_instance_q15 * S,
\r
1203 uint32_t blockSize);
\r
1207 * @brief Initialization function for the Q15 FIR filter.
\r
1208 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
\r
1209 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
\r
1210 * @param[in] pCoeffs points to the filter coefficients.
\r
1211 * @param[in] pState points to the state buffer.
\r
1212 * @param[in] blockSize number of samples that are processed at a time.
\r
1213 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
\r
1214 * <code>numTaps</code> is not a supported value.
\r
1216 arm_status arm_fir_init_q15(
\r
1217 arm_fir_instance_q15 * S,
\r
1221 uint32_t blockSize);
\r
1225 * @brief Processing function for the Q31 FIR filter.
\r
1226 * @param[in] S points to an instance of the Q31 FIR filter structure.
\r
1227 * @param[in] pSrc points to the block of input data.
\r
1228 * @param[out] pDst points to the block of output data.
\r
1229 * @param[in] blockSize number of samples to process.
\r
1232 const arm_fir_instance_q31 * S,
\r
1235 uint32_t blockSize);
\r
1239 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
\r
1240 * @param[in] S points to an instance of the Q31 FIR structure.
\r
1241 * @param[in] pSrc points to the block of input data.
\r
1242 * @param[out] pDst points to the block of output data.
\r
1243 * @param[in] blockSize number of samples to process.
\r
1245 void arm_fir_fast_q31(
\r
1246 const arm_fir_instance_q31 * S,
\r
1249 uint32_t blockSize);
\r
1253 * @brief Initialization function for the Q31 FIR filter.
\r
1254 * @param[in,out] S points to an instance of the Q31 FIR structure.
\r
1255 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1256 * @param[in] pCoeffs points to the filter coefficients.
\r
1257 * @param[in] pState points to the state buffer.
\r
1258 * @param[in] blockSize number of samples that are processed at a time.
\r
1260 void arm_fir_init_q31(
\r
1261 arm_fir_instance_q31 * S,
\r
1265 uint32_t blockSize);
\r
1269 * @brief Processing function for the floating-point FIR filter.
\r
1270 * @param[in] S points to an instance of the floating-point FIR structure.
\r
1271 * @param[in] pSrc points to the block of input data.
\r
1272 * @param[out] pDst points to the block of output data.
\r
1273 * @param[in] blockSize number of samples to process.
\r
1276 const arm_fir_instance_f32 * S,
\r
1279 uint32_t blockSize);
\r
1283 * @brief Initialization function for the floating-point FIR filter.
\r
1284 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
\r
1285 * @param[in] numTaps Number of filter coefficients in the filter.
\r
1286 * @param[in] pCoeffs points to the filter coefficients.
\r
1287 * @param[in] pState points to the state buffer.
\r
1288 * @param[in] blockSize number of samples that are processed at a time.
\r
1290 void arm_fir_init_f32(
\r
1291 arm_fir_instance_f32 * S,
\r
1293 float32_t * pCoeffs,
\r
1294 float32_t * pState,
\r
1295 uint32_t blockSize);
\r
1299 * @brief Instance structure for the Q15 Biquad cascade filter.
\r
1303 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1304 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1305 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1306 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1307 } arm_biquad_casd_df1_inst_q15;
\r
1310 * @brief Instance structure for the Q31 Biquad cascade filter.
\r
1314 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1315 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1316 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1317 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
\r
1318 } arm_biquad_casd_df1_inst_q31;
\r
1321 * @brief Instance structure for the floating-point Biquad cascade filter.
\r
1325 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
1326 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
\r
1327 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
\r
1328 } arm_biquad_casd_df1_inst_f32;
\r
1332 * @brief Processing function for the Q15 Biquad cascade filter.
\r
1333 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
\r
1334 * @param[in] pSrc points to the block of input data.
\r
1335 * @param[out] pDst points to the block of output data.
\r
1336 * @param[in] blockSize number of samples to process.
\r
1338 void arm_biquad_cascade_df1_q15(
\r
1339 const arm_biquad_casd_df1_inst_q15 * S,
\r
1342 uint32_t blockSize);
\r
1346 * @brief Initialization function for the Q15 Biquad cascade filter.
\r
1347 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
\r
1348 * @param[in] numStages number of 2nd order stages in the filter.
\r
1349 * @param[in] pCoeffs points to the filter coefficients.
\r
1350 * @param[in] pState points to the state buffer.
\r
1351 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1353 void arm_biquad_cascade_df1_init_q15(
\r
1354 arm_biquad_casd_df1_inst_q15 * S,
\r
1355 uint8_t numStages,
\r
1358 int8_t postShift);
\r
1362 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1363 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
\r
1364 * @param[in] pSrc points to the block of input data.
\r
1365 * @param[out] pDst points to the block of output data.
\r
1366 * @param[in] blockSize number of samples to process.
\r
1368 void arm_biquad_cascade_df1_fast_q15(
\r
1369 const arm_biquad_casd_df1_inst_q15 * S,
\r
1372 uint32_t blockSize);
\r
1376 * @brief Processing function for the Q31 Biquad cascade filter
\r
1377 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
\r
1378 * @param[in] pSrc points to the block of input data.
\r
1379 * @param[out] pDst points to the block of output data.
\r
1380 * @param[in] blockSize number of samples to process.
\r
1382 void arm_biquad_cascade_df1_q31(
\r
1383 const arm_biquad_casd_df1_inst_q31 * S,
\r
1386 uint32_t blockSize);
\r
1390 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
\r
1391 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
\r
1392 * @param[in] pSrc points to the block of input data.
\r
1393 * @param[out] pDst points to the block of output data.
\r
1394 * @param[in] blockSize number of samples to process.
\r
1396 void arm_biquad_cascade_df1_fast_q31(
\r
1397 const arm_biquad_casd_df1_inst_q31 * S,
\r
1400 uint32_t blockSize);
\r
1404 * @brief Initialization function for the Q31 Biquad cascade filter.
\r
1405 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
\r
1406 * @param[in] numStages number of 2nd order stages in the filter.
\r
1407 * @param[in] pCoeffs points to the filter coefficients.
\r
1408 * @param[in] pState points to the state buffer.
\r
1409 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
\r
1411 void arm_biquad_cascade_df1_init_q31(
\r
1412 arm_biquad_casd_df1_inst_q31 * S,
\r
1413 uint8_t numStages,
\r
1416 int8_t postShift);
\r
1420 * @brief Processing function for the floating-point Biquad cascade filter.
\r
1421 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
\r
1422 * @param[in] pSrc points to the block of input data.
\r
1423 * @param[out] pDst points to the block of output data.
\r
1424 * @param[in] blockSize number of samples to process.
\r
1426 void arm_biquad_cascade_df1_f32(
\r
1427 const arm_biquad_casd_df1_inst_f32 * S,
\r
1430 uint32_t blockSize);
\r
1434 * @brief Initialization function for the floating-point Biquad cascade filter.
\r
1435 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
\r
1436 * @param[in] numStages number of 2nd order stages in the filter.
\r
1437 * @param[in] pCoeffs points to the filter coefficients.
\r
1438 * @param[in] pState points to the state buffer.
\r
1440 void arm_biquad_cascade_df1_init_f32(
\r
1441 arm_biquad_casd_df1_inst_f32 * S,
\r
1442 uint8_t numStages,
\r
1443 float32_t * pCoeffs,
\r
1444 float32_t * pState);
\r
1448 * @brief Instance structure for the floating-point matrix structure.
\r
1452 uint16_t numRows; /**< number of rows of the matrix. */
\r
1453 uint16_t numCols; /**< number of columns of the matrix. */
\r
1454 float32_t *pData; /**< points to the data of the matrix. */
\r
1455 } arm_matrix_instance_f32;
\r
1459 * @brief Instance structure for the floating-point matrix structure.
\r
1463 uint16_t numRows; /**< number of rows of the matrix. */
\r
1464 uint16_t numCols; /**< number of columns of the matrix. */
\r
1465 float64_t *pData; /**< points to the data of the matrix. */
\r
1466 } arm_matrix_instance_f64;
\r
1469 * @brief Instance structure for the Q15 matrix structure.
\r
1473 uint16_t numRows; /**< number of rows of the matrix. */
\r
1474 uint16_t numCols; /**< number of columns of the matrix. */
\r
1475 q15_t *pData; /**< points to the data of the matrix. */
\r
1476 } arm_matrix_instance_q15;
\r
1479 * @brief Instance structure for the Q31 matrix structure.
\r
1483 uint16_t numRows; /**< number of rows of the matrix. */
\r
1484 uint16_t numCols; /**< number of columns of the matrix. */
\r
1485 q31_t *pData; /**< points to the data of the matrix. */
\r
1486 } arm_matrix_instance_q31;
\r
1490 * @brief Floating-point matrix addition.
\r
1491 * @param[in] pSrcA points to the first input matrix structure
\r
1492 * @param[in] pSrcB points to the second input matrix structure
\r
1493 * @param[out] pDst points to output matrix structure
\r
1494 * @return The function returns either
\r
1495 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1497 arm_status arm_mat_add_f32(
\r
1498 const arm_matrix_instance_f32 * pSrcA,
\r
1499 const arm_matrix_instance_f32 * pSrcB,
\r
1500 arm_matrix_instance_f32 * pDst);
\r
1504 * @brief Q15 matrix addition.
\r
1505 * @param[in] pSrcA points to the first input matrix structure
\r
1506 * @param[in] pSrcB points to the second input matrix structure
\r
1507 * @param[out] pDst points to output matrix structure
\r
1508 * @return The function returns either
\r
1509 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1511 arm_status arm_mat_add_q15(
\r
1512 const arm_matrix_instance_q15 * pSrcA,
\r
1513 const arm_matrix_instance_q15 * pSrcB,
\r
1514 arm_matrix_instance_q15 * pDst);
\r
1518 * @brief Q31 matrix addition.
\r
1519 * @param[in] pSrcA points to the first input matrix structure
\r
1520 * @param[in] pSrcB points to the second input matrix structure
\r
1521 * @param[out] pDst points to output matrix structure
\r
1522 * @return The function returns either
\r
1523 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1525 arm_status arm_mat_add_q31(
\r
1526 const arm_matrix_instance_q31 * pSrcA,
\r
1527 const arm_matrix_instance_q31 * pSrcB,
\r
1528 arm_matrix_instance_q31 * pDst);
\r
1532 * @brief Floating-point, complex, matrix multiplication.
\r
1533 * @param[in] pSrcA points to the first input matrix structure
\r
1534 * @param[in] pSrcB points to the second input matrix structure
\r
1535 * @param[out] pDst points to output matrix structure
\r
1536 * @return The function returns either
\r
1537 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1539 arm_status arm_mat_cmplx_mult_f32(
\r
1540 const arm_matrix_instance_f32 * pSrcA,
\r
1541 const arm_matrix_instance_f32 * pSrcB,
\r
1542 arm_matrix_instance_f32 * pDst);
\r
1546 * @brief Q15, complex, matrix multiplication.
\r
1547 * @param[in] pSrcA points to the first input matrix structure
\r
1548 * @param[in] pSrcB points to the second input matrix structure
\r
1549 * @param[out] pDst points to output matrix structure
\r
1550 * @return The function returns either
\r
1551 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1553 arm_status arm_mat_cmplx_mult_q15(
\r
1554 const arm_matrix_instance_q15 * pSrcA,
\r
1555 const arm_matrix_instance_q15 * pSrcB,
\r
1556 arm_matrix_instance_q15 * pDst,
\r
1557 q15_t * pScratch);
\r
1561 * @brief Q31, complex, matrix multiplication.
\r
1562 * @param[in] pSrcA points to the first input matrix structure
\r
1563 * @param[in] pSrcB points to the second input matrix structure
\r
1564 * @param[out] pDst points to output matrix structure
\r
1565 * @return The function returns either
\r
1566 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1568 arm_status arm_mat_cmplx_mult_q31(
\r
1569 const arm_matrix_instance_q31 * pSrcA,
\r
1570 const arm_matrix_instance_q31 * pSrcB,
\r
1571 arm_matrix_instance_q31 * pDst);
\r
1575 * @brief Floating-point matrix transpose.
\r
1576 * @param[in] pSrc points to the input matrix
\r
1577 * @param[out] pDst points to the output matrix
\r
1578 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1579 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1581 arm_status arm_mat_trans_f32(
\r
1582 const arm_matrix_instance_f32 * pSrc,
\r
1583 arm_matrix_instance_f32 * pDst);
\r
1587 * @brief Q15 matrix transpose.
\r
1588 * @param[in] pSrc points to the input matrix
\r
1589 * @param[out] pDst points to the output matrix
\r
1590 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1591 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1593 arm_status arm_mat_trans_q15(
\r
1594 const arm_matrix_instance_q15 * pSrc,
\r
1595 arm_matrix_instance_q15 * pDst);
\r
1599 * @brief Q31 matrix transpose.
\r
1600 * @param[in] pSrc points to the input matrix
\r
1601 * @param[out] pDst points to the output matrix
\r
1602 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
\r
1603 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1605 arm_status arm_mat_trans_q31(
\r
1606 const arm_matrix_instance_q31 * pSrc,
\r
1607 arm_matrix_instance_q31 * pDst);
\r
1611 * @brief Floating-point matrix multiplication
\r
1612 * @param[in] pSrcA points to the first input matrix structure
\r
1613 * @param[in] pSrcB points to the second input matrix structure
\r
1614 * @param[out] pDst points to output matrix structure
\r
1615 * @return The function returns either
\r
1616 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1618 arm_status arm_mat_mult_f32(
\r
1619 const arm_matrix_instance_f32 * pSrcA,
\r
1620 const arm_matrix_instance_f32 * pSrcB,
\r
1621 arm_matrix_instance_f32 * pDst);
\r
1625 * @brief Q15 matrix multiplication
\r
1626 * @param[in] pSrcA points to the first input matrix structure
\r
1627 * @param[in] pSrcB points to the second input matrix structure
\r
1628 * @param[out] pDst points to output matrix structure
\r
1629 * @param[in] pState points to the array for storing intermediate results
\r
1630 * @return The function returns either
\r
1631 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1633 arm_status arm_mat_mult_q15(
\r
1634 const arm_matrix_instance_q15 * pSrcA,
\r
1635 const arm_matrix_instance_q15 * pSrcB,
\r
1636 arm_matrix_instance_q15 * pDst,
\r
1641 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1642 * @param[in] pSrcA points to the first input matrix structure
\r
1643 * @param[in] pSrcB points to the second input matrix structure
\r
1644 * @param[out] pDst points to output matrix structure
\r
1645 * @param[in] pState points to the array for storing intermediate results
\r
1646 * @return The function returns either
\r
1647 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1649 arm_status arm_mat_mult_fast_q15(
\r
1650 const arm_matrix_instance_q15 * pSrcA,
\r
1651 const arm_matrix_instance_q15 * pSrcB,
\r
1652 arm_matrix_instance_q15 * pDst,
\r
1657 * @brief Q31 matrix multiplication
\r
1658 * @param[in] pSrcA points to the first input matrix structure
\r
1659 * @param[in] pSrcB points to the second input matrix structure
\r
1660 * @param[out] pDst points to output matrix structure
\r
1661 * @return The function returns either
\r
1662 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1664 arm_status arm_mat_mult_q31(
\r
1665 const arm_matrix_instance_q31 * pSrcA,
\r
1666 const arm_matrix_instance_q31 * pSrcB,
\r
1667 arm_matrix_instance_q31 * pDst);
\r
1671 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
\r
1672 * @param[in] pSrcA points to the first input matrix structure
\r
1673 * @param[in] pSrcB points to the second input matrix structure
\r
1674 * @param[out] pDst points to output matrix structure
\r
1675 * @return The function returns either
\r
1676 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1678 arm_status arm_mat_mult_fast_q31(
\r
1679 const arm_matrix_instance_q31 * pSrcA,
\r
1680 const arm_matrix_instance_q31 * pSrcB,
\r
1681 arm_matrix_instance_q31 * pDst);
\r
1685 * @brief Floating-point matrix subtraction
\r
1686 * @param[in] pSrcA points to the first input matrix structure
\r
1687 * @param[in] pSrcB points to the second input matrix structure
\r
1688 * @param[out] pDst points to output matrix structure
\r
1689 * @return The function returns either
\r
1690 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1692 arm_status arm_mat_sub_f32(
\r
1693 const arm_matrix_instance_f32 * pSrcA,
\r
1694 const arm_matrix_instance_f32 * pSrcB,
\r
1695 arm_matrix_instance_f32 * pDst);
\r
1699 * @brief Q15 matrix subtraction
\r
1700 * @param[in] pSrcA points to the first input matrix structure
\r
1701 * @param[in] pSrcB points to the second input matrix structure
\r
1702 * @param[out] pDst points to output matrix structure
\r
1703 * @return The function returns either
\r
1704 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1706 arm_status arm_mat_sub_q15(
\r
1707 const arm_matrix_instance_q15 * pSrcA,
\r
1708 const arm_matrix_instance_q15 * pSrcB,
\r
1709 arm_matrix_instance_q15 * pDst);
\r
1713 * @brief Q31 matrix subtraction
\r
1714 * @param[in] pSrcA points to the first input matrix structure
\r
1715 * @param[in] pSrcB points to the second input matrix structure
\r
1716 * @param[out] pDst points to output matrix structure
\r
1717 * @return The function returns either
\r
1718 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1720 arm_status arm_mat_sub_q31(
\r
1721 const arm_matrix_instance_q31 * pSrcA,
\r
1722 const arm_matrix_instance_q31 * pSrcB,
\r
1723 arm_matrix_instance_q31 * pDst);
\r
1727 * @brief Floating-point matrix scaling.
\r
1728 * @param[in] pSrc points to the input matrix
\r
1729 * @param[in] scale scale factor
\r
1730 * @param[out] pDst points to the output matrix
\r
1731 * @return The function returns either
\r
1732 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1734 arm_status arm_mat_scale_f32(
\r
1735 const arm_matrix_instance_f32 * pSrc,
\r
1737 arm_matrix_instance_f32 * pDst);
\r
1741 * @brief Q15 matrix scaling.
\r
1742 * @param[in] pSrc points to input matrix
\r
1743 * @param[in] scaleFract fractional portion of the scale factor
\r
1744 * @param[in] shift number of bits to shift the result by
\r
1745 * @param[out] pDst points to output matrix
\r
1746 * @return The function returns either
\r
1747 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1749 arm_status arm_mat_scale_q15(
\r
1750 const arm_matrix_instance_q15 * pSrc,
\r
1753 arm_matrix_instance_q15 * pDst);
\r
1757 * @brief Q31 matrix scaling.
\r
1758 * @param[in] pSrc points to input matrix
\r
1759 * @param[in] scaleFract fractional portion of the scale factor
\r
1760 * @param[in] shift number of bits to shift the result by
\r
1761 * @param[out] pDst points to output matrix structure
\r
1762 * @return The function returns either
\r
1763 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
\r
1765 arm_status arm_mat_scale_q31(
\r
1766 const arm_matrix_instance_q31 * pSrc,
\r
1769 arm_matrix_instance_q31 * pDst);
\r
1773 * @brief Q31 matrix initialization.
\r
1774 * @param[in,out] S points to an instance of the floating-point matrix structure.
\r
1775 * @param[in] nRows number of rows in the matrix.
\r
1776 * @param[in] nColumns number of columns in the matrix.
\r
1777 * @param[in] pData points to the matrix data array.
\r
1779 void arm_mat_init_q31(
\r
1780 arm_matrix_instance_q31 * S,
\r
1782 uint16_t nColumns,
\r
1787 * @brief Q15 matrix initialization.
\r
1788 * @param[in,out] S points to an instance of the floating-point matrix structure.
\r
1789 * @param[in] nRows number of rows in the matrix.
\r
1790 * @param[in] nColumns number of columns in the matrix.
\r
1791 * @param[in] pData points to the matrix data array.
\r
1793 void arm_mat_init_q15(
\r
1794 arm_matrix_instance_q15 * S,
\r
1796 uint16_t nColumns,
\r
1801 * @brief Floating-point matrix initialization.
\r
1802 * @param[in,out] S points to an instance of the floating-point matrix structure.
\r
1803 * @param[in] nRows number of rows in the matrix.
\r
1804 * @param[in] nColumns number of columns in the matrix.
\r
1805 * @param[in] pData points to the matrix data array.
\r
1807 void arm_mat_init_f32(
\r
1808 arm_matrix_instance_f32 * S,
\r
1810 uint16_t nColumns,
\r
1811 float32_t * pData);
\r
1816 * @brief Instance structure for the Q15 PID Control.
\r
1820 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1821 #if !defined (ARM_MATH_DSP)
\r
1825 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
\r
1827 q15_t state[3]; /**< The state array of length 3. */
\r
1828 q15_t Kp; /**< The proportional gain. */
\r
1829 q15_t Ki; /**< The integral gain. */
\r
1830 q15_t Kd; /**< The derivative gain. */
\r
1831 } arm_pid_instance_q15;
\r
1834 * @brief Instance structure for the Q31 PID Control.
\r
1838 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1839 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1840 q31_t A2; /**< The derived gain, A2 = Kd . */
\r
1841 q31_t state[3]; /**< The state array of length 3. */
\r
1842 q31_t Kp; /**< The proportional gain. */
\r
1843 q31_t Ki; /**< The integral gain. */
\r
1844 q31_t Kd; /**< The derivative gain. */
\r
1845 } arm_pid_instance_q31;
\r
1848 * @brief Instance structure for the floating-point PID Control.
\r
1852 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
\r
1853 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
\r
1854 float32_t A2; /**< The derived gain, A2 = Kd . */
\r
1855 float32_t state[3]; /**< The state array of length 3. */
\r
1856 float32_t Kp; /**< The proportional gain. */
\r
1857 float32_t Ki; /**< The integral gain. */
\r
1858 float32_t Kd; /**< The derivative gain. */
\r
1859 } arm_pid_instance_f32;
\r
1864 * @brief Initialization function for the floating-point PID Control.
\r
1865 * @param[in,out] S points to an instance of the PID structure.
\r
1866 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1868 void arm_pid_init_f32(
\r
1869 arm_pid_instance_f32 * S,
\r
1870 int32_t resetStateFlag);
\r
1874 * @brief Reset function for the floating-point PID Control.
\r
1875 * @param[in,out] S is an instance of the floating-point PID Control structure
\r
1877 void arm_pid_reset_f32(
\r
1878 arm_pid_instance_f32 * S);
\r
1882 * @brief Initialization function for the Q31 PID Control.
\r
1883 * @param[in,out] S points to an instance of the Q15 PID structure.
\r
1884 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1886 void arm_pid_init_q31(
\r
1887 arm_pid_instance_q31 * S,
\r
1888 int32_t resetStateFlag);
\r
1892 * @brief Reset function for the Q31 PID Control.
\r
1893 * @param[in,out] S points to an instance of the Q31 PID Control structure
\r
1896 void arm_pid_reset_q31(
\r
1897 arm_pid_instance_q31 * S);
\r
1901 * @brief Initialization function for the Q15 PID Control.
\r
1902 * @param[in,out] S points to an instance of the Q15 PID structure.
\r
1903 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
\r
1905 void arm_pid_init_q15(
\r
1906 arm_pid_instance_q15 * S,
\r
1907 int32_t resetStateFlag);
\r
1911 * @brief Reset function for the Q15 PID Control.
\r
1912 * @param[in,out] S points to an instance of the q15 PID Control structure
\r
1914 void arm_pid_reset_q15(
\r
1915 arm_pid_instance_q15 * S);
\r
1919 * @brief Instance structure for the floating-point Linear Interpolate function.
\r
1923 uint32_t nValues; /**< nValues */
\r
1924 float32_t x1; /**< x1 */
\r
1925 float32_t xSpacing; /**< xSpacing */
\r
1926 float32_t *pYData; /**< pointer to the table of Y values */
\r
1927 } arm_linear_interp_instance_f32;
\r
1930 * @brief Instance structure for the floating-point bilinear interpolation function.
\r
1934 uint16_t numRows; /**< number of rows in the data table. */
\r
1935 uint16_t numCols; /**< number of columns in the data table. */
\r
1936 float32_t *pData; /**< points to the data table. */
\r
1937 } arm_bilinear_interp_instance_f32;
\r
1940 * @brief Instance structure for the Q31 bilinear interpolation function.
\r
1944 uint16_t numRows; /**< number of rows in the data table. */
\r
1945 uint16_t numCols; /**< number of columns in the data table. */
\r
1946 q31_t *pData; /**< points to the data table. */
\r
1947 } arm_bilinear_interp_instance_q31;
\r
1950 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1954 uint16_t numRows; /**< number of rows in the data table. */
\r
1955 uint16_t numCols; /**< number of columns in the data table. */
\r
1956 q15_t *pData; /**< points to the data table. */
\r
1957 } arm_bilinear_interp_instance_q15;
\r
1960 * @brief Instance structure for the Q15 bilinear interpolation function.
\r
1964 uint16_t numRows; /**< number of rows in the data table. */
\r
1965 uint16_t numCols; /**< number of columns in the data table. */
\r
1966 q7_t *pData; /**< points to the data table. */
\r
1967 } arm_bilinear_interp_instance_q7;
\r
1971 * @brief Q7 vector multiplication.
\r
1972 * @param[in] pSrcA points to the first input vector
\r
1973 * @param[in] pSrcB points to the second input vector
\r
1974 * @param[out] pDst points to the output vector
\r
1975 * @param[in] blockSize number of samples in each vector
\r
1981 uint32_t blockSize);
\r
1985 * @brief Q15 vector multiplication.
\r
1986 * @param[in] pSrcA points to the first input vector
\r
1987 * @param[in] pSrcB points to the second input vector
\r
1988 * @param[out] pDst points to the output vector
\r
1989 * @param[in] blockSize number of samples in each vector
\r
1991 void arm_mult_q15(
\r
1995 uint32_t blockSize);
\r
1999 * @brief Q31 vector multiplication.
\r
2000 * @param[in] pSrcA points to the first input vector
\r
2001 * @param[in] pSrcB points to the second input vector
\r
2002 * @param[out] pDst points to the output vector
\r
2003 * @param[in] blockSize number of samples in each vector
\r
2005 void arm_mult_q31(
\r
2009 uint32_t blockSize);
\r
2013 * @brief Floating-point vector multiplication.
\r
2014 * @param[in] pSrcA points to the first input vector
\r
2015 * @param[in] pSrcB points to the second input vector
\r
2016 * @param[out] pDst points to the output vector
\r
2017 * @param[in] blockSize number of samples in each vector
\r
2019 void arm_mult_f32(
\r
2020 float32_t * pSrcA,
\r
2021 float32_t * pSrcB,
\r
2023 uint32_t blockSize);
\r
2027 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2031 uint16_t fftLen; /**< length of the FFT. */
\r
2032 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2033 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2034 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
\r
2035 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2036 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2037 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2038 } arm_cfft_radix2_instance_q15;
\r
2041 arm_status arm_cfft_radix2_init_q15(
\r
2042 arm_cfft_radix2_instance_q15 * S,
\r
2045 uint8_t bitReverseFlag);
\r
2048 void arm_cfft_radix2_q15(
\r
2049 const arm_cfft_radix2_instance_q15 * S,
\r
2054 * @brief Instance structure for the Q15 CFFT/CIFFT function.
\r
2058 uint16_t fftLen; /**< length of the FFT. */
\r
2059 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2060 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2061 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2062 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2063 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2064 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2065 } arm_cfft_radix4_instance_q15;
\r
2068 arm_status arm_cfft_radix4_init_q15(
\r
2069 arm_cfft_radix4_instance_q15 * S,
\r
2072 uint8_t bitReverseFlag);
\r
2075 void arm_cfft_radix4_q15(
\r
2076 const arm_cfft_radix4_instance_q15 * S,
\r
2080 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
\r
2084 uint16_t fftLen; /**< length of the FFT. */
\r
2085 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2086 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2087 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2088 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2089 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2090 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2091 } arm_cfft_radix2_instance_q31;
\r
2094 arm_status arm_cfft_radix2_init_q31(
\r
2095 arm_cfft_radix2_instance_q31 * S,
\r
2098 uint8_t bitReverseFlag);
\r
2101 void arm_cfft_radix2_q31(
\r
2102 const arm_cfft_radix2_instance_q31 * S,
\r
2106 * @brief Instance structure for the Q31 CFFT/CIFFT function.
\r
2110 uint16_t fftLen; /**< length of the FFT. */
\r
2111 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2112 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2113 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2114 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2115 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2116 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2117 } arm_cfft_radix4_instance_q31;
\r
2120 void arm_cfft_radix4_q31(
\r
2121 const arm_cfft_radix4_instance_q31 * S,
\r
2125 arm_status arm_cfft_radix4_init_q31(
\r
2126 arm_cfft_radix4_instance_q31 * S,
\r
2129 uint8_t bitReverseFlag);
\r
2132 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2136 uint16_t fftLen; /**< length of the FFT. */
\r
2137 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2138 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2139 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2140 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2141 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2142 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2143 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2144 } arm_cfft_radix2_instance_f32;
\r
2147 arm_status arm_cfft_radix2_init_f32(
\r
2148 arm_cfft_radix2_instance_f32 * S,
\r
2151 uint8_t bitReverseFlag);
\r
2154 void arm_cfft_radix2_f32(
\r
2155 const arm_cfft_radix2_instance_f32 * S,
\r
2156 float32_t * pSrc);
\r
2159 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2163 uint16_t fftLen; /**< length of the FFT. */
\r
2164 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
\r
2165 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
\r
2166 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2167 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2168 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2169 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
\r
2170 float32_t onebyfftLen; /**< value of 1/fftLen. */
\r
2171 } arm_cfft_radix4_instance_f32;
\r
2174 arm_status arm_cfft_radix4_init_f32(
\r
2175 arm_cfft_radix4_instance_f32 * S,
\r
2178 uint8_t bitReverseFlag);
\r
2181 void arm_cfft_radix4_f32(
\r
2182 const arm_cfft_radix4_instance_f32 * S,
\r
2183 float32_t * pSrc);
\r
2186 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2190 uint16_t fftLen; /**< length of the FFT. */
\r
2191 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2192 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2193 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2194 } arm_cfft_instance_q15;
\r
2196 void arm_cfft_q15(
\r
2197 const arm_cfft_instance_q15 * S,
\r
2200 uint8_t bitReverseFlag);
\r
2203 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
\r
2207 uint16_t fftLen; /**< length of the FFT. */
\r
2208 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2209 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2210 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2211 } arm_cfft_instance_q31;
\r
2213 void arm_cfft_q31(
\r
2214 const arm_cfft_instance_q31 * S,
\r
2217 uint8_t bitReverseFlag);
\r
2220 * @brief Instance structure for the floating-point CFFT/CIFFT function.
\r
2224 uint16_t fftLen; /**< length of the FFT. */
\r
2225 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
\r
2226 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
\r
2227 uint16_t bitRevLength; /**< bit reversal table length. */
\r
2228 } arm_cfft_instance_f32;
\r
2230 void arm_cfft_f32(
\r
2231 const arm_cfft_instance_f32 * S,
\r
2234 uint8_t bitReverseFlag);
\r
2237 * @brief Instance structure for the Q15 RFFT/RIFFT function.
\r
2241 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2242 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2243 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2244 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2245 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2246 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2247 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2248 } arm_rfft_instance_q15;
\r
2250 arm_status arm_rfft_init_q15(
\r
2251 arm_rfft_instance_q15 * S,
\r
2252 uint32_t fftLenReal,
\r
2253 uint32_t ifftFlagR,
\r
2254 uint32_t bitReverseFlag);
\r
2256 void arm_rfft_q15(
\r
2257 const arm_rfft_instance_q15 * S,
\r
2262 * @brief Instance structure for the Q31 RFFT/RIFFT function.
\r
2266 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2267 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2268 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2269 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2270 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2271 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2272 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2273 } arm_rfft_instance_q31;
\r
2275 arm_status arm_rfft_init_q31(
\r
2276 arm_rfft_instance_q31 * S,
\r
2277 uint32_t fftLenReal,
\r
2278 uint32_t ifftFlagR,
\r
2279 uint32_t bitReverseFlag);
\r
2281 void arm_rfft_q31(
\r
2282 const arm_rfft_instance_q31 * S,
\r
2287 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2291 uint32_t fftLenReal; /**< length of the real FFT. */
\r
2292 uint16_t fftLenBy2; /**< length of the complex FFT. */
\r
2293 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
\r
2294 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
\r
2295 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
\r
2296 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
\r
2297 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
\r
2298 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2299 } arm_rfft_instance_f32;
\r
2301 arm_status arm_rfft_init_f32(
\r
2302 arm_rfft_instance_f32 * S,
\r
2303 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2304 uint32_t fftLenReal,
\r
2305 uint32_t ifftFlagR,
\r
2306 uint32_t bitReverseFlag);
\r
2308 void arm_rfft_f32(
\r
2309 const arm_rfft_instance_f32 * S,
\r
2311 float32_t * pDst);
\r
2314 * @brief Instance structure for the floating-point RFFT/RIFFT function.
\r
2318 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
\r
2319 uint16_t fftLenRFFT; /**< length of the real sequence */
\r
2320 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
\r
2321 } arm_rfft_fast_instance_f32 ;
\r
2323 arm_status arm_rfft_fast_init_f32 (
\r
2324 arm_rfft_fast_instance_f32 * S,
\r
2327 void arm_rfft_fast_f32(
\r
2328 arm_rfft_fast_instance_f32 * S,
\r
2329 float32_t * p, float32_t * pOut,
\r
2330 uint8_t ifftFlag);
\r
2333 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
\r
2337 uint16_t N; /**< length of the DCT4. */
\r
2338 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2339 float32_t normalize; /**< normalizing factor. */
\r
2340 float32_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2341 float32_t *pCosFactor; /**< points to the cosFactor table. */
\r
2342 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
\r
2343 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
\r
2344 } arm_dct4_instance_f32;
\r
2348 * @brief Initialization function for the floating-point DCT4/IDCT4.
\r
2349 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
\r
2350 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
\r
2351 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
\r
2352 * @param[in] N length of the DCT4.
\r
2353 * @param[in] Nby2 half of the length of the DCT4.
\r
2354 * @param[in] normalize normalizing factor.
\r
2355 * @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
2357 arm_status arm_dct4_init_f32(
\r
2358 arm_dct4_instance_f32 * S,
\r
2359 arm_rfft_instance_f32 * S_RFFT,
\r
2360 arm_cfft_radix4_instance_f32 * S_CFFT,
\r
2363 float32_t normalize);
\r
2367 * @brief Processing function for the floating-point DCT4/IDCT4.
\r
2368 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
\r
2369 * @param[in] pState points to state buffer.
\r
2370 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
\r
2372 void arm_dct4_f32(
\r
2373 const arm_dct4_instance_f32 * S,
\r
2374 float32_t * pState,
\r
2375 float32_t * pInlineBuffer);
\r
2379 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
\r
2383 uint16_t N; /**< length of the DCT4. */
\r
2384 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2385 q31_t normalize; /**< normalizing factor. */
\r
2386 q31_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2387 q31_t *pCosFactor; /**< points to the cosFactor table. */
\r
2388 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
\r
2389 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
\r
2390 } arm_dct4_instance_q31;
\r
2394 * @brief Initialization function for the Q31 DCT4/IDCT4.
\r
2395 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
\r
2396 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
\r
2397 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
\r
2398 * @param[in] N length of the DCT4.
\r
2399 * @param[in] Nby2 half of the length of the DCT4.
\r
2400 * @param[in] normalize normalizing factor.
\r
2401 * @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
2403 arm_status arm_dct4_init_q31(
\r
2404 arm_dct4_instance_q31 * S,
\r
2405 arm_rfft_instance_q31 * S_RFFT,
\r
2406 arm_cfft_radix4_instance_q31 * S_CFFT,
\r
2413 * @brief Processing function for the Q31 DCT4/IDCT4.
\r
2414 * @param[in] S points to an instance of the Q31 DCT4 structure.
\r
2415 * @param[in] pState points to state buffer.
\r
2416 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
\r
2418 void arm_dct4_q31(
\r
2419 const arm_dct4_instance_q31 * S,
\r
2421 q31_t * pInlineBuffer);
\r
2425 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
\r
2429 uint16_t N; /**< length of the DCT4. */
\r
2430 uint16_t Nby2; /**< half of the length of the DCT4. */
\r
2431 q15_t normalize; /**< normalizing factor. */
\r
2432 q15_t *pTwiddle; /**< points to the twiddle factor table. */
\r
2433 q15_t *pCosFactor; /**< points to the cosFactor table. */
\r
2434 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
\r
2435 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
\r
2436 } arm_dct4_instance_q15;
\r
2440 * @brief Initialization function for the Q15 DCT4/IDCT4.
\r
2441 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
\r
2442 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
\r
2443 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
\r
2444 * @param[in] N length of the DCT4.
\r
2445 * @param[in] Nby2 half of the length of the DCT4.
\r
2446 * @param[in] normalize normalizing factor.
\r
2447 * @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
2449 arm_status arm_dct4_init_q15(
\r
2450 arm_dct4_instance_q15 * S,
\r
2451 arm_rfft_instance_q15 * S_RFFT,
\r
2452 arm_cfft_radix4_instance_q15 * S_CFFT,
\r
2459 * @brief Processing function for the Q15 DCT4/IDCT4.
\r
2460 * @param[in] S points to an instance of the Q15 DCT4 structure.
\r
2461 * @param[in] pState points to state buffer.
\r
2462 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
\r
2464 void arm_dct4_q15(
\r
2465 const arm_dct4_instance_q15 * S,
\r
2467 q15_t * pInlineBuffer);
\r
2471 * @brief Floating-point vector addition.
\r
2472 * @param[in] pSrcA points to the first input vector
\r
2473 * @param[in] pSrcB points to the second input vector
\r
2474 * @param[out] pDst points to the output vector
\r
2475 * @param[in] blockSize number of samples in each vector
\r
2478 float32_t * pSrcA,
\r
2479 float32_t * pSrcB,
\r
2481 uint32_t blockSize);
\r
2485 * @brief Q7 vector addition.
\r
2486 * @param[in] pSrcA points to the first input vector
\r
2487 * @param[in] pSrcB points to the second input vector
\r
2488 * @param[out] pDst points to the output vector
\r
2489 * @param[in] blockSize number of samples in each vector
\r
2495 uint32_t blockSize);
\r
2499 * @brief Q15 vector addition.
\r
2500 * @param[in] pSrcA points to the first input vector
\r
2501 * @param[in] pSrcB points to the second input vector
\r
2502 * @param[out] pDst points to the output vector
\r
2503 * @param[in] blockSize number of samples in each vector
\r
2509 uint32_t blockSize);
\r
2513 * @brief Q31 vector addition.
\r
2514 * @param[in] pSrcA points to the first input vector
\r
2515 * @param[in] pSrcB points to the second input vector
\r
2516 * @param[out] pDst points to the output vector
\r
2517 * @param[in] blockSize number of samples in each vector
\r
2523 uint32_t blockSize);
\r
2527 * @brief Floating-point vector subtraction.
\r
2528 * @param[in] pSrcA points to the first input vector
\r
2529 * @param[in] pSrcB points to the second input vector
\r
2530 * @param[out] pDst points to the output vector
\r
2531 * @param[in] blockSize number of samples in each vector
\r
2534 float32_t * pSrcA,
\r
2535 float32_t * pSrcB,
\r
2537 uint32_t blockSize);
\r
2541 * @brief Q7 vector subtraction.
\r
2542 * @param[in] pSrcA points to the first input vector
\r
2543 * @param[in] pSrcB points to the second input vector
\r
2544 * @param[out] pDst points to the output vector
\r
2545 * @param[in] blockSize number of samples in each vector
\r
2551 uint32_t blockSize);
\r
2555 * @brief Q15 vector subtraction.
\r
2556 * @param[in] pSrcA points to the first input vector
\r
2557 * @param[in] pSrcB points to the second input vector
\r
2558 * @param[out] pDst points to the output vector
\r
2559 * @param[in] blockSize number of samples in each vector
\r
2565 uint32_t blockSize);
\r
2569 * @brief Q31 vector subtraction.
\r
2570 * @param[in] pSrcA points to the first input vector
\r
2571 * @param[in] pSrcB points to the second input vector
\r
2572 * @param[out] pDst points to the output vector
\r
2573 * @param[in] blockSize number of samples in each vector
\r
2579 uint32_t blockSize);
\r
2583 * @brief Multiplies a floating-point vector by a scalar.
\r
2584 * @param[in] pSrc points to the input vector
\r
2585 * @param[in] scale scale factor to be applied
\r
2586 * @param[out] pDst points to the output vector
\r
2587 * @param[in] blockSize number of samples in the vector
\r
2589 void arm_scale_f32(
\r
2593 uint32_t blockSize);
\r
2597 * @brief Multiplies a Q7 vector by a scalar.
\r
2598 * @param[in] pSrc points to the input vector
\r
2599 * @param[in] scaleFract fractional portion of the scale value
\r
2600 * @param[in] shift number of bits to shift the result by
\r
2601 * @param[out] pDst points to the output vector
\r
2602 * @param[in] blockSize number of samples in the vector
\r
2604 void arm_scale_q7(
\r
2609 uint32_t blockSize);
\r
2613 * @brief Multiplies a Q15 vector by a scalar.
\r
2614 * @param[in] pSrc points to the input vector
\r
2615 * @param[in] scaleFract fractional portion of the scale value
\r
2616 * @param[in] shift number of bits to shift the result by
\r
2617 * @param[out] pDst points to the output vector
\r
2618 * @param[in] blockSize number of samples in the vector
\r
2620 void arm_scale_q15(
\r
2625 uint32_t blockSize);
\r
2629 * @brief Multiplies a Q31 vector by a scalar.
\r
2630 * @param[in] pSrc points to the input vector
\r
2631 * @param[in] scaleFract fractional portion of the scale value
\r
2632 * @param[in] shift number of bits to shift the result by
\r
2633 * @param[out] pDst points to the output vector
\r
2634 * @param[in] blockSize number of samples in the vector
\r
2636 void arm_scale_q31(
\r
2641 uint32_t blockSize);
\r
2645 * @brief Q7 vector absolute value.
\r
2646 * @param[in] pSrc points to the input buffer
\r
2647 * @param[out] pDst points to the output buffer
\r
2648 * @param[in] blockSize number of samples in each vector
\r
2653 uint32_t blockSize);
\r
2657 * @brief Floating-point vector absolute value.
\r
2658 * @param[in] pSrc points to the input buffer
\r
2659 * @param[out] pDst points to the output buffer
\r
2660 * @param[in] blockSize number of samples in each vector
\r
2665 uint32_t blockSize);
\r
2669 * @brief Q15 vector absolute value.
\r
2670 * @param[in] pSrc points to the input buffer
\r
2671 * @param[out] pDst points to the output buffer
\r
2672 * @param[in] blockSize number of samples in each vector
\r
2677 uint32_t blockSize);
\r
2681 * @brief Q31 vector absolute value.
\r
2682 * @param[in] pSrc points to the input buffer
\r
2683 * @param[out] pDst points to the output buffer
\r
2684 * @param[in] blockSize number of samples in each vector
\r
2689 uint32_t blockSize);
\r
2693 * @brief Dot product of floating-point vectors.
\r
2694 * @param[in] pSrcA points to the first input vector
\r
2695 * @param[in] pSrcB points to the second input vector
\r
2696 * @param[in] blockSize number of samples in each vector
\r
2697 * @param[out] result output result returned here
\r
2699 void arm_dot_prod_f32(
\r
2700 float32_t * pSrcA,
\r
2701 float32_t * pSrcB,
\r
2702 uint32_t blockSize,
\r
2703 float32_t * result);
\r
2707 * @brief Dot product of Q7 vectors.
\r
2708 * @param[in] pSrcA points to the first input vector
\r
2709 * @param[in] pSrcB points to the second input vector
\r
2710 * @param[in] blockSize number of samples in each vector
\r
2711 * @param[out] result output result returned here
\r
2713 void arm_dot_prod_q7(
\r
2716 uint32_t blockSize,
\r
2721 * @brief Dot product of Q15 vectors.
\r
2722 * @param[in] pSrcA points to the first input vector
\r
2723 * @param[in] pSrcB points to the second input vector
\r
2724 * @param[in] blockSize number of samples in each vector
\r
2725 * @param[out] result output result returned here
\r
2727 void arm_dot_prod_q15(
\r
2730 uint32_t blockSize,
\r
2735 * @brief Dot product of Q31 vectors.
\r
2736 * @param[in] pSrcA points to the first input vector
\r
2737 * @param[in] pSrcB points to the second input vector
\r
2738 * @param[in] blockSize number of samples in each vector
\r
2739 * @param[out] result output result returned here
\r
2741 void arm_dot_prod_q31(
\r
2744 uint32_t blockSize,
\r
2749 * @brief Shifts the elements of a Q7 vector a specified number of bits.
\r
2750 * @param[in] pSrc points to the input vector
\r
2751 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\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_shift_q7(
\r
2759 uint32_t blockSize);
\r
2763 * @brief Shifts the elements of a Q15 vector a specified number of bits.
\r
2764 * @param[in] pSrc points to the input vector
\r
2765 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2766 * @param[out] pDst points to the output vector
\r
2767 * @param[in] blockSize number of samples in the vector
\r
2769 void arm_shift_q15(
\r
2773 uint32_t blockSize);
\r
2777 * @brief Shifts the elements of a Q31 vector a specified number of bits.
\r
2778 * @param[in] pSrc points to the input vector
\r
2779 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
\r
2780 * @param[out] pDst points to the output vector
\r
2781 * @param[in] blockSize number of samples in the vector
\r
2783 void arm_shift_q31(
\r
2787 uint32_t blockSize);
\r
2791 * @brief Adds a constant offset to a floating-point vector.
\r
2792 * @param[in] pSrc points to the input vector
\r
2793 * @param[in] offset is the offset to be added
\r
2794 * @param[out] pDst points to the output vector
\r
2795 * @param[in] blockSize number of samples in the vector
\r
2797 void arm_offset_f32(
\r
2801 uint32_t blockSize);
\r
2805 * @brief Adds a constant offset to a Q7 vector.
\r
2806 * @param[in] pSrc points to the input vector
\r
2807 * @param[in] offset is the offset to be added
\r
2808 * @param[out] pDst points to the output vector
\r
2809 * @param[in] blockSize number of samples in the vector
\r
2811 void arm_offset_q7(
\r
2815 uint32_t blockSize);
\r
2819 * @brief Adds a constant offset to a Q15 vector.
\r
2820 * @param[in] pSrc points to the input vector
\r
2821 * @param[in] offset is the offset to be added
\r
2822 * @param[out] pDst points to the output vector
\r
2823 * @param[in] blockSize number of samples in the vector
\r
2825 void arm_offset_q15(
\r
2829 uint32_t blockSize);
\r
2833 * @brief Adds a constant offset to a Q31 vector.
\r
2834 * @param[in] pSrc points to the input vector
\r
2835 * @param[in] offset is the offset to be added
\r
2836 * @param[out] pDst points to the output vector
\r
2837 * @param[in] blockSize number of samples in the vector
\r
2839 void arm_offset_q31(
\r
2843 uint32_t blockSize);
\r
2847 * @brief Negates the elements of a floating-point vector.
\r
2848 * @param[in] pSrc points to the input vector
\r
2849 * @param[out] pDst points to the output vector
\r
2850 * @param[in] blockSize number of samples in the vector
\r
2852 void arm_negate_f32(
\r
2855 uint32_t blockSize);
\r
2859 * @brief Negates the elements of a Q7 vector.
\r
2860 * @param[in] pSrc points to the input vector
\r
2861 * @param[out] pDst points to the output vector
\r
2862 * @param[in] blockSize number of samples in the vector
\r
2864 void arm_negate_q7(
\r
2867 uint32_t blockSize);
\r
2871 * @brief Negates the elements of a Q15 vector.
\r
2872 * @param[in] pSrc points to the input vector
\r
2873 * @param[out] pDst points to the output vector
\r
2874 * @param[in] blockSize number of samples in the vector
\r
2876 void arm_negate_q15(
\r
2879 uint32_t blockSize);
\r
2883 * @brief Negates the elements of a Q31 vector.
\r
2884 * @param[in] pSrc points to the input vector
\r
2885 * @param[out] pDst points to the output vector
\r
2886 * @param[in] blockSize number of samples in the vector
\r
2888 void arm_negate_q31(
\r
2891 uint32_t blockSize);
\r
2895 * @brief Copies the elements of a floating-point vector.
\r
2896 * @param[in] pSrc input pointer
\r
2897 * @param[out] pDst output pointer
\r
2898 * @param[in] blockSize number of samples to process
\r
2900 void arm_copy_f32(
\r
2903 uint32_t blockSize);
\r
2907 * @brief Copies the elements of a Q7 vector.
\r
2908 * @param[in] pSrc input pointer
\r
2909 * @param[out] pDst output pointer
\r
2910 * @param[in] blockSize number of samples to process
\r
2915 uint32_t blockSize);
\r
2919 * @brief Copies the elements of a Q15 vector.
\r
2920 * @param[in] pSrc input pointer
\r
2921 * @param[out] pDst output pointer
\r
2922 * @param[in] blockSize number of samples to process
\r
2924 void arm_copy_q15(
\r
2927 uint32_t blockSize);
\r
2931 * @brief Copies the elements of a Q31 vector.
\r
2932 * @param[in] pSrc input pointer
\r
2933 * @param[out] pDst output pointer
\r
2934 * @param[in] blockSize number of samples to process
\r
2936 void arm_copy_q31(
\r
2939 uint32_t blockSize);
\r
2943 * @brief Fills a constant value into a floating-point vector.
\r
2944 * @param[in] value input value to be filled
\r
2945 * @param[out] pDst output pointer
\r
2946 * @param[in] blockSize number of samples to process
\r
2948 void arm_fill_f32(
\r
2951 uint32_t blockSize);
\r
2955 * @brief Fills a constant value into a Q7 vector.
\r
2956 * @param[in] value input value to be filled
\r
2957 * @param[out] pDst output pointer
\r
2958 * @param[in] blockSize number of samples to process
\r
2963 uint32_t blockSize);
\r
2967 * @brief Fills a constant value into a Q15 vector.
\r
2968 * @param[in] value input value to be filled
\r
2969 * @param[out] pDst output pointer
\r
2970 * @param[in] blockSize number of samples to process
\r
2972 void arm_fill_q15(
\r
2975 uint32_t blockSize);
\r
2979 * @brief Fills a constant value into a Q31 vector.
\r
2980 * @param[in] value input value to be filled
\r
2981 * @param[out] pDst output pointer
\r
2982 * @param[in] blockSize number of samples to process
\r
2984 void arm_fill_q31(
\r
2987 uint32_t blockSize);
\r
2991 * @brief Convolution of floating-point sequences.
\r
2992 * @param[in] pSrcA points to the first input sequence.
\r
2993 * @param[in] srcALen length of the first input sequence.
\r
2994 * @param[in] pSrcB points to the second input sequence.
\r
2995 * @param[in] srcBLen length of the second input sequence.
\r
2996 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
2998 void arm_conv_f32(
\r
2999 float32_t * pSrcA,
\r
3001 float32_t * pSrcB,
\r
3003 float32_t * pDst);
\r
3007 * @brief Convolution of Q15 sequences.
\r
3008 * @param[in] pSrcA points to the first input sequence.
\r
3009 * @param[in] srcALen length of the first input sequence.
\r
3010 * @param[in] pSrcB points to the second input sequence.
\r
3011 * @param[in] srcBLen length of the second input sequence.
\r
3012 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3013 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3014 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3016 void arm_conv_opt_q15(
\r
3022 q15_t * pScratch1,
\r
3023 q15_t * pScratch2);
\r
3027 * @brief Convolution of Q15 sequences.
\r
3028 * @param[in] pSrcA points to the first input sequence.
\r
3029 * @param[in] srcALen length of the first input sequence.
\r
3030 * @param[in] pSrcB points to the second input sequence.
\r
3031 * @param[in] srcBLen length of the second input sequence.
\r
3032 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
\r
3034 void arm_conv_q15(
\r
3043 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3044 * @param[in] pSrcA points to the first input sequence.
\r
3045 * @param[in] srcALen length of the first input sequence.
\r
3046 * @param[in] pSrcB points to the second input sequence.
\r
3047 * @param[in] srcBLen length of the second input sequence.
\r
3048 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3050 void arm_conv_fast_q15(
\r
3059 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3060 * @param[in] pSrcA points to the first input sequence.
\r
3061 * @param[in] srcALen length of the first input sequence.
\r
3062 * @param[in] pSrcB points to the second input sequence.
\r
3063 * @param[in] srcBLen length of the second input sequence.
\r
3064 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3065 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3066 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3068 void arm_conv_fast_opt_q15(
\r
3074 q15_t * pScratch1,
\r
3075 q15_t * pScratch2);
\r
3079 * @brief Convolution of Q31 sequences.
\r
3080 * @param[in] pSrcA points to the first input sequence.
\r
3081 * @param[in] srcALen length of the first input sequence.
\r
3082 * @param[in] pSrcB points to the second input sequence.
\r
3083 * @param[in] srcBLen length of the second input sequence.
\r
3084 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3086 void arm_conv_q31(
\r
3095 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3096 * @param[in] pSrcA points to the first input sequence.
\r
3097 * @param[in] srcALen length of the first input sequence.
\r
3098 * @param[in] pSrcB points to the second input sequence.
\r
3099 * @param[in] srcBLen length of the second input sequence.
\r
3100 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3102 void arm_conv_fast_q31(
\r
3111 * @brief Convolution of Q7 sequences.
\r
3112 * @param[in] pSrcA points to the first input sequence.
\r
3113 * @param[in] srcALen length of the first input sequence.
\r
3114 * @param[in] pSrcB points to the second input sequence.
\r
3115 * @param[in] srcBLen length of the second input sequence.
\r
3116 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3117 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3118 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3120 void arm_conv_opt_q7(
\r
3126 q15_t * pScratch1,
\r
3127 q15_t * pScratch2);
\r
3131 * @brief Convolution of Q7 sequences.
\r
3132 * @param[in] pSrcA points to the first input sequence.
\r
3133 * @param[in] srcALen length of the first input sequence.
\r
3134 * @param[in] pSrcB points to the second input sequence.
\r
3135 * @param[in] srcBLen length of the second input sequence.
\r
3136 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
\r
3147 * @brief Partial convolution of floating-point sequences.
\r
3148 * @param[in] pSrcA points to the first input sequence.
\r
3149 * @param[in] srcALen length of the first input sequence.
\r
3150 * @param[in] pSrcB points to the second input sequence.
\r
3151 * @param[in] srcBLen length of the second input sequence.
\r
3152 * @param[out] pDst points to the block of output data
\r
3153 * @param[in] firstIndex is the first output sample to start with.
\r
3154 * @param[in] numPoints is the number of output points to be computed.
\r
3155 * @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
3157 arm_status arm_conv_partial_f32(
\r
3158 float32_t * pSrcA,
\r
3160 float32_t * pSrcB,
\r
3163 uint32_t firstIndex,
\r
3164 uint32_t numPoints);
\r
3168 * @brief Partial convolution of Q15 sequences.
\r
3169 * @param[in] pSrcA points to the first input sequence.
\r
3170 * @param[in] srcALen length of the first input sequence.
\r
3171 * @param[in] pSrcB points to the second input sequence.
\r
3172 * @param[in] srcBLen length of the second input sequence.
\r
3173 * @param[out] pDst points to the block of output data
\r
3174 * @param[in] firstIndex is the first output sample to start with.
\r
3175 * @param[in] numPoints is the number of output points to be computed.
\r
3176 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3177 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3178 * @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
3180 arm_status arm_conv_partial_opt_q15(
\r
3186 uint32_t firstIndex,
\r
3187 uint32_t numPoints,
\r
3188 q15_t * pScratch1,
\r
3189 q15_t * pScratch2);
\r
3193 * @brief Partial convolution of Q15 sequences.
\r
3194 * @param[in] pSrcA points to the first input sequence.
\r
3195 * @param[in] srcALen length of the first input sequence.
\r
3196 * @param[in] pSrcB points to the second input sequence.
\r
3197 * @param[in] srcBLen length of the second input sequence.
\r
3198 * @param[out] pDst points to the block of output data
\r
3199 * @param[in] firstIndex is the first output sample to start with.
\r
3200 * @param[in] numPoints is the number of output points to be computed.
\r
3201 * @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
3203 arm_status arm_conv_partial_q15(
\r
3209 uint32_t firstIndex,
\r
3210 uint32_t numPoints);
\r
3214 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3215 * @param[in] pSrcA points to the first input sequence.
\r
3216 * @param[in] srcALen length of the first input sequence.
\r
3217 * @param[in] pSrcB points to the second input sequence.
\r
3218 * @param[in] srcBLen length of the second input sequence.
\r
3219 * @param[out] pDst points to the block of output data
\r
3220 * @param[in] firstIndex is the first output sample to start with.
\r
3221 * @param[in] numPoints is the number of output points to be computed.
\r
3222 * @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
3224 arm_status arm_conv_partial_fast_q15(
\r
3230 uint32_t firstIndex,
\r
3231 uint32_t numPoints);
\r
3235 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3236 * @param[in] pSrcA points to the first input sequence.
\r
3237 * @param[in] srcALen length of the first input sequence.
\r
3238 * @param[in] pSrcB points to the second input sequence.
\r
3239 * @param[in] srcBLen length of the second input sequence.
\r
3240 * @param[out] pDst points to the block of output data
\r
3241 * @param[in] firstIndex is the first output sample to start with.
\r
3242 * @param[in] numPoints is the number of output points to be computed.
\r
3243 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3244 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
\r
3245 * @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
3247 arm_status arm_conv_partial_fast_opt_q15(
\r
3253 uint32_t firstIndex,
\r
3254 uint32_t numPoints,
\r
3255 q15_t * pScratch1,
\r
3256 q15_t * pScratch2);
\r
3260 * @brief Partial convolution of Q31 sequences.
\r
3261 * @param[in] pSrcA points to the first input sequence.
\r
3262 * @param[in] srcALen length of the first input sequence.
\r
3263 * @param[in] pSrcB points to the second input sequence.
\r
3264 * @param[in] srcBLen length of the second input sequence.
\r
3265 * @param[out] pDst points to the block of output data
\r
3266 * @param[in] firstIndex is the first output sample to start with.
\r
3267 * @param[in] numPoints is the number of output points to be computed.
\r
3268 * @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
3270 arm_status arm_conv_partial_q31(
\r
3276 uint32_t firstIndex,
\r
3277 uint32_t numPoints);
\r
3281 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
3282 * @param[in] pSrcA points to the first input sequence.
\r
3283 * @param[in] srcALen length of the first input sequence.
\r
3284 * @param[in] pSrcB points to the second input sequence.
\r
3285 * @param[in] srcBLen length of the second input sequence.
\r
3286 * @param[out] pDst points to the block of output data
\r
3287 * @param[in] firstIndex is the first output sample to start with.
\r
3288 * @param[in] numPoints is the number of output points to be computed.
\r
3289 * @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
3291 arm_status arm_conv_partial_fast_q31(
\r
3297 uint32_t firstIndex,
\r
3298 uint32_t numPoints);
\r
3302 * @brief Partial convolution of Q7 sequences
\r
3303 * @param[in] pSrcA points to the first input sequence.
\r
3304 * @param[in] srcALen length of the first input sequence.
\r
3305 * @param[in] pSrcB points to the second input sequence.
\r
3306 * @param[in] srcBLen length of the second input sequence.
\r
3307 * @param[out] pDst points to the block of output data
\r
3308 * @param[in] firstIndex is the first output sample to start with.
\r
3309 * @param[in] numPoints is the number of output points to be computed.
\r
3310 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
3311 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
3312 * @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
3314 arm_status arm_conv_partial_opt_q7(
\r
3320 uint32_t firstIndex,
\r
3321 uint32_t numPoints,
\r
3322 q15_t * pScratch1,
\r
3323 q15_t * pScratch2);
\r
3327 * @brief Partial convolution of Q7 sequences.
\r
3328 * @param[in] pSrcA points to the first input sequence.
\r
3329 * @param[in] srcALen length of the first input sequence.
\r
3330 * @param[in] pSrcB points to the second input sequence.
\r
3331 * @param[in] srcBLen length of the second input sequence.
\r
3332 * @param[out] pDst points to the block of output data
\r
3333 * @param[in] firstIndex is the first output sample to start with.
\r
3334 * @param[in] numPoints is the number of output points to be computed.
\r
3335 * @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
3337 arm_status arm_conv_partial_q7(
\r
3343 uint32_t firstIndex,
\r
3344 uint32_t numPoints);
\r
3348 * @brief Instance structure for the Q15 FIR decimator.
\r
3352 uint8_t M; /**< decimation factor. */
\r
3353 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3354 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3355 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3356 } arm_fir_decimate_instance_q15;
\r
3359 * @brief Instance structure for the Q31 FIR decimator.
\r
3363 uint8_t M; /**< decimation factor. */
\r
3364 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3365 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3366 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3367 } arm_fir_decimate_instance_q31;
\r
3370 * @brief Instance structure for the floating-point FIR decimator.
\r
3374 uint8_t M; /**< decimation factor. */
\r
3375 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
3376 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
3377 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
3378 } arm_fir_decimate_instance_f32;
\r
3382 * @brief Processing function for the floating-point FIR decimator.
\r
3383 * @param[in] S points to an instance of the floating-point FIR decimator structure.
\r
3384 * @param[in] pSrc points to the block of input data.
\r
3385 * @param[out] pDst points to the block of output data
\r
3386 * @param[in] blockSize number of input samples to process per call.
\r
3388 void arm_fir_decimate_f32(
\r
3389 const arm_fir_decimate_instance_f32 * S,
\r
3392 uint32_t blockSize);
\r
3396 * @brief Initialization function for the floating-point FIR decimator.
\r
3397 * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
\r
3398 * @param[in] numTaps number of coefficients in the filter.
\r
3399 * @param[in] M decimation factor.
\r
3400 * @param[in] pCoeffs points to the filter coefficients.
\r
3401 * @param[in] pState points to the state buffer.
\r
3402 * @param[in] blockSize number of input samples to process per call.
\r
3403 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3404 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3406 arm_status arm_fir_decimate_init_f32(
\r
3407 arm_fir_decimate_instance_f32 * S,
\r
3410 float32_t * pCoeffs,
\r
3411 float32_t * pState,
\r
3412 uint32_t blockSize);
\r
3416 * @brief Processing function for the Q15 FIR decimator.
\r
3417 * @param[in] S points to an instance of the Q15 FIR decimator structure.
\r
3418 * @param[in] pSrc points to the block of input data.
\r
3419 * @param[out] pDst points to the block of output data
\r
3420 * @param[in] blockSize number of input samples to process per call.
\r
3422 void arm_fir_decimate_q15(
\r
3423 const arm_fir_decimate_instance_q15 * S,
\r
3426 uint32_t blockSize);
\r
3430 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3431 * @param[in] S points to an instance of the Q15 FIR decimator structure.
\r
3432 * @param[in] pSrc points to the block of input data.
\r
3433 * @param[out] pDst points to the block of output data
\r
3434 * @param[in] blockSize number of input samples to process per call.
\r
3436 void arm_fir_decimate_fast_q15(
\r
3437 const arm_fir_decimate_instance_q15 * S,
\r
3440 uint32_t blockSize);
\r
3444 * @brief Initialization function for the Q15 FIR decimator.
\r
3445 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
\r
3446 * @param[in] numTaps number of coefficients in the filter.
\r
3447 * @param[in] M decimation factor.
\r
3448 * @param[in] pCoeffs points to the filter coefficients.
\r
3449 * @param[in] pState points to the state buffer.
\r
3450 * @param[in] blockSize number of input samples to process per call.
\r
3451 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3452 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3454 arm_status arm_fir_decimate_init_q15(
\r
3455 arm_fir_decimate_instance_q15 * S,
\r
3460 uint32_t blockSize);
\r
3464 * @brief Processing function for the Q31 FIR decimator.
\r
3465 * @param[in] S points to an instance of the Q31 FIR decimator structure.
\r
3466 * @param[in] pSrc points to the block of input data.
\r
3467 * @param[out] pDst points to the block of output data
\r
3468 * @param[in] blockSize number of input samples to process per call.
\r
3470 void arm_fir_decimate_q31(
\r
3471 const arm_fir_decimate_instance_q31 * S,
\r
3474 uint32_t blockSize);
\r
3477 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
\r
3478 * @param[in] S points to an instance of the Q31 FIR decimator structure.
\r
3479 * @param[in] pSrc points to the block of input data.
\r
3480 * @param[out] pDst points to the block of output data
\r
3481 * @param[in] blockSize number of input samples to process per call.
\r
3483 void arm_fir_decimate_fast_q31(
\r
3484 arm_fir_decimate_instance_q31 * S,
\r
3487 uint32_t blockSize);
\r
3491 * @brief Initialization function for the Q31 FIR decimator.
\r
3492 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
\r
3493 * @param[in] numTaps number of coefficients in the filter.
\r
3494 * @param[in] M decimation factor.
\r
3495 * @param[in] pCoeffs points to the filter coefficients.
\r
3496 * @param[in] pState points to the state buffer.
\r
3497 * @param[in] blockSize number of input samples to process per call.
\r
3498 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3499 * <code>blockSize</code> is not a multiple of <code>M</code>.
\r
3501 arm_status arm_fir_decimate_init_q31(
\r
3502 arm_fir_decimate_instance_q31 * S,
\r
3507 uint32_t blockSize);
\r
3511 * @brief Instance structure for the Q15 FIR interpolator.
\r
3515 uint8_t L; /**< upsample factor. */
\r
3516 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3517 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3518 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3519 } arm_fir_interpolate_instance_q15;
\r
3522 * @brief Instance structure for the Q31 FIR interpolator.
\r
3526 uint8_t L; /**< upsample factor. */
\r
3527 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3528 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3529 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
\r
3530 } arm_fir_interpolate_instance_q31;
\r
3533 * @brief Instance structure for the floating-point FIR interpolator.
\r
3537 uint8_t L; /**< upsample factor. */
\r
3538 uint16_t phaseLength; /**< length of each polyphase filter component. */
\r
3539 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
\r
3540 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
\r
3541 } arm_fir_interpolate_instance_f32;
\r
3545 * @brief Processing function for the Q15 FIR interpolator.
\r
3546 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
\r
3547 * @param[in] pSrc points to the block of input data.
\r
3548 * @param[out] pDst points to the block of output data.
\r
3549 * @param[in] blockSize number of input samples to process per call.
\r
3551 void arm_fir_interpolate_q15(
\r
3552 const arm_fir_interpolate_instance_q15 * S,
\r
3555 uint32_t blockSize);
\r
3559 * @brief Initialization function for the Q15 FIR interpolator.
\r
3560 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
\r
3561 * @param[in] L upsample factor.
\r
3562 * @param[in] numTaps number of filter coefficients in the filter.
\r
3563 * @param[in] pCoeffs points to the filter coefficient buffer.
\r
3564 * @param[in] pState points to the state buffer.
\r
3565 * @param[in] blockSize number of input samples to process per call.
\r
3566 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3567 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3569 arm_status arm_fir_interpolate_init_q15(
\r
3570 arm_fir_interpolate_instance_q15 * S,
\r
3575 uint32_t blockSize);
\r
3579 * @brief Processing function for the Q31 FIR interpolator.
\r
3580 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
\r
3581 * @param[in] pSrc points to the block of input data.
\r
3582 * @param[out] pDst points to the block of output data.
\r
3583 * @param[in] blockSize number of input samples to process per call.
\r
3585 void arm_fir_interpolate_q31(
\r
3586 const arm_fir_interpolate_instance_q31 * S,
\r
3589 uint32_t blockSize);
\r
3593 * @brief Initialization function for the Q31 FIR interpolator.
\r
3594 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
\r
3595 * @param[in] L upsample factor.
\r
3596 * @param[in] numTaps number of filter coefficients in the filter.
\r
3597 * @param[in] pCoeffs points to the filter coefficient buffer.
\r
3598 * @param[in] pState points to the state buffer.
\r
3599 * @param[in] blockSize number of input samples to process per call.
\r
3600 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3601 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3603 arm_status arm_fir_interpolate_init_q31(
\r
3604 arm_fir_interpolate_instance_q31 * S,
\r
3609 uint32_t blockSize);
\r
3613 * @brief Processing function for the floating-point FIR interpolator.
\r
3614 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
\r
3615 * @param[in] pSrc points to the block of input data.
\r
3616 * @param[out] pDst points to the block of output data.
\r
3617 * @param[in] blockSize number of input samples to process per call.
\r
3619 void arm_fir_interpolate_f32(
\r
3620 const arm_fir_interpolate_instance_f32 * S,
\r
3623 uint32_t blockSize);
\r
3627 * @brief Initialization function for the floating-point FIR interpolator.
\r
3628 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
\r
3629 * @param[in] L upsample factor.
\r
3630 * @param[in] numTaps number of filter coefficients in the filter.
\r
3631 * @param[in] pCoeffs points to the filter coefficient buffer.
\r
3632 * @param[in] pState points to the state buffer.
\r
3633 * @param[in] blockSize number of input samples to process per call.
\r
3634 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
\r
3635 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
\r
3637 arm_status arm_fir_interpolate_init_f32(
\r
3638 arm_fir_interpolate_instance_f32 * S,
\r
3641 float32_t * pCoeffs,
\r
3642 float32_t * pState,
\r
3643 uint32_t blockSize);
\r
3647 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
\r
3651 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3652 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3653 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3654 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
\r
3655 } arm_biquad_cas_df1_32x64_ins_q31;
\r
3659 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3660 * @param[in] pSrc points to the block of input data.
\r
3661 * @param[out] pDst points to the block of output data
\r
3662 * @param[in] blockSize number of samples to process.
\r
3664 void arm_biquad_cas_df1_32x64_q31(
\r
3665 const arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3668 uint32_t blockSize);
\r
3672 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
\r
3673 * @param[in] numStages number of 2nd order stages in the filter.
\r
3674 * @param[in] pCoeffs points to the filter coefficients.
\r
3675 * @param[in] pState points to the state buffer.
\r
3676 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
\r
3678 void arm_biquad_cas_df1_32x64_init_q31(
\r
3679 arm_biquad_cas_df1_32x64_ins_q31 * S,
\r
3680 uint8_t numStages,
\r
3683 uint8_t postShift);
\r
3687 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3691 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3692 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3693 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3694 } arm_biquad_cascade_df2T_instance_f32;
\r
3697 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3701 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3702 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
\r
3703 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3704 } arm_biquad_cascade_stereo_df2T_instance_f32;
\r
3707 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
\r
3711 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
\r
3712 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
\r
3713 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
\r
3714 } arm_biquad_cascade_df2T_instance_f64;
\r
3718 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3719 * @param[in] S points to an instance of the filter data structure.
\r
3720 * @param[in] pSrc points to the block of input data.
\r
3721 * @param[out] pDst points to the block of output data
\r
3722 * @param[in] blockSize number of samples to process.
\r
3724 void arm_biquad_cascade_df2T_f32(
\r
3725 const arm_biquad_cascade_df2T_instance_f32 * S,
\r
3728 uint32_t blockSize);
\r
3732 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
\r
3733 * @param[in] S points to an instance of the filter data structure.
\r
3734 * @param[in] pSrc points to the block of input data.
\r
3735 * @param[out] pDst points to the block of output data
\r
3736 * @param[in] blockSize number of samples to process.
\r
3738 void arm_biquad_cascade_stereo_df2T_f32(
\r
3739 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3742 uint32_t blockSize);
\r
3746 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
\r
3747 * @param[in] S points to an instance of the filter data structure.
\r
3748 * @param[in] pSrc points to the block of input data.
\r
3749 * @param[out] pDst points to the block of output data
\r
3750 * @param[in] blockSize number of samples to process.
\r
3752 void arm_biquad_cascade_df2T_f64(
\r
3753 const arm_biquad_cascade_df2T_instance_f64 * S,
\r
3756 uint32_t blockSize);
\r
3760 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3761 * @param[in,out] S points to an instance of the filter data structure.
\r
3762 * @param[in] numStages number of 2nd order stages in the filter.
\r
3763 * @param[in] pCoeffs points to the filter coefficients.
\r
3764 * @param[in] pState points to the state buffer.
\r
3766 void arm_biquad_cascade_df2T_init_f32(
\r
3767 arm_biquad_cascade_df2T_instance_f32 * S,
\r
3768 uint8_t numStages,
\r
3769 float32_t * pCoeffs,
\r
3770 float32_t * pState);
\r
3774 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3775 * @param[in,out] S points to an instance of the filter data structure.
\r
3776 * @param[in] numStages number of 2nd order stages in the filter.
\r
3777 * @param[in] pCoeffs points to the filter coefficients.
\r
3778 * @param[in] pState points to the state buffer.
\r
3780 void arm_biquad_cascade_stereo_df2T_init_f32(
\r
3781 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
\r
3782 uint8_t numStages,
\r
3783 float32_t * pCoeffs,
\r
3784 float32_t * pState);
\r
3788 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
\r
3789 * @param[in,out] S points to an instance of the filter data structure.
\r
3790 * @param[in] numStages number of 2nd order stages in the filter.
\r
3791 * @param[in] pCoeffs points to the filter coefficients.
\r
3792 * @param[in] pState points to the state buffer.
\r
3794 void arm_biquad_cascade_df2T_init_f64(
\r
3795 arm_biquad_cascade_df2T_instance_f64 * S,
\r
3796 uint8_t numStages,
\r
3797 float64_t * pCoeffs,
\r
3798 float64_t * pState);
\r
3802 * @brief Instance structure for the Q15 FIR lattice filter.
\r
3806 uint16_t numStages; /**< number of filter stages. */
\r
3807 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3808 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3809 } arm_fir_lattice_instance_q15;
\r
3812 * @brief Instance structure for the Q31 FIR lattice filter.
\r
3816 uint16_t numStages; /**< number of filter stages. */
\r
3817 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3818 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3819 } arm_fir_lattice_instance_q31;
\r
3822 * @brief Instance structure for the floating-point FIR lattice filter.
\r
3826 uint16_t numStages; /**< number of filter stages. */
\r
3827 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
\r
3828 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
\r
3829 } arm_fir_lattice_instance_f32;
\r
3833 * @brief Initialization function for the Q15 FIR lattice filter.
\r
3834 * @param[in] S points to an instance of the Q15 FIR lattice structure.
\r
3835 * @param[in] numStages number of filter stages.
\r
3836 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3837 * @param[in] pState points to the state buffer. The array is of length numStages.
\r
3839 void arm_fir_lattice_init_q15(
\r
3840 arm_fir_lattice_instance_q15 * S,
\r
3841 uint16_t numStages,
\r
3847 * @brief Processing function for the Q15 FIR lattice filter.
\r
3848 * @param[in] S points to an instance of the Q15 FIR lattice structure.
\r
3849 * @param[in] pSrc points to the block of input data.
\r
3850 * @param[out] pDst points to the block of output data.
\r
3851 * @param[in] blockSize number of samples to process.
\r
3853 void arm_fir_lattice_q15(
\r
3854 const arm_fir_lattice_instance_q15 * S,
\r
3857 uint32_t blockSize);
\r
3861 * @brief Initialization function for the Q31 FIR lattice filter.
\r
3862 * @param[in] S points to an instance of the Q31 FIR lattice structure.
\r
3863 * @param[in] numStages number of filter stages.
\r
3864 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3865 * @param[in] pState points to the state buffer. The array is of length numStages.
\r
3867 void arm_fir_lattice_init_q31(
\r
3868 arm_fir_lattice_instance_q31 * S,
\r
3869 uint16_t numStages,
\r
3875 * @brief Processing function for the Q31 FIR lattice filter.
\r
3876 * @param[in] S points to an instance of the Q31 FIR lattice structure.
\r
3877 * @param[in] pSrc points to the block of input data.
\r
3878 * @param[out] pDst points to the block of output data
\r
3879 * @param[in] blockSize number of samples to process.
\r
3881 void arm_fir_lattice_q31(
\r
3882 const arm_fir_lattice_instance_q31 * S,
\r
3885 uint32_t blockSize);
\r
3889 * @brief Initialization function for the floating-point FIR lattice filter.
\r
3890 * @param[in] S points to an instance of the floating-point FIR lattice structure.
\r
3891 * @param[in] numStages number of filter stages.
\r
3892 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
\r
3893 * @param[in] pState points to the state buffer. The array is of length numStages.
\r
3895 void arm_fir_lattice_init_f32(
\r
3896 arm_fir_lattice_instance_f32 * S,
\r
3897 uint16_t numStages,
\r
3898 float32_t * pCoeffs,
\r
3899 float32_t * pState);
\r
3903 * @brief Processing function for the floating-point FIR lattice filter.
\r
3904 * @param[in] S points to an instance of the floating-point FIR lattice structure.
\r
3905 * @param[in] pSrc points to the block of input data.
\r
3906 * @param[out] pDst points to the block of output data
\r
3907 * @param[in] blockSize number of samples to process.
\r
3909 void arm_fir_lattice_f32(
\r
3910 const arm_fir_lattice_instance_f32 * S,
\r
3913 uint32_t blockSize);
\r
3917 * @brief Instance structure for the Q15 IIR lattice filter.
\r
3921 uint16_t numStages; /**< number of stages in the filter. */
\r
3922 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3923 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3924 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3925 } arm_iir_lattice_instance_q15;
\r
3928 * @brief Instance structure for the Q31 IIR lattice filter.
\r
3932 uint16_t numStages; /**< number of stages in the filter. */
\r
3933 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3934 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3935 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3936 } arm_iir_lattice_instance_q31;
\r
3939 * @brief Instance structure for the floating-point IIR lattice filter.
\r
3943 uint16_t numStages; /**< number of stages in the filter. */
\r
3944 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
\r
3945 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
\r
3946 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
\r
3947 } arm_iir_lattice_instance_f32;
\r
3951 * @brief Processing function for the floating-point IIR lattice filter.
\r
3952 * @param[in] S points to an instance of the floating-point IIR lattice structure.
\r
3953 * @param[in] pSrc points to the block of input data.
\r
3954 * @param[out] pDst points to the block of output data.
\r
3955 * @param[in] blockSize number of samples to process.
\r
3957 void arm_iir_lattice_f32(
\r
3958 const arm_iir_lattice_instance_f32 * S,
\r
3961 uint32_t blockSize);
\r
3965 * @brief Initialization function for the floating-point IIR lattice filter.
\r
3966 * @param[in] S points to an instance of the floating-point IIR lattice structure.
\r
3967 * @param[in] numStages number of stages in the filter.
\r
3968 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
3969 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
3970 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
\r
3971 * @param[in] blockSize number of samples to process.
\r
3973 void arm_iir_lattice_init_f32(
\r
3974 arm_iir_lattice_instance_f32 * S,
\r
3975 uint16_t numStages,
\r
3976 float32_t * pkCoeffs,
\r
3977 float32_t * pvCoeffs,
\r
3978 float32_t * pState,
\r
3979 uint32_t blockSize);
\r
3983 * @brief Processing function for the Q31 IIR lattice filter.
\r
3984 * @param[in] S points to an instance of the Q31 IIR lattice structure.
\r
3985 * @param[in] pSrc points to the block of input data.
\r
3986 * @param[out] pDst points to the block of output data.
\r
3987 * @param[in] blockSize number of samples to process.
\r
3989 void arm_iir_lattice_q31(
\r
3990 const arm_iir_lattice_instance_q31 * S,
\r
3993 uint32_t blockSize);
\r
3997 * @brief Initialization function for the Q31 IIR lattice filter.
\r
3998 * @param[in] S points to an instance of the Q31 IIR lattice structure.
\r
3999 * @param[in] numStages number of stages in the filter.
\r
4000 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
\r
4001 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
\r
4002 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
\r
4003 * @param[in] blockSize number of samples to process.
\r
4005 void arm_iir_lattice_init_q31(
\r
4006 arm_iir_lattice_instance_q31 * S,
\r
4007 uint16_t numStages,
\r
4011 uint32_t blockSize);
\r
4015 * @brief Processing function for the Q15 IIR lattice filter.
\r
4016 * @param[in] S points to an instance of the Q15 IIR lattice structure.
\r
4017 * @param[in] pSrc points to the block of input data.
\r
4018 * @param[out] pDst points to the block of output data.
\r
4019 * @param[in] blockSize number of samples to process.
\r
4021 void arm_iir_lattice_q15(
\r
4022 const arm_iir_lattice_instance_q15 * S,
\r
4025 uint32_t blockSize);
\r
4029 * @brief Initialization function for the Q15 IIR lattice filter.
\r
4030 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
\r
4031 * @param[in] numStages number of stages in the filter.
\r
4032 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
\r
4033 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
\r
4034 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
\r
4035 * @param[in] blockSize number of samples to process per call.
\r
4037 void arm_iir_lattice_init_q15(
\r
4038 arm_iir_lattice_instance_q15 * S,
\r
4039 uint16_t numStages,
\r
4043 uint32_t blockSize);
\r
4047 * @brief Instance structure for the floating-point LMS filter.
\r
4051 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4052 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4053 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4054 float32_t mu; /**< step size that controls filter coefficient updates. */
\r
4055 } arm_lms_instance_f32;
\r
4059 * @brief Processing function for floating-point LMS filter.
\r
4060 * @param[in] S points to an instance of the floating-point LMS filter structure.
\r
4061 * @param[in] pSrc points to the block of input data.
\r
4062 * @param[in] pRef points to the block of reference data.
\r
4063 * @param[out] pOut points to the block of output data.
\r
4064 * @param[out] pErr points to the block of error data.
\r
4065 * @param[in] blockSize number of samples to process.
\r
4068 const arm_lms_instance_f32 * S,
\r
4073 uint32_t blockSize);
\r
4077 * @brief Initialization function for floating-point LMS filter.
\r
4078 * @param[in] S points to an instance of the floating-point LMS filter structure.
\r
4079 * @param[in] numTaps number of filter coefficients.
\r
4080 * @param[in] pCoeffs points to the coefficient buffer.
\r
4081 * @param[in] pState points to state buffer.
\r
4082 * @param[in] mu step size that controls filter coefficient updates.
\r
4083 * @param[in] blockSize number of samples to process.
\r
4085 void arm_lms_init_f32(
\r
4086 arm_lms_instance_f32 * S,
\r
4088 float32_t * pCoeffs,
\r
4089 float32_t * pState,
\r
4091 uint32_t blockSize);
\r
4095 * @brief Instance structure for the Q15 LMS filter.
\r
4099 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4100 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4101 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4102 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4103 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4104 } arm_lms_instance_q15;
\r
4108 * @brief Initialization function for the Q15 LMS filter.
\r
4109 * @param[in] S points to an instance of the Q15 LMS filter structure.
\r
4110 * @param[in] numTaps number of filter coefficients.
\r
4111 * @param[in] pCoeffs points to the coefficient buffer.
\r
4112 * @param[in] pState points to the state buffer.
\r
4113 * @param[in] mu step size that controls filter coefficient updates.
\r
4114 * @param[in] blockSize number of samples to process.
\r
4115 * @param[in] postShift bit shift applied to coefficients.
\r
4117 void arm_lms_init_q15(
\r
4118 arm_lms_instance_q15 * S,
\r
4123 uint32_t blockSize,
\r
4124 uint32_t postShift);
\r
4128 * @brief Processing function for Q15 LMS filter.
\r
4129 * @param[in] S points to an instance of the Q15 LMS filter structure.
\r
4130 * @param[in] pSrc points to the block of input data.
\r
4131 * @param[in] pRef points to the block of reference data.
\r
4132 * @param[out] pOut points to the block of output data.
\r
4133 * @param[out] pErr points to the block of error data.
\r
4134 * @param[in] blockSize number of samples to process.
\r
4137 const arm_lms_instance_q15 * S,
\r
4142 uint32_t blockSize);
\r
4146 * @brief Instance structure for the Q31 LMS filter.
\r
4150 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4151 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4152 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4153 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4154 uint32_t postShift; /**< bit shift applied to coefficients. */
\r
4155 } arm_lms_instance_q31;
\r
4159 * @brief Processing function for Q31 LMS filter.
\r
4160 * @param[in] S points to an instance of the Q15 LMS filter structure.
\r
4161 * @param[in] pSrc points to the block of input data.
\r
4162 * @param[in] pRef points to the block of reference data.
\r
4163 * @param[out] pOut points to the block of output data.
\r
4164 * @param[out] pErr points to the block of error data.
\r
4165 * @param[in] blockSize number of samples to process.
\r
4168 const arm_lms_instance_q31 * S,
\r
4173 uint32_t blockSize);
\r
4177 * @brief Initialization function for Q31 LMS filter.
\r
4178 * @param[in] S points to an instance of the Q31 LMS filter structure.
\r
4179 * @param[in] numTaps number of filter coefficients.
\r
4180 * @param[in] pCoeffs points to coefficient buffer.
\r
4181 * @param[in] pState points to state buffer.
\r
4182 * @param[in] mu step size that controls filter coefficient updates.
\r
4183 * @param[in] blockSize number of samples to process.
\r
4184 * @param[in] postShift bit shift applied to coefficients.
\r
4186 void arm_lms_init_q31(
\r
4187 arm_lms_instance_q31 * S,
\r
4192 uint32_t blockSize,
\r
4193 uint32_t postShift);
\r
4197 * @brief Instance structure for the floating-point normalized LMS filter.
\r
4201 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4202 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4203 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4204 float32_t mu; /**< step size that control filter coefficient updates. */
\r
4205 float32_t energy; /**< saves previous frame energy. */
\r
4206 float32_t x0; /**< saves previous input sample. */
\r
4207 } arm_lms_norm_instance_f32;
\r
4211 * @brief Processing function for floating-point normalized LMS filter.
\r
4212 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
\r
4213 * @param[in] pSrc points to the block of input data.
\r
4214 * @param[in] pRef points to the block of reference data.
\r
4215 * @param[out] pOut points to the block of output data.
\r
4216 * @param[out] pErr points to the block of error data.
\r
4217 * @param[in] blockSize number of samples to process.
\r
4219 void arm_lms_norm_f32(
\r
4220 arm_lms_norm_instance_f32 * S,
\r
4225 uint32_t blockSize);
\r
4229 * @brief Initialization function for floating-point normalized LMS filter.
\r
4230 * @param[in] S points to an instance of the floating-point LMS filter structure.
\r
4231 * @param[in] numTaps number of filter coefficients.
\r
4232 * @param[in] pCoeffs points to coefficient buffer.
\r
4233 * @param[in] pState points to state buffer.
\r
4234 * @param[in] mu step size that controls filter coefficient updates.
\r
4235 * @param[in] blockSize number of samples to process.
\r
4237 void arm_lms_norm_init_f32(
\r
4238 arm_lms_norm_instance_f32 * S,
\r
4240 float32_t * pCoeffs,
\r
4241 float32_t * pState,
\r
4243 uint32_t blockSize);
\r
4247 * @brief Instance structure for the Q31 normalized LMS filter.
\r
4251 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4252 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4253 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4254 q31_t mu; /**< step size that controls filter coefficient updates. */
\r
4255 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4256 q31_t *recipTable; /**< points to the reciprocal initial value table. */
\r
4257 q31_t energy; /**< saves previous frame energy. */
\r
4258 q31_t x0; /**< saves previous input sample. */
\r
4259 } arm_lms_norm_instance_q31;
\r
4263 * @brief Processing function for Q31 normalized LMS filter.
\r
4264 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
\r
4265 * @param[in] pSrc points to the block of input data.
\r
4266 * @param[in] pRef points to the block of reference data.
\r
4267 * @param[out] pOut points to the block of output data.
\r
4268 * @param[out] pErr points to the block of error data.
\r
4269 * @param[in] blockSize number of samples to process.
\r
4271 void arm_lms_norm_q31(
\r
4272 arm_lms_norm_instance_q31 * S,
\r
4277 uint32_t blockSize);
\r
4281 * @brief Initialization function for Q31 normalized LMS filter.
\r
4282 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
\r
4283 * @param[in] numTaps number of filter coefficients.
\r
4284 * @param[in] pCoeffs points to coefficient buffer.
\r
4285 * @param[in] pState points to state buffer.
\r
4286 * @param[in] mu step size that controls filter coefficient updates.
\r
4287 * @param[in] blockSize number of samples to process.
\r
4288 * @param[in] postShift bit shift applied to coefficients.
\r
4290 void arm_lms_norm_init_q31(
\r
4291 arm_lms_norm_instance_q31 * S,
\r
4296 uint32_t blockSize,
\r
4297 uint8_t postShift);
\r
4301 * @brief Instance structure for the Q15 normalized LMS filter.
\r
4305 uint16_t numTaps; /**< Number of coefficients in the filter. */
\r
4306 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
\r
4307 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
\r
4308 q15_t mu; /**< step size that controls filter coefficient updates. */
\r
4309 uint8_t postShift; /**< bit shift applied to coefficients. */
\r
4310 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
\r
4311 q15_t energy; /**< saves previous frame energy. */
\r
4312 q15_t x0; /**< saves previous input sample. */
\r
4313 } arm_lms_norm_instance_q15;
\r
4317 * @brief Processing function for Q15 normalized LMS filter.
\r
4318 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
\r
4319 * @param[in] pSrc points to the block of input data.
\r
4320 * @param[in] pRef points to the block of reference data.
\r
4321 * @param[out] pOut points to the block of output data.
\r
4322 * @param[out] pErr points to the block of error data.
\r
4323 * @param[in] blockSize number of samples to process.
\r
4325 void arm_lms_norm_q15(
\r
4326 arm_lms_norm_instance_q15 * S,
\r
4331 uint32_t blockSize);
\r
4335 * @brief Initialization function for Q15 normalized LMS filter.
\r
4336 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
\r
4337 * @param[in] numTaps number of filter coefficients.
\r
4338 * @param[in] pCoeffs points to coefficient buffer.
\r
4339 * @param[in] pState points to state buffer.
\r
4340 * @param[in] mu step size that controls filter coefficient updates.
\r
4341 * @param[in] blockSize number of samples to process.
\r
4342 * @param[in] postShift bit shift applied to coefficients.
\r
4344 void arm_lms_norm_init_q15(
\r
4345 arm_lms_norm_instance_q15 * S,
\r
4350 uint32_t blockSize,
\r
4351 uint8_t postShift);
\r
4355 * @brief Correlation of floating-point sequences.
\r
4356 * @param[in] pSrcA points to the first input sequence.
\r
4357 * @param[in] srcALen length of the first input sequence.
\r
4358 * @param[in] pSrcB points to the second input sequence.
\r
4359 * @param[in] srcBLen length of the second input sequence.
\r
4360 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4362 void arm_correlate_f32(
\r
4363 float32_t * pSrcA,
\r
4365 float32_t * pSrcB,
\r
4367 float32_t * pDst);
\r
4371 * @brief Correlation of Q15 sequences
\r
4372 * @param[in] pSrcA points to the first input sequence.
\r
4373 * @param[in] srcALen length of the first input sequence.
\r
4374 * @param[in] pSrcB points to the second input sequence.
\r
4375 * @param[in] srcBLen length of the second input sequence.
\r
4376 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4377 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4379 void arm_correlate_opt_q15(
\r
4385 q15_t * pScratch);
\r
4389 * @brief Correlation of Q15 sequences.
\r
4390 * @param[in] pSrcA points to the first input sequence.
\r
4391 * @param[in] srcALen length of the first input sequence.
\r
4392 * @param[in] pSrcB points to the second input sequence.
\r
4393 * @param[in] srcBLen length of the second input sequence.
\r
4394 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4397 void arm_correlate_q15(
\r
4406 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4407 * @param[in] pSrcA points to the first input sequence.
\r
4408 * @param[in] srcALen length of the first input sequence.
\r
4409 * @param[in] pSrcB points to the second input sequence.
\r
4410 * @param[in] srcBLen length of the second input sequence.
\r
4411 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4414 void arm_correlate_fast_q15(
\r
4423 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
\r
4424 * @param[in] pSrcA points to the first input sequence.
\r
4425 * @param[in] srcALen length of the first input sequence.
\r
4426 * @param[in] pSrcB points to the second input sequence.
\r
4427 * @param[in] srcBLen length of the second input sequence.
\r
4428 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4429 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4431 void arm_correlate_fast_opt_q15(
\r
4437 q15_t * pScratch);
\r
4441 * @brief Correlation of Q31 sequences.
\r
4442 * @param[in] pSrcA points to the first input sequence.
\r
4443 * @param[in] srcALen length of the first input sequence.
\r
4444 * @param[in] pSrcB points to the second input sequence.
\r
4445 * @param[in] srcBLen length of the second input sequence.
\r
4446 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4448 void arm_correlate_q31(
\r
4457 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
\r
4458 * @param[in] pSrcA points to the first input sequence.
\r
4459 * @param[in] srcALen length of the first input sequence.
\r
4460 * @param[in] pSrcB points to the second input sequence.
\r
4461 * @param[in] srcBLen length of the second input sequence.
\r
4462 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4464 void arm_correlate_fast_q31(
\r
4473 * @brief Correlation of Q7 sequences.
\r
4474 * @param[in] pSrcA points to the first input sequence.
\r
4475 * @param[in] srcALen length of the first input sequence.
\r
4476 * @param[in] pSrcB points to the second input sequence.
\r
4477 * @param[in] srcBLen length of the second input sequence.
\r
4478 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4479 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
\r
4480 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
\r
4482 void arm_correlate_opt_q7(
\r
4488 q15_t * pScratch1,
\r
4489 q15_t * pScratch2);
\r
4493 * @brief Correlation of Q7 sequences.
\r
4494 * @param[in] pSrcA points to the first input sequence.
\r
4495 * @param[in] srcALen length of the first input sequence.
\r
4496 * @param[in] pSrcB points to the second input sequence.
\r
4497 * @param[in] srcBLen length of the second input sequence.
\r
4498 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
\r
4500 void arm_correlate_q7(
\r
4509 * @brief Instance structure for the floating-point sparse FIR filter.
\r
4513 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4514 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4515 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4516 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4517 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4518 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4519 } arm_fir_sparse_instance_f32;
\r
4522 * @brief Instance structure for the Q31 sparse FIR filter.
\r
4526 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4527 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4528 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4529 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4530 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4531 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4532 } arm_fir_sparse_instance_q31;
\r
4535 * @brief Instance structure for the Q15 sparse FIR filter.
\r
4539 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4540 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4541 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4542 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4543 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4544 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4545 } arm_fir_sparse_instance_q15;
\r
4548 * @brief Instance structure for the Q7 sparse FIR filter.
\r
4552 uint16_t numTaps; /**< number of coefficients in the filter. */
\r
4553 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
\r
4554 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
\r
4555 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
\r
4556 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
\r
4557 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
\r
4558 } arm_fir_sparse_instance_q7;
\r
4562 * @brief Processing function for the floating-point sparse FIR filter.
\r
4563 * @param[in] S points to an instance of the floating-point sparse FIR structure.
\r
4564 * @param[in] pSrc points to the block of input data.
\r
4565 * @param[out] pDst points to the block of output data
\r
4566 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4567 * @param[in] blockSize number of input samples to process per call.
\r
4569 void arm_fir_sparse_f32(
\r
4570 arm_fir_sparse_instance_f32 * S,
\r
4573 float32_t * pScratchIn,
\r
4574 uint32_t blockSize);
\r
4578 * @brief Initialization function for the floating-point sparse FIR filter.
\r
4579 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
\r
4580 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4581 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4582 * @param[in] pState points to the state buffer.
\r
4583 * @param[in] pTapDelay points to the array of offset times.
\r
4584 * @param[in] maxDelay maximum offset time supported.
\r
4585 * @param[in] blockSize number of samples that will be processed per block.
\r
4587 void arm_fir_sparse_init_f32(
\r
4588 arm_fir_sparse_instance_f32 * S,
\r
4590 float32_t * pCoeffs,
\r
4591 float32_t * pState,
\r
4592 int32_t * pTapDelay,
\r
4593 uint16_t maxDelay,
\r
4594 uint32_t blockSize);
\r
4598 * @brief Processing function for the Q31 sparse FIR filter.
\r
4599 * @param[in] S points to an instance of the Q31 sparse FIR structure.
\r
4600 * @param[in] pSrc points to the block of input data.
\r
4601 * @param[out] pDst points to the block of output data
\r
4602 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4603 * @param[in] blockSize number of input samples to process per call.
\r
4605 void arm_fir_sparse_q31(
\r
4606 arm_fir_sparse_instance_q31 * S,
\r
4609 q31_t * pScratchIn,
\r
4610 uint32_t blockSize);
\r
4614 * @brief Initialization function for the Q31 sparse FIR filter.
\r
4615 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
\r
4616 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4617 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4618 * @param[in] pState points to the state buffer.
\r
4619 * @param[in] pTapDelay points to the array of offset times.
\r
4620 * @param[in] maxDelay maximum offset time supported.
\r
4621 * @param[in] blockSize number of samples that will be processed per block.
\r
4623 void arm_fir_sparse_init_q31(
\r
4624 arm_fir_sparse_instance_q31 * S,
\r
4628 int32_t * pTapDelay,
\r
4629 uint16_t maxDelay,
\r
4630 uint32_t blockSize);
\r
4634 * @brief Processing function for the Q15 sparse FIR filter.
\r
4635 * @param[in] S points to an instance of the Q15 sparse FIR structure.
\r
4636 * @param[in] pSrc points to the block of input data.
\r
4637 * @param[out] pDst points to the block of output data
\r
4638 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4639 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
\r
4640 * @param[in] blockSize number of input samples to process per call.
\r
4642 void arm_fir_sparse_q15(
\r
4643 arm_fir_sparse_instance_q15 * S,
\r
4646 q15_t * pScratchIn,
\r
4647 q31_t * pScratchOut,
\r
4648 uint32_t blockSize);
\r
4652 * @brief Initialization function for the Q15 sparse FIR filter.
\r
4653 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
\r
4654 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4655 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4656 * @param[in] pState points to the state buffer.
\r
4657 * @param[in] pTapDelay points to the array of offset times.
\r
4658 * @param[in] maxDelay maximum offset time supported.
\r
4659 * @param[in] blockSize number of samples that will be processed per block.
\r
4661 void arm_fir_sparse_init_q15(
\r
4662 arm_fir_sparse_instance_q15 * S,
\r
4666 int32_t * pTapDelay,
\r
4667 uint16_t maxDelay,
\r
4668 uint32_t blockSize);
\r
4672 * @brief Processing function for the Q7 sparse FIR filter.
\r
4673 * @param[in] S points to an instance of the Q7 sparse FIR structure.
\r
4674 * @param[in] pSrc points to the block of input data.
\r
4675 * @param[out] pDst points to the block of output data
\r
4676 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
\r
4677 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
\r
4678 * @param[in] blockSize number of input samples to process per call.
\r
4680 void arm_fir_sparse_q7(
\r
4681 arm_fir_sparse_instance_q7 * S,
\r
4684 q7_t * pScratchIn,
\r
4685 q31_t * pScratchOut,
\r
4686 uint32_t blockSize);
\r
4690 * @brief Initialization function for the Q7 sparse FIR filter.
\r
4691 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
\r
4692 * @param[in] numTaps number of nonzero coefficients in the filter.
\r
4693 * @param[in] pCoeffs points to the array of filter coefficients.
\r
4694 * @param[in] pState points to the state buffer.
\r
4695 * @param[in] pTapDelay points to the array of offset times.
\r
4696 * @param[in] maxDelay maximum offset time supported.
\r
4697 * @param[in] blockSize number of samples that will be processed per block.
\r
4699 void arm_fir_sparse_init_q7(
\r
4700 arm_fir_sparse_instance_q7 * S,
\r
4704 int32_t * pTapDelay,
\r
4705 uint16_t maxDelay,
\r
4706 uint32_t blockSize);
\r
4710 * @brief Floating-point sin_cos function.
\r
4711 * @param[in] theta input value in degrees
\r
4712 * @param[out] pSinVal points to the processed sine output.
\r
4713 * @param[out] pCosVal points to the processed cos output.
\r
4715 void arm_sin_cos_f32(
\r
4717 float32_t * pSinVal,
\r
4718 float32_t * pCosVal);
\r
4722 * @brief Q31 sin_cos function.
\r
4723 * @param[in] theta scaled input value in degrees
\r
4724 * @param[out] pSinVal points to the processed sine output.
\r
4725 * @param[out] pCosVal points to the processed cosine output.
\r
4727 void arm_sin_cos_q31(
\r
4734 * @brief Floating-point complex conjugate.
\r
4735 * @param[in] pSrc points to the input vector
\r
4736 * @param[out] pDst points to the output vector
\r
4737 * @param[in] numSamples number of complex samples in each vector
\r
4739 void arm_cmplx_conj_f32(
\r
4742 uint32_t numSamples);
\r
4745 * @brief Q31 complex conjugate.
\r
4746 * @param[in] pSrc points to the input vector
\r
4747 * @param[out] pDst points to the output vector
\r
4748 * @param[in] numSamples number of complex samples in each vector
\r
4750 void arm_cmplx_conj_q31(
\r
4753 uint32_t numSamples);
\r
4757 * @brief Q15 complex conjugate.
\r
4758 * @param[in] pSrc points to the input vector
\r
4759 * @param[out] pDst points to the output vector
\r
4760 * @param[in] numSamples number of complex samples in each vector
\r
4762 void arm_cmplx_conj_q15(
\r
4765 uint32_t numSamples);
\r
4769 * @brief Floating-point complex magnitude squared
\r
4770 * @param[in] pSrc points to the complex input vector
\r
4771 * @param[out] pDst points to the real output vector
\r
4772 * @param[in] numSamples number of complex samples in the input vector
\r
4774 void arm_cmplx_mag_squared_f32(
\r
4777 uint32_t numSamples);
\r
4781 * @brief Q31 complex magnitude squared
\r
4782 * @param[in] pSrc points to the complex input vector
\r
4783 * @param[out] pDst points to the real output vector
\r
4784 * @param[in] numSamples number of complex samples in the input vector
\r
4786 void arm_cmplx_mag_squared_q31(
\r
4789 uint32_t numSamples);
\r
4793 * @brief Q15 complex magnitude squared
\r
4794 * @param[in] pSrc points to the complex input vector
\r
4795 * @param[out] pDst points to the real output vector
\r
4796 * @param[in] numSamples number of complex samples in the input vector
\r
4798 void arm_cmplx_mag_squared_q15(
\r
4801 uint32_t numSamples);
\r
4805 * @ingroup groupController
\r
4809 * @defgroup PID PID Motor Control
\r
4811 * A Proportional Integral Derivative (PID) controller is a generic feedback control
\r
4812 * loop mechanism widely used in industrial control systems.
\r
4813 * A PID controller is the most commonly used type of feedback controller.
\r
4815 * This set of functions implements (PID) controllers
\r
4816 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
\r
4817 * of data and each call to the function returns a single processed value.
\r
4818 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
\r
4819 * is the input sample value. The functions return the output value.
\r
4823 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
\r
4824 * A0 = Kp + Ki + Kd
\r
4825 * A1 = (-Kp ) - (2 * Kd )
\r
4829 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
\r
4832 * \image html PID.gif "Proportional Integral Derivative Controller"
\r
4835 * The PID controller calculates an "error" value as the difference between
\r
4836 * the measured output and the reference input.
\r
4837 * The controller attempts to minimize the error by adjusting the process control inputs.
\r
4838 * The proportional value determines the reaction to the current error,
\r
4839 * the integral value determines the reaction based on the sum of recent errors,
\r
4840 * and the derivative value determines the reaction based on the rate at which the error has been changing.
\r
4842 * \par Instance Structure
\r
4843 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
\r
4844 * A separate instance structure must be defined for each PID Controller.
\r
4845 * There are separate instance structure declarations for each of the 3 supported data types.
\r
4847 * \par Reset Functions
\r
4848 * There is also an associated reset function for each data type which clears the state array.
\r
4850 * \par Initialization Functions
\r
4851 * There is also an associated initialization function for each data type.
\r
4852 * The initialization function performs the following operations:
\r
4853 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
\r
4854 * - Zeros out the values in the state buffer.
\r
4857 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
\r
4859 * \par Fixed-Point Behavior
\r
4860 * Care must be taken when using the fixed-point versions of the PID Controller functions.
\r
4861 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
\r
4862 * Refer to the function specific documentation below for usage guidelines.
\r
4871 * @brief Process function for the floating-point PID Control.
\r
4872 * @param[in,out] S is an instance of the floating-point PID Control structure
\r
4873 * @param[in] in input sample to process
\r
4874 * @return out processed output sample.
\r
4876 CMSIS_INLINE __STATIC_INLINE float32_t arm_pid_f32(
\r
4877 arm_pid_instance_f32 * S,
\r
4882 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
\r
4883 out = (S->A0 * in) +
\r
4884 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
\r
4886 /* Update state */
\r
4887 S->state[1] = S->state[0];
\r
4889 S->state[2] = out;
\r
4891 /* return to application */
\r
4897 * @brief Process function for the Q31 PID Control.
\r
4898 * @param[in,out] S points to an instance of the Q31 PID Control structure
\r
4899 * @param[in] in input sample to process
\r
4900 * @return out processed output sample.
\r
4902 * <b>Scaling and Overflow Behavior:</b>
\r
4904 * The function is implemented using an internal 64-bit accumulator.
\r
4905 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
\r
4906 * Thus, if the accumulator result overflows it wraps around rather than clip.
\r
4907 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
\r
4908 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
\r
4910 CMSIS_INLINE __STATIC_INLINE q31_t arm_pid_q31(
\r
4911 arm_pid_instance_q31 * S,
\r
4917 /* acc = A0 * x[n] */
\r
4918 acc = (q63_t) S->A0 * in;
\r
4920 /* acc += A1 * x[n-1] */
\r
4921 acc += (q63_t) S->A1 * S->state[0];
\r
4923 /* acc += A2 * x[n-2] */
\r
4924 acc += (q63_t) S->A2 * S->state[1];
\r
4926 /* convert output to 1.31 format to add y[n-1] */
\r
4927 out = (q31_t) (acc >> 31u);
\r
4929 /* out += y[n-1] */
\r
4930 out += S->state[2];
\r
4932 /* Update state */
\r
4933 S->state[1] = S->state[0];
\r
4935 S->state[2] = out;
\r
4937 /* return to application */
\r
4943 * @brief Process function for the Q15 PID Control.
\r
4944 * @param[in,out] S points to an instance of the Q15 PID Control structure
\r
4945 * @param[in] in input sample to process
\r
4946 * @return out processed output sample.
\r
4948 * <b>Scaling and Overflow Behavior:</b>
\r
4950 * The function is implemented using a 64-bit internal accumulator.
\r
4951 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
\r
4952 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
\r
4953 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
\r
4954 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
\r
4955 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
\r
4957 CMSIS_INLINE __STATIC_INLINE q15_t arm_pid_q15(
\r
4958 arm_pid_instance_q15 * S,
\r
4964 #if defined (ARM_MATH_DSP)
\r
4965 __SIMD32_TYPE *vstate;
\r
4967 /* Implementation of PID controller */
\r
4969 /* acc = A0 * x[n] */
\r
4970 acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
\r
4972 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
4973 vstate = __SIMD32_CONST(S->state);
\r
4974 acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc);
\r
4976 /* acc = A0 * x[n] */
\r
4977 acc = ((q31_t) S->A0) * in;
\r
4979 /* acc += A1 * x[n-1] + A2 * x[n-2] */
\r
4980 acc += (q31_t) S->A1 * S->state[0];
\r
4981 acc += (q31_t) S->A2 * S->state[1];
\r
4984 /* acc += y[n-1] */
\r
4985 acc += (q31_t) S->state[2] << 15;
\r
4987 /* saturate the output */
\r
4988 out = (q15_t) (__SSAT((acc >> 15), 16));
\r
4990 /* Update state */
\r
4991 S->state[1] = S->state[0];
\r
4993 S->state[2] = out;
\r
4995 /* return to application */
\r
5000 * @} end of PID group
\r
5005 * @brief Floating-point matrix inverse.
\r
5006 * @param[in] src points to the instance of the input floating-point matrix structure.
\r
5007 * @param[out] dst points to the instance of the output floating-point matrix structure.
\r
5008 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5009 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5011 arm_status arm_mat_inverse_f32(
\r
5012 const arm_matrix_instance_f32 * src,
\r
5013 arm_matrix_instance_f32 * dst);
\r
5017 * @brief Floating-point matrix inverse.
\r
5018 * @param[in] src points to the instance of the input floating-point matrix structure.
\r
5019 * @param[out] dst points to the instance of the output floating-point matrix structure.
\r
5020 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
\r
5021 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
\r
5023 arm_status arm_mat_inverse_f64(
\r
5024 const arm_matrix_instance_f64 * src,
\r
5025 arm_matrix_instance_f64 * dst);
\r
5030 * @ingroup groupController
\r
5034 * @defgroup clarke Vector Clarke Transform
\r
5035 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
\r
5036 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
\r
5037 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
\r
5038 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
\r
5039 * \image html clarke.gif Stator current space vector and its components in (a,b).
\r
5040 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
\r
5041 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
\r
5043 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5044 * The library provides separate functions for Q31 and floating-point data types.
\r
5046 * \image html clarkeFormula.gif
\r
5047 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
\r
5048 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
\r
5049 * \par Fixed-Point Behavior
\r
5050 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5051 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5052 * Refer to the function specific documentation below for usage guidelines.
\r
5056 * @addtogroup clarke
\r
5062 * @brief Floating-point Clarke transform
\r
5063 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5064 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5065 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
5066 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
5068 CMSIS_INLINE __STATIC_INLINE void arm_clarke_f32(
\r
5071 float32_t * pIalpha,
\r
5072 float32_t * pIbeta)
\r
5074 /* Calculate pIalpha using the equation, pIalpha = Ia */
\r
5077 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
\r
5078 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
\r
5083 * @brief Clarke transform for Q31 version
\r
5084 * @param[in] Ia input three-phase coordinate <code>a</code>
\r
5085 * @param[in] Ib input three-phase coordinate <code>b</code>
\r
5086 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
5087 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\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 addition, hence there is no risk of overflow.
\r
5095 CMSIS_INLINE __STATIC_INLINE void arm_clarke_q31(
\r
5101 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5103 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
\r
5106 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
\r
5107 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
\r
5109 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
\r
5110 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
\r
5112 /* pIbeta is calculated by adding the intermediate products */
\r
5113 *pIbeta = __QADD(product1, product2);
\r
5117 * @} end of clarke group
\r
5121 * @brief Converts the elements of the Q7 vector to Q31 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_q31(
\r
5129 uint32_t blockSize);
\r
5134 * @ingroup groupController
\r
5138 * @defgroup inv_clarke Vector Inverse Clarke Transform
\r
5139 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
\r
5141 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5142 * The library provides separate functions for Q31 and floating-point data types.
\r
5144 * \image html clarkeInvFormula.gif
\r
5145 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
\r
5146 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
\r
5147 * \par Fixed-Point Behavior
\r
5148 * Care must be taken when using the Q31 version of the Clarke transform.
\r
5149 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5150 * Refer to the function specific documentation below for usage guidelines.
\r
5154 * @addtogroup inv_clarke
\r
5159 * @brief Floating-point Inverse Clarke transform
\r
5160 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5161 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5162 * @param[out] pIa points to output three-phase coordinate <code>a</code>
\r
5163 * @param[out] pIb points to output three-phase coordinate <code>b</code>
\r
5165 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_f32(
\r
5171 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5174 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
\r
5175 *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
\r
5180 * @brief Inverse Clarke transform for Q31 version
\r
5181 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
\r
5182 * @param[in] Ibeta input two-phase orthogonal vector axis beta
\r
5183 * @param[out] pIa points to output three-phase coordinate <code>a</code>
\r
5184 * @param[out] pIb points to output three-phase coordinate <code>b</code>
\r
5186 * <b>Scaling and Overflow Behavior:</b>
\r
5188 * The function is implemented using an internal 32-bit accumulator.
\r
5189 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5190 * There is saturation on the subtraction, hence there is no risk of overflow.
\r
5192 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_q31(
\r
5198 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5200 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
\r
5203 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
\r
5204 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
\r
5206 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
\r
5207 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
\r
5209 /* pIb is calculated by subtracting the products */
\r
5210 *pIb = __QSUB(product2, product1);
\r
5214 * @} end of inv_clarke group
\r
5218 * @brief Converts the elements of the Q7 vector to Q15 vector.
\r
5219 * @param[in] pSrc input pointer
\r
5220 * @param[out] pDst output pointer
\r
5221 * @param[in] blockSize number of samples to process
\r
5223 void arm_q7_to_q15(
\r
5226 uint32_t blockSize);
\r
5231 * @ingroup groupController
\r
5235 * @defgroup park Vector Park Transform
\r
5237 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
\r
5238 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
\r
5239 * from the stationary to the moving reference frame and control the spatial relationship between
\r
5240 * the stator vector current and rotor flux vector.
\r
5241 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
\r
5242 * current vector and the relationship from the two reference frames:
\r
5243 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
\r
5245 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5246 * The library provides separate functions for Q31 and floating-point data types.
\r
5248 * \image html parkFormula.gif
\r
5249 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
\r
5250 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5251 * cosine and sine values of theta (rotor flux position).
\r
5252 * \par Fixed-Point Behavior
\r
5253 * Care must be taken when using the Q31 version of the Park transform.
\r
5254 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5255 * Refer to the function specific documentation below for usage guidelines.
\r
5259 * @addtogroup park
\r
5264 * @brief Floating-point Park transform
\r
5265 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5266 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5267 * @param[out] pId points to output rotor reference frame d
\r
5268 * @param[out] pIq points to output rotor reference frame q
\r
5269 * @param[in] sinVal sine value of rotation angle theta
\r
5270 * @param[in] cosVal cosine value of rotation angle theta
\r
5272 * The function implements the forward Park transform.
\r
5275 CMSIS_INLINE __STATIC_INLINE void arm_park_f32(
\r
5283 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
\r
5284 *pId = Ialpha * cosVal + Ibeta * sinVal;
\r
5286 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
\r
5287 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
\r
5292 * @brief Park transform for Q31 version
\r
5293 * @param[in] Ialpha input two-phase vector coordinate alpha
\r
5294 * @param[in] Ibeta input two-phase vector coordinate beta
\r
5295 * @param[out] pId points to output rotor reference frame d
\r
5296 * @param[out] pIq points to output rotor reference frame q
\r
5297 * @param[in] sinVal sine value of rotation angle theta
\r
5298 * @param[in] cosVal cosine value of rotation angle theta
\r
5300 * <b>Scaling and Overflow Behavior:</b>
\r
5302 * The function is implemented using an internal 32-bit accumulator.
\r
5303 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5304 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
\r
5306 CMSIS_INLINE __STATIC_INLINE void arm_park_q31(
\r
5314 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5315 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5317 /* Intermediate product is calculated by (Ialpha * cosVal) */
\r
5318 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
\r
5320 /* Intermediate product is calculated by (Ibeta * sinVal) */
\r
5321 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
\r
5324 /* Intermediate product is calculated by (Ialpha * sinVal) */
\r
5325 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
\r
5327 /* Intermediate product is calculated by (Ibeta * cosVal) */
\r
5328 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
\r
5330 /* Calculate pId by adding the two intermediate products 1 and 2 */
\r
5331 *pId = __QADD(product1, product2);
\r
5333 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
\r
5334 *pIq = __QSUB(product4, product3);
\r
5338 * @} end of park group
\r
5342 * @brief Converts the elements of the Q7 vector to floating-point vector.
\r
5343 * @param[in] pSrc is input pointer
\r
5344 * @param[out] pDst is output pointer
\r
5345 * @param[in] blockSize is the number of samples to process
\r
5347 void arm_q7_to_float(
\r
5350 uint32_t blockSize);
\r
5354 * @ingroup groupController
\r
5358 * @defgroup inv_park Vector Inverse Park transform
\r
5359 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
\r
5361 * The function operates on a single sample of data and each call to the function returns the processed output.
\r
5362 * The library provides separate functions for Q31 and floating-point data types.
\r
5364 * \image html parkInvFormula.gif
\r
5365 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
\r
5366 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
\r
5367 * cosine and sine values of theta (rotor flux position).
\r
5368 * \par Fixed-Point Behavior
\r
5369 * Care must be taken when using the Q31 version of the Park transform.
\r
5370 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
\r
5371 * Refer to the function specific documentation below for usage guidelines.
\r
5375 * @addtogroup inv_park
\r
5380 * @brief Floating-point Inverse Park transform
\r
5381 * @param[in] Id input coordinate of rotor reference frame d
\r
5382 * @param[in] Iq input coordinate of rotor reference frame q
\r
5383 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
5384 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
5385 * @param[in] sinVal sine value of rotation angle theta
\r
5386 * @param[in] cosVal cosine value of rotation angle theta
\r
5388 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_f32(
\r
5391 float32_t * pIalpha,
\r
5392 float32_t * pIbeta,
\r
5396 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
\r
5397 *pIalpha = Id * cosVal - Iq * sinVal;
\r
5399 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
\r
5400 *pIbeta = Id * sinVal + Iq * cosVal;
\r
5405 * @brief Inverse Park transform for Q31 version
\r
5406 * @param[in] Id input coordinate of rotor reference frame d
\r
5407 * @param[in] Iq input coordinate of rotor reference frame q
\r
5408 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
\r
5409 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
\r
5410 * @param[in] sinVal sine value of rotation angle theta
\r
5411 * @param[in] cosVal cosine value of rotation angle theta
\r
5413 * <b>Scaling and Overflow Behavior:</b>
\r
5415 * The function is implemented using an internal 32-bit accumulator.
\r
5416 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
\r
5417 * There is saturation on the addition, hence there is no risk of overflow.
\r
5419 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_q31(
\r
5427 q31_t product1, product2; /* Temporary variables used to store intermediate results */
\r
5428 q31_t product3, product4; /* Temporary variables used to store intermediate results */
\r
5430 /* Intermediate product is calculated by (Id * cosVal) */
\r
5431 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
\r
5433 /* Intermediate product is calculated by (Iq * sinVal) */
\r
5434 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
\r
5437 /* Intermediate product is calculated by (Id * sinVal) */
\r
5438 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
\r
5440 /* Intermediate product is calculated by (Iq * cosVal) */
\r
5441 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
\r
5443 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
\r
5444 *pIalpha = __QSUB(product1, product2);
\r
5446 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
\r
5447 *pIbeta = __QADD(product4, product3);
\r
5451 * @} end of Inverse park group
\r
5456 * @brief Converts the elements of the Q31 vector to floating-point vector.
\r
5457 * @param[in] pSrc is input pointer
\r
5458 * @param[out] pDst is output pointer
\r
5459 * @param[in] blockSize is the number of samples to process
\r
5461 void arm_q31_to_float(
\r
5464 uint32_t blockSize);
\r
5467 * @ingroup groupInterpolation
\r
5471 * @defgroup LinearInterpolate Linear Interpolation
\r
5473 * Linear interpolation is a method of curve fitting using linear polynomials.
\r
5474 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
\r
5477 * \image html LinearInterp.gif "Linear interpolation"
\r
5480 * A Linear Interpolate function calculates an output value(y), for the input(x)
\r
5481 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
\r
5485 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
\r
5486 * where x0, x1 are nearest values of input x
\r
5487 * y0, y1 are nearest values to output y
\r
5491 * This set of functions implements Linear interpolation process
\r
5492 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
\r
5493 * sample of data and each call to the function returns a single processed value.
\r
5494 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
\r
5495 * <code>x</code> is the input sample value. The functions returns the output value.
\r
5498 * if x is outside of the table boundary, Linear interpolation returns first value of the table
\r
5499 * if x is below input range and returns last value of table if x is above range.
\r
5503 * @addtogroup LinearInterpolate
\r
5508 * @brief Process function for the floating-point Linear Interpolation Function.
\r
5509 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
\r
5510 * @param[in] x input sample to process
\r
5511 * @return y processed output sample.
\r
5514 CMSIS_INLINE __STATIC_INLINE float32_t arm_linear_interp_f32(
\r
5515 arm_linear_interp_instance_f32 * S,
\r
5519 float32_t x0, x1; /* Nearest input values */
\r
5520 float32_t y0, y1; /* Nearest output values */
\r
5521 float32_t xSpacing = S->xSpacing; /* spacing between input values */
\r
5522 int32_t i; /* Index variable */
\r
5523 float32_t *pYData = S->pYData; /* pointer to output table */
\r
5525 /* Calculation of index */
\r
5526 i = (int32_t) ((x - S->x1) / xSpacing);
\r
5530 /* Iniatilize output for below specified range as least output value of table */
\r
5533 else if ((uint32_t)i >= S->nValues)
\r
5535 /* Iniatilize output for above specified range as last output value of table */
\r
5536 y = pYData[S->nValues - 1];
\r
5540 /* Calculation of nearest input values */
\r
5541 x0 = S->x1 + i * xSpacing;
\r
5542 x1 = S->x1 + (i + 1) * xSpacing;
\r
5544 /* Read of nearest output values */
\r
5546 y1 = pYData[i + 1];
\r
5548 /* Calculation of output */
\r
5549 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
\r
5553 /* returns output value */
\r
5560 * @brief Process function for the Q31 Linear Interpolation Function.
\r
5561 * @param[in] pYData pointer to Q31 Linear Interpolation table
\r
5562 * @param[in] x input sample to process
\r
5563 * @param[in] nValues number of table values
\r
5564 * @return y processed output sample.
\r
5567 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5568 * This function can support maximum of table size 2^12.
\r
5571 CMSIS_INLINE __STATIC_INLINE q31_t arm_linear_interp_q31(
\r
5576 q31_t y; /* output */
\r
5577 q31_t y0, y1; /* Nearest output values */
\r
5578 q31_t fract; /* fractional part */
\r
5579 int32_t index; /* Index to read nearest output values */
\r
5581 /* Input is in 12.20 format */
\r
5582 /* 12 bits for the table index */
\r
5583 /* Index value calculation */
\r
5584 index = ((x & (q31_t)0xFFF00000) >> 20);
\r
5586 if (index >= (int32_t)(nValues - 1))
\r
5588 return (pYData[nValues - 1]);
\r
5590 else if (index < 0)
\r
5592 return (pYData[0]);
\r
5596 /* 20 bits for the fractional part */
\r
5597 /* shift left by 11 to keep fract in 1.31 format */
\r
5598 fract = (x & 0x000FFFFF) << 11;
\r
5600 /* Read two nearest output values from the index in 1.31(q31) format */
\r
5601 y0 = pYData[index];
\r
5602 y1 = pYData[index + 1];
\r
5604 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
\r
5605 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
\r
5607 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
\r
5608 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
\r
5610 /* Convert y to 1.31 format */
\r
5618 * @brief Process function for the Q15 Linear Interpolation Function.
\r
5619 * @param[in] pYData pointer to Q15 Linear Interpolation table
\r
5620 * @param[in] x input sample to process
\r
5621 * @param[in] nValues number of table values
\r
5622 * @return y processed output sample.
\r
5625 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5626 * This function can support maximum of table size 2^12.
\r
5629 CMSIS_INLINE __STATIC_INLINE q15_t arm_linear_interp_q15(
\r
5634 q63_t y; /* output */
\r
5635 q15_t y0, y1; /* Nearest output values */
\r
5636 q31_t fract; /* fractional part */
\r
5637 int32_t index; /* Index to read nearest output values */
\r
5639 /* Input is in 12.20 format */
\r
5640 /* 12 bits for the table index */
\r
5641 /* Index value calculation */
\r
5642 index = ((x & (int32_t)0xFFF00000) >> 20);
\r
5644 if (index >= (int32_t)(nValues - 1))
\r
5646 return (pYData[nValues - 1]);
\r
5648 else if (index < 0)
\r
5650 return (pYData[0]);
\r
5654 /* 20 bits for the fractional part */
\r
5655 /* fract is in 12.20 format */
\r
5656 fract = (x & 0x000FFFFF);
\r
5658 /* Read two nearest output values from the index */
\r
5659 y0 = pYData[index];
\r
5660 y1 = pYData[index + 1];
\r
5662 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
\r
5663 y = ((q63_t) y0 * (0xFFFFF - fract));
\r
5665 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
\r
5666 y += ((q63_t) y1 * (fract));
\r
5668 /* convert y to 1.15 format */
\r
5669 return (q15_t) (y >> 20);
\r
5676 * @brief Process function for the Q7 Linear Interpolation Function.
\r
5677 * @param[in] pYData pointer to Q7 Linear Interpolation table
\r
5678 * @param[in] x input sample to process
\r
5679 * @param[in] nValues number of table values
\r
5680 * @return y processed output sample.
\r
5683 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
\r
5684 * This function can support maximum of table size 2^12.
\r
5686 CMSIS_INLINE __STATIC_INLINE q7_t arm_linear_interp_q7(
\r
5691 q31_t y; /* output */
\r
5692 q7_t y0, y1; /* Nearest output values */
\r
5693 q31_t fract; /* fractional part */
\r
5694 uint32_t index; /* Index to read nearest output values */
\r
5696 /* Input is in 12.20 format */
\r
5697 /* 12 bits for the table index */
\r
5698 /* Index value calculation */
\r
5701 return (pYData[0]);
\r
5703 index = (x >> 20) & 0xfff;
\r
5705 if (index >= (nValues - 1))
\r
5707 return (pYData[nValues - 1]);
\r
5711 /* 20 bits for the fractional part */
\r
5712 /* fract is in 12.20 format */
\r
5713 fract = (x & 0x000FFFFF);
\r
5715 /* Read two nearest output values from the index and are in 1.7(q7) format */
\r
5716 y0 = pYData[index];
\r
5717 y1 = pYData[index + 1];
\r
5719 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
\r
5720 y = ((y0 * (0xFFFFF - fract)));
\r
5722 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
\r
5723 y += (y1 * fract);
\r
5725 /* convert y to 1.7(q7) format */
\r
5726 return (q7_t) (y >> 20);
\r
5731 * @} end of LinearInterpolate group
\r
5735 * @brief Fast approximation to the trigonometric sine function for floating-point data.
\r
5736 * @param[in] x input value in radians.
\r
5739 float32_t arm_sin_f32(
\r
5744 * @brief Fast approximation to the trigonometric sine function for Q31 data.
\r
5745 * @param[in] x Scaled input value in radians.
\r
5748 q31_t arm_sin_q31(
\r
5753 * @brief Fast approximation to the trigonometric sine function for Q15 data.
\r
5754 * @param[in] x Scaled input value in radians.
\r
5757 q15_t arm_sin_q15(
\r
5762 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
\r
5763 * @param[in] x input value in radians.
\r
5766 float32_t arm_cos_f32(
\r
5771 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
\r
5772 * @param[in] x Scaled input value in radians.
\r
5775 q31_t arm_cos_q31(
\r
5780 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
\r
5781 * @param[in] x Scaled input value in radians.
\r
5784 q15_t arm_cos_q15(
\r
5789 * @ingroup groupFastMath
\r
5794 * @defgroup SQRT Square Root
\r
5796 * Computes the square root of a number.
\r
5797 * There are separate functions for Q15, Q31, and floating-point data types.
\r
5798 * The square root function is computed using the Newton-Raphson algorithm.
\r
5799 * This is an iterative algorithm of the form:
\r
5801 * x1 = x0 - f(x0)/f'(x0)
\r
5803 * where <code>x1</code> is the current estimate,
\r
5804 * <code>x0</code> is the previous estimate, and
\r
5805 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
\r
5806 * For the square root function, the algorithm reduces to:
\r
5808 * x0 = in/2 [initial guess]
\r
5809 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
\r
5815 * @addtogroup SQRT
\r
5820 * @brief Floating-point square root function.
\r
5821 * @param[in] in input value.
\r
5822 * @param[out] pOut square root of input value.
\r
5823 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5824 * <code>in</code> is negative value and returns zero output for negative values.
\r
5826 CMSIS_INLINE __STATIC_INLINE arm_status arm_sqrt_f32(
\r
5833 #if (__FPU_USED == 1) && defined ( __CC_ARM )
\r
5834 *pOut = __sqrtf(in);
\r
5835 #elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
\r
5836 *pOut = __builtin_sqrtf(in);
\r
5837 #elif (__FPU_USED == 1) && defined(__GNUC__)
\r
5838 *pOut = __builtin_sqrtf(in);
\r
5839 #elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
\r
5840 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
\r
5842 *pOut = sqrtf(in);
\r
5845 return (ARM_MATH_SUCCESS);
\r
5850 return (ARM_MATH_ARGUMENT_ERROR);
\r
5856 * @brief Q31 square root function.
\r
5857 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
\r
5858 * @param[out] pOut square root of input value.
\r
5859 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5860 * <code>in</code> is negative value and returns zero output for negative values.
\r
5862 arm_status arm_sqrt_q31(
\r
5868 * @brief Q15 square root function.
\r
5869 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
\r
5870 * @param[out] pOut square root of input value.
\r
5871 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
\r
5872 * <code>in</code> is negative value and returns zero output for negative values.
\r
5874 arm_status arm_sqrt_q15(
\r
5879 * @} end of SQRT group
\r
5884 * @brief floating-point Circular write function.
\r
5886 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_f32(
\r
5887 int32_t * circBuffer,
\r
5889 uint16_t * writeOffset,
\r
5890 int32_t bufferInc,
\r
5891 const int32_t * src,
\r
5893 uint32_t blockSize)
\r
5898 /* Copy the value of Index pointer that points
\r
5899 * to the current location where the input samples to be copied */
\r
5900 wOffset = *writeOffset;
\r
5902 /* Loop over the blockSize */
\r
5907 /* copy the input sample to the circular buffer */
\r
5908 circBuffer[wOffset] = *src;
\r
5910 /* Update the input pointer */
\r
5913 /* Circularly update wOffset. Watch out for positive and negative value */
\r
5914 wOffset += bufferInc;
\r
5918 /* Decrement the loop counter */
\r
5922 /* Update the index pointer */
\r
5923 *writeOffset = (uint16_t)wOffset;
\r
5929 * @brief floating-point Circular Read function.
\r
5931 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_f32(
\r
5932 int32_t * circBuffer,
\r
5934 int32_t * readOffset,
\r
5935 int32_t bufferInc,
\r
5937 int32_t * dst_base,
\r
5938 int32_t dst_length,
\r
5940 uint32_t blockSize)
\r
5943 int32_t rOffset, dst_end;
\r
5945 /* Copy the value of Index pointer that points
\r
5946 * to the current location from where the input samples to be read */
\r
5947 rOffset = *readOffset;
\r
5948 dst_end = (int32_t) (dst_base + dst_length);
\r
5950 /* Loop over the blockSize */
\r
5955 /* copy the sample from the circular buffer to the destination buffer */
\r
5956 *dst = circBuffer[rOffset];
\r
5958 /* Update the input pointer */
\r
5961 if (dst == (int32_t *) dst_end)
\r
5966 /* Circularly update rOffset. Watch out for positive and negative value */
\r
5967 rOffset += bufferInc;
\r
5974 /* Decrement the loop counter */
\r
5978 /* Update the index pointer */
\r
5979 *readOffset = rOffset;
\r
5984 * @brief Q15 Circular write function.
\r
5986 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q15(
\r
5987 q15_t * circBuffer,
\r
5989 uint16_t * writeOffset,
\r
5990 int32_t bufferInc,
\r
5991 const q15_t * src,
\r
5993 uint32_t blockSize)
\r
5998 /* Copy the value of Index pointer that points
\r
5999 * to the current location where the input samples to be copied */
\r
6000 wOffset = *writeOffset;
\r
6002 /* Loop over the blockSize */
\r
6007 /* copy the input sample to the circular buffer */
\r
6008 circBuffer[wOffset] = *src;
\r
6010 /* Update the input pointer */
\r
6013 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6014 wOffset += bufferInc;
\r
6018 /* Decrement the loop counter */
\r
6022 /* Update the index pointer */
\r
6023 *writeOffset = (uint16_t)wOffset;
\r
6028 * @brief Q15 Circular Read function.
\r
6030 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q15(
\r
6031 q15_t * circBuffer,
\r
6033 int32_t * readOffset,
\r
6034 int32_t bufferInc,
\r
6037 int32_t dst_length,
\r
6039 uint32_t blockSize)
\r
6042 int32_t rOffset, dst_end;
\r
6044 /* Copy the value of Index pointer that points
\r
6045 * to the current location from where the input samples to be read */
\r
6046 rOffset = *readOffset;
\r
6048 dst_end = (int32_t) (dst_base + dst_length);
\r
6050 /* Loop over the blockSize */
\r
6055 /* copy the sample from the circular buffer to the destination buffer */
\r
6056 *dst = circBuffer[rOffset];
\r
6058 /* Update the input pointer */
\r
6061 if (dst == (q15_t *) dst_end)
\r
6066 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6067 rOffset += bufferInc;
\r
6074 /* Decrement the loop counter */
\r
6078 /* Update the index pointer */
\r
6079 *readOffset = rOffset;
\r
6084 * @brief Q7 Circular write function.
\r
6086 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q7(
\r
6087 q7_t * circBuffer,
\r
6089 uint16_t * writeOffset,
\r
6090 int32_t bufferInc,
\r
6093 uint32_t blockSize)
\r
6098 /* Copy the value of Index pointer that points
\r
6099 * to the current location where the input samples to be copied */
\r
6100 wOffset = *writeOffset;
\r
6102 /* Loop over the blockSize */
\r
6107 /* copy the input sample to the circular buffer */
\r
6108 circBuffer[wOffset] = *src;
\r
6110 /* Update the input pointer */
\r
6113 /* Circularly update wOffset. Watch out for positive and negative value */
\r
6114 wOffset += bufferInc;
\r
6118 /* Decrement the loop counter */
\r
6122 /* Update the index pointer */
\r
6123 *writeOffset = (uint16_t)wOffset;
\r
6128 * @brief Q7 Circular Read function.
\r
6130 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q7(
\r
6131 q7_t * circBuffer,
\r
6133 int32_t * readOffset,
\r
6134 int32_t bufferInc,
\r
6137 int32_t dst_length,
\r
6139 uint32_t blockSize)
\r
6142 int32_t rOffset, dst_end;
\r
6144 /* Copy the value of Index pointer that points
\r
6145 * to the current location from where the input samples to be read */
\r
6146 rOffset = *readOffset;
\r
6148 dst_end = (int32_t) (dst_base + dst_length);
\r
6150 /* Loop over the blockSize */
\r
6155 /* copy the sample from the circular buffer to the destination buffer */
\r
6156 *dst = circBuffer[rOffset];
\r
6158 /* Update the input pointer */
\r
6161 if (dst == (q7_t *) dst_end)
\r
6166 /* Circularly update rOffset. Watch out for positive and negative value */
\r
6167 rOffset += bufferInc;
\r
6174 /* Decrement the loop counter */
\r
6178 /* Update the index pointer */
\r
6179 *readOffset = rOffset;
\r
6184 * @brief Sum of the squares of the elements of a Q31 vector.
\r
6185 * @param[in] pSrc is input pointer
\r
6186 * @param[in] blockSize is the number of samples to process
\r
6187 * @param[out] pResult is output value.
\r
6189 void arm_power_q31(
\r
6191 uint32_t blockSize,
\r
6196 * @brief Sum of the squares of the elements of a floating-point vector.
\r
6197 * @param[in] pSrc is input pointer
\r
6198 * @param[in] blockSize is the number of samples to process
\r
6199 * @param[out] pResult is output value.
\r
6201 void arm_power_f32(
\r
6203 uint32_t blockSize,
\r
6204 float32_t * pResult);
\r
6208 * @brief Sum of the squares of the elements of a Q15 vector.
\r
6209 * @param[in] pSrc is input pointer
\r
6210 * @param[in] blockSize is the number of samples to process
\r
6211 * @param[out] pResult is output value.
\r
6213 void arm_power_q15(
\r
6215 uint32_t blockSize,
\r
6220 * @brief Sum of the squares of the elements of a Q7 vector.
\r
6221 * @param[in] pSrc is input pointer
\r
6222 * @param[in] blockSize is the number of samples to process
\r
6223 * @param[out] pResult is output value.
\r
6225 void arm_power_q7(
\r
6227 uint32_t blockSize,
\r
6232 * @brief Mean value of a Q7 vector.
\r
6233 * @param[in] pSrc is input pointer
\r
6234 * @param[in] blockSize is the number of samples to process
\r
6235 * @param[out] pResult is output value.
\r
6239 uint32_t blockSize,
\r
6244 * @brief Mean value of a Q15 vector.
\r
6245 * @param[in] pSrc is input pointer
\r
6246 * @param[in] blockSize is the number of samples to process
\r
6247 * @param[out] pResult is output value.
\r
6249 void arm_mean_q15(
\r
6251 uint32_t blockSize,
\r
6256 * @brief Mean value of a Q31 vector.
\r
6257 * @param[in] pSrc is input pointer
\r
6258 * @param[in] blockSize is the number of samples to process
\r
6259 * @param[out] pResult is output value.
\r
6261 void arm_mean_q31(
\r
6263 uint32_t blockSize,
\r
6268 * @brief Mean value of a floating-point vector.
\r
6269 * @param[in] pSrc is input pointer
\r
6270 * @param[in] blockSize is the number of samples to process
\r
6271 * @param[out] pResult is output value.
\r
6273 void arm_mean_f32(
\r
6275 uint32_t blockSize,
\r
6276 float32_t * pResult);
\r
6280 * @brief Variance of the elements of a floating-point vector.
\r
6281 * @param[in] pSrc is input pointer
\r
6282 * @param[in] blockSize is the number of samples to process
\r
6283 * @param[out] pResult is output value.
\r
6287 uint32_t blockSize,
\r
6288 float32_t * pResult);
\r
6292 * @brief Variance of the elements of a Q31 vector.
\r
6293 * @param[in] pSrc is input pointer
\r
6294 * @param[in] blockSize is the number of samples to process
\r
6295 * @param[out] pResult is output value.
\r
6299 uint32_t blockSize,
\r
6304 * @brief Variance of the elements of a Q15 vector.
\r
6305 * @param[in] pSrc is input pointer
\r
6306 * @param[in] blockSize is the number of samples to process
\r
6307 * @param[out] pResult is output value.
\r
6311 uint32_t blockSize,
\r
6316 * @brief Root Mean Square of the elements of a floating-point vector.
\r
6317 * @param[in] pSrc is input pointer
\r
6318 * @param[in] blockSize is the number of samples to process
\r
6319 * @param[out] pResult is output value.
\r
6323 uint32_t blockSize,
\r
6324 float32_t * pResult);
\r
6328 * @brief Root Mean Square of the elements of a Q31 vector.
\r
6329 * @param[in] pSrc is input pointer
\r
6330 * @param[in] blockSize is the number of samples to process
\r
6331 * @param[out] pResult is output value.
\r
6335 uint32_t blockSize,
\r
6340 * @brief Root Mean Square of the elements of a Q15 vector.
\r
6341 * @param[in] pSrc is input pointer
\r
6342 * @param[in] blockSize is the number of samples to process
\r
6343 * @param[out] pResult is output value.
\r
6347 uint32_t blockSize,
\r
6352 * @brief Standard deviation of the elements of a floating-point vector.
\r
6353 * @param[in] pSrc is input pointer
\r
6354 * @param[in] blockSize is the number of samples to process
\r
6355 * @param[out] pResult is output value.
\r
6359 uint32_t blockSize,
\r
6360 float32_t * pResult);
\r
6364 * @brief Standard deviation of the elements of a Q31 vector.
\r
6365 * @param[in] pSrc is input pointer
\r
6366 * @param[in] blockSize is the number of samples to process
\r
6367 * @param[out] pResult is output value.
\r
6371 uint32_t blockSize,
\r
6376 * @brief Standard deviation of the elements of a Q15 vector.
\r
6377 * @param[in] pSrc is input pointer
\r
6378 * @param[in] blockSize is the number of samples to process
\r
6379 * @param[out] pResult is output value.
\r
6383 uint32_t blockSize,
\r
6388 * @brief Floating-point complex magnitude
\r
6389 * @param[in] pSrc points to the complex input vector
\r
6390 * @param[out] pDst points to the real output vector
\r
6391 * @param[in] numSamples number of complex samples in the input vector
\r
6393 void arm_cmplx_mag_f32(
\r
6396 uint32_t numSamples);
\r
6400 * @brief Q31 complex magnitude
\r
6401 * @param[in] pSrc points to the complex input vector
\r
6402 * @param[out] pDst points to the real output vector
\r
6403 * @param[in] numSamples number of complex samples in the input vector
\r
6405 void arm_cmplx_mag_q31(
\r
6408 uint32_t numSamples);
\r
6412 * @brief Q15 complex magnitude
\r
6413 * @param[in] pSrc points to the complex input vector
\r
6414 * @param[out] pDst points to the real output vector
\r
6415 * @param[in] numSamples number of complex samples in the input vector
\r
6417 void arm_cmplx_mag_q15(
\r
6420 uint32_t numSamples);
\r
6424 * @brief Q15 complex dot product
\r
6425 * @param[in] pSrcA points to the first input vector
\r
6426 * @param[in] pSrcB points to the second input vector
\r
6427 * @param[in] numSamples number of complex samples in each vector
\r
6428 * @param[out] realResult real part of the result returned here
\r
6429 * @param[out] imagResult imaginary part of the result returned here
\r
6431 void arm_cmplx_dot_prod_q15(
\r
6434 uint32_t numSamples,
\r
6435 q31_t * realResult,
\r
6436 q31_t * imagResult);
\r
6440 * @brief Q31 complex dot product
\r
6441 * @param[in] pSrcA points to the first input vector
\r
6442 * @param[in] pSrcB points to the second input vector
\r
6443 * @param[in] numSamples number of complex samples in each vector
\r
6444 * @param[out] realResult real part of the result returned here
\r
6445 * @param[out] imagResult imaginary part of the result returned here
\r
6447 void arm_cmplx_dot_prod_q31(
\r
6450 uint32_t numSamples,
\r
6451 q63_t * realResult,
\r
6452 q63_t * imagResult);
\r
6456 * @brief Floating-point complex dot product
\r
6457 * @param[in] pSrcA points to the first input vector
\r
6458 * @param[in] pSrcB points to the second input vector
\r
6459 * @param[in] numSamples number of complex samples in each vector
\r
6460 * @param[out] realResult real part of the result returned here
\r
6461 * @param[out] imagResult imaginary part of the result returned here
\r
6463 void arm_cmplx_dot_prod_f32(
\r
6464 float32_t * pSrcA,
\r
6465 float32_t * pSrcB,
\r
6466 uint32_t numSamples,
\r
6467 float32_t * realResult,
\r
6468 float32_t * imagResult);
\r
6472 * @brief Q15 complex-by-real multiplication
\r
6473 * @param[in] pSrcCmplx points to the complex input vector
\r
6474 * @param[in] pSrcReal points to the real input vector
\r
6475 * @param[out] pCmplxDst points to the complex output vector
\r
6476 * @param[in] numSamples number of samples in each vector
\r
6478 void arm_cmplx_mult_real_q15(
\r
6479 q15_t * pSrcCmplx,
\r
6481 q15_t * pCmplxDst,
\r
6482 uint32_t numSamples);
\r
6486 * @brief Q31 complex-by-real multiplication
\r
6487 * @param[in] pSrcCmplx points to the complex input vector
\r
6488 * @param[in] pSrcReal points to the real input vector
\r
6489 * @param[out] pCmplxDst points to the complex output vector
\r
6490 * @param[in] numSamples number of samples in each vector
\r
6492 void arm_cmplx_mult_real_q31(
\r
6493 q31_t * pSrcCmplx,
\r
6495 q31_t * pCmplxDst,
\r
6496 uint32_t numSamples);
\r
6500 * @brief Floating-point complex-by-real multiplication
\r
6501 * @param[in] pSrcCmplx points to the complex input vector
\r
6502 * @param[in] pSrcReal points to the real input vector
\r
6503 * @param[out] pCmplxDst points to the complex output vector
\r
6504 * @param[in] numSamples number of samples in each vector
\r
6506 void arm_cmplx_mult_real_f32(
\r
6507 float32_t * pSrcCmplx,
\r
6508 float32_t * pSrcReal,
\r
6509 float32_t * pCmplxDst,
\r
6510 uint32_t numSamples);
\r
6514 * @brief Minimum value of a Q7 vector.
\r
6515 * @param[in] pSrc is input pointer
\r
6516 * @param[in] blockSize is the number of samples to process
\r
6517 * @param[out] result is output pointer
\r
6518 * @param[in] index is the array index of the minimum value in the input buffer.
\r
6522 uint32_t blockSize,
\r
6524 uint32_t * index);
\r
6528 * @brief Minimum value of a Q15 vector.
\r
6529 * @param[in] pSrc is input pointer
\r
6530 * @param[in] blockSize is the number of samples to process
\r
6531 * @param[out] pResult is output pointer
\r
6532 * @param[in] pIndex is the array index of the minimum value in the input buffer.
\r
6536 uint32_t blockSize,
\r
6538 uint32_t * pIndex);
\r
6542 * @brief Minimum value of a Q31 vector.
\r
6543 * @param[in] pSrc is input pointer
\r
6544 * @param[in] blockSize is the number of samples to process
\r
6545 * @param[out] pResult is output pointer
\r
6546 * @param[out] pIndex is the array index of the minimum value in the input buffer.
\r
6550 uint32_t blockSize,
\r
6552 uint32_t * pIndex);
\r
6556 * @brief Minimum value of a floating-point vector.
\r
6557 * @param[in] pSrc is input pointer
\r
6558 * @param[in] blockSize is the number of samples to process
\r
6559 * @param[out] pResult is output pointer
\r
6560 * @param[out] pIndex is the array index of the minimum value in the input buffer.
\r
6564 uint32_t blockSize,
\r
6565 float32_t * pResult,
\r
6566 uint32_t * pIndex);
\r
6570 * @brief Maximum value of a Q7 vector.
\r
6571 * @param[in] pSrc points to the input buffer
\r
6572 * @param[in] blockSize length of the input vector
\r
6573 * @param[out] pResult maximum value returned here
\r
6574 * @param[out] pIndex index of maximum value returned here
\r
6578 uint32_t blockSize,
\r
6580 uint32_t * pIndex);
\r
6584 * @brief Maximum value of a Q15 vector.
\r
6585 * @param[in] pSrc points to the input buffer
\r
6586 * @param[in] blockSize length of the input vector
\r
6587 * @param[out] pResult maximum value returned here
\r
6588 * @param[out] pIndex index of maximum value returned here
\r
6592 uint32_t blockSize,
\r
6594 uint32_t * pIndex);
\r
6598 * @brief Maximum value of a Q31 vector.
\r
6599 * @param[in] pSrc points to the input buffer
\r
6600 * @param[in] blockSize length of the input vector
\r
6601 * @param[out] pResult maximum value returned here
\r
6602 * @param[out] pIndex index of maximum value returned here
\r
6606 uint32_t blockSize,
\r
6608 uint32_t * pIndex);
\r
6612 * @brief Maximum value of a floating-point vector.
\r
6613 * @param[in] pSrc points to the input buffer
\r
6614 * @param[in] blockSize length of the input vector
\r
6615 * @param[out] pResult maximum value returned here
\r
6616 * @param[out] pIndex index of maximum value returned here
\r
6620 uint32_t blockSize,
\r
6621 float32_t * pResult,
\r
6622 uint32_t * pIndex);
\r
6626 * @brief Q15 complex-by-complex multiplication
\r
6627 * @param[in] pSrcA points to the first input vector
\r
6628 * @param[in] pSrcB points to the second input vector
\r
6629 * @param[out] pDst points to the output vector
\r
6630 * @param[in] numSamples number of complex samples in each vector
\r
6632 void arm_cmplx_mult_cmplx_q15(
\r
6636 uint32_t numSamples);
\r
6640 * @brief Q31 complex-by-complex multiplication
\r
6641 * @param[in] pSrcA points to the first input vector
\r
6642 * @param[in] pSrcB points to the second input vector
\r
6643 * @param[out] pDst points to the output vector
\r
6644 * @param[in] numSamples number of complex samples in each vector
\r
6646 void arm_cmplx_mult_cmplx_q31(
\r
6650 uint32_t numSamples);
\r
6654 * @brief Floating-point complex-by-complex multiplication
\r
6655 * @param[in] pSrcA points to the first input vector
\r
6656 * @param[in] pSrcB points to the second input vector
\r
6657 * @param[out] pDst points to the output vector
\r
6658 * @param[in] numSamples number of complex samples in each vector
\r
6660 void arm_cmplx_mult_cmplx_f32(
\r
6661 float32_t * pSrcA,
\r
6662 float32_t * pSrcB,
\r
6664 uint32_t numSamples);
\r
6668 * @brief Converts the elements of the floating-point vector to Q31 vector.
\r
6669 * @param[in] pSrc points to the floating-point input vector
\r
6670 * @param[out] pDst points to the Q31 output vector
\r
6671 * @param[in] blockSize length of the input vector
\r
6673 void arm_float_to_q31(
\r
6676 uint32_t blockSize);
\r
6680 * @brief Converts the elements of the floating-point vector to Q15 vector.
\r
6681 * @param[in] pSrc points to the floating-point input vector
\r
6682 * @param[out] pDst points to the Q15 output vector
\r
6683 * @param[in] blockSize length of the input vector
\r
6685 void arm_float_to_q15(
\r
6688 uint32_t blockSize);
\r
6692 * @brief Converts the elements of the floating-point vector to Q7 vector.
\r
6693 * @param[in] pSrc points to the floating-point input vector
\r
6694 * @param[out] pDst points to the Q7 output vector
\r
6695 * @param[in] blockSize length of the input vector
\r
6697 void arm_float_to_q7(
\r
6700 uint32_t blockSize);
\r
6704 * @brief Converts the elements of the Q31 vector to Q15 vector.
\r
6705 * @param[in] pSrc is input pointer
\r
6706 * @param[out] pDst is output pointer
\r
6707 * @param[in] blockSize is the number of samples to process
\r
6709 void arm_q31_to_q15(
\r
6712 uint32_t blockSize);
\r
6716 * @brief Converts the elements of the Q31 vector to Q7 vector.
\r
6717 * @param[in] pSrc is input pointer
\r
6718 * @param[out] pDst is output pointer
\r
6719 * @param[in] blockSize is the number of samples to process
\r
6721 void arm_q31_to_q7(
\r
6724 uint32_t blockSize);
\r
6728 * @brief Converts the elements of the Q15 vector to floating-point vector.
\r
6729 * @param[in] pSrc is input pointer
\r
6730 * @param[out] pDst is output pointer
\r
6731 * @param[in] blockSize is the number of samples to process
\r
6733 void arm_q15_to_float(
\r
6736 uint32_t blockSize);
\r
6740 * @brief Converts the elements of the Q15 vector to Q31 vector.
\r
6741 * @param[in] pSrc is input pointer
\r
6742 * @param[out] pDst is output pointer
\r
6743 * @param[in] blockSize is the number of samples to process
\r
6745 void arm_q15_to_q31(
\r
6748 uint32_t blockSize);
\r
6752 * @brief Converts the elements of the Q15 vector to Q7 vector.
\r
6753 * @param[in] pSrc is input pointer
\r
6754 * @param[out] pDst is output pointer
\r
6755 * @param[in] blockSize is the number of samples to process
\r
6757 void arm_q15_to_q7(
\r
6760 uint32_t blockSize);
\r
6764 * @ingroup groupInterpolation
\r
6768 * @defgroup BilinearInterpolate Bilinear Interpolation
\r
6770 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
\r
6771 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
\r
6772 * determines values between the grid points.
\r
6773 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
\r
6774 * Bilinear interpolation is often used in image processing to rescale images.
\r
6775 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
\r
6777 * <b>Algorithm</b>
\r
6779 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
\r
6780 * For floating-point, the instance structure is defined as:
\r
6784 * uint16_t numRows;
\r
6785 * uint16_t numCols;
\r
6786 * float32_t *pData;
\r
6787 * } arm_bilinear_interp_instance_f32;
\r
6791 * where <code>numRows</code> specifies the number of rows in the table;
\r
6792 * <code>numCols</code> specifies the number of columns in the table;
\r
6793 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
\r
6794 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
\r
6795 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
\r
6798 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
\r
6804 * The interpolated output point is computed as:
\r
6806 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
\r
6807 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
\r
6808 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
\r
6809 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
\r
6811 * Note that the coordinates (x, y) contain integer and fractional components.
\r
6812 * The integer components specify which portion of the table to use while the
\r
6813 * fractional components control the interpolation processor.
\r
6816 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
\r
6820 * @addtogroup BilinearInterpolate
\r
6827 * @brief Floating-point bilinear interpolation.
\r
6828 * @param[in,out] S points to an instance of the interpolation structure.
\r
6829 * @param[in] X interpolation coordinate.
\r
6830 * @param[in] Y interpolation coordinate.
\r
6831 * @return out interpolated value.
\r
6833 CMSIS_INLINE __STATIC_INLINE float32_t arm_bilinear_interp_f32(
\r
6834 const arm_bilinear_interp_instance_f32 * S,
\r
6839 float32_t f00, f01, f10, f11;
\r
6840 float32_t *pData = S->pData;
\r
6841 int32_t xIndex, yIndex, index;
\r
6842 float32_t xdiff, ydiff;
\r
6843 float32_t b1, b2, b3, b4;
\r
6845 xIndex = (int32_t) X;
\r
6846 yIndex = (int32_t) Y;
\r
6848 /* Care taken for table outside boundary */
\r
6849 /* Returns zero output when values are outside table boundary */
\r
6850 if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))
\r
6855 /* Calculation of index for two nearest points in X-direction */
\r
6856 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
\r
6859 /* Read two nearest points in X-direction */
\r
6860 f00 = pData[index];
\r
6861 f01 = pData[index + 1];
\r
6863 /* Calculation of index for two nearest points in Y-direction */
\r
6864 index = (xIndex - 1) + (yIndex) * S->numCols;
\r
6867 /* Read two nearest points in Y-direction */
\r
6868 f10 = pData[index];
\r
6869 f11 = pData[index + 1];
\r
6871 /* Calculation of intermediate values */
\r
6875 b4 = f00 - f01 - f10 + f11;
\r
6877 /* Calculation of fractional part in X */
\r
6878 xdiff = X - xIndex;
\r
6880 /* Calculation of fractional part in Y */
\r
6881 ydiff = Y - yIndex;
\r
6883 /* Calculation of bi-linear interpolated output */
\r
6884 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
\r
6886 /* return to application */
\r
6893 * @brief Q31 bilinear interpolation.
\r
6894 * @param[in,out] S points to an instance of the interpolation structure.
\r
6895 * @param[in] X interpolation coordinate in 12.20 format.
\r
6896 * @param[in] Y interpolation coordinate in 12.20 format.
\r
6897 * @return out interpolated value.
\r
6899 CMSIS_INLINE __STATIC_INLINE q31_t arm_bilinear_interp_q31(
\r
6900 arm_bilinear_interp_instance_q31 * S,
\r
6904 q31_t out; /* Temporary output */
\r
6905 q31_t acc = 0; /* output */
\r
6906 q31_t xfract, yfract; /* X, Y fractional parts */
\r
6907 q31_t x1, x2, y1, y2; /* Nearest output values */
\r
6908 int32_t rI, cI; /* Row and column indices */
\r
6909 q31_t *pYData = S->pData; /* pointer to output table values */
\r
6910 uint32_t nCols = S->numCols; /* num of rows */
\r
6912 /* Input is in 12.20 format */
\r
6913 /* 12 bits for the table index */
\r
6914 /* Index value calculation */
\r
6915 rI = ((X & (q31_t)0xFFF00000) >> 20);
\r
6917 /* Input is in 12.20 format */
\r
6918 /* 12 bits for the table index */
\r
6919 /* Index value calculation */
\r
6920 cI = ((Y & (q31_t)0xFFF00000) >> 20);
\r
6922 /* Care taken for table outside boundary */
\r
6923 /* Returns zero output when values are outside table boundary */
\r
6924 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
6929 /* 20 bits for the fractional part */
\r
6930 /* shift left xfract by 11 to keep 1.31 format */
\r
6931 xfract = (X & 0x000FFFFF) << 11u;
\r
6933 /* Read two nearest output values from the index */
\r
6934 x1 = pYData[(rI) + (int32_t)nCols * (cI) ];
\r
6935 x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
\r
6937 /* 20 bits for the fractional part */
\r
6938 /* shift left yfract by 11 to keep 1.31 format */
\r
6939 yfract = (Y & 0x000FFFFF) << 11u;
\r
6941 /* Read two nearest output values from the index */
\r
6942 y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ];
\r
6943 y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
\r
6945 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
\r
6946 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
\r
6947 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
\r
6949 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
\r
6950 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
\r
6951 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
\r
6953 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
6954 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
\r
6955 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
6957 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
\r
6958 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
\r
6959 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
\r
6961 /* Convert acc to 1.31(q31) format */
\r
6962 return ((q31_t)(acc << 2));
\r
6967 * @brief Q15 bilinear interpolation.
\r
6968 * @param[in,out] S points to an instance of the interpolation structure.
\r
6969 * @param[in] X interpolation coordinate in 12.20 format.
\r
6970 * @param[in] Y interpolation coordinate in 12.20 format.
\r
6971 * @return out interpolated value.
\r
6973 CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(
\r
6974 arm_bilinear_interp_instance_q15 * S,
\r
6978 q63_t acc = 0; /* output */
\r
6979 q31_t out; /* Temporary output */
\r
6980 q15_t x1, x2, y1, y2; /* Nearest output values */
\r
6981 q31_t xfract, yfract; /* X, Y fractional parts */
\r
6982 int32_t rI, cI; /* Row and column indices */
\r
6983 q15_t *pYData = S->pData; /* pointer to output table values */
\r
6984 uint32_t nCols = S->numCols; /* num of rows */
\r
6986 /* Input is in 12.20 format */
\r
6987 /* 12 bits for the table index */
\r
6988 /* Index value calculation */
\r
6989 rI = ((X & (q31_t)0xFFF00000) >> 20);
\r
6991 /* Input is in 12.20 format */
\r
6992 /* 12 bits for the table index */
\r
6993 /* Index value calculation */
\r
6994 cI = ((Y & (q31_t)0xFFF00000) >> 20);
\r
6996 /* Care taken for table outside boundary */
\r
6997 /* Returns zero output when values are outside table boundary */
\r
6998 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7003 /* 20 bits for the fractional part */
\r
7004 /* xfract should be in 12.20 format */
\r
7005 xfract = (X & 0x000FFFFF);
\r
7007 /* Read two nearest output values from the index */
\r
7008 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
\r
7009 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
\r
7011 /* 20 bits for the fractional part */
\r
7012 /* yfract should be in 12.20 format */
\r
7013 yfract = (Y & 0x000FFFFF);
\r
7015 /* Read two nearest output values from the index */
\r
7016 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
\r
7017 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
\r
7019 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
\r
7021 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
\r
7022 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
\r
7023 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
\r
7024 acc = ((q63_t) out * (0xFFFFF - yfract));
\r
7026 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
\r
7027 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
\r
7028 acc += ((q63_t) out * (xfract));
\r
7030 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
\r
7031 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
\r
7032 acc += ((q63_t) out * (yfract));
\r
7034 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
\r
7035 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
\r
7036 acc += ((q63_t) out * (yfract));
\r
7038 /* acc is in 13.51 format and down shift acc by 36 times */
\r
7039 /* Convert out to 1.15 format */
\r
7040 return ((q15_t)(acc >> 36));
\r
7045 * @brief Q7 bilinear interpolation.
\r
7046 * @param[in,out] S points to an instance of the interpolation structure.
\r
7047 * @param[in] X interpolation coordinate in 12.20 format.
\r
7048 * @param[in] Y interpolation coordinate in 12.20 format.
\r
7049 * @return out interpolated value.
\r
7051 CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7(
\r
7052 arm_bilinear_interp_instance_q7 * S,
\r
7056 q63_t acc = 0; /* output */
\r
7057 q31_t out; /* Temporary output */
\r
7058 q31_t xfract, yfract; /* X, Y fractional parts */
\r
7059 q7_t x1, x2, y1, y2; /* Nearest output values */
\r
7060 int32_t rI, cI; /* Row and column indices */
\r
7061 q7_t *pYData = S->pData; /* pointer to output table values */
\r
7062 uint32_t nCols = S->numCols; /* num of rows */
\r
7064 /* Input is in 12.20 format */
\r
7065 /* 12 bits for the table index */
\r
7066 /* Index value calculation */
\r
7067 rI = ((X & (q31_t)0xFFF00000) >> 20);
\r
7069 /* Input is in 12.20 format */
\r
7070 /* 12 bits for the table index */
\r
7071 /* Index value calculation */
\r
7072 cI = ((Y & (q31_t)0xFFF00000) >> 20);
\r
7074 /* Care taken for table outside boundary */
\r
7075 /* Returns zero output when values are outside table boundary */
\r
7076 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
\r
7081 /* 20 bits for the fractional part */
\r
7082 /* xfract should be in 12.20 format */
\r
7083 xfract = (X & (q31_t)0x000FFFFF);
\r
7085 /* Read two nearest output values from the index */
\r
7086 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
\r
7087 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
\r
7089 /* 20 bits for the fractional part */
\r
7090 /* yfract should be in 12.20 format */
\r
7091 yfract = (Y & (q31_t)0x000FFFFF);
\r
7093 /* Read two nearest output values from the index */
\r
7094 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
\r
7095 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
\r
7097 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
\r
7098 out = ((x1 * (0xFFFFF - xfract)));
\r
7099 acc = (((q63_t) out * (0xFFFFF - yfract)));
\r
7101 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
\r
7102 out = ((x2 * (0xFFFFF - yfract)));
\r
7103 acc += (((q63_t) out * (xfract)));
\r
7105 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
\r
7106 out = ((y1 * (0xFFFFF - xfract)));
\r
7107 acc += (((q63_t) out * (yfract)));
\r
7109 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
\r
7110 out = ((y2 * (yfract)));
\r
7111 acc += (((q63_t) out * (xfract)));
\r
7113 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
\r
7114 return ((q7_t)(acc >> 40));
\r
7118 * @} end of BilinearInterpolate group
\r
7123 #define multAcc_32x32_keep32_R(a, x, y) \
\r
7124 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7127 #define multSub_32x32_keep32_R(a, x, y) \
\r
7128 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
\r
7131 #define mult_32x32_keep32_R(a, x, y) \
\r
7132 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
\r
7135 #define multAcc_32x32_keep32(a, x, y) \
\r
7136 a += (q31_t) (((q63_t) x * y) >> 32)
\r
7139 #define multSub_32x32_keep32(a, x, y) \
\r
7140 a -= (q31_t) (((q63_t) x * y) >> 32)
\r
7143 #define mult_32x32_keep32(a, x, y) \
\r
7144 a = (q31_t) (((q63_t) x * y ) >> 32)
\r
7147 #if defined ( __CC_ARM )
\r
7148 /* Enter low optimization region - place directly above function definition */
\r
7149 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
\r
7150 #define LOW_OPTIMIZATION_ENTER \
\r
7151 _Pragma ("push") \
\r
7154 #define LOW_OPTIMIZATION_ENTER
\r
7157 /* Exit low optimization region - place directly after end of function definition */
\r
7158 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
\r
7159 #define LOW_OPTIMIZATION_EXIT \
\r
7162 #define LOW_OPTIMIZATION_EXIT
\r
7165 /* Enter low optimization region - place directly above function definition */
\r
7166 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7168 /* Exit low optimization region - place directly after end of function definition */
\r
7169 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7171 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
7172 #define LOW_OPTIMIZATION_ENTER
\r
7173 #define LOW_OPTIMIZATION_EXIT
\r
7174 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7175 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7177 #elif defined ( __GNUC__ )
\r
7178 #define LOW_OPTIMIZATION_ENTER \
\r
7179 __attribute__(( optimize("-O1") ))
\r
7180 #define LOW_OPTIMIZATION_EXIT
\r
7181 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7182 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7184 #elif defined ( __ICCARM__ )
\r
7185 /* Enter low optimization region - place directly above function definition */
\r
7186 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
\r
7187 #define LOW_OPTIMIZATION_ENTER \
\r
7188 _Pragma ("optimize=low")
\r
7190 #define LOW_OPTIMIZATION_ENTER
\r
7193 /* Exit low optimization region - place directly after end of function definition */
\r
7194 #define LOW_OPTIMIZATION_EXIT
\r
7196 /* Enter low optimization region - place directly above function definition */
\r
7197 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
\r
7198 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
\r
7199 _Pragma ("optimize=low")
\r
7201 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7204 /* Exit low optimization region - place directly after end of function definition */
\r
7205 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7207 #elif defined ( __TI_ARM__ )
\r
7208 #define LOW_OPTIMIZATION_ENTER
\r
7209 #define LOW_OPTIMIZATION_EXIT
\r
7210 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7211 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7213 #elif defined ( __CSMC__ )
\r
7214 #define LOW_OPTIMIZATION_ENTER
\r
7215 #define LOW_OPTIMIZATION_EXIT
\r
7216 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7217 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7219 #elif defined ( __TASKING__ )
\r
7220 #define LOW_OPTIMIZATION_ENTER
\r
7221 #define LOW_OPTIMIZATION_EXIT
\r
7222 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
\r
7223 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
\r
7228 #ifdef __cplusplus
\r
7232 /* Compiler specific diagnostic adjustment */
\r
7233 #if defined ( __CC_ARM )
\r
7235 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
\r
7237 #elif defined ( __GNUC__ )
\r
7238 #pragma GCC diagnostic pop
\r
7240 #elif defined ( __ICCARM__ )
\r
7242 #elif defined ( __TI_ARM__ )
\r
7244 #elif defined ( __CSMC__ )
\r
7246 #elif defined ( __TASKING__ )
\r
7249 #error Unknown compiler
\r
7252 #endif /* _ARM_MATH_H */
\r