ads1115 only

Fork of mbed by mbed official

Committer:
kaoshen
Date:
Tue Jan 17 23:27:32 2017 +0000
Revision:
135:fce8a9387ed1
Parent:
126:abea610beb85
333 ADS1115 ADC1

Who changed what in which revision?

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