Aded CMSIS5 DSP and NN folder. Needs some work

Committer:
robert_lp
Date:
Thu Apr 12 01:31:58 2018 +0000
Revision:
0:eedb7d567a5d
CMSIS5 Library

Who changed what in which revision?

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