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