this hurts

Dependencies:   FFT

Committer:
shyamgatech
Date:
Thu Dec 03 18:15:35 2020 +0000
Revision:
7:0d62545e6d73
Parent:
0:d6c9b09b4042
addded gui mbed code;

Who changed what in which revision?

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