Pinned to some recent date

Committer:
Simon Cooksey
Date:
Thu Nov 17 16:43:53 2016 +0000
Revision:
0:fb7af294d5d9
Initial commit

Who changed what in which revision?

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