mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Committer:
dkato
Date:
Fri Feb 02 05:42:23 2018 +0000
Revision:
0:f782d9c66c49
mbed-os for GR-LYCHEE

Who changed what in which revision?

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