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:
mbed_official
Date:
Thu Dec 21 18:20:02 2017 +0000
Revision:
159:7130f322cb7e
mbed library version 157

Who changed what in which revision?

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