[136] | 1 | /* ----------------------------------------------------------------------
|
---|
| 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
---|
| 3 | *
|
---|
| 4 | * $Date: 20. February 2014
|
---|
| 5 | * $Revision: V1.4.2
|
---|
| 6 | *
|
---|
| 7 | * Project: CMSIS DSP Library
|
---|
| 8 | * Title: arm_math.h
|
---|
| 9 | *
|
---|
| 10 | * Description: Public header file for CMSIS DSP Library
|
---|
| 11 | *
|
---|
| 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
---|
| 13 | *
|
---|
| 14 | * Redistribution and use in source and binary forms, with or without
|
---|
| 15 | * modification, are permitted provided that the following conditions
|
---|
| 16 | * are met:
|
---|
| 17 | * - Redistributions of source code must retain the above copyright
|
---|
| 18 | * notice, this list of conditions and the following disclaimer.
|
---|
| 19 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 20 | * notice, this list of conditions and the following disclaimer in
|
---|
| 21 | * the documentation and/or other materials provided with the
|
---|
| 22 | * distribution.
|
---|
| 23 | * - Neither the name of ARM LIMITED nor the names of its contributors
|
---|
| 24 | * may be used to endorse or promote products derived from this
|
---|
| 25 | * software without specific prior written permission.
|
---|
| 26 | *
|
---|
| 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
| 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
| 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
| 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
| 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
| 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
| 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
| 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
| 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
| 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
| 38 | * POSSIBILITY OF SUCH DAMAGE.
|
---|
| 39 | * -------------------------------------------------------------------- */
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | \mainpage CMSIS DSP Software Library
|
---|
| 43 | *
|
---|
| 44 | * <b>Introduction</b>
|
---|
| 45 | *
|
---|
| 46 | * This user manual describes the CMSIS DSP software library,
|
---|
| 47 | * a suite of common signal processing functions for use on Cortex-M processor based devices.
|
---|
| 48 | *
|
---|
| 49 | * The library is divided into a number of functions each covering a specific category:
|
---|
| 50 | * - Basic math functions
|
---|
| 51 | * - Fast math functions
|
---|
| 52 | * - Complex math functions
|
---|
| 53 | * - Filters
|
---|
| 54 | * - Matrix functions
|
---|
| 55 | * - Transforms
|
---|
| 56 | * - Motor control functions
|
---|
| 57 | * - Statistical functions
|
---|
| 58 | * - Support functions
|
---|
| 59 | * - Interpolation functions
|
---|
| 60 | *
|
---|
| 61 | * The library has separate functions for operating on 8-bit integers, 16-bit integers,
|
---|
| 62 | * 32-bit integer and 32-bit floating-point values.
|
---|
| 63 | *
|
---|
| 64 | * <b>Using the Library</b>
|
---|
| 65 | *
|
---|
| 66 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
|
---|
| 67 | * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
|
---|
| 68 | * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
|
---|
| 69 | * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
|
---|
| 70 | * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
|
---|
| 71 | * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
|
---|
| 72 | * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
|
---|
| 73 | * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
|
---|
| 74 | * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
|
---|
| 75 | *
|
---|
| 76 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
|
---|
| 77 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
|
---|
| 78 | * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
|
---|
| 79 | * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
|
---|
| 80 | * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
|
---|
| 81 | *
|
---|
| 82 | * <b>Examples</b>
|
---|
| 83 | *
|
---|
| 84 | * The library ships with a number of examples which demonstrate how to use the library functions.
|
---|
| 85 | *
|
---|
| 86 | * <b>Toolchain Support</b>
|
---|
| 87 | *
|
---|
| 88 | * The library has been developed and tested with MDK-ARM version 4.60.
|
---|
| 89 | * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
|
---|
| 90 | *
|
---|
| 91 | * <b>Building the Library</b>
|
---|
| 92 | *
|
---|
| 93 | * 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.
|
---|
| 94 | * - arm_cortexM_math.uvproj
|
---|
| 95 | *
|
---|
| 96 | *
|
---|
| 97 | * The libraries can be built by opening the arm_cortexM_math.uvproj project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
|
---|
| 98 | *
|
---|
| 99 | * <b>Pre-processor Macros</b>
|
---|
| 100 | *
|
---|
| 101 | * Each library project have differant pre-processor macros.
|
---|
| 102 | *
|
---|
| 103 | * - UNALIGNED_SUPPORT_DISABLE:
|
---|
| 104 | *
|
---|
| 105 | * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
|
---|
| 106 | *
|
---|
| 107 | * - ARM_MATH_BIG_ENDIAN:
|
---|
| 108 | *
|
---|
| 109 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
|
---|
| 110 | *
|
---|
| 111 | * - ARM_MATH_MATRIX_CHECK:
|
---|
| 112 | *
|
---|
| 113 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
|
---|
| 114 | *
|
---|
| 115 | * - ARM_MATH_ROUNDING:
|
---|
| 116 | *
|
---|
| 117 | * Define macro ARM_MATH_ROUNDING for rounding on support functions
|
---|
| 118 | *
|
---|
| 119 | * - ARM_MATH_CMx:
|
---|
| 120 | *
|
---|
| 121 | * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
|
---|
| 122 | * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target.
|
---|
| 123 | *
|
---|
| 124 | * - __FPU_PRESENT:
|
---|
| 125 | *
|
---|
| 126 | * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
|
---|
| 127 | *
|
---|
| 128 | * <b>Copyright Notice</b>
|
---|
| 129 | *
|
---|
| 130 | * Copyright (C) 2010-2013 ARM Limited. All rights reserved.
|
---|
| 131 | */
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 | /**
|
---|
| 135 | * @defgroup groupMath Basic Math Functions
|
---|
| 136 | */
|
---|
| 137 |
|
---|
| 138 | /**
|
---|
| 139 | * @defgroup groupFastMath Fast Math Functions
|
---|
| 140 | * This set of functions provides a fast approximation to sine, cosine, and square root.
|
---|
| 141 | * As compared to most of the other functions in the CMSIS math library, the fast math functions
|
---|
| 142 | * operate on individual values and not arrays.
|
---|
| 143 | * There are separate functions for Q15, Q31, and floating-point data.
|
---|
| 144 | *
|
---|
| 145 | */
|
---|
| 146 |
|
---|
| 147 | /**
|
---|
| 148 | * @defgroup groupCmplxMath Complex Math Functions
|
---|
| 149 | * This set of functions operates on complex data vectors.
|
---|
| 150 | * The data in the complex arrays is stored in an interleaved fashion
|
---|
| 151 | * (real, imag, real, imag, ...).
|
---|
| 152 | * In the API functions, the number of samples in a complex array refers
|
---|
| 153 | * to the number of complex values; the array contains twice this number of
|
---|
| 154 | * real values.
|
---|
| 155 | */
|
---|
| 156 |
|
---|
| 157 | /**
|
---|
| 158 | * @defgroup groupFilters Filtering Functions
|
---|
| 159 | */
|
---|
| 160 |
|
---|
| 161 | /**
|
---|
| 162 | * @defgroup groupMatrix Matrix Functions
|
---|
| 163 | *
|
---|
| 164 | * This set of functions provides basic matrix math operations.
|
---|
| 165 | * The functions operate on matrix data structures. For example,
|
---|
| 166 | * the type
|
---|
| 167 | * definition for the floating-point matrix structure is shown
|
---|
| 168 | * below:
|
---|
| 169 | * <pre>
|
---|
| 170 | * typedef struct
|
---|
| 171 | * {
|
---|
| 172 | * uint16_t numRows; // number of rows of the matrix.
|
---|
| 173 | * uint16_t numCols; // number of columns of the matrix.
|
---|
| 174 | * float32_t *pData; // points to the data of the matrix.
|
---|
| 175 | * } arm_matrix_instance_f32;
|
---|
| 176 | * </pre>
|
---|
| 177 | * There are similar definitions for Q15 and Q31 data types.
|
---|
| 178 | *
|
---|
| 179 | * The structure specifies the size of the matrix and then points to
|
---|
| 180 | * an array of data. The array is of size <code>numRows X numCols</code>
|
---|
| 181 | * and the values are arranged in row order. That is, the
|
---|
| 182 | * matrix element (i, j) is stored at:
|
---|
| 183 | * <pre>
|
---|
| 184 | * pData[i*numCols + j]
|
---|
| 185 | * </pre>
|
---|
| 186 | *
|
---|
| 187 | * \par Init Functions
|
---|
| 188 | * There is an associated initialization function for each type of matrix
|
---|
| 189 | * data structure.
|
---|
| 190 | * The initialization function sets the values of the internal structure fields.
|
---|
| 191 | * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
|
---|
| 192 | * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
|
---|
| 193 | *
|
---|
| 194 | * \par
|
---|
| 195 | * Use of the initialization function is optional. However, if initialization function is used
|
---|
| 196 | * then the instance structure cannot be placed into a const data section.
|
---|
| 197 | * To place the instance structure in a const data
|
---|
| 198 | * section, manually initialize the data structure. For example:
|
---|
| 199 | * <pre>
|
---|
| 200 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
|
---|
| 201 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
|
---|
| 202 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
|
---|
| 203 | * </pre>
|
---|
| 204 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
|
---|
| 205 | * specifies the number of columns, and <code>pData</code> points to the
|
---|
| 206 | * data array.
|
---|
| 207 | *
|
---|
| 208 | * \par Size Checking
|
---|
| 209 | * By default all of the matrix functions perform size checking on the input and
|
---|
| 210 | * output matrices. For example, the matrix addition function verifies that the
|
---|
| 211 | * two input matrices and the output matrix all have the same number of rows and
|
---|
| 212 | * columns. If the size check fails the functions return:
|
---|
| 213 | * <pre>
|
---|
| 214 | * ARM_MATH_SIZE_MISMATCH
|
---|
| 215 | * </pre>
|
---|
| 216 | * Otherwise the functions return
|
---|
| 217 | * <pre>
|
---|
| 218 | * ARM_MATH_SUCCESS
|
---|
| 219 | * </pre>
|
---|
| 220 | * There is some overhead associated with this matrix size checking.
|
---|
| 221 | * The matrix size checking is enabled via the \#define
|
---|
| 222 | * <pre>
|
---|
| 223 | * ARM_MATH_MATRIX_CHECK
|
---|
| 224 | * </pre>
|
---|
| 225 | * within the library project settings. By default this macro is defined
|
---|
| 226 | * and size checking is enabled. By changing the project settings and
|
---|
| 227 | * undefining this macro size checking is eliminated and the functions
|
---|
| 228 | * run a bit faster. With size checking disabled the functions always
|
---|
| 229 | * return <code>ARM_MATH_SUCCESS</code>.
|
---|
| 230 | */
|
---|
| 231 |
|
---|
| 232 | /**
|
---|
| 233 | * @defgroup groupTransforms Transform Functions
|
---|
| 234 | */
|
---|
| 235 |
|
---|
| 236 | /**
|
---|
| 237 | * @defgroup groupController Controller Functions
|
---|
| 238 | */
|
---|
| 239 |
|
---|
| 240 | /**
|
---|
| 241 | * @defgroup groupStats Statistics Functions
|
---|
| 242 | */
|
---|
| 243 | /**
|
---|
| 244 | * @defgroup groupSupport Support Functions
|
---|
| 245 | */
|
---|
| 246 |
|
---|
| 247 | /**
|
---|
| 248 | * @defgroup groupInterpolation Interpolation Functions
|
---|
| 249 | * These functions perform 1- and 2-dimensional interpolation of data.
|
---|
| 250 | * Linear interpolation is used for 1-dimensional data and
|
---|
| 251 | * bilinear interpolation is used for 2-dimensional data.
|
---|
| 252 | */
|
---|
| 253 |
|
---|
| 254 | /**
|
---|
| 255 | * @defgroup groupExamples Examples
|
---|
| 256 | */
|
---|
| 257 | #ifndef _ARM_MATH_H
|
---|
| 258 | #define _ARM_MATH_H
|
---|
| 259 |
|
---|
| 260 | #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
|
---|
| 261 |
|
---|
| 262 | #if defined (ARM_MATH_CM4)
|
---|
| 263 | #include "core_cm4.h"
|
---|
| 264 | #elif defined (ARM_MATH_CM3)
|
---|
| 265 | #include "core_cm3.h"
|
---|
| 266 | #elif defined (ARM_MATH_CM0)
|
---|
| 267 | #include "core_cm0.h"
|
---|
| 268 | #define ARM_MATH_CM0_FAMILY
|
---|
| 269 | #elif defined (ARM_MATH_CM0PLUS)
|
---|
| 270 | #include "core_cm0plus.h"
|
---|
| 271 | #define ARM_MATH_CM0_FAMILY
|
---|
| 272 | #else
|
---|
| 273 | #include "ARMCM4.h"
|
---|
| 274 | #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
|
---|
| 275 | #endif
|
---|
| 276 |
|
---|
| 277 | #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
|
---|
| 278 | #include "string.h"
|
---|
| 279 | #include "math.h"
|
---|
| 280 | #ifdef __cplusplus
|
---|
| 281 | extern "C"
|
---|
| 282 | {
|
---|
| 283 | #endif
|
---|
| 284 |
|
---|
| 285 |
|
---|
| 286 | /**
|
---|
| 287 | * @brief Macros required for reciprocal calculation in Normalized LMS
|
---|
| 288 | */
|
---|
| 289 |
|
---|
| 290 | #define DELTA_Q31 (0x100)
|
---|
| 291 | #define DELTA_Q15 0x5
|
---|
| 292 | #define INDEX_MASK 0x0000003F
|
---|
| 293 | #ifndef PI
|
---|
| 294 | #define PI 3.14159265358979f
|
---|
| 295 | #endif
|
---|
| 296 |
|
---|
| 297 | /**
|
---|
| 298 | * @brief Macros required for SINE and COSINE Fast math approximations
|
---|
| 299 | */
|
---|
| 300 |
|
---|
| 301 | #define FAST_MATH_TABLE_SIZE 512
|
---|
| 302 | #define FAST_MATH_Q31_SHIFT (32 - 10)
|
---|
| 303 | #define FAST_MATH_Q15_SHIFT (16 - 10)
|
---|
| 304 | #define CONTROLLER_Q31_SHIFT (32 - 9)
|
---|
| 305 | #define TABLE_SIZE 256
|
---|
| 306 | #define TABLE_SPACING_Q31 0x400000
|
---|
| 307 | #define TABLE_SPACING_Q15 0x80
|
---|
| 308 |
|
---|
| 309 | /**
|
---|
| 310 | * @brief Macros required for SINE and COSINE Controller functions
|
---|
| 311 | */
|
---|
| 312 | /* 1.31(q31) Fixed value of 2/360 */
|
---|
| 313 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
|
---|
| 314 | #define INPUT_SPACING 0xB60B61
|
---|
| 315 |
|
---|
| 316 | /**
|
---|
| 317 | * @brief Macro for Unaligned Support
|
---|
| 318 | */
|
---|
| 319 | #ifndef UNALIGNED_SUPPORT_DISABLE
|
---|
| 320 | #define ALIGN4
|
---|
| 321 | #else
|
---|
| 322 | #if defined (__GNUC__)
|
---|
| 323 | #define ALIGN4 __attribute__((aligned(4)))
|
---|
| 324 | #else
|
---|
| 325 | #define ALIGN4 __align(4)
|
---|
| 326 | #endif
|
---|
| 327 | #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
|
---|
| 328 |
|
---|
| 329 | /**
|
---|
| 330 | * @brief Error status returned by some functions in the library.
|
---|
| 331 | */
|
---|
| 332 |
|
---|
| 333 | typedef enum
|
---|
| 334 | {
|
---|
| 335 | ARM_MATH_SUCCESS = 0, /**< No error */
|
---|
| 336 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
|
---|
| 337 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
|
---|
| 338 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
|
---|
| 339 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
|
---|
| 340 | ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
|
---|
| 341 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
|
---|
| 342 | } arm_status;
|
---|
| 343 |
|
---|
| 344 | /**
|
---|
| 345 | * @brief 8-bit fractional data type in 1.7 format.
|
---|
| 346 | */
|
---|
| 347 | typedef int8_t q7_t;
|
---|
| 348 |
|
---|
| 349 | /**
|
---|
| 350 | * @brief 16-bit fractional data type in 1.15 format.
|
---|
| 351 | */
|
---|
| 352 | typedef int16_t q15_t;
|
---|
| 353 |
|
---|
| 354 | /**
|
---|
| 355 | * @brief 32-bit fractional data type in 1.31 format.
|
---|
| 356 | */
|
---|
| 357 | typedef int32_t q31_t;
|
---|
| 358 |
|
---|
| 359 | /**
|
---|
| 360 | * @brief 64-bit fractional data type in 1.63 format.
|
---|
| 361 | */
|
---|
| 362 | typedef int64_t q63_t;
|
---|
| 363 |
|
---|
| 364 | /**
|
---|
| 365 | * @brief 32-bit floating-point type definition.
|
---|
| 366 | */
|
---|
| 367 | typedef float float32_t;
|
---|
| 368 |
|
---|
| 369 | /**
|
---|
| 370 | * @brief 64-bit floating-point type definition.
|
---|
| 371 | */
|
---|
| 372 | typedef double float64_t;
|
---|
| 373 |
|
---|
| 374 | /**
|
---|
| 375 | * @brief definition to read/write two 16 bit values.
|
---|
| 376 | */
|
---|
| 377 | #if defined __CC_ARM
|
---|
| 378 | #define __SIMD32_TYPE int32_t __packed
|
---|
| 379 | #define CMSIS_UNUSED __attribute__((unused))
|
---|
| 380 | #elif defined __ICCARM__
|
---|
| 381 | #define CMSIS_UNUSED
|
---|
| 382 | #define __SIMD32_TYPE int32_t __packed
|
---|
| 383 | #elif defined __GNUC__
|
---|
| 384 | #define __SIMD32_TYPE int32_t
|
---|
| 385 | #define CMSIS_UNUSED __attribute__((unused))
|
---|
| 386 | #elif defined __CSMC__ /* Cosmic */
|
---|
| 387 | #define CMSIS_UNUSED
|
---|
| 388 | #define __SIMD32_TYPE int32_t
|
---|
| 389 | #else
|
---|
| 390 | #error Unknown compiler
|
---|
| 391 | #endif
|
---|
| 392 |
|
---|
| 393 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
|
---|
| 394 | #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
|
---|
| 395 |
|
---|
| 396 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
|
---|
| 397 |
|
---|
| 398 | #define __SIMD64(addr) (*(int64_t **) & (addr))
|
---|
| 399 |
|
---|
| 400 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
|
---|
| 401 | /**
|
---|
| 402 | * @brief definition to pack two 16 bit values.
|
---|
| 403 | */
|
---|
| 404 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
|
---|
| 405 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
|
---|
| 406 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
|
---|
| 407 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
|
---|
| 408 |
|
---|
| 409 | #endif
|
---|
| 410 |
|
---|
| 411 |
|
---|
| 412 | /**
|
---|
| 413 | * @brief definition to pack four 8 bit values.
|
---|
| 414 | */
|
---|
| 415 | #ifndef ARM_MATH_BIG_ENDIAN
|
---|
| 416 |
|
---|
| 417 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
|
---|
| 418 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
|
---|
| 419 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
|
---|
| 420 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
|
---|
| 421 | #else
|
---|
| 422 |
|
---|
| 423 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
|
---|
| 424 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
|
---|
| 425 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
|
---|
| 426 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
|
---|
| 427 |
|
---|
| 428 | #endif
|
---|
| 429 |
|
---|
| 430 |
|
---|
| 431 | /**
|
---|
| 432 | * @brief Clips Q63 to Q31 values.
|
---|
| 433 | */
|
---|
| 434 | static __INLINE q31_t clip_q63_to_q31(
|
---|
| 435 | q63_t x)
|
---|
| 436 | {
|
---|
| 437 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
|
---|
| 438 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | /**
|
---|
| 442 | * @brief Clips Q63 to Q15 values.
|
---|
| 443 | */
|
---|
| 444 | static __INLINE q15_t clip_q63_to_q15(
|
---|
| 445 | q63_t x)
|
---|
| 446 | {
|
---|
| 447 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
|
---|
| 448 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
|
---|
| 449 | }
|
---|
| 450 |
|
---|
| 451 | /**
|
---|
| 452 | * @brief Clips Q31 to Q7 values.
|
---|
| 453 | */
|
---|
| 454 | static __INLINE q7_t clip_q31_to_q7(
|
---|
| 455 | q31_t x)
|
---|
| 456 | {
|
---|
| 457 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
|
---|
| 458 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
|
---|
| 459 | }
|
---|
| 460 |
|
---|
| 461 | /**
|
---|
| 462 | * @brief Clips Q31 to Q15 values.
|
---|
| 463 | */
|
---|
| 464 | static __INLINE q15_t clip_q31_to_q15(
|
---|
| 465 | q31_t x)
|
---|
| 466 | {
|
---|
| 467 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
|
---|
| 468 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
|
---|
| 469 | }
|
---|
| 470 |
|
---|
| 471 | /**
|
---|
| 472 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
|
---|
| 473 | */
|
---|
| 474 |
|
---|
| 475 | static __INLINE q63_t mult32x64(
|
---|
| 476 | q63_t x,
|
---|
| 477 | q31_t y)
|
---|
| 478 | {
|
---|
| 479 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
|
---|
| 480 | (((q63_t) (x >> 32) * y)));
|
---|
| 481 | }
|
---|
| 482 |
|
---|
| 483 |
|
---|
| 484 | #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
|
---|
| 485 | #define __CLZ __clz
|
---|
| 486 | #endif
|
---|
| 487 |
|
---|
| 488 | #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
|
---|
| 489 |
|
---|
| 490 | static __INLINE uint32_t __CLZ(
|
---|
| 491 | q31_t data);
|
---|
| 492 |
|
---|
| 493 |
|
---|
| 494 | static __INLINE uint32_t __CLZ(
|
---|
| 495 | q31_t data)
|
---|
| 496 | {
|
---|
| 497 | uint32_t count = 0;
|
---|
| 498 | uint32_t mask = 0x80000000;
|
---|
| 499 |
|
---|
| 500 | while((data & mask) == 0)
|
---|
| 501 | {
|
---|
| 502 | count += 1u;
|
---|
| 503 | mask = mask >> 1u;
|
---|
| 504 | }
|
---|
| 505 |
|
---|
| 506 | return (count);
|
---|
| 507 |
|
---|
| 508 | }
|
---|
| 509 |
|
---|
| 510 | #endif
|
---|
| 511 |
|
---|
| 512 | /**
|
---|
| 513 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
|
---|
| 514 | */
|
---|
| 515 |
|
---|
| 516 | static __INLINE uint32_t arm_recip_q31(
|
---|
| 517 | q31_t in,
|
---|
| 518 | q31_t * dst,
|
---|
| 519 | q31_t * pRecipTable)
|
---|
| 520 | {
|
---|
| 521 |
|
---|
| 522 | uint32_t out, tempVal;
|
---|
| 523 | uint32_t index, i;
|
---|
| 524 | uint32_t signBits;
|
---|
| 525 |
|
---|
| 526 | if(in > 0)
|
---|
| 527 | {
|
---|
| 528 | signBits = __CLZ(in) - 1;
|
---|
| 529 | }
|
---|
| 530 | else
|
---|
| 531 | {
|
---|
| 532 | signBits = __CLZ(-in) - 1;
|
---|
| 533 | }
|
---|
| 534 |
|
---|
| 535 | /* Convert input sample to 1.31 format */
|
---|
| 536 | in = in << signBits;
|
---|
| 537 |
|
---|
| 538 | /* calculation of index for initial approximated Val */
|
---|
| 539 | index = (uint32_t) (in >> 24u);
|
---|
| 540 | index = (index & INDEX_MASK);
|
---|
| 541 |
|
---|
| 542 | /* 1.31 with exp 1 */
|
---|
| 543 | out = pRecipTable[index];
|
---|
| 544 |
|
---|
| 545 | /* calculation of reciprocal value */
|
---|
| 546 | /* running approximation for two iterations */
|
---|
| 547 | for (i = 0u; i < 2u; i++)
|
---|
| 548 | {
|
---|
| 549 | tempVal = (q31_t) (((q63_t) in * out) >> 31u);
|
---|
| 550 | tempVal = 0x7FFFFFFF - tempVal;
|
---|
| 551 | /* 1.31 with exp 1 */
|
---|
| 552 | //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
|
---|
| 553 | out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
|
---|
| 554 | }
|
---|
| 555 |
|
---|
| 556 | /* write output */
|
---|
| 557 | *dst = out;
|
---|
| 558 |
|
---|
| 559 | /* return num of signbits of out = 1/in value */
|
---|
| 560 | return (signBits + 1u);
|
---|
| 561 |
|
---|
| 562 | }
|
---|
| 563 |
|
---|
| 564 | /**
|
---|
| 565 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
|
---|
| 566 | */
|
---|
| 567 | static __INLINE uint32_t arm_recip_q15(
|
---|
| 568 | q15_t in,
|
---|
| 569 | q15_t * dst,
|
---|
| 570 | q15_t * pRecipTable)
|
---|
| 571 | {
|
---|
| 572 |
|
---|
| 573 | uint32_t out = 0, tempVal = 0;
|
---|
| 574 | uint32_t index = 0, i = 0;
|
---|
| 575 | uint32_t signBits = 0;
|
---|
| 576 |
|
---|
| 577 | if(in > 0)
|
---|
| 578 | {
|
---|
| 579 | signBits = __CLZ(in) - 17;
|
---|
| 580 | }
|
---|
| 581 | else
|
---|
| 582 | {
|
---|
| 583 | signBits = __CLZ(-in) - 17;
|
---|
| 584 | }
|
---|
| 585 |
|
---|
| 586 | /* Convert input sample to 1.15 format */
|
---|
| 587 | in = in << signBits;
|
---|
| 588 |
|
---|
| 589 | /* calculation of index for initial approximated Val */
|
---|
| 590 | index = in >> 8;
|
---|
| 591 | index = (index & INDEX_MASK);
|
---|
| 592 |
|
---|
| 593 | /* 1.15 with exp 1 */
|
---|
| 594 | out = pRecipTable[index];
|
---|
| 595 |
|
---|
| 596 | /* calculation of reciprocal value */
|
---|
| 597 | /* running approximation for two iterations */
|
---|
| 598 | for (i = 0; i < 2; i++)
|
---|
| 599 | {
|
---|
| 600 | tempVal = (q15_t) (((q31_t) in * out) >> 15);
|
---|
| 601 | tempVal = 0x7FFF - tempVal;
|
---|
| 602 | /* 1.15 with exp 1 */
|
---|
| 603 | out = (q15_t) (((q31_t) out * tempVal) >> 14);
|
---|
| 604 | }
|
---|
| 605 |
|
---|
| 606 | /* write output */
|
---|
| 607 | *dst = out;
|
---|
| 608 |
|
---|
| 609 | /* return num of signbits of out = 1/in value */
|
---|
| 610 | return (signBits + 1);
|
---|
| 611 |
|
---|
| 612 | }
|
---|
| 613 |
|
---|
| 614 |
|
---|
| 615 | /*
|
---|
| 616 | * @brief C custom defined intrinisic function for only M0 processors
|
---|
| 617 | */
|
---|
| 618 | #if defined(ARM_MATH_CM0_FAMILY)
|
---|
| 619 |
|
---|
| 620 | static __INLINE q31_t __SSAT(
|
---|
| 621 | q31_t x,
|
---|
| 622 | uint32_t y)
|
---|
| 623 | {
|
---|
| 624 | int32_t posMax, negMin;
|
---|
| 625 | uint32_t i;
|
---|
| 626 |
|
---|
| 627 | posMax = 1;
|
---|
| 628 | for (i = 0; i < (y - 1); i++)
|
---|
| 629 | {
|
---|
| 630 | posMax = posMax * 2;
|
---|
| 631 | }
|
---|
| 632 |
|
---|
| 633 | if(x > 0)
|
---|
| 634 | {
|
---|
| 635 | posMax = (posMax - 1);
|
---|
| 636 |
|
---|
| 637 | if(x > posMax)
|
---|
| 638 | {
|
---|
| 639 | x = posMax;
|
---|
| 640 | }
|
---|
| 641 | }
|
---|
| 642 | else
|
---|
| 643 | {
|
---|
| 644 | negMin = -posMax;
|
---|
| 645 |
|
---|
| 646 | if(x < negMin)
|
---|
| 647 | {
|
---|
| 648 | x = negMin;
|
---|
| 649 | }
|
---|
| 650 | }
|
---|
| 651 | return (x);
|
---|
| 652 |
|
---|
| 653 |
|
---|
| 654 | }
|
---|
| 655 |
|
---|
| 656 | #endif /* end of ARM_MATH_CM0_FAMILY */
|
---|
| 657 |
|
---|
| 658 |
|
---|
| 659 |
|
---|
| 660 | /*
|
---|
| 661 | * @brief C custom defined intrinsic function for M3 and M0 processors
|
---|
| 662 | */
|
---|
| 663 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
|
---|
| 664 |
|
---|
| 665 | /*
|
---|
| 666 | * @brief C custom defined QADD8 for M3 and M0 processors
|
---|
| 667 | */
|
---|
| 668 | static __INLINE q31_t __QADD8(
|
---|
| 669 | q31_t x,
|
---|
| 670 | q31_t y)
|
---|
| 671 | {
|
---|
| 672 |
|
---|
| 673 | q31_t sum;
|
---|
| 674 | q7_t r, s, t, u;
|
---|
| 675 |
|
---|
| 676 | r = (q7_t) x;
|
---|
| 677 | s = (q7_t) y;
|
---|
| 678 |
|
---|
| 679 | r = __SSAT((q31_t) (r + s), 8);
|
---|
| 680 | s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
|
---|
| 681 | t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
|
---|
| 682 | u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
|
---|
| 683 |
|
---|
| 684 | sum =
|
---|
| 685 | (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
|
---|
| 686 | (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
|
---|
| 687 |
|
---|
| 688 | return sum;
|
---|
| 689 |
|
---|
| 690 | }
|
---|
| 691 |
|
---|
| 692 | /*
|
---|
| 693 | * @brief C custom defined QSUB8 for M3 and M0 processors
|
---|
| 694 | */
|
---|
| 695 | static __INLINE q31_t __QSUB8(
|
---|
| 696 | q31_t x,
|
---|
| 697 | q31_t y)
|
---|
| 698 | {
|
---|
| 699 |
|
---|
| 700 | q31_t sum;
|
---|
| 701 | q31_t r, s, t, u;
|
---|
| 702 |
|
---|
| 703 | r = (q7_t) x;
|
---|
| 704 | s = (q7_t) y;
|
---|
| 705 |
|
---|
| 706 | r = __SSAT((r - s), 8);
|
---|
| 707 | s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
|
---|
| 708 | t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
|
---|
| 709 | u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
|
---|
| 710 |
|
---|
| 711 | sum =
|
---|
| 712 | (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
|
---|
| 713 | 0x000000FF);
|
---|
| 714 |
|
---|
| 715 | return sum;
|
---|
| 716 | }
|
---|
| 717 |
|
---|
| 718 | /*
|
---|
| 719 | * @brief C custom defined QADD16 for M3 and M0 processors
|
---|
| 720 | */
|
---|
| 721 |
|
---|
| 722 | /*
|
---|
| 723 | * @brief C custom defined QADD16 for M3 and M0 processors
|
---|
| 724 | */
|
---|
| 725 | static __INLINE q31_t __QADD16(
|
---|
| 726 | q31_t x,
|
---|
| 727 | q31_t y)
|
---|
| 728 | {
|
---|
| 729 |
|
---|
| 730 | q31_t sum;
|
---|
| 731 | q31_t r, s;
|
---|
| 732 |
|
---|
| 733 | r = (q15_t) x;
|
---|
| 734 | s = (q15_t) y;
|
---|
| 735 |
|
---|
| 736 | r = __SSAT(r + s, 16);
|
---|
| 737 | s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
|
---|
| 738 |
|
---|
| 739 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
|
---|
| 740 |
|
---|
| 741 | return sum;
|
---|
| 742 |
|
---|
| 743 | }
|
---|
| 744 |
|
---|
| 745 | /*
|
---|
| 746 | * @brief C custom defined SHADD16 for M3 and M0 processors
|
---|
| 747 | */
|
---|
| 748 | static __INLINE q31_t __SHADD16(
|
---|
| 749 | q31_t x,
|
---|
| 750 | q31_t y)
|
---|
| 751 | {
|
---|
| 752 |
|
---|
| 753 | q31_t sum;
|
---|
| 754 | q31_t r, s;
|
---|
| 755 |
|
---|
| 756 | r = (q15_t) x;
|
---|
| 757 | s = (q15_t) y;
|
---|
| 758 |
|
---|
| 759 | r = ((r >> 1) + (s >> 1));
|
---|
| 760 | s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
|
---|
| 761 |
|
---|
| 762 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
|
---|
| 763 |
|
---|
| 764 | return sum;
|
---|
| 765 |
|
---|
| 766 | }
|
---|
| 767 |
|
---|
| 768 | /*
|
---|
| 769 | * @brief C custom defined QSUB16 for M3 and M0 processors
|
---|
| 770 | */
|
---|
| 771 | static __INLINE q31_t __QSUB16(
|
---|
| 772 | q31_t x,
|
---|
| 773 | q31_t y)
|
---|
| 774 | {
|
---|
| 775 |
|
---|
| 776 | q31_t sum;
|
---|
| 777 | q31_t r, s;
|
---|
| 778 |
|
---|
| 779 | r = (q15_t) x;
|
---|
| 780 | s = (q15_t) y;
|
---|
| 781 |
|
---|
| 782 | r = __SSAT(r - s, 16);
|
---|
| 783 | s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
|
---|
| 784 |
|
---|
| 785 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
|
---|
| 786 |
|
---|
| 787 | return sum;
|
---|
| 788 | }
|
---|
| 789 |
|
---|
| 790 | /*
|
---|
| 791 | * @brief C custom defined SHSUB16 for M3 and M0 processors
|
---|
| 792 | */
|
---|
| 793 | static __INLINE q31_t __SHSUB16(
|
---|
| 794 | q31_t x,
|
---|
| 795 | q31_t y)
|
---|
| 796 | {
|
---|
| 797 |
|
---|
| 798 | q31_t diff;
|
---|
| 799 | q31_t r, s;
|
---|
| 800 |
|
---|
| 801 | r = (q15_t) x;
|
---|
| 802 | s = (q15_t) y;
|
---|
| 803 |
|
---|
| 804 | r = ((r >> 1) - (s >> 1));
|
---|
| 805 | s = (((x >> 17) - (y >> 17)) << 16);
|
---|
| 806 |
|
---|
| 807 | diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
|
---|
| 808 |
|
---|
| 809 | return diff;
|
---|
| 810 | }
|
---|
| 811 |
|
---|
| 812 | /*
|
---|
| 813 | * @brief C custom defined QASX for M3 and M0 processors
|
---|
| 814 | */
|
---|
| 815 | static __INLINE q31_t __QASX(
|
---|
| 816 | q31_t x,
|
---|
| 817 | q31_t y)
|
---|
| 818 | {
|
---|
| 819 |
|
---|
| 820 | q31_t sum = 0;
|
---|
| 821 |
|
---|
| 822 | sum =
|
---|
| 823 | ((sum +
|
---|
| 824 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
|
---|
| 825 | clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
|
---|
| 826 |
|
---|
| 827 | return sum;
|
---|
| 828 | }
|
---|
| 829 |
|
---|
| 830 | /*
|
---|
| 831 | * @brief C custom defined SHASX for M3 and M0 processors
|
---|
| 832 | */
|
---|
| 833 | static __INLINE q31_t __SHASX(
|
---|
| 834 | q31_t x,
|
---|
| 835 | q31_t y)
|
---|
| 836 | {
|
---|
| 837 |
|
---|
| 838 | q31_t sum;
|
---|
| 839 | q31_t r, s;
|
---|
| 840 |
|
---|
| 841 | r = (q15_t) x;
|
---|
| 842 | s = (q15_t) y;
|
---|
| 843 |
|
---|
| 844 | r = ((r >> 1) - (y >> 17));
|
---|
| 845 | s = (((x >> 17) + (s >> 1)) << 16);
|
---|
| 846 |
|
---|
| 847 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
|
---|
| 848 |
|
---|
| 849 | return sum;
|
---|
| 850 | }
|
---|
| 851 |
|
---|
| 852 |
|
---|
| 853 | /*
|
---|
| 854 | * @brief C custom defined QSAX for M3 and M0 processors
|
---|
| 855 | */
|
---|
| 856 | static __INLINE q31_t __QSAX(
|
---|
| 857 | q31_t x,
|
---|
| 858 | q31_t y)
|
---|
| 859 | {
|
---|
| 860 |
|
---|
| 861 | q31_t sum = 0;
|
---|
| 862 |
|
---|
| 863 | sum =
|
---|
| 864 | ((sum +
|
---|
| 865 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
|
---|
| 866 | clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
|
---|
| 867 |
|
---|
| 868 | return sum;
|
---|
| 869 | }
|
---|
| 870 |
|
---|
| 871 | /*
|
---|
| 872 | * @brief C custom defined SHSAX for M3 and M0 processors
|
---|
| 873 | */
|
---|
| 874 | static __INLINE q31_t __SHSAX(
|
---|
| 875 | q31_t x,
|
---|
| 876 | q31_t y)
|
---|
| 877 | {
|
---|
| 878 |
|
---|
| 879 | q31_t sum;
|
---|
| 880 | q31_t r, s;
|
---|
| 881 |
|
---|
| 882 | r = (q15_t) x;
|
---|
| 883 | s = (q15_t) y;
|
---|
| 884 |
|
---|
| 885 | r = ((r >> 1) + (y >> 17));
|
---|
| 886 | s = (((x >> 17) - (s >> 1)) << 16);
|
---|
| 887 |
|
---|
| 888 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
|
---|
| 889 |
|
---|
| 890 | return sum;
|
---|
| 891 | }
|
---|
| 892 |
|
---|
| 893 | /*
|
---|
| 894 | * @brief C custom defined SMUSDX for M3 and M0 processors
|
---|
| 895 | */
|
---|
| 896 | static __INLINE q31_t __SMUSDX(
|
---|
| 897 | q31_t x,
|
---|
| 898 | q31_t y)
|
---|
| 899 | {
|
---|
| 900 |
|
---|
| 901 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
|
---|
| 902 | ((q15_t) (x >> 16) * (q15_t) y)));
|
---|
| 903 | }
|
---|
| 904 |
|
---|
| 905 | /*
|
---|
| 906 | * @brief C custom defined SMUADX for M3 and M0 processors
|
---|
| 907 | */
|
---|
| 908 | static __INLINE q31_t __SMUADX(
|
---|
| 909 | q31_t x,
|
---|
| 910 | q31_t y)
|
---|
| 911 | {
|
---|
| 912 |
|
---|
| 913 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
|
---|
| 914 | ((q15_t) (x >> 16) * (q15_t) y)));
|
---|
| 915 | }
|
---|
| 916 |
|
---|
| 917 | /*
|
---|
| 918 | * @brief C custom defined QADD for M3 and M0 processors
|
---|
| 919 | */
|
---|
| 920 | static __INLINE q31_t __QADD(
|
---|
| 921 | q31_t x,
|
---|
| 922 | q31_t y)
|
---|
| 923 | {
|
---|
| 924 | return clip_q63_to_q31((q63_t) x + y);
|
---|
| 925 | }
|
---|
| 926 |
|
---|
| 927 | /*
|
---|
| 928 | * @brief C custom defined QSUB for M3 and M0 processors
|
---|
| 929 | */
|
---|
| 930 | static __INLINE q31_t __QSUB(
|
---|
| 931 | q31_t x,
|
---|
| 932 | q31_t y)
|
---|
| 933 | {
|
---|
| 934 | return clip_q63_to_q31((q63_t) x - y);
|
---|
| 935 | }
|
---|
| 936 |
|
---|
| 937 | /*
|
---|
| 938 | * @brief C custom defined SMLAD for M3 and M0 processors
|
---|
| 939 | */
|
---|
| 940 | static __INLINE q31_t __SMLAD(
|
---|
| 941 | q31_t x,
|
---|
| 942 | q31_t y,
|
---|
| 943 | q31_t sum)
|
---|
| 944 | {
|
---|
| 945 |
|
---|
| 946 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
|
---|
| 947 | ((q15_t) x * (q15_t) y));
|
---|
| 948 | }
|
---|
| 949 |
|
---|
| 950 | /*
|
---|
| 951 | * @brief C custom defined SMLADX for M3 and M0 processors
|
---|
| 952 | */
|
---|
| 953 | static __INLINE q31_t __SMLADX(
|
---|
| 954 | q31_t x,
|
---|
| 955 | q31_t y,
|
---|
| 956 | q31_t sum)
|
---|
| 957 | {
|
---|
| 958 |
|
---|
| 959 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
|
---|
| 960 | ((q15_t) x * (q15_t) (y >> 16)));
|
---|
| 961 | }
|
---|
| 962 |
|
---|
| 963 | /*
|
---|
| 964 | * @brief C custom defined SMLSDX for M3 and M0 processors
|
---|
| 965 | */
|
---|
| 966 | static __INLINE q31_t __SMLSDX(
|
---|
| 967 | q31_t x,
|
---|
| 968 | q31_t y,
|
---|
| 969 | q31_t sum)
|
---|
| 970 | {
|
---|
| 971 |
|
---|
| 972 | return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
|
---|
| 973 | ((q15_t) x * (q15_t) (y >> 16)));
|
---|
| 974 | }
|
---|
| 975 |
|
---|
| 976 | /*
|
---|
| 977 | * @brief C custom defined SMLALD for M3 and M0 processors
|
---|
| 978 | */
|
---|
| 979 | static __INLINE q63_t __SMLALD(
|
---|
| 980 | q31_t x,
|
---|
| 981 | q31_t y,
|
---|
| 982 | q63_t sum)
|
---|
| 983 | {
|
---|
| 984 |
|
---|
| 985 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
|
---|
| 986 | ((q15_t) x * (q15_t) y));
|
---|
| 987 | }
|
---|
| 988 |
|
---|
| 989 | /*
|
---|
| 990 | * @brief C custom defined SMLALDX for M3 and M0 processors
|
---|
| 991 | */
|
---|
| 992 | static __INLINE q63_t __SMLALDX(
|
---|
| 993 | q31_t x,
|
---|
| 994 | q31_t y,
|
---|
| 995 | q63_t sum)
|
---|
| 996 | {
|
---|
| 997 |
|
---|
| 998 | return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
|
---|
| 999 | ((q15_t) x * (q15_t) (y >> 16));
|
---|
| 1000 | }
|
---|
| 1001 |
|
---|
| 1002 | /*
|
---|
| 1003 | * @brief C custom defined SMUAD for M3 and M0 processors
|
---|
| 1004 | */
|
---|
| 1005 | static __INLINE q31_t __SMUAD(
|
---|
| 1006 | q31_t x,
|
---|
| 1007 | q31_t y)
|
---|
| 1008 | {
|
---|
| 1009 |
|
---|
| 1010 | return (((x >> 16) * (y >> 16)) +
|
---|
| 1011 | (((x << 16) >> 16) * ((y << 16) >> 16)));
|
---|
| 1012 | }
|
---|
| 1013 |
|
---|
| 1014 | /*
|
---|
| 1015 | * @brief C custom defined SMUSD for M3 and M0 processors
|
---|
| 1016 | */
|
---|
| 1017 | static __INLINE q31_t __SMUSD(
|
---|
| 1018 | q31_t x,
|
---|
| 1019 | q31_t y)
|
---|
| 1020 | {
|
---|
| 1021 |
|
---|
| 1022 | return (-((x >> 16) * (y >> 16)) +
|
---|
| 1023 | (((x << 16) >> 16) * ((y << 16) >> 16)));
|
---|
| 1024 | }
|
---|
| 1025 |
|
---|
| 1026 |
|
---|
| 1027 | /*
|
---|
| 1028 | * @brief C custom defined SXTB16 for M3 and M0 processors
|
---|
| 1029 | */
|
---|
| 1030 | static __INLINE q31_t __SXTB16(
|
---|
| 1031 | q31_t x)
|
---|
| 1032 | {
|
---|
| 1033 |
|
---|
| 1034 | return ((((x << 24) >> 24) & 0x0000FFFF) |
|
---|
| 1035 | (((x << 8) >> 8) & 0xFFFF0000));
|
---|
| 1036 | }
|
---|
| 1037 |
|
---|
| 1038 |
|
---|
| 1039 | #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
|
---|
| 1040 |
|
---|
| 1041 |
|
---|
| 1042 | /**
|
---|
| 1043 | * @brief Instance structure for the Q7 FIR filter.
|
---|
| 1044 | */
|
---|
| 1045 | typedef struct
|
---|
| 1046 | {
|
---|
| 1047 | uint16_t numTaps; /**< number of filter coefficients in the filter. */
|
---|
| 1048 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 1049 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 1050 | } arm_fir_instance_q7;
|
---|
| 1051 |
|
---|
| 1052 | /**
|
---|
| 1053 | * @brief Instance structure for the Q15 FIR filter.
|
---|
| 1054 | */
|
---|
| 1055 | typedef struct
|
---|
| 1056 | {
|
---|
| 1057 | uint16_t numTaps; /**< number of filter coefficients in the filter. */
|
---|
| 1058 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 1059 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 1060 | } arm_fir_instance_q15;
|
---|
| 1061 |
|
---|
| 1062 | /**
|
---|
| 1063 | * @brief Instance structure for the Q31 FIR filter.
|
---|
| 1064 | */
|
---|
| 1065 | typedef struct
|
---|
| 1066 | {
|
---|
| 1067 | uint16_t numTaps; /**< number of filter coefficients in the filter. */
|
---|
| 1068 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 1069 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 1070 | } arm_fir_instance_q31;
|
---|
| 1071 |
|
---|
| 1072 | /**
|
---|
| 1073 | * @brief Instance structure for the floating-point FIR filter.
|
---|
| 1074 | */
|
---|
| 1075 | typedef struct
|
---|
| 1076 | {
|
---|
| 1077 | uint16_t numTaps; /**< number of filter coefficients in the filter. */
|
---|
| 1078 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 1079 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 1080 | } arm_fir_instance_f32;
|
---|
| 1081 |
|
---|
| 1082 |
|
---|
| 1083 | /**
|
---|
| 1084 | * @brief Processing function for the Q7 FIR filter.
|
---|
| 1085 | * @param[in] *S points to an instance of the Q7 FIR filter structure.
|
---|
| 1086 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1087 | * @param[out] *pDst points to the block of output data.
|
---|
| 1088 | * @param[in] blockSize number of samples to process.
|
---|
| 1089 | * @return none.
|
---|
| 1090 | */
|
---|
| 1091 | void arm_fir_q7(
|
---|
| 1092 | const arm_fir_instance_q7 * S,
|
---|
| 1093 | q7_t * pSrc,
|
---|
| 1094 | q7_t * pDst,
|
---|
| 1095 | uint32_t blockSize);
|
---|
| 1096 |
|
---|
| 1097 |
|
---|
| 1098 | /**
|
---|
| 1099 | * @brief Initialization function for the Q7 FIR filter.
|
---|
| 1100 | * @param[in,out] *S points to an instance of the Q7 FIR structure.
|
---|
| 1101 | * @param[in] numTaps Number of filter coefficients in the filter.
|
---|
| 1102 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1103 | * @param[in] *pState points to the state buffer.
|
---|
| 1104 | * @param[in] blockSize number of samples that are processed.
|
---|
| 1105 | * @return none
|
---|
| 1106 | */
|
---|
| 1107 | void arm_fir_init_q7(
|
---|
| 1108 | arm_fir_instance_q7 * S,
|
---|
| 1109 | uint16_t numTaps,
|
---|
| 1110 | q7_t * pCoeffs,
|
---|
| 1111 | q7_t * pState,
|
---|
| 1112 | uint32_t blockSize);
|
---|
| 1113 |
|
---|
| 1114 |
|
---|
| 1115 | /**
|
---|
| 1116 | * @brief Processing function for the Q15 FIR filter.
|
---|
| 1117 | * @param[in] *S points to an instance of the Q15 FIR structure.
|
---|
| 1118 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1119 | * @param[out] *pDst points to the block of output data.
|
---|
| 1120 | * @param[in] blockSize number of samples to process.
|
---|
| 1121 | * @return none.
|
---|
| 1122 | */
|
---|
| 1123 | void arm_fir_q15(
|
---|
| 1124 | const arm_fir_instance_q15 * S,
|
---|
| 1125 | q15_t * pSrc,
|
---|
| 1126 | q15_t * pDst,
|
---|
| 1127 | uint32_t blockSize);
|
---|
| 1128 |
|
---|
| 1129 | /**
|
---|
| 1130 | * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
|
---|
| 1131 | * @param[in] *S points to an instance of the Q15 FIR filter structure.
|
---|
| 1132 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1133 | * @param[out] *pDst points to the block of output data.
|
---|
| 1134 | * @param[in] blockSize number of samples to process.
|
---|
| 1135 | * @return none.
|
---|
| 1136 | */
|
---|
| 1137 | void arm_fir_fast_q15(
|
---|
| 1138 | const arm_fir_instance_q15 * S,
|
---|
| 1139 | q15_t * pSrc,
|
---|
| 1140 | q15_t * pDst,
|
---|
| 1141 | uint32_t blockSize);
|
---|
| 1142 |
|
---|
| 1143 | /**
|
---|
| 1144 | * @brief Initialization function for the Q15 FIR filter.
|
---|
| 1145 | * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
|
---|
| 1146 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
|
---|
| 1147 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1148 | * @param[in] *pState points to the state buffer.
|
---|
| 1149 | * @param[in] blockSize number of samples that are processed at a time.
|
---|
| 1150 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
|
---|
| 1151 | * <code>numTaps</code> is not a supported value.
|
---|
| 1152 | */
|
---|
| 1153 |
|
---|
| 1154 | arm_status arm_fir_init_q15(
|
---|
| 1155 | arm_fir_instance_q15 * S,
|
---|
| 1156 | uint16_t numTaps,
|
---|
| 1157 | q15_t * pCoeffs,
|
---|
| 1158 | q15_t * pState,
|
---|
| 1159 | uint32_t blockSize);
|
---|
| 1160 |
|
---|
| 1161 | /**
|
---|
| 1162 | * @brief Processing function for the Q31 FIR filter.
|
---|
| 1163 | * @param[in] *S points to an instance of the Q31 FIR filter structure.
|
---|
| 1164 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1165 | * @param[out] *pDst points to the block of output data.
|
---|
| 1166 | * @param[in] blockSize number of samples to process.
|
---|
| 1167 | * @return none.
|
---|
| 1168 | */
|
---|
| 1169 | void arm_fir_q31(
|
---|
| 1170 | const arm_fir_instance_q31 * S,
|
---|
| 1171 | q31_t * pSrc,
|
---|
| 1172 | q31_t * pDst,
|
---|
| 1173 | uint32_t blockSize);
|
---|
| 1174 |
|
---|
| 1175 | /**
|
---|
| 1176 | * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
|
---|
| 1177 | * @param[in] *S points to an instance of the Q31 FIR structure.
|
---|
| 1178 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1179 | * @param[out] *pDst points to the block of output data.
|
---|
| 1180 | * @param[in] blockSize number of samples to process.
|
---|
| 1181 | * @return none.
|
---|
| 1182 | */
|
---|
| 1183 | void arm_fir_fast_q31(
|
---|
| 1184 | const arm_fir_instance_q31 * S,
|
---|
| 1185 | q31_t * pSrc,
|
---|
| 1186 | q31_t * pDst,
|
---|
| 1187 | uint32_t blockSize);
|
---|
| 1188 |
|
---|
| 1189 | /**
|
---|
| 1190 | * @brief Initialization function for the Q31 FIR filter.
|
---|
| 1191 | * @param[in,out] *S points to an instance of the Q31 FIR structure.
|
---|
| 1192 | * @param[in] numTaps Number of filter coefficients in the filter.
|
---|
| 1193 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1194 | * @param[in] *pState points to the state buffer.
|
---|
| 1195 | * @param[in] blockSize number of samples that are processed at a time.
|
---|
| 1196 | * @return none.
|
---|
| 1197 | */
|
---|
| 1198 | void arm_fir_init_q31(
|
---|
| 1199 | arm_fir_instance_q31 * S,
|
---|
| 1200 | uint16_t numTaps,
|
---|
| 1201 | q31_t * pCoeffs,
|
---|
| 1202 | q31_t * pState,
|
---|
| 1203 | uint32_t blockSize);
|
---|
| 1204 |
|
---|
| 1205 | /**
|
---|
| 1206 | * @brief Processing function for the floating-point FIR filter.
|
---|
| 1207 | * @param[in] *S points to an instance of the floating-point FIR structure.
|
---|
| 1208 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1209 | * @param[out] *pDst points to the block of output data.
|
---|
| 1210 | * @param[in] blockSize number of samples to process.
|
---|
| 1211 | * @return none.
|
---|
| 1212 | */
|
---|
| 1213 | void arm_fir_f32(
|
---|
| 1214 | const arm_fir_instance_f32 * S,
|
---|
| 1215 | float32_t * pSrc,
|
---|
| 1216 | float32_t * pDst,
|
---|
| 1217 | uint32_t blockSize);
|
---|
| 1218 |
|
---|
| 1219 | /**
|
---|
| 1220 | * @brief Initialization function for the floating-point FIR filter.
|
---|
| 1221 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
|
---|
| 1222 | * @param[in] numTaps Number of filter coefficients in the filter.
|
---|
| 1223 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1224 | * @param[in] *pState points to the state buffer.
|
---|
| 1225 | * @param[in] blockSize number of samples that are processed at a time.
|
---|
| 1226 | * @return none.
|
---|
| 1227 | */
|
---|
| 1228 | void arm_fir_init_f32(
|
---|
| 1229 | arm_fir_instance_f32 * S,
|
---|
| 1230 | uint16_t numTaps,
|
---|
| 1231 | float32_t * pCoeffs,
|
---|
| 1232 | float32_t * pState,
|
---|
| 1233 | uint32_t blockSize);
|
---|
| 1234 |
|
---|
| 1235 |
|
---|
| 1236 | /**
|
---|
| 1237 | * @brief Instance structure for the Q15 Biquad cascade filter.
|
---|
| 1238 | */
|
---|
| 1239 | typedef struct
|
---|
| 1240 | {
|
---|
| 1241 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
|
---|
| 1242 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
|
---|
| 1243 | q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
|
---|
| 1244 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
|
---|
| 1245 |
|
---|
| 1246 | } arm_biquad_casd_df1_inst_q15;
|
---|
| 1247 |
|
---|
| 1248 |
|
---|
| 1249 | /**
|
---|
| 1250 | * @brief Instance structure for the Q31 Biquad cascade filter.
|
---|
| 1251 | */
|
---|
| 1252 | typedef struct
|
---|
| 1253 | {
|
---|
| 1254 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
|
---|
| 1255 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
|
---|
| 1256 | q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
|
---|
| 1257 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
|
---|
| 1258 |
|
---|
| 1259 | } arm_biquad_casd_df1_inst_q31;
|
---|
| 1260 |
|
---|
| 1261 | /**
|
---|
| 1262 | * @brief Instance structure for the floating-point Biquad cascade filter.
|
---|
| 1263 | */
|
---|
| 1264 | typedef struct
|
---|
| 1265 | {
|
---|
| 1266 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
|
---|
| 1267 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
|
---|
| 1268 | float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
|
---|
| 1269 |
|
---|
| 1270 |
|
---|
| 1271 | } arm_biquad_casd_df1_inst_f32;
|
---|
| 1272 |
|
---|
| 1273 |
|
---|
| 1274 |
|
---|
| 1275 | /**
|
---|
| 1276 | * @brief Processing function for the Q15 Biquad cascade filter.
|
---|
| 1277 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
|
---|
| 1278 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1279 | * @param[out] *pDst points to the block of output data.
|
---|
| 1280 | * @param[in] blockSize number of samples to process.
|
---|
| 1281 | * @return none.
|
---|
| 1282 | */
|
---|
| 1283 |
|
---|
| 1284 | void arm_biquad_cascade_df1_q15(
|
---|
| 1285 | const arm_biquad_casd_df1_inst_q15 * S,
|
---|
| 1286 | q15_t * pSrc,
|
---|
| 1287 | q15_t * pDst,
|
---|
| 1288 | uint32_t blockSize);
|
---|
| 1289 |
|
---|
| 1290 | /**
|
---|
| 1291 | * @brief Initialization function for the Q15 Biquad cascade filter.
|
---|
| 1292 | * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
|
---|
| 1293 | * @param[in] numStages number of 2nd order stages in the filter.
|
---|
| 1294 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1295 | * @param[in] *pState points to the state buffer.
|
---|
| 1296 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
|
---|
| 1297 | * @return none
|
---|
| 1298 | */
|
---|
| 1299 |
|
---|
| 1300 | void arm_biquad_cascade_df1_init_q15(
|
---|
| 1301 | arm_biquad_casd_df1_inst_q15 * S,
|
---|
| 1302 | uint8_t numStages,
|
---|
| 1303 | q15_t * pCoeffs,
|
---|
| 1304 | q15_t * pState,
|
---|
| 1305 | int8_t postShift);
|
---|
| 1306 |
|
---|
| 1307 |
|
---|
| 1308 | /**
|
---|
| 1309 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
|
---|
| 1310 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
|
---|
| 1311 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1312 | * @param[out] *pDst points to the block of output data.
|
---|
| 1313 | * @param[in] blockSize number of samples to process.
|
---|
| 1314 | * @return none.
|
---|
| 1315 | */
|
---|
| 1316 |
|
---|
| 1317 | void arm_biquad_cascade_df1_fast_q15(
|
---|
| 1318 | const arm_biquad_casd_df1_inst_q15 * S,
|
---|
| 1319 | q15_t * pSrc,
|
---|
| 1320 | q15_t * pDst,
|
---|
| 1321 | uint32_t blockSize);
|
---|
| 1322 |
|
---|
| 1323 |
|
---|
| 1324 | /**
|
---|
| 1325 | * @brief Processing function for the Q31 Biquad cascade filter
|
---|
| 1326 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
|
---|
| 1327 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1328 | * @param[out] *pDst points to the block of output data.
|
---|
| 1329 | * @param[in] blockSize number of samples to process.
|
---|
| 1330 | * @return none.
|
---|
| 1331 | */
|
---|
| 1332 |
|
---|
| 1333 | void arm_biquad_cascade_df1_q31(
|
---|
| 1334 | const arm_biquad_casd_df1_inst_q31 * S,
|
---|
| 1335 | q31_t * pSrc,
|
---|
| 1336 | q31_t * pDst,
|
---|
| 1337 | uint32_t blockSize);
|
---|
| 1338 |
|
---|
| 1339 | /**
|
---|
| 1340 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
|
---|
| 1341 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
|
---|
| 1342 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1343 | * @param[out] *pDst points to the block of output data.
|
---|
| 1344 | * @param[in] blockSize number of samples to process.
|
---|
| 1345 | * @return none.
|
---|
| 1346 | */
|
---|
| 1347 |
|
---|
| 1348 | void arm_biquad_cascade_df1_fast_q31(
|
---|
| 1349 | const arm_biquad_casd_df1_inst_q31 * S,
|
---|
| 1350 | q31_t * pSrc,
|
---|
| 1351 | q31_t * pDst,
|
---|
| 1352 | uint32_t blockSize);
|
---|
| 1353 |
|
---|
| 1354 | /**
|
---|
| 1355 | * @brief Initialization function for the Q31 Biquad cascade filter.
|
---|
| 1356 | * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
|
---|
| 1357 | * @param[in] numStages number of 2nd order stages in the filter.
|
---|
| 1358 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1359 | * @param[in] *pState points to the state buffer.
|
---|
| 1360 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
|
---|
| 1361 | * @return none
|
---|
| 1362 | */
|
---|
| 1363 |
|
---|
| 1364 | void arm_biquad_cascade_df1_init_q31(
|
---|
| 1365 | arm_biquad_casd_df1_inst_q31 * S,
|
---|
| 1366 | uint8_t numStages,
|
---|
| 1367 | q31_t * pCoeffs,
|
---|
| 1368 | q31_t * pState,
|
---|
| 1369 | int8_t postShift);
|
---|
| 1370 |
|
---|
| 1371 | /**
|
---|
| 1372 | * @brief Processing function for the floating-point Biquad cascade filter.
|
---|
| 1373 | * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
|
---|
| 1374 | * @param[in] *pSrc points to the block of input data.
|
---|
| 1375 | * @param[out] *pDst points to the block of output data.
|
---|
| 1376 | * @param[in] blockSize number of samples to process.
|
---|
| 1377 | * @return none.
|
---|
| 1378 | */
|
---|
| 1379 |
|
---|
| 1380 | void arm_biquad_cascade_df1_f32(
|
---|
| 1381 | const arm_biquad_casd_df1_inst_f32 * S,
|
---|
| 1382 | float32_t * pSrc,
|
---|
| 1383 | float32_t * pDst,
|
---|
| 1384 | uint32_t blockSize);
|
---|
| 1385 |
|
---|
| 1386 | /**
|
---|
| 1387 | * @brief Initialization function for the floating-point Biquad cascade filter.
|
---|
| 1388 | * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
|
---|
| 1389 | * @param[in] numStages number of 2nd order stages in the filter.
|
---|
| 1390 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 1391 | * @param[in] *pState points to the state buffer.
|
---|
| 1392 | * @return none
|
---|
| 1393 | */
|
---|
| 1394 |
|
---|
| 1395 | void arm_biquad_cascade_df1_init_f32(
|
---|
| 1396 | arm_biquad_casd_df1_inst_f32 * S,
|
---|
| 1397 | uint8_t numStages,
|
---|
| 1398 | float32_t * pCoeffs,
|
---|
| 1399 | float32_t * pState);
|
---|
| 1400 |
|
---|
| 1401 |
|
---|
| 1402 | /**
|
---|
| 1403 | * @brief Instance structure for the floating-point matrix structure.
|
---|
| 1404 | */
|
---|
| 1405 |
|
---|
| 1406 | typedef struct
|
---|
| 1407 | {
|
---|
| 1408 | uint16_t numRows; /**< number of rows of the matrix. */
|
---|
| 1409 | uint16_t numCols; /**< number of columns of the matrix. */
|
---|
| 1410 | float32_t *pData; /**< points to the data of the matrix. */
|
---|
| 1411 | } arm_matrix_instance_f32;
|
---|
| 1412 |
|
---|
| 1413 | /**
|
---|
| 1414 | * @brief Instance structure for the Q15 matrix structure.
|
---|
| 1415 | */
|
---|
| 1416 |
|
---|
| 1417 | typedef struct
|
---|
| 1418 | {
|
---|
| 1419 | uint16_t numRows; /**< number of rows of the matrix. */
|
---|
| 1420 | uint16_t numCols; /**< number of columns of the matrix. */
|
---|
| 1421 | q15_t *pData; /**< points to the data of the matrix. */
|
---|
| 1422 |
|
---|
| 1423 | } arm_matrix_instance_q15;
|
---|
| 1424 |
|
---|
| 1425 | /**
|
---|
| 1426 | * @brief Instance structure for the Q31 matrix structure.
|
---|
| 1427 | */
|
---|
| 1428 |
|
---|
| 1429 | typedef struct
|
---|
| 1430 | {
|
---|
| 1431 | uint16_t numRows; /**< number of rows of the matrix. */
|
---|
| 1432 | uint16_t numCols; /**< number of columns of the matrix. */
|
---|
| 1433 | q31_t *pData; /**< points to the data of the matrix. */
|
---|
| 1434 |
|
---|
| 1435 | } arm_matrix_instance_q31;
|
---|
| 1436 |
|
---|
| 1437 |
|
---|
| 1438 |
|
---|
| 1439 | /**
|
---|
| 1440 | * @brief Floating-point matrix addition.
|
---|
| 1441 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1442 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1443 | * @param[out] *pDst points to output matrix structure
|
---|
| 1444 | * @return The function returns either
|
---|
| 1445 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1446 | */
|
---|
| 1447 |
|
---|
| 1448 | arm_status arm_mat_add_f32(
|
---|
| 1449 | const arm_matrix_instance_f32 * pSrcA,
|
---|
| 1450 | const arm_matrix_instance_f32 * pSrcB,
|
---|
| 1451 | arm_matrix_instance_f32 * pDst);
|
---|
| 1452 |
|
---|
| 1453 | /**
|
---|
| 1454 | * @brief Q15 matrix addition.
|
---|
| 1455 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1456 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1457 | * @param[out] *pDst points to output matrix structure
|
---|
| 1458 | * @return The function returns either
|
---|
| 1459 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1460 | */
|
---|
| 1461 |
|
---|
| 1462 | arm_status arm_mat_add_q15(
|
---|
| 1463 | const arm_matrix_instance_q15 * pSrcA,
|
---|
| 1464 | const arm_matrix_instance_q15 * pSrcB,
|
---|
| 1465 | arm_matrix_instance_q15 * pDst);
|
---|
| 1466 |
|
---|
| 1467 | /**
|
---|
| 1468 | * @brief Q31 matrix addition.
|
---|
| 1469 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1470 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1471 | * @param[out] *pDst points to output matrix structure
|
---|
| 1472 | * @return The function returns either
|
---|
| 1473 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1474 | */
|
---|
| 1475 |
|
---|
| 1476 | arm_status arm_mat_add_q31(
|
---|
| 1477 | const arm_matrix_instance_q31 * pSrcA,
|
---|
| 1478 | const arm_matrix_instance_q31 * pSrcB,
|
---|
| 1479 | arm_matrix_instance_q31 * pDst);
|
---|
| 1480 |
|
---|
| 1481 | /**
|
---|
| 1482 | * @brief Floating-point, complex, matrix multiplication.
|
---|
| 1483 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1484 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1485 | * @param[out] *pDst points to output matrix structure
|
---|
| 1486 | * @return The function returns either
|
---|
| 1487 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1488 | */
|
---|
| 1489 |
|
---|
| 1490 | arm_status arm_mat_cmplx_mult_f32(
|
---|
| 1491 | const arm_matrix_instance_f32 * pSrcA,
|
---|
| 1492 | const arm_matrix_instance_f32 * pSrcB,
|
---|
| 1493 | arm_matrix_instance_f32 * pDst);
|
---|
| 1494 |
|
---|
| 1495 | /**
|
---|
| 1496 | * @brief Q15, complex, matrix multiplication.
|
---|
| 1497 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1498 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1499 | * @param[out] *pDst points to output matrix structure
|
---|
| 1500 | * @return The function returns either
|
---|
| 1501 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1502 | */
|
---|
| 1503 |
|
---|
| 1504 | arm_status arm_mat_cmplx_mult_q15(
|
---|
| 1505 | const arm_matrix_instance_q15 * pSrcA,
|
---|
| 1506 | const arm_matrix_instance_q15 * pSrcB,
|
---|
| 1507 | arm_matrix_instance_q15 * pDst,
|
---|
| 1508 | q15_t * pScratch);
|
---|
| 1509 |
|
---|
| 1510 | /**
|
---|
| 1511 | * @brief Q31, complex, matrix multiplication.
|
---|
| 1512 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1513 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1514 | * @param[out] *pDst points to output matrix structure
|
---|
| 1515 | * @return The function returns either
|
---|
| 1516 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1517 | */
|
---|
| 1518 |
|
---|
| 1519 | arm_status arm_mat_cmplx_mult_q31(
|
---|
| 1520 | const arm_matrix_instance_q31 * pSrcA,
|
---|
| 1521 | const arm_matrix_instance_q31 * pSrcB,
|
---|
| 1522 | arm_matrix_instance_q31 * pDst);
|
---|
| 1523 |
|
---|
| 1524 |
|
---|
| 1525 | /**
|
---|
| 1526 | * @brief Floating-point matrix transpose.
|
---|
| 1527 | * @param[in] *pSrc points to the input matrix
|
---|
| 1528 | * @param[out] *pDst points to the output matrix
|
---|
| 1529 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
|
---|
| 1530 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1531 | */
|
---|
| 1532 |
|
---|
| 1533 | arm_status arm_mat_trans_f32(
|
---|
| 1534 | const arm_matrix_instance_f32 * pSrc,
|
---|
| 1535 | arm_matrix_instance_f32 * pDst);
|
---|
| 1536 |
|
---|
| 1537 |
|
---|
| 1538 | /**
|
---|
| 1539 | * @brief Q15 matrix transpose.
|
---|
| 1540 | * @param[in] *pSrc points to the input matrix
|
---|
| 1541 | * @param[out] *pDst points to the output matrix
|
---|
| 1542 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
|
---|
| 1543 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1544 | */
|
---|
| 1545 |
|
---|
| 1546 | arm_status arm_mat_trans_q15(
|
---|
| 1547 | const arm_matrix_instance_q15 * pSrc,
|
---|
| 1548 | arm_matrix_instance_q15 * pDst);
|
---|
| 1549 |
|
---|
| 1550 | /**
|
---|
| 1551 | * @brief Q31 matrix transpose.
|
---|
| 1552 | * @param[in] *pSrc points to the input matrix
|
---|
| 1553 | * @param[out] *pDst points to the output matrix
|
---|
| 1554 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
|
---|
| 1555 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1556 | */
|
---|
| 1557 |
|
---|
| 1558 | arm_status arm_mat_trans_q31(
|
---|
| 1559 | const arm_matrix_instance_q31 * pSrc,
|
---|
| 1560 | arm_matrix_instance_q31 * pDst);
|
---|
| 1561 |
|
---|
| 1562 |
|
---|
| 1563 | /**
|
---|
| 1564 | * @brief Floating-point matrix multiplication
|
---|
| 1565 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1566 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1567 | * @param[out] *pDst points to output matrix structure
|
---|
| 1568 | * @return The function returns either
|
---|
| 1569 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1570 | */
|
---|
| 1571 |
|
---|
| 1572 | arm_status arm_mat_mult_f32(
|
---|
| 1573 | const arm_matrix_instance_f32 * pSrcA,
|
---|
| 1574 | const arm_matrix_instance_f32 * pSrcB,
|
---|
| 1575 | arm_matrix_instance_f32 * pDst);
|
---|
| 1576 |
|
---|
| 1577 | /**
|
---|
| 1578 | * @brief Q15 matrix multiplication
|
---|
| 1579 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1580 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1581 | * @param[out] *pDst points to output matrix structure
|
---|
| 1582 | * @param[in] *pState points to the array for storing intermediate results
|
---|
| 1583 | * @return The function returns either
|
---|
| 1584 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1585 | */
|
---|
| 1586 |
|
---|
| 1587 | arm_status arm_mat_mult_q15(
|
---|
| 1588 | const arm_matrix_instance_q15 * pSrcA,
|
---|
| 1589 | const arm_matrix_instance_q15 * pSrcB,
|
---|
| 1590 | arm_matrix_instance_q15 * pDst,
|
---|
| 1591 | q15_t * pState);
|
---|
| 1592 |
|
---|
| 1593 | /**
|
---|
| 1594 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
|
---|
| 1595 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1596 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1597 | * @param[out] *pDst points to output matrix structure
|
---|
| 1598 | * @param[in] *pState points to the array for storing intermediate results
|
---|
| 1599 | * @return The function returns either
|
---|
| 1600 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1601 | */
|
---|
| 1602 |
|
---|
| 1603 | arm_status arm_mat_mult_fast_q15(
|
---|
| 1604 | const arm_matrix_instance_q15 * pSrcA,
|
---|
| 1605 | const arm_matrix_instance_q15 * pSrcB,
|
---|
| 1606 | arm_matrix_instance_q15 * pDst,
|
---|
| 1607 | q15_t * pState);
|
---|
| 1608 |
|
---|
| 1609 | /**
|
---|
| 1610 | * @brief Q31 matrix multiplication
|
---|
| 1611 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1612 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1613 | * @param[out] *pDst points to output matrix structure
|
---|
| 1614 | * @return The function returns either
|
---|
| 1615 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1616 | */
|
---|
| 1617 |
|
---|
| 1618 | arm_status arm_mat_mult_q31(
|
---|
| 1619 | const arm_matrix_instance_q31 * pSrcA,
|
---|
| 1620 | const arm_matrix_instance_q31 * pSrcB,
|
---|
| 1621 | arm_matrix_instance_q31 * pDst);
|
---|
| 1622 |
|
---|
| 1623 | /**
|
---|
| 1624 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
|
---|
| 1625 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1626 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1627 | * @param[out] *pDst points to output matrix structure
|
---|
| 1628 | * @return The function returns either
|
---|
| 1629 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1630 | */
|
---|
| 1631 |
|
---|
| 1632 | arm_status arm_mat_mult_fast_q31(
|
---|
| 1633 | const arm_matrix_instance_q31 * pSrcA,
|
---|
| 1634 | const arm_matrix_instance_q31 * pSrcB,
|
---|
| 1635 | arm_matrix_instance_q31 * pDst);
|
---|
| 1636 |
|
---|
| 1637 |
|
---|
| 1638 | /**
|
---|
| 1639 | * @brief Floating-point matrix subtraction
|
---|
| 1640 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1641 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1642 | * @param[out] *pDst points to output matrix structure
|
---|
| 1643 | * @return The function returns either
|
---|
| 1644 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1645 | */
|
---|
| 1646 |
|
---|
| 1647 | arm_status arm_mat_sub_f32(
|
---|
| 1648 | const arm_matrix_instance_f32 * pSrcA,
|
---|
| 1649 | const arm_matrix_instance_f32 * pSrcB,
|
---|
| 1650 | arm_matrix_instance_f32 * pDst);
|
---|
| 1651 |
|
---|
| 1652 | /**
|
---|
| 1653 | * @brief Q15 matrix subtraction
|
---|
| 1654 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1655 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1656 | * @param[out] *pDst points to output matrix structure
|
---|
| 1657 | * @return The function returns either
|
---|
| 1658 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1659 | */
|
---|
| 1660 |
|
---|
| 1661 | arm_status arm_mat_sub_q15(
|
---|
| 1662 | const arm_matrix_instance_q15 * pSrcA,
|
---|
| 1663 | const arm_matrix_instance_q15 * pSrcB,
|
---|
| 1664 | arm_matrix_instance_q15 * pDst);
|
---|
| 1665 |
|
---|
| 1666 | /**
|
---|
| 1667 | * @brief Q31 matrix subtraction
|
---|
| 1668 | * @param[in] *pSrcA points to the first input matrix structure
|
---|
| 1669 | * @param[in] *pSrcB points to the second input matrix structure
|
---|
| 1670 | * @param[out] *pDst points to output matrix structure
|
---|
| 1671 | * @return The function returns either
|
---|
| 1672 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1673 | */
|
---|
| 1674 |
|
---|
| 1675 | arm_status arm_mat_sub_q31(
|
---|
| 1676 | const arm_matrix_instance_q31 * pSrcA,
|
---|
| 1677 | const arm_matrix_instance_q31 * pSrcB,
|
---|
| 1678 | arm_matrix_instance_q31 * pDst);
|
---|
| 1679 |
|
---|
| 1680 | /**
|
---|
| 1681 | * @brief Floating-point matrix scaling.
|
---|
| 1682 | * @param[in] *pSrc points to the input matrix
|
---|
| 1683 | * @param[in] scale scale factor
|
---|
| 1684 | * @param[out] *pDst points to the output matrix
|
---|
| 1685 | * @return The function returns either
|
---|
| 1686 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1687 | */
|
---|
| 1688 |
|
---|
| 1689 | arm_status arm_mat_scale_f32(
|
---|
| 1690 | const arm_matrix_instance_f32 * pSrc,
|
---|
| 1691 | float32_t scale,
|
---|
| 1692 | arm_matrix_instance_f32 * pDst);
|
---|
| 1693 |
|
---|
| 1694 | /**
|
---|
| 1695 | * @brief Q15 matrix scaling.
|
---|
| 1696 | * @param[in] *pSrc points to input matrix
|
---|
| 1697 | * @param[in] scaleFract fractional portion of the scale factor
|
---|
| 1698 | * @param[in] shift number of bits to shift the result by
|
---|
| 1699 | * @param[out] *pDst points to output matrix
|
---|
| 1700 | * @return The function returns either
|
---|
| 1701 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1702 | */
|
---|
| 1703 |
|
---|
| 1704 | arm_status arm_mat_scale_q15(
|
---|
| 1705 | const arm_matrix_instance_q15 * pSrc,
|
---|
| 1706 | q15_t scaleFract,
|
---|
| 1707 | int32_t shift,
|
---|
| 1708 | arm_matrix_instance_q15 * pDst);
|
---|
| 1709 |
|
---|
| 1710 | /**
|
---|
| 1711 | * @brief Q31 matrix scaling.
|
---|
| 1712 | * @param[in] *pSrc points to input matrix
|
---|
| 1713 | * @param[in] scaleFract fractional portion of the scale factor
|
---|
| 1714 | * @param[in] shift number of bits to shift the result by
|
---|
| 1715 | * @param[out] *pDst points to output matrix structure
|
---|
| 1716 | * @return The function returns either
|
---|
| 1717 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
|
---|
| 1718 | */
|
---|
| 1719 |
|
---|
| 1720 | arm_status arm_mat_scale_q31(
|
---|
| 1721 | const arm_matrix_instance_q31 * pSrc,
|
---|
| 1722 | q31_t scaleFract,
|
---|
| 1723 | int32_t shift,
|
---|
| 1724 | arm_matrix_instance_q31 * pDst);
|
---|
| 1725 |
|
---|
| 1726 |
|
---|
| 1727 | /**
|
---|
| 1728 | * @brief Q31 matrix initialization.
|
---|
| 1729 | * @param[in,out] *S points to an instance of the floating-point matrix structure.
|
---|
| 1730 | * @param[in] nRows number of rows in the matrix.
|
---|
| 1731 | * @param[in] nColumns number of columns in the matrix.
|
---|
| 1732 | * @param[in] *pData points to the matrix data array.
|
---|
| 1733 | * @return none
|
---|
| 1734 | */
|
---|
| 1735 |
|
---|
| 1736 | void arm_mat_init_q31(
|
---|
| 1737 | arm_matrix_instance_q31 * S,
|
---|
| 1738 | uint16_t nRows,
|
---|
| 1739 | uint16_t nColumns,
|
---|
| 1740 | q31_t * pData);
|
---|
| 1741 |
|
---|
| 1742 | /**
|
---|
| 1743 | * @brief Q15 matrix initialization.
|
---|
| 1744 | * @param[in,out] *S points to an instance of the floating-point matrix structure.
|
---|
| 1745 | * @param[in] nRows number of rows in the matrix.
|
---|
| 1746 | * @param[in] nColumns number of columns in the matrix.
|
---|
| 1747 | * @param[in] *pData points to the matrix data array.
|
---|
| 1748 | * @return none
|
---|
| 1749 | */
|
---|
| 1750 |
|
---|
| 1751 | void arm_mat_init_q15(
|
---|
| 1752 | arm_matrix_instance_q15 * S,
|
---|
| 1753 | uint16_t nRows,
|
---|
| 1754 | uint16_t nColumns,
|
---|
| 1755 | q15_t * pData);
|
---|
| 1756 |
|
---|
| 1757 | /**
|
---|
| 1758 | * @brief Floating-point matrix initialization.
|
---|
| 1759 | * @param[in,out] *S points to an instance of the floating-point matrix structure.
|
---|
| 1760 | * @param[in] nRows number of rows in the matrix.
|
---|
| 1761 | * @param[in] nColumns number of columns in the matrix.
|
---|
| 1762 | * @param[in] *pData points to the matrix data array.
|
---|
| 1763 | * @return none
|
---|
| 1764 | */
|
---|
| 1765 |
|
---|
| 1766 | void arm_mat_init_f32(
|
---|
| 1767 | arm_matrix_instance_f32 * S,
|
---|
| 1768 | uint16_t nRows,
|
---|
| 1769 | uint16_t nColumns,
|
---|
| 1770 | float32_t * pData);
|
---|
| 1771 |
|
---|
| 1772 |
|
---|
| 1773 |
|
---|
| 1774 | /**
|
---|
| 1775 | * @brief Instance structure for the Q15 PID Control.
|
---|
| 1776 | */
|
---|
| 1777 | typedef struct
|
---|
| 1778 | {
|
---|
| 1779 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
|
---|
| 1780 | #ifdef ARM_MATH_CM0_FAMILY
|
---|
| 1781 | q15_t A1;
|
---|
| 1782 | q15_t A2;
|
---|
| 1783 | #else
|
---|
| 1784 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
|
---|
| 1785 | #endif
|
---|
| 1786 | q15_t state[3]; /**< The state array of length 3. */
|
---|
| 1787 | q15_t Kp; /**< The proportional gain. */
|
---|
| 1788 | q15_t Ki; /**< The integral gain. */
|
---|
| 1789 | q15_t Kd; /**< The derivative gain. */
|
---|
| 1790 | } arm_pid_instance_q15;
|
---|
| 1791 |
|
---|
| 1792 | /**
|
---|
| 1793 | * @brief Instance structure for the Q31 PID Control.
|
---|
| 1794 | */
|
---|
| 1795 | typedef struct
|
---|
| 1796 | {
|
---|
| 1797 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
|
---|
| 1798 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
|
---|
| 1799 | q31_t A2; /**< The derived gain, A2 = Kd . */
|
---|
| 1800 | q31_t state[3]; /**< The state array of length 3. */
|
---|
| 1801 | q31_t Kp; /**< The proportional gain. */
|
---|
| 1802 | q31_t Ki; /**< The integral gain. */
|
---|
| 1803 | q31_t Kd; /**< The derivative gain. */
|
---|
| 1804 |
|
---|
| 1805 | } arm_pid_instance_q31;
|
---|
| 1806 |
|
---|
| 1807 | /**
|
---|
| 1808 | * @brief Instance structure for the floating-point PID Control.
|
---|
| 1809 | */
|
---|
| 1810 | typedef struct
|
---|
| 1811 | {
|
---|
| 1812 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
|
---|
| 1813 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
|
---|
| 1814 | float32_t A2; /**< The derived gain, A2 = Kd . */
|
---|
| 1815 | float32_t state[3]; /**< The state array of length 3. */
|
---|
| 1816 | float32_t Kp; /**< The proportional gain. */
|
---|
| 1817 | float32_t Ki; /**< The integral gain. */
|
---|
| 1818 | float32_t Kd; /**< The derivative gain. */
|
---|
| 1819 | } arm_pid_instance_f32;
|
---|
| 1820 |
|
---|
| 1821 |
|
---|
| 1822 |
|
---|
| 1823 | /**
|
---|
| 1824 | * @brief Initialization function for the floating-point PID Control.
|
---|
| 1825 | * @param[in,out] *S points to an instance of the PID structure.
|
---|
| 1826 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
|
---|
| 1827 | * @return none.
|
---|
| 1828 | */
|
---|
| 1829 | void arm_pid_init_f32(
|
---|
| 1830 | arm_pid_instance_f32 * S,
|
---|
| 1831 | int32_t resetStateFlag);
|
---|
| 1832 |
|
---|
| 1833 | /**
|
---|
| 1834 | * @brief Reset function for the floating-point PID Control.
|
---|
| 1835 | * @param[in,out] *S is an instance of the floating-point PID Control structure
|
---|
| 1836 | * @return none
|
---|
| 1837 | */
|
---|
| 1838 | void arm_pid_reset_f32(
|
---|
| 1839 | arm_pid_instance_f32 * S);
|
---|
| 1840 |
|
---|
| 1841 |
|
---|
| 1842 | /**
|
---|
| 1843 | * @brief Initialization function for the Q31 PID Control.
|
---|
| 1844 | * @param[in,out] *S points to an instance of the Q15 PID structure.
|
---|
| 1845 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
|
---|
| 1846 | * @return none.
|
---|
| 1847 | */
|
---|
| 1848 | void arm_pid_init_q31(
|
---|
| 1849 | arm_pid_instance_q31 * S,
|
---|
| 1850 | int32_t resetStateFlag);
|
---|
| 1851 |
|
---|
| 1852 |
|
---|
| 1853 | /**
|
---|
| 1854 | * @brief Reset function for the Q31 PID Control.
|
---|
| 1855 | * @param[in,out] *S points to an instance of the Q31 PID Control structure
|
---|
| 1856 | * @return none
|
---|
| 1857 | */
|
---|
| 1858 |
|
---|
| 1859 | void arm_pid_reset_q31(
|
---|
| 1860 | arm_pid_instance_q31 * S);
|
---|
| 1861 |
|
---|
| 1862 | /**
|
---|
| 1863 | * @brief Initialization function for the Q15 PID Control.
|
---|
| 1864 | * @param[in,out] *S points to an instance of the Q15 PID structure.
|
---|
| 1865 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
|
---|
| 1866 | * @return none.
|
---|
| 1867 | */
|
---|
| 1868 | void arm_pid_init_q15(
|
---|
| 1869 | arm_pid_instance_q15 * S,
|
---|
| 1870 | int32_t resetStateFlag);
|
---|
| 1871 |
|
---|
| 1872 | /**
|
---|
| 1873 | * @brief Reset function for the Q15 PID Control.
|
---|
| 1874 | * @param[in,out] *S points to an instance of the q15 PID Control structure
|
---|
| 1875 | * @return none
|
---|
| 1876 | */
|
---|
| 1877 | void arm_pid_reset_q15(
|
---|
| 1878 | arm_pid_instance_q15 * S);
|
---|
| 1879 |
|
---|
| 1880 |
|
---|
| 1881 | /**
|
---|
| 1882 | * @brief Instance structure for the floating-point Linear Interpolate function.
|
---|
| 1883 | */
|
---|
| 1884 | typedef struct
|
---|
| 1885 | {
|
---|
| 1886 | uint32_t nValues; /**< nValues */
|
---|
| 1887 | float32_t x1; /**< x1 */
|
---|
| 1888 | float32_t xSpacing; /**< xSpacing */
|
---|
| 1889 | float32_t *pYData; /**< pointer to the table of Y values */
|
---|
| 1890 | } arm_linear_interp_instance_f32;
|
---|
| 1891 |
|
---|
| 1892 | /**
|
---|
| 1893 | * @brief Instance structure for the floating-point bilinear interpolation function.
|
---|
| 1894 | */
|
---|
| 1895 |
|
---|
| 1896 | typedef struct
|
---|
| 1897 | {
|
---|
| 1898 | uint16_t numRows; /**< number of rows in the data table. */
|
---|
| 1899 | uint16_t numCols; /**< number of columns in the data table. */
|
---|
| 1900 | float32_t *pData; /**< points to the data table. */
|
---|
| 1901 | } arm_bilinear_interp_instance_f32;
|
---|
| 1902 |
|
---|
| 1903 | /**
|
---|
| 1904 | * @brief Instance structure for the Q31 bilinear interpolation function.
|
---|
| 1905 | */
|
---|
| 1906 |
|
---|
| 1907 | typedef struct
|
---|
| 1908 | {
|
---|
| 1909 | uint16_t numRows; /**< number of rows in the data table. */
|
---|
| 1910 | uint16_t numCols; /**< number of columns in the data table. */
|
---|
| 1911 | q31_t *pData; /**< points to the data table. */
|
---|
| 1912 | } arm_bilinear_interp_instance_q31;
|
---|
| 1913 |
|
---|
| 1914 | /**
|
---|
| 1915 | * @brief Instance structure for the Q15 bilinear interpolation function.
|
---|
| 1916 | */
|
---|
| 1917 |
|
---|
| 1918 | typedef struct
|
---|
| 1919 | {
|
---|
| 1920 | uint16_t numRows; /**< number of rows in the data table. */
|
---|
| 1921 | uint16_t numCols; /**< number of columns in the data table. */
|
---|
| 1922 | q15_t *pData; /**< points to the data table. */
|
---|
| 1923 | } arm_bilinear_interp_instance_q15;
|
---|
| 1924 |
|
---|
| 1925 | /**
|
---|
| 1926 | * @brief Instance structure for the Q15 bilinear interpolation function.
|
---|
| 1927 | */
|
---|
| 1928 |
|
---|
| 1929 | typedef struct
|
---|
| 1930 | {
|
---|
| 1931 | uint16_t numRows; /**< number of rows in the data table. */
|
---|
| 1932 | uint16_t numCols; /**< number of columns in the data table. */
|
---|
| 1933 | q7_t *pData; /**< points to the data table. */
|
---|
| 1934 | } arm_bilinear_interp_instance_q7;
|
---|
| 1935 |
|
---|
| 1936 |
|
---|
| 1937 | /**
|
---|
| 1938 | * @brief Q7 vector multiplication.
|
---|
| 1939 | * @param[in] *pSrcA points to the first input vector
|
---|
| 1940 | * @param[in] *pSrcB points to the second input vector
|
---|
| 1941 | * @param[out] *pDst points to the output vector
|
---|
| 1942 | * @param[in] blockSize number of samples in each vector
|
---|
| 1943 | * @return none.
|
---|
| 1944 | */
|
---|
| 1945 |
|
---|
| 1946 | void arm_mult_q7(
|
---|
| 1947 | q7_t * pSrcA,
|
---|
| 1948 | q7_t * pSrcB,
|
---|
| 1949 | q7_t * pDst,
|
---|
| 1950 | uint32_t blockSize);
|
---|
| 1951 |
|
---|
| 1952 | /**
|
---|
| 1953 | * @brief Q15 vector multiplication.
|
---|
| 1954 | * @param[in] *pSrcA points to the first input vector
|
---|
| 1955 | * @param[in] *pSrcB points to the second input vector
|
---|
| 1956 | * @param[out] *pDst points to the output vector
|
---|
| 1957 | * @param[in] blockSize number of samples in each vector
|
---|
| 1958 | * @return none.
|
---|
| 1959 | */
|
---|
| 1960 |
|
---|
| 1961 | void arm_mult_q15(
|
---|
| 1962 | q15_t * pSrcA,
|
---|
| 1963 | q15_t * pSrcB,
|
---|
| 1964 | q15_t * pDst,
|
---|
| 1965 | uint32_t blockSize);
|
---|
| 1966 |
|
---|
| 1967 | /**
|
---|
| 1968 | * @brief Q31 vector multiplication.
|
---|
| 1969 | * @param[in] *pSrcA points to the first input vector
|
---|
| 1970 | * @param[in] *pSrcB points to the second input vector
|
---|
| 1971 | * @param[out] *pDst points to the output vector
|
---|
| 1972 | * @param[in] blockSize number of samples in each vector
|
---|
| 1973 | * @return none.
|
---|
| 1974 | */
|
---|
| 1975 |
|
---|
| 1976 | void arm_mult_q31(
|
---|
| 1977 | q31_t * pSrcA,
|
---|
| 1978 | q31_t * pSrcB,
|
---|
| 1979 | q31_t * pDst,
|
---|
| 1980 | uint32_t blockSize);
|
---|
| 1981 |
|
---|
| 1982 | /**
|
---|
| 1983 | * @brief Floating-point vector multiplication.
|
---|
| 1984 | * @param[in] *pSrcA points to the first input vector
|
---|
| 1985 | * @param[in] *pSrcB points to the second input vector
|
---|
| 1986 | * @param[out] *pDst points to the output vector
|
---|
| 1987 | * @param[in] blockSize number of samples in each vector
|
---|
| 1988 | * @return none.
|
---|
| 1989 | */
|
---|
| 1990 |
|
---|
| 1991 | void arm_mult_f32(
|
---|
| 1992 | float32_t * pSrcA,
|
---|
| 1993 | float32_t * pSrcB,
|
---|
| 1994 | float32_t * pDst,
|
---|
| 1995 | uint32_t blockSize);
|
---|
| 1996 |
|
---|
| 1997 |
|
---|
| 1998 |
|
---|
| 1999 |
|
---|
| 2000 |
|
---|
| 2001 |
|
---|
| 2002 | /**
|
---|
| 2003 | * @brief Instance structure for the Q15 CFFT/CIFFT function.
|
---|
| 2004 | */
|
---|
| 2005 |
|
---|
| 2006 | typedef struct
|
---|
| 2007 | {
|
---|
| 2008 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2009 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
|
---|
| 2010 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
|
---|
| 2011 | q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
|
---|
| 2012 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2013 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2014 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
|
---|
| 2015 | } arm_cfft_radix2_instance_q15;
|
---|
| 2016 |
|
---|
| 2017 | arm_status arm_cfft_radix2_init_q15(
|
---|
| 2018 | arm_cfft_radix2_instance_q15 * S,
|
---|
| 2019 | uint16_t fftLen,
|
---|
| 2020 | uint8_t ifftFlag,
|
---|
| 2021 | uint8_t bitReverseFlag);
|
---|
| 2022 |
|
---|
| 2023 | void arm_cfft_radix2_q15(
|
---|
| 2024 | const arm_cfft_radix2_instance_q15 * S,
|
---|
| 2025 | q15_t * pSrc);
|
---|
| 2026 |
|
---|
| 2027 |
|
---|
| 2028 |
|
---|
| 2029 | /**
|
---|
| 2030 | * @brief Instance structure for the Q15 CFFT/CIFFT function.
|
---|
| 2031 | */
|
---|
| 2032 |
|
---|
| 2033 | typedef struct
|
---|
| 2034 | {
|
---|
| 2035 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2036 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
|
---|
| 2037 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
|
---|
| 2038 | q15_t *pTwiddle; /**< points to the twiddle factor table. */
|
---|
| 2039 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2040 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2041 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
|
---|
| 2042 | } arm_cfft_radix4_instance_q15;
|
---|
| 2043 |
|
---|
| 2044 | arm_status arm_cfft_radix4_init_q15(
|
---|
| 2045 | arm_cfft_radix4_instance_q15 * S,
|
---|
| 2046 | uint16_t fftLen,
|
---|
| 2047 | uint8_t ifftFlag,
|
---|
| 2048 | uint8_t bitReverseFlag);
|
---|
| 2049 |
|
---|
| 2050 | void arm_cfft_radix4_q15(
|
---|
| 2051 | const arm_cfft_radix4_instance_q15 * S,
|
---|
| 2052 | q15_t * pSrc);
|
---|
| 2053 |
|
---|
| 2054 | /**
|
---|
| 2055 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
|
---|
| 2056 | */
|
---|
| 2057 |
|
---|
| 2058 | typedef struct
|
---|
| 2059 | {
|
---|
| 2060 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2061 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
|
---|
| 2062 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
|
---|
| 2063 | q31_t *pTwiddle; /**< points to the Twiddle factor table. */
|
---|
| 2064 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2065 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2066 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
|
---|
| 2067 | } arm_cfft_radix2_instance_q31;
|
---|
| 2068 |
|
---|
| 2069 | arm_status arm_cfft_radix2_init_q31(
|
---|
| 2070 | arm_cfft_radix2_instance_q31 * S,
|
---|
| 2071 | uint16_t fftLen,
|
---|
| 2072 | uint8_t ifftFlag,
|
---|
| 2073 | uint8_t bitReverseFlag);
|
---|
| 2074 |
|
---|
| 2075 | void arm_cfft_radix2_q31(
|
---|
| 2076 | const arm_cfft_radix2_instance_q31 * S,
|
---|
| 2077 | q31_t * pSrc);
|
---|
| 2078 |
|
---|
| 2079 | /**
|
---|
| 2080 | * @brief Instance structure for the Q31 CFFT/CIFFT function.
|
---|
| 2081 | */
|
---|
| 2082 |
|
---|
| 2083 | typedef struct
|
---|
| 2084 | {
|
---|
| 2085 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2086 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
|
---|
| 2087 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
|
---|
| 2088 | q31_t *pTwiddle; /**< points to the twiddle factor table. */
|
---|
| 2089 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2090 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2091 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
|
---|
| 2092 | } arm_cfft_radix4_instance_q31;
|
---|
| 2093 |
|
---|
| 2094 | void arm_cfft_radix4_q31(
|
---|
| 2095 | const arm_cfft_radix4_instance_q31 * S,
|
---|
| 2096 | q31_t * pSrc);
|
---|
| 2097 |
|
---|
| 2098 | arm_status arm_cfft_radix4_init_q31(
|
---|
| 2099 | arm_cfft_radix4_instance_q31 * S,
|
---|
| 2100 | uint16_t fftLen,
|
---|
| 2101 | uint8_t ifftFlag,
|
---|
| 2102 | uint8_t bitReverseFlag);
|
---|
| 2103 |
|
---|
| 2104 | /**
|
---|
| 2105 | * @brief Instance structure for the floating-point CFFT/CIFFT function.
|
---|
| 2106 | */
|
---|
| 2107 |
|
---|
| 2108 | typedef struct
|
---|
| 2109 | {
|
---|
| 2110 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2111 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
|
---|
| 2112 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
|
---|
| 2113 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */
|
---|
| 2114 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2115 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2116 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
|
---|
| 2117 | float32_t onebyfftLen; /**< value of 1/fftLen. */
|
---|
| 2118 | } arm_cfft_radix2_instance_f32;
|
---|
| 2119 |
|
---|
| 2120 | /* Deprecated */
|
---|
| 2121 | arm_status arm_cfft_radix2_init_f32(
|
---|
| 2122 | arm_cfft_radix2_instance_f32 * S,
|
---|
| 2123 | uint16_t fftLen,
|
---|
| 2124 | uint8_t ifftFlag,
|
---|
| 2125 | uint8_t bitReverseFlag);
|
---|
| 2126 |
|
---|
| 2127 | /* Deprecated */
|
---|
| 2128 | void arm_cfft_radix2_f32(
|
---|
| 2129 | const arm_cfft_radix2_instance_f32 * S,
|
---|
| 2130 | float32_t * pSrc);
|
---|
| 2131 |
|
---|
| 2132 | /**
|
---|
| 2133 | * @brief Instance structure for the floating-point CFFT/CIFFT function.
|
---|
| 2134 | */
|
---|
| 2135 |
|
---|
| 2136 | typedef struct
|
---|
| 2137 | {
|
---|
| 2138 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2139 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
|
---|
| 2140 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
|
---|
| 2141 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */
|
---|
| 2142 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2143 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2144 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
|
---|
| 2145 | float32_t onebyfftLen; /**< value of 1/fftLen. */
|
---|
| 2146 | } arm_cfft_radix4_instance_f32;
|
---|
| 2147 |
|
---|
| 2148 | /* Deprecated */
|
---|
| 2149 | arm_status arm_cfft_radix4_init_f32(
|
---|
| 2150 | arm_cfft_radix4_instance_f32 * S,
|
---|
| 2151 | uint16_t fftLen,
|
---|
| 2152 | uint8_t ifftFlag,
|
---|
| 2153 | uint8_t bitReverseFlag);
|
---|
| 2154 |
|
---|
| 2155 | /* Deprecated */
|
---|
| 2156 | void arm_cfft_radix4_f32(
|
---|
| 2157 | const arm_cfft_radix4_instance_f32 * S,
|
---|
| 2158 | float32_t * pSrc);
|
---|
| 2159 |
|
---|
| 2160 | /**
|
---|
| 2161 | * @brief Instance structure for the floating-point CFFT/CIFFT function.
|
---|
| 2162 | */
|
---|
| 2163 |
|
---|
| 2164 | typedef struct
|
---|
| 2165 | {
|
---|
| 2166 | uint16_t fftLen; /**< length of the FFT. */
|
---|
| 2167 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
|
---|
| 2168 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
|
---|
| 2169 | uint16_t bitRevLength; /**< bit reversal table length. */
|
---|
| 2170 | } arm_cfft_instance_f32;
|
---|
| 2171 |
|
---|
| 2172 | void arm_cfft_f32(
|
---|
| 2173 | const arm_cfft_instance_f32 * S,
|
---|
| 2174 | float32_t * p1,
|
---|
| 2175 | uint8_t ifftFlag,
|
---|
| 2176 | uint8_t bitReverseFlag);
|
---|
| 2177 |
|
---|
| 2178 | /**
|
---|
| 2179 | * @brief Instance structure for the Q15 RFFT/RIFFT function.
|
---|
| 2180 | */
|
---|
| 2181 |
|
---|
| 2182 | typedef struct
|
---|
| 2183 | {
|
---|
| 2184 | uint32_t fftLenReal; /**< length of the real FFT. */
|
---|
| 2185 | uint32_t fftLenBy2; /**< length of the complex FFT. */
|
---|
| 2186 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
|
---|
| 2187 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
|
---|
| 2188 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2189 | q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
|
---|
| 2190 | q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
|
---|
| 2191 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
|
---|
| 2192 | } arm_rfft_instance_q15;
|
---|
| 2193 |
|
---|
| 2194 | arm_status arm_rfft_init_q15(
|
---|
| 2195 | arm_rfft_instance_q15 * S,
|
---|
| 2196 | arm_cfft_radix4_instance_q15 * S_CFFT,
|
---|
| 2197 | uint32_t fftLenReal,
|
---|
| 2198 | uint32_t ifftFlagR,
|
---|
| 2199 | uint32_t bitReverseFlag);
|
---|
| 2200 |
|
---|
| 2201 | void arm_rfft_q15(
|
---|
| 2202 | const arm_rfft_instance_q15 * S,
|
---|
| 2203 | q15_t * pSrc,
|
---|
| 2204 | q15_t * pDst);
|
---|
| 2205 |
|
---|
| 2206 | /**
|
---|
| 2207 | * @brief Instance structure for the Q31 RFFT/RIFFT function.
|
---|
| 2208 | */
|
---|
| 2209 |
|
---|
| 2210 | typedef struct
|
---|
| 2211 | {
|
---|
| 2212 | uint32_t fftLenReal; /**< length of the real FFT. */
|
---|
| 2213 | uint32_t fftLenBy2; /**< length of the complex FFT. */
|
---|
| 2214 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
|
---|
| 2215 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
|
---|
| 2216 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2217 | q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
|
---|
| 2218 | q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
|
---|
| 2219 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
|
---|
| 2220 | } arm_rfft_instance_q31;
|
---|
| 2221 |
|
---|
| 2222 | arm_status arm_rfft_init_q31(
|
---|
| 2223 | arm_rfft_instance_q31 * S,
|
---|
| 2224 | arm_cfft_radix4_instance_q31 * S_CFFT,
|
---|
| 2225 | uint32_t fftLenReal,
|
---|
| 2226 | uint32_t ifftFlagR,
|
---|
| 2227 | uint32_t bitReverseFlag);
|
---|
| 2228 |
|
---|
| 2229 | void arm_rfft_q31(
|
---|
| 2230 | const arm_rfft_instance_q31 * S,
|
---|
| 2231 | q31_t * pSrc,
|
---|
| 2232 | q31_t * pDst);
|
---|
| 2233 |
|
---|
| 2234 | /**
|
---|
| 2235 | * @brief Instance structure for the floating-point RFFT/RIFFT function.
|
---|
| 2236 | */
|
---|
| 2237 |
|
---|
| 2238 | typedef struct
|
---|
| 2239 | {
|
---|
| 2240 | uint32_t fftLenReal; /**< length of the real FFT. */
|
---|
| 2241 | uint16_t fftLenBy2; /**< length of the complex FFT. */
|
---|
| 2242 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
|
---|
| 2243 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
|
---|
| 2244 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
|
---|
| 2245 | float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
|
---|
| 2246 | float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
|
---|
| 2247 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
|
---|
| 2248 | } arm_rfft_instance_f32;
|
---|
| 2249 |
|
---|
| 2250 | arm_status arm_rfft_init_f32(
|
---|
| 2251 | arm_rfft_instance_f32 * S,
|
---|
| 2252 | arm_cfft_radix4_instance_f32 * S_CFFT,
|
---|
| 2253 | uint32_t fftLenReal,
|
---|
| 2254 | uint32_t ifftFlagR,
|
---|
| 2255 | uint32_t bitReverseFlag);
|
---|
| 2256 |
|
---|
| 2257 | void arm_rfft_f32(
|
---|
| 2258 | const arm_rfft_instance_f32 * S,
|
---|
| 2259 | float32_t * pSrc,
|
---|
| 2260 | float32_t * pDst);
|
---|
| 2261 |
|
---|
| 2262 | /**
|
---|
| 2263 | * @brief Instance structure for the floating-point RFFT/RIFFT function.
|
---|
| 2264 | */
|
---|
| 2265 |
|
---|
| 2266 | typedef struct
|
---|
| 2267 | {
|
---|
| 2268 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
|
---|
| 2269 | uint16_t fftLenRFFT; /**< length of the real sequence */
|
---|
| 2270 | float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
|
---|
| 2271 | } arm_rfft_fast_instance_f32 ;
|
---|
| 2272 |
|
---|
| 2273 | arm_status arm_rfft_fast_init_f32 (
|
---|
| 2274 | arm_rfft_fast_instance_f32 * S,
|
---|
| 2275 | uint16_t fftLen);
|
---|
| 2276 |
|
---|
| 2277 | void arm_rfft_fast_f32(
|
---|
| 2278 | arm_rfft_fast_instance_f32 * S,
|
---|
| 2279 | float32_t * p, float32_t * pOut,
|
---|
| 2280 | uint8_t ifftFlag);
|
---|
| 2281 |
|
---|
| 2282 | /**
|
---|
| 2283 | * @brief Instance structure for the floating-point DCT4/IDCT4 function.
|
---|
| 2284 | */
|
---|
| 2285 |
|
---|
| 2286 | typedef struct
|
---|
| 2287 | {
|
---|
| 2288 | uint16_t N; /**< length of the DCT4. */
|
---|
| 2289 | uint16_t Nby2; /**< half of the length of the DCT4. */
|
---|
| 2290 | float32_t normalize; /**< normalizing factor. */
|
---|
| 2291 | float32_t *pTwiddle; /**< points to the twiddle factor table. */
|
---|
| 2292 | float32_t *pCosFactor; /**< points to the cosFactor table. */
|
---|
| 2293 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
|
---|
| 2294 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
|
---|
| 2295 | } arm_dct4_instance_f32;
|
---|
| 2296 |
|
---|
| 2297 | /**
|
---|
| 2298 | * @brief Initialization function for the floating-point DCT4/IDCT4.
|
---|
| 2299 | * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
|
---|
| 2300 | * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
|
---|
| 2301 | * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
|
---|
| 2302 | * @param[in] N length of the DCT4.
|
---|
| 2303 | * @param[in] Nby2 half of the length of the DCT4.
|
---|
| 2304 | * @param[in] normalize normalizing factor.
|
---|
| 2305 | * @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.
|
---|
| 2306 | */
|
---|
| 2307 |
|
---|
| 2308 | arm_status arm_dct4_init_f32(
|
---|
| 2309 | arm_dct4_instance_f32 * S,
|
---|
| 2310 | arm_rfft_instance_f32 * S_RFFT,
|
---|
| 2311 | arm_cfft_radix4_instance_f32 * S_CFFT,
|
---|
| 2312 | uint16_t N,
|
---|
| 2313 | uint16_t Nby2,
|
---|
| 2314 | float32_t normalize);
|
---|
| 2315 |
|
---|
| 2316 | /**
|
---|
| 2317 | * @brief Processing function for the floating-point DCT4/IDCT4.
|
---|
| 2318 | * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
|
---|
| 2319 | * @param[in] *pState points to state buffer.
|
---|
| 2320 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
|
---|
| 2321 | * @return none.
|
---|
| 2322 | */
|
---|
| 2323 |
|
---|
| 2324 | void arm_dct4_f32(
|
---|
| 2325 | const arm_dct4_instance_f32 * S,
|
---|
| 2326 | float32_t * pState,
|
---|
| 2327 | float32_t * pInlineBuffer);
|
---|
| 2328 |
|
---|
| 2329 | /**
|
---|
| 2330 | * @brief Instance structure for the Q31 DCT4/IDCT4 function.
|
---|
| 2331 | */
|
---|
| 2332 |
|
---|
| 2333 | typedef struct
|
---|
| 2334 | {
|
---|
| 2335 | uint16_t N; /**< length of the DCT4. */
|
---|
| 2336 | uint16_t Nby2; /**< half of the length of the DCT4. */
|
---|
| 2337 | q31_t normalize; /**< normalizing factor. */
|
---|
| 2338 | q31_t *pTwiddle; /**< points to the twiddle factor table. */
|
---|
| 2339 | q31_t *pCosFactor; /**< points to the cosFactor table. */
|
---|
| 2340 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
|
---|
| 2341 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
|
---|
| 2342 | } arm_dct4_instance_q31;
|
---|
| 2343 |
|
---|
| 2344 | /**
|
---|
| 2345 | * @brief Initialization function for the Q31 DCT4/IDCT4.
|
---|
| 2346 | * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
|
---|
| 2347 | * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
|
---|
| 2348 | * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
|
---|
| 2349 | * @param[in] N length of the DCT4.
|
---|
| 2350 | * @param[in] Nby2 half of the length of the DCT4.
|
---|
| 2351 | * @param[in] normalize normalizing factor.
|
---|
| 2352 | * @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.
|
---|
| 2353 | */
|
---|
| 2354 |
|
---|
| 2355 | arm_status arm_dct4_init_q31(
|
---|
| 2356 | arm_dct4_instance_q31 * S,
|
---|
| 2357 | arm_rfft_instance_q31 * S_RFFT,
|
---|
| 2358 | arm_cfft_radix4_instance_q31 * S_CFFT,
|
---|
| 2359 | uint16_t N,
|
---|
| 2360 | uint16_t Nby2,
|
---|
| 2361 | q31_t normalize);
|
---|
| 2362 |
|
---|
| 2363 | /**
|
---|
| 2364 | * @brief Processing function for the Q31 DCT4/IDCT4.
|
---|
| 2365 | * @param[in] *S points to an instance of the Q31 DCT4 structure.
|
---|
| 2366 | * @param[in] *pState points to state buffer.
|
---|
| 2367 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
|
---|
| 2368 | * @return none.
|
---|
| 2369 | */
|
---|
| 2370 |
|
---|
| 2371 | void arm_dct4_q31(
|
---|
| 2372 | const arm_dct4_instance_q31 * S,
|
---|
| 2373 | q31_t * pState,
|
---|
| 2374 | q31_t * pInlineBuffer);
|
---|
| 2375 |
|
---|
| 2376 | /**
|
---|
| 2377 | * @brief Instance structure for the Q15 DCT4/IDCT4 function.
|
---|
| 2378 | */
|
---|
| 2379 |
|
---|
| 2380 | typedef struct
|
---|
| 2381 | {
|
---|
| 2382 | uint16_t N; /**< length of the DCT4. */
|
---|
| 2383 | uint16_t Nby2; /**< half of the length of the DCT4. */
|
---|
| 2384 | q15_t normalize; /**< normalizing factor. */
|
---|
| 2385 | q15_t *pTwiddle; /**< points to the twiddle factor table. */
|
---|
| 2386 | q15_t *pCosFactor; /**< points to the cosFactor table. */
|
---|
| 2387 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
|
---|
| 2388 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
|
---|
| 2389 | } arm_dct4_instance_q15;
|
---|
| 2390 |
|
---|
| 2391 | /**
|
---|
| 2392 | * @brief Initialization function for the Q15 DCT4/IDCT4.
|
---|
| 2393 | * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
|
---|
| 2394 | * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
|
---|
| 2395 | * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
|
---|
| 2396 | * @param[in] N length of the DCT4.
|
---|
| 2397 | * @param[in] Nby2 half of the length of the DCT4.
|
---|
| 2398 | * @param[in] normalize normalizing factor.
|
---|
| 2399 | * @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.
|
---|
| 2400 | */
|
---|
| 2401 |
|
---|
| 2402 | arm_status arm_dct4_init_q15(
|
---|
| 2403 | arm_dct4_instance_q15 * S,
|
---|
| 2404 | arm_rfft_instance_q15 * S_RFFT,
|
---|
| 2405 | arm_cfft_radix4_instance_q15 * S_CFFT,
|
---|
| 2406 | uint16_t N,
|
---|
| 2407 | uint16_t Nby2,
|
---|
| 2408 | q15_t normalize);
|
---|
| 2409 |
|
---|
| 2410 | /**
|
---|
| 2411 | * @brief Processing function for the Q15 DCT4/IDCT4.
|
---|
| 2412 | * @param[in] *S points to an instance of the Q15 DCT4 structure.
|
---|
| 2413 | * @param[in] *pState points to state buffer.
|
---|
| 2414 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
|
---|
| 2415 | * @return none.
|
---|
| 2416 | */
|
---|
| 2417 |
|
---|
| 2418 | void arm_dct4_q15(
|
---|
| 2419 | const arm_dct4_instance_q15 * S,
|
---|
| 2420 | q15_t * pState,
|
---|
| 2421 | q15_t * pInlineBuffer);
|
---|
| 2422 |
|
---|
| 2423 | /**
|
---|
| 2424 | * @brief Floating-point vector addition.
|
---|
| 2425 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2426 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2427 | * @param[out] *pDst points to the output vector
|
---|
| 2428 | * @param[in] blockSize number of samples in each vector
|
---|
| 2429 | * @return none.
|
---|
| 2430 | */
|
---|
| 2431 |
|
---|
| 2432 | void arm_add_f32(
|
---|
| 2433 | float32_t * pSrcA,
|
---|
| 2434 | float32_t * pSrcB,
|
---|
| 2435 | float32_t * pDst,
|
---|
| 2436 | uint32_t blockSize);
|
---|
| 2437 |
|
---|
| 2438 | /**
|
---|
| 2439 | * @brief Q7 vector addition.
|
---|
| 2440 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2441 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2442 | * @param[out] *pDst points to the output vector
|
---|
| 2443 | * @param[in] blockSize number of samples in each vector
|
---|
| 2444 | * @return none.
|
---|
| 2445 | */
|
---|
| 2446 |
|
---|
| 2447 | void arm_add_q7(
|
---|
| 2448 | q7_t * pSrcA,
|
---|
| 2449 | q7_t * pSrcB,
|
---|
| 2450 | q7_t * pDst,
|
---|
| 2451 | uint32_t blockSize);
|
---|
| 2452 |
|
---|
| 2453 | /**
|
---|
| 2454 | * @brief Q15 vector addition.
|
---|
| 2455 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2456 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2457 | * @param[out] *pDst points to the output vector
|
---|
| 2458 | * @param[in] blockSize number of samples in each vector
|
---|
| 2459 | * @return none.
|
---|
| 2460 | */
|
---|
| 2461 |
|
---|
| 2462 | void arm_add_q15(
|
---|
| 2463 | q15_t * pSrcA,
|
---|
| 2464 | q15_t * pSrcB,
|
---|
| 2465 | q15_t * pDst,
|
---|
| 2466 | uint32_t blockSize);
|
---|
| 2467 |
|
---|
| 2468 | /**
|
---|
| 2469 | * @brief Q31 vector addition.
|
---|
| 2470 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2471 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2472 | * @param[out] *pDst points to the output vector
|
---|
| 2473 | * @param[in] blockSize number of samples in each vector
|
---|
| 2474 | * @return none.
|
---|
| 2475 | */
|
---|
| 2476 |
|
---|
| 2477 | void arm_add_q31(
|
---|
| 2478 | q31_t * pSrcA,
|
---|
| 2479 | q31_t * pSrcB,
|
---|
| 2480 | q31_t * pDst,
|
---|
| 2481 | uint32_t blockSize);
|
---|
| 2482 |
|
---|
| 2483 | /**
|
---|
| 2484 | * @brief Floating-point vector subtraction.
|
---|
| 2485 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2486 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2487 | * @param[out] *pDst points to the output vector
|
---|
| 2488 | * @param[in] blockSize number of samples in each vector
|
---|
| 2489 | * @return none.
|
---|
| 2490 | */
|
---|
| 2491 |
|
---|
| 2492 | void arm_sub_f32(
|
---|
| 2493 | float32_t * pSrcA,
|
---|
| 2494 | float32_t * pSrcB,
|
---|
| 2495 | float32_t * pDst,
|
---|
| 2496 | uint32_t blockSize);
|
---|
| 2497 |
|
---|
| 2498 | /**
|
---|
| 2499 | * @brief Q7 vector subtraction.
|
---|
| 2500 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2501 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2502 | * @param[out] *pDst points to the output vector
|
---|
| 2503 | * @param[in] blockSize number of samples in each vector
|
---|
| 2504 | * @return none.
|
---|
| 2505 | */
|
---|
| 2506 |
|
---|
| 2507 | void arm_sub_q7(
|
---|
| 2508 | q7_t * pSrcA,
|
---|
| 2509 | q7_t * pSrcB,
|
---|
| 2510 | q7_t * pDst,
|
---|
| 2511 | uint32_t blockSize);
|
---|
| 2512 |
|
---|
| 2513 | /**
|
---|
| 2514 | * @brief Q15 vector subtraction.
|
---|
| 2515 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2516 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2517 | * @param[out] *pDst points to the output vector
|
---|
| 2518 | * @param[in] blockSize number of samples in each vector
|
---|
| 2519 | * @return none.
|
---|
| 2520 | */
|
---|
| 2521 |
|
---|
| 2522 | void arm_sub_q15(
|
---|
| 2523 | q15_t * pSrcA,
|
---|
| 2524 | q15_t * pSrcB,
|
---|
| 2525 | q15_t * pDst,
|
---|
| 2526 | uint32_t blockSize);
|
---|
| 2527 |
|
---|
| 2528 | /**
|
---|
| 2529 | * @brief Q31 vector subtraction.
|
---|
| 2530 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2531 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2532 | * @param[out] *pDst points to the output vector
|
---|
| 2533 | * @param[in] blockSize number of samples in each vector
|
---|
| 2534 | * @return none.
|
---|
| 2535 | */
|
---|
| 2536 |
|
---|
| 2537 | void arm_sub_q31(
|
---|
| 2538 | q31_t * pSrcA,
|
---|
| 2539 | q31_t * pSrcB,
|
---|
| 2540 | q31_t * pDst,
|
---|
| 2541 | uint32_t blockSize);
|
---|
| 2542 |
|
---|
| 2543 | /**
|
---|
| 2544 | * @brief Multiplies a floating-point vector by a scalar.
|
---|
| 2545 | * @param[in] *pSrc points to the input vector
|
---|
| 2546 | * @param[in] scale scale factor to be applied
|
---|
| 2547 | * @param[out] *pDst points to the output vector
|
---|
| 2548 | * @param[in] blockSize number of samples in the vector
|
---|
| 2549 | * @return none.
|
---|
| 2550 | */
|
---|
| 2551 |
|
---|
| 2552 | void arm_scale_f32(
|
---|
| 2553 | float32_t * pSrc,
|
---|
| 2554 | float32_t scale,
|
---|
| 2555 | float32_t * pDst,
|
---|
| 2556 | uint32_t blockSize);
|
---|
| 2557 |
|
---|
| 2558 | /**
|
---|
| 2559 | * @brief Multiplies a Q7 vector by a scalar.
|
---|
| 2560 | * @param[in] *pSrc points to the input vector
|
---|
| 2561 | * @param[in] scaleFract fractional portion of the scale value
|
---|
| 2562 | * @param[in] shift number of bits to shift the result by
|
---|
| 2563 | * @param[out] *pDst points to the output vector
|
---|
| 2564 | * @param[in] blockSize number of samples in the vector
|
---|
| 2565 | * @return none.
|
---|
| 2566 | */
|
---|
| 2567 |
|
---|
| 2568 | void arm_scale_q7(
|
---|
| 2569 | q7_t * pSrc,
|
---|
| 2570 | q7_t scaleFract,
|
---|
| 2571 | int8_t shift,
|
---|
| 2572 | q7_t * pDst,
|
---|
| 2573 | uint32_t blockSize);
|
---|
| 2574 |
|
---|
| 2575 | /**
|
---|
| 2576 | * @brief Multiplies a Q15 vector by a scalar.
|
---|
| 2577 | * @param[in] *pSrc points to the input vector
|
---|
| 2578 | * @param[in] scaleFract fractional portion of the scale value
|
---|
| 2579 | * @param[in] shift number of bits to shift the result by
|
---|
| 2580 | * @param[out] *pDst points to the output vector
|
---|
| 2581 | * @param[in] blockSize number of samples in the vector
|
---|
| 2582 | * @return none.
|
---|
| 2583 | */
|
---|
| 2584 |
|
---|
| 2585 | void arm_scale_q15(
|
---|
| 2586 | q15_t * pSrc,
|
---|
| 2587 | q15_t scaleFract,
|
---|
| 2588 | int8_t shift,
|
---|
| 2589 | q15_t * pDst,
|
---|
| 2590 | uint32_t blockSize);
|
---|
| 2591 |
|
---|
| 2592 | /**
|
---|
| 2593 | * @brief Multiplies a Q31 vector by a scalar.
|
---|
| 2594 | * @param[in] *pSrc points to the input vector
|
---|
| 2595 | * @param[in] scaleFract fractional portion of the scale value
|
---|
| 2596 | * @param[in] shift number of bits to shift the result by
|
---|
| 2597 | * @param[out] *pDst points to the output vector
|
---|
| 2598 | * @param[in] blockSize number of samples in the vector
|
---|
| 2599 | * @return none.
|
---|
| 2600 | */
|
---|
| 2601 |
|
---|
| 2602 | void arm_scale_q31(
|
---|
| 2603 | q31_t * pSrc,
|
---|
| 2604 | q31_t scaleFract,
|
---|
| 2605 | int8_t shift,
|
---|
| 2606 | q31_t * pDst,
|
---|
| 2607 | uint32_t blockSize);
|
---|
| 2608 |
|
---|
| 2609 | /**
|
---|
| 2610 | * @brief Q7 vector absolute value.
|
---|
| 2611 | * @param[in] *pSrc points to the input buffer
|
---|
| 2612 | * @param[out] *pDst points to the output buffer
|
---|
| 2613 | * @param[in] blockSize number of samples in each vector
|
---|
| 2614 | * @return none.
|
---|
| 2615 | */
|
---|
| 2616 |
|
---|
| 2617 | void arm_abs_q7(
|
---|
| 2618 | q7_t * pSrc,
|
---|
| 2619 | q7_t * pDst,
|
---|
| 2620 | uint32_t blockSize);
|
---|
| 2621 |
|
---|
| 2622 | /**
|
---|
| 2623 | * @brief Floating-point vector absolute value.
|
---|
| 2624 | * @param[in] *pSrc points to the input buffer
|
---|
| 2625 | * @param[out] *pDst points to the output buffer
|
---|
| 2626 | * @param[in] blockSize number of samples in each vector
|
---|
| 2627 | * @return none.
|
---|
| 2628 | */
|
---|
| 2629 |
|
---|
| 2630 | void arm_abs_f32(
|
---|
| 2631 | float32_t * pSrc,
|
---|
| 2632 | float32_t * pDst,
|
---|
| 2633 | uint32_t blockSize);
|
---|
| 2634 |
|
---|
| 2635 | /**
|
---|
| 2636 | * @brief Q15 vector absolute value.
|
---|
| 2637 | * @param[in] *pSrc points to the input buffer
|
---|
| 2638 | * @param[out] *pDst points to the output buffer
|
---|
| 2639 | * @param[in] blockSize number of samples in each vector
|
---|
| 2640 | * @return none.
|
---|
| 2641 | */
|
---|
| 2642 |
|
---|
| 2643 | void arm_abs_q15(
|
---|
| 2644 | q15_t * pSrc,
|
---|
| 2645 | q15_t * pDst,
|
---|
| 2646 | uint32_t blockSize);
|
---|
| 2647 |
|
---|
| 2648 | /**
|
---|
| 2649 | * @brief Q31 vector absolute value.
|
---|
| 2650 | * @param[in] *pSrc points to the input buffer
|
---|
| 2651 | * @param[out] *pDst points to the output buffer
|
---|
| 2652 | * @param[in] blockSize number of samples in each vector
|
---|
| 2653 | * @return none.
|
---|
| 2654 | */
|
---|
| 2655 |
|
---|
| 2656 | void arm_abs_q31(
|
---|
| 2657 | q31_t * pSrc,
|
---|
| 2658 | q31_t * pDst,
|
---|
| 2659 | uint32_t blockSize);
|
---|
| 2660 |
|
---|
| 2661 | /**
|
---|
| 2662 | * @brief Dot product of floating-point vectors.
|
---|
| 2663 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2664 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2665 | * @param[in] blockSize number of samples in each vector
|
---|
| 2666 | * @param[out] *result output result returned here
|
---|
| 2667 | * @return none.
|
---|
| 2668 | */
|
---|
| 2669 |
|
---|
| 2670 | void arm_dot_prod_f32(
|
---|
| 2671 | float32_t * pSrcA,
|
---|
| 2672 | float32_t * pSrcB,
|
---|
| 2673 | uint32_t blockSize,
|
---|
| 2674 | float32_t * result);
|
---|
| 2675 |
|
---|
| 2676 | /**
|
---|
| 2677 | * @brief Dot product of Q7 vectors.
|
---|
| 2678 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2679 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2680 | * @param[in] blockSize number of samples in each vector
|
---|
| 2681 | * @param[out] *result output result returned here
|
---|
| 2682 | * @return none.
|
---|
| 2683 | */
|
---|
| 2684 |
|
---|
| 2685 | void arm_dot_prod_q7(
|
---|
| 2686 | q7_t * pSrcA,
|
---|
| 2687 | q7_t * pSrcB,
|
---|
| 2688 | uint32_t blockSize,
|
---|
| 2689 | q31_t * result);
|
---|
| 2690 |
|
---|
| 2691 | /**
|
---|
| 2692 | * @brief Dot product of Q15 vectors.
|
---|
| 2693 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2694 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2695 | * @param[in] blockSize number of samples in each vector
|
---|
| 2696 | * @param[out] *result output result returned here
|
---|
| 2697 | * @return none.
|
---|
| 2698 | */
|
---|
| 2699 |
|
---|
| 2700 | void arm_dot_prod_q15(
|
---|
| 2701 | q15_t * pSrcA,
|
---|
| 2702 | q15_t * pSrcB,
|
---|
| 2703 | uint32_t blockSize,
|
---|
| 2704 | q63_t * result);
|
---|
| 2705 |
|
---|
| 2706 | /**
|
---|
| 2707 | * @brief Dot product of Q31 vectors.
|
---|
| 2708 | * @param[in] *pSrcA points to the first input vector
|
---|
| 2709 | * @param[in] *pSrcB points to the second input vector
|
---|
| 2710 | * @param[in] blockSize number of samples in each vector
|
---|
| 2711 | * @param[out] *result output result returned here
|
---|
| 2712 | * @return none.
|
---|
| 2713 | */
|
---|
| 2714 |
|
---|
| 2715 | void arm_dot_prod_q31(
|
---|
| 2716 | q31_t * pSrcA,
|
---|
| 2717 | q31_t * pSrcB,
|
---|
| 2718 | uint32_t blockSize,
|
---|
| 2719 | q63_t * result);
|
---|
| 2720 |
|
---|
| 2721 | /**
|
---|
| 2722 | * @brief Shifts the elements of a Q7 vector a specified number of bits.
|
---|
| 2723 | * @param[in] *pSrc points to the input vector
|
---|
| 2724 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
|
---|
| 2725 | * @param[out] *pDst points to the output vector
|
---|
| 2726 | * @param[in] blockSize number of samples in the vector
|
---|
| 2727 | * @return none.
|
---|
| 2728 | */
|
---|
| 2729 |
|
---|
| 2730 | void arm_shift_q7(
|
---|
| 2731 | q7_t * pSrc,
|
---|
| 2732 | int8_t shiftBits,
|
---|
| 2733 | q7_t * pDst,
|
---|
| 2734 | uint32_t blockSize);
|
---|
| 2735 |
|
---|
| 2736 | /**
|
---|
| 2737 | * @brief Shifts the elements of a Q15 vector a specified number of bits.
|
---|
| 2738 | * @param[in] *pSrc points to the input vector
|
---|
| 2739 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
|
---|
| 2740 | * @param[out] *pDst points to the output vector
|
---|
| 2741 | * @param[in] blockSize number of samples in the vector
|
---|
| 2742 | * @return none.
|
---|
| 2743 | */
|
---|
| 2744 |
|
---|
| 2745 | void arm_shift_q15(
|
---|
| 2746 | q15_t * pSrc,
|
---|
| 2747 | int8_t shiftBits,
|
---|
| 2748 | q15_t * pDst,
|
---|
| 2749 | uint32_t blockSize);
|
---|
| 2750 |
|
---|
| 2751 | /**
|
---|
| 2752 | * @brief Shifts the elements of a Q31 vector a specified number of bits.
|
---|
| 2753 | * @param[in] *pSrc points to the input vector
|
---|
| 2754 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
|
---|
| 2755 | * @param[out] *pDst points to the output vector
|
---|
| 2756 | * @param[in] blockSize number of samples in the vector
|
---|
| 2757 | * @return none.
|
---|
| 2758 | */
|
---|
| 2759 |
|
---|
| 2760 | void arm_shift_q31(
|
---|
| 2761 | q31_t * pSrc,
|
---|
| 2762 | int8_t shiftBits,
|
---|
| 2763 | q31_t * pDst,
|
---|
| 2764 | uint32_t blockSize);
|
---|
| 2765 |
|
---|
| 2766 | /**
|
---|
| 2767 | * @brief Adds a constant offset to a floating-point vector.
|
---|
| 2768 | * @param[in] *pSrc points to the input vector
|
---|
| 2769 | * @param[in] offset is the offset to be added
|
---|
| 2770 | * @param[out] *pDst points to the output vector
|
---|
| 2771 | * @param[in] blockSize number of samples in the vector
|
---|
| 2772 | * @return none.
|
---|
| 2773 | */
|
---|
| 2774 |
|
---|
| 2775 | void arm_offset_f32(
|
---|
| 2776 | float32_t * pSrc,
|
---|
| 2777 | float32_t offset,
|
---|
| 2778 | float32_t * pDst,
|
---|
| 2779 | uint32_t blockSize);
|
---|
| 2780 |
|
---|
| 2781 | /**
|
---|
| 2782 | * @brief Adds a constant offset to a Q7 vector.
|
---|
| 2783 | * @param[in] *pSrc points to the input vector
|
---|
| 2784 | * @param[in] offset is the offset to be added
|
---|
| 2785 | * @param[out] *pDst points to the output vector
|
---|
| 2786 | * @param[in] blockSize number of samples in the vector
|
---|
| 2787 | * @return none.
|
---|
| 2788 | */
|
---|
| 2789 |
|
---|
| 2790 | void arm_offset_q7(
|
---|
| 2791 | q7_t * pSrc,
|
---|
| 2792 | q7_t offset,
|
---|
| 2793 | q7_t * pDst,
|
---|
| 2794 | uint32_t blockSize);
|
---|
| 2795 |
|
---|
| 2796 | /**
|
---|
| 2797 | * @brief Adds a constant offset to a Q15 vector.
|
---|
| 2798 | * @param[in] *pSrc points to the input vector
|
---|
| 2799 | * @param[in] offset is the offset to be added
|
---|
| 2800 | * @param[out] *pDst points to the output vector
|
---|
| 2801 | * @param[in] blockSize number of samples in the vector
|
---|
| 2802 | * @return none.
|
---|
| 2803 | */
|
---|
| 2804 |
|
---|
| 2805 | void arm_offset_q15(
|
---|
| 2806 | q15_t * pSrc,
|
---|
| 2807 | q15_t offset,
|
---|
| 2808 | q15_t * pDst,
|
---|
| 2809 | uint32_t blockSize);
|
---|
| 2810 |
|
---|
| 2811 | /**
|
---|
| 2812 | * @brief Adds a constant offset to a Q31 vector.
|
---|
| 2813 | * @param[in] *pSrc points to the input vector
|
---|
| 2814 | * @param[in] offset is the offset to be added
|
---|
| 2815 | * @param[out] *pDst points to the output vector
|
---|
| 2816 | * @param[in] blockSize number of samples in the vector
|
---|
| 2817 | * @return none.
|
---|
| 2818 | */
|
---|
| 2819 |
|
---|
| 2820 | void arm_offset_q31(
|
---|
| 2821 | q31_t * pSrc,
|
---|
| 2822 | q31_t offset,
|
---|
| 2823 | q31_t * pDst,
|
---|
| 2824 | uint32_t blockSize);
|
---|
| 2825 |
|
---|
| 2826 | /**
|
---|
| 2827 | * @brief Negates the elements of a floating-point vector.
|
---|
| 2828 | * @param[in] *pSrc points to the input vector
|
---|
| 2829 | * @param[out] *pDst points to the output vector
|
---|
| 2830 | * @param[in] blockSize number of samples in the vector
|
---|
| 2831 | * @return none.
|
---|
| 2832 | */
|
---|
| 2833 |
|
---|
| 2834 | void arm_negate_f32(
|
---|
| 2835 | float32_t * pSrc,
|
---|
| 2836 | float32_t * pDst,
|
---|
| 2837 | uint32_t blockSize);
|
---|
| 2838 |
|
---|
| 2839 | /**
|
---|
| 2840 | * @brief Negates the elements of a Q7 vector.
|
---|
| 2841 | * @param[in] *pSrc points to the input vector
|
---|
| 2842 | * @param[out] *pDst points to the output vector
|
---|
| 2843 | * @param[in] blockSize number of samples in the vector
|
---|
| 2844 | * @return none.
|
---|
| 2845 | */
|
---|
| 2846 |
|
---|
| 2847 | void arm_negate_q7(
|
---|
| 2848 | q7_t * pSrc,
|
---|
| 2849 | q7_t * pDst,
|
---|
| 2850 | uint32_t blockSize);
|
---|
| 2851 |
|
---|
| 2852 | /**
|
---|
| 2853 | * @brief Negates the elements of a Q15 vector.
|
---|
| 2854 | * @param[in] *pSrc points to the input vector
|
---|
| 2855 | * @param[out] *pDst points to the output vector
|
---|
| 2856 | * @param[in] blockSize number of samples in the vector
|
---|
| 2857 | * @return none.
|
---|
| 2858 | */
|
---|
| 2859 |
|
---|
| 2860 | void arm_negate_q15(
|
---|
| 2861 | q15_t * pSrc,
|
---|
| 2862 | q15_t * pDst,
|
---|
| 2863 | uint32_t blockSize);
|
---|
| 2864 |
|
---|
| 2865 | /**
|
---|
| 2866 | * @brief Negates the elements of a Q31 vector.
|
---|
| 2867 | * @param[in] *pSrc points to the input vector
|
---|
| 2868 | * @param[out] *pDst points to the output vector
|
---|
| 2869 | * @param[in] blockSize number of samples in the vector
|
---|
| 2870 | * @return none.
|
---|
| 2871 | */
|
---|
| 2872 |
|
---|
| 2873 | void arm_negate_q31(
|
---|
| 2874 | q31_t * pSrc,
|
---|
| 2875 | q31_t * pDst,
|
---|
| 2876 | uint32_t blockSize);
|
---|
| 2877 | /**
|
---|
| 2878 | * @brief Copies the elements of a floating-point vector.
|
---|
| 2879 | * @param[in] *pSrc input pointer
|
---|
| 2880 | * @param[out] *pDst output pointer
|
---|
| 2881 | * @param[in] blockSize number of samples to process
|
---|
| 2882 | * @return none.
|
---|
| 2883 | */
|
---|
| 2884 | void arm_copy_f32(
|
---|
| 2885 | float32_t * pSrc,
|
---|
| 2886 | float32_t * pDst,
|
---|
| 2887 | uint32_t blockSize);
|
---|
| 2888 |
|
---|
| 2889 | /**
|
---|
| 2890 | * @brief Copies the elements of a Q7 vector.
|
---|
| 2891 | * @param[in] *pSrc input pointer
|
---|
| 2892 | * @param[out] *pDst output pointer
|
---|
| 2893 | * @param[in] blockSize number of samples to process
|
---|
| 2894 | * @return none.
|
---|
| 2895 | */
|
---|
| 2896 | void arm_copy_q7(
|
---|
| 2897 | q7_t * pSrc,
|
---|
| 2898 | q7_t * pDst,
|
---|
| 2899 | uint32_t blockSize);
|
---|
| 2900 |
|
---|
| 2901 | /**
|
---|
| 2902 | * @brief Copies the elements of a Q15 vector.
|
---|
| 2903 | * @param[in] *pSrc input pointer
|
---|
| 2904 | * @param[out] *pDst output pointer
|
---|
| 2905 | * @param[in] blockSize number of samples to process
|
---|
| 2906 | * @return none.
|
---|
| 2907 | */
|
---|
| 2908 | void arm_copy_q15(
|
---|
| 2909 | q15_t * pSrc,
|
---|
| 2910 | q15_t * pDst,
|
---|
| 2911 | uint32_t blockSize);
|
---|
| 2912 |
|
---|
| 2913 | /**
|
---|
| 2914 | * @brief Copies the elements of a Q31 vector.
|
---|
| 2915 | * @param[in] *pSrc input pointer
|
---|
| 2916 | * @param[out] *pDst output pointer
|
---|
| 2917 | * @param[in] blockSize number of samples to process
|
---|
| 2918 | * @return none.
|
---|
| 2919 | */
|
---|
| 2920 | void arm_copy_q31(
|
---|
| 2921 | q31_t * pSrc,
|
---|
| 2922 | q31_t * pDst,
|
---|
| 2923 | uint32_t blockSize);
|
---|
| 2924 | /**
|
---|
| 2925 | * @brief Fills a constant value into a floating-point vector.
|
---|
| 2926 | * @param[in] value input value to be filled
|
---|
| 2927 | * @param[out] *pDst output pointer
|
---|
| 2928 | * @param[in] blockSize number of samples to process
|
---|
| 2929 | * @return none.
|
---|
| 2930 | */
|
---|
| 2931 | void arm_fill_f32(
|
---|
| 2932 | float32_t value,
|
---|
| 2933 | float32_t * pDst,
|
---|
| 2934 | uint32_t blockSize);
|
---|
| 2935 |
|
---|
| 2936 | /**
|
---|
| 2937 | * @brief Fills a constant value into a Q7 vector.
|
---|
| 2938 | * @param[in] value input value to be filled
|
---|
| 2939 | * @param[out] *pDst output pointer
|
---|
| 2940 | * @param[in] blockSize number of samples to process
|
---|
| 2941 | * @return none.
|
---|
| 2942 | */
|
---|
| 2943 | void arm_fill_q7(
|
---|
| 2944 | q7_t value,
|
---|
| 2945 | q7_t * pDst,
|
---|
| 2946 | uint32_t blockSize);
|
---|
| 2947 |
|
---|
| 2948 | /**
|
---|
| 2949 | * @brief Fills a constant value into a Q15 vector.
|
---|
| 2950 | * @param[in] value input value to be filled
|
---|
| 2951 | * @param[out] *pDst output pointer
|
---|
| 2952 | * @param[in] blockSize number of samples to process
|
---|
| 2953 | * @return none.
|
---|
| 2954 | */
|
---|
| 2955 | void arm_fill_q15(
|
---|
| 2956 | q15_t value,
|
---|
| 2957 | q15_t * pDst,
|
---|
| 2958 | uint32_t blockSize);
|
---|
| 2959 |
|
---|
| 2960 | /**
|
---|
| 2961 | * @brief Fills a constant value into a Q31 vector.
|
---|
| 2962 | * @param[in] value input value to be filled
|
---|
| 2963 | * @param[out] *pDst output pointer
|
---|
| 2964 | * @param[in] blockSize number of samples to process
|
---|
| 2965 | * @return none.
|
---|
| 2966 | */
|
---|
| 2967 | void arm_fill_q31(
|
---|
| 2968 | q31_t value,
|
---|
| 2969 | q31_t * pDst,
|
---|
| 2970 | uint32_t blockSize);
|
---|
| 2971 |
|
---|
| 2972 | /**
|
---|
| 2973 | * @brief Convolution of floating-point sequences.
|
---|
| 2974 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 2975 | * @param[in] srcALen length of the first input sequence.
|
---|
| 2976 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 2977 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 2978 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
|
---|
| 2979 | * @return none.
|
---|
| 2980 | */
|
---|
| 2981 |
|
---|
| 2982 | void arm_conv_f32(
|
---|
| 2983 | float32_t * pSrcA,
|
---|
| 2984 | uint32_t srcALen,
|
---|
| 2985 | float32_t * pSrcB,
|
---|
| 2986 | uint32_t srcBLen,
|
---|
| 2987 | float32_t * pDst);
|
---|
| 2988 |
|
---|
| 2989 |
|
---|
| 2990 | /**
|
---|
| 2991 | * @brief Convolution of Q15 sequences.
|
---|
| 2992 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 2993 | * @param[in] srcALen length of the first input sequence.
|
---|
| 2994 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 2995 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 2996 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 2997 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 2998 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
|
---|
| 2999 | * @return none.
|
---|
| 3000 | */
|
---|
| 3001 |
|
---|
| 3002 |
|
---|
| 3003 | void arm_conv_opt_q15(
|
---|
| 3004 | q15_t * pSrcA,
|
---|
| 3005 | uint32_t srcALen,
|
---|
| 3006 | q15_t * pSrcB,
|
---|
| 3007 | uint32_t srcBLen,
|
---|
| 3008 | q15_t * pDst,
|
---|
| 3009 | q15_t * pScratch1,
|
---|
| 3010 | q15_t * pScratch2);
|
---|
| 3011 |
|
---|
| 3012 |
|
---|
| 3013 | /**
|
---|
| 3014 | * @brief Convolution of Q15 sequences.
|
---|
| 3015 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3016 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3017 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3018 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3019 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
|
---|
| 3020 | * @return none.
|
---|
| 3021 | */
|
---|
| 3022 |
|
---|
| 3023 | void arm_conv_q15(
|
---|
| 3024 | q15_t * pSrcA,
|
---|
| 3025 | uint32_t srcALen,
|
---|
| 3026 | q15_t * pSrcB,
|
---|
| 3027 | uint32_t srcBLen,
|
---|
| 3028 | q15_t * pDst);
|
---|
| 3029 |
|
---|
| 3030 | /**
|
---|
| 3031 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 3032 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3033 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3034 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3035 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3036 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 3037 | * @return none.
|
---|
| 3038 | */
|
---|
| 3039 |
|
---|
| 3040 | void arm_conv_fast_q15(
|
---|
| 3041 | q15_t * pSrcA,
|
---|
| 3042 | uint32_t srcALen,
|
---|
| 3043 | q15_t * pSrcB,
|
---|
| 3044 | uint32_t srcBLen,
|
---|
| 3045 | q15_t * pDst);
|
---|
| 3046 |
|
---|
| 3047 | /**
|
---|
| 3048 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 3049 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3050 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3051 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3052 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3053 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 3054 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 3055 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
|
---|
| 3056 | * @return none.
|
---|
| 3057 | */
|
---|
| 3058 |
|
---|
| 3059 | void arm_conv_fast_opt_q15(
|
---|
| 3060 | q15_t * pSrcA,
|
---|
| 3061 | uint32_t srcALen,
|
---|
| 3062 | q15_t * pSrcB,
|
---|
| 3063 | uint32_t srcBLen,
|
---|
| 3064 | q15_t * pDst,
|
---|
| 3065 | q15_t * pScratch1,
|
---|
| 3066 | q15_t * pScratch2);
|
---|
| 3067 |
|
---|
| 3068 |
|
---|
| 3069 |
|
---|
| 3070 | /**
|
---|
| 3071 | * @brief Convolution of Q31 sequences.
|
---|
| 3072 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3073 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3074 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3075 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3076 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 3077 | * @return none.
|
---|
| 3078 | */
|
---|
| 3079 |
|
---|
| 3080 | void arm_conv_q31(
|
---|
| 3081 | q31_t * pSrcA,
|
---|
| 3082 | uint32_t srcALen,
|
---|
| 3083 | q31_t * pSrcB,
|
---|
| 3084 | uint32_t srcBLen,
|
---|
| 3085 | q31_t * pDst);
|
---|
| 3086 |
|
---|
| 3087 | /**
|
---|
| 3088 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 3089 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3090 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3091 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3092 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3093 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 3094 | * @return none.
|
---|
| 3095 | */
|
---|
| 3096 |
|
---|
| 3097 | void arm_conv_fast_q31(
|
---|
| 3098 | q31_t * pSrcA,
|
---|
| 3099 | uint32_t srcALen,
|
---|
| 3100 | q31_t * pSrcB,
|
---|
| 3101 | uint32_t srcBLen,
|
---|
| 3102 | q31_t * pDst);
|
---|
| 3103 |
|
---|
| 3104 |
|
---|
| 3105 | /**
|
---|
| 3106 | * @brief Convolution of Q7 sequences.
|
---|
| 3107 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3108 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3109 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3110 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3111 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 3112 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 3113 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
|
---|
| 3114 | * @return none.
|
---|
| 3115 | */
|
---|
| 3116 |
|
---|
| 3117 | void arm_conv_opt_q7(
|
---|
| 3118 | q7_t * pSrcA,
|
---|
| 3119 | uint32_t srcALen,
|
---|
| 3120 | q7_t * pSrcB,
|
---|
| 3121 | uint32_t srcBLen,
|
---|
| 3122 | q7_t * pDst,
|
---|
| 3123 | q15_t * pScratch1,
|
---|
| 3124 | q15_t * pScratch2);
|
---|
| 3125 |
|
---|
| 3126 |
|
---|
| 3127 |
|
---|
| 3128 | /**
|
---|
| 3129 | * @brief Convolution of Q7 sequences.
|
---|
| 3130 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3131 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3132 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3133 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3134 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
|
---|
| 3135 | * @return none.
|
---|
| 3136 | */
|
---|
| 3137 |
|
---|
| 3138 | void arm_conv_q7(
|
---|
| 3139 | q7_t * pSrcA,
|
---|
| 3140 | uint32_t srcALen,
|
---|
| 3141 | q7_t * pSrcB,
|
---|
| 3142 | uint32_t srcBLen,
|
---|
| 3143 | q7_t * pDst);
|
---|
| 3144 |
|
---|
| 3145 |
|
---|
| 3146 | /**
|
---|
| 3147 | * @brief Partial convolution of floating-point sequences.
|
---|
| 3148 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3149 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3150 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3151 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3152 | * @param[out] *pDst points to the block of output data
|
---|
| 3153 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3154 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 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].
|
---|
| 3156 | */
|
---|
| 3157 |
|
---|
| 3158 | arm_status arm_conv_partial_f32(
|
---|
| 3159 | float32_t * pSrcA,
|
---|
| 3160 | uint32_t srcALen,
|
---|
| 3161 | float32_t * pSrcB,
|
---|
| 3162 | uint32_t srcBLen,
|
---|
| 3163 | float32_t * pDst,
|
---|
| 3164 | uint32_t firstIndex,
|
---|
| 3165 | uint32_t numPoints);
|
---|
| 3166 |
|
---|
| 3167 | /**
|
---|
| 3168 | * @brief Partial convolution of Q15 sequences.
|
---|
| 3169 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3170 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3171 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3172 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3173 | * @param[out] *pDst points to the block of output data
|
---|
| 3174 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3175 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3176 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 3177 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
|
---|
| 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].
|
---|
| 3179 | */
|
---|
| 3180 |
|
---|
| 3181 | arm_status arm_conv_partial_opt_q15(
|
---|
| 3182 | q15_t * pSrcA,
|
---|
| 3183 | uint32_t srcALen,
|
---|
| 3184 | q15_t * pSrcB,
|
---|
| 3185 | uint32_t srcBLen,
|
---|
| 3186 | q15_t * pDst,
|
---|
| 3187 | uint32_t firstIndex,
|
---|
| 3188 | uint32_t numPoints,
|
---|
| 3189 | q15_t * pScratch1,
|
---|
| 3190 | q15_t * pScratch2);
|
---|
| 3191 |
|
---|
| 3192 |
|
---|
| 3193 | /**
|
---|
| 3194 | * @brief Partial convolution of Q15 sequences.
|
---|
| 3195 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3196 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3197 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3198 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3199 | * @param[out] *pDst points to the block of output data
|
---|
| 3200 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3201 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3202 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
---|
| 3203 | */
|
---|
| 3204 |
|
---|
| 3205 | arm_status arm_conv_partial_q15(
|
---|
| 3206 | q15_t * pSrcA,
|
---|
| 3207 | uint32_t srcALen,
|
---|
| 3208 | q15_t * pSrcB,
|
---|
| 3209 | uint32_t srcBLen,
|
---|
| 3210 | q15_t * pDst,
|
---|
| 3211 | uint32_t firstIndex,
|
---|
| 3212 | uint32_t numPoints);
|
---|
| 3213 |
|
---|
| 3214 | /**
|
---|
| 3215 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 3216 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3217 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3218 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3219 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3220 | * @param[out] *pDst points to the block of output data
|
---|
| 3221 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3222 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3223 | * @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].
|
---|
| 3224 | */
|
---|
| 3225 |
|
---|
| 3226 | arm_status arm_conv_partial_fast_q15(
|
---|
| 3227 | q15_t * pSrcA,
|
---|
| 3228 | uint32_t srcALen,
|
---|
| 3229 | q15_t * pSrcB,
|
---|
| 3230 | uint32_t srcBLen,
|
---|
| 3231 | q15_t * pDst,
|
---|
| 3232 | uint32_t firstIndex,
|
---|
| 3233 | uint32_t numPoints);
|
---|
| 3234 |
|
---|
| 3235 |
|
---|
| 3236 | /**
|
---|
| 3237 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 3238 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3239 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3240 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3241 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3242 | * @param[out] *pDst points to the block of output data
|
---|
| 3243 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3244 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3245 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 3246 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
|
---|
| 3247 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
---|
| 3248 | */
|
---|
| 3249 |
|
---|
| 3250 | arm_status arm_conv_partial_fast_opt_q15(
|
---|
| 3251 | q15_t * pSrcA,
|
---|
| 3252 | uint32_t srcALen,
|
---|
| 3253 | q15_t * pSrcB,
|
---|
| 3254 | uint32_t srcBLen,
|
---|
| 3255 | q15_t * pDst,
|
---|
| 3256 | uint32_t firstIndex,
|
---|
| 3257 | uint32_t numPoints,
|
---|
| 3258 | q15_t * pScratch1,
|
---|
| 3259 | q15_t * pScratch2);
|
---|
| 3260 |
|
---|
| 3261 |
|
---|
| 3262 | /**
|
---|
| 3263 | * @brief Partial convolution of Q31 sequences.
|
---|
| 3264 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3265 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3266 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3267 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3268 | * @param[out] *pDst points to the block of output data
|
---|
| 3269 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3270 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3271 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
---|
| 3272 | */
|
---|
| 3273 |
|
---|
| 3274 | arm_status arm_conv_partial_q31(
|
---|
| 3275 | q31_t * pSrcA,
|
---|
| 3276 | uint32_t srcALen,
|
---|
| 3277 | q31_t * pSrcB,
|
---|
| 3278 | uint32_t srcBLen,
|
---|
| 3279 | q31_t * pDst,
|
---|
| 3280 | uint32_t firstIndex,
|
---|
| 3281 | uint32_t numPoints);
|
---|
| 3282 |
|
---|
| 3283 |
|
---|
| 3284 | /**
|
---|
| 3285 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 3286 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3287 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3288 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3289 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3290 | * @param[out] *pDst points to the block of output data
|
---|
| 3291 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3292 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3293 | * @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].
|
---|
| 3294 | */
|
---|
| 3295 |
|
---|
| 3296 | arm_status arm_conv_partial_fast_q31(
|
---|
| 3297 | q31_t * pSrcA,
|
---|
| 3298 | uint32_t srcALen,
|
---|
| 3299 | q31_t * pSrcB,
|
---|
| 3300 | uint32_t srcBLen,
|
---|
| 3301 | q31_t * pDst,
|
---|
| 3302 | uint32_t firstIndex,
|
---|
| 3303 | uint32_t numPoints);
|
---|
| 3304 |
|
---|
| 3305 |
|
---|
| 3306 | /**
|
---|
| 3307 | * @brief Partial convolution of Q7 sequences
|
---|
| 3308 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3309 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3310 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3311 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3312 | * @param[out] *pDst points to the block of output data
|
---|
| 3313 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3314 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3315 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 3316 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
|
---|
| 3317 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
---|
| 3318 | */
|
---|
| 3319 |
|
---|
| 3320 | arm_status arm_conv_partial_opt_q7(
|
---|
| 3321 | q7_t * pSrcA,
|
---|
| 3322 | uint32_t srcALen,
|
---|
| 3323 | q7_t * pSrcB,
|
---|
| 3324 | uint32_t srcBLen,
|
---|
| 3325 | q7_t * pDst,
|
---|
| 3326 | uint32_t firstIndex,
|
---|
| 3327 | uint32_t numPoints,
|
---|
| 3328 | q15_t * pScratch1,
|
---|
| 3329 | q15_t * pScratch2);
|
---|
| 3330 |
|
---|
| 3331 |
|
---|
| 3332 | /**
|
---|
| 3333 | * @brief Partial convolution of Q7 sequences.
|
---|
| 3334 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 3335 | * @param[in] srcALen length of the first input sequence.
|
---|
| 3336 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 3337 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 3338 | * @param[out] *pDst points to the block of output data
|
---|
| 3339 | * @param[in] firstIndex is the first output sample to start with.
|
---|
| 3340 | * @param[in] numPoints is the number of output points to be computed.
|
---|
| 3341 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
---|
| 3342 | */
|
---|
| 3343 |
|
---|
| 3344 | arm_status arm_conv_partial_q7(
|
---|
| 3345 | q7_t * pSrcA,
|
---|
| 3346 | uint32_t srcALen,
|
---|
| 3347 | q7_t * pSrcB,
|
---|
| 3348 | uint32_t srcBLen,
|
---|
| 3349 | q7_t * pDst,
|
---|
| 3350 | uint32_t firstIndex,
|
---|
| 3351 | uint32_t numPoints);
|
---|
| 3352 |
|
---|
| 3353 |
|
---|
| 3354 |
|
---|
| 3355 | /**
|
---|
| 3356 | * @brief Instance structure for the Q15 FIR decimator.
|
---|
| 3357 | */
|
---|
| 3358 |
|
---|
| 3359 | typedef struct
|
---|
| 3360 | {
|
---|
| 3361 | uint8_t M; /**< decimation factor. */
|
---|
| 3362 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 3363 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 3364 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 3365 | } arm_fir_decimate_instance_q15;
|
---|
| 3366 |
|
---|
| 3367 | /**
|
---|
| 3368 | * @brief Instance structure for the Q31 FIR decimator.
|
---|
| 3369 | */
|
---|
| 3370 |
|
---|
| 3371 | typedef struct
|
---|
| 3372 | {
|
---|
| 3373 | uint8_t M; /**< decimation factor. */
|
---|
| 3374 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 3375 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 3376 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 3377 |
|
---|
| 3378 | } arm_fir_decimate_instance_q31;
|
---|
| 3379 |
|
---|
| 3380 | /**
|
---|
| 3381 | * @brief Instance structure for the floating-point FIR decimator.
|
---|
| 3382 | */
|
---|
| 3383 |
|
---|
| 3384 | typedef struct
|
---|
| 3385 | {
|
---|
| 3386 | uint8_t M; /**< decimation factor. */
|
---|
| 3387 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 3388 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 3389 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 3390 |
|
---|
| 3391 | } arm_fir_decimate_instance_f32;
|
---|
| 3392 |
|
---|
| 3393 |
|
---|
| 3394 |
|
---|
| 3395 | /**
|
---|
| 3396 | * @brief Processing function for the floating-point FIR decimator.
|
---|
| 3397 | * @param[in] *S points to an instance of the floating-point FIR decimator structure.
|
---|
| 3398 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3399 | * @param[out] *pDst points to the block of output data
|
---|
| 3400 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3401 | * @return none
|
---|
| 3402 | */
|
---|
| 3403 |
|
---|
| 3404 | void arm_fir_decimate_f32(
|
---|
| 3405 | const arm_fir_decimate_instance_f32 * S,
|
---|
| 3406 | float32_t * pSrc,
|
---|
| 3407 | float32_t * pDst,
|
---|
| 3408 | uint32_t blockSize);
|
---|
| 3409 |
|
---|
| 3410 |
|
---|
| 3411 | /**
|
---|
| 3412 | * @brief Initialization function for the floating-point FIR decimator.
|
---|
| 3413 | * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
|
---|
| 3414 | * @param[in] numTaps number of coefficients in the filter.
|
---|
| 3415 | * @param[in] M decimation factor.
|
---|
| 3416 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 3417 | * @param[in] *pState points to the state buffer.
|
---|
| 3418 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3419 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
|
---|
| 3420 | * <code>blockSize</code> is not a multiple of <code>M</code>.
|
---|
| 3421 | */
|
---|
| 3422 |
|
---|
| 3423 | arm_status arm_fir_decimate_init_f32(
|
---|
| 3424 | arm_fir_decimate_instance_f32 * S,
|
---|
| 3425 | uint16_t numTaps,
|
---|
| 3426 | uint8_t M,
|
---|
| 3427 | float32_t * pCoeffs,
|
---|
| 3428 | float32_t * pState,
|
---|
| 3429 | uint32_t blockSize);
|
---|
| 3430 |
|
---|
| 3431 | /**
|
---|
| 3432 | * @brief Processing function for the Q15 FIR decimator.
|
---|
| 3433 | * @param[in] *S points to an instance of the Q15 FIR decimator structure.
|
---|
| 3434 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3435 | * @param[out] *pDst points to the block of output data
|
---|
| 3436 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3437 | * @return none
|
---|
| 3438 | */
|
---|
| 3439 |
|
---|
| 3440 | void arm_fir_decimate_q15(
|
---|
| 3441 | const arm_fir_decimate_instance_q15 * S,
|
---|
| 3442 | q15_t * pSrc,
|
---|
| 3443 | q15_t * pDst,
|
---|
| 3444 | uint32_t blockSize);
|
---|
| 3445 |
|
---|
| 3446 | /**
|
---|
| 3447 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
|
---|
| 3448 | * @param[in] *S points to an instance of the Q15 FIR decimator structure.
|
---|
| 3449 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3450 | * @param[out] *pDst points to the block of output data
|
---|
| 3451 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3452 | * @return none
|
---|
| 3453 | */
|
---|
| 3454 |
|
---|
| 3455 | void arm_fir_decimate_fast_q15(
|
---|
| 3456 | const arm_fir_decimate_instance_q15 * S,
|
---|
| 3457 | q15_t * pSrc,
|
---|
| 3458 | q15_t * pDst,
|
---|
| 3459 | uint32_t blockSize);
|
---|
| 3460 |
|
---|
| 3461 |
|
---|
| 3462 |
|
---|
| 3463 | /**
|
---|
| 3464 | * @brief Initialization function for the Q15 FIR decimator.
|
---|
| 3465 | * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
|
---|
| 3466 | * @param[in] numTaps number of coefficients in the filter.
|
---|
| 3467 | * @param[in] M decimation factor.
|
---|
| 3468 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 3469 | * @param[in] *pState points to the state buffer.
|
---|
| 3470 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3471 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
|
---|
| 3472 | * <code>blockSize</code> is not a multiple of <code>M</code>.
|
---|
| 3473 | */
|
---|
| 3474 |
|
---|
| 3475 | arm_status arm_fir_decimate_init_q15(
|
---|
| 3476 | arm_fir_decimate_instance_q15 * S,
|
---|
| 3477 | uint16_t numTaps,
|
---|
| 3478 | uint8_t M,
|
---|
| 3479 | q15_t * pCoeffs,
|
---|
| 3480 | q15_t * pState,
|
---|
| 3481 | uint32_t blockSize);
|
---|
| 3482 |
|
---|
| 3483 | /**
|
---|
| 3484 | * @brief Processing function for the Q31 FIR decimator.
|
---|
| 3485 | * @param[in] *S points to an instance of the Q31 FIR decimator structure.
|
---|
| 3486 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3487 | * @param[out] *pDst points to the block of output data
|
---|
| 3488 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3489 | * @return none
|
---|
| 3490 | */
|
---|
| 3491 |
|
---|
| 3492 | void arm_fir_decimate_q31(
|
---|
| 3493 | const arm_fir_decimate_instance_q31 * S,
|
---|
| 3494 | q31_t * pSrc,
|
---|
| 3495 | q31_t * pDst,
|
---|
| 3496 | uint32_t blockSize);
|
---|
| 3497 |
|
---|
| 3498 | /**
|
---|
| 3499 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
|
---|
| 3500 | * @param[in] *S points to an instance of the Q31 FIR decimator structure.
|
---|
| 3501 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3502 | * @param[out] *pDst points to the block of output data
|
---|
| 3503 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3504 | * @return none
|
---|
| 3505 | */
|
---|
| 3506 |
|
---|
| 3507 | void arm_fir_decimate_fast_q31(
|
---|
| 3508 | arm_fir_decimate_instance_q31 * S,
|
---|
| 3509 | q31_t * pSrc,
|
---|
| 3510 | q31_t * pDst,
|
---|
| 3511 | uint32_t blockSize);
|
---|
| 3512 |
|
---|
| 3513 |
|
---|
| 3514 | /**
|
---|
| 3515 | * @brief Initialization function for the Q31 FIR decimator.
|
---|
| 3516 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
|
---|
| 3517 | * @param[in] numTaps number of coefficients in the filter.
|
---|
| 3518 | * @param[in] M decimation factor.
|
---|
| 3519 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 3520 | * @param[in] *pState points to the state buffer.
|
---|
| 3521 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3522 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
|
---|
| 3523 | * <code>blockSize</code> is not a multiple of <code>M</code>.
|
---|
| 3524 | */
|
---|
| 3525 |
|
---|
| 3526 | arm_status arm_fir_decimate_init_q31(
|
---|
| 3527 | arm_fir_decimate_instance_q31 * S,
|
---|
| 3528 | uint16_t numTaps,
|
---|
| 3529 | uint8_t M,
|
---|
| 3530 | q31_t * pCoeffs,
|
---|
| 3531 | q31_t * pState,
|
---|
| 3532 | uint32_t blockSize);
|
---|
| 3533 |
|
---|
| 3534 |
|
---|
| 3535 |
|
---|
| 3536 | /**
|
---|
| 3537 | * @brief Instance structure for the Q15 FIR interpolator.
|
---|
| 3538 | */
|
---|
| 3539 |
|
---|
| 3540 | typedef struct
|
---|
| 3541 | {
|
---|
| 3542 | uint8_t L; /**< upsample factor. */
|
---|
| 3543 | uint16_t phaseLength; /**< length of each polyphase filter component. */
|
---|
| 3544 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
|
---|
| 3545 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
|
---|
| 3546 | } arm_fir_interpolate_instance_q15;
|
---|
| 3547 |
|
---|
| 3548 | /**
|
---|
| 3549 | * @brief Instance structure for the Q31 FIR interpolator.
|
---|
| 3550 | */
|
---|
| 3551 |
|
---|
| 3552 | typedef struct
|
---|
| 3553 | {
|
---|
| 3554 | uint8_t L; /**< upsample factor. */
|
---|
| 3555 | uint16_t phaseLength; /**< length of each polyphase filter component. */
|
---|
| 3556 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
|
---|
| 3557 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
|
---|
| 3558 | } arm_fir_interpolate_instance_q31;
|
---|
| 3559 |
|
---|
| 3560 | /**
|
---|
| 3561 | * @brief Instance structure for the floating-point FIR interpolator.
|
---|
| 3562 | */
|
---|
| 3563 |
|
---|
| 3564 | typedef struct
|
---|
| 3565 | {
|
---|
| 3566 | uint8_t L; /**< upsample factor. */
|
---|
| 3567 | uint16_t phaseLength; /**< length of each polyphase filter component. */
|
---|
| 3568 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
|
---|
| 3569 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
|
---|
| 3570 | } arm_fir_interpolate_instance_f32;
|
---|
| 3571 |
|
---|
| 3572 |
|
---|
| 3573 | /**
|
---|
| 3574 | * @brief Processing function for the Q15 FIR interpolator.
|
---|
| 3575 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
|
---|
| 3576 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3577 | * @param[out] *pDst points to the block of output data.
|
---|
| 3578 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3579 | * @return none.
|
---|
| 3580 | */
|
---|
| 3581 |
|
---|
| 3582 | void arm_fir_interpolate_q15(
|
---|
| 3583 | const arm_fir_interpolate_instance_q15 * S,
|
---|
| 3584 | q15_t * pSrc,
|
---|
| 3585 | q15_t * pDst,
|
---|
| 3586 | uint32_t blockSize);
|
---|
| 3587 |
|
---|
| 3588 |
|
---|
| 3589 | /**
|
---|
| 3590 | * @brief Initialization function for the Q15 FIR interpolator.
|
---|
| 3591 | * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
|
---|
| 3592 | * @param[in] L upsample factor.
|
---|
| 3593 | * @param[in] numTaps number of filter coefficients in the filter.
|
---|
| 3594 | * @param[in] *pCoeffs points to the filter coefficient buffer.
|
---|
| 3595 | * @param[in] *pState points to the state buffer.
|
---|
| 3596 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3597 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
|
---|
| 3598 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
|
---|
| 3599 | */
|
---|
| 3600 |
|
---|
| 3601 | arm_status arm_fir_interpolate_init_q15(
|
---|
| 3602 | arm_fir_interpolate_instance_q15 * S,
|
---|
| 3603 | uint8_t L,
|
---|
| 3604 | uint16_t numTaps,
|
---|
| 3605 | q15_t * pCoeffs,
|
---|
| 3606 | q15_t * pState,
|
---|
| 3607 | uint32_t blockSize);
|
---|
| 3608 |
|
---|
| 3609 | /**
|
---|
| 3610 | * @brief Processing function for the Q31 FIR interpolator.
|
---|
| 3611 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
|
---|
| 3612 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3613 | * @param[out] *pDst points to the block of output data.
|
---|
| 3614 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3615 | * @return none.
|
---|
| 3616 | */
|
---|
| 3617 |
|
---|
| 3618 | void arm_fir_interpolate_q31(
|
---|
| 3619 | const arm_fir_interpolate_instance_q31 * S,
|
---|
| 3620 | q31_t * pSrc,
|
---|
| 3621 | q31_t * pDst,
|
---|
| 3622 | uint32_t blockSize);
|
---|
| 3623 |
|
---|
| 3624 | /**
|
---|
| 3625 | * @brief Initialization function for the Q31 FIR interpolator.
|
---|
| 3626 | * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
|
---|
| 3627 | * @param[in] L upsample factor.
|
---|
| 3628 | * @param[in] numTaps number of filter coefficients in the filter.
|
---|
| 3629 | * @param[in] *pCoeffs points to the filter coefficient buffer.
|
---|
| 3630 | * @param[in] *pState points to the state buffer.
|
---|
| 3631 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3632 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
|
---|
| 3633 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
|
---|
| 3634 | */
|
---|
| 3635 |
|
---|
| 3636 | arm_status arm_fir_interpolate_init_q31(
|
---|
| 3637 | arm_fir_interpolate_instance_q31 * S,
|
---|
| 3638 | uint8_t L,
|
---|
| 3639 | uint16_t numTaps,
|
---|
| 3640 | q31_t * pCoeffs,
|
---|
| 3641 | q31_t * pState,
|
---|
| 3642 | uint32_t blockSize);
|
---|
| 3643 |
|
---|
| 3644 |
|
---|
| 3645 | /**
|
---|
| 3646 | * @brief Processing function for the floating-point FIR interpolator.
|
---|
| 3647 | * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
|
---|
| 3648 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3649 | * @param[out] *pDst points to the block of output data.
|
---|
| 3650 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3651 | * @return none.
|
---|
| 3652 | */
|
---|
| 3653 |
|
---|
| 3654 | void arm_fir_interpolate_f32(
|
---|
| 3655 | const arm_fir_interpolate_instance_f32 * S,
|
---|
| 3656 | float32_t * pSrc,
|
---|
| 3657 | float32_t * pDst,
|
---|
| 3658 | uint32_t blockSize);
|
---|
| 3659 |
|
---|
| 3660 | /**
|
---|
| 3661 | * @brief Initialization function for the floating-point FIR interpolator.
|
---|
| 3662 | * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
|
---|
| 3663 | * @param[in] L upsample factor.
|
---|
| 3664 | * @param[in] numTaps number of filter coefficients in the filter.
|
---|
| 3665 | * @param[in] *pCoeffs points to the filter coefficient buffer.
|
---|
| 3666 | * @param[in] *pState points to the state buffer.
|
---|
| 3667 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 3668 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
|
---|
| 3669 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
|
---|
| 3670 | */
|
---|
| 3671 |
|
---|
| 3672 | arm_status arm_fir_interpolate_init_f32(
|
---|
| 3673 | arm_fir_interpolate_instance_f32 * S,
|
---|
| 3674 | uint8_t L,
|
---|
| 3675 | uint16_t numTaps,
|
---|
| 3676 | float32_t * pCoeffs,
|
---|
| 3677 | float32_t * pState,
|
---|
| 3678 | uint32_t blockSize);
|
---|
| 3679 |
|
---|
| 3680 | /**
|
---|
| 3681 | * @brief Instance structure for the high precision Q31 Biquad cascade filter.
|
---|
| 3682 | */
|
---|
| 3683 |
|
---|
| 3684 | typedef struct
|
---|
| 3685 | {
|
---|
| 3686 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
|
---|
| 3687 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
|
---|
| 3688 | q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
|
---|
| 3689 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
|
---|
| 3690 |
|
---|
| 3691 | } arm_biquad_cas_df1_32x64_ins_q31;
|
---|
| 3692 |
|
---|
| 3693 |
|
---|
| 3694 | /**
|
---|
| 3695 | * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
|
---|
| 3696 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3697 | * @param[out] *pDst points to the block of output data
|
---|
| 3698 | * @param[in] blockSize number of samples to process.
|
---|
| 3699 | * @return none.
|
---|
| 3700 | */
|
---|
| 3701 |
|
---|
| 3702 | void arm_biquad_cas_df1_32x64_q31(
|
---|
| 3703 | const arm_biquad_cas_df1_32x64_ins_q31 * S,
|
---|
| 3704 | q31_t * pSrc,
|
---|
| 3705 | q31_t * pDst,
|
---|
| 3706 | uint32_t blockSize);
|
---|
| 3707 |
|
---|
| 3708 |
|
---|
| 3709 | /**
|
---|
| 3710 | * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
|
---|
| 3711 | * @param[in] numStages number of 2nd order stages in the filter.
|
---|
| 3712 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 3713 | * @param[in] *pState points to the state buffer.
|
---|
| 3714 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
|
---|
| 3715 | * @return none
|
---|
| 3716 | */
|
---|
| 3717 |
|
---|
| 3718 | void arm_biquad_cas_df1_32x64_init_q31(
|
---|
| 3719 | arm_biquad_cas_df1_32x64_ins_q31 * S,
|
---|
| 3720 | uint8_t numStages,
|
---|
| 3721 | q31_t * pCoeffs,
|
---|
| 3722 | q63_t * pState,
|
---|
| 3723 | uint8_t postShift);
|
---|
| 3724 |
|
---|
| 3725 |
|
---|
| 3726 |
|
---|
| 3727 | /**
|
---|
| 3728 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
|
---|
| 3729 | */
|
---|
| 3730 |
|
---|
| 3731 | typedef struct
|
---|
| 3732 | {
|
---|
| 3733 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
|
---|
| 3734 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
|
---|
| 3735 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
|
---|
| 3736 | } arm_biquad_cascade_df2T_instance_f32;
|
---|
| 3737 |
|
---|
| 3738 |
|
---|
| 3739 | /**
|
---|
| 3740 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
|
---|
| 3741 | * @param[in] *S points to an instance of the filter data structure.
|
---|
| 3742 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3743 | * @param[out] *pDst points to the block of output data
|
---|
| 3744 | * @param[in] blockSize number of samples to process.
|
---|
| 3745 | * @return none.
|
---|
| 3746 | */
|
---|
| 3747 |
|
---|
| 3748 | void arm_biquad_cascade_df2T_f32(
|
---|
| 3749 | const arm_biquad_cascade_df2T_instance_f32 * S,
|
---|
| 3750 | float32_t * pSrc,
|
---|
| 3751 | float32_t * pDst,
|
---|
| 3752 | uint32_t blockSize);
|
---|
| 3753 |
|
---|
| 3754 |
|
---|
| 3755 | /**
|
---|
| 3756 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
|
---|
| 3757 | * @param[in,out] *S points to an instance of the filter data structure.
|
---|
| 3758 | * @param[in] numStages number of 2nd order stages in the filter.
|
---|
| 3759 | * @param[in] *pCoeffs points to the filter coefficients.
|
---|
| 3760 | * @param[in] *pState points to the state buffer.
|
---|
| 3761 | * @return none
|
---|
| 3762 | */
|
---|
| 3763 |
|
---|
| 3764 | void arm_biquad_cascade_df2T_init_f32(
|
---|
| 3765 | arm_biquad_cascade_df2T_instance_f32 * S,
|
---|
| 3766 | uint8_t numStages,
|
---|
| 3767 | float32_t * pCoeffs,
|
---|
| 3768 | float32_t * pState);
|
---|
| 3769 |
|
---|
| 3770 |
|
---|
| 3771 |
|
---|
| 3772 | /**
|
---|
| 3773 | * @brief Instance structure for the Q15 FIR lattice filter.
|
---|
| 3774 | */
|
---|
| 3775 |
|
---|
| 3776 | typedef struct
|
---|
| 3777 | {
|
---|
| 3778 | uint16_t numStages; /**< number of filter stages. */
|
---|
| 3779 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
|
---|
| 3780 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
|
---|
| 3781 | } arm_fir_lattice_instance_q15;
|
---|
| 3782 |
|
---|
| 3783 | /**
|
---|
| 3784 | * @brief Instance structure for the Q31 FIR lattice filter.
|
---|
| 3785 | */
|
---|
| 3786 |
|
---|
| 3787 | typedef struct
|
---|
| 3788 | {
|
---|
| 3789 | uint16_t numStages; /**< number of filter stages. */
|
---|
| 3790 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
|
---|
| 3791 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
|
---|
| 3792 | } arm_fir_lattice_instance_q31;
|
---|
| 3793 |
|
---|
| 3794 | /**
|
---|
| 3795 | * @brief Instance structure for the floating-point FIR lattice filter.
|
---|
| 3796 | */
|
---|
| 3797 |
|
---|
| 3798 | typedef struct
|
---|
| 3799 | {
|
---|
| 3800 | uint16_t numStages; /**< number of filter stages. */
|
---|
| 3801 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
|
---|
| 3802 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
|
---|
| 3803 | } arm_fir_lattice_instance_f32;
|
---|
| 3804 |
|
---|
| 3805 | /**
|
---|
| 3806 | * @brief Initialization function for the Q15 FIR lattice filter.
|
---|
| 3807 | * @param[in] *S points to an instance of the Q15 FIR lattice structure.
|
---|
| 3808 | * @param[in] numStages number of filter stages.
|
---|
| 3809 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
|
---|
| 3810 | * @param[in] *pState points to the state buffer. The array is of length numStages.
|
---|
| 3811 | * @return none.
|
---|
| 3812 | */
|
---|
| 3813 |
|
---|
| 3814 | void arm_fir_lattice_init_q15(
|
---|
| 3815 | arm_fir_lattice_instance_q15 * S,
|
---|
| 3816 | uint16_t numStages,
|
---|
| 3817 | q15_t * pCoeffs,
|
---|
| 3818 | q15_t * pState);
|
---|
| 3819 |
|
---|
| 3820 |
|
---|
| 3821 | /**
|
---|
| 3822 | * @brief Processing function for the Q15 FIR lattice filter.
|
---|
| 3823 | * @param[in] *S points to an instance of the Q15 FIR lattice structure.
|
---|
| 3824 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3825 | * @param[out] *pDst points to the block of output data.
|
---|
| 3826 | * @param[in] blockSize number of samples to process.
|
---|
| 3827 | * @return none.
|
---|
| 3828 | */
|
---|
| 3829 | void arm_fir_lattice_q15(
|
---|
| 3830 | const arm_fir_lattice_instance_q15 * S,
|
---|
| 3831 | q15_t * pSrc,
|
---|
| 3832 | q15_t * pDst,
|
---|
| 3833 | uint32_t blockSize);
|
---|
| 3834 |
|
---|
| 3835 | /**
|
---|
| 3836 | * @brief Initialization function for the Q31 FIR lattice filter.
|
---|
| 3837 | * @param[in] *S points to an instance of the Q31 FIR lattice structure.
|
---|
| 3838 | * @param[in] numStages number of filter stages.
|
---|
| 3839 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
|
---|
| 3840 | * @param[in] *pState points to the state buffer. The array is of length numStages.
|
---|
| 3841 | * @return none.
|
---|
| 3842 | */
|
---|
| 3843 |
|
---|
| 3844 | void arm_fir_lattice_init_q31(
|
---|
| 3845 | arm_fir_lattice_instance_q31 * S,
|
---|
| 3846 | uint16_t numStages,
|
---|
| 3847 | q31_t * pCoeffs,
|
---|
| 3848 | q31_t * pState);
|
---|
| 3849 |
|
---|
| 3850 |
|
---|
| 3851 | /**
|
---|
| 3852 | * @brief Processing function for the Q31 FIR lattice filter.
|
---|
| 3853 | * @param[in] *S points to an instance of the Q31 FIR lattice structure.
|
---|
| 3854 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3855 | * @param[out] *pDst points to the block of output data
|
---|
| 3856 | * @param[in] blockSize number of samples to process.
|
---|
| 3857 | * @return none.
|
---|
| 3858 | */
|
---|
| 3859 |
|
---|
| 3860 | void arm_fir_lattice_q31(
|
---|
| 3861 | const arm_fir_lattice_instance_q31 * S,
|
---|
| 3862 | q31_t * pSrc,
|
---|
| 3863 | q31_t * pDst,
|
---|
| 3864 | uint32_t blockSize);
|
---|
| 3865 |
|
---|
| 3866 | /**
|
---|
| 3867 | * @brief Initialization function for the floating-point FIR lattice filter.
|
---|
| 3868 | * @param[in] *S points to an instance of the floating-point FIR lattice structure.
|
---|
| 3869 | * @param[in] numStages number of filter stages.
|
---|
| 3870 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
|
---|
| 3871 | * @param[in] *pState points to the state buffer. The array is of length numStages.
|
---|
| 3872 | * @return none.
|
---|
| 3873 | */
|
---|
| 3874 |
|
---|
| 3875 | void arm_fir_lattice_init_f32(
|
---|
| 3876 | arm_fir_lattice_instance_f32 * S,
|
---|
| 3877 | uint16_t numStages,
|
---|
| 3878 | float32_t * pCoeffs,
|
---|
| 3879 | float32_t * pState);
|
---|
| 3880 |
|
---|
| 3881 | /**
|
---|
| 3882 | * @brief Processing function for the floating-point FIR lattice filter.
|
---|
| 3883 | * @param[in] *S points to an instance of the floating-point FIR lattice structure.
|
---|
| 3884 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3885 | * @param[out] *pDst points to the block of output data
|
---|
| 3886 | * @param[in] blockSize number of samples to process.
|
---|
| 3887 | * @return none.
|
---|
| 3888 | */
|
---|
| 3889 |
|
---|
| 3890 | void arm_fir_lattice_f32(
|
---|
| 3891 | const arm_fir_lattice_instance_f32 * S,
|
---|
| 3892 | float32_t * pSrc,
|
---|
| 3893 | float32_t * pDst,
|
---|
| 3894 | uint32_t blockSize);
|
---|
| 3895 |
|
---|
| 3896 | /**
|
---|
| 3897 | * @brief Instance structure for the Q15 IIR lattice filter.
|
---|
| 3898 | */
|
---|
| 3899 | typedef struct
|
---|
| 3900 | {
|
---|
| 3901 | uint16_t numStages; /**< number of stages in the filter. */
|
---|
| 3902 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
|
---|
| 3903 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
|
---|
| 3904 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
|
---|
| 3905 | } arm_iir_lattice_instance_q15;
|
---|
| 3906 |
|
---|
| 3907 | /**
|
---|
| 3908 | * @brief Instance structure for the Q31 IIR lattice filter.
|
---|
| 3909 | */
|
---|
| 3910 | typedef struct
|
---|
| 3911 | {
|
---|
| 3912 | uint16_t numStages; /**< number of stages in the filter. */
|
---|
| 3913 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
|
---|
| 3914 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
|
---|
| 3915 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
|
---|
| 3916 | } arm_iir_lattice_instance_q31;
|
---|
| 3917 |
|
---|
| 3918 | /**
|
---|
| 3919 | * @brief Instance structure for the floating-point IIR lattice filter.
|
---|
| 3920 | */
|
---|
| 3921 | typedef struct
|
---|
| 3922 | {
|
---|
| 3923 | uint16_t numStages; /**< number of stages in the filter. */
|
---|
| 3924 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
|
---|
| 3925 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
|
---|
| 3926 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
|
---|
| 3927 | } arm_iir_lattice_instance_f32;
|
---|
| 3928 |
|
---|
| 3929 | /**
|
---|
| 3930 | * @brief Processing function for the floating-point IIR lattice filter.
|
---|
| 3931 | * @param[in] *S points to an instance of the floating-point IIR lattice structure.
|
---|
| 3932 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3933 | * @param[out] *pDst points to the block of output data.
|
---|
| 3934 | * @param[in] blockSize number of samples to process.
|
---|
| 3935 | * @return none.
|
---|
| 3936 | */
|
---|
| 3937 |
|
---|
| 3938 | void arm_iir_lattice_f32(
|
---|
| 3939 | const arm_iir_lattice_instance_f32 * S,
|
---|
| 3940 | float32_t * pSrc,
|
---|
| 3941 | float32_t * pDst,
|
---|
| 3942 | uint32_t blockSize);
|
---|
| 3943 |
|
---|
| 3944 | /**
|
---|
| 3945 | * @brief Initialization function for the floating-point IIR lattice filter.
|
---|
| 3946 | * @param[in] *S points to an instance of the floating-point IIR lattice structure.
|
---|
| 3947 | * @param[in] numStages number of stages in the filter.
|
---|
| 3948 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
|
---|
| 3949 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
|
---|
| 3950 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
|
---|
| 3951 | * @param[in] blockSize number of samples to process.
|
---|
| 3952 | * @return none.
|
---|
| 3953 | */
|
---|
| 3954 |
|
---|
| 3955 | void arm_iir_lattice_init_f32(
|
---|
| 3956 | arm_iir_lattice_instance_f32 * S,
|
---|
| 3957 | uint16_t numStages,
|
---|
| 3958 | float32_t * pkCoeffs,
|
---|
| 3959 | float32_t * pvCoeffs,
|
---|
| 3960 | float32_t * pState,
|
---|
| 3961 | uint32_t blockSize);
|
---|
| 3962 |
|
---|
| 3963 |
|
---|
| 3964 | /**
|
---|
| 3965 | * @brief Processing function for the Q31 IIR lattice filter.
|
---|
| 3966 | * @param[in] *S points to an instance of the Q31 IIR lattice structure.
|
---|
| 3967 | * @param[in] *pSrc points to the block of input data.
|
---|
| 3968 | * @param[out] *pDst points to the block of output data.
|
---|
| 3969 | * @param[in] blockSize number of samples to process.
|
---|
| 3970 | * @return none.
|
---|
| 3971 | */
|
---|
| 3972 |
|
---|
| 3973 | void arm_iir_lattice_q31(
|
---|
| 3974 | const arm_iir_lattice_instance_q31 * S,
|
---|
| 3975 | q31_t * pSrc,
|
---|
| 3976 | q31_t * pDst,
|
---|
| 3977 | uint32_t blockSize);
|
---|
| 3978 |
|
---|
| 3979 |
|
---|
| 3980 | /**
|
---|
| 3981 | * @brief Initialization function for the Q31 IIR lattice filter.
|
---|
| 3982 | * @param[in] *S points to an instance of the Q31 IIR lattice structure.
|
---|
| 3983 | * @param[in] numStages number of stages in the filter.
|
---|
| 3984 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
|
---|
| 3985 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
|
---|
| 3986 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
|
---|
| 3987 | * @param[in] blockSize number of samples to process.
|
---|
| 3988 | * @return none.
|
---|
| 3989 | */
|
---|
| 3990 |
|
---|
| 3991 | void arm_iir_lattice_init_q31(
|
---|
| 3992 | arm_iir_lattice_instance_q31 * S,
|
---|
| 3993 | uint16_t numStages,
|
---|
| 3994 | q31_t * pkCoeffs,
|
---|
| 3995 | q31_t * pvCoeffs,
|
---|
| 3996 | q31_t * pState,
|
---|
| 3997 | uint32_t blockSize);
|
---|
| 3998 |
|
---|
| 3999 |
|
---|
| 4000 | /**
|
---|
| 4001 | * @brief Processing function for the Q15 IIR lattice filter.
|
---|
| 4002 | * @param[in] *S points to an instance of the Q15 IIR lattice structure.
|
---|
| 4003 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4004 | * @param[out] *pDst points to the block of output data.
|
---|
| 4005 | * @param[in] blockSize number of samples to process.
|
---|
| 4006 | * @return none.
|
---|
| 4007 | */
|
---|
| 4008 |
|
---|
| 4009 | void arm_iir_lattice_q15(
|
---|
| 4010 | const arm_iir_lattice_instance_q15 * S,
|
---|
| 4011 | q15_t * pSrc,
|
---|
| 4012 | q15_t * pDst,
|
---|
| 4013 | uint32_t blockSize);
|
---|
| 4014 |
|
---|
| 4015 |
|
---|
| 4016 | /**
|
---|
| 4017 | * @brief Initialization function for the Q15 IIR lattice filter.
|
---|
| 4018 | * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
|
---|
| 4019 | * @param[in] numStages number of stages in the filter.
|
---|
| 4020 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
|
---|
| 4021 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
|
---|
| 4022 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
|
---|
| 4023 | * @param[in] blockSize number of samples to process per call.
|
---|
| 4024 | * @return none.
|
---|
| 4025 | */
|
---|
| 4026 |
|
---|
| 4027 | void arm_iir_lattice_init_q15(
|
---|
| 4028 | arm_iir_lattice_instance_q15 * S,
|
---|
| 4029 | uint16_t numStages,
|
---|
| 4030 | q15_t * pkCoeffs,
|
---|
| 4031 | q15_t * pvCoeffs,
|
---|
| 4032 | q15_t * pState,
|
---|
| 4033 | uint32_t blockSize);
|
---|
| 4034 |
|
---|
| 4035 | /**
|
---|
| 4036 | * @brief Instance structure for the floating-point LMS filter.
|
---|
| 4037 | */
|
---|
| 4038 |
|
---|
| 4039 | typedef struct
|
---|
| 4040 | {
|
---|
| 4041 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4042 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 4043 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 4044 | float32_t mu; /**< step size that controls filter coefficient updates. */
|
---|
| 4045 | } arm_lms_instance_f32;
|
---|
| 4046 |
|
---|
| 4047 | /**
|
---|
| 4048 | * @brief Processing function for floating-point LMS filter.
|
---|
| 4049 | * @param[in] *S points to an instance of the floating-point LMS filter structure.
|
---|
| 4050 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4051 | * @param[in] *pRef points to the block of reference data.
|
---|
| 4052 | * @param[out] *pOut points to the block of output data.
|
---|
| 4053 | * @param[out] *pErr points to the block of error data.
|
---|
| 4054 | * @param[in] blockSize number of samples to process.
|
---|
| 4055 | * @return none.
|
---|
| 4056 | */
|
---|
| 4057 |
|
---|
| 4058 | void arm_lms_f32(
|
---|
| 4059 | const arm_lms_instance_f32 * S,
|
---|
| 4060 | float32_t * pSrc,
|
---|
| 4061 | float32_t * pRef,
|
---|
| 4062 | float32_t * pOut,
|
---|
| 4063 | float32_t * pErr,
|
---|
| 4064 | uint32_t blockSize);
|
---|
| 4065 |
|
---|
| 4066 | /**
|
---|
| 4067 | * @brief Initialization function for floating-point LMS filter.
|
---|
| 4068 | * @param[in] *S points to an instance of the floating-point LMS filter structure.
|
---|
| 4069 | * @param[in] numTaps number of filter coefficients.
|
---|
| 4070 | * @param[in] *pCoeffs points to the coefficient buffer.
|
---|
| 4071 | * @param[in] *pState points to state buffer.
|
---|
| 4072 | * @param[in] mu step size that controls filter coefficient updates.
|
---|
| 4073 | * @param[in] blockSize number of samples to process.
|
---|
| 4074 | * @return none.
|
---|
| 4075 | */
|
---|
| 4076 |
|
---|
| 4077 | void arm_lms_init_f32(
|
---|
| 4078 | arm_lms_instance_f32 * S,
|
---|
| 4079 | uint16_t numTaps,
|
---|
| 4080 | float32_t * pCoeffs,
|
---|
| 4081 | float32_t * pState,
|
---|
| 4082 | float32_t mu,
|
---|
| 4083 | uint32_t blockSize);
|
---|
| 4084 |
|
---|
| 4085 | /**
|
---|
| 4086 | * @brief Instance structure for the Q15 LMS filter.
|
---|
| 4087 | */
|
---|
| 4088 |
|
---|
| 4089 | typedef struct
|
---|
| 4090 | {
|
---|
| 4091 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4092 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 4093 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 4094 | q15_t mu; /**< step size that controls filter coefficient updates. */
|
---|
| 4095 | uint32_t postShift; /**< bit shift applied to coefficients. */
|
---|
| 4096 | } arm_lms_instance_q15;
|
---|
| 4097 |
|
---|
| 4098 |
|
---|
| 4099 | /**
|
---|
| 4100 | * @brief Initialization function for the Q15 LMS filter.
|
---|
| 4101 | * @param[in] *S points to an instance of the Q15 LMS filter structure.
|
---|
| 4102 | * @param[in] numTaps number of filter coefficients.
|
---|
| 4103 | * @param[in] *pCoeffs points to the coefficient buffer.
|
---|
| 4104 | * @param[in] *pState points to the state buffer.
|
---|
| 4105 | * @param[in] mu step size that controls filter coefficient updates.
|
---|
| 4106 | * @param[in] blockSize number of samples to process.
|
---|
| 4107 | * @param[in] postShift bit shift applied to coefficients.
|
---|
| 4108 | * @return none.
|
---|
| 4109 | */
|
---|
| 4110 |
|
---|
| 4111 | void arm_lms_init_q15(
|
---|
| 4112 | arm_lms_instance_q15 * S,
|
---|
| 4113 | uint16_t numTaps,
|
---|
| 4114 | q15_t * pCoeffs,
|
---|
| 4115 | q15_t * pState,
|
---|
| 4116 | q15_t mu,
|
---|
| 4117 | uint32_t blockSize,
|
---|
| 4118 | uint32_t postShift);
|
---|
| 4119 |
|
---|
| 4120 | /**
|
---|
| 4121 | * @brief Processing function for Q15 LMS filter.
|
---|
| 4122 | * @param[in] *S points to an instance of the Q15 LMS filter structure.
|
---|
| 4123 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4124 | * @param[in] *pRef points to the block of reference data.
|
---|
| 4125 | * @param[out] *pOut points to the block of output data.
|
---|
| 4126 | * @param[out] *pErr points to the block of error data.
|
---|
| 4127 | * @param[in] blockSize number of samples to process.
|
---|
| 4128 | * @return none.
|
---|
| 4129 | */
|
---|
| 4130 |
|
---|
| 4131 | void arm_lms_q15(
|
---|
| 4132 | const arm_lms_instance_q15 * S,
|
---|
| 4133 | q15_t * pSrc,
|
---|
| 4134 | q15_t * pRef,
|
---|
| 4135 | q15_t * pOut,
|
---|
| 4136 | q15_t * pErr,
|
---|
| 4137 | uint32_t blockSize);
|
---|
| 4138 |
|
---|
| 4139 |
|
---|
| 4140 | /**
|
---|
| 4141 | * @brief Instance structure for the Q31 LMS filter.
|
---|
| 4142 | */
|
---|
| 4143 |
|
---|
| 4144 | typedef struct
|
---|
| 4145 | {
|
---|
| 4146 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4147 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 4148 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 4149 | q31_t mu; /**< step size that controls filter coefficient updates. */
|
---|
| 4150 | uint32_t postShift; /**< bit shift applied to coefficients. */
|
---|
| 4151 |
|
---|
| 4152 | } arm_lms_instance_q31;
|
---|
| 4153 |
|
---|
| 4154 | /**
|
---|
| 4155 | * @brief Processing function for Q31 LMS filter.
|
---|
| 4156 | * @param[in] *S points to an instance of the Q15 LMS filter structure.
|
---|
| 4157 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4158 | * @param[in] *pRef points to the block of reference data.
|
---|
| 4159 | * @param[out] *pOut points to the block of output data.
|
---|
| 4160 | * @param[out] *pErr points to the block of error data.
|
---|
| 4161 | * @param[in] blockSize number of samples to process.
|
---|
| 4162 | * @return none.
|
---|
| 4163 | */
|
---|
| 4164 |
|
---|
| 4165 | void arm_lms_q31(
|
---|
| 4166 | const arm_lms_instance_q31 * S,
|
---|
| 4167 | q31_t * pSrc,
|
---|
| 4168 | q31_t * pRef,
|
---|
| 4169 | q31_t * pOut,
|
---|
| 4170 | q31_t * pErr,
|
---|
| 4171 | uint32_t blockSize);
|
---|
| 4172 |
|
---|
| 4173 | /**
|
---|
| 4174 | * @brief Initialization function for Q31 LMS filter.
|
---|
| 4175 | * @param[in] *S points to an instance of the Q31 LMS filter structure.
|
---|
| 4176 | * @param[in] numTaps number of filter coefficients.
|
---|
| 4177 | * @param[in] *pCoeffs points to coefficient buffer.
|
---|
| 4178 | * @param[in] *pState points to state buffer.
|
---|
| 4179 | * @param[in] mu step size that controls filter coefficient updates.
|
---|
| 4180 | * @param[in] blockSize number of samples to process.
|
---|
| 4181 | * @param[in] postShift bit shift applied to coefficients.
|
---|
| 4182 | * @return none.
|
---|
| 4183 | */
|
---|
| 4184 |
|
---|
| 4185 | void arm_lms_init_q31(
|
---|
| 4186 | arm_lms_instance_q31 * S,
|
---|
| 4187 | uint16_t numTaps,
|
---|
| 4188 | q31_t * pCoeffs,
|
---|
| 4189 | q31_t * pState,
|
---|
| 4190 | q31_t mu,
|
---|
| 4191 | uint32_t blockSize,
|
---|
| 4192 | uint32_t postShift);
|
---|
| 4193 |
|
---|
| 4194 | /**
|
---|
| 4195 | * @brief Instance structure for the floating-point normalized LMS filter.
|
---|
| 4196 | */
|
---|
| 4197 |
|
---|
| 4198 | typedef struct
|
---|
| 4199 | {
|
---|
| 4200 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4201 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 4202 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 4203 | float32_t mu; /**< step size that control filter coefficient updates. */
|
---|
| 4204 | float32_t energy; /**< saves previous frame energy. */
|
---|
| 4205 | float32_t x0; /**< saves previous input sample. */
|
---|
| 4206 | } arm_lms_norm_instance_f32;
|
---|
| 4207 |
|
---|
| 4208 | /**
|
---|
| 4209 | * @brief Processing function for floating-point normalized LMS filter.
|
---|
| 4210 | * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
|
---|
| 4211 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4212 | * @param[in] *pRef points to the block of reference data.
|
---|
| 4213 | * @param[out] *pOut points to the block of output data.
|
---|
| 4214 | * @param[out] *pErr points to the block of error data.
|
---|
| 4215 | * @param[in] blockSize number of samples to process.
|
---|
| 4216 | * @return none.
|
---|
| 4217 | */
|
---|
| 4218 |
|
---|
| 4219 | void arm_lms_norm_f32(
|
---|
| 4220 | arm_lms_norm_instance_f32 * S,
|
---|
| 4221 | float32_t * pSrc,
|
---|
| 4222 | float32_t * pRef,
|
---|
| 4223 | float32_t * pOut,
|
---|
| 4224 | float32_t * pErr,
|
---|
| 4225 | uint32_t blockSize);
|
---|
| 4226 |
|
---|
| 4227 | /**
|
---|
| 4228 | * @brief Initialization function for floating-point normalized LMS filter.
|
---|
| 4229 | * @param[in] *S points to an instance of the floating-point LMS filter structure.
|
---|
| 4230 | * @param[in] numTaps number of filter coefficients.
|
---|
| 4231 | * @param[in] *pCoeffs points to coefficient buffer.
|
---|
| 4232 | * @param[in] *pState points to state buffer.
|
---|
| 4233 | * @param[in] mu step size that controls filter coefficient updates.
|
---|
| 4234 | * @param[in] blockSize number of samples to process.
|
---|
| 4235 | * @return none.
|
---|
| 4236 | */
|
---|
| 4237 |
|
---|
| 4238 | void arm_lms_norm_init_f32(
|
---|
| 4239 | arm_lms_norm_instance_f32 * S,
|
---|
| 4240 | uint16_t numTaps,
|
---|
| 4241 | float32_t * pCoeffs,
|
---|
| 4242 | float32_t * pState,
|
---|
| 4243 | float32_t mu,
|
---|
| 4244 | uint32_t blockSize);
|
---|
| 4245 |
|
---|
| 4246 |
|
---|
| 4247 | /**
|
---|
| 4248 | * @brief Instance structure for the Q31 normalized LMS filter.
|
---|
| 4249 | */
|
---|
| 4250 | typedef struct
|
---|
| 4251 | {
|
---|
| 4252 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4253 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 4254 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 4255 | q31_t mu; /**< step size that controls filter coefficient updates. */
|
---|
| 4256 | uint8_t postShift; /**< bit shift applied to coefficients. */
|
---|
| 4257 | q31_t *recipTable; /**< points to the reciprocal initial value table. */
|
---|
| 4258 | q31_t energy; /**< saves previous frame energy. */
|
---|
| 4259 | q31_t x0; /**< saves previous input sample. */
|
---|
| 4260 | } arm_lms_norm_instance_q31;
|
---|
| 4261 |
|
---|
| 4262 | /**
|
---|
| 4263 | * @brief Processing function for Q31 normalized LMS filter.
|
---|
| 4264 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
|
---|
| 4265 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4266 | * @param[in] *pRef points to the block of reference data.
|
---|
| 4267 | * @param[out] *pOut points to the block of output data.
|
---|
| 4268 | * @param[out] *pErr points to the block of error data.
|
---|
| 4269 | * @param[in] blockSize number of samples to process.
|
---|
| 4270 | * @return none.
|
---|
| 4271 | */
|
---|
| 4272 |
|
---|
| 4273 | void arm_lms_norm_q31(
|
---|
| 4274 | arm_lms_norm_instance_q31 * S,
|
---|
| 4275 | q31_t * pSrc,
|
---|
| 4276 | q31_t * pRef,
|
---|
| 4277 | q31_t * pOut,
|
---|
| 4278 | q31_t * pErr,
|
---|
| 4279 | uint32_t blockSize);
|
---|
| 4280 |
|
---|
| 4281 | /**
|
---|
| 4282 | * @brief Initialization function for Q31 normalized LMS filter.
|
---|
| 4283 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
|
---|
| 4284 | * @param[in] numTaps number of filter coefficients.
|
---|
| 4285 | * @param[in] *pCoeffs points to coefficient buffer.
|
---|
| 4286 | * @param[in] *pState points to state buffer.
|
---|
| 4287 | * @param[in] mu step size that controls filter coefficient updates.
|
---|
| 4288 | * @param[in] blockSize number of samples to process.
|
---|
| 4289 | * @param[in] postShift bit shift applied to coefficients.
|
---|
| 4290 | * @return none.
|
---|
| 4291 | */
|
---|
| 4292 |
|
---|
| 4293 | void arm_lms_norm_init_q31(
|
---|
| 4294 | arm_lms_norm_instance_q31 * S,
|
---|
| 4295 | uint16_t numTaps,
|
---|
| 4296 | q31_t * pCoeffs,
|
---|
| 4297 | q31_t * pState,
|
---|
| 4298 | q31_t mu,
|
---|
| 4299 | uint32_t blockSize,
|
---|
| 4300 | uint8_t postShift);
|
---|
| 4301 |
|
---|
| 4302 | /**
|
---|
| 4303 | * @brief Instance structure for the Q15 normalized LMS filter.
|
---|
| 4304 | */
|
---|
| 4305 |
|
---|
| 4306 | typedef struct
|
---|
| 4307 | {
|
---|
| 4308 | uint16_t numTaps; /**< Number of coefficients in the filter. */
|
---|
| 4309 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
|
---|
| 4310 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
|
---|
| 4311 | q15_t mu; /**< step size that controls filter coefficient updates. */
|
---|
| 4312 | uint8_t postShift; /**< bit shift applied to coefficients. */
|
---|
| 4313 | q15_t *recipTable; /**< Points to the reciprocal initial value table. */
|
---|
| 4314 | q15_t energy; /**< saves previous frame energy. */
|
---|
| 4315 | q15_t x0; /**< saves previous input sample. */
|
---|
| 4316 | } arm_lms_norm_instance_q15;
|
---|
| 4317 |
|
---|
| 4318 | /**
|
---|
| 4319 | * @brief Processing function for Q15 normalized LMS filter.
|
---|
| 4320 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
|
---|
| 4321 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4322 | * @param[in] *pRef points to the block of reference data.
|
---|
| 4323 | * @param[out] *pOut points to the block of output data.
|
---|
| 4324 | * @param[out] *pErr points to the block of error data.
|
---|
| 4325 | * @param[in] blockSize number of samples to process.
|
---|
| 4326 | * @return none.
|
---|
| 4327 | */
|
---|
| 4328 |
|
---|
| 4329 | void arm_lms_norm_q15(
|
---|
| 4330 | arm_lms_norm_instance_q15 * S,
|
---|
| 4331 | q15_t * pSrc,
|
---|
| 4332 | q15_t * pRef,
|
---|
| 4333 | q15_t * pOut,
|
---|
| 4334 | q15_t * pErr,
|
---|
| 4335 | uint32_t blockSize);
|
---|
| 4336 |
|
---|
| 4337 |
|
---|
| 4338 | /**
|
---|
| 4339 | * @brief Initialization function for Q15 normalized LMS filter.
|
---|
| 4340 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
|
---|
| 4341 | * @param[in] numTaps number of filter coefficients.
|
---|
| 4342 | * @param[in] *pCoeffs points to coefficient buffer.
|
---|
| 4343 | * @param[in] *pState points to state buffer.
|
---|
| 4344 | * @param[in] mu step size that controls filter coefficient updates.
|
---|
| 4345 | * @param[in] blockSize number of samples to process.
|
---|
| 4346 | * @param[in] postShift bit shift applied to coefficients.
|
---|
| 4347 | * @return none.
|
---|
| 4348 | */
|
---|
| 4349 |
|
---|
| 4350 | void arm_lms_norm_init_q15(
|
---|
| 4351 | arm_lms_norm_instance_q15 * S,
|
---|
| 4352 | uint16_t numTaps,
|
---|
| 4353 | q15_t * pCoeffs,
|
---|
| 4354 | q15_t * pState,
|
---|
| 4355 | q15_t mu,
|
---|
| 4356 | uint32_t blockSize,
|
---|
| 4357 | uint8_t postShift);
|
---|
| 4358 |
|
---|
| 4359 | /**
|
---|
| 4360 | * @brief Correlation of floating-point sequences.
|
---|
| 4361 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4362 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4363 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4364 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4365 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4366 | * @return none.
|
---|
| 4367 | */
|
---|
| 4368 |
|
---|
| 4369 | void arm_correlate_f32(
|
---|
| 4370 | float32_t * pSrcA,
|
---|
| 4371 | uint32_t srcALen,
|
---|
| 4372 | float32_t * pSrcB,
|
---|
| 4373 | uint32_t srcBLen,
|
---|
| 4374 | float32_t * pDst);
|
---|
| 4375 |
|
---|
| 4376 |
|
---|
| 4377 | /**
|
---|
| 4378 | * @brief Correlation of Q15 sequences
|
---|
| 4379 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4380 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4381 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4382 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4383 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4384 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 4385 | * @return none.
|
---|
| 4386 | */
|
---|
| 4387 | void arm_correlate_opt_q15(
|
---|
| 4388 | q15_t * pSrcA,
|
---|
| 4389 | uint32_t srcALen,
|
---|
| 4390 | q15_t * pSrcB,
|
---|
| 4391 | uint32_t srcBLen,
|
---|
| 4392 | q15_t * pDst,
|
---|
| 4393 | q15_t * pScratch);
|
---|
| 4394 |
|
---|
| 4395 |
|
---|
| 4396 | /**
|
---|
| 4397 | * @brief Correlation of Q15 sequences.
|
---|
| 4398 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4399 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4400 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4401 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4402 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4403 | * @return none.
|
---|
| 4404 | */
|
---|
| 4405 |
|
---|
| 4406 | void arm_correlate_q15(
|
---|
| 4407 | q15_t * pSrcA,
|
---|
| 4408 | uint32_t srcALen,
|
---|
| 4409 | q15_t * pSrcB,
|
---|
| 4410 | uint32_t srcBLen,
|
---|
| 4411 | q15_t * pDst);
|
---|
| 4412 |
|
---|
| 4413 | /**
|
---|
| 4414 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
|
---|
| 4415 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4416 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4417 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4418 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4419 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4420 | * @return none.
|
---|
| 4421 | */
|
---|
| 4422 |
|
---|
| 4423 | void arm_correlate_fast_q15(
|
---|
| 4424 | q15_t * pSrcA,
|
---|
| 4425 | uint32_t srcALen,
|
---|
| 4426 | q15_t * pSrcB,
|
---|
| 4427 | uint32_t srcBLen,
|
---|
| 4428 | q15_t * pDst);
|
---|
| 4429 |
|
---|
| 4430 |
|
---|
| 4431 |
|
---|
| 4432 | /**
|
---|
| 4433 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
|
---|
| 4434 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4435 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4436 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4437 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4438 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4439 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 4440 | * @return none.
|
---|
| 4441 | */
|
---|
| 4442 |
|
---|
| 4443 | void arm_correlate_fast_opt_q15(
|
---|
| 4444 | q15_t * pSrcA,
|
---|
| 4445 | uint32_t srcALen,
|
---|
| 4446 | q15_t * pSrcB,
|
---|
| 4447 | uint32_t srcBLen,
|
---|
| 4448 | q15_t * pDst,
|
---|
| 4449 | q15_t * pScratch);
|
---|
| 4450 |
|
---|
| 4451 | /**
|
---|
| 4452 | * @brief Correlation of Q31 sequences.
|
---|
| 4453 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4454 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4455 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4456 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4457 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4458 | * @return none.
|
---|
| 4459 | */
|
---|
| 4460 |
|
---|
| 4461 | void arm_correlate_q31(
|
---|
| 4462 | q31_t * pSrcA,
|
---|
| 4463 | uint32_t srcALen,
|
---|
| 4464 | q31_t * pSrcB,
|
---|
| 4465 | uint32_t srcBLen,
|
---|
| 4466 | q31_t * pDst);
|
---|
| 4467 |
|
---|
| 4468 | /**
|
---|
| 4469 | * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
|
---|
| 4470 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4471 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4472 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4473 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4474 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4475 | * @return none.
|
---|
| 4476 | */
|
---|
| 4477 |
|
---|
| 4478 | void arm_correlate_fast_q31(
|
---|
| 4479 | q31_t * pSrcA,
|
---|
| 4480 | uint32_t srcALen,
|
---|
| 4481 | q31_t * pSrcB,
|
---|
| 4482 | uint32_t srcBLen,
|
---|
| 4483 | q31_t * pDst);
|
---|
| 4484 |
|
---|
| 4485 |
|
---|
| 4486 |
|
---|
| 4487 | /**
|
---|
| 4488 | * @brief Correlation of Q7 sequences.
|
---|
| 4489 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4490 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4491 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4492 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4493 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4494 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
|
---|
| 4495 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
|
---|
| 4496 | * @return none.
|
---|
| 4497 | */
|
---|
| 4498 |
|
---|
| 4499 | void arm_correlate_opt_q7(
|
---|
| 4500 | q7_t * pSrcA,
|
---|
| 4501 | uint32_t srcALen,
|
---|
| 4502 | q7_t * pSrcB,
|
---|
| 4503 | uint32_t srcBLen,
|
---|
| 4504 | q7_t * pDst,
|
---|
| 4505 | q15_t * pScratch1,
|
---|
| 4506 | q15_t * pScratch2);
|
---|
| 4507 |
|
---|
| 4508 |
|
---|
| 4509 | /**
|
---|
| 4510 | * @brief Correlation of Q7 sequences.
|
---|
| 4511 | * @param[in] *pSrcA points to the first input sequence.
|
---|
| 4512 | * @param[in] srcALen length of the first input sequence.
|
---|
| 4513 | * @param[in] *pSrcB points to the second input sequence.
|
---|
| 4514 | * @param[in] srcBLen length of the second input sequence.
|
---|
| 4515 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
|
---|
| 4516 | * @return none.
|
---|
| 4517 | */
|
---|
| 4518 |
|
---|
| 4519 | void arm_correlate_q7(
|
---|
| 4520 | q7_t * pSrcA,
|
---|
| 4521 | uint32_t srcALen,
|
---|
| 4522 | q7_t * pSrcB,
|
---|
| 4523 | uint32_t srcBLen,
|
---|
| 4524 | q7_t * pDst);
|
---|
| 4525 |
|
---|
| 4526 |
|
---|
| 4527 | /**
|
---|
| 4528 | * @brief Instance structure for the floating-point sparse FIR filter.
|
---|
| 4529 | */
|
---|
| 4530 | typedef struct
|
---|
| 4531 | {
|
---|
| 4532 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4533 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
|
---|
| 4534 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
|
---|
| 4535 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 4536 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
|
---|
| 4537 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
|
---|
| 4538 | } arm_fir_sparse_instance_f32;
|
---|
| 4539 |
|
---|
| 4540 | /**
|
---|
| 4541 | * @brief Instance structure for the Q31 sparse FIR filter.
|
---|
| 4542 | */
|
---|
| 4543 |
|
---|
| 4544 | typedef struct
|
---|
| 4545 | {
|
---|
| 4546 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4547 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
|
---|
| 4548 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
|
---|
| 4549 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 4550 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
|
---|
| 4551 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
|
---|
| 4552 | } arm_fir_sparse_instance_q31;
|
---|
| 4553 |
|
---|
| 4554 | /**
|
---|
| 4555 | * @brief Instance structure for the Q15 sparse FIR filter.
|
---|
| 4556 | */
|
---|
| 4557 |
|
---|
| 4558 | typedef struct
|
---|
| 4559 | {
|
---|
| 4560 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4561 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
|
---|
| 4562 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
|
---|
| 4563 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 4564 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
|
---|
| 4565 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
|
---|
| 4566 | } arm_fir_sparse_instance_q15;
|
---|
| 4567 |
|
---|
| 4568 | /**
|
---|
| 4569 | * @brief Instance structure for the Q7 sparse FIR filter.
|
---|
| 4570 | */
|
---|
| 4571 |
|
---|
| 4572 | typedef struct
|
---|
| 4573 | {
|
---|
| 4574 | uint16_t numTaps; /**< number of coefficients in the filter. */
|
---|
| 4575 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
|
---|
| 4576 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
|
---|
| 4577 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
|
---|
| 4578 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
|
---|
| 4579 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
|
---|
| 4580 | } arm_fir_sparse_instance_q7;
|
---|
| 4581 |
|
---|
| 4582 | /**
|
---|
| 4583 | * @brief Processing function for the floating-point sparse FIR filter.
|
---|
| 4584 | * @param[in] *S points to an instance of the floating-point sparse FIR structure.
|
---|
| 4585 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4586 | * @param[out] *pDst points to the block of output data
|
---|
| 4587 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
|
---|
| 4588 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 4589 | * @return none.
|
---|
| 4590 | */
|
---|
| 4591 |
|
---|
| 4592 | void arm_fir_sparse_f32(
|
---|
| 4593 | arm_fir_sparse_instance_f32 * S,
|
---|
| 4594 | float32_t * pSrc,
|
---|
| 4595 | float32_t * pDst,
|
---|
| 4596 | float32_t * pScratchIn,
|
---|
| 4597 | uint32_t blockSize);
|
---|
| 4598 |
|
---|
| 4599 | /**
|
---|
| 4600 | * @brief Initialization function for the floating-point sparse FIR filter.
|
---|
| 4601 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
|
---|
| 4602 | * @param[in] numTaps number of nonzero coefficients in the filter.
|
---|
| 4603 | * @param[in] *pCoeffs points to the array of filter coefficients.
|
---|
| 4604 | * @param[in] *pState points to the state buffer.
|
---|
| 4605 | * @param[in] *pTapDelay points to the array of offset times.
|
---|
| 4606 | * @param[in] maxDelay maximum offset time supported.
|
---|
| 4607 | * @param[in] blockSize number of samples that will be processed per block.
|
---|
| 4608 | * @return none
|
---|
| 4609 | */
|
---|
| 4610 |
|
---|
| 4611 | void arm_fir_sparse_init_f32(
|
---|
| 4612 | arm_fir_sparse_instance_f32 * S,
|
---|
| 4613 | uint16_t numTaps,
|
---|
| 4614 | float32_t * pCoeffs,
|
---|
| 4615 | float32_t * pState,
|
---|
| 4616 | int32_t * pTapDelay,
|
---|
| 4617 | uint16_t maxDelay,
|
---|
| 4618 | uint32_t blockSize);
|
---|
| 4619 |
|
---|
| 4620 | /**
|
---|
| 4621 | * @brief Processing function for the Q31 sparse FIR filter.
|
---|
| 4622 | * @param[in] *S points to an instance of the Q31 sparse FIR structure.
|
---|
| 4623 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4624 | * @param[out] *pDst points to the block of output data
|
---|
| 4625 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
|
---|
| 4626 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 4627 | * @return none.
|
---|
| 4628 | */
|
---|
| 4629 |
|
---|
| 4630 | void arm_fir_sparse_q31(
|
---|
| 4631 | arm_fir_sparse_instance_q31 * S,
|
---|
| 4632 | q31_t * pSrc,
|
---|
| 4633 | q31_t * pDst,
|
---|
| 4634 | q31_t * pScratchIn,
|
---|
| 4635 | uint32_t blockSize);
|
---|
| 4636 |
|
---|
| 4637 | /**
|
---|
| 4638 | * @brief Initialization function for the Q31 sparse FIR filter.
|
---|
| 4639 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
|
---|
| 4640 | * @param[in] numTaps number of nonzero coefficients in the filter.
|
---|
| 4641 | * @param[in] *pCoeffs points to the array of filter coefficients.
|
---|
| 4642 | * @param[in] *pState points to the state buffer.
|
---|
| 4643 | * @param[in] *pTapDelay points to the array of offset times.
|
---|
| 4644 | * @param[in] maxDelay maximum offset time supported.
|
---|
| 4645 | * @param[in] blockSize number of samples that will be processed per block.
|
---|
| 4646 | * @return none
|
---|
| 4647 | */
|
---|
| 4648 |
|
---|
| 4649 | void arm_fir_sparse_init_q31(
|
---|
| 4650 | arm_fir_sparse_instance_q31 * S,
|
---|
| 4651 | uint16_t numTaps,
|
---|
| 4652 | q31_t * pCoeffs,
|
---|
| 4653 | q31_t * pState,
|
---|
| 4654 | int32_t * pTapDelay,
|
---|
| 4655 | uint16_t maxDelay,
|
---|
| 4656 | uint32_t blockSize);
|
---|
| 4657 |
|
---|
| 4658 | /**
|
---|
| 4659 | * @brief Processing function for the Q15 sparse FIR filter.
|
---|
| 4660 | * @param[in] *S points to an instance of the Q15 sparse FIR structure.
|
---|
| 4661 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4662 | * @param[out] *pDst points to the block of output data
|
---|
| 4663 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
|
---|
| 4664 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
|
---|
| 4665 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 4666 | * @return none.
|
---|
| 4667 | */
|
---|
| 4668 |
|
---|
| 4669 | void arm_fir_sparse_q15(
|
---|
| 4670 | arm_fir_sparse_instance_q15 * S,
|
---|
| 4671 | q15_t * pSrc,
|
---|
| 4672 | q15_t * pDst,
|
---|
| 4673 | q15_t * pScratchIn,
|
---|
| 4674 | q31_t * pScratchOut,
|
---|
| 4675 | uint32_t blockSize);
|
---|
| 4676 |
|
---|
| 4677 |
|
---|
| 4678 | /**
|
---|
| 4679 | * @brief Initialization function for the Q15 sparse FIR filter.
|
---|
| 4680 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
|
---|
| 4681 | * @param[in] numTaps number of nonzero coefficients in the filter.
|
---|
| 4682 | * @param[in] *pCoeffs points to the array of filter coefficients.
|
---|
| 4683 | * @param[in] *pState points to the state buffer.
|
---|
| 4684 | * @param[in] *pTapDelay points to the array of offset times.
|
---|
| 4685 | * @param[in] maxDelay maximum offset time supported.
|
---|
| 4686 | * @param[in] blockSize number of samples that will be processed per block.
|
---|
| 4687 | * @return none
|
---|
| 4688 | */
|
---|
| 4689 |
|
---|
| 4690 | void arm_fir_sparse_init_q15(
|
---|
| 4691 | arm_fir_sparse_instance_q15 * S,
|
---|
| 4692 | uint16_t numTaps,
|
---|
| 4693 | q15_t * pCoeffs,
|
---|
| 4694 | q15_t * pState,
|
---|
| 4695 | int32_t * pTapDelay,
|
---|
| 4696 | uint16_t maxDelay,
|
---|
| 4697 | uint32_t blockSize);
|
---|
| 4698 |
|
---|
| 4699 | /**
|
---|
| 4700 | * @brief Processing function for the Q7 sparse FIR filter.
|
---|
| 4701 | * @param[in] *S points to an instance of the Q7 sparse FIR structure.
|
---|
| 4702 | * @param[in] *pSrc points to the block of input data.
|
---|
| 4703 | * @param[out] *pDst points to the block of output data
|
---|
| 4704 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
|
---|
| 4705 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
|
---|
| 4706 | * @param[in] blockSize number of input samples to process per call.
|
---|
| 4707 | * @return none.
|
---|
| 4708 | */
|
---|
| 4709 |
|
---|
| 4710 | void arm_fir_sparse_q7(
|
---|
| 4711 | arm_fir_sparse_instance_q7 * S,
|
---|
| 4712 | q7_t * pSrc,
|
---|
| 4713 | q7_t * pDst,
|
---|
| 4714 | q7_t * pScratchIn,
|
---|
| 4715 | q31_t * pScratchOut,
|
---|
| 4716 | uint32_t blockSize);
|
---|
| 4717 |
|
---|
| 4718 | /**
|
---|
| 4719 | * @brief Initialization function for the Q7 sparse FIR filter.
|
---|
| 4720 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
|
---|
| 4721 | * @param[in] numTaps number of nonzero coefficients in the filter.
|
---|
| 4722 | * @param[in] *pCoeffs points to the array of filter coefficients.
|
---|
| 4723 | * @param[in] *pState points to the state buffer.
|
---|
| 4724 | * @param[in] *pTapDelay points to the array of offset times.
|
---|
| 4725 | * @param[in] maxDelay maximum offset time supported.
|
---|
| 4726 | * @param[in] blockSize number of samples that will be processed per block.
|
---|
| 4727 | * @return none
|
---|
| 4728 | */
|
---|
| 4729 |
|
---|
| 4730 | void arm_fir_sparse_init_q7(
|
---|
| 4731 | arm_fir_sparse_instance_q7 * S,
|
---|
| 4732 | uint16_t numTaps,
|
---|
| 4733 | q7_t * pCoeffs,
|
---|
| 4734 | q7_t * pState,
|
---|
| 4735 | int32_t * pTapDelay,
|
---|
| 4736 | uint16_t maxDelay,
|
---|
| 4737 | uint32_t blockSize);
|
---|
| 4738 |
|
---|
| 4739 |
|
---|
| 4740 | /*
|
---|
| 4741 | * @brief Floating-point sin_cos function.
|
---|
| 4742 | * @param[in] theta input value in degrees
|
---|
| 4743 | * @param[out] *pSinVal points to the processed sine output.
|
---|
| 4744 | * @param[out] *pCosVal points to the processed cos output.
|
---|
| 4745 | * @return none.
|
---|
| 4746 | */
|
---|
| 4747 |
|
---|
| 4748 | void arm_sin_cos_f32(
|
---|
| 4749 | float32_t theta,
|
---|
| 4750 | float32_t * pSinVal,
|
---|
| 4751 | float32_t * pCcosVal);
|
---|
| 4752 |
|
---|
| 4753 | /*
|
---|
| 4754 | * @brief Q31 sin_cos function.
|
---|
| 4755 | * @param[in] theta scaled input value in degrees
|
---|
| 4756 | * @param[out] *pSinVal points to the processed sine output.
|
---|
| 4757 | * @param[out] *pCosVal points to the processed cosine output.
|
---|
| 4758 | * @return none.
|
---|
| 4759 | */
|
---|
| 4760 |
|
---|
| 4761 | void arm_sin_cos_q31(
|
---|
| 4762 | q31_t theta,
|
---|
| 4763 | q31_t * pSinVal,
|
---|
| 4764 | q31_t * pCosVal);
|
---|
| 4765 |
|
---|
| 4766 |
|
---|
| 4767 | /**
|
---|
| 4768 | * @brief Floating-point complex conjugate.
|
---|
| 4769 | * @param[in] *pSrc points to the input vector
|
---|
| 4770 | * @param[out] *pDst points to the output vector
|
---|
| 4771 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 4772 | * @return none.
|
---|
| 4773 | */
|
---|
| 4774 |
|
---|
| 4775 | void arm_cmplx_conj_f32(
|
---|
| 4776 | float32_t * pSrc,
|
---|
| 4777 | float32_t * pDst,
|
---|
| 4778 | uint32_t numSamples);
|
---|
| 4779 |
|
---|
| 4780 | /**
|
---|
| 4781 | * @brief Q31 complex conjugate.
|
---|
| 4782 | * @param[in] *pSrc points to the input vector
|
---|
| 4783 | * @param[out] *pDst points to the output vector
|
---|
| 4784 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 4785 | * @return none.
|
---|
| 4786 | */
|
---|
| 4787 |
|
---|
| 4788 | void arm_cmplx_conj_q31(
|
---|
| 4789 | q31_t * pSrc,
|
---|
| 4790 | q31_t * pDst,
|
---|
| 4791 | uint32_t numSamples);
|
---|
| 4792 |
|
---|
| 4793 | /**
|
---|
| 4794 | * @brief Q15 complex conjugate.
|
---|
| 4795 | * @param[in] *pSrc points to the input vector
|
---|
| 4796 | * @param[out] *pDst points to the output vector
|
---|
| 4797 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 4798 | * @return none.
|
---|
| 4799 | */
|
---|
| 4800 |
|
---|
| 4801 | void arm_cmplx_conj_q15(
|
---|
| 4802 | q15_t * pSrc,
|
---|
| 4803 | q15_t * pDst,
|
---|
| 4804 | uint32_t numSamples);
|
---|
| 4805 |
|
---|
| 4806 |
|
---|
| 4807 |
|
---|
| 4808 | /**
|
---|
| 4809 | * @brief Floating-point complex magnitude squared
|
---|
| 4810 | * @param[in] *pSrc points to the complex input vector
|
---|
| 4811 | * @param[out] *pDst points to the real output vector
|
---|
| 4812 | * @param[in] numSamples number of complex samples in the input vector
|
---|
| 4813 | * @return none.
|
---|
| 4814 | */
|
---|
| 4815 |
|
---|
| 4816 | void arm_cmplx_mag_squared_f32(
|
---|
| 4817 | float32_t * pSrc,
|
---|
| 4818 | float32_t * pDst,
|
---|
| 4819 | uint32_t numSamples);
|
---|
| 4820 |
|
---|
| 4821 | /**
|
---|
| 4822 | * @brief Q31 complex magnitude squared
|
---|
| 4823 | * @param[in] *pSrc points to the complex input vector
|
---|
| 4824 | * @param[out] *pDst points to the real output vector
|
---|
| 4825 | * @param[in] numSamples number of complex samples in the input vector
|
---|
| 4826 | * @return none.
|
---|
| 4827 | */
|
---|
| 4828 |
|
---|
| 4829 | void arm_cmplx_mag_squared_q31(
|
---|
| 4830 | q31_t * pSrc,
|
---|
| 4831 | q31_t * pDst,
|
---|
| 4832 | uint32_t numSamples);
|
---|
| 4833 |
|
---|
| 4834 | /**
|
---|
| 4835 | * @brief Q15 complex magnitude squared
|
---|
| 4836 | * @param[in] *pSrc points to the complex input vector
|
---|
| 4837 | * @param[out] *pDst points to the real output vector
|
---|
| 4838 | * @param[in] numSamples number of complex samples in the input vector
|
---|
| 4839 | * @return none.
|
---|
| 4840 | */
|
---|
| 4841 |
|
---|
| 4842 | void arm_cmplx_mag_squared_q15(
|
---|
| 4843 | q15_t * pSrc,
|
---|
| 4844 | q15_t * pDst,
|
---|
| 4845 | uint32_t numSamples);
|
---|
| 4846 |
|
---|
| 4847 |
|
---|
| 4848 | /**
|
---|
| 4849 | * @ingroup groupController
|
---|
| 4850 | */
|
---|
| 4851 |
|
---|
| 4852 | /**
|
---|
| 4853 | * @defgroup PID PID Motor Control
|
---|
| 4854 | *
|
---|
| 4855 | * A Proportional Integral Derivative (PID) controller is a generic feedback control
|
---|
| 4856 | * loop mechanism widely used in industrial control systems.
|
---|
| 4857 | * A PID controller is the most commonly used type of feedback controller.
|
---|
| 4858 | *
|
---|
| 4859 | * This set of functions implements (PID) controllers
|
---|
| 4860 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample
|
---|
| 4861 | * of data and each call to the function returns a single processed value.
|
---|
| 4862 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
|
---|
| 4863 | * is the input sample value. The functions return the output value.
|
---|
| 4864 | *
|
---|
| 4865 | * \par Algorithm:
|
---|
| 4866 | * <pre>
|
---|
| 4867 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
|
---|
| 4868 | * A0 = Kp + Ki + Kd
|
---|
| 4869 | * A1 = (-Kp ) - (2 * Kd )
|
---|
| 4870 | * A2 = Kd </pre>
|
---|
| 4871 | *
|
---|
| 4872 | * \par
|
---|
| 4873 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
|
---|
| 4874 | *
|
---|
| 4875 | * \par
|
---|
| 4876 | * \image html PID.gif "Proportional Integral Derivative Controller"
|
---|
| 4877 | *
|
---|
| 4878 | * \par
|
---|
| 4879 | * The PID controller calculates an "error" value as the difference between
|
---|
| 4880 | * the measured output and the reference input.
|
---|
| 4881 | * The controller attempts to minimize the error by adjusting the process control inputs.
|
---|
| 4882 | * The proportional value determines the reaction to the current error,
|
---|
| 4883 | * the integral value determines the reaction based on the sum of recent errors,
|
---|
| 4884 | * and the derivative value determines the reaction based on the rate at which the error has been changing.
|
---|
| 4885 | *
|
---|
| 4886 | * \par Instance Structure
|
---|
| 4887 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
|
---|
| 4888 | * A separate instance structure must be defined for each PID Controller.
|
---|
| 4889 | * There are separate instance structure declarations for each of the 3 supported data types.
|
---|
| 4890 | *
|
---|
| 4891 | * \par Reset Functions
|
---|
| 4892 | * There is also an associated reset function for each data type which clears the state array.
|
---|
| 4893 | *
|
---|
| 4894 | * \par Initialization Functions
|
---|
| 4895 | * There is also an associated initialization function for each data type.
|
---|
| 4896 | * The initialization function performs the following operations:
|
---|
| 4897 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
|
---|
| 4898 | * - Zeros out the values in the state buffer.
|
---|
| 4899 | *
|
---|
| 4900 | * \par
|
---|
| 4901 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
|
---|
| 4902 | *
|
---|
| 4903 | * \par Fixed-Point Behavior
|
---|
| 4904 | * Care must be taken when using the fixed-point versions of the PID Controller functions.
|
---|
| 4905 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
|
---|
| 4906 | * Refer to the function specific documentation below for usage guidelines.
|
---|
| 4907 | */
|
---|
| 4908 |
|
---|
| 4909 | /**
|
---|
| 4910 | * @addtogroup PID
|
---|
| 4911 | * @{
|
---|
| 4912 | */
|
---|
| 4913 |
|
---|
| 4914 | /**
|
---|
| 4915 | * @brief Process function for the floating-point PID Control.
|
---|
| 4916 | * @param[in,out] *S is an instance of the floating-point PID Control structure
|
---|
| 4917 | * @param[in] in input sample to process
|
---|
| 4918 | * @return out processed output sample.
|
---|
| 4919 | */
|
---|
| 4920 |
|
---|
| 4921 |
|
---|
| 4922 | static __INLINE float32_t arm_pid_f32(
|
---|
| 4923 | arm_pid_instance_f32 * S,
|
---|
| 4924 | float32_t in)
|
---|
| 4925 | {
|
---|
| 4926 | float32_t out;
|
---|
| 4927 |
|
---|
| 4928 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
|
---|
| 4929 | out = (S->A0 * in) +
|
---|
| 4930 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
|
---|
| 4931 |
|
---|
| 4932 | /* Update state */
|
---|
| 4933 | S->state[1] = S->state[0];
|
---|
| 4934 | S->state[0] = in;
|
---|
| 4935 | S->state[2] = out;
|
---|
| 4936 |
|
---|
| 4937 | /* return to application */
|
---|
| 4938 | return (out);
|
---|
| 4939 |
|
---|
| 4940 | }
|
---|
| 4941 |
|
---|
| 4942 | /**
|
---|
| 4943 | * @brief Process function for the Q31 PID Control.
|
---|
| 4944 | * @param[in,out] *S points to an instance of the Q31 PID Control structure
|
---|
| 4945 | * @param[in] in input sample to process
|
---|
| 4946 | * @return out processed output sample.
|
---|
| 4947 | *
|
---|
| 4948 | * <b>Scaling and Overflow Behavior:</b>
|
---|
| 4949 | * \par
|
---|
| 4950 | * The function is implemented using an internal 64-bit accumulator.
|
---|
| 4951 | * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
|
---|
| 4952 | * Thus, if the accumulator result overflows it wraps around rather than clip.
|
---|
| 4953 | * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
|
---|
| 4954 | * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
|
---|
| 4955 | */
|
---|
| 4956 |
|
---|
| 4957 | static __INLINE q31_t arm_pid_q31(
|
---|
| 4958 | arm_pid_instance_q31 * S,
|
---|
| 4959 | q31_t in)
|
---|
| 4960 | {
|
---|
| 4961 | q63_t acc;
|
---|
| 4962 | q31_t out;
|
---|
| 4963 |
|
---|
| 4964 | /* acc = A0 * x[n] */
|
---|
| 4965 | acc = (q63_t) S->A0 * in;
|
---|
| 4966 |
|
---|
| 4967 | /* acc += A1 * x[n-1] */
|
---|
| 4968 | acc += (q63_t) S->A1 * S->state[0];
|
---|
| 4969 |
|
---|
| 4970 | /* acc += A2 * x[n-2] */
|
---|
| 4971 | acc += (q63_t) S->A2 * S->state[1];
|
---|
| 4972 |
|
---|
| 4973 | /* convert output to 1.31 format to add y[n-1] */
|
---|
| 4974 | out = (q31_t) (acc >> 31u);
|
---|
| 4975 |
|
---|
| 4976 | /* out += y[n-1] */
|
---|
| 4977 | out += S->state[2];
|
---|
| 4978 |
|
---|
| 4979 | /* Update state */
|
---|
| 4980 | S->state[1] = S->state[0];
|
---|
| 4981 | S->state[0] = in;
|
---|
| 4982 | S->state[2] = out;
|
---|
| 4983 |
|
---|
| 4984 | /* return to application */
|
---|
| 4985 | return (out);
|
---|
| 4986 |
|
---|
| 4987 | }
|
---|
| 4988 |
|
---|
| 4989 | /**
|
---|
| 4990 | * @brief Process function for the Q15 PID Control.
|
---|
| 4991 | * @param[in,out] *S points to an instance of the Q15 PID Control structure
|
---|
| 4992 | * @param[in] in input sample to process
|
---|
| 4993 | * @return out processed output sample.
|
---|
| 4994 | *
|
---|
| 4995 | * <b>Scaling and Overflow Behavior:</b>
|
---|
| 4996 | * \par
|
---|
| 4997 | * The function is implemented using a 64-bit internal accumulator.
|
---|
| 4998 | * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
|
---|
| 4999 | * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
|
---|
| 5000 | * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
|
---|
| 5001 | * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
|
---|
| 5002 | * Lastly, the accumulator is saturated to yield a result in 1.15 format.
|
---|
| 5003 | */
|
---|
| 5004 |
|
---|
| 5005 | static __INLINE q15_t arm_pid_q15(
|
---|
| 5006 | arm_pid_instance_q15 * S,
|
---|
| 5007 | q15_t in)
|
---|
| 5008 | {
|
---|
| 5009 | q63_t acc;
|
---|
| 5010 | q15_t out;
|
---|
| 5011 |
|
---|
| 5012 | #ifndef ARM_MATH_CM0_FAMILY
|
---|
| 5013 | __SIMD32_TYPE *vstate;
|
---|
| 5014 |
|
---|
| 5015 | /* Implementation of PID controller */
|
---|
| 5016 |
|
---|
| 5017 | /* acc = A0 * x[n] */
|
---|
| 5018 | acc = (q31_t) __SMUAD(S->A0, in);
|
---|
| 5019 |
|
---|
| 5020 | /* acc += A1 * x[n-1] + A2 * x[n-2] */
|
---|
| 5021 | vstate = __SIMD32_CONST(S->state);
|
---|
| 5022 | acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
|
---|
| 5023 |
|
---|
| 5024 | #else
|
---|
| 5025 | /* acc = A0 * x[n] */
|
---|
| 5026 | acc = ((q31_t) S->A0) * in;
|
---|
| 5027 |
|
---|
| 5028 | /* acc += A1 * x[n-1] + A2 * x[n-2] */
|
---|
| 5029 | acc += (q31_t) S->A1 * S->state[0];
|
---|
| 5030 | acc += (q31_t) S->A2 * S->state[1];
|
---|
| 5031 |
|
---|
| 5032 | #endif
|
---|
| 5033 |
|
---|
| 5034 | /* acc += y[n-1] */
|
---|
| 5035 | acc += (q31_t) S->state[2] << 15;
|
---|
| 5036 |
|
---|
| 5037 | /* saturate the output */
|
---|
| 5038 | out = (q15_t) (__SSAT((acc >> 15), 16));
|
---|
| 5039 |
|
---|
| 5040 | /* Update state */
|
---|
| 5041 | S->state[1] = S->state[0];
|
---|
| 5042 | S->state[0] = in;
|
---|
| 5043 | S->state[2] = out;
|
---|
| 5044 |
|
---|
| 5045 | /* return to application */
|
---|
| 5046 | return (out);
|
---|
| 5047 |
|
---|
| 5048 | }
|
---|
| 5049 |
|
---|
| 5050 | /**
|
---|
| 5051 | * @} end of PID group
|
---|
| 5052 | */
|
---|
| 5053 |
|
---|
| 5054 |
|
---|
| 5055 | /**
|
---|
| 5056 | * @brief Floating-point matrix inverse.
|
---|
| 5057 | * @param[in] *src points to the instance of the input floating-point matrix structure.
|
---|
| 5058 | * @param[out] *dst points to the instance of the output floating-point matrix structure.
|
---|
| 5059 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
|
---|
| 5060 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
|
---|
| 5061 | */
|
---|
| 5062 |
|
---|
| 5063 | arm_status arm_mat_inverse_f32(
|
---|
| 5064 | const arm_matrix_instance_f32 * src,
|
---|
| 5065 | arm_matrix_instance_f32 * dst);
|
---|
| 5066 |
|
---|
| 5067 |
|
---|
| 5068 |
|
---|
| 5069 | /**
|
---|
| 5070 | * @ingroup groupController
|
---|
| 5071 | */
|
---|
| 5072 |
|
---|
| 5073 |
|
---|
| 5074 | /**
|
---|
| 5075 | * @defgroup clarke Vector Clarke Transform
|
---|
| 5076 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
|
---|
| 5077 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
|
---|
| 5078 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
|
---|
| 5079 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
|
---|
| 5080 | * \image html clarke.gif Stator current space vector and its components in (a,b).
|
---|
| 5081 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
|
---|
| 5082 | * can be calculated using only <code>Ia</code> and <code>Ib</code>.
|
---|
| 5083 | *
|
---|
| 5084 | * The function operates on a single sample of data and each call to the function returns the processed output.
|
---|
| 5085 | * The library provides separate functions for Q31 and floating-point data types.
|
---|
| 5086 | * \par Algorithm
|
---|
| 5087 | * \image html clarkeFormula.gif
|
---|
| 5088 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
|
---|
| 5089 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
|
---|
| 5090 | * \par Fixed-Point Behavior
|
---|
| 5091 | * Care must be taken when using the Q31 version of the Clarke transform.
|
---|
| 5092 | * In particular, the overflow and saturation behavior of the accumulator used must be considered.
|
---|
| 5093 | * Refer to the function specific documentation below for usage guidelines.
|
---|
| 5094 | */
|
---|
| 5095 |
|
---|
| 5096 | /**
|
---|
| 5097 | * @addtogroup clarke
|
---|
| 5098 | * @{
|
---|
| 5099 | */
|
---|
| 5100 |
|
---|
| 5101 | /**
|
---|
| 5102 | *
|
---|
| 5103 | * @brief Floating-point Clarke transform
|
---|
| 5104 | * @param[in] Ia input three-phase coordinate <code>a</code>
|
---|
| 5105 | * @param[in] Ib input three-phase coordinate <code>b</code>
|
---|
| 5106 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
|
---|
| 5107 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
|
---|
| 5108 | * @return none.
|
---|
| 5109 | */
|
---|
| 5110 |
|
---|
| 5111 | static __INLINE void arm_clarke_f32(
|
---|
| 5112 | float32_t Ia,
|
---|
| 5113 | float32_t Ib,
|
---|
| 5114 | float32_t * pIalpha,
|
---|
| 5115 | float32_t * pIbeta)
|
---|
| 5116 | {
|
---|
| 5117 | /* Calculate pIalpha using the equation, pIalpha = Ia */
|
---|
| 5118 | *pIalpha = Ia;
|
---|
| 5119 |
|
---|
| 5120 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
|
---|
| 5121 | *pIbeta =
|
---|
| 5122 | ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
|
---|
| 5123 |
|
---|
| 5124 | }
|
---|
| 5125 |
|
---|
| 5126 | /**
|
---|
| 5127 | * @brief Clarke transform for Q31 version
|
---|
| 5128 | * @param[in] Ia input three-phase coordinate <code>a</code>
|
---|
| 5129 | * @param[in] Ib input three-phase coordinate <code>b</code>
|
---|
| 5130 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
|
---|
| 5131 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
|
---|
| 5132 | * @return none.
|
---|
| 5133 | *
|
---|
| 5134 | * <b>Scaling and Overflow Behavior:</b>
|
---|
| 5135 | * \par
|
---|
| 5136 | * The function is implemented using an internal 32-bit accumulator.
|
---|
| 5137 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
|
---|
| 5138 | * There is saturation on the addition, hence there is no risk of overflow.
|
---|
| 5139 | */
|
---|
| 5140 |
|
---|
| 5141 | static __INLINE void arm_clarke_q31(
|
---|
| 5142 | q31_t Ia,
|
---|
| 5143 | q31_t Ib,
|
---|
| 5144 | q31_t * pIalpha,
|
---|
| 5145 | q31_t * pIbeta)
|
---|
| 5146 | {
|
---|
| 5147 | q31_t product1, product2; /* Temporary variables used to store intermediate results */
|
---|
| 5148 |
|
---|
| 5149 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */
|
---|
| 5150 | *pIalpha = Ia;
|
---|
| 5151 |
|
---|
| 5152 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
|
---|
| 5153 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
|
---|
| 5154 |
|
---|
| 5155 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
|
---|
| 5156 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
|
---|
| 5157 |
|
---|
| 5158 | /* pIbeta is calculated by adding the intermediate products */
|
---|
| 5159 | *pIbeta = __QADD(product1, product2);
|
---|
| 5160 | }
|
---|
| 5161 |
|
---|
| 5162 | /**
|
---|
| 5163 | * @} end of clarke group
|
---|
| 5164 | */
|
---|
| 5165 |
|
---|
| 5166 | /**
|
---|
| 5167 | * @brief Converts the elements of the Q7 vector to Q31 vector.
|
---|
| 5168 | * @param[in] *pSrc input pointer
|
---|
| 5169 | * @param[out] *pDst output pointer
|
---|
| 5170 | * @param[in] blockSize number of samples to process
|
---|
| 5171 | * @return none.
|
---|
| 5172 | */
|
---|
| 5173 | void arm_q7_to_q31(
|
---|
| 5174 | q7_t * pSrc,
|
---|
| 5175 | q31_t * pDst,
|
---|
| 5176 | uint32_t blockSize);
|
---|
| 5177 |
|
---|
| 5178 |
|
---|
| 5179 |
|
---|
| 5180 |
|
---|
| 5181 | /**
|
---|
| 5182 | * @ingroup groupController
|
---|
| 5183 | */
|
---|
| 5184 |
|
---|
| 5185 | /**
|
---|
| 5186 | * @defgroup inv_clarke Vector Inverse Clarke Transform
|
---|
| 5187 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
|
---|
| 5188 | *
|
---|
| 5189 | * The function operates on a single sample of data and each call to the function returns the processed output.
|
---|
| 5190 | * The library provides separate functions for Q31 and floating-point data types.
|
---|
| 5191 | * \par Algorithm
|
---|
| 5192 | * \image html clarkeInvFormula.gif
|
---|
| 5193 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
|
---|
| 5194 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
|
---|
| 5195 | * \par Fixed-Point Behavior
|
---|
| 5196 | * Care must be taken when using the Q31 version of the Clarke transform.
|
---|
| 5197 | * In particular, the overflow and saturation behavior of the accumulator used must be considered.
|
---|
| 5198 | * Refer to the function specific documentation below for usage guidelines.
|
---|
| 5199 | */
|
---|
| 5200 |
|
---|
| 5201 | /**
|
---|
| 5202 | * @addtogroup inv_clarke
|
---|
| 5203 | * @{
|
---|
| 5204 | */
|
---|
| 5205 |
|
---|
| 5206 | /**
|
---|
| 5207 | * @brief Floating-point Inverse Clarke transform
|
---|
| 5208 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha
|
---|
| 5209 | * @param[in] Ibeta input two-phase orthogonal vector axis beta
|
---|
| 5210 | * @param[out] *pIa points to output three-phase coordinate <code>a</code>
|
---|
| 5211 | * @param[out] *pIb points to output three-phase coordinate <code>b</code>
|
---|
| 5212 | * @return none.
|
---|
| 5213 | */
|
---|
| 5214 |
|
---|
| 5215 |
|
---|
| 5216 | static __INLINE void arm_inv_clarke_f32(
|
---|
| 5217 | float32_t Ialpha,
|
---|
| 5218 | float32_t Ibeta,
|
---|
| 5219 | float32_t * pIa,
|
---|
| 5220 | float32_t * pIb)
|
---|
| 5221 | {
|
---|
| 5222 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */
|
---|
| 5223 | *pIa = Ialpha;
|
---|
| 5224 |
|
---|
| 5225 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
|
---|
| 5226 | *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
|
---|
| 5227 |
|
---|
| 5228 | }
|
---|
| 5229 |
|
---|
| 5230 | /**
|
---|
| 5231 | * @brief Inverse Clarke transform for Q31 version
|
---|
| 5232 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha
|
---|
| 5233 | * @param[in] Ibeta input two-phase orthogonal vector axis beta
|
---|
| 5234 | * @param[out] *pIa points to output three-phase coordinate <code>a</code>
|
---|
| 5235 | * @param[out] *pIb points to output three-phase coordinate <code>b</code>
|
---|
| 5236 | * @return none.
|
---|
| 5237 | *
|
---|
| 5238 | * <b>Scaling and Overflow Behavior:</b>
|
---|
| 5239 | * \par
|
---|
| 5240 | * The function is implemented using an internal 32-bit accumulator.
|
---|
| 5241 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
|
---|
| 5242 | * There is saturation on the subtraction, hence there is no risk of overflow.
|
---|
| 5243 | */
|
---|
| 5244 |
|
---|
| 5245 | static __INLINE void arm_inv_clarke_q31(
|
---|
| 5246 | q31_t Ialpha,
|
---|
| 5247 | q31_t Ibeta,
|
---|
| 5248 | q31_t * pIa,
|
---|
| 5249 | q31_t * pIb)
|
---|
| 5250 | {
|
---|
| 5251 | q31_t product1, product2; /* Temporary variables used to store intermediate results */
|
---|
| 5252 |
|
---|
| 5253 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */
|
---|
| 5254 | *pIa = Ialpha;
|
---|
| 5255 |
|
---|
| 5256 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
|
---|
| 5257 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
|
---|
| 5258 |
|
---|
| 5259 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
|
---|
| 5260 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
|
---|
| 5261 |
|
---|
| 5262 | /* pIb is calculated by subtracting the products */
|
---|
| 5263 | *pIb = __QSUB(product2, product1);
|
---|
| 5264 |
|
---|
| 5265 | }
|
---|
| 5266 |
|
---|
| 5267 | /**
|
---|
| 5268 | * @} end of inv_clarke group
|
---|
| 5269 | */
|
---|
| 5270 |
|
---|
| 5271 | /**
|
---|
| 5272 | * @brief Converts the elements of the Q7 vector to Q15 vector.
|
---|
| 5273 | * @param[in] *pSrc input pointer
|
---|
| 5274 | * @param[out] *pDst output pointer
|
---|
| 5275 | * @param[in] blockSize number of samples to process
|
---|
| 5276 | * @return none.
|
---|
| 5277 | */
|
---|
| 5278 | void arm_q7_to_q15(
|
---|
| 5279 | q7_t * pSrc,
|
---|
| 5280 | q15_t * pDst,
|
---|
| 5281 | uint32_t blockSize);
|
---|
| 5282 |
|
---|
| 5283 |
|
---|
| 5284 |
|
---|
| 5285 | /**
|
---|
| 5286 | * @ingroup groupController
|
---|
| 5287 | */
|
---|
| 5288 |
|
---|
| 5289 | /**
|
---|
| 5290 | * @defgroup park Vector Park Transform
|
---|
| 5291 | *
|
---|
| 5292 | * Forward Park transform converts the input two-coordinate vector to flux and torque components.
|
---|
| 5293 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
|
---|
| 5294 | * from the stationary to the moving reference frame and control the spatial relationship between
|
---|
| 5295 | * the stator vector current and rotor flux vector.
|
---|
| 5296 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the
|
---|
| 5297 | * current vector and the relationship from the two reference frames:
|
---|
| 5298 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
|
---|
| 5299 | *
|
---|
| 5300 | * The function operates on a single sample of data and each call to the function returns the processed output.
|
---|
| 5301 | * The library provides separate functions for Q31 and floating-point data types.
|
---|
| 5302 | * \par Algorithm
|
---|
| 5303 | * \image html parkFormula.gif
|
---|
| 5304 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
|
---|
| 5305 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
|
---|
| 5306 | * cosine and sine values of theta (rotor flux position).
|
---|
| 5307 | * \par Fixed-Point Behavior
|
---|
| 5308 | * Care must be taken when using the Q31 version of the Park transform.
|
---|
| 5309 | * In particular, the overflow and saturation behavior of the accumulator used must be considered.
|
---|
| 5310 | * Refer to the function specific documentation below for usage guidelines.
|
---|
| 5311 | */
|
---|
| 5312 |
|
---|
| 5313 | /**
|
---|
| 5314 | * @addtogroup park
|
---|
| 5315 | * @{
|
---|
| 5316 | */
|
---|
| 5317 |
|
---|
| 5318 | /**
|
---|
| 5319 | * @brief Floating-point Park transform
|
---|
| 5320 | * @param[in] Ialpha input two-phase vector coordinate alpha
|
---|
| 5321 | * @param[in] Ibeta input two-phase vector coordinate beta
|
---|
| 5322 | * @param[out] *pId points to output rotor reference frame d
|
---|
| 5323 | * @param[out] *pIq points to output rotor reference frame q
|
---|
| 5324 | * @param[in] sinVal sine value of rotation angle theta
|
---|
| 5325 | * @param[in] cosVal cosine value of rotation angle theta
|
---|
| 5326 | * @return none.
|
---|
| 5327 | *
|
---|
| 5328 | * The function implements the forward Park transform.
|
---|
| 5329 | *
|
---|
| 5330 | */
|
---|
| 5331 |
|
---|
| 5332 | static __INLINE void arm_park_f32(
|
---|
| 5333 | float32_t Ialpha,
|
---|
| 5334 | float32_t Ibeta,
|
---|
| 5335 | float32_t * pId,
|
---|
| 5336 | float32_t * pIq,
|
---|
| 5337 | float32_t sinVal,
|
---|
| 5338 | float32_t cosVal)
|
---|
| 5339 | {
|
---|
| 5340 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
|
---|
| 5341 | *pId = Ialpha * cosVal + Ibeta * sinVal;
|
---|
| 5342 |
|
---|
| 5343 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
|
---|
| 5344 | *pIq = -Ialpha * sinVal + Ibeta * cosVal;
|
---|
| 5345 |
|
---|
| 5346 | }
|
---|
| 5347 |
|
---|
| 5348 | /**
|
---|
| 5349 | * @brief Park transform for Q31 version
|
---|
| 5350 | * @param[in] Ialpha input two-phase vector coordinate alpha
|
---|
| 5351 | * @param[in] Ibeta input two-phase vector coordinate beta
|
---|
| 5352 | * @param[out] *pId points to output rotor reference frame d
|
---|
| 5353 | * @param[out] *pIq points to output rotor reference frame q
|
---|
| 5354 | * @param[in] sinVal sine value of rotation angle theta
|
---|
| 5355 | * @param[in] cosVal cosine value of rotation angle theta
|
---|
| 5356 | * @return none.
|
---|
| 5357 | *
|
---|
| 5358 | * <b>Scaling and Overflow Behavior:</b>
|
---|
| 5359 | * \par
|
---|
| 5360 | * The function is implemented using an internal 32-bit accumulator.
|
---|
| 5361 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
|
---|
| 5362 | * There is saturation on the addition and subtraction, hence there is no risk of overflow.
|
---|
| 5363 | */
|
---|
| 5364 |
|
---|
| 5365 |
|
---|
| 5366 | static __INLINE void arm_park_q31(
|
---|
| 5367 | q31_t Ialpha,
|
---|
| 5368 | q31_t Ibeta,
|
---|
| 5369 | q31_t * pId,
|
---|
| 5370 | q31_t * pIq,
|
---|
| 5371 | q31_t sinVal,
|
---|
| 5372 | q31_t cosVal)
|
---|
| 5373 | {
|
---|
| 5374 | q31_t product1, product2; /* Temporary variables used to store intermediate results */
|
---|
| 5375 | q31_t product3, product4; /* Temporary variables used to store intermediate results */
|
---|
| 5376 |
|
---|
| 5377 | /* Intermediate product is calculated by (Ialpha * cosVal) */
|
---|
| 5378 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
|
---|
| 5379 |
|
---|
| 5380 | /* Intermediate product is calculated by (Ibeta * sinVal) */
|
---|
| 5381 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
|
---|
| 5382 |
|
---|
| 5383 |
|
---|
| 5384 | /* Intermediate product is calculated by (Ialpha * sinVal) */
|
---|
| 5385 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
|
---|
| 5386 |
|
---|
| 5387 | /* Intermediate product is calculated by (Ibeta * cosVal) */
|
---|
| 5388 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
|
---|
| 5389 |
|
---|
| 5390 | /* Calculate pId by adding the two intermediate products 1 and 2 */
|
---|
| 5391 | *pId = __QADD(product1, product2);
|
---|
| 5392 |
|
---|
| 5393 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
|
---|
| 5394 | *pIq = __QSUB(product4, product3);
|
---|
| 5395 | }
|
---|
| 5396 |
|
---|
| 5397 | /**
|
---|
| 5398 | * @} end of park group
|
---|
| 5399 | */
|
---|
| 5400 |
|
---|
| 5401 | /**
|
---|
| 5402 | * @brief Converts the elements of the Q7 vector to floating-point vector.
|
---|
| 5403 | * @param[in] *pSrc is input pointer
|
---|
| 5404 | * @param[out] *pDst is output pointer
|
---|
| 5405 | * @param[in] blockSize is the number of samples to process
|
---|
| 5406 | * @return none.
|
---|
| 5407 | */
|
---|
| 5408 | void arm_q7_to_float(
|
---|
| 5409 | q7_t * pSrc,
|
---|
| 5410 | float32_t * pDst,
|
---|
| 5411 | uint32_t blockSize);
|
---|
| 5412 |
|
---|
| 5413 |
|
---|
| 5414 | /**
|
---|
| 5415 | * @ingroup groupController
|
---|
| 5416 | */
|
---|
| 5417 |
|
---|
| 5418 | /**
|
---|
| 5419 | * @defgroup inv_park Vector Inverse Park transform
|
---|
| 5420 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
|
---|
| 5421 | *
|
---|
| 5422 | * The function operates on a single sample of data and each call to the function returns the processed output.
|
---|
| 5423 | * The library provides separate functions for Q31 and floating-point data types.
|
---|
| 5424 | * \par Algorithm
|
---|
| 5425 | * \image html parkInvFormula.gif
|
---|
| 5426 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
|
---|
| 5427 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
|
---|
| 5428 | * cosine and sine values of theta (rotor flux position).
|
---|
| 5429 | * \par Fixed-Point Behavior
|
---|
| 5430 | * Care must be taken when using the Q31 version of the Park transform.
|
---|
| 5431 | * In particular, the overflow and saturation behavior of the accumulator used must be considered.
|
---|
| 5432 | * Refer to the function specific documentation below for usage guidelines.
|
---|
| 5433 | */
|
---|
| 5434 |
|
---|
| 5435 | /**
|
---|
| 5436 | * @addtogroup inv_park
|
---|
| 5437 | * @{
|
---|
| 5438 | */
|
---|
| 5439 |
|
---|
| 5440 | /**
|
---|
| 5441 | * @brief Floating-point Inverse Park transform
|
---|
| 5442 | * @param[in] Id input coordinate of rotor reference frame d
|
---|
| 5443 | * @param[in] Iq input coordinate of rotor reference frame q
|
---|
| 5444 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
|
---|
| 5445 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
|
---|
| 5446 | * @param[in] sinVal sine value of rotation angle theta
|
---|
| 5447 | * @param[in] cosVal cosine value of rotation angle theta
|
---|
| 5448 | * @return none.
|
---|
| 5449 | */
|
---|
| 5450 |
|
---|
| 5451 | static __INLINE void arm_inv_park_f32(
|
---|
| 5452 | float32_t Id,
|
---|
| 5453 | float32_t Iq,
|
---|
| 5454 | float32_t * pIalpha,
|
---|
| 5455 | float32_t * pIbeta,
|
---|
| 5456 | float32_t sinVal,
|
---|
| 5457 | float32_t cosVal)
|
---|
| 5458 | {
|
---|
| 5459 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
|
---|
| 5460 | *pIalpha = Id * cosVal - Iq * sinVal;
|
---|
| 5461 |
|
---|
| 5462 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
|
---|
| 5463 | *pIbeta = Id * sinVal + Iq * cosVal;
|
---|
| 5464 |
|
---|
| 5465 | }
|
---|
| 5466 |
|
---|
| 5467 |
|
---|
| 5468 | /**
|
---|
| 5469 | * @brief Inverse Park transform for Q31 version
|
---|
| 5470 | * @param[in] Id input coordinate of rotor reference frame d
|
---|
| 5471 | * @param[in] Iq input coordinate of rotor reference frame q
|
---|
| 5472 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
|
---|
| 5473 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
|
---|
| 5474 | * @param[in] sinVal sine value of rotation angle theta
|
---|
| 5475 | * @param[in] cosVal cosine value of rotation angle theta
|
---|
| 5476 | * @return none.
|
---|
| 5477 | *
|
---|
| 5478 | * <b>Scaling and Overflow Behavior:</b>
|
---|
| 5479 | * \par
|
---|
| 5480 | * The function is implemented using an internal 32-bit accumulator.
|
---|
| 5481 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
|
---|
| 5482 | * There is saturation on the addition, hence there is no risk of overflow.
|
---|
| 5483 | */
|
---|
| 5484 |
|
---|
| 5485 |
|
---|
| 5486 | static __INLINE void arm_inv_park_q31(
|
---|
| 5487 | q31_t Id,
|
---|
| 5488 | q31_t Iq,
|
---|
| 5489 | q31_t * pIalpha,
|
---|
| 5490 | q31_t * pIbeta,
|
---|
| 5491 | q31_t sinVal,
|
---|
| 5492 | q31_t cosVal)
|
---|
| 5493 | {
|
---|
| 5494 | q31_t product1, product2; /* Temporary variables used to store intermediate results */
|
---|
| 5495 | q31_t product3, product4; /* Temporary variables used to store intermediate results */
|
---|
| 5496 |
|
---|
| 5497 | /* Intermediate product is calculated by (Id * cosVal) */
|
---|
| 5498 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
|
---|
| 5499 |
|
---|
| 5500 | /* Intermediate product is calculated by (Iq * sinVal) */
|
---|
| 5501 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
|
---|
| 5502 |
|
---|
| 5503 |
|
---|
| 5504 | /* Intermediate product is calculated by (Id * sinVal) */
|
---|
| 5505 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
|
---|
| 5506 |
|
---|
| 5507 | /* Intermediate product is calculated by (Iq * cosVal) */
|
---|
| 5508 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
|
---|
| 5509 |
|
---|
| 5510 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */
|
---|
| 5511 | *pIalpha = __QSUB(product1, product2);
|
---|
| 5512 |
|
---|
| 5513 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */
|
---|
| 5514 | *pIbeta = __QADD(product4, product3);
|
---|
| 5515 |
|
---|
| 5516 | }
|
---|
| 5517 |
|
---|
| 5518 | /**
|
---|
| 5519 | * @} end of Inverse park group
|
---|
| 5520 | */
|
---|
| 5521 |
|
---|
| 5522 |
|
---|
| 5523 | /**
|
---|
| 5524 | * @brief Converts the elements of the Q31 vector to floating-point vector.
|
---|
| 5525 | * @param[in] *pSrc is input pointer
|
---|
| 5526 | * @param[out] *pDst is output pointer
|
---|
| 5527 | * @param[in] blockSize is the number of samples to process
|
---|
| 5528 | * @return none.
|
---|
| 5529 | */
|
---|
| 5530 | void arm_q31_to_float(
|
---|
| 5531 | q31_t * pSrc,
|
---|
| 5532 | float32_t * pDst,
|
---|
| 5533 | uint32_t blockSize);
|
---|
| 5534 |
|
---|
| 5535 | /**
|
---|
| 5536 | * @ingroup groupInterpolation
|
---|
| 5537 | */
|
---|
| 5538 |
|
---|
| 5539 | /**
|
---|
| 5540 | * @defgroup LinearInterpolate Linear Interpolation
|
---|
| 5541 | *
|
---|
| 5542 | * Linear interpolation is a method of curve fitting using linear polynomials.
|
---|
| 5543 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
|
---|
| 5544 | *
|
---|
| 5545 | * \par
|
---|
| 5546 | * \image html LinearInterp.gif "Linear interpolation"
|
---|
| 5547 | *
|
---|
| 5548 | * \par
|
---|
| 5549 | * A Linear Interpolate function calculates an output value(y), for the input(x)
|
---|
| 5550 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
|
---|
| 5551 | *
|
---|
| 5552 | * \par Algorithm:
|
---|
| 5553 | * <pre>
|
---|
| 5554 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
|
---|
| 5555 | * where x0, x1 are nearest values of input x
|
---|
| 5556 | * y0, y1 are nearest values to output y
|
---|
| 5557 | * </pre>
|
---|
| 5558 | *
|
---|
| 5559 | * \par
|
---|
| 5560 | * This set of functions implements Linear interpolation process
|
---|
| 5561 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
|
---|
| 5562 | * sample of data and each call to the function returns a single processed value.
|
---|
| 5563 | * <code>S</code> points to an instance of the Linear Interpolate function data structure.
|
---|
| 5564 | * <code>x</code> is the input sample value. The functions returns the output value.
|
---|
| 5565 | *
|
---|
| 5566 | * \par
|
---|
| 5567 | * if x is outside of the table boundary, Linear interpolation returns first value of the table
|
---|
| 5568 | * if x is below input range and returns last value of table if x is above range.
|
---|
| 5569 | */
|
---|
| 5570 |
|
---|
| 5571 | /**
|
---|
| 5572 | * @addtogroup LinearInterpolate
|
---|
| 5573 | * @{
|
---|
| 5574 | */
|
---|
| 5575 |
|
---|
| 5576 | /**
|
---|
| 5577 | * @brief Process function for the floating-point Linear Interpolation Function.
|
---|
| 5578 | * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
|
---|
| 5579 | * @param[in] x input sample to process
|
---|
| 5580 | * @return y processed output sample.
|
---|
| 5581 | *
|
---|
| 5582 | */
|
---|
| 5583 |
|
---|
| 5584 | static __INLINE float32_t arm_linear_interp_f32(
|
---|
| 5585 | arm_linear_interp_instance_f32 * S,
|
---|
| 5586 | float32_t x)
|
---|
| 5587 | {
|
---|
| 5588 |
|
---|
| 5589 | float32_t y;
|
---|
| 5590 | float32_t x0, x1; /* Nearest input values */
|
---|
| 5591 | float32_t y0, y1; /* Nearest output values */
|
---|
| 5592 | float32_t xSpacing = S->xSpacing; /* spacing between input values */
|
---|
| 5593 | int32_t i; /* Index variable */
|
---|
| 5594 | float32_t *pYData = S->pYData; /* pointer to output table */
|
---|
| 5595 |
|
---|
| 5596 | /* Calculation of index */
|
---|
| 5597 | i = (int32_t) ((x - S->x1) / xSpacing);
|
---|
| 5598 |
|
---|
| 5599 | if(i < 0)
|
---|
| 5600 | {
|
---|
| 5601 | /* Iniatilize output for below specified range as least output value of table */
|
---|
| 5602 | y = pYData[0];
|
---|
| 5603 | }
|
---|
| 5604 | else if((uint32_t)i >= S->nValues)
|
---|
| 5605 | {
|
---|
| 5606 | /* Iniatilize output for above specified range as last output value of table */
|
---|
| 5607 | y = pYData[S->nValues - 1];
|
---|
| 5608 | }
|
---|
| 5609 | else
|
---|
| 5610 | {
|
---|
| 5611 | /* Calculation of nearest input values */
|
---|
| 5612 | x0 = S->x1 + i * xSpacing;
|
---|
| 5613 | x1 = S->x1 + (i + 1) * xSpacing;
|
---|
| 5614 |
|
---|
| 5615 | /* Read of nearest output values */
|
---|
| 5616 | y0 = pYData[i];
|
---|
| 5617 | y1 = pYData[i + 1];
|
---|
| 5618 |
|
---|
| 5619 | /* Calculation of output */
|
---|
| 5620 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
|
---|
| 5621 |
|
---|
| 5622 | }
|
---|
| 5623 |
|
---|
| 5624 | /* returns output value */
|
---|
| 5625 | return (y);
|
---|
| 5626 | }
|
---|
| 5627 |
|
---|
| 5628 | /**
|
---|
| 5629 | *
|
---|
| 5630 | * @brief Process function for the Q31 Linear Interpolation Function.
|
---|
| 5631 | * @param[in] *pYData pointer to Q31 Linear Interpolation table
|
---|
| 5632 | * @param[in] x input sample to process
|
---|
| 5633 | * @param[in] nValues number of table values
|
---|
| 5634 | * @return y processed output sample.
|
---|
| 5635 | *
|
---|
| 5636 | * \par
|
---|
| 5637 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
|
---|
| 5638 | * This function can support maximum of table size 2^12.
|
---|
| 5639 | *
|
---|
| 5640 | */
|
---|
| 5641 |
|
---|
| 5642 |
|
---|
| 5643 | static __INLINE q31_t arm_linear_interp_q31(
|
---|
| 5644 | q31_t * pYData,
|
---|
| 5645 | q31_t x,
|
---|
| 5646 | uint32_t nValues)
|
---|
| 5647 | {
|
---|
| 5648 | q31_t y; /* output */
|
---|
| 5649 | q31_t y0, y1; /* Nearest output values */
|
---|
| 5650 | q31_t fract; /* fractional part */
|
---|
| 5651 | int32_t index; /* Index to read nearest output values */
|
---|
| 5652 |
|
---|
| 5653 | /* Input is in 12.20 format */
|
---|
| 5654 | /* 12 bits for the table index */
|
---|
| 5655 | /* Index value calculation */
|
---|
| 5656 | index = ((x & 0xFFF00000) >> 20);
|
---|
| 5657 |
|
---|
| 5658 | if(index >= (int32_t)(nValues - 1))
|
---|
| 5659 | {
|
---|
| 5660 | return (pYData[nValues - 1]);
|
---|
| 5661 | }
|
---|
| 5662 | else if(index < 0)
|
---|
| 5663 | {
|
---|
| 5664 | return (pYData[0]);
|
---|
| 5665 | }
|
---|
| 5666 | else
|
---|
| 5667 | {
|
---|
| 5668 |
|
---|
| 5669 | /* 20 bits for the fractional part */
|
---|
| 5670 | /* shift left by 11 to keep fract in 1.31 format */
|
---|
| 5671 | fract = (x & 0x000FFFFF) << 11;
|
---|
| 5672 |
|
---|
| 5673 | /* Read two nearest output values from the index in 1.31(q31) format */
|
---|
| 5674 | y0 = pYData[index];
|
---|
| 5675 | y1 = pYData[index + 1u];
|
---|
| 5676 |
|
---|
| 5677 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */
|
---|
| 5678 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
|
---|
| 5679 |
|
---|
| 5680 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
|
---|
| 5681 | y += ((q31_t) (((q63_t) y1 * fract) >> 32));
|
---|
| 5682 |
|
---|
| 5683 | /* Convert y to 1.31 format */
|
---|
| 5684 | return (y << 1u);
|
---|
| 5685 |
|
---|
| 5686 | }
|
---|
| 5687 |
|
---|
| 5688 | }
|
---|
| 5689 |
|
---|
| 5690 | /**
|
---|
| 5691 | *
|
---|
| 5692 | * @brief Process function for the Q15 Linear Interpolation Function.
|
---|
| 5693 | * @param[in] *pYData pointer to Q15 Linear Interpolation table
|
---|
| 5694 | * @param[in] x input sample to process
|
---|
| 5695 | * @param[in] nValues number of table values
|
---|
| 5696 | * @return y processed output sample.
|
---|
| 5697 | *
|
---|
| 5698 | * \par
|
---|
| 5699 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
|
---|
| 5700 | * This function can support maximum of table size 2^12.
|
---|
| 5701 | *
|
---|
| 5702 | */
|
---|
| 5703 |
|
---|
| 5704 |
|
---|
| 5705 | static __INLINE q15_t arm_linear_interp_q15(
|
---|
| 5706 | q15_t * pYData,
|
---|
| 5707 | q31_t x,
|
---|
| 5708 | uint32_t nValues)
|
---|
| 5709 | {
|
---|
| 5710 | q63_t y; /* output */
|
---|
| 5711 | q15_t y0, y1; /* Nearest output values */
|
---|
| 5712 | q31_t fract; /* fractional part */
|
---|
| 5713 | int32_t index; /* Index to read nearest output values */
|
---|
| 5714 |
|
---|
| 5715 | /* Input is in 12.20 format */
|
---|
| 5716 | /* 12 bits for the table index */
|
---|
| 5717 | /* Index value calculation */
|
---|
| 5718 | index = ((x & 0xFFF00000) >> 20u);
|
---|
| 5719 |
|
---|
| 5720 | if(index >= (int32_t)(nValues - 1))
|
---|
| 5721 | {
|
---|
| 5722 | return (pYData[nValues - 1]);
|
---|
| 5723 | }
|
---|
| 5724 | else if(index < 0)
|
---|
| 5725 | {
|
---|
| 5726 | return (pYData[0]);
|
---|
| 5727 | }
|
---|
| 5728 | else
|
---|
| 5729 | {
|
---|
| 5730 | /* 20 bits for the fractional part */
|
---|
| 5731 | /* fract is in 12.20 format */
|
---|
| 5732 | fract = (x & 0x000FFFFF);
|
---|
| 5733 |
|
---|
| 5734 | /* Read two nearest output values from the index */
|
---|
| 5735 | y0 = pYData[index];
|
---|
| 5736 | y1 = pYData[index + 1u];
|
---|
| 5737 |
|
---|
| 5738 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */
|
---|
| 5739 | y = ((q63_t) y0 * (0xFFFFF - fract));
|
---|
| 5740 |
|
---|
| 5741 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
|
---|
| 5742 | y += ((q63_t) y1 * (fract));
|
---|
| 5743 |
|
---|
| 5744 | /* convert y to 1.15 format */
|
---|
| 5745 | return (y >> 20);
|
---|
| 5746 | }
|
---|
| 5747 |
|
---|
| 5748 |
|
---|
| 5749 | }
|
---|
| 5750 |
|
---|
| 5751 | /**
|
---|
| 5752 | *
|
---|
| 5753 | * @brief Process function for the Q7 Linear Interpolation Function.
|
---|
| 5754 | * @param[in] *pYData pointer to Q7 Linear Interpolation table
|
---|
| 5755 | * @param[in] x input sample to process
|
---|
| 5756 | * @param[in] nValues number of table values
|
---|
| 5757 | * @return y processed output sample.
|
---|
| 5758 | *
|
---|
| 5759 | * \par
|
---|
| 5760 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
|
---|
| 5761 | * This function can support maximum of table size 2^12.
|
---|
| 5762 | */
|
---|
| 5763 |
|
---|
| 5764 |
|
---|
| 5765 | static __INLINE q7_t arm_linear_interp_q7(
|
---|
| 5766 | q7_t * pYData,
|
---|
| 5767 | q31_t x,
|
---|
| 5768 | uint32_t nValues)
|
---|
| 5769 | {
|
---|
| 5770 | q31_t y; /* output */
|
---|
| 5771 | q7_t y0, y1; /* Nearest output values */
|
---|
| 5772 | q31_t fract; /* fractional part */
|
---|
| 5773 | uint32_t index; /* Index to read nearest output values */
|
---|
| 5774 |
|
---|
| 5775 | /* Input is in 12.20 format */
|
---|
| 5776 | /* 12 bits for the table index */
|
---|
| 5777 | /* Index value calculation */
|
---|
| 5778 | if (x < 0)
|
---|
| 5779 | {
|
---|
| 5780 | return (pYData[0]);
|
---|
| 5781 | }
|
---|
| 5782 | index = (x >> 20) & 0xfff;
|
---|
| 5783 |
|
---|
| 5784 |
|
---|
| 5785 | if(index >= (nValues - 1))
|
---|
| 5786 | {
|
---|
| 5787 | return (pYData[nValues - 1]);
|
---|
| 5788 | }
|
---|
| 5789 | else
|
---|
| 5790 | {
|
---|
| 5791 |
|
---|
| 5792 | /* 20 bits for the fractional part */
|
---|
| 5793 | /* fract is in 12.20 format */
|
---|
| 5794 | fract = (x & 0x000FFFFF);
|
---|
| 5795 |
|
---|
| 5796 | /* Read two nearest output values from the index and are in 1.7(q7) format */
|
---|
| 5797 | y0 = pYData[index];
|
---|
| 5798 | y1 = pYData[index + 1u];
|
---|
| 5799 |
|
---|
| 5800 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
|
---|
| 5801 | y = ((y0 * (0xFFFFF - fract)));
|
---|
| 5802 |
|
---|
| 5803 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
|
---|
| 5804 | y += (y1 * fract);
|
---|
| 5805 |
|
---|
| 5806 | /* convert y to 1.7(q7) format */
|
---|
| 5807 | return (y >> 20u);
|
---|
| 5808 |
|
---|
| 5809 | }
|
---|
| 5810 |
|
---|
| 5811 | }
|
---|
| 5812 | /**
|
---|
| 5813 | * @} end of LinearInterpolate group
|
---|
| 5814 | */
|
---|
| 5815 |
|
---|
| 5816 | /**
|
---|
| 5817 | * @brief Fast approximation to the trigonometric sine function for floating-point data.
|
---|
| 5818 | * @param[in] x input value in radians.
|
---|
| 5819 | * @return sin(x).
|
---|
| 5820 | */
|
---|
| 5821 |
|
---|
| 5822 | float32_t arm_sin_f32(
|
---|
| 5823 | float32_t x);
|
---|
| 5824 |
|
---|
| 5825 | /**
|
---|
| 5826 | * @brief Fast approximation to the trigonometric sine function for Q31 data.
|
---|
| 5827 | * @param[in] x Scaled input value in radians.
|
---|
| 5828 | * @return sin(x).
|
---|
| 5829 | */
|
---|
| 5830 |
|
---|
| 5831 | q31_t arm_sin_q31(
|
---|
| 5832 | q31_t x);
|
---|
| 5833 |
|
---|
| 5834 | /**
|
---|
| 5835 | * @brief Fast approximation to the trigonometric sine function for Q15 data.
|
---|
| 5836 | * @param[in] x Scaled input value in radians.
|
---|
| 5837 | * @return sin(x).
|
---|
| 5838 | */
|
---|
| 5839 |
|
---|
| 5840 | q15_t arm_sin_q15(
|
---|
| 5841 | q15_t x);
|
---|
| 5842 |
|
---|
| 5843 | /**
|
---|
| 5844 | * @brief Fast approximation to the trigonometric cosine function for floating-point data.
|
---|
| 5845 | * @param[in] x input value in radians.
|
---|
| 5846 | * @return cos(x).
|
---|
| 5847 | */
|
---|
| 5848 |
|
---|
| 5849 | float32_t arm_cos_f32(
|
---|
| 5850 | float32_t x);
|
---|
| 5851 |
|
---|
| 5852 | /**
|
---|
| 5853 | * @brief Fast approximation to the trigonometric cosine function for Q31 data.
|
---|
| 5854 | * @param[in] x Scaled input value in radians.
|
---|
| 5855 | * @return cos(x).
|
---|
| 5856 | */
|
---|
| 5857 |
|
---|
| 5858 | q31_t arm_cos_q31(
|
---|
| 5859 | q31_t x);
|
---|
| 5860 |
|
---|
| 5861 | /**
|
---|
| 5862 | * @brief Fast approximation to the trigonometric cosine function for Q15 data.
|
---|
| 5863 | * @param[in] x Scaled input value in radians.
|
---|
| 5864 | * @return cos(x).
|
---|
| 5865 | */
|
---|
| 5866 |
|
---|
| 5867 | q15_t arm_cos_q15(
|
---|
| 5868 | q15_t x);
|
---|
| 5869 |
|
---|
| 5870 |
|
---|
| 5871 | /**
|
---|
| 5872 | * @ingroup groupFastMath
|
---|
| 5873 | */
|
---|
| 5874 |
|
---|
| 5875 |
|
---|
| 5876 | /**
|
---|
| 5877 | * @defgroup SQRT Square Root
|
---|
| 5878 | *
|
---|
| 5879 | * Computes the square root of a number.
|
---|
| 5880 | * There are separate functions for Q15, Q31, and floating-point data types.
|
---|
| 5881 | * The square root function is computed using the Newton-Raphson algorithm.
|
---|
| 5882 | * This is an iterative algorithm of the form:
|
---|
| 5883 | * <pre>
|
---|
| 5884 | * x1 = x0 - f(x0)/f'(x0)
|
---|
| 5885 | * </pre>
|
---|
| 5886 | * where <code>x1</code> is the current estimate,
|
---|
| 5887 | * <code>x0</code> is the previous estimate, and
|
---|
| 5888 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
|
---|
| 5889 | * For the square root function, the algorithm reduces to:
|
---|
| 5890 | * <pre>
|
---|
| 5891 | * x0 = in/2 [initial guess]
|
---|
| 5892 | * x1 = 1/2 * ( x0 + in / x0) [each iteration]
|
---|
| 5893 | * </pre>
|
---|
| 5894 | */
|
---|
| 5895 |
|
---|
| 5896 |
|
---|
| 5897 | /**
|
---|
| 5898 | * @addtogroup SQRT
|
---|
| 5899 | * @{
|
---|
| 5900 | */
|
---|
| 5901 |
|
---|
| 5902 | /**
|
---|
| 5903 | * @brief Floating-point square root function.
|
---|
| 5904 | * @param[in] in input value.
|
---|
| 5905 | * @param[out] *pOut square root of input value.
|
---|
| 5906 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
|
---|
| 5907 | * <code>in</code> is negative value and returns zero output for negative values.
|
---|
| 5908 | */
|
---|
| 5909 |
|
---|
| 5910 | static __INLINE arm_status arm_sqrt_f32(
|
---|
| 5911 | float32_t in,
|
---|
| 5912 | float32_t * pOut)
|
---|
| 5913 | {
|
---|
| 5914 | if(in > 0)
|
---|
| 5915 | {
|
---|
| 5916 |
|
---|
| 5917 | // #if __FPU_USED
|
---|
| 5918 | #if (__FPU_USED == 1) && defined ( __CC_ARM )
|
---|
| 5919 | *pOut = __sqrtf(in);
|
---|
| 5920 | #else
|
---|
| 5921 | *pOut = sqrtf(in);
|
---|
| 5922 | #endif
|
---|
| 5923 |
|
---|
| 5924 | return (ARM_MATH_SUCCESS);
|
---|
| 5925 | }
|
---|
| 5926 | else
|
---|
| 5927 | {
|
---|
| 5928 | *pOut = 0.0f;
|
---|
| 5929 | return (ARM_MATH_ARGUMENT_ERROR);
|
---|
| 5930 | }
|
---|
| 5931 |
|
---|
| 5932 | }
|
---|
| 5933 |
|
---|
| 5934 |
|
---|
| 5935 | /**
|
---|
| 5936 | * @brief Q31 square root function.
|
---|
| 5937 | * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
|
---|
| 5938 | * @param[out] *pOut square root of input value.
|
---|
| 5939 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
|
---|
| 5940 | * <code>in</code> is negative value and returns zero output for negative values.
|
---|
| 5941 | */
|
---|
| 5942 | arm_status arm_sqrt_q31(
|
---|
| 5943 | q31_t in,
|
---|
| 5944 | q31_t * pOut);
|
---|
| 5945 |
|
---|
| 5946 | /**
|
---|
| 5947 | * @brief Q15 square root function.
|
---|
| 5948 | * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
|
---|
| 5949 | * @param[out] *pOut square root of input value.
|
---|
| 5950 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
|
---|
| 5951 | * <code>in</code> is negative value and returns zero output for negative values.
|
---|
| 5952 | */
|
---|
| 5953 | arm_status arm_sqrt_q15(
|
---|
| 5954 | q15_t in,
|
---|
| 5955 | q15_t * pOut);
|
---|
| 5956 |
|
---|
| 5957 | /**
|
---|
| 5958 | * @} end of SQRT group
|
---|
| 5959 | */
|
---|
| 5960 |
|
---|
| 5961 |
|
---|
| 5962 |
|
---|
| 5963 |
|
---|
| 5964 |
|
---|
| 5965 |
|
---|
| 5966 | /**
|
---|
| 5967 | * @brief floating-point Circular write function.
|
---|
| 5968 | */
|
---|
| 5969 |
|
---|
| 5970 | static __INLINE void arm_circularWrite_f32(
|
---|
| 5971 | int32_t * circBuffer,
|
---|
| 5972 | int32_t L,
|
---|
| 5973 | uint16_t * writeOffset,
|
---|
| 5974 | int32_t bufferInc,
|
---|
| 5975 | const int32_t * src,
|
---|
| 5976 | int32_t srcInc,
|
---|
| 5977 | uint32_t blockSize)
|
---|
| 5978 | {
|
---|
| 5979 | uint32_t i = 0u;
|
---|
| 5980 | int32_t wOffset;
|
---|
| 5981 |
|
---|
| 5982 | /* Copy the value of Index pointer that points
|
---|
| 5983 | * to the current location where the input samples to be copied */
|
---|
| 5984 | wOffset = *writeOffset;
|
---|
| 5985 |
|
---|
| 5986 | /* Loop over the blockSize */
|
---|
| 5987 | i = blockSize;
|
---|
| 5988 |
|
---|
| 5989 | while(i > 0u)
|
---|
| 5990 | {
|
---|
| 5991 | /* copy the input sample to the circular buffer */
|
---|
| 5992 | circBuffer[wOffset] = *src;
|
---|
| 5993 |
|
---|
| 5994 | /* Update the input pointer */
|
---|
| 5995 | src += srcInc;
|
---|
| 5996 |
|
---|
| 5997 | /* Circularly update wOffset. Watch out for positive and negative value */
|
---|
| 5998 | wOffset += bufferInc;
|
---|
| 5999 | if(wOffset >= L)
|
---|
| 6000 | wOffset -= L;
|
---|
| 6001 |
|
---|
| 6002 | /* Decrement the loop counter */
|
---|
| 6003 | i--;
|
---|
| 6004 | }
|
---|
| 6005 |
|
---|
| 6006 | /* Update the index pointer */
|
---|
| 6007 | *writeOffset = wOffset;
|
---|
| 6008 | }
|
---|
| 6009 |
|
---|
| 6010 |
|
---|
| 6011 |
|
---|
| 6012 | /**
|
---|
| 6013 | * @brief floating-point Circular Read function.
|
---|
| 6014 | */
|
---|
| 6015 | static __INLINE void arm_circularRead_f32(
|
---|
| 6016 | int32_t * circBuffer,
|
---|
| 6017 | int32_t L,
|
---|
| 6018 | int32_t * readOffset,
|
---|
| 6019 | int32_t bufferInc,
|
---|
| 6020 | int32_t * dst,
|
---|
| 6021 | int32_t * dst_base,
|
---|
| 6022 | int32_t dst_length,
|
---|
| 6023 | int32_t dstInc,
|
---|
| 6024 | uint32_t blockSize)
|
---|
| 6025 | {
|
---|
| 6026 | uint32_t i = 0u;
|
---|
| 6027 | int32_t rOffset, dst_end;
|
---|
| 6028 |
|
---|
| 6029 | /* Copy the value of Index pointer that points
|
---|
| 6030 | * to the current location from where the input samples to be read */
|
---|
| 6031 | rOffset = *readOffset;
|
---|
| 6032 | dst_end = (int32_t) (dst_base + dst_length);
|
---|
| 6033 |
|
---|
| 6034 | /* Loop over the blockSize */
|
---|
| 6035 | i = blockSize;
|
---|
| 6036 |
|
---|
| 6037 | while(i > 0u)
|
---|
| 6038 | {
|
---|
| 6039 | /* copy the sample from the circular buffer to the destination buffer */
|
---|
| 6040 | *dst = circBuffer[rOffset];
|
---|
| 6041 |
|
---|
| 6042 | /* Update the input pointer */
|
---|
| 6043 | dst += dstInc;
|
---|
| 6044 |
|
---|
| 6045 | if(dst == (int32_t *) dst_end)
|
---|
| 6046 | {
|
---|
| 6047 | dst = dst_base;
|
---|
| 6048 | }
|
---|
| 6049 |
|
---|
| 6050 | /* Circularly update rOffset. Watch out for positive and negative value */
|
---|
| 6051 | rOffset += bufferInc;
|
---|
| 6052 |
|
---|
| 6053 | if(rOffset >= L)
|
---|
| 6054 | {
|
---|
| 6055 | rOffset -= L;
|
---|
| 6056 | }
|
---|
| 6057 |
|
---|
| 6058 | /* Decrement the loop counter */
|
---|
| 6059 | i--;
|
---|
| 6060 | }
|
---|
| 6061 |
|
---|
| 6062 | /* Update the index pointer */
|
---|
| 6063 | *readOffset = rOffset;
|
---|
| 6064 | }
|
---|
| 6065 |
|
---|
| 6066 | /**
|
---|
| 6067 | * @brief Q15 Circular write function.
|
---|
| 6068 | */
|
---|
| 6069 |
|
---|
| 6070 | static __INLINE void arm_circularWrite_q15(
|
---|
| 6071 | q15_t * circBuffer,
|
---|
| 6072 | int32_t L,
|
---|
| 6073 | uint16_t * writeOffset,
|
---|
| 6074 | int32_t bufferInc,
|
---|
| 6075 | const q15_t * src,
|
---|
| 6076 | int32_t srcInc,
|
---|
| 6077 | uint32_t blockSize)
|
---|
| 6078 | {
|
---|
| 6079 | uint32_t i = 0u;
|
---|
| 6080 | int32_t wOffset;
|
---|
| 6081 |
|
---|
| 6082 | /* Copy the value of Index pointer that points
|
---|
| 6083 | * to the current location where the input samples to be copied */
|
---|
| 6084 | wOffset = *writeOffset;
|
---|
| 6085 |
|
---|
| 6086 | /* Loop over the blockSize */
|
---|
| 6087 | i = blockSize;
|
---|
| 6088 |
|
---|
| 6089 | while(i > 0u)
|
---|
| 6090 | {
|
---|
| 6091 | /* copy the input sample to the circular buffer */
|
---|
| 6092 | circBuffer[wOffset] = *src;
|
---|
| 6093 |
|
---|
| 6094 | /* Update the input pointer */
|
---|
| 6095 | src += srcInc;
|
---|
| 6096 |
|
---|
| 6097 | /* Circularly update wOffset. Watch out for positive and negative value */
|
---|
| 6098 | wOffset += bufferInc;
|
---|
| 6099 | if(wOffset >= L)
|
---|
| 6100 | wOffset -= L;
|
---|
| 6101 |
|
---|
| 6102 | /* Decrement the loop counter */
|
---|
| 6103 | i--;
|
---|
| 6104 | }
|
---|
| 6105 |
|
---|
| 6106 | /* Update the index pointer */
|
---|
| 6107 | *writeOffset = wOffset;
|
---|
| 6108 | }
|
---|
| 6109 |
|
---|
| 6110 |
|
---|
| 6111 |
|
---|
| 6112 | /**
|
---|
| 6113 | * @brief Q15 Circular Read function.
|
---|
| 6114 | */
|
---|
| 6115 | static __INLINE void arm_circularRead_q15(
|
---|
| 6116 | q15_t * circBuffer,
|
---|
| 6117 | int32_t L,
|
---|
| 6118 | int32_t * readOffset,
|
---|
| 6119 | int32_t bufferInc,
|
---|
| 6120 | q15_t * dst,
|
---|
| 6121 | q15_t * dst_base,
|
---|
| 6122 | int32_t dst_length,
|
---|
| 6123 | int32_t dstInc,
|
---|
| 6124 | uint32_t blockSize)
|
---|
| 6125 | {
|
---|
| 6126 | uint32_t i = 0;
|
---|
| 6127 | int32_t rOffset, dst_end;
|
---|
| 6128 |
|
---|
| 6129 | /* Copy the value of Index pointer that points
|
---|
| 6130 | * to the current location from where the input samples to be read */
|
---|
| 6131 | rOffset = *readOffset;
|
---|
| 6132 |
|
---|
| 6133 | dst_end = (int32_t) (dst_base + dst_length);
|
---|
| 6134 |
|
---|
| 6135 | /* Loop over the blockSize */
|
---|
| 6136 | i = blockSize;
|
---|
| 6137 |
|
---|
| 6138 | while(i > 0u)
|
---|
| 6139 | {
|
---|
| 6140 | /* copy the sample from the circular buffer to the destination buffer */
|
---|
| 6141 | *dst = circBuffer[rOffset];
|
---|
| 6142 |
|
---|
| 6143 | /* Update the input pointer */
|
---|
| 6144 | dst += dstInc;
|
---|
| 6145 |
|
---|
| 6146 | if(dst == (q15_t *) dst_end)
|
---|
| 6147 | {
|
---|
| 6148 | dst = dst_base;
|
---|
| 6149 | }
|
---|
| 6150 |
|
---|
| 6151 | /* Circularly update wOffset. Watch out for positive and negative value */
|
---|
| 6152 | rOffset += bufferInc;
|
---|
| 6153 |
|
---|
| 6154 | if(rOffset >= L)
|
---|
| 6155 | {
|
---|
| 6156 | rOffset -= L;
|
---|
| 6157 | }
|
---|
| 6158 |
|
---|
| 6159 | /* Decrement the loop counter */
|
---|
| 6160 | i--;
|
---|
| 6161 | }
|
---|
| 6162 |
|
---|
| 6163 | /* Update the index pointer */
|
---|
| 6164 | *readOffset = rOffset;
|
---|
| 6165 | }
|
---|
| 6166 |
|
---|
| 6167 |
|
---|
| 6168 | /**
|
---|
| 6169 | * @brief Q7 Circular write function.
|
---|
| 6170 | */
|
---|
| 6171 |
|
---|
| 6172 | static __INLINE void arm_circularWrite_q7(
|
---|
| 6173 | q7_t * circBuffer,
|
---|
| 6174 | int32_t L,
|
---|
| 6175 | uint16_t * writeOffset,
|
---|
| 6176 | int32_t bufferInc,
|
---|
| 6177 | const q7_t * src,
|
---|
| 6178 | int32_t srcInc,
|
---|
| 6179 | uint32_t blockSize)
|
---|
| 6180 | {
|
---|
| 6181 | uint32_t i = 0u;
|
---|
| 6182 | int32_t wOffset;
|
---|
| 6183 |
|
---|
| 6184 | /* Copy the value of Index pointer that points
|
---|
| 6185 | * to the current location where the input samples to be copied */
|
---|
| 6186 | wOffset = *writeOffset;
|
---|
| 6187 |
|
---|
| 6188 | /* Loop over the blockSize */
|
---|
| 6189 | i = blockSize;
|
---|
| 6190 |
|
---|
| 6191 | while(i > 0u)
|
---|
| 6192 | {
|
---|
| 6193 | /* copy the input sample to the circular buffer */
|
---|
| 6194 | circBuffer[wOffset] = *src;
|
---|
| 6195 |
|
---|
| 6196 | /* Update the input pointer */
|
---|
| 6197 | src += srcInc;
|
---|
| 6198 |
|
---|
| 6199 | /* Circularly update wOffset. Watch out for positive and negative value */
|
---|
| 6200 | wOffset += bufferInc;
|
---|
| 6201 | if(wOffset >= L)
|
---|
| 6202 | wOffset -= L;
|
---|
| 6203 |
|
---|
| 6204 | /* Decrement the loop counter */
|
---|
| 6205 | i--;
|
---|
| 6206 | }
|
---|
| 6207 |
|
---|
| 6208 | /* Update the index pointer */
|
---|
| 6209 | *writeOffset = wOffset;
|
---|
| 6210 | }
|
---|
| 6211 |
|
---|
| 6212 |
|
---|
| 6213 |
|
---|
| 6214 | /**
|
---|
| 6215 | * @brief Q7 Circular Read function.
|
---|
| 6216 | */
|
---|
| 6217 | static __INLINE void arm_circularRead_q7(
|
---|
| 6218 | q7_t * circBuffer,
|
---|
| 6219 | int32_t L,
|
---|
| 6220 | int32_t * readOffset,
|
---|
| 6221 | int32_t bufferInc,
|
---|
| 6222 | q7_t * dst,
|
---|
| 6223 | q7_t * dst_base,
|
---|
| 6224 | int32_t dst_length,
|
---|
| 6225 | int32_t dstInc,
|
---|
| 6226 | uint32_t blockSize)
|
---|
| 6227 | {
|
---|
| 6228 | uint32_t i = 0;
|
---|
| 6229 | int32_t rOffset, dst_end;
|
---|
| 6230 |
|
---|
| 6231 | /* Copy the value of Index pointer that points
|
---|
| 6232 | * to the current location from where the input samples to be read */
|
---|
| 6233 | rOffset = *readOffset;
|
---|
| 6234 |
|
---|
| 6235 | dst_end = (int32_t) (dst_base + dst_length);
|
---|
| 6236 |
|
---|
| 6237 | /* Loop over the blockSize */
|
---|
| 6238 | i = blockSize;
|
---|
| 6239 |
|
---|
| 6240 | while(i > 0u)
|
---|
| 6241 | {
|
---|
| 6242 | /* copy the sample from the circular buffer to the destination buffer */
|
---|
| 6243 | *dst = circBuffer[rOffset];
|
---|
| 6244 |
|
---|
| 6245 | /* Update the input pointer */
|
---|
| 6246 | dst += dstInc;
|
---|
| 6247 |
|
---|
| 6248 | if(dst == (q7_t *) dst_end)
|
---|
| 6249 | {
|
---|
| 6250 | dst = dst_base;
|
---|
| 6251 | }
|
---|
| 6252 |
|
---|
| 6253 | /* Circularly update rOffset. Watch out for positive and negative value */
|
---|
| 6254 | rOffset += bufferInc;
|
---|
| 6255 |
|
---|
| 6256 | if(rOffset >= L)
|
---|
| 6257 | {
|
---|
| 6258 | rOffset -= L;
|
---|
| 6259 | }
|
---|
| 6260 |
|
---|
| 6261 | /* Decrement the loop counter */
|
---|
| 6262 | i--;
|
---|
| 6263 | }
|
---|
| 6264 |
|
---|
| 6265 | /* Update the index pointer */
|
---|
| 6266 | *readOffset = rOffset;
|
---|
| 6267 | }
|
---|
| 6268 |
|
---|
| 6269 |
|
---|
| 6270 | /**
|
---|
| 6271 | * @brief Sum of the squares of the elements of a Q31 vector.
|
---|
| 6272 | * @param[in] *pSrc is input pointer
|
---|
| 6273 | * @param[in] blockSize is the number of samples to process
|
---|
| 6274 | * @param[out] *pResult is output value.
|
---|
| 6275 | * @return none.
|
---|
| 6276 | */
|
---|
| 6277 |
|
---|
| 6278 | void arm_power_q31(
|
---|
| 6279 | q31_t * pSrc,
|
---|
| 6280 | uint32_t blockSize,
|
---|
| 6281 | q63_t * pResult);
|
---|
| 6282 |
|
---|
| 6283 | /**
|
---|
| 6284 | * @brief Sum of the squares of the elements of a floating-point vector.
|
---|
| 6285 | * @param[in] *pSrc is input pointer
|
---|
| 6286 | * @param[in] blockSize is the number of samples to process
|
---|
| 6287 | * @param[out] *pResult is output value.
|
---|
| 6288 | * @return none.
|
---|
| 6289 | */
|
---|
| 6290 |
|
---|
| 6291 | void arm_power_f32(
|
---|
| 6292 | float32_t * pSrc,
|
---|
| 6293 | uint32_t blockSize,
|
---|
| 6294 | float32_t * pResult);
|
---|
| 6295 |
|
---|
| 6296 | /**
|
---|
| 6297 | * @brief Sum of the squares of the elements of a Q15 vector.
|
---|
| 6298 | * @param[in] *pSrc is input pointer
|
---|
| 6299 | * @param[in] blockSize is the number of samples to process
|
---|
| 6300 | * @param[out] *pResult is output value.
|
---|
| 6301 | * @return none.
|
---|
| 6302 | */
|
---|
| 6303 |
|
---|
| 6304 | void arm_power_q15(
|
---|
| 6305 | q15_t * pSrc,
|
---|
| 6306 | uint32_t blockSize,
|
---|
| 6307 | q63_t * pResult);
|
---|
| 6308 |
|
---|
| 6309 | /**
|
---|
| 6310 | * @brief Sum of the squares of the elements of a Q7 vector.
|
---|
| 6311 | * @param[in] *pSrc is input pointer
|
---|
| 6312 | * @param[in] blockSize is the number of samples to process
|
---|
| 6313 | * @param[out] *pResult is output value.
|
---|
| 6314 | * @return none.
|
---|
| 6315 | */
|
---|
| 6316 |
|
---|
| 6317 | void arm_power_q7(
|
---|
| 6318 | q7_t * pSrc,
|
---|
| 6319 | uint32_t blockSize,
|
---|
| 6320 | q31_t * pResult);
|
---|
| 6321 |
|
---|
| 6322 | /**
|
---|
| 6323 | * @brief Mean value of a Q7 vector.
|
---|
| 6324 | * @param[in] *pSrc is input pointer
|
---|
| 6325 | * @param[in] blockSize is the number of samples to process
|
---|
| 6326 | * @param[out] *pResult is output value.
|
---|
| 6327 | * @return none.
|
---|
| 6328 | */
|
---|
| 6329 |
|
---|
| 6330 | void arm_mean_q7(
|
---|
| 6331 | q7_t * pSrc,
|
---|
| 6332 | uint32_t blockSize,
|
---|
| 6333 | q7_t * pResult);
|
---|
| 6334 |
|
---|
| 6335 | /**
|
---|
| 6336 | * @brief Mean value of a Q15 vector.
|
---|
| 6337 | * @param[in] *pSrc is input pointer
|
---|
| 6338 | * @param[in] blockSize is the number of samples to process
|
---|
| 6339 | * @param[out] *pResult is output value.
|
---|
| 6340 | * @return none.
|
---|
| 6341 | */
|
---|
| 6342 | void arm_mean_q15(
|
---|
| 6343 | q15_t * pSrc,
|
---|
| 6344 | uint32_t blockSize,
|
---|
| 6345 | q15_t * pResult);
|
---|
| 6346 |
|
---|
| 6347 | /**
|
---|
| 6348 | * @brief Mean value of a Q31 vector.
|
---|
| 6349 | * @param[in] *pSrc is input pointer
|
---|
| 6350 | * @param[in] blockSize is the number of samples to process
|
---|
| 6351 | * @param[out] *pResult is output value.
|
---|
| 6352 | * @return none.
|
---|
| 6353 | */
|
---|
| 6354 | void arm_mean_q31(
|
---|
| 6355 | q31_t * pSrc,
|
---|
| 6356 | uint32_t blockSize,
|
---|
| 6357 | q31_t * pResult);
|
---|
| 6358 |
|
---|
| 6359 | /**
|
---|
| 6360 | * @brief Mean value of a floating-point vector.
|
---|
| 6361 | * @param[in] *pSrc is input pointer
|
---|
| 6362 | * @param[in] blockSize is the number of samples to process
|
---|
| 6363 | * @param[out] *pResult is output value.
|
---|
| 6364 | * @return none.
|
---|
| 6365 | */
|
---|
| 6366 | void arm_mean_f32(
|
---|
| 6367 | float32_t * pSrc,
|
---|
| 6368 | uint32_t blockSize,
|
---|
| 6369 | float32_t * pResult);
|
---|
| 6370 |
|
---|
| 6371 | /**
|
---|
| 6372 | * @brief Variance of the elements of a floating-point vector.
|
---|
| 6373 | * @param[in] *pSrc is input pointer
|
---|
| 6374 | * @param[in] blockSize is the number of samples to process
|
---|
| 6375 | * @param[out] *pResult is output value.
|
---|
| 6376 | * @return none.
|
---|
| 6377 | */
|
---|
| 6378 |
|
---|
| 6379 | void arm_var_f32(
|
---|
| 6380 | float32_t * pSrc,
|
---|
| 6381 | uint32_t blockSize,
|
---|
| 6382 | float32_t * pResult);
|
---|
| 6383 |
|
---|
| 6384 | /**
|
---|
| 6385 | * @brief Variance of the elements of a Q31 vector.
|
---|
| 6386 | * @param[in] *pSrc is input pointer
|
---|
| 6387 | * @param[in] blockSize is the number of samples to process
|
---|
| 6388 | * @param[out] *pResult is output value.
|
---|
| 6389 | * @return none.
|
---|
| 6390 | */
|
---|
| 6391 |
|
---|
| 6392 | void arm_var_q31(
|
---|
| 6393 | q31_t * pSrc,
|
---|
| 6394 | uint32_t blockSize,
|
---|
| 6395 | q31_t * pResult);
|
---|
| 6396 |
|
---|
| 6397 | /**
|
---|
| 6398 | * @brief Variance of the elements of a Q15 vector.
|
---|
| 6399 | * @param[in] *pSrc is input pointer
|
---|
| 6400 | * @param[in] blockSize is the number of samples to process
|
---|
| 6401 | * @param[out] *pResult is output value.
|
---|
| 6402 | * @return none.
|
---|
| 6403 | */
|
---|
| 6404 |
|
---|
| 6405 | void arm_var_q15(
|
---|
| 6406 | q15_t * pSrc,
|
---|
| 6407 | uint32_t blockSize,
|
---|
| 6408 | q15_t * pResult);
|
---|
| 6409 |
|
---|
| 6410 | /**
|
---|
| 6411 | * @brief Root Mean Square of the elements of a floating-point vector.
|
---|
| 6412 | * @param[in] *pSrc is input pointer
|
---|
| 6413 | * @param[in] blockSize is the number of samples to process
|
---|
| 6414 | * @param[out] *pResult is output value.
|
---|
| 6415 | * @return none.
|
---|
| 6416 | */
|
---|
| 6417 |
|
---|
| 6418 | void arm_rms_f32(
|
---|
| 6419 | float32_t * pSrc,
|
---|
| 6420 | uint32_t blockSize,
|
---|
| 6421 | float32_t * pResult);
|
---|
| 6422 |
|
---|
| 6423 | /**
|
---|
| 6424 | * @brief Root Mean Square of the elements of a Q31 vector.
|
---|
| 6425 | * @param[in] *pSrc is input pointer
|
---|
| 6426 | * @param[in] blockSize is the number of samples to process
|
---|
| 6427 | * @param[out] *pResult is output value.
|
---|
| 6428 | * @return none.
|
---|
| 6429 | */
|
---|
| 6430 |
|
---|
| 6431 | void arm_rms_q31(
|
---|
| 6432 | q31_t * pSrc,
|
---|
| 6433 | uint32_t blockSize,
|
---|
| 6434 | q31_t * pResult);
|
---|
| 6435 |
|
---|
| 6436 | /**
|
---|
| 6437 | * @brief Root Mean Square of the elements of a Q15 vector.
|
---|
| 6438 | * @param[in] *pSrc is input pointer
|
---|
| 6439 | * @param[in] blockSize is the number of samples to process
|
---|
| 6440 | * @param[out] *pResult is output value.
|
---|
| 6441 | * @return none.
|
---|
| 6442 | */
|
---|
| 6443 |
|
---|
| 6444 | void arm_rms_q15(
|
---|
| 6445 | q15_t * pSrc,
|
---|
| 6446 | uint32_t blockSize,
|
---|
| 6447 | q15_t * pResult);
|
---|
| 6448 |
|
---|
| 6449 | /**
|
---|
| 6450 | * @brief Standard deviation of the elements of a floating-point vector.
|
---|
| 6451 | * @param[in] *pSrc is input pointer
|
---|
| 6452 | * @param[in] blockSize is the number of samples to process
|
---|
| 6453 | * @param[out] *pResult is output value.
|
---|
| 6454 | * @return none.
|
---|
| 6455 | */
|
---|
| 6456 |
|
---|
| 6457 | void arm_std_f32(
|
---|
| 6458 | float32_t * pSrc,
|
---|
| 6459 | uint32_t blockSize,
|
---|
| 6460 | float32_t * pResult);
|
---|
| 6461 |
|
---|
| 6462 | /**
|
---|
| 6463 | * @brief Standard deviation of the elements of a Q31 vector.
|
---|
| 6464 | * @param[in] *pSrc is input pointer
|
---|
| 6465 | * @param[in] blockSize is the number of samples to process
|
---|
| 6466 | * @param[out] *pResult is output value.
|
---|
| 6467 | * @return none.
|
---|
| 6468 | */
|
---|
| 6469 |
|
---|
| 6470 | void arm_std_q31(
|
---|
| 6471 | q31_t * pSrc,
|
---|
| 6472 | uint32_t blockSize,
|
---|
| 6473 | q31_t * pResult);
|
---|
| 6474 |
|
---|
| 6475 | /**
|
---|
| 6476 | * @brief Standard deviation of the elements of a Q15 vector.
|
---|
| 6477 | * @param[in] *pSrc is input pointer
|
---|
| 6478 | * @param[in] blockSize is the number of samples to process
|
---|
| 6479 | * @param[out] *pResult is output value.
|
---|
| 6480 | * @return none.
|
---|
| 6481 | */
|
---|
| 6482 |
|
---|
| 6483 | void arm_std_q15(
|
---|
| 6484 | q15_t * pSrc,
|
---|
| 6485 | uint32_t blockSize,
|
---|
| 6486 | q15_t * pResult);
|
---|
| 6487 |
|
---|
| 6488 | /**
|
---|
| 6489 | * @brief Floating-point complex magnitude
|
---|
| 6490 | * @param[in] *pSrc points to the complex input vector
|
---|
| 6491 | * @param[out] *pDst points to the real output vector
|
---|
| 6492 | * @param[in] numSamples number of complex samples in the input vector
|
---|
| 6493 | * @return none.
|
---|
| 6494 | */
|
---|
| 6495 |
|
---|
| 6496 | void arm_cmplx_mag_f32(
|
---|
| 6497 | float32_t * pSrc,
|
---|
| 6498 | float32_t * pDst,
|
---|
| 6499 | uint32_t numSamples);
|
---|
| 6500 |
|
---|
| 6501 | /**
|
---|
| 6502 | * @brief Q31 complex magnitude
|
---|
| 6503 | * @param[in] *pSrc points to the complex input vector
|
---|
| 6504 | * @param[out] *pDst points to the real output vector
|
---|
| 6505 | * @param[in] numSamples number of complex samples in the input vector
|
---|
| 6506 | * @return none.
|
---|
| 6507 | */
|
---|
| 6508 |
|
---|
| 6509 | void arm_cmplx_mag_q31(
|
---|
| 6510 | q31_t * pSrc,
|
---|
| 6511 | q31_t * pDst,
|
---|
| 6512 | uint32_t numSamples);
|
---|
| 6513 |
|
---|
| 6514 | /**
|
---|
| 6515 | * @brief Q15 complex magnitude
|
---|
| 6516 | * @param[in] *pSrc points to the complex input vector
|
---|
| 6517 | * @param[out] *pDst points to the real output vector
|
---|
| 6518 | * @param[in] numSamples number of complex samples in the input vector
|
---|
| 6519 | * @return none.
|
---|
| 6520 | */
|
---|
| 6521 |
|
---|
| 6522 | void arm_cmplx_mag_q15(
|
---|
| 6523 | q15_t * pSrc,
|
---|
| 6524 | q15_t * pDst,
|
---|
| 6525 | uint32_t numSamples);
|
---|
| 6526 |
|
---|
| 6527 | /**
|
---|
| 6528 | * @brief Q15 complex dot product
|
---|
| 6529 | * @param[in] *pSrcA points to the first input vector
|
---|
| 6530 | * @param[in] *pSrcB points to the second input vector
|
---|
| 6531 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 6532 | * @param[out] *realResult real part of the result returned here
|
---|
| 6533 | * @param[out] *imagResult imaginary part of the result returned here
|
---|
| 6534 | * @return none.
|
---|
| 6535 | */
|
---|
| 6536 |
|
---|
| 6537 | void arm_cmplx_dot_prod_q15(
|
---|
| 6538 | q15_t * pSrcA,
|
---|
| 6539 | q15_t * pSrcB,
|
---|
| 6540 | uint32_t numSamples,
|
---|
| 6541 | q31_t * realResult,
|
---|
| 6542 | q31_t * imagResult);
|
---|
| 6543 |
|
---|
| 6544 | /**
|
---|
| 6545 | * @brief Q31 complex dot product
|
---|
| 6546 | * @param[in] *pSrcA points to the first input vector
|
---|
| 6547 | * @param[in] *pSrcB points to the second input vector
|
---|
| 6548 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 6549 | * @param[out] *realResult real part of the result returned here
|
---|
| 6550 | * @param[out] *imagResult imaginary part of the result returned here
|
---|
| 6551 | * @return none.
|
---|
| 6552 | */
|
---|
| 6553 |
|
---|
| 6554 | void arm_cmplx_dot_prod_q31(
|
---|
| 6555 | q31_t * pSrcA,
|
---|
| 6556 | q31_t * pSrcB,
|
---|
| 6557 | uint32_t numSamples,
|
---|
| 6558 | q63_t * realResult,
|
---|
| 6559 | q63_t * imagResult);
|
---|
| 6560 |
|
---|
| 6561 | /**
|
---|
| 6562 | * @brief Floating-point complex dot product
|
---|
| 6563 | * @param[in] *pSrcA points to the first input vector
|
---|
| 6564 | * @param[in] *pSrcB points to the second input vector
|
---|
| 6565 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 6566 | * @param[out] *realResult real part of the result returned here
|
---|
| 6567 | * @param[out] *imagResult imaginary part of the result returned here
|
---|
| 6568 | * @return none.
|
---|
| 6569 | */
|
---|
| 6570 |
|
---|
| 6571 | void arm_cmplx_dot_prod_f32(
|
---|
| 6572 | float32_t * pSrcA,
|
---|
| 6573 | float32_t * pSrcB,
|
---|
| 6574 | uint32_t numSamples,
|
---|
| 6575 | float32_t * realResult,
|
---|
| 6576 | float32_t * imagResult);
|
---|
| 6577 |
|
---|
| 6578 | /**
|
---|
| 6579 | * @brief Q15 complex-by-real multiplication
|
---|
| 6580 | * @param[in] *pSrcCmplx points to the complex input vector
|
---|
| 6581 | * @param[in] *pSrcReal points to the real input vector
|
---|
| 6582 | * @param[out] *pCmplxDst points to the complex output vector
|
---|
| 6583 | * @param[in] numSamples number of samples in each vector
|
---|
| 6584 | * @return none.
|
---|
| 6585 | */
|
---|
| 6586 |
|
---|
| 6587 | void arm_cmplx_mult_real_q15(
|
---|
| 6588 | q15_t * pSrcCmplx,
|
---|
| 6589 | q15_t * pSrcReal,
|
---|
| 6590 | q15_t * pCmplxDst,
|
---|
| 6591 | uint32_t numSamples);
|
---|
| 6592 |
|
---|
| 6593 | /**
|
---|
| 6594 | * @brief Q31 complex-by-real multiplication
|
---|
| 6595 | * @param[in] *pSrcCmplx points to the complex input vector
|
---|
| 6596 | * @param[in] *pSrcReal points to the real input vector
|
---|
| 6597 | * @param[out] *pCmplxDst points to the complex output vector
|
---|
| 6598 | * @param[in] numSamples number of samples in each vector
|
---|
| 6599 | * @return none.
|
---|
| 6600 | */
|
---|
| 6601 |
|
---|
| 6602 | void arm_cmplx_mult_real_q31(
|
---|
| 6603 | q31_t * pSrcCmplx,
|
---|
| 6604 | q31_t * pSrcReal,
|
---|
| 6605 | q31_t * pCmplxDst,
|
---|
| 6606 | uint32_t numSamples);
|
---|
| 6607 |
|
---|
| 6608 | /**
|
---|
| 6609 | * @brief Floating-point complex-by-real multiplication
|
---|
| 6610 | * @param[in] *pSrcCmplx points to the complex input vector
|
---|
| 6611 | * @param[in] *pSrcReal points to the real input vector
|
---|
| 6612 | * @param[out] *pCmplxDst points to the complex output vector
|
---|
| 6613 | * @param[in] numSamples number of samples in each vector
|
---|
| 6614 | * @return none.
|
---|
| 6615 | */
|
---|
| 6616 |
|
---|
| 6617 | void arm_cmplx_mult_real_f32(
|
---|
| 6618 | float32_t * pSrcCmplx,
|
---|
| 6619 | float32_t * pSrcReal,
|
---|
| 6620 | float32_t * pCmplxDst,
|
---|
| 6621 | uint32_t numSamples);
|
---|
| 6622 |
|
---|
| 6623 | /**
|
---|
| 6624 | * @brief Minimum value of a Q7 vector.
|
---|
| 6625 | * @param[in] *pSrc is input pointer
|
---|
| 6626 | * @param[in] blockSize is the number of samples to process
|
---|
| 6627 | * @param[out] *result is output pointer
|
---|
| 6628 | * @param[in] index is the array index of the minimum value in the input buffer.
|
---|
| 6629 | * @return none.
|
---|
| 6630 | */
|
---|
| 6631 |
|
---|
| 6632 | void arm_min_q7(
|
---|
| 6633 | q7_t * pSrc,
|
---|
| 6634 | uint32_t blockSize,
|
---|
| 6635 | q7_t * result,
|
---|
| 6636 | uint32_t * index);
|
---|
| 6637 |
|
---|
| 6638 | /**
|
---|
| 6639 | * @brief Minimum value of a Q15 vector.
|
---|
| 6640 | * @param[in] *pSrc is input pointer
|
---|
| 6641 | * @param[in] blockSize is the number of samples to process
|
---|
| 6642 | * @param[out] *pResult is output pointer
|
---|
| 6643 | * @param[in] *pIndex is the array index of the minimum value in the input buffer.
|
---|
| 6644 | * @return none.
|
---|
| 6645 | */
|
---|
| 6646 |
|
---|
| 6647 | void arm_min_q15(
|
---|
| 6648 | q15_t * pSrc,
|
---|
| 6649 | uint32_t blockSize,
|
---|
| 6650 | q15_t * pResult,
|
---|
| 6651 | uint32_t * pIndex);
|
---|
| 6652 |
|
---|
| 6653 | /**
|
---|
| 6654 | * @brief Minimum value of a Q31 vector.
|
---|
| 6655 | * @param[in] *pSrc is input pointer
|
---|
| 6656 | * @param[in] blockSize is the number of samples to process
|
---|
| 6657 | * @param[out] *pResult is output pointer
|
---|
| 6658 | * @param[out] *pIndex is the array index of the minimum value in the input buffer.
|
---|
| 6659 | * @return none.
|
---|
| 6660 | */
|
---|
| 6661 | void arm_min_q31(
|
---|
| 6662 | q31_t * pSrc,
|
---|
| 6663 | uint32_t blockSize,
|
---|
| 6664 | q31_t * pResult,
|
---|
| 6665 | uint32_t * pIndex);
|
---|
| 6666 |
|
---|
| 6667 | /**
|
---|
| 6668 | * @brief Minimum value of a floating-point vector.
|
---|
| 6669 | * @param[in] *pSrc is input pointer
|
---|
| 6670 | * @param[in] blockSize is the number of samples to process
|
---|
| 6671 | * @param[out] *pResult is output pointer
|
---|
| 6672 | * @param[out] *pIndex is the array index of the minimum value in the input buffer.
|
---|
| 6673 | * @return none.
|
---|
| 6674 | */
|
---|
| 6675 |
|
---|
| 6676 | void arm_min_f32(
|
---|
| 6677 | float32_t * pSrc,
|
---|
| 6678 | uint32_t blockSize,
|
---|
| 6679 | float32_t * pResult,
|
---|
| 6680 | uint32_t * pIndex);
|
---|
| 6681 |
|
---|
| 6682 | /**
|
---|
| 6683 | * @brief Maximum value of a Q7 vector.
|
---|
| 6684 | * @param[in] *pSrc points to the input buffer
|
---|
| 6685 | * @param[in] blockSize length of the input vector
|
---|
| 6686 | * @param[out] *pResult maximum value returned here
|
---|
| 6687 | * @param[out] *pIndex index of maximum value returned here
|
---|
| 6688 | * @return none.
|
---|
| 6689 | */
|
---|
| 6690 |
|
---|
| 6691 | void arm_max_q7(
|
---|
| 6692 | q7_t * pSrc,
|
---|
| 6693 | uint32_t blockSize,
|
---|
| 6694 | q7_t * pResult,
|
---|
| 6695 | uint32_t * pIndex);
|
---|
| 6696 |
|
---|
| 6697 | /**
|
---|
| 6698 | * @brief Maximum value of a Q15 vector.
|
---|
| 6699 | * @param[in] *pSrc points to the input buffer
|
---|
| 6700 | * @param[in] blockSize length of the input vector
|
---|
| 6701 | * @param[out] *pResult maximum value returned here
|
---|
| 6702 | * @param[out] *pIndex index of maximum value returned here
|
---|
| 6703 | * @return none.
|
---|
| 6704 | */
|
---|
| 6705 |
|
---|
| 6706 | void arm_max_q15(
|
---|
| 6707 | q15_t * pSrc,
|
---|
| 6708 | uint32_t blockSize,
|
---|
| 6709 | q15_t * pResult,
|
---|
| 6710 | uint32_t * pIndex);
|
---|
| 6711 |
|
---|
| 6712 | /**
|
---|
| 6713 | * @brief Maximum value of a Q31 vector.
|
---|
| 6714 | * @param[in] *pSrc points to the input buffer
|
---|
| 6715 | * @param[in] blockSize length of the input vector
|
---|
| 6716 | * @param[out] *pResult maximum value returned here
|
---|
| 6717 | * @param[out] *pIndex index of maximum value returned here
|
---|
| 6718 | * @return none.
|
---|
| 6719 | */
|
---|
| 6720 |
|
---|
| 6721 | void arm_max_q31(
|
---|
| 6722 | q31_t * pSrc,
|
---|
| 6723 | uint32_t blockSize,
|
---|
| 6724 | q31_t * pResult,
|
---|
| 6725 | uint32_t * pIndex);
|
---|
| 6726 |
|
---|
| 6727 | /**
|
---|
| 6728 | * @brief Maximum value of a floating-point vector.
|
---|
| 6729 | * @param[in] *pSrc points to the input buffer
|
---|
| 6730 | * @param[in] blockSize length of the input vector
|
---|
| 6731 | * @param[out] *pResult maximum value returned here
|
---|
| 6732 | * @param[out] *pIndex index of maximum value returned here
|
---|
| 6733 | * @return none.
|
---|
| 6734 | */
|
---|
| 6735 |
|
---|
| 6736 | void arm_max_f32(
|
---|
| 6737 | float32_t * pSrc,
|
---|
| 6738 | uint32_t blockSize,
|
---|
| 6739 | float32_t * pResult,
|
---|
| 6740 | uint32_t * pIndex);
|
---|
| 6741 |
|
---|
| 6742 | /**
|
---|
| 6743 | * @brief Q15 complex-by-complex multiplication
|
---|
| 6744 | * @param[in] *pSrcA points to the first input vector
|
---|
| 6745 | * @param[in] *pSrcB points to the second input vector
|
---|
| 6746 | * @param[out] *pDst points to the output vector
|
---|
| 6747 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 6748 | * @return none.
|
---|
| 6749 | */
|
---|
| 6750 |
|
---|
| 6751 | void arm_cmplx_mult_cmplx_q15(
|
---|
| 6752 | q15_t * pSrcA,
|
---|
| 6753 | q15_t * pSrcB,
|
---|
| 6754 | q15_t * pDst,
|
---|
| 6755 | uint32_t numSamples);
|
---|
| 6756 |
|
---|
| 6757 | /**
|
---|
| 6758 | * @brief Q31 complex-by-complex multiplication
|
---|
| 6759 | * @param[in] *pSrcA points to the first input vector
|
---|
| 6760 | * @param[in] *pSrcB points to the second input vector
|
---|
| 6761 | * @param[out] *pDst points to the output vector
|
---|
| 6762 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 6763 | * @return none.
|
---|
| 6764 | */
|
---|
| 6765 |
|
---|
| 6766 | void arm_cmplx_mult_cmplx_q31(
|
---|
| 6767 | q31_t * pSrcA,
|
---|
| 6768 | q31_t * pSrcB,
|
---|
| 6769 | q31_t * pDst,
|
---|
| 6770 | uint32_t numSamples);
|
---|
| 6771 |
|
---|
| 6772 | /**
|
---|
| 6773 | * @brief Floating-point complex-by-complex multiplication
|
---|
| 6774 | * @param[in] *pSrcA points to the first input vector
|
---|
| 6775 | * @param[in] *pSrcB points to the second input vector
|
---|
| 6776 | * @param[out] *pDst points to the output vector
|
---|
| 6777 | * @param[in] numSamples number of complex samples in each vector
|
---|
| 6778 | * @return none.
|
---|
| 6779 | */
|
---|
| 6780 |
|
---|
| 6781 | void arm_cmplx_mult_cmplx_f32(
|
---|
| 6782 | float32_t * pSrcA,
|
---|
| 6783 | float32_t * pSrcB,
|
---|
| 6784 | float32_t * pDst,
|
---|
| 6785 | uint32_t numSamples);
|
---|
| 6786 |
|
---|
| 6787 | /**
|
---|
| 6788 | * @brief Converts the elements of the floating-point vector to Q31 vector.
|
---|
| 6789 | * @param[in] *pSrc points to the floating-point input vector
|
---|
| 6790 | * @param[out] *pDst points to the Q31 output vector
|
---|
| 6791 | * @param[in] blockSize length of the input vector
|
---|
| 6792 | * @return none.
|
---|
| 6793 | */
|
---|
| 6794 | void arm_float_to_q31(
|
---|
| 6795 | float32_t * pSrc,
|
---|
| 6796 | q31_t * pDst,
|
---|
| 6797 | uint32_t blockSize);
|
---|
| 6798 |
|
---|
| 6799 | /**
|
---|
| 6800 | * @brief Converts the elements of the floating-point vector to Q15 vector.
|
---|
| 6801 | * @param[in] *pSrc points to the floating-point input vector
|
---|
| 6802 | * @param[out] *pDst points to the Q15 output vector
|
---|
| 6803 | * @param[in] blockSize length of the input vector
|
---|
| 6804 | * @return none
|
---|
| 6805 | */
|
---|
| 6806 | void arm_float_to_q15(
|
---|
| 6807 | float32_t * pSrc,
|
---|
| 6808 | q15_t * pDst,
|
---|
| 6809 | uint32_t blockSize);
|
---|
| 6810 |
|
---|
| 6811 | /**
|
---|
| 6812 | * @brief Converts the elements of the floating-point vector to Q7 vector.
|
---|
| 6813 | * @param[in] *pSrc points to the floating-point input vector
|
---|
| 6814 | * @param[out] *pDst points to the Q7 output vector
|
---|
| 6815 | * @param[in] blockSize length of the input vector
|
---|
| 6816 | * @return none
|
---|
| 6817 | */
|
---|
| 6818 | void arm_float_to_q7(
|
---|
| 6819 | float32_t * pSrc,
|
---|
| 6820 | q7_t * pDst,
|
---|
| 6821 | uint32_t blockSize);
|
---|
| 6822 |
|
---|
| 6823 |
|
---|
| 6824 | /**
|
---|
| 6825 | * @brief Converts the elements of the Q31 vector to Q15 vector.
|
---|
| 6826 | * @param[in] *pSrc is input pointer
|
---|
| 6827 | * @param[out] *pDst is output pointer
|
---|
| 6828 | * @param[in] blockSize is the number of samples to process
|
---|
| 6829 | * @return none.
|
---|
| 6830 | */
|
---|
| 6831 | void arm_q31_to_q15(
|
---|
| 6832 | q31_t * pSrc,
|
---|
| 6833 | q15_t * pDst,
|
---|
| 6834 | uint32_t blockSize);
|
---|
| 6835 |
|
---|
| 6836 | /**
|
---|
| 6837 | * @brief Converts the elements of the Q31 vector to Q7 vector.
|
---|
| 6838 | * @param[in] *pSrc is input pointer
|
---|
| 6839 | * @param[out] *pDst is output pointer
|
---|
| 6840 | * @param[in] blockSize is the number of samples to process
|
---|
| 6841 | * @return none.
|
---|
| 6842 | */
|
---|
| 6843 | void arm_q31_to_q7(
|
---|
| 6844 | q31_t * pSrc,
|
---|
| 6845 | q7_t * pDst,
|
---|
| 6846 | uint32_t blockSize);
|
---|
| 6847 |
|
---|
| 6848 | /**
|
---|
| 6849 | * @brief Converts the elements of the Q15 vector to floating-point vector.
|
---|
| 6850 | * @param[in] *pSrc is input pointer
|
---|
| 6851 | * @param[out] *pDst is output pointer
|
---|
| 6852 | * @param[in] blockSize is the number of samples to process
|
---|
| 6853 | * @return none.
|
---|
| 6854 | */
|
---|
| 6855 | void arm_q15_to_float(
|
---|
| 6856 | q15_t * pSrc,
|
---|
| 6857 | float32_t * pDst,
|
---|
| 6858 | uint32_t blockSize);
|
---|
| 6859 |
|
---|
| 6860 |
|
---|
| 6861 | /**
|
---|
| 6862 | * @brief Converts the elements of the Q15 vector to Q31 vector.
|
---|
| 6863 | * @param[in] *pSrc is input pointer
|
---|
| 6864 | * @param[out] *pDst is output pointer
|
---|
| 6865 | * @param[in] blockSize is the number of samples to process
|
---|
| 6866 | * @return none.
|
---|
| 6867 | */
|
---|
| 6868 | void arm_q15_to_q31(
|
---|
| 6869 | q15_t * pSrc,
|
---|
| 6870 | q31_t * pDst,
|
---|
| 6871 | uint32_t blockSize);
|
---|
| 6872 |
|
---|
| 6873 |
|
---|
| 6874 | /**
|
---|
| 6875 | * @brief Converts the elements of the Q15 vector to Q7 vector.
|
---|
| 6876 | * @param[in] *pSrc is input pointer
|
---|
| 6877 | * @param[out] *pDst is output pointer
|
---|
| 6878 | * @param[in] blockSize is the number of samples to process
|
---|
| 6879 | * @return none.
|
---|
| 6880 | */
|
---|
| 6881 | void arm_q15_to_q7(
|
---|
| 6882 | q15_t * pSrc,
|
---|
| 6883 | q7_t * pDst,
|
---|
| 6884 | uint32_t blockSize);
|
---|
| 6885 |
|
---|
| 6886 |
|
---|
| 6887 | /**
|
---|
| 6888 | * @ingroup groupInterpolation
|
---|
| 6889 | */
|
---|
| 6890 |
|
---|
| 6891 | /**
|
---|
| 6892 | * @defgroup BilinearInterpolate Bilinear Interpolation
|
---|
| 6893 | *
|
---|
| 6894 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
|
---|
| 6895 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
|
---|
| 6896 | * determines values between the grid points.
|
---|
| 6897 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
|
---|
| 6898 | * Bilinear interpolation is often used in image processing to rescale images.
|
---|
| 6899 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
|
---|
| 6900 | *
|
---|
| 6901 | * <b>Algorithm</b>
|
---|
| 6902 | * \par
|
---|
| 6903 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
|
---|
| 6904 | * For floating-point, the instance structure is defined as:
|
---|
| 6905 | * <pre>
|
---|
| 6906 | * typedef struct
|
---|
| 6907 | * {
|
---|
| 6908 | * uint16_t numRows;
|
---|
| 6909 | * uint16_t numCols;
|
---|
| 6910 | * float32_t *pData;
|
---|
| 6911 | * } arm_bilinear_interp_instance_f32;
|
---|
| 6912 | * </pre>
|
---|
| 6913 | *
|
---|
| 6914 | * \par
|
---|
| 6915 | * where <code>numRows</code> specifies the number of rows in the table;
|
---|
| 6916 | * <code>numCols</code> specifies the number of columns in the table;
|
---|
| 6917 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
|
---|
| 6918 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
|
---|
| 6919 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
|
---|
| 6920 | *
|
---|
| 6921 | * \par
|
---|
| 6922 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
|
---|
| 6923 | * <pre>
|
---|
| 6924 | * XF = floor(x)
|
---|
| 6925 | * YF = floor(y)
|
---|
| 6926 | * </pre>
|
---|
| 6927 | * \par
|
---|
| 6928 | * The interpolated output point is computed as:
|
---|
| 6929 | * <pre>
|
---|
| 6930 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
|
---|
| 6931 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
|
---|
| 6932 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
|
---|
| 6933 | * + f(XF+1, YF+1) * (x-XF)*(y-YF)
|
---|
| 6934 | * </pre>
|
---|
| 6935 | * Note that the coordinates (x, y) contain integer and fractional components.
|
---|
| 6936 | * The integer components specify which portion of the table to use while the
|
---|
| 6937 | * fractional components control the interpolation processor.
|
---|
| 6938 | *
|
---|
| 6939 | * \par
|
---|
| 6940 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
|
---|
| 6941 | */
|
---|
| 6942 |
|
---|
| 6943 | /**
|
---|
| 6944 | * @addtogroup BilinearInterpolate
|
---|
| 6945 | * @{
|
---|
| 6946 | */
|
---|
| 6947 |
|
---|
| 6948 | /**
|
---|
| 6949 | *
|
---|
| 6950 | * @brief Floating-point bilinear interpolation.
|
---|
| 6951 | * @param[in,out] *S points to an instance of the interpolation structure.
|
---|
| 6952 | * @param[in] X interpolation coordinate.
|
---|
| 6953 | * @param[in] Y interpolation coordinate.
|
---|
| 6954 | * @return out interpolated value.
|
---|
| 6955 | */
|
---|
| 6956 |
|
---|
| 6957 |
|
---|
| 6958 | static __INLINE float32_t arm_bilinear_interp_f32(
|
---|
| 6959 | const arm_bilinear_interp_instance_f32 * S,
|
---|
| 6960 | float32_t X,
|
---|
| 6961 | float32_t Y)
|
---|
| 6962 | {
|
---|
| 6963 | float32_t out;
|
---|
| 6964 | float32_t f00, f01, f10, f11;
|
---|
| 6965 | float32_t *pData = S->pData;
|
---|
| 6966 | int32_t xIndex, yIndex, index;
|
---|
| 6967 | float32_t xdiff, ydiff;
|
---|
| 6968 | float32_t b1, b2, b3, b4;
|
---|
| 6969 |
|
---|
| 6970 | xIndex = (int32_t) X;
|
---|
| 6971 | yIndex = (int32_t) Y;
|
---|
| 6972 |
|
---|
| 6973 | /* Care taken for table outside boundary */
|
---|
| 6974 | /* Returns zero output when values are outside table boundary */
|
---|
| 6975 | if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
|
---|
| 6976 | || yIndex > (S->numCols - 1))
|
---|
| 6977 | {
|
---|
| 6978 | return (0);
|
---|
| 6979 | }
|
---|
| 6980 |
|
---|
| 6981 | /* Calculation of index for two nearest points in X-direction */
|
---|
| 6982 | index = (xIndex - 1) + (yIndex - 1) * S->numCols;
|
---|
| 6983 |
|
---|
| 6984 |
|
---|
| 6985 | /* Read two nearest points in X-direction */
|
---|
| 6986 | f00 = pData[index];
|
---|
| 6987 | f01 = pData[index + 1];
|
---|
| 6988 |
|
---|
| 6989 | /* Calculation of index for two nearest points in Y-direction */
|
---|
| 6990 | index = (xIndex - 1) + (yIndex) * S->numCols;
|
---|
| 6991 |
|
---|
| 6992 |
|
---|
| 6993 | /* Read two nearest points in Y-direction */
|
---|
| 6994 | f10 = pData[index];
|
---|
| 6995 | f11 = pData[index + 1];
|
---|
| 6996 |
|
---|
| 6997 | /* Calculation of intermediate values */
|
---|
| 6998 | b1 = f00;
|
---|
| 6999 | b2 = f01 - f00;
|
---|
| 7000 | b3 = f10 - f00;
|
---|
| 7001 | b4 = f00 - f01 - f10 + f11;
|
---|
| 7002 |
|
---|
| 7003 | /* Calculation of fractional part in X */
|
---|
| 7004 | xdiff = X - xIndex;
|
---|
| 7005 |
|
---|
| 7006 | /* Calculation of fractional part in Y */
|
---|
| 7007 | ydiff = Y - yIndex;
|
---|
| 7008 |
|
---|
| 7009 | /* Calculation of bi-linear interpolated output */
|
---|
| 7010 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
|
---|
| 7011 |
|
---|
| 7012 | /* return to application */
|
---|
| 7013 | return (out);
|
---|
| 7014 |
|
---|
| 7015 | }
|
---|
| 7016 |
|
---|
| 7017 | /**
|
---|
| 7018 | *
|
---|
| 7019 | * @brief Q31 bilinear interpolation.
|
---|
| 7020 | * @param[in,out] *S points to an instance of the interpolation structure.
|
---|
| 7021 | * @param[in] X interpolation coordinate in 12.20 format.
|
---|
| 7022 | * @param[in] Y interpolation coordinate in 12.20 format.
|
---|
| 7023 | * @return out interpolated value.
|
---|
| 7024 | */
|
---|
| 7025 |
|
---|
| 7026 | static __INLINE q31_t arm_bilinear_interp_q31(
|
---|
| 7027 | arm_bilinear_interp_instance_q31 * S,
|
---|
| 7028 | q31_t X,
|
---|
| 7029 | q31_t Y)
|
---|
| 7030 | {
|
---|
| 7031 | q31_t out; /* Temporary output */
|
---|
| 7032 | q31_t acc = 0; /* output */
|
---|
| 7033 | q31_t xfract, yfract; /* X, Y fractional parts */
|
---|
| 7034 | q31_t x1, x2, y1, y2; /* Nearest output values */
|
---|
| 7035 | int32_t rI, cI; /* Row and column indices */
|
---|
| 7036 | q31_t *pYData = S->pData; /* pointer to output table values */
|
---|
| 7037 | uint32_t nCols = S->numCols; /* num of rows */
|
---|
| 7038 |
|
---|
| 7039 |
|
---|
| 7040 | /* Input is in 12.20 format */
|
---|
| 7041 | /* 12 bits for the table index */
|
---|
| 7042 | /* Index value calculation */
|
---|
| 7043 | rI = ((X & 0xFFF00000) >> 20u);
|
---|
| 7044 |
|
---|
| 7045 | /* Input is in 12.20 format */
|
---|
| 7046 | /* 12 bits for the table index */
|
---|
| 7047 | /* Index value calculation */
|
---|
| 7048 | cI = ((Y & 0xFFF00000) >> 20u);
|
---|
| 7049 |
|
---|
| 7050 | /* Care taken for table outside boundary */
|
---|
| 7051 | /* Returns zero output when values are outside table boundary */
|
---|
| 7052 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
|
---|
| 7053 | {
|
---|
| 7054 | return (0);
|
---|
| 7055 | }
|
---|
| 7056 |
|
---|
| 7057 | /* 20 bits for the fractional part */
|
---|
| 7058 | /* shift left xfract by 11 to keep 1.31 format */
|
---|
| 7059 | xfract = (X & 0x000FFFFF) << 11u;
|
---|
| 7060 |
|
---|
| 7061 | /* Read two nearest output values from the index */
|
---|
| 7062 | x1 = pYData[(rI) + nCols * (cI)];
|
---|
| 7063 | x2 = pYData[(rI) + nCols * (cI) + 1u];
|
---|
| 7064 |
|
---|
| 7065 | /* 20 bits for the fractional part */
|
---|
| 7066 | /* shift left yfract by 11 to keep 1.31 format */
|
---|
| 7067 | yfract = (Y & 0x000FFFFF) << 11u;
|
---|
| 7068 |
|
---|
| 7069 | /* Read two nearest output values from the index */
|
---|
| 7070 | y1 = pYData[(rI) + nCols * (cI + 1)];
|
---|
| 7071 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
|
---|
| 7072 |
|
---|
| 7073 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
|
---|
| 7074 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
|
---|
| 7075 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
|
---|
| 7076 |
|
---|
| 7077 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
|
---|
| 7078 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
|
---|
| 7079 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
|
---|
| 7080 |
|
---|
| 7081 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
|
---|
| 7082 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
|
---|
| 7083 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
|
---|
| 7084 |
|
---|
| 7085 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
|
---|
| 7086 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
|
---|
| 7087 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
|
---|
| 7088 |
|
---|
| 7089 | /* Convert acc to 1.31(q31) format */
|
---|
| 7090 | return (acc << 2u);
|
---|
| 7091 |
|
---|
| 7092 | }
|
---|
| 7093 |
|
---|
| 7094 | /**
|
---|
| 7095 | * @brief Q15 bilinear interpolation.
|
---|
| 7096 | * @param[in,out] *S points to an instance of the interpolation structure.
|
---|
| 7097 | * @param[in] X interpolation coordinate in 12.20 format.
|
---|
| 7098 | * @param[in] Y interpolation coordinate in 12.20 format.
|
---|
| 7099 | * @return out interpolated value.
|
---|
| 7100 | */
|
---|
| 7101 |
|
---|
| 7102 | static __INLINE q15_t arm_bilinear_interp_q15(
|
---|
| 7103 | arm_bilinear_interp_instance_q15 * S,
|
---|
| 7104 | q31_t X,
|
---|
| 7105 | q31_t Y)
|
---|
| 7106 | {
|
---|
| 7107 | q63_t acc = 0; /* output */
|
---|
| 7108 | q31_t out; /* Temporary output */
|
---|
| 7109 | q15_t x1, x2, y1, y2; /* Nearest output values */
|
---|
| 7110 | q31_t xfract, yfract; /* X, Y fractional parts */
|
---|
| 7111 | int32_t rI, cI; /* Row and column indices */
|
---|
| 7112 | q15_t *pYData = S->pData; /* pointer to output table values */
|
---|
| 7113 | uint32_t nCols = S->numCols; /* num of rows */
|
---|
| 7114 |
|
---|
| 7115 | /* Input is in 12.20 format */
|
---|
| 7116 | /* 12 bits for the table index */
|
---|
| 7117 | /* Index value calculation */
|
---|
| 7118 | rI = ((X & 0xFFF00000) >> 20);
|
---|
| 7119 |
|
---|
| 7120 | /* Input is in 12.20 format */
|
---|
| 7121 | /* 12 bits for the table index */
|
---|
| 7122 | /* Index value calculation */
|
---|
| 7123 | cI = ((Y & 0xFFF00000) >> 20);
|
---|
| 7124 |
|
---|
| 7125 | /* Care taken for table outside boundary */
|
---|
| 7126 | /* Returns zero output when values are outside table boundary */
|
---|
| 7127 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
|
---|
| 7128 | {
|
---|
| 7129 | return (0);
|
---|
| 7130 | }
|
---|
| 7131 |
|
---|
| 7132 | /* 20 bits for the fractional part */
|
---|
| 7133 | /* xfract should be in 12.20 format */
|
---|
| 7134 | xfract = (X & 0x000FFFFF);
|
---|
| 7135 |
|
---|
| 7136 | /* Read two nearest output values from the index */
|
---|
| 7137 | x1 = pYData[(rI) + nCols * (cI)];
|
---|
| 7138 | x2 = pYData[(rI) + nCols * (cI) + 1u];
|
---|
| 7139 |
|
---|
| 7140 |
|
---|
| 7141 | /* 20 bits for the fractional part */
|
---|
| 7142 | /* yfract should be in 12.20 format */
|
---|
| 7143 | yfract = (Y & 0x000FFFFF);
|
---|
| 7144 |
|
---|
| 7145 | /* Read two nearest output values from the index */
|
---|
| 7146 | y1 = pYData[(rI) + nCols * (cI + 1)];
|
---|
| 7147 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
|
---|
| 7148 |
|
---|
| 7149 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
|
---|
| 7150 |
|
---|
| 7151 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
|
---|
| 7152 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
|
---|
| 7153 | out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
|
---|
| 7154 | acc = ((q63_t) out * (0xFFFFF - yfract));
|
---|
| 7155 |
|
---|
| 7156 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
|
---|
| 7157 | out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
|
---|
| 7158 | acc += ((q63_t) out * (xfract));
|
---|
| 7159 |
|
---|
| 7160 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
|
---|
| 7161 | out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
|
---|
| 7162 | acc += ((q63_t) out * (yfract));
|
---|
| 7163 |
|
---|
| 7164 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
|
---|
| 7165 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
|
---|
| 7166 | acc += ((q63_t) out * (yfract));
|
---|
| 7167 |
|
---|
| 7168 | /* acc is in 13.51 format and down shift acc by 36 times */
|
---|
| 7169 | /* Convert out to 1.15 format */
|
---|
| 7170 | return (acc >> 36);
|
---|
| 7171 |
|
---|
| 7172 | }
|
---|
| 7173 |
|
---|
| 7174 | /**
|
---|
| 7175 | * @brief Q7 bilinear interpolation.
|
---|
| 7176 | * @param[in,out] *S points to an instance of the interpolation structure.
|
---|
| 7177 | * @param[in] X interpolation coordinate in 12.20 format.
|
---|
| 7178 | * @param[in] Y interpolation coordinate in 12.20 format.
|
---|
| 7179 | * @return out interpolated value.
|
---|
| 7180 | */
|
---|
| 7181 |
|
---|
| 7182 | static __INLINE q7_t arm_bilinear_interp_q7(
|
---|
| 7183 | arm_bilinear_interp_instance_q7 * S,
|
---|
| 7184 | q31_t X,
|
---|
| 7185 | q31_t Y)
|
---|
| 7186 | {
|
---|
| 7187 | q63_t acc = 0; /* output */
|
---|
| 7188 | q31_t out; /* Temporary output */
|
---|
| 7189 | q31_t xfract, yfract; /* X, Y fractional parts */
|
---|
| 7190 | q7_t x1, x2, y1, y2; /* Nearest output values */
|
---|
| 7191 | int32_t rI, cI; /* Row and column indices */
|
---|
| 7192 | q7_t *pYData = S->pData; /* pointer to output table values */
|
---|
| 7193 | uint32_t nCols = S->numCols; /* num of rows */
|
---|
| 7194 |
|
---|
| 7195 | /* Input is in 12.20 format */
|
---|
| 7196 | /* 12 bits for the table index */
|
---|
| 7197 | /* Index value calculation */
|
---|
| 7198 | rI = ((X & 0xFFF00000) >> 20);
|
---|
| 7199 |
|
---|
| 7200 | /* Input is in 12.20 format */
|
---|
| 7201 | /* 12 bits for the table index */
|
---|
| 7202 | /* Index value calculation */
|
---|
| 7203 | cI = ((Y & 0xFFF00000) >> 20);
|
---|
| 7204 |
|
---|
| 7205 | /* Care taken for table outside boundary */
|
---|
| 7206 | /* Returns zero output when values are outside table boundary */
|
---|
| 7207 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
|
---|
| 7208 | {
|
---|
| 7209 | return (0);
|
---|
| 7210 | }
|
---|
| 7211 |
|
---|
| 7212 | /* 20 bits for the fractional part */
|
---|
| 7213 | /* xfract should be in 12.20 format */
|
---|
| 7214 | xfract = (X & 0x000FFFFF);
|
---|
| 7215 |
|
---|
| 7216 | /* Read two nearest output values from the index */
|
---|
| 7217 | x1 = pYData[(rI) + nCols * (cI)];
|
---|
| 7218 | x2 = pYData[(rI) + nCols * (cI) + 1u];
|
---|
| 7219 |
|
---|
| 7220 |
|
---|
| 7221 | /* 20 bits for the fractional part */
|
---|
| 7222 | /* yfract should be in 12.20 format */
|
---|
| 7223 | yfract = (Y & 0x000FFFFF);
|
---|
| 7224 |
|
---|
| 7225 | /* Read two nearest output values from the index */
|
---|
| 7226 | y1 = pYData[(rI) + nCols * (cI + 1)];
|
---|
| 7227 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
|
---|
| 7228 |
|
---|
| 7229 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
|
---|
| 7230 | out = ((x1 * (0xFFFFF - xfract)));
|
---|
| 7231 | acc = (((q63_t) out * (0xFFFFF - yfract)));
|
---|
| 7232 |
|
---|
| 7233 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
|
---|
| 7234 | out = ((x2 * (0xFFFFF - yfract)));
|
---|
| 7235 | acc += (((q63_t) out * (xfract)));
|
---|
| 7236 |
|
---|
| 7237 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
|
---|
| 7238 | out = ((y1 * (0xFFFFF - xfract)));
|
---|
| 7239 | acc += (((q63_t) out * (yfract)));
|
---|
| 7240 |
|
---|
| 7241 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
|
---|
| 7242 | out = ((y2 * (yfract)));
|
---|
| 7243 | acc += (((q63_t) out * (xfract)));
|
---|
| 7244 |
|
---|
| 7245 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
|
---|
| 7246 | return (acc >> 40);
|
---|
| 7247 |
|
---|
| 7248 | }
|
---|
| 7249 |
|
---|
| 7250 | /**
|
---|
| 7251 | * @} end of BilinearInterpolate group
|
---|
| 7252 | */
|
---|
| 7253 |
|
---|
| 7254 |
|
---|
| 7255 | #if defined ( __CC_ARM ) //Keil
|
---|
| 7256 | //SMMLAR
|
---|
| 7257 | #define multAcc_32x32_keep32_R(a, x, y) \
|
---|
| 7258 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
|
---|
| 7259 |
|
---|
| 7260 | //SMMLSR
|
---|
| 7261 | #define multSub_32x32_keep32_R(a, x, y) \
|
---|
| 7262 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
|
---|
| 7263 |
|
---|
| 7264 | //SMMULR
|
---|
| 7265 | #define mult_32x32_keep32_R(a, x, y) \
|
---|
| 7266 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
|
---|
| 7267 |
|
---|
| 7268 | //Enter low optimization region - place directly above function definition
|
---|
| 7269 | #define LOW_OPTIMIZATION_ENTER \
|
---|
| 7270 | _Pragma ("push") \
|
---|
| 7271 | _Pragma ("O1")
|
---|
| 7272 |
|
---|
| 7273 | //Exit low optimization region - place directly after end of function definition
|
---|
| 7274 | #define LOW_OPTIMIZATION_EXIT \
|
---|
| 7275 | _Pragma ("pop")
|
---|
| 7276 |
|
---|
| 7277 | //Enter low optimization region - place directly above function definition
|
---|
| 7278 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
|
---|
| 7279 |
|
---|
| 7280 | //Exit low optimization region - place directly after end of function definition
|
---|
| 7281 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
|
---|
| 7282 |
|
---|
| 7283 | #elif defined(__ICCARM__) //IAR
|
---|
| 7284 | //SMMLA
|
---|
| 7285 | #define multAcc_32x32_keep32_R(a, x, y) \
|
---|
| 7286 | a += (q31_t) (((q63_t) x * y) >> 32)
|
---|
| 7287 |
|
---|
| 7288 | //SMMLS
|
---|
| 7289 | #define multSub_32x32_keep32_R(a, x, y) \
|
---|
| 7290 | a -= (q31_t) (((q63_t) x * y) >> 32)
|
---|
| 7291 |
|
---|
| 7292 | //SMMUL
|
---|
| 7293 | #define mult_32x32_keep32_R(a, x, y) \
|
---|
| 7294 | a = (q31_t) (((q63_t) x * y ) >> 32)
|
---|
| 7295 |
|
---|
| 7296 | //Enter low optimization region - place directly above function definition
|
---|
| 7297 | #define LOW_OPTIMIZATION_ENTER \
|
---|
| 7298 | _Pragma ("optimize=low")
|
---|
| 7299 |
|
---|
| 7300 | //Exit low optimization region - place directly after end of function definition
|
---|
| 7301 | #define LOW_OPTIMIZATION_EXIT
|
---|
| 7302 |
|
---|
| 7303 | //Enter low optimization region - place directly above function definition
|
---|
| 7304 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
|
---|
| 7305 | _Pragma ("optimize=low")
|
---|
| 7306 |
|
---|
| 7307 | //Exit low optimization region - place directly after end of function definition
|
---|
| 7308 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
|
---|
| 7309 |
|
---|
| 7310 | #elif defined(__GNUC__)
|
---|
| 7311 | //SMMLA
|
---|
| 7312 | #define multAcc_32x32_keep32_R(a, x, y) \
|
---|
| 7313 | a += (q31_t) (((q63_t) x * y) >> 32)
|
---|
| 7314 |
|
---|
| 7315 | //SMMLS
|
---|
| 7316 | #define multSub_32x32_keep32_R(a, x, y) \
|
---|
| 7317 | a -= (q31_t) (((q63_t) x * y) >> 32)
|
---|
| 7318 |
|
---|
| 7319 | //SMMUL
|
---|
| 7320 | #define mult_32x32_keep32_R(a, x, y) \
|
---|
| 7321 | a = (q31_t) (((q63_t) x * y ) >> 32)
|
---|
| 7322 |
|
---|
| 7323 | #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
|
---|
| 7324 |
|
---|
| 7325 | #define LOW_OPTIMIZATION_EXIT
|
---|
| 7326 |
|
---|
| 7327 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
|
---|
| 7328 |
|
---|
| 7329 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
|
---|
| 7330 |
|
---|
| 7331 | #elif defined(__CSMC__) // Cosmic
|
---|
| 7332 | //SMMLA
|
---|
| 7333 | #define multAcc_32x32_keep32_R(a, x, y) \
|
---|
| 7334 | a += (q31_t) (((q63_t) x * y) >> 32)
|
---|
| 7335 |
|
---|
| 7336 | //SMMLS
|
---|
| 7337 | #define multSub_32x32_keep32_R(a, x, y) \
|
---|
| 7338 | a -= (q31_t) (((q63_t) x * y) >> 32)
|
---|
| 7339 |
|
---|
| 7340 | //SMMUL
|
---|
| 7341 | #define mult_32x32_keep32_R(a, x, y) \
|
---|
| 7342 | a = (q31_t) (((q63_t) x * y ) >> 32)
|
---|
| 7343 |
|
---|
| 7344 | #define LOW_OPTIMIZATION_ENTER
|
---|
| 7345 | #define LOW_OPTIMIZATION_EXIT
|
---|
| 7346 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
|
---|
| 7347 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
|
---|
| 7348 |
|
---|
| 7349 | #endif
|
---|
| 7350 |
|
---|
| 7351 |
|
---|
| 7352 |
|
---|
| 7353 |
|
---|
| 7354 |
|
---|
| 7355 | #ifdef __cplusplus
|
---|
| 7356 | }
|
---|
| 7357 | #endif
|
---|
| 7358 |
|
---|
| 7359 |
|
---|
| 7360 | #endif /* _ARM_MATH_H */
|
---|
| 7361 |
|
---|
| 7362 |
|
---|
| 7363 | /**
|
---|
| 7364 | *
|
---|
| 7365 | * End of file.
|
---|
| 7366 | */
|
---|