TUKS MCU Introductory course / TUKS-COURSE-2-LED
Committer:
elmot
Date:
Sat Feb 25 08:59:21 2017 +0000
Revision:
6:0018763974d3
Parent:
1:d0dfbce63a89
No comment

Who changed what in which revision?

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