Home Alert System

Dependencies:   PWM_Tone_Library DHT

Committer:
aziz111
Date:
Fri Mar 08 17:15:02 2019 +0000
Revision:
5:569a4894abc1
Parent:
3:78f223d34f36
Final

Who changed what in which revision?

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