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:
AnnaBridge
Date:
Fri Sep 15 14:46:57 2017 +0100
Revision:
151:675da3299148
Parent:
145:64910690c574
Release 151 of the mbed library.

Who changed what in which revision?

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