mbed 5 experimental branch

Fork of dsp by Simon Ford

Committer:
nprobably
Date:
Thu Jun 29 06:56:55 2017 +0000
Revision:
3:ad02f4ea1fbe
Parent:
0:1014af42efd9
A hack to make it compile with mbed 5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:1014af42efd9 1 /* ----------------------------------------------------------------------
simon 0:1014af42efd9 2 * Copyright (C) 2010 ARM Limited. All rights reserved.
simon 0:1014af42efd9 3 *
simon 0:1014af42efd9 4 * $Date: 29. November 2010
simon 0:1014af42efd9 5 * $Revision: V1.0.3
simon 0:1014af42efd9 6 *
simon 0:1014af42efd9 7 * Project: CMSIS DSP Library
simon 0:1014af42efd9 8 * Title: arm_math.h
simon 0:1014af42efd9 9 *
simon 0:1014af42efd9 10 * Description: Public header file for CMSIS DSP Library
simon 0:1014af42efd9 11 *
simon 0:1014af42efd9 12 * Target Processor: Cortex-M4/Cortex-M3
simon 0:1014af42efd9 13 *
simon 0:1014af42efd9 14 * Version 1.0.3 2010/11/29
simon 0:1014af42efd9 15 * Re-organized the CMSIS folders and updated documentation.
simon 0:1014af42efd9 16 *
simon 0:1014af42efd9 17 * Version 1.0.2 2010/11/11
simon 0:1014af42efd9 18 * Documentation updated.
simon 0:1014af42efd9 19 *
simon 0:1014af42efd9 20 * Version 1.0.1 2010/10/05
simon 0:1014af42efd9 21 * Production release and review comments incorporated.
simon 0:1014af42efd9 22 *
simon 0:1014af42efd9 23 * Version 1.0.0 2010/09/20
simon 0:1014af42efd9 24 * Production release and review comments incorporated.
simon 0:1014af42efd9 25 *-------------------------------------------------------------------*/
simon 0:1014af42efd9 26
simon 0:1014af42efd9 27 /**
simon 0:1014af42efd9 28 \mainpage CMSIS DSP Software Library
simon 0:1014af42efd9 29 *
simon 0:1014af42efd9 30 * <b>Introduction</b>
simon 0:1014af42efd9 31 *
simon 0:1014af42efd9 32 * This user manual describes the CMSIS DSP software library,
simon 0:1014af42efd9 33 * a suite of common signal processing functions for use on Cortex-M processor based devices.
simon 0:1014af42efd9 34 *
simon 0:1014af42efd9 35 * The library is divided into a number of modules each covering a specific category:
simon 0:1014af42efd9 36 * - Basic math functions
simon 0:1014af42efd9 37 * - Fast math functions
simon 0:1014af42efd9 38 * - Complex math functions
simon 0:1014af42efd9 39 * - Filters
simon 0:1014af42efd9 40 * - Matrix functions
simon 0:1014af42efd9 41 * - Transforms
simon 0:1014af42efd9 42 * - Motor control functions
simon 0:1014af42efd9 43 * - Statistical functions
simon 0:1014af42efd9 44 * - Support functions
simon 0:1014af42efd9 45 * - Interpolation functions
simon 0:1014af42efd9 46 *
simon 0:1014af42efd9 47 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
simon 0:1014af42efd9 48 * 32-bit integer and 32-bit floating-point values.
simon 0:1014af42efd9 49 *
simon 0:1014af42efd9 50 * <b>Processor Support</b>
simon 0:1014af42efd9 51 *
simon 0:1014af42efd9 52 * The library is completely written in C and is fully CMSIS compliant.
simon 0:1014af42efd9 53 * High performance is achieved through maximum use of Cortex-M4 intrinsics.
simon 0:1014af42efd9 54 *
simon 0:1014af42efd9 55 * The supplied library source code also builds and runs on the Cortex-M3 processor,
simon 0:1014af42efd9 56 * with the DSP intrinsics being emulated through software.
simon 0:1014af42efd9 57 *
simon 0:1014af42efd9 58 * A Cortex-M0 version of the library is also being developed ;
simon 0:1014af42efd9 59 * updates on this activity will be made available shortly.
simon 0:1014af42efd9 60
simon 0:1014af42efd9 61 *
simon 0:1014af42efd9 62 * <b>Toolchain Support</b>
simon 0:1014af42efd9 63 *
simon 0:1014af42efd9 64 * The library has been developed and tested with MDK-ARM version 4.12.
simon 0:1014af42efd9 65 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
simon 0:1014af42efd9 66 *
simon 0:1014af42efd9 67 * <b>Using the Library</b>
simon 0:1014af42efd9 68 *
simon 0:1014af42efd9 69 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
simon 0:1014af42efd9 70 * - arm_cortexM4_math.lib
simon 0:1014af42efd9 71 * - arm_cortexM3_math.lib
simon 0:1014af42efd9 72 *
simon 0:1014af42efd9 73 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
simon 0:1014af42efd9 74 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
simon 0:1014af42efd9 75 * public header file <code> arm_math.h</code> for Cortex-M4, Cortex-M3 and Cortex-M0. Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
simon 0:1014af42efd9 76 * ARM_MATH_CM0 depending on the target processor in the application.
simon 0:1014af42efd9 77 *
simon 0:1014af42efd9 78 * <b>Examples</b>
simon 0:1014af42efd9 79 *
simon 0:1014af42efd9 80 * The library ships with a number of examples which demonstrate how to use the library functions.
simon 0:1014af42efd9 81 *
simon 0:1014af42efd9 82 * <b>Building the Library</b>
simon 0:1014af42efd9 83 *
simon 0:1014af42efd9 84 * The library installer also contains project files to re build the library on MDK Tool chain in the <code>Lib</code> folder.
simon 0:1014af42efd9 85 * - arm_cortexM4_math.uvproj
simon 0:1014af42efd9 86 * - arm_cortexM3_math.uvproj
simon 0:1014af42efd9 87 *
simon 0:1014af42efd9 88 * The library supports size checking on the input and output matrices. To enable this feature,
simon 0:1014af42efd9 89 * define the MACRO ARM_MATH_MATRIX_CHECK in pre processor settings in project options.
simon 0:1014af42efd9 90 * The Library also supports rounding on support functions by using ARM_MATH_ROUNDING in pre processor settings
simon 0:1014af42efd9 91 *
simon 0:1014af42efd9 92 * The project can be built by opening the appropriate project in MDK-ARM 4.12 chain and defining the optional pre processor MACROs detailed above.
simon 0:1014af42efd9 93 *
simon 0:1014af42efd9 94 * <b>Copyright Notice</b>
simon 0:1014af42efd9 95 *
simon 0:1014af42efd9 96 * Copyright (C) 2010 ARM Limited. All rights reserved.
simon 0:1014af42efd9 97 */
simon 0:1014af42efd9 98
simon 0:1014af42efd9 99
simon 0:1014af42efd9 100 /**
simon 0:1014af42efd9 101 * @defgroup groupMath Basic Math Functions
simon 0:1014af42efd9 102 */
simon 0:1014af42efd9 103
simon 0:1014af42efd9 104 /**
simon 0:1014af42efd9 105 * @defgroup groupFastMath Fast Math Functions
simon 0:1014af42efd9 106 * This set of functions provides a fast approximation to sine, cosine, and square root.
simon 0:1014af42efd9 107 * As compared to most of the other functions in the CMSIS math library, the fast math functions
simon 0:1014af42efd9 108 * operate on individual values and not arrays.
simon 0:1014af42efd9 109 * There are separate functions for Q15, Q31, and floating-point data.
simon 0:1014af42efd9 110 *
simon 0:1014af42efd9 111 */
simon 0:1014af42efd9 112
simon 0:1014af42efd9 113 /**
simon 0:1014af42efd9 114 * @defgroup groupCmplxMath Complex Math Functions
simon 0:1014af42efd9 115 * This set of functions operates on complex data vectors.
simon 0:1014af42efd9 116 * The data in the complex arrays is stored in an interleaved fashion
simon 0:1014af42efd9 117 * (real, imag, real, imag, ...).
simon 0:1014af42efd9 118 * In the API functions, the number of samples in a complex array refers
simon 0:1014af42efd9 119 * to the number of complex values; the array contains twice this number of
simon 0:1014af42efd9 120 * real values.
simon 0:1014af42efd9 121 */
simon 0:1014af42efd9 122
simon 0:1014af42efd9 123 /**
simon 0:1014af42efd9 124 * @defgroup groupFilters Filtering Functions
simon 0:1014af42efd9 125 */
simon 0:1014af42efd9 126
simon 0:1014af42efd9 127 /**
simon 0:1014af42efd9 128 * @defgroup groupMatrix Matrix Functions
simon 0:1014af42efd9 129 *
simon 0:1014af42efd9 130 * This set of functions provides basic matrix math operations.
simon 0:1014af42efd9 131 * The functions operate on matrix data structures. For example,
simon 0:1014af42efd9 132 * the type
simon 0:1014af42efd9 133 * definition for the floating-point matrix structure is shown
simon 0:1014af42efd9 134 * below:
simon 0:1014af42efd9 135 * <pre>
simon 0:1014af42efd9 136 * typedef struct
simon 0:1014af42efd9 137 * {
simon 0:1014af42efd9 138 * uint16_t numRows; // number of rows of the matrix.
simon 0:1014af42efd9 139 * uint16_t numCols; // number of columns of the matrix.
simon 0:1014af42efd9 140 * float32_t *pData; // points to the data of the matrix.
simon 0:1014af42efd9 141 * } arm_matrix_instance_f32;
simon 0:1014af42efd9 142 * </pre>
simon 0:1014af42efd9 143 * There are similar definitions for Q15 and Q31 data types.
simon 0:1014af42efd9 144 *
simon 0:1014af42efd9 145 * The structure specifies the size of the matrix and then points to
simon 0:1014af42efd9 146 * an array of data. The array is of size <code>numRows X numCols</code>
simon 0:1014af42efd9 147 * and the values are arranged in row order. That is, the
simon 0:1014af42efd9 148 * matrix element (i, j) is stored at:
simon 0:1014af42efd9 149 * <pre>
simon 0:1014af42efd9 150 * pData[i*numCols + j]
simon 0:1014af42efd9 151 * </pre>
simon 0:1014af42efd9 152 *
simon 0:1014af42efd9 153 * \par Init Functions
simon 0:1014af42efd9 154 * There is an associated initialization function for each type of matrix
simon 0:1014af42efd9 155 * data structure.
simon 0:1014af42efd9 156 * The initialization function sets the values of the internal structure fields.
simon 0:1014af42efd9 157 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
simon 0:1014af42efd9 158 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
simon 0:1014af42efd9 159 *
simon 0:1014af42efd9 160 * \par
simon 0:1014af42efd9 161 * Use of the initialization function is optional. However, if initialization function is used
simon 0:1014af42efd9 162 * then the instance structure cannot be placed into a const data section.
simon 0:1014af42efd9 163 * To place the instance structure in a const data
simon 0:1014af42efd9 164 * section, manually initialize the data structure. For example:
simon 0:1014af42efd9 165 * <pre>
simon 0:1014af42efd9 166 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
simon 0:1014af42efd9 167 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
simon 0:1014af42efd9 168 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
simon 0:1014af42efd9 169 * </pre>
simon 0:1014af42efd9 170 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
simon 0:1014af42efd9 171 * specifies the number of columns, and <code>pData</code> points to the
simon 0:1014af42efd9 172 * data array.
simon 0:1014af42efd9 173 *
simon 0:1014af42efd9 174 * \par Size Checking
simon 0:1014af42efd9 175 * By default all of the matrix functions perform size checking on the input and
simon 0:1014af42efd9 176 * output matrices. For example, the matrix addition function verifies that the
simon 0:1014af42efd9 177 * two input matrices and the output matrix all have the same number of rows and
simon 0:1014af42efd9 178 * columns. If the size check fails the functions return:
simon 0:1014af42efd9 179 * <pre>
simon 0:1014af42efd9 180 * ARM_MATH_SIZE_MISMATCH
simon 0:1014af42efd9 181 * </pre>
simon 0:1014af42efd9 182 * Otherwise the functions return
simon 0:1014af42efd9 183 * <pre>
simon 0:1014af42efd9 184 * ARM_MATH_SUCCESS
simon 0:1014af42efd9 185 * </pre>
simon 0:1014af42efd9 186 * There is some overhead associated with this matrix size checking.
simon 0:1014af42efd9 187 * The matrix size checking is enabled via the #define
simon 0:1014af42efd9 188 * <pre>
simon 0:1014af42efd9 189 * ARM_MATH_MATRIX_CHECK
simon 0:1014af42efd9 190 * </pre>
simon 0:1014af42efd9 191 * within the library project settings. By default this macro is defined
simon 0:1014af42efd9 192 * and size checking is enabled. By changing the project settings and
simon 0:1014af42efd9 193 * undefining this macro size checking is eliminated and the functions
simon 0:1014af42efd9 194 * run a bit faster. With size checking disabled the functions always
simon 0:1014af42efd9 195 * return <code>ARM_MATH_SUCCESS</code>.
simon 0:1014af42efd9 196 */
simon 0:1014af42efd9 197
simon 0:1014af42efd9 198 /**
simon 0:1014af42efd9 199 * @defgroup groupTransforms Transform Functions
simon 0:1014af42efd9 200 */
simon 0:1014af42efd9 201
simon 0:1014af42efd9 202 /**
simon 0:1014af42efd9 203 * @defgroup groupController Controller Functions
simon 0:1014af42efd9 204 */
simon 0:1014af42efd9 205
simon 0:1014af42efd9 206 /**
simon 0:1014af42efd9 207 * @defgroup groupStats Statistics Functions
simon 0:1014af42efd9 208 */
simon 0:1014af42efd9 209 /**
simon 0:1014af42efd9 210 * @defgroup groupSupport Support Functions
simon 0:1014af42efd9 211 */
simon 0:1014af42efd9 212
simon 0:1014af42efd9 213 /**
simon 0:1014af42efd9 214 * @defgroup groupInterpolation Interpolation Functions
simon 0:1014af42efd9 215 * These functions perform 1- and 2-dimensional interpolation of data.
simon 0:1014af42efd9 216 * Linear interpolation is used for 1-dimensional data and
simon 0:1014af42efd9 217 * bilinear interpolation is used for 2-dimensional data.
simon 0:1014af42efd9 218 */
simon 0:1014af42efd9 219
simon 0:1014af42efd9 220 /**
simon 0:1014af42efd9 221 * @defgroup groupExamples Examples
simon 0:1014af42efd9 222 */
simon 0:1014af42efd9 223 #ifndef _ARM_MATH_H
simon 0:1014af42efd9 224 #define _ARM_MATH_H
simon 0:1014af42efd9 225
nprobably 3:ad02f4ea1fbe 226 #define ARM_MATH_CM4 // mbed: set to CM� and include appropriate target cmsis library
simon 0:1014af42efd9 227 #include "cmsis.h"
simon 0:1014af42efd9 228
simon 0:1014af42efd9 229 // #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
simon 0:1014af42efd9 230
simon 0:1014af42efd9 231 /*
simon 0:1014af42efd9 232 #if defined (ARM_MATH_CM4)
simon 0:1014af42efd9 233 #include "core_cm4.h"
simon 0:1014af42efd9 234 #elif defined (ARM_MATH_CM3)
simon 0:1014af42efd9 235 #include "core_cm3.h"
simon 0:1014af42efd9 236 #elif defined (ARM_MATH_CM0)
simon 0:1014af42efd9 237 #include "core_cm0.h"
simon 0:1014af42efd9 238 #else
simon 0:1014af42efd9 239 #include "ARMCM4.h"
simon 0:1014af42efd9 240 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
simon 0:1014af42efd9 241 #endif
simon 0:1014af42efd9 242 */
simon 0:1014af42efd9 243
simon 0:1014af42efd9 244 //#undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
simon 0:1014af42efd9 245
simon 0:1014af42efd9 246 #include "string.h"
simon 0:1014af42efd9 247
simon 0:1014af42efd9 248 #ifdef __cplusplus
simon 0:1014af42efd9 249 extern "C"
simon 0:1014af42efd9 250 {
simon 0:1014af42efd9 251 #endif
simon 0:1014af42efd9 252
simon 0:1014af42efd9 253
simon 0:1014af42efd9 254 /**
simon 0:1014af42efd9 255 * @brief Macros required for reciprocal calculation in Normalized LMS
simon 0:1014af42efd9 256 */
simon 0:1014af42efd9 257
simon 0:1014af42efd9 258 #define DELTA_Q31 (0x100)
simon 0:1014af42efd9 259 #define DELTA_Q15 0x5
simon 0:1014af42efd9 260 #define INDEX_MASK 0x0000003F
simon 0:1014af42efd9 261 #define PI 3.14159265358979f
simon 0:1014af42efd9 262
simon 0:1014af42efd9 263 /**
simon 0:1014af42efd9 264 * @brief Macros required for SINE and COSINE Fast math approximations
simon 0:1014af42efd9 265 */
simon 0:1014af42efd9 266
simon 0:1014af42efd9 267 #define TABLE_SIZE 256
simon 0:1014af42efd9 268 #define TABLE_SPACING_Q31 0x800000
simon 0:1014af42efd9 269 #define TABLE_SPACING_Q15 0x80
simon 0:1014af42efd9 270
simon 0:1014af42efd9 271 /**
simon 0:1014af42efd9 272 * @brief Macros required for SINE and COSINE Controller functions
simon 0:1014af42efd9 273 */
simon 0:1014af42efd9 274 /* 1.31(q31) Fixed value of 2/360 */
simon 0:1014af42efd9 275 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
simon 0:1014af42efd9 276 #define INPUT_SPACING 0xB60B61
simon 0:1014af42efd9 277
simon 0:1014af42efd9 278
simon 0:1014af42efd9 279 /**
simon 0:1014af42efd9 280 * @brief Error status returned by some functions in the library.
simon 0:1014af42efd9 281 */
simon 0:1014af42efd9 282
simon 0:1014af42efd9 283 typedef enum
simon 0:1014af42efd9 284 {
simon 0:1014af42efd9 285 ARM_MATH_SUCCESS = 0, /**< No error */
simon 0:1014af42efd9 286 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
simon 0:1014af42efd9 287 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
simon 0:1014af42efd9 288 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
simon 0:1014af42efd9 289 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
simon 0:1014af42efd9 290 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
simon 0:1014af42efd9 291 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
simon 0:1014af42efd9 292 } arm_status;
simon 0:1014af42efd9 293
simon 0:1014af42efd9 294 /**
simon 0:1014af42efd9 295 * @brief 8-bit fractional data type in 1.7 format.
simon 0:1014af42efd9 296 */
simon 0:1014af42efd9 297 typedef int8_t q7_t;
simon 0:1014af42efd9 298
simon 0:1014af42efd9 299 /**
simon 0:1014af42efd9 300 * @brief 16-bit fractional data type in 1.15 format.
simon 0:1014af42efd9 301 */
simon 0:1014af42efd9 302 typedef int16_t q15_t;
simon 0:1014af42efd9 303
simon 0:1014af42efd9 304 /**
simon 0:1014af42efd9 305 * @brief 32-bit fractional data type in 1.31 format.
simon 0:1014af42efd9 306 */
simon 0:1014af42efd9 307 typedef int32_t q31_t;
simon 0:1014af42efd9 308
simon 0:1014af42efd9 309 /**
simon 0:1014af42efd9 310 * @brief 64-bit fractional data type in 1.63 format.
simon 0:1014af42efd9 311 */
simon 0:1014af42efd9 312 typedef int64_t q63_t;
simon 0:1014af42efd9 313
simon 0:1014af42efd9 314 /**
simon 0:1014af42efd9 315 * @brief 32-bit floating-point type definition.
simon 0:1014af42efd9 316 */
simon 0:1014af42efd9 317 typedef float float32_t;
simon 0:1014af42efd9 318
simon 0:1014af42efd9 319 /**
simon 0:1014af42efd9 320 * @brief 64-bit floating-point type definition.
simon 0:1014af42efd9 321 */
simon 0:1014af42efd9 322 typedef double float64_t;
simon 0:1014af42efd9 323
simon 0:1014af42efd9 324 /**
simon 0:1014af42efd9 325 * @brief definition to read/write two 16 bit values.
simon 0:1014af42efd9 326 */
simon 0:1014af42efd9 327 #define __SIMD32(addr) (*(int32_t **) & (addr))
simon 0:1014af42efd9 328
simon 0:1014af42efd9 329 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
simon 0:1014af42efd9 330 /**
simon 0:1014af42efd9 331 * @brief definition to pack two 16 bit values.
simon 0:1014af42efd9 332 */
simon 0:1014af42efd9 333 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
simon 0:1014af42efd9 334 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
simon 0:1014af42efd9 335
simon 0:1014af42efd9 336 #endif
simon 0:1014af42efd9 337
simon 0:1014af42efd9 338 /**
simon 0:1014af42efd9 339 * @brief definition to pack four 8 bit values.
simon 0:1014af42efd9 340 */
simon 0:1014af42efd9 341 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
simon 0:1014af42efd9 342 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
simon 0:1014af42efd9 343 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
simon 0:1014af42efd9 344 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
simon 0:1014af42efd9 345
simon 0:1014af42efd9 346
simon 0:1014af42efd9 347 /**
simon 0:1014af42efd9 348 * @brief Clips Q63 to Q31 values.
simon 0:1014af42efd9 349 */
simon 0:1014af42efd9 350 static __INLINE q31_t clip_q63_to_q31(
simon 0:1014af42efd9 351 q63_t x)
simon 0:1014af42efd9 352 {
simon 0:1014af42efd9 353 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
simon 0:1014af42efd9 354 ((0x7FFFFFFF ^ ((q31_t) (x >> 62)))) : (q31_t) x;
simon 0:1014af42efd9 355 }
simon 0:1014af42efd9 356
simon 0:1014af42efd9 357 /**
simon 0:1014af42efd9 358 * @brief Clips Q63 to Q15 values.
simon 0:1014af42efd9 359 */
simon 0:1014af42efd9 360 static __INLINE q15_t clip_q63_to_q15(
simon 0:1014af42efd9 361 q63_t x)
simon 0:1014af42efd9 362 {
simon 0:1014af42efd9 363 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
simon 0:1014af42efd9 364 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
simon 0:1014af42efd9 365 }
simon 0:1014af42efd9 366
simon 0:1014af42efd9 367 /**
simon 0:1014af42efd9 368 * @brief Clips Q31 to Q7 values.
simon 0:1014af42efd9 369 */
simon 0:1014af42efd9 370 static __INLINE q7_t clip_q31_to_q7(
simon 0:1014af42efd9 371 q31_t x)
simon 0:1014af42efd9 372 {
simon 0:1014af42efd9 373 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
simon 0:1014af42efd9 374 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
simon 0:1014af42efd9 375 }
simon 0:1014af42efd9 376
simon 0:1014af42efd9 377 /**
simon 0:1014af42efd9 378 * @brief Clips Q31 to Q15 values.
simon 0:1014af42efd9 379 */
simon 0:1014af42efd9 380 static __INLINE q15_t clip_q31_to_q15(
simon 0:1014af42efd9 381 q31_t x)
simon 0:1014af42efd9 382 {
simon 0:1014af42efd9 383 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
simon 0:1014af42efd9 384 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
simon 0:1014af42efd9 385 }
simon 0:1014af42efd9 386
simon 0:1014af42efd9 387 /**
simon 0:1014af42efd9 388 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
simon 0:1014af42efd9 389 */
simon 0:1014af42efd9 390
simon 0:1014af42efd9 391 static __INLINE q63_t mult32x64(
simon 0:1014af42efd9 392 q63_t x,
simon 0:1014af42efd9 393 q31_t y)
simon 0:1014af42efd9 394 {
simon 0:1014af42efd9 395 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
simon 0:1014af42efd9 396 (((q63_t) (x >> 32) * y)));
simon 0:1014af42efd9 397 }
simon 0:1014af42efd9 398
simon 0:1014af42efd9 399
simon 0:1014af42efd9 400 /**
simon 0:1014af42efd9 401 * @brief Function to Calculates 1/in(reciprocal) value of Q31 Data type.
simon 0:1014af42efd9 402 */
simon 0:1014af42efd9 403
simon 0:1014af42efd9 404 static __INLINE uint32_t arm_recip_q31(
simon 0:1014af42efd9 405 q31_t in,
simon 0:1014af42efd9 406 q31_t * dst,
simon 0:1014af42efd9 407 q31_t * pRecipTable)
simon 0:1014af42efd9 408 {
simon 0:1014af42efd9 409
simon 0:1014af42efd9 410 uint32_t out, tempVal;
simon 0:1014af42efd9 411 uint32_t index, i;
simon 0:1014af42efd9 412 uint32_t signBits;
simon 0:1014af42efd9 413
simon 0:1014af42efd9 414 if(in > 0)
simon 0:1014af42efd9 415 {
simon 0:1014af42efd9 416 signBits = __CLZ(in) - 1;
simon 0:1014af42efd9 417 }
simon 0:1014af42efd9 418 else
simon 0:1014af42efd9 419 {
simon 0:1014af42efd9 420 signBits = __CLZ(-in) - 1;
simon 0:1014af42efd9 421 }
simon 0:1014af42efd9 422
simon 0:1014af42efd9 423 /* Convert input sample to 1.31 format */
simon 0:1014af42efd9 424 in = in << signBits;
simon 0:1014af42efd9 425
simon 0:1014af42efd9 426 /* calculation of index for initial approximated Val */
simon 0:1014af42efd9 427 index = (uint32_t) (in >> 24u);
simon 0:1014af42efd9 428 index = (index & INDEX_MASK);
simon 0:1014af42efd9 429
simon 0:1014af42efd9 430 /* 1.31 with exp 1 */
simon 0:1014af42efd9 431 out = pRecipTable[index];
simon 0:1014af42efd9 432
simon 0:1014af42efd9 433 /* calculation of reciprocal value */
simon 0:1014af42efd9 434 /* running approximation for two iterations */
simon 0:1014af42efd9 435 for (i = 0u; i < 2u; i++)
simon 0:1014af42efd9 436 {
simon 0:1014af42efd9 437 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
simon 0:1014af42efd9 438 tempVal = 0x7FFFFFFF - tempVal;
simon 0:1014af42efd9 439 /* 1.31 with exp 1 */
simon 0:1014af42efd9 440 out = (q31_t) (((q63_t) out * tempVal) >> 30u);
simon 0:1014af42efd9 441 }
simon 0:1014af42efd9 442
simon 0:1014af42efd9 443 /* write output */
simon 0:1014af42efd9 444 *dst = out;
simon 0:1014af42efd9 445
simon 0:1014af42efd9 446 /* return num of signbits of out = 1/in value */
simon 0:1014af42efd9 447 return (signBits + 1u);
simon 0:1014af42efd9 448
simon 0:1014af42efd9 449 }
simon 0:1014af42efd9 450
simon 0:1014af42efd9 451 /**
simon 0:1014af42efd9 452 * @brief Function to Calculates 1/in(reciprocal) value of Q15 Data type.
simon 0:1014af42efd9 453 */
simon 0:1014af42efd9 454 static __INLINE uint32_t arm_recip_q15(
simon 0:1014af42efd9 455 q15_t in,
simon 0:1014af42efd9 456 q15_t * dst,
simon 0:1014af42efd9 457 q15_t * pRecipTable)
simon 0:1014af42efd9 458 {
simon 0:1014af42efd9 459
simon 0:1014af42efd9 460 uint32_t out = 0, tempVal = 0;
simon 0:1014af42efd9 461 uint32_t index = 0, i = 0;
simon 0:1014af42efd9 462 uint32_t signBits = 0;
simon 0:1014af42efd9 463
simon 0:1014af42efd9 464 if(in > 0)
simon 0:1014af42efd9 465 {
simon 0:1014af42efd9 466 signBits = __CLZ(in) - 17;
simon 0:1014af42efd9 467 }
simon 0:1014af42efd9 468 else
simon 0:1014af42efd9 469 {
simon 0:1014af42efd9 470 signBits = __CLZ(-in) - 17;
simon 0:1014af42efd9 471 }
simon 0:1014af42efd9 472
simon 0:1014af42efd9 473 /* Convert input sample to 1.15 format */
simon 0:1014af42efd9 474 in = in << signBits;
simon 0:1014af42efd9 475
simon 0:1014af42efd9 476 /* calculation of index for initial approximated Val */
simon 0:1014af42efd9 477 index = in >> 8;
simon 0:1014af42efd9 478 index = (index & INDEX_MASK);
simon 0:1014af42efd9 479
simon 0:1014af42efd9 480 /* 1.15 with exp 1 */
simon 0:1014af42efd9 481 out = pRecipTable[index];
simon 0:1014af42efd9 482
simon 0:1014af42efd9 483 /* calculation of reciprocal value */
simon 0:1014af42efd9 484 /* running approximation for two iterations */
simon 0:1014af42efd9 485 for (i = 0; i < 2; i++)
simon 0:1014af42efd9 486 {
simon 0:1014af42efd9 487 tempVal = (q15_t) (((q31_t) in * out) >> 15);
simon 0:1014af42efd9 488 tempVal = 0x7FFF - tempVal;
simon 0:1014af42efd9 489 /* 1.15 with exp 1 */
simon 0:1014af42efd9 490 out = (q15_t) (((q31_t) out * tempVal) >> 14);
simon 0:1014af42efd9 491 }
simon 0:1014af42efd9 492
simon 0:1014af42efd9 493 /* write output */
simon 0:1014af42efd9 494 *dst = out;
simon 0:1014af42efd9 495
simon 0:1014af42efd9 496 /* return num of signbits of out = 1/in value */
simon 0:1014af42efd9 497 return (signBits + 1);
simon 0:1014af42efd9 498
simon 0:1014af42efd9 499 }
simon 0:1014af42efd9 500
simon 0:1014af42efd9 501
simon 0:1014af42efd9 502 /*
simon 0:1014af42efd9 503 * @brief C custom defined intrinisic function for only M0 processors
simon 0:1014af42efd9 504 */
simon 0:1014af42efd9 505 #if defined(ARM_MATH_CM0)
simon 0:1014af42efd9 506
simon 0:1014af42efd9 507 static __INLINE q31_t __SSAT(
simon 0:1014af42efd9 508 q31_t x,
simon 0:1014af42efd9 509 uint32_t y)
simon 0:1014af42efd9 510 {
simon 0:1014af42efd9 511 int32_t posMax, negMin;
simon 0:1014af42efd9 512 uint32_t i;
simon 0:1014af42efd9 513
simon 0:1014af42efd9 514 posMax = 1;
simon 0:1014af42efd9 515 for (i = 0; i < (y - 1); i++)
simon 0:1014af42efd9 516 {
simon 0:1014af42efd9 517 posMax = posMax * 2;
simon 0:1014af42efd9 518 }
simon 0:1014af42efd9 519
simon 0:1014af42efd9 520 if(x > 0)
simon 0:1014af42efd9 521 {
simon 0:1014af42efd9 522 posMax = (posMax - 1);
simon 0:1014af42efd9 523
simon 0:1014af42efd9 524 if(x > posMax)
simon 0:1014af42efd9 525 {
simon 0:1014af42efd9 526 x = posMax;
simon 0:1014af42efd9 527 }
simon 0:1014af42efd9 528 }
simon 0:1014af42efd9 529 else
simon 0:1014af42efd9 530 {
simon 0:1014af42efd9 531 negMin = -posMax;
simon 0:1014af42efd9 532
simon 0:1014af42efd9 533 if(x < negMin)
simon 0:1014af42efd9 534 {
simon 0:1014af42efd9 535 x = negMin;
simon 0:1014af42efd9 536 }
simon 0:1014af42efd9 537 }
simon 0:1014af42efd9 538 return (x);
simon 0:1014af42efd9 539
simon 0:1014af42efd9 540
simon 0:1014af42efd9 541 }
simon 0:1014af42efd9 542
simon 0:1014af42efd9 543 #endif /* end of ARM_MATH_CM0 */
simon 0:1014af42efd9 544
simon 0:1014af42efd9 545
simon 0:1014af42efd9 546
simon 0:1014af42efd9 547 /*
simon 0:1014af42efd9 548 * @brief C custom defined intrinsic function for M3 and M0 processors
simon 0:1014af42efd9 549 */
simon 0:1014af42efd9 550 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
simon 0:1014af42efd9 551
simon 0:1014af42efd9 552 /*
simon 0:1014af42efd9 553 * @brief C custom defined QADD8 for M3 and M0 processors
simon 0:1014af42efd9 554 */
simon 0:1014af42efd9 555 static __INLINE q31_t __QADD8(
simon 0:1014af42efd9 556 q31_t x,
simon 0:1014af42efd9 557 q31_t y)
simon 0:1014af42efd9 558 {
simon 0:1014af42efd9 559
simon 0:1014af42efd9 560 q31_t sum;
simon 0:1014af42efd9 561 q7_t r, s, t, u;
simon 0:1014af42efd9 562
simon 0:1014af42efd9 563 r = (char) x;
simon 0:1014af42efd9 564 s = (char) y;
simon 0:1014af42efd9 565
simon 0:1014af42efd9 566 r = __SSAT((q31_t) (r + s), 8);
simon 0:1014af42efd9 567 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
simon 0:1014af42efd9 568 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
simon 0:1014af42efd9 569 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
simon 0:1014af42efd9 570
simon 0:1014af42efd9 571 sum = (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
simon 0:1014af42efd9 572 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
simon 0:1014af42efd9 573
simon 0:1014af42efd9 574 return sum;
simon 0:1014af42efd9 575
simon 0:1014af42efd9 576 }
simon 0:1014af42efd9 577
simon 0:1014af42efd9 578 /*
simon 0:1014af42efd9 579 * @brief C custom defined QSUB8 for M3 and M0 processors
simon 0:1014af42efd9 580 */
simon 0:1014af42efd9 581 static __INLINE q31_t __QSUB8(
simon 0:1014af42efd9 582 q31_t x,
simon 0:1014af42efd9 583 q31_t y)
simon 0:1014af42efd9 584 {
simon 0:1014af42efd9 585
simon 0:1014af42efd9 586 q31_t sum;
simon 0:1014af42efd9 587 q31_t r, s, t, u;
simon 0:1014af42efd9 588
simon 0:1014af42efd9 589 r = (char) x;
simon 0:1014af42efd9 590 s = (char) y;
simon 0:1014af42efd9 591
simon 0:1014af42efd9 592 r = __SSAT((r - s), 8);
simon 0:1014af42efd9 593 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
simon 0:1014af42efd9 594 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
simon 0:1014af42efd9 595 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
simon 0:1014af42efd9 596
simon 0:1014af42efd9 597 sum =
simon 0:1014af42efd9 598 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & 0x000000FF);
simon 0:1014af42efd9 599
simon 0:1014af42efd9 600 return sum;
simon 0:1014af42efd9 601 }
simon 0:1014af42efd9 602
simon 0:1014af42efd9 603 /*
simon 0:1014af42efd9 604 * @brief C custom defined QADD16 for M3 and M0 processors
simon 0:1014af42efd9 605 */
simon 0:1014af42efd9 606
simon 0:1014af42efd9 607 /*
simon 0:1014af42efd9 608 * @brief C custom defined QADD16 for M3 and M0 processors
simon 0:1014af42efd9 609 */
simon 0:1014af42efd9 610 static __INLINE q31_t __QADD16(
simon 0:1014af42efd9 611 q31_t x,
simon 0:1014af42efd9 612 q31_t y)
simon 0:1014af42efd9 613 {
simon 0:1014af42efd9 614
simon 0:1014af42efd9 615 q31_t sum;
simon 0:1014af42efd9 616 q31_t r, s;
simon 0:1014af42efd9 617
simon 0:1014af42efd9 618 r = (short) x;
simon 0:1014af42efd9 619 s = (short) y;
simon 0:1014af42efd9 620
simon 0:1014af42efd9 621 r = __SSAT(r + s, 16);
simon 0:1014af42efd9 622 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
simon 0:1014af42efd9 623
simon 0:1014af42efd9 624 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
simon 0:1014af42efd9 625
simon 0:1014af42efd9 626 return sum;
simon 0:1014af42efd9 627
simon 0:1014af42efd9 628 }
simon 0:1014af42efd9 629
simon 0:1014af42efd9 630 /*
simon 0:1014af42efd9 631 * @brief C custom defined SHADD16 for M3 and M0 processors
simon 0:1014af42efd9 632 */
simon 0:1014af42efd9 633 static __INLINE q31_t __SHADD16(
simon 0:1014af42efd9 634 q31_t x,
simon 0:1014af42efd9 635 q31_t y)
simon 0:1014af42efd9 636 {
simon 0:1014af42efd9 637
simon 0:1014af42efd9 638 q31_t sum;
simon 0:1014af42efd9 639 q31_t r, s;
simon 0:1014af42efd9 640
simon 0:1014af42efd9 641 r = (short) x;
simon 0:1014af42efd9 642 s = (short) y;
simon 0:1014af42efd9 643
simon 0:1014af42efd9 644 r = ((r >> 1) + (s >> 1));
simon 0:1014af42efd9 645 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
simon 0:1014af42efd9 646
simon 0:1014af42efd9 647 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
simon 0:1014af42efd9 648
simon 0:1014af42efd9 649 return sum;
simon 0:1014af42efd9 650
simon 0:1014af42efd9 651 }
simon 0:1014af42efd9 652
simon 0:1014af42efd9 653 /*
simon 0:1014af42efd9 654 * @brief C custom defined QSUB16 for M3 and M0 processors
simon 0:1014af42efd9 655 */
simon 0:1014af42efd9 656 static __INLINE q31_t __QSUB16(
simon 0:1014af42efd9 657 q31_t x,
simon 0:1014af42efd9 658 q31_t y)
simon 0:1014af42efd9 659 {
simon 0:1014af42efd9 660
simon 0:1014af42efd9 661 q31_t sum;
simon 0:1014af42efd9 662 q31_t r, s;
simon 0:1014af42efd9 663
simon 0:1014af42efd9 664 r = (short) x;
simon 0:1014af42efd9 665 s = (short) y;
simon 0:1014af42efd9 666
simon 0:1014af42efd9 667 r = __SSAT(r - s, 16);
simon 0:1014af42efd9 668 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
simon 0:1014af42efd9 669
simon 0:1014af42efd9 670 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
simon 0:1014af42efd9 671
simon 0:1014af42efd9 672 return sum;
simon 0:1014af42efd9 673 }
simon 0:1014af42efd9 674
simon 0:1014af42efd9 675 /*
simon 0:1014af42efd9 676 * @brief C custom defined SHSUB16 for M3 and M0 processors
simon 0:1014af42efd9 677 */
simon 0:1014af42efd9 678 static __INLINE q31_t __SHSUB16(
simon 0:1014af42efd9 679 q31_t x,
simon 0:1014af42efd9 680 q31_t y)
simon 0:1014af42efd9 681 {
simon 0:1014af42efd9 682
simon 0:1014af42efd9 683 q31_t diff;
simon 0:1014af42efd9 684 q31_t r, s;
simon 0:1014af42efd9 685
simon 0:1014af42efd9 686 r = (short) x;
simon 0:1014af42efd9 687 s = (short) y;
simon 0:1014af42efd9 688
simon 0:1014af42efd9 689 r = ((r >> 1) - (s >> 1));
simon 0:1014af42efd9 690 s = (((x >> 17) - (y >> 17)) << 16);
simon 0:1014af42efd9 691
simon 0:1014af42efd9 692 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
simon 0:1014af42efd9 693
simon 0:1014af42efd9 694 return diff;
simon 0:1014af42efd9 695 }
simon 0:1014af42efd9 696
simon 0:1014af42efd9 697 /*
simon 0:1014af42efd9 698 * @brief C custom defined QASX for M3 and M0 processors
simon 0:1014af42efd9 699 */
simon 0:1014af42efd9 700 static __INLINE q31_t __QASX(
simon 0:1014af42efd9 701 q31_t x,
simon 0:1014af42efd9 702 q31_t y)
simon 0:1014af42efd9 703 {
simon 0:1014af42efd9 704
simon 0:1014af42efd9 705 q31_t sum = 0;
simon 0:1014af42efd9 706
simon 0:1014af42efd9 707 sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) +
simon 0:1014af42efd9 708 clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16)));
simon 0:1014af42efd9 709
simon 0:1014af42efd9 710 return sum;
simon 0:1014af42efd9 711 }
simon 0:1014af42efd9 712
simon 0:1014af42efd9 713 /*
simon 0:1014af42efd9 714 * @brief C custom defined SHASX for M3 and M0 processors
simon 0:1014af42efd9 715 */
simon 0:1014af42efd9 716 static __INLINE q31_t __SHASX(
simon 0:1014af42efd9 717 q31_t x,
simon 0:1014af42efd9 718 q31_t y)
simon 0:1014af42efd9 719 {
simon 0:1014af42efd9 720
simon 0:1014af42efd9 721 q31_t sum;
simon 0:1014af42efd9 722 q31_t r, s;
simon 0:1014af42efd9 723
simon 0:1014af42efd9 724 r = (short) x;
simon 0:1014af42efd9 725 s = (short) y;
simon 0:1014af42efd9 726
simon 0:1014af42efd9 727 r = ((r >> 1) - (y >> 17));
simon 0:1014af42efd9 728 s = (((x >> 17) + (s >> 1)) << 16);
simon 0:1014af42efd9 729
simon 0:1014af42efd9 730 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
simon 0:1014af42efd9 731
simon 0:1014af42efd9 732 return sum;
simon 0:1014af42efd9 733 }
simon 0:1014af42efd9 734
simon 0:1014af42efd9 735
simon 0:1014af42efd9 736 /*
simon 0:1014af42efd9 737 * @brief C custom defined QSAX for M3 and M0 processors
simon 0:1014af42efd9 738 */
simon 0:1014af42efd9 739 static __INLINE q31_t __QSAX(
simon 0:1014af42efd9 740 q31_t x,
simon 0:1014af42efd9 741 q31_t y)
simon 0:1014af42efd9 742 {
simon 0:1014af42efd9 743
simon 0:1014af42efd9 744 q31_t sum = 0;
simon 0:1014af42efd9 745
simon 0:1014af42efd9 746 sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) +
simon 0:1014af42efd9 747 clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16)));
simon 0:1014af42efd9 748
simon 0:1014af42efd9 749 return sum;
simon 0:1014af42efd9 750 }
simon 0:1014af42efd9 751
simon 0:1014af42efd9 752 /*
simon 0:1014af42efd9 753 * @brief C custom defined SHSAX for M3 and M0 processors
simon 0:1014af42efd9 754 */
simon 0:1014af42efd9 755 static __INLINE q31_t __SHSAX(
simon 0:1014af42efd9 756 q31_t x,
simon 0:1014af42efd9 757 q31_t y)
simon 0:1014af42efd9 758 {
simon 0:1014af42efd9 759
simon 0:1014af42efd9 760 q31_t sum;
simon 0:1014af42efd9 761 q31_t r, s;
simon 0:1014af42efd9 762
simon 0:1014af42efd9 763 r = (short) x;
simon 0:1014af42efd9 764 s = (short) y;
simon 0:1014af42efd9 765
simon 0:1014af42efd9 766 r = ((r >> 1) + (y >> 17));
simon 0:1014af42efd9 767 s = (((x >> 17) - (s >> 1)) << 16);
simon 0:1014af42efd9 768
simon 0:1014af42efd9 769 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
simon 0:1014af42efd9 770
simon 0:1014af42efd9 771 return sum;
simon 0:1014af42efd9 772 }
simon 0:1014af42efd9 773
simon 0:1014af42efd9 774 /*
simon 0:1014af42efd9 775 * @brief C custom defined SMUSDX for M3 and M0 processors
simon 0:1014af42efd9 776 */
simon 0:1014af42efd9 777 static __INLINE q31_t __SMUSDX(
simon 0:1014af42efd9 778 q31_t x,
simon 0:1014af42efd9 779 q31_t y)
simon 0:1014af42efd9 780 {
simon 0:1014af42efd9 781
simon 0:1014af42efd9 782 return ((q31_t)(((short) x * (short) (y >> 16)) -
simon 0:1014af42efd9 783 ((short) (x >> 16) * (short) y)));
simon 0:1014af42efd9 784 }
simon 0:1014af42efd9 785
simon 0:1014af42efd9 786 /*
simon 0:1014af42efd9 787 * @brief C custom defined SMUADX for M3 and M0 processors
simon 0:1014af42efd9 788 */
simon 0:1014af42efd9 789 static __INLINE q31_t __SMUADX(
simon 0:1014af42efd9 790 q31_t x,
simon 0:1014af42efd9 791 q31_t y)
simon 0:1014af42efd9 792 {
simon 0:1014af42efd9 793
simon 0:1014af42efd9 794 return ((q31_t)(((short) x * (short) (y >> 16)) +
simon 0:1014af42efd9 795 ((short) (x >> 16) * (short) y)));
simon 0:1014af42efd9 796 }
simon 0:1014af42efd9 797
simon 0:1014af42efd9 798 /*
simon 0:1014af42efd9 799 * @brief C custom defined QADD for M3 and M0 processors
simon 0:1014af42efd9 800 */
simon 0:1014af42efd9 801 static __INLINE q31_t __QADD(
simon 0:1014af42efd9 802 q31_t x,
simon 0:1014af42efd9 803 q31_t y)
simon 0:1014af42efd9 804 {
simon 0:1014af42efd9 805 return clip_q63_to_q31((q63_t) x + y);
simon 0:1014af42efd9 806 }
simon 0:1014af42efd9 807
simon 0:1014af42efd9 808 /*
simon 0:1014af42efd9 809 * @brief C custom defined QSUB for M3 and M0 processors
simon 0:1014af42efd9 810 */
simon 0:1014af42efd9 811 static __INLINE q31_t __QSUB(
simon 0:1014af42efd9 812 q31_t x,
simon 0:1014af42efd9 813 q31_t y)
simon 0:1014af42efd9 814 {
simon 0:1014af42efd9 815 return clip_q63_to_q31((q63_t) x - y);
simon 0:1014af42efd9 816 }
simon 0:1014af42efd9 817
simon 0:1014af42efd9 818 /*
simon 0:1014af42efd9 819 * @brief C custom defined SMLAD for M3 and M0 processors
simon 0:1014af42efd9 820 */
simon 0:1014af42efd9 821 static __INLINE q31_t __SMLAD(
simon 0:1014af42efd9 822 q31_t x,
simon 0:1014af42efd9 823 q31_t y,
simon 0:1014af42efd9 824 q31_t sum)
simon 0:1014af42efd9 825 {
simon 0:1014af42efd9 826
simon 0:1014af42efd9 827 return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
simon 0:1014af42efd9 828 ((short) x * (short) y));
simon 0:1014af42efd9 829 }
simon 0:1014af42efd9 830
simon 0:1014af42efd9 831 /*
simon 0:1014af42efd9 832 * @brief C custom defined SMLADX for M3 and M0 processors
simon 0:1014af42efd9 833 */
simon 0:1014af42efd9 834 static __INLINE q31_t __SMLADX(
simon 0:1014af42efd9 835 q31_t x,
simon 0:1014af42efd9 836 q31_t y,
simon 0:1014af42efd9 837 q31_t sum)
simon 0:1014af42efd9 838 {
simon 0:1014af42efd9 839
simon 0:1014af42efd9 840 return (sum + ((short) (x >> 16) * (short) (y)) +
simon 0:1014af42efd9 841 ((short) x * (short) (y >> 16)));
simon 0:1014af42efd9 842 }
simon 0:1014af42efd9 843
simon 0:1014af42efd9 844 /*
simon 0:1014af42efd9 845 * @brief C custom defined SMLSDX for M3 and M0 processors
simon 0:1014af42efd9 846 */
simon 0:1014af42efd9 847 static __INLINE q31_t __SMLSDX(
simon 0:1014af42efd9 848 q31_t x,
simon 0:1014af42efd9 849 q31_t y,
simon 0:1014af42efd9 850 q31_t sum)
simon 0:1014af42efd9 851 {
simon 0:1014af42efd9 852
simon 0:1014af42efd9 853 return (sum - ((short) (x >> 16) * (short) (y)) +
simon 0:1014af42efd9 854 ((short) x * (short) (y >> 16)));
simon 0:1014af42efd9 855 }
simon 0:1014af42efd9 856
simon 0:1014af42efd9 857 /*
simon 0:1014af42efd9 858 * @brief C custom defined SMLALD for M3 and M0 processors
simon 0:1014af42efd9 859 */
simon 0:1014af42efd9 860 static __INLINE q63_t __SMLALD(
simon 0:1014af42efd9 861 q31_t x,
simon 0:1014af42efd9 862 q31_t y,
simon 0:1014af42efd9 863 q63_t sum)
simon 0:1014af42efd9 864 {
simon 0:1014af42efd9 865
simon 0:1014af42efd9 866 return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
simon 0:1014af42efd9 867 ((short) x * (short) y));
simon 0:1014af42efd9 868 }
simon 0:1014af42efd9 869
simon 0:1014af42efd9 870 /*
simon 0:1014af42efd9 871 * @brief C custom defined SMLALDX for M3 and M0 processors
simon 0:1014af42efd9 872 */
simon 0:1014af42efd9 873 static __INLINE q63_t __SMLALDX(
simon 0:1014af42efd9 874 q31_t x,
simon 0:1014af42efd9 875 q31_t y,
simon 0:1014af42efd9 876 q63_t sum)
simon 0:1014af42efd9 877 {
simon 0:1014af42efd9 878
simon 0:1014af42efd9 879 return (sum + ((short) (x >> 16) * (short) y)) +
simon 0:1014af42efd9 880 ((short) x * (short) (y >> 16));
simon 0:1014af42efd9 881 }
simon 0:1014af42efd9 882
simon 0:1014af42efd9 883 /*
simon 0:1014af42efd9 884 * @brief C custom defined SMUAD for M3 and M0 processors
simon 0:1014af42efd9 885 */
simon 0:1014af42efd9 886 static __INLINE q31_t __SMUAD(
simon 0:1014af42efd9 887 q31_t x,
simon 0:1014af42efd9 888 q31_t y)
simon 0:1014af42efd9 889 {
simon 0:1014af42efd9 890
simon 0:1014af42efd9 891 return (((x >> 16) * (y >> 16)) +
simon 0:1014af42efd9 892 (((x << 16) >> 16) * ((y << 16) >> 16)));
simon 0:1014af42efd9 893 }
simon 0:1014af42efd9 894
simon 0:1014af42efd9 895 /*
simon 0:1014af42efd9 896 * @brief C custom defined SMUSD for M3 and M0 processors
simon 0:1014af42efd9 897 */
simon 0:1014af42efd9 898 static __INLINE q31_t __SMUSD(
simon 0:1014af42efd9 899 q31_t x,
simon 0:1014af42efd9 900 q31_t y)
simon 0:1014af42efd9 901 {
simon 0:1014af42efd9 902
simon 0:1014af42efd9 903 return (-((x >> 16) * (y >> 16)) +
simon 0:1014af42efd9 904 (((x << 16) >> 16) * ((y << 16) >> 16)));
simon 0:1014af42efd9 905 }
simon 0:1014af42efd9 906
simon 0:1014af42efd9 907
simon 0:1014af42efd9 908
simon 0:1014af42efd9 909
simon 0:1014af42efd9 910 #endif /* (ARM_MATH_CM3) || defined (ARM_MATH_CM0) */
simon 0:1014af42efd9 911
simon 0:1014af42efd9 912
simon 0:1014af42efd9 913 /**
simon 0:1014af42efd9 914 * @brief Instance structure for the Q7 FIR filter.
simon 0:1014af42efd9 915 */
simon 0:1014af42efd9 916 typedef struct
simon 0:1014af42efd9 917 {
simon 0:1014af42efd9 918 uint16_t numTaps; /**< number of filter coefficients in the filter. */
simon 0:1014af42efd9 919 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 920 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 921 } arm_fir_instance_q7;
simon 0:1014af42efd9 922
simon 0:1014af42efd9 923 /**
simon 0:1014af42efd9 924 * @brief Instance structure for the Q15 FIR filter.
simon 0:1014af42efd9 925 */
simon 0:1014af42efd9 926 typedef struct
simon 0:1014af42efd9 927 {
simon 0:1014af42efd9 928 uint16_t numTaps; /**< number of filter coefficients in the filter. */
simon 0:1014af42efd9 929 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 930 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 931 } arm_fir_instance_q15;
simon 0:1014af42efd9 932
simon 0:1014af42efd9 933 /**
simon 0:1014af42efd9 934 * @brief Instance structure for the Q31 FIR filter.
simon 0:1014af42efd9 935 */
simon 0:1014af42efd9 936 typedef struct
simon 0:1014af42efd9 937 {
simon 0:1014af42efd9 938 uint16_t numTaps; /**< number of filter coefficients in the filter. */
simon 0:1014af42efd9 939 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 940 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 941 } arm_fir_instance_q31;
simon 0:1014af42efd9 942
simon 0:1014af42efd9 943 /**
simon 0:1014af42efd9 944 * @brief Instance structure for the floating-point FIR filter.
simon 0:1014af42efd9 945 */
simon 0:1014af42efd9 946 typedef struct
simon 0:1014af42efd9 947 {
simon 0:1014af42efd9 948 uint16_t numTaps; /**< number of filter coefficients in the filter. */
simon 0:1014af42efd9 949 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 950 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 951 } arm_fir_instance_f32;
simon 0:1014af42efd9 952
simon 0:1014af42efd9 953
simon 0:1014af42efd9 954 /**
simon 0:1014af42efd9 955 * @brief Processing function for the Q7 FIR filter.
simon 0:1014af42efd9 956 * @param[in] *S points to an instance of the Q7 FIR filter structure.
simon 0:1014af42efd9 957 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 958 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 959 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 960 * @return none.
simon 0:1014af42efd9 961 */
simon 0:1014af42efd9 962 void arm_fir_q7(
simon 0:1014af42efd9 963 const arm_fir_instance_q7 * S,
simon 0:1014af42efd9 964 q7_t * pSrc,
simon 0:1014af42efd9 965 q7_t * pDst,
simon 0:1014af42efd9 966 uint32_t blockSize);
simon 0:1014af42efd9 967
simon 0:1014af42efd9 968
simon 0:1014af42efd9 969 /**
simon 0:1014af42efd9 970 * @brief Initialization function for the Q7 FIR filter.
simon 0:1014af42efd9 971 * @param[in,out] *S points to an instance of the Q7 FIR structure.
simon 0:1014af42efd9 972 * @param[in] numTaps Number of filter coefficients in the filter.
simon 0:1014af42efd9 973 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 974 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 975 * @param[in] blockSize number of samples that are processed.
simon 0:1014af42efd9 976 * @return none
simon 0:1014af42efd9 977 */
simon 0:1014af42efd9 978 void arm_fir_init_q7(
simon 0:1014af42efd9 979 arm_fir_instance_q7 * S,
simon 0:1014af42efd9 980 uint16_t numTaps,
simon 0:1014af42efd9 981 q7_t * pCoeffs,
simon 0:1014af42efd9 982 q7_t * pState,
simon 0:1014af42efd9 983 uint32_t blockSize);
simon 0:1014af42efd9 984
simon 0:1014af42efd9 985
simon 0:1014af42efd9 986 /**
simon 0:1014af42efd9 987 * @brief Processing function for the Q15 FIR filter.
simon 0:1014af42efd9 988 * @param[in] *S points to an instance of the Q15 FIR structure.
simon 0:1014af42efd9 989 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 990 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 991 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 992 * @return none.
simon 0:1014af42efd9 993 */
simon 0:1014af42efd9 994 void arm_fir_q15(
simon 0:1014af42efd9 995 const arm_fir_instance_q15 * S,
simon 0:1014af42efd9 996 q15_t * pSrc,
simon 0:1014af42efd9 997 q15_t * pDst,
simon 0:1014af42efd9 998 uint32_t blockSize);
simon 0:1014af42efd9 999
simon 0:1014af42efd9 1000 /**
simon 0:1014af42efd9 1001 * @brief Processing function for the fast Q15 FIR filter.
simon 0:1014af42efd9 1002 * @param[in] *S points to an instance of the Q15 FIR filter structure.
simon 0:1014af42efd9 1003 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1004 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1005 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1006 * @return none.
simon 0:1014af42efd9 1007 */
simon 0:1014af42efd9 1008 void arm_fir_fast_q15(
simon 0:1014af42efd9 1009 const arm_fir_instance_q15 * S,
simon 0:1014af42efd9 1010 q15_t * pSrc,
simon 0:1014af42efd9 1011 q15_t * pDst,
simon 0:1014af42efd9 1012 uint32_t blockSize);
simon 0:1014af42efd9 1013
simon 0:1014af42efd9 1014 /**
simon 0:1014af42efd9 1015 * @brief Initialization function for the Q15 FIR filter.
simon 0:1014af42efd9 1016 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
simon 0:1014af42efd9 1017 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
simon 0:1014af42efd9 1018 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 1019 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 1020 * @param[in] blockSize number of samples that are processed at a time.
simon 0:1014af42efd9 1021 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
simon 0:1014af42efd9 1022 * <code>numTaps</code> is not a supported value.
simon 0:1014af42efd9 1023 */
simon 0:1014af42efd9 1024 arm_status arm_fir_init_q15(
simon 0:1014af42efd9 1025 arm_fir_instance_q15 * S,
simon 0:1014af42efd9 1026 uint16_t numTaps,
simon 0:1014af42efd9 1027 q15_t * pCoeffs,
simon 0:1014af42efd9 1028 q15_t * pState,
simon 0:1014af42efd9 1029 uint32_t blockSize);
simon 0:1014af42efd9 1030
simon 0:1014af42efd9 1031
simon 0:1014af42efd9 1032 /**
simon 0:1014af42efd9 1033 * @brief Processing function for the Q31 FIR filter.
simon 0:1014af42efd9 1034 * @param[in] *S points to an instance of the Q31 FIR filter structure.
simon 0:1014af42efd9 1035 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1036 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1037 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1038 * @return none.
simon 0:1014af42efd9 1039 */
simon 0:1014af42efd9 1040 void arm_fir_q31(
simon 0:1014af42efd9 1041 const arm_fir_instance_q31 * S,
simon 0:1014af42efd9 1042 q31_t * pSrc,
simon 0:1014af42efd9 1043 q31_t * pDst,
simon 0:1014af42efd9 1044 uint32_t blockSize);
simon 0:1014af42efd9 1045
simon 0:1014af42efd9 1046 /**
simon 0:1014af42efd9 1047 * @brief Processing function for the fast Q31 FIR filter.
simon 0:1014af42efd9 1048 * @param[in] *S points to an instance of the Q31 FIR structure.
simon 0:1014af42efd9 1049 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1050 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1051 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1052 * @return none.
simon 0:1014af42efd9 1053 */
simon 0:1014af42efd9 1054 void arm_fir_fast_q31(
simon 0:1014af42efd9 1055 const arm_fir_instance_q31 * S,
simon 0:1014af42efd9 1056 q31_t * pSrc,
simon 0:1014af42efd9 1057 q31_t * pDst,
simon 0:1014af42efd9 1058 uint32_t blockSize);
simon 0:1014af42efd9 1059
simon 0:1014af42efd9 1060 /**
simon 0:1014af42efd9 1061 * @brief Initialization function for the Q31 FIR filter.
simon 0:1014af42efd9 1062 * @param[in,out] *S points to an instance of the Q31 FIR structure.
simon 0:1014af42efd9 1063 * @param[in] numTaps Number of filter coefficients in the filter.
simon 0:1014af42efd9 1064 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 1065 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 1066 * @param[in] blockSize number of samples that are processed at a time.
simon 0:1014af42efd9 1067 * @return none.
simon 0:1014af42efd9 1068 */
simon 0:1014af42efd9 1069 void arm_fir_init_q31(
simon 0:1014af42efd9 1070 arm_fir_instance_q31 * S,
simon 0:1014af42efd9 1071 uint16_t numTaps,
simon 0:1014af42efd9 1072 q31_t * pCoeffs,
simon 0:1014af42efd9 1073 q31_t * pState,
simon 0:1014af42efd9 1074 uint32_t blockSize);
simon 0:1014af42efd9 1075
simon 0:1014af42efd9 1076 /**
simon 0:1014af42efd9 1077 * @brief Processing function for the floating-point FIR filter.
simon 0:1014af42efd9 1078 * @param[in] *S points to an instance of the floating-point FIR structure.
simon 0:1014af42efd9 1079 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1080 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1081 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1082 * @return none.
simon 0:1014af42efd9 1083 */
simon 0:1014af42efd9 1084 void arm_fir_f32(
simon 0:1014af42efd9 1085 const arm_fir_instance_f32 * S,
simon 0:1014af42efd9 1086 float32_t * pSrc,
simon 0:1014af42efd9 1087 float32_t * pDst,
simon 0:1014af42efd9 1088 uint32_t blockSize);
simon 0:1014af42efd9 1089
simon 0:1014af42efd9 1090 /**
simon 0:1014af42efd9 1091 * @brief Initialization function for the floating-point FIR filter.
simon 0:1014af42efd9 1092 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
simon 0:1014af42efd9 1093 * @param[in] numTaps Number of filter coefficients in the filter.
simon 0:1014af42efd9 1094 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 1095 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 1096 * @param[in] blockSize number of samples that are processed at a time.
simon 0:1014af42efd9 1097 * @return none.
simon 0:1014af42efd9 1098 */
simon 0:1014af42efd9 1099 void arm_fir_init_f32(
simon 0:1014af42efd9 1100 arm_fir_instance_f32 * S,
simon 0:1014af42efd9 1101 uint16_t numTaps,
simon 0:1014af42efd9 1102 float32_t * pCoeffs,
simon 0:1014af42efd9 1103 float32_t * pState,
simon 0:1014af42efd9 1104 uint32_t blockSize);
simon 0:1014af42efd9 1105
simon 0:1014af42efd9 1106
simon 0:1014af42efd9 1107 /**
simon 0:1014af42efd9 1108 * @brief Instance structure for the Q15 Biquad cascade filter.
simon 0:1014af42efd9 1109 */
simon 0:1014af42efd9 1110 typedef struct
simon 0:1014af42efd9 1111 {
simon 0:1014af42efd9 1112 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
simon 0:1014af42efd9 1113 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
simon 0:1014af42efd9 1114 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
simon 0:1014af42efd9 1115 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
simon 0:1014af42efd9 1116
simon 0:1014af42efd9 1117 } arm_biquad_casd_df1_inst_q15;
simon 0:1014af42efd9 1118
simon 0:1014af42efd9 1119
simon 0:1014af42efd9 1120 /**
simon 0:1014af42efd9 1121 * @brief Instance structure for the Q31 Biquad cascade filter.
simon 0:1014af42efd9 1122 */
simon 0:1014af42efd9 1123 typedef struct
simon 0:1014af42efd9 1124 {
simon 0:1014af42efd9 1125 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
simon 0:1014af42efd9 1126 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
simon 0:1014af42efd9 1127 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
simon 0:1014af42efd9 1128 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
simon 0:1014af42efd9 1129
simon 0:1014af42efd9 1130 } arm_biquad_casd_df1_inst_q31;
simon 0:1014af42efd9 1131
simon 0:1014af42efd9 1132 /**
simon 0:1014af42efd9 1133 * @brief Instance structure for the floating-point Biquad cascade filter.
simon 0:1014af42efd9 1134 */
simon 0:1014af42efd9 1135 typedef struct
simon 0:1014af42efd9 1136 {
simon 0:1014af42efd9 1137 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
simon 0:1014af42efd9 1138 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
simon 0:1014af42efd9 1139 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
simon 0:1014af42efd9 1140
simon 0:1014af42efd9 1141
simon 0:1014af42efd9 1142 } arm_biquad_casd_df1_inst_f32;
simon 0:1014af42efd9 1143
simon 0:1014af42efd9 1144
simon 0:1014af42efd9 1145
simon 0:1014af42efd9 1146 /**
simon 0:1014af42efd9 1147 * @brief Processing function for the Q15 Biquad cascade filter.
simon 0:1014af42efd9 1148 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
simon 0:1014af42efd9 1149 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1150 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1151 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1152 * @return none.
simon 0:1014af42efd9 1153 */
simon 0:1014af42efd9 1154
simon 0:1014af42efd9 1155 void arm_biquad_cascade_df1_q15(
simon 0:1014af42efd9 1156 const arm_biquad_casd_df1_inst_q15 * S,
simon 0:1014af42efd9 1157 q15_t * pSrc,
simon 0:1014af42efd9 1158 q15_t * pDst,
simon 0:1014af42efd9 1159 uint32_t blockSize);
simon 0:1014af42efd9 1160
simon 0:1014af42efd9 1161 /**
simon 0:1014af42efd9 1162 * @brief Initialization function for the Q15 Biquad cascade filter.
simon 0:1014af42efd9 1163 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
simon 0:1014af42efd9 1164 * @param[in] numStages number of 2nd order stages in the filter.
simon 0:1014af42efd9 1165 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 1166 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 1167 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
simon 0:1014af42efd9 1168 * @return none
simon 0:1014af42efd9 1169 */
simon 0:1014af42efd9 1170
simon 0:1014af42efd9 1171 void arm_biquad_cascade_df1_init_q15(
simon 0:1014af42efd9 1172 arm_biquad_casd_df1_inst_q15 * S,
simon 0:1014af42efd9 1173 uint8_t numStages,
simon 0:1014af42efd9 1174 q15_t * pCoeffs,
simon 0:1014af42efd9 1175 q15_t * pState,
simon 0:1014af42efd9 1176 int8_t postShift);
simon 0:1014af42efd9 1177
simon 0:1014af42efd9 1178
simon 0:1014af42efd9 1179 /**
simon 0:1014af42efd9 1180 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter.
simon 0:1014af42efd9 1181 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
simon 0:1014af42efd9 1182 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1183 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1184 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1185 * @return none.
simon 0:1014af42efd9 1186 */
simon 0:1014af42efd9 1187
simon 0:1014af42efd9 1188 void arm_biquad_cascade_df1_fast_q15(
simon 0:1014af42efd9 1189 const arm_biquad_casd_df1_inst_q15 * S,
simon 0:1014af42efd9 1190 q15_t * pSrc,
simon 0:1014af42efd9 1191 q15_t * pDst,
simon 0:1014af42efd9 1192 uint32_t blockSize);
simon 0:1014af42efd9 1193
simon 0:1014af42efd9 1194
simon 0:1014af42efd9 1195 /**
simon 0:1014af42efd9 1196 * @brief Processing function for the Q31 Biquad cascade filter
simon 0:1014af42efd9 1197 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
simon 0:1014af42efd9 1198 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1199 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1200 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1201 * @return none.
simon 0:1014af42efd9 1202 */
simon 0:1014af42efd9 1203
simon 0:1014af42efd9 1204 void arm_biquad_cascade_df1_q31(
simon 0:1014af42efd9 1205 const arm_biquad_casd_df1_inst_q31 * S,
simon 0:1014af42efd9 1206 q31_t * pSrc,
simon 0:1014af42efd9 1207 q31_t * pDst,
simon 0:1014af42efd9 1208 uint32_t blockSize);
simon 0:1014af42efd9 1209
simon 0:1014af42efd9 1210 /**
simon 0:1014af42efd9 1211 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter.
simon 0:1014af42efd9 1212 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
simon 0:1014af42efd9 1213 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1214 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1215 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1216 * @return none.
simon 0:1014af42efd9 1217 */
simon 0:1014af42efd9 1218
simon 0:1014af42efd9 1219 void arm_biquad_cascade_df1_fast_q31(
simon 0:1014af42efd9 1220 const arm_biquad_casd_df1_inst_q31 * S,
simon 0:1014af42efd9 1221 q31_t * pSrc,
simon 0:1014af42efd9 1222 q31_t * pDst,
simon 0:1014af42efd9 1223 uint32_t blockSize);
simon 0:1014af42efd9 1224
simon 0:1014af42efd9 1225 /**
simon 0:1014af42efd9 1226 * @brief Initialization function for the Q31 Biquad cascade filter.
simon 0:1014af42efd9 1227 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
simon 0:1014af42efd9 1228 * @param[in] numStages number of 2nd order stages in the filter.
simon 0:1014af42efd9 1229 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 1230 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 1231 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
simon 0:1014af42efd9 1232 * @return none
simon 0:1014af42efd9 1233 */
simon 0:1014af42efd9 1234
simon 0:1014af42efd9 1235 void arm_biquad_cascade_df1_init_q31(
simon 0:1014af42efd9 1236 arm_biquad_casd_df1_inst_q31 * S,
simon 0:1014af42efd9 1237 uint8_t numStages,
simon 0:1014af42efd9 1238 q31_t * pCoeffs,
simon 0:1014af42efd9 1239 q31_t * pState,
simon 0:1014af42efd9 1240 int8_t postShift);
simon 0:1014af42efd9 1241
simon 0:1014af42efd9 1242 /**
simon 0:1014af42efd9 1243 * @brief Processing function for the floating-point Biquad cascade filter.
simon 0:1014af42efd9 1244 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
simon 0:1014af42efd9 1245 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 1246 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 1247 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 1248 * @return none.
simon 0:1014af42efd9 1249 */
simon 0:1014af42efd9 1250
simon 0:1014af42efd9 1251 void arm_biquad_cascade_df1_f32(
simon 0:1014af42efd9 1252 const arm_biquad_casd_df1_inst_f32 * S,
simon 0:1014af42efd9 1253 float32_t * pSrc,
simon 0:1014af42efd9 1254 float32_t * pDst,
simon 0:1014af42efd9 1255 uint32_t blockSize);
simon 0:1014af42efd9 1256
simon 0:1014af42efd9 1257 /**
simon 0:1014af42efd9 1258 * @brief Initialization function for the floating-point Biquad cascade filter.
simon 0:1014af42efd9 1259 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
simon 0:1014af42efd9 1260 * @param[in] numStages number of 2nd order stages in the filter.
simon 0:1014af42efd9 1261 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 1262 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 1263 * @return none
simon 0:1014af42efd9 1264 */
simon 0:1014af42efd9 1265
simon 0:1014af42efd9 1266 void arm_biquad_cascade_df1_init_f32(
simon 0:1014af42efd9 1267 arm_biquad_casd_df1_inst_f32 * S,
simon 0:1014af42efd9 1268 uint8_t numStages,
simon 0:1014af42efd9 1269 float32_t * pCoeffs,
simon 0:1014af42efd9 1270 float32_t * pState);
simon 0:1014af42efd9 1271
simon 0:1014af42efd9 1272
simon 0:1014af42efd9 1273 /**
simon 0:1014af42efd9 1274 * @brief Instance structure for the floating-point matrix structure.
simon 0:1014af42efd9 1275 */
simon 0:1014af42efd9 1276
simon 0:1014af42efd9 1277 typedef struct
simon 0:1014af42efd9 1278 {
simon 0:1014af42efd9 1279 uint16_t numRows; /**< number of rows of the matrix. */
simon 0:1014af42efd9 1280 uint16_t numCols; /**< number of columns of the matrix. */
simon 0:1014af42efd9 1281 float32_t *pData; /**< points to the data of the matrix. */
simon 0:1014af42efd9 1282 } arm_matrix_instance_f32;
simon 0:1014af42efd9 1283
simon 0:1014af42efd9 1284 /**
simon 0:1014af42efd9 1285 * @brief Instance structure for the Q15 matrix structure.
simon 0:1014af42efd9 1286 */
simon 0:1014af42efd9 1287
simon 0:1014af42efd9 1288 typedef struct
simon 0:1014af42efd9 1289 {
simon 0:1014af42efd9 1290 uint16_t numRows; /**< number of rows of the matrix. */
simon 0:1014af42efd9 1291 uint16_t numCols; /**< number of columns of the matrix. */
simon 0:1014af42efd9 1292 q15_t *pData; /**< points to the data of the matrix. */
simon 0:1014af42efd9 1293
simon 0:1014af42efd9 1294 } arm_matrix_instance_q15;
simon 0:1014af42efd9 1295
simon 0:1014af42efd9 1296 /**
simon 0:1014af42efd9 1297 * @brief Instance structure for the Q31 matrix structure.
simon 0:1014af42efd9 1298 */
simon 0:1014af42efd9 1299
simon 0:1014af42efd9 1300 typedef struct
simon 0:1014af42efd9 1301 {
simon 0:1014af42efd9 1302 uint16_t numRows; /**< number of rows of the matrix. */
simon 0:1014af42efd9 1303 uint16_t numCols; /**< number of columns of the matrix. */
simon 0:1014af42efd9 1304 q31_t *pData; /**< points to the data of the matrix. */
simon 0:1014af42efd9 1305
simon 0:1014af42efd9 1306 } arm_matrix_instance_q31;
simon 0:1014af42efd9 1307
simon 0:1014af42efd9 1308
simon 0:1014af42efd9 1309
simon 0:1014af42efd9 1310 /**
simon 0:1014af42efd9 1311 * @brief Floating-point matrix addition.
simon 0:1014af42efd9 1312 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1313 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1314 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1315 * @return The function returns either
simon 0:1014af42efd9 1316 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1317 */
simon 0:1014af42efd9 1318
simon 0:1014af42efd9 1319 arm_status arm_mat_add_f32(
simon 0:1014af42efd9 1320 const arm_matrix_instance_f32 * pSrcA,
simon 0:1014af42efd9 1321 const arm_matrix_instance_f32 * pSrcB,
simon 0:1014af42efd9 1322 arm_matrix_instance_f32 * pDst);
simon 0:1014af42efd9 1323
simon 0:1014af42efd9 1324 /**
simon 0:1014af42efd9 1325 * @brief Q15 matrix addition.
simon 0:1014af42efd9 1326 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1327 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1328 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1329 * @return The function returns either
simon 0:1014af42efd9 1330 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1331 */
simon 0:1014af42efd9 1332
simon 0:1014af42efd9 1333 arm_status arm_mat_add_q15(
simon 0:1014af42efd9 1334 const arm_matrix_instance_q15 * pSrcA,
simon 0:1014af42efd9 1335 const arm_matrix_instance_q15 * pSrcB,
simon 0:1014af42efd9 1336 arm_matrix_instance_q15 * pDst);
simon 0:1014af42efd9 1337
simon 0:1014af42efd9 1338 /**
simon 0:1014af42efd9 1339 * @brief Q31 matrix addition.
simon 0:1014af42efd9 1340 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1341 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1342 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1343 * @return The function returns either
simon 0:1014af42efd9 1344 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1345 */
simon 0:1014af42efd9 1346
simon 0:1014af42efd9 1347 arm_status arm_mat_add_q31(
simon 0:1014af42efd9 1348 const arm_matrix_instance_q31 * pSrcA,
simon 0:1014af42efd9 1349 const arm_matrix_instance_q31 * pSrcB,
simon 0:1014af42efd9 1350 arm_matrix_instance_q31 * pDst);
simon 0:1014af42efd9 1351
simon 0:1014af42efd9 1352
simon 0:1014af42efd9 1353 /**
simon 0:1014af42efd9 1354 * @brief Floating-point matrix transpose.
simon 0:1014af42efd9 1355 * @param[in] *pSrc points to the input matrix
simon 0:1014af42efd9 1356 * @param[out] *pDst points to the output matrix
simon 0:1014af42efd9 1357 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
simon 0:1014af42efd9 1358 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
simon 0:1014af42efd9 1359 */
simon 0:1014af42efd9 1360
simon 0:1014af42efd9 1361 arm_status arm_mat_trans_f32(
simon 0:1014af42efd9 1362 const arm_matrix_instance_f32 * pSrc,
simon 0:1014af42efd9 1363 arm_matrix_instance_f32 * pDst);
simon 0:1014af42efd9 1364
simon 0:1014af42efd9 1365
simon 0:1014af42efd9 1366 /**
simon 0:1014af42efd9 1367 * @brief Q15 matrix transpose.
simon 0:1014af42efd9 1368 * @param[in] *pSrc points to the input matrix
simon 0:1014af42efd9 1369 * @param[out] *pDst points to the output matrix
simon 0:1014af42efd9 1370 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
simon 0:1014af42efd9 1371 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
simon 0:1014af42efd9 1372 */
simon 0:1014af42efd9 1373
simon 0:1014af42efd9 1374 arm_status arm_mat_trans_q15(
simon 0:1014af42efd9 1375 const arm_matrix_instance_q15 * pSrc,
simon 0:1014af42efd9 1376 arm_matrix_instance_q15 * pDst);
simon 0:1014af42efd9 1377
simon 0:1014af42efd9 1378 /**
simon 0:1014af42efd9 1379 * @brief Q31 matrix transpose.
simon 0:1014af42efd9 1380 * @param[in] *pSrc points to the input matrix
simon 0:1014af42efd9 1381 * @param[out] *pDst points to the output matrix
simon 0:1014af42efd9 1382 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
simon 0:1014af42efd9 1383 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
simon 0:1014af42efd9 1384 */
simon 0:1014af42efd9 1385
simon 0:1014af42efd9 1386 arm_status arm_mat_trans_q31(
simon 0:1014af42efd9 1387 const arm_matrix_instance_q31 * pSrc,
simon 0:1014af42efd9 1388 arm_matrix_instance_q31 * pDst);
simon 0:1014af42efd9 1389
simon 0:1014af42efd9 1390
simon 0:1014af42efd9 1391 /**
simon 0:1014af42efd9 1392 * @brief Floating-point matrix multiplication
simon 0:1014af42efd9 1393 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1394 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1395 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1396 * @return The function returns either
simon 0:1014af42efd9 1397 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1398 */
simon 0:1014af42efd9 1399
simon 0:1014af42efd9 1400 arm_status arm_mat_mult_f32(
simon 0:1014af42efd9 1401 const arm_matrix_instance_f32 * pSrcA,
simon 0:1014af42efd9 1402 const arm_matrix_instance_f32 * pSrcB,
simon 0:1014af42efd9 1403 arm_matrix_instance_f32 * pDst);
simon 0:1014af42efd9 1404
simon 0:1014af42efd9 1405 /**
simon 0:1014af42efd9 1406 * @brief Q15 matrix multiplication
simon 0:1014af42efd9 1407 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1408 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1409 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1410 * @return The function returns either
simon 0:1014af42efd9 1411 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1412 */
simon 0:1014af42efd9 1413
simon 0:1014af42efd9 1414 arm_status arm_mat_mult_q15(
simon 0:1014af42efd9 1415 const arm_matrix_instance_q15 * pSrcA,
simon 0:1014af42efd9 1416 const arm_matrix_instance_q15 * pSrcB,
simon 0:1014af42efd9 1417 arm_matrix_instance_q15 * pDst,
simon 0:1014af42efd9 1418 q15_t * pState);
simon 0:1014af42efd9 1419
simon 0:1014af42efd9 1420 /**
simon 0:1014af42efd9 1421 * @brief Q15 matrix multiplication (fast variant)
simon 0:1014af42efd9 1422 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1423 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1424 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1425 * @return The function returns either
simon 0:1014af42efd9 1426 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1427 */
simon 0:1014af42efd9 1428
simon 0:1014af42efd9 1429 arm_status arm_mat_mult_fast_q15(
simon 0:1014af42efd9 1430 const arm_matrix_instance_q15 * pSrcA,
simon 0:1014af42efd9 1431 const arm_matrix_instance_q15 * pSrcB,
simon 0:1014af42efd9 1432 arm_matrix_instance_q15 * pDst,
simon 0:1014af42efd9 1433 q15_t * pState);
simon 0:1014af42efd9 1434
simon 0:1014af42efd9 1435 /**
simon 0:1014af42efd9 1436 * @brief Q31 matrix multiplication
simon 0:1014af42efd9 1437 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1438 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1439 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1440 * @return The function returns either
simon 0:1014af42efd9 1441 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1442 */
simon 0:1014af42efd9 1443
simon 0:1014af42efd9 1444 arm_status arm_mat_mult_q31(
simon 0:1014af42efd9 1445 const arm_matrix_instance_q31 * pSrcA,
simon 0:1014af42efd9 1446 const arm_matrix_instance_q31 * pSrcB,
simon 0:1014af42efd9 1447 arm_matrix_instance_q31 * pDst);
simon 0:1014af42efd9 1448
simon 0:1014af42efd9 1449 /**
simon 0:1014af42efd9 1450 * @brief Q31 matrix multiplication (fast variant)
simon 0:1014af42efd9 1451 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1452 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1453 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1454 * @return The function returns either
simon 0:1014af42efd9 1455 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1456 */
simon 0:1014af42efd9 1457
simon 0:1014af42efd9 1458 arm_status arm_mat_mult_fast_q31(
simon 0:1014af42efd9 1459 const arm_matrix_instance_q31 * pSrcA,
simon 0:1014af42efd9 1460 const arm_matrix_instance_q31 * pSrcB,
simon 0:1014af42efd9 1461 arm_matrix_instance_q31 * pDst);
simon 0:1014af42efd9 1462
simon 0:1014af42efd9 1463
simon 0:1014af42efd9 1464 /**
simon 0:1014af42efd9 1465 * @brief Floating-point matrix subtraction
simon 0:1014af42efd9 1466 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1467 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1468 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1469 * @return The function returns either
simon 0:1014af42efd9 1470 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1471 */
simon 0:1014af42efd9 1472
simon 0:1014af42efd9 1473 arm_status arm_mat_sub_f32(
simon 0:1014af42efd9 1474 const arm_matrix_instance_f32 * pSrcA,
simon 0:1014af42efd9 1475 const arm_matrix_instance_f32 * pSrcB,
simon 0:1014af42efd9 1476 arm_matrix_instance_f32 * pDst);
simon 0:1014af42efd9 1477
simon 0:1014af42efd9 1478 /**
simon 0:1014af42efd9 1479 * @brief Q15 matrix subtraction
simon 0:1014af42efd9 1480 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1481 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1482 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1483 * @return The function returns either
simon 0:1014af42efd9 1484 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1485 */
simon 0:1014af42efd9 1486
simon 0:1014af42efd9 1487 arm_status arm_mat_sub_q15(
simon 0:1014af42efd9 1488 const arm_matrix_instance_q15 * pSrcA,
simon 0:1014af42efd9 1489 const arm_matrix_instance_q15 * pSrcB,
simon 0:1014af42efd9 1490 arm_matrix_instance_q15 * pDst);
simon 0:1014af42efd9 1491
simon 0:1014af42efd9 1492 /**
simon 0:1014af42efd9 1493 * @brief Q31 matrix subtraction
simon 0:1014af42efd9 1494 * @param[in] *pSrcA points to the first input matrix structure
simon 0:1014af42efd9 1495 * @param[in] *pSrcB points to the second input matrix structure
simon 0:1014af42efd9 1496 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1497 * @return The function returns either
simon 0:1014af42efd9 1498 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1499 */
simon 0:1014af42efd9 1500
simon 0:1014af42efd9 1501 arm_status arm_mat_sub_q31(
simon 0:1014af42efd9 1502 const arm_matrix_instance_q31 * pSrcA,
simon 0:1014af42efd9 1503 const arm_matrix_instance_q31 * pSrcB,
simon 0:1014af42efd9 1504 arm_matrix_instance_q31 * pDst);
simon 0:1014af42efd9 1505
simon 0:1014af42efd9 1506 /**
simon 0:1014af42efd9 1507 * @brief Floating-point matrix scaling.
simon 0:1014af42efd9 1508 * @param[in] *pSrc points to the input matrix
simon 0:1014af42efd9 1509 * @param[in] scale scale factor
simon 0:1014af42efd9 1510 * @param[out] *pDst points to the output matrix
simon 0:1014af42efd9 1511 * @return The function returns either
simon 0:1014af42efd9 1512 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1513 */
simon 0:1014af42efd9 1514
simon 0:1014af42efd9 1515 arm_status arm_mat_scale_f32(
simon 0:1014af42efd9 1516 const arm_matrix_instance_f32 * pSrc,
simon 0:1014af42efd9 1517 float32_t scale,
simon 0:1014af42efd9 1518 arm_matrix_instance_f32 * pDst);
simon 0:1014af42efd9 1519
simon 0:1014af42efd9 1520 /**
simon 0:1014af42efd9 1521 * @brief Q15 matrix scaling.
simon 0:1014af42efd9 1522 * @param[in] *pSrc points to input matrix
simon 0:1014af42efd9 1523 * @param[in] scaleFract fractional portion of the scale factor
simon 0:1014af42efd9 1524 * @param[in] shift number of bits to shift the result by
simon 0:1014af42efd9 1525 * @param[out] *pDst points to output matrix
simon 0:1014af42efd9 1526 * @return The function returns either
simon 0:1014af42efd9 1527 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1528 */
simon 0:1014af42efd9 1529
simon 0:1014af42efd9 1530 arm_status arm_mat_scale_q15(
simon 0:1014af42efd9 1531 const arm_matrix_instance_q15 * pSrc,
simon 0:1014af42efd9 1532 q15_t scaleFract,
simon 0:1014af42efd9 1533 int32_t shift,
simon 0:1014af42efd9 1534 arm_matrix_instance_q15 * pDst);
simon 0:1014af42efd9 1535
simon 0:1014af42efd9 1536 /**
simon 0:1014af42efd9 1537 * @brief Q31 matrix scaling.
simon 0:1014af42efd9 1538 * @param[in] *pSrc points to input matrix
simon 0:1014af42efd9 1539 * @param[in] scaleFract fractional portion of the scale factor
simon 0:1014af42efd9 1540 * @param[in] shift number of bits to shift the result by
simon 0:1014af42efd9 1541 * @param[out] *pDst points to output matrix structure
simon 0:1014af42efd9 1542 * @return The function returns either
simon 0:1014af42efd9 1543 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS based on the outcome of size checking.
simon 0:1014af42efd9 1544 */
simon 0:1014af42efd9 1545
simon 0:1014af42efd9 1546 arm_status arm_mat_scale_q31(
simon 0:1014af42efd9 1547 const arm_matrix_instance_q31 * pSrc,
simon 0:1014af42efd9 1548 q31_t scaleFract,
simon 0:1014af42efd9 1549 int32_t shift,
simon 0:1014af42efd9 1550 arm_matrix_instance_q31 * pDst);
simon 0:1014af42efd9 1551
simon 0:1014af42efd9 1552
simon 0:1014af42efd9 1553 /**
simon 0:1014af42efd9 1554 * @brief Q31 matrix initialization.
simon 0:1014af42efd9 1555 * @param[in,out] *S points to an instance of the floating-point matrix structure.
simon 0:1014af42efd9 1556 * @param[in] nRows number of rows in the matrix.
simon 0:1014af42efd9 1557 * @param[in] nColumns number of columns in the matrix.
simon 0:1014af42efd9 1558 * @param[in] *pData points to the matrix data array.
simon 0:1014af42efd9 1559 * @return none
simon 0:1014af42efd9 1560 */
simon 0:1014af42efd9 1561
simon 0:1014af42efd9 1562 void arm_mat_init_q31(
simon 0:1014af42efd9 1563 arm_matrix_instance_q31 * S,
simon 0:1014af42efd9 1564 uint16_t nRows,
simon 0:1014af42efd9 1565 uint16_t nColumns,
simon 0:1014af42efd9 1566 q31_t *pData);
simon 0:1014af42efd9 1567
simon 0:1014af42efd9 1568 /**
simon 0:1014af42efd9 1569 * @brief Q15 matrix initialization.
simon 0:1014af42efd9 1570 * @param[in,out] *S points to an instance of the floating-point matrix structure.
simon 0:1014af42efd9 1571 * @param[in] nRows number of rows in the matrix.
simon 0:1014af42efd9 1572 * @param[in] nColumns number of columns in the matrix.
simon 0:1014af42efd9 1573 * @param[in] *pData points to the matrix data array.
simon 0:1014af42efd9 1574 * @return none
simon 0:1014af42efd9 1575 */
simon 0:1014af42efd9 1576
simon 0:1014af42efd9 1577 void arm_mat_init_q15(
simon 0:1014af42efd9 1578 arm_matrix_instance_q15 * S,
simon 0:1014af42efd9 1579 uint16_t nRows,
simon 0:1014af42efd9 1580 uint16_t nColumns,
simon 0:1014af42efd9 1581 q15_t *pData);
simon 0:1014af42efd9 1582
simon 0:1014af42efd9 1583 /**
simon 0:1014af42efd9 1584 * @brief Floating-point matrix initialization.
simon 0:1014af42efd9 1585 * @param[in,out] *S points to an instance of the floating-point matrix structure.
simon 0:1014af42efd9 1586 * @param[in] nRows number of rows in the matrix.
simon 0:1014af42efd9 1587 * @param[in] nColumns number of columns in the matrix.
simon 0:1014af42efd9 1588 * @param[in] *pData points to the matrix data array.
simon 0:1014af42efd9 1589 * @return none
simon 0:1014af42efd9 1590 */
simon 0:1014af42efd9 1591
simon 0:1014af42efd9 1592 void arm_mat_init_f32(
simon 0:1014af42efd9 1593 arm_matrix_instance_f32 * S,
simon 0:1014af42efd9 1594 uint16_t nRows,
simon 0:1014af42efd9 1595 uint16_t nColumns,
simon 0:1014af42efd9 1596 float32_t *pData);
simon 0:1014af42efd9 1597
simon 0:1014af42efd9 1598
simon 0:1014af42efd9 1599
simon 0:1014af42efd9 1600 /**
simon 0:1014af42efd9 1601 * @brief Instance structure for the Q15 PID Control.
simon 0:1014af42efd9 1602 */
simon 0:1014af42efd9 1603 typedef struct
simon 0:1014af42efd9 1604 {
simon 0:1014af42efd9 1605 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
simon 0:1014af42efd9 1606 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd. */
simon 0:1014af42efd9 1607 q15_t state[3]; /**< The state array of length 3. */
simon 0:1014af42efd9 1608 q15_t Kp; /**< The proportional gain. */
simon 0:1014af42efd9 1609 q15_t Ki; /**< The integral gain. */
simon 0:1014af42efd9 1610 q15_t Kd; /**< The derivative gain. */
simon 0:1014af42efd9 1611 } arm_pid_instance_q15;
simon 0:1014af42efd9 1612
simon 0:1014af42efd9 1613 /**
simon 0:1014af42efd9 1614 * @brief Instance structure for the Q31 PID Control.
simon 0:1014af42efd9 1615 */
simon 0:1014af42efd9 1616 typedef struct
simon 0:1014af42efd9 1617 {
simon 0:1014af42efd9 1618 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
simon 0:1014af42efd9 1619 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
simon 0:1014af42efd9 1620 q31_t A2; /**< The derived gain, A2 = Kd . */
simon 0:1014af42efd9 1621 q31_t state[3]; /**< The state array of length 3. */
simon 0:1014af42efd9 1622 q31_t Kp; /**< The proportional gain. */
simon 0:1014af42efd9 1623 q31_t Ki; /**< The integral gain. */
simon 0:1014af42efd9 1624 q31_t Kd; /**< The derivative gain. */
simon 0:1014af42efd9 1625
simon 0:1014af42efd9 1626 } arm_pid_instance_q31;
simon 0:1014af42efd9 1627
simon 0:1014af42efd9 1628 /**
simon 0:1014af42efd9 1629 * @brief Instance structure for the floating-point PID Control.
simon 0:1014af42efd9 1630 */
simon 0:1014af42efd9 1631 typedef struct
simon 0:1014af42efd9 1632 {
simon 0:1014af42efd9 1633 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
simon 0:1014af42efd9 1634 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
simon 0:1014af42efd9 1635 float32_t A2; /**< The derived gain, A2 = Kd . */
simon 0:1014af42efd9 1636 float32_t state[3]; /**< The state array of length 3. */
simon 0:1014af42efd9 1637 float32_t Kp; /**< The proportional gain. */
simon 0:1014af42efd9 1638 float32_t Ki; /**< The integral gain. */
simon 0:1014af42efd9 1639 float32_t Kd; /**< The derivative gain. */
simon 0:1014af42efd9 1640 } arm_pid_instance_f32;
simon 0:1014af42efd9 1641
simon 0:1014af42efd9 1642
simon 0:1014af42efd9 1643
simon 0:1014af42efd9 1644 /**
simon 0:1014af42efd9 1645 * @brief Initialization function for the floating-point PID Control.
simon 0:1014af42efd9 1646 * @param[in,out] *S points to an instance of the PID structure.
simon 0:1014af42efd9 1647 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
simon 0:1014af42efd9 1648 * @return none.
simon 0:1014af42efd9 1649 */
simon 0:1014af42efd9 1650 void arm_pid_init_f32(
simon 0:1014af42efd9 1651 arm_pid_instance_f32 * S,
simon 0:1014af42efd9 1652 int32_t resetStateFlag);
simon 0:1014af42efd9 1653
simon 0:1014af42efd9 1654 /**
simon 0:1014af42efd9 1655 * @brief Reset function for the floating-point PID Control.
simon 0:1014af42efd9 1656 * @param[in,out] *S is an instance of the floating-point PID Control structure
simon 0:1014af42efd9 1657 * @return none
simon 0:1014af42efd9 1658 */
simon 0:1014af42efd9 1659 void arm_pid_reset_f32(
simon 0:1014af42efd9 1660 arm_pid_instance_f32 * S);
simon 0:1014af42efd9 1661
simon 0:1014af42efd9 1662
simon 0:1014af42efd9 1663 /**
simon 0:1014af42efd9 1664 * @brief Initialization function for the Q31 PID Control.
simon 0:1014af42efd9 1665 * @param[in,out] *S points to an instance of the Q15 PID structure.
simon 0:1014af42efd9 1666 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
simon 0:1014af42efd9 1667 * @return none.
simon 0:1014af42efd9 1668 */
simon 0:1014af42efd9 1669 void arm_pid_init_q31(
simon 0:1014af42efd9 1670 arm_pid_instance_q31 * S,
simon 0:1014af42efd9 1671 int32_t resetStateFlag);
simon 0:1014af42efd9 1672
simon 0:1014af42efd9 1673
simon 0:1014af42efd9 1674 /**
simon 0:1014af42efd9 1675 * @brief Reset function for the Q31 PID Control.
simon 0:1014af42efd9 1676 * @param[in,out] *S points to an instance of the Q31 PID Control structure
simon 0:1014af42efd9 1677 * @return none
simon 0:1014af42efd9 1678 */
simon 0:1014af42efd9 1679
simon 0:1014af42efd9 1680 void arm_pid_reset_q31(
simon 0:1014af42efd9 1681 arm_pid_instance_q31 * S);
simon 0:1014af42efd9 1682
simon 0:1014af42efd9 1683 /**
simon 0:1014af42efd9 1684 * @brief Initialization function for the Q15 PID Control.
simon 0:1014af42efd9 1685 * @param[in,out] *S points to an instance of the Q15 PID structure.
simon 0:1014af42efd9 1686 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
simon 0:1014af42efd9 1687 * @return none.
simon 0:1014af42efd9 1688 */
simon 0:1014af42efd9 1689 void arm_pid_init_q15(
simon 0:1014af42efd9 1690 arm_pid_instance_q15 * S,
simon 0:1014af42efd9 1691 int32_t resetStateFlag);
simon 0:1014af42efd9 1692
simon 0:1014af42efd9 1693 /**
simon 0:1014af42efd9 1694 * @brief Reset function for the Q15 PID Control.
simon 0:1014af42efd9 1695 * @param[in,out] *S points to an instance of the q15 PID Control structure
simon 0:1014af42efd9 1696 * @return none
simon 0:1014af42efd9 1697 */
simon 0:1014af42efd9 1698 void arm_pid_reset_q15(
simon 0:1014af42efd9 1699 arm_pid_instance_q15 * S);
simon 0:1014af42efd9 1700
simon 0:1014af42efd9 1701
simon 0:1014af42efd9 1702 /**
simon 0:1014af42efd9 1703 * @brief Instance structure for the floating-point Linear Interpolate function.
simon 0:1014af42efd9 1704 */
simon 0:1014af42efd9 1705 typedef struct
simon 0:1014af42efd9 1706 {
simon 0:1014af42efd9 1707 uint32_t nValues;
simon 0:1014af42efd9 1708 float32_t x1;
simon 0:1014af42efd9 1709 float32_t xSpacing;
simon 0:1014af42efd9 1710 float32_t *pYData; /**< pointer to the table of Y values */
simon 0:1014af42efd9 1711 } arm_linear_interp_instance_f32;
simon 0:1014af42efd9 1712
simon 0:1014af42efd9 1713 /**
simon 0:1014af42efd9 1714 * @brief Instance structure for the floating-point bilinear interpolation function.
simon 0:1014af42efd9 1715 */
simon 0:1014af42efd9 1716
simon 0:1014af42efd9 1717 typedef struct
simon 0:1014af42efd9 1718 {
simon 0:1014af42efd9 1719 uint16_t numRows; /**< number of rows in the data table. */
simon 0:1014af42efd9 1720 uint16_t numCols; /**< number of columns in the data table. */
simon 0:1014af42efd9 1721 float32_t *pData; /**< points to the data table. */
simon 0:1014af42efd9 1722 } arm_bilinear_interp_instance_f32;
simon 0:1014af42efd9 1723
simon 0:1014af42efd9 1724 /**
simon 0:1014af42efd9 1725 * @brief Instance structure for the Q31 bilinear interpolation function.
simon 0:1014af42efd9 1726 */
simon 0:1014af42efd9 1727
simon 0:1014af42efd9 1728 typedef struct
simon 0:1014af42efd9 1729 {
simon 0:1014af42efd9 1730 uint16_t numRows; /**< number of rows in the data table. */
simon 0:1014af42efd9 1731 uint16_t numCols; /**< number of columns in the data table. */
simon 0:1014af42efd9 1732 q31_t *pData; /**< points to the data table. */
simon 0:1014af42efd9 1733 } arm_bilinear_interp_instance_q31;
simon 0:1014af42efd9 1734
simon 0:1014af42efd9 1735 /**
simon 0:1014af42efd9 1736 * @brief Instance structure for the Q15 bilinear interpolation function.
simon 0:1014af42efd9 1737 */
simon 0:1014af42efd9 1738
simon 0:1014af42efd9 1739 typedef struct
simon 0:1014af42efd9 1740 {
simon 0:1014af42efd9 1741 uint16_t numRows; /**< number of rows in the data table. */
simon 0:1014af42efd9 1742 uint16_t numCols; /**< number of columns in the data table. */
simon 0:1014af42efd9 1743 q15_t *pData; /**< points to the data table. */
simon 0:1014af42efd9 1744 } arm_bilinear_interp_instance_q15;
simon 0:1014af42efd9 1745
simon 0:1014af42efd9 1746 /**
simon 0:1014af42efd9 1747 * @brief Instance structure for the Q15 bilinear interpolation function.
simon 0:1014af42efd9 1748 */
simon 0:1014af42efd9 1749
simon 0:1014af42efd9 1750 typedef struct
simon 0:1014af42efd9 1751 {
simon 0:1014af42efd9 1752 uint16_t numRows; /**< number of rows in the data table. */
simon 0:1014af42efd9 1753 uint16_t numCols; /**< number of columns in the data table. */
simon 0:1014af42efd9 1754 q7_t *pData; /**< points to the data table. */
simon 0:1014af42efd9 1755 } arm_bilinear_interp_instance_q7;
simon 0:1014af42efd9 1756
simon 0:1014af42efd9 1757
simon 0:1014af42efd9 1758 /**
simon 0:1014af42efd9 1759 * @brief Q7 vector multiplication.
simon 0:1014af42efd9 1760 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 1761 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 1762 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 1763 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 1764 * @return none.
simon 0:1014af42efd9 1765 */
simon 0:1014af42efd9 1766
simon 0:1014af42efd9 1767 void arm_mult_q7(
simon 0:1014af42efd9 1768 q7_t * pSrcA,
simon 0:1014af42efd9 1769 q7_t * pSrcB,
simon 0:1014af42efd9 1770 q7_t * pDst,
simon 0:1014af42efd9 1771 uint32_t blockSize);
simon 0:1014af42efd9 1772
simon 0:1014af42efd9 1773 /**
simon 0:1014af42efd9 1774 * @brief Q15 vector multiplication.
simon 0:1014af42efd9 1775 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 1776 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 1777 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 1778 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 1779 * @return none.
simon 0:1014af42efd9 1780 */
simon 0:1014af42efd9 1781
simon 0:1014af42efd9 1782 void arm_mult_q15(
simon 0:1014af42efd9 1783 q15_t * pSrcA,
simon 0:1014af42efd9 1784 q15_t * pSrcB,
simon 0:1014af42efd9 1785 q15_t * pDst,
simon 0:1014af42efd9 1786 uint32_t blockSize);
simon 0:1014af42efd9 1787
simon 0:1014af42efd9 1788 /**
simon 0:1014af42efd9 1789 * @brief Q31 vector multiplication.
simon 0:1014af42efd9 1790 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 1791 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 1792 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 1793 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 1794 * @return none.
simon 0:1014af42efd9 1795 */
simon 0:1014af42efd9 1796
simon 0:1014af42efd9 1797 void arm_mult_q31(
simon 0:1014af42efd9 1798 q31_t * pSrcA,
simon 0:1014af42efd9 1799 q31_t * pSrcB,
simon 0:1014af42efd9 1800 q31_t * pDst,
simon 0:1014af42efd9 1801 uint32_t blockSize);
simon 0:1014af42efd9 1802
simon 0:1014af42efd9 1803 /**
simon 0:1014af42efd9 1804 * @brief Floating-point vector multiplication.
simon 0:1014af42efd9 1805 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 1806 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 1807 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 1808 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 1809 * @return none.
simon 0:1014af42efd9 1810 */
simon 0:1014af42efd9 1811
simon 0:1014af42efd9 1812 void arm_mult_f32(
simon 0:1014af42efd9 1813 float32_t * pSrcA,
simon 0:1014af42efd9 1814 float32_t * pSrcB,
simon 0:1014af42efd9 1815 float32_t * pDst,
simon 0:1014af42efd9 1816 uint32_t blockSize);
simon 0:1014af42efd9 1817
simon 0:1014af42efd9 1818
simon 0:1014af42efd9 1819 /**
simon 0:1014af42efd9 1820 * @brief Instance structure for the Q15 CFFT/CIFFT function.
simon 0:1014af42efd9 1821 */
simon 0:1014af42efd9 1822
simon 0:1014af42efd9 1823 typedef struct
simon 0:1014af42efd9 1824 {
simon 0:1014af42efd9 1825 uint16_t fftLen; /**< length of the FFT. */
simon 0:1014af42efd9 1826 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
simon 0:1014af42efd9 1827 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
simon 0:1014af42efd9 1828 q15_t *pTwiddle; /**< points to the twiddle factor table. */
simon 0:1014af42efd9 1829 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
simon 0:1014af42efd9 1830 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
simon 0:1014af42efd9 1831 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
simon 0:1014af42efd9 1832 } arm_cfft_radix4_instance_q15;
simon 0:1014af42efd9 1833
simon 0:1014af42efd9 1834 /**
simon 0:1014af42efd9 1835 * @brief Instance structure for the Q31 CFFT/CIFFT function.
simon 0:1014af42efd9 1836 */
simon 0:1014af42efd9 1837
simon 0:1014af42efd9 1838 typedef struct
simon 0:1014af42efd9 1839 {
simon 0:1014af42efd9 1840 uint16_t fftLen; /**< length of the FFT. */
simon 0:1014af42efd9 1841 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
simon 0:1014af42efd9 1842 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
simon 0:1014af42efd9 1843 q31_t *pTwiddle; /**< points to the twiddle factor table. */
simon 0:1014af42efd9 1844 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
simon 0:1014af42efd9 1845 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
simon 0:1014af42efd9 1846 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
simon 0:1014af42efd9 1847 } arm_cfft_radix4_instance_q31;
simon 0:1014af42efd9 1848
simon 0:1014af42efd9 1849 /**
simon 0:1014af42efd9 1850 * @brief Instance structure for the floating-point CFFT/CIFFT function.
simon 0:1014af42efd9 1851 */
simon 0:1014af42efd9 1852
simon 0:1014af42efd9 1853 typedef struct
simon 0:1014af42efd9 1854 {
simon 0:1014af42efd9 1855 uint16_t fftLen; /**< length of the FFT. */
simon 0:1014af42efd9 1856 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
simon 0:1014af42efd9 1857 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
simon 0:1014af42efd9 1858 float32_t *pTwiddle; /**< points to the twiddle factor table. */
simon 0:1014af42efd9 1859 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
simon 0:1014af42efd9 1860 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
simon 0:1014af42efd9 1861 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
simon 0:1014af42efd9 1862 float32_t onebyfftLen; /**< value of 1/fftLen. */
simon 0:1014af42efd9 1863 } arm_cfft_radix4_instance_f32;
simon 0:1014af42efd9 1864
simon 0:1014af42efd9 1865 /**
simon 0:1014af42efd9 1866 * @brief Processing function for the Q15 CFFT/CIFFT.
simon 0:1014af42efd9 1867 * @param[in] *S points to an instance of the Q15 CFFT/CIFFT structure.
simon 0:1014af42efd9 1868 * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
simon 0:1014af42efd9 1869 * @return none.
simon 0:1014af42efd9 1870 */
simon 0:1014af42efd9 1871
simon 0:1014af42efd9 1872 void arm_cfft_radix4_q15(
simon 0:1014af42efd9 1873 const arm_cfft_radix4_instance_q15 * S,
simon 0:1014af42efd9 1874 q15_t * pSrc);
simon 0:1014af42efd9 1875
simon 0:1014af42efd9 1876 /**
simon 0:1014af42efd9 1877 * @brief Initialization function for the Q15 CFFT/CIFFT.
simon 0:1014af42efd9 1878 * @param[in,out] *S points to an instance of the Q15 CFFT/CIFFT structure.
simon 0:1014af42efd9 1879 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 1880 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
simon 0:1014af42efd9 1881 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
simon 0:1014af42efd9 1882 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
simon 0:1014af42efd9 1883 */
simon 0:1014af42efd9 1884
simon 0:1014af42efd9 1885 arm_status arm_cfft_radix4_init_q15(
simon 0:1014af42efd9 1886 arm_cfft_radix4_instance_q15 * S,
simon 0:1014af42efd9 1887 uint16_t fftLen,
simon 0:1014af42efd9 1888 uint8_t ifftFlag,
simon 0:1014af42efd9 1889 uint8_t bitReverseFlag);
simon 0:1014af42efd9 1890
simon 0:1014af42efd9 1891 /**
simon 0:1014af42efd9 1892 * @brief Processing function for the Q31 CFFT/CIFFT.
simon 0:1014af42efd9 1893 * @param[in] *S points to an instance of the Q31 CFFT/CIFFT structure.
simon 0:1014af42efd9 1894 * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
simon 0:1014af42efd9 1895 * @return none.
simon 0:1014af42efd9 1896 */
simon 0:1014af42efd9 1897
simon 0:1014af42efd9 1898 void arm_cfft_radix4_q31(
simon 0:1014af42efd9 1899 const arm_cfft_radix4_instance_q31 * S,
simon 0:1014af42efd9 1900 q31_t * pSrc);
simon 0:1014af42efd9 1901
simon 0:1014af42efd9 1902 /**
simon 0:1014af42efd9 1903 * @brief Initialization function for the Q31 CFFT/CIFFT.
simon 0:1014af42efd9 1904 * @param[in,out] *S points to an instance of the Q31 CFFT/CIFFT structure.
simon 0:1014af42efd9 1905 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 1906 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
simon 0:1014af42efd9 1907 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
simon 0:1014af42efd9 1908 * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
simon 0:1014af42efd9 1909 */
simon 0:1014af42efd9 1910
simon 0:1014af42efd9 1911 arm_status arm_cfft_radix4_init_q31(
simon 0:1014af42efd9 1912 arm_cfft_radix4_instance_q31 * S,
simon 0:1014af42efd9 1913 uint16_t fftLen,
simon 0:1014af42efd9 1914 uint8_t ifftFlag,
simon 0:1014af42efd9 1915 uint8_t bitReverseFlag);
simon 0:1014af42efd9 1916
simon 0:1014af42efd9 1917 /**
simon 0:1014af42efd9 1918 * @brief Processing function for the floating-point CFFT/CIFFT.
simon 0:1014af42efd9 1919 * @param[in] *S points to an instance of the floating-point CFFT/CIFFT structure.
simon 0:1014af42efd9 1920 * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
simon 0:1014af42efd9 1921 * @return none.
simon 0:1014af42efd9 1922 */
simon 0:1014af42efd9 1923
simon 0:1014af42efd9 1924 void arm_cfft_radix4_f32(
simon 0:1014af42efd9 1925 const arm_cfft_radix4_instance_f32 * S,
simon 0:1014af42efd9 1926 float32_t * pSrc);
simon 0:1014af42efd9 1927
simon 0:1014af42efd9 1928 /**
simon 0:1014af42efd9 1929 * @brief Initialization function for the floating-point CFFT/CIFFT.
simon 0:1014af42efd9 1930 * @param[in,out] *S points to an instance of the floating-point CFFT/CIFFT structure.
simon 0:1014af42efd9 1931 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 1932 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
simon 0:1014af42efd9 1933 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
simon 0:1014af42efd9 1934 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
simon 0:1014af42efd9 1935 */
simon 0:1014af42efd9 1936
simon 0:1014af42efd9 1937 arm_status arm_cfft_radix4_init_f32(
simon 0:1014af42efd9 1938 arm_cfft_radix4_instance_f32 * S,
simon 0:1014af42efd9 1939 uint16_t fftLen,
simon 0:1014af42efd9 1940 uint8_t ifftFlag,
simon 0:1014af42efd9 1941 uint8_t bitReverseFlag);
simon 0:1014af42efd9 1942
simon 0:1014af42efd9 1943
simon 0:1014af42efd9 1944
simon 0:1014af42efd9 1945 /*----------------------------------------------------------------------
simon 0:1014af42efd9 1946 * Internal functions prototypes FFT function
simon 0:1014af42efd9 1947 ----------------------------------------------------------------------*/
simon 0:1014af42efd9 1948
simon 0:1014af42efd9 1949 /**
simon 0:1014af42efd9 1950 * @brief Core function for the floating-point CFFT butterfly process.
simon 0:1014af42efd9 1951 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
simon 0:1014af42efd9 1952 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 1953 * @param[in] *pCoef points to the twiddle coefficient buffer.
simon 0:1014af42efd9 1954 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
simon 0:1014af42efd9 1955 * @return none.
simon 0:1014af42efd9 1956 */
simon 0:1014af42efd9 1957
simon 0:1014af42efd9 1958 void arm_radix4_butterfly_f32(
simon 0:1014af42efd9 1959 float32_t * pSrc,
simon 0:1014af42efd9 1960 uint16_t fftLen,
simon 0:1014af42efd9 1961 float32_t * pCoef,
simon 0:1014af42efd9 1962 uint16_t twidCoefModifier);
simon 0:1014af42efd9 1963
simon 0:1014af42efd9 1964 /**
simon 0:1014af42efd9 1965 * @brief Core function for the floating-point CIFFT butterfly process.
simon 0:1014af42efd9 1966 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
simon 0:1014af42efd9 1967 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 1968 * @param[in] *pCoef points to twiddle coefficient buffer.
simon 0:1014af42efd9 1969 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
simon 0:1014af42efd9 1970 * @param[in] onebyfftLen value of 1/fftLen.
simon 0:1014af42efd9 1971 * @return none.
simon 0:1014af42efd9 1972 */
simon 0:1014af42efd9 1973
simon 0:1014af42efd9 1974 void arm_radix4_butterfly_inverse_f32(
simon 0:1014af42efd9 1975 float32_t * pSrc,
simon 0:1014af42efd9 1976 uint16_t fftLen,
simon 0:1014af42efd9 1977 float32_t * pCoef,
simon 0:1014af42efd9 1978 uint16_t twidCoefModifier,
simon 0:1014af42efd9 1979 float32_t onebyfftLen);
simon 0:1014af42efd9 1980
simon 0:1014af42efd9 1981 /**
simon 0:1014af42efd9 1982 * @brief In-place bit reversal function.
simon 0:1014af42efd9 1983 * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
simon 0:1014af42efd9 1984 * @param[in] fftSize length of the FFT.
simon 0:1014af42efd9 1985 * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table.
simon 0:1014af42efd9 1986 * @param[in] *pBitRevTab points to the bit reversal table.
simon 0:1014af42efd9 1987 * @return none.
simon 0:1014af42efd9 1988 */
simon 0:1014af42efd9 1989
simon 0:1014af42efd9 1990 void arm_bitreversal_f32(
simon 0:1014af42efd9 1991 float32_t *pSrc,
simon 0:1014af42efd9 1992 uint16_t fftSize,
simon 0:1014af42efd9 1993 uint16_t bitRevFactor,
simon 0:1014af42efd9 1994 uint16_t *pBitRevTab);
simon 0:1014af42efd9 1995
simon 0:1014af42efd9 1996 /**
simon 0:1014af42efd9 1997 * @brief Core function for the Q31 CFFT butterfly process.
simon 0:1014af42efd9 1998 * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
simon 0:1014af42efd9 1999 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 2000 * @param[in] *pCoef points to twiddle coefficient buffer.
simon 0:1014af42efd9 2001 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
simon 0:1014af42efd9 2002 * @return none.
simon 0:1014af42efd9 2003 */
simon 0:1014af42efd9 2004
simon 0:1014af42efd9 2005 void arm_radix4_butterfly_q31(
simon 0:1014af42efd9 2006 q31_t *pSrc,
simon 0:1014af42efd9 2007 uint32_t fftLen,
simon 0:1014af42efd9 2008 q31_t *pCoef,
simon 0:1014af42efd9 2009 uint32_t twidCoefModifier);
simon 0:1014af42efd9 2010
simon 0:1014af42efd9 2011 /**
simon 0:1014af42efd9 2012 * @brief Core function for the Q31 CIFFT butterfly process.
simon 0:1014af42efd9 2013 * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
simon 0:1014af42efd9 2014 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 2015 * @param[in] *pCoef points to twiddle coefficient buffer.
simon 0:1014af42efd9 2016 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
simon 0:1014af42efd9 2017 * @return none.
simon 0:1014af42efd9 2018 */
simon 0:1014af42efd9 2019
simon 0:1014af42efd9 2020 void arm_radix4_butterfly_inverse_q31(
simon 0:1014af42efd9 2021 q31_t * pSrc,
simon 0:1014af42efd9 2022 uint32_t fftLen,
simon 0:1014af42efd9 2023 q31_t * pCoef,
simon 0:1014af42efd9 2024 uint32_t twidCoefModifier);
simon 0:1014af42efd9 2025
simon 0:1014af42efd9 2026 /**
simon 0:1014af42efd9 2027 * @brief In-place bit reversal function.
simon 0:1014af42efd9 2028 * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
simon 0:1014af42efd9 2029 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 2030 * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
simon 0:1014af42efd9 2031 * @param[in] *pBitRevTab points to bit reversal table.
simon 0:1014af42efd9 2032 * @return none.
simon 0:1014af42efd9 2033 */
simon 0:1014af42efd9 2034
simon 0:1014af42efd9 2035 void arm_bitreversal_q31(
simon 0:1014af42efd9 2036 q31_t * pSrc,
simon 0:1014af42efd9 2037 uint32_t fftLen,
simon 0:1014af42efd9 2038 uint16_t bitRevFactor,
simon 0:1014af42efd9 2039 uint16_t *pBitRevTab);
simon 0:1014af42efd9 2040
simon 0:1014af42efd9 2041 /**
simon 0:1014af42efd9 2042 * @brief Core function for the Q15 CFFT butterfly process.
simon 0:1014af42efd9 2043 * @param[in, out] *pSrc16 points to the in-place buffer of Q15 data type.
simon 0:1014af42efd9 2044 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 2045 * @param[in] *pCoef16 points to twiddle coefficient buffer.
simon 0:1014af42efd9 2046 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
simon 0:1014af42efd9 2047 * @return none.
simon 0:1014af42efd9 2048 */
simon 0:1014af42efd9 2049
simon 0:1014af42efd9 2050 void arm_radix4_butterfly_q15(
simon 0:1014af42efd9 2051 q15_t *pSrc16,
simon 0:1014af42efd9 2052 uint32_t fftLen,
simon 0:1014af42efd9 2053 q15_t *pCoef16,
simon 0:1014af42efd9 2054 uint32_t twidCoefModifier);
simon 0:1014af42efd9 2055
simon 0:1014af42efd9 2056 /**
simon 0:1014af42efd9 2057 * @brief Core function for the Q15 CIFFT butterfly process.
simon 0:1014af42efd9 2058 * @param[in, out] *pSrc16 points to the in-place buffer of Q15 data type.
simon 0:1014af42efd9 2059 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 2060 * @param[in] *pCoef16 points to twiddle coefficient buffer.
simon 0:1014af42efd9 2061 * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
simon 0:1014af42efd9 2062 * @return none.
simon 0:1014af42efd9 2063 */
simon 0:1014af42efd9 2064
simon 0:1014af42efd9 2065 void arm_radix4_butterfly_inverse_q15(
simon 0:1014af42efd9 2066 q15_t *pSrc16,
simon 0:1014af42efd9 2067 uint32_t fftLen,
simon 0:1014af42efd9 2068 q15_t *pCoef16,
simon 0:1014af42efd9 2069 uint32_t twidCoefModifier);
simon 0:1014af42efd9 2070
simon 0:1014af42efd9 2071 /**
simon 0:1014af42efd9 2072 * @brief In-place bit reversal function.
simon 0:1014af42efd9 2073 * @param[in, out] *pSrc points to the in-place buffer of Q15 data type.
simon 0:1014af42efd9 2074 * @param[in] fftLen length of the FFT.
simon 0:1014af42efd9 2075 * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
simon 0:1014af42efd9 2076 * @param[in] *pBitRevTab points to bit reversal table.
simon 0:1014af42efd9 2077 * @return none.
simon 0:1014af42efd9 2078 */
simon 0:1014af42efd9 2079
simon 0:1014af42efd9 2080 void arm_bitreversal_q15(
simon 0:1014af42efd9 2081 q15_t * pSrc,
simon 0:1014af42efd9 2082 uint32_t fftLen,
simon 0:1014af42efd9 2083 uint16_t bitRevFactor,
simon 0:1014af42efd9 2084 uint16_t *pBitRevTab);
simon 0:1014af42efd9 2085
simon 0:1014af42efd9 2086 /**
simon 0:1014af42efd9 2087 * @brief Instance structure for the Q15 RFFT/RIFFT function.
simon 0:1014af42efd9 2088 */
simon 0:1014af42efd9 2089
simon 0:1014af42efd9 2090 typedef struct
simon 0:1014af42efd9 2091 {
simon 0:1014af42efd9 2092 uint32_t fftLenReal; /**< length of the real FFT. */
simon 0:1014af42efd9 2093 uint32_t fftLenBy2; /**< length of the complex FFT. */
simon 0:1014af42efd9 2094 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
simon 0:1014af42efd9 2095 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
simon 0:1014af42efd9 2096 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
simon 0:1014af42efd9 2097 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
simon 0:1014af42efd9 2098 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
simon 0:1014af42efd9 2099 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
simon 0:1014af42efd9 2100 } arm_rfft_instance_q15;
simon 0:1014af42efd9 2101
simon 0:1014af42efd9 2102 /**
simon 0:1014af42efd9 2103 * @brief Instance structure for the Q31 RFFT/RIFFT function.
simon 0:1014af42efd9 2104 */
simon 0:1014af42efd9 2105
simon 0:1014af42efd9 2106 typedef struct
simon 0:1014af42efd9 2107 {
simon 0:1014af42efd9 2108 uint32_t fftLenReal; /**< length of the real FFT. */
simon 0:1014af42efd9 2109 uint32_t fftLenBy2; /**< length of the complex FFT. */
simon 0:1014af42efd9 2110 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
simon 0:1014af42efd9 2111 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
simon 0:1014af42efd9 2112 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
simon 0:1014af42efd9 2113 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
simon 0:1014af42efd9 2114 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
simon 0:1014af42efd9 2115 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
simon 0:1014af42efd9 2116 } arm_rfft_instance_q31;
simon 0:1014af42efd9 2117
simon 0:1014af42efd9 2118 /**
simon 0:1014af42efd9 2119 * @brief Instance structure for the floating-point RFFT/RIFFT function.
simon 0:1014af42efd9 2120 */
simon 0:1014af42efd9 2121
simon 0:1014af42efd9 2122 typedef struct
simon 0:1014af42efd9 2123 {
simon 0:1014af42efd9 2124 uint32_t fftLenReal; /**< length of the real FFT. */
simon 0:1014af42efd9 2125 uint16_t fftLenBy2; /**< length of the complex FFT. */
simon 0:1014af42efd9 2126 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
simon 0:1014af42efd9 2127 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
simon 0:1014af42efd9 2128 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
simon 0:1014af42efd9 2129 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
simon 0:1014af42efd9 2130 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
simon 0:1014af42efd9 2131 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
simon 0:1014af42efd9 2132 } arm_rfft_instance_f32;
simon 0:1014af42efd9 2133
simon 0:1014af42efd9 2134 /**
simon 0:1014af42efd9 2135 * @brief Processing function for the Q15 RFFT/RIFFT.
simon 0:1014af42efd9 2136 * @param[in] *S points to an instance of the Q15 RFFT/RIFFT structure.
simon 0:1014af42efd9 2137 * @param[in] *pSrc points to the input buffer.
simon 0:1014af42efd9 2138 * @param[out] *pDst points to the output buffer.
simon 0:1014af42efd9 2139 * @return none.
simon 0:1014af42efd9 2140 */
nprobably 3:ad02f4ea1fbe 2141 #ifdef 0
simon 0:1014af42efd9 2142 void arm_rfft_q15(
simon 0:1014af42efd9 2143 const arm_rfft_instance_q15 * S,
simon 0:1014af42efd9 2144 q15_t * pSrc,
simon 0:1014af42efd9 2145 q15_t * pDst);
simon 0:1014af42efd9 2146
simon 0:1014af42efd9 2147 /**
simon 0:1014af42efd9 2148 * @brief Initialization function for the Q15 RFFT/RIFFT.
simon 0:1014af42efd9 2149 * @param[in, out] *S points to an instance of the Q15 RFFT/RIFFT structure.
simon 0:1014af42efd9 2150 * @param[in] *S_CFFT points to an instance of the Q15 CFFT/CIFFT structure.
simon 0:1014af42efd9 2151 * @param[in] fftLenReal length of the FFT.
simon 0:1014af42efd9 2152 * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
simon 0:1014af42efd9 2153 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
simon 0:1014af42efd9 2154 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported value.
simon 0:1014af42efd9 2155 */
nprobably 3:ad02f4ea1fbe 2156 #endif
simon 0:1014af42efd9 2157 arm_status arm_rfft_init_q15(
simon 0:1014af42efd9 2158 arm_rfft_instance_q15 * S,
simon 0:1014af42efd9 2159 arm_cfft_radix4_instance_q15 * S_CFFT,
simon 0:1014af42efd9 2160 uint32_t fftLenReal,
simon 0:1014af42efd9 2161 uint32_t ifftFlagR,
simon 0:1014af42efd9 2162 uint32_t bitReverseFlag);
simon 0:1014af42efd9 2163
simon 0:1014af42efd9 2164 /**
simon 0:1014af42efd9 2165 * @brief Processing function for the Q31 RFFT/RIFFT.
simon 0:1014af42efd9 2166 * @param[in] *S points to an instance of the Q31 RFFT/RIFFT structure.
simon 0:1014af42efd9 2167 * @param[in] *pSrc points to the input buffer.
simon 0:1014af42efd9 2168 * @param[out] *pDst points to the output buffer.
simon 0:1014af42efd9 2169 * @return none.
simon 0:1014af42efd9 2170 */
nprobably 3:ad02f4ea1fbe 2171 #ifdef 0
simon 0:1014af42efd9 2172 void arm_rfft_q31(
simon 0:1014af42efd9 2173 const arm_rfft_instance_q31 * S,
simon 0:1014af42efd9 2174 q31_t * pSrc,
simon 0:1014af42efd9 2175 q31_t * pDst);
nprobably 3:ad02f4ea1fbe 2176 #endif
simon 0:1014af42efd9 2177 /**
simon 0:1014af42efd9 2178 * @brief Initialization function for the Q31 RFFT/RIFFT.
simon 0:1014af42efd9 2179 * @param[in, out] *S points to an instance of the Q31 RFFT/RIFFT structure.
simon 0:1014af42efd9 2180 * @param[in, out] *S_CFFT points to an instance of the Q31 CFFT/CIFFT structure.
simon 0:1014af42efd9 2181 * @param[in] fftLenReal length of the FFT.
simon 0:1014af42efd9 2182 * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
simon 0:1014af42efd9 2183 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
simon 0:1014af42efd9 2184 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported value.
simon 0:1014af42efd9 2185 */
simon 0:1014af42efd9 2186
simon 0:1014af42efd9 2187 arm_status arm_rfft_init_q31(
simon 0:1014af42efd9 2188 arm_rfft_instance_q31 * S,
simon 0:1014af42efd9 2189 arm_cfft_radix4_instance_q31 * S_CFFT,
simon 0:1014af42efd9 2190 uint32_t fftLenReal,
simon 0:1014af42efd9 2191 uint32_t ifftFlagR,
simon 0:1014af42efd9 2192 uint32_t bitReverseFlag);
simon 0:1014af42efd9 2193
simon 0:1014af42efd9 2194 /**
simon 0:1014af42efd9 2195 * @brief Initialization function for the floating-point RFFT/RIFFT.
simon 0:1014af42efd9 2196 * @param[in,out] *S points to an instance of the floating-point RFFT/RIFFT structure.
simon 0:1014af42efd9 2197 * @param[in,out] *S_CFFT points to an instance of the floating-point CFFT/CIFFT structure.
simon 0:1014af42efd9 2198 * @param[in] fftLenReal length of the FFT.
simon 0:1014af42efd9 2199 * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
simon 0:1014af42efd9 2200 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
simon 0:1014af42efd9 2201 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported value.
simon 0:1014af42efd9 2202 */
simon 0:1014af42efd9 2203
simon 0:1014af42efd9 2204 arm_status arm_rfft_init_f32(
simon 0:1014af42efd9 2205 arm_rfft_instance_f32 * S,
simon 0:1014af42efd9 2206 arm_cfft_radix4_instance_f32 * S_CFFT,
simon 0:1014af42efd9 2207 uint32_t fftLenReal,
simon 0:1014af42efd9 2208 uint32_t ifftFlagR,
simon 0:1014af42efd9 2209 uint32_t bitReverseFlag);
simon 0:1014af42efd9 2210
simon 0:1014af42efd9 2211 /**
simon 0:1014af42efd9 2212 * @brief Processing function for the floating-point RFFT/RIFFT.
simon 0:1014af42efd9 2213 * @param[in] *S points to an instance of the floating-point RFFT/RIFFT structure.
simon 0:1014af42efd9 2214 * @param[in] *pSrc points to the input buffer.
simon 0:1014af42efd9 2215 * @param[out] *pDst points to the output buffer.
simon 0:1014af42efd9 2216 * @return none.
simon 0:1014af42efd9 2217 */
simon 0:1014af42efd9 2218
simon 0:1014af42efd9 2219 void arm_rfft_f32(
simon 0:1014af42efd9 2220 const arm_rfft_instance_f32 * S,
simon 0:1014af42efd9 2221 float32_t * pSrc,
simon 0:1014af42efd9 2222 float32_t * pDst);
simon 0:1014af42efd9 2223
simon 0:1014af42efd9 2224 /**
simon 0:1014af42efd9 2225 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
simon 0:1014af42efd9 2226 */
simon 0:1014af42efd9 2227
simon 0:1014af42efd9 2228 typedef struct
simon 0:1014af42efd9 2229 {
simon 0:1014af42efd9 2230 uint16_t N; /**< length of the DCT4. */
simon 0:1014af42efd9 2231 uint16_t Nby2; /**< half of the length of the DCT4. */
simon 0:1014af42efd9 2232 float32_t normalize; /**< normalizing factor. */
simon 0:1014af42efd9 2233 float32_t *pTwiddle; /**< points to the twiddle factor table. */
simon 0:1014af42efd9 2234 float32_t *pCosFactor; /**< points to the cosFactor table. */
simon 0:1014af42efd9 2235 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
simon 0:1014af42efd9 2236 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
simon 0:1014af42efd9 2237 } arm_dct4_instance_f32;
simon 0:1014af42efd9 2238
simon 0:1014af42efd9 2239 /**
simon 0:1014af42efd9 2240 * @brief Initialization function for the floating-point DCT4/IDCT4.
simon 0:1014af42efd9 2241 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
simon 0:1014af42efd9 2242 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
simon 0:1014af42efd9 2243 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
simon 0:1014af42efd9 2244 * @param[in] N length of the DCT4.
simon 0:1014af42efd9 2245 * @param[in] Nby2 half of the length of the DCT4.
simon 0:1014af42efd9 2246 * @param[in] normalize normalizing factor.
simon 0:1014af42efd9 2247 * @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.
simon 0:1014af42efd9 2248 */
simon 0:1014af42efd9 2249
simon 0:1014af42efd9 2250 arm_status arm_dct4_init_f32(
simon 0:1014af42efd9 2251 arm_dct4_instance_f32 * S,
simon 0:1014af42efd9 2252 arm_rfft_instance_f32 * S_RFFT,
simon 0:1014af42efd9 2253 arm_cfft_radix4_instance_f32 * S_CFFT,
simon 0:1014af42efd9 2254 uint16_t N,
simon 0:1014af42efd9 2255 uint16_t Nby2,
simon 0:1014af42efd9 2256 float32_t normalize);
simon 0:1014af42efd9 2257
simon 0:1014af42efd9 2258 /**
simon 0:1014af42efd9 2259 * @brief Processing function for the floating-point DCT4/IDCT4.
simon 0:1014af42efd9 2260 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
simon 0:1014af42efd9 2261 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 2262 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
simon 0:1014af42efd9 2263 * @return none.
simon 0:1014af42efd9 2264 */
simon 0:1014af42efd9 2265
simon 0:1014af42efd9 2266 void arm_dct4_f32(
simon 0:1014af42efd9 2267 const arm_dct4_instance_f32 * S,
simon 0:1014af42efd9 2268 float32_t * pState,
simon 0:1014af42efd9 2269 float32_t * pInlineBuffer);
simon 0:1014af42efd9 2270
simon 0:1014af42efd9 2271 /**
simon 0:1014af42efd9 2272 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
simon 0:1014af42efd9 2273 */
simon 0:1014af42efd9 2274
simon 0:1014af42efd9 2275 typedef struct
simon 0:1014af42efd9 2276 {
simon 0:1014af42efd9 2277 uint16_t N; /**< length of the DCT4. */
simon 0:1014af42efd9 2278 uint16_t Nby2; /**< half of the length of the DCT4. */
simon 0:1014af42efd9 2279 q31_t normalize; /**< normalizing factor. */
simon 0:1014af42efd9 2280 q31_t *pTwiddle; /**< points to the twiddle factor table. */
simon 0:1014af42efd9 2281 q31_t *pCosFactor; /**< points to the cosFactor table. */
simon 0:1014af42efd9 2282 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
simon 0:1014af42efd9 2283 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
simon 0:1014af42efd9 2284 } arm_dct4_instance_q31;
simon 0:1014af42efd9 2285
simon 0:1014af42efd9 2286 /**
simon 0:1014af42efd9 2287 * @brief Initialization function for the Q31 DCT4/IDCT4.
simon 0:1014af42efd9 2288 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
simon 0:1014af42efd9 2289 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
simon 0:1014af42efd9 2290 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
simon 0:1014af42efd9 2291 * @param[in] N length of the DCT4.
simon 0:1014af42efd9 2292 * @param[in] Nby2 half of the length of the DCT4.
simon 0:1014af42efd9 2293 * @param[in] normalize normalizing factor.
simon 0:1014af42efd9 2294 * @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.
simon 0:1014af42efd9 2295 */
simon 0:1014af42efd9 2296
simon 0:1014af42efd9 2297 arm_status arm_dct4_init_q31(
simon 0:1014af42efd9 2298 arm_dct4_instance_q31 * S,
simon 0:1014af42efd9 2299 arm_rfft_instance_q31 * S_RFFT,
simon 0:1014af42efd9 2300 arm_cfft_radix4_instance_q31 * S_CFFT,
simon 0:1014af42efd9 2301 uint16_t N,
simon 0:1014af42efd9 2302 uint16_t Nby2,
simon 0:1014af42efd9 2303 q31_t normalize);
simon 0:1014af42efd9 2304
simon 0:1014af42efd9 2305 /**
simon 0:1014af42efd9 2306 * @brief Processing function for the Q31 DCT4/IDCT4.
simon 0:1014af42efd9 2307 * @param[in] *S points to an instance of the Q31 DCT4 structure.
simon 0:1014af42efd9 2308 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 2309 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
simon 0:1014af42efd9 2310 * @return none.
simon 0:1014af42efd9 2311 */
simon 0:1014af42efd9 2312
simon 0:1014af42efd9 2313 void arm_dct4_q31(
simon 0:1014af42efd9 2314 const arm_dct4_instance_q31 * S,
simon 0:1014af42efd9 2315 q31_t * pState,
simon 0:1014af42efd9 2316 q31_t * pInlineBuffer);
simon 0:1014af42efd9 2317
simon 0:1014af42efd9 2318 /**
simon 0:1014af42efd9 2319 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
simon 0:1014af42efd9 2320 */
simon 0:1014af42efd9 2321
simon 0:1014af42efd9 2322 typedef struct
simon 0:1014af42efd9 2323 {
simon 0:1014af42efd9 2324 uint16_t N; /**< length of the DCT4. */
simon 0:1014af42efd9 2325 uint16_t Nby2; /**< half of the length of the DCT4. */
simon 0:1014af42efd9 2326 q15_t normalize; /**< normalizing factor. */
simon 0:1014af42efd9 2327 q15_t *pTwiddle; /**< points to the twiddle factor table. */
simon 0:1014af42efd9 2328 q15_t *pCosFactor; /**< points to the cosFactor table. */
simon 0:1014af42efd9 2329 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
simon 0:1014af42efd9 2330 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
simon 0:1014af42efd9 2331 } arm_dct4_instance_q15;
simon 0:1014af42efd9 2332
simon 0:1014af42efd9 2333 /**
simon 0:1014af42efd9 2334 * @brief Initialization function for the Q15 DCT4/IDCT4.
simon 0:1014af42efd9 2335 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
simon 0:1014af42efd9 2336 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
simon 0:1014af42efd9 2337 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
simon 0:1014af42efd9 2338 * @param[in] N length of the DCT4.
simon 0:1014af42efd9 2339 * @param[in] Nby2 half of the length of the DCT4.
simon 0:1014af42efd9 2340 * @param[in] normalize normalizing factor.
simon 0:1014af42efd9 2341 * @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.
simon 0:1014af42efd9 2342 */
simon 0:1014af42efd9 2343
simon 0:1014af42efd9 2344 arm_status arm_dct4_init_q15(
simon 0:1014af42efd9 2345 arm_dct4_instance_q15 * S,
simon 0:1014af42efd9 2346 arm_rfft_instance_q15 * S_RFFT,
simon 0:1014af42efd9 2347 arm_cfft_radix4_instance_q15 * S_CFFT,
simon 0:1014af42efd9 2348 uint16_t N,
simon 0:1014af42efd9 2349 uint16_t Nby2,
simon 0:1014af42efd9 2350 q15_t normalize);
simon 0:1014af42efd9 2351
simon 0:1014af42efd9 2352 /**
simon 0:1014af42efd9 2353 * @brief Processing function for the Q15 DCT4/IDCT4.
simon 0:1014af42efd9 2354 * @param[in] *S points to an instance of the Q15 DCT4 structure.
simon 0:1014af42efd9 2355 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 2356 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
simon 0:1014af42efd9 2357 * @return none.
simon 0:1014af42efd9 2358 */
simon 0:1014af42efd9 2359
simon 0:1014af42efd9 2360 void arm_dct4_q15(
simon 0:1014af42efd9 2361 const arm_dct4_instance_q15 * S,
simon 0:1014af42efd9 2362 q15_t * pState,
simon 0:1014af42efd9 2363 q15_t * pInlineBuffer);
simon 0:1014af42efd9 2364
simon 0:1014af42efd9 2365 /**
simon 0:1014af42efd9 2366 * @brief Floating-point vector addition.
simon 0:1014af42efd9 2367 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2368 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2369 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2370 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2371 * @return none.
simon 0:1014af42efd9 2372 */
simon 0:1014af42efd9 2373
simon 0:1014af42efd9 2374 void arm_add_f32(
simon 0:1014af42efd9 2375 float32_t * pSrcA,
simon 0:1014af42efd9 2376 float32_t * pSrcB,
simon 0:1014af42efd9 2377 float32_t * pDst,
simon 0:1014af42efd9 2378 uint32_t blockSize);
simon 0:1014af42efd9 2379
simon 0:1014af42efd9 2380 /**
simon 0:1014af42efd9 2381 * @brief Q7 vector addition.
simon 0:1014af42efd9 2382 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2383 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2384 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2385 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2386 * @return none.
simon 0:1014af42efd9 2387 */
simon 0:1014af42efd9 2388
simon 0:1014af42efd9 2389 void arm_add_q7(
simon 0:1014af42efd9 2390 q7_t * pSrcA,
simon 0:1014af42efd9 2391 q7_t * pSrcB,
simon 0:1014af42efd9 2392 q7_t * pDst,
simon 0:1014af42efd9 2393 uint32_t blockSize);
simon 0:1014af42efd9 2394
simon 0:1014af42efd9 2395 /**
simon 0:1014af42efd9 2396 * @brief Q15 vector addition.
simon 0:1014af42efd9 2397 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2398 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2399 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2400 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2401 * @return none.
simon 0:1014af42efd9 2402 */
simon 0:1014af42efd9 2403
simon 0:1014af42efd9 2404 void arm_add_q15(
simon 0:1014af42efd9 2405 q15_t * pSrcA,
simon 0:1014af42efd9 2406 q15_t * pSrcB,
simon 0:1014af42efd9 2407 q15_t * pDst,
simon 0:1014af42efd9 2408 uint32_t blockSize);
simon 0:1014af42efd9 2409
simon 0:1014af42efd9 2410 /**
simon 0:1014af42efd9 2411 * @brief Q31 vector addition.
simon 0:1014af42efd9 2412 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2413 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2414 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2415 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2416 * @return none.
simon 0:1014af42efd9 2417 */
simon 0:1014af42efd9 2418
simon 0:1014af42efd9 2419 void arm_add_q31(
simon 0:1014af42efd9 2420 q31_t * pSrcA,
simon 0:1014af42efd9 2421 q31_t * pSrcB,
simon 0:1014af42efd9 2422 q31_t * pDst,
simon 0:1014af42efd9 2423 uint32_t blockSize);
simon 0:1014af42efd9 2424
simon 0:1014af42efd9 2425 /**
simon 0:1014af42efd9 2426 * @brief Floating-point vector subtraction.
simon 0:1014af42efd9 2427 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2428 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2429 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2430 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2431 * @return none.
simon 0:1014af42efd9 2432 */
simon 0:1014af42efd9 2433
simon 0:1014af42efd9 2434 void arm_sub_f32(
simon 0:1014af42efd9 2435 float32_t * pSrcA,
simon 0:1014af42efd9 2436 float32_t * pSrcB,
simon 0:1014af42efd9 2437 float32_t * pDst,
simon 0:1014af42efd9 2438 uint32_t blockSize);
simon 0:1014af42efd9 2439
simon 0:1014af42efd9 2440 /**
simon 0:1014af42efd9 2441 * @brief Q7 vector subtraction.
simon 0:1014af42efd9 2442 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2443 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2444 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2445 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2446 * @return none.
simon 0:1014af42efd9 2447 */
simon 0:1014af42efd9 2448
simon 0:1014af42efd9 2449 void arm_sub_q7(
simon 0:1014af42efd9 2450 q7_t * pSrcA,
simon 0:1014af42efd9 2451 q7_t * pSrcB,
simon 0:1014af42efd9 2452 q7_t * pDst,
simon 0:1014af42efd9 2453 uint32_t blockSize);
simon 0:1014af42efd9 2454
simon 0:1014af42efd9 2455 /**
simon 0:1014af42efd9 2456 * @brief Q15 vector subtraction.
simon 0:1014af42efd9 2457 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2458 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2459 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2460 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2461 * @return none.
simon 0:1014af42efd9 2462 */
simon 0:1014af42efd9 2463
simon 0:1014af42efd9 2464 void arm_sub_q15(
simon 0:1014af42efd9 2465 q15_t * pSrcA,
simon 0:1014af42efd9 2466 q15_t * pSrcB,
simon 0:1014af42efd9 2467 q15_t * pDst,
simon 0:1014af42efd9 2468 uint32_t blockSize);
simon 0:1014af42efd9 2469
simon 0:1014af42efd9 2470 /**
simon 0:1014af42efd9 2471 * @brief Q31 vector subtraction.
simon 0:1014af42efd9 2472 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2473 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2474 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2475 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2476 * @return none.
simon 0:1014af42efd9 2477 */
simon 0:1014af42efd9 2478
simon 0:1014af42efd9 2479 void arm_sub_q31(
simon 0:1014af42efd9 2480 q31_t * pSrcA,
simon 0:1014af42efd9 2481 q31_t * pSrcB,
simon 0:1014af42efd9 2482 q31_t * pDst,
simon 0:1014af42efd9 2483 uint32_t blockSize);
simon 0:1014af42efd9 2484
simon 0:1014af42efd9 2485 /**
simon 0:1014af42efd9 2486 * @brief Multiplies a floating-point vector by a scalar.
simon 0:1014af42efd9 2487 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2488 * @param[in] scale scale factor to be applied
simon 0:1014af42efd9 2489 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2490 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2491 * @return none.
simon 0:1014af42efd9 2492 */
simon 0:1014af42efd9 2493
simon 0:1014af42efd9 2494 void arm_scale_f32(
simon 0:1014af42efd9 2495 float32_t * pSrc,
simon 0:1014af42efd9 2496 float32_t scale,
simon 0:1014af42efd9 2497 float32_t * pDst,
simon 0:1014af42efd9 2498 uint32_t blockSize);
simon 0:1014af42efd9 2499
simon 0:1014af42efd9 2500 /**
simon 0:1014af42efd9 2501 * @brief Multiplies a Q7 vector by a scalar.
simon 0:1014af42efd9 2502 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2503 * @param[in] scaleFract fractional portion of the scale value
simon 0:1014af42efd9 2504 * @param[in] shift number of bits to shift the result by
simon 0:1014af42efd9 2505 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2506 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2507 * @return none.
simon 0:1014af42efd9 2508 */
simon 0:1014af42efd9 2509
simon 0:1014af42efd9 2510 void arm_scale_q7(
simon 0:1014af42efd9 2511 q7_t * pSrc,
simon 0:1014af42efd9 2512 q7_t scaleFract,
simon 0:1014af42efd9 2513 int8_t shift,
simon 0:1014af42efd9 2514 q7_t * pDst,
simon 0:1014af42efd9 2515 uint32_t blockSize);
simon 0:1014af42efd9 2516
simon 0:1014af42efd9 2517 /**
simon 0:1014af42efd9 2518 * @brief Multiplies a Q15 vector by a scalar.
simon 0:1014af42efd9 2519 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2520 * @param[in] scaleFract fractional portion of the scale value
simon 0:1014af42efd9 2521 * @param[in] shift number of bits to shift the result by
simon 0:1014af42efd9 2522 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2523 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2524 * @return none.
simon 0:1014af42efd9 2525 */
simon 0:1014af42efd9 2526
simon 0:1014af42efd9 2527 void arm_scale_q15(
simon 0:1014af42efd9 2528 q15_t * pSrc,
simon 0:1014af42efd9 2529 q15_t scaleFract,
simon 0:1014af42efd9 2530 int8_t shift,
simon 0:1014af42efd9 2531 q15_t * pDst,
simon 0:1014af42efd9 2532 uint32_t blockSize);
simon 0:1014af42efd9 2533
simon 0:1014af42efd9 2534 /**
simon 0:1014af42efd9 2535 * @brief Multiplies a Q31 vector by a scalar.
simon 0:1014af42efd9 2536 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2537 * @param[in] scaleFract fractional portion of the scale value
simon 0:1014af42efd9 2538 * @param[in] shift number of bits to shift the result by
simon 0:1014af42efd9 2539 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2540 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2541 * @return none.
simon 0:1014af42efd9 2542 */
simon 0:1014af42efd9 2543
simon 0:1014af42efd9 2544 void arm_scale_q31(
simon 0:1014af42efd9 2545 q31_t * pSrc,
simon 0:1014af42efd9 2546 q31_t scaleFract,
simon 0:1014af42efd9 2547 int8_t shift,
simon 0:1014af42efd9 2548 q31_t * pDst,
simon 0:1014af42efd9 2549 uint32_t blockSize);
simon 0:1014af42efd9 2550
simon 0:1014af42efd9 2551 /**
simon 0:1014af42efd9 2552 * @brief Q7 vector absolute value.
simon 0:1014af42efd9 2553 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 2554 * @param[out] *pDst points to the output buffer
simon 0:1014af42efd9 2555 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2556 * @return none.
simon 0:1014af42efd9 2557 */
simon 0:1014af42efd9 2558
simon 0:1014af42efd9 2559 void arm_abs_q7(
simon 0:1014af42efd9 2560 q7_t * pSrc,
simon 0:1014af42efd9 2561 q7_t * pDst,
simon 0:1014af42efd9 2562 uint32_t blockSize);
simon 0:1014af42efd9 2563
simon 0:1014af42efd9 2564 /**
simon 0:1014af42efd9 2565 * @brief Floating-point vector absolute value.
simon 0:1014af42efd9 2566 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 2567 * @param[out] *pDst points to the output buffer
simon 0:1014af42efd9 2568 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2569 * @return none.
simon 0:1014af42efd9 2570 */
simon 0:1014af42efd9 2571
simon 0:1014af42efd9 2572 void arm_abs_f32(
simon 0:1014af42efd9 2573 float32_t * pSrc,
simon 0:1014af42efd9 2574 float32_t * pDst,
simon 0:1014af42efd9 2575 uint32_t blockSize);
simon 0:1014af42efd9 2576
simon 0:1014af42efd9 2577 /**
simon 0:1014af42efd9 2578 * @brief Q15 vector absolute value.
simon 0:1014af42efd9 2579 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 2580 * @param[out] *pDst points to the output buffer
simon 0:1014af42efd9 2581 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2582 * @return none.
simon 0:1014af42efd9 2583 */
simon 0:1014af42efd9 2584
simon 0:1014af42efd9 2585 void arm_abs_q15(
simon 0:1014af42efd9 2586 q15_t * pSrc,
simon 0:1014af42efd9 2587 q15_t * pDst,
simon 0:1014af42efd9 2588 uint32_t blockSize);
simon 0:1014af42efd9 2589
simon 0:1014af42efd9 2590 /**
simon 0:1014af42efd9 2591 * @brief Q31 vector absolute value.
simon 0:1014af42efd9 2592 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 2593 * @param[out] *pDst points to the output buffer
simon 0:1014af42efd9 2594 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2595 * @return none.
simon 0:1014af42efd9 2596 */
simon 0:1014af42efd9 2597
simon 0:1014af42efd9 2598 void arm_abs_q31(
simon 0:1014af42efd9 2599 q31_t * pSrc,
simon 0:1014af42efd9 2600 q31_t * pDst,
simon 0:1014af42efd9 2601 uint32_t blockSize);
simon 0:1014af42efd9 2602
simon 0:1014af42efd9 2603 /**
simon 0:1014af42efd9 2604 * @brief Dot product of floating-point vectors.
simon 0:1014af42efd9 2605 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2606 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2607 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2608 * @param[out] *result output result returned here
simon 0:1014af42efd9 2609 * @return none.
simon 0:1014af42efd9 2610 */
simon 0:1014af42efd9 2611
simon 0:1014af42efd9 2612 void arm_dot_prod_f32(
simon 0:1014af42efd9 2613 float32_t * pSrcA,
simon 0:1014af42efd9 2614 float32_t * pSrcB,
simon 0:1014af42efd9 2615 uint32_t blockSize,
simon 0:1014af42efd9 2616 float32_t * result);
simon 0:1014af42efd9 2617
simon 0:1014af42efd9 2618 /**
simon 0:1014af42efd9 2619 * @brief Dot product of Q7 vectors.
simon 0:1014af42efd9 2620 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2621 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2622 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2623 * @param[out] *result output result returned here
simon 0:1014af42efd9 2624 * @return none.
simon 0:1014af42efd9 2625 */
simon 0:1014af42efd9 2626
simon 0:1014af42efd9 2627 void arm_dot_prod_q7(
simon 0:1014af42efd9 2628 q7_t * pSrcA,
simon 0:1014af42efd9 2629 q7_t * pSrcB,
simon 0:1014af42efd9 2630 uint32_t blockSize,
simon 0:1014af42efd9 2631 q31_t * result);
simon 0:1014af42efd9 2632
simon 0:1014af42efd9 2633 /**
simon 0:1014af42efd9 2634 * @brief Dot product of Q15 vectors.
simon 0:1014af42efd9 2635 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2636 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2637 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2638 * @param[out] *result output result returned here
simon 0:1014af42efd9 2639 * @return none.
simon 0:1014af42efd9 2640 */
simon 0:1014af42efd9 2641
simon 0:1014af42efd9 2642 void arm_dot_prod_q15(
simon 0:1014af42efd9 2643 q15_t * pSrcA,
simon 0:1014af42efd9 2644 q15_t * pSrcB,
simon 0:1014af42efd9 2645 uint32_t blockSize,
simon 0:1014af42efd9 2646 q63_t * result);
simon 0:1014af42efd9 2647
simon 0:1014af42efd9 2648 /**
simon 0:1014af42efd9 2649 * @brief Dot product of Q31 vectors.
simon 0:1014af42efd9 2650 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 2651 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 2652 * @param[in] blockSize number of samples in each vector
simon 0:1014af42efd9 2653 * @param[out] *result output result returned here
simon 0:1014af42efd9 2654 * @return none.
simon 0:1014af42efd9 2655 */
simon 0:1014af42efd9 2656
simon 0:1014af42efd9 2657 void arm_dot_prod_q31(
simon 0:1014af42efd9 2658 q31_t * pSrcA,
simon 0:1014af42efd9 2659 q31_t * pSrcB,
simon 0:1014af42efd9 2660 uint32_t blockSize,
simon 0:1014af42efd9 2661 q63_t * result);
simon 0:1014af42efd9 2662
simon 0:1014af42efd9 2663 /**
simon 0:1014af42efd9 2664 * @brief Shifts the elements of a Q7 vector a specified number of bits.
simon 0:1014af42efd9 2665 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2666 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
simon 0:1014af42efd9 2667 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2668 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2669 * @return none.
simon 0:1014af42efd9 2670 */
simon 0:1014af42efd9 2671
simon 0:1014af42efd9 2672 void arm_shift_q7(
simon 0:1014af42efd9 2673 q7_t * pSrc,
simon 0:1014af42efd9 2674 int8_t shiftBits,
simon 0:1014af42efd9 2675 q7_t * pDst,
simon 0:1014af42efd9 2676 uint32_t blockSize);
simon 0:1014af42efd9 2677
simon 0:1014af42efd9 2678 /**
simon 0:1014af42efd9 2679 * @brief Shifts the elements of a Q15 vector a specified number of bits.
simon 0:1014af42efd9 2680 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2681 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
simon 0:1014af42efd9 2682 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2683 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2684 * @return none.
simon 0:1014af42efd9 2685 */
simon 0:1014af42efd9 2686
simon 0:1014af42efd9 2687 void arm_shift_q15(
simon 0:1014af42efd9 2688 q15_t * pSrc,
simon 0:1014af42efd9 2689 int8_t shiftBits,
simon 0:1014af42efd9 2690 q15_t * pDst,
simon 0:1014af42efd9 2691 uint32_t blockSize);
simon 0:1014af42efd9 2692
simon 0:1014af42efd9 2693 /**
simon 0:1014af42efd9 2694 * @brief Shifts the elements of a Q31 vector a specified number of bits.
simon 0:1014af42efd9 2695 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2696 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
simon 0:1014af42efd9 2697 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2698 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2699 * @return none.
simon 0:1014af42efd9 2700 */
simon 0:1014af42efd9 2701
simon 0:1014af42efd9 2702 void arm_shift_q31(
simon 0:1014af42efd9 2703 q31_t * pSrc,
simon 0:1014af42efd9 2704 int8_t shiftBits,
simon 0:1014af42efd9 2705 q31_t * pDst,
simon 0:1014af42efd9 2706 uint32_t blockSize);
simon 0:1014af42efd9 2707
simon 0:1014af42efd9 2708 /**
simon 0:1014af42efd9 2709 * @brief Adds a constant offset to a floating-point vector.
simon 0:1014af42efd9 2710 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2711 * @param[in] offset is the offset to be added
simon 0:1014af42efd9 2712 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2713 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2714 * @return none.
simon 0:1014af42efd9 2715 */
simon 0:1014af42efd9 2716
simon 0:1014af42efd9 2717 void arm_offset_f32(
simon 0:1014af42efd9 2718 float32_t * pSrc,
simon 0:1014af42efd9 2719 float32_t offset,
simon 0:1014af42efd9 2720 float32_t * pDst,
simon 0:1014af42efd9 2721 uint32_t blockSize);
simon 0:1014af42efd9 2722
simon 0:1014af42efd9 2723 /**
simon 0:1014af42efd9 2724 * @brief Adds a constant offset to a Q7 vector.
simon 0:1014af42efd9 2725 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2726 * @param[in] offset is the offset to be added
simon 0:1014af42efd9 2727 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2728 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2729 * @return none.
simon 0:1014af42efd9 2730 */
simon 0:1014af42efd9 2731
simon 0:1014af42efd9 2732 void arm_offset_q7(
simon 0:1014af42efd9 2733 q7_t * pSrc,
simon 0:1014af42efd9 2734 q7_t offset,
simon 0:1014af42efd9 2735 q7_t * pDst,
simon 0:1014af42efd9 2736 uint32_t blockSize);
simon 0:1014af42efd9 2737
simon 0:1014af42efd9 2738 /**
simon 0:1014af42efd9 2739 * @brief Adds a constant offset to a Q15 vector.
simon 0:1014af42efd9 2740 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2741 * @param[in] offset is the offset to be added
simon 0:1014af42efd9 2742 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2743 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2744 * @return none.
simon 0:1014af42efd9 2745 */
simon 0:1014af42efd9 2746
simon 0:1014af42efd9 2747 void arm_offset_q15(
simon 0:1014af42efd9 2748 q15_t * pSrc,
simon 0:1014af42efd9 2749 q15_t offset,
simon 0:1014af42efd9 2750 q15_t * pDst,
simon 0:1014af42efd9 2751 uint32_t blockSize);
simon 0:1014af42efd9 2752
simon 0:1014af42efd9 2753 /**
simon 0:1014af42efd9 2754 * @brief Adds a constant offset to a Q31 vector.
simon 0:1014af42efd9 2755 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2756 * @param[in] offset is the offset to be added
simon 0:1014af42efd9 2757 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2758 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2759 * @return none.
simon 0:1014af42efd9 2760 */
simon 0:1014af42efd9 2761
simon 0:1014af42efd9 2762 void arm_offset_q31(
simon 0:1014af42efd9 2763 q31_t * pSrc,
simon 0:1014af42efd9 2764 q31_t offset,
simon 0:1014af42efd9 2765 q31_t * pDst,
simon 0:1014af42efd9 2766 uint32_t blockSize);
simon 0:1014af42efd9 2767
simon 0:1014af42efd9 2768 /**
simon 0:1014af42efd9 2769 * @brief Negates the elements of a floating-point vector.
simon 0:1014af42efd9 2770 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2771 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2772 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2773 * @return none.
simon 0:1014af42efd9 2774 */
simon 0:1014af42efd9 2775
simon 0:1014af42efd9 2776 void arm_negate_f32(
simon 0:1014af42efd9 2777 float32_t * pSrc,
simon 0:1014af42efd9 2778 float32_t * pDst,
simon 0:1014af42efd9 2779 uint32_t blockSize);
simon 0:1014af42efd9 2780
simon 0:1014af42efd9 2781 /**
simon 0:1014af42efd9 2782 * @brief Negates the elements of a Q7 vector.
simon 0:1014af42efd9 2783 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2784 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2785 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2786 * @return none.
simon 0:1014af42efd9 2787 */
simon 0:1014af42efd9 2788
simon 0:1014af42efd9 2789 void arm_negate_q7(
simon 0:1014af42efd9 2790 q7_t * pSrc,
simon 0:1014af42efd9 2791 q7_t * pDst,
simon 0:1014af42efd9 2792 uint32_t blockSize);
simon 0:1014af42efd9 2793
simon 0:1014af42efd9 2794 /**
simon 0:1014af42efd9 2795 * @brief Negates the elements of a Q15 vector.
simon 0:1014af42efd9 2796 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2797 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2798 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2799 * @return none.
simon 0:1014af42efd9 2800 */
simon 0:1014af42efd9 2801
simon 0:1014af42efd9 2802 void arm_negate_q15(
simon 0:1014af42efd9 2803 q15_t * pSrc,
simon 0:1014af42efd9 2804 q15_t * pDst,
simon 0:1014af42efd9 2805 uint32_t blockSize);
simon 0:1014af42efd9 2806
simon 0:1014af42efd9 2807 /**
simon 0:1014af42efd9 2808 * @brief Negates the elements of a Q31 vector.
simon 0:1014af42efd9 2809 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 2810 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 2811 * @param[in] blockSize number of samples in the vector
simon 0:1014af42efd9 2812 * @return none.
simon 0:1014af42efd9 2813 */
simon 0:1014af42efd9 2814
simon 0:1014af42efd9 2815 void arm_negate_q31(
simon 0:1014af42efd9 2816 q31_t * pSrc,
simon 0:1014af42efd9 2817 q31_t * pDst,
simon 0:1014af42efd9 2818 uint32_t blockSize);
simon 0:1014af42efd9 2819 /**
simon 0:1014af42efd9 2820 * @brief Copies the elements of a floating-point vector.
simon 0:1014af42efd9 2821 * @param[in] *pSrc input pointer
simon 0:1014af42efd9 2822 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2823 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2824 * @return none.
simon 0:1014af42efd9 2825 */
simon 0:1014af42efd9 2826 void arm_copy_f32(
simon 0:1014af42efd9 2827 float32_t * pSrc,
simon 0:1014af42efd9 2828 float32_t * pDst,
simon 0:1014af42efd9 2829 uint32_t blockSize);
simon 0:1014af42efd9 2830
simon 0:1014af42efd9 2831 /**
simon 0:1014af42efd9 2832 * @brief Copies the elements of a Q7 vector.
simon 0:1014af42efd9 2833 * @param[in] *pSrc input pointer
simon 0:1014af42efd9 2834 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2835 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2836 * @return none.
simon 0:1014af42efd9 2837 */
simon 0:1014af42efd9 2838 void arm_copy_q7(
simon 0:1014af42efd9 2839 q7_t * pSrc,
simon 0:1014af42efd9 2840 q7_t * pDst,
simon 0:1014af42efd9 2841 uint32_t blockSize);
simon 0:1014af42efd9 2842
simon 0:1014af42efd9 2843 /**
simon 0:1014af42efd9 2844 * @brief Copies the elements of a Q15 vector.
simon 0:1014af42efd9 2845 * @param[in] *pSrc input pointer
simon 0:1014af42efd9 2846 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2847 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2848 * @return none.
simon 0:1014af42efd9 2849 */
simon 0:1014af42efd9 2850 void arm_copy_q15(
simon 0:1014af42efd9 2851 q15_t * pSrc,
simon 0:1014af42efd9 2852 q15_t * pDst,
simon 0:1014af42efd9 2853 uint32_t blockSize);
simon 0:1014af42efd9 2854
simon 0:1014af42efd9 2855 /**
simon 0:1014af42efd9 2856 * @brief Copies the elements of a Q31 vector.
simon 0:1014af42efd9 2857 * @param[in] *pSrc input pointer
simon 0:1014af42efd9 2858 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2859 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2860 * @return none.
simon 0:1014af42efd9 2861 */
simon 0:1014af42efd9 2862 void arm_copy_q31(
simon 0:1014af42efd9 2863 q31_t * pSrc,
simon 0:1014af42efd9 2864 q31_t * pDst,
simon 0:1014af42efd9 2865 uint32_t blockSize);
simon 0:1014af42efd9 2866 /**
simon 0:1014af42efd9 2867 * @brief Fills a constant value into a floating-point vector.
simon 0:1014af42efd9 2868 * @param[in] value input value to be filled
simon 0:1014af42efd9 2869 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2870 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2871 * @return none.
simon 0:1014af42efd9 2872 */
simon 0:1014af42efd9 2873 void arm_fill_f32(
simon 0:1014af42efd9 2874 float32_t value,
simon 0:1014af42efd9 2875 float32_t * pDst,
simon 0:1014af42efd9 2876 uint32_t blockSize);
simon 0:1014af42efd9 2877
simon 0:1014af42efd9 2878 /**
simon 0:1014af42efd9 2879 * @brief Fills a constant value into a Q7 vector.
simon 0:1014af42efd9 2880 * @param[in] value input value to be filled
simon 0:1014af42efd9 2881 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2882 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2883 * @return none.
simon 0:1014af42efd9 2884 */
simon 0:1014af42efd9 2885 void arm_fill_q7(
simon 0:1014af42efd9 2886 q7_t value,
simon 0:1014af42efd9 2887 q7_t * pDst,
simon 0:1014af42efd9 2888 uint32_t blockSize);
simon 0:1014af42efd9 2889
simon 0:1014af42efd9 2890 /**
simon 0:1014af42efd9 2891 * @brief Fills a constant value into a Q15 vector.
simon 0:1014af42efd9 2892 * @param[in] value input value to be filled
simon 0:1014af42efd9 2893 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2894 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2895 * @return none.
simon 0:1014af42efd9 2896 */
simon 0:1014af42efd9 2897 void arm_fill_q15(
simon 0:1014af42efd9 2898 q15_t value,
simon 0:1014af42efd9 2899 q15_t * pDst,
simon 0:1014af42efd9 2900 uint32_t blockSize);
simon 0:1014af42efd9 2901
simon 0:1014af42efd9 2902 /**
simon 0:1014af42efd9 2903 * @brief Fills a constant value into a Q31 vector.
simon 0:1014af42efd9 2904 * @param[in] value input value to be filled
simon 0:1014af42efd9 2905 * @param[out] *pDst output pointer
simon 0:1014af42efd9 2906 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 2907 * @return none.
simon 0:1014af42efd9 2908 */
simon 0:1014af42efd9 2909 void arm_fill_q31(
simon 0:1014af42efd9 2910 q31_t value,
simon 0:1014af42efd9 2911 q31_t * pDst,
simon 0:1014af42efd9 2912 uint32_t blockSize);
simon 0:1014af42efd9 2913
simon 0:1014af42efd9 2914 /**
simon 0:1014af42efd9 2915 * @brief Convolution of floating-point sequences.
simon 0:1014af42efd9 2916 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 2917 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 2918 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 2919 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 2920 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
simon 0:1014af42efd9 2921 * @return none.
simon 0:1014af42efd9 2922 */
simon 0:1014af42efd9 2923
simon 0:1014af42efd9 2924 void arm_conv_f32(
simon 0:1014af42efd9 2925 float32_t * pSrcA,
simon 0:1014af42efd9 2926 uint32_t srcALen,
simon 0:1014af42efd9 2927 float32_t * pSrcB,
simon 0:1014af42efd9 2928 uint32_t srcBLen,
simon 0:1014af42efd9 2929 float32_t * pDst);
simon 0:1014af42efd9 2930
simon 0:1014af42efd9 2931 /**
simon 0:1014af42efd9 2932 * @brief Convolution of Q15 sequences.
simon 0:1014af42efd9 2933 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 2934 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 2935 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 2936 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 2937 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
simon 0:1014af42efd9 2938 * @return none.
simon 0:1014af42efd9 2939 */
simon 0:1014af42efd9 2940
simon 0:1014af42efd9 2941 void arm_conv_q15(
simon 0:1014af42efd9 2942 q15_t * pSrcA,
simon 0:1014af42efd9 2943 uint32_t srcALen,
simon 0:1014af42efd9 2944 q15_t * pSrcB,
simon 0:1014af42efd9 2945 uint32_t srcBLen,
simon 0:1014af42efd9 2946 q15_t * pDst);
simon 0:1014af42efd9 2947
simon 0:1014af42efd9 2948 /**
simon 0:1014af42efd9 2949 * @brief Convolution of Q15 sequences (fast version).
simon 0:1014af42efd9 2950 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 2951 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 2952 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 2953 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 2954 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
simon 0:1014af42efd9 2955 * @return none.
simon 0:1014af42efd9 2956 */
simon 0:1014af42efd9 2957
simon 0:1014af42efd9 2958 void arm_conv_fast_q15(
simon 0:1014af42efd9 2959 q15_t * pSrcA,
simon 0:1014af42efd9 2960 uint32_t srcALen,
simon 0:1014af42efd9 2961 q15_t * pSrcB,
simon 0:1014af42efd9 2962 uint32_t srcBLen,
simon 0:1014af42efd9 2963 q15_t * pDst);
simon 0:1014af42efd9 2964
simon 0:1014af42efd9 2965 /**
simon 0:1014af42efd9 2966 * @brief Convolution of Q31 sequences.
simon 0:1014af42efd9 2967 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 2968 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 2969 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 2970 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 2971 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
simon 0:1014af42efd9 2972 * @return none.
simon 0:1014af42efd9 2973 */
simon 0:1014af42efd9 2974
simon 0:1014af42efd9 2975 void arm_conv_q31(
simon 0:1014af42efd9 2976 q31_t * pSrcA,
simon 0:1014af42efd9 2977 uint32_t srcALen,
simon 0:1014af42efd9 2978 q31_t * pSrcB,
simon 0:1014af42efd9 2979 uint32_t srcBLen,
simon 0:1014af42efd9 2980 q31_t * pDst);
simon 0:1014af42efd9 2981
simon 0:1014af42efd9 2982 /**
simon 0:1014af42efd9 2983 * @brief Convolution of Q31 sequences (fast version).
simon 0:1014af42efd9 2984 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 2985 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 2986 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 2987 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 2988 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
simon 0:1014af42efd9 2989 * @return none.
simon 0:1014af42efd9 2990 */
simon 0:1014af42efd9 2991
simon 0:1014af42efd9 2992 void arm_conv_fast_q31(
simon 0:1014af42efd9 2993 q31_t * pSrcA,
simon 0:1014af42efd9 2994 uint32_t srcALen,
simon 0:1014af42efd9 2995 q31_t * pSrcB,
simon 0:1014af42efd9 2996 uint32_t srcBLen,
simon 0:1014af42efd9 2997 q31_t * pDst);
simon 0:1014af42efd9 2998
simon 0:1014af42efd9 2999 /**
simon 0:1014af42efd9 3000 * @brief Convolution of Q7 sequences.
simon 0:1014af42efd9 3001 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3002 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3003 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3004 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3005 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
simon 0:1014af42efd9 3006 * @return none.
simon 0:1014af42efd9 3007 */
simon 0:1014af42efd9 3008
simon 0:1014af42efd9 3009 void arm_conv_q7(
simon 0:1014af42efd9 3010 q7_t * pSrcA,
simon 0:1014af42efd9 3011 uint32_t srcALen,
simon 0:1014af42efd9 3012 q7_t * pSrcB,
simon 0:1014af42efd9 3013 uint32_t srcBLen,
simon 0:1014af42efd9 3014 q7_t * pDst);
simon 0:1014af42efd9 3015
simon 0:1014af42efd9 3016 /**
simon 0:1014af42efd9 3017 * @brief Partial convolution of floating-point sequences.
simon 0:1014af42efd9 3018 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3019 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3020 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3021 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3022 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3023 * @param[in] firstIndex is the first output sample to start with.
simon 0:1014af42efd9 3024 * @param[in] numPoints is the number of output points to be computed.
simon 0:1014af42efd9 3025 * @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].
simon 0:1014af42efd9 3026 */
simon 0:1014af42efd9 3027
simon 0:1014af42efd9 3028 arm_status arm_conv_partial_f32(
simon 0:1014af42efd9 3029 float32_t * pSrcA,
simon 0:1014af42efd9 3030 uint32_t srcALen,
simon 0:1014af42efd9 3031 float32_t * pSrcB,
simon 0:1014af42efd9 3032 uint32_t srcBLen,
simon 0:1014af42efd9 3033 float32_t * pDst,
simon 0:1014af42efd9 3034 uint32_t firstIndex,
simon 0:1014af42efd9 3035 uint32_t numPoints);
simon 0:1014af42efd9 3036
simon 0:1014af42efd9 3037 /**
simon 0:1014af42efd9 3038 * @brief Partial convolution of Q15 sequences.
simon 0:1014af42efd9 3039 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3040 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3041 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3042 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3043 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3044 * @param[in] firstIndex is the first output sample to start with.
simon 0:1014af42efd9 3045 * @param[in] numPoints is the number of output points to be computed.
simon 0:1014af42efd9 3046 * @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].
simon 0:1014af42efd9 3047 */
simon 0:1014af42efd9 3048
simon 0:1014af42efd9 3049 arm_status arm_conv_partial_q15(
simon 0:1014af42efd9 3050 q15_t * pSrcA,
simon 0:1014af42efd9 3051 uint32_t srcALen,
simon 0:1014af42efd9 3052 q15_t * pSrcB,
simon 0:1014af42efd9 3053 uint32_t srcBLen,
simon 0:1014af42efd9 3054 q15_t * pDst,
simon 0:1014af42efd9 3055 uint32_t firstIndex,
simon 0:1014af42efd9 3056 uint32_t numPoints);
simon 0:1014af42efd9 3057
simon 0:1014af42efd9 3058 /**
simon 0:1014af42efd9 3059 * @brief Partial convolution of Q15 sequences (fast version).
simon 0:1014af42efd9 3060 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3061 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3062 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3063 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3064 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3065 * @param[in] firstIndex is the first output sample to start with.
simon 0:1014af42efd9 3066 * @param[in] numPoints is the number of output points to be computed.
simon 0:1014af42efd9 3067 * @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].
simon 0:1014af42efd9 3068 */
simon 0:1014af42efd9 3069
simon 0:1014af42efd9 3070 arm_status arm_conv_partial_fast_q15(
simon 0:1014af42efd9 3071 q15_t * pSrcA,
simon 0:1014af42efd9 3072 uint32_t srcALen,
simon 0:1014af42efd9 3073 q15_t * pSrcB,
simon 0:1014af42efd9 3074 uint32_t srcBLen,
simon 0:1014af42efd9 3075 q15_t * pDst,
simon 0:1014af42efd9 3076 uint32_t firstIndex,
simon 0:1014af42efd9 3077 uint32_t numPoints);
simon 0:1014af42efd9 3078
simon 0:1014af42efd9 3079 /**
simon 0:1014af42efd9 3080 * @brief Partial convolution of Q31 sequences.
simon 0:1014af42efd9 3081 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3082 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3083 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3084 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3085 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3086 * @param[in] firstIndex is the first output sample to start with.
simon 0:1014af42efd9 3087 * @param[in] numPoints is the number of output points to be computed.
simon 0:1014af42efd9 3088 * @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].
simon 0:1014af42efd9 3089 */
simon 0:1014af42efd9 3090
simon 0:1014af42efd9 3091 arm_status arm_conv_partial_q31(
simon 0:1014af42efd9 3092 q31_t * pSrcA,
simon 0:1014af42efd9 3093 uint32_t srcALen,
simon 0:1014af42efd9 3094 q31_t * pSrcB,
simon 0:1014af42efd9 3095 uint32_t srcBLen,
simon 0:1014af42efd9 3096 q31_t * pDst,
simon 0:1014af42efd9 3097 uint32_t firstIndex,
simon 0:1014af42efd9 3098 uint32_t numPoints);
simon 0:1014af42efd9 3099
simon 0:1014af42efd9 3100
simon 0:1014af42efd9 3101 /**
simon 0:1014af42efd9 3102 * @brief Partial convolution of Q31 sequences (fast version).
simon 0:1014af42efd9 3103 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3104 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3105 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3106 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3107 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3108 * @param[in] firstIndex is the first output sample to start with.
simon 0:1014af42efd9 3109 * @param[in] numPoints is the number of output points to be computed.
simon 0:1014af42efd9 3110 * @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].
simon 0:1014af42efd9 3111 */
simon 0:1014af42efd9 3112
simon 0:1014af42efd9 3113 arm_status arm_conv_partial_fast_q31(
simon 0:1014af42efd9 3114 q31_t * pSrcA,
simon 0:1014af42efd9 3115 uint32_t srcALen,
simon 0:1014af42efd9 3116 q31_t * pSrcB,
simon 0:1014af42efd9 3117 uint32_t srcBLen,
simon 0:1014af42efd9 3118 q31_t * pDst,
simon 0:1014af42efd9 3119 uint32_t firstIndex,
simon 0:1014af42efd9 3120 uint32_t numPoints);
simon 0:1014af42efd9 3121
simon 0:1014af42efd9 3122 /**
simon 0:1014af42efd9 3123 * @brief Partial convolution of Q7 sequences
simon 0:1014af42efd9 3124 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 3125 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 3126 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 3127 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 3128 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3129 * @param[in] firstIndex is the first output sample to start with.
simon 0:1014af42efd9 3130 * @param[in] numPoints is the number of output points to be computed.
simon 0:1014af42efd9 3131 * @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].
simon 0:1014af42efd9 3132 */
simon 0:1014af42efd9 3133
simon 0:1014af42efd9 3134 arm_status arm_conv_partial_q7(
simon 0:1014af42efd9 3135 q7_t * pSrcA,
simon 0:1014af42efd9 3136 uint32_t srcALen,
simon 0:1014af42efd9 3137 q7_t * pSrcB,
simon 0:1014af42efd9 3138 uint32_t srcBLen,
simon 0:1014af42efd9 3139 q7_t * pDst,
simon 0:1014af42efd9 3140 uint32_t firstIndex,
simon 0:1014af42efd9 3141 uint32_t numPoints);
simon 0:1014af42efd9 3142
simon 0:1014af42efd9 3143
simon 0:1014af42efd9 3144 /**
simon 0:1014af42efd9 3145 * @brief Instance structure for the Q15 FIR decimator.
simon 0:1014af42efd9 3146 */
simon 0:1014af42efd9 3147
simon 0:1014af42efd9 3148 typedef struct
simon 0:1014af42efd9 3149 {
simon 0:1014af42efd9 3150 uint8_t M; /**< decimation factor. */
simon 0:1014af42efd9 3151 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3152 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 3153 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3154 } arm_fir_decimate_instance_q15;
simon 0:1014af42efd9 3155
simon 0:1014af42efd9 3156 /**
simon 0:1014af42efd9 3157 * @brief Instance structure for the Q31 FIR decimator.
simon 0:1014af42efd9 3158 */
simon 0:1014af42efd9 3159
simon 0:1014af42efd9 3160 typedef struct
simon 0:1014af42efd9 3161 {
simon 0:1014af42efd9 3162 uint8_t M; /**< decimation factor. */
simon 0:1014af42efd9 3163 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3164 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 3165 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3166
simon 0:1014af42efd9 3167 } arm_fir_decimate_instance_q31;
simon 0:1014af42efd9 3168
simon 0:1014af42efd9 3169 /**
simon 0:1014af42efd9 3170 * @brief Instance structure for the floating-point FIR decimator.
simon 0:1014af42efd9 3171 */
simon 0:1014af42efd9 3172
simon 0:1014af42efd9 3173 typedef struct
simon 0:1014af42efd9 3174 {
simon 0:1014af42efd9 3175 uint8_t M; /**< decimation factor. */
simon 0:1014af42efd9 3176 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3177 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 3178 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3179
simon 0:1014af42efd9 3180 } arm_fir_decimate_instance_f32;
simon 0:1014af42efd9 3181
simon 0:1014af42efd9 3182
simon 0:1014af42efd9 3183
simon 0:1014af42efd9 3184 /**
simon 0:1014af42efd9 3185 * @brief Processing function for the floating-point FIR decimator.
simon 0:1014af42efd9 3186 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
simon 0:1014af42efd9 3187 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3188 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3189 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3190 * @return none
simon 0:1014af42efd9 3191 */
simon 0:1014af42efd9 3192
simon 0:1014af42efd9 3193 void arm_fir_decimate_f32(
simon 0:1014af42efd9 3194 const arm_fir_decimate_instance_f32 * S,
simon 0:1014af42efd9 3195 float32_t * pSrc,
simon 0:1014af42efd9 3196 float32_t * pDst,
simon 0:1014af42efd9 3197 uint32_t blockSize);
simon 0:1014af42efd9 3198
simon 0:1014af42efd9 3199
simon 0:1014af42efd9 3200 /**
simon 0:1014af42efd9 3201 * @brief Initialization function for the floating-point FIR decimator.
simon 0:1014af42efd9 3202 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
simon 0:1014af42efd9 3203 * @param[in] numTaps number of coefficients in the filter.
simon 0:1014af42efd9 3204 * @param[in] M decimation factor.
simon 0:1014af42efd9 3205 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 3206 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3207 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3208 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
simon 0:1014af42efd9 3209 * <code>blockSize</code> is not a multiple of <code>M</code>.
simon 0:1014af42efd9 3210 */
simon 0:1014af42efd9 3211
simon 0:1014af42efd9 3212 arm_status arm_fir_decimate_init_f32(
simon 0:1014af42efd9 3213 arm_fir_decimate_instance_f32 * S,
simon 0:1014af42efd9 3214 uint16_t numTaps,
simon 0:1014af42efd9 3215 uint8_t M,
simon 0:1014af42efd9 3216 float32_t * pCoeffs,
simon 0:1014af42efd9 3217 float32_t * pState,
simon 0:1014af42efd9 3218 uint32_t blockSize);
simon 0:1014af42efd9 3219
simon 0:1014af42efd9 3220 /**
simon 0:1014af42efd9 3221 * @brief Processing function for the Q15 FIR decimator.
simon 0:1014af42efd9 3222 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
simon 0:1014af42efd9 3223 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3224 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3225 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3226 * @return none
simon 0:1014af42efd9 3227 */
simon 0:1014af42efd9 3228
simon 0:1014af42efd9 3229 void arm_fir_decimate_q15(
simon 0:1014af42efd9 3230 const arm_fir_decimate_instance_q15 * S,
simon 0:1014af42efd9 3231 q15_t * pSrc,
simon 0:1014af42efd9 3232 q15_t * pDst,
simon 0:1014af42efd9 3233 uint32_t blockSize);
simon 0:1014af42efd9 3234
simon 0:1014af42efd9 3235 /**
simon 0:1014af42efd9 3236 * @brief Processing function for the Q15 FIR decimator (fast variant).
simon 0:1014af42efd9 3237 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
simon 0:1014af42efd9 3238 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3239 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3240 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3241 * @return none
simon 0:1014af42efd9 3242 */
simon 0:1014af42efd9 3243
simon 0:1014af42efd9 3244 void arm_fir_decimate_fast_q15(
simon 0:1014af42efd9 3245 const arm_fir_decimate_instance_q15 * S,
simon 0:1014af42efd9 3246 q15_t * pSrc,
simon 0:1014af42efd9 3247 q15_t * pDst,
simon 0:1014af42efd9 3248 uint32_t blockSize);
simon 0:1014af42efd9 3249
simon 0:1014af42efd9 3250
simon 0:1014af42efd9 3251
simon 0:1014af42efd9 3252 /**
simon 0:1014af42efd9 3253 * @brief Initialization function for the Q15 FIR decimator.
simon 0:1014af42efd9 3254 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
simon 0:1014af42efd9 3255 * @param[in] numTaps number of coefficients in the filter.
simon 0:1014af42efd9 3256 * @param[in] M decimation factor.
simon 0:1014af42efd9 3257 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 3258 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3259 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3260 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
simon 0:1014af42efd9 3261 * <code>blockSize</code> is not a multiple of <code>M</code>.
simon 0:1014af42efd9 3262 */
simon 0:1014af42efd9 3263
simon 0:1014af42efd9 3264 arm_status arm_fir_decimate_init_q15(
simon 0:1014af42efd9 3265 arm_fir_decimate_instance_q15 * S,
simon 0:1014af42efd9 3266 uint16_t numTaps,
simon 0:1014af42efd9 3267 uint8_t M,
simon 0:1014af42efd9 3268 q15_t * pCoeffs,
simon 0:1014af42efd9 3269 q15_t * pState,
simon 0:1014af42efd9 3270 uint32_t blockSize);
simon 0:1014af42efd9 3271
simon 0:1014af42efd9 3272 /**
simon 0:1014af42efd9 3273 * @brief Processing function for the Q31 FIR decimator.
simon 0:1014af42efd9 3274 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
simon 0:1014af42efd9 3275 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3276 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3277 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3278 * @return none
simon 0:1014af42efd9 3279 */
simon 0:1014af42efd9 3280
simon 0:1014af42efd9 3281 void arm_fir_decimate_q31(
simon 0:1014af42efd9 3282 const arm_fir_decimate_instance_q31 * S,
simon 0:1014af42efd9 3283 q31_t * pSrc,
simon 0:1014af42efd9 3284 q31_t * pDst,
simon 0:1014af42efd9 3285 uint32_t blockSize);
simon 0:1014af42efd9 3286
simon 0:1014af42efd9 3287 /**
simon 0:1014af42efd9 3288 * @brief Processing function for the Q31 FIR decimator (fast variant).
simon 0:1014af42efd9 3289 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
simon 0:1014af42efd9 3290 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3291 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3292 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3293 * @return none
simon 0:1014af42efd9 3294 */
simon 0:1014af42efd9 3295
simon 0:1014af42efd9 3296 void arm_fir_decimate_fast_q31(
simon 0:1014af42efd9 3297 arm_fir_decimate_instance_q31 * S,
simon 0:1014af42efd9 3298 q31_t * pSrc,
simon 0:1014af42efd9 3299 q31_t * pDst,
simon 0:1014af42efd9 3300 uint32_t blockSize);
simon 0:1014af42efd9 3301
simon 0:1014af42efd9 3302
simon 0:1014af42efd9 3303 /**
simon 0:1014af42efd9 3304 * @brief Initialization function for the Q31 FIR decimator.
simon 0:1014af42efd9 3305 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
simon 0:1014af42efd9 3306 * @param[in] numTaps number of coefficients in the filter.
simon 0:1014af42efd9 3307 * @param[in] M decimation factor.
simon 0:1014af42efd9 3308 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 3309 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3310 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3311 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
simon 0:1014af42efd9 3312 * <code>blockSize</code> is not a multiple of <code>M</code>.
simon 0:1014af42efd9 3313 */
simon 0:1014af42efd9 3314
simon 0:1014af42efd9 3315 arm_status arm_fir_decimate_init_q31(
simon 0:1014af42efd9 3316 arm_fir_decimate_instance_q31 * S,
simon 0:1014af42efd9 3317 uint16_t numTaps,
simon 0:1014af42efd9 3318 uint8_t M,
simon 0:1014af42efd9 3319 q31_t * pCoeffs,
simon 0:1014af42efd9 3320 q31_t * pState,
simon 0:1014af42efd9 3321 uint32_t blockSize);
simon 0:1014af42efd9 3322
simon 0:1014af42efd9 3323
simon 0:1014af42efd9 3324
simon 0:1014af42efd9 3325 /**
simon 0:1014af42efd9 3326 * @brief Instance structure for the Q15 FIR interpolator.
simon 0:1014af42efd9 3327 */
simon 0:1014af42efd9 3328
simon 0:1014af42efd9 3329 typedef struct
simon 0:1014af42efd9 3330 {
simon 0:1014af42efd9 3331 uint8_t L; /**< upsample factor. */
simon 0:1014af42efd9 3332 uint16_t phaseLength; /**< length of each polyphase filter component. */
simon 0:1014af42efd9 3333 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
simon 0:1014af42efd9 3334 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
simon 0:1014af42efd9 3335 } arm_fir_interpolate_instance_q15;
simon 0:1014af42efd9 3336
simon 0:1014af42efd9 3337 /**
simon 0:1014af42efd9 3338 * @brief Instance structure for the Q31 FIR interpolator.
simon 0:1014af42efd9 3339 */
simon 0:1014af42efd9 3340
simon 0:1014af42efd9 3341 typedef struct
simon 0:1014af42efd9 3342 {
simon 0:1014af42efd9 3343 uint8_t L; /**< upsample factor. */
simon 0:1014af42efd9 3344 uint16_t phaseLength; /**< length of each polyphase filter component. */
simon 0:1014af42efd9 3345 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
simon 0:1014af42efd9 3346 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
simon 0:1014af42efd9 3347 } arm_fir_interpolate_instance_q31;
simon 0:1014af42efd9 3348
simon 0:1014af42efd9 3349 /**
simon 0:1014af42efd9 3350 * @brief Instance structure for the floating-point FIR interpolator.
simon 0:1014af42efd9 3351 */
simon 0:1014af42efd9 3352
simon 0:1014af42efd9 3353 typedef struct
simon 0:1014af42efd9 3354 {
simon 0:1014af42efd9 3355 uint8_t L; /**< upsample factor. */
simon 0:1014af42efd9 3356 uint16_t phaseLength; /**< length of each polyphase filter component. */
simon 0:1014af42efd9 3357 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
simon 0:1014af42efd9 3358 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
simon 0:1014af42efd9 3359 } arm_fir_interpolate_instance_f32;
simon 0:1014af42efd9 3360
simon 0:1014af42efd9 3361
simon 0:1014af42efd9 3362 /**
simon 0:1014af42efd9 3363 * @brief Processing function for the Q15 FIR interpolator.
simon 0:1014af42efd9 3364 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
simon 0:1014af42efd9 3365 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3366 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3367 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3368 * @return none.
simon 0:1014af42efd9 3369 */
simon 0:1014af42efd9 3370
simon 0:1014af42efd9 3371 void arm_fir_interpolate_q15(
simon 0:1014af42efd9 3372 const arm_fir_interpolate_instance_q15 * S,
simon 0:1014af42efd9 3373 q15_t * pSrc,
simon 0:1014af42efd9 3374 q15_t * pDst,
simon 0:1014af42efd9 3375 uint32_t blockSize);
simon 0:1014af42efd9 3376
simon 0:1014af42efd9 3377
simon 0:1014af42efd9 3378 /**
simon 0:1014af42efd9 3379 * @brief Initialization function for the Q15 FIR interpolator.
simon 0:1014af42efd9 3380 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
simon 0:1014af42efd9 3381 * @param[in] L upsample factor.
simon 0:1014af42efd9 3382 * @param[in] numTaps number of filter coefficients in the filter.
simon 0:1014af42efd9 3383 * @param[in] *pCoeffs points to the filter coefficient buffer.
simon 0:1014af42efd9 3384 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3385 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3386 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
simon 0:1014af42efd9 3387 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
simon 0:1014af42efd9 3388 */
simon 0:1014af42efd9 3389
simon 0:1014af42efd9 3390 arm_status arm_fir_interpolate_init_q15(
simon 0:1014af42efd9 3391 arm_fir_interpolate_instance_q15 * S,
simon 0:1014af42efd9 3392 uint8_t L,
simon 0:1014af42efd9 3393 uint16_t numTaps,
simon 0:1014af42efd9 3394 q15_t * pCoeffs,
simon 0:1014af42efd9 3395 q15_t * pState,
simon 0:1014af42efd9 3396 uint32_t blockSize);
simon 0:1014af42efd9 3397
simon 0:1014af42efd9 3398 /**
simon 0:1014af42efd9 3399 * @brief Processing function for the Q31 FIR interpolator.
simon 0:1014af42efd9 3400 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
simon 0:1014af42efd9 3401 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3402 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3403 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3404 * @return none.
simon 0:1014af42efd9 3405 */
simon 0:1014af42efd9 3406
simon 0:1014af42efd9 3407 void arm_fir_interpolate_q31(
simon 0:1014af42efd9 3408 const arm_fir_interpolate_instance_q31 * S,
simon 0:1014af42efd9 3409 q31_t * pSrc,
simon 0:1014af42efd9 3410 q31_t * pDst,
simon 0:1014af42efd9 3411 uint32_t blockSize);
simon 0:1014af42efd9 3412
simon 0:1014af42efd9 3413 /**
simon 0:1014af42efd9 3414 * @brief Initialization function for the Q31 FIR interpolator.
simon 0:1014af42efd9 3415 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
simon 0:1014af42efd9 3416 * @param[in] L upsample factor.
simon 0:1014af42efd9 3417 * @param[in] numTaps number of filter coefficients in the filter.
simon 0:1014af42efd9 3418 * @param[in] *pCoeffs points to the filter coefficient buffer.
simon 0:1014af42efd9 3419 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3420 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3421 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
simon 0:1014af42efd9 3422 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
simon 0:1014af42efd9 3423 */
simon 0:1014af42efd9 3424
simon 0:1014af42efd9 3425 arm_status arm_fir_interpolate_init_q31(
simon 0:1014af42efd9 3426 arm_fir_interpolate_instance_q31 * S,
simon 0:1014af42efd9 3427 uint8_t L,
simon 0:1014af42efd9 3428 uint16_t numTaps,
simon 0:1014af42efd9 3429 q31_t * pCoeffs,
simon 0:1014af42efd9 3430 q31_t * pState,
simon 0:1014af42efd9 3431 uint32_t blockSize);
simon 0:1014af42efd9 3432
simon 0:1014af42efd9 3433
simon 0:1014af42efd9 3434 /**
simon 0:1014af42efd9 3435 * @brief Processing function for the floating-point FIR interpolator.
simon 0:1014af42efd9 3436 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
simon 0:1014af42efd9 3437 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3438 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3439 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3440 * @return none.
simon 0:1014af42efd9 3441 */
simon 0:1014af42efd9 3442
simon 0:1014af42efd9 3443 void arm_fir_interpolate_f32(
simon 0:1014af42efd9 3444 const arm_fir_interpolate_instance_f32 * S,
simon 0:1014af42efd9 3445 float32_t * pSrc,
simon 0:1014af42efd9 3446 float32_t * pDst,
simon 0:1014af42efd9 3447 uint32_t blockSize);
simon 0:1014af42efd9 3448
simon 0:1014af42efd9 3449 /**
simon 0:1014af42efd9 3450 * @brief Initialization function for the floating-point FIR interpolator.
simon 0:1014af42efd9 3451 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
simon 0:1014af42efd9 3452 * @param[in] L upsample factor.
simon 0:1014af42efd9 3453 * @param[in] numTaps number of filter coefficients in the filter.
simon 0:1014af42efd9 3454 * @param[in] *pCoeffs points to the filter coefficient buffer.
simon 0:1014af42efd9 3455 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3456 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 3457 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
simon 0:1014af42efd9 3458 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
simon 0:1014af42efd9 3459 */
simon 0:1014af42efd9 3460
simon 0:1014af42efd9 3461 arm_status arm_fir_interpolate_init_f32(
simon 0:1014af42efd9 3462 arm_fir_interpolate_instance_f32 * S,
simon 0:1014af42efd9 3463 uint8_t L,
simon 0:1014af42efd9 3464 uint16_t numTaps,
simon 0:1014af42efd9 3465 float32_t * pCoeffs,
simon 0:1014af42efd9 3466 float32_t * pState,
simon 0:1014af42efd9 3467 uint32_t blockSize);
simon 0:1014af42efd9 3468
simon 0:1014af42efd9 3469 /**
simon 0:1014af42efd9 3470 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
simon 0:1014af42efd9 3471 */
simon 0:1014af42efd9 3472
simon 0:1014af42efd9 3473 typedef struct
simon 0:1014af42efd9 3474 {
simon 0:1014af42efd9 3475 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
simon 0:1014af42efd9 3476 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
simon 0:1014af42efd9 3477 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
simon 0:1014af42efd9 3478 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
simon 0:1014af42efd9 3479
simon 0:1014af42efd9 3480 } arm_biquad_cas_df1_32x64_ins_q31;
simon 0:1014af42efd9 3481
simon 0:1014af42efd9 3482
simon 0:1014af42efd9 3483 /**
simon 0:1014af42efd9 3484 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
simon 0:1014af42efd9 3485 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3486 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3487 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3488 * @return none.
simon 0:1014af42efd9 3489 */
simon 0:1014af42efd9 3490
simon 0:1014af42efd9 3491 void arm_biquad_cas_df1_32x64_q31(
simon 0:1014af42efd9 3492 const arm_biquad_cas_df1_32x64_ins_q31 * S,
simon 0:1014af42efd9 3493 q31_t * pSrc,
simon 0:1014af42efd9 3494 q31_t * pDst,
simon 0:1014af42efd9 3495 uint32_t blockSize);
simon 0:1014af42efd9 3496
simon 0:1014af42efd9 3497
simon 0:1014af42efd9 3498 /**
simon 0:1014af42efd9 3499 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
simon 0:1014af42efd9 3500 * @param[in] numStages number of 2nd order stages in the filter.
simon 0:1014af42efd9 3501 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 3502 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3503 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
simon 0:1014af42efd9 3504 * @return none
simon 0:1014af42efd9 3505 */
simon 0:1014af42efd9 3506
simon 0:1014af42efd9 3507 void arm_biquad_cas_df1_32x64_init_q31(
simon 0:1014af42efd9 3508 arm_biquad_cas_df1_32x64_ins_q31 * S,
simon 0:1014af42efd9 3509 uint8_t numStages,
simon 0:1014af42efd9 3510 q31_t * pCoeffs,
simon 0:1014af42efd9 3511 q63_t * pState,
simon 0:1014af42efd9 3512 uint8_t postShift);
simon 0:1014af42efd9 3513
simon 0:1014af42efd9 3514
simon 0:1014af42efd9 3515
simon 0:1014af42efd9 3516 /**
simon 0:1014af42efd9 3517 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
simon 0:1014af42efd9 3518 */
simon 0:1014af42efd9 3519
simon 0:1014af42efd9 3520 typedef struct
simon 0:1014af42efd9 3521 {
simon 0:1014af42efd9 3522 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
simon 0:1014af42efd9 3523 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
simon 0:1014af42efd9 3524 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
simon 0:1014af42efd9 3525 } arm_biquad_cascade_df2T_instance_f32;
simon 0:1014af42efd9 3526
simon 0:1014af42efd9 3527
simon 0:1014af42efd9 3528 /**
simon 0:1014af42efd9 3529 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
simon 0:1014af42efd9 3530 * @param[in] *S points to an instance of the filter data structure.
simon 0:1014af42efd9 3531 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3532 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3533 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3534 * @return none.
simon 0:1014af42efd9 3535 */
simon 0:1014af42efd9 3536
simon 0:1014af42efd9 3537 void arm_biquad_cascade_df2T_f32(
simon 0:1014af42efd9 3538 const arm_biquad_cascade_df2T_instance_f32 * S,
simon 0:1014af42efd9 3539 float32_t * pSrc,
simon 0:1014af42efd9 3540 float32_t * pDst,
simon 0:1014af42efd9 3541 uint32_t blockSize);
simon 0:1014af42efd9 3542
simon 0:1014af42efd9 3543
simon 0:1014af42efd9 3544 /**
simon 0:1014af42efd9 3545 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
simon 0:1014af42efd9 3546 * @param[in,out] *S points to an instance of the filter data structure.
simon 0:1014af42efd9 3547 * @param[in] numStages number of 2nd order stages in the filter.
simon 0:1014af42efd9 3548 * @param[in] *pCoeffs points to the filter coefficients.
simon 0:1014af42efd9 3549 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3550 * @return none
simon 0:1014af42efd9 3551 */
simon 0:1014af42efd9 3552
simon 0:1014af42efd9 3553 void arm_biquad_cascade_df2T_init_f32(
simon 0:1014af42efd9 3554 arm_biquad_cascade_df2T_instance_f32 * S,
simon 0:1014af42efd9 3555 uint8_t numStages,
simon 0:1014af42efd9 3556 float32_t * pCoeffs,
simon 0:1014af42efd9 3557 float32_t * pState);
simon 0:1014af42efd9 3558
simon 0:1014af42efd9 3559
simon 0:1014af42efd9 3560
simon 0:1014af42efd9 3561 /**
simon 0:1014af42efd9 3562 * @brief Instance structure for the Q15 FIR lattice filter.
simon 0:1014af42efd9 3563 */
simon 0:1014af42efd9 3564
simon 0:1014af42efd9 3565 typedef struct
simon 0:1014af42efd9 3566 {
simon 0:1014af42efd9 3567 uint16_t numStages; /**< number of filter stages. */
simon 0:1014af42efd9 3568 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
simon 0:1014af42efd9 3569 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
simon 0:1014af42efd9 3570 } arm_fir_lattice_instance_q15;
simon 0:1014af42efd9 3571
simon 0:1014af42efd9 3572 /**
simon 0:1014af42efd9 3573 * @brief Instance structure for the Q31 FIR lattice filter.
simon 0:1014af42efd9 3574 */
simon 0:1014af42efd9 3575
simon 0:1014af42efd9 3576 typedef struct
simon 0:1014af42efd9 3577 {
simon 0:1014af42efd9 3578 uint16_t numStages; /**< number of filter stages. */
simon 0:1014af42efd9 3579 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
simon 0:1014af42efd9 3580 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
simon 0:1014af42efd9 3581 } arm_fir_lattice_instance_q31;
simon 0:1014af42efd9 3582
simon 0:1014af42efd9 3583 /**
simon 0:1014af42efd9 3584 * @brief Instance structure for the floating-point FIR lattice filter.
simon 0:1014af42efd9 3585 */
simon 0:1014af42efd9 3586
simon 0:1014af42efd9 3587 typedef struct
simon 0:1014af42efd9 3588 {
simon 0:1014af42efd9 3589 uint16_t numStages; /**< number of filter stages. */
simon 0:1014af42efd9 3590 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
simon 0:1014af42efd9 3591 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
simon 0:1014af42efd9 3592 } arm_fir_lattice_instance_f32;
simon 0:1014af42efd9 3593
simon 0:1014af42efd9 3594 /**
simon 0:1014af42efd9 3595 * @brief Initialization function for the Q15 FIR lattice filter.
simon 0:1014af42efd9 3596 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
simon 0:1014af42efd9 3597 * @param[in] numStages number of filter stages.
simon 0:1014af42efd9 3598 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
simon 0:1014af42efd9 3599 * @param[in] *pState points to the state buffer. The array is of length numStages.
simon 0:1014af42efd9 3600 * @return none.
simon 0:1014af42efd9 3601 */
simon 0:1014af42efd9 3602
simon 0:1014af42efd9 3603 void arm_fir_lattice_init_q15(
simon 0:1014af42efd9 3604 arm_fir_lattice_instance_q15 * S,
simon 0:1014af42efd9 3605 uint16_t numStages,
simon 0:1014af42efd9 3606 q15_t * pCoeffs,
simon 0:1014af42efd9 3607 q15_t * pState);
simon 0:1014af42efd9 3608
simon 0:1014af42efd9 3609
simon 0:1014af42efd9 3610 /**
simon 0:1014af42efd9 3611 * @brief Processing function for the Q15 FIR lattice filter.
simon 0:1014af42efd9 3612 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
simon 0:1014af42efd9 3613 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3614 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3615 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3616 * @return none.
simon 0:1014af42efd9 3617 */
simon 0:1014af42efd9 3618 void arm_fir_lattice_q15(
simon 0:1014af42efd9 3619 const arm_fir_lattice_instance_q15 * S,
simon 0:1014af42efd9 3620 q15_t * pSrc,
simon 0:1014af42efd9 3621 q15_t * pDst,
simon 0:1014af42efd9 3622 uint32_t blockSize);
simon 0:1014af42efd9 3623
simon 0:1014af42efd9 3624 /**
simon 0:1014af42efd9 3625 * @brief Initialization function for the Q31 FIR lattice filter.
simon 0:1014af42efd9 3626 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
simon 0:1014af42efd9 3627 * @param[in] numStages number of filter stages.
simon 0:1014af42efd9 3628 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
simon 0:1014af42efd9 3629 * @param[in] *pState points to the state buffer. The array is of length numStages.
simon 0:1014af42efd9 3630 * @return none.
simon 0:1014af42efd9 3631 */
simon 0:1014af42efd9 3632
simon 0:1014af42efd9 3633 void arm_fir_lattice_init_q31(
simon 0:1014af42efd9 3634 arm_fir_lattice_instance_q31 * S,
simon 0:1014af42efd9 3635 uint16_t numStages,
simon 0:1014af42efd9 3636 q31_t * pCoeffs,
simon 0:1014af42efd9 3637 q31_t * pState);
simon 0:1014af42efd9 3638
simon 0:1014af42efd9 3639
simon 0:1014af42efd9 3640 /**
simon 0:1014af42efd9 3641 * @brief Processing function for the Q31 FIR lattice filter.
simon 0:1014af42efd9 3642 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
simon 0:1014af42efd9 3643 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3644 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3645 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3646 * @return none.
simon 0:1014af42efd9 3647 */
simon 0:1014af42efd9 3648
simon 0:1014af42efd9 3649 void arm_fir_lattice_q31(
simon 0:1014af42efd9 3650 const arm_fir_lattice_instance_q31 * S,
simon 0:1014af42efd9 3651 q31_t * pSrc,
simon 0:1014af42efd9 3652 q31_t * pDst,
simon 0:1014af42efd9 3653 uint32_t blockSize);
simon 0:1014af42efd9 3654
simon 0:1014af42efd9 3655 /**
simon 0:1014af42efd9 3656 * @brief Initialization function for the floating-point FIR lattice filter.
simon 0:1014af42efd9 3657 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
simon 0:1014af42efd9 3658 * @param[in] numStages number of filter stages.
simon 0:1014af42efd9 3659 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
simon 0:1014af42efd9 3660 * @param[in] *pState points to the state buffer. The array is of length numStages.
simon 0:1014af42efd9 3661 * @return none.
simon 0:1014af42efd9 3662 */
simon 0:1014af42efd9 3663
simon 0:1014af42efd9 3664 void arm_fir_lattice_init_f32(
simon 0:1014af42efd9 3665 arm_fir_lattice_instance_f32 * S,
simon 0:1014af42efd9 3666 uint16_t numStages,
simon 0:1014af42efd9 3667 float32_t * pCoeffs,
simon 0:1014af42efd9 3668 float32_t * pState);
simon 0:1014af42efd9 3669
simon 0:1014af42efd9 3670 /**
simon 0:1014af42efd9 3671 * @brief Processing function for the floating-point FIR lattice filter.
simon 0:1014af42efd9 3672 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
simon 0:1014af42efd9 3673 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3674 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 3675 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3676 * @return none.
simon 0:1014af42efd9 3677 */
simon 0:1014af42efd9 3678
simon 0:1014af42efd9 3679 void arm_fir_lattice_f32(
simon 0:1014af42efd9 3680 const arm_fir_lattice_instance_f32 * S,
simon 0:1014af42efd9 3681 float32_t * pSrc,
simon 0:1014af42efd9 3682 float32_t * pDst,
simon 0:1014af42efd9 3683 uint32_t blockSize);
simon 0:1014af42efd9 3684
simon 0:1014af42efd9 3685 /**
simon 0:1014af42efd9 3686 * @brief Instance structure for the Q15 IIR lattice filter.
simon 0:1014af42efd9 3687 */
simon 0:1014af42efd9 3688 typedef struct
simon 0:1014af42efd9 3689 {
simon 0:1014af42efd9 3690 uint16_t numStages; /**< number of stages in the filter. */
simon 0:1014af42efd9 3691 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
simon 0:1014af42efd9 3692 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
simon 0:1014af42efd9 3693 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
simon 0:1014af42efd9 3694 } arm_iir_lattice_instance_q15;
simon 0:1014af42efd9 3695
simon 0:1014af42efd9 3696 /**
simon 0:1014af42efd9 3697 * @brief Instance structure for the Q31 IIR lattice filter.
simon 0:1014af42efd9 3698 */
simon 0:1014af42efd9 3699 typedef struct
simon 0:1014af42efd9 3700 {
simon 0:1014af42efd9 3701 uint16_t numStages; /**< number of stages in the filter. */
simon 0:1014af42efd9 3702 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
simon 0:1014af42efd9 3703 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
simon 0:1014af42efd9 3704 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
simon 0:1014af42efd9 3705 } arm_iir_lattice_instance_q31;
simon 0:1014af42efd9 3706
simon 0:1014af42efd9 3707 /**
simon 0:1014af42efd9 3708 * @brief Instance structure for the floating-point IIR lattice filter.
simon 0:1014af42efd9 3709 */
simon 0:1014af42efd9 3710 typedef struct
simon 0:1014af42efd9 3711 {
simon 0:1014af42efd9 3712 uint16_t numStages; /**< number of stages in the filter. */
simon 0:1014af42efd9 3713 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
simon 0:1014af42efd9 3714 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
simon 0:1014af42efd9 3715 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
simon 0:1014af42efd9 3716 } arm_iir_lattice_instance_f32;
simon 0:1014af42efd9 3717
simon 0:1014af42efd9 3718 /**
simon 0:1014af42efd9 3719 * @brief Processing function for the floating-point IIR lattice filter.
simon 0:1014af42efd9 3720 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
simon 0:1014af42efd9 3721 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3722 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3723 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3724 * @return none.
simon 0:1014af42efd9 3725 */
simon 0:1014af42efd9 3726
simon 0:1014af42efd9 3727 void arm_iir_lattice_f32(
simon 0:1014af42efd9 3728 const arm_iir_lattice_instance_f32 * S,
simon 0:1014af42efd9 3729 float32_t * pSrc,
simon 0:1014af42efd9 3730 float32_t * pDst,
simon 0:1014af42efd9 3731 uint32_t blockSize);
simon 0:1014af42efd9 3732
simon 0:1014af42efd9 3733 /**
simon 0:1014af42efd9 3734 * @brief Initialization function for the floating-point IIR lattice filter.
simon 0:1014af42efd9 3735 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
simon 0:1014af42efd9 3736 * @param[in] numStages number of stages in the filter.
simon 0:1014af42efd9 3737 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
simon 0:1014af42efd9 3738 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
simon 0:1014af42efd9 3739 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
simon 0:1014af42efd9 3740 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3741 * @return none.
simon 0:1014af42efd9 3742 */
simon 0:1014af42efd9 3743
simon 0:1014af42efd9 3744 void arm_iir_lattice_init_f32(
simon 0:1014af42efd9 3745 arm_iir_lattice_instance_f32 * S,
simon 0:1014af42efd9 3746 uint16_t numStages,
simon 0:1014af42efd9 3747 float32_t *pkCoeffs,
simon 0:1014af42efd9 3748 float32_t *pvCoeffs,
simon 0:1014af42efd9 3749 float32_t *pState,
simon 0:1014af42efd9 3750 uint32_t blockSize);
simon 0:1014af42efd9 3751
simon 0:1014af42efd9 3752
simon 0:1014af42efd9 3753 /**
simon 0:1014af42efd9 3754 * @brief Processing function for the Q31 IIR lattice filter.
simon 0:1014af42efd9 3755 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
simon 0:1014af42efd9 3756 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3757 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3758 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3759 * @return none.
simon 0:1014af42efd9 3760 */
simon 0:1014af42efd9 3761
simon 0:1014af42efd9 3762 void arm_iir_lattice_q31(
simon 0:1014af42efd9 3763 const arm_iir_lattice_instance_q31 * S,
simon 0:1014af42efd9 3764 q31_t * pSrc,
simon 0:1014af42efd9 3765 q31_t * pDst,
simon 0:1014af42efd9 3766 uint32_t blockSize);
simon 0:1014af42efd9 3767
simon 0:1014af42efd9 3768
simon 0:1014af42efd9 3769 /**
simon 0:1014af42efd9 3770 * @brief Initialization function for the Q31 IIR lattice filter.
simon 0:1014af42efd9 3771 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
simon 0:1014af42efd9 3772 * @param[in] numStages number of stages in the filter.
simon 0:1014af42efd9 3773 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
simon 0:1014af42efd9 3774 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
simon 0:1014af42efd9 3775 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
simon 0:1014af42efd9 3776 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3777 * @return none.
simon 0:1014af42efd9 3778 */
simon 0:1014af42efd9 3779
simon 0:1014af42efd9 3780 void arm_iir_lattice_init_q31(
simon 0:1014af42efd9 3781 arm_iir_lattice_instance_q31 * S,
simon 0:1014af42efd9 3782 uint16_t numStages,
simon 0:1014af42efd9 3783 q31_t *pkCoeffs,
simon 0:1014af42efd9 3784 q31_t *pvCoeffs,
simon 0:1014af42efd9 3785 q31_t *pState,
simon 0:1014af42efd9 3786 uint32_t blockSize);
simon 0:1014af42efd9 3787
simon 0:1014af42efd9 3788
simon 0:1014af42efd9 3789 /**
simon 0:1014af42efd9 3790 * @brief Processing function for the Q15 IIR lattice filter.
simon 0:1014af42efd9 3791 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
simon 0:1014af42efd9 3792 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3793 * @param[out] *pDst points to the block of output data.
simon 0:1014af42efd9 3794 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3795 * @return none.
simon 0:1014af42efd9 3796 */
simon 0:1014af42efd9 3797
simon 0:1014af42efd9 3798 void arm_iir_lattice_q15(
simon 0:1014af42efd9 3799 const arm_iir_lattice_instance_q15 * S,
simon 0:1014af42efd9 3800 q15_t * pSrc,
simon 0:1014af42efd9 3801 q15_t * pDst,
simon 0:1014af42efd9 3802 uint32_t blockSize);
simon 0:1014af42efd9 3803
simon 0:1014af42efd9 3804
simon 0:1014af42efd9 3805 /**
simon 0:1014af42efd9 3806 * @brief Initialization function for the Q15 IIR lattice filter.
simon 0:1014af42efd9 3807 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
simon 0:1014af42efd9 3808 * @param[in] numStages number of stages in the filter.
simon 0:1014af42efd9 3809 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
simon 0:1014af42efd9 3810 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
simon 0:1014af42efd9 3811 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
simon 0:1014af42efd9 3812 * @param[in] blockSize number of samples to process per call.
simon 0:1014af42efd9 3813 * @return none.
simon 0:1014af42efd9 3814 */
simon 0:1014af42efd9 3815
simon 0:1014af42efd9 3816 void arm_iir_lattice_init_q15(
simon 0:1014af42efd9 3817 arm_iir_lattice_instance_q15 * S,
simon 0:1014af42efd9 3818 uint16_t numStages,
simon 0:1014af42efd9 3819 q15_t *pkCoeffs,
simon 0:1014af42efd9 3820 q15_t *pvCoeffs,
simon 0:1014af42efd9 3821 q15_t *pState,
simon 0:1014af42efd9 3822 uint32_t blockSize);
simon 0:1014af42efd9 3823
simon 0:1014af42efd9 3824 /**
simon 0:1014af42efd9 3825 * @brief Instance structure for the floating-point LMS filter.
simon 0:1014af42efd9 3826 */
simon 0:1014af42efd9 3827
simon 0:1014af42efd9 3828 typedef struct
simon 0:1014af42efd9 3829 {
simon 0:1014af42efd9 3830 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3831 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3832 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 3833 float32_t mu; /**< step size that controls filter coefficient updates. */
simon 0:1014af42efd9 3834 } arm_lms_instance_f32;
simon 0:1014af42efd9 3835
simon 0:1014af42efd9 3836 /**
simon 0:1014af42efd9 3837 * @brief Processing function for floating-point LMS filter.
simon 0:1014af42efd9 3838 * @param[in] *S points to an instance of the floating-point LMS filter structure.
simon 0:1014af42efd9 3839 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3840 * @param[in] *pRef points to the block of reference data.
simon 0:1014af42efd9 3841 * @param[out] *pOut points to the block of output data.
simon 0:1014af42efd9 3842 * @param[out] *pErr points to the block of error data.
simon 0:1014af42efd9 3843 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3844 * @return none.
simon 0:1014af42efd9 3845 */
simon 0:1014af42efd9 3846
simon 0:1014af42efd9 3847 void arm_lms_f32(
simon 0:1014af42efd9 3848 const arm_lms_instance_f32 * S,
simon 0:1014af42efd9 3849 float32_t * pSrc,
simon 0:1014af42efd9 3850 float32_t * pRef,
simon 0:1014af42efd9 3851 float32_t * pOut,
simon 0:1014af42efd9 3852 float32_t * pErr,
simon 0:1014af42efd9 3853 uint32_t blockSize);
simon 0:1014af42efd9 3854
simon 0:1014af42efd9 3855 /**
simon 0:1014af42efd9 3856 * @brief Initialization function for floating-point LMS filter.
simon 0:1014af42efd9 3857 * @param[in] *S points to an instance of the floating-point LMS filter structure.
simon 0:1014af42efd9 3858 * @param[in] numTaps number of filter coefficients.
simon 0:1014af42efd9 3859 * @param[in] *pCoeffs points to the coefficient buffer.
simon 0:1014af42efd9 3860 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 3861 * @param[in] mu step size that controls filter coefficient updates.
simon 0:1014af42efd9 3862 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3863 * @return none.
simon 0:1014af42efd9 3864 */
simon 0:1014af42efd9 3865
simon 0:1014af42efd9 3866 void arm_lms_init_f32(
simon 0:1014af42efd9 3867 arm_lms_instance_f32 * S,
simon 0:1014af42efd9 3868 uint16_t numTaps,
simon 0:1014af42efd9 3869 float32_t * pCoeffs,
simon 0:1014af42efd9 3870 float32_t * pState,
simon 0:1014af42efd9 3871 float32_t mu,
simon 0:1014af42efd9 3872 uint32_t blockSize);
simon 0:1014af42efd9 3873
simon 0:1014af42efd9 3874 /**
simon 0:1014af42efd9 3875 * @brief Instance structure for the Q15 LMS filter.
simon 0:1014af42efd9 3876 */
simon 0:1014af42efd9 3877
simon 0:1014af42efd9 3878 typedef struct
simon 0:1014af42efd9 3879 {
simon 0:1014af42efd9 3880 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3881 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3882 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 3883 q15_t mu; /**< step size that controls filter coefficient updates. */
simon 0:1014af42efd9 3884 uint32_t postShift; /**< bit shift applied to coefficients. */
simon 0:1014af42efd9 3885 } arm_lms_instance_q15;
simon 0:1014af42efd9 3886
simon 0:1014af42efd9 3887
simon 0:1014af42efd9 3888 /**
simon 0:1014af42efd9 3889 * @brief Initialization function for the Q15 LMS filter.
simon 0:1014af42efd9 3890 * @param[in] *S points to an instance of the Q15 LMS filter structure.
simon 0:1014af42efd9 3891 * @param[in] numTaps number of filter coefficients.
simon 0:1014af42efd9 3892 * @param[in] *pCoeffs points to the coefficient buffer.
simon 0:1014af42efd9 3893 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 3894 * @param[in] mu step size that controls filter coefficient updates.
simon 0:1014af42efd9 3895 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3896 * @param[in] postShift bit shift applied to coefficients.
simon 0:1014af42efd9 3897 * @return none.
simon 0:1014af42efd9 3898 */
simon 0:1014af42efd9 3899
simon 0:1014af42efd9 3900 void arm_lms_init_q15(
simon 0:1014af42efd9 3901 arm_lms_instance_q15 * S,
simon 0:1014af42efd9 3902 uint16_t numTaps,
simon 0:1014af42efd9 3903 q15_t * pCoeffs,
simon 0:1014af42efd9 3904 q15_t * pState,
simon 0:1014af42efd9 3905 q15_t mu,
simon 0:1014af42efd9 3906 uint32_t blockSize,
simon 0:1014af42efd9 3907 uint32_t postShift);
simon 0:1014af42efd9 3908
simon 0:1014af42efd9 3909 /**
simon 0:1014af42efd9 3910 * @brief Processing function for Q15 LMS filter.
simon 0:1014af42efd9 3911 * @param[in] *S points to an instance of the Q15 LMS filter structure.
simon 0:1014af42efd9 3912 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3913 * @param[in] *pRef points to the block of reference data.
simon 0:1014af42efd9 3914 * @param[out] *pOut points to the block of output data.
simon 0:1014af42efd9 3915 * @param[out] *pErr points to the block of error data.
simon 0:1014af42efd9 3916 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3917 * @return none.
simon 0:1014af42efd9 3918 */
simon 0:1014af42efd9 3919
simon 0:1014af42efd9 3920 void arm_lms_q15(
simon 0:1014af42efd9 3921 const arm_lms_instance_q15 * S,
simon 0:1014af42efd9 3922 q15_t * pSrc,
simon 0:1014af42efd9 3923 q15_t * pRef,
simon 0:1014af42efd9 3924 q15_t * pOut,
simon 0:1014af42efd9 3925 q15_t * pErr,
simon 0:1014af42efd9 3926 uint32_t blockSize);
simon 0:1014af42efd9 3927
simon 0:1014af42efd9 3928
simon 0:1014af42efd9 3929 /**
simon 0:1014af42efd9 3930 * @brief Instance structure for the Q31 LMS filter.
simon 0:1014af42efd9 3931 */
simon 0:1014af42efd9 3932
simon 0:1014af42efd9 3933 typedef struct
simon 0:1014af42efd9 3934 {
simon 0:1014af42efd9 3935 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3936 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3937 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 3938 q31_t mu; /**< step size that controls filter coefficient updates. */
simon 0:1014af42efd9 3939 uint32_t postShift; /**< bit shift applied to coefficients. */
simon 0:1014af42efd9 3940
simon 0:1014af42efd9 3941 } arm_lms_instance_q31;
simon 0:1014af42efd9 3942
simon 0:1014af42efd9 3943 /**
simon 0:1014af42efd9 3944 * @brief Processing function for Q31 LMS filter.
simon 0:1014af42efd9 3945 * @param[in] *S points to an instance of the Q15 LMS filter structure.
simon 0:1014af42efd9 3946 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 3947 * @param[in] *pRef points to the block of reference data.
simon 0:1014af42efd9 3948 * @param[out] *pOut points to the block of output data.
simon 0:1014af42efd9 3949 * @param[out] *pErr points to the block of error data.
simon 0:1014af42efd9 3950 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3951 * @return none.
simon 0:1014af42efd9 3952 */
simon 0:1014af42efd9 3953
simon 0:1014af42efd9 3954 void arm_lms_q31(
simon 0:1014af42efd9 3955 const arm_lms_instance_q31 * S,
simon 0:1014af42efd9 3956 q31_t * pSrc,
simon 0:1014af42efd9 3957 q31_t * pRef,
simon 0:1014af42efd9 3958 q31_t * pOut,
simon 0:1014af42efd9 3959 q31_t * pErr,
simon 0:1014af42efd9 3960 uint32_t blockSize);
simon 0:1014af42efd9 3961
simon 0:1014af42efd9 3962 /**
simon 0:1014af42efd9 3963 * @brief Initialization function for Q31 LMS filter.
simon 0:1014af42efd9 3964 * @param[in] *S points to an instance of the Q31 LMS filter structure.
simon 0:1014af42efd9 3965 * @param[in] numTaps number of filter coefficients.
simon 0:1014af42efd9 3966 * @param[in] *pCoeffs points to coefficient buffer.
simon 0:1014af42efd9 3967 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 3968 * @param[in] mu step size that controls filter coefficient updates.
simon 0:1014af42efd9 3969 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 3970 * @param[in] postShift bit shift applied to coefficients.
simon 0:1014af42efd9 3971 * @return none.
simon 0:1014af42efd9 3972 */
simon 0:1014af42efd9 3973
simon 0:1014af42efd9 3974 void arm_lms_init_q31(
simon 0:1014af42efd9 3975 arm_lms_instance_q31 * S,
simon 0:1014af42efd9 3976 uint16_t numTaps,
simon 0:1014af42efd9 3977 q31_t *pCoeffs,
simon 0:1014af42efd9 3978 q31_t *pState,
simon 0:1014af42efd9 3979 q31_t mu,
simon 0:1014af42efd9 3980 uint32_t blockSize,
simon 0:1014af42efd9 3981 uint32_t postShift);
simon 0:1014af42efd9 3982
simon 0:1014af42efd9 3983 /**
simon 0:1014af42efd9 3984 * @brief Instance structure for the floating-point normalized LMS filter.
simon 0:1014af42efd9 3985 */
simon 0:1014af42efd9 3986
simon 0:1014af42efd9 3987 typedef struct
simon 0:1014af42efd9 3988 {
simon 0:1014af42efd9 3989 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 3990 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 3991 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 3992 float32_t mu; /**< step size that control filter coefficient updates. */
simon 0:1014af42efd9 3993 float32_t energy; /**< saves previous frame energy. */
simon 0:1014af42efd9 3994 float32_t x0; /**< saves previous input sample. */
simon 0:1014af42efd9 3995 } arm_lms_norm_instance_f32;
simon 0:1014af42efd9 3996
simon 0:1014af42efd9 3997 /**
simon 0:1014af42efd9 3998 * @brief Processing function for floating-point normalized LMS filter.
simon 0:1014af42efd9 3999 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
simon 0:1014af42efd9 4000 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4001 * @param[in] *pRef points to the block of reference data.
simon 0:1014af42efd9 4002 * @param[out] *pOut points to the block of output data.
simon 0:1014af42efd9 4003 * @param[out] *pErr points to the block of error data.
simon 0:1014af42efd9 4004 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 4005 * @return none.
simon 0:1014af42efd9 4006 */
simon 0:1014af42efd9 4007
simon 0:1014af42efd9 4008 void arm_lms_norm_f32(
simon 0:1014af42efd9 4009 arm_lms_norm_instance_f32 * S,
simon 0:1014af42efd9 4010 float32_t * pSrc,
simon 0:1014af42efd9 4011 float32_t * pRef,
simon 0:1014af42efd9 4012 float32_t * pOut,
simon 0:1014af42efd9 4013 float32_t * pErr,
simon 0:1014af42efd9 4014 uint32_t blockSize);
simon 0:1014af42efd9 4015
simon 0:1014af42efd9 4016 /**
simon 0:1014af42efd9 4017 * @brief Initialization function for floating-point normalized LMS filter.
simon 0:1014af42efd9 4018 * @param[in] *S points to an instance of the floating-point LMS filter structure.
simon 0:1014af42efd9 4019 * @param[in] numTaps number of filter coefficients.
simon 0:1014af42efd9 4020 * @param[in] *pCoeffs points to coefficient buffer.
simon 0:1014af42efd9 4021 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 4022 * @param[in] mu step size that controls filter coefficient updates.
simon 0:1014af42efd9 4023 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 4024 * @return none.
simon 0:1014af42efd9 4025 */
simon 0:1014af42efd9 4026
simon 0:1014af42efd9 4027 void arm_lms_norm_init_f32(
simon 0:1014af42efd9 4028 arm_lms_norm_instance_f32 * S,
simon 0:1014af42efd9 4029 uint16_t numTaps,
simon 0:1014af42efd9 4030 float32_t * pCoeffs,
simon 0:1014af42efd9 4031 float32_t * pState,
simon 0:1014af42efd9 4032 float32_t mu,
simon 0:1014af42efd9 4033 uint32_t blockSize);
simon 0:1014af42efd9 4034
simon 0:1014af42efd9 4035
simon 0:1014af42efd9 4036 /**
simon 0:1014af42efd9 4037 * @brief Instance structure for the Q31 normalized LMS filter.
simon 0:1014af42efd9 4038 */
simon 0:1014af42efd9 4039 typedef struct
simon 0:1014af42efd9 4040 {
simon 0:1014af42efd9 4041 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 4042 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 4043 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 4044 q31_t mu; /**< step size that controls filter coefficient updates. */
simon 0:1014af42efd9 4045 uint8_t postShift; /**< bit shift applied to coefficients. */
simon 0:1014af42efd9 4046 q31_t *recipTable; /**< points to the reciprocal initial value table. */
simon 0:1014af42efd9 4047 q31_t energy; /**< saves previous frame energy. */
simon 0:1014af42efd9 4048 q31_t x0; /**< saves previous input sample. */
simon 0:1014af42efd9 4049 } arm_lms_norm_instance_q31;
simon 0:1014af42efd9 4050
simon 0:1014af42efd9 4051 /**
simon 0:1014af42efd9 4052 * @brief Processing function for Q31 normalized LMS filter.
simon 0:1014af42efd9 4053 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
simon 0:1014af42efd9 4054 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4055 * @param[in] *pRef points to the block of reference data.
simon 0:1014af42efd9 4056 * @param[out] *pOut points to the block of output data.
simon 0:1014af42efd9 4057 * @param[out] *pErr points to the block of error data.
simon 0:1014af42efd9 4058 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 4059 * @return none.
simon 0:1014af42efd9 4060 */
simon 0:1014af42efd9 4061
simon 0:1014af42efd9 4062 void arm_lms_norm_q31(
simon 0:1014af42efd9 4063 arm_lms_norm_instance_q31 * S,
simon 0:1014af42efd9 4064 q31_t * pSrc,
simon 0:1014af42efd9 4065 q31_t * pRef,
simon 0:1014af42efd9 4066 q31_t * pOut,
simon 0:1014af42efd9 4067 q31_t * pErr,
simon 0:1014af42efd9 4068 uint32_t blockSize);
simon 0:1014af42efd9 4069
simon 0:1014af42efd9 4070 /**
simon 0:1014af42efd9 4071 * @brief Initialization function for Q31 normalized LMS filter.
simon 0:1014af42efd9 4072 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
simon 0:1014af42efd9 4073 * @param[in] numTaps number of filter coefficients.
simon 0:1014af42efd9 4074 * @param[in] *pCoeffs points to coefficient buffer.
simon 0:1014af42efd9 4075 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 4076 * @param[in] mu step size that controls filter coefficient updates.
simon 0:1014af42efd9 4077 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 4078 * @param[in] postShift bit shift applied to coefficients.
simon 0:1014af42efd9 4079 * @return none.
simon 0:1014af42efd9 4080 */
simon 0:1014af42efd9 4081
simon 0:1014af42efd9 4082 void arm_lms_norm_init_q31(
simon 0:1014af42efd9 4083 arm_lms_norm_instance_q31 * S,
simon 0:1014af42efd9 4084 uint16_t numTaps,
simon 0:1014af42efd9 4085 q31_t * pCoeffs,
simon 0:1014af42efd9 4086 q31_t * pState,
simon 0:1014af42efd9 4087 q31_t mu,
simon 0:1014af42efd9 4088 uint32_t blockSize,
simon 0:1014af42efd9 4089 uint8_t postShift);
simon 0:1014af42efd9 4090
simon 0:1014af42efd9 4091 /**
simon 0:1014af42efd9 4092 * @brief Instance structure for the Q15 normalized LMS filter.
simon 0:1014af42efd9 4093 */
simon 0:1014af42efd9 4094
simon 0:1014af42efd9 4095 typedef struct
simon 0:1014af42efd9 4096 {
simon 0:1014af42efd9 4097 uint16_t numTaps; /**< Number of coefficients in the filter. */
simon 0:1014af42efd9 4098 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
simon 0:1014af42efd9 4099 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
simon 0:1014af42efd9 4100 q15_t mu; /**< step size that controls filter coefficient updates. */
simon 0:1014af42efd9 4101 uint8_t postShift; /**< bit shift applied to coefficients. */
simon 0:1014af42efd9 4102 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
simon 0:1014af42efd9 4103 q15_t energy; /**< saves previous frame energy. */
simon 0:1014af42efd9 4104 q15_t x0; /**< saves previous input sample. */
simon 0:1014af42efd9 4105 } arm_lms_norm_instance_q15;
simon 0:1014af42efd9 4106
simon 0:1014af42efd9 4107 /**
simon 0:1014af42efd9 4108 * @brief Processing function for Q15 normalized LMS filter.
simon 0:1014af42efd9 4109 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
simon 0:1014af42efd9 4110 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4111 * @param[in] *pRef points to the block of reference data.
simon 0:1014af42efd9 4112 * @param[out] *pOut points to the block of output data.
simon 0:1014af42efd9 4113 * @param[out] *pErr points to the block of error data.
simon 0:1014af42efd9 4114 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 4115 * @return none.
simon 0:1014af42efd9 4116 */
simon 0:1014af42efd9 4117
simon 0:1014af42efd9 4118 void arm_lms_norm_q15(
simon 0:1014af42efd9 4119 arm_lms_norm_instance_q15 * S,
simon 0:1014af42efd9 4120 q15_t * pSrc,
simon 0:1014af42efd9 4121 q15_t * pRef,
simon 0:1014af42efd9 4122 q15_t * pOut,
simon 0:1014af42efd9 4123 q15_t * pErr,
simon 0:1014af42efd9 4124 uint32_t blockSize);
simon 0:1014af42efd9 4125
simon 0:1014af42efd9 4126
simon 0:1014af42efd9 4127 /**
simon 0:1014af42efd9 4128 * @brief Initialization function for Q15 normalized LMS filter.
simon 0:1014af42efd9 4129 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
simon 0:1014af42efd9 4130 * @param[in] numTaps number of filter coefficients.
simon 0:1014af42efd9 4131 * @param[in] *pCoeffs points to coefficient buffer.
simon 0:1014af42efd9 4132 * @param[in] *pState points to state buffer.
simon 0:1014af42efd9 4133 * @param[in] mu step size that controls filter coefficient updates.
simon 0:1014af42efd9 4134 * @param[in] blockSize number of samples to process.
simon 0:1014af42efd9 4135 * @param[in] postShift bit shift applied to coefficients.
simon 0:1014af42efd9 4136 * @return none.
simon 0:1014af42efd9 4137 */
simon 0:1014af42efd9 4138
simon 0:1014af42efd9 4139 void arm_lms_norm_init_q15(
simon 0:1014af42efd9 4140 arm_lms_norm_instance_q15 * S,
simon 0:1014af42efd9 4141 uint16_t numTaps,
simon 0:1014af42efd9 4142 q15_t * pCoeffs,
simon 0:1014af42efd9 4143 q15_t * pState,
simon 0:1014af42efd9 4144 q15_t mu,
simon 0:1014af42efd9 4145 uint32_t blockSize,
simon 0:1014af42efd9 4146 uint8_t postShift);
simon 0:1014af42efd9 4147
simon 0:1014af42efd9 4148 /**
simon 0:1014af42efd9 4149 * @brief Correlation of floating-point sequences.
simon 0:1014af42efd9 4150 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 4151 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 4152 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 4153 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 4154 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
simon 0:1014af42efd9 4155 * @return none.
simon 0:1014af42efd9 4156 */
simon 0:1014af42efd9 4157
simon 0:1014af42efd9 4158 void arm_correlate_f32(
simon 0:1014af42efd9 4159 float32_t * pSrcA,
simon 0:1014af42efd9 4160 uint32_t srcALen,
simon 0:1014af42efd9 4161 float32_t * pSrcB,
simon 0:1014af42efd9 4162 uint32_t srcBLen,
simon 0:1014af42efd9 4163 float32_t * pDst);
simon 0:1014af42efd9 4164
simon 0:1014af42efd9 4165 /**
simon 0:1014af42efd9 4166 * @brief Correlation of Q15 sequences
simon 0:1014af42efd9 4167 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 4168 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 4169 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 4170 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 4171 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
simon 0:1014af42efd9 4172 * @return none.
simon 0:1014af42efd9 4173 */
simon 0:1014af42efd9 4174
simon 0:1014af42efd9 4175 void arm_correlate_q15(
simon 0:1014af42efd9 4176 q15_t * pSrcA,
simon 0:1014af42efd9 4177 uint32_t srcALen,
simon 0:1014af42efd9 4178 q15_t * pSrcB,
simon 0:1014af42efd9 4179 uint32_t srcBLen,
simon 0:1014af42efd9 4180 q15_t * pDst);
simon 0:1014af42efd9 4181
simon 0:1014af42efd9 4182 /**
simon 0:1014af42efd9 4183 * @brief Correlation of Q15 sequences (fast version).
simon 0:1014af42efd9 4184 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 4185 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 4186 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 4187 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 4188 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
simon 0:1014af42efd9 4189 * @return none.
simon 0:1014af42efd9 4190 */
simon 0:1014af42efd9 4191
simon 0:1014af42efd9 4192 void arm_correlate_fast_q15(
simon 0:1014af42efd9 4193 q15_t * pSrcA,
simon 0:1014af42efd9 4194 uint32_t srcALen,
simon 0:1014af42efd9 4195 q15_t * pSrcB,
simon 0:1014af42efd9 4196 uint32_t srcBLen,
simon 0:1014af42efd9 4197 q15_t * pDst);
simon 0:1014af42efd9 4198
simon 0:1014af42efd9 4199 /**
simon 0:1014af42efd9 4200 * @brief Correlate Q31 sequences
simon 0:1014af42efd9 4201 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 4202 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 4203 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 4204 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 4205 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
simon 0:1014af42efd9 4206 * @return none.
simon 0:1014af42efd9 4207 */
simon 0:1014af42efd9 4208
simon 0:1014af42efd9 4209 void arm_correlate_q31(
simon 0:1014af42efd9 4210 q31_t * pSrcA,
simon 0:1014af42efd9 4211 uint32_t srcALen,
simon 0:1014af42efd9 4212 q31_t * pSrcB,
simon 0:1014af42efd9 4213 uint32_t srcBLen,
simon 0:1014af42efd9 4214 q31_t * pDst);
simon 0:1014af42efd9 4215
simon 0:1014af42efd9 4216 /**
simon 0:1014af42efd9 4217 * @brief Correlate Q31 sequences (fast version)
simon 0:1014af42efd9 4218 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 4219 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 4220 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 4221 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 4222 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
simon 0:1014af42efd9 4223 * @return none.
simon 0:1014af42efd9 4224 */
simon 0:1014af42efd9 4225
simon 0:1014af42efd9 4226 void arm_correlate_fast_q31(
simon 0:1014af42efd9 4227 q31_t * pSrcA,
simon 0:1014af42efd9 4228 uint32_t srcALen,
simon 0:1014af42efd9 4229 q31_t * pSrcB,
simon 0:1014af42efd9 4230 uint32_t srcBLen,
simon 0:1014af42efd9 4231 q31_t * pDst);
simon 0:1014af42efd9 4232
simon 0:1014af42efd9 4233 /**
simon 0:1014af42efd9 4234 * @brief Correlation of Q7 sequences.
simon 0:1014af42efd9 4235 * @param[in] *pSrcA points to the first input sequence.
simon 0:1014af42efd9 4236 * @param[in] srcALen length of the first input sequence.
simon 0:1014af42efd9 4237 * @param[in] *pSrcB points to the second input sequence.
simon 0:1014af42efd9 4238 * @param[in] srcBLen length of the second input sequence.
simon 0:1014af42efd9 4239 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
simon 0:1014af42efd9 4240 * @return none.
simon 0:1014af42efd9 4241 */
simon 0:1014af42efd9 4242
simon 0:1014af42efd9 4243 void arm_correlate_q7(
simon 0:1014af42efd9 4244 q7_t * pSrcA,
simon 0:1014af42efd9 4245 uint32_t srcALen,
simon 0:1014af42efd9 4246 q7_t * pSrcB,
simon 0:1014af42efd9 4247 uint32_t srcBLen,
simon 0:1014af42efd9 4248 q7_t * pDst);
simon 0:1014af42efd9 4249
simon 0:1014af42efd9 4250 /**
simon 0:1014af42efd9 4251 * @brief Instance structure for the floating-point sparse FIR filter.
simon 0:1014af42efd9 4252 */
simon 0:1014af42efd9 4253 typedef struct
simon 0:1014af42efd9 4254 {
simon 0:1014af42efd9 4255 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 4256 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
simon 0:1014af42efd9 4257 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
simon 0:1014af42efd9 4258 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 4259 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
simon 0:1014af42efd9 4260 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
simon 0:1014af42efd9 4261 } arm_fir_sparse_instance_f32;
simon 0:1014af42efd9 4262
simon 0:1014af42efd9 4263 /**
simon 0:1014af42efd9 4264 * @brief Instance structure for the Q31 sparse FIR filter.
simon 0:1014af42efd9 4265 */
simon 0:1014af42efd9 4266
simon 0:1014af42efd9 4267 typedef struct
simon 0:1014af42efd9 4268 {
simon 0:1014af42efd9 4269 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 4270 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
simon 0:1014af42efd9 4271 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
simon 0:1014af42efd9 4272 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 4273 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
simon 0:1014af42efd9 4274 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
simon 0:1014af42efd9 4275 } arm_fir_sparse_instance_q31;
simon 0:1014af42efd9 4276
simon 0:1014af42efd9 4277 /**
simon 0:1014af42efd9 4278 * @brief Instance structure for the Q15 sparse FIR filter.
simon 0:1014af42efd9 4279 */
simon 0:1014af42efd9 4280
simon 0:1014af42efd9 4281 typedef struct
simon 0:1014af42efd9 4282 {
simon 0:1014af42efd9 4283 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 4284 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
simon 0:1014af42efd9 4285 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
simon 0:1014af42efd9 4286 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 4287 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
simon 0:1014af42efd9 4288 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
simon 0:1014af42efd9 4289 } arm_fir_sparse_instance_q15;
simon 0:1014af42efd9 4290
simon 0:1014af42efd9 4291 /**
simon 0:1014af42efd9 4292 * @brief Instance structure for the Q7 sparse FIR filter.
simon 0:1014af42efd9 4293 */
simon 0:1014af42efd9 4294
simon 0:1014af42efd9 4295 typedef struct
simon 0:1014af42efd9 4296 {
simon 0:1014af42efd9 4297 uint16_t numTaps; /**< number of coefficients in the filter. */
simon 0:1014af42efd9 4298 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
simon 0:1014af42efd9 4299 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
simon 0:1014af42efd9 4300 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
simon 0:1014af42efd9 4301 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
simon 0:1014af42efd9 4302 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
simon 0:1014af42efd9 4303 } arm_fir_sparse_instance_q7;
simon 0:1014af42efd9 4304
simon 0:1014af42efd9 4305 /**
simon 0:1014af42efd9 4306 * @brief Processing function for the floating-point sparse FIR filter.
simon 0:1014af42efd9 4307 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
simon 0:1014af42efd9 4308 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4309 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 4310 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
simon 0:1014af42efd9 4311 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 4312 * @return none.
simon 0:1014af42efd9 4313 */
simon 0:1014af42efd9 4314
simon 0:1014af42efd9 4315 void arm_fir_sparse_f32(
simon 0:1014af42efd9 4316 arm_fir_sparse_instance_f32 * S,
simon 0:1014af42efd9 4317 float32_t * pSrc,
simon 0:1014af42efd9 4318 float32_t * pDst,
simon 0:1014af42efd9 4319 float32_t * pScratchIn,
simon 0:1014af42efd9 4320 uint32_t blockSize);
simon 0:1014af42efd9 4321
simon 0:1014af42efd9 4322 /**
simon 0:1014af42efd9 4323 * @brief Initialization function for the floating-point sparse FIR filter.
simon 0:1014af42efd9 4324 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
simon 0:1014af42efd9 4325 * @param[in] numTaps number of nonzero coefficients in the filter.
simon 0:1014af42efd9 4326 * @param[in] *pCoeffs points to the array of filter coefficients.
simon 0:1014af42efd9 4327 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 4328 * @param[in] *pTapDelay points to the array of offset times.
simon 0:1014af42efd9 4329 * @param[in] maxDelay maximum offset time supported.
simon 0:1014af42efd9 4330 * @param[in] blockSize number of samples that will be processed per block.
simon 0:1014af42efd9 4331 * @return none
simon 0:1014af42efd9 4332 */
simon 0:1014af42efd9 4333
simon 0:1014af42efd9 4334 void arm_fir_sparse_init_f32(
simon 0:1014af42efd9 4335 arm_fir_sparse_instance_f32 * S,
simon 0:1014af42efd9 4336 uint16_t numTaps,
simon 0:1014af42efd9 4337 float32_t * pCoeffs,
simon 0:1014af42efd9 4338 float32_t * pState,
simon 0:1014af42efd9 4339 int32_t * pTapDelay,
simon 0:1014af42efd9 4340 uint16_t maxDelay,
simon 0:1014af42efd9 4341 uint32_t blockSize);
simon 0:1014af42efd9 4342
simon 0:1014af42efd9 4343 /**
simon 0:1014af42efd9 4344 * @brief Processing function for the Q31 sparse FIR filter.
simon 0:1014af42efd9 4345 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
simon 0:1014af42efd9 4346 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4347 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 4348 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
simon 0:1014af42efd9 4349 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 4350 * @return none.
simon 0:1014af42efd9 4351 */
simon 0:1014af42efd9 4352
simon 0:1014af42efd9 4353 void arm_fir_sparse_q31(
simon 0:1014af42efd9 4354 arm_fir_sparse_instance_q31 * S,
simon 0:1014af42efd9 4355 q31_t * pSrc,
simon 0:1014af42efd9 4356 q31_t * pDst,
simon 0:1014af42efd9 4357 q31_t * pScratchIn,
simon 0:1014af42efd9 4358 uint32_t blockSize);
simon 0:1014af42efd9 4359
simon 0:1014af42efd9 4360 /**
simon 0:1014af42efd9 4361 * @brief Initialization function for the Q31 sparse FIR filter.
simon 0:1014af42efd9 4362 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
simon 0:1014af42efd9 4363 * @param[in] numTaps number of nonzero coefficients in the filter.
simon 0:1014af42efd9 4364 * @param[in] *pCoeffs points to the array of filter coefficients.
simon 0:1014af42efd9 4365 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 4366 * @param[in] *pTapDelay points to the array of offset times.
simon 0:1014af42efd9 4367 * @param[in] maxDelay maximum offset time supported.
simon 0:1014af42efd9 4368 * @param[in] blockSize number of samples that will be processed per block.
simon 0:1014af42efd9 4369 * @return none
simon 0:1014af42efd9 4370 */
simon 0:1014af42efd9 4371
simon 0:1014af42efd9 4372 void arm_fir_sparse_init_q31(
simon 0:1014af42efd9 4373 arm_fir_sparse_instance_q31 * S,
simon 0:1014af42efd9 4374 uint16_t numTaps,
simon 0:1014af42efd9 4375 q31_t * pCoeffs,
simon 0:1014af42efd9 4376 q31_t * pState,
simon 0:1014af42efd9 4377 int32_t * pTapDelay,
simon 0:1014af42efd9 4378 uint16_t maxDelay,
simon 0:1014af42efd9 4379 uint32_t blockSize);
simon 0:1014af42efd9 4380
simon 0:1014af42efd9 4381 /**
simon 0:1014af42efd9 4382 * @brief Processing function for the Q15 sparse FIR filter.
simon 0:1014af42efd9 4383 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
simon 0:1014af42efd9 4384 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4385 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 4386 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
simon 0:1014af42efd9 4387 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
simon 0:1014af42efd9 4388 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 4389 * @return none.
simon 0:1014af42efd9 4390 */
simon 0:1014af42efd9 4391
simon 0:1014af42efd9 4392 void arm_fir_sparse_q15(
simon 0:1014af42efd9 4393 arm_fir_sparse_instance_q15 * S,
simon 0:1014af42efd9 4394 q15_t * pSrc,
simon 0:1014af42efd9 4395 q15_t * pDst,
simon 0:1014af42efd9 4396 q15_t * pScratchIn,
simon 0:1014af42efd9 4397 q31_t * pScratchOut,
simon 0:1014af42efd9 4398 uint32_t blockSize);
simon 0:1014af42efd9 4399
simon 0:1014af42efd9 4400
simon 0:1014af42efd9 4401 /**
simon 0:1014af42efd9 4402 * @brief Initialization function for the Q15 sparse FIR filter.
simon 0:1014af42efd9 4403 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
simon 0:1014af42efd9 4404 * @param[in] numTaps number of nonzero coefficients in the filter.
simon 0:1014af42efd9 4405 * @param[in] *pCoeffs points to the array of filter coefficients.
simon 0:1014af42efd9 4406 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 4407 * @param[in] *pTapDelay points to the array of offset times.
simon 0:1014af42efd9 4408 * @param[in] maxDelay maximum offset time supported.
simon 0:1014af42efd9 4409 * @param[in] blockSize number of samples that will be processed per block.
simon 0:1014af42efd9 4410 * @return none
simon 0:1014af42efd9 4411 */
simon 0:1014af42efd9 4412
simon 0:1014af42efd9 4413 void arm_fir_sparse_init_q15(
simon 0:1014af42efd9 4414 arm_fir_sparse_instance_q15 * S,
simon 0:1014af42efd9 4415 uint16_t numTaps,
simon 0:1014af42efd9 4416 q15_t * pCoeffs,
simon 0:1014af42efd9 4417 q15_t * pState,
simon 0:1014af42efd9 4418 int32_t * pTapDelay,
simon 0:1014af42efd9 4419 uint16_t maxDelay,
simon 0:1014af42efd9 4420 uint32_t blockSize);
simon 0:1014af42efd9 4421
simon 0:1014af42efd9 4422 /**
simon 0:1014af42efd9 4423 * @brief Processing function for the Q7 sparse FIR filter.
simon 0:1014af42efd9 4424 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
simon 0:1014af42efd9 4425 * @param[in] *pSrc points to the block of input data.
simon 0:1014af42efd9 4426 * @param[out] *pDst points to the block of output data
simon 0:1014af42efd9 4427 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
simon 0:1014af42efd9 4428 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
simon 0:1014af42efd9 4429 * @param[in] blockSize number of input samples to process per call.
simon 0:1014af42efd9 4430 * @return none.
simon 0:1014af42efd9 4431 */
simon 0:1014af42efd9 4432
simon 0:1014af42efd9 4433 void arm_fir_sparse_q7(
simon 0:1014af42efd9 4434 arm_fir_sparse_instance_q7 * S,
simon 0:1014af42efd9 4435 q7_t * pSrc,
simon 0:1014af42efd9 4436 q7_t * pDst,
simon 0:1014af42efd9 4437 q7_t * pScratchIn,
simon 0:1014af42efd9 4438 q31_t * pScratchOut,
simon 0:1014af42efd9 4439 uint32_t blockSize);
simon 0:1014af42efd9 4440
simon 0:1014af42efd9 4441 /**
simon 0:1014af42efd9 4442 * @brief Initialization function for the Q7 sparse FIR filter.
simon 0:1014af42efd9 4443 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
simon 0:1014af42efd9 4444 * @param[in] numTaps number of nonzero coefficients in the filter.
simon 0:1014af42efd9 4445 * @param[in] *pCoeffs points to the array of filter coefficients.
simon 0:1014af42efd9 4446 * @param[in] *pState points to the state buffer.
simon 0:1014af42efd9 4447 * @param[in] *pTapDelay points to the array of offset times.
simon 0:1014af42efd9 4448 * @param[in] maxDelay maximum offset time supported.
simon 0:1014af42efd9 4449 * @param[in] blockSize number of samples that will be processed per block.
simon 0:1014af42efd9 4450 * @return none
simon 0:1014af42efd9 4451 */
simon 0:1014af42efd9 4452
simon 0:1014af42efd9 4453 void arm_fir_sparse_init_q7(
simon 0:1014af42efd9 4454 arm_fir_sparse_instance_q7 * S,
simon 0:1014af42efd9 4455 uint16_t numTaps,
simon 0:1014af42efd9 4456 q7_t * pCoeffs,
simon 0:1014af42efd9 4457 q7_t * pState,
simon 0:1014af42efd9 4458 int32_t *pTapDelay,
simon 0:1014af42efd9 4459 uint16_t maxDelay,
simon 0:1014af42efd9 4460 uint32_t blockSize);
simon 0:1014af42efd9 4461
simon 0:1014af42efd9 4462
simon 0:1014af42efd9 4463 /*
simon 0:1014af42efd9 4464 * @brief Floating-point sin_cos function.
simon 0:1014af42efd9 4465 * @param[in] theta input value in degrees
simon 0:1014af42efd9 4466 * @param[out] *pSinVal points to the processed sine output.
simon 0:1014af42efd9 4467 * @param[out] *pCosVal points to the processed cos output.
simon 0:1014af42efd9 4468 * @return none.
simon 0:1014af42efd9 4469 */
simon 0:1014af42efd9 4470
simon 0:1014af42efd9 4471 void arm_sin_cos_f32(
simon 0:1014af42efd9 4472 float32_t theta,
simon 0:1014af42efd9 4473 float32_t *pSinVal,
simon 0:1014af42efd9 4474 float32_t *pCcosVal);
simon 0:1014af42efd9 4475
simon 0:1014af42efd9 4476 /*
simon 0:1014af42efd9 4477 * @brief Q31 sin_cos function.
simon 0:1014af42efd9 4478 * @param[in] theta scaled input value in degrees
simon 0:1014af42efd9 4479 * @param[out] *pSinVal points to the processed sine output.
simon 0:1014af42efd9 4480 * @param[out] *pCosVal points to the processed cosine output.
simon 0:1014af42efd9 4481 * @return none.
simon 0:1014af42efd9 4482 */
simon 0:1014af42efd9 4483
simon 0:1014af42efd9 4484 void arm_sin_cos_q31(
simon 0:1014af42efd9 4485 q31_t theta,
simon 0:1014af42efd9 4486 q31_t *pSinVal,
simon 0:1014af42efd9 4487 q31_t *pCosVal);
simon 0:1014af42efd9 4488
simon 0:1014af42efd9 4489
simon 0:1014af42efd9 4490 /**
simon 0:1014af42efd9 4491 * @brief Floating-point complex conjugate.
simon 0:1014af42efd9 4492 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 4493 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 4494 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 4495 * @return none.
simon 0:1014af42efd9 4496 */
simon 0:1014af42efd9 4497
simon 0:1014af42efd9 4498 void arm_cmplx_conj_f32(
simon 0:1014af42efd9 4499 float32_t * pSrc,
simon 0:1014af42efd9 4500 float32_t * pDst,
simon 0:1014af42efd9 4501 uint32_t numSamples);
simon 0:1014af42efd9 4502
simon 0:1014af42efd9 4503 /**
simon 0:1014af42efd9 4504 * @brief Q31 complex conjugate.
simon 0:1014af42efd9 4505 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 4506 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 4507 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 4508 * @return none.
simon 0:1014af42efd9 4509 */
simon 0:1014af42efd9 4510
simon 0:1014af42efd9 4511 void arm_cmplx_conj_q31(
simon 0:1014af42efd9 4512 q31_t * pSrc,
simon 0:1014af42efd9 4513 q31_t * pDst,
simon 0:1014af42efd9 4514 uint32_t numSamples);
simon 0:1014af42efd9 4515
simon 0:1014af42efd9 4516 /**
simon 0:1014af42efd9 4517 * @brief Q15 complex conjugate.
simon 0:1014af42efd9 4518 * @param[in] *pSrc points to the input vector
simon 0:1014af42efd9 4519 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 4520 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 4521 * @return none.
simon 0:1014af42efd9 4522 */
simon 0:1014af42efd9 4523
simon 0:1014af42efd9 4524 void arm_cmplx_conj_q15(
simon 0:1014af42efd9 4525 q15_t * pSrc,
simon 0:1014af42efd9 4526 q15_t * pDst,
simon 0:1014af42efd9 4527 uint32_t numSamples);
simon 0:1014af42efd9 4528
simon 0:1014af42efd9 4529
simon 0:1014af42efd9 4530
simon 0:1014af42efd9 4531 /**
simon 0:1014af42efd9 4532 * @brief Floating-point complex magnitude squared
simon 0:1014af42efd9 4533 * @param[in] *pSrc points to the complex input vector
simon 0:1014af42efd9 4534 * @param[out] *pDst points to the real output vector
simon 0:1014af42efd9 4535 * @param[in] numSamples number of complex samples in the input vector
simon 0:1014af42efd9 4536 * @return none.
simon 0:1014af42efd9 4537 */
simon 0:1014af42efd9 4538
simon 0:1014af42efd9 4539 void arm_cmplx_mag_squared_f32(
simon 0:1014af42efd9 4540 float32_t * pSrc,
simon 0:1014af42efd9 4541 float32_t * pDst,
simon 0:1014af42efd9 4542 uint32_t numSamples);
simon 0:1014af42efd9 4543
simon 0:1014af42efd9 4544 /**
simon 0:1014af42efd9 4545 * @brief Q31 complex magnitude squared
simon 0:1014af42efd9 4546 * @param[in] *pSrc points to the complex input vector
simon 0:1014af42efd9 4547 * @param[out] *pDst points to the real output vector
simon 0:1014af42efd9 4548 * @param[in] numSamples number of complex samples in the input vector
simon 0:1014af42efd9 4549 * @return none.
simon 0:1014af42efd9 4550 */
simon 0:1014af42efd9 4551
simon 0:1014af42efd9 4552 void arm_cmplx_mag_squared_q31(
simon 0:1014af42efd9 4553 q31_t * pSrc,
simon 0:1014af42efd9 4554 q31_t * pDst,
simon 0:1014af42efd9 4555 uint32_t numSamples);
simon 0:1014af42efd9 4556
simon 0:1014af42efd9 4557 /**
simon 0:1014af42efd9 4558 * @brief Q15 complex magnitude squared
simon 0:1014af42efd9 4559 * @param[in] *pSrc points to the complex input vector
simon 0:1014af42efd9 4560 * @param[out] *pDst points to the real output vector
simon 0:1014af42efd9 4561 * @param[in] numSamples number of complex samples in the input vector
simon 0:1014af42efd9 4562 * @return none.
simon 0:1014af42efd9 4563 */
simon 0:1014af42efd9 4564
simon 0:1014af42efd9 4565 void arm_cmplx_mag_squared_q15(
simon 0:1014af42efd9 4566 q15_t * pSrc,
simon 0:1014af42efd9 4567 q15_t * pDst,
simon 0:1014af42efd9 4568 uint32_t numSamples);
simon 0:1014af42efd9 4569
simon 0:1014af42efd9 4570
simon 0:1014af42efd9 4571 /**
simon 0:1014af42efd9 4572 * @ingroup groupController
simon 0:1014af42efd9 4573 */
simon 0:1014af42efd9 4574
simon 0:1014af42efd9 4575 /**
simon 0:1014af42efd9 4576 * @defgroup PID PID Motor Control
simon 0:1014af42efd9 4577 *
simon 0:1014af42efd9 4578 * A Proportional Integral Derivative (PID) controller is a generic feedback control
simon 0:1014af42efd9 4579 * loop mechanism widely used in industrial control systems.
simon 0:1014af42efd9 4580 * A PID controller is the most commonly used type of feedback controller.
simon 0:1014af42efd9 4581 *
simon 0:1014af42efd9 4582 * This set of functions implements (PID) controllers
simon 0:1014af42efd9 4583 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
simon 0:1014af42efd9 4584 * of data and each call to the function returns a single processed value.
simon 0:1014af42efd9 4585 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
simon 0:1014af42efd9 4586 * is the input sample value. The functions return the output value.
simon 0:1014af42efd9 4587 *
simon 0:1014af42efd9 4588 * \par Algorithm:
simon 0:1014af42efd9 4589 * <pre>
simon 0:1014af42efd9 4590 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
simon 0:1014af42efd9 4591 * A0 = Kp + Ki + Kd
simon 0:1014af42efd9 4592 * A1 = (-Kp ) - (2 * Kd )
simon 0:1014af42efd9 4593 * A2 = Kd </pre>
simon 0:1014af42efd9 4594 *
simon 0:1014af42efd9 4595 * \par
simon 0:1014af42efd9 4596 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
simon 0:1014af42efd9 4597 *
simon 0:1014af42efd9 4598 * \par
simon 0:1014af42efd9 4599 * \image html PID.gif "Proportional Integral Derivative Controller"
simon 0:1014af42efd9 4600 *
simon 0:1014af42efd9 4601 * \par
simon 0:1014af42efd9 4602 * The PID controller calculates an "error" value as the difference between
simon 0:1014af42efd9 4603 * the measured output and the reference input.
simon 0:1014af42efd9 4604 * The controller attempts to minimize the error by adjusting the process control inputs.
simon 0:1014af42efd9 4605 * The proportional value determines the reaction to the current error,
simon 0:1014af42efd9 4606 * the integral value determines the reaction based on the sum of recent errors,
simon 0:1014af42efd9 4607 * and the derivative value determines the reaction based on the rate at which the error has been changing.
simon 0:1014af42efd9 4608 *
simon 0:1014af42efd9 4609 * \par Instance Structure
simon 0:1014af42efd9 4610 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
simon 0:1014af42efd9 4611 * A separate instance structure must be defined for each PID Controller.
simon 0:1014af42efd9 4612 * There are separate instance structure declarations for each of the 3 supported data types.
simon 0:1014af42efd9 4613 *
simon 0:1014af42efd9 4614 * \par Reset Functions
simon 0:1014af42efd9 4615 * There is also an associated reset function for each data type which clears the state array.
simon 0:1014af42efd9 4616 *
simon 0:1014af42efd9 4617 * \par Initialization Functions
simon 0:1014af42efd9 4618 * There is also an associated initialization function for each data type.
simon 0:1014af42efd9 4619 * The initialization function performs the following operations:
simon 0:1014af42efd9 4620 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
simon 0:1014af42efd9 4621 * - Zeros out the values in the state buffer.
simon 0:1014af42efd9 4622 *
simon 0:1014af42efd9 4623 * \par
simon 0:1014af42efd9 4624 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
simon 0:1014af42efd9 4625 *
simon 0:1014af42efd9 4626 * \par Fixed-Point Behavior
simon 0:1014af42efd9 4627 * Care must be taken when using the fixed-point versions of the PID Controller functions.
simon 0:1014af42efd9 4628 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
simon 0:1014af42efd9 4629 * Refer to the function specific documentation below for usage guidelines.
simon 0:1014af42efd9 4630 */
simon 0:1014af42efd9 4631
simon 0:1014af42efd9 4632 /**
simon 0:1014af42efd9 4633 * @addtogroup PID
simon 0:1014af42efd9 4634 * @{
simon 0:1014af42efd9 4635 */
simon 0:1014af42efd9 4636
simon 0:1014af42efd9 4637 /**
simon 0:1014af42efd9 4638 * @brief Process function for the floating-point PID Control.
simon 0:1014af42efd9 4639 * @param[in,out] *S is an instance of the floating-point PID Control structure
simon 0:1014af42efd9 4640 * @param[in] in input sample to process
simon 0:1014af42efd9 4641 * @return out processed output sample.
simon 0:1014af42efd9 4642 */
simon 0:1014af42efd9 4643
simon 0:1014af42efd9 4644
simon 0:1014af42efd9 4645 static __INLINE float32_t arm_pid_f32(
simon 0:1014af42efd9 4646 arm_pid_instance_f32 * S,
simon 0:1014af42efd9 4647 float32_t in)
simon 0:1014af42efd9 4648 {
simon 0:1014af42efd9 4649 float32_t out;
simon 0:1014af42efd9 4650
simon 0:1014af42efd9 4651 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
simon 0:1014af42efd9 4652 out = (S->A0 * in) +
simon 0:1014af42efd9 4653 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
simon 0:1014af42efd9 4654
simon 0:1014af42efd9 4655 /* Update state */
simon 0:1014af42efd9 4656 S->state[1] = S->state[0];
simon 0:1014af42efd9 4657 S->state[0] = in;
simon 0:1014af42efd9 4658 S->state[2] = out;
simon 0:1014af42efd9 4659
simon 0:1014af42efd9 4660 /* return to application */
simon 0:1014af42efd9 4661 return (out);
simon 0:1014af42efd9 4662
simon 0:1014af42efd9 4663 }
simon 0:1014af42efd9 4664
simon 0:1014af42efd9 4665 /**
simon 0:1014af42efd9 4666 * @brief Process function for the Q31 PID Control.
simon 0:1014af42efd9 4667 * @param[in,out] *S points to an instance of the Q31 PID Control structure
simon 0:1014af42efd9 4668 * @param[in] in input sample to process
simon 0:1014af42efd9 4669 * @return out processed output sample.
simon 0:1014af42efd9 4670 *
simon 0:1014af42efd9 4671 * <b>Scaling and Overflow Behavior:</b>
simon 0:1014af42efd9 4672 * \par
simon 0:1014af42efd9 4673 * The function is implemented using an internal 64-bit accumulator.
simon 0:1014af42efd9 4674 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
simon 0:1014af42efd9 4675 * Thus, if the accumulator result overflows it wraps around rather than clip.
simon 0:1014af42efd9 4676 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
simon 0:1014af42efd9 4677 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
simon 0:1014af42efd9 4678 */
simon 0:1014af42efd9 4679
simon 0:1014af42efd9 4680 static __INLINE q31_t arm_pid_q31(
simon 0:1014af42efd9 4681 arm_pid_instance_q31 * S,
simon 0:1014af42efd9 4682 q31_t in)
simon 0:1014af42efd9 4683 {
simon 0:1014af42efd9 4684 q63_t acc;
simon 0:1014af42efd9 4685 q31_t out;
simon 0:1014af42efd9 4686
simon 0:1014af42efd9 4687 /* acc = A0 * x[n] */
simon 0:1014af42efd9 4688 acc = (q63_t) S->A0 * in;
simon 0:1014af42efd9 4689
simon 0:1014af42efd9 4690 /* acc += A1 * x[n-1] */
simon 0:1014af42efd9 4691 acc += (q63_t) S->A1 * S->state[0];
simon 0:1014af42efd9 4692
simon 0:1014af42efd9 4693 /* acc += A2 * x[n-2] */
simon 0:1014af42efd9 4694 acc += (q63_t) S->A2 * S->state[1];
simon 0:1014af42efd9 4695
simon 0:1014af42efd9 4696 /* convert output to 1.31 format to add y[n-1] */
simon 0:1014af42efd9 4697 out = (q31_t) (acc >> 31u);
simon 0:1014af42efd9 4698
simon 0:1014af42efd9 4699 /* out += y[n-1] */
simon 0:1014af42efd9 4700 out += S->state[2];
simon 0:1014af42efd9 4701
simon 0:1014af42efd9 4702 /* Update state */
simon 0:1014af42efd9 4703 S->state[1] = S->state[0];
simon 0:1014af42efd9 4704 S->state[0] = in;
simon 0:1014af42efd9 4705 S->state[2] = out;
simon 0:1014af42efd9 4706
simon 0:1014af42efd9 4707 /* return to application */
simon 0:1014af42efd9 4708 return (out);
simon 0:1014af42efd9 4709
simon 0:1014af42efd9 4710 }
simon 0:1014af42efd9 4711
simon 0:1014af42efd9 4712 /**
simon 0:1014af42efd9 4713 * @brief Process function for the Q15 PID Control.
simon 0:1014af42efd9 4714 * @param[in,out] *S points to an instance of the Q15 PID Control structure
simon 0:1014af42efd9 4715 * @param[in] in input sample to process
simon 0:1014af42efd9 4716 * @return out processed output sample.
simon 0:1014af42efd9 4717 *
simon 0:1014af42efd9 4718 * <b>Scaling and Overflow Behavior:</b>
simon 0:1014af42efd9 4719 * \par
simon 0:1014af42efd9 4720 * The function is implemented using a 64-bit internal accumulator.
simon 0:1014af42efd9 4721 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
simon 0:1014af42efd9 4722 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
simon 0:1014af42efd9 4723 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
simon 0:1014af42efd9 4724 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
simon 0:1014af42efd9 4725 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
simon 0:1014af42efd9 4726 */
simon 0:1014af42efd9 4727
simon 0:1014af42efd9 4728 static __INLINE q15_t arm_pid_q15(
simon 0:1014af42efd9 4729 arm_pid_instance_q15 * S,
simon 0:1014af42efd9 4730 q15_t in)
simon 0:1014af42efd9 4731 {
simon 0:1014af42efd9 4732 q63_t acc;
simon 0:1014af42efd9 4733 q15_t out;
simon 0:1014af42efd9 4734
simon 0:1014af42efd9 4735 /* Implementation of PID controller */
simon 0:1014af42efd9 4736
simon 0:1014af42efd9 4737 /* acc = A0 * x[n] */
simon 0:1014af42efd9 4738 acc = (q31_t) __SMUAD(S->A0, in);
simon 0:1014af42efd9 4739
simon 0:1014af42efd9 4740 /* acc += A1 * x[n-1] + A2 * x[n-2] */
simon 0:1014af42efd9 4741 acc = __SMLALD(S->A1, (q31_t)__SIMD32(S->state), acc);
simon 0:1014af42efd9 4742
simon 0:1014af42efd9 4743 /* acc += y[n-1] */
simon 0:1014af42efd9 4744 acc += (q31_t) S->state[2] << 15;
simon 0:1014af42efd9 4745
simon 0:1014af42efd9 4746 /* saturate the output */
simon 0:1014af42efd9 4747 out = (q15_t) (__SSAT((acc >> 15), 16));
simon 0:1014af42efd9 4748
simon 0:1014af42efd9 4749 /* Update state */
simon 0:1014af42efd9 4750 S->state[1] = S->state[0];
simon 0:1014af42efd9 4751 S->state[0] = in;
simon 0:1014af42efd9 4752 S->state[2] = out;
simon 0:1014af42efd9 4753
simon 0:1014af42efd9 4754 /* return to application */
simon 0:1014af42efd9 4755 return (out);
simon 0:1014af42efd9 4756
simon 0:1014af42efd9 4757 }
simon 0:1014af42efd9 4758
simon 0:1014af42efd9 4759 /**
simon 0:1014af42efd9 4760 * @} end of PID group
simon 0:1014af42efd9 4761 */
simon 0:1014af42efd9 4762
simon 0:1014af42efd9 4763
simon 0:1014af42efd9 4764 /**
simon 0:1014af42efd9 4765 * @brief Floating-point matrix inverse.
simon 0:1014af42efd9 4766 * @param[in] *src points to the instance of the input floating-point matrix structure.
simon 0:1014af42efd9 4767 * @param[out] *dst points to the instance of the output floating-point matrix structure.
simon 0:1014af42efd9 4768 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
simon 0:1014af42efd9 4769 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
simon 0:1014af42efd9 4770 */
simon 0:1014af42efd9 4771
simon 0:1014af42efd9 4772 arm_status arm_mat_inverse_f32(
simon 0:1014af42efd9 4773 const arm_matrix_instance_f32 * src,
simon 0:1014af42efd9 4774 arm_matrix_instance_f32 * dst);
simon 0:1014af42efd9 4775
simon 0:1014af42efd9 4776
simon 0:1014af42efd9 4777
simon 0:1014af42efd9 4778 /**
simon 0:1014af42efd9 4779 * @ingroup groupController
simon 0:1014af42efd9 4780 */
simon 0:1014af42efd9 4781
simon 0:1014af42efd9 4782
simon 0:1014af42efd9 4783 /**
simon 0:1014af42efd9 4784 * @defgroup clarke Vector Clarke Transform
simon 0:1014af42efd9 4785 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
simon 0:1014af42efd9 4786 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
simon 0:1014af42efd9 4787 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
simon 0:1014af42efd9 4788 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
simon 0:1014af42efd9 4789 * \image html clarke.gif Stator current space vector and its components in (a,b).
simon 0:1014af42efd9 4790 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
simon 0:1014af42efd9 4791 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
simon 0:1014af42efd9 4792 *
simon 0:1014af42efd9 4793 * The function operates on a single sample of data and each call to the function returns the processed output.
simon 0:1014af42efd9 4794 * The library provides separate functions for Q31 and floating-point data types.
simon 0:1014af42efd9 4795 * \par Algorithm
simon 0:1014af42efd9 4796 * \image html clarkeFormula.gif
simon 0:1014af42efd9 4797 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
simon 0:1014af42efd9 4798 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
simon 0:1014af42efd9 4799 * \par Fixed-Point Behavior
simon 0:1014af42efd9 4800 * Care must be taken when using the Q31 version of the Clarke transform.
simon 0:1014af42efd9 4801 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
simon 0:1014af42efd9 4802 * Refer to the function specific documentation below for usage guidelines.
simon 0:1014af42efd9 4803 */
simon 0:1014af42efd9 4804
simon 0:1014af42efd9 4805 /**
simon 0:1014af42efd9 4806 * @addtogroup clarke
simon 0:1014af42efd9 4807 * @{
simon 0:1014af42efd9 4808 */
simon 0:1014af42efd9 4809
simon 0:1014af42efd9 4810 /**
simon 0:1014af42efd9 4811 *
simon 0:1014af42efd9 4812 * @brief Floating-point Clarke transform
simon 0:1014af42efd9 4813 * @param[in] Ia input three-phase coordinate <code>a</code>
simon 0:1014af42efd9 4814 * @param[in] Ib input three-phase coordinate <code>b</code>
simon 0:1014af42efd9 4815 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
simon 0:1014af42efd9 4816 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
simon 0:1014af42efd9 4817 * @return none.
simon 0:1014af42efd9 4818 */
simon 0:1014af42efd9 4819
simon 0:1014af42efd9 4820 static __INLINE void arm_clarke_f32(
simon 0:1014af42efd9 4821 float32_t Ia,
simon 0:1014af42efd9 4822 float32_t Ib,
simon 0:1014af42efd9 4823 float32_t * pIalpha,
simon 0:1014af42efd9 4824 float32_t * pIbeta)
simon 0:1014af42efd9 4825 {
simon 0:1014af42efd9 4826 /* Calculate pIalpha using the equation, pIalpha = Ia */
simon 0:1014af42efd9 4827 *pIalpha = Ia;
simon 0:1014af42efd9 4828
simon 0:1014af42efd9 4829 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
simon 0:1014af42efd9 4830 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
simon 0:1014af42efd9 4831
simon 0:1014af42efd9 4832 }
simon 0:1014af42efd9 4833
simon 0:1014af42efd9 4834 /**
simon 0:1014af42efd9 4835 * @brief Clarke transform for Q31 version
simon 0:1014af42efd9 4836 * @param[in] Ia input three-phase coordinate <code>a</code>
simon 0:1014af42efd9 4837 * @param[in] Ib input three-phase coordinate <code>b</code>
simon 0:1014af42efd9 4838 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
simon 0:1014af42efd9 4839 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
simon 0:1014af42efd9 4840 * @return none.
simon 0:1014af42efd9 4841 *
simon 0:1014af42efd9 4842 * <b>Scaling and Overflow Behavior:</b>
simon 0:1014af42efd9 4843 * \par
simon 0:1014af42efd9 4844 * The function is implemented using an internal 32-bit accumulator.
simon 0:1014af42efd9 4845 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
simon 0:1014af42efd9 4846 * There is saturation on the addition, hence there is no risk of overflow.
simon 0:1014af42efd9 4847 */
simon 0:1014af42efd9 4848
simon 0:1014af42efd9 4849 static __INLINE void arm_clarke_q31(
simon 0:1014af42efd9 4850 q31_t Ia,
simon 0:1014af42efd9 4851 q31_t Ib,
simon 0:1014af42efd9 4852 q31_t * pIalpha,
simon 0:1014af42efd9 4853 q31_t * pIbeta)
simon 0:1014af42efd9 4854 {
simon 0:1014af42efd9 4855 q31_t product1, product2; /* Temporary variables used to store intermediate results */
simon 0:1014af42efd9 4856
simon 0:1014af42efd9 4857 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
simon 0:1014af42efd9 4858 *pIalpha = Ia;
simon 0:1014af42efd9 4859
simon 0:1014af42efd9 4860 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
simon 0:1014af42efd9 4861 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
simon 0:1014af42efd9 4862
simon 0:1014af42efd9 4863 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
simon 0:1014af42efd9 4864 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
simon 0:1014af42efd9 4865
simon 0:1014af42efd9 4866 /* pIbeta is calculated by adding the intermediate products */
simon 0:1014af42efd9 4867 *pIbeta = __QADD(product1, product2);
simon 0:1014af42efd9 4868 }
simon 0:1014af42efd9 4869
simon 0:1014af42efd9 4870 /**
simon 0:1014af42efd9 4871 * @} end of clarke group
simon 0:1014af42efd9 4872 */
simon 0:1014af42efd9 4873
simon 0:1014af42efd9 4874 /**
simon 0:1014af42efd9 4875 * @brief Converts the elements of the Q7 vector to Q31 vector.
simon 0:1014af42efd9 4876 * @param[in] *pSrc input pointer
simon 0:1014af42efd9 4877 * @param[out] *pDst output pointer
simon 0:1014af42efd9 4878 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 4879 * @return none.
simon 0:1014af42efd9 4880 */
simon 0:1014af42efd9 4881 void arm_q7_to_q31(
simon 0:1014af42efd9 4882 q7_t * pSrc,
simon 0:1014af42efd9 4883 q31_t * pDst,
simon 0:1014af42efd9 4884 uint32_t blockSize);
simon 0:1014af42efd9 4885
simon 0:1014af42efd9 4886
simon 0:1014af42efd9 4887
simon 0:1014af42efd9 4888
simon 0:1014af42efd9 4889 /**
simon 0:1014af42efd9 4890 * @ingroup groupController
simon 0:1014af42efd9 4891 */
simon 0:1014af42efd9 4892
simon 0:1014af42efd9 4893 /**
simon 0:1014af42efd9 4894 * @defgroup inv_clarke Vector Inverse Clarke Transform
simon 0:1014af42efd9 4895 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
simon 0:1014af42efd9 4896 *
simon 0:1014af42efd9 4897 * The function operates on a single sample of data and each call to the function returns the processed output.
simon 0:1014af42efd9 4898 * The library provides separate functions for Q31 and floating-point data types.
simon 0:1014af42efd9 4899 * \par Algorithm
simon 0:1014af42efd9 4900 * \image html clarkeInvFormula.gif
simon 0:1014af42efd9 4901 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
simon 0:1014af42efd9 4902 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
simon 0:1014af42efd9 4903 * \par Fixed-Point Behavior
simon 0:1014af42efd9 4904 * Care must be taken when using the Q31 version of the Clarke transform.
simon 0:1014af42efd9 4905 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
simon 0:1014af42efd9 4906 * Refer to the function specific documentation below for usage guidelines.
simon 0:1014af42efd9 4907 */
simon 0:1014af42efd9 4908
simon 0:1014af42efd9 4909 /**
simon 0:1014af42efd9 4910 * @addtogroup inv_clarke
simon 0:1014af42efd9 4911 * @{
simon 0:1014af42efd9 4912 */
simon 0:1014af42efd9 4913
simon 0:1014af42efd9 4914 /**
simon 0:1014af42efd9 4915 * @brief Floating-point Inverse Clarke transform
simon 0:1014af42efd9 4916 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
simon 0:1014af42efd9 4917 * @param[in] Ibeta input two-phase orthogonal vector axis beta
simon 0:1014af42efd9 4918 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
simon 0:1014af42efd9 4919 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
simon 0:1014af42efd9 4920 * @return none.
simon 0:1014af42efd9 4921 */
simon 0:1014af42efd9 4922
simon 0:1014af42efd9 4923
simon 0:1014af42efd9 4924 static __INLINE void arm_inv_clarke_f32(
simon 0:1014af42efd9 4925 float32_t Ialpha,
simon 0:1014af42efd9 4926 float32_t Ibeta,
simon 0:1014af42efd9 4927 float32_t * pIa,
simon 0:1014af42efd9 4928 float32_t * pIb)
simon 0:1014af42efd9 4929 {
simon 0:1014af42efd9 4930 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
simon 0:1014af42efd9 4931 *pIa = Ialpha;
simon 0:1014af42efd9 4932
simon 0:1014af42efd9 4933 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
simon 0:1014af42efd9 4934 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
simon 0:1014af42efd9 4935
simon 0:1014af42efd9 4936 }
simon 0:1014af42efd9 4937
simon 0:1014af42efd9 4938 /**
simon 0:1014af42efd9 4939 * @brief Inverse Clarke transform for Q31 version
simon 0:1014af42efd9 4940 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
simon 0:1014af42efd9 4941 * @param[in] Ibeta input two-phase orthogonal vector axis beta
simon 0:1014af42efd9 4942 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
simon 0:1014af42efd9 4943 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
simon 0:1014af42efd9 4944 * @return none.
simon 0:1014af42efd9 4945 *
simon 0:1014af42efd9 4946 * <b>Scaling and Overflow Behavior:</b>
simon 0:1014af42efd9 4947 * \par
simon 0:1014af42efd9 4948 * The function is implemented using an internal 32-bit accumulator.
simon 0:1014af42efd9 4949 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
simon 0:1014af42efd9 4950 * There is saturation on the subtraction, hence there is no risk of overflow.
simon 0:1014af42efd9 4951 */
simon 0:1014af42efd9 4952
simon 0:1014af42efd9 4953 static __INLINE void arm_inv_clarke_q31(
simon 0:1014af42efd9 4954 q31_t Ialpha,
simon 0:1014af42efd9 4955 q31_t Ibeta,
simon 0:1014af42efd9 4956 q31_t * pIa,
simon 0:1014af42efd9 4957 q31_t * pIb)
simon 0:1014af42efd9 4958 {
simon 0:1014af42efd9 4959 q31_t product1, product2; /* Temporary variables used to store intermediate results */
simon 0:1014af42efd9 4960
simon 0:1014af42efd9 4961 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
simon 0:1014af42efd9 4962 *pIa = Ialpha;
simon 0:1014af42efd9 4963
simon 0:1014af42efd9 4964 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
simon 0:1014af42efd9 4965 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
simon 0:1014af42efd9 4966
simon 0:1014af42efd9 4967 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
simon 0:1014af42efd9 4968 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
simon 0:1014af42efd9 4969
simon 0:1014af42efd9 4970 /* pIb is calculated by subtracting the products */
simon 0:1014af42efd9 4971 *pIb = __QSUB(product2, product1);
simon 0:1014af42efd9 4972
simon 0:1014af42efd9 4973 }
simon 0:1014af42efd9 4974
simon 0:1014af42efd9 4975 /**
simon 0:1014af42efd9 4976 * @} end of inv_clarke group
simon 0:1014af42efd9 4977 */
simon 0:1014af42efd9 4978
simon 0:1014af42efd9 4979 /**
simon 0:1014af42efd9 4980 * @brief Converts the elements of the Q7 vector to Q15 vector.
simon 0:1014af42efd9 4981 * @param[in] *pSrc input pointer
simon 0:1014af42efd9 4982 * @param[out] *pDst output pointer
simon 0:1014af42efd9 4983 * @param[in] blockSize number of samples to process
simon 0:1014af42efd9 4984 * @return none.
simon 0:1014af42efd9 4985 */
simon 0:1014af42efd9 4986 void arm_q7_to_q15(
simon 0:1014af42efd9 4987 q7_t * pSrc,
simon 0:1014af42efd9 4988 q15_t * pDst,
simon 0:1014af42efd9 4989 uint32_t blockSize);
simon 0:1014af42efd9 4990
simon 0:1014af42efd9 4991
simon 0:1014af42efd9 4992
simon 0:1014af42efd9 4993 /**
simon 0:1014af42efd9 4994 * @ingroup groupController
simon 0:1014af42efd9 4995 */
simon 0:1014af42efd9 4996
simon 0:1014af42efd9 4997 /**
simon 0:1014af42efd9 4998 * @defgroup park Vector Park Transform
simon 0:1014af42efd9 4999 *
simon 0:1014af42efd9 5000 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
simon 0:1014af42efd9 5001 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
simon 0:1014af42efd9 5002 * from the stationary to the moving reference frame and control the spatial relationship between
simon 0:1014af42efd9 5003 * the stator vector current and rotor flux vector.
simon 0:1014af42efd9 5004 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
simon 0:1014af42efd9 5005 * current vector and the relationship from the two reference frames:
simon 0:1014af42efd9 5006 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
simon 0:1014af42efd9 5007 *
simon 0:1014af42efd9 5008 * The function operates on a single sample of data and each call to the function returns the processed output.
simon 0:1014af42efd9 5009 * The library provides separate functions for Q31 and floating-point data types.
simon 0:1014af42efd9 5010 * \par Algorithm
simon 0:1014af42efd9 5011 * \image html parkFormula.gif
simon 0:1014af42efd9 5012 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
simon 0:1014af42efd9 5013 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
simon 0:1014af42efd9 5014 * cosine and sine values of theta (rotor flux position).
simon 0:1014af42efd9 5015 * \par Fixed-Point Behavior
simon 0:1014af42efd9 5016 * Care must be taken when using the Q31 version of the Park transform.
simon 0:1014af42efd9 5017 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
simon 0:1014af42efd9 5018 * Refer to the function specific documentation below for usage guidelines.
simon 0:1014af42efd9 5019 */
simon 0:1014af42efd9 5020
simon 0:1014af42efd9 5021 /**
simon 0:1014af42efd9 5022 * @addtogroup park
simon 0:1014af42efd9 5023 * @{
simon 0:1014af42efd9 5024 */
simon 0:1014af42efd9 5025
simon 0:1014af42efd9 5026 /**
simon 0:1014af42efd9 5027 * @brief Floating-point Park transform
simon 0:1014af42efd9 5028 * @param[in] Ialpha input two-phase vector coordinate alpha
simon 0:1014af42efd9 5029 * @param[in] Ibeta input two-phase vector coordinate beta
simon 0:1014af42efd9 5030 * @param[out] *pId points to output rotor reference frame d
simon 0:1014af42efd9 5031 * @param[out] *pIq points to output rotor reference frame q
simon 0:1014af42efd9 5032 * @param[in] sinVal sine value of rotation angle theta
simon 0:1014af42efd9 5033 * @param[in] cosVal cosine value of rotation angle theta
simon 0:1014af42efd9 5034 * @return none.
simon 0:1014af42efd9 5035 *
simon 0:1014af42efd9 5036 * The function implements the forward Park transform.
simon 0:1014af42efd9 5037 *
simon 0:1014af42efd9 5038 */
simon 0:1014af42efd9 5039
simon 0:1014af42efd9 5040 static __INLINE void arm_park_f32(
simon 0:1014af42efd9 5041 float32_t Ialpha,
simon 0:1014af42efd9 5042 float32_t Ibeta,
simon 0:1014af42efd9 5043 float32_t * pId,
simon 0:1014af42efd9 5044 float32_t * pIq,
simon 0:1014af42efd9 5045 float32_t sinVal,
simon 0:1014af42efd9 5046 float32_t cosVal)
simon 0:1014af42efd9 5047 {
simon 0:1014af42efd9 5048 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
simon 0:1014af42efd9 5049 *pId = Ialpha * cosVal + Ibeta * sinVal;
simon 0:1014af42efd9 5050
simon 0:1014af42efd9 5051 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
simon 0:1014af42efd9 5052 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
simon 0:1014af42efd9 5053
simon 0:1014af42efd9 5054 }
simon 0:1014af42efd9 5055
simon 0:1014af42efd9 5056 /**
simon 0:1014af42efd9 5057 * @brief Park transform for Q31 version
simon 0:1014af42efd9 5058 * @param[in] Ialpha input two-phase vector coordinate alpha
simon 0:1014af42efd9 5059 * @param[in] Ibeta input two-phase vector coordinate beta
simon 0:1014af42efd9 5060 * @param[out] *pId points to output rotor reference frame d
simon 0:1014af42efd9 5061 * @param[out] *pIq points to output rotor reference frame q
simon 0:1014af42efd9 5062 * @param[in] sinVal sine value of rotation angle theta
simon 0:1014af42efd9 5063 * @param[in] cosVal cosine value of rotation angle theta
simon 0:1014af42efd9 5064 * @return none.
simon 0:1014af42efd9 5065 *
simon 0:1014af42efd9 5066 * <b>Scaling and Overflow Behavior:</b>
simon 0:1014af42efd9 5067 * \par
simon 0:1014af42efd9 5068 * The function is implemented using an internal 32-bit accumulator.
simon 0:1014af42efd9 5069 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
simon 0:1014af42efd9 5070 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
simon 0:1014af42efd9 5071 */
simon 0:1014af42efd9 5072
simon 0:1014af42efd9 5073
simon 0:1014af42efd9 5074 static __INLINE void arm_park_q31(
simon 0:1014af42efd9 5075 q31_t Ialpha,
simon 0:1014af42efd9 5076 q31_t Ibeta,
simon 0:1014af42efd9 5077 q31_t * pId,
simon 0:1014af42efd9 5078 q31_t * pIq,
simon 0:1014af42efd9 5079 q31_t sinVal,
simon 0:1014af42efd9 5080 q31_t cosVal)
simon 0:1014af42efd9 5081 {
simon 0:1014af42efd9 5082 q31_t product1, product2; /* Temporary variables used to store intermediate results */
simon 0:1014af42efd9 5083 q31_t product3, product4; /* Temporary variables used to store intermediate results */
simon 0:1014af42efd9 5084
simon 0:1014af42efd9 5085 /* Intermediate product is calculated by (Ialpha * cosVal) */
simon 0:1014af42efd9 5086 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
simon 0:1014af42efd9 5087
simon 0:1014af42efd9 5088 /* Intermediate product is calculated by (Ibeta * sinVal) */
simon 0:1014af42efd9 5089 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
simon 0:1014af42efd9 5090
simon 0:1014af42efd9 5091
simon 0:1014af42efd9 5092 /* Intermediate product is calculated by (Ialpha * sinVal) */
simon 0:1014af42efd9 5093 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
simon 0:1014af42efd9 5094
simon 0:1014af42efd9 5095 /* Intermediate product is calculated by (Ibeta * cosVal) */
simon 0:1014af42efd9 5096 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
simon 0:1014af42efd9 5097
simon 0:1014af42efd9 5098 /* Calculate pId by adding the two intermediate products 1 and 2 */
simon 0:1014af42efd9 5099 *pId = __QADD(product1, product2);
simon 0:1014af42efd9 5100
simon 0:1014af42efd9 5101 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
simon 0:1014af42efd9 5102 *pIq = __QSUB(product4, product3);
simon 0:1014af42efd9 5103 }
simon 0:1014af42efd9 5104
simon 0:1014af42efd9 5105 /**
simon 0:1014af42efd9 5106 * @} end of park group
simon 0:1014af42efd9 5107 */
simon 0:1014af42efd9 5108
simon 0:1014af42efd9 5109 /**
simon 0:1014af42efd9 5110 * @brief Converts the elements of the Q7 vector to floating-point vector.
simon 0:1014af42efd9 5111 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 5112 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 5113 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 5114 * @return none.
simon 0:1014af42efd9 5115 */
simon 0:1014af42efd9 5116 void arm_q7_to_float(
simon 0:1014af42efd9 5117 q7_t * pSrc,
simon 0:1014af42efd9 5118 float32_t * pDst,
simon 0:1014af42efd9 5119 uint32_t blockSize);
simon 0:1014af42efd9 5120
simon 0:1014af42efd9 5121
simon 0:1014af42efd9 5122 /**
simon 0:1014af42efd9 5123 * @ingroup groupController
simon 0:1014af42efd9 5124 */
simon 0:1014af42efd9 5125
simon 0:1014af42efd9 5126 /**
simon 0:1014af42efd9 5127 * @defgroup inv_park Vector Inverse Park transform
simon 0:1014af42efd9 5128 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
simon 0:1014af42efd9 5129 *
simon 0:1014af42efd9 5130 * The function operates on a single sample of data and each call to the function returns the processed output.
simon 0:1014af42efd9 5131 * The library provides separate functions for Q31 and floating-point data types.
simon 0:1014af42efd9 5132 * \par Algorithm
simon 0:1014af42efd9 5133 * \image html parkInvFormula.gif
simon 0:1014af42efd9 5134 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
simon 0:1014af42efd9 5135 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
simon 0:1014af42efd9 5136 * cosine and sine values of theta (rotor flux position).
simon 0:1014af42efd9 5137 * \par Fixed-Point Behavior
simon 0:1014af42efd9 5138 * Care must be taken when using the Q31 version of the Park transform.
simon 0:1014af42efd9 5139 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
simon 0:1014af42efd9 5140 * Refer to the function specific documentation below for usage guidelines.
simon 0:1014af42efd9 5141 */
simon 0:1014af42efd9 5142
simon 0:1014af42efd9 5143 /**
simon 0:1014af42efd9 5144 * @addtogroup inv_park
simon 0:1014af42efd9 5145 * @{
simon 0:1014af42efd9 5146 */
simon 0:1014af42efd9 5147
simon 0:1014af42efd9 5148 /**
simon 0:1014af42efd9 5149 * @brief Floating-point Inverse Park transform
simon 0:1014af42efd9 5150 * @param[in] Id input coordinate of rotor reference frame d
simon 0:1014af42efd9 5151 * @param[in] Iq input coordinate of rotor reference frame q
simon 0:1014af42efd9 5152 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
simon 0:1014af42efd9 5153 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
simon 0:1014af42efd9 5154 * @param[in] sinVal sine value of rotation angle theta
simon 0:1014af42efd9 5155 * @param[in] cosVal cosine value of rotation angle theta
simon 0:1014af42efd9 5156 * @return none.
simon 0:1014af42efd9 5157 */
simon 0:1014af42efd9 5158
simon 0:1014af42efd9 5159 static __INLINE void arm_inv_park_f32(
simon 0:1014af42efd9 5160 float32_t Id,
simon 0:1014af42efd9 5161 float32_t Iq,
simon 0:1014af42efd9 5162 float32_t * pIalpha,
simon 0:1014af42efd9 5163 float32_t * pIbeta,
simon 0:1014af42efd9 5164 float32_t sinVal,
simon 0:1014af42efd9 5165 float32_t cosVal)
simon 0:1014af42efd9 5166 {
simon 0:1014af42efd9 5167 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
simon 0:1014af42efd9 5168 *pIalpha = Id * cosVal - Iq * sinVal;
simon 0:1014af42efd9 5169
simon 0:1014af42efd9 5170 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
simon 0:1014af42efd9 5171 *pIbeta = Id * sinVal + Iq * cosVal;
simon 0:1014af42efd9 5172
simon 0:1014af42efd9 5173 }
simon 0:1014af42efd9 5174
simon 0:1014af42efd9 5175
simon 0:1014af42efd9 5176 /**
simon 0:1014af42efd9 5177 * @brief Inverse Park transform for Q31 version
simon 0:1014af42efd9 5178 * @param[in] Id input coordinate of rotor reference frame d
simon 0:1014af42efd9 5179 * @param[in] Iq input coordinate of rotor reference frame q
simon 0:1014af42efd9 5180 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
simon 0:1014af42efd9 5181 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
simon 0:1014af42efd9 5182 * @param[in] sinVal sine value of rotation angle theta
simon 0:1014af42efd9 5183 * @param[in] cosVal cosine value of rotation angle theta
simon 0:1014af42efd9 5184 * @return none.
simon 0:1014af42efd9 5185 *
simon 0:1014af42efd9 5186 * <b>Scaling and Overflow Behavior:</b>
simon 0:1014af42efd9 5187 * \par
simon 0:1014af42efd9 5188 * The function is implemented using an internal 32-bit accumulator.
simon 0:1014af42efd9 5189 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
simon 0:1014af42efd9 5190 * There is saturation on the addition, hence there is no risk of overflow.
simon 0:1014af42efd9 5191 */
simon 0:1014af42efd9 5192
simon 0:1014af42efd9 5193
simon 0:1014af42efd9 5194 static __INLINE void arm_inv_park_q31(
simon 0:1014af42efd9 5195 q31_t Id,
simon 0:1014af42efd9 5196 q31_t Iq,
simon 0:1014af42efd9 5197 q31_t * pIalpha,
simon 0:1014af42efd9 5198 q31_t * pIbeta,
simon 0:1014af42efd9 5199 q31_t sinVal,
simon 0:1014af42efd9 5200 q31_t cosVal)
simon 0:1014af42efd9 5201 {
simon 0:1014af42efd9 5202 q31_t product1, product2; /* Temporary variables used to store intermediate results */
simon 0:1014af42efd9 5203 q31_t product3, product4; /* Temporary variables used to store intermediate results */
simon 0:1014af42efd9 5204
simon 0:1014af42efd9 5205 /* Intermediate product is calculated by (Id * cosVal) */
simon 0:1014af42efd9 5206 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
simon 0:1014af42efd9 5207
simon 0:1014af42efd9 5208 /* Intermediate product is calculated by (Iq * sinVal) */
simon 0:1014af42efd9 5209 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
simon 0:1014af42efd9 5210
simon 0:1014af42efd9 5211
simon 0:1014af42efd9 5212 /* Intermediate product is calculated by (Id * sinVal) */
simon 0:1014af42efd9 5213 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
simon 0:1014af42efd9 5214
simon 0:1014af42efd9 5215 /* Intermediate product is calculated by (Iq * cosVal) */
simon 0:1014af42efd9 5216 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
simon 0:1014af42efd9 5217
simon 0:1014af42efd9 5218 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
simon 0:1014af42efd9 5219 *pIalpha = __QSUB(product1, product2);
simon 0:1014af42efd9 5220
simon 0:1014af42efd9 5221 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
simon 0:1014af42efd9 5222 *pIbeta = __QADD(product4, product3);
simon 0:1014af42efd9 5223
simon 0:1014af42efd9 5224 }
simon 0:1014af42efd9 5225
simon 0:1014af42efd9 5226 /**
simon 0:1014af42efd9 5227 * @} end of Inverse park group
simon 0:1014af42efd9 5228 */
simon 0:1014af42efd9 5229
simon 0:1014af42efd9 5230
simon 0:1014af42efd9 5231 /**
simon 0:1014af42efd9 5232 * @brief Converts the elements of the Q31 vector to floating-point vector.
simon 0:1014af42efd9 5233 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 5234 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 5235 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 5236 * @return none.
simon 0:1014af42efd9 5237 */
simon 0:1014af42efd9 5238 void arm_q31_to_float(
simon 0:1014af42efd9 5239 q31_t * pSrc,
simon 0:1014af42efd9 5240 float32_t * pDst,
simon 0:1014af42efd9 5241 uint32_t blockSize);
simon 0:1014af42efd9 5242
simon 0:1014af42efd9 5243 /**
simon 0:1014af42efd9 5244 * @ingroup groupInterpolation
simon 0:1014af42efd9 5245 */
simon 0:1014af42efd9 5246
simon 0:1014af42efd9 5247 /**
simon 0:1014af42efd9 5248 * @defgroup LinearInterpolate Linear Interpolation
simon 0:1014af42efd9 5249 *
simon 0:1014af42efd9 5250 * Linear interpolation is a method of curve fitting using linear polynomials.
simon 0:1014af42efd9 5251 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
simon 0:1014af42efd9 5252 *
simon 0:1014af42efd9 5253 * \par
simon 0:1014af42efd9 5254 * \image html LinearInterp.gif "Linear interpolation"
simon 0:1014af42efd9 5255 *
simon 0:1014af42efd9 5256 * \par
simon 0:1014af42efd9 5257 * A Linear Interpolate function calculates an output value(y), for the input(x)
simon 0:1014af42efd9 5258 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
simon 0:1014af42efd9 5259 *
simon 0:1014af42efd9 5260 * \par Algorithm:
simon 0:1014af42efd9 5261 * <pre>
simon 0:1014af42efd9 5262 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
simon 0:1014af42efd9 5263 * where x0, x1 are nearest values of input x
simon 0:1014af42efd9 5264 * y0, y1 are nearest values to output y
simon 0:1014af42efd9 5265 * </pre>
simon 0:1014af42efd9 5266 *
simon 0:1014af42efd9 5267 * \par
simon 0:1014af42efd9 5268 * This set of functions implements Linear interpolation process
simon 0:1014af42efd9 5269 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
simon 0:1014af42efd9 5270 * sample of data and each call to the function returns a single processed value.
simon 0:1014af42efd9 5271 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
simon 0:1014af42efd9 5272 * <code>x</code> is the input sample value. The functions returns the output value.
simon 0:1014af42efd9 5273 *
simon 0:1014af42efd9 5274 * \par
simon 0:1014af42efd9 5275 * if x is outside of the table boundary, Linear interpolation returns first value of the table
simon 0:1014af42efd9 5276 * if x is below input range and returns last value of table if x is above range.
simon 0:1014af42efd9 5277 */
simon 0:1014af42efd9 5278
simon 0:1014af42efd9 5279 /**
simon 0:1014af42efd9 5280 * @addtogroup LinearInterpolate
simon 0:1014af42efd9 5281 * @{
simon 0:1014af42efd9 5282 */
simon 0:1014af42efd9 5283
simon 0:1014af42efd9 5284 /**
simon 0:1014af42efd9 5285 * @brief Process function for the floating-point Linear Interpolation Function.
simon 0:1014af42efd9 5286 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
simon 0:1014af42efd9 5287 * @param[in] x input sample to process
simon 0:1014af42efd9 5288 * @return y processed output sample.
simon 0:1014af42efd9 5289 *
simon 0:1014af42efd9 5290 */
simon 0:1014af42efd9 5291
simon 0:1014af42efd9 5292 static __INLINE float32_t arm_linear_interp_f32(
simon 0:1014af42efd9 5293 arm_linear_interp_instance_f32 * S,
simon 0:1014af42efd9 5294 float32_t x)
simon 0:1014af42efd9 5295 {
simon 0:1014af42efd9 5296
simon 0:1014af42efd9 5297 float32_t y;
simon 0:1014af42efd9 5298 float32_t x0, x1; /* Nearest input values */
simon 0:1014af42efd9 5299 float32_t y0, y1; /* Nearest output values */
simon 0:1014af42efd9 5300 float32_t xSpacing = S->xSpacing; /* spacing between input values */
simon 0:1014af42efd9 5301 int32_t i; /* Index variable */
simon 0:1014af42efd9 5302 float32_t *pYData = S->pYData; /* pointer to output table */
simon 0:1014af42efd9 5303
simon 0:1014af42efd9 5304 /* Calculation of index */
simon 0:1014af42efd9 5305 i = (x - S->x1) / xSpacing;
simon 0:1014af42efd9 5306
simon 0:1014af42efd9 5307 if(i < 0)
simon 0:1014af42efd9 5308 {
simon 0:1014af42efd9 5309 /* Iniatilize output for below specified range as least output value of table */
simon 0:1014af42efd9 5310 y = pYData[0];
simon 0:1014af42efd9 5311 }
simon 0:1014af42efd9 5312 else if(i >= S->nValues)
simon 0:1014af42efd9 5313 {
simon 0:1014af42efd9 5314 /* Iniatilize output for above specified range as last output value of table */
simon 0:1014af42efd9 5315 y = pYData[S->nValues-1];
simon 0:1014af42efd9 5316 }
simon 0:1014af42efd9 5317 else
simon 0:1014af42efd9 5318 {
simon 0:1014af42efd9 5319 /* Calculation of nearest input values */
simon 0:1014af42efd9 5320 x0 = S->x1 + i * xSpacing;
simon 0:1014af42efd9 5321 x1 = S->x1 + (i +1) * xSpacing;
simon 0:1014af42efd9 5322
simon 0:1014af42efd9 5323 /* Read of nearest output values */
simon 0:1014af42efd9 5324 y0 = pYData[i];
simon 0:1014af42efd9 5325 y1 = pYData[i + 1];
simon 0:1014af42efd9 5326
simon 0:1014af42efd9 5327 /* Calculation of output */
simon 0:1014af42efd9 5328 y = y0 + (x - x0) * ((y1 - y0)/(x1-x0));
simon 0:1014af42efd9 5329
simon 0:1014af42efd9 5330 }
simon 0:1014af42efd9 5331
simon 0:1014af42efd9 5332 /* returns output value */
simon 0:1014af42efd9 5333 return (y);
simon 0:1014af42efd9 5334 }
simon 0:1014af42efd9 5335
simon 0:1014af42efd9 5336 /**
simon 0:1014af42efd9 5337 *
simon 0:1014af42efd9 5338 * @brief Process function for the Q31 Linear Interpolation Function.
simon 0:1014af42efd9 5339 * @param[in] *pYData pointer to Q31 Linear Interpolation table
simon 0:1014af42efd9 5340 * @param[in] x input sample to process
simon 0:1014af42efd9 5341 * @param[in] nValues number of table values
simon 0:1014af42efd9 5342 * @return y processed output sample.
simon 0:1014af42efd9 5343 *
simon 0:1014af42efd9 5344 * \par
simon 0:1014af42efd9 5345 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
simon 0:1014af42efd9 5346 * This function can support maximum of table size 2^12.
simon 0:1014af42efd9 5347 *
simon 0:1014af42efd9 5348 */
simon 0:1014af42efd9 5349
simon 0:1014af42efd9 5350
simon 0:1014af42efd9 5351 static __INLINE q31_t arm_linear_interp_q31(q31_t *pYData,
simon 0:1014af42efd9 5352 q31_t x, uint32_t nValues)
simon 0:1014af42efd9 5353 {
simon 0:1014af42efd9 5354 q31_t y; /* output */
simon 0:1014af42efd9 5355 q31_t y0, y1; /* Nearest output values */
simon 0:1014af42efd9 5356 q31_t fract; /* fractional part */
simon 0:1014af42efd9 5357 int32_t index; /* Index to read nearest output values */
simon 0:1014af42efd9 5358
simon 0:1014af42efd9 5359 /* Input is in 12.20 format */
simon 0:1014af42efd9 5360 /* 12 bits for the table index */
simon 0:1014af42efd9 5361 /* Index value calculation */
simon 0:1014af42efd9 5362 index = ((x & 0xFFF00000) >> 20);
simon 0:1014af42efd9 5363
simon 0:1014af42efd9 5364 if(index >= (nValues - 1))
simon 0:1014af42efd9 5365 {
simon 0:1014af42efd9 5366 return(pYData[nValues - 1]);
simon 0:1014af42efd9 5367 }
simon 0:1014af42efd9 5368 else if(index < 0)
simon 0:1014af42efd9 5369 {
simon 0:1014af42efd9 5370 return(pYData[0]);
simon 0:1014af42efd9 5371 }
simon 0:1014af42efd9 5372 else
simon 0:1014af42efd9 5373 {
simon 0:1014af42efd9 5374
simon 0:1014af42efd9 5375 /* 20 bits for the fractional part */
simon 0:1014af42efd9 5376 /* shift left by 11 to keep fract in 1.31 format */
simon 0:1014af42efd9 5377 fract = (x & 0x000FFFFF) << 11;
simon 0:1014af42efd9 5378
simon 0:1014af42efd9 5379 /* Read two nearest output values from the index in 1.31(q31) format */
simon 0:1014af42efd9 5380 y0 = pYData[index];
simon 0:1014af42efd9 5381 y1 = pYData[index + 1u];
simon 0:1014af42efd9 5382
simon 0:1014af42efd9 5383 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
simon 0:1014af42efd9 5384 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
simon 0:1014af42efd9 5385
simon 0:1014af42efd9 5386 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
simon 0:1014af42efd9 5387 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
simon 0:1014af42efd9 5388
simon 0:1014af42efd9 5389 /* Convert y to 1.31 format */
simon 0:1014af42efd9 5390 return (y << 1u);
simon 0:1014af42efd9 5391
simon 0:1014af42efd9 5392 }
simon 0:1014af42efd9 5393
simon 0:1014af42efd9 5394 }
simon 0:1014af42efd9 5395
simon 0:1014af42efd9 5396 /**
simon 0:1014af42efd9 5397 *
simon 0:1014af42efd9 5398 * @brief Process function for the Q15 Linear Interpolation Function.
simon 0:1014af42efd9 5399 * @param[in] *pYData pointer to Q15 Linear Interpolation table
simon 0:1014af42efd9 5400 * @param[in] x input sample to process
simon 0:1014af42efd9 5401 * @param[in] nValues number of table values
simon 0:1014af42efd9 5402 * @return y processed output sample.
simon 0:1014af42efd9 5403 *
simon 0:1014af42efd9 5404 * \par
simon 0:1014af42efd9 5405 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
simon 0:1014af42efd9 5406 * This function can support maximum of table size 2^12.
simon 0:1014af42efd9 5407 *
simon 0:1014af42efd9 5408 */
simon 0:1014af42efd9 5409
simon 0:1014af42efd9 5410
simon 0:1014af42efd9 5411 static __INLINE q15_t arm_linear_interp_q15(q15_t *pYData, q31_t x, uint32_t nValues)
simon 0:1014af42efd9 5412 {
simon 0:1014af42efd9 5413 q63_t y; /* output */
simon 0:1014af42efd9 5414 q15_t y0, y1; /* Nearest output values */
simon 0:1014af42efd9 5415 q31_t fract; /* fractional part */
simon 0:1014af42efd9 5416 int32_t index; /* Index to read nearest output values */
simon 0:1014af42efd9 5417
simon 0:1014af42efd9 5418 /* Input is in 12.20 format */
simon 0:1014af42efd9 5419 /* 12 bits for the table index */
simon 0:1014af42efd9 5420 /* Index value calculation */
simon 0:1014af42efd9 5421 index = ((x & 0xFFF00000) >> 20u);
simon 0:1014af42efd9 5422
simon 0:1014af42efd9 5423 if(index >= (nValues - 1))
simon 0:1014af42efd9 5424 {
simon 0:1014af42efd9 5425 return(pYData[nValues - 1]);
simon 0:1014af42efd9 5426 }
simon 0:1014af42efd9 5427 else if(index < 0)
simon 0:1014af42efd9 5428 {
simon 0:1014af42efd9 5429 return(pYData[0]);
simon 0:1014af42efd9 5430 }
simon 0:1014af42efd9 5431 else
simon 0:1014af42efd9 5432 {
simon 0:1014af42efd9 5433 /* 20 bits for the fractional part */
simon 0:1014af42efd9 5434 /* fract is in 12.20 format */
simon 0:1014af42efd9 5435 fract = (x & 0x000FFFFF);
simon 0:1014af42efd9 5436
simon 0:1014af42efd9 5437 /* Read two nearest output values from the index */
simon 0:1014af42efd9 5438 y0 = pYData[index];
simon 0:1014af42efd9 5439 y1 = pYData[index + 1u];
simon 0:1014af42efd9 5440
simon 0:1014af42efd9 5441 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
simon 0:1014af42efd9 5442 y = ((q63_t) y0 * (0xFFFFF - fract));
simon 0:1014af42efd9 5443
simon 0:1014af42efd9 5444 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
simon 0:1014af42efd9 5445 y += ((q63_t) y1 * (fract));
simon 0:1014af42efd9 5446
simon 0:1014af42efd9 5447 /* convert y to 1.15 format */
simon 0:1014af42efd9 5448 return (y >> 20);
simon 0:1014af42efd9 5449 }
simon 0:1014af42efd9 5450
simon 0:1014af42efd9 5451
simon 0:1014af42efd9 5452 }
simon 0:1014af42efd9 5453
simon 0:1014af42efd9 5454 /**
simon 0:1014af42efd9 5455 *
simon 0:1014af42efd9 5456 * @brief Process function for the Q7 Linear Interpolation Function.
simon 0:1014af42efd9 5457 * @param[in] *pYData pointer to Q7 Linear Interpolation table
simon 0:1014af42efd9 5458 * @param[in] x input sample to process
simon 0:1014af42efd9 5459 * @param[in] nValues number of table values
simon 0:1014af42efd9 5460 * @return y processed output sample.
simon 0:1014af42efd9 5461 *
simon 0:1014af42efd9 5462 * \par
simon 0:1014af42efd9 5463 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
simon 0:1014af42efd9 5464 * This function can support maximum of table size 2^12.
simon 0:1014af42efd9 5465 */
simon 0:1014af42efd9 5466
simon 0:1014af42efd9 5467
simon 0:1014af42efd9 5468 static __INLINE q7_t arm_linear_interp_q7(q7_t *pYData, q31_t x, uint32_t nValues)
simon 0:1014af42efd9 5469 {
simon 0:1014af42efd9 5470 q31_t y; /* output */
simon 0:1014af42efd9 5471 q7_t y0, y1; /* Nearest output values */
simon 0:1014af42efd9 5472 q31_t fract; /* fractional part */
simon 0:1014af42efd9 5473 int32_t index; /* Index to read nearest output values */
simon 0:1014af42efd9 5474
simon 0:1014af42efd9 5475 /* Input is in 12.20 format */
simon 0:1014af42efd9 5476 /* 12 bits for the table index */
simon 0:1014af42efd9 5477 /* Index value calculation */
simon 0:1014af42efd9 5478 index = ((x & 0xFFF00000) >> 20u);
simon 0:1014af42efd9 5479
simon 0:1014af42efd9 5480
simon 0:1014af42efd9 5481 if(index >= (nValues - 1))
simon 0:1014af42efd9 5482 {
simon 0:1014af42efd9 5483 return(pYData[nValues - 1]);
simon 0:1014af42efd9 5484 }
simon 0:1014af42efd9 5485 else if(index < 0)
simon 0:1014af42efd9 5486 {
simon 0:1014af42efd9 5487 return(pYData[0]);
simon 0:1014af42efd9 5488 }
simon 0:1014af42efd9 5489 else
simon 0:1014af42efd9 5490 {
simon 0:1014af42efd9 5491
simon 0:1014af42efd9 5492 /* 20 bits for the fractional part */
simon 0:1014af42efd9 5493 /* fract is in 12.20 format */
simon 0:1014af42efd9 5494 fract = (x & 0x000FFFFF);
simon 0:1014af42efd9 5495
simon 0:1014af42efd9 5496 /* Read two nearest output values from the index and are in 1.7(q7) format */
simon 0:1014af42efd9 5497 y0 = pYData[index];
simon 0:1014af42efd9 5498 y1 = pYData[index + 1u];
simon 0:1014af42efd9 5499
simon 0:1014af42efd9 5500 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
simon 0:1014af42efd9 5501 y = ((y0 * (0xFFFFF - fract)));
simon 0:1014af42efd9 5502
simon 0:1014af42efd9 5503 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
simon 0:1014af42efd9 5504 y += (y1 * fract);
simon 0:1014af42efd9 5505
simon 0:1014af42efd9 5506 /* convert y to 1.7(q7) format */
simon 0:1014af42efd9 5507 return (y >> 20u);
simon 0:1014af42efd9 5508
simon 0:1014af42efd9 5509 }
simon 0:1014af42efd9 5510
simon 0:1014af42efd9 5511 }
simon 0:1014af42efd9 5512 /**
simon 0:1014af42efd9 5513 * @} end of LinearInterpolate group
simon 0:1014af42efd9 5514 */
simon 0:1014af42efd9 5515
simon 0:1014af42efd9 5516 /**
simon 0:1014af42efd9 5517 * @brief Fast approximation to the trigonometric sine function for floating-point data.
simon 0:1014af42efd9 5518 * @param[in] x input value in radians.
simon 0:1014af42efd9 5519 * @return sin(x).
simon 0:1014af42efd9 5520 */
simon 0:1014af42efd9 5521
simon 0:1014af42efd9 5522 float32_t arm_sin_f32(
simon 0:1014af42efd9 5523 float32_t x);
simon 0:1014af42efd9 5524
simon 0:1014af42efd9 5525 /**
simon 0:1014af42efd9 5526 * @brief Fast approximation to the trigonometric sine function for Q31 data.
simon 0:1014af42efd9 5527 * @param[in] x Scaled input value in radians.
simon 0:1014af42efd9 5528 * @return sin(x).
simon 0:1014af42efd9 5529 */
simon 0:1014af42efd9 5530
simon 0:1014af42efd9 5531 q31_t arm_sin_q31(
simon 0:1014af42efd9 5532 q31_t x);
simon 0:1014af42efd9 5533
simon 0:1014af42efd9 5534 /**
simon 0:1014af42efd9 5535 * @brief Fast approximation to the trigonometric sine function for Q15 data.
simon 0:1014af42efd9 5536 * @param[in] x Scaled input value in radians.
simon 0:1014af42efd9 5537 * @return sin(x).
simon 0:1014af42efd9 5538 */
simon 0:1014af42efd9 5539
simon 0:1014af42efd9 5540 q15_t arm_sin_q15(
simon 0:1014af42efd9 5541 q15_t x);
simon 0:1014af42efd9 5542
simon 0:1014af42efd9 5543 /**
simon 0:1014af42efd9 5544 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
simon 0:1014af42efd9 5545 * @param[in] x input value in radians.
simon 0:1014af42efd9 5546 * @return cos(x).
simon 0:1014af42efd9 5547 */
simon 0:1014af42efd9 5548
simon 0:1014af42efd9 5549 float32_t arm_cos_f32(
simon 0:1014af42efd9 5550 float32_t x);
simon 0:1014af42efd9 5551
simon 0:1014af42efd9 5552 /**
simon 0:1014af42efd9 5553 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
simon 0:1014af42efd9 5554 * @param[in] x Scaled input value in radians.
simon 0:1014af42efd9 5555 * @return cos(x).
simon 0:1014af42efd9 5556 */
simon 0:1014af42efd9 5557
simon 0:1014af42efd9 5558 q31_t arm_cos_q31(
simon 0:1014af42efd9 5559 q31_t x);
simon 0:1014af42efd9 5560
simon 0:1014af42efd9 5561 /**
simon 0:1014af42efd9 5562 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
simon 0:1014af42efd9 5563 * @param[in] x Scaled input value in radians.
simon 0:1014af42efd9 5564 * @return cos(x).
simon 0:1014af42efd9 5565 */
simon 0:1014af42efd9 5566
simon 0:1014af42efd9 5567 q15_t arm_cos_q15(
simon 0:1014af42efd9 5568 q15_t x);
simon 0:1014af42efd9 5569
simon 0:1014af42efd9 5570
simon 0:1014af42efd9 5571 /**
simon 0:1014af42efd9 5572 * @ingroup groupFastMath
simon 0:1014af42efd9 5573 */
simon 0:1014af42efd9 5574
simon 0:1014af42efd9 5575
simon 0:1014af42efd9 5576 /**
simon 0:1014af42efd9 5577 * @defgroup SQRT Square Root
simon 0:1014af42efd9 5578 *
simon 0:1014af42efd9 5579 * Computes the square root of a number.
simon 0:1014af42efd9 5580 * There are separate functions for Q15, Q31, and floating-point data types.
simon 0:1014af42efd9 5581 * The square root function is computed using the Newton-Raphson algorithm.
simon 0:1014af42efd9 5582 * This is an iterative algorithm of the form:
simon 0:1014af42efd9 5583 * <pre>
simon 0:1014af42efd9 5584 * x1 = x0 - f(x0)/f'(x0)
simon 0:1014af42efd9 5585 * </pre>
simon 0:1014af42efd9 5586 * where <code>x1</code> is the current estimate,
simon 0:1014af42efd9 5587 * <code>x0</code> is the previous estimate and
simon 0:1014af42efd9 5588 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
simon 0:1014af42efd9 5589 * For the square root function, the algorithm reduces to:
simon 0:1014af42efd9 5590 * <pre>
simon 0:1014af42efd9 5591 * x0 = in/2 [initial guess]
simon 0:1014af42efd9 5592 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
simon 0:1014af42efd9 5593 * </pre>
simon 0:1014af42efd9 5594 */
simon 0:1014af42efd9 5595
simon 0:1014af42efd9 5596
simon 0:1014af42efd9 5597 /**
simon 0:1014af42efd9 5598 * @addtogroup SQRT
simon 0:1014af42efd9 5599 * @{
simon 0:1014af42efd9 5600 */
simon 0:1014af42efd9 5601
simon 0:1014af42efd9 5602 /**
simon 0:1014af42efd9 5603 * @brief Floating-point square root function.
simon 0:1014af42efd9 5604 * @param[in] in input value.
simon 0:1014af42efd9 5605 * @param[out] *pOut square root of input value.
simon 0:1014af42efd9 5606 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
simon 0:1014af42efd9 5607 * <code>in</code> is negative value and returns zero output for negative values.
simon 0:1014af42efd9 5608 */
simon 0:1014af42efd9 5609
simon 0:1014af42efd9 5610 static __INLINE arm_status arm_sqrt_f32(
simon 0:1014af42efd9 5611 float32_t in, float32_t *pOut)
simon 0:1014af42efd9 5612 {
simon 0:1014af42efd9 5613 float32_t out;
simon 0:1014af42efd9 5614 float32_t prevOut;
simon 0:1014af42efd9 5615
simon 0:1014af42efd9 5616 if(in > 0)
simon 0:1014af42efd9 5617 {
simon 0:1014af42efd9 5618 /* Take initial guess as half the input */
simon 0:1014af42efd9 5619 prevOut = in / 2;
simon 0:1014af42efd9 5620
simon 0:1014af42efd9 5621 /* run for ten iterations */
simon 0:1014af42efd9 5622 out = 0.5f * (prevOut + (in / prevOut));
simon 0:1014af42efd9 5623 prevOut = 0.5f * (out + (in / out));
simon 0:1014af42efd9 5624
simon 0:1014af42efd9 5625 /* Third iteration */
simon 0:1014af42efd9 5626 out = 0.5f * (prevOut + (in / prevOut));
simon 0:1014af42efd9 5627 prevOut = 0.5f * (out + (in / out));
simon 0:1014af42efd9 5628
simon 0:1014af42efd9 5629 /* Fifth iteration */
simon 0:1014af42efd9 5630 out = 0.5f * (prevOut + (in / prevOut));
simon 0:1014af42efd9 5631 prevOut = 0.5f * (out + (in / out));
simon 0:1014af42efd9 5632
simon 0:1014af42efd9 5633 /* Seventh iteration */
simon 0:1014af42efd9 5634 out = 0.5f * (prevOut + (in / prevOut));
simon 0:1014af42efd9 5635 prevOut = 0.5f * (out + (in / out));
simon 0:1014af42efd9 5636 out = 0.5f * (prevOut + (in / prevOut));
simon 0:1014af42efd9 5637
simon 0:1014af42efd9 5638 /* tenth iteration */
simon 0:1014af42efd9 5639 *pOut = 0.5f * (out + (in / out));
simon 0:1014af42efd9 5640 return (ARM_MATH_SUCCESS);
simon 0:1014af42efd9 5641 }
simon 0:1014af42efd9 5642 else
simon 0:1014af42efd9 5643 {
simon 0:1014af42efd9 5644 *pOut = 0.0f;
simon 0:1014af42efd9 5645 return (ARM_MATH_ARGUMENT_ERROR);
simon 0:1014af42efd9 5646 }
simon 0:1014af42efd9 5647
simon 0:1014af42efd9 5648 }
simon 0:1014af42efd9 5649
simon 0:1014af42efd9 5650
simon 0:1014af42efd9 5651 /**
simon 0:1014af42efd9 5652 * @brief Q31 square root function.
simon 0:1014af42efd9 5653 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
simon 0:1014af42efd9 5654 * @param[out] *pOut square root of input value.
simon 0:1014af42efd9 5655 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
simon 0:1014af42efd9 5656 * <code>in</code> is negative value and returns zero output for negative values.
simon 0:1014af42efd9 5657 */
simon 0:1014af42efd9 5658 arm_status arm_sqrt_q31(
simon 0:1014af42efd9 5659 q31_t in, q31_t *pOut);
simon 0:1014af42efd9 5660
simon 0:1014af42efd9 5661 /**
simon 0:1014af42efd9 5662 * @brief Q15 square root function.
simon 0:1014af42efd9 5663 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
simon 0:1014af42efd9 5664 * @param[out] *pOut square root of input value.
simon 0:1014af42efd9 5665 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
simon 0:1014af42efd9 5666 * <code>in</code> is negative value and returns zero output for negative values.
simon 0:1014af42efd9 5667 */
simon 0:1014af42efd9 5668 arm_status arm_sqrt_q15(
simon 0:1014af42efd9 5669 q15_t in, q15_t *pOut);
simon 0:1014af42efd9 5670
simon 0:1014af42efd9 5671 /**
simon 0:1014af42efd9 5672 * @} end of SQRT group
simon 0:1014af42efd9 5673 */
simon 0:1014af42efd9 5674
simon 0:1014af42efd9 5675
simon 0:1014af42efd9 5676
simon 0:1014af42efd9 5677
simon 0:1014af42efd9 5678
simon 0:1014af42efd9 5679
simon 0:1014af42efd9 5680 /**
simon 0:1014af42efd9 5681 * @brief floating-point Circular write function.
simon 0:1014af42efd9 5682 */
simon 0:1014af42efd9 5683
simon 0:1014af42efd9 5684 static __INLINE void arm_circularWrite_f32(
simon 0:1014af42efd9 5685 int32_t * circBuffer,
simon 0:1014af42efd9 5686 int32_t L,
simon 0:1014af42efd9 5687 uint16_t * writeOffset,
simon 0:1014af42efd9 5688 int32_t bufferInc,
simon 0:1014af42efd9 5689 const int32_t * src,
simon 0:1014af42efd9 5690 int32_t srcInc,
simon 0:1014af42efd9 5691 uint32_t blockSize)
simon 0:1014af42efd9 5692 {
simon 0:1014af42efd9 5693 uint32_t i = 0u;
simon 0:1014af42efd9 5694 int32_t wOffset;
simon 0:1014af42efd9 5695
simon 0:1014af42efd9 5696 /* Copy the value of Index pointer that points
simon 0:1014af42efd9 5697 * to the current location where the input samples to be copied */
simon 0:1014af42efd9 5698 wOffset = *writeOffset;
simon 0:1014af42efd9 5699
simon 0:1014af42efd9 5700 /* Loop over the blockSize */
simon 0:1014af42efd9 5701 i = blockSize;
simon 0:1014af42efd9 5702
simon 0:1014af42efd9 5703 while(i > 0u)
simon 0:1014af42efd9 5704 {
simon 0:1014af42efd9 5705 /* copy the input sample to the circular buffer */
simon 0:1014af42efd9 5706 circBuffer[wOffset] = *src;
simon 0:1014af42efd9 5707
simon 0:1014af42efd9 5708 /* Update the input pointer */
simon 0:1014af42efd9 5709 src += srcInc;
simon 0:1014af42efd9 5710
simon 0:1014af42efd9 5711 /* Circularly update wOffset. Watch out for positive and negative value */
simon 0:1014af42efd9 5712 wOffset += bufferInc;
simon 0:1014af42efd9 5713 if(wOffset >= L)
simon 0:1014af42efd9 5714 wOffset -= L;
simon 0:1014af42efd9 5715
simon 0:1014af42efd9 5716 /* Decrement the loop counter */
simon 0:1014af42efd9 5717 i--;
simon 0:1014af42efd9 5718 }
simon 0:1014af42efd9 5719
simon 0:1014af42efd9 5720 /* Update the index pointer */
simon 0:1014af42efd9 5721 *writeOffset = wOffset;
simon 0:1014af42efd9 5722 }
simon 0:1014af42efd9 5723
simon 0:1014af42efd9 5724
simon 0:1014af42efd9 5725
simon 0:1014af42efd9 5726 /**
simon 0:1014af42efd9 5727 * @brief floating-point Circular Read function.
simon 0:1014af42efd9 5728 */
simon 0:1014af42efd9 5729 static __INLINE void arm_circularRead_f32(
simon 0:1014af42efd9 5730 int32_t * circBuffer,
simon 0:1014af42efd9 5731 int32_t L,
simon 0:1014af42efd9 5732 int32_t * readOffset,
simon 0:1014af42efd9 5733 int32_t bufferInc,
simon 0:1014af42efd9 5734 int32_t * dst,
simon 0:1014af42efd9 5735 int32_t * dst_base,
simon 0:1014af42efd9 5736 int32_t dst_length,
simon 0:1014af42efd9 5737 int32_t dstInc,
simon 0:1014af42efd9 5738 uint32_t blockSize)
simon 0:1014af42efd9 5739 {
simon 0:1014af42efd9 5740 uint32_t i = 0u;
simon 0:1014af42efd9 5741 int32_t rOffset, dst_end;
simon 0:1014af42efd9 5742
simon 0:1014af42efd9 5743 /* Copy the value of Index pointer that points
simon 0:1014af42efd9 5744 * to the current location from where the input samples to be read */
simon 0:1014af42efd9 5745 rOffset = *readOffset;
simon 0:1014af42efd9 5746 dst_end = (int32_t) (dst_base + dst_length);
simon 0:1014af42efd9 5747
simon 0:1014af42efd9 5748 /* Loop over the blockSize */
simon 0:1014af42efd9 5749 i = blockSize;
simon 0:1014af42efd9 5750
simon 0:1014af42efd9 5751 while(i > 0u)
simon 0:1014af42efd9 5752 {
simon 0:1014af42efd9 5753 /* copy the sample from the circular buffer to the destination buffer */
simon 0:1014af42efd9 5754 *dst = circBuffer[rOffset];
simon 0:1014af42efd9 5755
simon 0:1014af42efd9 5756 /* Update the input pointer */
simon 0:1014af42efd9 5757 dst += dstInc;
simon 0:1014af42efd9 5758
simon 0:1014af42efd9 5759 if(dst == (int32_t *) dst_end)
simon 0:1014af42efd9 5760 {
simon 0:1014af42efd9 5761 dst = dst_base;
simon 0:1014af42efd9 5762 }
simon 0:1014af42efd9 5763
simon 0:1014af42efd9 5764 /* Circularly update rOffset. Watch out for positive and negative value */
simon 0:1014af42efd9 5765 rOffset += bufferInc;
simon 0:1014af42efd9 5766
simon 0:1014af42efd9 5767 if(rOffset >= L)
simon 0:1014af42efd9 5768 {
simon 0:1014af42efd9 5769 rOffset -= L;
simon 0:1014af42efd9 5770 }
simon 0:1014af42efd9 5771
simon 0:1014af42efd9 5772 /* Decrement the loop counter */
simon 0:1014af42efd9 5773 i--;
simon 0:1014af42efd9 5774 }
simon 0:1014af42efd9 5775
simon 0:1014af42efd9 5776 /* Update the index pointer */
simon 0:1014af42efd9 5777 *readOffset = rOffset;
simon 0:1014af42efd9 5778 }
simon 0:1014af42efd9 5779
simon 0:1014af42efd9 5780 /**
simon 0:1014af42efd9 5781 * @brief Q15 Circular write function.
simon 0:1014af42efd9 5782 */
simon 0:1014af42efd9 5783
simon 0:1014af42efd9 5784 static __INLINE void arm_circularWrite_q15(
simon 0:1014af42efd9 5785 q15_t * circBuffer,
simon 0:1014af42efd9 5786 int32_t L,
simon 0:1014af42efd9 5787 uint16_t * writeOffset,
simon 0:1014af42efd9 5788 int32_t bufferInc,
simon 0:1014af42efd9 5789 const q15_t * src,
simon 0:1014af42efd9 5790 int32_t srcInc,
simon 0:1014af42efd9 5791 uint32_t blockSize)
simon 0:1014af42efd9 5792 {
simon 0:1014af42efd9 5793 uint32_t i = 0u;
simon 0:1014af42efd9 5794 int32_t wOffset;
simon 0:1014af42efd9 5795
simon 0:1014af42efd9 5796 /* Copy the value of Index pointer that points
simon 0:1014af42efd9 5797 * to the current location where the input samples to be copied */
simon 0:1014af42efd9 5798 wOffset = *writeOffset;
simon 0:1014af42efd9 5799
simon 0:1014af42efd9 5800 /* Loop over the blockSize */
simon 0:1014af42efd9 5801 i = blockSize;
simon 0:1014af42efd9 5802
simon 0:1014af42efd9 5803 while(i > 0u)
simon 0:1014af42efd9 5804 {
simon 0:1014af42efd9 5805 /* copy the input sample to the circular buffer */
simon 0:1014af42efd9 5806 circBuffer[wOffset] = *src;
simon 0:1014af42efd9 5807
simon 0:1014af42efd9 5808 /* Update the input pointer */
simon 0:1014af42efd9 5809 src += srcInc;
simon 0:1014af42efd9 5810
simon 0:1014af42efd9 5811 /* Circularly update wOffset. Watch out for positive and negative value */
simon 0:1014af42efd9 5812 wOffset += bufferInc;
simon 0:1014af42efd9 5813 if(wOffset >= L)
simon 0:1014af42efd9 5814 wOffset -= L;
simon 0:1014af42efd9 5815
simon 0:1014af42efd9 5816 /* Decrement the loop counter */
simon 0:1014af42efd9 5817 i--;
simon 0:1014af42efd9 5818 }
simon 0:1014af42efd9 5819
simon 0:1014af42efd9 5820 /* Update the index pointer */
simon 0:1014af42efd9 5821 *writeOffset = wOffset;
simon 0:1014af42efd9 5822 }
simon 0:1014af42efd9 5823
simon 0:1014af42efd9 5824
simon 0:1014af42efd9 5825
simon 0:1014af42efd9 5826 /**
simon 0:1014af42efd9 5827 * @brief Q15 Circular Read function.
simon 0:1014af42efd9 5828 */
simon 0:1014af42efd9 5829 static __INLINE void arm_circularRead_q15(
simon 0:1014af42efd9 5830 q15_t * circBuffer,
simon 0:1014af42efd9 5831 int32_t L,
simon 0:1014af42efd9 5832 int32_t * readOffset,
simon 0:1014af42efd9 5833 int32_t bufferInc,
simon 0:1014af42efd9 5834 q15_t * dst,
simon 0:1014af42efd9 5835 q15_t * dst_base,
simon 0:1014af42efd9 5836 int32_t dst_length,
simon 0:1014af42efd9 5837 int32_t dstInc,
simon 0:1014af42efd9 5838 uint32_t blockSize)
simon 0:1014af42efd9 5839 {
simon 0:1014af42efd9 5840 uint32_t i = 0;
simon 0:1014af42efd9 5841 int32_t rOffset, dst_end;
simon 0:1014af42efd9 5842
simon 0:1014af42efd9 5843 /* Copy the value of Index pointer that points
simon 0:1014af42efd9 5844 * to the current location from where the input samples to be read */
simon 0:1014af42efd9 5845 rOffset = *readOffset;
simon 0:1014af42efd9 5846
simon 0:1014af42efd9 5847 dst_end = (int32_t) (dst_base + dst_length);
simon 0:1014af42efd9 5848
simon 0:1014af42efd9 5849 /* Loop over the blockSize */
simon 0:1014af42efd9 5850 i = blockSize;
simon 0:1014af42efd9 5851
simon 0:1014af42efd9 5852 while(i > 0u)
simon 0:1014af42efd9 5853 {
simon 0:1014af42efd9 5854 /* copy the sample from the circular buffer to the destination buffer */
simon 0:1014af42efd9 5855 *dst = circBuffer[rOffset];
simon 0:1014af42efd9 5856
simon 0:1014af42efd9 5857 /* Update the input pointer */
simon 0:1014af42efd9 5858 dst += dstInc;
simon 0:1014af42efd9 5859
simon 0:1014af42efd9 5860 if(dst == (q15_t *) dst_end)
simon 0:1014af42efd9 5861 {
simon 0:1014af42efd9 5862 dst = dst_base;
simon 0:1014af42efd9 5863 }
simon 0:1014af42efd9 5864
simon 0:1014af42efd9 5865 /* Circularly update wOffset. Watch out for positive and negative value */
simon 0:1014af42efd9 5866 rOffset += bufferInc;
simon 0:1014af42efd9 5867
simon 0:1014af42efd9 5868 if(rOffset >= L)
simon 0:1014af42efd9 5869 {
simon 0:1014af42efd9 5870 rOffset -= L;
simon 0:1014af42efd9 5871 }
simon 0:1014af42efd9 5872
simon 0:1014af42efd9 5873 /* Decrement the loop counter */
simon 0:1014af42efd9 5874 i--;
simon 0:1014af42efd9 5875 }
simon 0:1014af42efd9 5876
simon 0:1014af42efd9 5877 /* Update the index pointer */
simon 0:1014af42efd9 5878 *readOffset = rOffset;
simon 0:1014af42efd9 5879 }
simon 0:1014af42efd9 5880
simon 0:1014af42efd9 5881
simon 0:1014af42efd9 5882 /**
simon 0:1014af42efd9 5883 * @brief Q7 Circular write function.
simon 0:1014af42efd9 5884 */
simon 0:1014af42efd9 5885
simon 0:1014af42efd9 5886 static __INLINE void arm_circularWrite_q7(
simon 0:1014af42efd9 5887 q7_t * circBuffer,
simon 0:1014af42efd9 5888 int32_t L,
simon 0:1014af42efd9 5889 uint16_t * writeOffset,
simon 0:1014af42efd9 5890 int32_t bufferInc,
simon 0:1014af42efd9 5891 const q7_t * src,
simon 0:1014af42efd9 5892 int32_t srcInc,
simon 0:1014af42efd9 5893 uint32_t blockSize)
simon 0:1014af42efd9 5894 {
simon 0:1014af42efd9 5895 uint32_t i = 0u;
simon 0:1014af42efd9 5896 int32_t wOffset;
simon 0:1014af42efd9 5897
simon 0:1014af42efd9 5898 /* Copy the value of Index pointer that points
simon 0:1014af42efd9 5899 * to the current location where the input samples to be copied */
simon 0:1014af42efd9 5900 wOffset = *writeOffset;
simon 0:1014af42efd9 5901
simon 0:1014af42efd9 5902 /* Loop over the blockSize */
simon 0:1014af42efd9 5903 i = blockSize;
simon 0:1014af42efd9 5904
simon 0:1014af42efd9 5905 while(i > 0u)
simon 0:1014af42efd9 5906 {
simon 0:1014af42efd9 5907 /* copy the input sample to the circular buffer */
simon 0:1014af42efd9 5908 circBuffer[wOffset] = *src;
simon 0:1014af42efd9 5909
simon 0:1014af42efd9 5910 /* Update the input pointer */
simon 0:1014af42efd9 5911 src += srcInc;
simon 0:1014af42efd9 5912
simon 0:1014af42efd9 5913 /* Circularly update wOffset. Watch out for positive and negative value */
simon 0:1014af42efd9 5914 wOffset += bufferInc;
simon 0:1014af42efd9 5915 if(wOffset >= L)
simon 0:1014af42efd9 5916 wOffset -= L;
simon 0:1014af42efd9 5917
simon 0:1014af42efd9 5918 /* Decrement the loop counter */
simon 0:1014af42efd9 5919 i--;
simon 0:1014af42efd9 5920 }
simon 0:1014af42efd9 5921
simon 0:1014af42efd9 5922 /* Update the index pointer */
simon 0:1014af42efd9 5923 *writeOffset = wOffset;
simon 0:1014af42efd9 5924 }
simon 0:1014af42efd9 5925
simon 0:1014af42efd9 5926
simon 0:1014af42efd9 5927
simon 0:1014af42efd9 5928 /**
simon 0:1014af42efd9 5929 * @brief Q7 Circular Read function.
simon 0:1014af42efd9 5930 */
simon 0:1014af42efd9 5931 static __INLINE void arm_circularRead_q7(
simon 0:1014af42efd9 5932 q7_t * circBuffer,
simon 0:1014af42efd9 5933 int32_t L,
simon 0:1014af42efd9 5934 int32_t * readOffset,
simon 0:1014af42efd9 5935 int32_t bufferInc,
simon 0:1014af42efd9 5936 q7_t * dst,
simon 0:1014af42efd9 5937 q7_t * dst_base,
simon 0:1014af42efd9 5938 int32_t dst_length,
simon 0:1014af42efd9 5939 int32_t dstInc,
simon 0:1014af42efd9 5940 uint32_t blockSize)
simon 0:1014af42efd9 5941 {
simon 0:1014af42efd9 5942 uint32_t i = 0;
simon 0:1014af42efd9 5943 int32_t rOffset, dst_end;
simon 0:1014af42efd9 5944
simon 0:1014af42efd9 5945 /* Copy the value of Index pointer that points
simon 0:1014af42efd9 5946 * to the current location from where the input samples to be read */
simon 0:1014af42efd9 5947 rOffset = *readOffset;
simon 0:1014af42efd9 5948
simon 0:1014af42efd9 5949 dst_end = (int32_t) (dst_base + dst_length);
simon 0:1014af42efd9 5950
simon 0:1014af42efd9 5951 /* Loop over the blockSize */
simon 0:1014af42efd9 5952 i = blockSize;
simon 0:1014af42efd9 5953
simon 0:1014af42efd9 5954 while(i > 0u)
simon 0:1014af42efd9 5955 {
simon 0:1014af42efd9 5956 /* copy the sample from the circular buffer to the destination buffer */
simon 0:1014af42efd9 5957 *dst = circBuffer[rOffset];
simon 0:1014af42efd9 5958
simon 0:1014af42efd9 5959 /* Update the input pointer */
simon 0:1014af42efd9 5960 dst += dstInc;
simon 0:1014af42efd9 5961
simon 0:1014af42efd9 5962 if(dst == (q7_t *) dst_end)
simon 0:1014af42efd9 5963 {
simon 0:1014af42efd9 5964 dst = dst_base;
simon 0:1014af42efd9 5965 }
simon 0:1014af42efd9 5966
simon 0:1014af42efd9 5967 /* Circularly update rOffset. Watch out for positive and negative value */
simon 0:1014af42efd9 5968 rOffset += bufferInc;
simon 0:1014af42efd9 5969
simon 0:1014af42efd9 5970 if(rOffset >= L)
simon 0:1014af42efd9 5971 {
simon 0:1014af42efd9 5972 rOffset -= L;
simon 0:1014af42efd9 5973 }
simon 0:1014af42efd9 5974
simon 0:1014af42efd9 5975 /* Decrement the loop counter */
simon 0:1014af42efd9 5976 i--;
simon 0:1014af42efd9 5977 }
simon 0:1014af42efd9 5978
simon 0:1014af42efd9 5979 /* Update the index pointer */
simon 0:1014af42efd9 5980 *readOffset = rOffset;
simon 0:1014af42efd9 5981 }
simon 0:1014af42efd9 5982
simon 0:1014af42efd9 5983
simon 0:1014af42efd9 5984 /**
simon 0:1014af42efd9 5985 * @brief Sum of the squares of the elements of a Q31 vector.
simon 0:1014af42efd9 5986 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 5987 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 5988 * @param[out] *pResult is output value.
simon 0:1014af42efd9 5989 * @return none.
simon 0:1014af42efd9 5990 */
simon 0:1014af42efd9 5991
simon 0:1014af42efd9 5992 void arm_power_q31(
simon 0:1014af42efd9 5993 q31_t * pSrc,
simon 0:1014af42efd9 5994 uint32_t blockSize,
simon 0:1014af42efd9 5995 q63_t * pResult);
simon 0:1014af42efd9 5996
simon 0:1014af42efd9 5997 /**
simon 0:1014af42efd9 5998 * @brief Sum of the squares of the elements of a floating-point vector.
simon 0:1014af42efd9 5999 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6000 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6001 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6002 * @return none.
simon 0:1014af42efd9 6003 */
simon 0:1014af42efd9 6004
simon 0:1014af42efd9 6005 void arm_power_f32(
simon 0:1014af42efd9 6006 float32_t * pSrc,
simon 0:1014af42efd9 6007 uint32_t blockSize,
simon 0:1014af42efd9 6008 float32_t * pResult);
simon 0:1014af42efd9 6009
simon 0:1014af42efd9 6010 /**
simon 0:1014af42efd9 6011 * @brief Sum of the squares of the elements of a Q15 vector.
simon 0:1014af42efd9 6012 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6013 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6014 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6015 * @return none.
simon 0:1014af42efd9 6016 */
simon 0:1014af42efd9 6017
simon 0:1014af42efd9 6018 void arm_power_q15(
simon 0:1014af42efd9 6019 q15_t * pSrc,
simon 0:1014af42efd9 6020 uint32_t blockSize,
simon 0:1014af42efd9 6021 q63_t * pResult);
simon 0:1014af42efd9 6022
simon 0:1014af42efd9 6023 /**
simon 0:1014af42efd9 6024 * @brief Sum of the squares of the elements of a Q7 vector.
simon 0:1014af42efd9 6025 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6026 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6027 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6028 * @return none.
simon 0:1014af42efd9 6029 */
simon 0:1014af42efd9 6030
simon 0:1014af42efd9 6031 void arm_power_q7(
simon 0:1014af42efd9 6032 q7_t * pSrc,
simon 0:1014af42efd9 6033 uint32_t blockSize,
simon 0:1014af42efd9 6034 q31_t * pResult);
simon 0:1014af42efd9 6035
simon 0:1014af42efd9 6036 /**
simon 0:1014af42efd9 6037 * @brief Mean value of a Q7 vector.
simon 0:1014af42efd9 6038 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6039 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6040 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6041 * @return none.
simon 0:1014af42efd9 6042 */
simon 0:1014af42efd9 6043
simon 0:1014af42efd9 6044 void arm_mean_q7(
simon 0:1014af42efd9 6045 q7_t * pSrc,
simon 0:1014af42efd9 6046 uint32_t blockSize,
simon 0:1014af42efd9 6047 q7_t * pResult);
simon 0:1014af42efd9 6048
simon 0:1014af42efd9 6049 /**
simon 0:1014af42efd9 6050 * @brief Mean value of a Q15 vector.
simon 0:1014af42efd9 6051 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6052 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6053 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6054 * @return none.
simon 0:1014af42efd9 6055 */
simon 0:1014af42efd9 6056 void arm_mean_q15(
simon 0:1014af42efd9 6057 q15_t * pSrc,
simon 0:1014af42efd9 6058 uint32_t blockSize,
simon 0:1014af42efd9 6059 q15_t * pResult);
simon 0:1014af42efd9 6060
simon 0:1014af42efd9 6061 /**
simon 0:1014af42efd9 6062 * @brief Mean value of a Q31 vector.
simon 0:1014af42efd9 6063 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6064 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6065 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6066 * @return none.
simon 0:1014af42efd9 6067 */
simon 0:1014af42efd9 6068 void arm_mean_q31(
simon 0:1014af42efd9 6069 q31_t * pSrc,
simon 0:1014af42efd9 6070 uint32_t blockSize,
simon 0:1014af42efd9 6071 q31_t * pResult);
simon 0:1014af42efd9 6072
simon 0:1014af42efd9 6073 /**
simon 0:1014af42efd9 6074 * @brief Mean value of a floating-point vector.
simon 0:1014af42efd9 6075 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6076 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6077 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6078 * @return none.
simon 0:1014af42efd9 6079 */
simon 0:1014af42efd9 6080 void arm_mean_f32(
simon 0:1014af42efd9 6081 float32_t * pSrc,
simon 0:1014af42efd9 6082 uint32_t blockSize,
simon 0:1014af42efd9 6083 float32_t * pResult);
simon 0:1014af42efd9 6084
simon 0:1014af42efd9 6085 /**
simon 0:1014af42efd9 6086 * @brief Variance of the elements of a floating-point vector.
simon 0:1014af42efd9 6087 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6088 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6089 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6090 * @return none.
simon 0:1014af42efd9 6091 */
simon 0:1014af42efd9 6092
simon 0:1014af42efd9 6093 void arm_var_f32(
simon 0:1014af42efd9 6094 float32_t * pSrc,
simon 0:1014af42efd9 6095 uint32_t blockSize,
simon 0:1014af42efd9 6096 float32_t * pResult);
simon 0:1014af42efd9 6097
simon 0:1014af42efd9 6098 /**
simon 0:1014af42efd9 6099 * @brief Variance of the elements of a Q31 vector.
simon 0:1014af42efd9 6100 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6101 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6102 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6103 * @return none.
simon 0:1014af42efd9 6104 */
simon 0:1014af42efd9 6105
simon 0:1014af42efd9 6106 void arm_var_q31(
simon 0:1014af42efd9 6107 q31_t * pSrc,
simon 0:1014af42efd9 6108 uint32_t blockSize,
simon 0:1014af42efd9 6109 q63_t * pResult);
simon 0:1014af42efd9 6110
simon 0:1014af42efd9 6111 /**
simon 0:1014af42efd9 6112 * @brief Variance of the elements of a Q15 vector.
simon 0:1014af42efd9 6113 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6114 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6115 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6116 * @return none.
simon 0:1014af42efd9 6117 */
simon 0:1014af42efd9 6118
simon 0:1014af42efd9 6119 void arm_var_q15(
simon 0:1014af42efd9 6120 q15_t * pSrc,
simon 0:1014af42efd9 6121 uint32_t blockSize,
simon 0:1014af42efd9 6122 q31_t * pResult);
simon 0:1014af42efd9 6123
simon 0:1014af42efd9 6124 /**
simon 0:1014af42efd9 6125 * @brief Root Mean Square of the elements of a floating-point vector.
simon 0:1014af42efd9 6126 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6127 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6128 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6129 * @return none.
simon 0:1014af42efd9 6130 */
simon 0:1014af42efd9 6131
simon 0:1014af42efd9 6132 void arm_rms_f32(
simon 0:1014af42efd9 6133 float32_t * pSrc,
simon 0:1014af42efd9 6134 uint32_t blockSize,
simon 0:1014af42efd9 6135 float32_t * pResult);
simon 0:1014af42efd9 6136
simon 0:1014af42efd9 6137 /**
simon 0:1014af42efd9 6138 * @brief Root Mean Square of the elements of a Q31 vector.
simon 0:1014af42efd9 6139 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6140 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6141 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6142 * @return none.
simon 0:1014af42efd9 6143 */
simon 0:1014af42efd9 6144
simon 0:1014af42efd9 6145 void arm_rms_q31(
simon 0:1014af42efd9 6146 q31_t * pSrc,
simon 0:1014af42efd9 6147 uint32_t blockSize,
simon 0:1014af42efd9 6148 q31_t * pResult);
simon 0:1014af42efd9 6149
simon 0:1014af42efd9 6150 /**
simon 0:1014af42efd9 6151 * @brief Root Mean Square of the elements of a Q15 vector.
simon 0:1014af42efd9 6152 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6153 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6154 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6155 * @return none.
simon 0:1014af42efd9 6156 */
simon 0:1014af42efd9 6157
simon 0:1014af42efd9 6158 void arm_rms_q15(
simon 0:1014af42efd9 6159 q15_t * pSrc,
simon 0:1014af42efd9 6160 uint32_t blockSize,
simon 0:1014af42efd9 6161 q15_t * pResult);
simon 0:1014af42efd9 6162
simon 0:1014af42efd9 6163 /**
simon 0:1014af42efd9 6164 * @brief Standard deviation of the elements of a floating-point vector.
simon 0:1014af42efd9 6165 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6166 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6167 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6168 * @return none.
simon 0:1014af42efd9 6169 */
simon 0:1014af42efd9 6170
simon 0:1014af42efd9 6171 void arm_std_f32(
simon 0:1014af42efd9 6172 float32_t * pSrc,
simon 0:1014af42efd9 6173 uint32_t blockSize,
simon 0:1014af42efd9 6174 float32_t * pResult);
simon 0:1014af42efd9 6175
simon 0:1014af42efd9 6176 /**
simon 0:1014af42efd9 6177 * @brief Standard deviation of the elements of a Q31 vector.
simon 0:1014af42efd9 6178 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6179 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6180 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6181 * @return none.
simon 0:1014af42efd9 6182 */
simon 0:1014af42efd9 6183
simon 0:1014af42efd9 6184 void arm_std_q31(
simon 0:1014af42efd9 6185 q31_t * pSrc,
simon 0:1014af42efd9 6186 uint32_t blockSize,
simon 0:1014af42efd9 6187 q31_t * pResult);
simon 0:1014af42efd9 6188
simon 0:1014af42efd9 6189 /**
simon 0:1014af42efd9 6190 * @brief Standard deviation of the elements of a Q15 vector.
simon 0:1014af42efd9 6191 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6192 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6193 * @param[out] *pResult is output value.
simon 0:1014af42efd9 6194 * @return none.
simon 0:1014af42efd9 6195 */
simon 0:1014af42efd9 6196
simon 0:1014af42efd9 6197 void arm_std_q15(
simon 0:1014af42efd9 6198 q15_t * pSrc,
simon 0:1014af42efd9 6199 uint32_t blockSize,
simon 0:1014af42efd9 6200 q15_t * pResult);
simon 0:1014af42efd9 6201
simon 0:1014af42efd9 6202 /**
simon 0:1014af42efd9 6203 * @brief Floating-point complex magnitude
simon 0:1014af42efd9 6204 * @param[in] *pSrc points to the complex input vector
simon 0:1014af42efd9 6205 * @param[out] *pDst points to the real output vector
simon 0:1014af42efd9 6206 * @param[in] numSamples number of complex samples in the input vector
simon 0:1014af42efd9 6207 * @return none.
simon 0:1014af42efd9 6208 */
simon 0:1014af42efd9 6209
simon 0:1014af42efd9 6210 void arm_cmplx_mag_f32(
simon 0:1014af42efd9 6211 float32_t * pSrc,
simon 0:1014af42efd9 6212 float32_t * pDst,
simon 0:1014af42efd9 6213 uint32_t numSamples);
simon 0:1014af42efd9 6214
simon 0:1014af42efd9 6215 /**
simon 0:1014af42efd9 6216 * @brief Q31 complex magnitude
simon 0:1014af42efd9 6217 * @param[in] *pSrc points to the complex input vector
simon 0:1014af42efd9 6218 * @param[out] *pDst points to the real output vector
simon 0:1014af42efd9 6219 * @param[in] numSamples number of complex samples in the input vector
simon 0:1014af42efd9 6220 * @return none.
simon 0:1014af42efd9 6221 */
simon 0:1014af42efd9 6222
simon 0:1014af42efd9 6223 void arm_cmplx_mag_q31(
simon 0:1014af42efd9 6224 q31_t * pSrc,
simon 0:1014af42efd9 6225 q31_t * pDst,
simon 0:1014af42efd9 6226 uint32_t numSamples);
simon 0:1014af42efd9 6227
simon 0:1014af42efd9 6228 /**
simon 0:1014af42efd9 6229 * @brief Q15 complex magnitude
simon 0:1014af42efd9 6230 * @param[in] *pSrc points to the complex input vector
simon 0:1014af42efd9 6231 * @param[out] *pDst points to the real output vector
simon 0:1014af42efd9 6232 * @param[in] numSamples number of complex samples in the input vector
simon 0:1014af42efd9 6233 * @return none.
simon 0:1014af42efd9 6234 */
simon 0:1014af42efd9 6235
simon 0:1014af42efd9 6236 void arm_cmplx_mag_q15(
simon 0:1014af42efd9 6237 q15_t * pSrc,
simon 0:1014af42efd9 6238 q15_t * pDst,
simon 0:1014af42efd9 6239 uint32_t numSamples);
simon 0:1014af42efd9 6240
simon 0:1014af42efd9 6241 /**
simon 0:1014af42efd9 6242 * @brief Q15 complex dot product
simon 0:1014af42efd9 6243 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 6244 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 6245 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 6246 * @param[out] *realResult real part of the result returned here
simon 0:1014af42efd9 6247 * @param[out] *imagResult imaginary part of the result returned here
simon 0:1014af42efd9 6248 * @return none.
simon 0:1014af42efd9 6249 */
simon 0:1014af42efd9 6250
simon 0:1014af42efd9 6251 void arm_cmplx_dot_prod_q15(
simon 0:1014af42efd9 6252 q15_t * pSrcA,
simon 0:1014af42efd9 6253 q15_t * pSrcB,
simon 0:1014af42efd9 6254 uint32_t numSamples,
simon 0:1014af42efd9 6255 q31_t * realResult,
simon 0:1014af42efd9 6256 q31_t * imagResult);
simon 0:1014af42efd9 6257
simon 0:1014af42efd9 6258 /**
simon 0:1014af42efd9 6259 * @brief Q31 complex dot product
simon 0:1014af42efd9 6260 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 6261 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 6262 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 6263 * @param[out] *realResult real part of the result returned here
simon 0:1014af42efd9 6264 * @param[out] *imagResult imaginary part of the result returned here
simon 0:1014af42efd9 6265 * @return none.
simon 0:1014af42efd9 6266 */
simon 0:1014af42efd9 6267
simon 0:1014af42efd9 6268 void arm_cmplx_dot_prod_q31(
simon 0:1014af42efd9 6269 q31_t * pSrcA,
simon 0:1014af42efd9 6270 q31_t * pSrcB,
simon 0:1014af42efd9 6271 uint32_t numSamples,
simon 0:1014af42efd9 6272 q63_t * realResult,
simon 0:1014af42efd9 6273 q63_t * imagResult);
simon 0:1014af42efd9 6274
simon 0:1014af42efd9 6275 /**
simon 0:1014af42efd9 6276 * @brief Floating-point complex dot product
simon 0:1014af42efd9 6277 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 6278 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 6279 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 6280 * @param[out] *realResult real part of the result returned here
simon 0:1014af42efd9 6281 * @param[out] *imagResult imaginary part of the result returned here
simon 0:1014af42efd9 6282 * @return none.
simon 0:1014af42efd9 6283 */
simon 0:1014af42efd9 6284
simon 0:1014af42efd9 6285 void arm_cmplx_dot_prod_f32(
simon 0:1014af42efd9 6286 float32_t * pSrcA,
simon 0:1014af42efd9 6287 float32_t * pSrcB,
simon 0:1014af42efd9 6288 uint32_t numSamples,
simon 0:1014af42efd9 6289 float32_t * realResult,
simon 0:1014af42efd9 6290 float32_t * imagResult);
simon 0:1014af42efd9 6291
simon 0:1014af42efd9 6292 /**
simon 0:1014af42efd9 6293 * @brief Q15 complex-by-real multiplication
simon 0:1014af42efd9 6294 * @param[in] *pSrcCmplx points to the complex input vector
simon 0:1014af42efd9 6295 * @param[in] *pSrcReal points to the real input vector
simon 0:1014af42efd9 6296 * @param[out] *pCmplxDst points to the complex output vector
simon 0:1014af42efd9 6297 * @param[in] numSamples number of samples in each vector
simon 0:1014af42efd9 6298 * @return none.
simon 0:1014af42efd9 6299 */
simon 0:1014af42efd9 6300
simon 0:1014af42efd9 6301 void arm_cmplx_mult_real_q15(
simon 0:1014af42efd9 6302 q15_t * pSrcCmplx,
simon 0:1014af42efd9 6303 q15_t * pSrcReal,
simon 0:1014af42efd9 6304 q15_t * pCmplxDst,
simon 0:1014af42efd9 6305 uint32_t numSamples);
simon 0:1014af42efd9 6306
simon 0:1014af42efd9 6307 /**
simon 0:1014af42efd9 6308 * @brief Q31 complex-by-real multiplication
simon 0:1014af42efd9 6309 * @param[in] *pSrcCmplx points to the complex input vector
simon 0:1014af42efd9 6310 * @param[in] *pSrcReal points to the real input vector
simon 0:1014af42efd9 6311 * @param[out] *pCmplxDst points to the complex output vector
simon 0:1014af42efd9 6312 * @param[in] numSamples number of samples in each vector
simon 0:1014af42efd9 6313 * @return none.
simon 0:1014af42efd9 6314 */
simon 0:1014af42efd9 6315
simon 0:1014af42efd9 6316 void arm_cmplx_mult_real_q31(
simon 0:1014af42efd9 6317 q31_t * pSrcCmplx,
simon 0:1014af42efd9 6318 q31_t * pSrcReal,
simon 0:1014af42efd9 6319 q31_t * pCmplxDst,
simon 0:1014af42efd9 6320 uint32_t numSamples);
simon 0:1014af42efd9 6321
simon 0:1014af42efd9 6322 /**
simon 0:1014af42efd9 6323 * @brief Floating-point complex-by-real multiplication
simon 0:1014af42efd9 6324 * @param[in] *pSrcCmplx points to the complex input vector
simon 0:1014af42efd9 6325 * @param[in] *pSrcReal points to the real input vector
simon 0:1014af42efd9 6326 * @param[out] *pCmplxDst points to the complex output vector
simon 0:1014af42efd9 6327 * @param[in] numSamples number of samples in each vector
simon 0:1014af42efd9 6328 * @return none.
simon 0:1014af42efd9 6329 */
simon 0:1014af42efd9 6330
simon 0:1014af42efd9 6331 void arm_cmplx_mult_real_f32(
simon 0:1014af42efd9 6332 float32_t * pSrcCmplx,
simon 0:1014af42efd9 6333 float32_t * pSrcReal,
simon 0:1014af42efd9 6334 float32_t * pCmplxDst,
simon 0:1014af42efd9 6335 uint32_t numSamples);
simon 0:1014af42efd9 6336
simon 0:1014af42efd9 6337 /**
simon 0:1014af42efd9 6338 * @brief Minimum value of a Q7 vector.
simon 0:1014af42efd9 6339 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6340 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6341 * @param[out] *result is output pointer
simon 0:1014af42efd9 6342 * @param[in] index is the array index of the minimum value in the input buffer.
simon 0:1014af42efd9 6343 * @return none.
simon 0:1014af42efd9 6344 */
simon 0:1014af42efd9 6345
simon 0:1014af42efd9 6346 void arm_min_q7(
simon 0:1014af42efd9 6347 q7_t * pSrc,
simon 0:1014af42efd9 6348 uint32_t blockSize,
simon 0:1014af42efd9 6349 q7_t * result,
simon 0:1014af42efd9 6350 uint32_t * index);
simon 0:1014af42efd9 6351
simon 0:1014af42efd9 6352 /**
simon 0:1014af42efd9 6353 * @brief Minimum value of a Q15 vector.
simon 0:1014af42efd9 6354 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6355 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6356 * @param[out] *pResult is output pointer
simon 0:1014af42efd9 6357 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
simon 0:1014af42efd9 6358 * @return none.
simon 0:1014af42efd9 6359 */
simon 0:1014af42efd9 6360
simon 0:1014af42efd9 6361 void arm_min_q15(
simon 0:1014af42efd9 6362 q15_t * pSrc,
simon 0:1014af42efd9 6363 uint32_t blockSize,
simon 0:1014af42efd9 6364 q15_t * pResult,
simon 0:1014af42efd9 6365 uint32_t * pIndex);
simon 0:1014af42efd9 6366
simon 0:1014af42efd9 6367 /**
simon 0:1014af42efd9 6368 * @brief Minimum value of a Q31 vector.
simon 0:1014af42efd9 6369 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6370 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6371 * @param[out] *pResult is output pointer
simon 0:1014af42efd9 6372 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
simon 0:1014af42efd9 6373 * @return none.
simon 0:1014af42efd9 6374 */
simon 0:1014af42efd9 6375 void arm_min_q31(
simon 0:1014af42efd9 6376 q31_t * pSrc,
simon 0:1014af42efd9 6377 uint32_t blockSize,
simon 0:1014af42efd9 6378 q31_t * pResult,
simon 0:1014af42efd9 6379 uint32_t * pIndex);
simon 0:1014af42efd9 6380
simon 0:1014af42efd9 6381 /**
simon 0:1014af42efd9 6382 * @brief Minimum value of a floating-point vector.
simon 0:1014af42efd9 6383 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6384 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6385 * @param[out] *pResult is output pointer
simon 0:1014af42efd9 6386 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
simon 0:1014af42efd9 6387 * @return none.
simon 0:1014af42efd9 6388 */
simon 0:1014af42efd9 6389
simon 0:1014af42efd9 6390 void arm_min_f32(
simon 0:1014af42efd9 6391 float32_t * pSrc,
simon 0:1014af42efd9 6392 uint32_t blockSize,
simon 0:1014af42efd9 6393 float32_t * pResult,
simon 0:1014af42efd9 6394 uint32_t * pIndex);
simon 0:1014af42efd9 6395
simon 0:1014af42efd9 6396 /**
simon 0:1014af42efd9 6397 * @brief Maximum value of a Q7 vector.
simon 0:1014af42efd9 6398 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 6399 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6400 * @param[out] *pResult maximum value returned here
simon 0:1014af42efd9 6401 * @param[out] *pIndex index of maximum value returned here
simon 0:1014af42efd9 6402 * @return none.
simon 0:1014af42efd9 6403 */
simon 0:1014af42efd9 6404
simon 0:1014af42efd9 6405 void arm_max_q7(
simon 0:1014af42efd9 6406 q7_t * pSrc,
simon 0:1014af42efd9 6407 uint32_t blockSize,
simon 0:1014af42efd9 6408 q7_t * pResult,
simon 0:1014af42efd9 6409 uint32_t * pIndex);
simon 0:1014af42efd9 6410
simon 0:1014af42efd9 6411 /**
simon 0:1014af42efd9 6412 * @brief Maximum value of a Q15 vector.
simon 0:1014af42efd9 6413 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 6414 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6415 * @param[out] *pResult maximum value returned here
simon 0:1014af42efd9 6416 * @param[out] *pIndex index of maximum value returned here
simon 0:1014af42efd9 6417 * @return none.
simon 0:1014af42efd9 6418 */
simon 0:1014af42efd9 6419
simon 0:1014af42efd9 6420 void arm_max_q15(
simon 0:1014af42efd9 6421 q15_t * pSrc,
simon 0:1014af42efd9 6422 uint32_t blockSize,
simon 0:1014af42efd9 6423 q15_t * pResult,
simon 0:1014af42efd9 6424 uint32_t * pIndex);
simon 0:1014af42efd9 6425
simon 0:1014af42efd9 6426 /**
simon 0:1014af42efd9 6427 * @brief Maximum value of a Q31 vector.
simon 0:1014af42efd9 6428 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 6429 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6430 * @param[out] *pResult maximum value returned here
simon 0:1014af42efd9 6431 * @param[out] *pIndex index of maximum value returned here
simon 0:1014af42efd9 6432 * @return none.
simon 0:1014af42efd9 6433 */
simon 0:1014af42efd9 6434
simon 0:1014af42efd9 6435 void arm_max_q31(
simon 0:1014af42efd9 6436 q31_t * pSrc,
simon 0:1014af42efd9 6437 uint32_t blockSize,
simon 0:1014af42efd9 6438 q31_t * pResult,
simon 0:1014af42efd9 6439 uint32_t * pIndex);
simon 0:1014af42efd9 6440
simon 0:1014af42efd9 6441 /**
simon 0:1014af42efd9 6442 * @brief Maximum value of a floating-point vector.
simon 0:1014af42efd9 6443 * @param[in] *pSrc points to the input buffer
simon 0:1014af42efd9 6444 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6445 * @param[out] *pResult maximum value returned here
simon 0:1014af42efd9 6446 * @param[out] *pIndex index of maximum value returned here
simon 0:1014af42efd9 6447 * @return none.
simon 0:1014af42efd9 6448 */
simon 0:1014af42efd9 6449
simon 0:1014af42efd9 6450 void arm_max_f32(
simon 0:1014af42efd9 6451 float32_t * pSrc,
simon 0:1014af42efd9 6452 uint32_t blockSize,
simon 0:1014af42efd9 6453 float32_t * pResult,
simon 0:1014af42efd9 6454 uint32_t * pIndex);
simon 0:1014af42efd9 6455
simon 0:1014af42efd9 6456 /**
simon 0:1014af42efd9 6457 * @brief Q15 complex-by-complex multiplication
simon 0:1014af42efd9 6458 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 6459 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 6460 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 6461 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 6462 * @return none.
simon 0:1014af42efd9 6463 */
simon 0:1014af42efd9 6464
simon 0:1014af42efd9 6465 void arm_cmplx_mult_cmplx_q15(
simon 0:1014af42efd9 6466 q15_t * pSrcA,
simon 0:1014af42efd9 6467 q15_t * pSrcB,
simon 0:1014af42efd9 6468 q15_t * pDst,
simon 0:1014af42efd9 6469 uint32_t numSamples);
simon 0:1014af42efd9 6470
simon 0:1014af42efd9 6471 /**
simon 0:1014af42efd9 6472 * @brief Q31 complex-by-complex multiplication
simon 0:1014af42efd9 6473 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 6474 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 6475 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 6476 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 6477 * @return none.
simon 0:1014af42efd9 6478 */
simon 0:1014af42efd9 6479
simon 0:1014af42efd9 6480 void arm_cmplx_mult_cmplx_q31(
simon 0:1014af42efd9 6481 q31_t * pSrcA,
simon 0:1014af42efd9 6482 q31_t * pSrcB,
simon 0:1014af42efd9 6483 q31_t * pDst,
simon 0:1014af42efd9 6484 uint32_t numSamples);
simon 0:1014af42efd9 6485
simon 0:1014af42efd9 6486 /**
simon 0:1014af42efd9 6487 * @brief Floating-point complex-by-complex multiplication
simon 0:1014af42efd9 6488 * @param[in] *pSrcA points to the first input vector
simon 0:1014af42efd9 6489 * @param[in] *pSrcB points to the second input vector
simon 0:1014af42efd9 6490 * @param[out] *pDst points to the output vector
simon 0:1014af42efd9 6491 * @param[in] numSamples number of complex samples in each vector
simon 0:1014af42efd9 6492 * @return none.
simon 0:1014af42efd9 6493 */
simon 0:1014af42efd9 6494
simon 0:1014af42efd9 6495 void arm_cmplx_mult_cmplx_f32(
simon 0:1014af42efd9 6496 float32_t * pSrcA,
simon 0:1014af42efd9 6497 float32_t * pSrcB,
simon 0:1014af42efd9 6498 float32_t * pDst,
simon 0:1014af42efd9 6499 uint32_t numSamples);
simon 0:1014af42efd9 6500
simon 0:1014af42efd9 6501 /**
simon 0:1014af42efd9 6502 * @brief Converts the elements of the floating-point vector to Q31 vector.
simon 0:1014af42efd9 6503 * @param[in] *pSrc points to the floating-point input vector
simon 0:1014af42efd9 6504 * @param[out] *pDst points to the Q31 output vector
simon 0:1014af42efd9 6505 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6506 * @return none.
simon 0:1014af42efd9 6507 */
simon 0:1014af42efd9 6508 void arm_float_to_q31(
simon 0:1014af42efd9 6509 float32_t * pSrc,
simon 0:1014af42efd9 6510 q31_t * pDst,
simon 0:1014af42efd9 6511 uint32_t blockSize);
simon 0:1014af42efd9 6512
simon 0:1014af42efd9 6513 /**
simon 0:1014af42efd9 6514 * @brief Converts the elements of the floating-point vector to Q15 vector.
simon 0:1014af42efd9 6515 * @param[in] *pSrc points to the floating-point input vector
simon 0:1014af42efd9 6516 * @param[out] *pDst points to the Q15 output vector
simon 0:1014af42efd9 6517 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6518 * @return none
simon 0:1014af42efd9 6519 */
simon 0:1014af42efd9 6520 void arm_float_to_q15(
simon 0:1014af42efd9 6521 float32_t * pSrc,
simon 0:1014af42efd9 6522 q15_t * pDst,
simon 0:1014af42efd9 6523 uint32_t blockSize);
simon 0:1014af42efd9 6524
simon 0:1014af42efd9 6525 /**
simon 0:1014af42efd9 6526 * @brief Converts the elements of the floating-point vector to Q7 vector.
simon 0:1014af42efd9 6527 * @param[in] *pSrc points to the floating-point input vector
simon 0:1014af42efd9 6528 * @param[out] *pDst points to the Q7 output vector
simon 0:1014af42efd9 6529 * @param[in] blockSize length of the input vector
simon 0:1014af42efd9 6530 * @return none
simon 0:1014af42efd9 6531 */
simon 0:1014af42efd9 6532 void arm_float_to_q7(
simon 0:1014af42efd9 6533 float32_t * pSrc,
simon 0:1014af42efd9 6534 q7_t * pDst,
simon 0:1014af42efd9 6535 uint32_t blockSize);
simon 0:1014af42efd9 6536
simon 0:1014af42efd9 6537
simon 0:1014af42efd9 6538 /**
simon 0:1014af42efd9 6539 * @brief Converts the elements of the Q31 vector to Q15 vector.
simon 0:1014af42efd9 6540 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6541 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 6542 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6543 * @return none.
simon 0:1014af42efd9 6544 */
simon 0:1014af42efd9 6545 void arm_q31_to_q15(
simon 0:1014af42efd9 6546 q31_t * pSrc,
simon 0:1014af42efd9 6547 q15_t * pDst,
simon 0:1014af42efd9 6548 uint32_t blockSize);
simon 0:1014af42efd9 6549
simon 0:1014af42efd9 6550 /**
simon 0:1014af42efd9 6551 * @brief Converts the elements of the Q31 vector to Q7 vector.
simon 0:1014af42efd9 6552 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6553 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 6554 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6555 * @return none.
simon 0:1014af42efd9 6556 */
simon 0:1014af42efd9 6557 void arm_q31_to_q7(
simon 0:1014af42efd9 6558 q31_t * pSrc,
simon 0:1014af42efd9 6559 q7_t * pDst,
simon 0:1014af42efd9 6560 uint32_t blockSize);
simon 0:1014af42efd9 6561
simon 0:1014af42efd9 6562 /**
simon 0:1014af42efd9 6563 * @brief Converts the elements of the Q15 vector to floating-point vector.
simon 0:1014af42efd9 6564 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6565 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 6566 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6567 * @return none.
simon 0:1014af42efd9 6568 */
simon 0:1014af42efd9 6569 void arm_q15_to_float(
simon 0:1014af42efd9 6570 q15_t * pSrc,
simon 0:1014af42efd9 6571 float32_t * pDst,
simon 0:1014af42efd9 6572 uint32_t blockSize);
simon 0:1014af42efd9 6573
simon 0:1014af42efd9 6574
simon 0:1014af42efd9 6575 /**
simon 0:1014af42efd9 6576 * @brief Converts the elements of the Q15 vector to Q31 vector.
simon 0:1014af42efd9 6577 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6578 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 6579 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6580 * @return none.
simon 0:1014af42efd9 6581 */
simon 0:1014af42efd9 6582 void arm_q15_to_q31(
simon 0:1014af42efd9 6583 q15_t * pSrc,
simon 0:1014af42efd9 6584 q31_t * pDst,
simon 0:1014af42efd9 6585 uint32_t blockSize);
simon 0:1014af42efd9 6586
simon 0:1014af42efd9 6587
simon 0:1014af42efd9 6588 /**
simon 0:1014af42efd9 6589 * @brief Converts the elements of the Q15 vector to Q7 vector.
simon 0:1014af42efd9 6590 * @param[in] *pSrc is input pointer
simon 0:1014af42efd9 6591 * @param[out] *pDst is output pointer
simon 0:1014af42efd9 6592 * @param[in] blockSize is the number of samples to process
simon 0:1014af42efd9 6593 * @return none.
simon 0:1014af42efd9 6594 */
simon 0:1014af42efd9 6595 void arm_q15_to_q7(
simon 0:1014af42efd9 6596 q15_t * pSrc,
simon 0:1014af42efd9 6597 q7_t * pDst,
simon 0:1014af42efd9 6598 uint32_t blockSize);
simon 0:1014af42efd9 6599
simon 0:1014af42efd9 6600
simon 0:1014af42efd9 6601 /**
simon 0:1014af42efd9 6602 * @ingroup groupInterpolation
simon 0:1014af42efd9 6603 */
simon 0:1014af42efd9 6604
simon 0:1014af42efd9 6605 /**
simon 0:1014af42efd9 6606 * @defgroup BilinearInterpolate Bilinear Interpolation
simon 0:1014af42efd9 6607 *
simon 0:1014af42efd9 6608 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
simon 0:1014af42efd9 6609 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
simon 0:1014af42efd9 6610 * determines values between the grid points.
simon 0:1014af42efd9 6611 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
simon 0:1014af42efd9 6612 * Bilinear interpolation is often used in image processing to rescale images.
simon 0:1014af42efd9 6613 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
simon 0:1014af42efd9 6614 *
simon 0:1014af42efd9 6615 * <b>Algorithm</b>
simon 0:1014af42efd9 6616 * \par
simon 0:1014af42efd9 6617 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
simon 0:1014af42efd9 6618 * For floating-point, the instance structure is defined as:
simon 0:1014af42efd9 6619 * <pre>
simon 0:1014af42efd9 6620 * typedef struct
simon 0:1014af42efd9 6621 * {
simon 0:1014af42efd9 6622 * uint16_t numRows;
simon 0:1014af42efd9 6623 * uint16_t numCols;
simon 0:1014af42efd9 6624 * float32_t *pData;
simon 0:1014af42efd9 6625 * } arm_bilinear_interp_instance_f32;
simon 0:1014af42efd9 6626 * </pre>
simon 0:1014af42efd9 6627 *
simon 0:1014af42efd9 6628 * \par
simon 0:1014af42efd9 6629 * where <code>numRows</code> specifies the number of rows in the table;
simon 0:1014af42efd9 6630 * <code>numCols</code> specifies the number of columns in the table;
simon 0:1014af42efd9 6631 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
simon 0:1014af42efd9 6632 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
simon 0:1014af42efd9 6633 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
simon 0:1014af42efd9 6634 *
simon 0:1014af42efd9 6635 * \par
simon 0:1014af42efd9 6636 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
simon 0:1014af42efd9 6637 * <pre>
simon 0:1014af42efd9 6638 * XF = floor(x)
simon 0:1014af42efd9 6639 * YF = floor(y)
simon 0:1014af42efd9 6640 * </pre>
simon 0:1014af42efd9 6641 * \par
simon 0:1014af42efd9 6642 * The interpolated output point is computed as:
simon 0:1014af42efd9 6643 * <pre>
simon 0:1014af42efd9 6644 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
simon 0:1014af42efd9 6645 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
simon 0:1014af42efd9 6646 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
simon 0:1014af42efd9 6647 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
simon 0:1014af42efd9 6648 * </pre>
simon 0:1014af42efd9 6649 * Note that the coordinates (x, y) contain integer and fractional components.
simon 0:1014af42efd9 6650 * The integer components specify which portion of the table to use while the
simon 0:1014af42efd9 6651 * fractional components control the interpolation processor.
simon 0:1014af42efd9 6652 *
simon 0:1014af42efd9 6653 * \par
simon 0:1014af42efd9 6654 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
simon 0:1014af42efd9 6655 */
simon 0:1014af42efd9 6656
simon 0:1014af42efd9 6657 /**
simon 0:1014af42efd9 6658 * @addtogroup BilinearInterpolate
simon 0:1014af42efd9 6659 * @{
simon 0:1014af42efd9 6660 */
simon 0:1014af42efd9 6661
simon 0:1014af42efd9 6662 /**
simon 0:1014af42efd9 6663 *
simon 0:1014af42efd9 6664 * @brief Floating-point bilinear interpolation.
simon 0:1014af42efd9 6665 * @param[in,out] *S points to an instance of the interpolation structure.
simon 0:1014af42efd9 6666 * @param[in] X interpolation coordinate.
simon 0:1014af42efd9 6667 * @param[in] Y interpolation coordinate.
simon 0:1014af42efd9 6668 * @return out interpolated value.
simon 0:1014af42efd9 6669 */
simon 0:1014af42efd9 6670
simon 0:1014af42efd9 6671
simon 0:1014af42efd9 6672 static __INLINE float32_t arm_bilinear_interp_f32(
simon 0:1014af42efd9 6673 const arm_bilinear_interp_instance_f32 * S,
simon 0:1014af42efd9 6674 float32_t X,
simon 0:1014af42efd9 6675 float32_t Y)
simon 0:1014af42efd9 6676 {
simon 0:1014af42efd9 6677 float32_t out;
simon 0:1014af42efd9 6678 float32_t f00, f01, f10, f11;
simon 0:1014af42efd9 6679 float32_t *pData = S->pData;
simon 0:1014af42efd9 6680 int32_t xIndex, yIndex, index;
simon 0:1014af42efd9 6681 float32_t xdiff, ydiff;
simon 0:1014af42efd9 6682 float32_t b1, b2, b3, b4;
simon 0:1014af42efd9 6683
simon 0:1014af42efd9 6684 xIndex = (int32_t) X;
simon 0:1014af42efd9 6685 yIndex = (int32_t) Y;
simon 0:1014af42efd9 6686
simon 0:1014af42efd9 6687 /* Care taken for table outside boundary */
simon 0:1014af42efd9 6688 /* Returns zero output when values are outside table boundary */
simon 0:1014af42efd9 6689 if(xIndex < 0 || xIndex > (S->numRows-1) || yIndex < 0 || yIndex > ( S->numCols-1))
simon 0:1014af42efd9 6690 {
simon 0:1014af42efd9 6691 return(0);
simon 0:1014af42efd9 6692 }
simon 0:1014af42efd9 6693
simon 0:1014af42efd9 6694 /* Calculation of index for two nearest points in X-direction */
simon 0:1014af42efd9 6695 index = (xIndex - 1) + (yIndex - 1) * S->numRows;
simon 0:1014af42efd9 6696
simon 0:1014af42efd9 6697
simon 0:1014af42efd9 6698 /* Read two nearest points in X-direction */
simon 0:1014af42efd9 6699 f00 = pData[index];
simon 0:1014af42efd9 6700 f01 = pData[index + 1];
simon 0:1014af42efd9 6701
simon 0:1014af42efd9 6702 /* Calculation of index for two nearest points in Y-direction */
simon 0:1014af42efd9 6703 index = (xIndex - 1) + (yIndex) * S->numRows;
simon 0:1014af42efd9 6704
simon 0:1014af42efd9 6705
simon 0:1014af42efd9 6706 /* Read two nearest points in Y-direction */
simon 0:1014af42efd9 6707 f10 = pData[index];
simon 0:1014af42efd9 6708 f11 = pData[index + 1];
simon 0:1014af42efd9 6709
simon 0:1014af42efd9 6710 /* Calculation of intermediate values */
simon 0:1014af42efd9 6711 b1 = f00;
simon 0:1014af42efd9 6712 b2 = f01 - f00;
simon 0:1014af42efd9 6713 b3 = f10 - f00;
simon 0:1014af42efd9 6714 b4 = f00 - f01 - f10 + f11;
simon 0:1014af42efd9 6715
simon 0:1014af42efd9 6716 /* Calculation of fractional part in X */
simon 0:1014af42efd9 6717 xdiff = X - xIndex;
simon 0:1014af42efd9 6718
simon 0:1014af42efd9 6719 /* Calculation of fractional part in Y */
simon 0:1014af42efd9 6720 ydiff = Y - yIndex;
simon 0:1014af42efd9 6721
simon 0:1014af42efd9 6722 /* Calculation of bi-linear interpolated output */
simon 0:1014af42efd9 6723 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
simon 0:1014af42efd9 6724
simon 0:1014af42efd9 6725 /* return to application */
simon 0:1014af42efd9 6726 return (out);
simon 0:1014af42efd9 6727
simon 0:1014af42efd9 6728 }
simon 0:1014af42efd9 6729
simon 0:1014af42efd9 6730 /**
simon 0:1014af42efd9 6731 *
simon 0:1014af42efd9 6732 * @brief Q31 bilinear interpolation.
simon 0:1014af42efd9 6733 * @param[in,out] *S points to an instance of the interpolation structure.
simon 0:1014af42efd9 6734 * @param[in] X interpolation coordinate in 12.20 format.
simon 0:1014af42efd9 6735 * @param[in] Y interpolation coordinate in 12.20 format.
simon 0:1014af42efd9 6736 * @return out interpolated value.
simon 0:1014af42efd9 6737 */
simon 0:1014af42efd9 6738
simon 0:1014af42efd9 6739 static __INLINE q31_t arm_bilinear_interp_q31(
simon 0:1014af42efd9 6740 arm_bilinear_interp_instance_q31 * S,
simon 0:1014af42efd9 6741 q31_t X,
simon 0:1014af42efd9 6742 q31_t Y)
simon 0:1014af42efd9 6743 {
simon 0:1014af42efd9 6744 q31_t out; /* Temporary output */
simon 0:1014af42efd9 6745 q31_t acc = 0; /* output */
simon 0:1014af42efd9 6746 q31_t xfract, yfract; /* X, Y fractional parts */
simon 0:1014af42efd9 6747 q31_t x1, x2, y1, y2; /* Nearest output values */
simon 0:1014af42efd9 6748 int32_t rI, cI; /* Row and column indices */
simon 0:1014af42efd9 6749 q31_t *pYData = S->pData; /* pointer to output table values */
simon 0:1014af42efd9 6750 uint32_t nRows = S->numRows; /* num of rows */
simon 0:1014af42efd9 6751
simon 0:1014af42efd9 6752
simon 0:1014af42efd9 6753 /* Input is in 12.20 format */
simon 0:1014af42efd9 6754 /* 12 bits for the table index */
simon 0:1014af42efd9 6755 /* Index value calculation */
simon 0:1014af42efd9 6756 rI = ((X & 0xFFF00000) >> 20u);
simon 0:1014af42efd9 6757
simon 0:1014af42efd9 6758 /* Input is in 12.20 format */
simon 0:1014af42efd9 6759 /* 12 bits for the table index */
simon 0:1014af42efd9 6760 /* Index value calculation */
simon 0:1014af42efd9 6761 cI = ((Y & 0xFFF00000) >> 20u);
simon 0:1014af42efd9 6762
simon 0:1014af42efd9 6763 /* Care taken for table outside boundary */
simon 0:1014af42efd9 6764 /* Returns zero output when values are outside table boundary */
simon 0:1014af42efd9 6765 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
simon 0:1014af42efd9 6766 {
simon 0:1014af42efd9 6767 return(0);
simon 0:1014af42efd9 6768 }
simon 0:1014af42efd9 6769
simon 0:1014af42efd9 6770 /* 20 bits for the fractional part */
simon 0:1014af42efd9 6771 /* shift left xfract by 11 to keep 1.31 format */
simon 0:1014af42efd9 6772 xfract = (X & 0x000FFFFF) << 11u;
simon 0:1014af42efd9 6773
simon 0:1014af42efd9 6774 /* Read two nearest output values from the index */
simon 0:1014af42efd9 6775 x1 = pYData[(rI) + nRows * (cI)];
simon 0:1014af42efd9 6776 x2 = pYData[(rI) + nRows * (cI) + 1u];
simon 0:1014af42efd9 6777
simon 0:1014af42efd9 6778 /* 20 bits for the fractional part */
simon 0:1014af42efd9 6779 /* shift left yfract by 11 to keep 1.31 format */
simon 0:1014af42efd9 6780 yfract = (Y & 0x000FFFFF) << 11u;
simon 0:1014af42efd9 6781
simon 0:1014af42efd9 6782 /* Read two nearest output values from the index */
simon 0:1014af42efd9 6783 y1 = pYData[(rI) + nRows * (cI + 1)];
simon 0:1014af42efd9 6784 y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
simon 0:1014af42efd9 6785
simon 0:1014af42efd9 6786 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
simon 0:1014af42efd9 6787 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
simon 0:1014af42efd9 6788 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
simon 0:1014af42efd9 6789
simon 0:1014af42efd9 6790 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
simon 0:1014af42efd9 6791 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
simon 0:1014af42efd9 6792 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
simon 0:1014af42efd9 6793
simon 0:1014af42efd9 6794 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
simon 0:1014af42efd9 6795 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
simon 0:1014af42efd9 6796 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
simon 0:1014af42efd9 6797
simon 0:1014af42efd9 6798 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
simon 0:1014af42efd9 6799 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
simon 0:1014af42efd9 6800 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
simon 0:1014af42efd9 6801
simon 0:1014af42efd9 6802 /* Convert acc to 1.31(q31) format */
simon 0:1014af42efd9 6803 return (acc << 2u);
simon 0:1014af42efd9 6804
simon 0:1014af42efd9 6805 }
simon 0:1014af42efd9 6806
simon 0:1014af42efd9 6807 /**
simon 0:1014af42efd9 6808 * @brief Q15 bilinear interpolation.
simon 0:1014af42efd9 6809 * @param[in,out] *S points to an instance of the interpolation structure.
simon 0:1014af42efd9 6810 * @param[in] X interpolation coordinate in 12.20 format.
simon 0:1014af42efd9 6811 * @param[in] Y interpolation coordinate in 12.20 format.
simon 0:1014af42efd9 6812 * @return out interpolated value.
simon 0:1014af42efd9 6813 */
simon 0:1014af42efd9 6814
simon 0:1014af42efd9 6815 static __INLINE q15_t arm_bilinear_interp_q15(
simon 0:1014af42efd9 6816 arm_bilinear_interp_instance_q15 * S,
simon 0:1014af42efd9 6817 q31_t X,
simon 0:1014af42efd9 6818 q31_t Y)
simon 0:1014af42efd9 6819 {
simon 0:1014af42efd9 6820 q63_t acc = 0; /* output */
simon 0:1014af42efd9 6821 q31_t out; /* Temporary output */
simon 0:1014af42efd9 6822 q15_t x1, x2, y1, y2; /* Nearest output values */
simon 0:1014af42efd9 6823 q31_t xfract, yfract; /* X, Y fractional parts */
simon 0:1014af42efd9 6824 int32_t rI, cI; /* Row and column indices */
simon 0:1014af42efd9 6825 q15_t *pYData = S->pData; /* pointer to output table values */
simon 0:1014af42efd9 6826 uint32_t nRows = S->numRows; /* num of rows */
simon 0:1014af42efd9 6827
simon 0:1014af42efd9 6828 /* Input is in 12.20 format */
simon 0:1014af42efd9 6829 /* 12 bits for the table index */
simon 0:1014af42efd9 6830 /* Index value calculation */
simon 0:1014af42efd9 6831 rI = ((X & 0xFFF00000) >> 20);
simon 0:1014af42efd9 6832
simon 0:1014af42efd9 6833 /* Input is in 12.20 format */
simon 0:1014af42efd9 6834 /* 12 bits for the table index */
simon 0:1014af42efd9 6835 /* Index value calculation */
simon 0:1014af42efd9 6836 cI = ((Y & 0xFFF00000) >> 20);
simon 0:1014af42efd9 6837
simon 0:1014af42efd9 6838 /* Care taken for table outside boundary */
simon 0:1014af42efd9 6839 /* Returns zero output when values are outside table boundary */
simon 0:1014af42efd9 6840 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
simon 0:1014af42efd9 6841 {
simon 0:1014af42efd9 6842 return(0);
simon 0:1014af42efd9 6843 }
simon 0:1014af42efd9 6844
simon 0:1014af42efd9 6845 /* 20 bits for the fractional part */
simon 0:1014af42efd9 6846 /* xfract should be in 12.20 format */
simon 0:1014af42efd9 6847 xfract = (X & 0x000FFFFF);
simon 0:1014af42efd9 6848
simon 0:1014af42efd9 6849 /* Read two nearest output values from the index */
simon 0:1014af42efd9 6850 x1 = pYData[(rI) + nRows * (cI)];
simon 0:1014af42efd9 6851 x2 = pYData[(rI) + nRows * (cI) + 1u];
simon 0:1014af42efd9 6852
simon 0:1014af42efd9 6853
simon 0:1014af42efd9 6854 /* 20 bits for the fractional part */
simon 0:1014af42efd9 6855 /* yfract should be in 12.20 format */
simon 0:1014af42efd9 6856 yfract = (Y & 0x000FFFFF);
simon 0:1014af42efd9 6857
simon 0:1014af42efd9 6858 /* Read two nearest output values from the index */
simon 0:1014af42efd9 6859 y1 = pYData[(rI) + nRows * (cI + 1)];
simon 0:1014af42efd9 6860 y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
simon 0:1014af42efd9 6861
simon 0:1014af42efd9 6862 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
simon 0:1014af42efd9 6863
simon 0:1014af42efd9 6864 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
simon 0:1014af42efd9 6865 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
simon 0:1014af42efd9 6866 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
simon 0:1014af42efd9 6867 acc = ((q63_t) out * (0xFFFFF - yfract));
simon 0:1014af42efd9 6868
simon 0:1014af42efd9 6869 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
simon 0:1014af42efd9 6870 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
simon 0:1014af42efd9 6871 acc += ((q63_t) out * (xfract));
simon 0:1014af42efd9 6872
simon 0:1014af42efd9 6873 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
simon 0:1014af42efd9 6874 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
simon 0:1014af42efd9 6875 acc += ((q63_t) out * (yfract));
simon 0:1014af42efd9 6876
simon 0:1014af42efd9 6877 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
simon 0:1014af42efd9 6878 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
simon 0:1014af42efd9 6879 acc += ((q63_t) out * (yfract));
simon 0:1014af42efd9 6880
simon 0:1014af42efd9 6881 /* acc is in 13.51 format and down shift acc by 36 times */
simon 0:1014af42efd9 6882 /* Convert out to 1.15 format */
simon 0:1014af42efd9 6883 return (acc >> 36);
simon 0:1014af42efd9 6884
simon 0:1014af42efd9 6885 }
simon 0:1014af42efd9 6886
simon 0:1014af42efd9 6887 /**
simon 0:1014af42efd9 6888 * @brief Q7 bilinear interpolation.
simon 0:1014af42efd9 6889 * @param[in,out] *S points to an instance of the interpolation structure.
simon 0:1014af42efd9 6890 * @param[in] X interpolation coordinate in 12.20 format.
simon 0:1014af42efd9 6891 * @param[in] Y interpolation coordinate in 12.20 format.
simon 0:1014af42efd9 6892 * @return out interpolated value.
simon 0:1014af42efd9 6893 */
simon 0:1014af42efd9 6894
simon 0:1014af42efd9 6895 static __INLINE q7_t arm_bilinear_interp_q7(
simon 0:1014af42efd9 6896 arm_bilinear_interp_instance_q7 * S,
simon 0:1014af42efd9 6897 q31_t X,
simon 0:1014af42efd9 6898 q31_t Y)
simon 0:1014af42efd9 6899 {
simon 0:1014af42efd9 6900 q63_t acc = 0; /* output */
simon 0:1014af42efd9 6901 q31_t out; /* Temporary output */
simon 0:1014af42efd9 6902 q31_t xfract, yfract; /* X, Y fractional parts */
simon 0:1014af42efd9 6903 q7_t x1, x2, y1, y2; /* Nearest output values */
simon 0:1014af42efd9 6904 int32_t rI, cI; /* Row and column indices */
simon 0:1014af42efd9 6905 q7_t *pYData = S->pData; /* pointer to output table values */
simon 0:1014af42efd9 6906 uint32_t nRows = S->numRows; /* num of rows */
simon 0:1014af42efd9 6907
simon 0:1014af42efd9 6908 /* Input is in 12.20 format */
simon 0:1014af42efd9 6909 /* 12 bits for the table index */
simon 0:1014af42efd9 6910 /* Index value calculation */
simon 0:1014af42efd9 6911 rI = ((X & 0xFFF00000) >> 20);
simon 0:1014af42efd9 6912
simon 0:1014af42efd9 6913 /* Input is in 12.20 format */
simon 0:1014af42efd9 6914 /* 12 bits for the table index */
simon 0:1014af42efd9 6915 /* Index value calculation */
simon 0:1014af42efd9 6916 cI = ((Y & 0xFFF00000) >> 20);
simon 0:1014af42efd9 6917
simon 0:1014af42efd9 6918 /* Care taken for table outside boundary */
simon 0:1014af42efd9 6919 /* Returns zero output when values are outside table boundary */
simon 0:1014af42efd9 6920 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
simon 0:1014af42efd9 6921 {
simon 0:1014af42efd9 6922 return(0);
simon 0:1014af42efd9 6923 }
simon 0:1014af42efd9 6924
simon 0:1014af42efd9 6925 /* 20 bits for the fractional part */
simon 0:1014af42efd9 6926 /* xfract should be in 12.20 format */
simon 0:1014af42efd9 6927 xfract = (X & 0x000FFFFF);
simon 0:1014af42efd9 6928
simon 0:1014af42efd9 6929 /* Read two nearest output values from the index */
simon 0:1014af42efd9 6930 x1 = pYData[(rI) + nRows * (cI)];
simon 0:1014af42efd9 6931 x2 = pYData[(rI) + nRows * (cI) + 1u];
simon 0:1014af42efd9 6932
simon 0:1014af42efd9 6933
simon 0:1014af42efd9 6934 /* 20 bits for the fractional part */
simon 0:1014af42efd9 6935 /* yfract should be in 12.20 format */
simon 0:1014af42efd9 6936 yfract = (Y & 0x000FFFFF);
simon 0:1014af42efd9 6937
simon 0:1014af42efd9 6938 /* Read two nearest output values from the index */
simon 0:1014af42efd9 6939 y1 = pYData[(rI) + nRows * (cI + 1)];
simon 0:1014af42efd9 6940 y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
simon 0:1014af42efd9 6941
simon 0:1014af42efd9 6942 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
simon 0:1014af42efd9 6943 out = ((x1 * (0xFFFFF - xfract)));
simon 0:1014af42efd9 6944 acc = (((q63_t) out * (0xFFFFF - yfract)));
simon 0:1014af42efd9 6945
simon 0:1014af42efd9 6946 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
simon 0:1014af42efd9 6947 out = ((x2 * (0xFFFFF - yfract)));
simon 0:1014af42efd9 6948 acc += (((q63_t) out * (xfract)));
simon 0:1014af42efd9 6949
simon 0:1014af42efd9 6950 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
simon 0:1014af42efd9 6951 out = ((y1 * (0xFFFFF - xfract)));
simon 0:1014af42efd9 6952 acc += (((q63_t) out * (yfract)));
simon 0:1014af42efd9 6953
simon 0:1014af42efd9 6954 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
simon 0:1014af42efd9 6955 out = ((y2 * (yfract)));
simon 0:1014af42efd9 6956 acc += (((q63_t) out * (xfract)));
simon 0:1014af42efd9 6957
simon 0:1014af42efd9 6958 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
simon 0:1014af42efd9 6959 return (acc >> 40);
simon 0:1014af42efd9 6960
simon 0:1014af42efd9 6961 }
simon 0:1014af42efd9 6962
simon 0:1014af42efd9 6963 /**
simon 0:1014af42efd9 6964 * @} end of BilinearInterpolate group
simon 0:1014af42efd9 6965 */
simon 0:1014af42efd9 6966
simon 0:1014af42efd9 6967
simon 0:1014af42efd9 6968
simon 0:1014af42efd9 6969
simon 0:1014af42efd9 6970
simon 0:1014af42efd9 6971
simon 0:1014af42efd9 6972 #ifdef __cplusplus
simon 0:1014af42efd9 6973 }
simon 0:1014af42efd9 6974 #endif
simon 0:1014af42efd9 6975
simon 0:1014af42efd9 6976
simon 0:1014af42efd9 6977 #endif /* _ARM_MATH_H */
simon 0:1014af42efd9 6978
simon 0:1014af42efd9 6979
simon 0:1014af42efd9 6980 /**
simon 0:1014af42efd9 6981 *
simon 0:1014af42efd9 6982 * End of file.
simon 0:1014af42efd9 6983 */