Lora4MakerFaire

Dependencies:   HC_SR04_Ultrasonic_Library X_NUCLEO_IKS01A2 mbed LoRaWAN-lib SX1272Lib

Fork of LoRaWANdemo72 by FabLab LoRa

Committer:
rschiano
Date:
Fri Dec 01 10:21:46 2017 +0000
Revision:
10:88f1c052f9e9
Parent:
8:346c55cb6033
LoraMakerFaire;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
salvatoregulfo 8:346c55cb6033 1 /* ----------------------------------------------------------------------
salvatoregulfo 8:346c55cb6033 2 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
salvatoregulfo 8:346c55cb6033 3 *
salvatoregulfo 8:346c55cb6033 4 * $Date: 19. March 2015
salvatoregulfo 8:346c55cb6033 5 * $Revision: V.1.4.5
salvatoregulfo 8:346c55cb6033 6 *
salvatoregulfo 8:346c55cb6033 7 7 * Project: CMSIS DSP Library
salvatoregulfo 8:346c55cb6033 8 8 * Title: arm_math.h
salvatoregulfo 8:346c55cb6033 9 9 *
salvatoregulfo 8:346c55cb6033 10 10 * Description: Public header file for CMSIS DSP Library
salvatoregulfo 8:346c55cb6033 11 11 *
salvatoregulfo 8:346c55cb6033 12 12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
salvatoregulfo 8:346c55cb6033 13 13 *
salvatoregulfo 8:346c55cb6033 14 14 * Redistribution and use in source and binary forms, with or without
salvatoregulfo 8:346c55cb6033 15 15 * modification, are permitted provided that the following conditions
salvatoregulfo 8:346c55cb6033 16 16 * are met:
salvatoregulfo 8:346c55cb6033 17 17 * - Redistributions of source code must retain the above copyright
salvatoregulfo 8:346c55cb6033 18 18 * notice, this list of conditions and the following disclaimer.
salvatoregulfo 8:346c55cb6033 19 19 * - Redistributions in binary form must reproduce the above copyright
salvatoregulfo 8:346c55cb6033 20 20 * notice, this list of conditions and the following disclaimer in
salvatoregulfo 8:346c55cb6033 21 21 * the documentation and/or other materials provided with the
salvatoregulfo 8:346c55cb6033 22 22 * distribution.
salvatoregulfo 8:346c55cb6033 23 23 * - Neither the name of ARM LIMITED nor the names of its contributors
salvatoregulfo 8:346c55cb6033 24 24 * may be used to endorse or promote products derived from this
salvatoregulfo 8:346c55cb6033 25 25 * software without specific prior written permission.
salvatoregulfo 8:346c55cb6033 26 26 *
salvatoregulfo 8:346c55cb6033 27 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
salvatoregulfo 8:346c55cb6033 28 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
salvatoregulfo 8:346c55cb6033 29 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
salvatoregulfo 8:346c55cb6033 30 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
salvatoregulfo 8:346c55cb6033 31 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
salvatoregulfo 8:346c55cb6033 32 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
salvatoregulfo 8:346c55cb6033 33 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
salvatoregulfo 8:346c55cb6033 34 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
salvatoregulfo 8:346c55cb6033 35 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
salvatoregulfo 8:346c55cb6033 36 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
salvatoregulfo 8:346c55cb6033 37 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
salvatoregulfo 8:346c55cb6033 38 38 * POSSIBILITY OF SUCH DAMAGE.
salvatoregulfo 8:346c55cb6033 39 39 * -------------------------------------------------------------------- */
salvatoregulfo 8:346c55cb6033 40
salvatoregulfo 8:346c55cb6033 41 /**
salvatoregulfo 8:346c55cb6033 42 42 \mainpage CMSIS DSP Software Library
salvatoregulfo 8:346c55cb6033 43 43 *
salvatoregulfo 8:346c55cb6033 44 44 * Introduction
salvatoregulfo 8:346c55cb6033 45 45 * ------------
salvatoregulfo 8:346c55cb6033 46 46 *
salvatoregulfo 8:346c55cb6033 47 47 * This user manual describes the CMSIS DSP software library,
salvatoregulfo 8:346c55cb6033 48 48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
salvatoregulfo 8:346c55cb6033 49 49 *
salvatoregulfo 8:346c55cb6033 50 50 * The library is divided into a number of functions each covering a specific category:
salvatoregulfo 8:346c55cb6033 51 51 * - Basic math functions
salvatoregulfo 8:346c55cb6033 52 52 * - Fast math functions
salvatoregulfo 8:346c55cb6033 53 53 * - Complex math functions
salvatoregulfo 8:346c55cb6033 54 54 * - Filters
salvatoregulfo 8:346c55cb6033 55 55 * - Matrix functions
salvatoregulfo 8:346c55cb6033 56 56 * - Transforms
salvatoregulfo 8:346c55cb6033 57 57 * - Motor control functions
salvatoregulfo 8:346c55cb6033 58 58 * - Statistical functions
salvatoregulfo 8:346c55cb6033 59 59 * - Support functions
salvatoregulfo 8:346c55cb6033 60 60 * - Interpolation functions
salvatoregulfo 8:346c55cb6033 61 61 *
salvatoregulfo 8:346c55cb6033 62 62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
salvatoregulfo 8:346c55cb6033 63 63 * 32-bit integer and 32-bit floating-point values.
salvatoregulfo 8:346c55cb6033 64 64 *
salvatoregulfo 8:346c55cb6033 65 65 * Using the Library
salvatoregulfo 8:346c55cb6033 66 66 * ------------
salvatoregulfo 8:346c55cb6033 67 67 *
salvatoregulfo 8:346c55cb6033 68 68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
salvatoregulfo 8:346c55cb6033 69 69 * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
salvatoregulfo 8:346c55cb6033 70 70 * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
salvatoregulfo 8:346c55cb6033 71 71 * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
salvatoregulfo 8:346c55cb6033 72 72 * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
salvatoregulfo 8:346c55cb6033 73 73 * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
salvatoregulfo 8:346c55cb6033 74 74 * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
salvatoregulfo 8:346c55cb6033 75 75 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
salvatoregulfo 8:346c55cb6033 76 76 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
salvatoregulfo 8:346c55cb6033 77 77 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
salvatoregulfo 8:346c55cb6033 78 78 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
salvatoregulfo 8:346c55cb6033 79 79 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
salvatoregulfo 8:346c55cb6033 80 80 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
salvatoregulfo 8:346c55cb6033 81 81 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
salvatoregulfo 8:346c55cb6033 82 82 * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
salvatoregulfo 8:346c55cb6033 83 83 *
salvatoregulfo 8:346c55cb6033 84 84 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
salvatoregulfo 8:346c55cb6033 85 85 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
salvatoregulfo 8:346c55cb6033 86 86 * public header file <code> arm_math.h</code> for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
salvatoregulfo 8:346c55cb6033 87 87 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
salvatoregulfo 8:346c55cb6033 88 88 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
salvatoregulfo 8:346c55cb6033 89 89 *
salvatoregulfo 8:346c55cb6033 90 90 * Examples
salvatoregulfo 8:346c55cb6033 91 91 * --------
salvatoregulfo 8:346c55cb6033 92 92 *
salvatoregulfo 8:346c55cb6033 93 93 * The library ships with a number of examples which demonstrate how to use the library functions.
salvatoregulfo 8:346c55cb6033 94 94 *
salvatoregulfo 8:346c55cb6033 95 95 * Toolchain Support
salvatoregulfo 8:346c55cb6033 96 96 * ------------
salvatoregulfo 8:346c55cb6033 97 97 *
salvatoregulfo 8:346c55cb6033 98 98 * The library has been developed and tested with MDK-ARM version 5.14.0.0
salvatoregulfo 8:346c55cb6033 99 99 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
salvatoregulfo 8:346c55cb6033 100 100 *
salvatoregulfo 8:346c55cb6033 101 101 * Building the Library
salvatoregulfo 8:346c55cb6033 102 102 * ------------
salvatoregulfo 8:346c55cb6033 103 103 *
salvatoregulfo 8:346c55cb6033 104 104 * 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.
salvatoregulfo 8:346c55cb6033 105 105 * - arm_cortexM_math.uvprojx
salvatoregulfo 8:346c55cb6033 106 106 *
salvatoregulfo 8:346c55cb6033 107 107 *
salvatoregulfo 8:346c55cb6033 108 108 * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
salvatoregulfo 8:346c55cb6033 109 109 *
salvatoregulfo 8:346c55cb6033 110 110 * Pre-processor Macros
salvatoregulfo 8:346c55cb6033 111 111 * ------------
salvatoregulfo 8:346c55cb6033 112 112 *
salvatoregulfo 8:346c55cb6033 113 113 * Each library project have differant pre-processor macros.
salvatoregulfo 8:346c55cb6033 114 114 *
salvatoregulfo 8:346c55cb6033 115 115 * - UNALIGNED_SUPPORT_DISABLE:
salvatoregulfo 8:346c55cb6033 116 116 *
salvatoregulfo 8:346c55cb6033 117 117 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
salvatoregulfo 8:346c55cb6033 118 118 *
salvatoregulfo 8:346c55cb6033 119 119 * - ARM_MATH_BIG_ENDIAN:
salvatoregulfo 8:346c55cb6033 120 120 *
salvatoregulfo 8:346c55cb6033 121 121 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
salvatoregulfo 8:346c55cb6033 122 122 *
salvatoregulfo 8:346c55cb6033 123 123 * - ARM_MATH_MATRIX_CHECK:
salvatoregulfo 8:346c55cb6033 124 124 *
salvatoregulfo 8:346c55cb6033 125 125 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
salvatoregulfo 8:346c55cb6033 126 126 *
salvatoregulfo 8:346c55cb6033 127 127 * - ARM_MATH_ROUNDING:
salvatoregulfo 8:346c55cb6033 128 128 *
salvatoregulfo 8:346c55cb6033 129 129 * Define macro ARM_MATH_ROUNDING for rounding on support functions
salvatoregulfo 8:346c55cb6033 130 130 *
salvatoregulfo 8:346c55cb6033 131 131 * - ARM_MATH_CMx:
salvatoregulfo 8:346c55cb6033 132 132 *
salvatoregulfo 8:346c55cb6033 133 133 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
salvatoregulfo 8:346c55cb6033 134 134 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
salvatoregulfo 8:346c55cb6033 135 135 * ARM_MATH_CM7 for building the library on cortex-M7.
salvatoregulfo 8:346c55cb6033 136 136 *
salvatoregulfo 8:346c55cb6033 137 137 * - __FPU_PRESENT:
salvatoregulfo 8:346c55cb6033 138 138 *
salvatoregulfo 8:346c55cb6033 139 139 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
salvatoregulfo 8:346c55cb6033 140 140 *
salvatoregulfo 8:346c55cb6033 141 141 * <hr>
salvatoregulfo 8:346c55cb6033 142 142 * CMSIS-DSP in ARM::CMSIS Pack
salvatoregulfo 8:346c55cb6033 143 143 * -----------------------------
salvatoregulfo 8:346c55cb6033 144 144 *
salvatoregulfo 8:346c55cb6033 145 145 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
salvatoregulfo 8:346c55cb6033 146 146 * |File/Folder |Content |
salvatoregulfo 8:346c55cb6033 147 147 * |------------------------------|------------------------------------------------------------------------|
salvatoregulfo 8:346c55cb6033 148 148 * |\b CMSIS\\Documentation\\DSP | This documentation |
salvatoregulfo 8:346c55cb6033 149 149 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
salvatoregulfo 8:346c55cb6033 150 150 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
salvatoregulfo 8:346c55cb6033 151 151 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
salvatoregulfo 8:346c55cb6033 152 152 *
salvatoregulfo 8:346c55cb6033 153 153 * <hr>
salvatoregulfo 8:346c55cb6033 154 154 * Revision History of CMSIS-DSP
salvatoregulfo 8:346c55cb6033 155 155 * ------------
salvatoregulfo 8:346c55cb6033 156 156 * Please refer to \ref ChangeLog_pg.
salvatoregulfo 8:346c55cb6033 157 157 *
salvatoregulfo 8:346c55cb6033 158 158 * Copyright Notice
salvatoregulfo 8:346c55cb6033 159 159 * ------------
salvatoregulfo 8:346c55cb6033 160 160 *
salvatoregulfo 8:346c55cb6033 161 161 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
salvatoregulfo 8:346c55cb6033 162 162 */
salvatoregulfo 8:346c55cb6033 163
salvatoregulfo 8:346c55cb6033 164
salvatoregulfo 8:346c55cb6033 165 /**
salvatoregulfo 8:346c55cb6033 166 166 * @defgroup groupMath Basic Math Functions
salvatoregulfo 8:346c55cb6033 167 167 */
salvatoregulfo 8:346c55cb6033 168
salvatoregulfo 8:346c55cb6033 169 /**
salvatoregulfo 8:346c55cb6033 170 170 * @defgroup groupFastMath Fast Math Functions
salvatoregulfo 8:346c55cb6033 171 171 * This set of functions provides a fast approximation to sine, cosine, and square root.
salvatoregulfo 8:346c55cb6033 172 172 * As compared to most of the other functions in the CMSIS math library, the fast math functions
salvatoregulfo 8:346c55cb6033 173 173 * operate on individual values and not arrays.
salvatoregulfo 8:346c55cb6033 174 174 * There are separate functions for Q15, Q31, and floating-point data.
salvatoregulfo 8:346c55cb6033 175 175 *
salvatoregulfo 8:346c55cb6033 176 176 */
salvatoregulfo 8:346c55cb6033 177
salvatoregulfo 8:346c55cb6033 178 /**
salvatoregulfo 8:346c55cb6033 179 179 * @defgroup groupCmplxMath Complex Math Functions
salvatoregulfo 8:346c55cb6033 180 180 * This set of functions operates on complex data vectors.
salvatoregulfo 8:346c55cb6033 181 181 * The data in the complex arrays is stored in an interleaved fashion
salvatoregulfo 8:346c55cb6033 182 182 * (real, imag, real, imag, ...).
salvatoregulfo 8:346c55cb6033 183 183 * In the API functions, the number of samples in a complex array refers
salvatoregulfo 8:346c55cb6033 184 184 * to the number of complex values; the array contains twice this number of
salvatoregulfo 8:346c55cb6033 185 185 * real values.
salvatoregulfo 8:346c55cb6033 186 186 */
salvatoregulfo 8:346c55cb6033 187
salvatoregulfo 8:346c55cb6033 188 /**
salvatoregulfo 8:346c55cb6033 189 189 * @defgroup groupFilters Filtering Functions
salvatoregulfo 8:346c55cb6033 190 190 */
salvatoregulfo 8:346c55cb6033 191
salvatoregulfo 8:346c55cb6033 192 /**
salvatoregulfo 8:346c55cb6033 193 193 * @defgroup groupMatrix Matrix Functions
salvatoregulfo 8:346c55cb6033 194 194 *
salvatoregulfo 8:346c55cb6033 195 195 * This set of functions provides basic matrix math operations.
salvatoregulfo 8:346c55cb6033 196 196 * The functions operate on matrix data structures. For example,
salvatoregulfo 8:346c55cb6033 197 197 * the type
salvatoregulfo 8:346c55cb6033 198 198 * definition for the floating-point matrix structure is shown
salvatoregulfo 8:346c55cb6033 199 199 * below:
salvatoregulfo 8:346c55cb6033 200 200 * <pre>
salvatoregulfo 8:346c55cb6033 201 201 * typedef struct
salvatoregulfo 8:346c55cb6033 202 202 * {
salvatoregulfo 8:346c55cb6033 203 203 * uint16_t numRows; // number of rows of the matrix.
salvatoregulfo 8:346c55cb6033 204 204 * uint16_t numCols; // number of columns of the matrix.
salvatoregulfo 8:346c55cb6033 205 205 * float32_t *pData; // points to the data of the matrix.
salvatoregulfo 8:346c55cb6033 206 206 * } arm_matrix_instance_f32;
salvatoregulfo 8:346c55cb6033 207 207 * </pre>
salvatoregulfo 8:346c55cb6033 208 208 * There are similar definitions for Q15 and Q31 data types.
salvatoregulfo 8:346c55cb6033 209 209 *
salvatoregulfo 8:346c55cb6033 210 210 * The structure specifies the size of the matrix and then points to
salvatoregulfo 8:346c55cb6033 211 211 * an array of data. The array is of size <code>numRows X numCols</code>
salvatoregulfo 8:346c55cb6033 212 212 * and the values are arranged in row order. That is, the
salvatoregulfo 8:346c55cb6033 213 213 * matrix element (i, j) is stored at:
salvatoregulfo 8:346c55cb6033 214 214 * <pre>
salvatoregulfo 8:346c55cb6033 215 215 * pData[i*numCols + j]
salvatoregulfo 8:346c55cb6033 216 216 * </pre>
salvatoregulfo 8:346c55cb6033 217 217 *
salvatoregulfo 8:346c55cb6033 218 218 * \par Init Functions
salvatoregulfo 8:346c55cb6033 219 219 * There is an associated initialization function for each type of matrix
salvatoregulfo 8:346c55cb6033 220 220 * data structure.
salvatoregulfo 8:346c55cb6033 221 221 * The initialization function sets the values of the internal structure fields.
salvatoregulfo 8:346c55cb6033 222 222 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
salvatoregulfo 8:346c55cb6033 223 223 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
salvatoregulfo 8:346c55cb6033 224 224 *
salvatoregulfo 8:346c55cb6033 225 225 * \par
salvatoregulfo 8:346c55cb6033 226 226 * Use of the initialization function is optional. However, if initialization function is used
salvatoregulfo 8:346c55cb6033 227 227 * then the instance structure cannot be placed into a const data section.
salvatoregulfo 8:346c55cb6033 228 228 * To place the instance structure in a const data
salvatoregulfo 8:346c55cb6033 229 229 * section, manually initialize the data structure. For example:
salvatoregulfo 8:346c55cb6033 230 230 * <pre>
salvatoregulfo 8:346c55cb6033 231 231 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
salvatoregulfo 8:346c55cb6033 232 232 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
salvatoregulfo 8:346c55cb6033 233 233 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
salvatoregulfo 8:346c55cb6033 234 234 * </pre>
salvatoregulfo 8:346c55cb6033 235 235 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
salvatoregulfo 8:346c55cb6033 236 236 * specifies the number of columns, and <code>pData</code> points to the
salvatoregulfo 8:346c55cb6033 237 237 * data array.
salvatoregulfo 8:346c55cb6033 238 238 *
salvatoregulfo 8:346c55cb6033 239 239 * \par Size Checking
salvatoregulfo 8:346c55cb6033 240 240 * By default all of the matrix functions perform size checking on the input and
salvatoregulfo 8:346c55cb6033 241 241 * output matrices. For example, the matrix addition function verifies that the
salvatoregulfo 8:346c55cb6033 242 242 * two input matrices and the output matrix all have the same number of rows and
salvatoregulfo 8:346c55cb6033 243 243 * columns. If the size check fails the functions return:
salvatoregulfo 8:346c55cb6033 244 244 * <pre>
salvatoregulfo 8:346c55cb6033 245 245 * ARM_MATH_SIZE_MISMATCH
salvatoregulfo 8:346c55cb6033 246 246 * </pre>
salvatoregulfo 8:346c55cb6033 247 247 * Otherwise the functions return
salvatoregulfo 8:346c55cb6033 248 248 * <pre>
salvatoregulfo 8:346c55cb6033 249 249 * ARM_MATH_SUCCESS
salvatoregulfo 8:346c55cb6033 250 250 * </pre>
salvatoregulfo 8:346c55cb6033 251 251 * There is some overhead associated with this matrix size checking.
salvatoregulfo 8:346c55cb6033 252 252 * The matrix size checking is enabled via the \#define
salvatoregulfo 8:346c55cb6033 253 253 * <pre>
salvatoregulfo 8:346c55cb6033 254 254 * ARM_MATH_MATRIX_CHECK
salvatoregulfo 8:346c55cb6033 255 255 * </pre>
salvatoregulfo 8:346c55cb6033 256 256 * within the library project settings. By default this macro is defined
salvatoregulfo 8:346c55cb6033 257 257 * and size checking is enabled. By changing the project settings and
salvatoregulfo 8:346c55cb6033 258 258 * undefining this macro size checking is eliminated and the functions
salvatoregulfo 8:346c55cb6033 259 259 * run a bit faster. With size checking disabled the functions always
salvatoregulfo 8:346c55cb6033 260 260 * return <code>ARM_MATH_SUCCESS</code>.
salvatoregulfo 8:346c55cb6033 261 261 */
salvatoregulfo 8:346c55cb6033 262
salvatoregulfo 8:346c55cb6033 263 /**
salvatoregulfo 8:346c55cb6033 264 264 * @defgroup groupTransforms Transform Functions
salvatoregulfo 8:346c55cb6033 265 265 */
salvatoregulfo 8:346c55cb6033 266
salvatoregulfo 8:346c55cb6033 267 /**
salvatoregulfo 8:346c55cb6033 268 268 * @defgroup groupController Controller Functions
salvatoregulfo 8:346c55cb6033 269 269 */
salvatoregulfo 8:346c55cb6033 270
salvatoregulfo 8:346c55cb6033 271 /**
salvatoregulfo 8:346c55cb6033 272 272 * @defgroup groupStats Statistics Functions
salvatoregulfo 8:346c55cb6033 273 273 */
salvatoregulfo 8:346c55cb6033 274 /**
salvatoregulfo 8:346c55cb6033 275 275 * @defgroup groupSupport Support Functions
salvatoregulfo 8:346c55cb6033 276 276 */
salvatoregulfo 8:346c55cb6033 277
salvatoregulfo 8:346c55cb6033 278 /**
salvatoregulfo 8:346c55cb6033 279 279 * @defgroup groupInterpolation Interpolation Functions
salvatoregulfo 8:346c55cb6033 280 280 * These functions perform 1- and 2-dimensional interpolation of data.
salvatoregulfo 8:346c55cb6033 281 281 * Linear interpolation is used for 1-dimensional data and
salvatoregulfo 8:346c55cb6033 282 282 * bilinear interpolation is used for 2-dimensional data.
salvatoregulfo 8:346c55cb6033 283 283 */
salvatoregulfo 8:346c55cb6033 284
salvatoregulfo 8:346c55cb6033 285 /**
salvatoregulfo 8:346c55cb6033 286 286 * @defgroup groupExamples Examples
salvatoregulfo 8:346c55cb6033 287 287 */
salvatoregulfo 8:346c55cb6033 288 #ifndef _ARM_MATH_H
salvatoregulfo 8:346c55cb6033 289 #define _ARM_MATH_H
salvatoregulfo 8:346c55cb6033 290
salvatoregulfo 8:346c55cb6033 291 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
salvatoregulfo 8:346c55cb6033 292
salvatoregulfo 8:346c55cb6033 293 #if defined(ARM_MATH_CM7)
salvatoregulfo 8:346c55cb6033 294 #include "core_cm7.h"
salvatoregulfo 8:346c55cb6033 295 #elif defined (ARM_MATH_CM4)
salvatoregulfo 8:346c55cb6033 296 #include "core_cm4.h"
salvatoregulfo 8:346c55cb6033 297 #elif defined (ARM_MATH_CM3)
salvatoregulfo 8:346c55cb6033 298 #include "core_cm3.h"
salvatoregulfo 8:346c55cb6033 299 #elif defined (ARM_MATH_CM0)
salvatoregulfo 8:346c55cb6033 300 #include "core_cm0.h"
salvatoregulfo 8:346c55cb6033 301 #define ARM_MATH_CM0_FAMILY
salvatoregulfo 8:346c55cb6033 302 #elif defined (ARM_MATH_CM0PLUS)
salvatoregulfo 8:346c55cb6033 303 #include "core_cm0plus.h"
salvatoregulfo 8:346c55cb6033 304 #define ARM_MATH_CM0_FAMILY
salvatoregulfo 8:346c55cb6033 305 #else
salvatoregulfo 8:346c55cb6033 306 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
salvatoregulfo 8:346c55cb6033 307 #endif
salvatoregulfo 8:346c55cb6033 308 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
salvatoregulfo 8:346c55cb6033 309 #include "string.h"
salvatoregulfo 8:346c55cb6033 310 #include "math.h"
salvatoregulfo 8:346c55cb6033 311 #ifdef __cplusplus
salvatoregulfo 8:346c55cb6033 312 extern "C"
salvatoregulfo 8:346c55cb6033 313 {
salvatoregulfo 8:346c55cb6033 314 #endif
salvatoregulfo 8:346c55cb6033 315
salvatoregulfo 8:346c55cb6033 316
salvatoregulfo 8:346c55cb6033 317 /**
salvatoregulfo 8:346c55cb6033 318 319 * @brief Macros required for reciprocal calculation in Normalized LMS
salvatoregulfo 8:346c55cb6033 319 320 */
salvatoregulfo 8:346c55cb6033 320
salvatoregulfo 8:346c55cb6033 321 #define DELTA_Q31 (0x100)
salvatoregulfo 8:346c55cb6033 322 #define DELTA_Q15 0x5
salvatoregulfo 8:346c55cb6033 323 #define INDEX_MASK 0x0000003F
salvatoregulfo 8:346c55cb6033 324 #ifndef PI
salvatoregulfo 8:346c55cb6033 325 #define PI 3.14159265358979f
salvatoregulfo 8:346c55cb6033 326 #endif
salvatoregulfo 8:346c55cb6033 327
salvatoregulfo 8:346c55cb6033 328 /**
salvatoregulfo 8:346c55cb6033 329 330 * @brief Macros required for SINE and COSINE Fast math approximations
salvatoregulfo 8:346c55cb6033 330 331 */
salvatoregulfo 8:346c55cb6033 331
salvatoregulfo 8:346c55cb6033 332 #define FAST_MATH_TABLE_SIZE 512
salvatoregulfo 8:346c55cb6033 333 #define FAST_MATH_Q31_SHIFT (32 - 10)
salvatoregulfo 8:346c55cb6033 334 #define FAST_MATH_Q15_SHIFT (16 - 10)
salvatoregulfo 8:346c55cb6033 335 #define CONTROLLER_Q31_SHIFT (32 - 9)
salvatoregulfo 8:346c55cb6033 336 #define TABLE_SIZE 256
salvatoregulfo 8:346c55cb6033 337 #define TABLE_SPACING_Q31 0x400000
salvatoregulfo 8:346c55cb6033 338 #define TABLE_SPACING_Q15 0x80
salvatoregulfo 8:346c55cb6033 339
salvatoregulfo 8:346c55cb6033 340 /**
salvatoregulfo 8:346c55cb6033 341 342 * @brief Macros required for SINE and COSINE Controller functions
salvatoregulfo 8:346c55cb6033 342 343 */
salvatoregulfo 8:346c55cb6033 343 /* 1.31(q31) Fixed value of 2/360 */
salvatoregulfo 8:346c55cb6033 344 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
salvatoregulfo 8:346c55cb6033 345 #define INPUT_SPACING 0xB60B61
salvatoregulfo 8:346c55cb6033 346
salvatoregulfo 8:346c55cb6033 347 /**
salvatoregulfo 8:346c55cb6033 348 349 * @brief Macro for Unaligned Support
salvatoregulfo 8:346c55cb6033 349 350 */
salvatoregulfo 8:346c55cb6033 350 #ifndef UNALIGNED_SUPPORT_DISABLE
salvatoregulfo 8:346c55cb6033 351 #define ALIGN4
salvatoregulfo 8:346c55cb6033 352 #else
salvatoregulfo 8:346c55cb6033 353 #if defined (__GNUC__)
salvatoregulfo 8:346c55cb6033 354 #define ALIGN4 __attribute__((aligned(4)))
salvatoregulfo 8:346c55cb6033 355 #else
salvatoregulfo 8:346c55cb6033 356 #define ALIGN4 __align(4)
salvatoregulfo 8:346c55cb6033 357 #endif
salvatoregulfo 8:346c55cb6033 358 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
salvatoregulfo 8:346c55cb6033 359
salvatoregulfo 8:346c55cb6033 360 /**
salvatoregulfo 8:346c55cb6033 361 362 * @brief Error status returned by some functions in the library.
salvatoregulfo 8:346c55cb6033 362 363 */
salvatoregulfo 8:346c55cb6033 363
salvatoregulfo 8:346c55cb6033 364 typedef enum
salvatoregulfo 8:346c55cb6033 365 {
salvatoregulfo 8:346c55cb6033 366 ARM_MATH_SUCCESS = 0, /**< No error */
salvatoregulfo 8:346c55cb6033 367 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
salvatoregulfo 8:346c55cb6033 368 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
salvatoregulfo 8:346c55cb6033 369 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
salvatoregulfo 8:346c55cb6033 370 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
salvatoregulfo 8:346c55cb6033 371 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
salvatoregulfo 8:346c55cb6033 372 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
salvatoregulfo 8:346c55cb6033 373 } arm_status;
salvatoregulfo 8:346c55cb6033 374
salvatoregulfo 8:346c55cb6033 375 /**
salvatoregulfo 8:346c55cb6033 376 377 * @brief 8-bit fractional data type in 1.7 format.
salvatoregulfo 8:346c55cb6033 377 378 */
salvatoregulfo 8:346c55cb6033 378 typedef int8_t q7_t;
salvatoregulfo 8:346c55cb6033 379
salvatoregulfo 8:346c55cb6033 380 /**
salvatoregulfo 8:346c55cb6033 381 382 * @brief 16-bit fractional data type in 1.15 format.
salvatoregulfo 8:346c55cb6033 382 383 */
salvatoregulfo 8:346c55cb6033 383 typedef int16_t q15_t;
salvatoregulfo 8:346c55cb6033 384
salvatoregulfo 8:346c55cb6033 385 /**
salvatoregulfo 8:346c55cb6033 386 387 * @brief 32-bit fractional data type in 1.31 format.
salvatoregulfo 8:346c55cb6033 387 388 */
salvatoregulfo 8:346c55cb6033 388 typedef int32_t q31_t;
salvatoregulfo 8:346c55cb6033 389
salvatoregulfo 8:346c55cb6033 390 /**
salvatoregulfo 8:346c55cb6033 391 392 * @brief 64-bit fractional data type in 1.63 format.
salvatoregulfo 8:346c55cb6033 392 393 */
salvatoregulfo 8:346c55cb6033 393 394 typedef int64_t q63_t;
salvatoregulfo 8:346c55cb6033 394 395
salvatoregulfo 8:346c55cb6033 395 396 /**
salvatoregulfo 8:346c55cb6033 396 397 * @brief 32-bit floating-point type definition.
salvatoregulfo 8:346c55cb6033 397 398 */
salvatoregulfo 8:346c55cb6033 398 399 typedef float float32_t;
salvatoregulfo 8:346c55cb6033 399 400
salvatoregulfo 8:346c55cb6033 400 401 /**
salvatoregulfo 8:346c55cb6033 401 402 * @brief 64-bit floating-point type definition.
salvatoregulfo 8:346c55cb6033 402 403 */
salvatoregulfo 8:346c55cb6033 403 404 typedef double float64_t;
salvatoregulfo 8:346c55cb6033 404 405
salvatoregulfo 8:346c55cb6033 405 406 /**
salvatoregulfo 8:346c55cb6033 406 407 * @brief definition to read/write two 16 bit values.
salvatoregulfo 8:346c55cb6033 407 408 */
salvatoregulfo 8:346c55cb6033 408 409 #if defined __CC_ARM
salvatoregulfo 8:346c55cb6033 409 410 #define __SIMD32_TYPE int32_t __packed
salvatoregulfo 8:346c55cb6033 410 411 #define CMSIS_UNUSED __attribute__((unused))
salvatoregulfo 8:346c55cb6033 411 412 #elif defined __ICCARM__
salvatoregulfo 8:346c55cb6033 412 413 #define __SIMD32_TYPE int32_t __packed
salvatoregulfo 8:346c55cb6033 413 414 #define CMSIS_UNUSED
salvatoregulfo 8:346c55cb6033 414 415 #elif defined __GNUC__
salvatoregulfo 8:346c55cb6033 415 416 #define __SIMD32_TYPE int32_t
salvatoregulfo 8:346c55cb6033 416 417 #define CMSIS_UNUSED __attribute__((unused))
salvatoregulfo 8:346c55cb6033 417 418 #elif defined __CSMC__ /* Cosmic */
salvatoregulfo 8:346c55cb6033 418 419 #define __SIMD32_TYPE int32_t
salvatoregulfo 8:346c55cb6033 419 420 #define CMSIS_UNUSED
salvatoregulfo 8:346c55cb6033 420 421 #elif defined __TASKING__
salvatoregulfo 8:346c55cb6033 421 422 #define __SIMD32_TYPE __unaligned int32_t
salvatoregulfo 8:346c55cb6033 422 423 #define CMSIS_UNUSED
salvatoregulfo 8:346c55cb6033 423 424 #else
salvatoregulfo 8:346c55cb6033 424 425 #error Unknown compiler
salvatoregulfo 8:346c55cb6033 425 426 #endif
salvatoregulfo 8:346c55cb6033 426 427
salvatoregulfo 8:346c55cb6033 427 428 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
salvatoregulfo 8:346c55cb6033 428 429 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
salvatoregulfo 8:346c55cb6033 429 430
salvatoregulfo 8:346c55cb6033 430 431 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
salvatoregulfo 8:346c55cb6033 431 432
salvatoregulfo 8:346c55cb6033 432 433 #define __SIMD64(addr) (*(int64_t **) & (addr))
salvatoregulfo 8:346c55cb6033 433 434
salvatoregulfo 8:346c55cb6033 434 435 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
salvatoregulfo 8:346c55cb6033 435 436 /**
salvatoregulfo 8:346c55cb6033 436 437 * @brief definition to pack two 16 bit values.
salvatoregulfo 8:346c55cb6033 437 438 */
salvatoregulfo 8:346c55cb6033 438 439 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
salvatoregulfo 8:346c55cb6033 439 440 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
salvatoregulfo 8:346c55cb6033 440 441 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
salvatoregulfo 8:346c55cb6033 441 442 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
salvatoregulfo 8:346c55cb6033 442 443
salvatoregulfo 8:346c55cb6033 443 444 #endif
salvatoregulfo 8:346c55cb6033 444 445
salvatoregulfo 8:346c55cb6033 445 446
salvatoregulfo 8:346c55cb6033 446 447 /**
salvatoregulfo 8:346c55cb6033 447 448 * @brief definition to pack four 8 bit values.
salvatoregulfo 8:346c55cb6033 448 449 */
salvatoregulfo 8:346c55cb6033 449 450 #ifndef ARM_MATH_BIG_ENDIAN
salvatoregulfo 8:346c55cb6033 450 451
salvatoregulfo 8:346c55cb6033 451 452 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
salvatoregulfo 8:346c55cb6033 452 453 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
salvatoregulfo 8:346c55cb6033 453 454 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
salvatoregulfo 8:346c55cb6033 454 455 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
salvatoregulfo 8:346c55cb6033 455 456 #else
salvatoregulfo 8:346c55cb6033 456 457
salvatoregulfo 8:346c55cb6033 457 458 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
salvatoregulfo 8:346c55cb6033 458 459 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
salvatoregulfo 8:346c55cb6033 459 460 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
salvatoregulfo 8:346c55cb6033 460 461 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
salvatoregulfo 8:346c55cb6033 461 462
salvatoregulfo 8:346c55cb6033 462 463 #endif
salvatoregulfo 8:346c55cb6033 463 464
salvatoregulfo 8:346c55cb6033 464 465
salvatoregulfo 8:346c55cb6033 465 466 /**
salvatoregulfo 8:346c55cb6033 466 467 * @brief Clips Q63 to Q31 values.
salvatoregulfo 8:346c55cb6033 467 468 */
salvatoregulfo 8:346c55cb6033 468 469 static __INLINE q31_t clip_q63_to_q31(
salvatoregulfo 8:346c55cb6033 469 470 q63_t x)
salvatoregulfo 8:346c55cb6033 470 471 {
salvatoregulfo 8:346c55cb6033 471 472 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
salvatoregulfo 8:346c55cb6033 472 473 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
salvatoregulfo 8:346c55cb6033 473 474 }
salvatoregulfo 8:346c55cb6033 474 475
salvatoregulfo 8:346c55cb6033 475 476 /**
salvatoregulfo 8:346c55cb6033 476 477 * @brief Clips Q63 to Q15 values.
salvatoregulfo 8:346c55cb6033 477 478 */
salvatoregulfo 8:346c55cb6033 478 479 static __INLINE q15_t clip_q63_to_q15(
salvatoregulfo 8:346c55cb6033 479 480 q63_t x)
salvatoregulfo 8:346c55cb6033 480 481 {
salvatoregulfo 8:346c55cb6033 481 482 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
salvatoregulfo 8:346c55cb6033 482 483 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
salvatoregulfo 8:346c55cb6033 483 484 }
salvatoregulfo 8:346c55cb6033 484 485
salvatoregulfo 8:346c55cb6033 485 486 /**
salvatoregulfo 8:346c55cb6033 486 487 * @brief Clips Q31 to Q7 values.
salvatoregulfo 8:346c55cb6033 487 488 */
salvatoregulfo 8:346c55cb6033 488 489 static __INLINE q7_t clip_q31_to_q7(
salvatoregulfo 8:346c55cb6033 489 490 q31_t x)
salvatoregulfo 8:346c55cb6033 490 491 {
salvatoregulfo 8:346c55cb6033 491 492 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
salvatoregulfo 8:346c55cb6033 492 493 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
salvatoregulfo 8:346c55cb6033 493 494 }
salvatoregulfo 8:346c55cb6033 494 495
salvatoregulfo 8:346c55cb6033 495 496 /**
salvatoregulfo 8:346c55cb6033 496 497 * @brief Clips Q31 to Q15 values.
salvatoregulfo 8:346c55cb6033 497 498 */
salvatoregulfo 8:346c55cb6033 498 499 static __INLINE q15_t clip_q31_to_q15(
salvatoregulfo 8:346c55cb6033 499 500 q31_t x)
salvatoregulfo 8:346c55cb6033 500 501 {
salvatoregulfo 8:346c55cb6033 501 502 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
salvatoregulfo 8:346c55cb6033 502 503 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
salvatoregulfo 8:346c55cb6033 503 504 }
salvatoregulfo 8:346c55cb6033 504 505
salvatoregulfo 8:346c55cb6033 505 506 /**
salvatoregulfo 8:346c55cb6033 506 507 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
salvatoregulfo 8:346c55cb6033 507 508 */
salvatoregulfo 8:346c55cb6033 508 509
salvatoregulfo 8:346c55cb6033 509 510 static __INLINE q63_t mult32x64(
salvatoregulfo 8:346c55cb6033 510 511 q63_t x,
salvatoregulfo 8:346c55cb6033 511 512 q31_t y)
salvatoregulfo 8:346c55cb6033 512 513 {
salvatoregulfo 8:346c55cb6033 513 514 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
salvatoregulfo 8:346c55cb6033 514 515 (((q63_t) (x >> 32) * y)));
salvatoregulfo 8:346c55cb6033 515 516 }
salvatoregulfo 8:346c55cb6033 516 517
salvatoregulfo 8:346c55cb6033 517 518
salvatoregulfo 8:346c55cb6033 518 519 //#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
salvatoregulfo 8:346c55cb6033 519 520 //#define __CLZ __clz
salvatoregulfo 8:346c55cb6033 520 521 //#endif
salvatoregulfo 8:346c55cb6033 521 522
salvatoregulfo 8:346c55cb6033 522 523 //note: function can be removed when all toolchain support __CLZ for Cortex-M0
salvatoregulfo 8:346c55cb6033 523 524 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
salvatoregulfo 8:346c55cb6033 524 525
salvatoregulfo 8:346c55cb6033 525 526 static __INLINE uint32_t __CLZ(
salvatoregulfo 8:346c55cb6033 526 527 q31_t data);
salvatoregulfo 8:346c55cb6033 527 528
salvatoregulfo 8:346c55cb6033 528 529
salvatoregulfo 8:346c55cb6033 529 530 static __INLINE uint32_t __CLZ(
salvatoregulfo 8:346c55cb6033 530 531 q31_t data)
salvatoregulfo 8:346c55cb6033 531 532 {
salvatoregulfo 8:346c55cb6033 532 533 uint32_t count = 0;
salvatoregulfo 8:346c55cb6033 533 534 uint32_t mask = 0x80000000;
salvatoregulfo 8:346c55cb6033 534 535
salvatoregulfo 8:346c55cb6033 535 536 while((data & mask) == 0)
salvatoregulfo 8:346c55cb6033 536 537 {
salvatoregulfo 8:346c55cb6033 537 538 count += 1u;
salvatoregulfo 8:346c55cb6033 538 539 mask = mask >> 1u;
salvatoregulfo 8:346c55cb6033 539 540 }
salvatoregulfo 8:346c55cb6033 540 541
salvatoregulfo 8:346c55cb6033 541 542 return (count);
salvatoregulfo 8:346c55cb6033 542 543
salvatoregulfo 8:346c55cb6033 543 544 }
salvatoregulfo 8:346c55cb6033 544 545
salvatoregulfo 8:346c55cb6033 545 546 #endif
salvatoregulfo 8:346c55cb6033 546 547
salvatoregulfo 8:346c55cb6033 547 548 /**
salvatoregulfo 8:346c55cb6033 548 549 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
salvatoregulfo 8:346c55cb6033 549 550 */
salvatoregulfo 8:346c55cb6033 550 551
salvatoregulfo 8:346c55cb6033 551 552 static __INLINE uint32_t arm_recip_q31(
salvatoregulfo 8:346c55cb6033 552 553 q31_t in,
salvatoregulfo 8:346c55cb6033 553 554 q31_t * dst,
salvatoregulfo 8:346c55cb6033 554 555 q31_t * pRecipTable)
salvatoregulfo 8:346c55cb6033 555 556 {
salvatoregulfo 8:346c55cb6033 556 557
salvatoregulfo 8:346c55cb6033 557 558 uint32_t out, tempVal;
salvatoregulfo 8:346c55cb6033 558 559 uint32_t index, i;
salvatoregulfo 8:346c55cb6033 559 560 uint32_t signBits;
salvatoregulfo 8:346c55cb6033 560 561
salvatoregulfo 8:346c55cb6033 561 562 if(in > 0)
salvatoregulfo 8:346c55cb6033 562 563 {
salvatoregulfo 8:346c55cb6033 563 564 signBits = __CLZ(in) - 1;
salvatoregulfo 8:346c55cb6033 564 565 }
salvatoregulfo 8:346c55cb6033 565 566 else
salvatoregulfo 8:346c55cb6033 566 567 {
salvatoregulfo 8:346c55cb6033 567 568 signBits = __CLZ(-in) - 1;
salvatoregulfo 8:346c55cb6033 568 569 }
salvatoregulfo 8:346c55cb6033 569 570
salvatoregulfo 8:346c55cb6033 570 571 /* Convert input sample to 1.31 format */
salvatoregulfo 8:346c55cb6033 571 572 in = in << signBits;
salvatoregulfo 8:346c55cb6033 572 573
salvatoregulfo 8:346c55cb6033 573 574 /* calculation of index for initial approximated Val */
salvatoregulfo 8:346c55cb6033 574 575 index = (uint32_t) (in >> 24u);
salvatoregulfo 8:346c55cb6033 575 576 index = (index & INDEX_MASK);
salvatoregulfo 8:346c55cb6033 576 577
salvatoregulfo 8:346c55cb6033 577 578 /* 1.31 with exp 1 */
salvatoregulfo 8:346c55cb6033 578 579 out = pRecipTable[index];
salvatoregulfo 8:346c55cb6033 579 580
salvatoregulfo 8:346c55cb6033 580 581 /* calculation of reciprocal value */
salvatoregulfo 8:346c55cb6033 581 582 /* running approximation for two iterations */
salvatoregulfo 8:346c55cb6033 582 583 for (i = 0u; i < 2u; i++)
salvatoregulfo 8:346c55cb6033 583 584 {
salvatoregulfo 8:346c55cb6033 584 585 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
salvatoregulfo 8:346c55cb6033 585 586 tempVal = 0x7FFFFFFF - tempVal;
salvatoregulfo 8:346c55cb6033 586 587 /* 1.31 with exp 1 */
salvatoregulfo 8:346c55cb6033 587 588 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
salvatoregulfo 8:346c55cb6033 588 589 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
salvatoregulfo 8:346c55cb6033 589 590 }
salvatoregulfo 8:346c55cb6033 590 591
salvatoregulfo 8:346c55cb6033 591 592 /* write output */
salvatoregulfo 8:346c55cb6033 592 593 *dst = out;
salvatoregulfo 8:346c55cb6033 593 594
salvatoregulfo 8:346c55cb6033 594 595 /* return num of signbits of out = 1/in value */
salvatoregulfo 8:346c55cb6033 595 596 return (signBits + 1u);
salvatoregulfo 8:346c55cb6033 596 597
salvatoregulfo 8:346c55cb6033 597 598 }
salvatoregulfo 8:346c55cb6033 598 599
salvatoregulfo 8:346c55cb6033 599 600 /**
salvatoregulfo 8:346c55cb6033 600 601 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
salvatoregulfo 8:346c55cb6033 601 602 */
salvatoregulfo 8:346c55cb6033 602 603 static __INLINE uint32_t arm_recip_q15(
salvatoregulfo 8:346c55cb6033 603 604 q15_t in,
salvatoregulfo 8:346c55cb6033 604 605 q15_t * dst,
salvatoregulfo 8:346c55cb6033 605 606 q15_t * pRecipTable)
salvatoregulfo 8:346c55cb6033 606 607 {
salvatoregulfo 8:346c55cb6033 607 608
salvatoregulfo 8:346c55cb6033 608 609 uint32_t out = 0, tempVal = 0;
salvatoregulfo 8:346c55cb6033 609 610 uint32_t index = 0, i = 0;
salvatoregulfo 8:346c55cb6033 610 611 uint32_t signBits = 0;
salvatoregulfo 8:346c55cb6033 611 612
salvatoregulfo 8:346c55cb6033 612 613 if(in > 0)
salvatoregulfo 8:346c55cb6033 613 614 {
salvatoregulfo 8:346c55cb6033 614 615 signBits = __CLZ(in) - 17;
salvatoregulfo 8:346c55cb6033 615 616 }
salvatoregulfo 8:346c55cb6033 616 617 else
salvatoregulfo 8:346c55cb6033 617 618 {
salvatoregulfo 8:346c55cb6033 618 619 signBits = __CLZ(-in) - 17;
salvatoregulfo 8:346c55cb6033 619 620 }
salvatoregulfo 8:346c55cb6033 620 621
salvatoregulfo 8:346c55cb6033 621 622 /* Convert input sample to 1.15 format */
salvatoregulfo 8:346c55cb6033 622 623 in = in << signBits;
salvatoregulfo 8:346c55cb6033 623 624
salvatoregulfo 8:346c55cb6033 624 625 /* calculation of index for initial approximated Val */
salvatoregulfo 8:346c55cb6033 625 626 index = in >> 8;
salvatoregulfo 8:346c55cb6033 626 627 index = (index & INDEX_MASK);
salvatoregulfo 8:346c55cb6033 627 628
salvatoregulfo 8:346c55cb6033 628 629 /* 1.15 with exp 1 */
salvatoregulfo 8:346c55cb6033 629 630 out = pRecipTable[index];
salvatoregulfo 8:346c55cb6033 630 631
salvatoregulfo 8:346c55cb6033 631 632 /* calculation of reciprocal value */
salvatoregulfo 8:346c55cb6033 632 633 /* running approximation for two iterations */
salvatoregulfo 8:346c55cb6033 633 634 for (i = 0; i < 2; i++)
salvatoregulfo 8:346c55cb6033 634 635 {
salvatoregulfo 8:346c55cb6033 635 636 tempVal = (q15_t) (((q31_t) in * out) >> 15);
salvatoregulfo 8:346c55cb6033 636 637 tempVal = 0x7FFF - tempVal;
salvatoregulfo 8:346c55cb6033 637 638 /* 1.15 with exp 1 */
salvatoregulfo 8:346c55cb6033 638 639 out = (q15_t) (((q31_t) out * tempVal) >> 14);
salvatoregulfo 8:346c55cb6033 639 640 }
salvatoregulfo 8:346c55cb6033 640 641
salvatoregulfo 8:346c55cb6033 641 642 /* write output */
salvatoregulfo 8:346c55cb6033 642 643 *dst = out;
salvatoregulfo 8:346c55cb6033 643 644
salvatoregulfo 8:346c55cb6033 644 645 /* return num of signbits of out = 1/in value */
salvatoregulfo 8:346c55cb6033 645 646 return (signBits + 1);
salvatoregulfo 8:346c55cb6033 646 647
salvatoregulfo 8:346c55cb6033 647 648 }
salvatoregulfo 8:346c55cb6033 648 649
salvatoregulfo 8:346c55cb6033 649 650
salvatoregulfo 8:346c55cb6033 650 651 /*
salvatoregulfo 8:346c55cb6033 651 652 * @brief C custom defined intrinisic function for only M0 processors
salvatoregulfo 8:346c55cb6033 652 653 */
salvatoregulfo 8:346c55cb6033 653 654 #if defined(ARM_MATH_CM0_FAMILY)
salvatoregulfo 8:346c55cb6033 654 655
salvatoregulfo 8:346c55cb6033 655 656 static __INLINE q31_t __SSAT(
salvatoregulfo 8:346c55cb6033 656 657 q31_t x,
salvatoregulfo 8:346c55cb6033 657 658 uint32_t y)
salvatoregulfo 8:346c55cb6033 658 659 {
salvatoregulfo 8:346c55cb6033 659 660 int32_t posMax, negMin;
salvatoregulfo 8:346c55cb6033 660 661 uint32_t i;
salvatoregulfo 8:346c55cb6033 661 662
salvatoregulfo 8:346c55cb6033 662 663 posMax = 1;
salvatoregulfo 8:346c55cb6033 663 664 for (i = 0; i < (y - 1); i++)
salvatoregulfo 8:346c55cb6033 664 665 {
salvatoregulfo 8:346c55cb6033 665 666 posMax = posMax * 2;
salvatoregulfo 8:346c55cb6033 666 667 }
salvatoregulfo 8:346c55cb6033 667 668
salvatoregulfo 8:346c55cb6033 668 669 if(x > 0)
salvatoregulfo 8:346c55cb6033 669 670 {
salvatoregulfo 8:346c55cb6033 670 671 posMax = (posMax - 1);
salvatoregulfo 8:346c55cb6033 671 672
salvatoregulfo 8:346c55cb6033 672 673 if(x > posMax)
salvatoregulfo 8:346c55cb6033 673 674 {
salvatoregulfo 8:346c55cb6033 674 675 x = posMax;
salvatoregulfo 8:346c55cb6033 675 676 }
salvatoregulfo 8:346c55cb6033 676 677 }
salvatoregulfo 8:346c55cb6033 677 678 else
salvatoregulfo 8:346c55cb6033 678 679 {
salvatoregulfo 8:346c55cb6033 679 680 negMin = -posMax;
salvatoregulfo 8:346c55cb6033 680 681
salvatoregulfo 8:346c55cb6033 681 682 if(x < negMin)
salvatoregulfo 8:346c55cb6033 682 683 {
salvatoregulfo 8:346c55cb6033 683 684 x = negMin;
salvatoregulfo 8:346c55cb6033 684 685 }
salvatoregulfo 8:346c55cb6033 685 686 }
salvatoregulfo 8:346c55cb6033 686 687 return (x);
salvatoregulfo 8:346c55cb6033 687 688
salvatoregulfo 8:346c55cb6033 688 689
salvatoregulfo 8:346c55cb6033 689 690 }
salvatoregulfo 8:346c55cb6033 690 691
salvatoregulfo 8:346c55cb6033 691 692 #endif /* end of ARM_MATH_CM0_FAMILY */
salvatoregulfo 8:346c55cb6033 692 693
salvatoregulfo 8:346c55cb6033 693 694
salvatoregulfo 8:346c55cb6033 694 695
salvatoregulfo 8:346c55cb6033 695 696 /*
salvatoregulfo 8:346c55cb6033 696 697 * @brief C custom defined intrinsic function for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 697 698 */
salvatoregulfo 8:346c55cb6033 698 699 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
salvatoregulfo 8:346c55cb6033 699 700
salvatoregulfo 8:346c55cb6033 700 701 /*
salvatoregulfo 8:346c55cb6033 701 702 * @brief C custom defined QADD8 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 702 703 */
salvatoregulfo 8:346c55cb6033 703 704 static __INLINE q31_t __QADD8(
salvatoregulfo 8:346c55cb6033 704 705 q31_t x,
salvatoregulfo 8:346c55cb6033 705 706 q31_t y)
salvatoregulfo 8:346c55cb6033 706 707 {
salvatoregulfo 8:346c55cb6033 707 708
salvatoregulfo 8:346c55cb6033 708 709 q31_t sum;
salvatoregulfo 8:346c55cb6033 709 710 q7_t r, s, t, u;
salvatoregulfo 8:346c55cb6033 710 711
salvatoregulfo 8:346c55cb6033 711 712 r = (q7_t) x;
salvatoregulfo 8:346c55cb6033 712 713 s = (q7_t) y;
salvatoregulfo 8:346c55cb6033 713 714
salvatoregulfo 8:346c55cb6033 714 715 r = __SSAT((q31_t) (r + s), 8);
salvatoregulfo 8:346c55cb6033 715 716 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
salvatoregulfo 8:346c55cb6033 716 717 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
salvatoregulfo 8:346c55cb6033 717 718 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
salvatoregulfo 8:346c55cb6033 718 719
salvatoregulfo 8:346c55cb6033 719 720 sum =
salvatoregulfo 8:346c55cb6033 720 721 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
salvatoregulfo 8:346c55cb6033 721 722 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
salvatoregulfo 8:346c55cb6033 722 723
salvatoregulfo 8:346c55cb6033 723 724 return sum;
salvatoregulfo 8:346c55cb6033 724 725
salvatoregulfo 8:346c55cb6033 725 726 }
salvatoregulfo 8:346c55cb6033 726 727
salvatoregulfo 8:346c55cb6033 727 728 /*
salvatoregulfo 8:346c55cb6033 728 729 * @brief C custom defined QSUB8 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 729 730 */
salvatoregulfo 8:346c55cb6033 730 731 static __INLINE q31_t __QSUB8(
salvatoregulfo 8:346c55cb6033 731 732 q31_t x,
salvatoregulfo 8:346c55cb6033 732 733 q31_t y)
salvatoregulfo 8:346c55cb6033 733 734 {
salvatoregulfo 8:346c55cb6033 734 735
salvatoregulfo 8:346c55cb6033 735 736 q31_t sum;
salvatoregulfo 8:346c55cb6033 736 737 q31_t r, s, t, u;
salvatoregulfo 8:346c55cb6033 737 738
salvatoregulfo 8:346c55cb6033 738 739 r = (q7_t) x;
salvatoregulfo 8:346c55cb6033 739 740 s = (q7_t) y;
salvatoregulfo 8:346c55cb6033 740 741
salvatoregulfo 8:346c55cb6033 741 742 r = __SSAT((r - s), 8);
salvatoregulfo 8:346c55cb6033 742 743 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
salvatoregulfo 8:346c55cb6033 743 744 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
salvatoregulfo 8:346c55cb6033 744 745 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
salvatoregulfo 8:346c55cb6033 745 746
salvatoregulfo 8:346c55cb6033 746 747 sum =
salvatoregulfo 8:346c55cb6033 747 748 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
salvatoregulfo 8:346c55cb6033 748 749 0x000000FF);
salvatoregulfo 8:346c55cb6033 749 750
salvatoregulfo 8:346c55cb6033 750 751 return sum;
salvatoregulfo 8:346c55cb6033 751 752 }
salvatoregulfo 8:346c55cb6033 752 753
salvatoregulfo 8:346c55cb6033 753 754 /*
salvatoregulfo 8:346c55cb6033 754 755 * @brief C custom defined QADD16 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 755 756 */
salvatoregulfo 8:346c55cb6033 756 757
salvatoregulfo 8:346c55cb6033 757 758 /*
salvatoregulfo 8:346c55cb6033 758 759 * @brief C custom defined QADD16 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 759 760 */
salvatoregulfo 8:346c55cb6033 760 761 static __INLINE q31_t __QADD16(
salvatoregulfo 8:346c55cb6033 761 762 q31_t x,
salvatoregulfo 8:346c55cb6033 762 763 q31_t y)
salvatoregulfo 8:346c55cb6033 763 764 {
salvatoregulfo 8:346c55cb6033 764 765
salvatoregulfo 8:346c55cb6033 765 766 q31_t sum;
salvatoregulfo 8:346c55cb6033 766 767 q31_t r, s;
salvatoregulfo 8:346c55cb6033 767 768
salvatoregulfo 8:346c55cb6033 768 769 r = (q15_t) x;
salvatoregulfo 8:346c55cb6033 769 770 s = (q15_t) y;
salvatoregulfo 8:346c55cb6033 770 771
salvatoregulfo 8:346c55cb6033 771 772 r = __SSAT(r + s, 16);
salvatoregulfo 8:346c55cb6033 772 773 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
salvatoregulfo 8:346c55cb6033 773 774
salvatoregulfo 8:346c55cb6033 774 775 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
salvatoregulfo 8:346c55cb6033 775 776
salvatoregulfo 8:346c55cb6033 776 777 return sum;
salvatoregulfo 8:346c55cb6033 777 778
salvatoregulfo 8:346c55cb6033 778 779 }
salvatoregulfo 8:346c55cb6033 779 780
salvatoregulfo 8:346c55cb6033 780 781 /*
salvatoregulfo 8:346c55cb6033 781 782 * @brief C custom defined SHADD16 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 782 783 */
salvatoregulfo 8:346c55cb6033 783 784 static __INLINE q31_t __SHADD16(
salvatoregulfo 8:346c55cb6033 784 785 q31_t x,
salvatoregulfo 8:346c55cb6033 785 786 q31_t y)
salvatoregulfo 8:346c55cb6033 786 787 {
salvatoregulfo 8:346c55cb6033 787 788
salvatoregulfo 8:346c55cb6033 788 789 q31_t sum;
salvatoregulfo 8:346c55cb6033 789 790 q31_t r, s;
salvatoregulfo 8:346c55cb6033 790 791
salvatoregulfo 8:346c55cb6033 791 792 r = (q15_t) x;
salvatoregulfo 8:346c55cb6033 792 793 s = (q15_t) y;
salvatoregulfo 8:346c55cb6033 793 794
salvatoregulfo 8:346c55cb6033 794 795 r = ((r >> 1) + (s >> 1));
salvatoregulfo 8:346c55cb6033 795 796 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
salvatoregulfo 8:346c55cb6033 796 797
salvatoregulfo 8:346c55cb6033 797 798 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
salvatoregulfo 8:346c55cb6033 798 799
salvatoregulfo 8:346c55cb6033 799 800 return sum;
salvatoregulfo 8:346c55cb6033 800 801
salvatoregulfo 8:346c55cb6033 801 802 }
salvatoregulfo 8:346c55cb6033 802 803
salvatoregulfo 8:346c55cb6033 803 804 /*
salvatoregulfo 8:346c55cb6033 804 805 * @brief C custom defined QSUB16 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 805 806 */
salvatoregulfo 8:346c55cb6033 806 807 static __INLINE q31_t __QSUB16(
salvatoregulfo 8:346c55cb6033 807 808 q31_t x,
salvatoregulfo 8:346c55cb6033 808 809 q31_t y)
salvatoregulfo 8:346c55cb6033 809 810 {
salvatoregulfo 8:346c55cb6033 810 811
salvatoregulfo 8:346c55cb6033 811 812 q31_t sum;
salvatoregulfo 8:346c55cb6033 812 813 q31_t r, s;
salvatoregulfo 8:346c55cb6033 813 814
salvatoregulfo 8:346c55cb6033 814 815 r = (q15_t) x;
salvatoregulfo 8:346c55cb6033 815 816 s = (q15_t) y;
salvatoregulfo 8:346c55cb6033 816 817
salvatoregulfo 8:346c55cb6033 817 818 r = __SSAT(r - s, 16);
salvatoregulfo 8:346c55cb6033 818 819 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
salvatoregulfo 8:346c55cb6033 819 820
salvatoregulfo 8:346c55cb6033 820 821 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
salvatoregulfo 8:346c55cb6033 821 822
salvatoregulfo 8:346c55cb6033 822 823 return sum;
salvatoregulfo 8:346c55cb6033 823 824 }
salvatoregulfo 8:346c55cb6033 824 825
salvatoregulfo 8:346c55cb6033 825 826 /*
salvatoregulfo 8:346c55cb6033 826 827 * @brief C custom defined SHSUB16 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 827 828 */
salvatoregulfo 8:346c55cb6033 828 829 static __INLINE q31_t __SHSUB16(
salvatoregulfo 8:346c55cb6033 829 830 q31_t x,
salvatoregulfo 8:346c55cb6033 830 831 q31_t y)
salvatoregulfo 8:346c55cb6033 831 832 {
salvatoregulfo 8:346c55cb6033 832 833
salvatoregulfo 8:346c55cb6033 833 834 q31_t diff;
salvatoregulfo 8:346c55cb6033 834 835 q31_t r, s;
salvatoregulfo 8:346c55cb6033 835 836
salvatoregulfo 8:346c55cb6033 836 837 r = (q15_t) x;
salvatoregulfo 8:346c55cb6033 837 838 s = (q15_t) y;
salvatoregulfo 8:346c55cb6033 838 839
salvatoregulfo 8:346c55cb6033 839 840 r = ((r >> 1) - (s >> 1));
salvatoregulfo 8:346c55cb6033 840 841 s = (((x >> 17) - (y >> 17)) << 16);
salvatoregulfo 8:346c55cb6033 841 842
salvatoregulfo 8:346c55cb6033 842 843 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
salvatoregulfo 8:346c55cb6033 843 844
salvatoregulfo 8:346c55cb6033 844 845 return diff;
salvatoregulfo 8:346c55cb6033 845 846 }
salvatoregulfo 8:346c55cb6033 846 847
salvatoregulfo 8:346c55cb6033 847 848 /*
salvatoregulfo 8:346c55cb6033 848 849 * @brief C custom defined QASX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 849 850 */
salvatoregulfo 8:346c55cb6033 850 851 static __INLINE q31_t __QASX(
salvatoregulfo 8:346c55cb6033 851 852 q31_t x,
salvatoregulfo 8:346c55cb6033 852 853 q31_t y)
salvatoregulfo 8:346c55cb6033 853 854 {
salvatoregulfo 8:346c55cb6033 854 855
salvatoregulfo 8:346c55cb6033 855 856 q31_t sum = 0;
salvatoregulfo 8:346c55cb6033 856 857
salvatoregulfo 8:346c55cb6033 857 858 sum =
salvatoregulfo 8:346c55cb6033 858 859 ((sum +
salvatoregulfo 8:346c55cb6033 859 860 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
salvatoregulfo 8:346c55cb6033 860 861 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
salvatoregulfo 8:346c55cb6033 861 862
salvatoregulfo 8:346c55cb6033 862 863 return sum;
salvatoregulfo 8:346c55cb6033 863 864 }
salvatoregulfo 8:346c55cb6033 864 865
salvatoregulfo 8:346c55cb6033 865 866 /*
salvatoregulfo 8:346c55cb6033 866 867 * @brief C custom defined SHASX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 867 868 */
salvatoregulfo 8:346c55cb6033 868 869 static __INLINE q31_t __SHASX(
salvatoregulfo 8:346c55cb6033 869 870 q31_t x,
salvatoregulfo 8:346c55cb6033 870 871 q31_t y)
salvatoregulfo 8:346c55cb6033 871 872 {
salvatoregulfo 8:346c55cb6033 872 873
salvatoregulfo 8:346c55cb6033 873 874 q31_t sum;
salvatoregulfo 8:346c55cb6033 874 875 q31_t r, s;
salvatoregulfo 8:346c55cb6033 875 876
salvatoregulfo 8:346c55cb6033 876 877 r = (q15_t) x;
salvatoregulfo 8:346c55cb6033 877 878 s = (q15_t) y;
salvatoregulfo 8:346c55cb6033 878 879
salvatoregulfo 8:346c55cb6033 879 880 r = ((r >> 1) - (y >> 17));
salvatoregulfo 8:346c55cb6033 880 881 s = (((x >> 17) + (s >> 1)) << 16);
salvatoregulfo 8:346c55cb6033 881 882
salvatoregulfo 8:346c55cb6033 882 883 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
salvatoregulfo 8:346c55cb6033 883 884
salvatoregulfo 8:346c55cb6033 884 885 return sum;
salvatoregulfo 8:346c55cb6033 885 886 }
salvatoregulfo 8:346c55cb6033 886 887
salvatoregulfo 8:346c55cb6033 887 888
salvatoregulfo 8:346c55cb6033 888 889 /*
salvatoregulfo 8:346c55cb6033 889 890 * @brief C custom defined QSAX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 890 891 */
salvatoregulfo 8:346c55cb6033 891 892 static __INLINE q31_t __QSAX(
salvatoregulfo 8:346c55cb6033 892 893 q31_t x,
salvatoregulfo 8:346c55cb6033 893 894 q31_t y)
salvatoregulfo 8:346c55cb6033 894 895 {
salvatoregulfo 8:346c55cb6033 895 896
salvatoregulfo 8:346c55cb6033 896 897 q31_t sum = 0;
salvatoregulfo 8:346c55cb6033 897 898
salvatoregulfo 8:346c55cb6033 898 899 sum =
salvatoregulfo 8:346c55cb6033 899 900 ((sum +
salvatoregulfo 8:346c55cb6033 900 901 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
salvatoregulfo 8:346c55cb6033 901 902 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
salvatoregulfo 8:346c55cb6033 902 903
salvatoregulfo 8:346c55cb6033 903 904 return sum;
salvatoregulfo 8:346c55cb6033 904 905 }
salvatoregulfo 8:346c55cb6033 905 906
salvatoregulfo 8:346c55cb6033 906 907 /*
salvatoregulfo 8:346c55cb6033 907 908 * @brief C custom defined SHSAX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 908 909 */
salvatoregulfo 8:346c55cb6033 909 910 static __INLINE q31_t __SHSAX(
salvatoregulfo 8:346c55cb6033 910 911 q31_t x,
salvatoregulfo 8:346c55cb6033 911 912 q31_t y)
salvatoregulfo 8:346c55cb6033 912 913 {
salvatoregulfo 8:346c55cb6033 913 914
salvatoregulfo 8:346c55cb6033 914 915 q31_t sum;
salvatoregulfo 8:346c55cb6033 915 916 q31_t r, s;
salvatoregulfo 8:346c55cb6033 916 917
salvatoregulfo 8:346c55cb6033 917 918 r = (q15_t) x;
salvatoregulfo 8:346c55cb6033 918 919 s = (q15_t) y;
salvatoregulfo 8:346c55cb6033 919 920
salvatoregulfo 8:346c55cb6033 920 921 r = ((r >> 1) + (y >> 17));
salvatoregulfo 8:346c55cb6033 921 922 s = (((x >> 17) - (s >> 1)) << 16);
salvatoregulfo 8:346c55cb6033 922 923
salvatoregulfo 8:346c55cb6033 923 924 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
salvatoregulfo 8:346c55cb6033 924 925
salvatoregulfo 8:346c55cb6033 925 926 return sum;
salvatoregulfo 8:346c55cb6033 926 927 }
salvatoregulfo 8:346c55cb6033 927 928
salvatoregulfo 8:346c55cb6033 928 929 /*
salvatoregulfo 8:346c55cb6033 929 930 * @brief C custom defined SMUSDX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 930 931 */
salvatoregulfo 8:346c55cb6033 931 932 static __INLINE q31_t __SMUSDX(
salvatoregulfo 8:346c55cb6033 932 933 q31_t x,
salvatoregulfo 8:346c55cb6033 933 934 q31_t y)
salvatoregulfo 8:346c55cb6033 934 935 {
salvatoregulfo 8:346c55cb6033 935 936
salvatoregulfo 8:346c55cb6033 936 937 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
salvatoregulfo 8:346c55cb6033 937 938 ((q15_t) (x >> 16) * (q15_t) y)));
salvatoregulfo 8:346c55cb6033 938 939 }
salvatoregulfo 8:346c55cb6033 939 940
salvatoregulfo 8:346c55cb6033 940 941 /*
salvatoregulfo 8:346c55cb6033 941 942 * @brief C custom defined SMUADX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 942 943 */
salvatoregulfo 8:346c55cb6033 943 944 static __INLINE q31_t __SMUADX(
salvatoregulfo 8:346c55cb6033 944 945 q31_t x,
salvatoregulfo 8:346c55cb6033 945 946 q31_t y)
salvatoregulfo 8:346c55cb6033 946 947 {
salvatoregulfo 8:346c55cb6033 947 948
salvatoregulfo 8:346c55cb6033 948 949 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
salvatoregulfo 8:346c55cb6033 949 950 ((q15_t) (x >> 16) * (q15_t) y)));
salvatoregulfo 8:346c55cb6033 950 951 }
salvatoregulfo 8:346c55cb6033 951 952
salvatoregulfo 8:346c55cb6033 952 953 /*
salvatoregulfo 8:346c55cb6033 953 954 * @brief C custom defined QADD for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 954 955 */
salvatoregulfo 8:346c55cb6033 955 956 static __INLINE q31_t __QADD(
salvatoregulfo 8:346c55cb6033 956 957 q31_t x,
salvatoregulfo 8:346c55cb6033 957 958 q31_t y)
salvatoregulfo 8:346c55cb6033 958 959 {
salvatoregulfo 8:346c55cb6033 959 960 return clip_q63_to_q31((q63_t) x + y);
salvatoregulfo 8:346c55cb6033 960 961 }
salvatoregulfo 8:346c55cb6033 961 962
salvatoregulfo 8:346c55cb6033 962 963 /*
salvatoregulfo 8:346c55cb6033 963 964 * @brief C custom defined QSUB for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 964 965 */
salvatoregulfo 8:346c55cb6033 965 966 static __INLINE q31_t __QSUB(
salvatoregulfo 8:346c55cb6033 966 967 q31_t x,
salvatoregulfo 8:346c55cb6033 967 968 q31_t y)
salvatoregulfo 8:346c55cb6033 968 969 {
salvatoregulfo 8:346c55cb6033 969 970 return clip_q63_to_q31((q63_t) x - y);
salvatoregulfo 8:346c55cb6033 970 971 }
salvatoregulfo 8:346c55cb6033 971 972
salvatoregulfo 8:346c55cb6033 972 973 /*
salvatoregulfo 8:346c55cb6033 973 974 * @brief C custom defined SMLAD for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 974 975 */
salvatoregulfo 8:346c55cb6033 975 976 static __INLINE q31_t __SMLAD(
salvatoregulfo 8:346c55cb6033 976 977 q31_t x,
salvatoregulfo 8:346c55cb6033 977 978 q31_t y,
salvatoregulfo 8:346c55cb6033 978 979 q31_t sum)
salvatoregulfo 8:346c55cb6033 979 980 {
salvatoregulfo 8:346c55cb6033 980 981
salvatoregulfo 8:346c55cb6033 981 982 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
salvatoregulfo 8:346c55cb6033 982 983 ((q15_t) x * (q15_t) y));
salvatoregulfo 8:346c55cb6033 983 984 }
salvatoregulfo 8:346c55cb6033 984 985
salvatoregulfo 8:346c55cb6033 985 986 /*
salvatoregulfo 8:346c55cb6033 986 987 * @brief C custom defined SMLADX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 987 988 */
salvatoregulfo 8:346c55cb6033 988 989 static __INLINE q31_t __SMLADX(
salvatoregulfo 8:346c55cb6033 989 990 q31_t x,
salvatoregulfo 8:346c55cb6033 990 991 q31_t y,
salvatoregulfo 8:346c55cb6033 991 992 q31_t sum)
salvatoregulfo 8:346c55cb6033 992 993 {
salvatoregulfo 8:346c55cb6033 993 994
salvatoregulfo 8:346c55cb6033 994 995 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
salvatoregulfo 8:346c55cb6033 995 996 ((q15_t) x * (q15_t) (y >> 16)));
salvatoregulfo 8:346c55cb6033 996 997 }
salvatoregulfo 8:346c55cb6033 997 998
salvatoregulfo 8:346c55cb6033 998 999 /*
salvatoregulfo 8:346c55cb6033 999 1000 * @brief C custom defined SMLSDX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 1000 1001 */
salvatoregulfo 8:346c55cb6033 1001 1002 static __INLINE q31_t __SMLSDX(
salvatoregulfo 8:346c55cb6033 1002 1003 q31_t x,
salvatoregulfo 8:346c55cb6033 1003 1004 q31_t y,
salvatoregulfo 8:346c55cb6033 1004 1005 q31_t sum)
salvatoregulfo 8:346c55cb6033 1005 1006 {
salvatoregulfo 8:346c55cb6033 1006 1007
salvatoregulfo 8:346c55cb6033 1007 1008 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
salvatoregulfo 8:346c55cb6033 1008 1009 ((q15_t) x * (q15_t) (y >> 16)));
salvatoregulfo 8:346c55cb6033 1009 1010 }
salvatoregulfo 8:346c55cb6033 1010 1011
salvatoregulfo 8:346c55cb6033 1011 1012 /*
salvatoregulfo 8:346c55cb6033 1012 1013 * @brief C custom defined SMLALD for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 1013 1014 */
salvatoregulfo 8:346c55cb6033 1014 1015 static __INLINE q63_t __SMLALD(
salvatoregulfo 8:346c55cb6033 1015 1016 q31_t x,
salvatoregulfo 8:346c55cb6033 1016 1017 q31_t y,
salvatoregulfo 8:346c55cb6033 1017 1018 q63_t sum)
salvatoregulfo 8:346c55cb6033 1018 1019 {
salvatoregulfo 8:346c55cb6033 1019 1020
salvatoregulfo 8:346c55cb6033 1020 1021 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
salvatoregulfo 8:346c55cb6033 1021 1022 ((q15_t) x * (q15_t) y));
salvatoregulfo 8:346c55cb6033 1022 1023 }
salvatoregulfo 8:346c55cb6033 1023 1024
salvatoregulfo 8:346c55cb6033 1024 1025 /*
salvatoregulfo 8:346c55cb6033 1025 1026 * @brief C custom defined SMLALDX for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 1026 1027 */
salvatoregulfo 8:346c55cb6033 1027 1028 static __INLINE q63_t __SMLALDX(
salvatoregulfo 8:346c55cb6033 1028 1029 q31_t x,
salvatoregulfo 8:346c55cb6033 1029 1030 q31_t y,
salvatoregulfo 8:346c55cb6033 1030 1031 q63_t sum)
salvatoregulfo 8:346c55cb6033 1031 1032 {
salvatoregulfo 8:346c55cb6033 1032 1033
salvatoregulfo 8:346c55cb6033 1033 1034 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
salvatoregulfo 8:346c55cb6033 1034 1035 ((q15_t) x * (q15_t) (y >> 16));
salvatoregulfo 8:346c55cb6033 1035 1036 }
salvatoregulfo 8:346c55cb6033 1036 1037
salvatoregulfo 8:346c55cb6033 1037 1038 /*
salvatoregulfo 8:346c55cb6033 1038 1039 * @brief C custom defined SMUAD for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 1039 1040 */
salvatoregulfo 8:346c55cb6033 1040 1041 static __INLINE q31_t __SMUAD(
salvatoregulfo 8:346c55cb6033 1041 1042 q31_t x,
salvatoregulfo 8:346c55cb6033 1042 1043 q31_t y)
salvatoregulfo 8:346c55cb6033 1043 1044 {
salvatoregulfo 8:346c55cb6033 1044 1045
salvatoregulfo 8:346c55cb6033 1045 1046 return (((x >> 16) * (y >> 16)) +
salvatoregulfo 8:346c55cb6033 1046 1047 (((x << 16) >> 16) * ((y << 16) >> 16)));
salvatoregulfo 8:346c55cb6033 1047 1048 }
salvatoregulfo 8:346c55cb6033 1048 1049
salvatoregulfo 8:346c55cb6033 1049 1050 /*
salvatoregulfo 8:346c55cb6033 1050 1051 * @brief C custom defined SMUSD for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 1051 1052 */
salvatoregulfo 8:346c55cb6033 1052 1053 static __INLINE q31_t __SMUSD(
salvatoregulfo 8:346c55cb6033 1053 1054 q31_t x,
salvatoregulfo 8:346c55cb6033 1054 1055 q31_t y)
salvatoregulfo 8:346c55cb6033 1055 1056 {
salvatoregulfo 8:346c55cb6033 1056 1057
salvatoregulfo 8:346c55cb6033 1057 1058 return (-((x >> 16) * (y >> 16)) +
salvatoregulfo 8:346c55cb6033 1058 1059 (((x << 16) >> 16) * ((y << 16) >> 16)));
salvatoregulfo 8:346c55cb6033 1059 1060 }
salvatoregulfo 8:346c55cb6033 1060 1061
salvatoregulfo 8:346c55cb6033 1061 1062
salvatoregulfo 8:346c55cb6033 1062 1063 /*
salvatoregulfo 8:346c55cb6033 1063 1064 * @brief C custom defined SXTB16 for M3 and M0 processors
salvatoregulfo 8:346c55cb6033 1064 1065 */
salvatoregulfo 8:346c55cb6033 1065 1066 static __INLINE q31_t __SXTB16(
salvatoregulfo 8:346c55cb6033 1066 1067 q31_t x)
salvatoregulfo 8:346c55cb6033 1067 1068 {
salvatoregulfo 8:346c55cb6033 1068 1069
salvatoregulfo 8:346c55cb6033 1069 1070 return ((((x << 24) >> 24) & 0x0000FFFF) |
salvatoregulfo 8:346c55cb6033 1070 1071 (((x << 8) >> 8) & 0xFFFF0000));
salvatoregulfo 8:346c55cb6033 1071 1072 }
salvatoregulfo 8:346c55cb6033 1072 1073
salvatoregulfo 8:346c55cb6033 1073 1074
salvatoregulfo 8:346c55cb6033 1074 1075 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
salvatoregulfo 8:346c55cb6033 1075 1076
salvatoregulfo 8:346c55cb6033 1076 1077
salvatoregulfo 8:346c55cb6033 1077 1078 /**
salvatoregulfo 8:346c55cb6033 1078 1079 * @brief Instance structure for the Q7 FIR filter.
salvatoregulfo 8:346c55cb6033 1079 1080 */
salvatoregulfo 8:346c55cb6033 1080 1081 typedef struct
salvatoregulfo 8:346c55cb6033 1081 1082 {
salvatoregulfo 8:346c55cb6033 1082 1083 uint16_t numTaps; /**< number of filter coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 1083 1084 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 1084 1085 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 1085 1086 } arm_fir_instance_q7;
salvatoregulfo 8:346c55cb6033 1086 1087
salvatoregulfo 8:346c55cb6033 1087 1088 /**
salvatoregulfo 8:346c55cb6033 1088 1089 * @brief Instance structure for the Q15 FIR filter.
salvatoregulfo 8:346c55cb6033 1089 1090 */
salvatoregulfo 8:346c55cb6033 1090 1091 typedef struct
salvatoregulfo 8:346c55cb6033 1091 1092 {
salvatoregulfo 8:346c55cb6033 1092 1093 uint16_t numTaps; /**< number of filter coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 1093 1094 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 1094 1095 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 1095 1096 } arm_fir_instance_q15;
salvatoregulfo 8:346c55cb6033 1096 1097
salvatoregulfo 8:346c55cb6033 1097 1098 /**
salvatoregulfo 8:346c55cb6033 1098 1099 * @brief Instance structure for the Q31 FIR filter.
salvatoregulfo 8:346c55cb6033 1099 1100 */
salvatoregulfo 8:346c55cb6033 1100 1101 typedef struct
salvatoregulfo 8:346c55cb6033 1101 1102 {
salvatoregulfo 8:346c55cb6033 1102 1103 uint16_t numTaps; /**< number of filter coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 1103 1104 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 1104 1105 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 1105 1106 } arm_fir_instance_q31;
salvatoregulfo 8:346c55cb6033 1106 1107
salvatoregulfo 8:346c55cb6033 1107 1108 /**
salvatoregulfo 8:346c55cb6033 1108 1109 * @brief Instance structure for the floating-point FIR filter.
salvatoregulfo 8:346c55cb6033 1109 1110 */
salvatoregulfo 8:346c55cb6033 1110 1111 typedef struct
salvatoregulfo 8:346c55cb6033 1111 1112 {
salvatoregulfo 8:346c55cb6033 1112 1113 uint16_t numTaps; /**< number of filter coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 1113 1114 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 1114 1115 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 1115 1116 } arm_fir_instance_f32;
salvatoregulfo 8:346c55cb6033 1116 1117
salvatoregulfo 8:346c55cb6033 1117 1118
salvatoregulfo 8:346c55cb6033 1118 1119 /**
salvatoregulfo 8:346c55cb6033 1119 1120 * @brief Processing function for the Q7 FIR filter.
salvatoregulfo 8:346c55cb6033 1120 1121 * @param[in] *S points to an instance of the Q7 FIR filter structure.
salvatoregulfo 8:346c55cb6033 1121 1122 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1122 1123 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1123 1124 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1124 1125 * @return none.
salvatoregulfo 8:346c55cb6033 1125 1126 */
salvatoregulfo 8:346c55cb6033 1126 1127 void arm_fir_q7(
salvatoregulfo 8:346c55cb6033 1127 1128 const arm_fir_instance_q7 * S,
salvatoregulfo 8:346c55cb6033 1128 1129 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 1129 1130 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 1130 1131 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1131 1132
salvatoregulfo 8:346c55cb6033 1132 1133
salvatoregulfo 8:346c55cb6033 1133 1134 /**
salvatoregulfo 8:346c55cb6033 1134 1135 * @brief Initialization function for the Q7 FIR filter.
salvatoregulfo 8:346c55cb6033 1135 1136 * @param[in,out] *S points to an instance of the Q7 FIR structure.
salvatoregulfo 8:346c55cb6033 1136 1137 * @param[in] numTaps Number of filter coefficients in the filter.
salvatoregulfo 8:346c55cb6033 1137 1138 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1138 1139 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1139 1140 * @param[in] blockSize number of samples that are processed.
salvatoregulfo 8:346c55cb6033 1140 1141 * @return none
salvatoregulfo 8:346c55cb6033 1141 1142 */
salvatoregulfo 8:346c55cb6033 1142 1143 void arm_fir_init_q7(
salvatoregulfo 8:346c55cb6033 1143 1144 arm_fir_instance_q7 * S,
salvatoregulfo 8:346c55cb6033 1144 1145 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 1145 1146 q7_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1146 1147 q7_t * pState,
salvatoregulfo 8:346c55cb6033 1147 1148 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1148 1149
salvatoregulfo 8:346c55cb6033 1149 1150
salvatoregulfo 8:346c55cb6033 1150 1151 /**
salvatoregulfo 8:346c55cb6033 1151 1152 * @brief Processing function for the Q15 FIR filter.
salvatoregulfo 8:346c55cb6033 1152 1153 * @param[in] *S points to an instance of the Q15 FIR structure.
salvatoregulfo 8:346c55cb6033 1153 1154 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1154 1155 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1155 1156 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1156 1157 * @return none.
salvatoregulfo 8:346c55cb6033 1157 1158 */
salvatoregulfo 8:346c55cb6033 1158 1159 void arm_fir_q15(
salvatoregulfo 8:346c55cb6033 1159 1160 const arm_fir_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 1160 1161 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 1161 1162 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 1162 1163 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1163 1164
salvatoregulfo 8:346c55cb6033 1164 1165 /**
salvatoregulfo 8:346c55cb6033 1165 1166 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 1166 1167 * @param[in] *S points to an instance of the Q15 FIR filter structure.
salvatoregulfo 8:346c55cb6033 1167 1168 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1168 1169 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1169 1170 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1170 1171 * @return none.
salvatoregulfo 8:346c55cb6033 1171 1172 */
salvatoregulfo 8:346c55cb6033 1172 1173 void arm_fir_fast_q15(
salvatoregulfo 8:346c55cb6033 1173 1174 const arm_fir_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 1174 1175 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 1175 1176 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 1176 1177 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1177 1178
salvatoregulfo 8:346c55cb6033 1178 1179 /**
salvatoregulfo 8:346c55cb6033 1179 1180 * @brief Initialization function for the Q15 FIR filter.
salvatoregulfo 8:346c55cb6033 1180 1181 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
salvatoregulfo 8:346c55cb6033 1181 1182 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
salvatoregulfo 8:346c55cb6033 1182 1183 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1183 1184 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1184 1185 * @param[in] blockSize number of samples that are processed at a time.
salvatoregulfo 8:346c55cb6033 1185 1186 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
salvatoregulfo 8:346c55cb6033 1186 1187 * <code>numTaps</code> is not a supported value.
salvatoregulfo 8:346c55cb6033 1187 1188 */
salvatoregulfo 8:346c55cb6033 1188 1189
salvatoregulfo 8:346c55cb6033 1189 1190 arm_status arm_fir_init_q15(
salvatoregulfo 8:346c55cb6033 1190 1191 arm_fir_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 1191 1192 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 1192 1193 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1193 1194 q15_t * pState,
salvatoregulfo 8:346c55cb6033 1194 1195 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1195 1196
salvatoregulfo 8:346c55cb6033 1196 1197 /**
salvatoregulfo 8:346c55cb6033 1197 1198 * @brief Processing function for the Q31 FIR filter.
salvatoregulfo 8:346c55cb6033 1198 1199 * @param[in] *S points to an instance of the Q31 FIR filter structure.
salvatoregulfo 8:346c55cb6033 1199 1200 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1200 1201 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1201 1202 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1202 1203 * @return none.
salvatoregulfo 8:346c55cb6033 1203 1204 */
salvatoregulfo 8:346c55cb6033 1204 1205 void arm_fir_q31(
salvatoregulfo 8:346c55cb6033 1205 1206 const arm_fir_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 1206 1207 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 1207 1208 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 1208 1209 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1209 1210
salvatoregulfo 8:346c55cb6033 1210 1211 /**
salvatoregulfo 8:346c55cb6033 1211 1212 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 1212 1213 * @param[in] *S points to an instance of the Q31 FIR structure.
salvatoregulfo 8:346c55cb6033 1213 1214 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1214 1215 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1215 1216 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1216 1217 * @return none.
salvatoregulfo 8:346c55cb6033 1217 1218 */
salvatoregulfo 8:346c55cb6033 1218 1219 void arm_fir_fast_q31(
salvatoregulfo 8:346c55cb6033 1219 1220 const arm_fir_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 1220 1221 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 1221 1222 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 1222 1223 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1223 1224
salvatoregulfo 8:346c55cb6033 1224 1225 /**
salvatoregulfo 8:346c55cb6033 1225 1226 * @brief Initialization function for the Q31 FIR filter.
salvatoregulfo 8:346c55cb6033 1226 1227 * @param[in,out] *S points to an instance of the Q31 FIR structure.
salvatoregulfo 8:346c55cb6033 1227 1228 * @param[in] numTaps Number of filter coefficients in the filter.
salvatoregulfo 8:346c55cb6033 1228 1229 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1229 1230 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1230 1231 * @param[in] blockSize number of samples that are processed at a time.
salvatoregulfo 8:346c55cb6033 1231 1232 * @return none.
salvatoregulfo 8:346c55cb6033 1232 1233 */
salvatoregulfo 8:346c55cb6033 1233 1234 void arm_fir_init_q31(
salvatoregulfo 8:346c55cb6033 1234 1235 arm_fir_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 1235 1236 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 1236 1237 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1237 1238 q31_t * pState,
salvatoregulfo 8:346c55cb6033 1238 1239 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1239 1240
salvatoregulfo 8:346c55cb6033 1240 1241 /**
salvatoregulfo 8:346c55cb6033 1241 1242 * @brief Processing function for the floating-point FIR filter.
salvatoregulfo 8:346c55cb6033 1242 1243 * @param[in] *S points to an instance of the floating-point FIR structure.
salvatoregulfo 8:346c55cb6033 1243 1244 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1244 1245 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1245 1246 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1246 1247 * @return none.
salvatoregulfo 8:346c55cb6033 1247 1248 */
salvatoregulfo 8:346c55cb6033 1248 1249 void arm_fir_f32(
salvatoregulfo 8:346c55cb6033 1249 1250 const arm_fir_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 1250 1251 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 1251 1252 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 1252 1253 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1253 1254
salvatoregulfo 8:346c55cb6033 1254 1255 /**
salvatoregulfo 8:346c55cb6033 1255 1256 * @brief Initialization function for the floating-point FIR filter.
salvatoregulfo 8:346c55cb6033 1256 1257 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
salvatoregulfo 8:346c55cb6033 1257 1258 * @param[in] numTaps Number of filter coefficients in the filter.
salvatoregulfo 8:346c55cb6033 1258 1259 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1259 1260 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1260 1261 * @param[in] blockSize number of samples that are processed at a time.
salvatoregulfo 8:346c55cb6033 1261 1262 * @return none.
salvatoregulfo 8:346c55cb6033 1262 1263 */
salvatoregulfo 8:346c55cb6033 1263 1264 void arm_fir_init_f32(
salvatoregulfo 8:346c55cb6033 1264 1265 arm_fir_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 1265 1266 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 1266 1267 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1267 1268 float32_t * pState,
salvatoregulfo 8:346c55cb6033 1268 1269 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1269 1270
salvatoregulfo 8:346c55cb6033 1270 1271
salvatoregulfo 8:346c55cb6033 1271 1272 /**
salvatoregulfo 8:346c55cb6033 1272 1273 * @brief Instance structure for the Q15 Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1273 1274 */
salvatoregulfo 8:346c55cb6033 1274 1275 typedef struct
salvatoregulfo 8:346c55cb6033 1275 1276 {
salvatoregulfo 8:346c55cb6033 1276 1277 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 1277 1278 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
salvatoregulfo 8:346c55cb6033 1278 1279 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 1279 1280 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
salvatoregulfo 8:346c55cb6033 1280 1281
salvatoregulfo 8:346c55cb6033 1281 1282 } arm_biquad_casd_df1_inst_q15;
salvatoregulfo 8:346c55cb6033 1282 1283
salvatoregulfo 8:346c55cb6033 1283 1284
salvatoregulfo 8:346c55cb6033 1284 1285 /**
salvatoregulfo 8:346c55cb6033 1285 1286 * @brief Instance structure for the Q31 Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1286 1287 */
salvatoregulfo 8:346c55cb6033 1287 1288 typedef struct
salvatoregulfo 8:346c55cb6033 1288 1289 {
salvatoregulfo 8:346c55cb6033 1289 1290 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 1290 1291 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
salvatoregulfo 8:346c55cb6033 1291 1292 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 1292 1293 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
salvatoregulfo 8:346c55cb6033 1293 1294
salvatoregulfo 8:346c55cb6033 1294 1295 } arm_biquad_casd_df1_inst_q31;
salvatoregulfo 8:346c55cb6033 1295 1296
salvatoregulfo 8:346c55cb6033 1296 1297 /**
salvatoregulfo 8:346c55cb6033 1297 1298 * @brief Instance structure for the floating-point Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1298 1299 */
salvatoregulfo 8:346c55cb6033 1299 1300 typedef struct
salvatoregulfo 8:346c55cb6033 1300 1301 {
salvatoregulfo 8:346c55cb6033 1301 1302 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 1302 1303 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
salvatoregulfo 8:346c55cb6033 1303 1304 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 1304 1305
salvatoregulfo 8:346c55cb6033 1305 1306
salvatoregulfo 8:346c55cb6033 1306 1307 } arm_biquad_casd_df1_inst_f32;
salvatoregulfo 8:346c55cb6033 1307 1308
salvatoregulfo 8:346c55cb6033 1308 1309
salvatoregulfo 8:346c55cb6033 1309 1310
salvatoregulfo 8:346c55cb6033 1310 1311 /**
salvatoregulfo 8:346c55cb6033 1311 1312 * @brief Processing function for the Q15 Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1312 1313 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1313 1314 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1314 1315 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1315 1316 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1316 1317 * @return none.
salvatoregulfo 8:346c55cb6033 1317 1318 */
salvatoregulfo 8:346c55cb6033 1318 1319
salvatoregulfo 8:346c55cb6033 1319 1320 void arm_biquad_cascade_df1_q15(
salvatoregulfo 8:346c55cb6033 1320 1321 const arm_biquad_casd_df1_inst_q15 * S,
salvatoregulfo 8:346c55cb6033 1321 1322 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 1322 1323 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 1323 1324 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1324 1325
salvatoregulfo 8:346c55cb6033 1325 1326 /**
salvatoregulfo 8:346c55cb6033 1326 1327 * @brief Initialization function for the Q15 Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1327 1328 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1328 1329 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 1329 1330 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1330 1331 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1331 1332 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
salvatoregulfo 8:346c55cb6033 1332 1333 * @return none
salvatoregulfo 8:346c55cb6033 1333 1334 */
salvatoregulfo 8:346c55cb6033 1334 1335
salvatoregulfo 8:346c55cb6033 1335 1336 void arm_biquad_cascade_df1_init_q15(
salvatoregulfo 8:346c55cb6033 1336 1337 arm_biquad_casd_df1_inst_q15 * S,
salvatoregulfo 8:346c55cb6033 1337 1338 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 1338 1339 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1339 1340 q15_t * pState,
salvatoregulfo 8:346c55cb6033 1340 1341 int8_t postShift);
salvatoregulfo 8:346c55cb6033 1341 1342
salvatoregulfo 8:346c55cb6033 1342 1343
salvatoregulfo 8:346c55cb6033 1343 1344 /**
salvatoregulfo 8:346c55cb6033 1344 1345 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 1345 1346 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1346 1347 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1347 1348 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1348 1349 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1349 1350 * @return none.
salvatoregulfo 8:346c55cb6033 1350 1351 */
salvatoregulfo 8:346c55cb6033 1351 1352
salvatoregulfo 8:346c55cb6033 1352 1353 void arm_biquad_cascade_df1_fast_q15(
salvatoregulfo 8:346c55cb6033 1353 1354 const arm_biquad_casd_df1_inst_q15 * S,
salvatoregulfo 8:346c55cb6033 1354 1355 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 1355 1356 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 1356 1357 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1357 1358
salvatoregulfo 8:346c55cb6033 1358 1359
salvatoregulfo 8:346c55cb6033 1359 1360 /**
salvatoregulfo 8:346c55cb6033 1360 1361 * @brief Processing function for the Q31 Biquad cascade filter
salvatoregulfo 8:346c55cb6033 1361 1362 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1362 1363 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1363 1364 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1364 1365 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1365 1366 * @return none.
salvatoregulfo 8:346c55cb6033 1366 1367 */
salvatoregulfo 8:346c55cb6033 1367 1368
salvatoregulfo 8:346c55cb6033 1368 1369 void arm_biquad_cascade_df1_q31(
salvatoregulfo 8:346c55cb6033 1369 1370 const arm_biquad_casd_df1_inst_q31 * S,
salvatoregulfo 8:346c55cb6033 1370 1371 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 1371 1372 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 1372 1373 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1373 1374
salvatoregulfo 8:346c55cb6033 1374 1375 /**
salvatoregulfo 8:346c55cb6033 1375 1376 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 1376 1377 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1377 1378 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1378 1379 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1379 1380 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1380 1381 * @return none.
salvatoregulfo 8:346c55cb6033 1381 1382 */
salvatoregulfo 8:346c55cb6033 1382 1383
salvatoregulfo 8:346c55cb6033 1383 1384 void arm_biquad_cascade_df1_fast_q31(
salvatoregulfo 8:346c55cb6033 1384 1385 const arm_biquad_casd_df1_inst_q31 * S,
salvatoregulfo 8:346c55cb6033 1385 1386 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 1386 1387 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 1387 1388 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1388 1389
salvatoregulfo 8:346c55cb6033 1389 1390 /**
salvatoregulfo 8:346c55cb6033 1390 1391 * @brief Initialization function for the Q31 Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1391 1392 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1392 1393 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 1393 1394 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1394 1395 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1395 1396 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
salvatoregulfo 8:346c55cb6033 1396 1397 * @return none
salvatoregulfo 8:346c55cb6033 1397 1398 */
salvatoregulfo 8:346c55cb6033 1398 1399
salvatoregulfo 8:346c55cb6033 1399 1400 void arm_biquad_cascade_df1_init_q31(
salvatoregulfo 8:346c55cb6033 1400 1401 arm_biquad_casd_df1_inst_q31 * S,
salvatoregulfo 8:346c55cb6033 1401 1402 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 1402 1403 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1403 1404 q31_t * pState,
salvatoregulfo 8:346c55cb6033 1404 1405 int8_t postShift);
salvatoregulfo 8:346c55cb6033 1405 1406
salvatoregulfo 8:346c55cb6033 1406 1407 /**
salvatoregulfo 8:346c55cb6033 1407 1408 * @brief Processing function for the floating-point Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1408 1409 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1409 1410 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 1410 1411 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 1411 1412 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 1412 1413 * @return none.
salvatoregulfo 8:346c55cb6033 1413 1414 */
salvatoregulfo 8:346c55cb6033 1414 1415
salvatoregulfo 8:346c55cb6033 1415 1416 void arm_biquad_cascade_df1_f32(
salvatoregulfo 8:346c55cb6033 1416 1417 const arm_biquad_casd_df1_inst_f32 * S,
salvatoregulfo 8:346c55cb6033 1417 1418 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 1418 1419 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 1419 1420 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1420 1421
salvatoregulfo 8:346c55cb6033 1421 1422 /**
salvatoregulfo 8:346c55cb6033 1422 1423 * @brief Initialization function for the floating-point Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 1423 1424 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
salvatoregulfo 8:346c55cb6033 1424 1425 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 1425 1426 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 1426 1427 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 1427 1428 * @return none
salvatoregulfo 8:346c55cb6033 1428 1429 */
salvatoregulfo 8:346c55cb6033 1429 1430
salvatoregulfo 8:346c55cb6033 1430 1431 void arm_biquad_cascade_df1_init_f32(
salvatoregulfo 8:346c55cb6033 1431 1432 arm_biquad_casd_df1_inst_f32 * S,
salvatoregulfo 8:346c55cb6033 1432 1433 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 1433 1434 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 1434 1435 float32_t * pState);
salvatoregulfo 8:346c55cb6033 1435 1436
salvatoregulfo 8:346c55cb6033 1436 1437
salvatoregulfo 8:346c55cb6033 1437 1438 /**
salvatoregulfo 8:346c55cb6033 1438 1439 * @brief Instance structure for the floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 1439 1440 */
salvatoregulfo 8:346c55cb6033 1440 1441
salvatoregulfo 8:346c55cb6033 1441 1442 typedef struct
salvatoregulfo 8:346c55cb6033 1442 1443 {
salvatoregulfo 8:346c55cb6033 1443 1444 uint16_t numRows; /**< number of rows of the matrix. */
salvatoregulfo 8:346c55cb6033 1444 1445 uint16_t numCols; /**< number of columns of the matrix. */
salvatoregulfo 8:346c55cb6033 1445 1446 float32_t *pData; /**< points to the data of the matrix. */
salvatoregulfo 8:346c55cb6033 1446 1447 } arm_matrix_instance_f32;
salvatoregulfo 8:346c55cb6033 1447 1448
salvatoregulfo 8:346c55cb6033 1448 1449
salvatoregulfo 8:346c55cb6033 1449 1450 /**
salvatoregulfo 8:346c55cb6033 1450 1451 * @brief Instance structure for the floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 1451 1452 */
salvatoregulfo 8:346c55cb6033 1452 1453
salvatoregulfo 8:346c55cb6033 1453 1454 typedef struct
salvatoregulfo 8:346c55cb6033 1454 1455 {
salvatoregulfo 8:346c55cb6033 1455 1456 uint16_t numRows; /**< number of rows of the matrix. */
salvatoregulfo 8:346c55cb6033 1456 1457 uint16_t numCols; /**< number of columns of the matrix. */
salvatoregulfo 8:346c55cb6033 1457 1458 float64_t *pData; /**< points to the data of the matrix. */
salvatoregulfo 8:346c55cb6033 1458 1459 } arm_matrix_instance_f64;
salvatoregulfo 8:346c55cb6033 1459 1460
salvatoregulfo 8:346c55cb6033 1460 1461 /**
salvatoregulfo 8:346c55cb6033 1461 1462 * @brief Instance structure for the Q15 matrix structure.
salvatoregulfo 8:346c55cb6033 1462 1463 */
salvatoregulfo 8:346c55cb6033 1463 1464
salvatoregulfo 8:346c55cb6033 1464 1465 typedef struct
salvatoregulfo 8:346c55cb6033 1465 1466 {
salvatoregulfo 8:346c55cb6033 1466 1467 uint16_t numRows; /**< number of rows of the matrix. */
salvatoregulfo 8:346c55cb6033 1467 1468 uint16_t numCols; /**< number of columns of the matrix. */
salvatoregulfo 8:346c55cb6033 1468 1469 q15_t *pData; /**< points to the data of the matrix. */
salvatoregulfo 8:346c55cb6033 1469 1470
salvatoregulfo 8:346c55cb6033 1470 1471 } arm_matrix_instance_q15;
salvatoregulfo 8:346c55cb6033 1471 1472
salvatoregulfo 8:346c55cb6033 1472 1473 /**
salvatoregulfo 8:346c55cb6033 1473 1474 * @brief Instance structure for the Q31 matrix structure.
salvatoregulfo 8:346c55cb6033 1474 1475 */
salvatoregulfo 8:346c55cb6033 1475 1476
salvatoregulfo 8:346c55cb6033 1476 1477 typedef struct
salvatoregulfo 8:346c55cb6033 1477 1478 {
salvatoregulfo 8:346c55cb6033 1478 1479 uint16_t numRows; /**< number of rows of the matrix. */
salvatoregulfo 8:346c55cb6033 1479 1480 uint16_t numCols; /**< number of columns of the matrix. */
salvatoregulfo 8:346c55cb6033 1480 1481 q31_t *pData; /**< points to the data of the matrix. */
salvatoregulfo 8:346c55cb6033 1481 1482
salvatoregulfo 8:346c55cb6033 1482 1483 } arm_matrix_instance_q31;
salvatoregulfo 8:346c55cb6033 1483 1484
salvatoregulfo 8:346c55cb6033 1484 1485
salvatoregulfo 8:346c55cb6033 1485 1486
salvatoregulfo 8:346c55cb6033 1486 1487 /**
salvatoregulfo 8:346c55cb6033 1487 1488 * @brief Floating-point matrix addition.
salvatoregulfo 8:346c55cb6033 1488 1489 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1489 1490 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1490 1491 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1491 1492 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1492 1493 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1493 1494 */
salvatoregulfo 8:346c55cb6033 1494 1495
salvatoregulfo 8:346c55cb6033 1495 1496 arm_status arm_mat_add_f32(
salvatoregulfo 8:346c55cb6033 1496 1497 const arm_matrix_instance_f32 * pSrcA,
salvatoregulfo 8:346c55cb6033 1497 1498 const arm_matrix_instance_f32 * pSrcB,
salvatoregulfo 8:346c55cb6033 1498 1499 arm_matrix_instance_f32 * pDst);
salvatoregulfo 8:346c55cb6033 1499 1500
salvatoregulfo 8:346c55cb6033 1500 1501 /**
salvatoregulfo 8:346c55cb6033 1501 1502 * @brief Q15 matrix addition.
salvatoregulfo 8:346c55cb6033 1502 1503 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1503 1504 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1504 1505 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1505 1506 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1506 1507 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1507 1508 */
salvatoregulfo 8:346c55cb6033 1508 1509
salvatoregulfo 8:346c55cb6033 1509 1510 arm_status arm_mat_add_q15(
salvatoregulfo 8:346c55cb6033 1510 1511 const arm_matrix_instance_q15 * pSrcA,
salvatoregulfo 8:346c55cb6033 1511 1512 const arm_matrix_instance_q15 * pSrcB,
salvatoregulfo 8:346c55cb6033 1512 1513 arm_matrix_instance_q15 * pDst);
salvatoregulfo 8:346c55cb6033 1513 1514
salvatoregulfo 8:346c55cb6033 1514 1515 /**
salvatoregulfo 8:346c55cb6033 1515 1516 * @brief Q31 matrix addition.
salvatoregulfo 8:346c55cb6033 1516 1517 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1517 1518 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1518 1519 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1519 1520 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1520 1521 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1521 1522 */
salvatoregulfo 8:346c55cb6033 1522 1523
salvatoregulfo 8:346c55cb6033 1523 1524 arm_status arm_mat_add_q31(
salvatoregulfo 8:346c55cb6033 1524 1525 const arm_matrix_instance_q31 * pSrcA,
salvatoregulfo 8:346c55cb6033 1525 1526 const arm_matrix_instance_q31 * pSrcB,
salvatoregulfo 8:346c55cb6033 1526 1527 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1527 1528
salvatoregulfo 8:346c55cb6033 1528 1529 /**
salvatoregulfo 8:346c55cb6033 1529 1530 * @brief Floating-point, complex, matrix multiplication.
salvatoregulfo 8:346c55cb6033 1530 1531 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1531 1532 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1532 1533 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1533 1534 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1534 1535 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1535 1536 */
salvatoregulfo 8:346c55cb6033 1536 1537
salvatoregulfo 8:346c55cb6033 1537 1538 arm_status arm_mat_cmplx_mult_f32(
salvatoregulfo 8:346c55cb6033 1538 1539 const arm_matrix_instance_f32 * pSrcA,
salvatoregulfo 8:346c55cb6033 1539 1540 const arm_matrix_instance_f32 * pSrcB,
salvatoregulfo 8:346c55cb6033 1540 1541 arm_matrix_instance_f32 * pDst);
salvatoregulfo 8:346c55cb6033 1541 1542
salvatoregulfo 8:346c55cb6033 1542 1543 /**
salvatoregulfo 8:346c55cb6033 1543 1544 * @brief Q15, complex, matrix multiplication.
salvatoregulfo 8:346c55cb6033 1544 1545 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1545 1546 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1546 1547 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1547 1548 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1548 1549 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1549 1550 */
salvatoregulfo 8:346c55cb6033 1550 1551
salvatoregulfo 8:346c55cb6033 1551 1552 arm_status arm_mat_cmplx_mult_q15(
salvatoregulfo 8:346c55cb6033 1552 1553 const arm_matrix_instance_q15 * pSrcA,
salvatoregulfo 8:346c55cb6033 1553 1554 const arm_matrix_instance_q15 * pSrcB,
salvatoregulfo 8:346c55cb6033 1554 1555 arm_matrix_instance_q15 * pDst,
salvatoregulfo 8:346c55cb6033 1555 1556 q15_t * pScratch);
salvatoregulfo 8:346c55cb6033 1556 1557
salvatoregulfo 8:346c55cb6033 1557 1558 /**
salvatoregulfo 8:346c55cb6033 1558 1559 * @brief Q31, complex, matrix multiplication.
salvatoregulfo 8:346c55cb6033 1559 1560 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1560 1561 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1561 1562 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1562 1563 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1563 1564 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1564 1565 */
salvatoregulfo 8:346c55cb6033 1565 1566
salvatoregulfo 8:346c55cb6033 1566 1567 arm_status arm_mat_cmplx_mult_q31(
salvatoregulfo 8:346c55cb6033 1567 1568 const arm_matrix_instance_q31 * pSrcA,
salvatoregulfo 8:346c55cb6033 1568 1569 const arm_matrix_instance_q31 * pSrcB,
salvatoregulfo 8:346c55cb6033 1569 1570 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1570 1571
salvatoregulfo 8:346c55cb6033 1571 1572
salvatoregulfo 8:346c55cb6033 1572 1573 /**
salvatoregulfo 8:346c55cb6033 1573 1574 * @brief Floating-point matrix transpose.
salvatoregulfo 8:346c55cb6033 1574 1575 * @param[in] *pSrc points to the input matrix
salvatoregulfo 8:346c55cb6033 1575 1576 * @param[out] *pDst points to the output matrix
salvatoregulfo 8:346c55cb6033 1576 1577 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
salvatoregulfo 8:346c55cb6033 1577 1578 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1578 1579 */
salvatoregulfo 8:346c55cb6033 1579 1580
salvatoregulfo 8:346c55cb6033 1580 1581 arm_status arm_mat_trans_f32(
salvatoregulfo 8:346c55cb6033 1581 1582 const arm_matrix_instance_f32 * pSrc,
salvatoregulfo 8:346c55cb6033 1582 1583 arm_matrix_instance_f32 * pDst);
salvatoregulfo 8:346c55cb6033 1583 1584
salvatoregulfo 8:346c55cb6033 1584 1585
salvatoregulfo 8:346c55cb6033 1585 1586 /**
salvatoregulfo 8:346c55cb6033 1586 1587 * @brief Q15 matrix transpose.
salvatoregulfo 8:346c55cb6033 1587 1588 * @param[in] *pSrc points to the input matrix
salvatoregulfo 8:346c55cb6033 1588 1589 * @param[out] *pDst points to the output matrix
salvatoregulfo 8:346c55cb6033 1589 1590 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
salvatoregulfo 8:346c55cb6033 1590 1591 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1591 1592 */
salvatoregulfo 8:346c55cb6033 1592 1593
salvatoregulfo 8:346c55cb6033 1593 1594 arm_status arm_mat_trans_q15(
salvatoregulfo 8:346c55cb6033 1594 1595 const arm_matrix_instance_q15 * pSrc,
salvatoregulfo 8:346c55cb6033 1595 1596 arm_matrix_instance_q15 * pDst);
salvatoregulfo 8:346c55cb6033 1596 1597
salvatoregulfo 8:346c55cb6033 1597 1598 /**
salvatoregulfo 8:346c55cb6033 1598 1599 * @brief Q31 matrix transpose.
salvatoregulfo 8:346c55cb6033 1599 1600 * @param[in] *pSrc points to the input matrix
salvatoregulfo 8:346c55cb6033 1600 1601 * @param[out] *pDst points to the output matrix
salvatoregulfo 8:346c55cb6033 1601 1602 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
salvatoregulfo 8:346c55cb6033 1602 1603 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1603 1604 */
salvatoregulfo 8:346c55cb6033 1604 1605
salvatoregulfo 8:346c55cb6033 1605 1606 arm_status arm_mat_trans_q31(
salvatoregulfo 8:346c55cb6033 1606 1607 const arm_matrix_instance_q31 * pSrc,
salvatoregulfo 8:346c55cb6033 1607 1608 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1608 1609
salvatoregulfo 8:346c55cb6033 1609 1610
salvatoregulfo 8:346c55cb6033 1610 1611 /**
salvatoregulfo 8:346c55cb6033 1611 1612 * @brief Floating-point matrix multiplication
salvatoregulfo 8:346c55cb6033 1612 1613 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1613 1614 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1614 1615 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1615 1616 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1616 1617 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1617 1618 */
salvatoregulfo 8:346c55cb6033 1618 1619
salvatoregulfo 8:346c55cb6033 1619 1620 arm_status arm_mat_mult_f32(
salvatoregulfo 8:346c55cb6033 1620 1621 const arm_matrix_instance_f32 * pSrcA,
salvatoregulfo 8:346c55cb6033 1621 1622 const arm_matrix_instance_f32 * pSrcB,
salvatoregulfo 8:346c55cb6033 1622 1623 arm_matrix_instance_f32 * pDst);
salvatoregulfo 8:346c55cb6033 1623 1624
salvatoregulfo 8:346c55cb6033 1624 1625 /**
salvatoregulfo 8:346c55cb6033 1625 1626 * @brief Q15 matrix multiplication
salvatoregulfo 8:346c55cb6033 1626 1627 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1627 1628 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1628 1629 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1629 1630 * @param[in] *pState points to the array for storing intermediate results
salvatoregulfo 8:346c55cb6033 1630 1631 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1631 1632 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1632 1633 */
salvatoregulfo 8:346c55cb6033 1633 1634
salvatoregulfo 8:346c55cb6033 1634 1635 arm_status arm_mat_mult_q15(
salvatoregulfo 8:346c55cb6033 1635 1636 const arm_matrix_instance_q15 * pSrcA,
salvatoregulfo 8:346c55cb6033 1636 1637 const arm_matrix_instance_q15 * pSrcB,
salvatoregulfo 8:346c55cb6033 1637 1638 arm_matrix_instance_q15 * pDst,
salvatoregulfo 8:346c55cb6033 1638 1639 q15_t * pState);
salvatoregulfo 8:346c55cb6033 1639 1640
salvatoregulfo 8:346c55cb6033 1640 1641 /**
salvatoregulfo 8:346c55cb6033 1641 1642 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 1642 1643 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1643 1644 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1644 1645 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1645 1646 * @param[in] *pState points to the array for storing intermediate results
salvatoregulfo 8:346c55cb6033 1646 1647 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1647 1648 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1648 1649 */
salvatoregulfo 8:346c55cb6033 1649 1650
salvatoregulfo 8:346c55cb6033 1650 1651 arm_status arm_mat_mult_fast_q15(
salvatoregulfo 8:346c55cb6033 1651 1652 const arm_matrix_instance_q15 * pSrcA,
salvatoregulfo 8:346c55cb6033 1652 1653 const arm_matrix_instance_q15 * pSrcB,
salvatoregulfo 8:346c55cb6033 1653 1654 arm_matrix_instance_q15 * pDst,
salvatoregulfo 8:346c55cb6033 1654 1655 q15_t * pState);
salvatoregulfo 8:346c55cb6033 1655 1656
salvatoregulfo 8:346c55cb6033 1656 1657 /**
salvatoregulfo 8:346c55cb6033 1657 1658 * @brief Q31 matrix multiplication
salvatoregulfo 8:346c55cb6033 1658 1659 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1659 1660 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1660 1661 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1661 1662 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1662 1663 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1663 1664 */
salvatoregulfo 8:346c55cb6033 1664 1665
salvatoregulfo 8:346c55cb6033 1665 1666 arm_status arm_mat_mult_q31(
salvatoregulfo 8:346c55cb6033 1666 1667 const arm_matrix_instance_q31 * pSrcA,
salvatoregulfo 8:346c55cb6033 1667 1668 const arm_matrix_instance_q31 * pSrcB,
salvatoregulfo 8:346c55cb6033 1668 1669 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1669 1670
salvatoregulfo 8:346c55cb6033 1670 1671 /**
salvatoregulfo 8:346c55cb6033 1671 1672 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 1672 1673 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1673 1674 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1674 1675 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1675 1676 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1676 1677 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1677 1678 */
salvatoregulfo 8:346c55cb6033 1678 1679
salvatoregulfo 8:346c55cb6033 1679 1680 arm_status arm_mat_mult_fast_q31(
salvatoregulfo 8:346c55cb6033 1680 1681 const arm_matrix_instance_q31 * pSrcA,
salvatoregulfo 8:346c55cb6033 1681 1682 const arm_matrix_instance_q31 * pSrcB,
salvatoregulfo 8:346c55cb6033 1682 1683 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1683 1684
salvatoregulfo 8:346c55cb6033 1684 1685
salvatoregulfo 8:346c55cb6033 1685 1686 /**
salvatoregulfo 8:346c55cb6033 1686 1687 * @brief Floating-point matrix subtraction
salvatoregulfo 8:346c55cb6033 1687 1688 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1688 1689 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1689 1690 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1690 1691 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1691 1692 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1692 1693 */
salvatoregulfo 8:346c55cb6033 1693 1694
salvatoregulfo 8:346c55cb6033 1694 1695 arm_status arm_mat_sub_f32(
salvatoregulfo 8:346c55cb6033 1695 1696 const arm_matrix_instance_f32 * pSrcA,
salvatoregulfo 8:346c55cb6033 1696 1697 const arm_matrix_instance_f32 * pSrcB,
salvatoregulfo 8:346c55cb6033 1697 1698 arm_matrix_instance_f32 * pDst);
salvatoregulfo 8:346c55cb6033 1698 1699
salvatoregulfo 8:346c55cb6033 1699 1700 /**
salvatoregulfo 8:346c55cb6033 1700 1701 * @brief Q15 matrix subtraction
salvatoregulfo 8:346c55cb6033 1701 1702 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1702 1703 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1703 1704 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1704 1705 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1705 1706 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1706 1707 */
salvatoregulfo 8:346c55cb6033 1707 1708
salvatoregulfo 8:346c55cb6033 1708 1709 arm_status arm_mat_sub_q15(
salvatoregulfo 8:346c55cb6033 1709 1710 const arm_matrix_instance_q15 * pSrcA,
salvatoregulfo 8:346c55cb6033 1710 1711 const arm_matrix_instance_q15 * pSrcB,
salvatoregulfo 8:346c55cb6033 1711 1712 arm_matrix_instance_q15 * pDst);
salvatoregulfo 8:346c55cb6033 1712 1713
salvatoregulfo 8:346c55cb6033 1713 1714 /**
salvatoregulfo 8:346c55cb6033 1714 1715 * @brief Q31 matrix subtraction
salvatoregulfo 8:346c55cb6033 1715 1716 * @param[in] *pSrcA points to the first input matrix structure
salvatoregulfo 8:346c55cb6033 1716 1717 * @param[in] *pSrcB points to the second input matrix structure
salvatoregulfo 8:346c55cb6033 1717 1718 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1718 1719 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1719 1720 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1720 1721 */
salvatoregulfo 8:346c55cb6033 1721 1722
salvatoregulfo 8:346c55cb6033 1722 1723 arm_status arm_mat_sub_q31(
salvatoregulfo 8:346c55cb6033 1723 1724 const arm_matrix_instance_q31 * pSrcA,
salvatoregulfo 8:346c55cb6033 1724 1725 const arm_matrix_instance_q31 * pSrcB,
salvatoregulfo 8:346c55cb6033 1725 1726 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1726 1727
salvatoregulfo 8:346c55cb6033 1727 1728 /**
salvatoregulfo 8:346c55cb6033 1728 1729 * @brief Floating-point matrix scaling.
salvatoregulfo 8:346c55cb6033 1729 1730 * @param[in] *pSrc points to the input matrix
salvatoregulfo 8:346c55cb6033 1730 1731 * @param[in] scale scale factor
salvatoregulfo 8:346c55cb6033 1731 1732 * @param[out] *pDst points to the output matrix
salvatoregulfo 8:346c55cb6033 1732 1733 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1733 1734 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1734 1735 */
salvatoregulfo 8:346c55cb6033 1735 1736
salvatoregulfo 8:346c55cb6033 1736 1737 arm_status arm_mat_scale_f32(
salvatoregulfo 8:346c55cb6033 1737 1738 const arm_matrix_instance_f32 * pSrc,
salvatoregulfo 8:346c55cb6033 1738 1739 float32_t scale,
salvatoregulfo 8:346c55cb6033 1739 1740 arm_matrix_instance_f32 * pDst);
salvatoregulfo 8:346c55cb6033 1740 1741
salvatoregulfo 8:346c55cb6033 1741 1742 /**
salvatoregulfo 8:346c55cb6033 1742 1743 * @brief Q15 matrix scaling.
salvatoregulfo 8:346c55cb6033 1743 1744 * @param[in] *pSrc points to input matrix
salvatoregulfo 8:346c55cb6033 1744 1745 * @param[in] scaleFract fractional portion of the scale factor
salvatoregulfo 8:346c55cb6033 1745 1746 * @param[in] shift number of bits to shift the result by
salvatoregulfo 8:346c55cb6033 1746 1747 * @param[out] *pDst points to output matrix
salvatoregulfo 8:346c55cb6033 1747 1748 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1748 1749 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1749 1750 */
salvatoregulfo 8:346c55cb6033 1750 1751
salvatoregulfo 8:346c55cb6033 1751 1752 arm_status arm_mat_scale_q15(
salvatoregulfo 8:346c55cb6033 1752 1753 const arm_matrix_instance_q15 * pSrc,
salvatoregulfo 8:346c55cb6033 1753 1754 q15_t scaleFract,
salvatoregulfo 8:346c55cb6033 1754 1755 int32_t shift,
salvatoregulfo 8:346c55cb6033 1755 1756 arm_matrix_instance_q15 * pDst);
salvatoregulfo 8:346c55cb6033 1756 1757
salvatoregulfo 8:346c55cb6033 1757 1758 /**
salvatoregulfo 8:346c55cb6033 1758 1759 * @brief Q31 matrix scaling.
salvatoregulfo 8:346c55cb6033 1759 1760 * @param[in] *pSrc points to input matrix
salvatoregulfo 8:346c55cb6033 1760 1761 * @param[in] scaleFract fractional portion of the scale factor
salvatoregulfo 8:346c55cb6033 1761 1762 * @param[in] shift number of bits to shift the result by
salvatoregulfo 8:346c55cb6033 1762 1763 * @param[out] *pDst points to output matrix structure
salvatoregulfo 8:346c55cb6033 1763 1764 * @return The function returns either
salvatoregulfo 8:346c55cb6033 1764 1765 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
salvatoregulfo 8:346c55cb6033 1765 1766 */
salvatoregulfo 8:346c55cb6033 1766 1767
salvatoregulfo 8:346c55cb6033 1767 1768 arm_status arm_mat_scale_q31(
salvatoregulfo 8:346c55cb6033 1768 1769 const arm_matrix_instance_q31 * pSrc,
salvatoregulfo 8:346c55cb6033 1769 1770 q31_t scaleFract,
salvatoregulfo 8:346c55cb6033 1770 1771 int32_t shift,
salvatoregulfo 8:346c55cb6033 1771 1772 arm_matrix_instance_q31 * pDst);
salvatoregulfo 8:346c55cb6033 1772 1773
salvatoregulfo 8:346c55cb6033 1773 1774
salvatoregulfo 8:346c55cb6033 1774 1775 /**
salvatoregulfo 8:346c55cb6033 1775 1776 * @brief Q31 matrix initialization.
salvatoregulfo 8:346c55cb6033 1776 1777 * @param[in,out] *S points to an instance of the floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 1777 1778 * @param[in] nRows number of rows in the matrix.
salvatoregulfo 8:346c55cb6033 1778 1779 * @param[in] nColumns number of columns in the matrix.
salvatoregulfo 8:346c55cb6033 1779 1780 * @param[in] *pData points to the matrix data array.
salvatoregulfo 8:346c55cb6033 1780 1781 * @return none
salvatoregulfo 8:346c55cb6033 1781 1782 */
salvatoregulfo 8:346c55cb6033 1782 1783
salvatoregulfo 8:346c55cb6033 1783 1784 void arm_mat_init_q31(
salvatoregulfo 8:346c55cb6033 1784 1785 arm_matrix_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 1785 1786 uint16_t nRows,
salvatoregulfo 8:346c55cb6033 1786 1787 uint16_t nColumns,
salvatoregulfo 8:346c55cb6033 1787 1788 q31_t * pData);
salvatoregulfo 8:346c55cb6033 1788 1789
salvatoregulfo 8:346c55cb6033 1789 1790 /**
salvatoregulfo 8:346c55cb6033 1790 1791 * @brief Q15 matrix initialization.
salvatoregulfo 8:346c55cb6033 1791 1792 * @param[in,out] *S points to an instance of the floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 1792 1793 * @param[in] nRows number of rows in the matrix.
salvatoregulfo 8:346c55cb6033 1793 1794 * @param[in] nColumns number of columns in the matrix.
salvatoregulfo 8:346c55cb6033 1794 1795 * @param[in] *pData points to the matrix data array.
salvatoregulfo 8:346c55cb6033 1795 1796 * @return none
salvatoregulfo 8:346c55cb6033 1796 1797 */
salvatoregulfo 8:346c55cb6033 1797 1798
salvatoregulfo 8:346c55cb6033 1798 1799 void arm_mat_init_q15(
salvatoregulfo 8:346c55cb6033 1799 1800 arm_matrix_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 1800 1801 uint16_t nRows,
salvatoregulfo 8:346c55cb6033 1801 1802 uint16_t nColumns,
salvatoregulfo 8:346c55cb6033 1802 1803 q15_t * pData);
salvatoregulfo 8:346c55cb6033 1803 1804
salvatoregulfo 8:346c55cb6033 1804 1805 /**
salvatoregulfo 8:346c55cb6033 1805 1806 * @brief Floating-point matrix initialization.
salvatoregulfo 8:346c55cb6033 1806 1807 * @param[in,out] *S points to an instance of the floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 1807 1808 * @param[in] nRows number of rows in the matrix.
salvatoregulfo 8:346c55cb6033 1808 1809 * @param[in] nColumns number of columns in the matrix.
salvatoregulfo 8:346c55cb6033 1809 1810 * @param[in] *pData points to the matrix data array.
salvatoregulfo 8:346c55cb6033 1810 1811 * @return none
salvatoregulfo 8:346c55cb6033 1811 1812 */
salvatoregulfo 8:346c55cb6033 1812 1813
salvatoregulfo 8:346c55cb6033 1813 1814 void arm_mat_init_f32(
salvatoregulfo 8:346c55cb6033 1814 1815 arm_matrix_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 1815 1816 uint16_t nRows,
salvatoregulfo 8:346c55cb6033 1816 1817 uint16_t nColumns,
salvatoregulfo 8:346c55cb6033 1817 1818 float32_t * pData);
salvatoregulfo 8:346c55cb6033 1818 1819
salvatoregulfo 8:346c55cb6033 1819 1820
salvatoregulfo 8:346c55cb6033 1820 1821
salvatoregulfo 8:346c55cb6033 1821 1822 /**
salvatoregulfo 8:346c55cb6033 1822 1823 * @brief Instance structure for the Q15 PID Control.
salvatoregulfo 8:346c55cb6033 1823 1824 */
salvatoregulfo 8:346c55cb6033 1824 1825 typedef struct
salvatoregulfo 8:346c55cb6033 1825 1826 {
salvatoregulfo 8:346c55cb6033 1826 1827 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
salvatoregulfo 8:346c55cb6033 1827 1828 #ifdef ARM_MATH_CM0_FAMILY
salvatoregulfo 8:346c55cb6033 1828 1829 q15_t A1;
salvatoregulfo 8:346c55cb6033 1829 1830 q15_t A2;
salvatoregulfo 8:346c55cb6033 1830 1831 #else
salvatoregulfo 8:346c55cb6033 1831 1832 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
salvatoregulfo 8:346c55cb6033 1832 1833 #endif
salvatoregulfo 8:346c55cb6033 1833 1834 q15_t state[3]; /**< The state array of length 3. */
salvatoregulfo 8:346c55cb6033 1834 1835 q15_t Kp; /**< The proportional gain. */
salvatoregulfo 8:346c55cb6033 1835 1836 q15_t Ki; /**< The integral gain. */
salvatoregulfo 8:346c55cb6033 1836 1837 q15_t Kd; /**< The derivative gain. */
salvatoregulfo 8:346c55cb6033 1837 1838 } arm_pid_instance_q15;
salvatoregulfo 8:346c55cb6033 1838 1839
salvatoregulfo 8:346c55cb6033 1839 1840 /**
salvatoregulfo 8:346c55cb6033 1840 1841 * @brief Instance structure for the Q31 PID Control.
salvatoregulfo 8:346c55cb6033 1841 1842 */
salvatoregulfo 8:346c55cb6033 1842 1843 typedef struct
salvatoregulfo 8:346c55cb6033 1843 1844 {
salvatoregulfo 8:346c55cb6033 1844 1845 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
salvatoregulfo 8:346c55cb6033 1845 1846 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
salvatoregulfo 8:346c55cb6033 1846 1847 q31_t A2; /**< The derived gain, A2 = Kd . */
salvatoregulfo 8:346c55cb6033 1847 1848 q31_t state[3]; /**< The state array of length 3. */
salvatoregulfo 8:346c55cb6033 1848 1849 q31_t Kp; /**< The proportional gain. */
salvatoregulfo 8:346c55cb6033 1849 1850 q31_t Ki; /**< The integral gain. */
salvatoregulfo 8:346c55cb6033 1850 1851 q31_t Kd; /**< The derivative gain. */
salvatoregulfo 8:346c55cb6033 1851 1852
salvatoregulfo 8:346c55cb6033 1852 1853 } arm_pid_instance_q31;
salvatoregulfo 8:346c55cb6033 1853 1854
salvatoregulfo 8:346c55cb6033 1854 1855 /**
salvatoregulfo 8:346c55cb6033 1855 1856 * @brief Instance structure for the floating-point PID Control.
salvatoregulfo 8:346c55cb6033 1856 1857 */
salvatoregulfo 8:346c55cb6033 1857 1858 typedef struct
salvatoregulfo 8:346c55cb6033 1858 1859 {
salvatoregulfo 8:346c55cb6033 1859 1860 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
salvatoregulfo 8:346c55cb6033 1860 1861 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
salvatoregulfo 8:346c55cb6033 1861 1862 float32_t A2; /**< The derived gain, A2 = Kd . */
salvatoregulfo 8:346c55cb6033 1862 1863 float32_t state[3]; /**< The state array of length 3. */
salvatoregulfo 8:346c55cb6033 1863 1864 float32_t Kp; /**< The proportional gain. */
salvatoregulfo 8:346c55cb6033 1864 1865 float32_t Ki; /**< The integral gain. */
salvatoregulfo 8:346c55cb6033 1865 1866 float32_t Kd; /**< The derivative gain. */
salvatoregulfo 8:346c55cb6033 1866 1867 } arm_pid_instance_f32;
salvatoregulfo 8:346c55cb6033 1867 1868
salvatoregulfo 8:346c55cb6033 1868 1869
salvatoregulfo 8:346c55cb6033 1869 1870
salvatoregulfo 8:346c55cb6033 1870 1871 /**
salvatoregulfo 8:346c55cb6033 1871 1872 * @brief Initialization function for the floating-point PID Control.
salvatoregulfo 8:346c55cb6033 1872 1873 * @param[in,out] *S points to an instance of the PID structure.
salvatoregulfo 8:346c55cb6033 1873 1874 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
salvatoregulfo 8:346c55cb6033 1874 1875 * @return none.
salvatoregulfo 8:346c55cb6033 1875 1876 */
salvatoregulfo 8:346c55cb6033 1876 1877 void arm_pid_init_f32(
salvatoregulfo 8:346c55cb6033 1877 1878 arm_pid_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 1878 1879 int32_t resetStateFlag);
salvatoregulfo 8:346c55cb6033 1879 1880
salvatoregulfo 8:346c55cb6033 1880 1881 /**
salvatoregulfo 8:346c55cb6033 1881 1882 * @brief Reset function for the floating-point PID Control.
salvatoregulfo 8:346c55cb6033 1882 1883 * @param[in,out] *S is an instance of the floating-point PID Control structure
salvatoregulfo 8:346c55cb6033 1883 1884 * @return none
salvatoregulfo 8:346c55cb6033 1884 1885 */
salvatoregulfo 8:346c55cb6033 1885 1886 void arm_pid_reset_f32(
salvatoregulfo 8:346c55cb6033 1886 1887 arm_pid_instance_f32 * S);
salvatoregulfo 8:346c55cb6033 1887 1888
salvatoregulfo 8:346c55cb6033 1888 1889
salvatoregulfo 8:346c55cb6033 1889 1890 /**
salvatoregulfo 8:346c55cb6033 1890 1891 * @brief Initialization function for the Q31 PID Control.
salvatoregulfo 8:346c55cb6033 1891 1892 * @param[in,out] *S points to an instance of the Q15 PID structure.
salvatoregulfo 8:346c55cb6033 1892 1893 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
salvatoregulfo 8:346c55cb6033 1893 1894 * @return none.
salvatoregulfo 8:346c55cb6033 1894 1895 */
salvatoregulfo 8:346c55cb6033 1895 1896 void arm_pid_init_q31(
salvatoregulfo 8:346c55cb6033 1896 1897 arm_pid_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 1897 1898 int32_t resetStateFlag);
salvatoregulfo 8:346c55cb6033 1898 1899
salvatoregulfo 8:346c55cb6033 1899 1900
salvatoregulfo 8:346c55cb6033 1900 1901 /**
salvatoregulfo 8:346c55cb6033 1901 1902 * @brief Reset function for the Q31 PID Control.
salvatoregulfo 8:346c55cb6033 1902 1903 * @param[in,out] *S points to an instance of the Q31 PID Control structure
salvatoregulfo 8:346c55cb6033 1903 1904 * @return none
salvatoregulfo 8:346c55cb6033 1904 1905 */
salvatoregulfo 8:346c55cb6033 1905 1906
salvatoregulfo 8:346c55cb6033 1906 1907 void arm_pid_reset_q31(
salvatoregulfo 8:346c55cb6033 1907 1908 arm_pid_instance_q31 * S);
salvatoregulfo 8:346c55cb6033 1908 1909
salvatoregulfo 8:346c55cb6033 1909 1910 /**
salvatoregulfo 8:346c55cb6033 1910 1911 * @brief Initialization function for the Q15 PID Control.
salvatoregulfo 8:346c55cb6033 1911 1912 * @param[in,out] *S points to an instance of the Q15 PID structure.
salvatoregulfo 8:346c55cb6033 1912 1913 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
salvatoregulfo 8:346c55cb6033 1913 1914 * @return none.
salvatoregulfo 8:346c55cb6033 1914 1915 */
salvatoregulfo 8:346c55cb6033 1915 1916 void arm_pid_init_q15(
salvatoregulfo 8:346c55cb6033 1916 1917 arm_pid_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 1917 1918 int32_t resetStateFlag);
salvatoregulfo 8:346c55cb6033 1918 1919
salvatoregulfo 8:346c55cb6033 1919 1920 /**
salvatoregulfo 8:346c55cb6033 1920 1921 * @brief Reset function for the Q15 PID Control.
salvatoregulfo 8:346c55cb6033 1921 1922 * @param[in,out] *S points to an instance of the q15 PID Control structure
salvatoregulfo 8:346c55cb6033 1922 1923 * @return none
salvatoregulfo 8:346c55cb6033 1923 1924 */
salvatoregulfo 8:346c55cb6033 1924 1925 void arm_pid_reset_q15(
salvatoregulfo 8:346c55cb6033 1925 1926 arm_pid_instance_q15 * S);
salvatoregulfo 8:346c55cb6033 1926 1927
salvatoregulfo 8:346c55cb6033 1927 1928
salvatoregulfo 8:346c55cb6033 1928 1929 /**
salvatoregulfo 8:346c55cb6033 1929 1930 * @brief Instance structure for the floating-point Linear Interpolate function.
salvatoregulfo 8:346c55cb6033 1930 1931 */
salvatoregulfo 8:346c55cb6033 1931 1932 typedef struct
salvatoregulfo 8:346c55cb6033 1932 1933 {
salvatoregulfo 8:346c55cb6033 1933 1934 uint32_t nValues; /**< nValues */
salvatoregulfo 8:346c55cb6033 1934 1935 float32_t x1; /**< x1 */
salvatoregulfo 8:346c55cb6033 1935 1936 float32_t xSpacing; /**< xSpacing */
salvatoregulfo 8:346c55cb6033 1936 1937 float32_t *pYData; /**< pointer to the table of Y values */
salvatoregulfo 8:346c55cb6033 1937 1938 } arm_linear_interp_instance_f32;
salvatoregulfo 8:346c55cb6033 1938 1939
salvatoregulfo 8:346c55cb6033 1939 1940 /**
salvatoregulfo 8:346c55cb6033 1940 1941 * @brief Instance structure for the floating-point bilinear interpolation function.
salvatoregulfo 8:346c55cb6033 1941 1942 */
salvatoregulfo 8:346c55cb6033 1942 1943
salvatoregulfo 8:346c55cb6033 1943 1944 typedef struct
salvatoregulfo 8:346c55cb6033 1944 1945 {
salvatoregulfo 8:346c55cb6033 1945 1946 uint16_t numRows; /**< number of rows in the data table. */
salvatoregulfo 8:346c55cb6033 1946 1947 uint16_t numCols; /**< number of columns in the data table. */
salvatoregulfo 8:346c55cb6033 1947 1948 float32_t *pData; /**< points to the data table. */
salvatoregulfo 8:346c55cb6033 1948 1949 } arm_bilinear_interp_instance_f32;
salvatoregulfo 8:346c55cb6033 1949 1950
salvatoregulfo 8:346c55cb6033 1950 1951 /**
salvatoregulfo 8:346c55cb6033 1951 1952 * @brief Instance structure for the Q31 bilinear interpolation function.
salvatoregulfo 8:346c55cb6033 1952 1953 */
salvatoregulfo 8:346c55cb6033 1953 1954
salvatoregulfo 8:346c55cb6033 1954 1955 typedef struct
salvatoregulfo 8:346c55cb6033 1955 1956 {
salvatoregulfo 8:346c55cb6033 1956 1957 uint16_t numRows; /**< number of rows in the data table. */
salvatoregulfo 8:346c55cb6033 1957 1958 uint16_t numCols; /**< number of columns in the data table. */
salvatoregulfo 8:346c55cb6033 1958 1959 q31_t *pData; /**< points to the data table. */
salvatoregulfo 8:346c55cb6033 1959 1960 } arm_bilinear_interp_instance_q31;
salvatoregulfo 8:346c55cb6033 1960 1961
salvatoregulfo 8:346c55cb6033 1961 1962 /**
salvatoregulfo 8:346c55cb6033 1962 1963 * @brief Instance structure for the Q15 bilinear interpolation function.
salvatoregulfo 8:346c55cb6033 1963 1964 */
salvatoregulfo 8:346c55cb6033 1964 1965
salvatoregulfo 8:346c55cb6033 1965 1966 typedef struct
salvatoregulfo 8:346c55cb6033 1966 1967 {
salvatoregulfo 8:346c55cb6033 1967 1968 uint16_t numRows; /**< number of rows in the data table. */
salvatoregulfo 8:346c55cb6033 1968 1969 uint16_t numCols; /**< number of columns in the data table. */
salvatoregulfo 8:346c55cb6033 1969 1970 q15_t *pData; /**< points to the data table. */
salvatoregulfo 8:346c55cb6033 1970 1971 } arm_bilinear_interp_instance_q15;
salvatoregulfo 8:346c55cb6033 1971 1972
salvatoregulfo 8:346c55cb6033 1972 1973 /**
salvatoregulfo 8:346c55cb6033 1973 1974 * @brief Instance structure for the Q15 bilinear interpolation function.
salvatoregulfo 8:346c55cb6033 1974 1975 */
salvatoregulfo 8:346c55cb6033 1975 1976
salvatoregulfo 8:346c55cb6033 1976 1977 typedef struct
salvatoregulfo 8:346c55cb6033 1977 1978 {
salvatoregulfo 8:346c55cb6033 1978 1979 uint16_t numRows; /**< number of rows in the data table. */
salvatoregulfo 8:346c55cb6033 1979 1980 uint16_t numCols; /**< number of columns in the data table. */
salvatoregulfo 8:346c55cb6033 1980 1981 q7_t *pData; /**< points to the data table. */
salvatoregulfo 8:346c55cb6033 1981 1982 } arm_bilinear_interp_instance_q7;
salvatoregulfo 8:346c55cb6033 1982 1983
salvatoregulfo 8:346c55cb6033 1983 1984
salvatoregulfo 8:346c55cb6033 1984 1985 /**
salvatoregulfo 8:346c55cb6033 1985 1986 * @brief Q7 vector multiplication.
salvatoregulfo 8:346c55cb6033 1986 1987 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 1987 1988 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 1988 1989 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 1989 1990 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 1990 1991 * @return none.
salvatoregulfo 8:346c55cb6033 1991 1992 */
salvatoregulfo 8:346c55cb6033 1992 1993
salvatoregulfo 8:346c55cb6033 1993 1994 void arm_mult_q7(
salvatoregulfo 8:346c55cb6033 1994 1995 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 1995 1996 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 1996 1997 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 1997 1998 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 1998 1999
salvatoregulfo 8:346c55cb6033 1999 2000 /**
salvatoregulfo 8:346c55cb6033 2000 2001 * @brief Q15 vector multiplication.
salvatoregulfo 8:346c55cb6033 2001 2002 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2002 2003 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2003 2004 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2004 2005 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2005 2006 * @return none.
salvatoregulfo 8:346c55cb6033 2006 2007 */
salvatoregulfo 8:346c55cb6033 2007 2008
salvatoregulfo 8:346c55cb6033 2008 2009 void arm_mult_q15(
salvatoregulfo 8:346c55cb6033 2009 2010 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2010 2011 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2011 2012 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2012 2013 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2013 2014
salvatoregulfo 8:346c55cb6033 2014 2015 /**
salvatoregulfo 8:346c55cb6033 2015 2016 * @brief Q31 vector multiplication.
salvatoregulfo 8:346c55cb6033 2016 2017 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2017 2018 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2018 2019 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2019 2020 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2020 2021 * @return none.
salvatoregulfo 8:346c55cb6033 2021 2022 */
salvatoregulfo 8:346c55cb6033 2022 2023
salvatoregulfo 8:346c55cb6033 2023 2024 void arm_mult_q31(
salvatoregulfo 8:346c55cb6033 2024 2025 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2025 2026 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2026 2027 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2027 2028 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2028 2029
salvatoregulfo 8:346c55cb6033 2029 2030 /**
salvatoregulfo 8:346c55cb6033 2030 2031 * @brief Floating-point vector multiplication.
salvatoregulfo 8:346c55cb6033 2031 2032 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2032 2033 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2033 2034 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2034 2035 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2035 2036 * @return none.
salvatoregulfo 8:346c55cb6033 2036 2037 */
salvatoregulfo 8:346c55cb6033 2037 2038
salvatoregulfo 8:346c55cb6033 2038 2039 void arm_mult_f32(
salvatoregulfo 8:346c55cb6033 2039 2040 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2040 2041 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2041 2042 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2042 2043 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2043 2044
salvatoregulfo 8:346c55cb6033 2044 2045
salvatoregulfo 8:346c55cb6033 2045 2046
salvatoregulfo 8:346c55cb6033 2046 2047
salvatoregulfo 8:346c55cb6033 2047 2048
salvatoregulfo 8:346c55cb6033 2048 2049
salvatoregulfo 8:346c55cb6033 2049 2050 /**
salvatoregulfo 8:346c55cb6033 2050 2051 * @brief Instance structure for the Q15 CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2051 2052 */
salvatoregulfo 8:346c55cb6033 2052 2053
salvatoregulfo 8:346c55cb6033 2053 2054 typedef struct
salvatoregulfo 8:346c55cb6033 2054 2055 {
salvatoregulfo 8:346c55cb6033 2055 2056 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2056 2057 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
salvatoregulfo 8:346c55cb6033 2057 2058 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2058 2059 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2059 2060 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2060 2061 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2061 2062 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
salvatoregulfo 8:346c55cb6033 2062 2063 } arm_cfft_radix2_instance_q15;
salvatoregulfo 8:346c55cb6033 2063 2064
salvatoregulfo 8:346c55cb6033 2064 2065 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2065 2066 arm_status arm_cfft_radix2_init_q15(
salvatoregulfo 8:346c55cb6033 2066 2067 arm_cfft_radix2_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2067 2068 uint16_t fftLen,
salvatoregulfo 8:346c55cb6033 2068 2069 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2069 2070 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2070 2071
salvatoregulfo 8:346c55cb6033 2071 2072 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2072 2073 void arm_cfft_radix2_q15(
salvatoregulfo 8:346c55cb6033 2073 2074 const arm_cfft_radix2_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2074 2075 q15_t * pSrc);
salvatoregulfo 8:346c55cb6033 2075 2076
salvatoregulfo 8:346c55cb6033 2076 2077
salvatoregulfo 8:346c55cb6033 2077 2078
salvatoregulfo 8:346c55cb6033 2078 2079 /**
salvatoregulfo 8:346c55cb6033 2079 2080 * @brief Instance structure for the Q15 CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2080 2081 */
salvatoregulfo 8:346c55cb6033 2081 2082
salvatoregulfo 8:346c55cb6033 2082 2083 typedef struct
salvatoregulfo 8:346c55cb6033 2083 2084 {
salvatoregulfo 8:346c55cb6033 2084 2085 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2085 2086 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
salvatoregulfo 8:346c55cb6033 2086 2087 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2087 2088 q15_t *pTwiddle; /**< points to the twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2088 2089 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2089 2090 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2090 2091 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
salvatoregulfo 8:346c55cb6033 2091 2092 } arm_cfft_radix4_instance_q15;
salvatoregulfo 8:346c55cb6033 2092 2093
salvatoregulfo 8:346c55cb6033 2093 2094 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2094 2095 arm_status arm_cfft_radix4_init_q15(
salvatoregulfo 8:346c55cb6033 2095 2096 arm_cfft_radix4_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2096 2097 uint16_t fftLen,
salvatoregulfo 8:346c55cb6033 2097 2098 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2098 2099 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2099 2100
salvatoregulfo 8:346c55cb6033 2100 2101 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2101 2102 void arm_cfft_radix4_q15(
salvatoregulfo 8:346c55cb6033 2102 2103 const arm_cfft_radix4_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2103 2104 q15_t * pSrc);
salvatoregulfo 8:346c55cb6033 2104 2105
salvatoregulfo 8:346c55cb6033 2105 2106 /**
salvatoregulfo 8:346c55cb6033 2106 2107 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2107 2108 */
salvatoregulfo 8:346c55cb6033 2108 2109
salvatoregulfo 8:346c55cb6033 2109 2110 typedef struct
salvatoregulfo 8:346c55cb6033 2110 2111 {
salvatoregulfo 8:346c55cb6033 2111 2112 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2112 2113 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
salvatoregulfo 8:346c55cb6033 2113 2114 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2114 2115 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2115 2116 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2116 2117 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2117 2118 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
salvatoregulfo 8:346c55cb6033 2118 2119 } arm_cfft_radix2_instance_q31;
salvatoregulfo 8:346c55cb6033 2119 2120
salvatoregulfo 8:346c55cb6033 2120 2121 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2121 2122 arm_status arm_cfft_radix2_init_q31(
salvatoregulfo 8:346c55cb6033 2122 2123 arm_cfft_radix2_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2123 2124 uint16_t fftLen,
salvatoregulfo 8:346c55cb6033 2124 2125 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2125 2126 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2126 2127
salvatoregulfo 8:346c55cb6033 2127 2128 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2128 2129 void arm_cfft_radix2_q31(
salvatoregulfo 8:346c55cb6033 2129 2130 const arm_cfft_radix2_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2130 2131 q31_t * pSrc);
salvatoregulfo 8:346c55cb6033 2131 2132
salvatoregulfo 8:346c55cb6033 2132 2133 /**
salvatoregulfo 8:346c55cb6033 2133 2134 * @brief Instance structure for the Q31 CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2134 2135 */
salvatoregulfo 8:346c55cb6033 2135 2136
salvatoregulfo 8:346c55cb6033 2136 2137 typedef struct
salvatoregulfo 8:346c55cb6033 2137 2138 {
salvatoregulfo 8:346c55cb6033 2138 2139 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2139 2140 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
salvatoregulfo 8:346c55cb6033 2140 2141 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2141 2142 q31_t *pTwiddle; /**< points to the twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2142 2143 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2143 2144 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2144 2145 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
salvatoregulfo 8:346c55cb6033 2145 2146 } arm_cfft_radix4_instance_q31;
salvatoregulfo 8:346c55cb6033 2146 2147
salvatoregulfo 8:346c55cb6033 2147 2148 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2148 2149 void arm_cfft_radix4_q31(
salvatoregulfo 8:346c55cb6033 2149 2150 const arm_cfft_radix4_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2150 2151 q31_t * pSrc);
salvatoregulfo 8:346c55cb6033 2151 2152
salvatoregulfo 8:346c55cb6033 2152 2153 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2153 2154 arm_status arm_cfft_radix4_init_q31(
salvatoregulfo 8:346c55cb6033 2154 2155 arm_cfft_radix4_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2155 2156 uint16_t fftLen,
salvatoregulfo 8:346c55cb6033 2156 2157 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2157 2158 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2158 2159
salvatoregulfo 8:346c55cb6033 2159 2160 /**
salvatoregulfo 8:346c55cb6033 2160 2161 * @brief Instance structure for the floating-point CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2161 2162 */
salvatoregulfo 8:346c55cb6033 2162 2163
salvatoregulfo 8:346c55cb6033 2163 2164 typedef struct
salvatoregulfo 8:346c55cb6033 2164 2165 {
salvatoregulfo 8:346c55cb6033 2165 2166 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2166 2167 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
salvatoregulfo 8:346c55cb6033 2167 2168 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2168 2169 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2169 2170 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2170 2171 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2171 2172 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
salvatoregulfo 8:346c55cb6033 2172 2173 float32_t onebyfftLen; /**< value of 1/fftLen. */
salvatoregulfo 8:346c55cb6033 2173 2174 } arm_cfft_radix2_instance_f32;
salvatoregulfo 8:346c55cb6033 2174 2175
salvatoregulfo 8:346c55cb6033 2175 2176 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2176 2177 arm_status arm_cfft_radix2_init_f32(
salvatoregulfo 8:346c55cb6033 2177 2178 arm_cfft_radix2_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2178 2179 uint16_t fftLen,
salvatoregulfo 8:346c55cb6033 2179 2180 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2180 2181 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2181 2182
salvatoregulfo 8:346c55cb6033 2182 2183 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2183 2184 void arm_cfft_radix2_f32(
salvatoregulfo 8:346c55cb6033 2184 2185 const arm_cfft_radix2_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2185 2186 float32_t * pSrc);
salvatoregulfo 8:346c55cb6033 2186 2187
salvatoregulfo 8:346c55cb6033 2187 2188 /**
salvatoregulfo 8:346c55cb6033 2188 2189 * @brief Instance structure for the floating-point CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2189 2190 */
salvatoregulfo 8:346c55cb6033 2190 2191
salvatoregulfo 8:346c55cb6033 2191 2192 typedef struct
salvatoregulfo 8:346c55cb6033 2192 2193 {
salvatoregulfo 8:346c55cb6033 2193 2194 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2194 2195 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
salvatoregulfo 8:346c55cb6033 2195 2196 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2196 2197 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2197 2198 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2198 2199 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2199 2200 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
salvatoregulfo 8:346c55cb6033 2200 2201 float32_t onebyfftLen; /**< value of 1/fftLen. */
salvatoregulfo 8:346c55cb6033 2201 2202 } arm_cfft_radix4_instance_f32;
salvatoregulfo 8:346c55cb6033 2202 2203
salvatoregulfo 8:346c55cb6033 2203 2204 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2204 2205 arm_status arm_cfft_radix4_init_f32(
salvatoregulfo 8:346c55cb6033 2205 2206 arm_cfft_radix4_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2206 2207 uint16_t fftLen,
salvatoregulfo 8:346c55cb6033 2207 2208 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2208 2209 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2209 2210
salvatoregulfo 8:346c55cb6033 2210 2211 /* Deprecated */
salvatoregulfo 8:346c55cb6033 2211 2212 void arm_cfft_radix4_f32(
salvatoregulfo 8:346c55cb6033 2212 2213 const arm_cfft_radix4_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2213 2214 float32_t * pSrc);
salvatoregulfo 8:346c55cb6033 2214 2215
salvatoregulfo 8:346c55cb6033 2215 2216 /**
salvatoregulfo 8:346c55cb6033 2216 2217 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2217 2218 */
salvatoregulfo 8:346c55cb6033 2218 2219
salvatoregulfo 8:346c55cb6033 2219 2220 typedef struct
salvatoregulfo 8:346c55cb6033 2220 2221 {
salvatoregulfo 8:346c55cb6033 2221 2222 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2222 2223 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2223 2224 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2224 2225 uint16_t bitRevLength; /**< bit reversal table length. */
salvatoregulfo 8:346c55cb6033 2225 2226 } arm_cfft_instance_q15;
salvatoregulfo 8:346c55cb6033 2226 2227
salvatoregulfo 8:346c55cb6033 2227 2228 void arm_cfft_q15(
salvatoregulfo 8:346c55cb6033 2228 2229 const arm_cfft_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2229 2230 q15_t * p1,
salvatoregulfo 8:346c55cb6033 2230 2231 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2231 2232 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2232 2233
salvatoregulfo 8:346c55cb6033 2233 2234 /**
salvatoregulfo 8:346c55cb6033 2234 2235 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2235 2236 */
salvatoregulfo 8:346c55cb6033 2236 2237
salvatoregulfo 8:346c55cb6033 2237 2238 typedef struct
salvatoregulfo 8:346c55cb6033 2238 2239 {
salvatoregulfo 8:346c55cb6033 2239 2240 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2240 2241 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2241 2242 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2242 2243 uint16_t bitRevLength; /**< bit reversal table length. */
salvatoregulfo 8:346c55cb6033 2243 2244 } arm_cfft_instance_q31;
salvatoregulfo 8:346c55cb6033 2244 2245
salvatoregulfo 8:346c55cb6033 2245 2246 void arm_cfft_q31(
salvatoregulfo 8:346c55cb6033 2246 2247 const arm_cfft_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2247 2248 q31_t * p1,
salvatoregulfo 8:346c55cb6033 2248 2249 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2249 2250 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2250 2251
salvatoregulfo 8:346c55cb6033 2251 2252 /**
salvatoregulfo 8:346c55cb6033 2252 2253 * @brief Instance structure for the floating-point CFFT/CIFFT function.
salvatoregulfo 8:346c55cb6033 2253 2254 */
salvatoregulfo 8:346c55cb6033 2254 2255
salvatoregulfo 8:346c55cb6033 2255 2256 typedef struct
salvatoregulfo 8:346c55cb6033 2256 2257 {
salvatoregulfo 8:346c55cb6033 2257 2258 uint16_t fftLen; /**< length of the FFT. */
salvatoregulfo 8:346c55cb6033 2258 2259 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2259 2260 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
salvatoregulfo 8:346c55cb6033 2260 2261 uint16_t bitRevLength; /**< bit reversal table length. */
salvatoregulfo 8:346c55cb6033 2261 2262 } arm_cfft_instance_f32;
salvatoregulfo 8:346c55cb6033 2262 2263
salvatoregulfo 8:346c55cb6033 2263 2264 void arm_cfft_f32(
salvatoregulfo 8:346c55cb6033 2264 2265 const arm_cfft_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2265 2266 float32_t * p1,
salvatoregulfo 8:346c55cb6033 2266 2267 uint8_t ifftFlag,
salvatoregulfo 8:346c55cb6033 2267 2268 uint8_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2268 2269
salvatoregulfo 8:346c55cb6033 2269 2270 /**
salvatoregulfo 8:346c55cb6033 2270 2271 * @brief Instance structure for the Q15 RFFT/RIFFT function.
salvatoregulfo 8:346c55cb6033 2271 2272 */
salvatoregulfo 8:346c55cb6033 2272 2273
salvatoregulfo 8:346c55cb6033 2273 2274 typedef struct
salvatoregulfo 8:346c55cb6033 2274 2275 {
salvatoregulfo 8:346c55cb6033 2275 2276 uint32_t fftLenReal; /**< length of the real FFT. */
salvatoregulfo 8:346c55cb6033 2276 2277 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
salvatoregulfo 8:346c55cb6033 2277 2278 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2278 2279 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2279 2280 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2280 2281 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2281 2282 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
salvatoregulfo 8:346c55cb6033 2282 2283 } arm_rfft_instance_q15;
salvatoregulfo 8:346c55cb6033 2283 2284
salvatoregulfo 8:346c55cb6033 2284 2285 arm_status arm_rfft_init_q15(
salvatoregulfo 8:346c55cb6033 2285 2286 arm_rfft_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2286 2287 uint32_t fftLenReal,
salvatoregulfo 8:346c55cb6033 2287 2288 uint32_t ifftFlagR,
salvatoregulfo 8:346c55cb6033 2288 2289 uint32_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2289 2290
salvatoregulfo 8:346c55cb6033 2290 2291 void arm_rfft_q15(
salvatoregulfo 8:346c55cb6033 2291 2292 const arm_rfft_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2292 2293 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2293 2294 q15_t * pDst);
salvatoregulfo 8:346c55cb6033 2294 2295
salvatoregulfo 8:346c55cb6033 2295 2296 /**
salvatoregulfo 8:346c55cb6033 2296 2297 * @brief Instance structure for the Q31 RFFT/RIFFT function.
salvatoregulfo 8:346c55cb6033 2297 2298 */
salvatoregulfo 8:346c55cb6033 2298 2299
salvatoregulfo 8:346c55cb6033 2299 2300 typedef struct
salvatoregulfo 8:346c55cb6033 2300 2301 {
salvatoregulfo 8:346c55cb6033 2301 2302 uint32_t fftLenReal; /**< length of the real FFT. */
salvatoregulfo 8:346c55cb6033 2302 2303 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
salvatoregulfo 8:346c55cb6033 2303 2304 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2304 2305 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2305 2306 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2306 2307 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2307 2308 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
salvatoregulfo 8:346c55cb6033 2308 2309 } arm_rfft_instance_q31;
salvatoregulfo 8:346c55cb6033 2309 2310
salvatoregulfo 8:346c55cb6033 2310 2311 arm_status arm_rfft_init_q31(
salvatoregulfo 8:346c55cb6033 2311 2312 arm_rfft_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2312 2313 uint32_t fftLenReal,
salvatoregulfo 8:346c55cb6033 2313 2314 uint32_t ifftFlagR,
salvatoregulfo 8:346c55cb6033 2314 2315 uint32_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2315 2316
salvatoregulfo 8:346c55cb6033 2316 2317 void arm_rfft_q31(
salvatoregulfo 8:346c55cb6033 2317 2318 const arm_rfft_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2318 2319 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 2319 2320 q31_t * pDst);
salvatoregulfo 8:346c55cb6033 2320 2321
salvatoregulfo 8:346c55cb6033 2321 2322 /**
salvatoregulfo 8:346c55cb6033 2322 2323 * @brief Instance structure for the floating-point RFFT/RIFFT function.
salvatoregulfo 8:346c55cb6033 2323 2324 */
salvatoregulfo 8:346c55cb6033 2324 2325
salvatoregulfo 8:346c55cb6033 2325 2326 typedef struct
salvatoregulfo 8:346c55cb6033 2326 2327 {
salvatoregulfo 8:346c55cb6033 2327 2328 uint32_t fftLenReal; /**< length of the real FFT. */
salvatoregulfo 8:346c55cb6033 2328 2329 uint16_t fftLenBy2; /**< length of the complex FFT. */
salvatoregulfo 8:346c55cb6033 2329 2330 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
salvatoregulfo 8:346c55cb6033 2330 2331 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
salvatoregulfo 8:346c55cb6033 2331 2332 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2332 2333 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2333 2334 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2334 2335 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
salvatoregulfo 8:346c55cb6033 2335 2336 } arm_rfft_instance_f32;
salvatoregulfo 8:346c55cb6033 2336 2337
salvatoregulfo 8:346c55cb6033 2337 2338 arm_status arm_rfft_init_f32(
salvatoregulfo 8:346c55cb6033 2338 2339 arm_rfft_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2339 2340 arm_cfft_radix4_instance_f32 * S_CFFT,
salvatoregulfo 8:346c55cb6033 2340 2341 uint32_t fftLenReal,
salvatoregulfo 8:346c55cb6033 2341 2342 uint32_t ifftFlagR,
salvatoregulfo 8:346c55cb6033 2342 2343 uint32_t bitReverseFlag);
salvatoregulfo 8:346c55cb6033 2343 2344
salvatoregulfo 8:346c55cb6033 2344 2345 void arm_rfft_f32(
salvatoregulfo 8:346c55cb6033 2345 2346 const arm_rfft_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2346 2347 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 2347 2348 float32_t * pDst);
salvatoregulfo 8:346c55cb6033 2348 2349
salvatoregulfo 8:346c55cb6033 2349 2350 /**
salvatoregulfo 8:346c55cb6033 2350 2351 * @brief Instance structure for the floating-point RFFT/RIFFT function.
salvatoregulfo 8:346c55cb6033 2351 2352 */
salvatoregulfo 8:346c55cb6033 2352 2353
salvatoregulfo 8:346c55cb6033 2353 2354 typedef struct
salvatoregulfo 8:346c55cb6033 2354 2355 {
salvatoregulfo 8:346c55cb6033 2355 2356 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
salvatoregulfo 8:346c55cb6033 2356 2357 uint16_t fftLenRFFT; /**< length of the real sequence */
salvatoregulfo 8:346c55cb6033 2357 2358 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
salvatoregulfo 8:346c55cb6033 2358 2359 } arm_rfft_fast_instance_f32 ;
salvatoregulfo 8:346c55cb6033 2359 2360
salvatoregulfo 8:346c55cb6033 2360 2361 arm_status arm_rfft_fast_init_f32 (
salvatoregulfo 8:346c55cb6033 2361 2362 arm_rfft_fast_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2362 2363 uint16_t fftLen);
salvatoregulfo 8:346c55cb6033 2363 2364
salvatoregulfo 8:346c55cb6033 2364 2365 void arm_rfft_fast_f32(
salvatoregulfo 8:346c55cb6033 2365 2366 arm_rfft_fast_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2366 2367 float32_t * p, float32_t * pOut,
salvatoregulfo 8:346c55cb6033 2367 2368 uint8_t ifftFlag);
salvatoregulfo 8:346c55cb6033 2368 2369
salvatoregulfo 8:346c55cb6033 2369 2370 /**
salvatoregulfo 8:346c55cb6033 2370 2371 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
salvatoregulfo 8:346c55cb6033 2371 2372 */
salvatoregulfo 8:346c55cb6033 2372 2373
salvatoregulfo 8:346c55cb6033 2373 2374 typedef struct
salvatoregulfo 8:346c55cb6033 2374 2375 {
salvatoregulfo 8:346c55cb6033 2375 2376 uint16_t N; /**< length of the DCT4. */
salvatoregulfo 8:346c55cb6033 2376 2377 uint16_t Nby2; /**< half of the length of the DCT4. */
salvatoregulfo 8:346c55cb6033 2377 2378 float32_t normalize; /**< normalizing factor. */
salvatoregulfo 8:346c55cb6033 2378 2379 float32_t *pTwiddle; /**< points to the twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2379 2380 float32_t *pCosFactor; /**< points to the cosFactor table. */
salvatoregulfo 8:346c55cb6033 2380 2381 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
salvatoregulfo 8:346c55cb6033 2381 2382 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
salvatoregulfo 8:346c55cb6033 2382 2383 } arm_dct4_instance_f32;
salvatoregulfo 8:346c55cb6033 2383 2384
salvatoregulfo 8:346c55cb6033 2384 2385 /**
salvatoregulfo 8:346c55cb6033 2385 2386 * @brief Initialization function for the floating-point DCT4/IDCT4.
salvatoregulfo 8:346c55cb6033 2386 2387 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
salvatoregulfo 8:346c55cb6033 2387 2388 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
salvatoregulfo 8:346c55cb6033 2388 2389 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
salvatoregulfo 8:346c55cb6033 2389 2390 * @param[in] N length of the DCT4.
salvatoregulfo 8:346c55cb6033 2390 2391 * @param[in] Nby2 half of the length of the DCT4.
salvatoregulfo 8:346c55cb6033 2391 2392 * @param[in] normalize normalizing factor.
salvatoregulfo 8:346c55cb6033 2392 2393 * @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.
salvatoregulfo 8:346c55cb6033 2393 2394 */
salvatoregulfo 8:346c55cb6033 2394 2395
salvatoregulfo 8:346c55cb6033 2395 2396 arm_status arm_dct4_init_f32(
salvatoregulfo 8:346c55cb6033 2396 2397 arm_dct4_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2397 2398 arm_rfft_instance_f32 * S_RFFT,
salvatoregulfo 8:346c55cb6033 2398 2399 arm_cfft_radix4_instance_f32 * S_CFFT,
salvatoregulfo 8:346c55cb6033 2399 2400 uint16_t N,
salvatoregulfo 8:346c55cb6033 2400 2401 uint16_t Nby2,
salvatoregulfo 8:346c55cb6033 2401 2402 float32_t normalize);
salvatoregulfo 8:346c55cb6033 2402 2403
salvatoregulfo 8:346c55cb6033 2403 2404 /**
salvatoregulfo 8:346c55cb6033 2404 2405 * @brief Processing function for the floating-point DCT4/IDCT4.
salvatoregulfo 8:346c55cb6033 2405 2406 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
salvatoregulfo 8:346c55cb6033 2406 2407 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 2407 2408 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
salvatoregulfo 8:346c55cb6033 2408 2409 * @return none.
salvatoregulfo 8:346c55cb6033 2409 2410 */
salvatoregulfo 8:346c55cb6033 2410 2411
salvatoregulfo 8:346c55cb6033 2411 2412 void arm_dct4_f32(
salvatoregulfo 8:346c55cb6033 2412 2413 const arm_dct4_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 2413 2414 float32_t * pState,
salvatoregulfo 8:346c55cb6033 2414 2415 float32_t * pInlineBuffer);
salvatoregulfo 8:346c55cb6033 2415 2416
salvatoregulfo 8:346c55cb6033 2416 2417 /**
salvatoregulfo 8:346c55cb6033 2417 2418 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
salvatoregulfo 8:346c55cb6033 2418 2419 */
salvatoregulfo 8:346c55cb6033 2419 2420
salvatoregulfo 8:346c55cb6033 2420 2421 typedef struct
salvatoregulfo 8:346c55cb6033 2421 2422 {
salvatoregulfo 8:346c55cb6033 2422 2423 uint16_t N; /**< length of the DCT4. */
salvatoregulfo 8:346c55cb6033 2423 2424 uint16_t Nby2; /**< half of the length of the DCT4. */
salvatoregulfo 8:346c55cb6033 2424 2425 q31_t normalize; /**< normalizing factor. */
salvatoregulfo 8:346c55cb6033 2425 2426 q31_t *pTwiddle; /**< points to the twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2426 2427 q31_t *pCosFactor; /**< points to the cosFactor table. */
salvatoregulfo 8:346c55cb6033 2427 2428 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
salvatoregulfo 8:346c55cb6033 2428 2429 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
salvatoregulfo 8:346c55cb6033 2429 2430 } arm_dct4_instance_q31;
salvatoregulfo 8:346c55cb6033 2430 2431
salvatoregulfo 8:346c55cb6033 2431 2432 /**
salvatoregulfo 8:346c55cb6033 2432 2433 * @brief Initialization function for the Q31 DCT4/IDCT4.
salvatoregulfo 8:346c55cb6033 2433 2434 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
salvatoregulfo 8:346c55cb6033 2434 2435 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
salvatoregulfo 8:346c55cb6033 2435 2436 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
salvatoregulfo 8:346c55cb6033 2436 2437 * @param[in] N length of the DCT4.
salvatoregulfo 8:346c55cb6033 2437 2438 * @param[in] Nby2 half of the length of the DCT4.
salvatoregulfo 8:346c55cb6033 2438 2439 * @param[in] normalize normalizing factor.
salvatoregulfo 8:346c55cb6033 2439 2440 * @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.
salvatoregulfo 8:346c55cb6033 2440 2441 */
salvatoregulfo 8:346c55cb6033 2441 2442
salvatoregulfo 8:346c55cb6033 2442 2443 arm_status arm_dct4_init_q31(
salvatoregulfo 8:346c55cb6033 2443 2444 arm_dct4_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2444 2445 arm_rfft_instance_q31 * S_RFFT,
salvatoregulfo 8:346c55cb6033 2445 2446 arm_cfft_radix4_instance_q31 * S_CFFT,
salvatoregulfo 8:346c55cb6033 2446 2447 uint16_t N,
salvatoregulfo 8:346c55cb6033 2447 2448 uint16_t Nby2,
salvatoregulfo 8:346c55cb6033 2448 2449 q31_t normalize);
salvatoregulfo 8:346c55cb6033 2449 2450
salvatoregulfo 8:346c55cb6033 2450 2451 /**
salvatoregulfo 8:346c55cb6033 2451 2452 * @brief Processing function for the Q31 DCT4/IDCT4.
salvatoregulfo 8:346c55cb6033 2452 2453 * @param[in] *S points to an instance of the Q31 DCT4 structure.
salvatoregulfo 8:346c55cb6033 2453 2454 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 2454 2455 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
salvatoregulfo 8:346c55cb6033 2455 2456 * @return none.
salvatoregulfo 8:346c55cb6033 2456 2457 */
salvatoregulfo 8:346c55cb6033 2457 2458
salvatoregulfo 8:346c55cb6033 2458 2459 void arm_dct4_q31(
salvatoregulfo 8:346c55cb6033 2459 2460 const arm_dct4_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 2460 2461 q31_t * pState,
salvatoregulfo 8:346c55cb6033 2461 2462 q31_t * pInlineBuffer);
salvatoregulfo 8:346c55cb6033 2462 2463
salvatoregulfo 8:346c55cb6033 2463 2464 /**
salvatoregulfo 8:346c55cb6033 2464 2465 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
salvatoregulfo 8:346c55cb6033 2465 2466 */
salvatoregulfo 8:346c55cb6033 2466 2467
salvatoregulfo 8:346c55cb6033 2467 2468 typedef struct
salvatoregulfo 8:346c55cb6033 2468 2469 {
salvatoregulfo 8:346c55cb6033 2469 2470 uint16_t N; /**< length of the DCT4. */
salvatoregulfo 8:346c55cb6033 2470 2471 uint16_t Nby2; /**< half of the length of the DCT4. */
salvatoregulfo 8:346c55cb6033 2471 2472 q15_t normalize; /**< normalizing factor. */
salvatoregulfo 8:346c55cb6033 2472 2473 q15_t *pTwiddle; /**< points to the twiddle factor table. */
salvatoregulfo 8:346c55cb6033 2473 2474 q15_t *pCosFactor; /**< points to the cosFactor table. */
salvatoregulfo 8:346c55cb6033 2474 2475 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
salvatoregulfo 8:346c55cb6033 2475 2476 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
salvatoregulfo 8:346c55cb6033 2476 2477 } arm_dct4_instance_q15;
salvatoregulfo 8:346c55cb6033 2477 2478
salvatoregulfo 8:346c55cb6033 2478 2479 /**
salvatoregulfo 8:346c55cb6033 2479 2480 * @brief Initialization function for the Q15 DCT4/IDCT4.
salvatoregulfo 8:346c55cb6033 2480 2481 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
salvatoregulfo 8:346c55cb6033 2481 2482 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
salvatoregulfo 8:346c55cb6033 2482 2483 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
salvatoregulfo 8:346c55cb6033 2483 2484 * @param[in] N length of the DCT4.
salvatoregulfo 8:346c55cb6033 2484 2485 * @param[in] Nby2 half of the length of the DCT4.
salvatoregulfo 8:346c55cb6033 2485 2486 * @param[in] normalize normalizing factor.
salvatoregulfo 8:346c55cb6033 2486 2487 * @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.
salvatoregulfo 8:346c55cb6033 2487 2488 */
salvatoregulfo 8:346c55cb6033 2488 2489
salvatoregulfo 8:346c55cb6033 2489 2490 arm_status arm_dct4_init_q15(
salvatoregulfo 8:346c55cb6033 2490 2491 arm_dct4_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2491 2492 arm_rfft_instance_q15 * S_RFFT,
salvatoregulfo 8:346c55cb6033 2492 2493 arm_cfft_radix4_instance_q15 * S_CFFT,
salvatoregulfo 8:346c55cb6033 2493 2494 uint16_t N,
salvatoregulfo 8:346c55cb6033 2494 2495 uint16_t Nby2,
salvatoregulfo 8:346c55cb6033 2495 2496 q15_t normalize);
salvatoregulfo 8:346c55cb6033 2496 2497
salvatoregulfo 8:346c55cb6033 2497 2498 /**
salvatoregulfo 8:346c55cb6033 2498 2499 * @brief Processing function for the Q15 DCT4/IDCT4.
salvatoregulfo 8:346c55cb6033 2499 2500 * @param[in] *S points to an instance of the Q15 DCT4 structure.
salvatoregulfo 8:346c55cb6033 2500 2501 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 2501 2502 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
salvatoregulfo 8:346c55cb6033 2502 2503 * @return none.
salvatoregulfo 8:346c55cb6033 2503 2504 */
salvatoregulfo 8:346c55cb6033 2504 2505
salvatoregulfo 8:346c55cb6033 2505 2506 void arm_dct4_q15(
salvatoregulfo 8:346c55cb6033 2506 2507 const arm_dct4_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 2507 2508 q15_t * pState,
salvatoregulfo 8:346c55cb6033 2508 2509 q15_t * pInlineBuffer);
salvatoregulfo 8:346c55cb6033 2509 2510
salvatoregulfo 8:346c55cb6033 2510 2511 /**
salvatoregulfo 8:346c55cb6033 2511 2512 * @brief Floating-point vector addition.
salvatoregulfo 8:346c55cb6033 2512 2513 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2513 2514 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2514 2515 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2515 2516 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2516 2517 * @return none.
salvatoregulfo 8:346c55cb6033 2517 2518 */
salvatoregulfo 8:346c55cb6033 2518 2519
salvatoregulfo 8:346c55cb6033 2519 2520 void arm_add_f32(
salvatoregulfo 8:346c55cb6033 2520 2521 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2521 2522 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2522 2523 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2523 2524 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2524 2525
salvatoregulfo 8:346c55cb6033 2525 2526 /**
salvatoregulfo 8:346c55cb6033 2526 2527 * @brief Q7 vector addition.
salvatoregulfo 8:346c55cb6033 2527 2528 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2528 2529 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2529 2530 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2530 2531 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2531 2532 * @return none.
salvatoregulfo 8:346c55cb6033 2532 2533 */
salvatoregulfo 8:346c55cb6033 2533 2534
salvatoregulfo 8:346c55cb6033 2534 2535 void arm_add_q7(
salvatoregulfo 8:346c55cb6033 2535 2536 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2536 2537 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2537 2538 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2538 2539 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2539 2540
salvatoregulfo 8:346c55cb6033 2540 2541 /**
salvatoregulfo 8:346c55cb6033 2541 2542 * @brief Q15 vector addition.
salvatoregulfo 8:346c55cb6033 2542 2543 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2543 2544 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2544 2545 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2545 2546 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2546 2547 * @return none.
salvatoregulfo 8:346c55cb6033 2547 2548 */
salvatoregulfo 8:346c55cb6033 2548 2549
salvatoregulfo 8:346c55cb6033 2549 2550 void arm_add_q15(
salvatoregulfo 8:346c55cb6033 2550 2551 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2551 2552 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2552 2553 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2553 2554 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2554 2555
salvatoregulfo 8:346c55cb6033 2555 2556 /**
salvatoregulfo 8:346c55cb6033 2556 2557 * @brief Q31 vector addition.
salvatoregulfo 8:346c55cb6033 2557 2558 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2558 2559 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2559 2560 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2560 2561 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2561 2562 * @return none.
salvatoregulfo 8:346c55cb6033 2562 2563 */
salvatoregulfo 8:346c55cb6033 2563 2564
salvatoregulfo 8:346c55cb6033 2564 2565 void arm_add_q31(
salvatoregulfo 8:346c55cb6033 2565 2566 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2566 2567 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2567 2568 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2568 2569 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2569 2570
salvatoregulfo 8:346c55cb6033 2570 2571 /**
salvatoregulfo 8:346c55cb6033 2571 2572 * @brief Floating-point vector subtraction.
salvatoregulfo 8:346c55cb6033 2572 2573 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2573 2574 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2574 2575 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2575 2576 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2576 2577 * @return none.
salvatoregulfo 8:346c55cb6033 2577 2578 */
salvatoregulfo 8:346c55cb6033 2578 2579
salvatoregulfo 8:346c55cb6033 2579 2580 void arm_sub_f32(
salvatoregulfo 8:346c55cb6033 2580 2581 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2581 2582 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2582 2583 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2583 2584 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2584 2585
salvatoregulfo 8:346c55cb6033 2585 2586 /**
salvatoregulfo 8:346c55cb6033 2586 2587 * @brief Q7 vector subtraction.
salvatoregulfo 8:346c55cb6033 2587 2588 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2588 2589 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2589 2590 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2590 2591 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2591 2592 * @return none.
salvatoregulfo 8:346c55cb6033 2592 2593 */
salvatoregulfo 8:346c55cb6033 2593 2594
salvatoregulfo 8:346c55cb6033 2594 2595 void arm_sub_q7(
salvatoregulfo 8:346c55cb6033 2595 2596 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2596 2597 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2597 2598 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2598 2599 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2599 2600
salvatoregulfo 8:346c55cb6033 2600 2601 /**
salvatoregulfo 8:346c55cb6033 2601 2602 * @brief Q15 vector subtraction.
salvatoregulfo 8:346c55cb6033 2602 2603 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2603 2604 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2604 2605 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2605 2606 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2606 2607 * @return none.
salvatoregulfo 8:346c55cb6033 2607 2608 */
salvatoregulfo 8:346c55cb6033 2608 2609
salvatoregulfo 8:346c55cb6033 2609 2610 void arm_sub_q15(
salvatoregulfo 8:346c55cb6033 2610 2611 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2611 2612 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2612 2613 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2613 2614 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2614 2615
salvatoregulfo 8:346c55cb6033 2615 2616 /**
salvatoregulfo 8:346c55cb6033 2616 2617 * @brief Q31 vector subtraction.
salvatoregulfo 8:346c55cb6033 2617 2618 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2618 2619 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2619 2620 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2620 2621 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2621 2622 * @return none.
salvatoregulfo 8:346c55cb6033 2622 2623 */
salvatoregulfo 8:346c55cb6033 2623 2624
salvatoregulfo 8:346c55cb6033 2624 2625 void arm_sub_q31(
salvatoregulfo 8:346c55cb6033 2625 2626 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2626 2627 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2627 2628 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2628 2629 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2629 2630
salvatoregulfo 8:346c55cb6033 2630 2631 /**
salvatoregulfo 8:346c55cb6033 2631 2632 * @brief Multiplies a floating-point vector by a scalar.
salvatoregulfo 8:346c55cb6033 2632 2633 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2633 2634 * @param[in] scale scale factor to be applied
salvatoregulfo 8:346c55cb6033 2634 2635 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2635 2636 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2636 2637 * @return none.
salvatoregulfo 8:346c55cb6033 2637 2638 */
salvatoregulfo 8:346c55cb6033 2638 2639
salvatoregulfo 8:346c55cb6033 2639 2640 void arm_scale_f32(
salvatoregulfo 8:346c55cb6033 2640 2641 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 2641 2642 float32_t scale,
salvatoregulfo 8:346c55cb6033 2642 2643 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2643 2644 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2644 2645
salvatoregulfo 8:346c55cb6033 2645 2646 /**
salvatoregulfo 8:346c55cb6033 2646 2647 * @brief Multiplies a Q7 vector by a scalar.
salvatoregulfo 8:346c55cb6033 2647 2648 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2648 2649 * @param[in] scaleFract fractional portion of the scale value
salvatoregulfo 8:346c55cb6033 2649 2650 * @param[in] shift number of bits to shift the result by
salvatoregulfo 8:346c55cb6033 2650 2651 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2651 2652 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2652 2653 * @return none.
salvatoregulfo 8:346c55cb6033 2653 2654 */
salvatoregulfo 8:346c55cb6033 2654 2655
salvatoregulfo 8:346c55cb6033 2655 2656 void arm_scale_q7(
salvatoregulfo 8:346c55cb6033 2656 2657 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 2657 2658 q7_t scaleFract,
salvatoregulfo 8:346c55cb6033 2658 2659 int8_t shift,
salvatoregulfo 8:346c55cb6033 2659 2660 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2660 2661 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2661 2662
salvatoregulfo 8:346c55cb6033 2662 2663 /**
salvatoregulfo 8:346c55cb6033 2663 2664 * @brief Multiplies a Q15 vector by a scalar.
salvatoregulfo 8:346c55cb6033 2664 2665 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2665 2666 * @param[in] scaleFract fractional portion of the scale value
salvatoregulfo 8:346c55cb6033 2666 2667 * @param[in] shift number of bits to shift the result by
salvatoregulfo 8:346c55cb6033 2667 2668 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2668 2669 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2669 2670 * @return none.
salvatoregulfo 8:346c55cb6033 2670 2671 */
salvatoregulfo 8:346c55cb6033 2671 2672
salvatoregulfo 8:346c55cb6033 2672 2673 void arm_scale_q15(
salvatoregulfo 8:346c55cb6033 2673 2674 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2674 2675 q15_t scaleFract,
salvatoregulfo 8:346c55cb6033 2675 2676 int8_t shift,
salvatoregulfo 8:346c55cb6033 2676 2677 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2677 2678 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2678 2679
salvatoregulfo 8:346c55cb6033 2679 2680 /**
salvatoregulfo 8:346c55cb6033 2680 2681 * @brief Multiplies a Q31 vector by a scalar.
salvatoregulfo 8:346c55cb6033 2681 2682 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2682 2683 * @param[in] scaleFract fractional portion of the scale value
salvatoregulfo 8:346c55cb6033 2683 2684 * @param[in] shift number of bits to shift the result by
salvatoregulfo 8:346c55cb6033 2684 2685 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2685 2686 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2686 2687 * @return none.
salvatoregulfo 8:346c55cb6033 2687 2688 */
salvatoregulfo 8:346c55cb6033 2688 2689
salvatoregulfo 8:346c55cb6033 2689 2690 void arm_scale_q31(
salvatoregulfo 8:346c55cb6033 2690 2691 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 2691 2692 q31_t scaleFract,
salvatoregulfo 8:346c55cb6033 2692 2693 int8_t shift,
salvatoregulfo 8:346c55cb6033 2693 2694 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2694 2695 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2695 2696
salvatoregulfo 8:346c55cb6033 2696 2697 /**
salvatoregulfo 8:346c55cb6033 2697 2698 * @brief Q7 vector absolute value.
salvatoregulfo 8:346c55cb6033 2698 2699 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 2699 2700 * @param[out] *pDst points to the output buffer
salvatoregulfo 8:346c55cb6033 2700 2701 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2701 2702 * @return none.
salvatoregulfo 8:346c55cb6033 2702 2703 */
salvatoregulfo 8:346c55cb6033 2703 2704
salvatoregulfo 8:346c55cb6033 2704 2705 void arm_abs_q7(
salvatoregulfo 8:346c55cb6033 2705 2706 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 2706 2707 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2707 2708 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2708 2709
salvatoregulfo 8:346c55cb6033 2709 2710 /**
salvatoregulfo 8:346c55cb6033 2710 2711 * @brief Floating-point vector absolute value.
salvatoregulfo 8:346c55cb6033 2711 2712 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 2712 2713 * @param[out] *pDst points to the output buffer
salvatoregulfo 8:346c55cb6033 2713 2714 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2714 2715 * @return none.
salvatoregulfo 8:346c55cb6033 2715 2716 */
salvatoregulfo 8:346c55cb6033 2716 2717
salvatoregulfo 8:346c55cb6033 2717 2718 void arm_abs_f32(
salvatoregulfo 8:346c55cb6033 2718 2719 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 2719 2720 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2720 2721 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2721 2722
salvatoregulfo 8:346c55cb6033 2722 2723 /**
salvatoregulfo 8:346c55cb6033 2723 2724 * @brief Q15 vector absolute value.
salvatoregulfo 8:346c55cb6033 2724 2725 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 2725 2726 * @param[out] *pDst points to the output buffer
salvatoregulfo 8:346c55cb6033 2726 2727 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2727 2728 * @return none.
salvatoregulfo 8:346c55cb6033 2728 2729 */
salvatoregulfo 8:346c55cb6033 2729 2730
salvatoregulfo 8:346c55cb6033 2730 2731 void arm_abs_q15(
salvatoregulfo 8:346c55cb6033 2731 2732 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2732 2733 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2733 2734 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2734 2735
salvatoregulfo 8:346c55cb6033 2735 2736 /**
salvatoregulfo 8:346c55cb6033 2736 2737 * @brief Q31 vector absolute value.
salvatoregulfo 8:346c55cb6033 2737 2738 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 2738 2739 * @param[out] *pDst points to the output buffer
salvatoregulfo 8:346c55cb6033 2739 2740 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2740 2741 * @return none.
salvatoregulfo 8:346c55cb6033 2741 2742 */
salvatoregulfo 8:346c55cb6033 2742 2743
salvatoregulfo 8:346c55cb6033 2743 2744 void arm_abs_q31(
salvatoregulfo 8:346c55cb6033 2744 2745 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 2745 2746 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2746 2747 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2747 2748
salvatoregulfo 8:346c55cb6033 2748 2749 /**
salvatoregulfo 8:346c55cb6033 2749 2750 * @brief Dot product of floating-point vectors.
salvatoregulfo 8:346c55cb6033 2750 2751 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2751 2752 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2752 2753 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2753 2754 * @param[out] *result output result returned here
salvatoregulfo 8:346c55cb6033 2754 2755 * @return none.
salvatoregulfo 8:346c55cb6033 2755 2756 */
salvatoregulfo 8:346c55cb6033 2756 2757
salvatoregulfo 8:346c55cb6033 2757 2758 void arm_dot_prod_f32(
salvatoregulfo 8:346c55cb6033 2758 2759 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2759 2760 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2760 2761 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 2761 2762 float32_t * result);
salvatoregulfo 8:346c55cb6033 2762 2763
salvatoregulfo 8:346c55cb6033 2763 2764 /**
salvatoregulfo 8:346c55cb6033 2764 2765 * @brief Dot product of Q7 vectors.
salvatoregulfo 8:346c55cb6033 2765 2766 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2766 2767 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2767 2768 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2768 2769 * @param[out] *result output result returned here
salvatoregulfo 8:346c55cb6033 2769 2770 * @return none.
salvatoregulfo 8:346c55cb6033 2770 2771 */
salvatoregulfo 8:346c55cb6033 2771 2772
salvatoregulfo 8:346c55cb6033 2772 2773 void arm_dot_prod_q7(
salvatoregulfo 8:346c55cb6033 2773 2774 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2774 2775 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2775 2776 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 2776 2777 q31_t * result);
salvatoregulfo 8:346c55cb6033 2777 2778
salvatoregulfo 8:346c55cb6033 2778 2779 /**
salvatoregulfo 8:346c55cb6033 2779 2780 * @brief Dot product of Q15 vectors.
salvatoregulfo 8:346c55cb6033 2780 2781 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2781 2782 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2782 2783 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2783 2784 * @param[out] *result output result returned here
salvatoregulfo 8:346c55cb6033 2784 2785 * @return none.
salvatoregulfo 8:346c55cb6033 2785 2786 */
salvatoregulfo 8:346c55cb6033 2786 2787
salvatoregulfo 8:346c55cb6033 2787 2788 void arm_dot_prod_q15(
salvatoregulfo 8:346c55cb6033 2788 2789 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2789 2790 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2790 2791 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 2791 2792 q63_t * result);
salvatoregulfo 8:346c55cb6033 2792 2793
salvatoregulfo 8:346c55cb6033 2793 2794 /**
salvatoregulfo 8:346c55cb6033 2794 2795 * @brief Dot product of Q31 vectors.
salvatoregulfo 8:346c55cb6033 2795 2796 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 2796 2797 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 2797 2798 * @param[in] blockSize number of samples in each vector
salvatoregulfo 8:346c55cb6033 2798 2799 * @param[out] *result output result returned here
salvatoregulfo 8:346c55cb6033 2799 2800 * @return none.
salvatoregulfo 8:346c55cb6033 2800 2801 */
salvatoregulfo 8:346c55cb6033 2801 2802
salvatoregulfo 8:346c55cb6033 2802 2803 void arm_dot_prod_q31(
salvatoregulfo 8:346c55cb6033 2803 2804 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 2804 2805 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 2805 2806 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 2806 2807 q63_t * result);
salvatoregulfo 8:346c55cb6033 2807 2808
salvatoregulfo 8:346c55cb6033 2808 2809 /**
salvatoregulfo 8:346c55cb6033 2809 2810 * @brief Shifts the elements of a Q7 vector a specified number of bits.
salvatoregulfo 8:346c55cb6033 2810 2811 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2811 2812 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
salvatoregulfo 8:346c55cb6033 2812 2813 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2813 2814 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2814 2815 * @return none.
salvatoregulfo 8:346c55cb6033 2815 2816 */
salvatoregulfo 8:346c55cb6033 2816 2817
salvatoregulfo 8:346c55cb6033 2817 2818 void arm_shift_q7(
salvatoregulfo 8:346c55cb6033 2818 2819 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 2819 2820 int8_t shiftBits,
salvatoregulfo 8:346c55cb6033 2820 2821 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2821 2822 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2822 2823
salvatoregulfo 8:346c55cb6033 2823 2824 /**
salvatoregulfo 8:346c55cb6033 2824 2825 * @brief Shifts the elements of a Q15 vector a specified number of bits.
salvatoregulfo 8:346c55cb6033 2825 2826 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2826 2827 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
salvatoregulfo 8:346c55cb6033 2827 2828 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2828 2829 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2829 2830 * @return none.
salvatoregulfo 8:346c55cb6033 2830 2831 */
salvatoregulfo 8:346c55cb6033 2831 2832
salvatoregulfo 8:346c55cb6033 2832 2833 void arm_shift_q15(
salvatoregulfo 8:346c55cb6033 2833 2834 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2834 2835 int8_t shiftBits,
salvatoregulfo 8:346c55cb6033 2835 2836 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2836 2837 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2837 2838
salvatoregulfo 8:346c55cb6033 2838 2839 /**
salvatoregulfo 8:346c55cb6033 2839 2840 * @brief Shifts the elements of a Q31 vector a specified number of bits.
salvatoregulfo 8:346c55cb6033 2840 2841 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2841 2842 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
salvatoregulfo 8:346c55cb6033 2842 2843 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2843 2844 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2844 2845 * @return none.
salvatoregulfo 8:346c55cb6033 2845 2846 */
salvatoregulfo 8:346c55cb6033 2846 2847
salvatoregulfo 8:346c55cb6033 2847 2848 void arm_shift_q31(
salvatoregulfo 8:346c55cb6033 2848 2849 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 2849 2850 int8_t shiftBits,
salvatoregulfo 8:346c55cb6033 2850 2851 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2851 2852 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2852 2853
salvatoregulfo 8:346c55cb6033 2853 2854 /**
salvatoregulfo 8:346c55cb6033 2854 2855 * @brief Adds a constant offset to a floating-point vector.
salvatoregulfo 8:346c55cb6033 2855 2856 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2856 2857 * @param[in] offset is the offset to be added
salvatoregulfo 8:346c55cb6033 2857 2858 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2858 2859 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2859 2860 * @return none.
salvatoregulfo 8:346c55cb6033 2860 2861 */
salvatoregulfo 8:346c55cb6033 2861 2862
salvatoregulfo 8:346c55cb6033 2862 2863 void arm_offset_f32(
salvatoregulfo 8:346c55cb6033 2863 2864 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 2864 2865 float32_t offset,
salvatoregulfo 8:346c55cb6033 2865 2866 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2866 2867 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2867 2868
salvatoregulfo 8:346c55cb6033 2868 2869 /**
salvatoregulfo 8:346c55cb6033 2869 2870 * @brief Adds a constant offset to a Q7 vector.
salvatoregulfo 8:346c55cb6033 2870 2871 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2871 2872 * @param[in] offset is the offset to be added
salvatoregulfo 8:346c55cb6033 2872 2873 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2873 2874 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2874 2875 * @return none.
salvatoregulfo 8:346c55cb6033 2875 2876 */
salvatoregulfo 8:346c55cb6033 2876 2877
salvatoregulfo 8:346c55cb6033 2877 2878 void arm_offset_q7(
salvatoregulfo 8:346c55cb6033 2878 2879 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 2879 2880 q7_t offset,
salvatoregulfo 8:346c55cb6033 2880 2881 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2881 2882 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2882 2883
salvatoregulfo 8:346c55cb6033 2883 2884 /**
salvatoregulfo 8:346c55cb6033 2884 2885 * @brief Adds a constant offset to a Q15 vector.
salvatoregulfo 8:346c55cb6033 2885 2886 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2886 2887 * @param[in] offset is the offset to be added
salvatoregulfo 8:346c55cb6033 2887 2888 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2888 2889 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2889 2890 * @return none.
salvatoregulfo 8:346c55cb6033 2890 2891 */
salvatoregulfo 8:346c55cb6033 2891 2892
salvatoregulfo 8:346c55cb6033 2892 2893 void arm_offset_q15(
salvatoregulfo 8:346c55cb6033 2893 2894 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2894 2895 q15_t offset,
salvatoregulfo 8:346c55cb6033 2895 2896 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2896 2897 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2897 2898
salvatoregulfo 8:346c55cb6033 2898 2899 /**
salvatoregulfo 8:346c55cb6033 2899 2900 * @brief Adds a constant offset to a Q31 vector.
salvatoregulfo 8:346c55cb6033 2900 2901 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2901 2902 * @param[in] offset is the offset to be added
salvatoregulfo 8:346c55cb6033 2902 2903 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2903 2904 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2904 2905 * @return none.
salvatoregulfo 8:346c55cb6033 2905 2906 */
salvatoregulfo 8:346c55cb6033 2906 2907
salvatoregulfo 8:346c55cb6033 2907 2908 void arm_offset_q31(
salvatoregulfo 8:346c55cb6033 2908 2909 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 2909 2910 q31_t offset,
salvatoregulfo 8:346c55cb6033 2910 2911 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2911 2912 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2912 2913
salvatoregulfo 8:346c55cb6033 2913 2914 /**
salvatoregulfo 8:346c55cb6033 2914 2915 * @brief Negates the elements of a floating-point vector.
salvatoregulfo 8:346c55cb6033 2915 2916 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2916 2917 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2917 2918 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2918 2919 * @return none.
salvatoregulfo 8:346c55cb6033 2919 2920 */
salvatoregulfo 8:346c55cb6033 2920 2921
salvatoregulfo 8:346c55cb6033 2921 2922 void arm_negate_f32(
salvatoregulfo 8:346c55cb6033 2922 2923 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 2923 2924 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2924 2925 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2925 2926
salvatoregulfo 8:346c55cb6033 2926 2927 /**
salvatoregulfo 8:346c55cb6033 2927 2928 * @brief Negates the elements of a Q7 vector.
salvatoregulfo 8:346c55cb6033 2928 2929 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2929 2930 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2930 2931 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2931 2932 * @return none.
salvatoregulfo 8:346c55cb6033 2932 2933 */
salvatoregulfo 8:346c55cb6033 2933 2934
salvatoregulfo 8:346c55cb6033 2934 2935 void arm_negate_q7(
salvatoregulfo 8:346c55cb6033 2935 2936 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 2936 2937 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2937 2938 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2938 2939
salvatoregulfo 8:346c55cb6033 2939 2940 /**
salvatoregulfo 8:346c55cb6033 2940 2941 * @brief Negates the elements of a Q15 vector.
salvatoregulfo 8:346c55cb6033 2941 2942 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2942 2943 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2943 2944 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2944 2945 * @return none.
salvatoregulfo 8:346c55cb6033 2945 2946 */
salvatoregulfo 8:346c55cb6033 2946 2947
salvatoregulfo 8:346c55cb6033 2947 2948 void arm_negate_q15(
salvatoregulfo 8:346c55cb6033 2948 2949 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2949 2950 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2950 2951 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2951 2952
salvatoregulfo 8:346c55cb6033 2952 2953 /**
salvatoregulfo 8:346c55cb6033 2953 2954 * @brief Negates the elements of a Q31 vector.
salvatoregulfo 8:346c55cb6033 2954 2955 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 2955 2956 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 2956 2957 * @param[in] blockSize number of samples in the vector
salvatoregulfo 8:346c55cb6033 2957 2958 * @return none.
salvatoregulfo 8:346c55cb6033 2958 2959 */
salvatoregulfo 8:346c55cb6033 2959 2960
salvatoregulfo 8:346c55cb6033 2960 2961 void arm_negate_q31(
salvatoregulfo 8:346c55cb6033 2961 2962 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 2962 2963 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 2963 2964 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2964 2965 /**
salvatoregulfo 8:346c55cb6033 2965 2966 * @brief Copies the elements of a floating-point vector.
salvatoregulfo 8:346c55cb6033 2966 2967 * @param[in] *pSrc input pointer
salvatoregulfo 8:346c55cb6033 2967 2968 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 2968 2969 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 2969 2970 * @return none.
salvatoregulfo 8:346c55cb6033 2970 2971 */
salvatoregulfo 8:346c55cb6033 2971 2972 void arm_copy_f32(
salvatoregulfo 8:346c55cb6033 2972 2973 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 2973 2974 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 2974 2975 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2975 2976
salvatoregulfo 8:346c55cb6033 2976 2977 /**
salvatoregulfo 8:346c55cb6033 2977 2978 * @brief Copies the elements of a Q7 vector.
salvatoregulfo 8:346c55cb6033 2978 2979 * @param[in] *pSrc input pointer
salvatoregulfo 8:346c55cb6033 2979 2980 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 2980 2981 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 2981 2982 * @return none.
salvatoregulfo 8:346c55cb6033 2982 2983 */
salvatoregulfo 8:346c55cb6033 2983 2984 void arm_copy_q7(
salvatoregulfo 8:346c55cb6033 2984 2985 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 2985 2986 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 2986 2987 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2987 2988
salvatoregulfo 8:346c55cb6033 2988 2989 /**
salvatoregulfo 8:346c55cb6033 2989 2990 * @brief Copies the elements of a Q15 vector.
salvatoregulfo 8:346c55cb6033 2990 2991 * @param[in] *pSrc input pointer
salvatoregulfo 8:346c55cb6033 2991 2992 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 2992 2993 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 2993 2994 * @return none.
salvatoregulfo 8:346c55cb6033 2994 2995 */
salvatoregulfo 8:346c55cb6033 2995 2996 void arm_copy_q15(
salvatoregulfo 8:346c55cb6033 2996 2997 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 2997 2998 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 2998 2999 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 2999 3000
salvatoregulfo 8:346c55cb6033 3000 3001 /**
salvatoregulfo 8:346c55cb6033 3001 3002 * @brief Copies the elements of a Q31 vector.
salvatoregulfo 8:346c55cb6033 3002 3003 * @param[in] *pSrc input pointer
salvatoregulfo 8:346c55cb6033 3003 3004 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 3004 3005 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 3005 3006 * @return none.
salvatoregulfo 8:346c55cb6033 3006 3007 */
salvatoregulfo 8:346c55cb6033 3007 3008 void arm_copy_q31(
salvatoregulfo 8:346c55cb6033 3008 3009 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 3009 3010 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3010 3011 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3011 3012 /**
salvatoregulfo 8:346c55cb6033 3012 3013 * @brief Fills a constant value into a floating-point vector.
salvatoregulfo 8:346c55cb6033 3013 3014 * @param[in] value input value to be filled
salvatoregulfo 8:346c55cb6033 3014 3015 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 3015 3016 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 3016 3017 * @return none.
salvatoregulfo 8:346c55cb6033 3017 3018 */
salvatoregulfo 8:346c55cb6033 3018 3019 void arm_fill_f32(
salvatoregulfo 8:346c55cb6033 3019 3020 float32_t value,
salvatoregulfo 8:346c55cb6033 3020 3021 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 3021 3022 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3022 3023
salvatoregulfo 8:346c55cb6033 3023 3024 /**
salvatoregulfo 8:346c55cb6033 3024 3025 * @brief Fills a constant value into a Q7 vector.
salvatoregulfo 8:346c55cb6033 3025 3026 * @param[in] value input value to be filled
salvatoregulfo 8:346c55cb6033 3026 3027 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 3027 3028 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 3028 3029 * @return none.
salvatoregulfo 8:346c55cb6033 3029 3030 */
salvatoregulfo 8:346c55cb6033 3030 3031 void arm_fill_q7(
salvatoregulfo 8:346c55cb6033 3031 3032 q7_t value,
salvatoregulfo 8:346c55cb6033 3032 3033 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 3033 3034 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3034 3035
salvatoregulfo 8:346c55cb6033 3035 3036 /**
salvatoregulfo 8:346c55cb6033 3036 3037 * @brief Fills a constant value into a Q15 vector.
salvatoregulfo 8:346c55cb6033 3037 3038 * @param[in] value input value to be filled
salvatoregulfo 8:346c55cb6033 3038 3039 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 3039 3040 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 3040 3041 * @return none.
salvatoregulfo 8:346c55cb6033 3041 3042 */
salvatoregulfo 8:346c55cb6033 3042 3043 void arm_fill_q15(
salvatoregulfo 8:346c55cb6033 3043 3044 q15_t value,
salvatoregulfo 8:346c55cb6033 3044 3045 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3045 3046 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3046 3047
salvatoregulfo 8:346c55cb6033 3047 3048 /**
salvatoregulfo 8:346c55cb6033 3048 3049 * @brief Fills a constant value into a Q31 vector.
salvatoregulfo 8:346c55cb6033 3049 3050 * @param[in] value input value to be filled
salvatoregulfo 8:346c55cb6033 3050 3051 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 3051 3052 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 3052 3053 * @return none.
salvatoregulfo 8:346c55cb6033 3053 3054 */
salvatoregulfo 8:346c55cb6033 3054 3055 void arm_fill_q31(
salvatoregulfo 8:346c55cb6033 3055 3056 q31_t value,
salvatoregulfo 8:346c55cb6033 3056 3057 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3057 3058 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3058 3059
salvatoregulfo 8:346c55cb6033 3059 3060 /**
salvatoregulfo 8:346c55cb6033 3060 3061 * @brief Convolution of floating-point sequences.
salvatoregulfo 8:346c55cb6033 3061 3062 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3062 3063 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3063 3064 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3064 3065 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3065 3066 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3066 3067 * @return none.
salvatoregulfo 8:346c55cb6033 3067 3068 */
salvatoregulfo 8:346c55cb6033 3068 3069
salvatoregulfo 8:346c55cb6033 3069 3070 void arm_conv_f32(
salvatoregulfo 8:346c55cb6033 3070 3071 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3071 3072 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3072 3073 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3073 3074 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3074 3075 float32_t * pDst);
salvatoregulfo 8:346c55cb6033 3075 3076
salvatoregulfo 8:346c55cb6033 3076 3077
salvatoregulfo 8:346c55cb6033 3077 3078 /**
salvatoregulfo 8:346c55cb6033 3078 3079 * @brief Convolution of Q15 sequences.
salvatoregulfo 8:346c55cb6033 3079 3080 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3080 3081 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3081 3082 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3082 3083 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3083 3084 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3084 3085 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 3085 3086 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 3086 3087 * @return none.
salvatoregulfo 8:346c55cb6033 3087 3088 */
salvatoregulfo 8:346c55cb6033 3088 3089
salvatoregulfo 8:346c55cb6033 3089 3090
salvatoregulfo 8:346c55cb6033 3090 3091 void arm_conv_opt_q15(
salvatoregulfo 8:346c55cb6033 3091 3092 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3092 3093 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3093 3094 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3094 3095 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3095 3096 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3096 3097 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 3097 3098 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 3098 3099
salvatoregulfo 8:346c55cb6033 3099 3100
salvatoregulfo 8:346c55cb6033 3100 3101 /**
salvatoregulfo 8:346c55cb6033 3101 3102 * @brief Convolution of Q15 sequences.
salvatoregulfo 8:346c55cb6033 3102 3103 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3103 3104 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3104 3105 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3105 3106 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3106 3107 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3107 3108 * @return none.
salvatoregulfo 8:346c55cb6033 3108 3109 */
salvatoregulfo 8:346c55cb6033 3109 3110
salvatoregulfo 8:346c55cb6033 3110 3111 void arm_conv_q15(
salvatoregulfo 8:346c55cb6033 3111 3112 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3112 3113 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3113 3114 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3114 3115 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3115 3116 q15_t * pDst);
salvatoregulfo 8:346c55cb6033 3116 3117
salvatoregulfo 8:346c55cb6033 3117 3118 /**
salvatoregulfo 8:346c55cb6033 3118 3119 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 3119 3120 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3120 3121 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3121 3122 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3122 3123 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3123 3124 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3124 3125 * @return none.
salvatoregulfo 8:346c55cb6033 3125 3126 */
salvatoregulfo 8:346c55cb6033 3126 3127
salvatoregulfo 8:346c55cb6033 3127 3128 void arm_conv_fast_q15(
salvatoregulfo 8:346c55cb6033 3128 3129 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3129 3130 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3130 3131 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3131 3132 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3132 3133 q15_t * pDst);
salvatoregulfo 8:346c55cb6033 3133 3134
salvatoregulfo 8:346c55cb6033 3134 3135 /**
salvatoregulfo 8:346c55cb6033 3135 3136 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 3136 3137 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3137 3138 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3138 3139 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3139 3140 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3140 3141 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3141 3142 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 3142 3143 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 3143 3144 * @return none.
salvatoregulfo 8:346c55cb6033 3144 3145 */
salvatoregulfo 8:346c55cb6033 3145 3146
salvatoregulfo 8:346c55cb6033 3146 3147 void arm_conv_fast_opt_q15(
salvatoregulfo 8:346c55cb6033 3147 3148 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3148 3149 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3149 3150 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3150 3151 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3151 3152 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3152 3153 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 3153 3154 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 3154 3155
salvatoregulfo 8:346c55cb6033 3155 3156
salvatoregulfo 8:346c55cb6033 3156 3157
salvatoregulfo 8:346c55cb6033 3157 3158 /**
salvatoregulfo 8:346c55cb6033 3158 3159 * @brief Convolution of Q31 sequences.
salvatoregulfo 8:346c55cb6033 3159 3160 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3160 3161 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3161 3162 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3162 3163 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3163 3164 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3164 3165 * @return none.
salvatoregulfo 8:346c55cb6033 3165 3166 */
salvatoregulfo 8:346c55cb6033 3166 3167
salvatoregulfo 8:346c55cb6033 3167 3168 void arm_conv_q31(
salvatoregulfo 8:346c55cb6033 3168 3169 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3169 3170 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3170 3171 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3171 3172 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3172 3173 q31_t * pDst);
salvatoregulfo 8:346c55cb6033 3173 3174
salvatoregulfo 8:346c55cb6033 3174 3175 /**
salvatoregulfo 8:346c55cb6033 3175 3176 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 3176 3177 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3177 3178 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3178 3179 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3179 3180 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3180 3181 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3181 3182 * @return none.
salvatoregulfo 8:346c55cb6033 3182 3183 */
salvatoregulfo 8:346c55cb6033 3183 3184
salvatoregulfo 8:346c55cb6033 3184 3185 void arm_conv_fast_q31(
salvatoregulfo 8:346c55cb6033 3185 3186 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3186 3187 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3187 3188 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3188 3189 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3189 3190 q31_t * pDst);
salvatoregulfo 8:346c55cb6033 3190 3191
salvatoregulfo 8:346c55cb6033 3191 3192
salvatoregulfo 8:346c55cb6033 3192 3193 /**
salvatoregulfo 8:346c55cb6033 3193 3194 * @brief Convolution of Q7 sequences.
salvatoregulfo 8:346c55cb6033 3194 3195 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3195 3196 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3196 3197 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3197 3198 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3198 3199 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3199 3200 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 3200 3201 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 3201 3202 * @return none.
salvatoregulfo 8:346c55cb6033 3202 3203 */
salvatoregulfo 8:346c55cb6033 3203 3204
salvatoregulfo 8:346c55cb6033 3204 3205 void arm_conv_opt_q7(
salvatoregulfo 8:346c55cb6033 3205 3206 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3206 3207 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3207 3208 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3208 3209 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3209 3210 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 3210 3211 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 3211 3212 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 3212 3213
salvatoregulfo 8:346c55cb6033 3213 3214
salvatoregulfo 8:346c55cb6033 3214 3215
salvatoregulfo 8:346c55cb6033 3215 3216 /**
salvatoregulfo 8:346c55cb6033 3216 3217 * @brief Convolution of Q7 sequences.
salvatoregulfo 8:346c55cb6033 3217 3218 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3218 3219 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3219 3220 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3220 3221 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3221 3222 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
salvatoregulfo 8:346c55cb6033 3222 3223 * @return none.
salvatoregulfo 8:346c55cb6033 3223 3224 */
salvatoregulfo 8:346c55cb6033 3224 3225
salvatoregulfo 8:346c55cb6033 3225 3226 void arm_conv_q7(
salvatoregulfo 8:346c55cb6033 3226 3227 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3227 3228 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3228 3229 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3229 3230 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3230 3231 q7_t * pDst);
salvatoregulfo 8:346c55cb6033 3231 3232
salvatoregulfo 8:346c55cb6033 3232 3233
salvatoregulfo 8:346c55cb6033 3233 3234 /**
salvatoregulfo 8:346c55cb6033 3234 3235 * @brief Partial convolution of floating-point sequences.
salvatoregulfo 8:346c55cb6033 3235 3236 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3236 3237 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3237 3238 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3238 3239 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3239 3240 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3240 3241 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3241 3242 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3242 3243 * @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].
salvatoregulfo 8:346c55cb6033 3243 3244 */
salvatoregulfo 8:346c55cb6033 3244 3245
salvatoregulfo 8:346c55cb6033 3245 3246 arm_status arm_conv_partial_f32(
salvatoregulfo 8:346c55cb6033 3246 3247 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3247 3248 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3248 3249 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3249 3250 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3250 3251 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 3251 3252 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3252 3253 uint32_t numPoints);
salvatoregulfo 8:346c55cb6033 3253 3254
salvatoregulfo 8:346c55cb6033 3254 3255 /**
salvatoregulfo 8:346c55cb6033 3255 3256 * @brief Partial convolution of Q15 sequences.
salvatoregulfo 8:346c55cb6033 3256 3257 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3257 3258 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3258 3259 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3259 3260 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3260 3261 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3261 3262 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3262 3263 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3263 3264 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 3264 3265 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 3265 3266 * @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].
salvatoregulfo 8:346c55cb6033 3266 3267 */
salvatoregulfo 8:346c55cb6033 3267 3268
salvatoregulfo 8:346c55cb6033 3268 3269 arm_status arm_conv_partial_opt_q15(
salvatoregulfo 8:346c55cb6033 3269 3270 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3270 3271 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3271 3272 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3272 3273 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3273 3274 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3274 3275 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3275 3276 uint32_t numPoints,
salvatoregulfo 8:346c55cb6033 3276 3277 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 3277 3278 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 3278 3279
salvatoregulfo 8:346c55cb6033 3279 3280
salvatoregulfo 8:346c55cb6033 3280 3281 /**
salvatoregulfo 8:346c55cb6033 3281 3282 * @brief Partial convolution of Q15 sequences.
salvatoregulfo 8:346c55cb6033 3282 3283 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3283 3284 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3284 3285 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3285 3286 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3286 3287 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3287 3288 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3288 3289 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3289 3290 * @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].
salvatoregulfo 8:346c55cb6033 3290 3291 */
salvatoregulfo 8:346c55cb6033 3291 3292
salvatoregulfo 8:346c55cb6033 3292 3293 arm_status arm_conv_partial_q15(
salvatoregulfo 8:346c55cb6033 3293 3294 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3294 3295 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3295 3296 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3296 3297 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3297 3298 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3298 3299 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3299 3300 uint32_t numPoints);
salvatoregulfo 8:346c55cb6033 3300 3301
salvatoregulfo 8:346c55cb6033 3301 3302 /**
salvatoregulfo 8:346c55cb6033 3302 3303 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 3303 3304 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3304 3305 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3305 3306 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3306 3307 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3307 3308 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3308 3309 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3309 3310 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3310 3311 * @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].
salvatoregulfo 8:346c55cb6033 3311 3312 */
salvatoregulfo 8:346c55cb6033 3312 3313
salvatoregulfo 8:346c55cb6033 3313 3314 arm_status arm_conv_partial_fast_q15(
salvatoregulfo 8:346c55cb6033 3314 3315 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3315 3316 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3316 3317 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3317 3318 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3318 3319 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3319 3320 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3320 3321 uint32_t numPoints);
salvatoregulfo 8:346c55cb6033 3321 3322
salvatoregulfo 8:346c55cb6033 3322 3323
salvatoregulfo 8:346c55cb6033 3323 3324 /**
salvatoregulfo 8:346c55cb6033 3324 3325 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 3325 3326 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3326 3327 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3327 3328 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3328 3329 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3329 3330 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3330 3331 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3331 3332 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3332 3333 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 3333 3334 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 3334 3335 * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
salvatoregulfo 8:346c55cb6033 3335 3336 */
salvatoregulfo 8:346c55cb6033 3336 3337
salvatoregulfo 8:346c55cb6033 3337 3338 arm_status arm_conv_partial_fast_opt_q15(
salvatoregulfo 8:346c55cb6033 3338 3339 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3339 3340 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3340 3341 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3341 3342 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3342 3343 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3343 3344 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3344 3345 uint32_t numPoints,
salvatoregulfo 8:346c55cb6033 3345 3346 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 3346 3347 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 3347 3348
salvatoregulfo 8:346c55cb6033 3348 3349
salvatoregulfo 8:346c55cb6033 3349 3350 /**
salvatoregulfo 8:346c55cb6033 3350 3351 * @brief Partial convolution of Q31 sequences.
salvatoregulfo 8:346c55cb6033 3351 3352 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3352 3353 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3353 3354 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3354 3355 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3355 3356 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3356 3357 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3357 3358 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3358 3359 * @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].
salvatoregulfo 8:346c55cb6033 3359 3360 */
salvatoregulfo 8:346c55cb6033 3360 3361
salvatoregulfo 8:346c55cb6033 3361 3362 arm_status arm_conv_partial_q31(
salvatoregulfo 8:346c55cb6033 3362 3363 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3363 3364 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3364 3365 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3365 3366 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3366 3367 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3367 3368 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3368 3369 uint32_t numPoints);
salvatoregulfo 8:346c55cb6033 3369 3370
salvatoregulfo 8:346c55cb6033 3370 3371
salvatoregulfo 8:346c55cb6033 3371 3372 /**
salvatoregulfo 8:346c55cb6033 3372 3373 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 3373 3374 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3374 3375 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3375 3376 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3376 3377 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3377 3378 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3378 3379 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3379 3380 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3380 3381 * @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].
salvatoregulfo 8:346c55cb6033 3381 3382 */
salvatoregulfo 8:346c55cb6033 3382 3383
salvatoregulfo 8:346c55cb6033 3383 3384 arm_status arm_conv_partial_fast_q31(
salvatoregulfo 8:346c55cb6033 3384 3385 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3385 3386 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3386 3387 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3387 3388 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3388 3389 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3389 3390 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3390 3391 uint32_t numPoints);
salvatoregulfo 8:346c55cb6033 3391 3392
salvatoregulfo 8:346c55cb6033 3392 3393
salvatoregulfo 8:346c55cb6033 3393 3394 /**
salvatoregulfo 8:346c55cb6033 3394 3395 * @brief Partial convolution of Q7 sequences
salvatoregulfo 8:346c55cb6033 3395 3396 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3396 3397 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3397 3398 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3398 3399 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3399 3400 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3400 3401 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3401 3402 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3402 3403 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 3403 3404 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 3404 3405 * @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].
salvatoregulfo 8:346c55cb6033 3405 3406 */
salvatoregulfo 8:346c55cb6033 3406 3407
salvatoregulfo 8:346c55cb6033 3407 3408 arm_status arm_conv_partial_opt_q7(
salvatoregulfo 8:346c55cb6033 3408 3409 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3409 3410 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3410 3411 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3411 3412 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3412 3413 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 3413 3414 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3414 3415 uint32_t numPoints,
salvatoregulfo 8:346c55cb6033 3415 3416 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 3416 3417 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 3417 3418
salvatoregulfo 8:346c55cb6033 3418 3419
salvatoregulfo 8:346c55cb6033 3419 3420 /**
salvatoregulfo 8:346c55cb6033 3420 3421 * @brief Partial convolution of Q7 sequences.
salvatoregulfo 8:346c55cb6033 3421 3422 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 3422 3423 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 3423 3424 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 3424 3425 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 3425 3426 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3426 3427 * @param[in] firstIndex is the first output sample to start with.
salvatoregulfo 8:346c55cb6033 3427 3428 * @param[in] numPoints is the number of output points to be computed.
salvatoregulfo 8:346c55cb6033 3428 3429 * @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].
salvatoregulfo 8:346c55cb6033 3429 3430 */
salvatoregulfo 8:346c55cb6033 3430 3431
salvatoregulfo 8:346c55cb6033 3431 3432 arm_status arm_conv_partial_q7(
salvatoregulfo 8:346c55cb6033 3432 3433 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 3433 3434 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 3434 3435 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 3435 3436 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 3436 3437 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 3437 3438 uint32_t firstIndex,
salvatoregulfo 8:346c55cb6033 3438 3439 uint32_t numPoints);
salvatoregulfo 8:346c55cb6033 3439 3440
salvatoregulfo 8:346c55cb6033 3440 3441
salvatoregulfo 8:346c55cb6033 3441 3442
salvatoregulfo 8:346c55cb6033 3442 3443 /**
salvatoregulfo 8:346c55cb6033 3443 3444 * @brief Instance structure for the Q15 FIR decimator.
salvatoregulfo 8:346c55cb6033 3444 3445 */
salvatoregulfo 8:346c55cb6033 3445 3446
salvatoregulfo 8:346c55cb6033 3446 3447 typedef struct
salvatoregulfo 8:346c55cb6033 3447 3448 {
salvatoregulfo 8:346c55cb6033 3448 3449 uint8_t M; /**< decimation factor. */
salvatoregulfo 8:346c55cb6033 3449 3450 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 3450 3451 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 3451 3452 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 3452 3453 } arm_fir_decimate_instance_q15;
salvatoregulfo 8:346c55cb6033 3453 3454
salvatoregulfo 8:346c55cb6033 3454 3455 /**
salvatoregulfo 8:346c55cb6033 3455 3456 * @brief Instance structure for the Q31 FIR decimator.
salvatoregulfo 8:346c55cb6033 3456 3457 */
salvatoregulfo 8:346c55cb6033 3457 3458
salvatoregulfo 8:346c55cb6033 3458 3459 typedef struct
salvatoregulfo 8:346c55cb6033 3459 3460 {
salvatoregulfo 8:346c55cb6033 3460 3461 uint8_t M; /**< decimation factor. */
salvatoregulfo 8:346c55cb6033 3461 3462 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 3462 3463 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 3463 3464 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 3464 3465
salvatoregulfo 8:346c55cb6033 3465 3466 } arm_fir_decimate_instance_q31;
salvatoregulfo 8:346c55cb6033 3466 3467
salvatoregulfo 8:346c55cb6033 3467 3468 /**
salvatoregulfo 8:346c55cb6033 3468 3469 * @brief Instance structure for the floating-point FIR decimator.
salvatoregulfo 8:346c55cb6033 3469 3470 */
salvatoregulfo 8:346c55cb6033 3470 3471
salvatoregulfo 8:346c55cb6033 3471 3472 typedef struct
salvatoregulfo 8:346c55cb6033 3472 3473 {
salvatoregulfo 8:346c55cb6033 3473 3474 uint8_t M; /**< decimation factor. */
salvatoregulfo 8:346c55cb6033 3474 3475 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 3475 3476 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 3476 3477 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 3477 3478
salvatoregulfo 8:346c55cb6033 3478 3479 } arm_fir_decimate_instance_f32;
salvatoregulfo 8:346c55cb6033 3479 3480
salvatoregulfo 8:346c55cb6033 3480 3481
salvatoregulfo 8:346c55cb6033 3481 3482
salvatoregulfo 8:346c55cb6033 3482 3483 /**
salvatoregulfo 8:346c55cb6033 3483 3484 * @brief Processing function for the floating-point FIR decimator.
salvatoregulfo 8:346c55cb6033 3484 3485 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3485 3486 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3486 3487 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3487 3488 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3488 3489 * @return none
salvatoregulfo 8:346c55cb6033 3489 3490 */
salvatoregulfo 8:346c55cb6033 3490 3491
salvatoregulfo 8:346c55cb6033 3491 3492 void arm_fir_decimate_f32(
salvatoregulfo 8:346c55cb6033 3492 3493 const arm_fir_decimate_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3493 3494 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 3494 3495 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 3495 3496 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3496 3497
salvatoregulfo 8:346c55cb6033 3497 3498
salvatoregulfo 8:346c55cb6033 3498 3499 /**
salvatoregulfo 8:346c55cb6033 3499 3500 * @brief Initialization function for the floating-point FIR decimator.
salvatoregulfo 8:346c55cb6033 3500 3501 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3501 3502 * @param[in] numTaps number of coefficients in the filter.
salvatoregulfo 8:346c55cb6033 3502 3503 * @param[in] M decimation factor.
salvatoregulfo 8:346c55cb6033 3503 3504 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3504 3505 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3505 3506 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3506 3507 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
salvatoregulfo 8:346c55cb6033 3507 3508 * <code>blockSize</code> is not a multiple of <code>M</code>.
salvatoregulfo 8:346c55cb6033 3508 3509 */
salvatoregulfo 8:346c55cb6033 3509 3510
salvatoregulfo 8:346c55cb6033 3510 3511 arm_status arm_fir_decimate_init_f32(
salvatoregulfo 8:346c55cb6033 3511 3512 arm_fir_decimate_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3512 3513 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 3513 3514 uint8_t M,
salvatoregulfo 8:346c55cb6033 3514 3515 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3515 3516 float32_t * pState,
salvatoregulfo 8:346c55cb6033 3516 3517 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3517 3518
salvatoregulfo 8:346c55cb6033 3518 3519 /**
salvatoregulfo 8:346c55cb6033 3519 3520 * @brief Processing function for the Q15 FIR decimator.
salvatoregulfo 8:346c55cb6033 3520 3521 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3521 3522 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3522 3523 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3523 3524 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3524 3525 * @return none
salvatoregulfo 8:346c55cb6033 3525 3526 */
salvatoregulfo 8:346c55cb6033 3526 3527
salvatoregulfo 8:346c55cb6033 3527 3528 void arm_fir_decimate_q15(
salvatoregulfo 8:346c55cb6033 3528 3529 const arm_fir_decimate_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 3529 3530 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 3530 3531 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3531 3532 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3532 3533
salvatoregulfo 8:346c55cb6033 3533 3534 /**
salvatoregulfo 8:346c55cb6033 3534 3535 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 3535 3536 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3536 3537 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3537 3538 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3538 3539 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3539 3540 * @return none
salvatoregulfo 8:346c55cb6033 3540 3541 */
salvatoregulfo 8:346c55cb6033 3541 3542
salvatoregulfo 8:346c55cb6033 3542 3543 void arm_fir_decimate_fast_q15(
salvatoregulfo 8:346c55cb6033 3543 3544 const arm_fir_decimate_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 3544 3545 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 3545 3546 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3546 3547 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3547 3548
salvatoregulfo 8:346c55cb6033 3548 3549
salvatoregulfo 8:346c55cb6033 3549 3550
salvatoregulfo 8:346c55cb6033 3550 3551 /**
salvatoregulfo 8:346c55cb6033 3551 3552 * @brief Initialization function for the Q15 FIR decimator.
salvatoregulfo 8:346c55cb6033 3552 3553 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3553 3554 * @param[in] numTaps number of coefficients in the filter.
salvatoregulfo 8:346c55cb6033 3554 3555 * @param[in] M decimation factor.
salvatoregulfo 8:346c55cb6033 3555 3556 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3556 3557 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3557 3558 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3558 3559 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
salvatoregulfo 8:346c55cb6033 3559 3560 * <code>blockSize</code> is not a multiple of <code>M</code>.
salvatoregulfo 8:346c55cb6033 3560 3561 */
salvatoregulfo 8:346c55cb6033 3561 3562
salvatoregulfo 8:346c55cb6033 3562 3563 arm_status arm_fir_decimate_init_q15(
salvatoregulfo 8:346c55cb6033 3563 3564 arm_fir_decimate_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 3564 3565 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 3565 3566 uint8_t M,
salvatoregulfo 8:346c55cb6033 3566 3567 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3567 3568 q15_t * pState,
salvatoregulfo 8:346c55cb6033 3568 3569 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3569 3570
salvatoregulfo 8:346c55cb6033 3570 3571 /**
salvatoregulfo 8:346c55cb6033 3571 3572 * @brief Processing function for the Q31 FIR decimator.
salvatoregulfo 8:346c55cb6033 3572 3573 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3573 3574 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3574 3575 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3575 3576 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3576 3577 * @return none
salvatoregulfo 8:346c55cb6033 3577 3578 */
salvatoregulfo 8:346c55cb6033 3578 3579
salvatoregulfo 8:346c55cb6033 3579 3580 void arm_fir_decimate_q31(
salvatoregulfo 8:346c55cb6033 3580 3581 const arm_fir_decimate_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 3581 3582 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 3582 3583 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3583 3584 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3584 3585
salvatoregulfo 8:346c55cb6033 3585 3586 /**
salvatoregulfo 8:346c55cb6033 3586 3587 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 3587 3588 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3588 3589 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3589 3590 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3590 3591 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3591 3592 * @return none
salvatoregulfo 8:346c55cb6033 3592 3593 */
salvatoregulfo 8:346c55cb6033 3593 3594
salvatoregulfo 8:346c55cb6033 3594 3595 void arm_fir_decimate_fast_q31(
salvatoregulfo 8:346c55cb6033 3595 3596 arm_fir_decimate_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 3596 3597 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 3597 3598 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3598 3599 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3599 3600
salvatoregulfo 8:346c55cb6033 3600 3601
salvatoregulfo 8:346c55cb6033 3601 3602 /**
salvatoregulfo 8:346c55cb6033 3602 3603 * @brief Initialization function for the Q31 FIR decimator.
salvatoregulfo 8:346c55cb6033 3603 3604 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
salvatoregulfo 8:346c55cb6033 3604 3605 * @param[in] numTaps number of coefficients in the filter.
salvatoregulfo 8:346c55cb6033 3605 3606 * @param[in] M decimation factor.
salvatoregulfo 8:346c55cb6033 3606 3607 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3607 3608 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3608 3609 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3609 3610 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
salvatoregulfo 8:346c55cb6033 3610 3611 * <code>blockSize</code> is not a multiple of <code>M</code>.
salvatoregulfo 8:346c55cb6033 3611 3612 */
salvatoregulfo 8:346c55cb6033 3612 3613
salvatoregulfo 8:346c55cb6033 3613 3614 arm_status arm_fir_decimate_init_q31(
salvatoregulfo 8:346c55cb6033 3614 3615 arm_fir_decimate_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 3615 3616 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 3616 3617 uint8_t M,
salvatoregulfo 8:346c55cb6033 3617 3618 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3618 3619 q31_t * pState,
salvatoregulfo 8:346c55cb6033 3619 3620 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3620 3621
salvatoregulfo 8:346c55cb6033 3621 3622
salvatoregulfo 8:346c55cb6033 3622 3623
salvatoregulfo 8:346c55cb6033 3623 3624 /**
salvatoregulfo 8:346c55cb6033 3624 3625 * @brief Instance structure for the Q15 FIR interpolator.
salvatoregulfo 8:346c55cb6033 3625 3626 */
salvatoregulfo 8:346c55cb6033 3626 3627
salvatoregulfo 8:346c55cb6033 3627 3628 typedef struct
salvatoregulfo 8:346c55cb6033 3628 3629 {
salvatoregulfo 8:346c55cb6033 3629 3630 uint8_t L; /**< upsample factor. */
salvatoregulfo 8:346c55cb6033 3630 3631 uint16_t phaseLength; /**< length of each polyphase filter component. */
salvatoregulfo 8:346c55cb6033 3631 3632 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
salvatoregulfo 8:346c55cb6033 3632 3633 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
salvatoregulfo 8:346c55cb6033 3633 3634 } arm_fir_interpolate_instance_q15;
salvatoregulfo 8:346c55cb6033 3634 3635
salvatoregulfo 8:346c55cb6033 3635 3636 /**
salvatoregulfo 8:346c55cb6033 3636 3637 * @brief Instance structure for the Q31 FIR interpolator.
salvatoregulfo 8:346c55cb6033 3637 3638 */
salvatoregulfo 8:346c55cb6033 3638 3639
salvatoregulfo 8:346c55cb6033 3639 3640 typedef struct
salvatoregulfo 8:346c55cb6033 3640 3641 {
salvatoregulfo 8:346c55cb6033 3641 3642 uint8_t L; /**< upsample factor. */
salvatoregulfo 8:346c55cb6033 3642 3643 uint16_t phaseLength; /**< length of each polyphase filter component. */
salvatoregulfo 8:346c55cb6033 3643 3644 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
salvatoregulfo 8:346c55cb6033 3644 3645 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
salvatoregulfo 8:346c55cb6033 3645 3646 } arm_fir_interpolate_instance_q31;
salvatoregulfo 8:346c55cb6033 3646 3647
salvatoregulfo 8:346c55cb6033 3647 3648 /**
salvatoregulfo 8:346c55cb6033 3648 3649 * @brief Instance structure for the floating-point FIR interpolator.
salvatoregulfo 8:346c55cb6033 3649 3650 */
salvatoregulfo 8:346c55cb6033 3650 3651
salvatoregulfo 8:346c55cb6033 3651 3652 typedef struct
salvatoregulfo 8:346c55cb6033 3652 3653 {
salvatoregulfo 8:346c55cb6033 3653 3654 uint8_t L; /**< upsample factor. */
salvatoregulfo 8:346c55cb6033 3654 3655 uint16_t phaseLength; /**< length of each polyphase filter component. */
salvatoregulfo 8:346c55cb6033 3655 3656 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
salvatoregulfo 8:346c55cb6033 3656 3657 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
salvatoregulfo 8:346c55cb6033 3657 3658 } arm_fir_interpolate_instance_f32;
salvatoregulfo 8:346c55cb6033 3658 3659
salvatoregulfo 8:346c55cb6033 3659 3660
salvatoregulfo 8:346c55cb6033 3660 3661 /**
salvatoregulfo 8:346c55cb6033 3661 3662 * @brief Processing function for the Q15 FIR interpolator.
salvatoregulfo 8:346c55cb6033 3662 3663 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
salvatoregulfo 8:346c55cb6033 3663 3664 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3664 3665 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 3665 3666 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3666 3667 * @return none.
salvatoregulfo 8:346c55cb6033 3667 3668 */
salvatoregulfo 8:346c55cb6033 3668 3669
salvatoregulfo 8:346c55cb6033 3669 3670 void arm_fir_interpolate_q15(
salvatoregulfo 8:346c55cb6033 3670 3671 const arm_fir_interpolate_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 3671 3672 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 3672 3673 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 3673 3674 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3674 3675
salvatoregulfo 8:346c55cb6033 3675 3676
salvatoregulfo 8:346c55cb6033 3676 3677 /**
salvatoregulfo 8:346c55cb6033 3677 3678 * @brief Initialization function for the Q15 FIR interpolator.
salvatoregulfo 8:346c55cb6033 3678 3679 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
salvatoregulfo 8:346c55cb6033 3679 3680 * @param[in] L upsample factor.
salvatoregulfo 8:346c55cb6033 3680 3681 * @param[in] numTaps number of filter coefficients in the filter.
salvatoregulfo 8:346c55cb6033 3681 3682 * @param[in] *pCoeffs points to the filter coefficient buffer.
salvatoregulfo 8:346c55cb6033 3682 3683 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3683 3684 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3684 3685 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
salvatoregulfo 8:346c55cb6033 3685 3686 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
salvatoregulfo 8:346c55cb6033 3686 3687 */
salvatoregulfo 8:346c55cb6033 3687 3688
salvatoregulfo 8:346c55cb6033 3688 3689 arm_status arm_fir_interpolate_init_q15(
salvatoregulfo 8:346c55cb6033 3689 3690 arm_fir_interpolate_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 3690 3691 uint8_t L,
salvatoregulfo 8:346c55cb6033 3691 3692 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 3692 3693 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3693 3694 q15_t * pState,
salvatoregulfo 8:346c55cb6033 3694 3695 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3695 3696
salvatoregulfo 8:346c55cb6033 3696 3697 /**
salvatoregulfo 8:346c55cb6033 3697 3698 * @brief Processing function for the Q31 FIR interpolator.
salvatoregulfo 8:346c55cb6033 3698 3699 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
salvatoregulfo 8:346c55cb6033 3699 3700 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3700 3701 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 3701 3702 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3702 3703 * @return none.
salvatoregulfo 8:346c55cb6033 3703 3704 */
salvatoregulfo 8:346c55cb6033 3704 3705
salvatoregulfo 8:346c55cb6033 3705 3706 void arm_fir_interpolate_q31(
salvatoregulfo 8:346c55cb6033 3706 3707 const arm_fir_interpolate_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 3707 3708 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 3708 3709 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3709 3710 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3710 3711
salvatoregulfo 8:346c55cb6033 3711 3712 /**
salvatoregulfo 8:346c55cb6033 3712 3713 * @brief Initialization function for the Q31 FIR interpolator.
salvatoregulfo 8:346c55cb6033 3713 3714 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
salvatoregulfo 8:346c55cb6033 3714 3715 * @param[in] L upsample factor.
salvatoregulfo 8:346c55cb6033 3715 3716 * @param[in] numTaps number of filter coefficients in the filter.
salvatoregulfo 8:346c55cb6033 3716 3717 * @param[in] *pCoeffs points to the filter coefficient buffer.
salvatoregulfo 8:346c55cb6033 3717 3718 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3718 3719 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3719 3720 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
salvatoregulfo 8:346c55cb6033 3720 3721 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
salvatoregulfo 8:346c55cb6033 3721 3722 */
salvatoregulfo 8:346c55cb6033 3722 3723
salvatoregulfo 8:346c55cb6033 3723 3724 arm_status arm_fir_interpolate_init_q31(
salvatoregulfo 8:346c55cb6033 3724 3725 arm_fir_interpolate_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 3725 3726 uint8_t L,
salvatoregulfo 8:346c55cb6033 3726 3727 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 3727 3728 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3728 3729 q31_t * pState,
salvatoregulfo 8:346c55cb6033 3729 3730 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3730 3731
salvatoregulfo 8:346c55cb6033 3731 3732
salvatoregulfo 8:346c55cb6033 3732 3733 /**
salvatoregulfo 8:346c55cb6033 3733 3734 * @brief Processing function for the floating-point FIR interpolator.
salvatoregulfo 8:346c55cb6033 3734 3735 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
salvatoregulfo 8:346c55cb6033 3735 3736 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3736 3737 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 3737 3738 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3738 3739 * @return none.
salvatoregulfo 8:346c55cb6033 3739 3740 */
salvatoregulfo 8:346c55cb6033 3740 3741
salvatoregulfo 8:346c55cb6033 3741 3742 void arm_fir_interpolate_f32(
salvatoregulfo 8:346c55cb6033 3742 3743 const arm_fir_interpolate_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3743 3744 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 3744 3745 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 3745 3746 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3746 3747
salvatoregulfo 8:346c55cb6033 3747 3748 /**
salvatoregulfo 8:346c55cb6033 3748 3749 * @brief Initialization function for the floating-point FIR interpolator.
salvatoregulfo 8:346c55cb6033 3749 3750 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
salvatoregulfo 8:346c55cb6033 3750 3751 * @param[in] L upsample factor.
salvatoregulfo 8:346c55cb6033 3751 3752 * @param[in] numTaps number of filter coefficients in the filter.
salvatoregulfo 8:346c55cb6033 3752 3753 * @param[in] *pCoeffs points to the filter coefficient buffer.
salvatoregulfo 8:346c55cb6033 3753 3754 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3754 3755 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 3755 3756 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
salvatoregulfo 8:346c55cb6033 3756 3757 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
salvatoregulfo 8:346c55cb6033 3757 3758 */
salvatoregulfo 8:346c55cb6033 3758 3759
salvatoregulfo 8:346c55cb6033 3759 3760 arm_status arm_fir_interpolate_init_f32(
salvatoregulfo 8:346c55cb6033 3760 3761 arm_fir_interpolate_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3761 3762 uint8_t L,
salvatoregulfo 8:346c55cb6033 3762 3763 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 3763 3764 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3764 3765 float32_t * pState,
salvatoregulfo 8:346c55cb6033 3765 3766 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3766 3767
salvatoregulfo 8:346c55cb6033 3767 3768 /**
salvatoregulfo 8:346c55cb6033 3768 3769 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3769 3770 */
salvatoregulfo 8:346c55cb6033 3770 3771
salvatoregulfo 8:346c55cb6033 3771 3772 typedef struct
salvatoregulfo 8:346c55cb6033 3772 3773 {
salvatoregulfo 8:346c55cb6033 3773 3774 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 3774 3775 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
salvatoregulfo 8:346c55cb6033 3775 3776 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 3776 3777 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
salvatoregulfo 8:346c55cb6033 3777 3778
salvatoregulfo 8:346c55cb6033 3778 3779 } arm_biquad_cas_df1_32x64_ins_q31;
salvatoregulfo 8:346c55cb6033 3779 3780
salvatoregulfo 8:346c55cb6033 3780 3781
salvatoregulfo 8:346c55cb6033 3781 3782 /**
salvatoregulfo 8:346c55cb6033 3782 3783 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
salvatoregulfo 8:346c55cb6033 3783 3784 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3784 3785 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3785 3786 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 3786 3787 * @return none.
salvatoregulfo 8:346c55cb6033 3787 3788 */
salvatoregulfo 8:346c55cb6033 3788 3789
salvatoregulfo 8:346c55cb6033 3789 3790 void arm_biquad_cas_df1_32x64_q31(
salvatoregulfo 8:346c55cb6033 3790 3791 const arm_biquad_cas_df1_32x64_ins_q31 * S,
salvatoregulfo 8:346c55cb6033 3791 3792 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 3792 3793 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 3793 3794 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3794 3795
salvatoregulfo 8:346c55cb6033 3795 3796
salvatoregulfo 8:346c55cb6033 3796 3797 /**
salvatoregulfo 8:346c55cb6033 3797 3798 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
salvatoregulfo 8:346c55cb6033 3798 3799 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 3799 3800 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3800 3801 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3801 3802 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
salvatoregulfo 8:346c55cb6033 3802 3803 * @return none
salvatoregulfo 8:346c55cb6033 3803 3804 */
salvatoregulfo 8:346c55cb6033 3804 3805
salvatoregulfo 8:346c55cb6033 3805 3806 void arm_biquad_cas_df1_32x64_init_q31(
salvatoregulfo 8:346c55cb6033 3806 3807 arm_biquad_cas_df1_32x64_ins_q31 * S,
salvatoregulfo 8:346c55cb6033 3807 3808 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 3808 3809 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3809 3810 q63_t * pState,
salvatoregulfo 8:346c55cb6033 3810 3811 uint8_t postShift);
salvatoregulfo 8:346c55cb6033 3811 3812
salvatoregulfo 8:346c55cb6033 3812 3813
salvatoregulfo 8:346c55cb6033 3813 3814
salvatoregulfo 8:346c55cb6033 3814 3815 /**
salvatoregulfo 8:346c55cb6033 3815 3816 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3816 3817 */
salvatoregulfo 8:346c55cb6033 3817 3818
salvatoregulfo 8:346c55cb6033 3818 3819 typedef struct
salvatoregulfo 8:346c55cb6033 3819 3820 {
salvatoregulfo 8:346c55cb6033 3820 3821 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 3821 3822 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
salvatoregulfo 8:346c55cb6033 3822 3823 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 3823 3824 } arm_biquad_cascade_df2T_instance_f32;
salvatoregulfo 8:346c55cb6033 3824 3825
salvatoregulfo 8:346c55cb6033 3825 3826
salvatoregulfo 8:346c55cb6033 3826 3827
salvatoregulfo 8:346c55cb6033 3827 3828 /**
salvatoregulfo 8:346c55cb6033 3828 3829 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3829 3830 */
salvatoregulfo 8:346c55cb6033 3830 3831
salvatoregulfo 8:346c55cb6033 3831 3832 typedef struct
salvatoregulfo 8:346c55cb6033 3832 3833 {
salvatoregulfo 8:346c55cb6033 3833 3834 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 3834 3835 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
salvatoregulfo 8:346c55cb6033 3835 3836 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 3836 3837 } arm_biquad_cascade_stereo_df2T_instance_f32;
salvatoregulfo 8:346c55cb6033 3837 3838
salvatoregulfo 8:346c55cb6033 3838 3839
salvatoregulfo 8:346c55cb6033 3839 3840
salvatoregulfo 8:346c55cb6033 3840 3841 /**
salvatoregulfo 8:346c55cb6033 3841 3842 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3842 3843 */
salvatoregulfo 8:346c55cb6033 3843 3844
salvatoregulfo 8:346c55cb6033 3844 3845 typedef struct
salvatoregulfo 8:346c55cb6033 3845 3846 {
salvatoregulfo 8:346c55cb6033 3846 3847 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
salvatoregulfo 8:346c55cb6033 3847 3848 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
salvatoregulfo 8:346c55cb6033 3848 3849 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
salvatoregulfo 8:346c55cb6033 3849 3850 } arm_biquad_cascade_df2T_instance_f64;
salvatoregulfo 8:346c55cb6033 3850 3851
salvatoregulfo 8:346c55cb6033 3851 3852
salvatoregulfo 8:346c55cb6033 3852 3853 /**
salvatoregulfo 8:346c55cb6033 3853 3854 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3854 3855 * @param[in] *S points to an instance of the filter data structure.
salvatoregulfo 8:346c55cb6033 3855 3856 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3856 3857 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3857 3858 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 3858 3859 * @return none.
salvatoregulfo 8:346c55cb6033 3859 3860 */
salvatoregulfo 8:346c55cb6033 3860 3861
salvatoregulfo 8:346c55cb6033 3861 3862 void arm_biquad_cascade_df2T_f32(
salvatoregulfo 8:346c55cb6033 3862 3863 const arm_biquad_cascade_df2T_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3863 3864 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 3864 3865 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 3865 3866 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3866 3867
salvatoregulfo 8:346c55cb6033 3867 3868
salvatoregulfo 8:346c55cb6033 3868 3869 /**
salvatoregulfo 8:346c55cb6033 3869 3870 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
salvatoregulfo 8:346c55cb6033 3870 3871 * @param[in] *S points to an instance of the filter data structure.
salvatoregulfo 8:346c55cb6033 3871 3872 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3872 3873 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3873 3874 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 3874 3875 * @return none.
salvatoregulfo 8:346c55cb6033 3875 3876 */
salvatoregulfo 8:346c55cb6033 3876 3877
salvatoregulfo 8:346c55cb6033 3877 3878 void arm_biquad_cascade_stereo_df2T_f32(
salvatoregulfo 8:346c55cb6033 3878 3879 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3879 3880 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 3880 3881 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 3881 3882 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3882 3883
salvatoregulfo 8:346c55cb6033 3883 3884 /**
salvatoregulfo 8:346c55cb6033 3884 3885 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3885 3886 * @param[in] *S points to an instance of the filter data structure.
salvatoregulfo 8:346c55cb6033 3886 3887 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 3887 3888 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 3888 3889 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 3889 3890 * @return none.
salvatoregulfo 8:346c55cb6033 3890 3891 */
salvatoregulfo 8:346c55cb6033 3891 3892
salvatoregulfo 8:346c55cb6033 3892 3893 void arm_biquad_cascade_df2T_f64(
salvatoregulfo 8:346c55cb6033 3893 3894 const arm_biquad_cascade_df2T_instance_f64 * S,
salvatoregulfo 8:346c55cb6033 3894 3895 float64_t * pSrc,
salvatoregulfo 8:346c55cb6033 3895 3896 float64_t * pDst,
salvatoregulfo 8:346c55cb6033 3896 3897 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 3897 3898
salvatoregulfo 8:346c55cb6033 3898 3899
salvatoregulfo 8:346c55cb6033 3899 3900 /**
salvatoregulfo 8:346c55cb6033 3900 3901 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3901 3902 * @param[in,out] *S points to an instance of the filter data structure.
salvatoregulfo 8:346c55cb6033 3902 3903 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 3903 3904 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3904 3905 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3905 3906 * @return none
salvatoregulfo 8:346c55cb6033 3906 3907 */
salvatoregulfo 8:346c55cb6033 3907 3908
salvatoregulfo 8:346c55cb6033 3908 3909 void arm_biquad_cascade_df2T_init_f32(
salvatoregulfo 8:346c55cb6033 3909 3910 arm_biquad_cascade_df2T_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3910 3911 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 3911 3912 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3912 3913 float32_t * pState);
salvatoregulfo 8:346c55cb6033 3913 3914
salvatoregulfo 8:346c55cb6033 3914 3915
salvatoregulfo 8:346c55cb6033 3915 3916 /**
salvatoregulfo 8:346c55cb6033 3916 3917 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3917 3918 * @param[in,out] *S points to an instance of the filter data structure.
salvatoregulfo 8:346c55cb6033 3918 3919 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 3919 3920 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3920 3921 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3921 3922 * @return none
salvatoregulfo 8:346c55cb6033 3922 3923 */
salvatoregulfo 8:346c55cb6033 3923 3924
salvatoregulfo 8:346c55cb6033 3924 3925 void arm_biquad_cascade_stereo_df2T_init_f32(
salvatoregulfo 8:346c55cb6033 3925 3926 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 3926 3927 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 3927 3928 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3928 3929 float32_t * pState);
salvatoregulfo 8:346c55cb6033 3929 3930
salvatoregulfo 8:346c55cb6033 3930 3931
salvatoregulfo 8:346c55cb6033 3931 3932 /**
salvatoregulfo 8:346c55cb6033 3932 3933 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
salvatoregulfo 8:346c55cb6033 3933 3934 * @param[in,out] *S points to an instance of the filter data structure.
salvatoregulfo 8:346c55cb6033 3934 3935 * @param[in] numStages number of 2nd order stages in the filter.
salvatoregulfo 8:346c55cb6033 3935 3936 * @param[in] *pCoeffs points to the filter coefficients.
salvatoregulfo 8:346c55cb6033 3936 3937 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 3937 3938 * @return none
salvatoregulfo 8:346c55cb6033 3938 3939 */
salvatoregulfo 8:346c55cb6033 3939 3940
salvatoregulfo 8:346c55cb6033 3940 3941 void arm_biquad_cascade_df2T_init_f64(
salvatoregulfo 8:346c55cb6033 3941 3942 arm_biquad_cascade_df2T_instance_f64 * S,
salvatoregulfo 8:346c55cb6033 3942 3943 uint8_t numStages,
salvatoregulfo 8:346c55cb6033 3943 3944 float64_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3944 3945 float64_t * pState);
salvatoregulfo 8:346c55cb6033 3945 3946
salvatoregulfo 8:346c55cb6033 3946 3947
salvatoregulfo 8:346c55cb6033 3947 3948
salvatoregulfo 8:346c55cb6033 3948 3949 /**
salvatoregulfo 8:346c55cb6033 3949 3950 * @brief Instance structure for the Q15 FIR lattice filter.
salvatoregulfo 8:346c55cb6033 3950 3951 */
salvatoregulfo 8:346c55cb6033 3951 3952
salvatoregulfo 8:346c55cb6033 3952 3953 typedef struct
salvatoregulfo 8:346c55cb6033 3953 3954 {
salvatoregulfo 8:346c55cb6033 3954 3955 uint16_t numStages; /**< number of filter stages. */
salvatoregulfo 8:346c55cb6033 3955 3956 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 3956 3957 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 3957 3958 } arm_fir_lattice_instance_q15;
salvatoregulfo 8:346c55cb6033 3958 3959
salvatoregulfo 8:346c55cb6033 3959 3960 /**
salvatoregulfo 8:346c55cb6033 3960 3961 * @brief Instance structure for the Q31 FIR lattice filter.
salvatoregulfo 8:346c55cb6033 3961 3962 */
salvatoregulfo 8:346c55cb6033 3962 3963
salvatoregulfo 8:346c55cb6033 3963 3964 typedef struct
salvatoregulfo 8:346c55cb6033 3964 3965 {
salvatoregulfo 8:346c55cb6033 3965 3966 uint16_t numStages; /**< number of filter stages. */
salvatoregulfo 8:346c55cb6033 3966 3967 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 3967 3968 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 3968 3969 } arm_fir_lattice_instance_q31;
salvatoregulfo 8:346c55cb6033 3969 3970
salvatoregulfo 8:346c55cb6033 3970 3971 /**
salvatoregulfo 8:346c55cb6033 3971 3972 * @brief Instance structure for the floating-point FIR lattice filter.
salvatoregulfo 8:346c55cb6033 3972 3973 */
salvatoregulfo 8:346c55cb6033 3973 3974
salvatoregulfo 8:346c55cb6033 3974 3975 typedef struct
salvatoregulfo 8:346c55cb6033 3975 3976 {
salvatoregulfo 8:346c55cb6033 3976 3977 uint16_t numStages; /**< number of filter stages. */
salvatoregulfo 8:346c55cb6033 3977 3978 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 3978 3979 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 3979 3980 } arm_fir_lattice_instance_f32;
salvatoregulfo 8:346c55cb6033 3980 3981
salvatoregulfo 8:346c55cb6033 3981 3982 /**
salvatoregulfo 8:346c55cb6033 3982 3983 * @brief Initialization function for the Q15 FIR lattice filter.
salvatoregulfo 8:346c55cb6033 3983 3984 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
salvatoregulfo 8:346c55cb6033 3984 3985 * @param[in] numStages number of filter stages.
salvatoregulfo 8:346c55cb6033 3985 3986 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 3986 3987 * @param[in] *pState points to the state buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 3987 3988 * @return none.
salvatoregulfo 8:346c55cb6033 3988 3989 */
salvatoregulfo 8:346c55cb6033 3989 3990
salvatoregulfo 8:346c55cb6033 3990 3991 void arm_fir_lattice_init_q15(
salvatoregulfo 8:346c55cb6033 3991 3992 arm_fir_lattice_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 3992 3993 uint16_t numStages,
salvatoregulfo 8:346c55cb6033 3993 3994 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 3994 3995 q15_t * pState);
salvatoregulfo 8:346c55cb6033 3995 3996
salvatoregulfo 8:346c55cb6033 3996 3997
salvatoregulfo 8:346c55cb6033 3997 3998 /**
salvatoregulfo 8:346c55cb6033 3998 3999 * @brief Processing function for the Q15 FIR lattice filter.
salvatoregulfo 8:346c55cb6033 3999 4000 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
salvatoregulfo 8:346c55cb6033 4000 4001 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4001 4002 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 4002 4003 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4003 4004 * @return none.
salvatoregulfo 8:346c55cb6033 4004 4005 */
salvatoregulfo 8:346c55cb6033 4005 4006 void arm_fir_lattice_q15(
salvatoregulfo 8:346c55cb6033 4006 4007 const arm_fir_lattice_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4007 4008 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 4008 4009 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 4009 4010 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4010 4011
salvatoregulfo 8:346c55cb6033 4011 4012 /**
salvatoregulfo 8:346c55cb6033 4012 4013 * @brief Initialization function for the Q31 FIR lattice filter.
salvatoregulfo 8:346c55cb6033 4013 4014 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
salvatoregulfo 8:346c55cb6033 4014 4015 * @param[in] numStages number of filter stages.
salvatoregulfo 8:346c55cb6033 4015 4016 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4016 4017 * @param[in] *pState points to the state buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4017 4018 * @return none.
salvatoregulfo 8:346c55cb6033 4018 4019 */
salvatoregulfo 8:346c55cb6033 4019 4020
salvatoregulfo 8:346c55cb6033 4020 4021 void arm_fir_lattice_init_q31(
salvatoregulfo 8:346c55cb6033 4021 4022 arm_fir_lattice_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4022 4023 uint16_t numStages,
salvatoregulfo 8:346c55cb6033 4023 4024 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4024 4025 q31_t * pState);
salvatoregulfo 8:346c55cb6033 4025 4026
salvatoregulfo 8:346c55cb6033 4026 4027
salvatoregulfo 8:346c55cb6033 4027 4028 /**
salvatoregulfo 8:346c55cb6033 4028 4029 * @brief Processing function for the Q31 FIR lattice filter.
salvatoregulfo 8:346c55cb6033 4029 4030 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
salvatoregulfo 8:346c55cb6033 4030 4031 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4031 4032 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 4032 4033 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4033 4034 * @return none.
salvatoregulfo 8:346c55cb6033 4034 4035 */
salvatoregulfo 8:346c55cb6033 4035 4036
salvatoregulfo 8:346c55cb6033 4036 4037 void arm_fir_lattice_q31(
salvatoregulfo 8:346c55cb6033 4037 4038 const arm_fir_lattice_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4038 4039 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 4039 4040 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 4040 4041 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4041 4042
salvatoregulfo 8:346c55cb6033 4042 4043 /**
salvatoregulfo 8:346c55cb6033 4043 4044 * @brief Initialization function for the floating-point FIR lattice filter.
salvatoregulfo 8:346c55cb6033 4044 4045 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
salvatoregulfo 8:346c55cb6033 4045 4046 * @param[in] numStages number of filter stages.
salvatoregulfo 8:346c55cb6033 4046 4047 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4047 4048 * @param[in] *pState points to the state buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4048 4049 * @return none.
salvatoregulfo 8:346c55cb6033 4049 4050 */
salvatoregulfo 8:346c55cb6033 4050 4051
salvatoregulfo 8:346c55cb6033 4051 4052 void arm_fir_lattice_init_f32(
salvatoregulfo 8:346c55cb6033 4052 4053 arm_fir_lattice_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4053 4054 uint16_t numStages,
salvatoregulfo 8:346c55cb6033 4054 4055 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4055 4056 float32_t * pState);
salvatoregulfo 8:346c55cb6033 4056 4057
salvatoregulfo 8:346c55cb6033 4057 4058 /**
salvatoregulfo 8:346c55cb6033 4058 4059 * @brief Processing function for the floating-point FIR lattice filter.
salvatoregulfo 8:346c55cb6033 4059 4060 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
salvatoregulfo 8:346c55cb6033 4060 4061 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4061 4062 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 4062 4063 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4063 4064 * @return none.
salvatoregulfo 8:346c55cb6033 4064 4065 */
salvatoregulfo 8:346c55cb6033 4065 4066
salvatoregulfo 8:346c55cb6033 4066 4067 void arm_fir_lattice_f32(
salvatoregulfo 8:346c55cb6033 4067 4068 const arm_fir_lattice_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4068 4069 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4069 4070 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 4070 4071 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4071 4072
salvatoregulfo 8:346c55cb6033 4072 4073 /**
salvatoregulfo 8:346c55cb6033 4073 4074 * @brief Instance structure for the Q15 IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4074 4075 */
salvatoregulfo 8:346c55cb6033 4075 4076 typedef struct
salvatoregulfo 8:346c55cb6033 4076 4077 {
salvatoregulfo 8:346c55cb6033 4077 4078 uint16_t numStages; /**< number of stages in the filter. */
salvatoregulfo 8:346c55cb6033 4078 4079 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
salvatoregulfo 8:346c55cb6033 4079 4080 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 4080 4081 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
salvatoregulfo 8:346c55cb6033 4081 4082 } arm_iir_lattice_instance_q15;
salvatoregulfo 8:346c55cb6033 4082 4083
salvatoregulfo 8:346c55cb6033 4083 4084 /**
salvatoregulfo 8:346c55cb6033 4084 4085 * @brief Instance structure for the Q31 IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4085 4086 */
salvatoregulfo 8:346c55cb6033 4086 4087 typedef struct
salvatoregulfo 8:346c55cb6033 4087 4088 {
salvatoregulfo 8:346c55cb6033 4088 4089 uint16_t numStages; /**< number of stages in the filter. */
salvatoregulfo 8:346c55cb6033 4089 4090 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
salvatoregulfo 8:346c55cb6033 4090 4091 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 4091 4092 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
salvatoregulfo 8:346c55cb6033 4092 4093 } arm_iir_lattice_instance_q31;
salvatoregulfo 8:346c55cb6033 4093 4094
salvatoregulfo 8:346c55cb6033 4094 4095 /**
salvatoregulfo 8:346c55cb6033 4095 4096 * @brief Instance structure for the floating-point IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4096 4097 */
salvatoregulfo 8:346c55cb6033 4097 4098 typedef struct
salvatoregulfo 8:346c55cb6033 4098 4099 {
salvatoregulfo 8:346c55cb6033 4099 4100 uint16_t numStages; /**< number of stages in the filter. */
salvatoregulfo 8:346c55cb6033 4100 4101 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
salvatoregulfo 8:346c55cb6033 4101 4102 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
salvatoregulfo 8:346c55cb6033 4102 4103 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
salvatoregulfo 8:346c55cb6033 4103 4104 } arm_iir_lattice_instance_f32;
salvatoregulfo 8:346c55cb6033 4104 4105
salvatoregulfo 8:346c55cb6033 4105 4106 /**
salvatoregulfo 8:346c55cb6033 4106 4107 * @brief Processing function for the floating-point IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4107 4108 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
salvatoregulfo 8:346c55cb6033 4108 4109 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4109 4110 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 4110 4111 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4111 4112 * @return none.
salvatoregulfo 8:346c55cb6033 4112 4113 */
salvatoregulfo 8:346c55cb6033 4113 4114
salvatoregulfo 8:346c55cb6033 4114 4115 void arm_iir_lattice_f32(
salvatoregulfo 8:346c55cb6033 4115 4116 const arm_iir_lattice_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4116 4117 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4117 4118 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 4118 4119 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4119 4120
salvatoregulfo 8:346c55cb6033 4120 4121 /**
salvatoregulfo 8:346c55cb6033 4121 4122 * @brief Initialization function for the floating-point IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4122 4123 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
salvatoregulfo 8:346c55cb6033 4123 4124 * @param[in] numStages number of stages in the filter.
salvatoregulfo 8:346c55cb6033 4124 4125 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4125 4126 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
salvatoregulfo 8:346c55cb6033 4126 4127 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
salvatoregulfo 8:346c55cb6033 4127 4128 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4128 4129 * @return none.
salvatoregulfo 8:346c55cb6033 4129 4130 */
salvatoregulfo 8:346c55cb6033 4130 4131
salvatoregulfo 8:346c55cb6033 4131 4132 void arm_iir_lattice_init_f32(
salvatoregulfo 8:346c55cb6033 4132 4133 arm_iir_lattice_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4133 4134 uint16_t numStages,
salvatoregulfo 8:346c55cb6033 4134 4135 float32_t * pkCoeffs,
salvatoregulfo 8:346c55cb6033 4135 4136 float32_t * pvCoeffs,
salvatoregulfo 8:346c55cb6033 4136 4137 float32_t * pState,
salvatoregulfo 8:346c55cb6033 4137 4138 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4138 4139
salvatoregulfo 8:346c55cb6033 4139 4140
salvatoregulfo 8:346c55cb6033 4140 4141 /**
salvatoregulfo 8:346c55cb6033 4141 4142 * @brief Processing function for the Q31 IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4142 4143 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
salvatoregulfo 8:346c55cb6033 4143 4144 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4144 4145 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 4145 4146 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4146 4147 * @return none.
salvatoregulfo 8:346c55cb6033 4147 4148 */
salvatoregulfo 8:346c55cb6033 4148 4149
salvatoregulfo 8:346c55cb6033 4149 4150 void arm_iir_lattice_q31(
salvatoregulfo 8:346c55cb6033 4150 4151 const arm_iir_lattice_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4151 4152 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 4152 4153 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 4153 4154 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4154 4155
salvatoregulfo 8:346c55cb6033 4155 4156
salvatoregulfo 8:346c55cb6033 4156 4157 /**
salvatoregulfo 8:346c55cb6033 4157 4158 * @brief Initialization function for the Q31 IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4158 4159 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
salvatoregulfo 8:346c55cb6033 4159 4160 * @param[in] numStages number of stages in the filter.
salvatoregulfo 8:346c55cb6033 4160 4161 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4161 4162 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
salvatoregulfo 8:346c55cb6033 4162 4163 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
salvatoregulfo 8:346c55cb6033 4163 4164 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4164 4165 * @return none.
salvatoregulfo 8:346c55cb6033 4165 4166 */
salvatoregulfo 8:346c55cb6033 4166 4167
salvatoregulfo 8:346c55cb6033 4167 4168 void arm_iir_lattice_init_q31(
salvatoregulfo 8:346c55cb6033 4168 4169 arm_iir_lattice_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4169 4170 uint16_t numStages,
salvatoregulfo 8:346c55cb6033 4170 4171 q31_t * pkCoeffs,
salvatoregulfo 8:346c55cb6033 4171 4172 q31_t * pvCoeffs,
salvatoregulfo 8:346c55cb6033 4172 4173 q31_t * pState,
salvatoregulfo 8:346c55cb6033 4173 4174 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4174 4175
salvatoregulfo 8:346c55cb6033 4175 4176
salvatoregulfo 8:346c55cb6033 4176 4177 /**
salvatoregulfo 8:346c55cb6033 4177 4178 * @brief Processing function for the Q15 IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4178 4179 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
salvatoregulfo 8:346c55cb6033 4179 4180 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4180 4181 * @param[out] *pDst points to the block of output data.
salvatoregulfo 8:346c55cb6033 4181 4182 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4182 4183 * @return none.
salvatoregulfo 8:346c55cb6033 4183 4184 */
salvatoregulfo 8:346c55cb6033 4184 4185
salvatoregulfo 8:346c55cb6033 4185 4186 void arm_iir_lattice_q15(
salvatoregulfo 8:346c55cb6033 4186 4187 const arm_iir_lattice_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4187 4188 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 4188 4189 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 4189 4190 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4190 4191
salvatoregulfo 8:346c55cb6033 4191 4192
salvatoregulfo 8:346c55cb6033 4192 4193 /**
salvatoregulfo 8:346c55cb6033 4193 4194 * @brief Initialization function for the Q15 IIR lattice filter.
salvatoregulfo 8:346c55cb6033 4194 4195 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
salvatoregulfo 8:346c55cb6033 4195 4196 * @param[in] numStages number of stages in the filter.
salvatoregulfo 8:346c55cb6033 4196 4197 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
salvatoregulfo 8:346c55cb6033 4197 4198 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
salvatoregulfo 8:346c55cb6033 4198 4199 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
salvatoregulfo 8:346c55cb6033 4199 4200 * @param[in] blockSize number of samples to process per call.
salvatoregulfo 8:346c55cb6033 4200 4201 * @return none.
salvatoregulfo 8:346c55cb6033 4201 4202 */
salvatoregulfo 8:346c55cb6033 4202 4203
salvatoregulfo 8:346c55cb6033 4203 4204 void arm_iir_lattice_init_q15(
salvatoregulfo 8:346c55cb6033 4204 4205 arm_iir_lattice_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4205 4206 uint16_t numStages,
salvatoregulfo 8:346c55cb6033 4206 4207 q15_t * pkCoeffs,
salvatoregulfo 8:346c55cb6033 4207 4208 q15_t * pvCoeffs,
salvatoregulfo 8:346c55cb6033 4208 4209 q15_t * pState,
salvatoregulfo 8:346c55cb6033 4209 4210 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4210 4211
salvatoregulfo 8:346c55cb6033 4211 4212 /**
salvatoregulfo 8:346c55cb6033 4212 4213 * @brief Instance structure for the floating-point LMS filter.
salvatoregulfo 8:346c55cb6033 4213 4214 */
salvatoregulfo 8:346c55cb6033 4214 4215
salvatoregulfo 8:346c55cb6033 4215 4216 typedef struct
salvatoregulfo 8:346c55cb6033 4216 4217 {
salvatoregulfo 8:346c55cb6033 4217 4218 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4218 4219 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4219 4220 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4220 4221 float32_t mu; /**< step size that controls filter coefficient updates. */
salvatoregulfo 8:346c55cb6033 4221 4222 } arm_lms_instance_f32;
salvatoregulfo 8:346c55cb6033 4222 4223
salvatoregulfo 8:346c55cb6033 4223 4224 /**
salvatoregulfo 8:346c55cb6033 4224 4225 * @brief Processing function for floating-point LMS filter.
salvatoregulfo 8:346c55cb6033 4225 4226 * @param[in] *S points to an instance of the floating-point LMS filter structure.
salvatoregulfo 8:346c55cb6033 4226 4227 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4227 4228 * @param[in] *pRef points to the block of reference data.
salvatoregulfo 8:346c55cb6033 4228 4229 * @param[out] *pOut points to the block of output data.
salvatoregulfo 8:346c55cb6033 4229 4230 * @param[out] *pErr points to the block of error data.
salvatoregulfo 8:346c55cb6033 4230 4231 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4231 4232 * @return none.
salvatoregulfo 8:346c55cb6033 4232 4233 */
salvatoregulfo 8:346c55cb6033 4233 4234
salvatoregulfo 8:346c55cb6033 4234 4235 void arm_lms_f32(
salvatoregulfo 8:346c55cb6033 4235 4236 const arm_lms_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4236 4237 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4237 4238 float32_t * pRef,
salvatoregulfo 8:346c55cb6033 4238 4239 float32_t * pOut,
salvatoregulfo 8:346c55cb6033 4239 4240 float32_t * pErr,
salvatoregulfo 8:346c55cb6033 4240 4241 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4241 4242
salvatoregulfo 8:346c55cb6033 4242 4243 /**
salvatoregulfo 8:346c55cb6033 4243 4244 * @brief Initialization function for floating-point LMS filter.
salvatoregulfo 8:346c55cb6033 4244 4245 * @param[in] *S points to an instance of the floating-point LMS filter structure.
salvatoregulfo 8:346c55cb6033 4245 4246 * @param[in] numTaps number of filter coefficients.
salvatoregulfo 8:346c55cb6033 4246 4247 * @param[in] *pCoeffs points to the coefficient buffer.
salvatoregulfo 8:346c55cb6033 4247 4248 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 4248 4249 * @param[in] mu step size that controls filter coefficient updates.
salvatoregulfo 8:346c55cb6033 4249 4250 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4250 4251 * @return none.
salvatoregulfo 8:346c55cb6033 4251 4252 */
salvatoregulfo 8:346c55cb6033 4252 4253
salvatoregulfo 8:346c55cb6033 4253 4254 void arm_lms_init_f32(
salvatoregulfo 8:346c55cb6033 4254 4255 arm_lms_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4255 4256 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4256 4257 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4257 4258 float32_t * pState,
salvatoregulfo 8:346c55cb6033 4258 4259 float32_t mu,
salvatoregulfo 8:346c55cb6033 4259 4260 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4260 4261
salvatoregulfo 8:346c55cb6033 4261 4262 /**
salvatoregulfo 8:346c55cb6033 4262 4263 * @brief Instance structure for the Q15 LMS filter.
salvatoregulfo 8:346c55cb6033 4263 4264 */
salvatoregulfo 8:346c55cb6033 4264 4265
salvatoregulfo 8:346c55cb6033 4265 4266 typedef struct
salvatoregulfo 8:346c55cb6033 4266 4267 {
salvatoregulfo 8:346c55cb6033 4267 4268 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4268 4269 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4269 4270 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4270 4271 q15_t mu; /**< step size that controls filter coefficient updates. */
salvatoregulfo 8:346c55cb6033 4271 4272 uint32_t postShift; /**< bit shift applied to coefficients. */
salvatoregulfo 8:346c55cb6033 4272 4273 } arm_lms_instance_q15;
salvatoregulfo 8:346c55cb6033 4273 4274
salvatoregulfo 8:346c55cb6033 4274 4275
salvatoregulfo 8:346c55cb6033 4275 4276 /**
salvatoregulfo 8:346c55cb6033 4276 4277 * @brief Initialization function for the Q15 LMS filter.
salvatoregulfo 8:346c55cb6033 4277 4278 * @param[in] *S points to an instance of the Q15 LMS filter structure.
salvatoregulfo 8:346c55cb6033 4278 4279 * @param[in] numTaps number of filter coefficients.
salvatoregulfo 8:346c55cb6033 4279 4280 * @param[in] *pCoeffs points to the coefficient buffer.
salvatoregulfo 8:346c55cb6033 4280 4281 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 4281 4282 * @param[in] mu step size that controls filter coefficient updates.
salvatoregulfo 8:346c55cb6033 4282 4283 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4283 4284 * @param[in] postShift bit shift applied to coefficients.
salvatoregulfo 8:346c55cb6033 4284 4285 * @return none.
salvatoregulfo 8:346c55cb6033 4285 4286 */
salvatoregulfo 8:346c55cb6033 4286 4287
salvatoregulfo 8:346c55cb6033 4287 4288 void arm_lms_init_q15(
salvatoregulfo 8:346c55cb6033 4288 4289 arm_lms_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4289 4290 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4290 4291 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4291 4292 q15_t * pState,
salvatoregulfo 8:346c55cb6033 4292 4293 q15_t mu,
salvatoregulfo 8:346c55cb6033 4293 4294 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 4294 4295 uint32_t postShift);
salvatoregulfo 8:346c55cb6033 4295 4296
salvatoregulfo 8:346c55cb6033 4296 4297 /**
salvatoregulfo 8:346c55cb6033 4297 4298 * @brief Processing function for Q15 LMS filter.
salvatoregulfo 8:346c55cb6033 4298 4299 * @param[in] *S points to an instance of the Q15 LMS filter structure.
salvatoregulfo 8:346c55cb6033 4299 4300 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4300 4301 * @param[in] *pRef points to the block of reference data.
salvatoregulfo 8:346c55cb6033 4301 4302 * @param[out] *pOut points to the block of output data.
salvatoregulfo 8:346c55cb6033 4302 4303 * @param[out] *pErr points to the block of error data.
salvatoregulfo 8:346c55cb6033 4303 4304 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4304 4305 * @return none.
salvatoregulfo 8:346c55cb6033 4305 4306 */
salvatoregulfo 8:346c55cb6033 4306 4307
salvatoregulfo 8:346c55cb6033 4307 4308 void arm_lms_q15(
salvatoregulfo 8:346c55cb6033 4308 4309 const arm_lms_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4309 4310 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 4310 4311 q15_t * pRef,
salvatoregulfo 8:346c55cb6033 4311 4312 q15_t * pOut,
salvatoregulfo 8:346c55cb6033 4312 4313 q15_t * pErr,
salvatoregulfo 8:346c55cb6033 4313 4314 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4314 4315
salvatoregulfo 8:346c55cb6033 4315 4316
salvatoregulfo 8:346c55cb6033 4316 4317 /**
salvatoregulfo 8:346c55cb6033 4317 4318 * @brief Instance structure for the Q31 LMS filter.
salvatoregulfo 8:346c55cb6033 4318 4319 */
salvatoregulfo 8:346c55cb6033 4319 4320
salvatoregulfo 8:346c55cb6033 4320 4321 typedef struct
salvatoregulfo 8:346c55cb6033 4321 4322 {
salvatoregulfo 8:346c55cb6033 4322 4323 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4323 4324 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4324 4325 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4325 4326 q31_t mu; /**< step size that controls filter coefficient updates. */
salvatoregulfo 8:346c55cb6033 4326 4327 uint32_t postShift; /**< bit shift applied to coefficients. */
salvatoregulfo 8:346c55cb6033 4327 4328
salvatoregulfo 8:346c55cb6033 4328 4329 } arm_lms_instance_q31;
salvatoregulfo 8:346c55cb6033 4329 4330
salvatoregulfo 8:346c55cb6033 4330 4331 /**
salvatoregulfo 8:346c55cb6033 4331 4332 * @brief Processing function for Q31 LMS filter.
salvatoregulfo 8:346c55cb6033 4332 4333 * @param[in] *S points to an instance of the Q15 LMS filter structure.
salvatoregulfo 8:346c55cb6033 4333 4334 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4334 4335 * @param[in] *pRef points to the block of reference data.
salvatoregulfo 8:346c55cb6033 4335 4336 * @param[out] *pOut points to the block of output data.
salvatoregulfo 8:346c55cb6033 4336 4337 * @param[out] *pErr points to the block of error data.
salvatoregulfo 8:346c55cb6033 4337 4338 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4338 4339 * @return none.
salvatoregulfo 8:346c55cb6033 4339 4340 */
salvatoregulfo 8:346c55cb6033 4340 4341
salvatoregulfo 8:346c55cb6033 4341 4342 void arm_lms_q31(
salvatoregulfo 8:346c55cb6033 4342 4343 const arm_lms_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4343 4344 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 4344 4345 q31_t * pRef,
salvatoregulfo 8:346c55cb6033 4345 4346 q31_t * pOut,
salvatoregulfo 8:346c55cb6033 4346 4347 q31_t * pErr,
salvatoregulfo 8:346c55cb6033 4347 4348 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4348 4349
salvatoregulfo 8:346c55cb6033 4349 4350 /**
salvatoregulfo 8:346c55cb6033 4350 4351 * @brief Initialization function for Q31 LMS filter.
salvatoregulfo 8:346c55cb6033 4351 4352 * @param[in] *S points to an instance of the Q31 LMS filter structure.
salvatoregulfo 8:346c55cb6033 4352 4353 * @param[in] numTaps number of filter coefficients.
salvatoregulfo 8:346c55cb6033 4353 4354 * @param[in] *pCoeffs points to coefficient buffer.
salvatoregulfo 8:346c55cb6033 4354 4355 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 4355 4356 * @param[in] mu step size that controls filter coefficient updates.
salvatoregulfo 8:346c55cb6033 4356 4357 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4357 4358 * @param[in] postShift bit shift applied to coefficients.
salvatoregulfo 8:346c55cb6033 4358 4359 * @return none.
salvatoregulfo 8:346c55cb6033 4359 4360 */
salvatoregulfo 8:346c55cb6033 4360 4361
salvatoregulfo 8:346c55cb6033 4361 4362 void arm_lms_init_q31(
salvatoregulfo 8:346c55cb6033 4362 4363 arm_lms_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4363 4364 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4364 4365 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4365 4366 q31_t * pState,
salvatoregulfo 8:346c55cb6033 4366 4367 q31_t mu,
salvatoregulfo 8:346c55cb6033 4367 4368 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 4368 4369 uint32_t postShift);
salvatoregulfo 8:346c55cb6033 4369 4370
salvatoregulfo 8:346c55cb6033 4370 4371 /**
salvatoregulfo 8:346c55cb6033 4371 4372 * @brief Instance structure for the floating-point normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4372 4373 */
salvatoregulfo 8:346c55cb6033 4373 4374
salvatoregulfo 8:346c55cb6033 4374 4375 typedef struct
salvatoregulfo 8:346c55cb6033 4375 4376 {
salvatoregulfo 8:346c55cb6033 4376 4377 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4377 4378 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4378 4379 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4379 4380 float32_t mu; /**< step size that control filter coefficient updates. */
salvatoregulfo 8:346c55cb6033 4380 4381 float32_t energy; /**< saves previous frame energy. */
salvatoregulfo 8:346c55cb6033 4381 4382 float32_t x0; /**< saves previous input sample. */
salvatoregulfo 8:346c55cb6033 4382 4383 } arm_lms_norm_instance_f32;
salvatoregulfo 8:346c55cb6033 4383 4384
salvatoregulfo 8:346c55cb6033 4384 4385 /**
salvatoregulfo 8:346c55cb6033 4385 4386 * @brief Processing function for floating-point normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4386 4387 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
salvatoregulfo 8:346c55cb6033 4387 4388 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4388 4389 * @param[in] *pRef points to the block of reference data.
salvatoregulfo 8:346c55cb6033 4389 4390 * @param[out] *pOut points to the block of output data.
salvatoregulfo 8:346c55cb6033 4390 4391 * @param[out] *pErr points to the block of error data.
salvatoregulfo 8:346c55cb6033 4391 4392 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4392 4393 * @return none.
salvatoregulfo 8:346c55cb6033 4393 4394 */
salvatoregulfo 8:346c55cb6033 4394 4395
salvatoregulfo 8:346c55cb6033 4395 4396 void arm_lms_norm_f32(
salvatoregulfo 8:346c55cb6033 4396 4397 arm_lms_norm_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4397 4398 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4398 4399 float32_t * pRef,
salvatoregulfo 8:346c55cb6033 4399 4400 float32_t * pOut,
salvatoregulfo 8:346c55cb6033 4400 4401 float32_t * pErr,
salvatoregulfo 8:346c55cb6033 4401 4402 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4402 4403
salvatoregulfo 8:346c55cb6033 4403 4404 /**
salvatoregulfo 8:346c55cb6033 4404 4405 * @brief Initialization function for floating-point normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4405 4406 * @param[in] *S points to an instance of the floating-point LMS filter structure.
salvatoregulfo 8:346c55cb6033 4406 4407 * @param[in] numTaps number of filter coefficients.
salvatoregulfo 8:346c55cb6033 4407 4408 * @param[in] *pCoeffs points to coefficient buffer.
salvatoregulfo 8:346c55cb6033 4408 4409 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 4409 4410 * @param[in] mu step size that controls filter coefficient updates.
salvatoregulfo 8:346c55cb6033 4410 4411 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4411 4412 * @return none.
salvatoregulfo 8:346c55cb6033 4412 4413 */
salvatoregulfo 8:346c55cb6033 4413 4414
salvatoregulfo 8:346c55cb6033 4414 4415 void arm_lms_norm_init_f32(
salvatoregulfo 8:346c55cb6033 4415 4416 arm_lms_norm_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4416 4417 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4417 4418 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4418 4419 float32_t * pState,
salvatoregulfo 8:346c55cb6033 4419 4420 float32_t mu,
salvatoregulfo 8:346c55cb6033 4420 4421 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4421 4422
salvatoregulfo 8:346c55cb6033 4422 4423
salvatoregulfo 8:346c55cb6033 4423 4424 /**
salvatoregulfo 8:346c55cb6033 4424 4425 * @brief Instance structure for the Q31 normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4425 4426 */
salvatoregulfo 8:346c55cb6033 4426 4427 typedef struct
salvatoregulfo 8:346c55cb6033 4427 4428 {
salvatoregulfo 8:346c55cb6033 4428 4429 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4429 4430 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4430 4431 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4431 4432 q31_t mu; /**< step size that controls filter coefficient updates. */
salvatoregulfo 8:346c55cb6033 4432 4433 uint8_t postShift; /**< bit shift applied to coefficients. */
salvatoregulfo 8:346c55cb6033 4433 4434 q31_t *recipTable; /**< points to the reciprocal initial value table. */
salvatoregulfo 8:346c55cb6033 4434 4435 q31_t energy; /**< saves previous frame energy. */
salvatoregulfo 8:346c55cb6033 4435 4436 q31_t x0; /**< saves previous input sample. */
salvatoregulfo 8:346c55cb6033 4436 4437 } arm_lms_norm_instance_q31;
salvatoregulfo 8:346c55cb6033 4437 4438
salvatoregulfo 8:346c55cb6033 4438 4439 /**
salvatoregulfo 8:346c55cb6033 4439 4440 * @brief Processing function for Q31 normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4440 4441 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
salvatoregulfo 8:346c55cb6033 4441 4442 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4442 4443 * @param[in] *pRef points to the block of reference data.
salvatoregulfo 8:346c55cb6033 4443 4444 * @param[out] *pOut points to the block of output data.
salvatoregulfo 8:346c55cb6033 4444 4445 * @param[out] *pErr points to the block of error data.
salvatoregulfo 8:346c55cb6033 4445 4446 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4446 4447 * @return none.
salvatoregulfo 8:346c55cb6033 4447 4448 */
salvatoregulfo 8:346c55cb6033 4448 4449
salvatoregulfo 8:346c55cb6033 4449 4450 void arm_lms_norm_q31(
salvatoregulfo 8:346c55cb6033 4450 4451 arm_lms_norm_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4451 4452 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 4452 4453 q31_t * pRef,
salvatoregulfo 8:346c55cb6033 4453 4454 q31_t * pOut,
salvatoregulfo 8:346c55cb6033 4454 4455 q31_t * pErr,
salvatoregulfo 8:346c55cb6033 4455 4456 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4456 4457
salvatoregulfo 8:346c55cb6033 4457 4458 /**
salvatoregulfo 8:346c55cb6033 4458 4459 * @brief Initialization function for Q31 normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4459 4460 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
salvatoregulfo 8:346c55cb6033 4460 4461 * @param[in] numTaps number of filter coefficients.
salvatoregulfo 8:346c55cb6033 4461 4462 * @param[in] *pCoeffs points to coefficient buffer.
salvatoregulfo 8:346c55cb6033 4462 4463 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 4463 4464 * @param[in] mu step size that controls filter coefficient updates.
salvatoregulfo 8:346c55cb6033 4464 4465 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4465 4466 * @param[in] postShift bit shift applied to coefficients.
salvatoregulfo 8:346c55cb6033 4466 4467 * @return none.
salvatoregulfo 8:346c55cb6033 4467 4468 */
salvatoregulfo 8:346c55cb6033 4468 4469
salvatoregulfo 8:346c55cb6033 4469 4470 void arm_lms_norm_init_q31(
salvatoregulfo 8:346c55cb6033 4470 4471 arm_lms_norm_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4471 4472 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4472 4473 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4473 4474 q31_t * pState,
salvatoregulfo 8:346c55cb6033 4474 4475 q31_t mu,
salvatoregulfo 8:346c55cb6033 4475 4476 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 4476 4477 uint8_t postShift);
salvatoregulfo 8:346c55cb6033 4477 4478
salvatoregulfo 8:346c55cb6033 4478 4479 /**
salvatoregulfo 8:346c55cb6033 4479 4480 * @brief Instance structure for the Q15 normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4480 4481 */
salvatoregulfo 8:346c55cb6033 4481 4482
salvatoregulfo 8:346c55cb6033 4482 4483 typedef struct
salvatoregulfo 8:346c55cb6033 4483 4484 {
salvatoregulfo 8:346c55cb6033 4484 4485 uint16_t numTaps; /**< Number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4485 4486 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4486 4487 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4487 4488 q15_t mu; /**< step size that controls filter coefficient updates. */
salvatoregulfo 8:346c55cb6033 4488 4489 uint8_t postShift; /**< bit shift applied to coefficients. */
salvatoregulfo 8:346c55cb6033 4489 4490 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
salvatoregulfo 8:346c55cb6033 4490 4491 q15_t energy; /**< saves previous frame energy. */
salvatoregulfo 8:346c55cb6033 4491 4492 q15_t x0; /**< saves previous input sample. */
salvatoregulfo 8:346c55cb6033 4492 4493 } arm_lms_norm_instance_q15;
salvatoregulfo 8:346c55cb6033 4493 4494
salvatoregulfo 8:346c55cb6033 4494 4495 /**
salvatoregulfo 8:346c55cb6033 4495 4496 * @brief Processing function for Q15 normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4496 4497 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
salvatoregulfo 8:346c55cb6033 4497 4498 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4498 4499 * @param[in] *pRef points to the block of reference data.
salvatoregulfo 8:346c55cb6033 4499 4500 * @param[out] *pOut points to the block of output data.
salvatoregulfo 8:346c55cb6033 4500 4501 * @param[out] *pErr points to the block of error data.
salvatoregulfo 8:346c55cb6033 4501 4502 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4502 4503 * @return none.
salvatoregulfo 8:346c55cb6033 4503 4504 */
salvatoregulfo 8:346c55cb6033 4504 4505
salvatoregulfo 8:346c55cb6033 4505 4506 void arm_lms_norm_q15(
salvatoregulfo 8:346c55cb6033 4506 4507 arm_lms_norm_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4507 4508 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 4508 4509 q15_t * pRef,
salvatoregulfo 8:346c55cb6033 4509 4510 q15_t * pOut,
salvatoregulfo 8:346c55cb6033 4510 4511 q15_t * pErr,
salvatoregulfo 8:346c55cb6033 4511 4512 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4512 4513
salvatoregulfo 8:346c55cb6033 4513 4514
salvatoregulfo 8:346c55cb6033 4514 4515 /**
salvatoregulfo 8:346c55cb6033 4515 4516 * @brief Initialization function for Q15 normalized LMS filter.
salvatoregulfo 8:346c55cb6033 4516 4517 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
salvatoregulfo 8:346c55cb6033 4517 4518 * @param[in] numTaps number of filter coefficients.
salvatoregulfo 8:346c55cb6033 4518 4519 * @param[in] *pCoeffs points to coefficient buffer.
salvatoregulfo 8:346c55cb6033 4519 4520 * @param[in] *pState points to state buffer.
salvatoregulfo 8:346c55cb6033 4520 4521 * @param[in] mu step size that controls filter coefficient updates.
salvatoregulfo 8:346c55cb6033 4521 4522 * @param[in] blockSize number of samples to process.
salvatoregulfo 8:346c55cb6033 4522 4523 * @param[in] postShift bit shift applied to coefficients.
salvatoregulfo 8:346c55cb6033 4523 4524 * @return none.
salvatoregulfo 8:346c55cb6033 4524 4525 */
salvatoregulfo 8:346c55cb6033 4525 4526
salvatoregulfo 8:346c55cb6033 4526 4527 void arm_lms_norm_init_q15(
salvatoregulfo 8:346c55cb6033 4527 4528 arm_lms_norm_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4528 4529 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4529 4530 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4530 4531 q15_t * pState,
salvatoregulfo 8:346c55cb6033 4531 4532 q15_t mu,
salvatoregulfo 8:346c55cb6033 4532 4533 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 4533 4534 uint8_t postShift);
salvatoregulfo 8:346c55cb6033 4534 4535
salvatoregulfo 8:346c55cb6033 4535 4536 /**
salvatoregulfo 8:346c55cb6033 4536 4537 * @brief Correlation of floating-point sequences.
salvatoregulfo 8:346c55cb6033 4537 4538 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4538 4539 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4539 4540 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4540 4541 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4541 4542 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4542 4543 * @return none.
salvatoregulfo 8:346c55cb6033 4543 4544 */
salvatoregulfo 8:346c55cb6033 4544 4545
salvatoregulfo 8:346c55cb6033 4545 4546 void arm_correlate_f32(
salvatoregulfo 8:346c55cb6033 4546 4547 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4547 4548 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4548 4549 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4549 4550 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4550 4551 float32_t * pDst);
salvatoregulfo 8:346c55cb6033 4551 4552
salvatoregulfo 8:346c55cb6033 4552 4553
salvatoregulfo 8:346c55cb6033 4553 4554 /**
salvatoregulfo 8:346c55cb6033 4554 4555 * @brief Correlation of Q15 sequences
salvatoregulfo 8:346c55cb6033 4555 4556 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4556 4557 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4557 4558 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4558 4559 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4559 4560 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4560 4561 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 4561 4562 * @return none.
salvatoregulfo 8:346c55cb6033 4562 4563 */
salvatoregulfo 8:346c55cb6033 4563 4564 void arm_correlate_opt_q15(
salvatoregulfo 8:346c55cb6033 4564 4565 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4565 4566 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4566 4567 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4567 4568 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4568 4569 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 4569 4570 q15_t * pScratch);
salvatoregulfo 8:346c55cb6033 4570 4571
salvatoregulfo 8:346c55cb6033 4571 4572
salvatoregulfo 8:346c55cb6033 4572 4573 /**
salvatoregulfo 8:346c55cb6033 4573 4574 * @brief Correlation of Q15 sequences.
salvatoregulfo 8:346c55cb6033 4574 4575 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4575 4576 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4576 4577 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4577 4578 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4578 4579 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4579 4580 * @return none.
salvatoregulfo 8:346c55cb6033 4580 4581 */
salvatoregulfo 8:346c55cb6033 4581 4582
salvatoregulfo 8:346c55cb6033 4582 4583 void arm_correlate_q15(
salvatoregulfo 8:346c55cb6033 4583 4584 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4584 4585 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4585 4586 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4586 4587 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4587 4588 q15_t * pDst);
salvatoregulfo 8:346c55cb6033 4588 4589
salvatoregulfo 8:346c55cb6033 4589 4590 /**
salvatoregulfo 8:346c55cb6033 4590 4591 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 4591 4592 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4592 4593 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4593 4594 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4594 4595 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4595 4596 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4596 4597 * @return none.
salvatoregulfo 8:346c55cb6033 4597 4598 */
salvatoregulfo 8:346c55cb6033 4598 4599
salvatoregulfo 8:346c55cb6033 4599 4600 void arm_correlate_fast_q15(
salvatoregulfo 8:346c55cb6033 4600 4601 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4601 4602 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4602 4603 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4603 4604 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4604 4605 q15_t * pDst);
salvatoregulfo 8:346c55cb6033 4605 4606
salvatoregulfo 8:346c55cb6033 4606 4607
salvatoregulfo 8:346c55cb6033 4607 4608
salvatoregulfo 8:346c55cb6033 4608 4609 /**
salvatoregulfo 8:346c55cb6033 4609 4610 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
salvatoregulfo 8:346c55cb6033 4610 4611 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4611 4612 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4612 4613 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4613 4614 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4614 4615 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4615 4616 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 4616 4617 * @return none.
salvatoregulfo 8:346c55cb6033 4617 4618 */
salvatoregulfo 8:346c55cb6033 4618 4619
salvatoregulfo 8:346c55cb6033 4619 4620 void arm_correlate_fast_opt_q15(
salvatoregulfo 8:346c55cb6033 4620 4621 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4621 4622 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4622 4623 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4623 4624 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4624 4625 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 4625 4626 q15_t * pScratch);
salvatoregulfo 8:346c55cb6033 4626 4627
salvatoregulfo 8:346c55cb6033 4627 4628 /**
salvatoregulfo 8:346c55cb6033 4628 4629 * @brief Correlation of Q31 sequences.
salvatoregulfo 8:346c55cb6033 4629 4630 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4630 4631 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4631 4632 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4632 4633 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4633 4634 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4634 4635 * @return none.
salvatoregulfo 8:346c55cb6033 4635 4636 */
salvatoregulfo 8:346c55cb6033 4636 4637
salvatoregulfo 8:346c55cb6033 4637 4638 void arm_correlate_q31(
salvatoregulfo 8:346c55cb6033 4638 4639 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4639 4640 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4640 4641 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4641 4642 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4642 4643 q31_t * pDst);
salvatoregulfo 8:346c55cb6033 4643 4644
salvatoregulfo 8:346c55cb6033 4644 4645 /**
salvatoregulfo 8:346c55cb6033 4645 4646 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
salvatoregulfo 8:346c55cb6033 4646 4647 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4647 4648 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4648 4649 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4649 4650 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4650 4651 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4651 4652 * @return none.
salvatoregulfo 8:346c55cb6033 4652 4653 */
salvatoregulfo 8:346c55cb6033 4653 4654
salvatoregulfo 8:346c55cb6033 4654 4655 void arm_correlate_fast_q31(
salvatoregulfo 8:346c55cb6033 4655 4656 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4656 4657 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4657 4658 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4658 4659 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4659 4660 q31_t * pDst);
salvatoregulfo 8:346c55cb6033 4660 4661
salvatoregulfo 8:346c55cb6033 4661 4662
salvatoregulfo 8:346c55cb6033 4662 4663
salvatoregulfo 8:346c55cb6033 4663 4664 /**
salvatoregulfo 8:346c55cb6033 4664 4665 * @brief Correlation of Q7 sequences.
salvatoregulfo 8:346c55cb6033 4665 4666 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4666 4667 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4667 4668 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4668 4669 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4669 4670 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4670 4671 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
salvatoregulfo 8:346c55cb6033 4671 4672 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
salvatoregulfo 8:346c55cb6033 4672 4673 * @return none.
salvatoregulfo 8:346c55cb6033 4673 4674 */
salvatoregulfo 8:346c55cb6033 4674 4675
salvatoregulfo 8:346c55cb6033 4675 4676 void arm_correlate_opt_q7(
salvatoregulfo 8:346c55cb6033 4676 4677 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4677 4678 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4678 4679 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4679 4680 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4680 4681 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 4681 4682 q15_t * pScratch1,
salvatoregulfo 8:346c55cb6033 4682 4683 q15_t * pScratch2);
salvatoregulfo 8:346c55cb6033 4683 4684
salvatoregulfo 8:346c55cb6033 4684 4685
salvatoregulfo 8:346c55cb6033 4685 4686 /**
salvatoregulfo 8:346c55cb6033 4686 4687 * @brief Correlation of Q7 sequences.
salvatoregulfo 8:346c55cb6033 4687 4688 * @param[in] *pSrcA points to the first input sequence.
salvatoregulfo 8:346c55cb6033 4688 4689 * @param[in] srcALen length of the first input sequence.
salvatoregulfo 8:346c55cb6033 4689 4690 * @param[in] *pSrcB points to the second input sequence.
salvatoregulfo 8:346c55cb6033 4690 4691 * @param[in] srcBLen length of the second input sequence.
salvatoregulfo 8:346c55cb6033 4691 4692 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
salvatoregulfo 8:346c55cb6033 4692 4693 * @return none.
salvatoregulfo 8:346c55cb6033 4693 4694 */
salvatoregulfo 8:346c55cb6033 4694 4695
salvatoregulfo 8:346c55cb6033 4695 4696 void arm_correlate_q7(
salvatoregulfo 8:346c55cb6033 4696 4697 q7_t * pSrcA,
salvatoregulfo 8:346c55cb6033 4697 4698 uint32_t srcALen,
salvatoregulfo 8:346c55cb6033 4698 4699 q7_t * pSrcB,
salvatoregulfo 8:346c55cb6033 4699 4700 uint32_t srcBLen,
salvatoregulfo 8:346c55cb6033 4700 4701 q7_t * pDst);
salvatoregulfo 8:346c55cb6033 4701 4702
salvatoregulfo 8:346c55cb6033 4702 4703
salvatoregulfo 8:346c55cb6033 4703 4704 /**
salvatoregulfo 8:346c55cb6033 4704 4705 * @brief Instance structure for the floating-point sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4705 4706 */
salvatoregulfo 8:346c55cb6033 4706 4707 typedef struct
salvatoregulfo 8:346c55cb6033 4707 4708 {
salvatoregulfo 8:346c55cb6033 4708 4709 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4709 4710 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
salvatoregulfo 8:346c55cb6033 4710 4711 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4711 4712 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 4712 4713 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
salvatoregulfo 8:346c55cb6033 4713 4714 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4714 4715 } arm_fir_sparse_instance_f32;
salvatoregulfo 8:346c55cb6033 4715 4716
salvatoregulfo 8:346c55cb6033 4716 4717 /**
salvatoregulfo 8:346c55cb6033 4717 4718 * @brief Instance structure for the Q31 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4718 4719 */
salvatoregulfo 8:346c55cb6033 4719 4720
salvatoregulfo 8:346c55cb6033 4720 4721 typedef struct
salvatoregulfo 8:346c55cb6033 4721 4722 {
salvatoregulfo 8:346c55cb6033 4722 4723 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4723 4724 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
salvatoregulfo 8:346c55cb6033 4724 4725 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4725 4726 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 4726 4727 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
salvatoregulfo 8:346c55cb6033 4727 4728 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4728 4729 } arm_fir_sparse_instance_q31;
salvatoregulfo 8:346c55cb6033 4729 4730
salvatoregulfo 8:346c55cb6033 4730 4731 /**
salvatoregulfo 8:346c55cb6033 4731 4732 * @brief Instance structure for the Q15 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4732 4733 */
salvatoregulfo 8:346c55cb6033 4733 4734
salvatoregulfo 8:346c55cb6033 4734 4735 typedef struct
salvatoregulfo 8:346c55cb6033 4735 4736 {
salvatoregulfo 8:346c55cb6033 4736 4737 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4737 4738 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
salvatoregulfo 8:346c55cb6033 4738 4739 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4739 4740 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 4740 4741 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
salvatoregulfo 8:346c55cb6033 4741 4742 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4742 4743 } arm_fir_sparse_instance_q15;
salvatoregulfo 8:346c55cb6033 4743 4744
salvatoregulfo 8:346c55cb6033 4744 4745 /**
salvatoregulfo 8:346c55cb6033 4745 4746 * @brief Instance structure for the Q7 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4746 4747 */
salvatoregulfo 8:346c55cb6033 4747 4748
salvatoregulfo 8:346c55cb6033 4748 4749 typedef struct
salvatoregulfo 8:346c55cb6033 4749 4750 {
salvatoregulfo 8:346c55cb6033 4750 4751 uint16_t numTaps; /**< number of coefficients in the filter. */
salvatoregulfo 8:346c55cb6033 4751 4752 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
salvatoregulfo 8:346c55cb6033 4752 4753 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
salvatoregulfo 8:346c55cb6033 4753 4754 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
salvatoregulfo 8:346c55cb6033 4754 4755 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
salvatoregulfo 8:346c55cb6033 4755 4756 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
salvatoregulfo 8:346c55cb6033 4756 4757 } arm_fir_sparse_instance_q7;
salvatoregulfo 8:346c55cb6033 4757 4758
salvatoregulfo 8:346c55cb6033 4758 4759 /**
salvatoregulfo 8:346c55cb6033 4759 4760 * @brief Processing function for the floating-point sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4760 4761 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4761 4762 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4762 4763 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 4763 4764 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
salvatoregulfo 8:346c55cb6033 4764 4765 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 4765 4766 * @return none.
salvatoregulfo 8:346c55cb6033 4766 4767 */
salvatoregulfo 8:346c55cb6033 4767 4768
salvatoregulfo 8:346c55cb6033 4768 4769 void arm_fir_sparse_f32(
salvatoregulfo 8:346c55cb6033 4769 4770 arm_fir_sparse_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4770 4771 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4771 4772 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 4772 4773 float32_t * pScratchIn,
salvatoregulfo 8:346c55cb6033 4773 4774 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4774 4775
salvatoregulfo 8:346c55cb6033 4775 4776 /**
salvatoregulfo 8:346c55cb6033 4776 4777 * @brief Initialization function for the floating-point sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4777 4778 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4778 4779 * @param[in] numTaps number of nonzero coefficients in the filter.
salvatoregulfo 8:346c55cb6033 4779 4780 * @param[in] *pCoeffs points to the array of filter coefficients.
salvatoregulfo 8:346c55cb6033 4780 4781 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 4781 4782 * @param[in] *pTapDelay points to the array of offset times.
salvatoregulfo 8:346c55cb6033 4782 4783 * @param[in] maxDelay maximum offset time supported.
salvatoregulfo 8:346c55cb6033 4783 4784 * @param[in] blockSize number of samples that will be processed per block.
salvatoregulfo 8:346c55cb6033 4784 4785 * @return none
salvatoregulfo 8:346c55cb6033 4785 4786 */
salvatoregulfo 8:346c55cb6033 4786 4787
salvatoregulfo 8:346c55cb6033 4787 4788 void arm_fir_sparse_init_f32(
salvatoregulfo 8:346c55cb6033 4788 4789 arm_fir_sparse_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 4789 4790 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4790 4791 float32_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4791 4792 float32_t * pState,
salvatoregulfo 8:346c55cb6033 4792 4793 int32_t * pTapDelay,
salvatoregulfo 8:346c55cb6033 4793 4794 uint16_t maxDelay,
salvatoregulfo 8:346c55cb6033 4794 4795 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4795 4796
salvatoregulfo 8:346c55cb6033 4796 4797 /**
salvatoregulfo 8:346c55cb6033 4797 4798 * @brief Processing function for the Q31 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4798 4799 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4799 4800 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4800 4801 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 4801 4802 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
salvatoregulfo 8:346c55cb6033 4802 4803 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 4803 4804 * @return none.
salvatoregulfo 8:346c55cb6033 4804 4805 */
salvatoregulfo 8:346c55cb6033 4805 4806
salvatoregulfo 8:346c55cb6033 4806 4807 void arm_fir_sparse_q31(
salvatoregulfo 8:346c55cb6033 4807 4808 arm_fir_sparse_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4808 4809 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 4809 4810 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 4810 4811 q31_t * pScratchIn,
salvatoregulfo 8:346c55cb6033 4811 4812 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4812 4813
salvatoregulfo 8:346c55cb6033 4813 4814 /**
salvatoregulfo 8:346c55cb6033 4814 4815 * @brief Initialization function for the Q31 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4815 4816 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4816 4817 * @param[in] numTaps number of nonzero coefficients in the filter.
salvatoregulfo 8:346c55cb6033 4817 4818 * @param[in] *pCoeffs points to the array of filter coefficients.
salvatoregulfo 8:346c55cb6033 4818 4819 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 4819 4820 * @param[in] *pTapDelay points to the array of offset times.
salvatoregulfo 8:346c55cb6033 4820 4821 * @param[in] maxDelay maximum offset time supported.
salvatoregulfo 8:346c55cb6033 4821 4822 * @param[in] blockSize number of samples that will be processed per block.
salvatoregulfo 8:346c55cb6033 4822 4823 * @return none
salvatoregulfo 8:346c55cb6033 4823 4824 */
salvatoregulfo 8:346c55cb6033 4824 4825
salvatoregulfo 8:346c55cb6033 4825 4826 void arm_fir_sparse_init_q31(
salvatoregulfo 8:346c55cb6033 4826 4827 arm_fir_sparse_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 4827 4828 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4828 4829 q31_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4829 4830 q31_t * pState,
salvatoregulfo 8:346c55cb6033 4830 4831 int32_t * pTapDelay,
salvatoregulfo 8:346c55cb6033 4831 4832 uint16_t maxDelay,
salvatoregulfo 8:346c55cb6033 4832 4833 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4833 4834
salvatoregulfo 8:346c55cb6033 4834 4835 /**
salvatoregulfo 8:346c55cb6033 4835 4836 * @brief Processing function for the Q15 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4836 4837 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4837 4838 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4838 4839 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 4839 4840 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
salvatoregulfo 8:346c55cb6033 4840 4841 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
salvatoregulfo 8:346c55cb6033 4841 4842 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 4842 4843 * @return none.
salvatoregulfo 8:346c55cb6033 4843 4844 */
salvatoregulfo 8:346c55cb6033 4844 4845
salvatoregulfo 8:346c55cb6033 4845 4846 void arm_fir_sparse_q15(
salvatoregulfo 8:346c55cb6033 4846 4847 arm_fir_sparse_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4847 4848 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 4848 4849 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 4849 4850 q15_t * pScratchIn,
salvatoregulfo 8:346c55cb6033 4850 4851 q31_t * pScratchOut,
salvatoregulfo 8:346c55cb6033 4851 4852 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4852 4853
salvatoregulfo 8:346c55cb6033 4853 4854
salvatoregulfo 8:346c55cb6033 4854 4855 /**
salvatoregulfo 8:346c55cb6033 4855 4856 * @brief Initialization function for the Q15 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4856 4857 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4857 4858 * @param[in] numTaps number of nonzero coefficients in the filter.
salvatoregulfo 8:346c55cb6033 4858 4859 * @param[in] *pCoeffs points to the array of filter coefficients.
salvatoregulfo 8:346c55cb6033 4859 4860 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 4860 4861 * @param[in] *pTapDelay points to the array of offset times.
salvatoregulfo 8:346c55cb6033 4861 4862 * @param[in] maxDelay maximum offset time supported.
salvatoregulfo 8:346c55cb6033 4862 4863 * @param[in] blockSize number of samples that will be processed per block.
salvatoregulfo 8:346c55cb6033 4863 4864 * @return none
salvatoregulfo 8:346c55cb6033 4864 4865 */
salvatoregulfo 8:346c55cb6033 4865 4866
salvatoregulfo 8:346c55cb6033 4866 4867 void arm_fir_sparse_init_q15(
salvatoregulfo 8:346c55cb6033 4867 4868 arm_fir_sparse_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 4868 4869 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4869 4870 q15_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4870 4871 q15_t * pState,
salvatoregulfo 8:346c55cb6033 4871 4872 int32_t * pTapDelay,
salvatoregulfo 8:346c55cb6033 4872 4873 uint16_t maxDelay,
salvatoregulfo 8:346c55cb6033 4873 4874 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4874 4875
salvatoregulfo 8:346c55cb6033 4875 4876 /**
salvatoregulfo 8:346c55cb6033 4876 4877 * @brief Processing function for the Q7 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4877 4878 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4878 4879 * @param[in] *pSrc points to the block of input data.
salvatoregulfo 8:346c55cb6033 4879 4880 * @param[out] *pDst points to the block of output data
salvatoregulfo 8:346c55cb6033 4880 4881 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
salvatoregulfo 8:346c55cb6033 4881 4882 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
salvatoregulfo 8:346c55cb6033 4882 4883 * @param[in] blockSize number of input samples to process per call.
salvatoregulfo 8:346c55cb6033 4883 4884 * @return none.
salvatoregulfo 8:346c55cb6033 4884 4885 */
salvatoregulfo 8:346c55cb6033 4885 4886
salvatoregulfo 8:346c55cb6033 4886 4887 void arm_fir_sparse_q7(
salvatoregulfo 8:346c55cb6033 4887 4888 arm_fir_sparse_instance_q7 * S,
salvatoregulfo 8:346c55cb6033 4888 4889 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 4889 4890 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 4890 4891 q7_t * pScratchIn,
salvatoregulfo 8:346c55cb6033 4891 4892 q31_t * pScratchOut,
salvatoregulfo 8:346c55cb6033 4892 4893 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4893 4894
salvatoregulfo 8:346c55cb6033 4894 4895 /**
salvatoregulfo 8:346c55cb6033 4895 4896 * @brief Initialization function for the Q7 sparse FIR filter.
salvatoregulfo 8:346c55cb6033 4896 4897 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
salvatoregulfo 8:346c55cb6033 4897 4898 * @param[in] numTaps number of nonzero coefficients in the filter.
salvatoregulfo 8:346c55cb6033 4898 4899 * @param[in] *pCoeffs points to the array of filter coefficients.
salvatoregulfo 8:346c55cb6033 4899 4900 * @param[in] *pState points to the state buffer.
salvatoregulfo 8:346c55cb6033 4900 4901 * @param[in] *pTapDelay points to the array of offset times.
salvatoregulfo 8:346c55cb6033 4901 4902 * @param[in] maxDelay maximum offset time supported.
salvatoregulfo 8:346c55cb6033 4902 4903 * @param[in] blockSize number of samples that will be processed per block.
salvatoregulfo 8:346c55cb6033 4903 4904 * @return none
salvatoregulfo 8:346c55cb6033 4904 4905 */
salvatoregulfo 8:346c55cb6033 4905 4906
salvatoregulfo 8:346c55cb6033 4906 4907 void arm_fir_sparse_init_q7(
salvatoregulfo 8:346c55cb6033 4907 4908 arm_fir_sparse_instance_q7 * S,
salvatoregulfo 8:346c55cb6033 4908 4909 uint16_t numTaps,
salvatoregulfo 8:346c55cb6033 4909 4910 q7_t * pCoeffs,
salvatoregulfo 8:346c55cb6033 4910 4911 q7_t * pState,
salvatoregulfo 8:346c55cb6033 4911 4912 int32_t * pTapDelay,
salvatoregulfo 8:346c55cb6033 4912 4913 uint16_t maxDelay,
salvatoregulfo 8:346c55cb6033 4913 4914 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 4914 4915
salvatoregulfo 8:346c55cb6033 4915 4916
salvatoregulfo 8:346c55cb6033 4916 4917 /*
salvatoregulfo 8:346c55cb6033 4917 4918 * @brief Floating-point sin_cos function.
salvatoregulfo 8:346c55cb6033 4918 4919 * @param[in] theta input value in degrees
salvatoregulfo 8:346c55cb6033 4919 4920 * @param[out] *pSinVal points to the processed sine output.
salvatoregulfo 8:346c55cb6033 4920 4921 * @param[out] *pCosVal points to the processed cos output.
salvatoregulfo 8:346c55cb6033 4921 4922 * @return none.
salvatoregulfo 8:346c55cb6033 4922 4923 */
salvatoregulfo 8:346c55cb6033 4923 4924
salvatoregulfo 8:346c55cb6033 4924 4925 void arm_sin_cos_f32(
salvatoregulfo 8:346c55cb6033 4925 4926 float32_t theta,
salvatoregulfo 8:346c55cb6033 4926 4927 float32_t * pSinVal,
salvatoregulfo 8:346c55cb6033 4927 4928 float32_t * pCcosVal);
salvatoregulfo 8:346c55cb6033 4928 4929
salvatoregulfo 8:346c55cb6033 4929 4930 /*
salvatoregulfo 8:346c55cb6033 4930 4931 * @brief Q31 sin_cos function.
salvatoregulfo 8:346c55cb6033 4931 4932 * @param[in] theta scaled input value in degrees
salvatoregulfo 8:346c55cb6033 4932 4933 * @param[out] *pSinVal points to the processed sine output.
salvatoregulfo 8:346c55cb6033 4933 4934 * @param[out] *pCosVal points to the processed cosine output.
salvatoregulfo 8:346c55cb6033 4934 4935 * @return none.
salvatoregulfo 8:346c55cb6033 4935 4936 */
salvatoregulfo 8:346c55cb6033 4936 4937
salvatoregulfo 8:346c55cb6033 4937 4938 void arm_sin_cos_q31(
salvatoregulfo 8:346c55cb6033 4938 4939 q31_t theta,
salvatoregulfo 8:346c55cb6033 4939 4940 q31_t * pSinVal,
salvatoregulfo 8:346c55cb6033 4940 4941 q31_t * pCosVal);
salvatoregulfo 8:346c55cb6033 4941 4942
salvatoregulfo 8:346c55cb6033 4942 4943
salvatoregulfo 8:346c55cb6033 4943 4944 /**
salvatoregulfo 8:346c55cb6033 4944 4945 * @brief Floating-point complex conjugate.
salvatoregulfo 8:346c55cb6033 4945 4946 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 4946 4947 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 4947 4948 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 4948 4949 * @return none.
salvatoregulfo 8:346c55cb6033 4949 4950 */
salvatoregulfo 8:346c55cb6033 4950 4951
salvatoregulfo 8:346c55cb6033 4951 4952 void arm_cmplx_conj_f32(
salvatoregulfo 8:346c55cb6033 4952 4953 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4953 4954 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 4954 4955 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 4955 4956
salvatoregulfo 8:346c55cb6033 4956 4957 /**
salvatoregulfo 8:346c55cb6033 4957 4958 * @brief Q31 complex conjugate.
salvatoregulfo 8:346c55cb6033 4958 4959 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 4959 4960 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 4960 4961 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 4961 4962 * @return none.
salvatoregulfo 8:346c55cb6033 4962 4963 */
salvatoregulfo 8:346c55cb6033 4963 4964
salvatoregulfo 8:346c55cb6033 4964 4965 void arm_cmplx_conj_q31(
salvatoregulfo 8:346c55cb6033 4965 4966 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 4966 4967 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 4967 4968 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 4968 4969
salvatoregulfo 8:346c55cb6033 4969 4970 /**
salvatoregulfo 8:346c55cb6033 4970 4971 * @brief Q15 complex conjugate.
salvatoregulfo 8:346c55cb6033 4971 4972 * @param[in] *pSrc points to the input vector
salvatoregulfo 8:346c55cb6033 4972 4973 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 4973 4974 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 4974 4975 * @return none.
salvatoregulfo 8:346c55cb6033 4975 4976 */
salvatoregulfo 8:346c55cb6033 4976 4977
salvatoregulfo 8:346c55cb6033 4977 4978 void arm_cmplx_conj_q15(
salvatoregulfo 8:346c55cb6033 4978 4979 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 4979 4980 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 4980 4981 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 4981 4982
salvatoregulfo 8:346c55cb6033 4982 4983
salvatoregulfo 8:346c55cb6033 4983 4984
salvatoregulfo 8:346c55cb6033 4984 4985 /**
salvatoregulfo 8:346c55cb6033 4985 4986 * @brief Floating-point complex magnitude squared
salvatoregulfo 8:346c55cb6033 4986 4987 * @param[in] *pSrc points to the complex input vector
salvatoregulfo 8:346c55cb6033 4987 4988 * @param[out] *pDst points to the real output vector
salvatoregulfo 8:346c55cb6033 4988 4989 * @param[in] numSamples number of complex samples in the input vector
salvatoregulfo 8:346c55cb6033 4989 4990 * @return none.
salvatoregulfo 8:346c55cb6033 4990 4991 */
salvatoregulfo 8:346c55cb6033 4991 4992
salvatoregulfo 8:346c55cb6033 4992 4993 void arm_cmplx_mag_squared_f32(
salvatoregulfo 8:346c55cb6033 4993 4994 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 4994 4995 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 4995 4996 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 4996 4997
salvatoregulfo 8:346c55cb6033 4997 4998 /**
salvatoregulfo 8:346c55cb6033 4998 4999 * @brief Q31 complex magnitude squared
salvatoregulfo 8:346c55cb6033 4999 5000 * @param[in] *pSrc points to the complex input vector
salvatoregulfo 8:346c55cb6033 5000 5001 * @param[out] *pDst points to the real output vector
salvatoregulfo 8:346c55cb6033 5001 5002 * @param[in] numSamples number of complex samples in the input vector
salvatoregulfo 8:346c55cb6033 5002 5003 * @return none.
salvatoregulfo 8:346c55cb6033 5003 5004 */
salvatoregulfo 8:346c55cb6033 5004 5005
salvatoregulfo 8:346c55cb6033 5005 5006 void arm_cmplx_mag_squared_q31(
salvatoregulfo 8:346c55cb6033 5006 5007 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 5007 5008 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 5008 5009 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 5009 5010
salvatoregulfo 8:346c55cb6033 5010 5011 /**
salvatoregulfo 8:346c55cb6033 5011 5012 * @brief Q15 complex magnitude squared
salvatoregulfo 8:346c55cb6033 5012 5013 * @param[in] *pSrc points to the complex input vector
salvatoregulfo 8:346c55cb6033 5013 5014 * @param[out] *pDst points to the real output vector
salvatoregulfo 8:346c55cb6033 5014 5015 * @param[in] numSamples number of complex samples in the input vector
salvatoregulfo 8:346c55cb6033 5015 5016 * @return none.
salvatoregulfo 8:346c55cb6033 5016 5017 */
salvatoregulfo 8:346c55cb6033 5017 5018
salvatoregulfo 8:346c55cb6033 5018 5019 void arm_cmplx_mag_squared_q15(
salvatoregulfo 8:346c55cb6033 5019 5020 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 5020 5021 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 5021 5022 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 5022 5023
salvatoregulfo 8:346c55cb6033 5023 5024
salvatoregulfo 8:346c55cb6033 5024 5025 /**
salvatoregulfo 8:346c55cb6033 5025 5026 * @ingroup groupController
salvatoregulfo 8:346c55cb6033 5026 5027 */
salvatoregulfo 8:346c55cb6033 5027 5028
salvatoregulfo 8:346c55cb6033 5028 5029 /**
salvatoregulfo 8:346c55cb6033 5029 5030 * @defgroup PID PID Motor Control
salvatoregulfo 8:346c55cb6033 5030 5031 *
salvatoregulfo 8:346c55cb6033 5031 5032 * A Proportional Integral Derivative (PID) controller is a generic feedback control
salvatoregulfo 8:346c55cb6033 5032 5033 * loop mechanism widely used in industrial control systems.
salvatoregulfo 8:346c55cb6033 5033 5034 * A PID controller is the most commonly used type of feedback controller.
salvatoregulfo 8:346c55cb6033 5034 5035 *
salvatoregulfo 8:346c55cb6033 5035 5036 * This set of functions implements (PID) controllers
salvatoregulfo 8:346c55cb6033 5036 5037 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
salvatoregulfo 8:346c55cb6033 5037 5038 * of data and each call to the function returns a single processed value.
salvatoregulfo 8:346c55cb6033 5038 5039 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
salvatoregulfo 8:346c55cb6033 5039 5040 * is the input sample value. The functions return the output value.
salvatoregulfo 8:346c55cb6033 5040 5041 *
salvatoregulfo 8:346c55cb6033 5041 5042 * \par Algorithm:
salvatoregulfo 8:346c55cb6033 5042 5043 * <pre>
salvatoregulfo 8:346c55cb6033 5043 5044 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
salvatoregulfo 8:346c55cb6033 5044 5045 * A0 = Kp + Ki + Kd
salvatoregulfo 8:346c55cb6033 5045 5046 * A1 = (-Kp ) - (2 * Kd )
salvatoregulfo 8:346c55cb6033 5046 5047 * A2 = Kd </pre>
salvatoregulfo 8:346c55cb6033 5047 5048 *
salvatoregulfo 8:346c55cb6033 5048 5049 * \par
salvatoregulfo 8:346c55cb6033 5049 5050 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
salvatoregulfo 8:346c55cb6033 5050 5051 *
salvatoregulfo 8:346c55cb6033 5051 5052 * \par
salvatoregulfo 8:346c55cb6033 5052 5053 * \image html PID.gif "Proportional Integral Derivative Controller"
salvatoregulfo 8:346c55cb6033 5053 5054 *
salvatoregulfo 8:346c55cb6033 5054 5055 * \par
salvatoregulfo 8:346c55cb6033 5055 5056 * The PID controller calculates an "error" value as the difference between
salvatoregulfo 8:346c55cb6033 5056 5057 * the measured output and the reference input.
salvatoregulfo 8:346c55cb6033 5057 5058 * The controller attempts to minimize the error by adjusting the process control inputs.
salvatoregulfo 8:346c55cb6033 5058 5059 * The proportional value determines the reaction to the current error,
salvatoregulfo 8:346c55cb6033 5059 5060 * the integral value determines the reaction based on the sum of recent errors,
salvatoregulfo 8:346c55cb6033 5060 5061 * and the derivative value determines the reaction based on the rate at which the error has been changing.
salvatoregulfo 8:346c55cb6033 5061 5062 *
salvatoregulfo 8:346c55cb6033 5062 5063 * \par Instance Structure
salvatoregulfo 8:346c55cb6033 5063 5064 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
salvatoregulfo 8:346c55cb6033 5064 5065 * A separate instance structure must be defined for each PID Controller.
salvatoregulfo 8:346c55cb6033 5065 5066 * There are separate instance structure declarations for each of the 3 supported data types.
salvatoregulfo 8:346c55cb6033 5066 5067 *
salvatoregulfo 8:346c55cb6033 5067 5068 * \par Reset Functions
salvatoregulfo 8:346c55cb6033 5068 5069 * There is also an associated reset function for each data type which clears the state array.
salvatoregulfo 8:346c55cb6033 5069 5070 *
salvatoregulfo 8:346c55cb6033 5070 5071 * \par Initialization Functions
salvatoregulfo 8:346c55cb6033 5071 5072 * There is also an associated initialization function for each data type.
salvatoregulfo 8:346c55cb6033 5072 5073 * The initialization function performs the following operations:
salvatoregulfo 8:346c55cb6033 5073 5074 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
salvatoregulfo 8:346c55cb6033 5074 5075 * - Zeros out the values in the state buffer.
salvatoregulfo 8:346c55cb6033 5075 5076 *
salvatoregulfo 8:346c55cb6033 5076 5077 * \par
salvatoregulfo 8:346c55cb6033 5077 5078 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
salvatoregulfo 8:346c55cb6033 5078 5079 *
salvatoregulfo 8:346c55cb6033 5079 5080 * \par Fixed-Point Behavior
salvatoregulfo 8:346c55cb6033 5080 5081 * Care must be taken when using the fixed-point versions of the PID Controller functions.
salvatoregulfo 8:346c55cb6033 5081 5082 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
salvatoregulfo 8:346c55cb6033 5082 5083 * Refer to the function specific documentation below for usage guidelines.
salvatoregulfo 8:346c55cb6033 5083 5084 */
salvatoregulfo 8:346c55cb6033 5084 5085
salvatoregulfo 8:346c55cb6033 5085 5086 /**
salvatoregulfo 8:346c55cb6033 5086 5087 * @addtogroup PID
salvatoregulfo 8:346c55cb6033 5087 5088 * @{
salvatoregulfo 8:346c55cb6033 5088 5089 */
salvatoregulfo 8:346c55cb6033 5089 5090
salvatoregulfo 8:346c55cb6033 5090 5091 /**
salvatoregulfo 8:346c55cb6033 5091 5092 * @brief Process function for the floating-point PID Control.
salvatoregulfo 8:346c55cb6033 5092 5093 * @param[in,out] *S is an instance of the floating-point PID Control structure
salvatoregulfo 8:346c55cb6033 5093 5094 * @param[in] in input sample to process
salvatoregulfo 8:346c55cb6033 5094 5095 * @return out processed output sample.
salvatoregulfo 8:346c55cb6033 5095 5096 */
salvatoregulfo 8:346c55cb6033 5096 5097
salvatoregulfo 8:346c55cb6033 5097 5098
salvatoregulfo 8:346c55cb6033 5098 5099 static __INLINE float32_t arm_pid_f32(
salvatoregulfo 8:346c55cb6033 5099 5100 arm_pid_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 5100 5101 float32_t in)
salvatoregulfo 8:346c55cb6033 5101 5102 {
salvatoregulfo 8:346c55cb6033 5102 5103 float32_t out;
salvatoregulfo 8:346c55cb6033 5103 5104
salvatoregulfo 8:346c55cb6033 5104 5105 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
salvatoregulfo 8:346c55cb6033 5105 5106 out = (S->A0 * in) +
salvatoregulfo 8:346c55cb6033 5106 5107 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
salvatoregulfo 8:346c55cb6033 5107 5108
salvatoregulfo 8:346c55cb6033 5108 5109 /* Update state */
salvatoregulfo 8:346c55cb6033 5109 5110 S->state[1] = S->state[0];
salvatoregulfo 8:346c55cb6033 5110 5111 S->state[0] = in;
salvatoregulfo 8:346c55cb6033 5111 5112 S->state[2] = out;
salvatoregulfo 8:346c55cb6033 5112 5113
salvatoregulfo 8:346c55cb6033 5113 5114 /* return to application */
salvatoregulfo 8:346c55cb6033 5114 5115 return (out);
salvatoregulfo 8:346c55cb6033 5115 5116
salvatoregulfo 8:346c55cb6033 5116 5117 }
salvatoregulfo 8:346c55cb6033 5117 5118
salvatoregulfo 8:346c55cb6033 5118 5119 /**
salvatoregulfo 8:346c55cb6033 5119 5120 * @brief Process function for the Q31 PID Control.
salvatoregulfo 8:346c55cb6033 5120 5121 * @param[in,out] *S points to an instance of the Q31 PID Control structure
salvatoregulfo 8:346c55cb6033 5121 5122 * @param[in] in input sample to process
salvatoregulfo 8:346c55cb6033 5122 5123 * @return out processed output sample.
salvatoregulfo 8:346c55cb6033 5123 5124 *
salvatoregulfo 8:346c55cb6033 5124 5125 * <b>Scaling and Overflow Behavior:</b>
salvatoregulfo 8:346c55cb6033 5125 5126 * \par
salvatoregulfo 8:346c55cb6033 5126 5127 * The function is implemented using an internal 64-bit accumulator.
salvatoregulfo 8:346c55cb6033 5127 5128 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
salvatoregulfo 8:346c55cb6033 5128 5129 * Thus, if the accumulator result overflows it wraps around rather than clip.
salvatoregulfo 8:346c55cb6033 5129 5130 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
salvatoregulfo 8:346c55cb6033 5130 5131 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
salvatoregulfo 8:346c55cb6033 5131 5132 */
salvatoregulfo 8:346c55cb6033 5132 5133
salvatoregulfo 8:346c55cb6033 5133 5134 static __INLINE q31_t arm_pid_q31(
salvatoregulfo 8:346c55cb6033 5134 5135 arm_pid_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 5135 5136 q31_t in)
salvatoregulfo 8:346c55cb6033 5136 5137 {
salvatoregulfo 8:346c55cb6033 5137 5138 q63_t acc;
salvatoregulfo 8:346c55cb6033 5138 5139 q31_t out;
salvatoregulfo 8:346c55cb6033 5139 5140
salvatoregulfo 8:346c55cb6033 5140 5141 /* acc = A0 * x[n] */
salvatoregulfo 8:346c55cb6033 5141 5142 acc = (q63_t) S->A0 * in;
salvatoregulfo 8:346c55cb6033 5142 5143
salvatoregulfo 8:346c55cb6033 5143 5144 /* acc += A1 * x[n-1] */
salvatoregulfo 8:346c55cb6033 5144 5145 acc += (q63_t) S->A1 * S->state[0];
salvatoregulfo 8:346c55cb6033 5145 5146
salvatoregulfo 8:346c55cb6033 5146 5147 /* acc += A2 * x[n-2] */
salvatoregulfo 8:346c55cb6033 5147 5148 acc += (q63_t) S->A2 * S->state[1];
salvatoregulfo 8:346c55cb6033 5148 5149
salvatoregulfo 8:346c55cb6033 5149 5150 /* convert output to 1.31 format to add y[n-1] */
salvatoregulfo 8:346c55cb6033 5150 5151 out = (q31_t) (acc >> 31u);
salvatoregulfo 8:346c55cb6033 5151 5152
salvatoregulfo 8:346c55cb6033 5152 5153 /* out += y[n-1] */
salvatoregulfo 8:346c55cb6033 5153 5154 out += S->state[2];
salvatoregulfo 8:346c55cb6033 5154 5155
salvatoregulfo 8:346c55cb6033 5155 5156 /* Update state */
salvatoregulfo 8:346c55cb6033 5156 5157 S->state[1] = S->state[0];
salvatoregulfo 8:346c55cb6033 5157 5158 S->state[0] = in;
salvatoregulfo 8:346c55cb6033 5158 5159 S->state[2] = out;
salvatoregulfo 8:346c55cb6033 5159 5160
salvatoregulfo 8:346c55cb6033 5160 5161 /* return to application */
salvatoregulfo 8:346c55cb6033 5161 5162 return (out);
salvatoregulfo 8:346c55cb6033 5162 5163
salvatoregulfo 8:346c55cb6033 5163 5164 }
salvatoregulfo 8:346c55cb6033 5164 5165
salvatoregulfo 8:346c55cb6033 5165 5166 /**
salvatoregulfo 8:346c55cb6033 5166 5167 * @brief Process function for the Q15 PID Control.
salvatoregulfo 8:346c55cb6033 5167 5168 * @param[in,out] *S points to an instance of the Q15 PID Control structure
salvatoregulfo 8:346c55cb6033 5168 5169 * @param[in] in input sample to process
salvatoregulfo 8:346c55cb6033 5169 5170 * @return out processed output sample.
salvatoregulfo 8:346c55cb6033 5170 5171 *
salvatoregulfo 8:346c55cb6033 5171 5172 * <b>Scaling and Overflow Behavior:</b>
salvatoregulfo 8:346c55cb6033 5172 5173 * \par
salvatoregulfo 8:346c55cb6033 5173 5174 * The function is implemented using a 64-bit internal accumulator.
salvatoregulfo 8:346c55cb6033 5174 5175 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
salvatoregulfo 8:346c55cb6033 5175 5176 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
salvatoregulfo 8:346c55cb6033 5176 5177 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
salvatoregulfo 8:346c55cb6033 5177 5178 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
salvatoregulfo 8:346c55cb6033 5178 5179 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
salvatoregulfo 8:346c55cb6033 5179 5180 */
salvatoregulfo 8:346c55cb6033 5180 5181
salvatoregulfo 8:346c55cb6033 5181 5182 static __INLINE q15_t arm_pid_q15(
salvatoregulfo 8:346c55cb6033 5182 5183 arm_pid_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 5183 5184 q15_t in)
salvatoregulfo 8:346c55cb6033 5184 5185 {
salvatoregulfo 8:346c55cb6033 5185 5186 q63_t acc;
salvatoregulfo 8:346c55cb6033 5186 5187 q15_t out;
salvatoregulfo 8:346c55cb6033 5187 5188
salvatoregulfo 8:346c55cb6033 5188 5189 #ifndef ARM_MATH_CM0_FAMILY
salvatoregulfo 8:346c55cb6033 5189 5190 __SIMD32_TYPE *vstate;
salvatoregulfo 8:346c55cb6033 5190 5191
salvatoregulfo 8:346c55cb6033 5191 5192 /* Implementation of PID controller */
salvatoregulfo 8:346c55cb6033 5192 5193
salvatoregulfo 8:346c55cb6033 5193 5194 /* acc = A0 * x[n] */
salvatoregulfo 8:346c55cb6033 5194 5195 acc = (q31_t) __SMUAD(S->A0, in);
salvatoregulfo 8:346c55cb6033 5195 5196
salvatoregulfo 8:346c55cb6033 5196 5197 /* acc += A1 * x[n-1] + A2 * x[n-2] */
salvatoregulfo 8:346c55cb6033 5197 5198 vstate = __SIMD32_CONST(S->state);
salvatoregulfo 8:346c55cb6033 5198 5199 acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
salvatoregulfo 8:346c55cb6033 5199 5200
salvatoregulfo 8:346c55cb6033 5200 5201 #else
salvatoregulfo 8:346c55cb6033 5201 5202 /* acc = A0 * x[n] */
salvatoregulfo 8:346c55cb6033 5202 5203 acc = ((q31_t) S->A0) * in;
salvatoregulfo 8:346c55cb6033 5203 5204
salvatoregulfo 8:346c55cb6033 5204 5205 /* acc += A1 * x[n-1] + A2 * x[n-2] */
salvatoregulfo 8:346c55cb6033 5205 5206 acc += (q31_t) S->A1 * S->state[0];
salvatoregulfo 8:346c55cb6033 5206 5207 acc += (q31_t) S->A2 * S->state[1];
salvatoregulfo 8:346c55cb6033 5207 5208
salvatoregulfo 8:346c55cb6033 5208 5209 #endif
salvatoregulfo 8:346c55cb6033 5209 5210
salvatoregulfo 8:346c55cb6033 5210 5211 /* acc += y[n-1] */
salvatoregulfo 8:346c55cb6033 5211 5212 acc += (q31_t) S->state[2] << 15;
salvatoregulfo 8:346c55cb6033 5212 5213
salvatoregulfo 8:346c55cb6033 5213 5214 /* saturate the output */
salvatoregulfo 8:346c55cb6033 5214 5215 out = (q15_t) (__SSAT((acc >> 15), 16));
salvatoregulfo 8:346c55cb6033 5215 5216
salvatoregulfo 8:346c55cb6033 5216 5217 /* Update state */
salvatoregulfo 8:346c55cb6033 5217 5218 S->state[1] = S->state[0];
salvatoregulfo 8:346c55cb6033 5218 5219 S->state[0] = in;
salvatoregulfo 8:346c55cb6033 5219 5220 S->state[2] = out;
salvatoregulfo 8:346c55cb6033 5220 5221
salvatoregulfo 8:346c55cb6033 5221 5222 /* return to application */
salvatoregulfo 8:346c55cb6033 5222 5223 return (out);
salvatoregulfo 8:346c55cb6033 5223 5224
salvatoregulfo 8:346c55cb6033 5224 5225 }
salvatoregulfo 8:346c55cb6033 5225 5226
salvatoregulfo 8:346c55cb6033 5226 5227 /**
salvatoregulfo 8:346c55cb6033 5227 5228 * @} end of PID group
salvatoregulfo 8:346c55cb6033 5228 5229 */
salvatoregulfo 8:346c55cb6033 5229 5230
salvatoregulfo 8:346c55cb6033 5230 5231
salvatoregulfo 8:346c55cb6033 5231 5232 /**
salvatoregulfo 8:346c55cb6033 5232 5233 * @brief Floating-point matrix inverse.
salvatoregulfo 8:346c55cb6033 5233 5234 * @param[in] *src points to the instance of the input floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 5234 5235 * @param[out] *dst points to the instance of the output floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 5235 5236 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
salvatoregulfo 8:346c55cb6033 5236 5237 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
salvatoregulfo 8:346c55cb6033 5237 5238 */
salvatoregulfo 8:346c55cb6033 5238 5239
salvatoregulfo 8:346c55cb6033 5239 5240 arm_status arm_mat_inverse_f32(
salvatoregulfo 8:346c55cb6033 5240 5241 const arm_matrix_instance_f32 * src,
salvatoregulfo 8:346c55cb6033 5241 5242 arm_matrix_instance_f32 * dst);
salvatoregulfo 8:346c55cb6033 5242 5243
salvatoregulfo 8:346c55cb6033 5243 5244
salvatoregulfo 8:346c55cb6033 5244 5245 /**
salvatoregulfo 8:346c55cb6033 5245 5246 * @brief Floating-point matrix inverse.
salvatoregulfo 8:346c55cb6033 5246 5247 * @param[in] *src points to the instance of the input floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 5247 5248 * @param[out] *dst points to the instance of the output floating-point matrix structure.
salvatoregulfo 8:346c55cb6033 5248 5249 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
salvatoregulfo 8:346c55cb6033 5249 5250 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
salvatoregulfo 8:346c55cb6033 5250 5251 */
salvatoregulfo 8:346c55cb6033 5251 5252
salvatoregulfo 8:346c55cb6033 5252 5253 arm_status arm_mat_inverse_f64(
salvatoregulfo 8:346c55cb6033 5253 5254 const arm_matrix_instance_f64 * src,
salvatoregulfo 8:346c55cb6033 5254 5255 arm_matrix_instance_f64 * dst);
salvatoregulfo 8:346c55cb6033 5255 5256
salvatoregulfo 8:346c55cb6033 5256 5257
salvatoregulfo 8:346c55cb6033 5257 5258
salvatoregulfo 8:346c55cb6033 5258 5259 /**
salvatoregulfo 8:346c55cb6033 5259 5260 * @ingroup groupController
salvatoregulfo 8:346c55cb6033 5260 5261 */
salvatoregulfo 8:346c55cb6033 5261 5262
salvatoregulfo 8:346c55cb6033 5262 5263
salvatoregulfo 8:346c55cb6033 5263 5264 /**
salvatoregulfo 8:346c55cb6033 5264 5265 * @defgroup clarke Vector Clarke Transform
salvatoregulfo 8:346c55cb6033 5265 5266 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
salvatoregulfo 8:346c55cb6033 5266 5267 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
salvatoregulfo 8:346c55cb6033 5267 5268 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
salvatoregulfo 8:346c55cb6033 5268 5269 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
salvatoregulfo 8:346c55cb6033 5269 5270 * \image html clarke.gif Stator current space vector and its components in (a,b).
salvatoregulfo 8:346c55cb6033 5270 5271 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
salvatoregulfo 8:346c55cb6033 5271 5272 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
salvatoregulfo 8:346c55cb6033 5272 5273 *
salvatoregulfo 8:346c55cb6033 5273 5274 * The function operates on a single sample of data and each call to the function returns the processed output.
salvatoregulfo 8:346c55cb6033 5274 5275 * The library provides separate functions for Q31 and floating-point data types.
salvatoregulfo 8:346c55cb6033 5275 5276 * \par Algorithm
salvatoregulfo 8:346c55cb6033 5276 5277 * \image html clarkeFormula.gif
salvatoregulfo 8:346c55cb6033 5277 5278 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
salvatoregulfo 8:346c55cb6033 5278 5279 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
salvatoregulfo 8:346c55cb6033 5279 5280 * \par Fixed-Point Behavior
salvatoregulfo 8:346c55cb6033 5280 5281 * Care must be taken when using the Q31 version of the Clarke transform.
salvatoregulfo 8:346c55cb6033 5281 5282 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
salvatoregulfo 8:346c55cb6033 5282 5283 * Refer to the function specific documentation below for usage guidelines.
salvatoregulfo 8:346c55cb6033 5283 5284 */
salvatoregulfo 8:346c55cb6033 5284 5285
salvatoregulfo 8:346c55cb6033 5285 5286 /**
salvatoregulfo 8:346c55cb6033 5286 5287 * @addtogroup clarke
salvatoregulfo 8:346c55cb6033 5287 5288 * @{
salvatoregulfo 8:346c55cb6033 5288 5289 */
salvatoregulfo 8:346c55cb6033 5289 5290
salvatoregulfo 8:346c55cb6033 5290 5291 /**
salvatoregulfo 8:346c55cb6033 5291 5292 *
salvatoregulfo 8:346c55cb6033 5292 5293 * @brief Floating-point Clarke transform
salvatoregulfo 8:346c55cb6033 5293 5294 * @param[in] Ia input three-phase coordinate <code>a</code>
salvatoregulfo 8:346c55cb6033 5294 5295 * @param[in] Ib input three-phase coordinate <code>b</code>
salvatoregulfo 8:346c55cb6033 5295 5296 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
salvatoregulfo 8:346c55cb6033 5296 5297 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
salvatoregulfo 8:346c55cb6033 5297 5298 * @return none.
salvatoregulfo 8:346c55cb6033 5298 5299 */
salvatoregulfo 8:346c55cb6033 5299 5300
salvatoregulfo 8:346c55cb6033 5300 5301 static __INLINE void arm_clarke_f32(
salvatoregulfo 8:346c55cb6033 5301 5302 float32_t Ia,
salvatoregulfo 8:346c55cb6033 5302 5303 float32_t Ib,
salvatoregulfo 8:346c55cb6033 5303 5304 float32_t * pIalpha,
salvatoregulfo 8:346c55cb6033 5304 5305 float32_t * pIbeta)
salvatoregulfo 8:346c55cb6033 5305 5306 {
salvatoregulfo 8:346c55cb6033 5306 5307 /* Calculate pIalpha using the equation, pIalpha = Ia */
salvatoregulfo 8:346c55cb6033 5307 5308 *pIalpha = Ia;
salvatoregulfo 8:346c55cb6033 5308 5309
salvatoregulfo 8:346c55cb6033 5309 5310 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
salvatoregulfo 8:346c55cb6033 5310 5311 *pIbeta =
salvatoregulfo 8:346c55cb6033 5311 5312 ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
salvatoregulfo 8:346c55cb6033 5312 5313
salvatoregulfo 8:346c55cb6033 5313 5314 }
salvatoregulfo 8:346c55cb6033 5314 5315
salvatoregulfo 8:346c55cb6033 5315 5316 /**
salvatoregulfo 8:346c55cb6033 5316 5317 * @brief Clarke transform for Q31 version
salvatoregulfo 8:346c55cb6033 5317 5318 * @param[in] Ia input three-phase coordinate <code>a</code>
salvatoregulfo 8:346c55cb6033 5318 5319 * @param[in] Ib input three-phase coordinate <code>b</code>
salvatoregulfo 8:346c55cb6033 5319 5320 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
salvatoregulfo 8:346c55cb6033 5320 5321 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
salvatoregulfo 8:346c55cb6033 5321 5322 * @return none.
salvatoregulfo 8:346c55cb6033 5322 5323 *
salvatoregulfo 8:346c55cb6033 5323 5324 * <b>Scaling and Overflow Behavior:</b>
salvatoregulfo 8:346c55cb6033 5324 5325 * \par
salvatoregulfo 8:346c55cb6033 5325 5326 * The function is implemented using an internal 32-bit accumulator.
salvatoregulfo 8:346c55cb6033 5326 5327 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
salvatoregulfo 8:346c55cb6033 5327 5328 * There is saturation on the addition, hence there is no risk of overflow.
salvatoregulfo 8:346c55cb6033 5328 5329 */
salvatoregulfo 8:346c55cb6033 5329 5330
salvatoregulfo 8:346c55cb6033 5330 5331 static __INLINE void arm_clarke_q31(
salvatoregulfo 8:346c55cb6033 5331 5332 q31_t Ia,
salvatoregulfo 8:346c55cb6033 5332 5333 q31_t Ib,
salvatoregulfo 8:346c55cb6033 5333 5334 q31_t * pIalpha,
salvatoregulfo 8:346c55cb6033 5334 5335 q31_t * pIbeta)
salvatoregulfo 8:346c55cb6033 5335 5336 {
salvatoregulfo 8:346c55cb6033 5336 5337 q31_t product1, product2; /* Temporary variables used to store intermediate results */
salvatoregulfo 8:346c55cb6033 5337 5338
salvatoregulfo 8:346c55cb6033 5338 5339 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
salvatoregulfo 8:346c55cb6033 5339 5340 *pIalpha = Ia;
salvatoregulfo 8:346c55cb6033 5340 5341
salvatoregulfo 8:346c55cb6033 5341 5342 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
salvatoregulfo 8:346c55cb6033 5342 5343 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
salvatoregulfo 8:346c55cb6033 5343 5344
salvatoregulfo 8:346c55cb6033 5344 5345 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
salvatoregulfo 8:346c55cb6033 5345 5346 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
salvatoregulfo 8:346c55cb6033 5346 5347
salvatoregulfo 8:346c55cb6033 5347 5348 /* pIbeta is calculated by adding the intermediate products */
salvatoregulfo 8:346c55cb6033 5348 5349 *pIbeta = __QADD(product1, product2);
salvatoregulfo 8:346c55cb6033 5349 5350 }
salvatoregulfo 8:346c55cb6033 5350 5351
salvatoregulfo 8:346c55cb6033 5351 5352 /**
salvatoregulfo 8:346c55cb6033 5352 5353 * @} end of clarke group
salvatoregulfo 8:346c55cb6033 5353 5354 */
salvatoregulfo 8:346c55cb6033 5354 5355
salvatoregulfo 8:346c55cb6033 5355 5356 /**
salvatoregulfo 8:346c55cb6033 5356 5357 * @brief Converts the elements of the Q7 vector to Q31 vector.
salvatoregulfo 8:346c55cb6033 5357 5358 * @param[in] *pSrc input pointer
salvatoregulfo 8:346c55cb6033 5358 5359 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 5359 5360 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 5360 5361 * @return none.
salvatoregulfo 8:346c55cb6033 5361 5362 */
salvatoregulfo 8:346c55cb6033 5362 5363 void arm_q7_to_q31(
salvatoregulfo 8:346c55cb6033 5363 5364 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 5364 5365 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 5365 5366 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 5366 5367
salvatoregulfo 8:346c55cb6033 5367 5368
salvatoregulfo 8:346c55cb6033 5368 5369
salvatoregulfo 8:346c55cb6033 5369 5370
salvatoregulfo 8:346c55cb6033 5370 5371 /**
salvatoregulfo 8:346c55cb6033 5371 5372 * @ingroup groupController
salvatoregulfo 8:346c55cb6033 5372 5373 */
salvatoregulfo 8:346c55cb6033 5373 5374
salvatoregulfo 8:346c55cb6033 5374 5375 /**
salvatoregulfo 8:346c55cb6033 5375 5376 * @defgroup inv_clarke Vector Inverse Clarke Transform
salvatoregulfo 8:346c55cb6033 5376 5377 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
salvatoregulfo 8:346c55cb6033 5377 5378 *
salvatoregulfo 8:346c55cb6033 5378 5379 * The function operates on a single sample of data and each call to the function returns the processed output.
salvatoregulfo 8:346c55cb6033 5379 5380 * The library provides separate functions for Q31 and floating-point data types.
salvatoregulfo 8:346c55cb6033 5380 5381 * \par Algorithm
salvatoregulfo 8:346c55cb6033 5381 5382 * \image html clarkeInvFormula.gif
salvatoregulfo 8:346c55cb6033 5382 5383 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
salvatoregulfo 8:346c55cb6033 5383 5384 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
salvatoregulfo 8:346c55cb6033 5384 5385 * \par Fixed-Point Behavior
salvatoregulfo 8:346c55cb6033 5385 5386 * Care must be taken when using the Q31 version of the Clarke transform.
salvatoregulfo 8:346c55cb6033 5386 5387 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
salvatoregulfo 8:346c55cb6033 5387 5388 * Refer to the function specific documentation below for usage guidelines.
salvatoregulfo 8:346c55cb6033 5388 5389 */
salvatoregulfo 8:346c55cb6033 5389 5390
salvatoregulfo 8:346c55cb6033 5390 5391 /**
salvatoregulfo 8:346c55cb6033 5391 5392 * @addtogroup inv_clarke
salvatoregulfo 8:346c55cb6033 5392 5393 * @{
salvatoregulfo 8:346c55cb6033 5393 5394 */
salvatoregulfo 8:346c55cb6033 5394 5395
salvatoregulfo 8:346c55cb6033 5395 5396 /**
salvatoregulfo 8:346c55cb6033 5396 5397 * @brief Floating-point Inverse Clarke transform
salvatoregulfo 8:346c55cb6033 5397 5398 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
salvatoregulfo 8:346c55cb6033 5398 5399 * @param[in] Ibeta input two-phase orthogonal vector axis beta
salvatoregulfo 8:346c55cb6033 5399 5400 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
salvatoregulfo 8:346c55cb6033 5400 5401 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
salvatoregulfo 8:346c55cb6033 5401 5402 * @return none.
salvatoregulfo 8:346c55cb6033 5402 5403 */
salvatoregulfo 8:346c55cb6033 5403 5404
salvatoregulfo 8:346c55cb6033 5404 5405
salvatoregulfo 8:346c55cb6033 5405 5406 static __INLINE void arm_inv_clarke_f32(
salvatoregulfo 8:346c55cb6033 5406 5407 float32_t Ialpha,
salvatoregulfo 8:346c55cb6033 5407 5408 float32_t Ibeta,
salvatoregulfo 8:346c55cb6033 5408 5409 float32_t * pIa,
salvatoregulfo 8:346c55cb6033 5409 5410 float32_t * pIb)
salvatoregulfo 8:346c55cb6033 5410 5411 {
salvatoregulfo 8:346c55cb6033 5411 5412 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
salvatoregulfo 8:346c55cb6033 5412 5413 *pIa = Ialpha;
salvatoregulfo 8:346c55cb6033 5413 5414
salvatoregulfo 8:346c55cb6033 5414 5415 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
salvatoregulfo 8:346c55cb6033 5415 5416 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
salvatoregulfo 8:346c55cb6033 5416 5417
salvatoregulfo 8:346c55cb6033 5417 5418 }
salvatoregulfo 8:346c55cb6033 5418 5419
salvatoregulfo 8:346c55cb6033 5419 5420 /**
salvatoregulfo 8:346c55cb6033 5420 5421 * @brief Inverse Clarke transform for Q31 version
salvatoregulfo 8:346c55cb6033 5421 5422 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
salvatoregulfo 8:346c55cb6033 5422 5423 * @param[in] Ibeta input two-phase orthogonal vector axis beta
salvatoregulfo 8:346c55cb6033 5423 5424 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
salvatoregulfo 8:346c55cb6033 5424 5425 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
salvatoregulfo 8:346c55cb6033 5425 5426 * @return none.
salvatoregulfo 8:346c55cb6033 5426 5427 *
salvatoregulfo 8:346c55cb6033 5427 5428 * <b>Scaling and Overflow Behavior:</b>
salvatoregulfo 8:346c55cb6033 5428 5429 * \par
salvatoregulfo 8:346c55cb6033 5429 5430 * The function is implemented using an internal 32-bit accumulator.
salvatoregulfo 8:346c55cb6033 5430 5431 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
salvatoregulfo 8:346c55cb6033 5431 5432 * There is saturation on the subtraction, hence there is no risk of overflow.
salvatoregulfo 8:346c55cb6033 5432 5433 */
salvatoregulfo 8:346c55cb6033 5433 5434
salvatoregulfo 8:346c55cb6033 5434 5435 static __INLINE void arm_inv_clarke_q31(
salvatoregulfo 8:346c55cb6033 5435 5436 q31_t Ialpha,
salvatoregulfo 8:346c55cb6033 5436 5437 q31_t Ibeta,
salvatoregulfo 8:346c55cb6033 5437 5438 q31_t * pIa,
salvatoregulfo 8:346c55cb6033 5438 5439 q31_t * pIb)
salvatoregulfo 8:346c55cb6033 5439 5440 {
salvatoregulfo 8:346c55cb6033 5440 5441 q31_t product1, product2; /* Temporary variables used to store intermediate results */
salvatoregulfo 8:346c55cb6033 5441 5442
salvatoregulfo 8:346c55cb6033 5442 5443 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
salvatoregulfo 8:346c55cb6033 5443 5444 *pIa = Ialpha;
salvatoregulfo 8:346c55cb6033 5444 5445
salvatoregulfo 8:346c55cb6033 5445 5446 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
salvatoregulfo 8:346c55cb6033 5446 5447 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
salvatoregulfo 8:346c55cb6033 5447 5448
salvatoregulfo 8:346c55cb6033 5448 5449 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
salvatoregulfo 8:346c55cb6033 5449 5450 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
salvatoregulfo 8:346c55cb6033 5450 5451
salvatoregulfo 8:346c55cb6033 5451 5452 /* pIb is calculated by subtracting the products */
salvatoregulfo 8:346c55cb6033 5452 5453 *pIb = __QSUB(product2, product1);
salvatoregulfo 8:346c55cb6033 5453 5454
salvatoregulfo 8:346c55cb6033 5454 5455 }
salvatoregulfo 8:346c55cb6033 5455 5456
salvatoregulfo 8:346c55cb6033 5456 5457 /**
salvatoregulfo 8:346c55cb6033 5457 5458 * @} end of inv_clarke group
salvatoregulfo 8:346c55cb6033 5458 5459 */
salvatoregulfo 8:346c55cb6033 5459 5460
salvatoregulfo 8:346c55cb6033 5460 5461 /**
salvatoregulfo 8:346c55cb6033 5461 5462 * @brief Converts the elements of the Q7 vector to Q15 vector.
salvatoregulfo 8:346c55cb6033 5462 5463 * @param[in] *pSrc input pointer
salvatoregulfo 8:346c55cb6033 5463 5464 * @param[out] *pDst output pointer
salvatoregulfo 8:346c55cb6033 5464 5465 * @param[in] blockSize number of samples to process
salvatoregulfo 8:346c55cb6033 5465 5466 * @return none.
salvatoregulfo 8:346c55cb6033 5466 5467 */
salvatoregulfo 8:346c55cb6033 5467 5468 void arm_q7_to_q15(
salvatoregulfo 8:346c55cb6033 5468 5469 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 5469 5470 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 5470 5471 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 5471 5472
salvatoregulfo 8:346c55cb6033 5472 5473
salvatoregulfo 8:346c55cb6033 5473 5474
salvatoregulfo 8:346c55cb6033 5474 5475 /**
salvatoregulfo 8:346c55cb6033 5475 5476 * @ingroup groupController
salvatoregulfo 8:346c55cb6033 5476 5477 */
salvatoregulfo 8:346c55cb6033 5477 5478
salvatoregulfo 8:346c55cb6033 5478 5479 /**
salvatoregulfo 8:346c55cb6033 5479 5480 * @defgroup park Vector Park Transform
salvatoregulfo 8:346c55cb6033 5480 5481 *
salvatoregulfo 8:346c55cb6033 5481 5482 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
salvatoregulfo 8:346c55cb6033 5482 5483 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
salvatoregulfo 8:346c55cb6033 5483 5484 * from the stationary to the moving reference frame and control the spatial relationship between
salvatoregulfo 8:346c55cb6033 5484 5485 * the stator vector current and rotor flux vector.
salvatoregulfo 8:346c55cb6033 5485 5486 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
salvatoregulfo 8:346c55cb6033 5486 5487 * current vector and the relationship from the two reference frames:
salvatoregulfo 8:346c55cb6033 5487 5488 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
salvatoregulfo 8:346c55cb6033 5488 5489 *
salvatoregulfo 8:346c55cb6033 5489 5490 * The function operates on a single sample of data and each call to the function returns the processed output.
salvatoregulfo 8:346c55cb6033 5490 5491 * The library provides separate functions for Q31 and floating-point data types.
salvatoregulfo 8:346c55cb6033 5491 5492 * \par Algorithm
salvatoregulfo 8:346c55cb6033 5492 5493 * \image html parkFormula.gif
salvatoregulfo 8:346c55cb6033 5493 5494 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
salvatoregulfo 8:346c55cb6033 5494 5495 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
salvatoregulfo 8:346c55cb6033 5495 5496 * cosine and sine values of theta (rotor flux position).
salvatoregulfo 8:346c55cb6033 5496 5497 * \par Fixed-Point Behavior
salvatoregulfo 8:346c55cb6033 5497 5498 * Care must be taken when using the Q31 version of the Park transform.
salvatoregulfo 8:346c55cb6033 5498 5499 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
salvatoregulfo 8:346c55cb6033 5499 5500 * Refer to the function specific documentation below for usage guidelines.
salvatoregulfo 8:346c55cb6033 5500 5501 */
salvatoregulfo 8:346c55cb6033 5501 5502
salvatoregulfo 8:346c55cb6033 5502 5503 /**
salvatoregulfo 8:346c55cb6033 5503 5504 * @addtogroup park
salvatoregulfo 8:346c55cb6033 5504 5505 * @{
salvatoregulfo 8:346c55cb6033 5505 5506 */
salvatoregulfo 8:346c55cb6033 5506 5507
salvatoregulfo 8:346c55cb6033 5507 5508 /**
salvatoregulfo 8:346c55cb6033 5508 5509 * @brief Floating-point Park transform
salvatoregulfo 8:346c55cb6033 5509 5510 * @param[in] Ialpha input two-phase vector coordinate alpha
salvatoregulfo 8:346c55cb6033 5510 5511 * @param[in] Ibeta input two-phase vector coordinate beta
salvatoregulfo 8:346c55cb6033 5511 5512 * @param[out] *pId points to output rotor reference frame d
salvatoregulfo 8:346c55cb6033 5512 5513 * @param[out] *pIq points to output rotor reference frame q
salvatoregulfo 8:346c55cb6033 5513 5514 * @param[in] sinVal sine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5514 5515 * @param[in] cosVal cosine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5515 5516 * @return none.
salvatoregulfo 8:346c55cb6033 5516 5517 *
salvatoregulfo 8:346c55cb6033 5517 5518 * The function implements the forward Park transform.
salvatoregulfo 8:346c55cb6033 5518 5519 *
salvatoregulfo 8:346c55cb6033 5519 5520 */
salvatoregulfo 8:346c55cb6033 5520 5521
salvatoregulfo 8:346c55cb6033 5521 5522 static __INLINE void arm_park_f32(
salvatoregulfo 8:346c55cb6033 5522 5523 float32_t Ialpha,
salvatoregulfo 8:346c55cb6033 5523 5524 float32_t Ibeta,
salvatoregulfo 8:346c55cb6033 5524 5525 float32_t * pId,
salvatoregulfo 8:346c55cb6033 5525 5526 float32_t * pIq,
salvatoregulfo 8:346c55cb6033 5526 5527 float32_t sinVal,
salvatoregulfo 8:346c55cb6033 5527 5528 float32_t cosVal)
salvatoregulfo 8:346c55cb6033 5528 5529 {
salvatoregulfo 8:346c55cb6033 5529 5530 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
salvatoregulfo 8:346c55cb6033 5530 5531 *pId = Ialpha * cosVal + Ibeta * sinVal;
salvatoregulfo 8:346c55cb6033 5531 5532
salvatoregulfo 8:346c55cb6033 5532 5533 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
salvatoregulfo 8:346c55cb6033 5533 5534 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
salvatoregulfo 8:346c55cb6033 5534 5535
salvatoregulfo 8:346c55cb6033 5535 5536 }
salvatoregulfo 8:346c55cb6033 5536 5537
salvatoregulfo 8:346c55cb6033 5537 5538 /**
salvatoregulfo 8:346c55cb6033 5538 5539 * @brief Park transform for Q31 version
salvatoregulfo 8:346c55cb6033 5539 5540 * @param[in] Ialpha input two-phase vector coordinate alpha
salvatoregulfo 8:346c55cb6033 5540 5541 * @param[in] Ibeta input two-phase vector coordinate beta
salvatoregulfo 8:346c55cb6033 5541 5542 * @param[out] *pId points to output rotor reference frame d
salvatoregulfo 8:346c55cb6033 5542 5543 * @param[out] *pIq points to output rotor reference frame q
salvatoregulfo 8:346c55cb6033 5543 5544 * @param[in] sinVal sine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5544 5545 * @param[in] cosVal cosine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5545 5546 * @return none.
salvatoregulfo 8:346c55cb6033 5546 5547 *
salvatoregulfo 8:346c55cb6033 5547 5548 * <b>Scaling and Overflow Behavior:</b>
salvatoregulfo 8:346c55cb6033 5548 5549 * \par
salvatoregulfo 8:346c55cb6033 5549 5550 * The function is implemented using an internal 32-bit accumulator.
salvatoregulfo 8:346c55cb6033 5550 5551 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
salvatoregulfo 8:346c55cb6033 5551 5552 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
salvatoregulfo 8:346c55cb6033 5552 5553 */
salvatoregulfo 8:346c55cb6033 5553 5554
salvatoregulfo 8:346c55cb6033 5554 5555
salvatoregulfo 8:346c55cb6033 5555 5556 static __INLINE void arm_park_q31(
salvatoregulfo 8:346c55cb6033 5556 5557 q31_t Ialpha,
salvatoregulfo 8:346c55cb6033 5557 5558 q31_t Ibeta,
salvatoregulfo 8:346c55cb6033 5558 5559 q31_t * pId,
salvatoregulfo 8:346c55cb6033 5559 5560 q31_t * pIq,
salvatoregulfo 8:346c55cb6033 5560 5561 q31_t sinVal,
salvatoregulfo 8:346c55cb6033 5561 5562 q31_t cosVal)
salvatoregulfo 8:346c55cb6033 5562 5563 {
salvatoregulfo 8:346c55cb6033 5563 5564 q31_t product1, product2; /* Temporary variables used to store intermediate results */
salvatoregulfo 8:346c55cb6033 5564 5565 q31_t product3, product4; /* Temporary variables used to store intermediate results */
salvatoregulfo 8:346c55cb6033 5565 5566
salvatoregulfo 8:346c55cb6033 5566 5567 /* Intermediate product is calculated by (Ialpha * cosVal) */
salvatoregulfo 8:346c55cb6033 5567 5568 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5568 5569
salvatoregulfo 8:346c55cb6033 5569 5570 /* Intermediate product is calculated by (Ibeta * sinVal) */
salvatoregulfo 8:346c55cb6033 5570 5571 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5571 5572
salvatoregulfo 8:346c55cb6033 5572 5573
salvatoregulfo 8:346c55cb6033 5573 5574 /* Intermediate product is calculated by (Ialpha * sinVal) */
salvatoregulfo 8:346c55cb6033 5574 5575 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5575 5576
salvatoregulfo 8:346c55cb6033 5576 5577 /* Intermediate product is calculated by (Ibeta * cosVal) */
salvatoregulfo 8:346c55cb6033 5577 5578 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5578 5579
salvatoregulfo 8:346c55cb6033 5579 5580 /* Calculate pId by adding the two intermediate products 1 and 2 */
salvatoregulfo 8:346c55cb6033 5580 5581 *pId = __QADD(product1, product2);
salvatoregulfo 8:346c55cb6033 5581 5582
salvatoregulfo 8:346c55cb6033 5582 5583 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
salvatoregulfo 8:346c55cb6033 5583 5584 *pIq = __QSUB(product4, product3);
salvatoregulfo 8:346c55cb6033 5584 5585 }
salvatoregulfo 8:346c55cb6033 5585 5586
salvatoregulfo 8:346c55cb6033 5586 5587 /**
salvatoregulfo 8:346c55cb6033 5587 5588 * @} end of park group
salvatoregulfo 8:346c55cb6033 5588 5589 */
salvatoregulfo 8:346c55cb6033 5589 5590
salvatoregulfo 8:346c55cb6033 5590 5591 /**
salvatoregulfo 8:346c55cb6033 5591 5592 * @brief Converts the elements of the Q7 vector to floating-point vector.
salvatoregulfo 8:346c55cb6033 5592 5593 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 5593 5594 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 5594 5595 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 5595 5596 * @return none.
salvatoregulfo 8:346c55cb6033 5596 5597 */
salvatoregulfo 8:346c55cb6033 5597 5598 void arm_q7_to_float(
salvatoregulfo 8:346c55cb6033 5598 5599 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 5599 5600 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 5600 5601 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 5601 5602
salvatoregulfo 8:346c55cb6033 5602 5603
salvatoregulfo 8:346c55cb6033 5603 5604 /**
salvatoregulfo 8:346c55cb6033 5604 5605 * @ingroup groupController
salvatoregulfo 8:346c55cb6033 5605 5606 */
salvatoregulfo 8:346c55cb6033 5606 5607
salvatoregulfo 8:346c55cb6033 5607 5608 /**
salvatoregulfo 8:346c55cb6033 5608 5609 * @defgroup inv_park Vector Inverse Park transform
salvatoregulfo 8:346c55cb6033 5609 5610 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
salvatoregulfo 8:346c55cb6033 5610 5611 *
salvatoregulfo 8:346c55cb6033 5611 5612 * The function operates on a single sample of data and each call to the function returns the processed output.
salvatoregulfo 8:346c55cb6033 5612 5613 * The library provides separate functions for Q31 and floating-point data types.
salvatoregulfo 8:346c55cb6033 5613 5614 * \par Algorithm
salvatoregulfo 8:346c55cb6033 5614 5615 * \image html parkInvFormula.gif
salvatoregulfo 8:346c55cb6033 5615 5616 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
salvatoregulfo 8:346c55cb6033 5616 5617 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
salvatoregulfo 8:346c55cb6033 5617 5618 * cosine and sine values of theta (rotor flux position).
salvatoregulfo 8:346c55cb6033 5618 5619 * \par Fixed-Point Behavior
salvatoregulfo 8:346c55cb6033 5619 5620 * Care must be taken when using the Q31 version of the Park transform.
salvatoregulfo 8:346c55cb6033 5620 5621 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
salvatoregulfo 8:346c55cb6033 5621 5622 * Refer to the function specific documentation below for usage guidelines.
salvatoregulfo 8:346c55cb6033 5622 5623 */
salvatoregulfo 8:346c55cb6033 5623 5624
salvatoregulfo 8:346c55cb6033 5624 5625 /**
salvatoregulfo 8:346c55cb6033 5625 5626 * @addtogroup inv_park
salvatoregulfo 8:346c55cb6033 5626 5627 * @{
salvatoregulfo 8:346c55cb6033 5627 5628 */
salvatoregulfo 8:346c55cb6033 5628 5629
salvatoregulfo 8:346c55cb6033 5629 5630 /**
salvatoregulfo 8:346c55cb6033 5630 5631 * @brief Floating-point Inverse Park transform
salvatoregulfo 8:346c55cb6033 5631 5632 * @param[in] Id input coordinate of rotor reference frame d
salvatoregulfo 8:346c55cb6033 5632 5633 * @param[in] Iq input coordinate of rotor reference frame q
salvatoregulfo 8:346c55cb6033 5633 5634 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
salvatoregulfo 8:346c55cb6033 5634 5635 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
salvatoregulfo 8:346c55cb6033 5635 5636 * @param[in] sinVal sine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5636 5637 * @param[in] cosVal cosine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5637 5638 * @return none.
salvatoregulfo 8:346c55cb6033 5638 5639 */
salvatoregulfo 8:346c55cb6033 5639 5640
salvatoregulfo 8:346c55cb6033 5640 5641 static __INLINE void arm_inv_park_f32(
salvatoregulfo 8:346c55cb6033 5641 5642 float32_t Id,
salvatoregulfo 8:346c55cb6033 5642 5643 float32_t Iq,
salvatoregulfo 8:346c55cb6033 5643 5644 float32_t * pIalpha,
salvatoregulfo 8:346c55cb6033 5644 5645 float32_t * pIbeta,
salvatoregulfo 8:346c55cb6033 5645 5646 float32_t sinVal,
salvatoregulfo 8:346c55cb6033 5646 5647 float32_t cosVal)
salvatoregulfo 8:346c55cb6033 5647 5648 {
salvatoregulfo 8:346c55cb6033 5648 5649 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
salvatoregulfo 8:346c55cb6033 5649 5650 *pIalpha = Id * cosVal - Iq * sinVal;
salvatoregulfo 8:346c55cb6033 5650 5651
salvatoregulfo 8:346c55cb6033 5651 5652 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
salvatoregulfo 8:346c55cb6033 5652 5653 *pIbeta = Id * sinVal + Iq * cosVal;
salvatoregulfo 8:346c55cb6033 5653 5654
salvatoregulfo 8:346c55cb6033 5654 5655 }
salvatoregulfo 8:346c55cb6033 5655 5656
salvatoregulfo 8:346c55cb6033 5656 5657
salvatoregulfo 8:346c55cb6033 5657 5658 /**
salvatoregulfo 8:346c55cb6033 5658 5659 * @brief Inverse Park transform for Q31 version
salvatoregulfo 8:346c55cb6033 5659 5660 * @param[in] Id input coordinate of rotor reference frame d
salvatoregulfo 8:346c55cb6033 5660 5661 * @param[in] Iq input coordinate of rotor reference frame q
salvatoregulfo 8:346c55cb6033 5661 5662 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
salvatoregulfo 8:346c55cb6033 5662 5663 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
salvatoregulfo 8:346c55cb6033 5663 5664 * @param[in] sinVal sine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5664 5665 * @param[in] cosVal cosine value of rotation angle theta
salvatoregulfo 8:346c55cb6033 5665 5666 * @return none.
salvatoregulfo 8:346c55cb6033 5666 5667 *
salvatoregulfo 8:346c55cb6033 5667 5668 * <b>Scaling and Overflow Behavior:</b>
salvatoregulfo 8:346c55cb6033 5668 5669 * \par
salvatoregulfo 8:346c55cb6033 5669 5670 * The function is implemented using an internal 32-bit accumulator.
salvatoregulfo 8:346c55cb6033 5670 5671 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
salvatoregulfo 8:346c55cb6033 5671 5672 * There is saturation on the addition, hence there is no risk of overflow.
salvatoregulfo 8:346c55cb6033 5672 5673 */
salvatoregulfo 8:346c55cb6033 5673 5674
salvatoregulfo 8:346c55cb6033 5674 5675
salvatoregulfo 8:346c55cb6033 5675 5676 static __INLINE void arm_inv_park_q31(
salvatoregulfo 8:346c55cb6033 5676 5677 q31_t Id,
salvatoregulfo 8:346c55cb6033 5677 5678 q31_t Iq,
salvatoregulfo 8:346c55cb6033 5678 5679 q31_t * pIalpha,
salvatoregulfo 8:346c55cb6033 5679 5680 q31_t * pIbeta,
salvatoregulfo 8:346c55cb6033 5680 5681 q31_t sinVal,
salvatoregulfo 8:346c55cb6033 5681 5682 q31_t cosVal)
salvatoregulfo 8:346c55cb6033 5682 5683 {
salvatoregulfo 8:346c55cb6033 5683 5684 q31_t product1, product2; /* Temporary variables used to store intermediate results */
salvatoregulfo 8:346c55cb6033 5684 5685 q31_t product3, product4; /* Temporary variables used to store intermediate results */
salvatoregulfo 8:346c55cb6033 5685 5686
salvatoregulfo 8:346c55cb6033 5686 5687 /* Intermediate product is calculated by (Id * cosVal) */
salvatoregulfo 8:346c55cb6033 5687 5688 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5688 5689
salvatoregulfo 8:346c55cb6033 5689 5690 /* Intermediate product is calculated by (Iq * sinVal) */
salvatoregulfo 8:346c55cb6033 5690 5691 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5691 5692
salvatoregulfo 8:346c55cb6033 5692 5693
salvatoregulfo 8:346c55cb6033 5693 5694 /* Intermediate product is calculated by (Id * sinVal) */
salvatoregulfo 8:346c55cb6033 5694 5695 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5695 5696
salvatoregulfo 8:346c55cb6033 5696 5697 /* Intermediate product is calculated by (Iq * cosVal) */
salvatoregulfo 8:346c55cb6033 5697 5698 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
salvatoregulfo 8:346c55cb6033 5698 5699
salvatoregulfo 8:346c55cb6033 5699 5700 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
salvatoregulfo 8:346c55cb6033 5700 5701 *pIalpha = __QSUB(product1, product2);
salvatoregulfo 8:346c55cb6033 5701 5702
salvatoregulfo 8:346c55cb6033 5702 5703 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
salvatoregulfo 8:346c55cb6033 5703 5704 *pIbeta = __QADD(product4, product3);
salvatoregulfo 8:346c55cb6033 5704 5705
salvatoregulfo 8:346c55cb6033 5705 5706 }
salvatoregulfo 8:346c55cb6033 5706 5707
salvatoregulfo 8:346c55cb6033 5707 5708 /**
salvatoregulfo 8:346c55cb6033 5708 5709 * @} end of Inverse park group
salvatoregulfo 8:346c55cb6033 5709 5710 */
salvatoregulfo 8:346c55cb6033 5710 5711
salvatoregulfo 8:346c55cb6033 5711 5712
salvatoregulfo 8:346c55cb6033 5712 5713 /**
salvatoregulfo 8:346c55cb6033 5713 5714 * @brief Converts the elements of the Q31 vector to floating-point vector.
salvatoregulfo 8:346c55cb6033 5714 5715 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 5715 5716 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 5716 5717 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 5717 5718 * @return none.
salvatoregulfo 8:346c55cb6033 5718 5719 */
salvatoregulfo 8:346c55cb6033 5719 5720 void arm_q31_to_float(
salvatoregulfo 8:346c55cb6033 5720 5721 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 5721 5722 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 5722 5723 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 5723 5724
salvatoregulfo 8:346c55cb6033 5724 5725 /**
salvatoregulfo 8:346c55cb6033 5725 5726 * @ingroup groupInterpolation
salvatoregulfo 8:346c55cb6033 5726 5727 */
salvatoregulfo 8:346c55cb6033 5727 5728
salvatoregulfo 8:346c55cb6033 5728 5729 /**
salvatoregulfo 8:346c55cb6033 5729 5730 * @defgroup LinearInterpolate Linear Interpolation
salvatoregulfo 8:346c55cb6033 5730 5731 *
salvatoregulfo 8:346c55cb6033 5731 5732 * Linear interpolation is a method of curve fitting using linear polynomials.
salvatoregulfo 8:346c55cb6033 5732 5733 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
salvatoregulfo 8:346c55cb6033 5733 5734 *
salvatoregulfo 8:346c55cb6033 5734 5735 * \par
salvatoregulfo 8:346c55cb6033 5735 5736 * \image html LinearInterp.gif "Linear interpolation"
salvatoregulfo 8:346c55cb6033 5736 5737 *
salvatoregulfo 8:346c55cb6033 5737 5738 * \par
salvatoregulfo 8:346c55cb6033 5738 5739 * A Linear Interpolate function calculates an output value(y), for the input(x)
salvatoregulfo 8:346c55cb6033 5739 5740 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
salvatoregulfo 8:346c55cb6033 5740 5741 *
salvatoregulfo 8:346c55cb6033 5741 5742 * \par Algorithm:
salvatoregulfo 8:346c55cb6033 5742 5743 * <pre>
salvatoregulfo 8:346c55cb6033 5743 5744 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
salvatoregulfo 8:346c55cb6033 5744 5745 * where x0, x1 are nearest values of input x
salvatoregulfo 8:346c55cb6033 5745 5746 * y0, y1 are nearest values to output y
salvatoregulfo 8:346c55cb6033 5746 5747 * </pre>
salvatoregulfo 8:346c55cb6033 5747 5748 *
salvatoregulfo 8:346c55cb6033 5748 5749 * \par
salvatoregulfo 8:346c55cb6033 5749 5750 * This set of functions implements Linear interpolation process
salvatoregulfo 8:346c55cb6033 5750 5751 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
salvatoregulfo 8:346c55cb6033 5751 5752 * sample of data and each call to the function returns a single processed value.
salvatoregulfo 8:346c55cb6033 5752 5753 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
salvatoregulfo 8:346c55cb6033 5753 5754 * <code>x</code> is the input sample value. The functions returns the output value.
salvatoregulfo 8:346c55cb6033 5754 5755 *
salvatoregulfo 8:346c55cb6033 5755 5756 * \par
salvatoregulfo 8:346c55cb6033 5756 5757 * if x is outside of the table boundary, Linear interpolation returns first value of the table
salvatoregulfo 8:346c55cb6033 5757 5758 * if x is below input range and returns last value of table if x is above range.
salvatoregulfo 8:346c55cb6033 5758 5759 */
salvatoregulfo 8:346c55cb6033 5759 5760
salvatoregulfo 8:346c55cb6033 5760 5761 /**
salvatoregulfo 8:346c55cb6033 5761 5762 * @addtogroup LinearInterpolate
salvatoregulfo 8:346c55cb6033 5762 5763 * @{
salvatoregulfo 8:346c55cb6033 5763 5764 */
salvatoregulfo 8:346c55cb6033 5764 5765
salvatoregulfo 8:346c55cb6033 5765 5766 /**
salvatoregulfo 8:346c55cb6033 5766 5767 * @brief Process function for the floating-point Linear Interpolation Function.
salvatoregulfo 8:346c55cb6033 5767 5768 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
salvatoregulfo 8:346c55cb6033 5768 5769 * @param[in] x input sample to process
salvatoregulfo 8:346c55cb6033 5769 5770 * @return y processed output sample.
salvatoregulfo 8:346c55cb6033 5770 5771 *
salvatoregulfo 8:346c55cb6033 5771 5772 */
salvatoregulfo 8:346c55cb6033 5772 5773
salvatoregulfo 8:346c55cb6033 5773 5774 static __INLINE float32_t arm_linear_interp_f32(
salvatoregulfo 8:346c55cb6033 5774 5775 arm_linear_interp_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 5775 5776 float32_t x)
salvatoregulfo 8:346c55cb6033 5776 5777 {
salvatoregulfo 8:346c55cb6033 5777 5778
salvatoregulfo 8:346c55cb6033 5778 5779 float32_t y;
salvatoregulfo 8:346c55cb6033 5779 5780 float32_t x0, x1; /* Nearest input values */
salvatoregulfo 8:346c55cb6033 5780 5781 float32_t y0, y1; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 5781 5782 float32_t xSpacing = S->xSpacing; /* spacing between input values */
salvatoregulfo 8:346c55cb6033 5782 5783 int32_t i; /* Index variable */
salvatoregulfo 8:346c55cb6033 5783 5784 float32_t *pYData = S->pYData; /* pointer to output table */
salvatoregulfo 8:346c55cb6033 5784 5785
salvatoregulfo 8:346c55cb6033 5785 5786 /* Calculation of index */
salvatoregulfo 8:346c55cb6033 5786 5787 i = (int32_t) ((x - S->x1) / xSpacing);
salvatoregulfo 8:346c55cb6033 5787 5788
salvatoregulfo 8:346c55cb6033 5788 5789 if(i < 0)
salvatoregulfo 8:346c55cb6033 5789 5790 {
salvatoregulfo 8:346c55cb6033 5790 5791 /* Iniatilize output for below specified range as least output value of table */
salvatoregulfo 8:346c55cb6033 5791 5792 y = pYData[0];
salvatoregulfo 8:346c55cb6033 5792 5793 }
salvatoregulfo 8:346c55cb6033 5793 5794 else if((uint32_t)i >= S->nValues)
salvatoregulfo 8:346c55cb6033 5794 5795 {
salvatoregulfo 8:346c55cb6033 5795 5796 /* Iniatilize output for above specified range as last output value of table */
salvatoregulfo 8:346c55cb6033 5796 5797 y = pYData[S->nValues - 1];
salvatoregulfo 8:346c55cb6033 5797 5798 }
salvatoregulfo 8:346c55cb6033 5798 5799 else
salvatoregulfo 8:346c55cb6033 5799 5800 {
salvatoregulfo 8:346c55cb6033 5800 5801 /* Calculation of nearest input values */
salvatoregulfo 8:346c55cb6033 5801 5802 x0 = S->x1 + i * xSpacing;
salvatoregulfo 8:346c55cb6033 5802 5803 x1 = S->x1 + (i + 1) * xSpacing;
salvatoregulfo 8:346c55cb6033 5803 5804
salvatoregulfo 8:346c55cb6033 5804 5805 /* Read of nearest output values */
salvatoregulfo 8:346c55cb6033 5805 5806 y0 = pYData[i];
salvatoregulfo 8:346c55cb6033 5806 5807 y1 = pYData[i + 1];
salvatoregulfo 8:346c55cb6033 5807 5808
salvatoregulfo 8:346c55cb6033 5808 5809 /* Calculation of output */
salvatoregulfo 8:346c55cb6033 5809 5810 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
salvatoregulfo 8:346c55cb6033 5810 5811
salvatoregulfo 8:346c55cb6033 5811 5812 }
salvatoregulfo 8:346c55cb6033 5812 5813
salvatoregulfo 8:346c55cb6033 5813 5814 /* returns output value */
salvatoregulfo 8:346c55cb6033 5814 5815 return (y);
salvatoregulfo 8:346c55cb6033 5815 5816 }
salvatoregulfo 8:346c55cb6033 5816 5817
salvatoregulfo 8:346c55cb6033 5817 5818 /**
salvatoregulfo 8:346c55cb6033 5818 5819 *
salvatoregulfo 8:346c55cb6033 5819 5820 * @brief Process function for the Q31 Linear Interpolation Function.
salvatoregulfo 8:346c55cb6033 5820 5821 * @param[in] *pYData pointer to Q31 Linear Interpolation table
salvatoregulfo 8:346c55cb6033 5821 5822 * @param[in] x input sample to process
salvatoregulfo 8:346c55cb6033 5822 5823 * @param[in] nValues number of table values
salvatoregulfo 8:346c55cb6033 5823 5824 * @return y processed output sample.
salvatoregulfo 8:346c55cb6033 5824 5825 *
salvatoregulfo 8:346c55cb6033 5825 5826 * \par
salvatoregulfo 8:346c55cb6033 5826 5827 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
salvatoregulfo 8:346c55cb6033 5827 5828 * This function can support maximum of table size 2^12.
salvatoregulfo 8:346c55cb6033 5828 5829 *
salvatoregulfo 8:346c55cb6033 5829 5830 */
salvatoregulfo 8:346c55cb6033 5830 5831
salvatoregulfo 8:346c55cb6033 5831 5832
salvatoregulfo 8:346c55cb6033 5832 5833 static __INLINE q31_t arm_linear_interp_q31(
salvatoregulfo 8:346c55cb6033 5833 5834 q31_t * pYData,
salvatoregulfo 8:346c55cb6033 5834 5835 q31_t x,
salvatoregulfo 8:346c55cb6033 5835 5836 uint32_t nValues)
salvatoregulfo 8:346c55cb6033 5836 5837 {
salvatoregulfo 8:346c55cb6033 5837 5838 q31_t y; /* output */
salvatoregulfo 8:346c55cb6033 5838 5839 q31_t y0, y1; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 5839 5840 q31_t fract; /* fractional part */
salvatoregulfo 8:346c55cb6033 5840 5841 int32_t index; /* Index to read nearest output values */
salvatoregulfo 8:346c55cb6033 5841 5842
salvatoregulfo 8:346c55cb6033 5842 5843 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 5843 5844 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 5844 5845 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 5845 5846 index = ((x & 0xFFF00000) >> 20);
salvatoregulfo 8:346c55cb6033 5846 5847
salvatoregulfo 8:346c55cb6033 5847 5848 if(index >= (int32_t)(nValues - 1))
salvatoregulfo 8:346c55cb6033 5848 5849 {
salvatoregulfo 8:346c55cb6033 5849 5850 return (pYData[nValues - 1]);
salvatoregulfo 8:346c55cb6033 5850 5851 }
salvatoregulfo 8:346c55cb6033 5851 5852 else if(index < 0)
salvatoregulfo 8:346c55cb6033 5852 5853 {
salvatoregulfo 8:346c55cb6033 5853 5854 return (pYData[0]);
salvatoregulfo 8:346c55cb6033 5854 5855 }
salvatoregulfo 8:346c55cb6033 5855 5856 else
salvatoregulfo 8:346c55cb6033 5856 5857 {
salvatoregulfo 8:346c55cb6033 5857 5858
salvatoregulfo 8:346c55cb6033 5858 5859 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 5859 5860 /* shift left by 11 to keep fract in 1.31 format */
salvatoregulfo 8:346c55cb6033 5860 5861 fract = (x & 0x000FFFFF) << 11;
salvatoregulfo 8:346c55cb6033 5861 5862
salvatoregulfo 8:346c55cb6033 5862 5863 /* Read two nearest output values from the index in 1.31(q31) format */
salvatoregulfo 8:346c55cb6033 5863 5864 y0 = pYData[index];
salvatoregulfo 8:346c55cb6033 5864 5865 y1 = pYData[index + 1u];
salvatoregulfo 8:346c55cb6033 5865 5866
salvatoregulfo 8:346c55cb6033 5866 5867 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
salvatoregulfo 8:346c55cb6033 5867 5868 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
salvatoregulfo 8:346c55cb6033 5868 5869
salvatoregulfo 8:346c55cb6033 5869 5870 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
salvatoregulfo 8:346c55cb6033 5870 5871 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
salvatoregulfo 8:346c55cb6033 5871 5872
salvatoregulfo 8:346c55cb6033 5872 5873 /* Convert y to 1.31 format */
salvatoregulfo 8:346c55cb6033 5873 5874 return (y << 1u);
salvatoregulfo 8:346c55cb6033 5874 5875
salvatoregulfo 8:346c55cb6033 5875 5876 }
salvatoregulfo 8:346c55cb6033 5876 5877
salvatoregulfo 8:346c55cb6033 5877 5878 }
salvatoregulfo 8:346c55cb6033 5878 5879
salvatoregulfo 8:346c55cb6033 5879 5880 /**
salvatoregulfo 8:346c55cb6033 5880 5881 *
salvatoregulfo 8:346c55cb6033 5881 5882 * @brief Process function for the Q15 Linear Interpolation Function.
salvatoregulfo 8:346c55cb6033 5882 5883 * @param[in] *pYData pointer to Q15 Linear Interpolation table
salvatoregulfo 8:346c55cb6033 5883 5884 * @param[in] x input sample to process
salvatoregulfo 8:346c55cb6033 5884 5885 * @param[in] nValues number of table values
salvatoregulfo 8:346c55cb6033 5885 5886 * @return y processed output sample.
salvatoregulfo 8:346c55cb6033 5886 5887 *
salvatoregulfo 8:346c55cb6033 5887 5888 * \par
salvatoregulfo 8:346c55cb6033 5888 5889 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
salvatoregulfo 8:346c55cb6033 5889 5890 * This function can support maximum of table size 2^12.
salvatoregulfo 8:346c55cb6033 5890 5891 *
salvatoregulfo 8:346c55cb6033 5891 5892 */
salvatoregulfo 8:346c55cb6033 5892 5893
salvatoregulfo 8:346c55cb6033 5893 5894
salvatoregulfo 8:346c55cb6033 5894 5895 static __INLINE q15_t arm_linear_interp_q15(
salvatoregulfo 8:346c55cb6033 5895 5896 q15_t * pYData,
salvatoregulfo 8:346c55cb6033 5896 5897 q31_t x,
salvatoregulfo 8:346c55cb6033 5897 5898 uint32_t nValues)
salvatoregulfo 8:346c55cb6033 5898 5899 {
salvatoregulfo 8:346c55cb6033 5899 5900 q63_t y; /* output */
salvatoregulfo 8:346c55cb6033 5900 5901 q15_t y0, y1; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 5901 5902 q31_t fract; /* fractional part */
salvatoregulfo 8:346c55cb6033 5902 5903 int32_t index; /* Index to read nearest output values */
salvatoregulfo 8:346c55cb6033 5903 5904
salvatoregulfo 8:346c55cb6033 5904 5905 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 5905 5906 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 5906 5907 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 5907 5908 index = ((x & 0xFFF00000) >> 20u);
salvatoregulfo 8:346c55cb6033 5908 5909
salvatoregulfo 8:346c55cb6033 5909 5910 if(index >= (int32_t)(nValues - 1))
salvatoregulfo 8:346c55cb6033 5910 5911 {
salvatoregulfo 8:346c55cb6033 5911 5912 return (pYData[nValues - 1]);
salvatoregulfo 8:346c55cb6033 5912 5913 }
salvatoregulfo 8:346c55cb6033 5913 5914 else if(index < 0)
salvatoregulfo 8:346c55cb6033 5914 5915 {
salvatoregulfo 8:346c55cb6033 5915 5916 return (pYData[0]);
salvatoregulfo 8:346c55cb6033 5916 5917 }
salvatoregulfo 8:346c55cb6033 5917 5918 else
salvatoregulfo 8:346c55cb6033 5918 5919 {
salvatoregulfo 8:346c55cb6033 5919 5920 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 5920 5921 /* fract is in 12.20 format */
salvatoregulfo 8:346c55cb6033 5921 5922 fract = (x & 0x000FFFFF);
salvatoregulfo 8:346c55cb6033 5922 5923
salvatoregulfo 8:346c55cb6033 5923 5924 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 5924 5925 y0 = pYData[index];
salvatoregulfo 8:346c55cb6033 5925 5926 y1 = pYData[index + 1u];
salvatoregulfo 8:346c55cb6033 5926 5927
salvatoregulfo 8:346c55cb6033 5927 5928 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
salvatoregulfo 8:346c55cb6033 5928 5929 y = ((q63_t) y0 * (0xFFFFF - fract));
salvatoregulfo 8:346c55cb6033 5929 5930
salvatoregulfo 8:346c55cb6033 5930 5931 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
salvatoregulfo 8:346c55cb6033 5931 5932 y += ((q63_t) y1 * (fract));
salvatoregulfo 8:346c55cb6033 5932 5933
salvatoregulfo 8:346c55cb6033 5933 5934 /* convert y to 1.15 format */
salvatoregulfo 8:346c55cb6033 5934 5935 return (y >> 20);
salvatoregulfo 8:346c55cb6033 5935 5936 }
salvatoregulfo 8:346c55cb6033 5936 5937
salvatoregulfo 8:346c55cb6033 5937 5938
salvatoregulfo 8:346c55cb6033 5938 5939 }
salvatoregulfo 8:346c55cb6033 5939 5940
salvatoregulfo 8:346c55cb6033 5940 5941 /**
salvatoregulfo 8:346c55cb6033 5941 5942 *
salvatoregulfo 8:346c55cb6033 5942 5943 * @brief Process function for the Q7 Linear Interpolation Function.
salvatoregulfo 8:346c55cb6033 5943 5944 * @param[in] *pYData pointer to Q7 Linear Interpolation table
salvatoregulfo 8:346c55cb6033 5944 5945 * @param[in] x input sample to process
salvatoregulfo 8:346c55cb6033 5945 5946 * @param[in] nValues number of table values
salvatoregulfo 8:346c55cb6033 5946 5947 * @return y processed output sample.
salvatoregulfo 8:346c55cb6033 5947 5948 *
salvatoregulfo 8:346c55cb6033 5948 5949 * \par
salvatoregulfo 8:346c55cb6033 5949 5950 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
salvatoregulfo 8:346c55cb6033 5950 5951 * This function can support maximum of table size 2^12.
salvatoregulfo 8:346c55cb6033 5951 5952 */
salvatoregulfo 8:346c55cb6033 5952 5953
salvatoregulfo 8:346c55cb6033 5953 5954
salvatoregulfo 8:346c55cb6033 5954 5955 static __INLINE q7_t arm_linear_interp_q7(
salvatoregulfo 8:346c55cb6033 5955 5956 q7_t * pYData,
salvatoregulfo 8:346c55cb6033 5956 5957 q31_t x,
salvatoregulfo 8:346c55cb6033 5957 5958 uint32_t nValues)
salvatoregulfo 8:346c55cb6033 5958 5959 {
salvatoregulfo 8:346c55cb6033 5959 5960 q31_t y; /* output */
salvatoregulfo 8:346c55cb6033 5960 5961 q7_t y0, y1; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 5961 5962 q31_t fract; /* fractional part */
salvatoregulfo 8:346c55cb6033 5962 5963 uint32_t index; /* Index to read nearest output values */
salvatoregulfo 8:346c55cb6033 5963 5964
salvatoregulfo 8:346c55cb6033 5964 5965 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 5965 5966 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 5966 5967 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 5967 5968 if (x < 0)
salvatoregulfo 8:346c55cb6033 5968 5969 {
salvatoregulfo 8:346c55cb6033 5969 5970 return (pYData[0]);
salvatoregulfo 8:346c55cb6033 5970 5971 }
salvatoregulfo 8:346c55cb6033 5971 5972 index = (x >> 20) & 0xfff;
salvatoregulfo 8:346c55cb6033 5972 5973
salvatoregulfo 8:346c55cb6033 5973 5974
salvatoregulfo 8:346c55cb6033 5974 5975 if(index >= (nValues - 1))
salvatoregulfo 8:346c55cb6033 5975 5976 {
salvatoregulfo 8:346c55cb6033 5976 5977 return (pYData[nValues - 1]);
salvatoregulfo 8:346c55cb6033 5977 5978 }
salvatoregulfo 8:346c55cb6033 5978 5979 else
salvatoregulfo 8:346c55cb6033 5979 5980 {
salvatoregulfo 8:346c55cb6033 5980 5981
salvatoregulfo 8:346c55cb6033 5981 5982 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 5982 5983 /* fract is in 12.20 format */
salvatoregulfo 8:346c55cb6033 5983 5984 fract = (x & 0x000FFFFF);
salvatoregulfo 8:346c55cb6033 5984 5985
salvatoregulfo 8:346c55cb6033 5985 5986 /* Read two nearest output values from the index and are in 1.7(q7) format */
salvatoregulfo 8:346c55cb6033 5986 5987 y0 = pYData[index];
salvatoregulfo 8:346c55cb6033 5987 5988 y1 = pYData[index + 1u];
salvatoregulfo 8:346c55cb6033 5988 5989
salvatoregulfo 8:346c55cb6033 5989 5990 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
salvatoregulfo 8:346c55cb6033 5990 5991 y = ((y0 * (0xFFFFF - fract)));
salvatoregulfo 8:346c55cb6033 5991 5992
salvatoregulfo 8:346c55cb6033 5992 5993 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
salvatoregulfo 8:346c55cb6033 5993 5994 y += (y1 * fract);
salvatoregulfo 8:346c55cb6033 5994 5995
salvatoregulfo 8:346c55cb6033 5995 5996 /* convert y to 1.7(q7) format */
salvatoregulfo 8:346c55cb6033 5996 5997 return (y >> 20u);
salvatoregulfo 8:346c55cb6033 5997 5998
salvatoregulfo 8:346c55cb6033 5998 5999 }
salvatoregulfo 8:346c55cb6033 5999 6000
salvatoregulfo 8:346c55cb6033 6000 6001 }
salvatoregulfo 8:346c55cb6033 6001 6002 /**
salvatoregulfo 8:346c55cb6033 6002 6003 * @} end of LinearInterpolate group
salvatoregulfo 8:346c55cb6033 6003 6004 */
salvatoregulfo 8:346c55cb6033 6004 6005
salvatoregulfo 8:346c55cb6033 6005 6006 /**
salvatoregulfo 8:346c55cb6033 6006 6007 * @brief Fast approximation to the trigonometric sine function for floating-point data.
salvatoregulfo 8:346c55cb6033 6007 6008 * @param[in] x input value in radians.
salvatoregulfo 8:346c55cb6033 6008 6009 * @return sin(x).
salvatoregulfo 8:346c55cb6033 6009 6010 */
salvatoregulfo 8:346c55cb6033 6010 6011
salvatoregulfo 8:346c55cb6033 6011 6012 float32_t arm_sin_f32(
salvatoregulfo 8:346c55cb6033 6012 6013 float32_t x);
salvatoregulfo 8:346c55cb6033 6013 6014
salvatoregulfo 8:346c55cb6033 6014 6015 /**
salvatoregulfo 8:346c55cb6033 6015 6016 * @brief Fast approximation to the trigonometric sine function for Q31 data.
salvatoregulfo 8:346c55cb6033 6016 6017 * @param[in] x Scaled input value in radians.
salvatoregulfo 8:346c55cb6033 6017 6018 * @return sin(x).
salvatoregulfo 8:346c55cb6033 6018 6019 */
salvatoregulfo 8:346c55cb6033 6019 6020
salvatoregulfo 8:346c55cb6033 6020 6021 q31_t arm_sin_q31(
salvatoregulfo 8:346c55cb6033 6021 6022 q31_t x);
salvatoregulfo 8:346c55cb6033 6022 6023
salvatoregulfo 8:346c55cb6033 6023 6024 /**
salvatoregulfo 8:346c55cb6033 6024 6025 * @brief Fast approximation to the trigonometric sine function for Q15 data.
salvatoregulfo 8:346c55cb6033 6025 6026 * @param[in] x Scaled input value in radians.
salvatoregulfo 8:346c55cb6033 6026 6027 * @return sin(x).
salvatoregulfo 8:346c55cb6033 6027 6028 */
salvatoregulfo 8:346c55cb6033 6028 6029
salvatoregulfo 8:346c55cb6033 6029 6030 q15_t arm_sin_q15(
salvatoregulfo 8:346c55cb6033 6030 6031 q15_t x);
salvatoregulfo 8:346c55cb6033 6031 6032
salvatoregulfo 8:346c55cb6033 6032 6033 /**
salvatoregulfo 8:346c55cb6033 6033 6034 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
salvatoregulfo 8:346c55cb6033 6034 6035 * @param[in] x input value in radians.
salvatoregulfo 8:346c55cb6033 6035 6036 * @return cos(x).
salvatoregulfo 8:346c55cb6033 6036 6037 */
salvatoregulfo 8:346c55cb6033 6037 6038
salvatoregulfo 8:346c55cb6033 6038 6039 float32_t arm_cos_f32(
salvatoregulfo 8:346c55cb6033 6039 6040 float32_t x);
salvatoregulfo 8:346c55cb6033 6040 6041
salvatoregulfo 8:346c55cb6033 6041 6042 /**
salvatoregulfo 8:346c55cb6033 6042 6043 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
salvatoregulfo 8:346c55cb6033 6043 6044 * @param[in] x Scaled input value in radians.
salvatoregulfo 8:346c55cb6033 6044 6045 * @return cos(x).
salvatoregulfo 8:346c55cb6033 6045 6046 */
salvatoregulfo 8:346c55cb6033 6046 6047
salvatoregulfo 8:346c55cb6033 6047 6048 q31_t arm_cos_q31(
salvatoregulfo 8:346c55cb6033 6048 6049 q31_t x);
salvatoregulfo 8:346c55cb6033 6049 6050
salvatoregulfo 8:346c55cb6033 6050 6051 /**
salvatoregulfo 8:346c55cb6033 6051 6052 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
salvatoregulfo 8:346c55cb6033 6052 6053 * @param[in] x Scaled input value in radians.
salvatoregulfo 8:346c55cb6033 6053 6054 * @return cos(x).
salvatoregulfo 8:346c55cb6033 6054 6055 */
salvatoregulfo 8:346c55cb6033 6055 6056
salvatoregulfo 8:346c55cb6033 6056 6057 q15_t arm_cos_q15(
salvatoregulfo 8:346c55cb6033 6057 6058 q15_t x);
salvatoregulfo 8:346c55cb6033 6058 6059
salvatoregulfo 8:346c55cb6033 6059 6060
salvatoregulfo 8:346c55cb6033 6060 6061 /**
salvatoregulfo 8:346c55cb6033 6061 6062 * @ingroup groupFastMath
salvatoregulfo 8:346c55cb6033 6062 6063 */
salvatoregulfo 8:346c55cb6033 6063 6064
salvatoregulfo 8:346c55cb6033 6064 6065
salvatoregulfo 8:346c55cb6033 6065 6066 /**
salvatoregulfo 8:346c55cb6033 6066 6067 * @defgroup SQRT Square Root
salvatoregulfo 8:346c55cb6033 6067 6068 *
salvatoregulfo 8:346c55cb6033 6068 6069 * Computes the square root of a number.
salvatoregulfo 8:346c55cb6033 6069 6070 * There are separate functions for Q15, Q31, and floating-point data types.
salvatoregulfo 8:346c55cb6033 6070 6071 * The square root function is computed using the Newton-Raphson algorithm.
salvatoregulfo 8:346c55cb6033 6071 6072 * This is an iterative algorithm of the form:
salvatoregulfo 8:346c55cb6033 6072 6073 * <pre>
salvatoregulfo 8:346c55cb6033 6073 6074 * x1 = x0 - f(x0)/f'(x0)
salvatoregulfo 8:346c55cb6033 6074 6075 * </pre>
salvatoregulfo 8:346c55cb6033 6075 6076 * where <code>x1</code> is the current estimate,
salvatoregulfo 8:346c55cb6033 6076 6077 * <code>x0</code> is the previous estimate, and
salvatoregulfo 8:346c55cb6033 6077 6078 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
salvatoregulfo 8:346c55cb6033 6078 6079 * For the square root function, the algorithm reduces to:
salvatoregulfo 8:346c55cb6033 6079 6080 * <pre>
salvatoregulfo 8:346c55cb6033 6080 6081 * x0 = in/2 [initial guess]
salvatoregulfo 8:346c55cb6033 6081 6082 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
salvatoregulfo 8:346c55cb6033 6082 6083 * </pre>
salvatoregulfo 8:346c55cb6033 6083 6084 */
salvatoregulfo 8:346c55cb6033 6084 6085
salvatoregulfo 8:346c55cb6033 6085 6086
salvatoregulfo 8:346c55cb6033 6086 6087 /**
salvatoregulfo 8:346c55cb6033 6087 6088 * @addtogroup SQRT
salvatoregulfo 8:346c55cb6033 6088 6089 * @{
salvatoregulfo 8:346c55cb6033 6089 6090 */
salvatoregulfo 8:346c55cb6033 6090 6091
salvatoregulfo 8:346c55cb6033 6091 6092 /**
salvatoregulfo 8:346c55cb6033 6092 6093 * @brief Floating-point square root function.
salvatoregulfo 8:346c55cb6033 6093 6094 * @param[in] in input value.
salvatoregulfo 8:346c55cb6033 6094 6095 * @param[out] *pOut square root of input value.
salvatoregulfo 8:346c55cb6033 6095 6096 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
salvatoregulfo 8:346c55cb6033 6096 6097 * <code>in</code> is negative value and returns zero output for negative values.
salvatoregulfo 8:346c55cb6033 6097 6098 */
salvatoregulfo 8:346c55cb6033 6098 6099
salvatoregulfo 8:346c55cb6033 6099 6100 static __INLINE arm_status arm_sqrt_f32(
salvatoregulfo 8:346c55cb6033 6100 6101 float32_t in,
salvatoregulfo 8:346c55cb6033 6101 6102 float32_t * pOut)
salvatoregulfo 8:346c55cb6033 6102 6103 {
salvatoregulfo 8:346c55cb6033 6103 6104 if(in >= 0.0f)
salvatoregulfo 8:346c55cb6033 6104 6105 {
salvatoregulfo 8:346c55cb6033 6105 6106
salvatoregulfo 8:346c55cb6033 6106 6107 // #if __FPU_USED
salvatoregulfo 8:346c55cb6033 6107 6108 #if (__FPU_USED == 1) && defined ( __CC_ARM )
salvatoregulfo 8:346c55cb6033 6108 6109 *pOut = __sqrtf(in);
salvatoregulfo 8:346c55cb6033 6109 6110 #else
salvatoregulfo 8:346c55cb6033 6110 6111 *pOut = sqrtf(in);
salvatoregulfo 8:346c55cb6033 6111 6112 #endif
salvatoregulfo 8:346c55cb6033 6112 6113
salvatoregulfo 8:346c55cb6033 6113 6114 return (ARM_MATH_SUCCESS);
salvatoregulfo 8:346c55cb6033 6114 6115 }
salvatoregulfo 8:346c55cb6033 6115 6116 else
salvatoregulfo 8:346c55cb6033 6116 6117 {
salvatoregulfo 8:346c55cb6033 6117 6118 *pOut = 0.0f;
salvatoregulfo 8:346c55cb6033 6118 6119 return (ARM_MATH_ARGUMENT_ERROR);
salvatoregulfo 8:346c55cb6033 6119 6120 }
salvatoregulfo 8:346c55cb6033 6120 6121
salvatoregulfo 8:346c55cb6033 6121 6122 }
salvatoregulfo 8:346c55cb6033 6122 6123
salvatoregulfo 8:346c55cb6033 6123 6124
salvatoregulfo 8:346c55cb6033 6124 6125 /**
salvatoregulfo 8:346c55cb6033 6125 6126 * @brief Q31 square root function.
salvatoregulfo 8:346c55cb6033 6126 6127 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
salvatoregulfo 8:346c55cb6033 6127 6128 * @param[out] *pOut square root of input value.
salvatoregulfo 8:346c55cb6033 6128 6129 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
salvatoregulfo 8:346c55cb6033 6129 6130 * <code>in</code> is negative value and returns zero output for negative values.
salvatoregulfo 8:346c55cb6033 6130 6131 */
salvatoregulfo 8:346c55cb6033 6131 6132 arm_status arm_sqrt_q31(
salvatoregulfo 8:346c55cb6033 6132 6133 q31_t in,
salvatoregulfo 8:346c55cb6033 6133 6134 q31_t * pOut);
salvatoregulfo 8:346c55cb6033 6134 6135
salvatoregulfo 8:346c55cb6033 6135 6136 /**
salvatoregulfo 8:346c55cb6033 6136 6137 * @brief Q15 square root function.
salvatoregulfo 8:346c55cb6033 6137 6138 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
salvatoregulfo 8:346c55cb6033 6138 6139 * @param[out] *pOut square root of input value.
salvatoregulfo 8:346c55cb6033 6139 6140 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
salvatoregulfo 8:346c55cb6033 6140 6141 * <code>in</code> is negative value and returns zero output for negative values.
salvatoregulfo 8:346c55cb6033 6141 6142 */
salvatoregulfo 8:346c55cb6033 6142 6143 arm_status arm_sqrt_q15(
salvatoregulfo 8:346c55cb6033 6143 6144 q15_t in,
salvatoregulfo 8:346c55cb6033 6144 6145 q15_t * pOut);
salvatoregulfo 8:346c55cb6033 6145 6146
salvatoregulfo 8:346c55cb6033 6146 6147 /**
salvatoregulfo 8:346c55cb6033 6147 6148 * @} end of SQRT group
salvatoregulfo 8:346c55cb6033 6148 6149 */
salvatoregulfo 8:346c55cb6033 6149 6150
salvatoregulfo 8:346c55cb6033 6150 6151
salvatoregulfo 8:346c55cb6033 6151 6152
salvatoregulfo 8:346c55cb6033 6152 6153
salvatoregulfo 8:346c55cb6033 6153 6154
salvatoregulfo 8:346c55cb6033 6154 6155
salvatoregulfo 8:346c55cb6033 6155 6156 /**
salvatoregulfo 8:346c55cb6033 6156 6157 * @brief floating-point Circular write function.
salvatoregulfo 8:346c55cb6033 6157 6158 */
salvatoregulfo 8:346c55cb6033 6158 6159
salvatoregulfo 8:346c55cb6033 6159 6160 static __INLINE void arm_circularWrite_f32(
salvatoregulfo 8:346c55cb6033 6160 6161 int32_t * circBuffer,
salvatoregulfo 8:346c55cb6033 6161 6162 int32_t L,
salvatoregulfo 8:346c55cb6033 6162 6163 uint16_t * writeOffset,
salvatoregulfo 8:346c55cb6033 6163 6164 int32_t bufferInc,
salvatoregulfo 8:346c55cb6033 6164 6165 const int32_t * src,
salvatoregulfo 8:346c55cb6033 6165 6166 int32_t srcInc,
salvatoregulfo 8:346c55cb6033 6166 6167 uint32_t blockSize)
salvatoregulfo 8:346c55cb6033 6167 6168 {
salvatoregulfo 8:346c55cb6033 6168 6169 uint32_t i = 0u;
salvatoregulfo 8:346c55cb6033 6169 6170 int32_t wOffset;
salvatoregulfo 8:346c55cb6033 6170 6171
salvatoregulfo 8:346c55cb6033 6171 6172 /* Copy the value of Index pointer that points
salvatoregulfo 8:346c55cb6033 6172 6173 * to the current location where the input samples to be copied */
salvatoregulfo 8:346c55cb6033 6173 6174 wOffset = *writeOffset;
salvatoregulfo 8:346c55cb6033 6174 6175
salvatoregulfo 8:346c55cb6033 6175 6176 /* Loop over the blockSize */
salvatoregulfo 8:346c55cb6033 6176 6177 i = blockSize;
salvatoregulfo 8:346c55cb6033 6177 6178
salvatoregulfo 8:346c55cb6033 6178 6179 while(i > 0u)
salvatoregulfo 8:346c55cb6033 6179 6180 {
salvatoregulfo 8:346c55cb6033 6180 6181 /* copy the input sample to the circular buffer */
salvatoregulfo 8:346c55cb6033 6181 6182 circBuffer[wOffset] = *src;
salvatoregulfo 8:346c55cb6033 6182 6183
salvatoregulfo 8:346c55cb6033 6183 6184 /* Update the input pointer */
salvatoregulfo 8:346c55cb6033 6184 6185 src += srcInc;
salvatoregulfo 8:346c55cb6033 6185 6186
salvatoregulfo 8:346c55cb6033 6186 6187 /* Circularly update wOffset. Watch out for positive and negative value */
salvatoregulfo 8:346c55cb6033 6187 6188 wOffset += bufferInc;
salvatoregulfo 8:346c55cb6033 6188 6189 if(wOffset >= L)
salvatoregulfo 8:346c55cb6033 6189 6190 wOffset -= L;
salvatoregulfo 8:346c55cb6033 6190 6191
salvatoregulfo 8:346c55cb6033 6191 6192 /* Decrement the loop counter */
salvatoregulfo 8:346c55cb6033 6192 6193 i--;
salvatoregulfo 8:346c55cb6033 6193 6194 }
salvatoregulfo 8:346c55cb6033 6194 6195
salvatoregulfo 8:346c55cb6033 6195 6196 /* Update the index pointer */
salvatoregulfo 8:346c55cb6033 6196 6197 *writeOffset = wOffset;
salvatoregulfo 8:346c55cb6033 6197 6198 }
salvatoregulfo 8:346c55cb6033 6198 6199
salvatoregulfo 8:346c55cb6033 6199 6200
salvatoregulfo 8:346c55cb6033 6200 6201
salvatoregulfo 8:346c55cb6033 6201 6202 /**
salvatoregulfo 8:346c55cb6033 6202 6203 * @brief floating-point Circular Read function.
salvatoregulfo 8:346c55cb6033 6203 6204 */
salvatoregulfo 8:346c55cb6033 6204 6205 static __INLINE void arm_circularRead_f32(
salvatoregulfo 8:346c55cb6033 6205 6206 int32_t * circBuffer,
salvatoregulfo 8:346c55cb6033 6206 6207 int32_t L,
salvatoregulfo 8:346c55cb6033 6207 6208 int32_t * readOffset,
salvatoregulfo 8:346c55cb6033 6208 6209 int32_t bufferInc,
salvatoregulfo 8:346c55cb6033 6209 6210 int32_t * dst,
salvatoregulfo 8:346c55cb6033 6210 6211 int32_t * dst_base,
salvatoregulfo 8:346c55cb6033 6211 6212 int32_t dst_length,
salvatoregulfo 8:346c55cb6033 6212 6213 int32_t dstInc,
salvatoregulfo 8:346c55cb6033 6213 6214 uint32_t blockSize)
salvatoregulfo 8:346c55cb6033 6214 6215 {
salvatoregulfo 8:346c55cb6033 6215 6216 uint32_t i = 0u;
salvatoregulfo 8:346c55cb6033 6216 6217 int32_t rOffset, dst_end;
salvatoregulfo 8:346c55cb6033 6217 6218
salvatoregulfo 8:346c55cb6033 6218 6219 /* Copy the value of Index pointer that points
salvatoregulfo 8:346c55cb6033 6219 6220 * to the current location from where the input samples to be read */
salvatoregulfo 8:346c55cb6033 6220 6221 rOffset = *readOffset;
salvatoregulfo 8:346c55cb6033 6221 6222 dst_end = (int32_t) (dst_base + dst_length);
salvatoregulfo 8:346c55cb6033 6222 6223
salvatoregulfo 8:346c55cb6033 6223 6224 /* Loop over the blockSize */
salvatoregulfo 8:346c55cb6033 6224 6225 i = blockSize;
salvatoregulfo 8:346c55cb6033 6225 6226
salvatoregulfo 8:346c55cb6033 6226 6227 while(i > 0u)
salvatoregulfo 8:346c55cb6033 6227 6228 {
salvatoregulfo 8:346c55cb6033 6228 6229 /* copy the sample from the circular buffer to the destination buffer */
salvatoregulfo 8:346c55cb6033 6229 6230 *dst = circBuffer[rOffset];
salvatoregulfo 8:346c55cb6033 6230 6231
salvatoregulfo 8:346c55cb6033 6231 6232 /* Update the input pointer */
salvatoregulfo 8:346c55cb6033 6232 6233 dst += dstInc;
salvatoregulfo 8:346c55cb6033 6233 6234
salvatoregulfo 8:346c55cb6033 6234 6235 if(dst == (int32_t *) dst_end)
salvatoregulfo 8:346c55cb6033 6235 6236 {
salvatoregulfo 8:346c55cb6033 6236 6237 dst = dst_base;
salvatoregulfo 8:346c55cb6033 6237 6238 }
salvatoregulfo 8:346c55cb6033 6238 6239
salvatoregulfo 8:346c55cb6033 6239 6240 /* Circularly update rOffset. Watch out for positive and negative value */
salvatoregulfo 8:346c55cb6033 6240 6241 rOffset += bufferInc;
salvatoregulfo 8:346c55cb6033 6241 6242
salvatoregulfo 8:346c55cb6033 6242 6243 if(rOffset >= L)
salvatoregulfo 8:346c55cb6033 6243 6244 {
salvatoregulfo 8:346c55cb6033 6244 6245 rOffset -= L;
salvatoregulfo 8:346c55cb6033 6245 6246 }
salvatoregulfo 8:346c55cb6033 6246 6247
salvatoregulfo 8:346c55cb6033 6247 6248 /* Decrement the loop counter */
salvatoregulfo 8:346c55cb6033 6248 6249 i--;
salvatoregulfo 8:346c55cb6033 6249 6250 }
salvatoregulfo 8:346c55cb6033 6250 6251
salvatoregulfo 8:346c55cb6033 6251 6252 /* Update the index pointer */
salvatoregulfo 8:346c55cb6033 6252 6253 *readOffset = rOffset;
salvatoregulfo 8:346c55cb6033 6253 6254 }
salvatoregulfo 8:346c55cb6033 6254 6255
salvatoregulfo 8:346c55cb6033 6255 6256 /**
salvatoregulfo 8:346c55cb6033 6256 6257 * @brief Q15 Circular write function.
salvatoregulfo 8:346c55cb6033 6257 6258 */
salvatoregulfo 8:346c55cb6033 6258 6259
salvatoregulfo 8:346c55cb6033 6259 6260 static __INLINE void arm_circularWrite_q15(
salvatoregulfo 8:346c55cb6033 6260 6261 q15_t * circBuffer,
salvatoregulfo 8:346c55cb6033 6261 6262 int32_t L,
salvatoregulfo 8:346c55cb6033 6262 6263 uint16_t * writeOffset,
salvatoregulfo 8:346c55cb6033 6263 6264 int32_t bufferInc,
salvatoregulfo 8:346c55cb6033 6264 6265 const q15_t * src,
salvatoregulfo 8:346c55cb6033 6265 6266 int32_t srcInc,
salvatoregulfo 8:346c55cb6033 6266 6267 uint32_t blockSize)
salvatoregulfo 8:346c55cb6033 6267 6268 {
salvatoregulfo 8:346c55cb6033 6268 6269 uint32_t i = 0u;
salvatoregulfo 8:346c55cb6033 6269 6270 int32_t wOffset;
salvatoregulfo 8:346c55cb6033 6270 6271
salvatoregulfo 8:346c55cb6033 6271 6272 /* Copy the value of Index pointer that points
salvatoregulfo 8:346c55cb6033 6272 6273 * to the current location where the input samples to be copied */
salvatoregulfo 8:346c55cb6033 6273 6274 wOffset = *writeOffset;
salvatoregulfo 8:346c55cb6033 6274 6275
salvatoregulfo 8:346c55cb6033 6275 6276 /* Loop over the blockSize */
salvatoregulfo 8:346c55cb6033 6276 6277 i = blockSize;
salvatoregulfo 8:346c55cb6033 6277 6278
salvatoregulfo 8:346c55cb6033 6278 6279 while(i > 0u)
salvatoregulfo 8:346c55cb6033 6279 6280 {
salvatoregulfo 8:346c55cb6033 6280 6281 /* copy the input sample to the circular buffer */
salvatoregulfo 8:346c55cb6033 6281 6282 circBuffer[wOffset] = *src;
salvatoregulfo 8:346c55cb6033 6282 6283
salvatoregulfo 8:346c55cb6033 6283 6284 /* Update the input pointer */
salvatoregulfo 8:346c55cb6033 6284 6285 src += srcInc;
salvatoregulfo 8:346c55cb6033 6285 6286
salvatoregulfo 8:346c55cb6033 6286 6287 /* Circularly update wOffset. Watch out for positive and negative value */
salvatoregulfo 8:346c55cb6033 6287 6288 wOffset += bufferInc;
salvatoregulfo 8:346c55cb6033 6288 6289 if(wOffset >= L)
salvatoregulfo 8:346c55cb6033 6289 6290 wOffset -= L;
salvatoregulfo 8:346c55cb6033 6290 6291
salvatoregulfo 8:346c55cb6033 6291 6292 /* Decrement the loop counter */
salvatoregulfo 8:346c55cb6033 6292 6293 i--;
salvatoregulfo 8:346c55cb6033 6293 6294 }
salvatoregulfo 8:346c55cb6033 6294 6295
salvatoregulfo 8:346c55cb6033 6295 6296 /* Update the index pointer */
salvatoregulfo 8:346c55cb6033 6296 6297 *writeOffset = wOffset;
salvatoregulfo 8:346c55cb6033 6297 6298 }
salvatoregulfo 8:346c55cb6033 6298 6299
salvatoregulfo 8:346c55cb6033 6299 6300
salvatoregulfo 8:346c55cb6033 6300 6301
salvatoregulfo 8:346c55cb6033 6301 6302 /**
salvatoregulfo 8:346c55cb6033 6302 6303 * @brief Q15 Circular Read function.
salvatoregulfo 8:346c55cb6033 6303 6304 */
salvatoregulfo 8:346c55cb6033 6304 6305 static __INLINE void arm_circularRead_q15(
salvatoregulfo 8:346c55cb6033 6305 6306 q15_t * circBuffer,
salvatoregulfo 8:346c55cb6033 6306 6307 int32_t L,
salvatoregulfo 8:346c55cb6033 6307 6308 int32_t * readOffset,
salvatoregulfo 8:346c55cb6033 6308 6309 int32_t bufferInc,
salvatoregulfo 8:346c55cb6033 6309 6310 q15_t * dst,
salvatoregulfo 8:346c55cb6033 6310 6311 q15_t * dst_base,
salvatoregulfo 8:346c55cb6033 6311 6312 int32_t dst_length,
salvatoregulfo 8:346c55cb6033 6312 6313 int32_t dstInc,
salvatoregulfo 8:346c55cb6033 6313 6314 uint32_t blockSize)
salvatoregulfo 8:346c55cb6033 6314 6315 {
salvatoregulfo 8:346c55cb6033 6315 6316 uint32_t i = 0;
salvatoregulfo 8:346c55cb6033 6316 6317 int32_t rOffset, dst_end;
salvatoregulfo 8:346c55cb6033 6317 6318
salvatoregulfo 8:346c55cb6033 6318 6319 /* Copy the value of Index pointer that points
salvatoregulfo 8:346c55cb6033 6319 6320 * to the current location from where the input samples to be read */
salvatoregulfo 8:346c55cb6033 6320 6321 rOffset = *readOffset;
salvatoregulfo 8:346c55cb6033 6321 6322
salvatoregulfo 8:346c55cb6033 6322 6323 dst_end = (int32_t) (dst_base + dst_length);
salvatoregulfo 8:346c55cb6033 6323 6324
salvatoregulfo 8:346c55cb6033 6324 6325 /* Loop over the blockSize */
salvatoregulfo 8:346c55cb6033 6325 6326 i = blockSize;
salvatoregulfo 8:346c55cb6033 6326 6327
salvatoregulfo 8:346c55cb6033 6327 6328 while(i > 0u)
salvatoregulfo 8:346c55cb6033 6328 6329 {
salvatoregulfo 8:346c55cb6033 6329 6330 /* copy the sample from the circular buffer to the destination buffer */
salvatoregulfo 8:346c55cb6033 6330 6331 *dst = circBuffer[rOffset];
salvatoregulfo 8:346c55cb6033 6331 6332
salvatoregulfo 8:346c55cb6033 6332 6333 /* Update the input pointer */
salvatoregulfo 8:346c55cb6033 6333 6334 dst += dstInc;
salvatoregulfo 8:346c55cb6033 6334 6335
salvatoregulfo 8:346c55cb6033 6335 6336 if(dst == (q15_t *) dst_end)
salvatoregulfo 8:346c55cb6033 6336 6337 {
salvatoregulfo 8:346c55cb6033 6337 6338 dst = dst_base;
salvatoregulfo 8:346c55cb6033 6338 6339 }
salvatoregulfo 8:346c55cb6033 6339 6340
salvatoregulfo 8:346c55cb6033 6340 6341 /* Circularly update wOffset. Watch out for positive and negative value */
salvatoregulfo 8:346c55cb6033 6341 6342 rOffset += bufferInc;
salvatoregulfo 8:346c55cb6033 6342 6343
salvatoregulfo 8:346c55cb6033 6343 6344 if(rOffset >= L)
salvatoregulfo 8:346c55cb6033 6344 6345 {
salvatoregulfo 8:346c55cb6033 6345 6346 rOffset -= L;
salvatoregulfo 8:346c55cb6033 6346 6347 }
salvatoregulfo 8:346c55cb6033 6347 6348
salvatoregulfo 8:346c55cb6033 6348 6349 /* Decrement the loop counter */
salvatoregulfo 8:346c55cb6033 6349 6350 i--;
salvatoregulfo 8:346c55cb6033 6350 6351 }
salvatoregulfo 8:346c55cb6033 6351 6352
salvatoregulfo 8:346c55cb6033 6352 6353 /* Update the index pointer */
salvatoregulfo 8:346c55cb6033 6353 6354 *readOffset = rOffset;
salvatoregulfo 8:346c55cb6033 6354 6355 }
salvatoregulfo 8:346c55cb6033 6355 6356
salvatoregulfo 8:346c55cb6033 6356 6357
salvatoregulfo 8:346c55cb6033 6357 6358 /**
salvatoregulfo 8:346c55cb6033 6358 6359 * @brief Q7 Circular write function.
salvatoregulfo 8:346c55cb6033 6359 6360 */
salvatoregulfo 8:346c55cb6033 6360 6361
salvatoregulfo 8:346c55cb6033 6361 6362 static __INLINE void arm_circularWrite_q7(
salvatoregulfo 8:346c55cb6033 6362 6363 q7_t * circBuffer,
salvatoregulfo 8:346c55cb6033 6363 6364 int32_t L,
salvatoregulfo 8:346c55cb6033 6364 6365 uint16_t * writeOffset,
salvatoregulfo 8:346c55cb6033 6365 6366 int32_t bufferInc,
salvatoregulfo 8:346c55cb6033 6366 6367 const q7_t * src,
salvatoregulfo 8:346c55cb6033 6367 6368 int32_t srcInc,
salvatoregulfo 8:346c55cb6033 6368 6369 uint32_t blockSize)
salvatoregulfo 8:346c55cb6033 6369 6370 {
salvatoregulfo 8:346c55cb6033 6370 6371 uint32_t i = 0u;
salvatoregulfo 8:346c55cb6033 6371 6372 int32_t wOffset;
salvatoregulfo 8:346c55cb6033 6372 6373
salvatoregulfo 8:346c55cb6033 6373 6374 /* Copy the value of Index pointer that points
salvatoregulfo 8:346c55cb6033 6374 6375 * to the current location where the input samples to be copied */
salvatoregulfo 8:346c55cb6033 6375 6376 wOffset = *writeOffset;
salvatoregulfo 8:346c55cb6033 6376 6377
salvatoregulfo 8:346c55cb6033 6377 6378 /* Loop over the blockSize */
salvatoregulfo 8:346c55cb6033 6378 6379 i = blockSize;
salvatoregulfo 8:346c55cb6033 6379 6380
salvatoregulfo 8:346c55cb6033 6380 6381 while(i > 0u)
salvatoregulfo 8:346c55cb6033 6381 6382 {
salvatoregulfo 8:346c55cb6033 6382 6383 /* copy the input sample to the circular buffer */
salvatoregulfo 8:346c55cb6033 6383 6384 circBuffer[wOffset] = *src;
salvatoregulfo 8:346c55cb6033 6384 6385
salvatoregulfo 8:346c55cb6033 6385 6386 /* Update the input pointer */
salvatoregulfo 8:346c55cb6033 6386 6387 src += srcInc;
salvatoregulfo 8:346c55cb6033 6387 6388
salvatoregulfo 8:346c55cb6033 6388 6389 /* Circularly update wOffset. Watch out for positive and negative value */
salvatoregulfo 8:346c55cb6033 6389 6390 wOffset += bufferInc;
salvatoregulfo 8:346c55cb6033 6390 6391 if(wOffset >= L)
salvatoregulfo 8:346c55cb6033 6391 6392 wOffset -= L;
salvatoregulfo 8:346c55cb6033 6392 6393
salvatoregulfo 8:346c55cb6033 6393 6394 /* Decrement the loop counter */
salvatoregulfo 8:346c55cb6033 6394 6395 i--;
salvatoregulfo 8:346c55cb6033 6395 6396 }
salvatoregulfo 8:346c55cb6033 6396 6397
salvatoregulfo 8:346c55cb6033 6397 6398 /* Update the index pointer */
salvatoregulfo 8:346c55cb6033 6398 6399 *writeOffset = wOffset;
salvatoregulfo 8:346c55cb6033 6399 6400 }
salvatoregulfo 8:346c55cb6033 6400 6401
salvatoregulfo 8:346c55cb6033 6401 6402
salvatoregulfo 8:346c55cb6033 6402 6403
salvatoregulfo 8:346c55cb6033 6403 6404 /**
salvatoregulfo 8:346c55cb6033 6404 6405 * @brief Q7 Circular Read function.
salvatoregulfo 8:346c55cb6033 6405 6406 */
salvatoregulfo 8:346c55cb6033 6406 6407 static __INLINE void arm_circularRead_q7(
salvatoregulfo 8:346c55cb6033 6407 6408 q7_t * circBuffer,
salvatoregulfo 8:346c55cb6033 6408 6409 int32_t L,
salvatoregulfo 8:346c55cb6033 6409 6410 int32_t * readOffset,
salvatoregulfo 8:346c55cb6033 6410 6411 int32_t bufferInc,
salvatoregulfo 8:346c55cb6033 6411 6412 q7_t * dst,
salvatoregulfo 8:346c55cb6033 6412 6413 q7_t * dst_base,
salvatoregulfo 8:346c55cb6033 6413 6414 int32_t dst_length,
salvatoregulfo 8:346c55cb6033 6414 6415 int32_t dstInc,
salvatoregulfo 8:346c55cb6033 6415 6416 uint32_t blockSize)
salvatoregulfo 8:346c55cb6033 6416 6417 {
salvatoregulfo 8:346c55cb6033 6417 6418 uint32_t i = 0;
salvatoregulfo 8:346c55cb6033 6418 6419 int32_t rOffset, dst_end;
salvatoregulfo 8:346c55cb6033 6419 6420
salvatoregulfo 8:346c55cb6033 6420 6421 /* Copy the value of Index pointer that points
salvatoregulfo 8:346c55cb6033 6421 6422 * to the current location from where the input samples to be read */
salvatoregulfo 8:346c55cb6033 6422 6423 rOffset = *readOffset;
salvatoregulfo 8:346c55cb6033 6423 6424
salvatoregulfo 8:346c55cb6033 6424 6425 dst_end = (int32_t) (dst_base + dst_length);
salvatoregulfo 8:346c55cb6033 6425 6426
salvatoregulfo 8:346c55cb6033 6426 6427 /* Loop over the blockSize */
salvatoregulfo 8:346c55cb6033 6427 6428 i = blockSize;
salvatoregulfo 8:346c55cb6033 6428 6429
salvatoregulfo 8:346c55cb6033 6429 6430 while(i > 0u)
salvatoregulfo 8:346c55cb6033 6430 6431 {
salvatoregulfo 8:346c55cb6033 6431 6432 /* copy the sample from the circular buffer to the destination buffer */
salvatoregulfo 8:346c55cb6033 6432 6433 *dst = circBuffer[rOffset];
salvatoregulfo 8:346c55cb6033 6433 6434
salvatoregulfo 8:346c55cb6033 6434 6435 /* Update the input pointer */
salvatoregulfo 8:346c55cb6033 6435 6436 dst += dstInc;
salvatoregulfo 8:346c55cb6033 6436 6437
salvatoregulfo 8:346c55cb6033 6437 6438 if(dst == (q7_t *) dst_end)
salvatoregulfo 8:346c55cb6033 6438 6439 {
salvatoregulfo 8:346c55cb6033 6439 6440 dst = dst_base;
salvatoregulfo 8:346c55cb6033 6440 6441 }
salvatoregulfo 8:346c55cb6033 6441 6442
salvatoregulfo 8:346c55cb6033 6442 6443 /* Circularly update rOffset. Watch out for positive and negative value */
salvatoregulfo 8:346c55cb6033 6443 6444 rOffset += bufferInc;
salvatoregulfo 8:346c55cb6033 6444 6445
salvatoregulfo 8:346c55cb6033 6445 6446 if(rOffset >= L)
salvatoregulfo 8:346c55cb6033 6446 6447 {
salvatoregulfo 8:346c55cb6033 6447 6448 rOffset -= L;
salvatoregulfo 8:346c55cb6033 6448 6449 }
salvatoregulfo 8:346c55cb6033 6449 6450
salvatoregulfo 8:346c55cb6033 6450 6451 /* Decrement the loop counter */
salvatoregulfo 8:346c55cb6033 6451 6452 i--;
salvatoregulfo 8:346c55cb6033 6452 6453 }
salvatoregulfo 8:346c55cb6033 6453 6454
salvatoregulfo 8:346c55cb6033 6454 6455 /* Update the index pointer */
salvatoregulfo 8:346c55cb6033 6455 6456 *readOffset = rOffset;
salvatoregulfo 8:346c55cb6033 6456 6457 }
salvatoregulfo 8:346c55cb6033 6457 6458
salvatoregulfo 8:346c55cb6033 6458 6459
salvatoregulfo 8:346c55cb6033 6459 6460 /**
salvatoregulfo 8:346c55cb6033 6460 6461 * @brief Sum of the squares of the elements of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6461 6462 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6462 6463 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6463 6464 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6464 6465 * @return none.
salvatoregulfo 8:346c55cb6033 6465 6466 */
salvatoregulfo 8:346c55cb6033 6466 6467
salvatoregulfo 8:346c55cb6033 6467 6468 void arm_power_q31(
salvatoregulfo 8:346c55cb6033 6468 6469 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6469 6470 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6470 6471 q63_t * pResult);
salvatoregulfo 8:346c55cb6033 6471 6472
salvatoregulfo 8:346c55cb6033 6472 6473 /**
salvatoregulfo 8:346c55cb6033 6473 6474 * @brief Sum of the squares of the elements of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6474 6475 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6475 6476 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6476 6477 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6477 6478 * @return none.
salvatoregulfo 8:346c55cb6033 6478 6479 */
salvatoregulfo 8:346c55cb6033 6479 6480
salvatoregulfo 8:346c55cb6033 6480 6481 void arm_power_f32(
salvatoregulfo 8:346c55cb6033 6481 6482 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6482 6483 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6483 6484 float32_t * pResult);
salvatoregulfo 8:346c55cb6033 6484 6485
salvatoregulfo 8:346c55cb6033 6485 6486 /**
salvatoregulfo 8:346c55cb6033 6486 6487 * @brief Sum of the squares of the elements of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6487 6488 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6488 6489 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6489 6490 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6490 6491 * @return none.
salvatoregulfo 8:346c55cb6033 6491 6492 */
salvatoregulfo 8:346c55cb6033 6492 6493
salvatoregulfo 8:346c55cb6033 6493 6494 void arm_power_q15(
salvatoregulfo 8:346c55cb6033 6494 6495 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6495 6496 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6496 6497 q63_t * pResult);
salvatoregulfo 8:346c55cb6033 6497 6498
salvatoregulfo 8:346c55cb6033 6498 6499 /**
salvatoregulfo 8:346c55cb6033 6499 6500 * @brief Sum of the squares of the elements of a Q7 vector.
salvatoregulfo 8:346c55cb6033 6500 6501 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6501 6502 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6502 6503 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6503 6504 * @return none.
salvatoregulfo 8:346c55cb6033 6504 6505 */
salvatoregulfo 8:346c55cb6033 6505 6506
salvatoregulfo 8:346c55cb6033 6506 6507 void arm_power_q7(
salvatoregulfo 8:346c55cb6033 6507 6508 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 6508 6509 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6509 6510 q31_t * pResult);
salvatoregulfo 8:346c55cb6033 6510 6511
salvatoregulfo 8:346c55cb6033 6511 6512 /**
salvatoregulfo 8:346c55cb6033 6512 6513 * @brief Mean value of a Q7 vector.
salvatoregulfo 8:346c55cb6033 6513 6514 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6514 6515 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6515 6516 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6516 6517 * @return none.
salvatoregulfo 8:346c55cb6033 6517 6518 */
salvatoregulfo 8:346c55cb6033 6518 6519
salvatoregulfo 8:346c55cb6033 6519 6520 void arm_mean_q7(
salvatoregulfo 8:346c55cb6033 6520 6521 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 6521 6522 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6522 6523 q7_t * pResult);
salvatoregulfo 8:346c55cb6033 6523 6524
salvatoregulfo 8:346c55cb6033 6524 6525 /**
salvatoregulfo 8:346c55cb6033 6525 6526 * @brief Mean value of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6526 6527 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6527 6528 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6528 6529 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6529 6530 * @return none.
salvatoregulfo 8:346c55cb6033 6530 6531 */
salvatoregulfo 8:346c55cb6033 6531 6532 void arm_mean_q15(
salvatoregulfo 8:346c55cb6033 6532 6533 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6533 6534 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6534 6535 q15_t * pResult);
salvatoregulfo 8:346c55cb6033 6535 6536
salvatoregulfo 8:346c55cb6033 6536 6537 /**
salvatoregulfo 8:346c55cb6033 6537 6538 * @brief Mean value of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6538 6539 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6539 6540 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6540 6541 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6541 6542 * @return none.
salvatoregulfo 8:346c55cb6033 6542 6543 */
salvatoregulfo 8:346c55cb6033 6543 6544 void arm_mean_q31(
salvatoregulfo 8:346c55cb6033 6544 6545 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6545 6546 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6546 6547 q31_t * pResult);
salvatoregulfo 8:346c55cb6033 6547 6548
salvatoregulfo 8:346c55cb6033 6548 6549 /**
salvatoregulfo 8:346c55cb6033 6549 6550 * @brief Mean value of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6550 6551 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6551 6552 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6552 6553 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6553 6554 * @return none.
salvatoregulfo 8:346c55cb6033 6554 6555 */
salvatoregulfo 8:346c55cb6033 6555 6556 void arm_mean_f32(
salvatoregulfo 8:346c55cb6033 6556 6557 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6557 6558 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6558 6559 float32_t * pResult);
salvatoregulfo 8:346c55cb6033 6559 6560
salvatoregulfo 8:346c55cb6033 6560 6561 /**
salvatoregulfo 8:346c55cb6033 6561 6562 * @brief Variance of the elements of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6562 6563 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6563 6564 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6564 6565 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6565 6566 * @return none.
salvatoregulfo 8:346c55cb6033 6566 6567 */
salvatoregulfo 8:346c55cb6033 6567 6568
salvatoregulfo 8:346c55cb6033 6568 6569 void arm_var_f32(
salvatoregulfo 8:346c55cb6033 6569 6570 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6570 6571 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6571 6572 float32_t * pResult);
salvatoregulfo 8:346c55cb6033 6572 6573
salvatoregulfo 8:346c55cb6033 6573 6574 /**
salvatoregulfo 8:346c55cb6033 6574 6575 * @brief Variance of the elements of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6575 6576 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6576 6577 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6577 6578 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6578 6579 * @return none.
salvatoregulfo 8:346c55cb6033 6579 6580 */
salvatoregulfo 8:346c55cb6033 6580 6581
salvatoregulfo 8:346c55cb6033 6581 6582 void arm_var_q31(
salvatoregulfo 8:346c55cb6033 6582 6583 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6583 6584 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6584 6585 q31_t * pResult);
salvatoregulfo 8:346c55cb6033 6585 6586
salvatoregulfo 8:346c55cb6033 6586 6587 /**
salvatoregulfo 8:346c55cb6033 6587 6588 * @brief Variance of the elements of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6588 6589 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6589 6590 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6590 6591 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6591 6592 * @return none.
salvatoregulfo 8:346c55cb6033 6592 6593 */
salvatoregulfo 8:346c55cb6033 6593 6594
salvatoregulfo 8:346c55cb6033 6594 6595 void arm_var_q15(
salvatoregulfo 8:346c55cb6033 6595 6596 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6596 6597 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6597 6598 q15_t * pResult);
salvatoregulfo 8:346c55cb6033 6598 6599
salvatoregulfo 8:346c55cb6033 6599 6600 /**
salvatoregulfo 8:346c55cb6033 6600 6601 * @brief Root Mean Square of the elements of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6601 6602 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6602 6603 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6603 6604 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6604 6605 * @return none.
salvatoregulfo 8:346c55cb6033 6605 6606 */
salvatoregulfo 8:346c55cb6033 6606 6607
salvatoregulfo 8:346c55cb6033 6607 6608 void arm_rms_f32(
salvatoregulfo 8:346c55cb6033 6608 6609 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6609 6610 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6610 6611 float32_t * pResult);
salvatoregulfo 8:346c55cb6033 6611 6612
salvatoregulfo 8:346c55cb6033 6612 6613 /**
salvatoregulfo 8:346c55cb6033 6613 6614 * @brief Root Mean Square of the elements of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6614 6615 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6615 6616 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6616 6617 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6617 6618 * @return none.
salvatoregulfo 8:346c55cb6033 6618 6619 */
salvatoregulfo 8:346c55cb6033 6619 6620
salvatoregulfo 8:346c55cb6033 6620 6621 void arm_rms_q31(
salvatoregulfo 8:346c55cb6033 6621 6622 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6622 6623 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6623 6624 q31_t * pResult);
salvatoregulfo 8:346c55cb6033 6624 6625
salvatoregulfo 8:346c55cb6033 6625 6626 /**
salvatoregulfo 8:346c55cb6033 6626 6627 * @brief Root Mean Square of the elements of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6627 6628 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6628 6629 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6629 6630 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6630 6631 * @return none.
salvatoregulfo 8:346c55cb6033 6631 6632 */
salvatoregulfo 8:346c55cb6033 6632 6633
salvatoregulfo 8:346c55cb6033 6633 6634 void arm_rms_q15(
salvatoregulfo 8:346c55cb6033 6634 6635 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6635 6636 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6636 6637 q15_t * pResult);
salvatoregulfo 8:346c55cb6033 6637 6638
salvatoregulfo 8:346c55cb6033 6638 6639 /**
salvatoregulfo 8:346c55cb6033 6639 6640 * @brief Standard deviation of the elements of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6640 6641 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6641 6642 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6642 6643 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6643 6644 * @return none.
salvatoregulfo 8:346c55cb6033 6644 6645 */
salvatoregulfo 8:346c55cb6033 6645 6646
salvatoregulfo 8:346c55cb6033 6646 6647 void arm_std_f32(
salvatoregulfo 8:346c55cb6033 6647 6648 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6648 6649 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6649 6650 float32_t * pResult);
salvatoregulfo 8:346c55cb6033 6650 6651
salvatoregulfo 8:346c55cb6033 6651 6652 /**
salvatoregulfo 8:346c55cb6033 6652 6653 * @brief Standard deviation of the elements of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6653 6654 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6654 6655 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6655 6656 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6656 6657 * @return none.
salvatoregulfo 8:346c55cb6033 6657 6658 */
salvatoregulfo 8:346c55cb6033 6658 6659
salvatoregulfo 8:346c55cb6033 6659 6660 void arm_std_q31(
salvatoregulfo 8:346c55cb6033 6660 6661 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6661 6662 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6662 6663 q31_t * pResult);
salvatoregulfo 8:346c55cb6033 6663 6664
salvatoregulfo 8:346c55cb6033 6664 6665 /**
salvatoregulfo 8:346c55cb6033 6665 6666 * @brief Standard deviation of the elements of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6666 6667 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6667 6668 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6668 6669 * @param[out] *pResult is output value.
salvatoregulfo 8:346c55cb6033 6669 6670 * @return none.
salvatoregulfo 8:346c55cb6033 6670 6671 */
salvatoregulfo 8:346c55cb6033 6671 6672
salvatoregulfo 8:346c55cb6033 6672 6673 void arm_std_q15(
salvatoregulfo 8:346c55cb6033 6673 6674 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6674 6675 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6675 6676 q15_t * pResult);
salvatoregulfo 8:346c55cb6033 6676 6677
salvatoregulfo 8:346c55cb6033 6677 6678 /**
salvatoregulfo 8:346c55cb6033 6678 6679 * @brief Floating-point complex magnitude
salvatoregulfo 8:346c55cb6033 6679 6680 * @param[in] *pSrc points to the complex input vector
salvatoregulfo 8:346c55cb6033 6680 6681 * @param[out] *pDst points to the real output vector
salvatoregulfo 8:346c55cb6033 6681 6682 * @param[in] numSamples number of complex samples in the input vector
salvatoregulfo 8:346c55cb6033 6682 6683 * @return none.
salvatoregulfo 8:346c55cb6033 6683 6684 */
salvatoregulfo 8:346c55cb6033 6684 6685
salvatoregulfo 8:346c55cb6033 6685 6686 void arm_cmplx_mag_f32(
salvatoregulfo 8:346c55cb6033 6686 6687 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6687 6688 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 6688 6689 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6689 6690
salvatoregulfo 8:346c55cb6033 6690 6691 /**
salvatoregulfo 8:346c55cb6033 6691 6692 * @brief Q31 complex magnitude
salvatoregulfo 8:346c55cb6033 6692 6693 * @param[in] *pSrc points to the complex input vector
salvatoregulfo 8:346c55cb6033 6693 6694 * @param[out] *pDst points to the real output vector
salvatoregulfo 8:346c55cb6033 6694 6695 * @param[in] numSamples number of complex samples in the input vector
salvatoregulfo 8:346c55cb6033 6695 6696 * @return none.
salvatoregulfo 8:346c55cb6033 6696 6697 */
salvatoregulfo 8:346c55cb6033 6697 6698
salvatoregulfo 8:346c55cb6033 6698 6699 void arm_cmplx_mag_q31(
salvatoregulfo 8:346c55cb6033 6699 6700 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6700 6701 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 6701 6702 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6702 6703
salvatoregulfo 8:346c55cb6033 6703 6704 /**
salvatoregulfo 8:346c55cb6033 6704 6705 * @brief Q15 complex magnitude
salvatoregulfo 8:346c55cb6033 6705 6706 * @param[in] *pSrc points to the complex input vector
salvatoregulfo 8:346c55cb6033 6706 6707 * @param[out] *pDst points to the real output vector
salvatoregulfo 8:346c55cb6033 6707 6708 * @param[in] numSamples number of complex samples in the input vector
salvatoregulfo 8:346c55cb6033 6708 6709 * @return none.
salvatoregulfo 8:346c55cb6033 6709 6710 */
salvatoregulfo 8:346c55cb6033 6710 6711
salvatoregulfo 8:346c55cb6033 6711 6712 void arm_cmplx_mag_q15(
salvatoregulfo 8:346c55cb6033 6712 6713 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6713 6714 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 6714 6715 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6715 6716
salvatoregulfo 8:346c55cb6033 6716 6717 /**
salvatoregulfo 8:346c55cb6033 6717 6718 * @brief Q15 complex dot product
salvatoregulfo 8:346c55cb6033 6718 6719 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 6719 6720 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 6720 6721 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 6721 6722 * @param[out] *realResult real part of the result returned here
salvatoregulfo 8:346c55cb6033 6722 6723 * @param[out] *imagResult imaginary part of the result returned here
salvatoregulfo 8:346c55cb6033 6723 6724 * @return none.
salvatoregulfo 8:346c55cb6033 6724 6725 */
salvatoregulfo 8:346c55cb6033 6725 6726
salvatoregulfo 8:346c55cb6033 6726 6727 void arm_cmplx_dot_prod_q15(
salvatoregulfo 8:346c55cb6033 6727 6728 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 6728 6729 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 6729 6730 uint32_t numSamples,
salvatoregulfo 8:346c55cb6033 6730 6731 q31_t * realResult,
salvatoregulfo 8:346c55cb6033 6731 6732 q31_t * imagResult);
salvatoregulfo 8:346c55cb6033 6732 6733
salvatoregulfo 8:346c55cb6033 6733 6734 /**
salvatoregulfo 8:346c55cb6033 6734 6735 * @brief Q31 complex dot product
salvatoregulfo 8:346c55cb6033 6735 6736 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 6736 6737 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 6737 6738 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 6738 6739 * @param[out] *realResult real part of the result returned here
salvatoregulfo 8:346c55cb6033 6739 6740 * @param[out] *imagResult imaginary part of the result returned here
salvatoregulfo 8:346c55cb6033 6740 6741 * @return none.
salvatoregulfo 8:346c55cb6033 6741 6742 */
salvatoregulfo 8:346c55cb6033 6742 6743
salvatoregulfo 8:346c55cb6033 6743 6744 void arm_cmplx_dot_prod_q31(
salvatoregulfo 8:346c55cb6033 6744 6745 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 6745 6746 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 6746 6747 uint32_t numSamples,
salvatoregulfo 8:346c55cb6033 6747 6748 q63_t * realResult,
salvatoregulfo 8:346c55cb6033 6748 6749 q63_t * imagResult);
salvatoregulfo 8:346c55cb6033 6749 6750
salvatoregulfo 8:346c55cb6033 6750 6751 /**
salvatoregulfo 8:346c55cb6033 6751 6752 * @brief Floating-point complex dot product
salvatoregulfo 8:346c55cb6033 6752 6753 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 6753 6754 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 6754 6755 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 6755 6756 * @param[out] *realResult real part of the result returned here
salvatoregulfo 8:346c55cb6033 6756 6757 * @param[out] *imagResult imaginary part of the result returned here
salvatoregulfo 8:346c55cb6033 6757 6758 * @return none.
salvatoregulfo 8:346c55cb6033 6758 6759 */
salvatoregulfo 8:346c55cb6033 6759 6760
salvatoregulfo 8:346c55cb6033 6760 6761 void arm_cmplx_dot_prod_f32(
salvatoregulfo 8:346c55cb6033 6761 6762 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 6762 6763 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 6763 6764 uint32_t numSamples,
salvatoregulfo 8:346c55cb6033 6764 6765 float32_t * realResult,
salvatoregulfo 8:346c55cb6033 6765 6766 float32_t * imagResult);
salvatoregulfo 8:346c55cb6033 6766 6767
salvatoregulfo 8:346c55cb6033 6767 6768 /**
salvatoregulfo 8:346c55cb6033 6768 6769 * @brief Q15 complex-by-real multiplication
salvatoregulfo 8:346c55cb6033 6769 6770 * @param[in] *pSrcCmplx points to the complex input vector
salvatoregulfo 8:346c55cb6033 6770 6771 * @param[in] *pSrcReal points to the real input vector
salvatoregulfo 8:346c55cb6033 6771 6772 * @param[out] *pCmplxDst points to the complex output vector
salvatoregulfo 8:346c55cb6033 6772 6773 * @param[in] numSamples number of samples in each vector
salvatoregulfo 8:346c55cb6033 6773 6774 * @return none.
salvatoregulfo 8:346c55cb6033 6774 6775 */
salvatoregulfo 8:346c55cb6033 6775 6776
salvatoregulfo 8:346c55cb6033 6776 6777 void arm_cmplx_mult_real_q15(
salvatoregulfo 8:346c55cb6033 6777 6778 q15_t * pSrcCmplx,
salvatoregulfo 8:346c55cb6033 6778 6779 q15_t * pSrcReal,
salvatoregulfo 8:346c55cb6033 6779 6780 q15_t * pCmplxDst,
salvatoregulfo 8:346c55cb6033 6780 6781 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6781 6782
salvatoregulfo 8:346c55cb6033 6782 6783 /**
salvatoregulfo 8:346c55cb6033 6783 6784 * @brief Q31 complex-by-real multiplication
salvatoregulfo 8:346c55cb6033 6784 6785 * @param[in] *pSrcCmplx points to the complex input vector
salvatoregulfo 8:346c55cb6033 6785 6786 * @param[in] *pSrcReal points to the real input vector
salvatoregulfo 8:346c55cb6033 6786 6787 * @param[out] *pCmplxDst points to the complex output vector
salvatoregulfo 8:346c55cb6033 6787 6788 * @param[in] numSamples number of samples in each vector
salvatoregulfo 8:346c55cb6033 6788 6789 * @return none.
salvatoregulfo 8:346c55cb6033 6789 6790 */
salvatoregulfo 8:346c55cb6033 6790 6791
salvatoregulfo 8:346c55cb6033 6791 6792 void arm_cmplx_mult_real_q31(
salvatoregulfo 8:346c55cb6033 6792 6793 q31_t * pSrcCmplx,
salvatoregulfo 8:346c55cb6033 6793 6794 q31_t * pSrcReal,
salvatoregulfo 8:346c55cb6033 6794 6795 q31_t * pCmplxDst,
salvatoregulfo 8:346c55cb6033 6795 6796 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6796 6797
salvatoregulfo 8:346c55cb6033 6797 6798 /**
salvatoregulfo 8:346c55cb6033 6798 6799 * @brief Floating-point complex-by-real multiplication
salvatoregulfo 8:346c55cb6033 6799 6800 * @param[in] *pSrcCmplx points to the complex input vector
salvatoregulfo 8:346c55cb6033 6800 6801 * @param[in] *pSrcReal points to the real input vector
salvatoregulfo 8:346c55cb6033 6801 6802 * @param[out] *pCmplxDst points to the complex output vector
salvatoregulfo 8:346c55cb6033 6802 6803 * @param[in] numSamples number of samples in each vector
salvatoregulfo 8:346c55cb6033 6803 6804 * @return none.
salvatoregulfo 8:346c55cb6033 6804 6805 */
salvatoregulfo 8:346c55cb6033 6805 6806
salvatoregulfo 8:346c55cb6033 6806 6807 void arm_cmplx_mult_real_f32(
salvatoregulfo 8:346c55cb6033 6807 6808 float32_t * pSrcCmplx,
salvatoregulfo 8:346c55cb6033 6808 6809 float32_t * pSrcReal,
salvatoregulfo 8:346c55cb6033 6809 6810 float32_t * pCmplxDst,
salvatoregulfo 8:346c55cb6033 6810 6811 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6811 6812
salvatoregulfo 8:346c55cb6033 6812 6813 /**
salvatoregulfo 8:346c55cb6033 6813 6814 * @brief Minimum value of a Q7 vector.
salvatoregulfo 8:346c55cb6033 6814 6815 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6815 6816 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6816 6817 * @param[out] *result is output pointer
salvatoregulfo 8:346c55cb6033 6817 6818 * @param[in] index is the array index of the minimum value in the input buffer.
salvatoregulfo 8:346c55cb6033 6818 6819 * @return none.
salvatoregulfo 8:346c55cb6033 6819 6820 */
salvatoregulfo 8:346c55cb6033 6820 6821
salvatoregulfo 8:346c55cb6033 6821 6822 void arm_min_q7(
salvatoregulfo 8:346c55cb6033 6822 6823 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 6823 6824 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6824 6825 q7_t * result,
salvatoregulfo 8:346c55cb6033 6825 6826 uint32_t * index);
salvatoregulfo 8:346c55cb6033 6826 6827
salvatoregulfo 8:346c55cb6033 6827 6828 /**
salvatoregulfo 8:346c55cb6033 6828 6829 * @brief Minimum value of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6829 6830 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6830 6831 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6831 6832 * @param[out] *pResult is output pointer
salvatoregulfo 8:346c55cb6033 6832 6833 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
salvatoregulfo 8:346c55cb6033 6833 6834 * @return none.
salvatoregulfo 8:346c55cb6033 6834 6835 */
salvatoregulfo 8:346c55cb6033 6835 6836
salvatoregulfo 8:346c55cb6033 6836 6837 void arm_min_q15(
salvatoregulfo 8:346c55cb6033 6837 6838 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6838 6839 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6839 6840 q15_t * pResult,
salvatoregulfo 8:346c55cb6033 6840 6841 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6841 6842
salvatoregulfo 8:346c55cb6033 6842 6843 /**
salvatoregulfo 8:346c55cb6033 6843 6844 * @brief Minimum value of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6844 6845 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6845 6846 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6846 6847 * @param[out] *pResult is output pointer
salvatoregulfo 8:346c55cb6033 6847 6848 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
salvatoregulfo 8:346c55cb6033 6848 6849 * @return none.
salvatoregulfo 8:346c55cb6033 6849 6850 */
salvatoregulfo 8:346c55cb6033 6850 6851 void arm_min_q31(
salvatoregulfo 8:346c55cb6033 6851 6852 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6852 6853 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6853 6854 q31_t * pResult,
salvatoregulfo 8:346c55cb6033 6854 6855 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6855 6856
salvatoregulfo 8:346c55cb6033 6856 6857 /**
salvatoregulfo 8:346c55cb6033 6857 6858 * @brief Minimum value of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6858 6859 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 6859 6860 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 6860 6861 * @param[out] *pResult is output pointer
salvatoregulfo 8:346c55cb6033 6861 6862 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
salvatoregulfo 8:346c55cb6033 6862 6863 * @return none.
salvatoregulfo 8:346c55cb6033 6863 6864 */
salvatoregulfo 8:346c55cb6033 6864 6865
salvatoregulfo 8:346c55cb6033 6865 6866 void arm_min_f32(
salvatoregulfo 8:346c55cb6033 6866 6867 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6867 6868 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6868 6869 float32_t * pResult,
salvatoregulfo 8:346c55cb6033 6869 6870 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6870 6871
salvatoregulfo 8:346c55cb6033 6871 6872 /**
salvatoregulfo 8:346c55cb6033 6872 6873 * @brief Maximum value of a Q7 vector.
salvatoregulfo 8:346c55cb6033 6873 6874 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 6874 6875 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 6875 6876 * @param[out] *pResult maximum value returned here
salvatoregulfo 8:346c55cb6033 6876 6877 * @param[out] *pIndex index of maximum value returned here
salvatoregulfo 8:346c55cb6033 6877 6878 * @return none.
salvatoregulfo 8:346c55cb6033 6878 6879 */
salvatoregulfo 8:346c55cb6033 6879 6880
salvatoregulfo 8:346c55cb6033 6880 6881 void arm_max_q7(
salvatoregulfo 8:346c55cb6033 6881 6882 q7_t * pSrc,
salvatoregulfo 8:346c55cb6033 6882 6883 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6883 6884 q7_t * pResult,
salvatoregulfo 8:346c55cb6033 6884 6885 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6885 6886
salvatoregulfo 8:346c55cb6033 6886 6887 /**
salvatoregulfo 8:346c55cb6033 6887 6888 * @brief Maximum value of a Q15 vector.
salvatoregulfo 8:346c55cb6033 6888 6889 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 6889 6890 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 6890 6891 * @param[out] *pResult maximum value returned here
salvatoregulfo 8:346c55cb6033 6891 6892 * @param[out] *pIndex index of maximum value returned here
salvatoregulfo 8:346c55cb6033 6892 6893 * @return none.
salvatoregulfo 8:346c55cb6033 6893 6894 */
salvatoregulfo 8:346c55cb6033 6894 6895
salvatoregulfo 8:346c55cb6033 6895 6896 void arm_max_q15(
salvatoregulfo 8:346c55cb6033 6896 6897 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 6897 6898 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6898 6899 q15_t * pResult,
salvatoregulfo 8:346c55cb6033 6899 6900 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6900 6901
salvatoregulfo 8:346c55cb6033 6901 6902 /**
salvatoregulfo 8:346c55cb6033 6902 6903 * @brief Maximum value of a Q31 vector.
salvatoregulfo 8:346c55cb6033 6903 6904 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 6904 6905 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 6905 6906 * @param[out] *pResult maximum value returned here
salvatoregulfo 8:346c55cb6033 6906 6907 * @param[out] *pIndex index of maximum value returned here
salvatoregulfo 8:346c55cb6033 6907 6908 * @return none.
salvatoregulfo 8:346c55cb6033 6908 6909 */
salvatoregulfo 8:346c55cb6033 6909 6910
salvatoregulfo 8:346c55cb6033 6910 6911 void arm_max_q31(
salvatoregulfo 8:346c55cb6033 6911 6912 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 6912 6913 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6913 6914 q31_t * pResult,
salvatoregulfo 8:346c55cb6033 6914 6915 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6915 6916
salvatoregulfo 8:346c55cb6033 6916 6917 /**
salvatoregulfo 8:346c55cb6033 6917 6918 * @brief Maximum value of a floating-point vector.
salvatoregulfo 8:346c55cb6033 6918 6919 * @param[in] *pSrc points to the input buffer
salvatoregulfo 8:346c55cb6033 6919 6920 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 6920 6921 * @param[out] *pResult maximum value returned here
salvatoregulfo 8:346c55cb6033 6921 6922 * @param[out] *pIndex index of maximum value returned here
salvatoregulfo 8:346c55cb6033 6922 6923 * @return none.
salvatoregulfo 8:346c55cb6033 6923 6924 */
salvatoregulfo 8:346c55cb6033 6924 6925
salvatoregulfo 8:346c55cb6033 6925 6926 void arm_max_f32(
salvatoregulfo 8:346c55cb6033 6926 6927 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6927 6928 uint32_t blockSize,
salvatoregulfo 8:346c55cb6033 6928 6929 float32_t * pResult,
salvatoregulfo 8:346c55cb6033 6929 6930 uint32_t * pIndex);
salvatoregulfo 8:346c55cb6033 6930 6931
salvatoregulfo 8:346c55cb6033 6931 6932 /**
salvatoregulfo 8:346c55cb6033 6932 6933 * @brief Q15 complex-by-complex multiplication
salvatoregulfo 8:346c55cb6033 6933 6934 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 6934 6935 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 6935 6936 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 6936 6937 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 6937 6938 * @return none.
salvatoregulfo 8:346c55cb6033 6938 6939 */
salvatoregulfo 8:346c55cb6033 6939 6940
salvatoregulfo 8:346c55cb6033 6940 6941 void arm_cmplx_mult_cmplx_q15(
salvatoregulfo 8:346c55cb6033 6941 6942 q15_t * pSrcA,
salvatoregulfo 8:346c55cb6033 6942 6943 q15_t * pSrcB,
salvatoregulfo 8:346c55cb6033 6943 6944 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 6944 6945 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6945 6946
salvatoregulfo 8:346c55cb6033 6946 6947 /**
salvatoregulfo 8:346c55cb6033 6947 6948 * @brief Q31 complex-by-complex multiplication
salvatoregulfo 8:346c55cb6033 6948 6949 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 6949 6950 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 6950 6951 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 6951 6952 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 6952 6953 * @return none.
salvatoregulfo 8:346c55cb6033 6953 6954 */
salvatoregulfo 8:346c55cb6033 6954 6955
salvatoregulfo 8:346c55cb6033 6955 6956 void arm_cmplx_mult_cmplx_q31(
salvatoregulfo 8:346c55cb6033 6956 6957 q31_t * pSrcA,
salvatoregulfo 8:346c55cb6033 6957 6958 q31_t * pSrcB,
salvatoregulfo 8:346c55cb6033 6958 6959 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 6959 6960 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6960 6961
salvatoregulfo 8:346c55cb6033 6961 6962 /**
salvatoregulfo 8:346c55cb6033 6962 6963 * @brief Floating-point complex-by-complex multiplication
salvatoregulfo 8:346c55cb6033 6963 6964 * @param[in] *pSrcA points to the first input vector
salvatoregulfo 8:346c55cb6033 6964 6965 * @param[in] *pSrcB points to the second input vector
salvatoregulfo 8:346c55cb6033 6965 6966 * @param[out] *pDst points to the output vector
salvatoregulfo 8:346c55cb6033 6966 6967 * @param[in] numSamples number of complex samples in each vector
salvatoregulfo 8:346c55cb6033 6967 6968 * @return none.
salvatoregulfo 8:346c55cb6033 6968 6969 */
salvatoregulfo 8:346c55cb6033 6969 6970
salvatoregulfo 8:346c55cb6033 6970 6971 void arm_cmplx_mult_cmplx_f32(
salvatoregulfo 8:346c55cb6033 6971 6972 float32_t * pSrcA,
salvatoregulfo 8:346c55cb6033 6972 6973 float32_t * pSrcB,
salvatoregulfo 8:346c55cb6033 6973 6974 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 6974 6975 uint32_t numSamples);
salvatoregulfo 8:346c55cb6033 6975 6976
salvatoregulfo 8:346c55cb6033 6976 6977 /**
salvatoregulfo 8:346c55cb6033 6977 6978 * @brief Converts the elements of the floating-point vector to Q31 vector.
salvatoregulfo 8:346c55cb6033 6978 6979 * @param[in] *pSrc points to the floating-point input vector
salvatoregulfo 8:346c55cb6033 6979 6980 * @param[out] *pDst points to the Q31 output vector
salvatoregulfo 8:346c55cb6033 6980 6981 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 6981 6982 * @return none.
salvatoregulfo 8:346c55cb6033 6982 6983 */
salvatoregulfo 8:346c55cb6033 6983 6984 void arm_float_to_q31(
salvatoregulfo 8:346c55cb6033 6984 6985 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6985 6986 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 6986 6987 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 6987 6988
salvatoregulfo 8:346c55cb6033 6988 6989 /**
salvatoregulfo 8:346c55cb6033 6989 6990 * @brief Converts the elements of the floating-point vector to Q15 vector.
salvatoregulfo 8:346c55cb6033 6990 6991 * @param[in] *pSrc points to the floating-point input vector
salvatoregulfo 8:346c55cb6033 6991 6992 * @param[out] *pDst points to the Q15 output vector
salvatoregulfo 8:346c55cb6033 6992 6993 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 6993 6994 * @return none
salvatoregulfo 8:346c55cb6033 6994 6995 */
salvatoregulfo 8:346c55cb6033 6995 6996 void arm_float_to_q15(
salvatoregulfo 8:346c55cb6033 6996 6997 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 6997 6998 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 6998 6999 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 6999 7000
salvatoregulfo 8:346c55cb6033 7000 7001 /**
salvatoregulfo 8:346c55cb6033 7001 7002 * @brief Converts the elements of the floating-point vector to Q7 vector.
salvatoregulfo 8:346c55cb6033 7002 7003 * @param[in] *pSrc points to the floating-point input vector
salvatoregulfo 8:346c55cb6033 7003 7004 * @param[out] *pDst points to the Q7 output vector
salvatoregulfo 8:346c55cb6033 7004 7005 * @param[in] blockSize length of the input vector
salvatoregulfo 8:346c55cb6033 7005 7006 * @return none
salvatoregulfo 8:346c55cb6033 7006 7007 */
salvatoregulfo 8:346c55cb6033 7007 7008 void arm_float_to_q7(
salvatoregulfo 8:346c55cb6033 7008 7009 float32_t * pSrc,
salvatoregulfo 8:346c55cb6033 7009 7010 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 7010 7011 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 7011 7012
salvatoregulfo 8:346c55cb6033 7012 7013
salvatoregulfo 8:346c55cb6033 7013 7014 /**
salvatoregulfo 8:346c55cb6033 7014 7015 * @brief Converts the elements of the Q31 vector to Q15 vector.
salvatoregulfo 8:346c55cb6033 7015 7016 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 7016 7017 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 7017 7018 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 7018 7019 * @return none.
salvatoregulfo 8:346c55cb6033 7019 7020 */
salvatoregulfo 8:346c55cb6033 7020 7021 void arm_q31_to_q15(
salvatoregulfo 8:346c55cb6033 7021 7022 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 7022 7023 q15_t * pDst,
salvatoregulfo 8:346c55cb6033 7023 7024 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 7024 7025
salvatoregulfo 8:346c55cb6033 7025 7026 /**
salvatoregulfo 8:346c55cb6033 7026 7027 * @brief Converts the elements of the Q31 vector to Q7 vector.
salvatoregulfo 8:346c55cb6033 7027 7028 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 7028 7029 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 7029 7030 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 7030 7031 * @return none.
salvatoregulfo 8:346c55cb6033 7031 7032 */
salvatoregulfo 8:346c55cb6033 7032 7033 void arm_q31_to_q7(
salvatoregulfo 8:346c55cb6033 7033 7034 q31_t * pSrc,
salvatoregulfo 8:346c55cb6033 7034 7035 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 7035 7036 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 7036 7037
salvatoregulfo 8:346c55cb6033 7037 7038 /**
salvatoregulfo 8:346c55cb6033 7038 7039 * @brief Converts the elements of the Q15 vector to floating-point vector.
salvatoregulfo 8:346c55cb6033 7039 7040 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 7040 7041 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 7041 7042 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 7042 7043 * @return none.
salvatoregulfo 8:346c55cb6033 7043 7044 */
salvatoregulfo 8:346c55cb6033 7044 7045 void arm_q15_to_float(
salvatoregulfo 8:346c55cb6033 7045 7046 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 7046 7047 float32_t * pDst,
salvatoregulfo 8:346c55cb6033 7047 7048 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 7048 7049
salvatoregulfo 8:346c55cb6033 7049 7050
salvatoregulfo 8:346c55cb6033 7050 7051 /**
salvatoregulfo 8:346c55cb6033 7051 7052 * @brief Converts the elements of the Q15 vector to Q31 vector.
salvatoregulfo 8:346c55cb6033 7052 7053 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 7053 7054 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 7054 7055 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 7055 7056 * @return none.
salvatoregulfo 8:346c55cb6033 7056 7057 */
salvatoregulfo 8:346c55cb6033 7057 7058 void arm_q15_to_q31(
salvatoregulfo 8:346c55cb6033 7058 7059 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 7059 7060 q31_t * pDst,
salvatoregulfo 8:346c55cb6033 7060 7061 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 7061 7062
salvatoregulfo 8:346c55cb6033 7062 7063
salvatoregulfo 8:346c55cb6033 7063 7064 /**
salvatoregulfo 8:346c55cb6033 7064 7065 * @brief Converts the elements of the Q15 vector to Q7 vector.
salvatoregulfo 8:346c55cb6033 7065 7066 * @param[in] *pSrc is input pointer
salvatoregulfo 8:346c55cb6033 7066 7067 * @param[out] *pDst is output pointer
salvatoregulfo 8:346c55cb6033 7067 7068 * @param[in] blockSize is the number of samples to process
salvatoregulfo 8:346c55cb6033 7068 7069 * @return none.
salvatoregulfo 8:346c55cb6033 7069 7070 */
salvatoregulfo 8:346c55cb6033 7070 7071 void arm_q15_to_q7(
salvatoregulfo 8:346c55cb6033 7071 7072 q15_t * pSrc,
salvatoregulfo 8:346c55cb6033 7072 7073 q7_t * pDst,
salvatoregulfo 8:346c55cb6033 7073 7074 uint32_t blockSize);
salvatoregulfo 8:346c55cb6033 7074 7075
salvatoregulfo 8:346c55cb6033 7075 7076
salvatoregulfo 8:346c55cb6033 7076 7077 /**
salvatoregulfo 8:346c55cb6033 7077 7078 * @ingroup groupInterpolation
salvatoregulfo 8:346c55cb6033 7078 7079 */
salvatoregulfo 8:346c55cb6033 7079 7080
salvatoregulfo 8:346c55cb6033 7080 7081 /**
salvatoregulfo 8:346c55cb6033 7081 7082 * @defgroup BilinearInterpolate Bilinear Interpolation
salvatoregulfo 8:346c55cb6033 7082 7083 *
salvatoregulfo 8:346c55cb6033 7083 7084 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
salvatoregulfo 8:346c55cb6033 7084 7085 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
salvatoregulfo 8:346c55cb6033 7085 7086 * determines values between the grid points.
salvatoregulfo 8:346c55cb6033 7086 7087 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
salvatoregulfo 8:346c55cb6033 7087 7088 * Bilinear interpolation is often used in image processing to rescale images.
salvatoregulfo 8:346c55cb6033 7088 7089 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
salvatoregulfo 8:346c55cb6033 7089 7090 *
salvatoregulfo 8:346c55cb6033 7090 7091 * <b>Algorithm</b>
salvatoregulfo 8:346c55cb6033 7091 7092 * \par
salvatoregulfo 8:346c55cb6033 7092 7093 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
salvatoregulfo 8:346c55cb6033 7093 7094 * For floating-point, the instance structure is defined as:
salvatoregulfo 8:346c55cb6033 7094 7095 * <pre>
salvatoregulfo 8:346c55cb6033 7095 7096 * typedef struct
salvatoregulfo 8:346c55cb6033 7096 7097 * {
salvatoregulfo 8:346c55cb6033 7097 7098 * uint16_t numRows;
salvatoregulfo 8:346c55cb6033 7098 7099 * uint16_t numCols;
salvatoregulfo 8:346c55cb6033 7099 7100 * float32_t *pData;
salvatoregulfo 8:346c55cb6033 7100 7101 * } arm_bilinear_interp_instance_f32;
salvatoregulfo 8:346c55cb6033 7101 7102 * </pre>
salvatoregulfo 8:346c55cb6033 7102 7103 *
salvatoregulfo 8:346c55cb6033 7103 7104 * \par
salvatoregulfo 8:346c55cb6033 7104 7105 * where <code>numRows</code> specifies the number of rows in the table;
salvatoregulfo 8:346c55cb6033 7105 7106 * <code>numCols</code> specifies the number of columns in the table;
salvatoregulfo 8:346c55cb6033 7106 7107 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
salvatoregulfo 8:346c55cb6033 7107 7108 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
salvatoregulfo 8:346c55cb6033 7108 7109 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
salvatoregulfo 8:346c55cb6033 7109 7110 *
salvatoregulfo 8:346c55cb6033 7110 7111 * \par
salvatoregulfo 8:346c55cb6033 7111 7112 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
salvatoregulfo 8:346c55cb6033 7112 7113 * <pre>
salvatoregulfo 8:346c55cb6033 7113 7114 * XF = floor(x)
salvatoregulfo 8:346c55cb6033 7114 7115 * YF = floor(y)
salvatoregulfo 8:346c55cb6033 7115 7116 * </pre>
salvatoregulfo 8:346c55cb6033 7116 7117 * \par
salvatoregulfo 8:346c55cb6033 7117 7118 * The interpolated output point is computed as:
salvatoregulfo 8:346c55cb6033 7118 7119 * <pre>
salvatoregulfo 8:346c55cb6033 7119 7120 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
salvatoregulfo 8:346c55cb6033 7120 7121 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
salvatoregulfo 8:346c55cb6033 7121 7122 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
salvatoregulfo 8:346c55cb6033 7122 7123 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
salvatoregulfo 8:346c55cb6033 7123 7124 * </pre>
salvatoregulfo 8:346c55cb6033 7124 7125 * Note that the coordinates (x, y) contain integer and fractional components.
salvatoregulfo 8:346c55cb6033 7125 7126 * The integer components specify which portion of the table to use while the
salvatoregulfo 8:346c55cb6033 7126 7127 * fractional components control the interpolation processor.
salvatoregulfo 8:346c55cb6033 7127 7128 *
salvatoregulfo 8:346c55cb6033 7128 7129 * \par
salvatoregulfo 8:346c55cb6033 7129 7130 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
salvatoregulfo 8:346c55cb6033 7130 7131 */
salvatoregulfo 8:346c55cb6033 7131 7132
salvatoregulfo 8:346c55cb6033 7132 7133 /**
salvatoregulfo 8:346c55cb6033 7133 7134 * @addtogroup BilinearInterpolate
salvatoregulfo 8:346c55cb6033 7134 7135 * @{
salvatoregulfo 8:346c55cb6033 7135 7136 */
salvatoregulfo 8:346c55cb6033 7136 7137
salvatoregulfo 8:346c55cb6033 7137 7138 /**
salvatoregulfo 8:346c55cb6033 7138 7139 *
salvatoregulfo 8:346c55cb6033 7139 7140 * @brief Floating-point bilinear interpolation.
salvatoregulfo 8:346c55cb6033 7140 7141 * @param[in,out] *S points to an instance of the interpolation structure.
salvatoregulfo 8:346c55cb6033 7141 7142 * @param[in] X interpolation coordinate.
salvatoregulfo 8:346c55cb6033 7142 7143 * @param[in] Y interpolation coordinate.
salvatoregulfo 8:346c55cb6033 7143 7144 * @return out interpolated value.
salvatoregulfo 8:346c55cb6033 7144 7145 */
salvatoregulfo 8:346c55cb6033 7145 7146
salvatoregulfo 8:346c55cb6033 7146 7147
salvatoregulfo 8:346c55cb6033 7147 7148 static __INLINE float32_t arm_bilinear_interp_f32(
salvatoregulfo 8:346c55cb6033 7148 7149 const arm_bilinear_interp_instance_f32 * S,
salvatoregulfo 8:346c55cb6033 7149 7150 float32_t X,
salvatoregulfo 8:346c55cb6033 7150 7151 float32_t Y)
salvatoregulfo 8:346c55cb6033 7151 7152 {
salvatoregulfo 8:346c55cb6033 7152 7153 float32_t out;
salvatoregulfo 8:346c55cb6033 7153 7154 float32_t f00, f01, f10, f11;
salvatoregulfo 8:346c55cb6033 7154 7155 float32_t *pData = S->pData;
salvatoregulfo 8:346c55cb6033 7155 7156 int32_t xIndex, yIndex, index;
salvatoregulfo 8:346c55cb6033 7156 7157 float32_t xdiff, ydiff;
salvatoregulfo 8:346c55cb6033 7157 7158 float32_t b1, b2, b3, b4;
salvatoregulfo 8:346c55cb6033 7158 7159
salvatoregulfo 8:346c55cb6033 7159 7160 xIndex = (int32_t) X;
salvatoregulfo 8:346c55cb6033 7160 7161 yIndex = (int32_t) Y;
salvatoregulfo 8:346c55cb6033 7161 7162
salvatoregulfo 8:346c55cb6033 7162 7163 /* Care taken for table outside boundary */
salvatoregulfo 8:346c55cb6033 7163 7164 /* Returns zero output when values are outside table boundary */
salvatoregulfo 8:346c55cb6033 7164 7165 if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
salvatoregulfo 8:346c55cb6033 7165 7166 || yIndex > (S->numCols - 1))
salvatoregulfo 8:346c55cb6033 7166 7167 {
salvatoregulfo 8:346c55cb6033 7167 7168 return (0);
salvatoregulfo 8:346c55cb6033 7168 7169 }
salvatoregulfo 8:346c55cb6033 7169 7170
salvatoregulfo 8:346c55cb6033 7170 7171 /* Calculation of index for two nearest points in X-direction */
salvatoregulfo 8:346c55cb6033 7171 7172 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
salvatoregulfo 8:346c55cb6033 7172 7173
salvatoregulfo 8:346c55cb6033 7173 7174
salvatoregulfo 8:346c55cb6033 7174 7175 /* Read two nearest points in X-direction */
salvatoregulfo 8:346c55cb6033 7175 7176 f00 = pData[index];
salvatoregulfo 8:346c55cb6033 7176 7177 f01 = pData[index + 1];
salvatoregulfo 8:346c55cb6033 7177 7178
salvatoregulfo 8:346c55cb6033 7178 7179 /* Calculation of index for two nearest points in Y-direction */
salvatoregulfo 8:346c55cb6033 7179 7180 index = (xIndex - 1) + (yIndex) * S->numCols;
salvatoregulfo 8:346c55cb6033 7180 7181
salvatoregulfo 8:346c55cb6033 7181 7182
salvatoregulfo 8:346c55cb6033 7182 7183 /* Read two nearest points in Y-direction */
salvatoregulfo 8:346c55cb6033 7183 7184 f10 = pData[index];
salvatoregulfo 8:346c55cb6033 7184 7185 f11 = pData[index + 1];
salvatoregulfo 8:346c55cb6033 7185 7186
salvatoregulfo 8:346c55cb6033 7186 7187 /* Calculation of intermediate values */
salvatoregulfo 8:346c55cb6033 7187 7188 b1 = f00;
salvatoregulfo 8:346c55cb6033 7188 7189 b2 = f01 - f00;
salvatoregulfo 8:346c55cb6033 7189 7190 b3 = f10 - f00;
salvatoregulfo 8:346c55cb6033 7190 7191 b4 = f00 - f01 - f10 + f11;
salvatoregulfo 8:346c55cb6033 7191 7192
salvatoregulfo 8:346c55cb6033 7192 7193 /* Calculation of fractional part in X */
salvatoregulfo 8:346c55cb6033 7193 7194 xdiff = X - xIndex;
salvatoregulfo 8:346c55cb6033 7194 7195
salvatoregulfo 8:346c55cb6033 7195 7196 /* Calculation of fractional part in Y */
salvatoregulfo 8:346c55cb6033 7196 7197 ydiff = Y - yIndex;
salvatoregulfo 8:346c55cb6033 7197 7198
salvatoregulfo 8:346c55cb6033 7198 7199 /* Calculation of bi-linear interpolated output */
salvatoregulfo 8:346c55cb6033 7199 7200 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
salvatoregulfo 8:346c55cb6033 7200 7201
salvatoregulfo 8:346c55cb6033 7201 7202 /* return to application */
salvatoregulfo 8:346c55cb6033 7202 7203 return (out);
salvatoregulfo 8:346c55cb6033 7203 7204
salvatoregulfo 8:346c55cb6033 7204 7205 }
salvatoregulfo 8:346c55cb6033 7205 7206
salvatoregulfo 8:346c55cb6033 7206 7207 /**
salvatoregulfo 8:346c55cb6033 7207 7208 *
salvatoregulfo 8:346c55cb6033 7208 7209 * @brief Q31 bilinear interpolation.
salvatoregulfo 8:346c55cb6033 7209 7210 * @param[in,out] *S points to an instance of the interpolation structure.
salvatoregulfo 8:346c55cb6033 7210 7211 * @param[in] X interpolation coordinate in 12.20 format.
salvatoregulfo 8:346c55cb6033 7211 7212 * @param[in] Y interpolation coordinate in 12.20 format.
salvatoregulfo 8:346c55cb6033 7212 7213 * @return out interpolated value.
salvatoregulfo 8:346c55cb6033 7213 7214 */
salvatoregulfo 8:346c55cb6033 7214 7215
salvatoregulfo 8:346c55cb6033 7215 7216 static __INLINE q31_t arm_bilinear_interp_q31(
salvatoregulfo 8:346c55cb6033 7216 7217 arm_bilinear_interp_instance_q31 * S,
salvatoregulfo 8:346c55cb6033 7217 7218 q31_t X,
salvatoregulfo 8:346c55cb6033 7218 7219 q31_t Y)
salvatoregulfo 8:346c55cb6033 7219 7220 {
salvatoregulfo 8:346c55cb6033 7220 7221 q31_t out; /* Temporary output */
salvatoregulfo 8:346c55cb6033 7221 7222 q31_t acc = 0; /* output */
salvatoregulfo 8:346c55cb6033 7222 7223 q31_t xfract, yfract; /* X, Y fractional parts */
salvatoregulfo 8:346c55cb6033 7223 7224 q31_t x1, x2, y1, y2; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 7224 7225 int32_t rI, cI; /* Row and column indices */
salvatoregulfo 8:346c55cb6033 7225 7226 q31_t *pYData = S->pData; /* pointer to output table values */
salvatoregulfo 8:346c55cb6033 7226 7227 uint32_t nCols = S->numCols; /* num of rows */
salvatoregulfo 8:346c55cb6033 7227 7228
salvatoregulfo 8:346c55cb6033 7228 7229
salvatoregulfo 8:346c55cb6033 7229 7230 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 7230 7231 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 7231 7232 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 7232 7233 rI = ((X & 0xFFF00000) >> 20u);
salvatoregulfo 8:346c55cb6033 7233 7234
salvatoregulfo 8:346c55cb6033 7234 7235 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 7235 7236 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 7236 7237 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 7237 7238 cI = ((Y & 0xFFF00000) >> 20u);
salvatoregulfo 8:346c55cb6033 7238 7239
salvatoregulfo 8:346c55cb6033 7239 7240 /* Care taken for table outside boundary */
salvatoregulfo 8:346c55cb6033 7240 7241 /* Returns zero output when values are outside table boundary */
salvatoregulfo 8:346c55cb6033 7241 7242 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
salvatoregulfo 8:346c55cb6033 7242 7243 {
salvatoregulfo 8:346c55cb6033 7243 7244 return (0);
salvatoregulfo 8:346c55cb6033 7244 7245 }
salvatoregulfo 8:346c55cb6033 7245 7246
salvatoregulfo 8:346c55cb6033 7246 7247 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 7247 7248 /* shift left xfract by 11 to keep 1.31 format */
salvatoregulfo 8:346c55cb6033 7248 7249 xfract = (X & 0x000FFFFF) << 11u;
salvatoregulfo 8:346c55cb6033 7249 7250
salvatoregulfo 8:346c55cb6033 7250 7251 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 7251 7252 x1 = pYData[(rI) + nCols * (cI)];
salvatoregulfo 8:346c55cb6033 7252 7253 x2 = pYData[(rI) + nCols * (cI) + 1u];
salvatoregulfo 8:346c55cb6033 7253 7254
salvatoregulfo 8:346c55cb6033 7254 7255 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 7255 7256 /* shift left yfract by 11 to keep 1.31 format */
salvatoregulfo 8:346c55cb6033 7256 7257 yfract = (Y & 0x000FFFFF) << 11u;
salvatoregulfo 8:346c55cb6033 7257 7258
salvatoregulfo 8:346c55cb6033 7258 7259 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 7259 7260 y1 = pYData[(rI) + nCols * (cI + 1)];
salvatoregulfo 8:346c55cb6033 7260 7261 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
salvatoregulfo 8:346c55cb6033 7261 7262
salvatoregulfo 8:346c55cb6033 7262 7263 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
salvatoregulfo 8:346c55cb6033 7263 7264 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
salvatoregulfo 8:346c55cb6033 7264 7265 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
salvatoregulfo 8:346c55cb6033 7265 7266
salvatoregulfo 8:346c55cb6033 7266 7267 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
salvatoregulfo 8:346c55cb6033 7267 7268 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
salvatoregulfo 8:346c55cb6033 7268 7269 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
salvatoregulfo 8:346c55cb6033 7269 7270
salvatoregulfo 8:346c55cb6033 7270 7271 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
salvatoregulfo 8:346c55cb6033 7271 7272 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
salvatoregulfo 8:346c55cb6033 7272 7273 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
salvatoregulfo 8:346c55cb6033 7273 7274
salvatoregulfo 8:346c55cb6033 7274 7275 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
salvatoregulfo 8:346c55cb6033 7275 7276 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
salvatoregulfo 8:346c55cb6033 7276 7277 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
salvatoregulfo 8:346c55cb6033 7277 7278
salvatoregulfo 8:346c55cb6033 7278 7279 /* Convert acc to 1.31(q31) format */
salvatoregulfo 8:346c55cb6033 7279 7280 return (acc << 2u);
salvatoregulfo 8:346c55cb6033 7280 7281
salvatoregulfo 8:346c55cb6033 7281 7282 }
salvatoregulfo 8:346c55cb6033 7282 7283
salvatoregulfo 8:346c55cb6033 7283 7284 /**
salvatoregulfo 8:346c55cb6033 7284 7285 * @brief Q15 bilinear interpolation.
salvatoregulfo 8:346c55cb6033 7285 7286 * @param[in,out] *S points to an instance of the interpolation structure.
salvatoregulfo 8:346c55cb6033 7286 7287 * @param[in] X interpolation coordinate in 12.20 format.
salvatoregulfo 8:346c55cb6033 7287 7288 * @param[in] Y interpolation coordinate in 12.20 format.
salvatoregulfo 8:346c55cb6033 7288 7289 * @return out interpolated value.
salvatoregulfo 8:346c55cb6033 7289 7290 */
salvatoregulfo 8:346c55cb6033 7290 7291
salvatoregulfo 8:346c55cb6033 7291 7292 static __INLINE q15_t arm_bilinear_interp_q15(
salvatoregulfo 8:346c55cb6033 7292 7293 arm_bilinear_interp_instance_q15 * S,
salvatoregulfo 8:346c55cb6033 7293 7294 q31_t X,
salvatoregulfo 8:346c55cb6033 7294 7295 q31_t Y)
salvatoregulfo 8:346c55cb6033 7295 7296 {
salvatoregulfo 8:346c55cb6033 7296 7297 q63_t acc = 0; /* output */
salvatoregulfo 8:346c55cb6033 7297 7298 q31_t out; /* Temporary output */
salvatoregulfo 8:346c55cb6033 7298 7299 q15_t x1, x2, y1, y2; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 7299 7300 q31_t xfract, yfract; /* X, Y fractional parts */
salvatoregulfo 8:346c55cb6033 7300 7301 int32_t rI, cI; /* Row and column indices */
salvatoregulfo 8:346c55cb6033 7301 7302 q15_t *pYData = S->pData; /* pointer to output table values */
salvatoregulfo 8:346c55cb6033 7302 7303 uint32_t nCols = S->numCols; /* num of rows */
salvatoregulfo 8:346c55cb6033 7303 7304
salvatoregulfo 8:346c55cb6033 7304 7305 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 7305 7306 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 7306 7307 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 7307 7308 rI = ((X & 0xFFF00000) >> 20);
salvatoregulfo 8:346c55cb6033 7308 7309
salvatoregulfo 8:346c55cb6033 7309 7310 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 7310 7311 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 7311 7312 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 7312 7313 cI = ((Y & 0xFFF00000) >> 20);
salvatoregulfo 8:346c55cb6033 7313 7314
salvatoregulfo 8:346c55cb6033 7314 7315 /* Care taken for table outside boundary */
salvatoregulfo 8:346c55cb6033 7315 7316 /* Returns zero output when values are outside table boundary */
salvatoregulfo 8:346c55cb6033 7316 7317 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
salvatoregulfo 8:346c55cb6033 7317 7318 {
salvatoregulfo 8:346c55cb6033 7318 7319 return (0);
salvatoregulfo 8:346c55cb6033 7319 7320 }
salvatoregulfo 8:346c55cb6033 7320 7321
salvatoregulfo 8:346c55cb6033 7321 7322 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 7322 7323 /* xfract should be in 12.20 format */
salvatoregulfo 8:346c55cb6033 7323 7324 xfract = (X & 0x000FFFFF);
salvatoregulfo 8:346c55cb6033 7324 7325
salvatoregulfo 8:346c55cb6033 7325 7326 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 7326 7327 x1 = pYData[(rI) + nCols * (cI)];
salvatoregulfo 8:346c55cb6033 7327 7328 x2 = pYData[(rI) + nCols * (cI) + 1u];
salvatoregulfo 8:346c55cb6033 7328 7329
salvatoregulfo 8:346c55cb6033 7329 7330
salvatoregulfo 8:346c55cb6033 7330 7331 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 7331 7332 /* yfract should be in 12.20 format */
salvatoregulfo 8:346c55cb6033 7332 7333 yfract = (Y & 0x000FFFFF);
salvatoregulfo 8:346c55cb6033 7333 7334
salvatoregulfo 8:346c55cb6033 7334 7335 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 7335 7336 y1 = pYData[(rI) + nCols * (cI + 1)];
salvatoregulfo 8:346c55cb6033 7336 7337 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
salvatoregulfo 8:346c55cb6033 7337 7338
salvatoregulfo 8:346c55cb6033 7338 7339 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
salvatoregulfo 8:346c55cb6033 7339 7340
salvatoregulfo 8:346c55cb6033 7340 7341 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
salvatoregulfo 8:346c55cb6033 7341 7342 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
salvatoregulfo 8:346c55cb6033 7342 7343 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
salvatoregulfo 8:346c55cb6033 7343 7344 acc = ((q63_t) out * (0xFFFFF - yfract));
salvatoregulfo 8:346c55cb6033 7344 7345
salvatoregulfo 8:346c55cb6033 7345 7346 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
salvatoregulfo 8:346c55cb6033 7346 7347 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
salvatoregulfo 8:346c55cb6033 7347 7348 acc += ((q63_t) out * (xfract));
salvatoregulfo 8:346c55cb6033 7348 7349
salvatoregulfo 8:346c55cb6033 7349 7350 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
salvatoregulfo 8:346c55cb6033 7350 7351 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
salvatoregulfo 8:346c55cb6033 7351 7352 acc += ((q63_t) out * (yfract));
salvatoregulfo 8:346c55cb6033 7352 7353
salvatoregulfo 8:346c55cb6033 7353 7354 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
salvatoregulfo 8:346c55cb6033 7354 7355 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
salvatoregulfo 8:346c55cb6033 7355 7356 acc += ((q63_t) out * (yfract));
salvatoregulfo 8:346c55cb6033 7356 7357
salvatoregulfo 8:346c55cb6033 7357 7358 /* acc is in 13.51 format and down shift acc by 36 times */
salvatoregulfo 8:346c55cb6033 7358 7359 /* Convert out to 1.15 format */
salvatoregulfo 8:346c55cb6033 7359 7360 return (acc >> 36);
salvatoregulfo 8:346c55cb6033 7360 7361
salvatoregulfo 8:346c55cb6033 7361 7362 }
salvatoregulfo 8:346c55cb6033 7362 7363
salvatoregulfo 8:346c55cb6033 7363 7364 /**
salvatoregulfo 8:346c55cb6033 7364 7365 * @brief Q7 bilinear interpolation.
salvatoregulfo 8:346c55cb6033 7365 7366 * @param[in,out] *S points to an instance of the interpolation structure.
salvatoregulfo 8:346c55cb6033 7366 7367 * @param[in] X interpolation coordinate in 12.20 format.
salvatoregulfo 8:346c55cb6033 7367 7368 * @param[in] Y interpolation coordinate in 12.20 format.
salvatoregulfo 8:346c55cb6033 7368 7369 * @return out interpolated value.
salvatoregulfo 8:346c55cb6033 7369 7370 */
salvatoregulfo 8:346c55cb6033 7370 7371
salvatoregulfo 8:346c55cb6033 7371 7372 static __INLINE q7_t arm_bilinear_interp_q7(
salvatoregulfo 8:346c55cb6033 7372 7373 arm_bilinear_interp_instance_q7 * S,
salvatoregulfo 8:346c55cb6033 7373 7374 q31_t X,
salvatoregulfo 8:346c55cb6033 7374 7375 q31_t Y)
salvatoregulfo 8:346c55cb6033 7375 7376 {
salvatoregulfo 8:346c55cb6033 7376 7377 q63_t acc = 0; /* output */
salvatoregulfo 8:346c55cb6033 7377 7378 q31_t out; /* Temporary output */
salvatoregulfo 8:346c55cb6033 7378 7379 q31_t xfract, yfract; /* X, Y fractional parts */
salvatoregulfo 8:346c55cb6033 7379 7380 q7_t x1, x2, y1, y2; /* Nearest output values */
salvatoregulfo 8:346c55cb6033 7380 7381 int32_t rI, cI; /* Row and column indices */
salvatoregulfo 8:346c55cb6033 7381 7382 q7_t *pYData = S->pData; /* pointer to output table values */
salvatoregulfo 8:346c55cb6033 7382 7383 uint32_t nCols = S->numCols; /* num of rows */
salvatoregulfo 8:346c55cb6033 7383 7384
salvatoregulfo 8:346c55cb6033 7384 7385 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 7385 7386 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 7386 7387 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 7387 7388 rI = ((X & 0xFFF00000) >> 20);
salvatoregulfo 8:346c55cb6033 7388 7389
salvatoregulfo 8:346c55cb6033 7389 7390 /* Input is in 12.20 format */
salvatoregulfo 8:346c55cb6033 7390 7391 /* 12 bits for the table index */
salvatoregulfo 8:346c55cb6033 7391 7392 /* Index value calculation */
salvatoregulfo 8:346c55cb6033 7392 7393 cI = ((Y & 0xFFF00000) >> 20);
salvatoregulfo 8:346c55cb6033 7393 7394
salvatoregulfo 8:346c55cb6033 7394 7395 /* Care taken for table outside boundary */
salvatoregulfo 8:346c55cb6033 7395 7396 /* Returns zero output when values are outside table boundary */
salvatoregulfo 8:346c55cb6033 7396 7397 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
salvatoregulfo 8:346c55cb6033 7397 7398 {
salvatoregulfo 8:346c55cb6033 7398 7399 return (0);
salvatoregulfo 8:346c55cb6033 7399 7400 }
salvatoregulfo 8:346c55cb6033 7400 7401
salvatoregulfo 8:346c55cb6033 7401 7402 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 7402 7403 /* xfract should be in 12.20 format */
salvatoregulfo 8:346c55cb6033 7403 7404 xfract = (X & 0x000FFFFF);
salvatoregulfo 8:346c55cb6033 7404 7405
salvatoregulfo 8:346c55cb6033 7405 7406 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 7406 7407 x1 = pYData[(rI) + nCols * (cI)];
salvatoregulfo 8:346c55cb6033 7407 7408 x2 = pYData[(rI) + nCols * (cI) + 1u];
salvatoregulfo 8:346c55cb6033 7408 7409
salvatoregulfo 8:346c55cb6033 7409 7410
salvatoregulfo 8:346c55cb6033 7410 7411 /* 20 bits for the fractional part */
salvatoregulfo 8:346c55cb6033 7411 7412 /* yfract should be in 12.20 format */
salvatoregulfo 8:346c55cb6033 7412 7413 yfract = (Y & 0x000FFFFF);
salvatoregulfo 8:346c55cb6033 7413 7414
salvatoregulfo 8:346c55cb6033 7414 7415 /* Read two nearest output values from the index */
salvatoregulfo 8:346c55cb6033 7415 7416 y1 = pYData[(rI) + nCols * (cI + 1)];
salvatoregulfo 8:346c55cb6033 7416 7417 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
salvatoregulfo 8:346c55cb6033 7417 7418
salvatoregulfo 8:346c55cb6033 7418 7419 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
salvatoregulfo 8:346c55cb6033 7419 7420 out = ((x1 * (0xFFFFF - xfract)));
salvatoregulfo 8:346c55cb6033 7420 7421 acc = (((q63_t) out * (0xFFFFF - yfract)));
salvatoregulfo 8:346c55cb6033 7421 7422
salvatoregulfo 8:346c55cb6033 7422 7423 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
salvatoregulfo 8:346c55cb6033 7423 7424 out = ((x2 * (0xFFFFF - yfract)));
salvatoregulfo 8:346c55cb6033 7424 7425 acc += (((q63_t) out * (xfract)));
salvatoregulfo 8:346c55cb6033 7425 7426
salvatoregulfo 8:346c55cb6033 7426 7427 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
salvatoregulfo 8:346c55cb6033 7427 7428 out = ((y1 * (0xFFFFF - xfract)));
salvatoregulfo 8:346c55cb6033 7428 7429 acc += (((q63_t) out * (yfract)));
salvatoregulfo 8:346c55cb6033 7429 7430
salvatoregulfo 8:346c55cb6033 7430 7431 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
salvatoregulfo 8:346c55cb6033 7431 7432 out = ((y2 * (yfract)));
salvatoregulfo 8:346c55cb6033 7432 7433 acc += (((q63_t) out * (xfract)));
salvatoregulfo 8:346c55cb6033 7433 7434
salvatoregulfo 8:346c55cb6033 7434 7435 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
salvatoregulfo 8:346c55cb6033 7435 7436 return (acc >> 40);
salvatoregulfo 8:346c55cb6033 7436 7437
salvatoregulfo 8:346c55cb6033 7437 7438 }
salvatoregulfo 8:346c55cb6033 7438 7439
salvatoregulfo 8:346c55cb6033 7439 7440 /**
salvatoregulfo 8:346c55cb6033 7440 7441 * @} end of BilinearInterpolate group
salvatoregulfo 8:346c55cb6033 7441 7442 */
salvatoregulfo 8:346c55cb6033 7442 7443
salvatoregulfo 8:346c55cb6033 7443 7444
salvatoregulfo 8:346c55cb6033 7444 7445 //SMMLAR
salvatoregulfo 8:346c55cb6033 7445 7446 #define multAcc_32x32_keep32_R(a, x, y) \
salvatoregulfo 8:346c55cb6033 7446 7447 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
salvatoregulfo 8:346c55cb6033 7447 7448
salvatoregulfo 8:346c55cb6033 7448 7449 //SMMLSR
salvatoregulfo 8:346c55cb6033 7449 7450 #define multSub_32x32_keep32_R(a, x, y) \
salvatoregulfo 8:346c55cb6033 7450 7451 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
salvatoregulfo 8:346c55cb6033 7451 7452
salvatoregulfo 8:346c55cb6033 7452 7453 //SMMULR
salvatoregulfo 8:346c55cb6033 7453 7454 #define mult_32x32_keep32_R(a, x, y) \
salvatoregulfo 8:346c55cb6033 7454 7455 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
salvatoregulfo 8:346c55cb6033 7455 7456
salvatoregulfo 8:346c55cb6033 7456 7457 //SMMLA
salvatoregulfo 8:346c55cb6033 7457 7458 #define multAcc_32x32_keep32(a, x, y) \
salvatoregulfo 8:346c55cb6033 7458 7459 a += (q31_t) (((q63_t) x * y) >> 32)
salvatoregulfo 8:346c55cb6033 7459 7460
salvatoregulfo 8:346c55cb6033 7460 7461 //SMMLS
salvatoregulfo 8:346c55cb6033 7461 7462 #define multSub_32x32_keep32(a, x, y) \
salvatoregulfo 8:346c55cb6033 7462 7463 a -= (q31_t) (((q63_t) x * y) >> 32)
salvatoregulfo 8:346c55cb6033 7463 7464
salvatoregulfo 8:346c55cb6033 7464 7465 //SMMUL
salvatoregulfo 8:346c55cb6033 7465 7466 #define mult_32x32_keep32(a, x, y) \
salvatoregulfo 8:346c55cb6033 7466 7467 a = (q31_t) (((q63_t) x * y ) >> 32)
salvatoregulfo 8:346c55cb6033 7467 7468
salvatoregulfo 8:346c55cb6033 7468 7469
salvatoregulfo 8:346c55cb6033 7469 7470 #if defined ( __CC_ARM ) //Keil
salvatoregulfo 8:346c55cb6033 7470 7471
salvatoregulfo 8:346c55cb6033 7471 7472 //Enter low optimization region - place directly above function definition
salvatoregulfo 8:346c55cb6033 7472 7473 #ifdef ARM_MATH_CM4
salvatoregulfo 8:346c55cb6033 7473 7474 #define LOW_OPTIMIZATION_ENTER \
salvatoregulfo 8:346c55cb6033 7474 7475 _Pragma ("push") \
salvatoregulfo 8:346c55cb6033 7475 7476 _Pragma ("O1")
salvatoregulfo 8:346c55cb6033 7476 7477 #else
salvatoregulfo 8:346c55cb6033 7477 7478 #define LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7478 7479 #endif
salvatoregulfo 8:346c55cb6033 7479 7480
salvatoregulfo 8:346c55cb6033 7480 7481 //Exit low optimization region - place directly after end of function definition
salvatoregulfo 8:346c55cb6033 7481 7482 #ifdef ARM_MATH_CM4
salvatoregulfo 8:346c55cb6033 7482 7483 #define LOW_OPTIMIZATION_EXIT \
salvatoregulfo 8:346c55cb6033 7483 7484 _Pragma ("pop")
salvatoregulfo 8:346c55cb6033 7484 7485 #else
salvatoregulfo 8:346c55cb6033 7485 #define LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7486 7487 #endif
salvatoregulfo 8:346c55cb6033 7487 7488
salvatoregulfo 8:346c55cb6033 7488 7489 //Enter low optimization region - place directly above function definition
salvatoregulfo 8:346c55cb6033 7489 7490 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7490 7491
salvatoregulfo 8:346c55cb6033 7491 7492 //Exit low optimization region - place directly after end of function definition
salvatoregulfo 8:346c55cb6033 7492 7493 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7493 7494
salvatoregulfo 8:346c55cb6033 7494 7495 #elif defined(__ICCARM__) //IAR
salvatoregulfo 8:346c55cb6033 7495 7496
salvatoregulfo 8:346c55cb6033 7496 7497 //Enter low optimization region - place directly above function definition
salvatoregulfo 8:346c55cb6033 7497 7498 #ifdef ARM_MATH_CM4
salvatoregulfo 8:346c55cb6033 7498 7499 #define LOW_OPTIMIZATION_ENTER \
salvatoregulfo 8:346c55cb6033 7499 7500 _Pragma ("optimize=low")
salvatoregulfo 8:346c55cb6033 7500 7501 #else
salvatoregulfo 8:346c55cb6033 7501 7502 #define LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7502 7503 #endif
salvatoregulfo 8:346c55cb6033 7503 7504
salvatoregulfo 8:346c55cb6033 7504 7505 //Exit low optimization region - place directly after end of function definition
salvatoregulfo 8:346c55cb6033 7505 7506 #define LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7506 7507
salvatoregulfo 8:346c55cb6033 7507 7508 //Enter low optimization region - place directly above function definition
salvatoregulfo 8:346c55cb6033 7508 7509 #ifdef ARM_MATH_CM4
salvatoregulfo 8:346c55cb6033 7509 7510 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
salvatoregulfo 8:346c55cb6033 7510 7511 _Pragma ("optimize=low")
salvatoregulfo 8:346c55cb6033 7511 7512 #else
salvatoregulfo 8:346c55cb6033 7512 7513 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7513 7514 #endif
salvatoregulfo 8:346c55cb6033 7514 7515
salvatoregulfo 8:346c55cb6033 7515 7516 //Exit low optimization region - place directly after end of function definition
salvatoregulfo 8:346c55cb6033 7516 7517 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7517 7518
salvatoregulfo 8:346c55cb6033 7518 7519 #elif defined(__GNUC__)
salvatoregulfo 8:346c55cb6033 7519 7520
salvatoregulfo 8:346c55cb6033 7520 7521 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
salvatoregulfo 8:346c55cb6033 7521 7522
salvatoregulfo 8:346c55cb6033 7522 7523 #define LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7523 7524
salvatoregulfo 8:346c55cb6033 7524 7525 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7525 7526
salvatoregulfo 8:346c55cb6033 7526 7527 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7527 7528
salvatoregulfo 8:346c55cb6033 7528 7529 #elif defined(__CSMC__) // Cosmic
salvatoregulfo 8:346c55cb6033 7529 7530
salvatoregulfo 8:346c55cb6033 7530 7531 #define LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7531 7532 #define LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7532 7533 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7533 7534 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7534 7535
salvatoregulfo 8:346c55cb6033 7535 7536 #elif defined(__TASKING__) // TASKING
salvatoregulfo 8:346c55cb6033 7536 7537
salvatoregulfo 8:346c55cb6033 7537 7538 #define LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7538 7539 #define LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7539 7540 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
salvatoregulfo 8:346c55cb6033 7540 7541 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
salvatoregulfo 8:346c55cb6033 7541 7542
salvatoregulfo 8:346c55cb6033 7542 7543 #endif
salvatoregulfo 8:346c55cb6033 7543 7544
salvatoregulfo 8:346c55cb6033 7544 7545
salvatoregulfo 8:346c55cb6033 7545 7546 #ifdef __cplusplus
salvatoregulfo 8:346c55cb6033 7546 7547 }
salvatoregulfo 8:346c55cb6033 7547 7548 #endif
salvatoregulfo 8:346c55cb6033 7548 7549
salvatoregulfo 8:346c55cb6033 7549 7550
salvatoregulfo 8:346c55cb6033 7550 7551 #endif /* _ARM_MATH_H */
salvatoregulfo 8:346c55cb6033 7551 7552
salvatoregulfo 8:346c55cb6033 7552 7553 /**
salvatoregulfo 8:346c55cb6033 7553 7554 *
salvatoregulfo 8:346c55cb6033 7554 7555 * End of file.
salvatoregulfo 8:346c55cb6033 7555 7556 */