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:
Thu Jul 06 15:30:22 2017 +0100
Revision:
146:22da6e220af6
Child:
160:5571c4ff569f
Release 146 of the mbed library.

Who changed what in which revision?

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