V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.
Dependents: MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more
arm_math.h@0:3d9c67d97d6f, 2014-07-28 (annotated)
- Committer:
- emh203
- Date:
- Mon Jul 28 15:03:15 2014 +0000
- Revision:
- 0:3d9c67d97d6f
1st working commit. Had to remove arm_bitreversal2.s arm_cfft_f32.c and arm_rfft_fast_f32.c. The .s will not assemble. For now I removed these functions so we could at least have a library for the other functions.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emh203 | 0:3d9c67d97d6f | 1 | /* ---------------------------------------------------------------------- |
emh203 | 0:3d9c67d97d6f | 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. |
emh203 | 0:3d9c67d97d6f | 3 | * |
emh203 | 0:3d9c67d97d6f | 4 | * $Date: 12. March 2014 |
emh203 | 0:3d9c67d97d6f | 5 | * $Revision: V1.4.3 |
emh203 | 0:3d9c67d97d6f | 6 | * |
emh203 | 0:3d9c67d97d6f | 7 | * Project: CMSIS DSP Library |
emh203 | 0:3d9c67d97d6f | 8 | * Title: arm_math.h |
emh203 | 0:3d9c67d97d6f | 9 | * |
emh203 | 0:3d9c67d97d6f | 10 | * Description: Public header file for CMSIS DSP Library |
emh203 | 0:3d9c67d97d6f | 11 | * |
emh203 | 0:3d9c67d97d6f | 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 |
emh203 | 0:3d9c67d97d6f | 13 | * |
emh203 | 0:3d9c67d97d6f | 14 | * Redistribution and use in source and binary forms, with or without |
emh203 | 0:3d9c67d97d6f | 15 | * modification, are permitted provided that the following conditions |
emh203 | 0:3d9c67d97d6f | 16 | * are met: |
emh203 | 0:3d9c67d97d6f | 17 | * - Redistributions of source code must retain the above copyright |
emh203 | 0:3d9c67d97d6f | 18 | * notice, this list of conditions and the following disclaimer. |
emh203 | 0:3d9c67d97d6f | 19 | * - Redistributions in binary form must reproduce the above copyright |
emh203 | 0:3d9c67d97d6f | 20 | * notice, this list of conditions and the following disclaimer in |
emh203 | 0:3d9c67d97d6f | 21 | * the documentation and/or other materials provided with the |
emh203 | 0:3d9c67d97d6f | 22 | * distribution. |
emh203 | 0:3d9c67d97d6f | 23 | * - Neither the name of ARM LIMITED nor the names of its contributors |
emh203 | 0:3d9c67d97d6f | 24 | * may be used to endorse or promote products derived from this |
emh203 | 0:3d9c67d97d6f | 25 | * software without specific prior written permission. |
emh203 | 0:3d9c67d97d6f | 26 | * |
emh203 | 0:3d9c67d97d6f | 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
emh203 | 0:3d9c67d97d6f | 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
emh203 | 0:3d9c67d97d6f | 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
emh203 | 0:3d9c67d97d6f | 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
emh203 | 0:3d9c67d97d6f | 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
emh203 | 0:3d9c67d97d6f | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
emh203 | 0:3d9c67d97d6f | 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
emh203 | 0:3d9c67d97d6f | 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
emh203 | 0:3d9c67d97d6f | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
emh203 | 0:3d9c67d97d6f | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
emh203 | 0:3d9c67d97d6f | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
emh203 | 0:3d9c67d97d6f | 38 | * POSSIBILITY OF SUCH DAMAGE. |
emh203 | 0:3d9c67d97d6f | 39 | * -------------------------------------------------------------------- */ |
emh203 | 0:3d9c67d97d6f | 40 | |
emh203 | 0:3d9c67d97d6f | 41 | /** |
emh203 | 0:3d9c67d97d6f | 42 | \mainpage CMSIS DSP Software Library |
emh203 | 0:3d9c67d97d6f | 43 | * |
emh203 | 0:3d9c67d97d6f | 44 | * Introduction |
emh203 | 0:3d9c67d97d6f | 45 | * ------------ |
emh203 | 0:3d9c67d97d6f | 46 | * |
emh203 | 0:3d9c67d97d6f | 47 | * This user manual describes the CMSIS DSP software library, |
emh203 | 0:3d9c67d97d6f | 48 | * a suite of common signal processing functions for use on Cortex-M processor based devices. |
emh203 | 0:3d9c67d97d6f | 49 | * |
emh203 | 0:3d9c67d97d6f | 50 | * The library is divided into a number of functions each covering a specific category: |
emh203 | 0:3d9c67d97d6f | 51 | * - Basic math functions |
emh203 | 0:3d9c67d97d6f | 52 | * - Fast math functions |
emh203 | 0:3d9c67d97d6f | 53 | * - Complex math functions |
emh203 | 0:3d9c67d97d6f | 54 | * - Filters |
emh203 | 0:3d9c67d97d6f | 55 | * - Matrix functions |
emh203 | 0:3d9c67d97d6f | 56 | * - Transforms |
emh203 | 0:3d9c67d97d6f | 57 | * - Motor control functions |
emh203 | 0:3d9c67d97d6f | 58 | * - Statistical functions |
emh203 | 0:3d9c67d97d6f | 59 | * - Support functions |
emh203 | 0:3d9c67d97d6f | 60 | * - Interpolation functions |
emh203 | 0:3d9c67d97d6f | 61 | * |
emh203 | 0:3d9c67d97d6f | 62 | * The library has separate functions for operating on 8-bit integers, 16-bit integers, |
emh203 | 0:3d9c67d97d6f | 63 | * 32-bit integer and 32-bit floating-point values. |
emh203 | 0:3d9c67d97d6f | 64 | * |
emh203 | 0:3d9c67d97d6f | 65 | * Using the Library |
emh203 | 0:3d9c67d97d6f | 66 | * ------------ |
emh203 | 0:3d9c67d97d6f | 67 | * |
emh203 | 0:3d9c67d97d6f | 68 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder. |
emh203 | 0:3d9c67d97d6f | 69 | * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) |
emh203 | 0:3d9c67d97d6f | 70 | * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) |
emh203 | 0:3d9c67d97d6f | 71 | * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) |
emh203 | 0:3d9c67d97d6f | 72 | * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) |
emh203 | 0:3d9c67d97d6f | 73 | * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) |
emh203 | 0:3d9c67d97d6f | 74 | * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) |
emh203 | 0:3d9c67d97d6f | 75 | * - arm_cortexM0l_math.lib (Little endian on Cortex-M0) |
emh203 | 0:3d9c67d97d6f | 76 | * - arm_cortexM0b_math.lib (Big endian on Cortex-M3) |
emh203 | 0:3d9c67d97d6f | 77 | * |
emh203 | 0:3d9c67d97d6f | 78 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder. |
emh203 | 0:3d9c67d97d6f | 79 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single |
emh203 | 0:3d9c67d97d6f | 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. |
emh203 | 0:3d9c67d97d6f | 81 | * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or |
emh203 | 0:3d9c67d97d6f | 82 | * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. |
emh203 | 0:3d9c67d97d6f | 83 | * |
emh203 | 0:3d9c67d97d6f | 84 | * Examples |
emh203 | 0:3d9c67d97d6f | 85 | * -------- |
emh203 | 0:3d9c67d97d6f | 86 | * |
emh203 | 0:3d9c67d97d6f | 87 | * The library ships with a number of examples which demonstrate how to use the library functions. |
emh203 | 0:3d9c67d97d6f | 88 | * |
emh203 | 0:3d9c67d97d6f | 89 | * Toolchain Support |
emh203 | 0:3d9c67d97d6f | 90 | * ------------ |
emh203 | 0:3d9c67d97d6f | 91 | * |
emh203 | 0:3d9c67d97d6f | 92 | * The library has been developed and tested with MDK-ARM version 4.60. |
emh203 | 0:3d9c67d97d6f | 93 | * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. |
emh203 | 0:3d9c67d97d6f | 94 | * |
emh203 | 0:3d9c67d97d6f | 95 | * Building the Library |
emh203 | 0:3d9c67d97d6f | 96 | * ------------ |
emh203 | 0:3d9c67d97d6f | 97 | * |
emh203 | 0:3d9c67d97d6f | 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. |
emh203 | 0:3d9c67d97d6f | 99 | * - arm_cortexM_math.uvproj |
emh203 | 0:3d9c67d97d6f | 100 | * |
emh203 | 0:3d9c67d97d6f | 101 | * |
emh203 | 0:3d9c67d97d6f | 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. |
emh203 | 0:3d9c67d97d6f | 103 | * |
emh203 | 0:3d9c67d97d6f | 104 | * Pre-processor Macros |
emh203 | 0:3d9c67d97d6f | 105 | * ------------ |
emh203 | 0:3d9c67d97d6f | 106 | * |
emh203 | 0:3d9c67d97d6f | 107 | * Each library project have differant pre-processor macros. |
emh203 | 0:3d9c67d97d6f | 108 | * |
emh203 | 0:3d9c67d97d6f | 109 | * - UNALIGNED_SUPPORT_DISABLE: |
emh203 | 0:3d9c67d97d6f | 110 | * |
emh203 | 0:3d9c67d97d6f | 111 | * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access |
emh203 | 0:3d9c67d97d6f | 112 | * |
emh203 | 0:3d9c67d97d6f | 113 | * - ARM_MATH_BIG_ENDIAN: |
emh203 | 0:3d9c67d97d6f | 114 | * |
emh203 | 0:3d9c67d97d6f | 115 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. |
emh203 | 0:3d9c67d97d6f | 116 | * |
emh203 | 0:3d9c67d97d6f | 117 | * - ARM_MATH_MATRIX_CHECK: |
emh203 | 0:3d9c67d97d6f | 118 | * |
emh203 | 0:3d9c67d97d6f | 119 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices |
emh203 | 0:3d9c67d97d6f | 120 | * |
emh203 | 0:3d9c67d97d6f | 121 | * - ARM_MATH_ROUNDING: |
emh203 | 0:3d9c67d97d6f | 122 | * |
emh203 | 0:3d9c67d97d6f | 123 | * Define macro ARM_MATH_ROUNDING for rounding on support functions |
emh203 | 0:3d9c67d97d6f | 124 | * |
emh203 | 0:3d9c67d97d6f | 125 | * - ARM_MATH_CMx: |
emh203 | 0:3d9c67d97d6f | 126 | * |
emh203 | 0:3d9c67d97d6f | 127 | * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target |
emh203 | 0:3d9c67d97d6f | 128 | * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target. |
emh203 | 0:3d9c67d97d6f | 129 | * |
emh203 | 0:3d9c67d97d6f | 130 | * - __FPU_PRESENT: |
emh203 | 0:3d9c67d97d6f | 131 | * |
emh203 | 0:3d9c67d97d6f | 132 | * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries |
emh203 | 0:3d9c67d97d6f | 133 | * |
emh203 | 0:3d9c67d97d6f | 134 | * <hr> |
emh203 | 0:3d9c67d97d6f | 135 | * CMSIS-DSP in ARM::CMSIS Pack |
emh203 | 0:3d9c67d97d6f | 136 | * ----------------------------- |
emh203 | 0:3d9c67d97d6f | 137 | * |
emh203 | 0:3d9c67d97d6f | 138 | * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories: |
emh203 | 0:3d9c67d97d6f | 139 | * |File/Folder |Content | |
emh203 | 0:3d9c67d97d6f | 140 | * |------------------------------|------------------------------------------------------------------------| |
emh203 | 0:3d9c67d97d6f | 141 | * |\b CMSIS\\Documentation\\DSP | This documentation | |
emh203 | 0:3d9c67d97d6f | 142 | * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | |
emh203 | 0:3d9c67d97d6f | 143 | * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | |
emh203 | 0:3d9c67d97d6f | 144 | * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | |
emh203 | 0:3d9c67d97d6f | 145 | * |
emh203 | 0:3d9c67d97d6f | 146 | * <hr> |
emh203 | 0:3d9c67d97d6f | 147 | * Revision History of CMSIS-DSP |
emh203 | 0:3d9c67d97d6f | 148 | * ------------ |
emh203 | 0:3d9c67d97d6f | 149 | * Please refer to \ref ChangeLog_pg. |
emh203 | 0:3d9c67d97d6f | 150 | * |
emh203 | 0:3d9c67d97d6f | 151 | * Copyright Notice |
emh203 | 0:3d9c67d97d6f | 152 | * ------------ |
emh203 | 0:3d9c67d97d6f | 153 | * |
emh203 | 0:3d9c67d97d6f | 154 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. |
emh203 | 0:3d9c67d97d6f | 155 | */ |
emh203 | 0:3d9c67d97d6f | 156 | |
emh203 | 0:3d9c67d97d6f | 157 | |
emh203 | 0:3d9c67d97d6f | 158 | /** |
emh203 | 0:3d9c67d97d6f | 159 | * @defgroup groupMath Basic Math Functions |
emh203 | 0:3d9c67d97d6f | 160 | */ |
emh203 | 0:3d9c67d97d6f | 161 | |
emh203 | 0:3d9c67d97d6f | 162 | /** |
emh203 | 0:3d9c67d97d6f | 163 | * @defgroup groupFastMath Fast Math Functions |
emh203 | 0:3d9c67d97d6f | 164 | * This set of functions provides a fast approximation to sine, cosine, and square root. |
emh203 | 0:3d9c67d97d6f | 165 | * As compared to most of the other functions in the CMSIS math library, the fast math functions |
emh203 | 0:3d9c67d97d6f | 166 | * operate on individual values and not arrays. |
emh203 | 0:3d9c67d97d6f | 167 | * There are separate functions for Q15, Q31, and floating-point data. |
emh203 | 0:3d9c67d97d6f | 168 | * |
emh203 | 0:3d9c67d97d6f | 169 | */ |
emh203 | 0:3d9c67d97d6f | 170 | |
emh203 | 0:3d9c67d97d6f | 171 | /** |
emh203 | 0:3d9c67d97d6f | 172 | * @defgroup groupCmplxMath Complex Math Functions |
emh203 | 0:3d9c67d97d6f | 173 | * This set of functions operates on complex data vectors. |
emh203 | 0:3d9c67d97d6f | 174 | * The data in the complex arrays is stored in an interleaved fashion |
emh203 | 0:3d9c67d97d6f | 175 | * (real, imag, real, imag, ...). |
emh203 | 0:3d9c67d97d6f | 176 | * In the API functions, the number of samples in a complex array refers |
emh203 | 0:3d9c67d97d6f | 177 | * to the number of complex values; the array contains twice this number of |
emh203 | 0:3d9c67d97d6f | 178 | * real values. |
emh203 | 0:3d9c67d97d6f | 179 | */ |
emh203 | 0:3d9c67d97d6f | 180 | |
emh203 | 0:3d9c67d97d6f | 181 | /** |
emh203 | 0:3d9c67d97d6f | 182 | * @defgroup groupFilters Filtering Functions |
emh203 | 0:3d9c67d97d6f | 183 | */ |
emh203 | 0:3d9c67d97d6f | 184 | |
emh203 | 0:3d9c67d97d6f | 185 | /** |
emh203 | 0:3d9c67d97d6f | 186 | * @defgroup groupMatrix Matrix Functions |
emh203 | 0:3d9c67d97d6f | 187 | * |
emh203 | 0:3d9c67d97d6f | 188 | * This set of functions provides basic matrix math operations. |
emh203 | 0:3d9c67d97d6f | 189 | * The functions operate on matrix data structures. For example, |
emh203 | 0:3d9c67d97d6f | 190 | * the type |
emh203 | 0:3d9c67d97d6f | 191 | * definition for the floating-point matrix structure is shown |
emh203 | 0:3d9c67d97d6f | 192 | * below: |
emh203 | 0:3d9c67d97d6f | 193 | * <pre> |
emh203 | 0:3d9c67d97d6f | 194 | * typedef struct |
emh203 | 0:3d9c67d97d6f | 195 | * { |
emh203 | 0:3d9c67d97d6f | 196 | * uint16_t numRows; // number of rows of the matrix. |
emh203 | 0:3d9c67d97d6f | 197 | * uint16_t numCols; // number of columns of the matrix. |
emh203 | 0:3d9c67d97d6f | 198 | * float32_t *pData; // points to the data of the matrix. |
emh203 | 0:3d9c67d97d6f | 199 | * } arm_matrix_instance_f32; |
emh203 | 0:3d9c67d97d6f | 200 | * </pre> |
emh203 | 0:3d9c67d97d6f | 201 | * There are similar definitions for Q15 and Q31 data types. |
emh203 | 0:3d9c67d97d6f | 202 | * |
emh203 | 0:3d9c67d97d6f | 203 | * The structure specifies the size of the matrix and then points to |
emh203 | 0:3d9c67d97d6f | 204 | * an array of data. The array is of size <code>numRows X numCols</code> |
emh203 | 0:3d9c67d97d6f | 205 | * and the values are arranged in row order. That is, the |
emh203 | 0:3d9c67d97d6f | 206 | * matrix element (i, j) is stored at: |
emh203 | 0:3d9c67d97d6f | 207 | * <pre> |
emh203 | 0:3d9c67d97d6f | 208 | * pData[i*numCols + j] |
emh203 | 0:3d9c67d97d6f | 209 | * </pre> |
emh203 | 0:3d9c67d97d6f | 210 | * |
emh203 | 0:3d9c67d97d6f | 211 | * \par Init Functions |
emh203 | 0:3d9c67d97d6f | 212 | * There is an associated initialization function for each type of matrix |
emh203 | 0:3d9c67d97d6f | 213 | * data structure. |
emh203 | 0:3d9c67d97d6f | 214 | * The initialization function sets the values of the internal structure fields. |
emh203 | 0:3d9c67d97d6f | 215 | * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code> |
emh203 | 0:3d9c67d97d6f | 216 | * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively. |
emh203 | 0:3d9c67d97d6f | 217 | * |
emh203 | 0:3d9c67d97d6f | 218 | * \par |
emh203 | 0:3d9c67d97d6f | 219 | * Use of the initialization function is optional. However, if initialization function is used |
emh203 | 0:3d9c67d97d6f | 220 | * then the instance structure cannot be placed into a const data section. |
emh203 | 0:3d9c67d97d6f | 221 | * To place the instance structure in a const data |
emh203 | 0:3d9c67d97d6f | 222 | * section, manually initialize the data structure. For example: |
emh203 | 0:3d9c67d97d6f | 223 | * <pre> |
emh203 | 0:3d9c67d97d6f | 224 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code> |
emh203 | 0:3d9c67d97d6f | 225 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code> |
emh203 | 0:3d9c67d97d6f | 226 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code> |
emh203 | 0:3d9c67d97d6f | 227 | * </pre> |
emh203 | 0:3d9c67d97d6f | 228 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code> |
emh203 | 0:3d9c67d97d6f | 229 | * specifies the number of columns, and <code>pData</code> points to the |
emh203 | 0:3d9c67d97d6f | 230 | * data array. |
emh203 | 0:3d9c67d97d6f | 231 | * |
emh203 | 0:3d9c67d97d6f | 232 | * \par Size Checking |
emh203 | 0:3d9c67d97d6f | 233 | * By default all of the matrix functions perform size checking on the input and |
emh203 | 0:3d9c67d97d6f | 234 | * output matrices. For example, the matrix addition function verifies that the |
emh203 | 0:3d9c67d97d6f | 235 | * two input matrices and the output matrix all have the same number of rows and |
emh203 | 0:3d9c67d97d6f | 236 | * columns. If the size check fails the functions return: |
emh203 | 0:3d9c67d97d6f | 237 | * <pre> |
emh203 | 0:3d9c67d97d6f | 238 | * ARM_MATH_SIZE_MISMATCH |
emh203 | 0:3d9c67d97d6f | 239 | * </pre> |
emh203 | 0:3d9c67d97d6f | 240 | * Otherwise the functions return |
emh203 | 0:3d9c67d97d6f | 241 | * <pre> |
emh203 | 0:3d9c67d97d6f | 242 | * ARM_MATH_SUCCESS |
emh203 | 0:3d9c67d97d6f | 243 | * </pre> |
emh203 | 0:3d9c67d97d6f | 244 | * There is some overhead associated with this matrix size checking. |
emh203 | 0:3d9c67d97d6f | 245 | * The matrix size checking is enabled via the \#define |
emh203 | 0:3d9c67d97d6f | 246 | * <pre> |
emh203 | 0:3d9c67d97d6f | 247 | * ARM_MATH_MATRIX_CHECK |
emh203 | 0:3d9c67d97d6f | 248 | * </pre> |
emh203 | 0:3d9c67d97d6f | 249 | * within the library project settings. By default this macro is defined |
emh203 | 0:3d9c67d97d6f | 250 | * and size checking is enabled. By changing the project settings and |
emh203 | 0:3d9c67d97d6f | 251 | * undefining this macro size checking is eliminated and the functions |
emh203 | 0:3d9c67d97d6f | 252 | * run a bit faster. With size checking disabled the functions always |
emh203 | 0:3d9c67d97d6f | 253 | * return <code>ARM_MATH_SUCCESS</code>. |
emh203 | 0:3d9c67d97d6f | 254 | */ |
emh203 | 0:3d9c67d97d6f | 255 | |
emh203 | 0:3d9c67d97d6f | 256 | /** |
emh203 | 0:3d9c67d97d6f | 257 | * @defgroup groupTransforms Transform Functions |
emh203 | 0:3d9c67d97d6f | 258 | */ |
emh203 | 0:3d9c67d97d6f | 259 | |
emh203 | 0:3d9c67d97d6f | 260 | /** |
emh203 | 0:3d9c67d97d6f | 261 | * @defgroup groupController Controller Functions |
emh203 | 0:3d9c67d97d6f | 262 | */ |
emh203 | 0:3d9c67d97d6f | 263 | |
emh203 | 0:3d9c67d97d6f | 264 | /** |
emh203 | 0:3d9c67d97d6f | 265 | * @defgroup groupStats Statistics Functions |
emh203 | 0:3d9c67d97d6f | 266 | */ |
emh203 | 0:3d9c67d97d6f | 267 | /** |
emh203 | 0:3d9c67d97d6f | 268 | * @defgroup groupSupport Support Functions |
emh203 | 0:3d9c67d97d6f | 269 | */ |
emh203 | 0:3d9c67d97d6f | 270 | |
emh203 | 0:3d9c67d97d6f | 271 | /** |
emh203 | 0:3d9c67d97d6f | 272 | * @defgroup groupInterpolation Interpolation Functions |
emh203 | 0:3d9c67d97d6f | 273 | * These functions perform 1- and 2-dimensional interpolation of data. |
emh203 | 0:3d9c67d97d6f | 274 | * Linear interpolation is used for 1-dimensional data and |
emh203 | 0:3d9c67d97d6f | 275 | * bilinear interpolation is used for 2-dimensional data. |
emh203 | 0:3d9c67d97d6f | 276 | */ |
emh203 | 0:3d9c67d97d6f | 277 | |
emh203 | 0:3d9c67d97d6f | 278 | /** |
emh203 | 0:3d9c67d97d6f | 279 | * @defgroup groupExamples Examples |
emh203 | 0:3d9c67d97d6f | 280 | */ |
emh203 | 0:3d9c67d97d6f | 281 | #ifndef _ARM_MATH_H |
emh203 | 0:3d9c67d97d6f | 282 | #define _ARM_MATH_H |
emh203 | 0:3d9c67d97d6f | 283 | |
emh203 | 0:3d9c67d97d6f | 284 | #define __CMSIS_GENERIC /* disable NVIC and Systick functions */ |
emh203 | 0:3d9c67d97d6f | 285 | |
emh203 | 0:3d9c67d97d6f | 286 | #if defined (ARM_MATH_CM4) |
emh203 | 0:3d9c67d97d6f | 287 | #include "core_cm4.h" |
emh203 | 0:3d9c67d97d6f | 288 | #elif defined (ARM_MATH_CM3) |
emh203 | 0:3d9c67d97d6f | 289 | #include "core_cm3.h" |
emh203 | 0:3d9c67d97d6f | 290 | #elif defined (ARM_MATH_CM0) |
emh203 | 0:3d9c67d97d6f | 291 | #include "core_cm0.h" |
emh203 | 0:3d9c67d97d6f | 292 | #define ARM_MATH_CM0_FAMILY |
emh203 | 0:3d9c67d97d6f | 293 | #elif defined (ARM_MATH_CM0PLUS) |
emh203 | 0:3d9c67d97d6f | 294 | #include "core_cm0plus.h" |
emh203 | 0:3d9c67d97d6f | 295 | #define ARM_MATH_CM0_FAMILY |
emh203 | 0:3d9c67d97d6f | 296 | #else |
emh203 | 0:3d9c67d97d6f | 297 | #include "ARMCM4.h" |
emh203 | 0:3d9c67d97d6f | 298 | #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....." |
emh203 | 0:3d9c67d97d6f | 299 | #endif |
emh203 | 0:3d9c67d97d6f | 300 | |
emh203 | 0:3d9c67d97d6f | 301 | #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ |
emh203 | 0:3d9c67d97d6f | 302 | #include "string.h" |
emh203 | 0:3d9c67d97d6f | 303 | #include "math.h" |
emh203 | 0:3d9c67d97d6f | 304 | #ifdef __cplusplus |
emh203 | 0:3d9c67d97d6f | 305 | extern "C" |
emh203 | 0:3d9c67d97d6f | 306 | { |
emh203 | 0:3d9c67d97d6f | 307 | #endif |
emh203 | 0:3d9c67d97d6f | 308 | |
emh203 | 0:3d9c67d97d6f | 309 | |
emh203 | 0:3d9c67d97d6f | 310 | /** |
emh203 | 0:3d9c67d97d6f | 311 | * @brief Macros required for reciprocal calculation in Normalized LMS |
emh203 | 0:3d9c67d97d6f | 312 | */ |
emh203 | 0:3d9c67d97d6f | 313 | |
emh203 | 0:3d9c67d97d6f | 314 | #define DELTA_Q31 (0x100) |
emh203 | 0:3d9c67d97d6f | 315 | #define DELTA_Q15 0x5 |
emh203 | 0:3d9c67d97d6f | 316 | #define INDEX_MASK 0x0000003F |
emh203 | 0:3d9c67d97d6f | 317 | #ifndef PI |
emh203 | 0:3d9c67d97d6f | 318 | #define PI 3.14159265358979f |
emh203 | 0:3d9c67d97d6f | 319 | #endif |
emh203 | 0:3d9c67d97d6f | 320 | |
emh203 | 0:3d9c67d97d6f | 321 | /** |
emh203 | 0:3d9c67d97d6f | 322 | * @brief Macros required for SINE and COSINE Fast math approximations |
emh203 | 0:3d9c67d97d6f | 323 | */ |
emh203 | 0:3d9c67d97d6f | 324 | |
emh203 | 0:3d9c67d97d6f | 325 | #define FAST_MATH_TABLE_SIZE 512 |
emh203 | 0:3d9c67d97d6f | 326 | #define FAST_MATH_Q31_SHIFT (32 - 10) |
emh203 | 0:3d9c67d97d6f | 327 | #define FAST_MATH_Q15_SHIFT (16 - 10) |
emh203 | 0:3d9c67d97d6f | 328 | #define CONTROLLER_Q31_SHIFT (32 - 9) |
emh203 | 0:3d9c67d97d6f | 329 | #define TABLE_SIZE 256 |
emh203 | 0:3d9c67d97d6f | 330 | #define TABLE_SPACING_Q31 0x400000 |
emh203 | 0:3d9c67d97d6f | 331 | #define TABLE_SPACING_Q15 0x80 |
emh203 | 0:3d9c67d97d6f | 332 | |
emh203 | 0:3d9c67d97d6f | 333 | /** |
emh203 | 0:3d9c67d97d6f | 334 | * @brief Macros required for SINE and COSINE Controller functions |
emh203 | 0:3d9c67d97d6f | 335 | */ |
emh203 | 0:3d9c67d97d6f | 336 | /* 1.31(q31) Fixed value of 2/360 */ |
emh203 | 0:3d9c67d97d6f | 337 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ |
emh203 | 0:3d9c67d97d6f | 338 | #define INPUT_SPACING 0xB60B61 |
emh203 | 0:3d9c67d97d6f | 339 | |
emh203 | 0:3d9c67d97d6f | 340 | /** |
emh203 | 0:3d9c67d97d6f | 341 | * @brief Macro for Unaligned Support |
emh203 | 0:3d9c67d97d6f | 342 | */ |
emh203 | 0:3d9c67d97d6f | 343 | #ifndef UNALIGNED_SUPPORT_DISABLE |
emh203 | 0:3d9c67d97d6f | 344 | #define ALIGN4 |
emh203 | 0:3d9c67d97d6f | 345 | #else |
emh203 | 0:3d9c67d97d6f | 346 | #if defined (__GNUC__) |
emh203 | 0:3d9c67d97d6f | 347 | #define ALIGN4 __attribute__((aligned(4))) |
emh203 | 0:3d9c67d97d6f | 348 | #else |
emh203 | 0:3d9c67d97d6f | 349 | #define ALIGN4 __align(4) |
emh203 | 0:3d9c67d97d6f | 350 | #endif |
emh203 | 0:3d9c67d97d6f | 351 | #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ |
emh203 | 0:3d9c67d97d6f | 352 | |
emh203 | 0:3d9c67d97d6f | 353 | /** |
emh203 | 0:3d9c67d97d6f | 354 | * @brief Error status returned by some functions in the library. |
emh203 | 0:3d9c67d97d6f | 355 | */ |
emh203 | 0:3d9c67d97d6f | 356 | |
emh203 | 0:3d9c67d97d6f | 357 | typedef enum |
emh203 | 0:3d9c67d97d6f | 358 | { |
emh203 | 0:3d9c67d97d6f | 359 | ARM_MATH_SUCCESS = 0, /**< No error */ |
emh203 | 0:3d9c67d97d6f | 360 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ |
emh203 | 0:3d9c67d97d6f | 361 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ |
emh203 | 0:3d9c67d97d6f | 362 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ |
emh203 | 0:3d9c67d97d6f | 363 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ |
emh203 | 0:3d9c67d97d6f | 364 | ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ |
emh203 | 0:3d9c67d97d6f | 365 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ |
emh203 | 0:3d9c67d97d6f | 366 | } arm_status; |
emh203 | 0:3d9c67d97d6f | 367 | |
emh203 | 0:3d9c67d97d6f | 368 | /** |
emh203 | 0:3d9c67d97d6f | 369 | * @brief 8-bit fractional data type in 1.7 format. |
emh203 | 0:3d9c67d97d6f | 370 | */ |
emh203 | 0:3d9c67d97d6f | 371 | typedef int8_t q7_t; |
emh203 | 0:3d9c67d97d6f | 372 | |
emh203 | 0:3d9c67d97d6f | 373 | /** |
emh203 | 0:3d9c67d97d6f | 374 | * @brief 16-bit fractional data type in 1.15 format. |
emh203 | 0:3d9c67d97d6f | 375 | */ |
emh203 | 0:3d9c67d97d6f | 376 | typedef int16_t q15_t; |
emh203 | 0:3d9c67d97d6f | 377 | |
emh203 | 0:3d9c67d97d6f | 378 | /** |
emh203 | 0:3d9c67d97d6f | 379 | * @brief 32-bit fractional data type in 1.31 format. |
emh203 | 0:3d9c67d97d6f | 380 | */ |
emh203 | 0:3d9c67d97d6f | 381 | typedef int32_t q31_t; |
emh203 | 0:3d9c67d97d6f | 382 | |
emh203 | 0:3d9c67d97d6f | 383 | /** |
emh203 | 0:3d9c67d97d6f | 384 | * @brief 64-bit fractional data type in 1.63 format. |
emh203 | 0:3d9c67d97d6f | 385 | */ |
emh203 | 0:3d9c67d97d6f | 386 | typedef int64_t q63_t; |
emh203 | 0:3d9c67d97d6f | 387 | |
emh203 | 0:3d9c67d97d6f | 388 | /** |
emh203 | 0:3d9c67d97d6f | 389 | * @brief 32-bit floating-point type definition. |
emh203 | 0:3d9c67d97d6f | 390 | */ |
emh203 | 0:3d9c67d97d6f | 391 | typedef float float32_t; |
emh203 | 0:3d9c67d97d6f | 392 | |
emh203 | 0:3d9c67d97d6f | 393 | /** |
emh203 | 0:3d9c67d97d6f | 394 | * @brief 64-bit floating-point type definition. |
emh203 | 0:3d9c67d97d6f | 395 | */ |
emh203 | 0:3d9c67d97d6f | 396 | typedef double float64_t; |
emh203 | 0:3d9c67d97d6f | 397 | |
emh203 | 0:3d9c67d97d6f | 398 | /** |
emh203 | 0:3d9c67d97d6f | 399 | * @brief definition to read/write two 16 bit values. |
emh203 | 0:3d9c67d97d6f | 400 | */ |
emh203 | 0:3d9c67d97d6f | 401 | #if defined __CC_ARM |
emh203 | 0:3d9c67d97d6f | 402 | #define __SIMD32_TYPE int32_t __packed |
emh203 | 0:3d9c67d97d6f | 403 | #define CMSIS_UNUSED __attribute__((unused)) |
emh203 | 0:3d9c67d97d6f | 404 | #elif defined __ICCARM__ |
emh203 | 0:3d9c67d97d6f | 405 | #define CMSIS_UNUSED |
emh203 | 0:3d9c67d97d6f | 406 | #define __SIMD32_TYPE int32_t __packed |
emh203 | 0:3d9c67d97d6f | 407 | #elif defined __GNUC__ |
emh203 | 0:3d9c67d97d6f | 408 | #define __SIMD32_TYPE int32_t |
emh203 | 0:3d9c67d97d6f | 409 | #define CMSIS_UNUSED __attribute__((unused)) |
emh203 | 0:3d9c67d97d6f | 410 | #elif defined __CSMC__ /* Cosmic */ |
emh203 | 0:3d9c67d97d6f | 411 | #define CMSIS_UNUSED |
emh203 | 0:3d9c67d97d6f | 412 | #define __SIMD32_TYPE int32_t |
emh203 | 0:3d9c67d97d6f | 413 | #else |
emh203 | 0:3d9c67d97d6f | 414 | #error Unknown compiler |
emh203 | 0:3d9c67d97d6f | 415 | #endif |
emh203 | 0:3d9c67d97d6f | 416 | |
emh203 | 0:3d9c67d97d6f | 417 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) |
emh203 | 0:3d9c67d97d6f | 418 | #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) |
emh203 | 0:3d9c67d97d6f | 419 | |
emh203 | 0:3d9c67d97d6f | 420 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) |
emh203 | 0:3d9c67d97d6f | 421 | |
emh203 | 0:3d9c67d97d6f | 422 | #define __SIMD64(addr) (*(int64_t **) & (addr)) |
emh203 | 0:3d9c67d97d6f | 423 | |
emh203 | 0:3d9c67d97d6f | 424 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
emh203 | 0:3d9c67d97d6f | 425 | /** |
emh203 | 0:3d9c67d97d6f | 426 | * @brief definition to pack two 16 bit values. |
emh203 | 0:3d9c67d97d6f | 427 | */ |
emh203 | 0:3d9c67d97d6f | 428 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ |
emh203 | 0:3d9c67d97d6f | 429 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) |
emh203 | 0:3d9c67d97d6f | 430 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ |
emh203 | 0:3d9c67d97d6f | 431 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) |
emh203 | 0:3d9c67d97d6f | 432 | |
emh203 | 0:3d9c67d97d6f | 433 | #endif |
emh203 | 0:3d9c67d97d6f | 434 | |
emh203 | 0:3d9c67d97d6f | 435 | |
emh203 | 0:3d9c67d97d6f | 436 | /** |
emh203 | 0:3d9c67d97d6f | 437 | * @brief definition to pack four 8 bit values. |
emh203 | 0:3d9c67d97d6f | 438 | */ |
emh203 | 0:3d9c67d97d6f | 439 | #ifndef ARM_MATH_BIG_ENDIAN |
emh203 | 0:3d9c67d97d6f | 440 | |
emh203 | 0:3d9c67d97d6f | 441 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ |
emh203 | 0:3d9c67d97d6f | 442 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ |
emh203 | 0:3d9c67d97d6f | 443 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ |
emh203 | 0:3d9c67d97d6f | 444 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) |
emh203 | 0:3d9c67d97d6f | 445 | #else |
emh203 | 0:3d9c67d97d6f | 446 | |
emh203 | 0:3d9c67d97d6f | 447 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ |
emh203 | 0:3d9c67d97d6f | 448 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ |
emh203 | 0:3d9c67d97d6f | 449 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ |
emh203 | 0:3d9c67d97d6f | 450 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) |
emh203 | 0:3d9c67d97d6f | 451 | |
emh203 | 0:3d9c67d97d6f | 452 | #endif |
emh203 | 0:3d9c67d97d6f | 453 | |
emh203 | 0:3d9c67d97d6f | 454 | |
emh203 | 0:3d9c67d97d6f | 455 | /** |
emh203 | 0:3d9c67d97d6f | 456 | * @brief Clips Q63 to Q31 values. |
emh203 | 0:3d9c67d97d6f | 457 | */ |
emh203 | 0:3d9c67d97d6f | 458 | static __INLINE q31_t clip_q63_to_q31( |
emh203 | 0:3d9c67d97d6f | 459 | q63_t x) |
emh203 | 0:3d9c67d97d6f | 460 | { |
emh203 | 0:3d9c67d97d6f | 461 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
emh203 | 0:3d9c67d97d6f | 462 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; |
emh203 | 0:3d9c67d97d6f | 463 | } |
emh203 | 0:3d9c67d97d6f | 464 | |
emh203 | 0:3d9c67d97d6f | 465 | /** |
emh203 | 0:3d9c67d97d6f | 466 | * @brief Clips Q63 to Q15 values. |
emh203 | 0:3d9c67d97d6f | 467 | */ |
emh203 | 0:3d9c67d97d6f | 468 | static __INLINE q15_t clip_q63_to_q15( |
emh203 | 0:3d9c67d97d6f | 469 | q63_t x) |
emh203 | 0:3d9c67d97d6f | 470 | { |
emh203 | 0:3d9c67d97d6f | 471 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
emh203 | 0:3d9c67d97d6f | 472 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); |
emh203 | 0:3d9c67d97d6f | 473 | } |
emh203 | 0:3d9c67d97d6f | 474 | |
emh203 | 0:3d9c67d97d6f | 475 | /** |
emh203 | 0:3d9c67d97d6f | 476 | * @brief Clips Q31 to Q7 values. |
emh203 | 0:3d9c67d97d6f | 477 | */ |
emh203 | 0:3d9c67d97d6f | 478 | static __INLINE q7_t clip_q31_to_q7( |
emh203 | 0:3d9c67d97d6f | 479 | q31_t x) |
emh203 | 0:3d9c67d97d6f | 480 | { |
emh203 | 0:3d9c67d97d6f | 481 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? |
emh203 | 0:3d9c67d97d6f | 482 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; |
emh203 | 0:3d9c67d97d6f | 483 | } |
emh203 | 0:3d9c67d97d6f | 484 | |
emh203 | 0:3d9c67d97d6f | 485 | /** |
emh203 | 0:3d9c67d97d6f | 486 | * @brief Clips Q31 to Q15 values. |
emh203 | 0:3d9c67d97d6f | 487 | */ |
emh203 | 0:3d9c67d97d6f | 488 | static __INLINE q15_t clip_q31_to_q15( |
emh203 | 0:3d9c67d97d6f | 489 | q31_t x) |
emh203 | 0:3d9c67d97d6f | 490 | { |
emh203 | 0:3d9c67d97d6f | 491 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? |
emh203 | 0:3d9c67d97d6f | 492 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 493 | } |
emh203 | 0:3d9c67d97d6f | 494 | |
emh203 | 0:3d9c67d97d6f | 495 | /** |
emh203 | 0:3d9c67d97d6f | 496 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. |
emh203 | 0:3d9c67d97d6f | 497 | */ |
emh203 | 0:3d9c67d97d6f | 498 | |
emh203 | 0:3d9c67d97d6f | 499 | static __INLINE q63_t mult32x64( |
emh203 | 0:3d9c67d97d6f | 500 | q63_t x, |
emh203 | 0:3d9c67d97d6f | 501 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 502 | { |
emh203 | 0:3d9c67d97d6f | 503 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + |
emh203 | 0:3d9c67d97d6f | 504 | (((q63_t) (x >> 32) * y))); |
emh203 | 0:3d9c67d97d6f | 505 | } |
emh203 | 0:3d9c67d97d6f | 506 | |
emh203 | 0:3d9c67d97d6f | 507 | |
emh203 | 0:3d9c67d97d6f | 508 | #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) |
emh203 | 0:3d9c67d97d6f | 509 | #define __CLZ __clz |
emh203 | 0:3d9c67d97d6f | 510 | #endif |
emh203 | 0:3d9c67d97d6f | 511 | |
emh203 | 0:3d9c67d97d6f | 512 | #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) ) |
emh203 | 0:3d9c67d97d6f | 513 | |
emh203 | 0:3d9c67d97d6f | 514 | static __INLINE uint32_t __CLZ( |
emh203 | 0:3d9c67d97d6f | 515 | q31_t data); |
emh203 | 0:3d9c67d97d6f | 516 | |
emh203 | 0:3d9c67d97d6f | 517 | |
emh203 | 0:3d9c67d97d6f | 518 | static __INLINE uint32_t __CLZ( |
emh203 | 0:3d9c67d97d6f | 519 | q31_t data) |
emh203 | 0:3d9c67d97d6f | 520 | { |
emh203 | 0:3d9c67d97d6f | 521 | uint32_t count = 0; |
emh203 | 0:3d9c67d97d6f | 522 | uint32_t mask = 0x80000000; |
emh203 | 0:3d9c67d97d6f | 523 | |
emh203 | 0:3d9c67d97d6f | 524 | while((data & mask) == 0) |
emh203 | 0:3d9c67d97d6f | 525 | { |
emh203 | 0:3d9c67d97d6f | 526 | count += 1u; |
emh203 | 0:3d9c67d97d6f | 527 | mask = mask >> 1u; |
emh203 | 0:3d9c67d97d6f | 528 | } |
emh203 | 0:3d9c67d97d6f | 529 | |
emh203 | 0:3d9c67d97d6f | 530 | return (count); |
emh203 | 0:3d9c67d97d6f | 531 | |
emh203 | 0:3d9c67d97d6f | 532 | } |
emh203 | 0:3d9c67d97d6f | 533 | |
emh203 | 0:3d9c67d97d6f | 534 | #endif |
emh203 | 0:3d9c67d97d6f | 535 | |
emh203 | 0:3d9c67d97d6f | 536 | /** |
emh203 | 0:3d9c67d97d6f | 537 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. |
emh203 | 0:3d9c67d97d6f | 538 | */ |
emh203 | 0:3d9c67d97d6f | 539 | |
emh203 | 0:3d9c67d97d6f | 540 | static __INLINE uint32_t arm_recip_q31( |
emh203 | 0:3d9c67d97d6f | 541 | q31_t in, |
emh203 | 0:3d9c67d97d6f | 542 | q31_t * dst, |
emh203 | 0:3d9c67d97d6f | 543 | q31_t * pRecipTable) |
emh203 | 0:3d9c67d97d6f | 544 | { |
emh203 | 0:3d9c67d97d6f | 545 | |
emh203 | 0:3d9c67d97d6f | 546 | uint32_t out, tempVal; |
emh203 | 0:3d9c67d97d6f | 547 | uint32_t index, i; |
emh203 | 0:3d9c67d97d6f | 548 | uint32_t signBits; |
emh203 | 0:3d9c67d97d6f | 549 | |
emh203 | 0:3d9c67d97d6f | 550 | if(in > 0) |
emh203 | 0:3d9c67d97d6f | 551 | { |
emh203 | 0:3d9c67d97d6f | 552 | signBits = __CLZ(in) - 1; |
emh203 | 0:3d9c67d97d6f | 553 | } |
emh203 | 0:3d9c67d97d6f | 554 | else |
emh203 | 0:3d9c67d97d6f | 555 | { |
emh203 | 0:3d9c67d97d6f | 556 | signBits = __CLZ(-in) - 1; |
emh203 | 0:3d9c67d97d6f | 557 | } |
emh203 | 0:3d9c67d97d6f | 558 | |
emh203 | 0:3d9c67d97d6f | 559 | /* Convert input sample to 1.31 format */ |
emh203 | 0:3d9c67d97d6f | 560 | in = in << signBits; |
emh203 | 0:3d9c67d97d6f | 561 | |
emh203 | 0:3d9c67d97d6f | 562 | /* calculation of index for initial approximated Val */ |
emh203 | 0:3d9c67d97d6f | 563 | index = (uint32_t) (in >> 24u); |
emh203 | 0:3d9c67d97d6f | 564 | index = (index & INDEX_MASK); |
emh203 | 0:3d9c67d97d6f | 565 | |
emh203 | 0:3d9c67d97d6f | 566 | /* 1.31 with exp 1 */ |
emh203 | 0:3d9c67d97d6f | 567 | out = pRecipTable[index]; |
emh203 | 0:3d9c67d97d6f | 568 | |
emh203 | 0:3d9c67d97d6f | 569 | /* calculation of reciprocal value */ |
emh203 | 0:3d9c67d97d6f | 570 | /* running approximation for two iterations */ |
emh203 | 0:3d9c67d97d6f | 571 | for (i = 0u; i < 2u; i++) |
emh203 | 0:3d9c67d97d6f | 572 | { |
emh203 | 0:3d9c67d97d6f | 573 | tempVal = (q31_t) (((q63_t) in * out) >> 31u); |
emh203 | 0:3d9c67d97d6f | 574 | tempVal = 0x7FFFFFFF - tempVal; |
emh203 | 0:3d9c67d97d6f | 575 | /* 1.31 with exp 1 */ |
emh203 | 0:3d9c67d97d6f | 576 | //out = (q31_t) (((q63_t) out * tempVal) >> 30u); |
emh203 | 0:3d9c67d97d6f | 577 | out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u); |
emh203 | 0:3d9c67d97d6f | 578 | } |
emh203 | 0:3d9c67d97d6f | 579 | |
emh203 | 0:3d9c67d97d6f | 580 | /* write output */ |
emh203 | 0:3d9c67d97d6f | 581 | *dst = out; |
emh203 | 0:3d9c67d97d6f | 582 | |
emh203 | 0:3d9c67d97d6f | 583 | /* return num of signbits of out = 1/in value */ |
emh203 | 0:3d9c67d97d6f | 584 | return (signBits + 1u); |
emh203 | 0:3d9c67d97d6f | 585 | |
emh203 | 0:3d9c67d97d6f | 586 | } |
emh203 | 0:3d9c67d97d6f | 587 | |
emh203 | 0:3d9c67d97d6f | 588 | /** |
emh203 | 0:3d9c67d97d6f | 589 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. |
emh203 | 0:3d9c67d97d6f | 590 | */ |
emh203 | 0:3d9c67d97d6f | 591 | static __INLINE uint32_t arm_recip_q15( |
emh203 | 0:3d9c67d97d6f | 592 | q15_t in, |
emh203 | 0:3d9c67d97d6f | 593 | q15_t * dst, |
emh203 | 0:3d9c67d97d6f | 594 | q15_t * pRecipTable) |
emh203 | 0:3d9c67d97d6f | 595 | { |
emh203 | 0:3d9c67d97d6f | 596 | |
emh203 | 0:3d9c67d97d6f | 597 | uint32_t out = 0, tempVal = 0; |
emh203 | 0:3d9c67d97d6f | 598 | uint32_t index = 0, i = 0; |
emh203 | 0:3d9c67d97d6f | 599 | uint32_t signBits = 0; |
emh203 | 0:3d9c67d97d6f | 600 | |
emh203 | 0:3d9c67d97d6f | 601 | if(in > 0) |
emh203 | 0:3d9c67d97d6f | 602 | { |
emh203 | 0:3d9c67d97d6f | 603 | signBits = __CLZ(in) - 17; |
emh203 | 0:3d9c67d97d6f | 604 | } |
emh203 | 0:3d9c67d97d6f | 605 | else |
emh203 | 0:3d9c67d97d6f | 606 | { |
emh203 | 0:3d9c67d97d6f | 607 | signBits = __CLZ(-in) - 17; |
emh203 | 0:3d9c67d97d6f | 608 | } |
emh203 | 0:3d9c67d97d6f | 609 | |
emh203 | 0:3d9c67d97d6f | 610 | /* Convert input sample to 1.15 format */ |
emh203 | 0:3d9c67d97d6f | 611 | in = in << signBits; |
emh203 | 0:3d9c67d97d6f | 612 | |
emh203 | 0:3d9c67d97d6f | 613 | /* calculation of index for initial approximated Val */ |
emh203 | 0:3d9c67d97d6f | 614 | index = in >> 8; |
emh203 | 0:3d9c67d97d6f | 615 | index = (index & INDEX_MASK); |
emh203 | 0:3d9c67d97d6f | 616 | |
emh203 | 0:3d9c67d97d6f | 617 | /* 1.15 with exp 1 */ |
emh203 | 0:3d9c67d97d6f | 618 | out = pRecipTable[index]; |
emh203 | 0:3d9c67d97d6f | 619 | |
emh203 | 0:3d9c67d97d6f | 620 | /* calculation of reciprocal value */ |
emh203 | 0:3d9c67d97d6f | 621 | /* running approximation for two iterations */ |
emh203 | 0:3d9c67d97d6f | 622 | for (i = 0; i < 2; i++) |
emh203 | 0:3d9c67d97d6f | 623 | { |
emh203 | 0:3d9c67d97d6f | 624 | tempVal = (q15_t) (((q31_t) in * out) >> 15); |
emh203 | 0:3d9c67d97d6f | 625 | tempVal = 0x7FFF - tempVal; |
emh203 | 0:3d9c67d97d6f | 626 | /* 1.15 with exp 1 */ |
emh203 | 0:3d9c67d97d6f | 627 | out = (q15_t) (((q31_t) out * tempVal) >> 14); |
emh203 | 0:3d9c67d97d6f | 628 | } |
emh203 | 0:3d9c67d97d6f | 629 | |
emh203 | 0:3d9c67d97d6f | 630 | /* write output */ |
emh203 | 0:3d9c67d97d6f | 631 | *dst = out; |
emh203 | 0:3d9c67d97d6f | 632 | |
emh203 | 0:3d9c67d97d6f | 633 | /* return num of signbits of out = 1/in value */ |
emh203 | 0:3d9c67d97d6f | 634 | return (signBits + 1); |
emh203 | 0:3d9c67d97d6f | 635 | |
emh203 | 0:3d9c67d97d6f | 636 | } |
emh203 | 0:3d9c67d97d6f | 637 | |
emh203 | 0:3d9c67d97d6f | 638 | |
emh203 | 0:3d9c67d97d6f | 639 | /* |
emh203 | 0:3d9c67d97d6f | 640 | * @brief C custom defined intrinisic function for only M0 processors |
emh203 | 0:3d9c67d97d6f | 641 | */ |
emh203 | 0:3d9c67d97d6f | 642 | #if defined(ARM_MATH_CM0_FAMILY) |
emh203 | 0:3d9c67d97d6f | 643 | |
emh203 | 0:3d9c67d97d6f | 644 | static __INLINE q31_t __SSAT( |
emh203 | 0:3d9c67d97d6f | 645 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 646 | uint32_t y) |
emh203 | 0:3d9c67d97d6f | 647 | { |
emh203 | 0:3d9c67d97d6f | 648 | int32_t posMax, negMin; |
emh203 | 0:3d9c67d97d6f | 649 | uint32_t i; |
emh203 | 0:3d9c67d97d6f | 650 | |
emh203 | 0:3d9c67d97d6f | 651 | posMax = 1; |
emh203 | 0:3d9c67d97d6f | 652 | for (i = 0; i < (y - 1); i++) |
emh203 | 0:3d9c67d97d6f | 653 | { |
emh203 | 0:3d9c67d97d6f | 654 | posMax = posMax * 2; |
emh203 | 0:3d9c67d97d6f | 655 | } |
emh203 | 0:3d9c67d97d6f | 656 | |
emh203 | 0:3d9c67d97d6f | 657 | if(x > 0) |
emh203 | 0:3d9c67d97d6f | 658 | { |
emh203 | 0:3d9c67d97d6f | 659 | posMax = (posMax - 1); |
emh203 | 0:3d9c67d97d6f | 660 | |
emh203 | 0:3d9c67d97d6f | 661 | if(x > posMax) |
emh203 | 0:3d9c67d97d6f | 662 | { |
emh203 | 0:3d9c67d97d6f | 663 | x = posMax; |
emh203 | 0:3d9c67d97d6f | 664 | } |
emh203 | 0:3d9c67d97d6f | 665 | } |
emh203 | 0:3d9c67d97d6f | 666 | else |
emh203 | 0:3d9c67d97d6f | 667 | { |
emh203 | 0:3d9c67d97d6f | 668 | negMin = -posMax; |
emh203 | 0:3d9c67d97d6f | 669 | |
emh203 | 0:3d9c67d97d6f | 670 | if(x < negMin) |
emh203 | 0:3d9c67d97d6f | 671 | { |
emh203 | 0:3d9c67d97d6f | 672 | x = negMin; |
emh203 | 0:3d9c67d97d6f | 673 | } |
emh203 | 0:3d9c67d97d6f | 674 | } |
emh203 | 0:3d9c67d97d6f | 675 | return (x); |
emh203 | 0:3d9c67d97d6f | 676 | |
emh203 | 0:3d9c67d97d6f | 677 | |
emh203 | 0:3d9c67d97d6f | 678 | } |
emh203 | 0:3d9c67d97d6f | 679 | |
emh203 | 0:3d9c67d97d6f | 680 | #endif /* end of ARM_MATH_CM0_FAMILY */ |
emh203 | 0:3d9c67d97d6f | 681 | |
emh203 | 0:3d9c67d97d6f | 682 | |
emh203 | 0:3d9c67d97d6f | 683 | |
emh203 | 0:3d9c67d97d6f | 684 | /* |
emh203 | 0:3d9c67d97d6f | 685 | * @brief C custom defined intrinsic function for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 686 | */ |
emh203 | 0:3d9c67d97d6f | 687 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
emh203 | 0:3d9c67d97d6f | 688 | |
emh203 | 0:3d9c67d97d6f | 689 | /* |
emh203 | 0:3d9c67d97d6f | 690 | * @brief C custom defined QADD8 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 691 | */ |
emh203 | 0:3d9c67d97d6f | 692 | static __INLINE q31_t __QADD8( |
emh203 | 0:3d9c67d97d6f | 693 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 694 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 695 | { |
emh203 | 0:3d9c67d97d6f | 696 | |
emh203 | 0:3d9c67d97d6f | 697 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 698 | q7_t r, s, t, u; |
emh203 | 0:3d9c67d97d6f | 699 | |
emh203 | 0:3d9c67d97d6f | 700 | r = (q7_t) x; |
emh203 | 0:3d9c67d97d6f | 701 | s = (q7_t) y; |
emh203 | 0:3d9c67d97d6f | 702 | |
emh203 | 0:3d9c67d97d6f | 703 | r = __SSAT((q31_t) (r + s), 8); |
emh203 | 0:3d9c67d97d6f | 704 | s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8); |
emh203 | 0:3d9c67d97d6f | 705 | t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8); |
emh203 | 0:3d9c67d97d6f | 706 | u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8); |
emh203 | 0:3d9c67d97d6f | 707 | |
emh203 | 0:3d9c67d97d6f | 708 | sum = |
emh203 | 0:3d9c67d97d6f | 709 | (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) | |
emh203 | 0:3d9c67d97d6f | 710 | (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF); |
emh203 | 0:3d9c67d97d6f | 711 | |
emh203 | 0:3d9c67d97d6f | 712 | return sum; |
emh203 | 0:3d9c67d97d6f | 713 | |
emh203 | 0:3d9c67d97d6f | 714 | } |
emh203 | 0:3d9c67d97d6f | 715 | |
emh203 | 0:3d9c67d97d6f | 716 | /* |
emh203 | 0:3d9c67d97d6f | 717 | * @brief C custom defined QSUB8 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 718 | */ |
emh203 | 0:3d9c67d97d6f | 719 | static __INLINE q31_t __QSUB8( |
emh203 | 0:3d9c67d97d6f | 720 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 721 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 722 | { |
emh203 | 0:3d9c67d97d6f | 723 | |
emh203 | 0:3d9c67d97d6f | 724 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 725 | q31_t r, s, t, u; |
emh203 | 0:3d9c67d97d6f | 726 | |
emh203 | 0:3d9c67d97d6f | 727 | r = (q7_t) x; |
emh203 | 0:3d9c67d97d6f | 728 | s = (q7_t) y; |
emh203 | 0:3d9c67d97d6f | 729 | |
emh203 | 0:3d9c67d97d6f | 730 | r = __SSAT((r - s), 8); |
emh203 | 0:3d9c67d97d6f | 731 | s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8; |
emh203 | 0:3d9c67d97d6f | 732 | t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16; |
emh203 | 0:3d9c67d97d6f | 733 | u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24; |
emh203 | 0:3d9c67d97d6f | 734 | |
emh203 | 0:3d9c67d97d6f | 735 | sum = |
emh203 | 0:3d9c67d97d6f | 736 | (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & |
emh203 | 0:3d9c67d97d6f | 737 | 0x000000FF); |
emh203 | 0:3d9c67d97d6f | 738 | |
emh203 | 0:3d9c67d97d6f | 739 | return sum; |
emh203 | 0:3d9c67d97d6f | 740 | } |
emh203 | 0:3d9c67d97d6f | 741 | |
emh203 | 0:3d9c67d97d6f | 742 | /* |
emh203 | 0:3d9c67d97d6f | 743 | * @brief C custom defined QADD16 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 744 | */ |
emh203 | 0:3d9c67d97d6f | 745 | |
emh203 | 0:3d9c67d97d6f | 746 | /* |
emh203 | 0:3d9c67d97d6f | 747 | * @brief C custom defined QADD16 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 748 | */ |
emh203 | 0:3d9c67d97d6f | 749 | static __INLINE q31_t __QADD16( |
emh203 | 0:3d9c67d97d6f | 750 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 751 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 752 | { |
emh203 | 0:3d9c67d97d6f | 753 | |
emh203 | 0:3d9c67d97d6f | 754 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 755 | q31_t r, s; |
emh203 | 0:3d9c67d97d6f | 756 | |
emh203 | 0:3d9c67d97d6f | 757 | r = (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 758 | s = (q15_t) y; |
emh203 | 0:3d9c67d97d6f | 759 | |
emh203 | 0:3d9c67d97d6f | 760 | r = __SSAT(r + s, 16); |
emh203 | 0:3d9c67d97d6f | 761 | s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16; |
emh203 | 0:3d9c67d97d6f | 762 | |
emh203 | 0:3d9c67d97d6f | 763 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emh203 | 0:3d9c67d97d6f | 764 | |
emh203 | 0:3d9c67d97d6f | 765 | return sum; |
emh203 | 0:3d9c67d97d6f | 766 | |
emh203 | 0:3d9c67d97d6f | 767 | } |
emh203 | 0:3d9c67d97d6f | 768 | |
emh203 | 0:3d9c67d97d6f | 769 | /* |
emh203 | 0:3d9c67d97d6f | 770 | * @brief C custom defined SHADD16 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 771 | */ |
emh203 | 0:3d9c67d97d6f | 772 | static __INLINE q31_t __SHADD16( |
emh203 | 0:3d9c67d97d6f | 773 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 774 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 775 | { |
emh203 | 0:3d9c67d97d6f | 776 | |
emh203 | 0:3d9c67d97d6f | 777 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 778 | q31_t r, s; |
emh203 | 0:3d9c67d97d6f | 779 | |
emh203 | 0:3d9c67d97d6f | 780 | r = (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 781 | s = (q15_t) y; |
emh203 | 0:3d9c67d97d6f | 782 | |
emh203 | 0:3d9c67d97d6f | 783 | r = ((r >> 1) + (s >> 1)); |
emh203 | 0:3d9c67d97d6f | 784 | s = ((q31_t) ((x >> 17) + (y >> 17))) << 16; |
emh203 | 0:3d9c67d97d6f | 785 | |
emh203 | 0:3d9c67d97d6f | 786 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emh203 | 0:3d9c67d97d6f | 787 | |
emh203 | 0:3d9c67d97d6f | 788 | return sum; |
emh203 | 0:3d9c67d97d6f | 789 | |
emh203 | 0:3d9c67d97d6f | 790 | } |
emh203 | 0:3d9c67d97d6f | 791 | |
emh203 | 0:3d9c67d97d6f | 792 | /* |
emh203 | 0:3d9c67d97d6f | 793 | * @brief C custom defined QSUB16 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 794 | */ |
emh203 | 0:3d9c67d97d6f | 795 | static __INLINE q31_t __QSUB16( |
emh203 | 0:3d9c67d97d6f | 796 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 797 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 798 | { |
emh203 | 0:3d9c67d97d6f | 799 | |
emh203 | 0:3d9c67d97d6f | 800 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 801 | q31_t r, s; |
emh203 | 0:3d9c67d97d6f | 802 | |
emh203 | 0:3d9c67d97d6f | 803 | r = (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 804 | s = (q15_t) y; |
emh203 | 0:3d9c67d97d6f | 805 | |
emh203 | 0:3d9c67d97d6f | 806 | r = __SSAT(r - s, 16); |
emh203 | 0:3d9c67d97d6f | 807 | s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16; |
emh203 | 0:3d9c67d97d6f | 808 | |
emh203 | 0:3d9c67d97d6f | 809 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emh203 | 0:3d9c67d97d6f | 810 | |
emh203 | 0:3d9c67d97d6f | 811 | return sum; |
emh203 | 0:3d9c67d97d6f | 812 | } |
emh203 | 0:3d9c67d97d6f | 813 | |
emh203 | 0:3d9c67d97d6f | 814 | /* |
emh203 | 0:3d9c67d97d6f | 815 | * @brief C custom defined SHSUB16 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 816 | */ |
emh203 | 0:3d9c67d97d6f | 817 | static __INLINE q31_t __SHSUB16( |
emh203 | 0:3d9c67d97d6f | 818 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 819 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 820 | { |
emh203 | 0:3d9c67d97d6f | 821 | |
emh203 | 0:3d9c67d97d6f | 822 | q31_t diff; |
emh203 | 0:3d9c67d97d6f | 823 | q31_t r, s; |
emh203 | 0:3d9c67d97d6f | 824 | |
emh203 | 0:3d9c67d97d6f | 825 | r = (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 826 | s = (q15_t) y; |
emh203 | 0:3d9c67d97d6f | 827 | |
emh203 | 0:3d9c67d97d6f | 828 | r = ((r >> 1) - (s >> 1)); |
emh203 | 0:3d9c67d97d6f | 829 | s = (((x >> 17) - (y >> 17)) << 16); |
emh203 | 0:3d9c67d97d6f | 830 | |
emh203 | 0:3d9c67d97d6f | 831 | diff = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emh203 | 0:3d9c67d97d6f | 832 | |
emh203 | 0:3d9c67d97d6f | 833 | return diff; |
emh203 | 0:3d9c67d97d6f | 834 | } |
emh203 | 0:3d9c67d97d6f | 835 | |
emh203 | 0:3d9c67d97d6f | 836 | /* |
emh203 | 0:3d9c67d97d6f | 837 | * @brief C custom defined QASX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 838 | */ |
emh203 | 0:3d9c67d97d6f | 839 | static __INLINE q31_t __QASX( |
emh203 | 0:3d9c67d97d6f | 840 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 841 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 842 | { |
emh203 | 0:3d9c67d97d6f | 843 | |
emh203 | 0:3d9c67d97d6f | 844 | q31_t sum = 0; |
emh203 | 0:3d9c67d97d6f | 845 | |
emh203 | 0:3d9c67d97d6f | 846 | sum = |
emh203 | 0:3d9c67d97d6f | 847 | ((sum + |
emh203 | 0:3d9c67d97d6f | 848 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) + |
emh203 | 0:3d9c67d97d6f | 849 | clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16))); |
emh203 | 0:3d9c67d97d6f | 850 | |
emh203 | 0:3d9c67d97d6f | 851 | return sum; |
emh203 | 0:3d9c67d97d6f | 852 | } |
emh203 | 0:3d9c67d97d6f | 853 | |
emh203 | 0:3d9c67d97d6f | 854 | /* |
emh203 | 0:3d9c67d97d6f | 855 | * @brief C custom defined SHASX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 856 | */ |
emh203 | 0:3d9c67d97d6f | 857 | static __INLINE q31_t __SHASX( |
emh203 | 0:3d9c67d97d6f | 858 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 859 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 860 | { |
emh203 | 0:3d9c67d97d6f | 861 | |
emh203 | 0:3d9c67d97d6f | 862 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 863 | q31_t r, s; |
emh203 | 0:3d9c67d97d6f | 864 | |
emh203 | 0:3d9c67d97d6f | 865 | r = (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 866 | s = (q15_t) y; |
emh203 | 0:3d9c67d97d6f | 867 | |
emh203 | 0:3d9c67d97d6f | 868 | r = ((r >> 1) - (y >> 17)); |
emh203 | 0:3d9c67d97d6f | 869 | s = (((x >> 17) + (s >> 1)) << 16); |
emh203 | 0:3d9c67d97d6f | 870 | |
emh203 | 0:3d9c67d97d6f | 871 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emh203 | 0:3d9c67d97d6f | 872 | |
emh203 | 0:3d9c67d97d6f | 873 | return sum; |
emh203 | 0:3d9c67d97d6f | 874 | } |
emh203 | 0:3d9c67d97d6f | 875 | |
emh203 | 0:3d9c67d97d6f | 876 | |
emh203 | 0:3d9c67d97d6f | 877 | /* |
emh203 | 0:3d9c67d97d6f | 878 | * @brief C custom defined QSAX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 879 | */ |
emh203 | 0:3d9c67d97d6f | 880 | static __INLINE q31_t __QSAX( |
emh203 | 0:3d9c67d97d6f | 881 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 882 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 883 | { |
emh203 | 0:3d9c67d97d6f | 884 | |
emh203 | 0:3d9c67d97d6f | 885 | q31_t sum = 0; |
emh203 | 0:3d9c67d97d6f | 886 | |
emh203 | 0:3d9c67d97d6f | 887 | sum = |
emh203 | 0:3d9c67d97d6f | 888 | ((sum + |
emh203 | 0:3d9c67d97d6f | 889 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) + |
emh203 | 0:3d9c67d97d6f | 890 | clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16))); |
emh203 | 0:3d9c67d97d6f | 891 | |
emh203 | 0:3d9c67d97d6f | 892 | return sum; |
emh203 | 0:3d9c67d97d6f | 893 | } |
emh203 | 0:3d9c67d97d6f | 894 | |
emh203 | 0:3d9c67d97d6f | 895 | /* |
emh203 | 0:3d9c67d97d6f | 896 | * @brief C custom defined SHSAX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 897 | */ |
emh203 | 0:3d9c67d97d6f | 898 | static __INLINE q31_t __SHSAX( |
emh203 | 0:3d9c67d97d6f | 899 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 900 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 901 | { |
emh203 | 0:3d9c67d97d6f | 902 | |
emh203 | 0:3d9c67d97d6f | 903 | q31_t sum; |
emh203 | 0:3d9c67d97d6f | 904 | q31_t r, s; |
emh203 | 0:3d9c67d97d6f | 905 | |
emh203 | 0:3d9c67d97d6f | 906 | r = (q15_t) x; |
emh203 | 0:3d9c67d97d6f | 907 | s = (q15_t) y; |
emh203 | 0:3d9c67d97d6f | 908 | |
emh203 | 0:3d9c67d97d6f | 909 | r = ((r >> 1) + (y >> 17)); |
emh203 | 0:3d9c67d97d6f | 910 | s = (((x >> 17) - (s >> 1)) << 16); |
emh203 | 0:3d9c67d97d6f | 911 | |
emh203 | 0:3d9c67d97d6f | 912 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emh203 | 0:3d9c67d97d6f | 913 | |
emh203 | 0:3d9c67d97d6f | 914 | return sum; |
emh203 | 0:3d9c67d97d6f | 915 | } |
emh203 | 0:3d9c67d97d6f | 916 | |
emh203 | 0:3d9c67d97d6f | 917 | /* |
emh203 | 0:3d9c67d97d6f | 918 | * @brief C custom defined SMUSDX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 919 | */ |
emh203 | 0:3d9c67d97d6f | 920 | static __INLINE q31_t __SMUSDX( |
emh203 | 0:3d9c67d97d6f | 921 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 922 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 923 | { |
emh203 | 0:3d9c67d97d6f | 924 | |
emh203 | 0:3d9c67d97d6f | 925 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) - |
emh203 | 0:3d9c67d97d6f | 926 | ((q15_t) (x >> 16) * (q15_t) y))); |
emh203 | 0:3d9c67d97d6f | 927 | } |
emh203 | 0:3d9c67d97d6f | 928 | |
emh203 | 0:3d9c67d97d6f | 929 | /* |
emh203 | 0:3d9c67d97d6f | 930 | * @brief C custom defined SMUADX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 931 | */ |
emh203 | 0:3d9c67d97d6f | 932 | static __INLINE q31_t __SMUADX( |
emh203 | 0:3d9c67d97d6f | 933 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 934 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 935 | { |
emh203 | 0:3d9c67d97d6f | 936 | |
emh203 | 0:3d9c67d97d6f | 937 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) + |
emh203 | 0:3d9c67d97d6f | 938 | ((q15_t) (x >> 16) * (q15_t) y))); |
emh203 | 0:3d9c67d97d6f | 939 | } |
emh203 | 0:3d9c67d97d6f | 940 | |
emh203 | 0:3d9c67d97d6f | 941 | /* |
emh203 | 0:3d9c67d97d6f | 942 | * @brief C custom defined QADD for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 943 | */ |
emh203 | 0:3d9c67d97d6f | 944 | static __INLINE q31_t __QADD( |
emh203 | 0:3d9c67d97d6f | 945 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 946 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 947 | { |
emh203 | 0:3d9c67d97d6f | 948 | return clip_q63_to_q31((q63_t) x + y); |
emh203 | 0:3d9c67d97d6f | 949 | } |
emh203 | 0:3d9c67d97d6f | 950 | |
emh203 | 0:3d9c67d97d6f | 951 | /* |
emh203 | 0:3d9c67d97d6f | 952 | * @brief C custom defined QSUB for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 953 | */ |
emh203 | 0:3d9c67d97d6f | 954 | static __INLINE q31_t __QSUB( |
emh203 | 0:3d9c67d97d6f | 955 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 956 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 957 | { |
emh203 | 0:3d9c67d97d6f | 958 | return clip_q63_to_q31((q63_t) x - y); |
emh203 | 0:3d9c67d97d6f | 959 | } |
emh203 | 0:3d9c67d97d6f | 960 | |
emh203 | 0:3d9c67d97d6f | 961 | /* |
emh203 | 0:3d9c67d97d6f | 962 | * @brief C custom defined SMLAD for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 963 | */ |
emh203 | 0:3d9c67d97d6f | 964 | static __INLINE q31_t __SMLAD( |
emh203 | 0:3d9c67d97d6f | 965 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 966 | q31_t y, |
emh203 | 0:3d9c67d97d6f | 967 | q31_t sum) |
emh203 | 0:3d9c67d97d6f | 968 | { |
emh203 | 0:3d9c67d97d6f | 969 | |
emh203 | 0:3d9c67d97d6f | 970 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
emh203 | 0:3d9c67d97d6f | 971 | ((q15_t) x * (q15_t) y)); |
emh203 | 0:3d9c67d97d6f | 972 | } |
emh203 | 0:3d9c67d97d6f | 973 | |
emh203 | 0:3d9c67d97d6f | 974 | /* |
emh203 | 0:3d9c67d97d6f | 975 | * @brief C custom defined SMLADX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 976 | */ |
emh203 | 0:3d9c67d97d6f | 977 | static __INLINE q31_t __SMLADX( |
emh203 | 0:3d9c67d97d6f | 978 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 979 | q31_t y, |
emh203 | 0:3d9c67d97d6f | 980 | q31_t sum) |
emh203 | 0:3d9c67d97d6f | 981 | { |
emh203 | 0:3d9c67d97d6f | 982 | |
emh203 | 0:3d9c67d97d6f | 983 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) + |
emh203 | 0:3d9c67d97d6f | 984 | ((q15_t) x * (q15_t) (y >> 16))); |
emh203 | 0:3d9c67d97d6f | 985 | } |
emh203 | 0:3d9c67d97d6f | 986 | |
emh203 | 0:3d9c67d97d6f | 987 | /* |
emh203 | 0:3d9c67d97d6f | 988 | * @brief C custom defined SMLSDX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 989 | */ |
emh203 | 0:3d9c67d97d6f | 990 | static __INLINE q31_t __SMLSDX( |
emh203 | 0:3d9c67d97d6f | 991 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 992 | q31_t y, |
emh203 | 0:3d9c67d97d6f | 993 | q31_t sum) |
emh203 | 0:3d9c67d97d6f | 994 | { |
emh203 | 0:3d9c67d97d6f | 995 | |
emh203 | 0:3d9c67d97d6f | 996 | return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) + |
emh203 | 0:3d9c67d97d6f | 997 | ((q15_t) x * (q15_t) (y >> 16))); |
emh203 | 0:3d9c67d97d6f | 998 | } |
emh203 | 0:3d9c67d97d6f | 999 | |
emh203 | 0:3d9c67d97d6f | 1000 | /* |
emh203 | 0:3d9c67d97d6f | 1001 | * @brief C custom defined SMLALD for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 1002 | */ |
emh203 | 0:3d9c67d97d6f | 1003 | static __INLINE q63_t __SMLALD( |
emh203 | 0:3d9c67d97d6f | 1004 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 1005 | q31_t y, |
emh203 | 0:3d9c67d97d6f | 1006 | q63_t sum) |
emh203 | 0:3d9c67d97d6f | 1007 | { |
emh203 | 0:3d9c67d97d6f | 1008 | |
emh203 | 0:3d9c67d97d6f | 1009 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
emh203 | 0:3d9c67d97d6f | 1010 | ((q15_t) x * (q15_t) y)); |
emh203 | 0:3d9c67d97d6f | 1011 | } |
emh203 | 0:3d9c67d97d6f | 1012 | |
emh203 | 0:3d9c67d97d6f | 1013 | /* |
emh203 | 0:3d9c67d97d6f | 1014 | * @brief C custom defined SMLALDX for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 1015 | */ |
emh203 | 0:3d9c67d97d6f | 1016 | static __INLINE q63_t __SMLALDX( |
emh203 | 0:3d9c67d97d6f | 1017 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 1018 | q31_t y, |
emh203 | 0:3d9c67d97d6f | 1019 | q63_t sum) |
emh203 | 0:3d9c67d97d6f | 1020 | { |
emh203 | 0:3d9c67d97d6f | 1021 | |
emh203 | 0:3d9c67d97d6f | 1022 | return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + |
emh203 | 0:3d9c67d97d6f | 1023 | ((q15_t) x * (q15_t) (y >> 16)); |
emh203 | 0:3d9c67d97d6f | 1024 | } |
emh203 | 0:3d9c67d97d6f | 1025 | |
emh203 | 0:3d9c67d97d6f | 1026 | /* |
emh203 | 0:3d9c67d97d6f | 1027 | * @brief C custom defined SMUAD for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 1028 | */ |
emh203 | 0:3d9c67d97d6f | 1029 | static __INLINE q31_t __SMUAD( |
emh203 | 0:3d9c67d97d6f | 1030 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 1031 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 1032 | { |
emh203 | 0:3d9c67d97d6f | 1033 | |
emh203 | 0:3d9c67d97d6f | 1034 | return (((x >> 16) * (y >> 16)) + |
emh203 | 0:3d9c67d97d6f | 1035 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
emh203 | 0:3d9c67d97d6f | 1036 | } |
emh203 | 0:3d9c67d97d6f | 1037 | |
emh203 | 0:3d9c67d97d6f | 1038 | /* |
emh203 | 0:3d9c67d97d6f | 1039 | * @brief C custom defined SMUSD for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 1040 | */ |
emh203 | 0:3d9c67d97d6f | 1041 | static __INLINE q31_t __SMUSD( |
emh203 | 0:3d9c67d97d6f | 1042 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 1043 | q31_t y) |
emh203 | 0:3d9c67d97d6f | 1044 | { |
emh203 | 0:3d9c67d97d6f | 1045 | |
emh203 | 0:3d9c67d97d6f | 1046 | return (-((x >> 16) * (y >> 16)) + |
emh203 | 0:3d9c67d97d6f | 1047 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
emh203 | 0:3d9c67d97d6f | 1048 | } |
emh203 | 0:3d9c67d97d6f | 1049 | |
emh203 | 0:3d9c67d97d6f | 1050 | |
emh203 | 0:3d9c67d97d6f | 1051 | /* |
emh203 | 0:3d9c67d97d6f | 1052 | * @brief C custom defined SXTB16 for M3 and M0 processors |
emh203 | 0:3d9c67d97d6f | 1053 | */ |
emh203 | 0:3d9c67d97d6f | 1054 | static __INLINE q31_t __SXTB16( |
emh203 | 0:3d9c67d97d6f | 1055 | q31_t x) |
emh203 | 0:3d9c67d97d6f | 1056 | { |
emh203 | 0:3d9c67d97d6f | 1057 | |
emh203 | 0:3d9c67d97d6f | 1058 | return ((((x << 24) >> 24) & 0x0000FFFF) | |
emh203 | 0:3d9c67d97d6f | 1059 | (((x << 8) >> 8) & 0xFFFF0000)); |
emh203 | 0:3d9c67d97d6f | 1060 | } |
emh203 | 0:3d9c67d97d6f | 1061 | |
emh203 | 0:3d9c67d97d6f | 1062 | |
emh203 | 0:3d9c67d97d6f | 1063 | #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ |
emh203 | 0:3d9c67d97d6f | 1064 | |
emh203 | 0:3d9c67d97d6f | 1065 | |
emh203 | 0:3d9c67d97d6f | 1066 | /** |
emh203 | 0:3d9c67d97d6f | 1067 | * @brief Instance structure for the Q7 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1068 | */ |
emh203 | 0:3d9c67d97d6f | 1069 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1070 | { |
emh203 | 0:3d9c67d97d6f | 1071 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 1072 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 1073 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 1074 | } arm_fir_instance_q7; |
emh203 | 0:3d9c67d97d6f | 1075 | |
emh203 | 0:3d9c67d97d6f | 1076 | /** |
emh203 | 0:3d9c67d97d6f | 1077 | * @brief Instance structure for the Q15 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1078 | */ |
emh203 | 0:3d9c67d97d6f | 1079 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1080 | { |
emh203 | 0:3d9c67d97d6f | 1081 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 1082 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 1083 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 1084 | } arm_fir_instance_q15; |
emh203 | 0:3d9c67d97d6f | 1085 | |
emh203 | 0:3d9c67d97d6f | 1086 | /** |
emh203 | 0:3d9c67d97d6f | 1087 | * @brief Instance structure for the Q31 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1088 | */ |
emh203 | 0:3d9c67d97d6f | 1089 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1090 | { |
emh203 | 0:3d9c67d97d6f | 1091 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 1092 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 1093 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 1094 | } arm_fir_instance_q31; |
emh203 | 0:3d9c67d97d6f | 1095 | |
emh203 | 0:3d9c67d97d6f | 1096 | /** |
emh203 | 0:3d9c67d97d6f | 1097 | * @brief Instance structure for the floating-point FIR filter. |
emh203 | 0:3d9c67d97d6f | 1098 | */ |
emh203 | 0:3d9c67d97d6f | 1099 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1100 | { |
emh203 | 0:3d9c67d97d6f | 1101 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 1102 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 1103 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 1104 | } arm_fir_instance_f32; |
emh203 | 0:3d9c67d97d6f | 1105 | |
emh203 | 0:3d9c67d97d6f | 1106 | |
emh203 | 0:3d9c67d97d6f | 1107 | /** |
emh203 | 0:3d9c67d97d6f | 1108 | * @brief Processing function for the Q7 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1109 | * @param[in] *S points to an instance of the Q7 FIR filter structure. |
emh203 | 0:3d9c67d97d6f | 1110 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1111 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1112 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1113 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1114 | */ |
emh203 | 0:3d9c67d97d6f | 1115 | void arm_fir_q7( |
emh203 | 0:3d9c67d97d6f | 1116 | const arm_fir_instance_q7 * S, |
emh203 | 0:3d9c67d97d6f | 1117 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1118 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1119 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1120 | |
emh203 | 0:3d9c67d97d6f | 1121 | |
emh203 | 0:3d9c67d97d6f | 1122 | /** |
emh203 | 0:3d9c67d97d6f | 1123 | * @brief Initialization function for the Q7 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1124 | * @param[in,out] *S points to an instance of the Q7 FIR structure. |
emh203 | 0:3d9c67d97d6f | 1125 | * @param[in] numTaps Number of filter coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 1126 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1127 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1128 | * @param[in] blockSize number of samples that are processed. |
emh203 | 0:3d9c67d97d6f | 1129 | * @return none |
emh203 | 0:3d9c67d97d6f | 1130 | */ |
emh203 | 0:3d9c67d97d6f | 1131 | void arm_fir_init_q7( |
emh203 | 0:3d9c67d97d6f | 1132 | arm_fir_instance_q7 * S, |
emh203 | 0:3d9c67d97d6f | 1133 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 1134 | q7_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1135 | q7_t * pState, |
emh203 | 0:3d9c67d97d6f | 1136 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1137 | |
emh203 | 0:3d9c67d97d6f | 1138 | |
emh203 | 0:3d9c67d97d6f | 1139 | /** |
emh203 | 0:3d9c67d97d6f | 1140 | * @brief Processing function for the Q15 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1141 | * @param[in] *S points to an instance of the Q15 FIR structure. |
emh203 | 0:3d9c67d97d6f | 1142 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1143 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1144 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1145 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1146 | */ |
emh203 | 0:3d9c67d97d6f | 1147 | void arm_fir_q15( |
emh203 | 0:3d9c67d97d6f | 1148 | const arm_fir_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1149 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1150 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1151 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1152 | |
emh203 | 0:3d9c67d97d6f | 1153 | /** |
emh203 | 0:3d9c67d97d6f | 1154 | * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 1155 | * @param[in] *S points to an instance of the Q15 FIR filter structure. |
emh203 | 0:3d9c67d97d6f | 1156 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1157 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1158 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1159 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1160 | */ |
emh203 | 0:3d9c67d97d6f | 1161 | void arm_fir_fast_q15( |
emh203 | 0:3d9c67d97d6f | 1162 | const arm_fir_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1163 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1164 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1165 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1166 | |
emh203 | 0:3d9c67d97d6f | 1167 | /** |
emh203 | 0:3d9c67d97d6f | 1168 | * @brief Initialization function for the Q15 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1169 | * @param[in,out] *S points to an instance of the Q15 FIR filter structure. |
emh203 | 0:3d9c67d97d6f | 1170 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. |
emh203 | 0:3d9c67d97d6f | 1171 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1172 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1173 | * @param[in] blockSize number of samples that are processed at a time. |
emh203 | 0:3d9c67d97d6f | 1174 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if |
emh203 | 0:3d9c67d97d6f | 1175 | * <code>numTaps</code> is not a supported value. |
emh203 | 0:3d9c67d97d6f | 1176 | */ |
emh203 | 0:3d9c67d97d6f | 1177 | |
emh203 | 0:3d9c67d97d6f | 1178 | arm_status arm_fir_init_q15( |
emh203 | 0:3d9c67d97d6f | 1179 | arm_fir_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1180 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 1181 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1182 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 1183 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1184 | |
emh203 | 0:3d9c67d97d6f | 1185 | /** |
emh203 | 0:3d9c67d97d6f | 1186 | * @brief Processing function for the Q31 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1187 | * @param[in] *S points to an instance of the Q31 FIR filter structure. |
emh203 | 0:3d9c67d97d6f | 1188 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1189 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1190 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1191 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1192 | */ |
emh203 | 0:3d9c67d97d6f | 1193 | void arm_fir_q31( |
emh203 | 0:3d9c67d97d6f | 1194 | const arm_fir_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1195 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1196 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1197 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1198 | |
emh203 | 0:3d9c67d97d6f | 1199 | /** |
emh203 | 0:3d9c67d97d6f | 1200 | * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 1201 | * @param[in] *S points to an instance of the Q31 FIR structure. |
emh203 | 0:3d9c67d97d6f | 1202 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1203 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1204 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1205 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1206 | */ |
emh203 | 0:3d9c67d97d6f | 1207 | void arm_fir_fast_q31( |
emh203 | 0:3d9c67d97d6f | 1208 | const arm_fir_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1209 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1210 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1211 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1212 | |
emh203 | 0:3d9c67d97d6f | 1213 | /** |
emh203 | 0:3d9c67d97d6f | 1214 | * @brief Initialization function for the Q31 FIR filter. |
emh203 | 0:3d9c67d97d6f | 1215 | * @param[in,out] *S points to an instance of the Q31 FIR structure. |
emh203 | 0:3d9c67d97d6f | 1216 | * @param[in] numTaps Number of filter coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 1217 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1218 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1219 | * @param[in] blockSize number of samples that are processed at a time. |
emh203 | 0:3d9c67d97d6f | 1220 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1221 | */ |
emh203 | 0:3d9c67d97d6f | 1222 | void arm_fir_init_q31( |
emh203 | 0:3d9c67d97d6f | 1223 | arm_fir_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1224 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 1225 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1226 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 1227 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1228 | |
emh203 | 0:3d9c67d97d6f | 1229 | /** |
emh203 | 0:3d9c67d97d6f | 1230 | * @brief Processing function for the floating-point FIR filter. |
emh203 | 0:3d9c67d97d6f | 1231 | * @param[in] *S points to an instance of the floating-point FIR structure. |
emh203 | 0:3d9c67d97d6f | 1232 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1233 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1234 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1235 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1236 | */ |
emh203 | 0:3d9c67d97d6f | 1237 | void arm_fir_f32( |
emh203 | 0:3d9c67d97d6f | 1238 | const arm_fir_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 1239 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1240 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1241 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1242 | |
emh203 | 0:3d9c67d97d6f | 1243 | /** |
emh203 | 0:3d9c67d97d6f | 1244 | * @brief Initialization function for the floating-point FIR filter. |
emh203 | 0:3d9c67d97d6f | 1245 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. |
emh203 | 0:3d9c67d97d6f | 1246 | * @param[in] numTaps Number of filter coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 1247 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1248 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1249 | * @param[in] blockSize number of samples that are processed at a time. |
emh203 | 0:3d9c67d97d6f | 1250 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1251 | */ |
emh203 | 0:3d9c67d97d6f | 1252 | void arm_fir_init_f32( |
emh203 | 0:3d9c67d97d6f | 1253 | arm_fir_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 1254 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 1255 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1256 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 1257 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1258 | |
emh203 | 0:3d9c67d97d6f | 1259 | |
emh203 | 0:3d9c67d97d6f | 1260 | /** |
emh203 | 0:3d9c67d97d6f | 1261 | * @brief Instance structure for the Q15 Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1262 | */ |
emh203 | 0:3d9c67d97d6f | 1263 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1264 | { |
emh203 | 0:3d9c67d97d6f | 1265 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1266 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1267 | q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1268 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
emh203 | 0:3d9c67d97d6f | 1269 | |
emh203 | 0:3d9c67d97d6f | 1270 | } arm_biquad_casd_df1_inst_q15; |
emh203 | 0:3d9c67d97d6f | 1271 | |
emh203 | 0:3d9c67d97d6f | 1272 | |
emh203 | 0:3d9c67d97d6f | 1273 | /** |
emh203 | 0:3d9c67d97d6f | 1274 | * @brief Instance structure for the Q31 Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1275 | */ |
emh203 | 0:3d9c67d97d6f | 1276 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1277 | { |
emh203 | 0:3d9c67d97d6f | 1278 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1279 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1280 | q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1281 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
emh203 | 0:3d9c67d97d6f | 1282 | |
emh203 | 0:3d9c67d97d6f | 1283 | } arm_biquad_casd_df1_inst_q31; |
emh203 | 0:3d9c67d97d6f | 1284 | |
emh203 | 0:3d9c67d97d6f | 1285 | /** |
emh203 | 0:3d9c67d97d6f | 1286 | * @brief Instance structure for the floating-point Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1287 | */ |
emh203 | 0:3d9c67d97d6f | 1288 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1289 | { |
emh203 | 0:3d9c67d97d6f | 1290 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1291 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1292 | float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
emh203 | 0:3d9c67d97d6f | 1293 | |
emh203 | 0:3d9c67d97d6f | 1294 | |
emh203 | 0:3d9c67d97d6f | 1295 | } arm_biquad_casd_df1_inst_f32; |
emh203 | 0:3d9c67d97d6f | 1296 | |
emh203 | 0:3d9c67d97d6f | 1297 | |
emh203 | 0:3d9c67d97d6f | 1298 | |
emh203 | 0:3d9c67d97d6f | 1299 | /** |
emh203 | 0:3d9c67d97d6f | 1300 | * @brief Processing function for the Q15 Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1301 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1302 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1303 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1304 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1305 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1306 | */ |
emh203 | 0:3d9c67d97d6f | 1307 | |
emh203 | 0:3d9c67d97d6f | 1308 | void arm_biquad_cascade_df1_q15( |
emh203 | 0:3d9c67d97d6f | 1309 | const arm_biquad_casd_df1_inst_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1310 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1311 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1312 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1313 | |
emh203 | 0:3d9c67d97d6f | 1314 | /** |
emh203 | 0:3d9c67d97d6f | 1315 | * @brief Initialization function for the Q15 Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1316 | * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1317 | * @param[in] numStages number of 2nd order stages in the filter. |
emh203 | 0:3d9c67d97d6f | 1318 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1319 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1320 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
emh203 | 0:3d9c67d97d6f | 1321 | * @return none |
emh203 | 0:3d9c67d97d6f | 1322 | */ |
emh203 | 0:3d9c67d97d6f | 1323 | |
emh203 | 0:3d9c67d97d6f | 1324 | void arm_biquad_cascade_df1_init_q15( |
emh203 | 0:3d9c67d97d6f | 1325 | arm_biquad_casd_df1_inst_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1326 | uint8_t numStages, |
emh203 | 0:3d9c67d97d6f | 1327 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1328 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 1329 | int8_t postShift); |
emh203 | 0:3d9c67d97d6f | 1330 | |
emh203 | 0:3d9c67d97d6f | 1331 | |
emh203 | 0:3d9c67d97d6f | 1332 | /** |
emh203 | 0:3d9c67d97d6f | 1333 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 1334 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1335 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1336 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1337 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1338 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1339 | */ |
emh203 | 0:3d9c67d97d6f | 1340 | |
emh203 | 0:3d9c67d97d6f | 1341 | void arm_biquad_cascade_df1_fast_q15( |
emh203 | 0:3d9c67d97d6f | 1342 | const arm_biquad_casd_df1_inst_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1343 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1344 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1345 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1346 | |
emh203 | 0:3d9c67d97d6f | 1347 | |
emh203 | 0:3d9c67d97d6f | 1348 | /** |
emh203 | 0:3d9c67d97d6f | 1349 | * @brief Processing function for the Q31 Biquad cascade filter |
emh203 | 0:3d9c67d97d6f | 1350 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1351 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1352 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1353 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1354 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1355 | */ |
emh203 | 0:3d9c67d97d6f | 1356 | |
emh203 | 0:3d9c67d97d6f | 1357 | void arm_biquad_cascade_df1_q31( |
emh203 | 0:3d9c67d97d6f | 1358 | const arm_biquad_casd_df1_inst_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1359 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1360 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1361 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1362 | |
emh203 | 0:3d9c67d97d6f | 1363 | /** |
emh203 | 0:3d9c67d97d6f | 1364 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 1365 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1366 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1367 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1368 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1369 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1370 | */ |
emh203 | 0:3d9c67d97d6f | 1371 | |
emh203 | 0:3d9c67d97d6f | 1372 | void arm_biquad_cascade_df1_fast_q31( |
emh203 | 0:3d9c67d97d6f | 1373 | const arm_biquad_casd_df1_inst_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1374 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1375 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1376 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1377 | |
emh203 | 0:3d9c67d97d6f | 1378 | /** |
emh203 | 0:3d9c67d97d6f | 1379 | * @brief Initialization function for the Q31 Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1380 | * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1381 | * @param[in] numStages number of 2nd order stages in the filter. |
emh203 | 0:3d9c67d97d6f | 1382 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1383 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1384 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
emh203 | 0:3d9c67d97d6f | 1385 | * @return none |
emh203 | 0:3d9c67d97d6f | 1386 | */ |
emh203 | 0:3d9c67d97d6f | 1387 | |
emh203 | 0:3d9c67d97d6f | 1388 | void arm_biquad_cascade_df1_init_q31( |
emh203 | 0:3d9c67d97d6f | 1389 | arm_biquad_casd_df1_inst_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1390 | uint8_t numStages, |
emh203 | 0:3d9c67d97d6f | 1391 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1392 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 1393 | int8_t postShift); |
emh203 | 0:3d9c67d97d6f | 1394 | |
emh203 | 0:3d9c67d97d6f | 1395 | /** |
emh203 | 0:3d9c67d97d6f | 1396 | * @brief Processing function for the floating-point Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1397 | * @param[in] *S points to an instance of the floating-point Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1398 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 1399 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 1400 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 1401 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1402 | */ |
emh203 | 0:3d9c67d97d6f | 1403 | |
emh203 | 0:3d9c67d97d6f | 1404 | void arm_biquad_cascade_df1_f32( |
emh203 | 0:3d9c67d97d6f | 1405 | const arm_biquad_casd_df1_inst_f32 * S, |
emh203 | 0:3d9c67d97d6f | 1406 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 1407 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1408 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1409 | |
emh203 | 0:3d9c67d97d6f | 1410 | /** |
emh203 | 0:3d9c67d97d6f | 1411 | * @brief Initialization function for the floating-point Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 1412 | * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. |
emh203 | 0:3d9c67d97d6f | 1413 | * @param[in] numStages number of 2nd order stages in the filter. |
emh203 | 0:3d9c67d97d6f | 1414 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 1415 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 1416 | * @return none |
emh203 | 0:3d9c67d97d6f | 1417 | */ |
emh203 | 0:3d9c67d97d6f | 1418 | |
emh203 | 0:3d9c67d97d6f | 1419 | void arm_biquad_cascade_df1_init_f32( |
emh203 | 0:3d9c67d97d6f | 1420 | arm_biquad_casd_df1_inst_f32 * S, |
emh203 | 0:3d9c67d97d6f | 1421 | uint8_t numStages, |
emh203 | 0:3d9c67d97d6f | 1422 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 1423 | float32_t * pState); |
emh203 | 0:3d9c67d97d6f | 1424 | |
emh203 | 0:3d9c67d97d6f | 1425 | |
emh203 | 0:3d9c67d97d6f | 1426 | /** |
emh203 | 0:3d9c67d97d6f | 1427 | * @brief Instance structure for the floating-point matrix structure. |
emh203 | 0:3d9c67d97d6f | 1428 | */ |
emh203 | 0:3d9c67d97d6f | 1429 | |
emh203 | 0:3d9c67d97d6f | 1430 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1431 | { |
emh203 | 0:3d9c67d97d6f | 1432 | uint16_t numRows; /**< number of rows of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1433 | uint16_t numCols; /**< number of columns of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1434 | float32_t *pData; /**< points to the data of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1435 | } arm_matrix_instance_f32; |
emh203 | 0:3d9c67d97d6f | 1436 | |
emh203 | 0:3d9c67d97d6f | 1437 | /** |
emh203 | 0:3d9c67d97d6f | 1438 | * @brief Instance structure for the Q15 matrix structure. |
emh203 | 0:3d9c67d97d6f | 1439 | */ |
emh203 | 0:3d9c67d97d6f | 1440 | |
emh203 | 0:3d9c67d97d6f | 1441 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1442 | { |
emh203 | 0:3d9c67d97d6f | 1443 | uint16_t numRows; /**< number of rows of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1444 | uint16_t numCols; /**< number of columns of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1445 | q15_t *pData; /**< points to the data of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1446 | |
emh203 | 0:3d9c67d97d6f | 1447 | } arm_matrix_instance_q15; |
emh203 | 0:3d9c67d97d6f | 1448 | |
emh203 | 0:3d9c67d97d6f | 1449 | /** |
emh203 | 0:3d9c67d97d6f | 1450 | * @brief Instance structure for the Q31 matrix structure. |
emh203 | 0:3d9c67d97d6f | 1451 | */ |
emh203 | 0:3d9c67d97d6f | 1452 | |
emh203 | 0:3d9c67d97d6f | 1453 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1454 | { |
emh203 | 0:3d9c67d97d6f | 1455 | uint16_t numRows; /**< number of rows of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1456 | uint16_t numCols; /**< number of columns of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1457 | q31_t *pData; /**< points to the data of the matrix. */ |
emh203 | 0:3d9c67d97d6f | 1458 | |
emh203 | 0:3d9c67d97d6f | 1459 | } arm_matrix_instance_q31; |
emh203 | 0:3d9c67d97d6f | 1460 | |
emh203 | 0:3d9c67d97d6f | 1461 | |
emh203 | 0:3d9c67d97d6f | 1462 | |
emh203 | 0:3d9c67d97d6f | 1463 | /** |
emh203 | 0:3d9c67d97d6f | 1464 | * @brief Floating-point matrix addition. |
emh203 | 0:3d9c67d97d6f | 1465 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1466 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1467 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1468 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1469 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1470 | */ |
emh203 | 0:3d9c67d97d6f | 1471 | |
emh203 | 0:3d9c67d97d6f | 1472 | arm_status arm_mat_add_f32( |
emh203 | 0:3d9c67d97d6f | 1473 | const arm_matrix_instance_f32 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1474 | const arm_matrix_instance_f32 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1475 | arm_matrix_instance_f32 * pDst); |
emh203 | 0:3d9c67d97d6f | 1476 | |
emh203 | 0:3d9c67d97d6f | 1477 | /** |
emh203 | 0:3d9c67d97d6f | 1478 | * @brief Q15 matrix addition. |
emh203 | 0:3d9c67d97d6f | 1479 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1480 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1481 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1482 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1483 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1484 | */ |
emh203 | 0:3d9c67d97d6f | 1485 | |
emh203 | 0:3d9c67d97d6f | 1486 | arm_status arm_mat_add_q15( |
emh203 | 0:3d9c67d97d6f | 1487 | const arm_matrix_instance_q15 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1488 | const arm_matrix_instance_q15 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1489 | arm_matrix_instance_q15 * pDst); |
emh203 | 0:3d9c67d97d6f | 1490 | |
emh203 | 0:3d9c67d97d6f | 1491 | /** |
emh203 | 0:3d9c67d97d6f | 1492 | * @brief Q31 matrix addition. |
emh203 | 0:3d9c67d97d6f | 1493 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1494 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1495 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1496 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1497 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1498 | */ |
emh203 | 0:3d9c67d97d6f | 1499 | |
emh203 | 0:3d9c67d97d6f | 1500 | arm_status arm_mat_add_q31( |
emh203 | 0:3d9c67d97d6f | 1501 | const arm_matrix_instance_q31 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1502 | const arm_matrix_instance_q31 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1503 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1504 | |
emh203 | 0:3d9c67d97d6f | 1505 | /** |
emh203 | 0:3d9c67d97d6f | 1506 | * @brief Floating-point, complex, matrix multiplication. |
emh203 | 0:3d9c67d97d6f | 1507 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1508 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1509 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1510 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1511 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1512 | */ |
emh203 | 0:3d9c67d97d6f | 1513 | |
emh203 | 0:3d9c67d97d6f | 1514 | arm_status arm_mat_cmplx_mult_f32( |
emh203 | 0:3d9c67d97d6f | 1515 | const arm_matrix_instance_f32 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1516 | const arm_matrix_instance_f32 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1517 | arm_matrix_instance_f32 * pDst); |
emh203 | 0:3d9c67d97d6f | 1518 | |
emh203 | 0:3d9c67d97d6f | 1519 | /** |
emh203 | 0:3d9c67d97d6f | 1520 | * @brief Q15, complex, matrix multiplication. |
emh203 | 0:3d9c67d97d6f | 1521 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1522 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1523 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1524 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1525 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1526 | */ |
emh203 | 0:3d9c67d97d6f | 1527 | |
emh203 | 0:3d9c67d97d6f | 1528 | arm_status arm_mat_cmplx_mult_q15( |
emh203 | 0:3d9c67d97d6f | 1529 | const arm_matrix_instance_q15 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1530 | const arm_matrix_instance_q15 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1531 | arm_matrix_instance_q15 * pDst, |
emh203 | 0:3d9c67d97d6f | 1532 | q15_t * pScratch); |
emh203 | 0:3d9c67d97d6f | 1533 | |
emh203 | 0:3d9c67d97d6f | 1534 | /** |
emh203 | 0:3d9c67d97d6f | 1535 | * @brief Q31, complex, matrix multiplication. |
emh203 | 0:3d9c67d97d6f | 1536 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1537 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1538 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1539 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1540 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1541 | */ |
emh203 | 0:3d9c67d97d6f | 1542 | |
emh203 | 0:3d9c67d97d6f | 1543 | arm_status arm_mat_cmplx_mult_q31( |
emh203 | 0:3d9c67d97d6f | 1544 | const arm_matrix_instance_q31 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1545 | const arm_matrix_instance_q31 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1546 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1547 | |
emh203 | 0:3d9c67d97d6f | 1548 | |
emh203 | 0:3d9c67d97d6f | 1549 | /** |
emh203 | 0:3d9c67d97d6f | 1550 | * @brief Floating-point matrix transpose. |
emh203 | 0:3d9c67d97d6f | 1551 | * @param[in] *pSrc points to the input matrix |
emh203 | 0:3d9c67d97d6f | 1552 | * @param[out] *pDst points to the output matrix |
emh203 | 0:3d9c67d97d6f | 1553 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
emh203 | 0:3d9c67d97d6f | 1554 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1555 | */ |
emh203 | 0:3d9c67d97d6f | 1556 | |
emh203 | 0:3d9c67d97d6f | 1557 | arm_status arm_mat_trans_f32( |
emh203 | 0:3d9c67d97d6f | 1558 | const arm_matrix_instance_f32 * pSrc, |
emh203 | 0:3d9c67d97d6f | 1559 | arm_matrix_instance_f32 * pDst); |
emh203 | 0:3d9c67d97d6f | 1560 | |
emh203 | 0:3d9c67d97d6f | 1561 | |
emh203 | 0:3d9c67d97d6f | 1562 | /** |
emh203 | 0:3d9c67d97d6f | 1563 | * @brief Q15 matrix transpose. |
emh203 | 0:3d9c67d97d6f | 1564 | * @param[in] *pSrc points to the input matrix |
emh203 | 0:3d9c67d97d6f | 1565 | * @param[out] *pDst points to the output matrix |
emh203 | 0:3d9c67d97d6f | 1566 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
emh203 | 0:3d9c67d97d6f | 1567 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1568 | */ |
emh203 | 0:3d9c67d97d6f | 1569 | |
emh203 | 0:3d9c67d97d6f | 1570 | arm_status arm_mat_trans_q15( |
emh203 | 0:3d9c67d97d6f | 1571 | const arm_matrix_instance_q15 * pSrc, |
emh203 | 0:3d9c67d97d6f | 1572 | arm_matrix_instance_q15 * pDst); |
emh203 | 0:3d9c67d97d6f | 1573 | |
emh203 | 0:3d9c67d97d6f | 1574 | /** |
emh203 | 0:3d9c67d97d6f | 1575 | * @brief Q31 matrix transpose. |
emh203 | 0:3d9c67d97d6f | 1576 | * @param[in] *pSrc points to the input matrix |
emh203 | 0:3d9c67d97d6f | 1577 | * @param[out] *pDst points to the output matrix |
emh203 | 0:3d9c67d97d6f | 1578 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
emh203 | 0:3d9c67d97d6f | 1579 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1580 | */ |
emh203 | 0:3d9c67d97d6f | 1581 | |
emh203 | 0:3d9c67d97d6f | 1582 | arm_status arm_mat_trans_q31( |
emh203 | 0:3d9c67d97d6f | 1583 | const arm_matrix_instance_q31 * pSrc, |
emh203 | 0:3d9c67d97d6f | 1584 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1585 | |
emh203 | 0:3d9c67d97d6f | 1586 | |
emh203 | 0:3d9c67d97d6f | 1587 | /** |
emh203 | 0:3d9c67d97d6f | 1588 | * @brief Floating-point matrix multiplication |
emh203 | 0:3d9c67d97d6f | 1589 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1590 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1591 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1592 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1593 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1594 | */ |
emh203 | 0:3d9c67d97d6f | 1595 | |
emh203 | 0:3d9c67d97d6f | 1596 | arm_status arm_mat_mult_f32( |
emh203 | 0:3d9c67d97d6f | 1597 | const arm_matrix_instance_f32 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1598 | const arm_matrix_instance_f32 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1599 | arm_matrix_instance_f32 * pDst); |
emh203 | 0:3d9c67d97d6f | 1600 | |
emh203 | 0:3d9c67d97d6f | 1601 | /** |
emh203 | 0:3d9c67d97d6f | 1602 | * @brief Q15 matrix multiplication |
emh203 | 0:3d9c67d97d6f | 1603 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1604 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1605 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1606 | * @param[in] *pState points to the array for storing intermediate results |
emh203 | 0:3d9c67d97d6f | 1607 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1608 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1609 | */ |
emh203 | 0:3d9c67d97d6f | 1610 | |
emh203 | 0:3d9c67d97d6f | 1611 | arm_status arm_mat_mult_q15( |
emh203 | 0:3d9c67d97d6f | 1612 | const arm_matrix_instance_q15 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1613 | const arm_matrix_instance_q15 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1614 | arm_matrix_instance_q15 * pDst, |
emh203 | 0:3d9c67d97d6f | 1615 | q15_t * pState); |
emh203 | 0:3d9c67d97d6f | 1616 | |
emh203 | 0:3d9c67d97d6f | 1617 | /** |
emh203 | 0:3d9c67d97d6f | 1618 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 1619 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1620 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1621 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1622 | * @param[in] *pState points to the array for storing intermediate results |
emh203 | 0:3d9c67d97d6f | 1623 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1624 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1625 | */ |
emh203 | 0:3d9c67d97d6f | 1626 | |
emh203 | 0:3d9c67d97d6f | 1627 | arm_status arm_mat_mult_fast_q15( |
emh203 | 0:3d9c67d97d6f | 1628 | const arm_matrix_instance_q15 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1629 | const arm_matrix_instance_q15 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1630 | arm_matrix_instance_q15 * pDst, |
emh203 | 0:3d9c67d97d6f | 1631 | q15_t * pState); |
emh203 | 0:3d9c67d97d6f | 1632 | |
emh203 | 0:3d9c67d97d6f | 1633 | /** |
emh203 | 0:3d9c67d97d6f | 1634 | * @brief Q31 matrix multiplication |
emh203 | 0:3d9c67d97d6f | 1635 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1636 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1637 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1638 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1639 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1640 | */ |
emh203 | 0:3d9c67d97d6f | 1641 | |
emh203 | 0:3d9c67d97d6f | 1642 | arm_status arm_mat_mult_q31( |
emh203 | 0:3d9c67d97d6f | 1643 | const arm_matrix_instance_q31 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1644 | const arm_matrix_instance_q31 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1645 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1646 | |
emh203 | 0:3d9c67d97d6f | 1647 | /** |
emh203 | 0:3d9c67d97d6f | 1648 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 1649 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1650 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1651 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1652 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1653 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1654 | */ |
emh203 | 0:3d9c67d97d6f | 1655 | |
emh203 | 0:3d9c67d97d6f | 1656 | arm_status arm_mat_mult_fast_q31( |
emh203 | 0:3d9c67d97d6f | 1657 | const arm_matrix_instance_q31 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1658 | const arm_matrix_instance_q31 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1659 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1660 | |
emh203 | 0:3d9c67d97d6f | 1661 | |
emh203 | 0:3d9c67d97d6f | 1662 | /** |
emh203 | 0:3d9c67d97d6f | 1663 | * @brief Floating-point matrix subtraction |
emh203 | 0:3d9c67d97d6f | 1664 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1665 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1666 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1667 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1668 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1669 | */ |
emh203 | 0:3d9c67d97d6f | 1670 | |
emh203 | 0:3d9c67d97d6f | 1671 | arm_status arm_mat_sub_f32( |
emh203 | 0:3d9c67d97d6f | 1672 | const arm_matrix_instance_f32 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1673 | const arm_matrix_instance_f32 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1674 | arm_matrix_instance_f32 * pDst); |
emh203 | 0:3d9c67d97d6f | 1675 | |
emh203 | 0:3d9c67d97d6f | 1676 | /** |
emh203 | 0:3d9c67d97d6f | 1677 | * @brief Q15 matrix subtraction |
emh203 | 0:3d9c67d97d6f | 1678 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1679 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1680 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1681 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1682 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1683 | */ |
emh203 | 0:3d9c67d97d6f | 1684 | |
emh203 | 0:3d9c67d97d6f | 1685 | arm_status arm_mat_sub_q15( |
emh203 | 0:3d9c67d97d6f | 1686 | const arm_matrix_instance_q15 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1687 | const arm_matrix_instance_q15 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1688 | arm_matrix_instance_q15 * pDst); |
emh203 | 0:3d9c67d97d6f | 1689 | |
emh203 | 0:3d9c67d97d6f | 1690 | /** |
emh203 | 0:3d9c67d97d6f | 1691 | * @brief Q31 matrix subtraction |
emh203 | 0:3d9c67d97d6f | 1692 | * @param[in] *pSrcA points to the first input matrix structure |
emh203 | 0:3d9c67d97d6f | 1693 | * @param[in] *pSrcB points to the second input matrix structure |
emh203 | 0:3d9c67d97d6f | 1694 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1695 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1696 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1697 | */ |
emh203 | 0:3d9c67d97d6f | 1698 | |
emh203 | 0:3d9c67d97d6f | 1699 | arm_status arm_mat_sub_q31( |
emh203 | 0:3d9c67d97d6f | 1700 | const arm_matrix_instance_q31 * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1701 | const arm_matrix_instance_q31 * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1702 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1703 | |
emh203 | 0:3d9c67d97d6f | 1704 | /** |
emh203 | 0:3d9c67d97d6f | 1705 | * @brief Floating-point matrix scaling. |
emh203 | 0:3d9c67d97d6f | 1706 | * @param[in] *pSrc points to the input matrix |
emh203 | 0:3d9c67d97d6f | 1707 | * @param[in] scale scale factor |
emh203 | 0:3d9c67d97d6f | 1708 | * @param[out] *pDst points to the output matrix |
emh203 | 0:3d9c67d97d6f | 1709 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1710 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1711 | */ |
emh203 | 0:3d9c67d97d6f | 1712 | |
emh203 | 0:3d9c67d97d6f | 1713 | arm_status arm_mat_scale_f32( |
emh203 | 0:3d9c67d97d6f | 1714 | const arm_matrix_instance_f32 * pSrc, |
emh203 | 0:3d9c67d97d6f | 1715 | float32_t scale, |
emh203 | 0:3d9c67d97d6f | 1716 | arm_matrix_instance_f32 * pDst); |
emh203 | 0:3d9c67d97d6f | 1717 | |
emh203 | 0:3d9c67d97d6f | 1718 | /** |
emh203 | 0:3d9c67d97d6f | 1719 | * @brief Q15 matrix scaling. |
emh203 | 0:3d9c67d97d6f | 1720 | * @param[in] *pSrc points to input matrix |
emh203 | 0:3d9c67d97d6f | 1721 | * @param[in] scaleFract fractional portion of the scale factor |
emh203 | 0:3d9c67d97d6f | 1722 | * @param[in] shift number of bits to shift the result by |
emh203 | 0:3d9c67d97d6f | 1723 | * @param[out] *pDst points to output matrix |
emh203 | 0:3d9c67d97d6f | 1724 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1725 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1726 | */ |
emh203 | 0:3d9c67d97d6f | 1727 | |
emh203 | 0:3d9c67d97d6f | 1728 | arm_status arm_mat_scale_q15( |
emh203 | 0:3d9c67d97d6f | 1729 | const arm_matrix_instance_q15 * pSrc, |
emh203 | 0:3d9c67d97d6f | 1730 | q15_t scaleFract, |
emh203 | 0:3d9c67d97d6f | 1731 | int32_t shift, |
emh203 | 0:3d9c67d97d6f | 1732 | arm_matrix_instance_q15 * pDst); |
emh203 | 0:3d9c67d97d6f | 1733 | |
emh203 | 0:3d9c67d97d6f | 1734 | /** |
emh203 | 0:3d9c67d97d6f | 1735 | * @brief Q31 matrix scaling. |
emh203 | 0:3d9c67d97d6f | 1736 | * @param[in] *pSrc points to input matrix |
emh203 | 0:3d9c67d97d6f | 1737 | * @param[in] scaleFract fractional portion of the scale factor |
emh203 | 0:3d9c67d97d6f | 1738 | * @param[in] shift number of bits to shift the result by |
emh203 | 0:3d9c67d97d6f | 1739 | * @param[out] *pDst points to output matrix structure |
emh203 | 0:3d9c67d97d6f | 1740 | * @return The function returns either |
emh203 | 0:3d9c67d97d6f | 1741 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emh203 | 0:3d9c67d97d6f | 1742 | */ |
emh203 | 0:3d9c67d97d6f | 1743 | |
emh203 | 0:3d9c67d97d6f | 1744 | arm_status arm_mat_scale_q31( |
emh203 | 0:3d9c67d97d6f | 1745 | const arm_matrix_instance_q31 * pSrc, |
emh203 | 0:3d9c67d97d6f | 1746 | q31_t scaleFract, |
emh203 | 0:3d9c67d97d6f | 1747 | int32_t shift, |
emh203 | 0:3d9c67d97d6f | 1748 | arm_matrix_instance_q31 * pDst); |
emh203 | 0:3d9c67d97d6f | 1749 | |
emh203 | 0:3d9c67d97d6f | 1750 | |
emh203 | 0:3d9c67d97d6f | 1751 | /** |
emh203 | 0:3d9c67d97d6f | 1752 | * @brief Q31 matrix initialization. |
emh203 | 0:3d9c67d97d6f | 1753 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
emh203 | 0:3d9c67d97d6f | 1754 | * @param[in] nRows number of rows in the matrix. |
emh203 | 0:3d9c67d97d6f | 1755 | * @param[in] nColumns number of columns in the matrix. |
emh203 | 0:3d9c67d97d6f | 1756 | * @param[in] *pData points to the matrix data array. |
emh203 | 0:3d9c67d97d6f | 1757 | * @return none |
emh203 | 0:3d9c67d97d6f | 1758 | */ |
emh203 | 0:3d9c67d97d6f | 1759 | |
emh203 | 0:3d9c67d97d6f | 1760 | void arm_mat_init_q31( |
emh203 | 0:3d9c67d97d6f | 1761 | arm_matrix_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1762 | uint16_t nRows, |
emh203 | 0:3d9c67d97d6f | 1763 | uint16_t nColumns, |
emh203 | 0:3d9c67d97d6f | 1764 | q31_t * pData); |
emh203 | 0:3d9c67d97d6f | 1765 | |
emh203 | 0:3d9c67d97d6f | 1766 | /** |
emh203 | 0:3d9c67d97d6f | 1767 | * @brief Q15 matrix initialization. |
emh203 | 0:3d9c67d97d6f | 1768 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
emh203 | 0:3d9c67d97d6f | 1769 | * @param[in] nRows number of rows in the matrix. |
emh203 | 0:3d9c67d97d6f | 1770 | * @param[in] nColumns number of columns in the matrix. |
emh203 | 0:3d9c67d97d6f | 1771 | * @param[in] *pData points to the matrix data array. |
emh203 | 0:3d9c67d97d6f | 1772 | * @return none |
emh203 | 0:3d9c67d97d6f | 1773 | */ |
emh203 | 0:3d9c67d97d6f | 1774 | |
emh203 | 0:3d9c67d97d6f | 1775 | void arm_mat_init_q15( |
emh203 | 0:3d9c67d97d6f | 1776 | arm_matrix_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1777 | uint16_t nRows, |
emh203 | 0:3d9c67d97d6f | 1778 | uint16_t nColumns, |
emh203 | 0:3d9c67d97d6f | 1779 | q15_t * pData); |
emh203 | 0:3d9c67d97d6f | 1780 | |
emh203 | 0:3d9c67d97d6f | 1781 | /** |
emh203 | 0:3d9c67d97d6f | 1782 | * @brief Floating-point matrix initialization. |
emh203 | 0:3d9c67d97d6f | 1783 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
emh203 | 0:3d9c67d97d6f | 1784 | * @param[in] nRows number of rows in the matrix. |
emh203 | 0:3d9c67d97d6f | 1785 | * @param[in] nColumns number of columns in the matrix. |
emh203 | 0:3d9c67d97d6f | 1786 | * @param[in] *pData points to the matrix data array. |
emh203 | 0:3d9c67d97d6f | 1787 | * @return none |
emh203 | 0:3d9c67d97d6f | 1788 | */ |
emh203 | 0:3d9c67d97d6f | 1789 | |
emh203 | 0:3d9c67d97d6f | 1790 | void arm_mat_init_f32( |
emh203 | 0:3d9c67d97d6f | 1791 | arm_matrix_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 1792 | uint16_t nRows, |
emh203 | 0:3d9c67d97d6f | 1793 | uint16_t nColumns, |
emh203 | 0:3d9c67d97d6f | 1794 | float32_t * pData); |
emh203 | 0:3d9c67d97d6f | 1795 | |
emh203 | 0:3d9c67d97d6f | 1796 | |
emh203 | 0:3d9c67d97d6f | 1797 | |
emh203 | 0:3d9c67d97d6f | 1798 | /** |
emh203 | 0:3d9c67d97d6f | 1799 | * @brief Instance structure for the Q15 PID Control. |
emh203 | 0:3d9c67d97d6f | 1800 | */ |
emh203 | 0:3d9c67d97d6f | 1801 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1802 | { |
emh203 | 0:3d9c67d97d6f | 1803 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
emh203 | 0:3d9c67d97d6f | 1804 | #ifdef ARM_MATH_CM0_FAMILY |
emh203 | 0:3d9c67d97d6f | 1805 | q15_t A1; |
emh203 | 0:3d9c67d97d6f | 1806 | q15_t A2; |
emh203 | 0:3d9c67d97d6f | 1807 | #else |
emh203 | 0:3d9c67d97d6f | 1808 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ |
emh203 | 0:3d9c67d97d6f | 1809 | #endif |
emh203 | 0:3d9c67d97d6f | 1810 | q15_t state[3]; /**< The state array of length 3. */ |
emh203 | 0:3d9c67d97d6f | 1811 | q15_t Kp; /**< The proportional gain. */ |
emh203 | 0:3d9c67d97d6f | 1812 | q15_t Ki; /**< The integral gain. */ |
emh203 | 0:3d9c67d97d6f | 1813 | q15_t Kd; /**< The derivative gain. */ |
emh203 | 0:3d9c67d97d6f | 1814 | } arm_pid_instance_q15; |
emh203 | 0:3d9c67d97d6f | 1815 | |
emh203 | 0:3d9c67d97d6f | 1816 | /** |
emh203 | 0:3d9c67d97d6f | 1817 | * @brief Instance structure for the Q31 PID Control. |
emh203 | 0:3d9c67d97d6f | 1818 | */ |
emh203 | 0:3d9c67d97d6f | 1819 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1820 | { |
emh203 | 0:3d9c67d97d6f | 1821 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
emh203 | 0:3d9c67d97d6f | 1822 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
emh203 | 0:3d9c67d97d6f | 1823 | q31_t A2; /**< The derived gain, A2 = Kd . */ |
emh203 | 0:3d9c67d97d6f | 1824 | q31_t state[3]; /**< The state array of length 3. */ |
emh203 | 0:3d9c67d97d6f | 1825 | q31_t Kp; /**< The proportional gain. */ |
emh203 | 0:3d9c67d97d6f | 1826 | q31_t Ki; /**< The integral gain. */ |
emh203 | 0:3d9c67d97d6f | 1827 | q31_t Kd; /**< The derivative gain. */ |
emh203 | 0:3d9c67d97d6f | 1828 | |
emh203 | 0:3d9c67d97d6f | 1829 | } arm_pid_instance_q31; |
emh203 | 0:3d9c67d97d6f | 1830 | |
emh203 | 0:3d9c67d97d6f | 1831 | /** |
emh203 | 0:3d9c67d97d6f | 1832 | * @brief Instance structure for the floating-point PID Control. |
emh203 | 0:3d9c67d97d6f | 1833 | */ |
emh203 | 0:3d9c67d97d6f | 1834 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1835 | { |
emh203 | 0:3d9c67d97d6f | 1836 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
emh203 | 0:3d9c67d97d6f | 1837 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
emh203 | 0:3d9c67d97d6f | 1838 | float32_t A2; /**< The derived gain, A2 = Kd . */ |
emh203 | 0:3d9c67d97d6f | 1839 | float32_t state[3]; /**< The state array of length 3. */ |
emh203 | 0:3d9c67d97d6f | 1840 | float32_t Kp; /**< The proportional gain. */ |
emh203 | 0:3d9c67d97d6f | 1841 | float32_t Ki; /**< The integral gain. */ |
emh203 | 0:3d9c67d97d6f | 1842 | float32_t Kd; /**< The derivative gain. */ |
emh203 | 0:3d9c67d97d6f | 1843 | } arm_pid_instance_f32; |
emh203 | 0:3d9c67d97d6f | 1844 | |
emh203 | 0:3d9c67d97d6f | 1845 | |
emh203 | 0:3d9c67d97d6f | 1846 | |
emh203 | 0:3d9c67d97d6f | 1847 | /** |
emh203 | 0:3d9c67d97d6f | 1848 | * @brief Initialization function for the floating-point PID Control. |
emh203 | 0:3d9c67d97d6f | 1849 | * @param[in,out] *S points to an instance of the PID structure. |
emh203 | 0:3d9c67d97d6f | 1850 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
emh203 | 0:3d9c67d97d6f | 1851 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1852 | */ |
emh203 | 0:3d9c67d97d6f | 1853 | void arm_pid_init_f32( |
emh203 | 0:3d9c67d97d6f | 1854 | arm_pid_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 1855 | int32_t resetStateFlag); |
emh203 | 0:3d9c67d97d6f | 1856 | |
emh203 | 0:3d9c67d97d6f | 1857 | /** |
emh203 | 0:3d9c67d97d6f | 1858 | * @brief Reset function for the floating-point PID Control. |
emh203 | 0:3d9c67d97d6f | 1859 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
emh203 | 0:3d9c67d97d6f | 1860 | * @return none |
emh203 | 0:3d9c67d97d6f | 1861 | */ |
emh203 | 0:3d9c67d97d6f | 1862 | void arm_pid_reset_f32( |
emh203 | 0:3d9c67d97d6f | 1863 | arm_pid_instance_f32 * S); |
emh203 | 0:3d9c67d97d6f | 1864 | |
emh203 | 0:3d9c67d97d6f | 1865 | |
emh203 | 0:3d9c67d97d6f | 1866 | /** |
emh203 | 0:3d9c67d97d6f | 1867 | * @brief Initialization function for the Q31 PID Control. |
emh203 | 0:3d9c67d97d6f | 1868 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
emh203 | 0:3d9c67d97d6f | 1869 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
emh203 | 0:3d9c67d97d6f | 1870 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1871 | */ |
emh203 | 0:3d9c67d97d6f | 1872 | void arm_pid_init_q31( |
emh203 | 0:3d9c67d97d6f | 1873 | arm_pid_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 1874 | int32_t resetStateFlag); |
emh203 | 0:3d9c67d97d6f | 1875 | |
emh203 | 0:3d9c67d97d6f | 1876 | |
emh203 | 0:3d9c67d97d6f | 1877 | /** |
emh203 | 0:3d9c67d97d6f | 1878 | * @brief Reset function for the Q31 PID Control. |
emh203 | 0:3d9c67d97d6f | 1879 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
emh203 | 0:3d9c67d97d6f | 1880 | * @return none |
emh203 | 0:3d9c67d97d6f | 1881 | */ |
emh203 | 0:3d9c67d97d6f | 1882 | |
emh203 | 0:3d9c67d97d6f | 1883 | void arm_pid_reset_q31( |
emh203 | 0:3d9c67d97d6f | 1884 | arm_pid_instance_q31 * S); |
emh203 | 0:3d9c67d97d6f | 1885 | |
emh203 | 0:3d9c67d97d6f | 1886 | /** |
emh203 | 0:3d9c67d97d6f | 1887 | * @brief Initialization function for the Q15 PID Control. |
emh203 | 0:3d9c67d97d6f | 1888 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
emh203 | 0:3d9c67d97d6f | 1889 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
emh203 | 0:3d9c67d97d6f | 1890 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1891 | */ |
emh203 | 0:3d9c67d97d6f | 1892 | void arm_pid_init_q15( |
emh203 | 0:3d9c67d97d6f | 1893 | arm_pid_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 1894 | int32_t resetStateFlag); |
emh203 | 0:3d9c67d97d6f | 1895 | |
emh203 | 0:3d9c67d97d6f | 1896 | /** |
emh203 | 0:3d9c67d97d6f | 1897 | * @brief Reset function for the Q15 PID Control. |
emh203 | 0:3d9c67d97d6f | 1898 | * @param[in,out] *S points to an instance of the q15 PID Control structure |
emh203 | 0:3d9c67d97d6f | 1899 | * @return none |
emh203 | 0:3d9c67d97d6f | 1900 | */ |
emh203 | 0:3d9c67d97d6f | 1901 | void arm_pid_reset_q15( |
emh203 | 0:3d9c67d97d6f | 1902 | arm_pid_instance_q15 * S); |
emh203 | 0:3d9c67d97d6f | 1903 | |
emh203 | 0:3d9c67d97d6f | 1904 | |
emh203 | 0:3d9c67d97d6f | 1905 | /** |
emh203 | 0:3d9c67d97d6f | 1906 | * @brief Instance structure for the floating-point Linear Interpolate function. |
emh203 | 0:3d9c67d97d6f | 1907 | */ |
emh203 | 0:3d9c67d97d6f | 1908 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1909 | { |
emh203 | 0:3d9c67d97d6f | 1910 | uint32_t nValues; /**< nValues */ |
emh203 | 0:3d9c67d97d6f | 1911 | float32_t x1; /**< x1 */ |
emh203 | 0:3d9c67d97d6f | 1912 | float32_t xSpacing; /**< xSpacing */ |
emh203 | 0:3d9c67d97d6f | 1913 | float32_t *pYData; /**< pointer to the table of Y values */ |
emh203 | 0:3d9c67d97d6f | 1914 | } arm_linear_interp_instance_f32; |
emh203 | 0:3d9c67d97d6f | 1915 | |
emh203 | 0:3d9c67d97d6f | 1916 | /** |
emh203 | 0:3d9c67d97d6f | 1917 | * @brief Instance structure for the floating-point bilinear interpolation function. |
emh203 | 0:3d9c67d97d6f | 1918 | */ |
emh203 | 0:3d9c67d97d6f | 1919 | |
emh203 | 0:3d9c67d97d6f | 1920 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1921 | { |
emh203 | 0:3d9c67d97d6f | 1922 | uint16_t numRows; /**< number of rows in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1923 | uint16_t numCols; /**< number of columns in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1924 | float32_t *pData; /**< points to the data table. */ |
emh203 | 0:3d9c67d97d6f | 1925 | } arm_bilinear_interp_instance_f32; |
emh203 | 0:3d9c67d97d6f | 1926 | |
emh203 | 0:3d9c67d97d6f | 1927 | /** |
emh203 | 0:3d9c67d97d6f | 1928 | * @brief Instance structure for the Q31 bilinear interpolation function. |
emh203 | 0:3d9c67d97d6f | 1929 | */ |
emh203 | 0:3d9c67d97d6f | 1930 | |
emh203 | 0:3d9c67d97d6f | 1931 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1932 | { |
emh203 | 0:3d9c67d97d6f | 1933 | uint16_t numRows; /**< number of rows in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1934 | uint16_t numCols; /**< number of columns in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1935 | q31_t *pData; /**< points to the data table. */ |
emh203 | 0:3d9c67d97d6f | 1936 | } arm_bilinear_interp_instance_q31; |
emh203 | 0:3d9c67d97d6f | 1937 | |
emh203 | 0:3d9c67d97d6f | 1938 | /** |
emh203 | 0:3d9c67d97d6f | 1939 | * @brief Instance structure for the Q15 bilinear interpolation function. |
emh203 | 0:3d9c67d97d6f | 1940 | */ |
emh203 | 0:3d9c67d97d6f | 1941 | |
emh203 | 0:3d9c67d97d6f | 1942 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1943 | { |
emh203 | 0:3d9c67d97d6f | 1944 | uint16_t numRows; /**< number of rows in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1945 | uint16_t numCols; /**< number of columns in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1946 | q15_t *pData; /**< points to the data table. */ |
emh203 | 0:3d9c67d97d6f | 1947 | } arm_bilinear_interp_instance_q15; |
emh203 | 0:3d9c67d97d6f | 1948 | |
emh203 | 0:3d9c67d97d6f | 1949 | /** |
emh203 | 0:3d9c67d97d6f | 1950 | * @brief Instance structure for the Q15 bilinear interpolation function. |
emh203 | 0:3d9c67d97d6f | 1951 | */ |
emh203 | 0:3d9c67d97d6f | 1952 | |
emh203 | 0:3d9c67d97d6f | 1953 | typedef struct |
emh203 | 0:3d9c67d97d6f | 1954 | { |
emh203 | 0:3d9c67d97d6f | 1955 | uint16_t numRows; /**< number of rows in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1956 | uint16_t numCols; /**< number of columns in the data table. */ |
emh203 | 0:3d9c67d97d6f | 1957 | q7_t *pData; /**< points to the data table. */ |
emh203 | 0:3d9c67d97d6f | 1958 | } arm_bilinear_interp_instance_q7; |
emh203 | 0:3d9c67d97d6f | 1959 | |
emh203 | 0:3d9c67d97d6f | 1960 | |
emh203 | 0:3d9c67d97d6f | 1961 | /** |
emh203 | 0:3d9c67d97d6f | 1962 | * @brief Q7 vector multiplication. |
emh203 | 0:3d9c67d97d6f | 1963 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 1964 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 1965 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 1966 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 1967 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1968 | */ |
emh203 | 0:3d9c67d97d6f | 1969 | |
emh203 | 0:3d9c67d97d6f | 1970 | void arm_mult_q7( |
emh203 | 0:3d9c67d97d6f | 1971 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1972 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1973 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1974 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1975 | |
emh203 | 0:3d9c67d97d6f | 1976 | /** |
emh203 | 0:3d9c67d97d6f | 1977 | * @brief Q15 vector multiplication. |
emh203 | 0:3d9c67d97d6f | 1978 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 1979 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 1980 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 1981 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 1982 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1983 | */ |
emh203 | 0:3d9c67d97d6f | 1984 | |
emh203 | 0:3d9c67d97d6f | 1985 | void arm_mult_q15( |
emh203 | 0:3d9c67d97d6f | 1986 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 1987 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 1988 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 1989 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 1990 | |
emh203 | 0:3d9c67d97d6f | 1991 | /** |
emh203 | 0:3d9c67d97d6f | 1992 | * @brief Q31 vector multiplication. |
emh203 | 0:3d9c67d97d6f | 1993 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 1994 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 1995 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 1996 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 1997 | * @return none. |
emh203 | 0:3d9c67d97d6f | 1998 | */ |
emh203 | 0:3d9c67d97d6f | 1999 | |
emh203 | 0:3d9c67d97d6f | 2000 | void arm_mult_q31( |
emh203 | 0:3d9c67d97d6f | 2001 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2002 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2003 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2004 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2005 | |
emh203 | 0:3d9c67d97d6f | 2006 | /** |
emh203 | 0:3d9c67d97d6f | 2007 | * @brief Floating-point vector multiplication. |
emh203 | 0:3d9c67d97d6f | 2008 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2009 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2010 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2011 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2012 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2013 | */ |
emh203 | 0:3d9c67d97d6f | 2014 | |
emh203 | 0:3d9c67d97d6f | 2015 | void arm_mult_f32( |
emh203 | 0:3d9c67d97d6f | 2016 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2017 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2018 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2019 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2020 | |
emh203 | 0:3d9c67d97d6f | 2021 | |
emh203 | 0:3d9c67d97d6f | 2022 | |
emh203 | 0:3d9c67d97d6f | 2023 | |
emh203 | 0:3d9c67d97d6f | 2024 | |
emh203 | 0:3d9c67d97d6f | 2025 | |
emh203 | 0:3d9c67d97d6f | 2026 | /** |
emh203 | 0:3d9c67d97d6f | 2027 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2028 | */ |
emh203 | 0:3d9c67d97d6f | 2029 | |
emh203 | 0:3d9c67d97d6f | 2030 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2031 | { |
emh203 | 0:3d9c67d97d6f | 2032 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2033 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2034 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2035 | q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2036 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2037 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2038 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2039 | } arm_cfft_radix2_instance_q15; |
emh203 | 0:3d9c67d97d6f | 2040 | |
emh203 | 0:3d9c67d97d6f | 2041 | arm_status arm_cfft_radix2_init_q15( |
emh203 | 0:3d9c67d97d6f | 2042 | arm_cfft_radix2_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2043 | uint16_t fftLen, |
emh203 | 0:3d9c67d97d6f | 2044 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2045 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2046 | |
emh203 | 0:3d9c67d97d6f | 2047 | void arm_cfft_radix2_q15( |
emh203 | 0:3d9c67d97d6f | 2048 | const arm_cfft_radix2_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2049 | q15_t * pSrc); |
emh203 | 0:3d9c67d97d6f | 2050 | |
emh203 | 0:3d9c67d97d6f | 2051 | |
emh203 | 0:3d9c67d97d6f | 2052 | |
emh203 | 0:3d9c67d97d6f | 2053 | /** |
emh203 | 0:3d9c67d97d6f | 2054 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2055 | */ |
emh203 | 0:3d9c67d97d6f | 2056 | |
emh203 | 0:3d9c67d97d6f | 2057 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2058 | { |
emh203 | 0:3d9c67d97d6f | 2059 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2060 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2061 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2062 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2063 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2064 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2065 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2066 | } arm_cfft_radix4_instance_q15; |
emh203 | 0:3d9c67d97d6f | 2067 | |
emh203 | 0:3d9c67d97d6f | 2068 | arm_status arm_cfft_radix4_init_q15( |
emh203 | 0:3d9c67d97d6f | 2069 | arm_cfft_radix4_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2070 | uint16_t fftLen, |
emh203 | 0:3d9c67d97d6f | 2071 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2072 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2073 | |
emh203 | 0:3d9c67d97d6f | 2074 | void arm_cfft_radix4_q15( |
emh203 | 0:3d9c67d97d6f | 2075 | const arm_cfft_radix4_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2076 | q15_t * pSrc); |
emh203 | 0:3d9c67d97d6f | 2077 | |
emh203 | 0:3d9c67d97d6f | 2078 | /** |
emh203 | 0:3d9c67d97d6f | 2079 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2080 | */ |
emh203 | 0:3d9c67d97d6f | 2081 | |
emh203 | 0:3d9c67d97d6f | 2082 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2083 | { |
emh203 | 0:3d9c67d97d6f | 2084 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2085 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2086 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2087 | q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2088 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2089 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2090 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2091 | } arm_cfft_radix2_instance_q31; |
emh203 | 0:3d9c67d97d6f | 2092 | |
emh203 | 0:3d9c67d97d6f | 2093 | arm_status arm_cfft_radix2_init_q31( |
emh203 | 0:3d9c67d97d6f | 2094 | arm_cfft_radix2_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2095 | uint16_t fftLen, |
emh203 | 0:3d9c67d97d6f | 2096 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2097 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2098 | |
emh203 | 0:3d9c67d97d6f | 2099 | void arm_cfft_radix2_q31( |
emh203 | 0:3d9c67d97d6f | 2100 | const arm_cfft_radix2_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2101 | q31_t * pSrc); |
emh203 | 0:3d9c67d97d6f | 2102 | |
emh203 | 0:3d9c67d97d6f | 2103 | /** |
emh203 | 0:3d9c67d97d6f | 2104 | * @brief Instance structure for the Q31 CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2105 | */ |
emh203 | 0:3d9c67d97d6f | 2106 | |
emh203 | 0:3d9c67d97d6f | 2107 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2108 | { |
emh203 | 0:3d9c67d97d6f | 2109 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2110 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2111 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2112 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2113 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2114 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2115 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2116 | } arm_cfft_radix4_instance_q31; |
emh203 | 0:3d9c67d97d6f | 2117 | |
emh203 | 0:3d9c67d97d6f | 2118 | void arm_cfft_radix4_q31( |
emh203 | 0:3d9c67d97d6f | 2119 | const arm_cfft_radix4_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2120 | q31_t * pSrc); |
emh203 | 0:3d9c67d97d6f | 2121 | |
emh203 | 0:3d9c67d97d6f | 2122 | arm_status arm_cfft_radix4_init_q31( |
emh203 | 0:3d9c67d97d6f | 2123 | arm_cfft_radix4_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2124 | uint16_t fftLen, |
emh203 | 0:3d9c67d97d6f | 2125 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2126 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2127 | |
emh203 | 0:3d9c67d97d6f | 2128 | /** |
emh203 | 0:3d9c67d97d6f | 2129 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2130 | */ |
emh203 | 0:3d9c67d97d6f | 2131 | |
emh203 | 0:3d9c67d97d6f | 2132 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2133 | { |
emh203 | 0:3d9c67d97d6f | 2134 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2135 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2136 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2137 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2138 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2139 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2140 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2141 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
emh203 | 0:3d9c67d97d6f | 2142 | } arm_cfft_radix2_instance_f32; |
emh203 | 0:3d9c67d97d6f | 2143 | |
emh203 | 0:3d9c67d97d6f | 2144 | /* Deprecated */ |
emh203 | 0:3d9c67d97d6f | 2145 | arm_status arm_cfft_radix2_init_f32( |
emh203 | 0:3d9c67d97d6f | 2146 | arm_cfft_radix2_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2147 | uint16_t fftLen, |
emh203 | 0:3d9c67d97d6f | 2148 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2149 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2150 | |
emh203 | 0:3d9c67d97d6f | 2151 | /* Deprecated */ |
emh203 | 0:3d9c67d97d6f | 2152 | void arm_cfft_radix2_f32( |
emh203 | 0:3d9c67d97d6f | 2153 | const arm_cfft_radix2_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2154 | float32_t * pSrc); |
emh203 | 0:3d9c67d97d6f | 2155 | |
emh203 | 0:3d9c67d97d6f | 2156 | /** |
emh203 | 0:3d9c67d97d6f | 2157 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2158 | */ |
emh203 | 0:3d9c67d97d6f | 2159 | |
emh203 | 0:3d9c67d97d6f | 2160 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2161 | { |
emh203 | 0:3d9c67d97d6f | 2162 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2163 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2164 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2165 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2166 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2167 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2168 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2169 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
emh203 | 0:3d9c67d97d6f | 2170 | } arm_cfft_radix4_instance_f32; |
emh203 | 0:3d9c67d97d6f | 2171 | |
emh203 | 0:3d9c67d97d6f | 2172 | /* Deprecated */ |
emh203 | 0:3d9c67d97d6f | 2173 | arm_status arm_cfft_radix4_init_f32( |
emh203 | 0:3d9c67d97d6f | 2174 | arm_cfft_radix4_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2175 | uint16_t fftLen, |
emh203 | 0:3d9c67d97d6f | 2176 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2177 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2178 | |
emh203 | 0:3d9c67d97d6f | 2179 | /* Deprecated */ |
emh203 | 0:3d9c67d97d6f | 2180 | void arm_cfft_radix4_f32( |
emh203 | 0:3d9c67d97d6f | 2181 | const arm_cfft_radix4_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2182 | float32_t * pSrc); |
emh203 | 0:3d9c67d97d6f | 2183 | |
emh203 | 0:3d9c67d97d6f | 2184 | /** |
emh203 | 0:3d9c67d97d6f | 2185 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
emh203 | 0:3d9c67d97d6f | 2186 | */ |
emh203 | 0:3d9c67d97d6f | 2187 | |
emh203 | 0:3d9c67d97d6f | 2188 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2189 | { |
emh203 | 0:3d9c67d97d6f | 2190 | uint16_t fftLen; /**< length of the FFT. */ |
emh203 | 0:3d9c67d97d6f | 2191 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2192 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emh203 | 0:3d9c67d97d6f | 2193 | uint16_t bitRevLength; /**< bit reversal table length. */ |
emh203 | 0:3d9c67d97d6f | 2194 | } arm_cfft_instance_f32; |
emh203 | 0:3d9c67d97d6f | 2195 | |
emh203 | 0:3d9c67d97d6f | 2196 | void arm_cfft_f32( |
emh203 | 0:3d9c67d97d6f | 2197 | const arm_cfft_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2198 | float32_t * p1, |
emh203 | 0:3d9c67d97d6f | 2199 | uint8_t ifftFlag, |
emh203 | 0:3d9c67d97d6f | 2200 | uint8_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2201 | |
emh203 | 0:3d9c67d97d6f | 2202 | /** |
emh203 | 0:3d9c67d97d6f | 2203 | * @brief Instance structure for the Q15 RFFT/RIFFT function. |
emh203 | 0:3d9c67d97d6f | 2204 | */ |
emh203 | 0:3d9c67d97d6f | 2205 | |
emh203 | 0:3d9c67d97d6f | 2206 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2207 | { |
emh203 | 0:3d9c67d97d6f | 2208 | uint32_t fftLenReal; /**< length of the real FFT. */ |
emh203 | 0:3d9c67d97d6f | 2209 | uint32_t fftLenBy2; /**< length of the complex FFT. */ |
emh203 | 0:3d9c67d97d6f | 2210 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2211 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2212 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2213 | q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2214 | q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2215 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2216 | } arm_rfft_instance_q15; |
emh203 | 0:3d9c67d97d6f | 2217 | |
emh203 | 0:3d9c67d97d6f | 2218 | arm_status arm_rfft_init_q15( |
emh203 | 0:3d9c67d97d6f | 2219 | arm_rfft_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2220 | arm_cfft_radix4_instance_q15 * S_CFFT, |
emh203 | 0:3d9c67d97d6f | 2221 | uint32_t fftLenReal, |
emh203 | 0:3d9c67d97d6f | 2222 | uint32_t ifftFlagR, |
emh203 | 0:3d9c67d97d6f | 2223 | uint32_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2224 | |
emh203 | 0:3d9c67d97d6f | 2225 | void arm_rfft_q15( |
emh203 | 0:3d9c67d97d6f | 2226 | const arm_rfft_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2227 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2228 | q15_t * pDst); |
emh203 | 0:3d9c67d97d6f | 2229 | |
emh203 | 0:3d9c67d97d6f | 2230 | /** |
emh203 | 0:3d9c67d97d6f | 2231 | * @brief Instance structure for the Q31 RFFT/RIFFT function. |
emh203 | 0:3d9c67d97d6f | 2232 | */ |
emh203 | 0:3d9c67d97d6f | 2233 | |
emh203 | 0:3d9c67d97d6f | 2234 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2235 | { |
emh203 | 0:3d9c67d97d6f | 2236 | uint32_t fftLenReal; /**< length of the real FFT. */ |
emh203 | 0:3d9c67d97d6f | 2237 | uint32_t fftLenBy2; /**< length of the complex FFT. */ |
emh203 | 0:3d9c67d97d6f | 2238 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2239 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2240 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2241 | q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2242 | q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2243 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2244 | } arm_rfft_instance_q31; |
emh203 | 0:3d9c67d97d6f | 2245 | |
emh203 | 0:3d9c67d97d6f | 2246 | arm_status arm_rfft_init_q31( |
emh203 | 0:3d9c67d97d6f | 2247 | arm_rfft_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2248 | arm_cfft_radix4_instance_q31 * S_CFFT, |
emh203 | 0:3d9c67d97d6f | 2249 | uint32_t fftLenReal, |
emh203 | 0:3d9c67d97d6f | 2250 | uint32_t ifftFlagR, |
emh203 | 0:3d9c67d97d6f | 2251 | uint32_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2252 | |
emh203 | 0:3d9c67d97d6f | 2253 | void arm_rfft_q31( |
emh203 | 0:3d9c67d97d6f | 2254 | const arm_rfft_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2255 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2256 | q31_t * pDst); |
emh203 | 0:3d9c67d97d6f | 2257 | |
emh203 | 0:3d9c67d97d6f | 2258 | /** |
emh203 | 0:3d9c67d97d6f | 2259 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
emh203 | 0:3d9c67d97d6f | 2260 | */ |
emh203 | 0:3d9c67d97d6f | 2261 | |
emh203 | 0:3d9c67d97d6f | 2262 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2263 | { |
emh203 | 0:3d9c67d97d6f | 2264 | uint32_t fftLenReal; /**< length of the real FFT. */ |
emh203 | 0:3d9c67d97d6f | 2265 | uint16_t fftLenBy2; /**< length of the complex FFT. */ |
emh203 | 0:3d9c67d97d6f | 2266 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
emh203 | 0:3d9c67d97d6f | 2267 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
emh203 | 0:3d9c67d97d6f | 2268 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2269 | float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2270 | float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2271 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2272 | } arm_rfft_instance_f32; |
emh203 | 0:3d9c67d97d6f | 2273 | |
emh203 | 0:3d9c67d97d6f | 2274 | arm_status arm_rfft_init_f32( |
emh203 | 0:3d9c67d97d6f | 2275 | arm_rfft_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2276 | arm_cfft_radix4_instance_f32 * S_CFFT, |
emh203 | 0:3d9c67d97d6f | 2277 | uint32_t fftLenReal, |
emh203 | 0:3d9c67d97d6f | 2278 | uint32_t ifftFlagR, |
emh203 | 0:3d9c67d97d6f | 2279 | uint32_t bitReverseFlag); |
emh203 | 0:3d9c67d97d6f | 2280 | |
emh203 | 0:3d9c67d97d6f | 2281 | void arm_rfft_f32( |
emh203 | 0:3d9c67d97d6f | 2282 | const arm_rfft_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2283 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2284 | float32_t * pDst); |
emh203 | 0:3d9c67d97d6f | 2285 | |
emh203 | 0:3d9c67d97d6f | 2286 | /** |
emh203 | 0:3d9c67d97d6f | 2287 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
emh203 | 0:3d9c67d97d6f | 2288 | */ |
emh203 | 0:3d9c67d97d6f | 2289 | |
emh203 | 0:3d9c67d97d6f | 2290 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2291 | { |
emh203 | 0:3d9c67d97d6f | 2292 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ |
emh203 | 0:3d9c67d97d6f | 2293 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
emh203 | 0:3d9c67d97d6f | 2294 | float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
emh203 | 0:3d9c67d97d6f | 2295 | } arm_rfft_fast_instance_f32 ; |
emh203 | 0:3d9c67d97d6f | 2296 | |
emh203 | 0:3d9c67d97d6f | 2297 | arm_status arm_rfft_fast_init_f32 ( |
emh203 | 0:3d9c67d97d6f | 2298 | arm_rfft_fast_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2299 | uint16_t fftLen); |
emh203 | 0:3d9c67d97d6f | 2300 | |
emh203 | 0:3d9c67d97d6f | 2301 | void arm_rfft_fast_f32( |
emh203 | 0:3d9c67d97d6f | 2302 | arm_rfft_fast_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2303 | float32_t * p, float32_t * pOut, |
emh203 | 0:3d9c67d97d6f | 2304 | uint8_t ifftFlag); |
emh203 | 0:3d9c67d97d6f | 2305 | |
emh203 | 0:3d9c67d97d6f | 2306 | /** |
emh203 | 0:3d9c67d97d6f | 2307 | * @brief Instance structure for the floating-point DCT4/IDCT4 function. |
emh203 | 0:3d9c67d97d6f | 2308 | */ |
emh203 | 0:3d9c67d97d6f | 2309 | |
emh203 | 0:3d9c67d97d6f | 2310 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2311 | { |
emh203 | 0:3d9c67d97d6f | 2312 | uint16_t N; /**< length of the DCT4. */ |
emh203 | 0:3d9c67d97d6f | 2313 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
emh203 | 0:3d9c67d97d6f | 2314 | float32_t normalize; /**< normalizing factor. */ |
emh203 | 0:3d9c67d97d6f | 2315 | float32_t *pTwiddle; /**< points to the twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2316 | float32_t *pCosFactor; /**< points to the cosFactor table. */ |
emh203 | 0:3d9c67d97d6f | 2317 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2318 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2319 | } arm_dct4_instance_f32; |
emh203 | 0:3d9c67d97d6f | 2320 | |
emh203 | 0:3d9c67d97d6f | 2321 | /** |
emh203 | 0:3d9c67d97d6f | 2322 | * @brief Initialization function for the floating-point DCT4/IDCT4. |
emh203 | 0:3d9c67d97d6f | 2323 | * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure. |
emh203 | 0:3d9c67d97d6f | 2324 | * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure. |
emh203 | 0:3d9c67d97d6f | 2325 | * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure. |
emh203 | 0:3d9c67d97d6f | 2326 | * @param[in] N length of the DCT4. |
emh203 | 0:3d9c67d97d6f | 2327 | * @param[in] Nby2 half of the length of the DCT4. |
emh203 | 0:3d9c67d97d6f | 2328 | * @param[in] normalize normalizing factor. |
emh203 | 0:3d9c67d97d6f | 2329 | * @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. |
emh203 | 0:3d9c67d97d6f | 2330 | */ |
emh203 | 0:3d9c67d97d6f | 2331 | |
emh203 | 0:3d9c67d97d6f | 2332 | arm_status arm_dct4_init_f32( |
emh203 | 0:3d9c67d97d6f | 2333 | arm_dct4_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2334 | arm_rfft_instance_f32 * S_RFFT, |
emh203 | 0:3d9c67d97d6f | 2335 | arm_cfft_radix4_instance_f32 * S_CFFT, |
emh203 | 0:3d9c67d97d6f | 2336 | uint16_t N, |
emh203 | 0:3d9c67d97d6f | 2337 | uint16_t Nby2, |
emh203 | 0:3d9c67d97d6f | 2338 | float32_t normalize); |
emh203 | 0:3d9c67d97d6f | 2339 | |
emh203 | 0:3d9c67d97d6f | 2340 | /** |
emh203 | 0:3d9c67d97d6f | 2341 | * @brief Processing function for the floating-point DCT4/IDCT4. |
emh203 | 0:3d9c67d97d6f | 2342 | * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure. |
emh203 | 0:3d9c67d97d6f | 2343 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 2344 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
emh203 | 0:3d9c67d97d6f | 2345 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2346 | */ |
emh203 | 0:3d9c67d97d6f | 2347 | |
emh203 | 0:3d9c67d97d6f | 2348 | void arm_dct4_f32( |
emh203 | 0:3d9c67d97d6f | 2349 | const arm_dct4_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 2350 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 2351 | float32_t * pInlineBuffer); |
emh203 | 0:3d9c67d97d6f | 2352 | |
emh203 | 0:3d9c67d97d6f | 2353 | /** |
emh203 | 0:3d9c67d97d6f | 2354 | * @brief Instance structure for the Q31 DCT4/IDCT4 function. |
emh203 | 0:3d9c67d97d6f | 2355 | */ |
emh203 | 0:3d9c67d97d6f | 2356 | |
emh203 | 0:3d9c67d97d6f | 2357 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2358 | { |
emh203 | 0:3d9c67d97d6f | 2359 | uint16_t N; /**< length of the DCT4. */ |
emh203 | 0:3d9c67d97d6f | 2360 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
emh203 | 0:3d9c67d97d6f | 2361 | q31_t normalize; /**< normalizing factor. */ |
emh203 | 0:3d9c67d97d6f | 2362 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2363 | q31_t *pCosFactor; /**< points to the cosFactor table. */ |
emh203 | 0:3d9c67d97d6f | 2364 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2365 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2366 | } arm_dct4_instance_q31; |
emh203 | 0:3d9c67d97d6f | 2367 | |
emh203 | 0:3d9c67d97d6f | 2368 | /** |
emh203 | 0:3d9c67d97d6f | 2369 | * @brief Initialization function for the Q31 DCT4/IDCT4. |
emh203 | 0:3d9c67d97d6f | 2370 | * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure. |
emh203 | 0:3d9c67d97d6f | 2371 | * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure |
emh203 | 0:3d9c67d97d6f | 2372 | * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure |
emh203 | 0:3d9c67d97d6f | 2373 | * @param[in] N length of the DCT4. |
emh203 | 0:3d9c67d97d6f | 2374 | * @param[in] Nby2 half of the length of the DCT4. |
emh203 | 0:3d9c67d97d6f | 2375 | * @param[in] normalize normalizing factor. |
emh203 | 0:3d9c67d97d6f | 2376 | * @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. |
emh203 | 0:3d9c67d97d6f | 2377 | */ |
emh203 | 0:3d9c67d97d6f | 2378 | |
emh203 | 0:3d9c67d97d6f | 2379 | arm_status arm_dct4_init_q31( |
emh203 | 0:3d9c67d97d6f | 2380 | arm_dct4_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2381 | arm_rfft_instance_q31 * S_RFFT, |
emh203 | 0:3d9c67d97d6f | 2382 | arm_cfft_radix4_instance_q31 * S_CFFT, |
emh203 | 0:3d9c67d97d6f | 2383 | uint16_t N, |
emh203 | 0:3d9c67d97d6f | 2384 | uint16_t Nby2, |
emh203 | 0:3d9c67d97d6f | 2385 | q31_t normalize); |
emh203 | 0:3d9c67d97d6f | 2386 | |
emh203 | 0:3d9c67d97d6f | 2387 | /** |
emh203 | 0:3d9c67d97d6f | 2388 | * @brief Processing function for the Q31 DCT4/IDCT4. |
emh203 | 0:3d9c67d97d6f | 2389 | * @param[in] *S points to an instance of the Q31 DCT4 structure. |
emh203 | 0:3d9c67d97d6f | 2390 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 2391 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
emh203 | 0:3d9c67d97d6f | 2392 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2393 | */ |
emh203 | 0:3d9c67d97d6f | 2394 | |
emh203 | 0:3d9c67d97d6f | 2395 | void arm_dct4_q31( |
emh203 | 0:3d9c67d97d6f | 2396 | const arm_dct4_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 2397 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 2398 | q31_t * pInlineBuffer); |
emh203 | 0:3d9c67d97d6f | 2399 | |
emh203 | 0:3d9c67d97d6f | 2400 | /** |
emh203 | 0:3d9c67d97d6f | 2401 | * @brief Instance structure for the Q15 DCT4/IDCT4 function. |
emh203 | 0:3d9c67d97d6f | 2402 | */ |
emh203 | 0:3d9c67d97d6f | 2403 | |
emh203 | 0:3d9c67d97d6f | 2404 | typedef struct |
emh203 | 0:3d9c67d97d6f | 2405 | { |
emh203 | 0:3d9c67d97d6f | 2406 | uint16_t N; /**< length of the DCT4. */ |
emh203 | 0:3d9c67d97d6f | 2407 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
emh203 | 0:3d9c67d97d6f | 2408 | q15_t normalize; /**< normalizing factor. */ |
emh203 | 0:3d9c67d97d6f | 2409 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
emh203 | 0:3d9c67d97d6f | 2410 | q15_t *pCosFactor; /**< points to the cosFactor table. */ |
emh203 | 0:3d9c67d97d6f | 2411 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2412 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
emh203 | 0:3d9c67d97d6f | 2413 | } arm_dct4_instance_q15; |
emh203 | 0:3d9c67d97d6f | 2414 | |
emh203 | 0:3d9c67d97d6f | 2415 | /** |
emh203 | 0:3d9c67d97d6f | 2416 | * @brief Initialization function for the Q15 DCT4/IDCT4. |
emh203 | 0:3d9c67d97d6f | 2417 | * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure. |
emh203 | 0:3d9c67d97d6f | 2418 | * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure. |
emh203 | 0:3d9c67d97d6f | 2419 | * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure. |
emh203 | 0:3d9c67d97d6f | 2420 | * @param[in] N length of the DCT4. |
emh203 | 0:3d9c67d97d6f | 2421 | * @param[in] Nby2 half of the length of the DCT4. |
emh203 | 0:3d9c67d97d6f | 2422 | * @param[in] normalize normalizing factor. |
emh203 | 0:3d9c67d97d6f | 2423 | * @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. |
emh203 | 0:3d9c67d97d6f | 2424 | */ |
emh203 | 0:3d9c67d97d6f | 2425 | |
emh203 | 0:3d9c67d97d6f | 2426 | arm_status arm_dct4_init_q15( |
emh203 | 0:3d9c67d97d6f | 2427 | arm_dct4_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2428 | arm_rfft_instance_q15 * S_RFFT, |
emh203 | 0:3d9c67d97d6f | 2429 | arm_cfft_radix4_instance_q15 * S_CFFT, |
emh203 | 0:3d9c67d97d6f | 2430 | uint16_t N, |
emh203 | 0:3d9c67d97d6f | 2431 | uint16_t Nby2, |
emh203 | 0:3d9c67d97d6f | 2432 | q15_t normalize); |
emh203 | 0:3d9c67d97d6f | 2433 | |
emh203 | 0:3d9c67d97d6f | 2434 | /** |
emh203 | 0:3d9c67d97d6f | 2435 | * @brief Processing function for the Q15 DCT4/IDCT4. |
emh203 | 0:3d9c67d97d6f | 2436 | * @param[in] *S points to an instance of the Q15 DCT4 structure. |
emh203 | 0:3d9c67d97d6f | 2437 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 2438 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
emh203 | 0:3d9c67d97d6f | 2439 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2440 | */ |
emh203 | 0:3d9c67d97d6f | 2441 | |
emh203 | 0:3d9c67d97d6f | 2442 | void arm_dct4_q15( |
emh203 | 0:3d9c67d97d6f | 2443 | const arm_dct4_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 2444 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 2445 | q15_t * pInlineBuffer); |
emh203 | 0:3d9c67d97d6f | 2446 | |
emh203 | 0:3d9c67d97d6f | 2447 | /** |
emh203 | 0:3d9c67d97d6f | 2448 | * @brief Floating-point vector addition. |
emh203 | 0:3d9c67d97d6f | 2449 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2450 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2451 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2452 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2453 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2454 | */ |
emh203 | 0:3d9c67d97d6f | 2455 | |
emh203 | 0:3d9c67d97d6f | 2456 | void arm_add_f32( |
emh203 | 0:3d9c67d97d6f | 2457 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2458 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2459 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2460 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2461 | |
emh203 | 0:3d9c67d97d6f | 2462 | /** |
emh203 | 0:3d9c67d97d6f | 2463 | * @brief Q7 vector addition. |
emh203 | 0:3d9c67d97d6f | 2464 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2465 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2466 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2467 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2468 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2469 | */ |
emh203 | 0:3d9c67d97d6f | 2470 | |
emh203 | 0:3d9c67d97d6f | 2471 | void arm_add_q7( |
emh203 | 0:3d9c67d97d6f | 2472 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2473 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2474 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2475 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2476 | |
emh203 | 0:3d9c67d97d6f | 2477 | /** |
emh203 | 0:3d9c67d97d6f | 2478 | * @brief Q15 vector addition. |
emh203 | 0:3d9c67d97d6f | 2479 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2480 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2481 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2482 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2483 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2484 | */ |
emh203 | 0:3d9c67d97d6f | 2485 | |
emh203 | 0:3d9c67d97d6f | 2486 | void arm_add_q15( |
emh203 | 0:3d9c67d97d6f | 2487 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2488 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2489 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2490 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2491 | |
emh203 | 0:3d9c67d97d6f | 2492 | /** |
emh203 | 0:3d9c67d97d6f | 2493 | * @brief Q31 vector addition. |
emh203 | 0:3d9c67d97d6f | 2494 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2495 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2496 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2497 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2498 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2499 | */ |
emh203 | 0:3d9c67d97d6f | 2500 | |
emh203 | 0:3d9c67d97d6f | 2501 | void arm_add_q31( |
emh203 | 0:3d9c67d97d6f | 2502 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2503 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2504 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2505 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2506 | |
emh203 | 0:3d9c67d97d6f | 2507 | /** |
emh203 | 0:3d9c67d97d6f | 2508 | * @brief Floating-point vector subtraction. |
emh203 | 0:3d9c67d97d6f | 2509 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2510 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2511 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2512 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2513 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2514 | */ |
emh203 | 0:3d9c67d97d6f | 2515 | |
emh203 | 0:3d9c67d97d6f | 2516 | void arm_sub_f32( |
emh203 | 0:3d9c67d97d6f | 2517 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2518 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2519 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2520 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2521 | |
emh203 | 0:3d9c67d97d6f | 2522 | /** |
emh203 | 0:3d9c67d97d6f | 2523 | * @brief Q7 vector subtraction. |
emh203 | 0:3d9c67d97d6f | 2524 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2525 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2526 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2527 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2528 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2529 | */ |
emh203 | 0:3d9c67d97d6f | 2530 | |
emh203 | 0:3d9c67d97d6f | 2531 | void arm_sub_q7( |
emh203 | 0:3d9c67d97d6f | 2532 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2533 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2534 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2535 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2536 | |
emh203 | 0:3d9c67d97d6f | 2537 | /** |
emh203 | 0:3d9c67d97d6f | 2538 | * @brief Q15 vector subtraction. |
emh203 | 0:3d9c67d97d6f | 2539 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2540 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2541 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2542 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2543 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2544 | */ |
emh203 | 0:3d9c67d97d6f | 2545 | |
emh203 | 0:3d9c67d97d6f | 2546 | void arm_sub_q15( |
emh203 | 0:3d9c67d97d6f | 2547 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2548 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2549 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2550 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2551 | |
emh203 | 0:3d9c67d97d6f | 2552 | /** |
emh203 | 0:3d9c67d97d6f | 2553 | * @brief Q31 vector subtraction. |
emh203 | 0:3d9c67d97d6f | 2554 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2555 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2556 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2557 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2558 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2559 | */ |
emh203 | 0:3d9c67d97d6f | 2560 | |
emh203 | 0:3d9c67d97d6f | 2561 | void arm_sub_q31( |
emh203 | 0:3d9c67d97d6f | 2562 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2563 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2564 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2565 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2566 | |
emh203 | 0:3d9c67d97d6f | 2567 | /** |
emh203 | 0:3d9c67d97d6f | 2568 | * @brief Multiplies a floating-point vector by a scalar. |
emh203 | 0:3d9c67d97d6f | 2569 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2570 | * @param[in] scale scale factor to be applied |
emh203 | 0:3d9c67d97d6f | 2571 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2572 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2573 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2574 | */ |
emh203 | 0:3d9c67d97d6f | 2575 | |
emh203 | 0:3d9c67d97d6f | 2576 | void arm_scale_f32( |
emh203 | 0:3d9c67d97d6f | 2577 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2578 | float32_t scale, |
emh203 | 0:3d9c67d97d6f | 2579 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2580 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2581 | |
emh203 | 0:3d9c67d97d6f | 2582 | /** |
emh203 | 0:3d9c67d97d6f | 2583 | * @brief Multiplies a Q7 vector by a scalar. |
emh203 | 0:3d9c67d97d6f | 2584 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2585 | * @param[in] scaleFract fractional portion of the scale value |
emh203 | 0:3d9c67d97d6f | 2586 | * @param[in] shift number of bits to shift the result by |
emh203 | 0:3d9c67d97d6f | 2587 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2588 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2589 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2590 | */ |
emh203 | 0:3d9c67d97d6f | 2591 | |
emh203 | 0:3d9c67d97d6f | 2592 | void arm_scale_q7( |
emh203 | 0:3d9c67d97d6f | 2593 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2594 | q7_t scaleFract, |
emh203 | 0:3d9c67d97d6f | 2595 | int8_t shift, |
emh203 | 0:3d9c67d97d6f | 2596 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2597 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2598 | |
emh203 | 0:3d9c67d97d6f | 2599 | /** |
emh203 | 0:3d9c67d97d6f | 2600 | * @brief Multiplies a Q15 vector by a scalar. |
emh203 | 0:3d9c67d97d6f | 2601 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2602 | * @param[in] scaleFract fractional portion of the scale value |
emh203 | 0:3d9c67d97d6f | 2603 | * @param[in] shift number of bits to shift the result by |
emh203 | 0:3d9c67d97d6f | 2604 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2605 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2606 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2607 | */ |
emh203 | 0:3d9c67d97d6f | 2608 | |
emh203 | 0:3d9c67d97d6f | 2609 | void arm_scale_q15( |
emh203 | 0:3d9c67d97d6f | 2610 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2611 | q15_t scaleFract, |
emh203 | 0:3d9c67d97d6f | 2612 | int8_t shift, |
emh203 | 0:3d9c67d97d6f | 2613 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2614 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2615 | |
emh203 | 0:3d9c67d97d6f | 2616 | /** |
emh203 | 0:3d9c67d97d6f | 2617 | * @brief Multiplies a Q31 vector by a scalar. |
emh203 | 0:3d9c67d97d6f | 2618 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2619 | * @param[in] scaleFract fractional portion of the scale value |
emh203 | 0:3d9c67d97d6f | 2620 | * @param[in] shift number of bits to shift the result by |
emh203 | 0:3d9c67d97d6f | 2621 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2622 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2623 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2624 | */ |
emh203 | 0:3d9c67d97d6f | 2625 | |
emh203 | 0:3d9c67d97d6f | 2626 | void arm_scale_q31( |
emh203 | 0:3d9c67d97d6f | 2627 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2628 | q31_t scaleFract, |
emh203 | 0:3d9c67d97d6f | 2629 | int8_t shift, |
emh203 | 0:3d9c67d97d6f | 2630 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2631 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2632 | |
emh203 | 0:3d9c67d97d6f | 2633 | /** |
emh203 | 0:3d9c67d97d6f | 2634 | * @brief Q7 vector absolute value. |
emh203 | 0:3d9c67d97d6f | 2635 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 2636 | * @param[out] *pDst points to the output buffer |
emh203 | 0:3d9c67d97d6f | 2637 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2638 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2639 | */ |
emh203 | 0:3d9c67d97d6f | 2640 | |
emh203 | 0:3d9c67d97d6f | 2641 | void arm_abs_q7( |
emh203 | 0:3d9c67d97d6f | 2642 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2643 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2644 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2645 | |
emh203 | 0:3d9c67d97d6f | 2646 | /** |
emh203 | 0:3d9c67d97d6f | 2647 | * @brief Floating-point vector absolute value. |
emh203 | 0:3d9c67d97d6f | 2648 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 2649 | * @param[out] *pDst points to the output buffer |
emh203 | 0:3d9c67d97d6f | 2650 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2651 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2652 | */ |
emh203 | 0:3d9c67d97d6f | 2653 | |
emh203 | 0:3d9c67d97d6f | 2654 | void arm_abs_f32( |
emh203 | 0:3d9c67d97d6f | 2655 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2656 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2657 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2658 | |
emh203 | 0:3d9c67d97d6f | 2659 | /** |
emh203 | 0:3d9c67d97d6f | 2660 | * @brief Q15 vector absolute value. |
emh203 | 0:3d9c67d97d6f | 2661 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 2662 | * @param[out] *pDst points to the output buffer |
emh203 | 0:3d9c67d97d6f | 2663 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2664 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2665 | */ |
emh203 | 0:3d9c67d97d6f | 2666 | |
emh203 | 0:3d9c67d97d6f | 2667 | void arm_abs_q15( |
emh203 | 0:3d9c67d97d6f | 2668 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2669 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2670 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2671 | |
emh203 | 0:3d9c67d97d6f | 2672 | /** |
emh203 | 0:3d9c67d97d6f | 2673 | * @brief Q31 vector absolute value. |
emh203 | 0:3d9c67d97d6f | 2674 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 2675 | * @param[out] *pDst points to the output buffer |
emh203 | 0:3d9c67d97d6f | 2676 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2677 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2678 | */ |
emh203 | 0:3d9c67d97d6f | 2679 | |
emh203 | 0:3d9c67d97d6f | 2680 | void arm_abs_q31( |
emh203 | 0:3d9c67d97d6f | 2681 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2682 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2683 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2684 | |
emh203 | 0:3d9c67d97d6f | 2685 | /** |
emh203 | 0:3d9c67d97d6f | 2686 | * @brief Dot product of floating-point vectors. |
emh203 | 0:3d9c67d97d6f | 2687 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2688 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2689 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2690 | * @param[out] *result output result returned here |
emh203 | 0:3d9c67d97d6f | 2691 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2692 | */ |
emh203 | 0:3d9c67d97d6f | 2693 | |
emh203 | 0:3d9c67d97d6f | 2694 | void arm_dot_prod_f32( |
emh203 | 0:3d9c67d97d6f | 2695 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2696 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2697 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 2698 | float32_t * result); |
emh203 | 0:3d9c67d97d6f | 2699 | |
emh203 | 0:3d9c67d97d6f | 2700 | /** |
emh203 | 0:3d9c67d97d6f | 2701 | * @brief Dot product of Q7 vectors. |
emh203 | 0:3d9c67d97d6f | 2702 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2703 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2704 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2705 | * @param[out] *result output result returned here |
emh203 | 0:3d9c67d97d6f | 2706 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2707 | */ |
emh203 | 0:3d9c67d97d6f | 2708 | |
emh203 | 0:3d9c67d97d6f | 2709 | void arm_dot_prod_q7( |
emh203 | 0:3d9c67d97d6f | 2710 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2711 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2712 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 2713 | q31_t * result); |
emh203 | 0:3d9c67d97d6f | 2714 | |
emh203 | 0:3d9c67d97d6f | 2715 | /** |
emh203 | 0:3d9c67d97d6f | 2716 | * @brief Dot product of Q15 vectors. |
emh203 | 0:3d9c67d97d6f | 2717 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2718 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2719 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2720 | * @param[out] *result output result returned here |
emh203 | 0:3d9c67d97d6f | 2721 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2722 | */ |
emh203 | 0:3d9c67d97d6f | 2723 | |
emh203 | 0:3d9c67d97d6f | 2724 | void arm_dot_prod_q15( |
emh203 | 0:3d9c67d97d6f | 2725 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2726 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2727 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 2728 | q63_t * result); |
emh203 | 0:3d9c67d97d6f | 2729 | |
emh203 | 0:3d9c67d97d6f | 2730 | /** |
emh203 | 0:3d9c67d97d6f | 2731 | * @brief Dot product of Q31 vectors. |
emh203 | 0:3d9c67d97d6f | 2732 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 2733 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 2734 | * @param[in] blockSize number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 2735 | * @param[out] *result output result returned here |
emh203 | 0:3d9c67d97d6f | 2736 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2737 | */ |
emh203 | 0:3d9c67d97d6f | 2738 | |
emh203 | 0:3d9c67d97d6f | 2739 | void arm_dot_prod_q31( |
emh203 | 0:3d9c67d97d6f | 2740 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 2741 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 2742 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 2743 | q63_t * result); |
emh203 | 0:3d9c67d97d6f | 2744 | |
emh203 | 0:3d9c67d97d6f | 2745 | /** |
emh203 | 0:3d9c67d97d6f | 2746 | * @brief Shifts the elements of a Q7 vector a specified number of bits. |
emh203 | 0:3d9c67d97d6f | 2747 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2748 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
emh203 | 0:3d9c67d97d6f | 2749 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2750 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2751 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2752 | */ |
emh203 | 0:3d9c67d97d6f | 2753 | |
emh203 | 0:3d9c67d97d6f | 2754 | void arm_shift_q7( |
emh203 | 0:3d9c67d97d6f | 2755 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2756 | int8_t shiftBits, |
emh203 | 0:3d9c67d97d6f | 2757 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2758 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2759 | |
emh203 | 0:3d9c67d97d6f | 2760 | /** |
emh203 | 0:3d9c67d97d6f | 2761 | * @brief Shifts the elements of a Q15 vector a specified number of bits. |
emh203 | 0:3d9c67d97d6f | 2762 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2763 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
emh203 | 0:3d9c67d97d6f | 2764 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2765 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2766 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2767 | */ |
emh203 | 0:3d9c67d97d6f | 2768 | |
emh203 | 0:3d9c67d97d6f | 2769 | void arm_shift_q15( |
emh203 | 0:3d9c67d97d6f | 2770 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2771 | int8_t shiftBits, |
emh203 | 0:3d9c67d97d6f | 2772 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2773 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2774 | |
emh203 | 0:3d9c67d97d6f | 2775 | /** |
emh203 | 0:3d9c67d97d6f | 2776 | * @brief Shifts the elements of a Q31 vector a specified number of bits. |
emh203 | 0:3d9c67d97d6f | 2777 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2778 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
emh203 | 0:3d9c67d97d6f | 2779 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2780 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2781 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2782 | */ |
emh203 | 0:3d9c67d97d6f | 2783 | |
emh203 | 0:3d9c67d97d6f | 2784 | void arm_shift_q31( |
emh203 | 0:3d9c67d97d6f | 2785 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2786 | int8_t shiftBits, |
emh203 | 0:3d9c67d97d6f | 2787 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2788 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2789 | |
emh203 | 0:3d9c67d97d6f | 2790 | /** |
emh203 | 0:3d9c67d97d6f | 2791 | * @brief Adds a constant offset to a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 2792 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2793 | * @param[in] offset is the offset to be added |
emh203 | 0:3d9c67d97d6f | 2794 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2795 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2796 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2797 | */ |
emh203 | 0:3d9c67d97d6f | 2798 | |
emh203 | 0:3d9c67d97d6f | 2799 | void arm_offset_f32( |
emh203 | 0:3d9c67d97d6f | 2800 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2801 | float32_t offset, |
emh203 | 0:3d9c67d97d6f | 2802 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2803 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2804 | |
emh203 | 0:3d9c67d97d6f | 2805 | /** |
emh203 | 0:3d9c67d97d6f | 2806 | * @brief Adds a constant offset to a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 2807 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2808 | * @param[in] offset is the offset to be added |
emh203 | 0:3d9c67d97d6f | 2809 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2810 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2811 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2812 | */ |
emh203 | 0:3d9c67d97d6f | 2813 | |
emh203 | 0:3d9c67d97d6f | 2814 | void arm_offset_q7( |
emh203 | 0:3d9c67d97d6f | 2815 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2816 | q7_t offset, |
emh203 | 0:3d9c67d97d6f | 2817 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2818 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2819 | |
emh203 | 0:3d9c67d97d6f | 2820 | /** |
emh203 | 0:3d9c67d97d6f | 2821 | * @brief Adds a constant offset to a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 2822 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2823 | * @param[in] offset is the offset to be added |
emh203 | 0:3d9c67d97d6f | 2824 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2825 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2826 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2827 | */ |
emh203 | 0:3d9c67d97d6f | 2828 | |
emh203 | 0:3d9c67d97d6f | 2829 | void arm_offset_q15( |
emh203 | 0:3d9c67d97d6f | 2830 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2831 | q15_t offset, |
emh203 | 0:3d9c67d97d6f | 2832 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2833 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2834 | |
emh203 | 0:3d9c67d97d6f | 2835 | /** |
emh203 | 0:3d9c67d97d6f | 2836 | * @brief Adds a constant offset to a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 2837 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2838 | * @param[in] offset is the offset to be added |
emh203 | 0:3d9c67d97d6f | 2839 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2840 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2841 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2842 | */ |
emh203 | 0:3d9c67d97d6f | 2843 | |
emh203 | 0:3d9c67d97d6f | 2844 | void arm_offset_q31( |
emh203 | 0:3d9c67d97d6f | 2845 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2846 | q31_t offset, |
emh203 | 0:3d9c67d97d6f | 2847 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2848 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2849 | |
emh203 | 0:3d9c67d97d6f | 2850 | /** |
emh203 | 0:3d9c67d97d6f | 2851 | * @brief Negates the elements of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 2852 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2853 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2854 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2855 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2856 | */ |
emh203 | 0:3d9c67d97d6f | 2857 | |
emh203 | 0:3d9c67d97d6f | 2858 | void arm_negate_f32( |
emh203 | 0:3d9c67d97d6f | 2859 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2860 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2861 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2862 | |
emh203 | 0:3d9c67d97d6f | 2863 | /** |
emh203 | 0:3d9c67d97d6f | 2864 | * @brief Negates the elements of a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 2865 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2866 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2867 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2868 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2869 | */ |
emh203 | 0:3d9c67d97d6f | 2870 | |
emh203 | 0:3d9c67d97d6f | 2871 | void arm_negate_q7( |
emh203 | 0:3d9c67d97d6f | 2872 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2873 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2874 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2875 | |
emh203 | 0:3d9c67d97d6f | 2876 | /** |
emh203 | 0:3d9c67d97d6f | 2877 | * @brief Negates the elements of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 2878 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2879 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2880 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2881 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2882 | */ |
emh203 | 0:3d9c67d97d6f | 2883 | |
emh203 | 0:3d9c67d97d6f | 2884 | void arm_negate_q15( |
emh203 | 0:3d9c67d97d6f | 2885 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2886 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2887 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2888 | |
emh203 | 0:3d9c67d97d6f | 2889 | /** |
emh203 | 0:3d9c67d97d6f | 2890 | * @brief Negates the elements of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 2891 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 2892 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 2893 | * @param[in] blockSize number of samples in the vector |
emh203 | 0:3d9c67d97d6f | 2894 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2895 | */ |
emh203 | 0:3d9c67d97d6f | 2896 | |
emh203 | 0:3d9c67d97d6f | 2897 | void arm_negate_q31( |
emh203 | 0:3d9c67d97d6f | 2898 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2899 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2900 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2901 | /** |
emh203 | 0:3d9c67d97d6f | 2902 | * @brief Copies the elements of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 2903 | * @param[in] *pSrc input pointer |
emh203 | 0:3d9c67d97d6f | 2904 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2905 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2906 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2907 | */ |
emh203 | 0:3d9c67d97d6f | 2908 | void arm_copy_f32( |
emh203 | 0:3d9c67d97d6f | 2909 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2910 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2911 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2912 | |
emh203 | 0:3d9c67d97d6f | 2913 | /** |
emh203 | 0:3d9c67d97d6f | 2914 | * @brief Copies the elements of a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 2915 | * @param[in] *pSrc input pointer |
emh203 | 0:3d9c67d97d6f | 2916 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2917 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2918 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2919 | */ |
emh203 | 0:3d9c67d97d6f | 2920 | void arm_copy_q7( |
emh203 | 0:3d9c67d97d6f | 2921 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2922 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2923 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2924 | |
emh203 | 0:3d9c67d97d6f | 2925 | /** |
emh203 | 0:3d9c67d97d6f | 2926 | * @brief Copies the elements of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 2927 | * @param[in] *pSrc input pointer |
emh203 | 0:3d9c67d97d6f | 2928 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2929 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2930 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2931 | */ |
emh203 | 0:3d9c67d97d6f | 2932 | void arm_copy_q15( |
emh203 | 0:3d9c67d97d6f | 2933 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2934 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2935 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2936 | |
emh203 | 0:3d9c67d97d6f | 2937 | /** |
emh203 | 0:3d9c67d97d6f | 2938 | * @brief Copies the elements of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 2939 | * @param[in] *pSrc input pointer |
emh203 | 0:3d9c67d97d6f | 2940 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2941 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2942 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2943 | */ |
emh203 | 0:3d9c67d97d6f | 2944 | void arm_copy_q31( |
emh203 | 0:3d9c67d97d6f | 2945 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 2946 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2947 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2948 | /** |
emh203 | 0:3d9c67d97d6f | 2949 | * @brief Fills a constant value into a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 2950 | * @param[in] value input value to be filled |
emh203 | 0:3d9c67d97d6f | 2951 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2952 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2953 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2954 | */ |
emh203 | 0:3d9c67d97d6f | 2955 | void arm_fill_f32( |
emh203 | 0:3d9c67d97d6f | 2956 | float32_t value, |
emh203 | 0:3d9c67d97d6f | 2957 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2958 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2959 | |
emh203 | 0:3d9c67d97d6f | 2960 | /** |
emh203 | 0:3d9c67d97d6f | 2961 | * @brief Fills a constant value into a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 2962 | * @param[in] value input value to be filled |
emh203 | 0:3d9c67d97d6f | 2963 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2964 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2965 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2966 | */ |
emh203 | 0:3d9c67d97d6f | 2967 | void arm_fill_q7( |
emh203 | 0:3d9c67d97d6f | 2968 | q7_t value, |
emh203 | 0:3d9c67d97d6f | 2969 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2970 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2971 | |
emh203 | 0:3d9c67d97d6f | 2972 | /** |
emh203 | 0:3d9c67d97d6f | 2973 | * @brief Fills a constant value into a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 2974 | * @param[in] value input value to be filled |
emh203 | 0:3d9c67d97d6f | 2975 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2976 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2977 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2978 | */ |
emh203 | 0:3d9c67d97d6f | 2979 | void arm_fill_q15( |
emh203 | 0:3d9c67d97d6f | 2980 | q15_t value, |
emh203 | 0:3d9c67d97d6f | 2981 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2982 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2983 | |
emh203 | 0:3d9c67d97d6f | 2984 | /** |
emh203 | 0:3d9c67d97d6f | 2985 | * @brief Fills a constant value into a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 2986 | * @param[in] value input value to be filled |
emh203 | 0:3d9c67d97d6f | 2987 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 2988 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 2989 | * @return none. |
emh203 | 0:3d9c67d97d6f | 2990 | */ |
emh203 | 0:3d9c67d97d6f | 2991 | void arm_fill_q31( |
emh203 | 0:3d9c67d97d6f | 2992 | q31_t value, |
emh203 | 0:3d9c67d97d6f | 2993 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 2994 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 2995 | |
emh203 | 0:3d9c67d97d6f | 2996 | /** |
emh203 | 0:3d9c67d97d6f | 2997 | * @brief Convolution of floating-point sequences. |
emh203 | 0:3d9c67d97d6f | 2998 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 2999 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3000 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3001 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3002 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3003 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3004 | */ |
emh203 | 0:3d9c67d97d6f | 3005 | |
emh203 | 0:3d9c67d97d6f | 3006 | void arm_conv_f32( |
emh203 | 0:3d9c67d97d6f | 3007 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3008 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3009 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3010 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3011 | float32_t * pDst); |
emh203 | 0:3d9c67d97d6f | 3012 | |
emh203 | 0:3d9c67d97d6f | 3013 | |
emh203 | 0:3d9c67d97d6f | 3014 | /** |
emh203 | 0:3d9c67d97d6f | 3015 | * @brief Convolution of Q15 sequences. |
emh203 | 0:3d9c67d97d6f | 3016 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3017 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3018 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3019 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3020 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3021 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 3022 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 3023 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3024 | */ |
emh203 | 0:3d9c67d97d6f | 3025 | |
emh203 | 0:3d9c67d97d6f | 3026 | |
emh203 | 0:3d9c67d97d6f | 3027 | void arm_conv_opt_q15( |
emh203 | 0:3d9c67d97d6f | 3028 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3029 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3030 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3031 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3032 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3033 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 3034 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 3035 | |
emh203 | 0:3d9c67d97d6f | 3036 | |
emh203 | 0:3d9c67d97d6f | 3037 | /** |
emh203 | 0:3d9c67d97d6f | 3038 | * @brief Convolution of Q15 sequences. |
emh203 | 0:3d9c67d97d6f | 3039 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3040 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3041 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3042 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3043 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3044 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3045 | */ |
emh203 | 0:3d9c67d97d6f | 3046 | |
emh203 | 0:3d9c67d97d6f | 3047 | void arm_conv_q15( |
emh203 | 0:3d9c67d97d6f | 3048 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3049 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3050 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3051 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3052 | q15_t * pDst); |
emh203 | 0:3d9c67d97d6f | 3053 | |
emh203 | 0:3d9c67d97d6f | 3054 | /** |
emh203 | 0:3d9c67d97d6f | 3055 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 3056 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3057 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3058 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3059 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3060 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3061 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3062 | */ |
emh203 | 0:3d9c67d97d6f | 3063 | |
emh203 | 0:3d9c67d97d6f | 3064 | void arm_conv_fast_q15( |
emh203 | 0:3d9c67d97d6f | 3065 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3066 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3067 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3068 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3069 | q15_t * pDst); |
emh203 | 0:3d9c67d97d6f | 3070 | |
emh203 | 0:3d9c67d97d6f | 3071 | /** |
emh203 | 0:3d9c67d97d6f | 3072 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 3073 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3074 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3075 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3076 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3077 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3078 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 3079 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 3080 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3081 | */ |
emh203 | 0:3d9c67d97d6f | 3082 | |
emh203 | 0:3d9c67d97d6f | 3083 | void arm_conv_fast_opt_q15( |
emh203 | 0:3d9c67d97d6f | 3084 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3085 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3086 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3087 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3088 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3089 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 3090 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 3091 | |
emh203 | 0:3d9c67d97d6f | 3092 | |
emh203 | 0:3d9c67d97d6f | 3093 | |
emh203 | 0:3d9c67d97d6f | 3094 | /** |
emh203 | 0:3d9c67d97d6f | 3095 | * @brief Convolution of Q31 sequences. |
emh203 | 0:3d9c67d97d6f | 3096 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3097 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3098 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3099 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3100 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3101 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3102 | */ |
emh203 | 0:3d9c67d97d6f | 3103 | |
emh203 | 0:3d9c67d97d6f | 3104 | void arm_conv_q31( |
emh203 | 0:3d9c67d97d6f | 3105 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3106 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3107 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3108 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3109 | q31_t * pDst); |
emh203 | 0:3d9c67d97d6f | 3110 | |
emh203 | 0:3d9c67d97d6f | 3111 | /** |
emh203 | 0:3d9c67d97d6f | 3112 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 3113 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3114 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3115 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3116 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3117 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3118 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3119 | */ |
emh203 | 0:3d9c67d97d6f | 3120 | |
emh203 | 0:3d9c67d97d6f | 3121 | void arm_conv_fast_q31( |
emh203 | 0:3d9c67d97d6f | 3122 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3123 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3124 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3125 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3126 | q31_t * pDst); |
emh203 | 0:3d9c67d97d6f | 3127 | |
emh203 | 0:3d9c67d97d6f | 3128 | |
emh203 | 0:3d9c67d97d6f | 3129 | /** |
emh203 | 0:3d9c67d97d6f | 3130 | * @brief Convolution of Q7 sequences. |
emh203 | 0:3d9c67d97d6f | 3131 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3132 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3133 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3134 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3135 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3136 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 3137 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 3138 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3139 | */ |
emh203 | 0:3d9c67d97d6f | 3140 | |
emh203 | 0:3d9c67d97d6f | 3141 | void arm_conv_opt_q7( |
emh203 | 0:3d9c67d97d6f | 3142 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3143 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3144 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3145 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3146 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3147 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 3148 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 3149 | |
emh203 | 0:3d9c67d97d6f | 3150 | |
emh203 | 0:3d9c67d97d6f | 3151 | |
emh203 | 0:3d9c67d97d6f | 3152 | /** |
emh203 | 0:3d9c67d97d6f | 3153 | * @brief Convolution of Q7 sequences. |
emh203 | 0:3d9c67d97d6f | 3154 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3155 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3156 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3157 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3158 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emh203 | 0:3d9c67d97d6f | 3159 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3160 | */ |
emh203 | 0:3d9c67d97d6f | 3161 | |
emh203 | 0:3d9c67d97d6f | 3162 | void arm_conv_q7( |
emh203 | 0:3d9c67d97d6f | 3163 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3164 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3165 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3166 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3167 | q7_t * pDst); |
emh203 | 0:3d9c67d97d6f | 3168 | |
emh203 | 0:3d9c67d97d6f | 3169 | |
emh203 | 0:3d9c67d97d6f | 3170 | /** |
emh203 | 0:3d9c67d97d6f | 3171 | * @brief Partial convolution of floating-point sequences. |
emh203 | 0:3d9c67d97d6f | 3172 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3173 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3174 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3175 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3176 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3177 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3178 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3179 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3180 | */ |
emh203 | 0:3d9c67d97d6f | 3181 | |
emh203 | 0:3d9c67d97d6f | 3182 | arm_status arm_conv_partial_f32( |
emh203 | 0:3d9c67d97d6f | 3183 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3184 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3185 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3186 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3187 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3188 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3189 | uint32_t numPoints); |
emh203 | 0:3d9c67d97d6f | 3190 | |
emh203 | 0:3d9c67d97d6f | 3191 | /** |
emh203 | 0:3d9c67d97d6f | 3192 | * @brief Partial convolution of Q15 sequences. |
emh203 | 0:3d9c67d97d6f | 3193 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3194 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3195 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3196 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3197 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3198 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3199 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3200 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 3201 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 3202 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3203 | */ |
emh203 | 0:3d9c67d97d6f | 3204 | |
emh203 | 0:3d9c67d97d6f | 3205 | arm_status arm_conv_partial_opt_q15( |
emh203 | 0:3d9c67d97d6f | 3206 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3207 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3208 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3209 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3210 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3211 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3212 | uint32_t numPoints, |
emh203 | 0:3d9c67d97d6f | 3213 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 3214 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 3215 | |
emh203 | 0:3d9c67d97d6f | 3216 | |
emh203 | 0:3d9c67d97d6f | 3217 | /** |
emh203 | 0:3d9c67d97d6f | 3218 | * @brief Partial convolution of Q15 sequences. |
emh203 | 0:3d9c67d97d6f | 3219 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3220 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3221 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3222 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3223 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3224 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3225 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3226 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3227 | */ |
emh203 | 0:3d9c67d97d6f | 3228 | |
emh203 | 0:3d9c67d97d6f | 3229 | arm_status arm_conv_partial_q15( |
emh203 | 0:3d9c67d97d6f | 3230 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3231 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3232 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3233 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3234 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3235 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3236 | uint32_t numPoints); |
emh203 | 0:3d9c67d97d6f | 3237 | |
emh203 | 0:3d9c67d97d6f | 3238 | /** |
emh203 | 0:3d9c67d97d6f | 3239 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 3240 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3241 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3242 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3243 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3244 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3245 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3246 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3247 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3248 | */ |
emh203 | 0:3d9c67d97d6f | 3249 | |
emh203 | 0:3d9c67d97d6f | 3250 | arm_status arm_conv_partial_fast_q15( |
emh203 | 0:3d9c67d97d6f | 3251 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3252 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3253 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3254 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3255 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3256 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3257 | uint32_t numPoints); |
emh203 | 0:3d9c67d97d6f | 3258 | |
emh203 | 0:3d9c67d97d6f | 3259 | |
emh203 | 0:3d9c67d97d6f | 3260 | /** |
emh203 | 0:3d9c67d97d6f | 3261 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 3262 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3263 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3264 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3265 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3266 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3267 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3268 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3269 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 3270 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 3271 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3272 | */ |
emh203 | 0:3d9c67d97d6f | 3273 | |
emh203 | 0:3d9c67d97d6f | 3274 | arm_status arm_conv_partial_fast_opt_q15( |
emh203 | 0:3d9c67d97d6f | 3275 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3276 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3277 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3278 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3279 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3280 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3281 | uint32_t numPoints, |
emh203 | 0:3d9c67d97d6f | 3282 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 3283 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 3284 | |
emh203 | 0:3d9c67d97d6f | 3285 | |
emh203 | 0:3d9c67d97d6f | 3286 | /** |
emh203 | 0:3d9c67d97d6f | 3287 | * @brief Partial convolution of Q31 sequences. |
emh203 | 0:3d9c67d97d6f | 3288 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3289 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3290 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3291 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3292 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3293 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3294 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3295 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3296 | */ |
emh203 | 0:3d9c67d97d6f | 3297 | |
emh203 | 0:3d9c67d97d6f | 3298 | arm_status arm_conv_partial_q31( |
emh203 | 0:3d9c67d97d6f | 3299 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3300 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3301 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3302 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3303 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3304 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3305 | uint32_t numPoints); |
emh203 | 0:3d9c67d97d6f | 3306 | |
emh203 | 0:3d9c67d97d6f | 3307 | |
emh203 | 0:3d9c67d97d6f | 3308 | /** |
emh203 | 0:3d9c67d97d6f | 3309 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 3310 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3311 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3312 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3313 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3314 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3315 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3316 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3317 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3318 | */ |
emh203 | 0:3d9c67d97d6f | 3319 | |
emh203 | 0:3d9c67d97d6f | 3320 | arm_status arm_conv_partial_fast_q31( |
emh203 | 0:3d9c67d97d6f | 3321 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3322 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3323 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3324 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3325 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3326 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3327 | uint32_t numPoints); |
emh203 | 0:3d9c67d97d6f | 3328 | |
emh203 | 0:3d9c67d97d6f | 3329 | |
emh203 | 0:3d9c67d97d6f | 3330 | /** |
emh203 | 0:3d9c67d97d6f | 3331 | * @brief Partial convolution of Q7 sequences |
emh203 | 0:3d9c67d97d6f | 3332 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3333 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3334 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3335 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3336 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3337 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3338 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3339 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 3340 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 3341 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3342 | */ |
emh203 | 0:3d9c67d97d6f | 3343 | |
emh203 | 0:3d9c67d97d6f | 3344 | arm_status arm_conv_partial_opt_q7( |
emh203 | 0:3d9c67d97d6f | 3345 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3346 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3347 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3348 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3349 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3350 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3351 | uint32_t numPoints, |
emh203 | 0:3d9c67d97d6f | 3352 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 3353 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 3354 | |
emh203 | 0:3d9c67d97d6f | 3355 | |
emh203 | 0:3d9c67d97d6f | 3356 | /** |
emh203 | 0:3d9c67d97d6f | 3357 | * @brief Partial convolution of Q7 sequences. |
emh203 | 0:3d9c67d97d6f | 3358 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3359 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 3360 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3361 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 3362 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3363 | * @param[in] firstIndex is the first output sample to start with. |
emh203 | 0:3d9c67d97d6f | 3364 | * @param[in] numPoints is the number of output points to be computed. |
emh203 | 0:3d9c67d97d6f | 3365 | * @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]. |
emh203 | 0:3d9c67d97d6f | 3366 | */ |
emh203 | 0:3d9c67d97d6f | 3367 | |
emh203 | 0:3d9c67d97d6f | 3368 | arm_status arm_conv_partial_q7( |
emh203 | 0:3d9c67d97d6f | 3369 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 3370 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 3371 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 3372 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 3373 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3374 | uint32_t firstIndex, |
emh203 | 0:3d9c67d97d6f | 3375 | uint32_t numPoints); |
emh203 | 0:3d9c67d97d6f | 3376 | |
emh203 | 0:3d9c67d97d6f | 3377 | |
emh203 | 0:3d9c67d97d6f | 3378 | |
emh203 | 0:3d9c67d97d6f | 3379 | /** |
emh203 | 0:3d9c67d97d6f | 3380 | * @brief Instance structure for the Q15 FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3381 | */ |
emh203 | 0:3d9c67d97d6f | 3382 | |
emh203 | 0:3d9c67d97d6f | 3383 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3384 | { |
emh203 | 0:3d9c67d97d6f | 3385 | uint8_t M; /**< decimation factor. */ |
emh203 | 0:3d9c67d97d6f | 3386 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 3387 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 3388 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 3389 | } arm_fir_decimate_instance_q15; |
emh203 | 0:3d9c67d97d6f | 3390 | |
emh203 | 0:3d9c67d97d6f | 3391 | /** |
emh203 | 0:3d9c67d97d6f | 3392 | * @brief Instance structure for the Q31 FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3393 | */ |
emh203 | 0:3d9c67d97d6f | 3394 | |
emh203 | 0:3d9c67d97d6f | 3395 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3396 | { |
emh203 | 0:3d9c67d97d6f | 3397 | uint8_t M; /**< decimation factor. */ |
emh203 | 0:3d9c67d97d6f | 3398 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 3399 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 3400 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 3401 | |
emh203 | 0:3d9c67d97d6f | 3402 | } arm_fir_decimate_instance_q31; |
emh203 | 0:3d9c67d97d6f | 3403 | |
emh203 | 0:3d9c67d97d6f | 3404 | /** |
emh203 | 0:3d9c67d97d6f | 3405 | * @brief Instance structure for the floating-point FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3406 | */ |
emh203 | 0:3d9c67d97d6f | 3407 | |
emh203 | 0:3d9c67d97d6f | 3408 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3409 | { |
emh203 | 0:3d9c67d97d6f | 3410 | uint8_t M; /**< decimation factor. */ |
emh203 | 0:3d9c67d97d6f | 3411 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 3412 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 3413 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 3414 | |
emh203 | 0:3d9c67d97d6f | 3415 | } arm_fir_decimate_instance_f32; |
emh203 | 0:3d9c67d97d6f | 3416 | |
emh203 | 0:3d9c67d97d6f | 3417 | |
emh203 | 0:3d9c67d97d6f | 3418 | |
emh203 | 0:3d9c67d97d6f | 3419 | /** |
emh203 | 0:3d9c67d97d6f | 3420 | * @brief Processing function for the floating-point FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3421 | * @param[in] *S points to an instance of the floating-point FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3422 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3423 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3424 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3425 | * @return none |
emh203 | 0:3d9c67d97d6f | 3426 | */ |
emh203 | 0:3d9c67d97d6f | 3427 | |
emh203 | 0:3d9c67d97d6f | 3428 | void arm_fir_decimate_f32( |
emh203 | 0:3d9c67d97d6f | 3429 | const arm_fir_decimate_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3430 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3431 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3432 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3433 | |
emh203 | 0:3d9c67d97d6f | 3434 | |
emh203 | 0:3d9c67d97d6f | 3435 | /** |
emh203 | 0:3d9c67d97d6f | 3436 | * @brief Initialization function for the floating-point FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3437 | * @param[in,out] *S points to an instance of the floating-point FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3438 | * @param[in] numTaps number of coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 3439 | * @param[in] M decimation factor. |
emh203 | 0:3d9c67d97d6f | 3440 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 3441 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3442 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3443 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emh203 | 0:3d9c67d97d6f | 3444 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
emh203 | 0:3d9c67d97d6f | 3445 | */ |
emh203 | 0:3d9c67d97d6f | 3446 | |
emh203 | 0:3d9c67d97d6f | 3447 | arm_status arm_fir_decimate_init_f32( |
emh203 | 0:3d9c67d97d6f | 3448 | arm_fir_decimate_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3449 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 3450 | uint8_t M, |
emh203 | 0:3d9c67d97d6f | 3451 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3452 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 3453 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3454 | |
emh203 | 0:3d9c67d97d6f | 3455 | /** |
emh203 | 0:3d9c67d97d6f | 3456 | * @brief Processing function for the Q15 FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3457 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3458 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3459 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3460 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3461 | * @return none |
emh203 | 0:3d9c67d97d6f | 3462 | */ |
emh203 | 0:3d9c67d97d6f | 3463 | |
emh203 | 0:3d9c67d97d6f | 3464 | void arm_fir_decimate_q15( |
emh203 | 0:3d9c67d97d6f | 3465 | const arm_fir_decimate_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3466 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3467 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3468 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3469 | |
emh203 | 0:3d9c67d97d6f | 3470 | /** |
emh203 | 0:3d9c67d97d6f | 3471 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 3472 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3473 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3474 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3475 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3476 | * @return none |
emh203 | 0:3d9c67d97d6f | 3477 | */ |
emh203 | 0:3d9c67d97d6f | 3478 | |
emh203 | 0:3d9c67d97d6f | 3479 | void arm_fir_decimate_fast_q15( |
emh203 | 0:3d9c67d97d6f | 3480 | const arm_fir_decimate_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3481 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3482 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3483 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3484 | |
emh203 | 0:3d9c67d97d6f | 3485 | |
emh203 | 0:3d9c67d97d6f | 3486 | |
emh203 | 0:3d9c67d97d6f | 3487 | /** |
emh203 | 0:3d9c67d97d6f | 3488 | * @brief Initialization function for the Q15 FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3489 | * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3490 | * @param[in] numTaps number of coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 3491 | * @param[in] M decimation factor. |
emh203 | 0:3d9c67d97d6f | 3492 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 3493 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3494 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3495 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emh203 | 0:3d9c67d97d6f | 3496 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
emh203 | 0:3d9c67d97d6f | 3497 | */ |
emh203 | 0:3d9c67d97d6f | 3498 | |
emh203 | 0:3d9c67d97d6f | 3499 | arm_status arm_fir_decimate_init_q15( |
emh203 | 0:3d9c67d97d6f | 3500 | arm_fir_decimate_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3501 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 3502 | uint8_t M, |
emh203 | 0:3d9c67d97d6f | 3503 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3504 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 3505 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3506 | |
emh203 | 0:3d9c67d97d6f | 3507 | /** |
emh203 | 0:3d9c67d97d6f | 3508 | * @brief Processing function for the Q31 FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3509 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3510 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3511 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3512 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3513 | * @return none |
emh203 | 0:3d9c67d97d6f | 3514 | */ |
emh203 | 0:3d9c67d97d6f | 3515 | |
emh203 | 0:3d9c67d97d6f | 3516 | void arm_fir_decimate_q31( |
emh203 | 0:3d9c67d97d6f | 3517 | const arm_fir_decimate_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3518 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3519 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3520 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3521 | |
emh203 | 0:3d9c67d97d6f | 3522 | /** |
emh203 | 0:3d9c67d97d6f | 3523 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 3524 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3525 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3526 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3527 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3528 | * @return none |
emh203 | 0:3d9c67d97d6f | 3529 | */ |
emh203 | 0:3d9c67d97d6f | 3530 | |
emh203 | 0:3d9c67d97d6f | 3531 | void arm_fir_decimate_fast_q31( |
emh203 | 0:3d9c67d97d6f | 3532 | arm_fir_decimate_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3533 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3534 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3535 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3536 | |
emh203 | 0:3d9c67d97d6f | 3537 | |
emh203 | 0:3d9c67d97d6f | 3538 | /** |
emh203 | 0:3d9c67d97d6f | 3539 | * @brief Initialization function for the Q31 FIR decimator. |
emh203 | 0:3d9c67d97d6f | 3540 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. |
emh203 | 0:3d9c67d97d6f | 3541 | * @param[in] numTaps number of coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 3542 | * @param[in] M decimation factor. |
emh203 | 0:3d9c67d97d6f | 3543 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 3544 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3545 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3546 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emh203 | 0:3d9c67d97d6f | 3547 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
emh203 | 0:3d9c67d97d6f | 3548 | */ |
emh203 | 0:3d9c67d97d6f | 3549 | |
emh203 | 0:3d9c67d97d6f | 3550 | arm_status arm_fir_decimate_init_q31( |
emh203 | 0:3d9c67d97d6f | 3551 | arm_fir_decimate_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3552 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 3553 | uint8_t M, |
emh203 | 0:3d9c67d97d6f | 3554 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3555 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 3556 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3557 | |
emh203 | 0:3d9c67d97d6f | 3558 | |
emh203 | 0:3d9c67d97d6f | 3559 | |
emh203 | 0:3d9c67d97d6f | 3560 | /** |
emh203 | 0:3d9c67d97d6f | 3561 | * @brief Instance structure for the Q15 FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3562 | */ |
emh203 | 0:3d9c67d97d6f | 3563 | |
emh203 | 0:3d9c67d97d6f | 3564 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3565 | { |
emh203 | 0:3d9c67d97d6f | 3566 | uint8_t L; /**< upsample factor. */ |
emh203 | 0:3d9c67d97d6f | 3567 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
emh203 | 0:3d9c67d97d6f | 3568 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
emh203 | 0:3d9c67d97d6f | 3569 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
emh203 | 0:3d9c67d97d6f | 3570 | } arm_fir_interpolate_instance_q15; |
emh203 | 0:3d9c67d97d6f | 3571 | |
emh203 | 0:3d9c67d97d6f | 3572 | /** |
emh203 | 0:3d9c67d97d6f | 3573 | * @brief Instance structure for the Q31 FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3574 | */ |
emh203 | 0:3d9c67d97d6f | 3575 | |
emh203 | 0:3d9c67d97d6f | 3576 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3577 | { |
emh203 | 0:3d9c67d97d6f | 3578 | uint8_t L; /**< upsample factor. */ |
emh203 | 0:3d9c67d97d6f | 3579 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
emh203 | 0:3d9c67d97d6f | 3580 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
emh203 | 0:3d9c67d97d6f | 3581 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
emh203 | 0:3d9c67d97d6f | 3582 | } arm_fir_interpolate_instance_q31; |
emh203 | 0:3d9c67d97d6f | 3583 | |
emh203 | 0:3d9c67d97d6f | 3584 | /** |
emh203 | 0:3d9c67d97d6f | 3585 | * @brief Instance structure for the floating-point FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3586 | */ |
emh203 | 0:3d9c67d97d6f | 3587 | |
emh203 | 0:3d9c67d97d6f | 3588 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3589 | { |
emh203 | 0:3d9c67d97d6f | 3590 | uint8_t L; /**< upsample factor. */ |
emh203 | 0:3d9c67d97d6f | 3591 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
emh203 | 0:3d9c67d97d6f | 3592 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
emh203 | 0:3d9c67d97d6f | 3593 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ |
emh203 | 0:3d9c67d97d6f | 3594 | } arm_fir_interpolate_instance_f32; |
emh203 | 0:3d9c67d97d6f | 3595 | |
emh203 | 0:3d9c67d97d6f | 3596 | |
emh203 | 0:3d9c67d97d6f | 3597 | /** |
emh203 | 0:3d9c67d97d6f | 3598 | * @brief Processing function for the Q15 FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3599 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
emh203 | 0:3d9c67d97d6f | 3600 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3601 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 3602 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3603 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3604 | */ |
emh203 | 0:3d9c67d97d6f | 3605 | |
emh203 | 0:3d9c67d97d6f | 3606 | void arm_fir_interpolate_q15( |
emh203 | 0:3d9c67d97d6f | 3607 | const arm_fir_interpolate_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3608 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3609 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3610 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3611 | |
emh203 | 0:3d9c67d97d6f | 3612 | |
emh203 | 0:3d9c67d97d6f | 3613 | /** |
emh203 | 0:3d9c67d97d6f | 3614 | * @brief Initialization function for the Q15 FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3615 | * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. |
emh203 | 0:3d9c67d97d6f | 3616 | * @param[in] L upsample factor. |
emh203 | 0:3d9c67d97d6f | 3617 | * @param[in] numTaps number of filter coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 3618 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 3619 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3620 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3621 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emh203 | 0:3d9c67d97d6f | 3622 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
emh203 | 0:3d9c67d97d6f | 3623 | */ |
emh203 | 0:3d9c67d97d6f | 3624 | |
emh203 | 0:3d9c67d97d6f | 3625 | arm_status arm_fir_interpolate_init_q15( |
emh203 | 0:3d9c67d97d6f | 3626 | arm_fir_interpolate_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3627 | uint8_t L, |
emh203 | 0:3d9c67d97d6f | 3628 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 3629 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3630 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 3631 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3632 | |
emh203 | 0:3d9c67d97d6f | 3633 | /** |
emh203 | 0:3d9c67d97d6f | 3634 | * @brief Processing function for the Q31 FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3635 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
emh203 | 0:3d9c67d97d6f | 3636 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3637 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 3638 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3639 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3640 | */ |
emh203 | 0:3d9c67d97d6f | 3641 | |
emh203 | 0:3d9c67d97d6f | 3642 | void arm_fir_interpolate_q31( |
emh203 | 0:3d9c67d97d6f | 3643 | const arm_fir_interpolate_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3644 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3645 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3646 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3647 | |
emh203 | 0:3d9c67d97d6f | 3648 | /** |
emh203 | 0:3d9c67d97d6f | 3649 | * @brief Initialization function for the Q31 FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3650 | * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure. |
emh203 | 0:3d9c67d97d6f | 3651 | * @param[in] L upsample factor. |
emh203 | 0:3d9c67d97d6f | 3652 | * @param[in] numTaps number of filter coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 3653 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 3654 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3655 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3656 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emh203 | 0:3d9c67d97d6f | 3657 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
emh203 | 0:3d9c67d97d6f | 3658 | */ |
emh203 | 0:3d9c67d97d6f | 3659 | |
emh203 | 0:3d9c67d97d6f | 3660 | arm_status arm_fir_interpolate_init_q31( |
emh203 | 0:3d9c67d97d6f | 3661 | arm_fir_interpolate_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3662 | uint8_t L, |
emh203 | 0:3d9c67d97d6f | 3663 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 3664 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3665 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 3666 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3667 | |
emh203 | 0:3d9c67d97d6f | 3668 | |
emh203 | 0:3d9c67d97d6f | 3669 | /** |
emh203 | 0:3d9c67d97d6f | 3670 | * @brief Processing function for the floating-point FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3671 | * @param[in] *S points to an instance of the floating-point FIR interpolator structure. |
emh203 | 0:3d9c67d97d6f | 3672 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3673 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 3674 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3675 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3676 | */ |
emh203 | 0:3d9c67d97d6f | 3677 | |
emh203 | 0:3d9c67d97d6f | 3678 | void arm_fir_interpolate_f32( |
emh203 | 0:3d9c67d97d6f | 3679 | const arm_fir_interpolate_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3680 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3681 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3682 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3683 | |
emh203 | 0:3d9c67d97d6f | 3684 | /** |
emh203 | 0:3d9c67d97d6f | 3685 | * @brief Initialization function for the floating-point FIR interpolator. |
emh203 | 0:3d9c67d97d6f | 3686 | * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure. |
emh203 | 0:3d9c67d97d6f | 3687 | * @param[in] L upsample factor. |
emh203 | 0:3d9c67d97d6f | 3688 | * @param[in] numTaps number of filter coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 3689 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 3690 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3691 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 3692 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emh203 | 0:3d9c67d97d6f | 3693 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
emh203 | 0:3d9c67d97d6f | 3694 | */ |
emh203 | 0:3d9c67d97d6f | 3695 | |
emh203 | 0:3d9c67d97d6f | 3696 | arm_status arm_fir_interpolate_init_f32( |
emh203 | 0:3d9c67d97d6f | 3697 | arm_fir_interpolate_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3698 | uint8_t L, |
emh203 | 0:3d9c67d97d6f | 3699 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 3700 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3701 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 3702 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3703 | |
emh203 | 0:3d9c67d97d6f | 3704 | /** |
emh203 | 0:3d9c67d97d6f | 3705 | * @brief Instance structure for the high precision Q31 Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 3706 | */ |
emh203 | 0:3d9c67d97d6f | 3707 | |
emh203 | 0:3d9c67d97d6f | 3708 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3709 | { |
emh203 | 0:3d9c67d97d6f | 3710 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emh203 | 0:3d9c67d97d6f | 3711 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
emh203 | 0:3d9c67d97d6f | 3712 | q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
emh203 | 0:3d9c67d97d6f | 3713 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ |
emh203 | 0:3d9c67d97d6f | 3714 | |
emh203 | 0:3d9c67d97d6f | 3715 | } arm_biquad_cas_df1_32x64_ins_q31; |
emh203 | 0:3d9c67d97d6f | 3716 | |
emh203 | 0:3d9c67d97d6f | 3717 | |
emh203 | 0:3d9c67d97d6f | 3718 | /** |
emh203 | 0:3d9c67d97d6f | 3719 | * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
emh203 | 0:3d9c67d97d6f | 3720 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3721 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3722 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3723 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3724 | */ |
emh203 | 0:3d9c67d97d6f | 3725 | |
emh203 | 0:3d9c67d97d6f | 3726 | void arm_biquad_cas_df1_32x64_q31( |
emh203 | 0:3d9c67d97d6f | 3727 | const arm_biquad_cas_df1_32x64_ins_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3728 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3729 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3730 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3731 | |
emh203 | 0:3d9c67d97d6f | 3732 | |
emh203 | 0:3d9c67d97d6f | 3733 | /** |
emh203 | 0:3d9c67d97d6f | 3734 | * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
emh203 | 0:3d9c67d97d6f | 3735 | * @param[in] numStages number of 2nd order stages in the filter. |
emh203 | 0:3d9c67d97d6f | 3736 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 3737 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3738 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format |
emh203 | 0:3d9c67d97d6f | 3739 | * @return none |
emh203 | 0:3d9c67d97d6f | 3740 | */ |
emh203 | 0:3d9c67d97d6f | 3741 | |
emh203 | 0:3d9c67d97d6f | 3742 | void arm_biquad_cas_df1_32x64_init_q31( |
emh203 | 0:3d9c67d97d6f | 3743 | arm_biquad_cas_df1_32x64_ins_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3744 | uint8_t numStages, |
emh203 | 0:3d9c67d97d6f | 3745 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3746 | q63_t * pState, |
emh203 | 0:3d9c67d97d6f | 3747 | uint8_t postShift); |
emh203 | 0:3d9c67d97d6f | 3748 | |
emh203 | 0:3d9c67d97d6f | 3749 | |
emh203 | 0:3d9c67d97d6f | 3750 | |
emh203 | 0:3d9c67d97d6f | 3751 | /** |
emh203 | 0:3d9c67d97d6f | 3752 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 3753 | */ |
emh203 | 0:3d9c67d97d6f | 3754 | |
emh203 | 0:3d9c67d97d6f | 3755 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3756 | { |
emh203 | 0:3d9c67d97d6f | 3757 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emh203 | 0:3d9c67d97d6f | 3758 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
emh203 | 0:3d9c67d97d6f | 3759 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
emh203 | 0:3d9c67d97d6f | 3760 | } arm_biquad_cascade_df2T_instance_f32; |
emh203 | 0:3d9c67d97d6f | 3761 | |
emh203 | 0:3d9c67d97d6f | 3762 | |
emh203 | 0:3d9c67d97d6f | 3763 | /** |
emh203 | 0:3d9c67d97d6f | 3764 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 3765 | * @param[in] *S points to an instance of the filter data structure. |
emh203 | 0:3d9c67d97d6f | 3766 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3767 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3768 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3769 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3770 | */ |
emh203 | 0:3d9c67d97d6f | 3771 | |
emh203 | 0:3d9c67d97d6f | 3772 | void arm_biquad_cascade_df2T_f32( |
emh203 | 0:3d9c67d97d6f | 3773 | const arm_biquad_cascade_df2T_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3774 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3775 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3776 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3777 | |
emh203 | 0:3d9c67d97d6f | 3778 | |
emh203 | 0:3d9c67d97d6f | 3779 | /** |
emh203 | 0:3d9c67d97d6f | 3780 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
emh203 | 0:3d9c67d97d6f | 3781 | * @param[in,out] *S points to an instance of the filter data structure. |
emh203 | 0:3d9c67d97d6f | 3782 | * @param[in] numStages number of 2nd order stages in the filter. |
emh203 | 0:3d9c67d97d6f | 3783 | * @param[in] *pCoeffs points to the filter coefficients. |
emh203 | 0:3d9c67d97d6f | 3784 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 3785 | * @return none |
emh203 | 0:3d9c67d97d6f | 3786 | */ |
emh203 | 0:3d9c67d97d6f | 3787 | |
emh203 | 0:3d9c67d97d6f | 3788 | void arm_biquad_cascade_df2T_init_f32( |
emh203 | 0:3d9c67d97d6f | 3789 | arm_biquad_cascade_df2T_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3790 | uint8_t numStages, |
emh203 | 0:3d9c67d97d6f | 3791 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3792 | float32_t * pState); |
emh203 | 0:3d9c67d97d6f | 3793 | |
emh203 | 0:3d9c67d97d6f | 3794 | |
emh203 | 0:3d9c67d97d6f | 3795 | |
emh203 | 0:3d9c67d97d6f | 3796 | /** |
emh203 | 0:3d9c67d97d6f | 3797 | * @brief Instance structure for the Q15 FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3798 | */ |
emh203 | 0:3d9c67d97d6f | 3799 | |
emh203 | 0:3d9c67d97d6f | 3800 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3801 | { |
emh203 | 0:3d9c67d97d6f | 3802 | uint16_t numStages; /**< number of filter stages. */ |
emh203 | 0:3d9c67d97d6f | 3803 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3804 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3805 | } arm_fir_lattice_instance_q15; |
emh203 | 0:3d9c67d97d6f | 3806 | |
emh203 | 0:3d9c67d97d6f | 3807 | /** |
emh203 | 0:3d9c67d97d6f | 3808 | * @brief Instance structure for the Q31 FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3809 | */ |
emh203 | 0:3d9c67d97d6f | 3810 | |
emh203 | 0:3d9c67d97d6f | 3811 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3812 | { |
emh203 | 0:3d9c67d97d6f | 3813 | uint16_t numStages; /**< number of filter stages. */ |
emh203 | 0:3d9c67d97d6f | 3814 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3815 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3816 | } arm_fir_lattice_instance_q31; |
emh203 | 0:3d9c67d97d6f | 3817 | |
emh203 | 0:3d9c67d97d6f | 3818 | /** |
emh203 | 0:3d9c67d97d6f | 3819 | * @brief Instance structure for the floating-point FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3820 | */ |
emh203 | 0:3d9c67d97d6f | 3821 | |
emh203 | 0:3d9c67d97d6f | 3822 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3823 | { |
emh203 | 0:3d9c67d97d6f | 3824 | uint16_t numStages; /**< number of filter stages. */ |
emh203 | 0:3d9c67d97d6f | 3825 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3826 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3827 | } arm_fir_lattice_instance_f32; |
emh203 | 0:3d9c67d97d6f | 3828 | |
emh203 | 0:3d9c67d97d6f | 3829 | /** |
emh203 | 0:3d9c67d97d6f | 3830 | * @brief Initialization function for the Q15 FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3831 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3832 | * @param[in] numStages number of filter stages. |
emh203 | 0:3d9c67d97d6f | 3833 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3834 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3835 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3836 | */ |
emh203 | 0:3d9c67d97d6f | 3837 | |
emh203 | 0:3d9c67d97d6f | 3838 | void arm_fir_lattice_init_q15( |
emh203 | 0:3d9c67d97d6f | 3839 | arm_fir_lattice_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3840 | uint16_t numStages, |
emh203 | 0:3d9c67d97d6f | 3841 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3842 | q15_t * pState); |
emh203 | 0:3d9c67d97d6f | 3843 | |
emh203 | 0:3d9c67d97d6f | 3844 | |
emh203 | 0:3d9c67d97d6f | 3845 | /** |
emh203 | 0:3d9c67d97d6f | 3846 | * @brief Processing function for the Q15 FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3847 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3848 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3849 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 3850 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3851 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3852 | */ |
emh203 | 0:3d9c67d97d6f | 3853 | void arm_fir_lattice_q15( |
emh203 | 0:3d9c67d97d6f | 3854 | const arm_fir_lattice_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 3855 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3856 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3857 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3858 | |
emh203 | 0:3d9c67d97d6f | 3859 | /** |
emh203 | 0:3d9c67d97d6f | 3860 | * @brief Initialization function for the Q31 FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3861 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3862 | * @param[in] numStages number of filter stages. |
emh203 | 0:3d9c67d97d6f | 3863 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3864 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3865 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3866 | */ |
emh203 | 0:3d9c67d97d6f | 3867 | |
emh203 | 0:3d9c67d97d6f | 3868 | void arm_fir_lattice_init_q31( |
emh203 | 0:3d9c67d97d6f | 3869 | arm_fir_lattice_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3870 | uint16_t numStages, |
emh203 | 0:3d9c67d97d6f | 3871 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3872 | q31_t * pState); |
emh203 | 0:3d9c67d97d6f | 3873 | |
emh203 | 0:3d9c67d97d6f | 3874 | |
emh203 | 0:3d9c67d97d6f | 3875 | /** |
emh203 | 0:3d9c67d97d6f | 3876 | * @brief Processing function for the Q31 FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3877 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3878 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3879 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3880 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3881 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3882 | */ |
emh203 | 0:3d9c67d97d6f | 3883 | |
emh203 | 0:3d9c67d97d6f | 3884 | void arm_fir_lattice_q31( |
emh203 | 0:3d9c67d97d6f | 3885 | const arm_fir_lattice_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3886 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3887 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3888 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3889 | |
emh203 | 0:3d9c67d97d6f | 3890 | /** |
emh203 | 0:3d9c67d97d6f | 3891 | * @brief Initialization function for the floating-point FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3892 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3893 | * @param[in] numStages number of filter stages. |
emh203 | 0:3d9c67d97d6f | 3894 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3895 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3896 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3897 | */ |
emh203 | 0:3d9c67d97d6f | 3898 | |
emh203 | 0:3d9c67d97d6f | 3899 | void arm_fir_lattice_init_f32( |
emh203 | 0:3d9c67d97d6f | 3900 | arm_fir_lattice_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3901 | uint16_t numStages, |
emh203 | 0:3d9c67d97d6f | 3902 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 3903 | float32_t * pState); |
emh203 | 0:3d9c67d97d6f | 3904 | |
emh203 | 0:3d9c67d97d6f | 3905 | /** |
emh203 | 0:3d9c67d97d6f | 3906 | * @brief Processing function for the floating-point FIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3907 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3908 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3909 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 3910 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3911 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3912 | */ |
emh203 | 0:3d9c67d97d6f | 3913 | |
emh203 | 0:3d9c67d97d6f | 3914 | void arm_fir_lattice_f32( |
emh203 | 0:3d9c67d97d6f | 3915 | const arm_fir_lattice_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3916 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3917 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3918 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3919 | |
emh203 | 0:3d9c67d97d6f | 3920 | /** |
emh203 | 0:3d9c67d97d6f | 3921 | * @brief Instance structure for the Q15 IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3922 | */ |
emh203 | 0:3d9c67d97d6f | 3923 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3924 | { |
emh203 | 0:3d9c67d97d6f | 3925 | uint16_t numStages; /**< number of stages in the filter. */ |
emh203 | 0:3d9c67d97d6f | 3926 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
emh203 | 0:3d9c67d97d6f | 3927 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3928 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
emh203 | 0:3d9c67d97d6f | 3929 | } arm_iir_lattice_instance_q15; |
emh203 | 0:3d9c67d97d6f | 3930 | |
emh203 | 0:3d9c67d97d6f | 3931 | /** |
emh203 | 0:3d9c67d97d6f | 3932 | * @brief Instance structure for the Q31 IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3933 | */ |
emh203 | 0:3d9c67d97d6f | 3934 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3935 | { |
emh203 | 0:3d9c67d97d6f | 3936 | uint16_t numStages; /**< number of stages in the filter. */ |
emh203 | 0:3d9c67d97d6f | 3937 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
emh203 | 0:3d9c67d97d6f | 3938 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3939 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
emh203 | 0:3d9c67d97d6f | 3940 | } arm_iir_lattice_instance_q31; |
emh203 | 0:3d9c67d97d6f | 3941 | |
emh203 | 0:3d9c67d97d6f | 3942 | /** |
emh203 | 0:3d9c67d97d6f | 3943 | * @brief Instance structure for the floating-point IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3944 | */ |
emh203 | 0:3d9c67d97d6f | 3945 | typedef struct |
emh203 | 0:3d9c67d97d6f | 3946 | { |
emh203 | 0:3d9c67d97d6f | 3947 | uint16_t numStages; /**< number of stages in the filter. */ |
emh203 | 0:3d9c67d97d6f | 3948 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
emh203 | 0:3d9c67d97d6f | 3949 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
emh203 | 0:3d9c67d97d6f | 3950 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
emh203 | 0:3d9c67d97d6f | 3951 | } arm_iir_lattice_instance_f32; |
emh203 | 0:3d9c67d97d6f | 3952 | |
emh203 | 0:3d9c67d97d6f | 3953 | /** |
emh203 | 0:3d9c67d97d6f | 3954 | * @brief Processing function for the floating-point IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3955 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3956 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3957 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 3958 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3959 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3960 | */ |
emh203 | 0:3d9c67d97d6f | 3961 | |
emh203 | 0:3d9c67d97d6f | 3962 | void arm_iir_lattice_f32( |
emh203 | 0:3d9c67d97d6f | 3963 | const arm_iir_lattice_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3964 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 3965 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 3966 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3967 | |
emh203 | 0:3d9c67d97d6f | 3968 | /** |
emh203 | 0:3d9c67d97d6f | 3969 | * @brief Initialization function for the floating-point IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3970 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3971 | * @param[in] numStages number of stages in the filter. |
emh203 | 0:3d9c67d97d6f | 3972 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 3973 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
emh203 | 0:3d9c67d97d6f | 3974 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1. |
emh203 | 0:3d9c67d97d6f | 3975 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3976 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3977 | */ |
emh203 | 0:3d9c67d97d6f | 3978 | |
emh203 | 0:3d9c67d97d6f | 3979 | void arm_iir_lattice_init_f32( |
emh203 | 0:3d9c67d97d6f | 3980 | arm_iir_lattice_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 3981 | uint16_t numStages, |
emh203 | 0:3d9c67d97d6f | 3982 | float32_t * pkCoeffs, |
emh203 | 0:3d9c67d97d6f | 3983 | float32_t * pvCoeffs, |
emh203 | 0:3d9c67d97d6f | 3984 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 3985 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 3986 | |
emh203 | 0:3d9c67d97d6f | 3987 | |
emh203 | 0:3d9c67d97d6f | 3988 | /** |
emh203 | 0:3d9c67d97d6f | 3989 | * @brief Processing function for the Q31 IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 3990 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 3991 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 3992 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 3993 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 3994 | * @return none. |
emh203 | 0:3d9c67d97d6f | 3995 | */ |
emh203 | 0:3d9c67d97d6f | 3996 | |
emh203 | 0:3d9c67d97d6f | 3997 | void arm_iir_lattice_q31( |
emh203 | 0:3d9c67d97d6f | 3998 | const arm_iir_lattice_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 3999 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4000 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4001 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4002 | |
emh203 | 0:3d9c67d97d6f | 4003 | |
emh203 | 0:3d9c67d97d6f | 4004 | /** |
emh203 | 0:3d9c67d97d6f | 4005 | * @brief Initialization function for the Q31 IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 4006 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 4007 | * @param[in] numStages number of stages in the filter. |
emh203 | 0:3d9c67d97d6f | 4008 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 4009 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
emh203 | 0:3d9c67d97d6f | 4010 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. |
emh203 | 0:3d9c67d97d6f | 4011 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4012 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4013 | */ |
emh203 | 0:3d9c67d97d6f | 4014 | |
emh203 | 0:3d9c67d97d6f | 4015 | void arm_iir_lattice_init_q31( |
emh203 | 0:3d9c67d97d6f | 4016 | arm_iir_lattice_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4017 | uint16_t numStages, |
emh203 | 0:3d9c67d97d6f | 4018 | q31_t * pkCoeffs, |
emh203 | 0:3d9c67d97d6f | 4019 | q31_t * pvCoeffs, |
emh203 | 0:3d9c67d97d6f | 4020 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 4021 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4022 | |
emh203 | 0:3d9c67d97d6f | 4023 | |
emh203 | 0:3d9c67d97d6f | 4024 | /** |
emh203 | 0:3d9c67d97d6f | 4025 | * @brief Processing function for the Q15 IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 4026 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 4027 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4028 | * @param[out] *pDst points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4029 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4030 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4031 | */ |
emh203 | 0:3d9c67d97d6f | 4032 | |
emh203 | 0:3d9c67d97d6f | 4033 | void arm_iir_lattice_q15( |
emh203 | 0:3d9c67d97d6f | 4034 | const arm_iir_lattice_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4035 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4036 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4037 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4038 | |
emh203 | 0:3d9c67d97d6f | 4039 | |
emh203 | 0:3d9c67d97d6f | 4040 | /** |
emh203 | 0:3d9c67d97d6f | 4041 | * @brief Initialization function for the Q15 IIR lattice filter. |
emh203 | 0:3d9c67d97d6f | 4042 | * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure. |
emh203 | 0:3d9c67d97d6f | 4043 | * @param[in] numStages number of stages in the filter. |
emh203 | 0:3d9c67d97d6f | 4044 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. |
emh203 | 0:3d9c67d97d6f | 4045 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. |
emh203 | 0:3d9c67d97d6f | 4046 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. |
emh203 | 0:3d9c67d97d6f | 4047 | * @param[in] blockSize number of samples to process per call. |
emh203 | 0:3d9c67d97d6f | 4048 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4049 | */ |
emh203 | 0:3d9c67d97d6f | 4050 | |
emh203 | 0:3d9c67d97d6f | 4051 | void arm_iir_lattice_init_q15( |
emh203 | 0:3d9c67d97d6f | 4052 | arm_iir_lattice_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4053 | uint16_t numStages, |
emh203 | 0:3d9c67d97d6f | 4054 | q15_t * pkCoeffs, |
emh203 | 0:3d9c67d97d6f | 4055 | q15_t * pvCoeffs, |
emh203 | 0:3d9c67d97d6f | 4056 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 4057 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4058 | |
emh203 | 0:3d9c67d97d6f | 4059 | /** |
emh203 | 0:3d9c67d97d6f | 4060 | * @brief Instance structure for the floating-point LMS filter. |
emh203 | 0:3d9c67d97d6f | 4061 | */ |
emh203 | 0:3d9c67d97d6f | 4062 | |
emh203 | 0:3d9c67d97d6f | 4063 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4064 | { |
emh203 | 0:3d9c67d97d6f | 4065 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4066 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4067 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4068 | float32_t mu; /**< step size that controls filter coefficient updates. */ |
emh203 | 0:3d9c67d97d6f | 4069 | } arm_lms_instance_f32; |
emh203 | 0:3d9c67d97d6f | 4070 | |
emh203 | 0:3d9c67d97d6f | 4071 | /** |
emh203 | 0:3d9c67d97d6f | 4072 | * @brief Processing function for floating-point LMS filter. |
emh203 | 0:3d9c67d97d6f | 4073 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4074 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4075 | * @param[in] *pRef points to the block of reference data. |
emh203 | 0:3d9c67d97d6f | 4076 | * @param[out] *pOut points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4077 | * @param[out] *pErr points to the block of error data. |
emh203 | 0:3d9c67d97d6f | 4078 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4079 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4080 | */ |
emh203 | 0:3d9c67d97d6f | 4081 | |
emh203 | 0:3d9c67d97d6f | 4082 | void arm_lms_f32( |
emh203 | 0:3d9c67d97d6f | 4083 | const arm_lms_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4084 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4085 | float32_t * pRef, |
emh203 | 0:3d9c67d97d6f | 4086 | float32_t * pOut, |
emh203 | 0:3d9c67d97d6f | 4087 | float32_t * pErr, |
emh203 | 0:3d9c67d97d6f | 4088 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4089 | |
emh203 | 0:3d9c67d97d6f | 4090 | /** |
emh203 | 0:3d9c67d97d6f | 4091 | * @brief Initialization function for floating-point LMS filter. |
emh203 | 0:3d9c67d97d6f | 4092 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4093 | * @param[in] numTaps number of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4094 | * @param[in] *pCoeffs points to the coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 4095 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 4096 | * @param[in] mu step size that controls filter coefficient updates. |
emh203 | 0:3d9c67d97d6f | 4097 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4098 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4099 | */ |
emh203 | 0:3d9c67d97d6f | 4100 | |
emh203 | 0:3d9c67d97d6f | 4101 | void arm_lms_init_f32( |
emh203 | 0:3d9c67d97d6f | 4102 | arm_lms_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4103 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4104 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4105 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 4106 | float32_t mu, |
emh203 | 0:3d9c67d97d6f | 4107 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4108 | |
emh203 | 0:3d9c67d97d6f | 4109 | /** |
emh203 | 0:3d9c67d97d6f | 4110 | * @brief Instance structure for the Q15 LMS filter. |
emh203 | 0:3d9c67d97d6f | 4111 | */ |
emh203 | 0:3d9c67d97d6f | 4112 | |
emh203 | 0:3d9c67d97d6f | 4113 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4114 | { |
emh203 | 0:3d9c67d97d6f | 4115 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4116 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4117 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4118 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
emh203 | 0:3d9c67d97d6f | 4119 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
emh203 | 0:3d9c67d97d6f | 4120 | } arm_lms_instance_q15; |
emh203 | 0:3d9c67d97d6f | 4121 | |
emh203 | 0:3d9c67d97d6f | 4122 | |
emh203 | 0:3d9c67d97d6f | 4123 | /** |
emh203 | 0:3d9c67d97d6f | 4124 | * @brief Initialization function for the Q15 LMS filter. |
emh203 | 0:3d9c67d97d6f | 4125 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4126 | * @param[in] numTaps number of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4127 | * @param[in] *pCoeffs points to the coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 4128 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 4129 | * @param[in] mu step size that controls filter coefficient updates. |
emh203 | 0:3d9c67d97d6f | 4130 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4131 | * @param[in] postShift bit shift applied to coefficients. |
emh203 | 0:3d9c67d97d6f | 4132 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4133 | */ |
emh203 | 0:3d9c67d97d6f | 4134 | |
emh203 | 0:3d9c67d97d6f | 4135 | void arm_lms_init_q15( |
emh203 | 0:3d9c67d97d6f | 4136 | arm_lms_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4137 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4138 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4139 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 4140 | q15_t mu, |
emh203 | 0:3d9c67d97d6f | 4141 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 4142 | uint32_t postShift); |
emh203 | 0:3d9c67d97d6f | 4143 | |
emh203 | 0:3d9c67d97d6f | 4144 | /** |
emh203 | 0:3d9c67d97d6f | 4145 | * @brief Processing function for Q15 LMS filter. |
emh203 | 0:3d9c67d97d6f | 4146 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4147 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4148 | * @param[in] *pRef points to the block of reference data. |
emh203 | 0:3d9c67d97d6f | 4149 | * @param[out] *pOut points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4150 | * @param[out] *pErr points to the block of error data. |
emh203 | 0:3d9c67d97d6f | 4151 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4152 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4153 | */ |
emh203 | 0:3d9c67d97d6f | 4154 | |
emh203 | 0:3d9c67d97d6f | 4155 | void arm_lms_q15( |
emh203 | 0:3d9c67d97d6f | 4156 | const arm_lms_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4157 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4158 | q15_t * pRef, |
emh203 | 0:3d9c67d97d6f | 4159 | q15_t * pOut, |
emh203 | 0:3d9c67d97d6f | 4160 | q15_t * pErr, |
emh203 | 0:3d9c67d97d6f | 4161 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4162 | |
emh203 | 0:3d9c67d97d6f | 4163 | |
emh203 | 0:3d9c67d97d6f | 4164 | /** |
emh203 | 0:3d9c67d97d6f | 4165 | * @brief Instance structure for the Q31 LMS filter. |
emh203 | 0:3d9c67d97d6f | 4166 | */ |
emh203 | 0:3d9c67d97d6f | 4167 | |
emh203 | 0:3d9c67d97d6f | 4168 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4169 | { |
emh203 | 0:3d9c67d97d6f | 4170 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4171 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4172 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4173 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
emh203 | 0:3d9c67d97d6f | 4174 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
emh203 | 0:3d9c67d97d6f | 4175 | |
emh203 | 0:3d9c67d97d6f | 4176 | } arm_lms_instance_q31; |
emh203 | 0:3d9c67d97d6f | 4177 | |
emh203 | 0:3d9c67d97d6f | 4178 | /** |
emh203 | 0:3d9c67d97d6f | 4179 | * @brief Processing function for Q31 LMS filter. |
emh203 | 0:3d9c67d97d6f | 4180 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4181 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4182 | * @param[in] *pRef points to the block of reference data. |
emh203 | 0:3d9c67d97d6f | 4183 | * @param[out] *pOut points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4184 | * @param[out] *pErr points to the block of error data. |
emh203 | 0:3d9c67d97d6f | 4185 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4186 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4187 | */ |
emh203 | 0:3d9c67d97d6f | 4188 | |
emh203 | 0:3d9c67d97d6f | 4189 | void arm_lms_q31( |
emh203 | 0:3d9c67d97d6f | 4190 | const arm_lms_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4191 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4192 | q31_t * pRef, |
emh203 | 0:3d9c67d97d6f | 4193 | q31_t * pOut, |
emh203 | 0:3d9c67d97d6f | 4194 | q31_t * pErr, |
emh203 | 0:3d9c67d97d6f | 4195 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4196 | |
emh203 | 0:3d9c67d97d6f | 4197 | /** |
emh203 | 0:3d9c67d97d6f | 4198 | * @brief Initialization function for Q31 LMS filter. |
emh203 | 0:3d9c67d97d6f | 4199 | * @param[in] *S points to an instance of the Q31 LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4200 | * @param[in] numTaps number of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4201 | * @param[in] *pCoeffs points to coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 4202 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 4203 | * @param[in] mu step size that controls filter coefficient updates. |
emh203 | 0:3d9c67d97d6f | 4204 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4205 | * @param[in] postShift bit shift applied to coefficients. |
emh203 | 0:3d9c67d97d6f | 4206 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4207 | */ |
emh203 | 0:3d9c67d97d6f | 4208 | |
emh203 | 0:3d9c67d97d6f | 4209 | void arm_lms_init_q31( |
emh203 | 0:3d9c67d97d6f | 4210 | arm_lms_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4211 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4212 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4213 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 4214 | q31_t mu, |
emh203 | 0:3d9c67d97d6f | 4215 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 4216 | uint32_t postShift); |
emh203 | 0:3d9c67d97d6f | 4217 | |
emh203 | 0:3d9c67d97d6f | 4218 | /** |
emh203 | 0:3d9c67d97d6f | 4219 | * @brief Instance structure for the floating-point normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4220 | */ |
emh203 | 0:3d9c67d97d6f | 4221 | |
emh203 | 0:3d9c67d97d6f | 4222 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4223 | { |
emh203 | 0:3d9c67d97d6f | 4224 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4225 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4226 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4227 | float32_t mu; /**< step size that control filter coefficient updates. */ |
emh203 | 0:3d9c67d97d6f | 4228 | float32_t energy; /**< saves previous frame energy. */ |
emh203 | 0:3d9c67d97d6f | 4229 | float32_t x0; /**< saves previous input sample. */ |
emh203 | 0:3d9c67d97d6f | 4230 | } arm_lms_norm_instance_f32; |
emh203 | 0:3d9c67d97d6f | 4231 | |
emh203 | 0:3d9c67d97d6f | 4232 | /** |
emh203 | 0:3d9c67d97d6f | 4233 | * @brief Processing function for floating-point normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4234 | * @param[in] *S points to an instance of the floating-point normalized LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4235 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4236 | * @param[in] *pRef points to the block of reference data. |
emh203 | 0:3d9c67d97d6f | 4237 | * @param[out] *pOut points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4238 | * @param[out] *pErr points to the block of error data. |
emh203 | 0:3d9c67d97d6f | 4239 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4240 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4241 | */ |
emh203 | 0:3d9c67d97d6f | 4242 | |
emh203 | 0:3d9c67d97d6f | 4243 | void arm_lms_norm_f32( |
emh203 | 0:3d9c67d97d6f | 4244 | arm_lms_norm_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4245 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4246 | float32_t * pRef, |
emh203 | 0:3d9c67d97d6f | 4247 | float32_t * pOut, |
emh203 | 0:3d9c67d97d6f | 4248 | float32_t * pErr, |
emh203 | 0:3d9c67d97d6f | 4249 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4250 | |
emh203 | 0:3d9c67d97d6f | 4251 | /** |
emh203 | 0:3d9c67d97d6f | 4252 | * @brief Initialization function for floating-point normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4253 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4254 | * @param[in] numTaps number of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4255 | * @param[in] *pCoeffs points to coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 4256 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 4257 | * @param[in] mu step size that controls filter coefficient updates. |
emh203 | 0:3d9c67d97d6f | 4258 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4259 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4260 | */ |
emh203 | 0:3d9c67d97d6f | 4261 | |
emh203 | 0:3d9c67d97d6f | 4262 | void arm_lms_norm_init_f32( |
emh203 | 0:3d9c67d97d6f | 4263 | arm_lms_norm_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4264 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4265 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4266 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 4267 | float32_t mu, |
emh203 | 0:3d9c67d97d6f | 4268 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4269 | |
emh203 | 0:3d9c67d97d6f | 4270 | |
emh203 | 0:3d9c67d97d6f | 4271 | /** |
emh203 | 0:3d9c67d97d6f | 4272 | * @brief Instance structure for the Q31 normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4273 | */ |
emh203 | 0:3d9c67d97d6f | 4274 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4275 | { |
emh203 | 0:3d9c67d97d6f | 4276 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4277 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4278 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4279 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
emh203 | 0:3d9c67d97d6f | 4280 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
emh203 | 0:3d9c67d97d6f | 4281 | q31_t *recipTable; /**< points to the reciprocal initial value table. */ |
emh203 | 0:3d9c67d97d6f | 4282 | q31_t energy; /**< saves previous frame energy. */ |
emh203 | 0:3d9c67d97d6f | 4283 | q31_t x0; /**< saves previous input sample. */ |
emh203 | 0:3d9c67d97d6f | 4284 | } arm_lms_norm_instance_q31; |
emh203 | 0:3d9c67d97d6f | 4285 | |
emh203 | 0:3d9c67d97d6f | 4286 | /** |
emh203 | 0:3d9c67d97d6f | 4287 | * @brief Processing function for Q31 normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4288 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4289 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4290 | * @param[in] *pRef points to the block of reference data. |
emh203 | 0:3d9c67d97d6f | 4291 | * @param[out] *pOut points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4292 | * @param[out] *pErr points to the block of error data. |
emh203 | 0:3d9c67d97d6f | 4293 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4294 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4295 | */ |
emh203 | 0:3d9c67d97d6f | 4296 | |
emh203 | 0:3d9c67d97d6f | 4297 | void arm_lms_norm_q31( |
emh203 | 0:3d9c67d97d6f | 4298 | arm_lms_norm_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4299 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4300 | q31_t * pRef, |
emh203 | 0:3d9c67d97d6f | 4301 | q31_t * pOut, |
emh203 | 0:3d9c67d97d6f | 4302 | q31_t * pErr, |
emh203 | 0:3d9c67d97d6f | 4303 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4304 | |
emh203 | 0:3d9c67d97d6f | 4305 | /** |
emh203 | 0:3d9c67d97d6f | 4306 | * @brief Initialization function for Q31 normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4307 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4308 | * @param[in] numTaps number of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4309 | * @param[in] *pCoeffs points to coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 4310 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 4311 | * @param[in] mu step size that controls filter coefficient updates. |
emh203 | 0:3d9c67d97d6f | 4312 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4313 | * @param[in] postShift bit shift applied to coefficients. |
emh203 | 0:3d9c67d97d6f | 4314 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4315 | */ |
emh203 | 0:3d9c67d97d6f | 4316 | |
emh203 | 0:3d9c67d97d6f | 4317 | void arm_lms_norm_init_q31( |
emh203 | 0:3d9c67d97d6f | 4318 | arm_lms_norm_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4319 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4320 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4321 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 4322 | q31_t mu, |
emh203 | 0:3d9c67d97d6f | 4323 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 4324 | uint8_t postShift); |
emh203 | 0:3d9c67d97d6f | 4325 | |
emh203 | 0:3d9c67d97d6f | 4326 | /** |
emh203 | 0:3d9c67d97d6f | 4327 | * @brief Instance structure for the Q15 normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4328 | */ |
emh203 | 0:3d9c67d97d6f | 4329 | |
emh203 | 0:3d9c67d97d6f | 4330 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4331 | { |
emh203 | 0:3d9c67d97d6f | 4332 | uint16_t numTaps; /**< Number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4333 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4334 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4335 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
emh203 | 0:3d9c67d97d6f | 4336 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
emh203 | 0:3d9c67d97d6f | 4337 | q15_t *recipTable; /**< Points to the reciprocal initial value table. */ |
emh203 | 0:3d9c67d97d6f | 4338 | q15_t energy; /**< saves previous frame energy. */ |
emh203 | 0:3d9c67d97d6f | 4339 | q15_t x0; /**< saves previous input sample. */ |
emh203 | 0:3d9c67d97d6f | 4340 | } arm_lms_norm_instance_q15; |
emh203 | 0:3d9c67d97d6f | 4341 | |
emh203 | 0:3d9c67d97d6f | 4342 | /** |
emh203 | 0:3d9c67d97d6f | 4343 | * @brief Processing function for Q15 normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4344 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4345 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4346 | * @param[in] *pRef points to the block of reference data. |
emh203 | 0:3d9c67d97d6f | 4347 | * @param[out] *pOut points to the block of output data. |
emh203 | 0:3d9c67d97d6f | 4348 | * @param[out] *pErr points to the block of error data. |
emh203 | 0:3d9c67d97d6f | 4349 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4350 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4351 | */ |
emh203 | 0:3d9c67d97d6f | 4352 | |
emh203 | 0:3d9c67d97d6f | 4353 | void arm_lms_norm_q15( |
emh203 | 0:3d9c67d97d6f | 4354 | arm_lms_norm_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4355 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4356 | q15_t * pRef, |
emh203 | 0:3d9c67d97d6f | 4357 | q15_t * pOut, |
emh203 | 0:3d9c67d97d6f | 4358 | q15_t * pErr, |
emh203 | 0:3d9c67d97d6f | 4359 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4360 | |
emh203 | 0:3d9c67d97d6f | 4361 | |
emh203 | 0:3d9c67d97d6f | 4362 | /** |
emh203 | 0:3d9c67d97d6f | 4363 | * @brief Initialization function for Q15 normalized LMS filter. |
emh203 | 0:3d9c67d97d6f | 4364 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
emh203 | 0:3d9c67d97d6f | 4365 | * @param[in] numTaps number of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4366 | * @param[in] *pCoeffs points to coefficient buffer. |
emh203 | 0:3d9c67d97d6f | 4367 | * @param[in] *pState points to state buffer. |
emh203 | 0:3d9c67d97d6f | 4368 | * @param[in] mu step size that controls filter coefficient updates. |
emh203 | 0:3d9c67d97d6f | 4369 | * @param[in] blockSize number of samples to process. |
emh203 | 0:3d9c67d97d6f | 4370 | * @param[in] postShift bit shift applied to coefficients. |
emh203 | 0:3d9c67d97d6f | 4371 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4372 | */ |
emh203 | 0:3d9c67d97d6f | 4373 | |
emh203 | 0:3d9c67d97d6f | 4374 | void arm_lms_norm_init_q15( |
emh203 | 0:3d9c67d97d6f | 4375 | arm_lms_norm_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4376 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4377 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4378 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 4379 | q15_t mu, |
emh203 | 0:3d9c67d97d6f | 4380 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 4381 | uint8_t postShift); |
emh203 | 0:3d9c67d97d6f | 4382 | |
emh203 | 0:3d9c67d97d6f | 4383 | /** |
emh203 | 0:3d9c67d97d6f | 4384 | * @brief Correlation of floating-point sequences. |
emh203 | 0:3d9c67d97d6f | 4385 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4386 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4387 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4388 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4389 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4390 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4391 | */ |
emh203 | 0:3d9c67d97d6f | 4392 | |
emh203 | 0:3d9c67d97d6f | 4393 | void arm_correlate_f32( |
emh203 | 0:3d9c67d97d6f | 4394 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4395 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4396 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4397 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4398 | float32_t * pDst); |
emh203 | 0:3d9c67d97d6f | 4399 | |
emh203 | 0:3d9c67d97d6f | 4400 | |
emh203 | 0:3d9c67d97d6f | 4401 | /** |
emh203 | 0:3d9c67d97d6f | 4402 | * @brief Correlation of Q15 sequences |
emh203 | 0:3d9c67d97d6f | 4403 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4404 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4405 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4406 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4407 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4408 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 4409 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4410 | */ |
emh203 | 0:3d9c67d97d6f | 4411 | void arm_correlate_opt_q15( |
emh203 | 0:3d9c67d97d6f | 4412 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4413 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4414 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4415 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4416 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4417 | q15_t * pScratch); |
emh203 | 0:3d9c67d97d6f | 4418 | |
emh203 | 0:3d9c67d97d6f | 4419 | |
emh203 | 0:3d9c67d97d6f | 4420 | /** |
emh203 | 0:3d9c67d97d6f | 4421 | * @brief Correlation of Q15 sequences. |
emh203 | 0:3d9c67d97d6f | 4422 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4423 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4424 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4425 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4426 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4427 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4428 | */ |
emh203 | 0:3d9c67d97d6f | 4429 | |
emh203 | 0:3d9c67d97d6f | 4430 | void arm_correlate_q15( |
emh203 | 0:3d9c67d97d6f | 4431 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4432 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4433 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4434 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4435 | q15_t * pDst); |
emh203 | 0:3d9c67d97d6f | 4436 | |
emh203 | 0:3d9c67d97d6f | 4437 | /** |
emh203 | 0:3d9c67d97d6f | 4438 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 4439 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4440 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4441 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4442 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4443 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4444 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4445 | */ |
emh203 | 0:3d9c67d97d6f | 4446 | |
emh203 | 0:3d9c67d97d6f | 4447 | void arm_correlate_fast_q15( |
emh203 | 0:3d9c67d97d6f | 4448 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4449 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4450 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4451 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4452 | q15_t * pDst); |
emh203 | 0:3d9c67d97d6f | 4453 | |
emh203 | 0:3d9c67d97d6f | 4454 | |
emh203 | 0:3d9c67d97d6f | 4455 | |
emh203 | 0:3d9c67d97d6f | 4456 | /** |
emh203 | 0:3d9c67d97d6f | 4457 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
emh203 | 0:3d9c67d97d6f | 4458 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4459 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4460 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4461 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4462 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4463 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 4464 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4465 | */ |
emh203 | 0:3d9c67d97d6f | 4466 | |
emh203 | 0:3d9c67d97d6f | 4467 | void arm_correlate_fast_opt_q15( |
emh203 | 0:3d9c67d97d6f | 4468 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4469 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4470 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4471 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4472 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4473 | q15_t * pScratch); |
emh203 | 0:3d9c67d97d6f | 4474 | |
emh203 | 0:3d9c67d97d6f | 4475 | /** |
emh203 | 0:3d9c67d97d6f | 4476 | * @brief Correlation of Q31 sequences. |
emh203 | 0:3d9c67d97d6f | 4477 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4478 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4479 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4480 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4481 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4482 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4483 | */ |
emh203 | 0:3d9c67d97d6f | 4484 | |
emh203 | 0:3d9c67d97d6f | 4485 | void arm_correlate_q31( |
emh203 | 0:3d9c67d97d6f | 4486 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4487 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4488 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4489 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4490 | q31_t * pDst); |
emh203 | 0:3d9c67d97d6f | 4491 | |
emh203 | 0:3d9c67d97d6f | 4492 | /** |
emh203 | 0:3d9c67d97d6f | 4493 | * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emh203 | 0:3d9c67d97d6f | 4494 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4495 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4496 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4497 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4498 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4499 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4500 | */ |
emh203 | 0:3d9c67d97d6f | 4501 | |
emh203 | 0:3d9c67d97d6f | 4502 | void arm_correlate_fast_q31( |
emh203 | 0:3d9c67d97d6f | 4503 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4504 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4505 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4506 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4507 | q31_t * pDst); |
emh203 | 0:3d9c67d97d6f | 4508 | |
emh203 | 0:3d9c67d97d6f | 4509 | |
emh203 | 0:3d9c67d97d6f | 4510 | |
emh203 | 0:3d9c67d97d6f | 4511 | /** |
emh203 | 0:3d9c67d97d6f | 4512 | * @brief Correlation of Q7 sequences. |
emh203 | 0:3d9c67d97d6f | 4513 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4514 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4515 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4516 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4517 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4518 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emh203 | 0:3d9c67d97d6f | 4519 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
emh203 | 0:3d9c67d97d6f | 4520 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4521 | */ |
emh203 | 0:3d9c67d97d6f | 4522 | |
emh203 | 0:3d9c67d97d6f | 4523 | void arm_correlate_opt_q7( |
emh203 | 0:3d9c67d97d6f | 4524 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4525 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4526 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4527 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4528 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4529 | q15_t * pScratch1, |
emh203 | 0:3d9c67d97d6f | 4530 | q15_t * pScratch2); |
emh203 | 0:3d9c67d97d6f | 4531 | |
emh203 | 0:3d9c67d97d6f | 4532 | |
emh203 | 0:3d9c67d97d6f | 4533 | /** |
emh203 | 0:3d9c67d97d6f | 4534 | * @brief Correlation of Q7 sequences. |
emh203 | 0:3d9c67d97d6f | 4535 | * @param[in] *pSrcA points to the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4536 | * @param[in] srcALen length of the first input sequence. |
emh203 | 0:3d9c67d97d6f | 4537 | * @param[in] *pSrcB points to the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4538 | * @param[in] srcBLen length of the second input sequence. |
emh203 | 0:3d9c67d97d6f | 4539 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emh203 | 0:3d9c67d97d6f | 4540 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4541 | */ |
emh203 | 0:3d9c67d97d6f | 4542 | |
emh203 | 0:3d9c67d97d6f | 4543 | void arm_correlate_q7( |
emh203 | 0:3d9c67d97d6f | 4544 | q7_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 4545 | uint32_t srcALen, |
emh203 | 0:3d9c67d97d6f | 4546 | q7_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 4547 | uint32_t srcBLen, |
emh203 | 0:3d9c67d97d6f | 4548 | q7_t * pDst); |
emh203 | 0:3d9c67d97d6f | 4549 | |
emh203 | 0:3d9c67d97d6f | 4550 | |
emh203 | 0:3d9c67d97d6f | 4551 | /** |
emh203 | 0:3d9c67d97d6f | 4552 | * @brief Instance structure for the floating-point sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4553 | */ |
emh203 | 0:3d9c67d97d6f | 4554 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4555 | { |
emh203 | 0:3d9c67d97d6f | 4556 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4557 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emh203 | 0:3d9c67d97d6f | 4558 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4559 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 4560 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emh203 | 0:3d9c67d97d6f | 4561 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4562 | } arm_fir_sparse_instance_f32; |
emh203 | 0:3d9c67d97d6f | 4563 | |
emh203 | 0:3d9c67d97d6f | 4564 | /** |
emh203 | 0:3d9c67d97d6f | 4565 | * @brief Instance structure for the Q31 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4566 | */ |
emh203 | 0:3d9c67d97d6f | 4567 | |
emh203 | 0:3d9c67d97d6f | 4568 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4569 | { |
emh203 | 0:3d9c67d97d6f | 4570 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4571 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emh203 | 0:3d9c67d97d6f | 4572 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4573 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 4574 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emh203 | 0:3d9c67d97d6f | 4575 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4576 | } arm_fir_sparse_instance_q31; |
emh203 | 0:3d9c67d97d6f | 4577 | |
emh203 | 0:3d9c67d97d6f | 4578 | /** |
emh203 | 0:3d9c67d97d6f | 4579 | * @brief Instance structure for the Q15 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4580 | */ |
emh203 | 0:3d9c67d97d6f | 4581 | |
emh203 | 0:3d9c67d97d6f | 4582 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4583 | { |
emh203 | 0:3d9c67d97d6f | 4584 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4585 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emh203 | 0:3d9c67d97d6f | 4586 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4587 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 4588 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emh203 | 0:3d9c67d97d6f | 4589 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4590 | } arm_fir_sparse_instance_q15; |
emh203 | 0:3d9c67d97d6f | 4591 | |
emh203 | 0:3d9c67d97d6f | 4592 | /** |
emh203 | 0:3d9c67d97d6f | 4593 | * @brief Instance structure for the Q7 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4594 | */ |
emh203 | 0:3d9c67d97d6f | 4595 | |
emh203 | 0:3d9c67d97d6f | 4596 | typedef struct |
emh203 | 0:3d9c67d97d6f | 4597 | { |
emh203 | 0:3d9c67d97d6f | 4598 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emh203 | 0:3d9c67d97d6f | 4599 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emh203 | 0:3d9c67d97d6f | 4600 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emh203 | 0:3d9c67d97d6f | 4601 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emh203 | 0:3d9c67d97d6f | 4602 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emh203 | 0:3d9c67d97d6f | 4603 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emh203 | 0:3d9c67d97d6f | 4604 | } arm_fir_sparse_instance_q7; |
emh203 | 0:3d9c67d97d6f | 4605 | |
emh203 | 0:3d9c67d97d6f | 4606 | /** |
emh203 | 0:3d9c67d97d6f | 4607 | * @brief Processing function for the floating-point sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4608 | * @param[in] *S points to an instance of the floating-point sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4609 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4610 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 4611 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emh203 | 0:3d9c67d97d6f | 4612 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 4613 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4614 | */ |
emh203 | 0:3d9c67d97d6f | 4615 | |
emh203 | 0:3d9c67d97d6f | 4616 | void arm_fir_sparse_f32( |
emh203 | 0:3d9c67d97d6f | 4617 | arm_fir_sparse_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4618 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4619 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4620 | float32_t * pScratchIn, |
emh203 | 0:3d9c67d97d6f | 4621 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4622 | |
emh203 | 0:3d9c67d97d6f | 4623 | /** |
emh203 | 0:3d9c67d97d6f | 4624 | * @brief Initialization function for the floating-point sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4625 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4626 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 4627 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4628 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 4629 | * @param[in] *pTapDelay points to the array of offset times. |
emh203 | 0:3d9c67d97d6f | 4630 | * @param[in] maxDelay maximum offset time supported. |
emh203 | 0:3d9c67d97d6f | 4631 | * @param[in] blockSize number of samples that will be processed per block. |
emh203 | 0:3d9c67d97d6f | 4632 | * @return none |
emh203 | 0:3d9c67d97d6f | 4633 | */ |
emh203 | 0:3d9c67d97d6f | 4634 | |
emh203 | 0:3d9c67d97d6f | 4635 | void arm_fir_sparse_init_f32( |
emh203 | 0:3d9c67d97d6f | 4636 | arm_fir_sparse_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4637 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4638 | float32_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4639 | float32_t * pState, |
emh203 | 0:3d9c67d97d6f | 4640 | int32_t * pTapDelay, |
emh203 | 0:3d9c67d97d6f | 4641 | uint16_t maxDelay, |
emh203 | 0:3d9c67d97d6f | 4642 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4643 | |
emh203 | 0:3d9c67d97d6f | 4644 | /** |
emh203 | 0:3d9c67d97d6f | 4645 | * @brief Processing function for the Q31 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4646 | * @param[in] *S points to an instance of the Q31 sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4647 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4648 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 4649 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emh203 | 0:3d9c67d97d6f | 4650 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 4651 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4652 | */ |
emh203 | 0:3d9c67d97d6f | 4653 | |
emh203 | 0:3d9c67d97d6f | 4654 | void arm_fir_sparse_q31( |
emh203 | 0:3d9c67d97d6f | 4655 | arm_fir_sparse_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4656 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4657 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4658 | q31_t * pScratchIn, |
emh203 | 0:3d9c67d97d6f | 4659 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4660 | |
emh203 | 0:3d9c67d97d6f | 4661 | /** |
emh203 | 0:3d9c67d97d6f | 4662 | * @brief Initialization function for the Q31 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4663 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4664 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 4665 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4666 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 4667 | * @param[in] *pTapDelay points to the array of offset times. |
emh203 | 0:3d9c67d97d6f | 4668 | * @param[in] maxDelay maximum offset time supported. |
emh203 | 0:3d9c67d97d6f | 4669 | * @param[in] blockSize number of samples that will be processed per block. |
emh203 | 0:3d9c67d97d6f | 4670 | * @return none |
emh203 | 0:3d9c67d97d6f | 4671 | */ |
emh203 | 0:3d9c67d97d6f | 4672 | |
emh203 | 0:3d9c67d97d6f | 4673 | void arm_fir_sparse_init_q31( |
emh203 | 0:3d9c67d97d6f | 4674 | arm_fir_sparse_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4675 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4676 | q31_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4677 | q31_t * pState, |
emh203 | 0:3d9c67d97d6f | 4678 | int32_t * pTapDelay, |
emh203 | 0:3d9c67d97d6f | 4679 | uint16_t maxDelay, |
emh203 | 0:3d9c67d97d6f | 4680 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4681 | |
emh203 | 0:3d9c67d97d6f | 4682 | /** |
emh203 | 0:3d9c67d97d6f | 4683 | * @brief Processing function for the Q15 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4684 | * @param[in] *S points to an instance of the Q15 sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4685 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4686 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 4687 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emh203 | 0:3d9c67d97d6f | 4688 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
emh203 | 0:3d9c67d97d6f | 4689 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 4690 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4691 | */ |
emh203 | 0:3d9c67d97d6f | 4692 | |
emh203 | 0:3d9c67d97d6f | 4693 | void arm_fir_sparse_q15( |
emh203 | 0:3d9c67d97d6f | 4694 | arm_fir_sparse_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4695 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4696 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4697 | q15_t * pScratchIn, |
emh203 | 0:3d9c67d97d6f | 4698 | q31_t * pScratchOut, |
emh203 | 0:3d9c67d97d6f | 4699 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4700 | |
emh203 | 0:3d9c67d97d6f | 4701 | |
emh203 | 0:3d9c67d97d6f | 4702 | /** |
emh203 | 0:3d9c67d97d6f | 4703 | * @brief Initialization function for the Q15 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4704 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4705 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 4706 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4707 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 4708 | * @param[in] *pTapDelay points to the array of offset times. |
emh203 | 0:3d9c67d97d6f | 4709 | * @param[in] maxDelay maximum offset time supported. |
emh203 | 0:3d9c67d97d6f | 4710 | * @param[in] blockSize number of samples that will be processed per block. |
emh203 | 0:3d9c67d97d6f | 4711 | * @return none |
emh203 | 0:3d9c67d97d6f | 4712 | */ |
emh203 | 0:3d9c67d97d6f | 4713 | |
emh203 | 0:3d9c67d97d6f | 4714 | void arm_fir_sparse_init_q15( |
emh203 | 0:3d9c67d97d6f | 4715 | arm_fir_sparse_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 4716 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4717 | q15_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4718 | q15_t * pState, |
emh203 | 0:3d9c67d97d6f | 4719 | int32_t * pTapDelay, |
emh203 | 0:3d9c67d97d6f | 4720 | uint16_t maxDelay, |
emh203 | 0:3d9c67d97d6f | 4721 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4722 | |
emh203 | 0:3d9c67d97d6f | 4723 | /** |
emh203 | 0:3d9c67d97d6f | 4724 | * @brief Processing function for the Q7 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4725 | * @param[in] *S points to an instance of the Q7 sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4726 | * @param[in] *pSrc points to the block of input data. |
emh203 | 0:3d9c67d97d6f | 4727 | * @param[out] *pDst points to the block of output data |
emh203 | 0:3d9c67d97d6f | 4728 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emh203 | 0:3d9c67d97d6f | 4729 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
emh203 | 0:3d9c67d97d6f | 4730 | * @param[in] blockSize number of input samples to process per call. |
emh203 | 0:3d9c67d97d6f | 4731 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4732 | */ |
emh203 | 0:3d9c67d97d6f | 4733 | |
emh203 | 0:3d9c67d97d6f | 4734 | void arm_fir_sparse_q7( |
emh203 | 0:3d9c67d97d6f | 4735 | arm_fir_sparse_instance_q7 * S, |
emh203 | 0:3d9c67d97d6f | 4736 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4737 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4738 | q7_t * pScratchIn, |
emh203 | 0:3d9c67d97d6f | 4739 | q31_t * pScratchOut, |
emh203 | 0:3d9c67d97d6f | 4740 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4741 | |
emh203 | 0:3d9c67d97d6f | 4742 | /** |
emh203 | 0:3d9c67d97d6f | 4743 | * @brief Initialization function for the Q7 sparse FIR filter. |
emh203 | 0:3d9c67d97d6f | 4744 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. |
emh203 | 0:3d9c67d97d6f | 4745 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emh203 | 0:3d9c67d97d6f | 4746 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emh203 | 0:3d9c67d97d6f | 4747 | * @param[in] *pState points to the state buffer. |
emh203 | 0:3d9c67d97d6f | 4748 | * @param[in] *pTapDelay points to the array of offset times. |
emh203 | 0:3d9c67d97d6f | 4749 | * @param[in] maxDelay maximum offset time supported. |
emh203 | 0:3d9c67d97d6f | 4750 | * @param[in] blockSize number of samples that will be processed per block. |
emh203 | 0:3d9c67d97d6f | 4751 | * @return none |
emh203 | 0:3d9c67d97d6f | 4752 | */ |
emh203 | 0:3d9c67d97d6f | 4753 | |
emh203 | 0:3d9c67d97d6f | 4754 | void arm_fir_sparse_init_q7( |
emh203 | 0:3d9c67d97d6f | 4755 | arm_fir_sparse_instance_q7 * S, |
emh203 | 0:3d9c67d97d6f | 4756 | uint16_t numTaps, |
emh203 | 0:3d9c67d97d6f | 4757 | q7_t * pCoeffs, |
emh203 | 0:3d9c67d97d6f | 4758 | q7_t * pState, |
emh203 | 0:3d9c67d97d6f | 4759 | int32_t * pTapDelay, |
emh203 | 0:3d9c67d97d6f | 4760 | uint16_t maxDelay, |
emh203 | 0:3d9c67d97d6f | 4761 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 4762 | |
emh203 | 0:3d9c67d97d6f | 4763 | |
emh203 | 0:3d9c67d97d6f | 4764 | /* |
emh203 | 0:3d9c67d97d6f | 4765 | * @brief Floating-point sin_cos function. |
emh203 | 0:3d9c67d97d6f | 4766 | * @param[in] theta input value in degrees |
emh203 | 0:3d9c67d97d6f | 4767 | * @param[out] *pSinVal points to the processed sine output. |
emh203 | 0:3d9c67d97d6f | 4768 | * @param[out] *pCosVal points to the processed cos output. |
emh203 | 0:3d9c67d97d6f | 4769 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4770 | */ |
emh203 | 0:3d9c67d97d6f | 4771 | |
emh203 | 0:3d9c67d97d6f | 4772 | void arm_sin_cos_f32( |
emh203 | 0:3d9c67d97d6f | 4773 | float32_t theta, |
emh203 | 0:3d9c67d97d6f | 4774 | float32_t * pSinVal, |
emh203 | 0:3d9c67d97d6f | 4775 | float32_t * pCcosVal); |
emh203 | 0:3d9c67d97d6f | 4776 | |
emh203 | 0:3d9c67d97d6f | 4777 | /* |
emh203 | 0:3d9c67d97d6f | 4778 | * @brief Q31 sin_cos function. |
emh203 | 0:3d9c67d97d6f | 4779 | * @param[in] theta scaled input value in degrees |
emh203 | 0:3d9c67d97d6f | 4780 | * @param[out] *pSinVal points to the processed sine output. |
emh203 | 0:3d9c67d97d6f | 4781 | * @param[out] *pCosVal points to the processed cosine output. |
emh203 | 0:3d9c67d97d6f | 4782 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4783 | */ |
emh203 | 0:3d9c67d97d6f | 4784 | |
emh203 | 0:3d9c67d97d6f | 4785 | void arm_sin_cos_q31( |
emh203 | 0:3d9c67d97d6f | 4786 | q31_t theta, |
emh203 | 0:3d9c67d97d6f | 4787 | q31_t * pSinVal, |
emh203 | 0:3d9c67d97d6f | 4788 | q31_t * pCosVal); |
emh203 | 0:3d9c67d97d6f | 4789 | |
emh203 | 0:3d9c67d97d6f | 4790 | |
emh203 | 0:3d9c67d97d6f | 4791 | /** |
emh203 | 0:3d9c67d97d6f | 4792 | * @brief Floating-point complex conjugate. |
emh203 | 0:3d9c67d97d6f | 4793 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 4794 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 4795 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 4796 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4797 | */ |
emh203 | 0:3d9c67d97d6f | 4798 | |
emh203 | 0:3d9c67d97d6f | 4799 | void arm_cmplx_conj_f32( |
emh203 | 0:3d9c67d97d6f | 4800 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4801 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4802 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 4803 | |
emh203 | 0:3d9c67d97d6f | 4804 | /** |
emh203 | 0:3d9c67d97d6f | 4805 | * @brief Q31 complex conjugate. |
emh203 | 0:3d9c67d97d6f | 4806 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 4807 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 4808 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 4809 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4810 | */ |
emh203 | 0:3d9c67d97d6f | 4811 | |
emh203 | 0:3d9c67d97d6f | 4812 | void arm_cmplx_conj_q31( |
emh203 | 0:3d9c67d97d6f | 4813 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4814 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4815 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 4816 | |
emh203 | 0:3d9c67d97d6f | 4817 | /** |
emh203 | 0:3d9c67d97d6f | 4818 | * @brief Q15 complex conjugate. |
emh203 | 0:3d9c67d97d6f | 4819 | * @param[in] *pSrc points to the input vector |
emh203 | 0:3d9c67d97d6f | 4820 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 4821 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 4822 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4823 | */ |
emh203 | 0:3d9c67d97d6f | 4824 | |
emh203 | 0:3d9c67d97d6f | 4825 | void arm_cmplx_conj_q15( |
emh203 | 0:3d9c67d97d6f | 4826 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4827 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4828 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 4829 | |
emh203 | 0:3d9c67d97d6f | 4830 | |
emh203 | 0:3d9c67d97d6f | 4831 | |
emh203 | 0:3d9c67d97d6f | 4832 | /** |
emh203 | 0:3d9c67d97d6f | 4833 | * @brief Floating-point complex magnitude squared |
emh203 | 0:3d9c67d97d6f | 4834 | * @param[in] *pSrc points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 4835 | * @param[out] *pDst points to the real output vector |
emh203 | 0:3d9c67d97d6f | 4836 | * @param[in] numSamples number of complex samples in the input vector |
emh203 | 0:3d9c67d97d6f | 4837 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4838 | */ |
emh203 | 0:3d9c67d97d6f | 4839 | |
emh203 | 0:3d9c67d97d6f | 4840 | void arm_cmplx_mag_squared_f32( |
emh203 | 0:3d9c67d97d6f | 4841 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4842 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4843 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 4844 | |
emh203 | 0:3d9c67d97d6f | 4845 | /** |
emh203 | 0:3d9c67d97d6f | 4846 | * @brief Q31 complex magnitude squared |
emh203 | 0:3d9c67d97d6f | 4847 | * @param[in] *pSrc points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 4848 | * @param[out] *pDst points to the real output vector |
emh203 | 0:3d9c67d97d6f | 4849 | * @param[in] numSamples number of complex samples in the input vector |
emh203 | 0:3d9c67d97d6f | 4850 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4851 | */ |
emh203 | 0:3d9c67d97d6f | 4852 | |
emh203 | 0:3d9c67d97d6f | 4853 | void arm_cmplx_mag_squared_q31( |
emh203 | 0:3d9c67d97d6f | 4854 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4855 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4856 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 4857 | |
emh203 | 0:3d9c67d97d6f | 4858 | /** |
emh203 | 0:3d9c67d97d6f | 4859 | * @brief Q15 complex magnitude squared |
emh203 | 0:3d9c67d97d6f | 4860 | * @param[in] *pSrc points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 4861 | * @param[out] *pDst points to the real output vector |
emh203 | 0:3d9c67d97d6f | 4862 | * @param[in] numSamples number of complex samples in the input vector |
emh203 | 0:3d9c67d97d6f | 4863 | * @return none. |
emh203 | 0:3d9c67d97d6f | 4864 | */ |
emh203 | 0:3d9c67d97d6f | 4865 | |
emh203 | 0:3d9c67d97d6f | 4866 | void arm_cmplx_mag_squared_q15( |
emh203 | 0:3d9c67d97d6f | 4867 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 4868 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 4869 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 4870 | |
emh203 | 0:3d9c67d97d6f | 4871 | |
emh203 | 0:3d9c67d97d6f | 4872 | /** |
emh203 | 0:3d9c67d97d6f | 4873 | * @ingroup groupController |
emh203 | 0:3d9c67d97d6f | 4874 | */ |
emh203 | 0:3d9c67d97d6f | 4875 | |
emh203 | 0:3d9c67d97d6f | 4876 | /** |
emh203 | 0:3d9c67d97d6f | 4877 | * @defgroup PID PID Motor Control |
emh203 | 0:3d9c67d97d6f | 4878 | * |
emh203 | 0:3d9c67d97d6f | 4879 | * A Proportional Integral Derivative (PID) controller is a generic feedback control |
emh203 | 0:3d9c67d97d6f | 4880 | * loop mechanism widely used in industrial control systems. |
emh203 | 0:3d9c67d97d6f | 4881 | * A PID controller is the most commonly used type of feedback controller. |
emh203 | 0:3d9c67d97d6f | 4882 | * |
emh203 | 0:3d9c67d97d6f | 4883 | * This set of functions implements (PID) controllers |
emh203 | 0:3d9c67d97d6f | 4884 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample |
emh203 | 0:3d9c67d97d6f | 4885 | * of data and each call to the function returns a single processed value. |
emh203 | 0:3d9c67d97d6f | 4886 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code> |
emh203 | 0:3d9c67d97d6f | 4887 | * is the input sample value. The functions return the output value. |
emh203 | 0:3d9c67d97d6f | 4888 | * |
emh203 | 0:3d9c67d97d6f | 4889 | * \par Algorithm: |
emh203 | 0:3d9c67d97d6f | 4890 | * <pre> |
emh203 | 0:3d9c67d97d6f | 4891 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] |
emh203 | 0:3d9c67d97d6f | 4892 | * A0 = Kp + Ki + Kd |
emh203 | 0:3d9c67d97d6f | 4893 | * A1 = (-Kp ) - (2 * Kd ) |
emh203 | 0:3d9c67d97d6f | 4894 | * A2 = Kd </pre> |
emh203 | 0:3d9c67d97d6f | 4895 | * |
emh203 | 0:3d9c67d97d6f | 4896 | * \par |
emh203 | 0:3d9c67d97d6f | 4897 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant |
emh203 | 0:3d9c67d97d6f | 4898 | * |
emh203 | 0:3d9c67d97d6f | 4899 | * \par |
emh203 | 0:3d9c67d97d6f | 4900 | * \image html PID.gif "Proportional Integral Derivative Controller" |
emh203 | 0:3d9c67d97d6f | 4901 | * |
emh203 | 0:3d9c67d97d6f | 4902 | * \par |
emh203 | 0:3d9c67d97d6f | 4903 | * The PID controller calculates an "error" value as the difference between |
emh203 | 0:3d9c67d97d6f | 4904 | * the measured output and the reference input. |
emh203 | 0:3d9c67d97d6f | 4905 | * The controller attempts to minimize the error by adjusting the process control inputs. |
emh203 | 0:3d9c67d97d6f | 4906 | * The proportional value determines the reaction to the current error, |
emh203 | 0:3d9c67d97d6f | 4907 | * the integral value determines the reaction based on the sum of recent errors, |
emh203 | 0:3d9c67d97d6f | 4908 | * and the derivative value determines the reaction based on the rate at which the error has been changing. |
emh203 | 0:3d9c67d97d6f | 4909 | * |
emh203 | 0:3d9c67d97d6f | 4910 | * \par Instance Structure |
emh203 | 0:3d9c67d97d6f | 4911 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. |
emh203 | 0:3d9c67d97d6f | 4912 | * A separate instance structure must be defined for each PID Controller. |
emh203 | 0:3d9c67d97d6f | 4913 | * There are separate instance structure declarations for each of the 3 supported data types. |
emh203 | 0:3d9c67d97d6f | 4914 | * |
emh203 | 0:3d9c67d97d6f | 4915 | * \par Reset Functions |
emh203 | 0:3d9c67d97d6f | 4916 | * There is also an associated reset function for each data type which clears the state array. |
emh203 | 0:3d9c67d97d6f | 4917 | * |
emh203 | 0:3d9c67d97d6f | 4918 | * \par Initialization Functions |
emh203 | 0:3d9c67d97d6f | 4919 | * There is also an associated initialization function for each data type. |
emh203 | 0:3d9c67d97d6f | 4920 | * The initialization function performs the following operations: |
emh203 | 0:3d9c67d97d6f | 4921 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. |
emh203 | 0:3d9c67d97d6f | 4922 | * - Zeros out the values in the state buffer. |
emh203 | 0:3d9c67d97d6f | 4923 | * |
emh203 | 0:3d9c67d97d6f | 4924 | * \par |
emh203 | 0:3d9c67d97d6f | 4925 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. |
emh203 | 0:3d9c67d97d6f | 4926 | * |
emh203 | 0:3d9c67d97d6f | 4927 | * \par Fixed-Point Behavior |
emh203 | 0:3d9c67d97d6f | 4928 | * Care must be taken when using the fixed-point versions of the PID Controller functions. |
emh203 | 0:3d9c67d97d6f | 4929 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. |
emh203 | 0:3d9c67d97d6f | 4930 | * Refer to the function specific documentation below for usage guidelines. |
emh203 | 0:3d9c67d97d6f | 4931 | */ |
emh203 | 0:3d9c67d97d6f | 4932 | |
emh203 | 0:3d9c67d97d6f | 4933 | /** |
emh203 | 0:3d9c67d97d6f | 4934 | * @addtogroup PID |
emh203 | 0:3d9c67d97d6f | 4935 | * @{ |
emh203 | 0:3d9c67d97d6f | 4936 | */ |
emh203 | 0:3d9c67d97d6f | 4937 | |
emh203 | 0:3d9c67d97d6f | 4938 | /** |
emh203 | 0:3d9c67d97d6f | 4939 | * @brief Process function for the floating-point PID Control. |
emh203 | 0:3d9c67d97d6f | 4940 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
emh203 | 0:3d9c67d97d6f | 4941 | * @param[in] in input sample to process |
emh203 | 0:3d9c67d97d6f | 4942 | * @return out processed output sample. |
emh203 | 0:3d9c67d97d6f | 4943 | */ |
emh203 | 0:3d9c67d97d6f | 4944 | |
emh203 | 0:3d9c67d97d6f | 4945 | |
emh203 | 0:3d9c67d97d6f | 4946 | static __INLINE float32_t arm_pid_f32( |
emh203 | 0:3d9c67d97d6f | 4947 | arm_pid_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 4948 | float32_t in) |
emh203 | 0:3d9c67d97d6f | 4949 | { |
emh203 | 0:3d9c67d97d6f | 4950 | float32_t out; |
emh203 | 0:3d9c67d97d6f | 4951 | |
emh203 | 0:3d9c67d97d6f | 4952 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ |
emh203 | 0:3d9c67d97d6f | 4953 | out = (S->A0 * in) + |
emh203 | 0:3d9c67d97d6f | 4954 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); |
emh203 | 0:3d9c67d97d6f | 4955 | |
emh203 | 0:3d9c67d97d6f | 4956 | /* Update state */ |
emh203 | 0:3d9c67d97d6f | 4957 | S->state[1] = S->state[0]; |
emh203 | 0:3d9c67d97d6f | 4958 | S->state[0] = in; |
emh203 | 0:3d9c67d97d6f | 4959 | S->state[2] = out; |
emh203 | 0:3d9c67d97d6f | 4960 | |
emh203 | 0:3d9c67d97d6f | 4961 | /* return to application */ |
emh203 | 0:3d9c67d97d6f | 4962 | return (out); |
emh203 | 0:3d9c67d97d6f | 4963 | |
emh203 | 0:3d9c67d97d6f | 4964 | } |
emh203 | 0:3d9c67d97d6f | 4965 | |
emh203 | 0:3d9c67d97d6f | 4966 | /** |
emh203 | 0:3d9c67d97d6f | 4967 | * @brief Process function for the Q31 PID Control. |
emh203 | 0:3d9c67d97d6f | 4968 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
emh203 | 0:3d9c67d97d6f | 4969 | * @param[in] in input sample to process |
emh203 | 0:3d9c67d97d6f | 4970 | * @return out processed output sample. |
emh203 | 0:3d9c67d97d6f | 4971 | * |
emh203 | 0:3d9c67d97d6f | 4972 | * <b>Scaling and Overflow Behavior:</b> |
emh203 | 0:3d9c67d97d6f | 4973 | * \par |
emh203 | 0:3d9c67d97d6f | 4974 | * The function is implemented using an internal 64-bit accumulator. |
emh203 | 0:3d9c67d97d6f | 4975 | * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. |
emh203 | 0:3d9c67d97d6f | 4976 | * Thus, if the accumulator result overflows it wraps around rather than clip. |
emh203 | 0:3d9c67d97d6f | 4977 | * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. |
emh203 | 0:3d9c67d97d6f | 4978 | * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. |
emh203 | 0:3d9c67d97d6f | 4979 | */ |
emh203 | 0:3d9c67d97d6f | 4980 | |
emh203 | 0:3d9c67d97d6f | 4981 | static __INLINE q31_t arm_pid_q31( |
emh203 | 0:3d9c67d97d6f | 4982 | arm_pid_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 4983 | q31_t in) |
emh203 | 0:3d9c67d97d6f | 4984 | { |
emh203 | 0:3d9c67d97d6f | 4985 | q63_t acc; |
emh203 | 0:3d9c67d97d6f | 4986 | q31_t out; |
emh203 | 0:3d9c67d97d6f | 4987 | |
emh203 | 0:3d9c67d97d6f | 4988 | /* acc = A0 * x[n] */ |
emh203 | 0:3d9c67d97d6f | 4989 | acc = (q63_t) S->A0 * in; |
emh203 | 0:3d9c67d97d6f | 4990 | |
emh203 | 0:3d9c67d97d6f | 4991 | /* acc += A1 * x[n-1] */ |
emh203 | 0:3d9c67d97d6f | 4992 | acc += (q63_t) S->A1 * S->state[0]; |
emh203 | 0:3d9c67d97d6f | 4993 | |
emh203 | 0:3d9c67d97d6f | 4994 | /* acc += A2 * x[n-2] */ |
emh203 | 0:3d9c67d97d6f | 4995 | acc += (q63_t) S->A2 * S->state[1]; |
emh203 | 0:3d9c67d97d6f | 4996 | |
emh203 | 0:3d9c67d97d6f | 4997 | /* convert output to 1.31 format to add y[n-1] */ |
emh203 | 0:3d9c67d97d6f | 4998 | out = (q31_t) (acc >> 31u); |
emh203 | 0:3d9c67d97d6f | 4999 | |
emh203 | 0:3d9c67d97d6f | 5000 | /* out += y[n-1] */ |
emh203 | 0:3d9c67d97d6f | 5001 | out += S->state[2]; |
emh203 | 0:3d9c67d97d6f | 5002 | |
emh203 | 0:3d9c67d97d6f | 5003 | /* Update state */ |
emh203 | 0:3d9c67d97d6f | 5004 | S->state[1] = S->state[0]; |
emh203 | 0:3d9c67d97d6f | 5005 | S->state[0] = in; |
emh203 | 0:3d9c67d97d6f | 5006 | S->state[2] = out; |
emh203 | 0:3d9c67d97d6f | 5007 | |
emh203 | 0:3d9c67d97d6f | 5008 | /* return to application */ |
emh203 | 0:3d9c67d97d6f | 5009 | return (out); |
emh203 | 0:3d9c67d97d6f | 5010 | |
emh203 | 0:3d9c67d97d6f | 5011 | } |
emh203 | 0:3d9c67d97d6f | 5012 | |
emh203 | 0:3d9c67d97d6f | 5013 | /** |
emh203 | 0:3d9c67d97d6f | 5014 | * @brief Process function for the Q15 PID Control. |
emh203 | 0:3d9c67d97d6f | 5015 | * @param[in,out] *S points to an instance of the Q15 PID Control structure |
emh203 | 0:3d9c67d97d6f | 5016 | * @param[in] in input sample to process |
emh203 | 0:3d9c67d97d6f | 5017 | * @return out processed output sample. |
emh203 | 0:3d9c67d97d6f | 5018 | * |
emh203 | 0:3d9c67d97d6f | 5019 | * <b>Scaling and Overflow Behavior:</b> |
emh203 | 0:3d9c67d97d6f | 5020 | * \par |
emh203 | 0:3d9c67d97d6f | 5021 | * The function is implemented using a 64-bit internal accumulator. |
emh203 | 0:3d9c67d97d6f | 5022 | * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. |
emh203 | 0:3d9c67d97d6f | 5023 | * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. |
emh203 | 0:3d9c67d97d6f | 5024 | * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. |
emh203 | 0:3d9c67d97d6f | 5025 | * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. |
emh203 | 0:3d9c67d97d6f | 5026 | * Lastly, the accumulator is saturated to yield a result in 1.15 format. |
emh203 | 0:3d9c67d97d6f | 5027 | */ |
emh203 | 0:3d9c67d97d6f | 5028 | |
emh203 | 0:3d9c67d97d6f | 5029 | static __INLINE q15_t arm_pid_q15( |
emh203 | 0:3d9c67d97d6f | 5030 | arm_pid_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 5031 | q15_t in) |
emh203 | 0:3d9c67d97d6f | 5032 | { |
emh203 | 0:3d9c67d97d6f | 5033 | q63_t acc; |
emh203 | 0:3d9c67d97d6f | 5034 | q15_t out; |
emh203 | 0:3d9c67d97d6f | 5035 | |
emh203 | 0:3d9c67d97d6f | 5036 | #ifndef ARM_MATH_CM0_FAMILY |
emh203 | 0:3d9c67d97d6f | 5037 | __SIMD32_TYPE *vstate; |
emh203 | 0:3d9c67d97d6f | 5038 | |
emh203 | 0:3d9c67d97d6f | 5039 | /* Implementation of PID controller */ |
emh203 | 0:3d9c67d97d6f | 5040 | |
emh203 | 0:3d9c67d97d6f | 5041 | /* acc = A0 * x[n] */ |
emh203 | 0:3d9c67d97d6f | 5042 | acc = (q31_t) __SMUAD(S->A0, in); |
emh203 | 0:3d9c67d97d6f | 5043 | |
emh203 | 0:3d9c67d97d6f | 5044 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
emh203 | 0:3d9c67d97d6f | 5045 | vstate = __SIMD32_CONST(S->state); |
emh203 | 0:3d9c67d97d6f | 5046 | acc = __SMLALD(S->A1, (q31_t) *vstate, acc); |
emh203 | 0:3d9c67d97d6f | 5047 | |
emh203 | 0:3d9c67d97d6f | 5048 | #else |
emh203 | 0:3d9c67d97d6f | 5049 | /* acc = A0 * x[n] */ |
emh203 | 0:3d9c67d97d6f | 5050 | acc = ((q31_t) S->A0) * in; |
emh203 | 0:3d9c67d97d6f | 5051 | |
emh203 | 0:3d9c67d97d6f | 5052 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
emh203 | 0:3d9c67d97d6f | 5053 | acc += (q31_t) S->A1 * S->state[0]; |
emh203 | 0:3d9c67d97d6f | 5054 | acc += (q31_t) S->A2 * S->state[1]; |
emh203 | 0:3d9c67d97d6f | 5055 | |
emh203 | 0:3d9c67d97d6f | 5056 | #endif |
emh203 | 0:3d9c67d97d6f | 5057 | |
emh203 | 0:3d9c67d97d6f | 5058 | /* acc += y[n-1] */ |
emh203 | 0:3d9c67d97d6f | 5059 | acc += (q31_t) S->state[2] << 15; |
emh203 | 0:3d9c67d97d6f | 5060 | |
emh203 | 0:3d9c67d97d6f | 5061 | /* saturate the output */ |
emh203 | 0:3d9c67d97d6f | 5062 | out = (q15_t) (__SSAT((acc >> 15), 16)); |
emh203 | 0:3d9c67d97d6f | 5063 | |
emh203 | 0:3d9c67d97d6f | 5064 | /* Update state */ |
emh203 | 0:3d9c67d97d6f | 5065 | S->state[1] = S->state[0]; |
emh203 | 0:3d9c67d97d6f | 5066 | S->state[0] = in; |
emh203 | 0:3d9c67d97d6f | 5067 | S->state[2] = out; |
emh203 | 0:3d9c67d97d6f | 5068 | |
emh203 | 0:3d9c67d97d6f | 5069 | /* return to application */ |
emh203 | 0:3d9c67d97d6f | 5070 | return (out); |
emh203 | 0:3d9c67d97d6f | 5071 | |
emh203 | 0:3d9c67d97d6f | 5072 | } |
emh203 | 0:3d9c67d97d6f | 5073 | |
emh203 | 0:3d9c67d97d6f | 5074 | /** |
emh203 | 0:3d9c67d97d6f | 5075 | * @} end of PID group |
emh203 | 0:3d9c67d97d6f | 5076 | */ |
emh203 | 0:3d9c67d97d6f | 5077 | |
emh203 | 0:3d9c67d97d6f | 5078 | |
emh203 | 0:3d9c67d97d6f | 5079 | /** |
emh203 | 0:3d9c67d97d6f | 5080 | * @brief Floating-point matrix inverse. |
emh203 | 0:3d9c67d97d6f | 5081 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
emh203 | 0:3d9c67d97d6f | 5082 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
emh203 | 0:3d9c67d97d6f | 5083 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
emh203 | 0:3d9c67d97d6f | 5084 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
emh203 | 0:3d9c67d97d6f | 5085 | */ |
emh203 | 0:3d9c67d97d6f | 5086 | |
emh203 | 0:3d9c67d97d6f | 5087 | arm_status arm_mat_inverse_f32( |
emh203 | 0:3d9c67d97d6f | 5088 | const arm_matrix_instance_f32 * src, |
emh203 | 0:3d9c67d97d6f | 5089 | arm_matrix_instance_f32 * dst); |
emh203 | 0:3d9c67d97d6f | 5090 | |
emh203 | 0:3d9c67d97d6f | 5091 | |
emh203 | 0:3d9c67d97d6f | 5092 | |
emh203 | 0:3d9c67d97d6f | 5093 | /** |
emh203 | 0:3d9c67d97d6f | 5094 | * @ingroup groupController |
emh203 | 0:3d9c67d97d6f | 5095 | */ |
emh203 | 0:3d9c67d97d6f | 5096 | |
emh203 | 0:3d9c67d97d6f | 5097 | |
emh203 | 0:3d9c67d97d6f | 5098 | /** |
emh203 | 0:3d9c67d97d6f | 5099 | * @defgroup clarke Vector Clarke Transform |
emh203 | 0:3d9c67d97d6f | 5100 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. |
emh203 | 0:3d9c67d97d6f | 5101 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents |
emh203 | 0:3d9c67d97d6f | 5102 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>. |
emh203 | 0:3d9c67d97d6f | 5103 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below |
emh203 | 0:3d9c67d97d6f | 5104 | * \image html clarke.gif Stator current space vector and its components in (a,b). |
emh203 | 0:3d9c67d97d6f | 5105 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code> |
emh203 | 0:3d9c67d97d6f | 5106 | * can be calculated using only <code>Ia</code> and <code>Ib</code>. |
emh203 | 0:3d9c67d97d6f | 5107 | * |
emh203 | 0:3d9c67d97d6f | 5108 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emh203 | 0:3d9c67d97d6f | 5109 | * The library provides separate functions for Q31 and floating-point data types. |
emh203 | 0:3d9c67d97d6f | 5110 | * \par Algorithm |
emh203 | 0:3d9c67d97d6f | 5111 | * \image html clarkeFormula.gif |
emh203 | 0:3d9c67d97d6f | 5112 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and |
emh203 | 0:3d9c67d97d6f | 5113 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector. |
emh203 | 0:3d9c67d97d6f | 5114 | * \par Fixed-Point Behavior |
emh203 | 0:3d9c67d97d6f | 5115 | * Care must be taken when using the Q31 version of the Clarke transform. |
emh203 | 0:3d9c67d97d6f | 5116 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emh203 | 0:3d9c67d97d6f | 5117 | * Refer to the function specific documentation below for usage guidelines. |
emh203 | 0:3d9c67d97d6f | 5118 | */ |
emh203 | 0:3d9c67d97d6f | 5119 | |
emh203 | 0:3d9c67d97d6f | 5120 | /** |
emh203 | 0:3d9c67d97d6f | 5121 | * @addtogroup clarke |
emh203 | 0:3d9c67d97d6f | 5122 | * @{ |
emh203 | 0:3d9c67d97d6f | 5123 | */ |
emh203 | 0:3d9c67d97d6f | 5124 | |
emh203 | 0:3d9c67d97d6f | 5125 | /** |
emh203 | 0:3d9c67d97d6f | 5126 | * |
emh203 | 0:3d9c67d97d6f | 5127 | * @brief Floating-point Clarke transform |
emh203 | 0:3d9c67d97d6f | 5128 | * @param[in] Ia input three-phase coordinate <code>a</code> |
emh203 | 0:3d9c67d97d6f | 5129 | * @param[in] Ib input three-phase coordinate <code>b</code> |
emh203 | 0:3d9c67d97d6f | 5130 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emh203 | 0:3d9c67d97d6f | 5131 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emh203 | 0:3d9c67d97d6f | 5132 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5133 | */ |
emh203 | 0:3d9c67d97d6f | 5134 | |
emh203 | 0:3d9c67d97d6f | 5135 | static __INLINE void arm_clarke_f32( |
emh203 | 0:3d9c67d97d6f | 5136 | float32_t Ia, |
emh203 | 0:3d9c67d97d6f | 5137 | float32_t Ib, |
emh203 | 0:3d9c67d97d6f | 5138 | float32_t * pIalpha, |
emh203 | 0:3d9c67d97d6f | 5139 | float32_t * pIbeta) |
emh203 | 0:3d9c67d97d6f | 5140 | { |
emh203 | 0:3d9c67d97d6f | 5141 | /* Calculate pIalpha using the equation, pIalpha = Ia */ |
emh203 | 0:3d9c67d97d6f | 5142 | *pIalpha = Ia; |
emh203 | 0:3d9c67d97d6f | 5143 | |
emh203 | 0:3d9c67d97d6f | 5144 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ |
emh203 | 0:3d9c67d97d6f | 5145 | *pIbeta = |
emh203 | 0:3d9c67d97d6f | 5146 | ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); |
emh203 | 0:3d9c67d97d6f | 5147 | |
emh203 | 0:3d9c67d97d6f | 5148 | } |
emh203 | 0:3d9c67d97d6f | 5149 | |
emh203 | 0:3d9c67d97d6f | 5150 | /** |
emh203 | 0:3d9c67d97d6f | 5151 | * @brief Clarke transform for Q31 version |
emh203 | 0:3d9c67d97d6f | 5152 | * @param[in] Ia input three-phase coordinate <code>a</code> |
emh203 | 0:3d9c67d97d6f | 5153 | * @param[in] Ib input three-phase coordinate <code>b</code> |
emh203 | 0:3d9c67d97d6f | 5154 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emh203 | 0:3d9c67d97d6f | 5155 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emh203 | 0:3d9c67d97d6f | 5156 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5157 | * |
emh203 | 0:3d9c67d97d6f | 5158 | * <b>Scaling and Overflow Behavior:</b> |
emh203 | 0:3d9c67d97d6f | 5159 | * \par |
emh203 | 0:3d9c67d97d6f | 5160 | * The function is implemented using an internal 32-bit accumulator. |
emh203 | 0:3d9c67d97d6f | 5161 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emh203 | 0:3d9c67d97d6f | 5162 | * There is saturation on the addition, hence there is no risk of overflow. |
emh203 | 0:3d9c67d97d6f | 5163 | */ |
emh203 | 0:3d9c67d97d6f | 5164 | |
emh203 | 0:3d9c67d97d6f | 5165 | static __INLINE void arm_clarke_q31( |
emh203 | 0:3d9c67d97d6f | 5166 | q31_t Ia, |
emh203 | 0:3d9c67d97d6f | 5167 | q31_t Ib, |
emh203 | 0:3d9c67d97d6f | 5168 | q31_t * pIalpha, |
emh203 | 0:3d9c67d97d6f | 5169 | q31_t * pIbeta) |
emh203 | 0:3d9c67d97d6f | 5170 | { |
emh203 | 0:3d9c67d97d6f | 5171 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emh203 | 0:3d9c67d97d6f | 5172 | |
emh203 | 0:3d9c67d97d6f | 5173 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */ |
emh203 | 0:3d9c67d97d6f | 5174 | *pIalpha = Ia; |
emh203 | 0:3d9c67d97d6f | 5175 | |
emh203 | 0:3d9c67d97d6f | 5176 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ |
emh203 | 0:3d9c67d97d6f | 5177 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); |
emh203 | 0:3d9c67d97d6f | 5178 | |
emh203 | 0:3d9c67d97d6f | 5179 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ |
emh203 | 0:3d9c67d97d6f | 5180 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); |
emh203 | 0:3d9c67d97d6f | 5181 | |
emh203 | 0:3d9c67d97d6f | 5182 | /* pIbeta is calculated by adding the intermediate products */ |
emh203 | 0:3d9c67d97d6f | 5183 | *pIbeta = __QADD(product1, product2); |
emh203 | 0:3d9c67d97d6f | 5184 | } |
emh203 | 0:3d9c67d97d6f | 5185 | |
emh203 | 0:3d9c67d97d6f | 5186 | /** |
emh203 | 0:3d9c67d97d6f | 5187 | * @} end of clarke group |
emh203 | 0:3d9c67d97d6f | 5188 | */ |
emh203 | 0:3d9c67d97d6f | 5189 | |
emh203 | 0:3d9c67d97d6f | 5190 | /** |
emh203 | 0:3d9c67d97d6f | 5191 | * @brief Converts the elements of the Q7 vector to Q31 vector. |
emh203 | 0:3d9c67d97d6f | 5192 | * @param[in] *pSrc input pointer |
emh203 | 0:3d9c67d97d6f | 5193 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 5194 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 5195 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5196 | */ |
emh203 | 0:3d9c67d97d6f | 5197 | void arm_q7_to_q31( |
emh203 | 0:3d9c67d97d6f | 5198 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 5199 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 5200 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 5201 | |
emh203 | 0:3d9c67d97d6f | 5202 | |
emh203 | 0:3d9c67d97d6f | 5203 | |
emh203 | 0:3d9c67d97d6f | 5204 | |
emh203 | 0:3d9c67d97d6f | 5205 | /** |
emh203 | 0:3d9c67d97d6f | 5206 | * @ingroup groupController |
emh203 | 0:3d9c67d97d6f | 5207 | */ |
emh203 | 0:3d9c67d97d6f | 5208 | |
emh203 | 0:3d9c67d97d6f | 5209 | /** |
emh203 | 0:3d9c67d97d6f | 5210 | * @defgroup inv_clarke Vector Inverse Clarke Transform |
emh203 | 0:3d9c67d97d6f | 5211 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. |
emh203 | 0:3d9c67d97d6f | 5212 | * |
emh203 | 0:3d9c67d97d6f | 5213 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emh203 | 0:3d9c67d97d6f | 5214 | * The library provides separate functions for Q31 and floating-point data types. |
emh203 | 0:3d9c67d97d6f | 5215 | * \par Algorithm |
emh203 | 0:3d9c67d97d6f | 5216 | * \image html clarkeInvFormula.gif |
emh203 | 0:3d9c67d97d6f | 5217 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and |
emh203 | 0:3d9c67d97d6f | 5218 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector. |
emh203 | 0:3d9c67d97d6f | 5219 | * \par Fixed-Point Behavior |
emh203 | 0:3d9c67d97d6f | 5220 | * Care must be taken when using the Q31 version of the Clarke transform. |
emh203 | 0:3d9c67d97d6f | 5221 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emh203 | 0:3d9c67d97d6f | 5222 | * Refer to the function specific documentation below for usage guidelines. |
emh203 | 0:3d9c67d97d6f | 5223 | */ |
emh203 | 0:3d9c67d97d6f | 5224 | |
emh203 | 0:3d9c67d97d6f | 5225 | /** |
emh203 | 0:3d9c67d97d6f | 5226 | * @addtogroup inv_clarke |
emh203 | 0:3d9c67d97d6f | 5227 | * @{ |
emh203 | 0:3d9c67d97d6f | 5228 | */ |
emh203 | 0:3d9c67d97d6f | 5229 | |
emh203 | 0:3d9c67d97d6f | 5230 | /** |
emh203 | 0:3d9c67d97d6f | 5231 | * @brief Floating-point Inverse Clarke transform |
emh203 | 0:3d9c67d97d6f | 5232 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
emh203 | 0:3d9c67d97d6f | 5233 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
emh203 | 0:3d9c67d97d6f | 5234 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
emh203 | 0:3d9c67d97d6f | 5235 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
emh203 | 0:3d9c67d97d6f | 5236 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5237 | */ |
emh203 | 0:3d9c67d97d6f | 5238 | |
emh203 | 0:3d9c67d97d6f | 5239 | |
emh203 | 0:3d9c67d97d6f | 5240 | static __INLINE void arm_inv_clarke_f32( |
emh203 | 0:3d9c67d97d6f | 5241 | float32_t Ialpha, |
emh203 | 0:3d9c67d97d6f | 5242 | float32_t Ibeta, |
emh203 | 0:3d9c67d97d6f | 5243 | float32_t * pIa, |
emh203 | 0:3d9c67d97d6f | 5244 | float32_t * pIb) |
emh203 | 0:3d9c67d97d6f | 5245 | { |
emh203 | 0:3d9c67d97d6f | 5246 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
emh203 | 0:3d9c67d97d6f | 5247 | *pIa = Ialpha; |
emh203 | 0:3d9c67d97d6f | 5248 | |
emh203 | 0:3d9c67d97d6f | 5249 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ |
emh203 | 0:3d9c67d97d6f | 5250 | *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta; |
emh203 | 0:3d9c67d97d6f | 5251 | |
emh203 | 0:3d9c67d97d6f | 5252 | } |
emh203 | 0:3d9c67d97d6f | 5253 | |
emh203 | 0:3d9c67d97d6f | 5254 | /** |
emh203 | 0:3d9c67d97d6f | 5255 | * @brief Inverse Clarke transform for Q31 version |
emh203 | 0:3d9c67d97d6f | 5256 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
emh203 | 0:3d9c67d97d6f | 5257 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
emh203 | 0:3d9c67d97d6f | 5258 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
emh203 | 0:3d9c67d97d6f | 5259 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
emh203 | 0:3d9c67d97d6f | 5260 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5261 | * |
emh203 | 0:3d9c67d97d6f | 5262 | * <b>Scaling and Overflow Behavior:</b> |
emh203 | 0:3d9c67d97d6f | 5263 | * \par |
emh203 | 0:3d9c67d97d6f | 5264 | * The function is implemented using an internal 32-bit accumulator. |
emh203 | 0:3d9c67d97d6f | 5265 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emh203 | 0:3d9c67d97d6f | 5266 | * There is saturation on the subtraction, hence there is no risk of overflow. |
emh203 | 0:3d9c67d97d6f | 5267 | */ |
emh203 | 0:3d9c67d97d6f | 5268 | |
emh203 | 0:3d9c67d97d6f | 5269 | static __INLINE void arm_inv_clarke_q31( |
emh203 | 0:3d9c67d97d6f | 5270 | q31_t Ialpha, |
emh203 | 0:3d9c67d97d6f | 5271 | q31_t Ibeta, |
emh203 | 0:3d9c67d97d6f | 5272 | q31_t * pIa, |
emh203 | 0:3d9c67d97d6f | 5273 | q31_t * pIb) |
emh203 | 0:3d9c67d97d6f | 5274 | { |
emh203 | 0:3d9c67d97d6f | 5275 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emh203 | 0:3d9c67d97d6f | 5276 | |
emh203 | 0:3d9c67d97d6f | 5277 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
emh203 | 0:3d9c67d97d6f | 5278 | *pIa = Ialpha; |
emh203 | 0:3d9c67d97d6f | 5279 | |
emh203 | 0:3d9c67d97d6f | 5280 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ |
emh203 | 0:3d9c67d97d6f | 5281 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5282 | |
emh203 | 0:3d9c67d97d6f | 5283 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ |
emh203 | 0:3d9c67d97d6f | 5284 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5285 | |
emh203 | 0:3d9c67d97d6f | 5286 | /* pIb is calculated by subtracting the products */ |
emh203 | 0:3d9c67d97d6f | 5287 | *pIb = __QSUB(product2, product1); |
emh203 | 0:3d9c67d97d6f | 5288 | |
emh203 | 0:3d9c67d97d6f | 5289 | } |
emh203 | 0:3d9c67d97d6f | 5290 | |
emh203 | 0:3d9c67d97d6f | 5291 | /** |
emh203 | 0:3d9c67d97d6f | 5292 | * @} end of inv_clarke group |
emh203 | 0:3d9c67d97d6f | 5293 | */ |
emh203 | 0:3d9c67d97d6f | 5294 | |
emh203 | 0:3d9c67d97d6f | 5295 | /** |
emh203 | 0:3d9c67d97d6f | 5296 | * @brief Converts the elements of the Q7 vector to Q15 vector. |
emh203 | 0:3d9c67d97d6f | 5297 | * @param[in] *pSrc input pointer |
emh203 | 0:3d9c67d97d6f | 5298 | * @param[out] *pDst output pointer |
emh203 | 0:3d9c67d97d6f | 5299 | * @param[in] blockSize number of samples to process |
emh203 | 0:3d9c67d97d6f | 5300 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5301 | */ |
emh203 | 0:3d9c67d97d6f | 5302 | void arm_q7_to_q15( |
emh203 | 0:3d9c67d97d6f | 5303 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 5304 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 5305 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 5306 | |
emh203 | 0:3d9c67d97d6f | 5307 | |
emh203 | 0:3d9c67d97d6f | 5308 | |
emh203 | 0:3d9c67d97d6f | 5309 | /** |
emh203 | 0:3d9c67d97d6f | 5310 | * @ingroup groupController |
emh203 | 0:3d9c67d97d6f | 5311 | */ |
emh203 | 0:3d9c67d97d6f | 5312 | |
emh203 | 0:3d9c67d97d6f | 5313 | /** |
emh203 | 0:3d9c67d97d6f | 5314 | * @defgroup park Vector Park Transform |
emh203 | 0:3d9c67d97d6f | 5315 | * |
emh203 | 0:3d9c67d97d6f | 5316 | * Forward Park transform converts the input two-coordinate vector to flux and torque components. |
emh203 | 0:3d9c67d97d6f | 5317 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents |
emh203 | 0:3d9c67d97d6f | 5318 | * from the stationary to the moving reference frame and control the spatial relationship between |
emh203 | 0:3d9c67d97d6f | 5319 | * the stator vector current and rotor flux vector. |
emh203 | 0:3d9c67d97d6f | 5320 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the |
emh203 | 0:3d9c67d97d6f | 5321 | * current vector and the relationship from the two reference frames: |
emh203 | 0:3d9c67d97d6f | 5322 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" |
emh203 | 0:3d9c67d97d6f | 5323 | * |
emh203 | 0:3d9c67d97d6f | 5324 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emh203 | 0:3d9c67d97d6f | 5325 | * The library provides separate functions for Q31 and floating-point data types. |
emh203 | 0:3d9c67d97d6f | 5326 | * \par Algorithm |
emh203 | 0:3d9c67d97d6f | 5327 | * \image html parkFormula.gif |
emh203 | 0:3d9c67d97d6f | 5328 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components, |
emh203 | 0:3d9c67d97d6f | 5329 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
emh203 | 0:3d9c67d97d6f | 5330 | * cosine and sine values of theta (rotor flux position). |
emh203 | 0:3d9c67d97d6f | 5331 | * \par Fixed-Point Behavior |
emh203 | 0:3d9c67d97d6f | 5332 | * Care must be taken when using the Q31 version of the Park transform. |
emh203 | 0:3d9c67d97d6f | 5333 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emh203 | 0:3d9c67d97d6f | 5334 | * Refer to the function specific documentation below for usage guidelines. |
emh203 | 0:3d9c67d97d6f | 5335 | */ |
emh203 | 0:3d9c67d97d6f | 5336 | |
emh203 | 0:3d9c67d97d6f | 5337 | /** |
emh203 | 0:3d9c67d97d6f | 5338 | * @addtogroup park |
emh203 | 0:3d9c67d97d6f | 5339 | * @{ |
emh203 | 0:3d9c67d97d6f | 5340 | */ |
emh203 | 0:3d9c67d97d6f | 5341 | |
emh203 | 0:3d9c67d97d6f | 5342 | /** |
emh203 | 0:3d9c67d97d6f | 5343 | * @brief Floating-point Park transform |
emh203 | 0:3d9c67d97d6f | 5344 | * @param[in] Ialpha input two-phase vector coordinate alpha |
emh203 | 0:3d9c67d97d6f | 5345 | * @param[in] Ibeta input two-phase vector coordinate beta |
emh203 | 0:3d9c67d97d6f | 5346 | * @param[out] *pId points to output rotor reference frame d |
emh203 | 0:3d9c67d97d6f | 5347 | * @param[out] *pIq points to output rotor reference frame q |
emh203 | 0:3d9c67d97d6f | 5348 | * @param[in] sinVal sine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5349 | * @param[in] cosVal cosine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5350 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5351 | * |
emh203 | 0:3d9c67d97d6f | 5352 | * The function implements the forward Park transform. |
emh203 | 0:3d9c67d97d6f | 5353 | * |
emh203 | 0:3d9c67d97d6f | 5354 | */ |
emh203 | 0:3d9c67d97d6f | 5355 | |
emh203 | 0:3d9c67d97d6f | 5356 | static __INLINE void arm_park_f32( |
emh203 | 0:3d9c67d97d6f | 5357 | float32_t Ialpha, |
emh203 | 0:3d9c67d97d6f | 5358 | float32_t Ibeta, |
emh203 | 0:3d9c67d97d6f | 5359 | float32_t * pId, |
emh203 | 0:3d9c67d97d6f | 5360 | float32_t * pIq, |
emh203 | 0:3d9c67d97d6f | 5361 | float32_t sinVal, |
emh203 | 0:3d9c67d97d6f | 5362 | float32_t cosVal) |
emh203 | 0:3d9c67d97d6f | 5363 | { |
emh203 | 0:3d9c67d97d6f | 5364 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ |
emh203 | 0:3d9c67d97d6f | 5365 | *pId = Ialpha * cosVal + Ibeta * sinVal; |
emh203 | 0:3d9c67d97d6f | 5366 | |
emh203 | 0:3d9c67d97d6f | 5367 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ |
emh203 | 0:3d9c67d97d6f | 5368 | *pIq = -Ialpha * sinVal + Ibeta * cosVal; |
emh203 | 0:3d9c67d97d6f | 5369 | |
emh203 | 0:3d9c67d97d6f | 5370 | } |
emh203 | 0:3d9c67d97d6f | 5371 | |
emh203 | 0:3d9c67d97d6f | 5372 | /** |
emh203 | 0:3d9c67d97d6f | 5373 | * @brief Park transform for Q31 version |
emh203 | 0:3d9c67d97d6f | 5374 | * @param[in] Ialpha input two-phase vector coordinate alpha |
emh203 | 0:3d9c67d97d6f | 5375 | * @param[in] Ibeta input two-phase vector coordinate beta |
emh203 | 0:3d9c67d97d6f | 5376 | * @param[out] *pId points to output rotor reference frame d |
emh203 | 0:3d9c67d97d6f | 5377 | * @param[out] *pIq points to output rotor reference frame q |
emh203 | 0:3d9c67d97d6f | 5378 | * @param[in] sinVal sine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5379 | * @param[in] cosVal cosine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5380 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5381 | * |
emh203 | 0:3d9c67d97d6f | 5382 | * <b>Scaling and Overflow Behavior:</b> |
emh203 | 0:3d9c67d97d6f | 5383 | * \par |
emh203 | 0:3d9c67d97d6f | 5384 | * The function is implemented using an internal 32-bit accumulator. |
emh203 | 0:3d9c67d97d6f | 5385 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emh203 | 0:3d9c67d97d6f | 5386 | * There is saturation on the addition and subtraction, hence there is no risk of overflow. |
emh203 | 0:3d9c67d97d6f | 5387 | */ |
emh203 | 0:3d9c67d97d6f | 5388 | |
emh203 | 0:3d9c67d97d6f | 5389 | |
emh203 | 0:3d9c67d97d6f | 5390 | static __INLINE void arm_park_q31( |
emh203 | 0:3d9c67d97d6f | 5391 | q31_t Ialpha, |
emh203 | 0:3d9c67d97d6f | 5392 | q31_t Ibeta, |
emh203 | 0:3d9c67d97d6f | 5393 | q31_t * pId, |
emh203 | 0:3d9c67d97d6f | 5394 | q31_t * pIq, |
emh203 | 0:3d9c67d97d6f | 5395 | q31_t sinVal, |
emh203 | 0:3d9c67d97d6f | 5396 | q31_t cosVal) |
emh203 | 0:3d9c67d97d6f | 5397 | { |
emh203 | 0:3d9c67d97d6f | 5398 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emh203 | 0:3d9c67d97d6f | 5399 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
emh203 | 0:3d9c67d97d6f | 5400 | |
emh203 | 0:3d9c67d97d6f | 5401 | /* Intermediate product is calculated by (Ialpha * cosVal) */ |
emh203 | 0:3d9c67d97d6f | 5402 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5403 | |
emh203 | 0:3d9c67d97d6f | 5404 | /* Intermediate product is calculated by (Ibeta * sinVal) */ |
emh203 | 0:3d9c67d97d6f | 5405 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5406 | |
emh203 | 0:3d9c67d97d6f | 5407 | |
emh203 | 0:3d9c67d97d6f | 5408 | /* Intermediate product is calculated by (Ialpha * sinVal) */ |
emh203 | 0:3d9c67d97d6f | 5409 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5410 | |
emh203 | 0:3d9c67d97d6f | 5411 | /* Intermediate product is calculated by (Ibeta * cosVal) */ |
emh203 | 0:3d9c67d97d6f | 5412 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5413 | |
emh203 | 0:3d9c67d97d6f | 5414 | /* Calculate pId by adding the two intermediate products 1 and 2 */ |
emh203 | 0:3d9c67d97d6f | 5415 | *pId = __QADD(product1, product2); |
emh203 | 0:3d9c67d97d6f | 5416 | |
emh203 | 0:3d9c67d97d6f | 5417 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ |
emh203 | 0:3d9c67d97d6f | 5418 | *pIq = __QSUB(product4, product3); |
emh203 | 0:3d9c67d97d6f | 5419 | } |
emh203 | 0:3d9c67d97d6f | 5420 | |
emh203 | 0:3d9c67d97d6f | 5421 | /** |
emh203 | 0:3d9c67d97d6f | 5422 | * @} end of park group |
emh203 | 0:3d9c67d97d6f | 5423 | */ |
emh203 | 0:3d9c67d97d6f | 5424 | |
emh203 | 0:3d9c67d97d6f | 5425 | /** |
emh203 | 0:3d9c67d97d6f | 5426 | * @brief Converts the elements of the Q7 vector to floating-point vector. |
emh203 | 0:3d9c67d97d6f | 5427 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 5428 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 5429 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 5430 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5431 | */ |
emh203 | 0:3d9c67d97d6f | 5432 | void arm_q7_to_float( |
emh203 | 0:3d9c67d97d6f | 5433 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 5434 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 5435 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 5436 | |
emh203 | 0:3d9c67d97d6f | 5437 | |
emh203 | 0:3d9c67d97d6f | 5438 | /** |
emh203 | 0:3d9c67d97d6f | 5439 | * @ingroup groupController |
emh203 | 0:3d9c67d97d6f | 5440 | */ |
emh203 | 0:3d9c67d97d6f | 5441 | |
emh203 | 0:3d9c67d97d6f | 5442 | /** |
emh203 | 0:3d9c67d97d6f | 5443 | * @defgroup inv_park Vector Inverse Park transform |
emh203 | 0:3d9c67d97d6f | 5444 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector. |
emh203 | 0:3d9c67d97d6f | 5445 | * |
emh203 | 0:3d9c67d97d6f | 5446 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emh203 | 0:3d9c67d97d6f | 5447 | * The library provides separate functions for Q31 and floating-point data types. |
emh203 | 0:3d9c67d97d6f | 5448 | * \par Algorithm |
emh203 | 0:3d9c67d97d6f | 5449 | * \image html parkInvFormula.gif |
emh203 | 0:3d9c67d97d6f | 5450 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components, |
emh203 | 0:3d9c67d97d6f | 5451 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
emh203 | 0:3d9c67d97d6f | 5452 | * cosine and sine values of theta (rotor flux position). |
emh203 | 0:3d9c67d97d6f | 5453 | * \par Fixed-Point Behavior |
emh203 | 0:3d9c67d97d6f | 5454 | * Care must be taken when using the Q31 version of the Park transform. |
emh203 | 0:3d9c67d97d6f | 5455 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emh203 | 0:3d9c67d97d6f | 5456 | * Refer to the function specific documentation below for usage guidelines. |
emh203 | 0:3d9c67d97d6f | 5457 | */ |
emh203 | 0:3d9c67d97d6f | 5458 | |
emh203 | 0:3d9c67d97d6f | 5459 | /** |
emh203 | 0:3d9c67d97d6f | 5460 | * @addtogroup inv_park |
emh203 | 0:3d9c67d97d6f | 5461 | * @{ |
emh203 | 0:3d9c67d97d6f | 5462 | */ |
emh203 | 0:3d9c67d97d6f | 5463 | |
emh203 | 0:3d9c67d97d6f | 5464 | /** |
emh203 | 0:3d9c67d97d6f | 5465 | * @brief Floating-point Inverse Park transform |
emh203 | 0:3d9c67d97d6f | 5466 | * @param[in] Id input coordinate of rotor reference frame d |
emh203 | 0:3d9c67d97d6f | 5467 | * @param[in] Iq input coordinate of rotor reference frame q |
emh203 | 0:3d9c67d97d6f | 5468 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emh203 | 0:3d9c67d97d6f | 5469 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emh203 | 0:3d9c67d97d6f | 5470 | * @param[in] sinVal sine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5471 | * @param[in] cosVal cosine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5472 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5473 | */ |
emh203 | 0:3d9c67d97d6f | 5474 | |
emh203 | 0:3d9c67d97d6f | 5475 | static __INLINE void arm_inv_park_f32( |
emh203 | 0:3d9c67d97d6f | 5476 | float32_t Id, |
emh203 | 0:3d9c67d97d6f | 5477 | float32_t Iq, |
emh203 | 0:3d9c67d97d6f | 5478 | float32_t * pIalpha, |
emh203 | 0:3d9c67d97d6f | 5479 | float32_t * pIbeta, |
emh203 | 0:3d9c67d97d6f | 5480 | float32_t sinVal, |
emh203 | 0:3d9c67d97d6f | 5481 | float32_t cosVal) |
emh203 | 0:3d9c67d97d6f | 5482 | { |
emh203 | 0:3d9c67d97d6f | 5483 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ |
emh203 | 0:3d9c67d97d6f | 5484 | *pIalpha = Id * cosVal - Iq * sinVal; |
emh203 | 0:3d9c67d97d6f | 5485 | |
emh203 | 0:3d9c67d97d6f | 5486 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ |
emh203 | 0:3d9c67d97d6f | 5487 | *pIbeta = Id * sinVal + Iq * cosVal; |
emh203 | 0:3d9c67d97d6f | 5488 | |
emh203 | 0:3d9c67d97d6f | 5489 | } |
emh203 | 0:3d9c67d97d6f | 5490 | |
emh203 | 0:3d9c67d97d6f | 5491 | |
emh203 | 0:3d9c67d97d6f | 5492 | /** |
emh203 | 0:3d9c67d97d6f | 5493 | * @brief Inverse Park transform for Q31 version |
emh203 | 0:3d9c67d97d6f | 5494 | * @param[in] Id input coordinate of rotor reference frame d |
emh203 | 0:3d9c67d97d6f | 5495 | * @param[in] Iq input coordinate of rotor reference frame q |
emh203 | 0:3d9c67d97d6f | 5496 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emh203 | 0:3d9c67d97d6f | 5497 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emh203 | 0:3d9c67d97d6f | 5498 | * @param[in] sinVal sine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5499 | * @param[in] cosVal cosine value of rotation angle theta |
emh203 | 0:3d9c67d97d6f | 5500 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5501 | * |
emh203 | 0:3d9c67d97d6f | 5502 | * <b>Scaling and Overflow Behavior:</b> |
emh203 | 0:3d9c67d97d6f | 5503 | * \par |
emh203 | 0:3d9c67d97d6f | 5504 | * The function is implemented using an internal 32-bit accumulator. |
emh203 | 0:3d9c67d97d6f | 5505 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emh203 | 0:3d9c67d97d6f | 5506 | * There is saturation on the addition, hence there is no risk of overflow. |
emh203 | 0:3d9c67d97d6f | 5507 | */ |
emh203 | 0:3d9c67d97d6f | 5508 | |
emh203 | 0:3d9c67d97d6f | 5509 | |
emh203 | 0:3d9c67d97d6f | 5510 | static __INLINE void arm_inv_park_q31( |
emh203 | 0:3d9c67d97d6f | 5511 | q31_t Id, |
emh203 | 0:3d9c67d97d6f | 5512 | q31_t Iq, |
emh203 | 0:3d9c67d97d6f | 5513 | q31_t * pIalpha, |
emh203 | 0:3d9c67d97d6f | 5514 | q31_t * pIbeta, |
emh203 | 0:3d9c67d97d6f | 5515 | q31_t sinVal, |
emh203 | 0:3d9c67d97d6f | 5516 | q31_t cosVal) |
emh203 | 0:3d9c67d97d6f | 5517 | { |
emh203 | 0:3d9c67d97d6f | 5518 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emh203 | 0:3d9c67d97d6f | 5519 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
emh203 | 0:3d9c67d97d6f | 5520 | |
emh203 | 0:3d9c67d97d6f | 5521 | /* Intermediate product is calculated by (Id * cosVal) */ |
emh203 | 0:3d9c67d97d6f | 5522 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5523 | |
emh203 | 0:3d9c67d97d6f | 5524 | /* Intermediate product is calculated by (Iq * sinVal) */ |
emh203 | 0:3d9c67d97d6f | 5525 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5526 | |
emh203 | 0:3d9c67d97d6f | 5527 | |
emh203 | 0:3d9c67d97d6f | 5528 | /* Intermediate product is calculated by (Id * sinVal) */ |
emh203 | 0:3d9c67d97d6f | 5529 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5530 | |
emh203 | 0:3d9c67d97d6f | 5531 | /* Intermediate product is calculated by (Iq * cosVal) */ |
emh203 | 0:3d9c67d97d6f | 5532 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); |
emh203 | 0:3d9c67d97d6f | 5533 | |
emh203 | 0:3d9c67d97d6f | 5534 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */ |
emh203 | 0:3d9c67d97d6f | 5535 | *pIalpha = __QSUB(product1, product2); |
emh203 | 0:3d9c67d97d6f | 5536 | |
emh203 | 0:3d9c67d97d6f | 5537 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */ |
emh203 | 0:3d9c67d97d6f | 5538 | *pIbeta = __QADD(product4, product3); |
emh203 | 0:3d9c67d97d6f | 5539 | |
emh203 | 0:3d9c67d97d6f | 5540 | } |
emh203 | 0:3d9c67d97d6f | 5541 | |
emh203 | 0:3d9c67d97d6f | 5542 | /** |
emh203 | 0:3d9c67d97d6f | 5543 | * @} end of Inverse park group |
emh203 | 0:3d9c67d97d6f | 5544 | */ |
emh203 | 0:3d9c67d97d6f | 5545 | |
emh203 | 0:3d9c67d97d6f | 5546 | |
emh203 | 0:3d9c67d97d6f | 5547 | /** |
emh203 | 0:3d9c67d97d6f | 5548 | * @brief Converts the elements of the Q31 vector to floating-point vector. |
emh203 | 0:3d9c67d97d6f | 5549 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 5550 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 5551 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 5552 | * @return none. |
emh203 | 0:3d9c67d97d6f | 5553 | */ |
emh203 | 0:3d9c67d97d6f | 5554 | void arm_q31_to_float( |
emh203 | 0:3d9c67d97d6f | 5555 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 5556 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 5557 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 5558 | |
emh203 | 0:3d9c67d97d6f | 5559 | /** |
emh203 | 0:3d9c67d97d6f | 5560 | * @ingroup groupInterpolation |
emh203 | 0:3d9c67d97d6f | 5561 | */ |
emh203 | 0:3d9c67d97d6f | 5562 | |
emh203 | 0:3d9c67d97d6f | 5563 | /** |
emh203 | 0:3d9c67d97d6f | 5564 | * @defgroup LinearInterpolate Linear Interpolation |
emh203 | 0:3d9c67d97d6f | 5565 | * |
emh203 | 0:3d9c67d97d6f | 5566 | * Linear interpolation is a method of curve fitting using linear polynomials. |
emh203 | 0:3d9c67d97d6f | 5567 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line |
emh203 | 0:3d9c67d97d6f | 5568 | * |
emh203 | 0:3d9c67d97d6f | 5569 | * \par |
emh203 | 0:3d9c67d97d6f | 5570 | * \image html LinearInterp.gif "Linear interpolation" |
emh203 | 0:3d9c67d97d6f | 5571 | * |
emh203 | 0:3d9c67d97d6f | 5572 | * \par |
emh203 | 0:3d9c67d97d6f | 5573 | * A Linear Interpolate function calculates an output value(y), for the input(x) |
emh203 | 0:3d9c67d97d6f | 5574 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) |
emh203 | 0:3d9c67d97d6f | 5575 | * |
emh203 | 0:3d9c67d97d6f | 5576 | * \par Algorithm: |
emh203 | 0:3d9c67d97d6f | 5577 | * <pre> |
emh203 | 0:3d9c67d97d6f | 5578 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0)) |
emh203 | 0:3d9c67d97d6f | 5579 | * where x0, x1 are nearest values of input x |
emh203 | 0:3d9c67d97d6f | 5580 | * y0, y1 are nearest values to output y |
emh203 | 0:3d9c67d97d6f | 5581 | * </pre> |
emh203 | 0:3d9c67d97d6f | 5582 | * |
emh203 | 0:3d9c67d97d6f | 5583 | * \par |
emh203 | 0:3d9c67d97d6f | 5584 | * This set of functions implements Linear interpolation process |
emh203 | 0:3d9c67d97d6f | 5585 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single |
emh203 | 0:3d9c67d97d6f | 5586 | * sample of data and each call to the function returns a single processed value. |
emh203 | 0:3d9c67d97d6f | 5587 | * <code>S</code> points to an instance of the Linear Interpolate function data structure. |
emh203 | 0:3d9c67d97d6f | 5588 | * <code>x</code> is the input sample value. The functions returns the output value. |
emh203 | 0:3d9c67d97d6f | 5589 | * |
emh203 | 0:3d9c67d97d6f | 5590 | * \par |
emh203 | 0:3d9c67d97d6f | 5591 | * if x is outside of the table boundary, Linear interpolation returns first value of the table |
emh203 | 0:3d9c67d97d6f | 5592 | * if x is below input range and returns last value of table if x is above range. |
emh203 | 0:3d9c67d97d6f | 5593 | */ |
emh203 | 0:3d9c67d97d6f | 5594 | |
emh203 | 0:3d9c67d97d6f | 5595 | /** |
emh203 | 0:3d9c67d97d6f | 5596 | * @addtogroup LinearInterpolate |
emh203 | 0:3d9c67d97d6f | 5597 | * @{ |
emh203 | 0:3d9c67d97d6f | 5598 | */ |
emh203 | 0:3d9c67d97d6f | 5599 | |
emh203 | 0:3d9c67d97d6f | 5600 | /** |
emh203 | 0:3d9c67d97d6f | 5601 | * @brief Process function for the floating-point Linear Interpolation Function. |
emh203 | 0:3d9c67d97d6f | 5602 | * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure |
emh203 | 0:3d9c67d97d6f | 5603 | * @param[in] x input sample to process |
emh203 | 0:3d9c67d97d6f | 5604 | * @return y processed output sample. |
emh203 | 0:3d9c67d97d6f | 5605 | * |
emh203 | 0:3d9c67d97d6f | 5606 | */ |
emh203 | 0:3d9c67d97d6f | 5607 | |
emh203 | 0:3d9c67d97d6f | 5608 | static __INLINE float32_t arm_linear_interp_f32( |
emh203 | 0:3d9c67d97d6f | 5609 | arm_linear_interp_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 5610 | float32_t x) |
emh203 | 0:3d9c67d97d6f | 5611 | { |
emh203 | 0:3d9c67d97d6f | 5612 | |
emh203 | 0:3d9c67d97d6f | 5613 | float32_t y; |
emh203 | 0:3d9c67d97d6f | 5614 | float32_t x0, x1; /* Nearest input values */ |
emh203 | 0:3d9c67d97d6f | 5615 | float32_t y0, y1; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5616 | float32_t xSpacing = S->xSpacing; /* spacing between input values */ |
emh203 | 0:3d9c67d97d6f | 5617 | int32_t i; /* Index variable */ |
emh203 | 0:3d9c67d97d6f | 5618 | float32_t *pYData = S->pYData; /* pointer to output table */ |
emh203 | 0:3d9c67d97d6f | 5619 | |
emh203 | 0:3d9c67d97d6f | 5620 | /* Calculation of index */ |
emh203 | 0:3d9c67d97d6f | 5621 | i = (int32_t) ((x - S->x1) / xSpacing); |
emh203 | 0:3d9c67d97d6f | 5622 | |
emh203 | 0:3d9c67d97d6f | 5623 | if(i < 0) |
emh203 | 0:3d9c67d97d6f | 5624 | { |
emh203 | 0:3d9c67d97d6f | 5625 | /* Iniatilize output for below specified range as least output value of table */ |
emh203 | 0:3d9c67d97d6f | 5626 | y = pYData[0]; |
emh203 | 0:3d9c67d97d6f | 5627 | } |
emh203 | 0:3d9c67d97d6f | 5628 | else if((uint32_t)i >= S->nValues) |
emh203 | 0:3d9c67d97d6f | 5629 | { |
emh203 | 0:3d9c67d97d6f | 5630 | /* Iniatilize output for above specified range as last output value of table */ |
emh203 | 0:3d9c67d97d6f | 5631 | y = pYData[S->nValues - 1]; |
emh203 | 0:3d9c67d97d6f | 5632 | } |
emh203 | 0:3d9c67d97d6f | 5633 | else |
emh203 | 0:3d9c67d97d6f | 5634 | { |
emh203 | 0:3d9c67d97d6f | 5635 | /* Calculation of nearest input values */ |
emh203 | 0:3d9c67d97d6f | 5636 | x0 = S->x1 + i * xSpacing; |
emh203 | 0:3d9c67d97d6f | 5637 | x1 = S->x1 + (i + 1) * xSpacing; |
emh203 | 0:3d9c67d97d6f | 5638 | |
emh203 | 0:3d9c67d97d6f | 5639 | /* Read of nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5640 | y0 = pYData[i]; |
emh203 | 0:3d9c67d97d6f | 5641 | y1 = pYData[i + 1]; |
emh203 | 0:3d9c67d97d6f | 5642 | |
emh203 | 0:3d9c67d97d6f | 5643 | /* Calculation of output */ |
emh203 | 0:3d9c67d97d6f | 5644 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); |
emh203 | 0:3d9c67d97d6f | 5645 | |
emh203 | 0:3d9c67d97d6f | 5646 | } |
emh203 | 0:3d9c67d97d6f | 5647 | |
emh203 | 0:3d9c67d97d6f | 5648 | /* returns output value */ |
emh203 | 0:3d9c67d97d6f | 5649 | return (y); |
emh203 | 0:3d9c67d97d6f | 5650 | } |
emh203 | 0:3d9c67d97d6f | 5651 | |
emh203 | 0:3d9c67d97d6f | 5652 | /** |
emh203 | 0:3d9c67d97d6f | 5653 | * |
emh203 | 0:3d9c67d97d6f | 5654 | * @brief Process function for the Q31 Linear Interpolation Function. |
emh203 | 0:3d9c67d97d6f | 5655 | * @param[in] *pYData pointer to Q31 Linear Interpolation table |
emh203 | 0:3d9c67d97d6f | 5656 | * @param[in] x input sample to process |
emh203 | 0:3d9c67d97d6f | 5657 | * @param[in] nValues number of table values |
emh203 | 0:3d9c67d97d6f | 5658 | * @return y processed output sample. |
emh203 | 0:3d9c67d97d6f | 5659 | * |
emh203 | 0:3d9c67d97d6f | 5660 | * \par |
emh203 | 0:3d9c67d97d6f | 5661 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
emh203 | 0:3d9c67d97d6f | 5662 | * This function can support maximum of table size 2^12. |
emh203 | 0:3d9c67d97d6f | 5663 | * |
emh203 | 0:3d9c67d97d6f | 5664 | */ |
emh203 | 0:3d9c67d97d6f | 5665 | |
emh203 | 0:3d9c67d97d6f | 5666 | |
emh203 | 0:3d9c67d97d6f | 5667 | static __INLINE q31_t arm_linear_interp_q31( |
emh203 | 0:3d9c67d97d6f | 5668 | q31_t * pYData, |
emh203 | 0:3d9c67d97d6f | 5669 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 5670 | uint32_t nValues) |
emh203 | 0:3d9c67d97d6f | 5671 | { |
emh203 | 0:3d9c67d97d6f | 5672 | q31_t y; /* output */ |
emh203 | 0:3d9c67d97d6f | 5673 | q31_t y0, y1; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5674 | q31_t fract; /* fractional part */ |
emh203 | 0:3d9c67d97d6f | 5675 | int32_t index; /* Index to read nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5676 | |
emh203 | 0:3d9c67d97d6f | 5677 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 5678 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 5679 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 5680 | index = ((x & 0xFFF00000) >> 20); |
emh203 | 0:3d9c67d97d6f | 5681 | |
emh203 | 0:3d9c67d97d6f | 5682 | if(index >= (int32_t)(nValues - 1)) |
emh203 | 0:3d9c67d97d6f | 5683 | { |
emh203 | 0:3d9c67d97d6f | 5684 | return (pYData[nValues - 1]); |
emh203 | 0:3d9c67d97d6f | 5685 | } |
emh203 | 0:3d9c67d97d6f | 5686 | else if(index < 0) |
emh203 | 0:3d9c67d97d6f | 5687 | { |
emh203 | 0:3d9c67d97d6f | 5688 | return (pYData[0]); |
emh203 | 0:3d9c67d97d6f | 5689 | } |
emh203 | 0:3d9c67d97d6f | 5690 | else |
emh203 | 0:3d9c67d97d6f | 5691 | { |
emh203 | 0:3d9c67d97d6f | 5692 | |
emh203 | 0:3d9c67d97d6f | 5693 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 5694 | /* shift left by 11 to keep fract in 1.31 format */ |
emh203 | 0:3d9c67d97d6f | 5695 | fract = (x & 0x000FFFFF) << 11; |
emh203 | 0:3d9c67d97d6f | 5696 | |
emh203 | 0:3d9c67d97d6f | 5697 | /* Read two nearest output values from the index in 1.31(q31) format */ |
emh203 | 0:3d9c67d97d6f | 5698 | y0 = pYData[index]; |
emh203 | 0:3d9c67d97d6f | 5699 | y1 = pYData[index + 1u]; |
emh203 | 0:3d9c67d97d6f | 5700 | |
emh203 | 0:3d9c67d97d6f | 5701 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */ |
emh203 | 0:3d9c67d97d6f | 5702 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 5703 | |
emh203 | 0:3d9c67d97d6f | 5704 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ |
emh203 | 0:3d9c67d97d6f | 5705 | y += ((q31_t) (((q63_t) y1 * fract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 5706 | |
emh203 | 0:3d9c67d97d6f | 5707 | /* Convert y to 1.31 format */ |
emh203 | 0:3d9c67d97d6f | 5708 | return (y << 1u); |
emh203 | 0:3d9c67d97d6f | 5709 | |
emh203 | 0:3d9c67d97d6f | 5710 | } |
emh203 | 0:3d9c67d97d6f | 5711 | |
emh203 | 0:3d9c67d97d6f | 5712 | } |
emh203 | 0:3d9c67d97d6f | 5713 | |
emh203 | 0:3d9c67d97d6f | 5714 | /** |
emh203 | 0:3d9c67d97d6f | 5715 | * |
emh203 | 0:3d9c67d97d6f | 5716 | * @brief Process function for the Q15 Linear Interpolation Function. |
emh203 | 0:3d9c67d97d6f | 5717 | * @param[in] *pYData pointer to Q15 Linear Interpolation table |
emh203 | 0:3d9c67d97d6f | 5718 | * @param[in] x input sample to process |
emh203 | 0:3d9c67d97d6f | 5719 | * @param[in] nValues number of table values |
emh203 | 0:3d9c67d97d6f | 5720 | * @return y processed output sample. |
emh203 | 0:3d9c67d97d6f | 5721 | * |
emh203 | 0:3d9c67d97d6f | 5722 | * \par |
emh203 | 0:3d9c67d97d6f | 5723 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
emh203 | 0:3d9c67d97d6f | 5724 | * This function can support maximum of table size 2^12. |
emh203 | 0:3d9c67d97d6f | 5725 | * |
emh203 | 0:3d9c67d97d6f | 5726 | */ |
emh203 | 0:3d9c67d97d6f | 5727 | |
emh203 | 0:3d9c67d97d6f | 5728 | |
emh203 | 0:3d9c67d97d6f | 5729 | static __INLINE q15_t arm_linear_interp_q15( |
emh203 | 0:3d9c67d97d6f | 5730 | q15_t * pYData, |
emh203 | 0:3d9c67d97d6f | 5731 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 5732 | uint32_t nValues) |
emh203 | 0:3d9c67d97d6f | 5733 | { |
emh203 | 0:3d9c67d97d6f | 5734 | q63_t y; /* output */ |
emh203 | 0:3d9c67d97d6f | 5735 | q15_t y0, y1; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5736 | q31_t fract; /* fractional part */ |
emh203 | 0:3d9c67d97d6f | 5737 | int32_t index; /* Index to read nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5738 | |
emh203 | 0:3d9c67d97d6f | 5739 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 5740 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 5741 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 5742 | index = ((x & 0xFFF00000) >> 20u); |
emh203 | 0:3d9c67d97d6f | 5743 | |
emh203 | 0:3d9c67d97d6f | 5744 | if(index >= (int32_t)(nValues - 1)) |
emh203 | 0:3d9c67d97d6f | 5745 | { |
emh203 | 0:3d9c67d97d6f | 5746 | return (pYData[nValues - 1]); |
emh203 | 0:3d9c67d97d6f | 5747 | } |
emh203 | 0:3d9c67d97d6f | 5748 | else if(index < 0) |
emh203 | 0:3d9c67d97d6f | 5749 | { |
emh203 | 0:3d9c67d97d6f | 5750 | return (pYData[0]); |
emh203 | 0:3d9c67d97d6f | 5751 | } |
emh203 | 0:3d9c67d97d6f | 5752 | else |
emh203 | 0:3d9c67d97d6f | 5753 | { |
emh203 | 0:3d9c67d97d6f | 5754 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 5755 | /* fract is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 5756 | fract = (x & 0x000FFFFF); |
emh203 | 0:3d9c67d97d6f | 5757 | |
emh203 | 0:3d9c67d97d6f | 5758 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 5759 | y0 = pYData[index]; |
emh203 | 0:3d9c67d97d6f | 5760 | y1 = pYData[index + 1u]; |
emh203 | 0:3d9c67d97d6f | 5761 | |
emh203 | 0:3d9c67d97d6f | 5762 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */ |
emh203 | 0:3d9c67d97d6f | 5763 | y = ((q63_t) y0 * (0xFFFFF - fract)); |
emh203 | 0:3d9c67d97d6f | 5764 | |
emh203 | 0:3d9c67d97d6f | 5765 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ |
emh203 | 0:3d9c67d97d6f | 5766 | y += ((q63_t) y1 * (fract)); |
emh203 | 0:3d9c67d97d6f | 5767 | |
emh203 | 0:3d9c67d97d6f | 5768 | /* convert y to 1.15 format */ |
emh203 | 0:3d9c67d97d6f | 5769 | return (y >> 20); |
emh203 | 0:3d9c67d97d6f | 5770 | } |
emh203 | 0:3d9c67d97d6f | 5771 | |
emh203 | 0:3d9c67d97d6f | 5772 | |
emh203 | 0:3d9c67d97d6f | 5773 | } |
emh203 | 0:3d9c67d97d6f | 5774 | |
emh203 | 0:3d9c67d97d6f | 5775 | /** |
emh203 | 0:3d9c67d97d6f | 5776 | * |
emh203 | 0:3d9c67d97d6f | 5777 | * @brief Process function for the Q7 Linear Interpolation Function. |
emh203 | 0:3d9c67d97d6f | 5778 | * @param[in] *pYData pointer to Q7 Linear Interpolation table |
emh203 | 0:3d9c67d97d6f | 5779 | * @param[in] x input sample to process |
emh203 | 0:3d9c67d97d6f | 5780 | * @param[in] nValues number of table values |
emh203 | 0:3d9c67d97d6f | 5781 | * @return y processed output sample. |
emh203 | 0:3d9c67d97d6f | 5782 | * |
emh203 | 0:3d9c67d97d6f | 5783 | * \par |
emh203 | 0:3d9c67d97d6f | 5784 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
emh203 | 0:3d9c67d97d6f | 5785 | * This function can support maximum of table size 2^12. |
emh203 | 0:3d9c67d97d6f | 5786 | */ |
emh203 | 0:3d9c67d97d6f | 5787 | |
emh203 | 0:3d9c67d97d6f | 5788 | |
emh203 | 0:3d9c67d97d6f | 5789 | static __INLINE q7_t arm_linear_interp_q7( |
emh203 | 0:3d9c67d97d6f | 5790 | q7_t * pYData, |
emh203 | 0:3d9c67d97d6f | 5791 | q31_t x, |
emh203 | 0:3d9c67d97d6f | 5792 | uint32_t nValues) |
emh203 | 0:3d9c67d97d6f | 5793 | { |
emh203 | 0:3d9c67d97d6f | 5794 | q31_t y; /* output */ |
emh203 | 0:3d9c67d97d6f | 5795 | q7_t y0, y1; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5796 | q31_t fract; /* fractional part */ |
emh203 | 0:3d9c67d97d6f | 5797 | uint32_t index; /* Index to read nearest output values */ |
emh203 | 0:3d9c67d97d6f | 5798 | |
emh203 | 0:3d9c67d97d6f | 5799 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 5800 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 5801 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 5802 | if (x < 0) |
emh203 | 0:3d9c67d97d6f | 5803 | { |
emh203 | 0:3d9c67d97d6f | 5804 | return (pYData[0]); |
emh203 | 0:3d9c67d97d6f | 5805 | } |
emh203 | 0:3d9c67d97d6f | 5806 | index = (x >> 20) & 0xfff; |
emh203 | 0:3d9c67d97d6f | 5807 | |
emh203 | 0:3d9c67d97d6f | 5808 | |
emh203 | 0:3d9c67d97d6f | 5809 | if(index >= (nValues - 1)) |
emh203 | 0:3d9c67d97d6f | 5810 | { |
emh203 | 0:3d9c67d97d6f | 5811 | return (pYData[nValues - 1]); |
emh203 | 0:3d9c67d97d6f | 5812 | } |
emh203 | 0:3d9c67d97d6f | 5813 | else |
emh203 | 0:3d9c67d97d6f | 5814 | { |
emh203 | 0:3d9c67d97d6f | 5815 | |
emh203 | 0:3d9c67d97d6f | 5816 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 5817 | /* fract is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 5818 | fract = (x & 0x000FFFFF); |
emh203 | 0:3d9c67d97d6f | 5819 | |
emh203 | 0:3d9c67d97d6f | 5820 | /* Read two nearest output values from the index and are in 1.7(q7) format */ |
emh203 | 0:3d9c67d97d6f | 5821 | y0 = pYData[index]; |
emh203 | 0:3d9c67d97d6f | 5822 | y1 = pYData[index + 1u]; |
emh203 | 0:3d9c67d97d6f | 5823 | |
emh203 | 0:3d9c67d97d6f | 5824 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ |
emh203 | 0:3d9c67d97d6f | 5825 | y = ((y0 * (0xFFFFF - fract))); |
emh203 | 0:3d9c67d97d6f | 5826 | |
emh203 | 0:3d9c67d97d6f | 5827 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ |
emh203 | 0:3d9c67d97d6f | 5828 | y += (y1 * fract); |
emh203 | 0:3d9c67d97d6f | 5829 | |
emh203 | 0:3d9c67d97d6f | 5830 | /* convert y to 1.7(q7) format */ |
emh203 | 0:3d9c67d97d6f | 5831 | return (y >> 20u); |
emh203 | 0:3d9c67d97d6f | 5832 | |
emh203 | 0:3d9c67d97d6f | 5833 | } |
emh203 | 0:3d9c67d97d6f | 5834 | |
emh203 | 0:3d9c67d97d6f | 5835 | } |
emh203 | 0:3d9c67d97d6f | 5836 | /** |
emh203 | 0:3d9c67d97d6f | 5837 | * @} end of LinearInterpolate group |
emh203 | 0:3d9c67d97d6f | 5838 | */ |
emh203 | 0:3d9c67d97d6f | 5839 | |
emh203 | 0:3d9c67d97d6f | 5840 | /** |
emh203 | 0:3d9c67d97d6f | 5841 | * @brief Fast approximation to the trigonometric sine function for floating-point data. |
emh203 | 0:3d9c67d97d6f | 5842 | * @param[in] x input value in radians. |
emh203 | 0:3d9c67d97d6f | 5843 | * @return sin(x). |
emh203 | 0:3d9c67d97d6f | 5844 | */ |
emh203 | 0:3d9c67d97d6f | 5845 | |
emh203 | 0:3d9c67d97d6f | 5846 | float32_t arm_sin_f32( |
emh203 | 0:3d9c67d97d6f | 5847 | float32_t x); |
emh203 | 0:3d9c67d97d6f | 5848 | |
emh203 | 0:3d9c67d97d6f | 5849 | /** |
emh203 | 0:3d9c67d97d6f | 5850 | * @brief Fast approximation to the trigonometric sine function for Q31 data. |
emh203 | 0:3d9c67d97d6f | 5851 | * @param[in] x Scaled input value in radians. |
emh203 | 0:3d9c67d97d6f | 5852 | * @return sin(x). |
emh203 | 0:3d9c67d97d6f | 5853 | */ |
emh203 | 0:3d9c67d97d6f | 5854 | |
emh203 | 0:3d9c67d97d6f | 5855 | q31_t arm_sin_q31( |
emh203 | 0:3d9c67d97d6f | 5856 | q31_t x); |
emh203 | 0:3d9c67d97d6f | 5857 | |
emh203 | 0:3d9c67d97d6f | 5858 | /** |
emh203 | 0:3d9c67d97d6f | 5859 | * @brief Fast approximation to the trigonometric sine function for Q15 data. |
emh203 | 0:3d9c67d97d6f | 5860 | * @param[in] x Scaled input value in radians. |
emh203 | 0:3d9c67d97d6f | 5861 | * @return sin(x). |
emh203 | 0:3d9c67d97d6f | 5862 | */ |
emh203 | 0:3d9c67d97d6f | 5863 | |
emh203 | 0:3d9c67d97d6f | 5864 | q15_t arm_sin_q15( |
emh203 | 0:3d9c67d97d6f | 5865 | q15_t x); |
emh203 | 0:3d9c67d97d6f | 5866 | |
emh203 | 0:3d9c67d97d6f | 5867 | /** |
emh203 | 0:3d9c67d97d6f | 5868 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. |
emh203 | 0:3d9c67d97d6f | 5869 | * @param[in] x input value in radians. |
emh203 | 0:3d9c67d97d6f | 5870 | * @return cos(x). |
emh203 | 0:3d9c67d97d6f | 5871 | */ |
emh203 | 0:3d9c67d97d6f | 5872 | |
emh203 | 0:3d9c67d97d6f | 5873 | float32_t arm_cos_f32( |
emh203 | 0:3d9c67d97d6f | 5874 | float32_t x); |
emh203 | 0:3d9c67d97d6f | 5875 | |
emh203 | 0:3d9c67d97d6f | 5876 | /** |
emh203 | 0:3d9c67d97d6f | 5877 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. |
emh203 | 0:3d9c67d97d6f | 5878 | * @param[in] x Scaled input value in radians. |
emh203 | 0:3d9c67d97d6f | 5879 | * @return cos(x). |
emh203 | 0:3d9c67d97d6f | 5880 | */ |
emh203 | 0:3d9c67d97d6f | 5881 | |
emh203 | 0:3d9c67d97d6f | 5882 | q31_t arm_cos_q31( |
emh203 | 0:3d9c67d97d6f | 5883 | q31_t x); |
emh203 | 0:3d9c67d97d6f | 5884 | |
emh203 | 0:3d9c67d97d6f | 5885 | /** |
emh203 | 0:3d9c67d97d6f | 5886 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. |
emh203 | 0:3d9c67d97d6f | 5887 | * @param[in] x Scaled input value in radians. |
emh203 | 0:3d9c67d97d6f | 5888 | * @return cos(x). |
emh203 | 0:3d9c67d97d6f | 5889 | */ |
emh203 | 0:3d9c67d97d6f | 5890 | |
emh203 | 0:3d9c67d97d6f | 5891 | q15_t arm_cos_q15( |
emh203 | 0:3d9c67d97d6f | 5892 | q15_t x); |
emh203 | 0:3d9c67d97d6f | 5893 | |
emh203 | 0:3d9c67d97d6f | 5894 | |
emh203 | 0:3d9c67d97d6f | 5895 | /** |
emh203 | 0:3d9c67d97d6f | 5896 | * @ingroup groupFastMath |
emh203 | 0:3d9c67d97d6f | 5897 | */ |
emh203 | 0:3d9c67d97d6f | 5898 | |
emh203 | 0:3d9c67d97d6f | 5899 | |
emh203 | 0:3d9c67d97d6f | 5900 | /** |
emh203 | 0:3d9c67d97d6f | 5901 | * @defgroup SQRT Square Root |
emh203 | 0:3d9c67d97d6f | 5902 | * |
emh203 | 0:3d9c67d97d6f | 5903 | * Computes the square root of a number. |
emh203 | 0:3d9c67d97d6f | 5904 | * There are separate functions for Q15, Q31, and floating-point data types. |
emh203 | 0:3d9c67d97d6f | 5905 | * The square root function is computed using the Newton-Raphson algorithm. |
emh203 | 0:3d9c67d97d6f | 5906 | * This is an iterative algorithm of the form: |
emh203 | 0:3d9c67d97d6f | 5907 | * <pre> |
emh203 | 0:3d9c67d97d6f | 5908 | * x1 = x0 - f(x0)/f'(x0) |
emh203 | 0:3d9c67d97d6f | 5909 | * </pre> |
emh203 | 0:3d9c67d97d6f | 5910 | * where <code>x1</code> is the current estimate, |
emh203 | 0:3d9c67d97d6f | 5911 | * <code>x0</code> is the previous estimate, and |
emh203 | 0:3d9c67d97d6f | 5912 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>. |
emh203 | 0:3d9c67d97d6f | 5913 | * For the square root function, the algorithm reduces to: |
emh203 | 0:3d9c67d97d6f | 5914 | * <pre> |
emh203 | 0:3d9c67d97d6f | 5915 | * x0 = in/2 [initial guess] |
emh203 | 0:3d9c67d97d6f | 5916 | * x1 = 1/2 * ( x0 + in / x0) [each iteration] |
emh203 | 0:3d9c67d97d6f | 5917 | * </pre> |
emh203 | 0:3d9c67d97d6f | 5918 | */ |
emh203 | 0:3d9c67d97d6f | 5919 | |
emh203 | 0:3d9c67d97d6f | 5920 | |
emh203 | 0:3d9c67d97d6f | 5921 | /** |
emh203 | 0:3d9c67d97d6f | 5922 | * @addtogroup SQRT |
emh203 | 0:3d9c67d97d6f | 5923 | * @{ |
emh203 | 0:3d9c67d97d6f | 5924 | */ |
emh203 | 0:3d9c67d97d6f | 5925 | |
emh203 | 0:3d9c67d97d6f | 5926 | /** |
emh203 | 0:3d9c67d97d6f | 5927 | * @brief Floating-point square root function. |
emh203 | 0:3d9c67d97d6f | 5928 | * @param[in] in input value. |
emh203 | 0:3d9c67d97d6f | 5929 | * @param[out] *pOut square root of input value. |
emh203 | 0:3d9c67d97d6f | 5930 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
emh203 | 0:3d9c67d97d6f | 5931 | * <code>in</code> is negative value and returns zero output for negative values. |
emh203 | 0:3d9c67d97d6f | 5932 | */ |
emh203 | 0:3d9c67d97d6f | 5933 | |
emh203 | 0:3d9c67d97d6f | 5934 | static __INLINE arm_status arm_sqrt_f32( |
emh203 | 0:3d9c67d97d6f | 5935 | float32_t in, |
emh203 | 0:3d9c67d97d6f | 5936 | float32_t * pOut) |
emh203 | 0:3d9c67d97d6f | 5937 | { |
emh203 | 0:3d9c67d97d6f | 5938 | if(in > 0) |
emh203 | 0:3d9c67d97d6f | 5939 | { |
emh203 | 0:3d9c67d97d6f | 5940 | |
emh203 | 0:3d9c67d97d6f | 5941 | // #if __FPU_USED |
emh203 | 0:3d9c67d97d6f | 5942 | #if (__FPU_USED == 1) && defined ( __CC_ARM ) |
emh203 | 0:3d9c67d97d6f | 5943 | *pOut = __sqrtf(in); |
emh203 | 0:3d9c67d97d6f | 5944 | #else |
emh203 | 0:3d9c67d97d6f | 5945 | *pOut = sqrtf(in); |
emh203 | 0:3d9c67d97d6f | 5946 | #endif |
emh203 | 0:3d9c67d97d6f | 5947 | |
emh203 | 0:3d9c67d97d6f | 5948 | return (ARM_MATH_SUCCESS); |
emh203 | 0:3d9c67d97d6f | 5949 | } |
emh203 | 0:3d9c67d97d6f | 5950 | else |
emh203 | 0:3d9c67d97d6f | 5951 | { |
emh203 | 0:3d9c67d97d6f | 5952 | *pOut = 0.0f; |
emh203 | 0:3d9c67d97d6f | 5953 | return (ARM_MATH_ARGUMENT_ERROR); |
emh203 | 0:3d9c67d97d6f | 5954 | } |
emh203 | 0:3d9c67d97d6f | 5955 | |
emh203 | 0:3d9c67d97d6f | 5956 | } |
emh203 | 0:3d9c67d97d6f | 5957 | |
emh203 | 0:3d9c67d97d6f | 5958 | |
emh203 | 0:3d9c67d97d6f | 5959 | /** |
emh203 | 0:3d9c67d97d6f | 5960 | * @brief Q31 square root function. |
emh203 | 0:3d9c67d97d6f | 5961 | * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. |
emh203 | 0:3d9c67d97d6f | 5962 | * @param[out] *pOut square root of input value. |
emh203 | 0:3d9c67d97d6f | 5963 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
emh203 | 0:3d9c67d97d6f | 5964 | * <code>in</code> is negative value and returns zero output for negative values. |
emh203 | 0:3d9c67d97d6f | 5965 | */ |
emh203 | 0:3d9c67d97d6f | 5966 | arm_status arm_sqrt_q31( |
emh203 | 0:3d9c67d97d6f | 5967 | q31_t in, |
emh203 | 0:3d9c67d97d6f | 5968 | q31_t * pOut); |
emh203 | 0:3d9c67d97d6f | 5969 | |
emh203 | 0:3d9c67d97d6f | 5970 | /** |
emh203 | 0:3d9c67d97d6f | 5971 | * @brief Q15 square root function. |
emh203 | 0:3d9c67d97d6f | 5972 | * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. |
emh203 | 0:3d9c67d97d6f | 5973 | * @param[out] *pOut square root of input value. |
emh203 | 0:3d9c67d97d6f | 5974 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
emh203 | 0:3d9c67d97d6f | 5975 | * <code>in</code> is negative value and returns zero output for negative values. |
emh203 | 0:3d9c67d97d6f | 5976 | */ |
emh203 | 0:3d9c67d97d6f | 5977 | arm_status arm_sqrt_q15( |
emh203 | 0:3d9c67d97d6f | 5978 | q15_t in, |
emh203 | 0:3d9c67d97d6f | 5979 | q15_t * pOut); |
emh203 | 0:3d9c67d97d6f | 5980 | |
emh203 | 0:3d9c67d97d6f | 5981 | /** |
emh203 | 0:3d9c67d97d6f | 5982 | * @} end of SQRT group |
emh203 | 0:3d9c67d97d6f | 5983 | */ |
emh203 | 0:3d9c67d97d6f | 5984 | |
emh203 | 0:3d9c67d97d6f | 5985 | |
emh203 | 0:3d9c67d97d6f | 5986 | |
emh203 | 0:3d9c67d97d6f | 5987 | |
emh203 | 0:3d9c67d97d6f | 5988 | |
emh203 | 0:3d9c67d97d6f | 5989 | |
emh203 | 0:3d9c67d97d6f | 5990 | /** |
emh203 | 0:3d9c67d97d6f | 5991 | * @brief floating-point Circular write function. |
emh203 | 0:3d9c67d97d6f | 5992 | */ |
emh203 | 0:3d9c67d97d6f | 5993 | |
emh203 | 0:3d9c67d97d6f | 5994 | static __INLINE void arm_circularWrite_f32( |
emh203 | 0:3d9c67d97d6f | 5995 | int32_t * circBuffer, |
emh203 | 0:3d9c67d97d6f | 5996 | int32_t L, |
emh203 | 0:3d9c67d97d6f | 5997 | uint16_t * writeOffset, |
emh203 | 0:3d9c67d97d6f | 5998 | int32_t bufferInc, |
emh203 | 0:3d9c67d97d6f | 5999 | const int32_t * src, |
emh203 | 0:3d9c67d97d6f | 6000 | int32_t srcInc, |
emh203 | 0:3d9c67d97d6f | 6001 | uint32_t blockSize) |
emh203 | 0:3d9c67d97d6f | 6002 | { |
emh203 | 0:3d9c67d97d6f | 6003 | uint32_t i = 0u; |
emh203 | 0:3d9c67d97d6f | 6004 | int32_t wOffset; |
emh203 | 0:3d9c67d97d6f | 6005 | |
emh203 | 0:3d9c67d97d6f | 6006 | /* Copy the value of Index pointer that points |
emh203 | 0:3d9c67d97d6f | 6007 | * to the current location where the input samples to be copied */ |
emh203 | 0:3d9c67d97d6f | 6008 | wOffset = *writeOffset; |
emh203 | 0:3d9c67d97d6f | 6009 | |
emh203 | 0:3d9c67d97d6f | 6010 | /* Loop over the blockSize */ |
emh203 | 0:3d9c67d97d6f | 6011 | i = blockSize; |
emh203 | 0:3d9c67d97d6f | 6012 | |
emh203 | 0:3d9c67d97d6f | 6013 | while(i > 0u) |
emh203 | 0:3d9c67d97d6f | 6014 | { |
emh203 | 0:3d9c67d97d6f | 6015 | /* copy the input sample to the circular buffer */ |
emh203 | 0:3d9c67d97d6f | 6016 | circBuffer[wOffset] = *src; |
emh203 | 0:3d9c67d97d6f | 6017 | |
emh203 | 0:3d9c67d97d6f | 6018 | /* Update the input pointer */ |
emh203 | 0:3d9c67d97d6f | 6019 | src += srcInc; |
emh203 | 0:3d9c67d97d6f | 6020 | |
emh203 | 0:3d9c67d97d6f | 6021 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emh203 | 0:3d9c67d97d6f | 6022 | wOffset += bufferInc; |
emh203 | 0:3d9c67d97d6f | 6023 | if(wOffset >= L) |
emh203 | 0:3d9c67d97d6f | 6024 | wOffset -= L; |
emh203 | 0:3d9c67d97d6f | 6025 | |
emh203 | 0:3d9c67d97d6f | 6026 | /* Decrement the loop counter */ |
emh203 | 0:3d9c67d97d6f | 6027 | i--; |
emh203 | 0:3d9c67d97d6f | 6028 | } |
emh203 | 0:3d9c67d97d6f | 6029 | |
emh203 | 0:3d9c67d97d6f | 6030 | /* Update the index pointer */ |
emh203 | 0:3d9c67d97d6f | 6031 | *writeOffset = wOffset; |
emh203 | 0:3d9c67d97d6f | 6032 | } |
emh203 | 0:3d9c67d97d6f | 6033 | |
emh203 | 0:3d9c67d97d6f | 6034 | |
emh203 | 0:3d9c67d97d6f | 6035 | |
emh203 | 0:3d9c67d97d6f | 6036 | /** |
emh203 | 0:3d9c67d97d6f | 6037 | * @brief floating-point Circular Read function. |
emh203 | 0:3d9c67d97d6f | 6038 | */ |
emh203 | 0:3d9c67d97d6f | 6039 | static __INLINE void arm_circularRead_f32( |
emh203 | 0:3d9c67d97d6f | 6040 | int32_t * circBuffer, |
emh203 | 0:3d9c67d97d6f | 6041 | int32_t L, |
emh203 | 0:3d9c67d97d6f | 6042 | int32_t * readOffset, |
emh203 | 0:3d9c67d97d6f | 6043 | int32_t bufferInc, |
emh203 | 0:3d9c67d97d6f | 6044 | int32_t * dst, |
emh203 | 0:3d9c67d97d6f | 6045 | int32_t * dst_base, |
emh203 | 0:3d9c67d97d6f | 6046 | int32_t dst_length, |
emh203 | 0:3d9c67d97d6f | 6047 | int32_t dstInc, |
emh203 | 0:3d9c67d97d6f | 6048 | uint32_t blockSize) |
emh203 | 0:3d9c67d97d6f | 6049 | { |
emh203 | 0:3d9c67d97d6f | 6050 | uint32_t i = 0u; |
emh203 | 0:3d9c67d97d6f | 6051 | int32_t rOffset, dst_end; |
emh203 | 0:3d9c67d97d6f | 6052 | |
emh203 | 0:3d9c67d97d6f | 6053 | /* Copy the value of Index pointer that points |
emh203 | 0:3d9c67d97d6f | 6054 | * to the current location from where the input samples to be read */ |
emh203 | 0:3d9c67d97d6f | 6055 | rOffset = *readOffset; |
emh203 | 0:3d9c67d97d6f | 6056 | dst_end = (int32_t) (dst_base + dst_length); |
emh203 | 0:3d9c67d97d6f | 6057 | |
emh203 | 0:3d9c67d97d6f | 6058 | /* Loop over the blockSize */ |
emh203 | 0:3d9c67d97d6f | 6059 | i = blockSize; |
emh203 | 0:3d9c67d97d6f | 6060 | |
emh203 | 0:3d9c67d97d6f | 6061 | while(i > 0u) |
emh203 | 0:3d9c67d97d6f | 6062 | { |
emh203 | 0:3d9c67d97d6f | 6063 | /* copy the sample from the circular buffer to the destination buffer */ |
emh203 | 0:3d9c67d97d6f | 6064 | *dst = circBuffer[rOffset]; |
emh203 | 0:3d9c67d97d6f | 6065 | |
emh203 | 0:3d9c67d97d6f | 6066 | /* Update the input pointer */ |
emh203 | 0:3d9c67d97d6f | 6067 | dst += dstInc; |
emh203 | 0:3d9c67d97d6f | 6068 | |
emh203 | 0:3d9c67d97d6f | 6069 | if(dst == (int32_t *) dst_end) |
emh203 | 0:3d9c67d97d6f | 6070 | { |
emh203 | 0:3d9c67d97d6f | 6071 | dst = dst_base; |
emh203 | 0:3d9c67d97d6f | 6072 | } |
emh203 | 0:3d9c67d97d6f | 6073 | |
emh203 | 0:3d9c67d97d6f | 6074 | /* Circularly update rOffset. Watch out for positive and negative value */ |
emh203 | 0:3d9c67d97d6f | 6075 | rOffset += bufferInc; |
emh203 | 0:3d9c67d97d6f | 6076 | |
emh203 | 0:3d9c67d97d6f | 6077 | if(rOffset >= L) |
emh203 | 0:3d9c67d97d6f | 6078 | { |
emh203 | 0:3d9c67d97d6f | 6079 | rOffset -= L; |
emh203 | 0:3d9c67d97d6f | 6080 | } |
emh203 | 0:3d9c67d97d6f | 6081 | |
emh203 | 0:3d9c67d97d6f | 6082 | /* Decrement the loop counter */ |
emh203 | 0:3d9c67d97d6f | 6083 | i--; |
emh203 | 0:3d9c67d97d6f | 6084 | } |
emh203 | 0:3d9c67d97d6f | 6085 | |
emh203 | 0:3d9c67d97d6f | 6086 | /* Update the index pointer */ |
emh203 | 0:3d9c67d97d6f | 6087 | *readOffset = rOffset; |
emh203 | 0:3d9c67d97d6f | 6088 | } |
emh203 | 0:3d9c67d97d6f | 6089 | |
emh203 | 0:3d9c67d97d6f | 6090 | /** |
emh203 | 0:3d9c67d97d6f | 6091 | * @brief Q15 Circular write function. |
emh203 | 0:3d9c67d97d6f | 6092 | */ |
emh203 | 0:3d9c67d97d6f | 6093 | |
emh203 | 0:3d9c67d97d6f | 6094 | static __INLINE void arm_circularWrite_q15( |
emh203 | 0:3d9c67d97d6f | 6095 | q15_t * circBuffer, |
emh203 | 0:3d9c67d97d6f | 6096 | int32_t L, |
emh203 | 0:3d9c67d97d6f | 6097 | uint16_t * writeOffset, |
emh203 | 0:3d9c67d97d6f | 6098 | int32_t bufferInc, |
emh203 | 0:3d9c67d97d6f | 6099 | const q15_t * src, |
emh203 | 0:3d9c67d97d6f | 6100 | int32_t srcInc, |
emh203 | 0:3d9c67d97d6f | 6101 | uint32_t blockSize) |
emh203 | 0:3d9c67d97d6f | 6102 | { |
emh203 | 0:3d9c67d97d6f | 6103 | uint32_t i = 0u; |
emh203 | 0:3d9c67d97d6f | 6104 | int32_t wOffset; |
emh203 | 0:3d9c67d97d6f | 6105 | |
emh203 | 0:3d9c67d97d6f | 6106 | /* Copy the value of Index pointer that points |
emh203 | 0:3d9c67d97d6f | 6107 | * to the current location where the input samples to be copied */ |
emh203 | 0:3d9c67d97d6f | 6108 | wOffset = *writeOffset; |
emh203 | 0:3d9c67d97d6f | 6109 | |
emh203 | 0:3d9c67d97d6f | 6110 | /* Loop over the blockSize */ |
emh203 | 0:3d9c67d97d6f | 6111 | i = blockSize; |
emh203 | 0:3d9c67d97d6f | 6112 | |
emh203 | 0:3d9c67d97d6f | 6113 | while(i > 0u) |
emh203 | 0:3d9c67d97d6f | 6114 | { |
emh203 | 0:3d9c67d97d6f | 6115 | /* copy the input sample to the circular buffer */ |
emh203 | 0:3d9c67d97d6f | 6116 | circBuffer[wOffset] = *src; |
emh203 | 0:3d9c67d97d6f | 6117 | |
emh203 | 0:3d9c67d97d6f | 6118 | /* Update the input pointer */ |
emh203 | 0:3d9c67d97d6f | 6119 | src += srcInc; |
emh203 | 0:3d9c67d97d6f | 6120 | |
emh203 | 0:3d9c67d97d6f | 6121 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emh203 | 0:3d9c67d97d6f | 6122 | wOffset += bufferInc; |
emh203 | 0:3d9c67d97d6f | 6123 | if(wOffset >= L) |
emh203 | 0:3d9c67d97d6f | 6124 | wOffset -= L; |
emh203 | 0:3d9c67d97d6f | 6125 | |
emh203 | 0:3d9c67d97d6f | 6126 | /* Decrement the loop counter */ |
emh203 | 0:3d9c67d97d6f | 6127 | i--; |
emh203 | 0:3d9c67d97d6f | 6128 | } |
emh203 | 0:3d9c67d97d6f | 6129 | |
emh203 | 0:3d9c67d97d6f | 6130 | /* Update the index pointer */ |
emh203 | 0:3d9c67d97d6f | 6131 | *writeOffset = wOffset; |
emh203 | 0:3d9c67d97d6f | 6132 | } |
emh203 | 0:3d9c67d97d6f | 6133 | |
emh203 | 0:3d9c67d97d6f | 6134 | |
emh203 | 0:3d9c67d97d6f | 6135 | |
emh203 | 0:3d9c67d97d6f | 6136 | /** |
emh203 | 0:3d9c67d97d6f | 6137 | * @brief Q15 Circular Read function. |
emh203 | 0:3d9c67d97d6f | 6138 | */ |
emh203 | 0:3d9c67d97d6f | 6139 | static __INLINE void arm_circularRead_q15( |
emh203 | 0:3d9c67d97d6f | 6140 | q15_t * circBuffer, |
emh203 | 0:3d9c67d97d6f | 6141 | int32_t L, |
emh203 | 0:3d9c67d97d6f | 6142 | int32_t * readOffset, |
emh203 | 0:3d9c67d97d6f | 6143 | int32_t bufferInc, |
emh203 | 0:3d9c67d97d6f | 6144 | q15_t * dst, |
emh203 | 0:3d9c67d97d6f | 6145 | q15_t * dst_base, |
emh203 | 0:3d9c67d97d6f | 6146 | int32_t dst_length, |
emh203 | 0:3d9c67d97d6f | 6147 | int32_t dstInc, |
emh203 | 0:3d9c67d97d6f | 6148 | uint32_t blockSize) |
emh203 | 0:3d9c67d97d6f | 6149 | { |
emh203 | 0:3d9c67d97d6f | 6150 | uint32_t i = 0; |
emh203 | 0:3d9c67d97d6f | 6151 | int32_t rOffset, dst_end; |
emh203 | 0:3d9c67d97d6f | 6152 | |
emh203 | 0:3d9c67d97d6f | 6153 | /* Copy the value of Index pointer that points |
emh203 | 0:3d9c67d97d6f | 6154 | * to the current location from where the input samples to be read */ |
emh203 | 0:3d9c67d97d6f | 6155 | rOffset = *readOffset; |
emh203 | 0:3d9c67d97d6f | 6156 | |
emh203 | 0:3d9c67d97d6f | 6157 | dst_end = (int32_t) (dst_base + dst_length); |
emh203 | 0:3d9c67d97d6f | 6158 | |
emh203 | 0:3d9c67d97d6f | 6159 | /* Loop over the blockSize */ |
emh203 | 0:3d9c67d97d6f | 6160 | i = blockSize; |
emh203 | 0:3d9c67d97d6f | 6161 | |
emh203 | 0:3d9c67d97d6f | 6162 | while(i > 0u) |
emh203 | 0:3d9c67d97d6f | 6163 | { |
emh203 | 0:3d9c67d97d6f | 6164 | /* copy the sample from the circular buffer to the destination buffer */ |
emh203 | 0:3d9c67d97d6f | 6165 | *dst = circBuffer[rOffset]; |
emh203 | 0:3d9c67d97d6f | 6166 | |
emh203 | 0:3d9c67d97d6f | 6167 | /* Update the input pointer */ |
emh203 | 0:3d9c67d97d6f | 6168 | dst += dstInc; |
emh203 | 0:3d9c67d97d6f | 6169 | |
emh203 | 0:3d9c67d97d6f | 6170 | if(dst == (q15_t *) dst_end) |
emh203 | 0:3d9c67d97d6f | 6171 | { |
emh203 | 0:3d9c67d97d6f | 6172 | dst = dst_base; |
emh203 | 0:3d9c67d97d6f | 6173 | } |
emh203 | 0:3d9c67d97d6f | 6174 | |
emh203 | 0:3d9c67d97d6f | 6175 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emh203 | 0:3d9c67d97d6f | 6176 | rOffset += bufferInc; |
emh203 | 0:3d9c67d97d6f | 6177 | |
emh203 | 0:3d9c67d97d6f | 6178 | if(rOffset >= L) |
emh203 | 0:3d9c67d97d6f | 6179 | { |
emh203 | 0:3d9c67d97d6f | 6180 | rOffset -= L; |
emh203 | 0:3d9c67d97d6f | 6181 | } |
emh203 | 0:3d9c67d97d6f | 6182 | |
emh203 | 0:3d9c67d97d6f | 6183 | /* Decrement the loop counter */ |
emh203 | 0:3d9c67d97d6f | 6184 | i--; |
emh203 | 0:3d9c67d97d6f | 6185 | } |
emh203 | 0:3d9c67d97d6f | 6186 | |
emh203 | 0:3d9c67d97d6f | 6187 | /* Update the index pointer */ |
emh203 | 0:3d9c67d97d6f | 6188 | *readOffset = rOffset; |
emh203 | 0:3d9c67d97d6f | 6189 | } |
emh203 | 0:3d9c67d97d6f | 6190 | |
emh203 | 0:3d9c67d97d6f | 6191 | |
emh203 | 0:3d9c67d97d6f | 6192 | /** |
emh203 | 0:3d9c67d97d6f | 6193 | * @brief Q7 Circular write function. |
emh203 | 0:3d9c67d97d6f | 6194 | */ |
emh203 | 0:3d9c67d97d6f | 6195 | |
emh203 | 0:3d9c67d97d6f | 6196 | static __INLINE void arm_circularWrite_q7( |
emh203 | 0:3d9c67d97d6f | 6197 | q7_t * circBuffer, |
emh203 | 0:3d9c67d97d6f | 6198 | int32_t L, |
emh203 | 0:3d9c67d97d6f | 6199 | uint16_t * writeOffset, |
emh203 | 0:3d9c67d97d6f | 6200 | int32_t bufferInc, |
emh203 | 0:3d9c67d97d6f | 6201 | const q7_t * src, |
emh203 | 0:3d9c67d97d6f | 6202 | int32_t srcInc, |
emh203 | 0:3d9c67d97d6f | 6203 | uint32_t blockSize) |
emh203 | 0:3d9c67d97d6f | 6204 | { |
emh203 | 0:3d9c67d97d6f | 6205 | uint32_t i = 0u; |
emh203 | 0:3d9c67d97d6f | 6206 | int32_t wOffset; |
emh203 | 0:3d9c67d97d6f | 6207 | |
emh203 | 0:3d9c67d97d6f | 6208 | /* Copy the value of Index pointer that points |
emh203 | 0:3d9c67d97d6f | 6209 | * to the current location where the input samples to be copied */ |
emh203 | 0:3d9c67d97d6f | 6210 | wOffset = *writeOffset; |
emh203 | 0:3d9c67d97d6f | 6211 | |
emh203 | 0:3d9c67d97d6f | 6212 | /* Loop over the blockSize */ |
emh203 | 0:3d9c67d97d6f | 6213 | i = blockSize; |
emh203 | 0:3d9c67d97d6f | 6214 | |
emh203 | 0:3d9c67d97d6f | 6215 | while(i > 0u) |
emh203 | 0:3d9c67d97d6f | 6216 | { |
emh203 | 0:3d9c67d97d6f | 6217 | /* copy the input sample to the circular buffer */ |
emh203 | 0:3d9c67d97d6f | 6218 | circBuffer[wOffset] = *src; |
emh203 | 0:3d9c67d97d6f | 6219 | |
emh203 | 0:3d9c67d97d6f | 6220 | /* Update the input pointer */ |
emh203 | 0:3d9c67d97d6f | 6221 | src += srcInc; |
emh203 | 0:3d9c67d97d6f | 6222 | |
emh203 | 0:3d9c67d97d6f | 6223 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emh203 | 0:3d9c67d97d6f | 6224 | wOffset += bufferInc; |
emh203 | 0:3d9c67d97d6f | 6225 | if(wOffset >= L) |
emh203 | 0:3d9c67d97d6f | 6226 | wOffset -= L; |
emh203 | 0:3d9c67d97d6f | 6227 | |
emh203 | 0:3d9c67d97d6f | 6228 | /* Decrement the loop counter */ |
emh203 | 0:3d9c67d97d6f | 6229 | i--; |
emh203 | 0:3d9c67d97d6f | 6230 | } |
emh203 | 0:3d9c67d97d6f | 6231 | |
emh203 | 0:3d9c67d97d6f | 6232 | /* Update the index pointer */ |
emh203 | 0:3d9c67d97d6f | 6233 | *writeOffset = wOffset; |
emh203 | 0:3d9c67d97d6f | 6234 | } |
emh203 | 0:3d9c67d97d6f | 6235 | |
emh203 | 0:3d9c67d97d6f | 6236 | |
emh203 | 0:3d9c67d97d6f | 6237 | |
emh203 | 0:3d9c67d97d6f | 6238 | /** |
emh203 | 0:3d9c67d97d6f | 6239 | * @brief Q7 Circular Read function. |
emh203 | 0:3d9c67d97d6f | 6240 | */ |
emh203 | 0:3d9c67d97d6f | 6241 | static __INLINE void arm_circularRead_q7( |
emh203 | 0:3d9c67d97d6f | 6242 | q7_t * circBuffer, |
emh203 | 0:3d9c67d97d6f | 6243 | int32_t L, |
emh203 | 0:3d9c67d97d6f | 6244 | int32_t * readOffset, |
emh203 | 0:3d9c67d97d6f | 6245 | int32_t bufferInc, |
emh203 | 0:3d9c67d97d6f | 6246 | q7_t * dst, |
emh203 | 0:3d9c67d97d6f | 6247 | q7_t * dst_base, |
emh203 | 0:3d9c67d97d6f | 6248 | int32_t dst_length, |
emh203 | 0:3d9c67d97d6f | 6249 | int32_t dstInc, |
emh203 | 0:3d9c67d97d6f | 6250 | uint32_t blockSize) |
emh203 | 0:3d9c67d97d6f | 6251 | { |
emh203 | 0:3d9c67d97d6f | 6252 | uint32_t i = 0; |
emh203 | 0:3d9c67d97d6f | 6253 | int32_t rOffset, dst_end; |
emh203 | 0:3d9c67d97d6f | 6254 | |
emh203 | 0:3d9c67d97d6f | 6255 | /* Copy the value of Index pointer that points |
emh203 | 0:3d9c67d97d6f | 6256 | * to the current location from where the input samples to be read */ |
emh203 | 0:3d9c67d97d6f | 6257 | rOffset = *readOffset; |
emh203 | 0:3d9c67d97d6f | 6258 | |
emh203 | 0:3d9c67d97d6f | 6259 | dst_end = (int32_t) (dst_base + dst_length); |
emh203 | 0:3d9c67d97d6f | 6260 | |
emh203 | 0:3d9c67d97d6f | 6261 | /* Loop over the blockSize */ |
emh203 | 0:3d9c67d97d6f | 6262 | i = blockSize; |
emh203 | 0:3d9c67d97d6f | 6263 | |
emh203 | 0:3d9c67d97d6f | 6264 | while(i > 0u) |
emh203 | 0:3d9c67d97d6f | 6265 | { |
emh203 | 0:3d9c67d97d6f | 6266 | /* copy the sample from the circular buffer to the destination buffer */ |
emh203 | 0:3d9c67d97d6f | 6267 | *dst = circBuffer[rOffset]; |
emh203 | 0:3d9c67d97d6f | 6268 | |
emh203 | 0:3d9c67d97d6f | 6269 | /* Update the input pointer */ |
emh203 | 0:3d9c67d97d6f | 6270 | dst += dstInc; |
emh203 | 0:3d9c67d97d6f | 6271 | |
emh203 | 0:3d9c67d97d6f | 6272 | if(dst == (q7_t *) dst_end) |
emh203 | 0:3d9c67d97d6f | 6273 | { |
emh203 | 0:3d9c67d97d6f | 6274 | dst = dst_base; |
emh203 | 0:3d9c67d97d6f | 6275 | } |
emh203 | 0:3d9c67d97d6f | 6276 | |
emh203 | 0:3d9c67d97d6f | 6277 | /* Circularly update rOffset. Watch out for positive and negative value */ |
emh203 | 0:3d9c67d97d6f | 6278 | rOffset += bufferInc; |
emh203 | 0:3d9c67d97d6f | 6279 | |
emh203 | 0:3d9c67d97d6f | 6280 | if(rOffset >= L) |
emh203 | 0:3d9c67d97d6f | 6281 | { |
emh203 | 0:3d9c67d97d6f | 6282 | rOffset -= L; |
emh203 | 0:3d9c67d97d6f | 6283 | } |
emh203 | 0:3d9c67d97d6f | 6284 | |
emh203 | 0:3d9c67d97d6f | 6285 | /* Decrement the loop counter */ |
emh203 | 0:3d9c67d97d6f | 6286 | i--; |
emh203 | 0:3d9c67d97d6f | 6287 | } |
emh203 | 0:3d9c67d97d6f | 6288 | |
emh203 | 0:3d9c67d97d6f | 6289 | /* Update the index pointer */ |
emh203 | 0:3d9c67d97d6f | 6290 | *readOffset = rOffset; |
emh203 | 0:3d9c67d97d6f | 6291 | } |
emh203 | 0:3d9c67d97d6f | 6292 | |
emh203 | 0:3d9c67d97d6f | 6293 | |
emh203 | 0:3d9c67d97d6f | 6294 | /** |
emh203 | 0:3d9c67d97d6f | 6295 | * @brief Sum of the squares of the elements of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6296 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6297 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6298 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6299 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6300 | */ |
emh203 | 0:3d9c67d97d6f | 6301 | |
emh203 | 0:3d9c67d97d6f | 6302 | void arm_power_q31( |
emh203 | 0:3d9c67d97d6f | 6303 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6304 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6305 | q63_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6306 | |
emh203 | 0:3d9c67d97d6f | 6307 | /** |
emh203 | 0:3d9c67d97d6f | 6308 | * @brief Sum of the squares of the elements of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6309 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6310 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6311 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6312 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6313 | */ |
emh203 | 0:3d9c67d97d6f | 6314 | |
emh203 | 0:3d9c67d97d6f | 6315 | void arm_power_f32( |
emh203 | 0:3d9c67d97d6f | 6316 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6317 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6318 | float32_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6319 | |
emh203 | 0:3d9c67d97d6f | 6320 | /** |
emh203 | 0:3d9c67d97d6f | 6321 | * @brief Sum of the squares of the elements of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6322 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6323 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6324 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6325 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6326 | */ |
emh203 | 0:3d9c67d97d6f | 6327 | |
emh203 | 0:3d9c67d97d6f | 6328 | void arm_power_q15( |
emh203 | 0:3d9c67d97d6f | 6329 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6330 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6331 | q63_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6332 | |
emh203 | 0:3d9c67d97d6f | 6333 | /** |
emh203 | 0:3d9c67d97d6f | 6334 | * @brief Sum of the squares of the elements of a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6335 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6336 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6337 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6338 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6339 | */ |
emh203 | 0:3d9c67d97d6f | 6340 | |
emh203 | 0:3d9c67d97d6f | 6341 | void arm_power_q7( |
emh203 | 0:3d9c67d97d6f | 6342 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6343 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6344 | q31_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6345 | |
emh203 | 0:3d9c67d97d6f | 6346 | /** |
emh203 | 0:3d9c67d97d6f | 6347 | * @brief Mean value of a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6348 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6349 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6350 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6351 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6352 | */ |
emh203 | 0:3d9c67d97d6f | 6353 | |
emh203 | 0:3d9c67d97d6f | 6354 | void arm_mean_q7( |
emh203 | 0:3d9c67d97d6f | 6355 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6356 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6357 | q7_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6358 | |
emh203 | 0:3d9c67d97d6f | 6359 | /** |
emh203 | 0:3d9c67d97d6f | 6360 | * @brief Mean value of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6361 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6362 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6363 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6364 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6365 | */ |
emh203 | 0:3d9c67d97d6f | 6366 | void arm_mean_q15( |
emh203 | 0:3d9c67d97d6f | 6367 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6368 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6369 | q15_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6370 | |
emh203 | 0:3d9c67d97d6f | 6371 | /** |
emh203 | 0:3d9c67d97d6f | 6372 | * @brief Mean value of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6373 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6374 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6375 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6376 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6377 | */ |
emh203 | 0:3d9c67d97d6f | 6378 | void arm_mean_q31( |
emh203 | 0:3d9c67d97d6f | 6379 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6380 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6381 | q31_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6382 | |
emh203 | 0:3d9c67d97d6f | 6383 | /** |
emh203 | 0:3d9c67d97d6f | 6384 | * @brief Mean value of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6385 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6386 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6387 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6388 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6389 | */ |
emh203 | 0:3d9c67d97d6f | 6390 | void arm_mean_f32( |
emh203 | 0:3d9c67d97d6f | 6391 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6392 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6393 | float32_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6394 | |
emh203 | 0:3d9c67d97d6f | 6395 | /** |
emh203 | 0:3d9c67d97d6f | 6396 | * @brief Variance of the elements of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6397 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6398 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6399 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6400 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6401 | */ |
emh203 | 0:3d9c67d97d6f | 6402 | |
emh203 | 0:3d9c67d97d6f | 6403 | void arm_var_f32( |
emh203 | 0:3d9c67d97d6f | 6404 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6405 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6406 | float32_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6407 | |
emh203 | 0:3d9c67d97d6f | 6408 | /** |
emh203 | 0:3d9c67d97d6f | 6409 | * @brief Variance of the elements of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6410 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6411 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6412 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6413 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6414 | */ |
emh203 | 0:3d9c67d97d6f | 6415 | |
emh203 | 0:3d9c67d97d6f | 6416 | void arm_var_q31( |
emh203 | 0:3d9c67d97d6f | 6417 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6418 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6419 | q31_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6420 | |
emh203 | 0:3d9c67d97d6f | 6421 | /** |
emh203 | 0:3d9c67d97d6f | 6422 | * @brief Variance of the elements of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6423 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6424 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6425 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6426 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6427 | */ |
emh203 | 0:3d9c67d97d6f | 6428 | |
emh203 | 0:3d9c67d97d6f | 6429 | void arm_var_q15( |
emh203 | 0:3d9c67d97d6f | 6430 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6431 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6432 | q15_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6433 | |
emh203 | 0:3d9c67d97d6f | 6434 | /** |
emh203 | 0:3d9c67d97d6f | 6435 | * @brief Root Mean Square of the elements of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6436 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6437 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6438 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6439 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6440 | */ |
emh203 | 0:3d9c67d97d6f | 6441 | |
emh203 | 0:3d9c67d97d6f | 6442 | void arm_rms_f32( |
emh203 | 0:3d9c67d97d6f | 6443 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6444 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6445 | float32_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6446 | |
emh203 | 0:3d9c67d97d6f | 6447 | /** |
emh203 | 0:3d9c67d97d6f | 6448 | * @brief Root Mean Square of the elements of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6449 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6450 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6451 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6452 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6453 | */ |
emh203 | 0:3d9c67d97d6f | 6454 | |
emh203 | 0:3d9c67d97d6f | 6455 | void arm_rms_q31( |
emh203 | 0:3d9c67d97d6f | 6456 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6457 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6458 | q31_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6459 | |
emh203 | 0:3d9c67d97d6f | 6460 | /** |
emh203 | 0:3d9c67d97d6f | 6461 | * @brief Root Mean Square of the elements of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6462 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6463 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6464 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6465 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6466 | */ |
emh203 | 0:3d9c67d97d6f | 6467 | |
emh203 | 0:3d9c67d97d6f | 6468 | void arm_rms_q15( |
emh203 | 0:3d9c67d97d6f | 6469 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6470 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6471 | q15_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6472 | |
emh203 | 0:3d9c67d97d6f | 6473 | /** |
emh203 | 0:3d9c67d97d6f | 6474 | * @brief Standard deviation of the elements of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6475 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6476 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6477 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6478 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6479 | */ |
emh203 | 0:3d9c67d97d6f | 6480 | |
emh203 | 0:3d9c67d97d6f | 6481 | void arm_std_f32( |
emh203 | 0:3d9c67d97d6f | 6482 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6483 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6484 | float32_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6485 | |
emh203 | 0:3d9c67d97d6f | 6486 | /** |
emh203 | 0:3d9c67d97d6f | 6487 | * @brief Standard deviation of the elements of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6488 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6489 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6490 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6491 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6492 | */ |
emh203 | 0:3d9c67d97d6f | 6493 | |
emh203 | 0:3d9c67d97d6f | 6494 | void arm_std_q31( |
emh203 | 0:3d9c67d97d6f | 6495 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6496 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6497 | q31_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6498 | |
emh203 | 0:3d9c67d97d6f | 6499 | /** |
emh203 | 0:3d9c67d97d6f | 6500 | * @brief Standard deviation of the elements of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6501 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6502 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6503 | * @param[out] *pResult is output value. |
emh203 | 0:3d9c67d97d6f | 6504 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6505 | */ |
emh203 | 0:3d9c67d97d6f | 6506 | |
emh203 | 0:3d9c67d97d6f | 6507 | void arm_std_q15( |
emh203 | 0:3d9c67d97d6f | 6508 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6509 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6510 | q15_t * pResult); |
emh203 | 0:3d9c67d97d6f | 6511 | |
emh203 | 0:3d9c67d97d6f | 6512 | /** |
emh203 | 0:3d9c67d97d6f | 6513 | * @brief Floating-point complex magnitude |
emh203 | 0:3d9c67d97d6f | 6514 | * @param[in] *pSrc points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 6515 | * @param[out] *pDst points to the real output vector |
emh203 | 0:3d9c67d97d6f | 6516 | * @param[in] numSamples number of complex samples in the input vector |
emh203 | 0:3d9c67d97d6f | 6517 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6518 | */ |
emh203 | 0:3d9c67d97d6f | 6519 | |
emh203 | 0:3d9c67d97d6f | 6520 | void arm_cmplx_mag_f32( |
emh203 | 0:3d9c67d97d6f | 6521 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6522 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6523 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6524 | |
emh203 | 0:3d9c67d97d6f | 6525 | /** |
emh203 | 0:3d9c67d97d6f | 6526 | * @brief Q31 complex magnitude |
emh203 | 0:3d9c67d97d6f | 6527 | * @param[in] *pSrc points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 6528 | * @param[out] *pDst points to the real output vector |
emh203 | 0:3d9c67d97d6f | 6529 | * @param[in] numSamples number of complex samples in the input vector |
emh203 | 0:3d9c67d97d6f | 6530 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6531 | */ |
emh203 | 0:3d9c67d97d6f | 6532 | |
emh203 | 0:3d9c67d97d6f | 6533 | void arm_cmplx_mag_q31( |
emh203 | 0:3d9c67d97d6f | 6534 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6535 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6536 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6537 | |
emh203 | 0:3d9c67d97d6f | 6538 | /** |
emh203 | 0:3d9c67d97d6f | 6539 | * @brief Q15 complex magnitude |
emh203 | 0:3d9c67d97d6f | 6540 | * @param[in] *pSrc points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 6541 | * @param[out] *pDst points to the real output vector |
emh203 | 0:3d9c67d97d6f | 6542 | * @param[in] numSamples number of complex samples in the input vector |
emh203 | 0:3d9c67d97d6f | 6543 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6544 | */ |
emh203 | 0:3d9c67d97d6f | 6545 | |
emh203 | 0:3d9c67d97d6f | 6546 | void arm_cmplx_mag_q15( |
emh203 | 0:3d9c67d97d6f | 6547 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6548 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6549 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6550 | |
emh203 | 0:3d9c67d97d6f | 6551 | /** |
emh203 | 0:3d9c67d97d6f | 6552 | * @brief Q15 complex dot product |
emh203 | 0:3d9c67d97d6f | 6553 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 6554 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 6555 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 6556 | * @param[out] *realResult real part of the result returned here |
emh203 | 0:3d9c67d97d6f | 6557 | * @param[out] *imagResult imaginary part of the result returned here |
emh203 | 0:3d9c67d97d6f | 6558 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6559 | */ |
emh203 | 0:3d9c67d97d6f | 6560 | |
emh203 | 0:3d9c67d97d6f | 6561 | void arm_cmplx_dot_prod_q15( |
emh203 | 0:3d9c67d97d6f | 6562 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 6563 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 6564 | uint32_t numSamples, |
emh203 | 0:3d9c67d97d6f | 6565 | q31_t * realResult, |
emh203 | 0:3d9c67d97d6f | 6566 | q31_t * imagResult); |
emh203 | 0:3d9c67d97d6f | 6567 | |
emh203 | 0:3d9c67d97d6f | 6568 | /** |
emh203 | 0:3d9c67d97d6f | 6569 | * @brief Q31 complex dot product |
emh203 | 0:3d9c67d97d6f | 6570 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 6571 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 6572 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 6573 | * @param[out] *realResult real part of the result returned here |
emh203 | 0:3d9c67d97d6f | 6574 | * @param[out] *imagResult imaginary part of the result returned here |
emh203 | 0:3d9c67d97d6f | 6575 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6576 | */ |
emh203 | 0:3d9c67d97d6f | 6577 | |
emh203 | 0:3d9c67d97d6f | 6578 | void arm_cmplx_dot_prod_q31( |
emh203 | 0:3d9c67d97d6f | 6579 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 6580 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 6581 | uint32_t numSamples, |
emh203 | 0:3d9c67d97d6f | 6582 | q63_t * realResult, |
emh203 | 0:3d9c67d97d6f | 6583 | q63_t * imagResult); |
emh203 | 0:3d9c67d97d6f | 6584 | |
emh203 | 0:3d9c67d97d6f | 6585 | /** |
emh203 | 0:3d9c67d97d6f | 6586 | * @brief Floating-point complex dot product |
emh203 | 0:3d9c67d97d6f | 6587 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 6588 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 6589 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 6590 | * @param[out] *realResult real part of the result returned here |
emh203 | 0:3d9c67d97d6f | 6591 | * @param[out] *imagResult imaginary part of the result returned here |
emh203 | 0:3d9c67d97d6f | 6592 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6593 | */ |
emh203 | 0:3d9c67d97d6f | 6594 | |
emh203 | 0:3d9c67d97d6f | 6595 | void arm_cmplx_dot_prod_f32( |
emh203 | 0:3d9c67d97d6f | 6596 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 6597 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 6598 | uint32_t numSamples, |
emh203 | 0:3d9c67d97d6f | 6599 | float32_t * realResult, |
emh203 | 0:3d9c67d97d6f | 6600 | float32_t * imagResult); |
emh203 | 0:3d9c67d97d6f | 6601 | |
emh203 | 0:3d9c67d97d6f | 6602 | /** |
emh203 | 0:3d9c67d97d6f | 6603 | * @brief Q15 complex-by-real multiplication |
emh203 | 0:3d9c67d97d6f | 6604 | * @param[in] *pSrcCmplx points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 6605 | * @param[in] *pSrcReal points to the real input vector |
emh203 | 0:3d9c67d97d6f | 6606 | * @param[out] *pCmplxDst points to the complex output vector |
emh203 | 0:3d9c67d97d6f | 6607 | * @param[in] numSamples number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 6608 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6609 | */ |
emh203 | 0:3d9c67d97d6f | 6610 | |
emh203 | 0:3d9c67d97d6f | 6611 | void arm_cmplx_mult_real_q15( |
emh203 | 0:3d9c67d97d6f | 6612 | q15_t * pSrcCmplx, |
emh203 | 0:3d9c67d97d6f | 6613 | q15_t * pSrcReal, |
emh203 | 0:3d9c67d97d6f | 6614 | q15_t * pCmplxDst, |
emh203 | 0:3d9c67d97d6f | 6615 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6616 | |
emh203 | 0:3d9c67d97d6f | 6617 | /** |
emh203 | 0:3d9c67d97d6f | 6618 | * @brief Q31 complex-by-real multiplication |
emh203 | 0:3d9c67d97d6f | 6619 | * @param[in] *pSrcCmplx points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 6620 | * @param[in] *pSrcReal points to the real input vector |
emh203 | 0:3d9c67d97d6f | 6621 | * @param[out] *pCmplxDst points to the complex output vector |
emh203 | 0:3d9c67d97d6f | 6622 | * @param[in] numSamples number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 6623 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6624 | */ |
emh203 | 0:3d9c67d97d6f | 6625 | |
emh203 | 0:3d9c67d97d6f | 6626 | void arm_cmplx_mult_real_q31( |
emh203 | 0:3d9c67d97d6f | 6627 | q31_t * pSrcCmplx, |
emh203 | 0:3d9c67d97d6f | 6628 | q31_t * pSrcReal, |
emh203 | 0:3d9c67d97d6f | 6629 | q31_t * pCmplxDst, |
emh203 | 0:3d9c67d97d6f | 6630 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6631 | |
emh203 | 0:3d9c67d97d6f | 6632 | /** |
emh203 | 0:3d9c67d97d6f | 6633 | * @brief Floating-point complex-by-real multiplication |
emh203 | 0:3d9c67d97d6f | 6634 | * @param[in] *pSrcCmplx points to the complex input vector |
emh203 | 0:3d9c67d97d6f | 6635 | * @param[in] *pSrcReal points to the real input vector |
emh203 | 0:3d9c67d97d6f | 6636 | * @param[out] *pCmplxDst points to the complex output vector |
emh203 | 0:3d9c67d97d6f | 6637 | * @param[in] numSamples number of samples in each vector |
emh203 | 0:3d9c67d97d6f | 6638 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6639 | */ |
emh203 | 0:3d9c67d97d6f | 6640 | |
emh203 | 0:3d9c67d97d6f | 6641 | void arm_cmplx_mult_real_f32( |
emh203 | 0:3d9c67d97d6f | 6642 | float32_t * pSrcCmplx, |
emh203 | 0:3d9c67d97d6f | 6643 | float32_t * pSrcReal, |
emh203 | 0:3d9c67d97d6f | 6644 | float32_t * pCmplxDst, |
emh203 | 0:3d9c67d97d6f | 6645 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6646 | |
emh203 | 0:3d9c67d97d6f | 6647 | /** |
emh203 | 0:3d9c67d97d6f | 6648 | * @brief Minimum value of a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6649 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6650 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6651 | * @param[out] *result is output pointer |
emh203 | 0:3d9c67d97d6f | 6652 | * @param[in] index is the array index of the minimum value in the input buffer. |
emh203 | 0:3d9c67d97d6f | 6653 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6654 | */ |
emh203 | 0:3d9c67d97d6f | 6655 | |
emh203 | 0:3d9c67d97d6f | 6656 | void arm_min_q7( |
emh203 | 0:3d9c67d97d6f | 6657 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6658 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6659 | q7_t * result, |
emh203 | 0:3d9c67d97d6f | 6660 | uint32_t * index); |
emh203 | 0:3d9c67d97d6f | 6661 | |
emh203 | 0:3d9c67d97d6f | 6662 | /** |
emh203 | 0:3d9c67d97d6f | 6663 | * @brief Minimum value of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6664 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6665 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6666 | * @param[out] *pResult is output pointer |
emh203 | 0:3d9c67d97d6f | 6667 | * @param[in] *pIndex is the array index of the minimum value in the input buffer. |
emh203 | 0:3d9c67d97d6f | 6668 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6669 | */ |
emh203 | 0:3d9c67d97d6f | 6670 | |
emh203 | 0:3d9c67d97d6f | 6671 | void arm_min_q15( |
emh203 | 0:3d9c67d97d6f | 6672 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6673 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6674 | q15_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6675 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6676 | |
emh203 | 0:3d9c67d97d6f | 6677 | /** |
emh203 | 0:3d9c67d97d6f | 6678 | * @brief Minimum value of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6679 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6680 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6681 | * @param[out] *pResult is output pointer |
emh203 | 0:3d9c67d97d6f | 6682 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
emh203 | 0:3d9c67d97d6f | 6683 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6684 | */ |
emh203 | 0:3d9c67d97d6f | 6685 | void arm_min_q31( |
emh203 | 0:3d9c67d97d6f | 6686 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6687 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6688 | q31_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6689 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6690 | |
emh203 | 0:3d9c67d97d6f | 6691 | /** |
emh203 | 0:3d9c67d97d6f | 6692 | * @brief Minimum value of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6693 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6694 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6695 | * @param[out] *pResult is output pointer |
emh203 | 0:3d9c67d97d6f | 6696 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
emh203 | 0:3d9c67d97d6f | 6697 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6698 | */ |
emh203 | 0:3d9c67d97d6f | 6699 | |
emh203 | 0:3d9c67d97d6f | 6700 | void arm_min_f32( |
emh203 | 0:3d9c67d97d6f | 6701 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6702 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6703 | float32_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6704 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6705 | |
emh203 | 0:3d9c67d97d6f | 6706 | /** |
emh203 | 0:3d9c67d97d6f | 6707 | * @brief Maximum value of a Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6708 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 6709 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6710 | * @param[out] *pResult maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6711 | * @param[out] *pIndex index of maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6712 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6713 | */ |
emh203 | 0:3d9c67d97d6f | 6714 | |
emh203 | 0:3d9c67d97d6f | 6715 | void arm_max_q7( |
emh203 | 0:3d9c67d97d6f | 6716 | q7_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6717 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6718 | q7_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6719 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6720 | |
emh203 | 0:3d9c67d97d6f | 6721 | /** |
emh203 | 0:3d9c67d97d6f | 6722 | * @brief Maximum value of a Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6723 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 6724 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6725 | * @param[out] *pResult maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6726 | * @param[out] *pIndex index of maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6727 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6728 | */ |
emh203 | 0:3d9c67d97d6f | 6729 | |
emh203 | 0:3d9c67d97d6f | 6730 | void arm_max_q15( |
emh203 | 0:3d9c67d97d6f | 6731 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6732 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6733 | q15_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6734 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6735 | |
emh203 | 0:3d9c67d97d6f | 6736 | /** |
emh203 | 0:3d9c67d97d6f | 6737 | * @brief Maximum value of a Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6738 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 6739 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6740 | * @param[out] *pResult maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6741 | * @param[out] *pIndex index of maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6742 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6743 | */ |
emh203 | 0:3d9c67d97d6f | 6744 | |
emh203 | 0:3d9c67d97d6f | 6745 | void arm_max_q31( |
emh203 | 0:3d9c67d97d6f | 6746 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6747 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6748 | q31_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6749 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6750 | |
emh203 | 0:3d9c67d97d6f | 6751 | /** |
emh203 | 0:3d9c67d97d6f | 6752 | * @brief Maximum value of a floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6753 | * @param[in] *pSrc points to the input buffer |
emh203 | 0:3d9c67d97d6f | 6754 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6755 | * @param[out] *pResult maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6756 | * @param[out] *pIndex index of maximum value returned here |
emh203 | 0:3d9c67d97d6f | 6757 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6758 | */ |
emh203 | 0:3d9c67d97d6f | 6759 | |
emh203 | 0:3d9c67d97d6f | 6760 | void arm_max_f32( |
emh203 | 0:3d9c67d97d6f | 6761 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6762 | uint32_t blockSize, |
emh203 | 0:3d9c67d97d6f | 6763 | float32_t * pResult, |
emh203 | 0:3d9c67d97d6f | 6764 | uint32_t * pIndex); |
emh203 | 0:3d9c67d97d6f | 6765 | |
emh203 | 0:3d9c67d97d6f | 6766 | /** |
emh203 | 0:3d9c67d97d6f | 6767 | * @brief Q15 complex-by-complex multiplication |
emh203 | 0:3d9c67d97d6f | 6768 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 6769 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 6770 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 6771 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 6772 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6773 | */ |
emh203 | 0:3d9c67d97d6f | 6774 | |
emh203 | 0:3d9c67d97d6f | 6775 | void arm_cmplx_mult_cmplx_q15( |
emh203 | 0:3d9c67d97d6f | 6776 | q15_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 6777 | q15_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 6778 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6779 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6780 | |
emh203 | 0:3d9c67d97d6f | 6781 | /** |
emh203 | 0:3d9c67d97d6f | 6782 | * @brief Q31 complex-by-complex multiplication |
emh203 | 0:3d9c67d97d6f | 6783 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 6784 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 6785 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 6786 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 6787 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6788 | */ |
emh203 | 0:3d9c67d97d6f | 6789 | |
emh203 | 0:3d9c67d97d6f | 6790 | void arm_cmplx_mult_cmplx_q31( |
emh203 | 0:3d9c67d97d6f | 6791 | q31_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 6792 | q31_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 6793 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6794 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6795 | |
emh203 | 0:3d9c67d97d6f | 6796 | /** |
emh203 | 0:3d9c67d97d6f | 6797 | * @brief Floating-point complex-by-complex multiplication |
emh203 | 0:3d9c67d97d6f | 6798 | * @param[in] *pSrcA points to the first input vector |
emh203 | 0:3d9c67d97d6f | 6799 | * @param[in] *pSrcB points to the second input vector |
emh203 | 0:3d9c67d97d6f | 6800 | * @param[out] *pDst points to the output vector |
emh203 | 0:3d9c67d97d6f | 6801 | * @param[in] numSamples number of complex samples in each vector |
emh203 | 0:3d9c67d97d6f | 6802 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6803 | */ |
emh203 | 0:3d9c67d97d6f | 6804 | |
emh203 | 0:3d9c67d97d6f | 6805 | void arm_cmplx_mult_cmplx_f32( |
emh203 | 0:3d9c67d97d6f | 6806 | float32_t * pSrcA, |
emh203 | 0:3d9c67d97d6f | 6807 | float32_t * pSrcB, |
emh203 | 0:3d9c67d97d6f | 6808 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6809 | uint32_t numSamples); |
emh203 | 0:3d9c67d97d6f | 6810 | |
emh203 | 0:3d9c67d97d6f | 6811 | /** |
emh203 | 0:3d9c67d97d6f | 6812 | * @brief Converts the elements of the floating-point vector to Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6813 | * @param[in] *pSrc points to the floating-point input vector |
emh203 | 0:3d9c67d97d6f | 6814 | * @param[out] *pDst points to the Q31 output vector |
emh203 | 0:3d9c67d97d6f | 6815 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6816 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6817 | */ |
emh203 | 0:3d9c67d97d6f | 6818 | void arm_float_to_q31( |
emh203 | 0:3d9c67d97d6f | 6819 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6820 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6821 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6822 | |
emh203 | 0:3d9c67d97d6f | 6823 | /** |
emh203 | 0:3d9c67d97d6f | 6824 | * @brief Converts the elements of the floating-point vector to Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6825 | * @param[in] *pSrc points to the floating-point input vector |
emh203 | 0:3d9c67d97d6f | 6826 | * @param[out] *pDst points to the Q15 output vector |
emh203 | 0:3d9c67d97d6f | 6827 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6828 | * @return none |
emh203 | 0:3d9c67d97d6f | 6829 | */ |
emh203 | 0:3d9c67d97d6f | 6830 | void arm_float_to_q15( |
emh203 | 0:3d9c67d97d6f | 6831 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6832 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6833 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6834 | |
emh203 | 0:3d9c67d97d6f | 6835 | /** |
emh203 | 0:3d9c67d97d6f | 6836 | * @brief Converts the elements of the floating-point vector to Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6837 | * @param[in] *pSrc points to the floating-point input vector |
emh203 | 0:3d9c67d97d6f | 6838 | * @param[out] *pDst points to the Q7 output vector |
emh203 | 0:3d9c67d97d6f | 6839 | * @param[in] blockSize length of the input vector |
emh203 | 0:3d9c67d97d6f | 6840 | * @return none |
emh203 | 0:3d9c67d97d6f | 6841 | */ |
emh203 | 0:3d9c67d97d6f | 6842 | void arm_float_to_q7( |
emh203 | 0:3d9c67d97d6f | 6843 | float32_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6844 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6845 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6846 | |
emh203 | 0:3d9c67d97d6f | 6847 | |
emh203 | 0:3d9c67d97d6f | 6848 | /** |
emh203 | 0:3d9c67d97d6f | 6849 | * @brief Converts the elements of the Q31 vector to Q15 vector. |
emh203 | 0:3d9c67d97d6f | 6850 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6851 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 6852 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6853 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6854 | */ |
emh203 | 0:3d9c67d97d6f | 6855 | void arm_q31_to_q15( |
emh203 | 0:3d9c67d97d6f | 6856 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6857 | q15_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6858 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6859 | |
emh203 | 0:3d9c67d97d6f | 6860 | /** |
emh203 | 0:3d9c67d97d6f | 6861 | * @brief Converts the elements of the Q31 vector to Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6862 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6863 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 6864 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6865 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6866 | */ |
emh203 | 0:3d9c67d97d6f | 6867 | void arm_q31_to_q7( |
emh203 | 0:3d9c67d97d6f | 6868 | q31_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6869 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6870 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6871 | |
emh203 | 0:3d9c67d97d6f | 6872 | /** |
emh203 | 0:3d9c67d97d6f | 6873 | * @brief Converts the elements of the Q15 vector to floating-point vector. |
emh203 | 0:3d9c67d97d6f | 6874 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6875 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 6876 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6877 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6878 | */ |
emh203 | 0:3d9c67d97d6f | 6879 | void arm_q15_to_float( |
emh203 | 0:3d9c67d97d6f | 6880 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6881 | float32_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6882 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6883 | |
emh203 | 0:3d9c67d97d6f | 6884 | |
emh203 | 0:3d9c67d97d6f | 6885 | /** |
emh203 | 0:3d9c67d97d6f | 6886 | * @brief Converts the elements of the Q15 vector to Q31 vector. |
emh203 | 0:3d9c67d97d6f | 6887 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6888 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 6889 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6890 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6891 | */ |
emh203 | 0:3d9c67d97d6f | 6892 | void arm_q15_to_q31( |
emh203 | 0:3d9c67d97d6f | 6893 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6894 | q31_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6895 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6896 | |
emh203 | 0:3d9c67d97d6f | 6897 | |
emh203 | 0:3d9c67d97d6f | 6898 | /** |
emh203 | 0:3d9c67d97d6f | 6899 | * @brief Converts the elements of the Q15 vector to Q7 vector. |
emh203 | 0:3d9c67d97d6f | 6900 | * @param[in] *pSrc is input pointer |
emh203 | 0:3d9c67d97d6f | 6901 | * @param[out] *pDst is output pointer |
emh203 | 0:3d9c67d97d6f | 6902 | * @param[in] blockSize is the number of samples to process |
emh203 | 0:3d9c67d97d6f | 6903 | * @return none. |
emh203 | 0:3d9c67d97d6f | 6904 | */ |
emh203 | 0:3d9c67d97d6f | 6905 | void arm_q15_to_q7( |
emh203 | 0:3d9c67d97d6f | 6906 | q15_t * pSrc, |
emh203 | 0:3d9c67d97d6f | 6907 | q7_t * pDst, |
emh203 | 0:3d9c67d97d6f | 6908 | uint32_t blockSize); |
emh203 | 0:3d9c67d97d6f | 6909 | |
emh203 | 0:3d9c67d97d6f | 6910 | |
emh203 | 0:3d9c67d97d6f | 6911 | /** |
emh203 | 0:3d9c67d97d6f | 6912 | * @ingroup groupInterpolation |
emh203 | 0:3d9c67d97d6f | 6913 | */ |
emh203 | 0:3d9c67d97d6f | 6914 | |
emh203 | 0:3d9c67d97d6f | 6915 | /** |
emh203 | 0:3d9c67d97d6f | 6916 | * @defgroup BilinearInterpolate Bilinear Interpolation |
emh203 | 0:3d9c67d97d6f | 6917 | * |
emh203 | 0:3d9c67d97d6f | 6918 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. |
emh203 | 0:3d9c67d97d6f | 6919 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process |
emh203 | 0:3d9c67d97d6f | 6920 | * determines values between the grid points. |
emh203 | 0:3d9c67d97d6f | 6921 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. |
emh203 | 0:3d9c67d97d6f | 6922 | * Bilinear interpolation is often used in image processing to rescale images. |
emh203 | 0:3d9c67d97d6f | 6923 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. |
emh203 | 0:3d9c67d97d6f | 6924 | * |
emh203 | 0:3d9c67d97d6f | 6925 | * <b>Algorithm</b> |
emh203 | 0:3d9c67d97d6f | 6926 | * \par |
emh203 | 0:3d9c67d97d6f | 6927 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. |
emh203 | 0:3d9c67d97d6f | 6928 | * For floating-point, the instance structure is defined as: |
emh203 | 0:3d9c67d97d6f | 6929 | * <pre> |
emh203 | 0:3d9c67d97d6f | 6930 | * typedef struct |
emh203 | 0:3d9c67d97d6f | 6931 | * { |
emh203 | 0:3d9c67d97d6f | 6932 | * uint16_t numRows; |
emh203 | 0:3d9c67d97d6f | 6933 | * uint16_t numCols; |
emh203 | 0:3d9c67d97d6f | 6934 | * float32_t *pData; |
emh203 | 0:3d9c67d97d6f | 6935 | * } arm_bilinear_interp_instance_f32; |
emh203 | 0:3d9c67d97d6f | 6936 | * </pre> |
emh203 | 0:3d9c67d97d6f | 6937 | * |
emh203 | 0:3d9c67d97d6f | 6938 | * \par |
emh203 | 0:3d9c67d97d6f | 6939 | * where <code>numRows</code> specifies the number of rows in the table; |
emh203 | 0:3d9c67d97d6f | 6940 | * <code>numCols</code> specifies the number of columns in the table; |
emh203 | 0:3d9c67d97d6f | 6941 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values. |
emh203 | 0:3d9c67d97d6f | 6942 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes. |
emh203 | 0:3d9c67d97d6f | 6943 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers. |
emh203 | 0:3d9c67d97d6f | 6944 | * |
emh203 | 0:3d9c67d97d6f | 6945 | * \par |
emh203 | 0:3d9c67d97d6f | 6946 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define: |
emh203 | 0:3d9c67d97d6f | 6947 | * <pre> |
emh203 | 0:3d9c67d97d6f | 6948 | * XF = floor(x) |
emh203 | 0:3d9c67d97d6f | 6949 | * YF = floor(y) |
emh203 | 0:3d9c67d97d6f | 6950 | * </pre> |
emh203 | 0:3d9c67d97d6f | 6951 | * \par |
emh203 | 0:3d9c67d97d6f | 6952 | * The interpolated output point is computed as: |
emh203 | 0:3d9c67d97d6f | 6953 | * <pre> |
emh203 | 0:3d9c67d97d6f | 6954 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF)) |
emh203 | 0:3d9c67d97d6f | 6955 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF)) |
emh203 | 0:3d9c67d97d6f | 6956 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF) |
emh203 | 0:3d9c67d97d6f | 6957 | * + f(XF+1, YF+1) * (x-XF)*(y-YF) |
emh203 | 0:3d9c67d97d6f | 6958 | * </pre> |
emh203 | 0:3d9c67d97d6f | 6959 | * Note that the coordinates (x, y) contain integer and fractional components. |
emh203 | 0:3d9c67d97d6f | 6960 | * The integer components specify which portion of the table to use while the |
emh203 | 0:3d9c67d97d6f | 6961 | * fractional components control the interpolation processor. |
emh203 | 0:3d9c67d97d6f | 6962 | * |
emh203 | 0:3d9c67d97d6f | 6963 | * \par |
emh203 | 0:3d9c67d97d6f | 6964 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. |
emh203 | 0:3d9c67d97d6f | 6965 | */ |
emh203 | 0:3d9c67d97d6f | 6966 | |
emh203 | 0:3d9c67d97d6f | 6967 | /** |
emh203 | 0:3d9c67d97d6f | 6968 | * @addtogroup BilinearInterpolate |
emh203 | 0:3d9c67d97d6f | 6969 | * @{ |
emh203 | 0:3d9c67d97d6f | 6970 | */ |
emh203 | 0:3d9c67d97d6f | 6971 | |
emh203 | 0:3d9c67d97d6f | 6972 | /** |
emh203 | 0:3d9c67d97d6f | 6973 | * |
emh203 | 0:3d9c67d97d6f | 6974 | * @brief Floating-point bilinear interpolation. |
emh203 | 0:3d9c67d97d6f | 6975 | * @param[in,out] *S points to an instance of the interpolation structure. |
emh203 | 0:3d9c67d97d6f | 6976 | * @param[in] X interpolation coordinate. |
emh203 | 0:3d9c67d97d6f | 6977 | * @param[in] Y interpolation coordinate. |
emh203 | 0:3d9c67d97d6f | 6978 | * @return out interpolated value. |
emh203 | 0:3d9c67d97d6f | 6979 | */ |
emh203 | 0:3d9c67d97d6f | 6980 | |
emh203 | 0:3d9c67d97d6f | 6981 | |
emh203 | 0:3d9c67d97d6f | 6982 | static __INLINE float32_t arm_bilinear_interp_f32( |
emh203 | 0:3d9c67d97d6f | 6983 | const arm_bilinear_interp_instance_f32 * S, |
emh203 | 0:3d9c67d97d6f | 6984 | float32_t X, |
emh203 | 0:3d9c67d97d6f | 6985 | float32_t Y) |
emh203 | 0:3d9c67d97d6f | 6986 | { |
emh203 | 0:3d9c67d97d6f | 6987 | float32_t out; |
emh203 | 0:3d9c67d97d6f | 6988 | float32_t f00, f01, f10, f11; |
emh203 | 0:3d9c67d97d6f | 6989 | float32_t *pData = S->pData; |
emh203 | 0:3d9c67d97d6f | 6990 | int32_t xIndex, yIndex, index; |
emh203 | 0:3d9c67d97d6f | 6991 | float32_t xdiff, ydiff; |
emh203 | 0:3d9c67d97d6f | 6992 | float32_t b1, b2, b3, b4; |
emh203 | 0:3d9c67d97d6f | 6993 | |
emh203 | 0:3d9c67d97d6f | 6994 | xIndex = (int32_t) X; |
emh203 | 0:3d9c67d97d6f | 6995 | yIndex = (int32_t) Y; |
emh203 | 0:3d9c67d97d6f | 6996 | |
emh203 | 0:3d9c67d97d6f | 6997 | /* Care taken for table outside boundary */ |
emh203 | 0:3d9c67d97d6f | 6998 | /* Returns zero output when values are outside table boundary */ |
emh203 | 0:3d9c67d97d6f | 6999 | if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 |
emh203 | 0:3d9c67d97d6f | 7000 | || yIndex > (S->numCols - 1)) |
emh203 | 0:3d9c67d97d6f | 7001 | { |
emh203 | 0:3d9c67d97d6f | 7002 | return (0); |
emh203 | 0:3d9c67d97d6f | 7003 | } |
emh203 | 0:3d9c67d97d6f | 7004 | |
emh203 | 0:3d9c67d97d6f | 7005 | /* Calculation of index for two nearest points in X-direction */ |
emh203 | 0:3d9c67d97d6f | 7006 | index = (xIndex - 1) + (yIndex - 1) * S->numCols; |
emh203 | 0:3d9c67d97d6f | 7007 | |
emh203 | 0:3d9c67d97d6f | 7008 | |
emh203 | 0:3d9c67d97d6f | 7009 | /* Read two nearest points in X-direction */ |
emh203 | 0:3d9c67d97d6f | 7010 | f00 = pData[index]; |
emh203 | 0:3d9c67d97d6f | 7011 | f01 = pData[index + 1]; |
emh203 | 0:3d9c67d97d6f | 7012 | |
emh203 | 0:3d9c67d97d6f | 7013 | /* Calculation of index for two nearest points in Y-direction */ |
emh203 | 0:3d9c67d97d6f | 7014 | index = (xIndex - 1) + (yIndex) * S->numCols; |
emh203 | 0:3d9c67d97d6f | 7015 | |
emh203 | 0:3d9c67d97d6f | 7016 | |
emh203 | 0:3d9c67d97d6f | 7017 | /* Read two nearest points in Y-direction */ |
emh203 | 0:3d9c67d97d6f | 7018 | f10 = pData[index]; |
emh203 | 0:3d9c67d97d6f | 7019 | f11 = pData[index + 1]; |
emh203 | 0:3d9c67d97d6f | 7020 | |
emh203 | 0:3d9c67d97d6f | 7021 | /* Calculation of intermediate values */ |
emh203 | 0:3d9c67d97d6f | 7022 | b1 = f00; |
emh203 | 0:3d9c67d97d6f | 7023 | b2 = f01 - f00; |
emh203 | 0:3d9c67d97d6f | 7024 | b3 = f10 - f00; |
emh203 | 0:3d9c67d97d6f | 7025 | b4 = f00 - f01 - f10 + f11; |
emh203 | 0:3d9c67d97d6f | 7026 | |
emh203 | 0:3d9c67d97d6f | 7027 | /* Calculation of fractional part in X */ |
emh203 | 0:3d9c67d97d6f | 7028 | xdiff = X - xIndex; |
emh203 | 0:3d9c67d97d6f | 7029 | |
emh203 | 0:3d9c67d97d6f | 7030 | /* Calculation of fractional part in Y */ |
emh203 | 0:3d9c67d97d6f | 7031 | ydiff = Y - yIndex; |
emh203 | 0:3d9c67d97d6f | 7032 | |
emh203 | 0:3d9c67d97d6f | 7033 | /* Calculation of bi-linear interpolated output */ |
emh203 | 0:3d9c67d97d6f | 7034 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; |
emh203 | 0:3d9c67d97d6f | 7035 | |
emh203 | 0:3d9c67d97d6f | 7036 | /* return to application */ |
emh203 | 0:3d9c67d97d6f | 7037 | return (out); |
emh203 | 0:3d9c67d97d6f | 7038 | |
emh203 | 0:3d9c67d97d6f | 7039 | } |
emh203 | 0:3d9c67d97d6f | 7040 | |
emh203 | 0:3d9c67d97d6f | 7041 | /** |
emh203 | 0:3d9c67d97d6f | 7042 | * |
emh203 | 0:3d9c67d97d6f | 7043 | * @brief Q31 bilinear interpolation. |
emh203 | 0:3d9c67d97d6f | 7044 | * @param[in,out] *S points to an instance of the interpolation structure. |
emh203 | 0:3d9c67d97d6f | 7045 | * @param[in] X interpolation coordinate in 12.20 format. |
emh203 | 0:3d9c67d97d6f | 7046 | * @param[in] Y interpolation coordinate in 12.20 format. |
emh203 | 0:3d9c67d97d6f | 7047 | * @return out interpolated value. |
emh203 | 0:3d9c67d97d6f | 7048 | */ |
emh203 | 0:3d9c67d97d6f | 7049 | |
emh203 | 0:3d9c67d97d6f | 7050 | static __INLINE q31_t arm_bilinear_interp_q31( |
emh203 | 0:3d9c67d97d6f | 7051 | arm_bilinear_interp_instance_q31 * S, |
emh203 | 0:3d9c67d97d6f | 7052 | q31_t X, |
emh203 | 0:3d9c67d97d6f | 7053 | q31_t Y) |
emh203 | 0:3d9c67d97d6f | 7054 | { |
emh203 | 0:3d9c67d97d6f | 7055 | q31_t out; /* Temporary output */ |
emh203 | 0:3d9c67d97d6f | 7056 | q31_t acc = 0; /* output */ |
emh203 | 0:3d9c67d97d6f | 7057 | q31_t xfract, yfract; /* X, Y fractional parts */ |
emh203 | 0:3d9c67d97d6f | 7058 | q31_t x1, x2, y1, y2; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 7059 | int32_t rI, cI; /* Row and column indices */ |
emh203 | 0:3d9c67d97d6f | 7060 | q31_t *pYData = S->pData; /* pointer to output table values */ |
emh203 | 0:3d9c67d97d6f | 7061 | uint32_t nCols = S->numCols; /* num of rows */ |
emh203 | 0:3d9c67d97d6f | 7062 | |
emh203 | 0:3d9c67d97d6f | 7063 | |
emh203 | 0:3d9c67d97d6f | 7064 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7065 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 7066 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 7067 | rI = ((X & 0xFFF00000) >> 20u); |
emh203 | 0:3d9c67d97d6f | 7068 | |
emh203 | 0:3d9c67d97d6f | 7069 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7070 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 7071 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 7072 | cI = ((Y & 0xFFF00000) >> 20u); |
emh203 | 0:3d9c67d97d6f | 7073 | |
emh203 | 0:3d9c67d97d6f | 7074 | /* Care taken for table outside boundary */ |
emh203 | 0:3d9c67d97d6f | 7075 | /* Returns zero output when values are outside table boundary */ |
emh203 | 0:3d9c67d97d6f | 7076 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
emh203 | 0:3d9c67d97d6f | 7077 | { |
emh203 | 0:3d9c67d97d6f | 7078 | return (0); |
emh203 | 0:3d9c67d97d6f | 7079 | } |
emh203 | 0:3d9c67d97d6f | 7080 | |
emh203 | 0:3d9c67d97d6f | 7081 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 7082 | /* shift left xfract by 11 to keep 1.31 format */ |
emh203 | 0:3d9c67d97d6f | 7083 | xfract = (X & 0x000FFFFF) << 11u; |
emh203 | 0:3d9c67d97d6f | 7084 | |
emh203 | 0:3d9c67d97d6f | 7085 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 7086 | x1 = pYData[(rI) + nCols * (cI)]; |
emh203 | 0:3d9c67d97d6f | 7087 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
emh203 | 0:3d9c67d97d6f | 7088 | |
emh203 | 0:3d9c67d97d6f | 7089 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 7090 | /* shift left yfract by 11 to keep 1.31 format */ |
emh203 | 0:3d9c67d97d6f | 7091 | yfract = (Y & 0x000FFFFF) << 11u; |
emh203 | 0:3d9c67d97d6f | 7092 | |
emh203 | 0:3d9c67d97d6f | 7093 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 7094 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
emh203 | 0:3d9c67d97d6f | 7095 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
emh203 | 0:3d9c67d97d6f | 7096 | |
emh203 | 0:3d9c67d97d6f | 7097 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ |
emh203 | 0:3d9c67d97d6f | 7098 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7099 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7100 | |
emh203 | 0:3d9c67d97d6f | 7101 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7102 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7103 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7104 | |
emh203 | 0:3d9c67d97d6f | 7105 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7106 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7107 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7108 | |
emh203 | 0:3d9c67d97d6f | 7109 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7110 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7111 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
emh203 | 0:3d9c67d97d6f | 7112 | |
emh203 | 0:3d9c67d97d6f | 7113 | /* Convert acc to 1.31(q31) format */ |
emh203 | 0:3d9c67d97d6f | 7114 | return (acc << 2u); |
emh203 | 0:3d9c67d97d6f | 7115 | |
emh203 | 0:3d9c67d97d6f | 7116 | } |
emh203 | 0:3d9c67d97d6f | 7117 | |
emh203 | 0:3d9c67d97d6f | 7118 | /** |
emh203 | 0:3d9c67d97d6f | 7119 | * @brief Q15 bilinear interpolation. |
emh203 | 0:3d9c67d97d6f | 7120 | * @param[in,out] *S points to an instance of the interpolation structure. |
emh203 | 0:3d9c67d97d6f | 7121 | * @param[in] X interpolation coordinate in 12.20 format. |
emh203 | 0:3d9c67d97d6f | 7122 | * @param[in] Y interpolation coordinate in 12.20 format. |
emh203 | 0:3d9c67d97d6f | 7123 | * @return out interpolated value. |
emh203 | 0:3d9c67d97d6f | 7124 | */ |
emh203 | 0:3d9c67d97d6f | 7125 | |
emh203 | 0:3d9c67d97d6f | 7126 | static __INLINE q15_t arm_bilinear_interp_q15( |
emh203 | 0:3d9c67d97d6f | 7127 | arm_bilinear_interp_instance_q15 * S, |
emh203 | 0:3d9c67d97d6f | 7128 | q31_t X, |
emh203 | 0:3d9c67d97d6f | 7129 | q31_t Y) |
emh203 | 0:3d9c67d97d6f | 7130 | { |
emh203 | 0:3d9c67d97d6f | 7131 | q63_t acc = 0; /* output */ |
emh203 | 0:3d9c67d97d6f | 7132 | q31_t out; /* Temporary output */ |
emh203 | 0:3d9c67d97d6f | 7133 | q15_t x1, x2, y1, y2; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 7134 | q31_t xfract, yfract; /* X, Y fractional parts */ |
emh203 | 0:3d9c67d97d6f | 7135 | int32_t rI, cI; /* Row and column indices */ |
emh203 | 0:3d9c67d97d6f | 7136 | q15_t *pYData = S->pData; /* pointer to output table values */ |
emh203 | 0:3d9c67d97d6f | 7137 | uint32_t nCols = S->numCols; /* num of rows */ |
emh203 | 0:3d9c67d97d6f | 7138 | |
emh203 | 0:3d9c67d97d6f | 7139 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7140 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 7141 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 7142 | rI = ((X & 0xFFF00000) >> 20); |
emh203 | 0:3d9c67d97d6f | 7143 | |
emh203 | 0:3d9c67d97d6f | 7144 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7145 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 7146 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 7147 | cI = ((Y & 0xFFF00000) >> 20); |
emh203 | 0:3d9c67d97d6f | 7148 | |
emh203 | 0:3d9c67d97d6f | 7149 | /* Care taken for table outside boundary */ |
emh203 | 0:3d9c67d97d6f | 7150 | /* Returns zero output when values are outside table boundary */ |
emh203 | 0:3d9c67d97d6f | 7151 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
emh203 | 0:3d9c67d97d6f | 7152 | { |
emh203 | 0:3d9c67d97d6f | 7153 | return (0); |
emh203 | 0:3d9c67d97d6f | 7154 | } |
emh203 | 0:3d9c67d97d6f | 7155 | |
emh203 | 0:3d9c67d97d6f | 7156 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 7157 | /* xfract should be in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7158 | xfract = (X & 0x000FFFFF); |
emh203 | 0:3d9c67d97d6f | 7159 | |
emh203 | 0:3d9c67d97d6f | 7160 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 7161 | x1 = pYData[(rI) + nCols * (cI)]; |
emh203 | 0:3d9c67d97d6f | 7162 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
emh203 | 0:3d9c67d97d6f | 7163 | |
emh203 | 0:3d9c67d97d6f | 7164 | |
emh203 | 0:3d9c67d97d6f | 7165 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 7166 | /* yfract should be in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7167 | yfract = (Y & 0x000FFFFF); |
emh203 | 0:3d9c67d97d6f | 7168 | |
emh203 | 0:3d9c67d97d6f | 7169 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 7170 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
emh203 | 0:3d9c67d97d6f | 7171 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
emh203 | 0:3d9c67d97d6f | 7172 | |
emh203 | 0:3d9c67d97d6f | 7173 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ |
emh203 | 0:3d9c67d97d6f | 7174 | |
emh203 | 0:3d9c67d97d6f | 7175 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ |
emh203 | 0:3d9c67d97d6f | 7176 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ |
emh203 | 0:3d9c67d97d6f | 7177 | out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); |
emh203 | 0:3d9c67d97d6f | 7178 | acc = ((q63_t) out * (0xFFFFF - yfract)); |
emh203 | 0:3d9c67d97d6f | 7179 | |
emh203 | 0:3d9c67d97d6f | 7180 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7181 | out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); |
emh203 | 0:3d9c67d97d6f | 7182 | acc += ((q63_t) out * (xfract)); |
emh203 | 0:3d9c67d97d6f | 7183 | |
emh203 | 0:3d9c67d97d6f | 7184 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7185 | out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); |
emh203 | 0:3d9c67d97d6f | 7186 | acc += ((q63_t) out * (yfract)); |
emh203 | 0:3d9c67d97d6f | 7187 | |
emh203 | 0:3d9c67d97d6f | 7188 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7189 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); |
emh203 | 0:3d9c67d97d6f | 7190 | acc += ((q63_t) out * (yfract)); |
emh203 | 0:3d9c67d97d6f | 7191 | |
emh203 | 0:3d9c67d97d6f | 7192 | /* acc is in 13.51 format and down shift acc by 36 times */ |
emh203 | 0:3d9c67d97d6f | 7193 | /* Convert out to 1.15 format */ |
emh203 | 0:3d9c67d97d6f | 7194 | return (acc >> 36); |
emh203 | 0:3d9c67d97d6f | 7195 | |
emh203 | 0:3d9c67d97d6f | 7196 | } |
emh203 | 0:3d9c67d97d6f | 7197 | |
emh203 | 0:3d9c67d97d6f | 7198 | /** |
emh203 | 0:3d9c67d97d6f | 7199 | * @brief Q7 bilinear interpolation. |
emh203 | 0:3d9c67d97d6f | 7200 | * @param[in,out] *S points to an instance of the interpolation structure. |
emh203 | 0:3d9c67d97d6f | 7201 | * @param[in] X interpolation coordinate in 12.20 format. |
emh203 | 0:3d9c67d97d6f | 7202 | * @param[in] Y interpolation coordinate in 12.20 format. |
emh203 | 0:3d9c67d97d6f | 7203 | * @return out interpolated value. |
emh203 | 0:3d9c67d97d6f | 7204 | */ |
emh203 | 0:3d9c67d97d6f | 7205 | |
emh203 | 0:3d9c67d97d6f | 7206 | static __INLINE q7_t arm_bilinear_interp_q7( |
emh203 | 0:3d9c67d97d6f | 7207 | arm_bilinear_interp_instance_q7 * S, |
emh203 | 0:3d9c67d97d6f | 7208 | q31_t X, |
emh203 | 0:3d9c67d97d6f | 7209 | q31_t Y) |
emh203 | 0:3d9c67d97d6f | 7210 | { |
emh203 | 0:3d9c67d97d6f | 7211 | q63_t acc = 0; /* output */ |
emh203 | 0:3d9c67d97d6f | 7212 | q31_t out; /* Temporary output */ |
emh203 | 0:3d9c67d97d6f | 7213 | q31_t xfract, yfract; /* X, Y fractional parts */ |
emh203 | 0:3d9c67d97d6f | 7214 | q7_t x1, x2, y1, y2; /* Nearest output values */ |
emh203 | 0:3d9c67d97d6f | 7215 | int32_t rI, cI; /* Row and column indices */ |
emh203 | 0:3d9c67d97d6f | 7216 | q7_t *pYData = S->pData; /* pointer to output table values */ |
emh203 | 0:3d9c67d97d6f | 7217 | uint32_t nCols = S->numCols; /* num of rows */ |
emh203 | 0:3d9c67d97d6f | 7218 | |
emh203 | 0:3d9c67d97d6f | 7219 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7220 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 7221 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 7222 | rI = ((X & 0xFFF00000) >> 20); |
emh203 | 0:3d9c67d97d6f | 7223 | |
emh203 | 0:3d9c67d97d6f | 7224 | /* Input is in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7225 | /* 12 bits for the table index */ |
emh203 | 0:3d9c67d97d6f | 7226 | /* Index value calculation */ |
emh203 | 0:3d9c67d97d6f | 7227 | cI = ((Y & 0xFFF00000) >> 20); |
emh203 | 0:3d9c67d97d6f | 7228 | |
emh203 | 0:3d9c67d97d6f | 7229 | /* Care taken for table outside boundary */ |
emh203 | 0:3d9c67d97d6f | 7230 | /* Returns zero output when values are outside table boundary */ |
emh203 | 0:3d9c67d97d6f | 7231 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
emh203 | 0:3d9c67d97d6f | 7232 | { |
emh203 | 0:3d9c67d97d6f | 7233 | return (0); |
emh203 | 0:3d9c67d97d6f | 7234 | } |
emh203 | 0:3d9c67d97d6f | 7235 | |
emh203 | 0:3d9c67d97d6f | 7236 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 7237 | /* xfract should be in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7238 | xfract = (X & 0x000FFFFF); |
emh203 | 0:3d9c67d97d6f | 7239 | |
emh203 | 0:3d9c67d97d6f | 7240 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 7241 | x1 = pYData[(rI) + nCols * (cI)]; |
emh203 | 0:3d9c67d97d6f | 7242 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
emh203 | 0:3d9c67d97d6f | 7243 | |
emh203 | 0:3d9c67d97d6f | 7244 | |
emh203 | 0:3d9c67d97d6f | 7245 | /* 20 bits for the fractional part */ |
emh203 | 0:3d9c67d97d6f | 7246 | /* yfract should be in 12.20 format */ |
emh203 | 0:3d9c67d97d6f | 7247 | yfract = (Y & 0x000FFFFF); |
emh203 | 0:3d9c67d97d6f | 7248 | |
emh203 | 0:3d9c67d97d6f | 7249 | /* Read two nearest output values from the index */ |
emh203 | 0:3d9c67d97d6f | 7250 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
emh203 | 0:3d9c67d97d6f | 7251 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
emh203 | 0:3d9c67d97d6f | 7252 | |
emh203 | 0:3d9c67d97d6f | 7253 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ |
emh203 | 0:3d9c67d97d6f | 7254 | out = ((x1 * (0xFFFFF - xfract))); |
emh203 | 0:3d9c67d97d6f | 7255 | acc = (((q63_t) out * (0xFFFFF - yfract))); |
emh203 | 0:3d9c67d97d6f | 7256 | |
emh203 | 0:3d9c67d97d6f | 7257 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7258 | out = ((x2 * (0xFFFFF - yfract))); |
emh203 | 0:3d9c67d97d6f | 7259 | acc += (((q63_t) out * (xfract))); |
emh203 | 0:3d9c67d97d6f | 7260 | |
emh203 | 0:3d9c67d97d6f | 7261 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7262 | out = ((y1 * (0xFFFFF - xfract))); |
emh203 | 0:3d9c67d97d6f | 7263 | acc += (((q63_t) out * (yfract))); |
emh203 | 0:3d9c67d97d6f | 7264 | |
emh203 | 0:3d9c67d97d6f | 7265 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ |
emh203 | 0:3d9c67d97d6f | 7266 | out = ((y2 * (yfract))); |
emh203 | 0:3d9c67d97d6f | 7267 | acc += (((q63_t) out * (xfract))); |
emh203 | 0:3d9c67d97d6f | 7268 | |
emh203 | 0:3d9c67d97d6f | 7269 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ |
emh203 | 0:3d9c67d97d6f | 7270 | return (acc >> 40); |
emh203 | 0:3d9c67d97d6f | 7271 | |
emh203 | 0:3d9c67d97d6f | 7272 | } |
emh203 | 0:3d9c67d97d6f | 7273 | |
emh203 | 0:3d9c67d97d6f | 7274 | /** |
emh203 | 0:3d9c67d97d6f | 7275 | * @} end of BilinearInterpolate group |
emh203 | 0:3d9c67d97d6f | 7276 | */ |
emh203 | 0:3d9c67d97d6f | 7277 | |
emh203 | 0:3d9c67d97d6f | 7278 | |
emh203 | 0:3d9c67d97d6f | 7279 | #if defined ( __CC_ARM ) //Keil |
emh203 | 0:3d9c67d97d6f | 7280 | //SMMLAR |
emh203 | 0:3d9c67d97d6f | 7281 | #define multAcc_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7282 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) |
emh203 | 0:3d9c67d97d6f | 7283 | |
emh203 | 0:3d9c67d97d6f | 7284 | //SMMLSR |
emh203 | 0:3d9c67d97d6f | 7285 | #define multSub_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7286 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) |
emh203 | 0:3d9c67d97d6f | 7287 | |
emh203 | 0:3d9c67d97d6f | 7288 | //SMMULR |
emh203 | 0:3d9c67d97d6f | 7289 | #define mult_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7290 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) |
emh203 | 0:3d9c67d97d6f | 7291 | |
emh203 | 0:3d9c67d97d6f | 7292 | //Enter low optimization region - place directly above function definition |
emh203 | 0:3d9c67d97d6f | 7293 | #define LOW_OPTIMIZATION_ENTER \ |
emh203 | 0:3d9c67d97d6f | 7294 | _Pragma ("push") \ |
emh203 | 0:3d9c67d97d6f | 7295 | _Pragma ("O1") |
emh203 | 0:3d9c67d97d6f | 7296 | |
emh203 | 0:3d9c67d97d6f | 7297 | //Exit low optimization region - place directly after end of function definition |
emh203 | 0:3d9c67d97d6f | 7298 | #define LOW_OPTIMIZATION_EXIT \ |
emh203 | 0:3d9c67d97d6f | 7299 | _Pragma ("pop") |
emh203 | 0:3d9c67d97d6f | 7300 | |
emh203 | 0:3d9c67d97d6f | 7301 | //Enter low optimization region - place directly above function definition |
emh203 | 0:3d9c67d97d6f | 7302 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
emh203 | 0:3d9c67d97d6f | 7303 | |
emh203 | 0:3d9c67d97d6f | 7304 | //Exit low optimization region - place directly after end of function definition |
emh203 | 0:3d9c67d97d6f | 7305 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7306 | |
emh203 | 0:3d9c67d97d6f | 7307 | #elif defined(__ICCARM__) //IAR |
emh203 | 0:3d9c67d97d6f | 7308 | //SMMLA |
emh203 | 0:3d9c67d97d6f | 7309 | #define multAcc_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7310 | a += (q31_t) (((q63_t) x * y) >> 32) |
emh203 | 0:3d9c67d97d6f | 7311 | |
emh203 | 0:3d9c67d97d6f | 7312 | //SMMLS |
emh203 | 0:3d9c67d97d6f | 7313 | #define multSub_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7314 | a -= (q31_t) (((q63_t) x * y) >> 32) |
emh203 | 0:3d9c67d97d6f | 7315 | |
emh203 | 0:3d9c67d97d6f | 7316 | //SMMUL |
emh203 | 0:3d9c67d97d6f | 7317 | #define mult_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7318 | a = (q31_t) (((q63_t) x * y ) >> 32) |
emh203 | 0:3d9c67d97d6f | 7319 | |
emh203 | 0:3d9c67d97d6f | 7320 | //Enter low optimization region - place directly above function definition |
emh203 | 0:3d9c67d97d6f | 7321 | #define LOW_OPTIMIZATION_ENTER \ |
emh203 | 0:3d9c67d97d6f | 7322 | _Pragma ("optimize=low") |
emh203 | 0:3d9c67d97d6f | 7323 | |
emh203 | 0:3d9c67d97d6f | 7324 | //Exit low optimization region - place directly after end of function definition |
emh203 | 0:3d9c67d97d6f | 7325 | #define LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7326 | |
emh203 | 0:3d9c67d97d6f | 7327 | //Enter low optimization region - place directly above function definition |
emh203 | 0:3d9c67d97d6f | 7328 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ |
emh203 | 0:3d9c67d97d6f | 7329 | _Pragma ("optimize=low") |
emh203 | 0:3d9c67d97d6f | 7330 | |
emh203 | 0:3d9c67d97d6f | 7331 | //Exit low optimization region - place directly after end of function definition |
emh203 | 0:3d9c67d97d6f | 7332 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7333 | |
emh203 | 0:3d9c67d97d6f | 7334 | #elif defined(__GNUC__) |
emh203 | 0:3d9c67d97d6f | 7335 | //SMMLA |
emh203 | 0:3d9c67d97d6f | 7336 | #define multAcc_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7337 | a += (q31_t) (((q63_t) x * y) >> 32) |
emh203 | 0:3d9c67d97d6f | 7338 | |
emh203 | 0:3d9c67d97d6f | 7339 | //SMMLS |
emh203 | 0:3d9c67d97d6f | 7340 | #define multSub_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7341 | a -= (q31_t) (((q63_t) x * y) >> 32) |
emh203 | 0:3d9c67d97d6f | 7342 | |
emh203 | 0:3d9c67d97d6f | 7343 | //SMMUL |
emh203 | 0:3d9c67d97d6f | 7344 | #define mult_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7345 | a = (q31_t) (((q63_t) x * y ) >> 32) |
emh203 | 0:3d9c67d97d6f | 7346 | |
emh203 | 0:3d9c67d97d6f | 7347 | #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) |
emh203 | 0:3d9c67d97d6f | 7348 | |
emh203 | 0:3d9c67d97d6f | 7349 | #define LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7350 | |
emh203 | 0:3d9c67d97d6f | 7351 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
emh203 | 0:3d9c67d97d6f | 7352 | |
emh203 | 0:3d9c67d97d6f | 7353 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7354 | |
emh203 | 0:3d9c67d97d6f | 7355 | #elif defined(__CSMC__) // Cosmic |
emh203 | 0:3d9c67d97d6f | 7356 | //SMMLA |
emh203 | 0:3d9c67d97d6f | 7357 | #define multAcc_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7358 | a += (q31_t) (((q63_t) x * y) >> 32) |
emh203 | 0:3d9c67d97d6f | 7359 | |
emh203 | 0:3d9c67d97d6f | 7360 | //SMMLS |
emh203 | 0:3d9c67d97d6f | 7361 | #define multSub_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7362 | a -= (q31_t) (((q63_t) x * y) >> 32) |
emh203 | 0:3d9c67d97d6f | 7363 | |
emh203 | 0:3d9c67d97d6f | 7364 | //SMMUL |
emh203 | 0:3d9c67d97d6f | 7365 | #define mult_32x32_keep32_R(a, x, y) \ |
emh203 | 0:3d9c67d97d6f | 7366 | a = (q31_t) (((q63_t) x * y ) >> 32) |
emh203 | 0:3d9c67d97d6f | 7367 | |
emh203 | 0:3d9c67d97d6f | 7368 | #define LOW_OPTIMIZATION_ENTER |
emh203 | 0:3d9c67d97d6f | 7369 | #define LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7370 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
emh203 | 0:3d9c67d97d6f | 7371 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
emh203 | 0:3d9c67d97d6f | 7372 | |
emh203 | 0:3d9c67d97d6f | 7373 | #endif |
emh203 | 0:3d9c67d97d6f | 7374 | |
emh203 | 0:3d9c67d97d6f | 7375 | |
emh203 | 0:3d9c67d97d6f | 7376 | |
emh203 | 0:3d9c67d97d6f | 7377 | |
emh203 | 0:3d9c67d97d6f | 7378 | |
emh203 | 0:3d9c67d97d6f | 7379 | #ifdef __cplusplus |
emh203 | 0:3d9c67d97d6f | 7380 | } |
emh203 | 0:3d9c67d97d6f | 7381 | #endif |
emh203 | 0:3d9c67d97d6f | 7382 | |
emh203 | 0:3d9c67d97d6f | 7383 | |
emh203 | 0:3d9c67d97d6f | 7384 | #endif /* _ARM_MATH_H */ |
emh203 | 0:3d9c67d97d6f | 7385 | |
emh203 | 0:3d9c67d97d6f | 7386 | |
emh203 | 0:3d9c67d97d6f | 7387 | /** |
emh203 | 0:3d9c67d97d6f | 7388 | * |
emh203 | 0:3d9c67d97d6f | 7389 | * End of file. |
emh203 | 0:3d9c67d97d6f | 7390 | */ |