,,

Fork of Application by Daniel Sygut

Committer:
Zaitsev
Date:
Tue Jan 10 20:42:26 2017 +0000
Revision:
10:41552d038a69
USB Serial bi-directional bridge

Who changed what in which revision?

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