mbed-os

Fork of mbed-os by erkin yucel

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

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