The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Anna Bridge
Date:
Fri Jun 22 15:38:59 2018 +0100
Revision:
169:a7c7b631e539
Parent:
160:5571c4ff569f
mbed library. Release version 162

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 160:5571c4ff569f 1 /* ----------------------------------------------------------------------
Anna Bridge 160:5571c4ff569f 2 * Project: CMSIS DSP Library
Anna Bridge 160:5571c4ff569f 3 * Title: arm_math.h
Anna Bridge 160:5571c4ff569f 4 * Description: Public header file for CMSIS DSP Library
Anna Bridge 160:5571c4ff569f 5 *
Anna Bridge 160:5571c4ff569f 6 * $Date: 27. January 2017
Anna Bridge 160:5571c4ff569f 7 * $Revision: V.1.5.1
Anna Bridge 160:5571c4ff569f 8 *
Anna Bridge 160:5571c4ff569f 9 * Target Processor: Cortex-M cores
Anna Bridge 160:5571c4ff569f 10 * -------------------------------------------------------------------- */
Anna Bridge 160:5571c4ff569f 11 /*
Anna Bridge 160:5571c4ff569f 12 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
Anna Bridge 160:5571c4ff569f 13 *
Anna Bridge 160:5571c4ff569f 14 * SPDX-License-Identifier: Apache-2.0
Anna Bridge 160:5571c4ff569f 15 *
Anna Bridge 160:5571c4ff569f 16 * Licensed under the Apache License, Version 2.0 (the License); you may
Anna Bridge 160:5571c4ff569f 17 * not use this file except in compliance with the License.
Anna Bridge 160:5571c4ff569f 18 * You may obtain a copy of the License at
Anna Bridge 160:5571c4ff569f 19 *
Anna Bridge 160:5571c4ff569f 20 * www.apache.org/licenses/LICENSE-2.0
Anna Bridge 160:5571c4ff569f 21 *
Anna Bridge 160:5571c4ff569f 22 * Unless required by applicable law or agreed to in writing, software
Anna Bridge 160:5571c4ff569f 23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
Anna Bridge 160:5571c4ff569f 24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Anna Bridge 160:5571c4ff569f 25 * See the License for the specific language governing permissions and
Anna Bridge 160:5571c4ff569f 26 * limitations under the License.
Anna Bridge 160:5571c4ff569f 27 */
Anna Bridge 160:5571c4ff569f 28
Anna Bridge 160:5571c4ff569f 29 /**
Anna Bridge 160:5571c4ff569f 30 \mainpage CMSIS DSP Software Library
Anna Bridge 160:5571c4ff569f 31 *
Anna Bridge 160:5571c4ff569f 32 * Introduction
Anna Bridge 160:5571c4ff569f 33 * ------------
Anna Bridge 160:5571c4ff569f 34 *
Anna Bridge 160:5571c4ff569f 35 * This user manual describes the CMSIS DSP software library,
Anna Bridge 160:5571c4ff569f 36 * a suite of common signal processing functions for use on Cortex-M processor based devices.
Anna Bridge 160:5571c4ff569f 37 *
Anna Bridge 160:5571c4ff569f 38 * The library is divided into a number of functions each covering a specific category:
Anna Bridge 160:5571c4ff569f 39 * - Basic math functions
Anna Bridge 160:5571c4ff569f 40 * - Fast math functions
Anna Bridge 160:5571c4ff569f 41 * - Complex math functions
Anna Bridge 160:5571c4ff569f 42 * - Filters
Anna Bridge 160:5571c4ff569f 43 * - Matrix functions
Anna Bridge 160:5571c4ff569f 44 * - Transforms
Anna Bridge 160:5571c4ff569f 45 * - Motor control functions
Anna Bridge 160:5571c4ff569f 46 * - Statistical functions
Anna Bridge 160:5571c4ff569f 47 * - Support functions
Anna Bridge 160:5571c4ff569f 48 * - Interpolation functions
Anna Bridge 160:5571c4ff569f 49 *
Anna Bridge 160:5571c4ff569f 50 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
Anna Bridge 160:5571c4ff569f 51 * 32-bit integer and 32-bit floating-point values.
Anna Bridge 160:5571c4ff569f 52 *
Anna Bridge 160:5571c4ff569f 53 * Using the Library
Anna Bridge 160:5571c4ff569f 54 * ------------
Anna Bridge 160:5571c4ff569f 55 *
Anna Bridge 160:5571c4ff569f 56 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
Anna Bridge 160:5571c4ff569f 57 * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
Anna Bridge 160:5571c4ff569f 58 * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
Anna Bridge 160:5571c4ff569f 59 * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
Anna Bridge 160:5571c4ff569f 60 * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
Anna Bridge 160:5571c4ff569f 61 * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
Anna Bridge 160:5571c4ff569f 62 * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
Anna Bridge 160:5571c4ff569f 63 * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
Anna Bridge 160:5571c4ff569f 64 * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
Anna Bridge 160:5571c4ff569f 65 * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
Anna Bridge 160:5571c4ff569f 66 * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
Anna Bridge 160:5571c4ff569f 67 * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
Anna Bridge 160:5571c4ff569f 68 * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
Anna Bridge 160:5571c4ff569f 69 * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
Anna Bridge 160:5571c4ff569f 70 * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
Anna Bridge 160:5571c4ff569f 71 * - arm_ARMv8MBLl_math.lib (ARMv8M Baseline, Little endian)
Anna Bridge 160:5571c4ff569f 72 * - arm_ARMv8MMLl_math.lib (ARMv8M Mainline, Little endian)
Anna Bridge 160:5571c4ff569f 73 * - arm_ARMv8MMLlfsp_math.lib (ARMv8M Mainline, Little endian, Single Precision Floating Point Unit)
Anna Bridge 160:5571c4ff569f 74 * - arm_ARMv8MMLld_math.lib (ARMv8M Mainline, Little endian, DSP instructions)
Anna Bridge 160:5571c4ff569f 75 * - arm_ARMv8MMLldfsp_math.lib (ARMv8M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
Anna Bridge 160:5571c4ff569f 76 *
Anna Bridge 160:5571c4ff569f 77 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
Anna Bridge 160:5571c4ff569f 78 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
Anna Bridge 160:5571c4ff569f 79 * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
Anna Bridge 160:5571c4ff569f 80 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
Anna Bridge 160:5571c4ff569f 81 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
Anna Bridge 160:5571c4ff569f 82 * For ARMv8M cores define pre processor MACRO ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML.
Anna Bridge 160:5571c4ff569f 83 * Set Pre processor MACRO __DSP_PRESENT if ARMv8M Mainline core supports DSP instructions.
Anna Bridge 160:5571c4ff569f 84 *
Anna Bridge 160:5571c4ff569f 85 *
Anna Bridge 160:5571c4ff569f 86 * Examples
Anna Bridge 160:5571c4ff569f 87 * --------
Anna Bridge 160:5571c4ff569f 88 *
Anna Bridge 160:5571c4ff569f 89 * The library ships with a number of examples which demonstrate how to use the library functions.
Anna Bridge 160:5571c4ff569f 90 *
Anna Bridge 160:5571c4ff569f 91 * Toolchain Support
Anna Bridge 160:5571c4ff569f 92 * ------------
Anna Bridge 160:5571c4ff569f 93 *
Anna Bridge 160:5571c4ff569f 94 * The library has been developed and tested with MDK-ARM version 5.14.0.0
Anna Bridge 160:5571c4ff569f 95 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
Anna Bridge 160:5571c4ff569f 96 *
Anna Bridge 160:5571c4ff569f 97 * Building the Library
Anna Bridge 160:5571c4ff569f 98 * ------------
Anna Bridge 160:5571c4ff569f 99 *
Anna Bridge 160:5571c4ff569f 100 * 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.
Anna Bridge 160:5571c4ff569f 101 * - arm_cortexM_math.uvprojx
Anna Bridge 160:5571c4ff569f 102 *
Anna Bridge 160:5571c4ff569f 103 *
Anna Bridge 160:5571c4ff569f 104 * 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.
Anna Bridge 160:5571c4ff569f 105 *
Anna Bridge 160:5571c4ff569f 106 * Pre-processor Macros
Anna Bridge 160:5571c4ff569f 107 * ------------
Anna Bridge 160:5571c4ff569f 108 *
Anna Bridge 160:5571c4ff569f 109 * Each library project have differant pre-processor macros.
Anna Bridge 160:5571c4ff569f 110 *
Anna Bridge 160:5571c4ff569f 111 * - UNALIGNED_SUPPORT_DISABLE:
Anna Bridge 160:5571c4ff569f 112 *
Anna Bridge 160:5571c4ff569f 113 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
Anna Bridge 160:5571c4ff569f 114 *
Anna Bridge 160:5571c4ff569f 115 * - ARM_MATH_BIG_ENDIAN:
Anna Bridge 160:5571c4ff569f 116 *
Anna Bridge 160:5571c4ff569f 117 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
Anna Bridge 160:5571c4ff569f 118 *
Anna Bridge 160:5571c4ff569f 119 * - ARM_MATH_MATRIX_CHECK:
Anna Bridge 160:5571c4ff569f 120 *
Anna Bridge 160:5571c4ff569f 121 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
Anna Bridge 160:5571c4ff569f 122 *
Anna Bridge 160:5571c4ff569f 123 * - ARM_MATH_ROUNDING:
Anna Bridge 160:5571c4ff569f 124 *
Anna Bridge 160:5571c4ff569f 125 * Define macro ARM_MATH_ROUNDING for rounding on support functions
Anna Bridge 160:5571c4ff569f 126 *
Anna Bridge 160:5571c4ff569f 127 * - ARM_MATH_CMx:
Anna Bridge 160:5571c4ff569f 128 *
Anna Bridge 160:5571c4ff569f 129 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
Anna Bridge 160:5571c4ff569f 130 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
Anna Bridge 160:5571c4ff569f 131 * ARM_MATH_CM7 for building the library on cortex-M7.
Anna Bridge 160:5571c4ff569f 132 *
Anna Bridge 160:5571c4ff569f 133 * - ARM_MATH_ARMV8MxL:
Anna Bridge 160:5571c4ff569f 134 *
Anna Bridge 160:5571c4ff569f 135 * Define macro ARM_MATH_ARMV8MBL for building the library on ARMv8M Baseline target, ARM_MATH_ARMV8MBL for building library
Anna Bridge 160:5571c4ff569f 136 * on ARMv8M Mainline target.
Anna Bridge 160:5571c4ff569f 137 *
Anna Bridge 160:5571c4ff569f 138 * - __FPU_PRESENT:
Anna Bridge 160:5571c4ff569f 139 *
Anna Bridge 160:5571c4ff569f 140 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries.
Anna Bridge 160:5571c4ff569f 141 *
Anna Bridge 160:5571c4ff569f 142 * - __DSP_PRESENT:
Anna Bridge 160:5571c4ff569f 143 *
Anna Bridge 160:5571c4ff569f 144 * Initialize macro __DSP_PRESENT = 1 when ARMv8M Mainline core supports DSP instructions.
Anna Bridge 160:5571c4ff569f 145 *
Anna Bridge 160:5571c4ff569f 146 * <hr>
Anna Bridge 160:5571c4ff569f 147 * CMSIS-DSP in ARM::CMSIS Pack
Anna Bridge 160:5571c4ff569f 148 * -----------------------------
Anna Bridge 160:5571c4ff569f 149 *
Anna Bridge 160:5571c4ff569f 150 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
Anna Bridge 160:5571c4ff569f 151 * |File/Folder |Content |
Anna Bridge 160:5571c4ff569f 152 * |------------------------------|------------------------------------------------------------------------|
Anna Bridge 160:5571c4ff569f 153 * |\b CMSIS\\Documentation\\DSP | This documentation |
Anna Bridge 160:5571c4ff569f 154 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
Anna Bridge 160:5571c4ff569f 155 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
Anna Bridge 160:5571c4ff569f 156 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
Anna Bridge 160:5571c4ff569f 157 *
Anna Bridge 160:5571c4ff569f 158 * <hr>
Anna Bridge 160:5571c4ff569f 159 * Revision History of CMSIS-DSP
Anna Bridge 160:5571c4ff569f 160 * ------------
Anna Bridge 160:5571c4ff569f 161 * Please refer to \ref ChangeLog_pg.
Anna Bridge 160:5571c4ff569f 162 *
Anna Bridge 160:5571c4ff569f 163 * Copyright Notice
Anna Bridge 160:5571c4ff569f 164 * ------------
Anna Bridge 160:5571c4ff569f 165 *
Anna Bridge 160:5571c4ff569f 166 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
Anna Bridge 160:5571c4ff569f 167 */
Anna Bridge 160:5571c4ff569f 168
Anna Bridge 160:5571c4ff569f 169
Anna Bridge 160:5571c4ff569f 170 /**
Anna Bridge 160:5571c4ff569f 171 * @defgroup groupMath Basic Math Functions
Anna Bridge 160:5571c4ff569f 172 */
Anna Bridge 160:5571c4ff569f 173
Anna Bridge 160:5571c4ff569f 174 /**
Anna Bridge 160:5571c4ff569f 175 * @defgroup groupFastMath Fast Math Functions
Anna Bridge 160:5571c4ff569f 176 * This set of functions provides a fast approximation to sine, cosine, and square root.
Anna Bridge 160:5571c4ff569f 177 * As compared to most of the other functions in the CMSIS math library, the fast math functions
Anna Bridge 160:5571c4ff569f 178 * operate on individual values and not arrays.
Anna Bridge 160:5571c4ff569f 179 * There are separate functions for Q15, Q31, and floating-point data.
Anna Bridge 160:5571c4ff569f 180 *
Anna Bridge 160:5571c4ff569f 181 */
Anna Bridge 160:5571c4ff569f 182
Anna Bridge 160:5571c4ff569f 183 /**
Anna Bridge 160:5571c4ff569f 184 * @defgroup groupCmplxMath Complex Math Functions
Anna Bridge 160:5571c4ff569f 185 * This set of functions operates on complex data vectors.
Anna Bridge 160:5571c4ff569f 186 * The data in the complex arrays is stored in an interleaved fashion
Anna Bridge 160:5571c4ff569f 187 * (real, imag, real, imag, ...).
Anna Bridge 160:5571c4ff569f 188 * In the API functions, the number of samples in a complex array refers
Anna Bridge 160:5571c4ff569f 189 * to the number of complex values; the array contains twice this number of
Anna Bridge 160:5571c4ff569f 190 * real values.
Anna Bridge 160:5571c4ff569f 191 */
Anna Bridge 160:5571c4ff569f 192
Anna Bridge 160:5571c4ff569f 193 /**
Anna Bridge 160:5571c4ff569f 194 * @defgroup groupFilters Filtering Functions
Anna Bridge 160:5571c4ff569f 195 */
Anna Bridge 160:5571c4ff569f 196
Anna Bridge 160:5571c4ff569f 197 /**
Anna Bridge 160:5571c4ff569f 198 * @defgroup groupMatrix Matrix Functions
Anna Bridge 160:5571c4ff569f 199 *
Anna Bridge 160:5571c4ff569f 200 * This set of functions provides basic matrix math operations.
Anna Bridge 160:5571c4ff569f 201 * The functions operate on matrix data structures. For example,
Anna Bridge 160:5571c4ff569f 202 * the type
Anna Bridge 160:5571c4ff569f 203 * definition for the floating-point matrix structure is shown
Anna Bridge 160:5571c4ff569f 204 * below:
Anna Bridge 160:5571c4ff569f 205 * <pre>
Anna Bridge 160:5571c4ff569f 206 * typedef struct
Anna Bridge 160:5571c4ff569f 207 * {
Anna Bridge 160:5571c4ff569f 208 * uint16_t numRows; // number of rows of the matrix.
Anna Bridge 160:5571c4ff569f 209 * uint16_t numCols; // number of columns of the matrix.
Anna Bridge 160:5571c4ff569f 210 * float32_t *pData; // points to the data of the matrix.
Anna Bridge 160:5571c4ff569f 211 * } arm_matrix_instance_f32;
Anna Bridge 160:5571c4ff569f 212 * </pre>
Anna Bridge 160:5571c4ff569f 213 * There are similar definitions for Q15 and Q31 data types.
Anna Bridge 160:5571c4ff569f 214 *
Anna Bridge 160:5571c4ff569f 215 * The structure specifies the size of the matrix and then points to
Anna Bridge 160:5571c4ff569f 216 * an array of data. The array is of size <code>numRows X numCols</code>
Anna Bridge 160:5571c4ff569f 217 * and the values are arranged in row order. That is, the
Anna Bridge 160:5571c4ff569f 218 * matrix element (i, j) is stored at:
Anna Bridge 160:5571c4ff569f 219 * <pre>
Anna Bridge 160:5571c4ff569f 220 * pData[i*numCols + j]
Anna Bridge 160:5571c4ff569f 221 * </pre>
Anna Bridge 160:5571c4ff569f 222 *
Anna Bridge 160:5571c4ff569f 223 * \par Init Functions
Anna Bridge 160:5571c4ff569f 224 * There is an associated initialization function for each type of matrix
Anna Bridge 160:5571c4ff569f 225 * data structure.
Anna Bridge 160:5571c4ff569f 226 * The initialization function sets the values of the internal structure fields.
Anna Bridge 160:5571c4ff569f 227 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
Anna Bridge 160:5571c4ff569f 228 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
Anna Bridge 160:5571c4ff569f 229 *
Anna Bridge 160:5571c4ff569f 230 * \par
Anna Bridge 160:5571c4ff569f 231 * Use of the initialization function is optional. However, if initialization function is used
Anna Bridge 160:5571c4ff569f 232 * then the instance structure cannot be placed into a const data section.
Anna Bridge 160:5571c4ff569f 233 * To place the instance structure in a const data
Anna Bridge 160:5571c4ff569f 234 * section, manually initialize the data structure. For example:
Anna Bridge 160:5571c4ff569f 235 * <pre>
Anna Bridge 160:5571c4ff569f 236 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
Anna Bridge 160:5571c4ff569f 237 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
Anna Bridge 160:5571c4ff569f 238 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
Anna Bridge 160:5571c4ff569f 239 * </pre>
Anna Bridge 160:5571c4ff569f 240 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
Anna Bridge 160:5571c4ff569f 241 * specifies the number of columns, and <code>pData</code> points to the
Anna Bridge 160:5571c4ff569f 242 * data array.
Anna Bridge 160:5571c4ff569f 243 *
Anna Bridge 160:5571c4ff569f 244 * \par Size Checking
Anna Bridge 160:5571c4ff569f 245 * By default all of the matrix functions perform size checking on the input and
Anna Bridge 160:5571c4ff569f 246 * output matrices. For example, the matrix addition function verifies that the
Anna Bridge 160:5571c4ff569f 247 * two input matrices and the output matrix all have the same number of rows and
Anna Bridge 160:5571c4ff569f 248 * columns. If the size check fails the functions return:
Anna Bridge 160:5571c4ff569f 249 * <pre>
Anna Bridge 160:5571c4ff569f 250 * ARM_MATH_SIZE_MISMATCH
Anna Bridge 160:5571c4ff569f 251 * </pre>
Anna Bridge 160:5571c4ff569f 252 * Otherwise the functions return
Anna Bridge 160:5571c4ff569f 253 * <pre>
Anna Bridge 160:5571c4ff569f 254 * ARM_MATH_SUCCESS
Anna Bridge 160:5571c4ff569f 255 * </pre>
Anna Bridge 160:5571c4ff569f 256 * There is some overhead associated with this matrix size checking.
Anna Bridge 160:5571c4ff569f 257 * The matrix size checking is enabled via the \#define
Anna Bridge 160:5571c4ff569f 258 * <pre>
Anna Bridge 160:5571c4ff569f 259 * ARM_MATH_MATRIX_CHECK
Anna Bridge 160:5571c4ff569f 260 * </pre>
Anna Bridge 160:5571c4ff569f 261 * within the library project settings. By default this macro is defined
Anna Bridge 160:5571c4ff569f 262 * and size checking is enabled. By changing the project settings and
Anna Bridge 160:5571c4ff569f 263 * undefining this macro size checking is eliminated and the functions
Anna Bridge 160:5571c4ff569f 264 * run a bit faster. With size checking disabled the functions always
Anna Bridge 160:5571c4ff569f 265 * return <code>ARM_MATH_SUCCESS</code>.
Anna Bridge 160:5571c4ff569f 266 */
Anna Bridge 160:5571c4ff569f 267
Anna Bridge 160:5571c4ff569f 268 /**
Anna Bridge 160:5571c4ff569f 269 * @defgroup groupTransforms Transform Functions
Anna Bridge 160:5571c4ff569f 270 */
Anna Bridge 160:5571c4ff569f 271
Anna Bridge 160:5571c4ff569f 272 /**
Anna Bridge 160:5571c4ff569f 273 * @defgroup groupController Controller Functions
Anna Bridge 160:5571c4ff569f 274 */
Anna Bridge 160:5571c4ff569f 275
Anna Bridge 160:5571c4ff569f 276 /**
Anna Bridge 160:5571c4ff569f 277 * @defgroup groupStats Statistics Functions
Anna Bridge 160:5571c4ff569f 278 */
Anna Bridge 160:5571c4ff569f 279 /**
Anna Bridge 160:5571c4ff569f 280 * @defgroup groupSupport Support Functions
Anna Bridge 160:5571c4ff569f 281 */
Anna Bridge 160:5571c4ff569f 282
Anna Bridge 160:5571c4ff569f 283 /**
Anna Bridge 160:5571c4ff569f 284 * @defgroup groupInterpolation Interpolation Functions
Anna Bridge 160:5571c4ff569f 285 * These functions perform 1- and 2-dimensional interpolation of data.
Anna Bridge 160:5571c4ff569f 286 * Linear interpolation is used for 1-dimensional data and
Anna Bridge 160:5571c4ff569f 287 * bilinear interpolation is used for 2-dimensional data.
Anna Bridge 160:5571c4ff569f 288 */
Anna Bridge 160:5571c4ff569f 289
Anna Bridge 160:5571c4ff569f 290 /**
Anna Bridge 160:5571c4ff569f 291 * @defgroup groupExamples Examples
Anna Bridge 160:5571c4ff569f 292 */
Anna Bridge 160:5571c4ff569f 293 #ifndef _ARM_MATH_H
Anna Bridge 160:5571c4ff569f 294 #define _ARM_MATH_H
Anna Bridge 160:5571c4ff569f 295
Anna Bridge 160:5571c4ff569f 296 /* Compiler specific diagnostic adjustment */
Anna Bridge 160:5571c4ff569f 297 #if defined ( __CC_ARM )
Anna Bridge 160:5571c4ff569f 298
Anna Bridge 160:5571c4ff569f 299 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
Anna Bridge 160:5571c4ff569f 300
Anna Bridge 160:5571c4ff569f 301 #elif defined ( __GNUC__ )
Anna Bridge 160:5571c4ff569f 302 #pragma GCC diagnostic push
Anna Bridge 160:5571c4ff569f 303 #pragma GCC diagnostic ignored "-Wsign-conversion"
Anna Bridge 160:5571c4ff569f 304 #pragma GCC diagnostic ignored "-Wconversion"
Anna Bridge 160:5571c4ff569f 305 #pragma GCC diagnostic ignored "-Wunused-parameter"
Anna Bridge 160:5571c4ff569f 306
Anna Bridge 160:5571c4ff569f 307 #elif defined ( __ICCARM__ )
Anna Bridge 160:5571c4ff569f 308
Anna Bridge 160:5571c4ff569f 309 #elif defined ( __TI_ARM__ )
Anna Bridge 160:5571c4ff569f 310
Anna Bridge 160:5571c4ff569f 311 #elif defined ( __CSMC__ )
Anna Bridge 160:5571c4ff569f 312
Anna Bridge 160:5571c4ff569f 313 #elif defined ( __TASKING__ )
Anna Bridge 160:5571c4ff569f 314
Anna Bridge 160:5571c4ff569f 315 #else
Anna Bridge 160:5571c4ff569f 316 #error Unknown compiler
Anna Bridge 160:5571c4ff569f 317 #endif
Anna Bridge 160:5571c4ff569f 318
Anna Bridge 160:5571c4ff569f 319
Anna Bridge 160:5571c4ff569f 320 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
Anna Bridge 160:5571c4ff569f 321
Anna Bridge 160:5571c4ff569f 322 #if defined(ARM_MATH_CM7)
Anna Bridge 160:5571c4ff569f 323 #include "core_cm7.h"
Anna Bridge 160:5571c4ff569f 324 #define ARM_MATH_DSP
Anna Bridge 160:5571c4ff569f 325 #elif defined (ARM_MATH_CM4)
Anna Bridge 160:5571c4ff569f 326 #include "core_cm4.h"
Anna Bridge 160:5571c4ff569f 327 #define ARM_MATH_DSP
Anna Bridge 160:5571c4ff569f 328 #elif defined (ARM_MATH_CM3)
Anna Bridge 160:5571c4ff569f 329 #include "core_cm3.h"
Anna Bridge 160:5571c4ff569f 330 #elif defined (ARM_MATH_CM0)
Anna Bridge 160:5571c4ff569f 331 #include "core_cm0.h"
Anna Bridge 160:5571c4ff569f 332 #define ARM_MATH_CM0_FAMILY
Anna Bridge 160:5571c4ff569f 333 #elif defined (ARM_MATH_CM0PLUS)
Anna Bridge 160:5571c4ff569f 334 #include "core_cm0plus.h"
Anna Bridge 160:5571c4ff569f 335 #define ARM_MATH_CM0_FAMILY
Anna Bridge 160:5571c4ff569f 336 #elif defined (ARM_MATH_ARMV8MBL)
Anna Bridge 160:5571c4ff569f 337 #include "core_armv8mbl.h"
Anna Bridge 160:5571c4ff569f 338 #define ARM_MATH_CM0_FAMILY
Anna Bridge 160:5571c4ff569f 339 #elif defined (ARM_MATH_ARMV8MML)
Anna Bridge 160:5571c4ff569f 340 #include "core_armv8mml.h"
Anna Bridge 160:5571c4ff569f 341 #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1))
Anna Bridge 160:5571c4ff569f 342 #define ARM_MATH_DSP
Anna Bridge 160:5571c4ff569f 343 #endif
Anna Bridge 160:5571c4ff569f 344 #else
Anna Bridge 160:5571c4ff569f 345 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
Anna Bridge 160:5571c4ff569f 346 #endif
Anna Bridge 160:5571c4ff569f 347
Anna Bridge 160:5571c4ff569f 348 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
Anna Bridge 160:5571c4ff569f 349 #include "string.h"
Anna Bridge 160:5571c4ff569f 350 #include "math.h"
Anna Bridge 160:5571c4ff569f 351 #ifdef __cplusplus
Anna Bridge 160:5571c4ff569f 352 extern "C"
Anna Bridge 160:5571c4ff569f 353 {
Anna Bridge 160:5571c4ff569f 354 #endif
Anna Bridge 160:5571c4ff569f 355
Anna Bridge 160:5571c4ff569f 356
Anna Bridge 160:5571c4ff569f 357 /**
Anna Bridge 160:5571c4ff569f 358 * @brief Macros required for reciprocal calculation in Normalized LMS
Anna Bridge 160:5571c4ff569f 359 */
Anna Bridge 160:5571c4ff569f 360
Anna Bridge 160:5571c4ff569f 361 #define DELTA_Q31 (0x100)
Anna Bridge 160:5571c4ff569f 362 #define DELTA_Q15 0x5
Anna Bridge 160:5571c4ff569f 363 #define INDEX_MASK 0x0000003F
Anna Bridge 160:5571c4ff569f 364 #ifndef PI
Anna Bridge 160:5571c4ff569f 365 #define PI 3.14159265358979f
Anna Bridge 160:5571c4ff569f 366 #endif
Anna Bridge 160:5571c4ff569f 367
Anna Bridge 160:5571c4ff569f 368 /**
Anna Bridge 160:5571c4ff569f 369 * @brief Macros required for SINE and COSINE Fast math approximations
Anna Bridge 160:5571c4ff569f 370 */
Anna Bridge 160:5571c4ff569f 371
Anna Bridge 160:5571c4ff569f 372 #define FAST_MATH_TABLE_SIZE 512
Anna Bridge 160:5571c4ff569f 373 #define FAST_MATH_Q31_SHIFT (32 - 10)
Anna Bridge 160:5571c4ff569f 374 #define FAST_MATH_Q15_SHIFT (16 - 10)
Anna Bridge 160:5571c4ff569f 375 #define CONTROLLER_Q31_SHIFT (32 - 9)
Anna Bridge 160:5571c4ff569f 376 #define TABLE_SPACING_Q31 0x400000
Anna Bridge 160:5571c4ff569f 377 #define TABLE_SPACING_Q15 0x80
Anna Bridge 160:5571c4ff569f 378
Anna Bridge 160:5571c4ff569f 379 /**
Anna Bridge 160:5571c4ff569f 380 * @brief Macros required for SINE and COSINE Controller functions
Anna Bridge 160:5571c4ff569f 381 */
Anna Bridge 160:5571c4ff569f 382 /* 1.31(q31) Fixed value of 2/360 */
Anna Bridge 160:5571c4ff569f 383 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
Anna Bridge 160:5571c4ff569f 384 #define INPUT_SPACING 0xB60B61
Anna Bridge 160:5571c4ff569f 385
Anna Bridge 160:5571c4ff569f 386 /**
Anna Bridge 160:5571c4ff569f 387 * @brief Macro for Unaligned Support
Anna Bridge 160:5571c4ff569f 388 */
Anna Bridge 160:5571c4ff569f 389 #ifndef UNALIGNED_SUPPORT_DISABLE
Anna Bridge 160:5571c4ff569f 390 #define ALIGN4
Anna Bridge 160:5571c4ff569f 391 #else
Anna Bridge 160:5571c4ff569f 392 #if defined (__GNUC__)
Anna Bridge 160:5571c4ff569f 393 #define ALIGN4 __attribute__((aligned(4)))
Anna Bridge 160:5571c4ff569f 394 #else
Anna Bridge 160:5571c4ff569f 395 #define ALIGN4 __align(4)
Anna Bridge 160:5571c4ff569f 396 #endif
Anna Bridge 160:5571c4ff569f 397 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
Anna Bridge 160:5571c4ff569f 398
Anna Bridge 160:5571c4ff569f 399 /**
Anna Bridge 160:5571c4ff569f 400 * @brief Error status returned by some functions in the library.
Anna Bridge 160:5571c4ff569f 401 */
Anna Bridge 160:5571c4ff569f 402
Anna Bridge 160:5571c4ff569f 403 typedef enum
Anna Bridge 160:5571c4ff569f 404 {
Anna Bridge 160:5571c4ff569f 405 ARM_MATH_SUCCESS = 0, /**< No error */
Anna Bridge 160:5571c4ff569f 406 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
Anna Bridge 160:5571c4ff569f 407 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
Anna Bridge 160:5571c4ff569f 408 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
Anna Bridge 160:5571c4ff569f 409 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
Anna Bridge 160:5571c4ff569f 410 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
Anna Bridge 160:5571c4ff569f 411 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
Anna Bridge 160:5571c4ff569f 412 } arm_status;
Anna Bridge 160:5571c4ff569f 413
Anna Bridge 160:5571c4ff569f 414 /**
Anna Bridge 160:5571c4ff569f 415 * @brief 8-bit fractional data type in 1.7 format.
Anna Bridge 160:5571c4ff569f 416 */
Anna Bridge 160:5571c4ff569f 417 typedef int8_t q7_t;
Anna Bridge 160:5571c4ff569f 418
Anna Bridge 160:5571c4ff569f 419 /**
Anna Bridge 160:5571c4ff569f 420 * @brief 16-bit fractional data type in 1.15 format.
Anna Bridge 160:5571c4ff569f 421 */
Anna Bridge 160:5571c4ff569f 422 typedef int16_t q15_t;
Anna Bridge 160:5571c4ff569f 423
Anna Bridge 160:5571c4ff569f 424 /**
Anna Bridge 160:5571c4ff569f 425 * @brief 32-bit fractional data type in 1.31 format.
Anna Bridge 160:5571c4ff569f 426 */
Anna Bridge 160:5571c4ff569f 427 typedef int32_t q31_t;
Anna Bridge 160:5571c4ff569f 428
Anna Bridge 160:5571c4ff569f 429 /**
Anna Bridge 160:5571c4ff569f 430 * @brief 64-bit fractional data type in 1.63 format.
Anna Bridge 160:5571c4ff569f 431 */
Anna Bridge 160:5571c4ff569f 432 typedef int64_t q63_t;
Anna Bridge 160:5571c4ff569f 433
Anna Bridge 160:5571c4ff569f 434 /**
Anna Bridge 160:5571c4ff569f 435 * @brief 32-bit floating-point type definition.
Anna Bridge 160:5571c4ff569f 436 */
Anna Bridge 160:5571c4ff569f 437 typedef float float32_t;
Anna Bridge 160:5571c4ff569f 438
Anna Bridge 160:5571c4ff569f 439 /**
Anna Bridge 160:5571c4ff569f 440 * @brief 64-bit floating-point type definition.
Anna Bridge 160:5571c4ff569f 441 */
Anna Bridge 160:5571c4ff569f 442 typedef double float64_t;
Anna Bridge 160:5571c4ff569f 443
Anna Bridge 160:5571c4ff569f 444 /**
Anna Bridge 160:5571c4ff569f 445 * @brief definition to read/write two 16 bit values.
Anna Bridge 160:5571c4ff569f 446 */
Anna Bridge 160:5571c4ff569f 447 #if defined ( __CC_ARM )
Anna Bridge 160:5571c4ff569f 448 #define __SIMD32_TYPE int32_t __packed
Anna Bridge 160:5571c4ff569f 449 #define CMSIS_UNUSED __attribute__((unused))
Anna Bridge 160:5571c4ff569f 450 #define CMSIS_INLINE __attribute__((always_inline))
Anna Bridge 160:5571c4ff569f 451
Anna Bridge 160:5571c4ff569f 452 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
Anna Bridge 160:5571c4ff569f 453 #define __SIMD32_TYPE int32_t
Anna Bridge 160:5571c4ff569f 454 #define CMSIS_UNUSED __attribute__((unused))
Anna Bridge 160:5571c4ff569f 455 #define CMSIS_INLINE __attribute__((always_inline))
Anna Bridge 160:5571c4ff569f 456
Anna Bridge 160:5571c4ff569f 457 #elif defined ( __GNUC__ )
Anna Bridge 160:5571c4ff569f 458 #define __SIMD32_TYPE int32_t
Anna Bridge 160:5571c4ff569f 459 #define CMSIS_UNUSED __attribute__((unused))
Anna Bridge 160:5571c4ff569f 460 #define CMSIS_INLINE __attribute__((always_inline))
Anna Bridge 160:5571c4ff569f 461
Anna Bridge 160:5571c4ff569f 462 #elif defined ( __ICCARM__ )
Anna Bridge 160:5571c4ff569f 463 #define __SIMD32_TYPE int32_t __packed
Anna Bridge 160:5571c4ff569f 464 #define CMSIS_UNUSED
Anna Bridge 160:5571c4ff569f 465 #define CMSIS_INLINE
Anna Bridge 160:5571c4ff569f 466
Anna Bridge 160:5571c4ff569f 467 #elif defined ( __TI_ARM__ )
Anna Bridge 160:5571c4ff569f 468 #define __SIMD32_TYPE int32_t
Anna Bridge 160:5571c4ff569f 469 #define CMSIS_UNUSED __attribute__((unused))
Anna Bridge 160:5571c4ff569f 470 #define CMSIS_INLINE
Anna Bridge 160:5571c4ff569f 471
Anna Bridge 160:5571c4ff569f 472 #elif defined ( __CSMC__ )
Anna Bridge 160:5571c4ff569f 473 #define __SIMD32_TYPE int32_t
Anna Bridge 160:5571c4ff569f 474 #define CMSIS_UNUSED
Anna Bridge 160:5571c4ff569f 475 #define CMSIS_INLINE
Anna Bridge 160:5571c4ff569f 476
Anna Bridge 160:5571c4ff569f 477 #elif defined ( __TASKING__ )
Anna Bridge 160:5571c4ff569f 478 #define __SIMD32_TYPE __unaligned int32_t
Anna Bridge 160:5571c4ff569f 479 #define CMSIS_UNUSED
Anna Bridge 160:5571c4ff569f 480 #define CMSIS_INLINE
Anna Bridge 160:5571c4ff569f 481
Anna Bridge 160:5571c4ff569f 482 #else
Anna Bridge 160:5571c4ff569f 483 #error Unknown compiler
Anna Bridge 160:5571c4ff569f 484 #endif
Anna Bridge 160:5571c4ff569f 485
Anna Bridge 160:5571c4ff569f 486 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
Anna Bridge 160:5571c4ff569f 487 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
Anna Bridge 160:5571c4ff569f 488 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
Anna Bridge 160:5571c4ff569f 489 #define __SIMD64(addr) (*(int64_t **) & (addr))
Anna Bridge 160:5571c4ff569f 490
Anna Bridge 160:5571c4ff569f 491 /* #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
Anna Bridge 160:5571c4ff569f 492 #if !defined (ARM_MATH_DSP)
Anna Bridge 160:5571c4ff569f 493 /**
Anna Bridge 160:5571c4ff569f 494 * @brief definition to pack two 16 bit values.
Anna Bridge 160:5571c4ff569f 495 */
Anna Bridge 160:5571c4ff569f 496 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
Anna Bridge 160:5571c4ff569f 497 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
Anna Bridge 160:5571c4ff569f 498 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
Anna Bridge 160:5571c4ff569f 499 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
Anna Bridge 160:5571c4ff569f 500
Anna Bridge 160:5571c4ff569f 501 /* #endif // defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
Anna Bridge 160:5571c4ff569f 502 #endif /* !defined (ARM_MATH_DSP) */
Anna Bridge 160:5571c4ff569f 503
Anna Bridge 160:5571c4ff569f 504 /**
Anna Bridge 160:5571c4ff569f 505 * @brief definition to pack four 8 bit values.
Anna Bridge 160:5571c4ff569f 506 */
Anna Bridge 160:5571c4ff569f 507 #ifndef ARM_MATH_BIG_ENDIAN
Anna Bridge 160:5571c4ff569f 508
Anna Bridge 160:5571c4ff569f 509 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
Anna Bridge 160:5571c4ff569f 510 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
Anna Bridge 160:5571c4ff569f 511 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
Anna Bridge 160:5571c4ff569f 512 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
Anna Bridge 160:5571c4ff569f 513 #else
Anna Bridge 160:5571c4ff569f 514
Anna Bridge 160:5571c4ff569f 515 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
Anna Bridge 160:5571c4ff569f 516 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
Anna Bridge 160:5571c4ff569f 517 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
Anna Bridge 160:5571c4ff569f 518 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
Anna Bridge 160:5571c4ff569f 519
Anna Bridge 160:5571c4ff569f 520 #endif
Anna Bridge 160:5571c4ff569f 521
Anna Bridge 160:5571c4ff569f 522
Anna Bridge 160:5571c4ff569f 523 /**
Anna Bridge 160:5571c4ff569f 524 * @brief Clips Q63 to Q31 values.
Anna Bridge 160:5571c4ff569f 525 */
Anna Bridge 160:5571c4ff569f 526 CMSIS_INLINE __STATIC_INLINE q31_t clip_q63_to_q31(
Anna Bridge 160:5571c4ff569f 527 q63_t x)
Anna Bridge 160:5571c4ff569f 528 {
Anna Bridge 160:5571c4ff569f 529 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
Anna Bridge 160:5571c4ff569f 530 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
Anna Bridge 160:5571c4ff569f 531 }
Anna Bridge 160:5571c4ff569f 532
Anna Bridge 160:5571c4ff569f 533 /**
Anna Bridge 160:5571c4ff569f 534 * @brief Clips Q63 to Q15 values.
Anna Bridge 160:5571c4ff569f 535 */
Anna Bridge 160:5571c4ff569f 536 CMSIS_INLINE __STATIC_INLINE q15_t clip_q63_to_q15(
Anna Bridge 160:5571c4ff569f 537 q63_t x)
Anna Bridge 160:5571c4ff569f 538 {
Anna Bridge 160:5571c4ff569f 539 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
Anna Bridge 160:5571c4ff569f 540 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
Anna Bridge 160:5571c4ff569f 541 }
Anna Bridge 160:5571c4ff569f 542
Anna Bridge 160:5571c4ff569f 543 /**
Anna Bridge 160:5571c4ff569f 544 * @brief Clips Q31 to Q7 values.
Anna Bridge 160:5571c4ff569f 545 */
Anna Bridge 160:5571c4ff569f 546 CMSIS_INLINE __STATIC_INLINE q7_t clip_q31_to_q7(
Anna Bridge 160:5571c4ff569f 547 q31_t x)
Anna Bridge 160:5571c4ff569f 548 {
Anna Bridge 160:5571c4ff569f 549 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
Anna Bridge 160:5571c4ff569f 550 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
Anna Bridge 160:5571c4ff569f 551 }
Anna Bridge 160:5571c4ff569f 552
Anna Bridge 160:5571c4ff569f 553 /**
Anna Bridge 160:5571c4ff569f 554 * @brief Clips Q31 to Q15 values.
Anna Bridge 160:5571c4ff569f 555 */
Anna Bridge 160:5571c4ff569f 556 CMSIS_INLINE __STATIC_INLINE q15_t clip_q31_to_q15(
Anna Bridge 160:5571c4ff569f 557 q31_t x)
Anna Bridge 160:5571c4ff569f 558 {
Anna Bridge 160:5571c4ff569f 559 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
Anna Bridge 160:5571c4ff569f 560 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
Anna Bridge 160:5571c4ff569f 561 }
Anna Bridge 160:5571c4ff569f 562
Anna Bridge 160:5571c4ff569f 563 /**
Anna Bridge 160:5571c4ff569f 564 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
Anna Bridge 160:5571c4ff569f 565 */
Anna Bridge 160:5571c4ff569f 566
Anna Bridge 160:5571c4ff569f 567 CMSIS_INLINE __STATIC_INLINE q63_t mult32x64(
Anna Bridge 160:5571c4ff569f 568 q63_t x,
Anna Bridge 160:5571c4ff569f 569 q31_t y)
Anna Bridge 160:5571c4ff569f 570 {
Anna Bridge 160:5571c4ff569f 571 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
Anna Bridge 160:5571c4ff569f 572 (((q63_t) (x >> 32) * y)));
Anna Bridge 160:5571c4ff569f 573 }
Anna Bridge 160:5571c4ff569f 574
Anna Bridge 160:5571c4ff569f 575 /**
Anna Bridge 160:5571c4ff569f 576 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
Anna Bridge 160:5571c4ff569f 577 */
Anna Bridge 160:5571c4ff569f 578
Anna Bridge 160:5571c4ff569f 579 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q31(
Anna Bridge 160:5571c4ff569f 580 q31_t in,
Anna Bridge 160:5571c4ff569f 581 q31_t * dst,
Anna Bridge 160:5571c4ff569f 582 q31_t * pRecipTable)
Anna Bridge 160:5571c4ff569f 583 {
Anna Bridge 160:5571c4ff569f 584 q31_t out;
Anna Bridge 160:5571c4ff569f 585 uint32_t tempVal;
Anna Bridge 160:5571c4ff569f 586 uint32_t index, i;
Anna Bridge 160:5571c4ff569f 587 uint32_t signBits;
Anna Bridge 160:5571c4ff569f 588
Anna Bridge 160:5571c4ff569f 589 if (in > 0)
Anna Bridge 160:5571c4ff569f 590 {
Anna Bridge 160:5571c4ff569f 591 signBits = ((uint32_t) (__CLZ( in) - 1));
Anna Bridge 160:5571c4ff569f 592 }
Anna Bridge 160:5571c4ff569f 593 else
Anna Bridge 160:5571c4ff569f 594 {
Anna Bridge 160:5571c4ff569f 595 signBits = ((uint32_t) (__CLZ(-in) - 1));
Anna Bridge 160:5571c4ff569f 596 }
Anna Bridge 160:5571c4ff569f 597
Anna Bridge 160:5571c4ff569f 598 /* Convert input sample to 1.31 format */
Anna Bridge 160:5571c4ff569f 599 in = (in << signBits);
Anna Bridge 160:5571c4ff569f 600
Anna Bridge 160:5571c4ff569f 601 /* calculation of index for initial approximated Val */
Anna Bridge 160:5571c4ff569f 602 index = (uint32_t)(in >> 24);
Anna Bridge 160:5571c4ff569f 603 index = (index & INDEX_MASK);
Anna Bridge 160:5571c4ff569f 604
Anna Bridge 160:5571c4ff569f 605 /* 1.31 with exp 1 */
Anna Bridge 160:5571c4ff569f 606 out = pRecipTable[index];
Anna Bridge 160:5571c4ff569f 607
Anna Bridge 160:5571c4ff569f 608 /* calculation of reciprocal value */
Anna Bridge 160:5571c4ff569f 609 /* running approximation for two iterations */
Anna Bridge 160:5571c4ff569f 610 for (i = 0u; i < 2u; i++)
Anna Bridge 160:5571c4ff569f 611 {
Anna Bridge 160:5571c4ff569f 612 tempVal = (uint32_t) (((q63_t) in * out) >> 31);
Anna Bridge 160:5571c4ff569f 613 tempVal = 0x7FFFFFFFu - tempVal;
Anna Bridge 160:5571c4ff569f 614 /* 1.31 with exp 1 */
Anna Bridge 160:5571c4ff569f 615 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
Anna Bridge 160:5571c4ff569f 616 out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
Anna Bridge 160:5571c4ff569f 617 }
Anna Bridge 160:5571c4ff569f 618
Anna Bridge 160:5571c4ff569f 619 /* write output */
Anna Bridge 160:5571c4ff569f 620 *dst = out;
Anna Bridge 160:5571c4ff569f 621
Anna Bridge 160:5571c4ff569f 622 /* return num of signbits of out = 1/in value */
Anna Bridge 160:5571c4ff569f 623 return (signBits + 1u);
Anna Bridge 160:5571c4ff569f 624 }
Anna Bridge 160:5571c4ff569f 625
Anna Bridge 160:5571c4ff569f 626
Anna Bridge 160:5571c4ff569f 627 /**
Anna Bridge 160:5571c4ff569f 628 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
Anna Bridge 160:5571c4ff569f 629 */
Anna Bridge 160:5571c4ff569f 630 CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q15(
Anna Bridge 160:5571c4ff569f 631 q15_t in,
Anna Bridge 160:5571c4ff569f 632 q15_t * dst,
Anna Bridge 160:5571c4ff569f 633 q15_t * pRecipTable)
Anna Bridge 160:5571c4ff569f 634 {
Anna Bridge 160:5571c4ff569f 635 q15_t out = 0;
Anna Bridge 160:5571c4ff569f 636 uint32_t tempVal = 0;
Anna Bridge 160:5571c4ff569f 637 uint32_t index = 0, i = 0;
Anna Bridge 160:5571c4ff569f 638 uint32_t signBits = 0;
Anna Bridge 160:5571c4ff569f 639
Anna Bridge 160:5571c4ff569f 640 if (in > 0)
Anna Bridge 160:5571c4ff569f 641 {
Anna Bridge 160:5571c4ff569f 642 signBits = ((uint32_t)(__CLZ( in) - 17));
Anna Bridge 160:5571c4ff569f 643 }
Anna Bridge 160:5571c4ff569f 644 else
Anna Bridge 160:5571c4ff569f 645 {
Anna Bridge 160:5571c4ff569f 646 signBits = ((uint32_t)(__CLZ(-in) - 17));
Anna Bridge 160:5571c4ff569f 647 }
Anna Bridge 160:5571c4ff569f 648
Anna Bridge 160:5571c4ff569f 649 /* Convert input sample to 1.15 format */
Anna Bridge 160:5571c4ff569f 650 in = (in << signBits);
Anna Bridge 160:5571c4ff569f 651
Anna Bridge 160:5571c4ff569f 652 /* calculation of index for initial approximated Val */
Anna Bridge 160:5571c4ff569f 653 index = (uint32_t)(in >> 8);
Anna Bridge 160:5571c4ff569f 654 index = (index & INDEX_MASK);
Anna Bridge 160:5571c4ff569f 655
Anna Bridge 160:5571c4ff569f 656 /* 1.15 with exp 1 */
Anna Bridge 160:5571c4ff569f 657 out = pRecipTable[index];
Anna Bridge 160:5571c4ff569f 658
Anna Bridge 160:5571c4ff569f 659 /* calculation of reciprocal value */
Anna Bridge 160:5571c4ff569f 660 /* running approximation for two iterations */
Anna Bridge 160:5571c4ff569f 661 for (i = 0u; i < 2u; i++)
Anna Bridge 160:5571c4ff569f 662 {
Anna Bridge 160:5571c4ff569f 663 tempVal = (uint32_t) (((q31_t) in * out) >> 15);
Anna Bridge 160:5571c4ff569f 664 tempVal = 0x7FFFu - tempVal;
Anna Bridge 160:5571c4ff569f 665 /* 1.15 with exp 1 */
Anna Bridge 160:5571c4ff569f 666 out = (q15_t) (((q31_t) out * tempVal) >> 14);
Anna Bridge 160:5571c4ff569f 667 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
Anna Bridge 160:5571c4ff569f 668 }
Anna Bridge 160:5571c4ff569f 669
Anna Bridge 160:5571c4ff569f 670 /* write output */
Anna Bridge 160:5571c4ff569f 671 *dst = out;
Anna Bridge 160:5571c4ff569f 672
Anna Bridge 160:5571c4ff569f 673 /* return num of signbits of out = 1/in value */
Anna Bridge 160:5571c4ff569f 674 return (signBits + 1);
Anna Bridge 160:5571c4ff569f 675 }
Anna Bridge 160:5571c4ff569f 676
Anna Bridge 160:5571c4ff569f 677 /*
Anna Bridge 160:5571c4ff569f 678 * @brief C custom defined intrinsic function for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 679 */
Anna Bridge 160:5571c4ff569f 680 /* #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
Anna Bridge 160:5571c4ff569f 681 #if !defined (ARM_MATH_DSP)
Anna Bridge 160:5571c4ff569f 682
Anna Bridge 160:5571c4ff569f 683 /*
Anna Bridge 160:5571c4ff569f 684 * @brief C custom defined QADD8 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 685 */
Anna Bridge 160:5571c4ff569f 686 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD8(
Anna Bridge 160:5571c4ff569f 687 uint32_t x,
Anna Bridge 160:5571c4ff569f 688 uint32_t y)
Anna Bridge 160:5571c4ff569f 689 {
Anna Bridge 160:5571c4ff569f 690 q31_t r, s, t, u;
Anna Bridge 160:5571c4ff569f 691
Anna Bridge 160:5571c4ff569f 692 r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 693 s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 694 t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 695 u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 696
Anna Bridge 160:5571c4ff569f 697 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
Anna Bridge 160:5571c4ff569f 698 }
Anna Bridge 160:5571c4ff569f 699
Anna Bridge 160:5571c4ff569f 700
Anna Bridge 160:5571c4ff569f 701 /*
Anna Bridge 160:5571c4ff569f 702 * @brief C custom defined QSUB8 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 703 */
Anna Bridge 160:5571c4ff569f 704 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB8(
Anna Bridge 160:5571c4ff569f 705 uint32_t x,
Anna Bridge 160:5571c4ff569f 706 uint32_t y)
Anna Bridge 160:5571c4ff569f 707 {
Anna Bridge 160:5571c4ff569f 708 q31_t r, s, t, u;
Anna Bridge 160:5571c4ff569f 709
Anna Bridge 160:5571c4ff569f 710 r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 711 s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 712 t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 713 u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
Anna Bridge 160:5571c4ff569f 714
Anna Bridge 160:5571c4ff569f 715 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
Anna Bridge 160:5571c4ff569f 716 }
Anna Bridge 160:5571c4ff569f 717
Anna Bridge 160:5571c4ff569f 718
Anna Bridge 160:5571c4ff569f 719 /*
Anna Bridge 160:5571c4ff569f 720 * @brief C custom defined QADD16 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 721 */
Anna Bridge 160:5571c4ff569f 722 CMSIS_INLINE __STATIC_INLINE uint32_t __QADD16(
Anna Bridge 160:5571c4ff569f 723 uint32_t x,
Anna Bridge 160:5571c4ff569f 724 uint32_t y)
Anna Bridge 160:5571c4ff569f 725 {
Anna Bridge 160:5571c4ff569f 726 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
Anna Bridge 160:5571c4ff569f 727 q31_t r = 0, s = 0;
Anna Bridge 160:5571c4ff569f 728
Anna Bridge 160:5571c4ff569f 729 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 730 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 731
Anna Bridge 160:5571c4ff569f 732 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 733 }
Anna Bridge 160:5571c4ff569f 734
Anna Bridge 160:5571c4ff569f 735
Anna Bridge 160:5571c4ff569f 736 /*
Anna Bridge 160:5571c4ff569f 737 * @brief C custom defined SHADD16 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 738 */
Anna Bridge 160:5571c4ff569f 739 CMSIS_INLINE __STATIC_INLINE uint32_t __SHADD16(
Anna Bridge 160:5571c4ff569f 740 uint32_t x,
Anna Bridge 160:5571c4ff569f 741 uint32_t y)
Anna Bridge 160:5571c4ff569f 742 {
Anna Bridge 160:5571c4ff569f 743 q31_t r, s;
Anna Bridge 160:5571c4ff569f 744
Anna Bridge 160:5571c4ff569f 745 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 746 s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 747
Anna Bridge 160:5571c4ff569f 748 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 749 }
Anna Bridge 160:5571c4ff569f 750
Anna Bridge 160:5571c4ff569f 751
Anna Bridge 160:5571c4ff569f 752 /*
Anna Bridge 160:5571c4ff569f 753 * @brief C custom defined QSUB16 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 754 */
Anna Bridge 160:5571c4ff569f 755 CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB16(
Anna Bridge 160:5571c4ff569f 756 uint32_t x,
Anna Bridge 160:5571c4ff569f 757 uint32_t y)
Anna Bridge 160:5571c4ff569f 758 {
Anna Bridge 160:5571c4ff569f 759 q31_t r, s;
Anna Bridge 160:5571c4ff569f 760
Anna Bridge 160:5571c4ff569f 761 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 762 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 763
Anna Bridge 160:5571c4ff569f 764 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 765 }
Anna Bridge 160:5571c4ff569f 766
Anna Bridge 160:5571c4ff569f 767
Anna Bridge 160:5571c4ff569f 768 /*
Anna Bridge 160:5571c4ff569f 769 * @brief C custom defined SHSUB16 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 770 */
Anna Bridge 160:5571c4ff569f 771 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSUB16(
Anna Bridge 160:5571c4ff569f 772 uint32_t x,
Anna Bridge 160:5571c4ff569f 773 uint32_t y)
Anna Bridge 160:5571c4ff569f 774 {
Anna Bridge 160:5571c4ff569f 775 q31_t r, s;
Anna Bridge 160:5571c4ff569f 776
Anna Bridge 160:5571c4ff569f 777 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 778 s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 779
Anna Bridge 160:5571c4ff569f 780 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 781 }
Anna Bridge 160:5571c4ff569f 782
Anna Bridge 160:5571c4ff569f 783
Anna Bridge 160:5571c4ff569f 784 /*
Anna Bridge 160:5571c4ff569f 785 * @brief C custom defined QASX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 786 */
Anna Bridge 160:5571c4ff569f 787 CMSIS_INLINE __STATIC_INLINE uint32_t __QASX(
Anna Bridge 160:5571c4ff569f 788 uint32_t x,
Anna Bridge 160:5571c4ff569f 789 uint32_t y)
Anna Bridge 160:5571c4ff569f 790 {
Anna Bridge 160:5571c4ff569f 791 q31_t r, s;
Anna Bridge 160:5571c4ff569f 792
Anna Bridge 160:5571c4ff569f 793 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 794 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 795
Anna Bridge 160:5571c4ff569f 796 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 797 }
Anna Bridge 160:5571c4ff569f 798
Anna Bridge 160:5571c4ff569f 799
Anna Bridge 160:5571c4ff569f 800 /*
Anna Bridge 160:5571c4ff569f 801 * @brief C custom defined SHASX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 802 */
Anna Bridge 160:5571c4ff569f 803 CMSIS_INLINE __STATIC_INLINE uint32_t __SHASX(
Anna Bridge 160:5571c4ff569f 804 uint32_t x,
Anna Bridge 160:5571c4ff569f 805 uint32_t y)
Anna Bridge 160:5571c4ff569f 806 {
Anna Bridge 160:5571c4ff569f 807 q31_t r, s;
Anna Bridge 160:5571c4ff569f 808
Anna Bridge 160:5571c4ff569f 809 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 810 s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 811
Anna Bridge 160:5571c4ff569f 812 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 813 }
Anna Bridge 160:5571c4ff569f 814
Anna Bridge 160:5571c4ff569f 815
Anna Bridge 160:5571c4ff569f 816 /*
Anna Bridge 160:5571c4ff569f 817 * @brief C custom defined QSAX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 818 */
Anna Bridge 160:5571c4ff569f 819 CMSIS_INLINE __STATIC_INLINE uint32_t __QSAX(
Anna Bridge 160:5571c4ff569f 820 uint32_t x,
Anna Bridge 160:5571c4ff569f 821 uint32_t y)
Anna Bridge 160:5571c4ff569f 822 {
Anna Bridge 160:5571c4ff569f 823 q31_t r, s;
Anna Bridge 160:5571c4ff569f 824
Anna Bridge 160:5571c4ff569f 825 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 826 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 827
Anna Bridge 160:5571c4ff569f 828 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 829 }
Anna Bridge 160:5571c4ff569f 830
Anna Bridge 160:5571c4ff569f 831
Anna Bridge 160:5571c4ff569f 832 /*
Anna Bridge 160:5571c4ff569f 833 * @brief C custom defined SHSAX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 834 */
Anna Bridge 160:5571c4ff569f 835 CMSIS_INLINE __STATIC_INLINE uint32_t __SHSAX(
Anna Bridge 160:5571c4ff569f 836 uint32_t x,
Anna Bridge 160:5571c4ff569f 837 uint32_t y)
Anna Bridge 160:5571c4ff569f 838 {
Anna Bridge 160:5571c4ff569f 839 q31_t r, s;
Anna Bridge 160:5571c4ff569f 840
Anna Bridge 160:5571c4ff569f 841 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 842 s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
Anna Bridge 160:5571c4ff569f 843
Anna Bridge 160:5571c4ff569f 844 return ((uint32_t)((s << 16) | (r )));
Anna Bridge 160:5571c4ff569f 845 }
Anna Bridge 160:5571c4ff569f 846
Anna Bridge 160:5571c4ff569f 847
Anna Bridge 160:5571c4ff569f 848 /*
Anna Bridge 160:5571c4ff569f 849 * @brief C custom defined SMUSDX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 850 */
Anna Bridge 160:5571c4ff569f 851 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSDX(
Anna Bridge 160:5571c4ff569f 852 uint32_t x,
Anna Bridge 160:5571c4ff569f 853 uint32_t y)
Anna Bridge 160:5571c4ff569f 854 {
Anna Bridge 160:5571c4ff569f 855 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
Anna Bridge 160:5571c4ff569f 856 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
Anna Bridge 160:5571c4ff569f 857 }
Anna Bridge 160:5571c4ff569f 858
Anna Bridge 160:5571c4ff569f 859 /*
Anna Bridge 160:5571c4ff569f 860 * @brief C custom defined SMUADX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 861 */
Anna Bridge 160:5571c4ff569f 862 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUADX(
Anna Bridge 160:5571c4ff569f 863 uint32_t x,
Anna Bridge 160:5571c4ff569f 864 uint32_t y)
Anna Bridge 160:5571c4ff569f 865 {
Anna Bridge 160:5571c4ff569f 866 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
Anna Bridge 160:5571c4ff569f 867 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
Anna Bridge 160:5571c4ff569f 868 }
Anna Bridge 160:5571c4ff569f 869
Anna Bridge 160:5571c4ff569f 870
Anna Bridge 160:5571c4ff569f 871 /*
Anna Bridge 160:5571c4ff569f 872 * @brief C custom defined QADD for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 873 */
Anna Bridge 160:5571c4ff569f 874 CMSIS_INLINE __STATIC_INLINE int32_t __QADD(
Anna Bridge 160:5571c4ff569f 875 int32_t x,
Anna Bridge 160:5571c4ff569f 876 int32_t y)
Anna Bridge 160:5571c4ff569f 877 {
Anna Bridge 160:5571c4ff569f 878 return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
Anna Bridge 160:5571c4ff569f 879 }
Anna Bridge 160:5571c4ff569f 880
Anna Bridge 160:5571c4ff569f 881
Anna Bridge 160:5571c4ff569f 882 /*
Anna Bridge 160:5571c4ff569f 883 * @brief C custom defined QSUB for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 884 */
Anna Bridge 160:5571c4ff569f 885 CMSIS_INLINE __STATIC_INLINE int32_t __QSUB(
Anna Bridge 160:5571c4ff569f 886 int32_t x,
Anna Bridge 160:5571c4ff569f 887 int32_t y)
Anna Bridge 160:5571c4ff569f 888 {
Anna Bridge 160:5571c4ff569f 889 return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
Anna Bridge 160:5571c4ff569f 890 }
Anna Bridge 160:5571c4ff569f 891
Anna Bridge 160:5571c4ff569f 892
Anna Bridge 160:5571c4ff569f 893 /*
Anna Bridge 160:5571c4ff569f 894 * @brief C custom defined SMLAD for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 895 */
Anna Bridge 160:5571c4ff569f 896 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLAD(
Anna Bridge 160:5571c4ff569f 897 uint32_t x,
Anna Bridge 160:5571c4ff569f 898 uint32_t y,
Anna Bridge 160:5571c4ff569f 899 uint32_t sum)
Anna Bridge 160:5571c4ff569f 900 {
Anna Bridge 160:5571c4ff569f 901 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
Anna Bridge 160:5571c4ff569f 902 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
Anna Bridge 160:5571c4ff569f 903 ( ((q31_t)sum ) ) ));
Anna Bridge 160:5571c4ff569f 904 }
Anna Bridge 160:5571c4ff569f 905
Anna Bridge 160:5571c4ff569f 906
Anna Bridge 160:5571c4ff569f 907 /*
Anna Bridge 160:5571c4ff569f 908 * @brief C custom defined SMLADX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 909 */
Anna Bridge 160:5571c4ff569f 910 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLADX(
Anna Bridge 160:5571c4ff569f 911 uint32_t x,
Anna Bridge 160:5571c4ff569f 912 uint32_t y,
Anna Bridge 160:5571c4ff569f 913 uint32_t sum)
Anna Bridge 160:5571c4ff569f 914 {
Anna Bridge 160:5571c4ff569f 915 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
Anna Bridge 160:5571c4ff569f 916 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
Anna Bridge 160:5571c4ff569f 917 ( ((q31_t)sum ) ) ));
Anna Bridge 160:5571c4ff569f 918 }
Anna Bridge 160:5571c4ff569f 919
Anna Bridge 160:5571c4ff569f 920
Anna Bridge 160:5571c4ff569f 921 /*
Anna Bridge 160:5571c4ff569f 922 * @brief C custom defined SMLSDX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 923 */
Anna Bridge 160:5571c4ff569f 924 CMSIS_INLINE __STATIC_INLINE uint32_t __SMLSDX(
Anna Bridge 160:5571c4ff569f 925 uint32_t x,
Anna Bridge 160:5571c4ff569f 926 uint32_t y,
Anna Bridge 160:5571c4ff569f 927 uint32_t sum)
Anna Bridge 160:5571c4ff569f 928 {
Anna Bridge 160:5571c4ff569f 929 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
Anna Bridge 160:5571c4ff569f 930 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
Anna Bridge 160:5571c4ff569f 931 ( ((q31_t)sum ) ) ));
Anna Bridge 160:5571c4ff569f 932 }
Anna Bridge 160:5571c4ff569f 933
Anna Bridge 160:5571c4ff569f 934
Anna Bridge 160:5571c4ff569f 935 /*
Anna Bridge 160:5571c4ff569f 936 * @brief C custom defined SMLALD for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 937 */
Anna Bridge 160:5571c4ff569f 938 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALD(
Anna Bridge 160:5571c4ff569f 939 uint32_t x,
Anna Bridge 160:5571c4ff569f 940 uint32_t y,
Anna Bridge 160:5571c4ff569f 941 uint64_t sum)
Anna Bridge 160:5571c4ff569f 942 {
Anna Bridge 160:5571c4ff569f 943 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
Anna Bridge 160:5571c4ff569f 944 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
Anna Bridge 160:5571c4ff569f 945 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
Anna Bridge 160:5571c4ff569f 946 ( ((q63_t)sum ) ) ));
Anna Bridge 160:5571c4ff569f 947 }
Anna Bridge 160:5571c4ff569f 948
Anna Bridge 160:5571c4ff569f 949
Anna Bridge 160:5571c4ff569f 950 /*
Anna Bridge 160:5571c4ff569f 951 * @brief C custom defined SMLALDX for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 952 */
Anna Bridge 160:5571c4ff569f 953 CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALDX(
Anna Bridge 160:5571c4ff569f 954 uint32_t x,
Anna Bridge 160:5571c4ff569f 955 uint32_t y,
Anna Bridge 160:5571c4ff569f 956 uint64_t sum)
Anna Bridge 160:5571c4ff569f 957 {
Anna Bridge 160:5571c4ff569f 958 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
Anna Bridge 160:5571c4ff569f 959 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
Anna Bridge 160:5571c4ff569f 960 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
Anna Bridge 160:5571c4ff569f 961 ( ((q63_t)sum ) ) ));
Anna Bridge 160:5571c4ff569f 962 }
Anna Bridge 160:5571c4ff569f 963
Anna Bridge 160:5571c4ff569f 964
Anna Bridge 160:5571c4ff569f 965 /*
Anna Bridge 160:5571c4ff569f 966 * @brief C custom defined SMUAD for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 967 */
Anna Bridge 160:5571c4ff569f 968 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUAD(
Anna Bridge 160:5571c4ff569f 969 uint32_t x,
Anna Bridge 160:5571c4ff569f 970 uint32_t y)
Anna Bridge 160:5571c4ff569f 971 {
Anna Bridge 160:5571c4ff569f 972 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
Anna Bridge 160:5571c4ff569f 973 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
Anna Bridge 160:5571c4ff569f 974 }
Anna Bridge 160:5571c4ff569f 975
Anna Bridge 160:5571c4ff569f 976
Anna Bridge 160:5571c4ff569f 977 /*
Anna Bridge 160:5571c4ff569f 978 * @brief C custom defined SMUSD for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 979 */
Anna Bridge 160:5571c4ff569f 980 CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSD(
Anna Bridge 160:5571c4ff569f 981 uint32_t x,
Anna Bridge 160:5571c4ff569f 982 uint32_t y)
Anna Bridge 160:5571c4ff569f 983 {
Anna Bridge 160:5571c4ff569f 984 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
Anna Bridge 160:5571c4ff569f 985 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
Anna Bridge 160:5571c4ff569f 986 }
Anna Bridge 160:5571c4ff569f 987
Anna Bridge 160:5571c4ff569f 988
Anna Bridge 160:5571c4ff569f 989 /*
Anna Bridge 160:5571c4ff569f 990 * @brief C custom defined SXTB16 for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 991 */
Anna Bridge 160:5571c4ff569f 992 CMSIS_INLINE __STATIC_INLINE uint32_t __SXTB16(
Anna Bridge 160:5571c4ff569f 993 uint32_t x)
Anna Bridge 160:5571c4ff569f 994 {
Anna Bridge 160:5571c4ff569f 995 return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
Anna Bridge 160:5571c4ff569f 996 ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
Anna Bridge 160:5571c4ff569f 997 }
Anna Bridge 160:5571c4ff569f 998
Anna Bridge 160:5571c4ff569f 999 /*
Anna Bridge 160:5571c4ff569f 1000 * @brief C custom defined SMMLA for M3 and M0 processors
Anna Bridge 160:5571c4ff569f 1001 */
Anna Bridge 160:5571c4ff569f 1002 CMSIS_INLINE __STATIC_INLINE int32_t __SMMLA(
Anna Bridge 160:5571c4ff569f 1003 int32_t x,
Anna Bridge 160:5571c4ff569f 1004 int32_t y,
Anna Bridge 160:5571c4ff569f 1005 int32_t sum)
Anna Bridge 160:5571c4ff569f 1006 {
Anna Bridge 160:5571c4ff569f 1007 return (sum + (int32_t) (((int64_t) x * y) >> 32));
Anna Bridge 160:5571c4ff569f 1008 }
Anna Bridge 160:5571c4ff569f 1009
Anna Bridge 160:5571c4ff569f 1010 #if 0
Anna Bridge 160:5571c4ff569f 1011 /*
Anna Bridge 160:5571c4ff569f 1012 * @brief C custom defined PKHBT for unavailable DSP extension
Anna Bridge 160:5571c4ff569f 1013 */
Anna Bridge 160:5571c4ff569f 1014 CMSIS_INLINE __STATIC_INLINE uint32_t __PKHBT(
Anna Bridge 160:5571c4ff569f 1015 uint32_t x,
Anna Bridge 160:5571c4ff569f 1016 uint32_t y,
Anna Bridge 160:5571c4ff569f 1017 uint32_t leftshift)
Anna Bridge 160:5571c4ff569f 1018 {
Anna Bridge 160:5571c4ff569f 1019 return ( ((x ) & 0x0000FFFFUL) |
Anna Bridge 160:5571c4ff569f 1020 ((y << leftshift) & 0xFFFF0000UL) );
Anna Bridge 160:5571c4ff569f 1021 }
Anna Bridge 160:5571c4ff569f 1022
Anna Bridge 160:5571c4ff569f 1023 /*
Anna Bridge 160:5571c4ff569f 1024 * @brief C custom defined PKHTB for unavailable DSP extension
Anna Bridge 160:5571c4ff569f 1025 */
Anna Bridge 160:5571c4ff569f 1026 CMSIS_INLINE __STATIC_INLINE uint32_t __PKHTB(
Anna Bridge 160:5571c4ff569f 1027 uint32_t x,
Anna Bridge 160:5571c4ff569f 1028 uint32_t y,
Anna Bridge 160:5571c4ff569f 1029 uint32_t rightshift)
Anna Bridge 160:5571c4ff569f 1030 {
Anna Bridge 160:5571c4ff569f 1031 return ( ((x ) & 0xFFFF0000UL) |
Anna Bridge 160:5571c4ff569f 1032 ((y >> rightshift) & 0x0000FFFFUL) );
Anna Bridge 160:5571c4ff569f 1033 }
Anna Bridge 160:5571c4ff569f 1034 #endif
Anna Bridge 160:5571c4ff569f 1035
Anna Bridge 160:5571c4ff569f 1036 /* #endif // defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
Anna Bridge 160:5571c4ff569f 1037 #endif /* !defined (ARM_MATH_DSP) */
Anna Bridge 160:5571c4ff569f 1038
Anna Bridge 160:5571c4ff569f 1039
Anna Bridge 160:5571c4ff569f 1040 /**
Anna Bridge 160:5571c4ff569f 1041 * @brief Instance structure for the Q7 FIR filter.
Anna Bridge 160:5571c4ff569f 1042 */
Anna Bridge 160:5571c4ff569f 1043 typedef struct
Anna Bridge 160:5571c4ff569f 1044 {
Anna Bridge 160:5571c4ff569f 1045 uint16_t numTaps; /**< number of filter coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 1046 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 1047 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 1048 } arm_fir_instance_q7;
Anna Bridge 160:5571c4ff569f 1049
Anna Bridge 160:5571c4ff569f 1050 /**
Anna Bridge 160:5571c4ff569f 1051 * @brief Instance structure for the Q15 FIR filter.
Anna Bridge 160:5571c4ff569f 1052 */
Anna Bridge 160:5571c4ff569f 1053 typedef struct
Anna Bridge 160:5571c4ff569f 1054 {
Anna Bridge 160:5571c4ff569f 1055 uint16_t numTaps; /**< number of filter coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 1056 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 1057 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 1058 } arm_fir_instance_q15;
Anna Bridge 160:5571c4ff569f 1059
Anna Bridge 160:5571c4ff569f 1060 /**
Anna Bridge 160:5571c4ff569f 1061 * @brief Instance structure for the Q31 FIR filter.
Anna Bridge 160:5571c4ff569f 1062 */
Anna Bridge 160:5571c4ff569f 1063 typedef struct
Anna Bridge 160:5571c4ff569f 1064 {
Anna Bridge 160:5571c4ff569f 1065 uint16_t numTaps; /**< number of filter coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 1066 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 1067 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 1068 } arm_fir_instance_q31;
Anna Bridge 160:5571c4ff569f 1069
Anna Bridge 160:5571c4ff569f 1070 /**
Anna Bridge 160:5571c4ff569f 1071 * @brief Instance structure for the floating-point FIR filter.
Anna Bridge 160:5571c4ff569f 1072 */
Anna Bridge 160:5571c4ff569f 1073 typedef struct
Anna Bridge 160:5571c4ff569f 1074 {
Anna Bridge 160:5571c4ff569f 1075 uint16_t numTaps; /**< number of filter coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 1076 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 1077 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 1078 } arm_fir_instance_f32;
Anna Bridge 160:5571c4ff569f 1079
Anna Bridge 160:5571c4ff569f 1080
Anna Bridge 160:5571c4ff569f 1081 /**
Anna Bridge 160:5571c4ff569f 1082 * @brief Processing function for the Q7 FIR filter.
Anna Bridge 160:5571c4ff569f 1083 * @param[in] S points to an instance of the Q7 FIR filter structure.
Anna Bridge 160:5571c4ff569f 1084 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1085 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1086 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1087 */
Anna Bridge 160:5571c4ff569f 1088 void arm_fir_q7(
Anna Bridge 160:5571c4ff569f 1089 const arm_fir_instance_q7 * S,
Anna Bridge 160:5571c4ff569f 1090 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 1091 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 1092 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1093
Anna Bridge 160:5571c4ff569f 1094
Anna Bridge 160:5571c4ff569f 1095 /**
Anna Bridge 160:5571c4ff569f 1096 * @brief Initialization function for the Q7 FIR filter.
Anna Bridge 160:5571c4ff569f 1097 * @param[in,out] S points to an instance of the Q7 FIR structure.
Anna Bridge 160:5571c4ff569f 1098 * @param[in] numTaps Number of filter coefficients in the filter.
Anna Bridge 160:5571c4ff569f 1099 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1100 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1101 * @param[in] blockSize number of samples that are processed.
Anna Bridge 160:5571c4ff569f 1102 */
Anna Bridge 160:5571c4ff569f 1103 void arm_fir_init_q7(
Anna Bridge 160:5571c4ff569f 1104 arm_fir_instance_q7 * S,
Anna Bridge 160:5571c4ff569f 1105 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 1106 q7_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1107 q7_t * pState,
Anna Bridge 160:5571c4ff569f 1108 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1109
Anna Bridge 160:5571c4ff569f 1110
Anna Bridge 160:5571c4ff569f 1111 /**
Anna Bridge 160:5571c4ff569f 1112 * @brief Processing function for the Q15 FIR filter.
Anna Bridge 160:5571c4ff569f 1113 * @param[in] S points to an instance of the Q15 FIR structure.
Anna Bridge 160:5571c4ff569f 1114 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1115 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1116 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1117 */
Anna Bridge 160:5571c4ff569f 1118 void arm_fir_q15(
Anna Bridge 160:5571c4ff569f 1119 const arm_fir_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1120 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 1121 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 1122 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1123
Anna Bridge 160:5571c4ff569f 1124
Anna Bridge 160:5571c4ff569f 1125 /**
Anna Bridge 160:5571c4ff569f 1126 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 1127 * @param[in] S points to an instance of the Q15 FIR filter structure.
Anna Bridge 160:5571c4ff569f 1128 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1129 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1130 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1131 */
Anna Bridge 160:5571c4ff569f 1132 void arm_fir_fast_q15(
Anna Bridge 160:5571c4ff569f 1133 const arm_fir_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1134 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 1135 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 1136 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1137
Anna Bridge 160:5571c4ff569f 1138
Anna Bridge 160:5571c4ff569f 1139 /**
Anna Bridge 160:5571c4ff569f 1140 * @brief Initialization function for the Q15 FIR filter.
Anna Bridge 160:5571c4ff569f 1141 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
Anna Bridge 160:5571c4ff569f 1142 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
Anna Bridge 160:5571c4ff569f 1143 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1144 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1145 * @param[in] blockSize number of samples that are processed at a time.
Anna Bridge 160:5571c4ff569f 1146 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
Anna Bridge 160:5571c4ff569f 1147 * <code>numTaps</code> is not a supported value.
Anna Bridge 160:5571c4ff569f 1148 */
Anna Bridge 160:5571c4ff569f 1149 arm_status arm_fir_init_q15(
Anna Bridge 160:5571c4ff569f 1150 arm_fir_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1151 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 1152 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1153 q15_t * pState,
Anna Bridge 160:5571c4ff569f 1154 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1155
Anna Bridge 160:5571c4ff569f 1156
Anna Bridge 160:5571c4ff569f 1157 /**
Anna Bridge 160:5571c4ff569f 1158 * @brief Processing function for the Q31 FIR filter.
Anna Bridge 160:5571c4ff569f 1159 * @param[in] S points to an instance of the Q31 FIR filter structure.
Anna Bridge 160:5571c4ff569f 1160 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1161 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1162 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1163 */
Anna Bridge 160:5571c4ff569f 1164 void arm_fir_q31(
Anna Bridge 160:5571c4ff569f 1165 const arm_fir_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 1166 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 1167 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 1168 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1169
Anna Bridge 160:5571c4ff569f 1170
Anna Bridge 160:5571c4ff569f 1171 /**
Anna Bridge 160:5571c4ff569f 1172 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 1173 * @param[in] S points to an instance of the Q31 FIR structure.
Anna Bridge 160:5571c4ff569f 1174 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1175 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1176 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1177 */
Anna Bridge 160:5571c4ff569f 1178 void arm_fir_fast_q31(
Anna Bridge 160:5571c4ff569f 1179 const arm_fir_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 1180 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 1181 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 1182 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1183
Anna Bridge 160:5571c4ff569f 1184
Anna Bridge 160:5571c4ff569f 1185 /**
Anna Bridge 160:5571c4ff569f 1186 * @brief Initialization function for the Q31 FIR filter.
Anna Bridge 160:5571c4ff569f 1187 * @param[in,out] S points to an instance of the Q31 FIR structure.
Anna Bridge 160:5571c4ff569f 1188 * @param[in] numTaps Number of filter coefficients in the filter.
Anna Bridge 160:5571c4ff569f 1189 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1190 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1191 * @param[in] blockSize number of samples that are processed at a time.
Anna Bridge 160:5571c4ff569f 1192 */
Anna Bridge 160:5571c4ff569f 1193 void arm_fir_init_q31(
Anna Bridge 160:5571c4ff569f 1194 arm_fir_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 1195 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 1196 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1197 q31_t * pState,
Anna Bridge 160:5571c4ff569f 1198 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1199
Anna Bridge 160:5571c4ff569f 1200
Anna Bridge 160:5571c4ff569f 1201 /**
Anna Bridge 160:5571c4ff569f 1202 * @brief Processing function for the floating-point FIR filter.
Anna Bridge 160:5571c4ff569f 1203 * @param[in] S points to an instance of the floating-point FIR structure.
Anna Bridge 160:5571c4ff569f 1204 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1205 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1206 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1207 */
Anna Bridge 160:5571c4ff569f 1208 void arm_fir_f32(
Anna Bridge 160:5571c4ff569f 1209 const arm_fir_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 1210 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 1211 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 1212 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1213
Anna Bridge 160:5571c4ff569f 1214
Anna Bridge 160:5571c4ff569f 1215 /**
Anna Bridge 160:5571c4ff569f 1216 * @brief Initialization function for the floating-point FIR filter.
Anna Bridge 160:5571c4ff569f 1217 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
Anna Bridge 160:5571c4ff569f 1218 * @param[in] numTaps Number of filter coefficients in the filter.
Anna Bridge 160:5571c4ff569f 1219 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1220 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1221 * @param[in] blockSize number of samples that are processed at a time.
Anna Bridge 160:5571c4ff569f 1222 */
Anna Bridge 160:5571c4ff569f 1223 void arm_fir_init_f32(
Anna Bridge 160:5571c4ff569f 1224 arm_fir_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 1225 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 1226 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1227 float32_t * pState,
Anna Bridge 160:5571c4ff569f 1228 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1229
Anna Bridge 160:5571c4ff569f 1230
Anna Bridge 160:5571c4ff569f 1231 /**
Anna Bridge 160:5571c4ff569f 1232 * @brief Instance structure for the Q15 Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1233 */
Anna Bridge 160:5571c4ff569f 1234 typedef struct
Anna Bridge 160:5571c4ff569f 1235 {
Anna Bridge 160:5571c4ff569f 1236 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 1237 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
Anna Bridge 160:5571c4ff569f 1238 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 1239 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
Anna Bridge 160:5571c4ff569f 1240 } arm_biquad_casd_df1_inst_q15;
Anna Bridge 160:5571c4ff569f 1241
Anna Bridge 160:5571c4ff569f 1242 /**
Anna Bridge 160:5571c4ff569f 1243 * @brief Instance structure for the Q31 Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1244 */
Anna Bridge 160:5571c4ff569f 1245 typedef struct
Anna Bridge 160:5571c4ff569f 1246 {
Anna Bridge 160:5571c4ff569f 1247 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 1248 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
Anna Bridge 160:5571c4ff569f 1249 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 1250 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
Anna Bridge 160:5571c4ff569f 1251 } arm_biquad_casd_df1_inst_q31;
Anna Bridge 160:5571c4ff569f 1252
Anna Bridge 160:5571c4ff569f 1253 /**
Anna Bridge 160:5571c4ff569f 1254 * @brief Instance structure for the floating-point Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1255 */
Anna Bridge 160:5571c4ff569f 1256 typedef struct
Anna Bridge 160:5571c4ff569f 1257 {
Anna Bridge 160:5571c4ff569f 1258 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 1259 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
Anna Bridge 160:5571c4ff569f 1260 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 1261 } arm_biquad_casd_df1_inst_f32;
Anna Bridge 160:5571c4ff569f 1262
Anna Bridge 160:5571c4ff569f 1263
Anna Bridge 160:5571c4ff569f 1264 /**
Anna Bridge 160:5571c4ff569f 1265 * @brief Processing function for the Q15 Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1266 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1267 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1268 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1269 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1270 */
Anna Bridge 160:5571c4ff569f 1271 void arm_biquad_cascade_df1_q15(
Anna Bridge 160:5571c4ff569f 1272 const arm_biquad_casd_df1_inst_q15 * S,
Anna Bridge 160:5571c4ff569f 1273 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 1274 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 1275 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1276
Anna Bridge 160:5571c4ff569f 1277
Anna Bridge 160:5571c4ff569f 1278 /**
Anna Bridge 160:5571c4ff569f 1279 * @brief Initialization function for the Q15 Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1280 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1281 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 1282 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1283 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1284 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
Anna Bridge 160:5571c4ff569f 1285 */
Anna Bridge 160:5571c4ff569f 1286 void arm_biquad_cascade_df1_init_q15(
Anna Bridge 160:5571c4ff569f 1287 arm_biquad_casd_df1_inst_q15 * S,
Anna Bridge 160:5571c4ff569f 1288 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 1289 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1290 q15_t * pState,
Anna Bridge 160:5571c4ff569f 1291 int8_t postShift);
Anna Bridge 160:5571c4ff569f 1292
Anna Bridge 160:5571c4ff569f 1293
Anna Bridge 160:5571c4ff569f 1294 /**
Anna Bridge 160:5571c4ff569f 1295 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 1296 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1297 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1298 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1299 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1300 */
Anna Bridge 160:5571c4ff569f 1301 void arm_biquad_cascade_df1_fast_q15(
Anna Bridge 160:5571c4ff569f 1302 const arm_biquad_casd_df1_inst_q15 * S,
Anna Bridge 160:5571c4ff569f 1303 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 1304 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 1305 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1306
Anna Bridge 160:5571c4ff569f 1307
Anna Bridge 160:5571c4ff569f 1308 /**
Anna Bridge 160:5571c4ff569f 1309 * @brief Processing function for the Q31 Biquad cascade filter
Anna Bridge 160:5571c4ff569f 1310 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1311 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1312 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1313 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1314 */
Anna Bridge 160:5571c4ff569f 1315 void arm_biquad_cascade_df1_q31(
Anna Bridge 160:5571c4ff569f 1316 const arm_biquad_casd_df1_inst_q31 * S,
Anna Bridge 160:5571c4ff569f 1317 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 1318 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 1319 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1320
Anna Bridge 160:5571c4ff569f 1321
Anna Bridge 160:5571c4ff569f 1322 /**
Anna Bridge 160:5571c4ff569f 1323 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 1324 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1325 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1326 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1327 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1328 */
Anna Bridge 160:5571c4ff569f 1329 void arm_biquad_cascade_df1_fast_q31(
Anna Bridge 160:5571c4ff569f 1330 const arm_biquad_casd_df1_inst_q31 * S,
Anna Bridge 160:5571c4ff569f 1331 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 1332 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 1333 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1334
Anna Bridge 160:5571c4ff569f 1335
Anna Bridge 160:5571c4ff569f 1336 /**
Anna Bridge 160:5571c4ff569f 1337 * @brief Initialization function for the Q31 Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1338 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1339 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 1340 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1341 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1342 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
Anna Bridge 160:5571c4ff569f 1343 */
Anna Bridge 160:5571c4ff569f 1344 void arm_biquad_cascade_df1_init_q31(
Anna Bridge 160:5571c4ff569f 1345 arm_biquad_casd_df1_inst_q31 * S,
Anna Bridge 160:5571c4ff569f 1346 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 1347 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1348 q31_t * pState,
Anna Bridge 160:5571c4ff569f 1349 int8_t postShift);
Anna Bridge 160:5571c4ff569f 1350
Anna Bridge 160:5571c4ff569f 1351
Anna Bridge 160:5571c4ff569f 1352 /**
Anna Bridge 160:5571c4ff569f 1353 * @brief Processing function for the floating-point Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1354 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1355 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 1356 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 1357 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 1358 */
Anna Bridge 160:5571c4ff569f 1359 void arm_biquad_cascade_df1_f32(
Anna Bridge 160:5571c4ff569f 1360 const arm_biquad_casd_df1_inst_f32 * S,
Anna Bridge 160:5571c4ff569f 1361 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 1362 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 1363 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1364
Anna Bridge 160:5571c4ff569f 1365
Anna Bridge 160:5571c4ff569f 1366 /**
Anna Bridge 160:5571c4ff569f 1367 * @brief Initialization function for the floating-point Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 1368 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
Anna Bridge 160:5571c4ff569f 1369 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 1370 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 1371 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 1372 */
Anna Bridge 160:5571c4ff569f 1373 void arm_biquad_cascade_df1_init_f32(
Anna Bridge 160:5571c4ff569f 1374 arm_biquad_casd_df1_inst_f32 * S,
Anna Bridge 160:5571c4ff569f 1375 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 1376 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 1377 float32_t * pState);
Anna Bridge 160:5571c4ff569f 1378
Anna Bridge 160:5571c4ff569f 1379
Anna Bridge 160:5571c4ff569f 1380 /**
Anna Bridge 160:5571c4ff569f 1381 * @brief Instance structure for the floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 1382 */
Anna Bridge 160:5571c4ff569f 1383 typedef struct
Anna Bridge 160:5571c4ff569f 1384 {
Anna Bridge 160:5571c4ff569f 1385 uint16_t numRows; /**< number of rows of the matrix. */
Anna Bridge 160:5571c4ff569f 1386 uint16_t numCols; /**< number of columns of the matrix. */
Anna Bridge 160:5571c4ff569f 1387 float32_t *pData; /**< points to the data of the matrix. */
Anna Bridge 160:5571c4ff569f 1388 } arm_matrix_instance_f32;
Anna Bridge 160:5571c4ff569f 1389
Anna Bridge 160:5571c4ff569f 1390
Anna Bridge 160:5571c4ff569f 1391 /**
Anna Bridge 160:5571c4ff569f 1392 * @brief Instance structure for the floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 1393 */
Anna Bridge 160:5571c4ff569f 1394 typedef struct
Anna Bridge 160:5571c4ff569f 1395 {
Anna Bridge 160:5571c4ff569f 1396 uint16_t numRows; /**< number of rows of the matrix. */
Anna Bridge 160:5571c4ff569f 1397 uint16_t numCols; /**< number of columns of the matrix. */
Anna Bridge 160:5571c4ff569f 1398 float64_t *pData; /**< points to the data of the matrix. */
Anna Bridge 160:5571c4ff569f 1399 } arm_matrix_instance_f64;
Anna Bridge 160:5571c4ff569f 1400
Anna Bridge 160:5571c4ff569f 1401 /**
Anna Bridge 160:5571c4ff569f 1402 * @brief Instance structure for the Q15 matrix structure.
Anna Bridge 160:5571c4ff569f 1403 */
Anna Bridge 160:5571c4ff569f 1404 typedef struct
Anna Bridge 160:5571c4ff569f 1405 {
Anna Bridge 160:5571c4ff569f 1406 uint16_t numRows; /**< number of rows of the matrix. */
Anna Bridge 160:5571c4ff569f 1407 uint16_t numCols; /**< number of columns of the matrix. */
Anna Bridge 160:5571c4ff569f 1408 q15_t *pData; /**< points to the data of the matrix. */
Anna Bridge 160:5571c4ff569f 1409 } arm_matrix_instance_q15;
Anna Bridge 160:5571c4ff569f 1410
Anna Bridge 160:5571c4ff569f 1411 /**
Anna Bridge 160:5571c4ff569f 1412 * @brief Instance structure for the Q31 matrix structure.
Anna Bridge 160:5571c4ff569f 1413 */
Anna Bridge 160:5571c4ff569f 1414 typedef struct
Anna Bridge 160:5571c4ff569f 1415 {
Anna Bridge 160:5571c4ff569f 1416 uint16_t numRows; /**< number of rows of the matrix. */
Anna Bridge 160:5571c4ff569f 1417 uint16_t numCols; /**< number of columns of the matrix. */
Anna Bridge 160:5571c4ff569f 1418 q31_t *pData; /**< points to the data of the matrix. */
Anna Bridge 160:5571c4ff569f 1419 } arm_matrix_instance_q31;
Anna Bridge 160:5571c4ff569f 1420
Anna Bridge 160:5571c4ff569f 1421
Anna Bridge 160:5571c4ff569f 1422 /**
Anna Bridge 160:5571c4ff569f 1423 * @brief Floating-point matrix addition.
Anna Bridge 160:5571c4ff569f 1424 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1425 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1426 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1427 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1428 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1429 */
Anna Bridge 160:5571c4ff569f 1430 arm_status arm_mat_add_f32(
Anna Bridge 160:5571c4ff569f 1431 const arm_matrix_instance_f32 * pSrcA,
Anna Bridge 160:5571c4ff569f 1432 const arm_matrix_instance_f32 * pSrcB,
Anna Bridge 160:5571c4ff569f 1433 arm_matrix_instance_f32 * pDst);
Anna Bridge 160:5571c4ff569f 1434
Anna Bridge 160:5571c4ff569f 1435
Anna Bridge 160:5571c4ff569f 1436 /**
Anna Bridge 160:5571c4ff569f 1437 * @brief Q15 matrix addition.
Anna Bridge 160:5571c4ff569f 1438 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1439 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1440 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1441 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1442 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1443 */
Anna Bridge 160:5571c4ff569f 1444 arm_status arm_mat_add_q15(
Anna Bridge 160:5571c4ff569f 1445 const arm_matrix_instance_q15 * pSrcA,
Anna Bridge 160:5571c4ff569f 1446 const arm_matrix_instance_q15 * pSrcB,
Anna Bridge 160:5571c4ff569f 1447 arm_matrix_instance_q15 * pDst);
Anna Bridge 160:5571c4ff569f 1448
Anna Bridge 160:5571c4ff569f 1449
Anna Bridge 160:5571c4ff569f 1450 /**
Anna Bridge 160:5571c4ff569f 1451 * @brief Q31 matrix addition.
Anna Bridge 160:5571c4ff569f 1452 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1453 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1454 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1455 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1456 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1457 */
Anna Bridge 160:5571c4ff569f 1458 arm_status arm_mat_add_q31(
Anna Bridge 160:5571c4ff569f 1459 const arm_matrix_instance_q31 * pSrcA,
Anna Bridge 160:5571c4ff569f 1460 const arm_matrix_instance_q31 * pSrcB,
Anna Bridge 160:5571c4ff569f 1461 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1462
Anna Bridge 160:5571c4ff569f 1463
Anna Bridge 160:5571c4ff569f 1464 /**
Anna Bridge 160:5571c4ff569f 1465 * @brief Floating-point, complex, matrix multiplication.
Anna Bridge 160:5571c4ff569f 1466 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1467 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1468 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1469 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1470 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1471 */
Anna Bridge 160:5571c4ff569f 1472 arm_status arm_mat_cmplx_mult_f32(
Anna Bridge 160:5571c4ff569f 1473 const arm_matrix_instance_f32 * pSrcA,
Anna Bridge 160:5571c4ff569f 1474 const arm_matrix_instance_f32 * pSrcB,
Anna Bridge 160:5571c4ff569f 1475 arm_matrix_instance_f32 * pDst);
Anna Bridge 160:5571c4ff569f 1476
Anna Bridge 160:5571c4ff569f 1477
Anna Bridge 160:5571c4ff569f 1478 /**
Anna Bridge 160:5571c4ff569f 1479 * @brief Q15, complex, matrix multiplication.
Anna Bridge 160:5571c4ff569f 1480 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1481 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1482 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1483 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1484 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1485 */
Anna Bridge 160:5571c4ff569f 1486 arm_status arm_mat_cmplx_mult_q15(
Anna Bridge 160:5571c4ff569f 1487 const arm_matrix_instance_q15 * pSrcA,
Anna Bridge 160:5571c4ff569f 1488 const arm_matrix_instance_q15 * pSrcB,
Anna Bridge 160:5571c4ff569f 1489 arm_matrix_instance_q15 * pDst,
Anna Bridge 160:5571c4ff569f 1490 q15_t * pScratch);
Anna Bridge 160:5571c4ff569f 1491
Anna Bridge 160:5571c4ff569f 1492
Anna Bridge 160:5571c4ff569f 1493 /**
Anna Bridge 160:5571c4ff569f 1494 * @brief Q31, complex, matrix multiplication.
Anna Bridge 160:5571c4ff569f 1495 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1496 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1497 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1498 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1499 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1500 */
Anna Bridge 160:5571c4ff569f 1501 arm_status arm_mat_cmplx_mult_q31(
Anna Bridge 160:5571c4ff569f 1502 const arm_matrix_instance_q31 * pSrcA,
Anna Bridge 160:5571c4ff569f 1503 const arm_matrix_instance_q31 * pSrcB,
Anna Bridge 160:5571c4ff569f 1504 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1505
Anna Bridge 160:5571c4ff569f 1506
Anna Bridge 160:5571c4ff569f 1507 /**
Anna Bridge 160:5571c4ff569f 1508 * @brief Floating-point matrix transpose.
Anna Bridge 160:5571c4ff569f 1509 * @param[in] pSrc points to the input matrix
Anna Bridge 160:5571c4ff569f 1510 * @param[out] pDst points to the output matrix
Anna Bridge 160:5571c4ff569f 1511 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
Anna Bridge 160:5571c4ff569f 1512 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1513 */
Anna Bridge 160:5571c4ff569f 1514 arm_status arm_mat_trans_f32(
Anna Bridge 160:5571c4ff569f 1515 const arm_matrix_instance_f32 * pSrc,
Anna Bridge 160:5571c4ff569f 1516 arm_matrix_instance_f32 * pDst);
Anna Bridge 160:5571c4ff569f 1517
Anna Bridge 160:5571c4ff569f 1518
Anna Bridge 160:5571c4ff569f 1519 /**
Anna Bridge 160:5571c4ff569f 1520 * @brief Q15 matrix transpose.
Anna Bridge 160:5571c4ff569f 1521 * @param[in] pSrc points to the input matrix
Anna Bridge 160:5571c4ff569f 1522 * @param[out] pDst points to the output matrix
Anna Bridge 160:5571c4ff569f 1523 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
Anna Bridge 160:5571c4ff569f 1524 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1525 */
Anna Bridge 160:5571c4ff569f 1526 arm_status arm_mat_trans_q15(
Anna Bridge 160:5571c4ff569f 1527 const arm_matrix_instance_q15 * pSrc,
Anna Bridge 160:5571c4ff569f 1528 arm_matrix_instance_q15 * pDst);
Anna Bridge 160:5571c4ff569f 1529
Anna Bridge 160:5571c4ff569f 1530
Anna Bridge 160:5571c4ff569f 1531 /**
Anna Bridge 160:5571c4ff569f 1532 * @brief Q31 matrix transpose.
Anna Bridge 160:5571c4ff569f 1533 * @param[in] pSrc points to the input matrix
Anna Bridge 160:5571c4ff569f 1534 * @param[out] pDst points to the output matrix
Anna Bridge 160:5571c4ff569f 1535 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
Anna Bridge 160:5571c4ff569f 1536 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1537 */
Anna Bridge 160:5571c4ff569f 1538 arm_status arm_mat_trans_q31(
Anna Bridge 160:5571c4ff569f 1539 const arm_matrix_instance_q31 * pSrc,
Anna Bridge 160:5571c4ff569f 1540 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1541
Anna Bridge 160:5571c4ff569f 1542
Anna Bridge 160:5571c4ff569f 1543 /**
Anna Bridge 160:5571c4ff569f 1544 * @brief Floating-point matrix multiplication
Anna Bridge 160:5571c4ff569f 1545 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1546 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1547 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1548 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1549 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1550 */
Anna Bridge 160:5571c4ff569f 1551 arm_status arm_mat_mult_f32(
Anna Bridge 160:5571c4ff569f 1552 const arm_matrix_instance_f32 * pSrcA,
Anna Bridge 160:5571c4ff569f 1553 const arm_matrix_instance_f32 * pSrcB,
Anna Bridge 160:5571c4ff569f 1554 arm_matrix_instance_f32 * pDst);
Anna Bridge 160:5571c4ff569f 1555
Anna Bridge 160:5571c4ff569f 1556
Anna Bridge 160:5571c4ff569f 1557 /**
Anna Bridge 160:5571c4ff569f 1558 * @brief Q15 matrix multiplication
Anna Bridge 160:5571c4ff569f 1559 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1560 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1561 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1562 * @param[in] pState points to the array for storing intermediate results
Anna Bridge 160:5571c4ff569f 1563 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1564 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1565 */
Anna Bridge 160:5571c4ff569f 1566 arm_status arm_mat_mult_q15(
Anna Bridge 160:5571c4ff569f 1567 const arm_matrix_instance_q15 * pSrcA,
Anna Bridge 160:5571c4ff569f 1568 const arm_matrix_instance_q15 * pSrcB,
Anna Bridge 160:5571c4ff569f 1569 arm_matrix_instance_q15 * pDst,
Anna Bridge 160:5571c4ff569f 1570 q15_t * pState);
Anna Bridge 160:5571c4ff569f 1571
Anna Bridge 160:5571c4ff569f 1572
Anna Bridge 160:5571c4ff569f 1573 /**
Anna Bridge 160:5571c4ff569f 1574 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 1575 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1576 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1577 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1578 * @param[in] pState points to the array for storing intermediate results
Anna Bridge 160:5571c4ff569f 1579 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1580 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1581 */
Anna Bridge 160:5571c4ff569f 1582 arm_status arm_mat_mult_fast_q15(
Anna Bridge 160:5571c4ff569f 1583 const arm_matrix_instance_q15 * pSrcA,
Anna Bridge 160:5571c4ff569f 1584 const arm_matrix_instance_q15 * pSrcB,
Anna Bridge 160:5571c4ff569f 1585 arm_matrix_instance_q15 * pDst,
Anna Bridge 160:5571c4ff569f 1586 q15_t * pState);
Anna Bridge 160:5571c4ff569f 1587
Anna Bridge 160:5571c4ff569f 1588
Anna Bridge 160:5571c4ff569f 1589 /**
Anna Bridge 160:5571c4ff569f 1590 * @brief Q31 matrix multiplication
Anna Bridge 160:5571c4ff569f 1591 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1592 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1593 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1594 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1595 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1596 */
Anna Bridge 160:5571c4ff569f 1597 arm_status arm_mat_mult_q31(
Anna Bridge 160:5571c4ff569f 1598 const arm_matrix_instance_q31 * pSrcA,
Anna Bridge 160:5571c4ff569f 1599 const arm_matrix_instance_q31 * pSrcB,
Anna Bridge 160:5571c4ff569f 1600 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1601
Anna Bridge 160:5571c4ff569f 1602
Anna Bridge 160:5571c4ff569f 1603 /**
Anna Bridge 160:5571c4ff569f 1604 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 1605 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1606 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1607 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1608 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1609 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1610 */
Anna Bridge 160:5571c4ff569f 1611 arm_status arm_mat_mult_fast_q31(
Anna Bridge 160:5571c4ff569f 1612 const arm_matrix_instance_q31 * pSrcA,
Anna Bridge 160:5571c4ff569f 1613 const arm_matrix_instance_q31 * pSrcB,
Anna Bridge 160:5571c4ff569f 1614 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1615
Anna Bridge 160:5571c4ff569f 1616
Anna Bridge 160:5571c4ff569f 1617 /**
Anna Bridge 160:5571c4ff569f 1618 * @brief Floating-point matrix subtraction
Anna Bridge 160:5571c4ff569f 1619 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1620 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1621 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1622 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1623 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1624 */
Anna Bridge 160:5571c4ff569f 1625 arm_status arm_mat_sub_f32(
Anna Bridge 160:5571c4ff569f 1626 const arm_matrix_instance_f32 * pSrcA,
Anna Bridge 160:5571c4ff569f 1627 const arm_matrix_instance_f32 * pSrcB,
Anna Bridge 160:5571c4ff569f 1628 arm_matrix_instance_f32 * pDst);
Anna Bridge 160:5571c4ff569f 1629
Anna Bridge 160:5571c4ff569f 1630
Anna Bridge 160:5571c4ff569f 1631 /**
Anna Bridge 160:5571c4ff569f 1632 * @brief Q15 matrix subtraction
Anna Bridge 160:5571c4ff569f 1633 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1634 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1635 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1636 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1637 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1638 */
Anna Bridge 160:5571c4ff569f 1639 arm_status arm_mat_sub_q15(
Anna Bridge 160:5571c4ff569f 1640 const arm_matrix_instance_q15 * pSrcA,
Anna Bridge 160:5571c4ff569f 1641 const arm_matrix_instance_q15 * pSrcB,
Anna Bridge 160:5571c4ff569f 1642 arm_matrix_instance_q15 * pDst);
Anna Bridge 160:5571c4ff569f 1643
Anna Bridge 160:5571c4ff569f 1644
Anna Bridge 160:5571c4ff569f 1645 /**
Anna Bridge 160:5571c4ff569f 1646 * @brief Q31 matrix subtraction
Anna Bridge 160:5571c4ff569f 1647 * @param[in] pSrcA points to the first input matrix structure
Anna Bridge 160:5571c4ff569f 1648 * @param[in] pSrcB points to the second input matrix structure
Anna Bridge 160:5571c4ff569f 1649 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1650 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1651 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1652 */
Anna Bridge 160:5571c4ff569f 1653 arm_status arm_mat_sub_q31(
Anna Bridge 160:5571c4ff569f 1654 const arm_matrix_instance_q31 * pSrcA,
Anna Bridge 160:5571c4ff569f 1655 const arm_matrix_instance_q31 * pSrcB,
Anna Bridge 160:5571c4ff569f 1656 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1657
Anna Bridge 160:5571c4ff569f 1658
Anna Bridge 160:5571c4ff569f 1659 /**
Anna Bridge 160:5571c4ff569f 1660 * @brief Floating-point matrix scaling.
Anna Bridge 160:5571c4ff569f 1661 * @param[in] pSrc points to the input matrix
Anna Bridge 160:5571c4ff569f 1662 * @param[in] scale scale factor
Anna Bridge 160:5571c4ff569f 1663 * @param[out] pDst points to the output matrix
Anna Bridge 160:5571c4ff569f 1664 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1665 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1666 */
Anna Bridge 160:5571c4ff569f 1667 arm_status arm_mat_scale_f32(
Anna Bridge 160:5571c4ff569f 1668 const arm_matrix_instance_f32 * pSrc,
Anna Bridge 160:5571c4ff569f 1669 float32_t scale,
Anna Bridge 160:5571c4ff569f 1670 arm_matrix_instance_f32 * pDst);
Anna Bridge 160:5571c4ff569f 1671
Anna Bridge 160:5571c4ff569f 1672
Anna Bridge 160:5571c4ff569f 1673 /**
Anna Bridge 160:5571c4ff569f 1674 * @brief Q15 matrix scaling.
Anna Bridge 160:5571c4ff569f 1675 * @param[in] pSrc points to input matrix
Anna Bridge 160:5571c4ff569f 1676 * @param[in] scaleFract fractional portion of the scale factor
Anna Bridge 160:5571c4ff569f 1677 * @param[in] shift number of bits to shift the result by
Anna Bridge 160:5571c4ff569f 1678 * @param[out] pDst points to output matrix
Anna Bridge 160:5571c4ff569f 1679 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1680 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1681 */
Anna Bridge 160:5571c4ff569f 1682 arm_status arm_mat_scale_q15(
Anna Bridge 160:5571c4ff569f 1683 const arm_matrix_instance_q15 * pSrc,
Anna Bridge 160:5571c4ff569f 1684 q15_t scaleFract,
Anna Bridge 160:5571c4ff569f 1685 int32_t shift,
Anna Bridge 160:5571c4ff569f 1686 arm_matrix_instance_q15 * pDst);
Anna Bridge 160:5571c4ff569f 1687
Anna Bridge 160:5571c4ff569f 1688
Anna Bridge 160:5571c4ff569f 1689 /**
Anna Bridge 160:5571c4ff569f 1690 * @brief Q31 matrix scaling.
Anna Bridge 160:5571c4ff569f 1691 * @param[in] pSrc points to input matrix
Anna Bridge 160:5571c4ff569f 1692 * @param[in] scaleFract fractional portion of the scale factor
Anna Bridge 160:5571c4ff569f 1693 * @param[in] shift number of bits to shift the result by
Anna Bridge 160:5571c4ff569f 1694 * @param[out] pDst points to output matrix structure
Anna Bridge 160:5571c4ff569f 1695 * @return The function returns either
Anna Bridge 160:5571c4ff569f 1696 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
Anna Bridge 160:5571c4ff569f 1697 */
Anna Bridge 160:5571c4ff569f 1698 arm_status arm_mat_scale_q31(
Anna Bridge 160:5571c4ff569f 1699 const arm_matrix_instance_q31 * pSrc,
Anna Bridge 160:5571c4ff569f 1700 q31_t scaleFract,
Anna Bridge 160:5571c4ff569f 1701 int32_t shift,
Anna Bridge 160:5571c4ff569f 1702 arm_matrix_instance_q31 * pDst);
Anna Bridge 160:5571c4ff569f 1703
Anna Bridge 160:5571c4ff569f 1704
Anna Bridge 160:5571c4ff569f 1705 /**
Anna Bridge 160:5571c4ff569f 1706 * @brief Q31 matrix initialization.
Anna Bridge 160:5571c4ff569f 1707 * @param[in,out] S points to an instance of the floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 1708 * @param[in] nRows number of rows in the matrix.
Anna Bridge 160:5571c4ff569f 1709 * @param[in] nColumns number of columns in the matrix.
Anna Bridge 160:5571c4ff569f 1710 * @param[in] pData points to the matrix data array.
Anna Bridge 160:5571c4ff569f 1711 */
Anna Bridge 160:5571c4ff569f 1712 void arm_mat_init_q31(
Anna Bridge 160:5571c4ff569f 1713 arm_matrix_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 1714 uint16_t nRows,
Anna Bridge 160:5571c4ff569f 1715 uint16_t nColumns,
Anna Bridge 160:5571c4ff569f 1716 q31_t * pData);
Anna Bridge 160:5571c4ff569f 1717
Anna Bridge 160:5571c4ff569f 1718
Anna Bridge 160:5571c4ff569f 1719 /**
Anna Bridge 160:5571c4ff569f 1720 * @brief Q15 matrix initialization.
Anna Bridge 160:5571c4ff569f 1721 * @param[in,out] S points to an instance of the floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 1722 * @param[in] nRows number of rows in the matrix.
Anna Bridge 160:5571c4ff569f 1723 * @param[in] nColumns number of columns in the matrix.
Anna Bridge 160:5571c4ff569f 1724 * @param[in] pData points to the matrix data array.
Anna Bridge 160:5571c4ff569f 1725 */
Anna Bridge 160:5571c4ff569f 1726 void arm_mat_init_q15(
Anna Bridge 160:5571c4ff569f 1727 arm_matrix_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1728 uint16_t nRows,
Anna Bridge 160:5571c4ff569f 1729 uint16_t nColumns,
Anna Bridge 160:5571c4ff569f 1730 q15_t * pData);
Anna Bridge 160:5571c4ff569f 1731
Anna Bridge 160:5571c4ff569f 1732
Anna Bridge 160:5571c4ff569f 1733 /**
Anna Bridge 160:5571c4ff569f 1734 * @brief Floating-point matrix initialization.
Anna Bridge 160:5571c4ff569f 1735 * @param[in,out] S points to an instance of the floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 1736 * @param[in] nRows number of rows in the matrix.
Anna Bridge 160:5571c4ff569f 1737 * @param[in] nColumns number of columns in the matrix.
Anna Bridge 160:5571c4ff569f 1738 * @param[in] pData points to the matrix data array.
Anna Bridge 160:5571c4ff569f 1739 */
Anna Bridge 160:5571c4ff569f 1740 void arm_mat_init_f32(
Anna Bridge 160:5571c4ff569f 1741 arm_matrix_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 1742 uint16_t nRows,
Anna Bridge 160:5571c4ff569f 1743 uint16_t nColumns,
Anna Bridge 160:5571c4ff569f 1744 float32_t * pData);
Anna Bridge 160:5571c4ff569f 1745
Anna Bridge 160:5571c4ff569f 1746
Anna Bridge 160:5571c4ff569f 1747
Anna Bridge 160:5571c4ff569f 1748 /**
Anna Bridge 160:5571c4ff569f 1749 * @brief Instance structure for the Q15 PID Control.
Anna Bridge 160:5571c4ff569f 1750 */
Anna Bridge 160:5571c4ff569f 1751 typedef struct
Anna Bridge 160:5571c4ff569f 1752 {
Anna Bridge 160:5571c4ff569f 1753 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
Anna Bridge 160:5571c4ff569f 1754 #if !defined (ARM_MATH_DSP)
Anna Bridge 160:5571c4ff569f 1755 q15_t A1;
Anna Bridge 160:5571c4ff569f 1756 q15_t A2;
Anna Bridge 160:5571c4ff569f 1757 #else
Anna Bridge 160:5571c4ff569f 1758 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
Anna Bridge 160:5571c4ff569f 1759 #endif
Anna Bridge 160:5571c4ff569f 1760 q15_t state[3]; /**< The state array of length 3. */
Anna Bridge 160:5571c4ff569f 1761 q15_t Kp; /**< The proportional gain. */
Anna Bridge 160:5571c4ff569f 1762 q15_t Ki; /**< The integral gain. */
Anna Bridge 160:5571c4ff569f 1763 q15_t Kd; /**< The derivative gain. */
Anna Bridge 160:5571c4ff569f 1764 } arm_pid_instance_q15;
Anna Bridge 160:5571c4ff569f 1765
Anna Bridge 160:5571c4ff569f 1766 /**
Anna Bridge 160:5571c4ff569f 1767 * @brief Instance structure for the Q31 PID Control.
Anna Bridge 160:5571c4ff569f 1768 */
Anna Bridge 160:5571c4ff569f 1769 typedef struct
Anna Bridge 160:5571c4ff569f 1770 {
Anna Bridge 160:5571c4ff569f 1771 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
Anna Bridge 160:5571c4ff569f 1772 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
Anna Bridge 160:5571c4ff569f 1773 q31_t A2; /**< The derived gain, A2 = Kd . */
Anna Bridge 160:5571c4ff569f 1774 q31_t state[3]; /**< The state array of length 3. */
Anna Bridge 160:5571c4ff569f 1775 q31_t Kp; /**< The proportional gain. */
Anna Bridge 160:5571c4ff569f 1776 q31_t Ki; /**< The integral gain. */
Anna Bridge 160:5571c4ff569f 1777 q31_t Kd; /**< The derivative gain. */
Anna Bridge 160:5571c4ff569f 1778 } arm_pid_instance_q31;
Anna Bridge 160:5571c4ff569f 1779
Anna Bridge 160:5571c4ff569f 1780 /**
Anna Bridge 160:5571c4ff569f 1781 * @brief Instance structure for the floating-point PID Control.
Anna Bridge 160:5571c4ff569f 1782 */
Anna Bridge 160:5571c4ff569f 1783 typedef struct
Anna Bridge 160:5571c4ff569f 1784 {
Anna Bridge 160:5571c4ff569f 1785 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
Anna Bridge 160:5571c4ff569f 1786 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
Anna Bridge 160:5571c4ff569f 1787 float32_t A2; /**< The derived gain, A2 = Kd . */
Anna Bridge 160:5571c4ff569f 1788 float32_t state[3]; /**< The state array of length 3. */
Anna Bridge 160:5571c4ff569f 1789 float32_t Kp; /**< The proportional gain. */
Anna Bridge 160:5571c4ff569f 1790 float32_t Ki; /**< The integral gain. */
Anna Bridge 160:5571c4ff569f 1791 float32_t Kd; /**< The derivative gain. */
Anna Bridge 160:5571c4ff569f 1792 } arm_pid_instance_f32;
Anna Bridge 160:5571c4ff569f 1793
Anna Bridge 160:5571c4ff569f 1794
Anna Bridge 160:5571c4ff569f 1795
Anna Bridge 160:5571c4ff569f 1796 /**
Anna Bridge 160:5571c4ff569f 1797 * @brief Initialization function for the floating-point PID Control.
Anna Bridge 160:5571c4ff569f 1798 * @param[in,out] S points to an instance of the PID structure.
Anna Bridge 160:5571c4ff569f 1799 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
Anna Bridge 160:5571c4ff569f 1800 */
Anna Bridge 160:5571c4ff569f 1801 void arm_pid_init_f32(
Anna Bridge 160:5571c4ff569f 1802 arm_pid_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 1803 int32_t resetStateFlag);
Anna Bridge 160:5571c4ff569f 1804
Anna Bridge 160:5571c4ff569f 1805
Anna Bridge 160:5571c4ff569f 1806 /**
Anna Bridge 160:5571c4ff569f 1807 * @brief Reset function for the floating-point PID Control.
Anna Bridge 160:5571c4ff569f 1808 * @param[in,out] S is an instance of the floating-point PID Control structure
Anna Bridge 160:5571c4ff569f 1809 */
Anna Bridge 160:5571c4ff569f 1810 void arm_pid_reset_f32(
Anna Bridge 160:5571c4ff569f 1811 arm_pid_instance_f32 * S);
Anna Bridge 160:5571c4ff569f 1812
Anna Bridge 160:5571c4ff569f 1813
Anna Bridge 160:5571c4ff569f 1814 /**
Anna Bridge 160:5571c4ff569f 1815 * @brief Initialization function for the Q31 PID Control.
Anna Bridge 160:5571c4ff569f 1816 * @param[in,out] S points to an instance of the Q15 PID structure.
Anna Bridge 160:5571c4ff569f 1817 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
Anna Bridge 160:5571c4ff569f 1818 */
Anna Bridge 160:5571c4ff569f 1819 void arm_pid_init_q31(
Anna Bridge 160:5571c4ff569f 1820 arm_pid_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 1821 int32_t resetStateFlag);
Anna Bridge 160:5571c4ff569f 1822
Anna Bridge 160:5571c4ff569f 1823
Anna Bridge 160:5571c4ff569f 1824 /**
Anna Bridge 160:5571c4ff569f 1825 * @brief Reset function for the Q31 PID Control.
Anna Bridge 160:5571c4ff569f 1826 * @param[in,out] S points to an instance of the Q31 PID Control structure
Anna Bridge 160:5571c4ff569f 1827 */
Anna Bridge 160:5571c4ff569f 1828
Anna Bridge 160:5571c4ff569f 1829 void arm_pid_reset_q31(
Anna Bridge 160:5571c4ff569f 1830 arm_pid_instance_q31 * S);
Anna Bridge 160:5571c4ff569f 1831
Anna Bridge 160:5571c4ff569f 1832
Anna Bridge 160:5571c4ff569f 1833 /**
Anna Bridge 160:5571c4ff569f 1834 * @brief Initialization function for the Q15 PID Control.
Anna Bridge 160:5571c4ff569f 1835 * @param[in,out] S points to an instance of the Q15 PID structure.
Anna Bridge 160:5571c4ff569f 1836 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
Anna Bridge 160:5571c4ff569f 1837 */
Anna Bridge 160:5571c4ff569f 1838 void arm_pid_init_q15(
Anna Bridge 160:5571c4ff569f 1839 arm_pid_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1840 int32_t resetStateFlag);
Anna Bridge 160:5571c4ff569f 1841
Anna Bridge 160:5571c4ff569f 1842
Anna Bridge 160:5571c4ff569f 1843 /**
Anna Bridge 160:5571c4ff569f 1844 * @brief Reset function for the Q15 PID Control.
Anna Bridge 160:5571c4ff569f 1845 * @param[in,out] S points to an instance of the q15 PID Control structure
Anna Bridge 160:5571c4ff569f 1846 */
Anna Bridge 160:5571c4ff569f 1847 void arm_pid_reset_q15(
Anna Bridge 160:5571c4ff569f 1848 arm_pid_instance_q15 * S);
Anna Bridge 160:5571c4ff569f 1849
Anna Bridge 160:5571c4ff569f 1850
Anna Bridge 160:5571c4ff569f 1851 /**
Anna Bridge 160:5571c4ff569f 1852 * @brief Instance structure for the floating-point Linear Interpolate function.
Anna Bridge 160:5571c4ff569f 1853 */
Anna Bridge 160:5571c4ff569f 1854 typedef struct
Anna Bridge 160:5571c4ff569f 1855 {
Anna Bridge 160:5571c4ff569f 1856 uint32_t nValues; /**< nValues */
Anna Bridge 160:5571c4ff569f 1857 float32_t x1; /**< x1 */
Anna Bridge 160:5571c4ff569f 1858 float32_t xSpacing; /**< xSpacing */
Anna Bridge 160:5571c4ff569f 1859 float32_t *pYData; /**< pointer to the table of Y values */
Anna Bridge 160:5571c4ff569f 1860 } arm_linear_interp_instance_f32;
Anna Bridge 160:5571c4ff569f 1861
Anna Bridge 160:5571c4ff569f 1862 /**
Anna Bridge 160:5571c4ff569f 1863 * @brief Instance structure for the floating-point bilinear interpolation function.
Anna Bridge 160:5571c4ff569f 1864 */
Anna Bridge 160:5571c4ff569f 1865 typedef struct
Anna Bridge 160:5571c4ff569f 1866 {
Anna Bridge 160:5571c4ff569f 1867 uint16_t numRows; /**< number of rows in the data table. */
Anna Bridge 160:5571c4ff569f 1868 uint16_t numCols; /**< number of columns in the data table. */
Anna Bridge 160:5571c4ff569f 1869 float32_t *pData; /**< points to the data table. */
Anna Bridge 160:5571c4ff569f 1870 } arm_bilinear_interp_instance_f32;
Anna Bridge 160:5571c4ff569f 1871
Anna Bridge 160:5571c4ff569f 1872 /**
Anna Bridge 160:5571c4ff569f 1873 * @brief Instance structure for the Q31 bilinear interpolation function.
Anna Bridge 160:5571c4ff569f 1874 */
Anna Bridge 160:5571c4ff569f 1875 typedef struct
Anna Bridge 160:5571c4ff569f 1876 {
Anna Bridge 160:5571c4ff569f 1877 uint16_t numRows; /**< number of rows in the data table. */
Anna Bridge 160:5571c4ff569f 1878 uint16_t numCols; /**< number of columns in the data table. */
Anna Bridge 160:5571c4ff569f 1879 q31_t *pData; /**< points to the data table. */
Anna Bridge 160:5571c4ff569f 1880 } arm_bilinear_interp_instance_q31;
Anna Bridge 160:5571c4ff569f 1881
Anna Bridge 160:5571c4ff569f 1882 /**
Anna Bridge 160:5571c4ff569f 1883 * @brief Instance structure for the Q15 bilinear interpolation function.
Anna Bridge 160:5571c4ff569f 1884 */
Anna Bridge 160:5571c4ff569f 1885 typedef struct
Anna Bridge 160:5571c4ff569f 1886 {
Anna Bridge 160:5571c4ff569f 1887 uint16_t numRows; /**< number of rows in the data table. */
Anna Bridge 160:5571c4ff569f 1888 uint16_t numCols; /**< number of columns in the data table. */
Anna Bridge 160:5571c4ff569f 1889 q15_t *pData; /**< points to the data table. */
Anna Bridge 160:5571c4ff569f 1890 } arm_bilinear_interp_instance_q15;
Anna Bridge 160:5571c4ff569f 1891
Anna Bridge 160:5571c4ff569f 1892 /**
Anna Bridge 160:5571c4ff569f 1893 * @brief Instance structure for the Q15 bilinear interpolation function.
Anna Bridge 160:5571c4ff569f 1894 */
Anna Bridge 160:5571c4ff569f 1895 typedef struct
Anna Bridge 160:5571c4ff569f 1896 {
Anna Bridge 160:5571c4ff569f 1897 uint16_t numRows; /**< number of rows in the data table. */
Anna Bridge 160:5571c4ff569f 1898 uint16_t numCols; /**< number of columns in the data table. */
Anna Bridge 160:5571c4ff569f 1899 q7_t *pData; /**< points to the data table. */
Anna Bridge 160:5571c4ff569f 1900 } arm_bilinear_interp_instance_q7;
Anna Bridge 160:5571c4ff569f 1901
Anna Bridge 160:5571c4ff569f 1902
Anna Bridge 160:5571c4ff569f 1903 /**
Anna Bridge 160:5571c4ff569f 1904 * @brief Q7 vector multiplication.
Anna Bridge 160:5571c4ff569f 1905 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 1906 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 1907 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 1908 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 1909 */
Anna Bridge 160:5571c4ff569f 1910 void arm_mult_q7(
Anna Bridge 160:5571c4ff569f 1911 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 1912 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 1913 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 1914 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1915
Anna Bridge 160:5571c4ff569f 1916
Anna Bridge 160:5571c4ff569f 1917 /**
Anna Bridge 160:5571c4ff569f 1918 * @brief Q15 vector multiplication.
Anna Bridge 160:5571c4ff569f 1919 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 1920 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 1921 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 1922 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 1923 */
Anna Bridge 160:5571c4ff569f 1924 void arm_mult_q15(
Anna Bridge 160:5571c4ff569f 1925 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 1926 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 1927 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 1928 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1929
Anna Bridge 160:5571c4ff569f 1930
Anna Bridge 160:5571c4ff569f 1931 /**
Anna Bridge 160:5571c4ff569f 1932 * @brief Q31 vector multiplication.
Anna Bridge 160:5571c4ff569f 1933 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 1934 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 1935 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 1936 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 1937 */
Anna Bridge 160:5571c4ff569f 1938 void arm_mult_q31(
Anna Bridge 160:5571c4ff569f 1939 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 1940 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 1941 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 1942 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1943
Anna Bridge 160:5571c4ff569f 1944
Anna Bridge 160:5571c4ff569f 1945 /**
Anna Bridge 160:5571c4ff569f 1946 * @brief Floating-point vector multiplication.
Anna Bridge 160:5571c4ff569f 1947 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 1948 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 1949 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 1950 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 1951 */
Anna Bridge 160:5571c4ff569f 1952 void arm_mult_f32(
Anna Bridge 160:5571c4ff569f 1953 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 1954 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 1955 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 1956 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 1957
Anna Bridge 160:5571c4ff569f 1958
Anna Bridge 160:5571c4ff569f 1959 /**
Anna Bridge 160:5571c4ff569f 1960 * @brief Instance structure for the Q15 CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 1961 */
Anna Bridge 160:5571c4ff569f 1962 typedef struct
Anna Bridge 160:5571c4ff569f 1963 {
Anna Bridge 160:5571c4ff569f 1964 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 1965 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
Anna Bridge 160:5571c4ff569f 1966 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 1967 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
Anna Bridge 160:5571c4ff569f 1968 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 1969 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 1970 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
Anna Bridge 160:5571c4ff569f 1971 } arm_cfft_radix2_instance_q15;
Anna Bridge 160:5571c4ff569f 1972
Anna Bridge 160:5571c4ff569f 1973 /* Deprecated */
Anna Bridge 160:5571c4ff569f 1974 arm_status arm_cfft_radix2_init_q15(
Anna Bridge 160:5571c4ff569f 1975 arm_cfft_radix2_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1976 uint16_t fftLen,
Anna Bridge 160:5571c4ff569f 1977 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 1978 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 1979
Anna Bridge 160:5571c4ff569f 1980 /* Deprecated */
Anna Bridge 160:5571c4ff569f 1981 void arm_cfft_radix2_q15(
Anna Bridge 160:5571c4ff569f 1982 const arm_cfft_radix2_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 1983 q15_t * pSrc);
Anna Bridge 160:5571c4ff569f 1984
Anna Bridge 160:5571c4ff569f 1985
Anna Bridge 160:5571c4ff569f 1986 /**
Anna Bridge 160:5571c4ff569f 1987 * @brief Instance structure for the Q15 CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 1988 */
Anna Bridge 160:5571c4ff569f 1989 typedef struct
Anna Bridge 160:5571c4ff569f 1990 {
Anna Bridge 160:5571c4ff569f 1991 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 1992 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
Anna Bridge 160:5571c4ff569f 1993 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 1994 q15_t *pTwiddle; /**< points to the twiddle factor table. */
Anna Bridge 160:5571c4ff569f 1995 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 1996 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 1997 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
Anna Bridge 160:5571c4ff569f 1998 } arm_cfft_radix4_instance_q15;
Anna Bridge 160:5571c4ff569f 1999
Anna Bridge 160:5571c4ff569f 2000 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2001 arm_status arm_cfft_radix4_init_q15(
Anna Bridge 160:5571c4ff569f 2002 arm_cfft_radix4_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2003 uint16_t fftLen,
Anna Bridge 160:5571c4ff569f 2004 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2005 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2006
Anna Bridge 160:5571c4ff569f 2007 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2008 void arm_cfft_radix4_q15(
Anna Bridge 160:5571c4ff569f 2009 const arm_cfft_radix4_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2010 q15_t * pSrc);
Anna Bridge 160:5571c4ff569f 2011
Anna Bridge 160:5571c4ff569f 2012 /**
Anna Bridge 160:5571c4ff569f 2013 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2014 */
Anna Bridge 160:5571c4ff569f 2015 typedef struct
Anna Bridge 160:5571c4ff569f 2016 {
Anna Bridge 160:5571c4ff569f 2017 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2018 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
Anna Bridge 160:5571c4ff569f 2019 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2020 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2021 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2022 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2023 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
Anna Bridge 160:5571c4ff569f 2024 } arm_cfft_radix2_instance_q31;
Anna Bridge 160:5571c4ff569f 2025
Anna Bridge 160:5571c4ff569f 2026 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2027 arm_status arm_cfft_radix2_init_q31(
Anna Bridge 160:5571c4ff569f 2028 arm_cfft_radix2_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2029 uint16_t fftLen,
Anna Bridge 160:5571c4ff569f 2030 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2031 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2032
Anna Bridge 160:5571c4ff569f 2033 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2034 void arm_cfft_radix2_q31(
Anna Bridge 160:5571c4ff569f 2035 const arm_cfft_radix2_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2036 q31_t * pSrc);
Anna Bridge 160:5571c4ff569f 2037
Anna Bridge 160:5571c4ff569f 2038 /**
Anna Bridge 160:5571c4ff569f 2039 * @brief Instance structure for the Q31 CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2040 */
Anna Bridge 160:5571c4ff569f 2041 typedef struct
Anna Bridge 160:5571c4ff569f 2042 {
Anna Bridge 160:5571c4ff569f 2043 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2044 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
Anna Bridge 160:5571c4ff569f 2045 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2046 q31_t *pTwiddle; /**< points to the twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2047 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2048 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2049 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
Anna Bridge 160:5571c4ff569f 2050 } arm_cfft_radix4_instance_q31;
Anna Bridge 160:5571c4ff569f 2051
Anna Bridge 160:5571c4ff569f 2052 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2053 void arm_cfft_radix4_q31(
Anna Bridge 160:5571c4ff569f 2054 const arm_cfft_radix4_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2055 q31_t * pSrc);
Anna Bridge 160:5571c4ff569f 2056
Anna Bridge 160:5571c4ff569f 2057 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2058 arm_status arm_cfft_radix4_init_q31(
Anna Bridge 160:5571c4ff569f 2059 arm_cfft_radix4_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2060 uint16_t fftLen,
Anna Bridge 160:5571c4ff569f 2061 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2062 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2063
Anna Bridge 160:5571c4ff569f 2064 /**
Anna Bridge 160:5571c4ff569f 2065 * @brief Instance structure for the floating-point CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2066 */
Anna Bridge 160:5571c4ff569f 2067 typedef struct
Anna Bridge 160:5571c4ff569f 2068 {
Anna Bridge 160:5571c4ff569f 2069 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2070 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
Anna Bridge 160:5571c4ff569f 2071 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2072 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2073 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2074 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2075 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
Anna Bridge 160:5571c4ff569f 2076 float32_t onebyfftLen; /**< value of 1/fftLen. */
Anna Bridge 160:5571c4ff569f 2077 } arm_cfft_radix2_instance_f32;
Anna Bridge 160:5571c4ff569f 2078
Anna Bridge 160:5571c4ff569f 2079 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2080 arm_status arm_cfft_radix2_init_f32(
Anna Bridge 160:5571c4ff569f 2081 arm_cfft_radix2_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2082 uint16_t fftLen,
Anna Bridge 160:5571c4ff569f 2083 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2084 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2085
Anna Bridge 160:5571c4ff569f 2086 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2087 void arm_cfft_radix2_f32(
Anna Bridge 160:5571c4ff569f 2088 const arm_cfft_radix2_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2089 float32_t * pSrc);
Anna Bridge 160:5571c4ff569f 2090
Anna Bridge 160:5571c4ff569f 2091 /**
Anna Bridge 160:5571c4ff569f 2092 * @brief Instance structure for the floating-point CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2093 */
Anna Bridge 160:5571c4ff569f 2094 typedef struct
Anna Bridge 160:5571c4ff569f 2095 {
Anna Bridge 160:5571c4ff569f 2096 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2097 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
Anna Bridge 160:5571c4ff569f 2098 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2099 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2100 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2101 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2102 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
Anna Bridge 160:5571c4ff569f 2103 float32_t onebyfftLen; /**< value of 1/fftLen. */
Anna Bridge 160:5571c4ff569f 2104 } arm_cfft_radix4_instance_f32;
Anna Bridge 160:5571c4ff569f 2105
Anna Bridge 160:5571c4ff569f 2106 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2107 arm_status arm_cfft_radix4_init_f32(
Anna Bridge 160:5571c4ff569f 2108 arm_cfft_radix4_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2109 uint16_t fftLen,
Anna Bridge 160:5571c4ff569f 2110 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2111 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2112
Anna Bridge 160:5571c4ff569f 2113 /* Deprecated */
Anna Bridge 160:5571c4ff569f 2114 void arm_cfft_radix4_f32(
Anna Bridge 160:5571c4ff569f 2115 const arm_cfft_radix4_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2116 float32_t * pSrc);
Anna Bridge 160:5571c4ff569f 2117
Anna Bridge 160:5571c4ff569f 2118 /**
Anna Bridge 160:5571c4ff569f 2119 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2120 */
Anna Bridge 160:5571c4ff569f 2121 typedef struct
Anna Bridge 160:5571c4ff569f 2122 {
Anna Bridge 160:5571c4ff569f 2123 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2124 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2125 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2126 uint16_t bitRevLength; /**< bit reversal table length. */
Anna Bridge 160:5571c4ff569f 2127 } arm_cfft_instance_q15;
Anna Bridge 160:5571c4ff569f 2128
Anna Bridge 160:5571c4ff569f 2129 void arm_cfft_q15(
Anna Bridge 160:5571c4ff569f 2130 const arm_cfft_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2131 q15_t * p1,
Anna Bridge 160:5571c4ff569f 2132 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2133 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2134
Anna Bridge 160:5571c4ff569f 2135 /**
Anna Bridge 160:5571c4ff569f 2136 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2137 */
Anna Bridge 160:5571c4ff569f 2138 typedef struct
Anna Bridge 160:5571c4ff569f 2139 {
Anna Bridge 160:5571c4ff569f 2140 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2141 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2142 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2143 uint16_t bitRevLength; /**< bit reversal table length. */
Anna Bridge 160:5571c4ff569f 2144 } arm_cfft_instance_q31;
Anna Bridge 160:5571c4ff569f 2145
Anna Bridge 160:5571c4ff569f 2146 void arm_cfft_q31(
Anna Bridge 160:5571c4ff569f 2147 const arm_cfft_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2148 q31_t * p1,
Anna Bridge 160:5571c4ff569f 2149 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2150 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2151
Anna Bridge 160:5571c4ff569f 2152 /**
Anna Bridge 160:5571c4ff569f 2153 * @brief Instance structure for the floating-point CFFT/CIFFT function.
Anna Bridge 160:5571c4ff569f 2154 */
Anna Bridge 160:5571c4ff569f 2155 typedef struct
Anna Bridge 160:5571c4ff569f 2156 {
Anna Bridge 160:5571c4ff569f 2157 uint16_t fftLen; /**< length of the FFT. */
Anna Bridge 160:5571c4ff569f 2158 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2159 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
Anna Bridge 160:5571c4ff569f 2160 uint16_t bitRevLength; /**< bit reversal table length. */
Anna Bridge 160:5571c4ff569f 2161 } arm_cfft_instance_f32;
Anna Bridge 160:5571c4ff569f 2162
Anna Bridge 160:5571c4ff569f 2163 void arm_cfft_f32(
Anna Bridge 160:5571c4ff569f 2164 const arm_cfft_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2165 float32_t * p1,
Anna Bridge 160:5571c4ff569f 2166 uint8_t ifftFlag,
Anna Bridge 160:5571c4ff569f 2167 uint8_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2168
Anna Bridge 160:5571c4ff569f 2169 /**
Anna Bridge 160:5571c4ff569f 2170 * @brief Instance structure for the Q15 RFFT/RIFFT function.
Anna Bridge 160:5571c4ff569f 2171 */
Anna Bridge 160:5571c4ff569f 2172 typedef struct
Anna Bridge 160:5571c4ff569f 2173 {
Anna Bridge 160:5571c4ff569f 2174 uint32_t fftLenReal; /**< length of the real FFT. */
Anna Bridge 160:5571c4ff569f 2175 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
Anna Bridge 160:5571c4ff569f 2176 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2177 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2178 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2179 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2180 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
Anna Bridge 160:5571c4ff569f 2181 } arm_rfft_instance_q15;
Anna Bridge 160:5571c4ff569f 2182
Anna Bridge 160:5571c4ff569f 2183 arm_status arm_rfft_init_q15(
Anna Bridge 160:5571c4ff569f 2184 arm_rfft_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2185 uint32_t fftLenReal,
Anna Bridge 160:5571c4ff569f 2186 uint32_t ifftFlagR,
Anna Bridge 160:5571c4ff569f 2187 uint32_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2188
Anna Bridge 160:5571c4ff569f 2189 void arm_rfft_q15(
Anna Bridge 160:5571c4ff569f 2190 const arm_rfft_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2191 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2192 q15_t * pDst);
Anna Bridge 160:5571c4ff569f 2193
Anna Bridge 160:5571c4ff569f 2194 /**
Anna Bridge 160:5571c4ff569f 2195 * @brief Instance structure for the Q31 RFFT/RIFFT function.
Anna Bridge 160:5571c4ff569f 2196 */
Anna Bridge 160:5571c4ff569f 2197 typedef struct
Anna Bridge 160:5571c4ff569f 2198 {
Anna Bridge 160:5571c4ff569f 2199 uint32_t fftLenReal; /**< length of the real FFT. */
Anna Bridge 160:5571c4ff569f 2200 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
Anna Bridge 160:5571c4ff569f 2201 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2202 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2203 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2204 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2205 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
Anna Bridge 160:5571c4ff569f 2206 } arm_rfft_instance_q31;
Anna Bridge 160:5571c4ff569f 2207
Anna Bridge 160:5571c4ff569f 2208 arm_status arm_rfft_init_q31(
Anna Bridge 160:5571c4ff569f 2209 arm_rfft_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2210 uint32_t fftLenReal,
Anna Bridge 160:5571c4ff569f 2211 uint32_t ifftFlagR,
Anna Bridge 160:5571c4ff569f 2212 uint32_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2213
Anna Bridge 160:5571c4ff569f 2214 void arm_rfft_q31(
Anna Bridge 160:5571c4ff569f 2215 const arm_rfft_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2216 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2217 q31_t * pDst);
Anna Bridge 160:5571c4ff569f 2218
Anna Bridge 160:5571c4ff569f 2219 /**
Anna Bridge 160:5571c4ff569f 2220 * @brief Instance structure for the floating-point RFFT/RIFFT function.
Anna Bridge 160:5571c4ff569f 2221 */
Anna Bridge 160:5571c4ff569f 2222 typedef struct
Anna Bridge 160:5571c4ff569f 2223 {
Anna Bridge 160:5571c4ff569f 2224 uint32_t fftLenReal; /**< length of the real FFT. */
Anna Bridge 160:5571c4ff569f 2225 uint16_t fftLenBy2; /**< length of the complex FFT. */
Anna Bridge 160:5571c4ff569f 2226 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
Anna Bridge 160:5571c4ff569f 2227 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
Anna Bridge 160:5571c4ff569f 2228 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2229 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2230 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2231 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
Anna Bridge 160:5571c4ff569f 2232 } arm_rfft_instance_f32;
Anna Bridge 160:5571c4ff569f 2233
Anna Bridge 160:5571c4ff569f 2234 arm_status arm_rfft_init_f32(
Anna Bridge 160:5571c4ff569f 2235 arm_rfft_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2236 arm_cfft_radix4_instance_f32 * S_CFFT,
Anna Bridge 160:5571c4ff569f 2237 uint32_t fftLenReal,
Anna Bridge 160:5571c4ff569f 2238 uint32_t ifftFlagR,
Anna Bridge 160:5571c4ff569f 2239 uint32_t bitReverseFlag);
Anna Bridge 160:5571c4ff569f 2240
Anna Bridge 160:5571c4ff569f 2241 void arm_rfft_f32(
Anna Bridge 160:5571c4ff569f 2242 const arm_rfft_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2243 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 2244 float32_t * pDst);
Anna Bridge 160:5571c4ff569f 2245
Anna Bridge 160:5571c4ff569f 2246 /**
Anna Bridge 160:5571c4ff569f 2247 * @brief Instance structure for the floating-point RFFT/RIFFT function.
Anna Bridge 160:5571c4ff569f 2248 */
Anna Bridge 160:5571c4ff569f 2249 typedef struct
Anna Bridge 160:5571c4ff569f 2250 {
Anna Bridge 160:5571c4ff569f 2251 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
Anna Bridge 160:5571c4ff569f 2252 uint16_t fftLenRFFT; /**< length of the real sequence */
Anna Bridge 160:5571c4ff569f 2253 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
Anna Bridge 160:5571c4ff569f 2254 } arm_rfft_fast_instance_f32 ;
Anna Bridge 160:5571c4ff569f 2255
Anna Bridge 160:5571c4ff569f 2256 arm_status arm_rfft_fast_init_f32 (
Anna Bridge 160:5571c4ff569f 2257 arm_rfft_fast_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2258 uint16_t fftLen);
Anna Bridge 160:5571c4ff569f 2259
Anna Bridge 160:5571c4ff569f 2260 void arm_rfft_fast_f32(
Anna Bridge 160:5571c4ff569f 2261 arm_rfft_fast_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2262 float32_t * p, float32_t * pOut,
Anna Bridge 160:5571c4ff569f 2263 uint8_t ifftFlag);
Anna Bridge 160:5571c4ff569f 2264
Anna Bridge 160:5571c4ff569f 2265 /**
Anna Bridge 160:5571c4ff569f 2266 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
Anna Bridge 160:5571c4ff569f 2267 */
Anna Bridge 160:5571c4ff569f 2268 typedef struct
Anna Bridge 160:5571c4ff569f 2269 {
Anna Bridge 160:5571c4ff569f 2270 uint16_t N; /**< length of the DCT4. */
Anna Bridge 160:5571c4ff569f 2271 uint16_t Nby2; /**< half of the length of the DCT4. */
Anna Bridge 160:5571c4ff569f 2272 float32_t normalize; /**< normalizing factor. */
Anna Bridge 160:5571c4ff569f 2273 float32_t *pTwiddle; /**< points to the twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2274 float32_t *pCosFactor; /**< points to the cosFactor table. */
Anna Bridge 160:5571c4ff569f 2275 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
Anna Bridge 160:5571c4ff569f 2276 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
Anna Bridge 160:5571c4ff569f 2277 } arm_dct4_instance_f32;
Anna Bridge 160:5571c4ff569f 2278
Anna Bridge 160:5571c4ff569f 2279
Anna Bridge 160:5571c4ff569f 2280 /**
Anna Bridge 160:5571c4ff569f 2281 * @brief Initialization function for the floating-point DCT4/IDCT4.
Anna Bridge 160:5571c4ff569f 2282 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
Anna Bridge 160:5571c4ff569f 2283 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
Anna Bridge 160:5571c4ff569f 2284 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
Anna Bridge 160:5571c4ff569f 2285 * @param[in] N length of the DCT4.
Anna Bridge 160:5571c4ff569f 2286 * @param[in] Nby2 half of the length of the DCT4.
Anna Bridge 160:5571c4ff569f 2287 * @param[in] normalize normalizing factor.
Anna Bridge 160:5571c4ff569f 2288 * @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.
Anna Bridge 160:5571c4ff569f 2289 */
Anna Bridge 160:5571c4ff569f 2290 arm_status arm_dct4_init_f32(
Anna Bridge 160:5571c4ff569f 2291 arm_dct4_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2292 arm_rfft_instance_f32 * S_RFFT,
Anna Bridge 160:5571c4ff569f 2293 arm_cfft_radix4_instance_f32 * S_CFFT,
Anna Bridge 160:5571c4ff569f 2294 uint16_t N,
Anna Bridge 160:5571c4ff569f 2295 uint16_t Nby2,
Anna Bridge 160:5571c4ff569f 2296 float32_t normalize);
Anna Bridge 160:5571c4ff569f 2297
Anna Bridge 160:5571c4ff569f 2298
Anna Bridge 160:5571c4ff569f 2299 /**
Anna Bridge 160:5571c4ff569f 2300 * @brief Processing function for the floating-point DCT4/IDCT4.
Anna Bridge 160:5571c4ff569f 2301 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
Anna Bridge 160:5571c4ff569f 2302 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 2303 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
Anna Bridge 160:5571c4ff569f 2304 */
Anna Bridge 160:5571c4ff569f 2305 void arm_dct4_f32(
Anna Bridge 160:5571c4ff569f 2306 const arm_dct4_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 2307 float32_t * pState,
Anna Bridge 160:5571c4ff569f 2308 float32_t * pInlineBuffer);
Anna Bridge 160:5571c4ff569f 2309
Anna Bridge 160:5571c4ff569f 2310
Anna Bridge 160:5571c4ff569f 2311 /**
Anna Bridge 160:5571c4ff569f 2312 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
Anna Bridge 160:5571c4ff569f 2313 */
Anna Bridge 160:5571c4ff569f 2314 typedef struct
Anna Bridge 160:5571c4ff569f 2315 {
Anna Bridge 160:5571c4ff569f 2316 uint16_t N; /**< length of the DCT4. */
Anna Bridge 160:5571c4ff569f 2317 uint16_t Nby2; /**< half of the length of the DCT4. */
Anna Bridge 160:5571c4ff569f 2318 q31_t normalize; /**< normalizing factor. */
Anna Bridge 160:5571c4ff569f 2319 q31_t *pTwiddle; /**< points to the twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2320 q31_t *pCosFactor; /**< points to the cosFactor table. */
Anna Bridge 160:5571c4ff569f 2321 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
Anna Bridge 160:5571c4ff569f 2322 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
Anna Bridge 160:5571c4ff569f 2323 } arm_dct4_instance_q31;
Anna Bridge 160:5571c4ff569f 2324
Anna Bridge 160:5571c4ff569f 2325
Anna Bridge 160:5571c4ff569f 2326 /**
Anna Bridge 160:5571c4ff569f 2327 * @brief Initialization function for the Q31 DCT4/IDCT4.
Anna Bridge 160:5571c4ff569f 2328 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
Anna Bridge 160:5571c4ff569f 2329 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
Anna Bridge 160:5571c4ff569f 2330 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
Anna Bridge 160:5571c4ff569f 2331 * @param[in] N length of the DCT4.
Anna Bridge 160:5571c4ff569f 2332 * @param[in] Nby2 half of the length of the DCT4.
Anna Bridge 160:5571c4ff569f 2333 * @param[in] normalize normalizing factor.
Anna Bridge 160:5571c4ff569f 2334 * @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.
Anna Bridge 160:5571c4ff569f 2335 */
Anna Bridge 160:5571c4ff569f 2336 arm_status arm_dct4_init_q31(
Anna Bridge 160:5571c4ff569f 2337 arm_dct4_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2338 arm_rfft_instance_q31 * S_RFFT,
Anna Bridge 160:5571c4ff569f 2339 arm_cfft_radix4_instance_q31 * S_CFFT,
Anna Bridge 160:5571c4ff569f 2340 uint16_t N,
Anna Bridge 160:5571c4ff569f 2341 uint16_t Nby2,
Anna Bridge 160:5571c4ff569f 2342 q31_t normalize);
Anna Bridge 160:5571c4ff569f 2343
Anna Bridge 160:5571c4ff569f 2344
Anna Bridge 160:5571c4ff569f 2345 /**
Anna Bridge 160:5571c4ff569f 2346 * @brief Processing function for the Q31 DCT4/IDCT4.
Anna Bridge 160:5571c4ff569f 2347 * @param[in] S points to an instance of the Q31 DCT4 structure.
Anna Bridge 160:5571c4ff569f 2348 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 2349 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
Anna Bridge 160:5571c4ff569f 2350 */
Anna Bridge 160:5571c4ff569f 2351 void arm_dct4_q31(
Anna Bridge 160:5571c4ff569f 2352 const arm_dct4_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 2353 q31_t * pState,
Anna Bridge 160:5571c4ff569f 2354 q31_t * pInlineBuffer);
Anna Bridge 160:5571c4ff569f 2355
Anna Bridge 160:5571c4ff569f 2356
Anna Bridge 160:5571c4ff569f 2357 /**
Anna Bridge 160:5571c4ff569f 2358 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
Anna Bridge 160:5571c4ff569f 2359 */
Anna Bridge 160:5571c4ff569f 2360 typedef struct
Anna Bridge 160:5571c4ff569f 2361 {
Anna Bridge 160:5571c4ff569f 2362 uint16_t N; /**< length of the DCT4. */
Anna Bridge 160:5571c4ff569f 2363 uint16_t Nby2; /**< half of the length of the DCT4. */
Anna Bridge 160:5571c4ff569f 2364 q15_t normalize; /**< normalizing factor. */
Anna Bridge 160:5571c4ff569f 2365 q15_t *pTwiddle; /**< points to the twiddle factor table. */
Anna Bridge 160:5571c4ff569f 2366 q15_t *pCosFactor; /**< points to the cosFactor table. */
Anna Bridge 160:5571c4ff569f 2367 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
Anna Bridge 160:5571c4ff569f 2368 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
Anna Bridge 160:5571c4ff569f 2369 } arm_dct4_instance_q15;
Anna Bridge 160:5571c4ff569f 2370
Anna Bridge 160:5571c4ff569f 2371
Anna Bridge 160:5571c4ff569f 2372 /**
Anna Bridge 160:5571c4ff569f 2373 * @brief Initialization function for the Q15 DCT4/IDCT4.
Anna Bridge 160:5571c4ff569f 2374 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
Anna Bridge 160:5571c4ff569f 2375 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
Anna Bridge 160:5571c4ff569f 2376 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
Anna Bridge 160:5571c4ff569f 2377 * @param[in] N length of the DCT4.
Anna Bridge 160:5571c4ff569f 2378 * @param[in] Nby2 half of the length of the DCT4.
Anna Bridge 160:5571c4ff569f 2379 * @param[in] normalize normalizing factor.
Anna Bridge 160:5571c4ff569f 2380 * @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.
Anna Bridge 160:5571c4ff569f 2381 */
Anna Bridge 160:5571c4ff569f 2382 arm_status arm_dct4_init_q15(
Anna Bridge 160:5571c4ff569f 2383 arm_dct4_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2384 arm_rfft_instance_q15 * S_RFFT,
Anna Bridge 160:5571c4ff569f 2385 arm_cfft_radix4_instance_q15 * S_CFFT,
Anna Bridge 160:5571c4ff569f 2386 uint16_t N,
Anna Bridge 160:5571c4ff569f 2387 uint16_t Nby2,
Anna Bridge 160:5571c4ff569f 2388 q15_t normalize);
Anna Bridge 160:5571c4ff569f 2389
Anna Bridge 160:5571c4ff569f 2390
Anna Bridge 160:5571c4ff569f 2391 /**
Anna Bridge 160:5571c4ff569f 2392 * @brief Processing function for the Q15 DCT4/IDCT4.
Anna Bridge 160:5571c4ff569f 2393 * @param[in] S points to an instance of the Q15 DCT4 structure.
Anna Bridge 160:5571c4ff569f 2394 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 2395 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
Anna Bridge 160:5571c4ff569f 2396 */
Anna Bridge 160:5571c4ff569f 2397 void arm_dct4_q15(
Anna Bridge 160:5571c4ff569f 2398 const arm_dct4_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 2399 q15_t * pState,
Anna Bridge 160:5571c4ff569f 2400 q15_t * pInlineBuffer);
Anna Bridge 160:5571c4ff569f 2401
Anna Bridge 160:5571c4ff569f 2402
Anna Bridge 160:5571c4ff569f 2403 /**
Anna Bridge 160:5571c4ff569f 2404 * @brief Floating-point vector addition.
Anna Bridge 160:5571c4ff569f 2405 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2406 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2407 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2408 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2409 */
Anna Bridge 160:5571c4ff569f 2410 void arm_add_f32(
Anna Bridge 160:5571c4ff569f 2411 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2412 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2413 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2414 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2415
Anna Bridge 160:5571c4ff569f 2416
Anna Bridge 160:5571c4ff569f 2417 /**
Anna Bridge 160:5571c4ff569f 2418 * @brief Q7 vector addition.
Anna Bridge 160:5571c4ff569f 2419 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2420 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2421 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2422 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2423 */
Anna Bridge 160:5571c4ff569f 2424 void arm_add_q7(
Anna Bridge 160:5571c4ff569f 2425 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2426 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2427 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2428 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2429
Anna Bridge 160:5571c4ff569f 2430
Anna Bridge 160:5571c4ff569f 2431 /**
Anna Bridge 160:5571c4ff569f 2432 * @brief Q15 vector addition.
Anna Bridge 160:5571c4ff569f 2433 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2434 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2435 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2436 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2437 */
Anna Bridge 160:5571c4ff569f 2438 void arm_add_q15(
Anna Bridge 160:5571c4ff569f 2439 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2440 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2441 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2442 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2443
Anna Bridge 160:5571c4ff569f 2444
Anna Bridge 160:5571c4ff569f 2445 /**
Anna Bridge 160:5571c4ff569f 2446 * @brief Q31 vector addition.
Anna Bridge 160:5571c4ff569f 2447 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2448 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2449 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2450 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2451 */
Anna Bridge 160:5571c4ff569f 2452 void arm_add_q31(
Anna Bridge 160:5571c4ff569f 2453 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2454 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2455 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2456 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2457
Anna Bridge 160:5571c4ff569f 2458
Anna Bridge 160:5571c4ff569f 2459 /**
Anna Bridge 160:5571c4ff569f 2460 * @brief Floating-point vector subtraction.
Anna Bridge 160:5571c4ff569f 2461 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2462 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2463 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2464 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2465 */
Anna Bridge 160:5571c4ff569f 2466 void arm_sub_f32(
Anna Bridge 160:5571c4ff569f 2467 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2468 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2469 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2470 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2471
Anna Bridge 160:5571c4ff569f 2472
Anna Bridge 160:5571c4ff569f 2473 /**
Anna Bridge 160:5571c4ff569f 2474 * @brief Q7 vector subtraction.
Anna Bridge 160:5571c4ff569f 2475 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2476 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2477 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2478 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2479 */
Anna Bridge 160:5571c4ff569f 2480 void arm_sub_q7(
Anna Bridge 160:5571c4ff569f 2481 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2482 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2483 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2484 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2485
Anna Bridge 160:5571c4ff569f 2486
Anna Bridge 160:5571c4ff569f 2487 /**
Anna Bridge 160:5571c4ff569f 2488 * @brief Q15 vector subtraction.
Anna Bridge 160:5571c4ff569f 2489 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2490 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2491 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2492 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2493 */
Anna Bridge 160:5571c4ff569f 2494 void arm_sub_q15(
Anna Bridge 160:5571c4ff569f 2495 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2496 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2497 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2498 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2499
Anna Bridge 160:5571c4ff569f 2500
Anna Bridge 160:5571c4ff569f 2501 /**
Anna Bridge 160:5571c4ff569f 2502 * @brief Q31 vector subtraction.
Anna Bridge 160:5571c4ff569f 2503 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2504 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2505 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2506 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2507 */
Anna Bridge 160:5571c4ff569f 2508 void arm_sub_q31(
Anna Bridge 160:5571c4ff569f 2509 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2510 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2511 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2512 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2513
Anna Bridge 160:5571c4ff569f 2514
Anna Bridge 160:5571c4ff569f 2515 /**
Anna Bridge 160:5571c4ff569f 2516 * @brief Multiplies a floating-point vector by a scalar.
Anna Bridge 160:5571c4ff569f 2517 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2518 * @param[in] scale scale factor to be applied
Anna Bridge 160:5571c4ff569f 2519 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2520 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2521 */
Anna Bridge 160:5571c4ff569f 2522 void arm_scale_f32(
Anna Bridge 160:5571c4ff569f 2523 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 2524 float32_t scale,
Anna Bridge 160:5571c4ff569f 2525 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2526 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2527
Anna Bridge 160:5571c4ff569f 2528
Anna Bridge 160:5571c4ff569f 2529 /**
Anna Bridge 160:5571c4ff569f 2530 * @brief Multiplies a Q7 vector by a scalar.
Anna Bridge 160:5571c4ff569f 2531 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2532 * @param[in] scaleFract fractional portion of the scale value
Anna Bridge 160:5571c4ff569f 2533 * @param[in] shift number of bits to shift the result by
Anna Bridge 160:5571c4ff569f 2534 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2535 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2536 */
Anna Bridge 160:5571c4ff569f 2537 void arm_scale_q7(
Anna Bridge 160:5571c4ff569f 2538 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 2539 q7_t scaleFract,
Anna Bridge 160:5571c4ff569f 2540 int8_t shift,
Anna Bridge 160:5571c4ff569f 2541 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2542 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2543
Anna Bridge 160:5571c4ff569f 2544
Anna Bridge 160:5571c4ff569f 2545 /**
Anna Bridge 160:5571c4ff569f 2546 * @brief Multiplies a Q15 vector by a scalar.
Anna Bridge 160:5571c4ff569f 2547 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2548 * @param[in] scaleFract fractional portion of the scale value
Anna Bridge 160:5571c4ff569f 2549 * @param[in] shift number of bits to shift the result by
Anna Bridge 160:5571c4ff569f 2550 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2551 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2552 */
Anna Bridge 160:5571c4ff569f 2553 void arm_scale_q15(
Anna Bridge 160:5571c4ff569f 2554 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2555 q15_t scaleFract,
Anna Bridge 160:5571c4ff569f 2556 int8_t shift,
Anna Bridge 160:5571c4ff569f 2557 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2558 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2559
Anna Bridge 160:5571c4ff569f 2560
Anna Bridge 160:5571c4ff569f 2561 /**
Anna Bridge 160:5571c4ff569f 2562 * @brief Multiplies a Q31 vector by a scalar.
Anna Bridge 160:5571c4ff569f 2563 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2564 * @param[in] scaleFract fractional portion of the scale value
Anna Bridge 160:5571c4ff569f 2565 * @param[in] shift number of bits to shift the result by
Anna Bridge 160:5571c4ff569f 2566 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2567 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2568 */
Anna Bridge 160:5571c4ff569f 2569 void arm_scale_q31(
Anna Bridge 160:5571c4ff569f 2570 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2571 q31_t scaleFract,
Anna Bridge 160:5571c4ff569f 2572 int8_t shift,
Anna Bridge 160:5571c4ff569f 2573 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2574 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2575
Anna Bridge 160:5571c4ff569f 2576
Anna Bridge 160:5571c4ff569f 2577 /**
Anna Bridge 160:5571c4ff569f 2578 * @brief Q7 vector absolute value.
Anna Bridge 160:5571c4ff569f 2579 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 2580 * @param[out] pDst points to the output buffer
Anna Bridge 160:5571c4ff569f 2581 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2582 */
Anna Bridge 160:5571c4ff569f 2583 void arm_abs_q7(
Anna Bridge 160:5571c4ff569f 2584 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 2585 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2586 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2587
Anna Bridge 160:5571c4ff569f 2588
Anna Bridge 160:5571c4ff569f 2589 /**
Anna Bridge 160:5571c4ff569f 2590 * @brief Floating-point vector absolute value.
Anna Bridge 160:5571c4ff569f 2591 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 2592 * @param[out] pDst points to the output buffer
Anna Bridge 160:5571c4ff569f 2593 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2594 */
Anna Bridge 160:5571c4ff569f 2595 void arm_abs_f32(
Anna Bridge 160:5571c4ff569f 2596 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 2597 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2598 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2599
Anna Bridge 160:5571c4ff569f 2600
Anna Bridge 160:5571c4ff569f 2601 /**
Anna Bridge 160:5571c4ff569f 2602 * @brief Q15 vector absolute value.
Anna Bridge 160:5571c4ff569f 2603 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 2604 * @param[out] pDst points to the output buffer
Anna Bridge 160:5571c4ff569f 2605 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2606 */
Anna Bridge 160:5571c4ff569f 2607 void arm_abs_q15(
Anna Bridge 160:5571c4ff569f 2608 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2609 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2610 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2611
Anna Bridge 160:5571c4ff569f 2612
Anna Bridge 160:5571c4ff569f 2613 /**
Anna Bridge 160:5571c4ff569f 2614 * @brief Q31 vector absolute value.
Anna Bridge 160:5571c4ff569f 2615 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 2616 * @param[out] pDst points to the output buffer
Anna Bridge 160:5571c4ff569f 2617 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2618 */
Anna Bridge 160:5571c4ff569f 2619 void arm_abs_q31(
Anna Bridge 160:5571c4ff569f 2620 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2621 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2622 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2623
Anna Bridge 160:5571c4ff569f 2624
Anna Bridge 160:5571c4ff569f 2625 /**
Anna Bridge 160:5571c4ff569f 2626 * @brief Dot product of floating-point vectors.
Anna Bridge 160:5571c4ff569f 2627 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2628 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2629 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2630 * @param[out] result output result returned here
Anna Bridge 160:5571c4ff569f 2631 */
Anna Bridge 160:5571c4ff569f 2632 void arm_dot_prod_f32(
Anna Bridge 160:5571c4ff569f 2633 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2634 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2635 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 2636 float32_t * result);
Anna Bridge 160:5571c4ff569f 2637
Anna Bridge 160:5571c4ff569f 2638
Anna Bridge 160:5571c4ff569f 2639 /**
Anna Bridge 160:5571c4ff569f 2640 * @brief Dot product of Q7 vectors.
Anna Bridge 160:5571c4ff569f 2641 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2642 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2643 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2644 * @param[out] result output result returned here
Anna Bridge 160:5571c4ff569f 2645 */
Anna Bridge 160:5571c4ff569f 2646 void arm_dot_prod_q7(
Anna Bridge 160:5571c4ff569f 2647 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2648 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2649 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 2650 q31_t * result);
Anna Bridge 160:5571c4ff569f 2651
Anna Bridge 160:5571c4ff569f 2652
Anna Bridge 160:5571c4ff569f 2653 /**
Anna Bridge 160:5571c4ff569f 2654 * @brief Dot product of Q15 vectors.
Anna Bridge 160:5571c4ff569f 2655 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2656 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2657 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2658 * @param[out] result output result returned here
Anna Bridge 160:5571c4ff569f 2659 */
Anna Bridge 160:5571c4ff569f 2660 void arm_dot_prod_q15(
Anna Bridge 160:5571c4ff569f 2661 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2662 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2663 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 2664 q63_t * result);
Anna Bridge 160:5571c4ff569f 2665
Anna Bridge 160:5571c4ff569f 2666
Anna Bridge 160:5571c4ff569f 2667 /**
Anna Bridge 160:5571c4ff569f 2668 * @brief Dot product of Q31 vectors.
Anna Bridge 160:5571c4ff569f 2669 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 2670 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 2671 * @param[in] blockSize number of samples in each vector
Anna Bridge 160:5571c4ff569f 2672 * @param[out] result output result returned here
Anna Bridge 160:5571c4ff569f 2673 */
Anna Bridge 160:5571c4ff569f 2674 void arm_dot_prod_q31(
Anna Bridge 160:5571c4ff569f 2675 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2676 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2677 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 2678 q63_t * result);
Anna Bridge 160:5571c4ff569f 2679
Anna Bridge 160:5571c4ff569f 2680
Anna Bridge 160:5571c4ff569f 2681 /**
Anna Bridge 160:5571c4ff569f 2682 * @brief Shifts the elements of a Q7 vector a specified number of bits.
Anna Bridge 160:5571c4ff569f 2683 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2684 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
Anna Bridge 160:5571c4ff569f 2685 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2686 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2687 */
Anna Bridge 160:5571c4ff569f 2688 void arm_shift_q7(
Anna Bridge 160:5571c4ff569f 2689 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 2690 int8_t shiftBits,
Anna Bridge 160:5571c4ff569f 2691 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2692 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2693
Anna Bridge 160:5571c4ff569f 2694
Anna Bridge 160:5571c4ff569f 2695 /**
Anna Bridge 160:5571c4ff569f 2696 * @brief Shifts the elements of a Q15 vector a specified number of bits.
Anna Bridge 160:5571c4ff569f 2697 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2698 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
Anna Bridge 160:5571c4ff569f 2699 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2700 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2701 */
Anna Bridge 160:5571c4ff569f 2702 void arm_shift_q15(
Anna Bridge 160:5571c4ff569f 2703 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2704 int8_t shiftBits,
Anna Bridge 160:5571c4ff569f 2705 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2706 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2707
Anna Bridge 160:5571c4ff569f 2708
Anna Bridge 160:5571c4ff569f 2709 /**
Anna Bridge 160:5571c4ff569f 2710 * @brief Shifts the elements of a Q31 vector a specified number of bits.
Anna Bridge 160:5571c4ff569f 2711 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2712 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
Anna Bridge 160:5571c4ff569f 2713 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2714 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2715 */
Anna Bridge 160:5571c4ff569f 2716 void arm_shift_q31(
Anna Bridge 160:5571c4ff569f 2717 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2718 int8_t shiftBits,
Anna Bridge 160:5571c4ff569f 2719 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2720 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2721
Anna Bridge 160:5571c4ff569f 2722
Anna Bridge 160:5571c4ff569f 2723 /**
Anna Bridge 160:5571c4ff569f 2724 * @brief Adds a constant offset to a floating-point vector.
Anna Bridge 160:5571c4ff569f 2725 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2726 * @param[in] offset is the offset to be added
Anna Bridge 160:5571c4ff569f 2727 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2728 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2729 */
Anna Bridge 160:5571c4ff569f 2730 void arm_offset_f32(
Anna Bridge 160:5571c4ff569f 2731 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 2732 float32_t offset,
Anna Bridge 160:5571c4ff569f 2733 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2734 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2735
Anna Bridge 160:5571c4ff569f 2736
Anna Bridge 160:5571c4ff569f 2737 /**
Anna Bridge 160:5571c4ff569f 2738 * @brief Adds a constant offset to a Q7 vector.
Anna Bridge 160:5571c4ff569f 2739 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2740 * @param[in] offset is the offset to be added
Anna Bridge 160:5571c4ff569f 2741 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2742 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2743 */
Anna Bridge 160:5571c4ff569f 2744 void arm_offset_q7(
Anna Bridge 160:5571c4ff569f 2745 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 2746 q7_t offset,
Anna Bridge 160:5571c4ff569f 2747 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2748 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2749
Anna Bridge 160:5571c4ff569f 2750
Anna Bridge 160:5571c4ff569f 2751 /**
Anna Bridge 160:5571c4ff569f 2752 * @brief Adds a constant offset to a Q15 vector.
Anna Bridge 160:5571c4ff569f 2753 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2754 * @param[in] offset is the offset to be added
Anna Bridge 160:5571c4ff569f 2755 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2756 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2757 */
Anna Bridge 160:5571c4ff569f 2758 void arm_offset_q15(
Anna Bridge 160:5571c4ff569f 2759 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2760 q15_t offset,
Anna Bridge 160:5571c4ff569f 2761 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2762 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2763
Anna Bridge 160:5571c4ff569f 2764
Anna Bridge 160:5571c4ff569f 2765 /**
Anna Bridge 160:5571c4ff569f 2766 * @brief Adds a constant offset to a Q31 vector.
Anna Bridge 160:5571c4ff569f 2767 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2768 * @param[in] offset is the offset to be added
Anna Bridge 160:5571c4ff569f 2769 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2770 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2771 */
Anna Bridge 160:5571c4ff569f 2772 void arm_offset_q31(
Anna Bridge 160:5571c4ff569f 2773 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2774 q31_t offset,
Anna Bridge 160:5571c4ff569f 2775 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2776 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2777
Anna Bridge 160:5571c4ff569f 2778
Anna Bridge 160:5571c4ff569f 2779 /**
Anna Bridge 160:5571c4ff569f 2780 * @brief Negates the elements of a floating-point vector.
Anna Bridge 160:5571c4ff569f 2781 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2782 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2783 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2784 */
Anna Bridge 160:5571c4ff569f 2785 void arm_negate_f32(
Anna Bridge 160:5571c4ff569f 2786 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 2787 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2788 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2789
Anna Bridge 160:5571c4ff569f 2790
Anna Bridge 160:5571c4ff569f 2791 /**
Anna Bridge 160:5571c4ff569f 2792 * @brief Negates the elements of a Q7 vector.
Anna Bridge 160:5571c4ff569f 2793 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2794 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2795 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2796 */
Anna Bridge 160:5571c4ff569f 2797 void arm_negate_q7(
Anna Bridge 160:5571c4ff569f 2798 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 2799 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2800 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2801
Anna Bridge 160:5571c4ff569f 2802
Anna Bridge 160:5571c4ff569f 2803 /**
Anna Bridge 160:5571c4ff569f 2804 * @brief Negates the elements of a Q15 vector.
Anna Bridge 160:5571c4ff569f 2805 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2806 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2807 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2808 */
Anna Bridge 160:5571c4ff569f 2809 void arm_negate_q15(
Anna Bridge 160:5571c4ff569f 2810 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2811 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2812 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2813
Anna Bridge 160:5571c4ff569f 2814
Anna Bridge 160:5571c4ff569f 2815 /**
Anna Bridge 160:5571c4ff569f 2816 * @brief Negates the elements of a Q31 vector.
Anna Bridge 160:5571c4ff569f 2817 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 2818 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 2819 * @param[in] blockSize number of samples in the vector
Anna Bridge 160:5571c4ff569f 2820 */
Anna Bridge 160:5571c4ff569f 2821 void arm_negate_q31(
Anna Bridge 160:5571c4ff569f 2822 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2823 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2824 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2825
Anna Bridge 160:5571c4ff569f 2826
Anna Bridge 160:5571c4ff569f 2827 /**
Anna Bridge 160:5571c4ff569f 2828 * @brief Copies the elements of a floating-point vector.
Anna Bridge 160:5571c4ff569f 2829 * @param[in] pSrc input pointer
Anna Bridge 160:5571c4ff569f 2830 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2831 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2832 */
Anna Bridge 160:5571c4ff569f 2833 void arm_copy_f32(
Anna Bridge 160:5571c4ff569f 2834 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 2835 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2836 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2837
Anna Bridge 160:5571c4ff569f 2838
Anna Bridge 160:5571c4ff569f 2839 /**
Anna Bridge 160:5571c4ff569f 2840 * @brief Copies the elements of a Q7 vector.
Anna Bridge 160:5571c4ff569f 2841 * @param[in] pSrc input pointer
Anna Bridge 160:5571c4ff569f 2842 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2843 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2844 */
Anna Bridge 160:5571c4ff569f 2845 void arm_copy_q7(
Anna Bridge 160:5571c4ff569f 2846 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 2847 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2848 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2849
Anna Bridge 160:5571c4ff569f 2850
Anna Bridge 160:5571c4ff569f 2851 /**
Anna Bridge 160:5571c4ff569f 2852 * @brief Copies the elements of a Q15 vector.
Anna Bridge 160:5571c4ff569f 2853 * @param[in] pSrc input pointer
Anna Bridge 160:5571c4ff569f 2854 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2855 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2856 */
Anna Bridge 160:5571c4ff569f 2857 void arm_copy_q15(
Anna Bridge 160:5571c4ff569f 2858 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 2859 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2860 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2861
Anna Bridge 160:5571c4ff569f 2862
Anna Bridge 160:5571c4ff569f 2863 /**
Anna Bridge 160:5571c4ff569f 2864 * @brief Copies the elements of a Q31 vector.
Anna Bridge 160:5571c4ff569f 2865 * @param[in] pSrc input pointer
Anna Bridge 160:5571c4ff569f 2866 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2867 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2868 */
Anna Bridge 160:5571c4ff569f 2869 void arm_copy_q31(
Anna Bridge 160:5571c4ff569f 2870 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 2871 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2872 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2873
Anna Bridge 160:5571c4ff569f 2874
Anna Bridge 160:5571c4ff569f 2875 /**
Anna Bridge 160:5571c4ff569f 2876 * @brief Fills a constant value into a floating-point vector.
Anna Bridge 160:5571c4ff569f 2877 * @param[in] value input value to be filled
Anna Bridge 160:5571c4ff569f 2878 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2879 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2880 */
Anna Bridge 160:5571c4ff569f 2881 void arm_fill_f32(
Anna Bridge 160:5571c4ff569f 2882 float32_t value,
Anna Bridge 160:5571c4ff569f 2883 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 2884 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2885
Anna Bridge 160:5571c4ff569f 2886
Anna Bridge 160:5571c4ff569f 2887 /**
Anna Bridge 160:5571c4ff569f 2888 * @brief Fills a constant value into a Q7 vector.
Anna Bridge 160:5571c4ff569f 2889 * @param[in] value input value to be filled
Anna Bridge 160:5571c4ff569f 2890 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2891 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2892 */
Anna Bridge 160:5571c4ff569f 2893 void arm_fill_q7(
Anna Bridge 160:5571c4ff569f 2894 q7_t value,
Anna Bridge 160:5571c4ff569f 2895 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 2896 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2897
Anna Bridge 160:5571c4ff569f 2898
Anna Bridge 160:5571c4ff569f 2899 /**
Anna Bridge 160:5571c4ff569f 2900 * @brief Fills a constant value into a Q15 vector.
Anna Bridge 160:5571c4ff569f 2901 * @param[in] value input value to be filled
Anna Bridge 160:5571c4ff569f 2902 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2903 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2904 */
Anna Bridge 160:5571c4ff569f 2905 void arm_fill_q15(
Anna Bridge 160:5571c4ff569f 2906 q15_t value,
Anna Bridge 160:5571c4ff569f 2907 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2908 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2909
Anna Bridge 160:5571c4ff569f 2910
Anna Bridge 160:5571c4ff569f 2911 /**
Anna Bridge 160:5571c4ff569f 2912 * @brief Fills a constant value into a Q31 vector.
Anna Bridge 160:5571c4ff569f 2913 * @param[in] value input value to be filled
Anna Bridge 160:5571c4ff569f 2914 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 2915 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 2916 */
Anna Bridge 160:5571c4ff569f 2917 void arm_fill_q31(
Anna Bridge 160:5571c4ff569f 2918 q31_t value,
Anna Bridge 160:5571c4ff569f 2919 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 2920 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 2921
Anna Bridge 160:5571c4ff569f 2922
Anna Bridge 160:5571c4ff569f 2923 /**
Anna Bridge 160:5571c4ff569f 2924 * @brief Convolution of floating-point sequences.
Anna Bridge 160:5571c4ff569f 2925 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 2926 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 2927 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 2928 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 2929 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 2930 */
Anna Bridge 160:5571c4ff569f 2931 void arm_conv_f32(
Anna Bridge 160:5571c4ff569f 2932 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2933 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 2934 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2935 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 2936 float32_t * pDst);
Anna Bridge 160:5571c4ff569f 2937
Anna Bridge 160:5571c4ff569f 2938
Anna Bridge 160:5571c4ff569f 2939 /**
Anna Bridge 160:5571c4ff569f 2940 * @brief Convolution of Q15 sequences.
Anna Bridge 160:5571c4ff569f 2941 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 2942 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 2943 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 2944 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 2945 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 2946 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 2947 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 2948 */
Anna Bridge 160:5571c4ff569f 2949 void arm_conv_opt_q15(
Anna Bridge 160:5571c4ff569f 2950 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2951 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 2952 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2953 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 2954 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 2955 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 2956 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 2957
Anna Bridge 160:5571c4ff569f 2958
Anna Bridge 160:5571c4ff569f 2959 /**
Anna Bridge 160:5571c4ff569f 2960 * @brief Convolution of Q15 sequences.
Anna Bridge 160:5571c4ff569f 2961 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 2962 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 2963 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 2964 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 2965 * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 2966 */
Anna Bridge 160:5571c4ff569f 2967 void arm_conv_q15(
Anna Bridge 160:5571c4ff569f 2968 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2969 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 2970 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2971 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 2972 q15_t * pDst);
Anna Bridge 160:5571c4ff569f 2973
Anna Bridge 160:5571c4ff569f 2974
Anna Bridge 160:5571c4ff569f 2975 /**
Anna Bridge 160:5571c4ff569f 2976 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 2977 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 2978 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 2979 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 2980 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 2981 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 2982 */
Anna Bridge 160:5571c4ff569f 2983 void arm_conv_fast_q15(
Anna Bridge 160:5571c4ff569f 2984 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 2985 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 2986 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 2987 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 2988 q15_t * pDst);
Anna Bridge 160:5571c4ff569f 2989
Anna Bridge 160:5571c4ff569f 2990
Anna Bridge 160:5571c4ff569f 2991 /**
Anna Bridge 160:5571c4ff569f 2992 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 2993 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 2994 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 2995 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 2996 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 2997 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 2998 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 2999 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 3000 */
Anna Bridge 160:5571c4ff569f 3001 void arm_conv_fast_opt_q15(
Anna Bridge 160:5571c4ff569f 3002 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3003 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3004 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3005 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3006 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3007 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 3008 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 3009
Anna Bridge 160:5571c4ff569f 3010
Anna Bridge 160:5571c4ff569f 3011 /**
Anna Bridge 160:5571c4ff569f 3012 * @brief Convolution of Q31 sequences.
Anna Bridge 160:5571c4ff569f 3013 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3014 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3015 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3016 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3017 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 3018 */
Anna Bridge 160:5571c4ff569f 3019 void arm_conv_q31(
Anna Bridge 160:5571c4ff569f 3020 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3021 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3022 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3023 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3024 q31_t * pDst);
Anna Bridge 160:5571c4ff569f 3025
Anna Bridge 160:5571c4ff569f 3026
Anna Bridge 160:5571c4ff569f 3027 /**
Anna Bridge 160:5571c4ff569f 3028 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 3029 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3030 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3031 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3032 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3033 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 3034 */
Anna Bridge 160:5571c4ff569f 3035 void arm_conv_fast_q31(
Anna Bridge 160:5571c4ff569f 3036 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3037 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3038 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3039 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3040 q31_t * pDst);
Anna Bridge 160:5571c4ff569f 3041
Anna Bridge 160:5571c4ff569f 3042
Anna Bridge 160:5571c4ff569f 3043 /**
Anna Bridge 160:5571c4ff569f 3044 * @brief Convolution of Q7 sequences.
Anna Bridge 160:5571c4ff569f 3045 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3046 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3047 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3048 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3049 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 3050 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 3051 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 3052 */
Anna Bridge 160:5571c4ff569f 3053 void arm_conv_opt_q7(
Anna Bridge 160:5571c4ff569f 3054 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3055 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3056 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3057 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3058 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 3059 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 3060 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 3061
Anna Bridge 160:5571c4ff569f 3062
Anna Bridge 160:5571c4ff569f 3063 /**
Anna Bridge 160:5571c4ff569f 3064 * @brief Convolution of Q7 sequences.
Anna Bridge 160:5571c4ff569f 3065 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3066 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3067 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3068 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3069 * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
Anna Bridge 160:5571c4ff569f 3070 */
Anna Bridge 160:5571c4ff569f 3071 void arm_conv_q7(
Anna Bridge 160:5571c4ff569f 3072 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3073 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3074 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3075 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3076 q7_t * pDst);
Anna Bridge 160:5571c4ff569f 3077
Anna Bridge 160:5571c4ff569f 3078
Anna Bridge 160:5571c4ff569f 3079 /**
Anna Bridge 160:5571c4ff569f 3080 * @brief Partial convolution of floating-point sequences.
Anna Bridge 160:5571c4ff569f 3081 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3082 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3083 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3084 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3085 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3086 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3087 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3088 * @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].
Anna Bridge 160:5571c4ff569f 3089 */
Anna Bridge 160:5571c4ff569f 3090 arm_status arm_conv_partial_f32(
Anna Bridge 160:5571c4ff569f 3091 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3092 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3093 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3094 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3095 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3096 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3097 uint32_t numPoints);
Anna Bridge 160:5571c4ff569f 3098
Anna Bridge 160:5571c4ff569f 3099
Anna Bridge 160:5571c4ff569f 3100 /**
Anna Bridge 160:5571c4ff569f 3101 * @brief Partial convolution of Q15 sequences.
Anna Bridge 160:5571c4ff569f 3102 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3103 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3104 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3105 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3106 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3107 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3108 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3109 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 3110 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 3111 * @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].
Anna Bridge 160:5571c4ff569f 3112 */
Anna Bridge 160:5571c4ff569f 3113 arm_status arm_conv_partial_opt_q15(
Anna Bridge 160:5571c4ff569f 3114 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3115 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3116 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3117 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3118 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3119 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3120 uint32_t numPoints,
Anna Bridge 160:5571c4ff569f 3121 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 3122 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 3123
Anna Bridge 160:5571c4ff569f 3124
Anna Bridge 160:5571c4ff569f 3125 /**
Anna Bridge 160:5571c4ff569f 3126 * @brief Partial convolution of Q15 sequences.
Anna Bridge 160:5571c4ff569f 3127 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3128 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3129 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3130 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3131 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3132 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3133 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3134 * @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].
Anna Bridge 160:5571c4ff569f 3135 */
Anna Bridge 160:5571c4ff569f 3136 arm_status arm_conv_partial_q15(
Anna Bridge 160:5571c4ff569f 3137 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3138 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3139 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3140 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3141 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3142 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3143 uint32_t numPoints);
Anna Bridge 160:5571c4ff569f 3144
Anna Bridge 160:5571c4ff569f 3145
Anna Bridge 160:5571c4ff569f 3146 /**
Anna Bridge 160:5571c4ff569f 3147 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 3148 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3149 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3150 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3151 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3152 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3153 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3154 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3155 * @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].
Anna Bridge 160:5571c4ff569f 3156 */
Anna Bridge 160:5571c4ff569f 3157 arm_status arm_conv_partial_fast_q15(
Anna Bridge 160:5571c4ff569f 3158 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3159 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3160 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3161 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3162 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3163 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3164 uint32_t numPoints);
Anna Bridge 160:5571c4ff569f 3165
Anna Bridge 160:5571c4ff569f 3166
Anna Bridge 160:5571c4ff569f 3167 /**
Anna Bridge 160:5571c4ff569f 3168 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 3169 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3170 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3171 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3172 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3173 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3174 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3175 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3176 * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 3177 * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 3178 * @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].
Anna Bridge 160:5571c4ff569f 3179 */
Anna Bridge 160:5571c4ff569f 3180 arm_status arm_conv_partial_fast_opt_q15(
Anna Bridge 160:5571c4ff569f 3181 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3182 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3183 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3184 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3185 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3186 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3187 uint32_t numPoints,
Anna Bridge 160:5571c4ff569f 3188 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 3189 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 3190
Anna Bridge 160:5571c4ff569f 3191
Anna Bridge 160:5571c4ff569f 3192 /**
Anna Bridge 160:5571c4ff569f 3193 * @brief Partial convolution of Q31 sequences.
Anna Bridge 160:5571c4ff569f 3194 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3195 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3196 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3197 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3198 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3199 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3200 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3201 * @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].
Anna Bridge 160:5571c4ff569f 3202 */
Anna Bridge 160:5571c4ff569f 3203 arm_status arm_conv_partial_q31(
Anna Bridge 160:5571c4ff569f 3204 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3205 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3206 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3207 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3208 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3209 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3210 uint32_t numPoints);
Anna Bridge 160:5571c4ff569f 3211
Anna Bridge 160:5571c4ff569f 3212
Anna Bridge 160:5571c4ff569f 3213 /**
Anna Bridge 160:5571c4ff569f 3214 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 3215 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3216 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3217 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3218 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3219 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3220 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3221 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3222 * @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].
Anna Bridge 160:5571c4ff569f 3223 */
Anna Bridge 160:5571c4ff569f 3224 arm_status arm_conv_partial_fast_q31(
Anna Bridge 160:5571c4ff569f 3225 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3226 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3227 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3228 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3229 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3230 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3231 uint32_t numPoints);
Anna Bridge 160:5571c4ff569f 3232
Anna Bridge 160:5571c4ff569f 3233
Anna Bridge 160:5571c4ff569f 3234 /**
Anna Bridge 160:5571c4ff569f 3235 * @brief Partial convolution of Q7 sequences
Anna Bridge 160:5571c4ff569f 3236 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3237 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3238 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3239 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3240 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3241 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3242 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3243 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 3244 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 3245 * @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].
Anna Bridge 160:5571c4ff569f 3246 */
Anna Bridge 160:5571c4ff569f 3247 arm_status arm_conv_partial_opt_q7(
Anna Bridge 160:5571c4ff569f 3248 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3249 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3250 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3251 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3252 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 3253 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3254 uint32_t numPoints,
Anna Bridge 160:5571c4ff569f 3255 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 3256 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 3257
Anna Bridge 160:5571c4ff569f 3258
Anna Bridge 160:5571c4ff569f 3259 /**
Anna Bridge 160:5571c4ff569f 3260 * @brief Partial convolution of Q7 sequences.
Anna Bridge 160:5571c4ff569f 3261 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 3262 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 3263 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 3264 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 3265 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3266 * @param[in] firstIndex is the first output sample to start with.
Anna Bridge 160:5571c4ff569f 3267 * @param[in] numPoints is the number of output points to be computed.
Anna Bridge 160:5571c4ff569f 3268 * @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].
Anna Bridge 160:5571c4ff569f 3269 */
Anna Bridge 160:5571c4ff569f 3270 arm_status arm_conv_partial_q7(
Anna Bridge 160:5571c4ff569f 3271 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 3272 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 3273 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 3274 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 3275 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 3276 uint32_t firstIndex,
Anna Bridge 160:5571c4ff569f 3277 uint32_t numPoints);
Anna Bridge 160:5571c4ff569f 3278
Anna Bridge 160:5571c4ff569f 3279
Anna Bridge 160:5571c4ff569f 3280 /**
Anna Bridge 160:5571c4ff569f 3281 * @brief Instance structure for the Q15 FIR decimator.
Anna Bridge 160:5571c4ff569f 3282 */
Anna Bridge 160:5571c4ff569f 3283 typedef struct
Anna Bridge 160:5571c4ff569f 3284 {
Anna Bridge 160:5571c4ff569f 3285 uint8_t M; /**< decimation factor. */
Anna Bridge 160:5571c4ff569f 3286 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 3287 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 3288 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 3289 } arm_fir_decimate_instance_q15;
Anna Bridge 160:5571c4ff569f 3290
Anna Bridge 160:5571c4ff569f 3291 /**
Anna Bridge 160:5571c4ff569f 3292 * @brief Instance structure for the Q31 FIR decimator.
Anna Bridge 160:5571c4ff569f 3293 */
Anna Bridge 160:5571c4ff569f 3294 typedef struct
Anna Bridge 160:5571c4ff569f 3295 {
Anna Bridge 160:5571c4ff569f 3296 uint8_t M; /**< decimation factor. */
Anna Bridge 160:5571c4ff569f 3297 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 3298 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 3299 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 3300 } arm_fir_decimate_instance_q31;
Anna Bridge 160:5571c4ff569f 3301
Anna Bridge 160:5571c4ff569f 3302 /**
Anna Bridge 160:5571c4ff569f 3303 * @brief Instance structure for the floating-point FIR decimator.
Anna Bridge 160:5571c4ff569f 3304 */
Anna Bridge 160:5571c4ff569f 3305 typedef struct
Anna Bridge 160:5571c4ff569f 3306 {
Anna Bridge 160:5571c4ff569f 3307 uint8_t M; /**< decimation factor. */
Anna Bridge 160:5571c4ff569f 3308 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 3309 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 3310 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 3311 } arm_fir_decimate_instance_f32;
Anna Bridge 160:5571c4ff569f 3312
Anna Bridge 160:5571c4ff569f 3313
Anna Bridge 160:5571c4ff569f 3314 /**
Anna Bridge 160:5571c4ff569f 3315 * @brief Processing function for the floating-point FIR decimator.
Anna Bridge 160:5571c4ff569f 3316 * @param[in] S points to an instance of the floating-point FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3317 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3318 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3319 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3320 */
Anna Bridge 160:5571c4ff569f 3321 void arm_fir_decimate_f32(
Anna Bridge 160:5571c4ff569f 3322 const arm_fir_decimate_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3323 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 3324 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3325 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3326
Anna Bridge 160:5571c4ff569f 3327
Anna Bridge 160:5571c4ff569f 3328 /**
Anna Bridge 160:5571c4ff569f 3329 * @brief Initialization function for the floating-point FIR decimator.
Anna Bridge 160:5571c4ff569f 3330 * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3331 * @param[in] numTaps number of coefficients in the filter.
Anna Bridge 160:5571c4ff569f 3332 * @param[in] M decimation factor.
Anna Bridge 160:5571c4ff569f 3333 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3334 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3335 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3336 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
Anna Bridge 160:5571c4ff569f 3337 * <code>blockSize</code> is not a multiple of <code>M</code>.
Anna Bridge 160:5571c4ff569f 3338 */
Anna Bridge 160:5571c4ff569f 3339 arm_status arm_fir_decimate_init_f32(
Anna Bridge 160:5571c4ff569f 3340 arm_fir_decimate_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3341 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 3342 uint8_t M,
Anna Bridge 160:5571c4ff569f 3343 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3344 float32_t * pState,
Anna Bridge 160:5571c4ff569f 3345 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3346
Anna Bridge 160:5571c4ff569f 3347
Anna Bridge 160:5571c4ff569f 3348 /**
Anna Bridge 160:5571c4ff569f 3349 * @brief Processing function for the Q15 FIR decimator.
Anna Bridge 160:5571c4ff569f 3350 * @param[in] S points to an instance of the Q15 FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3351 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3352 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3353 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3354 */
Anna Bridge 160:5571c4ff569f 3355 void arm_fir_decimate_q15(
Anna Bridge 160:5571c4ff569f 3356 const arm_fir_decimate_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3357 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 3358 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3359 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3360
Anna Bridge 160:5571c4ff569f 3361
Anna Bridge 160:5571c4ff569f 3362 /**
Anna Bridge 160:5571c4ff569f 3363 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 3364 * @param[in] S points to an instance of the Q15 FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3365 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3366 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3367 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3368 */
Anna Bridge 160:5571c4ff569f 3369 void arm_fir_decimate_fast_q15(
Anna Bridge 160:5571c4ff569f 3370 const arm_fir_decimate_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3371 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 3372 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3373 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3374
Anna Bridge 160:5571c4ff569f 3375
Anna Bridge 160:5571c4ff569f 3376 /**
Anna Bridge 160:5571c4ff569f 3377 * @brief Initialization function for the Q15 FIR decimator.
Anna Bridge 160:5571c4ff569f 3378 * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3379 * @param[in] numTaps number of coefficients in the filter.
Anna Bridge 160:5571c4ff569f 3380 * @param[in] M decimation factor.
Anna Bridge 160:5571c4ff569f 3381 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3382 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3383 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3384 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
Anna Bridge 160:5571c4ff569f 3385 * <code>blockSize</code> is not a multiple of <code>M</code>.
Anna Bridge 160:5571c4ff569f 3386 */
Anna Bridge 160:5571c4ff569f 3387 arm_status arm_fir_decimate_init_q15(
Anna Bridge 160:5571c4ff569f 3388 arm_fir_decimate_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3389 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 3390 uint8_t M,
Anna Bridge 160:5571c4ff569f 3391 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3392 q15_t * pState,
Anna Bridge 160:5571c4ff569f 3393 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3394
Anna Bridge 160:5571c4ff569f 3395
Anna Bridge 160:5571c4ff569f 3396 /**
Anna Bridge 160:5571c4ff569f 3397 * @brief Processing function for the Q31 FIR decimator.
Anna Bridge 160:5571c4ff569f 3398 * @param[in] S points to an instance of the Q31 FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3399 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3400 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3401 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3402 */
Anna Bridge 160:5571c4ff569f 3403 void arm_fir_decimate_q31(
Anna Bridge 160:5571c4ff569f 3404 const arm_fir_decimate_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3405 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 3406 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3407 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3408
Anna Bridge 160:5571c4ff569f 3409 /**
Anna Bridge 160:5571c4ff569f 3410 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 3411 * @param[in] S points to an instance of the Q31 FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3412 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3413 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3414 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3415 */
Anna Bridge 160:5571c4ff569f 3416 void arm_fir_decimate_fast_q31(
Anna Bridge 160:5571c4ff569f 3417 arm_fir_decimate_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3418 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 3419 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3420 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3421
Anna Bridge 160:5571c4ff569f 3422
Anna Bridge 160:5571c4ff569f 3423 /**
Anna Bridge 160:5571c4ff569f 3424 * @brief Initialization function for the Q31 FIR decimator.
Anna Bridge 160:5571c4ff569f 3425 * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
Anna Bridge 160:5571c4ff569f 3426 * @param[in] numTaps number of coefficients in the filter.
Anna Bridge 160:5571c4ff569f 3427 * @param[in] M decimation factor.
Anna Bridge 160:5571c4ff569f 3428 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3429 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3430 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3431 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
Anna Bridge 160:5571c4ff569f 3432 * <code>blockSize</code> is not a multiple of <code>M</code>.
Anna Bridge 160:5571c4ff569f 3433 */
Anna Bridge 160:5571c4ff569f 3434 arm_status arm_fir_decimate_init_q31(
Anna Bridge 160:5571c4ff569f 3435 arm_fir_decimate_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3436 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 3437 uint8_t M,
Anna Bridge 160:5571c4ff569f 3438 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3439 q31_t * pState,
Anna Bridge 160:5571c4ff569f 3440 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3441
Anna Bridge 160:5571c4ff569f 3442
Anna Bridge 160:5571c4ff569f 3443 /**
Anna Bridge 160:5571c4ff569f 3444 * @brief Instance structure for the Q15 FIR interpolator.
Anna Bridge 160:5571c4ff569f 3445 */
Anna Bridge 160:5571c4ff569f 3446 typedef struct
Anna Bridge 160:5571c4ff569f 3447 {
Anna Bridge 160:5571c4ff569f 3448 uint8_t L; /**< upsample factor. */
Anna Bridge 160:5571c4ff569f 3449 uint16_t phaseLength; /**< length of each polyphase filter component. */
Anna Bridge 160:5571c4ff569f 3450 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
Anna Bridge 160:5571c4ff569f 3451 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
Anna Bridge 160:5571c4ff569f 3452 } arm_fir_interpolate_instance_q15;
Anna Bridge 160:5571c4ff569f 3453
Anna Bridge 160:5571c4ff569f 3454 /**
Anna Bridge 160:5571c4ff569f 3455 * @brief Instance structure for the Q31 FIR interpolator.
Anna Bridge 160:5571c4ff569f 3456 */
Anna Bridge 160:5571c4ff569f 3457 typedef struct
Anna Bridge 160:5571c4ff569f 3458 {
Anna Bridge 160:5571c4ff569f 3459 uint8_t L; /**< upsample factor. */
Anna Bridge 160:5571c4ff569f 3460 uint16_t phaseLength; /**< length of each polyphase filter component. */
Anna Bridge 160:5571c4ff569f 3461 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
Anna Bridge 160:5571c4ff569f 3462 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
Anna Bridge 160:5571c4ff569f 3463 } arm_fir_interpolate_instance_q31;
Anna Bridge 160:5571c4ff569f 3464
Anna Bridge 160:5571c4ff569f 3465 /**
Anna Bridge 160:5571c4ff569f 3466 * @brief Instance structure for the floating-point FIR interpolator.
Anna Bridge 160:5571c4ff569f 3467 */
Anna Bridge 160:5571c4ff569f 3468 typedef struct
Anna Bridge 160:5571c4ff569f 3469 {
Anna Bridge 160:5571c4ff569f 3470 uint8_t L; /**< upsample factor. */
Anna Bridge 160:5571c4ff569f 3471 uint16_t phaseLength; /**< length of each polyphase filter component. */
Anna Bridge 160:5571c4ff569f 3472 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
Anna Bridge 160:5571c4ff569f 3473 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
Anna Bridge 160:5571c4ff569f 3474 } arm_fir_interpolate_instance_f32;
Anna Bridge 160:5571c4ff569f 3475
Anna Bridge 160:5571c4ff569f 3476
Anna Bridge 160:5571c4ff569f 3477 /**
Anna Bridge 160:5571c4ff569f 3478 * @brief Processing function for the Q15 FIR interpolator.
Anna Bridge 160:5571c4ff569f 3479 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
Anna Bridge 160:5571c4ff569f 3480 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3481 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3482 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3483 */
Anna Bridge 160:5571c4ff569f 3484 void arm_fir_interpolate_q15(
Anna Bridge 160:5571c4ff569f 3485 const arm_fir_interpolate_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3486 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 3487 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3488 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3489
Anna Bridge 160:5571c4ff569f 3490
Anna Bridge 160:5571c4ff569f 3491 /**
Anna Bridge 160:5571c4ff569f 3492 * @brief Initialization function for the Q15 FIR interpolator.
Anna Bridge 160:5571c4ff569f 3493 * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
Anna Bridge 160:5571c4ff569f 3494 * @param[in] L upsample factor.
Anna Bridge 160:5571c4ff569f 3495 * @param[in] numTaps number of filter coefficients in the filter.
Anna Bridge 160:5571c4ff569f 3496 * @param[in] pCoeffs points to the filter coefficient buffer.
Anna Bridge 160:5571c4ff569f 3497 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3498 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3499 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
Anna Bridge 160:5571c4ff569f 3500 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
Anna Bridge 160:5571c4ff569f 3501 */
Anna Bridge 160:5571c4ff569f 3502 arm_status arm_fir_interpolate_init_q15(
Anna Bridge 160:5571c4ff569f 3503 arm_fir_interpolate_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3504 uint8_t L,
Anna Bridge 160:5571c4ff569f 3505 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 3506 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3507 q15_t * pState,
Anna Bridge 160:5571c4ff569f 3508 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3509
Anna Bridge 160:5571c4ff569f 3510
Anna Bridge 160:5571c4ff569f 3511 /**
Anna Bridge 160:5571c4ff569f 3512 * @brief Processing function for the Q31 FIR interpolator.
Anna Bridge 160:5571c4ff569f 3513 * @param[in] S points to an instance of the Q15 FIR interpolator structure.
Anna Bridge 160:5571c4ff569f 3514 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3515 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3516 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3517 */
Anna Bridge 160:5571c4ff569f 3518 void arm_fir_interpolate_q31(
Anna Bridge 160:5571c4ff569f 3519 const arm_fir_interpolate_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3520 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 3521 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3522 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3523
Anna Bridge 160:5571c4ff569f 3524
Anna Bridge 160:5571c4ff569f 3525 /**
Anna Bridge 160:5571c4ff569f 3526 * @brief Initialization function for the Q31 FIR interpolator.
Anna Bridge 160:5571c4ff569f 3527 * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
Anna Bridge 160:5571c4ff569f 3528 * @param[in] L upsample factor.
Anna Bridge 160:5571c4ff569f 3529 * @param[in] numTaps number of filter coefficients in the filter.
Anna Bridge 160:5571c4ff569f 3530 * @param[in] pCoeffs points to the filter coefficient buffer.
Anna Bridge 160:5571c4ff569f 3531 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3532 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3533 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
Anna Bridge 160:5571c4ff569f 3534 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
Anna Bridge 160:5571c4ff569f 3535 */
Anna Bridge 160:5571c4ff569f 3536 arm_status arm_fir_interpolate_init_q31(
Anna Bridge 160:5571c4ff569f 3537 arm_fir_interpolate_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3538 uint8_t L,
Anna Bridge 160:5571c4ff569f 3539 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 3540 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3541 q31_t * pState,
Anna Bridge 160:5571c4ff569f 3542 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3543
Anna Bridge 160:5571c4ff569f 3544
Anna Bridge 160:5571c4ff569f 3545 /**
Anna Bridge 160:5571c4ff569f 3546 * @brief Processing function for the floating-point FIR interpolator.
Anna Bridge 160:5571c4ff569f 3547 * @param[in] S points to an instance of the floating-point FIR interpolator structure.
Anna Bridge 160:5571c4ff569f 3548 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3549 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3550 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3551 */
Anna Bridge 160:5571c4ff569f 3552 void arm_fir_interpolate_f32(
Anna Bridge 160:5571c4ff569f 3553 const arm_fir_interpolate_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3554 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 3555 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3556 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3557
Anna Bridge 160:5571c4ff569f 3558
Anna Bridge 160:5571c4ff569f 3559 /**
Anna Bridge 160:5571c4ff569f 3560 * @brief Initialization function for the floating-point FIR interpolator.
Anna Bridge 160:5571c4ff569f 3561 * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
Anna Bridge 160:5571c4ff569f 3562 * @param[in] L upsample factor.
Anna Bridge 160:5571c4ff569f 3563 * @param[in] numTaps number of filter coefficients in the filter.
Anna Bridge 160:5571c4ff569f 3564 * @param[in] pCoeffs points to the filter coefficient buffer.
Anna Bridge 160:5571c4ff569f 3565 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3566 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 3567 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
Anna Bridge 160:5571c4ff569f 3568 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
Anna Bridge 160:5571c4ff569f 3569 */
Anna Bridge 160:5571c4ff569f 3570 arm_status arm_fir_interpolate_init_f32(
Anna Bridge 160:5571c4ff569f 3571 arm_fir_interpolate_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3572 uint8_t L,
Anna Bridge 160:5571c4ff569f 3573 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 3574 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3575 float32_t * pState,
Anna Bridge 160:5571c4ff569f 3576 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3577
Anna Bridge 160:5571c4ff569f 3578
Anna Bridge 160:5571c4ff569f 3579 /**
Anna Bridge 160:5571c4ff569f 3580 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3581 */
Anna Bridge 160:5571c4ff569f 3582 typedef struct
Anna Bridge 160:5571c4ff569f 3583 {
Anna Bridge 160:5571c4ff569f 3584 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 3585 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
Anna Bridge 160:5571c4ff569f 3586 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 3587 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
Anna Bridge 160:5571c4ff569f 3588 } arm_biquad_cas_df1_32x64_ins_q31;
Anna Bridge 160:5571c4ff569f 3589
Anna Bridge 160:5571c4ff569f 3590
Anna Bridge 160:5571c4ff569f 3591 /**
Anna Bridge 160:5571c4ff569f 3592 * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
Anna Bridge 160:5571c4ff569f 3593 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3594 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3595 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3596 */
Anna Bridge 160:5571c4ff569f 3597 void arm_biquad_cas_df1_32x64_q31(
Anna Bridge 160:5571c4ff569f 3598 const arm_biquad_cas_df1_32x64_ins_q31 * S,
Anna Bridge 160:5571c4ff569f 3599 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 3600 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3601 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3602
Anna Bridge 160:5571c4ff569f 3603
Anna Bridge 160:5571c4ff569f 3604 /**
Anna Bridge 160:5571c4ff569f 3605 * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
Anna Bridge 160:5571c4ff569f 3606 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 3607 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3608 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3609 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
Anna Bridge 160:5571c4ff569f 3610 */
Anna Bridge 160:5571c4ff569f 3611 void arm_biquad_cas_df1_32x64_init_q31(
Anna Bridge 160:5571c4ff569f 3612 arm_biquad_cas_df1_32x64_ins_q31 * S,
Anna Bridge 160:5571c4ff569f 3613 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 3614 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3615 q63_t * pState,
Anna Bridge 160:5571c4ff569f 3616 uint8_t postShift);
Anna Bridge 160:5571c4ff569f 3617
Anna Bridge 160:5571c4ff569f 3618
Anna Bridge 160:5571c4ff569f 3619 /**
Anna Bridge 160:5571c4ff569f 3620 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3621 */
Anna Bridge 160:5571c4ff569f 3622 typedef struct
Anna Bridge 160:5571c4ff569f 3623 {
Anna Bridge 160:5571c4ff569f 3624 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 3625 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
Anna Bridge 160:5571c4ff569f 3626 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 3627 } arm_biquad_cascade_df2T_instance_f32;
Anna Bridge 160:5571c4ff569f 3628
Anna Bridge 160:5571c4ff569f 3629 /**
Anna Bridge 160:5571c4ff569f 3630 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3631 */
Anna Bridge 160:5571c4ff569f 3632 typedef struct
Anna Bridge 160:5571c4ff569f 3633 {
Anna Bridge 160:5571c4ff569f 3634 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 3635 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
Anna Bridge 160:5571c4ff569f 3636 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 3637 } arm_biquad_cascade_stereo_df2T_instance_f32;
Anna Bridge 160:5571c4ff569f 3638
Anna Bridge 160:5571c4ff569f 3639 /**
Anna Bridge 160:5571c4ff569f 3640 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3641 */
Anna Bridge 160:5571c4ff569f 3642 typedef struct
Anna Bridge 160:5571c4ff569f 3643 {
Anna Bridge 160:5571c4ff569f 3644 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
Anna Bridge 160:5571c4ff569f 3645 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
Anna Bridge 160:5571c4ff569f 3646 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
Anna Bridge 160:5571c4ff569f 3647 } arm_biquad_cascade_df2T_instance_f64;
Anna Bridge 160:5571c4ff569f 3648
Anna Bridge 160:5571c4ff569f 3649
Anna Bridge 160:5571c4ff569f 3650 /**
Anna Bridge 160:5571c4ff569f 3651 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3652 * @param[in] S points to an instance of the filter data structure.
Anna Bridge 160:5571c4ff569f 3653 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3654 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3655 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3656 */
Anna Bridge 160:5571c4ff569f 3657 void arm_biquad_cascade_df2T_f32(
Anna Bridge 160:5571c4ff569f 3658 const arm_biquad_cascade_df2T_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3659 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 3660 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3661 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3662
Anna Bridge 160:5571c4ff569f 3663
Anna Bridge 160:5571c4ff569f 3664 /**
Anna Bridge 160:5571c4ff569f 3665 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
Anna Bridge 160:5571c4ff569f 3666 * @param[in] S points to an instance of the filter data structure.
Anna Bridge 160:5571c4ff569f 3667 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3668 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3669 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3670 */
Anna Bridge 160:5571c4ff569f 3671 void arm_biquad_cascade_stereo_df2T_f32(
Anna Bridge 160:5571c4ff569f 3672 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3673 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 3674 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3675 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3676
Anna Bridge 160:5571c4ff569f 3677
Anna Bridge 160:5571c4ff569f 3678 /**
Anna Bridge 160:5571c4ff569f 3679 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3680 * @param[in] S points to an instance of the filter data structure.
Anna Bridge 160:5571c4ff569f 3681 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3682 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3683 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3684 */
Anna Bridge 160:5571c4ff569f 3685 void arm_biquad_cascade_df2T_f64(
Anna Bridge 160:5571c4ff569f 3686 const arm_biquad_cascade_df2T_instance_f64 * S,
Anna Bridge 160:5571c4ff569f 3687 float64_t * pSrc,
Anna Bridge 160:5571c4ff569f 3688 float64_t * pDst,
Anna Bridge 160:5571c4ff569f 3689 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3690
Anna Bridge 160:5571c4ff569f 3691
Anna Bridge 160:5571c4ff569f 3692 /**
Anna Bridge 160:5571c4ff569f 3693 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3694 * @param[in,out] S points to an instance of the filter data structure.
Anna Bridge 160:5571c4ff569f 3695 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 3696 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3697 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3698 */
Anna Bridge 160:5571c4ff569f 3699 void arm_biquad_cascade_df2T_init_f32(
Anna Bridge 160:5571c4ff569f 3700 arm_biquad_cascade_df2T_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3701 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 3702 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3703 float32_t * pState);
Anna Bridge 160:5571c4ff569f 3704
Anna Bridge 160:5571c4ff569f 3705
Anna Bridge 160:5571c4ff569f 3706 /**
Anna Bridge 160:5571c4ff569f 3707 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3708 * @param[in,out] S points to an instance of the filter data structure.
Anna Bridge 160:5571c4ff569f 3709 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 3710 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3711 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3712 */
Anna Bridge 160:5571c4ff569f 3713 void arm_biquad_cascade_stereo_df2T_init_f32(
Anna Bridge 160:5571c4ff569f 3714 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3715 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 3716 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3717 float32_t * pState);
Anna Bridge 160:5571c4ff569f 3718
Anna Bridge 160:5571c4ff569f 3719
Anna Bridge 160:5571c4ff569f 3720 /**
Anna Bridge 160:5571c4ff569f 3721 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
Anna Bridge 160:5571c4ff569f 3722 * @param[in,out] S points to an instance of the filter data structure.
Anna Bridge 160:5571c4ff569f 3723 * @param[in] numStages number of 2nd order stages in the filter.
Anna Bridge 160:5571c4ff569f 3724 * @param[in] pCoeffs points to the filter coefficients.
Anna Bridge 160:5571c4ff569f 3725 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 3726 */
Anna Bridge 160:5571c4ff569f 3727 void arm_biquad_cascade_df2T_init_f64(
Anna Bridge 160:5571c4ff569f 3728 arm_biquad_cascade_df2T_instance_f64 * S,
Anna Bridge 160:5571c4ff569f 3729 uint8_t numStages,
Anna Bridge 160:5571c4ff569f 3730 float64_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3731 float64_t * pState);
Anna Bridge 160:5571c4ff569f 3732
Anna Bridge 160:5571c4ff569f 3733
Anna Bridge 160:5571c4ff569f 3734 /**
Anna Bridge 160:5571c4ff569f 3735 * @brief Instance structure for the Q15 FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3736 */
Anna Bridge 160:5571c4ff569f 3737 typedef struct
Anna Bridge 160:5571c4ff569f 3738 {
Anna Bridge 160:5571c4ff569f 3739 uint16_t numStages; /**< number of filter stages. */
Anna Bridge 160:5571c4ff569f 3740 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3741 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3742 } arm_fir_lattice_instance_q15;
Anna Bridge 160:5571c4ff569f 3743
Anna Bridge 160:5571c4ff569f 3744 /**
Anna Bridge 160:5571c4ff569f 3745 * @brief Instance structure for the Q31 FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3746 */
Anna Bridge 160:5571c4ff569f 3747 typedef struct
Anna Bridge 160:5571c4ff569f 3748 {
Anna Bridge 160:5571c4ff569f 3749 uint16_t numStages; /**< number of filter stages. */
Anna Bridge 160:5571c4ff569f 3750 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3751 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3752 } arm_fir_lattice_instance_q31;
Anna Bridge 160:5571c4ff569f 3753
Anna Bridge 160:5571c4ff569f 3754 /**
Anna Bridge 160:5571c4ff569f 3755 * @brief Instance structure for the floating-point FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3756 */
Anna Bridge 160:5571c4ff569f 3757 typedef struct
Anna Bridge 160:5571c4ff569f 3758 {
Anna Bridge 160:5571c4ff569f 3759 uint16_t numStages; /**< number of filter stages. */
Anna Bridge 160:5571c4ff569f 3760 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3761 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3762 } arm_fir_lattice_instance_f32;
Anna Bridge 160:5571c4ff569f 3763
Anna Bridge 160:5571c4ff569f 3764
Anna Bridge 160:5571c4ff569f 3765 /**
Anna Bridge 160:5571c4ff569f 3766 * @brief Initialization function for the Q15 FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3767 * @param[in] S points to an instance of the Q15 FIR lattice structure.
Anna Bridge 160:5571c4ff569f 3768 * @param[in] numStages number of filter stages.
Anna Bridge 160:5571c4ff569f 3769 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3770 * @param[in] pState points to the state buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3771 */
Anna Bridge 160:5571c4ff569f 3772 void arm_fir_lattice_init_q15(
Anna Bridge 160:5571c4ff569f 3773 arm_fir_lattice_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3774 uint16_t numStages,
Anna Bridge 160:5571c4ff569f 3775 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3776 q15_t * pState);
Anna Bridge 160:5571c4ff569f 3777
Anna Bridge 160:5571c4ff569f 3778
Anna Bridge 160:5571c4ff569f 3779 /**
Anna Bridge 160:5571c4ff569f 3780 * @brief Processing function for the Q15 FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3781 * @param[in] S points to an instance of the Q15 FIR lattice structure.
Anna Bridge 160:5571c4ff569f 3782 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3783 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3784 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3785 */
Anna Bridge 160:5571c4ff569f 3786 void arm_fir_lattice_q15(
Anna Bridge 160:5571c4ff569f 3787 const arm_fir_lattice_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3788 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 3789 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3790 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3791
Anna Bridge 160:5571c4ff569f 3792
Anna Bridge 160:5571c4ff569f 3793 /**
Anna Bridge 160:5571c4ff569f 3794 * @brief Initialization function for the Q31 FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3795 * @param[in] S points to an instance of the Q31 FIR lattice structure.
Anna Bridge 160:5571c4ff569f 3796 * @param[in] numStages number of filter stages.
Anna Bridge 160:5571c4ff569f 3797 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3798 * @param[in] pState points to the state buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3799 */
Anna Bridge 160:5571c4ff569f 3800 void arm_fir_lattice_init_q31(
Anna Bridge 160:5571c4ff569f 3801 arm_fir_lattice_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3802 uint16_t numStages,
Anna Bridge 160:5571c4ff569f 3803 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3804 q31_t * pState);
Anna Bridge 160:5571c4ff569f 3805
Anna Bridge 160:5571c4ff569f 3806
Anna Bridge 160:5571c4ff569f 3807 /**
Anna Bridge 160:5571c4ff569f 3808 * @brief Processing function for the Q31 FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3809 * @param[in] S points to an instance of the Q31 FIR lattice structure.
Anna Bridge 160:5571c4ff569f 3810 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3811 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3812 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3813 */
Anna Bridge 160:5571c4ff569f 3814 void arm_fir_lattice_q31(
Anna Bridge 160:5571c4ff569f 3815 const arm_fir_lattice_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3816 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 3817 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3818 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3819
Anna Bridge 160:5571c4ff569f 3820
Anna Bridge 160:5571c4ff569f 3821 /**
Anna Bridge 160:5571c4ff569f 3822 * @brief Initialization function for the floating-point FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3823 * @param[in] S points to an instance of the floating-point FIR lattice structure.
Anna Bridge 160:5571c4ff569f 3824 * @param[in] numStages number of filter stages.
Anna Bridge 160:5571c4ff569f 3825 * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3826 * @param[in] pState points to the state buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3827 */
Anna Bridge 160:5571c4ff569f 3828 void arm_fir_lattice_init_f32(
Anna Bridge 160:5571c4ff569f 3829 arm_fir_lattice_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3830 uint16_t numStages,
Anna Bridge 160:5571c4ff569f 3831 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 3832 float32_t * pState);
Anna Bridge 160:5571c4ff569f 3833
Anna Bridge 160:5571c4ff569f 3834
Anna Bridge 160:5571c4ff569f 3835 /**
Anna Bridge 160:5571c4ff569f 3836 * @brief Processing function for the floating-point FIR lattice filter.
Anna Bridge 160:5571c4ff569f 3837 * @param[in] S points to an instance of the floating-point FIR lattice structure.
Anna Bridge 160:5571c4ff569f 3838 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3839 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 3840 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3841 */
Anna Bridge 160:5571c4ff569f 3842 void arm_fir_lattice_f32(
Anna Bridge 160:5571c4ff569f 3843 const arm_fir_lattice_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3844 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 3845 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3846 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3847
Anna Bridge 160:5571c4ff569f 3848
Anna Bridge 160:5571c4ff569f 3849 /**
Anna Bridge 160:5571c4ff569f 3850 * @brief Instance structure for the Q15 IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3851 */
Anna Bridge 160:5571c4ff569f 3852 typedef struct
Anna Bridge 160:5571c4ff569f 3853 {
Anna Bridge 160:5571c4ff569f 3854 uint16_t numStages; /**< number of stages in the filter. */
Anna Bridge 160:5571c4ff569f 3855 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
Anna Bridge 160:5571c4ff569f 3856 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3857 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
Anna Bridge 160:5571c4ff569f 3858 } arm_iir_lattice_instance_q15;
Anna Bridge 160:5571c4ff569f 3859
Anna Bridge 160:5571c4ff569f 3860 /**
Anna Bridge 160:5571c4ff569f 3861 * @brief Instance structure for the Q31 IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3862 */
Anna Bridge 160:5571c4ff569f 3863 typedef struct
Anna Bridge 160:5571c4ff569f 3864 {
Anna Bridge 160:5571c4ff569f 3865 uint16_t numStages; /**< number of stages in the filter. */
Anna Bridge 160:5571c4ff569f 3866 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
Anna Bridge 160:5571c4ff569f 3867 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3868 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
Anna Bridge 160:5571c4ff569f 3869 } arm_iir_lattice_instance_q31;
Anna Bridge 160:5571c4ff569f 3870
Anna Bridge 160:5571c4ff569f 3871 /**
Anna Bridge 160:5571c4ff569f 3872 * @brief Instance structure for the floating-point IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3873 */
Anna Bridge 160:5571c4ff569f 3874 typedef struct
Anna Bridge 160:5571c4ff569f 3875 {
Anna Bridge 160:5571c4ff569f 3876 uint16_t numStages; /**< number of stages in the filter. */
Anna Bridge 160:5571c4ff569f 3877 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
Anna Bridge 160:5571c4ff569f 3878 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
Anna Bridge 160:5571c4ff569f 3879 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
Anna Bridge 160:5571c4ff569f 3880 } arm_iir_lattice_instance_f32;
Anna Bridge 160:5571c4ff569f 3881
Anna Bridge 160:5571c4ff569f 3882
Anna Bridge 160:5571c4ff569f 3883 /**
Anna Bridge 160:5571c4ff569f 3884 * @brief Processing function for the floating-point IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3885 * @param[in] S points to an instance of the floating-point IIR lattice structure.
Anna Bridge 160:5571c4ff569f 3886 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3887 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3888 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3889 */
Anna Bridge 160:5571c4ff569f 3890 void arm_iir_lattice_f32(
Anna Bridge 160:5571c4ff569f 3891 const arm_iir_lattice_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3892 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 3893 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 3894 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3895
Anna Bridge 160:5571c4ff569f 3896
Anna Bridge 160:5571c4ff569f 3897 /**
Anna Bridge 160:5571c4ff569f 3898 * @brief Initialization function for the floating-point IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3899 * @param[in] S points to an instance of the floating-point IIR lattice structure.
Anna Bridge 160:5571c4ff569f 3900 * @param[in] numStages number of stages in the filter.
Anna Bridge 160:5571c4ff569f 3901 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3902 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
Anna Bridge 160:5571c4ff569f 3903 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
Anna Bridge 160:5571c4ff569f 3904 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3905 */
Anna Bridge 160:5571c4ff569f 3906 void arm_iir_lattice_init_f32(
Anna Bridge 160:5571c4ff569f 3907 arm_iir_lattice_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 3908 uint16_t numStages,
Anna Bridge 160:5571c4ff569f 3909 float32_t * pkCoeffs,
Anna Bridge 160:5571c4ff569f 3910 float32_t * pvCoeffs,
Anna Bridge 160:5571c4ff569f 3911 float32_t * pState,
Anna Bridge 160:5571c4ff569f 3912 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3913
Anna Bridge 160:5571c4ff569f 3914
Anna Bridge 160:5571c4ff569f 3915 /**
Anna Bridge 160:5571c4ff569f 3916 * @brief Processing function for the Q31 IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3917 * @param[in] S points to an instance of the Q31 IIR lattice structure.
Anna Bridge 160:5571c4ff569f 3918 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3919 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3920 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3921 */
Anna Bridge 160:5571c4ff569f 3922 void arm_iir_lattice_q31(
Anna Bridge 160:5571c4ff569f 3923 const arm_iir_lattice_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3924 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 3925 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 3926 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3927
Anna Bridge 160:5571c4ff569f 3928
Anna Bridge 160:5571c4ff569f 3929 /**
Anna Bridge 160:5571c4ff569f 3930 * @brief Initialization function for the Q31 IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3931 * @param[in] S points to an instance of the Q31 IIR lattice structure.
Anna Bridge 160:5571c4ff569f 3932 * @param[in] numStages number of stages in the filter.
Anna Bridge 160:5571c4ff569f 3933 * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3934 * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
Anna Bridge 160:5571c4ff569f 3935 * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
Anna Bridge 160:5571c4ff569f 3936 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3937 */
Anna Bridge 160:5571c4ff569f 3938 void arm_iir_lattice_init_q31(
Anna Bridge 160:5571c4ff569f 3939 arm_iir_lattice_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 3940 uint16_t numStages,
Anna Bridge 160:5571c4ff569f 3941 q31_t * pkCoeffs,
Anna Bridge 160:5571c4ff569f 3942 q31_t * pvCoeffs,
Anna Bridge 160:5571c4ff569f 3943 q31_t * pState,
Anna Bridge 160:5571c4ff569f 3944 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3945
Anna Bridge 160:5571c4ff569f 3946
Anna Bridge 160:5571c4ff569f 3947 /**
Anna Bridge 160:5571c4ff569f 3948 * @brief Processing function for the Q15 IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3949 * @param[in] S points to an instance of the Q15 IIR lattice structure.
Anna Bridge 160:5571c4ff569f 3950 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3951 * @param[out] pDst points to the block of output data.
Anna Bridge 160:5571c4ff569f 3952 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3953 */
Anna Bridge 160:5571c4ff569f 3954 void arm_iir_lattice_q15(
Anna Bridge 160:5571c4ff569f 3955 const arm_iir_lattice_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3956 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 3957 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 3958 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3959
Anna Bridge 160:5571c4ff569f 3960
Anna Bridge 160:5571c4ff569f 3961 /**
Anna Bridge 160:5571c4ff569f 3962 * @brief Initialization function for the Q15 IIR lattice filter.
Anna Bridge 160:5571c4ff569f 3963 * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
Anna Bridge 160:5571c4ff569f 3964 * @param[in] numStages number of stages in the filter.
Anna Bridge 160:5571c4ff569f 3965 * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
Anna Bridge 160:5571c4ff569f 3966 * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
Anna Bridge 160:5571c4ff569f 3967 * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
Anna Bridge 160:5571c4ff569f 3968 * @param[in] blockSize number of samples to process per call.
Anna Bridge 160:5571c4ff569f 3969 */
Anna Bridge 160:5571c4ff569f 3970 void arm_iir_lattice_init_q15(
Anna Bridge 160:5571c4ff569f 3971 arm_iir_lattice_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 3972 uint16_t numStages,
Anna Bridge 160:5571c4ff569f 3973 q15_t * pkCoeffs,
Anna Bridge 160:5571c4ff569f 3974 q15_t * pvCoeffs,
Anna Bridge 160:5571c4ff569f 3975 q15_t * pState,
Anna Bridge 160:5571c4ff569f 3976 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 3977
Anna Bridge 160:5571c4ff569f 3978
Anna Bridge 160:5571c4ff569f 3979 /**
Anna Bridge 160:5571c4ff569f 3980 * @brief Instance structure for the floating-point LMS filter.
Anna Bridge 160:5571c4ff569f 3981 */
Anna Bridge 160:5571c4ff569f 3982 typedef struct
Anna Bridge 160:5571c4ff569f 3983 {
Anna Bridge 160:5571c4ff569f 3984 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 3985 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 3986 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 3987 float32_t mu; /**< step size that controls filter coefficient updates. */
Anna Bridge 160:5571c4ff569f 3988 } arm_lms_instance_f32;
Anna Bridge 160:5571c4ff569f 3989
Anna Bridge 160:5571c4ff569f 3990
Anna Bridge 160:5571c4ff569f 3991 /**
Anna Bridge 160:5571c4ff569f 3992 * @brief Processing function for floating-point LMS filter.
Anna Bridge 160:5571c4ff569f 3993 * @param[in] S points to an instance of the floating-point LMS filter structure.
Anna Bridge 160:5571c4ff569f 3994 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 3995 * @param[in] pRef points to the block of reference data.
Anna Bridge 160:5571c4ff569f 3996 * @param[out] pOut points to the block of output data.
Anna Bridge 160:5571c4ff569f 3997 * @param[out] pErr points to the block of error data.
Anna Bridge 160:5571c4ff569f 3998 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 3999 */
Anna Bridge 160:5571c4ff569f 4000 void arm_lms_f32(
Anna Bridge 160:5571c4ff569f 4001 const arm_lms_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4002 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 4003 float32_t * pRef,
Anna Bridge 160:5571c4ff569f 4004 float32_t * pOut,
Anna Bridge 160:5571c4ff569f 4005 float32_t * pErr,
Anna Bridge 160:5571c4ff569f 4006 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4007
Anna Bridge 160:5571c4ff569f 4008
Anna Bridge 160:5571c4ff569f 4009 /**
Anna Bridge 160:5571c4ff569f 4010 * @brief Initialization function for floating-point LMS filter.
Anna Bridge 160:5571c4ff569f 4011 * @param[in] S points to an instance of the floating-point LMS filter structure.
Anna Bridge 160:5571c4ff569f 4012 * @param[in] numTaps number of filter coefficients.
Anna Bridge 160:5571c4ff569f 4013 * @param[in] pCoeffs points to the coefficient buffer.
Anna Bridge 160:5571c4ff569f 4014 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 4015 * @param[in] mu step size that controls filter coefficient updates.
Anna Bridge 160:5571c4ff569f 4016 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4017 */
Anna Bridge 160:5571c4ff569f 4018 void arm_lms_init_f32(
Anna Bridge 160:5571c4ff569f 4019 arm_lms_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4020 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4021 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4022 float32_t * pState,
Anna Bridge 160:5571c4ff569f 4023 float32_t mu,
Anna Bridge 160:5571c4ff569f 4024 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4025
Anna Bridge 160:5571c4ff569f 4026
Anna Bridge 160:5571c4ff569f 4027 /**
Anna Bridge 160:5571c4ff569f 4028 * @brief Instance structure for the Q15 LMS filter.
Anna Bridge 160:5571c4ff569f 4029 */
Anna Bridge 160:5571c4ff569f 4030 typedef struct
Anna Bridge 160:5571c4ff569f 4031 {
Anna Bridge 160:5571c4ff569f 4032 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4033 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4034 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4035 q15_t mu; /**< step size that controls filter coefficient updates. */
Anna Bridge 160:5571c4ff569f 4036 uint32_t postShift; /**< bit shift applied to coefficients. */
Anna Bridge 160:5571c4ff569f 4037 } arm_lms_instance_q15;
Anna Bridge 160:5571c4ff569f 4038
Anna Bridge 160:5571c4ff569f 4039
Anna Bridge 160:5571c4ff569f 4040 /**
Anna Bridge 160:5571c4ff569f 4041 * @brief Initialization function for the Q15 LMS filter.
Anna Bridge 160:5571c4ff569f 4042 * @param[in] S points to an instance of the Q15 LMS filter structure.
Anna Bridge 160:5571c4ff569f 4043 * @param[in] numTaps number of filter coefficients.
Anna Bridge 160:5571c4ff569f 4044 * @param[in] pCoeffs points to the coefficient buffer.
Anna Bridge 160:5571c4ff569f 4045 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 4046 * @param[in] mu step size that controls filter coefficient updates.
Anna Bridge 160:5571c4ff569f 4047 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4048 * @param[in] postShift bit shift applied to coefficients.
Anna Bridge 160:5571c4ff569f 4049 */
Anna Bridge 160:5571c4ff569f 4050 void arm_lms_init_q15(
Anna Bridge 160:5571c4ff569f 4051 arm_lms_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4052 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4053 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4054 q15_t * pState,
Anna Bridge 160:5571c4ff569f 4055 q15_t mu,
Anna Bridge 160:5571c4ff569f 4056 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 4057 uint32_t postShift);
Anna Bridge 160:5571c4ff569f 4058
Anna Bridge 160:5571c4ff569f 4059
Anna Bridge 160:5571c4ff569f 4060 /**
Anna Bridge 160:5571c4ff569f 4061 * @brief Processing function for Q15 LMS filter.
Anna Bridge 160:5571c4ff569f 4062 * @param[in] S points to an instance of the Q15 LMS filter structure.
Anna Bridge 160:5571c4ff569f 4063 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4064 * @param[in] pRef points to the block of reference data.
Anna Bridge 160:5571c4ff569f 4065 * @param[out] pOut points to the block of output data.
Anna Bridge 160:5571c4ff569f 4066 * @param[out] pErr points to the block of error data.
Anna Bridge 160:5571c4ff569f 4067 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4068 */
Anna Bridge 160:5571c4ff569f 4069 void arm_lms_q15(
Anna Bridge 160:5571c4ff569f 4070 const arm_lms_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4071 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 4072 q15_t * pRef,
Anna Bridge 160:5571c4ff569f 4073 q15_t * pOut,
Anna Bridge 160:5571c4ff569f 4074 q15_t * pErr,
Anna Bridge 160:5571c4ff569f 4075 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4076
Anna Bridge 160:5571c4ff569f 4077
Anna Bridge 160:5571c4ff569f 4078 /**
Anna Bridge 160:5571c4ff569f 4079 * @brief Instance structure for the Q31 LMS filter.
Anna Bridge 160:5571c4ff569f 4080 */
Anna Bridge 160:5571c4ff569f 4081 typedef struct
Anna Bridge 160:5571c4ff569f 4082 {
Anna Bridge 160:5571c4ff569f 4083 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4084 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4085 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4086 q31_t mu; /**< step size that controls filter coefficient updates. */
Anna Bridge 160:5571c4ff569f 4087 uint32_t postShift; /**< bit shift applied to coefficients. */
Anna Bridge 160:5571c4ff569f 4088 } arm_lms_instance_q31;
Anna Bridge 160:5571c4ff569f 4089
Anna Bridge 160:5571c4ff569f 4090
Anna Bridge 160:5571c4ff569f 4091 /**
Anna Bridge 160:5571c4ff569f 4092 * @brief Processing function for Q31 LMS filter.
Anna Bridge 160:5571c4ff569f 4093 * @param[in] S points to an instance of the Q15 LMS filter structure.
Anna Bridge 160:5571c4ff569f 4094 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4095 * @param[in] pRef points to the block of reference data.
Anna Bridge 160:5571c4ff569f 4096 * @param[out] pOut points to the block of output data.
Anna Bridge 160:5571c4ff569f 4097 * @param[out] pErr points to the block of error data.
Anna Bridge 160:5571c4ff569f 4098 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4099 */
Anna Bridge 160:5571c4ff569f 4100 void arm_lms_q31(
Anna Bridge 160:5571c4ff569f 4101 const arm_lms_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4102 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 4103 q31_t * pRef,
Anna Bridge 160:5571c4ff569f 4104 q31_t * pOut,
Anna Bridge 160:5571c4ff569f 4105 q31_t * pErr,
Anna Bridge 160:5571c4ff569f 4106 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4107
Anna Bridge 160:5571c4ff569f 4108
Anna Bridge 160:5571c4ff569f 4109 /**
Anna Bridge 160:5571c4ff569f 4110 * @brief Initialization function for Q31 LMS filter.
Anna Bridge 160:5571c4ff569f 4111 * @param[in] S points to an instance of the Q31 LMS filter structure.
Anna Bridge 160:5571c4ff569f 4112 * @param[in] numTaps number of filter coefficients.
Anna Bridge 160:5571c4ff569f 4113 * @param[in] pCoeffs points to coefficient buffer.
Anna Bridge 160:5571c4ff569f 4114 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 4115 * @param[in] mu step size that controls filter coefficient updates.
Anna Bridge 160:5571c4ff569f 4116 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4117 * @param[in] postShift bit shift applied to coefficients.
Anna Bridge 160:5571c4ff569f 4118 */
Anna Bridge 160:5571c4ff569f 4119 void arm_lms_init_q31(
Anna Bridge 160:5571c4ff569f 4120 arm_lms_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4121 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4122 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4123 q31_t * pState,
Anna Bridge 160:5571c4ff569f 4124 q31_t mu,
Anna Bridge 160:5571c4ff569f 4125 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 4126 uint32_t postShift);
Anna Bridge 160:5571c4ff569f 4127
Anna Bridge 160:5571c4ff569f 4128
Anna Bridge 160:5571c4ff569f 4129 /**
Anna Bridge 160:5571c4ff569f 4130 * @brief Instance structure for the floating-point normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4131 */
Anna Bridge 160:5571c4ff569f 4132 typedef struct
Anna Bridge 160:5571c4ff569f 4133 {
Anna Bridge 160:5571c4ff569f 4134 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4135 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4136 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4137 float32_t mu; /**< step size that control filter coefficient updates. */
Anna Bridge 160:5571c4ff569f 4138 float32_t energy; /**< saves previous frame energy. */
Anna Bridge 160:5571c4ff569f 4139 float32_t x0; /**< saves previous input sample. */
Anna Bridge 160:5571c4ff569f 4140 } arm_lms_norm_instance_f32;
Anna Bridge 160:5571c4ff569f 4141
Anna Bridge 160:5571c4ff569f 4142
Anna Bridge 160:5571c4ff569f 4143 /**
Anna Bridge 160:5571c4ff569f 4144 * @brief Processing function for floating-point normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4145 * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
Anna Bridge 160:5571c4ff569f 4146 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4147 * @param[in] pRef points to the block of reference data.
Anna Bridge 160:5571c4ff569f 4148 * @param[out] pOut points to the block of output data.
Anna Bridge 160:5571c4ff569f 4149 * @param[out] pErr points to the block of error data.
Anna Bridge 160:5571c4ff569f 4150 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4151 */
Anna Bridge 160:5571c4ff569f 4152 void arm_lms_norm_f32(
Anna Bridge 160:5571c4ff569f 4153 arm_lms_norm_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4154 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 4155 float32_t * pRef,
Anna Bridge 160:5571c4ff569f 4156 float32_t * pOut,
Anna Bridge 160:5571c4ff569f 4157 float32_t * pErr,
Anna Bridge 160:5571c4ff569f 4158 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4159
Anna Bridge 160:5571c4ff569f 4160
Anna Bridge 160:5571c4ff569f 4161 /**
Anna Bridge 160:5571c4ff569f 4162 * @brief Initialization function for floating-point normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4163 * @param[in] S points to an instance of the floating-point LMS filter structure.
Anna Bridge 160:5571c4ff569f 4164 * @param[in] numTaps number of filter coefficients.
Anna Bridge 160:5571c4ff569f 4165 * @param[in] pCoeffs points to coefficient buffer.
Anna Bridge 160:5571c4ff569f 4166 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 4167 * @param[in] mu step size that controls filter coefficient updates.
Anna Bridge 160:5571c4ff569f 4168 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4169 */
Anna Bridge 160:5571c4ff569f 4170 void arm_lms_norm_init_f32(
Anna Bridge 160:5571c4ff569f 4171 arm_lms_norm_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4172 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4173 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4174 float32_t * pState,
Anna Bridge 160:5571c4ff569f 4175 float32_t mu,
Anna Bridge 160:5571c4ff569f 4176 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4177
Anna Bridge 160:5571c4ff569f 4178
Anna Bridge 160:5571c4ff569f 4179 /**
Anna Bridge 160:5571c4ff569f 4180 * @brief Instance structure for the Q31 normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4181 */
Anna Bridge 160:5571c4ff569f 4182 typedef struct
Anna Bridge 160:5571c4ff569f 4183 {
Anna Bridge 160:5571c4ff569f 4184 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4185 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4186 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4187 q31_t mu; /**< step size that controls filter coefficient updates. */
Anna Bridge 160:5571c4ff569f 4188 uint8_t postShift; /**< bit shift applied to coefficients. */
Anna Bridge 160:5571c4ff569f 4189 q31_t *recipTable; /**< points to the reciprocal initial value table. */
Anna Bridge 160:5571c4ff569f 4190 q31_t energy; /**< saves previous frame energy. */
Anna Bridge 160:5571c4ff569f 4191 q31_t x0; /**< saves previous input sample. */
Anna Bridge 160:5571c4ff569f 4192 } arm_lms_norm_instance_q31;
Anna Bridge 160:5571c4ff569f 4193
Anna Bridge 160:5571c4ff569f 4194
Anna Bridge 160:5571c4ff569f 4195 /**
Anna Bridge 160:5571c4ff569f 4196 * @brief Processing function for Q31 normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4197 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
Anna Bridge 160:5571c4ff569f 4198 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4199 * @param[in] pRef points to the block of reference data.
Anna Bridge 160:5571c4ff569f 4200 * @param[out] pOut points to the block of output data.
Anna Bridge 160:5571c4ff569f 4201 * @param[out] pErr points to the block of error data.
Anna Bridge 160:5571c4ff569f 4202 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4203 */
Anna Bridge 160:5571c4ff569f 4204 void arm_lms_norm_q31(
Anna Bridge 160:5571c4ff569f 4205 arm_lms_norm_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4206 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 4207 q31_t * pRef,
Anna Bridge 160:5571c4ff569f 4208 q31_t * pOut,
Anna Bridge 160:5571c4ff569f 4209 q31_t * pErr,
Anna Bridge 160:5571c4ff569f 4210 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4211
Anna Bridge 160:5571c4ff569f 4212
Anna Bridge 160:5571c4ff569f 4213 /**
Anna Bridge 160:5571c4ff569f 4214 * @brief Initialization function for Q31 normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4215 * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
Anna Bridge 160:5571c4ff569f 4216 * @param[in] numTaps number of filter coefficients.
Anna Bridge 160:5571c4ff569f 4217 * @param[in] pCoeffs points to coefficient buffer.
Anna Bridge 160:5571c4ff569f 4218 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 4219 * @param[in] mu step size that controls filter coefficient updates.
Anna Bridge 160:5571c4ff569f 4220 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4221 * @param[in] postShift bit shift applied to coefficients.
Anna Bridge 160:5571c4ff569f 4222 */
Anna Bridge 160:5571c4ff569f 4223 void arm_lms_norm_init_q31(
Anna Bridge 160:5571c4ff569f 4224 arm_lms_norm_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4225 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4226 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4227 q31_t * pState,
Anna Bridge 160:5571c4ff569f 4228 q31_t mu,
Anna Bridge 160:5571c4ff569f 4229 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 4230 uint8_t postShift);
Anna Bridge 160:5571c4ff569f 4231
Anna Bridge 160:5571c4ff569f 4232
Anna Bridge 160:5571c4ff569f 4233 /**
Anna Bridge 160:5571c4ff569f 4234 * @brief Instance structure for the Q15 normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4235 */
Anna Bridge 160:5571c4ff569f 4236 typedef struct
Anna Bridge 160:5571c4ff569f 4237 {
Anna Bridge 160:5571c4ff569f 4238 uint16_t numTaps; /**< Number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4239 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4240 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4241 q15_t mu; /**< step size that controls filter coefficient updates. */
Anna Bridge 160:5571c4ff569f 4242 uint8_t postShift; /**< bit shift applied to coefficients. */
Anna Bridge 160:5571c4ff569f 4243 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
Anna Bridge 160:5571c4ff569f 4244 q15_t energy; /**< saves previous frame energy. */
Anna Bridge 160:5571c4ff569f 4245 q15_t x0; /**< saves previous input sample. */
Anna Bridge 160:5571c4ff569f 4246 } arm_lms_norm_instance_q15;
Anna Bridge 160:5571c4ff569f 4247
Anna Bridge 160:5571c4ff569f 4248
Anna Bridge 160:5571c4ff569f 4249 /**
Anna Bridge 160:5571c4ff569f 4250 * @brief Processing function for Q15 normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4251 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
Anna Bridge 160:5571c4ff569f 4252 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4253 * @param[in] pRef points to the block of reference data.
Anna Bridge 160:5571c4ff569f 4254 * @param[out] pOut points to the block of output data.
Anna Bridge 160:5571c4ff569f 4255 * @param[out] pErr points to the block of error data.
Anna Bridge 160:5571c4ff569f 4256 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4257 */
Anna Bridge 160:5571c4ff569f 4258 void arm_lms_norm_q15(
Anna Bridge 160:5571c4ff569f 4259 arm_lms_norm_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4260 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 4261 q15_t * pRef,
Anna Bridge 160:5571c4ff569f 4262 q15_t * pOut,
Anna Bridge 160:5571c4ff569f 4263 q15_t * pErr,
Anna Bridge 160:5571c4ff569f 4264 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4265
Anna Bridge 160:5571c4ff569f 4266
Anna Bridge 160:5571c4ff569f 4267 /**
Anna Bridge 160:5571c4ff569f 4268 * @brief Initialization function for Q15 normalized LMS filter.
Anna Bridge 160:5571c4ff569f 4269 * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
Anna Bridge 160:5571c4ff569f 4270 * @param[in] numTaps number of filter coefficients.
Anna Bridge 160:5571c4ff569f 4271 * @param[in] pCoeffs points to coefficient buffer.
Anna Bridge 160:5571c4ff569f 4272 * @param[in] pState points to state buffer.
Anna Bridge 160:5571c4ff569f 4273 * @param[in] mu step size that controls filter coefficient updates.
Anna Bridge 160:5571c4ff569f 4274 * @param[in] blockSize number of samples to process.
Anna Bridge 160:5571c4ff569f 4275 * @param[in] postShift bit shift applied to coefficients.
Anna Bridge 160:5571c4ff569f 4276 */
Anna Bridge 160:5571c4ff569f 4277 void arm_lms_norm_init_q15(
Anna Bridge 160:5571c4ff569f 4278 arm_lms_norm_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4279 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4280 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4281 q15_t * pState,
Anna Bridge 160:5571c4ff569f 4282 q15_t mu,
Anna Bridge 160:5571c4ff569f 4283 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 4284 uint8_t postShift);
Anna Bridge 160:5571c4ff569f 4285
Anna Bridge 160:5571c4ff569f 4286
Anna Bridge 160:5571c4ff569f 4287 /**
Anna Bridge 160:5571c4ff569f 4288 * @brief Correlation of floating-point sequences.
Anna Bridge 160:5571c4ff569f 4289 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4290 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4291 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4292 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4293 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4294 */
Anna Bridge 160:5571c4ff569f 4295 void arm_correlate_f32(
Anna Bridge 160:5571c4ff569f 4296 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4297 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4298 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4299 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4300 float32_t * pDst);
Anna Bridge 160:5571c4ff569f 4301
Anna Bridge 160:5571c4ff569f 4302
Anna Bridge 160:5571c4ff569f 4303 /**
Anna Bridge 160:5571c4ff569f 4304 * @brief Correlation of Q15 sequences
Anna Bridge 160:5571c4ff569f 4305 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4306 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4307 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4308 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4309 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4310 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 4311 */
Anna Bridge 160:5571c4ff569f 4312 void arm_correlate_opt_q15(
Anna Bridge 160:5571c4ff569f 4313 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4314 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4315 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4316 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4317 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 4318 q15_t * pScratch);
Anna Bridge 160:5571c4ff569f 4319
Anna Bridge 160:5571c4ff569f 4320
Anna Bridge 160:5571c4ff569f 4321 /**
Anna Bridge 160:5571c4ff569f 4322 * @brief Correlation of Q15 sequences.
Anna Bridge 160:5571c4ff569f 4323 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4324 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4325 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4326 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4327 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4328 */
Anna Bridge 160:5571c4ff569f 4329
Anna Bridge 160:5571c4ff569f 4330 void arm_correlate_q15(
Anna Bridge 160:5571c4ff569f 4331 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4332 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4333 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4334 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4335 q15_t * pDst);
Anna Bridge 160:5571c4ff569f 4336
Anna Bridge 160:5571c4ff569f 4337
Anna Bridge 160:5571c4ff569f 4338 /**
Anna Bridge 160:5571c4ff569f 4339 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 4340 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4341 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4342 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4343 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4344 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4345 */
Anna Bridge 160:5571c4ff569f 4346
Anna Bridge 160:5571c4ff569f 4347 void arm_correlate_fast_q15(
Anna Bridge 160:5571c4ff569f 4348 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4349 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4350 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4351 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4352 q15_t * pDst);
Anna Bridge 160:5571c4ff569f 4353
Anna Bridge 160:5571c4ff569f 4354
Anna Bridge 160:5571c4ff569f 4355 /**
Anna Bridge 160:5571c4ff569f 4356 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
Anna Bridge 160:5571c4ff569f 4357 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4358 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4359 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4360 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4361 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4362 * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 4363 */
Anna Bridge 160:5571c4ff569f 4364 void arm_correlate_fast_opt_q15(
Anna Bridge 160:5571c4ff569f 4365 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4366 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4367 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4368 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4369 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 4370 q15_t * pScratch);
Anna Bridge 160:5571c4ff569f 4371
Anna Bridge 160:5571c4ff569f 4372
Anna Bridge 160:5571c4ff569f 4373 /**
Anna Bridge 160:5571c4ff569f 4374 * @brief Correlation of Q31 sequences.
Anna Bridge 160:5571c4ff569f 4375 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4376 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4377 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4378 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4379 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4380 */
Anna Bridge 160:5571c4ff569f 4381 void arm_correlate_q31(
Anna Bridge 160:5571c4ff569f 4382 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4383 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4384 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4385 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4386 q31_t * pDst);
Anna Bridge 160:5571c4ff569f 4387
Anna Bridge 160:5571c4ff569f 4388
Anna Bridge 160:5571c4ff569f 4389 /**
Anna Bridge 160:5571c4ff569f 4390 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
Anna Bridge 160:5571c4ff569f 4391 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4392 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4393 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4394 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4395 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4396 */
Anna Bridge 160:5571c4ff569f 4397 void arm_correlate_fast_q31(
Anna Bridge 160:5571c4ff569f 4398 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4399 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4400 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4401 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4402 q31_t * pDst);
Anna Bridge 160:5571c4ff569f 4403
Anna Bridge 160:5571c4ff569f 4404
Anna Bridge 160:5571c4ff569f 4405 /**
Anna Bridge 160:5571c4ff569f 4406 * @brief Correlation of Q7 sequences.
Anna Bridge 160:5571c4ff569f 4407 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4408 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4409 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4410 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4411 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4412 * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
Anna Bridge 160:5571c4ff569f 4413 * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
Anna Bridge 160:5571c4ff569f 4414 */
Anna Bridge 160:5571c4ff569f 4415 void arm_correlate_opt_q7(
Anna Bridge 160:5571c4ff569f 4416 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4417 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4418 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4419 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4420 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 4421 q15_t * pScratch1,
Anna Bridge 160:5571c4ff569f 4422 q15_t * pScratch2);
Anna Bridge 160:5571c4ff569f 4423
Anna Bridge 160:5571c4ff569f 4424
Anna Bridge 160:5571c4ff569f 4425 /**
Anna Bridge 160:5571c4ff569f 4426 * @brief Correlation of Q7 sequences.
Anna Bridge 160:5571c4ff569f 4427 * @param[in] pSrcA points to the first input sequence.
Anna Bridge 160:5571c4ff569f 4428 * @param[in] srcALen length of the first input sequence.
Anna Bridge 160:5571c4ff569f 4429 * @param[in] pSrcB points to the second input sequence.
Anna Bridge 160:5571c4ff569f 4430 * @param[in] srcBLen length of the second input sequence.
Anna Bridge 160:5571c4ff569f 4431 * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
Anna Bridge 160:5571c4ff569f 4432 */
Anna Bridge 160:5571c4ff569f 4433 void arm_correlate_q7(
Anna Bridge 160:5571c4ff569f 4434 q7_t * pSrcA,
Anna Bridge 160:5571c4ff569f 4435 uint32_t srcALen,
Anna Bridge 160:5571c4ff569f 4436 q7_t * pSrcB,
Anna Bridge 160:5571c4ff569f 4437 uint32_t srcBLen,
Anna Bridge 160:5571c4ff569f 4438 q7_t * pDst);
Anna Bridge 160:5571c4ff569f 4439
Anna Bridge 160:5571c4ff569f 4440
Anna Bridge 160:5571c4ff569f 4441 /**
Anna Bridge 160:5571c4ff569f 4442 * @brief Instance structure for the floating-point sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4443 */
Anna Bridge 160:5571c4ff569f 4444 typedef struct
Anna Bridge 160:5571c4ff569f 4445 {
Anna Bridge 160:5571c4ff569f 4446 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4447 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
Anna Bridge 160:5571c4ff569f 4448 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4449 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 4450 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
Anna Bridge 160:5571c4ff569f 4451 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4452 } arm_fir_sparse_instance_f32;
Anna Bridge 160:5571c4ff569f 4453
Anna Bridge 160:5571c4ff569f 4454 /**
Anna Bridge 160:5571c4ff569f 4455 * @brief Instance structure for the Q31 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4456 */
Anna Bridge 160:5571c4ff569f 4457 typedef struct
Anna Bridge 160:5571c4ff569f 4458 {
Anna Bridge 160:5571c4ff569f 4459 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4460 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
Anna Bridge 160:5571c4ff569f 4461 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4462 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 4463 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
Anna Bridge 160:5571c4ff569f 4464 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4465 } arm_fir_sparse_instance_q31;
Anna Bridge 160:5571c4ff569f 4466
Anna Bridge 160:5571c4ff569f 4467 /**
Anna Bridge 160:5571c4ff569f 4468 * @brief Instance structure for the Q15 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4469 */
Anna Bridge 160:5571c4ff569f 4470 typedef struct
Anna Bridge 160:5571c4ff569f 4471 {
Anna Bridge 160:5571c4ff569f 4472 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4473 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
Anna Bridge 160:5571c4ff569f 4474 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4475 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 4476 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
Anna Bridge 160:5571c4ff569f 4477 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4478 } arm_fir_sparse_instance_q15;
Anna Bridge 160:5571c4ff569f 4479
Anna Bridge 160:5571c4ff569f 4480 /**
Anna Bridge 160:5571c4ff569f 4481 * @brief Instance structure for the Q7 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4482 */
Anna Bridge 160:5571c4ff569f 4483 typedef struct
Anna Bridge 160:5571c4ff569f 4484 {
Anna Bridge 160:5571c4ff569f 4485 uint16_t numTaps; /**< number of coefficients in the filter. */
Anna Bridge 160:5571c4ff569f 4486 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
Anna Bridge 160:5571c4ff569f 4487 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
Anna Bridge 160:5571c4ff569f 4488 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
Anna Bridge 160:5571c4ff569f 4489 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
Anna Bridge 160:5571c4ff569f 4490 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
Anna Bridge 160:5571c4ff569f 4491 } arm_fir_sparse_instance_q7;
Anna Bridge 160:5571c4ff569f 4492
Anna Bridge 160:5571c4ff569f 4493
Anna Bridge 160:5571c4ff569f 4494 /**
Anna Bridge 160:5571c4ff569f 4495 * @brief Processing function for the floating-point sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4496 * @param[in] S points to an instance of the floating-point sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4497 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4498 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 4499 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
Anna Bridge 160:5571c4ff569f 4500 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 4501 */
Anna Bridge 160:5571c4ff569f 4502 void arm_fir_sparse_f32(
Anna Bridge 160:5571c4ff569f 4503 arm_fir_sparse_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4504 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 4505 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 4506 float32_t * pScratchIn,
Anna Bridge 160:5571c4ff569f 4507 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4508
Anna Bridge 160:5571c4ff569f 4509
Anna Bridge 160:5571c4ff569f 4510 /**
Anna Bridge 160:5571c4ff569f 4511 * @brief Initialization function for the floating-point sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4512 * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4513 * @param[in] numTaps number of nonzero coefficients in the filter.
Anna Bridge 160:5571c4ff569f 4514 * @param[in] pCoeffs points to the array of filter coefficients.
Anna Bridge 160:5571c4ff569f 4515 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 4516 * @param[in] pTapDelay points to the array of offset times.
Anna Bridge 160:5571c4ff569f 4517 * @param[in] maxDelay maximum offset time supported.
Anna Bridge 160:5571c4ff569f 4518 * @param[in] blockSize number of samples that will be processed per block.
Anna Bridge 160:5571c4ff569f 4519 */
Anna Bridge 160:5571c4ff569f 4520 void arm_fir_sparse_init_f32(
Anna Bridge 160:5571c4ff569f 4521 arm_fir_sparse_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4522 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4523 float32_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4524 float32_t * pState,
Anna Bridge 160:5571c4ff569f 4525 int32_t * pTapDelay,
Anna Bridge 160:5571c4ff569f 4526 uint16_t maxDelay,
Anna Bridge 160:5571c4ff569f 4527 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4528
Anna Bridge 160:5571c4ff569f 4529
Anna Bridge 160:5571c4ff569f 4530 /**
Anna Bridge 160:5571c4ff569f 4531 * @brief Processing function for the Q31 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4532 * @param[in] S points to an instance of the Q31 sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4533 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4534 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 4535 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
Anna Bridge 160:5571c4ff569f 4536 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 4537 */
Anna Bridge 160:5571c4ff569f 4538 void arm_fir_sparse_q31(
Anna Bridge 160:5571c4ff569f 4539 arm_fir_sparse_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4540 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 4541 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 4542 q31_t * pScratchIn,
Anna Bridge 160:5571c4ff569f 4543 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4544
Anna Bridge 160:5571c4ff569f 4545
Anna Bridge 160:5571c4ff569f 4546 /**
Anna Bridge 160:5571c4ff569f 4547 * @brief Initialization function for the Q31 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4548 * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4549 * @param[in] numTaps number of nonzero coefficients in the filter.
Anna Bridge 160:5571c4ff569f 4550 * @param[in] pCoeffs points to the array of filter coefficients.
Anna Bridge 160:5571c4ff569f 4551 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 4552 * @param[in] pTapDelay points to the array of offset times.
Anna Bridge 160:5571c4ff569f 4553 * @param[in] maxDelay maximum offset time supported.
Anna Bridge 160:5571c4ff569f 4554 * @param[in] blockSize number of samples that will be processed per block.
Anna Bridge 160:5571c4ff569f 4555 */
Anna Bridge 160:5571c4ff569f 4556 void arm_fir_sparse_init_q31(
Anna Bridge 160:5571c4ff569f 4557 arm_fir_sparse_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4558 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4559 q31_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4560 q31_t * pState,
Anna Bridge 160:5571c4ff569f 4561 int32_t * pTapDelay,
Anna Bridge 160:5571c4ff569f 4562 uint16_t maxDelay,
Anna Bridge 160:5571c4ff569f 4563 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4564
Anna Bridge 160:5571c4ff569f 4565
Anna Bridge 160:5571c4ff569f 4566 /**
Anna Bridge 160:5571c4ff569f 4567 * @brief Processing function for the Q15 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4568 * @param[in] S points to an instance of the Q15 sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4569 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4570 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 4571 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
Anna Bridge 160:5571c4ff569f 4572 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
Anna Bridge 160:5571c4ff569f 4573 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 4574 */
Anna Bridge 160:5571c4ff569f 4575 void arm_fir_sparse_q15(
Anna Bridge 160:5571c4ff569f 4576 arm_fir_sparse_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4577 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 4578 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 4579 q15_t * pScratchIn,
Anna Bridge 160:5571c4ff569f 4580 q31_t * pScratchOut,
Anna Bridge 160:5571c4ff569f 4581 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4582
Anna Bridge 160:5571c4ff569f 4583
Anna Bridge 160:5571c4ff569f 4584 /**
Anna Bridge 160:5571c4ff569f 4585 * @brief Initialization function for the Q15 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4586 * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4587 * @param[in] numTaps number of nonzero coefficients in the filter.
Anna Bridge 160:5571c4ff569f 4588 * @param[in] pCoeffs points to the array of filter coefficients.
Anna Bridge 160:5571c4ff569f 4589 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 4590 * @param[in] pTapDelay points to the array of offset times.
Anna Bridge 160:5571c4ff569f 4591 * @param[in] maxDelay maximum offset time supported.
Anna Bridge 160:5571c4ff569f 4592 * @param[in] blockSize number of samples that will be processed per block.
Anna Bridge 160:5571c4ff569f 4593 */
Anna Bridge 160:5571c4ff569f 4594 void arm_fir_sparse_init_q15(
Anna Bridge 160:5571c4ff569f 4595 arm_fir_sparse_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4596 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4597 q15_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4598 q15_t * pState,
Anna Bridge 160:5571c4ff569f 4599 int32_t * pTapDelay,
Anna Bridge 160:5571c4ff569f 4600 uint16_t maxDelay,
Anna Bridge 160:5571c4ff569f 4601 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4602
Anna Bridge 160:5571c4ff569f 4603
Anna Bridge 160:5571c4ff569f 4604 /**
Anna Bridge 160:5571c4ff569f 4605 * @brief Processing function for the Q7 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4606 * @param[in] S points to an instance of the Q7 sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4607 * @param[in] pSrc points to the block of input data.
Anna Bridge 160:5571c4ff569f 4608 * @param[out] pDst points to the block of output data
Anna Bridge 160:5571c4ff569f 4609 * @param[in] pScratchIn points to a temporary buffer of size blockSize.
Anna Bridge 160:5571c4ff569f 4610 * @param[in] pScratchOut points to a temporary buffer of size blockSize.
Anna Bridge 160:5571c4ff569f 4611 * @param[in] blockSize number of input samples to process per call.
Anna Bridge 160:5571c4ff569f 4612 */
Anna Bridge 160:5571c4ff569f 4613 void arm_fir_sparse_q7(
Anna Bridge 160:5571c4ff569f 4614 arm_fir_sparse_instance_q7 * S,
Anna Bridge 160:5571c4ff569f 4615 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 4616 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 4617 q7_t * pScratchIn,
Anna Bridge 160:5571c4ff569f 4618 q31_t * pScratchOut,
Anna Bridge 160:5571c4ff569f 4619 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4620
Anna Bridge 160:5571c4ff569f 4621
Anna Bridge 160:5571c4ff569f 4622 /**
Anna Bridge 160:5571c4ff569f 4623 * @brief Initialization function for the Q7 sparse FIR filter.
Anna Bridge 160:5571c4ff569f 4624 * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
Anna Bridge 160:5571c4ff569f 4625 * @param[in] numTaps number of nonzero coefficients in the filter.
Anna Bridge 160:5571c4ff569f 4626 * @param[in] pCoeffs points to the array of filter coefficients.
Anna Bridge 160:5571c4ff569f 4627 * @param[in] pState points to the state buffer.
Anna Bridge 160:5571c4ff569f 4628 * @param[in] pTapDelay points to the array of offset times.
Anna Bridge 160:5571c4ff569f 4629 * @param[in] maxDelay maximum offset time supported.
Anna Bridge 160:5571c4ff569f 4630 * @param[in] blockSize number of samples that will be processed per block.
Anna Bridge 160:5571c4ff569f 4631 */
Anna Bridge 160:5571c4ff569f 4632 void arm_fir_sparse_init_q7(
Anna Bridge 160:5571c4ff569f 4633 arm_fir_sparse_instance_q7 * S,
Anna Bridge 160:5571c4ff569f 4634 uint16_t numTaps,
Anna Bridge 160:5571c4ff569f 4635 q7_t * pCoeffs,
Anna Bridge 160:5571c4ff569f 4636 q7_t * pState,
Anna Bridge 160:5571c4ff569f 4637 int32_t * pTapDelay,
Anna Bridge 160:5571c4ff569f 4638 uint16_t maxDelay,
Anna Bridge 160:5571c4ff569f 4639 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 4640
Anna Bridge 160:5571c4ff569f 4641
Anna Bridge 160:5571c4ff569f 4642 /**
Anna Bridge 160:5571c4ff569f 4643 * @brief Floating-point sin_cos function.
Anna Bridge 160:5571c4ff569f 4644 * @param[in] theta input value in degrees
Anna Bridge 160:5571c4ff569f 4645 * @param[out] pSinVal points to the processed sine output.
Anna Bridge 160:5571c4ff569f 4646 * @param[out] pCosVal points to the processed cos output.
Anna Bridge 160:5571c4ff569f 4647 */
Anna Bridge 160:5571c4ff569f 4648 void arm_sin_cos_f32(
Anna Bridge 160:5571c4ff569f 4649 float32_t theta,
Anna Bridge 160:5571c4ff569f 4650 float32_t * pSinVal,
Anna Bridge 160:5571c4ff569f 4651 float32_t * pCosVal);
Anna Bridge 160:5571c4ff569f 4652
Anna Bridge 160:5571c4ff569f 4653
Anna Bridge 160:5571c4ff569f 4654 /**
Anna Bridge 160:5571c4ff569f 4655 * @brief Q31 sin_cos function.
Anna Bridge 160:5571c4ff569f 4656 * @param[in] theta scaled input value in degrees
Anna Bridge 160:5571c4ff569f 4657 * @param[out] pSinVal points to the processed sine output.
Anna Bridge 160:5571c4ff569f 4658 * @param[out] pCosVal points to the processed cosine output.
Anna Bridge 160:5571c4ff569f 4659 */
Anna Bridge 160:5571c4ff569f 4660 void arm_sin_cos_q31(
Anna Bridge 160:5571c4ff569f 4661 q31_t theta,
Anna Bridge 160:5571c4ff569f 4662 q31_t * pSinVal,
Anna Bridge 160:5571c4ff569f 4663 q31_t * pCosVal);
Anna Bridge 160:5571c4ff569f 4664
Anna Bridge 160:5571c4ff569f 4665
Anna Bridge 160:5571c4ff569f 4666 /**
Anna Bridge 160:5571c4ff569f 4667 * @brief Floating-point complex conjugate.
Anna Bridge 160:5571c4ff569f 4668 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 4669 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 4670 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 4671 */
Anna Bridge 160:5571c4ff569f 4672 void arm_cmplx_conj_f32(
Anna Bridge 160:5571c4ff569f 4673 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 4674 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 4675 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 4676
Anna Bridge 160:5571c4ff569f 4677 /**
Anna Bridge 160:5571c4ff569f 4678 * @brief Q31 complex conjugate.
Anna Bridge 160:5571c4ff569f 4679 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 4680 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 4681 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 4682 */
Anna Bridge 160:5571c4ff569f 4683 void arm_cmplx_conj_q31(
Anna Bridge 160:5571c4ff569f 4684 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 4685 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 4686 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 4687
Anna Bridge 160:5571c4ff569f 4688
Anna Bridge 160:5571c4ff569f 4689 /**
Anna Bridge 160:5571c4ff569f 4690 * @brief Q15 complex conjugate.
Anna Bridge 160:5571c4ff569f 4691 * @param[in] pSrc points to the input vector
Anna Bridge 160:5571c4ff569f 4692 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 4693 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 4694 */
Anna Bridge 160:5571c4ff569f 4695 void arm_cmplx_conj_q15(
Anna Bridge 160:5571c4ff569f 4696 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 4697 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 4698 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 4699
Anna Bridge 160:5571c4ff569f 4700
Anna Bridge 160:5571c4ff569f 4701 /**
Anna Bridge 160:5571c4ff569f 4702 * @brief Floating-point complex magnitude squared
Anna Bridge 160:5571c4ff569f 4703 * @param[in] pSrc points to the complex input vector
Anna Bridge 160:5571c4ff569f 4704 * @param[out] pDst points to the real output vector
Anna Bridge 160:5571c4ff569f 4705 * @param[in] numSamples number of complex samples in the input vector
Anna Bridge 160:5571c4ff569f 4706 */
Anna Bridge 160:5571c4ff569f 4707 void arm_cmplx_mag_squared_f32(
Anna Bridge 160:5571c4ff569f 4708 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 4709 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 4710 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 4711
Anna Bridge 160:5571c4ff569f 4712
Anna Bridge 160:5571c4ff569f 4713 /**
Anna Bridge 160:5571c4ff569f 4714 * @brief Q31 complex magnitude squared
Anna Bridge 160:5571c4ff569f 4715 * @param[in] pSrc points to the complex input vector
Anna Bridge 160:5571c4ff569f 4716 * @param[out] pDst points to the real output vector
Anna Bridge 160:5571c4ff569f 4717 * @param[in] numSamples number of complex samples in the input vector
Anna Bridge 160:5571c4ff569f 4718 */
Anna Bridge 160:5571c4ff569f 4719 void arm_cmplx_mag_squared_q31(
Anna Bridge 160:5571c4ff569f 4720 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 4721 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 4722 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 4723
Anna Bridge 160:5571c4ff569f 4724
Anna Bridge 160:5571c4ff569f 4725 /**
Anna Bridge 160:5571c4ff569f 4726 * @brief Q15 complex magnitude squared
Anna Bridge 160:5571c4ff569f 4727 * @param[in] pSrc points to the complex input vector
Anna Bridge 160:5571c4ff569f 4728 * @param[out] pDst points to the real output vector
Anna Bridge 160:5571c4ff569f 4729 * @param[in] numSamples number of complex samples in the input vector
Anna Bridge 160:5571c4ff569f 4730 */
Anna Bridge 160:5571c4ff569f 4731 void arm_cmplx_mag_squared_q15(
Anna Bridge 160:5571c4ff569f 4732 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 4733 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 4734 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 4735
Anna Bridge 160:5571c4ff569f 4736
Anna Bridge 160:5571c4ff569f 4737 /**
Anna Bridge 160:5571c4ff569f 4738 * @ingroup groupController
Anna Bridge 160:5571c4ff569f 4739 */
Anna Bridge 160:5571c4ff569f 4740
Anna Bridge 160:5571c4ff569f 4741 /**
Anna Bridge 160:5571c4ff569f 4742 * @defgroup PID PID Motor Control
Anna Bridge 160:5571c4ff569f 4743 *
Anna Bridge 160:5571c4ff569f 4744 * A Proportional Integral Derivative (PID) controller is a generic feedback control
Anna Bridge 160:5571c4ff569f 4745 * loop mechanism widely used in industrial control systems.
Anna Bridge 160:5571c4ff569f 4746 * A PID controller is the most commonly used type of feedback controller.
Anna Bridge 160:5571c4ff569f 4747 *
Anna Bridge 160:5571c4ff569f 4748 * This set of functions implements (PID) controllers
Anna Bridge 160:5571c4ff569f 4749 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
Anna Bridge 160:5571c4ff569f 4750 * of data and each call to the function returns a single processed value.
Anna Bridge 160:5571c4ff569f 4751 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
Anna Bridge 160:5571c4ff569f 4752 * is the input sample value. The functions return the output value.
Anna Bridge 160:5571c4ff569f 4753 *
Anna Bridge 160:5571c4ff569f 4754 * \par Algorithm:
Anna Bridge 160:5571c4ff569f 4755 * <pre>
Anna Bridge 160:5571c4ff569f 4756 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
Anna Bridge 160:5571c4ff569f 4757 * A0 = Kp + Ki + Kd
Anna Bridge 160:5571c4ff569f 4758 * A1 = (-Kp ) - (2 * Kd )
Anna Bridge 160:5571c4ff569f 4759 * A2 = Kd </pre>
Anna Bridge 160:5571c4ff569f 4760 *
Anna Bridge 160:5571c4ff569f 4761 * \par
Anna Bridge 160:5571c4ff569f 4762 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
Anna Bridge 160:5571c4ff569f 4763 *
Anna Bridge 160:5571c4ff569f 4764 * \par
Anna Bridge 160:5571c4ff569f 4765 * \image html PID.gif "Proportional Integral Derivative Controller"
Anna Bridge 160:5571c4ff569f 4766 *
Anna Bridge 160:5571c4ff569f 4767 * \par
Anna Bridge 160:5571c4ff569f 4768 * The PID controller calculates an "error" value as the difference between
Anna Bridge 160:5571c4ff569f 4769 * the measured output and the reference input.
Anna Bridge 160:5571c4ff569f 4770 * The controller attempts to minimize the error by adjusting the process control inputs.
Anna Bridge 160:5571c4ff569f 4771 * The proportional value determines the reaction to the current error,
Anna Bridge 160:5571c4ff569f 4772 * the integral value determines the reaction based on the sum of recent errors,
Anna Bridge 160:5571c4ff569f 4773 * and the derivative value determines the reaction based on the rate at which the error has been changing.
Anna Bridge 160:5571c4ff569f 4774 *
Anna Bridge 160:5571c4ff569f 4775 * \par Instance Structure
Anna Bridge 160:5571c4ff569f 4776 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
Anna Bridge 160:5571c4ff569f 4777 * A separate instance structure must be defined for each PID Controller.
Anna Bridge 160:5571c4ff569f 4778 * There are separate instance structure declarations for each of the 3 supported data types.
Anna Bridge 160:5571c4ff569f 4779 *
Anna Bridge 160:5571c4ff569f 4780 * \par Reset Functions
Anna Bridge 160:5571c4ff569f 4781 * There is also an associated reset function for each data type which clears the state array.
Anna Bridge 160:5571c4ff569f 4782 *
Anna Bridge 160:5571c4ff569f 4783 * \par Initialization Functions
Anna Bridge 160:5571c4ff569f 4784 * There is also an associated initialization function for each data type.
Anna Bridge 160:5571c4ff569f 4785 * The initialization function performs the following operations:
Anna Bridge 160:5571c4ff569f 4786 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
Anna Bridge 160:5571c4ff569f 4787 * - Zeros out the values in the state buffer.
Anna Bridge 160:5571c4ff569f 4788 *
Anna Bridge 160:5571c4ff569f 4789 * \par
Anna Bridge 160:5571c4ff569f 4790 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
Anna Bridge 160:5571c4ff569f 4791 *
Anna Bridge 160:5571c4ff569f 4792 * \par Fixed-Point Behavior
Anna Bridge 160:5571c4ff569f 4793 * Care must be taken when using the fixed-point versions of the PID Controller functions.
Anna Bridge 160:5571c4ff569f 4794 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
Anna Bridge 160:5571c4ff569f 4795 * Refer to the function specific documentation below for usage guidelines.
Anna Bridge 160:5571c4ff569f 4796 */
Anna Bridge 160:5571c4ff569f 4797
Anna Bridge 160:5571c4ff569f 4798 /**
Anna Bridge 160:5571c4ff569f 4799 * @addtogroup PID
Anna Bridge 160:5571c4ff569f 4800 * @{
Anna Bridge 160:5571c4ff569f 4801 */
Anna Bridge 160:5571c4ff569f 4802
Anna Bridge 160:5571c4ff569f 4803 /**
Anna Bridge 160:5571c4ff569f 4804 * @brief Process function for the floating-point PID Control.
Anna Bridge 160:5571c4ff569f 4805 * @param[in,out] S is an instance of the floating-point PID Control structure
Anna Bridge 160:5571c4ff569f 4806 * @param[in] in input sample to process
Anna Bridge 160:5571c4ff569f 4807 * @return out processed output sample.
Anna Bridge 160:5571c4ff569f 4808 */
Anna Bridge 160:5571c4ff569f 4809 CMSIS_INLINE __STATIC_INLINE float32_t arm_pid_f32(
Anna Bridge 160:5571c4ff569f 4810 arm_pid_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 4811 float32_t in)
Anna Bridge 160:5571c4ff569f 4812 {
Anna Bridge 160:5571c4ff569f 4813 float32_t out;
Anna Bridge 160:5571c4ff569f 4814
Anna Bridge 160:5571c4ff569f 4815 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
Anna Bridge 160:5571c4ff569f 4816 out = (S->A0 * in) +
Anna Bridge 160:5571c4ff569f 4817 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
Anna Bridge 160:5571c4ff569f 4818
Anna Bridge 160:5571c4ff569f 4819 /* Update state */
Anna Bridge 160:5571c4ff569f 4820 S->state[1] = S->state[0];
Anna Bridge 160:5571c4ff569f 4821 S->state[0] = in;
Anna Bridge 160:5571c4ff569f 4822 S->state[2] = out;
Anna Bridge 160:5571c4ff569f 4823
Anna Bridge 160:5571c4ff569f 4824 /* return to application */
Anna Bridge 160:5571c4ff569f 4825 return (out);
Anna Bridge 160:5571c4ff569f 4826
Anna Bridge 160:5571c4ff569f 4827 }
Anna Bridge 160:5571c4ff569f 4828
Anna Bridge 160:5571c4ff569f 4829 /**
Anna Bridge 160:5571c4ff569f 4830 * @brief Process function for the Q31 PID Control.
Anna Bridge 160:5571c4ff569f 4831 * @param[in,out] S points to an instance of the Q31 PID Control structure
Anna Bridge 160:5571c4ff569f 4832 * @param[in] in input sample to process
Anna Bridge 160:5571c4ff569f 4833 * @return out processed output sample.
Anna Bridge 160:5571c4ff569f 4834 *
Anna Bridge 160:5571c4ff569f 4835 * <b>Scaling and Overflow Behavior:</b>
Anna Bridge 160:5571c4ff569f 4836 * \par
Anna Bridge 160:5571c4ff569f 4837 * The function is implemented using an internal 64-bit accumulator.
Anna Bridge 160:5571c4ff569f 4838 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
Anna Bridge 160:5571c4ff569f 4839 * Thus, if the accumulator result overflows it wraps around rather than clip.
Anna Bridge 160:5571c4ff569f 4840 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
Anna Bridge 160:5571c4ff569f 4841 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
Anna Bridge 160:5571c4ff569f 4842 */
Anna Bridge 160:5571c4ff569f 4843 CMSIS_INLINE __STATIC_INLINE q31_t arm_pid_q31(
Anna Bridge 160:5571c4ff569f 4844 arm_pid_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 4845 q31_t in)
Anna Bridge 160:5571c4ff569f 4846 {
Anna Bridge 160:5571c4ff569f 4847 q63_t acc;
Anna Bridge 160:5571c4ff569f 4848 q31_t out;
Anna Bridge 160:5571c4ff569f 4849
Anna Bridge 160:5571c4ff569f 4850 /* acc = A0 * x[n] */
Anna Bridge 160:5571c4ff569f 4851 acc = (q63_t) S->A0 * in;
Anna Bridge 160:5571c4ff569f 4852
Anna Bridge 160:5571c4ff569f 4853 /* acc += A1 * x[n-1] */
Anna Bridge 160:5571c4ff569f 4854 acc += (q63_t) S->A1 * S->state[0];
Anna Bridge 160:5571c4ff569f 4855
Anna Bridge 160:5571c4ff569f 4856 /* acc += A2 * x[n-2] */
Anna Bridge 160:5571c4ff569f 4857 acc += (q63_t) S->A2 * S->state[1];
Anna Bridge 160:5571c4ff569f 4858
Anna Bridge 160:5571c4ff569f 4859 /* convert output to 1.31 format to add y[n-1] */
Anna Bridge 160:5571c4ff569f 4860 out = (q31_t) (acc >> 31u);
Anna Bridge 160:5571c4ff569f 4861
Anna Bridge 160:5571c4ff569f 4862 /* out += y[n-1] */
Anna Bridge 160:5571c4ff569f 4863 out += S->state[2];
Anna Bridge 160:5571c4ff569f 4864
Anna Bridge 160:5571c4ff569f 4865 /* Update state */
Anna Bridge 160:5571c4ff569f 4866 S->state[1] = S->state[0];
Anna Bridge 160:5571c4ff569f 4867 S->state[0] = in;
Anna Bridge 160:5571c4ff569f 4868 S->state[2] = out;
Anna Bridge 160:5571c4ff569f 4869
Anna Bridge 160:5571c4ff569f 4870 /* return to application */
Anna Bridge 160:5571c4ff569f 4871 return (out);
Anna Bridge 160:5571c4ff569f 4872 }
Anna Bridge 160:5571c4ff569f 4873
Anna Bridge 160:5571c4ff569f 4874
Anna Bridge 160:5571c4ff569f 4875 /**
Anna Bridge 160:5571c4ff569f 4876 * @brief Process function for the Q15 PID Control.
Anna Bridge 160:5571c4ff569f 4877 * @param[in,out] S points to an instance of the Q15 PID Control structure
Anna Bridge 160:5571c4ff569f 4878 * @param[in] in input sample to process
Anna Bridge 160:5571c4ff569f 4879 * @return out processed output sample.
Anna Bridge 160:5571c4ff569f 4880 *
Anna Bridge 160:5571c4ff569f 4881 * <b>Scaling and Overflow Behavior:</b>
Anna Bridge 160:5571c4ff569f 4882 * \par
Anna Bridge 160:5571c4ff569f 4883 * The function is implemented using a 64-bit internal accumulator.
Anna Bridge 160:5571c4ff569f 4884 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
Anna Bridge 160:5571c4ff569f 4885 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
Anna Bridge 160:5571c4ff569f 4886 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
Anna Bridge 160:5571c4ff569f 4887 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
Anna Bridge 160:5571c4ff569f 4888 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
Anna Bridge 160:5571c4ff569f 4889 */
Anna Bridge 160:5571c4ff569f 4890 CMSIS_INLINE __STATIC_INLINE q15_t arm_pid_q15(
Anna Bridge 160:5571c4ff569f 4891 arm_pid_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 4892 q15_t in)
Anna Bridge 160:5571c4ff569f 4893 {
Anna Bridge 160:5571c4ff569f 4894 q63_t acc;
Anna Bridge 160:5571c4ff569f 4895 q15_t out;
Anna Bridge 160:5571c4ff569f 4896
Anna Bridge 160:5571c4ff569f 4897 #if defined (ARM_MATH_DSP)
Anna Bridge 160:5571c4ff569f 4898 __SIMD32_TYPE *vstate;
Anna Bridge 160:5571c4ff569f 4899
Anna Bridge 160:5571c4ff569f 4900 /* Implementation of PID controller */
Anna Bridge 160:5571c4ff569f 4901
Anna Bridge 160:5571c4ff569f 4902 /* acc = A0 * x[n] */
Anna Bridge 160:5571c4ff569f 4903 acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
Anna Bridge 160:5571c4ff569f 4904
Anna Bridge 160:5571c4ff569f 4905 /* acc += A1 * x[n-1] + A2 * x[n-2] */
Anna Bridge 160:5571c4ff569f 4906 vstate = __SIMD32_CONST(S->state);
Anna Bridge 160:5571c4ff569f 4907 acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc);
Anna Bridge 160:5571c4ff569f 4908 #else
Anna Bridge 160:5571c4ff569f 4909 /* acc = A0 * x[n] */
Anna Bridge 160:5571c4ff569f 4910 acc = ((q31_t) S->A0) * in;
Anna Bridge 160:5571c4ff569f 4911
Anna Bridge 160:5571c4ff569f 4912 /* acc += A1 * x[n-1] + A2 * x[n-2] */
Anna Bridge 160:5571c4ff569f 4913 acc += (q31_t) S->A1 * S->state[0];
Anna Bridge 160:5571c4ff569f 4914 acc += (q31_t) S->A2 * S->state[1];
Anna Bridge 160:5571c4ff569f 4915 #endif
Anna Bridge 160:5571c4ff569f 4916
Anna Bridge 160:5571c4ff569f 4917 /* acc += y[n-1] */
Anna Bridge 160:5571c4ff569f 4918 acc += (q31_t) S->state[2] << 15;
Anna Bridge 160:5571c4ff569f 4919
Anna Bridge 160:5571c4ff569f 4920 /* saturate the output */
Anna Bridge 160:5571c4ff569f 4921 out = (q15_t) (__SSAT((acc >> 15), 16));
Anna Bridge 160:5571c4ff569f 4922
Anna Bridge 160:5571c4ff569f 4923 /* Update state */
Anna Bridge 160:5571c4ff569f 4924 S->state[1] = S->state[0];
Anna Bridge 160:5571c4ff569f 4925 S->state[0] = in;
Anna Bridge 160:5571c4ff569f 4926 S->state[2] = out;
Anna Bridge 160:5571c4ff569f 4927
Anna Bridge 160:5571c4ff569f 4928 /* return to application */
Anna Bridge 160:5571c4ff569f 4929 return (out);
Anna Bridge 160:5571c4ff569f 4930 }
Anna Bridge 160:5571c4ff569f 4931
Anna Bridge 160:5571c4ff569f 4932 /**
Anna Bridge 160:5571c4ff569f 4933 * @} end of PID group
Anna Bridge 160:5571c4ff569f 4934 */
Anna Bridge 160:5571c4ff569f 4935
Anna Bridge 160:5571c4ff569f 4936
Anna Bridge 160:5571c4ff569f 4937 /**
Anna Bridge 160:5571c4ff569f 4938 * @brief Floating-point matrix inverse.
Anna Bridge 160:5571c4ff569f 4939 * @param[in] src points to the instance of the input floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 4940 * @param[out] dst points to the instance of the output floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 4941 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
Anna Bridge 160:5571c4ff569f 4942 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
Anna Bridge 160:5571c4ff569f 4943 */
Anna Bridge 160:5571c4ff569f 4944 arm_status arm_mat_inverse_f32(
Anna Bridge 160:5571c4ff569f 4945 const arm_matrix_instance_f32 * src,
Anna Bridge 160:5571c4ff569f 4946 arm_matrix_instance_f32 * dst);
Anna Bridge 160:5571c4ff569f 4947
Anna Bridge 160:5571c4ff569f 4948
Anna Bridge 160:5571c4ff569f 4949 /**
Anna Bridge 160:5571c4ff569f 4950 * @brief Floating-point matrix inverse.
Anna Bridge 160:5571c4ff569f 4951 * @param[in] src points to the instance of the input floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 4952 * @param[out] dst points to the instance of the output floating-point matrix structure.
Anna Bridge 160:5571c4ff569f 4953 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
Anna Bridge 160:5571c4ff569f 4954 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
Anna Bridge 160:5571c4ff569f 4955 */
Anna Bridge 160:5571c4ff569f 4956 arm_status arm_mat_inverse_f64(
Anna Bridge 160:5571c4ff569f 4957 const arm_matrix_instance_f64 * src,
Anna Bridge 160:5571c4ff569f 4958 arm_matrix_instance_f64 * dst);
Anna Bridge 160:5571c4ff569f 4959
Anna Bridge 160:5571c4ff569f 4960
Anna Bridge 160:5571c4ff569f 4961
Anna Bridge 160:5571c4ff569f 4962 /**
Anna Bridge 160:5571c4ff569f 4963 * @ingroup groupController
Anna Bridge 160:5571c4ff569f 4964 */
Anna Bridge 160:5571c4ff569f 4965
Anna Bridge 160:5571c4ff569f 4966 /**
Anna Bridge 160:5571c4ff569f 4967 * @defgroup clarke Vector Clarke Transform
Anna Bridge 160:5571c4ff569f 4968 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
Anna Bridge 160:5571c4ff569f 4969 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
Anna Bridge 160:5571c4ff569f 4970 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
Anna Bridge 160:5571c4ff569f 4971 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
Anna Bridge 160:5571c4ff569f 4972 * \image html clarke.gif Stator current space vector and its components in (a,b).
Anna Bridge 160:5571c4ff569f 4973 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
Anna Bridge 160:5571c4ff569f 4974 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
Anna Bridge 160:5571c4ff569f 4975 *
Anna Bridge 160:5571c4ff569f 4976 * The function operates on a single sample of data and each call to the function returns the processed output.
Anna Bridge 160:5571c4ff569f 4977 * The library provides separate functions for Q31 and floating-point data types.
Anna Bridge 160:5571c4ff569f 4978 * \par Algorithm
Anna Bridge 160:5571c4ff569f 4979 * \image html clarkeFormula.gif
Anna Bridge 160:5571c4ff569f 4980 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
Anna Bridge 160:5571c4ff569f 4981 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
Anna Bridge 160:5571c4ff569f 4982 * \par Fixed-Point Behavior
Anna Bridge 160:5571c4ff569f 4983 * Care must be taken when using the Q31 version of the Clarke transform.
Anna Bridge 160:5571c4ff569f 4984 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
Anna Bridge 160:5571c4ff569f 4985 * Refer to the function specific documentation below for usage guidelines.
Anna Bridge 160:5571c4ff569f 4986 */
Anna Bridge 160:5571c4ff569f 4987
Anna Bridge 160:5571c4ff569f 4988 /**
Anna Bridge 160:5571c4ff569f 4989 * @addtogroup clarke
Anna Bridge 160:5571c4ff569f 4990 * @{
Anna Bridge 160:5571c4ff569f 4991 */
Anna Bridge 160:5571c4ff569f 4992
Anna Bridge 160:5571c4ff569f 4993 /**
Anna Bridge 160:5571c4ff569f 4994 *
Anna Bridge 160:5571c4ff569f 4995 * @brief Floating-point Clarke transform
Anna Bridge 160:5571c4ff569f 4996 * @param[in] Ia input three-phase coordinate <code>a</code>
Anna Bridge 160:5571c4ff569f 4997 * @param[in] Ib input three-phase coordinate <code>b</code>
Anna Bridge 160:5571c4ff569f 4998 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
Anna Bridge 160:5571c4ff569f 4999 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
Anna Bridge 160:5571c4ff569f 5000 */
Anna Bridge 160:5571c4ff569f 5001 CMSIS_INLINE __STATIC_INLINE void arm_clarke_f32(
Anna Bridge 160:5571c4ff569f 5002 float32_t Ia,
Anna Bridge 160:5571c4ff569f 5003 float32_t Ib,
Anna Bridge 160:5571c4ff569f 5004 float32_t * pIalpha,
Anna Bridge 160:5571c4ff569f 5005 float32_t * pIbeta)
Anna Bridge 160:5571c4ff569f 5006 {
Anna Bridge 160:5571c4ff569f 5007 /* Calculate pIalpha using the equation, pIalpha = Ia */
Anna Bridge 160:5571c4ff569f 5008 *pIalpha = Ia;
Anna Bridge 160:5571c4ff569f 5009
Anna Bridge 160:5571c4ff569f 5010 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
Anna Bridge 160:5571c4ff569f 5011 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
Anna Bridge 160:5571c4ff569f 5012 }
Anna Bridge 160:5571c4ff569f 5013
Anna Bridge 160:5571c4ff569f 5014
Anna Bridge 160:5571c4ff569f 5015 /**
Anna Bridge 160:5571c4ff569f 5016 * @brief Clarke transform for Q31 version
Anna Bridge 160:5571c4ff569f 5017 * @param[in] Ia input three-phase coordinate <code>a</code>
Anna Bridge 160:5571c4ff569f 5018 * @param[in] Ib input three-phase coordinate <code>b</code>
Anna Bridge 160:5571c4ff569f 5019 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
Anna Bridge 160:5571c4ff569f 5020 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
Anna Bridge 160:5571c4ff569f 5021 *
Anna Bridge 160:5571c4ff569f 5022 * <b>Scaling and Overflow Behavior:</b>
Anna Bridge 160:5571c4ff569f 5023 * \par
Anna Bridge 160:5571c4ff569f 5024 * The function is implemented using an internal 32-bit accumulator.
Anna Bridge 160:5571c4ff569f 5025 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
Anna Bridge 160:5571c4ff569f 5026 * There is saturation on the addition, hence there is no risk of overflow.
Anna Bridge 160:5571c4ff569f 5027 */
Anna Bridge 160:5571c4ff569f 5028 CMSIS_INLINE __STATIC_INLINE void arm_clarke_q31(
Anna Bridge 160:5571c4ff569f 5029 q31_t Ia,
Anna Bridge 160:5571c4ff569f 5030 q31_t Ib,
Anna Bridge 160:5571c4ff569f 5031 q31_t * pIalpha,
Anna Bridge 160:5571c4ff569f 5032 q31_t * pIbeta)
Anna Bridge 160:5571c4ff569f 5033 {
Anna Bridge 160:5571c4ff569f 5034 q31_t product1, product2; /* Temporary variables used to store intermediate results */
Anna Bridge 160:5571c4ff569f 5035
Anna Bridge 160:5571c4ff569f 5036 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
Anna Bridge 160:5571c4ff569f 5037 *pIalpha = Ia;
Anna Bridge 160:5571c4ff569f 5038
Anna Bridge 160:5571c4ff569f 5039 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
Anna Bridge 160:5571c4ff569f 5040 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
Anna Bridge 160:5571c4ff569f 5041
Anna Bridge 160:5571c4ff569f 5042 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
Anna Bridge 160:5571c4ff569f 5043 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
Anna Bridge 160:5571c4ff569f 5044
Anna Bridge 160:5571c4ff569f 5045 /* pIbeta is calculated by adding the intermediate products */
Anna Bridge 160:5571c4ff569f 5046 *pIbeta = __QADD(product1, product2);
Anna Bridge 160:5571c4ff569f 5047 }
Anna Bridge 160:5571c4ff569f 5048
Anna Bridge 160:5571c4ff569f 5049 /**
Anna Bridge 160:5571c4ff569f 5050 * @} end of clarke group
Anna Bridge 160:5571c4ff569f 5051 */
Anna Bridge 160:5571c4ff569f 5052
Anna Bridge 160:5571c4ff569f 5053 /**
Anna Bridge 160:5571c4ff569f 5054 * @brief Converts the elements of the Q7 vector to Q31 vector.
Anna Bridge 160:5571c4ff569f 5055 * @param[in] pSrc input pointer
Anna Bridge 160:5571c4ff569f 5056 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 5057 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 5058 */
Anna Bridge 160:5571c4ff569f 5059 void arm_q7_to_q31(
Anna Bridge 160:5571c4ff569f 5060 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 5061 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 5062 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 5063
Anna Bridge 160:5571c4ff569f 5064
Anna Bridge 160:5571c4ff569f 5065
Anna Bridge 160:5571c4ff569f 5066 /**
Anna Bridge 160:5571c4ff569f 5067 * @ingroup groupController
Anna Bridge 160:5571c4ff569f 5068 */
Anna Bridge 160:5571c4ff569f 5069
Anna Bridge 160:5571c4ff569f 5070 /**
Anna Bridge 160:5571c4ff569f 5071 * @defgroup inv_clarke Vector Inverse Clarke Transform
Anna Bridge 160:5571c4ff569f 5072 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
Anna Bridge 160:5571c4ff569f 5073 *
Anna Bridge 160:5571c4ff569f 5074 * The function operates on a single sample of data and each call to the function returns the processed output.
Anna Bridge 160:5571c4ff569f 5075 * The library provides separate functions for Q31 and floating-point data types.
Anna Bridge 160:5571c4ff569f 5076 * \par Algorithm
Anna Bridge 160:5571c4ff569f 5077 * \image html clarkeInvFormula.gif
Anna Bridge 160:5571c4ff569f 5078 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
Anna Bridge 160:5571c4ff569f 5079 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
Anna Bridge 160:5571c4ff569f 5080 * \par Fixed-Point Behavior
Anna Bridge 160:5571c4ff569f 5081 * Care must be taken when using the Q31 version of the Clarke transform.
Anna Bridge 160:5571c4ff569f 5082 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
Anna Bridge 160:5571c4ff569f 5083 * Refer to the function specific documentation below for usage guidelines.
Anna Bridge 160:5571c4ff569f 5084 */
Anna Bridge 160:5571c4ff569f 5085
Anna Bridge 160:5571c4ff569f 5086 /**
Anna Bridge 160:5571c4ff569f 5087 * @addtogroup inv_clarke
Anna Bridge 160:5571c4ff569f 5088 * @{
Anna Bridge 160:5571c4ff569f 5089 */
Anna Bridge 160:5571c4ff569f 5090
Anna Bridge 160:5571c4ff569f 5091 /**
Anna Bridge 160:5571c4ff569f 5092 * @brief Floating-point Inverse Clarke transform
Anna Bridge 160:5571c4ff569f 5093 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
Anna Bridge 160:5571c4ff569f 5094 * @param[in] Ibeta input two-phase orthogonal vector axis beta
Anna Bridge 160:5571c4ff569f 5095 * @param[out] pIa points to output three-phase coordinate <code>a</code>
Anna Bridge 160:5571c4ff569f 5096 * @param[out] pIb points to output three-phase coordinate <code>b</code>
Anna Bridge 160:5571c4ff569f 5097 */
Anna Bridge 160:5571c4ff569f 5098 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_f32(
Anna Bridge 160:5571c4ff569f 5099 float32_t Ialpha,
Anna Bridge 160:5571c4ff569f 5100 float32_t Ibeta,
Anna Bridge 160:5571c4ff569f 5101 float32_t * pIa,
Anna Bridge 160:5571c4ff569f 5102 float32_t * pIb)
Anna Bridge 160:5571c4ff569f 5103 {
Anna Bridge 160:5571c4ff569f 5104 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
Anna Bridge 160:5571c4ff569f 5105 *pIa = Ialpha;
Anna Bridge 160:5571c4ff569f 5106
Anna Bridge 160:5571c4ff569f 5107 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
Anna Bridge 160:5571c4ff569f 5108 *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
Anna Bridge 160:5571c4ff569f 5109 }
Anna Bridge 160:5571c4ff569f 5110
Anna Bridge 160:5571c4ff569f 5111
Anna Bridge 160:5571c4ff569f 5112 /**
Anna Bridge 160:5571c4ff569f 5113 * @brief Inverse Clarke transform for Q31 version
Anna Bridge 160:5571c4ff569f 5114 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
Anna Bridge 160:5571c4ff569f 5115 * @param[in] Ibeta input two-phase orthogonal vector axis beta
Anna Bridge 160:5571c4ff569f 5116 * @param[out] pIa points to output three-phase coordinate <code>a</code>
Anna Bridge 160:5571c4ff569f 5117 * @param[out] pIb points to output three-phase coordinate <code>b</code>
Anna Bridge 160:5571c4ff569f 5118 *
Anna Bridge 160:5571c4ff569f 5119 * <b>Scaling and Overflow Behavior:</b>
Anna Bridge 160:5571c4ff569f 5120 * \par
Anna Bridge 160:5571c4ff569f 5121 * The function is implemented using an internal 32-bit accumulator.
Anna Bridge 160:5571c4ff569f 5122 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
Anna Bridge 160:5571c4ff569f 5123 * There is saturation on the subtraction, hence there is no risk of overflow.
Anna Bridge 160:5571c4ff569f 5124 */
Anna Bridge 160:5571c4ff569f 5125 CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_q31(
Anna Bridge 160:5571c4ff569f 5126 q31_t Ialpha,
Anna Bridge 160:5571c4ff569f 5127 q31_t Ibeta,
Anna Bridge 160:5571c4ff569f 5128 q31_t * pIa,
Anna Bridge 160:5571c4ff569f 5129 q31_t * pIb)
Anna Bridge 160:5571c4ff569f 5130 {
Anna Bridge 160:5571c4ff569f 5131 q31_t product1, product2; /* Temporary variables used to store intermediate results */
Anna Bridge 160:5571c4ff569f 5132
Anna Bridge 160:5571c4ff569f 5133 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
Anna Bridge 160:5571c4ff569f 5134 *pIa = Ialpha;
Anna Bridge 160:5571c4ff569f 5135
Anna Bridge 160:5571c4ff569f 5136 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
Anna Bridge 160:5571c4ff569f 5137 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
Anna Bridge 160:5571c4ff569f 5138
Anna Bridge 160:5571c4ff569f 5139 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
Anna Bridge 160:5571c4ff569f 5140 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
Anna Bridge 160:5571c4ff569f 5141
Anna Bridge 160:5571c4ff569f 5142 /* pIb is calculated by subtracting the products */
Anna Bridge 160:5571c4ff569f 5143 *pIb = __QSUB(product2, product1);
Anna Bridge 160:5571c4ff569f 5144 }
Anna Bridge 160:5571c4ff569f 5145
Anna Bridge 160:5571c4ff569f 5146 /**
Anna Bridge 160:5571c4ff569f 5147 * @} end of inv_clarke group
Anna Bridge 160:5571c4ff569f 5148 */
Anna Bridge 160:5571c4ff569f 5149
Anna Bridge 160:5571c4ff569f 5150 /**
Anna Bridge 160:5571c4ff569f 5151 * @brief Converts the elements of the Q7 vector to Q15 vector.
Anna Bridge 160:5571c4ff569f 5152 * @param[in] pSrc input pointer
Anna Bridge 160:5571c4ff569f 5153 * @param[out] pDst output pointer
Anna Bridge 160:5571c4ff569f 5154 * @param[in] blockSize number of samples to process
Anna Bridge 160:5571c4ff569f 5155 */
Anna Bridge 160:5571c4ff569f 5156 void arm_q7_to_q15(
Anna Bridge 160:5571c4ff569f 5157 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 5158 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 5159 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 5160
Anna Bridge 160:5571c4ff569f 5161
Anna Bridge 160:5571c4ff569f 5162
Anna Bridge 160:5571c4ff569f 5163 /**
Anna Bridge 160:5571c4ff569f 5164 * @ingroup groupController
Anna Bridge 160:5571c4ff569f 5165 */
Anna Bridge 160:5571c4ff569f 5166
Anna Bridge 160:5571c4ff569f 5167 /**
Anna Bridge 160:5571c4ff569f 5168 * @defgroup park Vector Park Transform
Anna Bridge 160:5571c4ff569f 5169 *
Anna Bridge 160:5571c4ff569f 5170 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
Anna Bridge 160:5571c4ff569f 5171 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
Anna Bridge 160:5571c4ff569f 5172 * from the stationary to the moving reference frame and control the spatial relationship between
Anna Bridge 160:5571c4ff569f 5173 * the stator vector current and rotor flux vector.
Anna Bridge 160:5571c4ff569f 5174 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
Anna Bridge 160:5571c4ff569f 5175 * current vector and the relationship from the two reference frames:
Anna Bridge 160:5571c4ff569f 5176 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
Anna Bridge 160:5571c4ff569f 5177 *
Anna Bridge 160:5571c4ff569f 5178 * The function operates on a single sample of data and each call to the function returns the processed output.
Anna Bridge 160:5571c4ff569f 5179 * The library provides separate functions for Q31 and floating-point data types.
Anna Bridge 160:5571c4ff569f 5180 * \par Algorithm
Anna Bridge 160:5571c4ff569f 5181 * \image html parkFormula.gif
Anna Bridge 160:5571c4ff569f 5182 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
Anna Bridge 160:5571c4ff569f 5183 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
Anna Bridge 160:5571c4ff569f 5184 * cosine and sine values of theta (rotor flux position).
Anna Bridge 160:5571c4ff569f 5185 * \par Fixed-Point Behavior
Anna Bridge 160:5571c4ff569f 5186 * Care must be taken when using the Q31 version of the Park transform.
Anna Bridge 160:5571c4ff569f 5187 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
Anna Bridge 160:5571c4ff569f 5188 * Refer to the function specific documentation below for usage guidelines.
Anna Bridge 160:5571c4ff569f 5189 */
Anna Bridge 160:5571c4ff569f 5190
Anna Bridge 160:5571c4ff569f 5191 /**
Anna Bridge 160:5571c4ff569f 5192 * @addtogroup park
Anna Bridge 160:5571c4ff569f 5193 * @{
Anna Bridge 160:5571c4ff569f 5194 */
Anna Bridge 160:5571c4ff569f 5195
Anna Bridge 160:5571c4ff569f 5196 /**
Anna Bridge 160:5571c4ff569f 5197 * @brief Floating-point Park transform
Anna Bridge 160:5571c4ff569f 5198 * @param[in] Ialpha input two-phase vector coordinate alpha
Anna Bridge 160:5571c4ff569f 5199 * @param[in] Ibeta input two-phase vector coordinate beta
Anna Bridge 160:5571c4ff569f 5200 * @param[out] pId points to output rotor reference frame d
Anna Bridge 160:5571c4ff569f 5201 * @param[out] pIq points to output rotor reference frame q
Anna Bridge 160:5571c4ff569f 5202 * @param[in] sinVal sine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5203 * @param[in] cosVal cosine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5204 *
Anna Bridge 160:5571c4ff569f 5205 * The function implements the forward Park transform.
Anna Bridge 160:5571c4ff569f 5206 *
Anna Bridge 160:5571c4ff569f 5207 */
Anna Bridge 160:5571c4ff569f 5208 CMSIS_INLINE __STATIC_INLINE void arm_park_f32(
Anna Bridge 160:5571c4ff569f 5209 float32_t Ialpha,
Anna Bridge 160:5571c4ff569f 5210 float32_t Ibeta,
Anna Bridge 160:5571c4ff569f 5211 float32_t * pId,
Anna Bridge 160:5571c4ff569f 5212 float32_t * pIq,
Anna Bridge 160:5571c4ff569f 5213 float32_t sinVal,
Anna Bridge 160:5571c4ff569f 5214 float32_t cosVal)
Anna Bridge 160:5571c4ff569f 5215 {
Anna Bridge 160:5571c4ff569f 5216 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
Anna Bridge 160:5571c4ff569f 5217 *pId = Ialpha * cosVal + Ibeta * sinVal;
Anna Bridge 160:5571c4ff569f 5218
Anna Bridge 160:5571c4ff569f 5219 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
Anna Bridge 160:5571c4ff569f 5220 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
Anna Bridge 160:5571c4ff569f 5221 }
Anna Bridge 160:5571c4ff569f 5222
Anna Bridge 160:5571c4ff569f 5223
Anna Bridge 160:5571c4ff569f 5224 /**
Anna Bridge 160:5571c4ff569f 5225 * @brief Park transform for Q31 version
Anna Bridge 160:5571c4ff569f 5226 * @param[in] Ialpha input two-phase vector coordinate alpha
Anna Bridge 160:5571c4ff569f 5227 * @param[in] Ibeta input two-phase vector coordinate beta
Anna Bridge 160:5571c4ff569f 5228 * @param[out] pId points to output rotor reference frame d
Anna Bridge 160:5571c4ff569f 5229 * @param[out] pIq points to output rotor reference frame q
Anna Bridge 160:5571c4ff569f 5230 * @param[in] sinVal sine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5231 * @param[in] cosVal cosine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5232 *
Anna Bridge 160:5571c4ff569f 5233 * <b>Scaling and Overflow Behavior:</b>
Anna Bridge 160:5571c4ff569f 5234 * \par
Anna Bridge 160:5571c4ff569f 5235 * The function is implemented using an internal 32-bit accumulator.
Anna Bridge 160:5571c4ff569f 5236 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
Anna Bridge 160:5571c4ff569f 5237 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
Anna Bridge 160:5571c4ff569f 5238 */
Anna Bridge 160:5571c4ff569f 5239 CMSIS_INLINE __STATIC_INLINE void arm_park_q31(
Anna Bridge 160:5571c4ff569f 5240 q31_t Ialpha,
Anna Bridge 160:5571c4ff569f 5241 q31_t Ibeta,
Anna Bridge 160:5571c4ff569f 5242 q31_t * pId,
Anna Bridge 160:5571c4ff569f 5243 q31_t * pIq,
Anna Bridge 160:5571c4ff569f 5244 q31_t sinVal,
Anna Bridge 160:5571c4ff569f 5245 q31_t cosVal)
Anna Bridge 160:5571c4ff569f 5246 {
Anna Bridge 160:5571c4ff569f 5247 q31_t product1, product2; /* Temporary variables used to store intermediate results */
Anna Bridge 160:5571c4ff569f 5248 q31_t product3, product4; /* Temporary variables used to store intermediate results */
Anna Bridge 160:5571c4ff569f 5249
Anna Bridge 160:5571c4ff569f 5250 /* Intermediate product is calculated by (Ialpha * cosVal) */
Anna Bridge 160:5571c4ff569f 5251 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5252
Anna Bridge 160:5571c4ff569f 5253 /* Intermediate product is calculated by (Ibeta * sinVal) */
Anna Bridge 160:5571c4ff569f 5254 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5255
Anna Bridge 160:5571c4ff569f 5256
Anna Bridge 160:5571c4ff569f 5257 /* Intermediate product is calculated by (Ialpha * sinVal) */
Anna Bridge 160:5571c4ff569f 5258 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5259
Anna Bridge 160:5571c4ff569f 5260 /* Intermediate product is calculated by (Ibeta * cosVal) */
Anna Bridge 160:5571c4ff569f 5261 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5262
Anna Bridge 160:5571c4ff569f 5263 /* Calculate pId by adding the two intermediate products 1 and 2 */
Anna Bridge 160:5571c4ff569f 5264 *pId = __QADD(product1, product2);
Anna Bridge 160:5571c4ff569f 5265
Anna Bridge 160:5571c4ff569f 5266 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
Anna Bridge 160:5571c4ff569f 5267 *pIq = __QSUB(product4, product3);
Anna Bridge 160:5571c4ff569f 5268 }
Anna Bridge 160:5571c4ff569f 5269
Anna Bridge 160:5571c4ff569f 5270 /**
Anna Bridge 160:5571c4ff569f 5271 * @} end of park group
Anna Bridge 160:5571c4ff569f 5272 */
Anna Bridge 160:5571c4ff569f 5273
Anna Bridge 160:5571c4ff569f 5274 /**
Anna Bridge 160:5571c4ff569f 5275 * @brief Converts the elements of the Q7 vector to floating-point vector.
Anna Bridge 160:5571c4ff569f 5276 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 5277 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 5278 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 5279 */
Anna Bridge 160:5571c4ff569f 5280 void arm_q7_to_float(
Anna Bridge 160:5571c4ff569f 5281 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 5282 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 5283 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 5284
Anna Bridge 160:5571c4ff569f 5285
Anna Bridge 160:5571c4ff569f 5286 /**
Anna Bridge 160:5571c4ff569f 5287 * @ingroup groupController
Anna Bridge 160:5571c4ff569f 5288 */
Anna Bridge 160:5571c4ff569f 5289
Anna Bridge 160:5571c4ff569f 5290 /**
Anna Bridge 160:5571c4ff569f 5291 * @defgroup inv_park Vector Inverse Park transform
Anna Bridge 160:5571c4ff569f 5292 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
Anna Bridge 160:5571c4ff569f 5293 *
Anna Bridge 160:5571c4ff569f 5294 * The function operates on a single sample of data and each call to the function returns the processed output.
Anna Bridge 160:5571c4ff569f 5295 * The library provides separate functions for Q31 and floating-point data types.
Anna Bridge 160:5571c4ff569f 5296 * \par Algorithm
Anna Bridge 160:5571c4ff569f 5297 * \image html parkInvFormula.gif
Anna Bridge 160:5571c4ff569f 5298 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
Anna Bridge 160:5571c4ff569f 5299 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
Anna Bridge 160:5571c4ff569f 5300 * cosine and sine values of theta (rotor flux position).
Anna Bridge 160:5571c4ff569f 5301 * \par Fixed-Point Behavior
Anna Bridge 160:5571c4ff569f 5302 * Care must be taken when using the Q31 version of the Park transform.
Anna Bridge 160:5571c4ff569f 5303 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
Anna Bridge 160:5571c4ff569f 5304 * Refer to the function specific documentation below for usage guidelines.
Anna Bridge 160:5571c4ff569f 5305 */
Anna Bridge 160:5571c4ff569f 5306
Anna Bridge 160:5571c4ff569f 5307 /**
Anna Bridge 160:5571c4ff569f 5308 * @addtogroup inv_park
Anna Bridge 160:5571c4ff569f 5309 * @{
Anna Bridge 160:5571c4ff569f 5310 */
Anna Bridge 160:5571c4ff569f 5311
Anna Bridge 160:5571c4ff569f 5312 /**
Anna Bridge 160:5571c4ff569f 5313 * @brief Floating-point Inverse Park transform
Anna Bridge 160:5571c4ff569f 5314 * @param[in] Id input coordinate of rotor reference frame d
Anna Bridge 160:5571c4ff569f 5315 * @param[in] Iq input coordinate of rotor reference frame q
Anna Bridge 160:5571c4ff569f 5316 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
Anna Bridge 160:5571c4ff569f 5317 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
Anna Bridge 160:5571c4ff569f 5318 * @param[in] sinVal sine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5319 * @param[in] cosVal cosine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5320 */
Anna Bridge 160:5571c4ff569f 5321 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_f32(
Anna Bridge 160:5571c4ff569f 5322 float32_t Id,
Anna Bridge 160:5571c4ff569f 5323 float32_t Iq,
Anna Bridge 160:5571c4ff569f 5324 float32_t * pIalpha,
Anna Bridge 160:5571c4ff569f 5325 float32_t * pIbeta,
Anna Bridge 160:5571c4ff569f 5326 float32_t sinVal,
Anna Bridge 160:5571c4ff569f 5327 float32_t cosVal)
Anna Bridge 160:5571c4ff569f 5328 {
Anna Bridge 160:5571c4ff569f 5329 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
Anna Bridge 160:5571c4ff569f 5330 *pIalpha = Id * cosVal - Iq * sinVal;
Anna Bridge 160:5571c4ff569f 5331
Anna Bridge 160:5571c4ff569f 5332 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
Anna Bridge 160:5571c4ff569f 5333 *pIbeta = Id * sinVal + Iq * cosVal;
Anna Bridge 160:5571c4ff569f 5334 }
Anna Bridge 160:5571c4ff569f 5335
Anna Bridge 160:5571c4ff569f 5336
Anna Bridge 160:5571c4ff569f 5337 /**
Anna Bridge 160:5571c4ff569f 5338 * @brief Inverse Park transform for Q31 version
Anna Bridge 160:5571c4ff569f 5339 * @param[in] Id input coordinate of rotor reference frame d
Anna Bridge 160:5571c4ff569f 5340 * @param[in] Iq input coordinate of rotor reference frame q
Anna Bridge 160:5571c4ff569f 5341 * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
Anna Bridge 160:5571c4ff569f 5342 * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
Anna Bridge 160:5571c4ff569f 5343 * @param[in] sinVal sine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5344 * @param[in] cosVal cosine value of rotation angle theta
Anna Bridge 160:5571c4ff569f 5345 *
Anna Bridge 160:5571c4ff569f 5346 * <b>Scaling and Overflow Behavior:</b>
Anna Bridge 160:5571c4ff569f 5347 * \par
Anna Bridge 160:5571c4ff569f 5348 * The function is implemented using an internal 32-bit accumulator.
Anna Bridge 160:5571c4ff569f 5349 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
Anna Bridge 160:5571c4ff569f 5350 * There is saturation on the addition, hence there is no risk of overflow.
Anna Bridge 160:5571c4ff569f 5351 */
Anna Bridge 160:5571c4ff569f 5352 CMSIS_INLINE __STATIC_INLINE void arm_inv_park_q31(
Anna Bridge 160:5571c4ff569f 5353 q31_t Id,
Anna Bridge 160:5571c4ff569f 5354 q31_t Iq,
Anna Bridge 160:5571c4ff569f 5355 q31_t * pIalpha,
Anna Bridge 160:5571c4ff569f 5356 q31_t * pIbeta,
Anna Bridge 160:5571c4ff569f 5357 q31_t sinVal,
Anna Bridge 160:5571c4ff569f 5358 q31_t cosVal)
Anna Bridge 160:5571c4ff569f 5359 {
Anna Bridge 160:5571c4ff569f 5360 q31_t product1, product2; /* Temporary variables used to store intermediate results */
Anna Bridge 160:5571c4ff569f 5361 q31_t product3, product4; /* Temporary variables used to store intermediate results */
Anna Bridge 160:5571c4ff569f 5362
Anna Bridge 160:5571c4ff569f 5363 /* Intermediate product is calculated by (Id * cosVal) */
Anna Bridge 160:5571c4ff569f 5364 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5365
Anna Bridge 160:5571c4ff569f 5366 /* Intermediate product is calculated by (Iq * sinVal) */
Anna Bridge 160:5571c4ff569f 5367 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5368
Anna Bridge 160:5571c4ff569f 5369
Anna Bridge 160:5571c4ff569f 5370 /* Intermediate product is calculated by (Id * sinVal) */
Anna Bridge 160:5571c4ff569f 5371 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5372
Anna Bridge 160:5571c4ff569f 5373 /* Intermediate product is calculated by (Iq * cosVal) */
Anna Bridge 160:5571c4ff569f 5374 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
Anna Bridge 160:5571c4ff569f 5375
Anna Bridge 160:5571c4ff569f 5376 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
Anna Bridge 160:5571c4ff569f 5377 *pIalpha = __QSUB(product1, product2);
Anna Bridge 160:5571c4ff569f 5378
Anna Bridge 160:5571c4ff569f 5379 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
Anna Bridge 160:5571c4ff569f 5380 *pIbeta = __QADD(product4, product3);
Anna Bridge 160:5571c4ff569f 5381 }
Anna Bridge 160:5571c4ff569f 5382
Anna Bridge 160:5571c4ff569f 5383 /**
Anna Bridge 160:5571c4ff569f 5384 * @} end of Inverse park group
Anna Bridge 160:5571c4ff569f 5385 */
Anna Bridge 160:5571c4ff569f 5386
Anna Bridge 160:5571c4ff569f 5387
Anna Bridge 160:5571c4ff569f 5388 /**
Anna Bridge 160:5571c4ff569f 5389 * @brief Converts the elements of the Q31 vector to floating-point vector.
Anna Bridge 160:5571c4ff569f 5390 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 5391 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 5392 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 5393 */
Anna Bridge 160:5571c4ff569f 5394 void arm_q31_to_float(
Anna Bridge 160:5571c4ff569f 5395 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 5396 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 5397 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 5398
Anna Bridge 160:5571c4ff569f 5399 /**
Anna Bridge 160:5571c4ff569f 5400 * @ingroup groupInterpolation
Anna Bridge 160:5571c4ff569f 5401 */
Anna Bridge 160:5571c4ff569f 5402
Anna Bridge 160:5571c4ff569f 5403 /**
Anna Bridge 160:5571c4ff569f 5404 * @defgroup LinearInterpolate Linear Interpolation
Anna Bridge 160:5571c4ff569f 5405 *
Anna Bridge 160:5571c4ff569f 5406 * Linear interpolation is a method of curve fitting using linear polynomials.
Anna Bridge 160:5571c4ff569f 5407 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
Anna Bridge 160:5571c4ff569f 5408 *
Anna Bridge 160:5571c4ff569f 5409 * \par
Anna Bridge 160:5571c4ff569f 5410 * \image html LinearInterp.gif "Linear interpolation"
Anna Bridge 160:5571c4ff569f 5411 *
Anna Bridge 160:5571c4ff569f 5412 * \par
Anna Bridge 160:5571c4ff569f 5413 * A Linear Interpolate function calculates an output value(y), for the input(x)
Anna Bridge 160:5571c4ff569f 5414 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
Anna Bridge 160:5571c4ff569f 5415 *
Anna Bridge 160:5571c4ff569f 5416 * \par Algorithm:
Anna Bridge 160:5571c4ff569f 5417 * <pre>
Anna Bridge 160:5571c4ff569f 5418 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
Anna Bridge 160:5571c4ff569f 5419 * where x0, x1 are nearest values of input x
Anna Bridge 160:5571c4ff569f 5420 * y0, y1 are nearest values to output y
Anna Bridge 160:5571c4ff569f 5421 * </pre>
Anna Bridge 160:5571c4ff569f 5422 *
Anna Bridge 160:5571c4ff569f 5423 * \par
Anna Bridge 160:5571c4ff569f 5424 * This set of functions implements Linear interpolation process
Anna Bridge 160:5571c4ff569f 5425 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
Anna Bridge 160:5571c4ff569f 5426 * sample of data and each call to the function returns a single processed value.
Anna Bridge 160:5571c4ff569f 5427 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
Anna Bridge 160:5571c4ff569f 5428 * <code>x</code> is the input sample value. The functions returns the output value.
Anna Bridge 160:5571c4ff569f 5429 *
Anna Bridge 160:5571c4ff569f 5430 * \par
Anna Bridge 160:5571c4ff569f 5431 * if x is outside of the table boundary, Linear interpolation returns first value of the table
Anna Bridge 160:5571c4ff569f 5432 * if x is below input range and returns last value of table if x is above range.
Anna Bridge 160:5571c4ff569f 5433 */
Anna Bridge 160:5571c4ff569f 5434
Anna Bridge 160:5571c4ff569f 5435 /**
Anna Bridge 160:5571c4ff569f 5436 * @addtogroup LinearInterpolate
Anna Bridge 160:5571c4ff569f 5437 * @{
Anna Bridge 160:5571c4ff569f 5438 */
Anna Bridge 160:5571c4ff569f 5439
Anna Bridge 160:5571c4ff569f 5440 /**
Anna Bridge 160:5571c4ff569f 5441 * @brief Process function for the floating-point Linear Interpolation Function.
Anna Bridge 160:5571c4ff569f 5442 * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
Anna Bridge 160:5571c4ff569f 5443 * @param[in] x input sample to process
Anna Bridge 160:5571c4ff569f 5444 * @return y processed output sample.
Anna Bridge 160:5571c4ff569f 5445 *
Anna Bridge 160:5571c4ff569f 5446 */
Anna Bridge 160:5571c4ff569f 5447 CMSIS_INLINE __STATIC_INLINE float32_t arm_linear_interp_f32(
Anna Bridge 160:5571c4ff569f 5448 arm_linear_interp_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 5449 float32_t x)
Anna Bridge 160:5571c4ff569f 5450 {
Anna Bridge 160:5571c4ff569f 5451 float32_t y;
Anna Bridge 160:5571c4ff569f 5452 float32_t x0, x1; /* Nearest input values */
Anna Bridge 160:5571c4ff569f 5453 float32_t y0, y1; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 5454 float32_t xSpacing = S->xSpacing; /* spacing between input values */
Anna Bridge 160:5571c4ff569f 5455 int32_t i; /* Index variable */
Anna Bridge 160:5571c4ff569f 5456 float32_t *pYData = S->pYData; /* pointer to output table */
Anna Bridge 160:5571c4ff569f 5457
Anna Bridge 160:5571c4ff569f 5458 /* Calculation of index */
Anna Bridge 160:5571c4ff569f 5459 i = (int32_t) ((x - S->x1) / xSpacing);
Anna Bridge 160:5571c4ff569f 5460
Anna Bridge 160:5571c4ff569f 5461 if (i < 0)
Anna Bridge 160:5571c4ff569f 5462 {
Anna Bridge 160:5571c4ff569f 5463 /* Iniatilize output for below specified range as least output value of table */
Anna Bridge 160:5571c4ff569f 5464 y = pYData[0];
Anna Bridge 160:5571c4ff569f 5465 }
Anna Bridge 160:5571c4ff569f 5466 else if ((uint32_t)i >= S->nValues)
Anna Bridge 160:5571c4ff569f 5467 {
Anna Bridge 160:5571c4ff569f 5468 /* Iniatilize output for above specified range as last output value of table */
Anna Bridge 160:5571c4ff569f 5469 y = pYData[S->nValues - 1];
Anna Bridge 160:5571c4ff569f 5470 }
Anna Bridge 160:5571c4ff569f 5471 else
Anna Bridge 160:5571c4ff569f 5472 {
Anna Bridge 160:5571c4ff569f 5473 /* Calculation of nearest input values */
Anna Bridge 160:5571c4ff569f 5474 x0 = S->x1 + i * xSpacing;
Anna Bridge 160:5571c4ff569f 5475 x1 = S->x1 + (i + 1) * xSpacing;
Anna Bridge 160:5571c4ff569f 5476
Anna Bridge 160:5571c4ff569f 5477 /* Read of nearest output values */
Anna Bridge 160:5571c4ff569f 5478 y0 = pYData[i];
Anna Bridge 160:5571c4ff569f 5479 y1 = pYData[i + 1];
Anna Bridge 160:5571c4ff569f 5480
Anna Bridge 160:5571c4ff569f 5481 /* Calculation of output */
Anna Bridge 160:5571c4ff569f 5482 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
Anna Bridge 160:5571c4ff569f 5483
Anna Bridge 160:5571c4ff569f 5484 }
Anna Bridge 160:5571c4ff569f 5485
Anna Bridge 160:5571c4ff569f 5486 /* returns output value */
Anna Bridge 160:5571c4ff569f 5487 return (y);
Anna Bridge 160:5571c4ff569f 5488 }
Anna Bridge 160:5571c4ff569f 5489
Anna Bridge 160:5571c4ff569f 5490
Anna Bridge 160:5571c4ff569f 5491 /**
Anna Bridge 160:5571c4ff569f 5492 *
Anna Bridge 160:5571c4ff569f 5493 * @brief Process function for the Q31 Linear Interpolation Function.
Anna Bridge 160:5571c4ff569f 5494 * @param[in] pYData pointer to Q31 Linear Interpolation table
Anna Bridge 160:5571c4ff569f 5495 * @param[in] x input sample to process
Anna Bridge 160:5571c4ff569f 5496 * @param[in] nValues number of table values
Anna Bridge 160:5571c4ff569f 5497 * @return y processed output sample.
Anna Bridge 160:5571c4ff569f 5498 *
Anna Bridge 160:5571c4ff569f 5499 * \par
Anna Bridge 160:5571c4ff569f 5500 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
Anna Bridge 160:5571c4ff569f 5501 * This function can support maximum of table size 2^12.
Anna Bridge 160:5571c4ff569f 5502 *
Anna Bridge 160:5571c4ff569f 5503 */
Anna Bridge 160:5571c4ff569f 5504 CMSIS_INLINE __STATIC_INLINE q31_t arm_linear_interp_q31(
Anna Bridge 160:5571c4ff569f 5505 q31_t * pYData,
Anna Bridge 160:5571c4ff569f 5506 q31_t x,
Anna Bridge 160:5571c4ff569f 5507 uint32_t nValues)
Anna Bridge 160:5571c4ff569f 5508 {
Anna Bridge 160:5571c4ff569f 5509 q31_t y; /* output */
Anna Bridge 160:5571c4ff569f 5510 q31_t y0, y1; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 5511 q31_t fract; /* fractional part */
Anna Bridge 160:5571c4ff569f 5512 int32_t index; /* Index to read nearest output values */
Anna Bridge 160:5571c4ff569f 5513
Anna Bridge 160:5571c4ff569f 5514 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 5515 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 5516 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 5517 index = ((x & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 5518
Anna Bridge 160:5571c4ff569f 5519 if (index >= (int32_t)(nValues - 1))
Anna Bridge 160:5571c4ff569f 5520 {
Anna Bridge 160:5571c4ff569f 5521 return (pYData[nValues - 1]);
Anna Bridge 160:5571c4ff569f 5522 }
Anna Bridge 160:5571c4ff569f 5523 else if (index < 0)
Anna Bridge 160:5571c4ff569f 5524 {
Anna Bridge 160:5571c4ff569f 5525 return (pYData[0]);
Anna Bridge 160:5571c4ff569f 5526 }
Anna Bridge 160:5571c4ff569f 5527 else
Anna Bridge 160:5571c4ff569f 5528 {
Anna Bridge 160:5571c4ff569f 5529 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 5530 /* shift left by 11 to keep fract in 1.31 format */
Anna Bridge 160:5571c4ff569f 5531 fract = (x & 0x000FFFFF) << 11;
Anna Bridge 160:5571c4ff569f 5532
Anna Bridge 160:5571c4ff569f 5533 /* Read two nearest output values from the index in 1.31(q31) format */
Anna Bridge 160:5571c4ff569f 5534 y0 = pYData[index];
Anna Bridge 160:5571c4ff569f 5535 y1 = pYData[index + 1];
Anna Bridge 160:5571c4ff569f 5536
Anna Bridge 160:5571c4ff569f 5537 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
Anna Bridge 160:5571c4ff569f 5538 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
Anna Bridge 160:5571c4ff569f 5539
Anna Bridge 160:5571c4ff569f 5540 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
Anna Bridge 160:5571c4ff569f 5541 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
Anna Bridge 160:5571c4ff569f 5542
Anna Bridge 160:5571c4ff569f 5543 /* Convert y to 1.31 format */
Anna Bridge 160:5571c4ff569f 5544 return (y << 1u);
Anna Bridge 160:5571c4ff569f 5545 }
Anna Bridge 160:5571c4ff569f 5546 }
Anna Bridge 160:5571c4ff569f 5547
Anna Bridge 160:5571c4ff569f 5548
Anna Bridge 160:5571c4ff569f 5549 /**
Anna Bridge 160:5571c4ff569f 5550 *
Anna Bridge 160:5571c4ff569f 5551 * @brief Process function for the Q15 Linear Interpolation Function.
Anna Bridge 160:5571c4ff569f 5552 * @param[in] pYData pointer to Q15 Linear Interpolation table
Anna Bridge 160:5571c4ff569f 5553 * @param[in] x input sample to process
Anna Bridge 160:5571c4ff569f 5554 * @param[in] nValues number of table values
Anna Bridge 160:5571c4ff569f 5555 * @return y processed output sample.
Anna Bridge 160:5571c4ff569f 5556 *
Anna Bridge 160:5571c4ff569f 5557 * \par
Anna Bridge 160:5571c4ff569f 5558 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
Anna Bridge 160:5571c4ff569f 5559 * This function can support maximum of table size 2^12.
Anna Bridge 160:5571c4ff569f 5560 *
Anna Bridge 160:5571c4ff569f 5561 */
Anna Bridge 160:5571c4ff569f 5562 CMSIS_INLINE __STATIC_INLINE q15_t arm_linear_interp_q15(
Anna Bridge 160:5571c4ff569f 5563 q15_t * pYData,
Anna Bridge 160:5571c4ff569f 5564 q31_t x,
Anna Bridge 160:5571c4ff569f 5565 uint32_t nValues)
Anna Bridge 160:5571c4ff569f 5566 {
Anna Bridge 160:5571c4ff569f 5567 q63_t y; /* output */
Anna Bridge 160:5571c4ff569f 5568 q15_t y0, y1; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 5569 q31_t fract; /* fractional part */
Anna Bridge 160:5571c4ff569f 5570 int32_t index; /* Index to read nearest output values */
Anna Bridge 160:5571c4ff569f 5571
Anna Bridge 160:5571c4ff569f 5572 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 5573 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 5574 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 5575 index = ((x & (int32_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 5576
Anna Bridge 160:5571c4ff569f 5577 if (index >= (int32_t)(nValues - 1))
Anna Bridge 160:5571c4ff569f 5578 {
Anna Bridge 160:5571c4ff569f 5579 return (pYData[nValues - 1]);
Anna Bridge 160:5571c4ff569f 5580 }
Anna Bridge 160:5571c4ff569f 5581 else if (index < 0)
Anna Bridge 160:5571c4ff569f 5582 {
Anna Bridge 160:5571c4ff569f 5583 return (pYData[0]);
Anna Bridge 160:5571c4ff569f 5584 }
Anna Bridge 160:5571c4ff569f 5585 else
Anna Bridge 160:5571c4ff569f 5586 {
Anna Bridge 160:5571c4ff569f 5587 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 5588 /* fract is in 12.20 format */
Anna Bridge 160:5571c4ff569f 5589 fract = (x & 0x000FFFFF);
Anna Bridge 160:5571c4ff569f 5590
Anna Bridge 160:5571c4ff569f 5591 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 5592 y0 = pYData[index];
Anna Bridge 160:5571c4ff569f 5593 y1 = pYData[index + 1];
Anna Bridge 160:5571c4ff569f 5594
Anna Bridge 160:5571c4ff569f 5595 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
Anna Bridge 160:5571c4ff569f 5596 y = ((q63_t) y0 * (0xFFFFF - fract));
Anna Bridge 160:5571c4ff569f 5597
Anna Bridge 160:5571c4ff569f 5598 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
Anna Bridge 160:5571c4ff569f 5599 y += ((q63_t) y1 * (fract));
Anna Bridge 160:5571c4ff569f 5600
Anna Bridge 160:5571c4ff569f 5601 /* convert y to 1.15 format */
Anna Bridge 160:5571c4ff569f 5602 return (q15_t) (y >> 20);
Anna Bridge 160:5571c4ff569f 5603 }
Anna Bridge 160:5571c4ff569f 5604 }
Anna Bridge 160:5571c4ff569f 5605
Anna Bridge 160:5571c4ff569f 5606
Anna Bridge 160:5571c4ff569f 5607 /**
Anna Bridge 160:5571c4ff569f 5608 *
Anna Bridge 160:5571c4ff569f 5609 * @brief Process function for the Q7 Linear Interpolation Function.
Anna Bridge 160:5571c4ff569f 5610 * @param[in] pYData pointer to Q7 Linear Interpolation table
Anna Bridge 160:5571c4ff569f 5611 * @param[in] x input sample to process
Anna Bridge 160:5571c4ff569f 5612 * @param[in] nValues number of table values
Anna Bridge 160:5571c4ff569f 5613 * @return y processed output sample.
Anna Bridge 160:5571c4ff569f 5614 *
Anna Bridge 160:5571c4ff569f 5615 * \par
Anna Bridge 160:5571c4ff569f 5616 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
Anna Bridge 160:5571c4ff569f 5617 * This function can support maximum of table size 2^12.
Anna Bridge 160:5571c4ff569f 5618 */
Anna Bridge 160:5571c4ff569f 5619 CMSIS_INLINE __STATIC_INLINE q7_t arm_linear_interp_q7(
Anna Bridge 160:5571c4ff569f 5620 q7_t * pYData,
Anna Bridge 160:5571c4ff569f 5621 q31_t x,
Anna Bridge 160:5571c4ff569f 5622 uint32_t nValues)
Anna Bridge 160:5571c4ff569f 5623 {
Anna Bridge 160:5571c4ff569f 5624 q31_t y; /* output */
Anna Bridge 160:5571c4ff569f 5625 q7_t y0, y1; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 5626 q31_t fract; /* fractional part */
Anna Bridge 160:5571c4ff569f 5627 uint32_t index; /* Index to read nearest output values */
Anna Bridge 160:5571c4ff569f 5628
Anna Bridge 160:5571c4ff569f 5629 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 5630 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 5631 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 5632 if (x < 0)
Anna Bridge 160:5571c4ff569f 5633 {
Anna Bridge 160:5571c4ff569f 5634 return (pYData[0]);
Anna Bridge 160:5571c4ff569f 5635 }
Anna Bridge 160:5571c4ff569f 5636 index = (x >> 20) & 0xfff;
Anna Bridge 160:5571c4ff569f 5637
Anna Bridge 160:5571c4ff569f 5638 if (index >= (nValues - 1))
Anna Bridge 160:5571c4ff569f 5639 {
Anna Bridge 160:5571c4ff569f 5640 return (pYData[nValues - 1]);
Anna Bridge 160:5571c4ff569f 5641 }
Anna Bridge 160:5571c4ff569f 5642 else
Anna Bridge 160:5571c4ff569f 5643 {
Anna Bridge 160:5571c4ff569f 5644 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 5645 /* fract is in 12.20 format */
Anna Bridge 160:5571c4ff569f 5646 fract = (x & 0x000FFFFF);
Anna Bridge 160:5571c4ff569f 5647
Anna Bridge 160:5571c4ff569f 5648 /* Read two nearest output values from the index and are in 1.7(q7) format */
Anna Bridge 160:5571c4ff569f 5649 y0 = pYData[index];
Anna Bridge 160:5571c4ff569f 5650 y1 = pYData[index + 1];
Anna Bridge 160:5571c4ff569f 5651
Anna Bridge 160:5571c4ff569f 5652 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
Anna Bridge 160:5571c4ff569f 5653 y = ((y0 * (0xFFFFF - fract)));
Anna Bridge 160:5571c4ff569f 5654
Anna Bridge 160:5571c4ff569f 5655 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
Anna Bridge 160:5571c4ff569f 5656 y += (y1 * fract);
Anna Bridge 160:5571c4ff569f 5657
Anna Bridge 160:5571c4ff569f 5658 /* convert y to 1.7(q7) format */
Anna Bridge 160:5571c4ff569f 5659 return (q7_t) (y >> 20);
Anna Bridge 160:5571c4ff569f 5660 }
Anna Bridge 160:5571c4ff569f 5661 }
Anna Bridge 160:5571c4ff569f 5662
Anna Bridge 160:5571c4ff569f 5663 /**
Anna Bridge 160:5571c4ff569f 5664 * @} end of LinearInterpolate group
Anna Bridge 160:5571c4ff569f 5665 */
Anna Bridge 160:5571c4ff569f 5666
Anna Bridge 160:5571c4ff569f 5667 /**
Anna Bridge 160:5571c4ff569f 5668 * @brief Fast approximation to the trigonometric sine function for floating-point data.
Anna Bridge 160:5571c4ff569f 5669 * @param[in] x input value in radians.
Anna Bridge 160:5571c4ff569f 5670 * @return sin(x).
Anna Bridge 160:5571c4ff569f 5671 */
Anna Bridge 160:5571c4ff569f 5672 float32_t arm_sin_f32(
Anna Bridge 160:5571c4ff569f 5673 float32_t x);
Anna Bridge 160:5571c4ff569f 5674
Anna Bridge 160:5571c4ff569f 5675
Anna Bridge 160:5571c4ff569f 5676 /**
Anna Bridge 160:5571c4ff569f 5677 * @brief Fast approximation to the trigonometric sine function for Q31 data.
Anna Bridge 160:5571c4ff569f 5678 * @param[in] x Scaled input value in radians.
Anna Bridge 160:5571c4ff569f 5679 * @return sin(x).
Anna Bridge 160:5571c4ff569f 5680 */
Anna Bridge 160:5571c4ff569f 5681 q31_t arm_sin_q31(
Anna Bridge 160:5571c4ff569f 5682 q31_t x);
Anna Bridge 160:5571c4ff569f 5683
Anna Bridge 160:5571c4ff569f 5684
Anna Bridge 160:5571c4ff569f 5685 /**
Anna Bridge 160:5571c4ff569f 5686 * @brief Fast approximation to the trigonometric sine function for Q15 data.
Anna Bridge 160:5571c4ff569f 5687 * @param[in] x Scaled input value in radians.
Anna Bridge 160:5571c4ff569f 5688 * @return sin(x).
Anna Bridge 160:5571c4ff569f 5689 */
Anna Bridge 160:5571c4ff569f 5690 q15_t arm_sin_q15(
Anna Bridge 160:5571c4ff569f 5691 q15_t x);
Anna Bridge 160:5571c4ff569f 5692
Anna Bridge 160:5571c4ff569f 5693
Anna Bridge 160:5571c4ff569f 5694 /**
Anna Bridge 160:5571c4ff569f 5695 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
Anna Bridge 160:5571c4ff569f 5696 * @param[in] x input value in radians.
Anna Bridge 160:5571c4ff569f 5697 * @return cos(x).
Anna Bridge 160:5571c4ff569f 5698 */
Anna Bridge 160:5571c4ff569f 5699 float32_t arm_cos_f32(
Anna Bridge 160:5571c4ff569f 5700 float32_t x);
Anna Bridge 160:5571c4ff569f 5701
Anna Bridge 160:5571c4ff569f 5702
Anna Bridge 160:5571c4ff569f 5703 /**
Anna Bridge 160:5571c4ff569f 5704 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
Anna Bridge 160:5571c4ff569f 5705 * @param[in] x Scaled input value in radians.
Anna Bridge 160:5571c4ff569f 5706 * @return cos(x).
Anna Bridge 160:5571c4ff569f 5707 */
Anna Bridge 160:5571c4ff569f 5708 q31_t arm_cos_q31(
Anna Bridge 160:5571c4ff569f 5709 q31_t x);
Anna Bridge 160:5571c4ff569f 5710
Anna Bridge 160:5571c4ff569f 5711
Anna Bridge 160:5571c4ff569f 5712 /**
Anna Bridge 160:5571c4ff569f 5713 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
Anna Bridge 160:5571c4ff569f 5714 * @param[in] x Scaled input value in radians.
Anna Bridge 160:5571c4ff569f 5715 * @return cos(x).
Anna Bridge 160:5571c4ff569f 5716 */
Anna Bridge 160:5571c4ff569f 5717 q15_t arm_cos_q15(
Anna Bridge 160:5571c4ff569f 5718 q15_t x);
Anna Bridge 160:5571c4ff569f 5719
Anna Bridge 160:5571c4ff569f 5720
Anna Bridge 160:5571c4ff569f 5721 /**
Anna Bridge 160:5571c4ff569f 5722 * @ingroup groupFastMath
Anna Bridge 160:5571c4ff569f 5723 */
Anna Bridge 160:5571c4ff569f 5724
Anna Bridge 160:5571c4ff569f 5725
Anna Bridge 160:5571c4ff569f 5726 /**
Anna Bridge 160:5571c4ff569f 5727 * @defgroup SQRT Square Root
Anna Bridge 160:5571c4ff569f 5728 *
Anna Bridge 160:5571c4ff569f 5729 * Computes the square root of a number.
Anna Bridge 160:5571c4ff569f 5730 * There are separate functions for Q15, Q31, and floating-point data types.
Anna Bridge 160:5571c4ff569f 5731 * The square root function is computed using the Newton-Raphson algorithm.
Anna Bridge 160:5571c4ff569f 5732 * This is an iterative algorithm of the form:
Anna Bridge 160:5571c4ff569f 5733 * <pre>
Anna Bridge 160:5571c4ff569f 5734 * x1 = x0 - f(x0)/f'(x0)
Anna Bridge 160:5571c4ff569f 5735 * </pre>
Anna Bridge 160:5571c4ff569f 5736 * where <code>x1</code> is the current estimate,
Anna Bridge 160:5571c4ff569f 5737 * <code>x0</code> is the previous estimate, and
Anna Bridge 160:5571c4ff569f 5738 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
Anna Bridge 160:5571c4ff569f 5739 * For the square root function, the algorithm reduces to:
Anna Bridge 160:5571c4ff569f 5740 * <pre>
Anna Bridge 160:5571c4ff569f 5741 * x0 = in/2 [initial guess]
Anna Bridge 160:5571c4ff569f 5742 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
Anna Bridge 160:5571c4ff569f 5743 * </pre>
Anna Bridge 160:5571c4ff569f 5744 */
Anna Bridge 160:5571c4ff569f 5745
Anna Bridge 160:5571c4ff569f 5746
Anna Bridge 160:5571c4ff569f 5747 /**
Anna Bridge 160:5571c4ff569f 5748 * @addtogroup SQRT
Anna Bridge 160:5571c4ff569f 5749 * @{
Anna Bridge 160:5571c4ff569f 5750 */
Anna Bridge 160:5571c4ff569f 5751
Anna Bridge 160:5571c4ff569f 5752 /**
Anna Bridge 160:5571c4ff569f 5753 * @brief Floating-point square root function.
Anna Bridge 160:5571c4ff569f 5754 * @param[in] in input value.
Anna Bridge 160:5571c4ff569f 5755 * @param[out] pOut square root of input value.
Anna Bridge 160:5571c4ff569f 5756 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
Anna Bridge 160:5571c4ff569f 5757 * <code>in</code> is negative value and returns zero output for negative values.
Anna Bridge 160:5571c4ff569f 5758 */
Anna Bridge 160:5571c4ff569f 5759 CMSIS_INLINE __STATIC_INLINE arm_status arm_sqrt_f32(
Anna Bridge 160:5571c4ff569f 5760 float32_t in,
Anna Bridge 160:5571c4ff569f 5761 float32_t * pOut)
Anna Bridge 160:5571c4ff569f 5762 {
Anna Bridge 160:5571c4ff569f 5763 if (in >= 0.0f)
Anna Bridge 160:5571c4ff569f 5764 {
Anna Bridge 160:5571c4ff569f 5765
Anna Bridge 160:5571c4ff569f 5766 #if (__FPU_USED == 1) && defined ( __CC_ARM )
Anna Bridge 160:5571c4ff569f 5767 *pOut = __sqrtf(in);
Anna Bridge 160:5571c4ff569f 5768 #elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
Anna Bridge 160:5571c4ff569f 5769 *pOut = __builtin_sqrtf(in);
Anna Bridge 160:5571c4ff569f 5770 #elif (__FPU_USED == 1) && defined(__GNUC__)
Anna Bridge 160:5571c4ff569f 5771 *pOut = __builtin_sqrtf(in);
Anna Bridge 160:5571c4ff569f 5772 #elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
Anna Bridge 160:5571c4ff569f 5773 __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
Anna Bridge 160:5571c4ff569f 5774 #else
Anna Bridge 160:5571c4ff569f 5775 *pOut = sqrtf(in);
Anna Bridge 160:5571c4ff569f 5776 #endif
Anna Bridge 160:5571c4ff569f 5777
Anna Bridge 160:5571c4ff569f 5778 return (ARM_MATH_SUCCESS);
Anna Bridge 160:5571c4ff569f 5779 }
Anna Bridge 160:5571c4ff569f 5780 else
Anna Bridge 160:5571c4ff569f 5781 {
Anna Bridge 160:5571c4ff569f 5782 *pOut = 0.0f;
Anna Bridge 160:5571c4ff569f 5783 return (ARM_MATH_ARGUMENT_ERROR);
Anna Bridge 160:5571c4ff569f 5784 }
Anna Bridge 160:5571c4ff569f 5785 }
Anna Bridge 160:5571c4ff569f 5786
Anna Bridge 160:5571c4ff569f 5787
Anna Bridge 160:5571c4ff569f 5788 /**
Anna Bridge 160:5571c4ff569f 5789 * @brief Q31 square root function.
Anna Bridge 160:5571c4ff569f 5790 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
Anna Bridge 160:5571c4ff569f 5791 * @param[out] pOut square root of input value.
Anna Bridge 160:5571c4ff569f 5792 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
Anna Bridge 160:5571c4ff569f 5793 * <code>in</code> is negative value and returns zero output for negative values.
Anna Bridge 160:5571c4ff569f 5794 */
Anna Bridge 160:5571c4ff569f 5795 arm_status arm_sqrt_q31(
Anna Bridge 160:5571c4ff569f 5796 q31_t in,
Anna Bridge 160:5571c4ff569f 5797 q31_t * pOut);
Anna Bridge 160:5571c4ff569f 5798
Anna Bridge 160:5571c4ff569f 5799
Anna Bridge 160:5571c4ff569f 5800 /**
Anna Bridge 160:5571c4ff569f 5801 * @brief Q15 square root function.
Anna Bridge 160:5571c4ff569f 5802 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
Anna Bridge 160:5571c4ff569f 5803 * @param[out] pOut square root of input value.
Anna Bridge 160:5571c4ff569f 5804 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
Anna Bridge 160:5571c4ff569f 5805 * <code>in</code> is negative value and returns zero output for negative values.
Anna Bridge 160:5571c4ff569f 5806 */
Anna Bridge 160:5571c4ff569f 5807 arm_status arm_sqrt_q15(
Anna Bridge 160:5571c4ff569f 5808 q15_t in,
Anna Bridge 160:5571c4ff569f 5809 q15_t * pOut);
Anna Bridge 160:5571c4ff569f 5810
Anna Bridge 160:5571c4ff569f 5811 /**
Anna Bridge 160:5571c4ff569f 5812 * @} end of SQRT group
Anna Bridge 160:5571c4ff569f 5813 */
Anna Bridge 160:5571c4ff569f 5814
Anna Bridge 160:5571c4ff569f 5815
Anna Bridge 160:5571c4ff569f 5816 /**
Anna Bridge 160:5571c4ff569f 5817 * @brief floating-point Circular write function.
Anna Bridge 160:5571c4ff569f 5818 */
Anna Bridge 160:5571c4ff569f 5819 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_f32(
Anna Bridge 160:5571c4ff569f 5820 int32_t * circBuffer,
Anna Bridge 160:5571c4ff569f 5821 int32_t L,
Anna Bridge 160:5571c4ff569f 5822 uint16_t * writeOffset,
Anna Bridge 160:5571c4ff569f 5823 int32_t bufferInc,
Anna Bridge 160:5571c4ff569f 5824 const int32_t * src,
Anna Bridge 160:5571c4ff569f 5825 int32_t srcInc,
Anna Bridge 160:5571c4ff569f 5826 uint32_t blockSize)
Anna Bridge 160:5571c4ff569f 5827 {
Anna Bridge 160:5571c4ff569f 5828 uint32_t i = 0u;
Anna Bridge 160:5571c4ff569f 5829 int32_t wOffset;
Anna Bridge 160:5571c4ff569f 5830
Anna Bridge 160:5571c4ff569f 5831 /* Copy the value of Index pointer that points
Anna Bridge 160:5571c4ff569f 5832 * to the current location where the input samples to be copied */
Anna Bridge 160:5571c4ff569f 5833 wOffset = *writeOffset;
Anna Bridge 160:5571c4ff569f 5834
Anna Bridge 160:5571c4ff569f 5835 /* Loop over the blockSize */
Anna Bridge 160:5571c4ff569f 5836 i = blockSize;
Anna Bridge 160:5571c4ff569f 5837
Anna Bridge 160:5571c4ff569f 5838 while (i > 0u)
Anna Bridge 160:5571c4ff569f 5839 {
Anna Bridge 160:5571c4ff569f 5840 /* copy the input sample to the circular buffer */
Anna Bridge 160:5571c4ff569f 5841 circBuffer[wOffset] = *src;
Anna Bridge 160:5571c4ff569f 5842
Anna Bridge 160:5571c4ff569f 5843 /* Update the input pointer */
Anna Bridge 160:5571c4ff569f 5844 src += srcInc;
Anna Bridge 160:5571c4ff569f 5845
Anna Bridge 160:5571c4ff569f 5846 /* Circularly update wOffset. Watch out for positive and negative value */
Anna Bridge 160:5571c4ff569f 5847 wOffset += bufferInc;
Anna Bridge 160:5571c4ff569f 5848 if (wOffset >= L)
Anna Bridge 160:5571c4ff569f 5849 wOffset -= L;
Anna Bridge 160:5571c4ff569f 5850
Anna Bridge 160:5571c4ff569f 5851 /* Decrement the loop counter */
Anna Bridge 160:5571c4ff569f 5852 i--;
Anna Bridge 160:5571c4ff569f 5853 }
Anna Bridge 160:5571c4ff569f 5854
Anna Bridge 160:5571c4ff569f 5855 /* Update the index pointer */
Anna Bridge 160:5571c4ff569f 5856 *writeOffset = (uint16_t)wOffset;
Anna Bridge 160:5571c4ff569f 5857 }
Anna Bridge 160:5571c4ff569f 5858
Anna Bridge 160:5571c4ff569f 5859
Anna Bridge 160:5571c4ff569f 5860
Anna Bridge 160:5571c4ff569f 5861 /**
Anna Bridge 160:5571c4ff569f 5862 * @brief floating-point Circular Read function.
Anna Bridge 160:5571c4ff569f 5863 */
Anna Bridge 160:5571c4ff569f 5864 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_f32(
Anna Bridge 160:5571c4ff569f 5865 int32_t * circBuffer,
Anna Bridge 160:5571c4ff569f 5866 int32_t L,
Anna Bridge 160:5571c4ff569f 5867 int32_t * readOffset,
Anna Bridge 160:5571c4ff569f 5868 int32_t bufferInc,
Anna Bridge 160:5571c4ff569f 5869 int32_t * dst,
Anna Bridge 160:5571c4ff569f 5870 int32_t * dst_base,
Anna Bridge 160:5571c4ff569f 5871 int32_t dst_length,
Anna Bridge 160:5571c4ff569f 5872 int32_t dstInc,
Anna Bridge 160:5571c4ff569f 5873 uint32_t blockSize)
Anna Bridge 160:5571c4ff569f 5874 {
Anna Bridge 160:5571c4ff569f 5875 uint32_t i = 0u;
Anna Bridge 160:5571c4ff569f 5876 int32_t rOffset, dst_end;
Anna Bridge 160:5571c4ff569f 5877
Anna Bridge 160:5571c4ff569f 5878 /* Copy the value of Index pointer that points
Anna Bridge 160:5571c4ff569f 5879 * to the current location from where the input samples to be read */
Anna Bridge 160:5571c4ff569f 5880 rOffset = *readOffset;
Anna Bridge 160:5571c4ff569f 5881 dst_end = (int32_t) (dst_base + dst_length);
Anna Bridge 160:5571c4ff569f 5882
Anna Bridge 160:5571c4ff569f 5883 /* Loop over the blockSize */
Anna Bridge 160:5571c4ff569f 5884 i = blockSize;
Anna Bridge 160:5571c4ff569f 5885
Anna Bridge 160:5571c4ff569f 5886 while (i > 0u)
Anna Bridge 160:5571c4ff569f 5887 {
Anna Bridge 160:5571c4ff569f 5888 /* copy the sample from the circular buffer to the destination buffer */
Anna Bridge 160:5571c4ff569f 5889 *dst = circBuffer[rOffset];
Anna Bridge 160:5571c4ff569f 5890
Anna Bridge 160:5571c4ff569f 5891 /* Update the input pointer */
Anna Bridge 160:5571c4ff569f 5892 dst += dstInc;
Anna Bridge 160:5571c4ff569f 5893
Anna Bridge 160:5571c4ff569f 5894 if (dst == (int32_t *) dst_end)
Anna Bridge 160:5571c4ff569f 5895 {
Anna Bridge 160:5571c4ff569f 5896 dst = dst_base;
Anna Bridge 160:5571c4ff569f 5897 }
Anna Bridge 160:5571c4ff569f 5898
Anna Bridge 160:5571c4ff569f 5899 /* Circularly update rOffset. Watch out for positive and negative value */
Anna Bridge 160:5571c4ff569f 5900 rOffset += bufferInc;
Anna Bridge 160:5571c4ff569f 5901
Anna Bridge 160:5571c4ff569f 5902 if (rOffset >= L)
Anna Bridge 160:5571c4ff569f 5903 {
Anna Bridge 160:5571c4ff569f 5904 rOffset -= L;
Anna Bridge 160:5571c4ff569f 5905 }
Anna Bridge 160:5571c4ff569f 5906
Anna Bridge 160:5571c4ff569f 5907 /* Decrement the loop counter */
Anna Bridge 160:5571c4ff569f 5908 i--;
Anna Bridge 160:5571c4ff569f 5909 }
Anna Bridge 160:5571c4ff569f 5910
Anna Bridge 160:5571c4ff569f 5911 /* Update the index pointer */
Anna Bridge 160:5571c4ff569f 5912 *readOffset = rOffset;
Anna Bridge 160:5571c4ff569f 5913 }
Anna Bridge 160:5571c4ff569f 5914
Anna Bridge 160:5571c4ff569f 5915
Anna Bridge 160:5571c4ff569f 5916 /**
Anna Bridge 160:5571c4ff569f 5917 * @brief Q15 Circular write function.
Anna Bridge 160:5571c4ff569f 5918 */
Anna Bridge 160:5571c4ff569f 5919 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q15(
Anna Bridge 160:5571c4ff569f 5920 q15_t * circBuffer,
Anna Bridge 160:5571c4ff569f 5921 int32_t L,
Anna Bridge 160:5571c4ff569f 5922 uint16_t * writeOffset,
Anna Bridge 160:5571c4ff569f 5923 int32_t bufferInc,
Anna Bridge 160:5571c4ff569f 5924 const q15_t * src,
Anna Bridge 160:5571c4ff569f 5925 int32_t srcInc,
Anna Bridge 160:5571c4ff569f 5926 uint32_t blockSize)
Anna Bridge 160:5571c4ff569f 5927 {
Anna Bridge 160:5571c4ff569f 5928 uint32_t i = 0u;
Anna Bridge 160:5571c4ff569f 5929 int32_t wOffset;
Anna Bridge 160:5571c4ff569f 5930
Anna Bridge 160:5571c4ff569f 5931 /* Copy the value of Index pointer that points
Anna Bridge 160:5571c4ff569f 5932 * to the current location where the input samples to be copied */
Anna Bridge 160:5571c4ff569f 5933 wOffset = *writeOffset;
Anna Bridge 160:5571c4ff569f 5934
Anna Bridge 160:5571c4ff569f 5935 /* Loop over the blockSize */
Anna Bridge 160:5571c4ff569f 5936 i = blockSize;
Anna Bridge 160:5571c4ff569f 5937
Anna Bridge 160:5571c4ff569f 5938 while (i > 0u)
Anna Bridge 160:5571c4ff569f 5939 {
Anna Bridge 160:5571c4ff569f 5940 /* copy the input sample to the circular buffer */
Anna Bridge 160:5571c4ff569f 5941 circBuffer[wOffset] = *src;
Anna Bridge 160:5571c4ff569f 5942
Anna Bridge 160:5571c4ff569f 5943 /* Update the input pointer */
Anna Bridge 160:5571c4ff569f 5944 src += srcInc;
Anna Bridge 160:5571c4ff569f 5945
Anna Bridge 160:5571c4ff569f 5946 /* Circularly update wOffset. Watch out for positive and negative value */
Anna Bridge 160:5571c4ff569f 5947 wOffset += bufferInc;
Anna Bridge 160:5571c4ff569f 5948 if (wOffset >= L)
Anna Bridge 160:5571c4ff569f 5949 wOffset -= L;
Anna Bridge 160:5571c4ff569f 5950
Anna Bridge 160:5571c4ff569f 5951 /* Decrement the loop counter */
Anna Bridge 160:5571c4ff569f 5952 i--;
Anna Bridge 160:5571c4ff569f 5953 }
Anna Bridge 160:5571c4ff569f 5954
Anna Bridge 160:5571c4ff569f 5955 /* Update the index pointer */
Anna Bridge 160:5571c4ff569f 5956 *writeOffset = (uint16_t)wOffset;
Anna Bridge 160:5571c4ff569f 5957 }
Anna Bridge 160:5571c4ff569f 5958
Anna Bridge 160:5571c4ff569f 5959
Anna Bridge 160:5571c4ff569f 5960 /**
Anna Bridge 160:5571c4ff569f 5961 * @brief Q15 Circular Read function.
Anna Bridge 160:5571c4ff569f 5962 */
Anna Bridge 160:5571c4ff569f 5963 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q15(
Anna Bridge 160:5571c4ff569f 5964 q15_t * circBuffer,
Anna Bridge 160:5571c4ff569f 5965 int32_t L,
Anna Bridge 160:5571c4ff569f 5966 int32_t * readOffset,
Anna Bridge 160:5571c4ff569f 5967 int32_t bufferInc,
Anna Bridge 160:5571c4ff569f 5968 q15_t * dst,
Anna Bridge 160:5571c4ff569f 5969 q15_t * dst_base,
Anna Bridge 160:5571c4ff569f 5970 int32_t dst_length,
Anna Bridge 160:5571c4ff569f 5971 int32_t dstInc,
Anna Bridge 160:5571c4ff569f 5972 uint32_t blockSize)
Anna Bridge 160:5571c4ff569f 5973 {
Anna Bridge 160:5571c4ff569f 5974 uint32_t i = 0;
Anna Bridge 160:5571c4ff569f 5975 int32_t rOffset, dst_end;
Anna Bridge 160:5571c4ff569f 5976
Anna Bridge 160:5571c4ff569f 5977 /* Copy the value of Index pointer that points
Anna Bridge 160:5571c4ff569f 5978 * to the current location from where the input samples to be read */
Anna Bridge 160:5571c4ff569f 5979 rOffset = *readOffset;
Anna Bridge 160:5571c4ff569f 5980
Anna Bridge 160:5571c4ff569f 5981 dst_end = (int32_t) (dst_base + dst_length);
Anna Bridge 160:5571c4ff569f 5982
Anna Bridge 160:5571c4ff569f 5983 /* Loop over the blockSize */
Anna Bridge 160:5571c4ff569f 5984 i = blockSize;
Anna Bridge 160:5571c4ff569f 5985
Anna Bridge 160:5571c4ff569f 5986 while (i > 0u)
Anna Bridge 160:5571c4ff569f 5987 {
Anna Bridge 160:5571c4ff569f 5988 /* copy the sample from the circular buffer to the destination buffer */
Anna Bridge 160:5571c4ff569f 5989 *dst = circBuffer[rOffset];
Anna Bridge 160:5571c4ff569f 5990
Anna Bridge 160:5571c4ff569f 5991 /* Update the input pointer */
Anna Bridge 160:5571c4ff569f 5992 dst += dstInc;
Anna Bridge 160:5571c4ff569f 5993
Anna Bridge 160:5571c4ff569f 5994 if (dst == (q15_t *) dst_end)
Anna Bridge 160:5571c4ff569f 5995 {
Anna Bridge 160:5571c4ff569f 5996 dst = dst_base;
Anna Bridge 160:5571c4ff569f 5997 }
Anna Bridge 160:5571c4ff569f 5998
Anna Bridge 160:5571c4ff569f 5999 /* Circularly update wOffset. Watch out for positive and negative value */
Anna Bridge 160:5571c4ff569f 6000 rOffset += bufferInc;
Anna Bridge 160:5571c4ff569f 6001
Anna Bridge 160:5571c4ff569f 6002 if (rOffset >= L)
Anna Bridge 160:5571c4ff569f 6003 {
Anna Bridge 160:5571c4ff569f 6004 rOffset -= L;
Anna Bridge 160:5571c4ff569f 6005 }
Anna Bridge 160:5571c4ff569f 6006
Anna Bridge 160:5571c4ff569f 6007 /* Decrement the loop counter */
Anna Bridge 160:5571c4ff569f 6008 i--;
Anna Bridge 160:5571c4ff569f 6009 }
Anna Bridge 160:5571c4ff569f 6010
Anna Bridge 160:5571c4ff569f 6011 /* Update the index pointer */
Anna Bridge 160:5571c4ff569f 6012 *readOffset = rOffset;
Anna Bridge 160:5571c4ff569f 6013 }
Anna Bridge 160:5571c4ff569f 6014
Anna Bridge 160:5571c4ff569f 6015
Anna Bridge 160:5571c4ff569f 6016 /**
Anna Bridge 160:5571c4ff569f 6017 * @brief Q7 Circular write function.
Anna Bridge 160:5571c4ff569f 6018 */
Anna Bridge 160:5571c4ff569f 6019 CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q7(
Anna Bridge 160:5571c4ff569f 6020 q7_t * circBuffer,
Anna Bridge 160:5571c4ff569f 6021 int32_t L,
Anna Bridge 160:5571c4ff569f 6022 uint16_t * writeOffset,
Anna Bridge 160:5571c4ff569f 6023 int32_t bufferInc,
Anna Bridge 160:5571c4ff569f 6024 const q7_t * src,
Anna Bridge 160:5571c4ff569f 6025 int32_t srcInc,
Anna Bridge 160:5571c4ff569f 6026 uint32_t blockSize)
Anna Bridge 160:5571c4ff569f 6027 {
Anna Bridge 160:5571c4ff569f 6028 uint32_t i = 0u;
Anna Bridge 160:5571c4ff569f 6029 int32_t wOffset;
Anna Bridge 160:5571c4ff569f 6030
Anna Bridge 160:5571c4ff569f 6031 /* Copy the value of Index pointer that points
Anna Bridge 160:5571c4ff569f 6032 * to the current location where the input samples to be copied */
Anna Bridge 160:5571c4ff569f 6033 wOffset = *writeOffset;
Anna Bridge 160:5571c4ff569f 6034
Anna Bridge 160:5571c4ff569f 6035 /* Loop over the blockSize */
Anna Bridge 160:5571c4ff569f 6036 i = blockSize;
Anna Bridge 160:5571c4ff569f 6037
Anna Bridge 160:5571c4ff569f 6038 while (i > 0u)
Anna Bridge 160:5571c4ff569f 6039 {
Anna Bridge 160:5571c4ff569f 6040 /* copy the input sample to the circular buffer */
Anna Bridge 160:5571c4ff569f 6041 circBuffer[wOffset] = *src;
Anna Bridge 160:5571c4ff569f 6042
Anna Bridge 160:5571c4ff569f 6043 /* Update the input pointer */
Anna Bridge 160:5571c4ff569f 6044 src += srcInc;
Anna Bridge 160:5571c4ff569f 6045
Anna Bridge 160:5571c4ff569f 6046 /* Circularly update wOffset. Watch out for positive and negative value */
Anna Bridge 160:5571c4ff569f 6047 wOffset += bufferInc;
Anna Bridge 160:5571c4ff569f 6048 if (wOffset >= L)
Anna Bridge 160:5571c4ff569f 6049 wOffset -= L;
Anna Bridge 160:5571c4ff569f 6050
Anna Bridge 160:5571c4ff569f 6051 /* Decrement the loop counter */
Anna Bridge 160:5571c4ff569f 6052 i--;
Anna Bridge 160:5571c4ff569f 6053 }
Anna Bridge 160:5571c4ff569f 6054
Anna Bridge 160:5571c4ff569f 6055 /* Update the index pointer */
Anna Bridge 160:5571c4ff569f 6056 *writeOffset = (uint16_t)wOffset;
Anna Bridge 160:5571c4ff569f 6057 }
Anna Bridge 160:5571c4ff569f 6058
Anna Bridge 160:5571c4ff569f 6059
Anna Bridge 160:5571c4ff569f 6060 /**
Anna Bridge 160:5571c4ff569f 6061 * @brief Q7 Circular Read function.
Anna Bridge 160:5571c4ff569f 6062 */
Anna Bridge 160:5571c4ff569f 6063 CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q7(
Anna Bridge 160:5571c4ff569f 6064 q7_t * circBuffer,
Anna Bridge 160:5571c4ff569f 6065 int32_t L,
Anna Bridge 160:5571c4ff569f 6066 int32_t * readOffset,
Anna Bridge 160:5571c4ff569f 6067 int32_t bufferInc,
Anna Bridge 160:5571c4ff569f 6068 q7_t * dst,
Anna Bridge 160:5571c4ff569f 6069 q7_t * dst_base,
Anna Bridge 160:5571c4ff569f 6070 int32_t dst_length,
Anna Bridge 160:5571c4ff569f 6071 int32_t dstInc,
Anna Bridge 160:5571c4ff569f 6072 uint32_t blockSize)
Anna Bridge 160:5571c4ff569f 6073 {
Anna Bridge 160:5571c4ff569f 6074 uint32_t i = 0;
Anna Bridge 160:5571c4ff569f 6075 int32_t rOffset, dst_end;
Anna Bridge 160:5571c4ff569f 6076
Anna Bridge 160:5571c4ff569f 6077 /* Copy the value of Index pointer that points
Anna Bridge 160:5571c4ff569f 6078 * to the current location from where the input samples to be read */
Anna Bridge 160:5571c4ff569f 6079 rOffset = *readOffset;
Anna Bridge 160:5571c4ff569f 6080
Anna Bridge 160:5571c4ff569f 6081 dst_end = (int32_t) (dst_base + dst_length);
Anna Bridge 160:5571c4ff569f 6082
Anna Bridge 160:5571c4ff569f 6083 /* Loop over the blockSize */
Anna Bridge 160:5571c4ff569f 6084 i = blockSize;
Anna Bridge 160:5571c4ff569f 6085
Anna Bridge 160:5571c4ff569f 6086 while (i > 0u)
Anna Bridge 160:5571c4ff569f 6087 {
Anna Bridge 160:5571c4ff569f 6088 /* copy the sample from the circular buffer to the destination buffer */
Anna Bridge 160:5571c4ff569f 6089 *dst = circBuffer[rOffset];
Anna Bridge 160:5571c4ff569f 6090
Anna Bridge 160:5571c4ff569f 6091 /* Update the input pointer */
Anna Bridge 160:5571c4ff569f 6092 dst += dstInc;
Anna Bridge 160:5571c4ff569f 6093
Anna Bridge 160:5571c4ff569f 6094 if (dst == (q7_t *) dst_end)
Anna Bridge 160:5571c4ff569f 6095 {
Anna Bridge 160:5571c4ff569f 6096 dst = dst_base;
Anna Bridge 160:5571c4ff569f 6097 }
Anna Bridge 160:5571c4ff569f 6098
Anna Bridge 160:5571c4ff569f 6099 /* Circularly update rOffset. Watch out for positive and negative value */
Anna Bridge 160:5571c4ff569f 6100 rOffset += bufferInc;
Anna Bridge 160:5571c4ff569f 6101
Anna Bridge 160:5571c4ff569f 6102 if (rOffset >= L)
Anna Bridge 160:5571c4ff569f 6103 {
Anna Bridge 160:5571c4ff569f 6104 rOffset -= L;
Anna Bridge 160:5571c4ff569f 6105 }
Anna Bridge 160:5571c4ff569f 6106
Anna Bridge 160:5571c4ff569f 6107 /* Decrement the loop counter */
Anna Bridge 160:5571c4ff569f 6108 i--;
Anna Bridge 160:5571c4ff569f 6109 }
Anna Bridge 160:5571c4ff569f 6110
Anna Bridge 160:5571c4ff569f 6111 /* Update the index pointer */
Anna Bridge 160:5571c4ff569f 6112 *readOffset = rOffset;
Anna Bridge 160:5571c4ff569f 6113 }
Anna Bridge 160:5571c4ff569f 6114
Anna Bridge 160:5571c4ff569f 6115
Anna Bridge 160:5571c4ff569f 6116 /**
Anna Bridge 160:5571c4ff569f 6117 * @brief Sum of the squares of the elements of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6118 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6119 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6120 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6121 */
Anna Bridge 160:5571c4ff569f 6122 void arm_power_q31(
Anna Bridge 160:5571c4ff569f 6123 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6124 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6125 q63_t * pResult);
Anna Bridge 160:5571c4ff569f 6126
Anna Bridge 160:5571c4ff569f 6127
Anna Bridge 160:5571c4ff569f 6128 /**
Anna Bridge 160:5571c4ff569f 6129 * @brief Sum of the squares of the elements of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6130 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6131 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6132 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6133 */
Anna Bridge 160:5571c4ff569f 6134 void arm_power_f32(
Anna Bridge 160:5571c4ff569f 6135 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6136 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6137 float32_t * pResult);
Anna Bridge 160:5571c4ff569f 6138
Anna Bridge 160:5571c4ff569f 6139
Anna Bridge 160:5571c4ff569f 6140 /**
Anna Bridge 160:5571c4ff569f 6141 * @brief Sum of the squares of the elements of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6142 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6143 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6144 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6145 */
Anna Bridge 160:5571c4ff569f 6146 void arm_power_q15(
Anna Bridge 160:5571c4ff569f 6147 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6148 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6149 q63_t * pResult);
Anna Bridge 160:5571c4ff569f 6150
Anna Bridge 160:5571c4ff569f 6151
Anna Bridge 160:5571c4ff569f 6152 /**
Anna Bridge 160:5571c4ff569f 6153 * @brief Sum of the squares of the elements of a Q7 vector.
Anna Bridge 160:5571c4ff569f 6154 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6155 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6156 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6157 */
Anna Bridge 160:5571c4ff569f 6158 void arm_power_q7(
Anna Bridge 160:5571c4ff569f 6159 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 6160 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6161 q31_t * pResult);
Anna Bridge 160:5571c4ff569f 6162
Anna Bridge 160:5571c4ff569f 6163
Anna Bridge 160:5571c4ff569f 6164 /**
Anna Bridge 160:5571c4ff569f 6165 * @brief Mean value of a Q7 vector.
Anna Bridge 160:5571c4ff569f 6166 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6167 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6168 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6169 */
Anna Bridge 160:5571c4ff569f 6170 void arm_mean_q7(
Anna Bridge 160:5571c4ff569f 6171 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 6172 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6173 q7_t * pResult);
Anna Bridge 160:5571c4ff569f 6174
Anna Bridge 160:5571c4ff569f 6175
Anna Bridge 160:5571c4ff569f 6176 /**
Anna Bridge 160:5571c4ff569f 6177 * @brief Mean value of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6178 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6179 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6180 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6181 */
Anna Bridge 160:5571c4ff569f 6182 void arm_mean_q15(
Anna Bridge 160:5571c4ff569f 6183 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6184 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6185 q15_t * pResult);
Anna Bridge 160:5571c4ff569f 6186
Anna Bridge 160:5571c4ff569f 6187
Anna Bridge 160:5571c4ff569f 6188 /**
Anna Bridge 160:5571c4ff569f 6189 * @brief Mean value of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6190 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6191 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6192 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6193 */
Anna Bridge 160:5571c4ff569f 6194 void arm_mean_q31(
Anna Bridge 160:5571c4ff569f 6195 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6196 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6197 q31_t * pResult);
Anna Bridge 160:5571c4ff569f 6198
Anna Bridge 160:5571c4ff569f 6199
Anna Bridge 160:5571c4ff569f 6200 /**
Anna Bridge 160:5571c4ff569f 6201 * @brief Mean value of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6202 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6203 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6204 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6205 */
Anna Bridge 160:5571c4ff569f 6206 void arm_mean_f32(
Anna Bridge 160:5571c4ff569f 6207 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6208 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6209 float32_t * pResult);
Anna Bridge 160:5571c4ff569f 6210
Anna Bridge 160:5571c4ff569f 6211
Anna Bridge 160:5571c4ff569f 6212 /**
Anna Bridge 160:5571c4ff569f 6213 * @brief Variance of the elements of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6214 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6215 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6216 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6217 */
Anna Bridge 160:5571c4ff569f 6218 void arm_var_f32(
Anna Bridge 160:5571c4ff569f 6219 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6220 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6221 float32_t * pResult);
Anna Bridge 160:5571c4ff569f 6222
Anna Bridge 160:5571c4ff569f 6223
Anna Bridge 160:5571c4ff569f 6224 /**
Anna Bridge 160:5571c4ff569f 6225 * @brief Variance of the elements of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6226 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6227 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6228 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6229 */
Anna Bridge 160:5571c4ff569f 6230 void arm_var_q31(
Anna Bridge 160:5571c4ff569f 6231 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6232 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6233 q31_t * pResult);
Anna Bridge 160:5571c4ff569f 6234
Anna Bridge 160:5571c4ff569f 6235
Anna Bridge 160:5571c4ff569f 6236 /**
Anna Bridge 160:5571c4ff569f 6237 * @brief Variance of the elements of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6238 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6239 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6240 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6241 */
Anna Bridge 160:5571c4ff569f 6242 void arm_var_q15(
Anna Bridge 160:5571c4ff569f 6243 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6244 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6245 q15_t * pResult);
Anna Bridge 160:5571c4ff569f 6246
Anna Bridge 160:5571c4ff569f 6247
Anna Bridge 160:5571c4ff569f 6248 /**
Anna Bridge 160:5571c4ff569f 6249 * @brief Root Mean Square of the elements of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6250 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6251 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6252 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6253 */
Anna Bridge 160:5571c4ff569f 6254 void arm_rms_f32(
Anna Bridge 160:5571c4ff569f 6255 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6256 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6257 float32_t * pResult);
Anna Bridge 160:5571c4ff569f 6258
Anna Bridge 160:5571c4ff569f 6259
Anna Bridge 160:5571c4ff569f 6260 /**
Anna Bridge 160:5571c4ff569f 6261 * @brief Root Mean Square of the elements of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6262 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6263 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6264 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6265 */
Anna Bridge 160:5571c4ff569f 6266 void arm_rms_q31(
Anna Bridge 160:5571c4ff569f 6267 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6268 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6269 q31_t * pResult);
Anna Bridge 160:5571c4ff569f 6270
Anna Bridge 160:5571c4ff569f 6271
Anna Bridge 160:5571c4ff569f 6272 /**
Anna Bridge 160:5571c4ff569f 6273 * @brief Root Mean Square of the elements of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6274 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6275 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6276 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6277 */
Anna Bridge 160:5571c4ff569f 6278 void arm_rms_q15(
Anna Bridge 160:5571c4ff569f 6279 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6280 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6281 q15_t * pResult);
Anna Bridge 160:5571c4ff569f 6282
Anna Bridge 160:5571c4ff569f 6283
Anna Bridge 160:5571c4ff569f 6284 /**
Anna Bridge 160:5571c4ff569f 6285 * @brief Standard deviation of the elements of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6286 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6287 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6288 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6289 */
Anna Bridge 160:5571c4ff569f 6290 void arm_std_f32(
Anna Bridge 160:5571c4ff569f 6291 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6292 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6293 float32_t * pResult);
Anna Bridge 160:5571c4ff569f 6294
Anna Bridge 160:5571c4ff569f 6295
Anna Bridge 160:5571c4ff569f 6296 /**
Anna Bridge 160:5571c4ff569f 6297 * @brief Standard deviation of the elements of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6298 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6299 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6300 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6301 */
Anna Bridge 160:5571c4ff569f 6302 void arm_std_q31(
Anna Bridge 160:5571c4ff569f 6303 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6304 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6305 q31_t * pResult);
Anna Bridge 160:5571c4ff569f 6306
Anna Bridge 160:5571c4ff569f 6307
Anna Bridge 160:5571c4ff569f 6308 /**
Anna Bridge 160:5571c4ff569f 6309 * @brief Standard deviation of the elements of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6310 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6311 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6312 * @param[out] pResult is output value.
Anna Bridge 160:5571c4ff569f 6313 */
Anna Bridge 160:5571c4ff569f 6314 void arm_std_q15(
Anna Bridge 160:5571c4ff569f 6315 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6316 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6317 q15_t * pResult);
Anna Bridge 160:5571c4ff569f 6318
Anna Bridge 160:5571c4ff569f 6319
Anna Bridge 160:5571c4ff569f 6320 /**
Anna Bridge 160:5571c4ff569f 6321 * @brief Floating-point complex magnitude
Anna Bridge 160:5571c4ff569f 6322 * @param[in] pSrc points to the complex input vector
Anna Bridge 160:5571c4ff569f 6323 * @param[out] pDst points to the real output vector
Anna Bridge 160:5571c4ff569f 6324 * @param[in] numSamples number of complex samples in the input vector
Anna Bridge 160:5571c4ff569f 6325 */
Anna Bridge 160:5571c4ff569f 6326 void arm_cmplx_mag_f32(
Anna Bridge 160:5571c4ff569f 6327 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6328 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 6329 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6330
Anna Bridge 160:5571c4ff569f 6331
Anna Bridge 160:5571c4ff569f 6332 /**
Anna Bridge 160:5571c4ff569f 6333 * @brief Q31 complex magnitude
Anna Bridge 160:5571c4ff569f 6334 * @param[in] pSrc points to the complex input vector
Anna Bridge 160:5571c4ff569f 6335 * @param[out] pDst points to the real output vector
Anna Bridge 160:5571c4ff569f 6336 * @param[in] numSamples number of complex samples in the input vector
Anna Bridge 160:5571c4ff569f 6337 */
Anna Bridge 160:5571c4ff569f 6338 void arm_cmplx_mag_q31(
Anna Bridge 160:5571c4ff569f 6339 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6340 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 6341 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6342
Anna Bridge 160:5571c4ff569f 6343
Anna Bridge 160:5571c4ff569f 6344 /**
Anna Bridge 160:5571c4ff569f 6345 * @brief Q15 complex magnitude
Anna Bridge 160:5571c4ff569f 6346 * @param[in] pSrc points to the complex input vector
Anna Bridge 160:5571c4ff569f 6347 * @param[out] pDst points to the real output vector
Anna Bridge 160:5571c4ff569f 6348 * @param[in] numSamples number of complex samples in the input vector
Anna Bridge 160:5571c4ff569f 6349 */
Anna Bridge 160:5571c4ff569f 6350 void arm_cmplx_mag_q15(
Anna Bridge 160:5571c4ff569f 6351 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6352 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 6353 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6354
Anna Bridge 160:5571c4ff569f 6355
Anna Bridge 160:5571c4ff569f 6356 /**
Anna Bridge 160:5571c4ff569f 6357 * @brief Q15 complex dot product
Anna Bridge 160:5571c4ff569f 6358 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 6359 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 6360 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 6361 * @param[out] realResult real part of the result returned here
Anna Bridge 160:5571c4ff569f 6362 * @param[out] imagResult imaginary part of the result returned here
Anna Bridge 160:5571c4ff569f 6363 */
Anna Bridge 160:5571c4ff569f 6364 void arm_cmplx_dot_prod_q15(
Anna Bridge 160:5571c4ff569f 6365 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 6366 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 6367 uint32_t numSamples,
Anna Bridge 160:5571c4ff569f 6368 q31_t * realResult,
Anna Bridge 160:5571c4ff569f 6369 q31_t * imagResult);
Anna Bridge 160:5571c4ff569f 6370
Anna Bridge 160:5571c4ff569f 6371
Anna Bridge 160:5571c4ff569f 6372 /**
Anna Bridge 160:5571c4ff569f 6373 * @brief Q31 complex dot product
Anna Bridge 160:5571c4ff569f 6374 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 6375 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 6376 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 6377 * @param[out] realResult real part of the result returned here
Anna Bridge 160:5571c4ff569f 6378 * @param[out] imagResult imaginary part of the result returned here
Anna Bridge 160:5571c4ff569f 6379 */
Anna Bridge 160:5571c4ff569f 6380 void arm_cmplx_dot_prod_q31(
Anna Bridge 160:5571c4ff569f 6381 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 6382 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 6383 uint32_t numSamples,
Anna Bridge 160:5571c4ff569f 6384 q63_t * realResult,
Anna Bridge 160:5571c4ff569f 6385 q63_t * imagResult);
Anna Bridge 160:5571c4ff569f 6386
Anna Bridge 160:5571c4ff569f 6387
Anna Bridge 160:5571c4ff569f 6388 /**
Anna Bridge 160:5571c4ff569f 6389 * @brief Floating-point complex dot product
Anna Bridge 160:5571c4ff569f 6390 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 6391 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 6392 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 6393 * @param[out] realResult real part of the result returned here
Anna Bridge 160:5571c4ff569f 6394 * @param[out] imagResult imaginary part of the result returned here
Anna Bridge 160:5571c4ff569f 6395 */
Anna Bridge 160:5571c4ff569f 6396 void arm_cmplx_dot_prod_f32(
Anna Bridge 160:5571c4ff569f 6397 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 6398 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 6399 uint32_t numSamples,
Anna Bridge 160:5571c4ff569f 6400 float32_t * realResult,
Anna Bridge 160:5571c4ff569f 6401 float32_t * imagResult);
Anna Bridge 160:5571c4ff569f 6402
Anna Bridge 160:5571c4ff569f 6403
Anna Bridge 160:5571c4ff569f 6404 /**
Anna Bridge 160:5571c4ff569f 6405 * @brief Q15 complex-by-real multiplication
Anna Bridge 160:5571c4ff569f 6406 * @param[in] pSrcCmplx points to the complex input vector
Anna Bridge 160:5571c4ff569f 6407 * @param[in] pSrcReal points to the real input vector
Anna Bridge 160:5571c4ff569f 6408 * @param[out] pCmplxDst points to the complex output vector
Anna Bridge 160:5571c4ff569f 6409 * @param[in] numSamples number of samples in each vector
Anna Bridge 160:5571c4ff569f 6410 */
Anna Bridge 160:5571c4ff569f 6411 void arm_cmplx_mult_real_q15(
Anna Bridge 160:5571c4ff569f 6412 q15_t * pSrcCmplx,
Anna Bridge 160:5571c4ff569f 6413 q15_t * pSrcReal,
Anna Bridge 160:5571c4ff569f 6414 q15_t * pCmplxDst,
Anna Bridge 160:5571c4ff569f 6415 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6416
Anna Bridge 160:5571c4ff569f 6417
Anna Bridge 160:5571c4ff569f 6418 /**
Anna Bridge 160:5571c4ff569f 6419 * @brief Q31 complex-by-real multiplication
Anna Bridge 160:5571c4ff569f 6420 * @param[in] pSrcCmplx points to the complex input vector
Anna Bridge 160:5571c4ff569f 6421 * @param[in] pSrcReal points to the real input vector
Anna Bridge 160:5571c4ff569f 6422 * @param[out] pCmplxDst points to the complex output vector
Anna Bridge 160:5571c4ff569f 6423 * @param[in] numSamples number of samples in each vector
Anna Bridge 160:5571c4ff569f 6424 */
Anna Bridge 160:5571c4ff569f 6425 void arm_cmplx_mult_real_q31(
Anna Bridge 160:5571c4ff569f 6426 q31_t * pSrcCmplx,
Anna Bridge 160:5571c4ff569f 6427 q31_t * pSrcReal,
Anna Bridge 160:5571c4ff569f 6428 q31_t * pCmplxDst,
Anna Bridge 160:5571c4ff569f 6429 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6430
Anna Bridge 160:5571c4ff569f 6431
Anna Bridge 160:5571c4ff569f 6432 /**
Anna Bridge 160:5571c4ff569f 6433 * @brief Floating-point complex-by-real multiplication
Anna Bridge 160:5571c4ff569f 6434 * @param[in] pSrcCmplx points to the complex input vector
Anna Bridge 160:5571c4ff569f 6435 * @param[in] pSrcReal points to the real input vector
Anna Bridge 160:5571c4ff569f 6436 * @param[out] pCmplxDst points to the complex output vector
Anna Bridge 160:5571c4ff569f 6437 * @param[in] numSamples number of samples in each vector
Anna Bridge 160:5571c4ff569f 6438 */
Anna Bridge 160:5571c4ff569f 6439 void arm_cmplx_mult_real_f32(
Anna Bridge 160:5571c4ff569f 6440 float32_t * pSrcCmplx,
Anna Bridge 160:5571c4ff569f 6441 float32_t * pSrcReal,
Anna Bridge 160:5571c4ff569f 6442 float32_t * pCmplxDst,
Anna Bridge 160:5571c4ff569f 6443 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6444
Anna Bridge 160:5571c4ff569f 6445
Anna Bridge 160:5571c4ff569f 6446 /**
Anna Bridge 160:5571c4ff569f 6447 * @brief Minimum value of a Q7 vector.
Anna Bridge 160:5571c4ff569f 6448 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6449 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6450 * @param[out] result is output pointer
Anna Bridge 160:5571c4ff569f 6451 * @param[in] index is the array index of the minimum value in the input buffer.
Anna Bridge 160:5571c4ff569f 6452 */
Anna Bridge 160:5571c4ff569f 6453 void arm_min_q7(
Anna Bridge 160:5571c4ff569f 6454 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 6455 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6456 q7_t * result,
Anna Bridge 160:5571c4ff569f 6457 uint32_t * index);
Anna Bridge 160:5571c4ff569f 6458
Anna Bridge 160:5571c4ff569f 6459
Anna Bridge 160:5571c4ff569f 6460 /**
Anna Bridge 160:5571c4ff569f 6461 * @brief Minimum value of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6462 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6463 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6464 * @param[out] pResult is output pointer
Anna Bridge 160:5571c4ff569f 6465 * @param[in] pIndex is the array index of the minimum value in the input buffer.
Anna Bridge 160:5571c4ff569f 6466 */
Anna Bridge 160:5571c4ff569f 6467 void arm_min_q15(
Anna Bridge 160:5571c4ff569f 6468 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6469 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6470 q15_t * pResult,
Anna Bridge 160:5571c4ff569f 6471 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6472
Anna Bridge 160:5571c4ff569f 6473
Anna Bridge 160:5571c4ff569f 6474 /**
Anna Bridge 160:5571c4ff569f 6475 * @brief Minimum value of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6476 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6477 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6478 * @param[out] pResult is output pointer
Anna Bridge 160:5571c4ff569f 6479 * @param[out] pIndex is the array index of the minimum value in the input buffer.
Anna Bridge 160:5571c4ff569f 6480 */
Anna Bridge 160:5571c4ff569f 6481 void arm_min_q31(
Anna Bridge 160:5571c4ff569f 6482 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6483 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6484 q31_t * pResult,
Anna Bridge 160:5571c4ff569f 6485 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6486
Anna Bridge 160:5571c4ff569f 6487
Anna Bridge 160:5571c4ff569f 6488 /**
Anna Bridge 160:5571c4ff569f 6489 * @brief Minimum value of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6490 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6491 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6492 * @param[out] pResult is output pointer
Anna Bridge 160:5571c4ff569f 6493 * @param[out] pIndex is the array index of the minimum value in the input buffer.
Anna Bridge 160:5571c4ff569f 6494 */
Anna Bridge 160:5571c4ff569f 6495 void arm_min_f32(
Anna Bridge 160:5571c4ff569f 6496 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6497 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6498 float32_t * pResult,
Anna Bridge 160:5571c4ff569f 6499 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6500
Anna Bridge 160:5571c4ff569f 6501
Anna Bridge 160:5571c4ff569f 6502 /**
Anna Bridge 160:5571c4ff569f 6503 * @brief Maximum value of a Q7 vector.
Anna Bridge 160:5571c4ff569f 6504 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 6505 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6506 * @param[out] pResult maximum value returned here
Anna Bridge 160:5571c4ff569f 6507 * @param[out] pIndex index of maximum value returned here
Anna Bridge 160:5571c4ff569f 6508 */
Anna Bridge 160:5571c4ff569f 6509 void arm_max_q7(
Anna Bridge 160:5571c4ff569f 6510 q7_t * pSrc,
Anna Bridge 160:5571c4ff569f 6511 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6512 q7_t * pResult,
Anna Bridge 160:5571c4ff569f 6513 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6514
Anna Bridge 160:5571c4ff569f 6515
Anna Bridge 160:5571c4ff569f 6516 /**
Anna Bridge 160:5571c4ff569f 6517 * @brief Maximum value of a Q15 vector.
Anna Bridge 160:5571c4ff569f 6518 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 6519 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6520 * @param[out] pResult maximum value returned here
Anna Bridge 160:5571c4ff569f 6521 * @param[out] pIndex index of maximum value returned here
Anna Bridge 160:5571c4ff569f 6522 */
Anna Bridge 160:5571c4ff569f 6523 void arm_max_q15(
Anna Bridge 160:5571c4ff569f 6524 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6525 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6526 q15_t * pResult,
Anna Bridge 160:5571c4ff569f 6527 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6528
Anna Bridge 160:5571c4ff569f 6529
Anna Bridge 160:5571c4ff569f 6530 /**
Anna Bridge 160:5571c4ff569f 6531 * @brief Maximum value of a Q31 vector.
Anna Bridge 160:5571c4ff569f 6532 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 6533 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6534 * @param[out] pResult maximum value returned here
Anna Bridge 160:5571c4ff569f 6535 * @param[out] pIndex index of maximum value returned here
Anna Bridge 160:5571c4ff569f 6536 */
Anna Bridge 160:5571c4ff569f 6537 void arm_max_q31(
Anna Bridge 160:5571c4ff569f 6538 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6539 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6540 q31_t * pResult,
Anna Bridge 160:5571c4ff569f 6541 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6542
Anna Bridge 160:5571c4ff569f 6543
Anna Bridge 160:5571c4ff569f 6544 /**
Anna Bridge 160:5571c4ff569f 6545 * @brief Maximum value of a floating-point vector.
Anna Bridge 160:5571c4ff569f 6546 * @param[in] pSrc points to the input buffer
Anna Bridge 160:5571c4ff569f 6547 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6548 * @param[out] pResult maximum value returned here
Anna Bridge 160:5571c4ff569f 6549 * @param[out] pIndex index of maximum value returned here
Anna Bridge 160:5571c4ff569f 6550 */
Anna Bridge 160:5571c4ff569f 6551 void arm_max_f32(
Anna Bridge 160:5571c4ff569f 6552 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6553 uint32_t blockSize,
Anna Bridge 160:5571c4ff569f 6554 float32_t * pResult,
Anna Bridge 160:5571c4ff569f 6555 uint32_t * pIndex);
Anna Bridge 160:5571c4ff569f 6556
Anna Bridge 160:5571c4ff569f 6557
Anna Bridge 160:5571c4ff569f 6558 /**
Anna Bridge 160:5571c4ff569f 6559 * @brief Q15 complex-by-complex multiplication
Anna Bridge 160:5571c4ff569f 6560 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 6561 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 6562 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 6563 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 6564 */
Anna Bridge 160:5571c4ff569f 6565 void arm_cmplx_mult_cmplx_q15(
Anna Bridge 160:5571c4ff569f 6566 q15_t * pSrcA,
Anna Bridge 160:5571c4ff569f 6567 q15_t * pSrcB,
Anna Bridge 160:5571c4ff569f 6568 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 6569 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6570
Anna Bridge 160:5571c4ff569f 6571
Anna Bridge 160:5571c4ff569f 6572 /**
Anna Bridge 160:5571c4ff569f 6573 * @brief Q31 complex-by-complex multiplication
Anna Bridge 160:5571c4ff569f 6574 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 6575 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 6576 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 6577 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 6578 */
Anna Bridge 160:5571c4ff569f 6579 void arm_cmplx_mult_cmplx_q31(
Anna Bridge 160:5571c4ff569f 6580 q31_t * pSrcA,
Anna Bridge 160:5571c4ff569f 6581 q31_t * pSrcB,
Anna Bridge 160:5571c4ff569f 6582 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 6583 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6584
Anna Bridge 160:5571c4ff569f 6585
Anna Bridge 160:5571c4ff569f 6586 /**
Anna Bridge 160:5571c4ff569f 6587 * @brief Floating-point complex-by-complex multiplication
Anna Bridge 160:5571c4ff569f 6588 * @param[in] pSrcA points to the first input vector
Anna Bridge 160:5571c4ff569f 6589 * @param[in] pSrcB points to the second input vector
Anna Bridge 160:5571c4ff569f 6590 * @param[out] pDst points to the output vector
Anna Bridge 160:5571c4ff569f 6591 * @param[in] numSamples number of complex samples in each vector
Anna Bridge 160:5571c4ff569f 6592 */
Anna Bridge 160:5571c4ff569f 6593 void arm_cmplx_mult_cmplx_f32(
Anna Bridge 160:5571c4ff569f 6594 float32_t * pSrcA,
Anna Bridge 160:5571c4ff569f 6595 float32_t * pSrcB,
Anna Bridge 160:5571c4ff569f 6596 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 6597 uint32_t numSamples);
Anna Bridge 160:5571c4ff569f 6598
Anna Bridge 160:5571c4ff569f 6599
Anna Bridge 160:5571c4ff569f 6600 /**
Anna Bridge 160:5571c4ff569f 6601 * @brief Converts the elements of the floating-point vector to Q31 vector.
Anna Bridge 160:5571c4ff569f 6602 * @param[in] pSrc points to the floating-point input vector
Anna Bridge 160:5571c4ff569f 6603 * @param[out] pDst points to the Q31 output vector
Anna Bridge 160:5571c4ff569f 6604 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6605 */
Anna Bridge 160:5571c4ff569f 6606 void arm_float_to_q31(
Anna Bridge 160:5571c4ff569f 6607 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6608 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 6609 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6610
Anna Bridge 160:5571c4ff569f 6611
Anna Bridge 160:5571c4ff569f 6612 /**
Anna Bridge 160:5571c4ff569f 6613 * @brief Converts the elements of the floating-point vector to Q15 vector.
Anna Bridge 160:5571c4ff569f 6614 * @param[in] pSrc points to the floating-point input vector
Anna Bridge 160:5571c4ff569f 6615 * @param[out] pDst points to the Q15 output vector
Anna Bridge 160:5571c4ff569f 6616 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6617 */
Anna Bridge 160:5571c4ff569f 6618 void arm_float_to_q15(
Anna Bridge 160:5571c4ff569f 6619 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6620 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 6621 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6622
Anna Bridge 160:5571c4ff569f 6623
Anna Bridge 160:5571c4ff569f 6624 /**
Anna Bridge 160:5571c4ff569f 6625 * @brief Converts the elements of the floating-point vector to Q7 vector.
Anna Bridge 160:5571c4ff569f 6626 * @param[in] pSrc points to the floating-point input vector
Anna Bridge 160:5571c4ff569f 6627 * @param[out] pDst points to the Q7 output vector
Anna Bridge 160:5571c4ff569f 6628 * @param[in] blockSize length of the input vector
Anna Bridge 160:5571c4ff569f 6629 */
Anna Bridge 160:5571c4ff569f 6630 void arm_float_to_q7(
Anna Bridge 160:5571c4ff569f 6631 float32_t * pSrc,
Anna Bridge 160:5571c4ff569f 6632 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 6633 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6634
Anna Bridge 160:5571c4ff569f 6635
Anna Bridge 160:5571c4ff569f 6636 /**
Anna Bridge 160:5571c4ff569f 6637 * @brief Converts the elements of the Q31 vector to Q15 vector.
Anna Bridge 160:5571c4ff569f 6638 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6639 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 6640 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6641 */
Anna Bridge 160:5571c4ff569f 6642 void arm_q31_to_q15(
Anna Bridge 160:5571c4ff569f 6643 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6644 q15_t * pDst,
Anna Bridge 160:5571c4ff569f 6645 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6646
Anna Bridge 160:5571c4ff569f 6647
Anna Bridge 160:5571c4ff569f 6648 /**
Anna Bridge 160:5571c4ff569f 6649 * @brief Converts the elements of the Q31 vector to Q7 vector.
Anna Bridge 160:5571c4ff569f 6650 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6651 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 6652 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6653 */
Anna Bridge 160:5571c4ff569f 6654 void arm_q31_to_q7(
Anna Bridge 160:5571c4ff569f 6655 q31_t * pSrc,
Anna Bridge 160:5571c4ff569f 6656 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 6657 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6658
Anna Bridge 160:5571c4ff569f 6659
Anna Bridge 160:5571c4ff569f 6660 /**
Anna Bridge 160:5571c4ff569f 6661 * @brief Converts the elements of the Q15 vector to floating-point vector.
Anna Bridge 160:5571c4ff569f 6662 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6663 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 6664 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6665 */
Anna Bridge 160:5571c4ff569f 6666 void arm_q15_to_float(
Anna Bridge 160:5571c4ff569f 6667 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6668 float32_t * pDst,
Anna Bridge 160:5571c4ff569f 6669 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6670
Anna Bridge 160:5571c4ff569f 6671
Anna Bridge 160:5571c4ff569f 6672 /**
Anna Bridge 160:5571c4ff569f 6673 * @brief Converts the elements of the Q15 vector to Q31 vector.
Anna Bridge 160:5571c4ff569f 6674 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6675 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 6676 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6677 */
Anna Bridge 160:5571c4ff569f 6678 void arm_q15_to_q31(
Anna Bridge 160:5571c4ff569f 6679 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6680 q31_t * pDst,
Anna Bridge 160:5571c4ff569f 6681 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6682
Anna Bridge 160:5571c4ff569f 6683
Anna Bridge 160:5571c4ff569f 6684 /**
Anna Bridge 160:5571c4ff569f 6685 * @brief Converts the elements of the Q15 vector to Q7 vector.
Anna Bridge 160:5571c4ff569f 6686 * @param[in] pSrc is input pointer
Anna Bridge 160:5571c4ff569f 6687 * @param[out] pDst is output pointer
Anna Bridge 160:5571c4ff569f 6688 * @param[in] blockSize is the number of samples to process
Anna Bridge 160:5571c4ff569f 6689 */
Anna Bridge 160:5571c4ff569f 6690 void arm_q15_to_q7(
Anna Bridge 160:5571c4ff569f 6691 q15_t * pSrc,
Anna Bridge 160:5571c4ff569f 6692 q7_t * pDst,
Anna Bridge 160:5571c4ff569f 6693 uint32_t blockSize);
Anna Bridge 160:5571c4ff569f 6694
Anna Bridge 160:5571c4ff569f 6695
Anna Bridge 160:5571c4ff569f 6696 /**
Anna Bridge 160:5571c4ff569f 6697 * @ingroup groupInterpolation
Anna Bridge 160:5571c4ff569f 6698 */
Anna Bridge 160:5571c4ff569f 6699
Anna Bridge 160:5571c4ff569f 6700 /**
Anna Bridge 160:5571c4ff569f 6701 * @defgroup BilinearInterpolate Bilinear Interpolation
Anna Bridge 160:5571c4ff569f 6702 *
Anna Bridge 160:5571c4ff569f 6703 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
Anna Bridge 160:5571c4ff569f 6704 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
Anna Bridge 160:5571c4ff569f 6705 * determines values between the grid points.
Anna Bridge 160:5571c4ff569f 6706 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
Anna Bridge 160:5571c4ff569f 6707 * Bilinear interpolation is often used in image processing to rescale images.
Anna Bridge 160:5571c4ff569f 6708 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
Anna Bridge 160:5571c4ff569f 6709 *
Anna Bridge 160:5571c4ff569f 6710 * <b>Algorithm</b>
Anna Bridge 160:5571c4ff569f 6711 * \par
Anna Bridge 160:5571c4ff569f 6712 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
Anna Bridge 160:5571c4ff569f 6713 * For floating-point, the instance structure is defined as:
Anna Bridge 160:5571c4ff569f 6714 * <pre>
Anna Bridge 160:5571c4ff569f 6715 * typedef struct
Anna Bridge 160:5571c4ff569f 6716 * {
Anna Bridge 160:5571c4ff569f 6717 * uint16_t numRows;
Anna Bridge 160:5571c4ff569f 6718 * uint16_t numCols;
Anna Bridge 160:5571c4ff569f 6719 * float32_t *pData;
Anna Bridge 160:5571c4ff569f 6720 * } arm_bilinear_interp_instance_f32;
Anna Bridge 160:5571c4ff569f 6721 * </pre>
Anna Bridge 160:5571c4ff569f 6722 *
Anna Bridge 160:5571c4ff569f 6723 * \par
Anna Bridge 160:5571c4ff569f 6724 * where <code>numRows</code> specifies the number of rows in the table;
Anna Bridge 160:5571c4ff569f 6725 * <code>numCols</code> specifies the number of columns in the table;
Anna Bridge 160:5571c4ff569f 6726 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
Anna Bridge 160:5571c4ff569f 6727 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
Anna Bridge 160:5571c4ff569f 6728 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
Anna Bridge 160:5571c4ff569f 6729 *
Anna Bridge 160:5571c4ff569f 6730 * \par
Anna Bridge 160:5571c4ff569f 6731 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
Anna Bridge 160:5571c4ff569f 6732 * <pre>
Anna Bridge 160:5571c4ff569f 6733 * XF = floor(x)
Anna Bridge 160:5571c4ff569f 6734 * YF = floor(y)
Anna Bridge 160:5571c4ff569f 6735 * </pre>
Anna Bridge 160:5571c4ff569f 6736 * \par
Anna Bridge 160:5571c4ff569f 6737 * The interpolated output point is computed as:
Anna Bridge 160:5571c4ff569f 6738 * <pre>
Anna Bridge 160:5571c4ff569f 6739 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
Anna Bridge 160:5571c4ff569f 6740 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
Anna Bridge 160:5571c4ff569f 6741 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
Anna Bridge 160:5571c4ff569f 6742 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
Anna Bridge 160:5571c4ff569f 6743 * </pre>
Anna Bridge 160:5571c4ff569f 6744 * Note that the coordinates (x, y) contain integer and fractional components.
Anna Bridge 160:5571c4ff569f 6745 * The integer components specify which portion of the table to use while the
Anna Bridge 160:5571c4ff569f 6746 * fractional components control the interpolation processor.
Anna Bridge 160:5571c4ff569f 6747 *
Anna Bridge 160:5571c4ff569f 6748 * \par
Anna Bridge 160:5571c4ff569f 6749 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
Anna Bridge 160:5571c4ff569f 6750 */
Anna Bridge 160:5571c4ff569f 6751
Anna Bridge 160:5571c4ff569f 6752 /**
Anna Bridge 160:5571c4ff569f 6753 * @addtogroup BilinearInterpolate
Anna Bridge 160:5571c4ff569f 6754 * @{
Anna Bridge 160:5571c4ff569f 6755 */
Anna Bridge 160:5571c4ff569f 6756
Anna Bridge 160:5571c4ff569f 6757
Anna Bridge 160:5571c4ff569f 6758 /**
Anna Bridge 160:5571c4ff569f 6759 *
Anna Bridge 160:5571c4ff569f 6760 * @brief Floating-point bilinear interpolation.
Anna Bridge 160:5571c4ff569f 6761 * @param[in,out] S points to an instance of the interpolation structure.
Anna Bridge 160:5571c4ff569f 6762 * @param[in] X interpolation coordinate.
Anna Bridge 160:5571c4ff569f 6763 * @param[in] Y interpolation coordinate.
Anna Bridge 160:5571c4ff569f 6764 * @return out interpolated value.
Anna Bridge 160:5571c4ff569f 6765 */
Anna Bridge 160:5571c4ff569f 6766 CMSIS_INLINE __STATIC_INLINE float32_t arm_bilinear_interp_f32(
Anna Bridge 160:5571c4ff569f 6767 const arm_bilinear_interp_instance_f32 * S,
Anna Bridge 160:5571c4ff569f 6768 float32_t X,
Anna Bridge 160:5571c4ff569f 6769 float32_t Y)
Anna Bridge 160:5571c4ff569f 6770 {
Anna Bridge 160:5571c4ff569f 6771 float32_t out;
Anna Bridge 160:5571c4ff569f 6772 float32_t f00, f01, f10, f11;
Anna Bridge 160:5571c4ff569f 6773 float32_t *pData = S->pData;
Anna Bridge 160:5571c4ff569f 6774 int32_t xIndex, yIndex, index;
Anna Bridge 160:5571c4ff569f 6775 float32_t xdiff, ydiff;
Anna Bridge 160:5571c4ff569f 6776 float32_t b1, b2, b3, b4;
Anna Bridge 160:5571c4ff569f 6777
Anna Bridge 160:5571c4ff569f 6778 xIndex = (int32_t) X;
Anna Bridge 160:5571c4ff569f 6779 yIndex = (int32_t) Y;
Anna Bridge 160:5571c4ff569f 6780
Anna Bridge 160:5571c4ff569f 6781 /* Care taken for table outside boundary */
Anna Bridge 160:5571c4ff569f 6782 /* Returns zero output when values are outside table boundary */
Anna Bridge 160:5571c4ff569f 6783 if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))
Anna Bridge 160:5571c4ff569f 6784 {
Anna Bridge 160:5571c4ff569f 6785 return (0);
Anna Bridge 160:5571c4ff569f 6786 }
Anna Bridge 160:5571c4ff569f 6787
Anna Bridge 160:5571c4ff569f 6788 /* Calculation of index for two nearest points in X-direction */
Anna Bridge 160:5571c4ff569f 6789 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
Anna Bridge 160:5571c4ff569f 6790
Anna Bridge 160:5571c4ff569f 6791
Anna Bridge 160:5571c4ff569f 6792 /* Read two nearest points in X-direction */
Anna Bridge 160:5571c4ff569f 6793 f00 = pData[index];
Anna Bridge 160:5571c4ff569f 6794 f01 = pData[index + 1];
Anna Bridge 160:5571c4ff569f 6795
Anna Bridge 160:5571c4ff569f 6796 /* Calculation of index for two nearest points in Y-direction */
Anna Bridge 160:5571c4ff569f 6797 index = (xIndex - 1) + (yIndex) * S->numCols;
Anna Bridge 160:5571c4ff569f 6798
Anna Bridge 160:5571c4ff569f 6799
Anna Bridge 160:5571c4ff569f 6800 /* Read two nearest points in Y-direction */
Anna Bridge 160:5571c4ff569f 6801 f10 = pData[index];
Anna Bridge 160:5571c4ff569f 6802 f11 = pData[index + 1];
Anna Bridge 160:5571c4ff569f 6803
Anna Bridge 160:5571c4ff569f 6804 /* Calculation of intermediate values */
Anna Bridge 160:5571c4ff569f 6805 b1 = f00;
Anna Bridge 160:5571c4ff569f 6806 b2 = f01 - f00;
Anna Bridge 160:5571c4ff569f 6807 b3 = f10 - f00;
Anna Bridge 160:5571c4ff569f 6808 b4 = f00 - f01 - f10 + f11;
Anna Bridge 160:5571c4ff569f 6809
Anna Bridge 160:5571c4ff569f 6810 /* Calculation of fractional part in X */
Anna Bridge 160:5571c4ff569f 6811 xdiff = X - xIndex;
Anna Bridge 160:5571c4ff569f 6812
Anna Bridge 160:5571c4ff569f 6813 /* Calculation of fractional part in Y */
Anna Bridge 160:5571c4ff569f 6814 ydiff = Y - yIndex;
Anna Bridge 160:5571c4ff569f 6815
Anna Bridge 160:5571c4ff569f 6816 /* Calculation of bi-linear interpolated output */
Anna Bridge 160:5571c4ff569f 6817 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
Anna Bridge 160:5571c4ff569f 6818
Anna Bridge 160:5571c4ff569f 6819 /* return to application */
Anna Bridge 160:5571c4ff569f 6820 return (out);
Anna Bridge 160:5571c4ff569f 6821 }
Anna Bridge 160:5571c4ff569f 6822
Anna Bridge 160:5571c4ff569f 6823
Anna Bridge 160:5571c4ff569f 6824 /**
Anna Bridge 160:5571c4ff569f 6825 *
Anna Bridge 160:5571c4ff569f 6826 * @brief Q31 bilinear interpolation.
Anna Bridge 160:5571c4ff569f 6827 * @param[in,out] S points to an instance of the interpolation structure.
Anna Bridge 160:5571c4ff569f 6828 * @param[in] X interpolation coordinate in 12.20 format.
Anna Bridge 160:5571c4ff569f 6829 * @param[in] Y interpolation coordinate in 12.20 format.
Anna Bridge 160:5571c4ff569f 6830 * @return out interpolated value.
Anna Bridge 160:5571c4ff569f 6831 */
Anna Bridge 160:5571c4ff569f 6832 CMSIS_INLINE __STATIC_INLINE q31_t arm_bilinear_interp_q31(
Anna Bridge 160:5571c4ff569f 6833 arm_bilinear_interp_instance_q31 * S,
Anna Bridge 160:5571c4ff569f 6834 q31_t X,
Anna Bridge 160:5571c4ff569f 6835 q31_t Y)
Anna Bridge 160:5571c4ff569f 6836 {
Anna Bridge 160:5571c4ff569f 6837 q31_t out; /* Temporary output */
Anna Bridge 160:5571c4ff569f 6838 q31_t acc = 0; /* output */
Anna Bridge 160:5571c4ff569f 6839 q31_t xfract, yfract; /* X, Y fractional parts */
Anna Bridge 160:5571c4ff569f 6840 q31_t x1, x2, y1, y2; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 6841 int32_t rI, cI; /* Row and column indices */
Anna Bridge 160:5571c4ff569f 6842 q31_t *pYData = S->pData; /* pointer to output table values */
Anna Bridge 160:5571c4ff569f 6843 uint32_t nCols = S->numCols; /* num of rows */
Anna Bridge 160:5571c4ff569f 6844
Anna Bridge 160:5571c4ff569f 6845 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 6846 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 6847 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 6848 rI = ((X & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 6849
Anna Bridge 160:5571c4ff569f 6850 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 6851 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 6852 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 6853 cI = ((Y & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 6854
Anna Bridge 160:5571c4ff569f 6855 /* Care taken for table outside boundary */
Anna Bridge 160:5571c4ff569f 6856 /* Returns zero output when values are outside table boundary */
Anna Bridge 160:5571c4ff569f 6857 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
Anna Bridge 160:5571c4ff569f 6858 {
Anna Bridge 160:5571c4ff569f 6859 return (0);
Anna Bridge 160:5571c4ff569f 6860 }
Anna Bridge 160:5571c4ff569f 6861
Anna Bridge 160:5571c4ff569f 6862 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 6863 /* shift left xfract by 11 to keep 1.31 format */
Anna Bridge 160:5571c4ff569f 6864 xfract = (X & 0x000FFFFF) << 11u;
Anna Bridge 160:5571c4ff569f 6865
Anna Bridge 160:5571c4ff569f 6866 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 6867 x1 = pYData[(rI) + (int32_t)nCols * (cI) ];
Anna Bridge 160:5571c4ff569f 6868 x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
Anna Bridge 160:5571c4ff569f 6869
Anna Bridge 160:5571c4ff569f 6870 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 6871 /* shift left yfract by 11 to keep 1.31 format */
Anna Bridge 160:5571c4ff569f 6872 yfract = (Y & 0x000FFFFF) << 11u;
Anna Bridge 160:5571c4ff569f 6873
Anna Bridge 160:5571c4ff569f 6874 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 6875 y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ];
Anna Bridge 160:5571c4ff569f 6876 y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
Anna Bridge 160:5571c4ff569f 6877
Anna Bridge 160:5571c4ff569f 6878 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
Anna Bridge 160:5571c4ff569f 6879 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
Anna Bridge 160:5571c4ff569f 6880 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
Anna Bridge 160:5571c4ff569f 6881
Anna Bridge 160:5571c4ff569f 6882 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
Anna Bridge 160:5571c4ff569f 6883 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
Anna Bridge 160:5571c4ff569f 6884 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
Anna Bridge 160:5571c4ff569f 6885
Anna Bridge 160:5571c4ff569f 6886 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
Anna Bridge 160:5571c4ff569f 6887 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
Anna Bridge 160:5571c4ff569f 6888 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
Anna Bridge 160:5571c4ff569f 6889
Anna Bridge 160:5571c4ff569f 6890 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
Anna Bridge 160:5571c4ff569f 6891 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
Anna Bridge 160:5571c4ff569f 6892 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
Anna Bridge 160:5571c4ff569f 6893
Anna Bridge 160:5571c4ff569f 6894 /* Convert acc to 1.31(q31) format */
Anna Bridge 160:5571c4ff569f 6895 return ((q31_t)(acc << 2));
Anna Bridge 160:5571c4ff569f 6896 }
Anna Bridge 160:5571c4ff569f 6897
Anna Bridge 160:5571c4ff569f 6898
Anna Bridge 160:5571c4ff569f 6899 /**
Anna Bridge 160:5571c4ff569f 6900 * @brief Q15 bilinear interpolation.
Anna Bridge 160:5571c4ff569f 6901 * @param[in,out] S points to an instance of the interpolation structure.
Anna Bridge 160:5571c4ff569f 6902 * @param[in] X interpolation coordinate in 12.20 format.
Anna Bridge 160:5571c4ff569f 6903 * @param[in] Y interpolation coordinate in 12.20 format.
Anna Bridge 160:5571c4ff569f 6904 * @return out interpolated value.
Anna Bridge 160:5571c4ff569f 6905 */
Anna Bridge 160:5571c4ff569f 6906 CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(
Anna Bridge 160:5571c4ff569f 6907 arm_bilinear_interp_instance_q15 * S,
Anna Bridge 160:5571c4ff569f 6908 q31_t X,
Anna Bridge 160:5571c4ff569f 6909 q31_t Y)
Anna Bridge 160:5571c4ff569f 6910 {
Anna Bridge 160:5571c4ff569f 6911 q63_t acc = 0; /* output */
Anna Bridge 160:5571c4ff569f 6912 q31_t out; /* Temporary output */
Anna Bridge 160:5571c4ff569f 6913 q15_t x1, x2, y1, y2; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 6914 q31_t xfract, yfract; /* X, Y fractional parts */
Anna Bridge 160:5571c4ff569f 6915 int32_t rI, cI; /* Row and column indices */
Anna Bridge 160:5571c4ff569f 6916 q15_t *pYData = S->pData; /* pointer to output table values */
Anna Bridge 160:5571c4ff569f 6917 uint32_t nCols = S->numCols; /* num of rows */
Anna Bridge 160:5571c4ff569f 6918
Anna Bridge 160:5571c4ff569f 6919 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 6920 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 6921 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 6922 rI = ((X & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 6923
Anna Bridge 160:5571c4ff569f 6924 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 6925 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 6926 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 6927 cI = ((Y & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 6928
Anna Bridge 160:5571c4ff569f 6929 /* Care taken for table outside boundary */
Anna Bridge 160:5571c4ff569f 6930 /* Returns zero output when values are outside table boundary */
Anna Bridge 160:5571c4ff569f 6931 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
Anna Bridge 160:5571c4ff569f 6932 {
Anna Bridge 160:5571c4ff569f 6933 return (0);
Anna Bridge 160:5571c4ff569f 6934 }
Anna Bridge 160:5571c4ff569f 6935
Anna Bridge 160:5571c4ff569f 6936 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 6937 /* xfract should be in 12.20 format */
Anna Bridge 160:5571c4ff569f 6938 xfract = (X & 0x000FFFFF);
Anna Bridge 160:5571c4ff569f 6939
Anna Bridge 160:5571c4ff569f 6940 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 6941 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
Anna Bridge 160:5571c4ff569f 6942 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
Anna Bridge 160:5571c4ff569f 6943
Anna Bridge 160:5571c4ff569f 6944 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 6945 /* yfract should be in 12.20 format */
Anna Bridge 160:5571c4ff569f 6946 yfract = (Y & 0x000FFFFF);
Anna Bridge 160:5571c4ff569f 6947
Anna Bridge 160:5571c4ff569f 6948 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 6949 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
Anna Bridge 160:5571c4ff569f 6950 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
Anna Bridge 160:5571c4ff569f 6951
Anna Bridge 160:5571c4ff569f 6952 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
Anna Bridge 160:5571c4ff569f 6953
Anna Bridge 160:5571c4ff569f 6954 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
Anna Bridge 160:5571c4ff569f 6955 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
Anna Bridge 160:5571c4ff569f 6956 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
Anna Bridge 160:5571c4ff569f 6957 acc = ((q63_t) out * (0xFFFFF - yfract));
Anna Bridge 160:5571c4ff569f 6958
Anna Bridge 160:5571c4ff569f 6959 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
Anna Bridge 160:5571c4ff569f 6960 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
Anna Bridge 160:5571c4ff569f 6961 acc += ((q63_t) out * (xfract));
Anna Bridge 160:5571c4ff569f 6962
Anna Bridge 160:5571c4ff569f 6963 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
Anna Bridge 160:5571c4ff569f 6964 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
Anna Bridge 160:5571c4ff569f 6965 acc += ((q63_t) out * (yfract));
Anna Bridge 160:5571c4ff569f 6966
Anna Bridge 160:5571c4ff569f 6967 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
Anna Bridge 160:5571c4ff569f 6968 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
Anna Bridge 160:5571c4ff569f 6969 acc += ((q63_t) out * (yfract));
Anna Bridge 160:5571c4ff569f 6970
Anna Bridge 160:5571c4ff569f 6971 /* acc is in 13.51 format and down shift acc by 36 times */
Anna Bridge 160:5571c4ff569f 6972 /* Convert out to 1.15 format */
Anna Bridge 160:5571c4ff569f 6973 return ((q15_t)(acc >> 36));
Anna Bridge 160:5571c4ff569f 6974 }
Anna Bridge 160:5571c4ff569f 6975
Anna Bridge 160:5571c4ff569f 6976
Anna Bridge 160:5571c4ff569f 6977 /**
Anna Bridge 160:5571c4ff569f 6978 * @brief Q7 bilinear interpolation.
Anna Bridge 160:5571c4ff569f 6979 * @param[in,out] S points to an instance of the interpolation structure.
Anna Bridge 160:5571c4ff569f 6980 * @param[in] X interpolation coordinate in 12.20 format.
Anna Bridge 160:5571c4ff569f 6981 * @param[in] Y interpolation coordinate in 12.20 format.
Anna Bridge 160:5571c4ff569f 6982 * @return out interpolated value.
Anna Bridge 160:5571c4ff569f 6983 */
Anna Bridge 160:5571c4ff569f 6984 CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7(
Anna Bridge 160:5571c4ff569f 6985 arm_bilinear_interp_instance_q7 * S,
Anna Bridge 160:5571c4ff569f 6986 q31_t X,
Anna Bridge 160:5571c4ff569f 6987 q31_t Y)
Anna Bridge 160:5571c4ff569f 6988 {
Anna Bridge 160:5571c4ff569f 6989 q63_t acc = 0; /* output */
Anna Bridge 160:5571c4ff569f 6990 q31_t out; /* Temporary output */
Anna Bridge 160:5571c4ff569f 6991 q31_t xfract, yfract; /* X, Y fractional parts */
Anna Bridge 160:5571c4ff569f 6992 q7_t x1, x2, y1, y2; /* Nearest output values */
Anna Bridge 160:5571c4ff569f 6993 int32_t rI, cI; /* Row and column indices */
Anna Bridge 160:5571c4ff569f 6994 q7_t *pYData = S->pData; /* pointer to output table values */
Anna Bridge 160:5571c4ff569f 6995 uint32_t nCols = S->numCols; /* num of rows */
Anna Bridge 160:5571c4ff569f 6996
Anna Bridge 160:5571c4ff569f 6997 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 6998 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 6999 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 7000 rI = ((X & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 7001
Anna Bridge 160:5571c4ff569f 7002 /* Input is in 12.20 format */
Anna Bridge 160:5571c4ff569f 7003 /* 12 bits for the table index */
Anna Bridge 160:5571c4ff569f 7004 /* Index value calculation */
Anna Bridge 160:5571c4ff569f 7005 cI = ((Y & (q31_t)0xFFF00000) >> 20);
Anna Bridge 160:5571c4ff569f 7006
Anna Bridge 160:5571c4ff569f 7007 /* Care taken for table outside boundary */
Anna Bridge 160:5571c4ff569f 7008 /* Returns zero output when values are outside table boundary */
Anna Bridge 160:5571c4ff569f 7009 if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
Anna Bridge 160:5571c4ff569f 7010 {
Anna Bridge 160:5571c4ff569f 7011 return (0);
Anna Bridge 160:5571c4ff569f 7012 }
Anna Bridge 160:5571c4ff569f 7013
Anna Bridge 160:5571c4ff569f 7014 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 7015 /* xfract should be in 12.20 format */
Anna Bridge 160:5571c4ff569f 7016 xfract = (X & (q31_t)0x000FFFFF);
Anna Bridge 160:5571c4ff569f 7017
Anna Bridge 160:5571c4ff569f 7018 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 7019 x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
Anna Bridge 160:5571c4ff569f 7020 x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
Anna Bridge 160:5571c4ff569f 7021
Anna Bridge 160:5571c4ff569f 7022 /* 20 bits for the fractional part */
Anna Bridge 160:5571c4ff569f 7023 /* yfract should be in 12.20 format */
Anna Bridge 160:5571c4ff569f 7024 yfract = (Y & (q31_t)0x000FFFFF);
Anna Bridge 160:5571c4ff569f 7025
Anna Bridge 160:5571c4ff569f 7026 /* Read two nearest output values from the index */
Anna Bridge 160:5571c4ff569f 7027 y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
Anna Bridge 160:5571c4ff569f 7028 y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
Anna Bridge 160:5571c4ff569f 7029
Anna Bridge 160:5571c4ff569f 7030 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
Anna Bridge 160:5571c4ff569f 7031 out = ((x1 * (0xFFFFF - xfract)));
Anna Bridge 160:5571c4ff569f 7032 acc = (((q63_t) out * (0xFFFFF - yfract)));
Anna Bridge 160:5571c4ff569f 7033
Anna Bridge 160:5571c4ff569f 7034 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
Anna Bridge 160:5571c4ff569f 7035 out = ((x2 * (0xFFFFF - yfract)));
Anna Bridge 160:5571c4ff569f 7036 acc += (((q63_t) out * (xfract)));
Anna Bridge 160:5571c4ff569f 7037
Anna Bridge 160:5571c4ff569f 7038 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
Anna Bridge 160:5571c4ff569f 7039 out = ((y1 * (0xFFFFF - xfract)));
Anna Bridge 160:5571c4ff569f 7040 acc += (((q63_t) out * (yfract)));
Anna Bridge 160:5571c4ff569f 7041
Anna Bridge 160:5571c4ff569f 7042 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
Anna Bridge 160:5571c4ff569f 7043 out = ((y2 * (yfract)));
Anna Bridge 160:5571c4ff569f 7044 acc += (((q63_t) out * (xfract)));
Anna Bridge 160:5571c4ff569f 7045
Anna Bridge 160:5571c4ff569f 7046 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
Anna Bridge 160:5571c4ff569f 7047 return ((q7_t)(acc >> 40));
Anna Bridge 160:5571c4ff569f 7048 }
Anna Bridge 160:5571c4ff569f 7049
Anna Bridge 160:5571c4ff569f 7050 /**
Anna Bridge 160:5571c4ff569f 7051 * @} end of BilinearInterpolate group
Anna Bridge 160:5571c4ff569f 7052 */
Anna Bridge 160:5571c4ff569f 7053
Anna Bridge 160:5571c4ff569f 7054
Anna Bridge 160:5571c4ff569f 7055 /* SMMLAR */
Anna Bridge 160:5571c4ff569f 7056 #define multAcc_32x32_keep32_R(a, x, y) \
Anna Bridge 160:5571c4ff569f 7057 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
Anna Bridge 160:5571c4ff569f 7058
Anna Bridge 160:5571c4ff569f 7059 /* SMMLSR */
Anna Bridge 160:5571c4ff569f 7060 #define multSub_32x32_keep32_R(a, x, y) \
Anna Bridge 160:5571c4ff569f 7061 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
Anna Bridge 160:5571c4ff569f 7062
Anna Bridge 160:5571c4ff569f 7063 /* SMMULR */
Anna Bridge 160:5571c4ff569f 7064 #define mult_32x32_keep32_R(a, x, y) \
Anna Bridge 160:5571c4ff569f 7065 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
Anna Bridge 160:5571c4ff569f 7066
Anna Bridge 160:5571c4ff569f 7067 /* SMMLA */
Anna Bridge 160:5571c4ff569f 7068 #define multAcc_32x32_keep32(a, x, y) \
Anna Bridge 160:5571c4ff569f 7069 a += (q31_t) (((q63_t) x * y) >> 32)
Anna Bridge 160:5571c4ff569f 7070
Anna Bridge 160:5571c4ff569f 7071 /* SMMLS */
Anna Bridge 160:5571c4ff569f 7072 #define multSub_32x32_keep32(a, x, y) \
Anna Bridge 160:5571c4ff569f 7073 a -= (q31_t) (((q63_t) x * y) >> 32)
Anna Bridge 160:5571c4ff569f 7074
Anna Bridge 160:5571c4ff569f 7075 /* SMMUL */
Anna Bridge 160:5571c4ff569f 7076 #define mult_32x32_keep32(a, x, y) \
Anna Bridge 160:5571c4ff569f 7077 a = (q31_t) (((q63_t) x * y ) >> 32)
Anna Bridge 160:5571c4ff569f 7078
Anna Bridge 160:5571c4ff569f 7079
Anna Bridge 160:5571c4ff569f 7080 #if defined ( __CC_ARM )
Anna Bridge 160:5571c4ff569f 7081 /* Enter low optimization region - place directly above function definition */
Anna Bridge 160:5571c4ff569f 7082 #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
Anna Bridge 160:5571c4ff569f 7083 #define LOW_OPTIMIZATION_ENTER \
Anna Bridge 160:5571c4ff569f 7084 _Pragma ("push") \
Anna Bridge 160:5571c4ff569f 7085 _Pragma ("O1")
Anna Bridge 160:5571c4ff569f 7086 #else
Anna Bridge 160:5571c4ff569f 7087 #define LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7088 #endif
Anna Bridge 160:5571c4ff569f 7089
Anna Bridge 160:5571c4ff569f 7090 /* Exit low optimization region - place directly after end of function definition */
Anna Bridge 160:5571c4ff569f 7091 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
Anna Bridge 160:5571c4ff569f 7092 #define LOW_OPTIMIZATION_EXIT \
Anna Bridge 160:5571c4ff569f 7093 _Pragma ("pop")
Anna Bridge 160:5571c4ff569f 7094 #else
Anna Bridge 160:5571c4ff569f 7095 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7096 #endif
Anna Bridge 160:5571c4ff569f 7097
Anna Bridge 160:5571c4ff569f 7098 /* Enter low optimization region - place directly above function definition */
Anna Bridge 160:5571c4ff569f 7099 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7100
Anna Bridge 160:5571c4ff569f 7101 /* Exit low optimization region - place directly after end of function definition */
Anna Bridge 160:5571c4ff569f 7102 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7103
Anna Bridge 160:5571c4ff569f 7104 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
Anna Bridge 160:5571c4ff569f 7105 #define LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7106 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7107 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7108 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7109
Anna Bridge 160:5571c4ff569f 7110 #elif defined ( __GNUC__ )
Anna Bridge 160:5571c4ff569f 7111 #define LOW_OPTIMIZATION_ENTER \
Anna Bridge 160:5571c4ff569f 7112 __attribute__(( optimize("-O1") ))
Anna Bridge 160:5571c4ff569f 7113 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7114 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7115 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7116
Anna Bridge 160:5571c4ff569f 7117 #elif defined ( __ICCARM__ )
Anna Bridge 160:5571c4ff569f 7118 /* Enter low optimization region - place directly above function definition */
Anna Bridge 160:5571c4ff569f 7119 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
Anna Bridge 160:5571c4ff569f 7120 #define LOW_OPTIMIZATION_ENTER \
Anna Bridge 160:5571c4ff569f 7121 _Pragma ("optimize=low")
Anna Bridge 160:5571c4ff569f 7122 #else
Anna Bridge 160:5571c4ff569f 7123 #define LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7124 #endif
Anna Bridge 160:5571c4ff569f 7125
Anna Bridge 160:5571c4ff569f 7126 /* Exit low optimization region - place directly after end of function definition */
Anna Bridge 160:5571c4ff569f 7127 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7128
Anna Bridge 160:5571c4ff569f 7129 /* Enter low optimization region - place directly above function definition */
Anna Bridge 160:5571c4ff569f 7130 #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
Anna Bridge 160:5571c4ff569f 7131 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
Anna Bridge 160:5571c4ff569f 7132 _Pragma ("optimize=low")
Anna Bridge 160:5571c4ff569f 7133 #else
Anna Bridge 160:5571c4ff569f 7134 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7135 #endif
Anna Bridge 160:5571c4ff569f 7136
Anna Bridge 160:5571c4ff569f 7137 /* Exit low optimization region - place directly after end of function definition */
Anna Bridge 160:5571c4ff569f 7138 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7139
Anna Bridge 160:5571c4ff569f 7140 #elif defined ( __TI_ARM__ )
Anna Bridge 160:5571c4ff569f 7141 #define LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7142 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7143 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7144 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7145
Anna Bridge 160:5571c4ff569f 7146 #elif defined ( __CSMC__ )
Anna Bridge 160:5571c4ff569f 7147 #define LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7148 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7149 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7150 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7151
Anna Bridge 160:5571c4ff569f 7152 #elif defined ( __TASKING__ )
Anna Bridge 160:5571c4ff569f 7153 #define LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7154 #define LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7155 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
Anna Bridge 160:5571c4ff569f 7156 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
Anna Bridge 160:5571c4ff569f 7157
Anna Bridge 160:5571c4ff569f 7158 #endif
Anna Bridge 160:5571c4ff569f 7159
Anna Bridge 160:5571c4ff569f 7160
Anna Bridge 160:5571c4ff569f 7161 #ifdef __cplusplus
Anna Bridge 160:5571c4ff569f 7162 }
Anna Bridge 160:5571c4ff569f 7163 #endif
Anna Bridge 160:5571c4ff569f 7164
Anna Bridge 160:5571c4ff569f 7165 /* Compiler specific diagnostic adjustment */
Anna Bridge 160:5571c4ff569f 7166 #if defined ( __CC_ARM )
Anna Bridge 160:5571c4ff569f 7167
Anna Bridge 160:5571c4ff569f 7168 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
Anna Bridge 160:5571c4ff569f 7169
Anna Bridge 160:5571c4ff569f 7170 #elif defined ( __GNUC__ )
Anna Bridge 160:5571c4ff569f 7171 #pragma GCC diagnostic pop
Anna Bridge 160:5571c4ff569f 7172
Anna Bridge 160:5571c4ff569f 7173 #elif defined ( __ICCARM__ )
Anna Bridge 160:5571c4ff569f 7174
Anna Bridge 160:5571c4ff569f 7175 #elif defined ( __TI_ARM__ )
Anna Bridge 160:5571c4ff569f 7176
Anna Bridge 160:5571c4ff569f 7177 #elif defined ( __CSMC__ )
Anna Bridge 160:5571c4ff569f 7178
Anna Bridge 160:5571c4ff569f 7179 #elif defined ( __TASKING__ )
Anna Bridge 160:5571c4ff569f 7180
Anna Bridge 160:5571c4ff569f 7181 #else
Anna Bridge 160:5571c4ff569f 7182 #error Unknown compiler
Anna Bridge 160:5571c4ff569f 7183 #endif
Anna Bridge 160:5571c4ff569f 7184
Anna Bridge 160:5571c4ff569f 7185 #endif /* _ARM_MATH_H */
Anna Bridge 160:5571c4ff569f 7186
Anna Bridge 160:5571c4ff569f 7187 /**
Anna Bridge 160:5571c4ff569f 7188 *
Anna Bridge 160:5571c4ff569f 7189 * End of file.
Anna Bridge 160:5571c4ff569f 7190 */