The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Fri Feb 16 16:16:41 2018 +0000
Revision:
161:aa5281ff4a02
mbed library. Release version 159.

Who changed what in which revision?

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