The main objective is to reduce loss in revenue due to delayed shelf-restocking (when product is in-stock in the store but not stocked on the shelf) and inaccurate forecasting (under-estimating future product sales) practices. The result is to demonstrate inventory automation using ECIS system by enabling the means to monitor and track store inventory in real-time, perform data analysis remotely in cloud, improve shopping experience for the consumers and increase revenue for the retailers in the retail industry. Machine Learning code can be found on my GitHub: https://github.com/priyankkalgaonkar
ECE 53301: Wireless and Multimedia Computing Final Project Report – Group 1
Inventory Automation Using Electronically Connected Intelligent Shelves.
Code Developed by: Priyank Kalgaonkar.
Department of Electrical and Computer Engineering, Purdue School of Engineering and Technology at IUPUI.
Submitted as partial fulfillment for the requirement of Fall 2019 - ECE 53301-26877: Wireless and Multimedia Computing course.
Date of Submission: December 12, 2019.
FinalVersionECISsystem/mbed/TARGET_K64F/arm_math.h@1:45dc700211a7, 2019-12-12 (annotated)
- Committer:
- priyank12p
- Date:
- Thu Dec 12 01:27:12 2019 +0000
- Revision:
- 1:45dc700211a7
- Parent:
- 0:b0c4c25d37ab
Minor changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
priyank12p | 0:b0c4c25d37ab | 1 | /* ---------------------------------------------------------------------- |
priyank12p | 0:b0c4c25d37ab | 2 | * Copyright (C) 2010-2015 ARM Limited. All rights reserved. |
priyank12p | 0:b0c4c25d37ab | 3 | * |
priyank12p | 0:b0c4c25d37ab | 4 | * $Date: 19. March 2015 |
priyank12p | 0:b0c4c25d37ab | 5 | * $Revision: V.1.4.5 |
priyank12p | 0:b0c4c25d37ab | 6 | * |
priyank12p | 0:b0c4c25d37ab | 7 | * Project: CMSIS DSP Library |
priyank12p | 0:b0c4c25d37ab | 8 | * Title: arm_math.h |
priyank12p | 0:b0c4c25d37ab | 9 | * |
priyank12p | 0:b0c4c25d37ab | 10 | * Description: Public header file for CMSIS DSP Library |
priyank12p | 0:b0c4c25d37ab | 11 | * |
priyank12p | 0:b0c4c25d37ab | 12 | * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0 |
priyank12p | 0:b0c4c25d37ab | 13 | * |
priyank12p | 0:b0c4c25d37ab | 14 | * Redistribution and use in source and binary forms, with or without |
priyank12p | 0:b0c4c25d37ab | 15 | * modification, are permitted provided that the following conditions |
priyank12p | 0:b0c4c25d37ab | 16 | * are met: |
priyank12p | 0:b0c4c25d37ab | 17 | * - Redistributions of source code must retain the above copyright |
priyank12p | 0:b0c4c25d37ab | 18 | * notice, this list of conditions and the following disclaimer. |
priyank12p | 0:b0c4c25d37ab | 19 | * - Redistributions in binary form must reproduce the above copyright |
priyank12p | 0:b0c4c25d37ab | 20 | * notice, this list of conditions and the following disclaimer in |
priyank12p | 0:b0c4c25d37ab | 21 | * the documentation and/or other materials provided with the |
priyank12p | 0:b0c4c25d37ab | 22 | * distribution. |
priyank12p | 0:b0c4c25d37ab | 23 | * - Neither the name of ARM LIMITED nor the names of its contributors |
priyank12p | 0:b0c4c25d37ab | 24 | * may be used to endorse or promote products derived from this |
priyank12p | 0:b0c4c25d37ab | 25 | * software without specific prior written permission. |
priyank12p | 0:b0c4c25d37ab | 26 | * |
priyank12p | 0:b0c4c25d37ab | 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
priyank12p | 0:b0c4c25d37ab | 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
priyank12p | 0:b0c4c25d37ab | 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
priyank12p | 0:b0c4c25d37ab | 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
priyank12p | 0:b0c4c25d37ab | 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
priyank12p | 0:b0c4c25d37ab | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
priyank12p | 0:b0c4c25d37ab | 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
priyank12p | 0:b0c4c25d37ab | 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
priyank12p | 0:b0c4c25d37ab | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
priyank12p | 0:b0c4c25d37ab | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
priyank12p | 0:b0c4c25d37ab | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
priyank12p | 0:b0c4c25d37ab | 38 | * POSSIBILITY OF SUCH DAMAGE. |
priyank12p | 0:b0c4c25d37ab | 39 | * -------------------------------------------------------------------- */ |
priyank12p | 0:b0c4c25d37ab | 40 | |
priyank12p | 0:b0c4c25d37ab | 41 | /** |
priyank12p | 0:b0c4c25d37ab | 42 | \mainpage CMSIS DSP Software Library |
priyank12p | 0:b0c4c25d37ab | 43 | * |
priyank12p | 0:b0c4c25d37ab | 44 | * Introduction |
priyank12p | 0:b0c4c25d37ab | 45 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 46 | * |
priyank12p | 0:b0c4c25d37ab | 47 | * This user manual describes the CMSIS DSP software library, |
priyank12p | 0:b0c4c25d37ab | 48 | * a suite of common signal processing functions for use on Cortex-M processor based devices. |
priyank12p | 0:b0c4c25d37ab | 49 | * |
priyank12p | 0:b0c4c25d37ab | 50 | * The library is divided into a number of functions each covering a specific category: |
priyank12p | 0:b0c4c25d37ab | 51 | * - Basic math functions |
priyank12p | 0:b0c4c25d37ab | 52 | * - Fast math functions |
priyank12p | 0:b0c4c25d37ab | 53 | * - Complex math functions |
priyank12p | 0:b0c4c25d37ab | 54 | * - Filters |
priyank12p | 0:b0c4c25d37ab | 55 | * - Matrix functions |
priyank12p | 0:b0c4c25d37ab | 56 | * - Transforms |
priyank12p | 0:b0c4c25d37ab | 57 | * - Motor control functions |
priyank12p | 0:b0c4c25d37ab | 58 | * - Statistical functions |
priyank12p | 0:b0c4c25d37ab | 59 | * - Support functions |
priyank12p | 0:b0c4c25d37ab | 60 | * - Interpolation functions |
priyank12p | 0:b0c4c25d37ab | 61 | * |
priyank12p | 0:b0c4c25d37ab | 62 | * The library has separate functions for operating on 8-bit integers, 16-bit integers, |
priyank12p | 0:b0c4c25d37ab | 63 | * 32-bit integer and 32-bit floating-point values. |
priyank12p | 0:b0c4c25d37ab | 64 | * |
priyank12p | 0:b0c4c25d37ab | 65 | * Using the Library |
priyank12p | 0:b0c4c25d37ab | 66 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 67 | * |
priyank12p | 0:b0c4c25d37ab | 68 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder. |
priyank12p | 0:b0c4c25d37ab | 69 | * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7) |
priyank12p | 0:b0c4c25d37ab | 70 | * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7) |
priyank12p | 0:b0c4c25d37ab | 71 | * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7) |
priyank12p | 0:b0c4c25d37ab | 72 | * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7) |
priyank12p | 0:b0c4c25d37ab | 73 | * - arm_cortexM7l_math.lib (Little endian on Cortex-M7) |
priyank12p | 0:b0c4c25d37ab | 74 | * - arm_cortexM7b_math.lib (Big endian on Cortex-M7) |
priyank12p | 0:b0c4c25d37ab | 75 | * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) |
priyank12p | 0:b0c4c25d37ab | 76 | * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) |
priyank12p | 0:b0c4c25d37ab | 77 | * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) |
priyank12p | 0:b0c4c25d37ab | 78 | * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) |
priyank12p | 0:b0c4c25d37ab | 79 | * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) |
priyank12p | 0:b0c4c25d37ab | 80 | * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) |
priyank12p | 0:b0c4c25d37ab | 81 | * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+) |
priyank12p | 0:b0c4c25d37ab | 82 | * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+) |
priyank12p | 0:b0c4c25d37ab | 83 | * |
priyank12p | 0:b0c4c25d37ab | 84 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder. |
priyank12p | 0:b0c4c25d37ab | 85 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single |
priyank12p | 0:b0c4c25d37ab | 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. |
priyank12p | 0:b0c4c25d37ab | 87 | * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or |
priyank12p | 0:b0c4c25d37ab | 88 | * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. |
priyank12p | 0:b0c4c25d37ab | 89 | * |
priyank12p | 0:b0c4c25d37ab | 90 | * Examples |
priyank12p | 0:b0c4c25d37ab | 91 | * -------- |
priyank12p | 0:b0c4c25d37ab | 92 | * |
priyank12p | 0:b0c4c25d37ab | 93 | * The library ships with a number of examples which demonstrate how to use the library functions. |
priyank12p | 0:b0c4c25d37ab | 94 | * |
priyank12p | 0:b0c4c25d37ab | 95 | * Toolchain Support |
priyank12p | 0:b0c4c25d37ab | 96 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 97 | * |
priyank12p | 0:b0c4c25d37ab | 98 | * The library has been developed and tested with MDK-ARM version 5.14.0.0 |
priyank12p | 0:b0c4c25d37ab | 99 | * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. |
priyank12p | 0:b0c4c25d37ab | 100 | * |
priyank12p | 0:b0c4c25d37ab | 101 | * Building the Library |
priyank12p | 0:b0c4c25d37ab | 102 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 103 | * |
priyank12p | 0:b0c4c25d37ab | 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. |
priyank12p | 0:b0c4c25d37ab | 105 | * - arm_cortexM_math.uvprojx |
priyank12p | 0:b0c4c25d37ab | 106 | * |
priyank12p | 0:b0c4c25d37ab | 107 | * |
priyank12p | 0:b0c4c25d37ab | 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. |
priyank12p | 0:b0c4c25d37ab | 109 | * |
priyank12p | 0:b0c4c25d37ab | 110 | * Pre-processor Macros |
priyank12p | 0:b0c4c25d37ab | 111 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 112 | * |
priyank12p | 0:b0c4c25d37ab | 113 | * Each library project have differant pre-processor macros. |
priyank12p | 0:b0c4c25d37ab | 114 | * |
priyank12p | 0:b0c4c25d37ab | 115 | * - UNALIGNED_SUPPORT_DISABLE: |
priyank12p | 0:b0c4c25d37ab | 116 | * |
priyank12p | 0:b0c4c25d37ab | 117 | * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access |
priyank12p | 0:b0c4c25d37ab | 118 | * |
priyank12p | 0:b0c4c25d37ab | 119 | * - ARM_MATH_BIG_ENDIAN: |
priyank12p | 0:b0c4c25d37ab | 120 | * |
priyank12p | 0:b0c4c25d37ab | 121 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. |
priyank12p | 0:b0c4c25d37ab | 122 | * |
priyank12p | 0:b0c4c25d37ab | 123 | * - ARM_MATH_MATRIX_CHECK: |
priyank12p | 0:b0c4c25d37ab | 124 | * |
priyank12p | 0:b0c4c25d37ab | 125 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices |
priyank12p | 0:b0c4c25d37ab | 126 | * |
priyank12p | 0:b0c4c25d37ab | 127 | * - ARM_MATH_ROUNDING: |
priyank12p | 0:b0c4c25d37ab | 128 | * |
priyank12p | 0:b0c4c25d37ab | 129 | * Define macro ARM_MATH_ROUNDING for rounding on support functions |
priyank12p | 0:b0c4c25d37ab | 130 | * |
priyank12p | 0:b0c4c25d37ab | 131 | * - ARM_MATH_CMx: |
priyank12p | 0:b0c4c25d37ab | 132 | * |
priyank12p | 0:b0c4c25d37ab | 133 | * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target |
priyank12p | 0:b0c4c25d37ab | 134 | * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and |
priyank12p | 0:b0c4c25d37ab | 135 | * ARM_MATH_CM7 for building the library on cortex-M7. |
priyank12p | 0:b0c4c25d37ab | 136 | * |
priyank12p | 0:b0c4c25d37ab | 137 | * - __FPU_PRESENT: |
priyank12p | 0:b0c4c25d37ab | 138 | * |
priyank12p | 0:b0c4c25d37ab | 139 | * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries |
priyank12p | 0:b0c4c25d37ab | 140 | * |
priyank12p | 0:b0c4c25d37ab | 141 | * <hr> |
priyank12p | 0:b0c4c25d37ab | 142 | * CMSIS-DSP in ARM::CMSIS Pack |
priyank12p | 0:b0c4c25d37ab | 143 | * ----------------------------- |
priyank12p | 0:b0c4c25d37ab | 144 | * |
priyank12p | 0:b0c4c25d37ab | 145 | * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories: |
priyank12p | 0:b0c4c25d37ab | 146 | * |File/Folder |Content | |
priyank12p | 0:b0c4c25d37ab | 147 | * |------------------------------|------------------------------------------------------------------------| |
priyank12p | 0:b0c4c25d37ab | 148 | * |\b CMSIS\\Documentation\\DSP | This documentation | |
priyank12p | 0:b0c4c25d37ab | 149 | * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | |
priyank12p | 0:b0c4c25d37ab | 150 | * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | |
priyank12p | 0:b0c4c25d37ab | 151 | * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | |
priyank12p | 0:b0c4c25d37ab | 152 | * |
priyank12p | 0:b0c4c25d37ab | 153 | * <hr> |
priyank12p | 0:b0c4c25d37ab | 154 | * Revision History of CMSIS-DSP |
priyank12p | 0:b0c4c25d37ab | 155 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 156 | * Please refer to \ref ChangeLog_pg. |
priyank12p | 0:b0c4c25d37ab | 157 | * |
priyank12p | 0:b0c4c25d37ab | 158 | * Copyright Notice |
priyank12p | 0:b0c4c25d37ab | 159 | * ------------ |
priyank12p | 0:b0c4c25d37ab | 160 | * |
priyank12p | 0:b0c4c25d37ab | 161 | * Copyright (C) 2010-2015 ARM Limited. All rights reserved. |
priyank12p | 0:b0c4c25d37ab | 162 | */ |
priyank12p | 0:b0c4c25d37ab | 163 | |
priyank12p | 0:b0c4c25d37ab | 164 | |
priyank12p | 0:b0c4c25d37ab | 165 | /** |
priyank12p | 0:b0c4c25d37ab | 166 | * @defgroup groupMath Basic Math Functions |
priyank12p | 0:b0c4c25d37ab | 167 | */ |
priyank12p | 0:b0c4c25d37ab | 168 | |
priyank12p | 0:b0c4c25d37ab | 169 | /** |
priyank12p | 0:b0c4c25d37ab | 170 | * @defgroup groupFastMath Fast Math Functions |
priyank12p | 0:b0c4c25d37ab | 171 | * This set of functions provides a fast approximation to sine, cosine, and square root. |
priyank12p | 0:b0c4c25d37ab | 172 | * As compared to most of the other functions in the CMSIS math library, the fast math functions |
priyank12p | 0:b0c4c25d37ab | 173 | * operate on individual values and not arrays. |
priyank12p | 0:b0c4c25d37ab | 174 | * There are separate functions for Q15, Q31, and floating-point data. |
priyank12p | 0:b0c4c25d37ab | 175 | * |
priyank12p | 0:b0c4c25d37ab | 176 | */ |
priyank12p | 0:b0c4c25d37ab | 177 | |
priyank12p | 0:b0c4c25d37ab | 178 | /** |
priyank12p | 0:b0c4c25d37ab | 179 | * @defgroup groupCmplxMath Complex Math Functions |
priyank12p | 0:b0c4c25d37ab | 180 | * This set of functions operates on complex data vectors. |
priyank12p | 0:b0c4c25d37ab | 181 | * The data in the complex arrays is stored in an interleaved fashion |
priyank12p | 0:b0c4c25d37ab | 182 | * (real, imag, real, imag, ...). |
priyank12p | 0:b0c4c25d37ab | 183 | * In the API functions, the number of samples in a complex array refers |
priyank12p | 0:b0c4c25d37ab | 184 | * to the number of complex values; the array contains twice this number of |
priyank12p | 0:b0c4c25d37ab | 185 | * real values. |
priyank12p | 0:b0c4c25d37ab | 186 | */ |
priyank12p | 0:b0c4c25d37ab | 187 | |
priyank12p | 0:b0c4c25d37ab | 188 | /** |
priyank12p | 0:b0c4c25d37ab | 189 | * @defgroup groupFilters Filtering Functions |
priyank12p | 0:b0c4c25d37ab | 190 | */ |
priyank12p | 0:b0c4c25d37ab | 191 | |
priyank12p | 0:b0c4c25d37ab | 192 | /** |
priyank12p | 0:b0c4c25d37ab | 193 | * @defgroup groupMatrix Matrix Functions |
priyank12p | 0:b0c4c25d37ab | 194 | * |
priyank12p | 0:b0c4c25d37ab | 195 | * This set of functions provides basic matrix math operations. |
priyank12p | 0:b0c4c25d37ab | 196 | * The functions operate on matrix data structures. For example, |
priyank12p | 0:b0c4c25d37ab | 197 | * the type |
priyank12p | 0:b0c4c25d37ab | 198 | * definition for the floating-point matrix structure is shown |
priyank12p | 0:b0c4c25d37ab | 199 | * below: |
priyank12p | 0:b0c4c25d37ab | 200 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 201 | * typedef struct |
priyank12p | 0:b0c4c25d37ab | 202 | * { |
priyank12p | 0:b0c4c25d37ab | 203 | * uint16_t numRows; // number of rows of the matrix. |
priyank12p | 0:b0c4c25d37ab | 204 | * uint16_t numCols; // number of columns of the matrix. |
priyank12p | 0:b0c4c25d37ab | 205 | * float32_t *pData; // points to the data of the matrix. |
priyank12p | 0:b0c4c25d37ab | 206 | * } arm_matrix_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 207 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 208 | * There are similar definitions for Q15 and Q31 data types. |
priyank12p | 0:b0c4c25d37ab | 209 | * |
priyank12p | 0:b0c4c25d37ab | 210 | * The structure specifies the size of the matrix and then points to |
priyank12p | 0:b0c4c25d37ab | 211 | * an array of data. The array is of size <code>numRows X numCols</code> |
priyank12p | 0:b0c4c25d37ab | 212 | * and the values are arranged in row order. That is, the |
priyank12p | 0:b0c4c25d37ab | 213 | * matrix element (i, j) is stored at: |
priyank12p | 0:b0c4c25d37ab | 214 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 215 | * pData[i*numCols + j] |
priyank12p | 0:b0c4c25d37ab | 216 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 217 | * |
priyank12p | 0:b0c4c25d37ab | 218 | * \par Init Functions |
priyank12p | 0:b0c4c25d37ab | 219 | * There is an associated initialization function for each type of matrix |
priyank12p | 0:b0c4c25d37ab | 220 | * data structure. |
priyank12p | 0:b0c4c25d37ab | 221 | * The initialization function sets the values of the internal structure fields. |
priyank12p | 0:b0c4c25d37ab | 222 | * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code> |
priyank12p | 0:b0c4c25d37ab | 223 | * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively. |
priyank12p | 0:b0c4c25d37ab | 224 | * |
priyank12p | 0:b0c4c25d37ab | 225 | * \par |
priyank12p | 0:b0c4c25d37ab | 226 | * Use of the initialization function is optional. However, if initialization function is used |
priyank12p | 0:b0c4c25d37ab | 227 | * then the instance structure cannot be placed into a const data section. |
priyank12p | 0:b0c4c25d37ab | 228 | * To place the instance structure in a const data |
priyank12p | 0:b0c4c25d37ab | 229 | * section, manually initialize the data structure. For example: |
priyank12p | 0:b0c4c25d37ab | 230 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 231 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code> |
priyank12p | 0:b0c4c25d37ab | 232 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code> |
priyank12p | 0:b0c4c25d37ab | 233 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code> |
priyank12p | 0:b0c4c25d37ab | 234 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 235 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code> |
priyank12p | 0:b0c4c25d37ab | 236 | * specifies the number of columns, and <code>pData</code> points to the |
priyank12p | 0:b0c4c25d37ab | 237 | * data array. |
priyank12p | 0:b0c4c25d37ab | 238 | * |
priyank12p | 0:b0c4c25d37ab | 239 | * \par Size Checking |
priyank12p | 0:b0c4c25d37ab | 240 | * By default all of the matrix functions perform size checking on the input and |
priyank12p | 0:b0c4c25d37ab | 241 | * output matrices. For example, the matrix addition function verifies that the |
priyank12p | 0:b0c4c25d37ab | 242 | * two input matrices and the output matrix all have the same number of rows and |
priyank12p | 0:b0c4c25d37ab | 243 | * columns. If the size check fails the functions return: |
priyank12p | 0:b0c4c25d37ab | 244 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 245 | * ARM_MATH_SIZE_MISMATCH |
priyank12p | 0:b0c4c25d37ab | 246 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 247 | * Otherwise the functions return |
priyank12p | 0:b0c4c25d37ab | 248 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 249 | * ARM_MATH_SUCCESS |
priyank12p | 0:b0c4c25d37ab | 250 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 251 | * There is some overhead associated with this matrix size checking. |
priyank12p | 0:b0c4c25d37ab | 252 | * The matrix size checking is enabled via the \#define |
priyank12p | 0:b0c4c25d37ab | 253 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 254 | * ARM_MATH_MATRIX_CHECK |
priyank12p | 0:b0c4c25d37ab | 255 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 256 | * within the library project settings. By default this macro is defined |
priyank12p | 0:b0c4c25d37ab | 257 | * and size checking is enabled. By changing the project settings and |
priyank12p | 0:b0c4c25d37ab | 258 | * undefining this macro size checking is eliminated and the functions |
priyank12p | 0:b0c4c25d37ab | 259 | * run a bit faster. With size checking disabled the functions always |
priyank12p | 0:b0c4c25d37ab | 260 | * return <code>ARM_MATH_SUCCESS</code>. |
priyank12p | 0:b0c4c25d37ab | 261 | */ |
priyank12p | 0:b0c4c25d37ab | 262 | |
priyank12p | 0:b0c4c25d37ab | 263 | /** |
priyank12p | 0:b0c4c25d37ab | 264 | * @defgroup groupTransforms Transform Functions |
priyank12p | 0:b0c4c25d37ab | 265 | */ |
priyank12p | 0:b0c4c25d37ab | 266 | |
priyank12p | 0:b0c4c25d37ab | 267 | /** |
priyank12p | 0:b0c4c25d37ab | 268 | * @defgroup groupController Controller Functions |
priyank12p | 0:b0c4c25d37ab | 269 | */ |
priyank12p | 0:b0c4c25d37ab | 270 | |
priyank12p | 0:b0c4c25d37ab | 271 | /** |
priyank12p | 0:b0c4c25d37ab | 272 | * @defgroup groupStats Statistics Functions |
priyank12p | 0:b0c4c25d37ab | 273 | */ |
priyank12p | 0:b0c4c25d37ab | 274 | /** |
priyank12p | 0:b0c4c25d37ab | 275 | * @defgroup groupSupport Support Functions |
priyank12p | 0:b0c4c25d37ab | 276 | */ |
priyank12p | 0:b0c4c25d37ab | 277 | |
priyank12p | 0:b0c4c25d37ab | 278 | /** |
priyank12p | 0:b0c4c25d37ab | 279 | * @defgroup groupInterpolation Interpolation Functions |
priyank12p | 0:b0c4c25d37ab | 280 | * These functions perform 1- and 2-dimensional interpolation of data. |
priyank12p | 0:b0c4c25d37ab | 281 | * Linear interpolation is used for 1-dimensional data and |
priyank12p | 0:b0c4c25d37ab | 282 | * bilinear interpolation is used for 2-dimensional data. |
priyank12p | 0:b0c4c25d37ab | 283 | */ |
priyank12p | 0:b0c4c25d37ab | 284 | |
priyank12p | 0:b0c4c25d37ab | 285 | /** |
priyank12p | 0:b0c4c25d37ab | 286 | * @defgroup groupExamples Examples |
priyank12p | 0:b0c4c25d37ab | 287 | */ |
priyank12p | 0:b0c4c25d37ab | 288 | #ifndef _ARM_MATH_H |
priyank12p | 0:b0c4c25d37ab | 289 | #define _ARM_MATH_H |
priyank12p | 0:b0c4c25d37ab | 290 | |
priyank12p | 0:b0c4c25d37ab | 291 | #define __CMSIS_GENERIC /* disable NVIC and Systick functions */ |
priyank12p | 0:b0c4c25d37ab | 292 | |
priyank12p | 0:b0c4c25d37ab | 293 | #if defined(ARM_MATH_CM7) |
priyank12p | 0:b0c4c25d37ab | 294 | #include "core_cm7.h" |
priyank12p | 0:b0c4c25d37ab | 295 | #elif defined (ARM_MATH_CM4) |
priyank12p | 0:b0c4c25d37ab | 296 | #include "core_cm4.h" |
priyank12p | 0:b0c4c25d37ab | 297 | #elif defined (ARM_MATH_CM3) |
priyank12p | 0:b0c4c25d37ab | 298 | #include "core_cm3.h" |
priyank12p | 0:b0c4c25d37ab | 299 | #elif defined (ARM_MATH_CM0) |
priyank12p | 0:b0c4c25d37ab | 300 | #include "core_cm0.h" |
priyank12p | 0:b0c4c25d37ab | 301 | #define ARM_MATH_CM0_FAMILY |
priyank12p | 0:b0c4c25d37ab | 302 | #elif defined (ARM_MATH_CM0PLUS) |
priyank12p | 0:b0c4c25d37ab | 303 | #include "core_cm0plus.h" |
priyank12p | 0:b0c4c25d37ab | 304 | #define ARM_MATH_CM0_FAMILY |
priyank12p | 0:b0c4c25d37ab | 305 | #else |
priyank12p | 0:b0c4c25d37ab | 306 | #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0" |
priyank12p | 0:b0c4c25d37ab | 307 | #endif |
priyank12p | 0:b0c4c25d37ab | 308 | |
priyank12p | 0:b0c4c25d37ab | 309 | #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ |
priyank12p | 0:b0c4c25d37ab | 310 | #include "string.h" |
priyank12p | 0:b0c4c25d37ab | 311 | #include "math.h" |
priyank12p | 0:b0c4c25d37ab | 312 | #ifdef __cplusplus |
priyank12p | 0:b0c4c25d37ab | 313 | extern "C" |
priyank12p | 0:b0c4c25d37ab | 314 | { |
priyank12p | 0:b0c4c25d37ab | 315 | #endif |
priyank12p | 0:b0c4c25d37ab | 316 | |
priyank12p | 0:b0c4c25d37ab | 317 | |
priyank12p | 0:b0c4c25d37ab | 318 | /** |
priyank12p | 0:b0c4c25d37ab | 319 | * @brief Macros required for reciprocal calculation in Normalized LMS |
priyank12p | 0:b0c4c25d37ab | 320 | */ |
priyank12p | 0:b0c4c25d37ab | 321 | |
priyank12p | 0:b0c4c25d37ab | 322 | #define DELTA_Q31 (0x100) |
priyank12p | 0:b0c4c25d37ab | 323 | #define DELTA_Q15 0x5 |
priyank12p | 0:b0c4c25d37ab | 324 | #define INDEX_MASK 0x0000003F |
priyank12p | 0:b0c4c25d37ab | 325 | #ifndef PI |
priyank12p | 0:b0c4c25d37ab | 326 | #define PI 3.14159265358979f |
priyank12p | 0:b0c4c25d37ab | 327 | #endif |
priyank12p | 0:b0c4c25d37ab | 328 | |
priyank12p | 0:b0c4c25d37ab | 329 | /** |
priyank12p | 0:b0c4c25d37ab | 330 | * @brief Macros required for SINE and COSINE Fast math approximations |
priyank12p | 0:b0c4c25d37ab | 331 | */ |
priyank12p | 0:b0c4c25d37ab | 332 | |
priyank12p | 0:b0c4c25d37ab | 333 | #define FAST_MATH_TABLE_SIZE 512 |
priyank12p | 0:b0c4c25d37ab | 334 | #define FAST_MATH_Q31_SHIFT (32 - 10) |
priyank12p | 0:b0c4c25d37ab | 335 | #define FAST_MATH_Q15_SHIFT (16 - 10) |
priyank12p | 0:b0c4c25d37ab | 336 | #define CONTROLLER_Q31_SHIFT (32 - 9) |
priyank12p | 0:b0c4c25d37ab | 337 | #define TABLE_SIZE 256 |
priyank12p | 0:b0c4c25d37ab | 338 | #define TABLE_SPACING_Q31 0x400000 |
priyank12p | 0:b0c4c25d37ab | 339 | #define TABLE_SPACING_Q15 0x80 |
priyank12p | 0:b0c4c25d37ab | 340 | |
priyank12p | 0:b0c4c25d37ab | 341 | /** |
priyank12p | 0:b0c4c25d37ab | 342 | * @brief Macros required for SINE and COSINE Controller functions |
priyank12p | 0:b0c4c25d37ab | 343 | */ |
priyank12p | 0:b0c4c25d37ab | 344 | /* 1.31(q31) Fixed value of 2/360 */ |
priyank12p | 0:b0c4c25d37ab | 345 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ |
priyank12p | 0:b0c4c25d37ab | 346 | #define INPUT_SPACING 0xB60B61 |
priyank12p | 0:b0c4c25d37ab | 347 | |
priyank12p | 0:b0c4c25d37ab | 348 | /** |
priyank12p | 0:b0c4c25d37ab | 349 | * @brief Macro for Unaligned Support |
priyank12p | 0:b0c4c25d37ab | 350 | */ |
priyank12p | 0:b0c4c25d37ab | 351 | #ifndef UNALIGNED_SUPPORT_DISABLE |
priyank12p | 0:b0c4c25d37ab | 352 | #define ALIGN4 |
priyank12p | 0:b0c4c25d37ab | 353 | #else |
priyank12p | 0:b0c4c25d37ab | 354 | #if defined (__GNUC__) |
priyank12p | 0:b0c4c25d37ab | 355 | #define ALIGN4 __attribute__((aligned(4))) |
priyank12p | 0:b0c4c25d37ab | 356 | #else |
priyank12p | 0:b0c4c25d37ab | 357 | #define ALIGN4 __align(4) |
priyank12p | 0:b0c4c25d37ab | 358 | #endif |
priyank12p | 0:b0c4c25d37ab | 359 | #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ |
priyank12p | 0:b0c4c25d37ab | 360 | |
priyank12p | 0:b0c4c25d37ab | 361 | /** |
priyank12p | 0:b0c4c25d37ab | 362 | * @brief Error status returned by some functions in the library. |
priyank12p | 0:b0c4c25d37ab | 363 | */ |
priyank12p | 0:b0c4c25d37ab | 364 | |
priyank12p | 0:b0c4c25d37ab | 365 | typedef enum |
priyank12p | 0:b0c4c25d37ab | 366 | { |
priyank12p | 0:b0c4c25d37ab | 367 | ARM_MATH_SUCCESS = 0, /**< No error */ |
priyank12p | 0:b0c4c25d37ab | 368 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ |
priyank12p | 0:b0c4c25d37ab | 369 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ |
priyank12p | 0:b0c4c25d37ab | 370 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ |
priyank12p | 0:b0c4c25d37ab | 371 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ |
priyank12p | 0:b0c4c25d37ab | 372 | ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ |
priyank12p | 0:b0c4c25d37ab | 373 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ |
priyank12p | 0:b0c4c25d37ab | 374 | } arm_status; |
priyank12p | 0:b0c4c25d37ab | 375 | |
priyank12p | 0:b0c4c25d37ab | 376 | /** |
priyank12p | 0:b0c4c25d37ab | 377 | * @brief 8-bit fractional data type in 1.7 format. |
priyank12p | 0:b0c4c25d37ab | 378 | */ |
priyank12p | 0:b0c4c25d37ab | 379 | typedef int8_t q7_t; |
priyank12p | 0:b0c4c25d37ab | 380 | |
priyank12p | 0:b0c4c25d37ab | 381 | /** |
priyank12p | 0:b0c4c25d37ab | 382 | * @brief 16-bit fractional data type in 1.15 format. |
priyank12p | 0:b0c4c25d37ab | 383 | */ |
priyank12p | 0:b0c4c25d37ab | 384 | typedef int16_t q15_t; |
priyank12p | 0:b0c4c25d37ab | 385 | |
priyank12p | 0:b0c4c25d37ab | 386 | /** |
priyank12p | 0:b0c4c25d37ab | 387 | * @brief 32-bit fractional data type in 1.31 format. |
priyank12p | 0:b0c4c25d37ab | 388 | */ |
priyank12p | 0:b0c4c25d37ab | 389 | typedef int32_t q31_t; |
priyank12p | 0:b0c4c25d37ab | 390 | |
priyank12p | 0:b0c4c25d37ab | 391 | /** |
priyank12p | 0:b0c4c25d37ab | 392 | * @brief 64-bit fractional data type in 1.63 format. |
priyank12p | 0:b0c4c25d37ab | 393 | */ |
priyank12p | 0:b0c4c25d37ab | 394 | typedef int64_t q63_t; |
priyank12p | 0:b0c4c25d37ab | 395 | |
priyank12p | 0:b0c4c25d37ab | 396 | /** |
priyank12p | 0:b0c4c25d37ab | 397 | * @brief 32-bit floating-point type definition. |
priyank12p | 0:b0c4c25d37ab | 398 | */ |
priyank12p | 0:b0c4c25d37ab | 399 | typedef float float32_t; |
priyank12p | 0:b0c4c25d37ab | 400 | |
priyank12p | 0:b0c4c25d37ab | 401 | /** |
priyank12p | 0:b0c4c25d37ab | 402 | * @brief 64-bit floating-point type definition. |
priyank12p | 0:b0c4c25d37ab | 403 | */ |
priyank12p | 0:b0c4c25d37ab | 404 | typedef double float64_t; |
priyank12p | 0:b0c4c25d37ab | 405 | |
priyank12p | 0:b0c4c25d37ab | 406 | /** |
priyank12p | 0:b0c4c25d37ab | 407 | * @brief definition to read/write two 16 bit values. |
priyank12p | 0:b0c4c25d37ab | 408 | */ |
priyank12p | 0:b0c4c25d37ab | 409 | #if defined __CC_ARM |
priyank12p | 0:b0c4c25d37ab | 410 | #define __SIMD32_TYPE int32_t __packed |
priyank12p | 0:b0c4c25d37ab | 411 | #define CMSIS_UNUSED __attribute__((unused)) |
priyank12p | 0:b0c4c25d37ab | 412 | #elif defined __ICCARM__ |
priyank12p | 0:b0c4c25d37ab | 413 | #define __SIMD32_TYPE int32_t __packed |
priyank12p | 0:b0c4c25d37ab | 414 | #define CMSIS_UNUSED |
priyank12p | 0:b0c4c25d37ab | 415 | #elif defined __GNUC__ |
priyank12p | 0:b0c4c25d37ab | 416 | #define __SIMD32_TYPE int32_t |
priyank12p | 0:b0c4c25d37ab | 417 | #define CMSIS_UNUSED __attribute__((unused)) |
priyank12p | 0:b0c4c25d37ab | 418 | #elif defined __CSMC__ /* Cosmic */ |
priyank12p | 0:b0c4c25d37ab | 419 | #define __SIMD32_TYPE int32_t |
priyank12p | 0:b0c4c25d37ab | 420 | #define CMSIS_UNUSED |
priyank12p | 0:b0c4c25d37ab | 421 | #elif defined __TASKING__ |
priyank12p | 0:b0c4c25d37ab | 422 | #define __SIMD32_TYPE __unaligned int32_t |
priyank12p | 0:b0c4c25d37ab | 423 | #define CMSIS_UNUSED |
priyank12p | 0:b0c4c25d37ab | 424 | #else |
priyank12p | 0:b0c4c25d37ab | 425 | #error Unknown compiler |
priyank12p | 0:b0c4c25d37ab | 426 | #endif |
priyank12p | 0:b0c4c25d37ab | 427 | |
priyank12p | 0:b0c4c25d37ab | 428 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) |
priyank12p | 0:b0c4c25d37ab | 429 | #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) |
priyank12p | 0:b0c4c25d37ab | 430 | |
priyank12p | 0:b0c4c25d37ab | 431 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) |
priyank12p | 0:b0c4c25d37ab | 432 | |
priyank12p | 0:b0c4c25d37ab | 433 | #define __SIMD64(addr) (*(int64_t **) & (addr)) |
priyank12p | 0:b0c4c25d37ab | 434 | |
priyank12p | 0:b0c4c25d37ab | 435 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
priyank12p | 0:b0c4c25d37ab | 436 | /** |
priyank12p | 0:b0c4c25d37ab | 437 | * @brief definition to pack two 16 bit values. |
priyank12p | 0:b0c4c25d37ab | 438 | */ |
priyank12p | 0:b0c4c25d37ab | 439 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ |
priyank12p | 0:b0c4c25d37ab | 440 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) |
priyank12p | 0:b0c4c25d37ab | 441 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ |
priyank12p | 0:b0c4c25d37ab | 442 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) |
priyank12p | 0:b0c4c25d37ab | 443 | |
priyank12p | 0:b0c4c25d37ab | 444 | #endif |
priyank12p | 0:b0c4c25d37ab | 445 | |
priyank12p | 0:b0c4c25d37ab | 446 | |
priyank12p | 0:b0c4c25d37ab | 447 | /** |
priyank12p | 0:b0c4c25d37ab | 448 | * @brief definition to pack four 8 bit values. |
priyank12p | 0:b0c4c25d37ab | 449 | */ |
priyank12p | 0:b0c4c25d37ab | 450 | #ifndef ARM_MATH_BIG_ENDIAN |
priyank12p | 0:b0c4c25d37ab | 451 | |
priyank12p | 0:b0c4c25d37ab | 452 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ |
priyank12p | 0:b0c4c25d37ab | 453 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ |
priyank12p | 0:b0c4c25d37ab | 454 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ |
priyank12p | 0:b0c4c25d37ab | 455 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) |
priyank12p | 0:b0c4c25d37ab | 456 | #else |
priyank12p | 0:b0c4c25d37ab | 457 | |
priyank12p | 0:b0c4c25d37ab | 458 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ |
priyank12p | 0:b0c4c25d37ab | 459 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ |
priyank12p | 0:b0c4c25d37ab | 460 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ |
priyank12p | 0:b0c4c25d37ab | 461 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) |
priyank12p | 0:b0c4c25d37ab | 462 | |
priyank12p | 0:b0c4c25d37ab | 463 | #endif |
priyank12p | 0:b0c4c25d37ab | 464 | |
priyank12p | 0:b0c4c25d37ab | 465 | |
priyank12p | 0:b0c4c25d37ab | 466 | /** |
priyank12p | 0:b0c4c25d37ab | 467 | * @brief Clips Q63 to Q31 values. |
priyank12p | 0:b0c4c25d37ab | 468 | */ |
priyank12p | 0:b0c4c25d37ab | 469 | static __INLINE q31_t clip_q63_to_q31( |
priyank12p | 0:b0c4c25d37ab | 470 | q63_t x) |
priyank12p | 0:b0c4c25d37ab | 471 | { |
priyank12p | 0:b0c4c25d37ab | 472 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
priyank12p | 0:b0c4c25d37ab | 473 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; |
priyank12p | 0:b0c4c25d37ab | 474 | } |
priyank12p | 0:b0c4c25d37ab | 475 | |
priyank12p | 0:b0c4c25d37ab | 476 | /** |
priyank12p | 0:b0c4c25d37ab | 477 | * @brief Clips Q63 to Q15 values. |
priyank12p | 0:b0c4c25d37ab | 478 | */ |
priyank12p | 0:b0c4c25d37ab | 479 | static __INLINE q15_t clip_q63_to_q15( |
priyank12p | 0:b0c4c25d37ab | 480 | q63_t x) |
priyank12p | 0:b0c4c25d37ab | 481 | { |
priyank12p | 0:b0c4c25d37ab | 482 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
priyank12p | 0:b0c4c25d37ab | 483 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); |
priyank12p | 0:b0c4c25d37ab | 484 | } |
priyank12p | 0:b0c4c25d37ab | 485 | |
priyank12p | 0:b0c4c25d37ab | 486 | /** |
priyank12p | 0:b0c4c25d37ab | 487 | * @brief Clips Q31 to Q7 values. |
priyank12p | 0:b0c4c25d37ab | 488 | */ |
priyank12p | 0:b0c4c25d37ab | 489 | static __INLINE q7_t clip_q31_to_q7( |
priyank12p | 0:b0c4c25d37ab | 490 | q31_t x) |
priyank12p | 0:b0c4c25d37ab | 491 | { |
priyank12p | 0:b0c4c25d37ab | 492 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? |
priyank12p | 0:b0c4c25d37ab | 493 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; |
priyank12p | 0:b0c4c25d37ab | 494 | } |
priyank12p | 0:b0c4c25d37ab | 495 | |
priyank12p | 0:b0c4c25d37ab | 496 | /** |
priyank12p | 0:b0c4c25d37ab | 497 | * @brief Clips Q31 to Q15 values. |
priyank12p | 0:b0c4c25d37ab | 498 | */ |
priyank12p | 0:b0c4c25d37ab | 499 | static __INLINE q15_t clip_q31_to_q15( |
priyank12p | 0:b0c4c25d37ab | 500 | q31_t x) |
priyank12p | 0:b0c4c25d37ab | 501 | { |
priyank12p | 0:b0c4c25d37ab | 502 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? |
priyank12p | 0:b0c4c25d37ab | 503 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 504 | } |
priyank12p | 0:b0c4c25d37ab | 505 | |
priyank12p | 0:b0c4c25d37ab | 506 | /** |
priyank12p | 0:b0c4c25d37ab | 507 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. |
priyank12p | 0:b0c4c25d37ab | 508 | */ |
priyank12p | 0:b0c4c25d37ab | 509 | |
priyank12p | 0:b0c4c25d37ab | 510 | static __INLINE q63_t mult32x64( |
priyank12p | 0:b0c4c25d37ab | 511 | q63_t x, |
priyank12p | 0:b0c4c25d37ab | 512 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 513 | { |
priyank12p | 0:b0c4c25d37ab | 514 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + |
priyank12p | 0:b0c4c25d37ab | 515 | (((q63_t) (x >> 32) * y))); |
priyank12p | 0:b0c4c25d37ab | 516 | } |
priyank12p | 0:b0c4c25d37ab | 517 | |
priyank12p | 0:b0c4c25d37ab | 518 | |
priyank12p | 0:b0c4c25d37ab | 519 | //#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) |
priyank12p | 0:b0c4c25d37ab | 520 | //#define __CLZ __clz |
priyank12p | 0:b0c4c25d37ab | 521 | //#endif |
priyank12p | 0:b0c4c25d37ab | 522 | |
priyank12p | 0:b0c4c25d37ab | 523 | //note: function can be removed when all toolchain support __CLZ for Cortex-M0 |
priyank12p | 0:b0c4c25d37ab | 524 | #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ) |
priyank12p | 0:b0c4c25d37ab | 525 | |
priyank12p | 0:b0c4c25d37ab | 526 | static __INLINE uint32_t __CLZ( |
priyank12p | 0:b0c4c25d37ab | 527 | q31_t data); |
priyank12p | 0:b0c4c25d37ab | 528 | |
priyank12p | 0:b0c4c25d37ab | 529 | |
priyank12p | 0:b0c4c25d37ab | 530 | static __INLINE uint32_t __CLZ( |
priyank12p | 0:b0c4c25d37ab | 531 | q31_t data) |
priyank12p | 0:b0c4c25d37ab | 532 | { |
priyank12p | 0:b0c4c25d37ab | 533 | uint32_t count = 0; |
priyank12p | 0:b0c4c25d37ab | 534 | uint32_t mask = 0x80000000; |
priyank12p | 0:b0c4c25d37ab | 535 | |
priyank12p | 0:b0c4c25d37ab | 536 | while((data & mask) == 0) |
priyank12p | 0:b0c4c25d37ab | 537 | { |
priyank12p | 0:b0c4c25d37ab | 538 | count += 1u; |
priyank12p | 0:b0c4c25d37ab | 539 | mask = mask >> 1u; |
priyank12p | 0:b0c4c25d37ab | 540 | } |
priyank12p | 0:b0c4c25d37ab | 541 | |
priyank12p | 0:b0c4c25d37ab | 542 | return (count); |
priyank12p | 0:b0c4c25d37ab | 543 | |
priyank12p | 0:b0c4c25d37ab | 544 | } |
priyank12p | 0:b0c4c25d37ab | 545 | |
priyank12p | 0:b0c4c25d37ab | 546 | #endif |
priyank12p | 0:b0c4c25d37ab | 547 | |
priyank12p | 0:b0c4c25d37ab | 548 | /** |
priyank12p | 0:b0c4c25d37ab | 549 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. |
priyank12p | 0:b0c4c25d37ab | 550 | */ |
priyank12p | 0:b0c4c25d37ab | 551 | |
priyank12p | 0:b0c4c25d37ab | 552 | static __INLINE uint32_t arm_recip_q31( |
priyank12p | 0:b0c4c25d37ab | 553 | q31_t in, |
priyank12p | 0:b0c4c25d37ab | 554 | q31_t * dst, |
priyank12p | 0:b0c4c25d37ab | 555 | q31_t * pRecipTable) |
priyank12p | 0:b0c4c25d37ab | 556 | { |
priyank12p | 0:b0c4c25d37ab | 557 | |
priyank12p | 0:b0c4c25d37ab | 558 | uint32_t out, tempVal; |
priyank12p | 0:b0c4c25d37ab | 559 | uint32_t index, i; |
priyank12p | 0:b0c4c25d37ab | 560 | uint32_t signBits; |
priyank12p | 0:b0c4c25d37ab | 561 | |
priyank12p | 0:b0c4c25d37ab | 562 | if(in > 0) |
priyank12p | 0:b0c4c25d37ab | 563 | { |
priyank12p | 0:b0c4c25d37ab | 564 | signBits = __CLZ(in) - 1; |
priyank12p | 0:b0c4c25d37ab | 565 | } |
priyank12p | 0:b0c4c25d37ab | 566 | else |
priyank12p | 0:b0c4c25d37ab | 567 | { |
priyank12p | 0:b0c4c25d37ab | 568 | signBits = __CLZ(-in) - 1; |
priyank12p | 0:b0c4c25d37ab | 569 | } |
priyank12p | 0:b0c4c25d37ab | 570 | |
priyank12p | 0:b0c4c25d37ab | 571 | /* Convert input sample to 1.31 format */ |
priyank12p | 0:b0c4c25d37ab | 572 | in = in << signBits; |
priyank12p | 0:b0c4c25d37ab | 573 | |
priyank12p | 0:b0c4c25d37ab | 574 | /* calculation of index for initial approximated Val */ |
priyank12p | 0:b0c4c25d37ab | 575 | index = (uint32_t) (in >> 24u); |
priyank12p | 0:b0c4c25d37ab | 576 | index = (index & INDEX_MASK); |
priyank12p | 0:b0c4c25d37ab | 577 | |
priyank12p | 0:b0c4c25d37ab | 578 | /* 1.31 with exp 1 */ |
priyank12p | 0:b0c4c25d37ab | 579 | out = pRecipTable[index]; |
priyank12p | 0:b0c4c25d37ab | 580 | |
priyank12p | 0:b0c4c25d37ab | 581 | /* calculation of reciprocal value */ |
priyank12p | 0:b0c4c25d37ab | 582 | /* running approximation for two iterations */ |
priyank12p | 0:b0c4c25d37ab | 583 | for (i = 0u; i < 2u; i++) |
priyank12p | 0:b0c4c25d37ab | 584 | { |
priyank12p | 0:b0c4c25d37ab | 585 | tempVal = (q31_t) (((q63_t) in * out) >> 31u); |
priyank12p | 0:b0c4c25d37ab | 586 | tempVal = 0x7FFFFFFF - tempVal; |
priyank12p | 0:b0c4c25d37ab | 587 | /* 1.31 with exp 1 */ |
priyank12p | 0:b0c4c25d37ab | 588 | //out = (q31_t) (((q63_t) out * tempVal) >> 30u); |
priyank12p | 0:b0c4c25d37ab | 589 | out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u); |
priyank12p | 0:b0c4c25d37ab | 590 | } |
priyank12p | 0:b0c4c25d37ab | 591 | |
priyank12p | 0:b0c4c25d37ab | 592 | /* write output */ |
priyank12p | 0:b0c4c25d37ab | 593 | *dst = out; |
priyank12p | 0:b0c4c25d37ab | 594 | |
priyank12p | 0:b0c4c25d37ab | 595 | /* return num of signbits of out = 1/in value */ |
priyank12p | 0:b0c4c25d37ab | 596 | return (signBits + 1u); |
priyank12p | 0:b0c4c25d37ab | 597 | |
priyank12p | 0:b0c4c25d37ab | 598 | } |
priyank12p | 0:b0c4c25d37ab | 599 | |
priyank12p | 0:b0c4c25d37ab | 600 | /** |
priyank12p | 0:b0c4c25d37ab | 601 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. |
priyank12p | 0:b0c4c25d37ab | 602 | */ |
priyank12p | 0:b0c4c25d37ab | 603 | static __INLINE uint32_t arm_recip_q15( |
priyank12p | 0:b0c4c25d37ab | 604 | q15_t in, |
priyank12p | 0:b0c4c25d37ab | 605 | q15_t * dst, |
priyank12p | 0:b0c4c25d37ab | 606 | q15_t * pRecipTable) |
priyank12p | 0:b0c4c25d37ab | 607 | { |
priyank12p | 0:b0c4c25d37ab | 608 | |
priyank12p | 0:b0c4c25d37ab | 609 | uint32_t out = 0, tempVal = 0; |
priyank12p | 0:b0c4c25d37ab | 610 | uint32_t index = 0, i = 0; |
priyank12p | 0:b0c4c25d37ab | 611 | uint32_t signBits = 0; |
priyank12p | 0:b0c4c25d37ab | 612 | |
priyank12p | 0:b0c4c25d37ab | 613 | if(in > 0) |
priyank12p | 0:b0c4c25d37ab | 614 | { |
priyank12p | 0:b0c4c25d37ab | 615 | signBits = __CLZ(in) - 17; |
priyank12p | 0:b0c4c25d37ab | 616 | } |
priyank12p | 0:b0c4c25d37ab | 617 | else |
priyank12p | 0:b0c4c25d37ab | 618 | { |
priyank12p | 0:b0c4c25d37ab | 619 | signBits = __CLZ(-in) - 17; |
priyank12p | 0:b0c4c25d37ab | 620 | } |
priyank12p | 0:b0c4c25d37ab | 621 | |
priyank12p | 0:b0c4c25d37ab | 622 | /* Convert input sample to 1.15 format */ |
priyank12p | 0:b0c4c25d37ab | 623 | in = in << signBits; |
priyank12p | 0:b0c4c25d37ab | 624 | |
priyank12p | 0:b0c4c25d37ab | 625 | /* calculation of index for initial approximated Val */ |
priyank12p | 0:b0c4c25d37ab | 626 | index = in >> 8; |
priyank12p | 0:b0c4c25d37ab | 627 | index = (index & INDEX_MASK); |
priyank12p | 0:b0c4c25d37ab | 628 | |
priyank12p | 0:b0c4c25d37ab | 629 | /* 1.15 with exp 1 */ |
priyank12p | 0:b0c4c25d37ab | 630 | out = pRecipTable[index]; |
priyank12p | 0:b0c4c25d37ab | 631 | |
priyank12p | 0:b0c4c25d37ab | 632 | /* calculation of reciprocal value */ |
priyank12p | 0:b0c4c25d37ab | 633 | /* running approximation for two iterations */ |
priyank12p | 0:b0c4c25d37ab | 634 | for (i = 0; i < 2; i++) |
priyank12p | 0:b0c4c25d37ab | 635 | { |
priyank12p | 0:b0c4c25d37ab | 636 | tempVal = (q15_t) (((q31_t) in * out) >> 15); |
priyank12p | 0:b0c4c25d37ab | 637 | tempVal = 0x7FFF - tempVal; |
priyank12p | 0:b0c4c25d37ab | 638 | /* 1.15 with exp 1 */ |
priyank12p | 0:b0c4c25d37ab | 639 | out = (q15_t) (((q31_t) out * tempVal) >> 14); |
priyank12p | 0:b0c4c25d37ab | 640 | } |
priyank12p | 0:b0c4c25d37ab | 641 | |
priyank12p | 0:b0c4c25d37ab | 642 | /* write output */ |
priyank12p | 0:b0c4c25d37ab | 643 | *dst = out; |
priyank12p | 0:b0c4c25d37ab | 644 | |
priyank12p | 0:b0c4c25d37ab | 645 | /* return num of signbits of out = 1/in value */ |
priyank12p | 0:b0c4c25d37ab | 646 | return (signBits + 1); |
priyank12p | 0:b0c4c25d37ab | 647 | |
priyank12p | 0:b0c4c25d37ab | 648 | } |
priyank12p | 0:b0c4c25d37ab | 649 | |
priyank12p | 0:b0c4c25d37ab | 650 | |
priyank12p | 0:b0c4c25d37ab | 651 | /* |
priyank12p | 0:b0c4c25d37ab | 652 | * @brief C custom defined intrinisic function for only M0 processors |
priyank12p | 0:b0c4c25d37ab | 653 | */ |
priyank12p | 0:b0c4c25d37ab | 654 | #if defined(ARM_MATH_CM0_FAMILY) |
priyank12p | 0:b0c4c25d37ab | 655 | |
priyank12p | 0:b0c4c25d37ab | 656 | static __INLINE q31_t __SSAT( |
priyank12p | 0:b0c4c25d37ab | 657 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 658 | uint32_t y) |
priyank12p | 0:b0c4c25d37ab | 659 | { |
priyank12p | 0:b0c4c25d37ab | 660 | int32_t posMax, negMin; |
priyank12p | 0:b0c4c25d37ab | 661 | uint32_t i; |
priyank12p | 0:b0c4c25d37ab | 662 | |
priyank12p | 0:b0c4c25d37ab | 663 | posMax = 1; |
priyank12p | 0:b0c4c25d37ab | 664 | for (i = 0; i < (y - 1); i++) |
priyank12p | 0:b0c4c25d37ab | 665 | { |
priyank12p | 0:b0c4c25d37ab | 666 | posMax = posMax * 2; |
priyank12p | 0:b0c4c25d37ab | 667 | } |
priyank12p | 0:b0c4c25d37ab | 668 | |
priyank12p | 0:b0c4c25d37ab | 669 | if(x > 0) |
priyank12p | 0:b0c4c25d37ab | 670 | { |
priyank12p | 0:b0c4c25d37ab | 671 | posMax = (posMax - 1); |
priyank12p | 0:b0c4c25d37ab | 672 | |
priyank12p | 0:b0c4c25d37ab | 673 | if(x > posMax) |
priyank12p | 0:b0c4c25d37ab | 674 | { |
priyank12p | 0:b0c4c25d37ab | 675 | x = posMax; |
priyank12p | 0:b0c4c25d37ab | 676 | } |
priyank12p | 0:b0c4c25d37ab | 677 | } |
priyank12p | 0:b0c4c25d37ab | 678 | else |
priyank12p | 0:b0c4c25d37ab | 679 | { |
priyank12p | 0:b0c4c25d37ab | 680 | negMin = -posMax; |
priyank12p | 0:b0c4c25d37ab | 681 | |
priyank12p | 0:b0c4c25d37ab | 682 | if(x < negMin) |
priyank12p | 0:b0c4c25d37ab | 683 | { |
priyank12p | 0:b0c4c25d37ab | 684 | x = negMin; |
priyank12p | 0:b0c4c25d37ab | 685 | } |
priyank12p | 0:b0c4c25d37ab | 686 | } |
priyank12p | 0:b0c4c25d37ab | 687 | return (x); |
priyank12p | 0:b0c4c25d37ab | 688 | |
priyank12p | 0:b0c4c25d37ab | 689 | |
priyank12p | 0:b0c4c25d37ab | 690 | } |
priyank12p | 0:b0c4c25d37ab | 691 | |
priyank12p | 0:b0c4c25d37ab | 692 | #endif /* end of ARM_MATH_CM0_FAMILY */ |
priyank12p | 0:b0c4c25d37ab | 693 | |
priyank12p | 0:b0c4c25d37ab | 694 | |
priyank12p | 0:b0c4c25d37ab | 695 | |
priyank12p | 0:b0c4c25d37ab | 696 | /* |
priyank12p | 0:b0c4c25d37ab | 697 | * @brief C custom defined intrinsic function for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 698 | */ |
priyank12p | 0:b0c4c25d37ab | 699 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
priyank12p | 0:b0c4c25d37ab | 700 | |
priyank12p | 0:b0c4c25d37ab | 701 | /* |
priyank12p | 0:b0c4c25d37ab | 702 | * @brief C custom defined QADD8 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 703 | */ |
priyank12p | 0:b0c4c25d37ab | 704 | static __INLINE q31_t __QADD8( |
priyank12p | 0:b0c4c25d37ab | 705 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 706 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 707 | { |
priyank12p | 0:b0c4c25d37ab | 708 | |
priyank12p | 0:b0c4c25d37ab | 709 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 710 | q7_t r, s, t, u; |
priyank12p | 0:b0c4c25d37ab | 711 | |
priyank12p | 0:b0c4c25d37ab | 712 | r = (q7_t) x; |
priyank12p | 0:b0c4c25d37ab | 713 | s = (q7_t) y; |
priyank12p | 0:b0c4c25d37ab | 714 | |
priyank12p | 0:b0c4c25d37ab | 715 | r = __SSAT((q31_t) (r + s), 8); |
priyank12p | 0:b0c4c25d37ab | 716 | s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8); |
priyank12p | 0:b0c4c25d37ab | 717 | t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8); |
priyank12p | 0:b0c4c25d37ab | 718 | u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8); |
priyank12p | 0:b0c4c25d37ab | 719 | |
priyank12p | 0:b0c4c25d37ab | 720 | sum = |
priyank12p | 0:b0c4c25d37ab | 721 | (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) | |
priyank12p | 0:b0c4c25d37ab | 722 | (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF); |
priyank12p | 0:b0c4c25d37ab | 723 | |
priyank12p | 0:b0c4c25d37ab | 724 | return sum; |
priyank12p | 0:b0c4c25d37ab | 725 | |
priyank12p | 0:b0c4c25d37ab | 726 | } |
priyank12p | 0:b0c4c25d37ab | 727 | |
priyank12p | 0:b0c4c25d37ab | 728 | /* |
priyank12p | 0:b0c4c25d37ab | 729 | * @brief C custom defined QSUB8 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 730 | */ |
priyank12p | 0:b0c4c25d37ab | 731 | static __INLINE q31_t __QSUB8( |
priyank12p | 0:b0c4c25d37ab | 732 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 733 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 734 | { |
priyank12p | 0:b0c4c25d37ab | 735 | |
priyank12p | 0:b0c4c25d37ab | 736 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 737 | q31_t r, s, t, u; |
priyank12p | 0:b0c4c25d37ab | 738 | |
priyank12p | 0:b0c4c25d37ab | 739 | r = (q7_t) x; |
priyank12p | 0:b0c4c25d37ab | 740 | s = (q7_t) y; |
priyank12p | 0:b0c4c25d37ab | 741 | |
priyank12p | 0:b0c4c25d37ab | 742 | r = __SSAT((r - s), 8); |
priyank12p | 0:b0c4c25d37ab | 743 | s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8; |
priyank12p | 0:b0c4c25d37ab | 744 | t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16; |
priyank12p | 0:b0c4c25d37ab | 745 | u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24; |
priyank12p | 0:b0c4c25d37ab | 746 | |
priyank12p | 0:b0c4c25d37ab | 747 | sum = |
priyank12p | 0:b0c4c25d37ab | 748 | (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & |
priyank12p | 0:b0c4c25d37ab | 749 | 0x000000FF); |
priyank12p | 0:b0c4c25d37ab | 750 | |
priyank12p | 0:b0c4c25d37ab | 751 | return sum; |
priyank12p | 0:b0c4c25d37ab | 752 | } |
priyank12p | 0:b0c4c25d37ab | 753 | |
priyank12p | 0:b0c4c25d37ab | 754 | /* |
priyank12p | 0:b0c4c25d37ab | 755 | * @brief C custom defined QADD16 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 756 | */ |
priyank12p | 0:b0c4c25d37ab | 757 | |
priyank12p | 0:b0c4c25d37ab | 758 | /* |
priyank12p | 0:b0c4c25d37ab | 759 | * @brief C custom defined QADD16 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 760 | */ |
priyank12p | 0:b0c4c25d37ab | 761 | static __INLINE q31_t __QADD16( |
priyank12p | 0:b0c4c25d37ab | 762 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 763 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 764 | { |
priyank12p | 0:b0c4c25d37ab | 765 | |
priyank12p | 0:b0c4c25d37ab | 766 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 767 | q31_t r, s; |
priyank12p | 0:b0c4c25d37ab | 768 | |
priyank12p | 0:b0c4c25d37ab | 769 | r = (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 770 | s = (q15_t) y; |
priyank12p | 0:b0c4c25d37ab | 771 | |
priyank12p | 0:b0c4c25d37ab | 772 | r = __SSAT(r + s, 16); |
priyank12p | 0:b0c4c25d37ab | 773 | s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16; |
priyank12p | 0:b0c4c25d37ab | 774 | |
priyank12p | 0:b0c4c25d37ab | 775 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
priyank12p | 0:b0c4c25d37ab | 776 | |
priyank12p | 0:b0c4c25d37ab | 777 | return sum; |
priyank12p | 0:b0c4c25d37ab | 778 | |
priyank12p | 0:b0c4c25d37ab | 779 | } |
priyank12p | 0:b0c4c25d37ab | 780 | |
priyank12p | 0:b0c4c25d37ab | 781 | /* |
priyank12p | 0:b0c4c25d37ab | 782 | * @brief C custom defined SHADD16 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 783 | */ |
priyank12p | 0:b0c4c25d37ab | 784 | static __INLINE q31_t __SHADD16( |
priyank12p | 0:b0c4c25d37ab | 785 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 786 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 787 | { |
priyank12p | 0:b0c4c25d37ab | 788 | |
priyank12p | 0:b0c4c25d37ab | 789 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 790 | q31_t r, s; |
priyank12p | 0:b0c4c25d37ab | 791 | |
priyank12p | 0:b0c4c25d37ab | 792 | r = (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 793 | s = (q15_t) y; |
priyank12p | 0:b0c4c25d37ab | 794 | |
priyank12p | 0:b0c4c25d37ab | 795 | r = ((r >> 1) + (s >> 1)); |
priyank12p | 0:b0c4c25d37ab | 796 | s = ((q31_t) ((x >> 17) + (y >> 17))) << 16; |
priyank12p | 0:b0c4c25d37ab | 797 | |
priyank12p | 0:b0c4c25d37ab | 798 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
priyank12p | 0:b0c4c25d37ab | 799 | |
priyank12p | 0:b0c4c25d37ab | 800 | return sum; |
priyank12p | 0:b0c4c25d37ab | 801 | |
priyank12p | 0:b0c4c25d37ab | 802 | } |
priyank12p | 0:b0c4c25d37ab | 803 | |
priyank12p | 0:b0c4c25d37ab | 804 | /* |
priyank12p | 0:b0c4c25d37ab | 805 | * @brief C custom defined QSUB16 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 806 | */ |
priyank12p | 0:b0c4c25d37ab | 807 | static __INLINE q31_t __QSUB16( |
priyank12p | 0:b0c4c25d37ab | 808 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 809 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 810 | { |
priyank12p | 0:b0c4c25d37ab | 811 | |
priyank12p | 0:b0c4c25d37ab | 812 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 813 | q31_t r, s; |
priyank12p | 0:b0c4c25d37ab | 814 | |
priyank12p | 0:b0c4c25d37ab | 815 | r = (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 816 | s = (q15_t) y; |
priyank12p | 0:b0c4c25d37ab | 817 | |
priyank12p | 0:b0c4c25d37ab | 818 | r = __SSAT(r - s, 16); |
priyank12p | 0:b0c4c25d37ab | 819 | s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16; |
priyank12p | 0:b0c4c25d37ab | 820 | |
priyank12p | 0:b0c4c25d37ab | 821 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
priyank12p | 0:b0c4c25d37ab | 822 | |
priyank12p | 0:b0c4c25d37ab | 823 | return sum; |
priyank12p | 0:b0c4c25d37ab | 824 | } |
priyank12p | 0:b0c4c25d37ab | 825 | |
priyank12p | 0:b0c4c25d37ab | 826 | /* |
priyank12p | 0:b0c4c25d37ab | 827 | * @brief C custom defined SHSUB16 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 828 | */ |
priyank12p | 0:b0c4c25d37ab | 829 | static __INLINE q31_t __SHSUB16( |
priyank12p | 0:b0c4c25d37ab | 830 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 831 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 832 | { |
priyank12p | 0:b0c4c25d37ab | 833 | |
priyank12p | 0:b0c4c25d37ab | 834 | q31_t diff; |
priyank12p | 0:b0c4c25d37ab | 835 | q31_t r, s; |
priyank12p | 0:b0c4c25d37ab | 836 | |
priyank12p | 0:b0c4c25d37ab | 837 | r = (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 838 | s = (q15_t) y; |
priyank12p | 0:b0c4c25d37ab | 839 | |
priyank12p | 0:b0c4c25d37ab | 840 | r = ((r >> 1) - (s >> 1)); |
priyank12p | 0:b0c4c25d37ab | 841 | s = (((x >> 17) - (y >> 17)) << 16); |
priyank12p | 0:b0c4c25d37ab | 842 | |
priyank12p | 0:b0c4c25d37ab | 843 | diff = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
priyank12p | 0:b0c4c25d37ab | 844 | |
priyank12p | 0:b0c4c25d37ab | 845 | return diff; |
priyank12p | 0:b0c4c25d37ab | 846 | } |
priyank12p | 0:b0c4c25d37ab | 847 | |
priyank12p | 0:b0c4c25d37ab | 848 | /* |
priyank12p | 0:b0c4c25d37ab | 849 | * @brief C custom defined QASX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 850 | */ |
priyank12p | 0:b0c4c25d37ab | 851 | static __INLINE q31_t __QASX( |
priyank12p | 0:b0c4c25d37ab | 852 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 853 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 854 | { |
priyank12p | 0:b0c4c25d37ab | 855 | |
priyank12p | 0:b0c4c25d37ab | 856 | q31_t sum = 0; |
priyank12p | 0:b0c4c25d37ab | 857 | |
priyank12p | 0:b0c4c25d37ab | 858 | sum = |
priyank12p | 0:b0c4c25d37ab | 859 | ((sum + |
priyank12p | 0:b0c4c25d37ab | 860 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) + |
priyank12p | 0:b0c4c25d37ab | 861 | clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16))); |
priyank12p | 0:b0c4c25d37ab | 862 | |
priyank12p | 0:b0c4c25d37ab | 863 | return sum; |
priyank12p | 0:b0c4c25d37ab | 864 | } |
priyank12p | 0:b0c4c25d37ab | 865 | |
priyank12p | 0:b0c4c25d37ab | 866 | /* |
priyank12p | 0:b0c4c25d37ab | 867 | * @brief C custom defined SHASX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 868 | */ |
priyank12p | 0:b0c4c25d37ab | 869 | static __INLINE q31_t __SHASX( |
priyank12p | 0:b0c4c25d37ab | 870 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 871 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 872 | { |
priyank12p | 0:b0c4c25d37ab | 873 | |
priyank12p | 0:b0c4c25d37ab | 874 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 875 | q31_t r, s; |
priyank12p | 0:b0c4c25d37ab | 876 | |
priyank12p | 0:b0c4c25d37ab | 877 | r = (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 878 | s = (q15_t) y; |
priyank12p | 0:b0c4c25d37ab | 879 | |
priyank12p | 0:b0c4c25d37ab | 880 | r = ((r >> 1) - (y >> 17)); |
priyank12p | 0:b0c4c25d37ab | 881 | s = (((x >> 17) + (s >> 1)) << 16); |
priyank12p | 0:b0c4c25d37ab | 882 | |
priyank12p | 0:b0c4c25d37ab | 883 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
priyank12p | 0:b0c4c25d37ab | 884 | |
priyank12p | 0:b0c4c25d37ab | 885 | return sum; |
priyank12p | 0:b0c4c25d37ab | 886 | } |
priyank12p | 0:b0c4c25d37ab | 887 | |
priyank12p | 0:b0c4c25d37ab | 888 | |
priyank12p | 0:b0c4c25d37ab | 889 | /* |
priyank12p | 0:b0c4c25d37ab | 890 | * @brief C custom defined QSAX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 891 | */ |
priyank12p | 0:b0c4c25d37ab | 892 | static __INLINE q31_t __QSAX( |
priyank12p | 0:b0c4c25d37ab | 893 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 894 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 895 | { |
priyank12p | 0:b0c4c25d37ab | 896 | |
priyank12p | 0:b0c4c25d37ab | 897 | q31_t sum = 0; |
priyank12p | 0:b0c4c25d37ab | 898 | |
priyank12p | 0:b0c4c25d37ab | 899 | sum = |
priyank12p | 0:b0c4c25d37ab | 900 | ((sum + |
priyank12p | 0:b0c4c25d37ab | 901 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) + |
priyank12p | 0:b0c4c25d37ab | 902 | clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16))); |
priyank12p | 0:b0c4c25d37ab | 903 | |
priyank12p | 0:b0c4c25d37ab | 904 | return sum; |
priyank12p | 0:b0c4c25d37ab | 905 | } |
priyank12p | 0:b0c4c25d37ab | 906 | |
priyank12p | 0:b0c4c25d37ab | 907 | /* |
priyank12p | 0:b0c4c25d37ab | 908 | * @brief C custom defined SHSAX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 909 | */ |
priyank12p | 0:b0c4c25d37ab | 910 | static __INLINE q31_t __SHSAX( |
priyank12p | 0:b0c4c25d37ab | 911 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 912 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 913 | { |
priyank12p | 0:b0c4c25d37ab | 914 | |
priyank12p | 0:b0c4c25d37ab | 915 | q31_t sum; |
priyank12p | 0:b0c4c25d37ab | 916 | q31_t r, s; |
priyank12p | 0:b0c4c25d37ab | 917 | |
priyank12p | 0:b0c4c25d37ab | 918 | r = (q15_t) x; |
priyank12p | 0:b0c4c25d37ab | 919 | s = (q15_t) y; |
priyank12p | 0:b0c4c25d37ab | 920 | |
priyank12p | 0:b0c4c25d37ab | 921 | r = ((r >> 1) + (y >> 17)); |
priyank12p | 0:b0c4c25d37ab | 922 | s = (((x >> 17) - (s >> 1)) << 16); |
priyank12p | 0:b0c4c25d37ab | 923 | |
priyank12p | 0:b0c4c25d37ab | 924 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
priyank12p | 0:b0c4c25d37ab | 925 | |
priyank12p | 0:b0c4c25d37ab | 926 | return sum; |
priyank12p | 0:b0c4c25d37ab | 927 | } |
priyank12p | 0:b0c4c25d37ab | 928 | |
priyank12p | 0:b0c4c25d37ab | 929 | /* |
priyank12p | 0:b0c4c25d37ab | 930 | * @brief C custom defined SMUSDX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 931 | */ |
priyank12p | 0:b0c4c25d37ab | 932 | static __INLINE q31_t __SMUSDX( |
priyank12p | 0:b0c4c25d37ab | 933 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 934 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 935 | { |
priyank12p | 0:b0c4c25d37ab | 936 | |
priyank12p | 0:b0c4c25d37ab | 937 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) - |
priyank12p | 0:b0c4c25d37ab | 938 | ((q15_t) (x >> 16) * (q15_t) y))); |
priyank12p | 0:b0c4c25d37ab | 939 | } |
priyank12p | 0:b0c4c25d37ab | 940 | |
priyank12p | 0:b0c4c25d37ab | 941 | /* |
priyank12p | 0:b0c4c25d37ab | 942 | * @brief C custom defined SMUADX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 943 | */ |
priyank12p | 0:b0c4c25d37ab | 944 | static __INLINE q31_t __SMUADX( |
priyank12p | 0:b0c4c25d37ab | 945 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 946 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 947 | { |
priyank12p | 0:b0c4c25d37ab | 948 | |
priyank12p | 0:b0c4c25d37ab | 949 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) + |
priyank12p | 0:b0c4c25d37ab | 950 | ((q15_t) (x >> 16) * (q15_t) y))); |
priyank12p | 0:b0c4c25d37ab | 951 | } |
priyank12p | 0:b0c4c25d37ab | 952 | |
priyank12p | 0:b0c4c25d37ab | 953 | /* |
priyank12p | 0:b0c4c25d37ab | 954 | * @brief C custom defined QADD for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 955 | */ |
priyank12p | 0:b0c4c25d37ab | 956 | static __INLINE q31_t __QADD( |
priyank12p | 0:b0c4c25d37ab | 957 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 958 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 959 | { |
priyank12p | 0:b0c4c25d37ab | 960 | return clip_q63_to_q31((q63_t) x + y); |
priyank12p | 0:b0c4c25d37ab | 961 | } |
priyank12p | 0:b0c4c25d37ab | 962 | |
priyank12p | 0:b0c4c25d37ab | 963 | /* |
priyank12p | 0:b0c4c25d37ab | 964 | * @brief C custom defined QSUB for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 965 | */ |
priyank12p | 0:b0c4c25d37ab | 966 | static __INLINE q31_t __QSUB( |
priyank12p | 0:b0c4c25d37ab | 967 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 968 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 969 | { |
priyank12p | 0:b0c4c25d37ab | 970 | return clip_q63_to_q31((q63_t) x - y); |
priyank12p | 0:b0c4c25d37ab | 971 | } |
priyank12p | 0:b0c4c25d37ab | 972 | |
priyank12p | 0:b0c4c25d37ab | 973 | /* |
priyank12p | 0:b0c4c25d37ab | 974 | * @brief C custom defined SMLAD for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 975 | */ |
priyank12p | 0:b0c4c25d37ab | 976 | static __INLINE q31_t __SMLAD( |
priyank12p | 0:b0c4c25d37ab | 977 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 978 | q31_t y, |
priyank12p | 0:b0c4c25d37ab | 979 | q31_t sum) |
priyank12p | 0:b0c4c25d37ab | 980 | { |
priyank12p | 0:b0c4c25d37ab | 981 | |
priyank12p | 0:b0c4c25d37ab | 982 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
priyank12p | 0:b0c4c25d37ab | 983 | ((q15_t) x * (q15_t) y)); |
priyank12p | 0:b0c4c25d37ab | 984 | } |
priyank12p | 0:b0c4c25d37ab | 985 | |
priyank12p | 0:b0c4c25d37ab | 986 | /* |
priyank12p | 0:b0c4c25d37ab | 987 | * @brief C custom defined SMLADX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 988 | */ |
priyank12p | 0:b0c4c25d37ab | 989 | static __INLINE q31_t __SMLADX( |
priyank12p | 0:b0c4c25d37ab | 990 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 991 | q31_t y, |
priyank12p | 0:b0c4c25d37ab | 992 | q31_t sum) |
priyank12p | 0:b0c4c25d37ab | 993 | { |
priyank12p | 0:b0c4c25d37ab | 994 | |
priyank12p | 0:b0c4c25d37ab | 995 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) + |
priyank12p | 0:b0c4c25d37ab | 996 | ((q15_t) x * (q15_t) (y >> 16))); |
priyank12p | 0:b0c4c25d37ab | 997 | } |
priyank12p | 0:b0c4c25d37ab | 998 | |
priyank12p | 0:b0c4c25d37ab | 999 | /* |
priyank12p | 0:b0c4c25d37ab | 1000 | * @brief C custom defined SMLSDX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 1001 | */ |
priyank12p | 0:b0c4c25d37ab | 1002 | static __INLINE q31_t __SMLSDX( |
priyank12p | 0:b0c4c25d37ab | 1003 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 1004 | q31_t y, |
priyank12p | 0:b0c4c25d37ab | 1005 | q31_t sum) |
priyank12p | 0:b0c4c25d37ab | 1006 | { |
priyank12p | 0:b0c4c25d37ab | 1007 | |
priyank12p | 0:b0c4c25d37ab | 1008 | return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) + |
priyank12p | 0:b0c4c25d37ab | 1009 | ((q15_t) x * (q15_t) (y >> 16))); |
priyank12p | 0:b0c4c25d37ab | 1010 | } |
priyank12p | 0:b0c4c25d37ab | 1011 | |
priyank12p | 0:b0c4c25d37ab | 1012 | /* |
priyank12p | 0:b0c4c25d37ab | 1013 | * @brief C custom defined SMLALD for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 1014 | */ |
priyank12p | 0:b0c4c25d37ab | 1015 | static __INLINE q63_t __SMLALD( |
priyank12p | 0:b0c4c25d37ab | 1016 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 1017 | q31_t y, |
priyank12p | 0:b0c4c25d37ab | 1018 | q63_t sum) |
priyank12p | 0:b0c4c25d37ab | 1019 | { |
priyank12p | 0:b0c4c25d37ab | 1020 | |
priyank12p | 0:b0c4c25d37ab | 1021 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
priyank12p | 0:b0c4c25d37ab | 1022 | ((q15_t) x * (q15_t) y)); |
priyank12p | 0:b0c4c25d37ab | 1023 | } |
priyank12p | 0:b0c4c25d37ab | 1024 | |
priyank12p | 0:b0c4c25d37ab | 1025 | /* |
priyank12p | 0:b0c4c25d37ab | 1026 | * @brief C custom defined SMLALDX for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 1027 | */ |
priyank12p | 0:b0c4c25d37ab | 1028 | static __INLINE q63_t __SMLALDX( |
priyank12p | 0:b0c4c25d37ab | 1029 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 1030 | q31_t y, |
priyank12p | 0:b0c4c25d37ab | 1031 | q63_t sum) |
priyank12p | 0:b0c4c25d37ab | 1032 | { |
priyank12p | 0:b0c4c25d37ab | 1033 | |
priyank12p | 0:b0c4c25d37ab | 1034 | return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + |
priyank12p | 0:b0c4c25d37ab | 1035 | ((q15_t) x * (q15_t) (y >> 16)); |
priyank12p | 0:b0c4c25d37ab | 1036 | } |
priyank12p | 0:b0c4c25d37ab | 1037 | |
priyank12p | 0:b0c4c25d37ab | 1038 | /* |
priyank12p | 0:b0c4c25d37ab | 1039 | * @brief C custom defined SMUAD for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 1040 | */ |
priyank12p | 0:b0c4c25d37ab | 1041 | static __INLINE q31_t __SMUAD( |
priyank12p | 0:b0c4c25d37ab | 1042 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 1043 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 1044 | { |
priyank12p | 0:b0c4c25d37ab | 1045 | |
priyank12p | 0:b0c4c25d37ab | 1046 | return (((x >> 16) * (y >> 16)) + |
priyank12p | 0:b0c4c25d37ab | 1047 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
priyank12p | 0:b0c4c25d37ab | 1048 | } |
priyank12p | 0:b0c4c25d37ab | 1049 | |
priyank12p | 0:b0c4c25d37ab | 1050 | /* |
priyank12p | 0:b0c4c25d37ab | 1051 | * @brief C custom defined SMUSD for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 1052 | */ |
priyank12p | 0:b0c4c25d37ab | 1053 | static __INLINE q31_t __SMUSD( |
priyank12p | 0:b0c4c25d37ab | 1054 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 1055 | q31_t y) |
priyank12p | 0:b0c4c25d37ab | 1056 | { |
priyank12p | 0:b0c4c25d37ab | 1057 | |
priyank12p | 0:b0c4c25d37ab | 1058 | return (-((x >> 16) * (y >> 16)) + |
priyank12p | 0:b0c4c25d37ab | 1059 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
priyank12p | 0:b0c4c25d37ab | 1060 | } |
priyank12p | 0:b0c4c25d37ab | 1061 | |
priyank12p | 0:b0c4c25d37ab | 1062 | |
priyank12p | 0:b0c4c25d37ab | 1063 | /* |
priyank12p | 0:b0c4c25d37ab | 1064 | * @brief C custom defined SXTB16 for M3 and M0 processors |
priyank12p | 0:b0c4c25d37ab | 1065 | */ |
priyank12p | 0:b0c4c25d37ab | 1066 | static __INLINE q31_t __SXTB16( |
priyank12p | 0:b0c4c25d37ab | 1067 | q31_t x) |
priyank12p | 0:b0c4c25d37ab | 1068 | { |
priyank12p | 0:b0c4c25d37ab | 1069 | |
priyank12p | 0:b0c4c25d37ab | 1070 | return ((((x << 24) >> 24) & 0x0000FFFF) | |
priyank12p | 0:b0c4c25d37ab | 1071 | (((x << 8) >> 8) & 0xFFFF0000)); |
priyank12p | 0:b0c4c25d37ab | 1072 | } |
priyank12p | 0:b0c4c25d37ab | 1073 | |
priyank12p | 0:b0c4c25d37ab | 1074 | |
priyank12p | 0:b0c4c25d37ab | 1075 | #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ |
priyank12p | 0:b0c4c25d37ab | 1076 | |
priyank12p | 0:b0c4c25d37ab | 1077 | |
priyank12p | 0:b0c4c25d37ab | 1078 | /** |
priyank12p | 0:b0c4c25d37ab | 1079 | * @brief Instance structure for the Q7 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1080 | */ |
priyank12p | 0:b0c4c25d37ab | 1081 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1082 | { |
priyank12p | 0:b0c4c25d37ab | 1083 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 1084 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 1085 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 1086 | } arm_fir_instance_q7; |
priyank12p | 0:b0c4c25d37ab | 1087 | |
priyank12p | 0:b0c4c25d37ab | 1088 | /** |
priyank12p | 0:b0c4c25d37ab | 1089 | * @brief Instance structure for the Q15 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1090 | */ |
priyank12p | 0:b0c4c25d37ab | 1091 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1092 | { |
priyank12p | 0:b0c4c25d37ab | 1093 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 1094 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 1095 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 1096 | } arm_fir_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 1097 | |
priyank12p | 0:b0c4c25d37ab | 1098 | /** |
priyank12p | 0:b0c4c25d37ab | 1099 | * @brief Instance structure for the Q31 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1100 | */ |
priyank12p | 0:b0c4c25d37ab | 1101 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1102 | { |
priyank12p | 0:b0c4c25d37ab | 1103 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 1104 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 1105 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 1106 | } arm_fir_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 1107 | |
priyank12p | 0:b0c4c25d37ab | 1108 | /** |
priyank12p | 0:b0c4c25d37ab | 1109 | * @brief Instance structure for the floating-point FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1110 | */ |
priyank12p | 0:b0c4c25d37ab | 1111 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1112 | { |
priyank12p | 0:b0c4c25d37ab | 1113 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 1114 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 1115 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 1116 | } arm_fir_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 1117 | |
priyank12p | 0:b0c4c25d37ab | 1118 | |
priyank12p | 0:b0c4c25d37ab | 1119 | /** |
priyank12p | 0:b0c4c25d37ab | 1120 | * @brief Processing function for the Q7 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1121 | * @param[in] *S points to an instance of the Q7 FIR filter structure. |
priyank12p | 0:b0c4c25d37ab | 1122 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1123 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1124 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1125 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1126 | */ |
priyank12p | 0:b0c4c25d37ab | 1127 | void arm_fir_q7( |
priyank12p | 0:b0c4c25d37ab | 1128 | const arm_fir_instance_q7 * S, |
priyank12p | 0:b0c4c25d37ab | 1129 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1130 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1131 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1132 | |
priyank12p | 0:b0c4c25d37ab | 1133 | |
priyank12p | 0:b0c4c25d37ab | 1134 | /** |
priyank12p | 0:b0c4c25d37ab | 1135 | * @brief Initialization function for the Q7 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1136 | * @param[in,out] *S points to an instance of the Q7 FIR structure. |
priyank12p | 0:b0c4c25d37ab | 1137 | * @param[in] numTaps Number of filter coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 1138 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1139 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1140 | * @param[in] blockSize number of samples that are processed. |
priyank12p | 0:b0c4c25d37ab | 1141 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1142 | */ |
priyank12p | 0:b0c4c25d37ab | 1143 | void arm_fir_init_q7( |
priyank12p | 0:b0c4c25d37ab | 1144 | arm_fir_instance_q7 * S, |
priyank12p | 0:b0c4c25d37ab | 1145 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 1146 | q7_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1147 | q7_t * pState, |
priyank12p | 0:b0c4c25d37ab | 1148 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1149 | |
priyank12p | 0:b0c4c25d37ab | 1150 | |
priyank12p | 0:b0c4c25d37ab | 1151 | /** |
priyank12p | 0:b0c4c25d37ab | 1152 | * @brief Processing function for the Q15 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1153 | * @param[in] *S points to an instance of the Q15 FIR structure. |
priyank12p | 0:b0c4c25d37ab | 1154 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1155 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1156 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1157 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1158 | */ |
priyank12p | 0:b0c4c25d37ab | 1159 | void arm_fir_q15( |
priyank12p | 0:b0c4c25d37ab | 1160 | const arm_fir_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1161 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1162 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1163 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1164 | |
priyank12p | 0:b0c4c25d37ab | 1165 | /** |
priyank12p | 0:b0c4c25d37ab | 1166 | * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 1167 | * @param[in] *S points to an instance of the Q15 FIR filter structure. |
priyank12p | 0:b0c4c25d37ab | 1168 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1169 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1170 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1171 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1172 | */ |
priyank12p | 0:b0c4c25d37ab | 1173 | void arm_fir_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 1174 | const arm_fir_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1175 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1176 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1177 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1178 | |
priyank12p | 0:b0c4c25d37ab | 1179 | /** |
priyank12p | 0:b0c4c25d37ab | 1180 | * @brief Initialization function for the Q15 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1181 | * @param[in,out] *S points to an instance of the Q15 FIR filter structure. |
priyank12p | 0:b0c4c25d37ab | 1182 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. |
priyank12p | 0:b0c4c25d37ab | 1183 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1184 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1185 | * @param[in] blockSize number of samples that are processed at a time. |
priyank12p | 0:b0c4c25d37ab | 1186 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if |
priyank12p | 0:b0c4c25d37ab | 1187 | * <code>numTaps</code> is not a supported value. |
priyank12p | 0:b0c4c25d37ab | 1188 | */ |
priyank12p | 0:b0c4c25d37ab | 1189 | |
priyank12p | 0:b0c4c25d37ab | 1190 | arm_status arm_fir_init_q15( |
priyank12p | 0:b0c4c25d37ab | 1191 | arm_fir_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1192 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 1193 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1194 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 1195 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1196 | |
priyank12p | 0:b0c4c25d37ab | 1197 | /** |
priyank12p | 0:b0c4c25d37ab | 1198 | * @brief Processing function for the Q31 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1199 | * @param[in] *S points to an instance of the Q31 FIR filter structure. |
priyank12p | 0:b0c4c25d37ab | 1200 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1201 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1202 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1203 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1204 | */ |
priyank12p | 0:b0c4c25d37ab | 1205 | void arm_fir_q31( |
priyank12p | 0:b0c4c25d37ab | 1206 | const arm_fir_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1207 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1208 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1209 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1210 | |
priyank12p | 0:b0c4c25d37ab | 1211 | /** |
priyank12p | 0:b0c4c25d37ab | 1212 | * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 1213 | * @param[in] *S points to an instance of the Q31 FIR structure. |
priyank12p | 0:b0c4c25d37ab | 1214 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1215 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1216 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1217 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1218 | */ |
priyank12p | 0:b0c4c25d37ab | 1219 | void arm_fir_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 1220 | const arm_fir_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1221 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1222 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1223 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1224 | |
priyank12p | 0:b0c4c25d37ab | 1225 | /** |
priyank12p | 0:b0c4c25d37ab | 1226 | * @brief Initialization function for the Q31 FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1227 | * @param[in,out] *S points to an instance of the Q31 FIR structure. |
priyank12p | 0:b0c4c25d37ab | 1228 | * @param[in] numTaps Number of filter coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 1229 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1230 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1231 | * @param[in] blockSize number of samples that are processed at a time. |
priyank12p | 0:b0c4c25d37ab | 1232 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1233 | */ |
priyank12p | 0:b0c4c25d37ab | 1234 | void arm_fir_init_q31( |
priyank12p | 0:b0c4c25d37ab | 1235 | arm_fir_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1236 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 1237 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1238 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 1239 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1240 | |
priyank12p | 0:b0c4c25d37ab | 1241 | /** |
priyank12p | 0:b0c4c25d37ab | 1242 | * @brief Processing function for the floating-point FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1243 | * @param[in] *S points to an instance of the floating-point FIR structure. |
priyank12p | 0:b0c4c25d37ab | 1244 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1245 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1246 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1247 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1248 | */ |
priyank12p | 0:b0c4c25d37ab | 1249 | void arm_fir_f32( |
priyank12p | 0:b0c4c25d37ab | 1250 | const arm_fir_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 1251 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1252 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1253 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1254 | |
priyank12p | 0:b0c4c25d37ab | 1255 | /** |
priyank12p | 0:b0c4c25d37ab | 1256 | * @brief Initialization function for the floating-point FIR filter. |
priyank12p | 0:b0c4c25d37ab | 1257 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. |
priyank12p | 0:b0c4c25d37ab | 1258 | * @param[in] numTaps Number of filter coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 1259 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1260 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1261 | * @param[in] blockSize number of samples that are processed at a time. |
priyank12p | 0:b0c4c25d37ab | 1262 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1263 | */ |
priyank12p | 0:b0c4c25d37ab | 1264 | void arm_fir_init_f32( |
priyank12p | 0:b0c4c25d37ab | 1265 | arm_fir_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 1266 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 1267 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1268 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 1269 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1270 | |
priyank12p | 0:b0c4c25d37ab | 1271 | |
priyank12p | 0:b0c4c25d37ab | 1272 | /** |
priyank12p | 0:b0c4c25d37ab | 1273 | * @brief Instance structure for the Q15 Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1274 | */ |
priyank12p | 0:b0c4c25d37ab | 1275 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1276 | { |
priyank12p | 0:b0c4c25d37ab | 1277 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1278 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1279 | q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1280 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
priyank12p | 0:b0c4c25d37ab | 1281 | |
priyank12p | 0:b0c4c25d37ab | 1282 | } arm_biquad_casd_df1_inst_q15; |
priyank12p | 0:b0c4c25d37ab | 1283 | |
priyank12p | 0:b0c4c25d37ab | 1284 | |
priyank12p | 0:b0c4c25d37ab | 1285 | /** |
priyank12p | 0:b0c4c25d37ab | 1286 | * @brief Instance structure for the Q31 Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1287 | */ |
priyank12p | 0:b0c4c25d37ab | 1288 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1289 | { |
priyank12p | 0:b0c4c25d37ab | 1290 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1291 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1292 | q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1293 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
priyank12p | 0:b0c4c25d37ab | 1294 | |
priyank12p | 0:b0c4c25d37ab | 1295 | } arm_biquad_casd_df1_inst_q31; |
priyank12p | 0:b0c4c25d37ab | 1296 | |
priyank12p | 0:b0c4c25d37ab | 1297 | /** |
priyank12p | 0:b0c4c25d37ab | 1298 | * @brief Instance structure for the floating-point Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1299 | */ |
priyank12p | 0:b0c4c25d37ab | 1300 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1301 | { |
priyank12p | 0:b0c4c25d37ab | 1302 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1303 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1304 | float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 1305 | |
priyank12p | 0:b0c4c25d37ab | 1306 | |
priyank12p | 0:b0c4c25d37ab | 1307 | } arm_biquad_casd_df1_inst_f32; |
priyank12p | 0:b0c4c25d37ab | 1308 | |
priyank12p | 0:b0c4c25d37ab | 1309 | |
priyank12p | 0:b0c4c25d37ab | 1310 | |
priyank12p | 0:b0c4c25d37ab | 1311 | /** |
priyank12p | 0:b0c4c25d37ab | 1312 | * @brief Processing function for the Q15 Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1313 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1314 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1315 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1316 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1317 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1318 | */ |
priyank12p | 0:b0c4c25d37ab | 1319 | |
priyank12p | 0:b0c4c25d37ab | 1320 | void arm_biquad_cascade_df1_q15( |
priyank12p | 0:b0c4c25d37ab | 1321 | const arm_biquad_casd_df1_inst_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1322 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1323 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1324 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1325 | |
priyank12p | 0:b0c4c25d37ab | 1326 | /** |
priyank12p | 0:b0c4c25d37ab | 1327 | * @brief Initialization function for the Q15 Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1328 | * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1329 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 1330 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1331 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1332 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
priyank12p | 0:b0c4c25d37ab | 1333 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1334 | */ |
priyank12p | 0:b0c4c25d37ab | 1335 | |
priyank12p | 0:b0c4c25d37ab | 1336 | void arm_biquad_cascade_df1_init_q15( |
priyank12p | 0:b0c4c25d37ab | 1337 | arm_biquad_casd_df1_inst_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1338 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 1339 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1340 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 1341 | int8_t postShift); |
priyank12p | 0:b0c4c25d37ab | 1342 | |
priyank12p | 0:b0c4c25d37ab | 1343 | |
priyank12p | 0:b0c4c25d37ab | 1344 | /** |
priyank12p | 0:b0c4c25d37ab | 1345 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 1346 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1347 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1348 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1349 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1350 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1351 | */ |
priyank12p | 0:b0c4c25d37ab | 1352 | |
priyank12p | 0:b0c4c25d37ab | 1353 | void arm_biquad_cascade_df1_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 1354 | const arm_biquad_casd_df1_inst_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1355 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1356 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1357 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1358 | |
priyank12p | 0:b0c4c25d37ab | 1359 | |
priyank12p | 0:b0c4c25d37ab | 1360 | /** |
priyank12p | 0:b0c4c25d37ab | 1361 | * @brief Processing function for the Q31 Biquad cascade filter |
priyank12p | 0:b0c4c25d37ab | 1362 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1363 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1364 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1365 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1366 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1367 | */ |
priyank12p | 0:b0c4c25d37ab | 1368 | |
priyank12p | 0:b0c4c25d37ab | 1369 | void arm_biquad_cascade_df1_q31( |
priyank12p | 0:b0c4c25d37ab | 1370 | const arm_biquad_casd_df1_inst_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1371 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1372 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1373 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1374 | |
priyank12p | 0:b0c4c25d37ab | 1375 | /** |
priyank12p | 0:b0c4c25d37ab | 1376 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 1377 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1378 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1379 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1380 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1381 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1382 | */ |
priyank12p | 0:b0c4c25d37ab | 1383 | |
priyank12p | 0:b0c4c25d37ab | 1384 | void arm_biquad_cascade_df1_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 1385 | const arm_biquad_casd_df1_inst_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1386 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1387 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1388 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1389 | |
priyank12p | 0:b0c4c25d37ab | 1390 | /** |
priyank12p | 0:b0c4c25d37ab | 1391 | * @brief Initialization function for the Q31 Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1392 | * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1393 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 1394 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1395 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1396 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
priyank12p | 0:b0c4c25d37ab | 1397 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1398 | */ |
priyank12p | 0:b0c4c25d37ab | 1399 | |
priyank12p | 0:b0c4c25d37ab | 1400 | void arm_biquad_cascade_df1_init_q31( |
priyank12p | 0:b0c4c25d37ab | 1401 | arm_biquad_casd_df1_inst_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1402 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 1403 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1404 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 1405 | int8_t postShift); |
priyank12p | 0:b0c4c25d37ab | 1406 | |
priyank12p | 0:b0c4c25d37ab | 1407 | /** |
priyank12p | 0:b0c4c25d37ab | 1408 | * @brief Processing function for the floating-point Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1409 | * @param[in] *S points to an instance of the floating-point Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1410 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 1411 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 1412 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 1413 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1414 | */ |
priyank12p | 0:b0c4c25d37ab | 1415 | |
priyank12p | 0:b0c4c25d37ab | 1416 | void arm_biquad_cascade_df1_f32( |
priyank12p | 0:b0c4c25d37ab | 1417 | const arm_biquad_casd_df1_inst_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 1418 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1419 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1420 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1421 | |
priyank12p | 0:b0c4c25d37ab | 1422 | /** |
priyank12p | 0:b0c4c25d37ab | 1423 | * @brief Initialization function for the floating-point Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 1424 | * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. |
priyank12p | 0:b0c4c25d37ab | 1425 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 1426 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 1427 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 1428 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1429 | */ |
priyank12p | 0:b0c4c25d37ab | 1430 | |
priyank12p | 0:b0c4c25d37ab | 1431 | void arm_biquad_cascade_df1_init_f32( |
priyank12p | 0:b0c4c25d37ab | 1432 | arm_biquad_casd_df1_inst_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 1433 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 1434 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 1435 | float32_t * pState); |
priyank12p | 0:b0c4c25d37ab | 1436 | |
priyank12p | 0:b0c4c25d37ab | 1437 | |
priyank12p | 0:b0c4c25d37ab | 1438 | /** |
priyank12p | 0:b0c4c25d37ab | 1439 | * @brief Instance structure for the floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1440 | */ |
priyank12p | 0:b0c4c25d37ab | 1441 | |
priyank12p | 0:b0c4c25d37ab | 1442 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1443 | { |
priyank12p | 0:b0c4c25d37ab | 1444 | uint16_t numRows; /**< number of rows of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1445 | uint16_t numCols; /**< number of columns of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1446 | float32_t *pData; /**< points to the data of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1447 | } arm_matrix_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 1448 | |
priyank12p | 0:b0c4c25d37ab | 1449 | |
priyank12p | 0:b0c4c25d37ab | 1450 | /** |
priyank12p | 0:b0c4c25d37ab | 1451 | * @brief Instance structure for the floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1452 | */ |
priyank12p | 0:b0c4c25d37ab | 1453 | |
priyank12p | 0:b0c4c25d37ab | 1454 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1455 | { |
priyank12p | 0:b0c4c25d37ab | 1456 | uint16_t numRows; /**< number of rows of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1457 | uint16_t numCols; /**< number of columns of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1458 | float64_t *pData; /**< points to the data of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1459 | } arm_matrix_instance_f64; |
priyank12p | 0:b0c4c25d37ab | 1460 | |
priyank12p | 0:b0c4c25d37ab | 1461 | /** |
priyank12p | 0:b0c4c25d37ab | 1462 | * @brief Instance structure for the Q15 matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1463 | */ |
priyank12p | 0:b0c4c25d37ab | 1464 | |
priyank12p | 0:b0c4c25d37ab | 1465 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1466 | { |
priyank12p | 0:b0c4c25d37ab | 1467 | uint16_t numRows; /**< number of rows of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1468 | uint16_t numCols; /**< number of columns of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1469 | q15_t *pData; /**< points to the data of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1470 | |
priyank12p | 0:b0c4c25d37ab | 1471 | } arm_matrix_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 1472 | |
priyank12p | 0:b0c4c25d37ab | 1473 | /** |
priyank12p | 0:b0c4c25d37ab | 1474 | * @brief Instance structure for the Q31 matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1475 | */ |
priyank12p | 0:b0c4c25d37ab | 1476 | |
priyank12p | 0:b0c4c25d37ab | 1477 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1478 | { |
priyank12p | 0:b0c4c25d37ab | 1479 | uint16_t numRows; /**< number of rows of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1480 | uint16_t numCols; /**< number of columns of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1481 | q31_t *pData; /**< points to the data of the matrix. */ |
priyank12p | 0:b0c4c25d37ab | 1482 | |
priyank12p | 0:b0c4c25d37ab | 1483 | } arm_matrix_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 1484 | |
priyank12p | 0:b0c4c25d37ab | 1485 | |
priyank12p | 0:b0c4c25d37ab | 1486 | |
priyank12p | 0:b0c4c25d37ab | 1487 | /** |
priyank12p | 0:b0c4c25d37ab | 1488 | * @brief Floating-point matrix addition. |
priyank12p | 0:b0c4c25d37ab | 1489 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1490 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1491 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1492 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1493 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1494 | */ |
priyank12p | 0:b0c4c25d37ab | 1495 | |
priyank12p | 0:b0c4c25d37ab | 1496 | arm_status arm_mat_add_f32( |
priyank12p | 0:b0c4c25d37ab | 1497 | const arm_matrix_instance_f32 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1498 | const arm_matrix_instance_f32 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1499 | arm_matrix_instance_f32 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1500 | |
priyank12p | 0:b0c4c25d37ab | 1501 | /** |
priyank12p | 0:b0c4c25d37ab | 1502 | * @brief Q15 matrix addition. |
priyank12p | 0:b0c4c25d37ab | 1503 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1504 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1505 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1506 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1507 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1508 | */ |
priyank12p | 0:b0c4c25d37ab | 1509 | |
priyank12p | 0:b0c4c25d37ab | 1510 | arm_status arm_mat_add_q15( |
priyank12p | 0:b0c4c25d37ab | 1511 | const arm_matrix_instance_q15 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1512 | const arm_matrix_instance_q15 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1513 | arm_matrix_instance_q15 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1514 | |
priyank12p | 0:b0c4c25d37ab | 1515 | /** |
priyank12p | 0:b0c4c25d37ab | 1516 | * @brief Q31 matrix addition. |
priyank12p | 0:b0c4c25d37ab | 1517 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1518 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1519 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1520 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1521 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1522 | */ |
priyank12p | 0:b0c4c25d37ab | 1523 | |
priyank12p | 0:b0c4c25d37ab | 1524 | arm_status arm_mat_add_q31( |
priyank12p | 0:b0c4c25d37ab | 1525 | const arm_matrix_instance_q31 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1526 | const arm_matrix_instance_q31 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1527 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1528 | |
priyank12p | 0:b0c4c25d37ab | 1529 | /** |
priyank12p | 0:b0c4c25d37ab | 1530 | * @brief Floating-point, complex, matrix multiplication. |
priyank12p | 0:b0c4c25d37ab | 1531 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1532 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1533 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1534 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1535 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1536 | */ |
priyank12p | 0:b0c4c25d37ab | 1537 | |
priyank12p | 0:b0c4c25d37ab | 1538 | arm_status arm_mat_cmplx_mult_f32( |
priyank12p | 0:b0c4c25d37ab | 1539 | const arm_matrix_instance_f32 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1540 | const arm_matrix_instance_f32 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1541 | arm_matrix_instance_f32 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1542 | |
priyank12p | 0:b0c4c25d37ab | 1543 | /** |
priyank12p | 0:b0c4c25d37ab | 1544 | * @brief Q15, complex, matrix multiplication. |
priyank12p | 0:b0c4c25d37ab | 1545 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1546 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1547 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1548 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1549 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1550 | */ |
priyank12p | 0:b0c4c25d37ab | 1551 | |
priyank12p | 0:b0c4c25d37ab | 1552 | arm_status arm_mat_cmplx_mult_q15( |
priyank12p | 0:b0c4c25d37ab | 1553 | const arm_matrix_instance_q15 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1554 | const arm_matrix_instance_q15 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1555 | arm_matrix_instance_q15 * pDst, |
priyank12p | 0:b0c4c25d37ab | 1556 | q15_t * pScratch); |
priyank12p | 0:b0c4c25d37ab | 1557 | |
priyank12p | 0:b0c4c25d37ab | 1558 | /** |
priyank12p | 0:b0c4c25d37ab | 1559 | * @brief Q31, complex, matrix multiplication. |
priyank12p | 0:b0c4c25d37ab | 1560 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1561 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1562 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1563 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1564 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1565 | */ |
priyank12p | 0:b0c4c25d37ab | 1566 | |
priyank12p | 0:b0c4c25d37ab | 1567 | arm_status arm_mat_cmplx_mult_q31( |
priyank12p | 0:b0c4c25d37ab | 1568 | const arm_matrix_instance_q31 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1569 | const arm_matrix_instance_q31 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1570 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1571 | |
priyank12p | 0:b0c4c25d37ab | 1572 | |
priyank12p | 0:b0c4c25d37ab | 1573 | /** |
priyank12p | 0:b0c4c25d37ab | 1574 | * @brief Floating-point matrix transpose. |
priyank12p | 0:b0c4c25d37ab | 1575 | * @param[in] *pSrc points to the input matrix |
priyank12p | 0:b0c4c25d37ab | 1576 | * @param[out] *pDst points to the output matrix |
priyank12p | 0:b0c4c25d37ab | 1577 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
priyank12p | 0:b0c4c25d37ab | 1578 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1579 | */ |
priyank12p | 0:b0c4c25d37ab | 1580 | |
priyank12p | 0:b0c4c25d37ab | 1581 | arm_status arm_mat_trans_f32( |
priyank12p | 0:b0c4c25d37ab | 1582 | const arm_matrix_instance_f32 * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1583 | arm_matrix_instance_f32 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1584 | |
priyank12p | 0:b0c4c25d37ab | 1585 | |
priyank12p | 0:b0c4c25d37ab | 1586 | /** |
priyank12p | 0:b0c4c25d37ab | 1587 | * @brief Q15 matrix transpose. |
priyank12p | 0:b0c4c25d37ab | 1588 | * @param[in] *pSrc points to the input matrix |
priyank12p | 0:b0c4c25d37ab | 1589 | * @param[out] *pDst points to the output matrix |
priyank12p | 0:b0c4c25d37ab | 1590 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
priyank12p | 0:b0c4c25d37ab | 1591 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1592 | */ |
priyank12p | 0:b0c4c25d37ab | 1593 | |
priyank12p | 0:b0c4c25d37ab | 1594 | arm_status arm_mat_trans_q15( |
priyank12p | 0:b0c4c25d37ab | 1595 | const arm_matrix_instance_q15 * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1596 | arm_matrix_instance_q15 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1597 | |
priyank12p | 0:b0c4c25d37ab | 1598 | /** |
priyank12p | 0:b0c4c25d37ab | 1599 | * @brief Q31 matrix transpose. |
priyank12p | 0:b0c4c25d37ab | 1600 | * @param[in] *pSrc points to the input matrix |
priyank12p | 0:b0c4c25d37ab | 1601 | * @param[out] *pDst points to the output matrix |
priyank12p | 0:b0c4c25d37ab | 1602 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
priyank12p | 0:b0c4c25d37ab | 1603 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1604 | */ |
priyank12p | 0:b0c4c25d37ab | 1605 | |
priyank12p | 0:b0c4c25d37ab | 1606 | arm_status arm_mat_trans_q31( |
priyank12p | 0:b0c4c25d37ab | 1607 | const arm_matrix_instance_q31 * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1608 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1609 | |
priyank12p | 0:b0c4c25d37ab | 1610 | |
priyank12p | 0:b0c4c25d37ab | 1611 | /** |
priyank12p | 0:b0c4c25d37ab | 1612 | * @brief Floating-point matrix multiplication |
priyank12p | 0:b0c4c25d37ab | 1613 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1614 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1615 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1616 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1617 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1618 | */ |
priyank12p | 0:b0c4c25d37ab | 1619 | |
priyank12p | 0:b0c4c25d37ab | 1620 | arm_status arm_mat_mult_f32( |
priyank12p | 0:b0c4c25d37ab | 1621 | const arm_matrix_instance_f32 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1622 | const arm_matrix_instance_f32 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1623 | arm_matrix_instance_f32 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1624 | |
priyank12p | 0:b0c4c25d37ab | 1625 | /** |
priyank12p | 0:b0c4c25d37ab | 1626 | * @brief Q15 matrix multiplication |
priyank12p | 0:b0c4c25d37ab | 1627 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1628 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1629 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1630 | * @param[in] *pState points to the array for storing intermediate results |
priyank12p | 0:b0c4c25d37ab | 1631 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1632 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1633 | */ |
priyank12p | 0:b0c4c25d37ab | 1634 | |
priyank12p | 0:b0c4c25d37ab | 1635 | arm_status arm_mat_mult_q15( |
priyank12p | 0:b0c4c25d37ab | 1636 | const arm_matrix_instance_q15 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1637 | const arm_matrix_instance_q15 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1638 | arm_matrix_instance_q15 * pDst, |
priyank12p | 0:b0c4c25d37ab | 1639 | q15_t * pState); |
priyank12p | 0:b0c4c25d37ab | 1640 | |
priyank12p | 0:b0c4c25d37ab | 1641 | /** |
priyank12p | 0:b0c4c25d37ab | 1642 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 1643 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1644 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1645 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1646 | * @param[in] *pState points to the array for storing intermediate results |
priyank12p | 0:b0c4c25d37ab | 1647 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1648 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1649 | */ |
priyank12p | 0:b0c4c25d37ab | 1650 | |
priyank12p | 0:b0c4c25d37ab | 1651 | arm_status arm_mat_mult_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 1652 | const arm_matrix_instance_q15 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1653 | const arm_matrix_instance_q15 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1654 | arm_matrix_instance_q15 * pDst, |
priyank12p | 0:b0c4c25d37ab | 1655 | q15_t * pState); |
priyank12p | 0:b0c4c25d37ab | 1656 | |
priyank12p | 0:b0c4c25d37ab | 1657 | /** |
priyank12p | 0:b0c4c25d37ab | 1658 | * @brief Q31 matrix multiplication |
priyank12p | 0:b0c4c25d37ab | 1659 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1660 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1661 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1662 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1663 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1664 | */ |
priyank12p | 0:b0c4c25d37ab | 1665 | |
priyank12p | 0:b0c4c25d37ab | 1666 | arm_status arm_mat_mult_q31( |
priyank12p | 0:b0c4c25d37ab | 1667 | const arm_matrix_instance_q31 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1668 | const arm_matrix_instance_q31 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1669 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1670 | |
priyank12p | 0:b0c4c25d37ab | 1671 | /** |
priyank12p | 0:b0c4c25d37ab | 1672 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 1673 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1674 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1675 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1676 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1677 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1678 | */ |
priyank12p | 0:b0c4c25d37ab | 1679 | |
priyank12p | 0:b0c4c25d37ab | 1680 | arm_status arm_mat_mult_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 1681 | const arm_matrix_instance_q31 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1682 | const arm_matrix_instance_q31 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1683 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1684 | |
priyank12p | 0:b0c4c25d37ab | 1685 | |
priyank12p | 0:b0c4c25d37ab | 1686 | /** |
priyank12p | 0:b0c4c25d37ab | 1687 | * @brief Floating-point matrix subtraction |
priyank12p | 0:b0c4c25d37ab | 1688 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1689 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1690 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1691 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1692 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1693 | */ |
priyank12p | 0:b0c4c25d37ab | 1694 | |
priyank12p | 0:b0c4c25d37ab | 1695 | arm_status arm_mat_sub_f32( |
priyank12p | 0:b0c4c25d37ab | 1696 | const arm_matrix_instance_f32 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1697 | const arm_matrix_instance_f32 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1698 | arm_matrix_instance_f32 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1699 | |
priyank12p | 0:b0c4c25d37ab | 1700 | /** |
priyank12p | 0:b0c4c25d37ab | 1701 | * @brief Q15 matrix subtraction |
priyank12p | 0:b0c4c25d37ab | 1702 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1703 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1704 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1705 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1706 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1707 | */ |
priyank12p | 0:b0c4c25d37ab | 1708 | |
priyank12p | 0:b0c4c25d37ab | 1709 | arm_status arm_mat_sub_q15( |
priyank12p | 0:b0c4c25d37ab | 1710 | const arm_matrix_instance_q15 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1711 | const arm_matrix_instance_q15 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1712 | arm_matrix_instance_q15 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1713 | |
priyank12p | 0:b0c4c25d37ab | 1714 | /** |
priyank12p | 0:b0c4c25d37ab | 1715 | * @brief Q31 matrix subtraction |
priyank12p | 0:b0c4c25d37ab | 1716 | * @param[in] *pSrcA points to the first input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1717 | * @param[in] *pSrcB points to the second input matrix structure |
priyank12p | 0:b0c4c25d37ab | 1718 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1719 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1720 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1721 | */ |
priyank12p | 0:b0c4c25d37ab | 1722 | |
priyank12p | 0:b0c4c25d37ab | 1723 | arm_status arm_mat_sub_q31( |
priyank12p | 0:b0c4c25d37ab | 1724 | const arm_matrix_instance_q31 * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1725 | const arm_matrix_instance_q31 * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1726 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1727 | |
priyank12p | 0:b0c4c25d37ab | 1728 | /** |
priyank12p | 0:b0c4c25d37ab | 1729 | * @brief Floating-point matrix scaling. |
priyank12p | 0:b0c4c25d37ab | 1730 | * @param[in] *pSrc points to the input matrix |
priyank12p | 0:b0c4c25d37ab | 1731 | * @param[in] scale scale factor |
priyank12p | 0:b0c4c25d37ab | 1732 | * @param[out] *pDst points to the output matrix |
priyank12p | 0:b0c4c25d37ab | 1733 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1734 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1735 | */ |
priyank12p | 0:b0c4c25d37ab | 1736 | |
priyank12p | 0:b0c4c25d37ab | 1737 | arm_status arm_mat_scale_f32( |
priyank12p | 0:b0c4c25d37ab | 1738 | const arm_matrix_instance_f32 * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1739 | float32_t scale, |
priyank12p | 0:b0c4c25d37ab | 1740 | arm_matrix_instance_f32 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1741 | |
priyank12p | 0:b0c4c25d37ab | 1742 | /** |
priyank12p | 0:b0c4c25d37ab | 1743 | * @brief Q15 matrix scaling. |
priyank12p | 0:b0c4c25d37ab | 1744 | * @param[in] *pSrc points to input matrix |
priyank12p | 0:b0c4c25d37ab | 1745 | * @param[in] scaleFract fractional portion of the scale factor |
priyank12p | 0:b0c4c25d37ab | 1746 | * @param[in] shift number of bits to shift the result by |
priyank12p | 0:b0c4c25d37ab | 1747 | * @param[out] *pDst points to output matrix |
priyank12p | 0:b0c4c25d37ab | 1748 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1749 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1750 | */ |
priyank12p | 0:b0c4c25d37ab | 1751 | |
priyank12p | 0:b0c4c25d37ab | 1752 | arm_status arm_mat_scale_q15( |
priyank12p | 0:b0c4c25d37ab | 1753 | const arm_matrix_instance_q15 * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1754 | q15_t scaleFract, |
priyank12p | 0:b0c4c25d37ab | 1755 | int32_t shift, |
priyank12p | 0:b0c4c25d37ab | 1756 | arm_matrix_instance_q15 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1757 | |
priyank12p | 0:b0c4c25d37ab | 1758 | /** |
priyank12p | 0:b0c4c25d37ab | 1759 | * @brief Q31 matrix scaling. |
priyank12p | 0:b0c4c25d37ab | 1760 | * @param[in] *pSrc points to input matrix |
priyank12p | 0:b0c4c25d37ab | 1761 | * @param[in] scaleFract fractional portion of the scale factor |
priyank12p | 0:b0c4c25d37ab | 1762 | * @param[in] shift number of bits to shift the result by |
priyank12p | 0:b0c4c25d37ab | 1763 | * @param[out] *pDst points to output matrix structure |
priyank12p | 0:b0c4c25d37ab | 1764 | * @return The function returns either |
priyank12p | 0:b0c4c25d37ab | 1765 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
priyank12p | 0:b0c4c25d37ab | 1766 | */ |
priyank12p | 0:b0c4c25d37ab | 1767 | |
priyank12p | 0:b0c4c25d37ab | 1768 | arm_status arm_mat_scale_q31( |
priyank12p | 0:b0c4c25d37ab | 1769 | const arm_matrix_instance_q31 * pSrc, |
priyank12p | 0:b0c4c25d37ab | 1770 | q31_t scaleFract, |
priyank12p | 0:b0c4c25d37ab | 1771 | int32_t shift, |
priyank12p | 0:b0c4c25d37ab | 1772 | arm_matrix_instance_q31 * pDst); |
priyank12p | 0:b0c4c25d37ab | 1773 | |
priyank12p | 0:b0c4c25d37ab | 1774 | |
priyank12p | 0:b0c4c25d37ab | 1775 | /** |
priyank12p | 0:b0c4c25d37ab | 1776 | * @brief Q31 matrix initialization. |
priyank12p | 0:b0c4c25d37ab | 1777 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1778 | * @param[in] nRows number of rows in the matrix. |
priyank12p | 0:b0c4c25d37ab | 1779 | * @param[in] nColumns number of columns in the matrix. |
priyank12p | 0:b0c4c25d37ab | 1780 | * @param[in] *pData points to the matrix data array. |
priyank12p | 0:b0c4c25d37ab | 1781 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1782 | */ |
priyank12p | 0:b0c4c25d37ab | 1783 | |
priyank12p | 0:b0c4c25d37ab | 1784 | void arm_mat_init_q31( |
priyank12p | 0:b0c4c25d37ab | 1785 | arm_matrix_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1786 | uint16_t nRows, |
priyank12p | 0:b0c4c25d37ab | 1787 | uint16_t nColumns, |
priyank12p | 0:b0c4c25d37ab | 1788 | q31_t * pData); |
priyank12p | 0:b0c4c25d37ab | 1789 | |
priyank12p | 0:b0c4c25d37ab | 1790 | /** |
priyank12p | 0:b0c4c25d37ab | 1791 | * @brief Q15 matrix initialization. |
priyank12p | 0:b0c4c25d37ab | 1792 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1793 | * @param[in] nRows number of rows in the matrix. |
priyank12p | 0:b0c4c25d37ab | 1794 | * @param[in] nColumns number of columns in the matrix. |
priyank12p | 0:b0c4c25d37ab | 1795 | * @param[in] *pData points to the matrix data array. |
priyank12p | 0:b0c4c25d37ab | 1796 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1797 | */ |
priyank12p | 0:b0c4c25d37ab | 1798 | |
priyank12p | 0:b0c4c25d37ab | 1799 | void arm_mat_init_q15( |
priyank12p | 0:b0c4c25d37ab | 1800 | arm_matrix_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1801 | uint16_t nRows, |
priyank12p | 0:b0c4c25d37ab | 1802 | uint16_t nColumns, |
priyank12p | 0:b0c4c25d37ab | 1803 | q15_t * pData); |
priyank12p | 0:b0c4c25d37ab | 1804 | |
priyank12p | 0:b0c4c25d37ab | 1805 | /** |
priyank12p | 0:b0c4c25d37ab | 1806 | * @brief Floating-point matrix initialization. |
priyank12p | 0:b0c4c25d37ab | 1807 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 1808 | * @param[in] nRows number of rows in the matrix. |
priyank12p | 0:b0c4c25d37ab | 1809 | * @param[in] nColumns number of columns in the matrix. |
priyank12p | 0:b0c4c25d37ab | 1810 | * @param[in] *pData points to the matrix data array. |
priyank12p | 0:b0c4c25d37ab | 1811 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1812 | */ |
priyank12p | 0:b0c4c25d37ab | 1813 | |
priyank12p | 0:b0c4c25d37ab | 1814 | void arm_mat_init_f32( |
priyank12p | 0:b0c4c25d37ab | 1815 | arm_matrix_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 1816 | uint16_t nRows, |
priyank12p | 0:b0c4c25d37ab | 1817 | uint16_t nColumns, |
priyank12p | 0:b0c4c25d37ab | 1818 | float32_t * pData); |
priyank12p | 0:b0c4c25d37ab | 1819 | |
priyank12p | 0:b0c4c25d37ab | 1820 | |
priyank12p | 0:b0c4c25d37ab | 1821 | |
priyank12p | 0:b0c4c25d37ab | 1822 | /** |
priyank12p | 0:b0c4c25d37ab | 1823 | * @brief Instance structure for the Q15 PID Control. |
priyank12p | 0:b0c4c25d37ab | 1824 | */ |
priyank12p | 0:b0c4c25d37ab | 1825 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1826 | { |
priyank12p | 0:b0c4c25d37ab | 1827 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
priyank12p | 0:b0c4c25d37ab | 1828 | #ifdef ARM_MATH_CM0_FAMILY |
priyank12p | 0:b0c4c25d37ab | 1829 | q15_t A1; |
priyank12p | 0:b0c4c25d37ab | 1830 | q15_t A2; |
priyank12p | 0:b0c4c25d37ab | 1831 | #else |
priyank12p | 0:b0c4c25d37ab | 1832 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ |
priyank12p | 0:b0c4c25d37ab | 1833 | #endif |
priyank12p | 0:b0c4c25d37ab | 1834 | q15_t state[3]; /**< The state array of length 3. */ |
priyank12p | 0:b0c4c25d37ab | 1835 | q15_t Kp; /**< The proportional gain. */ |
priyank12p | 0:b0c4c25d37ab | 1836 | q15_t Ki; /**< The integral gain. */ |
priyank12p | 0:b0c4c25d37ab | 1837 | q15_t Kd; /**< The derivative gain. */ |
priyank12p | 0:b0c4c25d37ab | 1838 | } arm_pid_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 1839 | |
priyank12p | 0:b0c4c25d37ab | 1840 | /** |
priyank12p | 0:b0c4c25d37ab | 1841 | * @brief Instance structure for the Q31 PID Control. |
priyank12p | 0:b0c4c25d37ab | 1842 | */ |
priyank12p | 0:b0c4c25d37ab | 1843 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1844 | { |
priyank12p | 0:b0c4c25d37ab | 1845 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
priyank12p | 0:b0c4c25d37ab | 1846 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
priyank12p | 0:b0c4c25d37ab | 1847 | q31_t A2; /**< The derived gain, A2 = Kd . */ |
priyank12p | 0:b0c4c25d37ab | 1848 | q31_t state[3]; /**< The state array of length 3. */ |
priyank12p | 0:b0c4c25d37ab | 1849 | q31_t Kp; /**< The proportional gain. */ |
priyank12p | 0:b0c4c25d37ab | 1850 | q31_t Ki; /**< The integral gain. */ |
priyank12p | 0:b0c4c25d37ab | 1851 | q31_t Kd; /**< The derivative gain. */ |
priyank12p | 0:b0c4c25d37ab | 1852 | |
priyank12p | 0:b0c4c25d37ab | 1853 | } arm_pid_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 1854 | |
priyank12p | 0:b0c4c25d37ab | 1855 | /** |
priyank12p | 0:b0c4c25d37ab | 1856 | * @brief Instance structure for the floating-point PID Control. |
priyank12p | 0:b0c4c25d37ab | 1857 | */ |
priyank12p | 0:b0c4c25d37ab | 1858 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1859 | { |
priyank12p | 0:b0c4c25d37ab | 1860 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
priyank12p | 0:b0c4c25d37ab | 1861 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
priyank12p | 0:b0c4c25d37ab | 1862 | float32_t A2; /**< The derived gain, A2 = Kd . */ |
priyank12p | 0:b0c4c25d37ab | 1863 | float32_t state[3]; /**< The state array of length 3. */ |
priyank12p | 0:b0c4c25d37ab | 1864 | float32_t Kp; /**< The proportional gain. */ |
priyank12p | 0:b0c4c25d37ab | 1865 | float32_t Ki; /**< The integral gain. */ |
priyank12p | 0:b0c4c25d37ab | 1866 | float32_t Kd; /**< The derivative gain. */ |
priyank12p | 0:b0c4c25d37ab | 1867 | } arm_pid_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 1868 | |
priyank12p | 0:b0c4c25d37ab | 1869 | |
priyank12p | 0:b0c4c25d37ab | 1870 | |
priyank12p | 0:b0c4c25d37ab | 1871 | /** |
priyank12p | 0:b0c4c25d37ab | 1872 | * @brief Initialization function for the floating-point PID Control. |
priyank12p | 0:b0c4c25d37ab | 1873 | * @param[in,out] *S points to an instance of the PID structure. |
priyank12p | 0:b0c4c25d37ab | 1874 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
priyank12p | 0:b0c4c25d37ab | 1875 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1876 | */ |
priyank12p | 0:b0c4c25d37ab | 1877 | void arm_pid_init_f32( |
priyank12p | 0:b0c4c25d37ab | 1878 | arm_pid_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 1879 | int32_t resetStateFlag); |
priyank12p | 0:b0c4c25d37ab | 1880 | |
priyank12p | 0:b0c4c25d37ab | 1881 | /** |
priyank12p | 0:b0c4c25d37ab | 1882 | * @brief Reset function for the floating-point PID Control. |
priyank12p | 0:b0c4c25d37ab | 1883 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
priyank12p | 0:b0c4c25d37ab | 1884 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1885 | */ |
priyank12p | 0:b0c4c25d37ab | 1886 | void arm_pid_reset_f32( |
priyank12p | 0:b0c4c25d37ab | 1887 | arm_pid_instance_f32 * S); |
priyank12p | 0:b0c4c25d37ab | 1888 | |
priyank12p | 0:b0c4c25d37ab | 1889 | |
priyank12p | 0:b0c4c25d37ab | 1890 | /** |
priyank12p | 0:b0c4c25d37ab | 1891 | * @brief Initialization function for the Q31 PID Control. |
priyank12p | 0:b0c4c25d37ab | 1892 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
priyank12p | 0:b0c4c25d37ab | 1893 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
priyank12p | 0:b0c4c25d37ab | 1894 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1895 | */ |
priyank12p | 0:b0c4c25d37ab | 1896 | void arm_pid_init_q31( |
priyank12p | 0:b0c4c25d37ab | 1897 | arm_pid_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 1898 | int32_t resetStateFlag); |
priyank12p | 0:b0c4c25d37ab | 1899 | |
priyank12p | 0:b0c4c25d37ab | 1900 | |
priyank12p | 0:b0c4c25d37ab | 1901 | /** |
priyank12p | 0:b0c4c25d37ab | 1902 | * @brief Reset function for the Q31 PID Control. |
priyank12p | 0:b0c4c25d37ab | 1903 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
priyank12p | 0:b0c4c25d37ab | 1904 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1905 | */ |
priyank12p | 0:b0c4c25d37ab | 1906 | |
priyank12p | 0:b0c4c25d37ab | 1907 | void arm_pid_reset_q31( |
priyank12p | 0:b0c4c25d37ab | 1908 | arm_pid_instance_q31 * S); |
priyank12p | 0:b0c4c25d37ab | 1909 | |
priyank12p | 0:b0c4c25d37ab | 1910 | /** |
priyank12p | 0:b0c4c25d37ab | 1911 | * @brief Initialization function for the Q15 PID Control. |
priyank12p | 0:b0c4c25d37ab | 1912 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
priyank12p | 0:b0c4c25d37ab | 1913 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
priyank12p | 0:b0c4c25d37ab | 1914 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1915 | */ |
priyank12p | 0:b0c4c25d37ab | 1916 | void arm_pid_init_q15( |
priyank12p | 0:b0c4c25d37ab | 1917 | arm_pid_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 1918 | int32_t resetStateFlag); |
priyank12p | 0:b0c4c25d37ab | 1919 | |
priyank12p | 0:b0c4c25d37ab | 1920 | /** |
priyank12p | 0:b0c4c25d37ab | 1921 | * @brief Reset function for the Q15 PID Control. |
priyank12p | 0:b0c4c25d37ab | 1922 | * @param[in,out] *S points to an instance of the q15 PID Control structure |
priyank12p | 0:b0c4c25d37ab | 1923 | * @return none |
priyank12p | 0:b0c4c25d37ab | 1924 | */ |
priyank12p | 0:b0c4c25d37ab | 1925 | void arm_pid_reset_q15( |
priyank12p | 0:b0c4c25d37ab | 1926 | arm_pid_instance_q15 * S); |
priyank12p | 0:b0c4c25d37ab | 1927 | |
priyank12p | 0:b0c4c25d37ab | 1928 | |
priyank12p | 0:b0c4c25d37ab | 1929 | /** |
priyank12p | 0:b0c4c25d37ab | 1930 | * @brief Instance structure for the floating-point Linear Interpolate function. |
priyank12p | 0:b0c4c25d37ab | 1931 | */ |
priyank12p | 0:b0c4c25d37ab | 1932 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1933 | { |
priyank12p | 0:b0c4c25d37ab | 1934 | uint32_t nValues; /**< nValues */ |
priyank12p | 0:b0c4c25d37ab | 1935 | float32_t x1; /**< x1 */ |
priyank12p | 0:b0c4c25d37ab | 1936 | float32_t xSpacing; /**< xSpacing */ |
priyank12p | 0:b0c4c25d37ab | 1937 | float32_t *pYData; /**< pointer to the table of Y values */ |
priyank12p | 0:b0c4c25d37ab | 1938 | } arm_linear_interp_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 1939 | |
priyank12p | 0:b0c4c25d37ab | 1940 | /** |
priyank12p | 0:b0c4c25d37ab | 1941 | * @brief Instance structure for the floating-point bilinear interpolation function. |
priyank12p | 0:b0c4c25d37ab | 1942 | */ |
priyank12p | 0:b0c4c25d37ab | 1943 | |
priyank12p | 0:b0c4c25d37ab | 1944 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1945 | { |
priyank12p | 0:b0c4c25d37ab | 1946 | uint16_t numRows; /**< number of rows in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1947 | uint16_t numCols; /**< number of columns in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1948 | float32_t *pData; /**< points to the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1949 | } arm_bilinear_interp_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 1950 | |
priyank12p | 0:b0c4c25d37ab | 1951 | /** |
priyank12p | 0:b0c4c25d37ab | 1952 | * @brief Instance structure for the Q31 bilinear interpolation function. |
priyank12p | 0:b0c4c25d37ab | 1953 | */ |
priyank12p | 0:b0c4c25d37ab | 1954 | |
priyank12p | 0:b0c4c25d37ab | 1955 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1956 | { |
priyank12p | 0:b0c4c25d37ab | 1957 | uint16_t numRows; /**< number of rows in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1958 | uint16_t numCols; /**< number of columns in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1959 | q31_t *pData; /**< points to the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1960 | } arm_bilinear_interp_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 1961 | |
priyank12p | 0:b0c4c25d37ab | 1962 | /** |
priyank12p | 0:b0c4c25d37ab | 1963 | * @brief Instance structure for the Q15 bilinear interpolation function. |
priyank12p | 0:b0c4c25d37ab | 1964 | */ |
priyank12p | 0:b0c4c25d37ab | 1965 | |
priyank12p | 0:b0c4c25d37ab | 1966 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1967 | { |
priyank12p | 0:b0c4c25d37ab | 1968 | uint16_t numRows; /**< number of rows in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1969 | uint16_t numCols; /**< number of columns in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1970 | q15_t *pData; /**< points to the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1971 | } arm_bilinear_interp_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 1972 | |
priyank12p | 0:b0c4c25d37ab | 1973 | /** |
priyank12p | 0:b0c4c25d37ab | 1974 | * @brief Instance structure for the Q15 bilinear interpolation function. |
priyank12p | 0:b0c4c25d37ab | 1975 | */ |
priyank12p | 0:b0c4c25d37ab | 1976 | |
priyank12p | 0:b0c4c25d37ab | 1977 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 1978 | { |
priyank12p | 0:b0c4c25d37ab | 1979 | uint16_t numRows; /**< number of rows in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1980 | uint16_t numCols; /**< number of columns in the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1981 | q7_t *pData; /**< points to the data table. */ |
priyank12p | 0:b0c4c25d37ab | 1982 | } arm_bilinear_interp_instance_q7; |
priyank12p | 0:b0c4c25d37ab | 1983 | |
priyank12p | 0:b0c4c25d37ab | 1984 | |
priyank12p | 0:b0c4c25d37ab | 1985 | /** |
priyank12p | 0:b0c4c25d37ab | 1986 | * @brief Q7 vector multiplication. |
priyank12p | 0:b0c4c25d37ab | 1987 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 1988 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 1989 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 1990 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 1991 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 1992 | */ |
priyank12p | 0:b0c4c25d37ab | 1993 | |
priyank12p | 0:b0c4c25d37ab | 1994 | void arm_mult_q7( |
priyank12p | 0:b0c4c25d37ab | 1995 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 1996 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 1997 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 1998 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 1999 | |
priyank12p | 0:b0c4c25d37ab | 2000 | /** |
priyank12p | 0:b0c4c25d37ab | 2001 | * @brief Q15 vector multiplication. |
priyank12p | 0:b0c4c25d37ab | 2002 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2003 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2004 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2005 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2006 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2007 | */ |
priyank12p | 0:b0c4c25d37ab | 2008 | |
priyank12p | 0:b0c4c25d37ab | 2009 | void arm_mult_q15( |
priyank12p | 0:b0c4c25d37ab | 2010 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2011 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2012 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2013 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2014 | |
priyank12p | 0:b0c4c25d37ab | 2015 | /** |
priyank12p | 0:b0c4c25d37ab | 2016 | * @brief Q31 vector multiplication. |
priyank12p | 0:b0c4c25d37ab | 2017 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2018 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2019 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2020 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2021 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2022 | */ |
priyank12p | 0:b0c4c25d37ab | 2023 | |
priyank12p | 0:b0c4c25d37ab | 2024 | void arm_mult_q31( |
priyank12p | 0:b0c4c25d37ab | 2025 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2026 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2027 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2028 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2029 | |
priyank12p | 0:b0c4c25d37ab | 2030 | /** |
priyank12p | 0:b0c4c25d37ab | 2031 | * @brief Floating-point vector multiplication. |
priyank12p | 0:b0c4c25d37ab | 2032 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2033 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2034 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2035 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2036 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2037 | */ |
priyank12p | 0:b0c4c25d37ab | 2038 | |
priyank12p | 0:b0c4c25d37ab | 2039 | void arm_mult_f32( |
priyank12p | 0:b0c4c25d37ab | 2040 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2041 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2042 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2043 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2044 | |
priyank12p | 0:b0c4c25d37ab | 2045 | |
priyank12p | 0:b0c4c25d37ab | 2046 | |
priyank12p | 0:b0c4c25d37ab | 2047 | |
priyank12p | 0:b0c4c25d37ab | 2048 | |
priyank12p | 0:b0c4c25d37ab | 2049 | |
priyank12p | 0:b0c4c25d37ab | 2050 | /** |
priyank12p | 0:b0c4c25d37ab | 2051 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2052 | */ |
priyank12p | 0:b0c4c25d37ab | 2053 | |
priyank12p | 0:b0c4c25d37ab | 2054 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2055 | { |
priyank12p | 0:b0c4c25d37ab | 2056 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2057 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2058 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2059 | q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2060 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2061 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2062 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2063 | } arm_cfft_radix2_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 2064 | |
priyank12p | 0:b0c4c25d37ab | 2065 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2066 | arm_status arm_cfft_radix2_init_q15( |
priyank12p | 0:b0c4c25d37ab | 2067 | arm_cfft_radix2_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2068 | uint16_t fftLen, |
priyank12p | 0:b0c4c25d37ab | 2069 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2070 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2071 | |
priyank12p | 0:b0c4c25d37ab | 2072 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2073 | void arm_cfft_radix2_q15( |
priyank12p | 0:b0c4c25d37ab | 2074 | const arm_cfft_radix2_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2075 | q15_t * pSrc); |
priyank12p | 0:b0c4c25d37ab | 2076 | |
priyank12p | 0:b0c4c25d37ab | 2077 | |
priyank12p | 0:b0c4c25d37ab | 2078 | |
priyank12p | 0:b0c4c25d37ab | 2079 | /** |
priyank12p | 0:b0c4c25d37ab | 2080 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2081 | */ |
priyank12p | 0:b0c4c25d37ab | 2082 | |
priyank12p | 0:b0c4c25d37ab | 2083 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2084 | { |
priyank12p | 0:b0c4c25d37ab | 2085 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2086 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2087 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2088 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2089 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2090 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2091 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2092 | } arm_cfft_radix4_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 2093 | |
priyank12p | 0:b0c4c25d37ab | 2094 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2095 | arm_status arm_cfft_radix4_init_q15( |
priyank12p | 0:b0c4c25d37ab | 2096 | arm_cfft_radix4_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2097 | uint16_t fftLen, |
priyank12p | 0:b0c4c25d37ab | 2098 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2099 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2100 | |
priyank12p | 0:b0c4c25d37ab | 2101 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2102 | void arm_cfft_radix4_q15( |
priyank12p | 0:b0c4c25d37ab | 2103 | const arm_cfft_radix4_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2104 | q15_t * pSrc); |
priyank12p | 0:b0c4c25d37ab | 2105 | |
priyank12p | 0:b0c4c25d37ab | 2106 | /** |
priyank12p | 0:b0c4c25d37ab | 2107 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2108 | */ |
priyank12p | 0:b0c4c25d37ab | 2109 | |
priyank12p | 0:b0c4c25d37ab | 2110 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2111 | { |
priyank12p | 0:b0c4c25d37ab | 2112 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2113 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2114 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2115 | q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2116 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2117 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2118 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2119 | } arm_cfft_radix2_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 2120 | |
priyank12p | 0:b0c4c25d37ab | 2121 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2122 | arm_status arm_cfft_radix2_init_q31( |
priyank12p | 0:b0c4c25d37ab | 2123 | arm_cfft_radix2_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2124 | uint16_t fftLen, |
priyank12p | 0:b0c4c25d37ab | 2125 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2126 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2127 | |
priyank12p | 0:b0c4c25d37ab | 2128 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2129 | void arm_cfft_radix2_q31( |
priyank12p | 0:b0c4c25d37ab | 2130 | const arm_cfft_radix2_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2131 | q31_t * pSrc); |
priyank12p | 0:b0c4c25d37ab | 2132 | |
priyank12p | 0:b0c4c25d37ab | 2133 | /** |
priyank12p | 0:b0c4c25d37ab | 2134 | * @brief Instance structure for the Q31 CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2135 | */ |
priyank12p | 0:b0c4c25d37ab | 2136 | |
priyank12p | 0:b0c4c25d37ab | 2137 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2138 | { |
priyank12p | 0:b0c4c25d37ab | 2139 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2140 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2141 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2142 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2143 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2144 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2145 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2146 | } arm_cfft_radix4_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 2147 | |
priyank12p | 0:b0c4c25d37ab | 2148 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2149 | void arm_cfft_radix4_q31( |
priyank12p | 0:b0c4c25d37ab | 2150 | const arm_cfft_radix4_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2151 | q31_t * pSrc); |
priyank12p | 0:b0c4c25d37ab | 2152 | |
priyank12p | 0:b0c4c25d37ab | 2153 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2154 | arm_status arm_cfft_radix4_init_q31( |
priyank12p | 0:b0c4c25d37ab | 2155 | arm_cfft_radix4_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2156 | uint16_t fftLen, |
priyank12p | 0:b0c4c25d37ab | 2157 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2158 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2159 | |
priyank12p | 0:b0c4c25d37ab | 2160 | /** |
priyank12p | 0:b0c4c25d37ab | 2161 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2162 | */ |
priyank12p | 0:b0c4c25d37ab | 2163 | |
priyank12p | 0:b0c4c25d37ab | 2164 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2165 | { |
priyank12p | 0:b0c4c25d37ab | 2166 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2167 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2168 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2169 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2170 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2171 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2172 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2173 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
priyank12p | 0:b0c4c25d37ab | 2174 | } arm_cfft_radix2_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 2175 | |
priyank12p | 0:b0c4c25d37ab | 2176 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2177 | arm_status arm_cfft_radix2_init_f32( |
priyank12p | 0:b0c4c25d37ab | 2178 | arm_cfft_radix2_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2179 | uint16_t fftLen, |
priyank12p | 0:b0c4c25d37ab | 2180 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2181 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2182 | |
priyank12p | 0:b0c4c25d37ab | 2183 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2184 | void arm_cfft_radix2_f32( |
priyank12p | 0:b0c4c25d37ab | 2185 | const arm_cfft_radix2_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2186 | float32_t * pSrc); |
priyank12p | 0:b0c4c25d37ab | 2187 | |
priyank12p | 0:b0c4c25d37ab | 2188 | /** |
priyank12p | 0:b0c4c25d37ab | 2189 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2190 | */ |
priyank12p | 0:b0c4c25d37ab | 2191 | |
priyank12p | 0:b0c4c25d37ab | 2192 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2193 | { |
priyank12p | 0:b0c4c25d37ab | 2194 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2195 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2196 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2197 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2198 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2199 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2200 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2201 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
priyank12p | 0:b0c4c25d37ab | 2202 | } arm_cfft_radix4_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 2203 | |
priyank12p | 0:b0c4c25d37ab | 2204 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2205 | arm_status arm_cfft_radix4_init_f32( |
priyank12p | 0:b0c4c25d37ab | 2206 | arm_cfft_radix4_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2207 | uint16_t fftLen, |
priyank12p | 0:b0c4c25d37ab | 2208 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2209 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2210 | |
priyank12p | 0:b0c4c25d37ab | 2211 | /* Deprecated */ |
priyank12p | 0:b0c4c25d37ab | 2212 | void arm_cfft_radix4_f32( |
priyank12p | 0:b0c4c25d37ab | 2213 | const arm_cfft_radix4_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2214 | float32_t * pSrc); |
priyank12p | 0:b0c4c25d37ab | 2215 | |
priyank12p | 0:b0c4c25d37ab | 2216 | /** |
priyank12p | 0:b0c4c25d37ab | 2217 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2218 | */ |
priyank12p | 0:b0c4c25d37ab | 2219 | |
priyank12p | 0:b0c4c25d37ab | 2220 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2221 | { |
priyank12p | 0:b0c4c25d37ab | 2222 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2223 | const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2224 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2225 | uint16_t bitRevLength; /**< bit reversal table length. */ |
priyank12p | 0:b0c4c25d37ab | 2226 | } arm_cfft_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 2227 | |
priyank12p | 0:b0c4c25d37ab | 2228 | void arm_cfft_q15( |
priyank12p | 0:b0c4c25d37ab | 2229 | const arm_cfft_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2230 | q15_t * p1, |
priyank12p | 0:b0c4c25d37ab | 2231 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2232 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2233 | |
priyank12p | 0:b0c4c25d37ab | 2234 | /** |
priyank12p | 0:b0c4c25d37ab | 2235 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2236 | */ |
priyank12p | 0:b0c4c25d37ab | 2237 | |
priyank12p | 0:b0c4c25d37ab | 2238 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2239 | { |
priyank12p | 0:b0c4c25d37ab | 2240 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2241 | const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2242 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2243 | uint16_t bitRevLength; /**< bit reversal table length. */ |
priyank12p | 0:b0c4c25d37ab | 2244 | } arm_cfft_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 2245 | |
priyank12p | 0:b0c4c25d37ab | 2246 | void arm_cfft_q31( |
priyank12p | 0:b0c4c25d37ab | 2247 | const arm_cfft_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2248 | q31_t * p1, |
priyank12p | 0:b0c4c25d37ab | 2249 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2250 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2251 | |
priyank12p | 0:b0c4c25d37ab | 2252 | /** |
priyank12p | 0:b0c4c25d37ab | 2253 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2254 | */ |
priyank12p | 0:b0c4c25d37ab | 2255 | |
priyank12p | 0:b0c4c25d37ab | 2256 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2257 | { |
priyank12p | 0:b0c4c25d37ab | 2258 | uint16_t fftLen; /**< length of the FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2259 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2260 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
priyank12p | 0:b0c4c25d37ab | 2261 | uint16_t bitRevLength; /**< bit reversal table length. */ |
priyank12p | 0:b0c4c25d37ab | 2262 | } arm_cfft_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 2263 | |
priyank12p | 0:b0c4c25d37ab | 2264 | void arm_cfft_f32( |
priyank12p | 0:b0c4c25d37ab | 2265 | const arm_cfft_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2266 | float32_t * p1, |
priyank12p | 0:b0c4c25d37ab | 2267 | uint8_t ifftFlag, |
priyank12p | 0:b0c4c25d37ab | 2268 | uint8_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2269 | |
priyank12p | 0:b0c4c25d37ab | 2270 | /** |
priyank12p | 0:b0c4c25d37ab | 2271 | * @brief Instance structure for the Q15 RFFT/RIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2272 | */ |
priyank12p | 0:b0c4c25d37ab | 2273 | |
priyank12p | 0:b0c4c25d37ab | 2274 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2275 | { |
priyank12p | 0:b0c4c25d37ab | 2276 | uint32_t fftLenReal; /**< length of the real FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2277 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2278 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2279 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2280 | q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2281 | q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2282 | const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2283 | } arm_rfft_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 2284 | |
priyank12p | 0:b0c4c25d37ab | 2285 | arm_status arm_rfft_init_q15( |
priyank12p | 0:b0c4c25d37ab | 2286 | arm_rfft_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2287 | uint32_t fftLenReal, |
priyank12p | 0:b0c4c25d37ab | 2288 | uint32_t ifftFlagR, |
priyank12p | 0:b0c4c25d37ab | 2289 | uint32_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2290 | |
priyank12p | 0:b0c4c25d37ab | 2291 | void arm_rfft_q15( |
priyank12p | 0:b0c4c25d37ab | 2292 | const arm_rfft_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2293 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2294 | q15_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 2295 | |
priyank12p | 0:b0c4c25d37ab | 2296 | /** |
priyank12p | 0:b0c4c25d37ab | 2297 | * @brief Instance structure for the Q31 RFFT/RIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2298 | */ |
priyank12p | 0:b0c4c25d37ab | 2299 | |
priyank12p | 0:b0c4c25d37ab | 2300 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2301 | { |
priyank12p | 0:b0c4c25d37ab | 2302 | uint32_t fftLenReal; /**< length of the real FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2303 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2304 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2305 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2306 | q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2307 | q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2308 | const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2309 | } arm_rfft_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 2310 | |
priyank12p | 0:b0c4c25d37ab | 2311 | arm_status arm_rfft_init_q31( |
priyank12p | 0:b0c4c25d37ab | 2312 | arm_rfft_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2313 | uint32_t fftLenReal, |
priyank12p | 0:b0c4c25d37ab | 2314 | uint32_t ifftFlagR, |
priyank12p | 0:b0c4c25d37ab | 2315 | uint32_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2316 | |
priyank12p | 0:b0c4c25d37ab | 2317 | void arm_rfft_q31( |
priyank12p | 0:b0c4c25d37ab | 2318 | const arm_rfft_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2319 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2320 | q31_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 2321 | |
priyank12p | 0:b0c4c25d37ab | 2322 | /** |
priyank12p | 0:b0c4c25d37ab | 2323 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2324 | */ |
priyank12p | 0:b0c4c25d37ab | 2325 | |
priyank12p | 0:b0c4c25d37ab | 2326 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2327 | { |
priyank12p | 0:b0c4c25d37ab | 2328 | uint32_t fftLenReal; /**< length of the real FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2329 | uint16_t fftLenBy2; /**< length of the complex FFT. */ |
priyank12p | 0:b0c4c25d37ab | 2330 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
priyank12p | 0:b0c4c25d37ab | 2331 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
priyank12p | 0:b0c4c25d37ab | 2332 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2333 | float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2334 | float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2335 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2336 | } arm_rfft_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 2337 | |
priyank12p | 0:b0c4c25d37ab | 2338 | arm_status arm_rfft_init_f32( |
priyank12p | 0:b0c4c25d37ab | 2339 | arm_rfft_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2340 | arm_cfft_radix4_instance_f32 * S_CFFT, |
priyank12p | 0:b0c4c25d37ab | 2341 | uint32_t fftLenReal, |
priyank12p | 0:b0c4c25d37ab | 2342 | uint32_t ifftFlagR, |
priyank12p | 0:b0c4c25d37ab | 2343 | uint32_t bitReverseFlag); |
priyank12p | 0:b0c4c25d37ab | 2344 | |
priyank12p | 0:b0c4c25d37ab | 2345 | void arm_rfft_f32( |
priyank12p | 0:b0c4c25d37ab | 2346 | const arm_rfft_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2347 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2348 | float32_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 2349 | |
priyank12p | 0:b0c4c25d37ab | 2350 | /** |
priyank12p | 0:b0c4c25d37ab | 2351 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
priyank12p | 0:b0c4c25d37ab | 2352 | */ |
priyank12p | 0:b0c4c25d37ab | 2353 | |
priyank12p | 0:b0c4c25d37ab | 2354 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2355 | { |
priyank12p | 0:b0c4c25d37ab | 2356 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ |
priyank12p | 0:b0c4c25d37ab | 2357 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
priyank12p | 0:b0c4c25d37ab | 2358 | float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
priyank12p | 0:b0c4c25d37ab | 2359 | } arm_rfft_fast_instance_f32 ; |
priyank12p | 0:b0c4c25d37ab | 2360 | |
priyank12p | 0:b0c4c25d37ab | 2361 | arm_status arm_rfft_fast_init_f32 ( |
priyank12p | 0:b0c4c25d37ab | 2362 | arm_rfft_fast_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2363 | uint16_t fftLen); |
priyank12p | 0:b0c4c25d37ab | 2364 | |
priyank12p | 0:b0c4c25d37ab | 2365 | void arm_rfft_fast_f32( |
priyank12p | 0:b0c4c25d37ab | 2366 | arm_rfft_fast_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2367 | float32_t * p, float32_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 2368 | uint8_t ifftFlag); |
priyank12p | 0:b0c4c25d37ab | 2369 | |
priyank12p | 0:b0c4c25d37ab | 2370 | /** |
priyank12p | 0:b0c4c25d37ab | 2371 | * @brief Instance structure for the floating-point DCT4/IDCT4 function. |
priyank12p | 0:b0c4c25d37ab | 2372 | */ |
priyank12p | 0:b0c4c25d37ab | 2373 | |
priyank12p | 0:b0c4c25d37ab | 2374 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2375 | { |
priyank12p | 0:b0c4c25d37ab | 2376 | uint16_t N; /**< length of the DCT4. */ |
priyank12p | 0:b0c4c25d37ab | 2377 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
priyank12p | 0:b0c4c25d37ab | 2378 | float32_t normalize; /**< normalizing factor. */ |
priyank12p | 0:b0c4c25d37ab | 2379 | float32_t *pTwiddle; /**< points to the twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2380 | float32_t *pCosFactor; /**< points to the cosFactor table. */ |
priyank12p | 0:b0c4c25d37ab | 2381 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2382 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2383 | } arm_dct4_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 2384 | |
priyank12p | 0:b0c4c25d37ab | 2385 | /** |
priyank12p | 0:b0c4c25d37ab | 2386 | * @brief Initialization function for the floating-point DCT4/IDCT4. |
priyank12p | 0:b0c4c25d37ab | 2387 | * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure. |
priyank12p | 0:b0c4c25d37ab | 2388 | * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure. |
priyank12p | 0:b0c4c25d37ab | 2389 | * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure. |
priyank12p | 0:b0c4c25d37ab | 2390 | * @param[in] N length of the DCT4. |
priyank12p | 0:b0c4c25d37ab | 2391 | * @param[in] Nby2 half of the length of the DCT4. |
priyank12p | 0:b0c4c25d37ab | 2392 | * @param[in] normalize normalizing factor. |
priyank12p | 0:b0c4c25d37ab | 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. |
priyank12p | 0:b0c4c25d37ab | 2394 | */ |
priyank12p | 0:b0c4c25d37ab | 2395 | |
priyank12p | 0:b0c4c25d37ab | 2396 | arm_status arm_dct4_init_f32( |
priyank12p | 0:b0c4c25d37ab | 2397 | arm_dct4_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2398 | arm_rfft_instance_f32 * S_RFFT, |
priyank12p | 0:b0c4c25d37ab | 2399 | arm_cfft_radix4_instance_f32 * S_CFFT, |
priyank12p | 0:b0c4c25d37ab | 2400 | uint16_t N, |
priyank12p | 0:b0c4c25d37ab | 2401 | uint16_t Nby2, |
priyank12p | 0:b0c4c25d37ab | 2402 | float32_t normalize); |
priyank12p | 0:b0c4c25d37ab | 2403 | |
priyank12p | 0:b0c4c25d37ab | 2404 | /** |
priyank12p | 0:b0c4c25d37ab | 2405 | * @brief Processing function for the floating-point DCT4/IDCT4. |
priyank12p | 0:b0c4c25d37ab | 2406 | * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure. |
priyank12p | 0:b0c4c25d37ab | 2407 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 2408 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
priyank12p | 0:b0c4c25d37ab | 2409 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2410 | */ |
priyank12p | 0:b0c4c25d37ab | 2411 | |
priyank12p | 0:b0c4c25d37ab | 2412 | void arm_dct4_f32( |
priyank12p | 0:b0c4c25d37ab | 2413 | const arm_dct4_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 2414 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 2415 | float32_t * pInlineBuffer); |
priyank12p | 0:b0c4c25d37ab | 2416 | |
priyank12p | 0:b0c4c25d37ab | 2417 | /** |
priyank12p | 0:b0c4c25d37ab | 2418 | * @brief Instance structure for the Q31 DCT4/IDCT4 function. |
priyank12p | 0:b0c4c25d37ab | 2419 | */ |
priyank12p | 0:b0c4c25d37ab | 2420 | |
priyank12p | 0:b0c4c25d37ab | 2421 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2422 | { |
priyank12p | 0:b0c4c25d37ab | 2423 | uint16_t N; /**< length of the DCT4. */ |
priyank12p | 0:b0c4c25d37ab | 2424 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
priyank12p | 0:b0c4c25d37ab | 2425 | q31_t normalize; /**< normalizing factor. */ |
priyank12p | 0:b0c4c25d37ab | 2426 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2427 | q31_t *pCosFactor; /**< points to the cosFactor table. */ |
priyank12p | 0:b0c4c25d37ab | 2428 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2429 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2430 | } arm_dct4_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 2431 | |
priyank12p | 0:b0c4c25d37ab | 2432 | /** |
priyank12p | 0:b0c4c25d37ab | 2433 | * @brief Initialization function for the Q31 DCT4/IDCT4. |
priyank12p | 0:b0c4c25d37ab | 2434 | * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure. |
priyank12p | 0:b0c4c25d37ab | 2435 | * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure |
priyank12p | 0:b0c4c25d37ab | 2436 | * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure |
priyank12p | 0:b0c4c25d37ab | 2437 | * @param[in] N length of the DCT4. |
priyank12p | 0:b0c4c25d37ab | 2438 | * @param[in] Nby2 half of the length of the DCT4. |
priyank12p | 0:b0c4c25d37ab | 2439 | * @param[in] normalize normalizing factor. |
priyank12p | 0:b0c4c25d37ab | 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. |
priyank12p | 0:b0c4c25d37ab | 2441 | */ |
priyank12p | 0:b0c4c25d37ab | 2442 | |
priyank12p | 0:b0c4c25d37ab | 2443 | arm_status arm_dct4_init_q31( |
priyank12p | 0:b0c4c25d37ab | 2444 | arm_dct4_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2445 | arm_rfft_instance_q31 * S_RFFT, |
priyank12p | 0:b0c4c25d37ab | 2446 | arm_cfft_radix4_instance_q31 * S_CFFT, |
priyank12p | 0:b0c4c25d37ab | 2447 | uint16_t N, |
priyank12p | 0:b0c4c25d37ab | 2448 | uint16_t Nby2, |
priyank12p | 0:b0c4c25d37ab | 2449 | q31_t normalize); |
priyank12p | 0:b0c4c25d37ab | 2450 | |
priyank12p | 0:b0c4c25d37ab | 2451 | /** |
priyank12p | 0:b0c4c25d37ab | 2452 | * @brief Processing function for the Q31 DCT4/IDCT4. |
priyank12p | 0:b0c4c25d37ab | 2453 | * @param[in] *S points to an instance of the Q31 DCT4 structure. |
priyank12p | 0:b0c4c25d37ab | 2454 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 2455 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
priyank12p | 0:b0c4c25d37ab | 2456 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2457 | */ |
priyank12p | 0:b0c4c25d37ab | 2458 | |
priyank12p | 0:b0c4c25d37ab | 2459 | void arm_dct4_q31( |
priyank12p | 0:b0c4c25d37ab | 2460 | const arm_dct4_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 2461 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 2462 | q31_t * pInlineBuffer); |
priyank12p | 0:b0c4c25d37ab | 2463 | |
priyank12p | 0:b0c4c25d37ab | 2464 | /** |
priyank12p | 0:b0c4c25d37ab | 2465 | * @brief Instance structure for the Q15 DCT4/IDCT4 function. |
priyank12p | 0:b0c4c25d37ab | 2466 | */ |
priyank12p | 0:b0c4c25d37ab | 2467 | |
priyank12p | 0:b0c4c25d37ab | 2468 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 2469 | { |
priyank12p | 0:b0c4c25d37ab | 2470 | uint16_t N; /**< length of the DCT4. */ |
priyank12p | 0:b0c4c25d37ab | 2471 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
priyank12p | 0:b0c4c25d37ab | 2472 | q15_t normalize; /**< normalizing factor. */ |
priyank12p | 0:b0c4c25d37ab | 2473 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
priyank12p | 0:b0c4c25d37ab | 2474 | q15_t *pCosFactor; /**< points to the cosFactor table. */ |
priyank12p | 0:b0c4c25d37ab | 2475 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2476 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
priyank12p | 0:b0c4c25d37ab | 2477 | } arm_dct4_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 2478 | |
priyank12p | 0:b0c4c25d37ab | 2479 | /** |
priyank12p | 0:b0c4c25d37ab | 2480 | * @brief Initialization function for the Q15 DCT4/IDCT4. |
priyank12p | 0:b0c4c25d37ab | 2481 | * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure. |
priyank12p | 0:b0c4c25d37ab | 2482 | * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure. |
priyank12p | 0:b0c4c25d37ab | 2483 | * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure. |
priyank12p | 0:b0c4c25d37ab | 2484 | * @param[in] N length of the DCT4. |
priyank12p | 0:b0c4c25d37ab | 2485 | * @param[in] Nby2 half of the length of the DCT4. |
priyank12p | 0:b0c4c25d37ab | 2486 | * @param[in] normalize normalizing factor. |
priyank12p | 0:b0c4c25d37ab | 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. |
priyank12p | 0:b0c4c25d37ab | 2488 | */ |
priyank12p | 0:b0c4c25d37ab | 2489 | |
priyank12p | 0:b0c4c25d37ab | 2490 | arm_status arm_dct4_init_q15( |
priyank12p | 0:b0c4c25d37ab | 2491 | arm_dct4_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2492 | arm_rfft_instance_q15 * S_RFFT, |
priyank12p | 0:b0c4c25d37ab | 2493 | arm_cfft_radix4_instance_q15 * S_CFFT, |
priyank12p | 0:b0c4c25d37ab | 2494 | uint16_t N, |
priyank12p | 0:b0c4c25d37ab | 2495 | uint16_t Nby2, |
priyank12p | 0:b0c4c25d37ab | 2496 | q15_t normalize); |
priyank12p | 0:b0c4c25d37ab | 2497 | |
priyank12p | 0:b0c4c25d37ab | 2498 | /** |
priyank12p | 0:b0c4c25d37ab | 2499 | * @brief Processing function for the Q15 DCT4/IDCT4. |
priyank12p | 0:b0c4c25d37ab | 2500 | * @param[in] *S points to an instance of the Q15 DCT4 structure. |
priyank12p | 0:b0c4c25d37ab | 2501 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 2502 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
priyank12p | 0:b0c4c25d37ab | 2503 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2504 | */ |
priyank12p | 0:b0c4c25d37ab | 2505 | |
priyank12p | 0:b0c4c25d37ab | 2506 | void arm_dct4_q15( |
priyank12p | 0:b0c4c25d37ab | 2507 | const arm_dct4_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 2508 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 2509 | q15_t * pInlineBuffer); |
priyank12p | 0:b0c4c25d37ab | 2510 | |
priyank12p | 0:b0c4c25d37ab | 2511 | /** |
priyank12p | 0:b0c4c25d37ab | 2512 | * @brief Floating-point vector addition. |
priyank12p | 0:b0c4c25d37ab | 2513 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2514 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2515 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2516 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2517 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2518 | */ |
priyank12p | 0:b0c4c25d37ab | 2519 | |
priyank12p | 0:b0c4c25d37ab | 2520 | void arm_add_f32( |
priyank12p | 0:b0c4c25d37ab | 2521 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2522 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2523 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2524 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2525 | |
priyank12p | 0:b0c4c25d37ab | 2526 | /** |
priyank12p | 0:b0c4c25d37ab | 2527 | * @brief Q7 vector addition. |
priyank12p | 0:b0c4c25d37ab | 2528 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2529 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2530 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2531 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2532 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2533 | */ |
priyank12p | 0:b0c4c25d37ab | 2534 | |
priyank12p | 0:b0c4c25d37ab | 2535 | void arm_add_q7( |
priyank12p | 0:b0c4c25d37ab | 2536 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2537 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2538 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2539 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2540 | |
priyank12p | 0:b0c4c25d37ab | 2541 | /** |
priyank12p | 0:b0c4c25d37ab | 2542 | * @brief Q15 vector addition. |
priyank12p | 0:b0c4c25d37ab | 2543 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2544 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2545 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2546 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2547 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2548 | */ |
priyank12p | 0:b0c4c25d37ab | 2549 | |
priyank12p | 0:b0c4c25d37ab | 2550 | void arm_add_q15( |
priyank12p | 0:b0c4c25d37ab | 2551 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2552 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2553 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2554 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2555 | |
priyank12p | 0:b0c4c25d37ab | 2556 | /** |
priyank12p | 0:b0c4c25d37ab | 2557 | * @brief Q31 vector addition. |
priyank12p | 0:b0c4c25d37ab | 2558 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2559 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2560 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2561 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2562 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2563 | */ |
priyank12p | 0:b0c4c25d37ab | 2564 | |
priyank12p | 0:b0c4c25d37ab | 2565 | void arm_add_q31( |
priyank12p | 0:b0c4c25d37ab | 2566 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2567 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2568 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2569 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2570 | |
priyank12p | 0:b0c4c25d37ab | 2571 | /** |
priyank12p | 0:b0c4c25d37ab | 2572 | * @brief Floating-point vector subtraction. |
priyank12p | 0:b0c4c25d37ab | 2573 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2574 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2575 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2576 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2577 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2578 | */ |
priyank12p | 0:b0c4c25d37ab | 2579 | |
priyank12p | 0:b0c4c25d37ab | 2580 | void arm_sub_f32( |
priyank12p | 0:b0c4c25d37ab | 2581 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2582 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2583 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2584 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2585 | |
priyank12p | 0:b0c4c25d37ab | 2586 | /** |
priyank12p | 0:b0c4c25d37ab | 2587 | * @brief Q7 vector subtraction. |
priyank12p | 0:b0c4c25d37ab | 2588 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2589 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2590 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2591 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2592 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2593 | */ |
priyank12p | 0:b0c4c25d37ab | 2594 | |
priyank12p | 0:b0c4c25d37ab | 2595 | void arm_sub_q7( |
priyank12p | 0:b0c4c25d37ab | 2596 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2597 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2598 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2599 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2600 | |
priyank12p | 0:b0c4c25d37ab | 2601 | /** |
priyank12p | 0:b0c4c25d37ab | 2602 | * @brief Q15 vector subtraction. |
priyank12p | 0:b0c4c25d37ab | 2603 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2604 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2605 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2606 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2607 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2608 | */ |
priyank12p | 0:b0c4c25d37ab | 2609 | |
priyank12p | 0:b0c4c25d37ab | 2610 | void arm_sub_q15( |
priyank12p | 0:b0c4c25d37ab | 2611 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2612 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2613 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2614 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2615 | |
priyank12p | 0:b0c4c25d37ab | 2616 | /** |
priyank12p | 0:b0c4c25d37ab | 2617 | * @brief Q31 vector subtraction. |
priyank12p | 0:b0c4c25d37ab | 2618 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2619 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2620 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2621 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2622 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2623 | */ |
priyank12p | 0:b0c4c25d37ab | 2624 | |
priyank12p | 0:b0c4c25d37ab | 2625 | void arm_sub_q31( |
priyank12p | 0:b0c4c25d37ab | 2626 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2627 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2628 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2629 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2630 | |
priyank12p | 0:b0c4c25d37ab | 2631 | /** |
priyank12p | 0:b0c4c25d37ab | 2632 | * @brief Multiplies a floating-point vector by a scalar. |
priyank12p | 0:b0c4c25d37ab | 2633 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2634 | * @param[in] scale scale factor to be applied |
priyank12p | 0:b0c4c25d37ab | 2635 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2636 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2637 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2638 | */ |
priyank12p | 0:b0c4c25d37ab | 2639 | |
priyank12p | 0:b0c4c25d37ab | 2640 | void arm_scale_f32( |
priyank12p | 0:b0c4c25d37ab | 2641 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2642 | float32_t scale, |
priyank12p | 0:b0c4c25d37ab | 2643 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2644 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2645 | |
priyank12p | 0:b0c4c25d37ab | 2646 | /** |
priyank12p | 0:b0c4c25d37ab | 2647 | * @brief Multiplies a Q7 vector by a scalar. |
priyank12p | 0:b0c4c25d37ab | 2648 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2649 | * @param[in] scaleFract fractional portion of the scale value |
priyank12p | 0:b0c4c25d37ab | 2650 | * @param[in] shift number of bits to shift the result by |
priyank12p | 0:b0c4c25d37ab | 2651 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2652 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2653 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2654 | */ |
priyank12p | 0:b0c4c25d37ab | 2655 | |
priyank12p | 0:b0c4c25d37ab | 2656 | void arm_scale_q7( |
priyank12p | 0:b0c4c25d37ab | 2657 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2658 | q7_t scaleFract, |
priyank12p | 0:b0c4c25d37ab | 2659 | int8_t shift, |
priyank12p | 0:b0c4c25d37ab | 2660 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2661 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2662 | |
priyank12p | 0:b0c4c25d37ab | 2663 | /** |
priyank12p | 0:b0c4c25d37ab | 2664 | * @brief Multiplies a Q15 vector by a scalar. |
priyank12p | 0:b0c4c25d37ab | 2665 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2666 | * @param[in] scaleFract fractional portion of the scale value |
priyank12p | 0:b0c4c25d37ab | 2667 | * @param[in] shift number of bits to shift the result by |
priyank12p | 0:b0c4c25d37ab | 2668 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2669 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2670 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2671 | */ |
priyank12p | 0:b0c4c25d37ab | 2672 | |
priyank12p | 0:b0c4c25d37ab | 2673 | void arm_scale_q15( |
priyank12p | 0:b0c4c25d37ab | 2674 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2675 | q15_t scaleFract, |
priyank12p | 0:b0c4c25d37ab | 2676 | int8_t shift, |
priyank12p | 0:b0c4c25d37ab | 2677 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2678 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2679 | |
priyank12p | 0:b0c4c25d37ab | 2680 | /** |
priyank12p | 0:b0c4c25d37ab | 2681 | * @brief Multiplies a Q31 vector by a scalar. |
priyank12p | 0:b0c4c25d37ab | 2682 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2683 | * @param[in] scaleFract fractional portion of the scale value |
priyank12p | 0:b0c4c25d37ab | 2684 | * @param[in] shift number of bits to shift the result by |
priyank12p | 0:b0c4c25d37ab | 2685 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2686 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2687 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2688 | */ |
priyank12p | 0:b0c4c25d37ab | 2689 | |
priyank12p | 0:b0c4c25d37ab | 2690 | void arm_scale_q31( |
priyank12p | 0:b0c4c25d37ab | 2691 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2692 | q31_t scaleFract, |
priyank12p | 0:b0c4c25d37ab | 2693 | int8_t shift, |
priyank12p | 0:b0c4c25d37ab | 2694 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2695 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2696 | |
priyank12p | 0:b0c4c25d37ab | 2697 | /** |
priyank12p | 0:b0c4c25d37ab | 2698 | * @brief Q7 vector absolute value. |
priyank12p | 0:b0c4c25d37ab | 2699 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 2700 | * @param[out] *pDst points to the output buffer |
priyank12p | 0:b0c4c25d37ab | 2701 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2702 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2703 | */ |
priyank12p | 0:b0c4c25d37ab | 2704 | |
priyank12p | 0:b0c4c25d37ab | 2705 | void arm_abs_q7( |
priyank12p | 0:b0c4c25d37ab | 2706 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2707 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2708 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2709 | |
priyank12p | 0:b0c4c25d37ab | 2710 | /** |
priyank12p | 0:b0c4c25d37ab | 2711 | * @brief Floating-point vector absolute value. |
priyank12p | 0:b0c4c25d37ab | 2712 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 2713 | * @param[out] *pDst points to the output buffer |
priyank12p | 0:b0c4c25d37ab | 2714 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2715 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2716 | */ |
priyank12p | 0:b0c4c25d37ab | 2717 | |
priyank12p | 0:b0c4c25d37ab | 2718 | void arm_abs_f32( |
priyank12p | 0:b0c4c25d37ab | 2719 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2720 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2721 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2722 | |
priyank12p | 0:b0c4c25d37ab | 2723 | /** |
priyank12p | 0:b0c4c25d37ab | 2724 | * @brief Q15 vector absolute value. |
priyank12p | 0:b0c4c25d37ab | 2725 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 2726 | * @param[out] *pDst points to the output buffer |
priyank12p | 0:b0c4c25d37ab | 2727 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2728 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2729 | */ |
priyank12p | 0:b0c4c25d37ab | 2730 | |
priyank12p | 0:b0c4c25d37ab | 2731 | void arm_abs_q15( |
priyank12p | 0:b0c4c25d37ab | 2732 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2733 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2734 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2735 | |
priyank12p | 0:b0c4c25d37ab | 2736 | /** |
priyank12p | 0:b0c4c25d37ab | 2737 | * @brief Q31 vector absolute value. |
priyank12p | 0:b0c4c25d37ab | 2738 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 2739 | * @param[out] *pDst points to the output buffer |
priyank12p | 0:b0c4c25d37ab | 2740 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2741 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2742 | */ |
priyank12p | 0:b0c4c25d37ab | 2743 | |
priyank12p | 0:b0c4c25d37ab | 2744 | void arm_abs_q31( |
priyank12p | 0:b0c4c25d37ab | 2745 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2746 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2747 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2748 | |
priyank12p | 0:b0c4c25d37ab | 2749 | /** |
priyank12p | 0:b0c4c25d37ab | 2750 | * @brief Dot product of floating-point vectors. |
priyank12p | 0:b0c4c25d37ab | 2751 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2752 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2753 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2754 | * @param[out] *result output result returned here |
priyank12p | 0:b0c4c25d37ab | 2755 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2756 | */ |
priyank12p | 0:b0c4c25d37ab | 2757 | |
priyank12p | 0:b0c4c25d37ab | 2758 | void arm_dot_prod_f32( |
priyank12p | 0:b0c4c25d37ab | 2759 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2760 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2761 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 2762 | float32_t * result); |
priyank12p | 0:b0c4c25d37ab | 2763 | |
priyank12p | 0:b0c4c25d37ab | 2764 | /** |
priyank12p | 0:b0c4c25d37ab | 2765 | * @brief Dot product of Q7 vectors. |
priyank12p | 0:b0c4c25d37ab | 2766 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2767 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2768 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2769 | * @param[out] *result output result returned here |
priyank12p | 0:b0c4c25d37ab | 2770 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2771 | */ |
priyank12p | 0:b0c4c25d37ab | 2772 | |
priyank12p | 0:b0c4c25d37ab | 2773 | void arm_dot_prod_q7( |
priyank12p | 0:b0c4c25d37ab | 2774 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2775 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2776 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 2777 | q31_t * result); |
priyank12p | 0:b0c4c25d37ab | 2778 | |
priyank12p | 0:b0c4c25d37ab | 2779 | /** |
priyank12p | 0:b0c4c25d37ab | 2780 | * @brief Dot product of Q15 vectors. |
priyank12p | 0:b0c4c25d37ab | 2781 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2782 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2783 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2784 | * @param[out] *result output result returned here |
priyank12p | 0:b0c4c25d37ab | 2785 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2786 | */ |
priyank12p | 0:b0c4c25d37ab | 2787 | |
priyank12p | 0:b0c4c25d37ab | 2788 | void arm_dot_prod_q15( |
priyank12p | 0:b0c4c25d37ab | 2789 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2790 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2791 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 2792 | q63_t * result); |
priyank12p | 0:b0c4c25d37ab | 2793 | |
priyank12p | 0:b0c4c25d37ab | 2794 | /** |
priyank12p | 0:b0c4c25d37ab | 2795 | * @brief Dot product of Q31 vectors. |
priyank12p | 0:b0c4c25d37ab | 2796 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 2797 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 2798 | * @param[in] blockSize number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 2799 | * @param[out] *result output result returned here |
priyank12p | 0:b0c4c25d37ab | 2800 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2801 | */ |
priyank12p | 0:b0c4c25d37ab | 2802 | |
priyank12p | 0:b0c4c25d37ab | 2803 | void arm_dot_prod_q31( |
priyank12p | 0:b0c4c25d37ab | 2804 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 2805 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 2806 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 2807 | q63_t * result); |
priyank12p | 0:b0c4c25d37ab | 2808 | |
priyank12p | 0:b0c4c25d37ab | 2809 | /** |
priyank12p | 0:b0c4c25d37ab | 2810 | * @brief Shifts the elements of a Q7 vector a specified number of bits. |
priyank12p | 0:b0c4c25d37ab | 2811 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2812 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
priyank12p | 0:b0c4c25d37ab | 2813 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2814 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2815 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2816 | */ |
priyank12p | 0:b0c4c25d37ab | 2817 | |
priyank12p | 0:b0c4c25d37ab | 2818 | void arm_shift_q7( |
priyank12p | 0:b0c4c25d37ab | 2819 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2820 | int8_t shiftBits, |
priyank12p | 0:b0c4c25d37ab | 2821 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2822 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2823 | |
priyank12p | 0:b0c4c25d37ab | 2824 | /** |
priyank12p | 0:b0c4c25d37ab | 2825 | * @brief Shifts the elements of a Q15 vector a specified number of bits. |
priyank12p | 0:b0c4c25d37ab | 2826 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2827 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
priyank12p | 0:b0c4c25d37ab | 2828 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2829 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2830 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2831 | */ |
priyank12p | 0:b0c4c25d37ab | 2832 | |
priyank12p | 0:b0c4c25d37ab | 2833 | void arm_shift_q15( |
priyank12p | 0:b0c4c25d37ab | 2834 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2835 | int8_t shiftBits, |
priyank12p | 0:b0c4c25d37ab | 2836 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2837 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2838 | |
priyank12p | 0:b0c4c25d37ab | 2839 | /** |
priyank12p | 0:b0c4c25d37ab | 2840 | * @brief Shifts the elements of a Q31 vector a specified number of bits. |
priyank12p | 0:b0c4c25d37ab | 2841 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2842 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
priyank12p | 0:b0c4c25d37ab | 2843 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2844 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2845 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2846 | */ |
priyank12p | 0:b0c4c25d37ab | 2847 | |
priyank12p | 0:b0c4c25d37ab | 2848 | void arm_shift_q31( |
priyank12p | 0:b0c4c25d37ab | 2849 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2850 | int8_t shiftBits, |
priyank12p | 0:b0c4c25d37ab | 2851 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2852 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2853 | |
priyank12p | 0:b0c4c25d37ab | 2854 | /** |
priyank12p | 0:b0c4c25d37ab | 2855 | * @brief Adds a constant offset to a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 2856 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2857 | * @param[in] offset is the offset to be added |
priyank12p | 0:b0c4c25d37ab | 2858 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2859 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2860 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2861 | */ |
priyank12p | 0:b0c4c25d37ab | 2862 | |
priyank12p | 0:b0c4c25d37ab | 2863 | void arm_offset_f32( |
priyank12p | 0:b0c4c25d37ab | 2864 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2865 | float32_t offset, |
priyank12p | 0:b0c4c25d37ab | 2866 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2867 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2868 | |
priyank12p | 0:b0c4c25d37ab | 2869 | /** |
priyank12p | 0:b0c4c25d37ab | 2870 | * @brief Adds a constant offset to a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 2871 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2872 | * @param[in] offset is the offset to be added |
priyank12p | 0:b0c4c25d37ab | 2873 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2874 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2875 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2876 | */ |
priyank12p | 0:b0c4c25d37ab | 2877 | |
priyank12p | 0:b0c4c25d37ab | 2878 | void arm_offset_q7( |
priyank12p | 0:b0c4c25d37ab | 2879 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2880 | q7_t offset, |
priyank12p | 0:b0c4c25d37ab | 2881 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2882 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2883 | |
priyank12p | 0:b0c4c25d37ab | 2884 | /** |
priyank12p | 0:b0c4c25d37ab | 2885 | * @brief Adds a constant offset to a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 2886 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2887 | * @param[in] offset is the offset to be added |
priyank12p | 0:b0c4c25d37ab | 2888 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2889 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2890 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2891 | */ |
priyank12p | 0:b0c4c25d37ab | 2892 | |
priyank12p | 0:b0c4c25d37ab | 2893 | void arm_offset_q15( |
priyank12p | 0:b0c4c25d37ab | 2894 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2895 | q15_t offset, |
priyank12p | 0:b0c4c25d37ab | 2896 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2897 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2898 | |
priyank12p | 0:b0c4c25d37ab | 2899 | /** |
priyank12p | 0:b0c4c25d37ab | 2900 | * @brief Adds a constant offset to a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 2901 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2902 | * @param[in] offset is the offset to be added |
priyank12p | 0:b0c4c25d37ab | 2903 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2904 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2905 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2906 | */ |
priyank12p | 0:b0c4c25d37ab | 2907 | |
priyank12p | 0:b0c4c25d37ab | 2908 | void arm_offset_q31( |
priyank12p | 0:b0c4c25d37ab | 2909 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2910 | q31_t offset, |
priyank12p | 0:b0c4c25d37ab | 2911 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2912 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2913 | |
priyank12p | 0:b0c4c25d37ab | 2914 | /** |
priyank12p | 0:b0c4c25d37ab | 2915 | * @brief Negates the elements of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 2916 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2917 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2918 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2919 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2920 | */ |
priyank12p | 0:b0c4c25d37ab | 2921 | |
priyank12p | 0:b0c4c25d37ab | 2922 | void arm_negate_f32( |
priyank12p | 0:b0c4c25d37ab | 2923 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2924 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2925 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2926 | |
priyank12p | 0:b0c4c25d37ab | 2927 | /** |
priyank12p | 0:b0c4c25d37ab | 2928 | * @brief Negates the elements of a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 2929 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2930 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2931 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2932 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2933 | */ |
priyank12p | 0:b0c4c25d37ab | 2934 | |
priyank12p | 0:b0c4c25d37ab | 2935 | void arm_negate_q7( |
priyank12p | 0:b0c4c25d37ab | 2936 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2937 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2938 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2939 | |
priyank12p | 0:b0c4c25d37ab | 2940 | /** |
priyank12p | 0:b0c4c25d37ab | 2941 | * @brief Negates the elements of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 2942 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2943 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2944 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2945 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2946 | */ |
priyank12p | 0:b0c4c25d37ab | 2947 | |
priyank12p | 0:b0c4c25d37ab | 2948 | void arm_negate_q15( |
priyank12p | 0:b0c4c25d37ab | 2949 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2950 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2951 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2952 | |
priyank12p | 0:b0c4c25d37ab | 2953 | /** |
priyank12p | 0:b0c4c25d37ab | 2954 | * @brief Negates the elements of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 2955 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 2956 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 2957 | * @param[in] blockSize number of samples in the vector |
priyank12p | 0:b0c4c25d37ab | 2958 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2959 | */ |
priyank12p | 0:b0c4c25d37ab | 2960 | |
priyank12p | 0:b0c4c25d37ab | 2961 | void arm_negate_q31( |
priyank12p | 0:b0c4c25d37ab | 2962 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2963 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2964 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2965 | /** |
priyank12p | 0:b0c4c25d37ab | 2966 | * @brief Copies the elements of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 2967 | * @param[in] *pSrc input pointer |
priyank12p | 0:b0c4c25d37ab | 2968 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 2969 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 2970 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2971 | */ |
priyank12p | 0:b0c4c25d37ab | 2972 | void arm_copy_f32( |
priyank12p | 0:b0c4c25d37ab | 2973 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2974 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2975 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2976 | |
priyank12p | 0:b0c4c25d37ab | 2977 | /** |
priyank12p | 0:b0c4c25d37ab | 2978 | * @brief Copies the elements of a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 2979 | * @param[in] *pSrc input pointer |
priyank12p | 0:b0c4c25d37ab | 2980 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 2981 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 2982 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2983 | */ |
priyank12p | 0:b0c4c25d37ab | 2984 | void arm_copy_q7( |
priyank12p | 0:b0c4c25d37ab | 2985 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2986 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2987 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 2988 | |
priyank12p | 0:b0c4c25d37ab | 2989 | /** |
priyank12p | 0:b0c4c25d37ab | 2990 | * @brief Copies the elements of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 2991 | * @param[in] *pSrc input pointer |
priyank12p | 0:b0c4c25d37ab | 2992 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 2993 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 2994 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 2995 | */ |
priyank12p | 0:b0c4c25d37ab | 2996 | void arm_copy_q15( |
priyank12p | 0:b0c4c25d37ab | 2997 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 2998 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 2999 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3000 | |
priyank12p | 0:b0c4c25d37ab | 3001 | /** |
priyank12p | 0:b0c4c25d37ab | 3002 | * @brief Copies the elements of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 3003 | * @param[in] *pSrc input pointer |
priyank12p | 0:b0c4c25d37ab | 3004 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 3005 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 3006 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3007 | */ |
priyank12p | 0:b0c4c25d37ab | 3008 | void arm_copy_q31( |
priyank12p | 0:b0c4c25d37ab | 3009 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3010 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3011 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3012 | /** |
priyank12p | 0:b0c4c25d37ab | 3013 | * @brief Fills a constant value into a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 3014 | * @param[in] value input value to be filled |
priyank12p | 0:b0c4c25d37ab | 3015 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 3016 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 3017 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3018 | */ |
priyank12p | 0:b0c4c25d37ab | 3019 | void arm_fill_f32( |
priyank12p | 0:b0c4c25d37ab | 3020 | float32_t value, |
priyank12p | 0:b0c4c25d37ab | 3021 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3022 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3023 | |
priyank12p | 0:b0c4c25d37ab | 3024 | /** |
priyank12p | 0:b0c4c25d37ab | 3025 | * @brief Fills a constant value into a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 3026 | * @param[in] value input value to be filled |
priyank12p | 0:b0c4c25d37ab | 3027 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 3028 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 3029 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3030 | */ |
priyank12p | 0:b0c4c25d37ab | 3031 | void arm_fill_q7( |
priyank12p | 0:b0c4c25d37ab | 3032 | q7_t value, |
priyank12p | 0:b0c4c25d37ab | 3033 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3034 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3035 | |
priyank12p | 0:b0c4c25d37ab | 3036 | /** |
priyank12p | 0:b0c4c25d37ab | 3037 | * @brief Fills a constant value into a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 3038 | * @param[in] value input value to be filled |
priyank12p | 0:b0c4c25d37ab | 3039 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 3040 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 3041 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3042 | */ |
priyank12p | 0:b0c4c25d37ab | 3043 | void arm_fill_q15( |
priyank12p | 0:b0c4c25d37ab | 3044 | q15_t value, |
priyank12p | 0:b0c4c25d37ab | 3045 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3046 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3047 | |
priyank12p | 0:b0c4c25d37ab | 3048 | /** |
priyank12p | 0:b0c4c25d37ab | 3049 | * @brief Fills a constant value into a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 3050 | * @param[in] value input value to be filled |
priyank12p | 0:b0c4c25d37ab | 3051 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 3052 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 3053 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3054 | */ |
priyank12p | 0:b0c4c25d37ab | 3055 | void arm_fill_q31( |
priyank12p | 0:b0c4c25d37ab | 3056 | q31_t value, |
priyank12p | 0:b0c4c25d37ab | 3057 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3058 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3059 | |
priyank12p | 0:b0c4c25d37ab | 3060 | /** |
priyank12p | 0:b0c4c25d37ab | 3061 | * @brief Convolution of floating-point sequences. |
priyank12p | 0:b0c4c25d37ab | 3062 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3063 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3064 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3065 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3066 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3067 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3068 | */ |
priyank12p | 0:b0c4c25d37ab | 3069 | |
priyank12p | 0:b0c4c25d37ab | 3070 | void arm_conv_f32( |
priyank12p | 0:b0c4c25d37ab | 3071 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3072 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3073 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3074 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3075 | float32_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 3076 | |
priyank12p | 0:b0c4c25d37ab | 3077 | |
priyank12p | 0:b0c4c25d37ab | 3078 | /** |
priyank12p | 0:b0c4c25d37ab | 3079 | * @brief Convolution of Q15 sequences. |
priyank12p | 0:b0c4c25d37ab | 3080 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3081 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3082 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3083 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3084 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3085 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 3086 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 3087 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3088 | */ |
priyank12p | 0:b0c4c25d37ab | 3089 | |
priyank12p | 0:b0c4c25d37ab | 3090 | |
priyank12p | 0:b0c4c25d37ab | 3091 | void arm_conv_opt_q15( |
priyank12p | 0:b0c4c25d37ab | 3092 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3093 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3094 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3095 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3096 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3097 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 3098 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 3099 | |
priyank12p | 0:b0c4c25d37ab | 3100 | |
priyank12p | 0:b0c4c25d37ab | 3101 | /** |
priyank12p | 0:b0c4c25d37ab | 3102 | * @brief Convolution of Q15 sequences. |
priyank12p | 0:b0c4c25d37ab | 3103 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3104 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3105 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3106 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3107 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3108 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3109 | */ |
priyank12p | 0:b0c4c25d37ab | 3110 | |
priyank12p | 0:b0c4c25d37ab | 3111 | void arm_conv_q15( |
priyank12p | 0:b0c4c25d37ab | 3112 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3113 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3114 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3115 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3116 | q15_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 3117 | |
priyank12p | 0:b0c4c25d37ab | 3118 | /** |
priyank12p | 0:b0c4c25d37ab | 3119 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 3120 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3121 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3122 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3123 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3124 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3125 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3126 | */ |
priyank12p | 0:b0c4c25d37ab | 3127 | |
priyank12p | 0:b0c4c25d37ab | 3128 | void arm_conv_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 3129 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3130 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3131 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3132 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3133 | q15_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 3134 | |
priyank12p | 0:b0c4c25d37ab | 3135 | /** |
priyank12p | 0:b0c4c25d37ab | 3136 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 3137 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3138 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3139 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3140 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3141 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3142 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 3143 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 3144 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3145 | */ |
priyank12p | 0:b0c4c25d37ab | 3146 | |
priyank12p | 0:b0c4c25d37ab | 3147 | void arm_conv_fast_opt_q15( |
priyank12p | 0:b0c4c25d37ab | 3148 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3149 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3150 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3151 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3152 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3153 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 3154 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 3155 | |
priyank12p | 0:b0c4c25d37ab | 3156 | |
priyank12p | 0:b0c4c25d37ab | 3157 | |
priyank12p | 0:b0c4c25d37ab | 3158 | /** |
priyank12p | 0:b0c4c25d37ab | 3159 | * @brief Convolution of Q31 sequences. |
priyank12p | 0:b0c4c25d37ab | 3160 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3161 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3162 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3163 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3164 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3165 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3166 | */ |
priyank12p | 0:b0c4c25d37ab | 3167 | |
priyank12p | 0:b0c4c25d37ab | 3168 | void arm_conv_q31( |
priyank12p | 0:b0c4c25d37ab | 3169 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3170 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3171 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3172 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3173 | q31_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 3174 | |
priyank12p | 0:b0c4c25d37ab | 3175 | /** |
priyank12p | 0:b0c4c25d37ab | 3176 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 3177 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3178 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3179 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3180 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3181 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3182 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3183 | */ |
priyank12p | 0:b0c4c25d37ab | 3184 | |
priyank12p | 0:b0c4c25d37ab | 3185 | void arm_conv_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 3186 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3187 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3188 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3189 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3190 | q31_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 3191 | |
priyank12p | 0:b0c4c25d37ab | 3192 | |
priyank12p | 0:b0c4c25d37ab | 3193 | /** |
priyank12p | 0:b0c4c25d37ab | 3194 | * @brief Convolution of Q7 sequences. |
priyank12p | 0:b0c4c25d37ab | 3195 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3196 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3197 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3198 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3199 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3200 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 3201 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 3202 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3203 | */ |
priyank12p | 0:b0c4c25d37ab | 3204 | |
priyank12p | 0:b0c4c25d37ab | 3205 | void arm_conv_opt_q7( |
priyank12p | 0:b0c4c25d37ab | 3206 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3207 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3208 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3209 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3210 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3211 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 3212 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 3213 | |
priyank12p | 0:b0c4c25d37ab | 3214 | |
priyank12p | 0:b0c4c25d37ab | 3215 | |
priyank12p | 0:b0c4c25d37ab | 3216 | /** |
priyank12p | 0:b0c4c25d37ab | 3217 | * @brief Convolution of Q7 sequences. |
priyank12p | 0:b0c4c25d37ab | 3218 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3219 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3220 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3221 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3222 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
priyank12p | 0:b0c4c25d37ab | 3223 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3224 | */ |
priyank12p | 0:b0c4c25d37ab | 3225 | |
priyank12p | 0:b0c4c25d37ab | 3226 | void arm_conv_q7( |
priyank12p | 0:b0c4c25d37ab | 3227 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3228 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3229 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3230 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3231 | q7_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 3232 | |
priyank12p | 0:b0c4c25d37ab | 3233 | |
priyank12p | 0:b0c4c25d37ab | 3234 | /** |
priyank12p | 0:b0c4c25d37ab | 3235 | * @brief Partial convolution of floating-point sequences. |
priyank12p | 0:b0c4c25d37ab | 3236 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3237 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3238 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3239 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3240 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3241 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3242 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3244 | */ |
priyank12p | 0:b0c4c25d37ab | 3245 | |
priyank12p | 0:b0c4c25d37ab | 3246 | arm_status arm_conv_partial_f32( |
priyank12p | 0:b0c4c25d37ab | 3247 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3248 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3249 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3250 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3251 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3252 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3253 | uint32_t numPoints); |
priyank12p | 0:b0c4c25d37ab | 3254 | |
priyank12p | 0:b0c4c25d37ab | 3255 | /** |
priyank12p | 0:b0c4c25d37ab | 3256 | * @brief Partial convolution of Q15 sequences. |
priyank12p | 0:b0c4c25d37ab | 3257 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3258 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3259 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3260 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3261 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3262 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3263 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 3264 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 3265 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3267 | */ |
priyank12p | 0:b0c4c25d37ab | 3268 | |
priyank12p | 0:b0c4c25d37ab | 3269 | arm_status arm_conv_partial_opt_q15( |
priyank12p | 0:b0c4c25d37ab | 3270 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3271 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3272 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3273 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3274 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3275 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3276 | uint32_t numPoints, |
priyank12p | 0:b0c4c25d37ab | 3277 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 3278 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 3279 | |
priyank12p | 0:b0c4c25d37ab | 3280 | |
priyank12p | 0:b0c4c25d37ab | 3281 | /** |
priyank12p | 0:b0c4c25d37ab | 3282 | * @brief Partial convolution of Q15 sequences. |
priyank12p | 0:b0c4c25d37ab | 3283 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3284 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3285 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3286 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3287 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3288 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3289 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3291 | */ |
priyank12p | 0:b0c4c25d37ab | 3292 | |
priyank12p | 0:b0c4c25d37ab | 3293 | arm_status arm_conv_partial_q15( |
priyank12p | 0:b0c4c25d37ab | 3294 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3295 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3296 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3297 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3298 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3299 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3300 | uint32_t numPoints); |
priyank12p | 0:b0c4c25d37ab | 3301 | |
priyank12p | 0:b0c4c25d37ab | 3302 | /** |
priyank12p | 0:b0c4c25d37ab | 3303 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 3304 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3305 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3306 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3307 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3308 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3309 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3310 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3312 | */ |
priyank12p | 0:b0c4c25d37ab | 3313 | |
priyank12p | 0:b0c4c25d37ab | 3314 | arm_status arm_conv_partial_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 3315 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3316 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3317 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3318 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3319 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3320 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3321 | uint32_t numPoints); |
priyank12p | 0:b0c4c25d37ab | 3322 | |
priyank12p | 0:b0c4c25d37ab | 3323 | |
priyank12p | 0:b0c4c25d37ab | 3324 | /** |
priyank12p | 0:b0c4c25d37ab | 3325 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 3326 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3327 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3328 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3329 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3330 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3331 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3332 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 3333 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 3334 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3336 | */ |
priyank12p | 0:b0c4c25d37ab | 3337 | |
priyank12p | 0:b0c4c25d37ab | 3338 | arm_status arm_conv_partial_fast_opt_q15( |
priyank12p | 0:b0c4c25d37ab | 3339 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3340 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3341 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3342 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3343 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3344 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3345 | uint32_t numPoints, |
priyank12p | 0:b0c4c25d37ab | 3346 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 3347 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 3348 | |
priyank12p | 0:b0c4c25d37ab | 3349 | |
priyank12p | 0:b0c4c25d37ab | 3350 | /** |
priyank12p | 0:b0c4c25d37ab | 3351 | * @brief Partial convolution of Q31 sequences. |
priyank12p | 0:b0c4c25d37ab | 3352 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3353 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3354 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3355 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3356 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3357 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3358 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3360 | */ |
priyank12p | 0:b0c4c25d37ab | 3361 | |
priyank12p | 0:b0c4c25d37ab | 3362 | arm_status arm_conv_partial_q31( |
priyank12p | 0:b0c4c25d37ab | 3363 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3364 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3365 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3366 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3367 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3368 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3369 | uint32_t numPoints); |
priyank12p | 0:b0c4c25d37ab | 3370 | |
priyank12p | 0:b0c4c25d37ab | 3371 | |
priyank12p | 0:b0c4c25d37ab | 3372 | /** |
priyank12p | 0:b0c4c25d37ab | 3373 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 3374 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3375 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3376 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3377 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3378 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3379 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3380 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3382 | */ |
priyank12p | 0:b0c4c25d37ab | 3383 | |
priyank12p | 0:b0c4c25d37ab | 3384 | arm_status arm_conv_partial_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 3385 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3386 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3387 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3388 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3389 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3390 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3391 | uint32_t numPoints); |
priyank12p | 0:b0c4c25d37ab | 3392 | |
priyank12p | 0:b0c4c25d37ab | 3393 | |
priyank12p | 0:b0c4c25d37ab | 3394 | /** |
priyank12p | 0:b0c4c25d37ab | 3395 | * @brief Partial convolution of Q7 sequences |
priyank12p | 0:b0c4c25d37ab | 3396 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3397 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3398 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3399 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3400 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3401 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3402 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 3403 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 3404 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3406 | */ |
priyank12p | 0:b0c4c25d37ab | 3407 | |
priyank12p | 0:b0c4c25d37ab | 3408 | arm_status arm_conv_partial_opt_q7( |
priyank12p | 0:b0c4c25d37ab | 3409 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3410 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3411 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3412 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3413 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3414 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3415 | uint32_t numPoints, |
priyank12p | 0:b0c4c25d37ab | 3416 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 3417 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 3418 | |
priyank12p | 0:b0c4c25d37ab | 3419 | |
priyank12p | 0:b0c4c25d37ab | 3420 | /** |
priyank12p | 0:b0c4c25d37ab | 3421 | * @brief Partial convolution of Q7 sequences. |
priyank12p | 0:b0c4c25d37ab | 3422 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3423 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 3424 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3425 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 3426 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3427 | * @param[in] firstIndex is the first output sample to start with. |
priyank12p | 0:b0c4c25d37ab | 3428 | * @param[in] numPoints is the number of output points to be computed. |
priyank12p | 0:b0c4c25d37ab | 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]. |
priyank12p | 0:b0c4c25d37ab | 3430 | */ |
priyank12p | 0:b0c4c25d37ab | 3431 | |
priyank12p | 0:b0c4c25d37ab | 3432 | arm_status arm_conv_partial_q7( |
priyank12p | 0:b0c4c25d37ab | 3433 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 3434 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 3435 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 3436 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 3437 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3438 | uint32_t firstIndex, |
priyank12p | 0:b0c4c25d37ab | 3439 | uint32_t numPoints); |
priyank12p | 0:b0c4c25d37ab | 3440 | |
priyank12p | 0:b0c4c25d37ab | 3441 | |
priyank12p | 0:b0c4c25d37ab | 3442 | |
priyank12p | 0:b0c4c25d37ab | 3443 | /** |
priyank12p | 0:b0c4c25d37ab | 3444 | * @brief Instance structure for the Q15 FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3445 | */ |
priyank12p | 0:b0c4c25d37ab | 3446 | |
priyank12p | 0:b0c4c25d37ab | 3447 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3448 | { |
priyank12p | 0:b0c4c25d37ab | 3449 | uint8_t M; /**< decimation factor. */ |
priyank12p | 0:b0c4c25d37ab | 3450 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 3451 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 3452 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 3453 | } arm_fir_decimate_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 3454 | |
priyank12p | 0:b0c4c25d37ab | 3455 | /** |
priyank12p | 0:b0c4c25d37ab | 3456 | * @brief Instance structure for the Q31 FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3457 | */ |
priyank12p | 0:b0c4c25d37ab | 3458 | |
priyank12p | 0:b0c4c25d37ab | 3459 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3460 | { |
priyank12p | 0:b0c4c25d37ab | 3461 | uint8_t M; /**< decimation factor. */ |
priyank12p | 0:b0c4c25d37ab | 3462 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 3463 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 3464 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 3465 | |
priyank12p | 0:b0c4c25d37ab | 3466 | } arm_fir_decimate_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 3467 | |
priyank12p | 0:b0c4c25d37ab | 3468 | /** |
priyank12p | 0:b0c4c25d37ab | 3469 | * @brief Instance structure for the floating-point FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3470 | */ |
priyank12p | 0:b0c4c25d37ab | 3471 | |
priyank12p | 0:b0c4c25d37ab | 3472 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3473 | { |
priyank12p | 0:b0c4c25d37ab | 3474 | uint8_t M; /**< decimation factor. */ |
priyank12p | 0:b0c4c25d37ab | 3475 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 3476 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 3477 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 3478 | |
priyank12p | 0:b0c4c25d37ab | 3479 | } arm_fir_decimate_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 3480 | |
priyank12p | 0:b0c4c25d37ab | 3481 | |
priyank12p | 0:b0c4c25d37ab | 3482 | |
priyank12p | 0:b0c4c25d37ab | 3483 | /** |
priyank12p | 0:b0c4c25d37ab | 3484 | * @brief Processing function for the floating-point FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3485 | * @param[in] *S points to an instance of the floating-point FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3486 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3487 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3488 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3489 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3490 | */ |
priyank12p | 0:b0c4c25d37ab | 3491 | |
priyank12p | 0:b0c4c25d37ab | 3492 | void arm_fir_decimate_f32( |
priyank12p | 0:b0c4c25d37ab | 3493 | const arm_fir_decimate_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3494 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3495 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3496 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3497 | |
priyank12p | 0:b0c4c25d37ab | 3498 | |
priyank12p | 0:b0c4c25d37ab | 3499 | /** |
priyank12p | 0:b0c4c25d37ab | 3500 | * @brief Initialization function for the floating-point FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3501 | * @param[in,out] *S points to an instance of the floating-point FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3502 | * @param[in] numTaps number of coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 3503 | * @param[in] M decimation factor. |
priyank12p | 0:b0c4c25d37ab | 3504 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3505 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3506 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3507 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
priyank12p | 0:b0c4c25d37ab | 3508 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
priyank12p | 0:b0c4c25d37ab | 3509 | */ |
priyank12p | 0:b0c4c25d37ab | 3510 | |
priyank12p | 0:b0c4c25d37ab | 3511 | arm_status arm_fir_decimate_init_f32( |
priyank12p | 0:b0c4c25d37ab | 3512 | arm_fir_decimate_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3513 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 3514 | uint8_t M, |
priyank12p | 0:b0c4c25d37ab | 3515 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3516 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3517 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3518 | |
priyank12p | 0:b0c4c25d37ab | 3519 | /** |
priyank12p | 0:b0c4c25d37ab | 3520 | * @brief Processing function for the Q15 FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3521 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3522 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3523 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3524 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3525 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3526 | */ |
priyank12p | 0:b0c4c25d37ab | 3527 | |
priyank12p | 0:b0c4c25d37ab | 3528 | void arm_fir_decimate_q15( |
priyank12p | 0:b0c4c25d37ab | 3529 | const arm_fir_decimate_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 3530 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3531 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3532 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3533 | |
priyank12p | 0:b0c4c25d37ab | 3534 | /** |
priyank12p | 0:b0c4c25d37ab | 3535 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 3536 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3537 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3538 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3539 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3540 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3541 | */ |
priyank12p | 0:b0c4c25d37ab | 3542 | |
priyank12p | 0:b0c4c25d37ab | 3543 | void arm_fir_decimate_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 3544 | const arm_fir_decimate_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 3545 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3546 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3547 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3548 | |
priyank12p | 0:b0c4c25d37ab | 3549 | |
priyank12p | 0:b0c4c25d37ab | 3550 | |
priyank12p | 0:b0c4c25d37ab | 3551 | /** |
priyank12p | 0:b0c4c25d37ab | 3552 | * @brief Initialization function for the Q15 FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3553 | * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3554 | * @param[in] numTaps number of coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 3555 | * @param[in] M decimation factor. |
priyank12p | 0:b0c4c25d37ab | 3556 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3557 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3558 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3559 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
priyank12p | 0:b0c4c25d37ab | 3560 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
priyank12p | 0:b0c4c25d37ab | 3561 | */ |
priyank12p | 0:b0c4c25d37ab | 3562 | |
priyank12p | 0:b0c4c25d37ab | 3563 | arm_status arm_fir_decimate_init_q15( |
priyank12p | 0:b0c4c25d37ab | 3564 | arm_fir_decimate_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 3565 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 3566 | uint8_t M, |
priyank12p | 0:b0c4c25d37ab | 3567 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3568 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3569 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3570 | |
priyank12p | 0:b0c4c25d37ab | 3571 | /** |
priyank12p | 0:b0c4c25d37ab | 3572 | * @brief Processing function for the Q31 FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3573 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3574 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3575 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3576 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3577 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3578 | */ |
priyank12p | 0:b0c4c25d37ab | 3579 | |
priyank12p | 0:b0c4c25d37ab | 3580 | void arm_fir_decimate_q31( |
priyank12p | 0:b0c4c25d37ab | 3581 | const arm_fir_decimate_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3582 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3583 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3584 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3585 | |
priyank12p | 0:b0c4c25d37ab | 3586 | /** |
priyank12p | 0:b0c4c25d37ab | 3587 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 3588 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3589 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3590 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3591 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3592 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3593 | */ |
priyank12p | 0:b0c4c25d37ab | 3594 | |
priyank12p | 0:b0c4c25d37ab | 3595 | void arm_fir_decimate_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 3596 | arm_fir_decimate_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3597 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3598 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3599 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3600 | |
priyank12p | 0:b0c4c25d37ab | 3601 | |
priyank12p | 0:b0c4c25d37ab | 3602 | /** |
priyank12p | 0:b0c4c25d37ab | 3603 | * @brief Initialization function for the Q31 FIR decimator. |
priyank12p | 0:b0c4c25d37ab | 3604 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. |
priyank12p | 0:b0c4c25d37ab | 3605 | * @param[in] numTaps number of coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 3606 | * @param[in] M decimation factor. |
priyank12p | 0:b0c4c25d37ab | 3607 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3608 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3609 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3610 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
priyank12p | 0:b0c4c25d37ab | 3611 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
priyank12p | 0:b0c4c25d37ab | 3612 | */ |
priyank12p | 0:b0c4c25d37ab | 3613 | |
priyank12p | 0:b0c4c25d37ab | 3614 | arm_status arm_fir_decimate_init_q31( |
priyank12p | 0:b0c4c25d37ab | 3615 | arm_fir_decimate_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3616 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 3617 | uint8_t M, |
priyank12p | 0:b0c4c25d37ab | 3618 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3619 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3620 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3621 | |
priyank12p | 0:b0c4c25d37ab | 3622 | |
priyank12p | 0:b0c4c25d37ab | 3623 | |
priyank12p | 0:b0c4c25d37ab | 3624 | /** |
priyank12p | 0:b0c4c25d37ab | 3625 | * @brief Instance structure for the Q15 FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3626 | */ |
priyank12p | 0:b0c4c25d37ab | 3627 | |
priyank12p | 0:b0c4c25d37ab | 3628 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3629 | { |
priyank12p | 0:b0c4c25d37ab | 3630 | uint8_t L; /**< upsample factor. */ |
priyank12p | 0:b0c4c25d37ab | 3631 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
priyank12p | 0:b0c4c25d37ab | 3632 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
priyank12p | 0:b0c4c25d37ab | 3633 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
priyank12p | 0:b0c4c25d37ab | 3634 | } arm_fir_interpolate_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 3635 | |
priyank12p | 0:b0c4c25d37ab | 3636 | /** |
priyank12p | 0:b0c4c25d37ab | 3637 | * @brief Instance structure for the Q31 FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3638 | */ |
priyank12p | 0:b0c4c25d37ab | 3639 | |
priyank12p | 0:b0c4c25d37ab | 3640 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3641 | { |
priyank12p | 0:b0c4c25d37ab | 3642 | uint8_t L; /**< upsample factor. */ |
priyank12p | 0:b0c4c25d37ab | 3643 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
priyank12p | 0:b0c4c25d37ab | 3644 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
priyank12p | 0:b0c4c25d37ab | 3645 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
priyank12p | 0:b0c4c25d37ab | 3646 | } arm_fir_interpolate_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 3647 | |
priyank12p | 0:b0c4c25d37ab | 3648 | /** |
priyank12p | 0:b0c4c25d37ab | 3649 | * @brief Instance structure for the floating-point FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3650 | */ |
priyank12p | 0:b0c4c25d37ab | 3651 | |
priyank12p | 0:b0c4c25d37ab | 3652 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3653 | { |
priyank12p | 0:b0c4c25d37ab | 3654 | uint8_t L; /**< upsample factor. */ |
priyank12p | 0:b0c4c25d37ab | 3655 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
priyank12p | 0:b0c4c25d37ab | 3656 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
priyank12p | 0:b0c4c25d37ab | 3657 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ |
priyank12p | 0:b0c4c25d37ab | 3658 | } arm_fir_interpolate_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 3659 | |
priyank12p | 0:b0c4c25d37ab | 3660 | |
priyank12p | 0:b0c4c25d37ab | 3661 | /** |
priyank12p | 0:b0c4c25d37ab | 3662 | * @brief Processing function for the Q15 FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3663 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
priyank12p | 0:b0c4c25d37ab | 3664 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3665 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 3666 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3667 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3668 | */ |
priyank12p | 0:b0c4c25d37ab | 3669 | |
priyank12p | 0:b0c4c25d37ab | 3670 | void arm_fir_interpolate_q15( |
priyank12p | 0:b0c4c25d37ab | 3671 | const arm_fir_interpolate_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 3672 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3673 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3674 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3675 | |
priyank12p | 0:b0c4c25d37ab | 3676 | |
priyank12p | 0:b0c4c25d37ab | 3677 | /** |
priyank12p | 0:b0c4c25d37ab | 3678 | * @brief Initialization function for the Q15 FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3679 | * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. |
priyank12p | 0:b0c4c25d37ab | 3680 | * @param[in] L upsample factor. |
priyank12p | 0:b0c4c25d37ab | 3681 | * @param[in] numTaps number of filter coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 3682 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 3683 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3684 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3685 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
priyank12p | 0:b0c4c25d37ab | 3686 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
priyank12p | 0:b0c4c25d37ab | 3687 | */ |
priyank12p | 0:b0c4c25d37ab | 3688 | |
priyank12p | 0:b0c4c25d37ab | 3689 | arm_status arm_fir_interpolate_init_q15( |
priyank12p | 0:b0c4c25d37ab | 3690 | arm_fir_interpolate_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 3691 | uint8_t L, |
priyank12p | 0:b0c4c25d37ab | 3692 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 3693 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3694 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3695 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3696 | |
priyank12p | 0:b0c4c25d37ab | 3697 | /** |
priyank12p | 0:b0c4c25d37ab | 3698 | * @brief Processing function for the Q31 FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3699 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
priyank12p | 0:b0c4c25d37ab | 3700 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3701 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 3702 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3703 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3704 | */ |
priyank12p | 0:b0c4c25d37ab | 3705 | |
priyank12p | 0:b0c4c25d37ab | 3706 | void arm_fir_interpolate_q31( |
priyank12p | 0:b0c4c25d37ab | 3707 | const arm_fir_interpolate_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3708 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3709 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3710 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3711 | |
priyank12p | 0:b0c4c25d37ab | 3712 | /** |
priyank12p | 0:b0c4c25d37ab | 3713 | * @brief Initialization function for the Q31 FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3714 | * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure. |
priyank12p | 0:b0c4c25d37ab | 3715 | * @param[in] L upsample factor. |
priyank12p | 0:b0c4c25d37ab | 3716 | * @param[in] numTaps number of filter coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 3717 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 3718 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3719 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3720 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
priyank12p | 0:b0c4c25d37ab | 3721 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
priyank12p | 0:b0c4c25d37ab | 3722 | */ |
priyank12p | 0:b0c4c25d37ab | 3723 | |
priyank12p | 0:b0c4c25d37ab | 3724 | arm_status arm_fir_interpolate_init_q31( |
priyank12p | 0:b0c4c25d37ab | 3725 | arm_fir_interpolate_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3726 | uint8_t L, |
priyank12p | 0:b0c4c25d37ab | 3727 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 3728 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3729 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3730 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3731 | |
priyank12p | 0:b0c4c25d37ab | 3732 | |
priyank12p | 0:b0c4c25d37ab | 3733 | /** |
priyank12p | 0:b0c4c25d37ab | 3734 | * @brief Processing function for the floating-point FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3735 | * @param[in] *S points to an instance of the floating-point FIR interpolator structure. |
priyank12p | 0:b0c4c25d37ab | 3736 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3737 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 3738 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3739 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3740 | */ |
priyank12p | 0:b0c4c25d37ab | 3741 | |
priyank12p | 0:b0c4c25d37ab | 3742 | void arm_fir_interpolate_f32( |
priyank12p | 0:b0c4c25d37ab | 3743 | const arm_fir_interpolate_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3744 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3745 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3746 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3747 | |
priyank12p | 0:b0c4c25d37ab | 3748 | /** |
priyank12p | 0:b0c4c25d37ab | 3749 | * @brief Initialization function for the floating-point FIR interpolator. |
priyank12p | 0:b0c4c25d37ab | 3750 | * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure. |
priyank12p | 0:b0c4c25d37ab | 3751 | * @param[in] L upsample factor. |
priyank12p | 0:b0c4c25d37ab | 3752 | * @param[in] numTaps number of filter coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 3753 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 3754 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3755 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 3756 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
priyank12p | 0:b0c4c25d37ab | 3757 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
priyank12p | 0:b0c4c25d37ab | 3758 | */ |
priyank12p | 0:b0c4c25d37ab | 3759 | |
priyank12p | 0:b0c4c25d37ab | 3760 | arm_status arm_fir_interpolate_init_f32( |
priyank12p | 0:b0c4c25d37ab | 3761 | arm_fir_interpolate_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3762 | uint8_t L, |
priyank12p | 0:b0c4c25d37ab | 3763 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 3764 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3765 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3766 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3767 | |
priyank12p | 0:b0c4c25d37ab | 3768 | /** |
priyank12p | 0:b0c4c25d37ab | 3769 | * @brief Instance structure for the high precision Q31 Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3770 | */ |
priyank12p | 0:b0c4c25d37ab | 3771 | |
priyank12p | 0:b0c4c25d37ab | 3772 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3773 | { |
priyank12p | 0:b0c4c25d37ab | 3774 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3775 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3776 | q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3777 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ |
priyank12p | 0:b0c4c25d37ab | 3778 | |
priyank12p | 0:b0c4c25d37ab | 3779 | } arm_biquad_cas_df1_32x64_ins_q31; |
priyank12p | 0:b0c4c25d37ab | 3780 | |
priyank12p | 0:b0c4c25d37ab | 3781 | |
priyank12p | 0:b0c4c25d37ab | 3782 | /** |
priyank12p | 0:b0c4c25d37ab | 3783 | * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
priyank12p | 0:b0c4c25d37ab | 3784 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3785 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3786 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 3787 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3788 | */ |
priyank12p | 0:b0c4c25d37ab | 3789 | |
priyank12p | 0:b0c4c25d37ab | 3790 | void arm_biquad_cas_df1_32x64_q31( |
priyank12p | 0:b0c4c25d37ab | 3791 | const arm_biquad_cas_df1_32x64_ins_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3792 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3793 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3794 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3795 | |
priyank12p | 0:b0c4c25d37ab | 3796 | |
priyank12p | 0:b0c4c25d37ab | 3797 | /** |
priyank12p | 0:b0c4c25d37ab | 3798 | * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
priyank12p | 0:b0c4c25d37ab | 3799 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 3800 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3801 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3802 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format |
priyank12p | 0:b0c4c25d37ab | 3803 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3804 | */ |
priyank12p | 0:b0c4c25d37ab | 3805 | |
priyank12p | 0:b0c4c25d37ab | 3806 | void arm_biquad_cas_df1_32x64_init_q31( |
priyank12p | 0:b0c4c25d37ab | 3807 | arm_biquad_cas_df1_32x64_ins_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 3808 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 3809 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3810 | q63_t * pState, |
priyank12p | 0:b0c4c25d37ab | 3811 | uint8_t postShift); |
priyank12p | 0:b0c4c25d37ab | 3812 | |
priyank12p | 0:b0c4c25d37ab | 3813 | |
priyank12p | 0:b0c4c25d37ab | 3814 | |
priyank12p | 0:b0c4c25d37ab | 3815 | /** |
priyank12p | 0:b0c4c25d37ab | 3816 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3817 | */ |
priyank12p | 0:b0c4c25d37ab | 3818 | |
priyank12p | 0:b0c4c25d37ab | 3819 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3820 | { |
priyank12p | 0:b0c4c25d37ab | 3821 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3822 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3823 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3824 | } arm_biquad_cascade_df2T_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 3825 | |
priyank12p | 0:b0c4c25d37ab | 3826 | |
priyank12p | 0:b0c4c25d37ab | 3827 | |
priyank12p | 0:b0c4c25d37ab | 3828 | /** |
priyank12p | 0:b0c4c25d37ab | 3829 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3830 | */ |
priyank12p | 0:b0c4c25d37ab | 3831 | |
priyank12p | 0:b0c4c25d37ab | 3832 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3833 | { |
priyank12p | 0:b0c4c25d37ab | 3834 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3835 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3836 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3837 | } arm_biquad_cascade_stereo_df2T_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 3838 | |
priyank12p | 0:b0c4c25d37ab | 3839 | |
priyank12p | 0:b0c4c25d37ab | 3840 | |
priyank12p | 0:b0c4c25d37ab | 3841 | /** |
priyank12p | 0:b0c4c25d37ab | 3842 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3843 | */ |
priyank12p | 0:b0c4c25d37ab | 3844 | |
priyank12p | 0:b0c4c25d37ab | 3845 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3846 | { |
priyank12p | 0:b0c4c25d37ab | 3847 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3848 | float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3849 | float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3850 | } arm_biquad_cascade_df2T_instance_f64; |
priyank12p | 0:b0c4c25d37ab | 3851 | |
priyank12p | 0:b0c4c25d37ab | 3852 | |
priyank12p | 0:b0c4c25d37ab | 3853 | /** |
priyank12p | 0:b0c4c25d37ab | 3854 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3855 | * @param[in] *S points to an instance of the filter data structure. |
priyank12p | 0:b0c4c25d37ab | 3856 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3857 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3858 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 3859 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3860 | */ |
priyank12p | 0:b0c4c25d37ab | 3861 | |
priyank12p | 0:b0c4c25d37ab | 3862 | void arm_biquad_cascade_df2T_f32( |
priyank12p | 0:b0c4c25d37ab | 3863 | const arm_biquad_cascade_df2T_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3864 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3865 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3866 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3867 | |
priyank12p | 0:b0c4c25d37ab | 3868 | |
priyank12p | 0:b0c4c25d37ab | 3869 | /** |
priyank12p | 0:b0c4c25d37ab | 3870 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels |
priyank12p | 0:b0c4c25d37ab | 3871 | * @param[in] *S points to an instance of the filter data structure. |
priyank12p | 0:b0c4c25d37ab | 3872 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3873 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3874 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 3875 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3876 | */ |
priyank12p | 0:b0c4c25d37ab | 3877 | |
priyank12p | 0:b0c4c25d37ab | 3878 | void arm_biquad_cascade_stereo_df2T_f32( |
priyank12p | 0:b0c4c25d37ab | 3879 | const arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3880 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3881 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3882 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3883 | |
priyank12p | 0:b0c4c25d37ab | 3884 | /** |
priyank12p | 0:b0c4c25d37ab | 3885 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3886 | * @param[in] *S points to an instance of the filter data structure. |
priyank12p | 0:b0c4c25d37ab | 3887 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 3888 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 3889 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 3890 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3891 | */ |
priyank12p | 0:b0c4c25d37ab | 3892 | |
priyank12p | 0:b0c4c25d37ab | 3893 | void arm_biquad_cascade_df2T_f64( |
priyank12p | 0:b0c4c25d37ab | 3894 | const arm_biquad_cascade_df2T_instance_f64 * S, |
priyank12p | 0:b0c4c25d37ab | 3895 | float64_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 3896 | float64_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 3897 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 3898 | |
priyank12p | 0:b0c4c25d37ab | 3899 | |
priyank12p | 0:b0c4c25d37ab | 3900 | /** |
priyank12p | 0:b0c4c25d37ab | 3901 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3902 | * @param[in,out] *S points to an instance of the filter data structure. |
priyank12p | 0:b0c4c25d37ab | 3903 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 3904 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3905 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3906 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3907 | */ |
priyank12p | 0:b0c4c25d37ab | 3908 | |
priyank12p | 0:b0c4c25d37ab | 3909 | void arm_biquad_cascade_df2T_init_f32( |
priyank12p | 0:b0c4c25d37ab | 3910 | arm_biquad_cascade_df2T_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3911 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 3912 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3913 | float32_t * pState); |
priyank12p | 0:b0c4c25d37ab | 3914 | |
priyank12p | 0:b0c4c25d37ab | 3915 | |
priyank12p | 0:b0c4c25d37ab | 3916 | /** |
priyank12p | 0:b0c4c25d37ab | 3917 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3918 | * @param[in,out] *S points to an instance of the filter data structure. |
priyank12p | 0:b0c4c25d37ab | 3919 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 3920 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3921 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3922 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3923 | */ |
priyank12p | 0:b0c4c25d37ab | 3924 | |
priyank12p | 0:b0c4c25d37ab | 3925 | void arm_biquad_cascade_stereo_df2T_init_f32( |
priyank12p | 0:b0c4c25d37ab | 3926 | arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 3927 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 3928 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3929 | float32_t * pState); |
priyank12p | 0:b0c4c25d37ab | 3930 | |
priyank12p | 0:b0c4c25d37ab | 3931 | |
priyank12p | 0:b0c4c25d37ab | 3932 | /** |
priyank12p | 0:b0c4c25d37ab | 3933 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
priyank12p | 0:b0c4c25d37ab | 3934 | * @param[in,out] *S points to an instance of the filter data structure. |
priyank12p | 0:b0c4c25d37ab | 3935 | * @param[in] numStages number of 2nd order stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 3936 | * @param[in] *pCoeffs points to the filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 3937 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 3938 | * @return none |
priyank12p | 0:b0c4c25d37ab | 3939 | */ |
priyank12p | 0:b0c4c25d37ab | 3940 | |
priyank12p | 0:b0c4c25d37ab | 3941 | void arm_biquad_cascade_df2T_init_f64( |
priyank12p | 0:b0c4c25d37ab | 3942 | arm_biquad_cascade_df2T_instance_f64 * S, |
priyank12p | 0:b0c4c25d37ab | 3943 | uint8_t numStages, |
priyank12p | 0:b0c4c25d37ab | 3944 | float64_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3945 | float64_t * pState); |
priyank12p | 0:b0c4c25d37ab | 3946 | |
priyank12p | 0:b0c4c25d37ab | 3947 | |
priyank12p | 0:b0c4c25d37ab | 3948 | |
priyank12p | 0:b0c4c25d37ab | 3949 | /** |
priyank12p | 0:b0c4c25d37ab | 3950 | * @brief Instance structure for the Q15 FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 3951 | */ |
priyank12p | 0:b0c4c25d37ab | 3952 | |
priyank12p | 0:b0c4c25d37ab | 3953 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3954 | { |
priyank12p | 0:b0c4c25d37ab | 3955 | uint16_t numStages; /**< number of filter stages. */ |
priyank12p | 0:b0c4c25d37ab | 3956 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3957 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3958 | } arm_fir_lattice_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 3959 | |
priyank12p | 0:b0c4c25d37ab | 3960 | /** |
priyank12p | 0:b0c4c25d37ab | 3961 | * @brief Instance structure for the Q31 FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 3962 | */ |
priyank12p | 0:b0c4c25d37ab | 3963 | |
priyank12p | 0:b0c4c25d37ab | 3964 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3965 | { |
priyank12p | 0:b0c4c25d37ab | 3966 | uint16_t numStages; /**< number of filter stages. */ |
priyank12p | 0:b0c4c25d37ab | 3967 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3968 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3969 | } arm_fir_lattice_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 3970 | |
priyank12p | 0:b0c4c25d37ab | 3971 | /** |
priyank12p | 0:b0c4c25d37ab | 3972 | * @brief Instance structure for the floating-point FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 3973 | */ |
priyank12p | 0:b0c4c25d37ab | 3974 | |
priyank12p | 0:b0c4c25d37ab | 3975 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 3976 | { |
priyank12p | 0:b0c4c25d37ab | 3977 | uint16_t numStages; /**< number of filter stages. */ |
priyank12p | 0:b0c4c25d37ab | 3978 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3979 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 3980 | } arm_fir_lattice_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 3981 | |
priyank12p | 0:b0c4c25d37ab | 3982 | /** |
priyank12p | 0:b0c4c25d37ab | 3983 | * @brief Initialization function for the Q15 FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 3984 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 3985 | * @param[in] numStages number of filter stages. |
priyank12p | 0:b0c4c25d37ab | 3986 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 3987 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 3988 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 3989 | */ |
priyank12p | 0:b0c4c25d37ab | 3990 | |
priyank12p | 0:b0c4c25d37ab | 3991 | void arm_fir_lattice_init_q15( |
priyank12p | 0:b0c4c25d37ab | 3992 | arm_fir_lattice_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 3993 | uint16_t numStages, |
priyank12p | 0:b0c4c25d37ab | 3994 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 3995 | q15_t * pState); |
priyank12p | 0:b0c4c25d37ab | 3996 | |
priyank12p | 0:b0c4c25d37ab | 3997 | |
priyank12p | 0:b0c4c25d37ab | 3998 | /** |
priyank12p | 0:b0c4c25d37ab | 3999 | * @brief Processing function for the Q15 FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4000 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4001 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4002 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4003 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4004 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4005 | */ |
priyank12p | 0:b0c4c25d37ab | 4006 | void arm_fir_lattice_q15( |
priyank12p | 0:b0c4c25d37ab | 4007 | const arm_fir_lattice_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4008 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4009 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4010 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4011 | |
priyank12p | 0:b0c4c25d37ab | 4012 | /** |
priyank12p | 0:b0c4c25d37ab | 4013 | * @brief Initialization function for the Q31 FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4014 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4015 | * @param[in] numStages number of filter stages. |
priyank12p | 0:b0c4c25d37ab | 4016 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4017 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4018 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4019 | */ |
priyank12p | 0:b0c4c25d37ab | 4020 | |
priyank12p | 0:b0c4c25d37ab | 4021 | void arm_fir_lattice_init_q31( |
priyank12p | 0:b0c4c25d37ab | 4022 | arm_fir_lattice_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4023 | uint16_t numStages, |
priyank12p | 0:b0c4c25d37ab | 4024 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4025 | q31_t * pState); |
priyank12p | 0:b0c4c25d37ab | 4026 | |
priyank12p | 0:b0c4c25d37ab | 4027 | |
priyank12p | 0:b0c4c25d37ab | 4028 | /** |
priyank12p | 0:b0c4c25d37ab | 4029 | * @brief Processing function for the Q31 FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4030 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4031 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4032 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 4033 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4034 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4035 | */ |
priyank12p | 0:b0c4c25d37ab | 4036 | |
priyank12p | 0:b0c4c25d37ab | 4037 | void arm_fir_lattice_q31( |
priyank12p | 0:b0c4c25d37ab | 4038 | const arm_fir_lattice_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4039 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4040 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4041 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4042 | |
priyank12p | 0:b0c4c25d37ab | 4043 | /** |
priyank12p | 0:b0c4c25d37ab | 4044 | * @brief Initialization function for the floating-point FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4045 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4046 | * @param[in] numStages number of filter stages. |
priyank12p | 0:b0c4c25d37ab | 4047 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4048 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4049 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4050 | */ |
priyank12p | 0:b0c4c25d37ab | 4051 | |
priyank12p | 0:b0c4c25d37ab | 4052 | void arm_fir_lattice_init_f32( |
priyank12p | 0:b0c4c25d37ab | 4053 | arm_fir_lattice_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4054 | uint16_t numStages, |
priyank12p | 0:b0c4c25d37ab | 4055 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4056 | float32_t * pState); |
priyank12p | 0:b0c4c25d37ab | 4057 | |
priyank12p | 0:b0c4c25d37ab | 4058 | /** |
priyank12p | 0:b0c4c25d37ab | 4059 | * @brief Processing function for the floating-point FIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4060 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4061 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4062 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 4063 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4064 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4065 | */ |
priyank12p | 0:b0c4c25d37ab | 4066 | |
priyank12p | 0:b0c4c25d37ab | 4067 | void arm_fir_lattice_f32( |
priyank12p | 0:b0c4c25d37ab | 4068 | const arm_fir_lattice_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4069 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4070 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4071 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4072 | |
priyank12p | 0:b0c4c25d37ab | 4073 | /** |
priyank12p | 0:b0c4c25d37ab | 4074 | * @brief Instance structure for the Q15 IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4075 | */ |
priyank12p | 0:b0c4c25d37ab | 4076 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4077 | { |
priyank12p | 0:b0c4c25d37ab | 4078 | uint16_t numStages; /**< number of stages in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4079 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
priyank12p | 0:b0c4c25d37ab | 4080 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 4081 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
priyank12p | 0:b0c4c25d37ab | 4082 | } arm_iir_lattice_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 4083 | |
priyank12p | 0:b0c4c25d37ab | 4084 | /** |
priyank12p | 0:b0c4c25d37ab | 4085 | * @brief Instance structure for the Q31 IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4086 | */ |
priyank12p | 0:b0c4c25d37ab | 4087 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4088 | { |
priyank12p | 0:b0c4c25d37ab | 4089 | uint16_t numStages; /**< number of stages in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4090 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
priyank12p | 0:b0c4c25d37ab | 4091 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 4092 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
priyank12p | 0:b0c4c25d37ab | 4093 | } arm_iir_lattice_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 4094 | |
priyank12p | 0:b0c4c25d37ab | 4095 | /** |
priyank12p | 0:b0c4c25d37ab | 4096 | * @brief Instance structure for the floating-point IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4097 | */ |
priyank12p | 0:b0c4c25d37ab | 4098 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4099 | { |
priyank12p | 0:b0c4c25d37ab | 4100 | uint16_t numStages; /**< number of stages in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4101 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
priyank12p | 0:b0c4c25d37ab | 4102 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
priyank12p | 0:b0c4c25d37ab | 4103 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
priyank12p | 0:b0c4c25d37ab | 4104 | } arm_iir_lattice_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 4105 | |
priyank12p | 0:b0c4c25d37ab | 4106 | /** |
priyank12p | 0:b0c4c25d37ab | 4107 | * @brief Processing function for the floating-point IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4108 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4109 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4110 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4111 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4112 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4113 | */ |
priyank12p | 0:b0c4c25d37ab | 4114 | |
priyank12p | 0:b0c4c25d37ab | 4115 | void arm_iir_lattice_f32( |
priyank12p | 0:b0c4c25d37ab | 4116 | const arm_iir_lattice_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4117 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4118 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4119 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4120 | |
priyank12p | 0:b0c4c25d37ab | 4121 | /** |
priyank12p | 0:b0c4c25d37ab | 4122 | * @brief Initialization function for the floating-point IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4123 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4124 | * @param[in] numStages number of stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 4125 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4126 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
priyank12p | 0:b0c4c25d37ab | 4127 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1. |
priyank12p | 0:b0c4c25d37ab | 4128 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4129 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4130 | */ |
priyank12p | 0:b0c4c25d37ab | 4131 | |
priyank12p | 0:b0c4c25d37ab | 4132 | void arm_iir_lattice_init_f32( |
priyank12p | 0:b0c4c25d37ab | 4133 | arm_iir_lattice_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4134 | uint16_t numStages, |
priyank12p | 0:b0c4c25d37ab | 4135 | float32_t * pkCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4136 | float32_t * pvCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4137 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4138 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4139 | |
priyank12p | 0:b0c4c25d37ab | 4140 | |
priyank12p | 0:b0c4c25d37ab | 4141 | /** |
priyank12p | 0:b0c4c25d37ab | 4142 | * @brief Processing function for the Q31 IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4143 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4144 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4145 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4146 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4147 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4148 | */ |
priyank12p | 0:b0c4c25d37ab | 4149 | |
priyank12p | 0:b0c4c25d37ab | 4150 | void arm_iir_lattice_q31( |
priyank12p | 0:b0c4c25d37ab | 4151 | const arm_iir_lattice_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4152 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4153 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4154 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4155 | |
priyank12p | 0:b0c4c25d37ab | 4156 | |
priyank12p | 0:b0c4c25d37ab | 4157 | /** |
priyank12p | 0:b0c4c25d37ab | 4158 | * @brief Initialization function for the Q31 IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4159 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4160 | * @param[in] numStages number of stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 4161 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4162 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
priyank12p | 0:b0c4c25d37ab | 4163 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. |
priyank12p | 0:b0c4c25d37ab | 4164 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4165 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4166 | */ |
priyank12p | 0:b0c4c25d37ab | 4167 | |
priyank12p | 0:b0c4c25d37ab | 4168 | void arm_iir_lattice_init_q31( |
priyank12p | 0:b0c4c25d37ab | 4169 | arm_iir_lattice_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4170 | uint16_t numStages, |
priyank12p | 0:b0c4c25d37ab | 4171 | q31_t * pkCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4172 | q31_t * pvCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4173 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4174 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4175 | |
priyank12p | 0:b0c4c25d37ab | 4176 | |
priyank12p | 0:b0c4c25d37ab | 4177 | /** |
priyank12p | 0:b0c4c25d37ab | 4178 | * @brief Processing function for the Q15 IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4179 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4180 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4181 | * @param[out] *pDst points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4182 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4183 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4184 | */ |
priyank12p | 0:b0c4c25d37ab | 4185 | |
priyank12p | 0:b0c4c25d37ab | 4186 | void arm_iir_lattice_q15( |
priyank12p | 0:b0c4c25d37ab | 4187 | const arm_iir_lattice_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4188 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4189 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4190 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4191 | |
priyank12p | 0:b0c4c25d37ab | 4192 | |
priyank12p | 0:b0c4c25d37ab | 4193 | /** |
priyank12p | 0:b0c4c25d37ab | 4194 | * @brief Initialization function for the Q15 IIR lattice filter. |
priyank12p | 0:b0c4c25d37ab | 4195 | * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure. |
priyank12p | 0:b0c4c25d37ab | 4196 | * @param[in] numStages number of stages in the filter. |
priyank12p | 0:b0c4c25d37ab | 4197 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. |
priyank12p | 0:b0c4c25d37ab | 4198 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. |
priyank12p | 0:b0c4c25d37ab | 4199 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. |
priyank12p | 0:b0c4c25d37ab | 4200 | * @param[in] blockSize number of samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 4201 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4202 | */ |
priyank12p | 0:b0c4c25d37ab | 4203 | |
priyank12p | 0:b0c4c25d37ab | 4204 | void arm_iir_lattice_init_q15( |
priyank12p | 0:b0c4c25d37ab | 4205 | arm_iir_lattice_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4206 | uint16_t numStages, |
priyank12p | 0:b0c4c25d37ab | 4207 | q15_t * pkCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4208 | q15_t * pvCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4209 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4210 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4211 | |
priyank12p | 0:b0c4c25d37ab | 4212 | /** |
priyank12p | 0:b0c4c25d37ab | 4213 | * @brief Instance structure for the floating-point LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4214 | */ |
priyank12p | 0:b0c4c25d37ab | 4215 | |
priyank12p | 0:b0c4c25d37ab | 4216 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4217 | { |
priyank12p | 0:b0c4c25d37ab | 4218 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4219 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4220 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4221 | float32_t mu; /**< step size that controls filter coefficient updates. */ |
priyank12p | 0:b0c4c25d37ab | 4222 | } arm_lms_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 4223 | |
priyank12p | 0:b0c4c25d37ab | 4224 | /** |
priyank12p | 0:b0c4c25d37ab | 4225 | * @brief Processing function for floating-point LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4226 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4227 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4228 | * @param[in] *pRef points to the block of reference data. |
priyank12p | 0:b0c4c25d37ab | 4229 | * @param[out] *pOut points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4230 | * @param[out] *pErr points to the block of error data. |
priyank12p | 0:b0c4c25d37ab | 4231 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4232 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4233 | */ |
priyank12p | 0:b0c4c25d37ab | 4234 | |
priyank12p | 0:b0c4c25d37ab | 4235 | void arm_lms_f32( |
priyank12p | 0:b0c4c25d37ab | 4236 | const arm_lms_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4237 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4238 | float32_t * pRef, |
priyank12p | 0:b0c4c25d37ab | 4239 | float32_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 4240 | float32_t * pErr, |
priyank12p | 0:b0c4c25d37ab | 4241 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4242 | |
priyank12p | 0:b0c4c25d37ab | 4243 | /** |
priyank12p | 0:b0c4c25d37ab | 4244 | * @brief Initialization function for floating-point LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4245 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4246 | * @param[in] numTaps number of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4247 | * @param[in] *pCoeffs points to the coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 4248 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 4249 | * @param[in] mu step size that controls filter coefficient updates. |
priyank12p | 0:b0c4c25d37ab | 4250 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4251 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4252 | */ |
priyank12p | 0:b0c4c25d37ab | 4253 | |
priyank12p | 0:b0c4c25d37ab | 4254 | void arm_lms_init_f32( |
priyank12p | 0:b0c4c25d37ab | 4255 | arm_lms_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4256 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4257 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4258 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4259 | float32_t mu, |
priyank12p | 0:b0c4c25d37ab | 4260 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4261 | |
priyank12p | 0:b0c4c25d37ab | 4262 | /** |
priyank12p | 0:b0c4c25d37ab | 4263 | * @brief Instance structure for the Q15 LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4264 | */ |
priyank12p | 0:b0c4c25d37ab | 4265 | |
priyank12p | 0:b0c4c25d37ab | 4266 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4267 | { |
priyank12p | 0:b0c4c25d37ab | 4268 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4269 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4270 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4271 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
priyank12p | 0:b0c4c25d37ab | 4272 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
priyank12p | 0:b0c4c25d37ab | 4273 | } arm_lms_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 4274 | |
priyank12p | 0:b0c4c25d37ab | 4275 | |
priyank12p | 0:b0c4c25d37ab | 4276 | /** |
priyank12p | 0:b0c4c25d37ab | 4277 | * @brief Initialization function for the Q15 LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4278 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4279 | * @param[in] numTaps number of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4280 | * @param[in] *pCoeffs points to the coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 4281 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 4282 | * @param[in] mu step size that controls filter coefficient updates. |
priyank12p | 0:b0c4c25d37ab | 4283 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4284 | * @param[in] postShift bit shift applied to coefficients. |
priyank12p | 0:b0c4c25d37ab | 4285 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4286 | */ |
priyank12p | 0:b0c4c25d37ab | 4287 | |
priyank12p | 0:b0c4c25d37ab | 4288 | void arm_lms_init_q15( |
priyank12p | 0:b0c4c25d37ab | 4289 | arm_lms_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4290 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4291 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4292 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4293 | q15_t mu, |
priyank12p | 0:b0c4c25d37ab | 4294 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 4295 | uint32_t postShift); |
priyank12p | 0:b0c4c25d37ab | 4296 | |
priyank12p | 0:b0c4c25d37ab | 4297 | /** |
priyank12p | 0:b0c4c25d37ab | 4298 | * @brief Processing function for Q15 LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4299 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4300 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4301 | * @param[in] *pRef points to the block of reference data. |
priyank12p | 0:b0c4c25d37ab | 4302 | * @param[out] *pOut points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4303 | * @param[out] *pErr points to the block of error data. |
priyank12p | 0:b0c4c25d37ab | 4304 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4305 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4306 | */ |
priyank12p | 0:b0c4c25d37ab | 4307 | |
priyank12p | 0:b0c4c25d37ab | 4308 | void arm_lms_q15( |
priyank12p | 0:b0c4c25d37ab | 4309 | const arm_lms_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4310 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4311 | q15_t * pRef, |
priyank12p | 0:b0c4c25d37ab | 4312 | q15_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 4313 | q15_t * pErr, |
priyank12p | 0:b0c4c25d37ab | 4314 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4315 | |
priyank12p | 0:b0c4c25d37ab | 4316 | |
priyank12p | 0:b0c4c25d37ab | 4317 | /** |
priyank12p | 0:b0c4c25d37ab | 4318 | * @brief Instance structure for the Q31 LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4319 | */ |
priyank12p | 0:b0c4c25d37ab | 4320 | |
priyank12p | 0:b0c4c25d37ab | 4321 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4322 | { |
priyank12p | 0:b0c4c25d37ab | 4323 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4324 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4325 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4326 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
priyank12p | 0:b0c4c25d37ab | 4327 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
priyank12p | 0:b0c4c25d37ab | 4328 | |
priyank12p | 0:b0c4c25d37ab | 4329 | } arm_lms_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 4330 | |
priyank12p | 0:b0c4c25d37ab | 4331 | /** |
priyank12p | 0:b0c4c25d37ab | 4332 | * @brief Processing function for Q31 LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4333 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4334 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4335 | * @param[in] *pRef points to the block of reference data. |
priyank12p | 0:b0c4c25d37ab | 4336 | * @param[out] *pOut points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4337 | * @param[out] *pErr points to the block of error data. |
priyank12p | 0:b0c4c25d37ab | 4338 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4339 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4340 | */ |
priyank12p | 0:b0c4c25d37ab | 4341 | |
priyank12p | 0:b0c4c25d37ab | 4342 | void arm_lms_q31( |
priyank12p | 0:b0c4c25d37ab | 4343 | const arm_lms_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4344 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4345 | q31_t * pRef, |
priyank12p | 0:b0c4c25d37ab | 4346 | q31_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 4347 | q31_t * pErr, |
priyank12p | 0:b0c4c25d37ab | 4348 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4349 | |
priyank12p | 0:b0c4c25d37ab | 4350 | /** |
priyank12p | 0:b0c4c25d37ab | 4351 | * @brief Initialization function for Q31 LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4352 | * @param[in] *S points to an instance of the Q31 LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4353 | * @param[in] numTaps number of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4354 | * @param[in] *pCoeffs points to coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 4355 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 4356 | * @param[in] mu step size that controls filter coefficient updates. |
priyank12p | 0:b0c4c25d37ab | 4357 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4358 | * @param[in] postShift bit shift applied to coefficients. |
priyank12p | 0:b0c4c25d37ab | 4359 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4360 | */ |
priyank12p | 0:b0c4c25d37ab | 4361 | |
priyank12p | 0:b0c4c25d37ab | 4362 | void arm_lms_init_q31( |
priyank12p | 0:b0c4c25d37ab | 4363 | arm_lms_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4364 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4365 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4366 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4367 | q31_t mu, |
priyank12p | 0:b0c4c25d37ab | 4368 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 4369 | uint32_t postShift); |
priyank12p | 0:b0c4c25d37ab | 4370 | |
priyank12p | 0:b0c4c25d37ab | 4371 | /** |
priyank12p | 0:b0c4c25d37ab | 4372 | * @brief Instance structure for the floating-point normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4373 | */ |
priyank12p | 0:b0c4c25d37ab | 4374 | |
priyank12p | 0:b0c4c25d37ab | 4375 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4376 | { |
priyank12p | 0:b0c4c25d37ab | 4377 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4378 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4379 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4380 | float32_t mu; /**< step size that control filter coefficient updates. */ |
priyank12p | 0:b0c4c25d37ab | 4381 | float32_t energy; /**< saves previous frame energy. */ |
priyank12p | 0:b0c4c25d37ab | 4382 | float32_t x0; /**< saves previous input sample. */ |
priyank12p | 0:b0c4c25d37ab | 4383 | } arm_lms_norm_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 4384 | |
priyank12p | 0:b0c4c25d37ab | 4385 | /** |
priyank12p | 0:b0c4c25d37ab | 4386 | * @brief Processing function for floating-point normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4387 | * @param[in] *S points to an instance of the floating-point normalized LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4388 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4389 | * @param[in] *pRef points to the block of reference data. |
priyank12p | 0:b0c4c25d37ab | 4390 | * @param[out] *pOut points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4391 | * @param[out] *pErr points to the block of error data. |
priyank12p | 0:b0c4c25d37ab | 4392 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4393 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4394 | */ |
priyank12p | 0:b0c4c25d37ab | 4395 | |
priyank12p | 0:b0c4c25d37ab | 4396 | void arm_lms_norm_f32( |
priyank12p | 0:b0c4c25d37ab | 4397 | arm_lms_norm_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4398 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4399 | float32_t * pRef, |
priyank12p | 0:b0c4c25d37ab | 4400 | float32_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 4401 | float32_t * pErr, |
priyank12p | 0:b0c4c25d37ab | 4402 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4403 | |
priyank12p | 0:b0c4c25d37ab | 4404 | /** |
priyank12p | 0:b0c4c25d37ab | 4405 | * @brief Initialization function for floating-point normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4406 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4407 | * @param[in] numTaps number of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4408 | * @param[in] *pCoeffs points to coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 4409 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 4410 | * @param[in] mu step size that controls filter coefficient updates. |
priyank12p | 0:b0c4c25d37ab | 4411 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4412 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4413 | */ |
priyank12p | 0:b0c4c25d37ab | 4414 | |
priyank12p | 0:b0c4c25d37ab | 4415 | void arm_lms_norm_init_f32( |
priyank12p | 0:b0c4c25d37ab | 4416 | arm_lms_norm_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4417 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4418 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4419 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4420 | float32_t mu, |
priyank12p | 0:b0c4c25d37ab | 4421 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4422 | |
priyank12p | 0:b0c4c25d37ab | 4423 | |
priyank12p | 0:b0c4c25d37ab | 4424 | /** |
priyank12p | 0:b0c4c25d37ab | 4425 | * @brief Instance structure for the Q31 normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4426 | */ |
priyank12p | 0:b0c4c25d37ab | 4427 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4428 | { |
priyank12p | 0:b0c4c25d37ab | 4429 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4430 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4431 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4432 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
priyank12p | 0:b0c4c25d37ab | 4433 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
priyank12p | 0:b0c4c25d37ab | 4434 | q31_t *recipTable; /**< points to the reciprocal initial value table. */ |
priyank12p | 0:b0c4c25d37ab | 4435 | q31_t energy; /**< saves previous frame energy. */ |
priyank12p | 0:b0c4c25d37ab | 4436 | q31_t x0; /**< saves previous input sample. */ |
priyank12p | 0:b0c4c25d37ab | 4437 | } arm_lms_norm_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 4438 | |
priyank12p | 0:b0c4c25d37ab | 4439 | /** |
priyank12p | 0:b0c4c25d37ab | 4440 | * @brief Processing function for Q31 normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4441 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4442 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4443 | * @param[in] *pRef points to the block of reference data. |
priyank12p | 0:b0c4c25d37ab | 4444 | * @param[out] *pOut points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4445 | * @param[out] *pErr points to the block of error data. |
priyank12p | 0:b0c4c25d37ab | 4446 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4447 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4448 | */ |
priyank12p | 0:b0c4c25d37ab | 4449 | |
priyank12p | 0:b0c4c25d37ab | 4450 | void arm_lms_norm_q31( |
priyank12p | 0:b0c4c25d37ab | 4451 | arm_lms_norm_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4452 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4453 | q31_t * pRef, |
priyank12p | 0:b0c4c25d37ab | 4454 | q31_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 4455 | q31_t * pErr, |
priyank12p | 0:b0c4c25d37ab | 4456 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4457 | |
priyank12p | 0:b0c4c25d37ab | 4458 | /** |
priyank12p | 0:b0c4c25d37ab | 4459 | * @brief Initialization function for Q31 normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4460 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4461 | * @param[in] numTaps number of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4462 | * @param[in] *pCoeffs points to coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 4463 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 4464 | * @param[in] mu step size that controls filter coefficient updates. |
priyank12p | 0:b0c4c25d37ab | 4465 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4466 | * @param[in] postShift bit shift applied to coefficients. |
priyank12p | 0:b0c4c25d37ab | 4467 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4468 | */ |
priyank12p | 0:b0c4c25d37ab | 4469 | |
priyank12p | 0:b0c4c25d37ab | 4470 | void arm_lms_norm_init_q31( |
priyank12p | 0:b0c4c25d37ab | 4471 | arm_lms_norm_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4472 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4473 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4474 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4475 | q31_t mu, |
priyank12p | 0:b0c4c25d37ab | 4476 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 4477 | uint8_t postShift); |
priyank12p | 0:b0c4c25d37ab | 4478 | |
priyank12p | 0:b0c4c25d37ab | 4479 | /** |
priyank12p | 0:b0c4c25d37ab | 4480 | * @brief Instance structure for the Q15 normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4481 | */ |
priyank12p | 0:b0c4c25d37ab | 4482 | |
priyank12p | 0:b0c4c25d37ab | 4483 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4484 | { |
priyank12p | 0:b0c4c25d37ab | 4485 | uint16_t numTaps; /**< Number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4486 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4487 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4488 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
priyank12p | 0:b0c4c25d37ab | 4489 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
priyank12p | 0:b0c4c25d37ab | 4490 | q15_t *recipTable; /**< Points to the reciprocal initial value table. */ |
priyank12p | 0:b0c4c25d37ab | 4491 | q15_t energy; /**< saves previous frame energy. */ |
priyank12p | 0:b0c4c25d37ab | 4492 | q15_t x0; /**< saves previous input sample. */ |
priyank12p | 0:b0c4c25d37ab | 4493 | } arm_lms_norm_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 4494 | |
priyank12p | 0:b0c4c25d37ab | 4495 | /** |
priyank12p | 0:b0c4c25d37ab | 4496 | * @brief Processing function for Q15 normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4497 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4498 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4499 | * @param[in] *pRef points to the block of reference data. |
priyank12p | 0:b0c4c25d37ab | 4500 | * @param[out] *pOut points to the block of output data. |
priyank12p | 0:b0c4c25d37ab | 4501 | * @param[out] *pErr points to the block of error data. |
priyank12p | 0:b0c4c25d37ab | 4502 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4503 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4504 | */ |
priyank12p | 0:b0c4c25d37ab | 4505 | |
priyank12p | 0:b0c4c25d37ab | 4506 | void arm_lms_norm_q15( |
priyank12p | 0:b0c4c25d37ab | 4507 | arm_lms_norm_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4508 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4509 | q15_t * pRef, |
priyank12p | 0:b0c4c25d37ab | 4510 | q15_t * pOut, |
priyank12p | 0:b0c4c25d37ab | 4511 | q15_t * pErr, |
priyank12p | 0:b0c4c25d37ab | 4512 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4513 | |
priyank12p | 0:b0c4c25d37ab | 4514 | |
priyank12p | 0:b0c4c25d37ab | 4515 | /** |
priyank12p | 0:b0c4c25d37ab | 4516 | * @brief Initialization function for Q15 normalized LMS filter. |
priyank12p | 0:b0c4c25d37ab | 4517 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
priyank12p | 0:b0c4c25d37ab | 4518 | * @param[in] numTaps number of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4519 | * @param[in] *pCoeffs points to coefficient buffer. |
priyank12p | 0:b0c4c25d37ab | 4520 | * @param[in] *pState points to state buffer. |
priyank12p | 0:b0c4c25d37ab | 4521 | * @param[in] mu step size that controls filter coefficient updates. |
priyank12p | 0:b0c4c25d37ab | 4522 | * @param[in] blockSize number of samples to process. |
priyank12p | 0:b0c4c25d37ab | 4523 | * @param[in] postShift bit shift applied to coefficients. |
priyank12p | 0:b0c4c25d37ab | 4524 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4525 | */ |
priyank12p | 0:b0c4c25d37ab | 4526 | |
priyank12p | 0:b0c4c25d37ab | 4527 | void arm_lms_norm_init_q15( |
priyank12p | 0:b0c4c25d37ab | 4528 | arm_lms_norm_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4529 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4530 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4531 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4532 | q15_t mu, |
priyank12p | 0:b0c4c25d37ab | 4533 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 4534 | uint8_t postShift); |
priyank12p | 0:b0c4c25d37ab | 4535 | |
priyank12p | 0:b0c4c25d37ab | 4536 | /** |
priyank12p | 0:b0c4c25d37ab | 4537 | * @brief Correlation of floating-point sequences. |
priyank12p | 0:b0c4c25d37ab | 4538 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4539 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4540 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4541 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4542 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4543 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4544 | */ |
priyank12p | 0:b0c4c25d37ab | 4545 | |
priyank12p | 0:b0c4c25d37ab | 4546 | void arm_correlate_f32( |
priyank12p | 0:b0c4c25d37ab | 4547 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4548 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4549 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4550 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4551 | float32_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 4552 | |
priyank12p | 0:b0c4c25d37ab | 4553 | |
priyank12p | 0:b0c4c25d37ab | 4554 | /** |
priyank12p | 0:b0c4c25d37ab | 4555 | * @brief Correlation of Q15 sequences |
priyank12p | 0:b0c4c25d37ab | 4556 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4557 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4558 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4559 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4560 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4561 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 4562 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4563 | */ |
priyank12p | 0:b0c4c25d37ab | 4564 | void arm_correlate_opt_q15( |
priyank12p | 0:b0c4c25d37ab | 4565 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4566 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4567 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4568 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4569 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4570 | q15_t * pScratch); |
priyank12p | 0:b0c4c25d37ab | 4571 | |
priyank12p | 0:b0c4c25d37ab | 4572 | |
priyank12p | 0:b0c4c25d37ab | 4573 | /** |
priyank12p | 0:b0c4c25d37ab | 4574 | * @brief Correlation of Q15 sequences. |
priyank12p | 0:b0c4c25d37ab | 4575 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4576 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4577 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4578 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4579 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4580 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4581 | */ |
priyank12p | 0:b0c4c25d37ab | 4582 | |
priyank12p | 0:b0c4c25d37ab | 4583 | void arm_correlate_q15( |
priyank12p | 0:b0c4c25d37ab | 4584 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4585 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4586 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4587 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4588 | q15_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 4589 | |
priyank12p | 0:b0c4c25d37ab | 4590 | /** |
priyank12p | 0:b0c4c25d37ab | 4591 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 4592 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4593 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4594 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4595 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4596 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4597 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4598 | */ |
priyank12p | 0:b0c4c25d37ab | 4599 | |
priyank12p | 0:b0c4c25d37ab | 4600 | void arm_correlate_fast_q15( |
priyank12p | 0:b0c4c25d37ab | 4601 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4602 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4603 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4604 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4605 | q15_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 4606 | |
priyank12p | 0:b0c4c25d37ab | 4607 | |
priyank12p | 0:b0c4c25d37ab | 4608 | |
priyank12p | 0:b0c4c25d37ab | 4609 | /** |
priyank12p | 0:b0c4c25d37ab | 4610 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
priyank12p | 0:b0c4c25d37ab | 4611 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4612 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4613 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4614 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4615 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4616 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 4617 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4618 | */ |
priyank12p | 0:b0c4c25d37ab | 4619 | |
priyank12p | 0:b0c4c25d37ab | 4620 | void arm_correlate_fast_opt_q15( |
priyank12p | 0:b0c4c25d37ab | 4621 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4622 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4623 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4624 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4625 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4626 | q15_t * pScratch); |
priyank12p | 0:b0c4c25d37ab | 4627 | |
priyank12p | 0:b0c4c25d37ab | 4628 | /** |
priyank12p | 0:b0c4c25d37ab | 4629 | * @brief Correlation of Q31 sequences. |
priyank12p | 0:b0c4c25d37ab | 4630 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4631 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4632 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4633 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4634 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4635 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4636 | */ |
priyank12p | 0:b0c4c25d37ab | 4637 | |
priyank12p | 0:b0c4c25d37ab | 4638 | void arm_correlate_q31( |
priyank12p | 0:b0c4c25d37ab | 4639 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4640 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4641 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4642 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4643 | q31_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 4644 | |
priyank12p | 0:b0c4c25d37ab | 4645 | /** |
priyank12p | 0:b0c4c25d37ab | 4646 | * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
priyank12p | 0:b0c4c25d37ab | 4647 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4648 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4649 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4650 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4651 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4652 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4653 | */ |
priyank12p | 0:b0c4c25d37ab | 4654 | |
priyank12p | 0:b0c4c25d37ab | 4655 | void arm_correlate_fast_q31( |
priyank12p | 0:b0c4c25d37ab | 4656 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4657 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4658 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4659 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4660 | q31_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 4661 | |
priyank12p | 0:b0c4c25d37ab | 4662 | |
priyank12p | 0:b0c4c25d37ab | 4663 | |
priyank12p | 0:b0c4c25d37ab | 4664 | /** |
priyank12p | 0:b0c4c25d37ab | 4665 | * @brief Correlation of Q7 sequences. |
priyank12p | 0:b0c4c25d37ab | 4666 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4667 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4668 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4669 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4670 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4671 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
priyank12p | 0:b0c4c25d37ab | 4672 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
priyank12p | 0:b0c4c25d37ab | 4673 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4674 | */ |
priyank12p | 0:b0c4c25d37ab | 4675 | |
priyank12p | 0:b0c4c25d37ab | 4676 | void arm_correlate_opt_q7( |
priyank12p | 0:b0c4c25d37ab | 4677 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4678 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4679 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4680 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4681 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4682 | q15_t * pScratch1, |
priyank12p | 0:b0c4c25d37ab | 4683 | q15_t * pScratch2); |
priyank12p | 0:b0c4c25d37ab | 4684 | |
priyank12p | 0:b0c4c25d37ab | 4685 | |
priyank12p | 0:b0c4c25d37ab | 4686 | /** |
priyank12p | 0:b0c4c25d37ab | 4687 | * @brief Correlation of Q7 sequences. |
priyank12p | 0:b0c4c25d37ab | 4688 | * @param[in] *pSrcA points to the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4689 | * @param[in] srcALen length of the first input sequence. |
priyank12p | 0:b0c4c25d37ab | 4690 | * @param[in] *pSrcB points to the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4691 | * @param[in] srcBLen length of the second input sequence. |
priyank12p | 0:b0c4c25d37ab | 4692 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
priyank12p | 0:b0c4c25d37ab | 4693 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4694 | */ |
priyank12p | 0:b0c4c25d37ab | 4695 | |
priyank12p | 0:b0c4c25d37ab | 4696 | void arm_correlate_q7( |
priyank12p | 0:b0c4c25d37ab | 4697 | q7_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 4698 | uint32_t srcALen, |
priyank12p | 0:b0c4c25d37ab | 4699 | q7_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 4700 | uint32_t srcBLen, |
priyank12p | 0:b0c4c25d37ab | 4701 | q7_t * pDst); |
priyank12p | 0:b0c4c25d37ab | 4702 | |
priyank12p | 0:b0c4c25d37ab | 4703 | |
priyank12p | 0:b0c4c25d37ab | 4704 | /** |
priyank12p | 0:b0c4c25d37ab | 4705 | * @brief Instance structure for the floating-point sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4706 | */ |
priyank12p | 0:b0c4c25d37ab | 4707 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4708 | { |
priyank12p | 0:b0c4c25d37ab | 4709 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4710 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
priyank12p | 0:b0c4c25d37ab | 4711 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4712 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 4713 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
priyank12p | 0:b0c4c25d37ab | 4714 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4715 | } arm_fir_sparse_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 4716 | |
priyank12p | 0:b0c4c25d37ab | 4717 | /** |
priyank12p | 0:b0c4c25d37ab | 4718 | * @brief Instance structure for the Q31 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4719 | */ |
priyank12p | 0:b0c4c25d37ab | 4720 | |
priyank12p | 0:b0c4c25d37ab | 4721 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4722 | { |
priyank12p | 0:b0c4c25d37ab | 4723 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4724 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
priyank12p | 0:b0c4c25d37ab | 4725 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4726 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 4727 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
priyank12p | 0:b0c4c25d37ab | 4728 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4729 | } arm_fir_sparse_instance_q31; |
priyank12p | 0:b0c4c25d37ab | 4730 | |
priyank12p | 0:b0c4c25d37ab | 4731 | /** |
priyank12p | 0:b0c4c25d37ab | 4732 | * @brief Instance structure for the Q15 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4733 | */ |
priyank12p | 0:b0c4c25d37ab | 4734 | |
priyank12p | 0:b0c4c25d37ab | 4735 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4736 | { |
priyank12p | 0:b0c4c25d37ab | 4737 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4738 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
priyank12p | 0:b0c4c25d37ab | 4739 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4740 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 4741 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
priyank12p | 0:b0c4c25d37ab | 4742 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4743 | } arm_fir_sparse_instance_q15; |
priyank12p | 0:b0c4c25d37ab | 4744 | |
priyank12p | 0:b0c4c25d37ab | 4745 | /** |
priyank12p | 0:b0c4c25d37ab | 4746 | * @brief Instance structure for the Q7 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4747 | */ |
priyank12p | 0:b0c4c25d37ab | 4748 | |
priyank12p | 0:b0c4c25d37ab | 4749 | typedef struct |
priyank12p | 0:b0c4c25d37ab | 4750 | { |
priyank12p | 0:b0c4c25d37ab | 4751 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
priyank12p | 0:b0c4c25d37ab | 4752 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
priyank12p | 0:b0c4c25d37ab | 4753 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
priyank12p | 0:b0c4c25d37ab | 4754 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
priyank12p | 0:b0c4c25d37ab | 4755 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
priyank12p | 0:b0c4c25d37ab | 4756 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
priyank12p | 0:b0c4c25d37ab | 4757 | } arm_fir_sparse_instance_q7; |
priyank12p | 0:b0c4c25d37ab | 4758 | |
priyank12p | 0:b0c4c25d37ab | 4759 | /** |
priyank12p | 0:b0c4c25d37ab | 4760 | * @brief Processing function for the floating-point sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4761 | * @param[in] *S points to an instance of the floating-point sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4762 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4763 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 4764 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
priyank12p | 0:b0c4c25d37ab | 4765 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 4766 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4767 | */ |
priyank12p | 0:b0c4c25d37ab | 4768 | |
priyank12p | 0:b0c4c25d37ab | 4769 | void arm_fir_sparse_f32( |
priyank12p | 0:b0c4c25d37ab | 4770 | arm_fir_sparse_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4771 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4772 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4773 | float32_t * pScratchIn, |
priyank12p | 0:b0c4c25d37ab | 4774 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4775 | |
priyank12p | 0:b0c4c25d37ab | 4776 | /** |
priyank12p | 0:b0c4c25d37ab | 4777 | * @brief Initialization function for the floating-point sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4778 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4779 | * @param[in] numTaps number of nonzero coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 4780 | * @param[in] *pCoeffs points to the array of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4781 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 4782 | * @param[in] *pTapDelay points to the array of offset times. |
priyank12p | 0:b0c4c25d37ab | 4783 | * @param[in] maxDelay maximum offset time supported. |
priyank12p | 0:b0c4c25d37ab | 4784 | * @param[in] blockSize number of samples that will be processed per block. |
priyank12p | 0:b0c4c25d37ab | 4785 | * @return none |
priyank12p | 0:b0c4c25d37ab | 4786 | */ |
priyank12p | 0:b0c4c25d37ab | 4787 | |
priyank12p | 0:b0c4c25d37ab | 4788 | void arm_fir_sparse_init_f32( |
priyank12p | 0:b0c4c25d37ab | 4789 | arm_fir_sparse_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 4790 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4791 | float32_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4792 | float32_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4793 | int32_t * pTapDelay, |
priyank12p | 0:b0c4c25d37ab | 4794 | uint16_t maxDelay, |
priyank12p | 0:b0c4c25d37ab | 4795 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4796 | |
priyank12p | 0:b0c4c25d37ab | 4797 | /** |
priyank12p | 0:b0c4c25d37ab | 4798 | * @brief Processing function for the Q31 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4799 | * @param[in] *S points to an instance of the Q31 sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4800 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4801 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 4802 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
priyank12p | 0:b0c4c25d37ab | 4803 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 4804 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4805 | */ |
priyank12p | 0:b0c4c25d37ab | 4806 | |
priyank12p | 0:b0c4c25d37ab | 4807 | void arm_fir_sparse_q31( |
priyank12p | 0:b0c4c25d37ab | 4808 | arm_fir_sparse_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4809 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4810 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4811 | q31_t * pScratchIn, |
priyank12p | 0:b0c4c25d37ab | 4812 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4813 | |
priyank12p | 0:b0c4c25d37ab | 4814 | /** |
priyank12p | 0:b0c4c25d37ab | 4815 | * @brief Initialization function for the Q31 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4816 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4817 | * @param[in] numTaps number of nonzero coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 4818 | * @param[in] *pCoeffs points to the array of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4819 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 4820 | * @param[in] *pTapDelay points to the array of offset times. |
priyank12p | 0:b0c4c25d37ab | 4821 | * @param[in] maxDelay maximum offset time supported. |
priyank12p | 0:b0c4c25d37ab | 4822 | * @param[in] blockSize number of samples that will be processed per block. |
priyank12p | 0:b0c4c25d37ab | 4823 | * @return none |
priyank12p | 0:b0c4c25d37ab | 4824 | */ |
priyank12p | 0:b0c4c25d37ab | 4825 | |
priyank12p | 0:b0c4c25d37ab | 4826 | void arm_fir_sparse_init_q31( |
priyank12p | 0:b0c4c25d37ab | 4827 | arm_fir_sparse_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 4828 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4829 | q31_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4830 | q31_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4831 | int32_t * pTapDelay, |
priyank12p | 0:b0c4c25d37ab | 4832 | uint16_t maxDelay, |
priyank12p | 0:b0c4c25d37ab | 4833 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4834 | |
priyank12p | 0:b0c4c25d37ab | 4835 | /** |
priyank12p | 0:b0c4c25d37ab | 4836 | * @brief Processing function for the Q15 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4837 | * @param[in] *S points to an instance of the Q15 sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4838 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4839 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 4840 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
priyank12p | 0:b0c4c25d37ab | 4841 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
priyank12p | 0:b0c4c25d37ab | 4842 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 4843 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4844 | */ |
priyank12p | 0:b0c4c25d37ab | 4845 | |
priyank12p | 0:b0c4c25d37ab | 4846 | void arm_fir_sparse_q15( |
priyank12p | 0:b0c4c25d37ab | 4847 | arm_fir_sparse_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4848 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4849 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4850 | q15_t * pScratchIn, |
priyank12p | 0:b0c4c25d37ab | 4851 | q31_t * pScratchOut, |
priyank12p | 0:b0c4c25d37ab | 4852 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4853 | |
priyank12p | 0:b0c4c25d37ab | 4854 | |
priyank12p | 0:b0c4c25d37ab | 4855 | /** |
priyank12p | 0:b0c4c25d37ab | 4856 | * @brief Initialization function for the Q15 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4857 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4858 | * @param[in] numTaps number of nonzero coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 4859 | * @param[in] *pCoeffs points to the array of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4860 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 4861 | * @param[in] *pTapDelay points to the array of offset times. |
priyank12p | 0:b0c4c25d37ab | 4862 | * @param[in] maxDelay maximum offset time supported. |
priyank12p | 0:b0c4c25d37ab | 4863 | * @param[in] blockSize number of samples that will be processed per block. |
priyank12p | 0:b0c4c25d37ab | 4864 | * @return none |
priyank12p | 0:b0c4c25d37ab | 4865 | */ |
priyank12p | 0:b0c4c25d37ab | 4866 | |
priyank12p | 0:b0c4c25d37ab | 4867 | void arm_fir_sparse_init_q15( |
priyank12p | 0:b0c4c25d37ab | 4868 | arm_fir_sparse_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 4869 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4870 | q15_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4871 | q15_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4872 | int32_t * pTapDelay, |
priyank12p | 0:b0c4c25d37ab | 4873 | uint16_t maxDelay, |
priyank12p | 0:b0c4c25d37ab | 4874 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4875 | |
priyank12p | 0:b0c4c25d37ab | 4876 | /** |
priyank12p | 0:b0c4c25d37ab | 4877 | * @brief Processing function for the Q7 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4878 | * @param[in] *S points to an instance of the Q7 sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4879 | * @param[in] *pSrc points to the block of input data. |
priyank12p | 0:b0c4c25d37ab | 4880 | * @param[out] *pDst points to the block of output data |
priyank12p | 0:b0c4c25d37ab | 4881 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
priyank12p | 0:b0c4c25d37ab | 4882 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
priyank12p | 0:b0c4c25d37ab | 4883 | * @param[in] blockSize number of input samples to process per call. |
priyank12p | 0:b0c4c25d37ab | 4884 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4885 | */ |
priyank12p | 0:b0c4c25d37ab | 4886 | |
priyank12p | 0:b0c4c25d37ab | 4887 | void arm_fir_sparse_q7( |
priyank12p | 0:b0c4c25d37ab | 4888 | arm_fir_sparse_instance_q7 * S, |
priyank12p | 0:b0c4c25d37ab | 4889 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4890 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4891 | q7_t * pScratchIn, |
priyank12p | 0:b0c4c25d37ab | 4892 | q31_t * pScratchOut, |
priyank12p | 0:b0c4c25d37ab | 4893 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4894 | |
priyank12p | 0:b0c4c25d37ab | 4895 | /** |
priyank12p | 0:b0c4c25d37ab | 4896 | * @brief Initialization function for the Q7 sparse FIR filter. |
priyank12p | 0:b0c4c25d37ab | 4897 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. |
priyank12p | 0:b0c4c25d37ab | 4898 | * @param[in] numTaps number of nonzero coefficients in the filter. |
priyank12p | 0:b0c4c25d37ab | 4899 | * @param[in] *pCoeffs points to the array of filter coefficients. |
priyank12p | 0:b0c4c25d37ab | 4900 | * @param[in] *pState points to the state buffer. |
priyank12p | 0:b0c4c25d37ab | 4901 | * @param[in] *pTapDelay points to the array of offset times. |
priyank12p | 0:b0c4c25d37ab | 4902 | * @param[in] maxDelay maximum offset time supported. |
priyank12p | 0:b0c4c25d37ab | 4903 | * @param[in] blockSize number of samples that will be processed per block. |
priyank12p | 0:b0c4c25d37ab | 4904 | * @return none |
priyank12p | 0:b0c4c25d37ab | 4905 | */ |
priyank12p | 0:b0c4c25d37ab | 4906 | |
priyank12p | 0:b0c4c25d37ab | 4907 | void arm_fir_sparse_init_q7( |
priyank12p | 0:b0c4c25d37ab | 4908 | arm_fir_sparse_instance_q7 * S, |
priyank12p | 0:b0c4c25d37ab | 4909 | uint16_t numTaps, |
priyank12p | 0:b0c4c25d37ab | 4910 | q7_t * pCoeffs, |
priyank12p | 0:b0c4c25d37ab | 4911 | q7_t * pState, |
priyank12p | 0:b0c4c25d37ab | 4912 | int32_t * pTapDelay, |
priyank12p | 0:b0c4c25d37ab | 4913 | uint16_t maxDelay, |
priyank12p | 0:b0c4c25d37ab | 4914 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 4915 | |
priyank12p | 0:b0c4c25d37ab | 4916 | |
priyank12p | 0:b0c4c25d37ab | 4917 | /* |
priyank12p | 0:b0c4c25d37ab | 4918 | * @brief Floating-point sin_cos function. |
priyank12p | 0:b0c4c25d37ab | 4919 | * @param[in] theta input value in degrees |
priyank12p | 0:b0c4c25d37ab | 4920 | * @param[out] *pSinVal points to the processed sine output. |
priyank12p | 0:b0c4c25d37ab | 4921 | * @param[out] *pCosVal points to the processed cos output. |
priyank12p | 0:b0c4c25d37ab | 4922 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4923 | */ |
priyank12p | 0:b0c4c25d37ab | 4924 | |
priyank12p | 0:b0c4c25d37ab | 4925 | void arm_sin_cos_f32( |
priyank12p | 0:b0c4c25d37ab | 4926 | float32_t theta, |
priyank12p | 0:b0c4c25d37ab | 4927 | float32_t * pSinVal, |
priyank12p | 0:b0c4c25d37ab | 4928 | float32_t * pCcosVal); |
priyank12p | 0:b0c4c25d37ab | 4929 | |
priyank12p | 0:b0c4c25d37ab | 4930 | /* |
priyank12p | 0:b0c4c25d37ab | 4931 | * @brief Q31 sin_cos function. |
priyank12p | 0:b0c4c25d37ab | 4932 | * @param[in] theta scaled input value in degrees |
priyank12p | 0:b0c4c25d37ab | 4933 | * @param[out] *pSinVal points to the processed sine output. |
priyank12p | 0:b0c4c25d37ab | 4934 | * @param[out] *pCosVal points to the processed cosine output. |
priyank12p | 0:b0c4c25d37ab | 4935 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4936 | */ |
priyank12p | 0:b0c4c25d37ab | 4937 | |
priyank12p | 0:b0c4c25d37ab | 4938 | void arm_sin_cos_q31( |
priyank12p | 0:b0c4c25d37ab | 4939 | q31_t theta, |
priyank12p | 0:b0c4c25d37ab | 4940 | q31_t * pSinVal, |
priyank12p | 0:b0c4c25d37ab | 4941 | q31_t * pCosVal); |
priyank12p | 0:b0c4c25d37ab | 4942 | |
priyank12p | 0:b0c4c25d37ab | 4943 | |
priyank12p | 0:b0c4c25d37ab | 4944 | /** |
priyank12p | 0:b0c4c25d37ab | 4945 | * @brief Floating-point complex conjugate. |
priyank12p | 0:b0c4c25d37ab | 4946 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 4947 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 4948 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 4949 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4950 | */ |
priyank12p | 0:b0c4c25d37ab | 4951 | |
priyank12p | 0:b0c4c25d37ab | 4952 | void arm_cmplx_conj_f32( |
priyank12p | 0:b0c4c25d37ab | 4953 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4954 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4955 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 4956 | |
priyank12p | 0:b0c4c25d37ab | 4957 | /** |
priyank12p | 0:b0c4c25d37ab | 4958 | * @brief Q31 complex conjugate. |
priyank12p | 0:b0c4c25d37ab | 4959 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 4960 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 4961 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 4962 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4963 | */ |
priyank12p | 0:b0c4c25d37ab | 4964 | |
priyank12p | 0:b0c4c25d37ab | 4965 | void arm_cmplx_conj_q31( |
priyank12p | 0:b0c4c25d37ab | 4966 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4967 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4968 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 4969 | |
priyank12p | 0:b0c4c25d37ab | 4970 | /** |
priyank12p | 0:b0c4c25d37ab | 4971 | * @brief Q15 complex conjugate. |
priyank12p | 0:b0c4c25d37ab | 4972 | * @param[in] *pSrc points to the input vector |
priyank12p | 0:b0c4c25d37ab | 4973 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 4974 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 4975 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4976 | */ |
priyank12p | 0:b0c4c25d37ab | 4977 | |
priyank12p | 0:b0c4c25d37ab | 4978 | void arm_cmplx_conj_q15( |
priyank12p | 0:b0c4c25d37ab | 4979 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4980 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4981 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 4982 | |
priyank12p | 0:b0c4c25d37ab | 4983 | |
priyank12p | 0:b0c4c25d37ab | 4984 | |
priyank12p | 0:b0c4c25d37ab | 4985 | /** |
priyank12p | 0:b0c4c25d37ab | 4986 | * @brief Floating-point complex magnitude squared |
priyank12p | 0:b0c4c25d37ab | 4987 | * @param[in] *pSrc points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 4988 | * @param[out] *pDst points to the real output vector |
priyank12p | 0:b0c4c25d37ab | 4989 | * @param[in] numSamples number of complex samples in the input vector |
priyank12p | 0:b0c4c25d37ab | 4990 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 4991 | */ |
priyank12p | 0:b0c4c25d37ab | 4992 | |
priyank12p | 0:b0c4c25d37ab | 4993 | void arm_cmplx_mag_squared_f32( |
priyank12p | 0:b0c4c25d37ab | 4994 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 4995 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 4996 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 4997 | |
priyank12p | 0:b0c4c25d37ab | 4998 | /** |
priyank12p | 0:b0c4c25d37ab | 4999 | * @brief Q31 complex magnitude squared |
priyank12p | 0:b0c4c25d37ab | 5000 | * @param[in] *pSrc points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 5001 | * @param[out] *pDst points to the real output vector |
priyank12p | 0:b0c4c25d37ab | 5002 | * @param[in] numSamples number of complex samples in the input vector |
priyank12p | 0:b0c4c25d37ab | 5003 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5004 | */ |
priyank12p | 0:b0c4c25d37ab | 5005 | |
priyank12p | 0:b0c4c25d37ab | 5006 | void arm_cmplx_mag_squared_q31( |
priyank12p | 0:b0c4c25d37ab | 5007 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 5008 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 5009 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 5010 | |
priyank12p | 0:b0c4c25d37ab | 5011 | /** |
priyank12p | 0:b0c4c25d37ab | 5012 | * @brief Q15 complex magnitude squared |
priyank12p | 0:b0c4c25d37ab | 5013 | * @param[in] *pSrc points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 5014 | * @param[out] *pDst points to the real output vector |
priyank12p | 0:b0c4c25d37ab | 5015 | * @param[in] numSamples number of complex samples in the input vector |
priyank12p | 0:b0c4c25d37ab | 5016 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5017 | */ |
priyank12p | 0:b0c4c25d37ab | 5018 | |
priyank12p | 0:b0c4c25d37ab | 5019 | void arm_cmplx_mag_squared_q15( |
priyank12p | 0:b0c4c25d37ab | 5020 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 5021 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 5022 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 5023 | |
priyank12p | 0:b0c4c25d37ab | 5024 | |
priyank12p | 0:b0c4c25d37ab | 5025 | /** |
priyank12p | 0:b0c4c25d37ab | 5026 | * @ingroup groupController |
priyank12p | 0:b0c4c25d37ab | 5027 | */ |
priyank12p | 0:b0c4c25d37ab | 5028 | |
priyank12p | 0:b0c4c25d37ab | 5029 | /** |
priyank12p | 0:b0c4c25d37ab | 5030 | * @defgroup PID PID Motor Control |
priyank12p | 0:b0c4c25d37ab | 5031 | * |
priyank12p | 0:b0c4c25d37ab | 5032 | * A Proportional Integral Derivative (PID) controller is a generic feedback control |
priyank12p | 0:b0c4c25d37ab | 5033 | * loop mechanism widely used in industrial control systems. |
priyank12p | 0:b0c4c25d37ab | 5034 | * A PID controller is the most commonly used type of feedback controller. |
priyank12p | 0:b0c4c25d37ab | 5035 | * |
priyank12p | 0:b0c4c25d37ab | 5036 | * This set of functions implements (PID) controllers |
priyank12p | 0:b0c4c25d37ab | 5037 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample |
priyank12p | 0:b0c4c25d37ab | 5038 | * of data and each call to the function returns a single processed value. |
priyank12p | 0:b0c4c25d37ab | 5039 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code> |
priyank12p | 0:b0c4c25d37ab | 5040 | * is the input sample value. The functions return the output value. |
priyank12p | 0:b0c4c25d37ab | 5041 | * |
priyank12p | 0:b0c4c25d37ab | 5042 | * \par Algorithm: |
priyank12p | 0:b0c4c25d37ab | 5043 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 5044 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] |
priyank12p | 0:b0c4c25d37ab | 5045 | * A0 = Kp + Ki + Kd |
priyank12p | 0:b0c4c25d37ab | 5046 | * A1 = (-Kp ) - (2 * Kd ) |
priyank12p | 0:b0c4c25d37ab | 5047 | * A2 = Kd </pre> |
priyank12p | 0:b0c4c25d37ab | 5048 | * |
priyank12p | 0:b0c4c25d37ab | 5049 | * \par |
priyank12p | 0:b0c4c25d37ab | 5050 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant |
priyank12p | 0:b0c4c25d37ab | 5051 | * |
priyank12p | 0:b0c4c25d37ab | 5052 | * \par |
priyank12p | 0:b0c4c25d37ab | 5053 | * \image html PID.gif "Proportional Integral Derivative Controller" |
priyank12p | 0:b0c4c25d37ab | 5054 | * |
priyank12p | 0:b0c4c25d37ab | 5055 | * \par |
priyank12p | 0:b0c4c25d37ab | 5056 | * The PID controller calculates an "error" value as the difference between |
priyank12p | 0:b0c4c25d37ab | 5057 | * the measured output and the reference input. |
priyank12p | 0:b0c4c25d37ab | 5058 | * The controller attempts to minimize the error by adjusting the process control inputs. |
priyank12p | 0:b0c4c25d37ab | 5059 | * The proportional value determines the reaction to the current error, |
priyank12p | 0:b0c4c25d37ab | 5060 | * the integral value determines the reaction based on the sum of recent errors, |
priyank12p | 0:b0c4c25d37ab | 5061 | * and the derivative value determines the reaction based on the rate at which the error has been changing. |
priyank12p | 0:b0c4c25d37ab | 5062 | * |
priyank12p | 0:b0c4c25d37ab | 5063 | * \par Instance Structure |
priyank12p | 0:b0c4c25d37ab | 5064 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. |
priyank12p | 0:b0c4c25d37ab | 5065 | * A separate instance structure must be defined for each PID Controller. |
priyank12p | 0:b0c4c25d37ab | 5066 | * There are separate instance structure declarations for each of the 3 supported data types. |
priyank12p | 0:b0c4c25d37ab | 5067 | * |
priyank12p | 0:b0c4c25d37ab | 5068 | * \par Reset Functions |
priyank12p | 0:b0c4c25d37ab | 5069 | * There is also an associated reset function for each data type which clears the state array. |
priyank12p | 0:b0c4c25d37ab | 5070 | * |
priyank12p | 0:b0c4c25d37ab | 5071 | * \par Initialization Functions |
priyank12p | 0:b0c4c25d37ab | 5072 | * There is also an associated initialization function for each data type. |
priyank12p | 0:b0c4c25d37ab | 5073 | * The initialization function performs the following operations: |
priyank12p | 0:b0c4c25d37ab | 5074 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. |
priyank12p | 0:b0c4c25d37ab | 5075 | * - Zeros out the values in the state buffer. |
priyank12p | 0:b0c4c25d37ab | 5076 | * |
priyank12p | 0:b0c4c25d37ab | 5077 | * \par |
priyank12p | 0:b0c4c25d37ab | 5078 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. |
priyank12p | 0:b0c4c25d37ab | 5079 | * |
priyank12p | 0:b0c4c25d37ab | 5080 | * \par Fixed-Point Behavior |
priyank12p | 0:b0c4c25d37ab | 5081 | * Care must be taken when using the fixed-point versions of the PID Controller functions. |
priyank12p | 0:b0c4c25d37ab | 5082 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. |
priyank12p | 0:b0c4c25d37ab | 5083 | * Refer to the function specific documentation below for usage guidelines. |
priyank12p | 0:b0c4c25d37ab | 5084 | */ |
priyank12p | 0:b0c4c25d37ab | 5085 | |
priyank12p | 0:b0c4c25d37ab | 5086 | /** |
priyank12p | 0:b0c4c25d37ab | 5087 | * @addtogroup PID |
priyank12p | 0:b0c4c25d37ab | 5088 | * @{ |
priyank12p | 0:b0c4c25d37ab | 5089 | */ |
priyank12p | 0:b0c4c25d37ab | 5090 | |
priyank12p | 0:b0c4c25d37ab | 5091 | /** |
priyank12p | 0:b0c4c25d37ab | 5092 | * @brief Process function for the floating-point PID Control. |
priyank12p | 0:b0c4c25d37ab | 5093 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
priyank12p | 0:b0c4c25d37ab | 5094 | * @param[in] in input sample to process |
priyank12p | 0:b0c4c25d37ab | 5095 | * @return out processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5096 | */ |
priyank12p | 0:b0c4c25d37ab | 5097 | |
priyank12p | 0:b0c4c25d37ab | 5098 | |
priyank12p | 0:b0c4c25d37ab | 5099 | static __INLINE float32_t arm_pid_f32( |
priyank12p | 0:b0c4c25d37ab | 5100 | arm_pid_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 5101 | float32_t in) |
priyank12p | 0:b0c4c25d37ab | 5102 | { |
priyank12p | 0:b0c4c25d37ab | 5103 | float32_t out; |
priyank12p | 0:b0c4c25d37ab | 5104 | |
priyank12p | 0:b0c4c25d37ab | 5105 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ |
priyank12p | 0:b0c4c25d37ab | 5106 | out = (S->A0 * in) + |
priyank12p | 0:b0c4c25d37ab | 5107 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); |
priyank12p | 0:b0c4c25d37ab | 5108 | |
priyank12p | 0:b0c4c25d37ab | 5109 | /* Update state */ |
priyank12p | 0:b0c4c25d37ab | 5110 | S->state[1] = S->state[0]; |
priyank12p | 0:b0c4c25d37ab | 5111 | S->state[0] = in; |
priyank12p | 0:b0c4c25d37ab | 5112 | S->state[2] = out; |
priyank12p | 0:b0c4c25d37ab | 5113 | |
priyank12p | 0:b0c4c25d37ab | 5114 | /* return to application */ |
priyank12p | 0:b0c4c25d37ab | 5115 | return (out); |
priyank12p | 0:b0c4c25d37ab | 5116 | |
priyank12p | 0:b0c4c25d37ab | 5117 | } |
priyank12p | 0:b0c4c25d37ab | 5118 | |
priyank12p | 0:b0c4c25d37ab | 5119 | /** |
priyank12p | 0:b0c4c25d37ab | 5120 | * @brief Process function for the Q31 PID Control. |
priyank12p | 0:b0c4c25d37ab | 5121 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
priyank12p | 0:b0c4c25d37ab | 5122 | * @param[in] in input sample to process |
priyank12p | 0:b0c4c25d37ab | 5123 | * @return out processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5124 | * |
priyank12p | 0:b0c4c25d37ab | 5125 | * <b>Scaling and Overflow Behavior:</b> |
priyank12p | 0:b0c4c25d37ab | 5126 | * \par |
priyank12p | 0:b0c4c25d37ab | 5127 | * The function is implemented using an internal 64-bit accumulator. |
priyank12p | 0:b0c4c25d37ab | 5128 | * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. |
priyank12p | 0:b0c4c25d37ab | 5129 | * Thus, if the accumulator result overflows it wraps around rather than clip. |
priyank12p | 0:b0c4c25d37ab | 5130 | * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. |
priyank12p | 0:b0c4c25d37ab | 5131 | * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. |
priyank12p | 0:b0c4c25d37ab | 5132 | */ |
priyank12p | 0:b0c4c25d37ab | 5133 | |
priyank12p | 0:b0c4c25d37ab | 5134 | static __INLINE q31_t arm_pid_q31( |
priyank12p | 0:b0c4c25d37ab | 5135 | arm_pid_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 5136 | q31_t in) |
priyank12p | 0:b0c4c25d37ab | 5137 | { |
priyank12p | 0:b0c4c25d37ab | 5138 | q63_t acc; |
priyank12p | 0:b0c4c25d37ab | 5139 | q31_t out; |
priyank12p | 0:b0c4c25d37ab | 5140 | |
priyank12p | 0:b0c4c25d37ab | 5141 | /* acc = A0 * x[n] */ |
priyank12p | 0:b0c4c25d37ab | 5142 | acc = (q63_t) S->A0 * in; |
priyank12p | 0:b0c4c25d37ab | 5143 | |
priyank12p | 0:b0c4c25d37ab | 5144 | /* acc += A1 * x[n-1] */ |
priyank12p | 0:b0c4c25d37ab | 5145 | acc += (q63_t) S->A1 * S->state[0]; |
priyank12p | 0:b0c4c25d37ab | 5146 | |
priyank12p | 0:b0c4c25d37ab | 5147 | /* acc += A2 * x[n-2] */ |
priyank12p | 0:b0c4c25d37ab | 5148 | acc += (q63_t) S->A2 * S->state[1]; |
priyank12p | 0:b0c4c25d37ab | 5149 | |
priyank12p | 0:b0c4c25d37ab | 5150 | /* convert output to 1.31 format to add y[n-1] */ |
priyank12p | 0:b0c4c25d37ab | 5151 | out = (q31_t) (acc >> 31u); |
priyank12p | 0:b0c4c25d37ab | 5152 | |
priyank12p | 0:b0c4c25d37ab | 5153 | /* out += y[n-1] */ |
priyank12p | 0:b0c4c25d37ab | 5154 | out += S->state[2]; |
priyank12p | 0:b0c4c25d37ab | 5155 | |
priyank12p | 0:b0c4c25d37ab | 5156 | /* Update state */ |
priyank12p | 0:b0c4c25d37ab | 5157 | S->state[1] = S->state[0]; |
priyank12p | 0:b0c4c25d37ab | 5158 | S->state[0] = in; |
priyank12p | 0:b0c4c25d37ab | 5159 | S->state[2] = out; |
priyank12p | 0:b0c4c25d37ab | 5160 | |
priyank12p | 0:b0c4c25d37ab | 5161 | /* return to application */ |
priyank12p | 0:b0c4c25d37ab | 5162 | return (out); |
priyank12p | 0:b0c4c25d37ab | 5163 | |
priyank12p | 0:b0c4c25d37ab | 5164 | } |
priyank12p | 0:b0c4c25d37ab | 5165 | |
priyank12p | 0:b0c4c25d37ab | 5166 | /** |
priyank12p | 0:b0c4c25d37ab | 5167 | * @brief Process function for the Q15 PID Control. |
priyank12p | 0:b0c4c25d37ab | 5168 | * @param[in,out] *S points to an instance of the Q15 PID Control structure |
priyank12p | 0:b0c4c25d37ab | 5169 | * @param[in] in input sample to process |
priyank12p | 0:b0c4c25d37ab | 5170 | * @return out processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5171 | * |
priyank12p | 0:b0c4c25d37ab | 5172 | * <b>Scaling and Overflow Behavior:</b> |
priyank12p | 0:b0c4c25d37ab | 5173 | * \par |
priyank12p | 0:b0c4c25d37ab | 5174 | * The function is implemented using a 64-bit internal accumulator. |
priyank12p | 0:b0c4c25d37ab | 5175 | * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. |
priyank12p | 0:b0c4c25d37ab | 5176 | * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. |
priyank12p | 0:b0c4c25d37ab | 5177 | * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. |
priyank12p | 0:b0c4c25d37ab | 5178 | * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. |
priyank12p | 0:b0c4c25d37ab | 5179 | * Lastly, the accumulator is saturated to yield a result in 1.15 format. |
priyank12p | 0:b0c4c25d37ab | 5180 | */ |
priyank12p | 0:b0c4c25d37ab | 5181 | |
priyank12p | 0:b0c4c25d37ab | 5182 | static __INLINE q15_t arm_pid_q15( |
priyank12p | 0:b0c4c25d37ab | 5183 | arm_pid_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 5184 | q15_t in) |
priyank12p | 0:b0c4c25d37ab | 5185 | { |
priyank12p | 0:b0c4c25d37ab | 5186 | q63_t acc; |
priyank12p | 0:b0c4c25d37ab | 5187 | q15_t out; |
priyank12p | 0:b0c4c25d37ab | 5188 | |
priyank12p | 0:b0c4c25d37ab | 5189 | #ifndef ARM_MATH_CM0_FAMILY |
priyank12p | 0:b0c4c25d37ab | 5190 | __SIMD32_TYPE *vstate; |
priyank12p | 0:b0c4c25d37ab | 5191 | |
priyank12p | 0:b0c4c25d37ab | 5192 | /* Implementation of PID controller */ |
priyank12p | 0:b0c4c25d37ab | 5193 | |
priyank12p | 0:b0c4c25d37ab | 5194 | /* acc = A0 * x[n] */ |
priyank12p | 0:b0c4c25d37ab | 5195 | acc = (q31_t) __SMUAD(S->A0, in); |
priyank12p | 0:b0c4c25d37ab | 5196 | |
priyank12p | 0:b0c4c25d37ab | 5197 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
priyank12p | 0:b0c4c25d37ab | 5198 | vstate = __SIMD32_CONST(S->state); |
priyank12p | 0:b0c4c25d37ab | 5199 | acc = __SMLALD(S->A1, (q31_t) *vstate, acc); |
priyank12p | 0:b0c4c25d37ab | 5200 | |
priyank12p | 0:b0c4c25d37ab | 5201 | #else |
priyank12p | 0:b0c4c25d37ab | 5202 | /* acc = A0 * x[n] */ |
priyank12p | 0:b0c4c25d37ab | 5203 | acc = ((q31_t) S->A0) * in; |
priyank12p | 0:b0c4c25d37ab | 5204 | |
priyank12p | 0:b0c4c25d37ab | 5205 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
priyank12p | 0:b0c4c25d37ab | 5206 | acc += (q31_t) S->A1 * S->state[0]; |
priyank12p | 0:b0c4c25d37ab | 5207 | acc += (q31_t) S->A2 * S->state[1]; |
priyank12p | 0:b0c4c25d37ab | 5208 | |
priyank12p | 0:b0c4c25d37ab | 5209 | #endif |
priyank12p | 0:b0c4c25d37ab | 5210 | |
priyank12p | 0:b0c4c25d37ab | 5211 | /* acc += y[n-1] */ |
priyank12p | 0:b0c4c25d37ab | 5212 | acc += (q31_t) S->state[2] << 15; |
priyank12p | 0:b0c4c25d37ab | 5213 | |
priyank12p | 0:b0c4c25d37ab | 5214 | /* saturate the output */ |
priyank12p | 0:b0c4c25d37ab | 5215 | out = (q15_t) (__SSAT((acc >> 15), 16)); |
priyank12p | 0:b0c4c25d37ab | 5216 | |
priyank12p | 0:b0c4c25d37ab | 5217 | /* Update state */ |
priyank12p | 0:b0c4c25d37ab | 5218 | S->state[1] = S->state[0]; |
priyank12p | 0:b0c4c25d37ab | 5219 | S->state[0] = in; |
priyank12p | 0:b0c4c25d37ab | 5220 | S->state[2] = out; |
priyank12p | 0:b0c4c25d37ab | 5221 | |
priyank12p | 0:b0c4c25d37ab | 5222 | /* return to application */ |
priyank12p | 0:b0c4c25d37ab | 5223 | return (out); |
priyank12p | 0:b0c4c25d37ab | 5224 | |
priyank12p | 0:b0c4c25d37ab | 5225 | } |
priyank12p | 0:b0c4c25d37ab | 5226 | |
priyank12p | 0:b0c4c25d37ab | 5227 | /** |
priyank12p | 0:b0c4c25d37ab | 5228 | * @} end of PID group |
priyank12p | 0:b0c4c25d37ab | 5229 | */ |
priyank12p | 0:b0c4c25d37ab | 5230 | |
priyank12p | 0:b0c4c25d37ab | 5231 | |
priyank12p | 0:b0c4c25d37ab | 5232 | /** |
priyank12p | 0:b0c4c25d37ab | 5233 | * @brief Floating-point matrix inverse. |
priyank12p | 0:b0c4c25d37ab | 5234 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 5235 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 5236 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
priyank12p | 0:b0c4c25d37ab | 5237 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
priyank12p | 0:b0c4c25d37ab | 5238 | */ |
priyank12p | 0:b0c4c25d37ab | 5239 | |
priyank12p | 0:b0c4c25d37ab | 5240 | arm_status arm_mat_inverse_f32( |
priyank12p | 0:b0c4c25d37ab | 5241 | const arm_matrix_instance_f32 * src, |
priyank12p | 0:b0c4c25d37ab | 5242 | arm_matrix_instance_f32 * dst); |
priyank12p | 0:b0c4c25d37ab | 5243 | |
priyank12p | 0:b0c4c25d37ab | 5244 | |
priyank12p | 0:b0c4c25d37ab | 5245 | /** |
priyank12p | 0:b0c4c25d37ab | 5246 | * @brief Floating-point matrix inverse. |
priyank12p | 0:b0c4c25d37ab | 5247 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 5248 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
priyank12p | 0:b0c4c25d37ab | 5249 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
priyank12p | 0:b0c4c25d37ab | 5250 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
priyank12p | 0:b0c4c25d37ab | 5251 | */ |
priyank12p | 0:b0c4c25d37ab | 5252 | |
priyank12p | 0:b0c4c25d37ab | 5253 | arm_status arm_mat_inverse_f64( |
priyank12p | 0:b0c4c25d37ab | 5254 | const arm_matrix_instance_f64 * src, |
priyank12p | 0:b0c4c25d37ab | 5255 | arm_matrix_instance_f64 * dst); |
priyank12p | 0:b0c4c25d37ab | 5256 | |
priyank12p | 0:b0c4c25d37ab | 5257 | |
priyank12p | 0:b0c4c25d37ab | 5258 | |
priyank12p | 0:b0c4c25d37ab | 5259 | /** |
priyank12p | 0:b0c4c25d37ab | 5260 | * @ingroup groupController |
priyank12p | 0:b0c4c25d37ab | 5261 | */ |
priyank12p | 0:b0c4c25d37ab | 5262 | |
priyank12p | 0:b0c4c25d37ab | 5263 | |
priyank12p | 0:b0c4c25d37ab | 5264 | /** |
priyank12p | 0:b0c4c25d37ab | 5265 | * @defgroup clarke Vector Clarke Transform |
priyank12p | 0:b0c4c25d37ab | 5266 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. |
priyank12p | 0:b0c4c25d37ab | 5267 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents |
priyank12p | 0:b0c4c25d37ab | 5268 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>. |
priyank12p | 0:b0c4c25d37ab | 5269 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below |
priyank12p | 0:b0c4c25d37ab | 5270 | * \image html clarke.gif Stator current space vector and its components in (a,b). |
priyank12p | 0:b0c4c25d37ab | 5271 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code> |
priyank12p | 0:b0c4c25d37ab | 5272 | * can be calculated using only <code>Ia</code> and <code>Ib</code>. |
priyank12p | 0:b0c4c25d37ab | 5273 | * |
priyank12p | 0:b0c4c25d37ab | 5274 | * The function operates on a single sample of data and each call to the function returns the processed output. |
priyank12p | 0:b0c4c25d37ab | 5275 | * The library provides separate functions for Q31 and floating-point data types. |
priyank12p | 0:b0c4c25d37ab | 5276 | * \par Algorithm |
priyank12p | 0:b0c4c25d37ab | 5277 | * \image html clarkeFormula.gif |
priyank12p | 0:b0c4c25d37ab | 5278 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and |
priyank12p | 0:b0c4c25d37ab | 5279 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector. |
priyank12p | 0:b0c4c25d37ab | 5280 | * \par Fixed-Point Behavior |
priyank12p | 0:b0c4c25d37ab | 5281 | * Care must be taken when using the Q31 version of the Clarke transform. |
priyank12p | 0:b0c4c25d37ab | 5282 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
priyank12p | 0:b0c4c25d37ab | 5283 | * Refer to the function specific documentation below for usage guidelines. |
priyank12p | 0:b0c4c25d37ab | 5284 | */ |
priyank12p | 0:b0c4c25d37ab | 5285 | |
priyank12p | 0:b0c4c25d37ab | 5286 | /** |
priyank12p | 0:b0c4c25d37ab | 5287 | * @addtogroup clarke |
priyank12p | 0:b0c4c25d37ab | 5288 | * @{ |
priyank12p | 0:b0c4c25d37ab | 5289 | */ |
priyank12p | 0:b0c4c25d37ab | 5290 | |
priyank12p | 0:b0c4c25d37ab | 5291 | /** |
priyank12p | 0:b0c4c25d37ab | 5292 | * |
priyank12p | 0:b0c4c25d37ab | 5293 | * @brief Floating-point Clarke transform |
priyank12p | 0:b0c4c25d37ab | 5294 | * @param[in] Ia input three-phase coordinate <code>a</code> |
priyank12p | 0:b0c4c25d37ab | 5295 | * @param[in] Ib input three-phase coordinate <code>b</code> |
priyank12p | 0:b0c4c25d37ab | 5296 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
priyank12p | 0:b0c4c25d37ab | 5297 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
priyank12p | 0:b0c4c25d37ab | 5298 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5299 | */ |
priyank12p | 0:b0c4c25d37ab | 5300 | |
priyank12p | 0:b0c4c25d37ab | 5301 | static __INLINE void arm_clarke_f32( |
priyank12p | 0:b0c4c25d37ab | 5302 | float32_t Ia, |
priyank12p | 0:b0c4c25d37ab | 5303 | float32_t Ib, |
priyank12p | 0:b0c4c25d37ab | 5304 | float32_t * pIalpha, |
priyank12p | 0:b0c4c25d37ab | 5305 | float32_t * pIbeta) |
priyank12p | 0:b0c4c25d37ab | 5306 | { |
priyank12p | 0:b0c4c25d37ab | 5307 | /* Calculate pIalpha using the equation, pIalpha = Ia */ |
priyank12p | 0:b0c4c25d37ab | 5308 | *pIalpha = Ia; |
priyank12p | 0:b0c4c25d37ab | 5309 | |
priyank12p | 0:b0c4c25d37ab | 5310 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ |
priyank12p | 0:b0c4c25d37ab | 5311 | *pIbeta = |
priyank12p | 0:b0c4c25d37ab | 5312 | ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); |
priyank12p | 0:b0c4c25d37ab | 5313 | |
priyank12p | 0:b0c4c25d37ab | 5314 | } |
priyank12p | 0:b0c4c25d37ab | 5315 | |
priyank12p | 0:b0c4c25d37ab | 5316 | /** |
priyank12p | 0:b0c4c25d37ab | 5317 | * @brief Clarke transform for Q31 version |
priyank12p | 0:b0c4c25d37ab | 5318 | * @param[in] Ia input three-phase coordinate <code>a</code> |
priyank12p | 0:b0c4c25d37ab | 5319 | * @param[in] Ib input three-phase coordinate <code>b</code> |
priyank12p | 0:b0c4c25d37ab | 5320 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
priyank12p | 0:b0c4c25d37ab | 5321 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
priyank12p | 0:b0c4c25d37ab | 5322 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5323 | * |
priyank12p | 0:b0c4c25d37ab | 5324 | * <b>Scaling and Overflow Behavior:</b> |
priyank12p | 0:b0c4c25d37ab | 5325 | * \par |
priyank12p | 0:b0c4c25d37ab | 5326 | * The function is implemented using an internal 32-bit accumulator. |
priyank12p | 0:b0c4c25d37ab | 5327 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
priyank12p | 0:b0c4c25d37ab | 5328 | * There is saturation on the addition, hence there is no risk of overflow. |
priyank12p | 0:b0c4c25d37ab | 5329 | */ |
priyank12p | 0:b0c4c25d37ab | 5330 | |
priyank12p | 0:b0c4c25d37ab | 5331 | static __INLINE void arm_clarke_q31( |
priyank12p | 0:b0c4c25d37ab | 5332 | q31_t Ia, |
priyank12p | 0:b0c4c25d37ab | 5333 | q31_t Ib, |
priyank12p | 0:b0c4c25d37ab | 5334 | q31_t * pIalpha, |
priyank12p | 0:b0c4c25d37ab | 5335 | q31_t * pIbeta) |
priyank12p | 0:b0c4c25d37ab | 5336 | { |
priyank12p | 0:b0c4c25d37ab | 5337 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
priyank12p | 0:b0c4c25d37ab | 5338 | |
priyank12p | 0:b0c4c25d37ab | 5339 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */ |
priyank12p | 0:b0c4c25d37ab | 5340 | *pIalpha = Ia; |
priyank12p | 0:b0c4c25d37ab | 5341 | |
priyank12p | 0:b0c4c25d37ab | 5342 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ |
priyank12p | 0:b0c4c25d37ab | 5343 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); |
priyank12p | 0:b0c4c25d37ab | 5344 | |
priyank12p | 0:b0c4c25d37ab | 5345 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ |
priyank12p | 0:b0c4c25d37ab | 5346 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); |
priyank12p | 0:b0c4c25d37ab | 5347 | |
priyank12p | 0:b0c4c25d37ab | 5348 | /* pIbeta is calculated by adding the intermediate products */ |
priyank12p | 0:b0c4c25d37ab | 5349 | *pIbeta = __QADD(product1, product2); |
priyank12p | 0:b0c4c25d37ab | 5350 | } |
priyank12p | 0:b0c4c25d37ab | 5351 | |
priyank12p | 0:b0c4c25d37ab | 5352 | /** |
priyank12p | 0:b0c4c25d37ab | 5353 | * @} end of clarke group |
priyank12p | 0:b0c4c25d37ab | 5354 | */ |
priyank12p | 0:b0c4c25d37ab | 5355 | |
priyank12p | 0:b0c4c25d37ab | 5356 | /** |
priyank12p | 0:b0c4c25d37ab | 5357 | * @brief Converts the elements of the Q7 vector to Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 5358 | * @param[in] *pSrc input pointer |
priyank12p | 0:b0c4c25d37ab | 5359 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 5360 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 5361 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5362 | */ |
priyank12p | 0:b0c4c25d37ab | 5363 | void arm_q7_to_q31( |
priyank12p | 0:b0c4c25d37ab | 5364 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 5365 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 5366 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 5367 | |
priyank12p | 0:b0c4c25d37ab | 5368 | |
priyank12p | 0:b0c4c25d37ab | 5369 | |
priyank12p | 0:b0c4c25d37ab | 5370 | |
priyank12p | 0:b0c4c25d37ab | 5371 | /** |
priyank12p | 0:b0c4c25d37ab | 5372 | * @ingroup groupController |
priyank12p | 0:b0c4c25d37ab | 5373 | */ |
priyank12p | 0:b0c4c25d37ab | 5374 | |
priyank12p | 0:b0c4c25d37ab | 5375 | /** |
priyank12p | 0:b0c4c25d37ab | 5376 | * @defgroup inv_clarke Vector Inverse Clarke Transform |
priyank12p | 0:b0c4c25d37ab | 5377 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. |
priyank12p | 0:b0c4c25d37ab | 5378 | * |
priyank12p | 0:b0c4c25d37ab | 5379 | * The function operates on a single sample of data and each call to the function returns the processed output. |
priyank12p | 0:b0c4c25d37ab | 5380 | * The library provides separate functions for Q31 and floating-point data types. |
priyank12p | 0:b0c4c25d37ab | 5381 | * \par Algorithm |
priyank12p | 0:b0c4c25d37ab | 5382 | * \image html clarkeInvFormula.gif |
priyank12p | 0:b0c4c25d37ab | 5383 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and |
priyank12p | 0:b0c4c25d37ab | 5384 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector. |
priyank12p | 0:b0c4c25d37ab | 5385 | * \par Fixed-Point Behavior |
priyank12p | 0:b0c4c25d37ab | 5386 | * Care must be taken when using the Q31 version of the Clarke transform. |
priyank12p | 0:b0c4c25d37ab | 5387 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
priyank12p | 0:b0c4c25d37ab | 5388 | * Refer to the function specific documentation below for usage guidelines. |
priyank12p | 0:b0c4c25d37ab | 5389 | */ |
priyank12p | 0:b0c4c25d37ab | 5390 | |
priyank12p | 0:b0c4c25d37ab | 5391 | /** |
priyank12p | 0:b0c4c25d37ab | 5392 | * @addtogroup inv_clarke |
priyank12p | 0:b0c4c25d37ab | 5393 | * @{ |
priyank12p | 0:b0c4c25d37ab | 5394 | */ |
priyank12p | 0:b0c4c25d37ab | 5395 | |
priyank12p | 0:b0c4c25d37ab | 5396 | /** |
priyank12p | 0:b0c4c25d37ab | 5397 | * @brief Floating-point Inverse Clarke transform |
priyank12p | 0:b0c4c25d37ab | 5398 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
priyank12p | 0:b0c4c25d37ab | 5399 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
priyank12p | 0:b0c4c25d37ab | 5400 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
priyank12p | 0:b0c4c25d37ab | 5401 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
priyank12p | 0:b0c4c25d37ab | 5402 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5403 | */ |
priyank12p | 0:b0c4c25d37ab | 5404 | |
priyank12p | 0:b0c4c25d37ab | 5405 | |
priyank12p | 0:b0c4c25d37ab | 5406 | static __INLINE void arm_inv_clarke_f32( |
priyank12p | 0:b0c4c25d37ab | 5407 | float32_t Ialpha, |
priyank12p | 0:b0c4c25d37ab | 5408 | float32_t Ibeta, |
priyank12p | 0:b0c4c25d37ab | 5409 | float32_t * pIa, |
priyank12p | 0:b0c4c25d37ab | 5410 | float32_t * pIb) |
priyank12p | 0:b0c4c25d37ab | 5411 | { |
priyank12p | 0:b0c4c25d37ab | 5412 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
priyank12p | 0:b0c4c25d37ab | 5413 | *pIa = Ialpha; |
priyank12p | 0:b0c4c25d37ab | 5414 | |
priyank12p | 0:b0c4c25d37ab | 5415 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ |
priyank12p | 0:b0c4c25d37ab | 5416 | *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta; |
priyank12p | 0:b0c4c25d37ab | 5417 | |
priyank12p | 0:b0c4c25d37ab | 5418 | } |
priyank12p | 0:b0c4c25d37ab | 5419 | |
priyank12p | 0:b0c4c25d37ab | 5420 | /** |
priyank12p | 0:b0c4c25d37ab | 5421 | * @brief Inverse Clarke transform for Q31 version |
priyank12p | 0:b0c4c25d37ab | 5422 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
priyank12p | 0:b0c4c25d37ab | 5423 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
priyank12p | 0:b0c4c25d37ab | 5424 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
priyank12p | 0:b0c4c25d37ab | 5425 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
priyank12p | 0:b0c4c25d37ab | 5426 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5427 | * |
priyank12p | 0:b0c4c25d37ab | 5428 | * <b>Scaling and Overflow Behavior:</b> |
priyank12p | 0:b0c4c25d37ab | 5429 | * \par |
priyank12p | 0:b0c4c25d37ab | 5430 | * The function is implemented using an internal 32-bit accumulator. |
priyank12p | 0:b0c4c25d37ab | 5431 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
priyank12p | 0:b0c4c25d37ab | 5432 | * There is saturation on the subtraction, hence there is no risk of overflow. |
priyank12p | 0:b0c4c25d37ab | 5433 | */ |
priyank12p | 0:b0c4c25d37ab | 5434 | |
priyank12p | 0:b0c4c25d37ab | 5435 | static __INLINE void arm_inv_clarke_q31( |
priyank12p | 0:b0c4c25d37ab | 5436 | q31_t Ialpha, |
priyank12p | 0:b0c4c25d37ab | 5437 | q31_t Ibeta, |
priyank12p | 0:b0c4c25d37ab | 5438 | q31_t * pIa, |
priyank12p | 0:b0c4c25d37ab | 5439 | q31_t * pIb) |
priyank12p | 0:b0c4c25d37ab | 5440 | { |
priyank12p | 0:b0c4c25d37ab | 5441 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
priyank12p | 0:b0c4c25d37ab | 5442 | |
priyank12p | 0:b0c4c25d37ab | 5443 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
priyank12p | 0:b0c4c25d37ab | 5444 | *pIa = Ialpha; |
priyank12p | 0:b0c4c25d37ab | 5445 | |
priyank12p | 0:b0c4c25d37ab | 5446 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ |
priyank12p | 0:b0c4c25d37ab | 5447 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5448 | |
priyank12p | 0:b0c4c25d37ab | 5449 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ |
priyank12p | 0:b0c4c25d37ab | 5450 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5451 | |
priyank12p | 0:b0c4c25d37ab | 5452 | /* pIb is calculated by subtracting the products */ |
priyank12p | 0:b0c4c25d37ab | 5453 | *pIb = __QSUB(product2, product1); |
priyank12p | 0:b0c4c25d37ab | 5454 | |
priyank12p | 0:b0c4c25d37ab | 5455 | } |
priyank12p | 0:b0c4c25d37ab | 5456 | |
priyank12p | 0:b0c4c25d37ab | 5457 | /** |
priyank12p | 0:b0c4c25d37ab | 5458 | * @} end of inv_clarke group |
priyank12p | 0:b0c4c25d37ab | 5459 | */ |
priyank12p | 0:b0c4c25d37ab | 5460 | |
priyank12p | 0:b0c4c25d37ab | 5461 | /** |
priyank12p | 0:b0c4c25d37ab | 5462 | * @brief Converts the elements of the Q7 vector to Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 5463 | * @param[in] *pSrc input pointer |
priyank12p | 0:b0c4c25d37ab | 5464 | * @param[out] *pDst output pointer |
priyank12p | 0:b0c4c25d37ab | 5465 | * @param[in] blockSize number of samples to process |
priyank12p | 0:b0c4c25d37ab | 5466 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5467 | */ |
priyank12p | 0:b0c4c25d37ab | 5468 | void arm_q7_to_q15( |
priyank12p | 0:b0c4c25d37ab | 5469 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 5470 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 5471 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 5472 | |
priyank12p | 0:b0c4c25d37ab | 5473 | |
priyank12p | 0:b0c4c25d37ab | 5474 | |
priyank12p | 0:b0c4c25d37ab | 5475 | /** |
priyank12p | 0:b0c4c25d37ab | 5476 | * @ingroup groupController |
priyank12p | 0:b0c4c25d37ab | 5477 | */ |
priyank12p | 0:b0c4c25d37ab | 5478 | |
priyank12p | 0:b0c4c25d37ab | 5479 | /** |
priyank12p | 0:b0c4c25d37ab | 5480 | * @defgroup park Vector Park Transform |
priyank12p | 0:b0c4c25d37ab | 5481 | * |
priyank12p | 0:b0c4c25d37ab | 5482 | * Forward Park transform converts the input two-coordinate vector to flux and torque components. |
priyank12p | 0:b0c4c25d37ab | 5483 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents |
priyank12p | 0:b0c4c25d37ab | 5484 | * from the stationary to the moving reference frame and control the spatial relationship between |
priyank12p | 0:b0c4c25d37ab | 5485 | * the stator vector current and rotor flux vector. |
priyank12p | 0:b0c4c25d37ab | 5486 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the |
priyank12p | 0:b0c4c25d37ab | 5487 | * current vector and the relationship from the two reference frames: |
priyank12p | 0:b0c4c25d37ab | 5488 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" |
priyank12p | 0:b0c4c25d37ab | 5489 | * |
priyank12p | 0:b0c4c25d37ab | 5490 | * The function operates on a single sample of data and each call to the function returns the processed output. |
priyank12p | 0:b0c4c25d37ab | 5491 | * The library provides separate functions for Q31 and floating-point data types. |
priyank12p | 0:b0c4c25d37ab | 5492 | * \par Algorithm |
priyank12p | 0:b0c4c25d37ab | 5493 | * \image html parkFormula.gif |
priyank12p | 0:b0c4c25d37ab | 5494 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components, |
priyank12p | 0:b0c4c25d37ab | 5495 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
priyank12p | 0:b0c4c25d37ab | 5496 | * cosine and sine values of theta (rotor flux position). |
priyank12p | 0:b0c4c25d37ab | 5497 | * \par Fixed-Point Behavior |
priyank12p | 0:b0c4c25d37ab | 5498 | * Care must be taken when using the Q31 version of the Park transform. |
priyank12p | 0:b0c4c25d37ab | 5499 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
priyank12p | 0:b0c4c25d37ab | 5500 | * Refer to the function specific documentation below for usage guidelines. |
priyank12p | 0:b0c4c25d37ab | 5501 | */ |
priyank12p | 0:b0c4c25d37ab | 5502 | |
priyank12p | 0:b0c4c25d37ab | 5503 | /** |
priyank12p | 0:b0c4c25d37ab | 5504 | * @addtogroup park |
priyank12p | 0:b0c4c25d37ab | 5505 | * @{ |
priyank12p | 0:b0c4c25d37ab | 5506 | */ |
priyank12p | 0:b0c4c25d37ab | 5507 | |
priyank12p | 0:b0c4c25d37ab | 5508 | /** |
priyank12p | 0:b0c4c25d37ab | 5509 | * @brief Floating-point Park transform |
priyank12p | 0:b0c4c25d37ab | 5510 | * @param[in] Ialpha input two-phase vector coordinate alpha |
priyank12p | 0:b0c4c25d37ab | 5511 | * @param[in] Ibeta input two-phase vector coordinate beta |
priyank12p | 0:b0c4c25d37ab | 5512 | * @param[out] *pId points to output rotor reference frame d |
priyank12p | 0:b0c4c25d37ab | 5513 | * @param[out] *pIq points to output rotor reference frame q |
priyank12p | 0:b0c4c25d37ab | 5514 | * @param[in] sinVal sine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5515 | * @param[in] cosVal cosine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5516 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5517 | * |
priyank12p | 0:b0c4c25d37ab | 5518 | * The function implements the forward Park transform. |
priyank12p | 0:b0c4c25d37ab | 5519 | * |
priyank12p | 0:b0c4c25d37ab | 5520 | */ |
priyank12p | 0:b0c4c25d37ab | 5521 | |
priyank12p | 0:b0c4c25d37ab | 5522 | static __INLINE void arm_park_f32( |
priyank12p | 0:b0c4c25d37ab | 5523 | float32_t Ialpha, |
priyank12p | 0:b0c4c25d37ab | 5524 | float32_t Ibeta, |
priyank12p | 0:b0c4c25d37ab | 5525 | float32_t * pId, |
priyank12p | 0:b0c4c25d37ab | 5526 | float32_t * pIq, |
priyank12p | 0:b0c4c25d37ab | 5527 | float32_t sinVal, |
priyank12p | 0:b0c4c25d37ab | 5528 | float32_t cosVal) |
priyank12p | 0:b0c4c25d37ab | 5529 | { |
priyank12p | 0:b0c4c25d37ab | 5530 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ |
priyank12p | 0:b0c4c25d37ab | 5531 | *pId = Ialpha * cosVal + Ibeta * sinVal; |
priyank12p | 0:b0c4c25d37ab | 5532 | |
priyank12p | 0:b0c4c25d37ab | 5533 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ |
priyank12p | 0:b0c4c25d37ab | 5534 | *pIq = -Ialpha * sinVal + Ibeta * cosVal; |
priyank12p | 0:b0c4c25d37ab | 5535 | |
priyank12p | 0:b0c4c25d37ab | 5536 | } |
priyank12p | 0:b0c4c25d37ab | 5537 | |
priyank12p | 0:b0c4c25d37ab | 5538 | /** |
priyank12p | 0:b0c4c25d37ab | 5539 | * @brief Park transform for Q31 version |
priyank12p | 0:b0c4c25d37ab | 5540 | * @param[in] Ialpha input two-phase vector coordinate alpha |
priyank12p | 0:b0c4c25d37ab | 5541 | * @param[in] Ibeta input two-phase vector coordinate beta |
priyank12p | 0:b0c4c25d37ab | 5542 | * @param[out] *pId points to output rotor reference frame d |
priyank12p | 0:b0c4c25d37ab | 5543 | * @param[out] *pIq points to output rotor reference frame q |
priyank12p | 0:b0c4c25d37ab | 5544 | * @param[in] sinVal sine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5545 | * @param[in] cosVal cosine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5546 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5547 | * |
priyank12p | 0:b0c4c25d37ab | 5548 | * <b>Scaling and Overflow Behavior:</b> |
priyank12p | 0:b0c4c25d37ab | 5549 | * \par |
priyank12p | 0:b0c4c25d37ab | 5550 | * The function is implemented using an internal 32-bit accumulator. |
priyank12p | 0:b0c4c25d37ab | 5551 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
priyank12p | 0:b0c4c25d37ab | 5552 | * There is saturation on the addition and subtraction, hence there is no risk of overflow. |
priyank12p | 0:b0c4c25d37ab | 5553 | */ |
priyank12p | 0:b0c4c25d37ab | 5554 | |
priyank12p | 0:b0c4c25d37ab | 5555 | |
priyank12p | 0:b0c4c25d37ab | 5556 | static __INLINE void arm_park_q31( |
priyank12p | 0:b0c4c25d37ab | 5557 | q31_t Ialpha, |
priyank12p | 0:b0c4c25d37ab | 5558 | q31_t Ibeta, |
priyank12p | 0:b0c4c25d37ab | 5559 | q31_t * pId, |
priyank12p | 0:b0c4c25d37ab | 5560 | q31_t * pIq, |
priyank12p | 0:b0c4c25d37ab | 5561 | q31_t sinVal, |
priyank12p | 0:b0c4c25d37ab | 5562 | q31_t cosVal) |
priyank12p | 0:b0c4c25d37ab | 5563 | { |
priyank12p | 0:b0c4c25d37ab | 5564 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
priyank12p | 0:b0c4c25d37ab | 5565 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
priyank12p | 0:b0c4c25d37ab | 5566 | |
priyank12p | 0:b0c4c25d37ab | 5567 | /* Intermediate product is calculated by (Ialpha * cosVal) */ |
priyank12p | 0:b0c4c25d37ab | 5568 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5569 | |
priyank12p | 0:b0c4c25d37ab | 5570 | /* Intermediate product is calculated by (Ibeta * sinVal) */ |
priyank12p | 0:b0c4c25d37ab | 5571 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5572 | |
priyank12p | 0:b0c4c25d37ab | 5573 | |
priyank12p | 0:b0c4c25d37ab | 5574 | /* Intermediate product is calculated by (Ialpha * sinVal) */ |
priyank12p | 0:b0c4c25d37ab | 5575 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5576 | |
priyank12p | 0:b0c4c25d37ab | 5577 | /* Intermediate product is calculated by (Ibeta * cosVal) */ |
priyank12p | 0:b0c4c25d37ab | 5578 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5579 | |
priyank12p | 0:b0c4c25d37ab | 5580 | /* Calculate pId by adding the two intermediate products 1 and 2 */ |
priyank12p | 0:b0c4c25d37ab | 5581 | *pId = __QADD(product1, product2); |
priyank12p | 0:b0c4c25d37ab | 5582 | |
priyank12p | 0:b0c4c25d37ab | 5583 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ |
priyank12p | 0:b0c4c25d37ab | 5584 | *pIq = __QSUB(product4, product3); |
priyank12p | 0:b0c4c25d37ab | 5585 | } |
priyank12p | 0:b0c4c25d37ab | 5586 | |
priyank12p | 0:b0c4c25d37ab | 5587 | /** |
priyank12p | 0:b0c4c25d37ab | 5588 | * @} end of park group |
priyank12p | 0:b0c4c25d37ab | 5589 | */ |
priyank12p | 0:b0c4c25d37ab | 5590 | |
priyank12p | 0:b0c4c25d37ab | 5591 | /** |
priyank12p | 0:b0c4c25d37ab | 5592 | * @brief Converts the elements of the Q7 vector to floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 5593 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 5594 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 5595 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 5596 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5597 | */ |
priyank12p | 0:b0c4c25d37ab | 5598 | void arm_q7_to_float( |
priyank12p | 0:b0c4c25d37ab | 5599 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 5600 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 5601 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 5602 | |
priyank12p | 0:b0c4c25d37ab | 5603 | |
priyank12p | 0:b0c4c25d37ab | 5604 | /** |
priyank12p | 0:b0c4c25d37ab | 5605 | * @ingroup groupController |
priyank12p | 0:b0c4c25d37ab | 5606 | */ |
priyank12p | 0:b0c4c25d37ab | 5607 | |
priyank12p | 0:b0c4c25d37ab | 5608 | /** |
priyank12p | 0:b0c4c25d37ab | 5609 | * @defgroup inv_park Vector Inverse Park transform |
priyank12p | 0:b0c4c25d37ab | 5610 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector. |
priyank12p | 0:b0c4c25d37ab | 5611 | * |
priyank12p | 0:b0c4c25d37ab | 5612 | * The function operates on a single sample of data and each call to the function returns the processed output. |
priyank12p | 0:b0c4c25d37ab | 5613 | * The library provides separate functions for Q31 and floating-point data types. |
priyank12p | 0:b0c4c25d37ab | 5614 | * \par Algorithm |
priyank12p | 0:b0c4c25d37ab | 5615 | * \image html parkInvFormula.gif |
priyank12p | 0:b0c4c25d37ab | 5616 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components, |
priyank12p | 0:b0c4c25d37ab | 5617 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
priyank12p | 0:b0c4c25d37ab | 5618 | * cosine and sine values of theta (rotor flux position). |
priyank12p | 0:b0c4c25d37ab | 5619 | * \par Fixed-Point Behavior |
priyank12p | 0:b0c4c25d37ab | 5620 | * Care must be taken when using the Q31 version of the Park transform. |
priyank12p | 0:b0c4c25d37ab | 5621 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
priyank12p | 0:b0c4c25d37ab | 5622 | * Refer to the function specific documentation below for usage guidelines. |
priyank12p | 0:b0c4c25d37ab | 5623 | */ |
priyank12p | 0:b0c4c25d37ab | 5624 | |
priyank12p | 0:b0c4c25d37ab | 5625 | /** |
priyank12p | 0:b0c4c25d37ab | 5626 | * @addtogroup inv_park |
priyank12p | 0:b0c4c25d37ab | 5627 | * @{ |
priyank12p | 0:b0c4c25d37ab | 5628 | */ |
priyank12p | 0:b0c4c25d37ab | 5629 | |
priyank12p | 0:b0c4c25d37ab | 5630 | /** |
priyank12p | 0:b0c4c25d37ab | 5631 | * @brief Floating-point Inverse Park transform |
priyank12p | 0:b0c4c25d37ab | 5632 | * @param[in] Id input coordinate of rotor reference frame d |
priyank12p | 0:b0c4c25d37ab | 5633 | * @param[in] Iq input coordinate of rotor reference frame q |
priyank12p | 0:b0c4c25d37ab | 5634 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
priyank12p | 0:b0c4c25d37ab | 5635 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
priyank12p | 0:b0c4c25d37ab | 5636 | * @param[in] sinVal sine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5637 | * @param[in] cosVal cosine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5638 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5639 | */ |
priyank12p | 0:b0c4c25d37ab | 5640 | |
priyank12p | 0:b0c4c25d37ab | 5641 | static __INLINE void arm_inv_park_f32( |
priyank12p | 0:b0c4c25d37ab | 5642 | float32_t Id, |
priyank12p | 0:b0c4c25d37ab | 5643 | float32_t Iq, |
priyank12p | 0:b0c4c25d37ab | 5644 | float32_t * pIalpha, |
priyank12p | 0:b0c4c25d37ab | 5645 | float32_t * pIbeta, |
priyank12p | 0:b0c4c25d37ab | 5646 | float32_t sinVal, |
priyank12p | 0:b0c4c25d37ab | 5647 | float32_t cosVal) |
priyank12p | 0:b0c4c25d37ab | 5648 | { |
priyank12p | 0:b0c4c25d37ab | 5649 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ |
priyank12p | 0:b0c4c25d37ab | 5650 | *pIalpha = Id * cosVal - Iq * sinVal; |
priyank12p | 0:b0c4c25d37ab | 5651 | |
priyank12p | 0:b0c4c25d37ab | 5652 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ |
priyank12p | 0:b0c4c25d37ab | 5653 | *pIbeta = Id * sinVal + Iq * cosVal; |
priyank12p | 0:b0c4c25d37ab | 5654 | |
priyank12p | 0:b0c4c25d37ab | 5655 | } |
priyank12p | 0:b0c4c25d37ab | 5656 | |
priyank12p | 0:b0c4c25d37ab | 5657 | |
priyank12p | 0:b0c4c25d37ab | 5658 | /** |
priyank12p | 0:b0c4c25d37ab | 5659 | * @brief Inverse Park transform for Q31 version |
priyank12p | 0:b0c4c25d37ab | 5660 | * @param[in] Id input coordinate of rotor reference frame d |
priyank12p | 0:b0c4c25d37ab | 5661 | * @param[in] Iq input coordinate of rotor reference frame q |
priyank12p | 0:b0c4c25d37ab | 5662 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
priyank12p | 0:b0c4c25d37ab | 5663 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
priyank12p | 0:b0c4c25d37ab | 5664 | * @param[in] sinVal sine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5665 | * @param[in] cosVal cosine value of rotation angle theta |
priyank12p | 0:b0c4c25d37ab | 5666 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5667 | * |
priyank12p | 0:b0c4c25d37ab | 5668 | * <b>Scaling and Overflow Behavior:</b> |
priyank12p | 0:b0c4c25d37ab | 5669 | * \par |
priyank12p | 0:b0c4c25d37ab | 5670 | * The function is implemented using an internal 32-bit accumulator. |
priyank12p | 0:b0c4c25d37ab | 5671 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
priyank12p | 0:b0c4c25d37ab | 5672 | * There is saturation on the addition, hence there is no risk of overflow. |
priyank12p | 0:b0c4c25d37ab | 5673 | */ |
priyank12p | 0:b0c4c25d37ab | 5674 | |
priyank12p | 0:b0c4c25d37ab | 5675 | |
priyank12p | 0:b0c4c25d37ab | 5676 | static __INLINE void arm_inv_park_q31( |
priyank12p | 0:b0c4c25d37ab | 5677 | q31_t Id, |
priyank12p | 0:b0c4c25d37ab | 5678 | q31_t Iq, |
priyank12p | 0:b0c4c25d37ab | 5679 | q31_t * pIalpha, |
priyank12p | 0:b0c4c25d37ab | 5680 | q31_t * pIbeta, |
priyank12p | 0:b0c4c25d37ab | 5681 | q31_t sinVal, |
priyank12p | 0:b0c4c25d37ab | 5682 | q31_t cosVal) |
priyank12p | 0:b0c4c25d37ab | 5683 | { |
priyank12p | 0:b0c4c25d37ab | 5684 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
priyank12p | 0:b0c4c25d37ab | 5685 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
priyank12p | 0:b0c4c25d37ab | 5686 | |
priyank12p | 0:b0c4c25d37ab | 5687 | /* Intermediate product is calculated by (Id * cosVal) */ |
priyank12p | 0:b0c4c25d37ab | 5688 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5689 | |
priyank12p | 0:b0c4c25d37ab | 5690 | /* Intermediate product is calculated by (Iq * sinVal) */ |
priyank12p | 0:b0c4c25d37ab | 5691 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5692 | |
priyank12p | 0:b0c4c25d37ab | 5693 | |
priyank12p | 0:b0c4c25d37ab | 5694 | /* Intermediate product is calculated by (Id * sinVal) */ |
priyank12p | 0:b0c4c25d37ab | 5695 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5696 | |
priyank12p | 0:b0c4c25d37ab | 5697 | /* Intermediate product is calculated by (Iq * cosVal) */ |
priyank12p | 0:b0c4c25d37ab | 5698 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); |
priyank12p | 0:b0c4c25d37ab | 5699 | |
priyank12p | 0:b0c4c25d37ab | 5700 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */ |
priyank12p | 0:b0c4c25d37ab | 5701 | *pIalpha = __QSUB(product1, product2); |
priyank12p | 0:b0c4c25d37ab | 5702 | |
priyank12p | 0:b0c4c25d37ab | 5703 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */ |
priyank12p | 0:b0c4c25d37ab | 5704 | *pIbeta = __QADD(product4, product3); |
priyank12p | 0:b0c4c25d37ab | 5705 | |
priyank12p | 0:b0c4c25d37ab | 5706 | } |
priyank12p | 0:b0c4c25d37ab | 5707 | |
priyank12p | 0:b0c4c25d37ab | 5708 | /** |
priyank12p | 0:b0c4c25d37ab | 5709 | * @} end of Inverse park group |
priyank12p | 0:b0c4c25d37ab | 5710 | */ |
priyank12p | 0:b0c4c25d37ab | 5711 | |
priyank12p | 0:b0c4c25d37ab | 5712 | |
priyank12p | 0:b0c4c25d37ab | 5713 | /** |
priyank12p | 0:b0c4c25d37ab | 5714 | * @brief Converts the elements of the Q31 vector to floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 5715 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 5716 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 5717 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 5718 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 5719 | */ |
priyank12p | 0:b0c4c25d37ab | 5720 | void arm_q31_to_float( |
priyank12p | 0:b0c4c25d37ab | 5721 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 5722 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 5723 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 5724 | |
priyank12p | 0:b0c4c25d37ab | 5725 | /** |
priyank12p | 0:b0c4c25d37ab | 5726 | * @ingroup groupInterpolation |
priyank12p | 0:b0c4c25d37ab | 5727 | */ |
priyank12p | 0:b0c4c25d37ab | 5728 | |
priyank12p | 0:b0c4c25d37ab | 5729 | /** |
priyank12p | 0:b0c4c25d37ab | 5730 | * @defgroup LinearInterpolate Linear Interpolation |
priyank12p | 0:b0c4c25d37ab | 5731 | * |
priyank12p | 0:b0c4c25d37ab | 5732 | * Linear interpolation is a method of curve fitting using linear polynomials. |
priyank12p | 0:b0c4c25d37ab | 5733 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line |
priyank12p | 0:b0c4c25d37ab | 5734 | * |
priyank12p | 0:b0c4c25d37ab | 5735 | * \par |
priyank12p | 0:b0c4c25d37ab | 5736 | * \image html LinearInterp.gif "Linear interpolation" |
priyank12p | 0:b0c4c25d37ab | 5737 | * |
priyank12p | 0:b0c4c25d37ab | 5738 | * \par |
priyank12p | 0:b0c4c25d37ab | 5739 | * A Linear Interpolate function calculates an output value(y), for the input(x) |
priyank12p | 0:b0c4c25d37ab | 5740 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) |
priyank12p | 0:b0c4c25d37ab | 5741 | * |
priyank12p | 0:b0c4c25d37ab | 5742 | * \par Algorithm: |
priyank12p | 0:b0c4c25d37ab | 5743 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 5744 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0)) |
priyank12p | 0:b0c4c25d37ab | 5745 | * where x0, x1 are nearest values of input x |
priyank12p | 0:b0c4c25d37ab | 5746 | * y0, y1 are nearest values to output y |
priyank12p | 0:b0c4c25d37ab | 5747 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 5748 | * |
priyank12p | 0:b0c4c25d37ab | 5749 | * \par |
priyank12p | 0:b0c4c25d37ab | 5750 | * This set of functions implements Linear interpolation process |
priyank12p | 0:b0c4c25d37ab | 5751 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single |
priyank12p | 0:b0c4c25d37ab | 5752 | * sample of data and each call to the function returns a single processed value. |
priyank12p | 0:b0c4c25d37ab | 5753 | * <code>S</code> points to an instance of the Linear Interpolate function data structure. |
priyank12p | 0:b0c4c25d37ab | 5754 | * <code>x</code> is the input sample value. The functions returns the output value. |
priyank12p | 0:b0c4c25d37ab | 5755 | * |
priyank12p | 0:b0c4c25d37ab | 5756 | * \par |
priyank12p | 0:b0c4c25d37ab | 5757 | * if x is outside of the table boundary, Linear interpolation returns first value of the table |
priyank12p | 0:b0c4c25d37ab | 5758 | * if x is below input range and returns last value of table if x is above range. |
priyank12p | 0:b0c4c25d37ab | 5759 | */ |
priyank12p | 0:b0c4c25d37ab | 5760 | |
priyank12p | 0:b0c4c25d37ab | 5761 | /** |
priyank12p | 0:b0c4c25d37ab | 5762 | * @addtogroup LinearInterpolate |
priyank12p | 0:b0c4c25d37ab | 5763 | * @{ |
priyank12p | 0:b0c4c25d37ab | 5764 | */ |
priyank12p | 0:b0c4c25d37ab | 5765 | |
priyank12p | 0:b0c4c25d37ab | 5766 | /** |
priyank12p | 0:b0c4c25d37ab | 5767 | * @brief Process function for the floating-point Linear Interpolation Function. |
priyank12p | 0:b0c4c25d37ab | 5768 | * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure |
priyank12p | 0:b0c4c25d37ab | 5769 | * @param[in] x input sample to process |
priyank12p | 0:b0c4c25d37ab | 5770 | * @return y processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5771 | * |
priyank12p | 0:b0c4c25d37ab | 5772 | */ |
priyank12p | 0:b0c4c25d37ab | 5773 | |
priyank12p | 0:b0c4c25d37ab | 5774 | static __INLINE float32_t arm_linear_interp_f32( |
priyank12p | 0:b0c4c25d37ab | 5775 | arm_linear_interp_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 5776 | float32_t x) |
priyank12p | 0:b0c4c25d37ab | 5777 | { |
priyank12p | 0:b0c4c25d37ab | 5778 | |
priyank12p | 0:b0c4c25d37ab | 5779 | float32_t y; |
priyank12p | 0:b0c4c25d37ab | 5780 | float32_t x0, x1; /* Nearest input values */ |
priyank12p | 0:b0c4c25d37ab | 5781 | float32_t y0, y1; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5782 | float32_t xSpacing = S->xSpacing; /* spacing between input values */ |
priyank12p | 0:b0c4c25d37ab | 5783 | int32_t i; /* Index variable */ |
priyank12p | 0:b0c4c25d37ab | 5784 | float32_t *pYData = S->pYData; /* pointer to output table */ |
priyank12p | 0:b0c4c25d37ab | 5785 | |
priyank12p | 0:b0c4c25d37ab | 5786 | /* Calculation of index */ |
priyank12p | 0:b0c4c25d37ab | 5787 | i = (int32_t) ((x - S->x1) / xSpacing); |
priyank12p | 0:b0c4c25d37ab | 5788 | |
priyank12p | 0:b0c4c25d37ab | 5789 | if(i < 0) |
priyank12p | 0:b0c4c25d37ab | 5790 | { |
priyank12p | 0:b0c4c25d37ab | 5791 | /* Iniatilize output for below specified range as least output value of table */ |
priyank12p | 0:b0c4c25d37ab | 5792 | y = pYData[0]; |
priyank12p | 0:b0c4c25d37ab | 5793 | } |
priyank12p | 0:b0c4c25d37ab | 5794 | else if((uint32_t)i >= S->nValues) |
priyank12p | 0:b0c4c25d37ab | 5795 | { |
priyank12p | 0:b0c4c25d37ab | 5796 | /* Iniatilize output for above specified range as last output value of table */ |
priyank12p | 0:b0c4c25d37ab | 5797 | y = pYData[S->nValues - 1]; |
priyank12p | 0:b0c4c25d37ab | 5798 | } |
priyank12p | 0:b0c4c25d37ab | 5799 | else |
priyank12p | 0:b0c4c25d37ab | 5800 | { |
priyank12p | 0:b0c4c25d37ab | 5801 | /* Calculation of nearest input values */ |
priyank12p | 0:b0c4c25d37ab | 5802 | x0 = S->x1 + i * xSpacing; |
priyank12p | 0:b0c4c25d37ab | 5803 | x1 = S->x1 + (i + 1) * xSpacing; |
priyank12p | 0:b0c4c25d37ab | 5804 | |
priyank12p | 0:b0c4c25d37ab | 5805 | /* Read of nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5806 | y0 = pYData[i]; |
priyank12p | 0:b0c4c25d37ab | 5807 | y1 = pYData[i + 1]; |
priyank12p | 0:b0c4c25d37ab | 5808 | |
priyank12p | 0:b0c4c25d37ab | 5809 | /* Calculation of output */ |
priyank12p | 0:b0c4c25d37ab | 5810 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); |
priyank12p | 0:b0c4c25d37ab | 5811 | |
priyank12p | 0:b0c4c25d37ab | 5812 | } |
priyank12p | 0:b0c4c25d37ab | 5813 | |
priyank12p | 0:b0c4c25d37ab | 5814 | /* returns output value */ |
priyank12p | 0:b0c4c25d37ab | 5815 | return (y); |
priyank12p | 0:b0c4c25d37ab | 5816 | } |
priyank12p | 0:b0c4c25d37ab | 5817 | |
priyank12p | 0:b0c4c25d37ab | 5818 | /** |
priyank12p | 0:b0c4c25d37ab | 5819 | * |
priyank12p | 0:b0c4c25d37ab | 5820 | * @brief Process function for the Q31 Linear Interpolation Function. |
priyank12p | 0:b0c4c25d37ab | 5821 | * @param[in] *pYData pointer to Q31 Linear Interpolation table |
priyank12p | 0:b0c4c25d37ab | 5822 | * @param[in] x input sample to process |
priyank12p | 0:b0c4c25d37ab | 5823 | * @param[in] nValues number of table values |
priyank12p | 0:b0c4c25d37ab | 5824 | * @return y processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5825 | * |
priyank12p | 0:b0c4c25d37ab | 5826 | * \par |
priyank12p | 0:b0c4c25d37ab | 5827 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
priyank12p | 0:b0c4c25d37ab | 5828 | * This function can support maximum of table size 2^12. |
priyank12p | 0:b0c4c25d37ab | 5829 | * |
priyank12p | 0:b0c4c25d37ab | 5830 | */ |
priyank12p | 0:b0c4c25d37ab | 5831 | |
priyank12p | 0:b0c4c25d37ab | 5832 | |
priyank12p | 0:b0c4c25d37ab | 5833 | static __INLINE q31_t arm_linear_interp_q31( |
priyank12p | 0:b0c4c25d37ab | 5834 | q31_t * pYData, |
priyank12p | 0:b0c4c25d37ab | 5835 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 5836 | uint32_t nValues) |
priyank12p | 0:b0c4c25d37ab | 5837 | { |
priyank12p | 0:b0c4c25d37ab | 5838 | q31_t y; /* output */ |
priyank12p | 0:b0c4c25d37ab | 5839 | q31_t y0, y1; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5840 | q31_t fract; /* fractional part */ |
priyank12p | 0:b0c4c25d37ab | 5841 | int32_t index; /* Index to read nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5842 | |
priyank12p | 0:b0c4c25d37ab | 5843 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 5844 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 5845 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 5846 | index = ((x & 0xFFF00000) >> 20); |
priyank12p | 0:b0c4c25d37ab | 5847 | |
priyank12p | 0:b0c4c25d37ab | 5848 | if(index >= (int32_t)(nValues - 1)) |
priyank12p | 0:b0c4c25d37ab | 5849 | { |
priyank12p | 0:b0c4c25d37ab | 5850 | return (pYData[nValues - 1]); |
priyank12p | 0:b0c4c25d37ab | 5851 | } |
priyank12p | 0:b0c4c25d37ab | 5852 | else if(index < 0) |
priyank12p | 0:b0c4c25d37ab | 5853 | { |
priyank12p | 0:b0c4c25d37ab | 5854 | return (pYData[0]); |
priyank12p | 0:b0c4c25d37ab | 5855 | } |
priyank12p | 0:b0c4c25d37ab | 5856 | else |
priyank12p | 0:b0c4c25d37ab | 5857 | { |
priyank12p | 0:b0c4c25d37ab | 5858 | |
priyank12p | 0:b0c4c25d37ab | 5859 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 5860 | /* shift left by 11 to keep fract in 1.31 format */ |
priyank12p | 0:b0c4c25d37ab | 5861 | fract = (x & 0x000FFFFF) << 11; |
priyank12p | 0:b0c4c25d37ab | 5862 | |
priyank12p | 0:b0c4c25d37ab | 5863 | /* Read two nearest output values from the index in 1.31(q31) format */ |
priyank12p | 0:b0c4c25d37ab | 5864 | y0 = pYData[index]; |
priyank12p | 0:b0c4c25d37ab | 5865 | y1 = pYData[index + 1u]; |
priyank12p | 0:b0c4c25d37ab | 5866 | |
priyank12p | 0:b0c4c25d37ab | 5867 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */ |
priyank12p | 0:b0c4c25d37ab | 5868 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 5869 | |
priyank12p | 0:b0c4c25d37ab | 5870 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ |
priyank12p | 0:b0c4c25d37ab | 5871 | y += ((q31_t) (((q63_t) y1 * fract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 5872 | |
priyank12p | 0:b0c4c25d37ab | 5873 | /* Convert y to 1.31 format */ |
priyank12p | 0:b0c4c25d37ab | 5874 | return (y << 1u); |
priyank12p | 0:b0c4c25d37ab | 5875 | |
priyank12p | 0:b0c4c25d37ab | 5876 | } |
priyank12p | 0:b0c4c25d37ab | 5877 | |
priyank12p | 0:b0c4c25d37ab | 5878 | } |
priyank12p | 0:b0c4c25d37ab | 5879 | |
priyank12p | 0:b0c4c25d37ab | 5880 | /** |
priyank12p | 0:b0c4c25d37ab | 5881 | * |
priyank12p | 0:b0c4c25d37ab | 5882 | * @brief Process function for the Q15 Linear Interpolation Function. |
priyank12p | 0:b0c4c25d37ab | 5883 | * @param[in] *pYData pointer to Q15 Linear Interpolation table |
priyank12p | 0:b0c4c25d37ab | 5884 | * @param[in] x input sample to process |
priyank12p | 0:b0c4c25d37ab | 5885 | * @param[in] nValues number of table values |
priyank12p | 0:b0c4c25d37ab | 5886 | * @return y processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5887 | * |
priyank12p | 0:b0c4c25d37ab | 5888 | * \par |
priyank12p | 0:b0c4c25d37ab | 5889 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
priyank12p | 0:b0c4c25d37ab | 5890 | * This function can support maximum of table size 2^12. |
priyank12p | 0:b0c4c25d37ab | 5891 | * |
priyank12p | 0:b0c4c25d37ab | 5892 | */ |
priyank12p | 0:b0c4c25d37ab | 5893 | |
priyank12p | 0:b0c4c25d37ab | 5894 | |
priyank12p | 0:b0c4c25d37ab | 5895 | static __INLINE q15_t arm_linear_interp_q15( |
priyank12p | 0:b0c4c25d37ab | 5896 | q15_t * pYData, |
priyank12p | 0:b0c4c25d37ab | 5897 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 5898 | uint32_t nValues) |
priyank12p | 0:b0c4c25d37ab | 5899 | { |
priyank12p | 0:b0c4c25d37ab | 5900 | q63_t y; /* output */ |
priyank12p | 0:b0c4c25d37ab | 5901 | q15_t y0, y1; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5902 | q31_t fract; /* fractional part */ |
priyank12p | 0:b0c4c25d37ab | 5903 | int32_t index; /* Index to read nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5904 | |
priyank12p | 0:b0c4c25d37ab | 5905 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 5906 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 5907 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 5908 | index = ((x & 0xFFF00000) >> 20u); |
priyank12p | 0:b0c4c25d37ab | 5909 | |
priyank12p | 0:b0c4c25d37ab | 5910 | if(index >= (int32_t)(nValues - 1)) |
priyank12p | 0:b0c4c25d37ab | 5911 | { |
priyank12p | 0:b0c4c25d37ab | 5912 | return (pYData[nValues - 1]); |
priyank12p | 0:b0c4c25d37ab | 5913 | } |
priyank12p | 0:b0c4c25d37ab | 5914 | else if(index < 0) |
priyank12p | 0:b0c4c25d37ab | 5915 | { |
priyank12p | 0:b0c4c25d37ab | 5916 | return (pYData[0]); |
priyank12p | 0:b0c4c25d37ab | 5917 | } |
priyank12p | 0:b0c4c25d37ab | 5918 | else |
priyank12p | 0:b0c4c25d37ab | 5919 | { |
priyank12p | 0:b0c4c25d37ab | 5920 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 5921 | /* fract is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 5922 | fract = (x & 0x000FFFFF); |
priyank12p | 0:b0c4c25d37ab | 5923 | |
priyank12p | 0:b0c4c25d37ab | 5924 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 5925 | y0 = pYData[index]; |
priyank12p | 0:b0c4c25d37ab | 5926 | y1 = pYData[index + 1u]; |
priyank12p | 0:b0c4c25d37ab | 5927 | |
priyank12p | 0:b0c4c25d37ab | 5928 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */ |
priyank12p | 0:b0c4c25d37ab | 5929 | y = ((q63_t) y0 * (0xFFFFF - fract)); |
priyank12p | 0:b0c4c25d37ab | 5930 | |
priyank12p | 0:b0c4c25d37ab | 5931 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ |
priyank12p | 0:b0c4c25d37ab | 5932 | y += ((q63_t) y1 * (fract)); |
priyank12p | 0:b0c4c25d37ab | 5933 | |
priyank12p | 0:b0c4c25d37ab | 5934 | /* convert y to 1.15 format */ |
priyank12p | 0:b0c4c25d37ab | 5935 | return (y >> 20); |
priyank12p | 0:b0c4c25d37ab | 5936 | } |
priyank12p | 0:b0c4c25d37ab | 5937 | |
priyank12p | 0:b0c4c25d37ab | 5938 | |
priyank12p | 0:b0c4c25d37ab | 5939 | } |
priyank12p | 0:b0c4c25d37ab | 5940 | |
priyank12p | 0:b0c4c25d37ab | 5941 | /** |
priyank12p | 0:b0c4c25d37ab | 5942 | * |
priyank12p | 0:b0c4c25d37ab | 5943 | * @brief Process function for the Q7 Linear Interpolation Function. |
priyank12p | 0:b0c4c25d37ab | 5944 | * @param[in] *pYData pointer to Q7 Linear Interpolation table |
priyank12p | 0:b0c4c25d37ab | 5945 | * @param[in] x input sample to process |
priyank12p | 0:b0c4c25d37ab | 5946 | * @param[in] nValues number of table values |
priyank12p | 0:b0c4c25d37ab | 5947 | * @return y processed output sample. |
priyank12p | 0:b0c4c25d37ab | 5948 | * |
priyank12p | 0:b0c4c25d37ab | 5949 | * \par |
priyank12p | 0:b0c4c25d37ab | 5950 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
priyank12p | 0:b0c4c25d37ab | 5951 | * This function can support maximum of table size 2^12. |
priyank12p | 0:b0c4c25d37ab | 5952 | */ |
priyank12p | 0:b0c4c25d37ab | 5953 | |
priyank12p | 0:b0c4c25d37ab | 5954 | |
priyank12p | 0:b0c4c25d37ab | 5955 | static __INLINE q7_t arm_linear_interp_q7( |
priyank12p | 0:b0c4c25d37ab | 5956 | q7_t * pYData, |
priyank12p | 0:b0c4c25d37ab | 5957 | q31_t x, |
priyank12p | 0:b0c4c25d37ab | 5958 | uint32_t nValues) |
priyank12p | 0:b0c4c25d37ab | 5959 | { |
priyank12p | 0:b0c4c25d37ab | 5960 | q31_t y; /* output */ |
priyank12p | 0:b0c4c25d37ab | 5961 | q7_t y0, y1; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5962 | q31_t fract; /* fractional part */ |
priyank12p | 0:b0c4c25d37ab | 5963 | uint32_t index; /* Index to read nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 5964 | |
priyank12p | 0:b0c4c25d37ab | 5965 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 5966 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 5967 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 5968 | if (x < 0) |
priyank12p | 0:b0c4c25d37ab | 5969 | { |
priyank12p | 0:b0c4c25d37ab | 5970 | return (pYData[0]); |
priyank12p | 0:b0c4c25d37ab | 5971 | } |
priyank12p | 0:b0c4c25d37ab | 5972 | index = (x >> 20) & 0xfff; |
priyank12p | 0:b0c4c25d37ab | 5973 | |
priyank12p | 0:b0c4c25d37ab | 5974 | |
priyank12p | 0:b0c4c25d37ab | 5975 | if(index >= (nValues - 1)) |
priyank12p | 0:b0c4c25d37ab | 5976 | { |
priyank12p | 0:b0c4c25d37ab | 5977 | return (pYData[nValues - 1]); |
priyank12p | 0:b0c4c25d37ab | 5978 | } |
priyank12p | 0:b0c4c25d37ab | 5979 | else |
priyank12p | 0:b0c4c25d37ab | 5980 | { |
priyank12p | 0:b0c4c25d37ab | 5981 | |
priyank12p | 0:b0c4c25d37ab | 5982 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 5983 | /* fract is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 5984 | fract = (x & 0x000FFFFF); |
priyank12p | 0:b0c4c25d37ab | 5985 | |
priyank12p | 0:b0c4c25d37ab | 5986 | /* Read two nearest output values from the index and are in 1.7(q7) format */ |
priyank12p | 0:b0c4c25d37ab | 5987 | y0 = pYData[index]; |
priyank12p | 0:b0c4c25d37ab | 5988 | y1 = pYData[index + 1u]; |
priyank12p | 0:b0c4c25d37ab | 5989 | |
priyank12p | 0:b0c4c25d37ab | 5990 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ |
priyank12p | 0:b0c4c25d37ab | 5991 | y = ((y0 * (0xFFFFF - fract))); |
priyank12p | 0:b0c4c25d37ab | 5992 | |
priyank12p | 0:b0c4c25d37ab | 5993 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ |
priyank12p | 0:b0c4c25d37ab | 5994 | y += (y1 * fract); |
priyank12p | 0:b0c4c25d37ab | 5995 | |
priyank12p | 0:b0c4c25d37ab | 5996 | /* convert y to 1.7(q7) format */ |
priyank12p | 0:b0c4c25d37ab | 5997 | return (y >> 20u); |
priyank12p | 0:b0c4c25d37ab | 5998 | |
priyank12p | 0:b0c4c25d37ab | 5999 | } |
priyank12p | 0:b0c4c25d37ab | 6000 | |
priyank12p | 0:b0c4c25d37ab | 6001 | } |
priyank12p | 0:b0c4c25d37ab | 6002 | /** |
priyank12p | 0:b0c4c25d37ab | 6003 | * @} end of LinearInterpolate group |
priyank12p | 0:b0c4c25d37ab | 6004 | */ |
priyank12p | 0:b0c4c25d37ab | 6005 | |
priyank12p | 0:b0c4c25d37ab | 6006 | /** |
priyank12p | 0:b0c4c25d37ab | 6007 | * @brief Fast approximation to the trigonometric sine function for floating-point data. |
priyank12p | 0:b0c4c25d37ab | 6008 | * @param[in] x input value in radians. |
priyank12p | 0:b0c4c25d37ab | 6009 | * @return sin(x). |
priyank12p | 0:b0c4c25d37ab | 6010 | */ |
priyank12p | 0:b0c4c25d37ab | 6011 | |
priyank12p | 0:b0c4c25d37ab | 6012 | float32_t arm_sin_f32( |
priyank12p | 0:b0c4c25d37ab | 6013 | float32_t x); |
priyank12p | 0:b0c4c25d37ab | 6014 | |
priyank12p | 0:b0c4c25d37ab | 6015 | /** |
priyank12p | 0:b0c4c25d37ab | 6016 | * @brief Fast approximation to the trigonometric sine function for Q31 data. |
priyank12p | 0:b0c4c25d37ab | 6017 | * @param[in] x Scaled input value in radians. |
priyank12p | 0:b0c4c25d37ab | 6018 | * @return sin(x). |
priyank12p | 0:b0c4c25d37ab | 6019 | */ |
priyank12p | 0:b0c4c25d37ab | 6020 | |
priyank12p | 0:b0c4c25d37ab | 6021 | q31_t arm_sin_q31( |
priyank12p | 0:b0c4c25d37ab | 6022 | q31_t x); |
priyank12p | 0:b0c4c25d37ab | 6023 | |
priyank12p | 0:b0c4c25d37ab | 6024 | /** |
priyank12p | 0:b0c4c25d37ab | 6025 | * @brief Fast approximation to the trigonometric sine function for Q15 data. |
priyank12p | 0:b0c4c25d37ab | 6026 | * @param[in] x Scaled input value in radians. |
priyank12p | 0:b0c4c25d37ab | 6027 | * @return sin(x). |
priyank12p | 0:b0c4c25d37ab | 6028 | */ |
priyank12p | 0:b0c4c25d37ab | 6029 | |
priyank12p | 0:b0c4c25d37ab | 6030 | q15_t arm_sin_q15( |
priyank12p | 0:b0c4c25d37ab | 6031 | q15_t x); |
priyank12p | 0:b0c4c25d37ab | 6032 | |
priyank12p | 0:b0c4c25d37ab | 6033 | /** |
priyank12p | 0:b0c4c25d37ab | 6034 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. |
priyank12p | 0:b0c4c25d37ab | 6035 | * @param[in] x input value in radians. |
priyank12p | 0:b0c4c25d37ab | 6036 | * @return cos(x). |
priyank12p | 0:b0c4c25d37ab | 6037 | */ |
priyank12p | 0:b0c4c25d37ab | 6038 | |
priyank12p | 0:b0c4c25d37ab | 6039 | float32_t arm_cos_f32( |
priyank12p | 0:b0c4c25d37ab | 6040 | float32_t x); |
priyank12p | 0:b0c4c25d37ab | 6041 | |
priyank12p | 0:b0c4c25d37ab | 6042 | /** |
priyank12p | 0:b0c4c25d37ab | 6043 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. |
priyank12p | 0:b0c4c25d37ab | 6044 | * @param[in] x Scaled input value in radians. |
priyank12p | 0:b0c4c25d37ab | 6045 | * @return cos(x). |
priyank12p | 0:b0c4c25d37ab | 6046 | */ |
priyank12p | 0:b0c4c25d37ab | 6047 | |
priyank12p | 0:b0c4c25d37ab | 6048 | q31_t arm_cos_q31( |
priyank12p | 0:b0c4c25d37ab | 6049 | q31_t x); |
priyank12p | 0:b0c4c25d37ab | 6050 | |
priyank12p | 0:b0c4c25d37ab | 6051 | /** |
priyank12p | 0:b0c4c25d37ab | 6052 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. |
priyank12p | 0:b0c4c25d37ab | 6053 | * @param[in] x Scaled input value in radians. |
priyank12p | 0:b0c4c25d37ab | 6054 | * @return cos(x). |
priyank12p | 0:b0c4c25d37ab | 6055 | */ |
priyank12p | 0:b0c4c25d37ab | 6056 | |
priyank12p | 0:b0c4c25d37ab | 6057 | q15_t arm_cos_q15( |
priyank12p | 0:b0c4c25d37ab | 6058 | q15_t x); |
priyank12p | 0:b0c4c25d37ab | 6059 | |
priyank12p | 0:b0c4c25d37ab | 6060 | |
priyank12p | 0:b0c4c25d37ab | 6061 | /** |
priyank12p | 0:b0c4c25d37ab | 6062 | * @ingroup groupFastMath |
priyank12p | 0:b0c4c25d37ab | 6063 | */ |
priyank12p | 0:b0c4c25d37ab | 6064 | |
priyank12p | 0:b0c4c25d37ab | 6065 | |
priyank12p | 0:b0c4c25d37ab | 6066 | /** |
priyank12p | 0:b0c4c25d37ab | 6067 | * @defgroup SQRT Square Root |
priyank12p | 0:b0c4c25d37ab | 6068 | * |
priyank12p | 0:b0c4c25d37ab | 6069 | * Computes the square root of a number. |
priyank12p | 0:b0c4c25d37ab | 6070 | * There are separate functions for Q15, Q31, and floating-point data types. |
priyank12p | 0:b0c4c25d37ab | 6071 | * The square root function is computed using the Newton-Raphson algorithm. |
priyank12p | 0:b0c4c25d37ab | 6072 | * This is an iterative algorithm of the form: |
priyank12p | 0:b0c4c25d37ab | 6073 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 6074 | * x1 = x0 - f(x0)/f'(x0) |
priyank12p | 0:b0c4c25d37ab | 6075 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 6076 | * where <code>x1</code> is the current estimate, |
priyank12p | 0:b0c4c25d37ab | 6077 | * <code>x0</code> is the previous estimate, and |
priyank12p | 0:b0c4c25d37ab | 6078 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>. |
priyank12p | 0:b0c4c25d37ab | 6079 | * For the square root function, the algorithm reduces to: |
priyank12p | 0:b0c4c25d37ab | 6080 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 6081 | * x0 = in/2 [initial guess] |
priyank12p | 0:b0c4c25d37ab | 6082 | * x1 = 1/2 * ( x0 + in / x0) [each iteration] |
priyank12p | 0:b0c4c25d37ab | 6083 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 6084 | */ |
priyank12p | 0:b0c4c25d37ab | 6085 | |
priyank12p | 0:b0c4c25d37ab | 6086 | |
priyank12p | 0:b0c4c25d37ab | 6087 | /** |
priyank12p | 0:b0c4c25d37ab | 6088 | * @addtogroup SQRT |
priyank12p | 0:b0c4c25d37ab | 6089 | * @{ |
priyank12p | 0:b0c4c25d37ab | 6090 | */ |
priyank12p | 0:b0c4c25d37ab | 6091 | |
priyank12p | 0:b0c4c25d37ab | 6092 | /** |
priyank12p | 0:b0c4c25d37ab | 6093 | * @brief Floating-point square root function. |
priyank12p | 0:b0c4c25d37ab | 6094 | * @param[in] in input value. |
priyank12p | 0:b0c4c25d37ab | 6095 | * @param[out] *pOut square root of input value. |
priyank12p | 0:b0c4c25d37ab | 6096 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
priyank12p | 0:b0c4c25d37ab | 6097 | * <code>in</code> is negative value and returns zero output for negative values. |
priyank12p | 0:b0c4c25d37ab | 6098 | */ |
priyank12p | 0:b0c4c25d37ab | 6099 | |
priyank12p | 0:b0c4c25d37ab | 6100 | static __INLINE arm_status arm_sqrt_f32( |
priyank12p | 0:b0c4c25d37ab | 6101 | float32_t in, |
priyank12p | 0:b0c4c25d37ab | 6102 | float32_t * pOut) |
priyank12p | 0:b0c4c25d37ab | 6103 | { |
priyank12p | 0:b0c4c25d37ab | 6104 | if(in >= 0.0f) |
priyank12p | 0:b0c4c25d37ab | 6105 | { |
priyank12p | 0:b0c4c25d37ab | 6106 | |
priyank12p | 0:b0c4c25d37ab | 6107 | // #if __FPU_USED |
priyank12p | 0:b0c4c25d37ab | 6108 | #if (__FPU_USED == 1) && defined ( __CC_ARM ) |
priyank12p | 0:b0c4c25d37ab | 6109 | *pOut = __sqrtf(in); |
priyank12p | 0:b0c4c25d37ab | 6110 | #else |
priyank12p | 0:b0c4c25d37ab | 6111 | *pOut = sqrtf(in); |
priyank12p | 0:b0c4c25d37ab | 6112 | #endif |
priyank12p | 0:b0c4c25d37ab | 6113 | |
priyank12p | 0:b0c4c25d37ab | 6114 | return (ARM_MATH_SUCCESS); |
priyank12p | 0:b0c4c25d37ab | 6115 | } |
priyank12p | 0:b0c4c25d37ab | 6116 | else |
priyank12p | 0:b0c4c25d37ab | 6117 | { |
priyank12p | 0:b0c4c25d37ab | 6118 | *pOut = 0.0f; |
priyank12p | 0:b0c4c25d37ab | 6119 | return (ARM_MATH_ARGUMENT_ERROR); |
priyank12p | 0:b0c4c25d37ab | 6120 | } |
priyank12p | 0:b0c4c25d37ab | 6121 | |
priyank12p | 0:b0c4c25d37ab | 6122 | } |
priyank12p | 0:b0c4c25d37ab | 6123 | |
priyank12p | 0:b0c4c25d37ab | 6124 | |
priyank12p | 0:b0c4c25d37ab | 6125 | /** |
priyank12p | 0:b0c4c25d37ab | 6126 | * @brief Q31 square root function. |
priyank12p | 0:b0c4c25d37ab | 6127 | * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. |
priyank12p | 0:b0c4c25d37ab | 6128 | * @param[out] *pOut square root of input value. |
priyank12p | 0:b0c4c25d37ab | 6129 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
priyank12p | 0:b0c4c25d37ab | 6130 | * <code>in</code> is negative value and returns zero output for negative values. |
priyank12p | 0:b0c4c25d37ab | 6131 | */ |
priyank12p | 0:b0c4c25d37ab | 6132 | arm_status arm_sqrt_q31( |
priyank12p | 0:b0c4c25d37ab | 6133 | q31_t in, |
priyank12p | 0:b0c4c25d37ab | 6134 | q31_t * pOut); |
priyank12p | 0:b0c4c25d37ab | 6135 | |
priyank12p | 0:b0c4c25d37ab | 6136 | /** |
priyank12p | 0:b0c4c25d37ab | 6137 | * @brief Q15 square root function. |
priyank12p | 0:b0c4c25d37ab | 6138 | * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. |
priyank12p | 0:b0c4c25d37ab | 6139 | * @param[out] *pOut square root of input value. |
priyank12p | 0:b0c4c25d37ab | 6140 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
priyank12p | 0:b0c4c25d37ab | 6141 | * <code>in</code> is negative value and returns zero output for negative values. |
priyank12p | 0:b0c4c25d37ab | 6142 | */ |
priyank12p | 0:b0c4c25d37ab | 6143 | arm_status arm_sqrt_q15( |
priyank12p | 0:b0c4c25d37ab | 6144 | q15_t in, |
priyank12p | 0:b0c4c25d37ab | 6145 | q15_t * pOut); |
priyank12p | 0:b0c4c25d37ab | 6146 | |
priyank12p | 0:b0c4c25d37ab | 6147 | /** |
priyank12p | 0:b0c4c25d37ab | 6148 | * @} end of SQRT group |
priyank12p | 0:b0c4c25d37ab | 6149 | */ |
priyank12p | 0:b0c4c25d37ab | 6150 | |
priyank12p | 0:b0c4c25d37ab | 6151 | |
priyank12p | 0:b0c4c25d37ab | 6152 | |
priyank12p | 0:b0c4c25d37ab | 6153 | |
priyank12p | 0:b0c4c25d37ab | 6154 | |
priyank12p | 0:b0c4c25d37ab | 6155 | |
priyank12p | 0:b0c4c25d37ab | 6156 | /** |
priyank12p | 0:b0c4c25d37ab | 6157 | * @brief floating-point Circular write function. |
priyank12p | 0:b0c4c25d37ab | 6158 | */ |
priyank12p | 0:b0c4c25d37ab | 6159 | |
priyank12p | 0:b0c4c25d37ab | 6160 | static __INLINE void arm_circularWrite_f32( |
priyank12p | 0:b0c4c25d37ab | 6161 | int32_t * circBuffer, |
priyank12p | 0:b0c4c25d37ab | 6162 | int32_t L, |
priyank12p | 0:b0c4c25d37ab | 6163 | uint16_t * writeOffset, |
priyank12p | 0:b0c4c25d37ab | 6164 | int32_t bufferInc, |
priyank12p | 0:b0c4c25d37ab | 6165 | const int32_t * src, |
priyank12p | 0:b0c4c25d37ab | 6166 | int32_t srcInc, |
priyank12p | 0:b0c4c25d37ab | 6167 | uint32_t blockSize) |
priyank12p | 0:b0c4c25d37ab | 6168 | { |
priyank12p | 0:b0c4c25d37ab | 6169 | uint32_t i = 0u; |
priyank12p | 0:b0c4c25d37ab | 6170 | int32_t wOffset; |
priyank12p | 0:b0c4c25d37ab | 6171 | |
priyank12p | 0:b0c4c25d37ab | 6172 | /* Copy the value of Index pointer that points |
priyank12p | 0:b0c4c25d37ab | 6173 | * to the current location where the input samples to be copied */ |
priyank12p | 0:b0c4c25d37ab | 6174 | wOffset = *writeOffset; |
priyank12p | 0:b0c4c25d37ab | 6175 | |
priyank12p | 0:b0c4c25d37ab | 6176 | /* Loop over the blockSize */ |
priyank12p | 0:b0c4c25d37ab | 6177 | i = blockSize; |
priyank12p | 0:b0c4c25d37ab | 6178 | |
priyank12p | 0:b0c4c25d37ab | 6179 | while(i > 0u) |
priyank12p | 0:b0c4c25d37ab | 6180 | { |
priyank12p | 0:b0c4c25d37ab | 6181 | /* copy the input sample to the circular buffer */ |
priyank12p | 0:b0c4c25d37ab | 6182 | circBuffer[wOffset] = *src; |
priyank12p | 0:b0c4c25d37ab | 6183 | |
priyank12p | 0:b0c4c25d37ab | 6184 | /* Update the input pointer */ |
priyank12p | 0:b0c4c25d37ab | 6185 | src += srcInc; |
priyank12p | 0:b0c4c25d37ab | 6186 | |
priyank12p | 0:b0c4c25d37ab | 6187 | /* Circularly update wOffset. Watch out for positive and negative value */ |
priyank12p | 0:b0c4c25d37ab | 6188 | wOffset += bufferInc; |
priyank12p | 0:b0c4c25d37ab | 6189 | if(wOffset >= L) |
priyank12p | 0:b0c4c25d37ab | 6190 | wOffset -= L; |
priyank12p | 0:b0c4c25d37ab | 6191 | |
priyank12p | 0:b0c4c25d37ab | 6192 | /* Decrement the loop counter */ |
priyank12p | 0:b0c4c25d37ab | 6193 | i--; |
priyank12p | 0:b0c4c25d37ab | 6194 | } |
priyank12p | 0:b0c4c25d37ab | 6195 | |
priyank12p | 0:b0c4c25d37ab | 6196 | /* Update the index pointer */ |
priyank12p | 0:b0c4c25d37ab | 6197 | *writeOffset = wOffset; |
priyank12p | 0:b0c4c25d37ab | 6198 | } |
priyank12p | 0:b0c4c25d37ab | 6199 | |
priyank12p | 0:b0c4c25d37ab | 6200 | |
priyank12p | 0:b0c4c25d37ab | 6201 | |
priyank12p | 0:b0c4c25d37ab | 6202 | /** |
priyank12p | 0:b0c4c25d37ab | 6203 | * @brief floating-point Circular Read function. |
priyank12p | 0:b0c4c25d37ab | 6204 | */ |
priyank12p | 0:b0c4c25d37ab | 6205 | static __INLINE void arm_circularRead_f32( |
priyank12p | 0:b0c4c25d37ab | 6206 | int32_t * circBuffer, |
priyank12p | 0:b0c4c25d37ab | 6207 | int32_t L, |
priyank12p | 0:b0c4c25d37ab | 6208 | int32_t * readOffset, |
priyank12p | 0:b0c4c25d37ab | 6209 | int32_t bufferInc, |
priyank12p | 0:b0c4c25d37ab | 6210 | int32_t * dst, |
priyank12p | 0:b0c4c25d37ab | 6211 | int32_t * dst_base, |
priyank12p | 0:b0c4c25d37ab | 6212 | int32_t dst_length, |
priyank12p | 0:b0c4c25d37ab | 6213 | int32_t dstInc, |
priyank12p | 0:b0c4c25d37ab | 6214 | uint32_t blockSize) |
priyank12p | 0:b0c4c25d37ab | 6215 | { |
priyank12p | 0:b0c4c25d37ab | 6216 | uint32_t i = 0u; |
priyank12p | 0:b0c4c25d37ab | 6217 | int32_t rOffset, dst_end; |
priyank12p | 0:b0c4c25d37ab | 6218 | |
priyank12p | 0:b0c4c25d37ab | 6219 | /* Copy the value of Index pointer that points |
priyank12p | 0:b0c4c25d37ab | 6220 | * to the current location from where the input samples to be read */ |
priyank12p | 0:b0c4c25d37ab | 6221 | rOffset = *readOffset; |
priyank12p | 0:b0c4c25d37ab | 6222 | dst_end = (int32_t) (dst_base + dst_length); |
priyank12p | 0:b0c4c25d37ab | 6223 | |
priyank12p | 0:b0c4c25d37ab | 6224 | /* Loop over the blockSize */ |
priyank12p | 0:b0c4c25d37ab | 6225 | i = blockSize; |
priyank12p | 0:b0c4c25d37ab | 6226 | |
priyank12p | 0:b0c4c25d37ab | 6227 | while(i > 0u) |
priyank12p | 0:b0c4c25d37ab | 6228 | { |
priyank12p | 0:b0c4c25d37ab | 6229 | /* copy the sample from the circular buffer to the destination buffer */ |
priyank12p | 0:b0c4c25d37ab | 6230 | *dst = circBuffer[rOffset]; |
priyank12p | 0:b0c4c25d37ab | 6231 | |
priyank12p | 0:b0c4c25d37ab | 6232 | /* Update the input pointer */ |
priyank12p | 0:b0c4c25d37ab | 6233 | dst += dstInc; |
priyank12p | 0:b0c4c25d37ab | 6234 | |
priyank12p | 0:b0c4c25d37ab | 6235 | if(dst == (int32_t *) dst_end) |
priyank12p | 0:b0c4c25d37ab | 6236 | { |
priyank12p | 0:b0c4c25d37ab | 6237 | dst = dst_base; |
priyank12p | 0:b0c4c25d37ab | 6238 | } |
priyank12p | 0:b0c4c25d37ab | 6239 | |
priyank12p | 0:b0c4c25d37ab | 6240 | /* Circularly update rOffset. Watch out for positive and negative value */ |
priyank12p | 0:b0c4c25d37ab | 6241 | rOffset += bufferInc; |
priyank12p | 0:b0c4c25d37ab | 6242 | |
priyank12p | 0:b0c4c25d37ab | 6243 | if(rOffset >= L) |
priyank12p | 0:b0c4c25d37ab | 6244 | { |
priyank12p | 0:b0c4c25d37ab | 6245 | rOffset -= L; |
priyank12p | 0:b0c4c25d37ab | 6246 | } |
priyank12p | 0:b0c4c25d37ab | 6247 | |
priyank12p | 0:b0c4c25d37ab | 6248 | /* Decrement the loop counter */ |
priyank12p | 0:b0c4c25d37ab | 6249 | i--; |
priyank12p | 0:b0c4c25d37ab | 6250 | } |
priyank12p | 0:b0c4c25d37ab | 6251 | |
priyank12p | 0:b0c4c25d37ab | 6252 | /* Update the index pointer */ |
priyank12p | 0:b0c4c25d37ab | 6253 | *readOffset = rOffset; |
priyank12p | 0:b0c4c25d37ab | 6254 | } |
priyank12p | 0:b0c4c25d37ab | 6255 | |
priyank12p | 0:b0c4c25d37ab | 6256 | /** |
priyank12p | 0:b0c4c25d37ab | 6257 | * @brief Q15 Circular write function. |
priyank12p | 0:b0c4c25d37ab | 6258 | */ |
priyank12p | 0:b0c4c25d37ab | 6259 | |
priyank12p | 0:b0c4c25d37ab | 6260 | static __INLINE void arm_circularWrite_q15( |
priyank12p | 0:b0c4c25d37ab | 6261 | q15_t * circBuffer, |
priyank12p | 0:b0c4c25d37ab | 6262 | int32_t L, |
priyank12p | 0:b0c4c25d37ab | 6263 | uint16_t * writeOffset, |
priyank12p | 0:b0c4c25d37ab | 6264 | int32_t bufferInc, |
priyank12p | 0:b0c4c25d37ab | 6265 | const q15_t * src, |
priyank12p | 0:b0c4c25d37ab | 6266 | int32_t srcInc, |
priyank12p | 0:b0c4c25d37ab | 6267 | uint32_t blockSize) |
priyank12p | 0:b0c4c25d37ab | 6268 | { |
priyank12p | 0:b0c4c25d37ab | 6269 | uint32_t i = 0u; |
priyank12p | 0:b0c4c25d37ab | 6270 | int32_t wOffset; |
priyank12p | 0:b0c4c25d37ab | 6271 | |
priyank12p | 0:b0c4c25d37ab | 6272 | /* Copy the value of Index pointer that points |
priyank12p | 0:b0c4c25d37ab | 6273 | * to the current location where the input samples to be copied */ |
priyank12p | 0:b0c4c25d37ab | 6274 | wOffset = *writeOffset; |
priyank12p | 0:b0c4c25d37ab | 6275 | |
priyank12p | 0:b0c4c25d37ab | 6276 | /* Loop over the blockSize */ |
priyank12p | 0:b0c4c25d37ab | 6277 | i = blockSize; |
priyank12p | 0:b0c4c25d37ab | 6278 | |
priyank12p | 0:b0c4c25d37ab | 6279 | while(i > 0u) |
priyank12p | 0:b0c4c25d37ab | 6280 | { |
priyank12p | 0:b0c4c25d37ab | 6281 | /* copy the input sample to the circular buffer */ |
priyank12p | 0:b0c4c25d37ab | 6282 | circBuffer[wOffset] = *src; |
priyank12p | 0:b0c4c25d37ab | 6283 | |
priyank12p | 0:b0c4c25d37ab | 6284 | /* Update the input pointer */ |
priyank12p | 0:b0c4c25d37ab | 6285 | src += srcInc; |
priyank12p | 0:b0c4c25d37ab | 6286 | |
priyank12p | 0:b0c4c25d37ab | 6287 | /* Circularly update wOffset. Watch out for positive and negative value */ |
priyank12p | 0:b0c4c25d37ab | 6288 | wOffset += bufferInc; |
priyank12p | 0:b0c4c25d37ab | 6289 | if(wOffset >= L) |
priyank12p | 0:b0c4c25d37ab | 6290 | wOffset -= L; |
priyank12p | 0:b0c4c25d37ab | 6291 | |
priyank12p | 0:b0c4c25d37ab | 6292 | /* Decrement the loop counter */ |
priyank12p | 0:b0c4c25d37ab | 6293 | i--; |
priyank12p | 0:b0c4c25d37ab | 6294 | } |
priyank12p | 0:b0c4c25d37ab | 6295 | |
priyank12p | 0:b0c4c25d37ab | 6296 | /* Update the index pointer */ |
priyank12p | 0:b0c4c25d37ab | 6297 | *writeOffset = wOffset; |
priyank12p | 0:b0c4c25d37ab | 6298 | } |
priyank12p | 0:b0c4c25d37ab | 6299 | |
priyank12p | 0:b0c4c25d37ab | 6300 | |
priyank12p | 0:b0c4c25d37ab | 6301 | |
priyank12p | 0:b0c4c25d37ab | 6302 | /** |
priyank12p | 0:b0c4c25d37ab | 6303 | * @brief Q15 Circular Read function. |
priyank12p | 0:b0c4c25d37ab | 6304 | */ |
priyank12p | 0:b0c4c25d37ab | 6305 | static __INLINE void arm_circularRead_q15( |
priyank12p | 0:b0c4c25d37ab | 6306 | q15_t * circBuffer, |
priyank12p | 0:b0c4c25d37ab | 6307 | int32_t L, |
priyank12p | 0:b0c4c25d37ab | 6308 | int32_t * readOffset, |
priyank12p | 0:b0c4c25d37ab | 6309 | int32_t bufferInc, |
priyank12p | 0:b0c4c25d37ab | 6310 | q15_t * dst, |
priyank12p | 0:b0c4c25d37ab | 6311 | q15_t * dst_base, |
priyank12p | 0:b0c4c25d37ab | 6312 | int32_t dst_length, |
priyank12p | 0:b0c4c25d37ab | 6313 | int32_t dstInc, |
priyank12p | 0:b0c4c25d37ab | 6314 | uint32_t blockSize) |
priyank12p | 0:b0c4c25d37ab | 6315 | { |
priyank12p | 0:b0c4c25d37ab | 6316 | uint32_t i = 0; |
priyank12p | 0:b0c4c25d37ab | 6317 | int32_t rOffset, dst_end; |
priyank12p | 0:b0c4c25d37ab | 6318 | |
priyank12p | 0:b0c4c25d37ab | 6319 | /* Copy the value of Index pointer that points |
priyank12p | 0:b0c4c25d37ab | 6320 | * to the current location from where the input samples to be read */ |
priyank12p | 0:b0c4c25d37ab | 6321 | rOffset = *readOffset; |
priyank12p | 0:b0c4c25d37ab | 6322 | |
priyank12p | 0:b0c4c25d37ab | 6323 | dst_end = (int32_t) (dst_base + dst_length); |
priyank12p | 0:b0c4c25d37ab | 6324 | |
priyank12p | 0:b0c4c25d37ab | 6325 | /* Loop over the blockSize */ |
priyank12p | 0:b0c4c25d37ab | 6326 | i = blockSize; |
priyank12p | 0:b0c4c25d37ab | 6327 | |
priyank12p | 0:b0c4c25d37ab | 6328 | while(i > 0u) |
priyank12p | 0:b0c4c25d37ab | 6329 | { |
priyank12p | 0:b0c4c25d37ab | 6330 | /* copy the sample from the circular buffer to the destination buffer */ |
priyank12p | 0:b0c4c25d37ab | 6331 | *dst = circBuffer[rOffset]; |
priyank12p | 0:b0c4c25d37ab | 6332 | |
priyank12p | 0:b0c4c25d37ab | 6333 | /* Update the input pointer */ |
priyank12p | 0:b0c4c25d37ab | 6334 | dst += dstInc; |
priyank12p | 0:b0c4c25d37ab | 6335 | |
priyank12p | 0:b0c4c25d37ab | 6336 | if(dst == (q15_t *) dst_end) |
priyank12p | 0:b0c4c25d37ab | 6337 | { |
priyank12p | 0:b0c4c25d37ab | 6338 | dst = dst_base; |
priyank12p | 0:b0c4c25d37ab | 6339 | } |
priyank12p | 0:b0c4c25d37ab | 6340 | |
priyank12p | 0:b0c4c25d37ab | 6341 | /* Circularly update wOffset. Watch out for positive and negative value */ |
priyank12p | 0:b0c4c25d37ab | 6342 | rOffset += bufferInc; |
priyank12p | 0:b0c4c25d37ab | 6343 | |
priyank12p | 0:b0c4c25d37ab | 6344 | if(rOffset >= L) |
priyank12p | 0:b0c4c25d37ab | 6345 | { |
priyank12p | 0:b0c4c25d37ab | 6346 | rOffset -= L; |
priyank12p | 0:b0c4c25d37ab | 6347 | } |
priyank12p | 0:b0c4c25d37ab | 6348 | |
priyank12p | 0:b0c4c25d37ab | 6349 | /* Decrement the loop counter */ |
priyank12p | 0:b0c4c25d37ab | 6350 | i--; |
priyank12p | 0:b0c4c25d37ab | 6351 | } |
priyank12p | 0:b0c4c25d37ab | 6352 | |
priyank12p | 0:b0c4c25d37ab | 6353 | /* Update the index pointer */ |
priyank12p | 0:b0c4c25d37ab | 6354 | *readOffset = rOffset; |
priyank12p | 0:b0c4c25d37ab | 6355 | } |
priyank12p | 0:b0c4c25d37ab | 6356 | |
priyank12p | 0:b0c4c25d37ab | 6357 | |
priyank12p | 0:b0c4c25d37ab | 6358 | /** |
priyank12p | 0:b0c4c25d37ab | 6359 | * @brief Q7 Circular write function. |
priyank12p | 0:b0c4c25d37ab | 6360 | */ |
priyank12p | 0:b0c4c25d37ab | 6361 | |
priyank12p | 0:b0c4c25d37ab | 6362 | static __INLINE void arm_circularWrite_q7( |
priyank12p | 0:b0c4c25d37ab | 6363 | q7_t * circBuffer, |
priyank12p | 0:b0c4c25d37ab | 6364 | int32_t L, |
priyank12p | 0:b0c4c25d37ab | 6365 | uint16_t * writeOffset, |
priyank12p | 0:b0c4c25d37ab | 6366 | int32_t bufferInc, |
priyank12p | 0:b0c4c25d37ab | 6367 | const q7_t * src, |
priyank12p | 0:b0c4c25d37ab | 6368 | int32_t srcInc, |
priyank12p | 0:b0c4c25d37ab | 6369 | uint32_t blockSize) |
priyank12p | 0:b0c4c25d37ab | 6370 | { |
priyank12p | 0:b0c4c25d37ab | 6371 | uint32_t i = 0u; |
priyank12p | 0:b0c4c25d37ab | 6372 | int32_t wOffset; |
priyank12p | 0:b0c4c25d37ab | 6373 | |
priyank12p | 0:b0c4c25d37ab | 6374 | /* Copy the value of Index pointer that points |
priyank12p | 0:b0c4c25d37ab | 6375 | * to the current location where the input samples to be copied */ |
priyank12p | 0:b0c4c25d37ab | 6376 | wOffset = *writeOffset; |
priyank12p | 0:b0c4c25d37ab | 6377 | |
priyank12p | 0:b0c4c25d37ab | 6378 | /* Loop over the blockSize */ |
priyank12p | 0:b0c4c25d37ab | 6379 | i = blockSize; |
priyank12p | 0:b0c4c25d37ab | 6380 | |
priyank12p | 0:b0c4c25d37ab | 6381 | while(i > 0u) |
priyank12p | 0:b0c4c25d37ab | 6382 | { |
priyank12p | 0:b0c4c25d37ab | 6383 | /* copy the input sample to the circular buffer */ |
priyank12p | 0:b0c4c25d37ab | 6384 | circBuffer[wOffset] = *src; |
priyank12p | 0:b0c4c25d37ab | 6385 | |
priyank12p | 0:b0c4c25d37ab | 6386 | /* Update the input pointer */ |
priyank12p | 0:b0c4c25d37ab | 6387 | src += srcInc; |
priyank12p | 0:b0c4c25d37ab | 6388 | |
priyank12p | 0:b0c4c25d37ab | 6389 | /* Circularly update wOffset. Watch out for positive and negative value */ |
priyank12p | 0:b0c4c25d37ab | 6390 | wOffset += bufferInc; |
priyank12p | 0:b0c4c25d37ab | 6391 | if(wOffset >= L) |
priyank12p | 0:b0c4c25d37ab | 6392 | wOffset -= L; |
priyank12p | 0:b0c4c25d37ab | 6393 | |
priyank12p | 0:b0c4c25d37ab | 6394 | /* Decrement the loop counter */ |
priyank12p | 0:b0c4c25d37ab | 6395 | i--; |
priyank12p | 0:b0c4c25d37ab | 6396 | } |
priyank12p | 0:b0c4c25d37ab | 6397 | |
priyank12p | 0:b0c4c25d37ab | 6398 | /* Update the index pointer */ |
priyank12p | 0:b0c4c25d37ab | 6399 | *writeOffset = wOffset; |
priyank12p | 0:b0c4c25d37ab | 6400 | } |
priyank12p | 0:b0c4c25d37ab | 6401 | |
priyank12p | 0:b0c4c25d37ab | 6402 | |
priyank12p | 0:b0c4c25d37ab | 6403 | |
priyank12p | 0:b0c4c25d37ab | 6404 | /** |
priyank12p | 0:b0c4c25d37ab | 6405 | * @brief Q7 Circular Read function. |
priyank12p | 0:b0c4c25d37ab | 6406 | */ |
priyank12p | 0:b0c4c25d37ab | 6407 | static __INLINE void arm_circularRead_q7( |
priyank12p | 0:b0c4c25d37ab | 6408 | q7_t * circBuffer, |
priyank12p | 0:b0c4c25d37ab | 6409 | int32_t L, |
priyank12p | 0:b0c4c25d37ab | 6410 | int32_t * readOffset, |
priyank12p | 0:b0c4c25d37ab | 6411 | int32_t bufferInc, |
priyank12p | 0:b0c4c25d37ab | 6412 | q7_t * dst, |
priyank12p | 0:b0c4c25d37ab | 6413 | q7_t * dst_base, |
priyank12p | 0:b0c4c25d37ab | 6414 | int32_t dst_length, |
priyank12p | 0:b0c4c25d37ab | 6415 | int32_t dstInc, |
priyank12p | 0:b0c4c25d37ab | 6416 | uint32_t blockSize) |
priyank12p | 0:b0c4c25d37ab | 6417 | { |
priyank12p | 0:b0c4c25d37ab | 6418 | uint32_t i = 0; |
priyank12p | 0:b0c4c25d37ab | 6419 | int32_t rOffset, dst_end; |
priyank12p | 0:b0c4c25d37ab | 6420 | |
priyank12p | 0:b0c4c25d37ab | 6421 | /* Copy the value of Index pointer that points |
priyank12p | 0:b0c4c25d37ab | 6422 | * to the current location from where the input samples to be read */ |
priyank12p | 0:b0c4c25d37ab | 6423 | rOffset = *readOffset; |
priyank12p | 0:b0c4c25d37ab | 6424 | |
priyank12p | 0:b0c4c25d37ab | 6425 | dst_end = (int32_t) (dst_base + dst_length); |
priyank12p | 0:b0c4c25d37ab | 6426 | |
priyank12p | 0:b0c4c25d37ab | 6427 | /* Loop over the blockSize */ |
priyank12p | 0:b0c4c25d37ab | 6428 | i = blockSize; |
priyank12p | 0:b0c4c25d37ab | 6429 | |
priyank12p | 0:b0c4c25d37ab | 6430 | while(i > 0u) |
priyank12p | 0:b0c4c25d37ab | 6431 | { |
priyank12p | 0:b0c4c25d37ab | 6432 | /* copy the sample from the circular buffer to the destination buffer */ |
priyank12p | 0:b0c4c25d37ab | 6433 | *dst = circBuffer[rOffset]; |
priyank12p | 0:b0c4c25d37ab | 6434 | |
priyank12p | 0:b0c4c25d37ab | 6435 | /* Update the input pointer */ |
priyank12p | 0:b0c4c25d37ab | 6436 | dst += dstInc; |
priyank12p | 0:b0c4c25d37ab | 6437 | |
priyank12p | 0:b0c4c25d37ab | 6438 | if(dst == (q7_t *) dst_end) |
priyank12p | 0:b0c4c25d37ab | 6439 | { |
priyank12p | 0:b0c4c25d37ab | 6440 | dst = dst_base; |
priyank12p | 0:b0c4c25d37ab | 6441 | } |
priyank12p | 0:b0c4c25d37ab | 6442 | |
priyank12p | 0:b0c4c25d37ab | 6443 | /* Circularly update rOffset. Watch out for positive and negative value */ |
priyank12p | 0:b0c4c25d37ab | 6444 | rOffset += bufferInc; |
priyank12p | 0:b0c4c25d37ab | 6445 | |
priyank12p | 0:b0c4c25d37ab | 6446 | if(rOffset >= L) |
priyank12p | 0:b0c4c25d37ab | 6447 | { |
priyank12p | 0:b0c4c25d37ab | 6448 | rOffset -= L; |
priyank12p | 0:b0c4c25d37ab | 6449 | } |
priyank12p | 0:b0c4c25d37ab | 6450 | |
priyank12p | 0:b0c4c25d37ab | 6451 | /* Decrement the loop counter */ |
priyank12p | 0:b0c4c25d37ab | 6452 | i--; |
priyank12p | 0:b0c4c25d37ab | 6453 | } |
priyank12p | 0:b0c4c25d37ab | 6454 | |
priyank12p | 0:b0c4c25d37ab | 6455 | /* Update the index pointer */ |
priyank12p | 0:b0c4c25d37ab | 6456 | *readOffset = rOffset; |
priyank12p | 0:b0c4c25d37ab | 6457 | } |
priyank12p | 0:b0c4c25d37ab | 6458 | |
priyank12p | 0:b0c4c25d37ab | 6459 | |
priyank12p | 0:b0c4c25d37ab | 6460 | /** |
priyank12p | 0:b0c4c25d37ab | 6461 | * @brief Sum of the squares of the elements of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6462 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6463 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6464 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6465 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6466 | */ |
priyank12p | 0:b0c4c25d37ab | 6467 | |
priyank12p | 0:b0c4c25d37ab | 6468 | void arm_power_q31( |
priyank12p | 0:b0c4c25d37ab | 6469 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6470 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6471 | q63_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6472 | |
priyank12p | 0:b0c4c25d37ab | 6473 | /** |
priyank12p | 0:b0c4c25d37ab | 6474 | * @brief Sum of the squares of the elements of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6475 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6476 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6477 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6478 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6479 | */ |
priyank12p | 0:b0c4c25d37ab | 6480 | |
priyank12p | 0:b0c4c25d37ab | 6481 | void arm_power_f32( |
priyank12p | 0:b0c4c25d37ab | 6482 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6483 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6484 | float32_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6485 | |
priyank12p | 0:b0c4c25d37ab | 6486 | /** |
priyank12p | 0:b0c4c25d37ab | 6487 | * @brief Sum of the squares of the elements of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6488 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6489 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6490 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6491 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6492 | */ |
priyank12p | 0:b0c4c25d37ab | 6493 | |
priyank12p | 0:b0c4c25d37ab | 6494 | void arm_power_q15( |
priyank12p | 0:b0c4c25d37ab | 6495 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6496 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6497 | q63_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6498 | |
priyank12p | 0:b0c4c25d37ab | 6499 | /** |
priyank12p | 0:b0c4c25d37ab | 6500 | * @brief Sum of the squares of the elements of a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 6501 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6502 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6503 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6504 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6505 | */ |
priyank12p | 0:b0c4c25d37ab | 6506 | |
priyank12p | 0:b0c4c25d37ab | 6507 | void arm_power_q7( |
priyank12p | 0:b0c4c25d37ab | 6508 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6509 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6510 | q31_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6511 | |
priyank12p | 0:b0c4c25d37ab | 6512 | /** |
priyank12p | 0:b0c4c25d37ab | 6513 | * @brief Mean value of a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 6514 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6515 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6516 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6517 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6518 | */ |
priyank12p | 0:b0c4c25d37ab | 6519 | |
priyank12p | 0:b0c4c25d37ab | 6520 | void arm_mean_q7( |
priyank12p | 0:b0c4c25d37ab | 6521 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6522 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6523 | q7_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6524 | |
priyank12p | 0:b0c4c25d37ab | 6525 | /** |
priyank12p | 0:b0c4c25d37ab | 6526 | * @brief Mean value of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6527 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6528 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6529 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6530 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6531 | */ |
priyank12p | 0:b0c4c25d37ab | 6532 | void arm_mean_q15( |
priyank12p | 0:b0c4c25d37ab | 6533 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6534 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6535 | q15_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6536 | |
priyank12p | 0:b0c4c25d37ab | 6537 | /** |
priyank12p | 0:b0c4c25d37ab | 6538 | * @brief Mean value of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6539 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6540 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6541 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6542 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6543 | */ |
priyank12p | 0:b0c4c25d37ab | 6544 | void arm_mean_q31( |
priyank12p | 0:b0c4c25d37ab | 6545 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6546 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6547 | q31_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6548 | |
priyank12p | 0:b0c4c25d37ab | 6549 | /** |
priyank12p | 0:b0c4c25d37ab | 6550 | * @brief Mean value of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6551 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6552 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6553 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6554 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6555 | */ |
priyank12p | 0:b0c4c25d37ab | 6556 | void arm_mean_f32( |
priyank12p | 0:b0c4c25d37ab | 6557 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6558 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6559 | float32_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6560 | |
priyank12p | 0:b0c4c25d37ab | 6561 | /** |
priyank12p | 0:b0c4c25d37ab | 6562 | * @brief Variance of the elements of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6563 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6564 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6565 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6566 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6567 | */ |
priyank12p | 0:b0c4c25d37ab | 6568 | |
priyank12p | 0:b0c4c25d37ab | 6569 | void arm_var_f32( |
priyank12p | 0:b0c4c25d37ab | 6570 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6571 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6572 | float32_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6573 | |
priyank12p | 0:b0c4c25d37ab | 6574 | /** |
priyank12p | 0:b0c4c25d37ab | 6575 | * @brief Variance of the elements of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6576 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6577 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6578 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6579 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6580 | */ |
priyank12p | 0:b0c4c25d37ab | 6581 | |
priyank12p | 0:b0c4c25d37ab | 6582 | void arm_var_q31( |
priyank12p | 0:b0c4c25d37ab | 6583 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6584 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6585 | q31_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6586 | |
priyank12p | 0:b0c4c25d37ab | 6587 | /** |
priyank12p | 0:b0c4c25d37ab | 6588 | * @brief Variance of the elements of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6589 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6590 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6591 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6592 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6593 | */ |
priyank12p | 0:b0c4c25d37ab | 6594 | |
priyank12p | 0:b0c4c25d37ab | 6595 | void arm_var_q15( |
priyank12p | 0:b0c4c25d37ab | 6596 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6597 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6598 | q15_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6599 | |
priyank12p | 0:b0c4c25d37ab | 6600 | /** |
priyank12p | 0:b0c4c25d37ab | 6601 | * @brief Root Mean Square of the elements of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6602 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6603 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6604 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6605 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6606 | */ |
priyank12p | 0:b0c4c25d37ab | 6607 | |
priyank12p | 0:b0c4c25d37ab | 6608 | void arm_rms_f32( |
priyank12p | 0:b0c4c25d37ab | 6609 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6610 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6611 | float32_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6612 | |
priyank12p | 0:b0c4c25d37ab | 6613 | /** |
priyank12p | 0:b0c4c25d37ab | 6614 | * @brief Root Mean Square of the elements of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6615 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6616 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6617 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6618 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6619 | */ |
priyank12p | 0:b0c4c25d37ab | 6620 | |
priyank12p | 0:b0c4c25d37ab | 6621 | void arm_rms_q31( |
priyank12p | 0:b0c4c25d37ab | 6622 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6623 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6624 | q31_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6625 | |
priyank12p | 0:b0c4c25d37ab | 6626 | /** |
priyank12p | 0:b0c4c25d37ab | 6627 | * @brief Root Mean Square of the elements of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6628 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6629 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6630 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6631 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6632 | */ |
priyank12p | 0:b0c4c25d37ab | 6633 | |
priyank12p | 0:b0c4c25d37ab | 6634 | void arm_rms_q15( |
priyank12p | 0:b0c4c25d37ab | 6635 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6636 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6637 | q15_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6638 | |
priyank12p | 0:b0c4c25d37ab | 6639 | /** |
priyank12p | 0:b0c4c25d37ab | 6640 | * @brief Standard deviation of the elements of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6641 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6642 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6643 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6644 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6645 | */ |
priyank12p | 0:b0c4c25d37ab | 6646 | |
priyank12p | 0:b0c4c25d37ab | 6647 | void arm_std_f32( |
priyank12p | 0:b0c4c25d37ab | 6648 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6649 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6650 | float32_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6651 | |
priyank12p | 0:b0c4c25d37ab | 6652 | /** |
priyank12p | 0:b0c4c25d37ab | 6653 | * @brief Standard deviation of the elements of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6654 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6655 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6656 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6657 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6658 | */ |
priyank12p | 0:b0c4c25d37ab | 6659 | |
priyank12p | 0:b0c4c25d37ab | 6660 | void arm_std_q31( |
priyank12p | 0:b0c4c25d37ab | 6661 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6662 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6663 | q31_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6664 | |
priyank12p | 0:b0c4c25d37ab | 6665 | /** |
priyank12p | 0:b0c4c25d37ab | 6666 | * @brief Standard deviation of the elements of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6667 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6668 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6669 | * @param[out] *pResult is output value. |
priyank12p | 0:b0c4c25d37ab | 6670 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6671 | */ |
priyank12p | 0:b0c4c25d37ab | 6672 | |
priyank12p | 0:b0c4c25d37ab | 6673 | void arm_std_q15( |
priyank12p | 0:b0c4c25d37ab | 6674 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6675 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6676 | q15_t * pResult); |
priyank12p | 0:b0c4c25d37ab | 6677 | |
priyank12p | 0:b0c4c25d37ab | 6678 | /** |
priyank12p | 0:b0c4c25d37ab | 6679 | * @brief Floating-point complex magnitude |
priyank12p | 0:b0c4c25d37ab | 6680 | * @param[in] *pSrc points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 6681 | * @param[out] *pDst points to the real output vector |
priyank12p | 0:b0c4c25d37ab | 6682 | * @param[in] numSamples number of complex samples in the input vector |
priyank12p | 0:b0c4c25d37ab | 6683 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6684 | */ |
priyank12p | 0:b0c4c25d37ab | 6685 | |
priyank12p | 0:b0c4c25d37ab | 6686 | void arm_cmplx_mag_f32( |
priyank12p | 0:b0c4c25d37ab | 6687 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6688 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6689 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6690 | |
priyank12p | 0:b0c4c25d37ab | 6691 | /** |
priyank12p | 0:b0c4c25d37ab | 6692 | * @brief Q31 complex magnitude |
priyank12p | 0:b0c4c25d37ab | 6693 | * @param[in] *pSrc points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 6694 | * @param[out] *pDst points to the real output vector |
priyank12p | 0:b0c4c25d37ab | 6695 | * @param[in] numSamples number of complex samples in the input vector |
priyank12p | 0:b0c4c25d37ab | 6696 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6697 | */ |
priyank12p | 0:b0c4c25d37ab | 6698 | |
priyank12p | 0:b0c4c25d37ab | 6699 | void arm_cmplx_mag_q31( |
priyank12p | 0:b0c4c25d37ab | 6700 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6701 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6702 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6703 | |
priyank12p | 0:b0c4c25d37ab | 6704 | /** |
priyank12p | 0:b0c4c25d37ab | 6705 | * @brief Q15 complex magnitude |
priyank12p | 0:b0c4c25d37ab | 6706 | * @param[in] *pSrc points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 6707 | * @param[out] *pDst points to the real output vector |
priyank12p | 0:b0c4c25d37ab | 6708 | * @param[in] numSamples number of complex samples in the input vector |
priyank12p | 0:b0c4c25d37ab | 6709 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6710 | */ |
priyank12p | 0:b0c4c25d37ab | 6711 | |
priyank12p | 0:b0c4c25d37ab | 6712 | void arm_cmplx_mag_q15( |
priyank12p | 0:b0c4c25d37ab | 6713 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6714 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6715 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6716 | |
priyank12p | 0:b0c4c25d37ab | 6717 | /** |
priyank12p | 0:b0c4c25d37ab | 6718 | * @brief Q15 complex dot product |
priyank12p | 0:b0c4c25d37ab | 6719 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 6720 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 6721 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6722 | * @param[out] *realResult real part of the result returned here |
priyank12p | 0:b0c4c25d37ab | 6723 | * @param[out] *imagResult imaginary part of the result returned here |
priyank12p | 0:b0c4c25d37ab | 6724 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6725 | */ |
priyank12p | 0:b0c4c25d37ab | 6726 | |
priyank12p | 0:b0c4c25d37ab | 6727 | void arm_cmplx_dot_prod_q15( |
priyank12p | 0:b0c4c25d37ab | 6728 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 6729 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 6730 | uint32_t numSamples, |
priyank12p | 0:b0c4c25d37ab | 6731 | q31_t * realResult, |
priyank12p | 0:b0c4c25d37ab | 6732 | q31_t * imagResult); |
priyank12p | 0:b0c4c25d37ab | 6733 | |
priyank12p | 0:b0c4c25d37ab | 6734 | /** |
priyank12p | 0:b0c4c25d37ab | 6735 | * @brief Q31 complex dot product |
priyank12p | 0:b0c4c25d37ab | 6736 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 6737 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 6738 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6739 | * @param[out] *realResult real part of the result returned here |
priyank12p | 0:b0c4c25d37ab | 6740 | * @param[out] *imagResult imaginary part of the result returned here |
priyank12p | 0:b0c4c25d37ab | 6741 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6742 | */ |
priyank12p | 0:b0c4c25d37ab | 6743 | |
priyank12p | 0:b0c4c25d37ab | 6744 | void arm_cmplx_dot_prod_q31( |
priyank12p | 0:b0c4c25d37ab | 6745 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 6746 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 6747 | uint32_t numSamples, |
priyank12p | 0:b0c4c25d37ab | 6748 | q63_t * realResult, |
priyank12p | 0:b0c4c25d37ab | 6749 | q63_t * imagResult); |
priyank12p | 0:b0c4c25d37ab | 6750 | |
priyank12p | 0:b0c4c25d37ab | 6751 | /** |
priyank12p | 0:b0c4c25d37ab | 6752 | * @brief Floating-point complex dot product |
priyank12p | 0:b0c4c25d37ab | 6753 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 6754 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 6755 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6756 | * @param[out] *realResult real part of the result returned here |
priyank12p | 0:b0c4c25d37ab | 6757 | * @param[out] *imagResult imaginary part of the result returned here |
priyank12p | 0:b0c4c25d37ab | 6758 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6759 | */ |
priyank12p | 0:b0c4c25d37ab | 6760 | |
priyank12p | 0:b0c4c25d37ab | 6761 | void arm_cmplx_dot_prod_f32( |
priyank12p | 0:b0c4c25d37ab | 6762 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 6763 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 6764 | uint32_t numSamples, |
priyank12p | 0:b0c4c25d37ab | 6765 | float32_t * realResult, |
priyank12p | 0:b0c4c25d37ab | 6766 | float32_t * imagResult); |
priyank12p | 0:b0c4c25d37ab | 6767 | |
priyank12p | 0:b0c4c25d37ab | 6768 | /** |
priyank12p | 0:b0c4c25d37ab | 6769 | * @brief Q15 complex-by-real multiplication |
priyank12p | 0:b0c4c25d37ab | 6770 | * @param[in] *pSrcCmplx points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 6771 | * @param[in] *pSrcReal points to the real input vector |
priyank12p | 0:b0c4c25d37ab | 6772 | * @param[out] *pCmplxDst points to the complex output vector |
priyank12p | 0:b0c4c25d37ab | 6773 | * @param[in] numSamples number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6774 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6775 | */ |
priyank12p | 0:b0c4c25d37ab | 6776 | |
priyank12p | 0:b0c4c25d37ab | 6777 | void arm_cmplx_mult_real_q15( |
priyank12p | 0:b0c4c25d37ab | 6778 | q15_t * pSrcCmplx, |
priyank12p | 0:b0c4c25d37ab | 6779 | q15_t * pSrcReal, |
priyank12p | 0:b0c4c25d37ab | 6780 | q15_t * pCmplxDst, |
priyank12p | 0:b0c4c25d37ab | 6781 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6782 | |
priyank12p | 0:b0c4c25d37ab | 6783 | /** |
priyank12p | 0:b0c4c25d37ab | 6784 | * @brief Q31 complex-by-real multiplication |
priyank12p | 0:b0c4c25d37ab | 6785 | * @param[in] *pSrcCmplx points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 6786 | * @param[in] *pSrcReal points to the real input vector |
priyank12p | 0:b0c4c25d37ab | 6787 | * @param[out] *pCmplxDst points to the complex output vector |
priyank12p | 0:b0c4c25d37ab | 6788 | * @param[in] numSamples number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6789 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6790 | */ |
priyank12p | 0:b0c4c25d37ab | 6791 | |
priyank12p | 0:b0c4c25d37ab | 6792 | void arm_cmplx_mult_real_q31( |
priyank12p | 0:b0c4c25d37ab | 6793 | q31_t * pSrcCmplx, |
priyank12p | 0:b0c4c25d37ab | 6794 | q31_t * pSrcReal, |
priyank12p | 0:b0c4c25d37ab | 6795 | q31_t * pCmplxDst, |
priyank12p | 0:b0c4c25d37ab | 6796 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6797 | |
priyank12p | 0:b0c4c25d37ab | 6798 | /** |
priyank12p | 0:b0c4c25d37ab | 6799 | * @brief Floating-point complex-by-real multiplication |
priyank12p | 0:b0c4c25d37ab | 6800 | * @param[in] *pSrcCmplx points to the complex input vector |
priyank12p | 0:b0c4c25d37ab | 6801 | * @param[in] *pSrcReal points to the real input vector |
priyank12p | 0:b0c4c25d37ab | 6802 | * @param[out] *pCmplxDst points to the complex output vector |
priyank12p | 0:b0c4c25d37ab | 6803 | * @param[in] numSamples number of samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6804 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6805 | */ |
priyank12p | 0:b0c4c25d37ab | 6806 | |
priyank12p | 0:b0c4c25d37ab | 6807 | void arm_cmplx_mult_real_f32( |
priyank12p | 0:b0c4c25d37ab | 6808 | float32_t * pSrcCmplx, |
priyank12p | 0:b0c4c25d37ab | 6809 | float32_t * pSrcReal, |
priyank12p | 0:b0c4c25d37ab | 6810 | float32_t * pCmplxDst, |
priyank12p | 0:b0c4c25d37ab | 6811 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6812 | |
priyank12p | 0:b0c4c25d37ab | 6813 | /** |
priyank12p | 0:b0c4c25d37ab | 6814 | * @brief Minimum value of a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 6815 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6816 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6817 | * @param[out] *result is output pointer |
priyank12p | 0:b0c4c25d37ab | 6818 | * @param[in] index is the array index of the minimum value in the input buffer. |
priyank12p | 0:b0c4c25d37ab | 6819 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6820 | */ |
priyank12p | 0:b0c4c25d37ab | 6821 | |
priyank12p | 0:b0c4c25d37ab | 6822 | void arm_min_q7( |
priyank12p | 0:b0c4c25d37ab | 6823 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6824 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6825 | q7_t * result, |
priyank12p | 0:b0c4c25d37ab | 6826 | uint32_t * index); |
priyank12p | 0:b0c4c25d37ab | 6827 | |
priyank12p | 0:b0c4c25d37ab | 6828 | /** |
priyank12p | 0:b0c4c25d37ab | 6829 | * @brief Minimum value of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6830 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6831 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6832 | * @param[out] *pResult is output pointer |
priyank12p | 0:b0c4c25d37ab | 6833 | * @param[in] *pIndex is the array index of the minimum value in the input buffer. |
priyank12p | 0:b0c4c25d37ab | 6834 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6835 | */ |
priyank12p | 0:b0c4c25d37ab | 6836 | |
priyank12p | 0:b0c4c25d37ab | 6837 | void arm_min_q15( |
priyank12p | 0:b0c4c25d37ab | 6838 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6839 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6840 | q15_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6841 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6842 | |
priyank12p | 0:b0c4c25d37ab | 6843 | /** |
priyank12p | 0:b0c4c25d37ab | 6844 | * @brief Minimum value of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6845 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6846 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6847 | * @param[out] *pResult is output pointer |
priyank12p | 0:b0c4c25d37ab | 6848 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
priyank12p | 0:b0c4c25d37ab | 6849 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6850 | */ |
priyank12p | 0:b0c4c25d37ab | 6851 | void arm_min_q31( |
priyank12p | 0:b0c4c25d37ab | 6852 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6853 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6854 | q31_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6855 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6856 | |
priyank12p | 0:b0c4c25d37ab | 6857 | /** |
priyank12p | 0:b0c4c25d37ab | 6858 | * @brief Minimum value of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6859 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 6860 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 6861 | * @param[out] *pResult is output pointer |
priyank12p | 0:b0c4c25d37ab | 6862 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
priyank12p | 0:b0c4c25d37ab | 6863 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6864 | */ |
priyank12p | 0:b0c4c25d37ab | 6865 | |
priyank12p | 0:b0c4c25d37ab | 6866 | void arm_min_f32( |
priyank12p | 0:b0c4c25d37ab | 6867 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6868 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6869 | float32_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6870 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6871 | |
priyank12p | 0:b0c4c25d37ab | 6872 | /** |
priyank12p | 0:b0c4c25d37ab | 6873 | * @brief Maximum value of a Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 6874 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 6875 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 6876 | * @param[out] *pResult maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6877 | * @param[out] *pIndex index of maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6878 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6879 | */ |
priyank12p | 0:b0c4c25d37ab | 6880 | |
priyank12p | 0:b0c4c25d37ab | 6881 | void arm_max_q7( |
priyank12p | 0:b0c4c25d37ab | 6882 | q7_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6883 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6884 | q7_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6885 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6886 | |
priyank12p | 0:b0c4c25d37ab | 6887 | /** |
priyank12p | 0:b0c4c25d37ab | 6888 | * @brief Maximum value of a Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6889 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 6890 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 6891 | * @param[out] *pResult maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6892 | * @param[out] *pIndex index of maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6893 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6894 | */ |
priyank12p | 0:b0c4c25d37ab | 6895 | |
priyank12p | 0:b0c4c25d37ab | 6896 | void arm_max_q15( |
priyank12p | 0:b0c4c25d37ab | 6897 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6898 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6899 | q15_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6900 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6901 | |
priyank12p | 0:b0c4c25d37ab | 6902 | /** |
priyank12p | 0:b0c4c25d37ab | 6903 | * @brief Maximum value of a Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6904 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 6905 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 6906 | * @param[out] *pResult maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6907 | * @param[out] *pIndex index of maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6908 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6909 | */ |
priyank12p | 0:b0c4c25d37ab | 6910 | |
priyank12p | 0:b0c4c25d37ab | 6911 | void arm_max_q31( |
priyank12p | 0:b0c4c25d37ab | 6912 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6913 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6914 | q31_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6915 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6916 | |
priyank12p | 0:b0c4c25d37ab | 6917 | /** |
priyank12p | 0:b0c4c25d37ab | 6918 | * @brief Maximum value of a floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 6919 | * @param[in] *pSrc points to the input buffer |
priyank12p | 0:b0c4c25d37ab | 6920 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 6921 | * @param[out] *pResult maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6922 | * @param[out] *pIndex index of maximum value returned here |
priyank12p | 0:b0c4c25d37ab | 6923 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6924 | */ |
priyank12p | 0:b0c4c25d37ab | 6925 | |
priyank12p | 0:b0c4c25d37ab | 6926 | void arm_max_f32( |
priyank12p | 0:b0c4c25d37ab | 6927 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6928 | uint32_t blockSize, |
priyank12p | 0:b0c4c25d37ab | 6929 | float32_t * pResult, |
priyank12p | 0:b0c4c25d37ab | 6930 | uint32_t * pIndex); |
priyank12p | 0:b0c4c25d37ab | 6931 | |
priyank12p | 0:b0c4c25d37ab | 6932 | /** |
priyank12p | 0:b0c4c25d37ab | 6933 | * @brief Q15 complex-by-complex multiplication |
priyank12p | 0:b0c4c25d37ab | 6934 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 6935 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 6936 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 6937 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6938 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6939 | */ |
priyank12p | 0:b0c4c25d37ab | 6940 | |
priyank12p | 0:b0c4c25d37ab | 6941 | void arm_cmplx_mult_cmplx_q15( |
priyank12p | 0:b0c4c25d37ab | 6942 | q15_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 6943 | q15_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 6944 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6945 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6946 | |
priyank12p | 0:b0c4c25d37ab | 6947 | /** |
priyank12p | 0:b0c4c25d37ab | 6948 | * @brief Q31 complex-by-complex multiplication |
priyank12p | 0:b0c4c25d37ab | 6949 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 6950 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 6951 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 6952 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6953 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6954 | */ |
priyank12p | 0:b0c4c25d37ab | 6955 | |
priyank12p | 0:b0c4c25d37ab | 6956 | void arm_cmplx_mult_cmplx_q31( |
priyank12p | 0:b0c4c25d37ab | 6957 | q31_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 6958 | q31_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 6959 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6960 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6961 | |
priyank12p | 0:b0c4c25d37ab | 6962 | /** |
priyank12p | 0:b0c4c25d37ab | 6963 | * @brief Floating-point complex-by-complex multiplication |
priyank12p | 0:b0c4c25d37ab | 6964 | * @param[in] *pSrcA points to the first input vector |
priyank12p | 0:b0c4c25d37ab | 6965 | * @param[in] *pSrcB points to the second input vector |
priyank12p | 0:b0c4c25d37ab | 6966 | * @param[out] *pDst points to the output vector |
priyank12p | 0:b0c4c25d37ab | 6967 | * @param[in] numSamples number of complex samples in each vector |
priyank12p | 0:b0c4c25d37ab | 6968 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6969 | */ |
priyank12p | 0:b0c4c25d37ab | 6970 | |
priyank12p | 0:b0c4c25d37ab | 6971 | void arm_cmplx_mult_cmplx_f32( |
priyank12p | 0:b0c4c25d37ab | 6972 | float32_t * pSrcA, |
priyank12p | 0:b0c4c25d37ab | 6973 | float32_t * pSrcB, |
priyank12p | 0:b0c4c25d37ab | 6974 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6975 | uint32_t numSamples); |
priyank12p | 0:b0c4c25d37ab | 6976 | |
priyank12p | 0:b0c4c25d37ab | 6977 | /** |
priyank12p | 0:b0c4c25d37ab | 6978 | * @brief Converts the elements of the floating-point vector to Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 6979 | * @param[in] *pSrc points to the floating-point input vector |
priyank12p | 0:b0c4c25d37ab | 6980 | * @param[out] *pDst points to the Q31 output vector |
priyank12p | 0:b0c4c25d37ab | 6981 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 6982 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 6983 | */ |
priyank12p | 0:b0c4c25d37ab | 6984 | void arm_float_to_q31( |
priyank12p | 0:b0c4c25d37ab | 6985 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6986 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6987 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 6988 | |
priyank12p | 0:b0c4c25d37ab | 6989 | /** |
priyank12p | 0:b0c4c25d37ab | 6990 | * @brief Converts the elements of the floating-point vector to Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 6991 | * @param[in] *pSrc points to the floating-point input vector |
priyank12p | 0:b0c4c25d37ab | 6992 | * @param[out] *pDst points to the Q15 output vector |
priyank12p | 0:b0c4c25d37ab | 6993 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 6994 | * @return none |
priyank12p | 0:b0c4c25d37ab | 6995 | */ |
priyank12p | 0:b0c4c25d37ab | 6996 | void arm_float_to_q15( |
priyank12p | 0:b0c4c25d37ab | 6997 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 6998 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 6999 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7000 | |
priyank12p | 0:b0c4c25d37ab | 7001 | /** |
priyank12p | 0:b0c4c25d37ab | 7002 | * @brief Converts the elements of the floating-point vector to Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 7003 | * @param[in] *pSrc points to the floating-point input vector |
priyank12p | 0:b0c4c25d37ab | 7004 | * @param[out] *pDst points to the Q7 output vector |
priyank12p | 0:b0c4c25d37ab | 7005 | * @param[in] blockSize length of the input vector |
priyank12p | 0:b0c4c25d37ab | 7006 | * @return none |
priyank12p | 0:b0c4c25d37ab | 7007 | */ |
priyank12p | 0:b0c4c25d37ab | 7008 | void arm_float_to_q7( |
priyank12p | 0:b0c4c25d37ab | 7009 | float32_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 7010 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 7011 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7012 | |
priyank12p | 0:b0c4c25d37ab | 7013 | |
priyank12p | 0:b0c4c25d37ab | 7014 | /** |
priyank12p | 0:b0c4c25d37ab | 7015 | * @brief Converts the elements of the Q31 vector to Q15 vector. |
priyank12p | 0:b0c4c25d37ab | 7016 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 7017 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 7018 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 7019 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 7020 | */ |
priyank12p | 0:b0c4c25d37ab | 7021 | void arm_q31_to_q15( |
priyank12p | 0:b0c4c25d37ab | 7022 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 7023 | q15_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 7024 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7025 | |
priyank12p | 0:b0c4c25d37ab | 7026 | /** |
priyank12p | 0:b0c4c25d37ab | 7027 | * @brief Converts the elements of the Q31 vector to Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 7028 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 7029 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 7030 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 7031 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 7032 | */ |
priyank12p | 0:b0c4c25d37ab | 7033 | void arm_q31_to_q7( |
priyank12p | 0:b0c4c25d37ab | 7034 | q31_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 7035 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 7036 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7037 | |
priyank12p | 0:b0c4c25d37ab | 7038 | /** |
priyank12p | 0:b0c4c25d37ab | 7039 | * @brief Converts the elements of the Q15 vector to floating-point vector. |
priyank12p | 0:b0c4c25d37ab | 7040 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 7041 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 7042 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 7043 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 7044 | */ |
priyank12p | 0:b0c4c25d37ab | 7045 | void arm_q15_to_float( |
priyank12p | 0:b0c4c25d37ab | 7046 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 7047 | float32_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 7048 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7049 | |
priyank12p | 0:b0c4c25d37ab | 7050 | |
priyank12p | 0:b0c4c25d37ab | 7051 | /** |
priyank12p | 0:b0c4c25d37ab | 7052 | * @brief Converts the elements of the Q15 vector to Q31 vector. |
priyank12p | 0:b0c4c25d37ab | 7053 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 7054 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 7055 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 7056 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 7057 | */ |
priyank12p | 0:b0c4c25d37ab | 7058 | void arm_q15_to_q31( |
priyank12p | 0:b0c4c25d37ab | 7059 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 7060 | q31_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 7061 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7062 | |
priyank12p | 0:b0c4c25d37ab | 7063 | |
priyank12p | 0:b0c4c25d37ab | 7064 | /** |
priyank12p | 0:b0c4c25d37ab | 7065 | * @brief Converts the elements of the Q15 vector to Q7 vector. |
priyank12p | 0:b0c4c25d37ab | 7066 | * @param[in] *pSrc is input pointer |
priyank12p | 0:b0c4c25d37ab | 7067 | * @param[out] *pDst is output pointer |
priyank12p | 0:b0c4c25d37ab | 7068 | * @param[in] blockSize is the number of samples to process |
priyank12p | 0:b0c4c25d37ab | 7069 | * @return none. |
priyank12p | 0:b0c4c25d37ab | 7070 | */ |
priyank12p | 0:b0c4c25d37ab | 7071 | void arm_q15_to_q7( |
priyank12p | 0:b0c4c25d37ab | 7072 | q15_t * pSrc, |
priyank12p | 0:b0c4c25d37ab | 7073 | q7_t * pDst, |
priyank12p | 0:b0c4c25d37ab | 7074 | uint32_t blockSize); |
priyank12p | 0:b0c4c25d37ab | 7075 | |
priyank12p | 0:b0c4c25d37ab | 7076 | |
priyank12p | 0:b0c4c25d37ab | 7077 | /** |
priyank12p | 0:b0c4c25d37ab | 7078 | * @ingroup groupInterpolation |
priyank12p | 0:b0c4c25d37ab | 7079 | */ |
priyank12p | 0:b0c4c25d37ab | 7080 | |
priyank12p | 0:b0c4c25d37ab | 7081 | /** |
priyank12p | 0:b0c4c25d37ab | 7082 | * @defgroup BilinearInterpolate Bilinear Interpolation |
priyank12p | 0:b0c4c25d37ab | 7083 | * |
priyank12p | 0:b0c4c25d37ab | 7084 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. |
priyank12p | 0:b0c4c25d37ab | 7085 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process |
priyank12p | 0:b0c4c25d37ab | 7086 | * determines values between the grid points. |
priyank12p | 0:b0c4c25d37ab | 7087 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. |
priyank12p | 0:b0c4c25d37ab | 7088 | * Bilinear interpolation is often used in image processing to rescale images. |
priyank12p | 0:b0c4c25d37ab | 7089 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. |
priyank12p | 0:b0c4c25d37ab | 7090 | * |
priyank12p | 0:b0c4c25d37ab | 7091 | * <b>Algorithm</b> |
priyank12p | 0:b0c4c25d37ab | 7092 | * \par |
priyank12p | 0:b0c4c25d37ab | 7093 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. |
priyank12p | 0:b0c4c25d37ab | 7094 | * For floating-point, the instance structure is defined as: |
priyank12p | 0:b0c4c25d37ab | 7095 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 7096 | * typedef struct |
priyank12p | 0:b0c4c25d37ab | 7097 | * { |
priyank12p | 0:b0c4c25d37ab | 7098 | * uint16_t numRows; |
priyank12p | 0:b0c4c25d37ab | 7099 | * uint16_t numCols; |
priyank12p | 0:b0c4c25d37ab | 7100 | * float32_t *pData; |
priyank12p | 0:b0c4c25d37ab | 7101 | * } arm_bilinear_interp_instance_f32; |
priyank12p | 0:b0c4c25d37ab | 7102 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 7103 | * |
priyank12p | 0:b0c4c25d37ab | 7104 | * \par |
priyank12p | 0:b0c4c25d37ab | 7105 | * where <code>numRows</code> specifies the number of rows in the table; |
priyank12p | 0:b0c4c25d37ab | 7106 | * <code>numCols</code> specifies the number of columns in the table; |
priyank12p | 0:b0c4c25d37ab | 7107 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values. |
priyank12p | 0:b0c4c25d37ab | 7108 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes. |
priyank12p | 0:b0c4c25d37ab | 7109 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers. |
priyank12p | 0:b0c4c25d37ab | 7110 | * |
priyank12p | 0:b0c4c25d37ab | 7111 | * \par |
priyank12p | 0:b0c4c25d37ab | 7112 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define: |
priyank12p | 0:b0c4c25d37ab | 7113 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 7114 | * XF = floor(x) |
priyank12p | 0:b0c4c25d37ab | 7115 | * YF = floor(y) |
priyank12p | 0:b0c4c25d37ab | 7116 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 7117 | * \par |
priyank12p | 0:b0c4c25d37ab | 7118 | * The interpolated output point is computed as: |
priyank12p | 0:b0c4c25d37ab | 7119 | * <pre> |
priyank12p | 0:b0c4c25d37ab | 7120 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF)) |
priyank12p | 0:b0c4c25d37ab | 7121 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF)) |
priyank12p | 0:b0c4c25d37ab | 7122 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF) |
priyank12p | 0:b0c4c25d37ab | 7123 | * + f(XF+1, YF+1) * (x-XF)*(y-YF) |
priyank12p | 0:b0c4c25d37ab | 7124 | * </pre> |
priyank12p | 0:b0c4c25d37ab | 7125 | * Note that the coordinates (x, y) contain integer and fractional components. |
priyank12p | 0:b0c4c25d37ab | 7126 | * The integer components specify which portion of the table to use while the |
priyank12p | 0:b0c4c25d37ab | 7127 | * fractional components control the interpolation processor. |
priyank12p | 0:b0c4c25d37ab | 7128 | * |
priyank12p | 0:b0c4c25d37ab | 7129 | * \par |
priyank12p | 0:b0c4c25d37ab | 7130 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. |
priyank12p | 0:b0c4c25d37ab | 7131 | */ |
priyank12p | 0:b0c4c25d37ab | 7132 | |
priyank12p | 0:b0c4c25d37ab | 7133 | /** |
priyank12p | 0:b0c4c25d37ab | 7134 | * @addtogroup BilinearInterpolate |
priyank12p | 0:b0c4c25d37ab | 7135 | * @{ |
priyank12p | 0:b0c4c25d37ab | 7136 | */ |
priyank12p | 0:b0c4c25d37ab | 7137 | |
priyank12p | 0:b0c4c25d37ab | 7138 | /** |
priyank12p | 0:b0c4c25d37ab | 7139 | * |
priyank12p | 0:b0c4c25d37ab | 7140 | * @brief Floating-point bilinear interpolation. |
priyank12p | 0:b0c4c25d37ab | 7141 | * @param[in,out] *S points to an instance of the interpolation structure. |
priyank12p | 0:b0c4c25d37ab | 7142 | * @param[in] X interpolation coordinate. |
priyank12p | 0:b0c4c25d37ab | 7143 | * @param[in] Y interpolation coordinate. |
priyank12p | 0:b0c4c25d37ab | 7144 | * @return out interpolated value. |
priyank12p | 0:b0c4c25d37ab | 7145 | */ |
priyank12p | 0:b0c4c25d37ab | 7146 | |
priyank12p | 0:b0c4c25d37ab | 7147 | |
priyank12p | 0:b0c4c25d37ab | 7148 | static __INLINE float32_t arm_bilinear_interp_f32( |
priyank12p | 0:b0c4c25d37ab | 7149 | const arm_bilinear_interp_instance_f32 * S, |
priyank12p | 0:b0c4c25d37ab | 7150 | float32_t X, |
priyank12p | 0:b0c4c25d37ab | 7151 | float32_t Y) |
priyank12p | 0:b0c4c25d37ab | 7152 | { |
priyank12p | 0:b0c4c25d37ab | 7153 | float32_t out; |
priyank12p | 0:b0c4c25d37ab | 7154 | float32_t f00, f01, f10, f11; |
priyank12p | 0:b0c4c25d37ab | 7155 | float32_t *pData = S->pData; |
priyank12p | 0:b0c4c25d37ab | 7156 | int32_t xIndex, yIndex, index; |
priyank12p | 0:b0c4c25d37ab | 7157 | float32_t xdiff, ydiff; |
priyank12p | 0:b0c4c25d37ab | 7158 | float32_t b1, b2, b3, b4; |
priyank12p | 0:b0c4c25d37ab | 7159 | |
priyank12p | 0:b0c4c25d37ab | 7160 | xIndex = (int32_t) X; |
priyank12p | 0:b0c4c25d37ab | 7161 | yIndex = (int32_t) Y; |
priyank12p | 0:b0c4c25d37ab | 7162 | |
priyank12p | 0:b0c4c25d37ab | 7163 | /* Care taken for table outside boundary */ |
priyank12p | 0:b0c4c25d37ab | 7164 | /* Returns zero output when values are outside table boundary */ |
priyank12p | 0:b0c4c25d37ab | 7165 | if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 |
priyank12p | 0:b0c4c25d37ab | 7166 | || yIndex > (S->numCols - 1)) |
priyank12p | 0:b0c4c25d37ab | 7167 | { |
priyank12p | 0:b0c4c25d37ab | 7168 | return (0); |
priyank12p | 0:b0c4c25d37ab | 7169 | } |
priyank12p | 0:b0c4c25d37ab | 7170 | |
priyank12p | 0:b0c4c25d37ab | 7171 | /* Calculation of index for two nearest points in X-direction */ |
priyank12p | 0:b0c4c25d37ab | 7172 | index = (xIndex - 1) + (yIndex - 1) * S->numCols; |
priyank12p | 0:b0c4c25d37ab | 7173 | |
priyank12p | 0:b0c4c25d37ab | 7174 | |
priyank12p | 0:b0c4c25d37ab | 7175 | /* Read two nearest points in X-direction */ |
priyank12p | 0:b0c4c25d37ab | 7176 | f00 = pData[index]; |
priyank12p | 0:b0c4c25d37ab | 7177 | f01 = pData[index + 1]; |
priyank12p | 0:b0c4c25d37ab | 7178 | |
priyank12p | 0:b0c4c25d37ab | 7179 | /* Calculation of index for two nearest points in Y-direction */ |
priyank12p | 0:b0c4c25d37ab | 7180 | index = (xIndex - 1) + (yIndex) * S->numCols; |
priyank12p | 0:b0c4c25d37ab | 7181 | |
priyank12p | 0:b0c4c25d37ab | 7182 | |
priyank12p | 0:b0c4c25d37ab | 7183 | /* Read two nearest points in Y-direction */ |
priyank12p | 0:b0c4c25d37ab | 7184 | f10 = pData[index]; |
priyank12p | 0:b0c4c25d37ab | 7185 | f11 = pData[index + 1]; |
priyank12p | 0:b0c4c25d37ab | 7186 | |
priyank12p | 0:b0c4c25d37ab | 7187 | /* Calculation of intermediate values */ |
priyank12p | 0:b0c4c25d37ab | 7188 | b1 = f00; |
priyank12p | 0:b0c4c25d37ab | 7189 | b2 = f01 - f00; |
priyank12p | 0:b0c4c25d37ab | 7190 | b3 = f10 - f00; |
priyank12p | 0:b0c4c25d37ab | 7191 | b4 = f00 - f01 - f10 + f11; |
priyank12p | 0:b0c4c25d37ab | 7192 | |
priyank12p | 0:b0c4c25d37ab | 7193 | /* Calculation of fractional part in X */ |
priyank12p | 0:b0c4c25d37ab | 7194 | xdiff = X - xIndex; |
priyank12p | 0:b0c4c25d37ab | 7195 | |
priyank12p | 0:b0c4c25d37ab | 7196 | /* Calculation of fractional part in Y */ |
priyank12p | 0:b0c4c25d37ab | 7197 | ydiff = Y - yIndex; |
priyank12p | 0:b0c4c25d37ab | 7198 | |
priyank12p | 0:b0c4c25d37ab | 7199 | /* Calculation of bi-linear interpolated output */ |
priyank12p | 0:b0c4c25d37ab | 7200 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; |
priyank12p | 0:b0c4c25d37ab | 7201 | |
priyank12p | 0:b0c4c25d37ab | 7202 | /* return to application */ |
priyank12p | 0:b0c4c25d37ab | 7203 | return (out); |
priyank12p | 0:b0c4c25d37ab | 7204 | |
priyank12p | 0:b0c4c25d37ab | 7205 | } |
priyank12p | 0:b0c4c25d37ab | 7206 | |
priyank12p | 0:b0c4c25d37ab | 7207 | /** |
priyank12p | 0:b0c4c25d37ab | 7208 | * |
priyank12p | 0:b0c4c25d37ab | 7209 | * @brief Q31 bilinear interpolation. |
priyank12p | 0:b0c4c25d37ab | 7210 | * @param[in,out] *S points to an instance of the interpolation structure. |
priyank12p | 0:b0c4c25d37ab | 7211 | * @param[in] X interpolation coordinate in 12.20 format. |
priyank12p | 0:b0c4c25d37ab | 7212 | * @param[in] Y interpolation coordinate in 12.20 format. |
priyank12p | 0:b0c4c25d37ab | 7213 | * @return out interpolated value. |
priyank12p | 0:b0c4c25d37ab | 7214 | */ |
priyank12p | 0:b0c4c25d37ab | 7215 | |
priyank12p | 0:b0c4c25d37ab | 7216 | static __INLINE q31_t arm_bilinear_interp_q31( |
priyank12p | 0:b0c4c25d37ab | 7217 | arm_bilinear_interp_instance_q31 * S, |
priyank12p | 0:b0c4c25d37ab | 7218 | q31_t X, |
priyank12p | 0:b0c4c25d37ab | 7219 | q31_t Y) |
priyank12p | 0:b0c4c25d37ab | 7220 | { |
priyank12p | 0:b0c4c25d37ab | 7221 | q31_t out; /* Temporary output */ |
priyank12p | 0:b0c4c25d37ab | 7222 | q31_t acc = 0; /* output */ |
priyank12p | 0:b0c4c25d37ab | 7223 | q31_t xfract, yfract; /* X, Y fractional parts */ |
priyank12p | 0:b0c4c25d37ab | 7224 | q31_t x1, x2, y1, y2; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 7225 | int32_t rI, cI; /* Row and column indices */ |
priyank12p | 0:b0c4c25d37ab | 7226 | q31_t *pYData = S->pData; /* pointer to output table values */ |
priyank12p | 0:b0c4c25d37ab | 7227 | uint32_t nCols = S->numCols; /* num of rows */ |
priyank12p | 0:b0c4c25d37ab | 7228 | |
priyank12p | 0:b0c4c25d37ab | 7229 | |
priyank12p | 0:b0c4c25d37ab | 7230 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7231 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 7232 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 7233 | rI = ((X & 0xFFF00000) >> 20u); |
priyank12p | 0:b0c4c25d37ab | 7234 | |
priyank12p | 0:b0c4c25d37ab | 7235 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7236 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 7237 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 7238 | cI = ((Y & 0xFFF00000) >> 20u); |
priyank12p | 0:b0c4c25d37ab | 7239 | |
priyank12p | 0:b0c4c25d37ab | 7240 | /* Care taken for table outside boundary */ |
priyank12p | 0:b0c4c25d37ab | 7241 | /* Returns zero output when values are outside table boundary */ |
priyank12p | 0:b0c4c25d37ab | 7242 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
priyank12p | 0:b0c4c25d37ab | 7243 | { |
priyank12p | 0:b0c4c25d37ab | 7244 | return (0); |
priyank12p | 0:b0c4c25d37ab | 7245 | } |
priyank12p | 0:b0c4c25d37ab | 7246 | |
priyank12p | 0:b0c4c25d37ab | 7247 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 7248 | /* shift left xfract by 11 to keep 1.31 format */ |
priyank12p | 0:b0c4c25d37ab | 7249 | xfract = (X & 0x000FFFFF) << 11u; |
priyank12p | 0:b0c4c25d37ab | 7250 | |
priyank12p | 0:b0c4c25d37ab | 7251 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 7252 | x1 = pYData[(rI) + nCols * (cI)]; |
priyank12p | 0:b0c4c25d37ab | 7253 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
priyank12p | 0:b0c4c25d37ab | 7254 | |
priyank12p | 0:b0c4c25d37ab | 7255 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 7256 | /* shift left yfract by 11 to keep 1.31 format */ |
priyank12p | 0:b0c4c25d37ab | 7257 | yfract = (Y & 0x000FFFFF) << 11u; |
priyank12p | 0:b0c4c25d37ab | 7258 | |
priyank12p | 0:b0c4c25d37ab | 7259 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 7260 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
priyank12p | 0:b0c4c25d37ab | 7261 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
priyank12p | 0:b0c4c25d37ab | 7262 | |
priyank12p | 0:b0c4c25d37ab | 7263 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ |
priyank12p | 0:b0c4c25d37ab | 7264 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7265 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7266 | |
priyank12p | 0:b0c4c25d37ab | 7267 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7268 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7269 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7270 | |
priyank12p | 0:b0c4c25d37ab | 7271 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7272 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7273 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7274 | |
priyank12p | 0:b0c4c25d37ab | 7275 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7276 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7277 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
priyank12p | 0:b0c4c25d37ab | 7278 | |
priyank12p | 0:b0c4c25d37ab | 7279 | /* Convert acc to 1.31(q31) format */ |
priyank12p | 0:b0c4c25d37ab | 7280 | return (acc << 2u); |
priyank12p | 0:b0c4c25d37ab | 7281 | |
priyank12p | 0:b0c4c25d37ab | 7282 | } |
priyank12p | 0:b0c4c25d37ab | 7283 | |
priyank12p | 0:b0c4c25d37ab | 7284 | /** |
priyank12p | 0:b0c4c25d37ab | 7285 | * @brief Q15 bilinear interpolation. |
priyank12p | 0:b0c4c25d37ab | 7286 | * @param[in,out] *S points to an instance of the interpolation structure. |
priyank12p | 0:b0c4c25d37ab | 7287 | * @param[in] X interpolation coordinate in 12.20 format. |
priyank12p | 0:b0c4c25d37ab | 7288 | * @param[in] Y interpolation coordinate in 12.20 format. |
priyank12p | 0:b0c4c25d37ab | 7289 | * @return out interpolated value. |
priyank12p | 0:b0c4c25d37ab | 7290 | */ |
priyank12p | 0:b0c4c25d37ab | 7291 | |
priyank12p | 0:b0c4c25d37ab | 7292 | static __INLINE q15_t arm_bilinear_interp_q15( |
priyank12p | 0:b0c4c25d37ab | 7293 | arm_bilinear_interp_instance_q15 * S, |
priyank12p | 0:b0c4c25d37ab | 7294 | q31_t X, |
priyank12p | 0:b0c4c25d37ab | 7295 | q31_t Y) |
priyank12p | 0:b0c4c25d37ab | 7296 | { |
priyank12p | 0:b0c4c25d37ab | 7297 | q63_t acc = 0; /* output */ |
priyank12p | 0:b0c4c25d37ab | 7298 | q31_t out; /* Temporary output */ |
priyank12p | 0:b0c4c25d37ab | 7299 | q15_t x1, x2, y1, y2; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 7300 | q31_t xfract, yfract; /* X, Y fractional parts */ |
priyank12p | 0:b0c4c25d37ab | 7301 | int32_t rI, cI; /* Row and column indices */ |
priyank12p | 0:b0c4c25d37ab | 7302 | q15_t *pYData = S->pData; /* pointer to output table values */ |
priyank12p | 0:b0c4c25d37ab | 7303 | uint32_t nCols = S->numCols; /* num of rows */ |
priyank12p | 0:b0c4c25d37ab | 7304 | |
priyank12p | 0:b0c4c25d37ab | 7305 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7306 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 7307 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 7308 | rI = ((X & 0xFFF00000) >> 20); |
priyank12p | 0:b0c4c25d37ab | 7309 | |
priyank12p | 0:b0c4c25d37ab | 7310 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7311 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 7312 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 7313 | cI = ((Y & 0xFFF00000) >> 20); |
priyank12p | 0:b0c4c25d37ab | 7314 | |
priyank12p | 0:b0c4c25d37ab | 7315 | /* Care taken for table outside boundary */ |
priyank12p | 0:b0c4c25d37ab | 7316 | /* Returns zero output when values are outside table boundary */ |
priyank12p | 0:b0c4c25d37ab | 7317 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
priyank12p | 0:b0c4c25d37ab | 7318 | { |
priyank12p | 0:b0c4c25d37ab | 7319 | return (0); |
priyank12p | 0:b0c4c25d37ab | 7320 | } |
priyank12p | 0:b0c4c25d37ab | 7321 | |
priyank12p | 0:b0c4c25d37ab | 7322 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 7323 | /* xfract should be in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7324 | xfract = (X & 0x000FFFFF); |
priyank12p | 0:b0c4c25d37ab | 7325 | |
priyank12p | 0:b0c4c25d37ab | 7326 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 7327 | x1 = pYData[(rI) + nCols * (cI)]; |
priyank12p | 0:b0c4c25d37ab | 7328 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
priyank12p | 0:b0c4c25d37ab | 7329 | |
priyank12p | 0:b0c4c25d37ab | 7330 | |
priyank12p | 0:b0c4c25d37ab | 7331 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 7332 | /* yfract should be in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7333 | yfract = (Y & 0x000FFFFF); |
priyank12p | 0:b0c4c25d37ab | 7334 | |
priyank12p | 0:b0c4c25d37ab | 7335 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 7336 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
priyank12p | 0:b0c4c25d37ab | 7337 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
priyank12p | 0:b0c4c25d37ab | 7338 | |
priyank12p | 0:b0c4c25d37ab | 7339 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ |
priyank12p | 0:b0c4c25d37ab | 7340 | |
priyank12p | 0:b0c4c25d37ab | 7341 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ |
priyank12p | 0:b0c4c25d37ab | 7342 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ |
priyank12p | 0:b0c4c25d37ab | 7343 | out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); |
priyank12p | 0:b0c4c25d37ab | 7344 | acc = ((q63_t) out * (0xFFFFF - yfract)); |
priyank12p | 0:b0c4c25d37ab | 7345 | |
priyank12p | 0:b0c4c25d37ab | 7346 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7347 | out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); |
priyank12p | 0:b0c4c25d37ab | 7348 | acc += ((q63_t) out * (xfract)); |
priyank12p | 0:b0c4c25d37ab | 7349 | |
priyank12p | 0:b0c4c25d37ab | 7350 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7351 | out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); |
priyank12p | 0:b0c4c25d37ab | 7352 | acc += ((q63_t) out * (yfract)); |
priyank12p | 0:b0c4c25d37ab | 7353 | |
priyank12p | 0:b0c4c25d37ab | 7354 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7355 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); |
priyank12p | 0:b0c4c25d37ab | 7356 | acc += ((q63_t) out * (yfract)); |
priyank12p | 0:b0c4c25d37ab | 7357 | |
priyank12p | 0:b0c4c25d37ab | 7358 | /* acc is in 13.51 format and down shift acc by 36 times */ |
priyank12p | 0:b0c4c25d37ab | 7359 | /* Convert out to 1.15 format */ |
priyank12p | 0:b0c4c25d37ab | 7360 | return (acc >> 36); |
priyank12p | 0:b0c4c25d37ab | 7361 | |
priyank12p | 0:b0c4c25d37ab | 7362 | } |
priyank12p | 0:b0c4c25d37ab | 7363 | |
priyank12p | 0:b0c4c25d37ab | 7364 | /** |
priyank12p | 0:b0c4c25d37ab | 7365 | * @brief Q7 bilinear interpolation. |
priyank12p | 0:b0c4c25d37ab | 7366 | * @param[in,out] *S points to an instance of the interpolation structure. |
priyank12p | 0:b0c4c25d37ab | 7367 | * @param[in] X interpolation coordinate in 12.20 format. |
priyank12p | 0:b0c4c25d37ab | 7368 | * @param[in] Y interpolation coordinate in 12.20 format. |
priyank12p | 0:b0c4c25d37ab | 7369 | * @return out interpolated value. |
priyank12p | 0:b0c4c25d37ab | 7370 | */ |
priyank12p | 0:b0c4c25d37ab | 7371 | |
priyank12p | 0:b0c4c25d37ab | 7372 | static __INLINE q7_t arm_bilinear_interp_q7( |
priyank12p | 0:b0c4c25d37ab | 7373 | arm_bilinear_interp_instance_q7 * S, |
priyank12p | 0:b0c4c25d37ab | 7374 | q31_t X, |
priyank12p | 0:b0c4c25d37ab | 7375 | q31_t Y) |
priyank12p | 0:b0c4c25d37ab | 7376 | { |
priyank12p | 0:b0c4c25d37ab | 7377 | q63_t acc = 0; /* output */ |
priyank12p | 0:b0c4c25d37ab | 7378 | q31_t out; /* Temporary output */ |
priyank12p | 0:b0c4c25d37ab | 7379 | q31_t xfract, yfract; /* X, Y fractional parts */ |
priyank12p | 0:b0c4c25d37ab | 7380 | q7_t x1, x2, y1, y2; /* Nearest output values */ |
priyank12p | 0:b0c4c25d37ab | 7381 | int32_t rI, cI; /* Row and column indices */ |
priyank12p | 0:b0c4c25d37ab | 7382 | q7_t *pYData = S->pData; /* pointer to output table values */ |
priyank12p | 0:b0c4c25d37ab | 7383 | uint32_t nCols = S->numCols; /* num of rows */ |
priyank12p | 0:b0c4c25d37ab | 7384 | |
priyank12p | 0:b0c4c25d37ab | 7385 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7386 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 7387 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 7388 | rI = ((X & 0xFFF00000) >> 20); |
priyank12p | 0:b0c4c25d37ab | 7389 | |
priyank12p | 0:b0c4c25d37ab | 7390 | /* Input is in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7391 | /* 12 bits for the table index */ |
priyank12p | 0:b0c4c25d37ab | 7392 | /* Index value calculation */ |
priyank12p | 0:b0c4c25d37ab | 7393 | cI = ((Y & 0xFFF00000) >> 20); |
priyank12p | 0:b0c4c25d37ab | 7394 | |
priyank12p | 0:b0c4c25d37ab | 7395 | /* Care taken for table outside boundary */ |
priyank12p | 0:b0c4c25d37ab | 7396 | /* Returns zero output when values are outside table boundary */ |
priyank12p | 0:b0c4c25d37ab | 7397 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
priyank12p | 0:b0c4c25d37ab | 7398 | { |
priyank12p | 0:b0c4c25d37ab | 7399 | return (0); |
priyank12p | 0:b0c4c25d37ab | 7400 | } |
priyank12p | 0:b0c4c25d37ab | 7401 | |
priyank12p | 0:b0c4c25d37ab | 7402 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 7403 | /* xfract should be in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7404 | xfract = (X & 0x000FFFFF); |
priyank12p | 0:b0c4c25d37ab | 7405 | |
priyank12p | 0:b0c4c25d37ab | 7406 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 7407 | x1 = pYData[(rI) + nCols * (cI)]; |
priyank12p | 0:b0c4c25d37ab | 7408 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
priyank12p | 0:b0c4c25d37ab | 7409 | |
priyank12p | 0:b0c4c25d37ab | 7410 | |
priyank12p | 0:b0c4c25d37ab | 7411 | /* 20 bits for the fractional part */ |
priyank12p | 0:b0c4c25d37ab | 7412 | /* yfract should be in 12.20 format */ |
priyank12p | 0:b0c4c25d37ab | 7413 | yfract = (Y & 0x000FFFFF); |
priyank12p | 0:b0c4c25d37ab | 7414 | |
priyank12p | 0:b0c4c25d37ab | 7415 | /* Read two nearest output values from the index */ |
priyank12p | 0:b0c4c25d37ab | 7416 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
priyank12p | 0:b0c4c25d37ab | 7417 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
priyank12p | 0:b0c4c25d37ab | 7418 | |
priyank12p | 0:b0c4c25d37ab | 7419 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ |
priyank12p | 0:b0c4c25d37ab | 7420 | out = ((x1 * (0xFFFFF - xfract))); |
priyank12p | 0:b0c4c25d37ab | 7421 | acc = (((q63_t) out * (0xFFFFF - yfract))); |
priyank12p | 0:b0c4c25d37ab | 7422 | |
priyank12p | 0:b0c4c25d37ab | 7423 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7424 | out = ((x2 * (0xFFFFF - yfract))); |
priyank12p | 0:b0c4c25d37ab | 7425 | acc += (((q63_t) out * (xfract))); |
priyank12p | 0:b0c4c25d37ab | 7426 | |
priyank12p | 0:b0c4c25d37ab | 7427 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7428 | out = ((y1 * (0xFFFFF - xfract))); |
priyank12p | 0:b0c4c25d37ab | 7429 | acc += (((q63_t) out * (yfract))); |
priyank12p | 0:b0c4c25d37ab | 7430 | |
priyank12p | 0:b0c4c25d37ab | 7431 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ |
priyank12p | 0:b0c4c25d37ab | 7432 | out = ((y2 * (yfract))); |
priyank12p | 0:b0c4c25d37ab | 7433 | acc += (((q63_t) out * (xfract))); |
priyank12p | 0:b0c4c25d37ab | 7434 | |
priyank12p | 0:b0c4c25d37ab | 7435 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ |
priyank12p | 0:b0c4c25d37ab | 7436 | return (acc >> 40); |
priyank12p | 0:b0c4c25d37ab | 7437 | |
priyank12p | 0:b0c4c25d37ab | 7438 | } |
priyank12p | 0:b0c4c25d37ab | 7439 | |
priyank12p | 0:b0c4c25d37ab | 7440 | /** |
priyank12p | 0:b0c4c25d37ab | 7441 | * @} end of BilinearInterpolate group |
priyank12p | 0:b0c4c25d37ab | 7442 | */ |
priyank12p | 0:b0c4c25d37ab | 7443 | |
priyank12p | 0:b0c4c25d37ab | 7444 | |
priyank12p | 0:b0c4c25d37ab | 7445 | //SMMLAR |
priyank12p | 0:b0c4c25d37ab | 7446 | #define multAcc_32x32_keep32_R(a, x, y) \ |
priyank12p | 0:b0c4c25d37ab | 7447 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) |
priyank12p | 0:b0c4c25d37ab | 7448 | |
priyank12p | 0:b0c4c25d37ab | 7449 | //SMMLSR |
priyank12p | 0:b0c4c25d37ab | 7450 | #define multSub_32x32_keep32_R(a, x, y) \ |
priyank12p | 0:b0c4c25d37ab | 7451 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) |
priyank12p | 0:b0c4c25d37ab | 7452 | |
priyank12p | 0:b0c4c25d37ab | 7453 | //SMMULR |
priyank12p | 0:b0c4c25d37ab | 7454 | #define mult_32x32_keep32_R(a, x, y) \ |
priyank12p | 0:b0c4c25d37ab | 7455 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) |
priyank12p | 0:b0c4c25d37ab | 7456 | |
priyank12p | 0:b0c4c25d37ab | 7457 | //SMMLA |
priyank12p | 0:b0c4c25d37ab | 7458 | #define multAcc_32x32_keep32(a, x, y) \ |
priyank12p | 0:b0c4c25d37ab | 7459 | a += (q31_t) (((q63_t) x * y) >> 32) |
priyank12p | 0:b0c4c25d37ab | 7460 | |
priyank12p | 0:b0c4c25d37ab | 7461 | //SMMLS |
priyank12p | 0:b0c4c25d37ab | 7462 | #define multSub_32x32_keep32(a, x, y) \ |
priyank12p | 0:b0c4c25d37ab | 7463 | a -= (q31_t) (((q63_t) x * y) >> 32) |
priyank12p | 0:b0c4c25d37ab | 7464 | |
priyank12p | 0:b0c4c25d37ab | 7465 | //SMMUL |
priyank12p | 0:b0c4c25d37ab | 7466 | #define mult_32x32_keep32(a, x, y) \ |
priyank12p | 0:b0c4c25d37ab | 7467 | a = (q31_t) (((q63_t) x * y ) >> 32) |
priyank12p | 0:b0c4c25d37ab | 7468 | |
priyank12p | 0:b0c4c25d37ab | 7469 | |
priyank12p | 0:b0c4c25d37ab | 7470 | #if defined ( __CC_ARM ) //Keil |
priyank12p | 0:b0c4c25d37ab | 7471 | |
priyank12p | 0:b0c4c25d37ab | 7472 | //Enter low optimization region - place directly above function definition |
priyank12p | 0:b0c4c25d37ab | 7473 | #ifdef ARM_MATH_CM4 |
priyank12p | 0:b0c4c25d37ab | 7474 | #define LOW_OPTIMIZATION_ENTER \ |
priyank12p | 0:b0c4c25d37ab | 7475 | _Pragma ("push") \ |
priyank12p | 0:b0c4c25d37ab | 7476 | _Pragma ("O1") |
priyank12p | 0:b0c4c25d37ab | 7477 | #else |
priyank12p | 0:b0c4c25d37ab | 7478 | #define LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7479 | #endif |
priyank12p | 0:b0c4c25d37ab | 7480 | |
priyank12p | 0:b0c4c25d37ab | 7481 | //Exit low optimization region - place directly after end of function definition |
priyank12p | 0:b0c4c25d37ab | 7482 | #ifdef ARM_MATH_CM4 |
priyank12p | 0:b0c4c25d37ab | 7483 | #define LOW_OPTIMIZATION_EXIT \ |
priyank12p | 0:b0c4c25d37ab | 7484 | _Pragma ("pop") |
priyank12p | 0:b0c4c25d37ab | 7485 | #else |
priyank12p | 0:b0c4c25d37ab | 7486 | #define LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7487 | #endif |
priyank12p | 0:b0c4c25d37ab | 7488 | |
priyank12p | 0:b0c4c25d37ab | 7489 | //Enter low optimization region - place directly above function definition |
priyank12p | 0:b0c4c25d37ab | 7490 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7491 | |
priyank12p | 0:b0c4c25d37ab | 7492 | //Exit low optimization region - place directly after end of function definition |
priyank12p | 0:b0c4c25d37ab | 7493 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7494 | |
priyank12p | 0:b0c4c25d37ab | 7495 | #elif defined(__ICCARM__) //IAR |
priyank12p | 0:b0c4c25d37ab | 7496 | |
priyank12p | 0:b0c4c25d37ab | 7497 | //Enter low optimization region - place directly above function definition |
priyank12p | 0:b0c4c25d37ab | 7498 | #ifdef ARM_MATH_CM4 |
priyank12p | 0:b0c4c25d37ab | 7499 | #define LOW_OPTIMIZATION_ENTER \ |
priyank12p | 0:b0c4c25d37ab | 7500 | _Pragma ("optimize=low") |
priyank12p | 0:b0c4c25d37ab | 7501 | #else |
priyank12p | 0:b0c4c25d37ab | 7502 | #define LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7503 | #endif |
priyank12p | 0:b0c4c25d37ab | 7504 | |
priyank12p | 0:b0c4c25d37ab | 7505 | //Exit low optimization region - place directly after end of function definition |
priyank12p | 0:b0c4c25d37ab | 7506 | #define LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7507 | |
priyank12p | 0:b0c4c25d37ab | 7508 | //Enter low optimization region - place directly above function definition |
priyank12p | 0:b0c4c25d37ab | 7509 | #ifdef ARM_MATH_CM4 |
priyank12p | 0:b0c4c25d37ab | 7510 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ |
priyank12p | 0:b0c4c25d37ab | 7511 | _Pragma ("optimize=low") |
priyank12p | 0:b0c4c25d37ab | 7512 | #else |
priyank12p | 0:b0c4c25d37ab | 7513 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7514 | #endif |
priyank12p | 0:b0c4c25d37ab | 7515 | |
priyank12p | 0:b0c4c25d37ab | 7516 | //Exit low optimization region - place directly after end of function definition |
priyank12p | 0:b0c4c25d37ab | 7517 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7518 | |
priyank12p | 0:b0c4c25d37ab | 7519 | #elif defined(__GNUC__) |
priyank12p | 0:b0c4c25d37ab | 7520 | |
priyank12p | 0:b0c4c25d37ab | 7521 | #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) |
priyank12p | 0:b0c4c25d37ab | 7522 | |
priyank12p | 0:b0c4c25d37ab | 7523 | #define LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7524 | |
priyank12p | 0:b0c4c25d37ab | 7525 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7526 | |
priyank12p | 0:b0c4c25d37ab | 7527 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7528 | |
priyank12p | 0:b0c4c25d37ab | 7529 | #elif defined(__CSMC__) // Cosmic |
priyank12p | 0:b0c4c25d37ab | 7530 | |
priyank12p | 0:b0c4c25d37ab | 7531 | #define LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7532 | #define LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7533 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7534 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7535 | |
priyank12p | 0:b0c4c25d37ab | 7536 | #elif defined(__TASKING__) // TASKING |
priyank12p | 0:b0c4c25d37ab | 7537 | |
priyank12p | 0:b0c4c25d37ab | 7538 | #define LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7539 | #define LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7540 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
priyank12p | 0:b0c4c25d37ab | 7541 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
priyank12p | 0:b0c4c25d37ab | 7542 | |
priyank12p | 0:b0c4c25d37ab | 7543 | #endif |
priyank12p | 0:b0c4c25d37ab | 7544 | |
priyank12p | 0:b0c4c25d37ab | 7545 | |
priyank12p | 0:b0c4c25d37ab | 7546 | #ifdef __cplusplus |
priyank12p | 0:b0c4c25d37ab | 7547 | } |
priyank12p | 0:b0c4c25d37ab | 7548 | #endif |
priyank12p | 0:b0c4c25d37ab | 7549 | |
priyank12p | 0:b0c4c25d37ab | 7550 | |
priyank12p | 0:b0c4c25d37ab | 7551 | #endif /* _ARM_MATH_H */ |
priyank12p | 0:b0c4c25d37ab | 7552 | |
priyank12p | 0:b0c4c25d37ab | 7553 | /** |
priyank12p | 0:b0c4c25d37ab | 7554 | * |
priyank12p | 0:b0c4c25d37ab | 7555 | * End of file. |
priyank12p | 0:b0c4c25d37ab | 7556 | */ |