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