The prosthetic control(MIT)

Committer:
ganlikun
Date:
Thu Jun 23 05:23:34 2022 +0000
Revision:
0:20e0c61e0684
01

Who changed what in which revision?

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