CMSIS DSP library

Dependents:   performance_timer Surfboard_ gps2rtty Capstone ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Committer:
mbed_official
Date:
Fri Nov 20 08:45:18 2015 +0000
Revision:
5:3762170b6d4d
Parent:
3:7a284390b0ce
Synchronized with git revision 2eb940b9a73af188d3004a2575fdfbb05febe62b

Full URL: https://github.com/mbedmicro/mbed/commit/2eb940b9a73af188d3004a2575fdfbb05febe62b/

Added option to build rpc library. closes #1426

Who changed what in which revision?

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