mbed library for NZ32-SC151
targets/cmsis/arm_math.h@17:639ed60ce759, 2016-08-19 (annotated)
- Committer:
- modtronix-com
- Date:
- Fri Aug 19 15:46:42 2016 +1000
- Revision:
- 17:639ed60ce759
- Parent:
- 10:6444e6c798ce
Added tag v1.1 for changeset 076cbe3e55be
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
modtronix | 10:6444e6c798ce | 1 | /* ---------------------------------------------------------------------- |
modtronix | 10:6444e6c798ce | 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. |
modtronix | 10:6444e6c798ce | 3 | * |
modtronix | 10:6444e6c798ce | 4 | * $Date: 12. March 2014 |
modtronix | 10:6444e6c798ce | 5 | * $Revision: V1.4.4 |
modtronix | 10:6444e6c798ce | 6 | * |
modtronix | 10:6444e6c798ce | 7 | * Project: CMSIS DSP Library |
modtronix | 10:6444e6c798ce | 8 | * Title: arm_math.h |
modtronix | 10:6444e6c798ce | 9 | * |
modtronix | 10:6444e6c798ce | 10 | * Description: Public header file for CMSIS DSP Library |
modtronix | 10:6444e6c798ce | 11 | * |
modtronix | 10:6444e6c798ce | 12 | * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0 |
modtronix | 10:6444e6c798ce | 13 | * |
modtronix | 10:6444e6c798ce | 14 | * Redistribution and use in source and binary forms, with or without |
modtronix | 10:6444e6c798ce | 15 | * modification, are permitted provided that the following conditions |
modtronix | 10:6444e6c798ce | 16 | * are met: |
modtronix | 10:6444e6c798ce | 17 | * - Redistributions of source code must retain the above copyright |
modtronix | 10:6444e6c798ce | 18 | * notice, this list of conditions and the following disclaimer. |
modtronix | 10:6444e6c798ce | 19 | * - Redistributions in binary form must reproduce the above copyright |
modtronix | 10:6444e6c798ce | 20 | * notice, this list of conditions and the following disclaimer in |
modtronix | 10:6444e6c798ce | 21 | * the documentation and/or other materials provided with the |
modtronix | 10:6444e6c798ce | 22 | * distribution. |
modtronix | 10:6444e6c798ce | 23 | * - Neither the name of ARM LIMITED nor the names of its contributors |
modtronix | 10:6444e6c798ce | 24 | * may be used to endorse or promote products derived from this |
modtronix | 10:6444e6c798ce | 25 | * software without specific prior written permission. |
modtronix | 10:6444e6c798ce | 26 | * |
modtronix | 10:6444e6c798ce | 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
modtronix | 10:6444e6c798ce | 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
modtronix | 10:6444e6c798ce | 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
modtronix | 10:6444e6c798ce | 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
modtronix | 10:6444e6c798ce | 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
modtronix | 10:6444e6c798ce | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
modtronix | 10:6444e6c798ce | 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
modtronix | 10:6444e6c798ce | 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
modtronix | 10:6444e6c798ce | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
modtronix | 10:6444e6c798ce | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
modtronix | 10:6444e6c798ce | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
modtronix | 10:6444e6c798ce | 38 | * POSSIBILITY OF SUCH DAMAGE. |
modtronix | 10:6444e6c798ce | 39 | * -------------------------------------------------------------------- */ |
modtronix | 10:6444e6c798ce | 40 | |
modtronix | 10:6444e6c798ce | 41 | /** |
modtronix | 10:6444e6c798ce | 42 | \mainpage CMSIS DSP Software Library |
modtronix | 10:6444e6c798ce | 43 | * |
modtronix | 10:6444e6c798ce | 44 | * Introduction |
modtronix | 10:6444e6c798ce | 45 | * ------------ |
modtronix | 10:6444e6c798ce | 46 | * |
modtronix | 10:6444e6c798ce | 47 | * This user manual describes the CMSIS DSP software library, |
modtronix | 10:6444e6c798ce | 48 | * a suite of common signal processing functions for use on Cortex-M processor based devices. |
modtronix | 10:6444e6c798ce | 49 | * |
modtronix | 10:6444e6c798ce | 50 | * The library is divided into a number of functions each covering a specific category: |
modtronix | 10:6444e6c798ce | 51 | * - Basic math functions |
modtronix | 10:6444e6c798ce | 52 | * - Fast math functions |
modtronix | 10:6444e6c798ce | 53 | * - Complex math functions |
modtronix | 10:6444e6c798ce | 54 | * - Filters |
modtronix | 10:6444e6c798ce | 55 | * - Matrix functions |
modtronix | 10:6444e6c798ce | 56 | * - Transforms |
modtronix | 10:6444e6c798ce | 57 | * - Motor control functions |
modtronix | 10:6444e6c798ce | 58 | * - Statistical functions |
modtronix | 10:6444e6c798ce | 59 | * - Support functions |
modtronix | 10:6444e6c798ce | 60 | * - Interpolation functions |
modtronix | 10:6444e6c798ce | 61 | * |
modtronix | 10:6444e6c798ce | 62 | * The library has separate functions for operating on 8-bit integers, 16-bit integers, |
modtronix | 10:6444e6c798ce | 63 | * 32-bit integer and 32-bit floating-point values. |
modtronix | 10:6444e6c798ce | 64 | * |
modtronix | 10:6444e6c798ce | 65 | * Using the Library |
modtronix | 10:6444e6c798ce | 66 | * ------------ |
modtronix | 10:6444e6c798ce | 67 | * |
modtronix | 10:6444e6c798ce | 68 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder. |
modtronix | 10:6444e6c798ce | 69 | * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) |
modtronix | 10:6444e6c798ce | 70 | * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) |
modtronix | 10:6444e6c798ce | 71 | * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) |
modtronix | 10:6444e6c798ce | 72 | * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) |
modtronix | 10:6444e6c798ce | 73 | * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) |
modtronix | 10:6444e6c798ce | 74 | * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) |
modtronix | 10:6444e6c798ce | 75 | * - arm_cortexM0l_math.lib (Little endian on Cortex-M0) |
modtronix | 10:6444e6c798ce | 76 | * - arm_cortexM0b_math.lib (Big endian on Cortex-M3) |
modtronix | 10:6444e6c798ce | 77 | * |
modtronix | 10:6444e6c798ce | 78 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder. |
modtronix | 10:6444e6c798ce | 79 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single |
modtronix | 10:6444e6c798ce | 80 | * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. |
modtronix | 10:6444e6c798ce | 81 | * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or |
modtronix | 10:6444e6c798ce | 82 | * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. |
modtronix | 10:6444e6c798ce | 83 | * |
modtronix | 10:6444e6c798ce | 84 | * Examples |
modtronix | 10:6444e6c798ce | 85 | * -------- |
modtronix | 10:6444e6c798ce | 86 | * |
modtronix | 10:6444e6c798ce | 87 | * The library ships with a number of examples which demonstrate how to use the library functions. |
modtronix | 10:6444e6c798ce | 88 | * |
modtronix | 10:6444e6c798ce | 89 | * Toolchain Support |
modtronix | 10:6444e6c798ce | 90 | * ------------ |
modtronix | 10:6444e6c798ce | 91 | * |
modtronix | 10:6444e6c798ce | 92 | * The library has been developed and tested with MDK-ARM version 4.60. |
modtronix | 10:6444e6c798ce | 93 | * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. |
modtronix | 10:6444e6c798ce | 94 | * |
modtronix | 10:6444e6c798ce | 95 | * Building the Library |
modtronix | 10:6444e6c798ce | 96 | * ------------ |
modtronix | 10:6444e6c798ce | 97 | * |
modtronix | 10:6444e6c798ce | 98 | * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder. |
modtronix | 10:6444e6c798ce | 99 | * - arm_cortexM_math.uvproj |
modtronix | 10:6444e6c798ce | 100 | * |
modtronix | 10:6444e6c798ce | 101 | * |
modtronix | 10:6444e6c798ce | 102 | * The libraries can be built by opening the arm_cortexM_math.uvproj project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above. |
modtronix | 10:6444e6c798ce | 103 | * |
modtronix | 10:6444e6c798ce | 104 | * Pre-processor Macros |
modtronix | 10:6444e6c798ce | 105 | * ------------ |
modtronix | 10:6444e6c798ce | 106 | * |
modtronix | 10:6444e6c798ce | 107 | * Each library project have differant pre-processor macros. |
modtronix | 10:6444e6c798ce | 108 | * |
modtronix | 10:6444e6c798ce | 109 | * - UNALIGNED_SUPPORT_DISABLE: |
modtronix | 10:6444e6c798ce | 110 | * |
modtronix | 10:6444e6c798ce | 111 | * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access |
modtronix | 10:6444e6c798ce | 112 | * |
modtronix | 10:6444e6c798ce | 113 | * - ARM_MATH_BIG_ENDIAN: |
modtronix | 10:6444e6c798ce | 114 | * |
modtronix | 10:6444e6c798ce | 115 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. |
modtronix | 10:6444e6c798ce | 116 | * |
modtronix | 10:6444e6c798ce | 117 | * - ARM_MATH_MATRIX_CHECK: |
modtronix | 10:6444e6c798ce | 118 | * |
modtronix | 10:6444e6c798ce | 119 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices |
modtronix | 10:6444e6c798ce | 120 | * |
modtronix | 10:6444e6c798ce | 121 | * - ARM_MATH_ROUNDING: |
modtronix | 10:6444e6c798ce | 122 | * |
modtronix | 10:6444e6c798ce | 123 | * Define macro ARM_MATH_ROUNDING for rounding on support functions |
modtronix | 10:6444e6c798ce | 124 | * |
modtronix | 10:6444e6c798ce | 125 | * - ARM_MATH_CMx: |
modtronix | 10:6444e6c798ce | 126 | * |
modtronix | 10:6444e6c798ce | 127 | * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target |
modtronix | 10:6444e6c798ce | 128 | * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target. |
modtronix | 10:6444e6c798ce | 129 | * |
modtronix | 10:6444e6c798ce | 130 | * - __FPU_PRESENT: |
modtronix | 10:6444e6c798ce | 131 | * |
modtronix | 10:6444e6c798ce | 132 | * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries |
modtronix | 10:6444e6c798ce | 133 | * |
modtronix | 10:6444e6c798ce | 134 | * <hr> |
modtronix | 10:6444e6c798ce | 135 | * CMSIS-DSP in ARM::CMSIS Pack |
modtronix | 10:6444e6c798ce | 136 | * ----------------------------- |
modtronix | 10:6444e6c798ce | 137 | * |
modtronix | 10:6444e6c798ce | 138 | * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories: |
modtronix | 10:6444e6c798ce | 139 | * |File/Folder |Content | |
modtronix | 10:6444e6c798ce | 140 | * |------------------------------|------------------------------------------------------------------------| |
modtronix | 10:6444e6c798ce | 141 | * |\b CMSIS\\Documentation\\DSP | This documentation | |
modtronix | 10:6444e6c798ce | 142 | * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | |
modtronix | 10:6444e6c798ce | 143 | * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | |
modtronix | 10:6444e6c798ce | 144 | * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | |
modtronix | 10:6444e6c798ce | 145 | * |
modtronix | 10:6444e6c798ce | 146 | * <hr> |
modtronix | 10:6444e6c798ce | 147 | * Revision History of CMSIS-DSP |
modtronix | 10:6444e6c798ce | 148 | * ------------ |
modtronix | 10:6444e6c798ce | 149 | * Please refer to \ref ChangeLog_pg. |
modtronix | 10:6444e6c798ce | 150 | * |
modtronix | 10:6444e6c798ce | 151 | * Copyright Notice |
modtronix | 10:6444e6c798ce | 152 | * ------------ |
modtronix | 10:6444e6c798ce | 153 | * |
modtronix | 10:6444e6c798ce | 154 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. |
modtronix | 10:6444e6c798ce | 155 | */ |
modtronix | 10:6444e6c798ce | 156 | |
modtronix | 10:6444e6c798ce | 157 | |
modtronix | 10:6444e6c798ce | 158 | /** |
modtronix | 10:6444e6c798ce | 159 | * @defgroup groupMath Basic Math Functions |
modtronix | 10:6444e6c798ce | 160 | */ |
modtronix | 10:6444e6c798ce | 161 | |
modtronix | 10:6444e6c798ce | 162 | /** |
modtronix | 10:6444e6c798ce | 163 | * @defgroup groupFastMath Fast Math Functions |
modtronix | 10:6444e6c798ce | 164 | * This set of functions provides a fast approximation to sine, cosine, and square root. |
modtronix | 10:6444e6c798ce | 165 | * As compared to most of the other functions in the CMSIS math library, the fast math functions |
modtronix | 10:6444e6c798ce | 166 | * operate on individual values and not arrays. |
modtronix | 10:6444e6c798ce | 167 | * There are separate functions for Q15, Q31, and floating-point data. |
modtronix | 10:6444e6c798ce | 168 | * |
modtronix | 10:6444e6c798ce | 169 | */ |
modtronix | 10:6444e6c798ce | 170 | |
modtronix | 10:6444e6c798ce | 171 | /** |
modtronix | 10:6444e6c798ce | 172 | * @defgroup groupCmplxMath Complex Math Functions |
modtronix | 10:6444e6c798ce | 173 | * This set of functions operates on complex data vectors. |
modtronix | 10:6444e6c798ce | 174 | * The data in the complex arrays is stored in an interleaved fashion |
modtronix | 10:6444e6c798ce | 175 | * (real, imag, real, imag, ...). |
modtronix | 10:6444e6c798ce | 176 | * In the API functions, the number of samples in a complex array refers |
modtronix | 10:6444e6c798ce | 177 | * to the number of complex values; the array contains twice this number of |
modtronix | 10:6444e6c798ce | 178 | * real values. |
modtronix | 10:6444e6c798ce | 179 | */ |
modtronix | 10:6444e6c798ce | 180 | |
modtronix | 10:6444e6c798ce | 181 | /** |
modtronix | 10:6444e6c798ce | 182 | * @defgroup groupFilters Filtering Functions |
modtronix | 10:6444e6c798ce | 183 | */ |
modtronix | 10:6444e6c798ce | 184 | |
modtronix | 10:6444e6c798ce | 185 | /** |
modtronix | 10:6444e6c798ce | 186 | * @defgroup groupMatrix Matrix Functions |
modtronix | 10:6444e6c798ce | 187 | * |
modtronix | 10:6444e6c798ce | 188 | * This set of functions provides basic matrix math operations. |
modtronix | 10:6444e6c798ce | 189 | * The functions operate on matrix data structures. For example, |
modtronix | 10:6444e6c798ce | 190 | * the type |
modtronix | 10:6444e6c798ce | 191 | * definition for the floating-point matrix structure is shown |
modtronix | 10:6444e6c798ce | 192 | * below: |
modtronix | 10:6444e6c798ce | 193 | * <pre> |
modtronix | 10:6444e6c798ce | 194 | * typedef struct |
modtronix | 10:6444e6c798ce | 195 | * { |
modtronix | 10:6444e6c798ce | 196 | * uint16_t numRows; // number of rows of the matrix. |
modtronix | 10:6444e6c798ce | 197 | * uint16_t numCols; // number of columns of the matrix. |
modtronix | 10:6444e6c798ce | 198 | * float32_t *pData; // points to the data of the matrix. |
modtronix | 10:6444e6c798ce | 199 | * } arm_matrix_instance_f32; |
modtronix | 10:6444e6c798ce | 200 | * </pre> |
modtronix | 10:6444e6c798ce | 201 | * There are similar definitions for Q15 and Q31 data types. |
modtronix | 10:6444e6c798ce | 202 | * |
modtronix | 10:6444e6c798ce | 203 | * The structure specifies the size of the matrix and then points to |
modtronix | 10:6444e6c798ce | 204 | * an array of data. The array is of size <code>numRows X numCols</code> |
modtronix | 10:6444e6c798ce | 205 | * and the values are arranged in row order. That is, the |
modtronix | 10:6444e6c798ce | 206 | * matrix element (i, j) is stored at: |
modtronix | 10:6444e6c798ce | 207 | * <pre> |
modtronix | 10:6444e6c798ce | 208 | * pData[i*numCols + j] |
modtronix | 10:6444e6c798ce | 209 | * </pre> |
modtronix | 10:6444e6c798ce | 210 | * |
modtronix | 10:6444e6c798ce | 211 | * \par Init Functions |
modtronix | 10:6444e6c798ce | 212 | * There is an associated initialization function for each type of matrix |
modtronix | 10:6444e6c798ce | 213 | * data structure. |
modtronix | 10:6444e6c798ce | 214 | * The initialization function sets the values of the internal structure fields. |
modtronix | 10:6444e6c798ce | 215 | * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code> |
modtronix | 10:6444e6c798ce | 216 | * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively. |
modtronix | 10:6444e6c798ce | 217 | * |
modtronix | 10:6444e6c798ce | 218 | * \par |
modtronix | 10:6444e6c798ce | 219 | * Use of the initialization function is optional. However, if initialization function is used |
modtronix | 10:6444e6c798ce | 220 | * then the instance structure cannot be placed into a const data section. |
modtronix | 10:6444e6c798ce | 221 | * To place the instance structure in a const data |
modtronix | 10:6444e6c798ce | 222 | * section, manually initialize the data structure. For example: |
modtronix | 10:6444e6c798ce | 223 | * <pre> |
modtronix | 10:6444e6c798ce | 224 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code> |
modtronix | 10:6444e6c798ce | 225 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code> |
modtronix | 10:6444e6c798ce | 226 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code> |
modtronix | 10:6444e6c798ce | 227 | * </pre> |
modtronix | 10:6444e6c798ce | 228 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code> |
modtronix | 10:6444e6c798ce | 229 | * specifies the number of columns, and <code>pData</code> points to the |
modtronix | 10:6444e6c798ce | 230 | * data array. |
modtronix | 10:6444e6c798ce | 231 | * |
modtronix | 10:6444e6c798ce | 232 | * \par Size Checking |
modtronix | 10:6444e6c798ce | 233 | * By default all of the matrix functions perform size checking on the input and |
modtronix | 10:6444e6c798ce | 234 | * output matrices. For example, the matrix addition function verifies that the |
modtronix | 10:6444e6c798ce | 235 | * two input matrices and the output matrix all have the same number of rows and |
modtronix | 10:6444e6c798ce | 236 | * columns. If the size check fails the functions return: |
modtronix | 10:6444e6c798ce | 237 | * <pre> |
modtronix | 10:6444e6c798ce | 238 | * ARM_MATH_SIZE_MISMATCH |
modtronix | 10:6444e6c798ce | 239 | * </pre> |
modtronix | 10:6444e6c798ce | 240 | * Otherwise the functions return |
modtronix | 10:6444e6c798ce | 241 | * <pre> |
modtronix | 10:6444e6c798ce | 242 | * ARM_MATH_SUCCESS |
modtronix | 10:6444e6c798ce | 243 | * </pre> |
modtronix | 10:6444e6c798ce | 244 | * There is some overhead associated with this matrix size checking. |
modtronix | 10:6444e6c798ce | 245 | * The matrix size checking is enabled via the \#define |
modtronix | 10:6444e6c798ce | 246 | * <pre> |
modtronix | 10:6444e6c798ce | 247 | * ARM_MATH_MATRIX_CHECK |
modtronix | 10:6444e6c798ce | 248 | * </pre> |
modtronix | 10:6444e6c798ce | 249 | * within the library project settings. By default this macro is defined |
modtronix | 10:6444e6c798ce | 250 | * and size checking is enabled. By changing the project settings and |
modtronix | 10:6444e6c798ce | 251 | * undefining this macro size checking is eliminated and the functions |
modtronix | 10:6444e6c798ce | 252 | * run a bit faster. With size checking disabled the functions always |
modtronix | 10:6444e6c798ce | 253 | * return <code>ARM_MATH_SUCCESS</code>. |
modtronix | 10:6444e6c798ce | 254 | */ |
modtronix | 10:6444e6c798ce | 255 | |
modtronix | 10:6444e6c798ce | 256 | /** |
modtronix | 10:6444e6c798ce | 257 | * @defgroup groupTransforms Transform Functions |
modtronix | 10:6444e6c798ce | 258 | */ |
modtronix | 10:6444e6c798ce | 259 | |
modtronix | 10:6444e6c798ce | 260 | /** |
modtronix | 10:6444e6c798ce | 261 | * @defgroup groupController Controller Functions |
modtronix | 10:6444e6c798ce | 262 | */ |
modtronix | 10:6444e6c798ce | 263 | |
modtronix | 10:6444e6c798ce | 264 | /** |
modtronix | 10:6444e6c798ce | 265 | * @defgroup groupStats Statistics Functions |
modtronix | 10:6444e6c798ce | 266 | */ |
modtronix | 10:6444e6c798ce | 267 | /** |
modtronix | 10:6444e6c798ce | 268 | * @defgroup groupSupport Support Functions |
modtronix | 10:6444e6c798ce | 269 | */ |
modtronix | 10:6444e6c798ce | 270 | |
modtronix | 10:6444e6c798ce | 271 | /** |
modtronix | 10:6444e6c798ce | 272 | * @defgroup groupInterpolation Interpolation Functions |
modtronix | 10:6444e6c798ce | 273 | * These functions perform 1- and 2-dimensional interpolation of data. |
modtronix | 10:6444e6c798ce | 274 | * Linear interpolation is used for 1-dimensional data and |
modtronix | 10:6444e6c798ce | 275 | * bilinear interpolation is used for 2-dimensional data. |
modtronix | 10:6444e6c798ce | 276 | */ |
modtronix | 10:6444e6c798ce | 277 | |
modtronix | 10:6444e6c798ce | 278 | /** |
modtronix | 10:6444e6c798ce | 279 | * @defgroup groupExamples Examples |
modtronix | 10:6444e6c798ce | 280 | */ |
modtronix | 10:6444e6c798ce | 281 | #ifndef _ARM_MATH_H |
modtronix | 10:6444e6c798ce | 282 | #define _ARM_MATH_H |
modtronix | 10:6444e6c798ce | 283 | |
modtronix | 10:6444e6c798ce | 284 | #define __CMSIS_GENERIC /* disable NVIC and Systick functions */ |
modtronix | 10:6444e6c798ce | 285 | |
modtronix | 10:6444e6c798ce | 286 | #if defined(ARM_MATH_CM7) |
modtronix | 10:6444e6c798ce | 287 | #include "core_cm7.h" |
modtronix | 10:6444e6c798ce | 288 | #elif defined (ARM_MATH_CM4) |
modtronix | 10:6444e6c798ce | 289 | #include "core_cm4.h" |
modtronix | 10:6444e6c798ce | 290 | #elif defined (ARM_MATH_CM3) |
modtronix | 10:6444e6c798ce | 291 | #include "core_cm3.h" |
modtronix | 10:6444e6c798ce | 292 | #elif defined (ARM_MATH_CM0) |
modtronix | 10:6444e6c798ce | 293 | #include "core_cm0.h" |
modtronix | 10:6444e6c798ce | 294 | #define ARM_MATH_CM0_FAMILY |
modtronix | 10:6444e6c798ce | 295 | #elif defined (ARM_MATH_CM0PLUS) |
modtronix | 10:6444e6c798ce | 296 | #include "core_cm0plus.h" |
modtronix | 10:6444e6c798ce | 297 | #define ARM_MATH_CM0_FAMILY |
modtronix | 10:6444e6c798ce | 298 | #else |
modtronix | 10:6444e6c798ce | 299 | #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0" |
modtronix | 10:6444e6c798ce | 300 | #endif |
modtronix | 10:6444e6c798ce | 301 | |
modtronix | 10:6444e6c798ce | 302 | #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ |
modtronix | 10:6444e6c798ce | 303 | #include "string.h" |
modtronix | 10:6444e6c798ce | 304 | #include "math.h" |
modtronix | 10:6444e6c798ce | 305 | #ifdef __cplusplus |
modtronix | 10:6444e6c798ce | 306 | extern "C" |
modtronix | 10:6444e6c798ce | 307 | { |
modtronix | 10:6444e6c798ce | 308 | #endif |
modtronix | 10:6444e6c798ce | 309 | |
modtronix | 10:6444e6c798ce | 310 | |
modtronix | 10:6444e6c798ce | 311 | /** |
modtronix | 10:6444e6c798ce | 312 | * @brief Macros required for reciprocal calculation in Normalized LMS |
modtronix | 10:6444e6c798ce | 313 | */ |
modtronix | 10:6444e6c798ce | 314 | |
modtronix | 10:6444e6c798ce | 315 | #define DELTA_Q31 (0x100) |
modtronix | 10:6444e6c798ce | 316 | #define DELTA_Q15 0x5 |
modtronix | 10:6444e6c798ce | 317 | #define INDEX_MASK 0x0000003F |
modtronix | 10:6444e6c798ce | 318 | #ifndef PI |
modtronix | 10:6444e6c798ce | 319 | #define PI 3.14159265358979f |
modtronix | 10:6444e6c798ce | 320 | #endif |
modtronix | 10:6444e6c798ce | 321 | |
modtronix | 10:6444e6c798ce | 322 | /** |
modtronix | 10:6444e6c798ce | 323 | * @brief Macros required for SINE and COSINE Fast math approximations |
modtronix | 10:6444e6c798ce | 324 | */ |
modtronix | 10:6444e6c798ce | 325 | |
modtronix | 10:6444e6c798ce | 326 | #define FAST_MATH_TABLE_SIZE 512 |
modtronix | 10:6444e6c798ce | 327 | #define FAST_MATH_Q31_SHIFT (32 - 10) |
modtronix | 10:6444e6c798ce | 328 | #define FAST_MATH_Q15_SHIFT (16 - 10) |
modtronix | 10:6444e6c798ce | 329 | #define CONTROLLER_Q31_SHIFT (32 - 9) |
modtronix | 10:6444e6c798ce | 330 | #define TABLE_SIZE 256 |
modtronix | 10:6444e6c798ce | 331 | #define TABLE_SPACING_Q31 0x400000 |
modtronix | 10:6444e6c798ce | 332 | #define TABLE_SPACING_Q15 0x80 |
modtronix | 10:6444e6c798ce | 333 | |
modtronix | 10:6444e6c798ce | 334 | /** |
modtronix | 10:6444e6c798ce | 335 | * @brief Macros required for SINE and COSINE Controller functions |
modtronix | 10:6444e6c798ce | 336 | */ |
modtronix | 10:6444e6c798ce | 337 | /* 1.31(q31) Fixed value of 2/360 */ |
modtronix | 10:6444e6c798ce | 338 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ |
modtronix | 10:6444e6c798ce | 339 | #define INPUT_SPACING 0xB60B61 |
modtronix | 10:6444e6c798ce | 340 | |
modtronix | 10:6444e6c798ce | 341 | /** |
modtronix | 10:6444e6c798ce | 342 | * @brief Macro for Unaligned Support |
modtronix | 10:6444e6c798ce | 343 | */ |
modtronix | 10:6444e6c798ce | 344 | #ifndef UNALIGNED_SUPPORT_DISABLE |
modtronix | 10:6444e6c798ce | 345 | #define ALIGN4 |
modtronix | 10:6444e6c798ce | 346 | #else |
modtronix | 10:6444e6c798ce | 347 | #if defined (__GNUC__) |
modtronix | 10:6444e6c798ce | 348 | #define ALIGN4 __attribute__((aligned(4))) |
modtronix | 10:6444e6c798ce | 349 | #else |
modtronix | 10:6444e6c798ce | 350 | #define ALIGN4 __align(4) |
modtronix | 10:6444e6c798ce | 351 | #endif |
modtronix | 10:6444e6c798ce | 352 | #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ |
modtronix | 10:6444e6c798ce | 353 | |
modtronix | 10:6444e6c798ce | 354 | /** |
modtronix | 10:6444e6c798ce | 355 | * @brief Error status returned by some functions in the library. |
modtronix | 10:6444e6c798ce | 356 | */ |
modtronix | 10:6444e6c798ce | 357 | |
modtronix | 10:6444e6c798ce | 358 | typedef enum |
modtronix | 10:6444e6c798ce | 359 | { |
modtronix | 10:6444e6c798ce | 360 | ARM_MATH_SUCCESS = 0, /**< No error */ |
modtronix | 10:6444e6c798ce | 361 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ |
modtronix | 10:6444e6c798ce | 362 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ |
modtronix | 10:6444e6c798ce | 363 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ |
modtronix | 10:6444e6c798ce | 364 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ |
modtronix | 10:6444e6c798ce | 365 | ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ |
modtronix | 10:6444e6c798ce | 366 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ |
modtronix | 10:6444e6c798ce | 367 | } arm_status; |
modtronix | 10:6444e6c798ce | 368 | |
modtronix | 10:6444e6c798ce | 369 | /** |
modtronix | 10:6444e6c798ce | 370 | * @brief 8-bit fractional data type in 1.7 format. |
modtronix | 10:6444e6c798ce | 371 | */ |
modtronix | 10:6444e6c798ce | 372 | typedef int8_t q7_t; |
modtronix | 10:6444e6c798ce | 373 | |
modtronix | 10:6444e6c798ce | 374 | /** |
modtronix | 10:6444e6c798ce | 375 | * @brief 16-bit fractional data type in 1.15 format. |
modtronix | 10:6444e6c798ce | 376 | */ |
modtronix | 10:6444e6c798ce | 377 | typedef int16_t q15_t; |
modtronix | 10:6444e6c798ce | 378 | |
modtronix | 10:6444e6c798ce | 379 | /** |
modtronix | 10:6444e6c798ce | 380 | * @brief 32-bit fractional data type in 1.31 format. |
modtronix | 10:6444e6c798ce | 381 | */ |
modtronix | 10:6444e6c798ce | 382 | typedef int32_t q31_t; |
modtronix | 10:6444e6c798ce | 383 | |
modtronix | 10:6444e6c798ce | 384 | /** |
modtronix | 10:6444e6c798ce | 385 | * @brief 64-bit fractional data type in 1.63 format. |
modtronix | 10:6444e6c798ce | 386 | */ |
modtronix | 10:6444e6c798ce | 387 | typedef int64_t q63_t; |
modtronix | 10:6444e6c798ce | 388 | |
modtronix | 10:6444e6c798ce | 389 | /** |
modtronix | 10:6444e6c798ce | 390 | * @brief 32-bit floating-point type definition. |
modtronix | 10:6444e6c798ce | 391 | */ |
modtronix | 10:6444e6c798ce | 392 | typedef float float32_t; |
modtronix | 10:6444e6c798ce | 393 | |
modtronix | 10:6444e6c798ce | 394 | /** |
modtronix | 10:6444e6c798ce | 395 | * @brief 64-bit floating-point type definition. |
modtronix | 10:6444e6c798ce | 396 | */ |
modtronix | 10:6444e6c798ce | 397 | typedef double float64_t; |
modtronix | 10:6444e6c798ce | 398 | |
modtronix | 10:6444e6c798ce | 399 | /** |
modtronix | 10:6444e6c798ce | 400 | * @brief definition to read/write two 16 bit values. |
modtronix | 10:6444e6c798ce | 401 | */ |
modtronix | 10:6444e6c798ce | 402 | #if defined __CC_ARM |
modtronix | 10:6444e6c798ce | 403 | #define __SIMD32_TYPE int32_t __packed |
modtronix | 10:6444e6c798ce | 404 | #define CMSIS_UNUSED __attribute__((unused)) |
modtronix | 10:6444e6c798ce | 405 | #elif defined __ICCARM__ |
modtronix | 10:6444e6c798ce | 406 | #define CMSIS_UNUSED |
modtronix | 10:6444e6c798ce | 407 | #define __SIMD32_TYPE int32_t __packed |
modtronix | 10:6444e6c798ce | 408 | #elif defined __GNUC__ |
modtronix | 10:6444e6c798ce | 409 | #define __SIMD32_TYPE int32_t |
modtronix | 10:6444e6c798ce | 410 | #define CMSIS_UNUSED __attribute__((unused)) |
modtronix | 10:6444e6c798ce | 411 | #elif defined __CSMC__ /* Cosmic */ |
modtronix | 10:6444e6c798ce | 412 | #define CMSIS_UNUSED |
modtronix | 10:6444e6c798ce | 413 | #define __SIMD32_TYPE int32_t |
modtronix | 10:6444e6c798ce | 414 | #else |
modtronix | 10:6444e6c798ce | 415 | #error Unknown compiler |
modtronix | 10:6444e6c798ce | 416 | #endif |
modtronix | 10:6444e6c798ce | 417 | |
modtronix | 10:6444e6c798ce | 418 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) |
modtronix | 10:6444e6c798ce | 419 | #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) |
modtronix | 10:6444e6c798ce | 420 | |
modtronix | 10:6444e6c798ce | 421 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) |
modtronix | 10:6444e6c798ce | 422 | |
modtronix | 10:6444e6c798ce | 423 | #define __SIMD64(addr) (*(int64_t **) & (addr)) |
modtronix | 10:6444e6c798ce | 424 | |
modtronix | 10:6444e6c798ce | 425 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
modtronix | 10:6444e6c798ce | 426 | /** |
modtronix | 10:6444e6c798ce | 427 | * @brief definition to pack two 16 bit values. |
modtronix | 10:6444e6c798ce | 428 | */ |
modtronix | 10:6444e6c798ce | 429 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ |
modtronix | 10:6444e6c798ce | 430 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) |
modtronix | 10:6444e6c798ce | 431 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ |
modtronix | 10:6444e6c798ce | 432 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) |
modtronix | 10:6444e6c798ce | 433 | |
modtronix | 10:6444e6c798ce | 434 | #endif |
modtronix | 10:6444e6c798ce | 435 | |
modtronix | 10:6444e6c798ce | 436 | |
modtronix | 10:6444e6c798ce | 437 | /** |
modtronix | 10:6444e6c798ce | 438 | * @brief definition to pack four 8 bit values. |
modtronix | 10:6444e6c798ce | 439 | */ |
modtronix | 10:6444e6c798ce | 440 | #ifndef ARM_MATH_BIG_ENDIAN |
modtronix | 10:6444e6c798ce | 441 | |
modtronix | 10:6444e6c798ce | 442 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ |
modtronix | 10:6444e6c798ce | 443 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ |
modtronix | 10:6444e6c798ce | 444 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ |
modtronix | 10:6444e6c798ce | 445 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) |
modtronix | 10:6444e6c798ce | 446 | #else |
modtronix | 10:6444e6c798ce | 447 | |
modtronix | 10:6444e6c798ce | 448 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ |
modtronix | 10:6444e6c798ce | 449 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ |
modtronix | 10:6444e6c798ce | 450 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ |
modtronix | 10:6444e6c798ce | 451 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) |
modtronix | 10:6444e6c798ce | 452 | |
modtronix | 10:6444e6c798ce | 453 | #endif |
modtronix | 10:6444e6c798ce | 454 | |
modtronix | 10:6444e6c798ce | 455 | |
modtronix | 10:6444e6c798ce | 456 | /** |
modtronix | 10:6444e6c798ce | 457 | * @brief Clips Q63 to Q31 values. |
modtronix | 10:6444e6c798ce | 458 | */ |
modtronix | 10:6444e6c798ce | 459 | static __INLINE q31_t clip_q63_to_q31( |
modtronix | 10:6444e6c798ce | 460 | q63_t x) |
modtronix | 10:6444e6c798ce | 461 | { |
modtronix | 10:6444e6c798ce | 462 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
modtronix | 10:6444e6c798ce | 463 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; |
modtronix | 10:6444e6c798ce | 464 | } |
modtronix | 10:6444e6c798ce | 465 | |
modtronix | 10:6444e6c798ce | 466 | /** |
modtronix | 10:6444e6c798ce | 467 | * @brief Clips Q63 to Q15 values. |
modtronix | 10:6444e6c798ce | 468 | */ |
modtronix | 10:6444e6c798ce | 469 | static __INLINE q15_t clip_q63_to_q15( |
modtronix | 10:6444e6c798ce | 470 | q63_t x) |
modtronix | 10:6444e6c798ce | 471 | { |
modtronix | 10:6444e6c798ce | 472 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
modtronix | 10:6444e6c798ce | 473 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); |
modtronix | 10:6444e6c798ce | 474 | } |
modtronix | 10:6444e6c798ce | 475 | |
modtronix | 10:6444e6c798ce | 476 | /** |
modtronix | 10:6444e6c798ce | 477 | * @brief Clips Q31 to Q7 values. |
modtronix | 10:6444e6c798ce | 478 | */ |
modtronix | 10:6444e6c798ce | 479 | static __INLINE q7_t clip_q31_to_q7( |
modtronix | 10:6444e6c798ce | 480 | q31_t x) |
modtronix | 10:6444e6c798ce | 481 | { |
modtronix | 10:6444e6c798ce | 482 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? |
modtronix | 10:6444e6c798ce | 483 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; |
modtronix | 10:6444e6c798ce | 484 | } |
modtronix | 10:6444e6c798ce | 485 | |
modtronix | 10:6444e6c798ce | 486 | /** |
modtronix | 10:6444e6c798ce | 487 | * @brief Clips Q31 to Q15 values. |
modtronix | 10:6444e6c798ce | 488 | */ |
modtronix | 10:6444e6c798ce | 489 | static __INLINE q15_t clip_q31_to_q15( |
modtronix | 10:6444e6c798ce | 490 | q31_t x) |
modtronix | 10:6444e6c798ce | 491 | { |
modtronix | 10:6444e6c798ce | 492 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? |
modtronix | 10:6444e6c798ce | 493 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; |
modtronix | 10:6444e6c798ce | 494 | } |
modtronix | 10:6444e6c798ce | 495 | |
modtronix | 10:6444e6c798ce | 496 | /** |
modtronix | 10:6444e6c798ce | 497 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. |
modtronix | 10:6444e6c798ce | 498 | */ |
modtronix | 10:6444e6c798ce | 499 | |
modtronix | 10:6444e6c798ce | 500 | static __INLINE q63_t mult32x64( |
modtronix | 10:6444e6c798ce | 501 | q63_t x, |
modtronix | 10:6444e6c798ce | 502 | q31_t y) |
modtronix | 10:6444e6c798ce | 503 | { |
modtronix | 10:6444e6c798ce | 504 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + |
modtronix | 10:6444e6c798ce | 505 | (((q63_t) (x >> 32) * y))); |
modtronix | 10:6444e6c798ce | 506 | } |
modtronix | 10:6444e6c798ce | 507 | |
modtronix | 10:6444e6c798ce | 508 | |
modtronix | 10:6444e6c798ce | 509 | #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) |
modtronix | 10:6444e6c798ce | 510 | #define __CLZ __clz |
modtronix | 10:6444e6c798ce | 511 | #endif |
modtronix | 10:6444e6c798ce | 512 | |
modtronix | 10:6444e6c798ce | 513 | #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) ) |
modtronix | 10:6444e6c798ce | 514 | |
modtronix | 10:6444e6c798ce | 515 | static __INLINE uint32_t __CLZ( |
modtronix | 10:6444e6c798ce | 516 | q31_t data); |
modtronix | 10:6444e6c798ce | 517 | |
modtronix | 10:6444e6c798ce | 518 | |
modtronix | 10:6444e6c798ce | 519 | static __INLINE uint32_t __CLZ( |
modtronix | 10:6444e6c798ce | 520 | q31_t data) |
modtronix | 10:6444e6c798ce | 521 | { |
modtronix | 10:6444e6c798ce | 522 | uint32_t count = 0; |
modtronix | 10:6444e6c798ce | 523 | uint32_t mask = 0x80000000; |
modtronix | 10:6444e6c798ce | 524 | |
modtronix | 10:6444e6c798ce | 525 | while((data & mask) == 0) |
modtronix | 10:6444e6c798ce | 526 | { |
modtronix | 10:6444e6c798ce | 527 | count += 1u; |
modtronix | 10:6444e6c798ce | 528 | mask = mask >> 1u; |
modtronix | 10:6444e6c798ce | 529 | } |
modtronix | 10:6444e6c798ce | 530 | |
modtronix | 10:6444e6c798ce | 531 | return (count); |
modtronix | 10:6444e6c798ce | 532 | |
modtronix | 10:6444e6c798ce | 533 | } |
modtronix | 10:6444e6c798ce | 534 | |
modtronix | 10:6444e6c798ce | 535 | #endif |
modtronix | 10:6444e6c798ce | 536 | |
modtronix | 10:6444e6c798ce | 537 | /** |
modtronix | 10:6444e6c798ce | 538 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. |
modtronix | 10:6444e6c798ce | 539 | */ |
modtronix | 10:6444e6c798ce | 540 | |
modtronix | 10:6444e6c798ce | 541 | static __INLINE uint32_t arm_recip_q31( |
modtronix | 10:6444e6c798ce | 542 | q31_t in, |
modtronix | 10:6444e6c798ce | 543 | q31_t * dst, |
modtronix | 10:6444e6c798ce | 544 | q31_t * pRecipTable) |
modtronix | 10:6444e6c798ce | 545 | { |
modtronix | 10:6444e6c798ce | 546 | |
modtronix | 10:6444e6c798ce | 547 | uint32_t out, tempVal; |
modtronix | 10:6444e6c798ce | 548 | uint32_t index, i; |
modtronix | 10:6444e6c798ce | 549 | uint32_t signBits; |
modtronix | 10:6444e6c798ce | 550 | |
modtronix | 10:6444e6c798ce | 551 | if(in > 0) |
modtronix | 10:6444e6c798ce | 552 | { |
modtronix | 10:6444e6c798ce | 553 | signBits = __CLZ(in) - 1; |
modtronix | 10:6444e6c798ce | 554 | } |
modtronix | 10:6444e6c798ce | 555 | else |
modtronix | 10:6444e6c798ce | 556 | { |
modtronix | 10:6444e6c798ce | 557 | signBits = __CLZ(-in) - 1; |
modtronix | 10:6444e6c798ce | 558 | } |
modtronix | 10:6444e6c798ce | 559 | |
modtronix | 10:6444e6c798ce | 560 | /* Convert input sample to 1.31 format */ |
modtronix | 10:6444e6c798ce | 561 | in = in << signBits; |
modtronix | 10:6444e6c798ce | 562 | |
modtronix | 10:6444e6c798ce | 563 | /* calculation of index for initial approximated Val */ |
modtronix | 10:6444e6c798ce | 564 | index = (uint32_t) (in >> 24u); |
modtronix | 10:6444e6c798ce | 565 | index = (index & INDEX_MASK); |
modtronix | 10:6444e6c798ce | 566 | |
modtronix | 10:6444e6c798ce | 567 | /* 1.31 with exp 1 */ |
modtronix | 10:6444e6c798ce | 568 | out = pRecipTable[index]; |
modtronix | 10:6444e6c798ce | 569 | |
modtronix | 10:6444e6c798ce | 570 | /* calculation of reciprocal value */ |
modtronix | 10:6444e6c798ce | 571 | /* running approximation for two iterations */ |
modtronix | 10:6444e6c798ce | 572 | for (i = 0u; i < 2u; i++) |
modtronix | 10:6444e6c798ce | 573 | { |
modtronix | 10:6444e6c798ce | 574 | tempVal = (q31_t) (((q63_t) in * out) >> 31u); |
modtronix | 10:6444e6c798ce | 575 | tempVal = 0x7FFFFFFF - tempVal; |
modtronix | 10:6444e6c798ce | 576 | /* 1.31 with exp 1 */ |
modtronix | 10:6444e6c798ce | 577 | //out = (q31_t) (((q63_t) out * tempVal) >> 30u); |
modtronix | 10:6444e6c798ce | 578 | out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u); |
modtronix | 10:6444e6c798ce | 579 | } |
modtronix | 10:6444e6c798ce | 580 | |
modtronix | 10:6444e6c798ce | 581 | /* write output */ |
modtronix | 10:6444e6c798ce | 582 | *dst = out; |
modtronix | 10:6444e6c798ce | 583 | |
modtronix | 10:6444e6c798ce | 584 | /* return num of signbits of out = 1/in value */ |
modtronix | 10:6444e6c798ce | 585 | return (signBits + 1u); |
modtronix | 10:6444e6c798ce | 586 | |
modtronix | 10:6444e6c798ce | 587 | } |
modtronix | 10:6444e6c798ce | 588 | |
modtronix | 10:6444e6c798ce | 589 | /** |
modtronix | 10:6444e6c798ce | 590 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. |
modtronix | 10:6444e6c798ce | 591 | */ |
modtronix | 10:6444e6c798ce | 592 | static __INLINE uint32_t arm_recip_q15( |
modtronix | 10:6444e6c798ce | 593 | q15_t in, |
modtronix | 10:6444e6c798ce | 594 | q15_t * dst, |
modtronix | 10:6444e6c798ce | 595 | q15_t * pRecipTable) |
modtronix | 10:6444e6c798ce | 596 | { |
modtronix | 10:6444e6c798ce | 597 | |
modtronix | 10:6444e6c798ce | 598 | uint32_t out = 0, tempVal = 0; |
modtronix | 10:6444e6c798ce | 599 | uint32_t index = 0, i = 0; |
modtronix | 10:6444e6c798ce | 600 | uint32_t signBits = 0; |
modtronix | 10:6444e6c798ce | 601 | |
modtronix | 10:6444e6c798ce | 602 | if(in > 0) |
modtronix | 10:6444e6c798ce | 603 | { |
modtronix | 10:6444e6c798ce | 604 | signBits = __CLZ(in) - 17; |
modtronix | 10:6444e6c798ce | 605 | } |
modtronix | 10:6444e6c798ce | 606 | else |
modtronix | 10:6444e6c798ce | 607 | { |
modtronix | 10:6444e6c798ce | 608 | signBits = __CLZ(-in) - 17; |
modtronix | 10:6444e6c798ce | 609 | } |
modtronix | 10:6444e6c798ce | 610 | |
modtronix | 10:6444e6c798ce | 611 | /* Convert input sample to 1.15 format */ |
modtronix | 10:6444e6c798ce | 612 | in = in << signBits; |
modtronix | 10:6444e6c798ce | 613 | |
modtronix | 10:6444e6c798ce | 614 | /* calculation of index for initial approximated Val */ |
modtronix | 10:6444e6c798ce | 615 | index = in >> 8; |
modtronix | 10:6444e6c798ce | 616 | index = (index & INDEX_MASK); |
modtronix | 10:6444e6c798ce | 617 | |
modtronix | 10:6444e6c798ce | 618 | /* 1.15 with exp 1 */ |
modtronix | 10:6444e6c798ce | 619 | out = pRecipTable[index]; |
modtronix | 10:6444e6c798ce | 620 | |
modtronix | 10:6444e6c798ce | 621 | /* calculation of reciprocal value */ |
modtronix | 10:6444e6c798ce | 622 | /* running approximation for two iterations */ |
modtronix | 10:6444e6c798ce | 623 | for (i = 0; i < 2; i++) |
modtronix | 10:6444e6c798ce | 624 | { |
modtronix | 10:6444e6c798ce | 625 | tempVal = (q15_t) (((q31_t) in * out) >> 15); |
modtronix | 10:6444e6c798ce | 626 | tempVal = 0x7FFF - tempVal; |
modtronix | 10:6444e6c798ce | 627 | /* 1.15 with exp 1 */ |
modtronix | 10:6444e6c798ce | 628 | out = (q15_t) (((q31_t) out * tempVal) >> 14); |
modtronix | 10:6444e6c798ce | 629 | } |
modtronix | 10:6444e6c798ce | 630 | |
modtronix | 10:6444e6c798ce | 631 | /* write output */ |
modtronix | 10:6444e6c798ce | 632 | *dst = out; |
modtronix | 10:6444e6c798ce | 633 | |
modtronix | 10:6444e6c798ce | 634 | /* return num of signbits of out = 1/in value */ |
modtronix | 10:6444e6c798ce | 635 | return (signBits + 1); |
modtronix | 10:6444e6c798ce | 636 | |
modtronix | 10:6444e6c798ce | 637 | } |
modtronix | 10:6444e6c798ce | 638 | |
modtronix | 10:6444e6c798ce | 639 | |
modtronix | 10:6444e6c798ce | 640 | /* |
modtronix | 10:6444e6c798ce | 641 | * @brief C custom defined intrinisic function for only M0 processors |
modtronix | 10:6444e6c798ce | 642 | */ |
modtronix | 10:6444e6c798ce | 643 | #if defined(ARM_MATH_CM0_FAMILY) |
modtronix | 10:6444e6c798ce | 644 | |
modtronix | 10:6444e6c798ce | 645 | static __INLINE q31_t __SSAT( |
modtronix | 10:6444e6c798ce | 646 | q31_t x, |
modtronix | 10:6444e6c798ce | 647 | uint32_t y) |
modtronix | 10:6444e6c798ce | 648 | { |
modtronix | 10:6444e6c798ce | 649 | int32_t posMax, negMin; |
modtronix | 10:6444e6c798ce | 650 | uint32_t i; |
modtronix | 10:6444e6c798ce | 651 | |
modtronix | 10:6444e6c798ce | 652 | posMax = 1; |
modtronix | 10:6444e6c798ce | 653 | for (i = 0; i < (y - 1); i++) |
modtronix | 10:6444e6c798ce | 654 | { |
modtronix | 10:6444e6c798ce | 655 | posMax = posMax * 2; |
modtronix | 10:6444e6c798ce | 656 | } |
modtronix | 10:6444e6c798ce | 657 | |
modtronix | 10:6444e6c798ce | 658 | if(x > 0) |
modtronix | 10:6444e6c798ce | 659 | { |
modtronix | 10:6444e6c798ce | 660 | posMax = (posMax - 1); |
modtronix | 10:6444e6c798ce | 661 | |
modtronix | 10:6444e6c798ce | 662 | if(x > posMax) |
modtronix | 10:6444e6c798ce | 663 | { |
modtronix | 10:6444e6c798ce | 664 | x = posMax; |
modtronix | 10:6444e6c798ce | 665 | } |
modtronix | 10:6444e6c798ce | 666 | } |
modtronix | 10:6444e6c798ce | 667 | else |
modtronix | 10:6444e6c798ce | 668 | { |
modtronix | 10:6444e6c798ce | 669 | negMin = -posMax; |
modtronix | 10:6444e6c798ce | 670 | |
modtronix | 10:6444e6c798ce | 671 | if(x < negMin) |
modtronix | 10:6444e6c798ce | 672 | { |
modtronix | 10:6444e6c798ce | 673 | x = negMin; |
modtronix | 10:6444e6c798ce | 674 | } |
modtronix | 10:6444e6c798ce | 675 | } |
modtronix | 10:6444e6c798ce | 676 | return (x); |
modtronix | 10:6444e6c798ce | 677 | |
modtronix | 10:6444e6c798ce | 678 | |
modtronix | 10:6444e6c798ce | 679 | } |
modtronix | 10:6444e6c798ce | 680 | |
modtronix | 10:6444e6c798ce | 681 | #endif /* end of ARM_MATH_CM0_FAMILY */ |
modtronix | 10:6444e6c798ce | 682 | |
modtronix | 10:6444e6c798ce | 683 | |
modtronix | 10:6444e6c798ce | 684 | |
modtronix | 10:6444e6c798ce | 685 | /* |
modtronix | 10:6444e6c798ce | 686 | * @brief C custom defined intrinsic function for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 687 | */ |
modtronix | 10:6444e6c798ce | 688 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
modtronix | 10:6444e6c798ce | 689 | |
modtronix | 10:6444e6c798ce | 690 | /* |
modtronix | 10:6444e6c798ce | 691 | * @brief C custom defined QADD8 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 692 | */ |
modtronix | 10:6444e6c798ce | 693 | static __INLINE q31_t __QADD8( |
modtronix | 10:6444e6c798ce | 694 | q31_t x, |
modtronix | 10:6444e6c798ce | 695 | q31_t y) |
modtronix | 10:6444e6c798ce | 696 | { |
modtronix | 10:6444e6c798ce | 697 | |
modtronix | 10:6444e6c798ce | 698 | q31_t sum; |
modtronix | 10:6444e6c798ce | 699 | q7_t r, s, t, u; |
modtronix | 10:6444e6c798ce | 700 | |
modtronix | 10:6444e6c798ce | 701 | r = (q7_t) x; |
modtronix | 10:6444e6c798ce | 702 | s = (q7_t) y; |
modtronix | 10:6444e6c798ce | 703 | |
modtronix | 10:6444e6c798ce | 704 | r = __SSAT((q31_t) (r + s), 8); |
modtronix | 10:6444e6c798ce | 705 | s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8); |
modtronix | 10:6444e6c798ce | 706 | t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8); |
modtronix | 10:6444e6c798ce | 707 | u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8); |
modtronix | 10:6444e6c798ce | 708 | |
modtronix | 10:6444e6c798ce | 709 | sum = |
modtronix | 10:6444e6c798ce | 710 | (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) | |
modtronix | 10:6444e6c798ce | 711 | (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF); |
modtronix | 10:6444e6c798ce | 712 | |
modtronix | 10:6444e6c798ce | 713 | return sum; |
modtronix | 10:6444e6c798ce | 714 | |
modtronix | 10:6444e6c798ce | 715 | } |
modtronix | 10:6444e6c798ce | 716 | |
modtronix | 10:6444e6c798ce | 717 | /* |
modtronix | 10:6444e6c798ce | 718 | * @brief C custom defined QSUB8 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 719 | */ |
modtronix | 10:6444e6c798ce | 720 | static __INLINE q31_t __QSUB8( |
modtronix | 10:6444e6c798ce | 721 | q31_t x, |
modtronix | 10:6444e6c798ce | 722 | q31_t y) |
modtronix | 10:6444e6c798ce | 723 | { |
modtronix | 10:6444e6c798ce | 724 | |
modtronix | 10:6444e6c798ce | 725 | q31_t sum; |
modtronix | 10:6444e6c798ce | 726 | q31_t r, s, t, u; |
modtronix | 10:6444e6c798ce | 727 | |
modtronix | 10:6444e6c798ce | 728 | r = (q7_t) x; |
modtronix | 10:6444e6c798ce | 729 | s = (q7_t) y; |
modtronix | 10:6444e6c798ce | 730 | |
modtronix | 10:6444e6c798ce | 731 | r = __SSAT((r - s), 8); |
modtronix | 10:6444e6c798ce | 732 | s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8; |
modtronix | 10:6444e6c798ce | 733 | t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16; |
modtronix | 10:6444e6c798ce | 734 | u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24; |
modtronix | 10:6444e6c798ce | 735 | |
modtronix | 10:6444e6c798ce | 736 | sum = |
modtronix | 10:6444e6c798ce | 737 | (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & |
modtronix | 10:6444e6c798ce | 738 | 0x000000FF); |
modtronix | 10:6444e6c798ce | 739 | |
modtronix | 10:6444e6c798ce | 740 | return sum; |
modtronix | 10:6444e6c798ce | 741 | } |
modtronix | 10:6444e6c798ce | 742 | |
modtronix | 10:6444e6c798ce | 743 | /* |
modtronix | 10:6444e6c798ce | 744 | * @brief C custom defined QADD16 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 745 | */ |
modtronix | 10:6444e6c798ce | 746 | |
modtronix | 10:6444e6c798ce | 747 | /* |
modtronix | 10:6444e6c798ce | 748 | * @brief C custom defined QADD16 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 749 | */ |
modtronix | 10:6444e6c798ce | 750 | static __INLINE q31_t __QADD16( |
modtronix | 10:6444e6c798ce | 751 | q31_t x, |
modtronix | 10:6444e6c798ce | 752 | q31_t y) |
modtronix | 10:6444e6c798ce | 753 | { |
modtronix | 10:6444e6c798ce | 754 | |
modtronix | 10:6444e6c798ce | 755 | q31_t sum; |
modtronix | 10:6444e6c798ce | 756 | q31_t r, s; |
modtronix | 10:6444e6c798ce | 757 | |
modtronix | 10:6444e6c798ce | 758 | r = (q15_t) x; |
modtronix | 10:6444e6c798ce | 759 | s = (q15_t) y; |
modtronix | 10:6444e6c798ce | 760 | |
modtronix | 10:6444e6c798ce | 761 | r = __SSAT(r + s, 16); |
modtronix | 10:6444e6c798ce | 762 | s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16; |
modtronix | 10:6444e6c798ce | 763 | |
modtronix | 10:6444e6c798ce | 764 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
modtronix | 10:6444e6c798ce | 765 | |
modtronix | 10:6444e6c798ce | 766 | return sum; |
modtronix | 10:6444e6c798ce | 767 | |
modtronix | 10:6444e6c798ce | 768 | } |
modtronix | 10:6444e6c798ce | 769 | |
modtronix | 10:6444e6c798ce | 770 | /* |
modtronix | 10:6444e6c798ce | 771 | * @brief C custom defined SHADD16 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 772 | */ |
modtronix | 10:6444e6c798ce | 773 | static __INLINE q31_t __SHADD16( |
modtronix | 10:6444e6c798ce | 774 | q31_t x, |
modtronix | 10:6444e6c798ce | 775 | q31_t y) |
modtronix | 10:6444e6c798ce | 776 | { |
modtronix | 10:6444e6c798ce | 777 | |
modtronix | 10:6444e6c798ce | 778 | q31_t sum; |
modtronix | 10:6444e6c798ce | 779 | q31_t r, s; |
modtronix | 10:6444e6c798ce | 780 | |
modtronix | 10:6444e6c798ce | 781 | r = (q15_t) x; |
modtronix | 10:6444e6c798ce | 782 | s = (q15_t) y; |
modtronix | 10:6444e6c798ce | 783 | |
modtronix | 10:6444e6c798ce | 784 | r = ((r >> 1) + (s >> 1)); |
modtronix | 10:6444e6c798ce | 785 | s = ((q31_t) ((x >> 17) + (y >> 17))) << 16; |
modtronix | 10:6444e6c798ce | 786 | |
modtronix | 10:6444e6c798ce | 787 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
modtronix | 10:6444e6c798ce | 788 | |
modtronix | 10:6444e6c798ce | 789 | return sum; |
modtronix | 10:6444e6c798ce | 790 | |
modtronix | 10:6444e6c798ce | 791 | } |
modtronix | 10:6444e6c798ce | 792 | |
modtronix | 10:6444e6c798ce | 793 | /* |
modtronix | 10:6444e6c798ce | 794 | * @brief C custom defined QSUB16 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 795 | */ |
modtronix | 10:6444e6c798ce | 796 | static __INLINE q31_t __QSUB16( |
modtronix | 10:6444e6c798ce | 797 | q31_t x, |
modtronix | 10:6444e6c798ce | 798 | q31_t y) |
modtronix | 10:6444e6c798ce | 799 | { |
modtronix | 10:6444e6c798ce | 800 | |
modtronix | 10:6444e6c798ce | 801 | q31_t sum; |
modtronix | 10:6444e6c798ce | 802 | q31_t r, s; |
modtronix | 10:6444e6c798ce | 803 | |
modtronix | 10:6444e6c798ce | 804 | r = (q15_t) x; |
modtronix | 10:6444e6c798ce | 805 | s = (q15_t) y; |
modtronix | 10:6444e6c798ce | 806 | |
modtronix | 10:6444e6c798ce | 807 | r = __SSAT(r - s, 16); |
modtronix | 10:6444e6c798ce | 808 | s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16; |
modtronix | 10:6444e6c798ce | 809 | |
modtronix | 10:6444e6c798ce | 810 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
modtronix | 10:6444e6c798ce | 811 | |
modtronix | 10:6444e6c798ce | 812 | return sum; |
modtronix | 10:6444e6c798ce | 813 | } |
modtronix | 10:6444e6c798ce | 814 | |
modtronix | 10:6444e6c798ce | 815 | /* |
modtronix | 10:6444e6c798ce | 816 | * @brief C custom defined SHSUB16 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 817 | */ |
modtronix | 10:6444e6c798ce | 818 | static __INLINE q31_t __SHSUB16( |
modtronix | 10:6444e6c798ce | 819 | q31_t x, |
modtronix | 10:6444e6c798ce | 820 | q31_t y) |
modtronix | 10:6444e6c798ce | 821 | { |
modtronix | 10:6444e6c798ce | 822 | |
modtronix | 10:6444e6c798ce | 823 | q31_t diff; |
modtronix | 10:6444e6c798ce | 824 | q31_t r, s; |
modtronix | 10:6444e6c798ce | 825 | |
modtronix | 10:6444e6c798ce | 826 | r = (q15_t) x; |
modtronix | 10:6444e6c798ce | 827 | s = (q15_t) y; |
modtronix | 10:6444e6c798ce | 828 | |
modtronix | 10:6444e6c798ce | 829 | r = ((r >> 1) - (s >> 1)); |
modtronix | 10:6444e6c798ce | 830 | s = (((x >> 17) - (y >> 17)) << 16); |
modtronix | 10:6444e6c798ce | 831 | |
modtronix | 10:6444e6c798ce | 832 | diff = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
modtronix | 10:6444e6c798ce | 833 | |
modtronix | 10:6444e6c798ce | 834 | return diff; |
modtronix | 10:6444e6c798ce | 835 | } |
modtronix | 10:6444e6c798ce | 836 | |
modtronix | 10:6444e6c798ce | 837 | /* |
modtronix | 10:6444e6c798ce | 838 | * @brief C custom defined QASX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 839 | */ |
modtronix | 10:6444e6c798ce | 840 | static __INLINE q31_t __QASX( |
modtronix | 10:6444e6c798ce | 841 | q31_t x, |
modtronix | 10:6444e6c798ce | 842 | q31_t y) |
modtronix | 10:6444e6c798ce | 843 | { |
modtronix | 10:6444e6c798ce | 844 | |
modtronix | 10:6444e6c798ce | 845 | q31_t sum = 0; |
modtronix | 10:6444e6c798ce | 846 | |
modtronix | 10:6444e6c798ce | 847 | sum = |
modtronix | 10:6444e6c798ce | 848 | ((sum + |
modtronix | 10:6444e6c798ce | 849 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) + |
modtronix | 10:6444e6c798ce | 850 | clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16))); |
modtronix | 10:6444e6c798ce | 851 | |
modtronix | 10:6444e6c798ce | 852 | return sum; |
modtronix | 10:6444e6c798ce | 853 | } |
modtronix | 10:6444e6c798ce | 854 | |
modtronix | 10:6444e6c798ce | 855 | /* |
modtronix | 10:6444e6c798ce | 856 | * @brief C custom defined SHASX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 857 | */ |
modtronix | 10:6444e6c798ce | 858 | static __INLINE q31_t __SHASX( |
modtronix | 10:6444e6c798ce | 859 | q31_t x, |
modtronix | 10:6444e6c798ce | 860 | q31_t y) |
modtronix | 10:6444e6c798ce | 861 | { |
modtronix | 10:6444e6c798ce | 862 | |
modtronix | 10:6444e6c798ce | 863 | q31_t sum; |
modtronix | 10:6444e6c798ce | 864 | q31_t r, s; |
modtronix | 10:6444e6c798ce | 865 | |
modtronix | 10:6444e6c798ce | 866 | r = (q15_t) x; |
modtronix | 10:6444e6c798ce | 867 | s = (q15_t) y; |
modtronix | 10:6444e6c798ce | 868 | |
modtronix | 10:6444e6c798ce | 869 | r = ((r >> 1) - (y >> 17)); |
modtronix | 10:6444e6c798ce | 870 | s = (((x >> 17) + (s >> 1)) << 16); |
modtronix | 10:6444e6c798ce | 871 | |
modtronix | 10:6444e6c798ce | 872 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
modtronix | 10:6444e6c798ce | 873 | |
modtronix | 10:6444e6c798ce | 874 | return sum; |
modtronix | 10:6444e6c798ce | 875 | } |
modtronix | 10:6444e6c798ce | 876 | |
modtronix | 10:6444e6c798ce | 877 | |
modtronix | 10:6444e6c798ce | 878 | /* |
modtronix | 10:6444e6c798ce | 879 | * @brief C custom defined QSAX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 880 | */ |
modtronix | 10:6444e6c798ce | 881 | static __INLINE q31_t __QSAX( |
modtronix | 10:6444e6c798ce | 882 | q31_t x, |
modtronix | 10:6444e6c798ce | 883 | q31_t y) |
modtronix | 10:6444e6c798ce | 884 | { |
modtronix | 10:6444e6c798ce | 885 | |
modtronix | 10:6444e6c798ce | 886 | q31_t sum = 0; |
modtronix | 10:6444e6c798ce | 887 | |
modtronix | 10:6444e6c798ce | 888 | sum = |
modtronix | 10:6444e6c798ce | 889 | ((sum + |
modtronix | 10:6444e6c798ce | 890 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) + |
modtronix | 10:6444e6c798ce | 891 | clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16))); |
modtronix | 10:6444e6c798ce | 892 | |
modtronix | 10:6444e6c798ce | 893 | return sum; |
modtronix | 10:6444e6c798ce | 894 | } |
modtronix | 10:6444e6c798ce | 895 | |
modtronix | 10:6444e6c798ce | 896 | /* |
modtronix | 10:6444e6c798ce | 897 | * @brief C custom defined SHSAX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 898 | */ |
modtronix | 10:6444e6c798ce | 899 | static __INLINE q31_t __SHSAX( |
modtronix | 10:6444e6c798ce | 900 | q31_t x, |
modtronix | 10:6444e6c798ce | 901 | q31_t y) |
modtronix | 10:6444e6c798ce | 902 | { |
modtronix | 10:6444e6c798ce | 903 | |
modtronix | 10:6444e6c798ce | 904 | q31_t sum; |
modtronix | 10:6444e6c798ce | 905 | q31_t r, s; |
modtronix | 10:6444e6c798ce | 906 | |
modtronix | 10:6444e6c798ce | 907 | r = (q15_t) x; |
modtronix | 10:6444e6c798ce | 908 | s = (q15_t) y; |
modtronix | 10:6444e6c798ce | 909 | |
modtronix | 10:6444e6c798ce | 910 | r = ((r >> 1) + (y >> 17)); |
modtronix | 10:6444e6c798ce | 911 | s = (((x >> 17) - (s >> 1)) << 16); |
modtronix | 10:6444e6c798ce | 912 | |
modtronix | 10:6444e6c798ce | 913 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
modtronix | 10:6444e6c798ce | 914 | |
modtronix | 10:6444e6c798ce | 915 | return sum; |
modtronix | 10:6444e6c798ce | 916 | } |
modtronix | 10:6444e6c798ce | 917 | |
modtronix | 10:6444e6c798ce | 918 | /* |
modtronix | 10:6444e6c798ce | 919 | * @brief C custom defined SMUSDX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 920 | */ |
modtronix | 10:6444e6c798ce | 921 | static __INLINE q31_t __SMUSDX( |
modtronix | 10:6444e6c798ce | 922 | q31_t x, |
modtronix | 10:6444e6c798ce | 923 | q31_t y) |
modtronix | 10:6444e6c798ce | 924 | { |
modtronix | 10:6444e6c798ce | 925 | |
modtronix | 10:6444e6c798ce | 926 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) - |
modtronix | 10:6444e6c798ce | 927 | ((q15_t) (x >> 16) * (q15_t) y))); |
modtronix | 10:6444e6c798ce | 928 | } |
modtronix | 10:6444e6c798ce | 929 | |
modtronix | 10:6444e6c798ce | 930 | /* |
modtronix | 10:6444e6c798ce | 931 | * @brief C custom defined SMUADX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 932 | */ |
modtronix | 10:6444e6c798ce | 933 | static __INLINE q31_t __SMUADX( |
modtronix | 10:6444e6c798ce | 934 | q31_t x, |
modtronix | 10:6444e6c798ce | 935 | q31_t y) |
modtronix | 10:6444e6c798ce | 936 | { |
modtronix | 10:6444e6c798ce | 937 | |
modtronix | 10:6444e6c798ce | 938 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) + |
modtronix | 10:6444e6c798ce | 939 | ((q15_t) (x >> 16) * (q15_t) y))); |
modtronix | 10:6444e6c798ce | 940 | } |
modtronix | 10:6444e6c798ce | 941 | |
modtronix | 10:6444e6c798ce | 942 | /* |
modtronix | 10:6444e6c798ce | 943 | * @brief C custom defined QADD for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 944 | */ |
modtronix | 10:6444e6c798ce | 945 | static __INLINE q31_t __QADD( |
modtronix | 10:6444e6c798ce | 946 | q31_t x, |
modtronix | 10:6444e6c798ce | 947 | q31_t y) |
modtronix | 10:6444e6c798ce | 948 | { |
modtronix | 10:6444e6c798ce | 949 | return clip_q63_to_q31((q63_t) x + y); |
modtronix | 10:6444e6c798ce | 950 | } |
modtronix | 10:6444e6c798ce | 951 | |
modtronix | 10:6444e6c798ce | 952 | /* |
modtronix | 10:6444e6c798ce | 953 | * @brief C custom defined QSUB for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 954 | */ |
modtronix | 10:6444e6c798ce | 955 | static __INLINE q31_t __QSUB( |
modtronix | 10:6444e6c798ce | 956 | q31_t x, |
modtronix | 10:6444e6c798ce | 957 | q31_t y) |
modtronix | 10:6444e6c798ce | 958 | { |
modtronix | 10:6444e6c798ce | 959 | return clip_q63_to_q31((q63_t) x - y); |
modtronix | 10:6444e6c798ce | 960 | } |
modtronix | 10:6444e6c798ce | 961 | |
modtronix | 10:6444e6c798ce | 962 | /* |
modtronix | 10:6444e6c798ce | 963 | * @brief C custom defined SMLAD for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 964 | */ |
modtronix | 10:6444e6c798ce | 965 | static __INLINE q31_t __SMLAD( |
modtronix | 10:6444e6c798ce | 966 | q31_t x, |
modtronix | 10:6444e6c798ce | 967 | q31_t y, |
modtronix | 10:6444e6c798ce | 968 | q31_t sum) |
modtronix | 10:6444e6c798ce | 969 | { |
modtronix | 10:6444e6c798ce | 970 | |
modtronix | 10:6444e6c798ce | 971 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
modtronix | 10:6444e6c798ce | 972 | ((q15_t) x * (q15_t) y)); |
modtronix | 10:6444e6c798ce | 973 | } |
modtronix | 10:6444e6c798ce | 974 | |
modtronix | 10:6444e6c798ce | 975 | /* |
modtronix | 10:6444e6c798ce | 976 | * @brief C custom defined SMLADX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 977 | */ |
modtronix | 10:6444e6c798ce | 978 | static __INLINE q31_t __SMLADX( |
modtronix | 10:6444e6c798ce | 979 | q31_t x, |
modtronix | 10:6444e6c798ce | 980 | q31_t y, |
modtronix | 10:6444e6c798ce | 981 | q31_t sum) |
modtronix | 10:6444e6c798ce | 982 | { |
modtronix | 10:6444e6c798ce | 983 | |
modtronix | 10:6444e6c798ce | 984 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) + |
modtronix | 10:6444e6c798ce | 985 | ((q15_t) x * (q15_t) (y >> 16))); |
modtronix | 10:6444e6c798ce | 986 | } |
modtronix | 10:6444e6c798ce | 987 | |
modtronix | 10:6444e6c798ce | 988 | /* |
modtronix | 10:6444e6c798ce | 989 | * @brief C custom defined SMLSDX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 990 | */ |
modtronix | 10:6444e6c798ce | 991 | static __INLINE q31_t __SMLSDX( |
modtronix | 10:6444e6c798ce | 992 | q31_t x, |
modtronix | 10:6444e6c798ce | 993 | q31_t y, |
modtronix | 10:6444e6c798ce | 994 | q31_t sum) |
modtronix | 10:6444e6c798ce | 995 | { |
modtronix | 10:6444e6c798ce | 996 | |
modtronix | 10:6444e6c798ce | 997 | return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) + |
modtronix | 10:6444e6c798ce | 998 | ((q15_t) x * (q15_t) (y >> 16))); |
modtronix | 10:6444e6c798ce | 999 | } |
modtronix | 10:6444e6c798ce | 1000 | |
modtronix | 10:6444e6c798ce | 1001 | /* |
modtronix | 10:6444e6c798ce | 1002 | * @brief C custom defined SMLALD for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 1003 | */ |
modtronix | 10:6444e6c798ce | 1004 | static __INLINE q63_t __SMLALD( |
modtronix | 10:6444e6c798ce | 1005 | q31_t x, |
modtronix | 10:6444e6c798ce | 1006 | q31_t y, |
modtronix | 10:6444e6c798ce | 1007 | q63_t sum) |
modtronix | 10:6444e6c798ce | 1008 | { |
modtronix | 10:6444e6c798ce | 1009 | |
modtronix | 10:6444e6c798ce | 1010 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
modtronix | 10:6444e6c798ce | 1011 | ((q15_t) x * (q15_t) y)); |
modtronix | 10:6444e6c798ce | 1012 | } |
modtronix | 10:6444e6c798ce | 1013 | |
modtronix | 10:6444e6c798ce | 1014 | /* |
modtronix | 10:6444e6c798ce | 1015 | * @brief C custom defined SMLALDX for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 1016 | */ |
modtronix | 10:6444e6c798ce | 1017 | static __INLINE q63_t __SMLALDX( |
modtronix | 10:6444e6c798ce | 1018 | q31_t x, |
modtronix | 10:6444e6c798ce | 1019 | q31_t y, |
modtronix | 10:6444e6c798ce | 1020 | q63_t sum) |
modtronix | 10:6444e6c798ce | 1021 | { |
modtronix | 10:6444e6c798ce | 1022 | |
modtronix | 10:6444e6c798ce | 1023 | return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + |
modtronix | 10:6444e6c798ce | 1024 | ((q15_t) x * (q15_t) (y >> 16)); |
modtronix | 10:6444e6c798ce | 1025 | } |
modtronix | 10:6444e6c798ce | 1026 | |
modtronix | 10:6444e6c798ce | 1027 | /* |
modtronix | 10:6444e6c798ce | 1028 | * @brief C custom defined SMUAD for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 1029 | */ |
modtronix | 10:6444e6c798ce | 1030 | static __INLINE q31_t __SMUAD( |
modtronix | 10:6444e6c798ce | 1031 | q31_t x, |
modtronix | 10:6444e6c798ce | 1032 | q31_t y) |
modtronix | 10:6444e6c798ce | 1033 | { |
modtronix | 10:6444e6c798ce | 1034 | |
modtronix | 10:6444e6c798ce | 1035 | return (((x >> 16) * (y >> 16)) + |
modtronix | 10:6444e6c798ce | 1036 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
modtronix | 10:6444e6c798ce | 1037 | } |
modtronix | 10:6444e6c798ce | 1038 | |
modtronix | 10:6444e6c798ce | 1039 | /* |
modtronix | 10:6444e6c798ce | 1040 | * @brief C custom defined SMUSD for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 1041 | */ |
modtronix | 10:6444e6c798ce | 1042 | static __INLINE q31_t __SMUSD( |
modtronix | 10:6444e6c798ce | 1043 | q31_t x, |
modtronix | 10:6444e6c798ce | 1044 | q31_t y) |
modtronix | 10:6444e6c798ce | 1045 | { |
modtronix | 10:6444e6c798ce | 1046 | |
modtronix | 10:6444e6c798ce | 1047 | return (-((x >> 16) * (y >> 16)) + |
modtronix | 10:6444e6c798ce | 1048 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
modtronix | 10:6444e6c798ce | 1049 | } |
modtronix | 10:6444e6c798ce | 1050 | |
modtronix | 10:6444e6c798ce | 1051 | |
modtronix | 10:6444e6c798ce | 1052 | /* |
modtronix | 10:6444e6c798ce | 1053 | * @brief C custom defined SXTB16 for M3 and M0 processors |
modtronix | 10:6444e6c798ce | 1054 | */ |
modtronix | 10:6444e6c798ce | 1055 | static __INLINE q31_t __SXTB16( |
modtronix | 10:6444e6c798ce | 1056 | q31_t x) |
modtronix | 10:6444e6c798ce | 1057 | { |
modtronix | 10:6444e6c798ce | 1058 | |
modtronix | 10:6444e6c798ce | 1059 | return ((((x << 24) >> 24) & 0x0000FFFF) | |
modtronix | 10:6444e6c798ce | 1060 | (((x << 8) >> 8) & 0xFFFF0000)); |
modtronix | 10:6444e6c798ce | 1061 | } |
modtronix | 10:6444e6c798ce | 1062 | |
modtronix | 10:6444e6c798ce | 1063 | |
modtronix | 10:6444e6c798ce | 1064 | #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ |
modtronix | 10:6444e6c798ce | 1065 | |
modtronix | 10:6444e6c798ce | 1066 | |
modtronix | 10:6444e6c798ce | 1067 | /** |
modtronix | 10:6444e6c798ce | 1068 | * @brief Instance structure for the Q7 FIR filter. |
modtronix | 10:6444e6c798ce | 1069 | */ |
modtronix | 10:6444e6c798ce | 1070 | typedef struct |
modtronix | 10:6444e6c798ce | 1071 | { |
modtronix | 10:6444e6c798ce | 1072 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 1073 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 1074 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 1075 | } arm_fir_instance_q7; |
modtronix | 10:6444e6c798ce | 1076 | |
modtronix | 10:6444e6c798ce | 1077 | /** |
modtronix | 10:6444e6c798ce | 1078 | * @brief Instance structure for the Q15 FIR filter. |
modtronix | 10:6444e6c798ce | 1079 | */ |
modtronix | 10:6444e6c798ce | 1080 | typedef struct |
modtronix | 10:6444e6c798ce | 1081 | { |
modtronix | 10:6444e6c798ce | 1082 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 1083 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 1084 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 1085 | } arm_fir_instance_q15; |
modtronix | 10:6444e6c798ce | 1086 | |
modtronix | 10:6444e6c798ce | 1087 | /** |
modtronix | 10:6444e6c798ce | 1088 | * @brief Instance structure for the Q31 FIR filter. |
modtronix | 10:6444e6c798ce | 1089 | */ |
modtronix | 10:6444e6c798ce | 1090 | typedef struct |
modtronix | 10:6444e6c798ce | 1091 | { |
modtronix | 10:6444e6c798ce | 1092 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 1093 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 1094 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 1095 | } arm_fir_instance_q31; |
modtronix | 10:6444e6c798ce | 1096 | |
modtronix | 10:6444e6c798ce | 1097 | /** |
modtronix | 10:6444e6c798ce | 1098 | * @brief Instance structure for the floating-point FIR filter. |
modtronix | 10:6444e6c798ce | 1099 | */ |
modtronix | 10:6444e6c798ce | 1100 | typedef struct |
modtronix | 10:6444e6c798ce | 1101 | { |
modtronix | 10:6444e6c798ce | 1102 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 1103 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 1104 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 1105 | } arm_fir_instance_f32; |
modtronix | 10:6444e6c798ce | 1106 | |
modtronix | 10:6444e6c798ce | 1107 | |
modtronix | 10:6444e6c798ce | 1108 | /** |
modtronix | 10:6444e6c798ce | 1109 | * @brief Processing function for the Q7 FIR filter. |
modtronix | 10:6444e6c798ce | 1110 | * @param[in] *S points to an instance of the Q7 FIR filter structure. |
modtronix | 10:6444e6c798ce | 1111 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1112 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1113 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1114 | * @return none. |
modtronix | 10:6444e6c798ce | 1115 | */ |
modtronix | 10:6444e6c798ce | 1116 | void arm_fir_q7( |
modtronix | 10:6444e6c798ce | 1117 | const arm_fir_instance_q7 * S, |
modtronix | 10:6444e6c798ce | 1118 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 1119 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 1120 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1121 | |
modtronix | 10:6444e6c798ce | 1122 | |
modtronix | 10:6444e6c798ce | 1123 | /** |
modtronix | 10:6444e6c798ce | 1124 | * @brief Initialization function for the Q7 FIR filter. |
modtronix | 10:6444e6c798ce | 1125 | * @param[in,out] *S points to an instance of the Q7 FIR structure. |
modtronix | 10:6444e6c798ce | 1126 | * @param[in] numTaps Number of filter coefficients in the filter. |
modtronix | 10:6444e6c798ce | 1127 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1128 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1129 | * @param[in] blockSize number of samples that are processed. |
modtronix | 10:6444e6c798ce | 1130 | * @return none |
modtronix | 10:6444e6c798ce | 1131 | */ |
modtronix | 10:6444e6c798ce | 1132 | void arm_fir_init_q7( |
modtronix | 10:6444e6c798ce | 1133 | arm_fir_instance_q7 * S, |
modtronix | 10:6444e6c798ce | 1134 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 1135 | q7_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1136 | q7_t * pState, |
modtronix | 10:6444e6c798ce | 1137 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1138 | |
modtronix | 10:6444e6c798ce | 1139 | |
modtronix | 10:6444e6c798ce | 1140 | /** |
modtronix | 10:6444e6c798ce | 1141 | * @brief Processing function for the Q15 FIR filter. |
modtronix | 10:6444e6c798ce | 1142 | * @param[in] *S points to an instance of the Q15 FIR structure. |
modtronix | 10:6444e6c798ce | 1143 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1144 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1145 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1146 | * @return none. |
modtronix | 10:6444e6c798ce | 1147 | */ |
modtronix | 10:6444e6c798ce | 1148 | void arm_fir_q15( |
modtronix | 10:6444e6c798ce | 1149 | const arm_fir_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 1150 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 1151 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 1152 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1153 | |
modtronix | 10:6444e6c798ce | 1154 | /** |
modtronix | 10:6444e6c798ce | 1155 | * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 1156 | * @param[in] *S points to an instance of the Q15 FIR filter structure. |
modtronix | 10:6444e6c798ce | 1157 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1158 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1159 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1160 | * @return none. |
modtronix | 10:6444e6c798ce | 1161 | */ |
modtronix | 10:6444e6c798ce | 1162 | void arm_fir_fast_q15( |
modtronix | 10:6444e6c798ce | 1163 | const arm_fir_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 1164 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 1165 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 1166 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1167 | |
modtronix | 10:6444e6c798ce | 1168 | /** |
modtronix | 10:6444e6c798ce | 1169 | * @brief Initialization function for the Q15 FIR filter. |
modtronix | 10:6444e6c798ce | 1170 | * @param[in,out] *S points to an instance of the Q15 FIR filter structure. |
modtronix | 10:6444e6c798ce | 1171 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. |
modtronix | 10:6444e6c798ce | 1172 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1173 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1174 | * @param[in] blockSize number of samples that are processed at a time. |
modtronix | 10:6444e6c798ce | 1175 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if |
modtronix | 10:6444e6c798ce | 1176 | * <code>numTaps</code> is not a supported value. |
modtronix | 10:6444e6c798ce | 1177 | */ |
modtronix | 10:6444e6c798ce | 1178 | |
modtronix | 10:6444e6c798ce | 1179 | arm_status arm_fir_init_q15( |
modtronix | 10:6444e6c798ce | 1180 | arm_fir_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 1181 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 1182 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1183 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 1184 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1185 | |
modtronix | 10:6444e6c798ce | 1186 | /** |
modtronix | 10:6444e6c798ce | 1187 | * @brief Processing function for the Q31 FIR filter. |
modtronix | 10:6444e6c798ce | 1188 | * @param[in] *S points to an instance of the Q31 FIR filter structure. |
modtronix | 10:6444e6c798ce | 1189 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1190 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1191 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1192 | * @return none. |
modtronix | 10:6444e6c798ce | 1193 | */ |
modtronix | 10:6444e6c798ce | 1194 | void arm_fir_q31( |
modtronix | 10:6444e6c798ce | 1195 | const arm_fir_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 1196 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 1197 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 1198 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1199 | |
modtronix | 10:6444e6c798ce | 1200 | /** |
modtronix | 10:6444e6c798ce | 1201 | * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 1202 | * @param[in] *S points to an instance of the Q31 FIR structure. |
modtronix | 10:6444e6c798ce | 1203 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1204 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1205 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1206 | * @return none. |
modtronix | 10:6444e6c798ce | 1207 | */ |
modtronix | 10:6444e6c798ce | 1208 | void arm_fir_fast_q31( |
modtronix | 10:6444e6c798ce | 1209 | const arm_fir_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 1210 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 1211 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 1212 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1213 | |
modtronix | 10:6444e6c798ce | 1214 | /** |
modtronix | 10:6444e6c798ce | 1215 | * @brief Initialization function for the Q31 FIR filter. |
modtronix | 10:6444e6c798ce | 1216 | * @param[in,out] *S points to an instance of the Q31 FIR structure. |
modtronix | 10:6444e6c798ce | 1217 | * @param[in] numTaps Number of filter coefficients in the filter. |
modtronix | 10:6444e6c798ce | 1218 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1219 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1220 | * @param[in] blockSize number of samples that are processed at a time. |
modtronix | 10:6444e6c798ce | 1221 | * @return none. |
modtronix | 10:6444e6c798ce | 1222 | */ |
modtronix | 10:6444e6c798ce | 1223 | void arm_fir_init_q31( |
modtronix | 10:6444e6c798ce | 1224 | arm_fir_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 1225 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 1226 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1227 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 1228 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1229 | |
modtronix | 10:6444e6c798ce | 1230 | /** |
modtronix | 10:6444e6c798ce | 1231 | * @brief Processing function for the floating-point FIR filter. |
modtronix | 10:6444e6c798ce | 1232 | * @param[in] *S points to an instance of the floating-point FIR structure. |
modtronix | 10:6444e6c798ce | 1233 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1234 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1235 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1236 | * @return none. |
modtronix | 10:6444e6c798ce | 1237 | */ |
modtronix | 10:6444e6c798ce | 1238 | void arm_fir_f32( |
modtronix | 10:6444e6c798ce | 1239 | const arm_fir_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 1240 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 1241 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 1242 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1243 | |
modtronix | 10:6444e6c798ce | 1244 | /** |
modtronix | 10:6444e6c798ce | 1245 | * @brief Initialization function for the floating-point FIR filter. |
modtronix | 10:6444e6c798ce | 1246 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. |
modtronix | 10:6444e6c798ce | 1247 | * @param[in] numTaps Number of filter coefficients in the filter. |
modtronix | 10:6444e6c798ce | 1248 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1249 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1250 | * @param[in] blockSize number of samples that are processed at a time. |
modtronix | 10:6444e6c798ce | 1251 | * @return none. |
modtronix | 10:6444e6c798ce | 1252 | */ |
modtronix | 10:6444e6c798ce | 1253 | void arm_fir_init_f32( |
modtronix | 10:6444e6c798ce | 1254 | arm_fir_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 1255 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 1256 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1257 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 1258 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1259 | |
modtronix | 10:6444e6c798ce | 1260 | |
modtronix | 10:6444e6c798ce | 1261 | /** |
modtronix | 10:6444e6c798ce | 1262 | * @brief Instance structure for the Q15 Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1263 | */ |
modtronix | 10:6444e6c798ce | 1264 | typedef struct |
modtronix | 10:6444e6c798ce | 1265 | { |
modtronix | 10:6444e6c798ce | 1266 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 1267 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
modtronix | 10:6444e6c798ce | 1268 | q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 1269 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
modtronix | 10:6444e6c798ce | 1270 | |
modtronix | 10:6444e6c798ce | 1271 | } arm_biquad_casd_df1_inst_q15; |
modtronix | 10:6444e6c798ce | 1272 | |
modtronix | 10:6444e6c798ce | 1273 | |
modtronix | 10:6444e6c798ce | 1274 | /** |
modtronix | 10:6444e6c798ce | 1275 | * @brief Instance structure for the Q31 Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1276 | */ |
modtronix | 10:6444e6c798ce | 1277 | typedef struct |
modtronix | 10:6444e6c798ce | 1278 | { |
modtronix | 10:6444e6c798ce | 1279 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 1280 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
modtronix | 10:6444e6c798ce | 1281 | q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 1282 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
modtronix | 10:6444e6c798ce | 1283 | |
modtronix | 10:6444e6c798ce | 1284 | } arm_biquad_casd_df1_inst_q31; |
modtronix | 10:6444e6c798ce | 1285 | |
modtronix | 10:6444e6c798ce | 1286 | /** |
modtronix | 10:6444e6c798ce | 1287 | * @brief Instance structure for the floating-point Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1288 | */ |
modtronix | 10:6444e6c798ce | 1289 | typedef struct |
modtronix | 10:6444e6c798ce | 1290 | { |
modtronix | 10:6444e6c798ce | 1291 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 1292 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
modtronix | 10:6444e6c798ce | 1293 | float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 1294 | |
modtronix | 10:6444e6c798ce | 1295 | |
modtronix | 10:6444e6c798ce | 1296 | } arm_biquad_casd_df1_inst_f32; |
modtronix | 10:6444e6c798ce | 1297 | |
modtronix | 10:6444e6c798ce | 1298 | |
modtronix | 10:6444e6c798ce | 1299 | |
modtronix | 10:6444e6c798ce | 1300 | /** |
modtronix | 10:6444e6c798ce | 1301 | * @brief Processing function for the Q15 Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1302 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1303 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1304 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1305 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1306 | * @return none. |
modtronix | 10:6444e6c798ce | 1307 | */ |
modtronix | 10:6444e6c798ce | 1308 | |
modtronix | 10:6444e6c798ce | 1309 | void arm_biquad_cascade_df1_q15( |
modtronix | 10:6444e6c798ce | 1310 | const arm_biquad_casd_df1_inst_q15 * S, |
modtronix | 10:6444e6c798ce | 1311 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 1312 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 1313 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1314 | |
modtronix | 10:6444e6c798ce | 1315 | /** |
modtronix | 10:6444e6c798ce | 1316 | * @brief Initialization function for the Q15 Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1317 | * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1318 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 1319 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1320 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1321 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
modtronix | 10:6444e6c798ce | 1322 | * @return none |
modtronix | 10:6444e6c798ce | 1323 | */ |
modtronix | 10:6444e6c798ce | 1324 | |
modtronix | 10:6444e6c798ce | 1325 | void arm_biquad_cascade_df1_init_q15( |
modtronix | 10:6444e6c798ce | 1326 | arm_biquad_casd_df1_inst_q15 * S, |
modtronix | 10:6444e6c798ce | 1327 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 1328 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1329 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 1330 | int8_t postShift); |
modtronix | 10:6444e6c798ce | 1331 | |
modtronix | 10:6444e6c798ce | 1332 | |
modtronix | 10:6444e6c798ce | 1333 | /** |
modtronix | 10:6444e6c798ce | 1334 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 1335 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1336 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1337 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1338 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1339 | * @return none. |
modtronix | 10:6444e6c798ce | 1340 | */ |
modtronix | 10:6444e6c798ce | 1341 | |
modtronix | 10:6444e6c798ce | 1342 | void arm_biquad_cascade_df1_fast_q15( |
modtronix | 10:6444e6c798ce | 1343 | const arm_biquad_casd_df1_inst_q15 * S, |
modtronix | 10:6444e6c798ce | 1344 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 1345 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 1346 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1347 | |
modtronix | 10:6444e6c798ce | 1348 | |
modtronix | 10:6444e6c798ce | 1349 | /** |
modtronix | 10:6444e6c798ce | 1350 | * @brief Processing function for the Q31 Biquad cascade filter |
modtronix | 10:6444e6c798ce | 1351 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1352 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1353 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1354 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1355 | * @return none. |
modtronix | 10:6444e6c798ce | 1356 | */ |
modtronix | 10:6444e6c798ce | 1357 | |
modtronix | 10:6444e6c798ce | 1358 | void arm_biquad_cascade_df1_q31( |
modtronix | 10:6444e6c798ce | 1359 | const arm_biquad_casd_df1_inst_q31 * S, |
modtronix | 10:6444e6c798ce | 1360 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 1361 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 1362 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1363 | |
modtronix | 10:6444e6c798ce | 1364 | /** |
modtronix | 10:6444e6c798ce | 1365 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 1366 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1367 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1368 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1369 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1370 | * @return none. |
modtronix | 10:6444e6c798ce | 1371 | */ |
modtronix | 10:6444e6c798ce | 1372 | |
modtronix | 10:6444e6c798ce | 1373 | void arm_biquad_cascade_df1_fast_q31( |
modtronix | 10:6444e6c798ce | 1374 | const arm_biquad_casd_df1_inst_q31 * S, |
modtronix | 10:6444e6c798ce | 1375 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 1376 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 1377 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1378 | |
modtronix | 10:6444e6c798ce | 1379 | /** |
modtronix | 10:6444e6c798ce | 1380 | * @brief Initialization function for the Q31 Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1381 | * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1382 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 1383 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1384 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1385 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
modtronix | 10:6444e6c798ce | 1386 | * @return none |
modtronix | 10:6444e6c798ce | 1387 | */ |
modtronix | 10:6444e6c798ce | 1388 | |
modtronix | 10:6444e6c798ce | 1389 | void arm_biquad_cascade_df1_init_q31( |
modtronix | 10:6444e6c798ce | 1390 | arm_biquad_casd_df1_inst_q31 * S, |
modtronix | 10:6444e6c798ce | 1391 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 1392 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1393 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 1394 | int8_t postShift); |
modtronix | 10:6444e6c798ce | 1395 | |
modtronix | 10:6444e6c798ce | 1396 | /** |
modtronix | 10:6444e6c798ce | 1397 | * @brief Processing function for the floating-point Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1398 | * @param[in] *S points to an instance of the floating-point Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1399 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 1400 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 1401 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 1402 | * @return none. |
modtronix | 10:6444e6c798ce | 1403 | */ |
modtronix | 10:6444e6c798ce | 1404 | |
modtronix | 10:6444e6c798ce | 1405 | void arm_biquad_cascade_df1_f32( |
modtronix | 10:6444e6c798ce | 1406 | const arm_biquad_casd_df1_inst_f32 * S, |
modtronix | 10:6444e6c798ce | 1407 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 1408 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 1409 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1410 | |
modtronix | 10:6444e6c798ce | 1411 | /** |
modtronix | 10:6444e6c798ce | 1412 | * @brief Initialization function for the floating-point Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 1413 | * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. |
modtronix | 10:6444e6c798ce | 1414 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 1415 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 1416 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 1417 | * @return none |
modtronix | 10:6444e6c798ce | 1418 | */ |
modtronix | 10:6444e6c798ce | 1419 | |
modtronix | 10:6444e6c798ce | 1420 | void arm_biquad_cascade_df1_init_f32( |
modtronix | 10:6444e6c798ce | 1421 | arm_biquad_casd_df1_inst_f32 * S, |
modtronix | 10:6444e6c798ce | 1422 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 1423 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 1424 | float32_t * pState); |
modtronix | 10:6444e6c798ce | 1425 | |
modtronix | 10:6444e6c798ce | 1426 | |
modtronix | 10:6444e6c798ce | 1427 | /** |
modtronix | 10:6444e6c798ce | 1428 | * @brief Instance structure for the floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 1429 | */ |
modtronix | 10:6444e6c798ce | 1430 | |
modtronix | 10:6444e6c798ce | 1431 | typedef struct |
modtronix | 10:6444e6c798ce | 1432 | { |
modtronix | 10:6444e6c798ce | 1433 | uint16_t numRows; /**< number of rows of the matrix. */ |
modtronix | 10:6444e6c798ce | 1434 | uint16_t numCols; /**< number of columns of the matrix. */ |
modtronix | 10:6444e6c798ce | 1435 | float32_t *pData; /**< points to the data of the matrix. */ |
modtronix | 10:6444e6c798ce | 1436 | } arm_matrix_instance_f32; |
modtronix | 10:6444e6c798ce | 1437 | |
modtronix | 10:6444e6c798ce | 1438 | |
modtronix | 10:6444e6c798ce | 1439 | /** |
modtronix | 10:6444e6c798ce | 1440 | * @brief Instance structure for the floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 1441 | */ |
modtronix | 10:6444e6c798ce | 1442 | |
modtronix | 10:6444e6c798ce | 1443 | typedef struct |
modtronix | 10:6444e6c798ce | 1444 | { |
modtronix | 10:6444e6c798ce | 1445 | uint16_t numRows; /**< number of rows of the matrix. */ |
modtronix | 10:6444e6c798ce | 1446 | uint16_t numCols; /**< number of columns of the matrix. */ |
modtronix | 10:6444e6c798ce | 1447 | float64_t *pData; /**< points to the data of the matrix. */ |
modtronix | 10:6444e6c798ce | 1448 | } arm_matrix_instance_f64; |
modtronix | 10:6444e6c798ce | 1449 | |
modtronix | 10:6444e6c798ce | 1450 | /** |
modtronix | 10:6444e6c798ce | 1451 | * @brief Instance structure for the Q15 matrix structure. |
modtronix | 10:6444e6c798ce | 1452 | */ |
modtronix | 10:6444e6c798ce | 1453 | |
modtronix | 10:6444e6c798ce | 1454 | typedef struct |
modtronix | 10:6444e6c798ce | 1455 | { |
modtronix | 10:6444e6c798ce | 1456 | uint16_t numRows; /**< number of rows of the matrix. */ |
modtronix | 10:6444e6c798ce | 1457 | uint16_t numCols; /**< number of columns of the matrix. */ |
modtronix | 10:6444e6c798ce | 1458 | q15_t *pData; /**< points to the data of the matrix. */ |
modtronix | 10:6444e6c798ce | 1459 | |
modtronix | 10:6444e6c798ce | 1460 | } arm_matrix_instance_q15; |
modtronix | 10:6444e6c798ce | 1461 | |
modtronix | 10:6444e6c798ce | 1462 | /** |
modtronix | 10:6444e6c798ce | 1463 | * @brief Instance structure for the Q31 matrix structure. |
modtronix | 10:6444e6c798ce | 1464 | */ |
modtronix | 10:6444e6c798ce | 1465 | |
modtronix | 10:6444e6c798ce | 1466 | typedef struct |
modtronix | 10:6444e6c798ce | 1467 | { |
modtronix | 10:6444e6c798ce | 1468 | uint16_t numRows; /**< number of rows of the matrix. */ |
modtronix | 10:6444e6c798ce | 1469 | uint16_t numCols; /**< number of columns of the matrix. */ |
modtronix | 10:6444e6c798ce | 1470 | q31_t *pData; /**< points to the data of the matrix. */ |
modtronix | 10:6444e6c798ce | 1471 | |
modtronix | 10:6444e6c798ce | 1472 | } arm_matrix_instance_q31; |
modtronix | 10:6444e6c798ce | 1473 | |
modtronix | 10:6444e6c798ce | 1474 | |
modtronix | 10:6444e6c798ce | 1475 | |
modtronix | 10:6444e6c798ce | 1476 | /** |
modtronix | 10:6444e6c798ce | 1477 | * @brief Floating-point matrix addition. |
modtronix | 10:6444e6c798ce | 1478 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1479 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1480 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1481 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1482 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1483 | */ |
modtronix | 10:6444e6c798ce | 1484 | |
modtronix | 10:6444e6c798ce | 1485 | arm_status arm_mat_add_f32( |
modtronix | 10:6444e6c798ce | 1486 | const arm_matrix_instance_f32 * pSrcA, |
modtronix | 10:6444e6c798ce | 1487 | const arm_matrix_instance_f32 * pSrcB, |
modtronix | 10:6444e6c798ce | 1488 | arm_matrix_instance_f32 * pDst); |
modtronix | 10:6444e6c798ce | 1489 | |
modtronix | 10:6444e6c798ce | 1490 | /** |
modtronix | 10:6444e6c798ce | 1491 | * @brief Q15 matrix addition. |
modtronix | 10:6444e6c798ce | 1492 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1493 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1494 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1495 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1496 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1497 | */ |
modtronix | 10:6444e6c798ce | 1498 | |
modtronix | 10:6444e6c798ce | 1499 | arm_status arm_mat_add_q15( |
modtronix | 10:6444e6c798ce | 1500 | const arm_matrix_instance_q15 * pSrcA, |
modtronix | 10:6444e6c798ce | 1501 | const arm_matrix_instance_q15 * pSrcB, |
modtronix | 10:6444e6c798ce | 1502 | arm_matrix_instance_q15 * pDst); |
modtronix | 10:6444e6c798ce | 1503 | |
modtronix | 10:6444e6c798ce | 1504 | /** |
modtronix | 10:6444e6c798ce | 1505 | * @brief Q31 matrix addition. |
modtronix | 10:6444e6c798ce | 1506 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1507 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1508 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1509 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1510 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1511 | */ |
modtronix | 10:6444e6c798ce | 1512 | |
modtronix | 10:6444e6c798ce | 1513 | arm_status arm_mat_add_q31( |
modtronix | 10:6444e6c798ce | 1514 | const arm_matrix_instance_q31 * pSrcA, |
modtronix | 10:6444e6c798ce | 1515 | const arm_matrix_instance_q31 * pSrcB, |
modtronix | 10:6444e6c798ce | 1516 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1517 | |
modtronix | 10:6444e6c798ce | 1518 | /** |
modtronix | 10:6444e6c798ce | 1519 | * @brief Floating-point, complex, matrix multiplication. |
modtronix | 10:6444e6c798ce | 1520 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1521 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1522 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1523 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1524 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1525 | */ |
modtronix | 10:6444e6c798ce | 1526 | |
modtronix | 10:6444e6c798ce | 1527 | arm_status arm_mat_cmplx_mult_f32( |
modtronix | 10:6444e6c798ce | 1528 | const arm_matrix_instance_f32 * pSrcA, |
modtronix | 10:6444e6c798ce | 1529 | const arm_matrix_instance_f32 * pSrcB, |
modtronix | 10:6444e6c798ce | 1530 | arm_matrix_instance_f32 * pDst); |
modtronix | 10:6444e6c798ce | 1531 | |
modtronix | 10:6444e6c798ce | 1532 | /** |
modtronix | 10:6444e6c798ce | 1533 | * @brief Q15, complex, matrix multiplication. |
modtronix | 10:6444e6c798ce | 1534 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1535 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1536 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1537 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1538 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1539 | */ |
modtronix | 10:6444e6c798ce | 1540 | |
modtronix | 10:6444e6c798ce | 1541 | arm_status arm_mat_cmplx_mult_q15( |
modtronix | 10:6444e6c798ce | 1542 | const arm_matrix_instance_q15 * pSrcA, |
modtronix | 10:6444e6c798ce | 1543 | const arm_matrix_instance_q15 * pSrcB, |
modtronix | 10:6444e6c798ce | 1544 | arm_matrix_instance_q15 * pDst, |
modtronix | 10:6444e6c798ce | 1545 | q15_t * pScratch); |
modtronix | 10:6444e6c798ce | 1546 | |
modtronix | 10:6444e6c798ce | 1547 | /** |
modtronix | 10:6444e6c798ce | 1548 | * @brief Q31, complex, matrix multiplication. |
modtronix | 10:6444e6c798ce | 1549 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1550 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1551 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1552 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1553 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1554 | */ |
modtronix | 10:6444e6c798ce | 1555 | |
modtronix | 10:6444e6c798ce | 1556 | arm_status arm_mat_cmplx_mult_q31( |
modtronix | 10:6444e6c798ce | 1557 | const arm_matrix_instance_q31 * pSrcA, |
modtronix | 10:6444e6c798ce | 1558 | const arm_matrix_instance_q31 * pSrcB, |
modtronix | 10:6444e6c798ce | 1559 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1560 | |
modtronix | 10:6444e6c798ce | 1561 | |
modtronix | 10:6444e6c798ce | 1562 | /** |
modtronix | 10:6444e6c798ce | 1563 | * @brief Floating-point matrix transpose. |
modtronix | 10:6444e6c798ce | 1564 | * @param[in] *pSrc points to the input matrix |
modtronix | 10:6444e6c798ce | 1565 | * @param[out] *pDst points to the output matrix |
modtronix | 10:6444e6c798ce | 1566 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
modtronix | 10:6444e6c798ce | 1567 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1568 | */ |
modtronix | 10:6444e6c798ce | 1569 | |
modtronix | 10:6444e6c798ce | 1570 | arm_status arm_mat_trans_f32( |
modtronix | 10:6444e6c798ce | 1571 | const arm_matrix_instance_f32 * pSrc, |
modtronix | 10:6444e6c798ce | 1572 | arm_matrix_instance_f32 * pDst); |
modtronix | 10:6444e6c798ce | 1573 | |
modtronix | 10:6444e6c798ce | 1574 | |
modtronix | 10:6444e6c798ce | 1575 | /** |
modtronix | 10:6444e6c798ce | 1576 | * @brief Q15 matrix transpose. |
modtronix | 10:6444e6c798ce | 1577 | * @param[in] *pSrc points to the input matrix |
modtronix | 10:6444e6c798ce | 1578 | * @param[out] *pDst points to the output matrix |
modtronix | 10:6444e6c798ce | 1579 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
modtronix | 10:6444e6c798ce | 1580 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1581 | */ |
modtronix | 10:6444e6c798ce | 1582 | |
modtronix | 10:6444e6c798ce | 1583 | arm_status arm_mat_trans_q15( |
modtronix | 10:6444e6c798ce | 1584 | const arm_matrix_instance_q15 * pSrc, |
modtronix | 10:6444e6c798ce | 1585 | arm_matrix_instance_q15 * pDst); |
modtronix | 10:6444e6c798ce | 1586 | |
modtronix | 10:6444e6c798ce | 1587 | /** |
modtronix | 10:6444e6c798ce | 1588 | * @brief Q31 matrix transpose. |
modtronix | 10:6444e6c798ce | 1589 | * @param[in] *pSrc points to the input matrix |
modtronix | 10:6444e6c798ce | 1590 | * @param[out] *pDst points to the output matrix |
modtronix | 10:6444e6c798ce | 1591 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
modtronix | 10:6444e6c798ce | 1592 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1593 | */ |
modtronix | 10:6444e6c798ce | 1594 | |
modtronix | 10:6444e6c798ce | 1595 | arm_status arm_mat_trans_q31( |
modtronix | 10:6444e6c798ce | 1596 | const arm_matrix_instance_q31 * pSrc, |
modtronix | 10:6444e6c798ce | 1597 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1598 | |
modtronix | 10:6444e6c798ce | 1599 | |
modtronix | 10:6444e6c798ce | 1600 | /** |
modtronix | 10:6444e6c798ce | 1601 | * @brief Floating-point matrix multiplication |
modtronix | 10:6444e6c798ce | 1602 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1603 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1604 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1605 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1606 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1607 | */ |
modtronix | 10:6444e6c798ce | 1608 | |
modtronix | 10:6444e6c798ce | 1609 | arm_status arm_mat_mult_f32( |
modtronix | 10:6444e6c798ce | 1610 | const arm_matrix_instance_f32 * pSrcA, |
modtronix | 10:6444e6c798ce | 1611 | const arm_matrix_instance_f32 * pSrcB, |
modtronix | 10:6444e6c798ce | 1612 | arm_matrix_instance_f32 * pDst); |
modtronix | 10:6444e6c798ce | 1613 | |
modtronix | 10:6444e6c798ce | 1614 | /** |
modtronix | 10:6444e6c798ce | 1615 | * @brief Q15 matrix multiplication |
modtronix | 10:6444e6c798ce | 1616 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1617 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1618 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1619 | * @param[in] *pState points to the array for storing intermediate results |
modtronix | 10:6444e6c798ce | 1620 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1621 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1622 | */ |
modtronix | 10:6444e6c798ce | 1623 | |
modtronix | 10:6444e6c798ce | 1624 | arm_status arm_mat_mult_q15( |
modtronix | 10:6444e6c798ce | 1625 | const arm_matrix_instance_q15 * pSrcA, |
modtronix | 10:6444e6c798ce | 1626 | const arm_matrix_instance_q15 * pSrcB, |
modtronix | 10:6444e6c798ce | 1627 | arm_matrix_instance_q15 * pDst, |
modtronix | 10:6444e6c798ce | 1628 | q15_t * pState); |
modtronix | 10:6444e6c798ce | 1629 | |
modtronix | 10:6444e6c798ce | 1630 | /** |
modtronix | 10:6444e6c798ce | 1631 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 1632 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1633 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1634 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1635 | * @param[in] *pState points to the array for storing intermediate results |
modtronix | 10:6444e6c798ce | 1636 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1637 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1638 | */ |
modtronix | 10:6444e6c798ce | 1639 | |
modtronix | 10:6444e6c798ce | 1640 | arm_status arm_mat_mult_fast_q15( |
modtronix | 10:6444e6c798ce | 1641 | const arm_matrix_instance_q15 * pSrcA, |
modtronix | 10:6444e6c798ce | 1642 | const arm_matrix_instance_q15 * pSrcB, |
modtronix | 10:6444e6c798ce | 1643 | arm_matrix_instance_q15 * pDst, |
modtronix | 10:6444e6c798ce | 1644 | q15_t * pState); |
modtronix | 10:6444e6c798ce | 1645 | |
modtronix | 10:6444e6c798ce | 1646 | /** |
modtronix | 10:6444e6c798ce | 1647 | * @brief Q31 matrix multiplication |
modtronix | 10:6444e6c798ce | 1648 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1649 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1650 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1651 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1652 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1653 | */ |
modtronix | 10:6444e6c798ce | 1654 | |
modtronix | 10:6444e6c798ce | 1655 | arm_status arm_mat_mult_q31( |
modtronix | 10:6444e6c798ce | 1656 | const arm_matrix_instance_q31 * pSrcA, |
modtronix | 10:6444e6c798ce | 1657 | const arm_matrix_instance_q31 * pSrcB, |
modtronix | 10:6444e6c798ce | 1658 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1659 | |
modtronix | 10:6444e6c798ce | 1660 | /** |
modtronix | 10:6444e6c798ce | 1661 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 1662 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1663 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1664 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1665 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1666 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1667 | */ |
modtronix | 10:6444e6c798ce | 1668 | |
modtronix | 10:6444e6c798ce | 1669 | arm_status arm_mat_mult_fast_q31( |
modtronix | 10:6444e6c798ce | 1670 | const arm_matrix_instance_q31 * pSrcA, |
modtronix | 10:6444e6c798ce | 1671 | const arm_matrix_instance_q31 * pSrcB, |
modtronix | 10:6444e6c798ce | 1672 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1673 | |
modtronix | 10:6444e6c798ce | 1674 | |
modtronix | 10:6444e6c798ce | 1675 | /** |
modtronix | 10:6444e6c798ce | 1676 | * @brief Floating-point matrix subtraction |
modtronix | 10:6444e6c798ce | 1677 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1678 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1679 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1680 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1681 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1682 | */ |
modtronix | 10:6444e6c798ce | 1683 | |
modtronix | 10:6444e6c798ce | 1684 | arm_status arm_mat_sub_f32( |
modtronix | 10:6444e6c798ce | 1685 | const arm_matrix_instance_f32 * pSrcA, |
modtronix | 10:6444e6c798ce | 1686 | const arm_matrix_instance_f32 * pSrcB, |
modtronix | 10:6444e6c798ce | 1687 | arm_matrix_instance_f32 * pDst); |
modtronix | 10:6444e6c798ce | 1688 | |
modtronix | 10:6444e6c798ce | 1689 | /** |
modtronix | 10:6444e6c798ce | 1690 | * @brief Q15 matrix subtraction |
modtronix | 10:6444e6c798ce | 1691 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1692 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1693 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1694 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1695 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1696 | */ |
modtronix | 10:6444e6c798ce | 1697 | |
modtronix | 10:6444e6c798ce | 1698 | arm_status arm_mat_sub_q15( |
modtronix | 10:6444e6c798ce | 1699 | const arm_matrix_instance_q15 * pSrcA, |
modtronix | 10:6444e6c798ce | 1700 | const arm_matrix_instance_q15 * pSrcB, |
modtronix | 10:6444e6c798ce | 1701 | arm_matrix_instance_q15 * pDst); |
modtronix | 10:6444e6c798ce | 1702 | |
modtronix | 10:6444e6c798ce | 1703 | /** |
modtronix | 10:6444e6c798ce | 1704 | * @brief Q31 matrix subtraction |
modtronix | 10:6444e6c798ce | 1705 | * @param[in] *pSrcA points to the first input matrix structure |
modtronix | 10:6444e6c798ce | 1706 | * @param[in] *pSrcB points to the second input matrix structure |
modtronix | 10:6444e6c798ce | 1707 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1708 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1709 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1710 | */ |
modtronix | 10:6444e6c798ce | 1711 | |
modtronix | 10:6444e6c798ce | 1712 | arm_status arm_mat_sub_q31( |
modtronix | 10:6444e6c798ce | 1713 | const arm_matrix_instance_q31 * pSrcA, |
modtronix | 10:6444e6c798ce | 1714 | const arm_matrix_instance_q31 * pSrcB, |
modtronix | 10:6444e6c798ce | 1715 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1716 | |
modtronix | 10:6444e6c798ce | 1717 | /** |
modtronix | 10:6444e6c798ce | 1718 | * @brief Floating-point matrix scaling. |
modtronix | 10:6444e6c798ce | 1719 | * @param[in] *pSrc points to the input matrix |
modtronix | 10:6444e6c798ce | 1720 | * @param[in] scale scale factor |
modtronix | 10:6444e6c798ce | 1721 | * @param[out] *pDst points to the output matrix |
modtronix | 10:6444e6c798ce | 1722 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1723 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1724 | */ |
modtronix | 10:6444e6c798ce | 1725 | |
modtronix | 10:6444e6c798ce | 1726 | arm_status arm_mat_scale_f32( |
modtronix | 10:6444e6c798ce | 1727 | const arm_matrix_instance_f32 * pSrc, |
modtronix | 10:6444e6c798ce | 1728 | float32_t scale, |
modtronix | 10:6444e6c798ce | 1729 | arm_matrix_instance_f32 * pDst); |
modtronix | 10:6444e6c798ce | 1730 | |
modtronix | 10:6444e6c798ce | 1731 | /** |
modtronix | 10:6444e6c798ce | 1732 | * @brief Q15 matrix scaling. |
modtronix | 10:6444e6c798ce | 1733 | * @param[in] *pSrc points to input matrix |
modtronix | 10:6444e6c798ce | 1734 | * @param[in] scaleFract fractional portion of the scale factor |
modtronix | 10:6444e6c798ce | 1735 | * @param[in] shift number of bits to shift the result by |
modtronix | 10:6444e6c798ce | 1736 | * @param[out] *pDst points to output matrix |
modtronix | 10:6444e6c798ce | 1737 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1738 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1739 | */ |
modtronix | 10:6444e6c798ce | 1740 | |
modtronix | 10:6444e6c798ce | 1741 | arm_status arm_mat_scale_q15( |
modtronix | 10:6444e6c798ce | 1742 | const arm_matrix_instance_q15 * pSrc, |
modtronix | 10:6444e6c798ce | 1743 | q15_t scaleFract, |
modtronix | 10:6444e6c798ce | 1744 | int32_t shift, |
modtronix | 10:6444e6c798ce | 1745 | arm_matrix_instance_q15 * pDst); |
modtronix | 10:6444e6c798ce | 1746 | |
modtronix | 10:6444e6c798ce | 1747 | /** |
modtronix | 10:6444e6c798ce | 1748 | * @brief Q31 matrix scaling. |
modtronix | 10:6444e6c798ce | 1749 | * @param[in] *pSrc points to input matrix |
modtronix | 10:6444e6c798ce | 1750 | * @param[in] scaleFract fractional portion of the scale factor |
modtronix | 10:6444e6c798ce | 1751 | * @param[in] shift number of bits to shift the result by |
modtronix | 10:6444e6c798ce | 1752 | * @param[out] *pDst points to output matrix structure |
modtronix | 10:6444e6c798ce | 1753 | * @return The function returns either |
modtronix | 10:6444e6c798ce | 1754 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
modtronix | 10:6444e6c798ce | 1755 | */ |
modtronix | 10:6444e6c798ce | 1756 | |
modtronix | 10:6444e6c798ce | 1757 | arm_status arm_mat_scale_q31( |
modtronix | 10:6444e6c798ce | 1758 | const arm_matrix_instance_q31 * pSrc, |
modtronix | 10:6444e6c798ce | 1759 | q31_t scaleFract, |
modtronix | 10:6444e6c798ce | 1760 | int32_t shift, |
modtronix | 10:6444e6c798ce | 1761 | arm_matrix_instance_q31 * pDst); |
modtronix | 10:6444e6c798ce | 1762 | |
modtronix | 10:6444e6c798ce | 1763 | |
modtronix | 10:6444e6c798ce | 1764 | /** |
modtronix | 10:6444e6c798ce | 1765 | * @brief Q31 matrix initialization. |
modtronix | 10:6444e6c798ce | 1766 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 1767 | * @param[in] nRows number of rows in the matrix. |
modtronix | 10:6444e6c798ce | 1768 | * @param[in] nColumns number of columns in the matrix. |
modtronix | 10:6444e6c798ce | 1769 | * @param[in] *pData points to the matrix data array. |
modtronix | 10:6444e6c798ce | 1770 | * @return none |
modtronix | 10:6444e6c798ce | 1771 | */ |
modtronix | 10:6444e6c798ce | 1772 | |
modtronix | 10:6444e6c798ce | 1773 | void arm_mat_init_q31( |
modtronix | 10:6444e6c798ce | 1774 | arm_matrix_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 1775 | uint16_t nRows, |
modtronix | 10:6444e6c798ce | 1776 | uint16_t nColumns, |
modtronix | 10:6444e6c798ce | 1777 | q31_t * pData); |
modtronix | 10:6444e6c798ce | 1778 | |
modtronix | 10:6444e6c798ce | 1779 | /** |
modtronix | 10:6444e6c798ce | 1780 | * @brief Q15 matrix initialization. |
modtronix | 10:6444e6c798ce | 1781 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 1782 | * @param[in] nRows number of rows in the matrix. |
modtronix | 10:6444e6c798ce | 1783 | * @param[in] nColumns number of columns in the matrix. |
modtronix | 10:6444e6c798ce | 1784 | * @param[in] *pData points to the matrix data array. |
modtronix | 10:6444e6c798ce | 1785 | * @return none |
modtronix | 10:6444e6c798ce | 1786 | */ |
modtronix | 10:6444e6c798ce | 1787 | |
modtronix | 10:6444e6c798ce | 1788 | void arm_mat_init_q15( |
modtronix | 10:6444e6c798ce | 1789 | arm_matrix_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 1790 | uint16_t nRows, |
modtronix | 10:6444e6c798ce | 1791 | uint16_t nColumns, |
modtronix | 10:6444e6c798ce | 1792 | q15_t * pData); |
modtronix | 10:6444e6c798ce | 1793 | |
modtronix | 10:6444e6c798ce | 1794 | /** |
modtronix | 10:6444e6c798ce | 1795 | * @brief Floating-point matrix initialization. |
modtronix | 10:6444e6c798ce | 1796 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 1797 | * @param[in] nRows number of rows in the matrix. |
modtronix | 10:6444e6c798ce | 1798 | * @param[in] nColumns number of columns in the matrix. |
modtronix | 10:6444e6c798ce | 1799 | * @param[in] *pData points to the matrix data array. |
modtronix | 10:6444e6c798ce | 1800 | * @return none |
modtronix | 10:6444e6c798ce | 1801 | */ |
modtronix | 10:6444e6c798ce | 1802 | |
modtronix | 10:6444e6c798ce | 1803 | void arm_mat_init_f32( |
modtronix | 10:6444e6c798ce | 1804 | arm_matrix_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 1805 | uint16_t nRows, |
modtronix | 10:6444e6c798ce | 1806 | uint16_t nColumns, |
modtronix | 10:6444e6c798ce | 1807 | float32_t * pData); |
modtronix | 10:6444e6c798ce | 1808 | |
modtronix | 10:6444e6c798ce | 1809 | |
modtronix | 10:6444e6c798ce | 1810 | |
modtronix | 10:6444e6c798ce | 1811 | /** |
modtronix | 10:6444e6c798ce | 1812 | * @brief Instance structure for the Q15 PID Control. |
modtronix | 10:6444e6c798ce | 1813 | */ |
modtronix | 10:6444e6c798ce | 1814 | typedef struct |
modtronix | 10:6444e6c798ce | 1815 | { |
modtronix | 10:6444e6c798ce | 1816 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
modtronix | 10:6444e6c798ce | 1817 | #ifdef ARM_MATH_CM0_FAMILY |
modtronix | 10:6444e6c798ce | 1818 | q15_t A1; |
modtronix | 10:6444e6c798ce | 1819 | q15_t A2; |
modtronix | 10:6444e6c798ce | 1820 | #else |
modtronix | 10:6444e6c798ce | 1821 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ |
modtronix | 10:6444e6c798ce | 1822 | #endif |
modtronix | 10:6444e6c798ce | 1823 | q15_t state[3]; /**< The state array of length 3. */ |
modtronix | 10:6444e6c798ce | 1824 | q15_t Kp; /**< The proportional gain. */ |
modtronix | 10:6444e6c798ce | 1825 | q15_t Ki; /**< The integral gain. */ |
modtronix | 10:6444e6c798ce | 1826 | q15_t Kd; /**< The derivative gain. */ |
modtronix | 10:6444e6c798ce | 1827 | } arm_pid_instance_q15; |
modtronix | 10:6444e6c798ce | 1828 | |
modtronix | 10:6444e6c798ce | 1829 | /** |
modtronix | 10:6444e6c798ce | 1830 | * @brief Instance structure for the Q31 PID Control. |
modtronix | 10:6444e6c798ce | 1831 | */ |
modtronix | 10:6444e6c798ce | 1832 | typedef struct |
modtronix | 10:6444e6c798ce | 1833 | { |
modtronix | 10:6444e6c798ce | 1834 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
modtronix | 10:6444e6c798ce | 1835 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
modtronix | 10:6444e6c798ce | 1836 | q31_t A2; /**< The derived gain, A2 = Kd . */ |
modtronix | 10:6444e6c798ce | 1837 | q31_t state[3]; /**< The state array of length 3. */ |
modtronix | 10:6444e6c798ce | 1838 | q31_t Kp; /**< The proportional gain. */ |
modtronix | 10:6444e6c798ce | 1839 | q31_t Ki; /**< The integral gain. */ |
modtronix | 10:6444e6c798ce | 1840 | q31_t Kd; /**< The derivative gain. */ |
modtronix | 10:6444e6c798ce | 1841 | |
modtronix | 10:6444e6c798ce | 1842 | } arm_pid_instance_q31; |
modtronix | 10:6444e6c798ce | 1843 | |
modtronix | 10:6444e6c798ce | 1844 | /** |
modtronix | 10:6444e6c798ce | 1845 | * @brief Instance structure for the floating-point PID Control. |
modtronix | 10:6444e6c798ce | 1846 | */ |
modtronix | 10:6444e6c798ce | 1847 | typedef struct |
modtronix | 10:6444e6c798ce | 1848 | { |
modtronix | 10:6444e6c798ce | 1849 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
modtronix | 10:6444e6c798ce | 1850 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
modtronix | 10:6444e6c798ce | 1851 | float32_t A2; /**< The derived gain, A2 = Kd . */ |
modtronix | 10:6444e6c798ce | 1852 | float32_t state[3]; /**< The state array of length 3. */ |
modtronix | 10:6444e6c798ce | 1853 | float32_t Kp; /**< The proportional gain. */ |
modtronix | 10:6444e6c798ce | 1854 | float32_t Ki; /**< The integral gain. */ |
modtronix | 10:6444e6c798ce | 1855 | float32_t Kd; /**< The derivative gain. */ |
modtronix | 10:6444e6c798ce | 1856 | } arm_pid_instance_f32; |
modtronix | 10:6444e6c798ce | 1857 | |
modtronix | 10:6444e6c798ce | 1858 | |
modtronix | 10:6444e6c798ce | 1859 | |
modtronix | 10:6444e6c798ce | 1860 | /** |
modtronix | 10:6444e6c798ce | 1861 | * @brief Initialization function for the floating-point PID Control. |
modtronix | 10:6444e6c798ce | 1862 | * @param[in,out] *S points to an instance of the PID structure. |
modtronix | 10:6444e6c798ce | 1863 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
modtronix | 10:6444e6c798ce | 1864 | * @return none. |
modtronix | 10:6444e6c798ce | 1865 | */ |
modtronix | 10:6444e6c798ce | 1866 | void arm_pid_init_f32( |
modtronix | 10:6444e6c798ce | 1867 | arm_pid_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 1868 | int32_t resetStateFlag); |
modtronix | 10:6444e6c798ce | 1869 | |
modtronix | 10:6444e6c798ce | 1870 | /** |
modtronix | 10:6444e6c798ce | 1871 | * @brief Reset function for the floating-point PID Control. |
modtronix | 10:6444e6c798ce | 1872 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
modtronix | 10:6444e6c798ce | 1873 | * @return none |
modtronix | 10:6444e6c798ce | 1874 | */ |
modtronix | 10:6444e6c798ce | 1875 | void arm_pid_reset_f32( |
modtronix | 10:6444e6c798ce | 1876 | arm_pid_instance_f32 * S); |
modtronix | 10:6444e6c798ce | 1877 | |
modtronix | 10:6444e6c798ce | 1878 | |
modtronix | 10:6444e6c798ce | 1879 | /** |
modtronix | 10:6444e6c798ce | 1880 | * @brief Initialization function for the Q31 PID Control. |
modtronix | 10:6444e6c798ce | 1881 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
modtronix | 10:6444e6c798ce | 1882 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
modtronix | 10:6444e6c798ce | 1883 | * @return none. |
modtronix | 10:6444e6c798ce | 1884 | */ |
modtronix | 10:6444e6c798ce | 1885 | void arm_pid_init_q31( |
modtronix | 10:6444e6c798ce | 1886 | arm_pid_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 1887 | int32_t resetStateFlag); |
modtronix | 10:6444e6c798ce | 1888 | |
modtronix | 10:6444e6c798ce | 1889 | |
modtronix | 10:6444e6c798ce | 1890 | /** |
modtronix | 10:6444e6c798ce | 1891 | * @brief Reset function for the Q31 PID Control. |
modtronix | 10:6444e6c798ce | 1892 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
modtronix | 10:6444e6c798ce | 1893 | * @return none |
modtronix | 10:6444e6c798ce | 1894 | */ |
modtronix | 10:6444e6c798ce | 1895 | |
modtronix | 10:6444e6c798ce | 1896 | void arm_pid_reset_q31( |
modtronix | 10:6444e6c798ce | 1897 | arm_pid_instance_q31 * S); |
modtronix | 10:6444e6c798ce | 1898 | |
modtronix | 10:6444e6c798ce | 1899 | /** |
modtronix | 10:6444e6c798ce | 1900 | * @brief Initialization function for the Q15 PID Control. |
modtronix | 10:6444e6c798ce | 1901 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
modtronix | 10:6444e6c798ce | 1902 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
modtronix | 10:6444e6c798ce | 1903 | * @return none. |
modtronix | 10:6444e6c798ce | 1904 | */ |
modtronix | 10:6444e6c798ce | 1905 | void arm_pid_init_q15( |
modtronix | 10:6444e6c798ce | 1906 | arm_pid_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 1907 | int32_t resetStateFlag); |
modtronix | 10:6444e6c798ce | 1908 | |
modtronix | 10:6444e6c798ce | 1909 | /** |
modtronix | 10:6444e6c798ce | 1910 | * @brief Reset function for the Q15 PID Control. |
modtronix | 10:6444e6c798ce | 1911 | * @param[in,out] *S points to an instance of the q15 PID Control structure |
modtronix | 10:6444e6c798ce | 1912 | * @return none |
modtronix | 10:6444e6c798ce | 1913 | */ |
modtronix | 10:6444e6c798ce | 1914 | void arm_pid_reset_q15( |
modtronix | 10:6444e6c798ce | 1915 | arm_pid_instance_q15 * S); |
modtronix | 10:6444e6c798ce | 1916 | |
modtronix | 10:6444e6c798ce | 1917 | |
modtronix | 10:6444e6c798ce | 1918 | /** |
modtronix | 10:6444e6c798ce | 1919 | * @brief Instance structure for the floating-point Linear Interpolate function. |
modtronix | 10:6444e6c798ce | 1920 | */ |
modtronix | 10:6444e6c798ce | 1921 | typedef struct |
modtronix | 10:6444e6c798ce | 1922 | { |
modtronix | 10:6444e6c798ce | 1923 | uint32_t nValues; /**< nValues */ |
modtronix | 10:6444e6c798ce | 1924 | float32_t x1; /**< x1 */ |
modtronix | 10:6444e6c798ce | 1925 | float32_t xSpacing; /**< xSpacing */ |
modtronix | 10:6444e6c798ce | 1926 | float32_t *pYData; /**< pointer to the table of Y values */ |
modtronix | 10:6444e6c798ce | 1927 | } arm_linear_interp_instance_f32; |
modtronix | 10:6444e6c798ce | 1928 | |
modtronix | 10:6444e6c798ce | 1929 | /** |
modtronix | 10:6444e6c798ce | 1930 | * @brief Instance structure for the floating-point bilinear interpolation function. |
modtronix | 10:6444e6c798ce | 1931 | */ |
modtronix | 10:6444e6c798ce | 1932 | |
modtronix | 10:6444e6c798ce | 1933 | typedef struct |
modtronix | 10:6444e6c798ce | 1934 | { |
modtronix | 10:6444e6c798ce | 1935 | uint16_t numRows; /**< number of rows in the data table. */ |
modtronix | 10:6444e6c798ce | 1936 | uint16_t numCols; /**< number of columns in the data table. */ |
modtronix | 10:6444e6c798ce | 1937 | float32_t *pData; /**< points to the data table. */ |
modtronix | 10:6444e6c798ce | 1938 | } arm_bilinear_interp_instance_f32; |
modtronix | 10:6444e6c798ce | 1939 | |
modtronix | 10:6444e6c798ce | 1940 | /** |
modtronix | 10:6444e6c798ce | 1941 | * @brief Instance structure for the Q31 bilinear interpolation function. |
modtronix | 10:6444e6c798ce | 1942 | */ |
modtronix | 10:6444e6c798ce | 1943 | |
modtronix | 10:6444e6c798ce | 1944 | typedef struct |
modtronix | 10:6444e6c798ce | 1945 | { |
modtronix | 10:6444e6c798ce | 1946 | uint16_t numRows; /**< number of rows in the data table. */ |
modtronix | 10:6444e6c798ce | 1947 | uint16_t numCols; /**< number of columns in the data table. */ |
modtronix | 10:6444e6c798ce | 1948 | q31_t *pData; /**< points to the data table. */ |
modtronix | 10:6444e6c798ce | 1949 | } arm_bilinear_interp_instance_q31; |
modtronix | 10:6444e6c798ce | 1950 | |
modtronix | 10:6444e6c798ce | 1951 | /** |
modtronix | 10:6444e6c798ce | 1952 | * @brief Instance structure for the Q15 bilinear interpolation function. |
modtronix | 10:6444e6c798ce | 1953 | */ |
modtronix | 10:6444e6c798ce | 1954 | |
modtronix | 10:6444e6c798ce | 1955 | typedef struct |
modtronix | 10:6444e6c798ce | 1956 | { |
modtronix | 10:6444e6c798ce | 1957 | uint16_t numRows; /**< number of rows in the data table. */ |
modtronix | 10:6444e6c798ce | 1958 | uint16_t numCols; /**< number of columns in the data table. */ |
modtronix | 10:6444e6c798ce | 1959 | q15_t *pData; /**< points to the data table. */ |
modtronix | 10:6444e6c798ce | 1960 | } arm_bilinear_interp_instance_q15; |
modtronix | 10:6444e6c798ce | 1961 | |
modtronix | 10:6444e6c798ce | 1962 | /** |
modtronix | 10:6444e6c798ce | 1963 | * @brief Instance structure for the Q15 bilinear interpolation function. |
modtronix | 10:6444e6c798ce | 1964 | */ |
modtronix | 10:6444e6c798ce | 1965 | |
modtronix | 10:6444e6c798ce | 1966 | typedef struct |
modtronix | 10:6444e6c798ce | 1967 | { |
modtronix | 10:6444e6c798ce | 1968 | uint16_t numRows; /**< number of rows in the data table. */ |
modtronix | 10:6444e6c798ce | 1969 | uint16_t numCols; /**< number of columns in the data table. */ |
modtronix | 10:6444e6c798ce | 1970 | q7_t *pData; /**< points to the data table. */ |
modtronix | 10:6444e6c798ce | 1971 | } arm_bilinear_interp_instance_q7; |
modtronix | 10:6444e6c798ce | 1972 | |
modtronix | 10:6444e6c798ce | 1973 | |
modtronix | 10:6444e6c798ce | 1974 | /** |
modtronix | 10:6444e6c798ce | 1975 | * @brief Q7 vector multiplication. |
modtronix | 10:6444e6c798ce | 1976 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 1977 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 1978 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 1979 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 1980 | * @return none. |
modtronix | 10:6444e6c798ce | 1981 | */ |
modtronix | 10:6444e6c798ce | 1982 | |
modtronix | 10:6444e6c798ce | 1983 | void arm_mult_q7( |
modtronix | 10:6444e6c798ce | 1984 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 1985 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 1986 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 1987 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 1988 | |
modtronix | 10:6444e6c798ce | 1989 | /** |
modtronix | 10:6444e6c798ce | 1990 | * @brief Q15 vector multiplication. |
modtronix | 10:6444e6c798ce | 1991 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 1992 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 1993 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 1994 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 1995 | * @return none. |
modtronix | 10:6444e6c798ce | 1996 | */ |
modtronix | 10:6444e6c798ce | 1997 | |
modtronix | 10:6444e6c798ce | 1998 | void arm_mult_q15( |
modtronix | 10:6444e6c798ce | 1999 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2000 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2001 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2002 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2003 | |
modtronix | 10:6444e6c798ce | 2004 | /** |
modtronix | 10:6444e6c798ce | 2005 | * @brief Q31 vector multiplication. |
modtronix | 10:6444e6c798ce | 2006 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2007 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2008 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2009 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2010 | * @return none. |
modtronix | 10:6444e6c798ce | 2011 | */ |
modtronix | 10:6444e6c798ce | 2012 | |
modtronix | 10:6444e6c798ce | 2013 | void arm_mult_q31( |
modtronix | 10:6444e6c798ce | 2014 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2015 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2016 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2017 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2018 | |
modtronix | 10:6444e6c798ce | 2019 | /** |
modtronix | 10:6444e6c798ce | 2020 | * @brief Floating-point vector multiplication. |
modtronix | 10:6444e6c798ce | 2021 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2022 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2023 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2024 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2025 | * @return none. |
modtronix | 10:6444e6c798ce | 2026 | */ |
modtronix | 10:6444e6c798ce | 2027 | |
modtronix | 10:6444e6c798ce | 2028 | void arm_mult_f32( |
modtronix | 10:6444e6c798ce | 2029 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2030 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2031 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2032 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2033 | |
modtronix | 10:6444e6c798ce | 2034 | |
modtronix | 10:6444e6c798ce | 2035 | |
modtronix | 10:6444e6c798ce | 2036 | |
modtronix | 10:6444e6c798ce | 2037 | |
modtronix | 10:6444e6c798ce | 2038 | |
modtronix | 10:6444e6c798ce | 2039 | /** |
modtronix | 10:6444e6c798ce | 2040 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2041 | */ |
modtronix | 10:6444e6c798ce | 2042 | |
modtronix | 10:6444e6c798ce | 2043 | typedef struct |
modtronix | 10:6444e6c798ce | 2044 | { |
modtronix | 10:6444e6c798ce | 2045 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2046 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
modtronix | 10:6444e6c798ce | 2047 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2048 | q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2049 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2050 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2051 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2052 | } arm_cfft_radix2_instance_q15; |
modtronix | 10:6444e6c798ce | 2053 | |
modtronix | 10:6444e6c798ce | 2054 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2055 | arm_status arm_cfft_radix2_init_q15( |
modtronix | 10:6444e6c798ce | 2056 | arm_cfft_radix2_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2057 | uint16_t fftLen, |
modtronix | 10:6444e6c798ce | 2058 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2059 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2060 | |
modtronix | 10:6444e6c798ce | 2061 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2062 | void arm_cfft_radix2_q15( |
modtronix | 10:6444e6c798ce | 2063 | const arm_cfft_radix2_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2064 | q15_t * pSrc); |
modtronix | 10:6444e6c798ce | 2065 | |
modtronix | 10:6444e6c798ce | 2066 | |
modtronix | 10:6444e6c798ce | 2067 | |
modtronix | 10:6444e6c798ce | 2068 | /** |
modtronix | 10:6444e6c798ce | 2069 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2070 | */ |
modtronix | 10:6444e6c798ce | 2071 | |
modtronix | 10:6444e6c798ce | 2072 | typedef struct |
modtronix | 10:6444e6c798ce | 2073 | { |
modtronix | 10:6444e6c798ce | 2074 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2075 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
modtronix | 10:6444e6c798ce | 2076 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2077 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2078 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2079 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2080 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2081 | } arm_cfft_radix4_instance_q15; |
modtronix | 10:6444e6c798ce | 2082 | |
modtronix | 10:6444e6c798ce | 2083 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2084 | arm_status arm_cfft_radix4_init_q15( |
modtronix | 10:6444e6c798ce | 2085 | arm_cfft_radix4_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2086 | uint16_t fftLen, |
modtronix | 10:6444e6c798ce | 2087 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2088 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2089 | |
modtronix | 10:6444e6c798ce | 2090 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2091 | void arm_cfft_radix4_q15( |
modtronix | 10:6444e6c798ce | 2092 | const arm_cfft_radix4_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2093 | q15_t * pSrc); |
modtronix | 10:6444e6c798ce | 2094 | |
modtronix | 10:6444e6c798ce | 2095 | /** |
modtronix | 10:6444e6c798ce | 2096 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2097 | */ |
modtronix | 10:6444e6c798ce | 2098 | |
modtronix | 10:6444e6c798ce | 2099 | typedef struct |
modtronix | 10:6444e6c798ce | 2100 | { |
modtronix | 10:6444e6c798ce | 2101 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2102 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
modtronix | 10:6444e6c798ce | 2103 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2104 | q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2105 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2106 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2107 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2108 | } arm_cfft_radix2_instance_q31; |
modtronix | 10:6444e6c798ce | 2109 | |
modtronix | 10:6444e6c798ce | 2110 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2111 | arm_status arm_cfft_radix2_init_q31( |
modtronix | 10:6444e6c798ce | 2112 | arm_cfft_radix2_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2113 | uint16_t fftLen, |
modtronix | 10:6444e6c798ce | 2114 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2115 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2116 | |
modtronix | 10:6444e6c798ce | 2117 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2118 | void arm_cfft_radix2_q31( |
modtronix | 10:6444e6c798ce | 2119 | const arm_cfft_radix2_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2120 | q31_t * pSrc); |
modtronix | 10:6444e6c798ce | 2121 | |
modtronix | 10:6444e6c798ce | 2122 | /** |
modtronix | 10:6444e6c798ce | 2123 | * @brief Instance structure for the Q31 CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2124 | */ |
modtronix | 10:6444e6c798ce | 2125 | |
modtronix | 10:6444e6c798ce | 2126 | typedef struct |
modtronix | 10:6444e6c798ce | 2127 | { |
modtronix | 10:6444e6c798ce | 2128 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2129 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
modtronix | 10:6444e6c798ce | 2130 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2131 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2132 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2133 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2134 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2135 | } arm_cfft_radix4_instance_q31; |
modtronix | 10:6444e6c798ce | 2136 | |
modtronix | 10:6444e6c798ce | 2137 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2138 | void arm_cfft_radix4_q31( |
modtronix | 10:6444e6c798ce | 2139 | const arm_cfft_radix4_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2140 | q31_t * pSrc); |
modtronix | 10:6444e6c798ce | 2141 | |
modtronix | 10:6444e6c798ce | 2142 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2143 | arm_status arm_cfft_radix4_init_q31( |
modtronix | 10:6444e6c798ce | 2144 | arm_cfft_radix4_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2145 | uint16_t fftLen, |
modtronix | 10:6444e6c798ce | 2146 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2147 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2148 | |
modtronix | 10:6444e6c798ce | 2149 | /** |
modtronix | 10:6444e6c798ce | 2150 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2151 | */ |
modtronix | 10:6444e6c798ce | 2152 | |
modtronix | 10:6444e6c798ce | 2153 | typedef struct |
modtronix | 10:6444e6c798ce | 2154 | { |
modtronix | 10:6444e6c798ce | 2155 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2156 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
modtronix | 10:6444e6c798ce | 2157 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2158 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2159 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2160 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2161 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2162 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
modtronix | 10:6444e6c798ce | 2163 | } arm_cfft_radix2_instance_f32; |
modtronix | 10:6444e6c798ce | 2164 | |
modtronix | 10:6444e6c798ce | 2165 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2166 | arm_status arm_cfft_radix2_init_f32( |
modtronix | 10:6444e6c798ce | 2167 | arm_cfft_radix2_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2168 | uint16_t fftLen, |
modtronix | 10:6444e6c798ce | 2169 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2170 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2171 | |
modtronix | 10:6444e6c798ce | 2172 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2173 | void arm_cfft_radix2_f32( |
modtronix | 10:6444e6c798ce | 2174 | const arm_cfft_radix2_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2175 | float32_t * pSrc); |
modtronix | 10:6444e6c798ce | 2176 | |
modtronix | 10:6444e6c798ce | 2177 | /** |
modtronix | 10:6444e6c798ce | 2178 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2179 | */ |
modtronix | 10:6444e6c798ce | 2180 | |
modtronix | 10:6444e6c798ce | 2181 | typedef struct |
modtronix | 10:6444e6c798ce | 2182 | { |
modtronix | 10:6444e6c798ce | 2183 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2184 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
modtronix | 10:6444e6c798ce | 2185 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2186 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2187 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2188 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2189 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2190 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
modtronix | 10:6444e6c798ce | 2191 | } arm_cfft_radix4_instance_f32; |
modtronix | 10:6444e6c798ce | 2192 | |
modtronix | 10:6444e6c798ce | 2193 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2194 | arm_status arm_cfft_radix4_init_f32( |
modtronix | 10:6444e6c798ce | 2195 | arm_cfft_radix4_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2196 | uint16_t fftLen, |
modtronix | 10:6444e6c798ce | 2197 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2198 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2199 | |
modtronix | 10:6444e6c798ce | 2200 | /* Deprecated */ |
modtronix | 10:6444e6c798ce | 2201 | void arm_cfft_radix4_f32( |
modtronix | 10:6444e6c798ce | 2202 | const arm_cfft_radix4_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2203 | float32_t * pSrc); |
modtronix | 10:6444e6c798ce | 2204 | |
modtronix | 10:6444e6c798ce | 2205 | /** |
modtronix | 10:6444e6c798ce | 2206 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2207 | */ |
modtronix | 10:6444e6c798ce | 2208 | |
modtronix | 10:6444e6c798ce | 2209 | typedef struct |
modtronix | 10:6444e6c798ce | 2210 | { |
modtronix | 10:6444e6c798ce | 2211 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2212 | const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2213 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2214 | uint16_t bitRevLength; /**< bit reversal table length. */ |
modtronix | 10:6444e6c798ce | 2215 | } arm_cfft_instance_q15; |
modtronix | 10:6444e6c798ce | 2216 | |
modtronix | 10:6444e6c798ce | 2217 | void arm_cfft_q15( |
modtronix | 10:6444e6c798ce | 2218 | const arm_cfft_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2219 | q15_t * p1, |
modtronix | 10:6444e6c798ce | 2220 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2221 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2222 | |
modtronix | 10:6444e6c798ce | 2223 | /** |
modtronix | 10:6444e6c798ce | 2224 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2225 | */ |
modtronix | 10:6444e6c798ce | 2226 | |
modtronix | 10:6444e6c798ce | 2227 | typedef struct |
modtronix | 10:6444e6c798ce | 2228 | { |
modtronix | 10:6444e6c798ce | 2229 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2230 | const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2231 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2232 | uint16_t bitRevLength; /**< bit reversal table length. */ |
modtronix | 10:6444e6c798ce | 2233 | } arm_cfft_instance_q31; |
modtronix | 10:6444e6c798ce | 2234 | |
modtronix | 10:6444e6c798ce | 2235 | void arm_cfft_q31( |
modtronix | 10:6444e6c798ce | 2236 | const arm_cfft_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2237 | q31_t * p1, |
modtronix | 10:6444e6c798ce | 2238 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2239 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2240 | |
modtronix | 10:6444e6c798ce | 2241 | /** |
modtronix | 10:6444e6c798ce | 2242 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
modtronix | 10:6444e6c798ce | 2243 | */ |
modtronix | 10:6444e6c798ce | 2244 | |
modtronix | 10:6444e6c798ce | 2245 | typedef struct |
modtronix | 10:6444e6c798ce | 2246 | { |
modtronix | 10:6444e6c798ce | 2247 | uint16_t fftLen; /**< length of the FFT. */ |
modtronix | 10:6444e6c798ce | 2248 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2249 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
modtronix | 10:6444e6c798ce | 2250 | uint16_t bitRevLength; /**< bit reversal table length. */ |
modtronix | 10:6444e6c798ce | 2251 | } arm_cfft_instance_f32; |
modtronix | 10:6444e6c798ce | 2252 | |
modtronix | 10:6444e6c798ce | 2253 | void arm_cfft_f32( |
modtronix | 10:6444e6c798ce | 2254 | const arm_cfft_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2255 | float32_t * p1, |
modtronix | 10:6444e6c798ce | 2256 | uint8_t ifftFlag, |
modtronix | 10:6444e6c798ce | 2257 | uint8_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2258 | |
modtronix | 10:6444e6c798ce | 2259 | /** |
modtronix | 10:6444e6c798ce | 2260 | * @brief Instance structure for the Q15 RFFT/RIFFT function. |
modtronix | 10:6444e6c798ce | 2261 | */ |
modtronix | 10:6444e6c798ce | 2262 | |
modtronix | 10:6444e6c798ce | 2263 | typedef struct |
modtronix | 10:6444e6c798ce | 2264 | { |
modtronix | 10:6444e6c798ce | 2265 | uint32_t fftLenReal; /**< length of the real FFT. */ |
modtronix | 10:6444e6c798ce | 2266 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
modtronix | 10:6444e6c798ce | 2267 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2268 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2269 | q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2270 | q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2271 | const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
modtronix | 10:6444e6c798ce | 2272 | } arm_rfft_instance_q15; |
modtronix | 10:6444e6c798ce | 2273 | |
modtronix | 10:6444e6c798ce | 2274 | arm_status arm_rfft_init_q15( |
modtronix | 10:6444e6c798ce | 2275 | arm_rfft_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2276 | uint32_t fftLenReal, |
modtronix | 10:6444e6c798ce | 2277 | uint32_t ifftFlagR, |
modtronix | 10:6444e6c798ce | 2278 | uint32_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2279 | |
modtronix | 10:6444e6c798ce | 2280 | void arm_rfft_q15( |
modtronix | 10:6444e6c798ce | 2281 | const arm_rfft_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2282 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2283 | q15_t * pDst); |
modtronix | 10:6444e6c798ce | 2284 | |
modtronix | 10:6444e6c798ce | 2285 | /** |
modtronix | 10:6444e6c798ce | 2286 | * @brief Instance structure for the Q31 RFFT/RIFFT function. |
modtronix | 10:6444e6c798ce | 2287 | */ |
modtronix | 10:6444e6c798ce | 2288 | |
modtronix | 10:6444e6c798ce | 2289 | typedef struct |
modtronix | 10:6444e6c798ce | 2290 | { |
modtronix | 10:6444e6c798ce | 2291 | uint32_t fftLenReal; /**< length of the real FFT. */ |
modtronix | 10:6444e6c798ce | 2292 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
modtronix | 10:6444e6c798ce | 2293 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2294 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2295 | q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2296 | q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2297 | const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
modtronix | 10:6444e6c798ce | 2298 | } arm_rfft_instance_q31; |
modtronix | 10:6444e6c798ce | 2299 | |
modtronix | 10:6444e6c798ce | 2300 | arm_status arm_rfft_init_q31( |
modtronix | 10:6444e6c798ce | 2301 | arm_rfft_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2302 | uint32_t fftLenReal, |
modtronix | 10:6444e6c798ce | 2303 | uint32_t ifftFlagR, |
modtronix | 10:6444e6c798ce | 2304 | uint32_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2305 | |
modtronix | 10:6444e6c798ce | 2306 | void arm_rfft_q31( |
modtronix | 10:6444e6c798ce | 2307 | const arm_rfft_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2308 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2309 | q31_t * pDst); |
modtronix | 10:6444e6c798ce | 2310 | |
modtronix | 10:6444e6c798ce | 2311 | /** |
modtronix | 10:6444e6c798ce | 2312 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
modtronix | 10:6444e6c798ce | 2313 | */ |
modtronix | 10:6444e6c798ce | 2314 | |
modtronix | 10:6444e6c798ce | 2315 | typedef struct |
modtronix | 10:6444e6c798ce | 2316 | { |
modtronix | 10:6444e6c798ce | 2317 | uint32_t fftLenReal; /**< length of the real FFT. */ |
modtronix | 10:6444e6c798ce | 2318 | uint16_t fftLenBy2; /**< length of the complex FFT. */ |
modtronix | 10:6444e6c798ce | 2319 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
modtronix | 10:6444e6c798ce | 2320 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
modtronix | 10:6444e6c798ce | 2321 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2322 | float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2323 | float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2324 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
modtronix | 10:6444e6c798ce | 2325 | } arm_rfft_instance_f32; |
modtronix | 10:6444e6c798ce | 2326 | |
modtronix | 10:6444e6c798ce | 2327 | arm_status arm_rfft_init_f32( |
modtronix | 10:6444e6c798ce | 2328 | arm_rfft_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2329 | arm_cfft_radix4_instance_f32 * S_CFFT, |
modtronix | 10:6444e6c798ce | 2330 | uint32_t fftLenReal, |
modtronix | 10:6444e6c798ce | 2331 | uint32_t ifftFlagR, |
modtronix | 10:6444e6c798ce | 2332 | uint32_t bitReverseFlag); |
modtronix | 10:6444e6c798ce | 2333 | |
modtronix | 10:6444e6c798ce | 2334 | void arm_rfft_f32( |
modtronix | 10:6444e6c798ce | 2335 | const arm_rfft_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2336 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 2337 | float32_t * pDst); |
modtronix | 10:6444e6c798ce | 2338 | |
modtronix | 10:6444e6c798ce | 2339 | /** |
modtronix | 10:6444e6c798ce | 2340 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
modtronix | 10:6444e6c798ce | 2341 | */ |
modtronix | 10:6444e6c798ce | 2342 | |
modtronix | 10:6444e6c798ce | 2343 | typedef struct |
modtronix | 10:6444e6c798ce | 2344 | { |
modtronix | 10:6444e6c798ce | 2345 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ |
modtronix | 10:6444e6c798ce | 2346 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
modtronix | 10:6444e6c798ce | 2347 | float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
modtronix | 10:6444e6c798ce | 2348 | } arm_rfft_fast_instance_f32 ; |
modtronix | 10:6444e6c798ce | 2349 | |
modtronix | 10:6444e6c798ce | 2350 | arm_status arm_rfft_fast_init_f32 ( |
modtronix | 10:6444e6c798ce | 2351 | arm_rfft_fast_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2352 | uint16_t fftLen); |
modtronix | 10:6444e6c798ce | 2353 | |
modtronix | 10:6444e6c798ce | 2354 | void arm_rfft_fast_f32( |
modtronix | 10:6444e6c798ce | 2355 | arm_rfft_fast_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2356 | float32_t * p, float32_t * pOut, |
modtronix | 10:6444e6c798ce | 2357 | uint8_t ifftFlag); |
modtronix | 10:6444e6c798ce | 2358 | |
modtronix | 10:6444e6c798ce | 2359 | /** |
modtronix | 10:6444e6c798ce | 2360 | * @brief Instance structure for the floating-point DCT4/IDCT4 function. |
modtronix | 10:6444e6c798ce | 2361 | */ |
modtronix | 10:6444e6c798ce | 2362 | |
modtronix | 10:6444e6c798ce | 2363 | typedef struct |
modtronix | 10:6444e6c798ce | 2364 | { |
modtronix | 10:6444e6c798ce | 2365 | uint16_t N; /**< length of the DCT4. */ |
modtronix | 10:6444e6c798ce | 2366 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
modtronix | 10:6444e6c798ce | 2367 | float32_t normalize; /**< normalizing factor. */ |
modtronix | 10:6444e6c798ce | 2368 | float32_t *pTwiddle; /**< points to the twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2369 | float32_t *pCosFactor; /**< points to the cosFactor table. */ |
modtronix | 10:6444e6c798ce | 2370 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ |
modtronix | 10:6444e6c798ce | 2371 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
modtronix | 10:6444e6c798ce | 2372 | } arm_dct4_instance_f32; |
modtronix | 10:6444e6c798ce | 2373 | |
modtronix | 10:6444e6c798ce | 2374 | /** |
modtronix | 10:6444e6c798ce | 2375 | * @brief Initialization function for the floating-point DCT4/IDCT4. |
modtronix | 10:6444e6c798ce | 2376 | * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure. |
modtronix | 10:6444e6c798ce | 2377 | * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure. |
modtronix | 10:6444e6c798ce | 2378 | * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure. |
modtronix | 10:6444e6c798ce | 2379 | * @param[in] N length of the DCT4. |
modtronix | 10:6444e6c798ce | 2380 | * @param[in] Nby2 half of the length of the DCT4. |
modtronix | 10:6444e6c798ce | 2381 | * @param[in] normalize normalizing factor. |
modtronix | 10:6444e6c798ce | 2382 | * @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. |
modtronix | 10:6444e6c798ce | 2383 | */ |
modtronix | 10:6444e6c798ce | 2384 | |
modtronix | 10:6444e6c798ce | 2385 | arm_status arm_dct4_init_f32( |
modtronix | 10:6444e6c798ce | 2386 | arm_dct4_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2387 | arm_rfft_instance_f32 * S_RFFT, |
modtronix | 10:6444e6c798ce | 2388 | arm_cfft_radix4_instance_f32 * S_CFFT, |
modtronix | 10:6444e6c798ce | 2389 | uint16_t N, |
modtronix | 10:6444e6c798ce | 2390 | uint16_t Nby2, |
modtronix | 10:6444e6c798ce | 2391 | float32_t normalize); |
modtronix | 10:6444e6c798ce | 2392 | |
modtronix | 10:6444e6c798ce | 2393 | /** |
modtronix | 10:6444e6c798ce | 2394 | * @brief Processing function for the floating-point DCT4/IDCT4. |
modtronix | 10:6444e6c798ce | 2395 | * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure. |
modtronix | 10:6444e6c798ce | 2396 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 2397 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
modtronix | 10:6444e6c798ce | 2398 | * @return none. |
modtronix | 10:6444e6c798ce | 2399 | */ |
modtronix | 10:6444e6c798ce | 2400 | |
modtronix | 10:6444e6c798ce | 2401 | void arm_dct4_f32( |
modtronix | 10:6444e6c798ce | 2402 | const arm_dct4_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 2403 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 2404 | float32_t * pInlineBuffer); |
modtronix | 10:6444e6c798ce | 2405 | |
modtronix | 10:6444e6c798ce | 2406 | /** |
modtronix | 10:6444e6c798ce | 2407 | * @brief Instance structure for the Q31 DCT4/IDCT4 function. |
modtronix | 10:6444e6c798ce | 2408 | */ |
modtronix | 10:6444e6c798ce | 2409 | |
modtronix | 10:6444e6c798ce | 2410 | typedef struct |
modtronix | 10:6444e6c798ce | 2411 | { |
modtronix | 10:6444e6c798ce | 2412 | uint16_t N; /**< length of the DCT4. */ |
modtronix | 10:6444e6c798ce | 2413 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
modtronix | 10:6444e6c798ce | 2414 | q31_t normalize; /**< normalizing factor. */ |
modtronix | 10:6444e6c798ce | 2415 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2416 | q31_t *pCosFactor; /**< points to the cosFactor table. */ |
modtronix | 10:6444e6c798ce | 2417 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ |
modtronix | 10:6444e6c798ce | 2418 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
modtronix | 10:6444e6c798ce | 2419 | } arm_dct4_instance_q31; |
modtronix | 10:6444e6c798ce | 2420 | |
modtronix | 10:6444e6c798ce | 2421 | /** |
modtronix | 10:6444e6c798ce | 2422 | * @brief Initialization function for the Q31 DCT4/IDCT4. |
modtronix | 10:6444e6c798ce | 2423 | * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure. |
modtronix | 10:6444e6c798ce | 2424 | * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure |
modtronix | 10:6444e6c798ce | 2425 | * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure |
modtronix | 10:6444e6c798ce | 2426 | * @param[in] N length of the DCT4. |
modtronix | 10:6444e6c798ce | 2427 | * @param[in] Nby2 half of the length of the DCT4. |
modtronix | 10:6444e6c798ce | 2428 | * @param[in] normalize normalizing factor. |
modtronix | 10:6444e6c798ce | 2429 | * @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. |
modtronix | 10:6444e6c798ce | 2430 | */ |
modtronix | 10:6444e6c798ce | 2431 | |
modtronix | 10:6444e6c798ce | 2432 | arm_status arm_dct4_init_q31( |
modtronix | 10:6444e6c798ce | 2433 | arm_dct4_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2434 | arm_rfft_instance_q31 * S_RFFT, |
modtronix | 10:6444e6c798ce | 2435 | arm_cfft_radix4_instance_q31 * S_CFFT, |
modtronix | 10:6444e6c798ce | 2436 | uint16_t N, |
modtronix | 10:6444e6c798ce | 2437 | uint16_t Nby2, |
modtronix | 10:6444e6c798ce | 2438 | q31_t normalize); |
modtronix | 10:6444e6c798ce | 2439 | |
modtronix | 10:6444e6c798ce | 2440 | /** |
modtronix | 10:6444e6c798ce | 2441 | * @brief Processing function for the Q31 DCT4/IDCT4. |
modtronix | 10:6444e6c798ce | 2442 | * @param[in] *S points to an instance of the Q31 DCT4 structure. |
modtronix | 10:6444e6c798ce | 2443 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 2444 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
modtronix | 10:6444e6c798ce | 2445 | * @return none. |
modtronix | 10:6444e6c798ce | 2446 | */ |
modtronix | 10:6444e6c798ce | 2447 | |
modtronix | 10:6444e6c798ce | 2448 | void arm_dct4_q31( |
modtronix | 10:6444e6c798ce | 2449 | const arm_dct4_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 2450 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 2451 | q31_t * pInlineBuffer); |
modtronix | 10:6444e6c798ce | 2452 | |
modtronix | 10:6444e6c798ce | 2453 | /** |
modtronix | 10:6444e6c798ce | 2454 | * @brief Instance structure for the Q15 DCT4/IDCT4 function. |
modtronix | 10:6444e6c798ce | 2455 | */ |
modtronix | 10:6444e6c798ce | 2456 | |
modtronix | 10:6444e6c798ce | 2457 | typedef struct |
modtronix | 10:6444e6c798ce | 2458 | { |
modtronix | 10:6444e6c798ce | 2459 | uint16_t N; /**< length of the DCT4. */ |
modtronix | 10:6444e6c798ce | 2460 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
modtronix | 10:6444e6c798ce | 2461 | q15_t normalize; /**< normalizing factor. */ |
modtronix | 10:6444e6c798ce | 2462 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
modtronix | 10:6444e6c798ce | 2463 | q15_t *pCosFactor; /**< points to the cosFactor table. */ |
modtronix | 10:6444e6c798ce | 2464 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ |
modtronix | 10:6444e6c798ce | 2465 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
modtronix | 10:6444e6c798ce | 2466 | } arm_dct4_instance_q15; |
modtronix | 10:6444e6c798ce | 2467 | |
modtronix | 10:6444e6c798ce | 2468 | /** |
modtronix | 10:6444e6c798ce | 2469 | * @brief Initialization function for the Q15 DCT4/IDCT4. |
modtronix | 10:6444e6c798ce | 2470 | * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure. |
modtronix | 10:6444e6c798ce | 2471 | * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure. |
modtronix | 10:6444e6c798ce | 2472 | * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure. |
modtronix | 10:6444e6c798ce | 2473 | * @param[in] N length of the DCT4. |
modtronix | 10:6444e6c798ce | 2474 | * @param[in] Nby2 half of the length of the DCT4. |
modtronix | 10:6444e6c798ce | 2475 | * @param[in] normalize normalizing factor. |
modtronix | 10:6444e6c798ce | 2476 | * @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. |
modtronix | 10:6444e6c798ce | 2477 | */ |
modtronix | 10:6444e6c798ce | 2478 | |
modtronix | 10:6444e6c798ce | 2479 | arm_status arm_dct4_init_q15( |
modtronix | 10:6444e6c798ce | 2480 | arm_dct4_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2481 | arm_rfft_instance_q15 * S_RFFT, |
modtronix | 10:6444e6c798ce | 2482 | arm_cfft_radix4_instance_q15 * S_CFFT, |
modtronix | 10:6444e6c798ce | 2483 | uint16_t N, |
modtronix | 10:6444e6c798ce | 2484 | uint16_t Nby2, |
modtronix | 10:6444e6c798ce | 2485 | q15_t normalize); |
modtronix | 10:6444e6c798ce | 2486 | |
modtronix | 10:6444e6c798ce | 2487 | /** |
modtronix | 10:6444e6c798ce | 2488 | * @brief Processing function for the Q15 DCT4/IDCT4. |
modtronix | 10:6444e6c798ce | 2489 | * @param[in] *S points to an instance of the Q15 DCT4 structure. |
modtronix | 10:6444e6c798ce | 2490 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 2491 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
modtronix | 10:6444e6c798ce | 2492 | * @return none. |
modtronix | 10:6444e6c798ce | 2493 | */ |
modtronix | 10:6444e6c798ce | 2494 | |
modtronix | 10:6444e6c798ce | 2495 | void arm_dct4_q15( |
modtronix | 10:6444e6c798ce | 2496 | const arm_dct4_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 2497 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 2498 | q15_t * pInlineBuffer); |
modtronix | 10:6444e6c798ce | 2499 | |
modtronix | 10:6444e6c798ce | 2500 | /** |
modtronix | 10:6444e6c798ce | 2501 | * @brief Floating-point vector addition. |
modtronix | 10:6444e6c798ce | 2502 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2503 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2504 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2505 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2506 | * @return none. |
modtronix | 10:6444e6c798ce | 2507 | */ |
modtronix | 10:6444e6c798ce | 2508 | |
modtronix | 10:6444e6c798ce | 2509 | void arm_add_f32( |
modtronix | 10:6444e6c798ce | 2510 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2511 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2512 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2513 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2514 | |
modtronix | 10:6444e6c798ce | 2515 | /** |
modtronix | 10:6444e6c798ce | 2516 | * @brief Q7 vector addition. |
modtronix | 10:6444e6c798ce | 2517 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2518 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2519 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2520 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2521 | * @return none. |
modtronix | 10:6444e6c798ce | 2522 | */ |
modtronix | 10:6444e6c798ce | 2523 | |
modtronix | 10:6444e6c798ce | 2524 | void arm_add_q7( |
modtronix | 10:6444e6c798ce | 2525 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2526 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2527 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2528 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2529 | |
modtronix | 10:6444e6c798ce | 2530 | /** |
modtronix | 10:6444e6c798ce | 2531 | * @brief Q15 vector addition. |
modtronix | 10:6444e6c798ce | 2532 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2533 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2534 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2535 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2536 | * @return none. |
modtronix | 10:6444e6c798ce | 2537 | */ |
modtronix | 10:6444e6c798ce | 2538 | |
modtronix | 10:6444e6c798ce | 2539 | void arm_add_q15( |
modtronix | 10:6444e6c798ce | 2540 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2541 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2542 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2543 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2544 | |
modtronix | 10:6444e6c798ce | 2545 | /** |
modtronix | 10:6444e6c798ce | 2546 | * @brief Q31 vector addition. |
modtronix | 10:6444e6c798ce | 2547 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2548 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2549 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2550 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2551 | * @return none. |
modtronix | 10:6444e6c798ce | 2552 | */ |
modtronix | 10:6444e6c798ce | 2553 | |
modtronix | 10:6444e6c798ce | 2554 | void arm_add_q31( |
modtronix | 10:6444e6c798ce | 2555 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2556 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2557 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2558 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2559 | |
modtronix | 10:6444e6c798ce | 2560 | /** |
modtronix | 10:6444e6c798ce | 2561 | * @brief Floating-point vector subtraction. |
modtronix | 10:6444e6c798ce | 2562 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2563 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2564 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2565 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2566 | * @return none. |
modtronix | 10:6444e6c798ce | 2567 | */ |
modtronix | 10:6444e6c798ce | 2568 | |
modtronix | 10:6444e6c798ce | 2569 | void arm_sub_f32( |
modtronix | 10:6444e6c798ce | 2570 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2571 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2572 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2573 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2574 | |
modtronix | 10:6444e6c798ce | 2575 | /** |
modtronix | 10:6444e6c798ce | 2576 | * @brief Q7 vector subtraction. |
modtronix | 10:6444e6c798ce | 2577 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2578 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2579 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2580 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2581 | * @return none. |
modtronix | 10:6444e6c798ce | 2582 | */ |
modtronix | 10:6444e6c798ce | 2583 | |
modtronix | 10:6444e6c798ce | 2584 | void arm_sub_q7( |
modtronix | 10:6444e6c798ce | 2585 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2586 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2587 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2588 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2589 | |
modtronix | 10:6444e6c798ce | 2590 | /** |
modtronix | 10:6444e6c798ce | 2591 | * @brief Q15 vector subtraction. |
modtronix | 10:6444e6c798ce | 2592 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2593 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2594 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2595 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2596 | * @return none. |
modtronix | 10:6444e6c798ce | 2597 | */ |
modtronix | 10:6444e6c798ce | 2598 | |
modtronix | 10:6444e6c798ce | 2599 | void arm_sub_q15( |
modtronix | 10:6444e6c798ce | 2600 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2601 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2602 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2603 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2604 | |
modtronix | 10:6444e6c798ce | 2605 | /** |
modtronix | 10:6444e6c798ce | 2606 | * @brief Q31 vector subtraction. |
modtronix | 10:6444e6c798ce | 2607 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2608 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2609 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2610 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2611 | * @return none. |
modtronix | 10:6444e6c798ce | 2612 | */ |
modtronix | 10:6444e6c798ce | 2613 | |
modtronix | 10:6444e6c798ce | 2614 | void arm_sub_q31( |
modtronix | 10:6444e6c798ce | 2615 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2616 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2617 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2618 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2619 | |
modtronix | 10:6444e6c798ce | 2620 | /** |
modtronix | 10:6444e6c798ce | 2621 | * @brief Multiplies a floating-point vector by a scalar. |
modtronix | 10:6444e6c798ce | 2622 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2623 | * @param[in] scale scale factor to be applied |
modtronix | 10:6444e6c798ce | 2624 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2625 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2626 | * @return none. |
modtronix | 10:6444e6c798ce | 2627 | */ |
modtronix | 10:6444e6c798ce | 2628 | |
modtronix | 10:6444e6c798ce | 2629 | void arm_scale_f32( |
modtronix | 10:6444e6c798ce | 2630 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 2631 | float32_t scale, |
modtronix | 10:6444e6c798ce | 2632 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2633 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2634 | |
modtronix | 10:6444e6c798ce | 2635 | /** |
modtronix | 10:6444e6c798ce | 2636 | * @brief Multiplies a Q7 vector by a scalar. |
modtronix | 10:6444e6c798ce | 2637 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2638 | * @param[in] scaleFract fractional portion of the scale value |
modtronix | 10:6444e6c798ce | 2639 | * @param[in] shift number of bits to shift the result by |
modtronix | 10:6444e6c798ce | 2640 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2641 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2642 | * @return none. |
modtronix | 10:6444e6c798ce | 2643 | */ |
modtronix | 10:6444e6c798ce | 2644 | |
modtronix | 10:6444e6c798ce | 2645 | void arm_scale_q7( |
modtronix | 10:6444e6c798ce | 2646 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 2647 | q7_t scaleFract, |
modtronix | 10:6444e6c798ce | 2648 | int8_t shift, |
modtronix | 10:6444e6c798ce | 2649 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2650 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2651 | |
modtronix | 10:6444e6c798ce | 2652 | /** |
modtronix | 10:6444e6c798ce | 2653 | * @brief Multiplies a Q15 vector by a scalar. |
modtronix | 10:6444e6c798ce | 2654 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2655 | * @param[in] scaleFract fractional portion of the scale value |
modtronix | 10:6444e6c798ce | 2656 | * @param[in] shift number of bits to shift the result by |
modtronix | 10:6444e6c798ce | 2657 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2658 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2659 | * @return none. |
modtronix | 10:6444e6c798ce | 2660 | */ |
modtronix | 10:6444e6c798ce | 2661 | |
modtronix | 10:6444e6c798ce | 2662 | void arm_scale_q15( |
modtronix | 10:6444e6c798ce | 2663 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2664 | q15_t scaleFract, |
modtronix | 10:6444e6c798ce | 2665 | int8_t shift, |
modtronix | 10:6444e6c798ce | 2666 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2667 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2668 | |
modtronix | 10:6444e6c798ce | 2669 | /** |
modtronix | 10:6444e6c798ce | 2670 | * @brief Multiplies a Q31 vector by a scalar. |
modtronix | 10:6444e6c798ce | 2671 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2672 | * @param[in] scaleFract fractional portion of the scale value |
modtronix | 10:6444e6c798ce | 2673 | * @param[in] shift number of bits to shift the result by |
modtronix | 10:6444e6c798ce | 2674 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2675 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2676 | * @return none. |
modtronix | 10:6444e6c798ce | 2677 | */ |
modtronix | 10:6444e6c798ce | 2678 | |
modtronix | 10:6444e6c798ce | 2679 | void arm_scale_q31( |
modtronix | 10:6444e6c798ce | 2680 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2681 | q31_t scaleFract, |
modtronix | 10:6444e6c798ce | 2682 | int8_t shift, |
modtronix | 10:6444e6c798ce | 2683 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2684 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2685 | |
modtronix | 10:6444e6c798ce | 2686 | /** |
modtronix | 10:6444e6c798ce | 2687 | * @brief Q7 vector absolute value. |
modtronix | 10:6444e6c798ce | 2688 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 2689 | * @param[out] *pDst points to the output buffer |
modtronix | 10:6444e6c798ce | 2690 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2691 | * @return none. |
modtronix | 10:6444e6c798ce | 2692 | */ |
modtronix | 10:6444e6c798ce | 2693 | |
modtronix | 10:6444e6c798ce | 2694 | void arm_abs_q7( |
modtronix | 10:6444e6c798ce | 2695 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 2696 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2697 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2698 | |
modtronix | 10:6444e6c798ce | 2699 | /** |
modtronix | 10:6444e6c798ce | 2700 | * @brief Floating-point vector absolute value. |
modtronix | 10:6444e6c798ce | 2701 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 2702 | * @param[out] *pDst points to the output buffer |
modtronix | 10:6444e6c798ce | 2703 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2704 | * @return none. |
modtronix | 10:6444e6c798ce | 2705 | */ |
modtronix | 10:6444e6c798ce | 2706 | |
modtronix | 10:6444e6c798ce | 2707 | void arm_abs_f32( |
modtronix | 10:6444e6c798ce | 2708 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 2709 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2710 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2711 | |
modtronix | 10:6444e6c798ce | 2712 | /** |
modtronix | 10:6444e6c798ce | 2713 | * @brief Q15 vector absolute value. |
modtronix | 10:6444e6c798ce | 2714 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 2715 | * @param[out] *pDst points to the output buffer |
modtronix | 10:6444e6c798ce | 2716 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2717 | * @return none. |
modtronix | 10:6444e6c798ce | 2718 | */ |
modtronix | 10:6444e6c798ce | 2719 | |
modtronix | 10:6444e6c798ce | 2720 | void arm_abs_q15( |
modtronix | 10:6444e6c798ce | 2721 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2722 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2723 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2724 | |
modtronix | 10:6444e6c798ce | 2725 | /** |
modtronix | 10:6444e6c798ce | 2726 | * @brief Q31 vector absolute value. |
modtronix | 10:6444e6c798ce | 2727 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 2728 | * @param[out] *pDst points to the output buffer |
modtronix | 10:6444e6c798ce | 2729 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2730 | * @return none. |
modtronix | 10:6444e6c798ce | 2731 | */ |
modtronix | 10:6444e6c798ce | 2732 | |
modtronix | 10:6444e6c798ce | 2733 | void arm_abs_q31( |
modtronix | 10:6444e6c798ce | 2734 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2735 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2736 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2737 | |
modtronix | 10:6444e6c798ce | 2738 | /** |
modtronix | 10:6444e6c798ce | 2739 | * @brief Dot product of floating-point vectors. |
modtronix | 10:6444e6c798ce | 2740 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2741 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2742 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2743 | * @param[out] *result output result returned here |
modtronix | 10:6444e6c798ce | 2744 | * @return none. |
modtronix | 10:6444e6c798ce | 2745 | */ |
modtronix | 10:6444e6c798ce | 2746 | |
modtronix | 10:6444e6c798ce | 2747 | void arm_dot_prod_f32( |
modtronix | 10:6444e6c798ce | 2748 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2749 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2750 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 2751 | float32_t * result); |
modtronix | 10:6444e6c798ce | 2752 | |
modtronix | 10:6444e6c798ce | 2753 | /** |
modtronix | 10:6444e6c798ce | 2754 | * @brief Dot product of Q7 vectors. |
modtronix | 10:6444e6c798ce | 2755 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2756 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2757 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2758 | * @param[out] *result output result returned here |
modtronix | 10:6444e6c798ce | 2759 | * @return none. |
modtronix | 10:6444e6c798ce | 2760 | */ |
modtronix | 10:6444e6c798ce | 2761 | |
modtronix | 10:6444e6c798ce | 2762 | void arm_dot_prod_q7( |
modtronix | 10:6444e6c798ce | 2763 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2764 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2765 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 2766 | q31_t * result); |
modtronix | 10:6444e6c798ce | 2767 | |
modtronix | 10:6444e6c798ce | 2768 | /** |
modtronix | 10:6444e6c798ce | 2769 | * @brief Dot product of Q15 vectors. |
modtronix | 10:6444e6c798ce | 2770 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2771 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2772 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2773 | * @param[out] *result output result returned here |
modtronix | 10:6444e6c798ce | 2774 | * @return none. |
modtronix | 10:6444e6c798ce | 2775 | */ |
modtronix | 10:6444e6c798ce | 2776 | |
modtronix | 10:6444e6c798ce | 2777 | void arm_dot_prod_q15( |
modtronix | 10:6444e6c798ce | 2778 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2779 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2780 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 2781 | q63_t * result); |
modtronix | 10:6444e6c798ce | 2782 | |
modtronix | 10:6444e6c798ce | 2783 | /** |
modtronix | 10:6444e6c798ce | 2784 | * @brief Dot product of Q31 vectors. |
modtronix | 10:6444e6c798ce | 2785 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 2786 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 2787 | * @param[in] blockSize number of samples in each vector |
modtronix | 10:6444e6c798ce | 2788 | * @param[out] *result output result returned here |
modtronix | 10:6444e6c798ce | 2789 | * @return none. |
modtronix | 10:6444e6c798ce | 2790 | */ |
modtronix | 10:6444e6c798ce | 2791 | |
modtronix | 10:6444e6c798ce | 2792 | void arm_dot_prod_q31( |
modtronix | 10:6444e6c798ce | 2793 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 2794 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 2795 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 2796 | q63_t * result); |
modtronix | 10:6444e6c798ce | 2797 | |
modtronix | 10:6444e6c798ce | 2798 | /** |
modtronix | 10:6444e6c798ce | 2799 | * @brief Shifts the elements of a Q7 vector a specified number of bits. |
modtronix | 10:6444e6c798ce | 2800 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2801 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
modtronix | 10:6444e6c798ce | 2802 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2803 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2804 | * @return none. |
modtronix | 10:6444e6c798ce | 2805 | */ |
modtronix | 10:6444e6c798ce | 2806 | |
modtronix | 10:6444e6c798ce | 2807 | void arm_shift_q7( |
modtronix | 10:6444e6c798ce | 2808 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 2809 | int8_t shiftBits, |
modtronix | 10:6444e6c798ce | 2810 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2811 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2812 | |
modtronix | 10:6444e6c798ce | 2813 | /** |
modtronix | 10:6444e6c798ce | 2814 | * @brief Shifts the elements of a Q15 vector a specified number of bits. |
modtronix | 10:6444e6c798ce | 2815 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2816 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
modtronix | 10:6444e6c798ce | 2817 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2818 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2819 | * @return none. |
modtronix | 10:6444e6c798ce | 2820 | */ |
modtronix | 10:6444e6c798ce | 2821 | |
modtronix | 10:6444e6c798ce | 2822 | void arm_shift_q15( |
modtronix | 10:6444e6c798ce | 2823 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2824 | int8_t shiftBits, |
modtronix | 10:6444e6c798ce | 2825 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2826 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2827 | |
modtronix | 10:6444e6c798ce | 2828 | /** |
modtronix | 10:6444e6c798ce | 2829 | * @brief Shifts the elements of a Q31 vector a specified number of bits. |
modtronix | 10:6444e6c798ce | 2830 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2831 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
modtronix | 10:6444e6c798ce | 2832 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2833 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2834 | * @return none. |
modtronix | 10:6444e6c798ce | 2835 | */ |
modtronix | 10:6444e6c798ce | 2836 | |
modtronix | 10:6444e6c798ce | 2837 | void arm_shift_q31( |
modtronix | 10:6444e6c798ce | 2838 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2839 | int8_t shiftBits, |
modtronix | 10:6444e6c798ce | 2840 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2841 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2842 | |
modtronix | 10:6444e6c798ce | 2843 | /** |
modtronix | 10:6444e6c798ce | 2844 | * @brief Adds a constant offset to a floating-point vector. |
modtronix | 10:6444e6c798ce | 2845 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2846 | * @param[in] offset is the offset to be added |
modtronix | 10:6444e6c798ce | 2847 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2848 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2849 | * @return none. |
modtronix | 10:6444e6c798ce | 2850 | */ |
modtronix | 10:6444e6c798ce | 2851 | |
modtronix | 10:6444e6c798ce | 2852 | void arm_offset_f32( |
modtronix | 10:6444e6c798ce | 2853 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 2854 | float32_t offset, |
modtronix | 10:6444e6c798ce | 2855 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2856 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2857 | |
modtronix | 10:6444e6c798ce | 2858 | /** |
modtronix | 10:6444e6c798ce | 2859 | * @brief Adds a constant offset to a Q7 vector. |
modtronix | 10:6444e6c798ce | 2860 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2861 | * @param[in] offset is the offset to be added |
modtronix | 10:6444e6c798ce | 2862 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2863 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2864 | * @return none. |
modtronix | 10:6444e6c798ce | 2865 | */ |
modtronix | 10:6444e6c798ce | 2866 | |
modtronix | 10:6444e6c798ce | 2867 | void arm_offset_q7( |
modtronix | 10:6444e6c798ce | 2868 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 2869 | q7_t offset, |
modtronix | 10:6444e6c798ce | 2870 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2871 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2872 | |
modtronix | 10:6444e6c798ce | 2873 | /** |
modtronix | 10:6444e6c798ce | 2874 | * @brief Adds a constant offset to a Q15 vector. |
modtronix | 10:6444e6c798ce | 2875 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2876 | * @param[in] offset is the offset to be added |
modtronix | 10:6444e6c798ce | 2877 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2878 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2879 | * @return none. |
modtronix | 10:6444e6c798ce | 2880 | */ |
modtronix | 10:6444e6c798ce | 2881 | |
modtronix | 10:6444e6c798ce | 2882 | void arm_offset_q15( |
modtronix | 10:6444e6c798ce | 2883 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2884 | q15_t offset, |
modtronix | 10:6444e6c798ce | 2885 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2886 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2887 | |
modtronix | 10:6444e6c798ce | 2888 | /** |
modtronix | 10:6444e6c798ce | 2889 | * @brief Adds a constant offset to a Q31 vector. |
modtronix | 10:6444e6c798ce | 2890 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2891 | * @param[in] offset is the offset to be added |
modtronix | 10:6444e6c798ce | 2892 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2893 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2894 | * @return none. |
modtronix | 10:6444e6c798ce | 2895 | */ |
modtronix | 10:6444e6c798ce | 2896 | |
modtronix | 10:6444e6c798ce | 2897 | void arm_offset_q31( |
modtronix | 10:6444e6c798ce | 2898 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2899 | q31_t offset, |
modtronix | 10:6444e6c798ce | 2900 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2901 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2902 | |
modtronix | 10:6444e6c798ce | 2903 | /** |
modtronix | 10:6444e6c798ce | 2904 | * @brief Negates the elements of a floating-point vector. |
modtronix | 10:6444e6c798ce | 2905 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2906 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2907 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2908 | * @return none. |
modtronix | 10:6444e6c798ce | 2909 | */ |
modtronix | 10:6444e6c798ce | 2910 | |
modtronix | 10:6444e6c798ce | 2911 | void arm_negate_f32( |
modtronix | 10:6444e6c798ce | 2912 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 2913 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2914 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2915 | |
modtronix | 10:6444e6c798ce | 2916 | /** |
modtronix | 10:6444e6c798ce | 2917 | * @brief Negates the elements of a Q7 vector. |
modtronix | 10:6444e6c798ce | 2918 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2919 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2920 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2921 | * @return none. |
modtronix | 10:6444e6c798ce | 2922 | */ |
modtronix | 10:6444e6c798ce | 2923 | |
modtronix | 10:6444e6c798ce | 2924 | void arm_negate_q7( |
modtronix | 10:6444e6c798ce | 2925 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 2926 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2927 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2928 | |
modtronix | 10:6444e6c798ce | 2929 | /** |
modtronix | 10:6444e6c798ce | 2930 | * @brief Negates the elements of a Q15 vector. |
modtronix | 10:6444e6c798ce | 2931 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2932 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2933 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2934 | * @return none. |
modtronix | 10:6444e6c798ce | 2935 | */ |
modtronix | 10:6444e6c798ce | 2936 | |
modtronix | 10:6444e6c798ce | 2937 | void arm_negate_q15( |
modtronix | 10:6444e6c798ce | 2938 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2939 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2940 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2941 | |
modtronix | 10:6444e6c798ce | 2942 | /** |
modtronix | 10:6444e6c798ce | 2943 | * @brief Negates the elements of a Q31 vector. |
modtronix | 10:6444e6c798ce | 2944 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 2945 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 2946 | * @param[in] blockSize number of samples in the vector |
modtronix | 10:6444e6c798ce | 2947 | * @return none. |
modtronix | 10:6444e6c798ce | 2948 | */ |
modtronix | 10:6444e6c798ce | 2949 | |
modtronix | 10:6444e6c798ce | 2950 | void arm_negate_q31( |
modtronix | 10:6444e6c798ce | 2951 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2952 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 2953 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2954 | /** |
modtronix | 10:6444e6c798ce | 2955 | * @brief Copies the elements of a floating-point vector. |
modtronix | 10:6444e6c798ce | 2956 | * @param[in] *pSrc input pointer |
modtronix | 10:6444e6c798ce | 2957 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 2958 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 2959 | * @return none. |
modtronix | 10:6444e6c798ce | 2960 | */ |
modtronix | 10:6444e6c798ce | 2961 | void arm_copy_f32( |
modtronix | 10:6444e6c798ce | 2962 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 2963 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 2964 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2965 | |
modtronix | 10:6444e6c798ce | 2966 | /** |
modtronix | 10:6444e6c798ce | 2967 | * @brief Copies the elements of a Q7 vector. |
modtronix | 10:6444e6c798ce | 2968 | * @param[in] *pSrc input pointer |
modtronix | 10:6444e6c798ce | 2969 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 2970 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 2971 | * @return none. |
modtronix | 10:6444e6c798ce | 2972 | */ |
modtronix | 10:6444e6c798ce | 2973 | void arm_copy_q7( |
modtronix | 10:6444e6c798ce | 2974 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 2975 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 2976 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2977 | |
modtronix | 10:6444e6c798ce | 2978 | /** |
modtronix | 10:6444e6c798ce | 2979 | * @brief Copies the elements of a Q15 vector. |
modtronix | 10:6444e6c798ce | 2980 | * @param[in] *pSrc input pointer |
modtronix | 10:6444e6c798ce | 2981 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 2982 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 2983 | * @return none. |
modtronix | 10:6444e6c798ce | 2984 | */ |
modtronix | 10:6444e6c798ce | 2985 | void arm_copy_q15( |
modtronix | 10:6444e6c798ce | 2986 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 2987 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 2988 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 2989 | |
modtronix | 10:6444e6c798ce | 2990 | /** |
modtronix | 10:6444e6c798ce | 2991 | * @brief Copies the elements of a Q31 vector. |
modtronix | 10:6444e6c798ce | 2992 | * @param[in] *pSrc input pointer |
modtronix | 10:6444e6c798ce | 2993 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 2994 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 2995 | * @return none. |
modtronix | 10:6444e6c798ce | 2996 | */ |
modtronix | 10:6444e6c798ce | 2997 | void arm_copy_q31( |
modtronix | 10:6444e6c798ce | 2998 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 2999 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3000 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3001 | /** |
modtronix | 10:6444e6c798ce | 3002 | * @brief Fills a constant value into a floating-point vector. |
modtronix | 10:6444e6c798ce | 3003 | * @param[in] value input value to be filled |
modtronix | 10:6444e6c798ce | 3004 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 3005 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 3006 | * @return none. |
modtronix | 10:6444e6c798ce | 3007 | */ |
modtronix | 10:6444e6c798ce | 3008 | void arm_fill_f32( |
modtronix | 10:6444e6c798ce | 3009 | float32_t value, |
modtronix | 10:6444e6c798ce | 3010 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 3011 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3012 | |
modtronix | 10:6444e6c798ce | 3013 | /** |
modtronix | 10:6444e6c798ce | 3014 | * @brief Fills a constant value into a Q7 vector. |
modtronix | 10:6444e6c798ce | 3015 | * @param[in] value input value to be filled |
modtronix | 10:6444e6c798ce | 3016 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 3017 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 3018 | * @return none. |
modtronix | 10:6444e6c798ce | 3019 | */ |
modtronix | 10:6444e6c798ce | 3020 | void arm_fill_q7( |
modtronix | 10:6444e6c798ce | 3021 | q7_t value, |
modtronix | 10:6444e6c798ce | 3022 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 3023 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3024 | |
modtronix | 10:6444e6c798ce | 3025 | /** |
modtronix | 10:6444e6c798ce | 3026 | * @brief Fills a constant value into a Q15 vector. |
modtronix | 10:6444e6c798ce | 3027 | * @param[in] value input value to be filled |
modtronix | 10:6444e6c798ce | 3028 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 3029 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 3030 | * @return none. |
modtronix | 10:6444e6c798ce | 3031 | */ |
modtronix | 10:6444e6c798ce | 3032 | void arm_fill_q15( |
modtronix | 10:6444e6c798ce | 3033 | q15_t value, |
modtronix | 10:6444e6c798ce | 3034 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3035 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3036 | |
modtronix | 10:6444e6c798ce | 3037 | /** |
modtronix | 10:6444e6c798ce | 3038 | * @brief Fills a constant value into a Q31 vector. |
modtronix | 10:6444e6c798ce | 3039 | * @param[in] value input value to be filled |
modtronix | 10:6444e6c798ce | 3040 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 3041 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 3042 | * @return none. |
modtronix | 10:6444e6c798ce | 3043 | */ |
modtronix | 10:6444e6c798ce | 3044 | void arm_fill_q31( |
modtronix | 10:6444e6c798ce | 3045 | q31_t value, |
modtronix | 10:6444e6c798ce | 3046 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3047 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3048 | |
modtronix | 10:6444e6c798ce | 3049 | /** |
modtronix | 10:6444e6c798ce | 3050 | * @brief Convolution of floating-point sequences. |
modtronix | 10:6444e6c798ce | 3051 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3052 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3053 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3054 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3055 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3056 | * @return none. |
modtronix | 10:6444e6c798ce | 3057 | */ |
modtronix | 10:6444e6c798ce | 3058 | |
modtronix | 10:6444e6c798ce | 3059 | void arm_conv_f32( |
modtronix | 10:6444e6c798ce | 3060 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3061 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3062 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3063 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3064 | float32_t * pDst); |
modtronix | 10:6444e6c798ce | 3065 | |
modtronix | 10:6444e6c798ce | 3066 | |
modtronix | 10:6444e6c798ce | 3067 | /** |
modtronix | 10:6444e6c798ce | 3068 | * @brief Convolution of Q15 sequences. |
modtronix | 10:6444e6c798ce | 3069 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3070 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3071 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3072 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3073 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3074 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 3075 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 3076 | * @return none. |
modtronix | 10:6444e6c798ce | 3077 | */ |
modtronix | 10:6444e6c798ce | 3078 | |
modtronix | 10:6444e6c798ce | 3079 | |
modtronix | 10:6444e6c798ce | 3080 | void arm_conv_opt_q15( |
modtronix | 10:6444e6c798ce | 3081 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3082 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3083 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3084 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3085 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3086 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 3087 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 3088 | |
modtronix | 10:6444e6c798ce | 3089 | |
modtronix | 10:6444e6c798ce | 3090 | /** |
modtronix | 10:6444e6c798ce | 3091 | * @brief Convolution of Q15 sequences. |
modtronix | 10:6444e6c798ce | 3092 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3093 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3094 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3095 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3096 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3097 | * @return none. |
modtronix | 10:6444e6c798ce | 3098 | */ |
modtronix | 10:6444e6c798ce | 3099 | |
modtronix | 10:6444e6c798ce | 3100 | void arm_conv_q15( |
modtronix | 10:6444e6c798ce | 3101 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3102 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3103 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3104 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3105 | q15_t * pDst); |
modtronix | 10:6444e6c798ce | 3106 | |
modtronix | 10:6444e6c798ce | 3107 | /** |
modtronix | 10:6444e6c798ce | 3108 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 3109 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3110 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3111 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3112 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3113 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3114 | * @return none. |
modtronix | 10:6444e6c798ce | 3115 | */ |
modtronix | 10:6444e6c798ce | 3116 | |
modtronix | 10:6444e6c798ce | 3117 | void arm_conv_fast_q15( |
modtronix | 10:6444e6c798ce | 3118 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3119 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3120 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3121 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3122 | q15_t * pDst); |
modtronix | 10:6444e6c798ce | 3123 | |
modtronix | 10:6444e6c798ce | 3124 | /** |
modtronix | 10:6444e6c798ce | 3125 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 3126 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3127 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3128 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3129 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3130 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3131 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 3132 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 3133 | * @return none. |
modtronix | 10:6444e6c798ce | 3134 | */ |
modtronix | 10:6444e6c798ce | 3135 | |
modtronix | 10:6444e6c798ce | 3136 | void arm_conv_fast_opt_q15( |
modtronix | 10:6444e6c798ce | 3137 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3138 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3139 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3140 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3141 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3142 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 3143 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 3144 | |
modtronix | 10:6444e6c798ce | 3145 | |
modtronix | 10:6444e6c798ce | 3146 | |
modtronix | 10:6444e6c798ce | 3147 | /** |
modtronix | 10:6444e6c798ce | 3148 | * @brief Convolution of Q31 sequences. |
modtronix | 10:6444e6c798ce | 3149 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3150 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3151 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3152 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3153 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3154 | * @return none. |
modtronix | 10:6444e6c798ce | 3155 | */ |
modtronix | 10:6444e6c798ce | 3156 | |
modtronix | 10:6444e6c798ce | 3157 | void arm_conv_q31( |
modtronix | 10:6444e6c798ce | 3158 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3159 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3160 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3161 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3162 | q31_t * pDst); |
modtronix | 10:6444e6c798ce | 3163 | |
modtronix | 10:6444e6c798ce | 3164 | /** |
modtronix | 10:6444e6c798ce | 3165 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 3166 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3167 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3168 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3169 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3170 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3171 | * @return none. |
modtronix | 10:6444e6c798ce | 3172 | */ |
modtronix | 10:6444e6c798ce | 3173 | |
modtronix | 10:6444e6c798ce | 3174 | void arm_conv_fast_q31( |
modtronix | 10:6444e6c798ce | 3175 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3176 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3177 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3178 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3179 | q31_t * pDst); |
modtronix | 10:6444e6c798ce | 3180 | |
modtronix | 10:6444e6c798ce | 3181 | |
modtronix | 10:6444e6c798ce | 3182 | /** |
modtronix | 10:6444e6c798ce | 3183 | * @brief Convolution of Q7 sequences. |
modtronix | 10:6444e6c798ce | 3184 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3185 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3186 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3187 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3188 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3189 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 3190 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 3191 | * @return none. |
modtronix | 10:6444e6c798ce | 3192 | */ |
modtronix | 10:6444e6c798ce | 3193 | |
modtronix | 10:6444e6c798ce | 3194 | void arm_conv_opt_q7( |
modtronix | 10:6444e6c798ce | 3195 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3196 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3197 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3198 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3199 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 3200 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 3201 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 3202 | |
modtronix | 10:6444e6c798ce | 3203 | |
modtronix | 10:6444e6c798ce | 3204 | |
modtronix | 10:6444e6c798ce | 3205 | /** |
modtronix | 10:6444e6c798ce | 3206 | * @brief Convolution of Q7 sequences. |
modtronix | 10:6444e6c798ce | 3207 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3208 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3209 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3210 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3211 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
modtronix | 10:6444e6c798ce | 3212 | * @return none. |
modtronix | 10:6444e6c798ce | 3213 | */ |
modtronix | 10:6444e6c798ce | 3214 | |
modtronix | 10:6444e6c798ce | 3215 | void arm_conv_q7( |
modtronix | 10:6444e6c798ce | 3216 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3217 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3218 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3219 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3220 | q7_t * pDst); |
modtronix | 10:6444e6c798ce | 3221 | |
modtronix | 10:6444e6c798ce | 3222 | |
modtronix | 10:6444e6c798ce | 3223 | /** |
modtronix | 10:6444e6c798ce | 3224 | * @brief Partial convolution of floating-point sequences. |
modtronix | 10:6444e6c798ce | 3225 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3226 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3227 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3228 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3229 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3230 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3231 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3232 | * @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]. |
modtronix | 10:6444e6c798ce | 3233 | */ |
modtronix | 10:6444e6c798ce | 3234 | |
modtronix | 10:6444e6c798ce | 3235 | arm_status arm_conv_partial_f32( |
modtronix | 10:6444e6c798ce | 3236 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3237 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3238 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3239 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3240 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 3241 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3242 | uint32_t numPoints); |
modtronix | 10:6444e6c798ce | 3243 | |
modtronix | 10:6444e6c798ce | 3244 | /** |
modtronix | 10:6444e6c798ce | 3245 | * @brief Partial convolution of Q15 sequences. |
modtronix | 10:6444e6c798ce | 3246 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3247 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3248 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3249 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3250 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3251 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3252 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3253 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 3254 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 3255 | * @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]. |
modtronix | 10:6444e6c798ce | 3256 | */ |
modtronix | 10:6444e6c798ce | 3257 | |
modtronix | 10:6444e6c798ce | 3258 | arm_status arm_conv_partial_opt_q15( |
modtronix | 10:6444e6c798ce | 3259 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3260 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3261 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3262 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3263 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3264 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3265 | uint32_t numPoints, |
modtronix | 10:6444e6c798ce | 3266 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 3267 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 3268 | |
modtronix | 10:6444e6c798ce | 3269 | |
modtronix | 10:6444e6c798ce | 3270 | /** |
modtronix | 10:6444e6c798ce | 3271 | * @brief Partial convolution of Q15 sequences. |
modtronix | 10:6444e6c798ce | 3272 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3273 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3274 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3275 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3276 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3277 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3278 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3279 | * @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]. |
modtronix | 10:6444e6c798ce | 3280 | */ |
modtronix | 10:6444e6c798ce | 3281 | |
modtronix | 10:6444e6c798ce | 3282 | arm_status arm_conv_partial_q15( |
modtronix | 10:6444e6c798ce | 3283 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3284 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3285 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3286 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3287 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3288 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3289 | uint32_t numPoints); |
modtronix | 10:6444e6c798ce | 3290 | |
modtronix | 10:6444e6c798ce | 3291 | /** |
modtronix | 10:6444e6c798ce | 3292 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 3293 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3294 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3295 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3296 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3297 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3298 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3299 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3300 | * @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]. |
modtronix | 10:6444e6c798ce | 3301 | */ |
modtronix | 10:6444e6c798ce | 3302 | |
modtronix | 10:6444e6c798ce | 3303 | arm_status arm_conv_partial_fast_q15( |
modtronix | 10:6444e6c798ce | 3304 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3305 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3306 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3307 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3308 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3309 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3310 | uint32_t numPoints); |
modtronix | 10:6444e6c798ce | 3311 | |
modtronix | 10:6444e6c798ce | 3312 | |
modtronix | 10:6444e6c798ce | 3313 | /** |
modtronix | 10:6444e6c798ce | 3314 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 3315 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3316 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3317 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3318 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3319 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3320 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3321 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3322 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 3323 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 3324 | * @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]. |
modtronix | 10:6444e6c798ce | 3325 | */ |
modtronix | 10:6444e6c798ce | 3326 | |
modtronix | 10:6444e6c798ce | 3327 | arm_status arm_conv_partial_fast_opt_q15( |
modtronix | 10:6444e6c798ce | 3328 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3329 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3330 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3331 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3332 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3333 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3334 | uint32_t numPoints, |
modtronix | 10:6444e6c798ce | 3335 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 3336 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 3337 | |
modtronix | 10:6444e6c798ce | 3338 | |
modtronix | 10:6444e6c798ce | 3339 | /** |
modtronix | 10:6444e6c798ce | 3340 | * @brief Partial convolution of Q31 sequences. |
modtronix | 10:6444e6c798ce | 3341 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3342 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3343 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3344 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3345 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3346 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3347 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3348 | * @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]. |
modtronix | 10:6444e6c798ce | 3349 | */ |
modtronix | 10:6444e6c798ce | 3350 | |
modtronix | 10:6444e6c798ce | 3351 | arm_status arm_conv_partial_q31( |
modtronix | 10:6444e6c798ce | 3352 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3353 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3354 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3355 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3356 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3357 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3358 | uint32_t numPoints); |
modtronix | 10:6444e6c798ce | 3359 | |
modtronix | 10:6444e6c798ce | 3360 | |
modtronix | 10:6444e6c798ce | 3361 | /** |
modtronix | 10:6444e6c798ce | 3362 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 3363 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3364 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3365 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3366 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3367 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3368 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3369 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3370 | * @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]. |
modtronix | 10:6444e6c798ce | 3371 | */ |
modtronix | 10:6444e6c798ce | 3372 | |
modtronix | 10:6444e6c798ce | 3373 | arm_status arm_conv_partial_fast_q31( |
modtronix | 10:6444e6c798ce | 3374 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3375 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3376 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3377 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3378 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3379 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3380 | uint32_t numPoints); |
modtronix | 10:6444e6c798ce | 3381 | |
modtronix | 10:6444e6c798ce | 3382 | |
modtronix | 10:6444e6c798ce | 3383 | /** |
modtronix | 10:6444e6c798ce | 3384 | * @brief Partial convolution of Q7 sequences |
modtronix | 10:6444e6c798ce | 3385 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3386 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3387 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3388 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3389 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3390 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3391 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3392 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 3393 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 3394 | * @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]. |
modtronix | 10:6444e6c798ce | 3395 | */ |
modtronix | 10:6444e6c798ce | 3396 | |
modtronix | 10:6444e6c798ce | 3397 | arm_status arm_conv_partial_opt_q7( |
modtronix | 10:6444e6c798ce | 3398 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3399 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3400 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3401 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3402 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 3403 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3404 | uint32_t numPoints, |
modtronix | 10:6444e6c798ce | 3405 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 3406 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 3407 | |
modtronix | 10:6444e6c798ce | 3408 | |
modtronix | 10:6444e6c798ce | 3409 | /** |
modtronix | 10:6444e6c798ce | 3410 | * @brief Partial convolution of Q7 sequences. |
modtronix | 10:6444e6c798ce | 3411 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 3412 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 3413 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 3414 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 3415 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3416 | * @param[in] firstIndex is the first output sample to start with. |
modtronix | 10:6444e6c798ce | 3417 | * @param[in] numPoints is the number of output points to be computed. |
modtronix | 10:6444e6c798ce | 3418 | * @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]. |
modtronix | 10:6444e6c798ce | 3419 | */ |
modtronix | 10:6444e6c798ce | 3420 | |
modtronix | 10:6444e6c798ce | 3421 | arm_status arm_conv_partial_q7( |
modtronix | 10:6444e6c798ce | 3422 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 3423 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 3424 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 3425 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 3426 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 3427 | uint32_t firstIndex, |
modtronix | 10:6444e6c798ce | 3428 | uint32_t numPoints); |
modtronix | 10:6444e6c798ce | 3429 | |
modtronix | 10:6444e6c798ce | 3430 | |
modtronix | 10:6444e6c798ce | 3431 | |
modtronix | 10:6444e6c798ce | 3432 | /** |
modtronix | 10:6444e6c798ce | 3433 | * @brief Instance structure for the Q15 FIR decimator. |
modtronix | 10:6444e6c798ce | 3434 | */ |
modtronix | 10:6444e6c798ce | 3435 | |
modtronix | 10:6444e6c798ce | 3436 | typedef struct |
modtronix | 10:6444e6c798ce | 3437 | { |
modtronix | 10:6444e6c798ce | 3438 | uint8_t M; /**< decimation factor. */ |
modtronix | 10:6444e6c798ce | 3439 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 3440 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 3441 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 3442 | } arm_fir_decimate_instance_q15; |
modtronix | 10:6444e6c798ce | 3443 | |
modtronix | 10:6444e6c798ce | 3444 | /** |
modtronix | 10:6444e6c798ce | 3445 | * @brief Instance structure for the Q31 FIR decimator. |
modtronix | 10:6444e6c798ce | 3446 | */ |
modtronix | 10:6444e6c798ce | 3447 | |
modtronix | 10:6444e6c798ce | 3448 | typedef struct |
modtronix | 10:6444e6c798ce | 3449 | { |
modtronix | 10:6444e6c798ce | 3450 | uint8_t M; /**< decimation factor. */ |
modtronix | 10:6444e6c798ce | 3451 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 3452 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 3453 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 3454 | |
modtronix | 10:6444e6c798ce | 3455 | } arm_fir_decimate_instance_q31; |
modtronix | 10:6444e6c798ce | 3456 | |
modtronix | 10:6444e6c798ce | 3457 | /** |
modtronix | 10:6444e6c798ce | 3458 | * @brief Instance structure for the floating-point FIR decimator. |
modtronix | 10:6444e6c798ce | 3459 | */ |
modtronix | 10:6444e6c798ce | 3460 | |
modtronix | 10:6444e6c798ce | 3461 | typedef struct |
modtronix | 10:6444e6c798ce | 3462 | { |
modtronix | 10:6444e6c798ce | 3463 | uint8_t M; /**< decimation factor. */ |
modtronix | 10:6444e6c798ce | 3464 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 3465 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 3466 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 3467 | |
modtronix | 10:6444e6c798ce | 3468 | } arm_fir_decimate_instance_f32; |
modtronix | 10:6444e6c798ce | 3469 | |
modtronix | 10:6444e6c798ce | 3470 | |
modtronix | 10:6444e6c798ce | 3471 | |
modtronix | 10:6444e6c798ce | 3472 | /** |
modtronix | 10:6444e6c798ce | 3473 | * @brief Processing function for the floating-point FIR decimator. |
modtronix | 10:6444e6c798ce | 3474 | * @param[in] *S points to an instance of the floating-point FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3475 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3476 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3477 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3478 | * @return none |
modtronix | 10:6444e6c798ce | 3479 | */ |
modtronix | 10:6444e6c798ce | 3480 | |
modtronix | 10:6444e6c798ce | 3481 | void arm_fir_decimate_f32( |
modtronix | 10:6444e6c798ce | 3482 | const arm_fir_decimate_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3483 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 3484 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 3485 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3486 | |
modtronix | 10:6444e6c798ce | 3487 | |
modtronix | 10:6444e6c798ce | 3488 | /** |
modtronix | 10:6444e6c798ce | 3489 | * @brief Initialization function for the floating-point FIR decimator. |
modtronix | 10:6444e6c798ce | 3490 | * @param[in,out] *S points to an instance of the floating-point FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3491 | * @param[in] numTaps number of coefficients in the filter. |
modtronix | 10:6444e6c798ce | 3492 | * @param[in] M decimation factor. |
modtronix | 10:6444e6c798ce | 3493 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3494 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3495 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3496 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
modtronix | 10:6444e6c798ce | 3497 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
modtronix | 10:6444e6c798ce | 3498 | */ |
modtronix | 10:6444e6c798ce | 3499 | |
modtronix | 10:6444e6c798ce | 3500 | arm_status arm_fir_decimate_init_f32( |
modtronix | 10:6444e6c798ce | 3501 | arm_fir_decimate_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3502 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 3503 | uint8_t M, |
modtronix | 10:6444e6c798ce | 3504 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3505 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 3506 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3507 | |
modtronix | 10:6444e6c798ce | 3508 | /** |
modtronix | 10:6444e6c798ce | 3509 | * @brief Processing function for the Q15 FIR decimator. |
modtronix | 10:6444e6c798ce | 3510 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3511 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3512 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3513 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3514 | * @return none |
modtronix | 10:6444e6c798ce | 3515 | */ |
modtronix | 10:6444e6c798ce | 3516 | |
modtronix | 10:6444e6c798ce | 3517 | void arm_fir_decimate_q15( |
modtronix | 10:6444e6c798ce | 3518 | const arm_fir_decimate_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3519 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 3520 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3521 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3522 | |
modtronix | 10:6444e6c798ce | 3523 | /** |
modtronix | 10:6444e6c798ce | 3524 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 3525 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3526 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3527 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3528 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3529 | * @return none |
modtronix | 10:6444e6c798ce | 3530 | */ |
modtronix | 10:6444e6c798ce | 3531 | |
modtronix | 10:6444e6c798ce | 3532 | void arm_fir_decimate_fast_q15( |
modtronix | 10:6444e6c798ce | 3533 | const arm_fir_decimate_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3534 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 3535 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3536 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3537 | |
modtronix | 10:6444e6c798ce | 3538 | |
modtronix | 10:6444e6c798ce | 3539 | |
modtronix | 10:6444e6c798ce | 3540 | /** |
modtronix | 10:6444e6c798ce | 3541 | * @brief Initialization function for the Q15 FIR decimator. |
modtronix | 10:6444e6c798ce | 3542 | * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3543 | * @param[in] numTaps number of coefficients in the filter. |
modtronix | 10:6444e6c798ce | 3544 | * @param[in] M decimation factor. |
modtronix | 10:6444e6c798ce | 3545 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3546 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3547 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3548 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
modtronix | 10:6444e6c798ce | 3549 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
modtronix | 10:6444e6c798ce | 3550 | */ |
modtronix | 10:6444e6c798ce | 3551 | |
modtronix | 10:6444e6c798ce | 3552 | arm_status arm_fir_decimate_init_q15( |
modtronix | 10:6444e6c798ce | 3553 | arm_fir_decimate_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3554 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 3555 | uint8_t M, |
modtronix | 10:6444e6c798ce | 3556 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3557 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 3558 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3559 | |
modtronix | 10:6444e6c798ce | 3560 | /** |
modtronix | 10:6444e6c798ce | 3561 | * @brief Processing function for the Q31 FIR decimator. |
modtronix | 10:6444e6c798ce | 3562 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3563 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3564 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3565 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3566 | * @return none |
modtronix | 10:6444e6c798ce | 3567 | */ |
modtronix | 10:6444e6c798ce | 3568 | |
modtronix | 10:6444e6c798ce | 3569 | void arm_fir_decimate_q31( |
modtronix | 10:6444e6c798ce | 3570 | const arm_fir_decimate_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 3571 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 3572 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3573 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3574 | |
modtronix | 10:6444e6c798ce | 3575 | /** |
modtronix | 10:6444e6c798ce | 3576 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 3577 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3578 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3579 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3580 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3581 | * @return none |
modtronix | 10:6444e6c798ce | 3582 | */ |
modtronix | 10:6444e6c798ce | 3583 | |
modtronix | 10:6444e6c798ce | 3584 | void arm_fir_decimate_fast_q31( |
modtronix | 10:6444e6c798ce | 3585 | arm_fir_decimate_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 3586 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 3587 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3588 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3589 | |
modtronix | 10:6444e6c798ce | 3590 | |
modtronix | 10:6444e6c798ce | 3591 | /** |
modtronix | 10:6444e6c798ce | 3592 | * @brief Initialization function for the Q31 FIR decimator. |
modtronix | 10:6444e6c798ce | 3593 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. |
modtronix | 10:6444e6c798ce | 3594 | * @param[in] numTaps number of coefficients in the filter. |
modtronix | 10:6444e6c798ce | 3595 | * @param[in] M decimation factor. |
modtronix | 10:6444e6c798ce | 3596 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3597 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3598 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3599 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
modtronix | 10:6444e6c798ce | 3600 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
modtronix | 10:6444e6c798ce | 3601 | */ |
modtronix | 10:6444e6c798ce | 3602 | |
modtronix | 10:6444e6c798ce | 3603 | arm_status arm_fir_decimate_init_q31( |
modtronix | 10:6444e6c798ce | 3604 | arm_fir_decimate_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 3605 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 3606 | uint8_t M, |
modtronix | 10:6444e6c798ce | 3607 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3608 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 3609 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3610 | |
modtronix | 10:6444e6c798ce | 3611 | |
modtronix | 10:6444e6c798ce | 3612 | |
modtronix | 10:6444e6c798ce | 3613 | /** |
modtronix | 10:6444e6c798ce | 3614 | * @brief Instance structure for the Q15 FIR interpolator. |
modtronix | 10:6444e6c798ce | 3615 | */ |
modtronix | 10:6444e6c798ce | 3616 | |
modtronix | 10:6444e6c798ce | 3617 | typedef struct |
modtronix | 10:6444e6c798ce | 3618 | { |
modtronix | 10:6444e6c798ce | 3619 | uint8_t L; /**< upsample factor. */ |
modtronix | 10:6444e6c798ce | 3620 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
modtronix | 10:6444e6c798ce | 3621 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
modtronix | 10:6444e6c798ce | 3622 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
modtronix | 10:6444e6c798ce | 3623 | } arm_fir_interpolate_instance_q15; |
modtronix | 10:6444e6c798ce | 3624 | |
modtronix | 10:6444e6c798ce | 3625 | /** |
modtronix | 10:6444e6c798ce | 3626 | * @brief Instance structure for the Q31 FIR interpolator. |
modtronix | 10:6444e6c798ce | 3627 | */ |
modtronix | 10:6444e6c798ce | 3628 | |
modtronix | 10:6444e6c798ce | 3629 | typedef struct |
modtronix | 10:6444e6c798ce | 3630 | { |
modtronix | 10:6444e6c798ce | 3631 | uint8_t L; /**< upsample factor. */ |
modtronix | 10:6444e6c798ce | 3632 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
modtronix | 10:6444e6c798ce | 3633 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
modtronix | 10:6444e6c798ce | 3634 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
modtronix | 10:6444e6c798ce | 3635 | } arm_fir_interpolate_instance_q31; |
modtronix | 10:6444e6c798ce | 3636 | |
modtronix | 10:6444e6c798ce | 3637 | /** |
modtronix | 10:6444e6c798ce | 3638 | * @brief Instance structure for the floating-point FIR interpolator. |
modtronix | 10:6444e6c798ce | 3639 | */ |
modtronix | 10:6444e6c798ce | 3640 | |
modtronix | 10:6444e6c798ce | 3641 | typedef struct |
modtronix | 10:6444e6c798ce | 3642 | { |
modtronix | 10:6444e6c798ce | 3643 | uint8_t L; /**< upsample factor. */ |
modtronix | 10:6444e6c798ce | 3644 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
modtronix | 10:6444e6c798ce | 3645 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
modtronix | 10:6444e6c798ce | 3646 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ |
modtronix | 10:6444e6c798ce | 3647 | } arm_fir_interpolate_instance_f32; |
modtronix | 10:6444e6c798ce | 3648 | |
modtronix | 10:6444e6c798ce | 3649 | |
modtronix | 10:6444e6c798ce | 3650 | /** |
modtronix | 10:6444e6c798ce | 3651 | * @brief Processing function for the Q15 FIR interpolator. |
modtronix | 10:6444e6c798ce | 3652 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
modtronix | 10:6444e6c798ce | 3653 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3654 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 3655 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3656 | * @return none. |
modtronix | 10:6444e6c798ce | 3657 | */ |
modtronix | 10:6444e6c798ce | 3658 | |
modtronix | 10:6444e6c798ce | 3659 | void arm_fir_interpolate_q15( |
modtronix | 10:6444e6c798ce | 3660 | const arm_fir_interpolate_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3661 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 3662 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3663 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3664 | |
modtronix | 10:6444e6c798ce | 3665 | |
modtronix | 10:6444e6c798ce | 3666 | /** |
modtronix | 10:6444e6c798ce | 3667 | * @brief Initialization function for the Q15 FIR interpolator. |
modtronix | 10:6444e6c798ce | 3668 | * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. |
modtronix | 10:6444e6c798ce | 3669 | * @param[in] L upsample factor. |
modtronix | 10:6444e6c798ce | 3670 | * @param[in] numTaps number of filter coefficients in the filter. |
modtronix | 10:6444e6c798ce | 3671 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
modtronix | 10:6444e6c798ce | 3672 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3673 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3674 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
modtronix | 10:6444e6c798ce | 3675 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
modtronix | 10:6444e6c798ce | 3676 | */ |
modtronix | 10:6444e6c798ce | 3677 | |
modtronix | 10:6444e6c798ce | 3678 | arm_status arm_fir_interpolate_init_q15( |
modtronix | 10:6444e6c798ce | 3679 | arm_fir_interpolate_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3680 | uint8_t L, |
modtronix | 10:6444e6c798ce | 3681 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 3682 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3683 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 3684 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3685 | |
modtronix | 10:6444e6c798ce | 3686 | /** |
modtronix | 10:6444e6c798ce | 3687 | * @brief Processing function for the Q31 FIR interpolator. |
modtronix | 10:6444e6c798ce | 3688 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
modtronix | 10:6444e6c798ce | 3689 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3690 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 3691 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3692 | * @return none. |
modtronix | 10:6444e6c798ce | 3693 | */ |
modtronix | 10:6444e6c798ce | 3694 | |
modtronix | 10:6444e6c798ce | 3695 | void arm_fir_interpolate_q31( |
modtronix | 10:6444e6c798ce | 3696 | const arm_fir_interpolate_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 3697 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 3698 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3699 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3700 | |
modtronix | 10:6444e6c798ce | 3701 | /** |
modtronix | 10:6444e6c798ce | 3702 | * @brief Initialization function for the Q31 FIR interpolator. |
modtronix | 10:6444e6c798ce | 3703 | * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure. |
modtronix | 10:6444e6c798ce | 3704 | * @param[in] L upsample factor. |
modtronix | 10:6444e6c798ce | 3705 | * @param[in] numTaps number of filter coefficients in the filter. |
modtronix | 10:6444e6c798ce | 3706 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
modtronix | 10:6444e6c798ce | 3707 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3708 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3709 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
modtronix | 10:6444e6c798ce | 3710 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
modtronix | 10:6444e6c798ce | 3711 | */ |
modtronix | 10:6444e6c798ce | 3712 | |
modtronix | 10:6444e6c798ce | 3713 | arm_status arm_fir_interpolate_init_q31( |
modtronix | 10:6444e6c798ce | 3714 | arm_fir_interpolate_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 3715 | uint8_t L, |
modtronix | 10:6444e6c798ce | 3716 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 3717 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3718 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 3719 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3720 | |
modtronix | 10:6444e6c798ce | 3721 | |
modtronix | 10:6444e6c798ce | 3722 | /** |
modtronix | 10:6444e6c798ce | 3723 | * @brief Processing function for the floating-point FIR interpolator. |
modtronix | 10:6444e6c798ce | 3724 | * @param[in] *S points to an instance of the floating-point FIR interpolator structure. |
modtronix | 10:6444e6c798ce | 3725 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3726 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 3727 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3728 | * @return none. |
modtronix | 10:6444e6c798ce | 3729 | */ |
modtronix | 10:6444e6c798ce | 3730 | |
modtronix | 10:6444e6c798ce | 3731 | void arm_fir_interpolate_f32( |
modtronix | 10:6444e6c798ce | 3732 | const arm_fir_interpolate_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3733 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 3734 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 3735 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3736 | |
modtronix | 10:6444e6c798ce | 3737 | /** |
modtronix | 10:6444e6c798ce | 3738 | * @brief Initialization function for the floating-point FIR interpolator. |
modtronix | 10:6444e6c798ce | 3739 | * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure. |
modtronix | 10:6444e6c798ce | 3740 | * @param[in] L upsample factor. |
modtronix | 10:6444e6c798ce | 3741 | * @param[in] numTaps number of filter coefficients in the filter. |
modtronix | 10:6444e6c798ce | 3742 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
modtronix | 10:6444e6c798ce | 3743 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3744 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 3745 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
modtronix | 10:6444e6c798ce | 3746 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
modtronix | 10:6444e6c798ce | 3747 | */ |
modtronix | 10:6444e6c798ce | 3748 | |
modtronix | 10:6444e6c798ce | 3749 | arm_status arm_fir_interpolate_init_f32( |
modtronix | 10:6444e6c798ce | 3750 | arm_fir_interpolate_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3751 | uint8_t L, |
modtronix | 10:6444e6c798ce | 3752 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 3753 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3754 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 3755 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3756 | |
modtronix | 10:6444e6c798ce | 3757 | /** |
modtronix | 10:6444e6c798ce | 3758 | * @brief Instance structure for the high precision Q31 Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3759 | */ |
modtronix | 10:6444e6c798ce | 3760 | |
modtronix | 10:6444e6c798ce | 3761 | typedef struct |
modtronix | 10:6444e6c798ce | 3762 | { |
modtronix | 10:6444e6c798ce | 3763 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 3764 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
modtronix | 10:6444e6c798ce | 3765 | q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 3766 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ |
modtronix | 10:6444e6c798ce | 3767 | |
modtronix | 10:6444e6c798ce | 3768 | } arm_biquad_cas_df1_32x64_ins_q31; |
modtronix | 10:6444e6c798ce | 3769 | |
modtronix | 10:6444e6c798ce | 3770 | |
modtronix | 10:6444e6c798ce | 3771 | /** |
modtronix | 10:6444e6c798ce | 3772 | * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
modtronix | 10:6444e6c798ce | 3773 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3774 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3775 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 3776 | * @return none. |
modtronix | 10:6444e6c798ce | 3777 | */ |
modtronix | 10:6444e6c798ce | 3778 | |
modtronix | 10:6444e6c798ce | 3779 | void arm_biquad_cas_df1_32x64_q31( |
modtronix | 10:6444e6c798ce | 3780 | const arm_biquad_cas_df1_32x64_ins_q31 * S, |
modtronix | 10:6444e6c798ce | 3781 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 3782 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 3783 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3784 | |
modtronix | 10:6444e6c798ce | 3785 | |
modtronix | 10:6444e6c798ce | 3786 | /** |
modtronix | 10:6444e6c798ce | 3787 | * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
modtronix | 10:6444e6c798ce | 3788 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 3789 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3790 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3791 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format |
modtronix | 10:6444e6c798ce | 3792 | * @return none |
modtronix | 10:6444e6c798ce | 3793 | */ |
modtronix | 10:6444e6c798ce | 3794 | |
modtronix | 10:6444e6c798ce | 3795 | void arm_biquad_cas_df1_32x64_init_q31( |
modtronix | 10:6444e6c798ce | 3796 | arm_biquad_cas_df1_32x64_ins_q31 * S, |
modtronix | 10:6444e6c798ce | 3797 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 3798 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3799 | q63_t * pState, |
modtronix | 10:6444e6c798ce | 3800 | uint8_t postShift); |
modtronix | 10:6444e6c798ce | 3801 | |
modtronix | 10:6444e6c798ce | 3802 | |
modtronix | 10:6444e6c798ce | 3803 | |
modtronix | 10:6444e6c798ce | 3804 | /** |
modtronix | 10:6444e6c798ce | 3805 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3806 | */ |
modtronix | 10:6444e6c798ce | 3807 | |
modtronix | 10:6444e6c798ce | 3808 | typedef struct |
modtronix | 10:6444e6c798ce | 3809 | { |
modtronix | 10:6444e6c798ce | 3810 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 3811 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
modtronix | 10:6444e6c798ce | 3812 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 3813 | } arm_biquad_cascade_df2T_instance_f32; |
modtronix | 10:6444e6c798ce | 3814 | |
modtronix | 10:6444e6c798ce | 3815 | |
modtronix | 10:6444e6c798ce | 3816 | |
modtronix | 10:6444e6c798ce | 3817 | /** |
modtronix | 10:6444e6c798ce | 3818 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3819 | */ |
modtronix | 10:6444e6c798ce | 3820 | |
modtronix | 10:6444e6c798ce | 3821 | typedef struct |
modtronix | 10:6444e6c798ce | 3822 | { |
modtronix | 10:6444e6c798ce | 3823 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 3824 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
modtronix | 10:6444e6c798ce | 3825 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 3826 | } arm_biquad_cascade_stereo_df2T_instance_f32; |
modtronix | 10:6444e6c798ce | 3827 | |
modtronix | 10:6444e6c798ce | 3828 | |
modtronix | 10:6444e6c798ce | 3829 | |
modtronix | 10:6444e6c798ce | 3830 | /** |
modtronix | 10:6444e6c798ce | 3831 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3832 | */ |
modtronix | 10:6444e6c798ce | 3833 | |
modtronix | 10:6444e6c798ce | 3834 | typedef struct |
modtronix | 10:6444e6c798ce | 3835 | { |
modtronix | 10:6444e6c798ce | 3836 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
modtronix | 10:6444e6c798ce | 3837 | float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
modtronix | 10:6444e6c798ce | 3838 | float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
modtronix | 10:6444e6c798ce | 3839 | } arm_biquad_cascade_df2T_instance_f64; |
modtronix | 10:6444e6c798ce | 3840 | |
modtronix | 10:6444e6c798ce | 3841 | |
modtronix | 10:6444e6c798ce | 3842 | /** |
modtronix | 10:6444e6c798ce | 3843 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3844 | * @param[in] *S points to an instance of the filter data structure. |
modtronix | 10:6444e6c798ce | 3845 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3846 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3847 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 3848 | * @return none. |
modtronix | 10:6444e6c798ce | 3849 | */ |
modtronix | 10:6444e6c798ce | 3850 | |
modtronix | 10:6444e6c798ce | 3851 | void arm_biquad_cascade_df2T_f32( |
modtronix | 10:6444e6c798ce | 3852 | const arm_biquad_cascade_df2T_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3853 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 3854 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 3855 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3856 | |
modtronix | 10:6444e6c798ce | 3857 | |
modtronix | 10:6444e6c798ce | 3858 | /** |
modtronix | 10:6444e6c798ce | 3859 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels |
modtronix | 10:6444e6c798ce | 3860 | * @param[in] *S points to an instance of the filter data structure. |
modtronix | 10:6444e6c798ce | 3861 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3862 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3863 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 3864 | * @return none. |
modtronix | 10:6444e6c798ce | 3865 | */ |
modtronix | 10:6444e6c798ce | 3866 | |
modtronix | 10:6444e6c798ce | 3867 | void arm_biquad_cascade_stereo_df2T_f32( |
modtronix | 10:6444e6c798ce | 3868 | const arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3869 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 3870 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 3871 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3872 | |
modtronix | 10:6444e6c798ce | 3873 | /** |
modtronix | 10:6444e6c798ce | 3874 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3875 | * @param[in] *S points to an instance of the filter data structure. |
modtronix | 10:6444e6c798ce | 3876 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3877 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 3878 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 3879 | * @return none. |
modtronix | 10:6444e6c798ce | 3880 | */ |
modtronix | 10:6444e6c798ce | 3881 | |
modtronix | 10:6444e6c798ce | 3882 | void arm_biquad_cascade_df2T_f64( |
modtronix | 10:6444e6c798ce | 3883 | const arm_biquad_cascade_df2T_instance_f64 * S, |
modtronix | 10:6444e6c798ce | 3884 | float64_t * pSrc, |
modtronix | 10:6444e6c798ce | 3885 | float64_t * pDst, |
modtronix | 10:6444e6c798ce | 3886 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 3887 | |
modtronix | 10:6444e6c798ce | 3888 | |
modtronix | 10:6444e6c798ce | 3889 | /** |
modtronix | 10:6444e6c798ce | 3890 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3891 | * @param[in,out] *S points to an instance of the filter data structure. |
modtronix | 10:6444e6c798ce | 3892 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 3893 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3894 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3895 | * @return none |
modtronix | 10:6444e6c798ce | 3896 | */ |
modtronix | 10:6444e6c798ce | 3897 | |
modtronix | 10:6444e6c798ce | 3898 | void arm_biquad_cascade_df2T_init_f32( |
modtronix | 10:6444e6c798ce | 3899 | arm_biquad_cascade_df2T_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3900 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 3901 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3902 | float32_t * pState); |
modtronix | 10:6444e6c798ce | 3903 | |
modtronix | 10:6444e6c798ce | 3904 | |
modtronix | 10:6444e6c798ce | 3905 | /** |
modtronix | 10:6444e6c798ce | 3906 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3907 | * @param[in,out] *S points to an instance of the filter data structure. |
modtronix | 10:6444e6c798ce | 3908 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 3909 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3910 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3911 | * @return none |
modtronix | 10:6444e6c798ce | 3912 | */ |
modtronix | 10:6444e6c798ce | 3913 | |
modtronix | 10:6444e6c798ce | 3914 | void arm_biquad_cascade_stereo_df2T_init_f32( |
modtronix | 10:6444e6c798ce | 3915 | arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 3916 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 3917 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3918 | float32_t * pState); |
modtronix | 10:6444e6c798ce | 3919 | |
modtronix | 10:6444e6c798ce | 3920 | |
modtronix | 10:6444e6c798ce | 3921 | /** |
modtronix | 10:6444e6c798ce | 3922 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
modtronix | 10:6444e6c798ce | 3923 | * @param[in,out] *S points to an instance of the filter data structure. |
modtronix | 10:6444e6c798ce | 3924 | * @param[in] numStages number of 2nd order stages in the filter. |
modtronix | 10:6444e6c798ce | 3925 | * @param[in] *pCoeffs points to the filter coefficients. |
modtronix | 10:6444e6c798ce | 3926 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 3927 | * @return none |
modtronix | 10:6444e6c798ce | 3928 | */ |
modtronix | 10:6444e6c798ce | 3929 | |
modtronix | 10:6444e6c798ce | 3930 | void arm_biquad_cascade_df2T_init_f64( |
modtronix | 10:6444e6c798ce | 3931 | arm_biquad_cascade_df2T_instance_f64 * S, |
modtronix | 10:6444e6c798ce | 3932 | uint8_t numStages, |
modtronix | 10:6444e6c798ce | 3933 | float64_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3934 | float64_t * pState); |
modtronix | 10:6444e6c798ce | 3935 | |
modtronix | 10:6444e6c798ce | 3936 | |
modtronix | 10:6444e6c798ce | 3937 | |
modtronix | 10:6444e6c798ce | 3938 | /** |
modtronix | 10:6444e6c798ce | 3939 | * @brief Instance structure for the Q15 FIR lattice filter. |
modtronix | 10:6444e6c798ce | 3940 | */ |
modtronix | 10:6444e6c798ce | 3941 | |
modtronix | 10:6444e6c798ce | 3942 | typedef struct |
modtronix | 10:6444e6c798ce | 3943 | { |
modtronix | 10:6444e6c798ce | 3944 | uint16_t numStages; /**< number of filter stages. */ |
modtronix | 10:6444e6c798ce | 3945 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 3946 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 3947 | } arm_fir_lattice_instance_q15; |
modtronix | 10:6444e6c798ce | 3948 | |
modtronix | 10:6444e6c798ce | 3949 | /** |
modtronix | 10:6444e6c798ce | 3950 | * @brief Instance structure for the Q31 FIR lattice filter. |
modtronix | 10:6444e6c798ce | 3951 | */ |
modtronix | 10:6444e6c798ce | 3952 | |
modtronix | 10:6444e6c798ce | 3953 | typedef struct |
modtronix | 10:6444e6c798ce | 3954 | { |
modtronix | 10:6444e6c798ce | 3955 | uint16_t numStages; /**< number of filter stages. */ |
modtronix | 10:6444e6c798ce | 3956 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 3957 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 3958 | } arm_fir_lattice_instance_q31; |
modtronix | 10:6444e6c798ce | 3959 | |
modtronix | 10:6444e6c798ce | 3960 | /** |
modtronix | 10:6444e6c798ce | 3961 | * @brief Instance structure for the floating-point FIR lattice filter. |
modtronix | 10:6444e6c798ce | 3962 | */ |
modtronix | 10:6444e6c798ce | 3963 | |
modtronix | 10:6444e6c798ce | 3964 | typedef struct |
modtronix | 10:6444e6c798ce | 3965 | { |
modtronix | 10:6444e6c798ce | 3966 | uint16_t numStages; /**< number of filter stages. */ |
modtronix | 10:6444e6c798ce | 3967 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 3968 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 3969 | } arm_fir_lattice_instance_f32; |
modtronix | 10:6444e6c798ce | 3970 | |
modtronix | 10:6444e6c798ce | 3971 | /** |
modtronix | 10:6444e6c798ce | 3972 | * @brief Initialization function for the Q15 FIR lattice filter. |
modtronix | 10:6444e6c798ce | 3973 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
modtronix | 10:6444e6c798ce | 3974 | * @param[in] numStages number of filter stages. |
modtronix | 10:6444e6c798ce | 3975 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 3976 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 3977 | * @return none. |
modtronix | 10:6444e6c798ce | 3978 | */ |
modtronix | 10:6444e6c798ce | 3979 | |
modtronix | 10:6444e6c798ce | 3980 | void arm_fir_lattice_init_q15( |
modtronix | 10:6444e6c798ce | 3981 | arm_fir_lattice_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3982 | uint16_t numStages, |
modtronix | 10:6444e6c798ce | 3983 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 3984 | q15_t * pState); |
modtronix | 10:6444e6c798ce | 3985 | |
modtronix | 10:6444e6c798ce | 3986 | |
modtronix | 10:6444e6c798ce | 3987 | /** |
modtronix | 10:6444e6c798ce | 3988 | * @brief Processing function for the Q15 FIR lattice filter. |
modtronix | 10:6444e6c798ce | 3989 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
modtronix | 10:6444e6c798ce | 3990 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 3991 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 3992 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 3993 | * @return none. |
modtronix | 10:6444e6c798ce | 3994 | */ |
modtronix | 10:6444e6c798ce | 3995 | void arm_fir_lattice_q15( |
modtronix | 10:6444e6c798ce | 3996 | const arm_fir_lattice_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 3997 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 3998 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 3999 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4000 | |
modtronix | 10:6444e6c798ce | 4001 | /** |
modtronix | 10:6444e6c798ce | 4002 | * @brief Initialization function for the Q31 FIR lattice filter. |
modtronix | 10:6444e6c798ce | 4003 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
modtronix | 10:6444e6c798ce | 4004 | * @param[in] numStages number of filter stages. |
modtronix | 10:6444e6c798ce | 4005 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4006 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4007 | * @return none. |
modtronix | 10:6444e6c798ce | 4008 | */ |
modtronix | 10:6444e6c798ce | 4009 | |
modtronix | 10:6444e6c798ce | 4010 | void arm_fir_lattice_init_q31( |
modtronix | 10:6444e6c798ce | 4011 | arm_fir_lattice_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4012 | uint16_t numStages, |
modtronix | 10:6444e6c798ce | 4013 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4014 | q31_t * pState); |
modtronix | 10:6444e6c798ce | 4015 | |
modtronix | 10:6444e6c798ce | 4016 | |
modtronix | 10:6444e6c798ce | 4017 | /** |
modtronix | 10:6444e6c798ce | 4018 | * @brief Processing function for the Q31 FIR lattice filter. |
modtronix | 10:6444e6c798ce | 4019 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
modtronix | 10:6444e6c798ce | 4020 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4021 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 4022 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4023 | * @return none. |
modtronix | 10:6444e6c798ce | 4024 | */ |
modtronix | 10:6444e6c798ce | 4025 | |
modtronix | 10:6444e6c798ce | 4026 | void arm_fir_lattice_q31( |
modtronix | 10:6444e6c798ce | 4027 | const arm_fir_lattice_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4028 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4029 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 4030 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4031 | |
modtronix | 10:6444e6c798ce | 4032 | /** |
modtronix | 10:6444e6c798ce | 4033 | * @brief Initialization function for the floating-point FIR lattice filter. |
modtronix | 10:6444e6c798ce | 4034 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
modtronix | 10:6444e6c798ce | 4035 | * @param[in] numStages number of filter stages. |
modtronix | 10:6444e6c798ce | 4036 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4037 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4038 | * @return none. |
modtronix | 10:6444e6c798ce | 4039 | */ |
modtronix | 10:6444e6c798ce | 4040 | |
modtronix | 10:6444e6c798ce | 4041 | void arm_fir_lattice_init_f32( |
modtronix | 10:6444e6c798ce | 4042 | arm_fir_lattice_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4043 | uint16_t numStages, |
modtronix | 10:6444e6c798ce | 4044 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4045 | float32_t * pState); |
modtronix | 10:6444e6c798ce | 4046 | |
modtronix | 10:6444e6c798ce | 4047 | /** |
modtronix | 10:6444e6c798ce | 4048 | * @brief Processing function for the floating-point FIR lattice filter. |
modtronix | 10:6444e6c798ce | 4049 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
modtronix | 10:6444e6c798ce | 4050 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4051 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 4052 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4053 | * @return none. |
modtronix | 10:6444e6c798ce | 4054 | */ |
modtronix | 10:6444e6c798ce | 4055 | |
modtronix | 10:6444e6c798ce | 4056 | void arm_fir_lattice_f32( |
modtronix | 10:6444e6c798ce | 4057 | const arm_fir_lattice_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4058 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4059 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 4060 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4061 | |
modtronix | 10:6444e6c798ce | 4062 | /** |
modtronix | 10:6444e6c798ce | 4063 | * @brief Instance structure for the Q15 IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4064 | */ |
modtronix | 10:6444e6c798ce | 4065 | typedef struct |
modtronix | 10:6444e6c798ce | 4066 | { |
modtronix | 10:6444e6c798ce | 4067 | uint16_t numStages; /**< number of stages in the filter. */ |
modtronix | 10:6444e6c798ce | 4068 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
modtronix | 10:6444e6c798ce | 4069 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 4070 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
modtronix | 10:6444e6c798ce | 4071 | } arm_iir_lattice_instance_q15; |
modtronix | 10:6444e6c798ce | 4072 | |
modtronix | 10:6444e6c798ce | 4073 | /** |
modtronix | 10:6444e6c798ce | 4074 | * @brief Instance structure for the Q31 IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4075 | */ |
modtronix | 10:6444e6c798ce | 4076 | typedef struct |
modtronix | 10:6444e6c798ce | 4077 | { |
modtronix | 10:6444e6c798ce | 4078 | uint16_t numStages; /**< number of stages in the filter. */ |
modtronix | 10:6444e6c798ce | 4079 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
modtronix | 10:6444e6c798ce | 4080 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 4081 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
modtronix | 10:6444e6c798ce | 4082 | } arm_iir_lattice_instance_q31; |
modtronix | 10:6444e6c798ce | 4083 | |
modtronix | 10:6444e6c798ce | 4084 | /** |
modtronix | 10:6444e6c798ce | 4085 | * @brief Instance structure for the floating-point IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4086 | */ |
modtronix | 10:6444e6c798ce | 4087 | typedef struct |
modtronix | 10:6444e6c798ce | 4088 | { |
modtronix | 10:6444e6c798ce | 4089 | uint16_t numStages; /**< number of stages in the filter. */ |
modtronix | 10:6444e6c798ce | 4090 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
modtronix | 10:6444e6c798ce | 4091 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
modtronix | 10:6444e6c798ce | 4092 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
modtronix | 10:6444e6c798ce | 4093 | } arm_iir_lattice_instance_f32; |
modtronix | 10:6444e6c798ce | 4094 | |
modtronix | 10:6444e6c798ce | 4095 | /** |
modtronix | 10:6444e6c798ce | 4096 | * @brief Processing function for the floating-point IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4097 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
modtronix | 10:6444e6c798ce | 4098 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4099 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 4100 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4101 | * @return none. |
modtronix | 10:6444e6c798ce | 4102 | */ |
modtronix | 10:6444e6c798ce | 4103 | |
modtronix | 10:6444e6c798ce | 4104 | void arm_iir_lattice_f32( |
modtronix | 10:6444e6c798ce | 4105 | const arm_iir_lattice_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4106 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4107 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 4108 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4109 | |
modtronix | 10:6444e6c798ce | 4110 | /** |
modtronix | 10:6444e6c798ce | 4111 | * @brief Initialization function for the floating-point IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4112 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
modtronix | 10:6444e6c798ce | 4113 | * @param[in] numStages number of stages in the filter. |
modtronix | 10:6444e6c798ce | 4114 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4115 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
modtronix | 10:6444e6c798ce | 4116 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1. |
modtronix | 10:6444e6c798ce | 4117 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4118 | * @return none. |
modtronix | 10:6444e6c798ce | 4119 | */ |
modtronix | 10:6444e6c798ce | 4120 | |
modtronix | 10:6444e6c798ce | 4121 | void arm_iir_lattice_init_f32( |
modtronix | 10:6444e6c798ce | 4122 | arm_iir_lattice_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4123 | uint16_t numStages, |
modtronix | 10:6444e6c798ce | 4124 | float32_t * pkCoeffs, |
modtronix | 10:6444e6c798ce | 4125 | float32_t * pvCoeffs, |
modtronix | 10:6444e6c798ce | 4126 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 4127 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4128 | |
modtronix | 10:6444e6c798ce | 4129 | |
modtronix | 10:6444e6c798ce | 4130 | /** |
modtronix | 10:6444e6c798ce | 4131 | * @brief Processing function for the Q31 IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4132 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
modtronix | 10:6444e6c798ce | 4133 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4134 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 4135 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4136 | * @return none. |
modtronix | 10:6444e6c798ce | 4137 | */ |
modtronix | 10:6444e6c798ce | 4138 | |
modtronix | 10:6444e6c798ce | 4139 | void arm_iir_lattice_q31( |
modtronix | 10:6444e6c798ce | 4140 | const arm_iir_lattice_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4141 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4142 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 4143 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4144 | |
modtronix | 10:6444e6c798ce | 4145 | |
modtronix | 10:6444e6c798ce | 4146 | /** |
modtronix | 10:6444e6c798ce | 4147 | * @brief Initialization function for the Q31 IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4148 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
modtronix | 10:6444e6c798ce | 4149 | * @param[in] numStages number of stages in the filter. |
modtronix | 10:6444e6c798ce | 4150 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4151 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
modtronix | 10:6444e6c798ce | 4152 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. |
modtronix | 10:6444e6c798ce | 4153 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4154 | * @return none. |
modtronix | 10:6444e6c798ce | 4155 | */ |
modtronix | 10:6444e6c798ce | 4156 | |
modtronix | 10:6444e6c798ce | 4157 | void arm_iir_lattice_init_q31( |
modtronix | 10:6444e6c798ce | 4158 | arm_iir_lattice_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4159 | uint16_t numStages, |
modtronix | 10:6444e6c798ce | 4160 | q31_t * pkCoeffs, |
modtronix | 10:6444e6c798ce | 4161 | q31_t * pvCoeffs, |
modtronix | 10:6444e6c798ce | 4162 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 4163 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4164 | |
modtronix | 10:6444e6c798ce | 4165 | |
modtronix | 10:6444e6c798ce | 4166 | /** |
modtronix | 10:6444e6c798ce | 4167 | * @brief Processing function for the Q15 IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4168 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. |
modtronix | 10:6444e6c798ce | 4169 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4170 | * @param[out] *pDst points to the block of output data. |
modtronix | 10:6444e6c798ce | 4171 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4172 | * @return none. |
modtronix | 10:6444e6c798ce | 4173 | */ |
modtronix | 10:6444e6c798ce | 4174 | |
modtronix | 10:6444e6c798ce | 4175 | void arm_iir_lattice_q15( |
modtronix | 10:6444e6c798ce | 4176 | const arm_iir_lattice_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4177 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 4178 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 4179 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4180 | |
modtronix | 10:6444e6c798ce | 4181 | |
modtronix | 10:6444e6c798ce | 4182 | /** |
modtronix | 10:6444e6c798ce | 4183 | * @brief Initialization function for the Q15 IIR lattice filter. |
modtronix | 10:6444e6c798ce | 4184 | * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure. |
modtronix | 10:6444e6c798ce | 4185 | * @param[in] numStages number of stages in the filter. |
modtronix | 10:6444e6c798ce | 4186 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. |
modtronix | 10:6444e6c798ce | 4187 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. |
modtronix | 10:6444e6c798ce | 4188 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. |
modtronix | 10:6444e6c798ce | 4189 | * @param[in] blockSize number of samples to process per call. |
modtronix | 10:6444e6c798ce | 4190 | * @return none. |
modtronix | 10:6444e6c798ce | 4191 | */ |
modtronix | 10:6444e6c798ce | 4192 | |
modtronix | 10:6444e6c798ce | 4193 | void arm_iir_lattice_init_q15( |
modtronix | 10:6444e6c798ce | 4194 | arm_iir_lattice_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4195 | uint16_t numStages, |
modtronix | 10:6444e6c798ce | 4196 | q15_t * pkCoeffs, |
modtronix | 10:6444e6c798ce | 4197 | q15_t * pvCoeffs, |
modtronix | 10:6444e6c798ce | 4198 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 4199 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4200 | |
modtronix | 10:6444e6c798ce | 4201 | /** |
modtronix | 10:6444e6c798ce | 4202 | * @brief Instance structure for the floating-point LMS filter. |
modtronix | 10:6444e6c798ce | 4203 | */ |
modtronix | 10:6444e6c798ce | 4204 | |
modtronix | 10:6444e6c798ce | 4205 | typedef struct |
modtronix | 10:6444e6c798ce | 4206 | { |
modtronix | 10:6444e6c798ce | 4207 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4208 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4209 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4210 | float32_t mu; /**< step size that controls filter coefficient updates. */ |
modtronix | 10:6444e6c798ce | 4211 | } arm_lms_instance_f32; |
modtronix | 10:6444e6c798ce | 4212 | |
modtronix | 10:6444e6c798ce | 4213 | /** |
modtronix | 10:6444e6c798ce | 4214 | * @brief Processing function for floating-point LMS filter. |
modtronix | 10:6444e6c798ce | 4215 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
modtronix | 10:6444e6c798ce | 4216 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4217 | * @param[in] *pRef points to the block of reference data. |
modtronix | 10:6444e6c798ce | 4218 | * @param[out] *pOut points to the block of output data. |
modtronix | 10:6444e6c798ce | 4219 | * @param[out] *pErr points to the block of error data. |
modtronix | 10:6444e6c798ce | 4220 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4221 | * @return none. |
modtronix | 10:6444e6c798ce | 4222 | */ |
modtronix | 10:6444e6c798ce | 4223 | |
modtronix | 10:6444e6c798ce | 4224 | void arm_lms_f32( |
modtronix | 10:6444e6c798ce | 4225 | const arm_lms_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4226 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4227 | float32_t * pRef, |
modtronix | 10:6444e6c798ce | 4228 | float32_t * pOut, |
modtronix | 10:6444e6c798ce | 4229 | float32_t * pErr, |
modtronix | 10:6444e6c798ce | 4230 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4231 | |
modtronix | 10:6444e6c798ce | 4232 | /** |
modtronix | 10:6444e6c798ce | 4233 | * @brief Initialization function for floating-point LMS filter. |
modtronix | 10:6444e6c798ce | 4234 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
modtronix | 10:6444e6c798ce | 4235 | * @param[in] numTaps number of filter coefficients. |
modtronix | 10:6444e6c798ce | 4236 | * @param[in] *pCoeffs points to the coefficient buffer. |
modtronix | 10:6444e6c798ce | 4237 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 4238 | * @param[in] mu step size that controls filter coefficient updates. |
modtronix | 10:6444e6c798ce | 4239 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4240 | * @return none. |
modtronix | 10:6444e6c798ce | 4241 | */ |
modtronix | 10:6444e6c798ce | 4242 | |
modtronix | 10:6444e6c798ce | 4243 | void arm_lms_init_f32( |
modtronix | 10:6444e6c798ce | 4244 | arm_lms_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4245 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4246 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4247 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 4248 | float32_t mu, |
modtronix | 10:6444e6c798ce | 4249 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4250 | |
modtronix | 10:6444e6c798ce | 4251 | /** |
modtronix | 10:6444e6c798ce | 4252 | * @brief Instance structure for the Q15 LMS filter. |
modtronix | 10:6444e6c798ce | 4253 | */ |
modtronix | 10:6444e6c798ce | 4254 | |
modtronix | 10:6444e6c798ce | 4255 | typedef struct |
modtronix | 10:6444e6c798ce | 4256 | { |
modtronix | 10:6444e6c798ce | 4257 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4258 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4259 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4260 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
modtronix | 10:6444e6c798ce | 4261 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
modtronix | 10:6444e6c798ce | 4262 | } arm_lms_instance_q15; |
modtronix | 10:6444e6c798ce | 4263 | |
modtronix | 10:6444e6c798ce | 4264 | |
modtronix | 10:6444e6c798ce | 4265 | /** |
modtronix | 10:6444e6c798ce | 4266 | * @brief Initialization function for the Q15 LMS filter. |
modtronix | 10:6444e6c798ce | 4267 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
modtronix | 10:6444e6c798ce | 4268 | * @param[in] numTaps number of filter coefficients. |
modtronix | 10:6444e6c798ce | 4269 | * @param[in] *pCoeffs points to the coefficient buffer. |
modtronix | 10:6444e6c798ce | 4270 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 4271 | * @param[in] mu step size that controls filter coefficient updates. |
modtronix | 10:6444e6c798ce | 4272 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4273 | * @param[in] postShift bit shift applied to coefficients. |
modtronix | 10:6444e6c798ce | 4274 | * @return none. |
modtronix | 10:6444e6c798ce | 4275 | */ |
modtronix | 10:6444e6c798ce | 4276 | |
modtronix | 10:6444e6c798ce | 4277 | void arm_lms_init_q15( |
modtronix | 10:6444e6c798ce | 4278 | arm_lms_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4279 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4280 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4281 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 4282 | q15_t mu, |
modtronix | 10:6444e6c798ce | 4283 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 4284 | uint32_t postShift); |
modtronix | 10:6444e6c798ce | 4285 | |
modtronix | 10:6444e6c798ce | 4286 | /** |
modtronix | 10:6444e6c798ce | 4287 | * @brief Processing function for Q15 LMS filter. |
modtronix | 10:6444e6c798ce | 4288 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
modtronix | 10:6444e6c798ce | 4289 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4290 | * @param[in] *pRef points to the block of reference data. |
modtronix | 10:6444e6c798ce | 4291 | * @param[out] *pOut points to the block of output data. |
modtronix | 10:6444e6c798ce | 4292 | * @param[out] *pErr points to the block of error data. |
modtronix | 10:6444e6c798ce | 4293 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4294 | * @return none. |
modtronix | 10:6444e6c798ce | 4295 | */ |
modtronix | 10:6444e6c798ce | 4296 | |
modtronix | 10:6444e6c798ce | 4297 | void arm_lms_q15( |
modtronix | 10:6444e6c798ce | 4298 | const arm_lms_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4299 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 4300 | q15_t * pRef, |
modtronix | 10:6444e6c798ce | 4301 | q15_t * pOut, |
modtronix | 10:6444e6c798ce | 4302 | q15_t * pErr, |
modtronix | 10:6444e6c798ce | 4303 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4304 | |
modtronix | 10:6444e6c798ce | 4305 | |
modtronix | 10:6444e6c798ce | 4306 | /** |
modtronix | 10:6444e6c798ce | 4307 | * @brief Instance structure for the Q31 LMS filter. |
modtronix | 10:6444e6c798ce | 4308 | */ |
modtronix | 10:6444e6c798ce | 4309 | |
modtronix | 10:6444e6c798ce | 4310 | typedef struct |
modtronix | 10:6444e6c798ce | 4311 | { |
modtronix | 10:6444e6c798ce | 4312 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4313 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4314 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4315 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
modtronix | 10:6444e6c798ce | 4316 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
modtronix | 10:6444e6c798ce | 4317 | |
modtronix | 10:6444e6c798ce | 4318 | } arm_lms_instance_q31; |
modtronix | 10:6444e6c798ce | 4319 | |
modtronix | 10:6444e6c798ce | 4320 | /** |
modtronix | 10:6444e6c798ce | 4321 | * @brief Processing function for Q31 LMS filter. |
modtronix | 10:6444e6c798ce | 4322 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
modtronix | 10:6444e6c798ce | 4323 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4324 | * @param[in] *pRef points to the block of reference data. |
modtronix | 10:6444e6c798ce | 4325 | * @param[out] *pOut points to the block of output data. |
modtronix | 10:6444e6c798ce | 4326 | * @param[out] *pErr points to the block of error data. |
modtronix | 10:6444e6c798ce | 4327 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4328 | * @return none. |
modtronix | 10:6444e6c798ce | 4329 | */ |
modtronix | 10:6444e6c798ce | 4330 | |
modtronix | 10:6444e6c798ce | 4331 | void arm_lms_q31( |
modtronix | 10:6444e6c798ce | 4332 | const arm_lms_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4333 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4334 | q31_t * pRef, |
modtronix | 10:6444e6c798ce | 4335 | q31_t * pOut, |
modtronix | 10:6444e6c798ce | 4336 | q31_t * pErr, |
modtronix | 10:6444e6c798ce | 4337 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4338 | |
modtronix | 10:6444e6c798ce | 4339 | /** |
modtronix | 10:6444e6c798ce | 4340 | * @brief Initialization function for Q31 LMS filter. |
modtronix | 10:6444e6c798ce | 4341 | * @param[in] *S points to an instance of the Q31 LMS filter structure. |
modtronix | 10:6444e6c798ce | 4342 | * @param[in] numTaps number of filter coefficients. |
modtronix | 10:6444e6c798ce | 4343 | * @param[in] *pCoeffs points to coefficient buffer. |
modtronix | 10:6444e6c798ce | 4344 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 4345 | * @param[in] mu step size that controls filter coefficient updates. |
modtronix | 10:6444e6c798ce | 4346 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4347 | * @param[in] postShift bit shift applied to coefficients. |
modtronix | 10:6444e6c798ce | 4348 | * @return none. |
modtronix | 10:6444e6c798ce | 4349 | */ |
modtronix | 10:6444e6c798ce | 4350 | |
modtronix | 10:6444e6c798ce | 4351 | void arm_lms_init_q31( |
modtronix | 10:6444e6c798ce | 4352 | arm_lms_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4353 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4354 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4355 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 4356 | q31_t mu, |
modtronix | 10:6444e6c798ce | 4357 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 4358 | uint32_t postShift); |
modtronix | 10:6444e6c798ce | 4359 | |
modtronix | 10:6444e6c798ce | 4360 | /** |
modtronix | 10:6444e6c798ce | 4361 | * @brief Instance structure for the floating-point normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4362 | */ |
modtronix | 10:6444e6c798ce | 4363 | |
modtronix | 10:6444e6c798ce | 4364 | typedef struct |
modtronix | 10:6444e6c798ce | 4365 | { |
modtronix | 10:6444e6c798ce | 4366 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4367 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4368 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4369 | float32_t mu; /**< step size that control filter coefficient updates. */ |
modtronix | 10:6444e6c798ce | 4370 | float32_t energy; /**< saves previous frame energy. */ |
modtronix | 10:6444e6c798ce | 4371 | float32_t x0; /**< saves previous input sample. */ |
modtronix | 10:6444e6c798ce | 4372 | } arm_lms_norm_instance_f32; |
modtronix | 10:6444e6c798ce | 4373 | |
modtronix | 10:6444e6c798ce | 4374 | /** |
modtronix | 10:6444e6c798ce | 4375 | * @brief Processing function for floating-point normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4376 | * @param[in] *S points to an instance of the floating-point normalized LMS filter structure. |
modtronix | 10:6444e6c798ce | 4377 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4378 | * @param[in] *pRef points to the block of reference data. |
modtronix | 10:6444e6c798ce | 4379 | * @param[out] *pOut points to the block of output data. |
modtronix | 10:6444e6c798ce | 4380 | * @param[out] *pErr points to the block of error data. |
modtronix | 10:6444e6c798ce | 4381 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4382 | * @return none. |
modtronix | 10:6444e6c798ce | 4383 | */ |
modtronix | 10:6444e6c798ce | 4384 | |
modtronix | 10:6444e6c798ce | 4385 | void arm_lms_norm_f32( |
modtronix | 10:6444e6c798ce | 4386 | arm_lms_norm_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4387 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4388 | float32_t * pRef, |
modtronix | 10:6444e6c798ce | 4389 | float32_t * pOut, |
modtronix | 10:6444e6c798ce | 4390 | float32_t * pErr, |
modtronix | 10:6444e6c798ce | 4391 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4392 | |
modtronix | 10:6444e6c798ce | 4393 | /** |
modtronix | 10:6444e6c798ce | 4394 | * @brief Initialization function for floating-point normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4395 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
modtronix | 10:6444e6c798ce | 4396 | * @param[in] numTaps number of filter coefficients. |
modtronix | 10:6444e6c798ce | 4397 | * @param[in] *pCoeffs points to coefficient buffer. |
modtronix | 10:6444e6c798ce | 4398 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 4399 | * @param[in] mu step size that controls filter coefficient updates. |
modtronix | 10:6444e6c798ce | 4400 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4401 | * @return none. |
modtronix | 10:6444e6c798ce | 4402 | */ |
modtronix | 10:6444e6c798ce | 4403 | |
modtronix | 10:6444e6c798ce | 4404 | void arm_lms_norm_init_f32( |
modtronix | 10:6444e6c798ce | 4405 | arm_lms_norm_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4406 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4407 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4408 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 4409 | float32_t mu, |
modtronix | 10:6444e6c798ce | 4410 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4411 | |
modtronix | 10:6444e6c798ce | 4412 | |
modtronix | 10:6444e6c798ce | 4413 | /** |
modtronix | 10:6444e6c798ce | 4414 | * @brief Instance structure for the Q31 normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4415 | */ |
modtronix | 10:6444e6c798ce | 4416 | typedef struct |
modtronix | 10:6444e6c798ce | 4417 | { |
modtronix | 10:6444e6c798ce | 4418 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4419 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4420 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4421 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
modtronix | 10:6444e6c798ce | 4422 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
modtronix | 10:6444e6c798ce | 4423 | q31_t *recipTable; /**< points to the reciprocal initial value table. */ |
modtronix | 10:6444e6c798ce | 4424 | q31_t energy; /**< saves previous frame energy. */ |
modtronix | 10:6444e6c798ce | 4425 | q31_t x0; /**< saves previous input sample. */ |
modtronix | 10:6444e6c798ce | 4426 | } arm_lms_norm_instance_q31; |
modtronix | 10:6444e6c798ce | 4427 | |
modtronix | 10:6444e6c798ce | 4428 | /** |
modtronix | 10:6444e6c798ce | 4429 | * @brief Processing function for Q31 normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4430 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
modtronix | 10:6444e6c798ce | 4431 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4432 | * @param[in] *pRef points to the block of reference data. |
modtronix | 10:6444e6c798ce | 4433 | * @param[out] *pOut points to the block of output data. |
modtronix | 10:6444e6c798ce | 4434 | * @param[out] *pErr points to the block of error data. |
modtronix | 10:6444e6c798ce | 4435 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4436 | * @return none. |
modtronix | 10:6444e6c798ce | 4437 | */ |
modtronix | 10:6444e6c798ce | 4438 | |
modtronix | 10:6444e6c798ce | 4439 | void arm_lms_norm_q31( |
modtronix | 10:6444e6c798ce | 4440 | arm_lms_norm_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4441 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4442 | q31_t * pRef, |
modtronix | 10:6444e6c798ce | 4443 | q31_t * pOut, |
modtronix | 10:6444e6c798ce | 4444 | q31_t * pErr, |
modtronix | 10:6444e6c798ce | 4445 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4446 | |
modtronix | 10:6444e6c798ce | 4447 | /** |
modtronix | 10:6444e6c798ce | 4448 | * @brief Initialization function for Q31 normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4449 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
modtronix | 10:6444e6c798ce | 4450 | * @param[in] numTaps number of filter coefficients. |
modtronix | 10:6444e6c798ce | 4451 | * @param[in] *pCoeffs points to coefficient buffer. |
modtronix | 10:6444e6c798ce | 4452 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 4453 | * @param[in] mu step size that controls filter coefficient updates. |
modtronix | 10:6444e6c798ce | 4454 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4455 | * @param[in] postShift bit shift applied to coefficients. |
modtronix | 10:6444e6c798ce | 4456 | * @return none. |
modtronix | 10:6444e6c798ce | 4457 | */ |
modtronix | 10:6444e6c798ce | 4458 | |
modtronix | 10:6444e6c798ce | 4459 | void arm_lms_norm_init_q31( |
modtronix | 10:6444e6c798ce | 4460 | arm_lms_norm_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4461 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4462 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4463 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 4464 | q31_t mu, |
modtronix | 10:6444e6c798ce | 4465 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 4466 | uint8_t postShift); |
modtronix | 10:6444e6c798ce | 4467 | |
modtronix | 10:6444e6c798ce | 4468 | /** |
modtronix | 10:6444e6c798ce | 4469 | * @brief Instance structure for the Q15 normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4470 | */ |
modtronix | 10:6444e6c798ce | 4471 | |
modtronix | 10:6444e6c798ce | 4472 | typedef struct |
modtronix | 10:6444e6c798ce | 4473 | { |
modtronix | 10:6444e6c798ce | 4474 | uint16_t numTaps; /**< Number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4475 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4476 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4477 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
modtronix | 10:6444e6c798ce | 4478 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
modtronix | 10:6444e6c798ce | 4479 | q15_t *recipTable; /**< Points to the reciprocal initial value table. */ |
modtronix | 10:6444e6c798ce | 4480 | q15_t energy; /**< saves previous frame energy. */ |
modtronix | 10:6444e6c798ce | 4481 | q15_t x0; /**< saves previous input sample. */ |
modtronix | 10:6444e6c798ce | 4482 | } arm_lms_norm_instance_q15; |
modtronix | 10:6444e6c798ce | 4483 | |
modtronix | 10:6444e6c798ce | 4484 | /** |
modtronix | 10:6444e6c798ce | 4485 | * @brief Processing function for Q15 normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4486 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
modtronix | 10:6444e6c798ce | 4487 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4488 | * @param[in] *pRef points to the block of reference data. |
modtronix | 10:6444e6c798ce | 4489 | * @param[out] *pOut points to the block of output data. |
modtronix | 10:6444e6c798ce | 4490 | * @param[out] *pErr points to the block of error data. |
modtronix | 10:6444e6c798ce | 4491 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4492 | * @return none. |
modtronix | 10:6444e6c798ce | 4493 | */ |
modtronix | 10:6444e6c798ce | 4494 | |
modtronix | 10:6444e6c798ce | 4495 | void arm_lms_norm_q15( |
modtronix | 10:6444e6c798ce | 4496 | arm_lms_norm_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4497 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 4498 | q15_t * pRef, |
modtronix | 10:6444e6c798ce | 4499 | q15_t * pOut, |
modtronix | 10:6444e6c798ce | 4500 | q15_t * pErr, |
modtronix | 10:6444e6c798ce | 4501 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4502 | |
modtronix | 10:6444e6c798ce | 4503 | |
modtronix | 10:6444e6c798ce | 4504 | /** |
modtronix | 10:6444e6c798ce | 4505 | * @brief Initialization function for Q15 normalized LMS filter. |
modtronix | 10:6444e6c798ce | 4506 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
modtronix | 10:6444e6c798ce | 4507 | * @param[in] numTaps number of filter coefficients. |
modtronix | 10:6444e6c798ce | 4508 | * @param[in] *pCoeffs points to coefficient buffer. |
modtronix | 10:6444e6c798ce | 4509 | * @param[in] *pState points to state buffer. |
modtronix | 10:6444e6c798ce | 4510 | * @param[in] mu step size that controls filter coefficient updates. |
modtronix | 10:6444e6c798ce | 4511 | * @param[in] blockSize number of samples to process. |
modtronix | 10:6444e6c798ce | 4512 | * @param[in] postShift bit shift applied to coefficients. |
modtronix | 10:6444e6c798ce | 4513 | * @return none. |
modtronix | 10:6444e6c798ce | 4514 | */ |
modtronix | 10:6444e6c798ce | 4515 | |
modtronix | 10:6444e6c798ce | 4516 | void arm_lms_norm_init_q15( |
modtronix | 10:6444e6c798ce | 4517 | arm_lms_norm_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4518 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4519 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4520 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 4521 | q15_t mu, |
modtronix | 10:6444e6c798ce | 4522 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 4523 | uint8_t postShift); |
modtronix | 10:6444e6c798ce | 4524 | |
modtronix | 10:6444e6c798ce | 4525 | /** |
modtronix | 10:6444e6c798ce | 4526 | * @brief Correlation of floating-point sequences. |
modtronix | 10:6444e6c798ce | 4527 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4528 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4529 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4530 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4531 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4532 | * @return none. |
modtronix | 10:6444e6c798ce | 4533 | */ |
modtronix | 10:6444e6c798ce | 4534 | |
modtronix | 10:6444e6c798ce | 4535 | void arm_correlate_f32( |
modtronix | 10:6444e6c798ce | 4536 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4537 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4538 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4539 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4540 | float32_t * pDst); |
modtronix | 10:6444e6c798ce | 4541 | |
modtronix | 10:6444e6c798ce | 4542 | |
modtronix | 10:6444e6c798ce | 4543 | /** |
modtronix | 10:6444e6c798ce | 4544 | * @brief Correlation of Q15 sequences |
modtronix | 10:6444e6c798ce | 4545 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4546 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4547 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4548 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4549 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4550 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 4551 | * @return none. |
modtronix | 10:6444e6c798ce | 4552 | */ |
modtronix | 10:6444e6c798ce | 4553 | void arm_correlate_opt_q15( |
modtronix | 10:6444e6c798ce | 4554 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4555 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4556 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4557 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4558 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 4559 | q15_t * pScratch); |
modtronix | 10:6444e6c798ce | 4560 | |
modtronix | 10:6444e6c798ce | 4561 | |
modtronix | 10:6444e6c798ce | 4562 | /** |
modtronix | 10:6444e6c798ce | 4563 | * @brief Correlation of Q15 sequences. |
modtronix | 10:6444e6c798ce | 4564 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4565 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4566 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4567 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4568 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4569 | * @return none. |
modtronix | 10:6444e6c798ce | 4570 | */ |
modtronix | 10:6444e6c798ce | 4571 | |
modtronix | 10:6444e6c798ce | 4572 | void arm_correlate_q15( |
modtronix | 10:6444e6c798ce | 4573 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4574 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4575 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4576 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4577 | q15_t * pDst); |
modtronix | 10:6444e6c798ce | 4578 | |
modtronix | 10:6444e6c798ce | 4579 | /** |
modtronix | 10:6444e6c798ce | 4580 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 4581 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4582 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4583 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4584 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4585 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4586 | * @return none. |
modtronix | 10:6444e6c798ce | 4587 | */ |
modtronix | 10:6444e6c798ce | 4588 | |
modtronix | 10:6444e6c798ce | 4589 | void arm_correlate_fast_q15( |
modtronix | 10:6444e6c798ce | 4590 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4591 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4592 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4593 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4594 | q15_t * pDst); |
modtronix | 10:6444e6c798ce | 4595 | |
modtronix | 10:6444e6c798ce | 4596 | |
modtronix | 10:6444e6c798ce | 4597 | |
modtronix | 10:6444e6c798ce | 4598 | /** |
modtronix | 10:6444e6c798ce | 4599 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
modtronix | 10:6444e6c798ce | 4600 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4601 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4602 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4603 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4604 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4605 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 4606 | * @return none. |
modtronix | 10:6444e6c798ce | 4607 | */ |
modtronix | 10:6444e6c798ce | 4608 | |
modtronix | 10:6444e6c798ce | 4609 | void arm_correlate_fast_opt_q15( |
modtronix | 10:6444e6c798ce | 4610 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4611 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4612 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4613 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4614 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 4615 | q15_t * pScratch); |
modtronix | 10:6444e6c798ce | 4616 | |
modtronix | 10:6444e6c798ce | 4617 | /** |
modtronix | 10:6444e6c798ce | 4618 | * @brief Correlation of Q31 sequences. |
modtronix | 10:6444e6c798ce | 4619 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4620 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4621 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4622 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4623 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4624 | * @return none. |
modtronix | 10:6444e6c798ce | 4625 | */ |
modtronix | 10:6444e6c798ce | 4626 | |
modtronix | 10:6444e6c798ce | 4627 | void arm_correlate_q31( |
modtronix | 10:6444e6c798ce | 4628 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4629 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4630 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4631 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4632 | q31_t * pDst); |
modtronix | 10:6444e6c798ce | 4633 | |
modtronix | 10:6444e6c798ce | 4634 | /** |
modtronix | 10:6444e6c798ce | 4635 | * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
modtronix | 10:6444e6c798ce | 4636 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4637 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4638 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4639 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4640 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4641 | * @return none. |
modtronix | 10:6444e6c798ce | 4642 | */ |
modtronix | 10:6444e6c798ce | 4643 | |
modtronix | 10:6444e6c798ce | 4644 | void arm_correlate_fast_q31( |
modtronix | 10:6444e6c798ce | 4645 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4646 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4647 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4648 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4649 | q31_t * pDst); |
modtronix | 10:6444e6c798ce | 4650 | |
modtronix | 10:6444e6c798ce | 4651 | |
modtronix | 10:6444e6c798ce | 4652 | |
modtronix | 10:6444e6c798ce | 4653 | /** |
modtronix | 10:6444e6c798ce | 4654 | * @brief Correlation of Q7 sequences. |
modtronix | 10:6444e6c798ce | 4655 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4656 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4657 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4658 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4659 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4660 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
modtronix | 10:6444e6c798ce | 4661 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
modtronix | 10:6444e6c798ce | 4662 | * @return none. |
modtronix | 10:6444e6c798ce | 4663 | */ |
modtronix | 10:6444e6c798ce | 4664 | |
modtronix | 10:6444e6c798ce | 4665 | void arm_correlate_opt_q7( |
modtronix | 10:6444e6c798ce | 4666 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4667 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4668 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4669 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4670 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 4671 | q15_t * pScratch1, |
modtronix | 10:6444e6c798ce | 4672 | q15_t * pScratch2); |
modtronix | 10:6444e6c798ce | 4673 | |
modtronix | 10:6444e6c798ce | 4674 | |
modtronix | 10:6444e6c798ce | 4675 | /** |
modtronix | 10:6444e6c798ce | 4676 | * @brief Correlation of Q7 sequences. |
modtronix | 10:6444e6c798ce | 4677 | * @param[in] *pSrcA points to the first input sequence. |
modtronix | 10:6444e6c798ce | 4678 | * @param[in] srcALen length of the first input sequence. |
modtronix | 10:6444e6c798ce | 4679 | * @param[in] *pSrcB points to the second input sequence. |
modtronix | 10:6444e6c798ce | 4680 | * @param[in] srcBLen length of the second input sequence. |
modtronix | 10:6444e6c798ce | 4681 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
modtronix | 10:6444e6c798ce | 4682 | * @return none. |
modtronix | 10:6444e6c798ce | 4683 | */ |
modtronix | 10:6444e6c798ce | 4684 | |
modtronix | 10:6444e6c798ce | 4685 | void arm_correlate_q7( |
modtronix | 10:6444e6c798ce | 4686 | q7_t * pSrcA, |
modtronix | 10:6444e6c798ce | 4687 | uint32_t srcALen, |
modtronix | 10:6444e6c798ce | 4688 | q7_t * pSrcB, |
modtronix | 10:6444e6c798ce | 4689 | uint32_t srcBLen, |
modtronix | 10:6444e6c798ce | 4690 | q7_t * pDst); |
modtronix | 10:6444e6c798ce | 4691 | |
modtronix | 10:6444e6c798ce | 4692 | |
modtronix | 10:6444e6c798ce | 4693 | /** |
modtronix | 10:6444e6c798ce | 4694 | * @brief Instance structure for the floating-point sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4695 | */ |
modtronix | 10:6444e6c798ce | 4696 | typedef struct |
modtronix | 10:6444e6c798ce | 4697 | { |
modtronix | 10:6444e6c798ce | 4698 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4699 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
modtronix | 10:6444e6c798ce | 4700 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4701 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 4702 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
modtronix | 10:6444e6c798ce | 4703 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4704 | } arm_fir_sparse_instance_f32; |
modtronix | 10:6444e6c798ce | 4705 | |
modtronix | 10:6444e6c798ce | 4706 | /** |
modtronix | 10:6444e6c798ce | 4707 | * @brief Instance structure for the Q31 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4708 | */ |
modtronix | 10:6444e6c798ce | 4709 | |
modtronix | 10:6444e6c798ce | 4710 | typedef struct |
modtronix | 10:6444e6c798ce | 4711 | { |
modtronix | 10:6444e6c798ce | 4712 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4713 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
modtronix | 10:6444e6c798ce | 4714 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4715 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 4716 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
modtronix | 10:6444e6c798ce | 4717 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4718 | } arm_fir_sparse_instance_q31; |
modtronix | 10:6444e6c798ce | 4719 | |
modtronix | 10:6444e6c798ce | 4720 | /** |
modtronix | 10:6444e6c798ce | 4721 | * @brief Instance structure for the Q15 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4722 | */ |
modtronix | 10:6444e6c798ce | 4723 | |
modtronix | 10:6444e6c798ce | 4724 | typedef struct |
modtronix | 10:6444e6c798ce | 4725 | { |
modtronix | 10:6444e6c798ce | 4726 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4727 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
modtronix | 10:6444e6c798ce | 4728 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4729 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 4730 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
modtronix | 10:6444e6c798ce | 4731 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4732 | } arm_fir_sparse_instance_q15; |
modtronix | 10:6444e6c798ce | 4733 | |
modtronix | 10:6444e6c798ce | 4734 | /** |
modtronix | 10:6444e6c798ce | 4735 | * @brief Instance structure for the Q7 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4736 | */ |
modtronix | 10:6444e6c798ce | 4737 | |
modtronix | 10:6444e6c798ce | 4738 | typedef struct |
modtronix | 10:6444e6c798ce | 4739 | { |
modtronix | 10:6444e6c798ce | 4740 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
modtronix | 10:6444e6c798ce | 4741 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
modtronix | 10:6444e6c798ce | 4742 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
modtronix | 10:6444e6c798ce | 4743 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
modtronix | 10:6444e6c798ce | 4744 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
modtronix | 10:6444e6c798ce | 4745 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
modtronix | 10:6444e6c798ce | 4746 | } arm_fir_sparse_instance_q7; |
modtronix | 10:6444e6c798ce | 4747 | |
modtronix | 10:6444e6c798ce | 4748 | /** |
modtronix | 10:6444e6c798ce | 4749 | * @brief Processing function for the floating-point sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4750 | * @param[in] *S points to an instance of the floating-point sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4751 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4752 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 4753 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
modtronix | 10:6444e6c798ce | 4754 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 4755 | * @return none. |
modtronix | 10:6444e6c798ce | 4756 | */ |
modtronix | 10:6444e6c798ce | 4757 | |
modtronix | 10:6444e6c798ce | 4758 | void arm_fir_sparse_f32( |
modtronix | 10:6444e6c798ce | 4759 | arm_fir_sparse_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4760 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4761 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 4762 | float32_t * pScratchIn, |
modtronix | 10:6444e6c798ce | 4763 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4764 | |
modtronix | 10:6444e6c798ce | 4765 | /** |
modtronix | 10:6444e6c798ce | 4766 | * @brief Initialization function for the floating-point sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4767 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4768 | * @param[in] numTaps number of nonzero coefficients in the filter. |
modtronix | 10:6444e6c798ce | 4769 | * @param[in] *pCoeffs points to the array of filter coefficients. |
modtronix | 10:6444e6c798ce | 4770 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 4771 | * @param[in] *pTapDelay points to the array of offset times. |
modtronix | 10:6444e6c798ce | 4772 | * @param[in] maxDelay maximum offset time supported. |
modtronix | 10:6444e6c798ce | 4773 | * @param[in] blockSize number of samples that will be processed per block. |
modtronix | 10:6444e6c798ce | 4774 | * @return none |
modtronix | 10:6444e6c798ce | 4775 | */ |
modtronix | 10:6444e6c798ce | 4776 | |
modtronix | 10:6444e6c798ce | 4777 | void arm_fir_sparse_init_f32( |
modtronix | 10:6444e6c798ce | 4778 | arm_fir_sparse_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 4779 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4780 | float32_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4781 | float32_t * pState, |
modtronix | 10:6444e6c798ce | 4782 | int32_t * pTapDelay, |
modtronix | 10:6444e6c798ce | 4783 | uint16_t maxDelay, |
modtronix | 10:6444e6c798ce | 4784 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4785 | |
modtronix | 10:6444e6c798ce | 4786 | /** |
modtronix | 10:6444e6c798ce | 4787 | * @brief Processing function for the Q31 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4788 | * @param[in] *S points to an instance of the Q31 sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4789 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4790 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 4791 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
modtronix | 10:6444e6c798ce | 4792 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 4793 | * @return none. |
modtronix | 10:6444e6c798ce | 4794 | */ |
modtronix | 10:6444e6c798ce | 4795 | |
modtronix | 10:6444e6c798ce | 4796 | void arm_fir_sparse_q31( |
modtronix | 10:6444e6c798ce | 4797 | arm_fir_sparse_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4798 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4799 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 4800 | q31_t * pScratchIn, |
modtronix | 10:6444e6c798ce | 4801 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4802 | |
modtronix | 10:6444e6c798ce | 4803 | /** |
modtronix | 10:6444e6c798ce | 4804 | * @brief Initialization function for the Q31 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4805 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4806 | * @param[in] numTaps number of nonzero coefficients in the filter. |
modtronix | 10:6444e6c798ce | 4807 | * @param[in] *pCoeffs points to the array of filter coefficients. |
modtronix | 10:6444e6c798ce | 4808 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 4809 | * @param[in] *pTapDelay points to the array of offset times. |
modtronix | 10:6444e6c798ce | 4810 | * @param[in] maxDelay maximum offset time supported. |
modtronix | 10:6444e6c798ce | 4811 | * @param[in] blockSize number of samples that will be processed per block. |
modtronix | 10:6444e6c798ce | 4812 | * @return none |
modtronix | 10:6444e6c798ce | 4813 | */ |
modtronix | 10:6444e6c798ce | 4814 | |
modtronix | 10:6444e6c798ce | 4815 | void arm_fir_sparse_init_q31( |
modtronix | 10:6444e6c798ce | 4816 | arm_fir_sparse_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 4817 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4818 | q31_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4819 | q31_t * pState, |
modtronix | 10:6444e6c798ce | 4820 | int32_t * pTapDelay, |
modtronix | 10:6444e6c798ce | 4821 | uint16_t maxDelay, |
modtronix | 10:6444e6c798ce | 4822 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4823 | |
modtronix | 10:6444e6c798ce | 4824 | /** |
modtronix | 10:6444e6c798ce | 4825 | * @brief Processing function for the Q15 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4826 | * @param[in] *S points to an instance of the Q15 sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4827 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4828 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 4829 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
modtronix | 10:6444e6c798ce | 4830 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
modtronix | 10:6444e6c798ce | 4831 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 4832 | * @return none. |
modtronix | 10:6444e6c798ce | 4833 | */ |
modtronix | 10:6444e6c798ce | 4834 | |
modtronix | 10:6444e6c798ce | 4835 | void arm_fir_sparse_q15( |
modtronix | 10:6444e6c798ce | 4836 | arm_fir_sparse_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4837 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 4838 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 4839 | q15_t * pScratchIn, |
modtronix | 10:6444e6c798ce | 4840 | q31_t * pScratchOut, |
modtronix | 10:6444e6c798ce | 4841 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4842 | |
modtronix | 10:6444e6c798ce | 4843 | |
modtronix | 10:6444e6c798ce | 4844 | /** |
modtronix | 10:6444e6c798ce | 4845 | * @brief Initialization function for the Q15 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4846 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4847 | * @param[in] numTaps number of nonzero coefficients in the filter. |
modtronix | 10:6444e6c798ce | 4848 | * @param[in] *pCoeffs points to the array of filter coefficients. |
modtronix | 10:6444e6c798ce | 4849 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 4850 | * @param[in] *pTapDelay points to the array of offset times. |
modtronix | 10:6444e6c798ce | 4851 | * @param[in] maxDelay maximum offset time supported. |
modtronix | 10:6444e6c798ce | 4852 | * @param[in] blockSize number of samples that will be processed per block. |
modtronix | 10:6444e6c798ce | 4853 | * @return none |
modtronix | 10:6444e6c798ce | 4854 | */ |
modtronix | 10:6444e6c798ce | 4855 | |
modtronix | 10:6444e6c798ce | 4856 | void arm_fir_sparse_init_q15( |
modtronix | 10:6444e6c798ce | 4857 | arm_fir_sparse_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 4858 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4859 | q15_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4860 | q15_t * pState, |
modtronix | 10:6444e6c798ce | 4861 | int32_t * pTapDelay, |
modtronix | 10:6444e6c798ce | 4862 | uint16_t maxDelay, |
modtronix | 10:6444e6c798ce | 4863 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4864 | |
modtronix | 10:6444e6c798ce | 4865 | /** |
modtronix | 10:6444e6c798ce | 4866 | * @brief Processing function for the Q7 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4867 | * @param[in] *S points to an instance of the Q7 sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4868 | * @param[in] *pSrc points to the block of input data. |
modtronix | 10:6444e6c798ce | 4869 | * @param[out] *pDst points to the block of output data |
modtronix | 10:6444e6c798ce | 4870 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
modtronix | 10:6444e6c798ce | 4871 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
modtronix | 10:6444e6c798ce | 4872 | * @param[in] blockSize number of input samples to process per call. |
modtronix | 10:6444e6c798ce | 4873 | * @return none. |
modtronix | 10:6444e6c798ce | 4874 | */ |
modtronix | 10:6444e6c798ce | 4875 | |
modtronix | 10:6444e6c798ce | 4876 | void arm_fir_sparse_q7( |
modtronix | 10:6444e6c798ce | 4877 | arm_fir_sparse_instance_q7 * S, |
modtronix | 10:6444e6c798ce | 4878 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 4879 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 4880 | q7_t * pScratchIn, |
modtronix | 10:6444e6c798ce | 4881 | q31_t * pScratchOut, |
modtronix | 10:6444e6c798ce | 4882 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4883 | |
modtronix | 10:6444e6c798ce | 4884 | /** |
modtronix | 10:6444e6c798ce | 4885 | * @brief Initialization function for the Q7 sparse FIR filter. |
modtronix | 10:6444e6c798ce | 4886 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. |
modtronix | 10:6444e6c798ce | 4887 | * @param[in] numTaps number of nonzero coefficients in the filter. |
modtronix | 10:6444e6c798ce | 4888 | * @param[in] *pCoeffs points to the array of filter coefficients. |
modtronix | 10:6444e6c798ce | 4889 | * @param[in] *pState points to the state buffer. |
modtronix | 10:6444e6c798ce | 4890 | * @param[in] *pTapDelay points to the array of offset times. |
modtronix | 10:6444e6c798ce | 4891 | * @param[in] maxDelay maximum offset time supported. |
modtronix | 10:6444e6c798ce | 4892 | * @param[in] blockSize number of samples that will be processed per block. |
modtronix | 10:6444e6c798ce | 4893 | * @return none |
modtronix | 10:6444e6c798ce | 4894 | */ |
modtronix | 10:6444e6c798ce | 4895 | |
modtronix | 10:6444e6c798ce | 4896 | void arm_fir_sparse_init_q7( |
modtronix | 10:6444e6c798ce | 4897 | arm_fir_sparse_instance_q7 * S, |
modtronix | 10:6444e6c798ce | 4898 | uint16_t numTaps, |
modtronix | 10:6444e6c798ce | 4899 | q7_t * pCoeffs, |
modtronix | 10:6444e6c798ce | 4900 | q7_t * pState, |
modtronix | 10:6444e6c798ce | 4901 | int32_t * pTapDelay, |
modtronix | 10:6444e6c798ce | 4902 | uint16_t maxDelay, |
modtronix | 10:6444e6c798ce | 4903 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 4904 | |
modtronix | 10:6444e6c798ce | 4905 | |
modtronix | 10:6444e6c798ce | 4906 | /* |
modtronix | 10:6444e6c798ce | 4907 | * @brief Floating-point sin_cos function. |
modtronix | 10:6444e6c798ce | 4908 | * @param[in] theta input value in degrees |
modtronix | 10:6444e6c798ce | 4909 | * @param[out] *pSinVal points to the processed sine output. |
modtronix | 10:6444e6c798ce | 4910 | * @param[out] *pCosVal points to the processed cos output. |
modtronix | 10:6444e6c798ce | 4911 | * @return none. |
modtronix | 10:6444e6c798ce | 4912 | */ |
modtronix | 10:6444e6c798ce | 4913 | |
modtronix | 10:6444e6c798ce | 4914 | void arm_sin_cos_f32( |
modtronix | 10:6444e6c798ce | 4915 | float32_t theta, |
modtronix | 10:6444e6c798ce | 4916 | float32_t * pSinVal, |
modtronix | 10:6444e6c798ce | 4917 | float32_t * pCcosVal); |
modtronix | 10:6444e6c798ce | 4918 | |
modtronix | 10:6444e6c798ce | 4919 | /* |
modtronix | 10:6444e6c798ce | 4920 | * @brief Q31 sin_cos function. |
modtronix | 10:6444e6c798ce | 4921 | * @param[in] theta scaled input value in degrees |
modtronix | 10:6444e6c798ce | 4922 | * @param[out] *pSinVal points to the processed sine output. |
modtronix | 10:6444e6c798ce | 4923 | * @param[out] *pCosVal points to the processed cosine output. |
modtronix | 10:6444e6c798ce | 4924 | * @return none. |
modtronix | 10:6444e6c798ce | 4925 | */ |
modtronix | 10:6444e6c798ce | 4926 | |
modtronix | 10:6444e6c798ce | 4927 | void arm_sin_cos_q31( |
modtronix | 10:6444e6c798ce | 4928 | q31_t theta, |
modtronix | 10:6444e6c798ce | 4929 | q31_t * pSinVal, |
modtronix | 10:6444e6c798ce | 4930 | q31_t * pCosVal); |
modtronix | 10:6444e6c798ce | 4931 | |
modtronix | 10:6444e6c798ce | 4932 | |
modtronix | 10:6444e6c798ce | 4933 | /** |
modtronix | 10:6444e6c798ce | 4934 | * @brief Floating-point complex conjugate. |
modtronix | 10:6444e6c798ce | 4935 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 4936 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 4937 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 4938 | * @return none. |
modtronix | 10:6444e6c798ce | 4939 | */ |
modtronix | 10:6444e6c798ce | 4940 | |
modtronix | 10:6444e6c798ce | 4941 | void arm_cmplx_conj_f32( |
modtronix | 10:6444e6c798ce | 4942 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4943 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 4944 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 4945 | |
modtronix | 10:6444e6c798ce | 4946 | /** |
modtronix | 10:6444e6c798ce | 4947 | * @brief Q31 complex conjugate. |
modtronix | 10:6444e6c798ce | 4948 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 4949 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 4950 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 4951 | * @return none. |
modtronix | 10:6444e6c798ce | 4952 | */ |
modtronix | 10:6444e6c798ce | 4953 | |
modtronix | 10:6444e6c798ce | 4954 | void arm_cmplx_conj_q31( |
modtronix | 10:6444e6c798ce | 4955 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4956 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 4957 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 4958 | |
modtronix | 10:6444e6c798ce | 4959 | /** |
modtronix | 10:6444e6c798ce | 4960 | * @brief Q15 complex conjugate. |
modtronix | 10:6444e6c798ce | 4961 | * @param[in] *pSrc points to the input vector |
modtronix | 10:6444e6c798ce | 4962 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 4963 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 4964 | * @return none. |
modtronix | 10:6444e6c798ce | 4965 | */ |
modtronix | 10:6444e6c798ce | 4966 | |
modtronix | 10:6444e6c798ce | 4967 | void arm_cmplx_conj_q15( |
modtronix | 10:6444e6c798ce | 4968 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 4969 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 4970 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 4971 | |
modtronix | 10:6444e6c798ce | 4972 | |
modtronix | 10:6444e6c798ce | 4973 | |
modtronix | 10:6444e6c798ce | 4974 | /** |
modtronix | 10:6444e6c798ce | 4975 | * @brief Floating-point complex magnitude squared |
modtronix | 10:6444e6c798ce | 4976 | * @param[in] *pSrc points to the complex input vector |
modtronix | 10:6444e6c798ce | 4977 | * @param[out] *pDst points to the real output vector |
modtronix | 10:6444e6c798ce | 4978 | * @param[in] numSamples number of complex samples in the input vector |
modtronix | 10:6444e6c798ce | 4979 | * @return none. |
modtronix | 10:6444e6c798ce | 4980 | */ |
modtronix | 10:6444e6c798ce | 4981 | |
modtronix | 10:6444e6c798ce | 4982 | void arm_cmplx_mag_squared_f32( |
modtronix | 10:6444e6c798ce | 4983 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 4984 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 4985 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 4986 | |
modtronix | 10:6444e6c798ce | 4987 | /** |
modtronix | 10:6444e6c798ce | 4988 | * @brief Q31 complex magnitude squared |
modtronix | 10:6444e6c798ce | 4989 | * @param[in] *pSrc points to the complex input vector |
modtronix | 10:6444e6c798ce | 4990 | * @param[out] *pDst points to the real output vector |
modtronix | 10:6444e6c798ce | 4991 | * @param[in] numSamples number of complex samples in the input vector |
modtronix | 10:6444e6c798ce | 4992 | * @return none. |
modtronix | 10:6444e6c798ce | 4993 | */ |
modtronix | 10:6444e6c798ce | 4994 | |
modtronix | 10:6444e6c798ce | 4995 | void arm_cmplx_mag_squared_q31( |
modtronix | 10:6444e6c798ce | 4996 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 4997 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 4998 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 4999 | |
modtronix | 10:6444e6c798ce | 5000 | /** |
modtronix | 10:6444e6c798ce | 5001 | * @brief Q15 complex magnitude squared |
modtronix | 10:6444e6c798ce | 5002 | * @param[in] *pSrc points to the complex input vector |
modtronix | 10:6444e6c798ce | 5003 | * @param[out] *pDst points to the real output vector |
modtronix | 10:6444e6c798ce | 5004 | * @param[in] numSamples number of complex samples in the input vector |
modtronix | 10:6444e6c798ce | 5005 | * @return none. |
modtronix | 10:6444e6c798ce | 5006 | */ |
modtronix | 10:6444e6c798ce | 5007 | |
modtronix | 10:6444e6c798ce | 5008 | void arm_cmplx_mag_squared_q15( |
modtronix | 10:6444e6c798ce | 5009 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 5010 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 5011 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 5012 | |
modtronix | 10:6444e6c798ce | 5013 | |
modtronix | 10:6444e6c798ce | 5014 | /** |
modtronix | 10:6444e6c798ce | 5015 | * @ingroup groupController |
modtronix | 10:6444e6c798ce | 5016 | */ |
modtronix | 10:6444e6c798ce | 5017 | |
modtronix | 10:6444e6c798ce | 5018 | /** |
modtronix | 10:6444e6c798ce | 5019 | * @defgroup PID PID Motor Control |
modtronix | 10:6444e6c798ce | 5020 | * |
modtronix | 10:6444e6c798ce | 5021 | * A Proportional Integral Derivative (PID) controller is a generic feedback control |
modtronix | 10:6444e6c798ce | 5022 | * loop mechanism widely used in industrial control systems. |
modtronix | 10:6444e6c798ce | 5023 | * A PID controller is the most commonly used type of feedback controller. |
modtronix | 10:6444e6c798ce | 5024 | * |
modtronix | 10:6444e6c798ce | 5025 | * This set of functions implements (PID) controllers |
modtronix | 10:6444e6c798ce | 5026 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample |
modtronix | 10:6444e6c798ce | 5027 | * of data and each call to the function returns a single processed value. |
modtronix | 10:6444e6c798ce | 5028 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code> |
modtronix | 10:6444e6c798ce | 5029 | * is the input sample value. The functions return the output value. |
modtronix | 10:6444e6c798ce | 5030 | * |
modtronix | 10:6444e6c798ce | 5031 | * \par Algorithm: |
modtronix | 10:6444e6c798ce | 5032 | * <pre> |
modtronix | 10:6444e6c798ce | 5033 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] |
modtronix | 10:6444e6c798ce | 5034 | * A0 = Kp + Ki + Kd |
modtronix | 10:6444e6c798ce | 5035 | * A1 = (-Kp ) - (2 * Kd ) |
modtronix | 10:6444e6c798ce | 5036 | * A2 = Kd </pre> |
modtronix | 10:6444e6c798ce | 5037 | * |
modtronix | 10:6444e6c798ce | 5038 | * \par |
modtronix | 10:6444e6c798ce | 5039 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant |
modtronix | 10:6444e6c798ce | 5040 | * |
modtronix | 10:6444e6c798ce | 5041 | * \par |
modtronix | 10:6444e6c798ce | 5042 | * \image html PID.gif "Proportional Integral Derivative Controller" |
modtronix | 10:6444e6c798ce | 5043 | * |
modtronix | 10:6444e6c798ce | 5044 | * \par |
modtronix | 10:6444e6c798ce | 5045 | * The PID controller calculates an "error" value as the difference between |
modtronix | 10:6444e6c798ce | 5046 | * the measured output and the reference input. |
modtronix | 10:6444e6c798ce | 5047 | * The controller attempts to minimize the error by adjusting the process control inputs. |
modtronix | 10:6444e6c798ce | 5048 | * The proportional value determines the reaction to the current error, |
modtronix | 10:6444e6c798ce | 5049 | * the integral value determines the reaction based on the sum of recent errors, |
modtronix | 10:6444e6c798ce | 5050 | * and the derivative value determines the reaction based on the rate at which the error has been changing. |
modtronix | 10:6444e6c798ce | 5051 | * |
modtronix | 10:6444e6c798ce | 5052 | * \par Instance Structure |
modtronix | 10:6444e6c798ce | 5053 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. |
modtronix | 10:6444e6c798ce | 5054 | * A separate instance structure must be defined for each PID Controller. |
modtronix | 10:6444e6c798ce | 5055 | * There are separate instance structure declarations for each of the 3 supported data types. |
modtronix | 10:6444e6c798ce | 5056 | * |
modtronix | 10:6444e6c798ce | 5057 | * \par Reset Functions |
modtronix | 10:6444e6c798ce | 5058 | * There is also an associated reset function for each data type which clears the state array. |
modtronix | 10:6444e6c798ce | 5059 | * |
modtronix | 10:6444e6c798ce | 5060 | * \par Initialization Functions |
modtronix | 10:6444e6c798ce | 5061 | * There is also an associated initialization function for each data type. |
modtronix | 10:6444e6c798ce | 5062 | * The initialization function performs the following operations: |
modtronix | 10:6444e6c798ce | 5063 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. |
modtronix | 10:6444e6c798ce | 5064 | * - Zeros out the values in the state buffer. |
modtronix | 10:6444e6c798ce | 5065 | * |
modtronix | 10:6444e6c798ce | 5066 | * \par |
modtronix | 10:6444e6c798ce | 5067 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. |
modtronix | 10:6444e6c798ce | 5068 | * |
modtronix | 10:6444e6c798ce | 5069 | * \par Fixed-Point Behavior |
modtronix | 10:6444e6c798ce | 5070 | * Care must be taken when using the fixed-point versions of the PID Controller functions. |
modtronix | 10:6444e6c798ce | 5071 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. |
modtronix | 10:6444e6c798ce | 5072 | * Refer to the function specific documentation below for usage guidelines. |
modtronix | 10:6444e6c798ce | 5073 | */ |
modtronix | 10:6444e6c798ce | 5074 | |
modtronix | 10:6444e6c798ce | 5075 | /** |
modtronix | 10:6444e6c798ce | 5076 | * @addtogroup PID |
modtronix | 10:6444e6c798ce | 5077 | * @{ |
modtronix | 10:6444e6c798ce | 5078 | */ |
modtronix | 10:6444e6c798ce | 5079 | |
modtronix | 10:6444e6c798ce | 5080 | /** |
modtronix | 10:6444e6c798ce | 5081 | * @brief Process function for the floating-point PID Control. |
modtronix | 10:6444e6c798ce | 5082 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
modtronix | 10:6444e6c798ce | 5083 | * @param[in] in input sample to process |
modtronix | 10:6444e6c798ce | 5084 | * @return out processed output sample. |
modtronix | 10:6444e6c798ce | 5085 | */ |
modtronix | 10:6444e6c798ce | 5086 | |
modtronix | 10:6444e6c798ce | 5087 | |
modtronix | 10:6444e6c798ce | 5088 | static __INLINE float32_t arm_pid_f32( |
modtronix | 10:6444e6c798ce | 5089 | arm_pid_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 5090 | float32_t in) |
modtronix | 10:6444e6c798ce | 5091 | { |
modtronix | 10:6444e6c798ce | 5092 | float32_t out; |
modtronix | 10:6444e6c798ce | 5093 | |
modtronix | 10:6444e6c798ce | 5094 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ |
modtronix | 10:6444e6c798ce | 5095 | out = (S->A0 * in) + |
modtronix | 10:6444e6c798ce | 5096 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); |
modtronix | 10:6444e6c798ce | 5097 | |
modtronix | 10:6444e6c798ce | 5098 | /* Update state */ |
modtronix | 10:6444e6c798ce | 5099 | S->state[1] = S->state[0]; |
modtronix | 10:6444e6c798ce | 5100 | S->state[0] = in; |
modtronix | 10:6444e6c798ce | 5101 | S->state[2] = out; |
modtronix | 10:6444e6c798ce | 5102 | |
modtronix | 10:6444e6c798ce | 5103 | /* return to application */ |
modtronix | 10:6444e6c798ce | 5104 | return (out); |
modtronix | 10:6444e6c798ce | 5105 | |
modtronix | 10:6444e6c798ce | 5106 | } |
modtronix | 10:6444e6c798ce | 5107 | |
modtronix | 10:6444e6c798ce | 5108 | /** |
modtronix | 10:6444e6c798ce | 5109 | * @brief Process function for the Q31 PID Control. |
modtronix | 10:6444e6c798ce | 5110 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
modtronix | 10:6444e6c798ce | 5111 | * @param[in] in input sample to process |
modtronix | 10:6444e6c798ce | 5112 | * @return out processed output sample. |
modtronix | 10:6444e6c798ce | 5113 | * |
modtronix | 10:6444e6c798ce | 5114 | * <b>Scaling and Overflow Behavior:</b> |
modtronix | 10:6444e6c798ce | 5115 | * \par |
modtronix | 10:6444e6c798ce | 5116 | * The function is implemented using an internal 64-bit accumulator. |
modtronix | 10:6444e6c798ce | 5117 | * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. |
modtronix | 10:6444e6c798ce | 5118 | * Thus, if the accumulator result overflows it wraps around rather than clip. |
modtronix | 10:6444e6c798ce | 5119 | * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. |
modtronix | 10:6444e6c798ce | 5120 | * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. |
modtronix | 10:6444e6c798ce | 5121 | */ |
modtronix | 10:6444e6c798ce | 5122 | |
modtronix | 10:6444e6c798ce | 5123 | static __INLINE q31_t arm_pid_q31( |
modtronix | 10:6444e6c798ce | 5124 | arm_pid_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 5125 | q31_t in) |
modtronix | 10:6444e6c798ce | 5126 | { |
modtronix | 10:6444e6c798ce | 5127 | q63_t acc; |
modtronix | 10:6444e6c798ce | 5128 | q31_t out; |
modtronix | 10:6444e6c798ce | 5129 | |
modtronix | 10:6444e6c798ce | 5130 | /* acc = A0 * x[n] */ |
modtronix | 10:6444e6c798ce | 5131 | acc = (q63_t) S->A0 * in; |
modtronix | 10:6444e6c798ce | 5132 | |
modtronix | 10:6444e6c798ce | 5133 | /* acc += A1 * x[n-1] */ |
modtronix | 10:6444e6c798ce | 5134 | acc += (q63_t) S->A1 * S->state[0]; |
modtronix | 10:6444e6c798ce | 5135 | |
modtronix | 10:6444e6c798ce | 5136 | /* acc += A2 * x[n-2] */ |
modtronix | 10:6444e6c798ce | 5137 | acc += (q63_t) S->A2 * S->state[1]; |
modtronix | 10:6444e6c798ce | 5138 | |
modtronix | 10:6444e6c798ce | 5139 | /* convert output to 1.31 format to add y[n-1] */ |
modtronix | 10:6444e6c798ce | 5140 | out = (q31_t) (acc >> 31u); |
modtronix | 10:6444e6c798ce | 5141 | |
modtronix | 10:6444e6c798ce | 5142 | /* out += y[n-1] */ |
modtronix | 10:6444e6c798ce | 5143 | out += S->state[2]; |
modtronix | 10:6444e6c798ce | 5144 | |
modtronix | 10:6444e6c798ce | 5145 | /* Update state */ |
modtronix | 10:6444e6c798ce | 5146 | S->state[1] = S->state[0]; |
modtronix | 10:6444e6c798ce | 5147 | S->state[0] = in; |
modtronix | 10:6444e6c798ce | 5148 | S->state[2] = out; |
modtronix | 10:6444e6c798ce | 5149 | |
modtronix | 10:6444e6c798ce | 5150 | /* return to application */ |
modtronix | 10:6444e6c798ce | 5151 | return (out); |
modtronix | 10:6444e6c798ce | 5152 | |
modtronix | 10:6444e6c798ce | 5153 | } |
modtronix | 10:6444e6c798ce | 5154 | |
modtronix | 10:6444e6c798ce | 5155 | /** |
modtronix | 10:6444e6c798ce | 5156 | * @brief Process function for the Q15 PID Control. |
modtronix | 10:6444e6c798ce | 5157 | * @param[in,out] *S points to an instance of the Q15 PID Control structure |
modtronix | 10:6444e6c798ce | 5158 | * @param[in] in input sample to process |
modtronix | 10:6444e6c798ce | 5159 | * @return out processed output sample. |
modtronix | 10:6444e6c798ce | 5160 | * |
modtronix | 10:6444e6c798ce | 5161 | * <b>Scaling and Overflow Behavior:</b> |
modtronix | 10:6444e6c798ce | 5162 | * \par |
modtronix | 10:6444e6c798ce | 5163 | * The function is implemented using a 64-bit internal accumulator. |
modtronix | 10:6444e6c798ce | 5164 | * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. |
modtronix | 10:6444e6c798ce | 5165 | * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. |
modtronix | 10:6444e6c798ce | 5166 | * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. |
modtronix | 10:6444e6c798ce | 5167 | * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. |
modtronix | 10:6444e6c798ce | 5168 | * Lastly, the accumulator is saturated to yield a result in 1.15 format. |
modtronix | 10:6444e6c798ce | 5169 | */ |
modtronix | 10:6444e6c798ce | 5170 | |
modtronix | 10:6444e6c798ce | 5171 | static __INLINE q15_t arm_pid_q15( |
modtronix | 10:6444e6c798ce | 5172 | arm_pid_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 5173 | q15_t in) |
modtronix | 10:6444e6c798ce | 5174 | { |
modtronix | 10:6444e6c798ce | 5175 | q63_t acc; |
modtronix | 10:6444e6c798ce | 5176 | q15_t out; |
modtronix | 10:6444e6c798ce | 5177 | |
modtronix | 10:6444e6c798ce | 5178 | #ifndef ARM_MATH_CM0_FAMILY |
modtronix | 10:6444e6c798ce | 5179 | __SIMD32_TYPE *vstate; |
modtronix | 10:6444e6c798ce | 5180 | |
modtronix | 10:6444e6c798ce | 5181 | /* Implementation of PID controller */ |
modtronix | 10:6444e6c798ce | 5182 | |
modtronix | 10:6444e6c798ce | 5183 | /* acc = A0 * x[n] */ |
modtronix | 10:6444e6c798ce | 5184 | acc = (q31_t) __SMUAD(S->A0, in); |
modtronix | 10:6444e6c798ce | 5185 | |
modtronix | 10:6444e6c798ce | 5186 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
modtronix | 10:6444e6c798ce | 5187 | vstate = __SIMD32_CONST(S->state); |
modtronix | 10:6444e6c798ce | 5188 | acc = __SMLALD(S->A1, (q31_t) *vstate, acc); |
modtronix | 10:6444e6c798ce | 5189 | |
modtronix | 10:6444e6c798ce | 5190 | #else |
modtronix | 10:6444e6c798ce | 5191 | /* acc = A0 * x[n] */ |
modtronix | 10:6444e6c798ce | 5192 | acc = ((q31_t) S->A0) * in; |
modtronix | 10:6444e6c798ce | 5193 | |
modtronix | 10:6444e6c798ce | 5194 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
modtronix | 10:6444e6c798ce | 5195 | acc += (q31_t) S->A1 * S->state[0]; |
modtronix | 10:6444e6c798ce | 5196 | acc += (q31_t) S->A2 * S->state[1]; |
modtronix | 10:6444e6c798ce | 5197 | |
modtronix | 10:6444e6c798ce | 5198 | #endif |
modtronix | 10:6444e6c798ce | 5199 | |
modtronix | 10:6444e6c798ce | 5200 | /* acc += y[n-1] */ |
modtronix | 10:6444e6c798ce | 5201 | acc += (q31_t) S->state[2] << 15; |
modtronix | 10:6444e6c798ce | 5202 | |
modtronix | 10:6444e6c798ce | 5203 | /* saturate the output */ |
modtronix | 10:6444e6c798ce | 5204 | out = (q15_t) (__SSAT((acc >> 15), 16)); |
modtronix | 10:6444e6c798ce | 5205 | |
modtronix | 10:6444e6c798ce | 5206 | /* Update state */ |
modtronix | 10:6444e6c798ce | 5207 | S->state[1] = S->state[0]; |
modtronix | 10:6444e6c798ce | 5208 | S->state[0] = in; |
modtronix | 10:6444e6c798ce | 5209 | S->state[2] = out; |
modtronix | 10:6444e6c798ce | 5210 | |
modtronix | 10:6444e6c798ce | 5211 | /* return to application */ |
modtronix | 10:6444e6c798ce | 5212 | return (out); |
modtronix | 10:6444e6c798ce | 5213 | |
modtronix | 10:6444e6c798ce | 5214 | } |
modtronix | 10:6444e6c798ce | 5215 | |
modtronix | 10:6444e6c798ce | 5216 | /** |
modtronix | 10:6444e6c798ce | 5217 | * @} end of PID group |
modtronix | 10:6444e6c798ce | 5218 | */ |
modtronix | 10:6444e6c798ce | 5219 | |
modtronix | 10:6444e6c798ce | 5220 | |
modtronix | 10:6444e6c798ce | 5221 | /** |
modtronix | 10:6444e6c798ce | 5222 | * @brief Floating-point matrix inverse. |
modtronix | 10:6444e6c798ce | 5223 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 5224 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 5225 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
modtronix | 10:6444e6c798ce | 5226 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
modtronix | 10:6444e6c798ce | 5227 | */ |
modtronix | 10:6444e6c798ce | 5228 | |
modtronix | 10:6444e6c798ce | 5229 | arm_status arm_mat_inverse_f32( |
modtronix | 10:6444e6c798ce | 5230 | const arm_matrix_instance_f32 * src, |
modtronix | 10:6444e6c798ce | 5231 | arm_matrix_instance_f32 * dst); |
modtronix | 10:6444e6c798ce | 5232 | |
modtronix | 10:6444e6c798ce | 5233 | |
modtronix | 10:6444e6c798ce | 5234 | /** |
modtronix | 10:6444e6c798ce | 5235 | * @brief Floating-point matrix inverse. |
modtronix | 10:6444e6c798ce | 5236 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 5237 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
modtronix | 10:6444e6c798ce | 5238 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
modtronix | 10:6444e6c798ce | 5239 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
modtronix | 10:6444e6c798ce | 5240 | */ |
modtronix | 10:6444e6c798ce | 5241 | |
modtronix | 10:6444e6c798ce | 5242 | arm_status arm_mat_inverse_f64( |
modtronix | 10:6444e6c798ce | 5243 | const arm_matrix_instance_f64 * src, |
modtronix | 10:6444e6c798ce | 5244 | arm_matrix_instance_f64 * dst); |
modtronix | 10:6444e6c798ce | 5245 | |
modtronix | 10:6444e6c798ce | 5246 | |
modtronix | 10:6444e6c798ce | 5247 | |
modtronix | 10:6444e6c798ce | 5248 | /** |
modtronix | 10:6444e6c798ce | 5249 | * @ingroup groupController |
modtronix | 10:6444e6c798ce | 5250 | */ |
modtronix | 10:6444e6c798ce | 5251 | |
modtronix | 10:6444e6c798ce | 5252 | |
modtronix | 10:6444e6c798ce | 5253 | /** |
modtronix | 10:6444e6c798ce | 5254 | * @defgroup clarke Vector Clarke Transform |
modtronix | 10:6444e6c798ce | 5255 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. |
modtronix | 10:6444e6c798ce | 5256 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents |
modtronix | 10:6444e6c798ce | 5257 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>. |
modtronix | 10:6444e6c798ce | 5258 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below |
modtronix | 10:6444e6c798ce | 5259 | * \image html clarke.gif Stator current space vector and its components in (a,b). |
modtronix | 10:6444e6c798ce | 5260 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code> |
modtronix | 10:6444e6c798ce | 5261 | * can be calculated using only <code>Ia</code> and <code>Ib</code>. |
modtronix | 10:6444e6c798ce | 5262 | * |
modtronix | 10:6444e6c798ce | 5263 | * The function operates on a single sample of data and each call to the function returns the processed output. |
modtronix | 10:6444e6c798ce | 5264 | * The library provides separate functions for Q31 and floating-point data types. |
modtronix | 10:6444e6c798ce | 5265 | * \par Algorithm |
modtronix | 10:6444e6c798ce | 5266 | * \image html clarkeFormula.gif |
modtronix | 10:6444e6c798ce | 5267 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and |
modtronix | 10:6444e6c798ce | 5268 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector. |
modtronix | 10:6444e6c798ce | 5269 | * \par Fixed-Point Behavior |
modtronix | 10:6444e6c798ce | 5270 | * Care must be taken when using the Q31 version of the Clarke transform. |
modtronix | 10:6444e6c798ce | 5271 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
modtronix | 10:6444e6c798ce | 5272 | * Refer to the function specific documentation below for usage guidelines. |
modtronix | 10:6444e6c798ce | 5273 | */ |
modtronix | 10:6444e6c798ce | 5274 | |
modtronix | 10:6444e6c798ce | 5275 | /** |
modtronix | 10:6444e6c798ce | 5276 | * @addtogroup clarke |
modtronix | 10:6444e6c798ce | 5277 | * @{ |
modtronix | 10:6444e6c798ce | 5278 | */ |
modtronix | 10:6444e6c798ce | 5279 | |
modtronix | 10:6444e6c798ce | 5280 | /** |
modtronix | 10:6444e6c798ce | 5281 | * |
modtronix | 10:6444e6c798ce | 5282 | * @brief Floating-point Clarke transform |
modtronix | 10:6444e6c798ce | 5283 | * @param[in] Ia input three-phase coordinate <code>a</code> |
modtronix | 10:6444e6c798ce | 5284 | * @param[in] Ib input three-phase coordinate <code>b</code> |
modtronix | 10:6444e6c798ce | 5285 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
modtronix | 10:6444e6c798ce | 5286 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
modtronix | 10:6444e6c798ce | 5287 | * @return none. |
modtronix | 10:6444e6c798ce | 5288 | */ |
modtronix | 10:6444e6c798ce | 5289 | |
modtronix | 10:6444e6c798ce | 5290 | static __INLINE void arm_clarke_f32( |
modtronix | 10:6444e6c798ce | 5291 | float32_t Ia, |
modtronix | 10:6444e6c798ce | 5292 | float32_t Ib, |
modtronix | 10:6444e6c798ce | 5293 | float32_t * pIalpha, |
modtronix | 10:6444e6c798ce | 5294 | float32_t * pIbeta) |
modtronix | 10:6444e6c798ce | 5295 | { |
modtronix | 10:6444e6c798ce | 5296 | /* Calculate pIalpha using the equation, pIalpha = Ia */ |
modtronix | 10:6444e6c798ce | 5297 | *pIalpha = Ia; |
modtronix | 10:6444e6c798ce | 5298 | |
modtronix | 10:6444e6c798ce | 5299 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ |
modtronix | 10:6444e6c798ce | 5300 | *pIbeta = |
modtronix | 10:6444e6c798ce | 5301 | ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); |
modtronix | 10:6444e6c798ce | 5302 | |
modtronix | 10:6444e6c798ce | 5303 | } |
modtronix | 10:6444e6c798ce | 5304 | |
modtronix | 10:6444e6c798ce | 5305 | /** |
modtronix | 10:6444e6c798ce | 5306 | * @brief Clarke transform for Q31 version |
modtronix | 10:6444e6c798ce | 5307 | * @param[in] Ia input three-phase coordinate <code>a</code> |
modtronix | 10:6444e6c798ce | 5308 | * @param[in] Ib input three-phase coordinate <code>b</code> |
modtronix | 10:6444e6c798ce | 5309 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
modtronix | 10:6444e6c798ce | 5310 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
modtronix | 10:6444e6c798ce | 5311 | * @return none. |
modtronix | 10:6444e6c798ce | 5312 | * |
modtronix | 10:6444e6c798ce | 5313 | * <b>Scaling and Overflow Behavior:</b> |
modtronix | 10:6444e6c798ce | 5314 | * \par |
modtronix | 10:6444e6c798ce | 5315 | * The function is implemented using an internal 32-bit accumulator. |
modtronix | 10:6444e6c798ce | 5316 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
modtronix | 10:6444e6c798ce | 5317 | * There is saturation on the addition, hence there is no risk of overflow. |
modtronix | 10:6444e6c798ce | 5318 | */ |
modtronix | 10:6444e6c798ce | 5319 | |
modtronix | 10:6444e6c798ce | 5320 | static __INLINE void arm_clarke_q31( |
modtronix | 10:6444e6c798ce | 5321 | q31_t Ia, |
modtronix | 10:6444e6c798ce | 5322 | q31_t Ib, |
modtronix | 10:6444e6c798ce | 5323 | q31_t * pIalpha, |
modtronix | 10:6444e6c798ce | 5324 | q31_t * pIbeta) |
modtronix | 10:6444e6c798ce | 5325 | { |
modtronix | 10:6444e6c798ce | 5326 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
modtronix | 10:6444e6c798ce | 5327 | |
modtronix | 10:6444e6c798ce | 5328 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */ |
modtronix | 10:6444e6c798ce | 5329 | *pIalpha = Ia; |
modtronix | 10:6444e6c798ce | 5330 | |
modtronix | 10:6444e6c798ce | 5331 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ |
modtronix | 10:6444e6c798ce | 5332 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); |
modtronix | 10:6444e6c798ce | 5333 | |
modtronix | 10:6444e6c798ce | 5334 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ |
modtronix | 10:6444e6c798ce | 5335 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); |
modtronix | 10:6444e6c798ce | 5336 | |
modtronix | 10:6444e6c798ce | 5337 | /* pIbeta is calculated by adding the intermediate products */ |
modtronix | 10:6444e6c798ce | 5338 | *pIbeta = __QADD(product1, product2); |
modtronix | 10:6444e6c798ce | 5339 | } |
modtronix | 10:6444e6c798ce | 5340 | |
modtronix | 10:6444e6c798ce | 5341 | /** |
modtronix | 10:6444e6c798ce | 5342 | * @} end of clarke group |
modtronix | 10:6444e6c798ce | 5343 | */ |
modtronix | 10:6444e6c798ce | 5344 | |
modtronix | 10:6444e6c798ce | 5345 | /** |
modtronix | 10:6444e6c798ce | 5346 | * @brief Converts the elements of the Q7 vector to Q31 vector. |
modtronix | 10:6444e6c798ce | 5347 | * @param[in] *pSrc input pointer |
modtronix | 10:6444e6c798ce | 5348 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 5349 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 5350 | * @return none. |
modtronix | 10:6444e6c798ce | 5351 | */ |
modtronix | 10:6444e6c798ce | 5352 | void arm_q7_to_q31( |
modtronix | 10:6444e6c798ce | 5353 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 5354 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 5355 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 5356 | |
modtronix | 10:6444e6c798ce | 5357 | |
modtronix | 10:6444e6c798ce | 5358 | |
modtronix | 10:6444e6c798ce | 5359 | |
modtronix | 10:6444e6c798ce | 5360 | /** |
modtronix | 10:6444e6c798ce | 5361 | * @ingroup groupController |
modtronix | 10:6444e6c798ce | 5362 | */ |
modtronix | 10:6444e6c798ce | 5363 | |
modtronix | 10:6444e6c798ce | 5364 | /** |
modtronix | 10:6444e6c798ce | 5365 | * @defgroup inv_clarke Vector Inverse Clarke Transform |
modtronix | 10:6444e6c798ce | 5366 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. |
modtronix | 10:6444e6c798ce | 5367 | * |
modtronix | 10:6444e6c798ce | 5368 | * The function operates on a single sample of data and each call to the function returns the processed output. |
modtronix | 10:6444e6c798ce | 5369 | * The library provides separate functions for Q31 and floating-point data types. |
modtronix | 10:6444e6c798ce | 5370 | * \par Algorithm |
modtronix | 10:6444e6c798ce | 5371 | * \image html clarkeInvFormula.gif |
modtronix | 10:6444e6c798ce | 5372 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and |
modtronix | 10:6444e6c798ce | 5373 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector. |
modtronix | 10:6444e6c798ce | 5374 | * \par Fixed-Point Behavior |
modtronix | 10:6444e6c798ce | 5375 | * Care must be taken when using the Q31 version of the Clarke transform. |
modtronix | 10:6444e6c798ce | 5376 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
modtronix | 10:6444e6c798ce | 5377 | * Refer to the function specific documentation below for usage guidelines. |
modtronix | 10:6444e6c798ce | 5378 | */ |
modtronix | 10:6444e6c798ce | 5379 | |
modtronix | 10:6444e6c798ce | 5380 | /** |
modtronix | 10:6444e6c798ce | 5381 | * @addtogroup inv_clarke |
modtronix | 10:6444e6c798ce | 5382 | * @{ |
modtronix | 10:6444e6c798ce | 5383 | */ |
modtronix | 10:6444e6c798ce | 5384 | |
modtronix | 10:6444e6c798ce | 5385 | /** |
modtronix | 10:6444e6c798ce | 5386 | * @brief Floating-point Inverse Clarke transform |
modtronix | 10:6444e6c798ce | 5387 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
modtronix | 10:6444e6c798ce | 5388 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
modtronix | 10:6444e6c798ce | 5389 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
modtronix | 10:6444e6c798ce | 5390 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
modtronix | 10:6444e6c798ce | 5391 | * @return none. |
modtronix | 10:6444e6c798ce | 5392 | */ |
modtronix | 10:6444e6c798ce | 5393 | |
modtronix | 10:6444e6c798ce | 5394 | |
modtronix | 10:6444e6c798ce | 5395 | static __INLINE void arm_inv_clarke_f32( |
modtronix | 10:6444e6c798ce | 5396 | float32_t Ialpha, |
modtronix | 10:6444e6c798ce | 5397 | float32_t Ibeta, |
modtronix | 10:6444e6c798ce | 5398 | float32_t * pIa, |
modtronix | 10:6444e6c798ce | 5399 | float32_t * pIb) |
modtronix | 10:6444e6c798ce | 5400 | { |
modtronix | 10:6444e6c798ce | 5401 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
modtronix | 10:6444e6c798ce | 5402 | *pIa = Ialpha; |
modtronix | 10:6444e6c798ce | 5403 | |
modtronix | 10:6444e6c798ce | 5404 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ |
modtronix | 10:6444e6c798ce | 5405 | *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta; |
modtronix | 10:6444e6c798ce | 5406 | |
modtronix | 10:6444e6c798ce | 5407 | } |
modtronix | 10:6444e6c798ce | 5408 | |
modtronix | 10:6444e6c798ce | 5409 | /** |
modtronix | 10:6444e6c798ce | 5410 | * @brief Inverse Clarke transform for Q31 version |
modtronix | 10:6444e6c798ce | 5411 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
modtronix | 10:6444e6c798ce | 5412 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
modtronix | 10:6444e6c798ce | 5413 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
modtronix | 10:6444e6c798ce | 5414 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
modtronix | 10:6444e6c798ce | 5415 | * @return none. |
modtronix | 10:6444e6c798ce | 5416 | * |
modtronix | 10:6444e6c798ce | 5417 | * <b>Scaling and Overflow Behavior:</b> |
modtronix | 10:6444e6c798ce | 5418 | * \par |
modtronix | 10:6444e6c798ce | 5419 | * The function is implemented using an internal 32-bit accumulator. |
modtronix | 10:6444e6c798ce | 5420 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
modtronix | 10:6444e6c798ce | 5421 | * There is saturation on the subtraction, hence there is no risk of overflow. |
modtronix | 10:6444e6c798ce | 5422 | */ |
modtronix | 10:6444e6c798ce | 5423 | |
modtronix | 10:6444e6c798ce | 5424 | static __INLINE void arm_inv_clarke_q31( |
modtronix | 10:6444e6c798ce | 5425 | q31_t Ialpha, |
modtronix | 10:6444e6c798ce | 5426 | q31_t Ibeta, |
modtronix | 10:6444e6c798ce | 5427 | q31_t * pIa, |
modtronix | 10:6444e6c798ce | 5428 | q31_t * pIb) |
modtronix | 10:6444e6c798ce | 5429 | { |
modtronix | 10:6444e6c798ce | 5430 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
modtronix | 10:6444e6c798ce | 5431 | |
modtronix | 10:6444e6c798ce | 5432 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
modtronix | 10:6444e6c798ce | 5433 | *pIa = Ialpha; |
modtronix | 10:6444e6c798ce | 5434 | |
modtronix | 10:6444e6c798ce | 5435 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ |
modtronix | 10:6444e6c798ce | 5436 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); |
modtronix | 10:6444e6c798ce | 5437 | |
modtronix | 10:6444e6c798ce | 5438 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ |
modtronix | 10:6444e6c798ce | 5439 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); |
modtronix | 10:6444e6c798ce | 5440 | |
modtronix | 10:6444e6c798ce | 5441 | /* pIb is calculated by subtracting the products */ |
modtronix | 10:6444e6c798ce | 5442 | *pIb = __QSUB(product2, product1); |
modtronix | 10:6444e6c798ce | 5443 | |
modtronix | 10:6444e6c798ce | 5444 | } |
modtronix | 10:6444e6c798ce | 5445 | |
modtronix | 10:6444e6c798ce | 5446 | /** |
modtronix | 10:6444e6c798ce | 5447 | * @} end of inv_clarke group |
modtronix | 10:6444e6c798ce | 5448 | */ |
modtronix | 10:6444e6c798ce | 5449 | |
modtronix | 10:6444e6c798ce | 5450 | /** |
modtronix | 10:6444e6c798ce | 5451 | * @brief Converts the elements of the Q7 vector to Q15 vector. |
modtronix | 10:6444e6c798ce | 5452 | * @param[in] *pSrc input pointer |
modtronix | 10:6444e6c798ce | 5453 | * @param[out] *pDst output pointer |
modtronix | 10:6444e6c798ce | 5454 | * @param[in] blockSize number of samples to process |
modtronix | 10:6444e6c798ce | 5455 | * @return none. |
modtronix | 10:6444e6c798ce | 5456 | */ |
modtronix | 10:6444e6c798ce | 5457 | void arm_q7_to_q15( |
modtronix | 10:6444e6c798ce | 5458 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 5459 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 5460 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 5461 | |
modtronix | 10:6444e6c798ce | 5462 | |
modtronix | 10:6444e6c798ce | 5463 | |
modtronix | 10:6444e6c798ce | 5464 | /** |
modtronix | 10:6444e6c798ce | 5465 | * @ingroup groupController |
modtronix | 10:6444e6c798ce | 5466 | */ |
modtronix | 10:6444e6c798ce | 5467 | |
modtronix | 10:6444e6c798ce | 5468 | /** |
modtronix | 10:6444e6c798ce | 5469 | * @defgroup park Vector Park Transform |
modtronix | 10:6444e6c798ce | 5470 | * |
modtronix | 10:6444e6c798ce | 5471 | * Forward Park transform converts the input two-coordinate vector to flux and torque components. |
modtronix | 10:6444e6c798ce | 5472 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents |
modtronix | 10:6444e6c798ce | 5473 | * from the stationary to the moving reference frame and control the spatial relationship between |
modtronix | 10:6444e6c798ce | 5474 | * the stator vector current and rotor flux vector. |
modtronix | 10:6444e6c798ce | 5475 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the |
modtronix | 10:6444e6c798ce | 5476 | * current vector and the relationship from the two reference frames: |
modtronix | 10:6444e6c798ce | 5477 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" |
modtronix | 10:6444e6c798ce | 5478 | * |
modtronix | 10:6444e6c798ce | 5479 | * The function operates on a single sample of data and each call to the function returns the processed output. |
modtronix | 10:6444e6c798ce | 5480 | * The library provides separate functions for Q31 and floating-point data types. |
modtronix | 10:6444e6c798ce | 5481 | * \par Algorithm |
modtronix | 10:6444e6c798ce | 5482 | * \image html parkFormula.gif |
modtronix | 10:6444e6c798ce | 5483 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components, |
modtronix | 10:6444e6c798ce | 5484 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
modtronix | 10:6444e6c798ce | 5485 | * cosine and sine values of theta (rotor flux position). |
modtronix | 10:6444e6c798ce | 5486 | * \par Fixed-Point Behavior |
modtronix | 10:6444e6c798ce | 5487 | * Care must be taken when using the Q31 version of the Park transform. |
modtronix | 10:6444e6c798ce | 5488 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
modtronix | 10:6444e6c798ce | 5489 | * Refer to the function specific documentation below for usage guidelines. |
modtronix | 10:6444e6c798ce | 5490 | */ |
modtronix | 10:6444e6c798ce | 5491 | |
modtronix | 10:6444e6c798ce | 5492 | /** |
modtronix | 10:6444e6c798ce | 5493 | * @addtogroup park |
modtronix | 10:6444e6c798ce | 5494 | * @{ |
modtronix | 10:6444e6c798ce | 5495 | */ |
modtronix | 10:6444e6c798ce | 5496 | |
modtronix | 10:6444e6c798ce | 5497 | /** |
modtronix | 10:6444e6c798ce | 5498 | * @brief Floating-point Park transform |
modtronix | 10:6444e6c798ce | 5499 | * @param[in] Ialpha input two-phase vector coordinate alpha |
modtronix | 10:6444e6c798ce | 5500 | * @param[in] Ibeta input two-phase vector coordinate beta |
modtronix | 10:6444e6c798ce | 5501 | * @param[out] *pId points to output rotor reference frame d |
modtronix | 10:6444e6c798ce | 5502 | * @param[out] *pIq points to output rotor reference frame q |
modtronix | 10:6444e6c798ce | 5503 | * @param[in] sinVal sine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5504 | * @param[in] cosVal cosine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5505 | * @return none. |
modtronix | 10:6444e6c798ce | 5506 | * |
modtronix | 10:6444e6c798ce | 5507 | * The function implements the forward Park transform. |
modtronix | 10:6444e6c798ce | 5508 | * |
modtronix | 10:6444e6c798ce | 5509 | */ |
modtronix | 10:6444e6c798ce | 5510 | |
modtronix | 10:6444e6c798ce | 5511 | static __INLINE void arm_park_f32( |
modtronix | 10:6444e6c798ce | 5512 | float32_t Ialpha, |
modtronix | 10:6444e6c798ce | 5513 | float32_t Ibeta, |
modtronix | 10:6444e6c798ce | 5514 | float32_t * pId, |
modtronix | 10:6444e6c798ce | 5515 | float32_t * pIq, |
modtronix | 10:6444e6c798ce | 5516 | float32_t sinVal, |
modtronix | 10:6444e6c798ce | 5517 | float32_t cosVal) |
modtronix | 10:6444e6c798ce | 5518 | { |
modtronix | 10:6444e6c798ce | 5519 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ |
modtronix | 10:6444e6c798ce | 5520 | *pId = Ialpha * cosVal + Ibeta * sinVal; |
modtronix | 10:6444e6c798ce | 5521 | |
modtronix | 10:6444e6c798ce | 5522 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ |
modtronix | 10:6444e6c798ce | 5523 | *pIq = -Ialpha * sinVal + Ibeta * cosVal; |
modtronix | 10:6444e6c798ce | 5524 | |
modtronix | 10:6444e6c798ce | 5525 | } |
modtronix | 10:6444e6c798ce | 5526 | |
modtronix | 10:6444e6c798ce | 5527 | /** |
modtronix | 10:6444e6c798ce | 5528 | * @brief Park transform for Q31 version |
modtronix | 10:6444e6c798ce | 5529 | * @param[in] Ialpha input two-phase vector coordinate alpha |
modtronix | 10:6444e6c798ce | 5530 | * @param[in] Ibeta input two-phase vector coordinate beta |
modtronix | 10:6444e6c798ce | 5531 | * @param[out] *pId points to output rotor reference frame d |
modtronix | 10:6444e6c798ce | 5532 | * @param[out] *pIq points to output rotor reference frame q |
modtronix | 10:6444e6c798ce | 5533 | * @param[in] sinVal sine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5534 | * @param[in] cosVal cosine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5535 | * @return none. |
modtronix | 10:6444e6c798ce | 5536 | * |
modtronix | 10:6444e6c798ce | 5537 | * <b>Scaling and Overflow Behavior:</b> |
modtronix | 10:6444e6c798ce | 5538 | * \par |
modtronix | 10:6444e6c798ce | 5539 | * The function is implemented using an internal 32-bit accumulator. |
modtronix | 10:6444e6c798ce | 5540 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
modtronix | 10:6444e6c798ce | 5541 | * There is saturation on the addition and subtraction, hence there is no risk of overflow. |
modtronix | 10:6444e6c798ce | 5542 | */ |
modtronix | 10:6444e6c798ce | 5543 | |
modtronix | 10:6444e6c798ce | 5544 | |
modtronix | 10:6444e6c798ce | 5545 | static __INLINE void arm_park_q31( |
modtronix | 10:6444e6c798ce | 5546 | q31_t Ialpha, |
modtronix | 10:6444e6c798ce | 5547 | q31_t Ibeta, |
modtronix | 10:6444e6c798ce | 5548 | q31_t * pId, |
modtronix | 10:6444e6c798ce | 5549 | q31_t * pIq, |
modtronix | 10:6444e6c798ce | 5550 | q31_t sinVal, |
modtronix | 10:6444e6c798ce | 5551 | q31_t cosVal) |
modtronix | 10:6444e6c798ce | 5552 | { |
modtronix | 10:6444e6c798ce | 5553 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
modtronix | 10:6444e6c798ce | 5554 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
modtronix | 10:6444e6c798ce | 5555 | |
modtronix | 10:6444e6c798ce | 5556 | /* Intermediate product is calculated by (Ialpha * cosVal) */ |
modtronix | 10:6444e6c798ce | 5557 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5558 | |
modtronix | 10:6444e6c798ce | 5559 | /* Intermediate product is calculated by (Ibeta * sinVal) */ |
modtronix | 10:6444e6c798ce | 5560 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5561 | |
modtronix | 10:6444e6c798ce | 5562 | |
modtronix | 10:6444e6c798ce | 5563 | /* Intermediate product is calculated by (Ialpha * sinVal) */ |
modtronix | 10:6444e6c798ce | 5564 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5565 | |
modtronix | 10:6444e6c798ce | 5566 | /* Intermediate product is calculated by (Ibeta * cosVal) */ |
modtronix | 10:6444e6c798ce | 5567 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5568 | |
modtronix | 10:6444e6c798ce | 5569 | /* Calculate pId by adding the two intermediate products 1 and 2 */ |
modtronix | 10:6444e6c798ce | 5570 | *pId = __QADD(product1, product2); |
modtronix | 10:6444e6c798ce | 5571 | |
modtronix | 10:6444e6c798ce | 5572 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ |
modtronix | 10:6444e6c798ce | 5573 | *pIq = __QSUB(product4, product3); |
modtronix | 10:6444e6c798ce | 5574 | } |
modtronix | 10:6444e6c798ce | 5575 | |
modtronix | 10:6444e6c798ce | 5576 | /** |
modtronix | 10:6444e6c798ce | 5577 | * @} end of park group |
modtronix | 10:6444e6c798ce | 5578 | */ |
modtronix | 10:6444e6c798ce | 5579 | |
modtronix | 10:6444e6c798ce | 5580 | /** |
modtronix | 10:6444e6c798ce | 5581 | * @brief Converts the elements of the Q7 vector to floating-point vector. |
modtronix | 10:6444e6c798ce | 5582 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 5583 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 5584 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 5585 | * @return none. |
modtronix | 10:6444e6c798ce | 5586 | */ |
modtronix | 10:6444e6c798ce | 5587 | void arm_q7_to_float( |
modtronix | 10:6444e6c798ce | 5588 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 5589 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 5590 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 5591 | |
modtronix | 10:6444e6c798ce | 5592 | |
modtronix | 10:6444e6c798ce | 5593 | /** |
modtronix | 10:6444e6c798ce | 5594 | * @ingroup groupController |
modtronix | 10:6444e6c798ce | 5595 | */ |
modtronix | 10:6444e6c798ce | 5596 | |
modtronix | 10:6444e6c798ce | 5597 | /** |
modtronix | 10:6444e6c798ce | 5598 | * @defgroup inv_park Vector Inverse Park transform |
modtronix | 10:6444e6c798ce | 5599 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector. |
modtronix | 10:6444e6c798ce | 5600 | * |
modtronix | 10:6444e6c798ce | 5601 | * The function operates on a single sample of data and each call to the function returns the processed output. |
modtronix | 10:6444e6c798ce | 5602 | * The library provides separate functions for Q31 and floating-point data types. |
modtronix | 10:6444e6c798ce | 5603 | * \par Algorithm |
modtronix | 10:6444e6c798ce | 5604 | * \image html parkInvFormula.gif |
modtronix | 10:6444e6c798ce | 5605 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components, |
modtronix | 10:6444e6c798ce | 5606 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
modtronix | 10:6444e6c798ce | 5607 | * cosine and sine values of theta (rotor flux position). |
modtronix | 10:6444e6c798ce | 5608 | * \par Fixed-Point Behavior |
modtronix | 10:6444e6c798ce | 5609 | * Care must be taken when using the Q31 version of the Park transform. |
modtronix | 10:6444e6c798ce | 5610 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
modtronix | 10:6444e6c798ce | 5611 | * Refer to the function specific documentation below for usage guidelines. |
modtronix | 10:6444e6c798ce | 5612 | */ |
modtronix | 10:6444e6c798ce | 5613 | |
modtronix | 10:6444e6c798ce | 5614 | /** |
modtronix | 10:6444e6c798ce | 5615 | * @addtogroup inv_park |
modtronix | 10:6444e6c798ce | 5616 | * @{ |
modtronix | 10:6444e6c798ce | 5617 | */ |
modtronix | 10:6444e6c798ce | 5618 | |
modtronix | 10:6444e6c798ce | 5619 | /** |
modtronix | 10:6444e6c798ce | 5620 | * @brief Floating-point Inverse Park transform |
modtronix | 10:6444e6c798ce | 5621 | * @param[in] Id input coordinate of rotor reference frame d |
modtronix | 10:6444e6c798ce | 5622 | * @param[in] Iq input coordinate of rotor reference frame q |
modtronix | 10:6444e6c798ce | 5623 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
modtronix | 10:6444e6c798ce | 5624 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
modtronix | 10:6444e6c798ce | 5625 | * @param[in] sinVal sine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5626 | * @param[in] cosVal cosine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5627 | * @return none. |
modtronix | 10:6444e6c798ce | 5628 | */ |
modtronix | 10:6444e6c798ce | 5629 | |
modtronix | 10:6444e6c798ce | 5630 | static __INLINE void arm_inv_park_f32( |
modtronix | 10:6444e6c798ce | 5631 | float32_t Id, |
modtronix | 10:6444e6c798ce | 5632 | float32_t Iq, |
modtronix | 10:6444e6c798ce | 5633 | float32_t * pIalpha, |
modtronix | 10:6444e6c798ce | 5634 | float32_t * pIbeta, |
modtronix | 10:6444e6c798ce | 5635 | float32_t sinVal, |
modtronix | 10:6444e6c798ce | 5636 | float32_t cosVal) |
modtronix | 10:6444e6c798ce | 5637 | { |
modtronix | 10:6444e6c798ce | 5638 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ |
modtronix | 10:6444e6c798ce | 5639 | *pIalpha = Id * cosVal - Iq * sinVal; |
modtronix | 10:6444e6c798ce | 5640 | |
modtronix | 10:6444e6c798ce | 5641 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ |
modtronix | 10:6444e6c798ce | 5642 | *pIbeta = Id * sinVal + Iq * cosVal; |
modtronix | 10:6444e6c798ce | 5643 | |
modtronix | 10:6444e6c798ce | 5644 | } |
modtronix | 10:6444e6c798ce | 5645 | |
modtronix | 10:6444e6c798ce | 5646 | |
modtronix | 10:6444e6c798ce | 5647 | /** |
modtronix | 10:6444e6c798ce | 5648 | * @brief Inverse Park transform for Q31 version |
modtronix | 10:6444e6c798ce | 5649 | * @param[in] Id input coordinate of rotor reference frame d |
modtronix | 10:6444e6c798ce | 5650 | * @param[in] Iq input coordinate of rotor reference frame q |
modtronix | 10:6444e6c798ce | 5651 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
modtronix | 10:6444e6c798ce | 5652 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
modtronix | 10:6444e6c798ce | 5653 | * @param[in] sinVal sine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5654 | * @param[in] cosVal cosine value of rotation angle theta |
modtronix | 10:6444e6c798ce | 5655 | * @return none. |
modtronix | 10:6444e6c798ce | 5656 | * |
modtronix | 10:6444e6c798ce | 5657 | * <b>Scaling and Overflow Behavior:</b> |
modtronix | 10:6444e6c798ce | 5658 | * \par |
modtronix | 10:6444e6c798ce | 5659 | * The function is implemented using an internal 32-bit accumulator. |
modtronix | 10:6444e6c798ce | 5660 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
modtronix | 10:6444e6c798ce | 5661 | * There is saturation on the addition, hence there is no risk of overflow. |
modtronix | 10:6444e6c798ce | 5662 | */ |
modtronix | 10:6444e6c798ce | 5663 | |
modtronix | 10:6444e6c798ce | 5664 | |
modtronix | 10:6444e6c798ce | 5665 | static __INLINE void arm_inv_park_q31( |
modtronix | 10:6444e6c798ce | 5666 | q31_t Id, |
modtronix | 10:6444e6c798ce | 5667 | q31_t Iq, |
modtronix | 10:6444e6c798ce | 5668 | q31_t * pIalpha, |
modtronix | 10:6444e6c798ce | 5669 | q31_t * pIbeta, |
modtronix | 10:6444e6c798ce | 5670 | q31_t sinVal, |
modtronix | 10:6444e6c798ce | 5671 | q31_t cosVal) |
modtronix | 10:6444e6c798ce | 5672 | { |
modtronix | 10:6444e6c798ce | 5673 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
modtronix | 10:6444e6c798ce | 5674 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
modtronix | 10:6444e6c798ce | 5675 | |
modtronix | 10:6444e6c798ce | 5676 | /* Intermediate product is calculated by (Id * cosVal) */ |
modtronix | 10:6444e6c798ce | 5677 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5678 | |
modtronix | 10:6444e6c798ce | 5679 | /* Intermediate product is calculated by (Iq * sinVal) */ |
modtronix | 10:6444e6c798ce | 5680 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5681 | |
modtronix | 10:6444e6c798ce | 5682 | |
modtronix | 10:6444e6c798ce | 5683 | /* Intermediate product is calculated by (Id * sinVal) */ |
modtronix | 10:6444e6c798ce | 5684 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5685 | |
modtronix | 10:6444e6c798ce | 5686 | /* Intermediate product is calculated by (Iq * cosVal) */ |
modtronix | 10:6444e6c798ce | 5687 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); |
modtronix | 10:6444e6c798ce | 5688 | |
modtronix | 10:6444e6c798ce | 5689 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */ |
modtronix | 10:6444e6c798ce | 5690 | *pIalpha = __QSUB(product1, product2); |
modtronix | 10:6444e6c798ce | 5691 | |
modtronix | 10:6444e6c798ce | 5692 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */ |
modtronix | 10:6444e6c798ce | 5693 | *pIbeta = __QADD(product4, product3); |
modtronix | 10:6444e6c798ce | 5694 | |
modtronix | 10:6444e6c798ce | 5695 | } |
modtronix | 10:6444e6c798ce | 5696 | |
modtronix | 10:6444e6c798ce | 5697 | /** |
modtronix | 10:6444e6c798ce | 5698 | * @} end of Inverse park group |
modtronix | 10:6444e6c798ce | 5699 | */ |
modtronix | 10:6444e6c798ce | 5700 | |
modtronix | 10:6444e6c798ce | 5701 | |
modtronix | 10:6444e6c798ce | 5702 | /** |
modtronix | 10:6444e6c798ce | 5703 | * @brief Converts the elements of the Q31 vector to floating-point vector. |
modtronix | 10:6444e6c798ce | 5704 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 5705 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 5706 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 5707 | * @return none. |
modtronix | 10:6444e6c798ce | 5708 | */ |
modtronix | 10:6444e6c798ce | 5709 | void arm_q31_to_float( |
modtronix | 10:6444e6c798ce | 5710 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 5711 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 5712 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 5713 | |
modtronix | 10:6444e6c798ce | 5714 | /** |
modtronix | 10:6444e6c798ce | 5715 | * @ingroup groupInterpolation |
modtronix | 10:6444e6c798ce | 5716 | */ |
modtronix | 10:6444e6c798ce | 5717 | |
modtronix | 10:6444e6c798ce | 5718 | /** |
modtronix | 10:6444e6c798ce | 5719 | * @defgroup LinearInterpolate Linear Interpolation |
modtronix | 10:6444e6c798ce | 5720 | * |
modtronix | 10:6444e6c798ce | 5721 | * Linear interpolation is a method of curve fitting using linear polynomials. |
modtronix | 10:6444e6c798ce | 5722 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line |
modtronix | 10:6444e6c798ce | 5723 | * |
modtronix | 10:6444e6c798ce | 5724 | * \par |
modtronix | 10:6444e6c798ce | 5725 | * \image html LinearInterp.gif "Linear interpolation" |
modtronix | 10:6444e6c798ce | 5726 | * |
modtronix | 10:6444e6c798ce | 5727 | * \par |
modtronix | 10:6444e6c798ce | 5728 | * A Linear Interpolate function calculates an output value(y), for the input(x) |
modtronix | 10:6444e6c798ce | 5729 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) |
modtronix | 10:6444e6c798ce | 5730 | * |
modtronix | 10:6444e6c798ce | 5731 | * \par Algorithm: |
modtronix | 10:6444e6c798ce | 5732 | * <pre> |
modtronix | 10:6444e6c798ce | 5733 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0)) |
modtronix | 10:6444e6c798ce | 5734 | * where x0, x1 are nearest values of input x |
modtronix | 10:6444e6c798ce | 5735 | * y0, y1 are nearest values to output y |
modtronix | 10:6444e6c798ce | 5736 | * </pre> |
modtronix | 10:6444e6c798ce | 5737 | * |
modtronix | 10:6444e6c798ce | 5738 | * \par |
modtronix | 10:6444e6c798ce | 5739 | * This set of functions implements Linear interpolation process |
modtronix | 10:6444e6c798ce | 5740 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single |
modtronix | 10:6444e6c798ce | 5741 | * sample of data and each call to the function returns a single processed value. |
modtronix | 10:6444e6c798ce | 5742 | * <code>S</code> points to an instance of the Linear Interpolate function data structure. |
modtronix | 10:6444e6c798ce | 5743 | * <code>x</code> is the input sample value. The functions returns the output value. |
modtronix | 10:6444e6c798ce | 5744 | * |
modtronix | 10:6444e6c798ce | 5745 | * \par |
modtronix | 10:6444e6c798ce | 5746 | * if x is outside of the table boundary, Linear interpolation returns first value of the table |
modtronix | 10:6444e6c798ce | 5747 | * if x is below input range and returns last value of table if x is above range. |
modtronix | 10:6444e6c798ce | 5748 | */ |
modtronix | 10:6444e6c798ce | 5749 | |
modtronix | 10:6444e6c798ce | 5750 | /** |
modtronix | 10:6444e6c798ce | 5751 | * @addtogroup LinearInterpolate |
modtronix | 10:6444e6c798ce | 5752 | * @{ |
modtronix | 10:6444e6c798ce | 5753 | */ |
modtronix | 10:6444e6c798ce | 5754 | |
modtronix | 10:6444e6c798ce | 5755 | /** |
modtronix | 10:6444e6c798ce | 5756 | * @brief Process function for the floating-point Linear Interpolation Function. |
modtronix | 10:6444e6c798ce | 5757 | * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure |
modtronix | 10:6444e6c798ce | 5758 | * @param[in] x input sample to process |
modtronix | 10:6444e6c798ce | 5759 | * @return y processed output sample. |
modtronix | 10:6444e6c798ce | 5760 | * |
modtronix | 10:6444e6c798ce | 5761 | */ |
modtronix | 10:6444e6c798ce | 5762 | |
modtronix | 10:6444e6c798ce | 5763 | static __INLINE float32_t arm_linear_interp_f32( |
modtronix | 10:6444e6c798ce | 5764 | arm_linear_interp_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 5765 | float32_t x) |
modtronix | 10:6444e6c798ce | 5766 | { |
modtronix | 10:6444e6c798ce | 5767 | |
modtronix | 10:6444e6c798ce | 5768 | float32_t y; |
modtronix | 10:6444e6c798ce | 5769 | float32_t x0, x1; /* Nearest input values */ |
modtronix | 10:6444e6c798ce | 5770 | float32_t y0, y1; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 5771 | float32_t xSpacing = S->xSpacing; /* spacing between input values */ |
modtronix | 10:6444e6c798ce | 5772 | int32_t i; /* Index variable */ |
modtronix | 10:6444e6c798ce | 5773 | float32_t *pYData = S->pYData; /* pointer to output table */ |
modtronix | 10:6444e6c798ce | 5774 | |
modtronix | 10:6444e6c798ce | 5775 | /* Calculation of index */ |
modtronix | 10:6444e6c798ce | 5776 | i = (int32_t) ((x - S->x1) / xSpacing); |
modtronix | 10:6444e6c798ce | 5777 | |
modtronix | 10:6444e6c798ce | 5778 | if(i < 0) |
modtronix | 10:6444e6c798ce | 5779 | { |
modtronix | 10:6444e6c798ce | 5780 | /* Iniatilize output for below specified range as least output value of table */ |
modtronix | 10:6444e6c798ce | 5781 | y = pYData[0]; |
modtronix | 10:6444e6c798ce | 5782 | } |
modtronix | 10:6444e6c798ce | 5783 | else if((uint32_t)i >= S->nValues) |
modtronix | 10:6444e6c798ce | 5784 | { |
modtronix | 10:6444e6c798ce | 5785 | /* Iniatilize output for above specified range as last output value of table */ |
modtronix | 10:6444e6c798ce | 5786 | y = pYData[S->nValues - 1]; |
modtronix | 10:6444e6c798ce | 5787 | } |
modtronix | 10:6444e6c798ce | 5788 | else |
modtronix | 10:6444e6c798ce | 5789 | { |
modtronix | 10:6444e6c798ce | 5790 | /* Calculation of nearest input values */ |
modtronix | 10:6444e6c798ce | 5791 | x0 = S->x1 + i * xSpacing; |
modtronix | 10:6444e6c798ce | 5792 | x1 = S->x1 + (i + 1) * xSpacing; |
modtronix | 10:6444e6c798ce | 5793 | |
modtronix | 10:6444e6c798ce | 5794 | /* Read of nearest output values */ |
modtronix | 10:6444e6c798ce | 5795 | y0 = pYData[i]; |
modtronix | 10:6444e6c798ce | 5796 | y1 = pYData[i + 1]; |
modtronix | 10:6444e6c798ce | 5797 | |
modtronix | 10:6444e6c798ce | 5798 | /* Calculation of output */ |
modtronix | 10:6444e6c798ce | 5799 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); |
modtronix | 10:6444e6c798ce | 5800 | |
modtronix | 10:6444e6c798ce | 5801 | } |
modtronix | 10:6444e6c798ce | 5802 | |
modtronix | 10:6444e6c798ce | 5803 | /* returns output value */ |
modtronix | 10:6444e6c798ce | 5804 | return (y); |
modtronix | 10:6444e6c798ce | 5805 | } |
modtronix | 10:6444e6c798ce | 5806 | |
modtronix | 10:6444e6c798ce | 5807 | /** |
modtronix | 10:6444e6c798ce | 5808 | * |
modtronix | 10:6444e6c798ce | 5809 | * @brief Process function for the Q31 Linear Interpolation Function. |
modtronix | 10:6444e6c798ce | 5810 | * @param[in] *pYData pointer to Q31 Linear Interpolation table |
modtronix | 10:6444e6c798ce | 5811 | * @param[in] x input sample to process |
modtronix | 10:6444e6c798ce | 5812 | * @param[in] nValues number of table values |
modtronix | 10:6444e6c798ce | 5813 | * @return y processed output sample. |
modtronix | 10:6444e6c798ce | 5814 | * |
modtronix | 10:6444e6c798ce | 5815 | * \par |
modtronix | 10:6444e6c798ce | 5816 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
modtronix | 10:6444e6c798ce | 5817 | * This function can support maximum of table size 2^12. |
modtronix | 10:6444e6c798ce | 5818 | * |
modtronix | 10:6444e6c798ce | 5819 | */ |
modtronix | 10:6444e6c798ce | 5820 | |
modtronix | 10:6444e6c798ce | 5821 | |
modtronix | 10:6444e6c798ce | 5822 | static __INLINE q31_t arm_linear_interp_q31( |
modtronix | 10:6444e6c798ce | 5823 | q31_t * pYData, |
modtronix | 10:6444e6c798ce | 5824 | q31_t x, |
modtronix | 10:6444e6c798ce | 5825 | uint32_t nValues) |
modtronix | 10:6444e6c798ce | 5826 | { |
modtronix | 10:6444e6c798ce | 5827 | q31_t y; /* output */ |
modtronix | 10:6444e6c798ce | 5828 | q31_t y0, y1; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 5829 | q31_t fract; /* fractional part */ |
modtronix | 10:6444e6c798ce | 5830 | int32_t index; /* Index to read nearest output values */ |
modtronix | 10:6444e6c798ce | 5831 | |
modtronix | 10:6444e6c798ce | 5832 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 5833 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 5834 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 5835 | index = ((x & 0xFFF00000) >> 20); |
modtronix | 10:6444e6c798ce | 5836 | |
modtronix | 10:6444e6c798ce | 5837 | if(index >= (int32_t)(nValues - 1)) |
modtronix | 10:6444e6c798ce | 5838 | { |
modtronix | 10:6444e6c798ce | 5839 | return (pYData[nValues - 1]); |
modtronix | 10:6444e6c798ce | 5840 | } |
modtronix | 10:6444e6c798ce | 5841 | else if(index < 0) |
modtronix | 10:6444e6c798ce | 5842 | { |
modtronix | 10:6444e6c798ce | 5843 | return (pYData[0]); |
modtronix | 10:6444e6c798ce | 5844 | } |
modtronix | 10:6444e6c798ce | 5845 | else |
modtronix | 10:6444e6c798ce | 5846 | { |
modtronix | 10:6444e6c798ce | 5847 | |
modtronix | 10:6444e6c798ce | 5848 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 5849 | /* shift left by 11 to keep fract in 1.31 format */ |
modtronix | 10:6444e6c798ce | 5850 | fract = (x & 0x000FFFFF) << 11; |
modtronix | 10:6444e6c798ce | 5851 | |
modtronix | 10:6444e6c798ce | 5852 | /* Read two nearest output values from the index in 1.31(q31) format */ |
modtronix | 10:6444e6c798ce | 5853 | y0 = pYData[index]; |
modtronix | 10:6444e6c798ce | 5854 | y1 = pYData[index + 1u]; |
modtronix | 10:6444e6c798ce | 5855 | |
modtronix | 10:6444e6c798ce | 5856 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */ |
modtronix | 10:6444e6c798ce | 5857 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); |
modtronix | 10:6444e6c798ce | 5858 | |
modtronix | 10:6444e6c798ce | 5859 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ |
modtronix | 10:6444e6c798ce | 5860 | y += ((q31_t) (((q63_t) y1 * fract) >> 32)); |
modtronix | 10:6444e6c798ce | 5861 | |
modtronix | 10:6444e6c798ce | 5862 | /* Convert y to 1.31 format */ |
modtronix | 10:6444e6c798ce | 5863 | return (y << 1u); |
modtronix | 10:6444e6c798ce | 5864 | |
modtronix | 10:6444e6c798ce | 5865 | } |
modtronix | 10:6444e6c798ce | 5866 | |
modtronix | 10:6444e6c798ce | 5867 | } |
modtronix | 10:6444e6c798ce | 5868 | |
modtronix | 10:6444e6c798ce | 5869 | /** |
modtronix | 10:6444e6c798ce | 5870 | * |
modtronix | 10:6444e6c798ce | 5871 | * @brief Process function for the Q15 Linear Interpolation Function. |
modtronix | 10:6444e6c798ce | 5872 | * @param[in] *pYData pointer to Q15 Linear Interpolation table |
modtronix | 10:6444e6c798ce | 5873 | * @param[in] x input sample to process |
modtronix | 10:6444e6c798ce | 5874 | * @param[in] nValues number of table values |
modtronix | 10:6444e6c798ce | 5875 | * @return y processed output sample. |
modtronix | 10:6444e6c798ce | 5876 | * |
modtronix | 10:6444e6c798ce | 5877 | * \par |
modtronix | 10:6444e6c798ce | 5878 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
modtronix | 10:6444e6c798ce | 5879 | * This function can support maximum of table size 2^12. |
modtronix | 10:6444e6c798ce | 5880 | * |
modtronix | 10:6444e6c798ce | 5881 | */ |
modtronix | 10:6444e6c798ce | 5882 | |
modtronix | 10:6444e6c798ce | 5883 | |
modtronix | 10:6444e6c798ce | 5884 | static __INLINE q15_t arm_linear_interp_q15( |
modtronix | 10:6444e6c798ce | 5885 | q15_t * pYData, |
modtronix | 10:6444e6c798ce | 5886 | q31_t x, |
modtronix | 10:6444e6c798ce | 5887 | uint32_t nValues) |
modtronix | 10:6444e6c798ce | 5888 | { |
modtronix | 10:6444e6c798ce | 5889 | q63_t y; /* output */ |
modtronix | 10:6444e6c798ce | 5890 | q15_t y0, y1; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 5891 | q31_t fract; /* fractional part */ |
modtronix | 10:6444e6c798ce | 5892 | int32_t index; /* Index to read nearest output values */ |
modtronix | 10:6444e6c798ce | 5893 | |
modtronix | 10:6444e6c798ce | 5894 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 5895 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 5896 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 5897 | index = ((x & 0xFFF00000) >> 20u); |
modtronix | 10:6444e6c798ce | 5898 | |
modtronix | 10:6444e6c798ce | 5899 | if(index >= (int32_t)(nValues - 1)) |
modtronix | 10:6444e6c798ce | 5900 | { |
modtronix | 10:6444e6c798ce | 5901 | return (pYData[nValues - 1]); |
modtronix | 10:6444e6c798ce | 5902 | } |
modtronix | 10:6444e6c798ce | 5903 | else if(index < 0) |
modtronix | 10:6444e6c798ce | 5904 | { |
modtronix | 10:6444e6c798ce | 5905 | return (pYData[0]); |
modtronix | 10:6444e6c798ce | 5906 | } |
modtronix | 10:6444e6c798ce | 5907 | else |
modtronix | 10:6444e6c798ce | 5908 | { |
modtronix | 10:6444e6c798ce | 5909 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 5910 | /* fract is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 5911 | fract = (x & 0x000FFFFF); |
modtronix | 10:6444e6c798ce | 5912 | |
modtronix | 10:6444e6c798ce | 5913 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 5914 | y0 = pYData[index]; |
modtronix | 10:6444e6c798ce | 5915 | y1 = pYData[index + 1u]; |
modtronix | 10:6444e6c798ce | 5916 | |
modtronix | 10:6444e6c798ce | 5917 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */ |
modtronix | 10:6444e6c798ce | 5918 | y = ((q63_t) y0 * (0xFFFFF - fract)); |
modtronix | 10:6444e6c798ce | 5919 | |
modtronix | 10:6444e6c798ce | 5920 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ |
modtronix | 10:6444e6c798ce | 5921 | y += ((q63_t) y1 * (fract)); |
modtronix | 10:6444e6c798ce | 5922 | |
modtronix | 10:6444e6c798ce | 5923 | /* convert y to 1.15 format */ |
modtronix | 10:6444e6c798ce | 5924 | return (y >> 20); |
modtronix | 10:6444e6c798ce | 5925 | } |
modtronix | 10:6444e6c798ce | 5926 | |
modtronix | 10:6444e6c798ce | 5927 | |
modtronix | 10:6444e6c798ce | 5928 | } |
modtronix | 10:6444e6c798ce | 5929 | |
modtronix | 10:6444e6c798ce | 5930 | /** |
modtronix | 10:6444e6c798ce | 5931 | * |
modtronix | 10:6444e6c798ce | 5932 | * @brief Process function for the Q7 Linear Interpolation Function. |
modtronix | 10:6444e6c798ce | 5933 | * @param[in] *pYData pointer to Q7 Linear Interpolation table |
modtronix | 10:6444e6c798ce | 5934 | * @param[in] x input sample to process |
modtronix | 10:6444e6c798ce | 5935 | * @param[in] nValues number of table values |
modtronix | 10:6444e6c798ce | 5936 | * @return y processed output sample. |
modtronix | 10:6444e6c798ce | 5937 | * |
modtronix | 10:6444e6c798ce | 5938 | * \par |
modtronix | 10:6444e6c798ce | 5939 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
modtronix | 10:6444e6c798ce | 5940 | * This function can support maximum of table size 2^12. |
modtronix | 10:6444e6c798ce | 5941 | */ |
modtronix | 10:6444e6c798ce | 5942 | |
modtronix | 10:6444e6c798ce | 5943 | |
modtronix | 10:6444e6c798ce | 5944 | static __INLINE q7_t arm_linear_interp_q7( |
modtronix | 10:6444e6c798ce | 5945 | q7_t * pYData, |
modtronix | 10:6444e6c798ce | 5946 | q31_t x, |
modtronix | 10:6444e6c798ce | 5947 | uint32_t nValues) |
modtronix | 10:6444e6c798ce | 5948 | { |
modtronix | 10:6444e6c798ce | 5949 | q31_t y; /* output */ |
modtronix | 10:6444e6c798ce | 5950 | q7_t y0, y1; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 5951 | q31_t fract; /* fractional part */ |
modtronix | 10:6444e6c798ce | 5952 | uint32_t index; /* Index to read nearest output values */ |
modtronix | 10:6444e6c798ce | 5953 | |
modtronix | 10:6444e6c798ce | 5954 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 5955 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 5956 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 5957 | if (x < 0) |
modtronix | 10:6444e6c798ce | 5958 | { |
modtronix | 10:6444e6c798ce | 5959 | return (pYData[0]); |
modtronix | 10:6444e6c798ce | 5960 | } |
modtronix | 10:6444e6c798ce | 5961 | index = (x >> 20) & 0xfff; |
modtronix | 10:6444e6c798ce | 5962 | |
modtronix | 10:6444e6c798ce | 5963 | |
modtronix | 10:6444e6c798ce | 5964 | if(index >= (nValues - 1)) |
modtronix | 10:6444e6c798ce | 5965 | { |
modtronix | 10:6444e6c798ce | 5966 | return (pYData[nValues - 1]); |
modtronix | 10:6444e6c798ce | 5967 | } |
modtronix | 10:6444e6c798ce | 5968 | else |
modtronix | 10:6444e6c798ce | 5969 | { |
modtronix | 10:6444e6c798ce | 5970 | |
modtronix | 10:6444e6c798ce | 5971 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 5972 | /* fract is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 5973 | fract = (x & 0x000FFFFF); |
modtronix | 10:6444e6c798ce | 5974 | |
modtronix | 10:6444e6c798ce | 5975 | /* Read two nearest output values from the index and are in 1.7(q7) format */ |
modtronix | 10:6444e6c798ce | 5976 | y0 = pYData[index]; |
modtronix | 10:6444e6c798ce | 5977 | y1 = pYData[index + 1u]; |
modtronix | 10:6444e6c798ce | 5978 | |
modtronix | 10:6444e6c798ce | 5979 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ |
modtronix | 10:6444e6c798ce | 5980 | y = ((y0 * (0xFFFFF - fract))); |
modtronix | 10:6444e6c798ce | 5981 | |
modtronix | 10:6444e6c798ce | 5982 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ |
modtronix | 10:6444e6c798ce | 5983 | y += (y1 * fract); |
modtronix | 10:6444e6c798ce | 5984 | |
modtronix | 10:6444e6c798ce | 5985 | /* convert y to 1.7(q7) format */ |
modtronix | 10:6444e6c798ce | 5986 | return (y >> 20u); |
modtronix | 10:6444e6c798ce | 5987 | |
modtronix | 10:6444e6c798ce | 5988 | } |
modtronix | 10:6444e6c798ce | 5989 | |
modtronix | 10:6444e6c798ce | 5990 | } |
modtronix | 10:6444e6c798ce | 5991 | /** |
modtronix | 10:6444e6c798ce | 5992 | * @} end of LinearInterpolate group |
modtronix | 10:6444e6c798ce | 5993 | */ |
modtronix | 10:6444e6c798ce | 5994 | |
modtronix | 10:6444e6c798ce | 5995 | /** |
modtronix | 10:6444e6c798ce | 5996 | * @brief Fast approximation to the trigonometric sine function for floating-point data. |
modtronix | 10:6444e6c798ce | 5997 | * @param[in] x input value in radians. |
modtronix | 10:6444e6c798ce | 5998 | * @return sin(x). |
modtronix | 10:6444e6c798ce | 5999 | */ |
modtronix | 10:6444e6c798ce | 6000 | |
modtronix | 10:6444e6c798ce | 6001 | float32_t arm_sin_f32( |
modtronix | 10:6444e6c798ce | 6002 | float32_t x); |
modtronix | 10:6444e6c798ce | 6003 | |
modtronix | 10:6444e6c798ce | 6004 | /** |
modtronix | 10:6444e6c798ce | 6005 | * @brief Fast approximation to the trigonometric sine function for Q31 data. |
modtronix | 10:6444e6c798ce | 6006 | * @param[in] x Scaled input value in radians. |
modtronix | 10:6444e6c798ce | 6007 | * @return sin(x). |
modtronix | 10:6444e6c798ce | 6008 | */ |
modtronix | 10:6444e6c798ce | 6009 | |
modtronix | 10:6444e6c798ce | 6010 | q31_t arm_sin_q31( |
modtronix | 10:6444e6c798ce | 6011 | q31_t x); |
modtronix | 10:6444e6c798ce | 6012 | |
modtronix | 10:6444e6c798ce | 6013 | /** |
modtronix | 10:6444e6c798ce | 6014 | * @brief Fast approximation to the trigonometric sine function for Q15 data. |
modtronix | 10:6444e6c798ce | 6015 | * @param[in] x Scaled input value in radians. |
modtronix | 10:6444e6c798ce | 6016 | * @return sin(x). |
modtronix | 10:6444e6c798ce | 6017 | */ |
modtronix | 10:6444e6c798ce | 6018 | |
modtronix | 10:6444e6c798ce | 6019 | q15_t arm_sin_q15( |
modtronix | 10:6444e6c798ce | 6020 | q15_t x); |
modtronix | 10:6444e6c798ce | 6021 | |
modtronix | 10:6444e6c798ce | 6022 | /** |
modtronix | 10:6444e6c798ce | 6023 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. |
modtronix | 10:6444e6c798ce | 6024 | * @param[in] x input value in radians. |
modtronix | 10:6444e6c798ce | 6025 | * @return cos(x). |
modtronix | 10:6444e6c798ce | 6026 | */ |
modtronix | 10:6444e6c798ce | 6027 | |
modtronix | 10:6444e6c798ce | 6028 | float32_t arm_cos_f32( |
modtronix | 10:6444e6c798ce | 6029 | float32_t x); |
modtronix | 10:6444e6c798ce | 6030 | |
modtronix | 10:6444e6c798ce | 6031 | /** |
modtronix | 10:6444e6c798ce | 6032 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. |
modtronix | 10:6444e6c798ce | 6033 | * @param[in] x Scaled input value in radians. |
modtronix | 10:6444e6c798ce | 6034 | * @return cos(x). |
modtronix | 10:6444e6c798ce | 6035 | */ |
modtronix | 10:6444e6c798ce | 6036 | |
modtronix | 10:6444e6c798ce | 6037 | q31_t arm_cos_q31( |
modtronix | 10:6444e6c798ce | 6038 | q31_t x); |
modtronix | 10:6444e6c798ce | 6039 | |
modtronix | 10:6444e6c798ce | 6040 | /** |
modtronix | 10:6444e6c798ce | 6041 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. |
modtronix | 10:6444e6c798ce | 6042 | * @param[in] x Scaled input value in radians. |
modtronix | 10:6444e6c798ce | 6043 | * @return cos(x). |
modtronix | 10:6444e6c798ce | 6044 | */ |
modtronix | 10:6444e6c798ce | 6045 | |
modtronix | 10:6444e6c798ce | 6046 | q15_t arm_cos_q15( |
modtronix | 10:6444e6c798ce | 6047 | q15_t x); |
modtronix | 10:6444e6c798ce | 6048 | |
modtronix | 10:6444e6c798ce | 6049 | |
modtronix | 10:6444e6c798ce | 6050 | /** |
modtronix | 10:6444e6c798ce | 6051 | * @ingroup groupFastMath |
modtronix | 10:6444e6c798ce | 6052 | */ |
modtronix | 10:6444e6c798ce | 6053 | |
modtronix | 10:6444e6c798ce | 6054 | |
modtronix | 10:6444e6c798ce | 6055 | /** |
modtronix | 10:6444e6c798ce | 6056 | * @defgroup SQRT Square Root |
modtronix | 10:6444e6c798ce | 6057 | * |
modtronix | 10:6444e6c798ce | 6058 | * Computes the square root of a number. |
modtronix | 10:6444e6c798ce | 6059 | * There are separate functions for Q15, Q31, and floating-point data types. |
modtronix | 10:6444e6c798ce | 6060 | * The square root function is computed using the Newton-Raphson algorithm. |
modtronix | 10:6444e6c798ce | 6061 | * This is an iterative algorithm of the form: |
modtronix | 10:6444e6c798ce | 6062 | * <pre> |
modtronix | 10:6444e6c798ce | 6063 | * x1 = x0 - f(x0)/f'(x0) |
modtronix | 10:6444e6c798ce | 6064 | * </pre> |
modtronix | 10:6444e6c798ce | 6065 | * where <code>x1</code> is the current estimate, |
modtronix | 10:6444e6c798ce | 6066 | * <code>x0</code> is the previous estimate, and |
modtronix | 10:6444e6c798ce | 6067 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>. |
modtronix | 10:6444e6c798ce | 6068 | * For the square root function, the algorithm reduces to: |
modtronix | 10:6444e6c798ce | 6069 | * <pre> |
modtronix | 10:6444e6c798ce | 6070 | * x0 = in/2 [initial guess] |
modtronix | 10:6444e6c798ce | 6071 | * x1 = 1/2 * ( x0 + in / x0) [each iteration] |
modtronix | 10:6444e6c798ce | 6072 | * </pre> |
modtronix | 10:6444e6c798ce | 6073 | */ |
modtronix | 10:6444e6c798ce | 6074 | |
modtronix | 10:6444e6c798ce | 6075 | |
modtronix | 10:6444e6c798ce | 6076 | /** |
modtronix | 10:6444e6c798ce | 6077 | * @addtogroup SQRT |
modtronix | 10:6444e6c798ce | 6078 | * @{ |
modtronix | 10:6444e6c798ce | 6079 | */ |
modtronix | 10:6444e6c798ce | 6080 | |
modtronix | 10:6444e6c798ce | 6081 | /** |
modtronix | 10:6444e6c798ce | 6082 | * @brief Floating-point square root function. |
modtronix | 10:6444e6c798ce | 6083 | * @param[in] in input value. |
modtronix | 10:6444e6c798ce | 6084 | * @param[out] *pOut square root of input value. |
modtronix | 10:6444e6c798ce | 6085 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
modtronix | 10:6444e6c798ce | 6086 | * <code>in</code> is negative value and returns zero output for negative values. |
modtronix | 10:6444e6c798ce | 6087 | */ |
modtronix | 10:6444e6c798ce | 6088 | |
modtronix | 10:6444e6c798ce | 6089 | static __INLINE arm_status arm_sqrt_f32( |
modtronix | 10:6444e6c798ce | 6090 | float32_t in, |
modtronix | 10:6444e6c798ce | 6091 | float32_t * pOut) |
modtronix | 10:6444e6c798ce | 6092 | { |
modtronix | 10:6444e6c798ce | 6093 | if(in > 0) |
modtronix | 10:6444e6c798ce | 6094 | { |
modtronix | 10:6444e6c798ce | 6095 | |
modtronix | 10:6444e6c798ce | 6096 | // #if __FPU_USED |
modtronix | 10:6444e6c798ce | 6097 | #if (__FPU_USED == 1) && defined ( __CC_ARM ) |
modtronix | 10:6444e6c798ce | 6098 | *pOut = __sqrtf(in); |
modtronix | 10:6444e6c798ce | 6099 | #else |
modtronix | 10:6444e6c798ce | 6100 | *pOut = sqrtf(in); |
modtronix | 10:6444e6c798ce | 6101 | #endif |
modtronix | 10:6444e6c798ce | 6102 | |
modtronix | 10:6444e6c798ce | 6103 | return (ARM_MATH_SUCCESS); |
modtronix | 10:6444e6c798ce | 6104 | } |
modtronix | 10:6444e6c798ce | 6105 | else |
modtronix | 10:6444e6c798ce | 6106 | { |
modtronix | 10:6444e6c798ce | 6107 | *pOut = 0.0f; |
modtronix | 10:6444e6c798ce | 6108 | return (ARM_MATH_ARGUMENT_ERROR); |
modtronix | 10:6444e6c798ce | 6109 | } |
modtronix | 10:6444e6c798ce | 6110 | |
modtronix | 10:6444e6c798ce | 6111 | } |
modtronix | 10:6444e6c798ce | 6112 | |
modtronix | 10:6444e6c798ce | 6113 | |
modtronix | 10:6444e6c798ce | 6114 | /** |
modtronix | 10:6444e6c798ce | 6115 | * @brief Q31 square root function. |
modtronix | 10:6444e6c798ce | 6116 | * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. |
modtronix | 10:6444e6c798ce | 6117 | * @param[out] *pOut square root of input value. |
modtronix | 10:6444e6c798ce | 6118 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
modtronix | 10:6444e6c798ce | 6119 | * <code>in</code> is negative value and returns zero output for negative values. |
modtronix | 10:6444e6c798ce | 6120 | */ |
modtronix | 10:6444e6c798ce | 6121 | arm_status arm_sqrt_q31( |
modtronix | 10:6444e6c798ce | 6122 | q31_t in, |
modtronix | 10:6444e6c798ce | 6123 | q31_t * pOut); |
modtronix | 10:6444e6c798ce | 6124 | |
modtronix | 10:6444e6c798ce | 6125 | /** |
modtronix | 10:6444e6c798ce | 6126 | * @brief Q15 square root function. |
modtronix | 10:6444e6c798ce | 6127 | * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. |
modtronix | 10:6444e6c798ce | 6128 | * @param[out] *pOut square root of input value. |
modtronix | 10:6444e6c798ce | 6129 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
modtronix | 10:6444e6c798ce | 6130 | * <code>in</code> is negative value and returns zero output for negative values. |
modtronix | 10:6444e6c798ce | 6131 | */ |
modtronix | 10:6444e6c798ce | 6132 | arm_status arm_sqrt_q15( |
modtronix | 10:6444e6c798ce | 6133 | q15_t in, |
modtronix | 10:6444e6c798ce | 6134 | q15_t * pOut); |
modtronix | 10:6444e6c798ce | 6135 | |
modtronix | 10:6444e6c798ce | 6136 | /** |
modtronix | 10:6444e6c798ce | 6137 | * @} end of SQRT group |
modtronix | 10:6444e6c798ce | 6138 | */ |
modtronix | 10:6444e6c798ce | 6139 | |
modtronix | 10:6444e6c798ce | 6140 | |
modtronix | 10:6444e6c798ce | 6141 | |
modtronix | 10:6444e6c798ce | 6142 | |
modtronix | 10:6444e6c798ce | 6143 | |
modtronix | 10:6444e6c798ce | 6144 | |
modtronix | 10:6444e6c798ce | 6145 | /** |
modtronix | 10:6444e6c798ce | 6146 | * @brief floating-point Circular write function. |
modtronix | 10:6444e6c798ce | 6147 | */ |
modtronix | 10:6444e6c798ce | 6148 | |
modtronix | 10:6444e6c798ce | 6149 | static __INLINE void arm_circularWrite_f32( |
modtronix | 10:6444e6c798ce | 6150 | int32_t * circBuffer, |
modtronix | 10:6444e6c798ce | 6151 | int32_t L, |
modtronix | 10:6444e6c798ce | 6152 | uint16_t * writeOffset, |
modtronix | 10:6444e6c798ce | 6153 | int32_t bufferInc, |
modtronix | 10:6444e6c798ce | 6154 | const int32_t * src, |
modtronix | 10:6444e6c798ce | 6155 | int32_t srcInc, |
modtronix | 10:6444e6c798ce | 6156 | uint32_t blockSize) |
modtronix | 10:6444e6c798ce | 6157 | { |
modtronix | 10:6444e6c798ce | 6158 | uint32_t i = 0u; |
modtronix | 10:6444e6c798ce | 6159 | int32_t wOffset; |
modtronix | 10:6444e6c798ce | 6160 | |
modtronix | 10:6444e6c798ce | 6161 | /* Copy the value of Index pointer that points |
modtronix | 10:6444e6c798ce | 6162 | * to the current location where the input samples to be copied */ |
modtronix | 10:6444e6c798ce | 6163 | wOffset = *writeOffset; |
modtronix | 10:6444e6c798ce | 6164 | |
modtronix | 10:6444e6c798ce | 6165 | /* Loop over the blockSize */ |
modtronix | 10:6444e6c798ce | 6166 | i = blockSize; |
modtronix | 10:6444e6c798ce | 6167 | |
modtronix | 10:6444e6c798ce | 6168 | while(i > 0u) |
modtronix | 10:6444e6c798ce | 6169 | { |
modtronix | 10:6444e6c798ce | 6170 | /* copy the input sample to the circular buffer */ |
modtronix | 10:6444e6c798ce | 6171 | circBuffer[wOffset] = *src; |
modtronix | 10:6444e6c798ce | 6172 | |
modtronix | 10:6444e6c798ce | 6173 | /* Update the input pointer */ |
modtronix | 10:6444e6c798ce | 6174 | src += srcInc; |
modtronix | 10:6444e6c798ce | 6175 | |
modtronix | 10:6444e6c798ce | 6176 | /* Circularly update wOffset. Watch out for positive and negative value */ |
modtronix | 10:6444e6c798ce | 6177 | wOffset += bufferInc; |
modtronix | 10:6444e6c798ce | 6178 | if(wOffset >= L) |
modtronix | 10:6444e6c798ce | 6179 | wOffset -= L; |
modtronix | 10:6444e6c798ce | 6180 | |
modtronix | 10:6444e6c798ce | 6181 | /* Decrement the loop counter */ |
modtronix | 10:6444e6c798ce | 6182 | i--; |
modtronix | 10:6444e6c798ce | 6183 | } |
modtronix | 10:6444e6c798ce | 6184 | |
modtronix | 10:6444e6c798ce | 6185 | /* Update the index pointer */ |
modtronix | 10:6444e6c798ce | 6186 | *writeOffset = wOffset; |
modtronix | 10:6444e6c798ce | 6187 | } |
modtronix | 10:6444e6c798ce | 6188 | |
modtronix | 10:6444e6c798ce | 6189 | |
modtronix | 10:6444e6c798ce | 6190 | |
modtronix | 10:6444e6c798ce | 6191 | /** |
modtronix | 10:6444e6c798ce | 6192 | * @brief floating-point Circular Read function. |
modtronix | 10:6444e6c798ce | 6193 | */ |
modtronix | 10:6444e6c798ce | 6194 | static __INLINE void arm_circularRead_f32( |
modtronix | 10:6444e6c798ce | 6195 | int32_t * circBuffer, |
modtronix | 10:6444e6c798ce | 6196 | int32_t L, |
modtronix | 10:6444e6c798ce | 6197 | int32_t * readOffset, |
modtronix | 10:6444e6c798ce | 6198 | int32_t bufferInc, |
modtronix | 10:6444e6c798ce | 6199 | int32_t * dst, |
modtronix | 10:6444e6c798ce | 6200 | int32_t * dst_base, |
modtronix | 10:6444e6c798ce | 6201 | int32_t dst_length, |
modtronix | 10:6444e6c798ce | 6202 | int32_t dstInc, |
modtronix | 10:6444e6c798ce | 6203 | uint32_t blockSize) |
modtronix | 10:6444e6c798ce | 6204 | { |
modtronix | 10:6444e6c798ce | 6205 | uint32_t i = 0u; |
modtronix | 10:6444e6c798ce | 6206 | int32_t rOffset, dst_end; |
modtronix | 10:6444e6c798ce | 6207 | |
modtronix | 10:6444e6c798ce | 6208 | /* Copy the value of Index pointer that points |
modtronix | 10:6444e6c798ce | 6209 | * to the current location from where the input samples to be read */ |
modtronix | 10:6444e6c798ce | 6210 | rOffset = *readOffset; |
modtronix | 10:6444e6c798ce | 6211 | dst_end = (int32_t) (dst_base + dst_length); |
modtronix | 10:6444e6c798ce | 6212 | |
modtronix | 10:6444e6c798ce | 6213 | /* Loop over the blockSize */ |
modtronix | 10:6444e6c798ce | 6214 | i = blockSize; |
modtronix | 10:6444e6c798ce | 6215 | |
modtronix | 10:6444e6c798ce | 6216 | while(i > 0u) |
modtronix | 10:6444e6c798ce | 6217 | { |
modtronix | 10:6444e6c798ce | 6218 | /* copy the sample from the circular buffer to the destination buffer */ |
modtronix | 10:6444e6c798ce | 6219 | *dst = circBuffer[rOffset]; |
modtronix | 10:6444e6c798ce | 6220 | |
modtronix | 10:6444e6c798ce | 6221 | /* Update the input pointer */ |
modtronix | 10:6444e6c798ce | 6222 | dst += dstInc; |
modtronix | 10:6444e6c798ce | 6223 | |
modtronix | 10:6444e6c798ce | 6224 | if(dst == (int32_t *) dst_end) |
modtronix | 10:6444e6c798ce | 6225 | { |
modtronix | 10:6444e6c798ce | 6226 | dst = dst_base; |
modtronix | 10:6444e6c798ce | 6227 | } |
modtronix | 10:6444e6c798ce | 6228 | |
modtronix | 10:6444e6c798ce | 6229 | /* Circularly update rOffset. Watch out for positive and negative value */ |
modtronix | 10:6444e6c798ce | 6230 | rOffset += bufferInc; |
modtronix | 10:6444e6c798ce | 6231 | |
modtronix | 10:6444e6c798ce | 6232 | if(rOffset >= L) |
modtronix | 10:6444e6c798ce | 6233 | { |
modtronix | 10:6444e6c798ce | 6234 | rOffset -= L; |
modtronix | 10:6444e6c798ce | 6235 | } |
modtronix | 10:6444e6c798ce | 6236 | |
modtronix | 10:6444e6c798ce | 6237 | /* Decrement the loop counter */ |
modtronix | 10:6444e6c798ce | 6238 | i--; |
modtronix | 10:6444e6c798ce | 6239 | } |
modtronix | 10:6444e6c798ce | 6240 | |
modtronix | 10:6444e6c798ce | 6241 | /* Update the index pointer */ |
modtronix | 10:6444e6c798ce | 6242 | *readOffset = rOffset; |
modtronix | 10:6444e6c798ce | 6243 | } |
modtronix | 10:6444e6c798ce | 6244 | |
modtronix | 10:6444e6c798ce | 6245 | /** |
modtronix | 10:6444e6c798ce | 6246 | * @brief Q15 Circular write function. |
modtronix | 10:6444e6c798ce | 6247 | */ |
modtronix | 10:6444e6c798ce | 6248 | |
modtronix | 10:6444e6c798ce | 6249 | static __INLINE void arm_circularWrite_q15( |
modtronix | 10:6444e6c798ce | 6250 | q15_t * circBuffer, |
modtronix | 10:6444e6c798ce | 6251 | int32_t L, |
modtronix | 10:6444e6c798ce | 6252 | uint16_t * writeOffset, |
modtronix | 10:6444e6c798ce | 6253 | int32_t bufferInc, |
modtronix | 10:6444e6c798ce | 6254 | const q15_t * src, |
modtronix | 10:6444e6c798ce | 6255 | int32_t srcInc, |
modtronix | 10:6444e6c798ce | 6256 | uint32_t blockSize) |
modtronix | 10:6444e6c798ce | 6257 | { |
modtronix | 10:6444e6c798ce | 6258 | uint32_t i = 0u; |
modtronix | 10:6444e6c798ce | 6259 | int32_t wOffset; |
modtronix | 10:6444e6c798ce | 6260 | |
modtronix | 10:6444e6c798ce | 6261 | /* Copy the value of Index pointer that points |
modtronix | 10:6444e6c798ce | 6262 | * to the current location where the input samples to be copied */ |
modtronix | 10:6444e6c798ce | 6263 | wOffset = *writeOffset; |
modtronix | 10:6444e6c798ce | 6264 | |
modtronix | 10:6444e6c798ce | 6265 | /* Loop over the blockSize */ |
modtronix | 10:6444e6c798ce | 6266 | i = blockSize; |
modtronix | 10:6444e6c798ce | 6267 | |
modtronix | 10:6444e6c798ce | 6268 | while(i > 0u) |
modtronix | 10:6444e6c798ce | 6269 | { |
modtronix | 10:6444e6c798ce | 6270 | /* copy the input sample to the circular buffer */ |
modtronix | 10:6444e6c798ce | 6271 | circBuffer[wOffset] = *src; |
modtronix | 10:6444e6c798ce | 6272 | |
modtronix | 10:6444e6c798ce | 6273 | /* Update the input pointer */ |
modtronix | 10:6444e6c798ce | 6274 | src += srcInc; |
modtronix | 10:6444e6c798ce | 6275 | |
modtronix | 10:6444e6c798ce | 6276 | /* Circularly update wOffset. Watch out for positive and negative value */ |
modtronix | 10:6444e6c798ce | 6277 | wOffset += bufferInc; |
modtronix | 10:6444e6c798ce | 6278 | if(wOffset >= L) |
modtronix | 10:6444e6c798ce | 6279 | wOffset -= L; |
modtronix | 10:6444e6c798ce | 6280 | |
modtronix | 10:6444e6c798ce | 6281 | /* Decrement the loop counter */ |
modtronix | 10:6444e6c798ce | 6282 | i--; |
modtronix | 10:6444e6c798ce | 6283 | } |
modtronix | 10:6444e6c798ce | 6284 | |
modtronix | 10:6444e6c798ce | 6285 | /* Update the index pointer */ |
modtronix | 10:6444e6c798ce | 6286 | *writeOffset = wOffset; |
modtronix | 10:6444e6c798ce | 6287 | } |
modtronix | 10:6444e6c798ce | 6288 | |
modtronix | 10:6444e6c798ce | 6289 | |
modtronix | 10:6444e6c798ce | 6290 | |
modtronix | 10:6444e6c798ce | 6291 | /** |
modtronix | 10:6444e6c798ce | 6292 | * @brief Q15 Circular Read function. |
modtronix | 10:6444e6c798ce | 6293 | */ |
modtronix | 10:6444e6c798ce | 6294 | static __INLINE void arm_circularRead_q15( |
modtronix | 10:6444e6c798ce | 6295 | q15_t * circBuffer, |
modtronix | 10:6444e6c798ce | 6296 | int32_t L, |
modtronix | 10:6444e6c798ce | 6297 | int32_t * readOffset, |
modtronix | 10:6444e6c798ce | 6298 | int32_t bufferInc, |
modtronix | 10:6444e6c798ce | 6299 | q15_t * dst, |
modtronix | 10:6444e6c798ce | 6300 | q15_t * dst_base, |
modtronix | 10:6444e6c798ce | 6301 | int32_t dst_length, |
modtronix | 10:6444e6c798ce | 6302 | int32_t dstInc, |
modtronix | 10:6444e6c798ce | 6303 | uint32_t blockSize) |
modtronix | 10:6444e6c798ce | 6304 | { |
modtronix | 10:6444e6c798ce | 6305 | uint32_t i = 0; |
modtronix | 10:6444e6c798ce | 6306 | int32_t rOffset, dst_end; |
modtronix | 10:6444e6c798ce | 6307 | |
modtronix | 10:6444e6c798ce | 6308 | /* Copy the value of Index pointer that points |
modtronix | 10:6444e6c798ce | 6309 | * to the current location from where the input samples to be read */ |
modtronix | 10:6444e6c798ce | 6310 | rOffset = *readOffset; |
modtronix | 10:6444e6c798ce | 6311 | |
modtronix | 10:6444e6c798ce | 6312 | dst_end = (int32_t) (dst_base + dst_length); |
modtronix | 10:6444e6c798ce | 6313 | |
modtronix | 10:6444e6c798ce | 6314 | /* Loop over the blockSize */ |
modtronix | 10:6444e6c798ce | 6315 | i = blockSize; |
modtronix | 10:6444e6c798ce | 6316 | |
modtronix | 10:6444e6c798ce | 6317 | while(i > 0u) |
modtronix | 10:6444e6c798ce | 6318 | { |
modtronix | 10:6444e6c798ce | 6319 | /* copy the sample from the circular buffer to the destination buffer */ |
modtronix | 10:6444e6c798ce | 6320 | *dst = circBuffer[rOffset]; |
modtronix | 10:6444e6c798ce | 6321 | |
modtronix | 10:6444e6c798ce | 6322 | /* Update the input pointer */ |
modtronix | 10:6444e6c798ce | 6323 | dst += dstInc; |
modtronix | 10:6444e6c798ce | 6324 | |
modtronix | 10:6444e6c798ce | 6325 | if(dst == (q15_t *) dst_end) |
modtronix | 10:6444e6c798ce | 6326 | { |
modtronix | 10:6444e6c798ce | 6327 | dst = dst_base; |
modtronix | 10:6444e6c798ce | 6328 | } |
modtronix | 10:6444e6c798ce | 6329 | |
modtronix | 10:6444e6c798ce | 6330 | /* Circularly update wOffset. Watch out for positive and negative value */ |
modtronix | 10:6444e6c798ce | 6331 | rOffset += bufferInc; |
modtronix | 10:6444e6c798ce | 6332 | |
modtronix | 10:6444e6c798ce | 6333 | if(rOffset >= L) |
modtronix | 10:6444e6c798ce | 6334 | { |
modtronix | 10:6444e6c798ce | 6335 | rOffset -= L; |
modtronix | 10:6444e6c798ce | 6336 | } |
modtronix | 10:6444e6c798ce | 6337 | |
modtronix | 10:6444e6c798ce | 6338 | /* Decrement the loop counter */ |
modtronix | 10:6444e6c798ce | 6339 | i--; |
modtronix | 10:6444e6c798ce | 6340 | } |
modtronix | 10:6444e6c798ce | 6341 | |
modtronix | 10:6444e6c798ce | 6342 | /* Update the index pointer */ |
modtronix | 10:6444e6c798ce | 6343 | *readOffset = rOffset; |
modtronix | 10:6444e6c798ce | 6344 | } |
modtronix | 10:6444e6c798ce | 6345 | |
modtronix | 10:6444e6c798ce | 6346 | |
modtronix | 10:6444e6c798ce | 6347 | /** |
modtronix | 10:6444e6c798ce | 6348 | * @brief Q7 Circular write function. |
modtronix | 10:6444e6c798ce | 6349 | */ |
modtronix | 10:6444e6c798ce | 6350 | |
modtronix | 10:6444e6c798ce | 6351 | static __INLINE void arm_circularWrite_q7( |
modtronix | 10:6444e6c798ce | 6352 | q7_t * circBuffer, |
modtronix | 10:6444e6c798ce | 6353 | int32_t L, |
modtronix | 10:6444e6c798ce | 6354 | uint16_t * writeOffset, |
modtronix | 10:6444e6c798ce | 6355 | int32_t bufferInc, |
modtronix | 10:6444e6c798ce | 6356 | const q7_t * src, |
modtronix | 10:6444e6c798ce | 6357 | int32_t srcInc, |
modtronix | 10:6444e6c798ce | 6358 | uint32_t blockSize) |
modtronix | 10:6444e6c798ce | 6359 | { |
modtronix | 10:6444e6c798ce | 6360 | uint32_t i = 0u; |
modtronix | 10:6444e6c798ce | 6361 | int32_t wOffset; |
modtronix | 10:6444e6c798ce | 6362 | |
modtronix | 10:6444e6c798ce | 6363 | /* Copy the value of Index pointer that points |
modtronix | 10:6444e6c798ce | 6364 | * to the current location where the input samples to be copied */ |
modtronix | 10:6444e6c798ce | 6365 | wOffset = *writeOffset; |
modtronix | 10:6444e6c798ce | 6366 | |
modtronix | 10:6444e6c798ce | 6367 | /* Loop over the blockSize */ |
modtronix | 10:6444e6c798ce | 6368 | i = blockSize; |
modtronix | 10:6444e6c798ce | 6369 | |
modtronix | 10:6444e6c798ce | 6370 | while(i > 0u) |
modtronix | 10:6444e6c798ce | 6371 | { |
modtronix | 10:6444e6c798ce | 6372 | /* copy the input sample to the circular buffer */ |
modtronix | 10:6444e6c798ce | 6373 | circBuffer[wOffset] = *src; |
modtronix | 10:6444e6c798ce | 6374 | |
modtronix | 10:6444e6c798ce | 6375 | /* Update the input pointer */ |
modtronix | 10:6444e6c798ce | 6376 | src += srcInc; |
modtronix | 10:6444e6c798ce | 6377 | |
modtronix | 10:6444e6c798ce | 6378 | /* Circularly update wOffset. Watch out for positive and negative value */ |
modtronix | 10:6444e6c798ce | 6379 | wOffset += bufferInc; |
modtronix | 10:6444e6c798ce | 6380 | if(wOffset >= L) |
modtronix | 10:6444e6c798ce | 6381 | wOffset -= L; |
modtronix | 10:6444e6c798ce | 6382 | |
modtronix | 10:6444e6c798ce | 6383 | /* Decrement the loop counter */ |
modtronix | 10:6444e6c798ce | 6384 | i--; |
modtronix | 10:6444e6c798ce | 6385 | } |
modtronix | 10:6444e6c798ce | 6386 | |
modtronix | 10:6444e6c798ce | 6387 | /* Update the index pointer */ |
modtronix | 10:6444e6c798ce | 6388 | *writeOffset = wOffset; |
modtronix | 10:6444e6c798ce | 6389 | } |
modtronix | 10:6444e6c798ce | 6390 | |
modtronix | 10:6444e6c798ce | 6391 | |
modtronix | 10:6444e6c798ce | 6392 | |
modtronix | 10:6444e6c798ce | 6393 | /** |
modtronix | 10:6444e6c798ce | 6394 | * @brief Q7 Circular Read function. |
modtronix | 10:6444e6c798ce | 6395 | */ |
modtronix | 10:6444e6c798ce | 6396 | static __INLINE void arm_circularRead_q7( |
modtronix | 10:6444e6c798ce | 6397 | q7_t * circBuffer, |
modtronix | 10:6444e6c798ce | 6398 | int32_t L, |
modtronix | 10:6444e6c798ce | 6399 | int32_t * readOffset, |
modtronix | 10:6444e6c798ce | 6400 | int32_t bufferInc, |
modtronix | 10:6444e6c798ce | 6401 | q7_t * dst, |
modtronix | 10:6444e6c798ce | 6402 | q7_t * dst_base, |
modtronix | 10:6444e6c798ce | 6403 | int32_t dst_length, |
modtronix | 10:6444e6c798ce | 6404 | int32_t dstInc, |
modtronix | 10:6444e6c798ce | 6405 | uint32_t blockSize) |
modtronix | 10:6444e6c798ce | 6406 | { |
modtronix | 10:6444e6c798ce | 6407 | uint32_t i = 0; |
modtronix | 10:6444e6c798ce | 6408 | int32_t rOffset, dst_end; |
modtronix | 10:6444e6c798ce | 6409 | |
modtronix | 10:6444e6c798ce | 6410 | /* Copy the value of Index pointer that points |
modtronix | 10:6444e6c798ce | 6411 | * to the current location from where the input samples to be read */ |
modtronix | 10:6444e6c798ce | 6412 | rOffset = *readOffset; |
modtronix | 10:6444e6c798ce | 6413 | |
modtronix | 10:6444e6c798ce | 6414 | dst_end = (int32_t) (dst_base + dst_length); |
modtronix | 10:6444e6c798ce | 6415 | |
modtronix | 10:6444e6c798ce | 6416 | /* Loop over the blockSize */ |
modtronix | 10:6444e6c798ce | 6417 | i = blockSize; |
modtronix | 10:6444e6c798ce | 6418 | |
modtronix | 10:6444e6c798ce | 6419 | while(i > 0u) |
modtronix | 10:6444e6c798ce | 6420 | { |
modtronix | 10:6444e6c798ce | 6421 | /* copy the sample from the circular buffer to the destination buffer */ |
modtronix | 10:6444e6c798ce | 6422 | *dst = circBuffer[rOffset]; |
modtronix | 10:6444e6c798ce | 6423 | |
modtronix | 10:6444e6c798ce | 6424 | /* Update the input pointer */ |
modtronix | 10:6444e6c798ce | 6425 | dst += dstInc; |
modtronix | 10:6444e6c798ce | 6426 | |
modtronix | 10:6444e6c798ce | 6427 | if(dst == (q7_t *) dst_end) |
modtronix | 10:6444e6c798ce | 6428 | { |
modtronix | 10:6444e6c798ce | 6429 | dst = dst_base; |
modtronix | 10:6444e6c798ce | 6430 | } |
modtronix | 10:6444e6c798ce | 6431 | |
modtronix | 10:6444e6c798ce | 6432 | /* Circularly update rOffset. Watch out for positive and negative value */ |
modtronix | 10:6444e6c798ce | 6433 | rOffset += bufferInc; |
modtronix | 10:6444e6c798ce | 6434 | |
modtronix | 10:6444e6c798ce | 6435 | if(rOffset >= L) |
modtronix | 10:6444e6c798ce | 6436 | { |
modtronix | 10:6444e6c798ce | 6437 | rOffset -= L; |
modtronix | 10:6444e6c798ce | 6438 | } |
modtronix | 10:6444e6c798ce | 6439 | |
modtronix | 10:6444e6c798ce | 6440 | /* Decrement the loop counter */ |
modtronix | 10:6444e6c798ce | 6441 | i--; |
modtronix | 10:6444e6c798ce | 6442 | } |
modtronix | 10:6444e6c798ce | 6443 | |
modtronix | 10:6444e6c798ce | 6444 | /* Update the index pointer */ |
modtronix | 10:6444e6c798ce | 6445 | *readOffset = rOffset; |
modtronix | 10:6444e6c798ce | 6446 | } |
modtronix | 10:6444e6c798ce | 6447 | |
modtronix | 10:6444e6c798ce | 6448 | |
modtronix | 10:6444e6c798ce | 6449 | /** |
modtronix | 10:6444e6c798ce | 6450 | * @brief Sum of the squares of the elements of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6451 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6452 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6453 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6454 | * @return none. |
modtronix | 10:6444e6c798ce | 6455 | */ |
modtronix | 10:6444e6c798ce | 6456 | |
modtronix | 10:6444e6c798ce | 6457 | void arm_power_q31( |
modtronix | 10:6444e6c798ce | 6458 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6459 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6460 | q63_t * pResult); |
modtronix | 10:6444e6c798ce | 6461 | |
modtronix | 10:6444e6c798ce | 6462 | /** |
modtronix | 10:6444e6c798ce | 6463 | * @brief Sum of the squares of the elements of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6464 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6465 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6466 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6467 | * @return none. |
modtronix | 10:6444e6c798ce | 6468 | */ |
modtronix | 10:6444e6c798ce | 6469 | |
modtronix | 10:6444e6c798ce | 6470 | void arm_power_f32( |
modtronix | 10:6444e6c798ce | 6471 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6472 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6473 | float32_t * pResult); |
modtronix | 10:6444e6c798ce | 6474 | |
modtronix | 10:6444e6c798ce | 6475 | /** |
modtronix | 10:6444e6c798ce | 6476 | * @brief Sum of the squares of the elements of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6477 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6478 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6479 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6480 | * @return none. |
modtronix | 10:6444e6c798ce | 6481 | */ |
modtronix | 10:6444e6c798ce | 6482 | |
modtronix | 10:6444e6c798ce | 6483 | void arm_power_q15( |
modtronix | 10:6444e6c798ce | 6484 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6485 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6486 | q63_t * pResult); |
modtronix | 10:6444e6c798ce | 6487 | |
modtronix | 10:6444e6c798ce | 6488 | /** |
modtronix | 10:6444e6c798ce | 6489 | * @brief Sum of the squares of the elements of a Q7 vector. |
modtronix | 10:6444e6c798ce | 6490 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6491 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6492 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6493 | * @return none. |
modtronix | 10:6444e6c798ce | 6494 | */ |
modtronix | 10:6444e6c798ce | 6495 | |
modtronix | 10:6444e6c798ce | 6496 | void arm_power_q7( |
modtronix | 10:6444e6c798ce | 6497 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 6498 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6499 | q31_t * pResult); |
modtronix | 10:6444e6c798ce | 6500 | |
modtronix | 10:6444e6c798ce | 6501 | /** |
modtronix | 10:6444e6c798ce | 6502 | * @brief Mean value of a Q7 vector. |
modtronix | 10:6444e6c798ce | 6503 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6504 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6505 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6506 | * @return none. |
modtronix | 10:6444e6c798ce | 6507 | */ |
modtronix | 10:6444e6c798ce | 6508 | |
modtronix | 10:6444e6c798ce | 6509 | void arm_mean_q7( |
modtronix | 10:6444e6c798ce | 6510 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 6511 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6512 | q7_t * pResult); |
modtronix | 10:6444e6c798ce | 6513 | |
modtronix | 10:6444e6c798ce | 6514 | /** |
modtronix | 10:6444e6c798ce | 6515 | * @brief Mean value of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6516 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6517 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6518 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6519 | * @return none. |
modtronix | 10:6444e6c798ce | 6520 | */ |
modtronix | 10:6444e6c798ce | 6521 | void arm_mean_q15( |
modtronix | 10:6444e6c798ce | 6522 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6523 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6524 | q15_t * pResult); |
modtronix | 10:6444e6c798ce | 6525 | |
modtronix | 10:6444e6c798ce | 6526 | /** |
modtronix | 10:6444e6c798ce | 6527 | * @brief Mean value of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6528 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6529 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6530 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6531 | * @return none. |
modtronix | 10:6444e6c798ce | 6532 | */ |
modtronix | 10:6444e6c798ce | 6533 | void arm_mean_q31( |
modtronix | 10:6444e6c798ce | 6534 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6535 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6536 | q31_t * pResult); |
modtronix | 10:6444e6c798ce | 6537 | |
modtronix | 10:6444e6c798ce | 6538 | /** |
modtronix | 10:6444e6c798ce | 6539 | * @brief Mean value of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6540 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6541 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6542 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6543 | * @return none. |
modtronix | 10:6444e6c798ce | 6544 | */ |
modtronix | 10:6444e6c798ce | 6545 | void arm_mean_f32( |
modtronix | 10:6444e6c798ce | 6546 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6547 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6548 | float32_t * pResult); |
modtronix | 10:6444e6c798ce | 6549 | |
modtronix | 10:6444e6c798ce | 6550 | /** |
modtronix | 10:6444e6c798ce | 6551 | * @brief Variance of the elements of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6552 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6553 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6554 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6555 | * @return none. |
modtronix | 10:6444e6c798ce | 6556 | */ |
modtronix | 10:6444e6c798ce | 6557 | |
modtronix | 10:6444e6c798ce | 6558 | void arm_var_f32( |
modtronix | 10:6444e6c798ce | 6559 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6560 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6561 | float32_t * pResult); |
modtronix | 10:6444e6c798ce | 6562 | |
modtronix | 10:6444e6c798ce | 6563 | /** |
modtronix | 10:6444e6c798ce | 6564 | * @brief Variance of the elements of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6565 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6566 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6567 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6568 | * @return none. |
modtronix | 10:6444e6c798ce | 6569 | */ |
modtronix | 10:6444e6c798ce | 6570 | |
modtronix | 10:6444e6c798ce | 6571 | void arm_var_q31( |
modtronix | 10:6444e6c798ce | 6572 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6573 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6574 | q31_t * pResult); |
modtronix | 10:6444e6c798ce | 6575 | |
modtronix | 10:6444e6c798ce | 6576 | /** |
modtronix | 10:6444e6c798ce | 6577 | * @brief Variance of the elements of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6578 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6579 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6580 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6581 | * @return none. |
modtronix | 10:6444e6c798ce | 6582 | */ |
modtronix | 10:6444e6c798ce | 6583 | |
modtronix | 10:6444e6c798ce | 6584 | void arm_var_q15( |
modtronix | 10:6444e6c798ce | 6585 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6586 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6587 | q15_t * pResult); |
modtronix | 10:6444e6c798ce | 6588 | |
modtronix | 10:6444e6c798ce | 6589 | /** |
modtronix | 10:6444e6c798ce | 6590 | * @brief Root Mean Square of the elements of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6591 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6592 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6593 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6594 | * @return none. |
modtronix | 10:6444e6c798ce | 6595 | */ |
modtronix | 10:6444e6c798ce | 6596 | |
modtronix | 10:6444e6c798ce | 6597 | void arm_rms_f32( |
modtronix | 10:6444e6c798ce | 6598 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6599 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6600 | float32_t * pResult); |
modtronix | 10:6444e6c798ce | 6601 | |
modtronix | 10:6444e6c798ce | 6602 | /** |
modtronix | 10:6444e6c798ce | 6603 | * @brief Root Mean Square of the elements of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6604 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6605 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6606 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6607 | * @return none. |
modtronix | 10:6444e6c798ce | 6608 | */ |
modtronix | 10:6444e6c798ce | 6609 | |
modtronix | 10:6444e6c798ce | 6610 | void arm_rms_q31( |
modtronix | 10:6444e6c798ce | 6611 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6612 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6613 | q31_t * pResult); |
modtronix | 10:6444e6c798ce | 6614 | |
modtronix | 10:6444e6c798ce | 6615 | /** |
modtronix | 10:6444e6c798ce | 6616 | * @brief Root Mean Square of the elements of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6617 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6618 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6619 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6620 | * @return none. |
modtronix | 10:6444e6c798ce | 6621 | */ |
modtronix | 10:6444e6c798ce | 6622 | |
modtronix | 10:6444e6c798ce | 6623 | void arm_rms_q15( |
modtronix | 10:6444e6c798ce | 6624 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6625 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6626 | q15_t * pResult); |
modtronix | 10:6444e6c798ce | 6627 | |
modtronix | 10:6444e6c798ce | 6628 | /** |
modtronix | 10:6444e6c798ce | 6629 | * @brief Standard deviation of the elements of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6630 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6631 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6632 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6633 | * @return none. |
modtronix | 10:6444e6c798ce | 6634 | */ |
modtronix | 10:6444e6c798ce | 6635 | |
modtronix | 10:6444e6c798ce | 6636 | void arm_std_f32( |
modtronix | 10:6444e6c798ce | 6637 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6638 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6639 | float32_t * pResult); |
modtronix | 10:6444e6c798ce | 6640 | |
modtronix | 10:6444e6c798ce | 6641 | /** |
modtronix | 10:6444e6c798ce | 6642 | * @brief Standard deviation of the elements of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6643 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6644 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6645 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6646 | * @return none. |
modtronix | 10:6444e6c798ce | 6647 | */ |
modtronix | 10:6444e6c798ce | 6648 | |
modtronix | 10:6444e6c798ce | 6649 | void arm_std_q31( |
modtronix | 10:6444e6c798ce | 6650 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6651 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6652 | q31_t * pResult); |
modtronix | 10:6444e6c798ce | 6653 | |
modtronix | 10:6444e6c798ce | 6654 | /** |
modtronix | 10:6444e6c798ce | 6655 | * @brief Standard deviation of the elements of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6656 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6657 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6658 | * @param[out] *pResult is output value. |
modtronix | 10:6444e6c798ce | 6659 | * @return none. |
modtronix | 10:6444e6c798ce | 6660 | */ |
modtronix | 10:6444e6c798ce | 6661 | |
modtronix | 10:6444e6c798ce | 6662 | void arm_std_q15( |
modtronix | 10:6444e6c798ce | 6663 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6664 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6665 | q15_t * pResult); |
modtronix | 10:6444e6c798ce | 6666 | |
modtronix | 10:6444e6c798ce | 6667 | /** |
modtronix | 10:6444e6c798ce | 6668 | * @brief Floating-point complex magnitude |
modtronix | 10:6444e6c798ce | 6669 | * @param[in] *pSrc points to the complex input vector |
modtronix | 10:6444e6c798ce | 6670 | * @param[out] *pDst points to the real output vector |
modtronix | 10:6444e6c798ce | 6671 | * @param[in] numSamples number of complex samples in the input vector |
modtronix | 10:6444e6c798ce | 6672 | * @return none. |
modtronix | 10:6444e6c798ce | 6673 | */ |
modtronix | 10:6444e6c798ce | 6674 | |
modtronix | 10:6444e6c798ce | 6675 | void arm_cmplx_mag_f32( |
modtronix | 10:6444e6c798ce | 6676 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6677 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 6678 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6679 | |
modtronix | 10:6444e6c798ce | 6680 | /** |
modtronix | 10:6444e6c798ce | 6681 | * @brief Q31 complex magnitude |
modtronix | 10:6444e6c798ce | 6682 | * @param[in] *pSrc points to the complex input vector |
modtronix | 10:6444e6c798ce | 6683 | * @param[out] *pDst points to the real output vector |
modtronix | 10:6444e6c798ce | 6684 | * @param[in] numSamples number of complex samples in the input vector |
modtronix | 10:6444e6c798ce | 6685 | * @return none. |
modtronix | 10:6444e6c798ce | 6686 | */ |
modtronix | 10:6444e6c798ce | 6687 | |
modtronix | 10:6444e6c798ce | 6688 | void arm_cmplx_mag_q31( |
modtronix | 10:6444e6c798ce | 6689 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6690 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 6691 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6692 | |
modtronix | 10:6444e6c798ce | 6693 | /** |
modtronix | 10:6444e6c798ce | 6694 | * @brief Q15 complex magnitude |
modtronix | 10:6444e6c798ce | 6695 | * @param[in] *pSrc points to the complex input vector |
modtronix | 10:6444e6c798ce | 6696 | * @param[out] *pDst points to the real output vector |
modtronix | 10:6444e6c798ce | 6697 | * @param[in] numSamples number of complex samples in the input vector |
modtronix | 10:6444e6c798ce | 6698 | * @return none. |
modtronix | 10:6444e6c798ce | 6699 | */ |
modtronix | 10:6444e6c798ce | 6700 | |
modtronix | 10:6444e6c798ce | 6701 | void arm_cmplx_mag_q15( |
modtronix | 10:6444e6c798ce | 6702 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6703 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 6704 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6705 | |
modtronix | 10:6444e6c798ce | 6706 | /** |
modtronix | 10:6444e6c798ce | 6707 | * @brief Q15 complex dot product |
modtronix | 10:6444e6c798ce | 6708 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 6709 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 6710 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 6711 | * @param[out] *realResult real part of the result returned here |
modtronix | 10:6444e6c798ce | 6712 | * @param[out] *imagResult imaginary part of the result returned here |
modtronix | 10:6444e6c798ce | 6713 | * @return none. |
modtronix | 10:6444e6c798ce | 6714 | */ |
modtronix | 10:6444e6c798ce | 6715 | |
modtronix | 10:6444e6c798ce | 6716 | void arm_cmplx_dot_prod_q15( |
modtronix | 10:6444e6c798ce | 6717 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 6718 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 6719 | uint32_t numSamples, |
modtronix | 10:6444e6c798ce | 6720 | q31_t * realResult, |
modtronix | 10:6444e6c798ce | 6721 | q31_t * imagResult); |
modtronix | 10:6444e6c798ce | 6722 | |
modtronix | 10:6444e6c798ce | 6723 | /** |
modtronix | 10:6444e6c798ce | 6724 | * @brief Q31 complex dot product |
modtronix | 10:6444e6c798ce | 6725 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 6726 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 6727 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 6728 | * @param[out] *realResult real part of the result returned here |
modtronix | 10:6444e6c798ce | 6729 | * @param[out] *imagResult imaginary part of the result returned here |
modtronix | 10:6444e6c798ce | 6730 | * @return none. |
modtronix | 10:6444e6c798ce | 6731 | */ |
modtronix | 10:6444e6c798ce | 6732 | |
modtronix | 10:6444e6c798ce | 6733 | void arm_cmplx_dot_prod_q31( |
modtronix | 10:6444e6c798ce | 6734 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 6735 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 6736 | uint32_t numSamples, |
modtronix | 10:6444e6c798ce | 6737 | q63_t * realResult, |
modtronix | 10:6444e6c798ce | 6738 | q63_t * imagResult); |
modtronix | 10:6444e6c798ce | 6739 | |
modtronix | 10:6444e6c798ce | 6740 | /** |
modtronix | 10:6444e6c798ce | 6741 | * @brief Floating-point complex dot product |
modtronix | 10:6444e6c798ce | 6742 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 6743 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 6744 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 6745 | * @param[out] *realResult real part of the result returned here |
modtronix | 10:6444e6c798ce | 6746 | * @param[out] *imagResult imaginary part of the result returned here |
modtronix | 10:6444e6c798ce | 6747 | * @return none. |
modtronix | 10:6444e6c798ce | 6748 | */ |
modtronix | 10:6444e6c798ce | 6749 | |
modtronix | 10:6444e6c798ce | 6750 | void arm_cmplx_dot_prod_f32( |
modtronix | 10:6444e6c798ce | 6751 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 6752 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 6753 | uint32_t numSamples, |
modtronix | 10:6444e6c798ce | 6754 | float32_t * realResult, |
modtronix | 10:6444e6c798ce | 6755 | float32_t * imagResult); |
modtronix | 10:6444e6c798ce | 6756 | |
modtronix | 10:6444e6c798ce | 6757 | /** |
modtronix | 10:6444e6c798ce | 6758 | * @brief Q15 complex-by-real multiplication |
modtronix | 10:6444e6c798ce | 6759 | * @param[in] *pSrcCmplx points to the complex input vector |
modtronix | 10:6444e6c798ce | 6760 | * @param[in] *pSrcReal points to the real input vector |
modtronix | 10:6444e6c798ce | 6761 | * @param[out] *pCmplxDst points to the complex output vector |
modtronix | 10:6444e6c798ce | 6762 | * @param[in] numSamples number of samples in each vector |
modtronix | 10:6444e6c798ce | 6763 | * @return none. |
modtronix | 10:6444e6c798ce | 6764 | */ |
modtronix | 10:6444e6c798ce | 6765 | |
modtronix | 10:6444e6c798ce | 6766 | void arm_cmplx_mult_real_q15( |
modtronix | 10:6444e6c798ce | 6767 | q15_t * pSrcCmplx, |
modtronix | 10:6444e6c798ce | 6768 | q15_t * pSrcReal, |
modtronix | 10:6444e6c798ce | 6769 | q15_t * pCmplxDst, |
modtronix | 10:6444e6c798ce | 6770 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6771 | |
modtronix | 10:6444e6c798ce | 6772 | /** |
modtronix | 10:6444e6c798ce | 6773 | * @brief Q31 complex-by-real multiplication |
modtronix | 10:6444e6c798ce | 6774 | * @param[in] *pSrcCmplx points to the complex input vector |
modtronix | 10:6444e6c798ce | 6775 | * @param[in] *pSrcReal points to the real input vector |
modtronix | 10:6444e6c798ce | 6776 | * @param[out] *pCmplxDst points to the complex output vector |
modtronix | 10:6444e6c798ce | 6777 | * @param[in] numSamples number of samples in each vector |
modtronix | 10:6444e6c798ce | 6778 | * @return none. |
modtronix | 10:6444e6c798ce | 6779 | */ |
modtronix | 10:6444e6c798ce | 6780 | |
modtronix | 10:6444e6c798ce | 6781 | void arm_cmplx_mult_real_q31( |
modtronix | 10:6444e6c798ce | 6782 | q31_t * pSrcCmplx, |
modtronix | 10:6444e6c798ce | 6783 | q31_t * pSrcReal, |
modtronix | 10:6444e6c798ce | 6784 | q31_t * pCmplxDst, |
modtronix | 10:6444e6c798ce | 6785 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6786 | |
modtronix | 10:6444e6c798ce | 6787 | /** |
modtronix | 10:6444e6c798ce | 6788 | * @brief Floating-point complex-by-real multiplication |
modtronix | 10:6444e6c798ce | 6789 | * @param[in] *pSrcCmplx points to the complex input vector |
modtronix | 10:6444e6c798ce | 6790 | * @param[in] *pSrcReal points to the real input vector |
modtronix | 10:6444e6c798ce | 6791 | * @param[out] *pCmplxDst points to the complex output vector |
modtronix | 10:6444e6c798ce | 6792 | * @param[in] numSamples number of samples in each vector |
modtronix | 10:6444e6c798ce | 6793 | * @return none. |
modtronix | 10:6444e6c798ce | 6794 | */ |
modtronix | 10:6444e6c798ce | 6795 | |
modtronix | 10:6444e6c798ce | 6796 | void arm_cmplx_mult_real_f32( |
modtronix | 10:6444e6c798ce | 6797 | float32_t * pSrcCmplx, |
modtronix | 10:6444e6c798ce | 6798 | float32_t * pSrcReal, |
modtronix | 10:6444e6c798ce | 6799 | float32_t * pCmplxDst, |
modtronix | 10:6444e6c798ce | 6800 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6801 | |
modtronix | 10:6444e6c798ce | 6802 | /** |
modtronix | 10:6444e6c798ce | 6803 | * @brief Minimum value of a Q7 vector. |
modtronix | 10:6444e6c798ce | 6804 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6805 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6806 | * @param[out] *result is output pointer |
modtronix | 10:6444e6c798ce | 6807 | * @param[in] index is the array index of the minimum value in the input buffer. |
modtronix | 10:6444e6c798ce | 6808 | * @return none. |
modtronix | 10:6444e6c798ce | 6809 | */ |
modtronix | 10:6444e6c798ce | 6810 | |
modtronix | 10:6444e6c798ce | 6811 | void arm_min_q7( |
modtronix | 10:6444e6c798ce | 6812 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 6813 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6814 | q7_t * result, |
modtronix | 10:6444e6c798ce | 6815 | uint32_t * index); |
modtronix | 10:6444e6c798ce | 6816 | |
modtronix | 10:6444e6c798ce | 6817 | /** |
modtronix | 10:6444e6c798ce | 6818 | * @brief Minimum value of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6819 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6820 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6821 | * @param[out] *pResult is output pointer |
modtronix | 10:6444e6c798ce | 6822 | * @param[in] *pIndex is the array index of the minimum value in the input buffer. |
modtronix | 10:6444e6c798ce | 6823 | * @return none. |
modtronix | 10:6444e6c798ce | 6824 | */ |
modtronix | 10:6444e6c798ce | 6825 | |
modtronix | 10:6444e6c798ce | 6826 | void arm_min_q15( |
modtronix | 10:6444e6c798ce | 6827 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6828 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6829 | q15_t * pResult, |
modtronix | 10:6444e6c798ce | 6830 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6831 | |
modtronix | 10:6444e6c798ce | 6832 | /** |
modtronix | 10:6444e6c798ce | 6833 | * @brief Minimum value of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6834 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6835 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6836 | * @param[out] *pResult is output pointer |
modtronix | 10:6444e6c798ce | 6837 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
modtronix | 10:6444e6c798ce | 6838 | * @return none. |
modtronix | 10:6444e6c798ce | 6839 | */ |
modtronix | 10:6444e6c798ce | 6840 | void arm_min_q31( |
modtronix | 10:6444e6c798ce | 6841 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6842 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6843 | q31_t * pResult, |
modtronix | 10:6444e6c798ce | 6844 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6845 | |
modtronix | 10:6444e6c798ce | 6846 | /** |
modtronix | 10:6444e6c798ce | 6847 | * @brief Minimum value of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6848 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 6849 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 6850 | * @param[out] *pResult is output pointer |
modtronix | 10:6444e6c798ce | 6851 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
modtronix | 10:6444e6c798ce | 6852 | * @return none. |
modtronix | 10:6444e6c798ce | 6853 | */ |
modtronix | 10:6444e6c798ce | 6854 | |
modtronix | 10:6444e6c798ce | 6855 | void arm_min_f32( |
modtronix | 10:6444e6c798ce | 6856 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6857 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6858 | float32_t * pResult, |
modtronix | 10:6444e6c798ce | 6859 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6860 | |
modtronix | 10:6444e6c798ce | 6861 | /** |
modtronix | 10:6444e6c798ce | 6862 | * @brief Maximum value of a Q7 vector. |
modtronix | 10:6444e6c798ce | 6863 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 6864 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6865 | * @param[out] *pResult maximum value returned here |
modtronix | 10:6444e6c798ce | 6866 | * @param[out] *pIndex index of maximum value returned here |
modtronix | 10:6444e6c798ce | 6867 | * @return none. |
modtronix | 10:6444e6c798ce | 6868 | */ |
modtronix | 10:6444e6c798ce | 6869 | |
modtronix | 10:6444e6c798ce | 6870 | void arm_max_q7( |
modtronix | 10:6444e6c798ce | 6871 | q7_t * pSrc, |
modtronix | 10:6444e6c798ce | 6872 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6873 | q7_t * pResult, |
modtronix | 10:6444e6c798ce | 6874 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6875 | |
modtronix | 10:6444e6c798ce | 6876 | /** |
modtronix | 10:6444e6c798ce | 6877 | * @brief Maximum value of a Q15 vector. |
modtronix | 10:6444e6c798ce | 6878 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 6879 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6880 | * @param[out] *pResult maximum value returned here |
modtronix | 10:6444e6c798ce | 6881 | * @param[out] *pIndex index of maximum value returned here |
modtronix | 10:6444e6c798ce | 6882 | * @return none. |
modtronix | 10:6444e6c798ce | 6883 | */ |
modtronix | 10:6444e6c798ce | 6884 | |
modtronix | 10:6444e6c798ce | 6885 | void arm_max_q15( |
modtronix | 10:6444e6c798ce | 6886 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 6887 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6888 | q15_t * pResult, |
modtronix | 10:6444e6c798ce | 6889 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6890 | |
modtronix | 10:6444e6c798ce | 6891 | /** |
modtronix | 10:6444e6c798ce | 6892 | * @brief Maximum value of a Q31 vector. |
modtronix | 10:6444e6c798ce | 6893 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 6894 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6895 | * @param[out] *pResult maximum value returned here |
modtronix | 10:6444e6c798ce | 6896 | * @param[out] *pIndex index of maximum value returned here |
modtronix | 10:6444e6c798ce | 6897 | * @return none. |
modtronix | 10:6444e6c798ce | 6898 | */ |
modtronix | 10:6444e6c798ce | 6899 | |
modtronix | 10:6444e6c798ce | 6900 | void arm_max_q31( |
modtronix | 10:6444e6c798ce | 6901 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 6902 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6903 | q31_t * pResult, |
modtronix | 10:6444e6c798ce | 6904 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6905 | |
modtronix | 10:6444e6c798ce | 6906 | /** |
modtronix | 10:6444e6c798ce | 6907 | * @brief Maximum value of a floating-point vector. |
modtronix | 10:6444e6c798ce | 6908 | * @param[in] *pSrc points to the input buffer |
modtronix | 10:6444e6c798ce | 6909 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6910 | * @param[out] *pResult maximum value returned here |
modtronix | 10:6444e6c798ce | 6911 | * @param[out] *pIndex index of maximum value returned here |
modtronix | 10:6444e6c798ce | 6912 | * @return none. |
modtronix | 10:6444e6c798ce | 6913 | */ |
modtronix | 10:6444e6c798ce | 6914 | |
modtronix | 10:6444e6c798ce | 6915 | void arm_max_f32( |
modtronix | 10:6444e6c798ce | 6916 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6917 | uint32_t blockSize, |
modtronix | 10:6444e6c798ce | 6918 | float32_t * pResult, |
modtronix | 10:6444e6c798ce | 6919 | uint32_t * pIndex); |
modtronix | 10:6444e6c798ce | 6920 | |
modtronix | 10:6444e6c798ce | 6921 | /** |
modtronix | 10:6444e6c798ce | 6922 | * @brief Q15 complex-by-complex multiplication |
modtronix | 10:6444e6c798ce | 6923 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 6924 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 6925 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 6926 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 6927 | * @return none. |
modtronix | 10:6444e6c798ce | 6928 | */ |
modtronix | 10:6444e6c798ce | 6929 | |
modtronix | 10:6444e6c798ce | 6930 | void arm_cmplx_mult_cmplx_q15( |
modtronix | 10:6444e6c798ce | 6931 | q15_t * pSrcA, |
modtronix | 10:6444e6c798ce | 6932 | q15_t * pSrcB, |
modtronix | 10:6444e6c798ce | 6933 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 6934 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6935 | |
modtronix | 10:6444e6c798ce | 6936 | /** |
modtronix | 10:6444e6c798ce | 6937 | * @brief Q31 complex-by-complex multiplication |
modtronix | 10:6444e6c798ce | 6938 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 6939 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 6940 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 6941 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 6942 | * @return none. |
modtronix | 10:6444e6c798ce | 6943 | */ |
modtronix | 10:6444e6c798ce | 6944 | |
modtronix | 10:6444e6c798ce | 6945 | void arm_cmplx_mult_cmplx_q31( |
modtronix | 10:6444e6c798ce | 6946 | q31_t * pSrcA, |
modtronix | 10:6444e6c798ce | 6947 | q31_t * pSrcB, |
modtronix | 10:6444e6c798ce | 6948 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 6949 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6950 | |
modtronix | 10:6444e6c798ce | 6951 | /** |
modtronix | 10:6444e6c798ce | 6952 | * @brief Floating-point complex-by-complex multiplication |
modtronix | 10:6444e6c798ce | 6953 | * @param[in] *pSrcA points to the first input vector |
modtronix | 10:6444e6c798ce | 6954 | * @param[in] *pSrcB points to the second input vector |
modtronix | 10:6444e6c798ce | 6955 | * @param[out] *pDst points to the output vector |
modtronix | 10:6444e6c798ce | 6956 | * @param[in] numSamples number of complex samples in each vector |
modtronix | 10:6444e6c798ce | 6957 | * @return none. |
modtronix | 10:6444e6c798ce | 6958 | */ |
modtronix | 10:6444e6c798ce | 6959 | |
modtronix | 10:6444e6c798ce | 6960 | void arm_cmplx_mult_cmplx_f32( |
modtronix | 10:6444e6c798ce | 6961 | float32_t * pSrcA, |
modtronix | 10:6444e6c798ce | 6962 | float32_t * pSrcB, |
modtronix | 10:6444e6c798ce | 6963 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 6964 | uint32_t numSamples); |
modtronix | 10:6444e6c798ce | 6965 | |
modtronix | 10:6444e6c798ce | 6966 | /** |
modtronix | 10:6444e6c798ce | 6967 | * @brief Converts the elements of the floating-point vector to Q31 vector. |
modtronix | 10:6444e6c798ce | 6968 | * @param[in] *pSrc points to the floating-point input vector |
modtronix | 10:6444e6c798ce | 6969 | * @param[out] *pDst points to the Q31 output vector |
modtronix | 10:6444e6c798ce | 6970 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6971 | * @return none. |
modtronix | 10:6444e6c798ce | 6972 | */ |
modtronix | 10:6444e6c798ce | 6973 | void arm_float_to_q31( |
modtronix | 10:6444e6c798ce | 6974 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6975 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 6976 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 6977 | |
modtronix | 10:6444e6c798ce | 6978 | /** |
modtronix | 10:6444e6c798ce | 6979 | * @brief Converts the elements of the floating-point vector to Q15 vector. |
modtronix | 10:6444e6c798ce | 6980 | * @param[in] *pSrc points to the floating-point input vector |
modtronix | 10:6444e6c798ce | 6981 | * @param[out] *pDst points to the Q15 output vector |
modtronix | 10:6444e6c798ce | 6982 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6983 | * @return none |
modtronix | 10:6444e6c798ce | 6984 | */ |
modtronix | 10:6444e6c798ce | 6985 | void arm_float_to_q15( |
modtronix | 10:6444e6c798ce | 6986 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6987 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 6988 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 6989 | |
modtronix | 10:6444e6c798ce | 6990 | /** |
modtronix | 10:6444e6c798ce | 6991 | * @brief Converts the elements of the floating-point vector to Q7 vector. |
modtronix | 10:6444e6c798ce | 6992 | * @param[in] *pSrc points to the floating-point input vector |
modtronix | 10:6444e6c798ce | 6993 | * @param[out] *pDst points to the Q7 output vector |
modtronix | 10:6444e6c798ce | 6994 | * @param[in] blockSize length of the input vector |
modtronix | 10:6444e6c798ce | 6995 | * @return none |
modtronix | 10:6444e6c798ce | 6996 | */ |
modtronix | 10:6444e6c798ce | 6997 | void arm_float_to_q7( |
modtronix | 10:6444e6c798ce | 6998 | float32_t * pSrc, |
modtronix | 10:6444e6c798ce | 6999 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 7000 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 7001 | |
modtronix | 10:6444e6c798ce | 7002 | |
modtronix | 10:6444e6c798ce | 7003 | /** |
modtronix | 10:6444e6c798ce | 7004 | * @brief Converts the elements of the Q31 vector to Q15 vector. |
modtronix | 10:6444e6c798ce | 7005 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 7006 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 7007 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 7008 | * @return none. |
modtronix | 10:6444e6c798ce | 7009 | */ |
modtronix | 10:6444e6c798ce | 7010 | void arm_q31_to_q15( |
modtronix | 10:6444e6c798ce | 7011 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 7012 | q15_t * pDst, |
modtronix | 10:6444e6c798ce | 7013 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 7014 | |
modtronix | 10:6444e6c798ce | 7015 | /** |
modtronix | 10:6444e6c798ce | 7016 | * @brief Converts the elements of the Q31 vector to Q7 vector. |
modtronix | 10:6444e6c798ce | 7017 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 7018 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 7019 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 7020 | * @return none. |
modtronix | 10:6444e6c798ce | 7021 | */ |
modtronix | 10:6444e6c798ce | 7022 | void arm_q31_to_q7( |
modtronix | 10:6444e6c798ce | 7023 | q31_t * pSrc, |
modtronix | 10:6444e6c798ce | 7024 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 7025 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 7026 | |
modtronix | 10:6444e6c798ce | 7027 | /** |
modtronix | 10:6444e6c798ce | 7028 | * @brief Converts the elements of the Q15 vector to floating-point vector. |
modtronix | 10:6444e6c798ce | 7029 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 7030 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 7031 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 7032 | * @return none. |
modtronix | 10:6444e6c798ce | 7033 | */ |
modtronix | 10:6444e6c798ce | 7034 | void arm_q15_to_float( |
modtronix | 10:6444e6c798ce | 7035 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 7036 | float32_t * pDst, |
modtronix | 10:6444e6c798ce | 7037 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 7038 | |
modtronix | 10:6444e6c798ce | 7039 | |
modtronix | 10:6444e6c798ce | 7040 | /** |
modtronix | 10:6444e6c798ce | 7041 | * @brief Converts the elements of the Q15 vector to Q31 vector. |
modtronix | 10:6444e6c798ce | 7042 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 7043 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 7044 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 7045 | * @return none. |
modtronix | 10:6444e6c798ce | 7046 | */ |
modtronix | 10:6444e6c798ce | 7047 | void arm_q15_to_q31( |
modtronix | 10:6444e6c798ce | 7048 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 7049 | q31_t * pDst, |
modtronix | 10:6444e6c798ce | 7050 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 7051 | |
modtronix | 10:6444e6c798ce | 7052 | |
modtronix | 10:6444e6c798ce | 7053 | /** |
modtronix | 10:6444e6c798ce | 7054 | * @brief Converts the elements of the Q15 vector to Q7 vector. |
modtronix | 10:6444e6c798ce | 7055 | * @param[in] *pSrc is input pointer |
modtronix | 10:6444e6c798ce | 7056 | * @param[out] *pDst is output pointer |
modtronix | 10:6444e6c798ce | 7057 | * @param[in] blockSize is the number of samples to process |
modtronix | 10:6444e6c798ce | 7058 | * @return none. |
modtronix | 10:6444e6c798ce | 7059 | */ |
modtronix | 10:6444e6c798ce | 7060 | void arm_q15_to_q7( |
modtronix | 10:6444e6c798ce | 7061 | q15_t * pSrc, |
modtronix | 10:6444e6c798ce | 7062 | q7_t * pDst, |
modtronix | 10:6444e6c798ce | 7063 | uint32_t blockSize); |
modtronix | 10:6444e6c798ce | 7064 | |
modtronix | 10:6444e6c798ce | 7065 | |
modtronix | 10:6444e6c798ce | 7066 | /** |
modtronix | 10:6444e6c798ce | 7067 | * @ingroup groupInterpolation |
modtronix | 10:6444e6c798ce | 7068 | */ |
modtronix | 10:6444e6c798ce | 7069 | |
modtronix | 10:6444e6c798ce | 7070 | /** |
modtronix | 10:6444e6c798ce | 7071 | * @defgroup BilinearInterpolate Bilinear Interpolation |
modtronix | 10:6444e6c798ce | 7072 | * |
modtronix | 10:6444e6c798ce | 7073 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. |
modtronix | 10:6444e6c798ce | 7074 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process |
modtronix | 10:6444e6c798ce | 7075 | * determines values between the grid points. |
modtronix | 10:6444e6c798ce | 7076 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. |
modtronix | 10:6444e6c798ce | 7077 | * Bilinear interpolation is often used in image processing to rescale images. |
modtronix | 10:6444e6c798ce | 7078 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. |
modtronix | 10:6444e6c798ce | 7079 | * |
modtronix | 10:6444e6c798ce | 7080 | * <b>Algorithm</b> |
modtronix | 10:6444e6c798ce | 7081 | * \par |
modtronix | 10:6444e6c798ce | 7082 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. |
modtronix | 10:6444e6c798ce | 7083 | * For floating-point, the instance structure is defined as: |
modtronix | 10:6444e6c798ce | 7084 | * <pre> |
modtronix | 10:6444e6c798ce | 7085 | * typedef struct |
modtronix | 10:6444e6c798ce | 7086 | * { |
modtronix | 10:6444e6c798ce | 7087 | * uint16_t numRows; |
modtronix | 10:6444e6c798ce | 7088 | * uint16_t numCols; |
modtronix | 10:6444e6c798ce | 7089 | * float32_t *pData; |
modtronix | 10:6444e6c798ce | 7090 | * } arm_bilinear_interp_instance_f32; |
modtronix | 10:6444e6c798ce | 7091 | * </pre> |
modtronix | 10:6444e6c798ce | 7092 | * |
modtronix | 10:6444e6c798ce | 7093 | * \par |
modtronix | 10:6444e6c798ce | 7094 | * where <code>numRows</code> specifies the number of rows in the table; |
modtronix | 10:6444e6c798ce | 7095 | * <code>numCols</code> specifies the number of columns in the table; |
modtronix | 10:6444e6c798ce | 7096 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values. |
modtronix | 10:6444e6c798ce | 7097 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes. |
modtronix | 10:6444e6c798ce | 7098 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers. |
modtronix | 10:6444e6c798ce | 7099 | * |
modtronix | 10:6444e6c798ce | 7100 | * \par |
modtronix | 10:6444e6c798ce | 7101 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define: |
modtronix | 10:6444e6c798ce | 7102 | * <pre> |
modtronix | 10:6444e6c798ce | 7103 | * XF = floor(x) |
modtronix | 10:6444e6c798ce | 7104 | * YF = floor(y) |
modtronix | 10:6444e6c798ce | 7105 | * </pre> |
modtronix | 10:6444e6c798ce | 7106 | * \par |
modtronix | 10:6444e6c798ce | 7107 | * The interpolated output point is computed as: |
modtronix | 10:6444e6c798ce | 7108 | * <pre> |
modtronix | 10:6444e6c798ce | 7109 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF)) |
modtronix | 10:6444e6c798ce | 7110 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF)) |
modtronix | 10:6444e6c798ce | 7111 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF) |
modtronix | 10:6444e6c798ce | 7112 | * + f(XF+1, YF+1) * (x-XF)*(y-YF) |
modtronix | 10:6444e6c798ce | 7113 | * </pre> |
modtronix | 10:6444e6c798ce | 7114 | * Note that the coordinates (x, y) contain integer and fractional components. |
modtronix | 10:6444e6c798ce | 7115 | * The integer components specify which portion of the table to use while the |
modtronix | 10:6444e6c798ce | 7116 | * fractional components control the interpolation processor. |
modtronix | 10:6444e6c798ce | 7117 | * |
modtronix | 10:6444e6c798ce | 7118 | * \par |
modtronix | 10:6444e6c798ce | 7119 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. |
modtronix | 10:6444e6c798ce | 7120 | */ |
modtronix | 10:6444e6c798ce | 7121 | |
modtronix | 10:6444e6c798ce | 7122 | /** |
modtronix | 10:6444e6c798ce | 7123 | * @addtogroup BilinearInterpolate |
modtronix | 10:6444e6c798ce | 7124 | * @{ |
modtronix | 10:6444e6c798ce | 7125 | */ |
modtronix | 10:6444e6c798ce | 7126 | |
modtronix | 10:6444e6c798ce | 7127 | /** |
modtronix | 10:6444e6c798ce | 7128 | * |
modtronix | 10:6444e6c798ce | 7129 | * @brief Floating-point bilinear interpolation. |
modtronix | 10:6444e6c798ce | 7130 | * @param[in,out] *S points to an instance of the interpolation structure. |
modtronix | 10:6444e6c798ce | 7131 | * @param[in] X interpolation coordinate. |
modtronix | 10:6444e6c798ce | 7132 | * @param[in] Y interpolation coordinate. |
modtronix | 10:6444e6c798ce | 7133 | * @return out interpolated value. |
modtronix | 10:6444e6c798ce | 7134 | */ |
modtronix | 10:6444e6c798ce | 7135 | |
modtronix | 10:6444e6c798ce | 7136 | |
modtronix | 10:6444e6c798ce | 7137 | static __INLINE float32_t arm_bilinear_interp_f32( |
modtronix | 10:6444e6c798ce | 7138 | const arm_bilinear_interp_instance_f32 * S, |
modtronix | 10:6444e6c798ce | 7139 | float32_t X, |
modtronix | 10:6444e6c798ce | 7140 | float32_t Y) |
modtronix | 10:6444e6c798ce | 7141 | { |
modtronix | 10:6444e6c798ce | 7142 | float32_t out; |
modtronix | 10:6444e6c798ce | 7143 | float32_t f00, f01, f10, f11; |
modtronix | 10:6444e6c798ce | 7144 | float32_t *pData = S->pData; |
modtronix | 10:6444e6c798ce | 7145 | int32_t xIndex, yIndex, index; |
modtronix | 10:6444e6c798ce | 7146 | float32_t xdiff, ydiff; |
modtronix | 10:6444e6c798ce | 7147 | float32_t b1, b2, b3, b4; |
modtronix | 10:6444e6c798ce | 7148 | |
modtronix | 10:6444e6c798ce | 7149 | xIndex = (int32_t) X; |
modtronix | 10:6444e6c798ce | 7150 | yIndex = (int32_t) Y; |
modtronix | 10:6444e6c798ce | 7151 | |
modtronix | 10:6444e6c798ce | 7152 | /* Care taken for table outside boundary */ |
modtronix | 10:6444e6c798ce | 7153 | /* Returns zero output when values are outside table boundary */ |
modtronix | 10:6444e6c798ce | 7154 | if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 |
modtronix | 10:6444e6c798ce | 7155 | || yIndex > (S->numCols - 1)) |
modtronix | 10:6444e6c798ce | 7156 | { |
modtronix | 10:6444e6c798ce | 7157 | return (0); |
modtronix | 10:6444e6c798ce | 7158 | } |
modtronix | 10:6444e6c798ce | 7159 | |
modtronix | 10:6444e6c798ce | 7160 | /* Calculation of index for two nearest points in X-direction */ |
modtronix | 10:6444e6c798ce | 7161 | index = (xIndex - 1) + (yIndex - 1) * S->numCols; |
modtronix | 10:6444e6c798ce | 7162 | |
modtronix | 10:6444e6c798ce | 7163 | |
modtronix | 10:6444e6c798ce | 7164 | /* Read two nearest points in X-direction */ |
modtronix | 10:6444e6c798ce | 7165 | f00 = pData[index]; |
modtronix | 10:6444e6c798ce | 7166 | f01 = pData[index + 1]; |
modtronix | 10:6444e6c798ce | 7167 | |
modtronix | 10:6444e6c798ce | 7168 | /* Calculation of index for two nearest points in Y-direction */ |
modtronix | 10:6444e6c798ce | 7169 | index = (xIndex - 1) + (yIndex) * S->numCols; |
modtronix | 10:6444e6c798ce | 7170 | |
modtronix | 10:6444e6c798ce | 7171 | |
modtronix | 10:6444e6c798ce | 7172 | /* Read two nearest points in Y-direction */ |
modtronix | 10:6444e6c798ce | 7173 | f10 = pData[index]; |
modtronix | 10:6444e6c798ce | 7174 | f11 = pData[index + 1]; |
modtronix | 10:6444e6c798ce | 7175 | |
modtronix | 10:6444e6c798ce | 7176 | /* Calculation of intermediate values */ |
modtronix | 10:6444e6c798ce | 7177 | b1 = f00; |
modtronix | 10:6444e6c798ce | 7178 | b2 = f01 - f00; |
modtronix | 10:6444e6c798ce | 7179 | b3 = f10 - f00; |
modtronix | 10:6444e6c798ce | 7180 | b4 = f00 - f01 - f10 + f11; |
modtronix | 10:6444e6c798ce | 7181 | |
modtronix | 10:6444e6c798ce | 7182 | /* Calculation of fractional part in X */ |
modtronix | 10:6444e6c798ce | 7183 | xdiff = X - xIndex; |
modtronix | 10:6444e6c798ce | 7184 | |
modtronix | 10:6444e6c798ce | 7185 | /* Calculation of fractional part in Y */ |
modtronix | 10:6444e6c798ce | 7186 | ydiff = Y - yIndex; |
modtronix | 10:6444e6c798ce | 7187 | |
modtronix | 10:6444e6c798ce | 7188 | /* Calculation of bi-linear interpolated output */ |
modtronix | 10:6444e6c798ce | 7189 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; |
modtronix | 10:6444e6c798ce | 7190 | |
modtronix | 10:6444e6c798ce | 7191 | /* return to application */ |
modtronix | 10:6444e6c798ce | 7192 | return (out); |
modtronix | 10:6444e6c798ce | 7193 | |
modtronix | 10:6444e6c798ce | 7194 | } |
modtronix | 10:6444e6c798ce | 7195 | |
modtronix | 10:6444e6c798ce | 7196 | /** |
modtronix | 10:6444e6c798ce | 7197 | * |
modtronix | 10:6444e6c798ce | 7198 | * @brief Q31 bilinear interpolation. |
modtronix | 10:6444e6c798ce | 7199 | * @param[in,out] *S points to an instance of the interpolation structure. |
modtronix | 10:6444e6c798ce | 7200 | * @param[in] X interpolation coordinate in 12.20 format. |
modtronix | 10:6444e6c798ce | 7201 | * @param[in] Y interpolation coordinate in 12.20 format. |
modtronix | 10:6444e6c798ce | 7202 | * @return out interpolated value. |
modtronix | 10:6444e6c798ce | 7203 | */ |
modtronix | 10:6444e6c798ce | 7204 | |
modtronix | 10:6444e6c798ce | 7205 | static __INLINE q31_t arm_bilinear_interp_q31( |
modtronix | 10:6444e6c798ce | 7206 | arm_bilinear_interp_instance_q31 * S, |
modtronix | 10:6444e6c798ce | 7207 | q31_t X, |
modtronix | 10:6444e6c798ce | 7208 | q31_t Y) |
modtronix | 10:6444e6c798ce | 7209 | { |
modtronix | 10:6444e6c798ce | 7210 | q31_t out; /* Temporary output */ |
modtronix | 10:6444e6c798ce | 7211 | q31_t acc = 0; /* output */ |
modtronix | 10:6444e6c798ce | 7212 | q31_t xfract, yfract; /* X, Y fractional parts */ |
modtronix | 10:6444e6c798ce | 7213 | q31_t x1, x2, y1, y2; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 7214 | int32_t rI, cI; /* Row and column indices */ |
modtronix | 10:6444e6c798ce | 7215 | q31_t *pYData = S->pData; /* pointer to output table values */ |
modtronix | 10:6444e6c798ce | 7216 | uint32_t nCols = S->numCols; /* num of rows */ |
modtronix | 10:6444e6c798ce | 7217 | |
modtronix | 10:6444e6c798ce | 7218 | |
modtronix | 10:6444e6c798ce | 7219 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7220 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 7221 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 7222 | rI = ((X & 0xFFF00000) >> 20u); |
modtronix | 10:6444e6c798ce | 7223 | |
modtronix | 10:6444e6c798ce | 7224 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7225 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 7226 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 7227 | cI = ((Y & 0xFFF00000) >> 20u); |
modtronix | 10:6444e6c798ce | 7228 | |
modtronix | 10:6444e6c798ce | 7229 | /* Care taken for table outside boundary */ |
modtronix | 10:6444e6c798ce | 7230 | /* Returns zero output when values are outside table boundary */ |
modtronix | 10:6444e6c798ce | 7231 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
modtronix | 10:6444e6c798ce | 7232 | { |
modtronix | 10:6444e6c798ce | 7233 | return (0); |
modtronix | 10:6444e6c798ce | 7234 | } |
modtronix | 10:6444e6c798ce | 7235 | |
modtronix | 10:6444e6c798ce | 7236 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 7237 | /* shift left xfract by 11 to keep 1.31 format */ |
modtronix | 10:6444e6c798ce | 7238 | xfract = (X & 0x000FFFFF) << 11u; |
modtronix | 10:6444e6c798ce | 7239 | |
modtronix | 10:6444e6c798ce | 7240 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 7241 | x1 = pYData[(rI) + nCols * (cI)]; |
modtronix | 10:6444e6c798ce | 7242 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
modtronix | 10:6444e6c798ce | 7243 | |
modtronix | 10:6444e6c798ce | 7244 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 7245 | /* shift left yfract by 11 to keep 1.31 format */ |
modtronix | 10:6444e6c798ce | 7246 | yfract = (Y & 0x000FFFFF) << 11u; |
modtronix | 10:6444e6c798ce | 7247 | |
modtronix | 10:6444e6c798ce | 7248 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 7249 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
modtronix | 10:6444e6c798ce | 7250 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
modtronix | 10:6444e6c798ce | 7251 | |
modtronix | 10:6444e6c798ce | 7252 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ |
modtronix | 10:6444e6c798ce | 7253 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); |
modtronix | 10:6444e6c798ce | 7254 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); |
modtronix | 10:6444e6c798ce | 7255 | |
modtronix | 10:6444e6c798ce | 7256 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ |
modtronix | 10:6444e6c798ce | 7257 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); |
modtronix | 10:6444e6c798ce | 7258 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); |
modtronix | 10:6444e6c798ce | 7259 | |
modtronix | 10:6444e6c798ce | 7260 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ |
modtronix | 10:6444e6c798ce | 7261 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); |
modtronix | 10:6444e6c798ce | 7262 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
modtronix | 10:6444e6c798ce | 7263 | |
modtronix | 10:6444e6c798ce | 7264 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ |
modtronix | 10:6444e6c798ce | 7265 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); |
modtronix | 10:6444e6c798ce | 7266 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
modtronix | 10:6444e6c798ce | 7267 | |
modtronix | 10:6444e6c798ce | 7268 | /* Convert acc to 1.31(q31) format */ |
modtronix | 10:6444e6c798ce | 7269 | return (acc << 2u); |
modtronix | 10:6444e6c798ce | 7270 | |
modtronix | 10:6444e6c798ce | 7271 | } |
modtronix | 10:6444e6c798ce | 7272 | |
modtronix | 10:6444e6c798ce | 7273 | /** |
modtronix | 10:6444e6c798ce | 7274 | * @brief Q15 bilinear interpolation. |
modtronix | 10:6444e6c798ce | 7275 | * @param[in,out] *S points to an instance of the interpolation structure. |
modtronix | 10:6444e6c798ce | 7276 | * @param[in] X interpolation coordinate in 12.20 format. |
modtronix | 10:6444e6c798ce | 7277 | * @param[in] Y interpolation coordinate in 12.20 format. |
modtronix | 10:6444e6c798ce | 7278 | * @return out interpolated value. |
modtronix | 10:6444e6c798ce | 7279 | */ |
modtronix | 10:6444e6c798ce | 7280 | |
modtronix | 10:6444e6c798ce | 7281 | static __INLINE q15_t arm_bilinear_interp_q15( |
modtronix | 10:6444e6c798ce | 7282 | arm_bilinear_interp_instance_q15 * S, |
modtronix | 10:6444e6c798ce | 7283 | q31_t X, |
modtronix | 10:6444e6c798ce | 7284 | q31_t Y) |
modtronix | 10:6444e6c798ce | 7285 | { |
modtronix | 10:6444e6c798ce | 7286 | q63_t acc = 0; /* output */ |
modtronix | 10:6444e6c798ce | 7287 | q31_t out; /* Temporary output */ |
modtronix | 10:6444e6c798ce | 7288 | q15_t x1, x2, y1, y2; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 7289 | q31_t xfract, yfract; /* X, Y fractional parts */ |
modtronix | 10:6444e6c798ce | 7290 | int32_t rI, cI; /* Row and column indices */ |
modtronix | 10:6444e6c798ce | 7291 | q15_t *pYData = S->pData; /* pointer to output table values */ |
modtronix | 10:6444e6c798ce | 7292 | uint32_t nCols = S->numCols; /* num of rows */ |
modtronix | 10:6444e6c798ce | 7293 | |
modtronix | 10:6444e6c798ce | 7294 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7295 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 7296 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 7297 | rI = ((X & 0xFFF00000) >> 20); |
modtronix | 10:6444e6c798ce | 7298 | |
modtronix | 10:6444e6c798ce | 7299 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7300 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 7301 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 7302 | cI = ((Y & 0xFFF00000) >> 20); |
modtronix | 10:6444e6c798ce | 7303 | |
modtronix | 10:6444e6c798ce | 7304 | /* Care taken for table outside boundary */ |
modtronix | 10:6444e6c798ce | 7305 | /* Returns zero output when values are outside table boundary */ |
modtronix | 10:6444e6c798ce | 7306 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
modtronix | 10:6444e6c798ce | 7307 | { |
modtronix | 10:6444e6c798ce | 7308 | return (0); |
modtronix | 10:6444e6c798ce | 7309 | } |
modtronix | 10:6444e6c798ce | 7310 | |
modtronix | 10:6444e6c798ce | 7311 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 7312 | /* xfract should be in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7313 | xfract = (X & 0x000FFFFF); |
modtronix | 10:6444e6c798ce | 7314 | |
modtronix | 10:6444e6c798ce | 7315 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 7316 | x1 = pYData[(rI) + nCols * (cI)]; |
modtronix | 10:6444e6c798ce | 7317 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
modtronix | 10:6444e6c798ce | 7318 | |
modtronix | 10:6444e6c798ce | 7319 | |
modtronix | 10:6444e6c798ce | 7320 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 7321 | /* yfract should be in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7322 | yfract = (Y & 0x000FFFFF); |
modtronix | 10:6444e6c798ce | 7323 | |
modtronix | 10:6444e6c798ce | 7324 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 7325 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
modtronix | 10:6444e6c798ce | 7326 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
modtronix | 10:6444e6c798ce | 7327 | |
modtronix | 10:6444e6c798ce | 7328 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ |
modtronix | 10:6444e6c798ce | 7329 | |
modtronix | 10:6444e6c798ce | 7330 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ |
modtronix | 10:6444e6c798ce | 7331 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ |
modtronix | 10:6444e6c798ce | 7332 | out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); |
modtronix | 10:6444e6c798ce | 7333 | acc = ((q63_t) out * (0xFFFFF - yfract)); |
modtronix | 10:6444e6c798ce | 7334 | |
modtronix | 10:6444e6c798ce | 7335 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ |
modtronix | 10:6444e6c798ce | 7336 | out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); |
modtronix | 10:6444e6c798ce | 7337 | acc += ((q63_t) out * (xfract)); |
modtronix | 10:6444e6c798ce | 7338 | |
modtronix | 10:6444e6c798ce | 7339 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ |
modtronix | 10:6444e6c798ce | 7340 | out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); |
modtronix | 10:6444e6c798ce | 7341 | acc += ((q63_t) out * (yfract)); |
modtronix | 10:6444e6c798ce | 7342 | |
modtronix | 10:6444e6c798ce | 7343 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ |
modtronix | 10:6444e6c798ce | 7344 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); |
modtronix | 10:6444e6c798ce | 7345 | acc += ((q63_t) out * (yfract)); |
modtronix | 10:6444e6c798ce | 7346 | |
modtronix | 10:6444e6c798ce | 7347 | /* acc is in 13.51 format and down shift acc by 36 times */ |
modtronix | 10:6444e6c798ce | 7348 | /* Convert out to 1.15 format */ |
modtronix | 10:6444e6c798ce | 7349 | return (acc >> 36); |
modtronix | 10:6444e6c798ce | 7350 | |
modtronix | 10:6444e6c798ce | 7351 | } |
modtronix | 10:6444e6c798ce | 7352 | |
modtronix | 10:6444e6c798ce | 7353 | /** |
modtronix | 10:6444e6c798ce | 7354 | * @brief Q7 bilinear interpolation. |
modtronix | 10:6444e6c798ce | 7355 | * @param[in,out] *S points to an instance of the interpolation structure. |
modtronix | 10:6444e6c798ce | 7356 | * @param[in] X interpolation coordinate in 12.20 format. |
modtronix | 10:6444e6c798ce | 7357 | * @param[in] Y interpolation coordinate in 12.20 format. |
modtronix | 10:6444e6c798ce | 7358 | * @return out interpolated value. |
modtronix | 10:6444e6c798ce | 7359 | */ |
modtronix | 10:6444e6c798ce | 7360 | |
modtronix | 10:6444e6c798ce | 7361 | static __INLINE q7_t arm_bilinear_interp_q7( |
modtronix | 10:6444e6c798ce | 7362 | arm_bilinear_interp_instance_q7 * S, |
modtronix | 10:6444e6c798ce | 7363 | q31_t X, |
modtronix | 10:6444e6c798ce | 7364 | q31_t Y) |
modtronix | 10:6444e6c798ce | 7365 | { |
modtronix | 10:6444e6c798ce | 7366 | q63_t acc = 0; /* output */ |
modtronix | 10:6444e6c798ce | 7367 | q31_t out; /* Temporary output */ |
modtronix | 10:6444e6c798ce | 7368 | q31_t xfract, yfract; /* X, Y fractional parts */ |
modtronix | 10:6444e6c798ce | 7369 | q7_t x1, x2, y1, y2; /* Nearest output values */ |
modtronix | 10:6444e6c798ce | 7370 | int32_t rI, cI; /* Row and column indices */ |
modtronix | 10:6444e6c798ce | 7371 | q7_t *pYData = S->pData; /* pointer to output table values */ |
modtronix | 10:6444e6c798ce | 7372 | uint32_t nCols = S->numCols; /* num of rows */ |
modtronix | 10:6444e6c798ce | 7373 | |
modtronix | 10:6444e6c798ce | 7374 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7375 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 7376 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 7377 | rI = ((X & 0xFFF00000) >> 20); |
modtronix | 10:6444e6c798ce | 7378 | |
modtronix | 10:6444e6c798ce | 7379 | /* Input is in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7380 | /* 12 bits for the table index */ |
modtronix | 10:6444e6c798ce | 7381 | /* Index value calculation */ |
modtronix | 10:6444e6c798ce | 7382 | cI = ((Y & 0xFFF00000) >> 20); |
modtronix | 10:6444e6c798ce | 7383 | |
modtronix | 10:6444e6c798ce | 7384 | /* Care taken for table outside boundary */ |
modtronix | 10:6444e6c798ce | 7385 | /* Returns zero output when values are outside table boundary */ |
modtronix | 10:6444e6c798ce | 7386 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
modtronix | 10:6444e6c798ce | 7387 | { |
modtronix | 10:6444e6c798ce | 7388 | return (0); |
modtronix | 10:6444e6c798ce | 7389 | } |
modtronix | 10:6444e6c798ce | 7390 | |
modtronix | 10:6444e6c798ce | 7391 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 7392 | /* xfract should be in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7393 | xfract = (X & 0x000FFFFF); |
modtronix | 10:6444e6c798ce | 7394 | |
modtronix | 10:6444e6c798ce | 7395 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 7396 | x1 = pYData[(rI) + nCols * (cI)]; |
modtronix | 10:6444e6c798ce | 7397 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
modtronix | 10:6444e6c798ce | 7398 | |
modtronix | 10:6444e6c798ce | 7399 | |
modtronix | 10:6444e6c798ce | 7400 | /* 20 bits for the fractional part */ |
modtronix | 10:6444e6c798ce | 7401 | /* yfract should be in 12.20 format */ |
modtronix | 10:6444e6c798ce | 7402 | yfract = (Y & 0x000FFFFF); |
modtronix | 10:6444e6c798ce | 7403 | |
modtronix | 10:6444e6c798ce | 7404 | /* Read two nearest output values from the index */ |
modtronix | 10:6444e6c798ce | 7405 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
modtronix | 10:6444e6c798ce | 7406 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
modtronix | 10:6444e6c798ce | 7407 | |
modtronix | 10:6444e6c798ce | 7408 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ |
modtronix | 10:6444e6c798ce | 7409 | out = ((x1 * (0xFFFFF - xfract))); |
modtronix | 10:6444e6c798ce | 7410 | acc = (((q63_t) out * (0xFFFFF - yfract))); |
modtronix | 10:6444e6c798ce | 7411 | |
modtronix | 10:6444e6c798ce | 7412 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ |
modtronix | 10:6444e6c798ce | 7413 | out = ((x2 * (0xFFFFF - yfract))); |
modtronix | 10:6444e6c798ce | 7414 | acc += (((q63_t) out * (xfract))); |
modtronix | 10:6444e6c798ce | 7415 | |
modtronix | 10:6444e6c798ce | 7416 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ |
modtronix | 10:6444e6c798ce | 7417 | out = ((y1 * (0xFFFFF - xfract))); |
modtronix | 10:6444e6c798ce | 7418 | acc += (((q63_t) out * (yfract))); |
modtronix | 10:6444e6c798ce | 7419 | |
modtronix | 10:6444e6c798ce | 7420 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ |
modtronix | 10:6444e6c798ce | 7421 | out = ((y2 * (yfract))); |
modtronix | 10:6444e6c798ce | 7422 | acc += (((q63_t) out * (xfract))); |
modtronix | 10:6444e6c798ce | 7423 | |
modtronix | 10:6444e6c798ce | 7424 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ |
modtronix | 10:6444e6c798ce | 7425 | return (acc >> 40); |
modtronix | 10:6444e6c798ce | 7426 | |
modtronix | 10:6444e6c798ce | 7427 | } |
modtronix | 10:6444e6c798ce | 7428 | |
modtronix | 10:6444e6c798ce | 7429 | /** |
modtronix | 10:6444e6c798ce | 7430 | * @} end of BilinearInterpolate group |
modtronix | 10:6444e6c798ce | 7431 | */ |
modtronix | 10:6444e6c798ce | 7432 | |
modtronix | 10:6444e6c798ce | 7433 | |
modtronix | 10:6444e6c798ce | 7434 | //SMMLAR |
modtronix | 10:6444e6c798ce | 7435 | #define multAcc_32x32_keep32_R(a, x, y) \ |
modtronix | 10:6444e6c798ce | 7436 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) |
modtronix | 10:6444e6c798ce | 7437 | |
modtronix | 10:6444e6c798ce | 7438 | //SMMLSR |
modtronix | 10:6444e6c798ce | 7439 | #define multSub_32x32_keep32_R(a, x, y) \ |
modtronix | 10:6444e6c798ce | 7440 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) |
modtronix | 10:6444e6c798ce | 7441 | |
modtronix | 10:6444e6c798ce | 7442 | //SMMULR |
modtronix | 10:6444e6c798ce | 7443 | #define mult_32x32_keep32_R(a, x, y) \ |
modtronix | 10:6444e6c798ce | 7444 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) |
modtronix | 10:6444e6c798ce | 7445 | |
modtronix | 10:6444e6c798ce | 7446 | //SMMLA |
modtronix | 10:6444e6c798ce | 7447 | #define multAcc_32x32_keep32(a, x, y) \ |
modtronix | 10:6444e6c798ce | 7448 | a += (q31_t) (((q63_t) x * y) >> 32) |
modtronix | 10:6444e6c798ce | 7449 | |
modtronix | 10:6444e6c798ce | 7450 | //SMMLS |
modtronix | 10:6444e6c798ce | 7451 | #define multSub_32x32_keep32(a, x, y) \ |
modtronix | 10:6444e6c798ce | 7452 | a -= (q31_t) (((q63_t) x * y) >> 32) |
modtronix | 10:6444e6c798ce | 7453 | |
modtronix | 10:6444e6c798ce | 7454 | //SMMUL |
modtronix | 10:6444e6c798ce | 7455 | #define mult_32x32_keep32(a, x, y) \ |
modtronix | 10:6444e6c798ce | 7456 | a = (q31_t) (((q63_t) x * y ) >> 32) |
modtronix | 10:6444e6c798ce | 7457 | |
modtronix | 10:6444e6c798ce | 7458 | |
modtronix | 10:6444e6c798ce | 7459 | #if defined ( __CC_ARM ) //Keil |
modtronix | 10:6444e6c798ce | 7460 | |
modtronix | 10:6444e6c798ce | 7461 | //Enter low optimization region - place directly above function definition |
modtronix | 10:6444e6c798ce | 7462 | #ifdef ARM_MATH_CM4 |
modtronix | 10:6444e6c798ce | 7463 | #define LOW_OPTIMIZATION_ENTER \ |
modtronix | 10:6444e6c798ce | 7464 | _Pragma ("push") \ |
modtronix | 10:6444e6c798ce | 7465 | _Pragma ("O1") |
modtronix | 10:6444e6c798ce | 7466 | #else |
modtronix | 10:6444e6c798ce | 7467 | #define LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7468 | #endif |
modtronix | 10:6444e6c798ce | 7469 | |
modtronix | 10:6444e6c798ce | 7470 | //Exit low optimization region - place directly after end of function definition |
modtronix | 10:6444e6c798ce | 7471 | #ifdef ARM_MATH_CM4 |
modtronix | 10:6444e6c798ce | 7472 | #define LOW_OPTIMIZATION_EXIT \ |
modtronix | 10:6444e6c798ce | 7473 | _Pragma ("pop") |
modtronix | 10:6444e6c798ce | 7474 | #else |
modtronix | 10:6444e6c798ce | 7475 | #define LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7476 | #endif |
modtronix | 10:6444e6c798ce | 7477 | |
modtronix | 10:6444e6c798ce | 7478 | //Enter low optimization region - place directly above function definition |
modtronix | 10:6444e6c798ce | 7479 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7480 | |
modtronix | 10:6444e6c798ce | 7481 | //Exit low optimization region - place directly after end of function definition |
modtronix | 10:6444e6c798ce | 7482 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7483 | |
modtronix | 10:6444e6c798ce | 7484 | #elif defined(__ICCARM__) //IAR |
modtronix | 10:6444e6c798ce | 7485 | |
modtronix | 10:6444e6c798ce | 7486 | //Enter low optimization region - place directly above function definition |
modtronix | 10:6444e6c798ce | 7487 | #ifdef ARM_MATH_CM4 |
modtronix | 10:6444e6c798ce | 7488 | #define LOW_OPTIMIZATION_ENTER \ |
modtronix | 10:6444e6c798ce | 7489 | _Pragma ("optimize=low") |
modtronix | 10:6444e6c798ce | 7490 | #else |
modtronix | 10:6444e6c798ce | 7491 | #define LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7492 | #endif |
modtronix | 10:6444e6c798ce | 7493 | |
modtronix | 10:6444e6c798ce | 7494 | //Exit low optimization region - place directly after end of function definition |
modtronix | 10:6444e6c798ce | 7495 | #define LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7496 | |
modtronix | 10:6444e6c798ce | 7497 | //Enter low optimization region - place directly above function definition |
modtronix | 10:6444e6c798ce | 7498 | #ifdef ARM_MATH_CM4 |
modtronix | 10:6444e6c798ce | 7499 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ |
modtronix | 10:6444e6c798ce | 7500 | _Pragma ("optimize=low") |
modtronix | 10:6444e6c798ce | 7501 | #else |
modtronix | 10:6444e6c798ce | 7502 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7503 | #endif |
modtronix | 10:6444e6c798ce | 7504 | |
modtronix | 10:6444e6c798ce | 7505 | //Exit low optimization region - place directly after end of function definition |
modtronix | 10:6444e6c798ce | 7506 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7507 | |
modtronix | 10:6444e6c798ce | 7508 | #elif defined(__GNUC__) |
modtronix | 10:6444e6c798ce | 7509 | |
modtronix | 10:6444e6c798ce | 7510 | #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) |
modtronix | 10:6444e6c798ce | 7511 | |
modtronix | 10:6444e6c798ce | 7512 | #define LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7513 | |
modtronix | 10:6444e6c798ce | 7514 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7515 | |
modtronix | 10:6444e6c798ce | 7516 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7517 | |
modtronix | 10:6444e6c798ce | 7518 | #elif defined(__CSMC__) // Cosmic |
modtronix | 10:6444e6c798ce | 7519 | |
modtronix | 10:6444e6c798ce | 7520 | #define LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7521 | #define LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7522 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
modtronix | 10:6444e6c798ce | 7523 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
modtronix | 10:6444e6c798ce | 7524 | |
modtronix | 10:6444e6c798ce | 7525 | #endif |
modtronix | 10:6444e6c798ce | 7526 | |
modtronix | 10:6444e6c798ce | 7527 | |
modtronix | 10:6444e6c798ce | 7528 | #ifdef __cplusplus |
modtronix | 10:6444e6c798ce | 7529 | } |
modtronix | 10:6444e6c798ce | 7530 | #endif |
modtronix | 10:6444e6c798ce | 7531 | |
modtronix | 10:6444e6c798ce | 7532 | |
modtronix | 10:6444e6c798ce | 7533 | #endif /* _ARM_MATH_H */ |
modtronix | 10:6444e6c798ce | 7534 | |
modtronix | 10:6444e6c798ce | 7535 | /** |
modtronix | 10:6444e6c798ce | 7536 | * |
modtronix | 10:6444e6c798ce | 7537 | * End of file. |
modtronix | 10:6444e6c798ce | 7538 | */ |