Fork of mbed-dsp. CMSIS-DSP library of supporting NEON

Dependents:   mbed-os-example-cmsis_dsp_neon

Fork of mbed-dsp by mbed official

Information

Japanese version is available in lower part of this page.
このページの後半に日本語版が用意されています.

CMSIS-DSP of supporting NEON

What is this ?

A library for CMSIS-DSP of supporting NEON.
We supported the NEON to CMSIS-DSP Ver1.4.3(CMSIS V4.1) that ARM supplied, has achieved the processing speed improvement.
If you use the mbed-dsp library, you can use to replace this library.
CMSIS-DSP of supporting NEON is provied as a library.

Library Creation environment

CMSIS-DSP library of supporting NEON was created by the following environment.

  • Compiler
    ARMCC Version 5.03
  • Compile option switch[C Compiler]
   -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -O3 -Otime --cpu=Cortex-A9 --littleend --arm 
   --apcs=/interwork --no_unaligned_access --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp 
   --vectorize --asm
  • Compile option switch[Assembler]
   --cpreproc --cpu=Cortex-A9 --littleend --arm --apcs=/interwork --no_unaligned_access 
   --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp


Effects of NEON support

In the data which passes to each function, large size will be expected more effective than small size.
Also if the data is a multiple of 16, effect will be expected in every function in the CMSIS-DSP.


NEON対応CMSIS-DSP

概要

NEON対応したCMSIS-DSPのライブラリです。
ARM社提供のCMSIS-DSP Ver1.4.3(CMSIS V4.1)をターゲットにNEON対応を行ない、処理速度向上を実現しております。
mbed-dspライブラリを使用している場合は、本ライブラリに置き換えて使用することができます。
NEON対応したCMSIS-DSPはライブラリで提供します。

ライブラリ作成環境

NEON対応CMSIS-DSPライブラリは、以下の環境で作成しています。

  • コンパイラ
    ARMCC Version 5.03
  • コンパイルオプションスイッチ[C Compiler]
   -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -O3 -Otime --cpu=Cortex-A9 --littleend --arm 
   --apcs=/interwork --no_unaligned_access --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp 
   --vectorize --asm
  • コンパイルオプションスイッチ[Assembler]
   --cpreproc --cpu=Cortex-A9 --littleend --arm --apcs=/interwork --no_unaligned_access 
   --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp


NEON対応による効果について

CMSIS-DSP内の各関数へ渡すデータは、小さいサイズよりも大きいサイズの方が効果が見込めます。
また、16の倍数のデータであれば、CMSIS-DSP内のどの関数でも効果が見込めます。


Committer:
emilmont
Date:
Wed Nov 28 12:30:09 2012 +0000
Revision:
1:fdd22bb7aa52
Child:
2:da51fb522205
DSP library code

Who changed what in which revision?

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