The CMSIS DSP 5 library

Dependents:   Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more

Committer:
xorjoep
Date:
Wed Jun 20 11:21:31 2018 +0000
Revision:
1:24714b45cd1b
The newest version of the CMSIS library

Who changed what in which revision?

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