mbed library sources. Supersedes mbed-src.

Dependents:   SPIne CH_Communicatuin_Test CH_Communicatuin_Test2 MCP_SPIne ... more

Fork of mbed-dev-f303 by Ben Katz

Committer:
AnnaBridge
Date:
Wed Jun 21 17:46:44 2017 +0100
Revision:
167:e84263d55307
Parent:
149:156823d33999
This updates the lib to the mbed lib v 145

Who changed what in which revision?

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