Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
arm_math.h@59:8aa304768360, 2021-03-28 (annotated)
- Committer:
- cactode
- Date:
- Sun Mar 28 01:10:30 2021 -0700
- Revision:
- 59:8aa304768360
Added more DSP functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cactode | 59:8aa304768360 | 1 | /****************************************************************************** |
cactode | 59:8aa304768360 | 2 | * @file arm_math.h |
cactode | 59:8aa304768360 | 3 | * @brief Public header file for CMSIS DSP Library |
cactode | 59:8aa304768360 | 4 | * @version V1.7.0 |
cactode | 59:8aa304768360 | 5 | * @date 18. March 2019 |
cactode | 59:8aa304768360 | 6 | ******************************************************************************/ |
cactode | 59:8aa304768360 | 7 | /* |
cactode | 59:8aa304768360 | 8 | * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. |
cactode | 59:8aa304768360 | 9 | * |
cactode | 59:8aa304768360 | 10 | * SPDX-License-Identifier: Apache-2.0 |
cactode | 59:8aa304768360 | 11 | * |
cactode | 59:8aa304768360 | 12 | * Licensed under the Apache License, Version 2.0 (the License); you may |
cactode | 59:8aa304768360 | 13 | * not use this file except in compliance with the License. |
cactode | 59:8aa304768360 | 14 | * You may obtain a copy of the License at |
cactode | 59:8aa304768360 | 15 | * |
cactode | 59:8aa304768360 | 16 | * www.apache.org/licenses/LICENSE-2.0 |
cactode | 59:8aa304768360 | 17 | * |
cactode | 59:8aa304768360 | 18 | * Unless required by applicable law or agreed to in writing, software |
cactode | 59:8aa304768360 | 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
cactode | 59:8aa304768360 | 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
cactode | 59:8aa304768360 | 21 | * See the License for the specific language governing permissions and |
cactode | 59:8aa304768360 | 22 | * limitations under the License. |
cactode | 59:8aa304768360 | 23 | */ |
cactode | 59:8aa304768360 | 24 | |
cactode | 59:8aa304768360 | 25 | /** |
cactode | 59:8aa304768360 | 26 | \mainpage CMSIS DSP Software Library |
cactode | 59:8aa304768360 | 27 | * |
cactode | 59:8aa304768360 | 28 | * Introduction |
cactode | 59:8aa304768360 | 29 | * ------------ |
cactode | 59:8aa304768360 | 30 | * |
cactode | 59:8aa304768360 | 31 | * This user manual describes the CMSIS DSP software library, |
cactode | 59:8aa304768360 | 32 | * a suite of common signal processing functions for use on Cortex-M and Cortex-A processor |
cactode | 59:8aa304768360 | 33 | * based devices. |
cactode | 59:8aa304768360 | 34 | * |
cactode | 59:8aa304768360 | 35 | * The library is divided into a number of functions each covering a specific category: |
cactode | 59:8aa304768360 | 36 | * - Basic math functions |
cactode | 59:8aa304768360 | 37 | * - Fast math functions |
cactode | 59:8aa304768360 | 38 | * - Complex math functions |
cactode | 59:8aa304768360 | 39 | * - Filtering functions |
cactode | 59:8aa304768360 | 40 | * - Matrix functions |
cactode | 59:8aa304768360 | 41 | * - Transform functions |
cactode | 59:8aa304768360 | 42 | * - Motor control functions |
cactode | 59:8aa304768360 | 43 | * - Statistical functions |
cactode | 59:8aa304768360 | 44 | * - Support functions |
cactode | 59:8aa304768360 | 45 | * - Interpolation functions |
cactode | 59:8aa304768360 | 46 | * - Support Vector Machine functions (SVM) |
cactode | 59:8aa304768360 | 47 | * - Bayes classifier functions |
cactode | 59:8aa304768360 | 48 | * - Distance functions |
cactode | 59:8aa304768360 | 49 | * |
cactode | 59:8aa304768360 | 50 | * The library has generally separate functions for operating on 8-bit integers, 16-bit integers, |
cactode | 59:8aa304768360 | 51 | * 32-bit integer and 32-bit floating-point values. |
cactode | 59:8aa304768360 | 52 | * |
cactode | 59:8aa304768360 | 53 | * Using the Library |
cactode | 59:8aa304768360 | 54 | * ------------ |
cactode | 59:8aa304768360 | 55 | * |
cactode | 59:8aa304768360 | 56 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder. |
cactode | 59:8aa304768360 | 57 | * |
cactode | 59:8aa304768360 | 58 | * Here is the list of pre-built libraries : |
cactode | 59:8aa304768360 | 59 | * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit) |
cactode | 59:8aa304768360 | 60 | * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit) |
cactode | 59:8aa304768360 | 61 | * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit) |
cactode | 59:8aa304768360 | 62 | * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on) |
cactode | 59:8aa304768360 | 63 | * - arm_cortexM7l_math.lib (Cortex-M7, Little endian) |
cactode | 59:8aa304768360 | 64 | * - arm_cortexM7b_math.lib (Cortex-M7, Big endian) |
cactode | 59:8aa304768360 | 65 | * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit) |
cactode | 59:8aa304768360 | 66 | * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit) |
cactode | 59:8aa304768360 | 67 | * - arm_cortexM4l_math.lib (Cortex-M4, Little endian) |
cactode | 59:8aa304768360 | 68 | * - arm_cortexM4b_math.lib (Cortex-M4, Big endian) |
cactode | 59:8aa304768360 | 69 | * - arm_cortexM3l_math.lib (Cortex-M3, Little endian) |
cactode | 59:8aa304768360 | 70 | * - arm_cortexM3b_math.lib (Cortex-M3, Big endian) |
cactode | 59:8aa304768360 | 71 | * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian) |
cactode | 59:8aa304768360 | 72 | * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian) |
cactode | 59:8aa304768360 | 73 | * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian) |
cactode | 59:8aa304768360 | 74 | * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian) |
cactode | 59:8aa304768360 | 75 | * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit) |
cactode | 59:8aa304768360 | 76 | * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions) |
cactode | 59:8aa304768360 | 77 | * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit) |
cactode | 59:8aa304768360 | 78 | * |
cactode | 59:8aa304768360 | 79 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder. |
cactode | 59:8aa304768360 | 80 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single |
cactode | 59:8aa304768360 | 81 | * 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. |
cactode | 59:8aa304768360 | 82 | * |
cactode | 59:8aa304768360 | 83 | * |
cactode | 59:8aa304768360 | 84 | * Examples |
cactode | 59:8aa304768360 | 85 | * -------- |
cactode | 59:8aa304768360 | 86 | * |
cactode | 59:8aa304768360 | 87 | * The library ships with a number of examples which demonstrate how to use the library functions. |
cactode | 59:8aa304768360 | 88 | * |
cactode | 59:8aa304768360 | 89 | * Toolchain Support |
cactode | 59:8aa304768360 | 90 | * ------------ |
cactode | 59:8aa304768360 | 91 | * |
cactode | 59:8aa304768360 | 92 | * The library is now tested on Fast Models building with cmake. |
cactode | 59:8aa304768360 | 93 | * Core M0, M7, A5 are tested. |
cactode | 59:8aa304768360 | 94 | * |
cactode | 59:8aa304768360 | 95 | * |
cactode | 59:8aa304768360 | 96 | * |
cactode | 59:8aa304768360 | 97 | * Building the Library |
cactode | 59:8aa304768360 | 98 | * ------------ |
cactode | 59:8aa304768360 | 99 | * |
cactode | 59:8aa304768360 | 100 | * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP\\Projects\\ARM</code> folder. |
cactode | 59:8aa304768360 | 101 | * - arm_cortexM_math.uvprojx |
cactode | 59:8aa304768360 | 102 | * |
cactode | 59:8aa304768360 | 103 | * |
cactode | 59:8aa304768360 | 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 preprocessor macros detailed above. |
cactode | 59:8aa304768360 | 105 | * |
cactode | 59:8aa304768360 | 106 | * There is also a work in progress cmake build. The README file is giving more details. |
cactode | 59:8aa304768360 | 107 | * |
cactode | 59:8aa304768360 | 108 | * Preprocessor Macros |
cactode | 59:8aa304768360 | 109 | * ------------ |
cactode | 59:8aa304768360 | 110 | * |
cactode | 59:8aa304768360 | 111 | * Each library project have different preprocessor macros. |
cactode | 59:8aa304768360 | 112 | * |
cactode | 59:8aa304768360 | 113 | * - ARM_MATH_BIG_ENDIAN: |
cactode | 59:8aa304768360 | 114 | * |
cactode | 59:8aa304768360 | 115 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. |
cactode | 59:8aa304768360 | 116 | * |
cactode | 59:8aa304768360 | 117 | * - ARM_MATH_MATRIX_CHECK: |
cactode | 59:8aa304768360 | 118 | * |
cactode | 59:8aa304768360 | 119 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices |
cactode | 59:8aa304768360 | 120 | * |
cactode | 59:8aa304768360 | 121 | * - ARM_MATH_ROUNDING: |
cactode | 59:8aa304768360 | 122 | * |
cactode | 59:8aa304768360 | 123 | * Define macro ARM_MATH_ROUNDING for rounding on support functions |
cactode | 59:8aa304768360 | 124 | * |
cactode | 59:8aa304768360 | 125 | * - ARM_MATH_LOOPUNROLL: |
cactode | 59:8aa304768360 | 126 | * |
cactode | 59:8aa304768360 | 127 | * Define macro ARM_MATH_LOOPUNROLL to enable manual loop unrolling in DSP functions |
cactode | 59:8aa304768360 | 128 | * |
cactode | 59:8aa304768360 | 129 | * - ARM_MATH_NEON: |
cactode | 59:8aa304768360 | 130 | * |
cactode | 59:8aa304768360 | 131 | * Define macro ARM_MATH_NEON to enable Neon versions of the DSP functions. |
cactode | 59:8aa304768360 | 132 | * It is not enabled by default when Neon is available because performances are |
cactode | 59:8aa304768360 | 133 | * dependent on the compiler and target architecture. |
cactode | 59:8aa304768360 | 134 | * |
cactode | 59:8aa304768360 | 135 | * - ARM_MATH_NEON_EXPERIMENTAL: |
cactode | 59:8aa304768360 | 136 | * |
cactode | 59:8aa304768360 | 137 | * Define macro ARM_MATH_NEON_EXPERIMENTAL to enable experimental Neon versions of |
cactode | 59:8aa304768360 | 138 | * of some DSP functions. Experimental Neon versions currently do not have better |
cactode | 59:8aa304768360 | 139 | * performances than the scalar versions. |
cactode | 59:8aa304768360 | 140 | * |
cactode | 59:8aa304768360 | 141 | * - ARM_MATH_HELIUM: |
cactode | 59:8aa304768360 | 142 | * |
cactode | 59:8aa304768360 | 143 | * It implies the flags ARM_MATH_MVEF and ARM_MATH_MVEI and ARM_MATH_FLOAT16. |
cactode | 59:8aa304768360 | 144 | * |
cactode | 59:8aa304768360 | 145 | * - ARM_MATH_MVEF: |
cactode | 59:8aa304768360 | 146 | * |
cactode | 59:8aa304768360 | 147 | * Select Helium versions of the f32 algorithms. |
cactode | 59:8aa304768360 | 148 | * It implies ARM_MATH_FLOAT16 and ARM_MATH_MVEI. |
cactode | 59:8aa304768360 | 149 | * |
cactode | 59:8aa304768360 | 150 | * - ARM_MATH_MVEI: |
cactode | 59:8aa304768360 | 151 | * |
cactode | 59:8aa304768360 | 152 | * Select Helium versions of the int and fixed point algorithms. |
cactode | 59:8aa304768360 | 153 | * |
cactode | 59:8aa304768360 | 154 | * - ARM_MATH_FLOAT16: |
cactode | 59:8aa304768360 | 155 | * |
cactode | 59:8aa304768360 | 156 | * Float16 implementations of some algorithms (Requires MVE extension). |
cactode | 59:8aa304768360 | 157 | * |
cactode | 59:8aa304768360 | 158 | * <hr> |
cactode | 59:8aa304768360 | 159 | * CMSIS-DSP in ARM::CMSIS Pack |
cactode | 59:8aa304768360 | 160 | * ----------------------------- |
cactode | 59:8aa304768360 | 161 | * |
cactode | 59:8aa304768360 | 162 | * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories: |
cactode | 59:8aa304768360 | 163 | * |File/Folder |Content | |
cactode | 59:8aa304768360 | 164 | * |---------------------------------|------------------------------------------------------------------------| |
cactode | 59:8aa304768360 | 165 | * |\b CMSIS\\Documentation\\DSP | This documentation | |
cactode | 59:8aa304768360 | 166 | * |\b CMSIS\\DSP\\DSP_Lib_TestSuite | DSP_Lib test suite | |
cactode | 59:8aa304768360 | 167 | * |\b CMSIS\\DSP\\Examples | Example projects demonstrating the usage of the library functions | |
cactode | 59:8aa304768360 | 168 | * |\b CMSIS\\DSP\\Include | DSP_Lib include files | |
cactode | 59:8aa304768360 | 169 | * |\b CMSIS\\DSP\\Lib | DSP_Lib binaries | |
cactode | 59:8aa304768360 | 170 | * |\b CMSIS\\DSP\\Projects | Projects to rebuild DSP_Lib binaries | |
cactode | 59:8aa304768360 | 171 | * |\b CMSIS\\DSP\\Source | DSP_Lib source files | |
cactode | 59:8aa304768360 | 172 | * |
cactode | 59:8aa304768360 | 173 | * <hr> |
cactode | 59:8aa304768360 | 174 | * Revision History of CMSIS-DSP |
cactode | 59:8aa304768360 | 175 | * ------------ |
cactode | 59:8aa304768360 | 176 | * Please refer to \ref ChangeLog_pg. |
cactode | 59:8aa304768360 | 177 | */ |
cactode | 59:8aa304768360 | 178 | |
cactode | 59:8aa304768360 | 179 | |
cactode | 59:8aa304768360 | 180 | /** |
cactode | 59:8aa304768360 | 181 | * @defgroup groupMath Basic Math Functions |
cactode | 59:8aa304768360 | 182 | */ |
cactode | 59:8aa304768360 | 183 | |
cactode | 59:8aa304768360 | 184 | /** |
cactode | 59:8aa304768360 | 185 | * @defgroup groupFastMath Fast Math Functions |
cactode | 59:8aa304768360 | 186 | * This set of functions provides a fast approximation to sine, cosine, and square root. |
cactode | 59:8aa304768360 | 187 | * As compared to most of the other functions in the CMSIS math library, the fast math functions |
cactode | 59:8aa304768360 | 188 | * operate on individual values and not arrays. |
cactode | 59:8aa304768360 | 189 | * There are separate functions for Q15, Q31, and floating-point data. |
cactode | 59:8aa304768360 | 190 | * |
cactode | 59:8aa304768360 | 191 | */ |
cactode | 59:8aa304768360 | 192 | |
cactode | 59:8aa304768360 | 193 | /** |
cactode | 59:8aa304768360 | 194 | * @defgroup groupCmplxMath Complex Math Functions |
cactode | 59:8aa304768360 | 195 | * This set of functions operates on complex data vectors. |
cactode | 59:8aa304768360 | 196 | * The data in the complex arrays is stored in an interleaved fashion |
cactode | 59:8aa304768360 | 197 | * (real, imag, real, imag, ...). |
cactode | 59:8aa304768360 | 198 | * In the API functions, the number of samples in a complex array refers |
cactode | 59:8aa304768360 | 199 | * to the number of complex values; the array contains twice this number of |
cactode | 59:8aa304768360 | 200 | * real values. |
cactode | 59:8aa304768360 | 201 | */ |
cactode | 59:8aa304768360 | 202 | |
cactode | 59:8aa304768360 | 203 | /** |
cactode | 59:8aa304768360 | 204 | * @defgroup groupFilters Filtering Functions |
cactode | 59:8aa304768360 | 205 | */ |
cactode | 59:8aa304768360 | 206 | |
cactode | 59:8aa304768360 | 207 | /** |
cactode | 59:8aa304768360 | 208 | * @defgroup groupMatrix Matrix Functions |
cactode | 59:8aa304768360 | 209 | * |
cactode | 59:8aa304768360 | 210 | * This set of functions provides basic matrix math operations. |
cactode | 59:8aa304768360 | 211 | * The functions operate on matrix data structures. For example, |
cactode | 59:8aa304768360 | 212 | * the type |
cactode | 59:8aa304768360 | 213 | * definition for the floating-point matrix structure is shown |
cactode | 59:8aa304768360 | 214 | * below: |
cactode | 59:8aa304768360 | 215 | * <pre> |
cactode | 59:8aa304768360 | 216 | * typedef struct |
cactode | 59:8aa304768360 | 217 | * { |
cactode | 59:8aa304768360 | 218 | * uint16_t numRows; // number of rows of the matrix. |
cactode | 59:8aa304768360 | 219 | * uint16_t numCols; // number of columns of the matrix. |
cactode | 59:8aa304768360 | 220 | * float32_t *pData; // points to the data of the matrix. |
cactode | 59:8aa304768360 | 221 | * } arm_matrix_instance_f32; |
cactode | 59:8aa304768360 | 222 | * </pre> |
cactode | 59:8aa304768360 | 223 | * There are similar definitions for Q15 and Q31 data types. |
cactode | 59:8aa304768360 | 224 | * |
cactode | 59:8aa304768360 | 225 | * The structure specifies the size of the matrix and then points to |
cactode | 59:8aa304768360 | 226 | * an array of data. The array is of size <code>numRows X numCols</code> |
cactode | 59:8aa304768360 | 227 | * and the values are arranged in row order. That is, the |
cactode | 59:8aa304768360 | 228 | * matrix element (i, j) is stored at: |
cactode | 59:8aa304768360 | 229 | * <pre> |
cactode | 59:8aa304768360 | 230 | * pData[i*numCols + j] |
cactode | 59:8aa304768360 | 231 | * </pre> |
cactode | 59:8aa304768360 | 232 | * |
cactode | 59:8aa304768360 | 233 | * \par Init Functions |
cactode | 59:8aa304768360 | 234 | * There is an associated initialization function for each type of matrix |
cactode | 59:8aa304768360 | 235 | * data structure. |
cactode | 59:8aa304768360 | 236 | * The initialization function sets the values of the internal structure fields. |
cactode | 59:8aa304768360 | 237 | * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15() |
cactode | 59:8aa304768360 | 238 | * for floating-point, Q31 and Q15 types, respectively. |
cactode | 59:8aa304768360 | 239 | * |
cactode | 59:8aa304768360 | 240 | * \par |
cactode | 59:8aa304768360 | 241 | * Use of the initialization function is optional. However, if initialization function is used |
cactode | 59:8aa304768360 | 242 | * then the instance structure cannot be placed into a const data section. |
cactode | 59:8aa304768360 | 243 | * To place the instance structure in a const data |
cactode | 59:8aa304768360 | 244 | * section, manually initialize the data structure. For example: |
cactode | 59:8aa304768360 | 245 | * <pre> |
cactode | 59:8aa304768360 | 246 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code> |
cactode | 59:8aa304768360 | 247 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code> |
cactode | 59:8aa304768360 | 248 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code> |
cactode | 59:8aa304768360 | 249 | * </pre> |
cactode | 59:8aa304768360 | 250 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code> |
cactode | 59:8aa304768360 | 251 | * specifies the number of columns, and <code>pData</code> points to the |
cactode | 59:8aa304768360 | 252 | * data array. |
cactode | 59:8aa304768360 | 253 | * |
cactode | 59:8aa304768360 | 254 | * \par Size Checking |
cactode | 59:8aa304768360 | 255 | * By default all of the matrix functions perform size checking on the input and |
cactode | 59:8aa304768360 | 256 | * output matrices. For example, the matrix addition function verifies that the |
cactode | 59:8aa304768360 | 257 | * two input matrices and the output matrix all have the same number of rows and |
cactode | 59:8aa304768360 | 258 | * columns. If the size check fails the functions return: |
cactode | 59:8aa304768360 | 259 | * <pre> |
cactode | 59:8aa304768360 | 260 | * ARM_MATH_SIZE_MISMATCH |
cactode | 59:8aa304768360 | 261 | * </pre> |
cactode | 59:8aa304768360 | 262 | * Otherwise the functions return |
cactode | 59:8aa304768360 | 263 | * <pre> |
cactode | 59:8aa304768360 | 264 | * ARM_MATH_SUCCESS |
cactode | 59:8aa304768360 | 265 | * </pre> |
cactode | 59:8aa304768360 | 266 | * There is some overhead associated with this matrix size checking. |
cactode | 59:8aa304768360 | 267 | * The matrix size checking is enabled via the \#define |
cactode | 59:8aa304768360 | 268 | * <pre> |
cactode | 59:8aa304768360 | 269 | * ARM_MATH_MATRIX_CHECK |
cactode | 59:8aa304768360 | 270 | * </pre> |
cactode | 59:8aa304768360 | 271 | * within the library project settings. By default this macro is defined |
cactode | 59:8aa304768360 | 272 | * and size checking is enabled. By changing the project settings and |
cactode | 59:8aa304768360 | 273 | * undefining this macro size checking is eliminated and the functions |
cactode | 59:8aa304768360 | 274 | * run a bit faster. With size checking disabled the functions always |
cactode | 59:8aa304768360 | 275 | * return <code>ARM_MATH_SUCCESS</code>. |
cactode | 59:8aa304768360 | 276 | */ |
cactode | 59:8aa304768360 | 277 | |
cactode | 59:8aa304768360 | 278 | /** |
cactode | 59:8aa304768360 | 279 | * @defgroup groupTransforms Transform Functions |
cactode | 59:8aa304768360 | 280 | */ |
cactode | 59:8aa304768360 | 281 | |
cactode | 59:8aa304768360 | 282 | /** |
cactode | 59:8aa304768360 | 283 | * @defgroup groupController Controller Functions |
cactode | 59:8aa304768360 | 284 | */ |
cactode | 59:8aa304768360 | 285 | |
cactode | 59:8aa304768360 | 286 | /** |
cactode | 59:8aa304768360 | 287 | * @defgroup groupStats Statistics Functions |
cactode | 59:8aa304768360 | 288 | */ |
cactode | 59:8aa304768360 | 289 | |
cactode | 59:8aa304768360 | 290 | /** |
cactode | 59:8aa304768360 | 291 | * @defgroup groupSupport Support Functions |
cactode | 59:8aa304768360 | 292 | */ |
cactode | 59:8aa304768360 | 293 | |
cactode | 59:8aa304768360 | 294 | /** |
cactode | 59:8aa304768360 | 295 | * @defgroup groupInterpolation Interpolation Functions |
cactode | 59:8aa304768360 | 296 | * These functions perform 1- and 2-dimensional interpolation of data. |
cactode | 59:8aa304768360 | 297 | * Linear interpolation is used for 1-dimensional data and |
cactode | 59:8aa304768360 | 298 | * bilinear interpolation is used for 2-dimensional data. |
cactode | 59:8aa304768360 | 299 | */ |
cactode | 59:8aa304768360 | 300 | |
cactode | 59:8aa304768360 | 301 | /** |
cactode | 59:8aa304768360 | 302 | * @defgroup groupExamples Examples |
cactode | 59:8aa304768360 | 303 | */ |
cactode | 59:8aa304768360 | 304 | |
cactode | 59:8aa304768360 | 305 | /** |
cactode | 59:8aa304768360 | 306 | * @defgroup groupSVM SVM Functions |
cactode | 59:8aa304768360 | 307 | * This set of functions is implementing SVM classification on 2 classes. |
cactode | 59:8aa304768360 | 308 | * The training must be done from scikit-learn. The parameters can be easily |
cactode | 59:8aa304768360 | 309 | * generated from the scikit-learn object. Some examples are given in |
cactode | 59:8aa304768360 | 310 | * DSP/Testing/PatternGeneration/SVM.py |
cactode | 59:8aa304768360 | 311 | * |
cactode | 59:8aa304768360 | 312 | * If more than 2 classes are needed, the functions in this folder |
cactode | 59:8aa304768360 | 313 | * will have to be used, as building blocks, to do multi-class classification. |
cactode | 59:8aa304768360 | 314 | * |
cactode | 59:8aa304768360 | 315 | * No multi-class classification is provided in this SVM folder. |
cactode | 59:8aa304768360 | 316 | * |
cactode | 59:8aa304768360 | 317 | */ |
cactode | 59:8aa304768360 | 318 | |
cactode | 59:8aa304768360 | 319 | |
cactode | 59:8aa304768360 | 320 | /** |
cactode | 59:8aa304768360 | 321 | * @defgroup groupBayes Bayesian estimators |
cactode | 59:8aa304768360 | 322 | * |
cactode | 59:8aa304768360 | 323 | * Implement the naive gaussian Bayes estimator. |
cactode | 59:8aa304768360 | 324 | * The training must be done from scikit-learn. |
cactode | 59:8aa304768360 | 325 | * |
cactode | 59:8aa304768360 | 326 | * The parameters can be easily |
cactode | 59:8aa304768360 | 327 | * generated from the scikit-learn object. Some examples are given in |
cactode | 59:8aa304768360 | 328 | * DSP/Testing/PatternGeneration/Bayes.py |
cactode | 59:8aa304768360 | 329 | */ |
cactode | 59:8aa304768360 | 330 | |
cactode | 59:8aa304768360 | 331 | /** |
cactode | 59:8aa304768360 | 332 | * @defgroup groupDistance Distance functions |
cactode | 59:8aa304768360 | 333 | * |
cactode | 59:8aa304768360 | 334 | * Distance functions for use with clustering algorithms. |
cactode | 59:8aa304768360 | 335 | * There are distance functions for float vectors and boolean vectors. |
cactode | 59:8aa304768360 | 336 | * |
cactode | 59:8aa304768360 | 337 | */ |
cactode | 59:8aa304768360 | 338 | |
cactode | 59:8aa304768360 | 339 | |
cactode | 59:8aa304768360 | 340 | #ifndef _ARM_MATH_H |
cactode | 59:8aa304768360 | 341 | #define _ARM_MATH_H |
cactode | 59:8aa304768360 | 342 | |
cactode | 59:8aa304768360 | 343 | #ifdef __cplusplus |
cactode | 59:8aa304768360 | 344 | extern "C" |
cactode | 59:8aa304768360 | 345 | { |
cactode | 59:8aa304768360 | 346 | #endif |
cactode | 59:8aa304768360 | 347 | |
cactode | 59:8aa304768360 | 348 | /* Compiler specific diagnostic adjustment */ |
cactode | 59:8aa304768360 | 349 | #if defined ( __CC_ARM ) |
cactode | 59:8aa304768360 | 350 | |
cactode | 59:8aa304768360 | 351 | #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) |
cactode | 59:8aa304768360 | 352 | |
cactode | 59:8aa304768360 | 353 | #elif defined ( __GNUC__ ) |
cactode | 59:8aa304768360 | 354 | #pragma GCC diagnostic push |
cactode | 59:8aa304768360 | 355 | #pragma GCC diagnostic ignored "-Wsign-conversion" |
cactode | 59:8aa304768360 | 356 | #pragma GCC diagnostic ignored "-Wconversion" |
cactode | 59:8aa304768360 | 357 | #pragma GCC diagnostic ignored "-Wunused-parameter" |
cactode | 59:8aa304768360 | 358 | |
cactode | 59:8aa304768360 | 359 | #elif defined ( __ICCARM__ ) |
cactode | 59:8aa304768360 | 360 | |
cactode | 59:8aa304768360 | 361 | #elif defined ( __TI_ARM__ ) |
cactode | 59:8aa304768360 | 362 | |
cactode | 59:8aa304768360 | 363 | #elif defined ( __CSMC__ ) |
cactode | 59:8aa304768360 | 364 | |
cactode | 59:8aa304768360 | 365 | #elif defined ( __TASKING__ ) |
cactode | 59:8aa304768360 | 366 | |
cactode | 59:8aa304768360 | 367 | #elif defined ( _MSC_VER ) |
cactode | 59:8aa304768360 | 368 | |
cactode | 59:8aa304768360 | 369 | #else |
cactode | 59:8aa304768360 | 370 | #error Unknown compiler |
cactode | 59:8aa304768360 | 371 | #endif |
cactode | 59:8aa304768360 | 372 | |
cactode | 59:8aa304768360 | 373 | |
cactode | 59:8aa304768360 | 374 | /* Included for instrinsics definitions */ |
cactode | 59:8aa304768360 | 375 | #if defined (_MSC_VER ) |
cactode | 59:8aa304768360 | 376 | #include <stdint.h> |
cactode | 59:8aa304768360 | 377 | #define __STATIC_FORCEINLINE static __forceinline |
cactode | 59:8aa304768360 | 378 | #define __STATIC_INLINE static __inline |
cactode | 59:8aa304768360 | 379 | #define __ALIGNED(x) __declspec(align(x)) |
cactode | 59:8aa304768360 | 380 | |
cactode | 59:8aa304768360 | 381 | #elif defined (__GNUC_PYTHON__) |
cactode | 59:8aa304768360 | 382 | #include <stdint.h> |
cactode | 59:8aa304768360 | 383 | #define __ALIGNED(x) __attribute__((aligned(x))) |
cactode | 59:8aa304768360 | 384 | #define __STATIC_FORCEINLINE static __attribute__((inline)) |
cactode | 59:8aa304768360 | 385 | #define __STATIC_INLINE static __attribute__((inline)) |
cactode | 59:8aa304768360 | 386 | #pragma GCC diagnostic ignored "-Wunused-function" |
cactode | 59:8aa304768360 | 387 | #pragma GCC diagnostic ignored "-Wattributes" |
cactode | 59:8aa304768360 | 388 | |
cactode | 59:8aa304768360 | 389 | #else |
cactode | 59:8aa304768360 | 390 | #include "cmsis_compiler.h" |
cactode | 59:8aa304768360 | 391 | #endif |
cactode | 59:8aa304768360 | 392 | |
cactode | 59:8aa304768360 | 393 | |
cactode | 59:8aa304768360 | 394 | |
cactode | 59:8aa304768360 | 395 | #include <string.h> |
cactode | 59:8aa304768360 | 396 | #include <math.h> |
cactode | 59:8aa304768360 | 397 | #include <float.h> |
cactode | 59:8aa304768360 | 398 | #include <limits.h> |
cactode | 59:8aa304768360 | 399 | |
cactode | 59:8aa304768360 | 400 | |
cactode | 59:8aa304768360 | 401 | #define F64_MAX ((float64_t)DBL_MAX) |
cactode | 59:8aa304768360 | 402 | #define F32_MAX ((float32_t)FLT_MAX) |
cactode | 59:8aa304768360 | 403 | |
cactode | 59:8aa304768360 | 404 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 405 | #define F16_MAX ((float16_t)FLT_MAX) |
cactode | 59:8aa304768360 | 406 | #endif |
cactode | 59:8aa304768360 | 407 | |
cactode | 59:8aa304768360 | 408 | #define F64_MIN (-DBL_MAX) |
cactode | 59:8aa304768360 | 409 | #define F32_MIN (-FLT_MAX) |
cactode | 59:8aa304768360 | 410 | |
cactode | 59:8aa304768360 | 411 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 412 | #define F16_MIN (-(float16_t)FLT_MAX) |
cactode | 59:8aa304768360 | 413 | #endif |
cactode | 59:8aa304768360 | 414 | |
cactode | 59:8aa304768360 | 415 | #define F64_ABSMAX ((float64_t)DBL_MAX) |
cactode | 59:8aa304768360 | 416 | #define F32_ABSMAX ((float32_t)FLT_MAX) |
cactode | 59:8aa304768360 | 417 | |
cactode | 59:8aa304768360 | 418 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 419 | #define F16_ABSMAX ((float16_t)FLT_MAX) |
cactode | 59:8aa304768360 | 420 | #endif |
cactode | 59:8aa304768360 | 421 | |
cactode | 59:8aa304768360 | 422 | #define F64_ABSMIN ((float64_t)0.0) |
cactode | 59:8aa304768360 | 423 | #define F32_ABSMIN ((float32_t)0.0) |
cactode | 59:8aa304768360 | 424 | |
cactode | 59:8aa304768360 | 425 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 426 | #define F16_ABSMIN ((float16_t)0.0) |
cactode | 59:8aa304768360 | 427 | #endif |
cactode | 59:8aa304768360 | 428 | |
cactode | 59:8aa304768360 | 429 | #define Q31_MAX ((q31_t)(0x7FFFFFFFL)) |
cactode | 59:8aa304768360 | 430 | #define Q15_MAX ((q15_t)(0x7FFF)) |
cactode | 59:8aa304768360 | 431 | #define Q7_MAX ((q7_t)(0x7F)) |
cactode | 59:8aa304768360 | 432 | #define Q31_MIN ((q31_t)(0x80000000L)) |
cactode | 59:8aa304768360 | 433 | #define Q15_MIN ((q15_t)(0x8000)) |
cactode | 59:8aa304768360 | 434 | #define Q7_MIN ((q7_t)(0x80)) |
cactode | 59:8aa304768360 | 435 | |
cactode | 59:8aa304768360 | 436 | #define Q31_ABSMAX ((q31_t)(0x7FFFFFFFL)) |
cactode | 59:8aa304768360 | 437 | #define Q15_ABSMAX ((q15_t)(0x7FFF)) |
cactode | 59:8aa304768360 | 438 | #define Q7_ABSMAX ((q7_t)(0x7F)) |
cactode | 59:8aa304768360 | 439 | #define Q31_ABSMIN ((q31_t)0) |
cactode | 59:8aa304768360 | 440 | #define Q15_ABSMIN ((q15_t)0) |
cactode | 59:8aa304768360 | 441 | #define Q7_ABSMIN ((q7_t)0) |
cactode | 59:8aa304768360 | 442 | |
cactode | 59:8aa304768360 | 443 | /* evaluate ARM DSP feature */ |
cactode | 59:8aa304768360 | 444 | #if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) |
cactode | 59:8aa304768360 | 445 | #define ARM_MATH_DSP 1 |
cactode | 59:8aa304768360 | 446 | #endif |
cactode | 59:8aa304768360 | 447 | |
cactode | 59:8aa304768360 | 448 | #if defined(ARM_MATH_NEON) |
cactode | 59:8aa304768360 | 449 | #include <arm_neon.h> |
cactode | 59:8aa304768360 | 450 | #endif |
cactode | 59:8aa304768360 | 451 | |
cactode | 59:8aa304768360 | 452 | #if defined (ARM_MATH_HELIUM) |
cactode | 59:8aa304768360 | 453 | #define ARM_MATH_MVEF |
cactode | 59:8aa304768360 | 454 | #define ARM_MATH_FLOAT16 |
cactode | 59:8aa304768360 | 455 | #endif |
cactode | 59:8aa304768360 | 456 | |
cactode | 59:8aa304768360 | 457 | #if defined (ARM_MATH_MVEF) |
cactode | 59:8aa304768360 | 458 | #define ARM_MATH_MVEI |
cactode | 59:8aa304768360 | 459 | #define ARM_MATH_FLOAT16 |
cactode | 59:8aa304768360 | 460 | #endif |
cactode | 59:8aa304768360 | 461 | |
cactode | 59:8aa304768360 | 462 | #if defined (ARM_MATH_HELIUM) || defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI) |
cactode | 59:8aa304768360 | 463 | #include <arm_mve.h> |
cactode | 59:8aa304768360 | 464 | #endif |
cactode | 59:8aa304768360 | 465 | |
cactode | 59:8aa304768360 | 466 | |
cactode | 59:8aa304768360 | 467 | /** |
cactode | 59:8aa304768360 | 468 | * @brief Macros required for reciprocal calculation in Normalized LMS |
cactode | 59:8aa304768360 | 469 | */ |
cactode | 59:8aa304768360 | 470 | |
cactode | 59:8aa304768360 | 471 | #define DELTA_Q31 ((q31_t)(0x100)) |
cactode | 59:8aa304768360 | 472 | #define DELTA_Q15 ((q15_t)0x5) |
cactode | 59:8aa304768360 | 473 | #define INDEX_MASK 0x0000003F |
cactode | 59:8aa304768360 | 474 | #ifndef PI |
cactode | 59:8aa304768360 | 475 | #define PI 3.14159265358979f |
cactode | 59:8aa304768360 | 476 | #endif |
cactode | 59:8aa304768360 | 477 | |
cactode | 59:8aa304768360 | 478 | /** |
cactode | 59:8aa304768360 | 479 | * @brief Macros required for SINE and COSINE Fast math approximations |
cactode | 59:8aa304768360 | 480 | */ |
cactode | 59:8aa304768360 | 481 | |
cactode | 59:8aa304768360 | 482 | #define FAST_MATH_TABLE_SIZE 512 |
cactode | 59:8aa304768360 | 483 | #define FAST_MATH_Q31_SHIFT (32 - 10) |
cactode | 59:8aa304768360 | 484 | #define FAST_MATH_Q15_SHIFT (16 - 10) |
cactode | 59:8aa304768360 | 485 | #define CONTROLLER_Q31_SHIFT (32 - 9) |
cactode | 59:8aa304768360 | 486 | #define TABLE_SPACING_Q31 0x400000 |
cactode | 59:8aa304768360 | 487 | #define TABLE_SPACING_Q15 0x80 |
cactode | 59:8aa304768360 | 488 | |
cactode | 59:8aa304768360 | 489 | /** |
cactode | 59:8aa304768360 | 490 | * @brief Macros required for SINE and COSINE Controller functions |
cactode | 59:8aa304768360 | 491 | */ |
cactode | 59:8aa304768360 | 492 | /* 1.31(q31) Fixed value of 2/360 */ |
cactode | 59:8aa304768360 | 493 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ |
cactode | 59:8aa304768360 | 494 | #define INPUT_SPACING 0xB60B61 |
cactode | 59:8aa304768360 | 495 | |
cactode | 59:8aa304768360 | 496 | /** |
cactode | 59:8aa304768360 | 497 | * @brief Macros for complex numbers |
cactode | 59:8aa304768360 | 498 | */ |
cactode | 59:8aa304768360 | 499 | |
cactode | 59:8aa304768360 | 500 | /* Dimension C vector space */ |
cactode | 59:8aa304768360 | 501 | #define CMPLX_DIM 2 |
cactode | 59:8aa304768360 | 502 | |
cactode | 59:8aa304768360 | 503 | /** |
cactode | 59:8aa304768360 | 504 | * @brief Error status returned by some functions in the library. |
cactode | 59:8aa304768360 | 505 | */ |
cactode | 59:8aa304768360 | 506 | |
cactode | 59:8aa304768360 | 507 | typedef enum |
cactode | 59:8aa304768360 | 508 | { |
cactode | 59:8aa304768360 | 509 | ARM_MATH_SUCCESS = 0, /**< No error */ |
cactode | 59:8aa304768360 | 510 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ |
cactode | 59:8aa304768360 | 511 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ |
cactode | 59:8aa304768360 | 512 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation */ |
cactode | 59:8aa304768360 | 513 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ |
cactode | 59:8aa304768360 | 514 | ARM_MATH_SINGULAR = -5, /**< Input matrix is singular and cannot be inverted */ |
cactode | 59:8aa304768360 | 515 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ |
cactode | 59:8aa304768360 | 516 | } arm_status; |
cactode | 59:8aa304768360 | 517 | |
cactode | 59:8aa304768360 | 518 | /** |
cactode | 59:8aa304768360 | 519 | * @brief 8-bit fractional data type in 1.7 format. |
cactode | 59:8aa304768360 | 520 | */ |
cactode | 59:8aa304768360 | 521 | typedef int8_t q7_t; |
cactode | 59:8aa304768360 | 522 | |
cactode | 59:8aa304768360 | 523 | /** |
cactode | 59:8aa304768360 | 524 | * @brief 16-bit fractional data type in 1.15 format. |
cactode | 59:8aa304768360 | 525 | */ |
cactode | 59:8aa304768360 | 526 | typedef int16_t q15_t; |
cactode | 59:8aa304768360 | 527 | |
cactode | 59:8aa304768360 | 528 | /** |
cactode | 59:8aa304768360 | 529 | * @brief 32-bit fractional data type in 1.31 format. |
cactode | 59:8aa304768360 | 530 | */ |
cactode | 59:8aa304768360 | 531 | typedef int32_t q31_t; |
cactode | 59:8aa304768360 | 532 | |
cactode | 59:8aa304768360 | 533 | /** |
cactode | 59:8aa304768360 | 534 | * @brief 64-bit fractional data type in 1.63 format. |
cactode | 59:8aa304768360 | 535 | */ |
cactode | 59:8aa304768360 | 536 | typedef int64_t q63_t; |
cactode | 59:8aa304768360 | 537 | |
cactode | 59:8aa304768360 | 538 | /** |
cactode | 59:8aa304768360 | 539 | * @brief 32-bit floating-point type definition. |
cactode | 59:8aa304768360 | 540 | */ |
cactode | 59:8aa304768360 | 541 | typedef float float32_t; |
cactode | 59:8aa304768360 | 542 | |
cactode | 59:8aa304768360 | 543 | /** |
cactode | 59:8aa304768360 | 544 | * @brief 64-bit floating-point type definition. |
cactode | 59:8aa304768360 | 545 | */ |
cactode | 59:8aa304768360 | 546 | typedef double float64_t; |
cactode | 59:8aa304768360 | 547 | |
cactode | 59:8aa304768360 | 548 | /** |
cactode | 59:8aa304768360 | 549 | * @brief vector types |
cactode | 59:8aa304768360 | 550 | */ |
cactode | 59:8aa304768360 | 551 | #if defined(ARM_MATH_NEON) || defined (ARM_MATH_MVEI) |
cactode | 59:8aa304768360 | 552 | /** |
cactode | 59:8aa304768360 | 553 | * @brief 64-bit fractional 128-bit vector data type in 1.63 format |
cactode | 59:8aa304768360 | 554 | */ |
cactode | 59:8aa304768360 | 555 | typedef int64x2_t q63x2_t; |
cactode | 59:8aa304768360 | 556 | |
cactode | 59:8aa304768360 | 557 | /** |
cactode | 59:8aa304768360 | 558 | * @brief 32-bit fractional 128-bit vector data type in 1.31 format. |
cactode | 59:8aa304768360 | 559 | */ |
cactode | 59:8aa304768360 | 560 | typedef int32x4_t q31x4_t; |
cactode | 59:8aa304768360 | 561 | |
cactode | 59:8aa304768360 | 562 | /** |
cactode | 59:8aa304768360 | 563 | * @brief 16-bit fractional 128-bit vector data type with 16-bit alignement in 1.15 format. |
cactode | 59:8aa304768360 | 564 | */ |
cactode | 59:8aa304768360 | 565 | typedef __ALIGNED(2) int16x8_t q15x8_t; |
cactode | 59:8aa304768360 | 566 | |
cactode | 59:8aa304768360 | 567 | /** |
cactode | 59:8aa304768360 | 568 | * @brief 8-bit fractional 128-bit vector data type with 8-bit alignement in 1.7 format. |
cactode | 59:8aa304768360 | 569 | */ |
cactode | 59:8aa304768360 | 570 | typedef __ALIGNED(1) int8x16_t q7x16_t; |
cactode | 59:8aa304768360 | 571 | |
cactode | 59:8aa304768360 | 572 | /** |
cactode | 59:8aa304768360 | 573 | * @brief 32-bit fractional 128-bit vector pair data type in 1.31 format. |
cactode | 59:8aa304768360 | 574 | */ |
cactode | 59:8aa304768360 | 575 | typedef int32x4x2_t q31x4x2_t; |
cactode | 59:8aa304768360 | 576 | |
cactode | 59:8aa304768360 | 577 | /** |
cactode | 59:8aa304768360 | 578 | * @brief 32-bit fractional 128-bit vector quadruplet data type in 1.31 format. |
cactode | 59:8aa304768360 | 579 | */ |
cactode | 59:8aa304768360 | 580 | typedef int32x4x4_t q31x4x4_t; |
cactode | 59:8aa304768360 | 581 | |
cactode | 59:8aa304768360 | 582 | /** |
cactode | 59:8aa304768360 | 583 | * @brief 16-bit fractional 128-bit vector pair data type in 1.15 format. |
cactode | 59:8aa304768360 | 584 | */ |
cactode | 59:8aa304768360 | 585 | typedef int16x8x2_t q15x8x2_t; |
cactode | 59:8aa304768360 | 586 | |
cactode | 59:8aa304768360 | 587 | /** |
cactode | 59:8aa304768360 | 588 | * @brief 16-bit fractional 128-bit vector quadruplet data type in 1.15 format. |
cactode | 59:8aa304768360 | 589 | */ |
cactode | 59:8aa304768360 | 590 | typedef int16x8x4_t q15x8x4_t; |
cactode | 59:8aa304768360 | 591 | |
cactode | 59:8aa304768360 | 592 | /** |
cactode | 59:8aa304768360 | 593 | * @brief 8-bit fractional 128-bit vector pair data type in 1.7 format. |
cactode | 59:8aa304768360 | 594 | */ |
cactode | 59:8aa304768360 | 595 | typedef int8x16x2_t q7x16x2_t; |
cactode | 59:8aa304768360 | 596 | |
cactode | 59:8aa304768360 | 597 | /** |
cactode | 59:8aa304768360 | 598 | * @brief 8-bit fractional 128-bit vector quadruplet data type in 1.7 format. |
cactode | 59:8aa304768360 | 599 | */ |
cactode | 59:8aa304768360 | 600 | typedef int8x16x4_t q7x16x4_t; |
cactode | 59:8aa304768360 | 601 | |
cactode | 59:8aa304768360 | 602 | /** |
cactode | 59:8aa304768360 | 603 | * @brief 32-bit fractional data type in 9.23 format. |
cactode | 59:8aa304768360 | 604 | */ |
cactode | 59:8aa304768360 | 605 | typedef int32_t q23_t; |
cactode | 59:8aa304768360 | 606 | |
cactode | 59:8aa304768360 | 607 | /** |
cactode | 59:8aa304768360 | 608 | * @brief 32-bit fractional 128-bit vector data type in 9.23 format. |
cactode | 59:8aa304768360 | 609 | */ |
cactode | 59:8aa304768360 | 610 | typedef int32x4_t q23x4_t; |
cactode | 59:8aa304768360 | 611 | |
cactode | 59:8aa304768360 | 612 | /** |
cactode | 59:8aa304768360 | 613 | * @brief 64-bit status 128-bit vector data type. |
cactode | 59:8aa304768360 | 614 | */ |
cactode | 59:8aa304768360 | 615 | typedef int64x2_t status64x2_t; |
cactode | 59:8aa304768360 | 616 | |
cactode | 59:8aa304768360 | 617 | /** |
cactode | 59:8aa304768360 | 618 | * @brief 32-bit status 128-bit vector data type. |
cactode | 59:8aa304768360 | 619 | */ |
cactode | 59:8aa304768360 | 620 | typedef int32x4_t status32x4_t; |
cactode | 59:8aa304768360 | 621 | |
cactode | 59:8aa304768360 | 622 | /** |
cactode | 59:8aa304768360 | 623 | * @brief 16-bit status 128-bit vector data type. |
cactode | 59:8aa304768360 | 624 | */ |
cactode | 59:8aa304768360 | 625 | typedef int16x8_t status16x8_t; |
cactode | 59:8aa304768360 | 626 | |
cactode | 59:8aa304768360 | 627 | /** |
cactode | 59:8aa304768360 | 628 | * @brief 8-bit status 128-bit vector data type. |
cactode | 59:8aa304768360 | 629 | */ |
cactode | 59:8aa304768360 | 630 | typedef int8x16_t status8x16_t; |
cactode | 59:8aa304768360 | 631 | |
cactode | 59:8aa304768360 | 632 | |
cactode | 59:8aa304768360 | 633 | #endif |
cactode | 59:8aa304768360 | 634 | |
cactode | 59:8aa304768360 | 635 | #if defined(ARM_MATH_NEON) || defined(ARM_MATH_MVEF) /* floating point vector*/ |
cactode | 59:8aa304768360 | 636 | /** |
cactode | 59:8aa304768360 | 637 | * @brief 32-bit floating-point 128-bit vector type |
cactode | 59:8aa304768360 | 638 | */ |
cactode | 59:8aa304768360 | 639 | typedef float32x4_t f32x4_t; |
cactode | 59:8aa304768360 | 640 | |
cactode | 59:8aa304768360 | 641 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 642 | /** |
cactode | 59:8aa304768360 | 643 | * @brief 16-bit floating-point 128-bit vector data type |
cactode | 59:8aa304768360 | 644 | */ |
cactode | 59:8aa304768360 | 645 | typedef __ALIGNED(2) float16x8_t f16x8_t; |
cactode | 59:8aa304768360 | 646 | #endif |
cactode | 59:8aa304768360 | 647 | |
cactode | 59:8aa304768360 | 648 | /** |
cactode | 59:8aa304768360 | 649 | * @brief 32-bit floating-point 128-bit vector pair data type |
cactode | 59:8aa304768360 | 650 | */ |
cactode | 59:8aa304768360 | 651 | typedef float32x4x2_t f32x4x2_t; |
cactode | 59:8aa304768360 | 652 | |
cactode | 59:8aa304768360 | 653 | /** |
cactode | 59:8aa304768360 | 654 | * @brief 32-bit floating-point 128-bit vector quadruplet data type |
cactode | 59:8aa304768360 | 655 | */ |
cactode | 59:8aa304768360 | 656 | typedef float32x4x4_t f32x4x4_t; |
cactode | 59:8aa304768360 | 657 | |
cactode | 59:8aa304768360 | 658 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 659 | /** |
cactode | 59:8aa304768360 | 660 | * @brief 16-bit floating-point 128-bit vector pair data type |
cactode | 59:8aa304768360 | 661 | */ |
cactode | 59:8aa304768360 | 662 | typedef float16x8x2_t f16x8x2_t; |
cactode | 59:8aa304768360 | 663 | |
cactode | 59:8aa304768360 | 664 | /** |
cactode | 59:8aa304768360 | 665 | * @brief 16-bit floating-point 128-bit vector quadruplet data type |
cactode | 59:8aa304768360 | 666 | */ |
cactode | 59:8aa304768360 | 667 | typedef float16x8x4_t f16x8x4_t; |
cactode | 59:8aa304768360 | 668 | #endif |
cactode | 59:8aa304768360 | 669 | |
cactode | 59:8aa304768360 | 670 | /** |
cactode | 59:8aa304768360 | 671 | * @brief 32-bit ubiquitous 128-bit vector data type |
cactode | 59:8aa304768360 | 672 | */ |
cactode | 59:8aa304768360 | 673 | typedef union _any32x4_t |
cactode | 59:8aa304768360 | 674 | { |
cactode | 59:8aa304768360 | 675 | float32x4_t f; |
cactode | 59:8aa304768360 | 676 | int32x4_t i; |
cactode | 59:8aa304768360 | 677 | } any32x4_t; |
cactode | 59:8aa304768360 | 678 | |
cactode | 59:8aa304768360 | 679 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 680 | /** |
cactode | 59:8aa304768360 | 681 | * @brief 16-bit ubiquitous 128-bit vector data type |
cactode | 59:8aa304768360 | 682 | */ |
cactode | 59:8aa304768360 | 683 | typedef union _any16x8_t |
cactode | 59:8aa304768360 | 684 | { |
cactode | 59:8aa304768360 | 685 | float16x8_t f; |
cactode | 59:8aa304768360 | 686 | int16x8_t i; |
cactode | 59:8aa304768360 | 687 | } any16x8_t; |
cactode | 59:8aa304768360 | 688 | #endif |
cactode | 59:8aa304768360 | 689 | |
cactode | 59:8aa304768360 | 690 | #endif |
cactode | 59:8aa304768360 | 691 | |
cactode | 59:8aa304768360 | 692 | #if defined(ARM_MATH_NEON) |
cactode | 59:8aa304768360 | 693 | /** |
cactode | 59:8aa304768360 | 694 | * @brief 32-bit fractional 64-bit vector data type in 1.31 format. |
cactode | 59:8aa304768360 | 695 | */ |
cactode | 59:8aa304768360 | 696 | typedef int32x2_t q31x2_t; |
cactode | 59:8aa304768360 | 697 | |
cactode | 59:8aa304768360 | 698 | /** |
cactode | 59:8aa304768360 | 699 | * @brief 16-bit fractional 64-bit vector data type in 1.15 format. |
cactode | 59:8aa304768360 | 700 | */ |
cactode | 59:8aa304768360 | 701 | typedef __ALIGNED(2) int16x4_t q15x4_t; |
cactode | 59:8aa304768360 | 702 | |
cactode | 59:8aa304768360 | 703 | /** |
cactode | 59:8aa304768360 | 704 | * @brief 8-bit fractional 64-bit vector data type in 1.7 format. |
cactode | 59:8aa304768360 | 705 | */ |
cactode | 59:8aa304768360 | 706 | typedef __ALIGNED(1) int8x8_t q7x8_t; |
cactode | 59:8aa304768360 | 707 | |
cactode | 59:8aa304768360 | 708 | /** |
cactode | 59:8aa304768360 | 709 | * @brief 32-bit float 64-bit vector data type. |
cactode | 59:8aa304768360 | 710 | */ |
cactode | 59:8aa304768360 | 711 | typedef float32x2_t f32x2_t; |
cactode | 59:8aa304768360 | 712 | |
cactode | 59:8aa304768360 | 713 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 714 | /** |
cactode | 59:8aa304768360 | 715 | * @brief 16-bit float 64-bit vector data type. |
cactode | 59:8aa304768360 | 716 | */ |
cactode | 59:8aa304768360 | 717 | typedef __ALIGNED(2) float16x4_t f16x4_t; |
cactode | 59:8aa304768360 | 718 | #endif |
cactode | 59:8aa304768360 | 719 | |
cactode | 59:8aa304768360 | 720 | /** |
cactode | 59:8aa304768360 | 721 | * @brief 32-bit floating-point 128-bit vector triplet data type |
cactode | 59:8aa304768360 | 722 | */ |
cactode | 59:8aa304768360 | 723 | typedef float32x4x3_t f32x4x3_t; |
cactode | 59:8aa304768360 | 724 | |
cactode | 59:8aa304768360 | 725 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 726 | /** |
cactode | 59:8aa304768360 | 727 | * @brief 16-bit floating-point 128-bit vector triplet data type |
cactode | 59:8aa304768360 | 728 | */ |
cactode | 59:8aa304768360 | 729 | typedef float16x8x3_t f16x8x3_t; |
cactode | 59:8aa304768360 | 730 | #endif |
cactode | 59:8aa304768360 | 731 | |
cactode | 59:8aa304768360 | 732 | /** |
cactode | 59:8aa304768360 | 733 | * @brief 32-bit fractional 128-bit vector triplet data type in 1.31 format |
cactode | 59:8aa304768360 | 734 | */ |
cactode | 59:8aa304768360 | 735 | typedef int32x4x3_t q31x4x3_t; |
cactode | 59:8aa304768360 | 736 | |
cactode | 59:8aa304768360 | 737 | /** |
cactode | 59:8aa304768360 | 738 | * @brief 16-bit fractional 128-bit vector triplet data type in 1.15 format |
cactode | 59:8aa304768360 | 739 | */ |
cactode | 59:8aa304768360 | 740 | typedef int16x8x3_t q15x8x3_t; |
cactode | 59:8aa304768360 | 741 | |
cactode | 59:8aa304768360 | 742 | /** |
cactode | 59:8aa304768360 | 743 | * @brief 8-bit fractional 128-bit vector triplet data type in 1.7 format |
cactode | 59:8aa304768360 | 744 | */ |
cactode | 59:8aa304768360 | 745 | typedef int8x16x3_t q7x16x3_t; |
cactode | 59:8aa304768360 | 746 | |
cactode | 59:8aa304768360 | 747 | /** |
cactode | 59:8aa304768360 | 748 | * @brief 32-bit floating-point 64-bit vector pair data type |
cactode | 59:8aa304768360 | 749 | */ |
cactode | 59:8aa304768360 | 750 | typedef float32x2x2_t f32x2x2_t; |
cactode | 59:8aa304768360 | 751 | |
cactode | 59:8aa304768360 | 752 | /** |
cactode | 59:8aa304768360 | 753 | * @brief 32-bit floating-point 64-bit vector triplet data type |
cactode | 59:8aa304768360 | 754 | */ |
cactode | 59:8aa304768360 | 755 | typedef float32x2x3_t f32x2x3_t; |
cactode | 59:8aa304768360 | 756 | |
cactode | 59:8aa304768360 | 757 | /** |
cactode | 59:8aa304768360 | 758 | * @brief 32-bit floating-point 64-bit vector quadruplet data type |
cactode | 59:8aa304768360 | 759 | */ |
cactode | 59:8aa304768360 | 760 | typedef float32x2x4_t f32x2x4_t; |
cactode | 59:8aa304768360 | 761 | |
cactode | 59:8aa304768360 | 762 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 763 | /** |
cactode | 59:8aa304768360 | 764 | * @brief 16-bit floating-point 64-bit vector pair data type |
cactode | 59:8aa304768360 | 765 | */ |
cactode | 59:8aa304768360 | 766 | typedef float16x4x2_t f16x4x2_t; |
cactode | 59:8aa304768360 | 767 | |
cactode | 59:8aa304768360 | 768 | /** |
cactode | 59:8aa304768360 | 769 | * @brief 16-bit floating-point 64-bit vector triplet data type |
cactode | 59:8aa304768360 | 770 | */ |
cactode | 59:8aa304768360 | 771 | typedef float16x4x3_t f16x4x3_t; |
cactode | 59:8aa304768360 | 772 | |
cactode | 59:8aa304768360 | 773 | /** |
cactode | 59:8aa304768360 | 774 | * @brief 16-bit floating-point 64-bit vector quadruplet data type |
cactode | 59:8aa304768360 | 775 | */ |
cactode | 59:8aa304768360 | 776 | typedef float16x4x4_t f16x4x4_t; |
cactode | 59:8aa304768360 | 777 | #endif |
cactode | 59:8aa304768360 | 778 | |
cactode | 59:8aa304768360 | 779 | /** |
cactode | 59:8aa304768360 | 780 | * @brief 32-bit fractional 64-bit vector pair data type in 1.31 format |
cactode | 59:8aa304768360 | 781 | */ |
cactode | 59:8aa304768360 | 782 | typedef int32x2x2_t q31x2x2_t; |
cactode | 59:8aa304768360 | 783 | |
cactode | 59:8aa304768360 | 784 | /** |
cactode | 59:8aa304768360 | 785 | * @brief 32-bit fractional 64-bit vector triplet data type in 1.31 format |
cactode | 59:8aa304768360 | 786 | */ |
cactode | 59:8aa304768360 | 787 | typedef int32x2x3_t q31x2x3_t; |
cactode | 59:8aa304768360 | 788 | |
cactode | 59:8aa304768360 | 789 | /** |
cactode | 59:8aa304768360 | 790 | * @brief 32-bit fractional 64-bit vector quadruplet data type in 1.31 format |
cactode | 59:8aa304768360 | 791 | */ |
cactode | 59:8aa304768360 | 792 | typedef int32x4x3_t q31x2x4_t; |
cactode | 59:8aa304768360 | 793 | |
cactode | 59:8aa304768360 | 794 | /** |
cactode | 59:8aa304768360 | 795 | * @brief 16-bit fractional 64-bit vector pair data type in 1.15 format |
cactode | 59:8aa304768360 | 796 | */ |
cactode | 59:8aa304768360 | 797 | typedef int16x4x2_t q15x4x2_t; |
cactode | 59:8aa304768360 | 798 | |
cactode | 59:8aa304768360 | 799 | /** |
cactode | 59:8aa304768360 | 800 | * @brief 16-bit fractional 64-bit vector triplet data type in 1.15 format |
cactode | 59:8aa304768360 | 801 | */ |
cactode | 59:8aa304768360 | 802 | typedef int16x4x2_t q15x4x3_t; |
cactode | 59:8aa304768360 | 803 | |
cactode | 59:8aa304768360 | 804 | /** |
cactode | 59:8aa304768360 | 805 | * @brief 16-bit fractional 64-bit vector quadruplet data type in 1.15 format |
cactode | 59:8aa304768360 | 806 | */ |
cactode | 59:8aa304768360 | 807 | typedef int16x4x3_t q15x4x4_t; |
cactode | 59:8aa304768360 | 808 | |
cactode | 59:8aa304768360 | 809 | /** |
cactode | 59:8aa304768360 | 810 | * @brief 8-bit fractional 64-bit vector pair data type in 1.7 format |
cactode | 59:8aa304768360 | 811 | */ |
cactode | 59:8aa304768360 | 812 | typedef int8x8x2_t q7x8x2_t; |
cactode | 59:8aa304768360 | 813 | |
cactode | 59:8aa304768360 | 814 | /** |
cactode | 59:8aa304768360 | 815 | * @brief 8-bit fractional 64-bit vector triplet data type in 1.7 format |
cactode | 59:8aa304768360 | 816 | */ |
cactode | 59:8aa304768360 | 817 | typedef int8x8x3_t q7x8x3_t; |
cactode | 59:8aa304768360 | 818 | |
cactode | 59:8aa304768360 | 819 | /** |
cactode | 59:8aa304768360 | 820 | * @brief 8-bit fractional 64-bit vector quadruplet data type in 1.7 format |
cactode | 59:8aa304768360 | 821 | */ |
cactode | 59:8aa304768360 | 822 | typedef int8x8x4_t q7x8x4_t; |
cactode | 59:8aa304768360 | 823 | |
cactode | 59:8aa304768360 | 824 | /** |
cactode | 59:8aa304768360 | 825 | * @brief 32-bit ubiquitous 64-bit vector data type |
cactode | 59:8aa304768360 | 826 | */ |
cactode | 59:8aa304768360 | 827 | typedef union _any32x2_t |
cactode | 59:8aa304768360 | 828 | { |
cactode | 59:8aa304768360 | 829 | float32x2_t f; |
cactode | 59:8aa304768360 | 830 | int32x2_t i; |
cactode | 59:8aa304768360 | 831 | } any32x2_t; |
cactode | 59:8aa304768360 | 832 | |
cactode | 59:8aa304768360 | 833 | #if defined(ARM_MATH_FLOAT16) |
cactode | 59:8aa304768360 | 834 | /** |
cactode | 59:8aa304768360 | 835 | * @brief 16-bit ubiquitous 64-bit vector data type |
cactode | 59:8aa304768360 | 836 | */ |
cactode | 59:8aa304768360 | 837 | typedef union _any16x4_t |
cactode | 59:8aa304768360 | 838 | { |
cactode | 59:8aa304768360 | 839 | float16x4_t f; |
cactode | 59:8aa304768360 | 840 | int16x4_t i; |
cactode | 59:8aa304768360 | 841 | } any16x4_t; |
cactode | 59:8aa304768360 | 842 | #endif |
cactode | 59:8aa304768360 | 843 | |
cactode | 59:8aa304768360 | 844 | /** |
cactode | 59:8aa304768360 | 845 | * @brief 32-bit status 64-bit vector data type. |
cactode | 59:8aa304768360 | 846 | */ |
cactode | 59:8aa304768360 | 847 | typedef int32x4_t status32x2_t; |
cactode | 59:8aa304768360 | 848 | |
cactode | 59:8aa304768360 | 849 | /** |
cactode | 59:8aa304768360 | 850 | * @brief 16-bit status 64-bit vector data type. |
cactode | 59:8aa304768360 | 851 | */ |
cactode | 59:8aa304768360 | 852 | typedef int16x8_t status16x4_t; |
cactode | 59:8aa304768360 | 853 | |
cactode | 59:8aa304768360 | 854 | /** |
cactode | 59:8aa304768360 | 855 | * @brief 8-bit status 64-bit vector data type. |
cactode | 59:8aa304768360 | 856 | */ |
cactode | 59:8aa304768360 | 857 | typedef int8x16_t status8x8_t; |
cactode | 59:8aa304768360 | 858 | |
cactode | 59:8aa304768360 | 859 | #endif |
cactode | 59:8aa304768360 | 860 | |
cactode | 59:8aa304768360 | 861 | |
cactode | 59:8aa304768360 | 862 | |
cactode | 59:8aa304768360 | 863 | /** |
cactode | 59:8aa304768360 | 864 | @brief definition to read/write two 16 bit values. |
cactode | 59:8aa304768360 | 865 | @deprecated |
cactode | 59:8aa304768360 | 866 | */ |
cactode | 59:8aa304768360 | 867 | #if defined ( __CC_ARM ) |
cactode | 59:8aa304768360 | 868 | #define __SIMD32_TYPE int32_t __packed |
cactode | 59:8aa304768360 | 869 | #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) |
cactode | 59:8aa304768360 | 870 | #define __SIMD32_TYPE int32_t |
cactode | 59:8aa304768360 | 871 | #elif defined ( __GNUC__ ) |
cactode | 59:8aa304768360 | 872 | #define __SIMD32_TYPE int32_t |
cactode | 59:8aa304768360 | 873 | #elif defined ( __ICCARM__ ) |
cactode | 59:8aa304768360 | 874 | #define __SIMD32_TYPE int32_t __packed |
cactode | 59:8aa304768360 | 875 | #elif defined ( __TI_ARM__ ) |
cactode | 59:8aa304768360 | 876 | #define __SIMD32_TYPE int32_t |
cactode | 59:8aa304768360 | 877 | #elif defined ( __CSMC__ ) |
cactode | 59:8aa304768360 | 878 | #define __SIMD32_TYPE int32_t |
cactode | 59:8aa304768360 | 879 | #elif defined ( __TASKING__ ) |
cactode | 59:8aa304768360 | 880 | #define __SIMD32_TYPE __un(aligned) int32_t |
cactode | 59:8aa304768360 | 881 | #elif defined(_MSC_VER ) |
cactode | 59:8aa304768360 | 882 | #define __SIMD32_TYPE int32_t |
cactode | 59:8aa304768360 | 883 | #else |
cactode | 59:8aa304768360 | 884 | #error Unknown compiler |
cactode | 59:8aa304768360 | 885 | #endif |
cactode | 59:8aa304768360 | 886 | |
cactode | 59:8aa304768360 | 887 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) |
cactode | 59:8aa304768360 | 888 | #define __SIMD32_CONST(addr) ( (__SIMD32_TYPE * ) (addr)) |
cactode | 59:8aa304768360 | 889 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE * ) (addr)) |
cactode | 59:8aa304768360 | 890 | #define __SIMD64(addr) (*( int64_t **) & (addr)) |
cactode | 59:8aa304768360 | 891 | |
cactode | 59:8aa304768360 | 892 | #define STEP(x) (x) <= 0 ? 0 : 1 |
cactode | 59:8aa304768360 | 893 | #define SQ(x) ((x) * (x)) |
cactode | 59:8aa304768360 | 894 | |
cactode | 59:8aa304768360 | 895 | /* SIMD replacement */ |
cactode | 59:8aa304768360 | 896 | |
cactode | 59:8aa304768360 | 897 | |
cactode | 59:8aa304768360 | 898 | /** |
cactode | 59:8aa304768360 | 899 | @brief Read 2 Q15 from Q15 pointer. |
cactode | 59:8aa304768360 | 900 | @param[in] pQ15 points to input value |
cactode | 59:8aa304768360 | 901 | @return Q31 value |
cactode | 59:8aa304768360 | 902 | */ |
cactode | 59:8aa304768360 | 903 | __STATIC_FORCEINLINE q31_t read_q15x2 ( |
cactode | 59:8aa304768360 | 904 | q15_t * pQ15) |
cactode | 59:8aa304768360 | 905 | { |
cactode | 59:8aa304768360 | 906 | q31_t val; |
cactode | 59:8aa304768360 | 907 | |
cactode | 59:8aa304768360 | 908 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 909 | memcpy (&val, pQ15, 4); |
cactode | 59:8aa304768360 | 910 | #else |
cactode | 59:8aa304768360 | 911 | val = (pQ15[1] << 16) | (pQ15[0] & 0x0FFFF) ; |
cactode | 59:8aa304768360 | 912 | #endif |
cactode | 59:8aa304768360 | 913 | |
cactode | 59:8aa304768360 | 914 | return (val); |
cactode | 59:8aa304768360 | 915 | } |
cactode | 59:8aa304768360 | 916 | |
cactode | 59:8aa304768360 | 917 | /** |
cactode | 59:8aa304768360 | 918 | @brief Read 2 Q15 from Q15 pointer and increment pointer afterwards. |
cactode | 59:8aa304768360 | 919 | @param[in] pQ15 points to input value |
cactode | 59:8aa304768360 | 920 | @return Q31 value |
cactode | 59:8aa304768360 | 921 | */ |
cactode | 59:8aa304768360 | 922 | __STATIC_FORCEINLINE q31_t read_q15x2_ia ( |
cactode | 59:8aa304768360 | 923 | q15_t ** pQ15) |
cactode | 59:8aa304768360 | 924 | { |
cactode | 59:8aa304768360 | 925 | q31_t val; |
cactode | 59:8aa304768360 | 926 | |
cactode | 59:8aa304768360 | 927 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 928 | memcpy (&val, *pQ15, 4); |
cactode | 59:8aa304768360 | 929 | #else |
cactode | 59:8aa304768360 | 930 | val = ((*pQ15)[1] << 16) | ((*pQ15)[0] & 0x0FFFF); |
cactode | 59:8aa304768360 | 931 | #endif |
cactode | 59:8aa304768360 | 932 | |
cactode | 59:8aa304768360 | 933 | *pQ15 += 2; |
cactode | 59:8aa304768360 | 934 | return (val); |
cactode | 59:8aa304768360 | 935 | } |
cactode | 59:8aa304768360 | 936 | |
cactode | 59:8aa304768360 | 937 | /** |
cactode | 59:8aa304768360 | 938 | @brief Read 2 Q15 from Q15 pointer and decrement pointer afterwards. |
cactode | 59:8aa304768360 | 939 | @param[in] pQ15 points to input value |
cactode | 59:8aa304768360 | 940 | @return Q31 value |
cactode | 59:8aa304768360 | 941 | */ |
cactode | 59:8aa304768360 | 942 | __STATIC_FORCEINLINE q31_t read_q15x2_da ( |
cactode | 59:8aa304768360 | 943 | q15_t ** pQ15) |
cactode | 59:8aa304768360 | 944 | { |
cactode | 59:8aa304768360 | 945 | q31_t val; |
cactode | 59:8aa304768360 | 946 | |
cactode | 59:8aa304768360 | 947 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 948 | memcpy (&val, *pQ15, 4); |
cactode | 59:8aa304768360 | 949 | #else |
cactode | 59:8aa304768360 | 950 | val = ((*pQ15)[1] << 16) | ((*pQ15)[0] & 0x0FFFF); |
cactode | 59:8aa304768360 | 951 | #endif |
cactode | 59:8aa304768360 | 952 | |
cactode | 59:8aa304768360 | 953 | *pQ15 -= 2; |
cactode | 59:8aa304768360 | 954 | return (val); |
cactode | 59:8aa304768360 | 955 | } |
cactode | 59:8aa304768360 | 956 | |
cactode | 59:8aa304768360 | 957 | /** |
cactode | 59:8aa304768360 | 958 | @brief Write 2 Q15 to Q15 pointer and increment pointer afterwards. |
cactode | 59:8aa304768360 | 959 | @param[in] pQ15 points to input value |
cactode | 59:8aa304768360 | 960 | @param[in] value Q31 value |
cactode | 59:8aa304768360 | 961 | @return none |
cactode | 59:8aa304768360 | 962 | */ |
cactode | 59:8aa304768360 | 963 | __STATIC_FORCEINLINE void write_q15x2_ia ( |
cactode | 59:8aa304768360 | 964 | q15_t ** pQ15, |
cactode | 59:8aa304768360 | 965 | q31_t value) |
cactode | 59:8aa304768360 | 966 | { |
cactode | 59:8aa304768360 | 967 | q31_t val = value; |
cactode | 59:8aa304768360 | 968 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 969 | memcpy (*pQ15, &val, 4); |
cactode | 59:8aa304768360 | 970 | #else |
cactode | 59:8aa304768360 | 971 | (*pQ15)[0] = (val & 0x0FFFF); |
cactode | 59:8aa304768360 | 972 | (*pQ15)[1] = (val >> 16) & 0x0FFFF; |
cactode | 59:8aa304768360 | 973 | #endif |
cactode | 59:8aa304768360 | 974 | |
cactode | 59:8aa304768360 | 975 | *pQ15 += 2; |
cactode | 59:8aa304768360 | 976 | } |
cactode | 59:8aa304768360 | 977 | |
cactode | 59:8aa304768360 | 978 | /** |
cactode | 59:8aa304768360 | 979 | @brief Write 2 Q15 to Q15 pointer. |
cactode | 59:8aa304768360 | 980 | @param[in] pQ15 points to input value |
cactode | 59:8aa304768360 | 981 | @param[in] value Q31 value |
cactode | 59:8aa304768360 | 982 | @return none |
cactode | 59:8aa304768360 | 983 | */ |
cactode | 59:8aa304768360 | 984 | __STATIC_FORCEINLINE void write_q15x2 ( |
cactode | 59:8aa304768360 | 985 | q15_t * pQ15, |
cactode | 59:8aa304768360 | 986 | q31_t value) |
cactode | 59:8aa304768360 | 987 | { |
cactode | 59:8aa304768360 | 988 | q31_t val = value; |
cactode | 59:8aa304768360 | 989 | |
cactode | 59:8aa304768360 | 990 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 991 | memcpy (pQ15, &val, 4); |
cactode | 59:8aa304768360 | 992 | #else |
cactode | 59:8aa304768360 | 993 | pQ15[0] = val & 0x0FFFF; |
cactode | 59:8aa304768360 | 994 | pQ15[1] = val >> 16; |
cactode | 59:8aa304768360 | 995 | #endif |
cactode | 59:8aa304768360 | 996 | } |
cactode | 59:8aa304768360 | 997 | |
cactode | 59:8aa304768360 | 998 | |
cactode | 59:8aa304768360 | 999 | /** |
cactode | 59:8aa304768360 | 1000 | @brief Read 4 Q7 from Q7 pointer and increment pointer afterwards. |
cactode | 59:8aa304768360 | 1001 | @param[in] pQ7 points to input value |
cactode | 59:8aa304768360 | 1002 | @return Q31 value |
cactode | 59:8aa304768360 | 1003 | */ |
cactode | 59:8aa304768360 | 1004 | __STATIC_FORCEINLINE q31_t read_q7x4_ia ( |
cactode | 59:8aa304768360 | 1005 | q7_t ** pQ7) |
cactode | 59:8aa304768360 | 1006 | { |
cactode | 59:8aa304768360 | 1007 | q31_t val; |
cactode | 59:8aa304768360 | 1008 | |
cactode | 59:8aa304768360 | 1009 | |
cactode | 59:8aa304768360 | 1010 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 1011 | memcpy (&val, *pQ7, 4); |
cactode | 59:8aa304768360 | 1012 | #else |
cactode | 59:8aa304768360 | 1013 | val =(((*pQ7)[3] & 0x0FF) << 24) | (((*pQ7)[2] & 0x0FF) << 16) | (((*pQ7)[1] & 0x0FF) << 8) | ((*pQ7)[0] & 0x0FF); |
cactode | 59:8aa304768360 | 1014 | #endif |
cactode | 59:8aa304768360 | 1015 | |
cactode | 59:8aa304768360 | 1016 | *pQ7 += 4; |
cactode | 59:8aa304768360 | 1017 | |
cactode | 59:8aa304768360 | 1018 | return (val); |
cactode | 59:8aa304768360 | 1019 | } |
cactode | 59:8aa304768360 | 1020 | |
cactode | 59:8aa304768360 | 1021 | /** |
cactode | 59:8aa304768360 | 1022 | @brief Read 4 Q7 from Q7 pointer and decrement pointer afterwards. |
cactode | 59:8aa304768360 | 1023 | @param[in] pQ7 points to input value |
cactode | 59:8aa304768360 | 1024 | @return Q31 value |
cactode | 59:8aa304768360 | 1025 | */ |
cactode | 59:8aa304768360 | 1026 | __STATIC_FORCEINLINE q31_t read_q7x4_da ( |
cactode | 59:8aa304768360 | 1027 | q7_t ** pQ7) |
cactode | 59:8aa304768360 | 1028 | { |
cactode | 59:8aa304768360 | 1029 | q31_t val; |
cactode | 59:8aa304768360 | 1030 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 1031 | memcpy (&val, *pQ7, 4); |
cactode | 59:8aa304768360 | 1032 | #else |
cactode | 59:8aa304768360 | 1033 | val = ((((*pQ7)[3]) & 0x0FF) << 24) | ((((*pQ7)[2]) & 0x0FF) << 16) | ((((*pQ7)[1]) & 0x0FF) << 8) | ((*pQ7)[0] & 0x0FF); |
cactode | 59:8aa304768360 | 1034 | #endif |
cactode | 59:8aa304768360 | 1035 | *pQ7 -= 4; |
cactode | 59:8aa304768360 | 1036 | |
cactode | 59:8aa304768360 | 1037 | return (val); |
cactode | 59:8aa304768360 | 1038 | } |
cactode | 59:8aa304768360 | 1039 | |
cactode | 59:8aa304768360 | 1040 | /** |
cactode | 59:8aa304768360 | 1041 | @brief Write 4 Q7 to Q7 pointer and increment pointer afterwards. |
cactode | 59:8aa304768360 | 1042 | @param[in] pQ7 points to input value |
cactode | 59:8aa304768360 | 1043 | @param[in] value Q31 value |
cactode | 59:8aa304768360 | 1044 | @return none |
cactode | 59:8aa304768360 | 1045 | */ |
cactode | 59:8aa304768360 | 1046 | __STATIC_FORCEINLINE void write_q7x4_ia ( |
cactode | 59:8aa304768360 | 1047 | q7_t ** pQ7, |
cactode | 59:8aa304768360 | 1048 | q31_t value) |
cactode | 59:8aa304768360 | 1049 | { |
cactode | 59:8aa304768360 | 1050 | q31_t val = value; |
cactode | 59:8aa304768360 | 1051 | #ifdef __ARM_FEATURE_UNALIGNED |
cactode | 59:8aa304768360 | 1052 | memcpy (*pQ7, &val, 4); |
cactode | 59:8aa304768360 | 1053 | #else |
cactode | 59:8aa304768360 | 1054 | (*pQ7)[0] = val & 0x0FF; |
cactode | 59:8aa304768360 | 1055 | (*pQ7)[1] = (val >> 8) & 0x0FF; |
cactode | 59:8aa304768360 | 1056 | (*pQ7)[2] = (val >> 16) & 0x0FF; |
cactode | 59:8aa304768360 | 1057 | (*pQ7)[3] = (val >> 24) & 0x0FF; |
cactode | 59:8aa304768360 | 1058 | |
cactode | 59:8aa304768360 | 1059 | #endif |
cactode | 59:8aa304768360 | 1060 | *pQ7 += 4; |
cactode | 59:8aa304768360 | 1061 | } |
cactode | 59:8aa304768360 | 1062 | |
cactode | 59:8aa304768360 | 1063 | /* |
cactode | 59:8aa304768360 | 1064 | |
cactode | 59:8aa304768360 | 1065 | Normally those kind of definitions are in a compiler file |
cactode | 59:8aa304768360 | 1066 | in Core or Core_A. |
cactode | 59:8aa304768360 | 1067 | |
cactode | 59:8aa304768360 | 1068 | But for MSVC compiler it is a bit special. The goal is very specific |
cactode | 59:8aa304768360 | 1069 | to CMSIS-DSP and only to allow the use of this library from other |
cactode | 59:8aa304768360 | 1070 | systems like Python or Matlab. |
cactode | 59:8aa304768360 | 1071 | |
cactode | 59:8aa304768360 | 1072 | MSVC is not going to be used to cross-compile to ARM. So, having a MSVC |
cactode | 59:8aa304768360 | 1073 | compiler file in Core or Core_A would not make sense. |
cactode | 59:8aa304768360 | 1074 | |
cactode | 59:8aa304768360 | 1075 | */ |
cactode | 59:8aa304768360 | 1076 | #if defined ( _MSC_VER ) || defined(__GNUC_PYTHON__) |
cactode | 59:8aa304768360 | 1077 | __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t data) |
cactode | 59:8aa304768360 | 1078 | { |
cactode | 59:8aa304768360 | 1079 | if (data == 0U) { return 32U; } |
cactode | 59:8aa304768360 | 1080 | |
cactode | 59:8aa304768360 | 1081 | uint32_t count = 0U; |
cactode | 59:8aa304768360 | 1082 | uint32_t mask = 0x80000000U; |
cactode | 59:8aa304768360 | 1083 | |
cactode | 59:8aa304768360 | 1084 | while ((data & mask) == 0U) |
cactode | 59:8aa304768360 | 1085 | { |
cactode | 59:8aa304768360 | 1086 | count += 1U; |
cactode | 59:8aa304768360 | 1087 | mask = mask >> 1U; |
cactode | 59:8aa304768360 | 1088 | } |
cactode | 59:8aa304768360 | 1089 | return count; |
cactode | 59:8aa304768360 | 1090 | } |
cactode | 59:8aa304768360 | 1091 | |
cactode | 59:8aa304768360 | 1092 | __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) |
cactode | 59:8aa304768360 | 1093 | { |
cactode | 59:8aa304768360 | 1094 | if ((sat >= 1U) && (sat <= 32U)) |
cactode | 59:8aa304768360 | 1095 | { |
cactode | 59:8aa304768360 | 1096 | const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); |
cactode | 59:8aa304768360 | 1097 | const int32_t min = -1 - max ; |
cactode | 59:8aa304768360 | 1098 | if (val > max) |
cactode | 59:8aa304768360 | 1099 | { |
cactode | 59:8aa304768360 | 1100 | return max; |
cactode | 59:8aa304768360 | 1101 | } |
cactode | 59:8aa304768360 | 1102 | else if (val < min) |
cactode | 59:8aa304768360 | 1103 | { |
cactode | 59:8aa304768360 | 1104 | return min; |
cactode | 59:8aa304768360 | 1105 | } |
cactode | 59:8aa304768360 | 1106 | } |
cactode | 59:8aa304768360 | 1107 | return val; |
cactode | 59:8aa304768360 | 1108 | } |
cactode | 59:8aa304768360 | 1109 | |
cactode | 59:8aa304768360 | 1110 | __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) |
cactode | 59:8aa304768360 | 1111 | { |
cactode | 59:8aa304768360 | 1112 | if (sat <= 31U) |
cactode | 59:8aa304768360 | 1113 | { |
cactode | 59:8aa304768360 | 1114 | const uint32_t max = ((1U << sat) - 1U); |
cactode | 59:8aa304768360 | 1115 | if (val > (int32_t)max) |
cactode | 59:8aa304768360 | 1116 | { |
cactode | 59:8aa304768360 | 1117 | return max; |
cactode | 59:8aa304768360 | 1118 | } |
cactode | 59:8aa304768360 | 1119 | else if (val < 0) |
cactode | 59:8aa304768360 | 1120 | { |
cactode | 59:8aa304768360 | 1121 | return 0U; |
cactode | 59:8aa304768360 | 1122 | } |
cactode | 59:8aa304768360 | 1123 | } |
cactode | 59:8aa304768360 | 1124 | return (uint32_t)val; |
cactode | 59:8aa304768360 | 1125 | } |
cactode | 59:8aa304768360 | 1126 | #endif |
cactode | 59:8aa304768360 | 1127 | |
cactode | 59:8aa304768360 | 1128 | #ifndef ARM_MATH_DSP |
cactode | 59:8aa304768360 | 1129 | /** |
cactode | 59:8aa304768360 | 1130 | * @brief definition to pack two 16 bit values. |
cactode | 59:8aa304768360 | 1131 | */ |
cactode | 59:8aa304768360 | 1132 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ |
cactode | 59:8aa304768360 | 1133 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) |
cactode | 59:8aa304768360 | 1134 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ |
cactode | 59:8aa304768360 | 1135 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) |
cactode | 59:8aa304768360 | 1136 | #endif |
cactode | 59:8aa304768360 | 1137 | |
cactode | 59:8aa304768360 | 1138 | /** |
cactode | 59:8aa304768360 | 1139 | * @brief definition to pack four 8 bit values. |
cactode | 59:8aa304768360 | 1140 | */ |
cactode | 59:8aa304768360 | 1141 | #ifndef ARM_MATH_BIG_ENDIAN |
cactode | 59:8aa304768360 | 1142 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ |
cactode | 59:8aa304768360 | 1143 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ |
cactode | 59:8aa304768360 | 1144 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ |
cactode | 59:8aa304768360 | 1145 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) |
cactode | 59:8aa304768360 | 1146 | #else |
cactode | 59:8aa304768360 | 1147 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ |
cactode | 59:8aa304768360 | 1148 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ |
cactode | 59:8aa304768360 | 1149 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ |
cactode | 59:8aa304768360 | 1150 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) |
cactode | 59:8aa304768360 | 1151 | #endif |
cactode | 59:8aa304768360 | 1152 | |
cactode | 59:8aa304768360 | 1153 | |
cactode | 59:8aa304768360 | 1154 | /** |
cactode | 59:8aa304768360 | 1155 | * @brief Clips Q63 to Q31 values. |
cactode | 59:8aa304768360 | 1156 | */ |
cactode | 59:8aa304768360 | 1157 | __STATIC_FORCEINLINE q31_t clip_q63_to_q31( |
cactode | 59:8aa304768360 | 1158 | q63_t x) |
cactode | 59:8aa304768360 | 1159 | { |
cactode | 59:8aa304768360 | 1160 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
cactode | 59:8aa304768360 | 1161 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; |
cactode | 59:8aa304768360 | 1162 | } |
cactode | 59:8aa304768360 | 1163 | |
cactode | 59:8aa304768360 | 1164 | /** |
cactode | 59:8aa304768360 | 1165 | * @brief Clips Q63 to Q15 values. |
cactode | 59:8aa304768360 | 1166 | */ |
cactode | 59:8aa304768360 | 1167 | __STATIC_FORCEINLINE q15_t clip_q63_to_q15( |
cactode | 59:8aa304768360 | 1168 | q63_t x) |
cactode | 59:8aa304768360 | 1169 | { |
cactode | 59:8aa304768360 | 1170 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
cactode | 59:8aa304768360 | 1171 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); |
cactode | 59:8aa304768360 | 1172 | } |
cactode | 59:8aa304768360 | 1173 | |
cactode | 59:8aa304768360 | 1174 | /** |
cactode | 59:8aa304768360 | 1175 | * @brief Clips Q31 to Q7 values. |
cactode | 59:8aa304768360 | 1176 | */ |
cactode | 59:8aa304768360 | 1177 | __STATIC_FORCEINLINE q7_t clip_q31_to_q7( |
cactode | 59:8aa304768360 | 1178 | q31_t x) |
cactode | 59:8aa304768360 | 1179 | { |
cactode | 59:8aa304768360 | 1180 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? |
cactode | 59:8aa304768360 | 1181 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; |
cactode | 59:8aa304768360 | 1182 | } |
cactode | 59:8aa304768360 | 1183 | |
cactode | 59:8aa304768360 | 1184 | /** |
cactode | 59:8aa304768360 | 1185 | * @brief Clips Q31 to Q15 values. |
cactode | 59:8aa304768360 | 1186 | */ |
cactode | 59:8aa304768360 | 1187 | __STATIC_FORCEINLINE q15_t clip_q31_to_q15( |
cactode | 59:8aa304768360 | 1188 | q31_t x) |
cactode | 59:8aa304768360 | 1189 | { |
cactode | 59:8aa304768360 | 1190 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? |
cactode | 59:8aa304768360 | 1191 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; |
cactode | 59:8aa304768360 | 1192 | } |
cactode | 59:8aa304768360 | 1193 | |
cactode | 59:8aa304768360 | 1194 | /** |
cactode | 59:8aa304768360 | 1195 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. |
cactode | 59:8aa304768360 | 1196 | */ |
cactode | 59:8aa304768360 | 1197 | __STATIC_FORCEINLINE q63_t mult32x64( |
cactode | 59:8aa304768360 | 1198 | q63_t x, |
cactode | 59:8aa304768360 | 1199 | q31_t y) |
cactode | 59:8aa304768360 | 1200 | { |
cactode | 59:8aa304768360 | 1201 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + |
cactode | 59:8aa304768360 | 1202 | (((q63_t) (x >> 32) * y) ) ); |
cactode | 59:8aa304768360 | 1203 | } |
cactode | 59:8aa304768360 | 1204 | |
cactode | 59:8aa304768360 | 1205 | /** |
cactode | 59:8aa304768360 | 1206 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. |
cactode | 59:8aa304768360 | 1207 | */ |
cactode | 59:8aa304768360 | 1208 | __STATIC_FORCEINLINE uint32_t arm_recip_q31( |
cactode | 59:8aa304768360 | 1209 | q31_t in, |
cactode | 59:8aa304768360 | 1210 | q31_t * dst, |
cactode | 59:8aa304768360 | 1211 | const q31_t * pRecipTable) |
cactode | 59:8aa304768360 | 1212 | { |
cactode | 59:8aa304768360 | 1213 | q31_t out; |
cactode | 59:8aa304768360 | 1214 | uint32_t tempVal; |
cactode | 59:8aa304768360 | 1215 | uint32_t index, i; |
cactode | 59:8aa304768360 | 1216 | uint32_t signBits; |
cactode | 59:8aa304768360 | 1217 | |
cactode | 59:8aa304768360 | 1218 | if (in > 0) |
cactode | 59:8aa304768360 | 1219 | { |
cactode | 59:8aa304768360 | 1220 | signBits = ((uint32_t) (__CLZ( in) - 1)); |
cactode | 59:8aa304768360 | 1221 | } |
cactode | 59:8aa304768360 | 1222 | else |
cactode | 59:8aa304768360 | 1223 | { |
cactode | 59:8aa304768360 | 1224 | signBits = ((uint32_t) (__CLZ(-in) - 1)); |
cactode | 59:8aa304768360 | 1225 | } |
cactode | 59:8aa304768360 | 1226 | |
cactode | 59:8aa304768360 | 1227 | /* Convert input sample to 1.31 format */ |
cactode | 59:8aa304768360 | 1228 | in = (in << signBits); |
cactode | 59:8aa304768360 | 1229 | |
cactode | 59:8aa304768360 | 1230 | /* calculation of index for initial approximated Val */ |
cactode | 59:8aa304768360 | 1231 | index = (uint32_t)(in >> 24); |
cactode | 59:8aa304768360 | 1232 | index = (index & INDEX_MASK); |
cactode | 59:8aa304768360 | 1233 | |
cactode | 59:8aa304768360 | 1234 | /* 1.31 with exp 1 */ |
cactode | 59:8aa304768360 | 1235 | out = pRecipTable[index]; |
cactode | 59:8aa304768360 | 1236 | |
cactode | 59:8aa304768360 | 1237 | /* calculation of reciprocal value */ |
cactode | 59:8aa304768360 | 1238 | /* running approximation for two iterations */ |
cactode | 59:8aa304768360 | 1239 | for (i = 0U; i < 2U; i++) |
cactode | 59:8aa304768360 | 1240 | { |
cactode | 59:8aa304768360 | 1241 | tempVal = (uint32_t) (((q63_t) in * out) >> 31); |
cactode | 59:8aa304768360 | 1242 | tempVal = 0x7FFFFFFFu - tempVal; |
cactode | 59:8aa304768360 | 1243 | /* 1.31 with exp 1 */ |
cactode | 59:8aa304768360 | 1244 | /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */ |
cactode | 59:8aa304768360 | 1245 | out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30); |
cactode | 59:8aa304768360 | 1246 | } |
cactode | 59:8aa304768360 | 1247 | |
cactode | 59:8aa304768360 | 1248 | /* write output */ |
cactode | 59:8aa304768360 | 1249 | *dst = out; |
cactode | 59:8aa304768360 | 1250 | |
cactode | 59:8aa304768360 | 1251 | /* return num of signbits of out = 1/in value */ |
cactode | 59:8aa304768360 | 1252 | return (signBits + 1U); |
cactode | 59:8aa304768360 | 1253 | } |
cactode | 59:8aa304768360 | 1254 | |
cactode | 59:8aa304768360 | 1255 | |
cactode | 59:8aa304768360 | 1256 | /** |
cactode | 59:8aa304768360 | 1257 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. |
cactode | 59:8aa304768360 | 1258 | */ |
cactode | 59:8aa304768360 | 1259 | __STATIC_FORCEINLINE uint32_t arm_recip_q15( |
cactode | 59:8aa304768360 | 1260 | q15_t in, |
cactode | 59:8aa304768360 | 1261 | q15_t * dst, |
cactode | 59:8aa304768360 | 1262 | const q15_t * pRecipTable) |
cactode | 59:8aa304768360 | 1263 | { |
cactode | 59:8aa304768360 | 1264 | q15_t out = 0; |
cactode | 59:8aa304768360 | 1265 | uint32_t tempVal = 0; |
cactode | 59:8aa304768360 | 1266 | uint32_t index = 0, i = 0; |
cactode | 59:8aa304768360 | 1267 | uint32_t signBits = 0; |
cactode | 59:8aa304768360 | 1268 | |
cactode | 59:8aa304768360 | 1269 | if (in > 0) |
cactode | 59:8aa304768360 | 1270 | { |
cactode | 59:8aa304768360 | 1271 | signBits = ((uint32_t)(__CLZ( in) - 17)); |
cactode | 59:8aa304768360 | 1272 | } |
cactode | 59:8aa304768360 | 1273 | else |
cactode | 59:8aa304768360 | 1274 | { |
cactode | 59:8aa304768360 | 1275 | signBits = ((uint32_t)(__CLZ(-in) - 17)); |
cactode | 59:8aa304768360 | 1276 | } |
cactode | 59:8aa304768360 | 1277 | |
cactode | 59:8aa304768360 | 1278 | /* Convert input sample to 1.15 format */ |
cactode | 59:8aa304768360 | 1279 | in = (in << signBits); |
cactode | 59:8aa304768360 | 1280 | |
cactode | 59:8aa304768360 | 1281 | /* calculation of index for initial approximated Val */ |
cactode | 59:8aa304768360 | 1282 | index = (uint32_t)(in >> 8); |
cactode | 59:8aa304768360 | 1283 | index = (index & INDEX_MASK); |
cactode | 59:8aa304768360 | 1284 | |
cactode | 59:8aa304768360 | 1285 | /* 1.15 with exp 1 */ |
cactode | 59:8aa304768360 | 1286 | out = pRecipTable[index]; |
cactode | 59:8aa304768360 | 1287 | |
cactode | 59:8aa304768360 | 1288 | /* calculation of reciprocal value */ |
cactode | 59:8aa304768360 | 1289 | /* running approximation for two iterations */ |
cactode | 59:8aa304768360 | 1290 | for (i = 0U; i < 2U; i++) |
cactode | 59:8aa304768360 | 1291 | { |
cactode | 59:8aa304768360 | 1292 | tempVal = (uint32_t) (((q31_t) in * out) >> 15); |
cactode | 59:8aa304768360 | 1293 | tempVal = 0x7FFFu - tempVal; |
cactode | 59:8aa304768360 | 1294 | /* 1.15 with exp 1 */ |
cactode | 59:8aa304768360 | 1295 | out = (q15_t) (((q31_t) out * tempVal) >> 14); |
cactode | 59:8aa304768360 | 1296 | /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */ |
cactode | 59:8aa304768360 | 1297 | } |
cactode | 59:8aa304768360 | 1298 | |
cactode | 59:8aa304768360 | 1299 | /* write output */ |
cactode | 59:8aa304768360 | 1300 | *dst = out; |
cactode | 59:8aa304768360 | 1301 | |
cactode | 59:8aa304768360 | 1302 | /* return num of signbits of out = 1/in value */ |
cactode | 59:8aa304768360 | 1303 | return (signBits + 1); |
cactode | 59:8aa304768360 | 1304 | } |
cactode | 59:8aa304768360 | 1305 | |
cactode | 59:8aa304768360 | 1306 | /** |
cactode | 59:8aa304768360 | 1307 | * @brief Integer exponentiation |
cactode | 59:8aa304768360 | 1308 | * @param[in] x value |
cactode | 59:8aa304768360 | 1309 | * @param[in] nb integer exponent >= 1 |
cactode | 59:8aa304768360 | 1310 | * @return x^nb |
cactode | 59:8aa304768360 | 1311 | * |
cactode | 59:8aa304768360 | 1312 | */ |
cactode | 59:8aa304768360 | 1313 | __STATIC_INLINE float32_t arm_exponent_f32(float32_t x, int32_t nb) |
cactode | 59:8aa304768360 | 1314 | { |
cactode | 59:8aa304768360 | 1315 | float32_t r = x; |
cactode | 59:8aa304768360 | 1316 | nb --; |
cactode | 59:8aa304768360 | 1317 | while(nb > 0) |
cactode | 59:8aa304768360 | 1318 | { |
cactode | 59:8aa304768360 | 1319 | r = r * x; |
cactode | 59:8aa304768360 | 1320 | nb--; |
cactode | 59:8aa304768360 | 1321 | } |
cactode | 59:8aa304768360 | 1322 | return(r); |
cactode | 59:8aa304768360 | 1323 | } |
cactode | 59:8aa304768360 | 1324 | |
cactode | 59:8aa304768360 | 1325 | /** |
cactode | 59:8aa304768360 | 1326 | * @brief 64-bit to 32-bit unsigned normalization |
cactode | 59:8aa304768360 | 1327 | * @param[in] in is input unsigned long long value |
cactode | 59:8aa304768360 | 1328 | * @param[out] normalized is the 32-bit normalized value |
cactode | 59:8aa304768360 | 1329 | * @param[out] norm is norm scale |
cactode | 59:8aa304768360 | 1330 | */ |
cactode | 59:8aa304768360 | 1331 | __STATIC_INLINE void arm_norm_64_to_32u(uint64_t in, int32_t * normalized, int32_t *norm) |
cactode | 59:8aa304768360 | 1332 | { |
cactode | 59:8aa304768360 | 1333 | int32_t n1; |
cactode | 59:8aa304768360 | 1334 | int32_t hi = (int32_t) (in >> 32); |
cactode | 59:8aa304768360 | 1335 | int32_t lo = (int32_t) ((in << 32) >> 32); |
cactode | 59:8aa304768360 | 1336 | |
cactode | 59:8aa304768360 | 1337 | n1 = __CLZ(hi) - 32; |
cactode | 59:8aa304768360 | 1338 | if (!n1) |
cactode | 59:8aa304768360 | 1339 | { |
cactode | 59:8aa304768360 | 1340 | /* |
cactode | 59:8aa304768360 | 1341 | * input fits in 32-bit |
cactode | 59:8aa304768360 | 1342 | */ |
cactode | 59:8aa304768360 | 1343 | n1 = __CLZ(lo); |
cactode | 59:8aa304768360 | 1344 | if (!n1) |
cactode | 59:8aa304768360 | 1345 | { |
cactode | 59:8aa304768360 | 1346 | /* |
cactode | 59:8aa304768360 | 1347 | * MSB set, need to scale down by 1 |
cactode | 59:8aa304768360 | 1348 | */ |
cactode | 59:8aa304768360 | 1349 | *norm = -1; |
cactode | 59:8aa304768360 | 1350 | *normalized = (((uint32_t) lo) >> 1); |
cactode | 59:8aa304768360 | 1351 | } else |
cactode | 59:8aa304768360 | 1352 | { |
cactode | 59:8aa304768360 | 1353 | if (n1 == 32) |
cactode | 59:8aa304768360 | 1354 | { |
cactode | 59:8aa304768360 | 1355 | /* |
cactode | 59:8aa304768360 | 1356 | * input is zero |
cactode | 59:8aa304768360 | 1357 | */ |
cactode | 59:8aa304768360 | 1358 | *norm = 0; |
cactode | 59:8aa304768360 | 1359 | *normalized = 0; |
cactode | 59:8aa304768360 | 1360 | } else |
cactode | 59:8aa304768360 | 1361 | { |
cactode | 59:8aa304768360 | 1362 | /* |
cactode | 59:8aa304768360 | 1363 | * 32-bit normalization |
cactode | 59:8aa304768360 | 1364 | */ |
cactode | 59:8aa304768360 | 1365 | *norm = n1 - 1; |
cactode | 59:8aa304768360 | 1366 | *normalized = lo << *norm; |
cactode | 59:8aa304768360 | 1367 | } |
cactode | 59:8aa304768360 | 1368 | } |
cactode | 59:8aa304768360 | 1369 | } else |
cactode | 59:8aa304768360 | 1370 | { |
cactode | 59:8aa304768360 | 1371 | /* |
cactode | 59:8aa304768360 | 1372 | * input fits in 64-bit |
cactode | 59:8aa304768360 | 1373 | */ |
cactode | 59:8aa304768360 | 1374 | n1 = 1 - n1; |
cactode | 59:8aa304768360 | 1375 | *norm = -n1; |
cactode | 59:8aa304768360 | 1376 | /* |
cactode | 59:8aa304768360 | 1377 | * 64 bit normalization |
cactode | 59:8aa304768360 | 1378 | */ |
cactode | 59:8aa304768360 | 1379 | *normalized = (((uint32_t) lo) >> n1) | (hi << (32 - n1)); |
cactode | 59:8aa304768360 | 1380 | } |
cactode | 59:8aa304768360 | 1381 | } |
cactode | 59:8aa304768360 | 1382 | |
cactode | 59:8aa304768360 | 1383 | __STATIC_INLINE q31_t arm_div_q63_to_q31(q63_t num, q31_t den) |
cactode | 59:8aa304768360 | 1384 | { |
cactode | 59:8aa304768360 | 1385 | q31_t result; |
cactode | 59:8aa304768360 | 1386 | uint64_t absNum; |
cactode | 59:8aa304768360 | 1387 | int32_t normalized; |
cactode | 59:8aa304768360 | 1388 | int32_t norm; |
cactode | 59:8aa304768360 | 1389 | |
cactode | 59:8aa304768360 | 1390 | /* |
cactode | 59:8aa304768360 | 1391 | * if sum fits in 32bits |
cactode | 59:8aa304768360 | 1392 | * avoid costly 64-bit division |
cactode | 59:8aa304768360 | 1393 | */ |
cactode | 59:8aa304768360 | 1394 | absNum = num > 0 ? num : -num; |
cactode | 59:8aa304768360 | 1395 | arm_norm_64_to_32u(absNum, &normalized, &norm); |
cactode | 59:8aa304768360 | 1396 | if (norm > 0) |
cactode | 59:8aa304768360 | 1397 | /* |
cactode | 59:8aa304768360 | 1398 | * 32-bit division |
cactode | 59:8aa304768360 | 1399 | */ |
cactode | 59:8aa304768360 | 1400 | result = (q31_t) num / den; |
cactode | 59:8aa304768360 | 1401 | else |
cactode | 59:8aa304768360 | 1402 | /* |
cactode | 59:8aa304768360 | 1403 | * 64-bit division |
cactode | 59:8aa304768360 | 1404 | */ |
cactode | 59:8aa304768360 | 1405 | result = (q31_t) (num / den); |
cactode | 59:8aa304768360 | 1406 | |
cactode | 59:8aa304768360 | 1407 | return result; |
cactode | 59:8aa304768360 | 1408 | } |
cactode | 59:8aa304768360 | 1409 | |
cactode | 59:8aa304768360 | 1410 | |
cactode | 59:8aa304768360 | 1411 | /* |
cactode | 59:8aa304768360 | 1412 | * @brief C custom defined intrinsic functions |
cactode | 59:8aa304768360 | 1413 | */ |
cactode | 59:8aa304768360 | 1414 | #if !defined (ARM_MATH_DSP) |
cactode | 59:8aa304768360 | 1415 | |
cactode | 59:8aa304768360 | 1416 | /* |
cactode | 59:8aa304768360 | 1417 | * @brief C custom defined QADD8 |
cactode | 59:8aa304768360 | 1418 | */ |
cactode | 59:8aa304768360 | 1419 | __STATIC_FORCEINLINE uint32_t __QADD8( |
cactode | 59:8aa304768360 | 1420 | uint32_t x, |
cactode | 59:8aa304768360 | 1421 | uint32_t y) |
cactode | 59:8aa304768360 | 1422 | { |
cactode | 59:8aa304768360 | 1423 | q31_t r, s, t, u; |
cactode | 59:8aa304768360 | 1424 | |
cactode | 59:8aa304768360 | 1425 | r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1426 | s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1427 | t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1428 | u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1429 | |
cactode | 59:8aa304768360 | 1430 | return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); |
cactode | 59:8aa304768360 | 1431 | } |
cactode | 59:8aa304768360 | 1432 | |
cactode | 59:8aa304768360 | 1433 | |
cactode | 59:8aa304768360 | 1434 | /* |
cactode | 59:8aa304768360 | 1435 | * @brief C custom defined QSUB8 |
cactode | 59:8aa304768360 | 1436 | */ |
cactode | 59:8aa304768360 | 1437 | __STATIC_FORCEINLINE uint32_t __QSUB8( |
cactode | 59:8aa304768360 | 1438 | uint32_t x, |
cactode | 59:8aa304768360 | 1439 | uint32_t y) |
cactode | 59:8aa304768360 | 1440 | { |
cactode | 59:8aa304768360 | 1441 | q31_t r, s, t, u; |
cactode | 59:8aa304768360 | 1442 | |
cactode | 59:8aa304768360 | 1443 | r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1444 | s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1445 | t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1446 | u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; |
cactode | 59:8aa304768360 | 1447 | |
cactode | 59:8aa304768360 | 1448 | return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); |
cactode | 59:8aa304768360 | 1449 | } |
cactode | 59:8aa304768360 | 1450 | |
cactode | 59:8aa304768360 | 1451 | |
cactode | 59:8aa304768360 | 1452 | /* |
cactode | 59:8aa304768360 | 1453 | * @brief C custom defined QADD16 |
cactode | 59:8aa304768360 | 1454 | */ |
cactode | 59:8aa304768360 | 1455 | __STATIC_FORCEINLINE uint32_t __QADD16( |
cactode | 59:8aa304768360 | 1456 | uint32_t x, |
cactode | 59:8aa304768360 | 1457 | uint32_t y) |
cactode | 59:8aa304768360 | 1458 | { |
cactode | 59:8aa304768360 | 1459 | /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */ |
cactode | 59:8aa304768360 | 1460 | q31_t r = 0, s = 0; |
cactode | 59:8aa304768360 | 1461 | |
cactode | 59:8aa304768360 | 1462 | r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1463 | s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1464 | |
cactode | 59:8aa304768360 | 1465 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1466 | } |
cactode | 59:8aa304768360 | 1467 | |
cactode | 59:8aa304768360 | 1468 | |
cactode | 59:8aa304768360 | 1469 | /* |
cactode | 59:8aa304768360 | 1470 | * @brief C custom defined SHADD16 |
cactode | 59:8aa304768360 | 1471 | */ |
cactode | 59:8aa304768360 | 1472 | __STATIC_FORCEINLINE uint32_t __SHADD16( |
cactode | 59:8aa304768360 | 1473 | uint32_t x, |
cactode | 59:8aa304768360 | 1474 | uint32_t y) |
cactode | 59:8aa304768360 | 1475 | { |
cactode | 59:8aa304768360 | 1476 | q31_t r, s; |
cactode | 59:8aa304768360 | 1477 | |
cactode | 59:8aa304768360 | 1478 | r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1479 | s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1480 | |
cactode | 59:8aa304768360 | 1481 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1482 | } |
cactode | 59:8aa304768360 | 1483 | |
cactode | 59:8aa304768360 | 1484 | |
cactode | 59:8aa304768360 | 1485 | /* |
cactode | 59:8aa304768360 | 1486 | * @brief C custom defined QSUB16 |
cactode | 59:8aa304768360 | 1487 | */ |
cactode | 59:8aa304768360 | 1488 | __STATIC_FORCEINLINE uint32_t __QSUB16( |
cactode | 59:8aa304768360 | 1489 | uint32_t x, |
cactode | 59:8aa304768360 | 1490 | uint32_t y) |
cactode | 59:8aa304768360 | 1491 | { |
cactode | 59:8aa304768360 | 1492 | q31_t r, s; |
cactode | 59:8aa304768360 | 1493 | |
cactode | 59:8aa304768360 | 1494 | r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1495 | s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1496 | |
cactode | 59:8aa304768360 | 1497 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1498 | } |
cactode | 59:8aa304768360 | 1499 | |
cactode | 59:8aa304768360 | 1500 | |
cactode | 59:8aa304768360 | 1501 | /* |
cactode | 59:8aa304768360 | 1502 | * @brief C custom defined SHSUB16 |
cactode | 59:8aa304768360 | 1503 | */ |
cactode | 59:8aa304768360 | 1504 | __STATIC_FORCEINLINE uint32_t __SHSUB16( |
cactode | 59:8aa304768360 | 1505 | uint32_t x, |
cactode | 59:8aa304768360 | 1506 | uint32_t y) |
cactode | 59:8aa304768360 | 1507 | { |
cactode | 59:8aa304768360 | 1508 | q31_t r, s; |
cactode | 59:8aa304768360 | 1509 | |
cactode | 59:8aa304768360 | 1510 | r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1511 | s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1512 | |
cactode | 59:8aa304768360 | 1513 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1514 | } |
cactode | 59:8aa304768360 | 1515 | |
cactode | 59:8aa304768360 | 1516 | |
cactode | 59:8aa304768360 | 1517 | /* |
cactode | 59:8aa304768360 | 1518 | * @brief C custom defined QASX |
cactode | 59:8aa304768360 | 1519 | */ |
cactode | 59:8aa304768360 | 1520 | __STATIC_FORCEINLINE uint32_t __QASX( |
cactode | 59:8aa304768360 | 1521 | uint32_t x, |
cactode | 59:8aa304768360 | 1522 | uint32_t y) |
cactode | 59:8aa304768360 | 1523 | { |
cactode | 59:8aa304768360 | 1524 | q31_t r, s; |
cactode | 59:8aa304768360 | 1525 | |
cactode | 59:8aa304768360 | 1526 | r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1527 | s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1528 | |
cactode | 59:8aa304768360 | 1529 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1530 | } |
cactode | 59:8aa304768360 | 1531 | |
cactode | 59:8aa304768360 | 1532 | |
cactode | 59:8aa304768360 | 1533 | /* |
cactode | 59:8aa304768360 | 1534 | * @brief C custom defined SHASX |
cactode | 59:8aa304768360 | 1535 | */ |
cactode | 59:8aa304768360 | 1536 | __STATIC_FORCEINLINE uint32_t __SHASX( |
cactode | 59:8aa304768360 | 1537 | uint32_t x, |
cactode | 59:8aa304768360 | 1538 | uint32_t y) |
cactode | 59:8aa304768360 | 1539 | { |
cactode | 59:8aa304768360 | 1540 | q31_t r, s; |
cactode | 59:8aa304768360 | 1541 | |
cactode | 59:8aa304768360 | 1542 | r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1543 | s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1544 | |
cactode | 59:8aa304768360 | 1545 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1546 | } |
cactode | 59:8aa304768360 | 1547 | |
cactode | 59:8aa304768360 | 1548 | |
cactode | 59:8aa304768360 | 1549 | /* |
cactode | 59:8aa304768360 | 1550 | * @brief C custom defined QSAX |
cactode | 59:8aa304768360 | 1551 | */ |
cactode | 59:8aa304768360 | 1552 | __STATIC_FORCEINLINE uint32_t __QSAX( |
cactode | 59:8aa304768360 | 1553 | uint32_t x, |
cactode | 59:8aa304768360 | 1554 | uint32_t y) |
cactode | 59:8aa304768360 | 1555 | { |
cactode | 59:8aa304768360 | 1556 | q31_t r, s; |
cactode | 59:8aa304768360 | 1557 | |
cactode | 59:8aa304768360 | 1558 | r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1559 | s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1560 | |
cactode | 59:8aa304768360 | 1561 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1562 | } |
cactode | 59:8aa304768360 | 1563 | |
cactode | 59:8aa304768360 | 1564 | |
cactode | 59:8aa304768360 | 1565 | /* |
cactode | 59:8aa304768360 | 1566 | * @brief C custom defined SHSAX |
cactode | 59:8aa304768360 | 1567 | */ |
cactode | 59:8aa304768360 | 1568 | __STATIC_FORCEINLINE uint32_t __SHSAX( |
cactode | 59:8aa304768360 | 1569 | uint32_t x, |
cactode | 59:8aa304768360 | 1570 | uint32_t y) |
cactode | 59:8aa304768360 | 1571 | { |
cactode | 59:8aa304768360 | 1572 | q31_t r, s; |
cactode | 59:8aa304768360 | 1573 | |
cactode | 59:8aa304768360 | 1574 | r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1575 | s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; |
cactode | 59:8aa304768360 | 1576 | |
cactode | 59:8aa304768360 | 1577 | return ((uint32_t)((s << 16) | (r ))); |
cactode | 59:8aa304768360 | 1578 | } |
cactode | 59:8aa304768360 | 1579 | |
cactode | 59:8aa304768360 | 1580 | |
cactode | 59:8aa304768360 | 1581 | /* |
cactode | 59:8aa304768360 | 1582 | * @brief C custom defined SMUSDX |
cactode | 59:8aa304768360 | 1583 | */ |
cactode | 59:8aa304768360 | 1584 | __STATIC_FORCEINLINE uint32_t __SMUSDX( |
cactode | 59:8aa304768360 | 1585 | uint32_t x, |
cactode | 59:8aa304768360 | 1586 | uint32_t y) |
cactode | 59:8aa304768360 | 1587 | { |
cactode | 59:8aa304768360 | 1588 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - |
cactode | 59:8aa304768360 | 1589 | ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); |
cactode | 59:8aa304768360 | 1590 | } |
cactode | 59:8aa304768360 | 1591 | |
cactode | 59:8aa304768360 | 1592 | /* |
cactode | 59:8aa304768360 | 1593 | * @brief C custom defined SMUADX |
cactode | 59:8aa304768360 | 1594 | */ |
cactode | 59:8aa304768360 | 1595 | __STATIC_FORCEINLINE uint32_t __SMUADX( |
cactode | 59:8aa304768360 | 1596 | uint32_t x, |
cactode | 59:8aa304768360 | 1597 | uint32_t y) |
cactode | 59:8aa304768360 | 1598 | { |
cactode | 59:8aa304768360 | 1599 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + |
cactode | 59:8aa304768360 | 1600 | ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); |
cactode | 59:8aa304768360 | 1601 | } |
cactode | 59:8aa304768360 | 1602 | |
cactode | 59:8aa304768360 | 1603 | |
cactode | 59:8aa304768360 | 1604 | /* |
cactode | 59:8aa304768360 | 1605 | * @brief C custom defined QADD |
cactode | 59:8aa304768360 | 1606 | */ |
cactode | 59:8aa304768360 | 1607 | __STATIC_FORCEINLINE int32_t __QADD( |
cactode | 59:8aa304768360 | 1608 | int32_t x, |
cactode | 59:8aa304768360 | 1609 | int32_t y) |
cactode | 59:8aa304768360 | 1610 | { |
cactode | 59:8aa304768360 | 1611 | return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y))); |
cactode | 59:8aa304768360 | 1612 | } |
cactode | 59:8aa304768360 | 1613 | |
cactode | 59:8aa304768360 | 1614 | |
cactode | 59:8aa304768360 | 1615 | /* |
cactode | 59:8aa304768360 | 1616 | * @brief C custom defined QSUB |
cactode | 59:8aa304768360 | 1617 | */ |
cactode | 59:8aa304768360 | 1618 | __STATIC_FORCEINLINE int32_t __QSUB( |
cactode | 59:8aa304768360 | 1619 | int32_t x, |
cactode | 59:8aa304768360 | 1620 | int32_t y) |
cactode | 59:8aa304768360 | 1621 | { |
cactode | 59:8aa304768360 | 1622 | return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y))); |
cactode | 59:8aa304768360 | 1623 | } |
cactode | 59:8aa304768360 | 1624 | |
cactode | 59:8aa304768360 | 1625 | |
cactode | 59:8aa304768360 | 1626 | /* |
cactode | 59:8aa304768360 | 1627 | * @brief C custom defined SMLAD |
cactode | 59:8aa304768360 | 1628 | */ |
cactode | 59:8aa304768360 | 1629 | __STATIC_FORCEINLINE uint32_t __SMLAD( |
cactode | 59:8aa304768360 | 1630 | uint32_t x, |
cactode | 59:8aa304768360 | 1631 | uint32_t y, |
cactode | 59:8aa304768360 | 1632 | uint32_t sum) |
cactode | 59:8aa304768360 | 1633 | { |
cactode | 59:8aa304768360 | 1634 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + |
cactode | 59:8aa304768360 | 1635 | ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + |
cactode | 59:8aa304768360 | 1636 | ( ((q31_t)sum ) ) )); |
cactode | 59:8aa304768360 | 1637 | } |
cactode | 59:8aa304768360 | 1638 | |
cactode | 59:8aa304768360 | 1639 | |
cactode | 59:8aa304768360 | 1640 | /* |
cactode | 59:8aa304768360 | 1641 | * @brief C custom defined SMLADX |
cactode | 59:8aa304768360 | 1642 | */ |
cactode | 59:8aa304768360 | 1643 | __STATIC_FORCEINLINE uint32_t __SMLADX( |
cactode | 59:8aa304768360 | 1644 | uint32_t x, |
cactode | 59:8aa304768360 | 1645 | uint32_t y, |
cactode | 59:8aa304768360 | 1646 | uint32_t sum) |
cactode | 59:8aa304768360 | 1647 | { |
cactode | 59:8aa304768360 | 1648 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + |
cactode | 59:8aa304768360 | 1649 | ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + |
cactode | 59:8aa304768360 | 1650 | ( ((q31_t)sum ) ) )); |
cactode | 59:8aa304768360 | 1651 | } |
cactode | 59:8aa304768360 | 1652 | |
cactode | 59:8aa304768360 | 1653 | |
cactode | 59:8aa304768360 | 1654 | /* |
cactode | 59:8aa304768360 | 1655 | * @brief C custom defined SMLSDX |
cactode | 59:8aa304768360 | 1656 | */ |
cactode | 59:8aa304768360 | 1657 | __STATIC_FORCEINLINE uint32_t __SMLSDX( |
cactode | 59:8aa304768360 | 1658 | uint32_t x, |
cactode | 59:8aa304768360 | 1659 | uint32_t y, |
cactode | 59:8aa304768360 | 1660 | uint32_t sum) |
cactode | 59:8aa304768360 | 1661 | { |
cactode | 59:8aa304768360 | 1662 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - |
cactode | 59:8aa304768360 | 1663 | ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + |
cactode | 59:8aa304768360 | 1664 | ( ((q31_t)sum ) ) )); |
cactode | 59:8aa304768360 | 1665 | } |
cactode | 59:8aa304768360 | 1666 | |
cactode | 59:8aa304768360 | 1667 | |
cactode | 59:8aa304768360 | 1668 | /* |
cactode | 59:8aa304768360 | 1669 | * @brief C custom defined SMLALD |
cactode | 59:8aa304768360 | 1670 | */ |
cactode | 59:8aa304768360 | 1671 | __STATIC_FORCEINLINE uint64_t __SMLALD( |
cactode | 59:8aa304768360 | 1672 | uint32_t x, |
cactode | 59:8aa304768360 | 1673 | uint32_t y, |
cactode | 59:8aa304768360 | 1674 | uint64_t sum) |
cactode | 59:8aa304768360 | 1675 | { |
cactode | 59:8aa304768360 | 1676 | /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */ |
cactode | 59:8aa304768360 | 1677 | return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + |
cactode | 59:8aa304768360 | 1678 | ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + |
cactode | 59:8aa304768360 | 1679 | ( ((q63_t)sum ) ) )); |
cactode | 59:8aa304768360 | 1680 | } |
cactode | 59:8aa304768360 | 1681 | |
cactode | 59:8aa304768360 | 1682 | |
cactode | 59:8aa304768360 | 1683 | /* |
cactode | 59:8aa304768360 | 1684 | * @brief C custom defined SMLALDX |
cactode | 59:8aa304768360 | 1685 | */ |
cactode | 59:8aa304768360 | 1686 | __STATIC_FORCEINLINE uint64_t __SMLALDX( |
cactode | 59:8aa304768360 | 1687 | uint32_t x, |
cactode | 59:8aa304768360 | 1688 | uint32_t y, |
cactode | 59:8aa304768360 | 1689 | uint64_t sum) |
cactode | 59:8aa304768360 | 1690 | { |
cactode | 59:8aa304768360 | 1691 | /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */ |
cactode | 59:8aa304768360 | 1692 | return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + |
cactode | 59:8aa304768360 | 1693 | ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + |
cactode | 59:8aa304768360 | 1694 | ( ((q63_t)sum ) ) )); |
cactode | 59:8aa304768360 | 1695 | } |
cactode | 59:8aa304768360 | 1696 | |
cactode | 59:8aa304768360 | 1697 | |
cactode | 59:8aa304768360 | 1698 | /* |
cactode | 59:8aa304768360 | 1699 | * @brief C custom defined SMUAD |
cactode | 59:8aa304768360 | 1700 | */ |
cactode | 59:8aa304768360 | 1701 | __STATIC_FORCEINLINE uint32_t __SMUAD( |
cactode | 59:8aa304768360 | 1702 | uint32_t x, |
cactode | 59:8aa304768360 | 1703 | uint32_t y) |
cactode | 59:8aa304768360 | 1704 | { |
cactode | 59:8aa304768360 | 1705 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + |
cactode | 59:8aa304768360 | 1706 | ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); |
cactode | 59:8aa304768360 | 1707 | } |
cactode | 59:8aa304768360 | 1708 | |
cactode | 59:8aa304768360 | 1709 | |
cactode | 59:8aa304768360 | 1710 | /* |
cactode | 59:8aa304768360 | 1711 | * @brief C custom defined SMUSD |
cactode | 59:8aa304768360 | 1712 | */ |
cactode | 59:8aa304768360 | 1713 | __STATIC_FORCEINLINE uint32_t __SMUSD( |
cactode | 59:8aa304768360 | 1714 | uint32_t x, |
cactode | 59:8aa304768360 | 1715 | uint32_t y) |
cactode | 59:8aa304768360 | 1716 | { |
cactode | 59:8aa304768360 | 1717 | return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) - |
cactode | 59:8aa304768360 | 1718 | ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); |
cactode | 59:8aa304768360 | 1719 | } |
cactode | 59:8aa304768360 | 1720 | |
cactode | 59:8aa304768360 | 1721 | |
cactode | 59:8aa304768360 | 1722 | /* |
cactode | 59:8aa304768360 | 1723 | * @brief C custom defined SXTB16 |
cactode | 59:8aa304768360 | 1724 | */ |
cactode | 59:8aa304768360 | 1725 | __STATIC_FORCEINLINE uint32_t __SXTB16( |
cactode | 59:8aa304768360 | 1726 | uint32_t x) |
cactode | 59:8aa304768360 | 1727 | { |
cactode | 59:8aa304768360 | 1728 | return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) | |
cactode | 59:8aa304768360 | 1729 | ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) )); |
cactode | 59:8aa304768360 | 1730 | } |
cactode | 59:8aa304768360 | 1731 | |
cactode | 59:8aa304768360 | 1732 | /* |
cactode | 59:8aa304768360 | 1733 | * @brief C custom defined SMMLA |
cactode | 59:8aa304768360 | 1734 | */ |
cactode | 59:8aa304768360 | 1735 | __STATIC_FORCEINLINE int32_t __SMMLA( |
cactode | 59:8aa304768360 | 1736 | int32_t x, |
cactode | 59:8aa304768360 | 1737 | int32_t y, |
cactode | 59:8aa304768360 | 1738 | int32_t sum) |
cactode | 59:8aa304768360 | 1739 | { |
cactode | 59:8aa304768360 | 1740 | return (sum + (int32_t) (((int64_t) x * y) >> 32)); |
cactode | 59:8aa304768360 | 1741 | } |
cactode | 59:8aa304768360 | 1742 | |
cactode | 59:8aa304768360 | 1743 | #endif /* !defined (ARM_MATH_DSP) */ |
cactode | 59:8aa304768360 | 1744 | |
cactode | 59:8aa304768360 | 1745 | |
cactode | 59:8aa304768360 | 1746 | /** |
cactode | 59:8aa304768360 | 1747 | * @brief Instance structure for the Q7 FIR filter. |
cactode | 59:8aa304768360 | 1748 | */ |
cactode | 59:8aa304768360 | 1749 | typedef struct |
cactode | 59:8aa304768360 | 1750 | { |
cactode | 59:8aa304768360 | 1751 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
cactode | 59:8aa304768360 | 1752 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 1753 | const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 1754 | } arm_fir_instance_q7; |
cactode | 59:8aa304768360 | 1755 | |
cactode | 59:8aa304768360 | 1756 | /** |
cactode | 59:8aa304768360 | 1757 | * @brief Instance structure for the Q15 FIR filter. |
cactode | 59:8aa304768360 | 1758 | */ |
cactode | 59:8aa304768360 | 1759 | typedef struct |
cactode | 59:8aa304768360 | 1760 | { |
cactode | 59:8aa304768360 | 1761 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
cactode | 59:8aa304768360 | 1762 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 1763 | const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 1764 | } arm_fir_instance_q15; |
cactode | 59:8aa304768360 | 1765 | |
cactode | 59:8aa304768360 | 1766 | /** |
cactode | 59:8aa304768360 | 1767 | * @brief Instance structure for the Q31 FIR filter. |
cactode | 59:8aa304768360 | 1768 | */ |
cactode | 59:8aa304768360 | 1769 | typedef struct |
cactode | 59:8aa304768360 | 1770 | { |
cactode | 59:8aa304768360 | 1771 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
cactode | 59:8aa304768360 | 1772 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 1773 | const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 1774 | } arm_fir_instance_q31; |
cactode | 59:8aa304768360 | 1775 | |
cactode | 59:8aa304768360 | 1776 | /** |
cactode | 59:8aa304768360 | 1777 | * @brief Instance structure for the floating-point FIR filter. |
cactode | 59:8aa304768360 | 1778 | */ |
cactode | 59:8aa304768360 | 1779 | typedef struct |
cactode | 59:8aa304768360 | 1780 | { |
cactode | 59:8aa304768360 | 1781 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
cactode | 59:8aa304768360 | 1782 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 1783 | const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 1784 | } arm_fir_instance_f32; |
cactode | 59:8aa304768360 | 1785 | |
cactode | 59:8aa304768360 | 1786 | /** |
cactode | 59:8aa304768360 | 1787 | * @brief Processing function for the Q7 FIR filter. |
cactode | 59:8aa304768360 | 1788 | * @param[in] S points to an instance of the Q7 FIR filter structure. |
cactode | 59:8aa304768360 | 1789 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1790 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1791 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1792 | */ |
cactode | 59:8aa304768360 | 1793 | void arm_fir_q7( |
cactode | 59:8aa304768360 | 1794 | const arm_fir_instance_q7 * S, |
cactode | 59:8aa304768360 | 1795 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 1796 | q7_t * pDst, |
cactode | 59:8aa304768360 | 1797 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1798 | |
cactode | 59:8aa304768360 | 1799 | /** |
cactode | 59:8aa304768360 | 1800 | * @brief Initialization function for the Q7 FIR filter. |
cactode | 59:8aa304768360 | 1801 | * @param[in,out] S points to an instance of the Q7 FIR structure. |
cactode | 59:8aa304768360 | 1802 | * @param[in] numTaps Number of filter coefficients in the filter. |
cactode | 59:8aa304768360 | 1803 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 1804 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 1805 | * @param[in] blockSize number of samples that are processed. |
cactode | 59:8aa304768360 | 1806 | */ |
cactode | 59:8aa304768360 | 1807 | void arm_fir_init_q7( |
cactode | 59:8aa304768360 | 1808 | arm_fir_instance_q7 * S, |
cactode | 59:8aa304768360 | 1809 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 1810 | const q7_t * pCoeffs, |
cactode | 59:8aa304768360 | 1811 | q7_t * pState, |
cactode | 59:8aa304768360 | 1812 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1813 | |
cactode | 59:8aa304768360 | 1814 | /** |
cactode | 59:8aa304768360 | 1815 | * @brief Processing function for the Q15 FIR filter. |
cactode | 59:8aa304768360 | 1816 | * @param[in] S points to an instance of the Q15 FIR structure. |
cactode | 59:8aa304768360 | 1817 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1818 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1819 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1820 | */ |
cactode | 59:8aa304768360 | 1821 | void arm_fir_q15( |
cactode | 59:8aa304768360 | 1822 | const arm_fir_instance_q15 * S, |
cactode | 59:8aa304768360 | 1823 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 1824 | q15_t * pDst, |
cactode | 59:8aa304768360 | 1825 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1826 | |
cactode | 59:8aa304768360 | 1827 | /** |
cactode | 59:8aa304768360 | 1828 | * @brief Processing function for the fast Q15 FIR filter (fast version). |
cactode | 59:8aa304768360 | 1829 | * @param[in] S points to an instance of the Q15 FIR filter structure. |
cactode | 59:8aa304768360 | 1830 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1831 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1832 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1833 | */ |
cactode | 59:8aa304768360 | 1834 | void arm_fir_fast_q15( |
cactode | 59:8aa304768360 | 1835 | const arm_fir_instance_q15 * S, |
cactode | 59:8aa304768360 | 1836 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 1837 | q15_t * pDst, |
cactode | 59:8aa304768360 | 1838 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1839 | |
cactode | 59:8aa304768360 | 1840 | /** |
cactode | 59:8aa304768360 | 1841 | * @brief Initialization function for the Q15 FIR filter. |
cactode | 59:8aa304768360 | 1842 | * @param[in,out] S points to an instance of the Q15 FIR filter structure. |
cactode | 59:8aa304768360 | 1843 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. |
cactode | 59:8aa304768360 | 1844 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 1845 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 1846 | * @param[in] blockSize number of samples that are processed at a time. |
cactode | 59:8aa304768360 | 1847 | * @return The function returns either |
cactode | 59:8aa304768360 | 1848 | * <code>ARM_MATH_SUCCESS</code> if initialization was successful or |
cactode | 59:8aa304768360 | 1849 | * <code>ARM_MATH_ARGUMENT_ERROR</code> if <code>numTaps</code> is not a supported value. |
cactode | 59:8aa304768360 | 1850 | */ |
cactode | 59:8aa304768360 | 1851 | arm_status arm_fir_init_q15( |
cactode | 59:8aa304768360 | 1852 | arm_fir_instance_q15 * S, |
cactode | 59:8aa304768360 | 1853 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 1854 | const q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 1855 | q15_t * pState, |
cactode | 59:8aa304768360 | 1856 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1857 | |
cactode | 59:8aa304768360 | 1858 | /** |
cactode | 59:8aa304768360 | 1859 | * @brief Processing function for the Q31 FIR filter. |
cactode | 59:8aa304768360 | 1860 | * @param[in] S points to an instance of the Q31 FIR filter structure. |
cactode | 59:8aa304768360 | 1861 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1862 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1863 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1864 | */ |
cactode | 59:8aa304768360 | 1865 | void arm_fir_q31( |
cactode | 59:8aa304768360 | 1866 | const arm_fir_instance_q31 * S, |
cactode | 59:8aa304768360 | 1867 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 1868 | q31_t * pDst, |
cactode | 59:8aa304768360 | 1869 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1870 | |
cactode | 59:8aa304768360 | 1871 | /** |
cactode | 59:8aa304768360 | 1872 | * @brief Processing function for the fast Q31 FIR filter (fast version). |
cactode | 59:8aa304768360 | 1873 | * @param[in] S points to an instance of the Q31 FIR filter structure. |
cactode | 59:8aa304768360 | 1874 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1875 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1876 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1877 | */ |
cactode | 59:8aa304768360 | 1878 | void arm_fir_fast_q31( |
cactode | 59:8aa304768360 | 1879 | const arm_fir_instance_q31 * S, |
cactode | 59:8aa304768360 | 1880 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 1881 | q31_t * pDst, |
cactode | 59:8aa304768360 | 1882 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1883 | |
cactode | 59:8aa304768360 | 1884 | /** |
cactode | 59:8aa304768360 | 1885 | * @brief Initialization function for the Q31 FIR filter. |
cactode | 59:8aa304768360 | 1886 | * @param[in,out] S points to an instance of the Q31 FIR structure. |
cactode | 59:8aa304768360 | 1887 | * @param[in] numTaps Number of filter coefficients in the filter. |
cactode | 59:8aa304768360 | 1888 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 1889 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 1890 | * @param[in] blockSize number of samples that are processed at a time. |
cactode | 59:8aa304768360 | 1891 | */ |
cactode | 59:8aa304768360 | 1892 | void arm_fir_init_q31( |
cactode | 59:8aa304768360 | 1893 | arm_fir_instance_q31 * S, |
cactode | 59:8aa304768360 | 1894 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 1895 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 1896 | q31_t * pState, |
cactode | 59:8aa304768360 | 1897 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1898 | |
cactode | 59:8aa304768360 | 1899 | /** |
cactode | 59:8aa304768360 | 1900 | * @brief Processing function for the floating-point FIR filter. |
cactode | 59:8aa304768360 | 1901 | * @param[in] S points to an instance of the floating-point FIR structure. |
cactode | 59:8aa304768360 | 1902 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1903 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1904 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1905 | */ |
cactode | 59:8aa304768360 | 1906 | void arm_fir_f32( |
cactode | 59:8aa304768360 | 1907 | const arm_fir_instance_f32 * S, |
cactode | 59:8aa304768360 | 1908 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 1909 | float32_t * pDst, |
cactode | 59:8aa304768360 | 1910 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1911 | |
cactode | 59:8aa304768360 | 1912 | /** |
cactode | 59:8aa304768360 | 1913 | * @brief Initialization function for the floating-point FIR filter. |
cactode | 59:8aa304768360 | 1914 | * @param[in,out] S points to an instance of the floating-point FIR filter structure. |
cactode | 59:8aa304768360 | 1915 | * @param[in] numTaps Number of filter coefficients in the filter. |
cactode | 59:8aa304768360 | 1916 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 1917 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 1918 | * @param[in] blockSize number of samples that are processed at a time. |
cactode | 59:8aa304768360 | 1919 | */ |
cactode | 59:8aa304768360 | 1920 | void arm_fir_init_f32( |
cactode | 59:8aa304768360 | 1921 | arm_fir_instance_f32 * S, |
cactode | 59:8aa304768360 | 1922 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 1923 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 1924 | float32_t * pState, |
cactode | 59:8aa304768360 | 1925 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1926 | |
cactode | 59:8aa304768360 | 1927 | /** |
cactode | 59:8aa304768360 | 1928 | * @brief Instance structure for the Q15 Biquad cascade filter. |
cactode | 59:8aa304768360 | 1929 | */ |
cactode | 59:8aa304768360 | 1930 | typedef struct |
cactode | 59:8aa304768360 | 1931 | { |
cactode | 59:8aa304768360 | 1932 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 1933 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
cactode | 59:8aa304768360 | 1934 | const q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 1935 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
cactode | 59:8aa304768360 | 1936 | } arm_biquad_casd_df1_inst_q15; |
cactode | 59:8aa304768360 | 1937 | |
cactode | 59:8aa304768360 | 1938 | /** |
cactode | 59:8aa304768360 | 1939 | * @brief Instance structure for the Q31 Biquad cascade filter. |
cactode | 59:8aa304768360 | 1940 | */ |
cactode | 59:8aa304768360 | 1941 | typedef struct |
cactode | 59:8aa304768360 | 1942 | { |
cactode | 59:8aa304768360 | 1943 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 1944 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
cactode | 59:8aa304768360 | 1945 | const q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 1946 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
cactode | 59:8aa304768360 | 1947 | } arm_biquad_casd_df1_inst_q31; |
cactode | 59:8aa304768360 | 1948 | |
cactode | 59:8aa304768360 | 1949 | /** |
cactode | 59:8aa304768360 | 1950 | * @brief Instance structure for the floating-point Biquad cascade filter. |
cactode | 59:8aa304768360 | 1951 | */ |
cactode | 59:8aa304768360 | 1952 | typedef struct |
cactode | 59:8aa304768360 | 1953 | { |
cactode | 59:8aa304768360 | 1954 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 1955 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
cactode | 59:8aa304768360 | 1956 | const float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 1957 | } arm_biquad_casd_df1_inst_f32; |
cactode | 59:8aa304768360 | 1958 | |
cactode | 59:8aa304768360 | 1959 | #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) |
cactode | 59:8aa304768360 | 1960 | /** |
cactode | 59:8aa304768360 | 1961 | * @brief Instance structure for the modified Biquad coefs required by vectorized code. |
cactode | 59:8aa304768360 | 1962 | */ |
cactode | 59:8aa304768360 | 1963 | typedef struct |
cactode | 59:8aa304768360 | 1964 | { |
cactode | 59:8aa304768360 | 1965 | float32_t coeffs[8][4]; /**< Points to the array of modified coefficients. The array is of length 32. There is one per stage */ |
cactode | 59:8aa304768360 | 1966 | } arm_biquad_mod_coef_f32; |
cactode | 59:8aa304768360 | 1967 | #endif |
cactode | 59:8aa304768360 | 1968 | |
cactode | 59:8aa304768360 | 1969 | /** |
cactode | 59:8aa304768360 | 1970 | * @brief Processing function for the Q15 Biquad cascade filter. |
cactode | 59:8aa304768360 | 1971 | * @param[in] S points to an instance of the Q15 Biquad cascade structure. |
cactode | 59:8aa304768360 | 1972 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 1973 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 1974 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 1975 | */ |
cactode | 59:8aa304768360 | 1976 | void arm_biquad_cascade_df1_q15( |
cactode | 59:8aa304768360 | 1977 | const arm_biquad_casd_df1_inst_q15 * S, |
cactode | 59:8aa304768360 | 1978 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 1979 | q15_t * pDst, |
cactode | 59:8aa304768360 | 1980 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 1981 | |
cactode | 59:8aa304768360 | 1982 | /** |
cactode | 59:8aa304768360 | 1983 | * @brief Initialization function for the Q15 Biquad cascade filter. |
cactode | 59:8aa304768360 | 1984 | * @param[in,out] S points to an instance of the Q15 Biquad cascade structure. |
cactode | 59:8aa304768360 | 1985 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 1986 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 1987 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 1988 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
cactode | 59:8aa304768360 | 1989 | */ |
cactode | 59:8aa304768360 | 1990 | void arm_biquad_cascade_df1_init_q15( |
cactode | 59:8aa304768360 | 1991 | arm_biquad_casd_df1_inst_q15 * S, |
cactode | 59:8aa304768360 | 1992 | uint8_t numStages, |
cactode | 59:8aa304768360 | 1993 | const q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 1994 | q15_t * pState, |
cactode | 59:8aa304768360 | 1995 | int8_t postShift); |
cactode | 59:8aa304768360 | 1996 | |
cactode | 59:8aa304768360 | 1997 | /** |
cactode | 59:8aa304768360 | 1998 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
cactode | 59:8aa304768360 | 1999 | * @param[in] S points to an instance of the Q15 Biquad cascade structure. |
cactode | 59:8aa304768360 | 2000 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 2001 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 2002 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 2003 | */ |
cactode | 59:8aa304768360 | 2004 | void arm_biquad_cascade_df1_fast_q15( |
cactode | 59:8aa304768360 | 2005 | const arm_biquad_casd_df1_inst_q15 * S, |
cactode | 59:8aa304768360 | 2006 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 2007 | q15_t * pDst, |
cactode | 59:8aa304768360 | 2008 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2009 | |
cactode | 59:8aa304768360 | 2010 | /** |
cactode | 59:8aa304768360 | 2011 | * @brief Processing function for the Q31 Biquad cascade filter |
cactode | 59:8aa304768360 | 2012 | * @param[in] S points to an instance of the Q31 Biquad cascade structure. |
cactode | 59:8aa304768360 | 2013 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 2014 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 2015 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 2016 | */ |
cactode | 59:8aa304768360 | 2017 | void arm_biquad_cascade_df1_q31( |
cactode | 59:8aa304768360 | 2018 | const arm_biquad_casd_df1_inst_q31 * S, |
cactode | 59:8aa304768360 | 2019 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 2020 | q31_t * pDst, |
cactode | 59:8aa304768360 | 2021 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2022 | |
cactode | 59:8aa304768360 | 2023 | /** |
cactode | 59:8aa304768360 | 2024 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
cactode | 59:8aa304768360 | 2025 | * @param[in] S points to an instance of the Q31 Biquad cascade structure. |
cactode | 59:8aa304768360 | 2026 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 2027 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 2028 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 2029 | */ |
cactode | 59:8aa304768360 | 2030 | void arm_biquad_cascade_df1_fast_q31( |
cactode | 59:8aa304768360 | 2031 | const arm_biquad_casd_df1_inst_q31 * S, |
cactode | 59:8aa304768360 | 2032 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 2033 | q31_t * pDst, |
cactode | 59:8aa304768360 | 2034 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2035 | |
cactode | 59:8aa304768360 | 2036 | /** |
cactode | 59:8aa304768360 | 2037 | * @brief Initialization function for the Q31 Biquad cascade filter. |
cactode | 59:8aa304768360 | 2038 | * @param[in,out] S points to an instance of the Q31 Biquad cascade structure. |
cactode | 59:8aa304768360 | 2039 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 2040 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 2041 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 2042 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
cactode | 59:8aa304768360 | 2043 | */ |
cactode | 59:8aa304768360 | 2044 | void arm_biquad_cascade_df1_init_q31( |
cactode | 59:8aa304768360 | 2045 | arm_biquad_casd_df1_inst_q31 * S, |
cactode | 59:8aa304768360 | 2046 | uint8_t numStages, |
cactode | 59:8aa304768360 | 2047 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 2048 | q31_t * pState, |
cactode | 59:8aa304768360 | 2049 | int8_t postShift); |
cactode | 59:8aa304768360 | 2050 | |
cactode | 59:8aa304768360 | 2051 | /** |
cactode | 59:8aa304768360 | 2052 | * @brief Processing function for the floating-point Biquad cascade filter. |
cactode | 59:8aa304768360 | 2053 | * @param[in] S points to an instance of the floating-point Biquad cascade structure. |
cactode | 59:8aa304768360 | 2054 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 2055 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 2056 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 2057 | */ |
cactode | 59:8aa304768360 | 2058 | void arm_biquad_cascade_df1_f32( |
cactode | 59:8aa304768360 | 2059 | const arm_biquad_casd_df1_inst_f32 * S, |
cactode | 59:8aa304768360 | 2060 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 2061 | float32_t * pDst, |
cactode | 59:8aa304768360 | 2062 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2063 | |
cactode | 59:8aa304768360 | 2064 | /** |
cactode | 59:8aa304768360 | 2065 | * @brief Initialization function for the floating-point Biquad cascade filter. |
cactode | 59:8aa304768360 | 2066 | * @param[in,out] S points to an instance of the floating-point Biquad cascade structure. |
cactode | 59:8aa304768360 | 2067 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 2068 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 2069 | * @param[in] pCoeffsMod points to the modified filter coefficients (only MVE version). |
cactode | 59:8aa304768360 | 2070 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 2071 | */ |
cactode | 59:8aa304768360 | 2072 | #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) |
cactode | 59:8aa304768360 | 2073 | void arm_biquad_cascade_df1_mve_init_f32( |
cactode | 59:8aa304768360 | 2074 | arm_biquad_casd_df1_inst_f32 * S, |
cactode | 59:8aa304768360 | 2075 | uint8_t numStages, |
cactode | 59:8aa304768360 | 2076 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 2077 | arm_biquad_mod_coef_f32 * pCoeffsMod, |
cactode | 59:8aa304768360 | 2078 | float32_t * pState); |
cactode | 59:8aa304768360 | 2079 | #endif |
cactode | 59:8aa304768360 | 2080 | |
cactode | 59:8aa304768360 | 2081 | void arm_biquad_cascade_df1_init_f32( |
cactode | 59:8aa304768360 | 2082 | arm_biquad_casd_df1_inst_f32 * S, |
cactode | 59:8aa304768360 | 2083 | uint8_t numStages, |
cactode | 59:8aa304768360 | 2084 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 2085 | float32_t * pState); |
cactode | 59:8aa304768360 | 2086 | |
cactode | 59:8aa304768360 | 2087 | |
cactode | 59:8aa304768360 | 2088 | /** |
cactode | 59:8aa304768360 | 2089 | * @brief Compute the logical bitwise AND of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2090 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2091 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2092 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2093 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2094 | * @return none |
cactode | 59:8aa304768360 | 2095 | */ |
cactode | 59:8aa304768360 | 2096 | void arm_and_u16( |
cactode | 59:8aa304768360 | 2097 | const uint16_t * pSrcA, |
cactode | 59:8aa304768360 | 2098 | const uint16_t * pSrcB, |
cactode | 59:8aa304768360 | 2099 | uint16_t * pDst, |
cactode | 59:8aa304768360 | 2100 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2101 | |
cactode | 59:8aa304768360 | 2102 | /** |
cactode | 59:8aa304768360 | 2103 | * @brief Compute the logical bitwise AND of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2104 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2105 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2106 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2107 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2108 | * @return none |
cactode | 59:8aa304768360 | 2109 | */ |
cactode | 59:8aa304768360 | 2110 | void arm_and_u32( |
cactode | 59:8aa304768360 | 2111 | const uint32_t * pSrcA, |
cactode | 59:8aa304768360 | 2112 | const uint32_t * pSrcB, |
cactode | 59:8aa304768360 | 2113 | uint32_t * pDst, |
cactode | 59:8aa304768360 | 2114 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2115 | |
cactode | 59:8aa304768360 | 2116 | /** |
cactode | 59:8aa304768360 | 2117 | * @brief Compute the logical bitwise AND of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2118 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2119 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2120 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2121 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2122 | * @return none |
cactode | 59:8aa304768360 | 2123 | */ |
cactode | 59:8aa304768360 | 2124 | void arm_and_u8( |
cactode | 59:8aa304768360 | 2125 | const uint8_t * pSrcA, |
cactode | 59:8aa304768360 | 2126 | const uint8_t * pSrcB, |
cactode | 59:8aa304768360 | 2127 | uint8_t * pDst, |
cactode | 59:8aa304768360 | 2128 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2129 | |
cactode | 59:8aa304768360 | 2130 | /** |
cactode | 59:8aa304768360 | 2131 | * @brief Compute the logical bitwise OR of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2132 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2133 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2134 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2135 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2136 | * @return none |
cactode | 59:8aa304768360 | 2137 | */ |
cactode | 59:8aa304768360 | 2138 | void arm_or_u16( |
cactode | 59:8aa304768360 | 2139 | const uint16_t * pSrcA, |
cactode | 59:8aa304768360 | 2140 | const uint16_t * pSrcB, |
cactode | 59:8aa304768360 | 2141 | uint16_t * pDst, |
cactode | 59:8aa304768360 | 2142 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2143 | |
cactode | 59:8aa304768360 | 2144 | /** |
cactode | 59:8aa304768360 | 2145 | * @brief Compute the logical bitwise OR of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2146 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2147 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2148 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2149 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2150 | * @return none |
cactode | 59:8aa304768360 | 2151 | */ |
cactode | 59:8aa304768360 | 2152 | void arm_or_u32( |
cactode | 59:8aa304768360 | 2153 | const uint32_t * pSrcA, |
cactode | 59:8aa304768360 | 2154 | const uint32_t * pSrcB, |
cactode | 59:8aa304768360 | 2155 | uint32_t * pDst, |
cactode | 59:8aa304768360 | 2156 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2157 | |
cactode | 59:8aa304768360 | 2158 | /** |
cactode | 59:8aa304768360 | 2159 | * @brief Compute the logical bitwise OR of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2160 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2161 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2162 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2163 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2164 | * @return none |
cactode | 59:8aa304768360 | 2165 | */ |
cactode | 59:8aa304768360 | 2166 | void arm_or_u8( |
cactode | 59:8aa304768360 | 2167 | const uint8_t * pSrcA, |
cactode | 59:8aa304768360 | 2168 | const uint8_t * pSrcB, |
cactode | 59:8aa304768360 | 2169 | uint8_t * pDst, |
cactode | 59:8aa304768360 | 2170 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2171 | |
cactode | 59:8aa304768360 | 2172 | /** |
cactode | 59:8aa304768360 | 2173 | * @brief Compute the logical bitwise NOT of a fixed-point vector. |
cactode | 59:8aa304768360 | 2174 | * @param[in] pSrc points to input vector |
cactode | 59:8aa304768360 | 2175 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2176 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2177 | * @return none |
cactode | 59:8aa304768360 | 2178 | */ |
cactode | 59:8aa304768360 | 2179 | void arm_not_u16( |
cactode | 59:8aa304768360 | 2180 | const uint16_t * pSrc, |
cactode | 59:8aa304768360 | 2181 | uint16_t * pDst, |
cactode | 59:8aa304768360 | 2182 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2183 | |
cactode | 59:8aa304768360 | 2184 | /** |
cactode | 59:8aa304768360 | 2185 | * @brief Compute the logical bitwise NOT of a fixed-point vector. |
cactode | 59:8aa304768360 | 2186 | * @param[in] pSrc points to input vector |
cactode | 59:8aa304768360 | 2187 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2188 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2189 | * @return none |
cactode | 59:8aa304768360 | 2190 | */ |
cactode | 59:8aa304768360 | 2191 | void arm_not_u32( |
cactode | 59:8aa304768360 | 2192 | const uint32_t * pSrc, |
cactode | 59:8aa304768360 | 2193 | uint32_t * pDst, |
cactode | 59:8aa304768360 | 2194 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2195 | |
cactode | 59:8aa304768360 | 2196 | /** |
cactode | 59:8aa304768360 | 2197 | * @brief Compute the logical bitwise NOT of a fixed-point vector. |
cactode | 59:8aa304768360 | 2198 | * @param[in] pSrc points to input vector |
cactode | 59:8aa304768360 | 2199 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2200 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2201 | * @return none |
cactode | 59:8aa304768360 | 2202 | */ |
cactode | 59:8aa304768360 | 2203 | void arm_not_u8( |
cactode | 59:8aa304768360 | 2204 | const uint8_t * pSrc, |
cactode | 59:8aa304768360 | 2205 | uint8_t * pDst, |
cactode | 59:8aa304768360 | 2206 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2207 | |
cactode | 59:8aa304768360 | 2208 | /** |
cactode | 59:8aa304768360 | 2209 | * @brief Compute the logical bitwise XOR of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2210 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2211 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2212 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2213 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2214 | * @return none |
cactode | 59:8aa304768360 | 2215 | */ |
cactode | 59:8aa304768360 | 2216 | void arm_xor_u16( |
cactode | 59:8aa304768360 | 2217 | const uint16_t * pSrcA, |
cactode | 59:8aa304768360 | 2218 | const uint16_t * pSrcB, |
cactode | 59:8aa304768360 | 2219 | uint16_t * pDst, |
cactode | 59:8aa304768360 | 2220 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2221 | |
cactode | 59:8aa304768360 | 2222 | /** |
cactode | 59:8aa304768360 | 2223 | * @brief Compute the logical bitwise XOR of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2224 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2225 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2226 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2227 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2228 | * @return none |
cactode | 59:8aa304768360 | 2229 | */ |
cactode | 59:8aa304768360 | 2230 | void arm_xor_u32( |
cactode | 59:8aa304768360 | 2231 | const uint32_t * pSrcA, |
cactode | 59:8aa304768360 | 2232 | const uint32_t * pSrcB, |
cactode | 59:8aa304768360 | 2233 | uint32_t * pDst, |
cactode | 59:8aa304768360 | 2234 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2235 | |
cactode | 59:8aa304768360 | 2236 | /** |
cactode | 59:8aa304768360 | 2237 | * @brief Compute the logical bitwise XOR of two fixed-point vectors. |
cactode | 59:8aa304768360 | 2238 | * @param[in] pSrcA points to input vector A |
cactode | 59:8aa304768360 | 2239 | * @param[in] pSrcB points to input vector B |
cactode | 59:8aa304768360 | 2240 | * @param[out] pDst points to output vector |
cactode | 59:8aa304768360 | 2241 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2242 | * @return none |
cactode | 59:8aa304768360 | 2243 | */ |
cactode | 59:8aa304768360 | 2244 | void arm_xor_u8( |
cactode | 59:8aa304768360 | 2245 | const uint8_t * pSrcA, |
cactode | 59:8aa304768360 | 2246 | const uint8_t * pSrcB, |
cactode | 59:8aa304768360 | 2247 | uint8_t * pDst, |
cactode | 59:8aa304768360 | 2248 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2249 | |
cactode | 59:8aa304768360 | 2250 | /** |
cactode | 59:8aa304768360 | 2251 | * @brief Struct for specifying sorting algorithm |
cactode | 59:8aa304768360 | 2252 | */ |
cactode | 59:8aa304768360 | 2253 | typedef enum |
cactode | 59:8aa304768360 | 2254 | { |
cactode | 59:8aa304768360 | 2255 | ARM_SORT_BITONIC = 0, |
cactode | 59:8aa304768360 | 2256 | /**< Bitonic sort */ |
cactode | 59:8aa304768360 | 2257 | ARM_SORT_BUBBLE = 1, |
cactode | 59:8aa304768360 | 2258 | /**< Bubble sort */ |
cactode | 59:8aa304768360 | 2259 | ARM_SORT_HEAP = 2, |
cactode | 59:8aa304768360 | 2260 | /**< Heap sort */ |
cactode | 59:8aa304768360 | 2261 | ARM_SORT_INSERTION = 3, |
cactode | 59:8aa304768360 | 2262 | /**< Insertion sort */ |
cactode | 59:8aa304768360 | 2263 | ARM_SORT_QUICK = 4, |
cactode | 59:8aa304768360 | 2264 | /**< Quick sort */ |
cactode | 59:8aa304768360 | 2265 | ARM_SORT_SELECTION = 5 |
cactode | 59:8aa304768360 | 2266 | /**< Selection sort */ |
cactode | 59:8aa304768360 | 2267 | } arm_sort_alg; |
cactode | 59:8aa304768360 | 2268 | |
cactode | 59:8aa304768360 | 2269 | /** |
cactode | 59:8aa304768360 | 2270 | * @brief Struct for specifying sorting algorithm |
cactode | 59:8aa304768360 | 2271 | */ |
cactode | 59:8aa304768360 | 2272 | typedef enum |
cactode | 59:8aa304768360 | 2273 | { |
cactode | 59:8aa304768360 | 2274 | ARM_SORT_DESCENDING = 0, |
cactode | 59:8aa304768360 | 2275 | /**< Descending order (9 to 0) */ |
cactode | 59:8aa304768360 | 2276 | ARM_SORT_ASCENDING = 1 |
cactode | 59:8aa304768360 | 2277 | /**< Ascending order (0 to 9) */ |
cactode | 59:8aa304768360 | 2278 | } arm_sort_dir; |
cactode | 59:8aa304768360 | 2279 | |
cactode | 59:8aa304768360 | 2280 | /** |
cactode | 59:8aa304768360 | 2281 | * @brief Instance structure for the sorting algorithms. |
cactode | 59:8aa304768360 | 2282 | */ |
cactode | 59:8aa304768360 | 2283 | typedef struct |
cactode | 59:8aa304768360 | 2284 | { |
cactode | 59:8aa304768360 | 2285 | arm_sort_alg alg; /**< Sorting algorithm selected */ |
cactode | 59:8aa304768360 | 2286 | arm_sort_dir dir; /**< Sorting order (direction) */ |
cactode | 59:8aa304768360 | 2287 | } arm_sort_instance_f32; |
cactode | 59:8aa304768360 | 2288 | |
cactode | 59:8aa304768360 | 2289 | /** |
cactode | 59:8aa304768360 | 2290 | * @param[in] S points to an instance of the sorting structure. |
cactode | 59:8aa304768360 | 2291 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 2292 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 2293 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 2294 | */ |
cactode | 59:8aa304768360 | 2295 | void arm_sort_f32( |
cactode | 59:8aa304768360 | 2296 | const arm_sort_instance_f32 * S, |
cactode | 59:8aa304768360 | 2297 | float32_t * pSrc, |
cactode | 59:8aa304768360 | 2298 | float32_t * pDst, |
cactode | 59:8aa304768360 | 2299 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2300 | |
cactode | 59:8aa304768360 | 2301 | /** |
cactode | 59:8aa304768360 | 2302 | * @param[in,out] S points to an instance of the sorting structure. |
cactode | 59:8aa304768360 | 2303 | * @param[in] alg Selected algorithm. |
cactode | 59:8aa304768360 | 2304 | * @param[in] dir Sorting order. |
cactode | 59:8aa304768360 | 2305 | */ |
cactode | 59:8aa304768360 | 2306 | void arm_sort_init_f32( |
cactode | 59:8aa304768360 | 2307 | arm_sort_instance_f32 * S, |
cactode | 59:8aa304768360 | 2308 | arm_sort_alg alg, |
cactode | 59:8aa304768360 | 2309 | arm_sort_dir dir); |
cactode | 59:8aa304768360 | 2310 | |
cactode | 59:8aa304768360 | 2311 | /** |
cactode | 59:8aa304768360 | 2312 | * @brief Instance structure for the sorting algorithms. |
cactode | 59:8aa304768360 | 2313 | */ |
cactode | 59:8aa304768360 | 2314 | typedef struct |
cactode | 59:8aa304768360 | 2315 | { |
cactode | 59:8aa304768360 | 2316 | arm_sort_dir dir; /**< Sorting order (direction) */ |
cactode | 59:8aa304768360 | 2317 | float32_t * buffer; /**< Working buffer */ |
cactode | 59:8aa304768360 | 2318 | } arm_merge_sort_instance_f32; |
cactode | 59:8aa304768360 | 2319 | |
cactode | 59:8aa304768360 | 2320 | /** |
cactode | 59:8aa304768360 | 2321 | * @param[in] S points to an instance of the sorting structure. |
cactode | 59:8aa304768360 | 2322 | * @param[in,out] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 2323 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 2324 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 2325 | */ |
cactode | 59:8aa304768360 | 2326 | void arm_merge_sort_f32( |
cactode | 59:8aa304768360 | 2327 | const arm_merge_sort_instance_f32 * S, |
cactode | 59:8aa304768360 | 2328 | float32_t *pSrc, |
cactode | 59:8aa304768360 | 2329 | float32_t *pDst, |
cactode | 59:8aa304768360 | 2330 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2331 | |
cactode | 59:8aa304768360 | 2332 | /** |
cactode | 59:8aa304768360 | 2333 | * @param[in,out] S points to an instance of the sorting structure. |
cactode | 59:8aa304768360 | 2334 | * @param[in] dir Sorting order. |
cactode | 59:8aa304768360 | 2335 | * @param[in] buffer Working buffer. |
cactode | 59:8aa304768360 | 2336 | */ |
cactode | 59:8aa304768360 | 2337 | void arm_merge_sort_init_f32( |
cactode | 59:8aa304768360 | 2338 | arm_merge_sort_instance_f32 * S, |
cactode | 59:8aa304768360 | 2339 | arm_sort_dir dir, |
cactode | 59:8aa304768360 | 2340 | float32_t * buffer); |
cactode | 59:8aa304768360 | 2341 | |
cactode | 59:8aa304768360 | 2342 | /** |
cactode | 59:8aa304768360 | 2343 | * @brief Struct for specifying cubic spline type |
cactode | 59:8aa304768360 | 2344 | */ |
cactode | 59:8aa304768360 | 2345 | typedef enum |
cactode | 59:8aa304768360 | 2346 | { |
cactode | 59:8aa304768360 | 2347 | ARM_SPLINE_NATURAL = 0, /**< Natural spline */ |
cactode | 59:8aa304768360 | 2348 | ARM_SPLINE_PARABOLIC_RUNOUT = 1 /**< Parabolic runout spline */ |
cactode | 59:8aa304768360 | 2349 | } arm_spline_type; |
cactode | 59:8aa304768360 | 2350 | |
cactode | 59:8aa304768360 | 2351 | /** |
cactode | 59:8aa304768360 | 2352 | * @brief Instance structure for the floating-point cubic spline interpolation. |
cactode | 59:8aa304768360 | 2353 | */ |
cactode | 59:8aa304768360 | 2354 | typedef struct |
cactode | 59:8aa304768360 | 2355 | { |
cactode | 59:8aa304768360 | 2356 | arm_spline_type type; /**< Type (boundary conditions) */ |
cactode | 59:8aa304768360 | 2357 | const float32_t * x; /**< x values */ |
cactode | 59:8aa304768360 | 2358 | const float32_t * y; /**< y values */ |
cactode | 59:8aa304768360 | 2359 | uint32_t n_x; /**< Number of known data points */ |
cactode | 59:8aa304768360 | 2360 | float32_t * coeffs; /**< Coefficients buffer (b,c, and d) */ |
cactode | 59:8aa304768360 | 2361 | } arm_spline_instance_f32; |
cactode | 59:8aa304768360 | 2362 | |
cactode | 59:8aa304768360 | 2363 | /** |
cactode | 59:8aa304768360 | 2364 | * @brief Processing function for the floating-point cubic spline interpolation. |
cactode | 59:8aa304768360 | 2365 | * @param[in] S points to an instance of the floating-point spline structure. |
cactode | 59:8aa304768360 | 2366 | * @param[in] xq points to the x values ot the interpolated data points. |
cactode | 59:8aa304768360 | 2367 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 2368 | * @param[in] blockSize number of samples of output data. |
cactode | 59:8aa304768360 | 2369 | */ |
cactode | 59:8aa304768360 | 2370 | void arm_spline_f32( |
cactode | 59:8aa304768360 | 2371 | arm_spline_instance_f32 * S, |
cactode | 59:8aa304768360 | 2372 | const float32_t * xq, |
cactode | 59:8aa304768360 | 2373 | float32_t * pDst, |
cactode | 59:8aa304768360 | 2374 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2375 | |
cactode | 59:8aa304768360 | 2376 | /** |
cactode | 59:8aa304768360 | 2377 | * @brief Initialization function for the floating-point cubic spline interpolation. |
cactode | 59:8aa304768360 | 2378 | * @param[in,out] S points to an instance of the floating-point spline structure. |
cactode | 59:8aa304768360 | 2379 | * @param[in] type type of cubic spline interpolation (boundary conditions) |
cactode | 59:8aa304768360 | 2380 | * @param[in] x points to the x values of the known data points. |
cactode | 59:8aa304768360 | 2381 | * @param[in] y points to the y values of the known data points. |
cactode | 59:8aa304768360 | 2382 | * @param[in] n number of known data points. |
cactode | 59:8aa304768360 | 2383 | * @param[in] coeffs coefficients array for b, c, and d |
cactode | 59:8aa304768360 | 2384 | * @param[in] tempBuffer buffer array for internal computations |
cactode | 59:8aa304768360 | 2385 | */ |
cactode | 59:8aa304768360 | 2386 | void arm_spline_init_f32( |
cactode | 59:8aa304768360 | 2387 | arm_spline_instance_f32 * S, |
cactode | 59:8aa304768360 | 2388 | arm_spline_type type, |
cactode | 59:8aa304768360 | 2389 | const float32_t * x, |
cactode | 59:8aa304768360 | 2390 | const float32_t * y, |
cactode | 59:8aa304768360 | 2391 | uint32_t n, |
cactode | 59:8aa304768360 | 2392 | float32_t * coeffs, |
cactode | 59:8aa304768360 | 2393 | float32_t * tempBuffer); |
cactode | 59:8aa304768360 | 2394 | |
cactode | 59:8aa304768360 | 2395 | /** |
cactode | 59:8aa304768360 | 2396 | * @brief Instance structure for the floating-point matrix structure. |
cactode | 59:8aa304768360 | 2397 | */ |
cactode | 59:8aa304768360 | 2398 | typedef struct |
cactode | 59:8aa304768360 | 2399 | { |
cactode | 59:8aa304768360 | 2400 | uint16_t numRows; /**< number of rows of the matrix. */ |
cactode | 59:8aa304768360 | 2401 | uint16_t numCols; /**< number of columns of the matrix. */ |
cactode | 59:8aa304768360 | 2402 | float32_t *pData; /**< points to the data of the matrix. */ |
cactode | 59:8aa304768360 | 2403 | } arm_matrix_instance_f32; |
cactode | 59:8aa304768360 | 2404 | |
cactode | 59:8aa304768360 | 2405 | /** |
cactode | 59:8aa304768360 | 2406 | * @brief Instance structure for the floating-point matrix structure. |
cactode | 59:8aa304768360 | 2407 | */ |
cactode | 59:8aa304768360 | 2408 | typedef struct |
cactode | 59:8aa304768360 | 2409 | { |
cactode | 59:8aa304768360 | 2410 | uint16_t numRows; /**< number of rows of the matrix. */ |
cactode | 59:8aa304768360 | 2411 | uint16_t numCols; /**< number of columns of the matrix. */ |
cactode | 59:8aa304768360 | 2412 | float64_t *pData; /**< points to the data of the matrix. */ |
cactode | 59:8aa304768360 | 2413 | } arm_matrix_instance_f64; |
cactode | 59:8aa304768360 | 2414 | |
cactode | 59:8aa304768360 | 2415 | /** |
cactode | 59:8aa304768360 | 2416 | * @brief Instance structure for the Q15 matrix structure. |
cactode | 59:8aa304768360 | 2417 | */ |
cactode | 59:8aa304768360 | 2418 | typedef struct |
cactode | 59:8aa304768360 | 2419 | { |
cactode | 59:8aa304768360 | 2420 | uint16_t numRows; /**< number of rows of the matrix. */ |
cactode | 59:8aa304768360 | 2421 | uint16_t numCols; /**< number of columns of the matrix. */ |
cactode | 59:8aa304768360 | 2422 | q15_t *pData; /**< points to the data of the matrix. */ |
cactode | 59:8aa304768360 | 2423 | } arm_matrix_instance_q15; |
cactode | 59:8aa304768360 | 2424 | |
cactode | 59:8aa304768360 | 2425 | /** |
cactode | 59:8aa304768360 | 2426 | * @brief Instance structure for the Q31 matrix structure. |
cactode | 59:8aa304768360 | 2427 | */ |
cactode | 59:8aa304768360 | 2428 | typedef struct |
cactode | 59:8aa304768360 | 2429 | { |
cactode | 59:8aa304768360 | 2430 | uint16_t numRows; /**< number of rows of the matrix. */ |
cactode | 59:8aa304768360 | 2431 | uint16_t numCols; /**< number of columns of the matrix. */ |
cactode | 59:8aa304768360 | 2432 | q31_t *pData; /**< points to the data of the matrix. */ |
cactode | 59:8aa304768360 | 2433 | } arm_matrix_instance_q31; |
cactode | 59:8aa304768360 | 2434 | |
cactode | 59:8aa304768360 | 2435 | /** |
cactode | 59:8aa304768360 | 2436 | * @brief Floating-point matrix addition. |
cactode | 59:8aa304768360 | 2437 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2438 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2439 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2440 | * @return The function returns either |
cactode | 59:8aa304768360 | 2441 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2442 | */ |
cactode | 59:8aa304768360 | 2443 | arm_status arm_mat_add_f32( |
cactode | 59:8aa304768360 | 2444 | const arm_matrix_instance_f32 * pSrcA, |
cactode | 59:8aa304768360 | 2445 | const arm_matrix_instance_f32 * pSrcB, |
cactode | 59:8aa304768360 | 2446 | arm_matrix_instance_f32 * pDst); |
cactode | 59:8aa304768360 | 2447 | |
cactode | 59:8aa304768360 | 2448 | /** |
cactode | 59:8aa304768360 | 2449 | * @brief Q15 matrix addition. |
cactode | 59:8aa304768360 | 2450 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2451 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2452 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2453 | * @return The function returns either |
cactode | 59:8aa304768360 | 2454 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2455 | */ |
cactode | 59:8aa304768360 | 2456 | arm_status arm_mat_add_q15( |
cactode | 59:8aa304768360 | 2457 | const arm_matrix_instance_q15 * pSrcA, |
cactode | 59:8aa304768360 | 2458 | const arm_matrix_instance_q15 * pSrcB, |
cactode | 59:8aa304768360 | 2459 | arm_matrix_instance_q15 * pDst); |
cactode | 59:8aa304768360 | 2460 | |
cactode | 59:8aa304768360 | 2461 | /** |
cactode | 59:8aa304768360 | 2462 | * @brief Q31 matrix addition. |
cactode | 59:8aa304768360 | 2463 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2464 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2465 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2466 | * @return The function returns either |
cactode | 59:8aa304768360 | 2467 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2468 | */ |
cactode | 59:8aa304768360 | 2469 | arm_status arm_mat_add_q31( |
cactode | 59:8aa304768360 | 2470 | const arm_matrix_instance_q31 * pSrcA, |
cactode | 59:8aa304768360 | 2471 | const arm_matrix_instance_q31 * pSrcB, |
cactode | 59:8aa304768360 | 2472 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2473 | |
cactode | 59:8aa304768360 | 2474 | /** |
cactode | 59:8aa304768360 | 2475 | * @brief Floating-point, complex, matrix multiplication. |
cactode | 59:8aa304768360 | 2476 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2477 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2478 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2479 | * @return The function returns either |
cactode | 59:8aa304768360 | 2480 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2481 | */ |
cactode | 59:8aa304768360 | 2482 | arm_status arm_mat_cmplx_mult_f32( |
cactode | 59:8aa304768360 | 2483 | const arm_matrix_instance_f32 * pSrcA, |
cactode | 59:8aa304768360 | 2484 | const arm_matrix_instance_f32 * pSrcB, |
cactode | 59:8aa304768360 | 2485 | arm_matrix_instance_f32 * pDst); |
cactode | 59:8aa304768360 | 2486 | |
cactode | 59:8aa304768360 | 2487 | /** |
cactode | 59:8aa304768360 | 2488 | * @brief Q15, complex, matrix multiplication. |
cactode | 59:8aa304768360 | 2489 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2490 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2491 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2492 | * @return The function returns either |
cactode | 59:8aa304768360 | 2493 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2494 | */ |
cactode | 59:8aa304768360 | 2495 | arm_status arm_mat_cmplx_mult_q15( |
cactode | 59:8aa304768360 | 2496 | const arm_matrix_instance_q15 * pSrcA, |
cactode | 59:8aa304768360 | 2497 | const arm_matrix_instance_q15 * pSrcB, |
cactode | 59:8aa304768360 | 2498 | arm_matrix_instance_q15 * pDst, |
cactode | 59:8aa304768360 | 2499 | q15_t * pScratch); |
cactode | 59:8aa304768360 | 2500 | |
cactode | 59:8aa304768360 | 2501 | /** |
cactode | 59:8aa304768360 | 2502 | * @brief Q31, complex, matrix multiplication. |
cactode | 59:8aa304768360 | 2503 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2504 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2505 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2506 | * @return The function returns either |
cactode | 59:8aa304768360 | 2507 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2508 | */ |
cactode | 59:8aa304768360 | 2509 | arm_status arm_mat_cmplx_mult_q31( |
cactode | 59:8aa304768360 | 2510 | const arm_matrix_instance_q31 * pSrcA, |
cactode | 59:8aa304768360 | 2511 | const arm_matrix_instance_q31 * pSrcB, |
cactode | 59:8aa304768360 | 2512 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2513 | |
cactode | 59:8aa304768360 | 2514 | /** |
cactode | 59:8aa304768360 | 2515 | * @brief Floating-point matrix transpose. |
cactode | 59:8aa304768360 | 2516 | * @param[in] pSrc points to the input matrix |
cactode | 59:8aa304768360 | 2517 | * @param[out] pDst points to the output matrix |
cactode | 59:8aa304768360 | 2518 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
cactode | 59:8aa304768360 | 2519 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2520 | */ |
cactode | 59:8aa304768360 | 2521 | arm_status arm_mat_trans_f32( |
cactode | 59:8aa304768360 | 2522 | const arm_matrix_instance_f32 * pSrc, |
cactode | 59:8aa304768360 | 2523 | arm_matrix_instance_f32 * pDst); |
cactode | 59:8aa304768360 | 2524 | |
cactode | 59:8aa304768360 | 2525 | /** |
cactode | 59:8aa304768360 | 2526 | * @brief Q15 matrix transpose. |
cactode | 59:8aa304768360 | 2527 | * @param[in] pSrc points to the input matrix |
cactode | 59:8aa304768360 | 2528 | * @param[out] pDst points to the output matrix |
cactode | 59:8aa304768360 | 2529 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
cactode | 59:8aa304768360 | 2530 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2531 | */ |
cactode | 59:8aa304768360 | 2532 | arm_status arm_mat_trans_q15( |
cactode | 59:8aa304768360 | 2533 | const arm_matrix_instance_q15 * pSrc, |
cactode | 59:8aa304768360 | 2534 | arm_matrix_instance_q15 * pDst); |
cactode | 59:8aa304768360 | 2535 | |
cactode | 59:8aa304768360 | 2536 | /** |
cactode | 59:8aa304768360 | 2537 | * @brief Q31 matrix transpose. |
cactode | 59:8aa304768360 | 2538 | * @param[in] pSrc points to the input matrix |
cactode | 59:8aa304768360 | 2539 | * @param[out] pDst points to the output matrix |
cactode | 59:8aa304768360 | 2540 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
cactode | 59:8aa304768360 | 2541 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2542 | */ |
cactode | 59:8aa304768360 | 2543 | arm_status arm_mat_trans_q31( |
cactode | 59:8aa304768360 | 2544 | const arm_matrix_instance_q31 * pSrc, |
cactode | 59:8aa304768360 | 2545 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2546 | |
cactode | 59:8aa304768360 | 2547 | /** |
cactode | 59:8aa304768360 | 2548 | * @brief Floating-point matrix multiplication |
cactode | 59:8aa304768360 | 2549 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2550 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2551 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2552 | * @return The function returns either |
cactode | 59:8aa304768360 | 2553 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2554 | */ |
cactode | 59:8aa304768360 | 2555 | arm_status arm_mat_mult_f32( |
cactode | 59:8aa304768360 | 2556 | const arm_matrix_instance_f32 * pSrcA, |
cactode | 59:8aa304768360 | 2557 | const arm_matrix_instance_f32 * pSrcB, |
cactode | 59:8aa304768360 | 2558 | arm_matrix_instance_f32 * pDst); |
cactode | 59:8aa304768360 | 2559 | |
cactode | 59:8aa304768360 | 2560 | /** |
cactode | 59:8aa304768360 | 2561 | * @brief Q15 matrix multiplication |
cactode | 59:8aa304768360 | 2562 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2563 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2564 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2565 | * @param[in] pState points to the array for storing intermediate results |
cactode | 59:8aa304768360 | 2566 | * @return The function returns either |
cactode | 59:8aa304768360 | 2567 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2568 | */ |
cactode | 59:8aa304768360 | 2569 | arm_status arm_mat_mult_q15( |
cactode | 59:8aa304768360 | 2570 | const arm_matrix_instance_q15 * pSrcA, |
cactode | 59:8aa304768360 | 2571 | const arm_matrix_instance_q15 * pSrcB, |
cactode | 59:8aa304768360 | 2572 | arm_matrix_instance_q15 * pDst, |
cactode | 59:8aa304768360 | 2573 | q15_t * pState); |
cactode | 59:8aa304768360 | 2574 | |
cactode | 59:8aa304768360 | 2575 | /** |
cactode | 59:8aa304768360 | 2576 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 2577 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2578 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2579 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2580 | * @param[in] pState points to the array for storing intermediate results |
cactode | 59:8aa304768360 | 2581 | * @return The function returns either |
cactode | 59:8aa304768360 | 2582 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2583 | */ |
cactode | 59:8aa304768360 | 2584 | arm_status arm_mat_mult_fast_q15( |
cactode | 59:8aa304768360 | 2585 | const arm_matrix_instance_q15 * pSrcA, |
cactode | 59:8aa304768360 | 2586 | const arm_matrix_instance_q15 * pSrcB, |
cactode | 59:8aa304768360 | 2587 | arm_matrix_instance_q15 * pDst, |
cactode | 59:8aa304768360 | 2588 | q15_t * pState); |
cactode | 59:8aa304768360 | 2589 | |
cactode | 59:8aa304768360 | 2590 | /** |
cactode | 59:8aa304768360 | 2591 | * @brief Q31 matrix multiplication |
cactode | 59:8aa304768360 | 2592 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2593 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2594 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2595 | * @return The function returns either |
cactode | 59:8aa304768360 | 2596 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2597 | */ |
cactode | 59:8aa304768360 | 2598 | arm_status arm_mat_mult_q31( |
cactode | 59:8aa304768360 | 2599 | const arm_matrix_instance_q31 * pSrcA, |
cactode | 59:8aa304768360 | 2600 | const arm_matrix_instance_q31 * pSrcB, |
cactode | 59:8aa304768360 | 2601 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2602 | |
cactode | 59:8aa304768360 | 2603 | /** |
cactode | 59:8aa304768360 | 2604 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 2605 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2606 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2607 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2608 | * @return The function returns either |
cactode | 59:8aa304768360 | 2609 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2610 | */ |
cactode | 59:8aa304768360 | 2611 | arm_status arm_mat_mult_fast_q31( |
cactode | 59:8aa304768360 | 2612 | const arm_matrix_instance_q31 * pSrcA, |
cactode | 59:8aa304768360 | 2613 | const arm_matrix_instance_q31 * pSrcB, |
cactode | 59:8aa304768360 | 2614 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2615 | |
cactode | 59:8aa304768360 | 2616 | /** |
cactode | 59:8aa304768360 | 2617 | * @brief Floating-point matrix subtraction |
cactode | 59:8aa304768360 | 2618 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2619 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2620 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2621 | * @return The function returns either |
cactode | 59:8aa304768360 | 2622 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2623 | */ |
cactode | 59:8aa304768360 | 2624 | arm_status arm_mat_sub_f32( |
cactode | 59:8aa304768360 | 2625 | const arm_matrix_instance_f32 * pSrcA, |
cactode | 59:8aa304768360 | 2626 | const arm_matrix_instance_f32 * pSrcB, |
cactode | 59:8aa304768360 | 2627 | arm_matrix_instance_f32 * pDst); |
cactode | 59:8aa304768360 | 2628 | |
cactode | 59:8aa304768360 | 2629 | /** |
cactode | 59:8aa304768360 | 2630 | * @brief Q15 matrix subtraction |
cactode | 59:8aa304768360 | 2631 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2632 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2633 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2634 | * @return The function returns either |
cactode | 59:8aa304768360 | 2635 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2636 | */ |
cactode | 59:8aa304768360 | 2637 | arm_status arm_mat_sub_q15( |
cactode | 59:8aa304768360 | 2638 | const arm_matrix_instance_q15 * pSrcA, |
cactode | 59:8aa304768360 | 2639 | const arm_matrix_instance_q15 * pSrcB, |
cactode | 59:8aa304768360 | 2640 | arm_matrix_instance_q15 * pDst); |
cactode | 59:8aa304768360 | 2641 | |
cactode | 59:8aa304768360 | 2642 | /** |
cactode | 59:8aa304768360 | 2643 | * @brief Q31 matrix subtraction |
cactode | 59:8aa304768360 | 2644 | * @param[in] pSrcA points to the first input matrix structure |
cactode | 59:8aa304768360 | 2645 | * @param[in] pSrcB points to the second input matrix structure |
cactode | 59:8aa304768360 | 2646 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2647 | * @return The function returns either |
cactode | 59:8aa304768360 | 2648 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2649 | */ |
cactode | 59:8aa304768360 | 2650 | arm_status arm_mat_sub_q31( |
cactode | 59:8aa304768360 | 2651 | const arm_matrix_instance_q31 * pSrcA, |
cactode | 59:8aa304768360 | 2652 | const arm_matrix_instance_q31 * pSrcB, |
cactode | 59:8aa304768360 | 2653 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2654 | |
cactode | 59:8aa304768360 | 2655 | /** |
cactode | 59:8aa304768360 | 2656 | * @brief Floating-point matrix scaling. |
cactode | 59:8aa304768360 | 2657 | * @param[in] pSrc points to the input matrix |
cactode | 59:8aa304768360 | 2658 | * @param[in] scale scale factor |
cactode | 59:8aa304768360 | 2659 | * @param[out] pDst points to the output matrix |
cactode | 59:8aa304768360 | 2660 | * @return The function returns either |
cactode | 59:8aa304768360 | 2661 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2662 | */ |
cactode | 59:8aa304768360 | 2663 | arm_status arm_mat_scale_f32( |
cactode | 59:8aa304768360 | 2664 | const arm_matrix_instance_f32 * pSrc, |
cactode | 59:8aa304768360 | 2665 | float32_t scale, |
cactode | 59:8aa304768360 | 2666 | arm_matrix_instance_f32 * pDst); |
cactode | 59:8aa304768360 | 2667 | |
cactode | 59:8aa304768360 | 2668 | /** |
cactode | 59:8aa304768360 | 2669 | * @brief Q15 matrix scaling. |
cactode | 59:8aa304768360 | 2670 | * @param[in] pSrc points to input matrix |
cactode | 59:8aa304768360 | 2671 | * @param[in] scaleFract fractional portion of the scale factor |
cactode | 59:8aa304768360 | 2672 | * @param[in] shift number of bits to shift the result by |
cactode | 59:8aa304768360 | 2673 | * @param[out] pDst points to output matrix |
cactode | 59:8aa304768360 | 2674 | * @return The function returns either |
cactode | 59:8aa304768360 | 2675 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2676 | */ |
cactode | 59:8aa304768360 | 2677 | arm_status arm_mat_scale_q15( |
cactode | 59:8aa304768360 | 2678 | const arm_matrix_instance_q15 * pSrc, |
cactode | 59:8aa304768360 | 2679 | q15_t scaleFract, |
cactode | 59:8aa304768360 | 2680 | int32_t shift, |
cactode | 59:8aa304768360 | 2681 | arm_matrix_instance_q15 * pDst); |
cactode | 59:8aa304768360 | 2682 | |
cactode | 59:8aa304768360 | 2683 | /** |
cactode | 59:8aa304768360 | 2684 | * @brief Q31 matrix scaling. |
cactode | 59:8aa304768360 | 2685 | * @param[in] pSrc points to input matrix |
cactode | 59:8aa304768360 | 2686 | * @param[in] scaleFract fractional portion of the scale factor |
cactode | 59:8aa304768360 | 2687 | * @param[in] shift number of bits to shift the result by |
cactode | 59:8aa304768360 | 2688 | * @param[out] pDst points to output matrix structure |
cactode | 59:8aa304768360 | 2689 | * @return The function returns either |
cactode | 59:8aa304768360 | 2690 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
cactode | 59:8aa304768360 | 2691 | */ |
cactode | 59:8aa304768360 | 2692 | arm_status arm_mat_scale_q31( |
cactode | 59:8aa304768360 | 2693 | const arm_matrix_instance_q31 * pSrc, |
cactode | 59:8aa304768360 | 2694 | q31_t scaleFract, |
cactode | 59:8aa304768360 | 2695 | int32_t shift, |
cactode | 59:8aa304768360 | 2696 | arm_matrix_instance_q31 * pDst); |
cactode | 59:8aa304768360 | 2697 | |
cactode | 59:8aa304768360 | 2698 | /** |
cactode | 59:8aa304768360 | 2699 | * @brief Q31 matrix initialization. |
cactode | 59:8aa304768360 | 2700 | * @param[in,out] S points to an instance of the floating-point matrix structure. |
cactode | 59:8aa304768360 | 2701 | * @param[in] nRows number of rows in the matrix. |
cactode | 59:8aa304768360 | 2702 | * @param[in] nColumns number of columns in the matrix. |
cactode | 59:8aa304768360 | 2703 | * @param[in] pData points to the matrix data array. |
cactode | 59:8aa304768360 | 2704 | */ |
cactode | 59:8aa304768360 | 2705 | void arm_mat_init_q31( |
cactode | 59:8aa304768360 | 2706 | arm_matrix_instance_q31 * S, |
cactode | 59:8aa304768360 | 2707 | uint16_t nRows, |
cactode | 59:8aa304768360 | 2708 | uint16_t nColumns, |
cactode | 59:8aa304768360 | 2709 | q31_t * pData); |
cactode | 59:8aa304768360 | 2710 | |
cactode | 59:8aa304768360 | 2711 | /** |
cactode | 59:8aa304768360 | 2712 | * @brief Q15 matrix initialization. |
cactode | 59:8aa304768360 | 2713 | * @param[in,out] S points to an instance of the floating-point matrix structure. |
cactode | 59:8aa304768360 | 2714 | * @param[in] nRows number of rows in the matrix. |
cactode | 59:8aa304768360 | 2715 | * @param[in] nColumns number of columns in the matrix. |
cactode | 59:8aa304768360 | 2716 | * @param[in] pData points to the matrix data array. |
cactode | 59:8aa304768360 | 2717 | */ |
cactode | 59:8aa304768360 | 2718 | void arm_mat_init_q15( |
cactode | 59:8aa304768360 | 2719 | arm_matrix_instance_q15 * S, |
cactode | 59:8aa304768360 | 2720 | uint16_t nRows, |
cactode | 59:8aa304768360 | 2721 | uint16_t nColumns, |
cactode | 59:8aa304768360 | 2722 | q15_t * pData); |
cactode | 59:8aa304768360 | 2723 | |
cactode | 59:8aa304768360 | 2724 | /** |
cactode | 59:8aa304768360 | 2725 | * @brief Floating-point matrix initialization. |
cactode | 59:8aa304768360 | 2726 | * @param[in,out] S points to an instance of the floating-point matrix structure. |
cactode | 59:8aa304768360 | 2727 | * @param[in] nRows number of rows in the matrix. |
cactode | 59:8aa304768360 | 2728 | * @param[in] nColumns number of columns in the matrix. |
cactode | 59:8aa304768360 | 2729 | * @param[in] pData points to the matrix data array. |
cactode | 59:8aa304768360 | 2730 | */ |
cactode | 59:8aa304768360 | 2731 | void arm_mat_init_f32( |
cactode | 59:8aa304768360 | 2732 | arm_matrix_instance_f32 * S, |
cactode | 59:8aa304768360 | 2733 | uint16_t nRows, |
cactode | 59:8aa304768360 | 2734 | uint16_t nColumns, |
cactode | 59:8aa304768360 | 2735 | float32_t * pData); |
cactode | 59:8aa304768360 | 2736 | |
cactode | 59:8aa304768360 | 2737 | |
cactode | 59:8aa304768360 | 2738 | /** |
cactode | 59:8aa304768360 | 2739 | * @brief Instance structure for the Q15 PID Control. |
cactode | 59:8aa304768360 | 2740 | */ |
cactode | 59:8aa304768360 | 2741 | typedef struct |
cactode | 59:8aa304768360 | 2742 | { |
cactode | 59:8aa304768360 | 2743 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
cactode | 59:8aa304768360 | 2744 | #if !defined (ARM_MATH_DSP) |
cactode | 59:8aa304768360 | 2745 | q15_t A1; |
cactode | 59:8aa304768360 | 2746 | q15_t A2; |
cactode | 59:8aa304768360 | 2747 | #else |
cactode | 59:8aa304768360 | 2748 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ |
cactode | 59:8aa304768360 | 2749 | #endif |
cactode | 59:8aa304768360 | 2750 | q15_t state[3]; /**< The state array of length 3. */ |
cactode | 59:8aa304768360 | 2751 | q15_t Kp; /**< The proportional gain. */ |
cactode | 59:8aa304768360 | 2752 | q15_t Ki; /**< The integral gain. */ |
cactode | 59:8aa304768360 | 2753 | q15_t Kd; /**< The derivative gain. */ |
cactode | 59:8aa304768360 | 2754 | } arm_pid_instance_q15; |
cactode | 59:8aa304768360 | 2755 | |
cactode | 59:8aa304768360 | 2756 | /** |
cactode | 59:8aa304768360 | 2757 | * @brief Instance structure for the Q31 PID Control. |
cactode | 59:8aa304768360 | 2758 | */ |
cactode | 59:8aa304768360 | 2759 | typedef struct |
cactode | 59:8aa304768360 | 2760 | { |
cactode | 59:8aa304768360 | 2761 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
cactode | 59:8aa304768360 | 2762 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
cactode | 59:8aa304768360 | 2763 | q31_t A2; /**< The derived gain, A2 = Kd . */ |
cactode | 59:8aa304768360 | 2764 | q31_t state[3]; /**< The state array of length 3. */ |
cactode | 59:8aa304768360 | 2765 | q31_t Kp; /**< The proportional gain. */ |
cactode | 59:8aa304768360 | 2766 | q31_t Ki; /**< The integral gain. */ |
cactode | 59:8aa304768360 | 2767 | q31_t Kd; /**< The derivative gain. */ |
cactode | 59:8aa304768360 | 2768 | } arm_pid_instance_q31; |
cactode | 59:8aa304768360 | 2769 | |
cactode | 59:8aa304768360 | 2770 | /** |
cactode | 59:8aa304768360 | 2771 | * @brief Instance structure for the floating-point PID Control. |
cactode | 59:8aa304768360 | 2772 | */ |
cactode | 59:8aa304768360 | 2773 | typedef struct |
cactode | 59:8aa304768360 | 2774 | { |
cactode | 59:8aa304768360 | 2775 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
cactode | 59:8aa304768360 | 2776 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
cactode | 59:8aa304768360 | 2777 | float32_t A2; /**< The derived gain, A2 = Kd . */ |
cactode | 59:8aa304768360 | 2778 | float32_t state[3]; /**< The state array of length 3. */ |
cactode | 59:8aa304768360 | 2779 | float32_t Kp; /**< The proportional gain. */ |
cactode | 59:8aa304768360 | 2780 | float32_t Ki; /**< The integral gain. */ |
cactode | 59:8aa304768360 | 2781 | float32_t Kd; /**< The derivative gain. */ |
cactode | 59:8aa304768360 | 2782 | } arm_pid_instance_f32; |
cactode | 59:8aa304768360 | 2783 | |
cactode | 59:8aa304768360 | 2784 | |
cactode | 59:8aa304768360 | 2785 | |
cactode | 59:8aa304768360 | 2786 | /** |
cactode | 59:8aa304768360 | 2787 | * @brief Initialization function for the floating-point PID Control. |
cactode | 59:8aa304768360 | 2788 | * @param[in,out] S points to an instance of the PID structure. |
cactode | 59:8aa304768360 | 2789 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
cactode | 59:8aa304768360 | 2790 | */ |
cactode | 59:8aa304768360 | 2791 | void arm_pid_init_f32( |
cactode | 59:8aa304768360 | 2792 | arm_pid_instance_f32 * S, |
cactode | 59:8aa304768360 | 2793 | int32_t resetStateFlag); |
cactode | 59:8aa304768360 | 2794 | |
cactode | 59:8aa304768360 | 2795 | |
cactode | 59:8aa304768360 | 2796 | /** |
cactode | 59:8aa304768360 | 2797 | * @brief Reset function for the floating-point PID Control. |
cactode | 59:8aa304768360 | 2798 | * @param[in,out] S is an instance of the floating-point PID Control structure |
cactode | 59:8aa304768360 | 2799 | */ |
cactode | 59:8aa304768360 | 2800 | void arm_pid_reset_f32( |
cactode | 59:8aa304768360 | 2801 | arm_pid_instance_f32 * S); |
cactode | 59:8aa304768360 | 2802 | |
cactode | 59:8aa304768360 | 2803 | |
cactode | 59:8aa304768360 | 2804 | /** |
cactode | 59:8aa304768360 | 2805 | * @brief Initialization function for the Q31 PID Control. |
cactode | 59:8aa304768360 | 2806 | * @param[in,out] S points to an instance of the Q15 PID structure. |
cactode | 59:8aa304768360 | 2807 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
cactode | 59:8aa304768360 | 2808 | */ |
cactode | 59:8aa304768360 | 2809 | void arm_pid_init_q31( |
cactode | 59:8aa304768360 | 2810 | arm_pid_instance_q31 * S, |
cactode | 59:8aa304768360 | 2811 | int32_t resetStateFlag); |
cactode | 59:8aa304768360 | 2812 | |
cactode | 59:8aa304768360 | 2813 | |
cactode | 59:8aa304768360 | 2814 | /** |
cactode | 59:8aa304768360 | 2815 | * @brief Reset function for the Q31 PID Control. |
cactode | 59:8aa304768360 | 2816 | * @param[in,out] S points to an instance of the Q31 PID Control structure |
cactode | 59:8aa304768360 | 2817 | */ |
cactode | 59:8aa304768360 | 2818 | |
cactode | 59:8aa304768360 | 2819 | void arm_pid_reset_q31( |
cactode | 59:8aa304768360 | 2820 | arm_pid_instance_q31 * S); |
cactode | 59:8aa304768360 | 2821 | |
cactode | 59:8aa304768360 | 2822 | |
cactode | 59:8aa304768360 | 2823 | /** |
cactode | 59:8aa304768360 | 2824 | * @brief Initialization function for the Q15 PID Control. |
cactode | 59:8aa304768360 | 2825 | * @param[in,out] S points to an instance of the Q15 PID structure. |
cactode | 59:8aa304768360 | 2826 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
cactode | 59:8aa304768360 | 2827 | */ |
cactode | 59:8aa304768360 | 2828 | void arm_pid_init_q15( |
cactode | 59:8aa304768360 | 2829 | arm_pid_instance_q15 * S, |
cactode | 59:8aa304768360 | 2830 | int32_t resetStateFlag); |
cactode | 59:8aa304768360 | 2831 | |
cactode | 59:8aa304768360 | 2832 | |
cactode | 59:8aa304768360 | 2833 | /** |
cactode | 59:8aa304768360 | 2834 | * @brief Reset function for the Q15 PID Control. |
cactode | 59:8aa304768360 | 2835 | * @param[in,out] S points to an instance of the q15 PID Control structure |
cactode | 59:8aa304768360 | 2836 | */ |
cactode | 59:8aa304768360 | 2837 | void arm_pid_reset_q15( |
cactode | 59:8aa304768360 | 2838 | arm_pid_instance_q15 * S); |
cactode | 59:8aa304768360 | 2839 | |
cactode | 59:8aa304768360 | 2840 | |
cactode | 59:8aa304768360 | 2841 | /** |
cactode | 59:8aa304768360 | 2842 | * @brief Instance structure for the floating-point Linear Interpolate function. |
cactode | 59:8aa304768360 | 2843 | */ |
cactode | 59:8aa304768360 | 2844 | typedef struct |
cactode | 59:8aa304768360 | 2845 | { |
cactode | 59:8aa304768360 | 2846 | uint32_t nValues; /**< nValues */ |
cactode | 59:8aa304768360 | 2847 | float32_t x1; /**< x1 */ |
cactode | 59:8aa304768360 | 2848 | float32_t xSpacing; /**< xSpacing */ |
cactode | 59:8aa304768360 | 2849 | float32_t *pYData; /**< pointer to the table of Y values */ |
cactode | 59:8aa304768360 | 2850 | } arm_linear_interp_instance_f32; |
cactode | 59:8aa304768360 | 2851 | |
cactode | 59:8aa304768360 | 2852 | /** |
cactode | 59:8aa304768360 | 2853 | * @brief Instance structure for the floating-point bilinear interpolation function. |
cactode | 59:8aa304768360 | 2854 | */ |
cactode | 59:8aa304768360 | 2855 | typedef struct |
cactode | 59:8aa304768360 | 2856 | { |
cactode | 59:8aa304768360 | 2857 | uint16_t numRows; /**< number of rows in the data table. */ |
cactode | 59:8aa304768360 | 2858 | uint16_t numCols; /**< number of columns in the data table. */ |
cactode | 59:8aa304768360 | 2859 | float32_t *pData; /**< points to the data table. */ |
cactode | 59:8aa304768360 | 2860 | } arm_bilinear_interp_instance_f32; |
cactode | 59:8aa304768360 | 2861 | |
cactode | 59:8aa304768360 | 2862 | /** |
cactode | 59:8aa304768360 | 2863 | * @brief Instance structure for the Q31 bilinear interpolation function. |
cactode | 59:8aa304768360 | 2864 | */ |
cactode | 59:8aa304768360 | 2865 | typedef struct |
cactode | 59:8aa304768360 | 2866 | { |
cactode | 59:8aa304768360 | 2867 | uint16_t numRows; /**< number of rows in the data table. */ |
cactode | 59:8aa304768360 | 2868 | uint16_t numCols; /**< number of columns in the data table. */ |
cactode | 59:8aa304768360 | 2869 | q31_t *pData; /**< points to the data table. */ |
cactode | 59:8aa304768360 | 2870 | } arm_bilinear_interp_instance_q31; |
cactode | 59:8aa304768360 | 2871 | |
cactode | 59:8aa304768360 | 2872 | /** |
cactode | 59:8aa304768360 | 2873 | * @brief Instance structure for the Q15 bilinear interpolation function. |
cactode | 59:8aa304768360 | 2874 | */ |
cactode | 59:8aa304768360 | 2875 | typedef struct |
cactode | 59:8aa304768360 | 2876 | { |
cactode | 59:8aa304768360 | 2877 | uint16_t numRows; /**< number of rows in the data table. */ |
cactode | 59:8aa304768360 | 2878 | uint16_t numCols; /**< number of columns in the data table. */ |
cactode | 59:8aa304768360 | 2879 | q15_t *pData; /**< points to the data table. */ |
cactode | 59:8aa304768360 | 2880 | } arm_bilinear_interp_instance_q15; |
cactode | 59:8aa304768360 | 2881 | |
cactode | 59:8aa304768360 | 2882 | /** |
cactode | 59:8aa304768360 | 2883 | * @brief Instance structure for the Q15 bilinear interpolation function. |
cactode | 59:8aa304768360 | 2884 | */ |
cactode | 59:8aa304768360 | 2885 | typedef struct |
cactode | 59:8aa304768360 | 2886 | { |
cactode | 59:8aa304768360 | 2887 | uint16_t numRows; /**< number of rows in the data table. */ |
cactode | 59:8aa304768360 | 2888 | uint16_t numCols; /**< number of columns in the data table. */ |
cactode | 59:8aa304768360 | 2889 | q7_t *pData; /**< points to the data table. */ |
cactode | 59:8aa304768360 | 2890 | } arm_bilinear_interp_instance_q7; |
cactode | 59:8aa304768360 | 2891 | |
cactode | 59:8aa304768360 | 2892 | |
cactode | 59:8aa304768360 | 2893 | /** |
cactode | 59:8aa304768360 | 2894 | * @brief Q7 vector multiplication. |
cactode | 59:8aa304768360 | 2895 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 2896 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 2897 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 2898 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2899 | */ |
cactode | 59:8aa304768360 | 2900 | void arm_mult_q7( |
cactode | 59:8aa304768360 | 2901 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 2902 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 2903 | q7_t * pDst, |
cactode | 59:8aa304768360 | 2904 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2905 | |
cactode | 59:8aa304768360 | 2906 | |
cactode | 59:8aa304768360 | 2907 | /** |
cactode | 59:8aa304768360 | 2908 | * @brief Q15 vector multiplication. |
cactode | 59:8aa304768360 | 2909 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 2910 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 2911 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 2912 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2913 | */ |
cactode | 59:8aa304768360 | 2914 | void arm_mult_q15( |
cactode | 59:8aa304768360 | 2915 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 2916 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 2917 | q15_t * pDst, |
cactode | 59:8aa304768360 | 2918 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2919 | |
cactode | 59:8aa304768360 | 2920 | |
cactode | 59:8aa304768360 | 2921 | /** |
cactode | 59:8aa304768360 | 2922 | * @brief Q31 vector multiplication. |
cactode | 59:8aa304768360 | 2923 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 2924 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 2925 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 2926 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2927 | */ |
cactode | 59:8aa304768360 | 2928 | void arm_mult_q31( |
cactode | 59:8aa304768360 | 2929 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 2930 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 2931 | q31_t * pDst, |
cactode | 59:8aa304768360 | 2932 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2933 | |
cactode | 59:8aa304768360 | 2934 | |
cactode | 59:8aa304768360 | 2935 | /** |
cactode | 59:8aa304768360 | 2936 | * @brief Floating-point vector multiplication. |
cactode | 59:8aa304768360 | 2937 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 2938 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 2939 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 2940 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 2941 | */ |
cactode | 59:8aa304768360 | 2942 | void arm_mult_f32( |
cactode | 59:8aa304768360 | 2943 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 2944 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 2945 | float32_t * pDst, |
cactode | 59:8aa304768360 | 2946 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 2947 | |
cactode | 59:8aa304768360 | 2948 | |
cactode | 59:8aa304768360 | 2949 | /** |
cactode | 59:8aa304768360 | 2950 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 2951 | */ |
cactode | 59:8aa304768360 | 2952 | typedef struct |
cactode | 59:8aa304768360 | 2953 | { |
cactode | 59:8aa304768360 | 2954 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 2955 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
cactode | 59:8aa304768360 | 2956 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 2957 | const q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ |
cactode | 59:8aa304768360 | 2958 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 2959 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 2960 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
cactode | 59:8aa304768360 | 2961 | } arm_cfft_radix2_instance_q15; |
cactode | 59:8aa304768360 | 2962 | |
cactode | 59:8aa304768360 | 2963 | /* Deprecated */ |
cactode | 59:8aa304768360 | 2964 | arm_status arm_cfft_radix2_init_q15( |
cactode | 59:8aa304768360 | 2965 | arm_cfft_radix2_instance_q15 * S, |
cactode | 59:8aa304768360 | 2966 | uint16_t fftLen, |
cactode | 59:8aa304768360 | 2967 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 2968 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 2969 | |
cactode | 59:8aa304768360 | 2970 | /* Deprecated */ |
cactode | 59:8aa304768360 | 2971 | void arm_cfft_radix2_q15( |
cactode | 59:8aa304768360 | 2972 | const arm_cfft_radix2_instance_q15 * S, |
cactode | 59:8aa304768360 | 2973 | q15_t * pSrc); |
cactode | 59:8aa304768360 | 2974 | |
cactode | 59:8aa304768360 | 2975 | |
cactode | 59:8aa304768360 | 2976 | /** |
cactode | 59:8aa304768360 | 2977 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 2978 | */ |
cactode | 59:8aa304768360 | 2979 | typedef struct |
cactode | 59:8aa304768360 | 2980 | { |
cactode | 59:8aa304768360 | 2981 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 2982 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
cactode | 59:8aa304768360 | 2983 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 2984 | const q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
cactode | 59:8aa304768360 | 2985 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 2986 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 2987 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
cactode | 59:8aa304768360 | 2988 | } arm_cfft_radix4_instance_q15; |
cactode | 59:8aa304768360 | 2989 | |
cactode | 59:8aa304768360 | 2990 | /* Deprecated */ |
cactode | 59:8aa304768360 | 2991 | arm_status arm_cfft_radix4_init_q15( |
cactode | 59:8aa304768360 | 2992 | arm_cfft_radix4_instance_q15 * S, |
cactode | 59:8aa304768360 | 2993 | uint16_t fftLen, |
cactode | 59:8aa304768360 | 2994 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 2995 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 2996 | |
cactode | 59:8aa304768360 | 2997 | /* Deprecated */ |
cactode | 59:8aa304768360 | 2998 | void arm_cfft_radix4_q15( |
cactode | 59:8aa304768360 | 2999 | const arm_cfft_radix4_instance_q15 * S, |
cactode | 59:8aa304768360 | 3000 | q15_t * pSrc); |
cactode | 59:8aa304768360 | 3001 | |
cactode | 59:8aa304768360 | 3002 | /** |
cactode | 59:8aa304768360 | 3003 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3004 | */ |
cactode | 59:8aa304768360 | 3005 | typedef struct |
cactode | 59:8aa304768360 | 3006 | { |
cactode | 59:8aa304768360 | 3007 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3008 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
cactode | 59:8aa304768360 | 3009 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3010 | const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3011 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3012 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3013 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
cactode | 59:8aa304768360 | 3014 | } arm_cfft_radix2_instance_q31; |
cactode | 59:8aa304768360 | 3015 | |
cactode | 59:8aa304768360 | 3016 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3017 | arm_status arm_cfft_radix2_init_q31( |
cactode | 59:8aa304768360 | 3018 | arm_cfft_radix2_instance_q31 * S, |
cactode | 59:8aa304768360 | 3019 | uint16_t fftLen, |
cactode | 59:8aa304768360 | 3020 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3021 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3022 | |
cactode | 59:8aa304768360 | 3023 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3024 | void arm_cfft_radix2_q31( |
cactode | 59:8aa304768360 | 3025 | const arm_cfft_radix2_instance_q31 * S, |
cactode | 59:8aa304768360 | 3026 | q31_t * pSrc); |
cactode | 59:8aa304768360 | 3027 | |
cactode | 59:8aa304768360 | 3028 | /** |
cactode | 59:8aa304768360 | 3029 | * @brief Instance structure for the Q31 CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3030 | */ |
cactode | 59:8aa304768360 | 3031 | typedef struct |
cactode | 59:8aa304768360 | 3032 | { |
cactode | 59:8aa304768360 | 3033 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3034 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
cactode | 59:8aa304768360 | 3035 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3036 | const q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
cactode | 59:8aa304768360 | 3037 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3038 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3039 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
cactode | 59:8aa304768360 | 3040 | } arm_cfft_radix4_instance_q31; |
cactode | 59:8aa304768360 | 3041 | |
cactode | 59:8aa304768360 | 3042 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3043 | void arm_cfft_radix4_q31( |
cactode | 59:8aa304768360 | 3044 | const arm_cfft_radix4_instance_q31 * S, |
cactode | 59:8aa304768360 | 3045 | q31_t * pSrc); |
cactode | 59:8aa304768360 | 3046 | |
cactode | 59:8aa304768360 | 3047 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3048 | arm_status arm_cfft_radix4_init_q31( |
cactode | 59:8aa304768360 | 3049 | arm_cfft_radix4_instance_q31 * S, |
cactode | 59:8aa304768360 | 3050 | uint16_t fftLen, |
cactode | 59:8aa304768360 | 3051 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3052 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3053 | |
cactode | 59:8aa304768360 | 3054 | /** |
cactode | 59:8aa304768360 | 3055 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3056 | */ |
cactode | 59:8aa304768360 | 3057 | typedef struct |
cactode | 59:8aa304768360 | 3058 | { |
cactode | 59:8aa304768360 | 3059 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3060 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
cactode | 59:8aa304768360 | 3061 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3062 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3063 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3064 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3065 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
cactode | 59:8aa304768360 | 3066 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
cactode | 59:8aa304768360 | 3067 | } arm_cfft_radix2_instance_f32; |
cactode | 59:8aa304768360 | 3068 | |
cactode | 59:8aa304768360 | 3069 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3070 | arm_status arm_cfft_radix2_init_f32( |
cactode | 59:8aa304768360 | 3071 | arm_cfft_radix2_instance_f32 * S, |
cactode | 59:8aa304768360 | 3072 | uint16_t fftLen, |
cactode | 59:8aa304768360 | 3073 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3074 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3075 | |
cactode | 59:8aa304768360 | 3076 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3077 | void arm_cfft_radix2_f32( |
cactode | 59:8aa304768360 | 3078 | const arm_cfft_radix2_instance_f32 * S, |
cactode | 59:8aa304768360 | 3079 | float32_t * pSrc); |
cactode | 59:8aa304768360 | 3080 | |
cactode | 59:8aa304768360 | 3081 | /** |
cactode | 59:8aa304768360 | 3082 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3083 | */ |
cactode | 59:8aa304768360 | 3084 | typedef struct |
cactode | 59:8aa304768360 | 3085 | { |
cactode | 59:8aa304768360 | 3086 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3087 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
cactode | 59:8aa304768360 | 3088 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3089 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3090 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3091 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3092 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
cactode | 59:8aa304768360 | 3093 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
cactode | 59:8aa304768360 | 3094 | } arm_cfft_radix4_instance_f32; |
cactode | 59:8aa304768360 | 3095 | |
cactode | 59:8aa304768360 | 3096 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3097 | arm_status arm_cfft_radix4_init_f32( |
cactode | 59:8aa304768360 | 3098 | arm_cfft_radix4_instance_f32 * S, |
cactode | 59:8aa304768360 | 3099 | uint16_t fftLen, |
cactode | 59:8aa304768360 | 3100 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3101 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3102 | |
cactode | 59:8aa304768360 | 3103 | /* Deprecated */ |
cactode | 59:8aa304768360 | 3104 | void arm_cfft_radix4_f32( |
cactode | 59:8aa304768360 | 3105 | const arm_cfft_radix4_instance_f32 * S, |
cactode | 59:8aa304768360 | 3106 | float32_t * pSrc); |
cactode | 59:8aa304768360 | 3107 | |
cactode | 59:8aa304768360 | 3108 | /** |
cactode | 59:8aa304768360 | 3109 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3110 | */ |
cactode | 59:8aa304768360 | 3111 | typedef struct |
cactode | 59:8aa304768360 | 3112 | { |
cactode | 59:8aa304768360 | 3113 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3114 | const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3115 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3116 | uint16_t bitRevLength; /**< bit reversal table length. */ |
cactode | 59:8aa304768360 | 3117 | #if defined(ARM_MATH_MVEI) |
cactode | 59:8aa304768360 | 3118 | const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \ |
cactode | 59:8aa304768360 | 3119 | const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \ |
cactode | 59:8aa304768360 | 3120 | const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \ |
cactode | 59:8aa304768360 | 3121 | const q15_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \ |
cactode | 59:8aa304768360 | 3122 | const q15_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \ |
cactode | 59:8aa304768360 | 3123 | const q15_t *rearranged_twiddle_stride3; |
cactode | 59:8aa304768360 | 3124 | #endif |
cactode | 59:8aa304768360 | 3125 | } arm_cfft_instance_q15; |
cactode | 59:8aa304768360 | 3126 | |
cactode | 59:8aa304768360 | 3127 | arm_status arm_cfft_init_q15( |
cactode | 59:8aa304768360 | 3128 | arm_cfft_instance_q15 * S, |
cactode | 59:8aa304768360 | 3129 | uint16_t fftLen); |
cactode | 59:8aa304768360 | 3130 | |
cactode | 59:8aa304768360 | 3131 | void arm_cfft_q15( |
cactode | 59:8aa304768360 | 3132 | const arm_cfft_instance_q15 * S, |
cactode | 59:8aa304768360 | 3133 | q15_t * p1, |
cactode | 59:8aa304768360 | 3134 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3135 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3136 | |
cactode | 59:8aa304768360 | 3137 | /** |
cactode | 59:8aa304768360 | 3138 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3139 | */ |
cactode | 59:8aa304768360 | 3140 | typedef struct |
cactode | 59:8aa304768360 | 3141 | { |
cactode | 59:8aa304768360 | 3142 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3143 | const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3144 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3145 | uint16_t bitRevLength; /**< bit reversal table length. */ |
cactode | 59:8aa304768360 | 3146 | #if defined(ARM_MATH_MVEI) |
cactode | 59:8aa304768360 | 3147 | const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \ |
cactode | 59:8aa304768360 | 3148 | const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \ |
cactode | 59:8aa304768360 | 3149 | const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \ |
cactode | 59:8aa304768360 | 3150 | const q31_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \ |
cactode | 59:8aa304768360 | 3151 | const q31_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \ |
cactode | 59:8aa304768360 | 3152 | const q31_t *rearranged_twiddle_stride3; |
cactode | 59:8aa304768360 | 3153 | #endif |
cactode | 59:8aa304768360 | 3154 | } arm_cfft_instance_q31; |
cactode | 59:8aa304768360 | 3155 | |
cactode | 59:8aa304768360 | 3156 | arm_status arm_cfft_init_q31( |
cactode | 59:8aa304768360 | 3157 | arm_cfft_instance_q31 * S, |
cactode | 59:8aa304768360 | 3158 | uint16_t fftLen); |
cactode | 59:8aa304768360 | 3159 | |
cactode | 59:8aa304768360 | 3160 | void arm_cfft_q31( |
cactode | 59:8aa304768360 | 3161 | const arm_cfft_instance_q31 * S, |
cactode | 59:8aa304768360 | 3162 | q31_t * p1, |
cactode | 59:8aa304768360 | 3163 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3164 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3165 | |
cactode | 59:8aa304768360 | 3166 | /** |
cactode | 59:8aa304768360 | 3167 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3168 | */ |
cactode | 59:8aa304768360 | 3169 | typedef struct |
cactode | 59:8aa304768360 | 3170 | { |
cactode | 59:8aa304768360 | 3171 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3172 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3173 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3174 | uint16_t bitRevLength; /**< bit reversal table length. */ |
cactode | 59:8aa304768360 | 3175 | #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) |
cactode | 59:8aa304768360 | 3176 | const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \ |
cactode | 59:8aa304768360 | 3177 | const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \ |
cactode | 59:8aa304768360 | 3178 | const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \ |
cactode | 59:8aa304768360 | 3179 | const float32_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \ |
cactode | 59:8aa304768360 | 3180 | const float32_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \ |
cactode | 59:8aa304768360 | 3181 | const float32_t *rearranged_twiddle_stride3; |
cactode | 59:8aa304768360 | 3182 | #endif |
cactode | 59:8aa304768360 | 3183 | } arm_cfft_instance_f32; |
cactode | 59:8aa304768360 | 3184 | |
cactode | 59:8aa304768360 | 3185 | |
cactode | 59:8aa304768360 | 3186 | arm_status arm_cfft_init_f32( |
cactode | 59:8aa304768360 | 3187 | arm_cfft_instance_f32 * S, |
cactode | 59:8aa304768360 | 3188 | uint16_t fftLen); |
cactode | 59:8aa304768360 | 3189 | |
cactode | 59:8aa304768360 | 3190 | void arm_cfft_f32( |
cactode | 59:8aa304768360 | 3191 | const arm_cfft_instance_f32 * S, |
cactode | 59:8aa304768360 | 3192 | float32_t * p1, |
cactode | 59:8aa304768360 | 3193 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3194 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3195 | |
cactode | 59:8aa304768360 | 3196 | |
cactode | 59:8aa304768360 | 3197 | /** |
cactode | 59:8aa304768360 | 3198 | * @brief Instance structure for the Double Precision Floating-point CFFT/CIFFT function. |
cactode | 59:8aa304768360 | 3199 | */ |
cactode | 59:8aa304768360 | 3200 | typedef struct |
cactode | 59:8aa304768360 | 3201 | { |
cactode | 59:8aa304768360 | 3202 | uint16_t fftLen; /**< length of the FFT. */ |
cactode | 59:8aa304768360 | 3203 | const float64_t *pTwiddle; /**< points to the Twiddle factor table. */ |
cactode | 59:8aa304768360 | 3204 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
cactode | 59:8aa304768360 | 3205 | uint16_t bitRevLength; /**< bit reversal table length. */ |
cactode | 59:8aa304768360 | 3206 | } arm_cfft_instance_f64; |
cactode | 59:8aa304768360 | 3207 | |
cactode | 59:8aa304768360 | 3208 | void arm_cfft_f64( |
cactode | 59:8aa304768360 | 3209 | const arm_cfft_instance_f64 * S, |
cactode | 59:8aa304768360 | 3210 | float64_t * p1, |
cactode | 59:8aa304768360 | 3211 | uint8_t ifftFlag, |
cactode | 59:8aa304768360 | 3212 | uint8_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3213 | |
cactode | 59:8aa304768360 | 3214 | /** |
cactode | 59:8aa304768360 | 3215 | * @brief Instance structure for the Q15 RFFT/RIFFT function. |
cactode | 59:8aa304768360 | 3216 | */ |
cactode | 59:8aa304768360 | 3217 | typedef struct |
cactode | 59:8aa304768360 | 3218 | { |
cactode | 59:8aa304768360 | 3219 | uint32_t fftLenReal; /**< length of the real FFT. */ |
cactode | 59:8aa304768360 | 3220 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
cactode | 59:8aa304768360 | 3221 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3222 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3223 | const q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
cactode | 59:8aa304768360 | 3224 | const q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
cactode | 59:8aa304768360 | 3225 | #if defined(ARM_MATH_MVEI) |
cactode | 59:8aa304768360 | 3226 | arm_cfft_instance_q15 cfftInst; |
cactode | 59:8aa304768360 | 3227 | #else |
cactode | 59:8aa304768360 | 3228 | const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
cactode | 59:8aa304768360 | 3229 | #endif |
cactode | 59:8aa304768360 | 3230 | } arm_rfft_instance_q15; |
cactode | 59:8aa304768360 | 3231 | |
cactode | 59:8aa304768360 | 3232 | arm_status arm_rfft_init_q15( |
cactode | 59:8aa304768360 | 3233 | arm_rfft_instance_q15 * S, |
cactode | 59:8aa304768360 | 3234 | uint32_t fftLenReal, |
cactode | 59:8aa304768360 | 3235 | uint32_t ifftFlagR, |
cactode | 59:8aa304768360 | 3236 | uint32_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3237 | |
cactode | 59:8aa304768360 | 3238 | void arm_rfft_q15( |
cactode | 59:8aa304768360 | 3239 | const arm_rfft_instance_q15 * S, |
cactode | 59:8aa304768360 | 3240 | q15_t * pSrc, |
cactode | 59:8aa304768360 | 3241 | q15_t * pDst); |
cactode | 59:8aa304768360 | 3242 | |
cactode | 59:8aa304768360 | 3243 | /** |
cactode | 59:8aa304768360 | 3244 | * @brief Instance structure for the Q31 RFFT/RIFFT function. |
cactode | 59:8aa304768360 | 3245 | */ |
cactode | 59:8aa304768360 | 3246 | typedef struct |
cactode | 59:8aa304768360 | 3247 | { |
cactode | 59:8aa304768360 | 3248 | uint32_t fftLenReal; /**< length of the real FFT. */ |
cactode | 59:8aa304768360 | 3249 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
cactode | 59:8aa304768360 | 3250 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3251 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3252 | const q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
cactode | 59:8aa304768360 | 3253 | const q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
cactode | 59:8aa304768360 | 3254 | #if defined(ARM_MATH_MVEI) |
cactode | 59:8aa304768360 | 3255 | arm_cfft_instance_q31 cfftInst; |
cactode | 59:8aa304768360 | 3256 | #else |
cactode | 59:8aa304768360 | 3257 | const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
cactode | 59:8aa304768360 | 3258 | #endif |
cactode | 59:8aa304768360 | 3259 | } arm_rfft_instance_q31; |
cactode | 59:8aa304768360 | 3260 | |
cactode | 59:8aa304768360 | 3261 | arm_status arm_rfft_init_q31( |
cactode | 59:8aa304768360 | 3262 | arm_rfft_instance_q31 * S, |
cactode | 59:8aa304768360 | 3263 | uint32_t fftLenReal, |
cactode | 59:8aa304768360 | 3264 | uint32_t ifftFlagR, |
cactode | 59:8aa304768360 | 3265 | uint32_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3266 | |
cactode | 59:8aa304768360 | 3267 | void arm_rfft_q31( |
cactode | 59:8aa304768360 | 3268 | const arm_rfft_instance_q31 * S, |
cactode | 59:8aa304768360 | 3269 | q31_t * pSrc, |
cactode | 59:8aa304768360 | 3270 | q31_t * pDst); |
cactode | 59:8aa304768360 | 3271 | |
cactode | 59:8aa304768360 | 3272 | /** |
cactode | 59:8aa304768360 | 3273 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
cactode | 59:8aa304768360 | 3274 | */ |
cactode | 59:8aa304768360 | 3275 | typedef struct |
cactode | 59:8aa304768360 | 3276 | { |
cactode | 59:8aa304768360 | 3277 | uint32_t fftLenReal; /**< length of the real FFT. */ |
cactode | 59:8aa304768360 | 3278 | uint16_t fftLenBy2; /**< length of the complex FFT. */ |
cactode | 59:8aa304768360 | 3279 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
cactode | 59:8aa304768360 | 3280 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
cactode | 59:8aa304768360 | 3281 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
cactode | 59:8aa304768360 | 3282 | const float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
cactode | 59:8aa304768360 | 3283 | const float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
cactode | 59:8aa304768360 | 3284 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
cactode | 59:8aa304768360 | 3285 | } arm_rfft_instance_f32; |
cactode | 59:8aa304768360 | 3286 | |
cactode | 59:8aa304768360 | 3287 | arm_status arm_rfft_init_f32( |
cactode | 59:8aa304768360 | 3288 | arm_rfft_instance_f32 * S, |
cactode | 59:8aa304768360 | 3289 | arm_cfft_radix4_instance_f32 * S_CFFT, |
cactode | 59:8aa304768360 | 3290 | uint32_t fftLenReal, |
cactode | 59:8aa304768360 | 3291 | uint32_t ifftFlagR, |
cactode | 59:8aa304768360 | 3292 | uint32_t bitReverseFlag); |
cactode | 59:8aa304768360 | 3293 | |
cactode | 59:8aa304768360 | 3294 | void arm_rfft_f32( |
cactode | 59:8aa304768360 | 3295 | const arm_rfft_instance_f32 * S, |
cactode | 59:8aa304768360 | 3296 | float32_t * pSrc, |
cactode | 59:8aa304768360 | 3297 | float32_t * pDst); |
cactode | 59:8aa304768360 | 3298 | |
cactode | 59:8aa304768360 | 3299 | /** |
cactode | 59:8aa304768360 | 3300 | * @brief Instance structure for the Double Precision Floating-point RFFT/RIFFT function. |
cactode | 59:8aa304768360 | 3301 | */ |
cactode | 59:8aa304768360 | 3302 | typedef struct |
cactode | 59:8aa304768360 | 3303 | { |
cactode | 59:8aa304768360 | 3304 | arm_cfft_instance_f64 Sint; /**< Internal CFFT structure. */ |
cactode | 59:8aa304768360 | 3305 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
cactode | 59:8aa304768360 | 3306 | const float64_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
cactode | 59:8aa304768360 | 3307 | } arm_rfft_fast_instance_f64 ; |
cactode | 59:8aa304768360 | 3308 | |
cactode | 59:8aa304768360 | 3309 | arm_status arm_rfft_fast_init_f64 ( |
cactode | 59:8aa304768360 | 3310 | arm_rfft_fast_instance_f64 * S, |
cactode | 59:8aa304768360 | 3311 | uint16_t fftLen); |
cactode | 59:8aa304768360 | 3312 | |
cactode | 59:8aa304768360 | 3313 | |
cactode | 59:8aa304768360 | 3314 | void arm_rfft_fast_f64( |
cactode | 59:8aa304768360 | 3315 | arm_rfft_fast_instance_f64 * S, |
cactode | 59:8aa304768360 | 3316 | float64_t * p, float64_t * pOut, |
cactode | 59:8aa304768360 | 3317 | uint8_t ifftFlag); |
cactode | 59:8aa304768360 | 3318 | |
cactode | 59:8aa304768360 | 3319 | |
cactode | 59:8aa304768360 | 3320 | /** |
cactode | 59:8aa304768360 | 3321 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
cactode | 59:8aa304768360 | 3322 | */ |
cactode | 59:8aa304768360 | 3323 | typedef struct |
cactode | 59:8aa304768360 | 3324 | { |
cactode | 59:8aa304768360 | 3325 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ |
cactode | 59:8aa304768360 | 3326 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
cactode | 59:8aa304768360 | 3327 | const float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
cactode | 59:8aa304768360 | 3328 | } arm_rfft_fast_instance_f32 ; |
cactode | 59:8aa304768360 | 3329 | |
cactode | 59:8aa304768360 | 3330 | arm_status arm_rfft_fast_init_f32 ( |
cactode | 59:8aa304768360 | 3331 | arm_rfft_fast_instance_f32 * S, |
cactode | 59:8aa304768360 | 3332 | uint16_t fftLen); |
cactode | 59:8aa304768360 | 3333 | |
cactode | 59:8aa304768360 | 3334 | |
cactode | 59:8aa304768360 | 3335 | void arm_rfft_fast_f32( |
cactode | 59:8aa304768360 | 3336 | const arm_rfft_fast_instance_f32 * S, |
cactode | 59:8aa304768360 | 3337 | float32_t * p, float32_t * pOut, |
cactode | 59:8aa304768360 | 3338 | uint8_t ifftFlag); |
cactode | 59:8aa304768360 | 3339 | |
cactode | 59:8aa304768360 | 3340 | /** |
cactode | 59:8aa304768360 | 3341 | * @brief Instance structure for the floating-point DCT4/IDCT4 function. |
cactode | 59:8aa304768360 | 3342 | */ |
cactode | 59:8aa304768360 | 3343 | typedef struct |
cactode | 59:8aa304768360 | 3344 | { |
cactode | 59:8aa304768360 | 3345 | uint16_t N; /**< length of the DCT4. */ |
cactode | 59:8aa304768360 | 3346 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
cactode | 59:8aa304768360 | 3347 | float32_t normalize; /**< normalizing factor. */ |
cactode | 59:8aa304768360 | 3348 | const float32_t *pTwiddle; /**< points to the twiddle factor table. */ |
cactode | 59:8aa304768360 | 3349 | const float32_t *pCosFactor; /**< points to the cosFactor table. */ |
cactode | 59:8aa304768360 | 3350 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ |
cactode | 59:8aa304768360 | 3351 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
cactode | 59:8aa304768360 | 3352 | } arm_dct4_instance_f32; |
cactode | 59:8aa304768360 | 3353 | |
cactode | 59:8aa304768360 | 3354 | |
cactode | 59:8aa304768360 | 3355 | /** |
cactode | 59:8aa304768360 | 3356 | * @brief Initialization function for the floating-point DCT4/IDCT4. |
cactode | 59:8aa304768360 | 3357 | * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure. |
cactode | 59:8aa304768360 | 3358 | * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure. |
cactode | 59:8aa304768360 | 3359 | * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure. |
cactode | 59:8aa304768360 | 3360 | * @param[in] N length of the DCT4. |
cactode | 59:8aa304768360 | 3361 | * @param[in] Nby2 half of the length of the DCT4. |
cactode | 59:8aa304768360 | 3362 | * @param[in] normalize normalizing factor. |
cactode | 59:8aa304768360 | 3363 | * @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. |
cactode | 59:8aa304768360 | 3364 | */ |
cactode | 59:8aa304768360 | 3365 | arm_status arm_dct4_init_f32( |
cactode | 59:8aa304768360 | 3366 | arm_dct4_instance_f32 * S, |
cactode | 59:8aa304768360 | 3367 | arm_rfft_instance_f32 * S_RFFT, |
cactode | 59:8aa304768360 | 3368 | arm_cfft_radix4_instance_f32 * S_CFFT, |
cactode | 59:8aa304768360 | 3369 | uint16_t N, |
cactode | 59:8aa304768360 | 3370 | uint16_t Nby2, |
cactode | 59:8aa304768360 | 3371 | float32_t normalize); |
cactode | 59:8aa304768360 | 3372 | |
cactode | 59:8aa304768360 | 3373 | |
cactode | 59:8aa304768360 | 3374 | /** |
cactode | 59:8aa304768360 | 3375 | * @brief Processing function for the floating-point DCT4/IDCT4. |
cactode | 59:8aa304768360 | 3376 | * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure. |
cactode | 59:8aa304768360 | 3377 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 3378 | * @param[in,out] pInlineBuffer points to the in-place input and output buffer. |
cactode | 59:8aa304768360 | 3379 | */ |
cactode | 59:8aa304768360 | 3380 | void arm_dct4_f32( |
cactode | 59:8aa304768360 | 3381 | const arm_dct4_instance_f32 * S, |
cactode | 59:8aa304768360 | 3382 | float32_t * pState, |
cactode | 59:8aa304768360 | 3383 | float32_t * pInlineBuffer); |
cactode | 59:8aa304768360 | 3384 | |
cactode | 59:8aa304768360 | 3385 | |
cactode | 59:8aa304768360 | 3386 | /** |
cactode | 59:8aa304768360 | 3387 | * @brief Instance structure for the Q31 DCT4/IDCT4 function. |
cactode | 59:8aa304768360 | 3388 | */ |
cactode | 59:8aa304768360 | 3389 | typedef struct |
cactode | 59:8aa304768360 | 3390 | { |
cactode | 59:8aa304768360 | 3391 | uint16_t N; /**< length of the DCT4. */ |
cactode | 59:8aa304768360 | 3392 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
cactode | 59:8aa304768360 | 3393 | q31_t normalize; /**< normalizing factor. */ |
cactode | 59:8aa304768360 | 3394 | const q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
cactode | 59:8aa304768360 | 3395 | const q31_t *pCosFactor; /**< points to the cosFactor table. */ |
cactode | 59:8aa304768360 | 3396 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ |
cactode | 59:8aa304768360 | 3397 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
cactode | 59:8aa304768360 | 3398 | } arm_dct4_instance_q31; |
cactode | 59:8aa304768360 | 3399 | |
cactode | 59:8aa304768360 | 3400 | |
cactode | 59:8aa304768360 | 3401 | /** |
cactode | 59:8aa304768360 | 3402 | * @brief Initialization function for the Q31 DCT4/IDCT4. |
cactode | 59:8aa304768360 | 3403 | * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure. |
cactode | 59:8aa304768360 | 3404 | * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure |
cactode | 59:8aa304768360 | 3405 | * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure |
cactode | 59:8aa304768360 | 3406 | * @param[in] N length of the DCT4. |
cactode | 59:8aa304768360 | 3407 | * @param[in] Nby2 half of the length of the DCT4. |
cactode | 59:8aa304768360 | 3408 | * @param[in] normalize normalizing factor. |
cactode | 59:8aa304768360 | 3409 | * @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. |
cactode | 59:8aa304768360 | 3410 | */ |
cactode | 59:8aa304768360 | 3411 | arm_status arm_dct4_init_q31( |
cactode | 59:8aa304768360 | 3412 | arm_dct4_instance_q31 * S, |
cactode | 59:8aa304768360 | 3413 | arm_rfft_instance_q31 * S_RFFT, |
cactode | 59:8aa304768360 | 3414 | arm_cfft_radix4_instance_q31 * S_CFFT, |
cactode | 59:8aa304768360 | 3415 | uint16_t N, |
cactode | 59:8aa304768360 | 3416 | uint16_t Nby2, |
cactode | 59:8aa304768360 | 3417 | q31_t normalize); |
cactode | 59:8aa304768360 | 3418 | |
cactode | 59:8aa304768360 | 3419 | |
cactode | 59:8aa304768360 | 3420 | /** |
cactode | 59:8aa304768360 | 3421 | * @brief Processing function for the Q31 DCT4/IDCT4. |
cactode | 59:8aa304768360 | 3422 | * @param[in] S points to an instance of the Q31 DCT4 structure. |
cactode | 59:8aa304768360 | 3423 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 3424 | * @param[in,out] pInlineBuffer points to the in-place input and output buffer. |
cactode | 59:8aa304768360 | 3425 | */ |
cactode | 59:8aa304768360 | 3426 | void arm_dct4_q31( |
cactode | 59:8aa304768360 | 3427 | const arm_dct4_instance_q31 * S, |
cactode | 59:8aa304768360 | 3428 | q31_t * pState, |
cactode | 59:8aa304768360 | 3429 | q31_t * pInlineBuffer); |
cactode | 59:8aa304768360 | 3430 | |
cactode | 59:8aa304768360 | 3431 | |
cactode | 59:8aa304768360 | 3432 | /** |
cactode | 59:8aa304768360 | 3433 | * @brief Instance structure for the Q15 DCT4/IDCT4 function. |
cactode | 59:8aa304768360 | 3434 | */ |
cactode | 59:8aa304768360 | 3435 | typedef struct |
cactode | 59:8aa304768360 | 3436 | { |
cactode | 59:8aa304768360 | 3437 | uint16_t N; /**< length of the DCT4. */ |
cactode | 59:8aa304768360 | 3438 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
cactode | 59:8aa304768360 | 3439 | q15_t normalize; /**< normalizing factor. */ |
cactode | 59:8aa304768360 | 3440 | const q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
cactode | 59:8aa304768360 | 3441 | const q15_t *pCosFactor; /**< points to the cosFactor table. */ |
cactode | 59:8aa304768360 | 3442 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ |
cactode | 59:8aa304768360 | 3443 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
cactode | 59:8aa304768360 | 3444 | } arm_dct4_instance_q15; |
cactode | 59:8aa304768360 | 3445 | |
cactode | 59:8aa304768360 | 3446 | |
cactode | 59:8aa304768360 | 3447 | /** |
cactode | 59:8aa304768360 | 3448 | * @brief Initialization function for the Q15 DCT4/IDCT4. |
cactode | 59:8aa304768360 | 3449 | * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure. |
cactode | 59:8aa304768360 | 3450 | * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure. |
cactode | 59:8aa304768360 | 3451 | * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure. |
cactode | 59:8aa304768360 | 3452 | * @param[in] N length of the DCT4. |
cactode | 59:8aa304768360 | 3453 | * @param[in] Nby2 half of the length of the DCT4. |
cactode | 59:8aa304768360 | 3454 | * @param[in] normalize normalizing factor. |
cactode | 59:8aa304768360 | 3455 | * @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. |
cactode | 59:8aa304768360 | 3456 | */ |
cactode | 59:8aa304768360 | 3457 | arm_status arm_dct4_init_q15( |
cactode | 59:8aa304768360 | 3458 | arm_dct4_instance_q15 * S, |
cactode | 59:8aa304768360 | 3459 | arm_rfft_instance_q15 * S_RFFT, |
cactode | 59:8aa304768360 | 3460 | arm_cfft_radix4_instance_q15 * S_CFFT, |
cactode | 59:8aa304768360 | 3461 | uint16_t N, |
cactode | 59:8aa304768360 | 3462 | uint16_t Nby2, |
cactode | 59:8aa304768360 | 3463 | q15_t normalize); |
cactode | 59:8aa304768360 | 3464 | |
cactode | 59:8aa304768360 | 3465 | |
cactode | 59:8aa304768360 | 3466 | /** |
cactode | 59:8aa304768360 | 3467 | * @brief Processing function for the Q15 DCT4/IDCT4. |
cactode | 59:8aa304768360 | 3468 | * @param[in] S points to an instance of the Q15 DCT4 structure. |
cactode | 59:8aa304768360 | 3469 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 3470 | * @param[in,out] pInlineBuffer points to the in-place input and output buffer. |
cactode | 59:8aa304768360 | 3471 | */ |
cactode | 59:8aa304768360 | 3472 | void arm_dct4_q15( |
cactode | 59:8aa304768360 | 3473 | const arm_dct4_instance_q15 * S, |
cactode | 59:8aa304768360 | 3474 | q15_t * pState, |
cactode | 59:8aa304768360 | 3475 | q15_t * pInlineBuffer); |
cactode | 59:8aa304768360 | 3476 | |
cactode | 59:8aa304768360 | 3477 | |
cactode | 59:8aa304768360 | 3478 | /** |
cactode | 59:8aa304768360 | 3479 | * @brief Floating-point vector addition. |
cactode | 59:8aa304768360 | 3480 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3481 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3482 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3483 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3484 | */ |
cactode | 59:8aa304768360 | 3485 | void arm_add_f32( |
cactode | 59:8aa304768360 | 3486 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 3487 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 3488 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3489 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3490 | |
cactode | 59:8aa304768360 | 3491 | |
cactode | 59:8aa304768360 | 3492 | /** |
cactode | 59:8aa304768360 | 3493 | * @brief Q7 vector addition. |
cactode | 59:8aa304768360 | 3494 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3495 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3496 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3497 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3498 | */ |
cactode | 59:8aa304768360 | 3499 | void arm_add_q7( |
cactode | 59:8aa304768360 | 3500 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 3501 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 3502 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3503 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3504 | |
cactode | 59:8aa304768360 | 3505 | |
cactode | 59:8aa304768360 | 3506 | /** |
cactode | 59:8aa304768360 | 3507 | * @brief Q15 vector addition. |
cactode | 59:8aa304768360 | 3508 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3509 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3510 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3511 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3512 | */ |
cactode | 59:8aa304768360 | 3513 | void arm_add_q15( |
cactode | 59:8aa304768360 | 3514 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 3515 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 3516 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3517 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3518 | |
cactode | 59:8aa304768360 | 3519 | |
cactode | 59:8aa304768360 | 3520 | /** |
cactode | 59:8aa304768360 | 3521 | * @brief Q31 vector addition. |
cactode | 59:8aa304768360 | 3522 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3523 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3524 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3525 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3526 | */ |
cactode | 59:8aa304768360 | 3527 | void arm_add_q31( |
cactode | 59:8aa304768360 | 3528 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 3529 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 3530 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3531 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3532 | |
cactode | 59:8aa304768360 | 3533 | |
cactode | 59:8aa304768360 | 3534 | /** |
cactode | 59:8aa304768360 | 3535 | * @brief Floating-point vector subtraction. |
cactode | 59:8aa304768360 | 3536 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3537 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3538 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3539 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3540 | */ |
cactode | 59:8aa304768360 | 3541 | void arm_sub_f32( |
cactode | 59:8aa304768360 | 3542 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 3543 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 3544 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3545 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3546 | |
cactode | 59:8aa304768360 | 3547 | |
cactode | 59:8aa304768360 | 3548 | /** |
cactode | 59:8aa304768360 | 3549 | * @brief Q7 vector subtraction. |
cactode | 59:8aa304768360 | 3550 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3551 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3552 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3553 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3554 | */ |
cactode | 59:8aa304768360 | 3555 | void arm_sub_q7( |
cactode | 59:8aa304768360 | 3556 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 3557 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 3558 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3559 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3560 | |
cactode | 59:8aa304768360 | 3561 | |
cactode | 59:8aa304768360 | 3562 | /** |
cactode | 59:8aa304768360 | 3563 | * @brief Q15 vector subtraction. |
cactode | 59:8aa304768360 | 3564 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3565 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3566 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3567 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3568 | */ |
cactode | 59:8aa304768360 | 3569 | void arm_sub_q15( |
cactode | 59:8aa304768360 | 3570 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 3571 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 3572 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3573 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3574 | |
cactode | 59:8aa304768360 | 3575 | |
cactode | 59:8aa304768360 | 3576 | /** |
cactode | 59:8aa304768360 | 3577 | * @brief Q31 vector subtraction. |
cactode | 59:8aa304768360 | 3578 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3579 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3580 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3581 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3582 | */ |
cactode | 59:8aa304768360 | 3583 | void arm_sub_q31( |
cactode | 59:8aa304768360 | 3584 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 3585 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 3586 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3587 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3588 | |
cactode | 59:8aa304768360 | 3589 | |
cactode | 59:8aa304768360 | 3590 | /** |
cactode | 59:8aa304768360 | 3591 | * @brief Multiplies a floating-point vector by a scalar. |
cactode | 59:8aa304768360 | 3592 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3593 | * @param[in] scale scale factor to be applied |
cactode | 59:8aa304768360 | 3594 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3595 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3596 | */ |
cactode | 59:8aa304768360 | 3597 | void arm_scale_f32( |
cactode | 59:8aa304768360 | 3598 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 3599 | float32_t scale, |
cactode | 59:8aa304768360 | 3600 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3601 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3602 | |
cactode | 59:8aa304768360 | 3603 | |
cactode | 59:8aa304768360 | 3604 | /** |
cactode | 59:8aa304768360 | 3605 | * @brief Multiplies a Q7 vector by a scalar. |
cactode | 59:8aa304768360 | 3606 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3607 | * @param[in] scaleFract fractional portion of the scale value |
cactode | 59:8aa304768360 | 3608 | * @param[in] shift number of bits to shift the result by |
cactode | 59:8aa304768360 | 3609 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3610 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3611 | */ |
cactode | 59:8aa304768360 | 3612 | void arm_scale_q7( |
cactode | 59:8aa304768360 | 3613 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 3614 | q7_t scaleFract, |
cactode | 59:8aa304768360 | 3615 | int8_t shift, |
cactode | 59:8aa304768360 | 3616 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3617 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3618 | |
cactode | 59:8aa304768360 | 3619 | |
cactode | 59:8aa304768360 | 3620 | /** |
cactode | 59:8aa304768360 | 3621 | * @brief Multiplies a Q15 vector by a scalar. |
cactode | 59:8aa304768360 | 3622 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3623 | * @param[in] scaleFract fractional portion of the scale value |
cactode | 59:8aa304768360 | 3624 | * @param[in] shift number of bits to shift the result by |
cactode | 59:8aa304768360 | 3625 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3626 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3627 | */ |
cactode | 59:8aa304768360 | 3628 | void arm_scale_q15( |
cactode | 59:8aa304768360 | 3629 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 3630 | q15_t scaleFract, |
cactode | 59:8aa304768360 | 3631 | int8_t shift, |
cactode | 59:8aa304768360 | 3632 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3633 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3634 | |
cactode | 59:8aa304768360 | 3635 | |
cactode | 59:8aa304768360 | 3636 | /** |
cactode | 59:8aa304768360 | 3637 | * @brief Multiplies a Q31 vector by a scalar. |
cactode | 59:8aa304768360 | 3638 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3639 | * @param[in] scaleFract fractional portion of the scale value |
cactode | 59:8aa304768360 | 3640 | * @param[in] shift number of bits to shift the result by |
cactode | 59:8aa304768360 | 3641 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3642 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3643 | */ |
cactode | 59:8aa304768360 | 3644 | void arm_scale_q31( |
cactode | 59:8aa304768360 | 3645 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 3646 | q31_t scaleFract, |
cactode | 59:8aa304768360 | 3647 | int8_t shift, |
cactode | 59:8aa304768360 | 3648 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3649 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3650 | |
cactode | 59:8aa304768360 | 3651 | |
cactode | 59:8aa304768360 | 3652 | /** |
cactode | 59:8aa304768360 | 3653 | * @brief Q7 vector absolute value. |
cactode | 59:8aa304768360 | 3654 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 3655 | * @param[out] pDst points to the output buffer |
cactode | 59:8aa304768360 | 3656 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3657 | */ |
cactode | 59:8aa304768360 | 3658 | void arm_abs_q7( |
cactode | 59:8aa304768360 | 3659 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 3660 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3661 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3662 | |
cactode | 59:8aa304768360 | 3663 | |
cactode | 59:8aa304768360 | 3664 | /** |
cactode | 59:8aa304768360 | 3665 | * @brief Floating-point vector absolute value. |
cactode | 59:8aa304768360 | 3666 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 3667 | * @param[out] pDst points to the output buffer |
cactode | 59:8aa304768360 | 3668 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3669 | */ |
cactode | 59:8aa304768360 | 3670 | void arm_abs_f32( |
cactode | 59:8aa304768360 | 3671 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 3672 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3673 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3674 | |
cactode | 59:8aa304768360 | 3675 | |
cactode | 59:8aa304768360 | 3676 | /** |
cactode | 59:8aa304768360 | 3677 | * @brief Q15 vector absolute value. |
cactode | 59:8aa304768360 | 3678 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 3679 | * @param[out] pDst points to the output buffer |
cactode | 59:8aa304768360 | 3680 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3681 | */ |
cactode | 59:8aa304768360 | 3682 | void arm_abs_q15( |
cactode | 59:8aa304768360 | 3683 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 3684 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3685 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3686 | |
cactode | 59:8aa304768360 | 3687 | |
cactode | 59:8aa304768360 | 3688 | /** |
cactode | 59:8aa304768360 | 3689 | * @brief Q31 vector absolute value. |
cactode | 59:8aa304768360 | 3690 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 3691 | * @param[out] pDst points to the output buffer |
cactode | 59:8aa304768360 | 3692 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3693 | */ |
cactode | 59:8aa304768360 | 3694 | void arm_abs_q31( |
cactode | 59:8aa304768360 | 3695 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 3696 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3697 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3698 | |
cactode | 59:8aa304768360 | 3699 | |
cactode | 59:8aa304768360 | 3700 | /** |
cactode | 59:8aa304768360 | 3701 | * @brief Dot product of floating-point vectors. |
cactode | 59:8aa304768360 | 3702 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3703 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3704 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3705 | * @param[out] result output result returned here |
cactode | 59:8aa304768360 | 3706 | */ |
cactode | 59:8aa304768360 | 3707 | void arm_dot_prod_f32( |
cactode | 59:8aa304768360 | 3708 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 3709 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 3710 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 3711 | float32_t * result); |
cactode | 59:8aa304768360 | 3712 | |
cactode | 59:8aa304768360 | 3713 | |
cactode | 59:8aa304768360 | 3714 | /** |
cactode | 59:8aa304768360 | 3715 | * @brief Dot product of Q7 vectors. |
cactode | 59:8aa304768360 | 3716 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3717 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3718 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3719 | * @param[out] result output result returned here |
cactode | 59:8aa304768360 | 3720 | */ |
cactode | 59:8aa304768360 | 3721 | void arm_dot_prod_q7( |
cactode | 59:8aa304768360 | 3722 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 3723 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 3724 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 3725 | q31_t * result); |
cactode | 59:8aa304768360 | 3726 | |
cactode | 59:8aa304768360 | 3727 | |
cactode | 59:8aa304768360 | 3728 | /** |
cactode | 59:8aa304768360 | 3729 | * @brief Dot product of Q15 vectors. |
cactode | 59:8aa304768360 | 3730 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3731 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3732 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3733 | * @param[out] result output result returned here |
cactode | 59:8aa304768360 | 3734 | */ |
cactode | 59:8aa304768360 | 3735 | void arm_dot_prod_q15( |
cactode | 59:8aa304768360 | 3736 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 3737 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 3738 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 3739 | q63_t * result); |
cactode | 59:8aa304768360 | 3740 | |
cactode | 59:8aa304768360 | 3741 | |
cactode | 59:8aa304768360 | 3742 | /** |
cactode | 59:8aa304768360 | 3743 | * @brief Dot product of Q31 vectors. |
cactode | 59:8aa304768360 | 3744 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 3745 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 3746 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 3747 | * @param[out] result output result returned here |
cactode | 59:8aa304768360 | 3748 | */ |
cactode | 59:8aa304768360 | 3749 | void arm_dot_prod_q31( |
cactode | 59:8aa304768360 | 3750 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 3751 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 3752 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 3753 | q63_t * result); |
cactode | 59:8aa304768360 | 3754 | |
cactode | 59:8aa304768360 | 3755 | |
cactode | 59:8aa304768360 | 3756 | /** |
cactode | 59:8aa304768360 | 3757 | * @brief Shifts the elements of a Q7 vector a specified number of bits. |
cactode | 59:8aa304768360 | 3758 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3759 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
cactode | 59:8aa304768360 | 3760 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3761 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3762 | */ |
cactode | 59:8aa304768360 | 3763 | void arm_shift_q7( |
cactode | 59:8aa304768360 | 3764 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 3765 | int8_t shiftBits, |
cactode | 59:8aa304768360 | 3766 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3767 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3768 | |
cactode | 59:8aa304768360 | 3769 | |
cactode | 59:8aa304768360 | 3770 | /** |
cactode | 59:8aa304768360 | 3771 | * @brief Shifts the elements of a Q15 vector a specified number of bits. |
cactode | 59:8aa304768360 | 3772 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3773 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
cactode | 59:8aa304768360 | 3774 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3775 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3776 | */ |
cactode | 59:8aa304768360 | 3777 | void arm_shift_q15( |
cactode | 59:8aa304768360 | 3778 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 3779 | int8_t shiftBits, |
cactode | 59:8aa304768360 | 3780 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3781 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3782 | |
cactode | 59:8aa304768360 | 3783 | |
cactode | 59:8aa304768360 | 3784 | /** |
cactode | 59:8aa304768360 | 3785 | * @brief Shifts the elements of a Q31 vector a specified number of bits. |
cactode | 59:8aa304768360 | 3786 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3787 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
cactode | 59:8aa304768360 | 3788 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3789 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3790 | */ |
cactode | 59:8aa304768360 | 3791 | void arm_shift_q31( |
cactode | 59:8aa304768360 | 3792 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 3793 | int8_t shiftBits, |
cactode | 59:8aa304768360 | 3794 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3795 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3796 | |
cactode | 59:8aa304768360 | 3797 | |
cactode | 59:8aa304768360 | 3798 | /** |
cactode | 59:8aa304768360 | 3799 | * @brief Adds a constant offset to a floating-point vector. |
cactode | 59:8aa304768360 | 3800 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3801 | * @param[in] offset is the offset to be added |
cactode | 59:8aa304768360 | 3802 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3803 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3804 | */ |
cactode | 59:8aa304768360 | 3805 | void arm_offset_f32( |
cactode | 59:8aa304768360 | 3806 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 3807 | float32_t offset, |
cactode | 59:8aa304768360 | 3808 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3809 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3810 | |
cactode | 59:8aa304768360 | 3811 | |
cactode | 59:8aa304768360 | 3812 | /** |
cactode | 59:8aa304768360 | 3813 | * @brief Adds a constant offset to a Q7 vector. |
cactode | 59:8aa304768360 | 3814 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3815 | * @param[in] offset is the offset to be added |
cactode | 59:8aa304768360 | 3816 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3817 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3818 | */ |
cactode | 59:8aa304768360 | 3819 | void arm_offset_q7( |
cactode | 59:8aa304768360 | 3820 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 3821 | q7_t offset, |
cactode | 59:8aa304768360 | 3822 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3823 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3824 | |
cactode | 59:8aa304768360 | 3825 | |
cactode | 59:8aa304768360 | 3826 | /** |
cactode | 59:8aa304768360 | 3827 | * @brief Adds a constant offset to a Q15 vector. |
cactode | 59:8aa304768360 | 3828 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3829 | * @param[in] offset is the offset to be added |
cactode | 59:8aa304768360 | 3830 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3831 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3832 | */ |
cactode | 59:8aa304768360 | 3833 | void arm_offset_q15( |
cactode | 59:8aa304768360 | 3834 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 3835 | q15_t offset, |
cactode | 59:8aa304768360 | 3836 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3837 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3838 | |
cactode | 59:8aa304768360 | 3839 | |
cactode | 59:8aa304768360 | 3840 | /** |
cactode | 59:8aa304768360 | 3841 | * @brief Adds a constant offset to a Q31 vector. |
cactode | 59:8aa304768360 | 3842 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3843 | * @param[in] offset is the offset to be added |
cactode | 59:8aa304768360 | 3844 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3845 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3846 | */ |
cactode | 59:8aa304768360 | 3847 | void arm_offset_q31( |
cactode | 59:8aa304768360 | 3848 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 3849 | q31_t offset, |
cactode | 59:8aa304768360 | 3850 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3851 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3852 | |
cactode | 59:8aa304768360 | 3853 | |
cactode | 59:8aa304768360 | 3854 | /** |
cactode | 59:8aa304768360 | 3855 | * @brief Negates the elements of a floating-point vector. |
cactode | 59:8aa304768360 | 3856 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3857 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3858 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3859 | */ |
cactode | 59:8aa304768360 | 3860 | void arm_negate_f32( |
cactode | 59:8aa304768360 | 3861 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 3862 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3863 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3864 | |
cactode | 59:8aa304768360 | 3865 | |
cactode | 59:8aa304768360 | 3866 | /** |
cactode | 59:8aa304768360 | 3867 | * @brief Negates the elements of a Q7 vector. |
cactode | 59:8aa304768360 | 3868 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3869 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3870 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3871 | */ |
cactode | 59:8aa304768360 | 3872 | void arm_negate_q7( |
cactode | 59:8aa304768360 | 3873 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 3874 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3875 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3876 | |
cactode | 59:8aa304768360 | 3877 | |
cactode | 59:8aa304768360 | 3878 | /** |
cactode | 59:8aa304768360 | 3879 | * @brief Negates the elements of a Q15 vector. |
cactode | 59:8aa304768360 | 3880 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3881 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3882 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3883 | */ |
cactode | 59:8aa304768360 | 3884 | void arm_negate_q15( |
cactode | 59:8aa304768360 | 3885 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 3886 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3887 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3888 | |
cactode | 59:8aa304768360 | 3889 | |
cactode | 59:8aa304768360 | 3890 | /** |
cactode | 59:8aa304768360 | 3891 | * @brief Negates the elements of a Q31 vector. |
cactode | 59:8aa304768360 | 3892 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 3893 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 3894 | * @param[in] blockSize number of samples in the vector |
cactode | 59:8aa304768360 | 3895 | */ |
cactode | 59:8aa304768360 | 3896 | void arm_negate_q31( |
cactode | 59:8aa304768360 | 3897 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 3898 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3899 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3900 | |
cactode | 59:8aa304768360 | 3901 | |
cactode | 59:8aa304768360 | 3902 | /** |
cactode | 59:8aa304768360 | 3903 | * @brief Copies the elements of a floating-point vector. |
cactode | 59:8aa304768360 | 3904 | * @param[in] pSrc input pointer |
cactode | 59:8aa304768360 | 3905 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3906 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3907 | */ |
cactode | 59:8aa304768360 | 3908 | void arm_copy_f32( |
cactode | 59:8aa304768360 | 3909 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 3910 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3911 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3912 | |
cactode | 59:8aa304768360 | 3913 | |
cactode | 59:8aa304768360 | 3914 | /** |
cactode | 59:8aa304768360 | 3915 | * @brief Copies the elements of a Q7 vector. |
cactode | 59:8aa304768360 | 3916 | * @param[in] pSrc input pointer |
cactode | 59:8aa304768360 | 3917 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3918 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3919 | */ |
cactode | 59:8aa304768360 | 3920 | void arm_copy_q7( |
cactode | 59:8aa304768360 | 3921 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 3922 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3923 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3924 | |
cactode | 59:8aa304768360 | 3925 | |
cactode | 59:8aa304768360 | 3926 | /** |
cactode | 59:8aa304768360 | 3927 | * @brief Copies the elements of a Q15 vector. |
cactode | 59:8aa304768360 | 3928 | * @param[in] pSrc input pointer |
cactode | 59:8aa304768360 | 3929 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3930 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3931 | */ |
cactode | 59:8aa304768360 | 3932 | void arm_copy_q15( |
cactode | 59:8aa304768360 | 3933 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 3934 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3935 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3936 | |
cactode | 59:8aa304768360 | 3937 | |
cactode | 59:8aa304768360 | 3938 | /** |
cactode | 59:8aa304768360 | 3939 | * @brief Copies the elements of a Q31 vector. |
cactode | 59:8aa304768360 | 3940 | * @param[in] pSrc input pointer |
cactode | 59:8aa304768360 | 3941 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3942 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3943 | */ |
cactode | 59:8aa304768360 | 3944 | void arm_copy_q31( |
cactode | 59:8aa304768360 | 3945 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 3946 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3947 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3948 | |
cactode | 59:8aa304768360 | 3949 | |
cactode | 59:8aa304768360 | 3950 | /** |
cactode | 59:8aa304768360 | 3951 | * @brief Fills a constant value into a floating-point vector. |
cactode | 59:8aa304768360 | 3952 | * @param[in] value input value to be filled |
cactode | 59:8aa304768360 | 3953 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3954 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3955 | */ |
cactode | 59:8aa304768360 | 3956 | void arm_fill_f32( |
cactode | 59:8aa304768360 | 3957 | float32_t value, |
cactode | 59:8aa304768360 | 3958 | float32_t * pDst, |
cactode | 59:8aa304768360 | 3959 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3960 | |
cactode | 59:8aa304768360 | 3961 | |
cactode | 59:8aa304768360 | 3962 | /** |
cactode | 59:8aa304768360 | 3963 | * @brief Fills a constant value into a Q7 vector. |
cactode | 59:8aa304768360 | 3964 | * @param[in] value input value to be filled |
cactode | 59:8aa304768360 | 3965 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3966 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3967 | */ |
cactode | 59:8aa304768360 | 3968 | void arm_fill_q7( |
cactode | 59:8aa304768360 | 3969 | q7_t value, |
cactode | 59:8aa304768360 | 3970 | q7_t * pDst, |
cactode | 59:8aa304768360 | 3971 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3972 | |
cactode | 59:8aa304768360 | 3973 | |
cactode | 59:8aa304768360 | 3974 | /** |
cactode | 59:8aa304768360 | 3975 | * @brief Fills a constant value into a Q15 vector. |
cactode | 59:8aa304768360 | 3976 | * @param[in] value input value to be filled |
cactode | 59:8aa304768360 | 3977 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3978 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3979 | */ |
cactode | 59:8aa304768360 | 3980 | void arm_fill_q15( |
cactode | 59:8aa304768360 | 3981 | q15_t value, |
cactode | 59:8aa304768360 | 3982 | q15_t * pDst, |
cactode | 59:8aa304768360 | 3983 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3984 | |
cactode | 59:8aa304768360 | 3985 | |
cactode | 59:8aa304768360 | 3986 | /** |
cactode | 59:8aa304768360 | 3987 | * @brief Fills a constant value into a Q31 vector. |
cactode | 59:8aa304768360 | 3988 | * @param[in] value input value to be filled |
cactode | 59:8aa304768360 | 3989 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 3990 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 3991 | */ |
cactode | 59:8aa304768360 | 3992 | void arm_fill_q31( |
cactode | 59:8aa304768360 | 3993 | q31_t value, |
cactode | 59:8aa304768360 | 3994 | q31_t * pDst, |
cactode | 59:8aa304768360 | 3995 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 3996 | |
cactode | 59:8aa304768360 | 3997 | |
cactode | 59:8aa304768360 | 3998 | /** |
cactode | 59:8aa304768360 | 3999 | * @brief Convolution of floating-point sequences. |
cactode | 59:8aa304768360 | 4000 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4001 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4002 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4003 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4004 | * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4005 | */ |
cactode | 59:8aa304768360 | 4006 | void arm_conv_f32( |
cactode | 59:8aa304768360 | 4007 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 4008 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4009 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 4010 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4011 | float32_t * pDst); |
cactode | 59:8aa304768360 | 4012 | |
cactode | 59:8aa304768360 | 4013 | |
cactode | 59:8aa304768360 | 4014 | /** |
cactode | 59:8aa304768360 | 4015 | * @brief Convolution of Q15 sequences. |
cactode | 59:8aa304768360 | 4016 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4017 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4018 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4019 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4020 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4021 | * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 4022 | * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 4023 | */ |
cactode | 59:8aa304768360 | 4024 | void arm_conv_opt_q15( |
cactode | 59:8aa304768360 | 4025 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4026 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4027 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4028 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4029 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4030 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 4031 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 4032 | |
cactode | 59:8aa304768360 | 4033 | |
cactode | 59:8aa304768360 | 4034 | /** |
cactode | 59:8aa304768360 | 4035 | * @brief Convolution of Q15 sequences. |
cactode | 59:8aa304768360 | 4036 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4037 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4038 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4039 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4040 | * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4041 | */ |
cactode | 59:8aa304768360 | 4042 | void arm_conv_q15( |
cactode | 59:8aa304768360 | 4043 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4044 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4045 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4046 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4047 | q15_t * pDst); |
cactode | 59:8aa304768360 | 4048 | |
cactode | 59:8aa304768360 | 4049 | |
cactode | 59:8aa304768360 | 4050 | /** |
cactode | 59:8aa304768360 | 4051 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 4052 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4053 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4054 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4055 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4056 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4057 | */ |
cactode | 59:8aa304768360 | 4058 | void arm_conv_fast_q15( |
cactode | 59:8aa304768360 | 4059 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4060 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4061 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4062 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4063 | q15_t * pDst); |
cactode | 59:8aa304768360 | 4064 | |
cactode | 59:8aa304768360 | 4065 | |
cactode | 59:8aa304768360 | 4066 | /** |
cactode | 59:8aa304768360 | 4067 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 4068 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4069 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4070 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4071 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4072 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4073 | * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 4074 | * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 4075 | */ |
cactode | 59:8aa304768360 | 4076 | void arm_conv_fast_opt_q15( |
cactode | 59:8aa304768360 | 4077 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4078 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4079 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4080 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4081 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4082 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 4083 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 4084 | |
cactode | 59:8aa304768360 | 4085 | |
cactode | 59:8aa304768360 | 4086 | /** |
cactode | 59:8aa304768360 | 4087 | * @brief Convolution of Q31 sequences. |
cactode | 59:8aa304768360 | 4088 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4089 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4090 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4091 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4092 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4093 | */ |
cactode | 59:8aa304768360 | 4094 | void arm_conv_q31( |
cactode | 59:8aa304768360 | 4095 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 4096 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4097 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 4098 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4099 | q31_t * pDst); |
cactode | 59:8aa304768360 | 4100 | |
cactode | 59:8aa304768360 | 4101 | |
cactode | 59:8aa304768360 | 4102 | /** |
cactode | 59:8aa304768360 | 4103 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 4104 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4105 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4106 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4107 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4108 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4109 | */ |
cactode | 59:8aa304768360 | 4110 | void arm_conv_fast_q31( |
cactode | 59:8aa304768360 | 4111 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 4112 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4113 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 4114 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4115 | q31_t * pDst); |
cactode | 59:8aa304768360 | 4116 | |
cactode | 59:8aa304768360 | 4117 | |
cactode | 59:8aa304768360 | 4118 | /** |
cactode | 59:8aa304768360 | 4119 | * @brief Convolution of Q7 sequences. |
cactode | 59:8aa304768360 | 4120 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4121 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4122 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4123 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4124 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4125 | * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 4126 | * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 4127 | */ |
cactode | 59:8aa304768360 | 4128 | void arm_conv_opt_q7( |
cactode | 59:8aa304768360 | 4129 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 4130 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4131 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 4132 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4133 | q7_t * pDst, |
cactode | 59:8aa304768360 | 4134 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 4135 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 4136 | |
cactode | 59:8aa304768360 | 4137 | |
cactode | 59:8aa304768360 | 4138 | /** |
cactode | 59:8aa304768360 | 4139 | * @brief Convolution of Q7 sequences. |
cactode | 59:8aa304768360 | 4140 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4141 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4142 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4143 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4144 | * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. |
cactode | 59:8aa304768360 | 4145 | */ |
cactode | 59:8aa304768360 | 4146 | void arm_conv_q7( |
cactode | 59:8aa304768360 | 4147 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 4148 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4149 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 4150 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4151 | q7_t * pDst); |
cactode | 59:8aa304768360 | 4152 | |
cactode | 59:8aa304768360 | 4153 | |
cactode | 59:8aa304768360 | 4154 | /** |
cactode | 59:8aa304768360 | 4155 | * @brief Partial convolution of floating-point sequences. |
cactode | 59:8aa304768360 | 4156 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4157 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4158 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4159 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4160 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4161 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4162 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4163 | * @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]. |
cactode | 59:8aa304768360 | 4164 | */ |
cactode | 59:8aa304768360 | 4165 | arm_status arm_conv_partial_f32( |
cactode | 59:8aa304768360 | 4166 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 4167 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4168 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 4169 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4170 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4171 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4172 | uint32_t numPoints); |
cactode | 59:8aa304768360 | 4173 | |
cactode | 59:8aa304768360 | 4174 | |
cactode | 59:8aa304768360 | 4175 | /** |
cactode | 59:8aa304768360 | 4176 | * @brief Partial convolution of Q15 sequences. |
cactode | 59:8aa304768360 | 4177 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4178 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4179 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4180 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4181 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4182 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4183 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4184 | * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 4185 | * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 4186 | * @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]. |
cactode | 59:8aa304768360 | 4187 | */ |
cactode | 59:8aa304768360 | 4188 | arm_status arm_conv_partial_opt_q15( |
cactode | 59:8aa304768360 | 4189 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4190 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4191 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4192 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4193 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4194 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4195 | uint32_t numPoints, |
cactode | 59:8aa304768360 | 4196 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 4197 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 4198 | |
cactode | 59:8aa304768360 | 4199 | |
cactode | 59:8aa304768360 | 4200 | /** |
cactode | 59:8aa304768360 | 4201 | * @brief Partial convolution of Q15 sequences. |
cactode | 59:8aa304768360 | 4202 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4203 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4204 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4205 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4206 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4207 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4208 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4209 | * @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]. |
cactode | 59:8aa304768360 | 4210 | */ |
cactode | 59:8aa304768360 | 4211 | arm_status arm_conv_partial_q15( |
cactode | 59:8aa304768360 | 4212 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4213 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4214 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4215 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4216 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4217 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4218 | uint32_t numPoints); |
cactode | 59:8aa304768360 | 4219 | |
cactode | 59:8aa304768360 | 4220 | |
cactode | 59:8aa304768360 | 4221 | /** |
cactode | 59:8aa304768360 | 4222 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 4223 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4224 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4225 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4226 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4227 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4228 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4229 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4230 | * @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]. |
cactode | 59:8aa304768360 | 4231 | */ |
cactode | 59:8aa304768360 | 4232 | arm_status arm_conv_partial_fast_q15( |
cactode | 59:8aa304768360 | 4233 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4234 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4235 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4236 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4237 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4238 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4239 | uint32_t numPoints); |
cactode | 59:8aa304768360 | 4240 | |
cactode | 59:8aa304768360 | 4241 | |
cactode | 59:8aa304768360 | 4242 | /** |
cactode | 59:8aa304768360 | 4243 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 4244 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4245 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4246 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4247 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4248 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4249 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4250 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4251 | * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 4252 | * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 4253 | * @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]. |
cactode | 59:8aa304768360 | 4254 | */ |
cactode | 59:8aa304768360 | 4255 | arm_status arm_conv_partial_fast_opt_q15( |
cactode | 59:8aa304768360 | 4256 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 4257 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4258 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 4259 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4260 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4261 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4262 | uint32_t numPoints, |
cactode | 59:8aa304768360 | 4263 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 4264 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 4265 | |
cactode | 59:8aa304768360 | 4266 | |
cactode | 59:8aa304768360 | 4267 | /** |
cactode | 59:8aa304768360 | 4268 | * @brief Partial convolution of Q31 sequences. |
cactode | 59:8aa304768360 | 4269 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4270 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4271 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4272 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4273 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4274 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4275 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4276 | * @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]. |
cactode | 59:8aa304768360 | 4277 | */ |
cactode | 59:8aa304768360 | 4278 | arm_status arm_conv_partial_q31( |
cactode | 59:8aa304768360 | 4279 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 4280 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4281 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 4282 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4283 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4284 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4285 | uint32_t numPoints); |
cactode | 59:8aa304768360 | 4286 | |
cactode | 59:8aa304768360 | 4287 | |
cactode | 59:8aa304768360 | 4288 | /** |
cactode | 59:8aa304768360 | 4289 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
cactode | 59:8aa304768360 | 4290 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4291 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4292 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4293 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4294 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4295 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4296 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4297 | * @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]. |
cactode | 59:8aa304768360 | 4298 | */ |
cactode | 59:8aa304768360 | 4299 | arm_status arm_conv_partial_fast_q31( |
cactode | 59:8aa304768360 | 4300 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 4301 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4302 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 4303 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4304 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4305 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4306 | uint32_t numPoints); |
cactode | 59:8aa304768360 | 4307 | |
cactode | 59:8aa304768360 | 4308 | |
cactode | 59:8aa304768360 | 4309 | /** |
cactode | 59:8aa304768360 | 4310 | * @brief Partial convolution of Q7 sequences |
cactode | 59:8aa304768360 | 4311 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4312 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4313 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4314 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4315 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4316 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4317 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4318 | * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 4319 | * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 4320 | * @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]. |
cactode | 59:8aa304768360 | 4321 | */ |
cactode | 59:8aa304768360 | 4322 | arm_status arm_conv_partial_opt_q7( |
cactode | 59:8aa304768360 | 4323 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 4324 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4325 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 4326 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4327 | q7_t * pDst, |
cactode | 59:8aa304768360 | 4328 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4329 | uint32_t numPoints, |
cactode | 59:8aa304768360 | 4330 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 4331 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 4332 | |
cactode | 59:8aa304768360 | 4333 | |
cactode | 59:8aa304768360 | 4334 | /** |
cactode | 59:8aa304768360 | 4335 | * @brief Partial convolution of Q7 sequences. |
cactode | 59:8aa304768360 | 4336 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 4337 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 4338 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 4339 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 4340 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4341 | * @param[in] firstIndex is the first output sample to start with. |
cactode | 59:8aa304768360 | 4342 | * @param[in] numPoints is the number of output points to be computed. |
cactode | 59:8aa304768360 | 4343 | * @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]. |
cactode | 59:8aa304768360 | 4344 | */ |
cactode | 59:8aa304768360 | 4345 | arm_status arm_conv_partial_q7( |
cactode | 59:8aa304768360 | 4346 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 4347 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 4348 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 4349 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 4350 | q7_t * pDst, |
cactode | 59:8aa304768360 | 4351 | uint32_t firstIndex, |
cactode | 59:8aa304768360 | 4352 | uint32_t numPoints); |
cactode | 59:8aa304768360 | 4353 | |
cactode | 59:8aa304768360 | 4354 | |
cactode | 59:8aa304768360 | 4355 | /** |
cactode | 59:8aa304768360 | 4356 | * @brief Instance structure for the Q15 FIR decimator. |
cactode | 59:8aa304768360 | 4357 | */ |
cactode | 59:8aa304768360 | 4358 | typedef struct |
cactode | 59:8aa304768360 | 4359 | { |
cactode | 59:8aa304768360 | 4360 | uint8_t M; /**< decimation factor. */ |
cactode | 59:8aa304768360 | 4361 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 4362 | const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 4363 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 4364 | } arm_fir_decimate_instance_q15; |
cactode | 59:8aa304768360 | 4365 | |
cactode | 59:8aa304768360 | 4366 | /** |
cactode | 59:8aa304768360 | 4367 | * @brief Instance structure for the Q31 FIR decimator. |
cactode | 59:8aa304768360 | 4368 | */ |
cactode | 59:8aa304768360 | 4369 | typedef struct |
cactode | 59:8aa304768360 | 4370 | { |
cactode | 59:8aa304768360 | 4371 | uint8_t M; /**< decimation factor. */ |
cactode | 59:8aa304768360 | 4372 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 4373 | const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 4374 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 4375 | } arm_fir_decimate_instance_q31; |
cactode | 59:8aa304768360 | 4376 | |
cactode | 59:8aa304768360 | 4377 | /** |
cactode | 59:8aa304768360 | 4378 | @brief Instance structure for floating-point FIR decimator. |
cactode | 59:8aa304768360 | 4379 | */ |
cactode | 59:8aa304768360 | 4380 | typedef struct |
cactode | 59:8aa304768360 | 4381 | { |
cactode | 59:8aa304768360 | 4382 | uint8_t M; /**< decimation factor. */ |
cactode | 59:8aa304768360 | 4383 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 4384 | const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 4385 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 4386 | } arm_fir_decimate_instance_f32; |
cactode | 59:8aa304768360 | 4387 | |
cactode | 59:8aa304768360 | 4388 | |
cactode | 59:8aa304768360 | 4389 | /** |
cactode | 59:8aa304768360 | 4390 | @brief Processing function for floating-point FIR decimator. |
cactode | 59:8aa304768360 | 4391 | @param[in] S points to an instance of the floating-point FIR decimator structure |
cactode | 59:8aa304768360 | 4392 | @param[in] pSrc points to the block of input data |
cactode | 59:8aa304768360 | 4393 | @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4394 | @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 4395 | */ |
cactode | 59:8aa304768360 | 4396 | void arm_fir_decimate_f32( |
cactode | 59:8aa304768360 | 4397 | const arm_fir_decimate_instance_f32 * S, |
cactode | 59:8aa304768360 | 4398 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 4399 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4400 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4401 | |
cactode | 59:8aa304768360 | 4402 | |
cactode | 59:8aa304768360 | 4403 | /** |
cactode | 59:8aa304768360 | 4404 | @brief Initialization function for the floating-point FIR decimator. |
cactode | 59:8aa304768360 | 4405 | @param[in,out] S points to an instance of the floating-point FIR decimator structure |
cactode | 59:8aa304768360 | 4406 | @param[in] numTaps number of coefficients in the filter |
cactode | 59:8aa304768360 | 4407 | @param[in] M decimation factor |
cactode | 59:8aa304768360 | 4408 | @param[in] pCoeffs points to the filter coefficients |
cactode | 59:8aa304768360 | 4409 | @param[in] pState points to the state buffer |
cactode | 59:8aa304768360 | 4410 | @param[in] blockSize number of input samples to process per call |
cactode | 59:8aa304768360 | 4411 | @return execution status |
cactode | 59:8aa304768360 | 4412 | - \ref ARM_MATH_SUCCESS : Operation successful |
cactode | 59:8aa304768360 | 4413 | - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code> |
cactode | 59:8aa304768360 | 4414 | */ |
cactode | 59:8aa304768360 | 4415 | arm_status arm_fir_decimate_init_f32( |
cactode | 59:8aa304768360 | 4416 | arm_fir_decimate_instance_f32 * S, |
cactode | 59:8aa304768360 | 4417 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 4418 | uint8_t M, |
cactode | 59:8aa304768360 | 4419 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 4420 | float32_t * pState, |
cactode | 59:8aa304768360 | 4421 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4422 | |
cactode | 59:8aa304768360 | 4423 | |
cactode | 59:8aa304768360 | 4424 | /** |
cactode | 59:8aa304768360 | 4425 | * @brief Processing function for the Q15 FIR decimator. |
cactode | 59:8aa304768360 | 4426 | * @param[in] S points to an instance of the Q15 FIR decimator structure. |
cactode | 59:8aa304768360 | 4427 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4428 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4429 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4430 | */ |
cactode | 59:8aa304768360 | 4431 | void arm_fir_decimate_q15( |
cactode | 59:8aa304768360 | 4432 | const arm_fir_decimate_instance_q15 * S, |
cactode | 59:8aa304768360 | 4433 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 4434 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4435 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4436 | |
cactode | 59:8aa304768360 | 4437 | |
cactode | 59:8aa304768360 | 4438 | /** |
cactode | 59:8aa304768360 | 4439 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
cactode | 59:8aa304768360 | 4440 | * @param[in] S points to an instance of the Q15 FIR decimator structure. |
cactode | 59:8aa304768360 | 4441 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4442 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4443 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4444 | */ |
cactode | 59:8aa304768360 | 4445 | void arm_fir_decimate_fast_q15( |
cactode | 59:8aa304768360 | 4446 | const arm_fir_decimate_instance_q15 * S, |
cactode | 59:8aa304768360 | 4447 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 4448 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4449 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4450 | |
cactode | 59:8aa304768360 | 4451 | |
cactode | 59:8aa304768360 | 4452 | /** |
cactode | 59:8aa304768360 | 4453 | * @brief Initialization function for the Q15 FIR decimator. |
cactode | 59:8aa304768360 | 4454 | * @param[in,out] S points to an instance of the Q15 FIR decimator structure. |
cactode | 59:8aa304768360 | 4455 | * @param[in] numTaps number of coefficients in the filter. |
cactode | 59:8aa304768360 | 4456 | * @param[in] M decimation factor. |
cactode | 59:8aa304768360 | 4457 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 4458 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4459 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4460 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
cactode | 59:8aa304768360 | 4461 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
cactode | 59:8aa304768360 | 4462 | */ |
cactode | 59:8aa304768360 | 4463 | arm_status arm_fir_decimate_init_q15( |
cactode | 59:8aa304768360 | 4464 | arm_fir_decimate_instance_q15 * S, |
cactode | 59:8aa304768360 | 4465 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 4466 | uint8_t M, |
cactode | 59:8aa304768360 | 4467 | const q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 4468 | q15_t * pState, |
cactode | 59:8aa304768360 | 4469 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4470 | |
cactode | 59:8aa304768360 | 4471 | |
cactode | 59:8aa304768360 | 4472 | /** |
cactode | 59:8aa304768360 | 4473 | * @brief Processing function for the Q31 FIR decimator. |
cactode | 59:8aa304768360 | 4474 | * @param[in] S points to an instance of the Q31 FIR decimator structure. |
cactode | 59:8aa304768360 | 4475 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4476 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4477 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4478 | */ |
cactode | 59:8aa304768360 | 4479 | void arm_fir_decimate_q31( |
cactode | 59:8aa304768360 | 4480 | const arm_fir_decimate_instance_q31 * S, |
cactode | 59:8aa304768360 | 4481 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 4482 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4483 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4484 | |
cactode | 59:8aa304768360 | 4485 | /** |
cactode | 59:8aa304768360 | 4486 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
cactode | 59:8aa304768360 | 4487 | * @param[in] S points to an instance of the Q31 FIR decimator structure. |
cactode | 59:8aa304768360 | 4488 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4489 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4490 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4491 | */ |
cactode | 59:8aa304768360 | 4492 | void arm_fir_decimate_fast_q31( |
cactode | 59:8aa304768360 | 4493 | const arm_fir_decimate_instance_q31 * S, |
cactode | 59:8aa304768360 | 4494 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 4495 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4496 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4497 | |
cactode | 59:8aa304768360 | 4498 | |
cactode | 59:8aa304768360 | 4499 | /** |
cactode | 59:8aa304768360 | 4500 | * @brief Initialization function for the Q31 FIR decimator. |
cactode | 59:8aa304768360 | 4501 | * @param[in,out] S points to an instance of the Q31 FIR decimator structure. |
cactode | 59:8aa304768360 | 4502 | * @param[in] numTaps number of coefficients in the filter. |
cactode | 59:8aa304768360 | 4503 | * @param[in] M decimation factor. |
cactode | 59:8aa304768360 | 4504 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 4505 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4506 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4507 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
cactode | 59:8aa304768360 | 4508 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
cactode | 59:8aa304768360 | 4509 | */ |
cactode | 59:8aa304768360 | 4510 | arm_status arm_fir_decimate_init_q31( |
cactode | 59:8aa304768360 | 4511 | arm_fir_decimate_instance_q31 * S, |
cactode | 59:8aa304768360 | 4512 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 4513 | uint8_t M, |
cactode | 59:8aa304768360 | 4514 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 4515 | q31_t * pState, |
cactode | 59:8aa304768360 | 4516 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4517 | |
cactode | 59:8aa304768360 | 4518 | |
cactode | 59:8aa304768360 | 4519 | /** |
cactode | 59:8aa304768360 | 4520 | * @brief Instance structure for the Q15 FIR interpolator. |
cactode | 59:8aa304768360 | 4521 | */ |
cactode | 59:8aa304768360 | 4522 | typedef struct |
cactode | 59:8aa304768360 | 4523 | { |
cactode | 59:8aa304768360 | 4524 | uint8_t L; /**< upsample factor. */ |
cactode | 59:8aa304768360 | 4525 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
cactode | 59:8aa304768360 | 4526 | const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
cactode | 59:8aa304768360 | 4527 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
cactode | 59:8aa304768360 | 4528 | } arm_fir_interpolate_instance_q15; |
cactode | 59:8aa304768360 | 4529 | |
cactode | 59:8aa304768360 | 4530 | /** |
cactode | 59:8aa304768360 | 4531 | * @brief Instance structure for the Q31 FIR interpolator. |
cactode | 59:8aa304768360 | 4532 | */ |
cactode | 59:8aa304768360 | 4533 | typedef struct |
cactode | 59:8aa304768360 | 4534 | { |
cactode | 59:8aa304768360 | 4535 | uint8_t L; /**< upsample factor. */ |
cactode | 59:8aa304768360 | 4536 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
cactode | 59:8aa304768360 | 4537 | const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
cactode | 59:8aa304768360 | 4538 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
cactode | 59:8aa304768360 | 4539 | } arm_fir_interpolate_instance_q31; |
cactode | 59:8aa304768360 | 4540 | |
cactode | 59:8aa304768360 | 4541 | /** |
cactode | 59:8aa304768360 | 4542 | * @brief Instance structure for the floating-point FIR interpolator. |
cactode | 59:8aa304768360 | 4543 | */ |
cactode | 59:8aa304768360 | 4544 | typedef struct |
cactode | 59:8aa304768360 | 4545 | { |
cactode | 59:8aa304768360 | 4546 | uint8_t L; /**< upsample factor. */ |
cactode | 59:8aa304768360 | 4547 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
cactode | 59:8aa304768360 | 4548 | const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
cactode | 59:8aa304768360 | 4549 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ |
cactode | 59:8aa304768360 | 4550 | } arm_fir_interpolate_instance_f32; |
cactode | 59:8aa304768360 | 4551 | |
cactode | 59:8aa304768360 | 4552 | |
cactode | 59:8aa304768360 | 4553 | /** |
cactode | 59:8aa304768360 | 4554 | * @brief Processing function for the Q15 FIR interpolator. |
cactode | 59:8aa304768360 | 4555 | * @param[in] S points to an instance of the Q15 FIR interpolator structure. |
cactode | 59:8aa304768360 | 4556 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4557 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 4558 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4559 | */ |
cactode | 59:8aa304768360 | 4560 | void arm_fir_interpolate_q15( |
cactode | 59:8aa304768360 | 4561 | const arm_fir_interpolate_instance_q15 * S, |
cactode | 59:8aa304768360 | 4562 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 4563 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4564 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4565 | |
cactode | 59:8aa304768360 | 4566 | |
cactode | 59:8aa304768360 | 4567 | /** |
cactode | 59:8aa304768360 | 4568 | * @brief Initialization function for the Q15 FIR interpolator. |
cactode | 59:8aa304768360 | 4569 | * @param[in,out] S points to an instance of the Q15 FIR interpolator structure. |
cactode | 59:8aa304768360 | 4570 | * @param[in] L upsample factor. |
cactode | 59:8aa304768360 | 4571 | * @param[in] numTaps number of filter coefficients in the filter. |
cactode | 59:8aa304768360 | 4572 | * @param[in] pCoeffs points to the filter coefficient buffer. |
cactode | 59:8aa304768360 | 4573 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4574 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4575 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
cactode | 59:8aa304768360 | 4576 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
cactode | 59:8aa304768360 | 4577 | */ |
cactode | 59:8aa304768360 | 4578 | arm_status arm_fir_interpolate_init_q15( |
cactode | 59:8aa304768360 | 4579 | arm_fir_interpolate_instance_q15 * S, |
cactode | 59:8aa304768360 | 4580 | uint8_t L, |
cactode | 59:8aa304768360 | 4581 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 4582 | const q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 4583 | q15_t * pState, |
cactode | 59:8aa304768360 | 4584 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4585 | |
cactode | 59:8aa304768360 | 4586 | |
cactode | 59:8aa304768360 | 4587 | /** |
cactode | 59:8aa304768360 | 4588 | * @brief Processing function for the Q31 FIR interpolator. |
cactode | 59:8aa304768360 | 4589 | * @param[in] S points to an instance of the Q15 FIR interpolator structure. |
cactode | 59:8aa304768360 | 4590 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4591 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 4592 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4593 | */ |
cactode | 59:8aa304768360 | 4594 | void arm_fir_interpolate_q31( |
cactode | 59:8aa304768360 | 4595 | const arm_fir_interpolate_instance_q31 * S, |
cactode | 59:8aa304768360 | 4596 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 4597 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4598 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4599 | |
cactode | 59:8aa304768360 | 4600 | |
cactode | 59:8aa304768360 | 4601 | /** |
cactode | 59:8aa304768360 | 4602 | * @brief Initialization function for the Q31 FIR interpolator. |
cactode | 59:8aa304768360 | 4603 | * @param[in,out] S points to an instance of the Q31 FIR interpolator structure. |
cactode | 59:8aa304768360 | 4604 | * @param[in] L upsample factor. |
cactode | 59:8aa304768360 | 4605 | * @param[in] numTaps number of filter coefficients in the filter. |
cactode | 59:8aa304768360 | 4606 | * @param[in] pCoeffs points to the filter coefficient buffer. |
cactode | 59:8aa304768360 | 4607 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4608 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4609 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
cactode | 59:8aa304768360 | 4610 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
cactode | 59:8aa304768360 | 4611 | */ |
cactode | 59:8aa304768360 | 4612 | arm_status arm_fir_interpolate_init_q31( |
cactode | 59:8aa304768360 | 4613 | arm_fir_interpolate_instance_q31 * S, |
cactode | 59:8aa304768360 | 4614 | uint8_t L, |
cactode | 59:8aa304768360 | 4615 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 4616 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 4617 | q31_t * pState, |
cactode | 59:8aa304768360 | 4618 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4619 | |
cactode | 59:8aa304768360 | 4620 | |
cactode | 59:8aa304768360 | 4621 | /** |
cactode | 59:8aa304768360 | 4622 | * @brief Processing function for the floating-point FIR interpolator. |
cactode | 59:8aa304768360 | 4623 | * @param[in] S points to an instance of the floating-point FIR interpolator structure. |
cactode | 59:8aa304768360 | 4624 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4625 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 4626 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4627 | */ |
cactode | 59:8aa304768360 | 4628 | void arm_fir_interpolate_f32( |
cactode | 59:8aa304768360 | 4629 | const arm_fir_interpolate_instance_f32 * S, |
cactode | 59:8aa304768360 | 4630 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 4631 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4632 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4633 | |
cactode | 59:8aa304768360 | 4634 | |
cactode | 59:8aa304768360 | 4635 | /** |
cactode | 59:8aa304768360 | 4636 | * @brief Initialization function for the floating-point FIR interpolator. |
cactode | 59:8aa304768360 | 4637 | * @param[in,out] S points to an instance of the floating-point FIR interpolator structure. |
cactode | 59:8aa304768360 | 4638 | * @param[in] L upsample factor. |
cactode | 59:8aa304768360 | 4639 | * @param[in] numTaps number of filter coefficients in the filter. |
cactode | 59:8aa304768360 | 4640 | * @param[in] pCoeffs points to the filter coefficient buffer. |
cactode | 59:8aa304768360 | 4641 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4642 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 4643 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
cactode | 59:8aa304768360 | 4644 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
cactode | 59:8aa304768360 | 4645 | */ |
cactode | 59:8aa304768360 | 4646 | arm_status arm_fir_interpolate_init_f32( |
cactode | 59:8aa304768360 | 4647 | arm_fir_interpolate_instance_f32 * S, |
cactode | 59:8aa304768360 | 4648 | uint8_t L, |
cactode | 59:8aa304768360 | 4649 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 4650 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 4651 | float32_t * pState, |
cactode | 59:8aa304768360 | 4652 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4653 | |
cactode | 59:8aa304768360 | 4654 | |
cactode | 59:8aa304768360 | 4655 | /** |
cactode | 59:8aa304768360 | 4656 | * @brief Instance structure for the high precision Q31 Biquad cascade filter. |
cactode | 59:8aa304768360 | 4657 | */ |
cactode | 59:8aa304768360 | 4658 | typedef struct |
cactode | 59:8aa304768360 | 4659 | { |
cactode | 59:8aa304768360 | 4660 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 4661 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
cactode | 59:8aa304768360 | 4662 | const q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 4663 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ |
cactode | 59:8aa304768360 | 4664 | } arm_biquad_cas_df1_32x64_ins_q31; |
cactode | 59:8aa304768360 | 4665 | |
cactode | 59:8aa304768360 | 4666 | |
cactode | 59:8aa304768360 | 4667 | /** |
cactode | 59:8aa304768360 | 4668 | * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure. |
cactode | 59:8aa304768360 | 4669 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4670 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4671 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4672 | */ |
cactode | 59:8aa304768360 | 4673 | void arm_biquad_cas_df1_32x64_q31( |
cactode | 59:8aa304768360 | 4674 | const arm_biquad_cas_df1_32x64_ins_q31 * S, |
cactode | 59:8aa304768360 | 4675 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 4676 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4677 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4678 | |
cactode | 59:8aa304768360 | 4679 | |
cactode | 59:8aa304768360 | 4680 | /** |
cactode | 59:8aa304768360 | 4681 | * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure. |
cactode | 59:8aa304768360 | 4682 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 4683 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 4684 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4685 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format |
cactode | 59:8aa304768360 | 4686 | */ |
cactode | 59:8aa304768360 | 4687 | void arm_biquad_cas_df1_32x64_init_q31( |
cactode | 59:8aa304768360 | 4688 | arm_biquad_cas_df1_32x64_ins_q31 * S, |
cactode | 59:8aa304768360 | 4689 | uint8_t numStages, |
cactode | 59:8aa304768360 | 4690 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 4691 | q63_t * pState, |
cactode | 59:8aa304768360 | 4692 | uint8_t postShift); |
cactode | 59:8aa304768360 | 4693 | |
cactode | 59:8aa304768360 | 4694 | |
cactode | 59:8aa304768360 | 4695 | /** |
cactode | 59:8aa304768360 | 4696 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4697 | */ |
cactode | 59:8aa304768360 | 4698 | typedef struct |
cactode | 59:8aa304768360 | 4699 | { |
cactode | 59:8aa304768360 | 4700 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 4701 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
cactode | 59:8aa304768360 | 4702 | const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 4703 | } arm_biquad_cascade_df2T_instance_f32; |
cactode | 59:8aa304768360 | 4704 | |
cactode | 59:8aa304768360 | 4705 | /** |
cactode | 59:8aa304768360 | 4706 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4707 | */ |
cactode | 59:8aa304768360 | 4708 | typedef struct |
cactode | 59:8aa304768360 | 4709 | { |
cactode | 59:8aa304768360 | 4710 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 4711 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
cactode | 59:8aa304768360 | 4712 | const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 4713 | } arm_biquad_cascade_stereo_df2T_instance_f32; |
cactode | 59:8aa304768360 | 4714 | |
cactode | 59:8aa304768360 | 4715 | /** |
cactode | 59:8aa304768360 | 4716 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4717 | */ |
cactode | 59:8aa304768360 | 4718 | typedef struct |
cactode | 59:8aa304768360 | 4719 | { |
cactode | 59:8aa304768360 | 4720 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
cactode | 59:8aa304768360 | 4721 | float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
cactode | 59:8aa304768360 | 4722 | const float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
cactode | 59:8aa304768360 | 4723 | } arm_biquad_cascade_df2T_instance_f64; |
cactode | 59:8aa304768360 | 4724 | |
cactode | 59:8aa304768360 | 4725 | |
cactode | 59:8aa304768360 | 4726 | /** |
cactode | 59:8aa304768360 | 4727 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4728 | * @param[in] S points to an instance of the filter data structure. |
cactode | 59:8aa304768360 | 4729 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4730 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4731 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4732 | */ |
cactode | 59:8aa304768360 | 4733 | void arm_biquad_cascade_df2T_f32( |
cactode | 59:8aa304768360 | 4734 | const arm_biquad_cascade_df2T_instance_f32 * S, |
cactode | 59:8aa304768360 | 4735 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 4736 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4737 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4738 | |
cactode | 59:8aa304768360 | 4739 | |
cactode | 59:8aa304768360 | 4740 | /** |
cactode | 59:8aa304768360 | 4741 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels |
cactode | 59:8aa304768360 | 4742 | * @param[in] S points to an instance of the filter data structure. |
cactode | 59:8aa304768360 | 4743 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4744 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4745 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4746 | */ |
cactode | 59:8aa304768360 | 4747 | void arm_biquad_cascade_stereo_df2T_f32( |
cactode | 59:8aa304768360 | 4748 | const arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
cactode | 59:8aa304768360 | 4749 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 4750 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4751 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4752 | |
cactode | 59:8aa304768360 | 4753 | |
cactode | 59:8aa304768360 | 4754 | /** |
cactode | 59:8aa304768360 | 4755 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4756 | * @param[in] S points to an instance of the filter data structure. |
cactode | 59:8aa304768360 | 4757 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4758 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4759 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4760 | */ |
cactode | 59:8aa304768360 | 4761 | void arm_biquad_cascade_df2T_f64( |
cactode | 59:8aa304768360 | 4762 | const arm_biquad_cascade_df2T_instance_f64 * S, |
cactode | 59:8aa304768360 | 4763 | const float64_t * pSrc, |
cactode | 59:8aa304768360 | 4764 | float64_t * pDst, |
cactode | 59:8aa304768360 | 4765 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4766 | |
cactode | 59:8aa304768360 | 4767 | |
cactode | 59:8aa304768360 | 4768 | #if defined(ARM_MATH_NEON) |
cactode | 59:8aa304768360 | 4769 | void arm_biquad_cascade_df2T_compute_coefs_f32( |
cactode | 59:8aa304768360 | 4770 | arm_biquad_cascade_df2T_instance_f32 * S, |
cactode | 59:8aa304768360 | 4771 | uint8_t numStages, |
cactode | 59:8aa304768360 | 4772 | float32_t * pCoeffs); |
cactode | 59:8aa304768360 | 4773 | #endif |
cactode | 59:8aa304768360 | 4774 | /** |
cactode | 59:8aa304768360 | 4775 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4776 | * @param[in,out] S points to an instance of the filter data structure. |
cactode | 59:8aa304768360 | 4777 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 4778 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 4779 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4780 | */ |
cactode | 59:8aa304768360 | 4781 | void arm_biquad_cascade_df2T_init_f32( |
cactode | 59:8aa304768360 | 4782 | arm_biquad_cascade_df2T_instance_f32 * S, |
cactode | 59:8aa304768360 | 4783 | uint8_t numStages, |
cactode | 59:8aa304768360 | 4784 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 4785 | float32_t * pState); |
cactode | 59:8aa304768360 | 4786 | |
cactode | 59:8aa304768360 | 4787 | |
cactode | 59:8aa304768360 | 4788 | /** |
cactode | 59:8aa304768360 | 4789 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4790 | * @param[in,out] S points to an instance of the filter data structure. |
cactode | 59:8aa304768360 | 4791 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 4792 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 4793 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4794 | */ |
cactode | 59:8aa304768360 | 4795 | void arm_biquad_cascade_stereo_df2T_init_f32( |
cactode | 59:8aa304768360 | 4796 | arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
cactode | 59:8aa304768360 | 4797 | uint8_t numStages, |
cactode | 59:8aa304768360 | 4798 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 4799 | float32_t * pState); |
cactode | 59:8aa304768360 | 4800 | |
cactode | 59:8aa304768360 | 4801 | |
cactode | 59:8aa304768360 | 4802 | /** |
cactode | 59:8aa304768360 | 4803 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
cactode | 59:8aa304768360 | 4804 | * @param[in,out] S points to an instance of the filter data structure. |
cactode | 59:8aa304768360 | 4805 | * @param[in] numStages number of 2nd order stages in the filter. |
cactode | 59:8aa304768360 | 4806 | * @param[in] pCoeffs points to the filter coefficients. |
cactode | 59:8aa304768360 | 4807 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 4808 | */ |
cactode | 59:8aa304768360 | 4809 | void arm_biquad_cascade_df2T_init_f64( |
cactode | 59:8aa304768360 | 4810 | arm_biquad_cascade_df2T_instance_f64 * S, |
cactode | 59:8aa304768360 | 4811 | uint8_t numStages, |
cactode | 59:8aa304768360 | 4812 | const float64_t * pCoeffs, |
cactode | 59:8aa304768360 | 4813 | float64_t * pState); |
cactode | 59:8aa304768360 | 4814 | |
cactode | 59:8aa304768360 | 4815 | |
cactode | 59:8aa304768360 | 4816 | /** |
cactode | 59:8aa304768360 | 4817 | * @brief Instance structure for the Q15 FIR lattice filter. |
cactode | 59:8aa304768360 | 4818 | */ |
cactode | 59:8aa304768360 | 4819 | typedef struct |
cactode | 59:8aa304768360 | 4820 | { |
cactode | 59:8aa304768360 | 4821 | uint16_t numStages; /**< number of filter stages. */ |
cactode | 59:8aa304768360 | 4822 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4823 | const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4824 | } arm_fir_lattice_instance_q15; |
cactode | 59:8aa304768360 | 4825 | |
cactode | 59:8aa304768360 | 4826 | /** |
cactode | 59:8aa304768360 | 4827 | * @brief Instance structure for the Q31 FIR lattice filter. |
cactode | 59:8aa304768360 | 4828 | */ |
cactode | 59:8aa304768360 | 4829 | typedef struct |
cactode | 59:8aa304768360 | 4830 | { |
cactode | 59:8aa304768360 | 4831 | uint16_t numStages; /**< number of filter stages. */ |
cactode | 59:8aa304768360 | 4832 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4833 | const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4834 | } arm_fir_lattice_instance_q31; |
cactode | 59:8aa304768360 | 4835 | |
cactode | 59:8aa304768360 | 4836 | /** |
cactode | 59:8aa304768360 | 4837 | * @brief Instance structure for the floating-point FIR lattice filter. |
cactode | 59:8aa304768360 | 4838 | */ |
cactode | 59:8aa304768360 | 4839 | typedef struct |
cactode | 59:8aa304768360 | 4840 | { |
cactode | 59:8aa304768360 | 4841 | uint16_t numStages; /**< number of filter stages. */ |
cactode | 59:8aa304768360 | 4842 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4843 | const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4844 | } arm_fir_lattice_instance_f32; |
cactode | 59:8aa304768360 | 4845 | |
cactode | 59:8aa304768360 | 4846 | |
cactode | 59:8aa304768360 | 4847 | /** |
cactode | 59:8aa304768360 | 4848 | * @brief Initialization function for the Q15 FIR lattice filter. |
cactode | 59:8aa304768360 | 4849 | * @param[in] S points to an instance of the Q15 FIR lattice structure. |
cactode | 59:8aa304768360 | 4850 | * @param[in] numStages number of filter stages. |
cactode | 59:8aa304768360 | 4851 | * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4852 | * @param[in] pState points to the state buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4853 | */ |
cactode | 59:8aa304768360 | 4854 | void arm_fir_lattice_init_q15( |
cactode | 59:8aa304768360 | 4855 | arm_fir_lattice_instance_q15 * S, |
cactode | 59:8aa304768360 | 4856 | uint16_t numStages, |
cactode | 59:8aa304768360 | 4857 | const q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 4858 | q15_t * pState); |
cactode | 59:8aa304768360 | 4859 | |
cactode | 59:8aa304768360 | 4860 | |
cactode | 59:8aa304768360 | 4861 | /** |
cactode | 59:8aa304768360 | 4862 | * @brief Processing function for the Q15 FIR lattice filter. |
cactode | 59:8aa304768360 | 4863 | * @param[in] S points to an instance of the Q15 FIR lattice structure. |
cactode | 59:8aa304768360 | 4864 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4865 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 4866 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4867 | */ |
cactode | 59:8aa304768360 | 4868 | void arm_fir_lattice_q15( |
cactode | 59:8aa304768360 | 4869 | const arm_fir_lattice_instance_q15 * S, |
cactode | 59:8aa304768360 | 4870 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 4871 | q15_t * pDst, |
cactode | 59:8aa304768360 | 4872 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4873 | |
cactode | 59:8aa304768360 | 4874 | |
cactode | 59:8aa304768360 | 4875 | /** |
cactode | 59:8aa304768360 | 4876 | * @brief Initialization function for the Q31 FIR lattice filter. |
cactode | 59:8aa304768360 | 4877 | * @param[in] S points to an instance of the Q31 FIR lattice structure. |
cactode | 59:8aa304768360 | 4878 | * @param[in] numStages number of filter stages. |
cactode | 59:8aa304768360 | 4879 | * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4880 | * @param[in] pState points to the state buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4881 | */ |
cactode | 59:8aa304768360 | 4882 | void arm_fir_lattice_init_q31( |
cactode | 59:8aa304768360 | 4883 | arm_fir_lattice_instance_q31 * S, |
cactode | 59:8aa304768360 | 4884 | uint16_t numStages, |
cactode | 59:8aa304768360 | 4885 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 4886 | q31_t * pState); |
cactode | 59:8aa304768360 | 4887 | |
cactode | 59:8aa304768360 | 4888 | |
cactode | 59:8aa304768360 | 4889 | /** |
cactode | 59:8aa304768360 | 4890 | * @brief Processing function for the Q31 FIR lattice filter. |
cactode | 59:8aa304768360 | 4891 | * @param[in] S points to an instance of the Q31 FIR lattice structure. |
cactode | 59:8aa304768360 | 4892 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4893 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4894 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4895 | */ |
cactode | 59:8aa304768360 | 4896 | void arm_fir_lattice_q31( |
cactode | 59:8aa304768360 | 4897 | const arm_fir_lattice_instance_q31 * S, |
cactode | 59:8aa304768360 | 4898 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 4899 | q31_t * pDst, |
cactode | 59:8aa304768360 | 4900 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4901 | |
cactode | 59:8aa304768360 | 4902 | |
cactode | 59:8aa304768360 | 4903 | /** |
cactode | 59:8aa304768360 | 4904 | * @brief Initialization function for the floating-point FIR lattice filter. |
cactode | 59:8aa304768360 | 4905 | * @param[in] S points to an instance of the floating-point FIR lattice structure. |
cactode | 59:8aa304768360 | 4906 | * @param[in] numStages number of filter stages. |
cactode | 59:8aa304768360 | 4907 | * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4908 | * @param[in] pState points to the state buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4909 | */ |
cactode | 59:8aa304768360 | 4910 | void arm_fir_lattice_init_f32( |
cactode | 59:8aa304768360 | 4911 | arm_fir_lattice_instance_f32 * S, |
cactode | 59:8aa304768360 | 4912 | uint16_t numStages, |
cactode | 59:8aa304768360 | 4913 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 4914 | float32_t * pState); |
cactode | 59:8aa304768360 | 4915 | |
cactode | 59:8aa304768360 | 4916 | |
cactode | 59:8aa304768360 | 4917 | /** |
cactode | 59:8aa304768360 | 4918 | * @brief Processing function for the floating-point FIR lattice filter. |
cactode | 59:8aa304768360 | 4919 | * @param[in] S points to an instance of the floating-point FIR lattice structure. |
cactode | 59:8aa304768360 | 4920 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4921 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 4922 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4923 | */ |
cactode | 59:8aa304768360 | 4924 | void arm_fir_lattice_f32( |
cactode | 59:8aa304768360 | 4925 | const arm_fir_lattice_instance_f32 * S, |
cactode | 59:8aa304768360 | 4926 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 4927 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4928 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4929 | |
cactode | 59:8aa304768360 | 4930 | |
cactode | 59:8aa304768360 | 4931 | /** |
cactode | 59:8aa304768360 | 4932 | * @brief Instance structure for the Q15 IIR lattice filter. |
cactode | 59:8aa304768360 | 4933 | */ |
cactode | 59:8aa304768360 | 4934 | typedef struct |
cactode | 59:8aa304768360 | 4935 | { |
cactode | 59:8aa304768360 | 4936 | uint16_t numStages; /**< number of stages in the filter. */ |
cactode | 59:8aa304768360 | 4937 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
cactode | 59:8aa304768360 | 4938 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4939 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
cactode | 59:8aa304768360 | 4940 | } arm_iir_lattice_instance_q15; |
cactode | 59:8aa304768360 | 4941 | |
cactode | 59:8aa304768360 | 4942 | /** |
cactode | 59:8aa304768360 | 4943 | * @brief Instance structure for the Q31 IIR lattice filter. |
cactode | 59:8aa304768360 | 4944 | */ |
cactode | 59:8aa304768360 | 4945 | typedef struct |
cactode | 59:8aa304768360 | 4946 | { |
cactode | 59:8aa304768360 | 4947 | uint16_t numStages; /**< number of stages in the filter. */ |
cactode | 59:8aa304768360 | 4948 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
cactode | 59:8aa304768360 | 4949 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4950 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
cactode | 59:8aa304768360 | 4951 | } arm_iir_lattice_instance_q31; |
cactode | 59:8aa304768360 | 4952 | |
cactode | 59:8aa304768360 | 4953 | /** |
cactode | 59:8aa304768360 | 4954 | * @brief Instance structure for the floating-point IIR lattice filter. |
cactode | 59:8aa304768360 | 4955 | */ |
cactode | 59:8aa304768360 | 4956 | typedef struct |
cactode | 59:8aa304768360 | 4957 | { |
cactode | 59:8aa304768360 | 4958 | uint16_t numStages; /**< number of stages in the filter. */ |
cactode | 59:8aa304768360 | 4959 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
cactode | 59:8aa304768360 | 4960 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
cactode | 59:8aa304768360 | 4961 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
cactode | 59:8aa304768360 | 4962 | } arm_iir_lattice_instance_f32; |
cactode | 59:8aa304768360 | 4963 | |
cactode | 59:8aa304768360 | 4964 | |
cactode | 59:8aa304768360 | 4965 | /** |
cactode | 59:8aa304768360 | 4966 | * @brief Processing function for the floating-point IIR lattice filter. |
cactode | 59:8aa304768360 | 4967 | * @param[in] S points to an instance of the floating-point IIR lattice structure. |
cactode | 59:8aa304768360 | 4968 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 4969 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 4970 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4971 | */ |
cactode | 59:8aa304768360 | 4972 | void arm_iir_lattice_f32( |
cactode | 59:8aa304768360 | 4973 | const arm_iir_lattice_instance_f32 * S, |
cactode | 59:8aa304768360 | 4974 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 4975 | float32_t * pDst, |
cactode | 59:8aa304768360 | 4976 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4977 | |
cactode | 59:8aa304768360 | 4978 | |
cactode | 59:8aa304768360 | 4979 | /** |
cactode | 59:8aa304768360 | 4980 | * @brief Initialization function for the floating-point IIR lattice filter. |
cactode | 59:8aa304768360 | 4981 | * @param[in] S points to an instance of the floating-point IIR lattice structure. |
cactode | 59:8aa304768360 | 4982 | * @param[in] numStages number of stages in the filter. |
cactode | 59:8aa304768360 | 4983 | * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 4984 | * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
cactode | 59:8aa304768360 | 4985 | * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1. |
cactode | 59:8aa304768360 | 4986 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 4987 | */ |
cactode | 59:8aa304768360 | 4988 | void arm_iir_lattice_init_f32( |
cactode | 59:8aa304768360 | 4989 | arm_iir_lattice_instance_f32 * S, |
cactode | 59:8aa304768360 | 4990 | uint16_t numStages, |
cactode | 59:8aa304768360 | 4991 | float32_t * pkCoeffs, |
cactode | 59:8aa304768360 | 4992 | float32_t * pvCoeffs, |
cactode | 59:8aa304768360 | 4993 | float32_t * pState, |
cactode | 59:8aa304768360 | 4994 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 4995 | |
cactode | 59:8aa304768360 | 4996 | |
cactode | 59:8aa304768360 | 4997 | /** |
cactode | 59:8aa304768360 | 4998 | * @brief Processing function for the Q31 IIR lattice filter. |
cactode | 59:8aa304768360 | 4999 | * @param[in] S points to an instance of the Q31 IIR lattice structure. |
cactode | 59:8aa304768360 | 5000 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5001 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 5002 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5003 | */ |
cactode | 59:8aa304768360 | 5004 | void arm_iir_lattice_q31( |
cactode | 59:8aa304768360 | 5005 | const arm_iir_lattice_instance_q31 * S, |
cactode | 59:8aa304768360 | 5006 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 5007 | q31_t * pDst, |
cactode | 59:8aa304768360 | 5008 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5009 | |
cactode | 59:8aa304768360 | 5010 | |
cactode | 59:8aa304768360 | 5011 | /** |
cactode | 59:8aa304768360 | 5012 | * @brief Initialization function for the Q31 IIR lattice filter. |
cactode | 59:8aa304768360 | 5013 | * @param[in] S points to an instance of the Q31 IIR lattice structure. |
cactode | 59:8aa304768360 | 5014 | * @param[in] numStages number of stages in the filter. |
cactode | 59:8aa304768360 | 5015 | * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 5016 | * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
cactode | 59:8aa304768360 | 5017 | * @param[in] pState points to the state buffer. The array is of length numStages+blockSize. |
cactode | 59:8aa304768360 | 5018 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5019 | */ |
cactode | 59:8aa304768360 | 5020 | void arm_iir_lattice_init_q31( |
cactode | 59:8aa304768360 | 5021 | arm_iir_lattice_instance_q31 * S, |
cactode | 59:8aa304768360 | 5022 | uint16_t numStages, |
cactode | 59:8aa304768360 | 5023 | q31_t * pkCoeffs, |
cactode | 59:8aa304768360 | 5024 | q31_t * pvCoeffs, |
cactode | 59:8aa304768360 | 5025 | q31_t * pState, |
cactode | 59:8aa304768360 | 5026 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5027 | |
cactode | 59:8aa304768360 | 5028 | |
cactode | 59:8aa304768360 | 5029 | /** |
cactode | 59:8aa304768360 | 5030 | * @brief Processing function for the Q15 IIR lattice filter. |
cactode | 59:8aa304768360 | 5031 | * @param[in] S points to an instance of the Q15 IIR lattice structure. |
cactode | 59:8aa304768360 | 5032 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5033 | * @param[out] pDst points to the block of output data. |
cactode | 59:8aa304768360 | 5034 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5035 | */ |
cactode | 59:8aa304768360 | 5036 | void arm_iir_lattice_q15( |
cactode | 59:8aa304768360 | 5037 | const arm_iir_lattice_instance_q15 * S, |
cactode | 59:8aa304768360 | 5038 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 5039 | q15_t * pDst, |
cactode | 59:8aa304768360 | 5040 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5041 | |
cactode | 59:8aa304768360 | 5042 | |
cactode | 59:8aa304768360 | 5043 | /** |
cactode | 59:8aa304768360 | 5044 | * @brief Initialization function for the Q15 IIR lattice filter. |
cactode | 59:8aa304768360 | 5045 | * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure. |
cactode | 59:8aa304768360 | 5046 | * @param[in] numStages number of stages in the filter. |
cactode | 59:8aa304768360 | 5047 | * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages. |
cactode | 59:8aa304768360 | 5048 | * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. |
cactode | 59:8aa304768360 | 5049 | * @param[in] pState points to state buffer. The array is of length numStages+blockSize. |
cactode | 59:8aa304768360 | 5050 | * @param[in] blockSize number of samples to process per call. |
cactode | 59:8aa304768360 | 5051 | */ |
cactode | 59:8aa304768360 | 5052 | void arm_iir_lattice_init_q15( |
cactode | 59:8aa304768360 | 5053 | arm_iir_lattice_instance_q15 * S, |
cactode | 59:8aa304768360 | 5054 | uint16_t numStages, |
cactode | 59:8aa304768360 | 5055 | q15_t * pkCoeffs, |
cactode | 59:8aa304768360 | 5056 | q15_t * pvCoeffs, |
cactode | 59:8aa304768360 | 5057 | q15_t * pState, |
cactode | 59:8aa304768360 | 5058 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5059 | |
cactode | 59:8aa304768360 | 5060 | |
cactode | 59:8aa304768360 | 5061 | /** |
cactode | 59:8aa304768360 | 5062 | * @brief Instance structure for the floating-point LMS filter. |
cactode | 59:8aa304768360 | 5063 | */ |
cactode | 59:8aa304768360 | 5064 | typedef struct |
cactode | 59:8aa304768360 | 5065 | { |
cactode | 59:8aa304768360 | 5066 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5067 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 5068 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5069 | float32_t mu; /**< step size that controls filter coefficient updates. */ |
cactode | 59:8aa304768360 | 5070 | } arm_lms_instance_f32; |
cactode | 59:8aa304768360 | 5071 | |
cactode | 59:8aa304768360 | 5072 | |
cactode | 59:8aa304768360 | 5073 | /** |
cactode | 59:8aa304768360 | 5074 | * @brief Processing function for floating-point LMS filter. |
cactode | 59:8aa304768360 | 5075 | * @param[in] S points to an instance of the floating-point LMS filter structure. |
cactode | 59:8aa304768360 | 5076 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5077 | * @param[in] pRef points to the block of reference data. |
cactode | 59:8aa304768360 | 5078 | * @param[out] pOut points to the block of output data. |
cactode | 59:8aa304768360 | 5079 | * @param[out] pErr points to the block of error data. |
cactode | 59:8aa304768360 | 5080 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5081 | */ |
cactode | 59:8aa304768360 | 5082 | void arm_lms_f32( |
cactode | 59:8aa304768360 | 5083 | const arm_lms_instance_f32 * S, |
cactode | 59:8aa304768360 | 5084 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 5085 | float32_t * pRef, |
cactode | 59:8aa304768360 | 5086 | float32_t * pOut, |
cactode | 59:8aa304768360 | 5087 | float32_t * pErr, |
cactode | 59:8aa304768360 | 5088 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5089 | |
cactode | 59:8aa304768360 | 5090 | |
cactode | 59:8aa304768360 | 5091 | /** |
cactode | 59:8aa304768360 | 5092 | * @brief Initialization function for floating-point LMS filter. |
cactode | 59:8aa304768360 | 5093 | * @param[in] S points to an instance of the floating-point LMS filter structure. |
cactode | 59:8aa304768360 | 5094 | * @param[in] numTaps number of filter coefficients. |
cactode | 59:8aa304768360 | 5095 | * @param[in] pCoeffs points to the coefficient buffer. |
cactode | 59:8aa304768360 | 5096 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 5097 | * @param[in] mu step size that controls filter coefficient updates. |
cactode | 59:8aa304768360 | 5098 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5099 | */ |
cactode | 59:8aa304768360 | 5100 | void arm_lms_init_f32( |
cactode | 59:8aa304768360 | 5101 | arm_lms_instance_f32 * S, |
cactode | 59:8aa304768360 | 5102 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5103 | float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 5104 | float32_t * pState, |
cactode | 59:8aa304768360 | 5105 | float32_t mu, |
cactode | 59:8aa304768360 | 5106 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5107 | |
cactode | 59:8aa304768360 | 5108 | |
cactode | 59:8aa304768360 | 5109 | /** |
cactode | 59:8aa304768360 | 5110 | * @brief Instance structure for the Q15 LMS filter. |
cactode | 59:8aa304768360 | 5111 | */ |
cactode | 59:8aa304768360 | 5112 | typedef struct |
cactode | 59:8aa304768360 | 5113 | { |
cactode | 59:8aa304768360 | 5114 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5115 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 5116 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5117 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
cactode | 59:8aa304768360 | 5118 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
cactode | 59:8aa304768360 | 5119 | } arm_lms_instance_q15; |
cactode | 59:8aa304768360 | 5120 | |
cactode | 59:8aa304768360 | 5121 | |
cactode | 59:8aa304768360 | 5122 | /** |
cactode | 59:8aa304768360 | 5123 | * @brief Initialization function for the Q15 LMS filter. |
cactode | 59:8aa304768360 | 5124 | * @param[in] S points to an instance of the Q15 LMS filter structure. |
cactode | 59:8aa304768360 | 5125 | * @param[in] numTaps number of filter coefficients. |
cactode | 59:8aa304768360 | 5126 | * @param[in] pCoeffs points to the coefficient buffer. |
cactode | 59:8aa304768360 | 5127 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 5128 | * @param[in] mu step size that controls filter coefficient updates. |
cactode | 59:8aa304768360 | 5129 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5130 | * @param[in] postShift bit shift applied to coefficients. |
cactode | 59:8aa304768360 | 5131 | */ |
cactode | 59:8aa304768360 | 5132 | void arm_lms_init_q15( |
cactode | 59:8aa304768360 | 5133 | arm_lms_instance_q15 * S, |
cactode | 59:8aa304768360 | 5134 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5135 | q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 5136 | q15_t * pState, |
cactode | 59:8aa304768360 | 5137 | q15_t mu, |
cactode | 59:8aa304768360 | 5138 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 5139 | uint32_t postShift); |
cactode | 59:8aa304768360 | 5140 | |
cactode | 59:8aa304768360 | 5141 | |
cactode | 59:8aa304768360 | 5142 | /** |
cactode | 59:8aa304768360 | 5143 | * @brief Processing function for Q15 LMS filter. |
cactode | 59:8aa304768360 | 5144 | * @param[in] S points to an instance of the Q15 LMS filter structure. |
cactode | 59:8aa304768360 | 5145 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5146 | * @param[in] pRef points to the block of reference data. |
cactode | 59:8aa304768360 | 5147 | * @param[out] pOut points to the block of output data. |
cactode | 59:8aa304768360 | 5148 | * @param[out] pErr points to the block of error data. |
cactode | 59:8aa304768360 | 5149 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5150 | */ |
cactode | 59:8aa304768360 | 5151 | void arm_lms_q15( |
cactode | 59:8aa304768360 | 5152 | const arm_lms_instance_q15 * S, |
cactode | 59:8aa304768360 | 5153 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 5154 | q15_t * pRef, |
cactode | 59:8aa304768360 | 5155 | q15_t * pOut, |
cactode | 59:8aa304768360 | 5156 | q15_t * pErr, |
cactode | 59:8aa304768360 | 5157 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5158 | |
cactode | 59:8aa304768360 | 5159 | |
cactode | 59:8aa304768360 | 5160 | /** |
cactode | 59:8aa304768360 | 5161 | * @brief Instance structure for the Q31 LMS filter. |
cactode | 59:8aa304768360 | 5162 | */ |
cactode | 59:8aa304768360 | 5163 | typedef struct |
cactode | 59:8aa304768360 | 5164 | { |
cactode | 59:8aa304768360 | 5165 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5166 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 5167 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5168 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
cactode | 59:8aa304768360 | 5169 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
cactode | 59:8aa304768360 | 5170 | } arm_lms_instance_q31; |
cactode | 59:8aa304768360 | 5171 | |
cactode | 59:8aa304768360 | 5172 | |
cactode | 59:8aa304768360 | 5173 | /** |
cactode | 59:8aa304768360 | 5174 | * @brief Processing function for Q31 LMS filter. |
cactode | 59:8aa304768360 | 5175 | * @param[in] S points to an instance of the Q15 LMS filter structure. |
cactode | 59:8aa304768360 | 5176 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5177 | * @param[in] pRef points to the block of reference data. |
cactode | 59:8aa304768360 | 5178 | * @param[out] pOut points to the block of output data. |
cactode | 59:8aa304768360 | 5179 | * @param[out] pErr points to the block of error data. |
cactode | 59:8aa304768360 | 5180 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5181 | */ |
cactode | 59:8aa304768360 | 5182 | void arm_lms_q31( |
cactode | 59:8aa304768360 | 5183 | const arm_lms_instance_q31 * S, |
cactode | 59:8aa304768360 | 5184 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 5185 | q31_t * pRef, |
cactode | 59:8aa304768360 | 5186 | q31_t * pOut, |
cactode | 59:8aa304768360 | 5187 | q31_t * pErr, |
cactode | 59:8aa304768360 | 5188 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5189 | |
cactode | 59:8aa304768360 | 5190 | |
cactode | 59:8aa304768360 | 5191 | /** |
cactode | 59:8aa304768360 | 5192 | * @brief Initialization function for Q31 LMS filter. |
cactode | 59:8aa304768360 | 5193 | * @param[in] S points to an instance of the Q31 LMS filter structure. |
cactode | 59:8aa304768360 | 5194 | * @param[in] numTaps number of filter coefficients. |
cactode | 59:8aa304768360 | 5195 | * @param[in] pCoeffs points to coefficient buffer. |
cactode | 59:8aa304768360 | 5196 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 5197 | * @param[in] mu step size that controls filter coefficient updates. |
cactode | 59:8aa304768360 | 5198 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5199 | * @param[in] postShift bit shift applied to coefficients. |
cactode | 59:8aa304768360 | 5200 | */ |
cactode | 59:8aa304768360 | 5201 | void arm_lms_init_q31( |
cactode | 59:8aa304768360 | 5202 | arm_lms_instance_q31 * S, |
cactode | 59:8aa304768360 | 5203 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5204 | q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 5205 | q31_t * pState, |
cactode | 59:8aa304768360 | 5206 | q31_t mu, |
cactode | 59:8aa304768360 | 5207 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 5208 | uint32_t postShift); |
cactode | 59:8aa304768360 | 5209 | |
cactode | 59:8aa304768360 | 5210 | |
cactode | 59:8aa304768360 | 5211 | /** |
cactode | 59:8aa304768360 | 5212 | * @brief Instance structure for the floating-point normalized LMS filter. |
cactode | 59:8aa304768360 | 5213 | */ |
cactode | 59:8aa304768360 | 5214 | typedef struct |
cactode | 59:8aa304768360 | 5215 | { |
cactode | 59:8aa304768360 | 5216 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5217 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 5218 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5219 | float32_t mu; /**< step size that control filter coefficient updates. */ |
cactode | 59:8aa304768360 | 5220 | float32_t energy; /**< saves previous frame energy. */ |
cactode | 59:8aa304768360 | 5221 | float32_t x0; /**< saves previous input sample. */ |
cactode | 59:8aa304768360 | 5222 | } arm_lms_norm_instance_f32; |
cactode | 59:8aa304768360 | 5223 | |
cactode | 59:8aa304768360 | 5224 | |
cactode | 59:8aa304768360 | 5225 | /** |
cactode | 59:8aa304768360 | 5226 | * @brief Processing function for floating-point normalized LMS filter. |
cactode | 59:8aa304768360 | 5227 | * @param[in] S points to an instance of the floating-point normalized LMS filter structure. |
cactode | 59:8aa304768360 | 5228 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5229 | * @param[in] pRef points to the block of reference data. |
cactode | 59:8aa304768360 | 5230 | * @param[out] pOut points to the block of output data. |
cactode | 59:8aa304768360 | 5231 | * @param[out] pErr points to the block of error data. |
cactode | 59:8aa304768360 | 5232 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5233 | */ |
cactode | 59:8aa304768360 | 5234 | void arm_lms_norm_f32( |
cactode | 59:8aa304768360 | 5235 | arm_lms_norm_instance_f32 * S, |
cactode | 59:8aa304768360 | 5236 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 5237 | float32_t * pRef, |
cactode | 59:8aa304768360 | 5238 | float32_t * pOut, |
cactode | 59:8aa304768360 | 5239 | float32_t * pErr, |
cactode | 59:8aa304768360 | 5240 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5241 | |
cactode | 59:8aa304768360 | 5242 | |
cactode | 59:8aa304768360 | 5243 | /** |
cactode | 59:8aa304768360 | 5244 | * @brief Initialization function for floating-point normalized LMS filter. |
cactode | 59:8aa304768360 | 5245 | * @param[in] S points to an instance of the floating-point LMS filter structure. |
cactode | 59:8aa304768360 | 5246 | * @param[in] numTaps number of filter coefficients. |
cactode | 59:8aa304768360 | 5247 | * @param[in] pCoeffs points to coefficient buffer. |
cactode | 59:8aa304768360 | 5248 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 5249 | * @param[in] mu step size that controls filter coefficient updates. |
cactode | 59:8aa304768360 | 5250 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5251 | */ |
cactode | 59:8aa304768360 | 5252 | void arm_lms_norm_init_f32( |
cactode | 59:8aa304768360 | 5253 | arm_lms_norm_instance_f32 * S, |
cactode | 59:8aa304768360 | 5254 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5255 | float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 5256 | float32_t * pState, |
cactode | 59:8aa304768360 | 5257 | float32_t mu, |
cactode | 59:8aa304768360 | 5258 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5259 | |
cactode | 59:8aa304768360 | 5260 | |
cactode | 59:8aa304768360 | 5261 | /** |
cactode | 59:8aa304768360 | 5262 | * @brief Instance structure for the Q31 normalized LMS filter. |
cactode | 59:8aa304768360 | 5263 | */ |
cactode | 59:8aa304768360 | 5264 | typedef struct |
cactode | 59:8aa304768360 | 5265 | { |
cactode | 59:8aa304768360 | 5266 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5267 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 5268 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5269 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
cactode | 59:8aa304768360 | 5270 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
cactode | 59:8aa304768360 | 5271 | const q31_t *recipTable; /**< points to the reciprocal initial value table. */ |
cactode | 59:8aa304768360 | 5272 | q31_t energy; /**< saves previous frame energy. */ |
cactode | 59:8aa304768360 | 5273 | q31_t x0; /**< saves previous input sample. */ |
cactode | 59:8aa304768360 | 5274 | } arm_lms_norm_instance_q31; |
cactode | 59:8aa304768360 | 5275 | |
cactode | 59:8aa304768360 | 5276 | |
cactode | 59:8aa304768360 | 5277 | /** |
cactode | 59:8aa304768360 | 5278 | * @brief Processing function for Q31 normalized LMS filter. |
cactode | 59:8aa304768360 | 5279 | * @param[in] S points to an instance of the Q31 normalized LMS filter structure. |
cactode | 59:8aa304768360 | 5280 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5281 | * @param[in] pRef points to the block of reference data. |
cactode | 59:8aa304768360 | 5282 | * @param[out] pOut points to the block of output data. |
cactode | 59:8aa304768360 | 5283 | * @param[out] pErr points to the block of error data. |
cactode | 59:8aa304768360 | 5284 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5285 | */ |
cactode | 59:8aa304768360 | 5286 | void arm_lms_norm_q31( |
cactode | 59:8aa304768360 | 5287 | arm_lms_norm_instance_q31 * S, |
cactode | 59:8aa304768360 | 5288 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 5289 | q31_t * pRef, |
cactode | 59:8aa304768360 | 5290 | q31_t * pOut, |
cactode | 59:8aa304768360 | 5291 | q31_t * pErr, |
cactode | 59:8aa304768360 | 5292 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5293 | |
cactode | 59:8aa304768360 | 5294 | |
cactode | 59:8aa304768360 | 5295 | /** |
cactode | 59:8aa304768360 | 5296 | * @brief Initialization function for Q31 normalized LMS filter. |
cactode | 59:8aa304768360 | 5297 | * @param[in] S points to an instance of the Q31 normalized LMS filter structure. |
cactode | 59:8aa304768360 | 5298 | * @param[in] numTaps number of filter coefficients. |
cactode | 59:8aa304768360 | 5299 | * @param[in] pCoeffs points to coefficient buffer. |
cactode | 59:8aa304768360 | 5300 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 5301 | * @param[in] mu step size that controls filter coefficient updates. |
cactode | 59:8aa304768360 | 5302 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5303 | * @param[in] postShift bit shift applied to coefficients. |
cactode | 59:8aa304768360 | 5304 | */ |
cactode | 59:8aa304768360 | 5305 | void arm_lms_norm_init_q31( |
cactode | 59:8aa304768360 | 5306 | arm_lms_norm_instance_q31 * S, |
cactode | 59:8aa304768360 | 5307 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5308 | q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 5309 | q31_t * pState, |
cactode | 59:8aa304768360 | 5310 | q31_t mu, |
cactode | 59:8aa304768360 | 5311 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 5312 | uint8_t postShift); |
cactode | 59:8aa304768360 | 5313 | |
cactode | 59:8aa304768360 | 5314 | |
cactode | 59:8aa304768360 | 5315 | /** |
cactode | 59:8aa304768360 | 5316 | * @brief Instance structure for the Q15 normalized LMS filter. |
cactode | 59:8aa304768360 | 5317 | */ |
cactode | 59:8aa304768360 | 5318 | typedef struct |
cactode | 59:8aa304768360 | 5319 | { |
cactode | 59:8aa304768360 | 5320 | uint16_t numTaps; /**< Number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5321 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
cactode | 59:8aa304768360 | 5322 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5323 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
cactode | 59:8aa304768360 | 5324 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
cactode | 59:8aa304768360 | 5325 | const q15_t *recipTable; /**< Points to the reciprocal initial value table. */ |
cactode | 59:8aa304768360 | 5326 | q15_t energy; /**< saves previous frame energy. */ |
cactode | 59:8aa304768360 | 5327 | q15_t x0; /**< saves previous input sample. */ |
cactode | 59:8aa304768360 | 5328 | } arm_lms_norm_instance_q15; |
cactode | 59:8aa304768360 | 5329 | |
cactode | 59:8aa304768360 | 5330 | |
cactode | 59:8aa304768360 | 5331 | /** |
cactode | 59:8aa304768360 | 5332 | * @brief Processing function for Q15 normalized LMS filter. |
cactode | 59:8aa304768360 | 5333 | * @param[in] S points to an instance of the Q15 normalized LMS filter structure. |
cactode | 59:8aa304768360 | 5334 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5335 | * @param[in] pRef points to the block of reference data. |
cactode | 59:8aa304768360 | 5336 | * @param[out] pOut points to the block of output data. |
cactode | 59:8aa304768360 | 5337 | * @param[out] pErr points to the block of error data. |
cactode | 59:8aa304768360 | 5338 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5339 | */ |
cactode | 59:8aa304768360 | 5340 | void arm_lms_norm_q15( |
cactode | 59:8aa304768360 | 5341 | arm_lms_norm_instance_q15 * S, |
cactode | 59:8aa304768360 | 5342 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 5343 | q15_t * pRef, |
cactode | 59:8aa304768360 | 5344 | q15_t * pOut, |
cactode | 59:8aa304768360 | 5345 | q15_t * pErr, |
cactode | 59:8aa304768360 | 5346 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5347 | |
cactode | 59:8aa304768360 | 5348 | |
cactode | 59:8aa304768360 | 5349 | /** |
cactode | 59:8aa304768360 | 5350 | * @brief Initialization function for Q15 normalized LMS filter. |
cactode | 59:8aa304768360 | 5351 | * @param[in] S points to an instance of the Q15 normalized LMS filter structure. |
cactode | 59:8aa304768360 | 5352 | * @param[in] numTaps number of filter coefficients. |
cactode | 59:8aa304768360 | 5353 | * @param[in] pCoeffs points to coefficient buffer. |
cactode | 59:8aa304768360 | 5354 | * @param[in] pState points to state buffer. |
cactode | 59:8aa304768360 | 5355 | * @param[in] mu step size that controls filter coefficient updates. |
cactode | 59:8aa304768360 | 5356 | * @param[in] blockSize number of samples to process. |
cactode | 59:8aa304768360 | 5357 | * @param[in] postShift bit shift applied to coefficients. |
cactode | 59:8aa304768360 | 5358 | */ |
cactode | 59:8aa304768360 | 5359 | void arm_lms_norm_init_q15( |
cactode | 59:8aa304768360 | 5360 | arm_lms_norm_instance_q15 * S, |
cactode | 59:8aa304768360 | 5361 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5362 | q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 5363 | q15_t * pState, |
cactode | 59:8aa304768360 | 5364 | q15_t mu, |
cactode | 59:8aa304768360 | 5365 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 5366 | uint8_t postShift); |
cactode | 59:8aa304768360 | 5367 | |
cactode | 59:8aa304768360 | 5368 | |
cactode | 59:8aa304768360 | 5369 | /** |
cactode | 59:8aa304768360 | 5370 | * @brief Correlation of floating-point sequences. |
cactode | 59:8aa304768360 | 5371 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 5372 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 5373 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 5374 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 5375 | * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5376 | */ |
cactode | 59:8aa304768360 | 5377 | void arm_correlate_f32( |
cactode | 59:8aa304768360 | 5378 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 5379 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5380 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 5381 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5382 | float32_t * pDst); |
cactode | 59:8aa304768360 | 5383 | |
cactode | 59:8aa304768360 | 5384 | |
cactode | 59:8aa304768360 | 5385 | /** |
cactode | 59:8aa304768360 | 5386 | @brief Correlation of Q15 sequences |
cactode | 59:8aa304768360 | 5387 | @param[in] pSrcA points to the first input sequence |
cactode | 59:8aa304768360 | 5388 | @param[in] srcALen length of the first input sequence |
cactode | 59:8aa304768360 | 5389 | @param[in] pSrcB points to the second input sequence |
cactode | 59:8aa304768360 | 5390 | @param[in] srcBLen length of the second input sequence |
cactode | 59:8aa304768360 | 5391 | @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5392 | @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 5393 | */ |
cactode | 59:8aa304768360 | 5394 | void arm_correlate_opt_q15( |
cactode | 59:8aa304768360 | 5395 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 5396 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5397 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 5398 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5399 | q15_t * pDst, |
cactode | 59:8aa304768360 | 5400 | q15_t * pScratch); |
cactode | 59:8aa304768360 | 5401 | |
cactode | 59:8aa304768360 | 5402 | |
cactode | 59:8aa304768360 | 5403 | /** |
cactode | 59:8aa304768360 | 5404 | @brief Correlation of Q15 sequences. |
cactode | 59:8aa304768360 | 5405 | @param[in] pSrcA points to the first input sequence |
cactode | 59:8aa304768360 | 5406 | @param[in] srcALen length of the first input sequence |
cactode | 59:8aa304768360 | 5407 | @param[in] pSrcB points to the second input sequence |
cactode | 59:8aa304768360 | 5408 | @param[in] srcBLen length of the second input sequence |
cactode | 59:8aa304768360 | 5409 | @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5410 | */ |
cactode | 59:8aa304768360 | 5411 | void arm_correlate_q15( |
cactode | 59:8aa304768360 | 5412 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 5413 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5414 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 5415 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5416 | q15_t * pDst); |
cactode | 59:8aa304768360 | 5417 | |
cactode | 59:8aa304768360 | 5418 | |
cactode | 59:8aa304768360 | 5419 | /** |
cactode | 59:8aa304768360 | 5420 | @brief Correlation of Q15 sequences (fast version). |
cactode | 59:8aa304768360 | 5421 | @param[in] pSrcA points to the first input sequence |
cactode | 59:8aa304768360 | 5422 | @param[in] srcALen length of the first input sequence |
cactode | 59:8aa304768360 | 5423 | @param[in] pSrcB points to the second input sequence |
cactode | 59:8aa304768360 | 5424 | @param[in] srcBLen length of the second input sequence |
cactode | 59:8aa304768360 | 5425 | @param[out] pDst points to the location where the output result is written. Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5426 | @return none |
cactode | 59:8aa304768360 | 5427 | */ |
cactode | 59:8aa304768360 | 5428 | void arm_correlate_fast_q15( |
cactode | 59:8aa304768360 | 5429 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 5430 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5431 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 5432 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5433 | q15_t * pDst); |
cactode | 59:8aa304768360 | 5434 | |
cactode | 59:8aa304768360 | 5435 | |
cactode | 59:8aa304768360 | 5436 | /** |
cactode | 59:8aa304768360 | 5437 | @brief Correlation of Q15 sequences (fast version). |
cactode | 59:8aa304768360 | 5438 | @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 5439 | @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 5440 | @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 5441 | @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 5442 | @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5443 | @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 5444 | */ |
cactode | 59:8aa304768360 | 5445 | void arm_correlate_fast_opt_q15( |
cactode | 59:8aa304768360 | 5446 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 5447 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5448 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 5449 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5450 | q15_t * pDst, |
cactode | 59:8aa304768360 | 5451 | q15_t * pScratch); |
cactode | 59:8aa304768360 | 5452 | |
cactode | 59:8aa304768360 | 5453 | |
cactode | 59:8aa304768360 | 5454 | /** |
cactode | 59:8aa304768360 | 5455 | * @brief Correlation of Q31 sequences. |
cactode | 59:8aa304768360 | 5456 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 5457 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 5458 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 5459 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 5460 | * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5461 | */ |
cactode | 59:8aa304768360 | 5462 | void arm_correlate_q31( |
cactode | 59:8aa304768360 | 5463 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 5464 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5465 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 5466 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5467 | q31_t * pDst); |
cactode | 59:8aa304768360 | 5468 | |
cactode | 59:8aa304768360 | 5469 | |
cactode | 59:8aa304768360 | 5470 | /** |
cactode | 59:8aa304768360 | 5471 | @brief Correlation of Q31 sequences (fast version). |
cactode | 59:8aa304768360 | 5472 | @param[in] pSrcA points to the first input sequence |
cactode | 59:8aa304768360 | 5473 | @param[in] srcALen length of the first input sequence |
cactode | 59:8aa304768360 | 5474 | @param[in] pSrcB points to the second input sequence |
cactode | 59:8aa304768360 | 5475 | @param[in] srcBLen length of the second input sequence |
cactode | 59:8aa304768360 | 5476 | @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5477 | */ |
cactode | 59:8aa304768360 | 5478 | void arm_correlate_fast_q31( |
cactode | 59:8aa304768360 | 5479 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 5480 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5481 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 5482 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5483 | q31_t * pDst); |
cactode | 59:8aa304768360 | 5484 | |
cactode | 59:8aa304768360 | 5485 | |
cactode | 59:8aa304768360 | 5486 | /** |
cactode | 59:8aa304768360 | 5487 | * @brief Correlation of Q7 sequences. |
cactode | 59:8aa304768360 | 5488 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 5489 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 5490 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 5491 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 5492 | * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5493 | * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
cactode | 59:8aa304768360 | 5494 | * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
cactode | 59:8aa304768360 | 5495 | */ |
cactode | 59:8aa304768360 | 5496 | void arm_correlate_opt_q7( |
cactode | 59:8aa304768360 | 5497 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 5498 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5499 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 5500 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5501 | q7_t * pDst, |
cactode | 59:8aa304768360 | 5502 | q15_t * pScratch1, |
cactode | 59:8aa304768360 | 5503 | q15_t * pScratch2); |
cactode | 59:8aa304768360 | 5504 | |
cactode | 59:8aa304768360 | 5505 | |
cactode | 59:8aa304768360 | 5506 | /** |
cactode | 59:8aa304768360 | 5507 | * @brief Correlation of Q7 sequences. |
cactode | 59:8aa304768360 | 5508 | * @param[in] pSrcA points to the first input sequence. |
cactode | 59:8aa304768360 | 5509 | * @param[in] srcALen length of the first input sequence. |
cactode | 59:8aa304768360 | 5510 | * @param[in] pSrcB points to the second input sequence. |
cactode | 59:8aa304768360 | 5511 | * @param[in] srcBLen length of the second input sequence. |
cactode | 59:8aa304768360 | 5512 | * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
cactode | 59:8aa304768360 | 5513 | */ |
cactode | 59:8aa304768360 | 5514 | void arm_correlate_q7( |
cactode | 59:8aa304768360 | 5515 | const q7_t * pSrcA, |
cactode | 59:8aa304768360 | 5516 | uint32_t srcALen, |
cactode | 59:8aa304768360 | 5517 | const q7_t * pSrcB, |
cactode | 59:8aa304768360 | 5518 | uint32_t srcBLen, |
cactode | 59:8aa304768360 | 5519 | q7_t * pDst); |
cactode | 59:8aa304768360 | 5520 | |
cactode | 59:8aa304768360 | 5521 | |
cactode | 59:8aa304768360 | 5522 | /** |
cactode | 59:8aa304768360 | 5523 | * @brief Instance structure for the floating-point sparse FIR filter. |
cactode | 59:8aa304768360 | 5524 | */ |
cactode | 59:8aa304768360 | 5525 | typedef struct |
cactode | 59:8aa304768360 | 5526 | { |
cactode | 59:8aa304768360 | 5527 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5528 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
cactode | 59:8aa304768360 | 5529 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
cactode | 59:8aa304768360 | 5530 | const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 5531 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
cactode | 59:8aa304768360 | 5532 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5533 | } arm_fir_sparse_instance_f32; |
cactode | 59:8aa304768360 | 5534 | |
cactode | 59:8aa304768360 | 5535 | /** |
cactode | 59:8aa304768360 | 5536 | * @brief Instance structure for the Q31 sparse FIR filter. |
cactode | 59:8aa304768360 | 5537 | */ |
cactode | 59:8aa304768360 | 5538 | typedef struct |
cactode | 59:8aa304768360 | 5539 | { |
cactode | 59:8aa304768360 | 5540 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5541 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
cactode | 59:8aa304768360 | 5542 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
cactode | 59:8aa304768360 | 5543 | const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 5544 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
cactode | 59:8aa304768360 | 5545 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5546 | } arm_fir_sparse_instance_q31; |
cactode | 59:8aa304768360 | 5547 | |
cactode | 59:8aa304768360 | 5548 | /** |
cactode | 59:8aa304768360 | 5549 | * @brief Instance structure for the Q15 sparse FIR filter. |
cactode | 59:8aa304768360 | 5550 | */ |
cactode | 59:8aa304768360 | 5551 | typedef struct |
cactode | 59:8aa304768360 | 5552 | { |
cactode | 59:8aa304768360 | 5553 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5554 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
cactode | 59:8aa304768360 | 5555 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
cactode | 59:8aa304768360 | 5556 | const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 5557 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
cactode | 59:8aa304768360 | 5558 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5559 | } arm_fir_sparse_instance_q15; |
cactode | 59:8aa304768360 | 5560 | |
cactode | 59:8aa304768360 | 5561 | /** |
cactode | 59:8aa304768360 | 5562 | * @brief Instance structure for the Q7 sparse FIR filter. |
cactode | 59:8aa304768360 | 5563 | */ |
cactode | 59:8aa304768360 | 5564 | typedef struct |
cactode | 59:8aa304768360 | 5565 | { |
cactode | 59:8aa304768360 | 5566 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
cactode | 59:8aa304768360 | 5567 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
cactode | 59:8aa304768360 | 5568 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
cactode | 59:8aa304768360 | 5569 | const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
cactode | 59:8aa304768360 | 5570 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
cactode | 59:8aa304768360 | 5571 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
cactode | 59:8aa304768360 | 5572 | } arm_fir_sparse_instance_q7; |
cactode | 59:8aa304768360 | 5573 | |
cactode | 59:8aa304768360 | 5574 | |
cactode | 59:8aa304768360 | 5575 | /** |
cactode | 59:8aa304768360 | 5576 | * @brief Processing function for the floating-point sparse FIR filter. |
cactode | 59:8aa304768360 | 5577 | * @param[in] S points to an instance of the floating-point sparse FIR structure. |
cactode | 59:8aa304768360 | 5578 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5579 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 5580 | * @param[in] pScratchIn points to a temporary buffer of size blockSize. |
cactode | 59:8aa304768360 | 5581 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 5582 | */ |
cactode | 59:8aa304768360 | 5583 | void arm_fir_sparse_f32( |
cactode | 59:8aa304768360 | 5584 | arm_fir_sparse_instance_f32 * S, |
cactode | 59:8aa304768360 | 5585 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 5586 | float32_t * pDst, |
cactode | 59:8aa304768360 | 5587 | float32_t * pScratchIn, |
cactode | 59:8aa304768360 | 5588 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5589 | |
cactode | 59:8aa304768360 | 5590 | |
cactode | 59:8aa304768360 | 5591 | /** |
cactode | 59:8aa304768360 | 5592 | * @brief Initialization function for the floating-point sparse FIR filter. |
cactode | 59:8aa304768360 | 5593 | * @param[in,out] S points to an instance of the floating-point sparse FIR structure. |
cactode | 59:8aa304768360 | 5594 | * @param[in] numTaps number of nonzero coefficients in the filter. |
cactode | 59:8aa304768360 | 5595 | * @param[in] pCoeffs points to the array of filter coefficients. |
cactode | 59:8aa304768360 | 5596 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 5597 | * @param[in] pTapDelay points to the array of offset times. |
cactode | 59:8aa304768360 | 5598 | * @param[in] maxDelay maximum offset time supported. |
cactode | 59:8aa304768360 | 5599 | * @param[in] blockSize number of samples that will be processed per block. |
cactode | 59:8aa304768360 | 5600 | */ |
cactode | 59:8aa304768360 | 5601 | void arm_fir_sparse_init_f32( |
cactode | 59:8aa304768360 | 5602 | arm_fir_sparse_instance_f32 * S, |
cactode | 59:8aa304768360 | 5603 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5604 | const float32_t * pCoeffs, |
cactode | 59:8aa304768360 | 5605 | float32_t * pState, |
cactode | 59:8aa304768360 | 5606 | int32_t * pTapDelay, |
cactode | 59:8aa304768360 | 5607 | uint16_t maxDelay, |
cactode | 59:8aa304768360 | 5608 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5609 | |
cactode | 59:8aa304768360 | 5610 | |
cactode | 59:8aa304768360 | 5611 | /** |
cactode | 59:8aa304768360 | 5612 | * @brief Processing function for the Q31 sparse FIR filter. |
cactode | 59:8aa304768360 | 5613 | * @param[in] S points to an instance of the Q31 sparse FIR structure. |
cactode | 59:8aa304768360 | 5614 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5615 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 5616 | * @param[in] pScratchIn points to a temporary buffer of size blockSize. |
cactode | 59:8aa304768360 | 5617 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 5618 | */ |
cactode | 59:8aa304768360 | 5619 | void arm_fir_sparse_q31( |
cactode | 59:8aa304768360 | 5620 | arm_fir_sparse_instance_q31 * S, |
cactode | 59:8aa304768360 | 5621 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 5622 | q31_t * pDst, |
cactode | 59:8aa304768360 | 5623 | q31_t * pScratchIn, |
cactode | 59:8aa304768360 | 5624 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5625 | |
cactode | 59:8aa304768360 | 5626 | |
cactode | 59:8aa304768360 | 5627 | /** |
cactode | 59:8aa304768360 | 5628 | * @brief Initialization function for the Q31 sparse FIR filter. |
cactode | 59:8aa304768360 | 5629 | * @param[in,out] S points to an instance of the Q31 sparse FIR structure. |
cactode | 59:8aa304768360 | 5630 | * @param[in] numTaps number of nonzero coefficients in the filter. |
cactode | 59:8aa304768360 | 5631 | * @param[in] pCoeffs points to the array of filter coefficients. |
cactode | 59:8aa304768360 | 5632 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 5633 | * @param[in] pTapDelay points to the array of offset times. |
cactode | 59:8aa304768360 | 5634 | * @param[in] maxDelay maximum offset time supported. |
cactode | 59:8aa304768360 | 5635 | * @param[in] blockSize number of samples that will be processed per block. |
cactode | 59:8aa304768360 | 5636 | */ |
cactode | 59:8aa304768360 | 5637 | void arm_fir_sparse_init_q31( |
cactode | 59:8aa304768360 | 5638 | arm_fir_sparse_instance_q31 * S, |
cactode | 59:8aa304768360 | 5639 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5640 | const q31_t * pCoeffs, |
cactode | 59:8aa304768360 | 5641 | q31_t * pState, |
cactode | 59:8aa304768360 | 5642 | int32_t * pTapDelay, |
cactode | 59:8aa304768360 | 5643 | uint16_t maxDelay, |
cactode | 59:8aa304768360 | 5644 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5645 | |
cactode | 59:8aa304768360 | 5646 | |
cactode | 59:8aa304768360 | 5647 | /** |
cactode | 59:8aa304768360 | 5648 | * @brief Processing function for the Q15 sparse FIR filter. |
cactode | 59:8aa304768360 | 5649 | * @param[in] S points to an instance of the Q15 sparse FIR structure. |
cactode | 59:8aa304768360 | 5650 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5651 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 5652 | * @param[in] pScratchIn points to a temporary buffer of size blockSize. |
cactode | 59:8aa304768360 | 5653 | * @param[in] pScratchOut points to a temporary buffer of size blockSize. |
cactode | 59:8aa304768360 | 5654 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 5655 | */ |
cactode | 59:8aa304768360 | 5656 | void arm_fir_sparse_q15( |
cactode | 59:8aa304768360 | 5657 | arm_fir_sparse_instance_q15 * S, |
cactode | 59:8aa304768360 | 5658 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 5659 | q15_t * pDst, |
cactode | 59:8aa304768360 | 5660 | q15_t * pScratchIn, |
cactode | 59:8aa304768360 | 5661 | q31_t * pScratchOut, |
cactode | 59:8aa304768360 | 5662 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5663 | |
cactode | 59:8aa304768360 | 5664 | |
cactode | 59:8aa304768360 | 5665 | /** |
cactode | 59:8aa304768360 | 5666 | * @brief Initialization function for the Q15 sparse FIR filter. |
cactode | 59:8aa304768360 | 5667 | * @param[in,out] S points to an instance of the Q15 sparse FIR structure. |
cactode | 59:8aa304768360 | 5668 | * @param[in] numTaps number of nonzero coefficients in the filter. |
cactode | 59:8aa304768360 | 5669 | * @param[in] pCoeffs points to the array of filter coefficients. |
cactode | 59:8aa304768360 | 5670 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 5671 | * @param[in] pTapDelay points to the array of offset times. |
cactode | 59:8aa304768360 | 5672 | * @param[in] maxDelay maximum offset time supported. |
cactode | 59:8aa304768360 | 5673 | * @param[in] blockSize number of samples that will be processed per block. |
cactode | 59:8aa304768360 | 5674 | */ |
cactode | 59:8aa304768360 | 5675 | void arm_fir_sparse_init_q15( |
cactode | 59:8aa304768360 | 5676 | arm_fir_sparse_instance_q15 * S, |
cactode | 59:8aa304768360 | 5677 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5678 | const q15_t * pCoeffs, |
cactode | 59:8aa304768360 | 5679 | q15_t * pState, |
cactode | 59:8aa304768360 | 5680 | int32_t * pTapDelay, |
cactode | 59:8aa304768360 | 5681 | uint16_t maxDelay, |
cactode | 59:8aa304768360 | 5682 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5683 | |
cactode | 59:8aa304768360 | 5684 | |
cactode | 59:8aa304768360 | 5685 | /** |
cactode | 59:8aa304768360 | 5686 | * @brief Processing function for the Q7 sparse FIR filter. |
cactode | 59:8aa304768360 | 5687 | * @param[in] S points to an instance of the Q7 sparse FIR structure. |
cactode | 59:8aa304768360 | 5688 | * @param[in] pSrc points to the block of input data. |
cactode | 59:8aa304768360 | 5689 | * @param[out] pDst points to the block of output data |
cactode | 59:8aa304768360 | 5690 | * @param[in] pScratchIn points to a temporary buffer of size blockSize. |
cactode | 59:8aa304768360 | 5691 | * @param[in] pScratchOut points to a temporary buffer of size blockSize. |
cactode | 59:8aa304768360 | 5692 | * @param[in] blockSize number of input samples to process per call. |
cactode | 59:8aa304768360 | 5693 | */ |
cactode | 59:8aa304768360 | 5694 | void arm_fir_sparse_q7( |
cactode | 59:8aa304768360 | 5695 | arm_fir_sparse_instance_q7 * S, |
cactode | 59:8aa304768360 | 5696 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 5697 | q7_t * pDst, |
cactode | 59:8aa304768360 | 5698 | q7_t * pScratchIn, |
cactode | 59:8aa304768360 | 5699 | q31_t * pScratchOut, |
cactode | 59:8aa304768360 | 5700 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5701 | |
cactode | 59:8aa304768360 | 5702 | |
cactode | 59:8aa304768360 | 5703 | /** |
cactode | 59:8aa304768360 | 5704 | * @brief Initialization function for the Q7 sparse FIR filter. |
cactode | 59:8aa304768360 | 5705 | * @param[in,out] S points to an instance of the Q7 sparse FIR structure. |
cactode | 59:8aa304768360 | 5706 | * @param[in] numTaps number of nonzero coefficients in the filter. |
cactode | 59:8aa304768360 | 5707 | * @param[in] pCoeffs points to the array of filter coefficients. |
cactode | 59:8aa304768360 | 5708 | * @param[in] pState points to the state buffer. |
cactode | 59:8aa304768360 | 5709 | * @param[in] pTapDelay points to the array of offset times. |
cactode | 59:8aa304768360 | 5710 | * @param[in] maxDelay maximum offset time supported. |
cactode | 59:8aa304768360 | 5711 | * @param[in] blockSize number of samples that will be processed per block. |
cactode | 59:8aa304768360 | 5712 | */ |
cactode | 59:8aa304768360 | 5713 | void arm_fir_sparse_init_q7( |
cactode | 59:8aa304768360 | 5714 | arm_fir_sparse_instance_q7 * S, |
cactode | 59:8aa304768360 | 5715 | uint16_t numTaps, |
cactode | 59:8aa304768360 | 5716 | const q7_t * pCoeffs, |
cactode | 59:8aa304768360 | 5717 | q7_t * pState, |
cactode | 59:8aa304768360 | 5718 | int32_t * pTapDelay, |
cactode | 59:8aa304768360 | 5719 | uint16_t maxDelay, |
cactode | 59:8aa304768360 | 5720 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 5721 | |
cactode | 59:8aa304768360 | 5722 | |
cactode | 59:8aa304768360 | 5723 | /** |
cactode | 59:8aa304768360 | 5724 | * @brief Floating-point sin_cos function. |
cactode | 59:8aa304768360 | 5725 | * @param[in] theta input value in degrees |
cactode | 59:8aa304768360 | 5726 | * @param[out] pSinVal points to the processed sine output. |
cactode | 59:8aa304768360 | 5727 | * @param[out] pCosVal points to the processed cos output. |
cactode | 59:8aa304768360 | 5728 | */ |
cactode | 59:8aa304768360 | 5729 | void arm_sin_cos_f32( |
cactode | 59:8aa304768360 | 5730 | float32_t theta, |
cactode | 59:8aa304768360 | 5731 | float32_t * pSinVal, |
cactode | 59:8aa304768360 | 5732 | float32_t * pCosVal); |
cactode | 59:8aa304768360 | 5733 | |
cactode | 59:8aa304768360 | 5734 | |
cactode | 59:8aa304768360 | 5735 | /** |
cactode | 59:8aa304768360 | 5736 | * @brief Q31 sin_cos function. |
cactode | 59:8aa304768360 | 5737 | * @param[in] theta scaled input value in degrees |
cactode | 59:8aa304768360 | 5738 | * @param[out] pSinVal points to the processed sine output. |
cactode | 59:8aa304768360 | 5739 | * @param[out] pCosVal points to the processed cosine output. |
cactode | 59:8aa304768360 | 5740 | */ |
cactode | 59:8aa304768360 | 5741 | void arm_sin_cos_q31( |
cactode | 59:8aa304768360 | 5742 | q31_t theta, |
cactode | 59:8aa304768360 | 5743 | q31_t * pSinVal, |
cactode | 59:8aa304768360 | 5744 | q31_t * pCosVal); |
cactode | 59:8aa304768360 | 5745 | |
cactode | 59:8aa304768360 | 5746 | |
cactode | 59:8aa304768360 | 5747 | /** |
cactode | 59:8aa304768360 | 5748 | * @brief Floating-point complex conjugate. |
cactode | 59:8aa304768360 | 5749 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 5750 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 5751 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 5752 | */ |
cactode | 59:8aa304768360 | 5753 | void arm_cmplx_conj_f32( |
cactode | 59:8aa304768360 | 5754 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 5755 | float32_t * pDst, |
cactode | 59:8aa304768360 | 5756 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 5757 | |
cactode | 59:8aa304768360 | 5758 | /** |
cactode | 59:8aa304768360 | 5759 | * @brief Q31 complex conjugate. |
cactode | 59:8aa304768360 | 5760 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 5761 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 5762 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 5763 | */ |
cactode | 59:8aa304768360 | 5764 | void arm_cmplx_conj_q31( |
cactode | 59:8aa304768360 | 5765 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 5766 | q31_t * pDst, |
cactode | 59:8aa304768360 | 5767 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 5768 | |
cactode | 59:8aa304768360 | 5769 | |
cactode | 59:8aa304768360 | 5770 | /** |
cactode | 59:8aa304768360 | 5771 | * @brief Q15 complex conjugate. |
cactode | 59:8aa304768360 | 5772 | * @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 5773 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 5774 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 5775 | */ |
cactode | 59:8aa304768360 | 5776 | void arm_cmplx_conj_q15( |
cactode | 59:8aa304768360 | 5777 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 5778 | q15_t * pDst, |
cactode | 59:8aa304768360 | 5779 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 5780 | |
cactode | 59:8aa304768360 | 5781 | |
cactode | 59:8aa304768360 | 5782 | /** |
cactode | 59:8aa304768360 | 5783 | * @brief Floating-point complex magnitude squared |
cactode | 59:8aa304768360 | 5784 | * @param[in] pSrc points to the complex input vector |
cactode | 59:8aa304768360 | 5785 | * @param[out] pDst points to the real output vector |
cactode | 59:8aa304768360 | 5786 | * @param[in] numSamples number of complex samples in the input vector |
cactode | 59:8aa304768360 | 5787 | */ |
cactode | 59:8aa304768360 | 5788 | void arm_cmplx_mag_squared_f32( |
cactode | 59:8aa304768360 | 5789 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 5790 | float32_t * pDst, |
cactode | 59:8aa304768360 | 5791 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 5792 | |
cactode | 59:8aa304768360 | 5793 | |
cactode | 59:8aa304768360 | 5794 | /** |
cactode | 59:8aa304768360 | 5795 | * @brief Q31 complex magnitude squared |
cactode | 59:8aa304768360 | 5796 | * @param[in] pSrc points to the complex input vector |
cactode | 59:8aa304768360 | 5797 | * @param[out] pDst points to the real output vector |
cactode | 59:8aa304768360 | 5798 | * @param[in] numSamples number of complex samples in the input vector |
cactode | 59:8aa304768360 | 5799 | */ |
cactode | 59:8aa304768360 | 5800 | void arm_cmplx_mag_squared_q31( |
cactode | 59:8aa304768360 | 5801 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 5802 | q31_t * pDst, |
cactode | 59:8aa304768360 | 5803 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 5804 | |
cactode | 59:8aa304768360 | 5805 | |
cactode | 59:8aa304768360 | 5806 | /** |
cactode | 59:8aa304768360 | 5807 | * @brief Q15 complex magnitude squared |
cactode | 59:8aa304768360 | 5808 | * @param[in] pSrc points to the complex input vector |
cactode | 59:8aa304768360 | 5809 | * @param[out] pDst points to the real output vector |
cactode | 59:8aa304768360 | 5810 | * @param[in] numSamples number of complex samples in the input vector |
cactode | 59:8aa304768360 | 5811 | */ |
cactode | 59:8aa304768360 | 5812 | void arm_cmplx_mag_squared_q15( |
cactode | 59:8aa304768360 | 5813 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 5814 | q15_t * pDst, |
cactode | 59:8aa304768360 | 5815 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 5816 | |
cactode | 59:8aa304768360 | 5817 | |
cactode | 59:8aa304768360 | 5818 | /** |
cactode | 59:8aa304768360 | 5819 | * @ingroup groupController |
cactode | 59:8aa304768360 | 5820 | */ |
cactode | 59:8aa304768360 | 5821 | |
cactode | 59:8aa304768360 | 5822 | /** |
cactode | 59:8aa304768360 | 5823 | * @defgroup PID PID Motor Control |
cactode | 59:8aa304768360 | 5824 | * |
cactode | 59:8aa304768360 | 5825 | * A Proportional Integral Derivative (PID) controller is a generic feedback control |
cactode | 59:8aa304768360 | 5826 | * loop mechanism widely used in industrial control systems. |
cactode | 59:8aa304768360 | 5827 | * A PID controller is the most commonly used type of feedback controller. |
cactode | 59:8aa304768360 | 5828 | * |
cactode | 59:8aa304768360 | 5829 | * This set of functions implements (PID) controllers |
cactode | 59:8aa304768360 | 5830 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample |
cactode | 59:8aa304768360 | 5831 | * of data and each call to the function returns a single processed value. |
cactode | 59:8aa304768360 | 5832 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code> |
cactode | 59:8aa304768360 | 5833 | * is the input sample value. The functions return the output value. |
cactode | 59:8aa304768360 | 5834 | * |
cactode | 59:8aa304768360 | 5835 | * \par Algorithm: |
cactode | 59:8aa304768360 | 5836 | * <pre> |
cactode | 59:8aa304768360 | 5837 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] |
cactode | 59:8aa304768360 | 5838 | * A0 = Kp + Ki + Kd |
cactode | 59:8aa304768360 | 5839 | * A1 = (-Kp ) - (2 * Kd ) |
cactode | 59:8aa304768360 | 5840 | * A2 = Kd |
cactode | 59:8aa304768360 | 5841 | * </pre> |
cactode | 59:8aa304768360 | 5842 | * |
cactode | 59:8aa304768360 | 5843 | * \par |
cactode | 59:8aa304768360 | 5844 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant |
cactode | 59:8aa304768360 | 5845 | * |
cactode | 59:8aa304768360 | 5846 | * \par |
cactode | 59:8aa304768360 | 5847 | * \image html PID.gif "Proportional Integral Derivative Controller" |
cactode | 59:8aa304768360 | 5848 | * |
cactode | 59:8aa304768360 | 5849 | * \par |
cactode | 59:8aa304768360 | 5850 | * The PID controller calculates an "error" value as the difference between |
cactode | 59:8aa304768360 | 5851 | * the measured output and the reference input. |
cactode | 59:8aa304768360 | 5852 | * The controller attempts to minimize the error by adjusting the process control inputs. |
cactode | 59:8aa304768360 | 5853 | * The proportional value determines the reaction to the current error, |
cactode | 59:8aa304768360 | 5854 | * the integral value determines the reaction based on the sum of recent errors, |
cactode | 59:8aa304768360 | 5855 | * and the derivative value determines the reaction based on the rate at which the error has been changing. |
cactode | 59:8aa304768360 | 5856 | * |
cactode | 59:8aa304768360 | 5857 | * \par Instance Structure |
cactode | 59:8aa304768360 | 5858 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. |
cactode | 59:8aa304768360 | 5859 | * A separate instance structure must be defined for each PID Controller. |
cactode | 59:8aa304768360 | 5860 | * There are separate instance structure declarations for each of the 3 supported data types. |
cactode | 59:8aa304768360 | 5861 | * |
cactode | 59:8aa304768360 | 5862 | * \par Reset Functions |
cactode | 59:8aa304768360 | 5863 | * There is also an associated reset function for each data type which clears the state array. |
cactode | 59:8aa304768360 | 5864 | * |
cactode | 59:8aa304768360 | 5865 | * \par Initialization Functions |
cactode | 59:8aa304768360 | 5866 | * There is also an associated initialization function for each data type. |
cactode | 59:8aa304768360 | 5867 | * The initialization function performs the following operations: |
cactode | 59:8aa304768360 | 5868 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. |
cactode | 59:8aa304768360 | 5869 | * - Zeros out the values in the state buffer. |
cactode | 59:8aa304768360 | 5870 | * |
cactode | 59:8aa304768360 | 5871 | * \par |
cactode | 59:8aa304768360 | 5872 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. |
cactode | 59:8aa304768360 | 5873 | * |
cactode | 59:8aa304768360 | 5874 | * \par Fixed-Point Behavior |
cactode | 59:8aa304768360 | 5875 | * Care must be taken when using the fixed-point versions of the PID Controller functions. |
cactode | 59:8aa304768360 | 5876 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. |
cactode | 59:8aa304768360 | 5877 | * Refer to the function specific documentation below for usage guidelines. |
cactode | 59:8aa304768360 | 5878 | */ |
cactode | 59:8aa304768360 | 5879 | |
cactode | 59:8aa304768360 | 5880 | /** |
cactode | 59:8aa304768360 | 5881 | * @addtogroup PID |
cactode | 59:8aa304768360 | 5882 | * @{ |
cactode | 59:8aa304768360 | 5883 | */ |
cactode | 59:8aa304768360 | 5884 | |
cactode | 59:8aa304768360 | 5885 | /** |
cactode | 59:8aa304768360 | 5886 | * @brief Process function for the floating-point PID Control. |
cactode | 59:8aa304768360 | 5887 | * @param[in,out] S is an instance of the floating-point PID Control structure |
cactode | 59:8aa304768360 | 5888 | * @param[in] in input sample to process |
cactode | 59:8aa304768360 | 5889 | * @return processed output sample. |
cactode | 59:8aa304768360 | 5890 | */ |
cactode | 59:8aa304768360 | 5891 | __STATIC_FORCEINLINE float32_t arm_pid_f32( |
cactode | 59:8aa304768360 | 5892 | arm_pid_instance_f32 * S, |
cactode | 59:8aa304768360 | 5893 | float32_t in) |
cactode | 59:8aa304768360 | 5894 | { |
cactode | 59:8aa304768360 | 5895 | float32_t out; |
cactode | 59:8aa304768360 | 5896 | |
cactode | 59:8aa304768360 | 5897 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ |
cactode | 59:8aa304768360 | 5898 | out = (S->A0 * in) + |
cactode | 59:8aa304768360 | 5899 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); |
cactode | 59:8aa304768360 | 5900 | |
cactode | 59:8aa304768360 | 5901 | /* Update state */ |
cactode | 59:8aa304768360 | 5902 | S->state[1] = S->state[0]; |
cactode | 59:8aa304768360 | 5903 | S->state[0] = in; |
cactode | 59:8aa304768360 | 5904 | S->state[2] = out; |
cactode | 59:8aa304768360 | 5905 | |
cactode | 59:8aa304768360 | 5906 | /* return to application */ |
cactode | 59:8aa304768360 | 5907 | return (out); |
cactode | 59:8aa304768360 | 5908 | |
cactode | 59:8aa304768360 | 5909 | } |
cactode | 59:8aa304768360 | 5910 | |
cactode | 59:8aa304768360 | 5911 | /** |
cactode | 59:8aa304768360 | 5912 | @brief Process function for the Q31 PID Control. |
cactode | 59:8aa304768360 | 5913 | @param[in,out] S points to an instance of the Q31 PID Control structure |
cactode | 59:8aa304768360 | 5914 | @param[in] in input sample to process |
cactode | 59:8aa304768360 | 5915 | @return processed output sample. |
cactode | 59:8aa304768360 | 5916 | |
cactode | 59:8aa304768360 | 5917 | \par Scaling and Overflow Behavior |
cactode | 59:8aa304768360 | 5918 | The function is implemented using an internal 64-bit accumulator. |
cactode | 59:8aa304768360 | 5919 | The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. |
cactode | 59:8aa304768360 | 5920 | Thus, if the accumulator result overflows it wraps around rather than clip. |
cactode | 59:8aa304768360 | 5921 | In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. |
cactode | 59:8aa304768360 | 5922 | After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. |
cactode | 59:8aa304768360 | 5923 | */ |
cactode | 59:8aa304768360 | 5924 | __STATIC_FORCEINLINE q31_t arm_pid_q31( |
cactode | 59:8aa304768360 | 5925 | arm_pid_instance_q31 * S, |
cactode | 59:8aa304768360 | 5926 | q31_t in) |
cactode | 59:8aa304768360 | 5927 | { |
cactode | 59:8aa304768360 | 5928 | q63_t acc; |
cactode | 59:8aa304768360 | 5929 | q31_t out; |
cactode | 59:8aa304768360 | 5930 | |
cactode | 59:8aa304768360 | 5931 | /* acc = A0 * x[n] */ |
cactode | 59:8aa304768360 | 5932 | acc = (q63_t) S->A0 * in; |
cactode | 59:8aa304768360 | 5933 | |
cactode | 59:8aa304768360 | 5934 | /* acc += A1 * x[n-1] */ |
cactode | 59:8aa304768360 | 5935 | acc += (q63_t) S->A1 * S->state[0]; |
cactode | 59:8aa304768360 | 5936 | |
cactode | 59:8aa304768360 | 5937 | /* acc += A2 * x[n-2] */ |
cactode | 59:8aa304768360 | 5938 | acc += (q63_t) S->A2 * S->state[1]; |
cactode | 59:8aa304768360 | 5939 | |
cactode | 59:8aa304768360 | 5940 | /* convert output to 1.31 format to add y[n-1] */ |
cactode | 59:8aa304768360 | 5941 | out = (q31_t) (acc >> 31U); |
cactode | 59:8aa304768360 | 5942 | |
cactode | 59:8aa304768360 | 5943 | /* out += y[n-1] */ |
cactode | 59:8aa304768360 | 5944 | out += S->state[2]; |
cactode | 59:8aa304768360 | 5945 | |
cactode | 59:8aa304768360 | 5946 | /* Update state */ |
cactode | 59:8aa304768360 | 5947 | S->state[1] = S->state[0]; |
cactode | 59:8aa304768360 | 5948 | S->state[0] = in; |
cactode | 59:8aa304768360 | 5949 | S->state[2] = out; |
cactode | 59:8aa304768360 | 5950 | |
cactode | 59:8aa304768360 | 5951 | /* return to application */ |
cactode | 59:8aa304768360 | 5952 | return (out); |
cactode | 59:8aa304768360 | 5953 | } |
cactode | 59:8aa304768360 | 5954 | |
cactode | 59:8aa304768360 | 5955 | |
cactode | 59:8aa304768360 | 5956 | /** |
cactode | 59:8aa304768360 | 5957 | @brief Process function for the Q15 PID Control. |
cactode | 59:8aa304768360 | 5958 | @param[in,out] S points to an instance of the Q15 PID Control structure |
cactode | 59:8aa304768360 | 5959 | @param[in] in input sample to process |
cactode | 59:8aa304768360 | 5960 | @return processed output sample. |
cactode | 59:8aa304768360 | 5961 | |
cactode | 59:8aa304768360 | 5962 | \par Scaling and Overflow Behavior |
cactode | 59:8aa304768360 | 5963 | The function is implemented using a 64-bit internal accumulator. |
cactode | 59:8aa304768360 | 5964 | Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. |
cactode | 59:8aa304768360 | 5965 | The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. |
cactode | 59:8aa304768360 | 5966 | There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. |
cactode | 59:8aa304768360 | 5967 | After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. |
cactode | 59:8aa304768360 | 5968 | Lastly, the accumulator is saturated to yield a result in 1.15 format. |
cactode | 59:8aa304768360 | 5969 | */ |
cactode | 59:8aa304768360 | 5970 | __STATIC_FORCEINLINE q15_t arm_pid_q15( |
cactode | 59:8aa304768360 | 5971 | arm_pid_instance_q15 * S, |
cactode | 59:8aa304768360 | 5972 | q15_t in) |
cactode | 59:8aa304768360 | 5973 | { |
cactode | 59:8aa304768360 | 5974 | q63_t acc; |
cactode | 59:8aa304768360 | 5975 | q15_t out; |
cactode | 59:8aa304768360 | 5976 | |
cactode | 59:8aa304768360 | 5977 | #if defined (ARM_MATH_DSP) |
cactode | 59:8aa304768360 | 5978 | /* Implementation of PID controller */ |
cactode | 59:8aa304768360 | 5979 | |
cactode | 59:8aa304768360 | 5980 | /* acc = A0 * x[n] */ |
cactode | 59:8aa304768360 | 5981 | acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in); |
cactode | 59:8aa304768360 | 5982 | |
cactode | 59:8aa304768360 | 5983 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
cactode | 59:8aa304768360 | 5984 | acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)read_q15x2 (S->state), (uint64_t)acc); |
cactode | 59:8aa304768360 | 5985 | #else |
cactode | 59:8aa304768360 | 5986 | /* acc = A0 * x[n] */ |
cactode | 59:8aa304768360 | 5987 | acc = ((q31_t) S->A0) * in; |
cactode | 59:8aa304768360 | 5988 | |
cactode | 59:8aa304768360 | 5989 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
cactode | 59:8aa304768360 | 5990 | acc += (q31_t) S->A1 * S->state[0]; |
cactode | 59:8aa304768360 | 5991 | acc += (q31_t) S->A2 * S->state[1]; |
cactode | 59:8aa304768360 | 5992 | #endif |
cactode | 59:8aa304768360 | 5993 | |
cactode | 59:8aa304768360 | 5994 | /* acc += y[n-1] */ |
cactode | 59:8aa304768360 | 5995 | acc += (q31_t) S->state[2] << 15; |
cactode | 59:8aa304768360 | 5996 | |
cactode | 59:8aa304768360 | 5997 | /* saturate the output */ |
cactode | 59:8aa304768360 | 5998 | out = (q15_t) (__SSAT((q31_t)(acc >> 15), 16)); |
cactode | 59:8aa304768360 | 5999 | |
cactode | 59:8aa304768360 | 6000 | /* Update state */ |
cactode | 59:8aa304768360 | 6001 | S->state[1] = S->state[0]; |
cactode | 59:8aa304768360 | 6002 | S->state[0] = in; |
cactode | 59:8aa304768360 | 6003 | S->state[2] = out; |
cactode | 59:8aa304768360 | 6004 | |
cactode | 59:8aa304768360 | 6005 | /* return to application */ |
cactode | 59:8aa304768360 | 6006 | return (out); |
cactode | 59:8aa304768360 | 6007 | } |
cactode | 59:8aa304768360 | 6008 | |
cactode | 59:8aa304768360 | 6009 | /** |
cactode | 59:8aa304768360 | 6010 | * @} end of PID group |
cactode | 59:8aa304768360 | 6011 | */ |
cactode | 59:8aa304768360 | 6012 | |
cactode | 59:8aa304768360 | 6013 | |
cactode | 59:8aa304768360 | 6014 | /** |
cactode | 59:8aa304768360 | 6015 | * @brief Floating-point matrix inverse. |
cactode | 59:8aa304768360 | 6016 | * @param[in] src points to the instance of the input floating-point matrix structure. |
cactode | 59:8aa304768360 | 6017 | * @param[out] dst points to the instance of the output floating-point matrix structure. |
cactode | 59:8aa304768360 | 6018 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
cactode | 59:8aa304768360 | 6019 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
cactode | 59:8aa304768360 | 6020 | */ |
cactode | 59:8aa304768360 | 6021 | arm_status arm_mat_inverse_f32( |
cactode | 59:8aa304768360 | 6022 | const arm_matrix_instance_f32 * src, |
cactode | 59:8aa304768360 | 6023 | arm_matrix_instance_f32 * dst); |
cactode | 59:8aa304768360 | 6024 | |
cactode | 59:8aa304768360 | 6025 | |
cactode | 59:8aa304768360 | 6026 | /** |
cactode | 59:8aa304768360 | 6027 | * @brief Floating-point matrix inverse. |
cactode | 59:8aa304768360 | 6028 | * @param[in] src points to the instance of the input floating-point matrix structure. |
cactode | 59:8aa304768360 | 6029 | * @param[out] dst points to the instance of the output floating-point matrix structure. |
cactode | 59:8aa304768360 | 6030 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
cactode | 59:8aa304768360 | 6031 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
cactode | 59:8aa304768360 | 6032 | */ |
cactode | 59:8aa304768360 | 6033 | arm_status arm_mat_inverse_f64( |
cactode | 59:8aa304768360 | 6034 | const arm_matrix_instance_f64 * src, |
cactode | 59:8aa304768360 | 6035 | arm_matrix_instance_f64 * dst); |
cactode | 59:8aa304768360 | 6036 | |
cactode | 59:8aa304768360 | 6037 | |
cactode | 59:8aa304768360 | 6038 | |
cactode | 59:8aa304768360 | 6039 | /** |
cactode | 59:8aa304768360 | 6040 | * @ingroup groupController |
cactode | 59:8aa304768360 | 6041 | */ |
cactode | 59:8aa304768360 | 6042 | |
cactode | 59:8aa304768360 | 6043 | /** |
cactode | 59:8aa304768360 | 6044 | * @defgroup clarke Vector Clarke Transform |
cactode | 59:8aa304768360 | 6045 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. |
cactode | 59:8aa304768360 | 6046 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents |
cactode | 59:8aa304768360 | 6047 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>. |
cactode | 59:8aa304768360 | 6048 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below |
cactode | 59:8aa304768360 | 6049 | * \image html clarke.gif Stator current space vector and its components in (a,b). |
cactode | 59:8aa304768360 | 6050 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code> |
cactode | 59:8aa304768360 | 6051 | * can be calculated using only <code>Ia</code> and <code>Ib</code>. |
cactode | 59:8aa304768360 | 6052 | * |
cactode | 59:8aa304768360 | 6053 | * The function operates on a single sample of data and each call to the function returns the processed output. |
cactode | 59:8aa304768360 | 6054 | * The library provides separate functions for Q31 and floating-point data types. |
cactode | 59:8aa304768360 | 6055 | * \par Algorithm |
cactode | 59:8aa304768360 | 6056 | * \image html clarkeFormula.gif |
cactode | 59:8aa304768360 | 6057 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and |
cactode | 59:8aa304768360 | 6058 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector. |
cactode | 59:8aa304768360 | 6059 | * \par Fixed-Point Behavior |
cactode | 59:8aa304768360 | 6060 | * Care must be taken when using the Q31 version of the Clarke transform. |
cactode | 59:8aa304768360 | 6061 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
cactode | 59:8aa304768360 | 6062 | * Refer to the function specific documentation below for usage guidelines. |
cactode | 59:8aa304768360 | 6063 | */ |
cactode | 59:8aa304768360 | 6064 | |
cactode | 59:8aa304768360 | 6065 | /** |
cactode | 59:8aa304768360 | 6066 | * @addtogroup clarke |
cactode | 59:8aa304768360 | 6067 | * @{ |
cactode | 59:8aa304768360 | 6068 | */ |
cactode | 59:8aa304768360 | 6069 | |
cactode | 59:8aa304768360 | 6070 | /** |
cactode | 59:8aa304768360 | 6071 | * |
cactode | 59:8aa304768360 | 6072 | * @brief Floating-point Clarke transform |
cactode | 59:8aa304768360 | 6073 | * @param[in] Ia input three-phase coordinate <code>a</code> |
cactode | 59:8aa304768360 | 6074 | * @param[in] Ib input three-phase coordinate <code>b</code> |
cactode | 59:8aa304768360 | 6075 | * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha |
cactode | 59:8aa304768360 | 6076 | * @param[out] pIbeta points to output two-phase orthogonal vector axis beta |
cactode | 59:8aa304768360 | 6077 | * @return none |
cactode | 59:8aa304768360 | 6078 | */ |
cactode | 59:8aa304768360 | 6079 | __STATIC_FORCEINLINE void arm_clarke_f32( |
cactode | 59:8aa304768360 | 6080 | float32_t Ia, |
cactode | 59:8aa304768360 | 6081 | float32_t Ib, |
cactode | 59:8aa304768360 | 6082 | float32_t * pIalpha, |
cactode | 59:8aa304768360 | 6083 | float32_t * pIbeta) |
cactode | 59:8aa304768360 | 6084 | { |
cactode | 59:8aa304768360 | 6085 | /* Calculate pIalpha using the equation, pIalpha = Ia */ |
cactode | 59:8aa304768360 | 6086 | *pIalpha = Ia; |
cactode | 59:8aa304768360 | 6087 | |
cactode | 59:8aa304768360 | 6088 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ |
cactode | 59:8aa304768360 | 6089 | *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); |
cactode | 59:8aa304768360 | 6090 | } |
cactode | 59:8aa304768360 | 6091 | |
cactode | 59:8aa304768360 | 6092 | |
cactode | 59:8aa304768360 | 6093 | /** |
cactode | 59:8aa304768360 | 6094 | @brief Clarke transform for Q31 version |
cactode | 59:8aa304768360 | 6095 | @param[in] Ia input three-phase coordinate <code>a</code> |
cactode | 59:8aa304768360 | 6096 | @param[in] Ib input three-phase coordinate <code>b</code> |
cactode | 59:8aa304768360 | 6097 | @param[out] pIalpha points to output two-phase orthogonal vector axis alpha |
cactode | 59:8aa304768360 | 6098 | @param[out] pIbeta points to output two-phase orthogonal vector axis beta |
cactode | 59:8aa304768360 | 6099 | @return none |
cactode | 59:8aa304768360 | 6100 | |
cactode | 59:8aa304768360 | 6101 | \par Scaling and Overflow Behavior |
cactode | 59:8aa304768360 | 6102 | The function is implemented using an internal 32-bit accumulator. |
cactode | 59:8aa304768360 | 6103 | The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
cactode | 59:8aa304768360 | 6104 | There is saturation on the addition, hence there is no risk of overflow. |
cactode | 59:8aa304768360 | 6105 | */ |
cactode | 59:8aa304768360 | 6106 | __STATIC_FORCEINLINE void arm_clarke_q31( |
cactode | 59:8aa304768360 | 6107 | q31_t Ia, |
cactode | 59:8aa304768360 | 6108 | q31_t Ib, |
cactode | 59:8aa304768360 | 6109 | q31_t * pIalpha, |
cactode | 59:8aa304768360 | 6110 | q31_t * pIbeta) |
cactode | 59:8aa304768360 | 6111 | { |
cactode | 59:8aa304768360 | 6112 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
cactode | 59:8aa304768360 | 6113 | |
cactode | 59:8aa304768360 | 6114 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */ |
cactode | 59:8aa304768360 | 6115 | *pIalpha = Ia; |
cactode | 59:8aa304768360 | 6116 | |
cactode | 59:8aa304768360 | 6117 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ |
cactode | 59:8aa304768360 | 6118 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); |
cactode | 59:8aa304768360 | 6119 | |
cactode | 59:8aa304768360 | 6120 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ |
cactode | 59:8aa304768360 | 6121 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); |
cactode | 59:8aa304768360 | 6122 | |
cactode | 59:8aa304768360 | 6123 | /* pIbeta is calculated by adding the intermediate products */ |
cactode | 59:8aa304768360 | 6124 | *pIbeta = __QADD(product1, product2); |
cactode | 59:8aa304768360 | 6125 | } |
cactode | 59:8aa304768360 | 6126 | |
cactode | 59:8aa304768360 | 6127 | /** |
cactode | 59:8aa304768360 | 6128 | * @} end of clarke group |
cactode | 59:8aa304768360 | 6129 | */ |
cactode | 59:8aa304768360 | 6130 | |
cactode | 59:8aa304768360 | 6131 | |
cactode | 59:8aa304768360 | 6132 | /** |
cactode | 59:8aa304768360 | 6133 | * @ingroup groupController |
cactode | 59:8aa304768360 | 6134 | */ |
cactode | 59:8aa304768360 | 6135 | |
cactode | 59:8aa304768360 | 6136 | /** |
cactode | 59:8aa304768360 | 6137 | * @defgroup inv_clarke Vector Inverse Clarke Transform |
cactode | 59:8aa304768360 | 6138 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. |
cactode | 59:8aa304768360 | 6139 | * |
cactode | 59:8aa304768360 | 6140 | * The function operates on a single sample of data and each call to the function returns the processed output. |
cactode | 59:8aa304768360 | 6141 | * The library provides separate functions for Q31 and floating-point data types. |
cactode | 59:8aa304768360 | 6142 | * \par Algorithm |
cactode | 59:8aa304768360 | 6143 | * \image html clarkeInvFormula.gif |
cactode | 59:8aa304768360 | 6144 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and |
cactode | 59:8aa304768360 | 6145 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector. |
cactode | 59:8aa304768360 | 6146 | * \par Fixed-Point Behavior |
cactode | 59:8aa304768360 | 6147 | * Care must be taken when using the Q31 version of the Clarke transform. |
cactode | 59:8aa304768360 | 6148 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
cactode | 59:8aa304768360 | 6149 | * Refer to the function specific documentation below for usage guidelines. |
cactode | 59:8aa304768360 | 6150 | */ |
cactode | 59:8aa304768360 | 6151 | |
cactode | 59:8aa304768360 | 6152 | /** |
cactode | 59:8aa304768360 | 6153 | * @addtogroup inv_clarke |
cactode | 59:8aa304768360 | 6154 | * @{ |
cactode | 59:8aa304768360 | 6155 | */ |
cactode | 59:8aa304768360 | 6156 | |
cactode | 59:8aa304768360 | 6157 | /** |
cactode | 59:8aa304768360 | 6158 | * @brief Floating-point Inverse Clarke transform |
cactode | 59:8aa304768360 | 6159 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
cactode | 59:8aa304768360 | 6160 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
cactode | 59:8aa304768360 | 6161 | * @param[out] pIa points to output three-phase coordinate <code>a</code> |
cactode | 59:8aa304768360 | 6162 | * @param[out] pIb points to output three-phase coordinate <code>b</code> |
cactode | 59:8aa304768360 | 6163 | * @return none |
cactode | 59:8aa304768360 | 6164 | */ |
cactode | 59:8aa304768360 | 6165 | __STATIC_FORCEINLINE void arm_inv_clarke_f32( |
cactode | 59:8aa304768360 | 6166 | float32_t Ialpha, |
cactode | 59:8aa304768360 | 6167 | float32_t Ibeta, |
cactode | 59:8aa304768360 | 6168 | float32_t * pIa, |
cactode | 59:8aa304768360 | 6169 | float32_t * pIb) |
cactode | 59:8aa304768360 | 6170 | { |
cactode | 59:8aa304768360 | 6171 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
cactode | 59:8aa304768360 | 6172 | *pIa = Ialpha; |
cactode | 59:8aa304768360 | 6173 | |
cactode | 59:8aa304768360 | 6174 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ |
cactode | 59:8aa304768360 | 6175 | *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta; |
cactode | 59:8aa304768360 | 6176 | } |
cactode | 59:8aa304768360 | 6177 | |
cactode | 59:8aa304768360 | 6178 | |
cactode | 59:8aa304768360 | 6179 | /** |
cactode | 59:8aa304768360 | 6180 | @brief Inverse Clarke transform for Q31 version |
cactode | 59:8aa304768360 | 6181 | @param[in] Ialpha input two-phase orthogonal vector axis alpha |
cactode | 59:8aa304768360 | 6182 | @param[in] Ibeta input two-phase orthogonal vector axis beta |
cactode | 59:8aa304768360 | 6183 | @param[out] pIa points to output three-phase coordinate <code>a</code> |
cactode | 59:8aa304768360 | 6184 | @param[out] pIb points to output three-phase coordinate <code>b</code> |
cactode | 59:8aa304768360 | 6185 | @return none |
cactode | 59:8aa304768360 | 6186 | |
cactode | 59:8aa304768360 | 6187 | \par Scaling and Overflow Behavior |
cactode | 59:8aa304768360 | 6188 | The function is implemented using an internal 32-bit accumulator. |
cactode | 59:8aa304768360 | 6189 | The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
cactode | 59:8aa304768360 | 6190 | There is saturation on the subtraction, hence there is no risk of overflow. |
cactode | 59:8aa304768360 | 6191 | */ |
cactode | 59:8aa304768360 | 6192 | __STATIC_FORCEINLINE void arm_inv_clarke_q31( |
cactode | 59:8aa304768360 | 6193 | q31_t Ialpha, |
cactode | 59:8aa304768360 | 6194 | q31_t Ibeta, |
cactode | 59:8aa304768360 | 6195 | q31_t * pIa, |
cactode | 59:8aa304768360 | 6196 | q31_t * pIb) |
cactode | 59:8aa304768360 | 6197 | { |
cactode | 59:8aa304768360 | 6198 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
cactode | 59:8aa304768360 | 6199 | |
cactode | 59:8aa304768360 | 6200 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
cactode | 59:8aa304768360 | 6201 | *pIa = Ialpha; |
cactode | 59:8aa304768360 | 6202 | |
cactode | 59:8aa304768360 | 6203 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ |
cactode | 59:8aa304768360 | 6204 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); |
cactode | 59:8aa304768360 | 6205 | |
cactode | 59:8aa304768360 | 6206 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ |
cactode | 59:8aa304768360 | 6207 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); |
cactode | 59:8aa304768360 | 6208 | |
cactode | 59:8aa304768360 | 6209 | /* pIb is calculated by subtracting the products */ |
cactode | 59:8aa304768360 | 6210 | *pIb = __QSUB(product2, product1); |
cactode | 59:8aa304768360 | 6211 | } |
cactode | 59:8aa304768360 | 6212 | |
cactode | 59:8aa304768360 | 6213 | /** |
cactode | 59:8aa304768360 | 6214 | * @} end of inv_clarke group |
cactode | 59:8aa304768360 | 6215 | */ |
cactode | 59:8aa304768360 | 6216 | |
cactode | 59:8aa304768360 | 6217 | |
cactode | 59:8aa304768360 | 6218 | |
cactode | 59:8aa304768360 | 6219 | /** |
cactode | 59:8aa304768360 | 6220 | * @ingroup groupController |
cactode | 59:8aa304768360 | 6221 | */ |
cactode | 59:8aa304768360 | 6222 | |
cactode | 59:8aa304768360 | 6223 | /** |
cactode | 59:8aa304768360 | 6224 | * @defgroup park Vector Park Transform |
cactode | 59:8aa304768360 | 6225 | * |
cactode | 59:8aa304768360 | 6226 | * Forward Park transform converts the input two-coordinate vector to flux and torque components. |
cactode | 59:8aa304768360 | 6227 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents |
cactode | 59:8aa304768360 | 6228 | * from the stationary to the moving reference frame and control the spatial relationship between |
cactode | 59:8aa304768360 | 6229 | * the stator vector current and rotor flux vector. |
cactode | 59:8aa304768360 | 6230 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the |
cactode | 59:8aa304768360 | 6231 | * current vector and the relationship from the two reference frames: |
cactode | 59:8aa304768360 | 6232 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" |
cactode | 59:8aa304768360 | 6233 | * |
cactode | 59:8aa304768360 | 6234 | * The function operates on a single sample of data and each call to the function returns the processed output. |
cactode | 59:8aa304768360 | 6235 | * The library provides separate functions for Q31 and floating-point data types. |
cactode | 59:8aa304768360 | 6236 | * \par Algorithm |
cactode | 59:8aa304768360 | 6237 | * \image html parkFormula.gif |
cactode | 59:8aa304768360 | 6238 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components, |
cactode | 59:8aa304768360 | 6239 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
cactode | 59:8aa304768360 | 6240 | * cosine and sine values of theta (rotor flux position). |
cactode | 59:8aa304768360 | 6241 | * \par Fixed-Point Behavior |
cactode | 59:8aa304768360 | 6242 | * Care must be taken when using the Q31 version of the Park transform. |
cactode | 59:8aa304768360 | 6243 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
cactode | 59:8aa304768360 | 6244 | * Refer to the function specific documentation below for usage guidelines. |
cactode | 59:8aa304768360 | 6245 | */ |
cactode | 59:8aa304768360 | 6246 | |
cactode | 59:8aa304768360 | 6247 | /** |
cactode | 59:8aa304768360 | 6248 | * @addtogroup park |
cactode | 59:8aa304768360 | 6249 | * @{ |
cactode | 59:8aa304768360 | 6250 | */ |
cactode | 59:8aa304768360 | 6251 | |
cactode | 59:8aa304768360 | 6252 | /** |
cactode | 59:8aa304768360 | 6253 | * @brief Floating-point Park transform |
cactode | 59:8aa304768360 | 6254 | * @param[in] Ialpha input two-phase vector coordinate alpha |
cactode | 59:8aa304768360 | 6255 | * @param[in] Ibeta input two-phase vector coordinate beta |
cactode | 59:8aa304768360 | 6256 | * @param[out] pId points to output rotor reference frame d |
cactode | 59:8aa304768360 | 6257 | * @param[out] pIq points to output rotor reference frame q |
cactode | 59:8aa304768360 | 6258 | * @param[in] sinVal sine value of rotation angle theta |
cactode | 59:8aa304768360 | 6259 | * @param[in] cosVal cosine value of rotation angle theta |
cactode | 59:8aa304768360 | 6260 | * @return none |
cactode | 59:8aa304768360 | 6261 | * |
cactode | 59:8aa304768360 | 6262 | * The function implements the forward Park transform. |
cactode | 59:8aa304768360 | 6263 | * |
cactode | 59:8aa304768360 | 6264 | */ |
cactode | 59:8aa304768360 | 6265 | __STATIC_FORCEINLINE void arm_park_f32( |
cactode | 59:8aa304768360 | 6266 | float32_t Ialpha, |
cactode | 59:8aa304768360 | 6267 | float32_t Ibeta, |
cactode | 59:8aa304768360 | 6268 | float32_t * pId, |
cactode | 59:8aa304768360 | 6269 | float32_t * pIq, |
cactode | 59:8aa304768360 | 6270 | float32_t sinVal, |
cactode | 59:8aa304768360 | 6271 | float32_t cosVal) |
cactode | 59:8aa304768360 | 6272 | { |
cactode | 59:8aa304768360 | 6273 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ |
cactode | 59:8aa304768360 | 6274 | *pId = Ialpha * cosVal + Ibeta * sinVal; |
cactode | 59:8aa304768360 | 6275 | |
cactode | 59:8aa304768360 | 6276 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ |
cactode | 59:8aa304768360 | 6277 | *pIq = -Ialpha * sinVal + Ibeta * cosVal; |
cactode | 59:8aa304768360 | 6278 | } |
cactode | 59:8aa304768360 | 6279 | |
cactode | 59:8aa304768360 | 6280 | |
cactode | 59:8aa304768360 | 6281 | /** |
cactode | 59:8aa304768360 | 6282 | @brief Park transform for Q31 version |
cactode | 59:8aa304768360 | 6283 | @param[in] Ialpha input two-phase vector coordinate alpha |
cactode | 59:8aa304768360 | 6284 | @param[in] Ibeta input two-phase vector coordinate beta |
cactode | 59:8aa304768360 | 6285 | @param[out] pId points to output rotor reference frame d |
cactode | 59:8aa304768360 | 6286 | @param[out] pIq points to output rotor reference frame q |
cactode | 59:8aa304768360 | 6287 | @param[in] sinVal sine value of rotation angle theta |
cactode | 59:8aa304768360 | 6288 | @param[in] cosVal cosine value of rotation angle theta |
cactode | 59:8aa304768360 | 6289 | @return none |
cactode | 59:8aa304768360 | 6290 | |
cactode | 59:8aa304768360 | 6291 | \par Scaling and Overflow Behavior |
cactode | 59:8aa304768360 | 6292 | The function is implemented using an internal 32-bit accumulator. |
cactode | 59:8aa304768360 | 6293 | The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
cactode | 59:8aa304768360 | 6294 | There is saturation on the addition and subtraction, hence there is no risk of overflow. |
cactode | 59:8aa304768360 | 6295 | */ |
cactode | 59:8aa304768360 | 6296 | __STATIC_FORCEINLINE void arm_park_q31( |
cactode | 59:8aa304768360 | 6297 | q31_t Ialpha, |
cactode | 59:8aa304768360 | 6298 | q31_t Ibeta, |
cactode | 59:8aa304768360 | 6299 | q31_t * pId, |
cactode | 59:8aa304768360 | 6300 | q31_t * pIq, |
cactode | 59:8aa304768360 | 6301 | q31_t sinVal, |
cactode | 59:8aa304768360 | 6302 | q31_t cosVal) |
cactode | 59:8aa304768360 | 6303 | { |
cactode | 59:8aa304768360 | 6304 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
cactode | 59:8aa304768360 | 6305 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
cactode | 59:8aa304768360 | 6306 | |
cactode | 59:8aa304768360 | 6307 | /* Intermediate product is calculated by (Ialpha * cosVal) */ |
cactode | 59:8aa304768360 | 6308 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); |
cactode | 59:8aa304768360 | 6309 | |
cactode | 59:8aa304768360 | 6310 | /* Intermediate product is calculated by (Ibeta * sinVal) */ |
cactode | 59:8aa304768360 | 6311 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); |
cactode | 59:8aa304768360 | 6312 | |
cactode | 59:8aa304768360 | 6313 | |
cactode | 59:8aa304768360 | 6314 | /* Intermediate product is calculated by (Ialpha * sinVal) */ |
cactode | 59:8aa304768360 | 6315 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); |
cactode | 59:8aa304768360 | 6316 | |
cactode | 59:8aa304768360 | 6317 | /* Intermediate product is calculated by (Ibeta * cosVal) */ |
cactode | 59:8aa304768360 | 6318 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); |
cactode | 59:8aa304768360 | 6319 | |
cactode | 59:8aa304768360 | 6320 | /* Calculate pId by adding the two intermediate products 1 and 2 */ |
cactode | 59:8aa304768360 | 6321 | *pId = __QADD(product1, product2); |
cactode | 59:8aa304768360 | 6322 | |
cactode | 59:8aa304768360 | 6323 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ |
cactode | 59:8aa304768360 | 6324 | *pIq = __QSUB(product4, product3); |
cactode | 59:8aa304768360 | 6325 | } |
cactode | 59:8aa304768360 | 6326 | |
cactode | 59:8aa304768360 | 6327 | /** |
cactode | 59:8aa304768360 | 6328 | * @} end of park group |
cactode | 59:8aa304768360 | 6329 | */ |
cactode | 59:8aa304768360 | 6330 | |
cactode | 59:8aa304768360 | 6331 | |
cactode | 59:8aa304768360 | 6332 | /** |
cactode | 59:8aa304768360 | 6333 | * @ingroup groupController |
cactode | 59:8aa304768360 | 6334 | */ |
cactode | 59:8aa304768360 | 6335 | |
cactode | 59:8aa304768360 | 6336 | /** |
cactode | 59:8aa304768360 | 6337 | * @defgroup inv_park Vector Inverse Park transform |
cactode | 59:8aa304768360 | 6338 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector. |
cactode | 59:8aa304768360 | 6339 | * |
cactode | 59:8aa304768360 | 6340 | * The function operates on a single sample of data and each call to the function returns the processed output. |
cactode | 59:8aa304768360 | 6341 | * The library provides separate functions for Q31 and floating-point data types. |
cactode | 59:8aa304768360 | 6342 | * \par Algorithm |
cactode | 59:8aa304768360 | 6343 | * \image html parkInvFormula.gif |
cactode | 59:8aa304768360 | 6344 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components, |
cactode | 59:8aa304768360 | 6345 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
cactode | 59:8aa304768360 | 6346 | * cosine and sine values of theta (rotor flux position). |
cactode | 59:8aa304768360 | 6347 | * \par Fixed-Point Behavior |
cactode | 59:8aa304768360 | 6348 | * Care must be taken when using the Q31 version of the Park transform. |
cactode | 59:8aa304768360 | 6349 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
cactode | 59:8aa304768360 | 6350 | * Refer to the function specific documentation below for usage guidelines. |
cactode | 59:8aa304768360 | 6351 | */ |
cactode | 59:8aa304768360 | 6352 | |
cactode | 59:8aa304768360 | 6353 | /** |
cactode | 59:8aa304768360 | 6354 | * @addtogroup inv_park |
cactode | 59:8aa304768360 | 6355 | * @{ |
cactode | 59:8aa304768360 | 6356 | */ |
cactode | 59:8aa304768360 | 6357 | |
cactode | 59:8aa304768360 | 6358 | /** |
cactode | 59:8aa304768360 | 6359 | * @brief Floating-point Inverse Park transform |
cactode | 59:8aa304768360 | 6360 | * @param[in] Id input coordinate of rotor reference frame d |
cactode | 59:8aa304768360 | 6361 | * @param[in] Iq input coordinate of rotor reference frame q |
cactode | 59:8aa304768360 | 6362 | * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha |
cactode | 59:8aa304768360 | 6363 | * @param[out] pIbeta points to output two-phase orthogonal vector axis beta |
cactode | 59:8aa304768360 | 6364 | * @param[in] sinVal sine value of rotation angle theta |
cactode | 59:8aa304768360 | 6365 | * @param[in] cosVal cosine value of rotation angle theta |
cactode | 59:8aa304768360 | 6366 | * @return none |
cactode | 59:8aa304768360 | 6367 | */ |
cactode | 59:8aa304768360 | 6368 | __STATIC_FORCEINLINE void arm_inv_park_f32( |
cactode | 59:8aa304768360 | 6369 | float32_t Id, |
cactode | 59:8aa304768360 | 6370 | float32_t Iq, |
cactode | 59:8aa304768360 | 6371 | float32_t * pIalpha, |
cactode | 59:8aa304768360 | 6372 | float32_t * pIbeta, |
cactode | 59:8aa304768360 | 6373 | float32_t sinVal, |
cactode | 59:8aa304768360 | 6374 | float32_t cosVal) |
cactode | 59:8aa304768360 | 6375 | { |
cactode | 59:8aa304768360 | 6376 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ |
cactode | 59:8aa304768360 | 6377 | *pIalpha = Id * cosVal - Iq * sinVal; |
cactode | 59:8aa304768360 | 6378 | |
cactode | 59:8aa304768360 | 6379 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ |
cactode | 59:8aa304768360 | 6380 | *pIbeta = Id * sinVal + Iq * cosVal; |
cactode | 59:8aa304768360 | 6381 | } |
cactode | 59:8aa304768360 | 6382 | |
cactode | 59:8aa304768360 | 6383 | |
cactode | 59:8aa304768360 | 6384 | /** |
cactode | 59:8aa304768360 | 6385 | @brief Inverse Park transform for Q31 version |
cactode | 59:8aa304768360 | 6386 | @param[in] Id input coordinate of rotor reference frame d |
cactode | 59:8aa304768360 | 6387 | @param[in] Iq input coordinate of rotor reference frame q |
cactode | 59:8aa304768360 | 6388 | @param[out] pIalpha points to output two-phase orthogonal vector axis alpha |
cactode | 59:8aa304768360 | 6389 | @param[out] pIbeta points to output two-phase orthogonal vector axis beta |
cactode | 59:8aa304768360 | 6390 | @param[in] sinVal sine value of rotation angle theta |
cactode | 59:8aa304768360 | 6391 | @param[in] cosVal cosine value of rotation angle theta |
cactode | 59:8aa304768360 | 6392 | @return none |
cactode | 59:8aa304768360 | 6393 | |
cactode | 59:8aa304768360 | 6394 | @par Scaling and Overflow Behavior |
cactode | 59:8aa304768360 | 6395 | The function is implemented using an internal 32-bit accumulator. |
cactode | 59:8aa304768360 | 6396 | The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
cactode | 59:8aa304768360 | 6397 | There is saturation on the addition, hence there is no risk of overflow. |
cactode | 59:8aa304768360 | 6398 | */ |
cactode | 59:8aa304768360 | 6399 | __STATIC_FORCEINLINE void arm_inv_park_q31( |
cactode | 59:8aa304768360 | 6400 | q31_t Id, |
cactode | 59:8aa304768360 | 6401 | q31_t Iq, |
cactode | 59:8aa304768360 | 6402 | q31_t * pIalpha, |
cactode | 59:8aa304768360 | 6403 | q31_t * pIbeta, |
cactode | 59:8aa304768360 | 6404 | q31_t sinVal, |
cactode | 59:8aa304768360 | 6405 | q31_t cosVal) |
cactode | 59:8aa304768360 | 6406 | { |
cactode | 59:8aa304768360 | 6407 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
cactode | 59:8aa304768360 | 6408 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
cactode | 59:8aa304768360 | 6409 | |
cactode | 59:8aa304768360 | 6410 | /* Intermediate product is calculated by (Id * cosVal) */ |
cactode | 59:8aa304768360 | 6411 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); |
cactode | 59:8aa304768360 | 6412 | |
cactode | 59:8aa304768360 | 6413 | /* Intermediate product is calculated by (Iq * sinVal) */ |
cactode | 59:8aa304768360 | 6414 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); |
cactode | 59:8aa304768360 | 6415 | |
cactode | 59:8aa304768360 | 6416 | |
cactode | 59:8aa304768360 | 6417 | /* Intermediate product is calculated by (Id * sinVal) */ |
cactode | 59:8aa304768360 | 6418 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); |
cactode | 59:8aa304768360 | 6419 | |
cactode | 59:8aa304768360 | 6420 | /* Intermediate product is calculated by (Iq * cosVal) */ |
cactode | 59:8aa304768360 | 6421 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); |
cactode | 59:8aa304768360 | 6422 | |
cactode | 59:8aa304768360 | 6423 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */ |
cactode | 59:8aa304768360 | 6424 | *pIalpha = __QSUB(product1, product2); |
cactode | 59:8aa304768360 | 6425 | |
cactode | 59:8aa304768360 | 6426 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */ |
cactode | 59:8aa304768360 | 6427 | *pIbeta = __QADD(product4, product3); |
cactode | 59:8aa304768360 | 6428 | } |
cactode | 59:8aa304768360 | 6429 | |
cactode | 59:8aa304768360 | 6430 | /** |
cactode | 59:8aa304768360 | 6431 | * @} end of Inverse park group |
cactode | 59:8aa304768360 | 6432 | */ |
cactode | 59:8aa304768360 | 6433 | |
cactode | 59:8aa304768360 | 6434 | |
cactode | 59:8aa304768360 | 6435 | /** |
cactode | 59:8aa304768360 | 6436 | * @ingroup groupInterpolation |
cactode | 59:8aa304768360 | 6437 | */ |
cactode | 59:8aa304768360 | 6438 | |
cactode | 59:8aa304768360 | 6439 | /** |
cactode | 59:8aa304768360 | 6440 | * @defgroup LinearInterpolate Linear Interpolation |
cactode | 59:8aa304768360 | 6441 | * |
cactode | 59:8aa304768360 | 6442 | * Linear interpolation is a method of curve fitting using linear polynomials. |
cactode | 59:8aa304768360 | 6443 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line |
cactode | 59:8aa304768360 | 6444 | * |
cactode | 59:8aa304768360 | 6445 | * \par |
cactode | 59:8aa304768360 | 6446 | * \image html LinearInterp.gif "Linear interpolation" |
cactode | 59:8aa304768360 | 6447 | * |
cactode | 59:8aa304768360 | 6448 | * \par |
cactode | 59:8aa304768360 | 6449 | * A Linear Interpolate function calculates an output value(y), for the input(x) |
cactode | 59:8aa304768360 | 6450 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) |
cactode | 59:8aa304768360 | 6451 | * |
cactode | 59:8aa304768360 | 6452 | * \par Algorithm: |
cactode | 59:8aa304768360 | 6453 | * <pre> |
cactode | 59:8aa304768360 | 6454 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0)) |
cactode | 59:8aa304768360 | 6455 | * where x0, x1 are nearest values of input x |
cactode | 59:8aa304768360 | 6456 | * y0, y1 are nearest values to output y |
cactode | 59:8aa304768360 | 6457 | * </pre> |
cactode | 59:8aa304768360 | 6458 | * |
cactode | 59:8aa304768360 | 6459 | * \par |
cactode | 59:8aa304768360 | 6460 | * This set of functions implements Linear interpolation process |
cactode | 59:8aa304768360 | 6461 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single |
cactode | 59:8aa304768360 | 6462 | * sample of data and each call to the function returns a single processed value. |
cactode | 59:8aa304768360 | 6463 | * <code>S</code> points to an instance of the Linear Interpolate function data structure. |
cactode | 59:8aa304768360 | 6464 | * <code>x</code> is the input sample value. The functions returns the output value. |
cactode | 59:8aa304768360 | 6465 | * |
cactode | 59:8aa304768360 | 6466 | * \par |
cactode | 59:8aa304768360 | 6467 | * if x is outside of the table boundary, Linear interpolation returns first value of the table |
cactode | 59:8aa304768360 | 6468 | * if x is below input range and returns last value of table if x is above range. |
cactode | 59:8aa304768360 | 6469 | */ |
cactode | 59:8aa304768360 | 6470 | |
cactode | 59:8aa304768360 | 6471 | /** |
cactode | 59:8aa304768360 | 6472 | * @addtogroup LinearInterpolate |
cactode | 59:8aa304768360 | 6473 | * @{ |
cactode | 59:8aa304768360 | 6474 | */ |
cactode | 59:8aa304768360 | 6475 | |
cactode | 59:8aa304768360 | 6476 | /** |
cactode | 59:8aa304768360 | 6477 | * @brief Process function for the floating-point Linear Interpolation Function. |
cactode | 59:8aa304768360 | 6478 | * @param[in,out] S is an instance of the floating-point Linear Interpolation structure |
cactode | 59:8aa304768360 | 6479 | * @param[in] x input sample to process |
cactode | 59:8aa304768360 | 6480 | * @return y processed output sample. |
cactode | 59:8aa304768360 | 6481 | * |
cactode | 59:8aa304768360 | 6482 | */ |
cactode | 59:8aa304768360 | 6483 | __STATIC_FORCEINLINE float32_t arm_linear_interp_f32( |
cactode | 59:8aa304768360 | 6484 | arm_linear_interp_instance_f32 * S, |
cactode | 59:8aa304768360 | 6485 | float32_t x) |
cactode | 59:8aa304768360 | 6486 | { |
cactode | 59:8aa304768360 | 6487 | float32_t y; |
cactode | 59:8aa304768360 | 6488 | float32_t x0, x1; /* Nearest input values */ |
cactode | 59:8aa304768360 | 6489 | float32_t y0, y1; /* Nearest output values */ |
cactode | 59:8aa304768360 | 6490 | float32_t xSpacing = S->xSpacing; /* spacing between input values */ |
cactode | 59:8aa304768360 | 6491 | int32_t i; /* Index variable */ |
cactode | 59:8aa304768360 | 6492 | float32_t *pYData = S->pYData; /* pointer to output table */ |
cactode | 59:8aa304768360 | 6493 | |
cactode | 59:8aa304768360 | 6494 | /* Calculation of index */ |
cactode | 59:8aa304768360 | 6495 | i = (int32_t) ((x - S->x1) / xSpacing); |
cactode | 59:8aa304768360 | 6496 | |
cactode | 59:8aa304768360 | 6497 | if (i < 0) |
cactode | 59:8aa304768360 | 6498 | { |
cactode | 59:8aa304768360 | 6499 | /* Iniatilize output for below specified range as least output value of table */ |
cactode | 59:8aa304768360 | 6500 | y = pYData[0]; |
cactode | 59:8aa304768360 | 6501 | } |
cactode | 59:8aa304768360 | 6502 | else if ((uint32_t)i >= (S->nValues - 1)) |
cactode | 59:8aa304768360 | 6503 | { |
cactode | 59:8aa304768360 | 6504 | /* Iniatilize output for above specified range as last output value of table */ |
cactode | 59:8aa304768360 | 6505 | y = pYData[S->nValues - 1]; |
cactode | 59:8aa304768360 | 6506 | } |
cactode | 59:8aa304768360 | 6507 | else |
cactode | 59:8aa304768360 | 6508 | { |
cactode | 59:8aa304768360 | 6509 | /* Calculation of nearest input values */ |
cactode | 59:8aa304768360 | 6510 | x0 = S->x1 + i * xSpacing; |
cactode | 59:8aa304768360 | 6511 | x1 = S->x1 + (i + 1) * xSpacing; |
cactode | 59:8aa304768360 | 6512 | |
cactode | 59:8aa304768360 | 6513 | /* Read of nearest output values */ |
cactode | 59:8aa304768360 | 6514 | y0 = pYData[i]; |
cactode | 59:8aa304768360 | 6515 | y1 = pYData[i + 1]; |
cactode | 59:8aa304768360 | 6516 | |
cactode | 59:8aa304768360 | 6517 | /* Calculation of output */ |
cactode | 59:8aa304768360 | 6518 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); |
cactode | 59:8aa304768360 | 6519 | |
cactode | 59:8aa304768360 | 6520 | } |
cactode | 59:8aa304768360 | 6521 | |
cactode | 59:8aa304768360 | 6522 | /* returns output value */ |
cactode | 59:8aa304768360 | 6523 | return (y); |
cactode | 59:8aa304768360 | 6524 | } |
cactode | 59:8aa304768360 | 6525 | |
cactode | 59:8aa304768360 | 6526 | |
cactode | 59:8aa304768360 | 6527 | /** |
cactode | 59:8aa304768360 | 6528 | * |
cactode | 59:8aa304768360 | 6529 | * @brief Process function for the Q31 Linear Interpolation Function. |
cactode | 59:8aa304768360 | 6530 | * @param[in] pYData pointer to Q31 Linear Interpolation table |
cactode | 59:8aa304768360 | 6531 | * @param[in] x input sample to process |
cactode | 59:8aa304768360 | 6532 | * @param[in] nValues number of table values |
cactode | 59:8aa304768360 | 6533 | * @return y processed output sample. |
cactode | 59:8aa304768360 | 6534 | * |
cactode | 59:8aa304768360 | 6535 | * \par |
cactode | 59:8aa304768360 | 6536 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
cactode | 59:8aa304768360 | 6537 | * This function can support maximum of table size 2^12. |
cactode | 59:8aa304768360 | 6538 | * |
cactode | 59:8aa304768360 | 6539 | */ |
cactode | 59:8aa304768360 | 6540 | __STATIC_FORCEINLINE q31_t arm_linear_interp_q31( |
cactode | 59:8aa304768360 | 6541 | q31_t * pYData, |
cactode | 59:8aa304768360 | 6542 | q31_t x, |
cactode | 59:8aa304768360 | 6543 | uint32_t nValues) |
cactode | 59:8aa304768360 | 6544 | { |
cactode | 59:8aa304768360 | 6545 | q31_t y; /* output */ |
cactode | 59:8aa304768360 | 6546 | q31_t y0, y1; /* Nearest output values */ |
cactode | 59:8aa304768360 | 6547 | q31_t fract; /* fractional part */ |
cactode | 59:8aa304768360 | 6548 | int32_t index; /* Index to read nearest output values */ |
cactode | 59:8aa304768360 | 6549 | |
cactode | 59:8aa304768360 | 6550 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 6551 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 6552 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 6553 | index = ((x & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 6554 | |
cactode | 59:8aa304768360 | 6555 | if (index >= (int32_t)(nValues - 1)) |
cactode | 59:8aa304768360 | 6556 | { |
cactode | 59:8aa304768360 | 6557 | return (pYData[nValues - 1]); |
cactode | 59:8aa304768360 | 6558 | } |
cactode | 59:8aa304768360 | 6559 | else if (index < 0) |
cactode | 59:8aa304768360 | 6560 | { |
cactode | 59:8aa304768360 | 6561 | return (pYData[0]); |
cactode | 59:8aa304768360 | 6562 | } |
cactode | 59:8aa304768360 | 6563 | else |
cactode | 59:8aa304768360 | 6564 | { |
cactode | 59:8aa304768360 | 6565 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 6566 | /* shift left by 11 to keep fract in 1.31 format */ |
cactode | 59:8aa304768360 | 6567 | fract = (x & 0x000FFFFF) << 11; |
cactode | 59:8aa304768360 | 6568 | |
cactode | 59:8aa304768360 | 6569 | /* Read two nearest output values from the index in 1.31(q31) format */ |
cactode | 59:8aa304768360 | 6570 | y0 = pYData[index]; |
cactode | 59:8aa304768360 | 6571 | y1 = pYData[index + 1]; |
cactode | 59:8aa304768360 | 6572 | |
cactode | 59:8aa304768360 | 6573 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */ |
cactode | 59:8aa304768360 | 6574 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); |
cactode | 59:8aa304768360 | 6575 | |
cactode | 59:8aa304768360 | 6576 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ |
cactode | 59:8aa304768360 | 6577 | y += ((q31_t) (((q63_t) y1 * fract) >> 32)); |
cactode | 59:8aa304768360 | 6578 | |
cactode | 59:8aa304768360 | 6579 | /* Convert y to 1.31 format */ |
cactode | 59:8aa304768360 | 6580 | return (y << 1U); |
cactode | 59:8aa304768360 | 6581 | } |
cactode | 59:8aa304768360 | 6582 | } |
cactode | 59:8aa304768360 | 6583 | |
cactode | 59:8aa304768360 | 6584 | |
cactode | 59:8aa304768360 | 6585 | /** |
cactode | 59:8aa304768360 | 6586 | * |
cactode | 59:8aa304768360 | 6587 | * @brief Process function for the Q15 Linear Interpolation Function. |
cactode | 59:8aa304768360 | 6588 | * @param[in] pYData pointer to Q15 Linear Interpolation table |
cactode | 59:8aa304768360 | 6589 | * @param[in] x input sample to process |
cactode | 59:8aa304768360 | 6590 | * @param[in] nValues number of table values |
cactode | 59:8aa304768360 | 6591 | * @return y processed output sample. |
cactode | 59:8aa304768360 | 6592 | * |
cactode | 59:8aa304768360 | 6593 | * \par |
cactode | 59:8aa304768360 | 6594 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
cactode | 59:8aa304768360 | 6595 | * This function can support maximum of table size 2^12. |
cactode | 59:8aa304768360 | 6596 | * |
cactode | 59:8aa304768360 | 6597 | */ |
cactode | 59:8aa304768360 | 6598 | __STATIC_FORCEINLINE q15_t arm_linear_interp_q15( |
cactode | 59:8aa304768360 | 6599 | q15_t * pYData, |
cactode | 59:8aa304768360 | 6600 | q31_t x, |
cactode | 59:8aa304768360 | 6601 | uint32_t nValues) |
cactode | 59:8aa304768360 | 6602 | { |
cactode | 59:8aa304768360 | 6603 | q63_t y; /* output */ |
cactode | 59:8aa304768360 | 6604 | q15_t y0, y1; /* Nearest output values */ |
cactode | 59:8aa304768360 | 6605 | q31_t fract; /* fractional part */ |
cactode | 59:8aa304768360 | 6606 | int32_t index; /* Index to read nearest output values */ |
cactode | 59:8aa304768360 | 6607 | |
cactode | 59:8aa304768360 | 6608 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 6609 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 6610 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 6611 | index = ((x & (int32_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 6612 | |
cactode | 59:8aa304768360 | 6613 | if (index >= (int32_t)(nValues - 1)) |
cactode | 59:8aa304768360 | 6614 | { |
cactode | 59:8aa304768360 | 6615 | return (pYData[nValues - 1]); |
cactode | 59:8aa304768360 | 6616 | } |
cactode | 59:8aa304768360 | 6617 | else if (index < 0) |
cactode | 59:8aa304768360 | 6618 | { |
cactode | 59:8aa304768360 | 6619 | return (pYData[0]); |
cactode | 59:8aa304768360 | 6620 | } |
cactode | 59:8aa304768360 | 6621 | else |
cactode | 59:8aa304768360 | 6622 | { |
cactode | 59:8aa304768360 | 6623 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 6624 | /* fract is in 12.20 format */ |
cactode | 59:8aa304768360 | 6625 | fract = (x & 0x000FFFFF); |
cactode | 59:8aa304768360 | 6626 | |
cactode | 59:8aa304768360 | 6627 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 6628 | y0 = pYData[index]; |
cactode | 59:8aa304768360 | 6629 | y1 = pYData[index + 1]; |
cactode | 59:8aa304768360 | 6630 | |
cactode | 59:8aa304768360 | 6631 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */ |
cactode | 59:8aa304768360 | 6632 | y = ((q63_t) y0 * (0xFFFFF - fract)); |
cactode | 59:8aa304768360 | 6633 | |
cactode | 59:8aa304768360 | 6634 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ |
cactode | 59:8aa304768360 | 6635 | y += ((q63_t) y1 * (fract)); |
cactode | 59:8aa304768360 | 6636 | |
cactode | 59:8aa304768360 | 6637 | /* convert y to 1.15 format */ |
cactode | 59:8aa304768360 | 6638 | return (q15_t) (y >> 20); |
cactode | 59:8aa304768360 | 6639 | } |
cactode | 59:8aa304768360 | 6640 | } |
cactode | 59:8aa304768360 | 6641 | |
cactode | 59:8aa304768360 | 6642 | |
cactode | 59:8aa304768360 | 6643 | /** |
cactode | 59:8aa304768360 | 6644 | * |
cactode | 59:8aa304768360 | 6645 | * @brief Process function for the Q7 Linear Interpolation Function. |
cactode | 59:8aa304768360 | 6646 | * @param[in] pYData pointer to Q7 Linear Interpolation table |
cactode | 59:8aa304768360 | 6647 | * @param[in] x input sample to process |
cactode | 59:8aa304768360 | 6648 | * @param[in] nValues number of table values |
cactode | 59:8aa304768360 | 6649 | * @return y processed output sample. |
cactode | 59:8aa304768360 | 6650 | * |
cactode | 59:8aa304768360 | 6651 | * \par |
cactode | 59:8aa304768360 | 6652 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
cactode | 59:8aa304768360 | 6653 | * This function can support maximum of table size 2^12. |
cactode | 59:8aa304768360 | 6654 | */ |
cactode | 59:8aa304768360 | 6655 | __STATIC_FORCEINLINE q7_t arm_linear_interp_q7( |
cactode | 59:8aa304768360 | 6656 | q7_t * pYData, |
cactode | 59:8aa304768360 | 6657 | q31_t x, |
cactode | 59:8aa304768360 | 6658 | uint32_t nValues) |
cactode | 59:8aa304768360 | 6659 | { |
cactode | 59:8aa304768360 | 6660 | q31_t y; /* output */ |
cactode | 59:8aa304768360 | 6661 | q7_t y0, y1; /* Nearest output values */ |
cactode | 59:8aa304768360 | 6662 | q31_t fract; /* fractional part */ |
cactode | 59:8aa304768360 | 6663 | uint32_t index; /* Index to read nearest output values */ |
cactode | 59:8aa304768360 | 6664 | |
cactode | 59:8aa304768360 | 6665 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 6666 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 6667 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 6668 | if (x < 0) |
cactode | 59:8aa304768360 | 6669 | { |
cactode | 59:8aa304768360 | 6670 | return (pYData[0]); |
cactode | 59:8aa304768360 | 6671 | } |
cactode | 59:8aa304768360 | 6672 | index = (x >> 20) & 0xfff; |
cactode | 59:8aa304768360 | 6673 | |
cactode | 59:8aa304768360 | 6674 | if (index >= (nValues - 1)) |
cactode | 59:8aa304768360 | 6675 | { |
cactode | 59:8aa304768360 | 6676 | return (pYData[nValues - 1]); |
cactode | 59:8aa304768360 | 6677 | } |
cactode | 59:8aa304768360 | 6678 | else |
cactode | 59:8aa304768360 | 6679 | { |
cactode | 59:8aa304768360 | 6680 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 6681 | /* fract is in 12.20 format */ |
cactode | 59:8aa304768360 | 6682 | fract = (x & 0x000FFFFF); |
cactode | 59:8aa304768360 | 6683 | |
cactode | 59:8aa304768360 | 6684 | /* Read two nearest output values from the index and are in 1.7(q7) format */ |
cactode | 59:8aa304768360 | 6685 | y0 = pYData[index]; |
cactode | 59:8aa304768360 | 6686 | y1 = pYData[index + 1]; |
cactode | 59:8aa304768360 | 6687 | |
cactode | 59:8aa304768360 | 6688 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ |
cactode | 59:8aa304768360 | 6689 | y = ((y0 * (0xFFFFF - fract))); |
cactode | 59:8aa304768360 | 6690 | |
cactode | 59:8aa304768360 | 6691 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ |
cactode | 59:8aa304768360 | 6692 | y += (y1 * fract); |
cactode | 59:8aa304768360 | 6693 | |
cactode | 59:8aa304768360 | 6694 | /* convert y to 1.7(q7) format */ |
cactode | 59:8aa304768360 | 6695 | return (q7_t) (y >> 20); |
cactode | 59:8aa304768360 | 6696 | } |
cactode | 59:8aa304768360 | 6697 | } |
cactode | 59:8aa304768360 | 6698 | |
cactode | 59:8aa304768360 | 6699 | /** |
cactode | 59:8aa304768360 | 6700 | * @} end of LinearInterpolate group |
cactode | 59:8aa304768360 | 6701 | */ |
cactode | 59:8aa304768360 | 6702 | |
cactode | 59:8aa304768360 | 6703 | /** |
cactode | 59:8aa304768360 | 6704 | * @brief Fast approximation to the trigonometric sine function for floating-point data. |
cactode | 59:8aa304768360 | 6705 | * @param[in] x input value in radians. |
cactode | 59:8aa304768360 | 6706 | * @return sin(x). |
cactode | 59:8aa304768360 | 6707 | */ |
cactode | 59:8aa304768360 | 6708 | float32_t arm_sin_f32( |
cactode | 59:8aa304768360 | 6709 | float32_t x); |
cactode | 59:8aa304768360 | 6710 | |
cactode | 59:8aa304768360 | 6711 | |
cactode | 59:8aa304768360 | 6712 | /** |
cactode | 59:8aa304768360 | 6713 | * @brief Fast approximation to the trigonometric sine function for Q31 data. |
cactode | 59:8aa304768360 | 6714 | * @param[in] x Scaled input value in radians. |
cactode | 59:8aa304768360 | 6715 | * @return sin(x). |
cactode | 59:8aa304768360 | 6716 | */ |
cactode | 59:8aa304768360 | 6717 | q31_t arm_sin_q31( |
cactode | 59:8aa304768360 | 6718 | q31_t x); |
cactode | 59:8aa304768360 | 6719 | |
cactode | 59:8aa304768360 | 6720 | |
cactode | 59:8aa304768360 | 6721 | /** |
cactode | 59:8aa304768360 | 6722 | * @brief Fast approximation to the trigonometric sine function for Q15 data. |
cactode | 59:8aa304768360 | 6723 | * @param[in] x Scaled input value in radians. |
cactode | 59:8aa304768360 | 6724 | * @return sin(x). |
cactode | 59:8aa304768360 | 6725 | */ |
cactode | 59:8aa304768360 | 6726 | q15_t arm_sin_q15( |
cactode | 59:8aa304768360 | 6727 | q15_t x); |
cactode | 59:8aa304768360 | 6728 | |
cactode | 59:8aa304768360 | 6729 | |
cactode | 59:8aa304768360 | 6730 | /** |
cactode | 59:8aa304768360 | 6731 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. |
cactode | 59:8aa304768360 | 6732 | * @param[in] x input value in radians. |
cactode | 59:8aa304768360 | 6733 | * @return cos(x). |
cactode | 59:8aa304768360 | 6734 | */ |
cactode | 59:8aa304768360 | 6735 | float32_t arm_cos_f32( |
cactode | 59:8aa304768360 | 6736 | float32_t x); |
cactode | 59:8aa304768360 | 6737 | |
cactode | 59:8aa304768360 | 6738 | |
cactode | 59:8aa304768360 | 6739 | /** |
cactode | 59:8aa304768360 | 6740 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. |
cactode | 59:8aa304768360 | 6741 | * @param[in] x Scaled input value in radians. |
cactode | 59:8aa304768360 | 6742 | * @return cos(x). |
cactode | 59:8aa304768360 | 6743 | */ |
cactode | 59:8aa304768360 | 6744 | q31_t arm_cos_q31( |
cactode | 59:8aa304768360 | 6745 | q31_t x); |
cactode | 59:8aa304768360 | 6746 | |
cactode | 59:8aa304768360 | 6747 | |
cactode | 59:8aa304768360 | 6748 | /** |
cactode | 59:8aa304768360 | 6749 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. |
cactode | 59:8aa304768360 | 6750 | * @param[in] x Scaled input value in radians. |
cactode | 59:8aa304768360 | 6751 | * @return cos(x). |
cactode | 59:8aa304768360 | 6752 | */ |
cactode | 59:8aa304768360 | 6753 | q15_t arm_cos_q15( |
cactode | 59:8aa304768360 | 6754 | q15_t x); |
cactode | 59:8aa304768360 | 6755 | |
cactode | 59:8aa304768360 | 6756 | |
cactode | 59:8aa304768360 | 6757 | /** |
cactode | 59:8aa304768360 | 6758 | @brief Floating-point vector of log values. |
cactode | 59:8aa304768360 | 6759 | @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 6760 | @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 6761 | @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 6762 | @return none |
cactode | 59:8aa304768360 | 6763 | */ |
cactode | 59:8aa304768360 | 6764 | void arm_vlog_f32( |
cactode | 59:8aa304768360 | 6765 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 6766 | float32_t * pDst, |
cactode | 59:8aa304768360 | 6767 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 6768 | |
cactode | 59:8aa304768360 | 6769 | /** |
cactode | 59:8aa304768360 | 6770 | @brief Floating-point vector of exp values. |
cactode | 59:8aa304768360 | 6771 | @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 6772 | @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 6773 | @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 6774 | @return none |
cactode | 59:8aa304768360 | 6775 | */ |
cactode | 59:8aa304768360 | 6776 | void arm_vexp_f32( |
cactode | 59:8aa304768360 | 6777 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 6778 | float32_t * pDst, |
cactode | 59:8aa304768360 | 6779 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 6780 | |
cactode | 59:8aa304768360 | 6781 | /** |
cactode | 59:8aa304768360 | 6782 | * @ingroup groupFastMath |
cactode | 59:8aa304768360 | 6783 | */ |
cactode | 59:8aa304768360 | 6784 | |
cactode | 59:8aa304768360 | 6785 | |
cactode | 59:8aa304768360 | 6786 | /** |
cactode | 59:8aa304768360 | 6787 | * @defgroup SQRT Square Root |
cactode | 59:8aa304768360 | 6788 | * |
cactode | 59:8aa304768360 | 6789 | * Computes the square root of a number. |
cactode | 59:8aa304768360 | 6790 | * There are separate functions for Q15, Q31, and floating-point data types. |
cactode | 59:8aa304768360 | 6791 | * The square root function is computed using the Newton-Raphson algorithm. |
cactode | 59:8aa304768360 | 6792 | * This is an iterative algorithm of the form: |
cactode | 59:8aa304768360 | 6793 | * <pre> |
cactode | 59:8aa304768360 | 6794 | * x1 = x0 - f(x0)/f'(x0) |
cactode | 59:8aa304768360 | 6795 | * </pre> |
cactode | 59:8aa304768360 | 6796 | * where <code>x1</code> is the current estimate, |
cactode | 59:8aa304768360 | 6797 | * <code>x0</code> is the previous estimate, and |
cactode | 59:8aa304768360 | 6798 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>. |
cactode | 59:8aa304768360 | 6799 | * For the square root function, the algorithm reduces to: |
cactode | 59:8aa304768360 | 6800 | * <pre> |
cactode | 59:8aa304768360 | 6801 | * x0 = in/2 [initial guess] |
cactode | 59:8aa304768360 | 6802 | * x1 = 1/2 * ( x0 + in / x0) [each iteration] |
cactode | 59:8aa304768360 | 6803 | * </pre> |
cactode | 59:8aa304768360 | 6804 | */ |
cactode | 59:8aa304768360 | 6805 | |
cactode | 59:8aa304768360 | 6806 | |
cactode | 59:8aa304768360 | 6807 | /** |
cactode | 59:8aa304768360 | 6808 | * @addtogroup SQRT |
cactode | 59:8aa304768360 | 6809 | * @{ |
cactode | 59:8aa304768360 | 6810 | */ |
cactode | 59:8aa304768360 | 6811 | |
cactode | 59:8aa304768360 | 6812 | /** |
cactode | 59:8aa304768360 | 6813 | @brief Floating-point square root function. |
cactode | 59:8aa304768360 | 6814 | @param[in] in input value |
cactode | 59:8aa304768360 | 6815 | @param[out] pOut square root of input value |
cactode | 59:8aa304768360 | 6816 | @return execution status |
cactode | 59:8aa304768360 | 6817 | - \ref ARM_MATH_SUCCESS : input value is positive |
cactode | 59:8aa304768360 | 6818 | - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 |
cactode | 59:8aa304768360 | 6819 | */ |
cactode | 59:8aa304768360 | 6820 | __STATIC_FORCEINLINE arm_status arm_sqrt_f32( |
cactode | 59:8aa304768360 | 6821 | float32_t in, |
cactode | 59:8aa304768360 | 6822 | float32_t * pOut) |
cactode | 59:8aa304768360 | 6823 | { |
cactode | 59:8aa304768360 | 6824 | if (in >= 0.0f) |
cactode | 59:8aa304768360 | 6825 | { |
cactode | 59:8aa304768360 | 6826 | #if defined ( __CC_ARM ) |
cactode | 59:8aa304768360 | 6827 | #if defined __TARGET_FPU_VFP |
cactode | 59:8aa304768360 | 6828 | *pOut = __sqrtf(in); |
cactode | 59:8aa304768360 | 6829 | #else |
cactode | 59:8aa304768360 | 6830 | *pOut = sqrtf(in); |
cactode | 59:8aa304768360 | 6831 | #endif |
cactode | 59:8aa304768360 | 6832 | |
cactode | 59:8aa304768360 | 6833 | #elif defined ( __ICCARM__ ) |
cactode | 59:8aa304768360 | 6834 | #if defined __ARMVFP__ |
cactode | 59:8aa304768360 | 6835 | __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in)); |
cactode | 59:8aa304768360 | 6836 | #else |
cactode | 59:8aa304768360 | 6837 | *pOut = sqrtf(in); |
cactode | 59:8aa304768360 | 6838 | #endif |
cactode | 59:8aa304768360 | 6839 | |
cactode | 59:8aa304768360 | 6840 | #else |
cactode | 59:8aa304768360 | 6841 | *pOut = sqrtf(in); |
cactode | 59:8aa304768360 | 6842 | #endif |
cactode | 59:8aa304768360 | 6843 | |
cactode | 59:8aa304768360 | 6844 | return (ARM_MATH_SUCCESS); |
cactode | 59:8aa304768360 | 6845 | } |
cactode | 59:8aa304768360 | 6846 | else |
cactode | 59:8aa304768360 | 6847 | { |
cactode | 59:8aa304768360 | 6848 | *pOut = 0.0f; |
cactode | 59:8aa304768360 | 6849 | return (ARM_MATH_ARGUMENT_ERROR); |
cactode | 59:8aa304768360 | 6850 | } |
cactode | 59:8aa304768360 | 6851 | } |
cactode | 59:8aa304768360 | 6852 | |
cactode | 59:8aa304768360 | 6853 | |
cactode | 59:8aa304768360 | 6854 | /** |
cactode | 59:8aa304768360 | 6855 | @brief Q31 square root function. |
cactode | 59:8aa304768360 | 6856 | @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF |
cactode | 59:8aa304768360 | 6857 | @param[out] pOut points to square root of input value |
cactode | 59:8aa304768360 | 6858 | @return execution status |
cactode | 59:8aa304768360 | 6859 | - \ref ARM_MATH_SUCCESS : input value is positive |
cactode | 59:8aa304768360 | 6860 | - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 |
cactode | 59:8aa304768360 | 6861 | */ |
cactode | 59:8aa304768360 | 6862 | arm_status arm_sqrt_q31( |
cactode | 59:8aa304768360 | 6863 | q31_t in, |
cactode | 59:8aa304768360 | 6864 | q31_t * pOut); |
cactode | 59:8aa304768360 | 6865 | |
cactode | 59:8aa304768360 | 6866 | |
cactode | 59:8aa304768360 | 6867 | /** |
cactode | 59:8aa304768360 | 6868 | @brief Q15 square root function. |
cactode | 59:8aa304768360 | 6869 | @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF |
cactode | 59:8aa304768360 | 6870 | @param[out] pOut points to square root of input value |
cactode | 59:8aa304768360 | 6871 | @return execution status |
cactode | 59:8aa304768360 | 6872 | - \ref ARM_MATH_SUCCESS : input value is positive |
cactode | 59:8aa304768360 | 6873 | - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 |
cactode | 59:8aa304768360 | 6874 | */ |
cactode | 59:8aa304768360 | 6875 | arm_status arm_sqrt_q15( |
cactode | 59:8aa304768360 | 6876 | q15_t in, |
cactode | 59:8aa304768360 | 6877 | q15_t * pOut); |
cactode | 59:8aa304768360 | 6878 | |
cactode | 59:8aa304768360 | 6879 | /** |
cactode | 59:8aa304768360 | 6880 | * @brief Vector Floating-point square root function. |
cactode | 59:8aa304768360 | 6881 | * @param[in] pIn input vector. |
cactode | 59:8aa304768360 | 6882 | * @param[out] pOut vector of square roots of input elements. |
cactode | 59:8aa304768360 | 6883 | * @param[in] len length of input vector. |
cactode | 59:8aa304768360 | 6884 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
cactode | 59:8aa304768360 | 6885 | * <code>in</code> is negative value and returns zero output for negative values. |
cactode | 59:8aa304768360 | 6886 | */ |
cactode | 59:8aa304768360 | 6887 | void arm_vsqrt_f32( |
cactode | 59:8aa304768360 | 6888 | float32_t * pIn, |
cactode | 59:8aa304768360 | 6889 | float32_t * pOut, |
cactode | 59:8aa304768360 | 6890 | uint16_t len); |
cactode | 59:8aa304768360 | 6891 | |
cactode | 59:8aa304768360 | 6892 | void arm_vsqrt_q31( |
cactode | 59:8aa304768360 | 6893 | q31_t * pIn, |
cactode | 59:8aa304768360 | 6894 | q31_t * pOut, |
cactode | 59:8aa304768360 | 6895 | uint16_t len); |
cactode | 59:8aa304768360 | 6896 | |
cactode | 59:8aa304768360 | 6897 | void arm_vsqrt_q15( |
cactode | 59:8aa304768360 | 6898 | q15_t * pIn, |
cactode | 59:8aa304768360 | 6899 | q15_t * pOut, |
cactode | 59:8aa304768360 | 6900 | uint16_t len); |
cactode | 59:8aa304768360 | 6901 | |
cactode | 59:8aa304768360 | 6902 | /** |
cactode | 59:8aa304768360 | 6903 | * @} end of SQRT group |
cactode | 59:8aa304768360 | 6904 | */ |
cactode | 59:8aa304768360 | 6905 | |
cactode | 59:8aa304768360 | 6906 | |
cactode | 59:8aa304768360 | 6907 | /** |
cactode | 59:8aa304768360 | 6908 | * @brief floating-point Circular write function. |
cactode | 59:8aa304768360 | 6909 | */ |
cactode | 59:8aa304768360 | 6910 | __STATIC_FORCEINLINE void arm_circularWrite_f32( |
cactode | 59:8aa304768360 | 6911 | int32_t * circBuffer, |
cactode | 59:8aa304768360 | 6912 | int32_t L, |
cactode | 59:8aa304768360 | 6913 | uint16_t * writeOffset, |
cactode | 59:8aa304768360 | 6914 | int32_t bufferInc, |
cactode | 59:8aa304768360 | 6915 | const int32_t * src, |
cactode | 59:8aa304768360 | 6916 | int32_t srcInc, |
cactode | 59:8aa304768360 | 6917 | uint32_t blockSize) |
cactode | 59:8aa304768360 | 6918 | { |
cactode | 59:8aa304768360 | 6919 | uint32_t i = 0U; |
cactode | 59:8aa304768360 | 6920 | int32_t wOffset; |
cactode | 59:8aa304768360 | 6921 | |
cactode | 59:8aa304768360 | 6922 | /* Copy the value of Index pointer that points |
cactode | 59:8aa304768360 | 6923 | * to the current location where the input samples to be copied */ |
cactode | 59:8aa304768360 | 6924 | wOffset = *writeOffset; |
cactode | 59:8aa304768360 | 6925 | |
cactode | 59:8aa304768360 | 6926 | /* Loop over the blockSize */ |
cactode | 59:8aa304768360 | 6927 | i = blockSize; |
cactode | 59:8aa304768360 | 6928 | |
cactode | 59:8aa304768360 | 6929 | while (i > 0U) |
cactode | 59:8aa304768360 | 6930 | { |
cactode | 59:8aa304768360 | 6931 | /* copy the input sample to the circular buffer */ |
cactode | 59:8aa304768360 | 6932 | circBuffer[wOffset] = *src; |
cactode | 59:8aa304768360 | 6933 | |
cactode | 59:8aa304768360 | 6934 | /* Update the input pointer */ |
cactode | 59:8aa304768360 | 6935 | src += srcInc; |
cactode | 59:8aa304768360 | 6936 | |
cactode | 59:8aa304768360 | 6937 | /* Circularly update wOffset. Watch out for positive and negative value */ |
cactode | 59:8aa304768360 | 6938 | wOffset += bufferInc; |
cactode | 59:8aa304768360 | 6939 | if (wOffset >= L) |
cactode | 59:8aa304768360 | 6940 | wOffset -= L; |
cactode | 59:8aa304768360 | 6941 | |
cactode | 59:8aa304768360 | 6942 | /* Decrement the loop counter */ |
cactode | 59:8aa304768360 | 6943 | i--; |
cactode | 59:8aa304768360 | 6944 | } |
cactode | 59:8aa304768360 | 6945 | |
cactode | 59:8aa304768360 | 6946 | /* Update the index pointer */ |
cactode | 59:8aa304768360 | 6947 | *writeOffset = (uint16_t)wOffset; |
cactode | 59:8aa304768360 | 6948 | } |
cactode | 59:8aa304768360 | 6949 | |
cactode | 59:8aa304768360 | 6950 | |
cactode | 59:8aa304768360 | 6951 | |
cactode | 59:8aa304768360 | 6952 | /** |
cactode | 59:8aa304768360 | 6953 | * @brief floating-point Circular Read function. |
cactode | 59:8aa304768360 | 6954 | */ |
cactode | 59:8aa304768360 | 6955 | __STATIC_FORCEINLINE void arm_circularRead_f32( |
cactode | 59:8aa304768360 | 6956 | int32_t * circBuffer, |
cactode | 59:8aa304768360 | 6957 | int32_t L, |
cactode | 59:8aa304768360 | 6958 | int32_t * readOffset, |
cactode | 59:8aa304768360 | 6959 | int32_t bufferInc, |
cactode | 59:8aa304768360 | 6960 | int32_t * dst, |
cactode | 59:8aa304768360 | 6961 | int32_t * dst_base, |
cactode | 59:8aa304768360 | 6962 | int32_t dst_length, |
cactode | 59:8aa304768360 | 6963 | int32_t dstInc, |
cactode | 59:8aa304768360 | 6964 | uint32_t blockSize) |
cactode | 59:8aa304768360 | 6965 | { |
cactode | 59:8aa304768360 | 6966 | uint32_t i = 0U; |
cactode | 59:8aa304768360 | 6967 | int32_t rOffset; |
cactode | 59:8aa304768360 | 6968 | int32_t* dst_end; |
cactode | 59:8aa304768360 | 6969 | |
cactode | 59:8aa304768360 | 6970 | /* Copy the value of Index pointer that points |
cactode | 59:8aa304768360 | 6971 | * to the current location from where the input samples to be read */ |
cactode | 59:8aa304768360 | 6972 | rOffset = *readOffset; |
cactode | 59:8aa304768360 | 6973 | dst_end = dst_base + dst_length; |
cactode | 59:8aa304768360 | 6974 | |
cactode | 59:8aa304768360 | 6975 | /* Loop over the blockSize */ |
cactode | 59:8aa304768360 | 6976 | i = blockSize; |
cactode | 59:8aa304768360 | 6977 | |
cactode | 59:8aa304768360 | 6978 | while (i > 0U) |
cactode | 59:8aa304768360 | 6979 | { |
cactode | 59:8aa304768360 | 6980 | /* copy the sample from the circular buffer to the destination buffer */ |
cactode | 59:8aa304768360 | 6981 | *dst = circBuffer[rOffset]; |
cactode | 59:8aa304768360 | 6982 | |
cactode | 59:8aa304768360 | 6983 | /* Update the input pointer */ |
cactode | 59:8aa304768360 | 6984 | dst += dstInc; |
cactode | 59:8aa304768360 | 6985 | |
cactode | 59:8aa304768360 | 6986 | if (dst == dst_end) |
cactode | 59:8aa304768360 | 6987 | { |
cactode | 59:8aa304768360 | 6988 | dst = dst_base; |
cactode | 59:8aa304768360 | 6989 | } |
cactode | 59:8aa304768360 | 6990 | |
cactode | 59:8aa304768360 | 6991 | /* Circularly update rOffset. Watch out for positive and negative value */ |
cactode | 59:8aa304768360 | 6992 | rOffset += bufferInc; |
cactode | 59:8aa304768360 | 6993 | |
cactode | 59:8aa304768360 | 6994 | if (rOffset >= L) |
cactode | 59:8aa304768360 | 6995 | { |
cactode | 59:8aa304768360 | 6996 | rOffset -= L; |
cactode | 59:8aa304768360 | 6997 | } |
cactode | 59:8aa304768360 | 6998 | |
cactode | 59:8aa304768360 | 6999 | /* Decrement the loop counter */ |
cactode | 59:8aa304768360 | 7000 | i--; |
cactode | 59:8aa304768360 | 7001 | } |
cactode | 59:8aa304768360 | 7002 | |
cactode | 59:8aa304768360 | 7003 | /* Update the index pointer */ |
cactode | 59:8aa304768360 | 7004 | *readOffset = rOffset; |
cactode | 59:8aa304768360 | 7005 | } |
cactode | 59:8aa304768360 | 7006 | |
cactode | 59:8aa304768360 | 7007 | |
cactode | 59:8aa304768360 | 7008 | /** |
cactode | 59:8aa304768360 | 7009 | * @brief Q15 Circular write function. |
cactode | 59:8aa304768360 | 7010 | */ |
cactode | 59:8aa304768360 | 7011 | __STATIC_FORCEINLINE void arm_circularWrite_q15( |
cactode | 59:8aa304768360 | 7012 | q15_t * circBuffer, |
cactode | 59:8aa304768360 | 7013 | int32_t L, |
cactode | 59:8aa304768360 | 7014 | uint16_t * writeOffset, |
cactode | 59:8aa304768360 | 7015 | int32_t bufferInc, |
cactode | 59:8aa304768360 | 7016 | const q15_t * src, |
cactode | 59:8aa304768360 | 7017 | int32_t srcInc, |
cactode | 59:8aa304768360 | 7018 | uint32_t blockSize) |
cactode | 59:8aa304768360 | 7019 | { |
cactode | 59:8aa304768360 | 7020 | uint32_t i = 0U; |
cactode | 59:8aa304768360 | 7021 | int32_t wOffset; |
cactode | 59:8aa304768360 | 7022 | |
cactode | 59:8aa304768360 | 7023 | /* Copy the value of Index pointer that points |
cactode | 59:8aa304768360 | 7024 | * to the current location where the input samples to be copied */ |
cactode | 59:8aa304768360 | 7025 | wOffset = *writeOffset; |
cactode | 59:8aa304768360 | 7026 | |
cactode | 59:8aa304768360 | 7027 | /* Loop over the blockSize */ |
cactode | 59:8aa304768360 | 7028 | i = blockSize; |
cactode | 59:8aa304768360 | 7029 | |
cactode | 59:8aa304768360 | 7030 | while (i > 0U) |
cactode | 59:8aa304768360 | 7031 | { |
cactode | 59:8aa304768360 | 7032 | /* copy the input sample to the circular buffer */ |
cactode | 59:8aa304768360 | 7033 | circBuffer[wOffset] = *src; |
cactode | 59:8aa304768360 | 7034 | |
cactode | 59:8aa304768360 | 7035 | /* Update the input pointer */ |
cactode | 59:8aa304768360 | 7036 | src += srcInc; |
cactode | 59:8aa304768360 | 7037 | |
cactode | 59:8aa304768360 | 7038 | /* Circularly update wOffset. Watch out for positive and negative value */ |
cactode | 59:8aa304768360 | 7039 | wOffset += bufferInc; |
cactode | 59:8aa304768360 | 7040 | if (wOffset >= L) |
cactode | 59:8aa304768360 | 7041 | wOffset -= L; |
cactode | 59:8aa304768360 | 7042 | |
cactode | 59:8aa304768360 | 7043 | /* Decrement the loop counter */ |
cactode | 59:8aa304768360 | 7044 | i--; |
cactode | 59:8aa304768360 | 7045 | } |
cactode | 59:8aa304768360 | 7046 | |
cactode | 59:8aa304768360 | 7047 | /* Update the index pointer */ |
cactode | 59:8aa304768360 | 7048 | *writeOffset = (uint16_t)wOffset; |
cactode | 59:8aa304768360 | 7049 | } |
cactode | 59:8aa304768360 | 7050 | |
cactode | 59:8aa304768360 | 7051 | |
cactode | 59:8aa304768360 | 7052 | /** |
cactode | 59:8aa304768360 | 7053 | * @brief Q15 Circular Read function. |
cactode | 59:8aa304768360 | 7054 | */ |
cactode | 59:8aa304768360 | 7055 | __STATIC_FORCEINLINE void arm_circularRead_q15( |
cactode | 59:8aa304768360 | 7056 | q15_t * circBuffer, |
cactode | 59:8aa304768360 | 7057 | int32_t L, |
cactode | 59:8aa304768360 | 7058 | int32_t * readOffset, |
cactode | 59:8aa304768360 | 7059 | int32_t bufferInc, |
cactode | 59:8aa304768360 | 7060 | q15_t * dst, |
cactode | 59:8aa304768360 | 7061 | q15_t * dst_base, |
cactode | 59:8aa304768360 | 7062 | int32_t dst_length, |
cactode | 59:8aa304768360 | 7063 | int32_t dstInc, |
cactode | 59:8aa304768360 | 7064 | uint32_t blockSize) |
cactode | 59:8aa304768360 | 7065 | { |
cactode | 59:8aa304768360 | 7066 | uint32_t i = 0; |
cactode | 59:8aa304768360 | 7067 | int32_t rOffset; |
cactode | 59:8aa304768360 | 7068 | q15_t* dst_end; |
cactode | 59:8aa304768360 | 7069 | |
cactode | 59:8aa304768360 | 7070 | /* Copy the value of Index pointer that points |
cactode | 59:8aa304768360 | 7071 | * to the current location from where the input samples to be read */ |
cactode | 59:8aa304768360 | 7072 | rOffset = *readOffset; |
cactode | 59:8aa304768360 | 7073 | |
cactode | 59:8aa304768360 | 7074 | dst_end = dst_base + dst_length; |
cactode | 59:8aa304768360 | 7075 | |
cactode | 59:8aa304768360 | 7076 | /* Loop over the blockSize */ |
cactode | 59:8aa304768360 | 7077 | i = blockSize; |
cactode | 59:8aa304768360 | 7078 | |
cactode | 59:8aa304768360 | 7079 | while (i > 0U) |
cactode | 59:8aa304768360 | 7080 | { |
cactode | 59:8aa304768360 | 7081 | /* copy the sample from the circular buffer to the destination buffer */ |
cactode | 59:8aa304768360 | 7082 | *dst = circBuffer[rOffset]; |
cactode | 59:8aa304768360 | 7083 | |
cactode | 59:8aa304768360 | 7084 | /* Update the input pointer */ |
cactode | 59:8aa304768360 | 7085 | dst += dstInc; |
cactode | 59:8aa304768360 | 7086 | |
cactode | 59:8aa304768360 | 7087 | if (dst == dst_end) |
cactode | 59:8aa304768360 | 7088 | { |
cactode | 59:8aa304768360 | 7089 | dst = dst_base; |
cactode | 59:8aa304768360 | 7090 | } |
cactode | 59:8aa304768360 | 7091 | |
cactode | 59:8aa304768360 | 7092 | /* Circularly update wOffset. Watch out for positive and negative value */ |
cactode | 59:8aa304768360 | 7093 | rOffset += bufferInc; |
cactode | 59:8aa304768360 | 7094 | |
cactode | 59:8aa304768360 | 7095 | if (rOffset >= L) |
cactode | 59:8aa304768360 | 7096 | { |
cactode | 59:8aa304768360 | 7097 | rOffset -= L; |
cactode | 59:8aa304768360 | 7098 | } |
cactode | 59:8aa304768360 | 7099 | |
cactode | 59:8aa304768360 | 7100 | /* Decrement the loop counter */ |
cactode | 59:8aa304768360 | 7101 | i--; |
cactode | 59:8aa304768360 | 7102 | } |
cactode | 59:8aa304768360 | 7103 | |
cactode | 59:8aa304768360 | 7104 | /* Update the index pointer */ |
cactode | 59:8aa304768360 | 7105 | *readOffset = rOffset; |
cactode | 59:8aa304768360 | 7106 | } |
cactode | 59:8aa304768360 | 7107 | |
cactode | 59:8aa304768360 | 7108 | |
cactode | 59:8aa304768360 | 7109 | /** |
cactode | 59:8aa304768360 | 7110 | * @brief Q7 Circular write function. |
cactode | 59:8aa304768360 | 7111 | */ |
cactode | 59:8aa304768360 | 7112 | __STATIC_FORCEINLINE void arm_circularWrite_q7( |
cactode | 59:8aa304768360 | 7113 | q7_t * circBuffer, |
cactode | 59:8aa304768360 | 7114 | int32_t L, |
cactode | 59:8aa304768360 | 7115 | uint16_t * writeOffset, |
cactode | 59:8aa304768360 | 7116 | int32_t bufferInc, |
cactode | 59:8aa304768360 | 7117 | const q7_t * src, |
cactode | 59:8aa304768360 | 7118 | int32_t srcInc, |
cactode | 59:8aa304768360 | 7119 | uint32_t blockSize) |
cactode | 59:8aa304768360 | 7120 | { |
cactode | 59:8aa304768360 | 7121 | uint32_t i = 0U; |
cactode | 59:8aa304768360 | 7122 | int32_t wOffset; |
cactode | 59:8aa304768360 | 7123 | |
cactode | 59:8aa304768360 | 7124 | /* Copy the value of Index pointer that points |
cactode | 59:8aa304768360 | 7125 | * to the current location where the input samples to be copied */ |
cactode | 59:8aa304768360 | 7126 | wOffset = *writeOffset; |
cactode | 59:8aa304768360 | 7127 | |
cactode | 59:8aa304768360 | 7128 | /* Loop over the blockSize */ |
cactode | 59:8aa304768360 | 7129 | i = blockSize; |
cactode | 59:8aa304768360 | 7130 | |
cactode | 59:8aa304768360 | 7131 | while (i > 0U) |
cactode | 59:8aa304768360 | 7132 | { |
cactode | 59:8aa304768360 | 7133 | /* copy the input sample to the circular buffer */ |
cactode | 59:8aa304768360 | 7134 | circBuffer[wOffset] = *src; |
cactode | 59:8aa304768360 | 7135 | |
cactode | 59:8aa304768360 | 7136 | /* Update the input pointer */ |
cactode | 59:8aa304768360 | 7137 | src += srcInc; |
cactode | 59:8aa304768360 | 7138 | |
cactode | 59:8aa304768360 | 7139 | /* Circularly update wOffset. Watch out for positive and negative value */ |
cactode | 59:8aa304768360 | 7140 | wOffset += bufferInc; |
cactode | 59:8aa304768360 | 7141 | if (wOffset >= L) |
cactode | 59:8aa304768360 | 7142 | wOffset -= L; |
cactode | 59:8aa304768360 | 7143 | |
cactode | 59:8aa304768360 | 7144 | /* Decrement the loop counter */ |
cactode | 59:8aa304768360 | 7145 | i--; |
cactode | 59:8aa304768360 | 7146 | } |
cactode | 59:8aa304768360 | 7147 | |
cactode | 59:8aa304768360 | 7148 | /* Update the index pointer */ |
cactode | 59:8aa304768360 | 7149 | *writeOffset = (uint16_t)wOffset; |
cactode | 59:8aa304768360 | 7150 | } |
cactode | 59:8aa304768360 | 7151 | |
cactode | 59:8aa304768360 | 7152 | |
cactode | 59:8aa304768360 | 7153 | /** |
cactode | 59:8aa304768360 | 7154 | * @brief Q7 Circular Read function. |
cactode | 59:8aa304768360 | 7155 | */ |
cactode | 59:8aa304768360 | 7156 | __STATIC_FORCEINLINE void arm_circularRead_q7( |
cactode | 59:8aa304768360 | 7157 | q7_t * circBuffer, |
cactode | 59:8aa304768360 | 7158 | int32_t L, |
cactode | 59:8aa304768360 | 7159 | int32_t * readOffset, |
cactode | 59:8aa304768360 | 7160 | int32_t bufferInc, |
cactode | 59:8aa304768360 | 7161 | q7_t * dst, |
cactode | 59:8aa304768360 | 7162 | q7_t * dst_base, |
cactode | 59:8aa304768360 | 7163 | int32_t dst_length, |
cactode | 59:8aa304768360 | 7164 | int32_t dstInc, |
cactode | 59:8aa304768360 | 7165 | uint32_t blockSize) |
cactode | 59:8aa304768360 | 7166 | { |
cactode | 59:8aa304768360 | 7167 | uint32_t i = 0; |
cactode | 59:8aa304768360 | 7168 | int32_t rOffset; |
cactode | 59:8aa304768360 | 7169 | q7_t* dst_end; |
cactode | 59:8aa304768360 | 7170 | |
cactode | 59:8aa304768360 | 7171 | /* Copy the value of Index pointer that points |
cactode | 59:8aa304768360 | 7172 | * to the current location from where the input samples to be read */ |
cactode | 59:8aa304768360 | 7173 | rOffset = *readOffset; |
cactode | 59:8aa304768360 | 7174 | |
cactode | 59:8aa304768360 | 7175 | dst_end = dst_base + dst_length; |
cactode | 59:8aa304768360 | 7176 | |
cactode | 59:8aa304768360 | 7177 | /* Loop over the blockSize */ |
cactode | 59:8aa304768360 | 7178 | i = blockSize; |
cactode | 59:8aa304768360 | 7179 | |
cactode | 59:8aa304768360 | 7180 | while (i > 0U) |
cactode | 59:8aa304768360 | 7181 | { |
cactode | 59:8aa304768360 | 7182 | /* copy the sample from the circular buffer to the destination buffer */ |
cactode | 59:8aa304768360 | 7183 | *dst = circBuffer[rOffset]; |
cactode | 59:8aa304768360 | 7184 | |
cactode | 59:8aa304768360 | 7185 | /* Update the input pointer */ |
cactode | 59:8aa304768360 | 7186 | dst += dstInc; |
cactode | 59:8aa304768360 | 7187 | |
cactode | 59:8aa304768360 | 7188 | if (dst == dst_end) |
cactode | 59:8aa304768360 | 7189 | { |
cactode | 59:8aa304768360 | 7190 | dst = dst_base; |
cactode | 59:8aa304768360 | 7191 | } |
cactode | 59:8aa304768360 | 7192 | |
cactode | 59:8aa304768360 | 7193 | /* Circularly update rOffset. Watch out for positive and negative value */ |
cactode | 59:8aa304768360 | 7194 | rOffset += bufferInc; |
cactode | 59:8aa304768360 | 7195 | |
cactode | 59:8aa304768360 | 7196 | if (rOffset >= L) |
cactode | 59:8aa304768360 | 7197 | { |
cactode | 59:8aa304768360 | 7198 | rOffset -= L; |
cactode | 59:8aa304768360 | 7199 | } |
cactode | 59:8aa304768360 | 7200 | |
cactode | 59:8aa304768360 | 7201 | /* Decrement the loop counter */ |
cactode | 59:8aa304768360 | 7202 | i--; |
cactode | 59:8aa304768360 | 7203 | } |
cactode | 59:8aa304768360 | 7204 | |
cactode | 59:8aa304768360 | 7205 | /* Update the index pointer */ |
cactode | 59:8aa304768360 | 7206 | *readOffset = rOffset; |
cactode | 59:8aa304768360 | 7207 | } |
cactode | 59:8aa304768360 | 7208 | |
cactode | 59:8aa304768360 | 7209 | |
cactode | 59:8aa304768360 | 7210 | /** |
cactode | 59:8aa304768360 | 7211 | * @brief Sum of the squares of the elements of a Q31 vector. |
cactode | 59:8aa304768360 | 7212 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7213 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7214 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7215 | */ |
cactode | 59:8aa304768360 | 7216 | void arm_power_q31( |
cactode | 59:8aa304768360 | 7217 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7218 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7219 | q63_t * pResult); |
cactode | 59:8aa304768360 | 7220 | |
cactode | 59:8aa304768360 | 7221 | |
cactode | 59:8aa304768360 | 7222 | /** |
cactode | 59:8aa304768360 | 7223 | * @brief Sum of the squares of the elements of a floating-point vector. |
cactode | 59:8aa304768360 | 7224 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7225 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7226 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7227 | */ |
cactode | 59:8aa304768360 | 7228 | void arm_power_f32( |
cactode | 59:8aa304768360 | 7229 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7230 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7231 | float32_t * pResult); |
cactode | 59:8aa304768360 | 7232 | |
cactode | 59:8aa304768360 | 7233 | |
cactode | 59:8aa304768360 | 7234 | /** |
cactode | 59:8aa304768360 | 7235 | * @brief Sum of the squares of the elements of a Q15 vector. |
cactode | 59:8aa304768360 | 7236 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7237 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7238 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7239 | */ |
cactode | 59:8aa304768360 | 7240 | void arm_power_q15( |
cactode | 59:8aa304768360 | 7241 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7242 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7243 | q63_t * pResult); |
cactode | 59:8aa304768360 | 7244 | |
cactode | 59:8aa304768360 | 7245 | |
cactode | 59:8aa304768360 | 7246 | /** |
cactode | 59:8aa304768360 | 7247 | * @brief Sum of the squares of the elements of a Q7 vector. |
cactode | 59:8aa304768360 | 7248 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7249 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7250 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7251 | */ |
cactode | 59:8aa304768360 | 7252 | void arm_power_q7( |
cactode | 59:8aa304768360 | 7253 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7254 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7255 | q31_t * pResult); |
cactode | 59:8aa304768360 | 7256 | |
cactode | 59:8aa304768360 | 7257 | |
cactode | 59:8aa304768360 | 7258 | /** |
cactode | 59:8aa304768360 | 7259 | * @brief Mean value of a Q7 vector. |
cactode | 59:8aa304768360 | 7260 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7261 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7262 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7263 | */ |
cactode | 59:8aa304768360 | 7264 | void arm_mean_q7( |
cactode | 59:8aa304768360 | 7265 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7266 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7267 | q7_t * pResult); |
cactode | 59:8aa304768360 | 7268 | |
cactode | 59:8aa304768360 | 7269 | |
cactode | 59:8aa304768360 | 7270 | /** |
cactode | 59:8aa304768360 | 7271 | * @brief Mean value of a Q15 vector. |
cactode | 59:8aa304768360 | 7272 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7273 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7274 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7275 | */ |
cactode | 59:8aa304768360 | 7276 | void arm_mean_q15( |
cactode | 59:8aa304768360 | 7277 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7278 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7279 | q15_t * pResult); |
cactode | 59:8aa304768360 | 7280 | |
cactode | 59:8aa304768360 | 7281 | |
cactode | 59:8aa304768360 | 7282 | /** |
cactode | 59:8aa304768360 | 7283 | * @brief Mean value of a Q31 vector. |
cactode | 59:8aa304768360 | 7284 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7285 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7286 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7287 | */ |
cactode | 59:8aa304768360 | 7288 | void arm_mean_q31( |
cactode | 59:8aa304768360 | 7289 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7290 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7291 | q31_t * pResult); |
cactode | 59:8aa304768360 | 7292 | |
cactode | 59:8aa304768360 | 7293 | |
cactode | 59:8aa304768360 | 7294 | /** |
cactode | 59:8aa304768360 | 7295 | * @brief Mean value of a floating-point vector. |
cactode | 59:8aa304768360 | 7296 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7297 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7298 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7299 | */ |
cactode | 59:8aa304768360 | 7300 | void arm_mean_f32( |
cactode | 59:8aa304768360 | 7301 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7302 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7303 | float32_t * pResult); |
cactode | 59:8aa304768360 | 7304 | |
cactode | 59:8aa304768360 | 7305 | |
cactode | 59:8aa304768360 | 7306 | /** |
cactode | 59:8aa304768360 | 7307 | * @brief Variance of the elements of a floating-point vector. |
cactode | 59:8aa304768360 | 7308 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7309 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7310 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7311 | */ |
cactode | 59:8aa304768360 | 7312 | void arm_var_f32( |
cactode | 59:8aa304768360 | 7313 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7314 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7315 | float32_t * pResult); |
cactode | 59:8aa304768360 | 7316 | |
cactode | 59:8aa304768360 | 7317 | |
cactode | 59:8aa304768360 | 7318 | /** |
cactode | 59:8aa304768360 | 7319 | * @brief Variance of the elements of a Q31 vector. |
cactode | 59:8aa304768360 | 7320 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7321 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7322 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7323 | */ |
cactode | 59:8aa304768360 | 7324 | void arm_var_q31( |
cactode | 59:8aa304768360 | 7325 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7326 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7327 | q31_t * pResult); |
cactode | 59:8aa304768360 | 7328 | |
cactode | 59:8aa304768360 | 7329 | |
cactode | 59:8aa304768360 | 7330 | /** |
cactode | 59:8aa304768360 | 7331 | * @brief Variance of the elements of a Q15 vector. |
cactode | 59:8aa304768360 | 7332 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7333 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7334 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7335 | */ |
cactode | 59:8aa304768360 | 7336 | void arm_var_q15( |
cactode | 59:8aa304768360 | 7337 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7338 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7339 | q15_t * pResult); |
cactode | 59:8aa304768360 | 7340 | |
cactode | 59:8aa304768360 | 7341 | |
cactode | 59:8aa304768360 | 7342 | /** |
cactode | 59:8aa304768360 | 7343 | * @brief Root Mean Square of the elements of a floating-point vector. |
cactode | 59:8aa304768360 | 7344 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7345 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7346 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7347 | */ |
cactode | 59:8aa304768360 | 7348 | void arm_rms_f32( |
cactode | 59:8aa304768360 | 7349 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7350 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7351 | float32_t * pResult); |
cactode | 59:8aa304768360 | 7352 | |
cactode | 59:8aa304768360 | 7353 | |
cactode | 59:8aa304768360 | 7354 | /** |
cactode | 59:8aa304768360 | 7355 | * @brief Root Mean Square of the elements of a Q31 vector. |
cactode | 59:8aa304768360 | 7356 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7357 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7358 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7359 | */ |
cactode | 59:8aa304768360 | 7360 | void arm_rms_q31( |
cactode | 59:8aa304768360 | 7361 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7362 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7363 | q31_t * pResult); |
cactode | 59:8aa304768360 | 7364 | |
cactode | 59:8aa304768360 | 7365 | |
cactode | 59:8aa304768360 | 7366 | /** |
cactode | 59:8aa304768360 | 7367 | * @brief Root Mean Square of the elements of a Q15 vector. |
cactode | 59:8aa304768360 | 7368 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7369 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7370 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7371 | */ |
cactode | 59:8aa304768360 | 7372 | void arm_rms_q15( |
cactode | 59:8aa304768360 | 7373 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7374 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7375 | q15_t * pResult); |
cactode | 59:8aa304768360 | 7376 | |
cactode | 59:8aa304768360 | 7377 | |
cactode | 59:8aa304768360 | 7378 | /** |
cactode | 59:8aa304768360 | 7379 | * @brief Standard deviation of the elements of a floating-point vector. |
cactode | 59:8aa304768360 | 7380 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7381 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7382 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7383 | */ |
cactode | 59:8aa304768360 | 7384 | void arm_std_f32( |
cactode | 59:8aa304768360 | 7385 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7386 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7387 | float32_t * pResult); |
cactode | 59:8aa304768360 | 7388 | |
cactode | 59:8aa304768360 | 7389 | |
cactode | 59:8aa304768360 | 7390 | /** |
cactode | 59:8aa304768360 | 7391 | * @brief Standard deviation of the elements of a Q31 vector. |
cactode | 59:8aa304768360 | 7392 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7393 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7394 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7395 | */ |
cactode | 59:8aa304768360 | 7396 | void arm_std_q31( |
cactode | 59:8aa304768360 | 7397 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7398 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7399 | q31_t * pResult); |
cactode | 59:8aa304768360 | 7400 | |
cactode | 59:8aa304768360 | 7401 | |
cactode | 59:8aa304768360 | 7402 | /** |
cactode | 59:8aa304768360 | 7403 | * @brief Standard deviation of the elements of a Q15 vector. |
cactode | 59:8aa304768360 | 7404 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7405 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7406 | * @param[out] pResult is output value. |
cactode | 59:8aa304768360 | 7407 | */ |
cactode | 59:8aa304768360 | 7408 | void arm_std_q15( |
cactode | 59:8aa304768360 | 7409 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7410 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7411 | q15_t * pResult); |
cactode | 59:8aa304768360 | 7412 | |
cactode | 59:8aa304768360 | 7413 | |
cactode | 59:8aa304768360 | 7414 | /** |
cactode | 59:8aa304768360 | 7415 | * @brief Floating-point complex magnitude |
cactode | 59:8aa304768360 | 7416 | * @param[in] pSrc points to the complex input vector |
cactode | 59:8aa304768360 | 7417 | * @param[out] pDst points to the real output vector |
cactode | 59:8aa304768360 | 7418 | * @param[in] numSamples number of complex samples in the input vector |
cactode | 59:8aa304768360 | 7419 | */ |
cactode | 59:8aa304768360 | 7420 | void arm_cmplx_mag_f32( |
cactode | 59:8aa304768360 | 7421 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7422 | float32_t * pDst, |
cactode | 59:8aa304768360 | 7423 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7424 | |
cactode | 59:8aa304768360 | 7425 | |
cactode | 59:8aa304768360 | 7426 | /** |
cactode | 59:8aa304768360 | 7427 | * @brief Q31 complex magnitude |
cactode | 59:8aa304768360 | 7428 | * @param[in] pSrc points to the complex input vector |
cactode | 59:8aa304768360 | 7429 | * @param[out] pDst points to the real output vector |
cactode | 59:8aa304768360 | 7430 | * @param[in] numSamples number of complex samples in the input vector |
cactode | 59:8aa304768360 | 7431 | */ |
cactode | 59:8aa304768360 | 7432 | void arm_cmplx_mag_q31( |
cactode | 59:8aa304768360 | 7433 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7434 | q31_t * pDst, |
cactode | 59:8aa304768360 | 7435 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7436 | |
cactode | 59:8aa304768360 | 7437 | |
cactode | 59:8aa304768360 | 7438 | /** |
cactode | 59:8aa304768360 | 7439 | * @brief Q15 complex magnitude |
cactode | 59:8aa304768360 | 7440 | * @param[in] pSrc points to the complex input vector |
cactode | 59:8aa304768360 | 7441 | * @param[out] pDst points to the real output vector |
cactode | 59:8aa304768360 | 7442 | * @param[in] numSamples number of complex samples in the input vector |
cactode | 59:8aa304768360 | 7443 | */ |
cactode | 59:8aa304768360 | 7444 | void arm_cmplx_mag_q15( |
cactode | 59:8aa304768360 | 7445 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7446 | q15_t * pDst, |
cactode | 59:8aa304768360 | 7447 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7448 | |
cactode | 59:8aa304768360 | 7449 | |
cactode | 59:8aa304768360 | 7450 | /** |
cactode | 59:8aa304768360 | 7451 | * @brief Q15 complex dot product |
cactode | 59:8aa304768360 | 7452 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 7453 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 7454 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 7455 | * @param[out] realResult real part of the result returned here |
cactode | 59:8aa304768360 | 7456 | * @param[out] imagResult imaginary part of the result returned here |
cactode | 59:8aa304768360 | 7457 | */ |
cactode | 59:8aa304768360 | 7458 | void arm_cmplx_dot_prod_q15( |
cactode | 59:8aa304768360 | 7459 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 7460 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 7461 | uint32_t numSamples, |
cactode | 59:8aa304768360 | 7462 | q31_t * realResult, |
cactode | 59:8aa304768360 | 7463 | q31_t * imagResult); |
cactode | 59:8aa304768360 | 7464 | |
cactode | 59:8aa304768360 | 7465 | |
cactode | 59:8aa304768360 | 7466 | /** |
cactode | 59:8aa304768360 | 7467 | * @brief Q31 complex dot product |
cactode | 59:8aa304768360 | 7468 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 7469 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 7470 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 7471 | * @param[out] realResult real part of the result returned here |
cactode | 59:8aa304768360 | 7472 | * @param[out] imagResult imaginary part of the result returned here |
cactode | 59:8aa304768360 | 7473 | */ |
cactode | 59:8aa304768360 | 7474 | void arm_cmplx_dot_prod_q31( |
cactode | 59:8aa304768360 | 7475 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 7476 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 7477 | uint32_t numSamples, |
cactode | 59:8aa304768360 | 7478 | q63_t * realResult, |
cactode | 59:8aa304768360 | 7479 | q63_t * imagResult); |
cactode | 59:8aa304768360 | 7480 | |
cactode | 59:8aa304768360 | 7481 | |
cactode | 59:8aa304768360 | 7482 | /** |
cactode | 59:8aa304768360 | 7483 | * @brief Floating-point complex dot product |
cactode | 59:8aa304768360 | 7484 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 7485 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 7486 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 7487 | * @param[out] realResult real part of the result returned here |
cactode | 59:8aa304768360 | 7488 | * @param[out] imagResult imaginary part of the result returned here |
cactode | 59:8aa304768360 | 7489 | */ |
cactode | 59:8aa304768360 | 7490 | void arm_cmplx_dot_prod_f32( |
cactode | 59:8aa304768360 | 7491 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 7492 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 7493 | uint32_t numSamples, |
cactode | 59:8aa304768360 | 7494 | float32_t * realResult, |
cactode | 59:8aa304768360 | 7495 | float32_t * imagResult); |
cactode | 59:8aa304768360 | 7496 | |
cactode | 59:8aa304768360 | 7497 | |
cactode | 59:8aa304768360 | 7498 | /** |
cactode | 59:8aa304768360 | 7499 | * @brief Q15 complex-by-real multiplication |
cactode | 59:8aa304768360 | 7500 | * @param[in] pSrcCmplx points to the complex input vector |
cactode | 59:8aa304768360 | 7501 | * @param[in] pSrcReal points to the real input vector |
cactode | 59:8aa304768360 | 7502 | * @param[out] pCmplxDst points to the complex output vector |
cactode | 59:8aa304768360 | 7503 | * @param[in] numSamples number of samples in each vector |
cactode | 59:8aa304768360 | 7504 | */ |
cactode | 59:8aa304768360 | 7505 | void arm_cmplx_mult_real_q15( |
cactode | 59:8aa304768360 | 7506 | const q15_t * pSrcCmplx, |
cactode | 59:8aa304768360 | 7507 | const q15_t * pSrcReal, |
cactode | 59:8aa304768360 | 7508 | q15_t * pCmplxDst, |
cactode | 59:8aa304768360 | 7509 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7510 | |
cactode | 59:8aa304768360 | 7511 | |
cactode | 59:8aa304768360 | 7512 | /** |
cactode | 59:8aa304768360 | 7513 | * @brief Q31 complex-by-real multiplication |
cactode | 59:8aa304768360 | 7514 | * @param[in] pSrcCmplx points to the complex input vector |
cactode | 59:8aa304768360 | 7515 | * @param[in] pSrcReal points to the real input vector |
cactode | 59:8aa304768360 | 7516 | * @param[out] pCmplxDst points to the complex output vector |
cactode | 59:8aa304768360 | 7517 | * @param[in] numSamples number of samples in each vector |
cactode | 59:8aa304768360 | 7518 | */ |
cactode | 59:8aa304768360 | 7519 | void arm_cmplx_mult_real_q31( |
cactode | 59:8aa304768360 | 7520 | const q31_t * pSrcCmplx, |
cactode | 59:8aa304768360 | 7521 | const q31_t * pSrcReal, |
cactode | 59:8aa304768360 | 7522 | q31_t * pCmplxDst, |
cactode | 59:8aa304768360 | 7523 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7524 | |
cactode | 59:8aa304768360 | 7525 | |
cactode | 59:8aa304768360 | 7526 | /** |
cactode | 59:8aa304768360 | 7527 | * @brief Floating-point complex-by-real multiplication |
cactode | 59:8aa304768360 | 7528 | * @param[in] pSrcCmplx points to the complex input vector |
cactode | 59:8aa304768360 | 7529 | * @param[in] pSrcReal points to the real input vector |
cactode | 59:8aa304768360 | 7530 | * @param[out] pCmplxDst points to the complex output vector |
cactode | 59:8aa304768360 | 7531 | * @param[in] numSamples number of samples in each vector |
cactode | 59:8aa304768360 | 7532 | */ |
cactode | 59:8aa304768360 | 7533 | void arm_cmplx_mult_real_f32( |
cactode | 59:8aa304768360 | 7534 | const float32_t * pSrcCmplx, |
cactode | 59:8aa304768360 | 7535 | const float32_t * pSrcReal, |
cactode | 59:8aa304768360 | 7536 | float32_t * pCmplxDst, |
cactode | 59:8aa304768360 | 7537 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7538 | |
cactode | 59:8aa304768360 | 7539 | |
cactode | 59:8aa304768360 | 7540 | /** |
cactode | 59:8aa304768360 | 7541 | * @brief Minimum value of a Q7 vector. |
cactode | 59:8aa304768360 | 7542 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7543 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7544 | * @param[out] result is output pointer |
cactode | 59:8aa304768360 | 7545 | * @param[in] index is the array index of the minimum value in the input buffer. |
cactode | 59:8aa304768360 | 7546 | */ |
cactode | 59:8aa304768360 | 7547 | void arm_min_q7( |
cactode | 59:8aa304768360 | 7548 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7549 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7550 | q7_t * result, |
cactode | 59:8aa304768360 | 7551 | uint32_t * index); |
cactode | 59:8aa304768360 | 7552 | |
cactode | 59:8aa304768360 | 7553 | |
cactode | 59:8aa304768360 | 7554 | /** |
cactode | 59:8aa304768360 | 7555 | * @brief Minimum value of a Q15 vector. |
cactode | 59:8aa304768360 | 7556 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7557 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7558 | * @param[out] pResult is output pointer |
cactode | 59:8aa304768360 | 7559 | * @param[in] pIndex is the array index of the minimum value in the input buffer. |
cactode | 59:8aa304768360 | 7560 | */ |
cactode | 59:8aa304768360 | 7561 | void arm_min_q15( |
cactode | 59:8aa304768360 | 7562 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7563 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7564 | q15_t * pResult, |
cactode | 59:8aa304768360 | 7565 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7566 | |
cactode | 59:8aa304768360 | 7567 | |
cactode | 59:8aa304768360 | 7568 | /** |
cactode | 59:8aa304768360 | 7569 | * @brief Minimum value of a Q31 vector. |
cactode | 59:8aa304768360 | 7570 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7571 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7572 | * @param[out] pResult is output pointer |
cactode | 59:8aa304768360 | 7573 | * @param[out] pIndex is the array index of the minimum value in the input buffer. |
cactode | 59:8aa304768360 | 7574 | */ |
cactode | 59:8aa304768360 | 7575 | void arm_min_q31( |
cactode | 59:8aa304768360 | 7576 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7577 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7578 | q31_t * pResult, |
cactode | 59:8aa304768360 | 7579 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7580 | |
cactode | 59:8aa304768360 | 7581 | |
cactode | 59:8aa304768360 | 7582 | /** |
cactode | 59:8aa304768360 | 7583 | * @brief Minimum value of a floating-point vector. |
cactode | 59:8aa304768360 | 7584 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7585 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7586 | * @param[out] pResult is output pointer |
cactode | 59:8aa304768360 | 7587 | * @param[out] pIndex is the array index of the minimum value in the input buffer. |
cactode | 59:8aa304768360 | 7588 | */ |
cactode | 59:8aa304768360 | 7589 | void arm_min_f32( |
cactode | 59:8aa304768360 | 7590 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7591 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7592 | float32_t * pResult, |
cactode | 59:8aa304768360 | 7593 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7594 | |
cactode | 59:8aa304768360 | 7595 | |
cactode | 59:8aa304768360 | 7596 | /** |
cactode | 59:8aa304768360 | 7597 | * @brief Maximum value of a Q7 vector. |
cactode | 59:8aa304768360 | 7598 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 7599 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7600 | * @param[out] pResult maximum value returned here |
cactode | 59:8aa304768360 | 7601 | * @param[out] pIndex index of maximum value returned here |
cactode | 59:8aa304768360 | 7602 | */ |
cactode | 59:8aa304768360 | 7603 | void arm_max_q7( |
cactode | 59:8aa304768360 | 7604 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7605 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7606 | q7_t * pResult, |
cactode | 59:8aa304768360 | 7607 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7608 | |
cactode | 59:8aa304768360 | 7609 | |
cactode | 59:8aa304768360 | 7610 | /** |
cactode | 59:8aa304768360 | 7611 | * @brief Maximum value of a Q15 vector. |
cactode | 59:8aa304768360 | 7612 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 7613 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7614 | * @param[out] pResult maximum value returned here |
cactode | 59:8aa304768360 | 7615 | * @param[out] pIndex index of maximum value returned here |
cactode | 59:8aa304768360 | 7616 | */ |
cactode | 59:8aa304768360 | 7617 | void arm_max_q15( |
cactode | 59:8aa304768360 | 7618 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7619 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7620 | q15_t * pResult, |
cactode | 59:8aa304768360 | 7621 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7622 | |
cactode | 59:8aa304768360 | 7623 | |
cactode | 59:8aa304768360 | 7624 | /** |
cactode | 59:8aa304768360 | 7625 | * @brief Maximum value of a Q31 vector. |
cactode | 59:8aa304768360 | 7626 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 7627 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7628 | * @param[out] pResult maximum value returned here |
cactode | 59:8aa304768360 | 7629 | * @param[out] pIndex index of maximum value returned here |
cactode | 59:8aa304768360 | 7630 | */ |
cactode | 59:8aa304768360 | 7631 | void arm_max_q31( |
cactode | 59:8aa304768360 | 7632 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7633 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7634 | q31_t * pResult, |
cactode | 59:8aa304768360 | 7635 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7636 | |
cactode | 59:8aa304768360 | 7637 | |
cactode | 59:8aa304768360 | 7638 | /** |
cactode | 59:8aa304768360 | 7639 | * @brief Maximum value of a floating-point vector. |
cactode | 59:8aa304768360 | 7640 | * @param[in] pSrc points to the input buffer |
cactode | 59:8aa304768360 | 7641 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7642 | * @param[out] pResult maximum value returned here |
cactode | 59:8aa304768360 | 7643 | * @param[out] pIndex index of maximum value returned here |
cactode | 59:8aa304768360 | 7644 | */ |
cactode | 59:8aa304768360 | 7645 | void arm_max_f32( |
cactode | 59:8aa304768360 | 7646 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7647 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7648 | float32_t * pResult, |
cactode | 59:8aa304768360 | 7649 | uint32_t * pIndex); |
cactode | 59:8aa304768360 | 7650 | |
cactode | 59:8aa304768360 | 7651 | /** |
cactode | 59:8aa304768360 | 7652 | @brief Maximum value of a floating-point vector. |
cactode | 59:8aa304768360 | 7653 | @param[in] pSrc points to the input vector |
cactode | 59:8aa304768360 | 7654 | @param[in] blockSize number of samples in input vector |
cactode | 59:8aa304768360 | 7655 | @param[out] pResult maximum value returned here |
cactode | 59:8aa304768360 | 7656 | @return none |
cactode | 59:8aa304768360 | 7657 | */ |
cactode | 59:8aa304768360 | 7658 | void arm_max_no_idx_f32( |
cactode | 59:8aa304768360 | 7659 | const float32_t *pSrc, |
cactode | 59:8aa304768360 | 7660 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 7661 | float32_t *pResult); |
cactode | 59:8aa304768360 | 7662 | |
cactode | 59:8aa304768360 | 7663 | /** |
cactode | 59:8aa304768360 | 7664 | * @brief Q15 complex-by-complex multiplication |
cactode | 59:8aa304768360 | 7665 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 7666 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 7667 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 7668 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 7669 | */ |
cactode | 59:8aa304768360 | 7670 | void arm_cmplx_mult_cmplx_q15( |
cactode | 59:8aa304768360 | 7671 | const q15_t * pSrcA, |
cactode | 59:8aa304768360 | 7672 | const q15_t * pSrcB, |
cactode | 59:8aa304768360 | 7673 | q15_t * pDst, |
cactode | 59:8aa304768360 | 7674 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7675 | |
cactode | 59:8aa304768360 | 7676 | |
cactode | 59:8aa304768360 | 7677 | /** |
cactode | 59:8aa304768360 | 7678 | * @brief Q31 complex-by-complex multiplication |
cactode | 59:8aa304768360 | 7679 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 7680 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 7681 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 7682 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 7683 | */ |
cactode | 59:8aa304768360 | 7684 | void arm_cmplx_mult_cmplx_q31( |
cactode | 59:8aa304768360 | 7685 | const q31_t * pSrcA, |
cactode | 59:8aa304768360 | 7686 | const q31_t * pSrcB, |
cactode | 59:8aa304768360 | 7687 | q31_t * pDst, |
cactode | 59:8aa304768360 | 7688 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7689 | |
cactode | 59:8aa304768360 | 7690 | |
cactode | 59:8aa304768360 | 7691 | /** |
cactode | 59:8aa304768360 | 7692 | * @brief Floating-point complex-by-complex multiplication |
cactode | 59:8aa304768360 | 7693 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 7694 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 7695 | * @param[out] pDst points to the output vector |
cactode | 59:8aa304768360 | 7696 | * @param[in] numSamples number of complex samples in each vector |
cactode | 59:8aa304768360 | 7697 | */ |
cactode | 59:8aa304768360 | 7698 | void arm_cmplx_mult_cmplx_f32( |
cactode | 59:8aa304768360 | 7699 | const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 7700 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 7701 | float32_t * pDst, |
cactode | 59:8aa304768360 | 7702 | uint32_t numSamples); |
cactode | 59:8aa304768360 | 7703 | |
cactode | 59:8aa304768360 | 7704 | |
cactode | 59:8aa304768360 | 7705 | /** |
cactode | 59:8aa304768360 | 7706 | * @brief Converts the elements of the floating-point vector to Q31 vector. |
cactode | 59:8aa304768360 | 7707 | * @param[in] pSrc points to the floating-point input vector |
cactode | 59:8aa304768360 | 7708 | * @param[out] pDst points to the Q31 output vector |
cactode | 59:8aa304768360 | 7709 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7710 | */ |
cactode | 59:8aa304768360 | 7711 | void arm_float_to_q31( |
cactode | 59:8aa304768360 | 7712 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7713 | q31_t * pDst, |
cactode | 59:8aa304768360 | 7714 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7715 | |
cactode | 59:8aa304768360 | 7716 | |
cactode | 59:8aa304768360 | 7717 | /** |
cactode | 59:8aa304768360 | 7718 | * @brief Converts the elements of the floating-point vector to Q15 vector. |
cactode | 59:8aa304768360 | 7719 | * @param[in] pSrc points to the floating-point input vector |
cactode | 59:8aa304768360 | 7720 | * @param[out] pDst points to the Q15 output vector |
cactode | 59:8aa304768360 | 7721 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7722 | */ |
cactode | 59:8aa304768360 | 7723 | void arm_float_to_q15( |
cactode | 59:8aa304768360 | 7724 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7725 | q15_t * pDst, |
cactode | 59:8aa304768360 | 7726 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7727 | |
cactode | 59:8aa304768360 | 7728 | |
cactode | 59:8aa304768360 | 7729 | /** |
cactode | 59:8aa304768360 | 7730 | * @brief Converts the elements of the floating-point vector to Q7 vector. |
cactode | 59:8aa304768360 | 7731 | * @param[in] pSrc points to the floating-point input vector |
cactode | 59:8aa304768360 | 7732 | * @param[out] pDst points to the Q7 output vector |
cactode | 59:8aa304768360 | 7733 | * @param[in] blockSize length of the input vector |
cactode | 59:8aa304768360 | 7734 | */ |
cactode | 59:8aa304768360 | 7735 | void arm_float_to_q7( |
cactode | 59:8aa304768360 | 7736 | const float32_t * pSrc, |
cactode | 59:8aa304768360 | 7737 | q7_t * pDst, |
cactode | 59:8aa304768360 | 7738 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7739 | |
cactode | 59:8aa304768360 | 7740 | |
cactode | 59:8aa304768360 | 7741 | /** |
cactode | 59:8aa304768360 | 7742 | * @brief Converts the elements of the Q31 vector to floating-point vector. |
cactode | 59:8aa304768360 | 7743 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7744 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7745 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7746 | */ |
cactode | 59:8aa304768360 | 7747 | void arm_q31_to_float( |
cactode | 59:8aa304768360 | 7748 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7749 | float32_t * pDst, |
cactode | 59:8aa304768360 | 7750 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7751 | |
cactode | 59:8aa304768360 | 7752 | |
cactode | 59:8aa304768360 | 7753 | /** |
cactode | 59:8aa304768360 | 7754 | * @brief Converts the elements of the Q31 vector to Q15 vector. |
cactode | 59:8aa304768360 | 7755 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7756 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7757 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7758 | */ |
cactode | 59:8aa304768360 | 7759 | void arm_q31_to_q15( |
cactode | 59:8aa304768360 | 7760 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7761 | q15_t * pDst, |
cactode | 59:8aa304768360 | 7762 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7763 | |
cactode | 59:8aa304768360 | 7764 | |
cactode | 59:8aa304768360 | 7765 | /** |
cactode | 59:8aa304768360 | 7766 | * @brief Converts the elements of the Q31 vector to Q7 vector. |
cactode | 59:8aa304768360 | 7767 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7768 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7769 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7770 | */ |
cactode | 59:8aa304768360 | 7771 | void arm_q31_to_q7( |
cactode | 59:8aa304768360 | 7772 | const q31_t * pSrc, |
cactode | 59:8aa304768360 | 7773 | q7_t * pDst, |
cactode | 59:8aa304768360 | 7774 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7775 | |
cactode | 59:8aa304768360 | 7776 | |
cactode | 59:8aa304768360 | 7777 | /** |
cactode | 59:8aa304768360 | 7778 | * @brief Converts the elements of the Q15 vector to floating-point vector. |
cactode | 59:8aa304768360 | 7779 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7780 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7781 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7782 | */ |
cactode | 59:8aa304768360 | 7783 | void arm_q15_to_float( |
cactode | 59:8aa304768360 | 7784 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7785 | float32_t * pDst, |
cactode | 59:8aa304768360 | 7786 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7787 | |
cactode | 59:8aa304768360 | 7788 | |
cactode | 59:8aa304768360 | 7789 | /** |
cactode | 59:8aa304768360 | 7790 | * @brief Converts the elements of the Q15 vector to Q31 vector. |
cactode | 59:8aa304768360 | 7791 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7792 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7793 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7794 | */ |
cactode | 59:8aa304768360 | 7795 | void arm_q15_to_q31( |
cactode | 59:8aa304768360 | 7796 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7797 | q31_t * pDst, |
cactode | 59:8aa304768360 | 7798 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7799 | |
cactode | 59:8aa304768360 | 7800 | |
cactode | 59:8aa304768360 | 7801 | /** |
cactode | 59:8aa304768360 | 7802 | * @brief Converts the elements of the Q15 vector to Q7 vector. |
cactode | 59:8aa304768360 | 7803 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7804 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7805 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7806 | */ |
cactode | 59:8aa304768360 | 7807 | void arm_q15_to_q7( |
cactode | 59:8aa304768360 | 7808 | const q15_t * pSrc, |
cactode | 59:8aa304768360 | 7809 | q7_t * pDst, |
cactode | 59:8aa304768360 | 7810 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7811 | |
cactode | 59:8aa304768360 | 7812 | |
cactode | 59:8aa304768360 | 7813 | /** |
cactode | 59:8aa304768360 | 7814 | * @brief Converts the elements of the Q7 vector to floating-point vector. |
cactode | 59:8aa304768360 | 7815 | * @param[in] pSrc is input pointer |
cactode | 59:8aa304768360 | 7816 | * @param[out] pDst is output pointer |
cactode | 59:8aa304768360 | 7817 | * @param[in] blockSize is the number of samples to process |
cactode | 59:8aa304768360 | 7818 | */ |
cactode | 59:8aa304768360 | 7819 | void arm_q7_to_float( |
cactode | 59:8aa304768360 | 7820 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7821 | float32_t * pDst, |
cactode | 59:8aa304768360 | 7822 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7823 | |
cactode | 59:8aa304768360 | 7824 | |
cactode | 59:8aa304768360 | 7825 | /** |
cactode | 59:8aa304768360 | 7826 | * @brief Converts the elements of the Q7 vector to Q31 vector. |
cactode | 59:8aa304768360 | 7827 | * @param[in] pSrc input pointer |
cactode | 59:8aa304768360 | 7828 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 7829 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 7830 | */ |
cactode | 59:8aa304768360 | 7831 | void arm_q7_to_q31( |
cactode | 59:8aa304768360 | 7832 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7833 | q31_t * pDst, |
cactode | 59:8aa304768360 | 7834 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7835 | |
cactode | 59:8aa304768360 | 7836 | |
cactode | 59:8aa304768360 | 7837 | /** |
cactode | 59:8aa304768360 | 7838 | * @brief Converts the elements of the Q7 vector to Q15 vector. |
cactode | 59:8aa304768360 | 7839 | * @param[in] pSrc input pointer |
cactode | 59:8aa304768360 | 7840 | * @param[out] pDst output pointer |
cactode | 59:8aa304768360 | 7841 | * @param[in] blockSize number of samples to process |
cactode | 59:8aa304768360 | 7842 | */ |
cactode | 59:8aa304768360 | 7843 | void arm_q7_to_q15( |
cactode | 59:8aa304768360 | 7844 | const q7_t * pSrc, |
cactode | 59:8aa304768360 | 7845 | q15_t * pDst, |
cactode | 59:8aa304768360 | 7846 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 7847 | |
cactode | 59:8aa304768360 | 7848 | /** |
cactode | 59:8aa304768360 | 7849 | * @brief Struct for specifying SVM Kernel |
cactode | 59:8aa304768360 | 7850 | */ |
cactode | 59:8aa304768360 | 7851 | typedef enum |
cactode | 59:8aa304768360 | 7852 | { |
cactode | 59:8aa304768360 | 7853 | ARM_ML_KERNEL_LINEAR = 0, |
cactode | 59:8aa304768360 | 7854 | /**< Linear kernel */ |
cactode | 59:8aa304768360 | 7855 | ARM_ML_KERNEL_POLYNOMIAL = 1, |
cactode | 59:8aa304768360 | 7856 | /**< Polynomial kernel */ |
cactode | 59:8aa304768360 | 7857 | ARM_ML_KERNEL_RBF = 2, |
cactode | 59:8aa304768360 | 7858 | /**< Radial Basis Function kernel */ |
cactode | 59:8aa304768360 | 7859 | ARM_ML_KERNEL_SIGMOID = 3 |
cactode | 59:8aa304768360 | 7860 | /**< Sigmoid kernel */ |
cactode | 59:8aa304768360 | 7861 | } arm_ml_kernel_type; |
cactode | 59:8aa304768360 | 7862 | |
cactode | 59:8aa304768360 | 7863 | |
cactode | 59:8aa304768360 | 7864 | /** |
cactode | 59:8aa304768360 | 7865 | * @brief Instance structure for linear SVM prediction function. |
cactode | 59:8aa304768360 | 7866 | */ |
cactode | 59:8aa304768360 | 7867 | typedef struct |
cactode | 59:8aa304768360 | 7868 | { |
cactode | 59:8aa304768360 | 7869 | uint32_t nbOfSupportVectors; /**< Number of support vectors */ |
cactode | 59:8aa304768360 | 7870 | uint32_t vectorDimension; /**< Dimension of vector space */ |
cactode | 59:8aa304768360 | 7871 | float32_t intercept; /**< Intercept */ |
cactode | 59:8aa304768360 | 7872 | const float32_t *dualCoefficients; /**< Dual coefficients */ |
cactode | 59:8aa304768360 | 7873 | const float32_t *supportVectors; /**< Support vectors */ |
cactode | 59:8aa304768360 | 7874 | const int32_t *classes; /**< The two SVM classes */ |
cactode | 59:8aa304768360 | 7875 | } arm_svm_linear_instance_f32; |
cactode | 59:8aa304768360 | 7876 | |
cactode | 59:8aa304768360 | 7877 | |
cactode | 59:8aa304768360 | 7878 | /** |
cactode | 59:8aa304768360 | 7879 | * @brief Instance structure for polynomial SVM prediction function. |
cactode | 59:8aa304768360 | 7880 | */ |
cactode | 59:8aa304768360 | 7881 | typedef struct |
cactode | 59:8aa304768360 | 7882 | { |
cactode | 59:8aa304768360 | 7883 | uint32_t nbOfSupportVectors; /**< Number of support vectors */ |
cactode | 59:8aa304768360 | 7884 | uint32_t vectorDimension; /**< Dimension of vector space */ |
cactode | 59:8aa304768360 | 7885 | float32_t intercept; /**< Intercept */ |
cactode | 59:8aa304768360 | 7886 | const float32_t *dualCoefficients; /**< Dual coefficients */ |
cactode | 59:8aa304768360 | 7887 | const float32_t *supportVectors; /**< Support vectors */ |
cactode | 59:8aa304768360 | 7888 | const int32_t *classes; /**< The two SVM classes */ |
cactode | 59:8aa304768360 | 7889 | int32_t degree; /**< Polynomial degree */ |
cactode | 59:8aa304768360 | 7890 | float32_t coef0; /**< Polynomial constant */ |
cactode | 59:8aa304768360 | 7891 | float32_t gamma; /**< Gamma factor */ |
cactode | 59:8aa304768360 | 7892 | } arm_svm_polynomial_instance_f32; |
cactode | 59:8aa304768360 | 7893 | |
cactode | 59:8aa304768360 | 7894 | /** |
cactode | 59:8aa304768360 | 7895 | * @brief Instance structure for rbf SVM prediction function. |
cactode | 59:8aa304768360 | 7896 | */ |
cactode | 59:8aa304768360 | 7897 | typedef struct |
cactode | 59:8aa304768360 | 7898 | { |
cactode | 59:8aa304768360 | 7899 | uint32_t nbOfSupportVectors; /**< Number of support vectors */ |
cactode | 59:8aa304768360 | 7900 | uint32_t vectorDimension; /**< Dimension of vector space */ |
cactode | 59:8aa304768360 | 7901 | float32_t intercept; /**< Intercept */ |
cactode | 59:8aa304768360 | 7902 | const float32_t *dualCoefficients; /**< Dual coefficients */ |
cactode | 59:8aa304768360 | 7903 | const float32_t *supportVectors; /**< Support vectors */ |
cactode | 59:8aa304768360 | 7904 | const int32_t *classes; /**< The two SVM classes */ |
cactode | 59:8aa304768360 | 7905 | float32_t gamma; /**< Gamma factor */ |
cactode | 59:8aa304768360 | 7906 | } arm_svm_rbf_instance_f32; |
cactode | 59:8aa304768360 | 7907 | |
cactode | 59:8aa304768360 | 7908 | /** |
cactode | 59:8aa304768360 | 7909 | * @brief Instance structure for sigmoid SVM prediction function. |
cactode | 59:8aa304768360 | 7910 | */ |
cactode | 59:8aa304768360 | 7911 | typedef struct |
cactode | 59:8aa304768360 | 7912 | { |
cactode | 59:8aa304768360 | 7913 | uint32_t nbOfSupportVectors; /**< Number of support vectors */ |
cactode | 59:8aa304768360 | 7914 | uint32_t vectorDimension; /**< Dimension of vector space */ |
cactode | 59:8aa304768360 | 7915 | float32_t intercept; /**< Intercept */ |
cactode | 59:8aa304768360 | 7916 | const float32_t *dualCoefficients; /**< Dual coefficients */ |
cactode | 59:8aa304768360 | 7917 | const float32_t *supportVectors; /**< Support vectors */ |
cactode | 59:8aa304768360 | 7918 | const int32_t *classes; /**< The two SVM classes */ |
cactode | 59:8aa304768360 | 7919 | float32_t coef0; /**< Independant constant */ |
cactode | 59:8aa304768360 | 7920 | float32_t gamma; /**< Gamma factor */ |
cactode | 59:8aa304768360 | 7921 | } arm_svm_sigmoid_instance_f32; |
cactode | 59:8aa304768360 | 7922 | |
cactode | 59:8aa304768360 | 7923 | /** |
cactode | 59:8aa304768360 | 7924 | * @brief SVM linear instance init function |
cactode | 59:8aa304768360 | 7925 | * @param[in] S Parameters for SVM functions |
cactode | 59:8aa304768360 | 7926 | * @param[in] nbOfSupportVectors Number of support vectors |
cactode | 59:8aa304768360 | 7927 | * @param[in] vectorDimension Dimension of vector space |
cactode | 59:8aa304768360 | 7928 | * @param[in] intercept Intercept |
cactode | 59:8aa304768360 | 7929 | * @param[in] dualCoefficients Array of dual coefficients |
cactode | 59:8aa304768360 | 7930 | * @param[in] supportVectors Array of support vectors |
cactode | 59:8aa304768360 | 7931 | * @param[in] classes Array of 2 classes ID |
cactode | 59:8aa304768360 | 7932 | * @return none. |
cactode | 59:8aa304768360 | 7933 | * |
cactode | 59:8aa304768360 | 7934 | */ |
cactode | 59:8aa304768360 | 7935 | |
cactode | 59:8aa304768360 | 7936 | |
cactode | 59:8aa304768360 | 7937 | void arm_svm_linear_init_f32(arm_svm_linear_instance_f32 *S, |
cactode | 59:8aa304768360 | 7938 | uint32_t nbOfSupportVectors, |
cactode | 59:8aa304768360 | 7939 | uint32_t vectorDimension, |
cactode | 59:8aa304768360 | 7940 | float32_t intercept, |
cactode | 59:8aa304768360 | 7941 | const float32_t *dualCoefficients, |
cactode | 59:8aa304768360 | 7942 | const float32_t *supportVectors, |
cactode | 59:8aa304768360 | 7943 | const int32_t *classes); |
cactode | 59:8aa304768360 | 7944 | |
cactode | 59:8aa304768360 | 7945 | /** |
cactode | 59:8aa304768360 | 7946 | * @brief SVM linear prediction |
cactode | 59:8aa304768360 | 7947 | * @param[in] S Pointer to an instance of the linear SVM structure. |
cactode | 59:8aa304768360 | 7948 | * @param[in] in Pointer to input vector |
cactode | 59:8aa304768360 | 7949 | * @param[out] pResult Decision value |
cactode | 59:8aa304768360 | 7950 | * @return none. |
cactode | 59:8aa304768360 | 7951 | * |
cactode | 59:8aa304768360 | 7952 | */ |
cactode | 59:8aa304768360 | 7953 | |
cactode | 59:8aa304768360 | 7954 | void arm_svm_linear_predict_f32(const arm_svm_linear_instance_f32 *S, |
cactode | 59:8aa304768360 | 7955 | const float32_t * in, |
cactode | 59:8aa304768360 | 7956 | int32_t * pResult); |
cactode | 59:8aa304768360 | 7957 | |
cactode | 59:8aa304768360 | 7958 | |
cactode | 59:8aa304768360 | 7959 | /** |
cactode | 59:8aa304768360 | 7960 | * @brief SVM polynomial instance init function |
cactode | 59:8aa304768360 | 7961 | * @param[in] S points to an instance of the polynomial SVM structure. |
cactode | 59:8aa304768360 | 7962 | * @param[in] nbOfSupportVectors Number of support vectors |
cactode | 59:8aa304768360 | 7963 | * @param[in] vectorDimension Dimension of vector space |
cactode | 59:8aa304768360 | 7964 | * @param[in] intercept Intercept |
cactode | 59:8aa304768360 | 7965 | * @param[in] dualCoefficients Array of dual coefficients |
cactode | 59:8aa304768360 | 7966 | * @param[in] supportVectors Array of support vectors |
cactode | 59:8aa304768360 | 7967 | * @param[in] classes Array of 2 classes ID |
cactode | 59:8aa304768360 | 7968 | * @param[in] degree Polynomial degree |
cactode | 59:8aa304768360 | 7969 | * @param[in] coef0 coeff0 (scikit-learn terminology) |
cactode | 59:8aa304768360 | 7970 | * @param[in] gamma gamma (scikit-learn terminology) |
cactode | 59:8aa304768360 | 7971 | * @return none. |
cactode | 59:8aa304768360 | 7972 | * |
cactode | 59:8aa304768360 | 7973 | */ |
cactode | 59:8aa304768360 | 7974 | |
cactode | 59:8aa304768360 | 7975 | |
cactode | 59:8aa304768360 | 7976 | void arm_svm_polynomial_init_f32(arm_svm_polynomial_instance_f32 *S, |
cactode | 59:8aa304768360 | 7977 | uint32_t nbOfSupportVectors, |
cactode | 59:8aa304768360 | 7978 | uint32_t vectorDimension, |
cactode | 59:8aa304768360 | 7979 | float32_t intercept, |
cactode | 59:8aa304768360 | 7980 | const float32_t *dualCoefficients, |
cactode | 59:8aa304768360 | 7981 | const float32_t *supportVectors, |
cactode | 59:8aa304768360 | 7982 | const int32_t *classes, |
cactode | 59:8aa304768360 | 7983 | int32_t degree, |
cactode | 59:8aa304768360 | 7984 | float32_t coef0, |
cactode | 59:8aa304768360 | 7985 | float32_t gamma |
cactode | 59:8aa304768360 | 7986 | ); |
cactode | 59:8aa304768360 | 7987 | |
cactode | 59:8aa304768360 | 7988 | /** |
cactode | 59:8aa304768360 | 7989 | * @brief SVM polynomial prediction |
cactode | 59:8aa304768360 | 7990 | * @param[in] S Pointer to an instance of the polynomial SVM structure. |
cactode | 59:8aa304768360 | 7991 | * @param[in] in Pointer to input vector |
cactode | 59:8aa304768360 | 7992 | * @param[out] pResult Decision value |
cactode | 59:8aa304768360 | 7993 | * @return none. |
cactode | 59:8aa304768360 | 7994 | * |
cactode | 59:8aa304768360 | 7995 | */ |
cactode | 59:8aa304768360 | 7996 | void arm_svm_polynomial_predict_f32(const arm_svm_polynomial_instance_f32 *S, |
cactode | 59:8aa304768360 | 7997 | const float32_t * in, |
cactode | 59:8aa304768360 | 7998 | int32_t * pResult); |
cactode | 59:8aa304768360 | 7999 | |
cactode | 59:8aa304768360 | 8000 | |
cactode | 59:8aa304768360 | 8001 | /** |
cactode | 59:8aa304768360 | 8002 | * @brief SVM radial basis function instance init function |
cactode | 59:8aa304768360 | 8003 | * @param[in] S points to an instance of the polynomial SVM structure. |
cactode | 59:8aa304768360 | 8004 | * @param[in] nbOfSupportVectors Number of support vectors |
cactode | 59:8aa304768360 | 8005 | * @param[in] vectorDimension Dimension of vector space |
cactode | 59:8aa304768360 | 8006 | * @param[in] intercept Intercept |
cactode | 59:8aa304768360 | 8007 | * @param[in] dualCoefficients Array of dual coefficients |
cactode | 59:8aa304768360 | 8008 | * @param[in] supportVectors Array of support vectors |
cactode | 59:8aa304768360 | 8009 | * @param[in] classes Array of 2 classes ID |
cactode | 59:8aa304768360 | 8010 | * @param[in] gamma gamma (scikit-learn terminology) |
cactode | 59:8aa304768360 | 8011 | * @return none. |
cactode | 59:8aa304768360 | 8012 | * |
cactode | 59:8aa304768360 | 8013 | */ |
cactode | 59:8aa304768360 | 8014 | |
cactode | 59:8aa304768360 | 8015 | void arm_svm_rbf_init_f32(arm_svm_rbf_instance_f32 *S, |
cactode | 59:8aa304768360 | 8016 | uint32_t nbOfSupportVectors, |
cactode | 59:8aa304768360 | 8017 | uint32_t vectorDimension, |
cactode | 59:8aa304768360 | 8018 | float32_t intercept, |
cactode | 59:8aa304768360 | 8019 | const float32_t *dualCoefficients, |
cactode | 59:8aa304768360 | 8020 | const float32_t *supportVectors, |
cactode | 59:8aa304768360 | 8021 | const int32_t *classes, |
cactode | 59:8aa304768360 | 8022 | float32_t gamma |
cactode | 59:8aa304768360 | 8023 | ); |
cactode | 59:8aa304768360 | 8024 | |
cactode | 59:8aa304768360 | 8025 | /** |
cactode | 59:8aa304768360 | 8026 | * @brief SVM rbf prediction |
cactode | 59:8aa304768360 | 8027 | * @param[in] S Pointer to an instance of the rbf SVM structure. |
cactode | 59:8aa304768360 | 8028 | * @param[in] in Pointer to input vector |
cactode | 59:8aa304768360 | 8029 | * @param[out] pResult decision value |
cactode | 59:8aa304768360 | 8030 | * @return none. |
cactode | 59:8aa304768360 | 8031 | * |
cactode | 59:8aa304768360 | 8032 | */ |
cactode | 59:8aa304768360 | 8033 | void arm_svm_rbf_predict_f32(const arm_svm_rbf_instance_f32 *S, |
cactode | 59:8aa304768360 | 8034 | const float32_t * in, |
cactode | 59:8aa304768360 | 8035 | int32_t * pResult); |
cactode | 59:8aa304768360 | 8036 | |
cactode | 59:8aa304768360 | 8037 | /** |
cactode | 59:8aa304768360 | 8038 | * @brief SVM sigmoid instance init function |
cactode | 59:8aa304768360 | 8039 | * @param[in] S points to an instance of the rbf SVM structure. |
cactode | 59:8aa304768360 | 8040 | * @param[in] nbOfSupportVectors Number of support vectors |
cactode | 59:8aa304768360 | 8041 | * @param[in] vectorDimension Dimension of vector space |
cactode | 59:8aa304768360 | 8042 | * @param[in] intercept Intercept |
cactode | 59:8aa304768360 | 8043 | * @param[in] dualCoefficients Array of dual coefficients |
cactode | 59:8aa304768360 | 8044 | * @param[in] supportVectors Array of support vectors |
cactode | 59:8aa304768360 | 8045 | * @param[in] classes Array of 2 classes ID |
cactode | 59:8aa304768360 | 8046 | * @param[in] coef0 coeff0 (scikit-learn terminology) |
cactode | 59:8aa304768360 | 8047 | * @param[in] gamma gamma (scikit-learn terminology) |
cactode | 59:8aa304768360 | 8048 | * @return none. |
cactode | 59:8aa304768360 | 8049 | * |
cactode | 59:8aa304768360 | 8050 | */ |
cactode | 59:8aa304768360 | 8051 | |
cactode | 59:8aa304768360 | 8052 | void arm_svm_sigmoid_init_f32(arm_svm_sigmoid_instance_f32 *S, |
cactode | 59:8aa304768360 | 8053 | uint32_t nbOfSupportVectors, |
cactode | 59:8aa304768360 | 8054 | uint32_t vectorDimension, |
cactode | 59:8aa304768360 | 8055 | float32_t intercept, |
cactode | 59:8aa304768360 | 8056 | const float32_t *dualCoefficients, |
cactode | 59:8aa304768360 | 8057 | const float32_t *supportVectors, |
cactode | 59:8aa304768360 | 8058 | const int32_t *classes, |
cactode | 59:8aa304768360 | 8059 | float32_t coef0, |
cactode | 59:8aa304768360 | 8060 | float32_t gamma |
cactode | 59:8aa304768360 | 8061 | ); |
cactode | 59:8aa304768360 | 8062 | |
cactode | 59:8aa304768360 | 8063 | /** |
cactode | 59:8aa304768360 | 8064 | * @brief SVM sigmoid prediction |
cactode | 59:8aa304768360 | 8065 | * @param[in] S Pointer to an instance of the rbf SVM structure. |
cactode | 59:8aa304768360 | 8066 | * @param[in] in Pointer to input vector |
cactode | 59:8aa304768360 | 8067 | * @param[out] pResult Decision value |
cactode | 59:8aa304768360 | 8068 | * @return none. |
cactode | 59:8aa304768360 | 8069 | * |
cactode | 59:8aa304768360 | 8070 | */ |
cactode | 59:8aa304768360 | 8071 | void arm_svm_sigmoid_predict_f32(const arm_svm_sigmoid_instance_f32 *S, |
cactode | 59:8aa304768360 | 8072 | const float32_t * in, |
cactode | 59:8aa304768360 | 8073 | int32_t * pResult); |
cactode | 59:8aa304768360 | 8074 | |
cactode | 59:8aa304768360 | 8075 | |
cactode | 59:8aa304768360 | 8076 | |
cactode | 59:8aa304768360 | 8077 | /** |
cactode | 59:8aa304768360 | 8078 | * @brief Instance structure for Naive Gaussian Bayesian estimator. |
cactode | 59:8aa304768360 | 8079 | */ |
cactode | 59:8aa304768360 | 8080 | typedef struct |
cactode | 59:8aa304768360 | 8081 | { |
cactode | 59:8aa304768360 | 8082 | uint32_t vectorDimension; /**< Dimension of vector space */ |
cactode | 59:8aa304768360 | 8083 | uint32_t numberOfClasses; /**< Number of different classes */ |
cactode | 59:8aa304768360 | 8084 | const float32_t *theta; /**< Mean values for the Gaussians */ |
cactode | 59:8aa304768360 | 8085 | const float32_t *sigma; /**< Variances for the Gaussians */ |
cactode | 59:8aa304768360 | 8086 | const float32_t *classPriors; /**< Class prior probabilities */ |
cactode | 59:8aa304768360 | 8087 | float32_t epsilon; /**< Additive value to variances */ |
cactode | 59:8aa304768360 | 8088 | } arm_gaussian_naive_bayes_instance_f32; |
cactode | 59:8aa304768360 | 8089 | |
cactode | 59:8aa304768360 | 8090 | /** |
cactode | 59:8aa304768360 | 8091 | * @brief Naive Gaussian Bayesian Estimator |
cactode | 59:8aa304768360 | 8092 | * |
cactode | 59:8aa304768360 | 8093 | * @param[in] S points to a naive bayes instance structure |
cactode | 59:8aa304768360 | 8094 | * @param[in] in points to the elements of the input vector. |
cactode | 59:8aa304768360 | 8095 | * @param[in] pBuffer points to a buffer of length numberOfClasses |
cactode | 59:8aa304768360 | 8096 | * @return The predicted class |
cactode | 59:8aa304768360 | 8097 | * |
cactode | 59:8aa304768360 | 8098 | */ |
cactode | 59:8aa304768360 | 8099 | |
cactode | 59:8aa304768360 | 8100 | |
cactode | 59:8aa304768360 | 8101 | uint32_t arm_gaussian_naive_bayes_predict_f32(const arm_gaussian_naive_bayes_instance_f32 *S, |
cactode | 59:8aa304768360 | 8102 | const float32_t * in, |
cactode | 59:8aa304768360 | 8103 | float32_t *pBuffer); |
cactode | 59:8aa304768360 | 8104 | |
cactode | 59:8aa304768360 | 8105 | /** |
cactode | 59:8aa304768360 | 8106 | * @brief Computation of the LogSumExp |
cactode | 59:8aa304768360 | 8107 | * |
cactode | 59:8aa304768360 | 8108 | * In probabilistic computations, the dynamic of the probability values can be very |
cactode | 59:8aa304768360 | 8109 | * wide because they come from gaussian functions. |
cactode | 59:8aa304768360 | 8110 | * To avoid underflow and overflow issues, the values are represented by their log. |
cactode | 59:8aa304768360 | 8111 | * In this representation, multiplying the original exp values is easy : their logs are added. |
cactode | 59:8aa304768360 | 8112 | * But adding the original exp values is requiring some special handling and it is the |
cactode | 59:8aa304768360 | 8113 | * goal of the LogSumExp function. |
cactode | 59:8aa304768360 | 8114 | * |
cactode | 59:8aa304768360 | 8115 | * If the values are x1...xn, the function is computing: |
cactode | 59:8aa304768360 | 8116 | * |
cactode | 59:8aa304768360 | 8117 | * ln(exp(x1) + ... + exp(xn)) and the computation is done in such a way that |
cactode | 59:8aa304768360 | 8118 | * rounding issues are minimised. |
cactode | 59:8aa304768360 | 8119 | * |
cactode | 59:8aa304768360 | 8120 | * The max xm of the values is extracted and the function is computing: |
cactode | 59:8aa304768360 | 8121 | * xm + ln(exp(x1 - xm) + ... + exp(xn - xm)) |
cactode | 59:8aa304768360 | 8122 | * |
cactode | 59:8aa304768360 | 8123 | * @param[in] *in Pointer to an array of input values. |
cactode | 59:8aa304768360 | 8124 | * @param[in] blockSize Number of samples in the input array. |
cactode | 59:8aa304768360 | 8125 | * @return LogSumExp |
cactode | 59:8aa304768360 | 8126 | * |
cactode | 59:8aa304768360 | 8127 | */ |
cactode | 59:8aa304768360 | 8128 | |
cactode | 59:8aa304768360 | 8129 | |
cactode | 59:8aa304768360 | 8130 | float32_t arm_logsumexp_f32(const float32_t *in, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8131 | |
cactode | 59:8aa304768360 | 8132 | /** |
cactode | 59:8aa304768360 | 8133 | * @brief Dot product with log arithmetic |
cactode | 59:8aa304768360 | 8134 | * |
cactode | 59:8aa304768360 | 8135 | * Vectors are containing the log of the samples |
cactode | 59:8aa304768360 | 8136 | * |
cactode | 59:8aa304768360 | 8137 | * @param[in] pSrcA points to the first input vector |
cactode | 59:8aa304768360 | 8138 | * @param[in] pSrcB points to the second input vector |
cactode | 59:8aa304768360 | 8139 | * @param[in] blockSize number of samples in each vector |
cactode | 59:8aa304768360 | 8140 | * @param[in] pTmpBuffer temporary buffer of length blockSize |
cactode | 59:8aa304768360 | 8141 | * @return The log of the dot product . |
cactode | 59:8aa304768360 | 8142 | * |
cactode | 59:8aa304768360 | 8143 | */ |
cactode | 59:8aa304768360 | 8144 | |
cactode | 59:8aa304768360 | 8145 | |
cactode | 59:8aa304768360 | 8146 | float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA, |
cactode | 59:8aa304768360 | 8147 | const float32_t * pSrcB, |
cactode | 59:8aa304768360 | 8148 | uint32_t blockSize, |
cactode | 59:8aa304768360 | 8149 | float32_t *pTmpBuffer); |
cactode | 59:8aa304768360 | 8150 | |
cactode | 59:8aa304768360 | 8151 | /** |
cactode | 59:8aa304768360 | 8152 | * @brief Entropy |
cactode | 59:8aa304768360 | 8153 | * |
cactode | 59:8aa304768360 | 8154 | * @param[in] pSrcA Array of input values. |
cactode | 59:8aa304768360 | 8155 | * @param[in] blockSize Number of samples in the input array. |
cactode | 59:8aa304768360 | 8156 | * @return Entropy -Sum(p ln p) |
cactode | 59:8aa304768360 | 8157 | * |
cactode | 59:8aa304768360 | 8158 | */ |
cactode | 59:8aa304768360 | 8159 | |
cactode | 59:8aa304768360 | 8160 | |
cactode | 59:8aa304768360 | 8161 | float32_t arm_entropy_f32(const float32_t * pSrcA,uint32_t blockSize); |
cactode | 59:8aa304768360 | 8162 | |
cactode | 59:8aa304768360 | 8163 | |
cactode | 59:8aa304768360 | 8164 | /** |
cactode | 59:8aa304768360 | 8165 | * @brief Entropy |
cactode | 59:8aa304768360 | 8166 | * |
cactode | 59:8aa304768360 | 8167 | * @param[in] pSrcA Array of input values. |
cactode | 59:8aa304768360 | 8168 | * @param[in] blockSize Number of samples in the input array. |
cactode | 59:8aa304768360 | 8169 | * @return Entropy -Sum(p ln p) |
cactode | 59:8aa304768360 | 8170 | * |
cactode | 59:8aa304768360 | 8171 | */ |
cactode | 59:8aa304768360 | 8172 | |
cactode | 59:8aa304768360 | 8173 | |
cactode | 59:8aa304768360 | 8174 | float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8175 | |
cactode | 59:8aa304768360 | 8176 | |
cactode | 59:8aa304768360 | 8177 | /** |
cactode | 59:8aa304768360 | 8178 | * @brief Kullback-Leibler |
cactode | 59:8aa304768360 | 8179 | * |
cactode | 59:8aa304768360 | 8180 | * @param[in] pSrcA Pointer to an array of input values for probability distribution A. |
cactode | 59:8aa304768360 | 8181 | * @param[in] pSrcB Pointer to an array of input values for probability distribution B. |
cactode | 59:8aa304768360 | 8182 | * @param[in] blockSize Number of samples in the input array. |
cactode | 59:8aa304768360 | 8183 | * @return Kullback-Leibler Divergence D(A || B) |
cactode | 59:8aa304768360 | 8184 | * |
cactode | 59:8aa304768360 | 8185 | */ |
cactode | 59:8aa304768360 | 8186 | float32_t arm_kullback_leibler_f32(const float32_t * pSrcA |
cactode | 59:8aa304768360 | 8187 | ,const float32_t * pSrcB |
cactode | 59:8aa304768360 | 8188 | ,uint32_t blockSize); |
cactode | 59:8aa304768360 | 8189 | |
cactode | 59:8aa304768360 | 8190 | |
cactode | 59:8aa304768360 | 8191 | /** |
cactode | 59:8aa304768360 | 8192 | * @brief Kullback-Leibler |
cactode | 59:8aa304768360 | 8193 | * |
cactode | 59:8aa304768360 | 8194 | * @param[in] pSrcA Pointer to an array of input values for probability distribution A. |
cactode | 59:8aa304768360 | 8195 | * @param[in] pSrcB Pointer to an array of input values for probability distribution B. |
cactode | 59:8aa304768360 | 8196 | * @param[in] blockSize Number of samples in the input array. |
cactode | 59:8aa304768360 | 8197 | * @return Kullback-Leibler Divergence D(A || B) |
cactode | 59:8aa304768360 | 8198 | * |
cactode | 59:8aa304768360 | 8199 | */ |
cactode | 59:8aa304768360 | 8200 | float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, |
cactode | 59:8aa304768360 | 8201 | const float64_t * pSrcB, |
cactode | 59:8aa304768360 | 8202 | uint32_t blockSize); |
cactode | 59:8aa304768360 | 8203 | |
cactode | 59:8aa304768360 | 8204 | |
cactode | 59:8aa304768360 | 8205 | /** |
cactode | 59:8aa304768360 | 8206 | * @brief Weighted sum |
cactode | 59:8aa304768360 | 8207 | * |
cactode | 59:8aa304768360 | 8208 | * |
cactode | 59:8aa304768360 | 8209 | * @param[in] *in Array of input values. |
cactode | 59:8aa304768360 | 8210 | * @param[in] *weigths Weights |
cactode | 59:8aa304768360 | 8211 | * @param[in] blockSize Number of samples in the input array. |
cactode | 59:8aa304768360 | 8212 | * @return Weighted sum |
cactode | 59:8aa304768360 | 8213 | * |
cactode | 59:8aa304768360 | 8214 | */ |
cactode | 59:8aa304768360 | 8215 | float32_t arm_weighted_sum_f32(const float32_t *in |
cactode | 59:8aa304768360 | 8216 | , const float32_t *weigths |
cactode | 59:8aa304768360 | 8217 | , uint32_t blockSize); |
cactode | 59:8aa304768360 | 8218 | |
cactode | 59:8aa304768360 | 8219 | |
cactode | 59:8aa304768360 | 8220 | /** |
cactode | 59:8aa304768360 | 8221 | * @brief Barycenter |
cactode | 59:8aa304768360 | 8222 | * |
cactode | 59:8aa304768360 | 8223 | * |
cactode | 59:8aa304768360 | 8224 | * @param[in] in List of vectors |
cactode | 59:8aa304768360 | 8225 | * @param[in] weights Weights of the vectors |
cactode | 59:8aa304768360 | 8226 | * @param[out] out Barycenter |
cactode | 59:8aa304768360 | 8227 | * @param[in] nbVectors Number of vectors |
cactode | 59:8aa304768360 | 8228 | * @param[in] vecDim Dimension of space (vector dimension) |
cactode | 59:8aa304768360 | 8229 | * @return None |
cactode | 59:8aa304768360 | 8230 | * |
cactode | 59:8aa304768360 | 8231 | */ |
cactode | 59:8aa304768360 | 8232 | void arm_barycenter_f32(const float32_t *in |
cactode | 59:8aa304768360 | 8233 | , const float32_t *weights |
cactode | 59:8aa304768360 | 8234 | , float32_t *out |
cactode | 59:8aa304768360 | 8235 | , uint32_t nbVectors |
cactode | 59:8aa304768360 | 8236 | , uint32_t vecDim); |
cactode | 59:8aa304768360 | 8237 | |
cactode | 59:8aa304768360 | 8238 | /** |
cactode | 59:8aa304768360 | 8239 | * @brief Euclidean distance between two vectors |
cactode | 59:8aa304768360 | 8240 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8241 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8242 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8243 | * @return distance |
cactode | 59:8aa304768360 | 8244 | * |
cactode | 59:8aa304768360 | 8245 | */ |
cactode | 59:8aa304768360 | 8246 | |
cactode | 59:8aa304768360 | 8247 | float32_t arm_euclidean_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8248 | |
cactode | 59:8aa304768360 | 8249 | /** |
cactode | 59:8aa304768360 | 8250 | * @brief Bray-Curtis distance between two vectors |
cactode | 59:8aa304768360 | 8251 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8252 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8253 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8254 | * @return distance |
cactode | 59:8aa304768360 | 8255 | * |
cactode | 59:8aa304768360 | 8256 | */ |
cactode | 59:8aa304768360 | 8257 | float32_t arm_braycurtis_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8258 | |
cactode | 59:8aa304768360 | 8259 | /** |
cactode | 59:8aa304768360 | 8260 | * @brief Canberra distance between two vectors |
cactode | 59:8aa304768360 | 8261 | * |
cactode | 59:8aa304768360 | 8262 | * This function may divide by zero when samples pA[i] and pB[i] are both zero. |
cactode | 59:8aa304768360 | 8263 | * The result of the computation will be correct. So the division per zero may be |
cactode | 59:8aa304768360 | 8264 | * ignored. |
cactode | 59:8aa304768360 | 8265 | * |
cactode | 59:8aa304768360 | 8266 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8267 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8268 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8269 | * @return distance |
cactode | 59:8aa304768360 | 8270 | * |
cactode | 59:8aa304768360 | 8271 | */ |
cactode | 59:8aa304768360 | 8272 | float32_t arm_canberra_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8273 | |
cactode | 59:8aa304768360 | 8274 | |
cactode | 59:8aa304768360 | 8275 | /** |
cactode | 59:8aa304768360 | 8276 | * @brief Chebyshev distance between two vectors |
cactode | 59:8aa304768360 | 8277 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8278 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8279 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8280 | * @return distance |
cactode | 59:8aa304768360 | 8281 | * |
cactode | 59:8aa304768360 | 8282 | */ |
cactode | 59:8aa304768360 | 8283 | float32_t arm_chebyshev_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8284 | |
cactode | 59:8aa304768360 | 8285 | |
cactode | 59:8aa304768360 | 8286 | /** |
cactode | 59:8aa304768360 | 8287 | * @brief Cityblock (Manhattan) distance between two vectors |
cactode | 59:8aa304768360 | 8288 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8289 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8290 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8291 | * @return distance |
cactode | 59:8aa304768360 | 8292 | * |
cactode | 59:8aa304768360 | 8293 | */ |
cactode | 59:8aa304768360 | 8294 | float32_t arm_cityblock_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8295 | |
cactode | 59:8aa304768360 | 8296 | /** |
cactode | 59:8aa304768360 | 8297 | * @brief Correlation distance between two vectors |
cactode | 59:8aa304768360 | 8298 | * |
cactode | 59:8aa304768360 | 8299 | * The input vectors are modified in place ! |
cactode | 59:8aa304768360 | 8300 | * |
cactode | 59:8aa304768360 | 8301 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8302 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8303 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8304 | * @return distance |
cactode | 59:8aa304768360 | 8305 | * |
cactode | 59:8aa304768360 | 8306 | */ |
cactode | 59:8aa304768360 | 8307 | float32_t arm_correlation_distance_f32(float32_t *pA,float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8308 | |
cactode | 59:8aa304768360 | 8309 | /** |
cactode | 59:8aa304768360 | 8310 | * @brief Cosine distance between two vectors |
cactode | 59:8aa304768360 | 8311 | * |
cactode | 59:8aa304768360 | 8312 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8313 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8314 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8315 | * @return distance |
cactode | 59:8aa304768360 | 8316 | * |
cactode | 59:8aa304768360 | 8317 | */ |
cactode | 59:8aa304768360 | 8318 | |
cactode | 59:8aa304768360 | 8319 | float32_t arm_cosine_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8320 | |
cactode | 59:8aa304768360 | 8321 | /** |
cactode | 59:8aa304768360 | 8322 | * @brief Jensen-Shannon distance between two vectors |
cactode | 59:8aa304768360 | 8323 | * |
cactode | 59:8aa304768360 | 8324 | * This function is assuming that elements of second vector are > 0 |
cactode | 59:8aa304768360 | 8325 | * and 0 only when the corresponding element of first vector is 0. |
cactode | 59:8aa304768360 | 8326 | * Otherwise the result of the computation does not make sense |
cactode | 59:8aa304768360 | 8327 | * and for speed reasons, the cases returning NaN or Infinity are not |
cactode | 59:8aa304768360 | 8328 | * managed. |
cactode | 59:8aa304768360 | 8329 | * |
cactode | 59:8aa304768360 | 8330 | * When the function is computing x log (x / y) with x 0 and y 0, |
cactode | 59:8aa304768360 | 8331 | * it will compute the right value (0) but a division per zero will occur |
cactode | 59:8aa304768360 | 8332 | * and shoudl be ignored in client code. |
cactode | 59:8aa304768360 | 8333 | * |
cactode | 59:8aa304768360 | 8334 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8335 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8336 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8337 | * @return distance |
cactode | 59:8aa304768360 | 8338 | * |
cactode | 59:8aa304768360 | 8339 | */ |
cactode | 59:8aa304768360 | 8340 | |
cactode | 59:8aa304768360 | 8341 | float32_t arm_jensenshannon_distance_f32(const float32_t *pA,const float32_t *pB,uint32_t blockSize); |
cactode | 59:8aa304768360 | 8342 | |
cactode | 59:8aa304768360 | 8343 | /** |
cactode | 59:8aa304768360 | 8344 | * @brief Minkowski distance between two vectors |
cactode | 59:8aa304768360 | 8345 | * |
cactode | 59:8aa304768360 | 8346 | * @param[in] pA First vector |
cactode | 59:8aa304768360 | 8347 | * @param[in] pB Second vector |
cactode | 59:8aa304768360 | 8348 | * @param[in] n Norm order (>= 2) |
cactode | 59:8aa304768360 | 8349 | * @param[in] blockSize vector length |
cactode | 59:8aa304768360 | 8350 | * @return distance |
cactode | 59:8aa304768360 | 8351 | * |
cactode | 59:8aa304768360 | 8352 | */ |
cactode | 59:8aa304768360 | 8353 | |
cactode | 59:8aa304768360 | 8354 | |
cactode | 59:8aa304768360 | 8355 | |
cactode | 59:8aa304768360 | 8356 | float32_t arm_minkowski_distance_f32(const float32_t *pA,const float32_t *pB, int32_t order, uint32_t blockSize); |
cactode | 59:8aa304768360 | 8357 | |
cactode | 59:8aa304768360 | 8358 | /** |
cactode | 59:8aa304768360 | 8359 | * @brief Dice distance between two vectors |
cactode | 59:8aa304768360 | 8360 | * |
cactode | 59:8aa304768360 | 8361 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8362 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8363 | * @param[in] order Distance order |
cactode | 59:8aa304768360 | 8364 | * @param[in] blockSize Number of samples |
cactode | 59:8aa304768360 | 8365 | * @return distance |
cactode | 59:8aa304768360 | 8366 | * |
cactode | 59:8aa304768360 | 8367 | */ |
cactode | 59:8aa304768360 | 8368 | |
cactode | 59:8aa304768360 | 8369 | |
cactode | 59:8aa304768360 | 8370 | float32_t arm_dice_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8371 | |
cactode | 59:8aa304768360 | 8372 | /** |
cactode | 59:8aa304768360 | 8373 | * @brief Hamming distance between two vectors |
cactode | 59:8aa304768360 | 8374 | * |
cactode | 59:8aa304768360 | 8375 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8376 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8377 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8378 | * @return distance |
cactode | 59:8aa304768360 | 8379 | * |
cactode | 59:8aa304768360 | 8380 | */ |
cactode | 59:8aa304768360 | 8381 | |
cactode | 59:8aa304768360 | 8382 | float32_t arm_hamming_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8383 | |
cactode | 59:8aa304768360 | 8384 | /** |
cactode | 59:8aa304768360 | 8385 | * @brief Jaccard distance between two vectors |
cactode | 59:8aa304768360 | 8386 | * |
cactode | 59:8aa304768360 | 8387 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8388 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8389 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8390 | * @return distance |
cactode | 59:8aa304768360 | 8391 | * |
cactode | 59:8aa304768360 | 8392 | */ |
cactode | 59:8aa304768360 | 8393 | |
cactode | 59:8aa304768360 | 8394 | float32_t arm_jaccard_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8395 | |
cactode | 59:8aa304768360 | 8396 | /** |
cactode | 59:8aa304768360 | 8397 | * @brief Kulsinski distance between two vectors |
cactode | 59:8aa304768360 | 8398 | * |
cactode | 59:8aa304768360 | 8399 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8400 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8401 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8402 | * @return distance |
cactode | 59:8aa304768360 | 8403 | * |
cactode | 59:8aa304768360 | 8404 | */ |
cactode | 59:8aa304768360 | 8405 | |
cactode | 59:8aa304768360 | 8406 | float32_t arm_kulsinski_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8407 | |
cactode | 59:8aa304768360 | 8408 | /** |
cactode | 59:8aa304768360 | 8409 | * @brief Roger Stanimoto distance between two vectors |
cactode | 59:8aa304768360 | 8410 | * |
cactode | 59:8aa304768360 | 8411 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8412 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8413 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8414 | * @return distance |
cactode | 59:8aa304768360 | 8415 | * |
cactode | 59:8aa304768360 | 8416 | */ |
cactode | 59:8aa304768360 | 8417 | |
cactode | 59:8aa304768360 | 8418 | float32_t arm_rogerstanimoto_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8419 | |
cactode | 59:8aa304768360 | 8420 | /** |
cactode | 59:8aa304768360 | 8421 | * @brief Russell-Rao distance between two vectors |
cactode | 59:8aa304768360 | 8422 | * |
cactode | 59:8aa304768360 | 8423 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8424 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8425 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8426 | * @return distance |
cactode | 59:8aa304768360 | 8427 | * |
cactode | 59:8aa304768360 | 8428 | */ |
cactode | 59:8aa304768360 | 8429 | |
cactode | 59:8aa304768360 | 8430 | float32_t arm_russellrao_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8431 | |
cactode | 59:8aa304768360 | 8432 | /** |
cactode | 59:8aa304768360 | 8433 | * @brief Sokal-Michener distance between two vectors |
cactode | 59:8aa304768360 | 8434 | * |
cactode | 59:8aa304768360 | 8435 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8436 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8437 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8438 | * @return distance |
cactode | 59:8aa304768360 | 8439 | * |
cactode | 59:8aa304768360 | 8440 | */ |
cactode | 59:8aa304768360 | 8441 | |
cactode | 59:8aa304768360 | 8442 | float32_t arm_sokalmichener_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8443 | |
cactode | 59:8aa304768360 | 8444 | /** |
cactode | 59:8aa304768360 | 8445 | * @brief Sokal-Sneath distance between two vectors |
cactode | 59:8aa304768360 | 8446 | * |
cactode | 59:8aa304768360 | 8447 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8448 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8449 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8450 | * @return distance |
cactode | 59:8aa304768360 | 8451 | * |
cactode | 59:8aa304768360 | 8452 | */ |
cactode | 59:8aa304768360 | 8453 | |
cactode | 59:8aa304768360 | 8454 | float32_t arm_sokalsneath_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8455 | |
cactode | 59:8aa304768360 | 8456 | /** |
cactode | 59:8aa304768360 | 8457 | * @brief Yule distance between two vectors |
cactode | 59:8aa304768360 | 8458 | * |
cactode | 59:8aa304768360 | 8459 | * @param[in] pA First vector of packed booleans |
cactode | 59:8aa304768360 | 8460 | * @param[in] pB Second vector of packed booleans |
cactode | 59:8aa304768360 | 8461 | * @param[in] numberOfBools Number of booleans |
cactode | 59:8aa304768360 | 8462 | * @return distance |
cactode | 59:8aa304768360 | 8463 | * |
cactode | 59:8aa304768360 | 8464 | */ |
cactode | 59:8aa304768360 | 8465 | |
cactode | 59:8aa304768360 | 8466 | float32_t arm_yule_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); |
cactode | 59:8aa304768360 | 8467 | |
cactode | 59:8aa304768360 | 8468 | |
cactode | 59:8aa304768360 | 8469 | /** |
cactode | 59:8aa304768360 | 8470 | * @ingroup groupInterpolation |
cactode | 59:8aa304768360 | 8471 | */ |
cactode | 59:8aa304768360 | 8472 | |
cactode | 59:8aa304768360 | 8473 | /** |
cactode | 59:8aa304768360 | 8474 | * @defgroup BilinearInterpolate Bilinear Interpolation |
cactode | 59:8aa304768360 | 8475 | * |
cactode | 59:8aa304768360 | 8476 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. |
cactode | 59:8aa304768360 | 8477 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process |
cactode | 59:8aa304768360 | 8478 | * determines values between the grid points. |
cactode | 59:8aa304768360 | 8479 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. |
cactode | 59:8aa304768360 | 8480 | * Bilinear interpolation is often used in image processing to rescale images. |
cactode | 59:8aa304768360 | 8481 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. |
cactode | 59:8aa304768360 | 8482 | * |
cactode | 59:8aa304768360 | 8483 | * <b>Algorithm</b> |
cactode | 59:8aa304768360 | 8484 | * \par |
cactode | 59:8aa304768360 | 8485 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. |
cactode | 59:8aa304768360 | 8486 | * For floating-point, the instance structure is defined as: |
cactode | 59:8aa304768360 | 8487 | * <pre> |
cactode | 59:8aa304768360 | 8488 | * typedef struct |
cactode | 59:8aa304768360 | 8489 | * { |
cactode | 59:8aa304768360 | 8490 | * uint16_t numRows; |
cactode | 59:8aa304768360 | 8491 | * uint16_t numCols; |
cactode | 59:8aa304768360 | 8492 | * float32_t *pData; |
cactode | 59:8aa304768360 | 8493 | * } arm_bilinear_interp_instance_f32; |
cactode | 59:8aa304768360 | 8494 | * </pre> |
cactode | 59:8aa304768360 | 8495 | * |
cactode | 59:8aa304768360 | 8496 | * \par |
cactode | 59:8aa304768360 | 8497 | * where <code>numRows</code> specifies the number of rows in the table; |
cactode | 59:8aa304768360 | 8498 | * <code>numCols</code> specifies the number of columns in the table; |
cactode | 59:8aa304768360 | 8499 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values. |
cactode | 59:8aa304768360 | 8500 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes. |
cactode | 59:8aa304768360 | 8501 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers. |
cactode | 59:8aa304768360 | 8502 | * |
cactode | 59:8aa304768360 | 8503 | * \par |
cactode | 59:8aa304768360 | 8504 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define: |
cactode | 59:8aa304768360 | 8505 | * <pre> |
cactode | 59:8aa304768360 | 8506 | * XF = floor(x) |
cactode | 59:8aa304768360 | 8507 | * YF = floor(y) |
cactode | 59:8aa304768360 | 8508 | * </pre> |
cactode | 59:8aa304768360 | 8509 | * \par |
cactode | 59:8aa304768360 | 8510 | * The interpolated output point is computed as: |
cactode | 59:8aa304768360 | 8511 | * <pre> |
cactode | 59:8aa304768360 | 8512 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF)) |
cactode | 59:8aa304768360 | 8513 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF)) |
cactode | 59:8aa304768360 | 8514 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF) |
cactode | 59:8aa304768360 | 8515 | * + f(XF+1, YF+1) * (x-XF)*(y-YF) |
cactode | 59:8aa304768360 | 8516 | * </pre> |
cactode | 59:8aa304768360 | 8517 | * Note that the coordinates (x, y) contain integer and fractional components. |
cactode | 59:8aa304768360 | 8518 | * The integer components specify which portion of the table to use while the |
cactode | 59:8aa304768360 | 8519 | * fractional components control the interpolation processor. |
cactode | 59:8aa304768360 | 8520 | * |
cactode | 59:8aa304768360 | 8521 | * \par |
cactode | 59:8aa304768360 | 8522 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. |
cactode | 59:8aa304768360 | 8523 | */ |
cactode | 59:8aa304768360 | 8524 | |
cactode | 59:8aa304768360 | 8525 | |
cactode | 59:8aa304768360 | 8526 | /** |
cactode | 59:8aa304768360 | 8527 | * @addtogroup BilinearInterpolate |
cactode | 59:8aa304768360 | 8528 | * @{ |
cactode | 59:8aa304768360 | 8529 | */ |
cactode | 59:8aa304768360 | 8530 | |
cactode | 59:8aa304768360 | 8531 | /** |
cactode | 59:8aa304768360 | 8532 | * @brief Floating-point bilinear interpolation. |
cactode | 59:8aa304768360 | 8533 | * @param[in,out] S points to an instance of the interpolation structure. |
cactode | 59:8aa304768360 | 8534 | * @param[in] X interpolation coordinate. |
cactode | 59:8aa304768360 | 8535 | * @param[in] Y interpolation coordinate. |
cactode | 59:8aa304768360 | 8536 | * @return out interpolated value. |
cactode | 59:8aa304768360 | 8537 | */ |
cactode | 59:8aa304768360 | 8538 | __STATIC_FORCEINLINE float32_t arm_bilinear_interp_f32( |
cactode | 59:8aa304768360 | 8539 | const arm_bilinear_interp_instance_f32 * S, |
cactode | 59:8aa304768360 | 8540 | float32_t X, |
cactode | 59:8aa304768360 | 8541 | float32_t Y) |
cactode | 59:8aa304768360 | 8542 | { |
cactode | 59:8aa304768360 | 8543 | float32_t out; |
cactode | 59:8aa304768360 | 8544 | float32_t f00, f01, f10, f11; |
cactode | 59:8aa304768360 | 8545 | float32_t *pData = S->pData; |
cactode | 59:8aa304768360 | 8546 | int32_t xIndex, yIndex, index; |
cactode | 59:8aa304768360 | 8547 | float32_t xdiff, ydiff; |
cactode | 59:8aa304768360 | 8548 | float32_t b1, b2, b3, b4; |
cactode | 59:8aa304768360 | 8549 | |
cactode | 59:8aa304768360 | 8550 | xIndex = (int32_t) X; |
cactode | 59:8aa304768360 | 8551 | yIndex = (int32_t) Y; |
cactode | 59:8aa304768360 | 8552 | |
cactode | 59:8aa304768360 | 8553 | /* Care taken for table outside boundary */ |
cactode | 59:8aa304768360 | 8554 | /* Returns zero output when values are outside table boundary */ |
cactode | 59:8aa304768360 | 8555 | if (xIndex < 0 || xIndex > (S->numCols - 2) || yIndex < 0 || yIndex > (S->numRows - 2)) |
cactode | 59:8aa304768360 | 8556 | { |
cactode | 59:8aa304768360 | 8557 | return (0); |
cactode | 59:8aa304768360 | 8558 | } |
cactode | 59:8aa304768360 | 8559 | |
cactode | 59:8aa304768360 | 8560 | /* Calculation of index for two nearest points in X-direction */ |
cactode | 59:8aa304768360 | 8561 | index = (xIndex ) + (yIndex ) * S->numCols; |
cactode | 59:8aa304768360 | 8562 | |
cactode | 59:8aa304768360 | 8563 | |
cactode | 59:8aa304768360 | 8564 | /* Read two nearest points in X-direction */ |
cactode | 59:8aa304768360 | 8565 | f00 = pData[index]; |
cactode | 59:8aa304768360 | 8566 | f01 = pData[index + 1]; |
cactode | 59:8aa304768360 | 8567 | |
cactode | 59:8aa304768360 | 8568 | /* Calculation of index for two nearest points in Y-direction */ |
cactode | 59:8aa304768360 | 8569 | index = (xIndex ) + (yIndex+1) * S->numCols; |
cactode | 59:8aa304768360 | 8570 | |
cactode | 59:8aa304768360 | 8571 | |
cactode | 59:8aa304768360 | 8572 | /* Read two nearest points in Y-direction */ |
cactode | 59:8aa304768360 | 8573 | f10 = pData[index]; |
cactode | 59:8aa304768360 | 8574 | f11 = pData[index + 1]; |
cactode | 59:8aa304768360 | 8575 | |
cactode | 59:8aa304768360 | 8576 | /* Calculation of intermediate values */ |
cactode | 59:8aa304768360 | 8577 | b1 = f00; |
cactode | 59:8aa304768360 | 8578 | b2 = f01 - f00; |
cactode | 59:8aa304768360 | 8579 | b3 = f10 - f00; |
cactode | 59:8aa304768360 | 8580 | b4 = f00 - f01 - f10 + f11; |
cactode | 59:8aa304768360 | 8581 | |
cactode | 59:8aa304768360 | 8582 | /* Calculation of fractional part in X */ |
cactode | 59:8aa304768360 | 8583 | xdiff = X - xIndex; |
cactode | 59:8aa304768360 | 8584 | |
cactode | 59:8aa304768360 | 8585 | /* Calculation of fractional part in Y */ |
cactode | 59:8aa304768360 | 8586 | ydiff = Y - yIndex; |
cactode | 59:8aa304768360 | 8587 | |
cactode | 59:8aa304768360 | 8588 | /* Calculation of bi-linear interpolated output */ |
cactode | 59:8aa304768360 | 8589 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; |
cactode | 59:8aa304768360 | 8590 | |
cactode | 59:8aa304768360 | 8591 | /* return to application */ |
cactode | 59:8aa304768360 | 8592 | return (out); |
cactode | 59:8aa304768360 | 8593 | } |
cactode | 59:8aa304768360 | 8594 | |
cactode | 59:8aa304768360 | 8595 | |
cactode | 59:8aa304768360 | 8596 | /** |
cactode | 59:8aa304768360 | 8597 | * @brief Q31 bilinear interpolation. |
cactode | 59:8aa304768360 | 8598 | * @param[in,out] S points to an instance of the interpolation structure. |
cactode | 59:8aa304768360 | 8599 | * @param[in] X interpolation coordinate in 12.20 format. |
cactode | 59:8aa304768360 | 8600 | * @param[in] Y interpolation coordinate in 12.20 format. |
cactode | 59:8aa304768360 | 8601 | * @return out interpolated value. |
cactode | 59:8aa304768360 | 8602 | */ |
cactode | 59:8aa304768360 | 8603 | __STATIC_FORCEINLINE q31_t arm_bilinear_interp_q31( |
cactode | 59:8aa304768360 | 8604 | arm_bilinear_interp_instance_q31 * S, |
cactode | 59:8aa304768360 | 8605 | q31_t X, |
cactode | 59:8aa304768360 | 8606 | q31_t Y) |
cactode | 59:8aa304768360 | 8607 | { |
cactode | 59:8aa304768360 | 8608 | q31_t out; /* Temporary output */ |
cactode | 59:8aa304768360 | 8609 | q31_t acc = 0; /* output */ |
cactode | 59:8aa304768360 | 8610 | q31_t xfract, yfract; /* X, Y fractional parts */ |
cactode | 59:8aa304768360 | 8611 | q31_t x1, x2, y1, y2; /* Nearest output values */ |
cactode | 59:8aa304768360 | 8612 | int32_t rI, cI; /* Row and column indices */ |
cactode | 59:8aa304768360 | 8613 | q31_t *pYData = S->pData; /* pointer to output table values */ |
cactode | 59:8aa304768360 | 8614 | uint32_t nCols = S->numCols; /* num of rows */ |
cactode | 59:8aa304768360 | 8615 | |
cactode | 59:8aa304768360 | 8616 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 8617 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 8618 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 8619 | rI = ((X & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 8620 | |
cactode | 59:8aa304768360 | 8621 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 8622 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 8623 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 8624 | cI = ((Y & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 8625 | |
cactode | 59:8aa304768360 | 8626 | /* Care taken for table outside boundary */ |
cactode | 59:8aa304768360 | 8627 | /* Returns zero output when values are outside table boundary */ |
cactode | 59:8aa304768360 | 8628 | if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2)) |
cactode | 59:8aa304768360 | 8629 | { |
cactode | 59:8aa304768360 | 8630 | return (0); |
cactode | 59:8aa304768360 | 8631 | } |
cactode | 59:8aa304768360 | 8632 | |
cactode | 59:8aa304768360 | 8633 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 8634 | /* shift left xfract by 11 to keep 1.31 format */ |
cactode | 59:8aa304768360 | 8635 | xfract = (X & 0x000FFFFF) << 11U; |
cactode | 59:8aa304768360 | 8636 | |
cactode | 59:8aa304768360 | 8637 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 8638 | x1 = pYData[(rI) + (int32_t)nCols * (cI) ]; |
cactode | 59:8aa304768360 | 8639 | x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1]; |
cactode | 59:8aa304768360 | 8640 | |
cactode | 59:8aa304768360 | 8641 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 8642 | /* shift left yfract by 11 to keep 1.31 format */ |
cactode | 59:8aa304768360 | 8643 | yfract = (Y & 0x000FFFFF) << 11U; |
cactode | 59:8aa304768360 | 8644 | |
cactode | 59:8aa304768360 | 8645 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 8646 | y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ]; |
cactode | 59:8aa304768360 | 8647 | y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1]; |
cactode | 59:8aa304768360 | 8648 | |
cactode | 59:8aa304768360 | 8649 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ |
cactode | 59:8aa304768360 | 8650 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); |
cactode | 59:8aa304768360 | 8651 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); |
cactode | 59:8aa304768360 | 8652 | |
cactode | 59:8aa304768360 | 8653 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ |
cactode | 59:8aa304768360 | 8654 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); |
cactode | 59:8aa304768360 | 8655 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); |
cactode | 59:8aa304768360 | 8656 | |
cactode | 59:8aa304768360 | 8657 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ |
cactode | 59:8aa304768360 | 8658 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); |
cactode | 59:8aa304768360 | 8659 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
cactode | 59:8aa304768360 | 8660 | |
cactode | 59:8aa304768360 | 8661 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ |
cactode | 59:8aa304768360 | 8662 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); |
cactode | 59:8aa304768360 | 8663 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
cactode | 59:8aa304768360 | 8664 | |
cactode | 59:8aa304768360 | 8665 | /* Convert acc to 1.31(q31) format */ |
cactode | 59:8aa304768360 | 8666 | return ((q31_t)(acc << 2)); |
cactode | 59:8aa304768360 | 8667 | } |
cactode | 59:8aa304768360 | 8668 | |
cactode | 59:8aa304768360 | 8669 | |
cactode | 59:8aa304768360 | 8670 | /** |
cactode | 59:8aa304768360 | 8671 | * @brief Q15 bilinear interpolation. |
cactode | 59:8aa304768360 | 8672 | * @param[in,out] S points to an instance of the interpolation structure. |
cactode | 59:8aa304768360 | 8673 | * @param[in] X interpolation coordinate in 12.20 format. |
cactode | 59:8aa304768360 | 8674 | * @param[in] Y interpolation coordinate in 12.20 format. |
cactode | 59:8aa304768360 | 8675 | * @return out interpolated value. |
cactode | 59:8aa304768360 | 8676 | */ |
cactode | 59:8aa304768360 | 8677 | __STATIC_FORCEINLINE q15_t arm_bilinear_interp_q15( |
cactode | 59:8aa304768360 | 8678 | arm_bilinear_interp_instance_q15 * S, |
cactode | 59:8aa304768360 | 8679 | q31_t X, |
cactode | 59:8aa304768360 | 8680 | q31_t Y) |
cactode | 59:8aa304768360 | 8681 | { |
cactode | 59:8aa304768360 | 8682 | q63_t acc = 0; /* output */ |
cactode | 59:8aa304768360 | 8683 | q31_t out; /* Temporary output */ |
cactode | 59:8aa304768360 | 8684 | q15_t x1, x2, y1, y2; /* Nearest output values */ |
cactode | 59:8aa304768360 | 8685 | q31_t xfract, yfract; /* X, Y fractional parts */ |
cactode | 59:8aa304768360 | 8686 | int32_t rI, cI; /* Row and column indices */ |
cactode | 59:8aa304768360 | 8687 | q15_t *pYData = S->pData; /* pointer to output table values */ |
cactode | 59:8aa304768360 | 8688 | uint32_t nCols = S->numCols; /* num of rows */ |
cactode | 59:8aa304768360 | 8689 | |
cactode | 59:8aa304768360 | 8690 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 8691 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 8692 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 8693 | rI = ((X & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 8694 | |
cactode | 59:8aa304768360 | 8695 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 8696 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 8697 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 8698 | cI = ((Y & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 8699 | |
cactode | 59:8aa304768360 | 8700 | /* Care taken for table outside boundary */ |
cactode | 59:8aa304768360 | 8701 | /* Returns zero output when values are outside table boundary */ |
cactode | 59:8aa304768360 | 8702 | if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2)) |
cactode | 59:8aa304768360 | 8703 | { |
cactode | 59:8aa304768360 | 8704 | return (0); |
cactode | 59:8aa304768360 | 8705 | } |
cactode | 59:8aa304768360 | 8706 | |
cactode | 59:8aa304768360 | 8707 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 8708 | /* xfract should be in 12.20 format */ |
cactode | 59:8aa304768360 | 8709 | xfract = (X & 0x000FFFFF); |
cactode | 59:8aa304768360 | 8710 | |
cactode | 59:8aa304768360 | 8711 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 8712 | x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; |
cactode | 59:8aa304768360 | 8713 | x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; |
cactode | 59:8aa304768360 | 8714 | |
cactode | 59:8aa304768360 | 8715 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 8716 | /* yfract should be in 12.20 format */ |
cactode | 59:8aa304768360 | 8717 | yfract = (Y & 0x000FFFFF); |
cactode | 59:8aa304768360 | 8718 | |
cactode | 59:8aa304768360 | 8719 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 8720 | y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; |
cactode | 59:8aa304768360 | 8721 | y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; |
cactode | 59:8aa304768360 | 8722 | |
cactode | 59:8aa304768360 | 8723 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ |
cactode | 59:8aa304768360 | 8724 | |
cactode | 59:8aa304768360 | 8725 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ |
cactode | 59:8aa304768360 | 8726 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ |
cactode | 59:8aa304768360 | 8727 | out = (q31_t) (((q63_t) x1 * (0x0FFFFF - xfract)) >> 4U); |
cactode | 59:8aa304768360 | 8728 | acc = ((q63_t) out * (0x0FFFFF - yfract)); |
cactode | 59:8aa304768360 | 8729 | |
cactode | 59:8aa304768360 | 8730 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ |
cactode | 59:8aa304768360 | 8731 | out = (q31_t) (((q63_t) x2 * (0x0FFFFF - yfract)) >> 4U); |
cactode | 59:8aa304768360 | 8732 | acc += ((q63_t) out * (xfract)); |
cactode | 59:8aa304768360 | 8733 | |
cactode | 59:8aa304768360 | 8734 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ |
cactode | 59:8aa304768360 | 8735 | out = (q31_t) (((q63_t) y1 * (0x0FFFFF - xfract)) >> 4U); |
cactode | 59:8aa304768360 | 8736 | acc += ((q63_t) out * (yfract)); |
cactode | 59:8aa304768360 | 8737 | |
cactode | 59:8aa304768360 | 8738 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ |
cactode | 59:8aa304768360 | 8739 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U); |
cactode | 59:8aa304768360 | 8740 | acc += ((q63_t) out * (yfract)); |
cactode | 59:8aa304768360 | 8741 | |
cactode | 59:8aa304768360 | 8742 | /* acc is in 13.51 format and down shift acc by 36 times */ |
cactode | 59:8aa304768360 | 8743 | /* Convert out to 1.15 format */ |
cactode | 59:8aa304768360 | 8744 | return ((q15_t)(acc >> 36)); |
cactode | 59:8aa304768360 | 8745 | } |
cactode | 59:8aa304768360 | 8746 | |
cactode | 59:8aa304768360 | 8747 | |
cactode | 59:8aa304768360 | 8748 | /** |
cactode | 59:8aa304768360 | 8749 | * @brief Q7 bilinear interpolation. |
cactode | 59:8aa304768360 | 8750 | * @param[in,out] S points to an instance of the interpolation structure. |
cactode | 59:8aa304768360 | 8751 | * @param[in] X interpolation coordinate in 12.20 format. |
cactode | 59:8aa304768360 | 8752 | * @param[in] Y interpolation coordinate in 12.20 format. |
cactode | 59:8aa304768360 | 8753 | * @return out interpolated value. |
cactode | 59:8aa304768360 | 8754 | */ |
cactode | 59:8aa304768360 | 8755 | __STATIC_FORCEINLINE q7_t arm_bilinear_interp_q7( |
cactode | 59:8aa304768360 | 8756 | arm_bilinear_interp_instance_q7 * S, |
cactode | 59:8aa304768360 | 8757 | q31_t X, |
cactode | 59:8aa304768360 | 8758 | q31_t Y) |
cactode | 59:8aa304768360 | 8759 | { |
cactode | 59:8aa304768360 | 8760 | q63_t acc = 0; /* output */ |
cactode | 59:8aa304768360 | 8761 | q31_t out; /* Temporary output */ |
cactode | 59:8aa304768360 | 8762 | q31_t xfract, yfract; /* X, Y fractional parts */ |
cactode | 59:8aa304768360 | 8763 | q7_t x1, x2, y1, y2; /* Nearest output values */ |
cactode | 59:8aa304768360 | 8764 | int32_t rI, cI; /* Row and column indices */ |
cactode | 59:8aa304768360 | 8765 | q7_t *pYData = S->pData; /* pointer to output table values */ |
cactode | 59:8aa304768360 | 8766 | uint32_t nCols = S->numCols; /* num of rows */ |
cactode | 59:8aa304768360 | 8767 | |
cactode | 59:8aa304768360 | 8768 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 8769 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 8770 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 8771 | rI = ((X & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 8772 | |
cactode | 59:8aa304768360 | 8773 | /* Input is in 12.20 format */ |
cactode | 59:8aa304768360 | 8774 | /* 12 bits for the table index */ |
cactode | 59:8aa304768360 | 8775 | /* Index value calculation */ |
cactode | 59:8aa304768360 | 8776 | cI = ((Y & (q31_t)0xFFF00000) >> 20); |
cactode | 59:8aa304768360 | 8777 | |
cactode | 59:8aa304768360 | 8778 | /* Care taken for table outside boundary */ |
cactode | 59:8aa304768360 | 8779 | /* Returns zero output when values are outside table boundary */ |
cactode | 59:8aa304768360 | 8780 | if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2)) |
cactode | 59:8aa304768360 | 8781 | { |
cactode | 59:8aa304768360 | 8782 | return (0); |
cactode | 59:8aa304768360 | 8783 | } |
cactode | 59:8aa304768360 | 8784 | |
cactode | 59:8aa304768360 | 8785 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 8786 | /* xfract should be in 12.20 format */ |
cactode | 59:8aa304768360 | 8787 | xfract = (X & (q31_t)0x000FFFFF); |
cactode | 59:8aa304768360 | 8788 | |
cactode | 59:8aa304768360 | 8789 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 8790 | x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; |
cactode | 59:8aa304768360 | 8791 | x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; |
cactode | 59:8aa304768360 | 8792 | |
cactode | 59:8aa304768360 | 8793 | /* 20 bits for the fractional part */ |
cactode | 59:8aa304768360 | 8794 | /* yfract should be in 12.20 format */ |
cactode | 59:8aa304768360 | 8795 | yfract = (Y & (q31_t)0x000FFFFF); |
cactode | 59:8aa304768360 | 8796 | |
cactode | 59:8aa304768360 | 8797 | /* Read two nearest output values from the index */ |
cactode | 59:8aa304768360 | 8798 | y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; |
cactode | 59:8aa304768360 | 8799 | y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; |
cactode | 59:8aa304768360 | 8800 | |
cactode | 59:8aa304768360 | 8801 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ |
cactode | 59:8aa304768360 | 8802 | out = ((x1 * (0xFFFFF - xfract))); |
cactode | 59:8aa304768360 | 8803 | acc = (((q63_t) out * (0xFFFFF - yfract))); |
cactode | 59:8aa304768360 | 8804 | |
cactode | 59:8aa304768360 | 8805 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ |
cactode | 59:8aa304768360 | 8806 | out = ((x2 * (0xFFFFF - yfract))); |
cactode | 59:8aa304768360 | 8807 | acc += (((q63_t) out * (xfract))); |
cactode | 59:8aa304768360 | 8808 | |
cactode | 59:8aa304768360 | 8809 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ |
cactode | 59:8aa304768360 | 8810 | out = ((y1 * (0xFFFFF - xfract))); |
cactode | 59:8aa304768360 | 8811 | acc += (((q63_t) out * (yfract))); |
cactode | 59:8aa304768360 | 8812 | |
cactode | 59:8aa304768360 | 8813 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ |
cactode | 59:8aa304768360 | 8814 | out = ((y2 * (yfract))); |
cactode | 59:8aa304768360 | 8815 | acc += (((q63_t) out * (xfract))); |
cactode | 59:8aa304768360 | 8816 | |
cactode | 59:8aa304768360 | 8817 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ |
cactode | 59:8aa304768360 | 8818 | return ((q7_t)(acc >> 40)); |
cactode | 59:8aa304768360 | 8819 | } |
cactode | 59:8aa304768360 | 8820 | |
cactode | 59:8aa304768360 | 8821 | /** |
cactode | 59:8aa304768360 | 8822 | * @} end of BilinearInterpolate group |
cactode | 59:8aa304768360 | 8823 | */ |
cactode | 59:8aa304768360 | 8824 | |
cactode | 59:8aa304768360 | 8825 | |
cactode | 59:8aa304768360 | 8826 | /* SMMLAR */ |
cactode | 59:8aa304768360 | 8827 | #define multAcc_32x32_keep32_R(a, x, y) \ |
cactode | 59:8aa304768360 | 8828 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) |
cactode | 59:8aa304768360 | 8829 | |
cactode | 59:8aa304768360 | 8830 | /* SMMLSR */ |
cactode | 59:8aa304768360 | 8831 | #define multSub_32x32_keep32_R(a, x, y) \ |
cactode | 59:8aa304768360 | 8832 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) |
cactode | 59:8aa304768360 | 8833 | |
cactode | 59:8aa304768360 | 8834 | /* SMMULR */ |
cactode | 59:8aa304768360 | 8835 | #define mult_32x32_keep32_R(a, x, y) \ |
cactode | 59:8aa304768360 | 8836 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) |
cactode | 59:8aa304768360 | 8837 | |
cactode | 59:8aa304768360 | 8838 | /* SMMLA */ |
cactode | 59:8aa304768360 | 8839 | #define multAcc_32x32_keep32(a, x, y) \ |
cactode | 59:8aa304768360 | 8840 | a += (q31_t) (((q63_t) x * y) >> 32) |
cactode | 59:8aa304768360 | 8841 | |
cactode | 59:8aa304768360 | 8842 | /* SMMLS */ |
cactode | 59:8aa304768360 | 8843 | #define multSub_32x32_keep32(a, x, y) \ |
cactode | 59:8aa304768360 | 8844 | a -= (q31_t) (((q63_t) x * y) >> 32) |
cactode | 59:8aa304768360 | 8845 | |
cactode | 59:8aa304768360 | 8846 | /* SMMUL */ |
cactode | 59:8aa304768360 | 8847 | #define mult_32x32_keep32(a, x, y) \ |
cactode | 59:8aa304768360 | 8848 | a = (q31_t) (((q63_t) x * y ) >> 32) |
cactode | 59:8aa304768360 | 8849 | |
cactode | 59:8aa304768360 | 8850 | |
cactode | 59:8aa304768360 | 8851 | #if defined ( __CC_ARM ) |
cactode | 59:8aa304768360 | 8852 | /* Enter low optimization region - place directly above function definition */ |
cactode | 59:8aa304768360 | 8853 | #if defined( __ARM_ARCH_7EM__ ) |
cactode | 59:8aa304768360 | 8854 | #define LOW_OPTIMIZATION_ENTER \ |
cactode | 59:8aa304768360 | 8855 | _Pragma ("push") \ |
cactode | 59:8aa304768360 | 8856 | _Pragma ("O1") |
cactode | 59:8aa304768360 | 8857 | #else |
cactode | 59:8aa304768360 | 8858 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8859 | #endif |
cactode | 59:8aa304768360 | 8860 | |
cactode | 59:8aa304768360 | 8861 | /* Exit low optimization region - place directly after end of function definition */ |
cactode | 59:8aa304768360 | 8862 | #if defined ( __ARM_ARCH_7EM__ ) |
cactode | 59:8aa304768360 | 8863 | #define LOW_OPTIMIZATION_EXIT \ |
cactode | 59:8aa304768360 | 8864 | _Pragma ("pop") |
cactode | 59:8aa304768360 | 8865 | #else |
cactode | 59:8aa304768360 | 8866 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8867 | #endif |
cactode | 59:8aa304768360 | 8868 | |
cactode | 59:8aa304768360 | 8869 | /* Enter low optimization region - place directly above function definition */ |
cactode | 59:8aa304768360 | 8870 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8871 | |
cactode | 59:8aa304768360 | 8872 | /* Exit low optimization region - place directly after end of function definition */ |
cactode | 59:8aa304768360 | 8873 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8874 | |
cactode | 59:8aa304768360 | 8875 | #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) |
cactode | 59:8aa304768360 | 8876 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8877 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8878 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8879 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8880 | |
cactode | 59:8aa304768360 | 8881 | #elif defined ( __GNUC__ ) |
cactode | 59:8aa304768360 | 8882 | #define LOW_OPTIMIZATION_ENTER \ |
cactode | 59:8aa304768360 | 8883 | __attribute__(( optimize("-O1") )) |
cactode | 59:8aa304768360 | 8884 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8885 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8886 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8887 | |
cactode | 59:8aa304768360 | 8888 | #elif defined ( __ICCARM__ ) |
cactode | 59:8aa304768360 | 8889 | /* Enter low optimization region - place directly above function definition */ |
cactode | 59:8aa304768360 | 8890 | #if defined ( __ARM_ARCH_7EM__ ) |
cactode | 59:8aa304768360 | 8891 | #define LOW_OPTIMIZATION_ENTER \ |
cactode | 59:8aa304768360 | 8892 | _Pragma ("optimize=low") |
cactode | 59:8aa304768360 | 8893 | #else |
cactode | 59:8aa304768360 | 8894 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8895 | #endif |
cactode | 59:8aa304768360 | 8896 | |
cactode | 59:8aa304768360 | 8897 | /* Exit low optimization region - place directly after end of function definition */ |
cactode | 59:8aa304768360 | 8898 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8899 | |
cactode | 59:8aa304768360 | 8900 | /* Enter low optimization region - place directly above function definition */ |
cactode | 59:8aa304768360 | 8901 | #if defined ( __ARM_ARCH_7EM__ ) |
cactode | 59:8aa304768360 | 8902 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ |
cactode | 59:8aa304768360 | 8903 | _Pragma ("optimize=low") |
cactode | 59:8aa304768360 | 8904 | #else |
cactode | 59:8aa304768360 | 8905 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8906 | #endif |
cactode | 59:8aa304768360 | 8907 | |
cactode | 59:8aa304768360 | 8908 | /* Exit low optimization region - place directly after end of function definition */ |
cactode | 59:8aa304768360 | 8909 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8910 | |
cactode | 59:8aa304768360 | 8911 | #elif defined ( __TI_ARM__ ) |
cactode | 59:8aa304768360 | 8912 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8913 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8914 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8915 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8916 | |
cactode | 59:8aa304768360 | 8917 | #elif defined ( __CSMC__ ) |
cactode | 59:8aa304768360 | 8918 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8919 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8920 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8921 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8922 | |
cactode | 59:8aa304768360 | 8923 | #elif defined ( __TASKING__ ) |
cactode | 59:8aa304768360 | 8924 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8925 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8926 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8927 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8928 | |
cactode | 59:8aa304768360 | 8929 | #elif defined ( _MSC_VER ) || defined(__GNUC_PYTHON__) |
cactode | 59:8aa304768360 | 8930 | #define LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8931 | #define LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8932 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
cactode | 59:8aa304768360 | 8933 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
cactode | 59:8aa304768360 | 8934 | #endif |
cactode | 59:8aa304768360 | 8935 | |
cactode | 59:8aa304768360 | 8936 | |
cactode | 59:8aa304768360 | 8937 | |
cactode | 59:8aa304768360 | 8938 | /* Compiler specific diagnostic adjustment */ |
cactode | 59:8aa304768360 | 8939 | #if defined ( __CC_ARM ) |
cactode | 59:8aa304768360 | 8940 | |
cactode | 59:8aa304768360 | 8941 | #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) |
cactode | 59:8aa304768360 | 8942 | |
cactode | 59:8aa304768360 | 8943 | #elif defined ( __GNUC__ ) |
cactode | 59:8aa304768360 | 8944 | #pragma GCC diagnostic pop |
cactode | 59:8aa304768360 | 8945 | |
cactode | 59:8aa304768360 | 8946 | #elif defined ( __ICCARM__ ) |
cactode | 59:8aa304768360 | 8947 | |
cactode | 59:8aa304768360 | 8948 | #elif defined ( __TI_ARM__ ) |
cactode | 59:8aa304768360 | 8949 | |
cactode | 59:8aa304768360 | 8950 | #elif defined ( __CSMC__ ) |
cactode | 59:8aa304768360 | 8951 | |
cactode | 59:8aa304768360 | 8952 | #elif defined ( __TASKING__ ) |
cactode | 59:8aa304768360 | 8953 | |
cactode | 59:8aa304768360 | 8954 | #elif defined ( _MSC_VER ) |
cactode | 59:8aa304768360 | 8955 | |
cactode | 59:8aa304768360 | 8956 | #else |
cactode | 59:8aa304768360 | 8957 | #error Unknown compiler |
cactode | 59:8aa304768360 | 8958 | #endif |
cactode | 59:8aa304768360 | 8959 | |
cactode | 59:8aa304768360 | 8960 | #ifdef __cplusplus |
cactode | 59:8aa304768360 | 8961 | } |
cactode | 59:8aa304768360 | 8962 | #endif |
cactode | 59:8aa304768360 | 8963 | |
cactode | 59:8aa304768360 | 8964 | |
cactode | 59:8aa304768360 | 8965 | #endif /* _ARM_MATH_H */ |
cactode | 59:8aa304768360 | 8966 | |
cactode | 59:8aa304768360 | 8967 | /** |
cactode | 59:8aa304768360 | 8968 | * |
cactode | 59:8aa304768360 | 8969 | * End of file. |
cactode | 59:8aa304768360 | 8970 | */ |