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:
Kojto
Date:
Wed Apr 29 10:16:23 2015 +0100
Revision:
98:8ab26030e058
Child:
110:165afa46840b
Release 98 of the mbed library

Changes:
- Silabs new targets (Giant, Zero, Happy, Leopard, Wonder Geckos)
- Asynchronous SPI, I2C, Serial
- LowPower classes
- Nordic - nordic SDK v8.0 update
- Teensy - gcc arm fix for startup
- Nucleo F411 - usb freq fix

Who changed what in which revision?

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