Elijah Stanger-Jones / mbed-dev-f303
Committer:
elijahsj
Date:
Mon Nov 09 00:02:47 2020 -0500
Revision:
1:8a094db1347f
test

Who changed what in which revision?

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