CMSIS DSP Library from CMSIS 2.0. See http://www.onarm.com/cmsis/ for full details

Dependents:   K22F_DSP_Matrix_least_square BNO055-ELEC3810 1BNO055 ECE4180Project--Slave2 ... more

Committer:
simon
Date:
Thu Mar 10 15:12:05 2011 +0000
Revision:
1:2ec9aa7241dc

        

Who changed what in which revision?

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