Fork of mbed-dsp. CMSIS-DSP library of supporting NEON
Dependents: mbed-os-example-cmsis_dsp_neon
Fork of mbed-dsp by
Information
Japanese version is available in lower part of this page.
このページの後半に日本語版が用意されています.
CMSIS-DSP of supporting NEON
What is this ?
A library for CMSIS-DSP of supporting NEON.
We supported the NEON to CMSIS-DSP Ver1.4.3(CMSIS V4.1) that ARM supplied, has achieved the processing speed improvement.
If you use the mbed-dsp library, you can use to replace this library.
CMSIS-DSP of supporting NEON is provied as a library.
Library Creation environment
CMSIS-DSP library of supporting NEON was created by the following environment.
- Compiler
ARMCC Version 5.03 - Compile option switch[C Compiler]
-DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -O3 -Otime --cpu=Cortex-A9 --littleend --arm --apcs=/interwork --no_unaligned_access --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp --vectorize --asm
- Compile option switch[Assembler]
--cpreproc --cpu=Cortex-A9 --littleend --arm --apcs=/interwork --no_unaligned_access --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp
Effects of NEON support
In the data which passes to each function, large size will be expected more effective than small size.
Also if the data is a multiple of 16, effect will be expected in every function in the CMSIS-DSP.
NEON対応CMSIS-DSP
概要
NEON対応したCMSIS-DSPのライブラリです。
ARM社提供のCMSIS-DSP Ver1.4.3(CMSIS V4.1)をターゲットにNEON対応を行ない、処理速度向上を実現しております。
mbed-dspライブラリを使用している場合は、本ライブラリに置き換えて使用することができます。
NEON対応したCMSIS-DSPはライブラリで提供します。
ライブラリ作成環境
NEON対応CMSIS-DSPライブラリは、以下の環境で作成しています。
- コンパイラ
ARMCC Version 5.03 - コンパイルオプションスイッチ[C Compiler]
-DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -O3 -Otime --cpu=Cortex-A9 --littleend --arm --apcs=/interwork --no_unaligned_access --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp --vectorize --asm
- コンパイルオプションスイッチ[Assembler]
--cpreproc --cpu=Cortex-A9 --littleend --arm --apcs=/interwork --no_unaligned_access --fpu=vfpv3_fp16 --fpmode=fast --apcs=/hardfp
NEON対応による効果について
CMSIS-DSP内の各関数へ渡すデータは、小さいサイズよりも大きいサイズの方が効果が見込めます。
また、16の倍数のデータであれば、CMSIS-DSP内のどの関数でも効果が見込めます。
cmsis_dsp/arm_math.h@3:7a284390b0ce, 2013-11-08 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Nov 08 13:45:10 2013 +0000
- Revision:
- 3:7a284390b0ce
- Parent:
- 2:da51fb522205
- Child:
- 5:a912b042151f
Synchronized with git revision e69956aba2f68a2a26ac26b051f8d349deaa1ce8
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 3:7a284390b0ce | 1 | /* ---------------------------------------------------------------------- |
mbed_official | 3:7a284390b0ce | 2 | * Copyright (C) 2010-2013 ARM Limited. All rights reserved. |
mbed_official | 3:7a284390b0ce | 3 | * |
mbed_official | 3:7a284390b0ce | 4 | * $Date: 17. January 2013 |
mbed_official | 3:7a284390b0ce | 5 | * $Revision: V1.4.1 |
mbed_official | 3:7a284390b0ce | 6 | * |
mbed_official | 3:7a284390b0ce | 7 | * Project: CMSIS DSP Library |
mbed_official | 3:7a284390b0ce | 8 | * Title: arm_math.h |
mbed_official | 3:7a284390b0ce | 9 | * |
mbed_official | 3:7a284390b0ce | 10 | * Description: Public header file for CMSIS DSP Library |
mbed_official | 3:7a284390b0ce | 11 | * |
mbed_official | 3:7a284390b0ce | 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 |
mbed_official | 3:7a284390b0ce | 13 | * |
mbed_official | 3:7a284390b0ce | 14 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 3:7a284390b0ce | 15 | * modification, are permitted provided that the following conditions |
mbed_official | 3:7a284390b0ce | 16 | * are met: |
mbed_official | 3:7a284390b0ce | 17 | * - Redistributions of source code must retain the above copyright |
mbed_official | 3:7a284390b0ce | 18 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 3:7a284390b0ce | 19 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 3:7a284390b0ce | 20 | * notice, this list of conditions and the following disclaimer in |
mbed_official | 3:7a284390b0ce | 21 | * the documentation and/or other materials provided with the |
mbed_official | 3:7a284390b0ce | 22 | * distribution. |
mbed_official | 3:7a284390b0ce | 23 | * - Neither the name of ARM LIMITED nor the names of its contributors |
mbed_official | 3:7a284390b0ce | 24 | * may be used to endorse or promote products derived from this |
mbed_official | 3:7a284390b0ce | 25 | * software without specific prior written permission. |
mbed_official | 3:7a284390b0ce | 26 | * |
mbed_official | 3:7a284390b0ce | 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
mbed_official | 3:7a284390b0ce | 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
mbed_official | 3:7a284390b0ce | 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
mbed_official | 3:7a284390b0ce | 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
mbed_official | 3:7a284390b0ce | 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
mbed_official | 3:7a284390b0ce | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
mbed_official | 3:7a284390b0ce | 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
mbed_official | 3:7a284390b0ce | 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 3:7a284390b0ce | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
mbed_official | 3:7a284390b0ce | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
mbed_official | 3:7a284390b0ce | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 3:7a284390b0ce | 38 | * POSSIBILITY OF SUCH DAMAGE. |
emilmont | 1:fdd22bb7aa52 | 39 | * -------------------------------------------------------------------- */ |
emilmont | 1:fdd22bb7aa52 | 40 | |
emilmont | 1:fdd22bb7aa52 | 41 | /** |
emilmont | 1:fdd22bb7aa52 | 42 | \mainpage CMSIS DSP Software Library |
emilmont | 1:fdd22bb7aa52 | 43 | * |
emilmont | 1:fdd22bb7aa52 | 44 | * <b>Introduction</b> |
emilmont | 1:fdd22bb7aa52 | 45 | * |
mbed_official | 3:7a284390b0ce | 46 | * This user manual describes the CMSIS DSP software library, |
emilmont | 1:fdd22bb7aa52 | 47 | * a suite of common signal processing functions for use on Cortex-M processor based devices. |
emilmont | 1:fdd22bb7aa52 | 48 | * |
mbed_official | 3:7a284390b0ce | 49 | * The library is divided into a number of functions each covering a specific category: |
emilmont | 1:fdd22bb7aa52 | 50 | * - Basic math functions |
emilmont | 1:fdd22bb7aa52 | 51 | * - Fast math functions |
emilmont | 1:fdd22bb7aa52 | 52 | * - Complex math functions |
emilmont | 1:fdd22bb7aa52 | 53 | * - Filters |
emilmont | 1:fdd22bb7aa52 | 54 | * - Matrix functions |
emilmont | 1:fdd22bb7aa52 | 55 | * - Transforms |
emilmont | 1:fdd22bb7aa52 | 56 | * - Motor control functions |
emilmont | 1:fdd22bb7aa52 | 57 | * - Statistical functions |
emilmont | 1:fdd22bb7aa52 | 58 | * - Support functions |
emilmont | 1:fdd22bb7aa52 | 59 | * - Interpolation functions |
emilmont | 1:fdd22bb7aa52 | 60 | * |
emilmont | 1:fdd22bb7aa52 | 61 | * The library has separate functions for operating on 8-bit integers, 16-bit integers, |
mbed_official | 3:7a284390b0ce | 62 | * 32-bit integer and 32-bit floating-point values. |
emilmont | 1:fdd22bb7aa52 | 63 | * |
emilmont | 1:fdd22bb7aa52 | 64 | * <b>Using the Library</b> |
emilmont | 1:fdd22bb7aa52 | 65 | * |
emilmont | 1:fdd22bb7aa52 | 66 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder. |
emilmont | 1:fdd22bb7aa52 | 67 | * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) |
emilmont | 1:fdd22bb7aa52 | 68 | * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) |
emilmont | 1:fdd22bb7aa52 | 69 | * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) |
emilmont | 1:fdd22bb7aa52 | 70 | * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) |
emilmont | 1:fdd22bb7aa52 | 71 | * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) |
emilmont | 1:fdd22bb7aa52 | 72 | * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) |
emilmont | 1:fdd22bb7aa52 | 73 | * - arm_cortexM0l_math.lib (Little endian on Cortex-M0) |
emilmont | 1:fdd22bb7aa52 | 74 | * - arm_cortexM0b_math.lib (Big endian on Cortex-M3) |
emilmont | 1:fdd22bb7aa52 | 75 | * |
emilmont | 1:fdd22bb7aa52 | 76 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder. |
mbed_official | 3:7a284390b0ce | 77 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single |
mbed_official | 3:7a284390b0ce | 78 | * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. |
mbed_official | 3:7a284390b0ce | 79 | * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or |
mbed_official | 3:7a284390b0ce | 80 | * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. |
emilmont | 1:fdd22bb7aa52 | 81 | * |
emilmont | 1:fdd22bb7aa52 | 82 | * <b>Examples</b> |
emilmont | 1:fdd22bb7aa52 | 83 | * |
emilmont | 1:fdd22bb7aa52 | 84 | * The library ships with a number of examples which demonstrate how to use the library functions. |
emilmont | 1:fdd22bb7aa52 | 85 | * |
mbed_official | 3:7a284390b0ce | 86 | * <b>Toolchain Support</b> |
mbed_official | 3:7a284390b0ce | 87 | * |
mbed_official | 3:7a284390b0ce | 88 | * The library has been developed and tested with MDK-ARM version 4.60. |
mbed_official | 3:7a284390b0ce | 89 | * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. |
mbed_official | 3:7a284390b0ce | 90 | * |
emilmont | 1:fdd22bb7aa52 | 91 | * <b>Building the Library</b> |
emilmont | 1:fdd22bb7aa52 | 92 | * |
emilmont | 1:fdd22bb7aa52 | 93 | * The library installer contains project files to re build libraries on MDK Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder. |
emilmont | 1:fdd22bb7aa52 | 94 | * - arm_cortexM0b_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 95 | * - arm_cortexM0l_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 96 | * - arm_cortexM3b_math.uvproj |
mbed_official | 3:7a284390b0ce | 97 | * - arm_cortexM3l_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 98 | * - arm_cortexM4b_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 99 | * - arm_cortexM4l_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 100 | * - arm_cortexM4bf_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 101 | * - arm_cortexM4lf_math.uvproj |
emilmont | 1:fdd22bb7aa52 | 102 | * |
emilmont | 1:fdd22bb7aa52 | 103 | * |
mbed_official | 3:7a284390b0ce | 104 | * The project can be built by opening the appropriate project in MDK-ARM 4.60 chain and defining the optional pre processor MACROs detailed above. |
mbed_official | 3:7a284390b0ce | 105 | * |
mbed_official | 3:7a284390b0ce | 106 | * <b>Pre-processor Macros</b> |
mbed_official | 3:7a284390b0ce | 107 | * |
mbed_official | 3:7a284390b0ce | 108 | * Each library project have differant pre-processor macros. |
mbed_official | 3:7a284390b0ce | 109 | * |
mbed_official | 3:7a284390b0ce | 110 | * - UNALIGNED_SUPPORT_DISABLE: |
mbed_official | 3:7a284390b0ce | 111 | * |
mbed_official | 3:7a284390b0ce | 112 | * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access |
mbed_official | 3:7a284390b0ce | 113 | * |
mbed_official | 3:7a284390b0ce | 114 | * - ARM_MATH_BIG_ENDIAN: |
mbed_official | 3:7a284390b0ce | 115 | * |
mbed_official | 3:7a284390b0ce | 116 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. |
mbed_official | 3:7a284390b0ce | 117 | * |
mbed_official | 3:7a284390b0ce | 118 | * - ARM_MATH_MATRIX_CHECK: |
mbed_official | 3:7a284390b0ce | 119 | * |
mbed_official | 3:7a284390b0ce | 120 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices |
mbed_official | 3:7a284390b0ce | 121 | * |
mbed_official | 3:7a284390b0ce | 122 | * - ARM_MATH_ROUNDING: |
mbed_official | 3:7a284390b0ce | 123 | * |
mbed_official | 3:7a284390b0ce | 124 | * Define macro ARM_MATH_ROUNDING for rounding on support functions |
mbed_official | 3:7a284390b0ce | 125 | * |
mbed_official | 3:7a284390b0ce | 126 | * - ARM_MATH_CMx: |
mbed_official | 3:7a284390b0ce | 127 | * |
mbed_official | 3:7a284390b0ce | 128 | * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target |
mbed_official | 3:7a284390b0ce | 129 | * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target. |
mbed_official | 3:7a284390b0ce | 130 | * |
mbed_official | 3:7a284390b0ce | 131 | * - __FPU_PRESENT: |
mbed_official | 3:7a284390b0ce | 132 | * |
mbed_official | 3:7a284390b0ce | 133 | * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries |
emilmont | 1:fdd22bb7aa52 | 134 | * |
emilmont | 1:fdd22bb7aa52 | 135 | * <b>Copyright Notice</b> |
emilmont | 1:fdd22bb7aa52 | 136 | * |
mbed_official | 3:7a284390b0ce | 137 | * Copyright (C) 2010-2013 ARM Limited. All rights reserved. |
emilmont | 1:fdd22bb7aa52 | 138 | */ |
emilmont | 1:fdd22bb7aa52 | 139 | |
emilmont | 1:fdd22bb7aa52 | 140 | |
emilmont | 1:fdd22bb7aa52 | 141 | /** |
emilmont | 1:fdd22bb7aa52 | 142 | * @defgroup groupMath Basic Math Functions |
emilmont | 1:fdd22bb7aa52 | 143 | */ |
emilmont | 1:fdd22bb7aa52 | 144 | |
emilmont | 1:fdd22bb7aa52 | 145 | /** |
emilmont | 1:fdd22bb7aa52 | 146 | * @defgroup groupFastMath Fast Math Functions |
emilmont | 1:fdd22bb7aa52 | 147 | * This set of functions provides a fast approximation to sine, cosine, and square root. |
emilmont | 1:fdd22bb7aa52 | 148 | * As compared to most of the other functions in the CMSIS math library, the fast math functions |
emilmont | 1:fdd22bb7aa52 | 149 | * operate on individual values and not arrays. |
emilmont | 1:fdd22bb7aa52 | 150 | * There are separate functions for Q15, Q31, and floating-point data. |
emilmont | 1:fdd22bb7aa52 | 151 | * |
emilmont | 1:fdd22bb7aa52 | 152 | */ |
emilmont | 1:fdd22bb7aa52 | 153 | |
emilmont | 1:fdd22bb7aa52 | 154 | /** |
emilmont | 1:fdd22bb7aa52 | 155 | * @defgroup groupCmplxMath Complex Math Functions |
emilmont | 1:fdd22bb7aa52 | 156 | * This set of functions operates on complex data vectors. |
emilmont | 1:fdd22bb7aa52 | 157 | * The data in the complex arrays is stored in an interleaved fashion |
emilmont | 1:fdd22bb7aa52 | 158 | * (real, imag, real, imag, ...). |
emilmont | 1:fdd22bb7aa52 | 159 | * In the API functions, the number of samples in a complex array refers |
emilmont | 1:fdd22bb7aa52 | 160 | * to the number of complex values; the array contains twice this number of |
emilmont | 1:fdd22bb7aa52 | 161 | * real values. |
emilmont | 1:fdd22bb7aa52 | 162 | */ |
emilmont | 1:fdd22bb7aa52 | 163 | |
emilmont | 1:fdd22bb7aa52 | 164 | /** |
emilmont | 1:fdd22bb7aa52 | 165 | * @defgroup groupFilters Filtering Functions |
emilmont | 1:fdd22bb7aa52 | 166 | */ |
emilmont | 1:fdd22bb7aa52 | 167 | |
emilmont | 1:fdd22bb7aa52 | 168 | /** |
emilmont | 1:fdd22bb7aa52 | 169 | * @defgroup groupMatrix Matrix Functions |
emilmont | 1:fdd22bb7aa52 | 170 | * |
emilmont | 1:fdd22bb7aa52 | 171 | * This set of functions provides basic matrix math operations. |
emilmont | 1:fdd22bb7aa52 | 172 | * The functions operate on matrix data structures. For example, |
emilmont | 1:fdd22bb7aa52 | 173 | * the type |
emilmont | 1:fdd22bb7aa52 | 174 | * definition for the floating-point matrix structure is shown |
emilmont | 1:fdd22bb7aa52 | 175 | * below: |
emilmont | 1:fdd22bb7aa52 | 176 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 177 | * typedef struct |
emilmont | 1:fdd22bb7aa52 | 178 | * { |
emilmont | 1:fdd22bb7aa52 | 179 | * uint16_t numRows; // number of rows of the matrix. |
emilmont | 1:fdd22bb7aa52 | 180 | * uint16_t numCols; // number of columns of the matrix. |
emilmont | 1:fdd22bb7aa52 | 181 | * float32_t *pData; // points to the data of the matrix. |
emilmont | 1:fdd22bb7aa52 | 182 | * } arm_matrix_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 183 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 184 | * There are similar definitions for Q15 and Q31 data types. |
emilmont | 1:fdd22bb7aa52 | 185 | * |
emilmont | 1:fdd22bb7aa52 | 186 | * The structure specifies the size of the matrix and then points to |
emilmont | 1:fdd22bb7aa52 | 187 | * an array of data. The array is of size <code>numRows X numCols</code> |
emilmont | 1:fdd22bb7aa52 | 188 | * and the values are arranged in row order. That is, the |
emilmont | 1:fdd22bb7aa52 | 189 | * matrix element (i, j) is stored at: |
emilmont | 1:fdd22bb7aa52 | 190 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 191 | * pData[i*numCols + j] |
emilmont | 1:fdd22bb7aa52 | 192 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 193 | * |
emilmont | 1:fdd22bb7aa52 | 194 | * \par Init Functions |
emilmont | 1:fdd22bb7aa52 | 195 | * There is an associated initialization function for each type of matrix |
emilmont | 1:fdd22bb7aa52 | 196 | * data structure. |
emilmont | 1:fdd22bb7aa52 | 197 | * The initialization function sets the values of the internal structure fields. |
emilmont | 1:fdd22bb7aa52 | 198 | * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code> |
emilmont | 1:fdd22bb7aa52 | 199 | * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively. |
emilmont | 1:fdd22bb7aa52 | 200 | * |
emilmont | 1:fdd22bb7aa52 | 201 | * \par |
emilmont | 1:fdd22bb7aa52 | 202 | * Use of the initialization function is optional. However, if initialization function is used |
emilmont | 1:fdd22bb7aa52 | 203 | * then the instance structure cannot be placed into a const data section. |
emilmont | 1:fdd22bb7aa52 | 204 | * To place the instance structure in a const data |
emilmont | 1:fdd22bb7aa52 | 205 | * section, manually initialize the data structure. For example: |
emilmont | 1:fdd22bb7aa52 | 206 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 207 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code> |
emilmont | 1:fdd22bb7aa52 | 208 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code> |
emilmont | 1:fdd22bb7aa52 | 209 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code> |
emilmont | 1:fdd22bb7aa52 | 210 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 211 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code> |
emilmont | 1:fdd22bb7aa52 | 212 | * specifies the number of columns, and <code>pData</code> points to the |
emilmont | 1:fdd22bb7aa52 | 213 | * data array. |
emilmont | 1:fdd22bb7aa52 | 214 | * |
emilmont | 1:fdd22bb7aa52 | 215 | * \par Size Checking |
emilmont | 1:fdd22bb7aa52 | 216 | * By default all of the matrix functions perform size checking on the input and |
emilmont | 1:fdd22bb7aa52 | 217 | * output matrices. For example, the matrix addition function verifies that the |
emilmont | 1:fdd22bb7aa52 | 218 | * two input matrices and the output matrix all have the same number of rows and |
emilmont | 1:fdd22bb7aa52 | 219 | * columns. If the size check fails the functions return: |
emilmont | 1:fdd22bb7aa52 | 220 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 221 | * ARM_MATH_SIZE_MISMATCH |
emilmont | 1:fdd22bb7aa52 | 222 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 223 | * Otherwise the functions return |
emilmont | 1:fdd22bb7aa52 | 224 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 225 | * ARM_MATH_SUCCESS |
emilmont | 1:fdd22bb7aa52 | 226 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 227 | * There is some overhead associated with this matrix size checking. |
emilmont | 1:fdd22bb7aa52 | 228 | * The matrix size checking is enabled via the \#define |
emilmont | 1:fdd22bb7aa52 | 229 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 230 | * ARM_MATH_MATRIX_CHECK |
emilmont | 1:fdd22bb7aa52 | 231 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 232 | * within the library project settings. By default this macro is defined |
emilmont | 1:fdd22bb7aa52 | 233 | * and size checking is enabled. By changing the project settings and |
emilmont | 1:fdd22bb7aa52 | 234 | * undefining this macro size checking is eliminated and the functions |
emilmont | 1:fdd22bb7aa52 | 235 | * run a bit faster. With size checking disabled the functions always |
emilmont | 1:fdd22bb7aa52 | 236 | * return <code>ARM_MATH_SUCCESS</code>. |
emilmont | 1:fdd22bb7aa52 | 237 | */ |
emilmont | 1:fdd22bb7aa52 | 238 | |
emilmont | 1:fdd22bb7aa52 | 239 | /** |
emilmont | 1:fdd22bb7aa52 | 240 | * @defgroup groupTransforms Transform Functions |
emilmont | 1:fdd22bb7aa52 | 241 | */ |
emilmont | 1:fdd22bb7aa52 | 242 | |
emilmont | 1:fdd22bb7aa52 | 243 | /** |
emilmont | 1:fdd22bb7aa52 | 244 | * @defgroup groupController Controller Functions |
emilmont | 1:fdd22bb7aa52 | 245 | */ |
emilmont | 1:fdd22bb7aa52 | 246 | |
emilmont | 1:fdd22bb7aa52 | 247 | /** |
emilmont | 1:fdd22bb7aa52 | 248 | * @defgroup groupStats Statistics Functions |
emilmont | 1:fdd22bb7aa52 | 249 | */ |
emilmont | 1:fdd22bb7aa52 | 250 | /** |
emilmont | 1:fdd22bb7aa52 | 251 | * @defgroup groupSupport Support Functions |
emilmont | 1:fdd22bb7aa52 | 252 | */ |
emilmont | 1:fdd22bb7aa52 | 253 | |
emilmont | 1:fdd22bb7aa52 | 254 | /** |
emilmont | 1:fdd22bb7aa52 | 255 | * @defgroup groupInterpolation Interpolation Functions |
emilmont | 1:fdd22bb7aa52 | 256 | * These functions perform 1- and 2-dimensional interpolation of data. |
emilmont | 1:fdd22bb7aa52 | 257 | * Linear interpolation is used for 1-dimensional data and |
emilmont | 1:fdd22bb7aa52 | 258 | * bilinear interpolation is used for 2-dimensional data. |
emilmont | 1:fdd22bb7aa52 | 259 | */ |
emilmont | 1:fdd22bb7aa52 | 260 | |
emilmont | 1:fdd22bb7aa52 | 261 | /** |
emilmont | 1:fdd22bb7aa52 | 262 | * @defgroup groupExamples Examples |
emilmont | 1:fdd22bb7aa52 | 263 | */ |
emilmont | 1:fdd22bb7aa52 | 264 | #ifndef _ARM_MATH_H |
emilmont | 1:fdd22bb7aa52 | 265 | #define _ARM_MATH_H |
emilmont | 1:fdd22bb7aa52 | 266 | |
emilmont | 1:fdd22bb7aa52 | 267 | #define __CMSIS_GENERIC /* disable NVIC and Systick functions */ |
emilmont | 1:fdd22bb7aa52 | 268 | |
emilmont | 1:fdd22bb7aa52 | 269 | #if defined (ARM_MATH_CM4) |
emilmont | 1:fdd22bb7aa52 | 270 | #include "core_cm4.h" |
emilmont | 1:fdd22bb7aa52 | 271 | #elif defined (ARM_MATH_CM3) |
emilmont | 1:fdd22bb7aa52 | 272 | #include "core_cm3.h" |
emilmont | 1:fdd22bb7aa52 | 273 | #elif defined (ARM_MATH_CM0) |
emilmont | 1:fdd22bb7aa52 | 274 | #include "core_cm0.h" |
mbed_official | 3:7a284390b0ce | 275 | #define ARM_MATH_CM0_FAMILY |
mbed_official | 3:7a284390b0ce | 276 | #elif defined (ARM_MATH_CM0PLUS) |
mbed_official | 3:7a284390b0ce | 277 | #include "core_cm0plus.h" |
mbed_official | 3:7a284390b0ce | 278 | #define ARM_MATH_CM0_FAMILY |
emilmont | 1:fdd22bb7aa52 | 279 | #else |
emilmont | 1:fdd22bb7aa52 | 280 | #include "ARMCM4.h" |
emilmont | 1:fdd22bb7aa52 | 281 | #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....." |
emilmont | 1:fdd22bb7aa52 | 282 | #endif |
emilmont | 1:fdd22bb7aa52 | 283 | |
emilmont | 1:fdd22bb7aa52 | 284 | #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ |
emilmont | 1:fdd22bb7aa52 | 285 | #include "string.h" |
emilmont | 1:fdd22bb7aa52 | 286 | #include "math.h" |
emilmont | 2:da51fb522205 | 287 | #ifdef __cplusplus |
emilmont | 1:fdd22bb7aa52 | 288 | extern "C" |
emilmont | 1:fdd22bb7aa52 | 289 | { |
emilmont | 1:fdd22bb7aa52 | 290 | #endif |
emilmont | 1:fdd22bb7aa52 | 291 | |
emilmont | 1:fdd22bb7aa52 | 292 | |
emilmont | 1:fdd22bb7aa52 | 293 | /** |
emilmont | 1:fdd22bb7aa52 | 294 | * @brief Macros required for reciprocal calculation in Normalized LMS |
emilmont | 1:fdd22bb7aa52 | 295 | */ |
emilmont | 1:fdd22bb7aa52 | 296 | |
emilmont | 2:da51fb522205 | 297 | #define DELTA_Q31 (0x100) |
emilmont | 2:da51fb522205 | 298 | #define DELTA_Q15 0x5 |
emilmont | 2:da51fb522205 | 299 | #define INDEX_MASK 0x0000003F |
emilmont | 1:fdd22bb7aa52 | 300 | #ifndef PI |
emilmont | 2:da51fb522205 | 301 | #define PI 3.14159265358979f |
emilmont | 1:fdd22bb7aa52 | 302 | #endif |
emilmont | 1:fdd22bb7aa52 | 303 | |
emilmont | 1:fdd22bb7aa52 | 304 | /** |
emilmont | 1:fdd22bb7aa52 | 305 | * @brief Macros required for SINE and COSINE Fast math approximations |
emilmont | 1:fdd22bb7aa52 | 306 | */ |
emilmont | 1:fdd22bb7aa52 | 307 | |
emilmont | 2:da51fb522205 | 308 | #define TABLE_SIZE 256 |
emilmont | 2:da51fb522205 | 309 | #define TABLE_SPACING_Q31 0x800000 |
emilmont | 2:da51fb522205 | 310 | #define TABLE_SPACING_Q15 0x80 |
emilmont | 1:fdd22bb7aa52 | 311 | |
emilmont | 1:fdd22bb7aa52 | 312 | /** |
emilmont | 1:fdd22bb7aa52 | 313 | * @brief Macros required for SINE and COSINE Controller functions |
emilmont | 1:fdd22bb7aa52 | 314 | */ |
emilmont | 1:fdd22bb7aa52 | 315 | /* 1.31(q31) Fixed value of 2/360 */ |
emilmont | 1:fdd22bb7aa52 | 316 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ |
emilmont | 2:da51fb522205 | 317 | #define INPUT_SPACING 0xB60B61 |
emilmont | 1:fdd22bb7aa52 | 318 | |
emilmont | 1:fdd22bb7aa52 | 319 | /** |
emilmont | 1:fdd22bb7aa52 | 320 | * @brief Macro for Unaligned Support |
emilmont | 1:fdd22bb7aa52 | 321 | */ |
emilmont | 1:fdd22bb7aa52 | 322 | #ifndef UNALIGNED_SUPPORT_DISABLE |
emilmont | 1:fdd22bb7aa52 | 323 | #define ALIGN4 |
emilmont | 1:fdd22bb7aa52 | 324 | #else |
emilmont | 1:fdd22bb7aa52 | 325 | #if defined (__GNUC__) |
emilmont | 1:fdd22bb7aa52 | 326 | #define ALIGN4 __attribute__((aligned(4))) |
emilmont | 1:fdd22bb7aa52 | 327 | #else |
emilmont | 1:fdd22bb7aa52 | 328 | #define ALIGN4 __align(4) |
emilmont | 1:fdd22bb7aa52 | 329 | #endif |
emilmont | 2:da51fb522205 | 330 | #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ |
emilmont | 1:fdd22bb7aa52 | 331 | |
emilmont | 1:fdd22bb7aa52 | 332 | /** |
emilmont | 1:fdd22bb7aa52 | 333 | * @brief Error status returned by some functions in the library. |
emilmont | 1:fdd22bb7aa52 | 334 | */ |
emilmont | 1:fdd22bb7aa52 | 335 | |
emilmont | 1:fdd22bb7aa52 | 336 | typedef enum |
emilmont | 1:fdd22bb7aa52 | 337 | { |
emilmont | 1:fdd22bb7aa52 | 338 | ARM_MATH_SUCCESS = 0, /**< No error */ |
emilmont | 1:fdd22bb7aa52 | 339 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ |
emilmont | 1:fdd22bb7aa52 | 340 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ |
emilmont | 1:fdd22bb7aa52 | 341 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ |
emilmont | 1:fdd22bb7aa52 | 342 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ |
emilmont | 1:fdd22bb7aa52 | 343 | ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ |
emilmont | 1:fdd22bb7aa52 | 344 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ |
emilmont | 1:fdd22bb7aa52 | 345 | } arm_status; |
emilmont | 1:fdd22bb7aa52 | 346 | |
emilmont | 1:fdd22bb7aa52 | 347 | /** |
emilmont | 1:fdd22bb7aa52 | 348 | * @brief 8-bit fractional data type in 1.7 format. |
emilmont | 1:fdd22bb7aa52 | 349 | */ |
emilmont | 1:fdd22bb7aa52 | 350 | typedef int8_t q7_t; |
emilmont | 1:fdd22bb7aa52 | 351 | |
emilmont | 1:fdd22bb7aa52 | 352 | /** |
emilmont | 1:fdd22bb7aa52 | 353 | * @brief 16-bit fractional data type in 1.15 format. |
emilmont | 1:fdd22bb7aa52 | 354 | */ |
emilmont | 1:fdd22bb7aa52 | 355 | typedef int16_t q15_t; |
emilmont | 1:fdd22bb7aa52 | 356 | |
emilmont | 1:fdd22bb7aa52 | 357 | /** |
emilmont | 1:fdd22bb7aa52 | 358 | * @brief 32-bit fractional data type in 1.31 format. |
emilmont | 1:fdd22bb7aa52 | 359 | */ |
emilmont | 1:fdd22bb7aa52 | 360 | typedef int32_t q31_t; |
emilmont | 1:fdd22bb7aa52 | 361 | |
emilmont | 1:fdd22bb7aa52 | 362 | /** |
emilmont | 1:fdd22bb7aa52 | 363 | * @brief 64-bit fractional data type in 1.63 format. |
emilmont | 1:fdd22bb7aa52 | 364 | */ |
emilmont | 1:fdd22bb7aa52 | 365 | typedef int64_t q63_t; |
emilmont | 1:fdd22bb7aa52 | 366 | |
emilmont | 1:fdd22bb7aa52 | 367 | /** |
emilmont | 1:fdd22bb7aa52 | 368 | * @brief 32-bit floating-point type definition. |
emilmont | 1:fdd22bb7aa52 | 369 | */ |
emilmont | 1:fdd22bb7aa52 | 370 | typedef float float32_t; |
emilmont | 1:fdd22bb7aa52 | 371 | |
emilmont | 1:fdd22bb7aa52 | 372 | /** |
emilmont | 1:fdd22bb7aa52 | 373 | * @brief 64-bit floating-point type definition. |
emilmont | 1:fdd22bb7aa52 | 374 | */ |
emilmont | 1:fdd22bb7aa52 | 375 | typedef double float64_t; |
emilmont | 1:fdd22bb7aa52 | 376 | |
emilmont | 1:fdd22bb7aa52 | 377 | /** |
emilmont | 1:fdd22bb7aa52 | 378 | * @brief definition to read/write two 16 bit values. |
emilmont | 1:fdd22bb7aa52 | 379 | */ |
mbed_official | 3:7a284390b0ce | 380 | #if defined __CC_ARM |
mbed_official | 3:7a284390b0ce | 381 | #define __SIMD32_TYPE int32_t __packed |
mbed_official | 3:7a284390b0ce | 382 | #define CMSIS_UNUSED __attribute__((unused)) |
mbed_official | 3:7a284390b0ce | 383 | #elif defined __ICCARM__ |
mbed_official | 3:7a284390b0ce | 384 | #define CMSIS_UNUSED |
mbed_official | 3:7a284390b0ce | 385 | #define __SIMD32_TYPE int32_t __packed |
mbed_official | 3:7a284390b0ce | 386 | #elif defined __GNUC__ |
mbed_official | 3:7a284390b0ce | 387 | #define __SIMD32_TYPE int32_t |
mbed_official | 3:7a284390b0ce | 388 | #define CMSIS_UNUSED __attribute__((unused)) |
emilmont | 1:fdd22bb7aa52 | 389 | #else |
mbed_official | 3:7a284390b0ce | 390 | #error Unknown compiler |
mbed_official | 3:7a284390b0ce | 391 | #endif |
mbed_official | 3:7a284390b0ce | 392 | |
mbed_official | 3:7a284390b0ce | 393 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) |
mbed_official | 3:7a284390b0ce | 394 | #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) |
mbed_official | 3:7a284390b0ce | 395 | |
mbed_official | 3:7a284390b0ce | 396 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) |
mbed_official | 3:7a284390b0ce | 397 | |
mbed_official | 3:7a284390b0ce | 398 | #define __SIMD64(addr) (*(int64_t **) & (addr)) |
mbed_official | 3:7a284390b0ce | 399 | |
mbed_official | 3:7a284390b0ce | 400 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
emilmont | 1:fdd22bb7aa52 | 401 | /** |
emilmont | 1:fdd22bb7aa52 | 402 | * @brief definition to pack two 16 bit values. |
emilmont | 1:fdd22bb7aa52 | 403 | */ |
emilmont | 1:fdd22bb7aa52 | 404 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ |
emilmont | 1:fdd22bb7aa52 | 405 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) |
emilmont | 1:fdd22bb7aa52 | 406 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ |
emilmont | 1:fdd22bb7aa52 | 407 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) |
emilmont | 1:fdd22bb7aa52 | 408 | |
emilmont | 1:fdd22bb7aa52 | 409 | #endif |
emilmont | 1:fdd22bb7aa52 | 410 | |
emilmont | 1:fdd22bb7aa52 | 411 | |
emilmont | 1:fdd22bb7aa52 | 412 | /** |
emilmont | 1:fdd22bb7aa52 | 413 | * @brief definition to pack four 8 bit values. |
emilmont | 1:fdd22bb7aa52 | 414 | */ |
emilmont | 1:fdd22bb7aa52 | 415 | #ifndef ARM_MATH_BIG_ENDIAN |
emilmont | 1:fdd22bb7aa52 | 416 | |
emilmont | 2:da51fb522205 | 417 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ |
emilmont | 2:da51fb522205 | 418 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ |
emilmont | 2:da51fb522205 | 419 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ |
emilmont | 2:da51fb522205 | 420 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) |
emilmont | 1:fdd22bb7aa52 | 421 | #else |
emilmont | 1:fdd22bb7aa52 | 422 | |
emilmont | 2:da51fb522205 | 423 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ |
emilmont | 2:da51fb522205 | 424 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ |
emilmont | 2:da51fb522205 | 425 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ |
emilmont | 2:da51fb522205 | 426 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) |
emilmont | 1:fdd22bb7aa52 | 427 | |
emilmont | 1:fdd22bb7aa52 | 428 | #endif |
emilmont | 1:fdd22bb7aa52 | 429 | |
emilmont | 1:fdd22bb7aa52 | 430 | |
emilmont | 1:fdd22bb7aa52 | 431 | /** |
emilmont | 1:fdd22bb7aa52 | 432 | * @brief Clips Q63 to Q31 values. |
emilmont | 1:fdd22bb7aa52 | 433 | */ |
mbed_official | 3:7a284390b0ce | 434 | static __INLINE q31_t clip_q63_to_q31( |
emilmont | 1:fdd22bb7aa52 | 435 | q63_t x) |
emilmont | 1:fdd22bb7aa52 | 436 | { |
emilmont | 1:fdd22bb7aa52 | 437 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
emilmont | 1:fdd22bb7aa52 | 438 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; |
emilmont | 1:fdd22bb7aa52 | 439 | } |
emilmont | 1:fdd22bb7aa52 | 440 | |
emilmont | 1:fdd22bb7aa52 | 441 | /** |
emilmont | 1:fdd22bb7aa52 | 442 | * @brief Clips Q63 to Q15 values. |
emilmont | 1:fdd22bb7aa52 | 443 | */ |
mbed_official | 3:7a284390b0ce | 444 | static __INLINE q15_t clip_q63_to_q15( |
emilmont | 1:fdd22bb7aa52 | 445 | q63_t x) |
emilmont | 1:fdd22bb7aa52 | 446 | { |
emilmont | 1:fdd22bb7aa52 | 447 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
emilmont | 1:fdd22bb7aa52 | 448 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); |
emilmont | 1:fdd22bb7aa52 | 449 | } |
emilmont | 1:fdd22bb7aa52 | 450 | |
emilmont | 1:fdd22bb7aa52 | 451 | /** |
emilmont | 1:fdd22bb7aa52 | 452 | * @brief Clips Q31 to Q7 values. |
emilmont | 1:fdd22bb7aa52 | 453 | */ |
mbed_official | 3:7a284390b0ce | 454 | static __INLINE q7_t clip_q31_to_q7( |
emilmont | 1:fdd22bb7aa52 | 455 | q31_t x) |
emilmont | 1:fdd22bb7aa52 | 456 | { |
emilmont | 1:fdd22bb7aa52 | 457 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? |
emilmont | 1:fdd22bb7aa52 | 458 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; |
emilmont | 1:fdd22bb7aa52 | 459 | } |
emilmont | 1:fdd22bb7aa52 | 460 | |
emilmont | 1:fdd22bb7aa52 | 461 | /** |
emilmont | 1:fdd22bb7aa52 | 462 | * @brief Clips Q31 to Q15 values. |
emilmont | 1:fdd22bb7aa52 | 463 | */ |
mbed_official | 3:7a284390b0ce | 464 | static __INLINE q15_t clip_q31_to_q15( |
emilmont | 1:fdd22bb7aa52 | 465 | q31_t x) |
emilmont | 1:fdd22bb7aa52 | 466 | { |
emilmont | 1:fdd22bb7aa52 | 467 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? |
emilmont | 1:fdd22bb7aa52 | 468 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; |
emilmont | 1:fdd22bb7aa52 | 469 | } |
emilmont | 1:fdd22bb7aa52 | 470 | |
emilmont | 1:fdd22bb7aa52 | 471 | /** |
emilmont | 1:fdd22bb7aa52 | 472 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. |
emilmont | 1:fdd22bb7aa52 | 473 | */ |
emilmont | 1:fdd22bb7aa52 | 474 | |
mbed_official | 3:7a284390b0ce | 475 | static __INLINE q63_t mult32x64( |
emilmont | 1:fdd22bb7aa52 | 476 | q63_t x, |
emilmont | 1:fdd22bb7aa52 | 477 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 478 | { |
emilmont | 1:fdd22bb7aa52 | 479 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + |
emilmont | 1:fdd22bb7aa52 | 480 | (((q63_t) (x >> 32) * y))); |
emilmont | 1:fdd22bb7aa52 | 481 | } |
emilmont | 1:fdd22bb7aa52 | 482 | |
emilmont | 1:fdd22bb7aa52 | 483 | |
mbed_official | 3:7a284390b0ce | 484 | #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) |
emilmont | 1:fdd22bb7aa52 | 485 | #define __CLZ __clz |
mbed_official | 3:7a284390b0ce | 486 | #elif defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) ) |
mbed_official | 3:7a284390b0ce | 487 | |
mbed_official | 3:7a284390b0ce | 488 | static __INLINE uint32_t __CLZ( |
mbed_official | 3:7a284390b0ce | 489 | q31_t data); |
mbed_official | 3:7a284390b0ce | 490 | |
mbed_official | 3:7a284390b0ce | 491 | |
mbed_official | 3:7a284390b0ce | 492 | static __INLINE uint32_t __CLZ( |
mbed_official | 3:7a284390b0ce | 493 | q31_t data) |
emilmont | 1:fdd22bb7aa52 | 494 | { |
emilmont | 1:fdd22bb7aa52 | 495 | uint32_t count = 0; |
emilmont | 1:fdd22bb7aa52 | 496 | uint32_t mask = 0x80000000; |
emilmont | 1:fdd22bb7aa52 | 497 | |
emilmont | 1:fdd22bb7aa52 | 498 | while((data & mask) == 0) |
emilmont | 1:fdd22bb7aa52 | 499 | { |
emilmont | 1:fdd22bb7aa52 | 500 | count += 1u; |
emilmont | 1:fdd22bb7aa52 | 501 | mask = mask >> 1u; |
emilmont | 1:fdd22bb7aa52 | 502 | } |
emilmont | 1:fdd22bb7aa52 | 503 | |
emilmont | 1:fdd22bb7aa52 | 504 | return (count); |
emilmont | 1:fdd22bb7aa52 | 505 | |
emilmont | 1:fdd22bb7aa52 | 506 | } |
emilmont | 1:fdd22bb7aa52 | 507 | |
emilmont | 1:fdd22bb7aa52 | 508 | #endif |
emilmont | 1:fdd22bb7aa52 | 509 | |
emilmont | 1:fdd22bb7aa52 | 510 | /** |
mbed_official | 3:7a284390b0ce | 511 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. |
mbed_official | 3:7a284390b0ce | 512 | */ |
mbed_official | 3:7a284390b0ce | 513 | |
mbed_official | 3:7a284390b0ce | 514 | static __INLINE uint32_t arm_recip_q31( |
emilmont | 1:fdd22bb7aa52 | 515 | q31_t in, |
emilmont | 1:fdd22bb7aa52 | 516 | q31_t * dst, |
emilmont | 1:fdd22bb7aa52 | 517 | q31_t * pRecipTable) |
emilmont | 1:fdd22bb7aa52 | 518 | { |
emilmont | 1:fdd22bb7aa52 | 519 | |
emilmont | 1:fdd22bb7aa52 | 520 | uint32_t out, tempVal; |
emilmont | 1:fdd22bb7aa52 | 521 | uint32_t index, i; |
emilmont | 1:fdd22bb7aa52 | 522 | uint32_t signBits; |
emilmont | 1:fdd22bb7aa52 | 523 | |
emilmont | 1:fdd22bb7aa52 | 524 | if(in > 0) |
emilmont | 1:fdd22bb7aa52 | 525 | { |
emilmont | 1:fdd22bb7aa52 | 526 | signBits = __CLZ(in) - 1; |
emilmont | 1:fdd22bb7aa52 | 527 | } |
emilmont | 1:fdd22bb7aa52 | 528 | else |
emilmont | 1:fdd22bb7aa52 | 529 | { |
emilmont | 1:fdd22bb7aa52 | 530 | signBits = __CLZ(-in) - 1; |
emilmont | 1:fdd22bb7aa52 | 531 | } |
emilmont | 1:fdd22bb7aa52 | 532 | |
emilmont | 1:fdd22bb7aa52 | 533 | /* Convert input sample to 1.31 format */ |
emilmont | 1:fdd22bb7aa52 | 534 | in = in << signBits; |
emilmont | 1:fdd22bb7aa52 | 535 | |
emilmont | 1:fdd22bb7aa52 | 536 | /* calculation of index for initial approximated Val */ |
emilmont | 1:fdd22bb7aa52 | 537 | index = (uint32_t) (in >> 24u); |
emilmont | 1:fdd22bb7aa52 | 538 | index = (index & INDEX_MASK); |
emilmont | 1:fdd22bb7aa52 | 539 | |
emilmont | 1:fdd22bb7aa52 | 540 | /* 1.31 with exp 1 */ |
emilmont | 1:fdd22bb7aa52 | 541 | out = pRecipTable[index]; |
emilmont | 1:fdd22bb7aa52 | 542 | |
emilmont | 1:fdd22bb7aa52 | 543 | /* calculation of reciprocal value */ |
emilmont | 1:fdd22bb7aa52 | 544 | /* running approximation for two iterations */ |
emilmont | 1:fdd22bb7aa52 | 545 | for (i = 0u; i < 2u; i++) |
emilmont | 1:fdd22bb7aa52 | 546 | { |
emilmont | 1:fdd22bb7aa52 | 547 | tempVal = (q31_t) (((q63_t) in * out) >> 31u); |
emilmont | 1:fdd22bb7aa52 | 548 | tempVal = 0x7FFFFFFF - tempVal; |
emilmont | 1:fdd22bb7aa52 | 549 | /* 1.31 with exp 1 */ |
emilmont | 1:fdd22bb7aa52 | 550 | //out = (q31_t) (((q63_t) out * tempVal) >> 30u); |
emilmont | 1:fdd22bb7aa52 | 551 | out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u); |
emilmont | 1:fdd22bb7aa52 | 552 | } |
emilmont | 1:fdd22bb7aa52 | 553 | |
emilmont | 1:fdd22bb7aa52 | 554 | /* write output */ |
emilmont | 1:fdd22bb7aa52 | 555 | *dst = out; |
emilmont | 1:fdd22bb7aa52 | 556 | |
emilmont | 1:fdd22bb7aa52 | 557 | /* return num of signbits of out = 1/in value */ |
emilmont | 1:fdd22bb7aa52 | 558 | return (signBits + 1u); |
emilmont | 1:fdd22bb7aa52 | 559 | |
emilmont | 1:fdd22bb7aa52 | 560 | } |
emilmont | 1:fdd22bb7aa52 | 561 | |
emilmont | 1:fdd22bb7aa52 | 562 | /** |
mbed_official | 3:7a284390b0ce | 563 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. |
mbed_official | 3:7a284390b0ce | 564 | */ |
mbed_official | 3:7a284390b0ce | 565 | static __INLINE uint32_t arm_recip_q15( |
emilmont | 1:fdd22bb7aa52 | 566 | q15_t in, |
emilmont | 1:fdd22bb7aa52 | 567 | q15_t * dst, |
emilmont | 1:fdd22bb7aa52 | 568 | q15_t * pRecipTable) |
emilmont | 1:fdd22bb7aa52 | 569 | { |
emilmont | 1:fdd22bb7aa52 | 570 | |
emilmont | 1:fdd22bb7aa52 | 571 | uint32_t out = 0, tempVal = 0; |
emilmont | 1:fdd22bb7aa52 | 572 | uint32_t index = 0, i = 0; |
emilmont | 1:fdd22bb7aa52 | 573 | uint32_t signBits = 0; |
emilmont | 1:fdd22bb7aa52 | 574 | |
emilmont | 1:fdd22bb7aa52 | 575 | if(in > 0) |
emilmont | 1:fdd22bb7aa52 | 576 | { |
emilmont | 1:fdd22bb7aa52 | 577 | signBits = __CLZ(in) - 17; |
emilmont | 1:fdd22bb7aa52 | 578 | } |
emilmont | 1:fdd22bb7aa52 | 579 | else |
emilmont | 1:fdd22bb7aa52 | 580 | { |
emilmont | 1:fdd22bb7aa52 | 581 | signBits = __CLZ(-in) - 17; |
emilmont | 1:fdd22bb7aa52 | 582 | } |
emilmont | 1:fdd22bb7aa52 | 583 | |
emilmont | 1:fdd22bb7aa52 | 584 | /* Convert input sample to 1.15 format */ |
emilmont | 1:fdd22bb7aa52 | 585 | in = in << signBits; |
emilmont | 1:fdd22bb7aa52 | 586 | |
emilmont | 1:fdd22bb7aa52 | 587 | /* calculation of index for initial approximated Val */ |
emilmont | 1:fdd22bb7aa52 | 588 | index = in >> 8; |
emilmont | 1:fdd22bb7aa52 | 589 | index = (index & INDEX_MASK); |
emilmont | 1:fdd22bb7aa52 | 590 | |
emilmont | 1:fdd22bb7aa52 | 591 | /* 1.15 with exp 1 */ |
emilmont | 1:fdd22bb7aa52 | 592 | out = pRecipTable[index]; |
emilmont | 1:fdd22bb7aa52 | 593 | |
emilmont | 1:fdd22bb7aa52 | 594 | /* calculation of reciprocal value */ |
emilmont | 1:fdd22bb7aa52 | 595 | /* running approximation for two iterations */ |
emilmont | 1:fdd22bb7aa52 | 596 | for (i = 0; i < 2; i++) |
emilmont | 1:fdd22bb7aa52 | 597 | { |
emilmont | 1:fdd22bb7aa52 | 598 | tempVal = (q15_t) (((q31_t) in * out) >> 15); |
emilmont | 1:fdd22bb7aa52 | 599 | tempVal = 0x7FFF - tempVal; |
emilmont | 1:fdd22bb7aa52 | 600 | /* 1.15 with exp 1 */ |
emilmont | 1:fdd22bb7aa52 | 601 | out = (q15_t) (((q31_t) out * tempVal) >> 14); |
emilmont | 1:fdd22bb7aa52 | 602 | } |
emilmont | 1:fdd22bb7aa52 | 603 | |
emilmont | 1:fdd22bb7aa52 | 604 | /* write output */ |
emilmont | 1:fdd22bb7aa52 | 605 | *dst = out; |
emilmont | 1:fdd22bb7aa52 | 606 | |
emilmont | 1:fdd22bb7aa52 | 607 | /* return num of signbits of out = 1/in value */ |
emilmont | 1:fdd22bb7aa52 | 608 | return (signBits + 1); |
emilmont | 1:fdd22bb7aa52 | 609 | |
emilmont | 1:fdd22bb7aa52 | 610 | } |
emilmont | 1:fdd22bb7aa52 | 611 | |
emilmont | 1:fdd22bb7aa52 | 612 | |
emilmont | 1:fdd22bb7aa52 | 613 | /* |
emilmont | 1:fdd22bb7aa52 | 614 | * @brief C custom defined intrinisic function for only M0 processors |
emilmont | 1:fdd22bb7aa52 | 615 | */ |
mbed_official | 3:7a284390b0ce | 616 | #if defined(ARM_MATH_CM0_FAMILY) |
mbed_official | 3:7a284390b0ce | 617 | |
mbed_official | 3:7a284390b0ce | 618 | static __INLINE q31_t __SSAT( |
emilmont | 1:fdd22bb7aa52 | 619 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 620 | uint32_t y) |
emilmont | 1:fdd22bb7aa52 | 621 | { |
emilmont | 1:fdd22bb7aa52 | 622 | int32_t posMax, negMin; |
emilmont | 1:fdd22bb7aa52 | 623 | uint32_t i; |
emilmont | 1:fdd22bb7aa52 | 624 | |
emilmont | 1:fdd22bb7aa52 | 625 | posMax = 1; |
emilmont | 1:fdd22bb7aa52 | 626 | for (i = 0; i < (y - 1); i++) |
emilmont | 1:fdd22bb7aa52 | 627 | { |
emilmont | 1:fdd22bb7aa52 | 628 | posMax = posMax * 2; |
emilmont | 1:fdd22bb7aa52 | 629 | } |
emilmont | 1:fdd22bb7aa52 | 630 | |
emilmont | 1:fdd22bb7aa52 | 631 | if(x > 0) |
emilmont | 1:fdd22bb7aa52 | 632 | { |
emilmont | 1:fdd22bb7aa52 | 633 | posMax = (posMax - 1); |
emilmont | 1:fdd22bb7aa52 | 634 | |
emilmont | 1:fdd22bb7aa52 | 635 | if(x > posMax) |
emilmont | 1:fdd22bb7aa52 | 636 | { |
emilmont | 1:fdd22bb7aa52 | 637 | x = posMax; |
emilmont | 1:fdd22bb7aa52 | 638 | } |
emilmont | 1:fdd22bb7aa52 | 639 | } |
emilmont | 1:fdd22bb7aa52 | 640 | else |
emilmont | 1:fdd22bb7aa52 | 641 | { |
emilmont | 1:fdd22bb7aa52 | 642 | negMin = -posMax; |
emilmont | 1:fdd22bb7aa52 | 643 | |
emilmont | 1:fdd22bb7aa52 | 644 | if(x < negMin) |
emilmont | 1:fdd22bb7aa52 | 645 | { |
emilmont | 1:fdd22bb7aa52 | 646 | x = negMin; |
emilmont | 1:fdd22bb7aa52 | 647 | } |
emilmont | 1:fdd22bb7aa52 | 648 | } |
emilmont | 1:fdd22bb7aa52 | 649 | return (x); |
emilmont | 1:fdd22bb7aa52 | 650 | |
emilmont | 1:fdd22bb7aa52 | 651 | |
emilmont | 1:fdd22bb7aa52 | 652 | } |
emilmont | 1:fdd22bb7aa52 | 653 | |
mbed_official | 3:7a284390b0ce | 654 | #endif /* end of ARM_MATH_CM0_FAMILY */ |
emilmont | 1:fdd22bb7aa52 | 655 | |
emilmont | 1:fdd22bb7aa52 | 656 | |
emilmont | 1:fdd22bb7aa52 | 657 | |
emilmont | 1:fdd22bb7aa52 | 658 | /* |
emilmont | 1:fdd22bb7aa52 | 659 | * @brief C custom defined intrinsic function for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 660 | */ |
mbed_official | 3:7a284390b0ce | 661 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
emilmont | 1:fdd22bb7aa52 | 662 | |
emilmont | 1:fdd22bb7aa52 | 663 | /* |
emilmont | 1:fdd22bb7aa52 | 664 | * @brief C custom defined QADD8 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 665 | */ |
mbed_official | 3:7a284390b0ce | 666 | static __INLINE q31_t __QADD8( |
emilmont | 1:fdd22bb7aa52 | 667 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 668 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 669 | { |
emilmont | 1:fdd22bb7aa52 | 670 | |
emilmont | 1:fdd22bb7aa52 | 671 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 672 | q7_t r, s, t, u; |
emilmont | 1:fdd22bb7aa52 | 673 | |
emilmont | 1:fdd22bb7aa52 | 674 | r = (q7_t) x; |
emilmont | 1:fdd22bb7aa52 | 675 | s = (q7_t) y; |
emilmont | 1:fdd22bb7aa52 | 676 | |
emilmont | 1:fdd22bb7aa52 | 677 | r = __SSAT((q31_t) (r + s), 8); |
emilmont | 1:fdd22bb7aa52 | 678 | s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8); |
emilmont | 1:fdd22bb7aa52 | 679 | t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8); |
emilmont | 1:fdd22bb7aa52 | 680 | u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8); |
emilmont | 1:fdd22bb7aa52 | 681 | |
emilmont | 1:fdd22bb7aa52 | 682 | sum = |
emilmont | 1:fdd22bb7aa52 | 683 | (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) | |
emilmont | 1:fdd22bb7aa52 | 684 | (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF); |
emilmont | 1:fdd22bb7aa52 | 685 | |
emilmont | 1:fdd22bb7aa52 | 686 | return sum; |
emilmont | 1:fdd22bb7aa52 | 687 | |
emilmont | 1:fdd22bb7aa52 | 688 | } |
emilmont | 1:fdd22bb7aa52 | 689 | |
emilmont | 1:fdd22bb7aa52 | 690 | /* |
emilmont | 1:fdd22bb7aa52 | 691 | * @brief C custom defined QSUB8 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 692 | */ |
mbed_official | 3:7a284390b0ce | 693 | static __INLINE q31_t __QSUB8( |
emilmont | 1:fdd22bb7aa52 | 694 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 695 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 696 | { |
emilmont | 1:fdd22bb7aa52 | 697 | |
emilmont | 1:fdd22bb7aa52 | 698 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 699 | q31_t r, s, t, u; |
emilmont | 1:fdd22bb7aa52 | 700 | |
emilmont | 1:fdd22bb7aa52 | 701 | r = (q7_t) x; |
emilmont | 1:fdd22bb7aa52 | 702 | s = (q7_t) y; |
emilmont | 1:fdd22bb7aa52 | 703 | |
emilmont | 1:fdd22bb7aa52 | 704 | r = __SSAT((r - s), 8); |
emilmont | 1:fdd22bb7aa52 | 705 | s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8; |
emilmont | 1:fdd22bb7aa52 | 706 | t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16; |
emilmont | 1:fdd22bb7aa52 | 707 | u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24; |
emilmont | 1:fdd22bb7aa52 | 708 | |
emilmont | 1:fdd22bb7aa52 | 709 | sum = |
emilmont | 1:fdd22bb7aa52 | 710 | (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & |
emilmont | 1:fdd22bb7aa52 | 711 | 0x000000FF); |
emilmont | 1:fdd22bb7aa52 | 712 | |
emilmont | 1:fdd22bb7aa52 | 713 | return sum; |
emilmont | 1:fdd22bb7aa52 | 714 | } |
emilmont | 1:fdd22bb7aa52 | 715 | |
emilmont | 1:fdd22bb7aa52 | 716 | /* |
emilmont | 1:fdd22bb7aa52 | 717 | * @brief C custom defined QADD16 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 718 | */ |
emilmont | 1:fdd22bb7aa52 | 719 | |
emilmont | 1:fdd22bb7aa52 | 720 | /* |
emilmont | 1:fdd22bb7aa52 | 721 | * @brief C custom defined QADD16 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 722 | */ |
mbed_official | 3:7a284390b0ce | 723 | static __INLINE q31_t __QADD16( |
emilmont | 1:fdd22bb7aa52 | 724 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 725 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 726 | { |
emilmont | 1:fdd22bb7aa52 | 727 | |
emilmont | 1:fdd22bb7aa52 | 728 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 729 | q31_t r, s; |
emilmont | 1:fdd22bb7aa52 | 730 | |
emilmont | 1:fdd22bb7aa52 | 731 | r = (short) x; |
emilmont | 1:fdd22bb7aa52 | 732 | s = (short) y; |
emilmont | 1:fdd22bb7aa52 | 733 | |
emilmont | 1:fdd22bb7aa52 | 734 | r = __SSAT(r + s, 16); |
emilmont | 1:fdd22bb7aa52 | 735 | s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16; |
emilmont | 1:fdd22bb7aa52 | 736 | |
emilmont | 1:fdd22bb7aa52 | 737 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emilmont | 1:fdd22bb7aa52 | 738 | |
emilmont | 1:fdd22bb7aa52 | 739 | return sum; |
emilmont | 1:fdd22bb7aa52 | 740 | |
emilmont | 1:fdd22bb7aa52 | 741 | } |
emilmont | 1:fdd22bb7aa52 | 742 | |
emilmont | 1:fdd22bb7aa52 | 743 | /* |
emilmont | 1:fdd22bb7aa52 | 744 | * @brief C custom defined SHADD16 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 745 | */ |
mbed_official | 3:7a284390b0ce | 746 | static __INLINE q31_t __SHADD16( |
emilmont | 1:fdd22bb7aa52 | 747 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 748 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 749 | { |
emilmont | 1:fdd22bb7aa52 | 750 | |
emilmont | 1:fdd22bb7aa52 | 751 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 752 | q31_t r, s; |
emilmont | 1:fdd22bb7aa52 | 753 | |
emilmont | 1:fdd22bb7aa52 | 754 | r = (short) x; |
emilmont | 1:fdd22bb7aa52 | 755 | s = (short) y; |
emilmont | 1:fdd22bb7aa52 | 756 | |
emilmont | 1:fdd22bb7aa52 | 757 | r = ((r >> 1) + (s >> 1)); |
emilmont | 1:fdd22bb7aa52 | 758 | s = ((q31_t) ((x >> 17) + (y >> 17))) << 16; |
emilmont | 1:fdd22bb7aa52 | 759 | |
emilmont | 1:fdd22bb7aa52 | 760 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emilmont | 1:fdd22bb7aa52 | 761 | |
emilmont | 1:fdd22bb7aa52 | 762 | return sum; |
emilmont | 1:fdd22bb7aa52 | 763 | |
emilmont | 1:fdd22bb7aa52 | 764 | } |
emilmont | 1:fdd22bb7aa52 | 765 | |
emilmont | 1:fdd22bb7aa52 | 766 | /* |
emilmont | 1:fdd22bb7aa52 | 767 | * @brief C custom defined QSUB16 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 768 | */ |
mbed_official | 3:7a284390b0ce | 769 | static __INLINE q31_t __QSUB16( |
emilmont | 1:fdd22bb7aa52 | 770 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 771 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 772 | { |
emilmont | 1:fdd22bb7aa52 | 773 | |
emilmont | 1:fdd22bb7aa52 | 774 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 775 | q31_t r, s; |
emilmont | 1:fdd22bb7aa52 | 776 | |
emilmont | 1:fdd22bb7aa52 | 777 | r = (short) x; |
emilmont | 1:fdd22bb7aa52 | 778 | s = (short) y; |
emilmont | 1:fdd22bb7aa52 | 779 | |
emilmont | 1:fdd22bb7aa52 | 780 | r = __SSAT(r - s, 16); |
emilmont | 1:fdd22bb7aa52 | 781 | s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16; |
emilmont | 1:fdd22bb7aa52 | 782 | |
emilmont | 1:fdd22bb7aa52 | 783 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emilmont | 1:fdd22bb7aa52 | 784 | |
emilmont | 1:fdd22bb7aa52 | 785 | return sum; |
emilmont | 1:fdd22bb7aa52 | 786 | } |
emilmont | 1:fdd22bb7aa52 | 787 | |
emilmont | 1:fdd22bb7aa52 | 788 | /* |
emilmont | 1:fdd22bb7aa52 | 789 | * @brief C custom defined SHSUB16 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 790 | */ |
mbed_official | 3:7a284390b0ce | 791 | static __INLINE q31_t __SHSUB16( |
emilmont | 1:fdd22bb7aa52 | 792 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 793 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 794 | { |
emilmont | 1:fdd22bb7aa52 | 795 | |
emilmont | 1:fdd22bb7aa52 | 796 | q31_t diff; |
emilmont | 1:fdd22bb7aa52 | 797 | q31_t r, s; |
emilmont | 1:fdd22bb7aa52 | 798 | |
emilmont | 1:fdd22bb7aa52 | 799 | r = (short) x; |
emilmont | 1:fdd22bb7aa52 | 800 | s = (short) y; |
emilmont | 1:fdd22bb7aa52 | 801 | |
emilmont | 1:fdd22bb7aa52 | 802 | r = ((r >> 1) - (s >> 1)); |
emilmont | 1:fdd22bb7aa52 | 803 | s = (((x >> 17) - (y >> 17)) << 16); |
emilmont | 1:fdd22bb7aa52 | 804 | |
emilmont | 1:fdd22bb7aa52 | 805 | diff = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emilmont | 1:fdd22bb7aa52 | 806 | |
emilmont | 1:fdd22bb7aa52 | 807 | return diff; |
emilmont | 1:fdd22bb7aa52 | 808 | } |
emilmont | 1:fdd22bb7aa52 | 809 | |
emilmont | 1:fdd22bb7aa52 | 810 | /* |
emilmont | 1:fdd22bb7aa52 | 811 | * @brief C custom defined QASX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 812 | */ |
mbed_official | 3:7a284390b0ce | 813 | static __INLINE q31_t __QASX( |
emilmont | 1:fdd22bb7aa52 | 814 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 815 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 816 | { |
emilmont | 1:fdd22bb7aa52 | 817 | |
emilmont | 1:fdd22bb7aa52 | 818 | q31_t sum = 0; |
emilmont | 1:fdd22bb7aa52 | 819 | |
emilmont | 1:fdd22bb7aa52 | 820 | sum = |
emilmont | 1:fdd22bb7aa52 | 821 | ((sum + |
emilmont | 1:fdd22bb7aa52 | 822 | clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) + |
emilmont | 1:fdd22bb7aa52 | 823 | clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16))); |
emilmont | 1:fdd22bb7aa52 | 824 | |
emilmont | 1:fdd22bb7aa52 | 825 | return sum; |
emilmont | 1:fdd22bb7aa52 | 826 | } |
emilmont | 1:fdd22bb7aa52 | 827 | |
emilmont | 1:fdd22bb7aa52 | 828 | /* |
emilmont | 1:fdd22bb7aa52 | 829 | * @brief C custom defined SHASX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 830 | */ |
mbed_official | 3:7a284390b0ce | 831 | static __INLINE q31_t __SHASX( |
emilmont | 1:fdd22bb7aa52 | 832 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 833 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 834 | { |
emilmont | 1:fdd22bb7aa52 | 835 | |
emilmont | 1:fdd22bb7aa52 | 836 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 837 | q31_t r, s; |
emilmont | 1:fdd22bb7aa52 | 838 | |
emilmont | 1:fdd22bb7aa52 | 839 | r = (short) x; |
emilmont | 1:fdd22bb7aa52 | 840 | s = (short) y; |
emilmont | 1:fdd22bb7aa52 | 841 | |
emilmont | 1:fdd22bb7aa52 | 842 | r = ((r >> 1) - (y >> 17)); |
emilmont | 1:fdd22bb7aa52 | 843 | s = (((x >> 17) + (s >> 1)) << 16); |
emilmont | 1:fdd22bb7aa52 | 844 | |
emilmont | 1:fdd22bb7aa52 | 845 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emilmont | 1:fdd22bb7aa52 | 846 | |
emilmont | 1:fdd22bb7aa52 | 847 | return sum; |
emilmont | 1:fdd22bb7aa52 | 848 | } |
emilmont | 1:fdd22bb7aa52 | 849 | |
emilmont | 1:fdd22bb7aa52 | 850 | |
emilmont | 1:fdd22bb7aa52 | 851 | /* |
emilmont | 1:fdd22bb7aa52 | 852 | * @brief C custom defined QSAX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 853 | */ |
mbed_official | 3:7a284390b0ce | 854 | static __INLINE q31_t __QSAX( |
emilmont | 1:fdd22bb7aa52 | 855 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 856 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 857 | { |
emilmont | 1:fdd22bb7aa52 | 858 | |
emilmont | 1:fdd22bb7aa52 | 859 | q31_t sum = 0; |
emilmont | 1:fdd22bb7aa52 | 860 | |
emilmont | 1:fdd22bb7aa52 | 861 | sum = |
emilmont | 1:fdd22bb7aa52 | 862 | ((sum + |
emilmont | 1:fdd22bb7aa52 | 863 | clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) + |
emilmont | 1:fdd22bb7aa52 | 864 | clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16))); |
emilmont | 1:fdd22bb7aa52 | 865 | |
emilmont | 1:fdd22bb7aa52 | 866 | return sum; |
emilmont | 1:fdd22bb7aa52 | 867 | } |
emilmont | 1:fdd22bb7aa52 | 868 | |
emilmont | 1:fdd22bb7aa52 | 869 | /* |
emilmont | 1:fdd22bb7aa52 | 870 | * @brief C custom defined SHSAX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 871 | */ |
mbed_official | 3:7a284390b0ce | 872 | static __INLINE q31_t __SHSAX( |
emilmont | 1:fdd22bb7aa52 | 873 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 874 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 875 | { |
emilmont | 1:fdd22bb7aa52 | 876 | |
emilmont | 1:fdd22bb7aa52 | 877 | q31_t sum; |
emilmont | 1:fdd22bb7aa52 | 878 | q31_t r, s; |
emilmont | 1:fdd22bb7aa52 | 879 | |
emilmont | 1:fdd22bb7aa52 | 880 | r = (short) x; |
emilmont | 1:fdd22bb7aa52 | 881 | s = (short) y; |
emilmont | 1:fdd22bb7aa52 | 882 | |
emilmont | 1:fdd22bb7aa52 | 883 | r = ((r >> 1) + (y >> 17)); |
emilmont | 1:fdd22bb7aa52 | 884 | s = (((x >> 17) - (s >> 1)) << 16); |
emilmont | 1:fdd22bb7aa52 | 885 | |
emilmont | 1:fdd22bb7aa52 | 886 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
emilmont | 1:fdd22bb7aa52 | 887 | |
emilmont | 1:fdd22bb7aa52 | 888 | return sum; |
emilmont | 1:fdd22bb7aa52 | 889 | } |
emilmont | 1:fdd22bb7aa52 | 890 | |
emilmont | 1:fdd22bb7aa52 | 891 | /* |
emilmont | 1:fdd22bb7aa52 | 892 | * @brief C custom defined SMUSDX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 893 | */ |
mbed_official | 3:7a284390b0ce | 894 | static __INLINE q31_t __SMUSDX( |
emilmont | 1:fdd22bb7aa52 | 895 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 896 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 897 | { |
emilmont | 1:fdd22bb7aa52 | 898 | |
emilmont | 1:fdd22bb7aa52 | 899 | return ((q31_t) (((short) x * (short) (y >> 16)) - |
emilmont | 1:fdd22bb7aa52 | 900 | ((short) (x >> 16) * (short) y))); |
emilmont | 1:fdd22bb7aa52 | 901 | } |
emilmont | 1:fdd22bb7aa52 | 902 | |
emilmont | 1:fdd22bb7aa52 | 903 | /* |
emilmont | 1:fdd22bb7aa52 | 904 | * @brief C custom defined SMUADX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 905 | */ |
mbed_official | 3:7a284390b0ce | 906 | static __INLINE q31_t __SMUADX( |
emilmont | 1:fdd22bb7aa52 | 907 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 908 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 909 | { |
emilmont | 1:fdd22bb7aa52 | 910 | |
emilmont | 1:fdd22bb7aa52 | 911 | return ((q31_t) (((short) x * (short) (y >> 16)) + |
emilmont | 1:fdd22bb7aa52 | 912 | ((short) (x >> 16) * (short) y))); |
emilmont | 1:fdd22bb7aa52 | 913 | } |
emilmont | 1:fdd22bb7aa52 | 914 | |
emilmont | 1:fdd22bb7aa52 | 915 | /* |
emilmont | 1:fdd22bb7aa52 | 916 | * @brief C custom defined QADD for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 917 | */ |
mbed_official | 3:7a284390b0ce | 918 | static __INLINE q31_t __QADD( |
emilmont | 1:fdd22bb7aa52 | 919 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 920 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 921 | { |
emilmont | 1:fdd22bb7aa52 | 922 | return clip_q63_to_q31((q63_t) x + y); |
emilmont | 1:fdd22bb7aa52 | 923 | } |
emilmont | 1:fdd22bb7aa52 | 924 | |
emilmont | 1:fdd22bb7aa52 | 925 | /* |
emilmont | 1:fdd22bb7aa52 | 926 | * @brief C custom defined QSUB for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 927 | */ |
mbed_official | 3:7a284390b0ce | 928 | static __INLINE q31_t __QSUB( |
emilmont | 1:fdd22bb7aa52 | 929 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 930 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 931 | { |
emilmont | 1:fdd22bb7aa52 | 932 | return clip_q63_to_q31((q63_t) x - y); |
emilmont | 1:fdd22bb7aa52 | 933 | } |
emilmont | 1:fdd22bb7aa52 | 934 | |
emilmont | 1:fdd22bb7aa52 | 935 | /* |
emilmont | 1:fdd22bb7aa52 | 936 | * @brief C custom defined SMLAD for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 937 | */ |
mbed_official | 3:7a284390b0ce | 938 | static __INLINE q31_t __SMLAD( |
emilmont | 1:fdd22bb7aa52 | 939 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 940 | q31_t y, |
emilmont | 1:fdd22bb7aa52 | 941 | q31_t sum) |
emilmont | 1:fdd22bb7aa52 | 942 | { |
emilmont | 1:fdd22bb7aa52 | 943 | |
emilmont | 1:fdd22bb7aa52 | 944 | return (sum + ((short) (x >> 16) * (short) (y >> 16)) + |
emilmont | 1:fdd22bb7aa52 | 945 | ((short) x * (short) y)); |
emilmont | 1:fdd22bb7aa52 | 946 | } |
emilmont | 1:fdd22bb7aa52 | 947 | |
emilmont | 1:fdd22bb7aa52 | 948 | /* |
emilmont | 1:fdd22bb7aa52 | 949 | * @brief C custom defined SMLADX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 950 | */ |
mbed_official | 3:7a284390b0ce | 951 | static __INLINE q31_t __SMLADX( |
emilmont | 1:fdd22bb7aa52 | 952 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 953 | q31_t y, |
emilmont | 1:fdd22bb7aa52 | 954 | q31_t sum) |
emilmont | 1:fdd22bb7aa52 | 955 | { |
emilmont | 1:fdd22bb7aa52 | 956 | |
emilmont | 1:fdd22bb7aa52 | 957 | return (sum + ((short) (x >> 16) * (short) (y)) + |
emilmont | 1:fdd22bb7aa52 | 958 | ((short) x * (short) (y >> 16))); |
emilmont | 1:fdd22bb7aa52 | 959 | } |
emilmont | 1:fdd22bb7aa52 | 960 | |
emilmont | 1:fdd22bb7aa52 | 961 | /* |
emilmont | 1:fdd22bb7aa52 | 962 | * @brief C custom defined SMLSDX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 963 | */ |
mbed_official | 3:7a284390b0ce | 964 | static __INLINE q31_t __SMLSDX( |
emilmont | 1:fdd22bb7aa52 | 965 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 966 | q31_t y, |
emilmont | 1:fdd22bb7aa52 | 967 | q31_t sum) |
emilmont | 1:fdd22bb7aa52 | 968 | { |
emilmont | 1:fdd22bb7aa52 | 969 | |
emilmont | 1:fdd22bb7aa52 | 970 | return (sum - ((short) (x >> 16) * (short) (y)) + |
emilmont | 1:fdd22bb7aa52 | 971 | ((short) x * (short) (y >> 16))); |
emilmont | 1:fdd22bb7aa52 | 972 | } |
emilmont | 1:fdd22bb7aa52 | 973 | |
emilmont | 1:fdd22bb7aa52 | 974 | /* |
emilmont | 1:fdd22bb7aa52 | 975 | * @brief C custom defined SMLALD for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 976 | */ |
mbed_official | 3:7a284390b0ce | 977 | static __INLINE q63_t __SMLALD( |
emilmont | 1:fdd22bb7aa52 | 978 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 979 | q31_t y, |
emilmont | 1:fdd22bb7aa52 | 980 | q63_t sum) |
emilmont | 1:fdd22bb7aa52 | 981 | { |
emilmont | 1:fdd22bb7aa52 | 982 | |
emilmont | 1:fdd22bb7aa52 | 983 | return (sum + ((short) (x >> 16) * (short) (y >> 16)) + |
emilmont | 1:fdd22bb7aa52 | 984 | ((short) x * (short) y)); |
emilmont | 1:fdd22bb7aa52 | 985 | } |
emilmont | 1:fdd22bb7aa52 | 986 | |
emilmont | 1:fdd22bb7aa52 | 987 | /* |
emilmont | 1:fdd22bb7aa52 | 988 | * @brief C custom defined SMLALDX for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 989 | */ |
mbed_official | 3:7a284390b0ce | 990 | static __INLINE q63_t __SMLALDX( |
emilmont | 1:fdd22bb7aa52 | 991 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 992 | q31_t y, |
emilmont | 1:fdd22bb7aa52 | 993 | q63_t sum) |
emilmont | 1:fdd22bb7aa52 | 994 | { |
emilmont | 1:fdd22bb7aa52 | 995 | |
emilmont | 1:fdd22bb7aa52 | 996 | return (sum + ((short) (x >> 16) * (short) y)) + |
emilmont | 1:fdd22bb7aa52 | 997 | ((short) x * (short) (y >> 16)); |
emilmont | 1:fdd22bb7aa52 | 998 | } |
emilmont | 1:fdd22bb7aa52 | 999 | |
emilmont | 1:fdd22bb7aa52 | 1000 | /* |
emilmont | 1:fdd22bb7aa52 | 1001 | * @brief C custom defined SMUAD for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 1002 | */ |
mbed_official | 3:7a284390b0ce | 1003 | static __INLINE q31_t __SMUAD( |
emilmont | 1:fdd22bb7aa52 | 1004 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 1005 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 1006 | { |
emilmont | 1:fdd22bb7aa52 | 1007 | |
emilmont | 1:fdd22bb7aa52 | 1008 | return (((x >> 16) * (y >> 16)) + |
emilmont | 1:fdd22bb7aa52 | 1009 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
emilmont | 1:fdd22bb7aa52 | 1010 | } |
emilmont | 1:fdd22bb7aa52 | 1011 | |
emilmont | 1:fdd22bb7aa52 | 1012 | /* |
emilmont | 1:fdd22bb7aa52 | 1013 | * @brief C custom defined SMUSD for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 1014 | */ |
mbed_official | 3:7a284390b0ce | 1015 | static __INLINE q31_t __SMUSD( |
emilmont | 1:fdd22bb7aa52 | 1016 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 1017 | q31_t y) |
emilmont | 1:fdd22bb7aa52 | 1018 | { |
emilmont | 1:fdd22bb7aa52 | 1019 | |
emilmont | 1:fdd22bb7aa52 | 1020 | return (-((x >> 16) * (y >> 16)) + |
emilmont | 1:fdd22bb7aa52 | 1021 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
emilmont | 1:fdd22bb7aa52 | 1022 | } |
emilmont | 1:fdd22bb7aa52 | 1023 | |
emilmont | 1:fdd22bb7aa52 | 1024 | |
emilmont | 1:fdd22bb7aa52 | 1025 | /* |
emilmont | 1:fdd22bb7aa52 | 1026 | * @brief C custom defined SXTB16 for M3 and M0 processors |
emilmont | 1:fdd22bb7aa52 | 1027 | */ |
mbed_official | 3:7a284390b0ce | 1028 | static __INLINE q31_t __SXTB16( |
emilmont | 1:fdd22bb7aa52 | 1029 | q31_t x) |
emilmont | 1:fdd22bb7aa52 | 1030 | { |
emilmont | 1:fdd22bb7aa52 | 1031 | |
emilmont | 1:fdd22bb7aa52 | 1032 | return ((((x << 24) >> 24) & 0x0000FFFF) | |
emilmont | 1:fdd22bb7aa52 | 1033 | (((x << 8) >> 8) & 0xFFFF0000)); |
emilmont | 1:fdd22bb7aa52 | 1034 | } |
emilmont | 1:fdd22bb7aa52 | 1035 | |
emilmont | 1:fdd22bb7aa52 | 1036 | |
mbed_official | 3:7a284390b0ce | 1037 | #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ |
emilmont | 1:fdd22bb7aa52 | 1038 | |
emilmont | 1:fdd22bb7aa52 | 1039 | |
emilmont | 1:fdd22bb7aa52 | 1040 | /** |
emilmont | 1:fdd22bb7aa52 | 1041 | * @brief Instance structure for the Q7 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1042 | */ |
emilmont | 1:fdd22bb7aa52 | 1043 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1044 | { |
emilmont | 1:fdd22bb7aa52 | 1045 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 1046 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 1047 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 1048 | } arm_fir_instance_q7; |
emilmont | 1:fdd22bb7aa52 | 1049 | |
emilmont | 1:fdd22bb7aa52 | 1050 | /** |
emilmont | 1:fdd22bb7aa52 | 1051 | * @brief Instance structure for the Q15 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1052 | */ |
emilmont | 1:fdd22bb7aa52 | 1053 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1054 | { |
emilmont | 1:fdd22bb7aa52 | 1055 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 1056 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 1057 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 1058 | } arm_fir_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 1059 | |
emilmont | 1:fdd22bb7aa52 | 1060 | /** |
emilmont | 1:fdd22bb7aa52 | 1061 | * @brief Instance structure for the Q31 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1062 | */ |
emilmont | 1:fdd22bb7aa52 | 1063 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1064 | { |
emilmont | 1:fdd22bb7aa52 | 1065 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 1066 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 1067 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 1068 | } arm_fir_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 1069 | |
emilmont | 1:fdd22bb7aa52 | 1070 | /** |
emilmont | 1:fdd22bb7aa52 | 1071 | * @brief Instance structure for the floating-point FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1072 | */ |
emilmont | 1:fdd22bb7aa52 | 1073 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1074 | { |
emilmont | 1:fdd22bb7aa52 | 1075 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 1076 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 1077 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 1078 | } arm_fir_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 1079 | |
emilmont | 1:fdd22bb7aa52 | 1080 | |
emilmont | 1:fdd22bb7aa52 | 1081 | /** |
emilmont | 1:fdd22bb7aa52 | 1082 | * @brief Processing function for the Q7 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1083 | * @param[in] *S points to an instance of the Q7 FIR filter structure. |
emilmont | 1:fdd22bb7aa52 | 1084 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1085 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1086 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1087 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1088 | */ |
emilmont | 1:fdd22bb7aa52 | 1089 | void arm_fir_q7( |
emilmont | 1:fdd22bb7aa52 | 1090 | const arm_fir_instance_q7 * S, |
emilmont | 1:fdd22bb7aa52 | 1091 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1092 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1093 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1094 | |
emilmont | 1:fdd22bb7aa52 | 1095 | |
emilmont | 1:fdd22bb7aa52 | 1096 | /** |
emilmont | 1:fdd22bb7aa52 | 1097 | * @brief Initialization function for the Q7 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1098 | * @param[in,out] *S points to an instance of the Q7 FIR structure. |
emilmont | 1:fdd22bb7aa52 | 1099 | * @param[in] numTaps Number of filter coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 1100 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 1101 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 1102 | * @param[in] blockSize number of samples that are processed. |
emilmont | 1:fdd22bb7aa52 | 1103 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1104 | */ |
emilmont | 1:fdd22bb7aa52 | 1105 | void arm_fir_init_q7( |
emilmont | 1:fdd22bb7aa52 | 1106 | arm_fir_instance_q7 * S, |
emilmont | 1:fdd22bb7aa52 | 1107 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 1108 | q7_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1109 | q7_t * pState, |
emilmont | 1:fdd22bb7aa52 | 1110 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1111 | |
emilmont | 1:fdd22bb7aa52 | 1112 | |
emilmont | 1:fdd22bb7aa52 | 1113 | /** |
emilmont | 1:fdd22bb7aa52 | 1114 | * @brief Processing function for the Q15 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1115 | * @param[in] *S points to an instance of the Q15 FIR structure. |
emilmont | 1:fdd22bb7aa52 | 1116 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1117 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1118 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1119 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1120 | */ |
emilmont | 1:fdd22bb7aa52 | 1121 | void arm_fir_q15( |
emilmont | 1:fdd22bb7aa52 | 1122 | const arm_fir_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1123 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1124 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1125 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1126 | |
emilmont | 1:fdd22bb7aa52 | 1127 | /** |
emilmont | 1:fdd22bb7aa52 | 1128 | * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 1129 | * @param[in] *S points to an instance of the Q15 FIR filter structure. |
emilmont | 1:fdd22bb7aa52 | 1130 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1131 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1132 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1133 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1134 | */ |
emilmont | 1:fdd22bb7aa52 | 1135 | void arm_fir_fast_q15( |
emilmont | 1:fdd22bb7aa52 | 1136 | const arm_fir_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1137 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1138 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1139 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1140 | |
emilmont | 1:fdd22bb7aa52 | 1141 | /** |
emilmont | 1:fdd22bb7aa52 | 1142 | * @brief Initialization function for the Q15 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1143 | * @param[in,out] *S points to an instance of the Q15 FIR filter structure. |
emilmont | 1:fdd22bb7aa52 | 1144 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. |
emilmont | 1:fdd22bb7aa52 | 1145 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 1146 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 1147 | * @param[in] blockSize number of samples that are processed at a time. |
emilmont | 1:fdd22bb7aa52 | 1148 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if |
emilmont | 1:fdd22bb7aa52 | 1149 | * <code>numTaps</code> is not a supported value. |
emilmont | 1:fdd22bb7aa52 | 1150 | */ |
emilmont | 1:fdd22bb7aa52 | 1151 | |
emilmont | 1:fdd22bb7aa52 | 1152 | arm_status arm_fir_init_q15( |
emilmont | 1:fdd22bb7aa52 | 1153 | arm_fir_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1154 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 1155 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1156 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 1157 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1158 | |
emilmont | 1:fdd22bb7aa52 | 1159 | /** |
emilmont | 1:fdd22bb7aa52 | 1160 | * @brief Processing function for the Q31 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1161 | * @param[in] *S points to an instance of the Q31 FIR filter structure. |
emilmont | 1:fdd22bb7aa52 | 1162 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1163 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1164 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1165 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1166 | */ |
emilmont | 1:fdd22bb7aa52 | 1167 | void arm_fir_q31( |
emilmont | 1:fdd22bb7aa52 | 1168 | const arm_fir_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1169 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1170 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1171 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1172 | |
emilmont | 1:fdd22bb7aa52 | 1173 | /** |
emilmont | 1:fdd22bb7aa52 | 1174 | * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 1175 | * @param[in] *S points to an instance of the Q31 FIR structure. |
emilmont | 1:fdd22bb7aa52 | 1176 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1177 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1178 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1179 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1180 | */ |
emilmont | 1:fdd22bb7aa52 | 1181 | void arm_fir_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 1182 | const arm_fir_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1183 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1184 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1185 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1186 | |
emilmont | 1:fdd22bb7aa52 | 1187 | /** |
emilmont | 1:fdd22bb7aa52 | 1188 | * @brief Initialization function for the Q31 FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1189 | * @param[in,out] *S points to an instance of the Q31 FIR structure. |
emilmont | 2:da51fb522205 | 1190 | * @param[in] numTaps Number of filter coefficients in the filter. |
emilmont | 2:da51fb522205 | 1191 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 2:da51fb522205 | 1192 | * @param[in] *pState points to the state buffer. |
emilmont | 2:da51fb522205 | 1193 | * @param[in] blockSize number of samples that are processed at a time. |
emilmont | 2:da51fb522205 | 1194 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1195 | */ |
emilmont | 1:fdd22bb7aa52 | 1196 | void arm_fir_init_q31( |
emilmont | 1:fdd22bb7aa52 | 1197 | arm_fir_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1198 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 1199 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1200 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 1201 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1202 | |
emilmont | 1:fdd22bb7aa52 | 1203 | /** |
emilmont | 1:fdd22bb7aa52 | 1204 | * @brief Processing function for the floating-point FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1205 | * @param[in] *S points to an instance of the floating-point FIR structure. |
emilmont | 1:fdd22bb7aa52 | 1206 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1207 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1208 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1209 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1210 | */ |
emilmont | 1:fdd22bb7aa52 | 1211 | void arm_fir_f32( |
emilmont | 1:fdd22bb7aa52 | 1212 | const arm_fir_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 1213 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1214 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1215 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1216 | |
emilmont | 1:fdd22bb7aa52 | 1217 | /** |
emilmont | 1:fdd22bb7aa52 | 1218 | * @brief Initialization function for the floating-point FIR filter. |
emilmont | 1:fdd22bb7aa52 | 1219 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. |
emilmont | 2:da51fb522205 | 1220 | * @param[in] numTaps Number of filter coefficients in the filter. |
emilmont | 2:da51fb522205 | 1221 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 2:da51fb522205 | 1222 | * @param[in] *pState points to the state buffer. |
emilmont | 2:da51fb522205 | 1223 | * @param[in] blockSize number of samples that are processed at a time. |
emilmont | 2:da51fb522205 | 1224 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1225 | */ |
emilmont | 1:fdd22bb7aa52 | 1226 | void arm_fir_init_f32( |
emilmont | 1:fdd22bb7aa52 | 1227 | arm_fir_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 1228 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 1229 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1230 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 1231 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1232 | |
emilmont | 1:fdd22bb7aa52 | 1233 | |
emilmont | 1:fdd22bb7aa52 | 1234 | /** |
emilmont | 1:fdd22bb7aa52 | 1235 | * @brief Instance structure for the Q15 Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1236 | */ |
emilmont | 1:fdd22bb7aa52 | 1237 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1238 | { |
emilmont | 1:fdd22bb7aa52 | 1239 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1240 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1241 | q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1242 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
emilmont | 1:fdd22bb7aa52 | 1243 | |
emilmont | 1:fdd22bb7aa52 | 1244 | } arm_biquad_casd_df1_inst_q15; |
emilmont | 1:fdd22bb7aa52 | 1245 | |
emilmont | 1:fdd22bb7aa52 | 1246 | |
emilmont | 1:fdd22bb7aa52 | 1247 | /** |
emilmont | 1:fdd22bb7aa52 | 1248 | * @brief Instance structure for the Q31 Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1249 | */ |
emilmont | 1:fdd22bb7aa52 | 1250 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1251 | { |
emilmont | 1:fdd22bb7aa52 | 1252 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1253 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1254 | q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1255 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
emilmont | 1:fdd22bb7aa52 | 1256 | |
emilmont | 1:fdd22bb7aa52 | 1257 | } arm_biquad_casd_df1_inst_q31; |
emilmont | 1:fdd22bb7aa52 | 1258 | |
emilmont | 1:fdd22bb7aa52 | 1259 | /** |
emilmont | 1:fdd22bb7aa52 | 1260 | * @brief Instance structure for the floating-point Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1261 | */ |
emilmont | 1:fdd22bb7aa52 | 1262 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1263 | { |
emilmont | 1:fdd22bb7aa52 | 1264 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1265 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1266 | float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 1267 | |
emilmont | 1:fdd22bb7aa52 | 1268 | |
emilmont | 1:fdd22bb7aa52 | 1269 | } arm_biquad_casd_df1_inst_f32; |
emilmont | 1:fdd22bb7aa52 | 1270 | |
emilmont | 1:fdd22bb7aa52 | 1271 | |
emilmont | 1:fdd22bb7aa52 | 1272 | |
emilmont | 1:fdd22bb7aa52 | 1273 | /** |
emilmont | 1:fdd22bb7aa52 | 1274 | * @brief Processing function for the Q15 Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1275 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1276 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1277 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1278 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1279 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1280 | */ |
emilmont | 1:fdd22bb7aa52 | 1281 | |
emilmont | 1:fdd22bb7aa52 | 1282 | void arm_biquad_cascade_df1_q15( |
emilmont | 1:fdd22bb7aa52 | 1283 | const arm_biquad_casd_df1_inst_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1284 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1285 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1286 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1287 | |
emilmont | 1:fdd22bb7aa52 | 1288 | /** |
emilmont | 1:fdd22bb7aa52 | 1289 | * @brief Initialization function for the Q15 Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1290 | * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1291 | * @param[in] numStages number of 2nd order stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 1292 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 1293 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 1294 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
emilmont | 1:fdd22bb7aa52 | 1295 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1296 | */ |
emilmont | 1:fdd22bb7aa52 | 1297 | |
emilmont | 1:fdd22bb7aa52 | 1298 | void arm_biquad_cascade_df1_init_q15( |
emilmont | 1:fdd22bb7aa52 | 1299 | arm_biquad_casd_df1_inst_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1300 | uint8_t numStages, |
emilmont | 1:fdd22bb7aa52 | 1301 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1302 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 1303 | int8_t postShift); |
emilmont | 1:fdd22bb7aa52 | 1304 | |
emilmont | 1:fdd22bb7aa52 | 1305 | |
emilmont | 1:fdd22bb7aa52 | 1306 | /** |
emilmont | 1:fdd22bb7aa52 | 1307 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 1308 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1309 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1310 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1311 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1312 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1313 | */ |
emilmont | 1:fdd22bb7aa52 | 1314 | |
emilmont | 1:fdd22bb7aa52 | 1315 | void arm_biquad_cascade_df1_fast_q15( |
emilmont | 1:fdd22bb7aa52 | 1316 | const arm_biquad_casd_df1_inst_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1317 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1318 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1319 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1320 | |
emilmont | 1:fdd22bb7aa52 | 1321 | |
emilmont | 1:fdd22bb7aa52 | 1322 | /** |
emilmont | 1:fdd22bb7aa52 | 1323 | * @brief Processing function for the Q31 Biquad cascade filter |
emilmont | 1:fdd22bb7aa52 | 1324 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1325 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1326 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1327 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1328 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1329 | */ |
emilmont | 1:fdd22bb7aa52 | 1330 | |
emilmont | 1:fdd22bb7aa52 | 1331 | void arm_biquad_cascade_df1_q31( |
emilmont | 1:fdd22bb7aa52 | 1332 | const arm_biquad_casd_df1_inst_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1333 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1334 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1335 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1336 | |
emilmont | 1:fdd22bb7aa52 | 1337 | /** |
emilmont | 1:fdd22bb7aa52 | 1338 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 1339 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1340 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1341 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1342 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1343 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1344 | */ |
emilmont | 1:fdd22bb7aa52 | 1345 | |
emilmont | 1:fdd22bb7aa52 | 1346 | void arm_biquad_cascade_df1_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 1347 | const arm_biquad_casd_df1_inst_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1348 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1349 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1350 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1351 | |
emilmont | 1:fdd22bb7aa52 | 1352 | /** |
emilmont | 1:fdd22bb7aa52 | 1353 | * @brief Initialization function for the Q31 Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1354 | * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1355 | * @param[in] numStages number of 2nd order stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 1356 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 1357 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 1358 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
emilmont | 1:fdd22bb7aa52 | 1359 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1360 | */ |
emilmont | 1:fdd22bb7aa52 | 1361 | |
emilmont | 1:fdd22bb7aa52 | 1362 | void arm_biquad_cascade_df1_init_q31( |
emilmont | 1:fdd22bb7aa52 | 1363 | arm_biquad_casd_df1_inst_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1364 | uint8_t numStages, |
emilmont | 1:fdd22bb7aa52 | 1365 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1366 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 1367 | int8_t postShift); |
emilmont | 1:fdd22bb7aa52 | 1368 | |
emilmont | 1:fdd22bb7aa52 | 1369 | /** |
emilmont | 1:fdd22bb7aa52 | 1370 | * @brief Processing function for the floating-point Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1371 | * @param[in] *S points to an instance of the floating-point Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1372 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 1373 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 1374 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 1375 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1376 | */ |
emilmont | 1:fdd22bb7aa52 | 1377 | |
emilmont | 1:fdd22bb7aa52 | 1378 | void arm_biquad_cascade_df1_f32( |
emilmont | 1:fdd22bb7aa52 | 1379 | const arm_biquad_casd_df1_inst_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 1380 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1381 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1382 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1383 | |
emilmont | 1:fdd22bb7aa52 | 1384 | /** |
emilmont | 1:fdd22bb7aa52 | 1385 | * @brief Initialization function for the floating-point Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 1386 | * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. |
emilmont | 1:fdd22bb7aa52 | 1387 | * @param[in] numStages number of 2nd order stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 1388 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 1389 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 1390 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1391 | */ |
emilmont | 1:fdd22bb7aa52 | 1392 | |
emilmont | 1:fdd22bb7aa52 | 1393 | void arm_biquad_cascade_df1_init_f32( |
emilmont | 1:fdd22bb7aa52 | 1394 | arm_biquad_casd_df1_inst_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 1395 | uint8_t numStages, |
emilmont | 1:fdd22bb7aa52 | 1396 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 1397 | float32_t * pState); |
emilmont | 1:fdd22bb7aa52 | 1398 | |
emilmont | 1:fdd22bb7aa52 | 1399 | |
emilmont | 1:fdd22bb7aa52 | 1400 | /** |
emilmont | 1:fdd22bb7aa52 | 1401 | * @brief Instance structure for the floating-point matrix structure. |
emilmont | 1:fdd22bb7aa52 | 1402 | */ |
emilmont | 1:fdd22bb7aa52 | 1403 | |
emilmont | 1:fdd22bb7aa52 | 1404 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1405 | { |
emilmont | 1:fdd22bb7aa52 | 1406 | uint16_t numRows; /**< number of rows of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1407 | uint16_t numCols; /**< number of columns of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1408 | float32_t *pData; /**< points to the data of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1409 | } arm_matrix_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 1410 | |
emilmont | 1:fdd22bb7aa52 | 1411 | /** |
emilmont | 1:fdd22bb7aa52 | 1412 | * @brief Instance structure for the Q15 matrix structure. |
emilmont | 1:fdd22bb7aa52 | 1413 | */ |
emilmont | 1:fdd22bb7aa52 | 1414 | |
emilmont | 1:fdd22bb7aa52 | 1415 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1416 | { |
emilmont | 1:fdd22bb7aa52 | 1417 | uint16_t numRows; /**< number of rows of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1418 | uint16_t numCols; /**< number of columns of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1419 | q15_t *pData; /**< points to the data of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1420 | |
emilmont | 1:fdd22bb7aa52 | 1421 | } arm_matrix_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 1422 | |
emilmont | 1:fdd22bb7aa52 | 1423 | /** |
emilmont | 1:fdd22bb7aa52 | 1424 | * @brief Instance structure for the Q31 matrix structure. |
emilmont | 1:fdd22bb7aa52 | 1425 | */ |
emilmont | 1:fdd22bb7aa52 | 1426 | |
emilmont | 1:fdd22bb7aa52 | 1427 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1428 | { |
emilmont | 1:fdd22bb7aa52 | 1429 | uint16_t numRows; /**< number of rows of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1430 | uint16_t numCols; /**< number of columns of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1431 | q31_t *pData; /**< points to the data of the matrix. */ |
emilmont | 1:fdd22bb7aa52 | 1432 | |
emilmont | 1:fdd22bb7aa52 | 1433 | } arm_matrix_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 1434 | |
emilmont | 1:fdd22bb7aa52 | 1435 | |
emilmont | 1:fdd22bb7aa52 | 1436 | |
emilmont | 1:fdd22bb7aa52 | 1437 | /** |
emilmont | 1:fdd22bb7aa52 | 1438 | * @brief Floating-point matrix addition. |
emilmont | 1:fdd22bb7aa52 | 1439 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1440 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1441 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1442 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1443 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1444 | */ |
emilmont | 1:fdd22bb7aa52 | 1445 | |
emilmont | 1:fdd22bb7aa52 | 1446 | arm_status arm_mat_add_f32( |
emilmont | 1:fdd22bb7aa52 | 1447 | const arm_matrix_instance_f32 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1448 | const arm_matrix_instance_f32 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1449 | arm_matrix_instance_f32 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1450 | |
emilmont | 1:fdd22bb7aa52 | 1451 | /** |
emilmont | 1:fdd22bb7aa52 | 1452 | * @brief Q15 matrix addition. |
emilmont | 1:fdd22bb7aa52 | 1453 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1454 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1455 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1456 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1457 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1458 | */ |
emilmont | 1:fdd22bb7aa52 | 1459 | |
emilmont | 1:fdd22bb7aa52 | 1460 | arm_status arm_mat_add_q15( |
emilmont | 1:fdd22bb7aa52 | 1461 | const arm_matrix_instance_q15 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1462 | const arm_matrix_instance_q15 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1463 | arm_matrix_instance_q15 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1464 | |
emilmont | 1:fdd22bb7aa52 | 1465 | /** |
emilmont | 1:fdd22bb7aa52 | 1466 | * @brief Q31 matrix addition. |
emilmont | 1:fdd22bb7aa52 | 1467 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1468 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1469 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1470 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1471 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1472 | */ |
emilmont | 1:fdd22bb7aa52 | 1473 | |
emilmont | 1:fdd22bb7aa52 | 1474 | arm_status arm_mat_add_q31( |
emilmont | 1:fdd22bb7aa52 | 1475 | const arm_matrix_instance_q31 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1476 | const arm_matrix_instance_q31 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1477 | arm_matrix_instance_q31 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1478 | |
emilmont | 1:fdd22bb7aa52 | 1479 | |
emilmont | 1:fdd22bb7aa52 | 1480 | /** |
emilmont | 1:fdd22bb7aa52 | 1481 | * @brief Floating-point matrix transpose. |
emilmont | 1:fdd22bb7aa52 | 1482 | * @param[in] *pSrc points to the input matrix |
emilmont | 1:fdd22bb7aa52 | 1483 | * @param[out] *pDst points to the output matrix |
emilmont | 2:da51fb522205 | 1484 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
emilmont | 1:fdd22bb7aa52 | 1485 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1486 | */ |
emilmont | 1:fdd22bb7aa52 | 1487 | |
emilmont | 1:fdd22bb7aa52 | 1488 | arm_status arm_mat_trans_f32( |
emilmont | 1:fdd22bb7aa52 | 1489 | const arm_matrix_instance_f32 * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1490 | arm_matrix_instance_f32 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1491 | |
emilmont | 1:fdd22bb7aa52 | 1492 | |
emilmont | 1:fdd22bb7aa52 | 1493 | /** |
emilmont | 1:fdd22bb7aa52 | 1494 | * @brief Q15 matrix transpose. |
emilmont | 1:fdd22bb7aa52 | 1495 | * @param[in] *pSrc points to the input matrix |
emilmont | 1:fdd22bb7aa52 | 1496 | * @param[out] *pDst points to the output matrix |
emilmont | 2:da51fb522205 | 1497 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
emilmont | 1:fdd22bb7aa52 | 1498 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1499 | */ |
emilmont | 1:fdd22bb7aa52 | 1500 | |
emilmont | 1:fdd22bb7aa52 | 1501 | arm_status arm_mat_trans_q15( |
emilmont | 1:fdd22bb7aa52 | 1502 | const arm_matrix_instance_q15 * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1503 | arm_matrix_instance_q15 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1504 | |
emilmont | 1:fdd22bb7aa52 | 1505 | /** |
emilmont | 1:fdd22bb7aa52 | 1506 | * @brief Q31 matrix transpose. |
emilmont | 1:fdd22bb7aa52 | 1507 | * @param[in] *pSrc points to the input matrix |
emilmont | 1:fdd22bb7aa52 | 1508 | * @param[out] *pDst points to the output matrix |
emilmont | 2:da51fb522205 | 1509 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
emilmont | 1:fdd22bb7aa52 | 1510 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1511 | */ |
emilmont | 1:fdd22bb7aa52 | 1512 | |
emilmont | 1:fdd22bb7aa52 | 1513 | arm_status arm_mat_trans_q31( |
emilmont | 1:fdd22bb7aa52 | 1514 | const arm_matrix_instance_q31 * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1515 | arm_matrix_instance_q31 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1516 | |
emilmont | 1:fdd22bb7aa52 | 1517 | |
emilmont | 1:fdd22bb7aa52 | 1518 | /** |
emilmont | 1:fdd22bb7aa52 | 1519 | * @brief Floating-point matrix multiplication |
emilmont | 1:fdd22bb7aa52 | 1520 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1521 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1522 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1523 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1524 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1525 | */ |
emilmont | 1:fdd22bb7aa52 | 1526 | |
emilmont | 1:fdd22bb7aa52 | 1527 | arm_status arm_mat_mult_f32( |
emilmont | 1:fdd22bb7aa52 | 1528 | const arm_matrix_instance_f32 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1529 | const arm_matrix_instance_f32 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1530 | arm_matrix_instance_f32 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1531 | |
emilmont | 1:fdd22bb7aa52 | 1532 | /** |
emilmont | 1:fdd22bb7aa52 | 1533 | * @brief Q15 matrix multiplication |
emilmont | 1:fdd22bb7aa52 | 1534 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1535 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1536 | * @param[out] *pDst points to output matrix structure |
mbed_official | 3:7a284390b0ce | 1537 | * @param[in] *pState points to the array for storing intermediate results |
emilmont | 1:fdd22bb7aa52 | 1538 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1539 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1540 | */ |
emilmont | 1:fdd22bb7aa52 | 1541 | |
emilmont | 1:fdd22bb7aa52 | 1542 | arm_status arm_mat_mult_q15( |
emilmont | 1:fdd22bb7aa52 | 1543 | const arm_matrix_instance_q15 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1544 | const arm_matrix_instance_q15 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1545 | arm_matrix_instance_q15 * pDst, |
emilmont | 1:fdd22bb7aa52 | 1546 | q15_t * pState); |
emilmont | 1:fdd22bb7aa52 | 1547 | |
emilmont | 1:fdd22bb7aa52 | 1548 | /** |
emilmont | 1:fdd22bb7aa52 | 1549 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 1550 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1551 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1552 | * @param[out] *pDst points to output matrix structure |
mbed_official | 3:7a284390b0ce | 1553 | * @param[in] *pState points to the array for storing intermediate results |
emilmont | 1:fdd22bb7aa52 | 1554 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1555 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1556 | */ |
emilmont | 1:fdd22bb7aa52 | 1557 | |
emilmont | 1:fdd22bb7aa52 | 1558 | arm_status arm_mat_mult_fast_q15( |
emilmont | 1:fdd22bb7aa52 | 1559 | const arm_matrix_instance_q15 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1560 | const arm_matrix_instance_q15 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1561 | arm_matrix_instance_q15 * pDst, |
emilmont | 1:fdd22bb7aa52 | 1562 | q15_t * pState); |
emilmont | 1:fdd22bb7aa52 | 1563 | |
emilmont | 1:fdd22bb7aa52 | 1564 | /** |
emilmont | 1:fdd22bb7aa52 | 1565 | * @brief Q31 matrix multiplication |
emilmont | 1:fdd22bb7aa52 | 1566 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1567 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1568 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1569 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1570 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1571 | */ |
emilmont | 1:fdd22bb7aa52 | 1572 | |
emilmont | 1:fdd22bb7aa52 | 1573 | arm_status arm_mat_mult_q31( |
emilmont | 1:fdd22bb7aa52 | 1574 | const arm_matrix_instance_q31 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1575 | const arm_matrix_instance_q31 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1576 | arm_matrix_instance_q31 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1577 | |
emilmont | 1:fdd22bb7aa52 | 1578 | /** |
emilmont | 1:fdd22bb7aa52 | 1579 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 1580 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1581 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1582 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1583 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1584 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1585 | */ |
emilmont | 1:fdd22bb7aa52 | 1586 | |
emilmont | 1:fdd22bb7aa52 | 1587 | arm_status arm_mat_mult_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 1588 | const arm_matrix_instance_q31 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1589 | const arm_matrix_instance_q31 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1590 | arm_matrix_instance_q31 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1591 | |
emilmont | 1:fdd22bb7aa52 | 1592 | |
emilmont | 1:fdd22bb7aa52 | 1593 | /** |
emilmont | 1:fdd22bb7aa52 | 1594 | * @brief Floating-point matrix subtraction |
emilmont | 1:fdd22bb7aa52 | 1595 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1596 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1597 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1598 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1599 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1600 | */ |
emilmont | 1:fdd22bb7aa52 | 1601 | |
emilmont | 1:fdd22bb7aa52 | 1602 | arm_status arm_mat_sub_f32( |
emilmont | 1:fdd22bb7aa52 | 1603 | const arm_matrix_instance_f32 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1604 | const arm_matrix_instance_f32 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1605 | arm_matrix_instance_f32 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1606 | |
emilmont | 1:fdd22bb7aa52 | 1607 | /** |
emilmont | 1:fdd22bb7aa52 | 1608 | * @brief Q15 matrix subtraction |
emilmont | 1:fdd22bb7aa52 | 1609 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1610 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1611 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1612 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1613 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1614 | */ |
emilmont | 1:fdd22bb7aa52 | 1615 | |
emilmont | 1:fdd22bb7aa52 | 1616 | arm_status arm_mat_sub_q15( |
emilmont | 1:fdd22bb7aa52 | 1617 | const arm_matrix_instance_q15 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1618 | const arm_matrix_instance_q15 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1619 | arm_matrix_instance_q15 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1620 | |
emilmont | 1:fdd22bb7aa52 | 1621 | /** |
emilmont | 1:fdd22bb7aa52 | 1622 | * @brief Q31 matrix subtraction |
emilmont | 1:fdd22bb7aa52 | 1623 | * @param[in] *pSrcA points to the first input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1624 | * @param[in] *pSrcB points to the second input matrix structure |
emilmont | 1:fdd22bb7aa52 | 1625 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1626 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1627 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1628 | */ |
emilmont | 1:fdd22bb7aa52 | 1629 | |
emilmont | 1:fdd22bb7aa52 | 1630 | arm_status arm_mat_sub_q31( |
emilmont | 1:fdd22bb7aa52 | 1631 | const arm_matrix_instance_q31 * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1632 | const arm_matrix_instance_q31 * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1633 | arm_matrix_instance_q31 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1634 | |
emilmont | 1:fdd22bb7aa52 | 1635 | /** |
emilmont | 1:fdd22bb7aa52 | 1636 | * @brief Floating-point matrix scaling. |
emilmont | 1:fdd22bb7aa52 | 1637 | * @param[in] *pSrc points to the input matrix |
emilmont | 1:fdd22bb7aa52 | 1638 | * @param[in] scale scale factor |
emilmont | 1:fdd22bb7aa52 | 1639 | * @param[out] *pDst points to the output matrix |
emilmont | 1:fdd22bb7aa52 | 1640 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1641 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1642 | */ |
emilmont | 1:fdd22bb7aa52 | 1643 | |
emilmont | 1:fdd22bb7aa52 | 1644 | arm_status arm_mat_scale_f32( |
emilmont | 1:fdd22bb7aa52 | 1645 | const arm_matrix_instance_f32 * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1646 | float32_t scale, |
emilmont | 1:fdd22bb7aa52 | 1647 | arm_matrix_instance_f32 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1648 | |
emilmont | 1:fdd22bb7aa52 | 1649 | /** |
emilmont | 1:fdd22bb7aa52 | 1650 | * @brief Q15 matrix scaling. |
emilmont | 1:fdd22bb7aa52 | 1651 | * @param[in] *pSrc points to input matrix |
emilmont | 1:fdd22bb7aa52 | 1652 | * @param[in] scaleFract fractional portion of the scale factor |
emilmont | 1:fdd22bb7aa52 | 1653 | * @param[in] shift number of bits to shift the result by |
emilmont | 1:fdd22bb7aa52 | 1654 | * @param[out] *pDst points to output matrix |
emilmont | 1:fdd22bb7aa52 | 1655 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1656 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1657 | */ |
emilmont | 1:fdd22bb7aa52 | 1658 | |
emilmont | 1:fdd22bb7aa52 | 1659 | arm_status arm_mat_scale_q15( |
emilmont | 1:fdd22bb7aa52 | 1660 | const arm_matrix_instance_q15 * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1661 | q15_t scaleFract, |
emilmont | 1:fdd22bb7aa52 | 1662 | int32_t shift, |
emilmont | 1:fdd22bb7aa52 | 1663 | arm_matrix_instance_q15 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1664 | |
emilmont | 1:fdd22bb7aa52 | 1665 | /** |
emilmont | 1:fdd22bb7aa52 | 1666 | * @brief Q31 matrix scaling. |
emilmont | 1:fdd22bb7aa52 | 1667 | * @param[in] *pSrc points to input matrix |
emilmont | 1:fdd22bb7aa52 | 1668 | * @param[in] scaleFract fractional portion of the scale factor |
emilmont | 1:fdd22bb7aa52 | 1669 | * @param[in] shift number of bits to shift the result by |
emilmont | 1:fdd22bb7aa52 | 1670 | * @param[out] *pDst points to output matrix structure |
emilmont | 1:fdd22bb7aa52 | 1671 | * @return The function returns either |
emilmont | 1:fdd22bb7aa52 | 1672 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
emilmont | 1:fdd22bb7aa52 | 1673 | */ |
emilmont | 1:fdd22bb7aa52 | 1674 | |
emilmont | 1:fdd22bb7aa52 | 1675 | arm_status arm_mat_scale_q31( |
emilmont | 1:fdd22bb7aa52 | 1676 | const arm_matrix_instance_q31 * pSrc, |
emilmont | 1:fdd22bb7aa52 | 1677 | q31_t scaleFract, |
emilmont | 1:fdd22bb7aa52 | 1678 | int32_t shift, |
emilmont | 1:fdd22bb7aa52 | 1679 | arm_matrix_instance_q31 * pDst); |
emilmont | 1:fdd22bb7aa52 | 1680 | |
emilmont | 1:fdd22bb7aa52 | 1681 | |
emilmont | 1:fdd22bb7aa52 | 1682 | /** |
emilmont | 1:fdd22bb7aa52 | 1683 | * @brief Q31 matrix initialization. |
emilmont | 1:fdd22bb7aa52 | 1684 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
emilmont | 1:fdd22bb7aa52 | 1685 | * @param[in] nRows number of rows in the matrix. |
emilmont | 1:fdd22bb7aa52 | 1686 | * @param[in] nColumns number of columns in the matrix. |
emilmont | 2:da51fb522205 | 1687 | * @param[in] *pData points to the matrix data array. |
emilmont | 1:fdd22bb7aa52 | 1688 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1689 | */ |
emilmont | 1:fdd22bb7aa52 | 1690 | |
emilmont | 1:fdd22bb7aa52 | 1691 | void arm_mat_init_q31( |
emilmont | 1:fdd22bb7aa52 | 1692 | arm_matrix_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1693 | uint16_t nRows, |
emilmont | 1:fdd22bb7aa52 | 1694 | uint16_t nColumns, |
emilmont | 1:fdd22bb7aa52 | 1695 | q31_t * pData); |
emilmont | 1:fdd22bb7aa52 | 1696 | |
emilmont | 1:fdd22bb7aa52 | 1697 | /** |
emilmont | 1:fdd22bb7aa52 | 1698 | * @brief Q15 matrix initialization. |
emilmont | 1:fdd22bb7aa52 | 1699 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
emilmont | 1:fdd22bb7aa52 | 1700 | * @param[in] nRows number of rows in the matrix. |
emilmont | 1:fdd22bb7aa52 | 1701 | * @param[in] nColumns number of columns in the matrix. |
emilmont | 2:da51fb522205 | 1702 | * @param[in] *pData points to the matrix data array. |
emilmont | 1:fdd22bb7aa52 | 1703 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1704 | */ |
emilmont | 1:fdd22bb7aa52 | 1705 | |
emilmont | 1:fdd22bb7aa52 | 1706 | void arm_mat_init_q15( |
emilmont | 1:fdd22bb7aa52 | 1707 | arm_matrix_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1708 | uint16_t nRows, |
emilmont | 1:fdd22bb7aa52 | 1709 | uint16_t nColumns, |
emilmont | 1:fdd22bb7aa52 | 1710 | q15_t * pData); |
emilmont | 1:fdd22bb7aa52 | 1711 | |
emilmont | 1:fdd22bb7aa52 | 1712 | /** |
emilmont | 1:fdd22bb7aa52 | 1713 | * @brief Floating-point matrix initialization. |
emilmont | 1:fdd22bb7aa52 | 1714 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
emilmont | 1:fdd22bb7aa52 | 1715 | * @param[in] nRows number of rows in the matrix. |
emilmont | 1:fdd22bb7aa52 | 1716 | * @param[in] nColumns number of columns in the matrix. |
emilmont | 2:da51fb522205 | 1717 | * @param[in] *pData points to the matrix data array. |
emilmont | 1:fdd22bb7aa52 | 1718 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1719 | */ |
emilmont | 1:fdd22bb7aa52 | 1720 | |
emilmont | 1:fdd22bb7aa52 | 1721 | void arm_mat_init_f32( |
emilmont | 1:fdd22bb7aa52 | 1722 | arm_matrix_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 1723 | uint16_t nRows, |
emilmont | 1:fdd22bb7aa52 | 1724 | uint16_t nColumns, |
emilmont | 1:fdd22bb7aa52 | 1725 | float32_t * pData); |
emilmont | 1:fdd22bb7aa52 | 1726 | |
emilmont | 1:fdd22bb7aa52 | 1727 | |
emilmont | 1:fdd22bb7aa52 | 1728 | |
emilmont | 1:fdd22bb7aa52 | 1729 | /** |
emilmont | 1:fdd22bb7aa52 | 1730 | * @brief Instance structure for the Q15 PID Control. |
emilmont | 1:fdd22bb7aa52 | 1731 | */ |
emilmont | 1:fdd22bb7aa52 | 1732 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1733 | { |
emilmont | 1:fdd22bb7aa52 | 1734 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
mbed_official | 3:7a284390b0ce | 1735 | #ifdef ARM_MATH_CM0_FAMILY |
emilmont | 1:fdd22bb7aa52 | 1736 | q15_t A1; |
emilmont | 1:fdd22bb7aa52 | 1737 | q15_t A2; |
emilmont | 1:fdd22bb7aa52 | 1738 | #else |
emilmont | 1:fdd22bb7aa52 | 1739 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ |
emilmont | 1:fdd22bb7aa52 | 1740 | #endif |
emilmont | 1:fdd22bb7aa52 | 1741 | q15_t state[3]; /**< The state array of length 3. */ |
emilmont | 1:fdd22bb7aa52 | 1742 | q15_t Kp; /**< The proportional gain. */ |
emilmont | 1:fdd22bb7aa52 | 1743 | q15_t Ki; /**< The integral gain. */ |
emilmont | 1:fdd22bb7aa52 | 1744 | q15_t Kd; /**< The derivative gain. */ |
emilmont | 1:fdd22bb7aa52 | 1745 | } arm_pid_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 1746 | |
emilmont | 1:fdd22bb7aa52 | 1747 | /** |
emilmont | 1:fdd22bb7aa52 | 1748 | * @brief Instance structure for the Q31 PID Control. |
emilmont | 1:fdd22bb7aa52 | 1749 | */ |
emilmont | 1:fdd22bb7aa52 | 1750 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1751 | { |
emilmont | 1:fdd22bb7aa52 | 1752 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
emilmont | 1:fdd22bb7aa52 | 1753 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
emilmont | 1:fdd22bb7aa52 | 1754 | q31_t A2; /**< The derived gain, A2 = Kd . */ |
emilmont | 1:fdd22bb7aa52 | 1755 | q31_t state[3]; /**< The state array of length 3. */ |
emilmont | 1:fdd22bb7aa52 | 1756 | q31_t Kp; /**< The proportional gain. */ |
emilmont | 1:fdd22bb7aa52 | 1757 | q31_t Ki; /**< The integral gain. */ |
emilmont | 1:fdd22bb7aa52 | 1758 | q31_t Kd; /**< The derivative gain. */ |
emilmont | 1:fdd22bb7aa52 | 1759 | |
emilmont | 1:fdd22bb7aa52 | 1760 | } arm_pid_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 1761 | |
emilmont | 1:fdd22bb7aa52 | 1762 | /** |
emilmont | 1:fdd22bb7aa52 | 1763 | * @brief Instance structure for the floating-point PID Control. |
emilmont | 1:fdd22bb7aa52 | 1764 | */ |
emilmont | 1:fdd22bb7aa52 | 1765 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1766 | { |
emilmont | 1:fdd22bb7aa52 | 1767 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
emilmont | 1:fdd22bb7aa52 | 1768 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
emilmont | 1:fdd22bb7aa52 | 1769 | float32_t A2; /**< The derived gain, A2 = Kd . */ |
emilmont | 1:fdd22bb7aa52 | 1770 | float32_t state[3]; /**< The state array of length 3. */ |
emilmont | 1:fdd22bb7aa52 | 1771 | float32_t Kp; /**< The proportional gain. */ |
emilmont | 1:fdd22bb7aa52 | 1772 | float32_t Ki; /**< The integral gain. */ |
emilmont | 1:fdd22bb7aa52 | 1773 | float32_t Kd; /**< The derivative gain. */ |
emilmont | 1:fdd22bb7aa52 | 1774 | } arm_pid_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 1775 | |
emilmont | 1:fdd22bb7aa52 | 1776 | |
emilmont | 1:fdd22bb7aa52 | 1777 | |
emilmont | 1:fdd22bb7aa52 | 1778 | /** |
emilmont | 1:fdd22bb7aa52 | 1779 | * @brief Initialization function for the floating-point PID Control. |
emilmont | 1:fdd22bb7aa52 | 1780 | * @param[in,out] *S points to an instance of the PID structure. |
emilmont | 1:fdd22bb7aa52 | 1781 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
emilmont | 1:fdd22bb7aa52 | 1782 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1783 | */ |
emilmont | 1:fdd22bb7aa52 | 1784 | void arm_pid_init_f32( |
emilmont | 1:fdd22bb7aa52 | 1785 | arm_pid_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 1786 | int32_t resetStateFlag); |
emilmont | 1:fdd22bb7aa52 | 1787 | |
emilmont | 1:fdd22bb7aa52 | 1788 | /** |
emilmont | 1:fdd22bb7aa52 | 1789 | * @brief Reset function for the floating-point PID Control. |
emilmont | 1:fdd22bb7aa52 | 1790 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
emilmont | 1:fdd22bb7aa52 | 1791 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1792 | */ |
emilmont | 1:fdd22bb7aa52 | 1793 | void arm_pid_reset_f32( |
emilmont | 1:fdd22bb7aa52 | 1794 | arm_pid_instance_f32 * S); |
emilmont | 1:fdd22bb7aa52 | 1795 | |
emilmont | 1:fdd22bb7aa52 | 1796 | |
emilmont | 1:fdd22bb7aa52 | 1797 | /** |
emilmont | 1:fdd22bb7aa52 | 1798 | * @brief Initialization function for the Q31 PID Control. |
emilmont | 1:fdd22bb7aa52 | 1799 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
emilmont | 1:fdd22bb7aa52 | 1800 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
emilmont | 1:fdd22bb7aa52 | 1801 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1802 | */ |
emilmont | 1:fdd22bb7aa52 | 1803 | void arm_pid_init_q31( |
emilmont | 1:fdd22bb7aa52 | 1804 | arm_pid_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 1805 | int32_t resetStateFlag); |
emilmont | 1:fdd22bb7aa52 | 1806 | |
emilmont | 1:fdd22bb7aa52 | 1807 | |
emilmont | 1:fdd22bb7aa52 | 1808 | /** |
emilmont | 1:fdd22bb7aa52 | 1809 | * @brief Reset function for the Q31 PID Control. |
emilmont | 1:fdd22bb7aa52 | 1810 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
emilmont | 1:fdd22bb7aa52 | 1811 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1812 | */ |
emilmont | 1:fdd22bb7aa52 | 1813 | |
emilmont | 1:fdd22bb7aa52 | 1814 | void arm_pid_reset_q31( |
emilmont | 1:fdd22bb7aa52 | 1815 | arm_pid_instance_q31 * S); |
emilmont | 1:fdd22bb7aa52 | 1816 | |
emilmont | 1:fdd22bb7aa52 | 1817 | /** |
emilmont | 1:fdd22bb7aa52 | 1818 | * @brief Initialization function for the Q15 PID Control. |
emilmont | 1:fdd22bb7aa52 | 1819 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
emilmont | 1:fdd22bb7aa52 | 1820 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
emilmont | 1:fdd22bb7aa52 | 1821 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1822 | */ |
emilmont | 1:fdd22bb7aa52 | 1823 | void arm_pid_init_q15( |
emilmont | 1:fdd22bb7aa52 | 1824 | arm_pid_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 1825 | int32_t resetStateFlag); |
emilmont | 1:fdd22bb7aa52 | 1826 | |
emilmont | 1:fdd22bb7aa52 | 1827 | /** |
emilmont | 1:fdd22bb7aa52 | 1828 | * @brief Reset function for the Q15 PID Control. |
emilmont | 1:fdd22bb7aa52 | 1829 | * @param[in,out] *S points to an instance of the q15 PID Control structure |
emilmont | 1:fdd22bb7aa52 | 1830 | * @return none |
emilmont | 1:fdd22bb7aa52 | 1831 | */ |
emilmont | 1:fdd22bb7aa52 | 1832 | void arm_pid_reset_q15( |
emilmont | 1:fdd22bb7aa52 | 1833 | arm_pid_instance_q15 * S); |
emilmont | 1:fdd22bb7aa52 | 1834 | |
emilmont | 1:fdd22bb7aa52 | 1835 | |
emilmont | 1:fdd22bb7aa52 | 1836 | /** |
emilmont | 1:fdd22bb7aa52 | 1837 | * @brief Instance structure for the floating-point Linear Interpolate function. |
emilmont | 1:fdd22bb7aa52 | 1838 | */ |
emilmont | 1:fdd22bb7aa52 | 1839 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1840 | { |
emilmont | 1:fdd22bb7aa52 | 1841 | uint32_t nValues; /**< nValues */ |
emilmont | 1:fdd22bb7aa52 | 1842 | float32_t x1; /**< x1 */ |
emilmont | 1:fdd22bb7aa52 | 1843 | float32_t xSpacing; /**< xSpacing */ |
emilmont | 1:fdd22bb7aa52 | 1844 | float32_t *pYData; /**< pointer to the table of Y values */ |
emilmont | 1:fdd22bb7aa52 | 1845 | } arm_linear_interp_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 1846 | |
emilmont | 1:fdd22bb7aa52 | 1847 | /** |
emilmont | 1:fdd22bb7aa52 | 1848 | * @brief Instance structure for the floating-point bilinear interpolation function. |
emilmont | 1:fdd22bb7aa52 | 1849 | */ |
emilmont | 1:fdd22bb7aa52 | 1850 | |
emilmont | 1:fdd22bb7aa52 | 1851 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1852 | { |
emilmont | 1:fdd22bb7aa52 | 1853 | uint16_t numRows; /**< number of rows in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1854 | uint16_t numCols; /**< number of columns in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1855 | float32_t *pData; /**< points to the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1856 | } arm_bilinear_interp_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 1857 | |
emilmont | 1:fdd22bb7aa52 | 1858 | /** |
emilmont | 1:fdd22bb7aa52 | 1859 | * @brief Instance structure for the Q31 bilinear interpolation function. |
emilmont | 1:fdd22bb7aa52 | 1860 | */ |
emilmont | 1:fdd22bb7aa52 | 1861 | |
emilmont | 1:fdd22bb7aa52 | 1862 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1863 | { |
emilmont | 1:fdd22bb7aa52 | 1864 | uint16_t numRows; /**< number of rows in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1865 | uint16_t numCols; /**< number of columns in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1866 | q31_t *pData; /**< points to the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1867 | } arm_bilinear_interp_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 1868 | |
emilmont | 1:fdd22bb7aa52 | 1869 | /** |
emilmont | 1:fdd22bb7aa52 | 1870 | * @brief Instance structure for the Q15 bilinear interpolation function. |
emilmont | 1:fdd22bb7aa52 | 1871 | */ |
emilmont | 1:fdd22bb7aa52 | 1872 | |
emilmont | 1:fdd22bb7aa52 | 1873 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1874 | { |
emilmont | 1:fdd22bb7aa52 | 1875 | uint16_t numRows; /**< number of rows in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1876 | uint16_t numCols; /**< number of columns in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1877 | q15_t *pData; /**< points to the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1878 | } arm_bilinear_interp_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 1879 | |
emilmont | 1:fdd22bb7aa52 | 1880 | /** |
emilmont | 1:fdd22bb7aa52 | 1881 | * @brief Instance structure for the Q15 bilinear interpolation function. |
emilmont | 1:fdd22bb7aa52 | 1882 | */ |
emilmont | 1:fdd22bb7aa52 | 1883 | |
emilmont | 1:fdd22bb7aa52 | 1884 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1885 | { |
emilmont | 1:fdd22bb7aa52 | 1886 | uint16_t numRows; /**< number of rows in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1887 | uint16_t numCols; /**< number of columns in the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1888 | q7_t *pData; /**< points to the data table. */ |
emilmont | 1:fdd22bb7aa52 | 1889 | } arm_bilinear_interp_instance_q7; |
emilmont | 1:fdd22bb7aa52 | 1890 | |
emilmont | 1:fdd22bb7aa52 | 1891 | |
emilmont | 1:fdd22bb7aa52 | 1892 | /** |
emilmont | 1:fdd22bb7aa52 | 1893 | * @brief Q7 vector multiplication. |
emilmont | 1:fdd22bb7aa52 | 1894 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 1895 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 1896 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 1897 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 1898 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1899 | */ |
emilmont | 1:fdd22bb7aa52 | 1900 | |
emilmont | 1:fdd22bb7aa52 | 1901 | void arm_mult_q7( |
emilmont | 1:fdd22bb7aa52 | 1902 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1903 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1904 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1905 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1906 | |
emilmont | 1:fdd22bb7aa52 | 1907 | /** |
emilmont | 1:fdd22bb7aa52 | 1908 | * @brief Q15 vector multiplication. |
emilmont | 1:fdd22bb7aa52 | 1909 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 1910 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 1911 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 1912 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 1913 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1914 | */ |
emilmont | 1:fdd22bb7aa52 | 1915 | |
emilmont | 1:fdd22bb7aa52 | 1916 | void arm_mult_q15( |
emilmont | 1:fdd22bb7aa52 | 1917 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1918 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1919 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1920 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1921 | |
emilmont | 1:fdd22bb7aa52 | 1922 | /** |
emilmont | 1:fdd22bb7aa52 | 1923 | * @brief Q31 vector multiplication. |
emilmont | 1:fdd22bb7aa52 | 1924 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 1925 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 1926 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 1927 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 1928 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1929 | */ |
emilmont | 1:fdd22bb7aa52 | 1930 | |
emilmont | 1:fdd22bb7aa52 | 1931 | void arm_mult_q31( |
emilmont | 1:fdd22bb7aa52 | 1932 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1933 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1934 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1935 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1936 | |
emilmont | 1:fdd22bb7aa52 | 1937 | /** |
emilmont | 1:fdd22bb7aa52 | 1938 | * @brief Floating-point vector multiplication. |
emilmont | 1:fdd22bb7aa52 | 1939 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 1940 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 1941 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 1942 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 1943 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 1944 | */ |
emilmont | 1:fdd22bb7aa52 | 1945 | |
emilmont | 1:fdd22bb7aa52 | 1946 | void arm_mult_f32( |
emilmont | 1:fdd22bb7aa52 | 1947 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 1948 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 1949 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 1950 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 1951 | |
emilmont | 1:fdd22bb7aa52 | 1952 | |
mbed_official | 3:7a284390b0ce | 1953 | |
mbed_official | 3:7a284390b0ce | 1954 | |
emilmont | 1:fdd22bb7aa52 | 1955 | |
emilmont | 1:fdd22bb7aa52 | 1956 | |
emilmont | 1:fdd22bb7aa52 | 1957 | /** |
emilmont | 1:fdd22bb7aa52 | 1958 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
emilmont | 1:fdd22bb7aa52 | 1959 | */ |
emilmont | 1:fdd22bb7aa52 | 1960 | |
emilmont | 1:fdd22bb7aa52 | 1961 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 1962 | { |
emilmont | 1:fdd22bb7aa52 | 1963 | uint16_t fftLen; /**< length of the FFT. */ |
emilmont | 1:fdd22bb7aa52 | 1964 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emilmont | 1:fdd22bb7aa52 | 1965 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emilmont | 1:fdd22bb7aa52 | 1966 | q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 1967 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emilmont | 1:fdd22bb7aa52 | 1968 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 1969 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emilmont | 1:fdd22bb7aa52 | 1970 | } arm_cfft_radix2_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 1971 | |
mbed_official | 3:7a284390b0ce | 1972 | arm_status arm_cfft_radix2_init_q15( |
mbed_official | 3:7a284390b0ce | 1973 | arm_cfft_radix2_instance_q15 * S, |
mbed_official | 3:7a284390b0ce | 1974 | uint16_t fftLen, |
mbed_official | 3:7a284390b0ce | 1975 | uint8_t ifftFlag, |
mbed_official | 3:7a284390b0ce | 1976 | uint8_t bitReverseFlag); |
mbed_official | 3:7a284390b0ce | 1977 | |
mbed_official | 3:7a284390b0ce | 1978 | void arm_cfft_radix2_q15( |
mbed_official | 3:7a284390b0ce | 1979 | const arm_cfft_radix2_instance_q15 * S, |
mbed_official | 3:7a284390b0ce | 1980 | q15_t * pSrc); |
mbed_official | 3:7a284390b0ce | 1981 | |
mbed_official | 3:7a284390b0ce | 1982 | |
mbed_official | 3:7a284390b0ce | 1983 | |
mbed_official | 3:7a284390b0ce | 1984 | /** |
mbed_official | 3:7a284390b0ce | 1985 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
mbed_official | 3:7a284390b0ce | 1986 | */ |
mbed_official | 3:7a284390b0ce | 1987 | |
mbed_official | 3:7a284390b0ce | 1988 | typedef struct |
mbed_official | 3:7a284390b0ce | 1989 | { |
mbed_official | 3:7a284390b0ce | 1990 | uint16_t fftLen; /**< length of the FFT. */ |
mbed_official | 3:7a284390b0ce | 1991 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mbed_official | 3:7a284390b0ce | 1992 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mbed_official | 3:7a284390b0ce | 1993 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 1994 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 1995 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 1996 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 1997 | } arm_cfft_radix4_instance_q15; |
mbed_official | 3:7a284390b0ce | 1998 | |
mbed_official | 3:7a284390b0ce | 1999 | arm_status arm_cfft_radix4_init_q15( |
mbed_official | 3:7a284390b0ce | 2000 | arm_cfft_radix4_instance_q15 * S, |
mbed_official | 3:7a284390b0ce | 2001 | uint16_t fftLen, |
mbed_official | 3:7a284390b0ce | 2002 | uint8_t ifftFlag, |
mbed_official | 3:7a284390b0ce | 2003 | uint8_t bitReverseFlag); |
mbed_official | 3:7a284390b0ce | 2004 | |
mbed_official | 3:7a284390b0ce | 2005 | void arm_cfft_radix4_q15( |
mbed_official | 3:7a284390b0ce | 2006 | const arm_cfft_radix4_instance_q15 * S, |
mbed_official | 3:7a284390b0ce | 2007 | q15_t * pSrc); |
mbed_official | 3:7a284390b0ce | 2008 | |
emilmont | 1:fdd22bb7aa52 | 2009 | /** |
emilmont | 1:fdd22bb7aa52 | 2010 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. |
emilmont | 1:fdd22bb7aa52 | 2011 | */ |
emilmont | 1:fdd22bb7aa52 | 2012 | |
emilmont | 1:fdd22bb7aa52 | 2013 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2014 | { |
emilmont | 1:fdd22bb7aa52 | 2015 | uint16_t fftLen; /**< length of the FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2016 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emilmont | 1:fdd22bb7aa52 | 2017 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emilmont | 1:fdd22bb7aa52 | 2018 | q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2019 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emilmont | 1:fdd22bb7aa52 | 2020 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2021 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emilmont | 1:fdd22bb7aa52 | 2022 | } arm_cfft_radix2_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 2023 | |
mbed_official | 3:7a284390b0ce | 2024 | arm_status arm_cfft_radix2_init_q31( |
mbed_official | 3:7a284390b0ce | 2025 | arm_cfft_radix2_instance_q31 * S, |
mbed_official | 3:7a284390b0ce | 2026 | uint16_t fftLen, |
mbed_official | 3:7a284390b0ce | 2027 | uint8_t ifftFlag, |
mbed_official | 3:7a284390b0ce | 2028 | uint8_t bitReverseFlag); |
mbed_official | 3:7a284390b0ce | 2029 | |
mbed_official | 3:7a284390b0ce | 2030 | void arm_cfft_radix2_q31( |
mbed_official | 3:7a284390b0ce | 2031 | const arm_cfft_radix2_instance_q31 * S, |
mbed_official | 3:7a284390b0ce | 2032 | q31_t * pSrc); |
mbed_official | 3:7a284390b0ce | 2033 | |
mbed_official | 3:7a284390b0ce | 2034 | /** |
mbed_official | 3:7a284390b0ce | 2035 | * @brief Instance structure for the Q31 CFFT/CIFFT function. |
mbed_official | 3:7a284390b0ce | 2036 | */ |
mbed_official | 3:7a284390b0ce | 2037 | |
mbed_official | 3:7a284390b0ce | 2038 | typedef struct |
mbed_official | 3:7a284390b0ce | 2039 | { |
mbed_official | 3:7a284390b0ce | 2040 | uint16_t fftLen; /**< length of the FFT. */ |
mbed_official | 3:7a284390b0ce | 2041 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mbed_official | 3:7a284390b0ce | 2042 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mbed_official | 3:7a284390b0ce | 2043 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 2044 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 2045 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 2046 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 2047 | } arm_cfft_radix4_instance_q31; |
mbed_official | 3:7a284390b0ce | 2048 | |
mbed_official | 3:7a284390b0ce | 2049 | |
mbed_official | 3:7a284390b0ce | 2050 | void arm_cfft_radix4_q31( |
mbed_official | 3:7a284390b0ce | 2051 | const arm_cfft_radix4_instance_q31 * S, |
mbed_official | 3:7a284390b0ce | 2052 | q31_t * pSrc); |
mbed_official | 3:7a284390b0ce | 2053 | |
mbed_official | 3:7a284390b0ce | 2054 | arm_status arm_cfft_radix4_init_q31( |
mbed_official | 3:7a284390b0ce | 2055 | arm_cfft_radix4_instance_q31 * S, |
mbed_official | 3:7a284390b0ce | 2056 | uint16_t fftLen, |
mbed_official | 3:7a284390b0ce | 2057 | uint8_t ifftFlag, |
mbed_official | 3:7a284390b0ce | 2058 | uint8_t bitReverseFlag); |
mbed_official | 3:7a284390b0ce | 2059 | |
emilmont | 1:fdd22bb7aa52 | 2060 | /** |
emilmont | 1:fdd22bb7aa52 | 2061 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
emilmont | 1:fdd22bb7aa52 | 2062 | */ |
emilmont | 1:fdd22bb7aa52 | 2063 | |
emilmont | 1:fdd22bb7aa52 | 2064 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2065 | { |
emilmont | 1:fdd22bb7aa52 | 2066 | uint16_t fftLen; /**< length of the FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2067 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
emilmont | 1:fdd22bb7aa52 | 2068 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
emilmont | 1:fdd22bb7aa52 | 2069 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2070 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
emilmont | 1:fdd22bb7aa52 | 2071 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2072 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
emilmont | 1:fdd22bb7aa52 | 2073 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
emilmont | 1:fdd22bb7aa52 | 2074 | } arm_cfft_radix2_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 2075 | |
mbed_official | 3:7a284390b0ce | 2076 | /* Deprecated */ |
emilmont | 1:fdd22bb7aa52 | 2077 | arm_status arm_cfft_radix2_init_f32( |
emilmont | 1:fdd22bb7aa52 | 2078 | arm_cfft_radix2_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2079 | uint16_t fftLen, |
emilmont | 1:fdd22bb7aa52 | 2080 | uint8_t ifftFlag, |
emilmont | 1:fdd22bb7aa52 | 2081 | uint8_t bitReverseFlag); |
emilmont | 1:fdd22bb7aa52 | 2082 | |
mbed_official | 3:7a284390b0ce | 2083 | /* Deprecated */ |
mbed_official | 3:7a284390b0ce | 2084 | void arm_cfft_radix2_f32( |
mbed_official | 3:7a284390b0ce | 2085 | const arm_cfft_radix2_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2086 | float32_t * pSrc); |
emilmont | 1:fdd22bb7aa52 | 2087 | |
emilmont | 1:fdd22bb7aa52 | 2088 | /** |
mbed_official | 3:7a284390b0ce | 2089 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
mbed_official | 3:7a284390b0ce | 2090 | */ |
mbed_official | 3:7a284390b0ce | 2091 | |
mbed_official | 3:7a284390b0ce | 2092 | typedef struct |
mbed_official | 3:7a284390b0ce | 2093 | { |
mbed_official | 3:7a284390b0ce | 2094 | uint16_t fftLen; /**< length of the FFT. */ |
mbed_official | 3:7a284390b0ce | 2095 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mbed_official | 3:7a284390b0ce | 2096 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mbed_official | 3:7a284390b0ce | 2097 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 2098 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 2099 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 2100 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 2101 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
mbed_official | 3:7a284390b0ce | 2102 | } arm_cfft_radix4_instance_f32; |
mbed_official | 3:7a284390b0ce | 2103 | |
mbed_official | 3:7a284390b0ce | 2104 | /* Deprecated */ |
emilmont | 1:fdd22bb7aa52 | 2105 | arm_status arm_cfft_radix4_init_f32( |
emilmont | 1:fdd22bb7aa52 | 2106 | arm_cfft_radix4_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2107 | uint16_t fftLen, |
emilmont | 1:fdd22bb7aa52 | 2108 | uint8_t ifftFlag, |
emilmont | 1:fdd22bb7aa52 | 2109 | uint8_t bitReverseFlag); |
emilmont | 1:fdd22bb7aa52 | 2110 | |
mbed_official | 3:7a284390b0ce | 2111 | /* Deprecated */ |
mbed_official | 3:7a284390b0ce | 2112 | void arm_cfft_radix4_f32( |
mbed_official | 3:7a284390b0ce | 2113 | const arm_cfft_radix4_instance_f32 * S, |
mbed_official | 3:7a284390b0ce | 2114 | float32_t * pSrc); |
mbed_official | 3:7a284390b0ce | 2115 | |
mbed_official | 3:7a284390b0ce | 2116 | /** |
mbed_official | 3:7a284390b0ce | 2117 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
mbed_official | 3:7a284390b0ce | 2118 | */ |
mbed_official | 3:7a284390b0ce | 2119 | |
mbed_official | 3:7a284390b0ce | 2120 | typedef struct |
mbed_official | 3:7a284390b0ce | 2121 | { |
mbed_official | 3:7a284390b0ce | 2122 | uint16_t fftLen; /**< length of the FFT. */ |
mbed_official | 3:7a284390b0ce | 2123 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mbed_official | 3:7a284390b0ce | 2124 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mbed_official | 3:7a284390b0ce | 2125 | uint16_t bitRevLength; /**< bit reversal table length. */ |
mbed_official | 3:7a284390b0ce | 2126 | } arm_cfft_instance_f32; |
mbed_official | 3:7a284390b0ce | 2127 | |
mbed_official | 3:7a284390b0ce | 2128 | void arm_cfft_f32( |
mbed_official | 3:7a284390b0ce | 2129 | const arm_cfft_instance_f32 * S, |
mbed_official | 3:7a284390b0ce | 2130 | float32_t * p1, |
mbed_official | 3:7a284390b0ce | 2131 | uint8_t ifftFlag, |
mbed_official | 3:7a284390b0ce | 2132 | uint8_t bitReverseFlag); |
emilmont | 1:fdd22bb7aa52 | 2133 | |
emilmont | 1:fdd22bb7aa52 | 2134 | /** |
emilmont | 1:fdd22bb7aa52 | 2135 | * @brief Instance structure for the Q15 RFFT/RIFFT function. |
emilmont | 1:fdd22bb7aa52 | 2136 | */ |
emilmont | 1:fdd22bb7aa52 | 2137 | |
emilmont | 1:fdd22bb7aa52 | 2138 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2139 | { |
emilmont | 1:fdd22bb7aa52 | 2140 | uint32_t fftLenReal; /**< length of the real FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2141 | uint32_t fftLenBy2; /**< length of the complex FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2142 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
emilmont | 1:fdd22bb7aa52 | 2143 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
emilmont | 1:fdd22bb7aa52 | 2144 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2145 | q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2146 | q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2147 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2148 | } arm_rfft_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 2149 | |
mbed_official | 3:7a284390b0ce | 2150 | arm_status arm_rfft_init_q15( |
mbed_official | 3:7a284390b0ce | 2151 | arm_rfft_instance_q15 * S, |
mbed_official | 3:7a284390b0ce | 2152 | arm_cfft_radix4_instance_q15 * S_CFFT, |
mbed_official | 3:7a284390b0ce | 2153 | uint32_t fftLenReal, |
mbed_official | 3:7a284390b0ce | 2154 | uint32_t ifftFlagR, |
mbed_official | 3:7a284390b0ce | 2155 | uint32_t bitReverseFlag); |
mbed_official | 3:7a284390b0ce | 2156 | |
mbed_official | 3:7a284390b0ce | 2157 | void arm_rfft_q15( |
mbed_official | 3:7a284390b0ce | 2158 | const arm_rfft_instance_q15 * S, |
mbed_official | 3:7a284390b0ce | 2159 | q15_t * pSrc, |
mbed_official | 3:7a284390b0ce | 2160 | q15_t * pDst); |
mbed_official | 3:7a284390b0ce | 2161 | |
emilmont | 1:fdd22bb7aa52 | 2162 | /** |
emilmont | 1:fdd22bb7aa52 | 2163 | * @brief Instance structure for the Q31 RFFT/RIFFT function. |
emilmont | 1:fdd22bb7aa52 | 2164 | */ |
emilmont | 1:fdd22bb7aa52 | 2165 | |
emilmont | 1:fdd22bb7aa52 | 2166 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2167 | { |
emilmont | 1:fdd22bb7aa52 | 2168 | uint32_t fftLenReal; /**< length of the real FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2169 | uint32_t fftLenBy2; /**< length of the complex FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2170 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
emilmont | 1:fdd22bb7aa52 | 2171 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
emilmont | 1:fdd22bb7aa52 | 2172 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2173 | q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2174 | q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2175 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2176 | } arm_rfft_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 2177 | |
mbed_official | 3:7a284390b0ce | 2178 | arm_status arm_rfft_init_q31( |
mbed_official | 3:7a284390b0ce | 2179 | arm_rfft_instance_q31 * S, |
mbed_official | 3:7a284390b0ce | 2180 | arm_cfft_radix4_instance_q31 * S_CFFT, |
mbed_official | 3:7a284390b0ce | 2181 | uint32_t fftLenReal, |
mbed_official | 3:7a284390b0ce | 2182 | uint32_t ifftFlagR, |
mbed_official | 3:7a284390b0ce | 2183 | uint32_t bitReverseFlag); |
mbed_official | 3:7a284390b0ce | 2184 | |
mbed_official | 3:7a284390b0ce | 2185 | void arm_rfft_q31( |
mbed_official | 3:7a284390b0ce | 2186 | const arm_rfft_instance_q31 * S, |
mbed_official | 3:7a284390b0ce | 2187 | q31_t * pSrc, |
mbed_official | 3:7a284390b0ce | 2188 | q31_t * pDst); |
mbed_official | 3:7a284390b0ce | 2189 | |
emilmont | 1:fdd22bb7aa52 | 2190 | /** |
emilmont | 1:fdd22bb7aa52 | 2191 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
emilmont | 1:fdd22bb7aa52 | 2192 | */ |
emilmont | 1:fdd22bb7aa52 | 2193 | |
emilmont | 1:fdd22bb7aa52 | 2194 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2195 | { |
emilmont | 1:fdd22bb7aa52 | 2196 | uint32_t fftLenReal; /**< length of the real FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2197 | uint16_t fftLenBy2; /**< length of the complex FFT. */ |
emilmont | 1:fdd22bb7aa52 | 2198 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
emilmont | 1:fdd22bb7aa52 | 2199 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
emilmont | 1:fdd22bb7aa52 | 2200 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2201 | float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2202 | float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2203 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2204 | } arm_rfft_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 2205 | |
emilmont | 1:fdd22bb7aa52 | 2206 | arm_status arm_rfft_init_f32( |
emilmont | 1:fdd22bb7aa52 | 2207 | arm_rfft_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2208 | arm_cfft_radix4_instance_f32 * S_CFFT, |
emilmont | 1:fdd22bb7aa52 | 2209 | uint32_t fftLenReal, |
emilmont | 1:fdd22bb7aa52 | 2210 | uint32_t ifftFlagR, |
emilmont | 1:fdd22bb7aa52 | 2211 | uint32_t bitReverseFlag); |
emilmont | 1:fdd22bb7aa52 | 2212 | |
emilmont | 1:fdd22bb7aa52 | 2213 | void arm_rfft_f32( |
emilmont | 1:fdd22bb7aa52 | 2214 | const arm_rfft_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2215 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2216 | float32_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 2217 | |
emilmont | 1:fdd22bb7aa52 | 2218 | /** |
mbed_official | 3:7a284390b0ce | 2219 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
mbed_official | 3:7a284390b0ce | 2220 | */ |
mbed_official | 3:7a284390b0ce | 2221 | |
mbed_official | 3:7a284390b0ce | 2222 | typedef struct |
mbed_official | 3:7a284390b0ce | 2223 | { |
mbed_official | 3:7a284390b0ce | 2224 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ |
mbed_official | 3:7a284390b0ce | 2225 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
mbed_official | 3:7a284390b0ce | 2226 | float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
mbed_official | 3:7a284390b0ce | 2227 | } arm_rfft_fast_instance_f32 ; |
mbed_official | 3:7a284390b0ce | 2228 | |
mbed_official | 3:7a284390b0ce | 2229 | arm_status arm_rfft_fast_init_f32 ( |
mbed_official | 3:7a284390b0ce | 2230 | arm_rfft_fast_instance_f32 * S, |
mbed_official | 3:7a284390b0ce | 2231 | uint16_t fftLen); |
mbed_official | 3:7a284390b0ce | 2232 | |
mbed_official | 3:7a284390b0ce | 2233 | void arm_rfft_fast_f32( |
mbed_official | 3:7a284390b0ce | 2234 | arm_rfft_fast_instance_f32 * S, |
mbed_official | 3:7a284390b0ce | 2235 | float32_t * p, float32_t * pOut, |
mbed_official | 3:7a284390b0ce | 2236 | uint8_t ifftFlag); |
mbed_official | 3:7a284390b0ce | 2237 | |
mbed_official | 3:7a284390b0ce | 2238 | /** |
emilmont | 1:fdd22bb7aa52 | 2239 | * @brief Instance structure for the floating-point DCT4/IDCT4 function. |
emilmont | 1:fdd22bb7aa52 | 2240 | */ |
emilmont | 1:fdd22bb7aa52 | 2241 | |
emilmont | 1:fdd22bb7aa52 | 2242 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2243 | { |
emilmont | 1:fdd22bb7aa52 | 2244 | uint16_t N; /**< length of the DCT4. */ |
emilmont | 1:fdd22bb7aa52 | 2245 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
emilmont | 1:fdd22bb7aa52 | 2246 | float32_t normalize; /**< normalizing factor. */ |
emilmont | 1:fdd22bb7aa52 | 2247 | float32_t *pTwiddle; /**< points to the twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2248 | float32_t *pCosFactor; /**< points to the cosFactor table. */ |
emilmont | 1:fdd22bb7aa52 | 2249 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2250 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2251 | } arm_dct4_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 2252 | |
emilmont | 1:fdd22bb7aa52 | 2253 | /** |
emilmont | 1:fdd22bb7aa52 | 2254 | * @brief Initialization function for the floating-point DCT4/IDCT4. |
emilmont | 1:fdd22bb7aa52 | 2255 | * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure. |
emilmont | 1:fdd22bb7aa52 | 2256 | * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure. |
emilmont | 1:fdd22bb7aa52 | 2257 | * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure. |
emilmont | 1:fdd22bb7aa52 | 2258 | * @param[in] N length of the DCT4. |
emilmont | 1:fdd22bb7aa52 | 2259 | * @param[in] Nby2 half of the length of the DCT4. |
emilmont | 1:fdd22bb7aa52 | 2260 | * @param[in] normalize normalizing factor. |
emilmont | 2:da51fb522205 | 2261 | * @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. |
emilmont | 1:fdd22bb7aa52 | 2262 | */ |
emilmont | 1:fdd22bb7aa52 | 2263 | |
emilmont | 1:fdd22bb7aa52 | 2264 | arm_status arm_dct4_init_f32( |
emilmont | 1:fdd22bb7aa52 | 2265 | arm_dct4_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2266 | arm_rfft_instance_f32 * S_RFFT, |
emilmont | 1:fdd22bb7aa52 | 2267 | arm_cfft_radix4_instance_f32 * S_CFFT, |
emilmont | 1:fdd22bb7aa52 | 2268 | uint16_t N, |
emilmont | 1:fdd22bb7aa52 | 2269 | uint16_t Nby2, |
emilmont | 1:fdd22bb7aa52 | 2270 | float32_t normalize); |
emilmont | 1:fdd22bb7aa52 | 2271 | |
emilmont | 1:fdd22bb7aa52 | 2272 | /** |
emilmont | 1:fdd22bb7aa52 | 2273 | * @brief Processing function for the floating-point DCT4/IDCT4. |
emilmont | 1:fdd22bb7aa52 | 2274 | * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure. |
emilmont | 1:fdd22bb7aa52 | 2275 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 2276 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
emilmont | 1:fdd22bb7aa52 | 2277 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2278 | */ |
emilmont | 1:fdd22bb7aa52 | 2279 | |
emilmont | 1:fdd22bb7aa52 | 2280 | void arm_dct4_f32( |
emilmont | 1:fdd22bb7aa52 | 2281 | const arm_dct4_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 2282 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 2283 | float32_t * pInlineBuffer); |
emilmont | 1:fdd22bb7aa52 | 2284 | |
emilmont | 1:fdd22bb7aa52 | 2285 | /** |
emilmont | 1:fdd22bb7aa52 | 2286 | * @brief Instance structure for the Q31 DCT4/IDCT4 function. |
emilmont | 1:fdd22bb7aa52 | 2287 | */ |
emilmont | 1:fdd22bb7aa52 | 2288 | |
emilmont | 1:fdd22bb7aa52 | 2289 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2290 | { |
emilmont | 1:fdd22bb7aa52 | 2291 | uint16_t N; /**< length of the DCT4. */ |
emilmont | 1:fdd22bb7aa52 | 2292 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
emilmont | 1:fdd22bb7aa52 | 2293 | q31_t normalize; /**< normalizing factor. */ |
emilmont | 1:fdd22bb7aa52 | 2294 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2295 | q31_t *pCosFactor; /**< points to the cosFactor table. */ |
emilmont | 1:fdd22bb7aa52 | 2296 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2297 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2298 | } arm_dct4_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 2299 | |
emilmont | 1:fdd22bb7aa52 | 2300 | /** |
emilmont | 1:fdd22bb7aa52 | 2301 | * @brief Initialization function for the Q31 DCT4/IDCT4. |
emilmont | 1:fdd22bb7aa52 | 2302 | * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure. |
emilmont | 1:fdd22bb7aa52 | 2303 | * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure |
emilmont | 1:fdd22bb7aa52 | 2304 | * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure |
emilmont | 1:fdd22bb7aa52 | 2305 | * @param[in] N length of the DCT4. |
emilmont | 1:fdd22bb7aa52 | 2306 | * @param[in] Nby2 half of the length of the DCT4. |
emilmont | 1:fdd22bb7aa52 | 2307 | * @param[in] normalize normalizing factor. |
emilmont | 2:da51fb522205 | 2308 | * @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. |
emilmont | 1:fdd22bb7aa52 | 2309 | */ |
emilmont | 1:fdd22bb7aa52 | 2310 | |
emilmont | 1:fdd22bb7aa52 | 2311 | arm_status arm_dct4_init_q31( |
emilmont | 1:fdd22bb7aa52 | 2312 | arm_dct4_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 2313 | arm_rfft_instance_q31 * S_RFFT, |
emilmont | 1:fdd22bb7aa52 | 2314 | arm_cfft_radix4_instance_q31 * S_CFFT, |
emilmont | 1:fdd22bb7aa52 | 2315 | uint16_t N, |
emilmont | 1:fdd22bb7aa52 | 2316 | uint16_t Nby2, |
emilmont | 1:fdd22bb7aa52 | 2317 | q31_t normalize); |
emilmont | 1:fdd22bb7aa52 | 2318 | |
emilmont | 1:fdd22bb7aa52 | 2319 | /** |
emilmont | 1:fdd22bb7aa52 | 2320 | * @brief Processing function for the Q31 DCT4/IDCT4. |
emilmont | 1:fdd22bb7aa52 | 2321 | * @param[in] *S points to an instance of the Q31 DCT4 structure. |
emilmont | 1:fdd22bb7aa52 | 2322 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 2323 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
emilmont | 1:fdd22bb7aa52 | 2324 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2325 | */ |
emilmont | 1:fdd22bb7aa52 | 2326 | |
emilmont | 1:fdd22bb7aa52 | 2327 | void arm_dct4_q31( |
emilmont | 1:fdd22bb7aa52 | 2328 | const arm_dct4_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 2329 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 2330 | q31_t * pInlineBuffer); |
emilmont | 1:fdd22bb7aa52 | 2331 | |
emilmont | 1:fdd22bb7aa52 | 2332 | /** |
emilmont | 1:fdd22bb7aa52 | 2333 | * @brief Instance structure for the Q15 DCT4/IDCT4 function. |
emilmont | 1:fdd22bb7aa52 | 2334 | */ |
emilmont | 1:fdd22bb7aa52 | 2335 | |
emilmont | 1:fdd22bb7aa52 | 2336 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 2337 | { |
emilmont | 1:fdd22bb7aa52 | 2338 | uint16_t N; /**< length of the DCT4. */ |
emilmont | 1:fdd22bb7aa52 | 2339 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
emilmont | 1:fdd22bb7aa52 | 2340 | q15_t normalize; /**< normalizing factor. */ |
emilmont | 1:fdd22bb7aa52 | 2341 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
emilmont | 1:fdd22bb7aa52 | 2342 | q15_t *pCosFactor; /**< points to the cosFactor table. */ |
emilmont | 1:fdd22bb7aa52 | 2343 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2344 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
emilmont | 1:fdd22bb7aa52 | 2345 | } arm_dct4_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 2346 | |
emilmont | 1:fdd22bb7aa52 | 2347 | /** |
emilmont | 1:fdd22bb7aa52 | 2348 | * @brief Initialization function for the Q15 DCT4/IDCT4. |
emilmont | 1:fdd22bb7aa52 | 2349 | * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure. |
emilmont | 1:fdd22bb7aa52 | 2350 | * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure. |
emilmont | 1:fdd22bb7aa52 | 2351 | * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure. |
emilmont | 1:fdd22bb7aa52 | 2352 | * @param[in] N length of the DCT4. |
emilmont | 1:fdd22bb7aa52 | 2353 | * @param[in] Nby2 half of the length of the DCT4. |
emilmont | 1:fdd22bb7aa52 | 2354 | * @param[in] normalize normalizing factor. |
emilmont | 2:da51fb522205 | 2355 | * @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. |
emilmont | 1:fdd22bb7aa52 | 2356 | */ |
emilmont | 1:fdd22bb7aa52 | 2357 | |
emilmont | 1:fdd22bb7aa52 | 2358 | arm_status arm_dct4_init_q15( |
emilmont | 1:fdd22bb7aa52 | 2359 | arm_dct4_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 2360 | arm_rfft_instance_q15 * S_RFFT, |
emilmont | 1:fdd22bb7aa52 | 2361 | arm_cfft_radix4_instance_q15 * S_CFFT, |
emilmont | 1:fdd22bb7aa52 | 2362 | uint16_t N, |
emilmont | 1:fdd22bb7aa52 | 2363 | uint16_t Nby2, |
emilmont | 1:fdd22bb7aa52 | 2364 | q15_t normalize); |
emilmont | 1:fdd22bb7aa52 | 2365 | |
emilmont | 1:fdd22bb7aa52 | 2366 | /** |
emilmont | 1:fdd22bb7aa52 | 2367 | * @brief Processing function for the Q15 DCT4/IDCT4. |
emilmont | 1:fdd22bb7aa52 | 2368 | * @param[in] *S points to an instance of the Q15 DCT4 structure. |
emilmont | 1:fdd22bb7aa52 | 2369 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 2370 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
emilmont | 1:fdd22bb7aa52 | 2371 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2372 | */ |
emilmont | 1:fdd22bb7aa52 | 2373 | |
emilmont | 1:fdd22bb7aa52 | 2374 | void arm_dct4_q15( |
emilmont | 1:fdd22bb7aa52 | 2375 | const arm_dct4_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 2376 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 2377 | q15_t * pInlineBuffer); |
emilmont | 1:fdd22bb7aa52 | 2378 | |
emilmont | 1:fdd22bb7aa52 | 2379 | /** |
emilmont | 1:fdd22bb7aa52 | 2380 | * @brief Floating-point vector addition. |
emilmont | 1:fdd22bb7aa52 | 2381 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2382 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2383 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2384 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2385 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2386 | */ |
emilmont | 1:fdd22bb7aa52 | 2387 | |
emilmont | 1:fdd22bb7aa52 | 2388 | void arm_add_f32( |
emilmont | 1:fdd22bb7aa52 | 2389 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2390 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2391 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2392 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2393 | |
emilmont | 1:fdd22bb7aa52 | 2394 | /** |
emilmont | 1:fdd22bb7aa52 | 2395 | * @brief Q7 vector addition. |
emilmont | 1:fdd22bb7aa52 | 2396 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2397 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2398 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2399 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2400 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2401 | */ |
emilmont | 1:fdd22bb7aa52 | 2402 | |
emilmont | 1:fdd22bb7aa52 | 2403 | void arm_add_q7( |
emilmont | 1:fdd22bb7aa52 | 2404 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2405 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2406 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2407 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2408 | |
emilmont | 1:fdd22bb7aa52 | 2409 | /** |
emilmont | 1:fdd22bb7aa52 | 2410 | * @brief Q15 vector addition. |
emilmont | 1:fdd22bb7aa52 | 2411 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2412 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2413 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2414 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2415 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2416 | */ |
emilmont | 1:fdd22bb7aa52 | 2417 | |
emilmont | 1:fdd22bb7aa52 | 2418 | void arm_add_q15( |
emilmont | 1:fdd22bb7aa52 | 2419 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2420 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2421 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2422 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2423 | |
emilmont | 1:fdd22bb7aa52 | 2424 | /** |
emilmont | 1:fdd22bb7aa52 | 2425 | * @brief Q31 vector addition. |
emilmont | 1:fdd22bb7aa52 | 2426 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2427 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2428 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2429 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2430 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2431 | */ |
emilmont | 1:fdd22bb7aa52 | 2432 | |
emilmont | 1:fdd22bb7aa52 | 2433 | void arm_add_q31( |
emilmont | 1:fdd22bb7aa52 | 2434 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2435 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2436 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2437 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2438 | |
emilmont | 1:fdd22bb7aa52 | 2439 | /** |
emilmont | 1:fdd22bb7aa52 | 2440 | * @brief Floating-point vector subtraction. |
emilmont | 1:fdd22bb7aa52 | 2441 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2442 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2443 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2444 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2445 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2446 | */ |
emilmont | 1:fdd22bb7aa52 | 2447 | |
emilmont | 1:fdd22bb7aa52 | 2448 | void arm_sub_f32( |
emilmont | 1:fdd22bb7aa52 | 2449 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2450 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2451 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2452 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2453 | |
emilmont | 1:fdd22bb7aa52 | 2454 | /** |
emilmont | 1:fdd22bb7aa52 | 2455 | * @brief Q7 vector subtraction. |
emilmont | 1:fdd22bb7aa52 | 2456 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2457 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2458 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2459 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2460 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2461 | */ |
emilmont | 1:fdd22bb7aa52 | 2462 | |
emilmont | 1:fdd22bb7aa52 | 2463 | void arm_sub_q7( |
emilmont | 1:fdd22bb7aa52 | 2464 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2465 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2466 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2467 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2468 | |
emilmont | 1:fdd22bb7aa52 | 2469 | /** |
emilmont | 1:fdd22bb7aa52 | 2470 | * @brief Q15 vector subtraction. |
emilmont | 1:fdd22bb7aa52 | 2471 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2472 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2473 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2474 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2475 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2476 | */ |
emilmont | 1:fdd22bb7aa52 | 2477 | |
emilmont | 1:fdd22bb7aa52 | 2478 | void arm_sub_q15( |
emilmont | 1:fdd22bb7aa52 | 2479 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2480 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2481 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2482 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2483 | |
emilmont | 1:fdd22bb7aa52 | 2484 | /** |
emilmont | 1:fdd22bb7aa52 | 2485 | * @brief Q31 vector subtraction. |
emilmont | 1:fdd22bb7aa52 | 2486 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2487 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2488 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2489 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2490 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2491 | */ |
emilmont | 1:fdd22bb7aa52 | 2492 | |
emilmont | 1:fdd22bb7aa52 | 2493 | void arm_sub_q31( |
emilmont | 1:fdd22bb7aa52 | 2494 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2495 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2496 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2497 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2498 | |
emilmont | 1:fdd22bb7aa52 | 2499 | /** |
emilmont | 1:fdd22bb7aa52 | 2500 | * @brief Multiplies a floating-point vector by a scalar. |
emilmont | 1:fdd22bb7aa52 | 2501 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2502 | * @param[in] scale scale factor to be applied |
emilmont | 1:fdd22bb7aa52 | 2503 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2504 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2505 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2506 | */ |
emilmont | 1:fdd22bb7aa52 | 2507 | |
emilmont | 1:fdd22bb7aa52 | 2508 | void arm_scale_f32( |
emilmont | 1:fdd22bb7aa52 | 2509 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2510 | float32_t scale, |
emilmont | 1:fdd22bb7aa52 | 2511 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2512 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2513 | |
emilmont | 1:fdd22bb7aa52 | 2514 | /** |
emilmont | 1:fdd22bb7aa52 | 2515 | * @brief Multiplies a Q7 vector by a scalar. |
emilmont | 1:fdd22bb7aa52 | 2516 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2517 | * @param[in] scaleFract fractional portion of the scale value |
emilmont | 1:fdd22bb7aa52 | 2518 | * @param[in] shift number of bits to shift the result by |
emilmont | 1:fdd22bb7aa52 | 2519 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2520 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2521 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2522 | */ |
emilmont | 1:fdd22bb7aa52 | 2523 | |
emilmont | 1:fdd22bb7aa52 | 2524 | void arm_scale_q7( |
emilmont | 1:fdd22bb7aa52 | 2525 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2526 | q7_t scaleFract, |
emilmont | 1:fdd22bb7aa52 | 2527 | int8_t shift, |
emilmont | 1:fdd22bb7aa52 | 2528 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2529 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2530 | |
emilmont | 1:fdd22bb7aa52 | 2531 | /** |
emilmont | 1:fdd22bb7aa52 | 2532 | * @brief Multiplies a Q15 vector by a scalar. |
emilmont | 1:fdd22bb7aa52 | 2533 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2534 | * @param[in] scaleFract fractional portion of the scale value |
emilmont | 1:fdd22bb7aa52 | 2535 | * @param[in] shift number of bits to shift the result by |
emilmont | 1:fdd22bb7aa52 | 2536 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2537 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2538 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2539 | */ |
emilmont | 1:fdd22bb7aa52 | 2540 | |
emilmont | 1:fdd22bb7aa52 | 2541 | void arm_scale_q15( |
emilmont | 1:fdd22bb7aa52 | 2542 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2543 | q15_t scaleFract, |
emilmont | 1:fdd22bb7aa52 | 2544 | int8_t shift, |
emilmont | 1:fdd22bb7aa52 | 2545 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2546 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2547 | |
emilmont | 1:fdd22bb7aa52 | 2548 | /** |
emilmont | 1:fdd22bb7aa52 | 2549 | * @brief Multiplies a Q31 vector by a scalar. |
emilmont | 1:fdd22bb7aa52 | 2550 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2551 | * @param[in] scaleFract fractional portion of the scale value |
emilmont | 1:fdd22bb7aa52 | 2552 | * @param[in] shift number of bits to shift the result by |
emilmont | 1:fdd22bb7aa52 | 2553 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2554 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2555 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2556 | */ |
emilmont | 1:fdd22bb7aa52 | 2557 | |
emilmont | 1:fdd22bb7aa52 | 2558 | void arm_scale_q31( |
emilmont | 1:fdd22bb7aa52 | 2559 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2560 | q31_t scaleFract, |
emilmont | 1:fdd22bb7aa52 | 2561 | int8_t shift, |
emilmont | 1:fdd22bb7aa52 | 2562 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2563 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2564 | |
emilmont | 1:fdd22bb7aa52 | 2565 | /** |
emilmont | 1:fdd22bb7aa52 | 2566 | * @brief Q7 vector absolute value. |
emilmont | 1:fdd22bb7aa52 | 2567 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 2568 | * @param[out] *pDst points to the output buffer |
emilmont | 1:fdd22bb7aa52 | 2569 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2570 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2571 | */ |
emilmont | 1:fdd22bb7aa52 | 2572 | |
emilmont | 1:fdd22bb7aa52 | 2573 | void arm_abs_q7( |
emilmont | 1:fdd22bb7aa52 | 2574 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2575 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2576 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2577 | |
emilmont | 1:fdd22bb7aa52 | 2578 | /** |
emilmont | 1:fdd22bb7aa52 | 2579 | * @brief Floating-point vector absolute value. |
emilmont | 1:fdd22bb7aa52 | 2580 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 2581 | * @param[out] *pDst points to the output buffer |
emilmont | 1:fdd22bb7aa52 | 2582 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2583 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2584 | */ |
emilmont | 1:fdd22bb7aa52 | 2585 | |
emilmont | 1:fdd22bb7aa52 | 2586 | void arm_abs_f32( |
emilmont | 1:fdd22bb7aa52 | 2587 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2588 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2589 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2590 | |
emilmont | 1:fdd22bb7aa52 | 2591 | /** |
emilmont | 1:fdd22bb7aa52 | 2592 | * @brief Q15 vector absolute value. |
emilmont | 1:fdd22bb7aa52 | 2593 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 2594 | * @param[out] *pDst points to the output buffer |
emilmont | 1:fdd22bb7aa52 | 2595 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2596 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2597 | */ |
emilmont | 1:fdd22bb7aa52 | 2598 | |
emilmont | 1:fdd22bb7aa52 | 2599 | void arm_abs_q15( |
emilmont | 1:fdd22bb7aa52 | 2600 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2601 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2602 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2603 | |
emilmont | 1:fdd22bb7aa52 | 2604 | /** |
emilmont | 1:fdd22bb7aa52 | 2605 | * @brief Q31 vector absolute value. |
emilmont | 1:fdd22bb7aa52 | 2606 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 2607 | * @param[out] *pDst points to the output buffer |
emilmont | 1:fdd22bb7aa52 | 2608 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2609 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2610 | */ |
emilmont | 1:fdd22bb7aa52 | 2611 | |
emilmont | 1:fdd22bb7aa52 | 2612 | void arm_abs_q31( |
emilmont | 1:fdd22bb7aa52 | 2613 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2614 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2615 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2616 | |
emilmont | 1:fdd22bb7aa52 | 2617 | /** |
emilmont | 1:fdd22bb7aa52 | 2618 | * @brief Dot product of floating-point vectors. |
emilmont | 1:fdd22bb7aa52 | 2619 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2620 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2621 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2622 | * @param[out] *result output result returned here |
emilmont | 1:fdd22bb7aa52 | 2623 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2624 | */ |
emilmont | 1:fdd22bb7aa52 | 2625 | |
emilmont | 1:fdd22bb7aa52 | 2626 | void arm_dot_prod_f32( |
emilmont | 1:fdd22bb7aa52 | 2627 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2628 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2629 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 2630 | float32_t * result); |
emilmont | 1:fdd22bb7aa52 | 2631 | |
emilmont | 1:fdd22bb7aa52 | 2632 | /** |
emilmont | 1:fdd22bb7aa52 | 2633 | * @brief Dot product of Q7 vectors. |
emilmont | 1:fdd22bb7aa52 | 2634 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2635 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2636 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2637 | * @param[out] *result output result returned here |
emilmont | 1:fdd22bb7aa52 | 2638 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2639 | */ |
emilmont | 1:fdd22bb7aa52 | 2640 | |
emilmont | 1:fdd22bb7aa52 | 2641 | void arm_dot_prod_q7( |
emilmont | 1:fdd22bb7aa52 | 2642 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2643 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2644 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 2645 | q31_t * result); |
emilmont | 1:fdd22bb7aa52 | 2646 | |
emilmont | 1:fdd22bb7aa52 | 2647 | /** |
emilmont | 1:fdd22bb7aa52 | 2648 | * @brief Dot product of Q15 vectors. |
emilmont | 1:fdd22bb7aa52 | 2649 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2650 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2651 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2652 | * @param[out] *result output result returned here |
emilmont | 1:fdd22bb7aa52 | 2653 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2654 | */ |
emilmont | 1:fdd22bb7aa52 | 2655 | |
emilmont | 1:fdd22bb7aa52 | 2656 | void arm_dot_prod_q15( |
emilmont | 1:fdd22bb7aa52 | 2657 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2658 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2659 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 2660 | q63_t * result); |
emilmont | 1:fdd22bb7aa52 | 2661 | |
emilmont | 1:fdd22bb7aa52 | 2662 | /** |
emilmont | 1:fdd22bb7aa52 | 2663 | * @brief Dot product of Q31 vectors. |
emilmont | 1:fdd22bb7aa52 | 2664 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 2665 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 2666 | * @param[in] blockSize number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 2667 | * @param[out] *result output result returned here |
emilmont | 1:fdd22bb7aa52 | 2668 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2669 | */ |
emilmont | 1:fdd22bb7aa52 | 2670 | |
emilmont | 1:fdd22bb7aa52 | 2671 | void arm_dot_prod_q31( |
emilmont | 1:fdd22bb7aa52 | 2672 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2673 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2674 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 2675 | q63_t * result); |
emilmont | 1:fdd22bb7aa52 | 2676 | |
emilmont | 1:fdd22bb7aa52 | 2677 | /** |
emilmont | 1:fdd22bb7aa52 | 2678 | * @brief Shifts the elements of a Q7 vector a specified number of bits. |
emilmont | 1:fdd22bb7aa52 | 2679 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2680 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
emilmont | 1:fdd22bb7aa52 | 2681 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2682 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2683 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2684 | */ |
emilmont | 1:fdd22bb7aa52 | 2685 | |
emilmont | 1:fdd22bb7aa52 | 2686 | void arm_shift_q7( |
emilmont | 1:fdd22bb7aa52 | 2687 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2688 | int8_t shiftBits, |
emilmont | 1:fdd22bb7aa52 | 2689 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2690 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2691 | |
emilmont | 1:fdd22bb7aa52 | 2692 | /** |
emilmont | 1:fdd22bb7aa52 | 2693 | * @brief Shifts the elements of a Q15 vector a specified number of bits. |
emilmont | 1:fdd22bb7aa52 | 2694 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2695 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
emilmont | 1:fdd22bb7aa52 | 2696 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2697 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2698 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2699 | */ |
emilmont | 1:fdd22bb7aa52 | 2700 | |
emilmont | 1:fdd22bb7aa52 | 2701 | void arm_shift_q15( |
emilmont | 1:fdd22bb7aa52 | 2702 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2703 | int8_t shiftBits, |
emilmont | 1:fdd22bb7aa52 | 2704 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2705 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2706 | |
emilmont | 1:fdd22bb7aa52 | 2707 | /** |
emilmont | 1:fdd22bb7aa52 | 2708 | * @brief Shifts the elements of a Q31 vector a specified number of bits. |
emilmont | 1:fdd22bb7aa52 | 2709 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2710 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
emilmont | 1:fdd22bb7aa52 | 2711 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2712 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2713 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2714 | */ |
emilmont | 1:fdd22bb7aa52 | 2715 | |
emilmont | 1:fdd22bb7aa52 | 2716 | void arm_shift_q31( |
emilmont | 1:fdd22bb7aa52 | 2717 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2718 | int8_t shiftBits, |
emilmont | 1:fdd22bb7aa52 | 2719 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2720 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2721 | |
emilmont | 1:fdd22bb7aa52 | 2722 | /** |
emilmont | 1:fdd22bb7aa52 | 2723 | * @brief Adds a constant offset to a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 2724 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2725 | * @param[in] offset is the offset to be added |
emilmont | 1:fdd22bb7aa52 | 2726 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2727 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2728 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2729 | */ |
emilmont | 1:fdd22bb7aa52 | 2730 | |
emilmont | 1:fdd22bb7aa52 | 2731 | void arm_offset_f32( |
emilmont | 1:fdd22bb7aa52 | 2732 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2733 | float32_t offset, |
emilmont | 1:fdd22bb7aa52 | 2734 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2735 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2736 | |
emilmont | 1:fdd22bb7aa52 | 2737 | /** |
emilmont | 1:fdd22bb7aa52 | 2738 | * @brief Adds a constant offset to a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 2739 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2740 | * @param[in] offset is the offset to be added |
emilmont | 1:fdd22bb7aa52 | 2741 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2742 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2743 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2744 | */ |
emilmont | 1:fdd22bb7aa52 | 2745 | |
emilmont | 1:fdd22bb7aa52 | 2746 | void arm_offset_q7( |
emilmont | 1:fdd22bb7aa52 | 2747 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2748 | q7_t offset, |
emilmont | 1:fdd22bb7aa52 | 2749 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2750 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2751 | |
emilmont | 1:fdd22bb7aa52 | 2752 | /** |
emilmont | 1:fdd22bb7aa52 | 2753 | * @brief Adds a constant offset to a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 2754 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2755 | * @param[in] offset is the offset to be added |
emilmont | 1:fdd22bb7aa52 | 2756 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2757 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2758 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2759 | */ |
emilmont | 1:fdd22bb7aa52 | 2760 | |
emilmont | 1:fdd22bb7aa52 | 2761 | void arm_offset_q15( |
emilmont | 1:fdd22bb7aa52 | 2762 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2763 | q15_t offset, |
emilmont | 1:fdd22bb7aa52 | 2764 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2765 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2766 | |
emilmont | 1:fdd22bb7aa52 | 2767 | /** |
emilmont | 1:fdd22bb7aa52 | 2768 | * @brief Adds a constant offset to a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 2769 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2770 | * @param[in] offset is the offset to be added |
emilmont | 1:fdd22bb7aa52 | 2771 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2772 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2773 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2774 | */ |
emilmont | 1:fdd22bb7aa52 | 2775 | |
emilmont | 1:fdd22bb7aa52 | 2776 | void arm_offset_q31( |
emilmont | 1:fdd22bb7aa52 | 2777 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2778 | q31_t offset, |
emilmont | 1:fdd22bb7aa52 | 2779 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2780 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2781 | |
emilmont | 1:fdd22bb7aa52 | 2782 | /** |
emilmont | 1:fdd22bb7aa52 | 2783 | * @brief Negates the elements of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 2784 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2785 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2786 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2787 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2788 | */ |
emilmont | 1:fdd22bb7aa52 | 2789 | |
emilmont | 1:fdd22bb7aa52 | 2790 | void arm_negate_f32( |
emilmont | 1:fdd22bb7aa52 | 2791 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2792 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2793 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2794 | |
emilmont | 1:fdd22bb7aa52 | 2795 | /** |
emilmont | 1:fdd22bb7aa52 | 2796 | * @brief Negates the elements of a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 2797 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2798 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2799 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2800 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2801 | */ |
emilmont | 1:fdd22bb7aa52 | 2802 | |
emilmont | 1:fdd22bb7aa52 | 2803 | void arm_negate_q7( |
emilmont | 1:fdd22bb7aa52 | 2804 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2805 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2806 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2807 | |
emilmont | 1:fdd22bb7aa52 | 2808 | /** |
emilmont | 1:fdd22bb7aa52 | 2809 | * @brief Negates the elements of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 2810 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2811 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2812 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2813 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2814 | */ |
emilmont | 1:fdd22bb7aa52 | 2815 | |
emilmont | 1:fdd22bb7aa52 | 2816 | void arm_negate_q15( |
emilmont | 1:fdd22bb7aa52 | 2817 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2818 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2819 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2820 | |
emilmont | 1:fdd22bb7aa52 | 2821 | /** |
emilmont | 1:fdd22bb7aa52 | 2822 | * @brief Negates the elements of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 2823 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 2824 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 2825 | * @param[in] blockSize number of samples in the vector |
emilmont | 1:fdd22bb7aa52 | 2826 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2827 | */ |
emilmont | 1:fdd22bb7aa52 | 2828 | |
emilmont | 1:fdd22bb7aa52 | 2829 | void arm_negate_q31( |
emilmont | 1:fdd22bb7aa52 | 2830 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2831 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2832 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2833 | /** |
mbed_official | 3:7a284390b0ce | 2834 | * @brief Copies the elements of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 2835 | * @param[in] *pSrc input pointer |
emilmont | 1:fdd22bb7aa52 | 2836 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2837 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2838 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2839 | */ |
emilmont | 1:fdd22bb7aa52 | 2840 | void arm_copy_f32( |
emilmont | 1:fdd22bb7aa52 | 2841 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2842 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2843 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2844 | |
emilmont | 1:fdd22bb7aa52 | 2845 | /** |
mbed_official | 3:7a284390b0ce | 2846 | * @brief Copies the elements of a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 2847 | * @param[in] *pSrc input pointer |
emilmont | 1:fdd22bb7aa52 | 2848 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2849 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2850 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2851 | */ |
emilmont | 1:fdd22bb7aa52 | 2852 | void arm_copy_q7( |
emilmont | 1:fdd22bb7aa52 | 2853 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2854 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2855 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2856 | |
emilmont | 1:fdd22bb7aa52 | 2857 | /** |
mbed_official | 3:7a284390b0ce | 2858 | * @brief Copies the elements of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 2859 | * @param[in] *pSrc input pointer |
emilmont | 1:fdd22bb7aa52 | 2860 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2861 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2862 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2863 | */ |
emilmont | 1:fdd22bb7aa52 | 2864 | void arm_copy_q15( |
emilmont | 1:fdd22bb7aa52 | 2865 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2866 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2867 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2868 | |
emilmont | 1:fdd22bb7aa52 | 2869 | /** |
mbed_official | 3:7a284390b0ce | 2870 | * @brief Copies the elements of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 2871 | * @param[in] *pSrc input pointer |
emilmont | 1:fdd22bb7aa52 | 2872 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2873 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2874 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2875 | */ |
emilmont | 1:fdd22bb7aa52 | 2876 | void arm_copy_q31( |
emilmont | 1:fdd22bb7aa52 | 2877 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 2878 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2879 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2880 | /** |
mbed_official | 3:7a284390b0ce | 2881 | * @brief Fills a constant value into a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 2882 | * @param[in] value input value to be filled |
emilmont | 1:fdd22bb7aa52 | 2883 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2884 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2885 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2886 | */ |
emilmont | 1:fdd22bb7aa52 | 2887 | void arm_fill_f32( |
emilmont | 1:fdd22bb7aa52 | 2888 | float32_t value, |
emilmont | 1:fdd22bb7aa52 | 2889 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2890 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2891 | |
emilmont | 1:fdd22bb7aa52 | 2892 | /** |
mbed_official | 3:7a284390b0ce | 2893 | * @brief Fills a constant value into a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 2894 | * @param[in] value input value to be filled |
emilmont | 1:fdd22bb7aa52 | 2895 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2896 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2897 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2898 | */ |
emilmont | 1:fdd22bb7aa52 | 2899 | void arm_fill_q7( |
emilmont | 1:fdd22bb7aa52 | 2900 | q7_t value, |
emilmont | 1:fdd22bb7aa52 | 2901 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2902 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2903 | |
emilmont | 1:fdd22bb7aa52 | 2904 | /** |
mbed_official | 3:7a284390b0ce | 2905 | * @brief Fills a constant value into a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 2906 | * @param[in] value input value to be filled |
emilmont | 1:fdd22bb7aa52 | 2907 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2908 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2909 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2910 | */ |
emilmont | 1:fdd22bb7aa52 | 2911 | void arm_fill_q15( |
emilmont | 1:fdd22bb7aa52 | 2912 | q15_t value, |
emilmont | 1:fdd22bb7aa52 | 2913 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2914 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2915 | |
emilmont | 1:fdd22bb7aa52 | 2916 | /** |
mbed_official | 3:7a284390b0ce | 2917 | * @brief Fills a constant value into a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 2918 | * @param[in] value input value to be filled |
emilmont | 1:fdd22bb7aa52 | 2919 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 2920 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 2921 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2922 | */ |
emilmont | 1:fdd22bb7aa52 | 2923 | void arm_fill_q31( |
emilmont | 1:fdd22bb7aa52 | 2924 | q31_t value, |
emilmont | 1:fdd22bb7aa52 | 2925 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2926 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 2927 | |
mbed_official | 3:7a284390b0ce | 2928 | /** |
mbed_official | 3:7a284390b0ce | 2929 | * @brief Convolution of floating-point sequences. |
mbed_official | 3:7a284390b0ce | 2930 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 2931 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 2932 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 2933 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 2934 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
mbed_official | 3:7a284390b0ce | 2935 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2936 | */ |
emilmont | 1:fdd22bb7aa52 | 2937 | |
emilmont | 1:fdd22bb7aa52 | 2938 | void arm_conv_f32( |
emilmont | 1:fdd22bb7aa52 | 2939 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2940 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 2941 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2942 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 2943 | float32_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 2944 | |
mbed_official | 3:7a284390b0ce | 2945 | |
mbed_official | 3:7a284390b0ce | 2946 | /** |
mbed_official | 3:7a284390b0ce | 2947 | * @brief Convolution of Q15 sequences. |
mbed_official | 3:7a284390b0ce | 2948 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 2949 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 2950 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 2951 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 2952 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mbed_official | 3:7a284390b0ce | 2953 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 2954 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 2955 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2956 | */ |
emilmont | 1:fdd22bb7aa52 | 2957 | |
emilmont | 1:fdd22bb7aa52 | 2958 | |
emilmont | 1:fdd22bb7aa52 | 2959 | void arm_conv_opt_q15( |
emilmont | 1:fdd22bb7aa52 | 2960 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2961 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 2962 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2963 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 2964 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 2965 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 2966 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 2967 | |
emilmont | 1:fdd22bb7aa52 | 2968 | |
mbed_official | 3:7a284390b0ce | 2969 | /** |
mbed_official | 3:7a284390b0ce | 2970 | * @brief Convolution of Q15 sequences. |
mbed_official | 3:7a284390b0ce | 2971 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 2972 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 2973 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 2974 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 2975 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
mbed_official | 3:7a284390b0ce | 2976 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2977 | */ |
emilmont | 1:fdd22bb7aa52 | 2978 | |
emilmont | 1:fdd22bb7aa52 | 2979 | void arm_conv_q15( |
emilmont | 1:fdd22bb7aa52 | 2980 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 2981 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 2982 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 2983 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 2984 | q15_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 2985 | |
emilmont | 1:fdd22bb7aa52 | 2986 | /** |
emilmont | 1:fdd22bb7aa52 | 2987 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 2988 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 2989 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 2990 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 2991 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 2992 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emilmont | 1:fdd22bb7aa52 | 2993 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 2994 | */ |
emilmont | 1:fdd22bb7aa52 | 2995 | |
emilmont | 1:fdd22bb7aa52 | 2996 | void arm_conv_fast_q15( |
emilmont | 2:da51fb522205 | 2997 | q15_t * pSrcA, |
emilmont | 2:da51fb522205 | 2998 | uint32_t srcALen, |
emilmont | 2:da51fb522205 | 2999 | q15_t * pSrcB, |
emilmont | 2:da51fb522205 | 3000 | uint32_t srcBLen, |
emilmont | 2:da51fb522205 | 3001 | q15_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 3002 | |
emilmont | 1:fdd22bb7aa52 | 3003 | /** |
emilmont | 1:fdd22bb7aa52 | 3004 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 3005 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3006 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3007 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3008 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3009 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mbed_official | 3:7a284390b0ce | 3010 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 3011 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 3012 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3013 | */ |
emilmont | 1:fdd22bb7aa52 | 3014 | |
emilmont | 1:fdd22bb7aa52 | 3015 | void arm_conv_fast_opt_q15( |
emilmont | 1:fdd22bb7aa52 | 3016 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3017 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3018 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3019 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3020 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3021 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 3022 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 3023 | |
emilmont | 1:fdd22bb7aa52 | 3024 | |
emilmont | 1:fdd22bb7aa52 | 3025 | |
emilmont | 1:fdd22bb7aa52 | 3026 | /** |
emilmont | 1:fdd22bb7aa52 | 3027 | * @brief Convolution of Q31 sequences. |
emilmont | 1:fdd22bb7aa52 | 3028 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3029 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3030 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3031 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3032 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emilmont | 1:fdd22bb7aa52 | 3033 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3034 | */ |
emilmont | 1:fdd22bb7aa52 | 3035 | |
emilmont | 1:fdd22bb7aa52 | 3036 | void arm_conv_q31( |
emilmont | 1:fdd22bb7aa52 | 3037 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3038 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3039 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3040 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3041 | q31_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 3042 | |
emilmont | 1:fdd22bb7aa52 | 3043 | /** |
emilmont | 1:fdd22bb7aa52 | 3044 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 3045 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3046 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3047 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3048 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3049 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emilmont | 1:fdd22bb7aa52 | 3050 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3051 | */ |
emilmont | 1:fdd22bb7aa52 | 3052 | |
emilmont | 1:fdd22bb7aa52 | 3053 | void arm_conv_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 3054 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3055 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3056 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3057 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3058 | q31_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 3059 | |
emilmont | 1:fdd22bb7aa52 | 3060 | |
mbed_official | 3:7a284390b0ce | 3061 | /** |
mbed_official | 3:7a284390b0ce | 3062 | * @brief Convolution of Q7 sequences. |
mbed_official | 3:7a284390b0ce | 3063 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 3064 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 3065 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 3066 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 3067 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mbed_official | 3:7a284390b0ce | 3068 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 3069 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 3070 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3071 | */ |
emilmont | 1:fdd22bb7aa52 | 3072 | |
emilmont | 1:fdd22bb7aa52 | 3073 | void arm_conv_opt_q7( |
emilmont | 1:fdd22bb7aa52 | 3074 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3075 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3076 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3077 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3078 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3079 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 3080 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 3081 | |
emilmont | 1:fdd22bb7aa52 | 3082 | |
emilmont | 1:fdd22bb7aa52 | 3083 | |
emilmont | 1:fdd22bb7aa52 | 3084 | /** |
emilmont | 1:fdd22bb7aa52 | 3085 | * @brief Convolution of Q7 sequences. |
emilmont | 1:fdd22bb7aa52 | 3086 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3087 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3088 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3089 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3090 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
emilmont | 1:fdd22bb7aa52 | 3091 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3092 | */ |
emilmont | 1:fdd22bb7aa52 | 3093 | |
emilmont | 1:fdd22bb7aa52 | 3094 | void arm_conv_q7( |
emilmont | 1:fdd22bb7aa52 | 3095 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3096 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3097 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3098 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3099 | q7_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 3100 | |
emilmont | 1:fdd22bb7aa52 | 3101 | |
emilmont | 1:fdd22bb7aa52 | 3102 | /** |
emilmont | 1:fdd22bb7aa52 | 3103 | * @brief Partial convolution of floating-point sequences. |
emilmont | 1:fdd22bb7aa52 | 3104 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3105 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3106 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3107 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3108 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3109 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3110 | * @param[in] numPoints is the number of output points to be computed. |
emilmont | 1:fdd22bb7aa52 | 3111 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3112 | */ |
emilmont | 1:fdd22bb7aa52 | 3113 | |
emilmont | 1:fdd22bb7aa52 | 3114 | arm_status arm_conv_partial_f32( |
emilmont | 1:fdd22bb7aa52 | 3115 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3116 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3117 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3118 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3119 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3120 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3121 | uint32_t numPoints); |
emilmont | 1:fdd22bb7aa52 | 3122 | |
mbed_official | 3:7a284390b0ce | 3123 | /** |
mbed_official | 3:7a284390b0ce | 3124 | * @brief Partial convolution of Q15 sequences. |
mbed_official | 3:7a284390b0ce | 3125 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 3126 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 3127 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 3128 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 3129 | * @param[out] *pDst points to the block of output data |
mbed_official | 3:7a284390b0ce | 3130 | * @param[in] firstIndex is the first output sample to start with. |
mbed_official | 3:7a284390b0ce | 3131 | * @param[in] numPoints is the number of output points to be computed. |
mbed_official | 3:7a284390b0ce | 3132 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 3133 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 3134 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3135 | */ |
emilmont | 1:fdd22bb7aa52 | 3136 | |
emilmont | 1:fdd22bb7aa52 | 3137 | arm_status arm_conv_partial_opt_q15( |
emilmont | 1:fdd22bb7aa52 | 3138 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3139 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3140 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3141 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3142 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3143 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3144 | uint32_t numPoints, |
emilmont | 1:fdd22bb7aa52 | 3145 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 3146 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 3147 | |
emilmont | 1:fdd22bb7aa52 | 3148 | |
emilmont | 1:fdd22bb7aa52 | 3149 | /** |
emilmont | 1:fdd22bb7aa52 | 3150 | * @brief Partial convolution of Q15 sequences. |
emilmont | 1:fdd22bb7aa52 | 3151 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3152 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3153 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3154 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3155 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3156 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3157 | * @param[in] numPoints is the number of output points to be computed. |
emilmont | 1:fdd22bb7aa52 | 3158 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3159 | */ |
emilmont | 1:fdd22bb7aa52 | 3160 | |
emilmont | 1:fdd22bb7aa52 | 3161 | arm_status arm_conv_partial_q15( |
emilmont | 1:fdd22bb7aa52 | 3162 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3163 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3164 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3165 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3166 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3167 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3168 | uint32_t numPoints); |
emilmont | 1:fdd22bb7aa52 | 3169 | |
emilmont | 1:fdd22bb7aa52 | 3170 | /** |
emilmont | 1:fdd22bb7aa52 | 3171 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 3172 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3173 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3174 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3175 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3176 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3177 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3178 | * @param[in] numPoints is the number of output points to be computed. |
emilmont | 1:fdd22bb7aa52 | 3179 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
emilmont | 1:fdd22bb7aa52 | 3180 | */ |
emilmont | 1:fdd22bb7aa52 | 3181 | |
emilmont | 1:fdd22bb7aa52 | 3182 | arm_status arm_conv_partial_fast_q15( |
emilmont | 2:da51fb522205 | 3183 | q15_t * pSrcA, |
emilmont | 2:da51fb522205 | 3184 | uint32_t srcALen, |
emilmont | 2:da51fb522205 | 3185 | q15_t * pSrcB, |
emilmont | 2:da51fb522205 | 3186 | uint32_t srcBLen, |
emilmont | 2:da51fb522205 | 3187 | q15_t * pDst, |
emilmont | 2:da51fb522205 | 3188 | uint32_t firstIndex, |
emilmont | 2:da51fb522205 | 3189 | uint32_t numPoints); |
emilmont | 1:fdd22bb7aa52 | 3190 | |
emilmont | 1:fdd22bb7aa52 | 3191 | |
emilmont | 1:fdd22bb7aa52 | 3192 | /** |
emilmont | 1:fdd22bb7aa52 | 3193 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 3194 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3195 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3196 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3197 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3198 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3199 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3200 | * @param[in] numPoints is the number of output points to be computed. |
mbed_official | 3:7a284390b0ce | 3201 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 3202 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 3203 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3204 | */ |
emilmont | 1:fdd22bb7aa52 | 3205 | |
emilmont | 1:fdd22bb7aa52 | 3206 | arm_status arm_conv_partial_fast_opt_q15( |
emilmont | 1:fdd22bb7aa52 | 3207 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3208 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3209 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3210 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3211 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3212 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3213 | uint32_t numPoints, |
emilmont | 1:fdd22bb7aa52 | 3214 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 3215 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 3216 | |
emilmont | 1:fdd22bb7aa52 | 3217 | |
emilmont | 1:fdd22bb7aa52 | 3218 | /** |
emilmont | 1:fdd22bb7aa52 | 3219 | * @brief Partial convolution of Q31 sequences. |
emilmont | 1:fdd22bb7aa52 | 3220 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3221 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3222 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3223 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3224 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3225 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3226 | * @param[in] numPoints is the number of output points to be computed. |
emilmont | 1:fdd22bb7aa52 | 3227 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3228 | */ |
emilmont | 1:fdd22bb7aa52 | 3229 | |
emilmont | 1:fdd22bb7aa52 | 3230 | arm_status arm_conv_partial_q31( |
emilmont | 1:fdd22bb7aa52 | 3231 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3232 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3233 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3234 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3235 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3236 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3237 | uint32_t numPoints); |
emilmont | 1:fdd22bb7aa52 | 3238 | |
emilmont | 1:fdd22bb7aa52 | 3239 | |
emilmont | 1:fdd22bb7aa52 | 3240 | /** |
emilmont | 1:fdd22bb7aa52 | 3241 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 3242 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3243 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3244 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3245 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3246 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3247 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3248 | * @param[in] numPoints is the number of output points to be computed. |
emilmont | 1:fdd22bb7aa52 | 3249 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3250 | */ |
emilmont | 1:fdd22bb7aa52 | 3251 | |
emilmont | 1:fdd22bb7aa52 | 3252 | arm_status arm_conv_partial_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 3253 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3254 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3255 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3256 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3257 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3258 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3259 | uint32_t numPoints); |
emilmont | 1:fdd22bb7aa52 | 3260 | |
emilmont | 1:fdd22bb7aa52 | 3261 | |
mbed_official | 3:7a284390b0ce | 3262 | /** |
mbed_official | 3:7a284390b0ce | 3263 | * @brief Partial convolution of Q7 sequences |
mbed_official | 3:7a284390b0ce | 3264 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 3265 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 3266 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 3267 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 3268 | * @param[out] *pDst points to the block of output data |
mbed_official | 3:7a284390b0ce | 3269 | * @param[in] firstIndex is the first output sample to start with. |
mbed_official | 3:7a284390b0ce | 3270 | * @param[in] numPoints is the number of output points to be computed. |
mbed_official | 3:7a284390b0ce | 3271 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 3272 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 3273 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3274 | */ |
emilmont | 1:fdd22bb7aa52 | 3275 | |
emilmont | 1:fdd22bb7aa52 | 3276 | arm_status arm_conv_partial_opt_q7( |
emilmont | 1:fdd22bb7aa52 | 3277 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3278 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3279 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3280 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3281 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3282 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3283 | uint32_t numPoints, |
emilmont | 1:fdd22bb7aa52 | 3284 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 3285 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 3286 | |
emilmont | 1:fdd22bb7aa52 | 3287 | |
emilmont | 1:fdd22bb7aa52 | 3288 | /** |
emilmont | 1:fdd22bb7aa52 | 3289 | * @brief Partial convolution of Q7 sequences. |
emilmont | 1:fdd22bb7aa52 | 3290 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3291 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 3292 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3293 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 3294 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3295 | * @param[in] firstIndex is the first output sample to start with. |
emilmont | 1:fdd22bb7aa52 | 3296 | * @param[in] numPoints is the number of output points to be computed. |
emilmont | 1:fdd22bb7aa52 | 3297 | * @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]. |
emilmont | 1:fdd22bb7aa52 | 3298 | */ |
emilmont | 1:fdd22bb7aa52 | 3299 | |
emilmont | 1:fdd22bb7aa52 | 3300 | arm_status arm_conv_partial_q7( |
emilmont | 1:fdd22bb7aa52 | 3301 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 3302 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 3303 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 3304 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 3305 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3306 | uint32_t firstIndex, |
emilmont | 1:fdd22bb7aa52 | 3307 | uint32_t numPoints); |
emilmont | 1:fdd22bb7aa52 | 3308 | |
emilmont | 1:fdd22bb7aa52 | 3309 | |
emilmont | 1:fdd22bb7aa52 | 3310 | |
emilmont | 1:fdd22bb7aa52 | 3311 | /** |
emilmont | 1:fdd22bb7aa52 | 3312 | * @brief Instance structure for the Q15 FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3313 | */ |
emilmont | 1:fdd22bb7aa52 | 3314 | |
emilmont | 1:fdd22bb7aa52 | 3315 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3316 | { |
emilmont | 1:fdd22bb7aa52 | 3317 | uint8_t M; /**< decimation factor. */ |
emilmont | 1:fdd22bb7aa52 | 3318 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3319 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 3320 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 3321 | } arm_fir_decimate_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 3322 | |
emilmont | 1:fdd22bb7aa52 | 3323 | /** |
emilmont | 1:fdd22bb7aa52 | 3324 | * @brief Instance structure for the Q31 FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3325 | */ |
emilmont | 1:fdd22bb7aa52 | 3326 | |
emilmont | 1:fdd22bb7aa52 | 3327 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3328 | { |
emilmont | 1:fdd22bb7aa52 | 3329 | uint8_t M; /**< decimation factor. */ |
emilmont | 1:fdd22bb7aa52 | 3330 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3331 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 3332 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 3333 | |
emilmont | 1:fdd22bb7aa52 | 3334 | } arm_fir_decimate_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 3335 | |
emilmont | 1:fdd22bb7aa52 | 3336 | /** |
emilmont | 1:fdd22bb7aa52 | 3337 | * @brief Instance structure for the floating-point FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3338 | */ |
emilmont | 1:fdd22bb7aa52 | 3339 | |
emilmont | 1:fdd22bb7aa52 | 3340 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3341 | { |
emilmont | 1:fdd22bb7aa52 | 3342 | uint8_t M; /**< decimation factor. */ |
emilmont | 1:fdd22bb7aa52 | 3343 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3344 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 3345 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 3346 | |
emilmont | 1:fdd22bb7aa52 | 3347 | } arm_fir_decimate_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 3348 | |
emilmont | 1:fdd22bb7aa52 | 3349 | |
emilmont | 1:fdd22bb7aa52 | 3350 | |
emilmont | 1:fdd22bb7aa52 | 3351 | /** |
emilmont | 1:fdd22bb7aa52 | 3352 | * @brief Processing function for the floating-point FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3353 | * @param[in] *S points to an instance of the floating-point FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3354 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3355 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3356 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3357 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3358 | */ |
emilmont | 1:fdd22bb7aa52 | 3359 | |
emilmont | 1:fdd22bb7aa52 | 3360 | void arm_fir_decimate_f32( |
emilmont | 1:fdd22bb7aa52 | 3361 | const arm_fir_decimate_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3362 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3363 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3364 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3365 | |
emilmont | 1:fdd22bb7aa52 | 3366 | |
emilmont | 1:fdd22bb7aa52 | 3367 | /** |
emilmont | 1:fdd22bb7aa52 | 3368 | * @brief Initialization function for the floating-point FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3369 | * @param[in,out] *S points to an instance of the floating-point FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3370 | * @param[in] numTaps number of coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 3371 | * @param[in] M decimation factor. |
emilmont | 1:fdd22bb7aa52 | 3372 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 3373 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3374 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3375 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emilmont | 1:fdd22bb7aa52 | 3376 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
emilmont | 1:fdd22bb7aa52 | 3377 | */ |
emilmont | 1:fdd22bb7aa52 | 3378 | |
emilmont | 1:fdd22bb7aa52 | 3379 | arm_status arm_fir_decimate_init_f32( |
emilmont | 1:fdd22bb7aa52 | 3380 | arm_fir_decimate_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3381 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 3382 | uint8_t M, |
emilmont | 1:fdd22bb7aa52 | 3383 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3384 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3385 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3386 | |
emilmont | 1:fdd22bb7aa52 | 3387 | /** |
emilmont | 1:fdd22bb7aa52 | 3388 | * @brief Processing function for the Q15 FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3389 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3390 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3391 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3392 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3393 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3394 | */ |
emilmont | 1:fdd22bb7aa52 | 3395 | |
emilmont | 1:fdd22bb7aa52 | 3396 | void arm_fir_decimate_q15( |
emilmont | 1:fdd22bb7aa52 | 3397 | const arm_fir_decimate_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3398 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3399 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3400 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3401 | |
emilmont | 1:fdd22bb7aa52 | 3402 | /** |
emilmont | 1:fdd22bb7aa52 | 3403 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 3404 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3405 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3406 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3407 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3408 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3409 | */ |
emilmont | 1:fdd22bb7aa52 | 3410 | |
emilmont | 1:fdd22bb7aa52 | 3411 | void arm_fir_decimate_fast_q15( |
emilmont | 1:fdd22bb7aa52 | 3412 | const arm_fir_decimate_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3413 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3414 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3415 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3416 | |
emilmont | 1:fdd22bb7aa52 | 3417 | |
emilmont | 1:fdd22bb7aa52 | 3418 | |
emilmont | 1:fdd22bb7aa52 | 3419 | /** |
emilmont | 1:fdd22bb7aa52 | 3420 | * @brief Initialization function for the Q15 FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3421 | * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3422 | * @param[in] numTaps number of coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 3423 | * @param[in] M decimation factor. |
emilmont | 1:fdd22bb7aa52 | 3424 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 3425 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3426 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3427 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emilmont | 1:fdd22bb7aa52 | 3428 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
emilmont | 1:fdd22bb7aa52 | 3429 | */ |
emilmont | 1:fdd22bb7aa52 | 3430 | |
emilmont | 1:fdd22bb7aa52 | 3431 | arm_status arm_fir_decimate_init_q15( |
emilmont | 1:fdd22bb7aa52 | 3432 | arm_fir_decimate_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3433 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 3434 | uint8_t M, |
emilmont | 1:fdd22bb7aa52 | 3435 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3436 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3437 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3438 | |
emilmont | 1:fdd22bb7aa52 | 3439 | /** |
emilmont | 1:fdd22bb7aa52 | 3440 | * @brief Processing function for the Q31 FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3441 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3442 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3443 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3444 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3445 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3446 | */ |
emilmont | 1:fdd22bb7aa52 | 3447 | |
emilmont | 1:fdd22bb7aa52 | 3448 | void arm_fir_decimate_q31( |
emilmont | 1:fdd22bb7aa52 | 3449 | const arm_fir_decimate_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3450 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3451 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3452 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3453 | |
emilmont | 1:fdd22bb7aa52 | 3454 | /** |
emilmont | 1:fdd22bb7aa52 | 3455 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 3456 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3457 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3458 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3459 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3460 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3461 | */ |
emilmont | 1:fdd22bb7aa52 | 3462 | |
emilmont | 1:fdd22bb7aa52 | 3463 | void arm_fir_decimate_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 3464 | arm_fir_decimate_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3465 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3466 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3467 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3468 | |
emilmont | 1:fdd22bb7aa52 | 3469 | |
emilmont | 1:fdd22bb7aa52 | 3470 | /** |
emilmont | 1:fdd22bb7aa52 | 3471 | * @brief Initialization function for the Q31 FIR decimator. |
emilmont | 1:fdd22bb7aa52 | 3472 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. |
emilmont | 1:fdd22bb7aa52 | 3473 | * @param[in] numTaps number of coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 3474 | * @param[in] M decimation factor. |
emilmont | 1:fdd22bb7aa52 | 3475 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 3476 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3477 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3478 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emilmont | 1:fdd22bb7aa52 | 3479 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
emilmont | 1:fdd22bb7aa52 | 3480 | */ |
emilmont | 1:fdd22bb7aa52 | 3481 | |
emilmont | 1:fdd22bb7aa52 | 3482 | arm_status arm_fir_decimate_init_q31( |
emilmont | 1:fdd22bb7aa52 | 3483 | arm_fir_decimate_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3484 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 3485 | uint8_t M, |
emilmont | 1:fdd22bb7aa52 | 3486 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3487 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3488 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3489 | |
emilmont | 1:fdd22bb7aa52 | 3490 | |
emilmont | 1:fdd22bb7aa52 | 3491 | |
emilmont | 1:fdd22bb7aa52 | 3492 | /** |
emilmont | 1:fdd22bb7aa52 | 3493 | * @brief Instance structure for the Q15 FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3494 | */ |
emilmont | 1:fdd22bb7aa52 | 3495 | |
emilmont | 1:fdd22bb7aa52 | 3496 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3497 | { |
emilmont | 1:fdd22bb7aa52 | 3498 | uint8_t L; /**< upsample factor. */ |
emilmont | 1:fdd22bb7aa52 | 3499 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
emilmont | 1:fdd22bb7aa52 | 3500 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
emilmont | 1:fdd22bb7aa52 | 3501 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
emilmont | 1:fdd22bb7aa52 | 3502 | } arm_fir_interpolate_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 3503 | |
emilmont | 1:fdd22bb7aa52 | 3504 | /** |
emilmont | 1:fdd22bb7aa52 | 3505 | * @brief Instance structure for the Q31 FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3506 | */ |
emilmont | 1:fdd22bb7aa52 | 3507 | |
emilmont | 1:fdd22bb7aa52 | 3508 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3509 | { |
emilmont | 1:fdd22bb7aa52 | 3510 | uint8_t L; /**< upsample factor. */ |
emilmont | 1:fdd22bb7aa52 | 3511 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
emilmont | 1:fdd22bb7aa52 | 3512 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
emilmont | 1:fdd22bb7aa52 | 3513 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
emilmont | 1:fdd22bb7aa52 | 3514 | } arm_fir_interpolate_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 3515 | |
emilmont | 1:fdd22bb7aa52 | 3516 | /** |
emilmont | 1:fdd22bb7aa52 | 3517 | * @brief Instance structure for the floating-point FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3518 | */ |
emilmont | 1:fdd22bb7aa52 | 3519 | |
emilmont | 1:fdd22bb7aa52 | 3520 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3521 | { |
emilmont | 1:fdd22bb7aa52 | 3522 | uint8_t L; /**< upsample factor. */ |
emilmont | 1:fdd22bb7aa52 | 3523 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
emilmont | 1:fdd22bb7aa52 | 3524 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
emilmont | 1:fdd22bb7aa52 | 3525 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ |
emilmont | 1:fdd22bb7aa52 | 3526 | } arm_fir_interpolate_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 3527 | |
emilmont | 1:fdd22bb7aa52 | 3528 | |
emilmont | 1:fdd22bb7aa52 | 3529 | /** |
emilmont | 1:fdd22bb7aa52 | 3530 | * @brief Processing function for the Q15 FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3531 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
emilmont | 1:fdd22bb7aa52 | 3532 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3533 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3534 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3535 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3536 | */ |
emilmont | 1:fdd22bb7aa52 | 3537 | |
emilmont | 1:fdd22bb7aa52 | 3538 | void arm_fir_interpolate_q15( |
emilmont | 1:fdd22bb7aa52 | 3539 | const arm_fir_interpolate_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3540 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3541 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3542 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3543 | |
emilmont | 1:fdd22bb7aa52 | 3544 | |
emilmont | 1:fdd22bb7aa52 | 3545 | /** |
emilmont | 1:fdd22bb7aa52 | 3546 | * @brief Initialization function for the Q15 FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3547 | * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. |
emilmont | 1:fdd22bb7aa52 | 3548 | * @param[in] L upsample factor. |
emilmont | 1:fdd22bb7aa52 | 3549 | * @param[in] numTaps number of filter coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 3550 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 3551 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3552 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3553 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emilmont | 1:fdd22bb7aa52 | 3554 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
emilmont | 1:fdd22bb7aa52 | 3555 | */ |
emilmont | 1:fdd22bb7aa52 | 3556 | |
emilmont | 1:fdd22bb7aa52 | 3557 | arm_status arm_fir_interpolate_init_q15( |
emilmont | 1:fdd22bb7aa52 | 3558 | arm_fir_interpolate_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3559 | uint8_t L, |
emilmont | 1:fdd22bb7aa52 | 3560 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 3561 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3562 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3563 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3564 | |
emilmont | 1:fdd22bb7aa52 | 3565 | /** |
emilmont | 1:fdd22bb7aa52 | 3566 | * @brief Processing function for the Q31 FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3567 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
emilmont | 1:fdd22bb7aa52 | 3568 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3569 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3570 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3571 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3572 | */ |
emilmont | 1:fdd22bb7aa52 | 3573 | |
emilmont | 1:fdd22bb7aa52 | 3574 | void arm_fir_interpolate_q31( |
emilmont | 1:fdd22bb7aa52 | 3575 | const arm_fir_interpolate_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3576 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3577 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3578 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3579 | |
emilmont | 1:fdd22bb7aa52 | 3580 | /** |
emilmont | 1:fdd22bb7aa52 | 3581 | * @brief Initialization function for the Q31 FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3582 | * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure. |
emilmont | 1:fdd22bb7aa52 | 3583 | * @param[in] L upsample factor. |
emilmont | 1:fdd22bb7aa52 | 3584 | * @param[in] numTaps number of filter coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 3585 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 3586 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3587 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3588 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emilmont | 1:fdd22bb7aa52 | 3589 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
emilmont | 1:fdd22bb7aa52 | 3590 | */ |
emilmont | 1:fdd22bb7aa52 | 3591 | |
emilmont | 1:fdd22bb7aa52 | 3592 | arm_status arm_fir_interpolate_init_q31( |
emilmont | 1:fdd22bb7aa52 | 3593 | arm_fir_interpolate_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3594 | uint8_t L, |
emilmont | 1:fdd22bb7aa52 | 3595 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 3596 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3597 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3598 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3599 | |
emilmont | 1:fdd22bb7aa52 | 3600 | |
emilmont | 1:fdd22bb7aa52 | 3601 | /** |
emilmont | 1:fdd22bb7aa52 | 3602 | * @brief Processing function for the floating-point FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3603 | * @param[in] *S points to an instance of the floating-point FIR interpolator structure. |
emilmont | 1:fdd22bb7aa52 | 3604 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3605 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3606 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3607 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3608 | */ |
emilmont | 1:fdd22bb7aa52 | 3609 | |
emilmont | 1:fdd22bb7aa52 | 3610 | void arm_fir_interpolate_f32( |
emilmont | 1:fdd22bb7aa52 | 3611 | const arm_fir_interpolate_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3612 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3613 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3614 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3615 | |
emilmont | 1:fdd22bb7aa52 | 3616 | /** |
emilmont | 1:fdd22bb7aa52 | 3617 | * @brief Initialization function for the floating-point FIR interpolator. |
emilmont | 1:fdd22bb7aa52 | 3618 | * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure. |
emilmont | 1:fdd22bb7aa52 | 3619 | * @param[in] L upsample factor. |
emilmont | 1:fdd22bb7aa52 | 3620 | * @param[in] numTaps number of filter coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 3621 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 3622 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3623 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3624 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
emilmont | 1:fdd22bb7aa52 | 3625 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
emilmont | 1:fdd22bb7aa52 | 3626 | */ |
emilmont | 1:fdd22bb7aa52 | 3627 | |
emilmont | 1:fdd22bb7aa52 | 3628 | arm_status arm_fir_interpolate_init_f32( |
emilmont | 1:fdd22bb7aa52 | 3629 | arm_fir_interpolate_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3630 | uint8_t L, |
emilmont | 1:fdd22bb7aa52 | 3631 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 3632 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3633 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3634 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3635 | |
emilmont | 1:fdd22bb7aa52 | 3636 | /** |
emilmont | 1:fdd22bb7aa52 | 3637 | * @brief Instance structure for the high precision Q31 Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 3638 | */ |
emilmont | 1:fdd22bb7aa52 | 3639 | |
emilmont | 1:fdd22bb7aa52 | 3640 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3641 | { |
emilmont | 1:fdd22bb7aa52 | 3642 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3643 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3644 | q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3645 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ |
emilmont | 1:fdd22bb7aa52 | 3646 | |
emilmont | 1:fdd22bb7aa52 | 3647 | } arm_biquad_cas_df1_32x64_ins_q31; |
emilmont | 1:fdd22bb7aa52 | 3648 | |
emilmont | 1:fdd22bb7aa52 | 3649 | |
emilmont | 1:fdd22bb7aa52 | 3650 | /** |
emilmont | 1:fdd22bb7aa52 | 3651 | * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
emilmont | 1:fdd22bb7aa52 | 3652 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3653 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3654 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3655 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3656 | */ |
emilmont | 1:fdd22bb7aa52 | 3657 | |
emilmont | 1:fdd22bb7aa52 | 3658 | void arm_biquad_cas_df1_32x64_q31( |
emilmont | 1:fdd22bb7aa52 | 3659 | const arm_biquad_cas_df1_32x64_ins_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3660 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3661 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3662 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3663 | |
emilmont | 1:fdd22bb7aa52 | 3664 | |
emilmont | 1:fdd22bb7aa52 | 3665 | /** |
emilmont | 1:fdd22bb7aa52 | 3666 | * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
emilmont | 1:fdd22bb7aa52 | 3667 | * @param[in] numStages number of 2nd order stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 3668 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 3669 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3670 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format |
emilmont | 1:fdd22bb7aa52 | 3671 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3672 | */ |
emilmont | 1:fdd22bb7aa52 | 3673 | |
emilmont | 1:fdd22bb7aa52 | 3674 | void arm_biquad_cas_df1_32x64_init_q31( |
emilmont | 1:fdd22bb7aa52 | 3675 | arm_biquad_cas_df1_32x64_ins_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3676 | uint8_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3677 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3678 | q63_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3679 | uint8_t postShift); |
emilmont | 1:fdd22bb7aa52 | 3680 | |
emilmont | 1:fdd22bb7aa52 | 3681 | |
emilmont | 1:fdd22bb7aa52 | 3682 | |
emilmont | 1:fdd22bb7aa52 | 3683 | /** |
emilmont | 1:fdd22bb7aa52 | 3684 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 3685 | */ |
emilmont | 1:fdd22bb7aa52 | 3686 | |
emilmont | 1:fdd22bb7aa52 | 3687 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3688 | { |
emilmont | 1:fdd22bb7aa52 | 3689 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3690 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3691 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3692 | } arm_biquad_cascade_df2T_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 3693 | |
emilmont | 1:fdd22bb7aa52 | 3694 | |
emilmont | 1:fdd22bb7aa52 | 3695 | /** |
emilmont | 1:fdd22bb7aa52 | 3696 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 3697 | * @param[in] *S points to an instance of the filter data structure. |
emilmont | 1:fdd22bb7aa52 | 3698 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3699 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3700 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3701 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3702 | */ |
emilmont | 1:fdd22bb7aa52 | 3703 | |
emilmont | 1:fdd22bb7aa52 | 3704 | void arm_biquad_cascade_df2T_f32( |
emilmont | 1:fdd22bb7aa52 | 3705 | const arm_biquad_cascade_df2T_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3706 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3707 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3708 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3709 | |
emilmont | 1:fdd22bb7aa52 | 3710 | |
emilmont | 1:fdd22bb7aa52 | 3711 | /** |
emilmont | 1:fdd22bb7aa52 | 3712 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
emilmont | 1:fdd22bb7aa52 | 3713 | * @param[in,out] *S points to an instance of the filter data structure. |
emilmont | 1:fdd22bb7aa52 | 3714 | * @param[in] numStages number of 2nd order stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 3715 | * @param[in] *pCoeffs points to the filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 3716 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 3717 | * @return none |
emilmont | 1:fdd22bb7aa52 | 3718 | */ |
emilmont | 1:fdd22bb7aa52 | 3719 | |
emilmont | 1:fdd22bb7aa52 | 3720 | void arm_biquad_cascade_df2T_init_f32( |
emilmont | 1:fdd22bb7aa52 | 3721 | arm_biquad_cascade_df2T_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3722 | uint8_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3723 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3724 | float32_t * pState); |
emilmont | 1:fdd22bb7aa52 | 3725 | |
emilmont | 1:fdd22bb7aa52 | 3726 | |
emilmont | 1:fdd22bb7aa52 | 3727 | |
emilmont | 1:fdd22bb7aa52 | 3728 | /** |
emilmont | 1:fdd22bb7aa52 | 3729 | * @brief Instance structure for the Q15 FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3730 | */ |
emilmont | 1:fdd22bb7aa52 | 3731 | |
emilmont | 1:fdd22bb7aa52 | 3732 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3733 | { |
emilmont | 1:fdd22bb7aa52 | 3734 | uint16_t numStages; /**< number of filter stages. */ |
emilmont | 1:fdd22bb7aa52 | 3735 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3736 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3737 | } arm_fir_lattice_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 3738 | |
emilmont | 1:fdd22bb7aa52 | 3739 | /** |
emilmont | 1:fdd22bb7aa52 | 3740 | * @brief Instance structure for the Q31 FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3741 | */ |
emilmont | 1:fdd22bb7aa52 | 3742 | |
emilmont | 1:fdd22bb7aa52 | 3743 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3744 | { |
emilmont | 1:fdd22bb7aa52 | 3745 | uint16_t numStages; /**< number of filter stages. */ |
emilmont | 1:fdd22bb7aa52 | 3746 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3747 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3748 | } arm_fir_lattice_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 3749 | |
emilmont | 1:fdd22bb7aa52 | 3750 | /** |
emilmont | 1:fdd22bb7aa52 | 3751 | * @brief Instance structure for the floating-point FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3752 | */ |
emilmont | 1:fdd22bb7aa52 | 3753 | |
emilmont | 1:fdd22bb7aa52 | 3754 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3755 | { |
emilmont | 1:fdd22bb7aa52 | 3756 | uint16_t numStages; /**< number of filter stages. */ |
emilmont | 1:fdd22bb7aa52 | 3757 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3758 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3759 | } arm_fir_lattice_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 3760 | |
emilmont | 1:fdd22bb7aa52 | 3761 | /** |
emilmont | 1:fdd22bb7aa52 | 3762 | * @brief Initialization function for the Q15 FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3763 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3764 | * @param[in] numStages number of filter stages. |
mbed_official | 3:7a284390b0ce | 3765 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
mbed_official | 3:7a284390b0ce | 3766 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3767 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3768 | */ |
emilmont | 1:fdd22bb7aa52 | 3769 | |
emilmont | 1:fdd22bb7aa52 | 3770 | void arm_fir_lattice_init_q15( |
emilmont | 1:fdd22bb7aa52 | 3771 | arm_fir_lattice_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3772 | uint16_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3773 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3774 | q15_t * pState); |
emilmont | 1:fdd22bb7aa52 | 3775 | |
emilmont | 1:fdd22bb7aa52 | 3776 | |
emilmont | 1:fdd22bb7aa52 | 3777 | /** |
emilmont | 1:fdd22bb7aa52 | 3778 | * @brief Processing function for the Q15 FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3779 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3780 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3781 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3782 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3783 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3784 | */ |
emilmont | 1:fdd22bb7aa52 | 3785 | void arm_fir_lattice_q15( |
emilmont | 1:fdd22bb7aa52 | 3786 | const arm_fir_lattice_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3787 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3788 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3789 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3790 | |
emilmont | 1:fdd22bb7aa52 | 3791 | /** |
emilmont | 1:fdd22bb7aa52 | 3792 | * @brief Initialization function for the Q31 FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3793 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3794 | * @param[in] numStages number of filter stages. |
emilmont | 1:fdd22bb7aa52 | 3795 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3796 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3797 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3798 | */ |
emilmont | 1:fdd22bb7aa52 | 3799 | |
emilmont | 1:fdd22bb7aa52 | 3800 | void arm_fir_lattice_init_q31( |
emilmont | 1:fdd22bb7aa52 | 3801 | arm_fir_lattice_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3802 | uint16_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3803 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3804 | q31_t * pState); |
emilmont | 1:fdd22bb7aa52 | 3805 | |
emilmont | 1:fdd22bb7aa52 | 3806 | |
emilmont | 1:fdd22bb7aa52 | 3807 | /** |
emilmont | 1:fdd22bb7aa52 | 3808 | * @brief Processing function for the Q31 FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3809 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3810 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3811 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3812 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3813 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3814 | */ |
emilmont | 1:fdd22bb7aa52 | 3815 | |
emilmont | 1:fdd22bb7aa52 | 3816 | void arm_fir_lattice_q31( |
emilmont | 1:fdd22bb7aa52 | 3817 | const arm_fir_lattice_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3818 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3819 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3820 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3821 | |
emilmont | 1:fdd22bb7aa52 | 3822 | /** |
emilmont | 1:fdd22bb7aa52 | 3823 | * @brief Initialization function for the floating-point FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3824 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3825 | * @param[in] numStages number of filter stages. |
emilmont | 1:fdd22bb7aa52 | 3826 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3827 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3828 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3829 | */ |
emilmont | 1:fdd22bb7aa52 | 3830 | |
emilmont | 1:fdd22bb7aa52 | 3831 | void arm_fir_lattice_init_f32( |
emilmont | 1:fdd22bb7aa52 | 3832 | arm_fir_lattice_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3833 | uint16_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3834 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3835 | float32_t * pState); |
emilmont | 1:fdd22bb7aa52 | 3836 | |
emilmont | 1:fdd22bb7aa52 | 3837 | /** |
emilmont | 1:fdd22bb7aa52 | 3838 | * @brief Processing function for the floating-point FIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3839 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3840 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3841 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 3842 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3843 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3844 | */ |
emilmont | 1:fdd22bb7aa52 | 3845 | |
emilmont | 1:fdd22bb7aa52 | 3846 | void arm_fir_lattice_f32( |
emilmont | 1:fdd22bb7aa52 | 3847 | const arm_fir_lattice_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3848 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3849 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3850 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3851 | |
emilmont | 1:fdd22bb7aa52 | 3852 | /** |
emilmont | 1:fdd22bb7aa52 | 3853 | * @brief Instance structure for the Q15 IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3854 | */ |
emilmont | 1:fdd22bb7aa52 | 3855 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3856 | { |
emilmont | 1:fdd22bb7aa52 | 3857 | uint16_t numStages; /**< number of stages in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3858 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
emilmont | 1:fdd22bb7aa52 | 3859 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3860 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
emilmont | 1:fdd22bb7aa52 | 3861 | } arm_iir_lattice_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 3862 | |
emilmont | 1:fdd22bb7aa52 | 3863 | /** |
emilmont | 1:fdd22bb7aa52 | 3864 | * @brief Instance structure for the Q31 IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3865 | */ |
emilmont | 1:fdd22bb7aa52 | 3866 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3867 | { |
emilmont | 1:fdd22bb7aa52 | 3868 | uint16_t numStages; /**< number of stages in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3869 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
emilmont | 1:fdd22bb7aa52 | 3870 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3871 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
emilmont | 1:fdd22bb7aa52 | 3872 | } arm_iir_lattice_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 3873 | |
emilmont | 1:fdd22bb7aa52 | 3874 | /** |
emilmont | 1:fdd22bb7aa52 | 3875 | * @brief Instance structure for the floating-point IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3876 | */ |
emilmont | 1:fdd22bb7aa52 | 3877 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3878 | { |
emilmont | 1:fdd22bb7aa52 | 3879 | uint16_t numStages; /**< number of stages in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3880 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
emilmont | 1:fdd22bb7aa52 | 3881 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
emilmont | 1:fdd22bb7aa52 | 3882 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
emilmont | 1:fdd22bb7aa52 | 3883 | } arm_iir_lattice_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 3884 | |
emilmont | 1:fdd22bb7aa52 | 3885 | /** |
emilmont | 1:fdd22bb7aa52 | 3886 | * @brief Processing function for the floating-point IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3887 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3888 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3889 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3890 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3891 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3892 | */ |
emilmont | 1:fdd22bb7aa52 | 3893 | |
emilmont | 1:fdd22bb7aa52 | 3894 | void arm_iir_lattice_f32( |
emilmont | 1:fdd22bb7aa52 | 3895 | const arm_iir_lattice_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3896 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3897 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3898 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3899 | |
emilmont | 1:fdd22bb7aa52 | 3900 | /** |
emilmont | 1:fdd22bb7aa52 | 3901 | * @brief Initialization function for the floating-point IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3902 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3903 | * @param[in] numStages number of stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 3904 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3905 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
emilmont | 1:fdd22bb7aa52 | 3906 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1. |
emilmont | 1:fdd22bb7aa52 | 3907 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3908 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3909 | */ |
emilmont | 1:fdd22bb7aa52 | 3910 | |
emilmont | 1:fdd22bb7aa52 | 3911 | void arm_iir_lattice_init_f32( |
emilmont | 1:fdd22bb7aa52 | 3912 | arm_iir_lattice_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 3913 | uint16_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3914 | float32_t * pkCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3915 | float32_t * pvCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3916 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3917 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3918 | |
emilmont | 1:fdd22bb7aa52 | 3919 | |
emilmont | 1:fdd22bb7aa52 | 3920 | /** |
emilmont | 1:fdd22bb7aa52 | 3921 | * @brief Processing function for the Q31 IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3922 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3923 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3924 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3925 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3926 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3927 | */ |
emilmont | 1:fdd22bb7aa52 | 3928 | |
emilmont | 1:fdd22bb7aa52 | 3929 | void arm_iir_lattice_q31( |
emilmont | 1:fdd22bb7aa52 | 3930 | const arm_iir_lattice_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3931 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3932 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3933 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3934 | |
emilmont | 1:fdd22bb7aa52 | 3935 | |
emilmont | 1:fdd22bb7aa52 | 3936 | /** |
emilmont | 1:fdd22bb7aa52 | 3937 | * @brief Initialization function for the Q31 IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3938 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3939 | * @param[in] numStages number of stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 3940 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3941 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
emilmont | 1:fdd22bb7aa52 | 3942 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. |
emilmont | 1:fdd22bb7aa52 | 3943 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3944 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3945 | */ |
emilmont | 1:fdd22bb7aa52 | 3946 | |
emilmont | 1:fdd22bb7aa52 | 3947 | void arm_iir_lattice_init_q31( |
emilmont | 1:fdd22bb7aa52 | 3948 | arm_iir_lattice_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 3949 | uint16_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3950 | q31_t * pkCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3951 | q31_t * pvCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3952 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3953 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3954 | |
emilmont | 1:fdd22bb7aa52 | 3955 | |
emilmont | 1:fdd22bb7aa52 | 3956 | /** |
emilmont | 1:fdd22bb7aa52 | 3957 | * @brief Processing function for the Q15 IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3958 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3959 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 3960 | * @param[out] *pDst points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 3961 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 3962 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3963 | */ |
emilmont | 1:fdd22bb7aa52 | 3964 | |
emilmont | 1:fdd22bb7aa52 | 3965 | void arm_iir_lattice_q15( |
emilmont | 1:fdd22bb7aa52 | 3966 | const arm_iir_lattice_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3967 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 3968 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 3969 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3970 | |
emilmont | 1:fdd22bb7aa52 | 3971 | |
emilmont | 1:fdd22bb7aa52 | 3972 | /** |
emilmont | 1:fdd22bb7aa52 | 3973 | * @brief Initialization function for the Q15 IIR lattice filter. |
emilmont | 1:fdd22bb7aa52 | 3974 | * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure. |
emilmont | 1:fdd22bb7aa52 | 3975 | * @param[in] numStages number of stages in the filter. |
emilmont | 1:fdd22bb7aa52 | 3976 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. |
emilmont | 1:fdd22bb7aa52 | 3977 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. |
emilmont | 1:fdd22bb7aa52 | 3978 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. |
emilmont | 1:fdd22bb7aa52 | 3979 | * @param[in] blockSize number of samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 3980 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 3981 | */ |
emilmont | 1:fdd22bb7aa52 | 3982 | |
emilmont | 1:fdd22bb7aa52 | 3983 | void arm_iir_lattice_init_q15( |
emilmont | 1:fdd22bb7aa52 | 3984 | arm_iir_lattice_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 3985 | uint16_t numStages, |
emilmont | 1:fdd22bb7aa52 | 3986 | q15_t * pkCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3987 | q15_t * pvCoeffs, |
emilmont | 1:fdd22bb7aa52 | 3988 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 3989 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 3990 | |
emilmont | 1:fdd22bb7aa52 | 3991 | /** |
emilmont | 1:fdd22bb7aa52 | 3992 | * @brief Instance structure for the floating-point LMS filter. |
emilmont | 1:fdd22bb7aa52 | 3993 | */ |
emilmont | 1:fdd22bb7aa52 | 3994 | |
emilmont | 1:fdd22bb7aa52 | 3995 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 3996 | { |
emilmont | 1:fdd22bb7aa52 | 3997 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 3998 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 3999 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4000 | float32_t mu; /**< step size that controls filter coefficient updates. */ |
emilmont | 1:fdd22bb7aa52 | 4001 | } arm_lms_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 4002 | |
emilmont | 1:fdd22bb7aa52 | 4003 | /** |
emilmont | 1:fdd22bb7aa52 | 4004 | * @brief Processing function for floating-point LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4005 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4006 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4007 | * @param[in] *pRef points to the block of reference data. |
emilmont | 1:fdd22bb7aa52 | 4008 | * @param[out] *pOut points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 4009 | * @param[out] *pErr points to the block of error data. |
emilmont | 1:fdd22bb7aa52 | 4010 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4011 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4012 | */ |
emilmont | 1:fdd22bb7aa52 | 4013 | |
emilmont | 1:fdd22bb7aa52 | 4014 | void arm_lms_f32( |
emilmont | 1:fdd22bb7aa52 | 4015 | const arm_lms_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4016 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4017 | float32_t * pRef, |
emilmont | 1:fdd22bb7aa52 | 4018 | float32_t * pOut, |
emilmont | 1:fdd22bb7aa52 | 4019 | float32_t * pErr, |
emilmont | 1:fdd22bb7aa52 | 4020 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4021 | |
emilmont | 1:fdd22bb7aa52 | 4022 | /** |
emilmont | 1:fdd22bb7aa52 | 4023 | * @brief Initialization function for floating-point LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4024 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4025 | * @param[in] numTaps number of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4026 | * @param[in] *pCoeffs points to the coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 4027 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 4028 | * @param[in] mu step size that controls filter coefficient updates. |
emilmont | 1:fdd22bb7aa52 | 4029 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4030 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4031 | */ |
emilmont | 1:fdd22bb7aa52 | 4032 | |
emilmont | 1:fdd22bb7aa52 | 4033 | void arm_lms_init_f32( |
emilmont | 1:fdd22bb7aa52 | 4034 | arm_lms_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4035 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4036 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4037 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4038 | float32_t mu, |
emilmont | 1:fdd22bb7aa52 | 4039 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4040 | |
emilmont | 1:fdd22bb7aa52 | 4041 | /** |
emilmont | 1:fdd22bb7aa52 | 4042 | * @brief Instance structure for the Q15 LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4043 | */ |
emilmont | 1:fdd22bb7aa52 | 4044 | |
emilmont | 1:fdd22bb7aa52 | 4045 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4046 | { |
emilmont | 1:fdd22bb7aa52 | 4047 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4048 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4049 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4050 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
emilmont | 1:fdd22bb7aa52 | 4051 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
emilmont | 1:fdd22bb7aa52 | 4052 | } arm_lms_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 4053 | |
emilmont | 1:fdd22bb7aa52 | 4054 | |
emilmont | 1:fdd22bb7aa52 | 4055 | /** |
emilmont | 1:fdd22bb7aa52 | 4056 | * @brief Initialization function for the Q15 LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4057 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4058 | * @param[in] numTaps number of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4059 | * @param[in] *pCoeffs points to the coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 4060 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 4061 | * @param[in] mu step size that controls filter coefficient updates. |
emilmont | 1:fdd22bb7aa52 | 4062 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4063 | * @param[in] postShift bit shift applied to coefficients. |
emilmont | 1:fdd22bb7aa52 | 4064 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4065 | */ |
emilmont | 1:fdd22bb7aa52 | 4066 | |
emilmont | 1:fdd22bb7aa52 | 4067 | void arm_lms_init_q15( |
emilmont | 1:fdd22bb7aa52 | 4068 | arm_lms_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4069 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4070 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4071 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4072 | q15_t mu, |
emilmont | 1:fdd22bb7aa52 | 4073 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 4074 | uint32_t postShift); |
emilmont | 1:fdd22bb7aa52 | 4075 | |
emilmont | 1:fdd22bb7aa52 | 4076 | /** |
emilmont | 1:fdd22bb7aa52 | 4077 | * @brief Processing function for Q15 LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4078 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4079 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4080 | * @param[in] *pRef points to the block of reference data. |
emilmont | 1:fdd22bb7aa52 | 4081 | * @param[out] *pOut points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 4082 | * @param[out] *pErr points to the block of error data. |
emilmont | 1:fdd22bb7aa52 | 4083 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4084 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4085 | */ |
emilmont | 1:fdd22bb7aa52 | 4086 | |
emilmont | 1:fdd22bb7aa52 | 4087 | void arm_lms_q15( |
emilmont | 1:fdd22bb7aa52 | 4088 | const arm_lms_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4089 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4090 | q15_t * pRef, |
emilmont | 1:fdd22bb7aa52 | 4091 | q15_t * pOut, |
emilmont | 1:fdd22bb7aa52 | 4092 | q15_t * pErr, |
emilmont | 1:fdd22bb7aa52 | 4093 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4094 | |
emilmont | 1:fdd22bb7aa52 | 4095 | |
emilmont | 1:fdd22bb7aa52 | 4096 | /** |
emilmont | 1:fdd22bb7aa52 | 4097 | * @brief Instance structure for the Q31 LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4098 | */ |
emilmont | 1:fdd22bb7aa52 | 4099 | |
emilmont | 1:fdd22bb7aa52 | 4100 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4101 | { |
emilmont | 1:fdd22bb7aa52 | 4102 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4103 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4104 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4105 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
emilmont | 1:fdd22bb7aa52 | 4106 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
emilmont | 1:fdd22bb7aa52 | 4107 | |
emilmont | 1:fdd22bb7aa52 | 4108 | } arm_lms_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 4109 | |
emilmont | 1:fdd22bb7aa52 | 4110 | /** |
emilmont | 1:fdd22bb7aa52 | 4111 | * @brief Processing function for Q31 LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4112 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4113 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4114 | * @param[in] *pRef points to the block of reference data. |
emilmont | 1:fdd22bb7aa52 | 4115 | * @param[out] *pOut points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 4116 | * @param[out] *pErr points to the block of error data. |
emilmont | 1:fdd22bb7aa52 | 4117 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4118 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4119 | */ |
emilmont | 1:fdd22bb7aa52 | 4120 | |
emilmont | 1:fdd22bb7aa52 | 4121 | void arm_lms_q31( |
emilmont | 1:fdd22bb7aa52 | 4122 | const arm_lms_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4123 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4124 | q31_t * pRef, |
emilmont | 1:fdd22bb7aa52 | 4125 | q31_t * pOut, |
emilmont | 1:fdd22bb7aa52 | 4126 | q31_t * pErr, |
emilmont | 1:fdd22bb7aa52 | 4127 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4128 | |
emilmont | 1:fdd22bb7aa52 | 4129 | /** |
emilmont | 1:fdd22bb7aa52 | 4130 | * @brief Initialization function for Q31 LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4131 | * @param[in] *S points to an instance of the Q31 LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4132 | * @param[in] numTaps number of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4133 | * @param[in] *pCoeffs points to coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 4134 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 4135 | * @param[in] mu step size that controls filter coefficient updates. |
emilmont | 1:fdd22bb7aa52 | 4136 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4137 | * @param[in] postShift bit shift applied to coefficients. |
emilmont | 1:fdd22bb7aa52 | 4138 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4139 | */ |
emilmont | 1:fdd22bb7aa52 | 4140 | |
emilmont | 1:fdd22bb7aa52 | 4141 | void arm_lms_init_q31( |
emilmont | 1:fdd22bb7aa52 | 4142 | arm_lms_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4143 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4144 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4145 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4146 | q31_t mu, |
emilmont | 1:fdd22bb7aa52 | 4147 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 4148 | uint32_t postShift); |
emilmont | 1:fdd22bb7aa52 | 4149 | |
emilmont | 1:fdd22bb7aa52 | 4150 | /** |
emilmont | 1:fdd22bb7aa52 | 4151 | * @brief Instance structure for the floating-point normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4152 | */ |
emilmont | 1:fdd22bb7aa52 | 4153 | |
emilmont | 1:fdd22bb7aa52 | 4154 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4155 | { |
emilmont | 1:fdd22bb7aa52 | 4156 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4157 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4158 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4159 | float32_t mu; /**< step size that control filter coefficient updates. */ |
emilmont | 1:fdd22bb7aa52 | 4160 | float32_t energy; /**< saves previous frame energy. */ |
emilmont | 1:fdd22bb7aa52 | 4161 | float32_t x0; /**< saves previous input sample. */ |
emilmont | 1:fdd22bb7aa52 | 4162 | } arm_lms_norm_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 4163 | |
emilmont | 1:fdd22bb7aa52 | 4164 | /** |
emilmont | 1:fdd22bb7aa52 | 4165 | * @brief Processing function for floating-point normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4166 | * @param[in] *S points to an instance of the floating-point normalized LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4167 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4168 | * @param[in] *pRef points to the block of reference data. |
emilmont | 1:fdd22bb7aa52 | 4169 | * @param[out] *pOut points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 4170 | * @param[out] *pErr points to the block of error data. |
emilmont | 1:fdd22bb7aa52 | 4171 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4172 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4173 | */ |
emilmont | 1:fdd22bb7aa52 | 4174 | |
emilmont | 1:fdd22bb7aa52 | 4175 | void arm_lms_norm_f32( |
emilmont | 1:fdd22bb7aa52 | 4176 | arm_lms_norm_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4177 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4178 | float32_t * pRef, |
emilmont | 1:fdd22bb7aa52 | 4179 | float32_t * pOut, |
emilmont | 1:fdd22bb7aa52 | 4180 | float32_t * pErr, |
emilmont | 1:fdd22bb7aa52 | 4181 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4182 | |
emilmont | 1:fdd22bb7aa52 | 4183 | /** |
emilmont | 1:fdd22bb7aa52 | 4184 | * @brief Initialization function for floating-point normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4185 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4186 | * @param[in] numTaps number of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4187 | * @param[in] *pCoeffs points to coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 4188 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 4189 | * @param[in] mu step size that controls filter coefficient updates. |
emilmont | 1:fdd22bb7aa52 | 4190 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4191 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4192 | */ |
emilmont | 1:fdd22bb7aa52 | 4193 | |
emilmont | 1:fdd22bb7aa52 | 4194 | void arm_lms_norm_init_f32( |
emilmont | 1:fdd22bb7aa52 | 4195 | arm_lms_norm_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4196 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4197 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4198 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4199 | float32_t mu, |
emilmont | 1:fdd22bb7aa52 | 4200 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4201 | |
emilmont | 1:fdd22bb7aa52 | 4202 | |
emilmont | 1:fdd22bb7aa52 | 4203 | /** |
emilmont | 1:fdd22bb7aa52 | 4204 | * @brief Instance structure for the Q31 normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4205 | */ |
emilmont | 1:fdd22bb7aa52 | 4206 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4207 | { |
emilmont | 1:fdd22bb7aa52 | 4208 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4209 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4210 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4211 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
emilmont | 1:fdd22bb7aa52 | 4212 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
emilmont | 1:fdd22bb7aa52 | 4213 | q31_t *recipTable; /**< points to the reciprocal initial value table. */ |
emilmont | 1:fdd22bb7aa52 | 4214 | q31_t energy; /**< saves previous frame energy. */ |
emilmont | 1:fdd22bb7aa52 | 4215 | q31_t x0; /**< saves previous input sample. */ |
emilmont | 1:fdd22bb7aa52 | 4216 | } arm_lms_norm_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 4217 | |
emilmont | 1:fdd22bb7aa52 | 4218 | /** |
emilmont | 1:fdd22bb7aa52 | 4219 | * @brief Processing function for Q31 normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4220 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4221 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4222 | * @param[in] *pRef points to the block of reference data. |
emilmont | 1:fdd22bb7aa52 | 4223 | * @param[out] *pOut points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 4224 | * @param[out] *pErr points to the block of error data. |
emilmont | 1:fdd22bb7aa52 | 4225 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4226 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4227 | */ |
emilmont | 1:fdd22bb7aa52 | 4228 | |
emilmont | 1:fdd22bb7aa52 | 4229 | void arm_lms_norm_q31( |
emilmont | 1:fdd22bb7aa52 | 4230 | arm_lms_norm_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4231 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4232 | q31_t * pRef, |
emilmont | 1:fdd22bb7aa52 | 4233 | q31_t * pOut, |
emilmont | 1:fdd22bb7aa52 | 4234 | q31_t * pErr, |
emilmont | 1:fdd22bb7aa52 | 4235 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4236 | |
emilmont | 1:fdd22bb7aa52 | 4237 | /** |
emilmont | 1:fdd22bb7aa52 | 4238 | * @brief Initialization function for Q31 normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4239 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4240 | * @param[in] numTaps number of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4241 | * @param[in] *pCoeffs points to coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 4242 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 4243 | * @param[in] mu step size that controls filter coefficient updates. |
emilmont | 1:fdd22bb7aa52 | 4244 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4245 | * @param[in] postShift bit shift applied to coefficients. |
emilmont | 1:fdd22bb7aa52 | 4246 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4247 | */ |
emilmont | 1:fdd22bb7aa52 | 4248 | |
emilmont | 1:fdd22bb7aa52 | 4249 | void arm_lms_norm_init_q31( |
emilmont | 1:fdd22bb7aa52 | 4250 | arm_lms_norm_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4251 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4252 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4253 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4254 | q31_t mu, |
emilmont | 1:fdd22bb7aa52 | 4255 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 4256 | uint8_t postShift); |
emilmont | 1:fdd22bb7aa52 | 4257 | |
emilmont | 1:fdd22bb7aa52 | 4258 | /** |
emilmont | 1:fdd22bb7aa52 | 4259 | * @brief Instance structure for the Q15 normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4260 | */ |
emilmont | 1:fdd22bb7aa52 | 4261 | |
emilmont | 1:fdd22bb7aa52 | 4262 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4263 | { |
emilmont | 1:fdd22bb7aa52 | 4264 | uint16_t numTaps; /**< Number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4265 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4266 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4267 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
emilmont | 1:fdd22bb7aa52 | 4268 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
emilmont | 1:fdd22bb7aa52 | 4269 | q15_t *recipTable; /**< Points to the reciprocal initial value table. */ |
emilmont | 1:fdd22bb7aa52 | 4270 | q15_t energy; /**< saves previous frame energy. */ |
emilmont | 1:fdd22bb7aa52 | 4271 | q15_t x0; /**< saves previous input sample. */ |
emilmont | 1:fdd22bb7aa52 | 4272 | } arm_lms_norm_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 4273 | |
emilmont | 1:fdd22bb7aa52 | 4274 | /** |
emilmont | 1:fdd22bb7aa52 | 4275 | * @brief Processing function for Q15 normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4276 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4277 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4278 | * @param[in] *pRef points to the block of reference data. |
emilmont | 1:fdd22bb7aa52 | 4279 | * @param[out] *pOut points to the block of output data. |
emilmont | 1:fdd22bb7aa52 | 4280 | * @param[out] *pErr points to the block of error data. |
emilmont | 1:fdd22bb7aa52 | 4281 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4282 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4283 | */ |
emilmont | 1:fdd22bb7aa52 | 4284 | |
emilmont | 1:fdd22bb7aa52 | 4285 | void arm_lms_norm_q15( |
emilmont | 1:fdd22bb7aa52 | 4286 | arm_lms_norm_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4287 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4288 | q15_t * pRef, |
emilmont | 1:fdd22bb7aa52 | 4289 | q15_t * pOut, |
emilmont | 1:fdd22bb7aa52 | 4290 | q15_t * pErr, |
emilmont | 1:fdd22bb7aa52 | 4291 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4292 | |
emilmont | 1:fdd22bb7aa52 | 4293 | |
emilmont | 1:fdd22bb7aa52 | 4294 | /** |
emilmont | 1:fdd22bb7aa52 | 4295 | * @brief Initialization function for Q15 normalized LMS filter. |
emilmont | 1:fdd22bb7aa52 | 4296 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
emilmont | 1:fdd22bb7aa52 | 4297 | * @param[in] numTaps number of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4298 | * @param[in] *pCoeffs points to coefficient buffer. |
emilmont | 1:fdd22bb7aa52 | 4299 | * @param[in] *pState points to state buffer. |
emilmont | 1:fdd22bb7aa52 | 4300 | * @param[in] mu step size that controls filter coefficient updates. |
emilmont | 1:fdd22bb7aa52 | 4301 | * @param[in] blockSize number of samples to process. |
emilmont | 1:fdd22bb7aa52 | 4302 | * @param[in] postShift bit shift applied to coefficients. |
emilmont | 1:fdd22bb7aa52 | 4303 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4304 | */ |
emilmont | 1:fdd22bb7aa52 | 4305 | |
emilmont | 1:fdd22bb7aa52 | 4306 | void arm_lms_norm_init_q15( |
emilmont | 1:fdd22bb7aa52 | 4307 | arm_lms_norm_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4308 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4309 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4310 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4311 | q15_t mu, |
emilmont | 1:fdd22bb7aa52 | 4312 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 4313 | uint8_t postShift); |
emilmont | 1:fdd22bb7aa52 | 4314 | |
emilmont | 1:fdd22bb7aa52 | 4315 | /** |
emilmont | 1:fdd22bb7aa52 | 4316 | * @brief Correlation of floating-point sequences. |
emilmont | 1:fdd22bb7aa52 | 4317 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4318 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4319 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4320 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4321 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emilmont | 1:fdd22bb7aa52 | 4322 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4323 | */ |
emilmont | 1:fdd22bb7aa52 | 4324 | |
emilmont | 1:fdd22bb7aa52 | 4325 | void arm_correlate_f32( |
emilmont | 1:fdd22bb7aa52 | 4326 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4327 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4328 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4329 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4330 | float32_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 4331 | |
emilmont | 1:fdd22bb7aa52 | 4332 | |
mbed_official | 3:7a284390b0ce | 4333 | /** |
mbed_official | 3:7a284390b0ce | 4334 | * @brief Correlation of Q15 sequences |
mbed_official | 3:7a284390b0ce | 4335 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 4336 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 4337 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 4338 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 4339 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mbed_official | 3:7a284390b0ce | 4340 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 4341 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4342 | */ |
emilmont | 1:fdd22bb7aa52 | 4343 | void arm_correlate_opt_q15( |
emilmont | 1:fdd22bb7aa52 | 4344 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4345 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4346 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4347 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4348 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4349 | q15_t * pScratch); |
emilmont | 1:fdd22bb7aa52 | 4350 | |
emilmont | 1:fdd22bb7aa52 | 4351 | |
emilmont | 1:fdd22bb7aa52 | 4352 | /** |
emilmont | 1:fdd22bb7aa52 | 4353 | * @brief Correlation of Q15 sequences. |
emilmont | 1:fdd22bb7aa52 | 4354 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4355 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4356 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4357 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4358 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emilmont | 1:fdd22bb7aa52 | 4359 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4360 | */ |
emilmont | 1:fdd22bb7aa52 | 4361 | |
emilmont | 1:fdd22bb7aa52 | 4362 | void arm_correlate_q15( |
emilmont | 1:fdd22bb7aa52 | 4363 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4364 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4365 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4366 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4367 | q15_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 4368 | |
emilmont | 1:fdd22bb7aa52 | 4369 | /** |
emilmont | 1:fdd22bb7aa52 | 4370 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 4371 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4372 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4373 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4374 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4375 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emilmont | 1:fdd22bb7aa52 | 4376 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4377 | */ |
emilmont | 1:fdd22bb7aa52 | 4378 | |
emilmont | 1:fdd22bb7aa52 | 4379 | void arm_correlate_fast_q15( |
emilmont | 2:da51fb522205 | 4380 | q15_t * pSrcA, |
emilmont | 2:da51fb522205 | 4381 | uint32_t srcALen, |
emilmont | 2:da51fb522205 | 4382 | q15_t * pSrcB, |
emilmont | 2:da51fb522205 | 4383 | uint32_t srcBLen, |
emilmont | 2:da51fb522205 | 4384 | q15_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 4385 | |
emilmont | 1:fdd22bb7aa52 | 4386 | |
emilmont | 1:fdd22bb7aa52 | 4387 | |
emilmont | 1:fdd22bb7aa52 | 4388 | /** |
emilmont | 1:fdd22bb7aa52 | 4389 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
emilmont | 1:fdd22bb7aa52 | 4390 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4391 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4392 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4393 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4394 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mbed_official | 3:7a284390b0ce | 4395 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
emilmont | 1:fdd22bb7aa52 | 4396 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4397 | */ |
emilmont | 1:fdd22bb7aa52 | 4398 | |
emilmont | 1:fdd22bb7aa52 | 4399 | void arm_correlate_fast_opt_q15( |
emilmont | 1:fdd22bb7aa52 | 4400 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4401 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4402 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4403 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4404 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4405 | q15_t * pScratch); |
emilmont | 1:fdd22bb7aa52 | 4406 | |
emilmont | 1:fdd22bb7aa52 | 4407 | /** |
emilmont | 1:fdd22bb7aa52 | 4408 | * @brief Correlation of Q31 sequences. |
emilmont | 1:fdd22bb7aa52 | 4409 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4410 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4411 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4412 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4413 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emilmont | 1:fdd22bb7aa52 | 4414 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4415 | */ |
emilmont | 1:fdd22bb7aa52 | 4416 | |
emilmont | 1:fdd22bb7aa52 | 4417 | void arm_correlate_q31( |
emilmont | 1:fdd22bb7aa52 | 4418 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4419 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4420 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4421 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4422 | q31_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 4423 | |
emilmont | 1:fdd22bb7aa52 | 4424 | /** |
emilmont | 1:fdd22bb7aa52 | 4425 | * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
emilmont | 1:fdd22bb7aa52 | 4426 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4427 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4428 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4429 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4430 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emilmont | 1:fdd22bb7aa52 | 4431 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4432 | */ |
emilmont | 1:fdd22bb7aa52 | 4433 | |
emilmont | 1:fdd22bb7aa52 | 4434 | void arm_correlate_fast_q31( |
emilmont | 1:fdd22bb7aa52 | 4435 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4436 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4437 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4438 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4439 | q31_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 4440 | |
emilmont | 1:fdd22bb7aa52 | 4441 | |
emilmont | 1:fdd22bb7aa52 | 4442 | |
mbed_official | 3:7a284390b0ce | 4443 | /** |
mbed_official | 3:7a284390b0ce | 4444 | * @brief Correlation of Q7 sequences. |
mbed_official | 3:7a284390b0ce | 4445 | * @param[in] *pSrcA points to the first input sequence. |
mbed_official | 3:7a284390b0ce | 4446 | * @param[in] srcALen length of the first input sequence. |
mbed_official | 3:7a284390b0ce | 4447 | * @param[in] *pSrcB points to the second input sequence. |
mbed_official | 3:7a284390b0ce | 4448 | * @param[in] srcBLen length of the second input sequence. |
mbed_official | 3:7a284390b0ce | 4449 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mbed_official | 3:7a284390b0ce | 4450 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mbed_official | 3:7a284390b0ce | 4451 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
mbed_official | 3:7a284390b0ce | 4452 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4453 | */ |
emilmont | 1:fdd22bb7aa52 | 4454 | |
emilmont | 1:fdd22bb7aa52 | 4455 | void arm_correlate_opt_q7( |
emilmont | 1:fdd22bb7aa52 | 4456 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4457 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4458 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4459 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4460 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4461 | q15_t * pScratch1, |
emilmont | 1:fdd22bb7aa52 | 4462 | q15_t * pScratch2); |
emilmont | 1:fdd22bb7aa52 | 4463 | |
emilmont | 1:fdd22bb7aa52 | 4464 | |
emilmont | 1:fdd22bb7aa52 | 4465 | /** |
emilmont | 1:fdd22bb7aa52 | 4466 | * @brief Correlation of Q7 sequences. |
emilmont | 1:fdd22bb7aa52 | 4467 | * @param[in] *pSrcA points to the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4468 | * @param[in] srcALen length of the first input sequence. |
emilmont | 1:fdd22bb7aa52 | 4469 | * @param[in] *pSrcB points to the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4470 | * @param[in] srcBLen length of the second input sequence. |
emilmont | 1:fdd22bb7aa52 | 4471 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
emilmont | 1:fdd22bb7aa52 | 4472 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4473 | */ |
emilmont | 1:fdd22bb7aa52 | 4474 | |
emilmont | 1:fdd22bb7aa52 | 4475 | void arm_correlate_q7( |
emilmont | 1:fdd22bb7aa52 | 4476 | q7_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 4477 | uint32_t srcALen, |
emilmont | 1:fdd22bb7aa52 | 4478 | q7_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 4479 | uint32_t srcBLen, |
emilmont | 1:fdd22bb7aa52 | 4480 | q7_t * pDst); |
emilmont | 1:fdd22bb7aa52 | 4481 | |
emilmont | 1:fdd22bb7aa52 | 4482 | |
emilmont | 1:fdd22bb7aa52 | 4483 | /** |
emilmont | 1:fdd22bb7aa52 | 4484 | * @brief Instance structure for the floating-point sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4485 | */ |
emilmont | 1:fdd22bb7aa52 | 4486 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4487 | { |
emilmont | 1:fdd22bb7aa52 | 4488 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4489 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emilmont | 1:fdd22bb7aa52 | 4490 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4491 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 4492 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emilmont | 1:fdd22bb7aa52 | 4493 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4494 | } arm_fir_sparse_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 4495 | |
emilmont | 1:fdd22bb7aa52 | 4496 | /** |
emilmont | 1:fdd22bb7aa52 | 4497 | * @brief Instance structure for the Q31 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4498 | */ |
emilmont | 1:fdd22bb7aa52 | 4499 | |
emilmont | 1:fdd22bb7aa52 | 4500 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4501 | { |
emilmont | 1:fdd22bb7aa52 | 4502 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4503 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emilmont | 1:fdd22bb7aa52 | 4504 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4505 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 4506 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emilmont | 1:fdd22bb7aa52 | 4507 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4508 | } arm_fir_sparse_instance_q31; |
emilmont | 1:fdd22bb7aa52 | 4509 | |
emilmont | 1:fdd22bb7aa52 | 4510 | /** |
emilmont | 1:fdd22bb7aa52 | 4511 | * @brief Instance structure for the Q15 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4512 | */ |
emilmont | 1:fdd22bb7aa52 | 4513 | |
emilmont | 1:fdd22bb7aa52 | 4514 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4515 | { |
emilmont | 1:fdd22bb7aa52 | 4516 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4517 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emilmont | 1:fdd22bb7aa52 | 4518 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4519 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 4520 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emilmont | 1:fdd22bb7aa52 | 4521 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4522 | } arm_fir_sparse_instance_q15; |
emilmont | 1:fdd22bb7aa52 | 4523 | |
emilmont | 1:fdd22bb7aa52 | 4524 | /** |
emilmont | 1:fdd22bb7aa52 | 4525 | * @brief Instance structure for the Q7 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4526 | */ |
emilmont | 1:fdd22bb7aa52 | 4527 | |
emilmont | 1:fdd22bb7aa52 | 4528 | typedef struct |
emilmont | 1:fdd22bb7aa52 | 4529 | { |
emilmont | 1:fdd22bb7aa52 | 4530 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
emilmont | 1:fdd22bb7aa52 | 4531 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
emilmont | 1:fdd22bb7aa52 | 4532 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
emilmont | 1:fdd22bb7aa52 | 4533 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
emilmont | 1:fdd22bb7aa52 | 4534 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
emilmont | 1:fdd22bb7aa52 | 4535 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
emilmont | 1:fdd22bb7aa52 | 4536 | } arm_fir_sparse_instance_q7; |
emilmont | 1:fdd22bb7aa52 | 4537 | |
emilmont | 1:fdd22bb7aa52 | 4538 | /** |
emilmont | 1:fdd22bb7aa52 | 4539 | * @brief Processing function for the floating-point sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4540 | * @param[in] *S points to an instance of the floating-point sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4541 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4542 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 4543 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emilmont | 1:fdd22bb7aa52 | 4544 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 4545 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4546 | */ |
emilmont | 1:fdd22bb7aa52 | 4547 | |
emilmont | 1:fdd22bb7aa52 | 4548 | void arm_fir_sparse_f32( |
emilmont | 1:fdd22bb7aa52 | 4549 | arm_fir_sparse_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4550 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4551 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4552 | float32_t * pScratchIn, |
emilmont | 1:fdd22bb7aa52 | 4553 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4554 | |
emilmont | 1:fdd22bb7aa52 | 4555 | /** |
emilmont | 1:fdd22bb7aa52 | 4556 | * @brief Initialization function for the floating-point sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4557 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4558 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 4559 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4560 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 4561 | * @param[in] *pTapDelay points to the array of offset times. |
emilmont | 1:fdd22bb7aa52 | 4562 | * @param[in] maxDelay maximum offset time supported. |
emilmont | 1:fdd22bb7aa52 | 4563 | * @param[in] blockSize number of samples that will be processed per block. |
emilmont | 1:fdd22bb7aa52 | 4564 | * @return none |
emilmont | 1:fdd22bb7aa52 | 4565 | */ |
emilmont | 1:fdd22bb7aa52 | 4566 | |
emilmont | 1:fdd22bb7aa52 | 4567 | void arm_fir_sparse_init_f32( |
emilmont | 1:fdd22bb7aa52 | 4568 | arm_fir_sparse_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4569 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4570 | float32_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4571 | float32_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4572 | int32_t * pTapDelay, |
emilmont | 1:fdd22bb7aa52 | 4573 | uint16_t maxDelay, |
emilmont | 1:fdd22bb7aa52 | 4574 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4575 | |
emilmont | 1:fdd22bb7aa52 | 4576 | /** |
emilmont | 1:fdd22bb7aa52 | 4577 | * @brief Processing function for the Q31 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4578 | * @param[in] *S points to an instance of the Q31 sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4579 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4580 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 4581 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emilmont | 1:fdd22bb7aa52 | 4582 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 4583 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4584 | */ |
emilmont | 1:fdd22bb7aa52 | 4585 | |
emilmont | 1:fdd22bb7aa52 | 4586 | void arm_fir_sparse_q31( |
emilmont | 1:fdd22bb7aa52 | 4587 | arm_fir_sparse_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4588 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4589 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4590 | q31_t * pScratchIn, |
emilmont | 1:fdd22bb7aa52 | 4591 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4592 | |
emilmont | 1:fdd22bb7aa52 | 4593 | /** |
emilmont | 1:fdd22bb7aa52 | 4594 | * @brief Initialization function for the Q31 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4595 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4596 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 4597 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4598 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 4599 | * @param[in] *pTapDelay points to the array of offset times. |
emilmont | 1:fdd22bb7aa52 | 4600 | * @param[in] maxDelay maximum offset time supported. |
emilmont | 1:fdd22bb7aa52 | 4601 | * @param[in] blockSize number of samples that will be processed per block. |
emilmont | 1:fdd22bb7aa52 | 4602 | * @return none |
emilmont | 1:fdd22bb7aa52 | 4603 | */ |
emilmont | 1:fdd22bb7aa52 | 4604 | |
emilmont | 1:fdd22bb7aa52 | 4605 | void arm_fir_sparse_init_q31( |
emilmont | 1:fdd22bb7aa52 | 4606 | arm_fir_sparse_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4607 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4608 | q31_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4609 | q31_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4610 | int32_t * pTapDelay, |
emilmont | 1:fdd22bb7aa52 | 4611 | uint16_t maxDelay, |
emilmont | 1:fdd22bb7aa52 | 4612 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4613 | |
emilmont | 1:fdd22bb7aa52 | 4614 | /** |
emilmont | 1:fdd22bb7aa52 | 4615 | * @brief Processing function for the Q15 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4616 | * @param[in] *S points to an instance of the Q15 sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4617 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4618 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 4619 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emilmont | 1:fdd22bb7aa52 | 4620 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
emilmont | 1:fdd22bb7aa52 | 4621 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 4622 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4623 | */ |
emilmont | 1:fdd22bb7aa52 | 4624 | |
emilmont | 1:fdd22bb7aa52 | 4625 | void arm_fir_sparse_q15( |
emilmont | 1:fdd22bb7aa52 | 4626 | arm_fir_sparse_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4627 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4628 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4629 | q15_t * pScratchIn, |
emilmont | 1:fdd22bb7aa52 | 4630 | q31_t * pScratchOut, |
emilmont | 1:fdd22bb7aa52 | 4631 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4632 | |
emilmont | 1:fdd22bb7aa52 | 4633 | |
emilmont | 1:fdd22bb7aa52 | 4634 | /** |
emilmont | 1:fdd22bb7aa52 | 4635 | * @brief Initialization function for the Q15 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4636 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4637 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 4638 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4639 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 4640 | * @param[in] *pTapDelay points to the array of offset times. |
emilmont | 1:fdd22bb7aa52 | 4641 | * @param[in] maxDelay maximum offset time supported. |
emilmont | 1:fdd22bb7aa52 | 4642 | * @param[in] blockSize number of samples that will be processed per block. |
emilmont | 1:fdd22bb7aa52 | 4643 | * @return none |
emilmont | 1:fdd22bb7aa52 | 4644 | */ |
emilmont | 1:fdd22bb7aa52 | 4645 | |
emilmont | 1:fdd22bb7aa52 | 4646 | void arm_fir_sparse_init_q15( |
emilmont | 1:fdd22bb7aa52 | 4647 | arm_fir_sparse_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4648 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4649 | q15_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4650 | q15_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4651 | int32_t * pTapDelay, |
emilmont | 1:fdd22bb7aa52 | 4652 | uint16_t maxDelay, |
emilmont | 1:fdd22bb7aa52 | 4653 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4654 | |
emilmont | 1:fdd22bb7aa52 | 4655 | /** |
emilmont | 1:fdd22bb7aa52 | 4656 | * @brief Processing function for the Q7 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4657 | * @param[in] *S points to an instance of the Q7 sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4658 | * @param[in] *pSrc points to the block of input data. |
emilmont | 1:fdd22bb7aa52 | 4659 | * @param[out] *pDst points to the block of output data |
emilmont | 1:fdd22bb7aa52 | 4660 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
emilmont | 1:fdd22bb7aa52 | 4661 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
emilmont | 1:fdd22bb7aa52 | 4662 | * @param[in] blockSize number of input samples to process per call. |
emilmont | 1:fdd22bb7aa52 | 4663 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4664 | */ |
emilmont | 1:fdd22bb7aa52 | 4665 | |
emilmont | 1:fdd22bb7aa52 | 4666 | void arm_fir_sparse_q7( |
emilmont | 1:fdd22bb7aa52 | 4667 | arm_fir_sparse_instance_q7 * S, |
emilmont | 1:fdd22bb7aa52 | 4668 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4669 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4670 | q7_t * pScratchIn, |
emilmont | 1:fdd22bb7aa52 | 4671 | q31_t * pScratchOut, |
emilmont | 1:fdd22bb7aa52 | 4672 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4673 | |
emilmont | 1:fdd22bb7aa52 | 4674 | /** |
emilmont | 1:fdd22bb7aa52 | 4675 | * @brief Initialization function for the Q7 sparse FIR filter. |
emilmont | 1:fdd22bb7aa52 | 4676 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. |
emilmont | 1:fdd22bb7aa52 | 4677 | * @param[in] numTaps number of nonzero coefficients in the filter. |
emilmont | 1:fdd22bb7aa52 | 4678 | * @param[in] *pCoeffs points to the array of filter coefficients. |
emilmont | 1:fdd22bb7aa52 | 4679 | * @param[in] *pState points to the state buffer. |
emilmont | 1:fdd22bb7aa52 | 4680 | * @param[in] *pTapDelay points to the array of offset times. |
emilmont | 1:fdd22bb7aa52 | 4681 | * @param[in] maxDelay maximum offset time supported. |
emilmont | 1:fdd22bb7aa52 | 4682 | * @param[in] blockSize number of samples that will be processed per block. |
emilmont | 1:fdd22bb7aa52 | 4683 | * @return none |
emilmont | 1:fdd22bb7aa52 | 4684 | */ |
emilmont | 1:fdd22bb7aa52 | 4685 | |
emilmont | 1:fdd22bb7aa52 | 4686 | void arm_fir_sparse_init_q7( |
emilmont | 1:fdd22bb7aa52 | 4687 | arm_fir_sparse_instance_q7 * S, |
emilmont | 1:fdd22bb7aa52 | 4688 | uint16_t numTaps, |
emilmont | 1:fdd22bb7aa52 | 4689 | q7_t * pCoeffs, |
emilmont | 1:fdd22bb7aa52 | 4690 | q7_t * pState, |
emilmont | 1:fdd22bb7aa52 | 4691 | int32_t * pTapDelay, |
emilmont | 1:fdd22bb7aa52 | 4692 | uint16_t maxDelay, |
emilmont | 1:fdd22bb7aa52 | 4693 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 4694 | |
emilmont | 1:fdd22bb7aa52 | 4695 | |
emilmont | 1:fdd22bb7aa52 | 4696 | /* |
emilmont | 1:fdd22bb7aa52 | 4697 | * @brief Floating-point sin_cos function. |
mbed_official | 3:7a284390b0ce | 4698 | * @param[in] theta input value in degrees |
mbed_official | 3:7a284390b0ce | 4699 | * @param[out] *pSinVal points to the processed sine output. |
mbed_official | 3:7a284390b0ce | 4700 | * @param[out] *pCosVal points to the processed cos output. |
emilmont | 1:fdd22bb7aa52 | 4701 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4702 | */ |
emilmont | 1:fdd22bb7aa52 | 4703 | |
emilmont | 1:fdd22bb7aa52 | 4704 | void arm_sin_cos_f32( |
emilmont | 1:fdd22bb7aa52 | 4705 | float32_t theta, |
emilmont | 1:fdd22bb7aa52 | 4706 | float32_t * pSinVal, |
emilmont | 1:fdd22bb7aa52 | 4707 | float32_t * pCcosVal); |
emilmont | 1:fdd22bb7aa52 | 4708 | |
emilmont | 1:fdd22bb7aa52 | 4709 | /* |
emilmont | 1:fdd22bb7aa52 | 4710 | * @brief Q31 sin_cos function. |
mbed_official | 3:7a284390b0ce | 4711 | * @param[in] theta scaled input value in degrees |
mbed_official | 3:7a284390b0ce | 4712 | * @param[out] *pSinVal points to the processed sine output. |
mbed_official | 3:7a284390b0ce | 4713 | * @param[out] *pCosVal points to the processed cosine output. |
emilmont | 1:fdd22bb7aa52 | 4714 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4715 | */ |
emilmont | 1:fdd22bb7aa52 | 4716 | |
emilmont | 1:fdd22bb7aa52 | 4717 | void arm_sin_cos_q31( |
emilmont | 1:fdd22bb7aa52 | 4718 | q31_t theta, |
emilmont | 1:fdd22bb7aa52 | 4719 | q31_t * pSinVal, |
emilmont | 1:fdd22bb7aa52 | 4720 | q31_t * pCosVal); |
emilmont | 1:fdd22bb7aa52 | 4721 | |
emilmont | 1:fdd22bb7aa52 | 4722 | |
emilmont | 1:fdd22bb7aa52 | 4723 | /** |
emilmont | 1:fdd22bb7aa52 | 4724 | * @brief Floating-point complex conjugate. |
emilmont | 1:fdd22bb7aa52 | 4725 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 4726 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 4727 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 4728 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4729 | */ |
emilmont | 1:fdd22bb7aa52 | 4730 | |
emilmont | 1:fdd22bb7aa52 | 4731 | void arm_cmplx_conj_f32( |
emilmont | 1:fdd22bb7aa52 | 4732 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4733 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4734 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 4735 | |
emilmont | 1:fdd22bb7aa52 | 4736 | /** |
emilmont | 1:fdd22bb7aa52 | 4737 | * @brief Q31 complex conjugate. |
emilmont | 1:fdd22bb7aa52 | 4738 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 4739 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 4740 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 4741 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4742 | */ |
emilmont | 1:fdd22bb7aa52 | 4743 | |
emilmont | 1:fdd22bb7aa52 | 4744 | void arm_cmplx_conj_q31( |
emilmont | 1:fdd22bb7aa52 | 4745 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4746 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4747 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 4748 | |
emilmont | 1:fdd22bb7aa52 | 4749 | /** |
emilmont | 1:fdd22bb7aa52 | 4750 | * @brief Q15 complex conjugate. |
emilmont | 1:fdd22bb7aa52 | 4751 | * @param[in] *pSrc points to the input vector |
emilmont | 1:fdd22bb7aa52 | 4752 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 4753 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 4754 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4755 | */ |
emilmont | 1:fdd22bb7aa52 | 4756 | |
emilmont | 1:fdd22bb7aa52 | 4757 | void arm_cmplx_conj_q15( |
emilmont | 1:fdd22bb7aa52 | 4758 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4759 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4760 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 4761 | |
emilmont | 1:fdd22bb7aa52 | 4762 | |
emilmont | 1:fdd22bb7aa52 | 4763 | |
emilmont | 1:fdd22bb7aa52 | 4764 | /** |
emilmont | 1:fdd22bb7aa52 | 4765 | * @brief Floating-point complex magnitude squared |
emilmont | 1:fdd22bb7aa52 | 4766 | * @param[in] *pSrc points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 4767 | * @param[out] *pDst points to the real output vector |
emilmont | 1:fdd22bb7aa52 | 4768 | * @param[in] numSamples number of complex samples in the input vector |
emilmont | 1:fdd22bb7aa52 | 4769 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4770 | */ |
emilmont | 1:fdd22bb7aa52 | 4771 | |
emilmont | 1:fdd22bb7aa52 | 4772 | void arm_cmplx_mag_squared_f32( |
emilmont | 1:fdd22bb7aa52 | 4773 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4774 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4775 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 4776 | |
emilmont | 1:fdd22bb7aa52 | 4777 | /** |
emilmont | 1:fdd22bb7aa52 | 4778 | * @brief Q31 complex magnitude squared |
emilmont | 1:fdd22bb7aa52 | 4779 | * @param[in] *pSrc points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 4780 | * @param[out] *pDst points to the real output vector |
emilmont | 1:fdd22bb7aa52 | 4781 | * @param[in] numSamples number of complex samples in the input vector |
emilmont | 1:fdd22bb7aa52 | 4782 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4783 | */ |
emilmont | 1:fdd22bb7aa52 | 4784 | |
emilmont | 1:fdd22bb7aa52 | 4785 | void arm_cmplx_mag_squared_q31( |
emilmont | 1:fdd22bb7aa52 | 4786 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4787 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4788 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 4789 | |
emilmont | 1:fdd22bb7aa52 | 4790 | /** |
emilmont | 1:fdd22bb7aa52 | 4791 | * @brief Q15 complex magnitude squared |
emilmont | 1:fdd22bb7aa52 | 4792 | * @param[in] *pSrc points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 4793 | * @param[out] *pDst points to the real output vector |
emilmont | 1:fdd22bb7aa52 | 4794 | * @param[in] numSamples number of complex samples in the input vector |
emilmont | 1:fdd22bb7aa52 | 4795 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 4796 | */ |
emilmont | 1:fdd22bb7aa52 | 4797 | |
emilmont | 1:fdd22bb7aa52 | 4798 | void arm_cmplx_mag_squared_q15( |
emilmont | 1:fdd22bb7aa52 | 4799 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 4800 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 4801 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 4802 | |
emilmont | 1:fdd22bb7aa52 | 4803 | |
emilmont | 1:fdd22bb7aa52 | 4804 | /** |
emilmont | 1:fdd22bb7aa52 | 4805 | * @ingroup groupController |
emilmont | 1:fdd22bb7aa52 | 4806 | */ |
emilmont | 1:fdd22bb7aa52 | 4807 | |
emilmont | 1:fdd22bb7aa52 | 4808 | /** |
emilmont | 1:fdd22bb7aa52 | 4809 | * @defgroup PID PID Motor Control |
emilmont | 1:fdd22bb7aa52 | 4810 | * |
mbed_official | 3:7a284390b0ce | 4811 | * A Proportional Integral Derivative (PID) controller is a generic feedback control |
emilmont | 1:fdd22bb7aa52 | 4812 | * loop mechanism widely used in industrial control systems. |
emilmont | 1:fdd22bb7aa52 | 4813 | * A PID controller is the most commonly used type of feedback controller. |
emilmont | 1:fdd22bb7aa52 | 4814 | * |
emilmont | 1:fdd22bb7aa52 | 4815 | * This set of functions implements (PID) controllers |
emilmont | 1:fdd22bb7aa52 | 4816 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample |
emilmont | 1:fdd22bb7aa52 | 4817 | * of data and each call to the function returns a single processed value. |
emilmont | 1:fdd22bb7aa52 | 4818 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code> |
emilmont | 1:fdd22bb7aa52 | 4819 | * is the input sample value. The functions return the output value. |
emilmont | 1:fdd22bb7aa52 | 4820 | * |
emilmont | 1:fdd22bb7aa52 | 4821 | * \par Algorithm: |
emilmont | 1:fdd22bb7aa52 | 4822 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 4823 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] |
emilmont | 1:fdd22bb7aa52 | 4824 | * A0 = Kp + Ki + Kd |
emilmont | 1:fdd22bb7aa52 | 4825 | * A1 = (-Kp ) - (2 * Kd ) |
emilmont | 1:fdd22bb7aa52 | 4826 | * A2 = Kd </pre> |
emilmont | 1:fdd22bb7aa52 | 4827 | * |
emilmont | 1:fdd22bb7aa52 | 4828 | * \par |
emilmont | 1:fdd22bb7aa52 | 4829 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant |
mbed_official | 3:7a284390b0ce | 4830 | * |
mbed_official | 3:7a284390b0ce | 4831 | * \par |
mbed_official | 3:7a284390b0ce | 4832 | * \image html PID.gif "Proportional Integral Derivative Controller" |
emilmont | 1:fdd22bb7aa52 | 4833 | * |
emilmont | 1:fdd22bb7aa52 | 4834 | * \par |
emilmont | 1:fdd22bb7aa52 | 4835 | * The PID controller calculates an "error" value as the difference between |
emilmont | 1:fdd22bb7aa52 | 4836 | * the measured output and the reference input. |
mbed_official | 3:7a284390b0ce | 4837 | * The controller attempts to minimize the error by adjusting the process control inputs. |
mbed_official | 3:7a284390b0ce | 4838 | * The proportional value determines the reaction to the current error, |
mbed_official | 3:7a284390b0ce | 4839 | * the integral value determines the reaction based on the sum of recent errors, |
emilmont | 1:fdd22bb7aa52 | 4840 | * and the derivative value determines the reaction based on the rate at which the error has been changing. |
emilmont | 1:fdd22bb7aa52 | 4841 | * |
mbed_official | 3:7a284390b0ce | 4842 | * \par Instance Structure |
mbed_official | 3:7a284390b0ce | 4843 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. |
mbed_official | 3:7a284390b0ce | 4844 | * A separate instance structure must be defined for each PID Controller. |
mbed_official | 3:7a284390b0ce | 4845 | * There are separate instance structure declarations for each of the 3 supported data types. |
mbed_official | 3:7a284390b0ce | 4846 | * |
mbed_official | 3:7a284390b0ce | 4847 | * \par Reset Functions |
mbed_official | 3:7a284390b0ce | 4848 | * There is also an associated reset function for each data type which clears the state array. |
emilmont | 1:fdd22bb7aa52 | 4849 | * |
mbed_official | 3:7a284390b0ce | 4850 | * \par Initialization Functions |
mbed_official | 3:7a284390b0ce | 4851 | * There is also an associated initialization function for each data type. |
mbed_official | 3:7a284390b0ce | 4852 | * The initialization function performs the following operations: |
emilmont | 1:fdd22bb7aa52 | 4853 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. |
mbed_official | 3:7a284390b0ce | 4854 | * - Zeros out the values in the state buffer. |
mbed_official | 3:7a284390b0ce | 4855 | * |
mbed_official | 3:7a284390b0ce | 4856 | * \par |
mbed_official | 3:7a284390b0ce | 4857 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. |
emilmont | 1:fdd22bb7aa52 | 4858 | * |
mbed_official | 3:7a284390b0ce | 4859 | * \par Fixed-Point Behavior |
mbed_official | 3:7a284390b0ce | 4860 | * Care must be taken when using the fixed-point versions of the PID Controller functions. |
mbed_official | 3:7a284390b0ce | 4861 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. |
mbed_official | 3:7a284390b0ce | 4862 | * Refer to the function specific documentation below for usage guidelines. |
emilmont | 1:fdd22bb7aa52 | 4863 | */ |
emilmont | 1:fdd22bb7aa52 | 4864 | |
emilmont | 1:fdd22bb7aa52 | 4865 | /** |
emilmont | 1:fdd22bb7aa52 | 4866 | * @addtogroup PID |
emilmont | 1:fdd22bb7aa52 | 4867 | * @{ |
emilmont | 1:fdd22bb7aa52 | 4868 | */ |
emilmont | 1:fdd22bb7aa52 | 4869 | |
emilmont | 1:fdd22bb7aa52 | 4870 | /** |
emilmont | 1:fdd22bb7aa52 | 4871 | * @brief Process function for the floating-point PID Control. |
emilmont | 1:fdd22bb7aa52 | 4872 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
emilmont | 1:fdd22bb7aa52 | 4873 | * @param[in] in input sample to process |
emilmont | 1:fdd22bb7aa52 | 4874 | * @return out processed output sample. |
emilmont | 1:fdd22bb7aa52 | 4875 | */ |
emilmont | 1:fdd22bb7aa52 | 4876 | |
emilmont | 1:fdd22bb7aa52 | 4877 | |
mbed_official | 3:7a284390b0ce | 4878 | static __INLINE float32_t arm_pid_f32( |
emilmont | 1:fdd22bb7aa52 | 4879 | arm_pid_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 4880 | float32_t in) |
emilmont | 1:fdd22bb7aa52 | 4881 | { |
emilmont | 1:fdd22bb7aa52 | 4882 | float32_t out; |
emilmont | 1:fdd22bb7aa52 | 4883 | |
emilmont | 1:fdd22bb7aa52 | 4884 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ |
emilmont | 1:fdd22bb7aa52 | 4885 | out = (S->A0 * in) + |
emilmont | 1:fdd22bb7aa52 | 4886 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); |
emilmont | 1:fdd22bb7aa52 | 4887 | |
emilmont | 1:fdd22bb7aa52 | 4888 | /* Update state */ |
emilmont | 1:fdd22bb7aa52 | 4889 | S->state[1] = S->state[0]; |
emilmont | 1:fdd22bb7aa52 | 4890 | S->state[0] = in; |
emilmont | 1:fdd22bb7aa52 | 4891 | S->state[2] = out; |
emilmont | 1:fdd22bb7aa52 | 4892 | |
emilmont | 1:fdd22bb7aa52 | 4893 | /* return to application */ |
emilmont | 1:fdd22bb7aa52 | 4894 | return (out); |
emilmont | 1:fdd22bb7aa52 | 4895 | |
emilmont | 1:fdd22bb7aa52 | 4896 | } |
emilmont | 1:fdd22bb7aa52 | 4897 | |
emilmont | 1:fdd22bb7aa52 | 4898 | /** |
emilmont | 1:fdd22bb7aa52 | 4899 | * @brief Process function for the Q31 PID Control. |
emilmont | 1:fdd22bb7aa52 | 4900 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
emilmont | 1:fdd22bb7aa52 | 4901 | * @param[in] in input sample to process |
emilmont | 1:fdd22bb7aa52 | 4902 | * @return out processed output sample. |
emilmont | 1:fdd22bb7aa52 | 4903 | * |
mbed_official | 3:7a284390b0ce | 4904 | * <b>Scaling and Overflow Behavior:</b> |
mbed_official | 3:7a284390b0ce | 4905 | * \par |
mbed_official | 3:7a284390b0ce | 4906 | * The function is implemented using an internal 64-bit accumulator. |
mbed_official | 3:7a284390b0ce | 4907 | * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. |
mbed_official | 3:7a284390b0ce | 4908 | * Thus, if the accumulator result overflows it wraps around rather than clip. |
mbed_official | 3:7a284390b0ce | 4909 | * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. |
mbed_official | 3:7a284390b0ce | 4910 | * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. |
mbed_official | 3:7a284390b0ce | 4911 | */ |
mbed_official | 3:7a284390b0ce | 4912 | |
mbed_official | 3:7a284390b0ce | 4913 | static __INLINE q31_t arm_pid_q31( |
emilmont | 1:fdd22bb7aa52 | 4914 | arm_pid_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 4915 | q31_t in) |
emilmont | 1:fdd22bb7aa52 | 4916 | { |
emilmont | 1:fdd22bb7aa52 | 4917 | q63_t acc; |
emilmont | 1:fdd22bb7aa52 | 4918 | q31_t out; |
emilmont | 1:fdd22bb7aa52 | 4919 | |
emilmont | 1:fdd22bb7aa52 | 4920 | /* acc = A0 * x[n] */ |
emilmont | 1:fdd22bb7aa52 | 4921 | acc = (q63_t) S->A0 * in; |
emilmont | 1:fdd22bb7aa52 | 4922 | |
emilmont | 1:fdd22bb7aa52 | 4923 | /* acc += A1 * x[n-1] */ |
emilmont | 1:fdd22bb7aa52 | 4924 | acc += (q63_t) S->A1 * S->state[0]; |
emilmont | 1:fdd22bb7aa52 | 4925 | |
emilmont | 1:fdd22bb7aa52 | 4926 | /* acc += A2 * x[n-2] */ |
emilmont | 1:fdd22bb7aa52 | 4927 | acc += (q63_t) S->A2 * S->state[1]; |
emilmont | 1:fdd22bb7aa52 | 4928 | |
emilmont | 1:fdd22bb7aa52 | 4929 | /* convert output to 1.31 format to add y[n-1] */ |
emilmont | 1:fdd22bb7aa52 | 4930 | out = (q31_t) (acc >> 31u); |
emilmont | 1:fdd22bb7aa52 | 4931 | |
emilmont | 1:fdd22bb7aa52 | 4932 | /* out += y[n-1] */ |
emilmont | 1:fdd22bb7aa52 | 4933 | out += S->state[2]; |
emilmont | 1:fdd22bb7aa52 | 4934 | |
emilmont | 1:fdd22bb7aa52 | 4935 | /* Update state */ |
emilmont | 1:fdd22bb7aa52 | 4936 | S->state[1] = S->state[0]; |
emilmont | 1:fdd22bb7aa52 | 4937 | S->state[0] = in; |
emilmont | 1:fdd22bb7aa52 | 4938 | S->state[2] = out; |
emilmont | 1:fdd22bb7aa52 | 4939 | |
emilmont | 1:fdd22bb7aa52 | 4940 | /* return to application */ |
emilmont | 1:fdd22bb7aa52 | 4941 | return (out); |
emilmont | 1:fdd22bb7aa52 | 4942 | |
emilmont | 1:fdd22bb7aa52 | 4943 | } |
emilmont | 1:fdd22bb7aa52 | 4944 | |
emilmont | 1:fdd22bb7aa52 | 4945 | /** |
emilmont | 1:fdd22bb7aa52 | 4946 | * @brief Process function for the Q15 PID Control. |
emilmont | 1:fdd22bb7aa52 | 4947 | * @param[in,out] *S points to an instance of the Q15 PID Control structure |
emilmont | 1:fdd22bb7aa52 | 4948 | * @param[in] in input sample to process |
emilmont | 1:fdd22bb7aa52 | 4949 | * @return out processed output sample. |
emilmont | 1:fdd22bb7aa52 | 4950 | * |
mbed_official | 3:7a284390b0ce | 4951 | * <b>Scaling and Overflow Behavior:</b> |
mbed_official | 3:7a284390b0ce | 4952 | * \par |
mbed_official | 3:7a284390b0ce | 4953 | * The function is implemented using a 64-bit internal accumulator. |
mbed_official | 3:7a284390b0ce | 4954 | * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. |
mbed_official | 3:7a284390b0ce | 4955 | * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. |
mbed_official | 3:7a284390b0ce | 4956 | * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. |
mbed_official | 3:7a284390b0ce | 4957 | * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. |
emilmont | 1:fdd22bb7aa52 | 4958 | * Lastly, the accumulator is saturated to yield a result in 1.15 format. |
emilmont | 1:fdd22bb7aa52 | 4959 | */ |
emilmont | 1:fdd22bb7aa52 | 4960 | |
mbed_official | 3:7a284390b0ce | 4961 | static __INLINE q15_t arm_pid_q15( |
emilmont | 1:fdd22bb7aa52 | 4962 | arm_pid_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 4963 | q15_t in) |
emilmont | 1:fdd22bb7aa52 | 4964 | { |
emilmont | 1:fdd22bb7aa52 | 4965 | q63_t acc; |
emilmont | 1:fdd22bb7aa52 | 4966 | q15_t out; |
emilmont | 1:fdd22bb7aa52 | 4967 | |
mbed_official | 3:7a284390b0ce | 4968 | #ifndef ARM_MATH_CM0_FAMILY |
mbed_official | 3:7a284390b0ce | 4969 | __SIMD32_TYPE *vstate; |
mbed_official | 3:7a284390b0ce | 4970 | |
emilmont | 1:fdd22bb7aa52 | 4971 | /* Implementation of PID controller */ |
emilmont | 1:fdd22bb7aa52 | 4972 | |
emilmont | 1:fdd22bb7aa52 | 4973 | /* acc = A0 * x[n] */ |
emilmont | 1:fdd22bb7aa52 | 4974 | acc = (q31_t) __SMUAD(S->A0, in); |
emilmont | 1:fdd22bb7aa52 | 4975 | |
mbed_official | 3:7a284390b0ce | 4976 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
mbed_official | 3:7a284390b0ce | 4977 | vstate = __SIMD32_CONST(S->state); |
mbed_official | 3:7a284390b0ce | 4978 | acc = __SMLALD(S->A1, (q31_t) *vstate, acc); |
mbed_official | 3:7a284390b0ce | 4979 | |
mbed_official | 3:7a284390b0ce | 4980 | #else |
mbed_official | 3:7a284390b0ce | 4981 | /* acc = A0 * x[n] */ |
mbed_official | 3:7a284390b0ce | 4982 | acc = ((q31_t) S->A0) * in; |
emilmont | 1:fdd22bb7aa52 | 4983 | |
emilmont | 1:fdd22bb7aa52 | 4984 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
emilmont | 1:fdd22bb7aa52 | 4985 | acc += (q31_t) S->A1 * S->state[0]; |
emilmont | 1:fdd22bb7aa52 | 4986 | acc += (q31_t) S->A2 * S->state[1]; |
emilmont | 1:fdd22bb7aa52 | 4987 | |
emilmont | 1:fdd22bb7aa52 | 4988 | #endif |
emilmont | 1:fdd22bb7aa52 | 4989 | |
emilmont | 1:fdd22bb7aa52 | 4990 | /* acc += y[n-1] */ |
emilmont | 1:fdd22bb7aa52 | 4991 | acc += (q31_t) S->state[2] << 15; |
emilmont | 1:fdd22bb7aa52 | 4992 | |
emilmont | 1:fdd22bb7aa52 | 4993 | /* saturate the output */ |
emilmont | 1:fdd22bb7aa52 | 4994 | out = (q15_t) (__SSAT((acc >> 15), 16)); |
emilmont | 1:fdd22bb7aa52 | 4995 | |
emilmont | 1:fdd22bb7aa52 | 4996 | /* Update state */ |
emilmont | 1:fdd22bb7aa52 | 4997 | S->state[1] = S->state[0]; |
emilmont | 1:fdd22bb7aa52 | 4998 | S->state[0] = in; |
emilmont | 1:fdd22bb7aa52 | 4999 | S->state[2] = out; |
emilmont | 1:fdd22bb7aa52 | 5000 | |
emilmont | 1:fdd22bb7aa52 | 5001 | /* return to application */ |
emilmont | 1:fdd22bb7aa52 | 5002 | return (out); |
emilmont | 1:fdd22bb7aa52 | 5003 | |
emilmont | 1:fdd22bb7aa52 | 5004 | } |
emilmont | 1:fdd22bb7aa52 | 5005 | |
emilmont | 1:fdd22bb7aa52 | 5006 | /** |
emilmont | 1:fdd22bb7aa52 | 5007 | * @} end of PID group |
emilmont | 1:fdd22bb7aa52 | 5008 | */ |
emilmont | 1:fdd22bb7aa52 | 5009 | |
emilmont | 1:fdd22bb7aa52 | 5010 | |
emilmont | 1:fdd22bb7aa52 | 5011 | /** |
emilmont | 1:fdd22bb7aa52 | 5012 | * @brief Floating-point matrix inverse. |
emilmont | 1:fdd22bb7aa52 | 5013 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
emilmont | 1:fdd22bb7aa52 | 5014 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
emilmont | 1:fdd22bb7aa52 | 5015 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
emilmont | 1:fdd22bb7aa52 | 5016 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
emilmont | 1:fdd22bb7aa52 | 5017 | */ |
emilmont | 1:fdd22bb7aa52 | 5018 | |
emilmont | 1:fdd22bb7aa52 | 5019 | arm_status arm_mat_inverse_f32( |
emilmont | 1:fdd22bb7aa52 | 5020 | const arm_matrix_instance_f32 * src, |
emilmont | 1:fdd22bb7aa52 | 5021 | arm_matrix_instance_f32 * dst); |
emilmont | 1:fdd22bb7aa52 | 5022 | |
emilmont | 1:fdd22bb7aa52 | 5023 | |
emilmont | 1:fdd22bb7aa52 | 5024 | |
emilmont | 1:fdd22bb7aa52 | 5025 | /** |
emilmont | 1:fdd22bb7aa52 | 5026 | * @ingroup groupController |
emilmont | 1:fdd22bb7aa52 | 5027 | */ |
emilmont | 1:fdd22bb7aa52 | 5028 | |
emilmont | 1:fdd22bb7aa52 | 5029 | |
emilmont | 1:fdd22bb7aa52 | 5030 | /** |
emilmont | 1:fdd22bb7aa52 | 5031 | * @defgroup clarke Vector Clarke Transform |
emilmont | 1:fdd22bb7aa52 | 5032 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. |
emilmont | 1:fdd22bb7aa52 | 5033 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents |
emilmont | 1:fdd22bb7aa52 | 5034 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>. |
emilmont | 1:fdd22bb7aa52 | 5035 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below |
emilmont | 1:fdd22bb7aa52 | 5036 | * \image html clarke.gif Stator current space vector and its components in (a,b). |
emilmont | 1:fdd22bb7aa52 | 5037 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code> |
emilmont | 1:fdd22bb7aa52 | 5038 | * can be calculated using only <code>Ia</code> and <code>Ib</code>. |
emilmont | 1:fdd22bb7aa52 | 5039 | * |
mbed_official | 3:7a284390b0ce | 5040 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emilmont | 1:fdd22bb7aa52 | 5041 | * The library provides separate functions for Q31 and floating-point data types. |
emilmont | 1:fdd22bb7aa52 | 5042 | * \par Algorithm |
emilmont | 1:fdd22bb7aa52 | 5043 | * \image html clarkeFormula.gif |
emilmont | 1:fdd22bb7aa52 | 5044 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and |
emilmont | 1:fdd22bb7aa52 | 5045 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector. |
emilmont | 1:fdd22bb7aa52 | 5046 | * \par Fixed-Point Behavior |
emilmont | 1:fdd22bb7aa52 | 5047 | * Care must be taken when using the Q31 version of the Clarke transform. |
emilmont | 1:fdd22bb7aa52 | 5048 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emilmont | 1:fdd22bb7aa52 | 5049 | * Refer to the function specific documentation below for usage guidelines. |
emilmont | 1:fdd22bb7aa52 | 5050 | */ |
emilmont | 1:fdd22bb7aa52 | 5051 | |
emilmont | 1:fdd22bb7aa52 | 5052 | /** |
emilmont | 1:fdd22bb7aa52 | 5053 | * @addtogroup clarke |
emilmont | 1:fdd22bb7aa52 | 5054 | * @{ |
emilmont | 1:fdd22bb7aa52 | 5055 | */ |
emilmont | 1:fdd22bb7aa52 | 5056 | |
emilmont | 1:fdd22bb7aa52 | 5057 | /** |
emilmont | 1:fdd22bb7aa52 | 5058 | * |
emilmont | 1:fdd22bb7aa52 | 5059 | * @brief Floating-point Clarke transform |
emilmont | 1:fdd22bb7aa52 | 5060 | * @param[in] Ia input three-phase coordinate <code>a</code> |
emilmont | 1:fdd22bb7aa52 | 5061 | * @param[in] Ib input three-phase coordinate <code>b</code> |
emilmont | 1:fdd22bb7aa52 | 5062 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emilmont | 1:fdd22bb7aa52 | 5063 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emilmont | 1:fdd22bb7aa52 | 5064 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5065 | */ |
emilmont | 1:fdd22bb7aa52 | 5066 | |
mbed_official | 3:7a284390b0ce | 5067 | static __INLINE void arm_clarke_f32( |
emilmont | 1:fdd22bb7aa52 | 5068 | float32_t Ia, |
emilmont | 1:fdd22bb7aa52 | 5069 | float32_t Ib, |
emilmont | 1:fdd22bb7aa52 | 5070 | float32_t * pIalpha, |
emilmont | 1:fdd22bb7aa52 | 5071 | float32_t * pIbeta) |
emilmont | 1:fdd22bb7aa52 | 5072 | { |
emilmont | 1:fdd22bb7aa52 | 5073 | /* Calculate pIalpha using the equation, pIalpha = Ia */ |
emilmont | 1:fdd22bb7aa52 | 5074 | *pIalpha = Ia; |
emilmont | 1:fdd22bb7aa52 | 5075 | |
emilmont | 1:fdd22bb7aa52 | 5076 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ |
emilmont | 1:fdd22bb7aa52 | 5077 | *pIbeta = |
emilmont | 1:fdd22bb7aa52 | 5078 | ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); |
emilmont | 1:fdd22bb7aa52 | 5079 | |
emilmont | 1:fdd22bb7aa52 | 5080 | } |
emilmont | 1:fdd22bb7aa52 | 5081 | |
emilmont | 1:fdd22bb7aa52 | 5082 | /** |
emilmont | 1:fdd22bb7aa52 | 5083 | * @brief Clarke transform for Q31 version |
emilmont | 1:fdd22bb7aa52 | 5084 | * @param[in] Ia input three-phase coordinate <code>a</code> |
emilmont | 1:fdd22bb7aa52 | 5085 | * @param[in] Ib input three-phase coordinate <code>b</code> |
emilmont | 1:fdd22bb7aa52 | 5086 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emilmont | 1:fdd22bb7aa52 | 5087 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emilmont | 1:fdd22bb7aa52 | 5088 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5089 | * |
emilmont | 1:fdd22bb7aa52 | 5090 | * <b>Scaling and Overflow Behavior:</b> |
emilmont | 1:fdd22bb7aa52 | 5091 | * \par |
emilmont | 1:fdd22bb7aa52 | 5092 | * The function is implemented using an internal 32-bit accumulator. |
emilmont | 1:fdd22bb7aa52 | 5093 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emilmont | 1:fdd22bb7aa52 | 5094 | * There is saturation on the addition, hence there is no risk of overflow. |
emilmont | 1:fdd22bb7aa52 | 5095 | */ |
emilmont | 1:fdd22bb7aa52 | 5096 | |
mbed_official | 3:7a284390b0ce | 5097 | static __INLINE void arm_clarke_q31( |
emilmont | 1:fdd22bb7aa52 | 5098 | q31_t Ia, |
emilmont | 1:fdd22bb7aa52 | 5099 | q31_t Ib, |
emilmont | 1:fdd22bb7aa52 | 5100 | q31_t * pIalpha, |
emilmont | 1:fdd22bb7aa52 | 5101 | q31_t * pIbeta) |
emilmont | 1:fdd22bb7aa52 | 5102 | { |
emilmont | 1:fdd22bb7aa52 | 5103 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emilmont | 1:fdd22bb7aa52 | 5104 | |
emilmont | 1:fdd22bb7aa52 | 5105 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */ |
emilmont | 1:fdd22bb7aa52 | 5106 | *pIalpha = Ia; |
emilmont | 1:fdd22bb7aa52 | 5107 | |
emilmont | 1:fdd22bb7aa52 | 5108 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ |
emilmont | 1:fdd22bb7aa52 | 5109 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); |
emilmont | 1:fdd22bb7aa52 | 5110 | |
emilmont | 1:fdd22bb7aa52 | 5111 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ |
emilmont | 1:fdd22bb7aa52 | 5112 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); |
emilmont | 1:fdd22bb7aa52 | 5113 | |
emilmont | 1:fdd22bb7aa52 | 5114 | /* pIbeta is calculated by adding the intermediate products */ |
emilmont | 1:fdd22bb7aa52 | 5115 | *pIbeta = __QADD(product1, product2); |
emilmont | 1:fdd22bb7aa52 | 5116 | } |
emilmont | 1:fdd22bb7aa52 | 5117 | |
emilmont | 1:fdd22bb7aa52 | 5118 | /** |
emilmont | 1:fdd22bb7aa52 | 5119 | * @} end of clarke group |
emilmont | 1:fdd22bb7aa52 | 5120 | */ |
emilmont | 1:fdd22bb7aa52 | 5121 | |
emilmont | 1:fdd22bb7aa52 | 5122 | /** |
emilmont | 1:fdd22bb7aa52 | 5123 | * @brief Converts the elements of the Q7 vector to Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 5124 | * @param[in] *pSrc input pointer |
emilmont | 1:fdd22bb7aa52 | 5125 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 5126 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 5127 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5128 | */ |
emilmont | 1:fdd22bb7aa52 | 5129 | void arm_q7_to_q31( |
emilmont | 1:fdd22bb7aa52 | 5130 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 5131 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 5132 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 5133 | |
emilmont | 1:fdd22bb7aa52 | 5134 | |
emilmont | 1:fdd22bb7aa52 | 5135 | |
emilmont | 1:fdd22bb7aa52 | 5136 | |
emilmont | 1:fdd22bb7aa52 | 5137 | /** |
emilmont | 1:fdd22bb7aa52 | 5138 | * @ingroup groupController |
emilmont | 1:fdd22bb7aa52 | 5139 | */ |
emilmont | 1:fdd22bb7aa52 | 5140 | |
emilmont | 1:fdd22bb7aa52 | 5141 | /** |
emilmont | 1:fdd22bb7aa52 | 5142 | * @defgroup inv_clarke Vector Inverse Clarke Transform |
emilmont | 1:fdd22bb7aa52 | 5143 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. |
mbed_official | 3:7a284390b0ce | 5144 | * |
mbed_official | 3:7a284390b0ce | 5145 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emilmont | 1:fdd22bb7aa52 | 5146 | * The library provides separate functions for Q31 and floating-point data types. |
emilmont | 1:fdd22bb7aa52 | 5147 | * \par Algorithm |
emilmont | 1:fdd22bb7aa52 | 5148 | * \image html clarkeInvFormula.gif |
emilmont | 1:fdd22bb7aa52 | 5149 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and |
emilmont | 1:fdd22bb7aa52 | 5150 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector. |
emilmont | 1:fdd22bb7aa52 | 5151 | * \par Fixed-Point Behavior |
emilmont | 1:fdd22bb7aa52 | 5152 | * Care must be taken when using the Q31 version of the Clarke transform. |
emilmont | 1:fdd22bb7aa52 | 5153 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emilmont | 1:fdd22bb7aa52 | 5154 | * Refer to the function specific documentation below for usage guidelines. |
emilmont | 1:fdd22bb7aa52 | 5155 | */ |
emilmont | 1:fdd22bb7aa52 | 5156 | |
emilmont | 1:fdd22bb7aa52 | 5157 | /** |
emilmont | 1:fdd22bb7aa52 | 5158 | * @addtogroup inv_clarke |
emilmont | 1:fdd22bb7aa52 | 5159 | * @{ |
emilmont | 1:fdd22bb7aa52 | 5160 | */ |
emilmont | 1:fdd22bb7aa52 | 5161 | |
emilmont | 1:fdd22bb7aa52 | 5162 | /** |
emilmont | 1:fdd22bb7aa52 | 5163 | * @brief Floating-point Inverse Clarke transform |
emilmont | 1:fdd22bb7aa52 | 5164 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
emilmont | 1:fdd22bb7aa52 | 5165 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
emilmont | 1:fdd22bb7aa52 | 5166 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
emilmont | 1:fdd22bb7aa52 | 5167 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
emilmont | 1:fdd22bb7aa52 | 5168 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5169 | */ |
emilmont | 1:fdd22bb7aa52 | 5170 | |
emilmont | 1:fdd22bb7aa52 | 5171 | |
mbed_official | 3:7a284390b0ce | 5172 | static __INLINE void arm_inv_clarke_f32( |
emilmont | 1:fdd22bb7aa52 | 5173 | float32_t Ialpha, |
emilmont | 1:fdd22bb7aa52 | 5174 | float32_t Ibeta, |
emilmont | 1:fdd22bb7aa52 | 5175 | float32_t * pIa, |
emilmont | 1:fdd22bb7aa52 | 5176 | float32_t * pIb) |
emilmont | 1:fdd22bb7aa52 | 5177 | { |
emilmont | 1:fdd22bb7aa52 | 5178 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
emilmont | 1:fdd22bb7aa52 | 5179 | *pIa = Ialpha; |
emilmont | 1:fdd22bb7aa52 | 5180 | |
emilmont | 1:fdd22bb7aa52 | 5181 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ |
emilmont | 1:fdd22bb7aa52 | 5182 | *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta; |
emilmont | 1:fdd22bb7aa52 | 5183 | |
emilmont | 1:fdd22bb7aa52 | 5184 | } |
emilmont | 1:fdd22bb7aa52 | 5185 | |
emilmont | 1:fdd22bb7aa52 | 5186 | /** |
mbed_official | 3:7a284390b0ce | 5187 | * @brief Inverse Clarke transform for Q31 version |
emilmont | 1:fdd22bb7aa52 | 5188 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
emilmont | 1:fdd22bb7aa52 | 5189 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
emilmont | 1:fdd22bb7aa52 | 5190 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
emilmont | 1:fdd22bb7aa52 | 5191 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
emilmont | 1:fdd22bb7aa52 | 5192 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5193 | * |
emilmont | 1:fdd22bb7aa52 | 5194 | * <b>Scaling and Overflow Behavior:</b> |
emilmont | 1:fdd22bb7aa52 | 5195 | * \par |
emilmont | 1:fdd22bb7aa52 | 5196 | * The function is implemented using an internal 32-bit accumulator. |
emilmont | 1:fdd22bb7aa52 | 5197 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emilmont | 1:fdd22bb7aa52 | 5198 | * There is saturation on the subtraction, hence there is no risk of overflow. |
emilmont | 1:fdd22bb7aa52 | 5199 | */ |
emilmont | 1:fdd22bb7aa52 | 5200 | |
mbed_official | 3:7a284390b0ce | 5201 | static __INLINE void arm_inv_clarke_q31( |
emilmont | 1:fdd22bb7aa52 | 5202 | q31_t Ialpha, |
emilmont | 1:fdd22bb7aa52 | 5203 | q31_t Ibeta, |
emilmont | 1:fdd22bb7aa52 | 5204 | q31_t * pIa, |
emilmont | 1:fdd22bb7aa52 | 5205 | q31_t * pIb) |
emilmont | 1:fdd22bb7aa52 | 5206 | { |
emilmont | 1:fdd22bb7aa52 | 5207 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emilmont | 1:fdd22bb7aa52 | 5208 | |
emilmont | 1:fdd22bb7aa52 | 5209 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
emilmont | 1:fdd22bb7aa52 | 5210 | *pIa = Ialpha; |
emilmont | 1:fdd22bb7aa52 | 5211 | |
emilmont | 1:fdd22bb7aa52 | 5212 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ |
emilmont | 1:fdd22bb7aa52 | 5213 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5214 | |
emilmont | 1:fdd22bb7aa52 | 5215 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ |
emilmont | 1:fdd22bb7aa52 | 5216 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5217 | |
emilmont | 1:fdd22bb7aa52 | 5218 | /* pIb is calculated by subtracting the products */ |
emilmont | 1:fdd22bb7aa52 | 5219 | *pIb = __QSUB(product2, product1); |
emilmont | 1:fdd22bb7aa52 | 5220 | |
emilmont | 1:fdd22bb7aa52 | 5221 | } |
emilmont | 1:fdd22bb7aa52 | 5222 | |
emilmont | 1:fdd22bb7aa52 | 5223 | /** |
emilmont | 1:fdd22bb7aa52 | 5224 | * @} end of inv_clarke group |
emilmont | 1:fdd22bb7aa52 | 5225 | */ |
emilmont | 1:fdd22bb7aa52 | 5226 | |
emilmont | 1:fdd22bb7aa52 | 5227 | /** |
emilmont | 1:fdd22bb7aa52 | 5228 | * @brief Converts the elements of the Q7 vector to Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 5229 | * @param[in] *pSrc input pointer |
emilmont | 1:fdd22bb7aa52 | 5230 | * @param[out] *pDst output pointer |
emilmont | 1:fdd22bb7aa52 | 5231 | * @param[in] blockSize number of samples to process |
emilmont | 1:fdd22bb7aa52 | 5232 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5233 | */ |
emilmont | 1:fdd22bb7aa52 | 5234 | void arm_q7_to_q15( |
emilmont | 1:fdd22bb7aa52 | 5235 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 5236 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 5237 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 5238 | |
emilmont | 1:fdd22bb7aa52 | 5239 | |
emilmont | 1:fdd22bb7aa52 | 5240 | |
emilmont | 1:fdd22bb7aa52 | 5241 | /** |
emilmont | 1:fdd22bb7aa52 | 5242 | * @ingroup groupController |
emilmont | 1:fdd22bb7aa52 | 5243 | */ |
emilmont | 1:fdd22bb7aa52 | 5244 | |
emilmont | 1:fdd22bb7aa52 | 5245 | /** |
emilmont | 1:fdd22bb7aa52 | 5246 | * @defgroup park Vector Park Transform |
emilmont | 1:fdd22bb7aa52 | 5247 | * |
emilmont | 1:fdd22bb7aa52 | 5248 | * Forward Park transform converts the input two-coordinate vector to flux and torque components. |
mbed_official | 3:7a284390b0ce | 5249 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents |
mbed_official | 3:7a284390b0ce | 5250 | * from the stationary to the moving reference frame and control the spatial relationship between |
emilmont | 1:fdd22bb7aa52 | 5251 | * the stator vector current and rotor flux vector. |
mbed_official | 3:7a284390b0ce | 5252 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the |
emilmont | 1:fdd22bb7aa52 | 5253 | * current vector and the relationship from the two reference frames: |
emilmont | 1:fdd22bb7aa52 | 5254 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" |
emilmont | 1:fdd22bb7aa52 | 5255 | * |
mbed_official | 3:7a284390b0ce | 5256 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emilmont | 1:fdd22bb7aa52 | 5257 | * The library provides separate functions for Q31 and floating-point data types. |
emilmont | 1:fdd22bb7aa52 | 5258 | * \par Algorithm |
emilmont | 1:fdd22bb7aa52 | 5259 | * \image html parkFormula.gif |
mbed_official | 3:7a284390b0ce | 5260 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components, |
mbed_official | 3:7a284390b0ce | 5261 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
emilmont | 1:fdd22bb7aa52 | 5262 | * cosine and sine values of theta (rotor flux position). |
emilmont | 1:fdd22bb7aa52 | 5263 | * \par Fixed-Point Behavior |
emilmont | 1:fdd22bb7aa52 | 5264 | * Care must be taken when using the Q31 version of the Park transform. |
emilmont | 1:fdd22bb7aa52 | 5265 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emilmont | 1:fdd22bb7aa52 | 5266 | * Refer to the function specific documentation below for usage guidelines. |
emilmont | 1:fdd22bb7aa52 | 5267 | */ |
emilmont | 1:fdd22bb7aa52 | 5268 | |
emilmont | 1:fdd22bb7aa52 | 5269 | /** |
emilmont | 1:fdd22bb7aa52 | 5270 | * @addtogroup park |
emilmont | 1:fdd22bb7aa52 | 5271 | * @{ |
emilmont | 1:fdd22bb7aa52 | 5272 | */ |
emilmont | 1:fdd22bb7aa52 | 5273 | |
emilmont | 1:fdd22bb7aa52 | 5274 | /** |
emilmont | 1:fdd22bb7aa52 | 5275 | * @brief Floating-point Park transform |
emilmont | 1:fdd22bb7aa52 | 5276 | * @param[in] Ialpha input two-phase vector coordinate alpha |
emilmont | 1:fdd22bb7aa52 | 5277 | * @param[in] Ibeta input two-phase vector coordinate beta |
emilmont | 2:da51fb522205 | 5278 | * @param[out] *pId points to output rotor reference frame d |
emilmont | 2:da51fb522205 | 5279 | * @param[out] *pIq points to output rotor reference frame q |
emilmont | 1:fdd22bb7aa52 | 5280 | * @param[in] sinVal sine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5281 | * @param[in] cosVal cosine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5282 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5283 | * |
emilmont | 1:fdd22bb7aa52 | 5284 | * The function implements the forward Park transform. |
emilmont | 1:fdd22bb7aa52 | 5285 | * |
emilmont | 1:fdd22bb7aa52 | 5286 | */ |
emilmont | 1:fdd22bb7aa52 | 5287 | |
mbed_official | 3:7a284390b0ce | 5288 | static __INLINE void arm_park_f32( |
emilmont | 1:fdd22bb7aa52 | 5289 | float32_t Ialpha, |
emilmont | 1:fdd22bb7aa52 | 5290 | float32_t Ibeta, |
emilmont | 1:fdd22bb7aa52 | 5291 | float32_t * pId, |
emilmont | 1:fdd22bb7aa52 | 5292 | float32_t * pIq, |
emilmont | 1:fdd22bb7aa52 | 5293 | float32_t sinVal, |
emilmont | 1:fdd22bb7aa52 | 5294 | float32_t cosVal) |
emilmont | 1:fdd22bb7aa52 | 5295 | { |
emilmont | 1:fdd22bb7aa52 | 5296 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ |
emilmont | 1:fdd22bb7aa52 | 5297 | *pId = Ialpha * cosVal + Ibeta * sinVal; |
emilmont | 1:fdd22bb7aa52 | 5298 | |
emilmont | 1:fdd22bb7aa52 | 5299 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ |
emilmont | 1:fdd22bb7aa52 | 5300 | *pIq = -Ialpha * sinVal + Ibeta * cosVal; |
emilmont | 1:fdd22bb7aa52 | 5301 | |
emilmont | 1:fdd22bb7aa52 | 5302 | } |
emilmont | 1:fdd22bb7aa52 | 5303 | |
emilmont | 1:fdd22bb7aa52 | 5304 | /** |
mbed_official | 3:7a284390b0ce | 5305 | * @brief Park transform for Q31 version |
emilmont | 1:fdd22bb7aa52 | 5306 | * @param[in] Ialpha input two-phase vector coordinate alpha |
emilmont | 1:fdd22bb7aa52 | 5307 | * @param[in] Ibeta input two-phase vector coordinate beta |
emilmont | 1:fdd22bb7aa52 | 5308 | * @param[out] *pId points to output rotor reference frame d |
emilmont | 1:fdd22bb7aa52 | 5309 | * @param[out] *pIq points to output rotor reference frame q |
emilmont | 1:fdd22bb7aa52 | 5310 | * @param[in] sinVal sine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5311 | * @param[in] cosVal cosine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5312 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5313 | * |
emilmont | 1:fdd22bb7aa52 | 5314 | * <b>Scaling and Overflow Behavior:</b> |
emilmont | 1:fdd22bb7aa52 | 5315 | * \par |
emilmont | 1:fdd22bb7aa52 | 5316 | * The function is implemented using an internal 32-bit accumulator. |
emilmont | 1:fdd22bb7aa52 | 5317 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emilmont | 1:fdd22bb7aa52 | 5318 | * There is saturation on the addition and subtraction, hence there is no risk of overflow. |
emilmont | 1:fdd22bb7aa52 | 5319 | */ |
emilmont | 1:fdd22bb7aa52 | 5320 | |
emilmont | 1:fdd22bb7aa52 | 5321 | |
mbed_official | 3:7a284390b0ce | 5322 | static __INLINE void arm_park_q31( |
emilmont | 1:fdd22bb7aa52 | 5323 | q31_t Ialpha, |
emilmont | 1:fdd22bb7aa52 | 5324 | q31_t Ibeta, |
emilmont | 1:fdd22bb7aa52 | 5325 | q31_t * pId, |
emilmont | 1:fdd22bb7aa52 | 5326 | q31_t * pIq, |
emilmont | 1:fdd22bb7aa52 | 5327 | q31_t sinVal, |
emilmont | 1:fdd22bb7aa52 | 5328 | q31_t cosVal) |
emilmont | 1:fdd22bb7aa52 | 5329 | { |
emilmont | 1:fdd22bb7aa52 | 5330 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emilmont | 1:fdd22bb7aa52 | 5331 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
emilmont | 1:fdd22bb7aa52 | 5332 | |
emilmont | 1:fdd22bb7aa52 | 5333 | /* Intermediate product is calculated by (Ialpha * cosVal) */ |
emilmont | 1:fdd22bb7aa52 | 5334 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5335 | |
emilmont | 1:fdd22bb7aa52 | 5336 | /* Intermediate product is calculated by (Ibeta * sinVal) */ |
emilmont | 1:fdd22bb7aa52 | 5337 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5338 | |
emilmont | 1:fdd22bb7aa52 | 5339 | |
emilmont | 1:fdd22bb7aa52 | 5340 | /* Intermediate product is calculated by (Ialpha * sinVal) */ |
emilmont | 1:fdd22bb7aa52 | 5341 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5342 | |
emilmont | 1:fdd22bb7aa52 | 5343 | /* Intermediate product is calculated by (Ibeta * cosVal) */ |
emilmont | 1:fdd22bb7aa52 | 5344 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5345 | |
emilmont | 1:fdd22bb7aa52 | 5346 | /* Calculate pId by adding the two intermediate products 1 and 2 */ |
emilmont | 1:fdd22bb7aa52 | 5347 | *pId = __QADD(product1, product2); |
emilmont | 1:fdd22bb7aa52 | 5348 | |
emilmont | 1:fdd22bb7aa52 | 5349 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ |
emilmont | 1:fdd22bb7aa52 | 5350 | *pIq = __QSUB(product4, product3); |
emilmont | 1:fdd22bb7aa52 | 5351 | } |
emilmont | 1:fdd22bb7aa52 | 5352 | |
emilmont | 1:fdd22bb7aa52 | 5353 | /** |
emilmont | 1:fdd22bb7aa52 | 5354 | * @} end of park group |
emilmont | 1:fdd22bb7aa52 | 5355 | */ |
emilmont | 1:fdd22bb7aa52 | 5356 | |
emilmont | 1:fdd22bb7aa52 | 5357 | /** |
emilmont | 1:fdd22bb7aa52 | 5358 | * @brief Converts the elements of the Q7 vector to floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 5359 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 5360 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 5361 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 5362 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5363 | */ |
emilmont | 1:fdd22bb7aa52 | 5364 | void arm_q7_to_float( |
emilmont | 1:fdd22bb7aa52 | 5365 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 5366 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 5367 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 5368 | |
emilmont | 1:fdd22bb7aa52 | 5369 | |
emilmont | 1:fdd22bb7aa52 | 5370 | /** |
emilmont | 1:fdd22bb7aa52 | 5371 | * @ingroup groupController |
emilmont | 1:fdd22bb7aa52 | 5372 | */ |
emilmont | 1:fdd22bb7aa52 | 5373 | |
emilmont | 1:fdd22bb7aa52 | 5374 | /** |
emilmont | 1:fdd22bb7aa52 | 5375 | * @defgroup inv_park Vector Inverse Park transform |
emilmont | 1:fdd22bb7aa52 | 5376 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector. |
emilmont | 1:fdd22bb7aa52 | 5377 | * |
mbed_official | 3:7a284390b0ce | 5378 | * The function operates on a single sample of data and each call to the function returns the processed output. |
emilmont | 1:fdd22bb7aa52 | 5379 | * The library provides separate functions for Q31 and floating-point data types. |
emilmont | 1:fdd22bb7aa52 | 5380 | * \par Algorithm |
emilmont | 1:fdd22bb7aa52 | 5381 | * \image html parkInvFormula.gif |
mbed_official | 3:7a284390b0ce | 5382 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components, |
mbed_official | 3:7a284390b0ce | 5383 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
emilmont | 1:fdd22bb7aa52 | 5384 | * cosine and sine values of theta (rotor flux position). |
emilmont | 1:fdd22bb7aa52 | 5385 | * \par Fixed-Point Behavior |
emilmont | 1:fdd22bb7aa52 | 5386 | * Care must be taken when using the Q31 version of the Park transform. |
emilmont | 1:fdd22bb7aa52 | 5387 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
emilmont | 1:fdd22bb7aa52 | 5388 | * Refer to the function specific documentation below for usage guidelines. |
emilmont | 1:fdd22bb7aa52 | 5389 | */ |
emilmont | 1:fdd22bb7aa52 | 5390 | |
emilmont | 1:fdd22bb7aa52 | 5391 | /** |
emilmont | 1:fdd22bb7aa52 | 5392 | * @addtogroup inv_park |
emilmont | 1:fdd22bb7aa52 | 5393 | * @{ |
emilmont | 1:fdd22bb7aa52 | 5394 | */ |
emilmont | 1:fdd22bb7aa52 | 5395 | |
emilmont | 1:fdd22bb7aa52 | 5396 | /** |
emilmont | 1:fdd22bb7aa52 | 5397 | * @brief Floating-point Inverse Park transform |
emilmont | 1:fdd22bb7aa52 | 5398 | * @param[in] Id input coordinate of rotor reference frame d |
emilmont | 1:fdd22bb7aa52 | 5399 | * @param[in] Iq input coordinate of rotor reference frame q |
emilmont | 1:fdd22bb7aa52 | 5400 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emilmont | 1:fdd22bb7aa52 | 5401 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emilmont | 1:fdd22bb7aa52 | 5402 | * @param[in] sinVal sine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5403 | * @param[in] cosVal cosine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5404 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5405 | */ |
emilmont | 1:fdd22bb7aa52 | 5406 | |
mbed_official | 3:7a284390b0ce | 5407 | static __INLINE void arm_inv_park_f32( |
emilmont | 1:fdd22bb7aa52 | 5408 | float32_t Id, |
emilmont | 1:fdd22bb7aa52 | 5409 | float32_t Iq, |
emilmont | 1:fdd22bb7aa52 | 5410 | float32_t * pIalpha, |
emilmont | 1:fdd22bb7aa52 | 5411 | float32_t * pIbeta, |
emilmont | 1:fdd22bb7aa52 | 5412 | float32_t sinVal, |
emilmont | 1:fdd22bb7aa52 | 5413 | float32_t cosVal) |
emilmont | 1:fdd22bb7aa52 | 5414 | { |
emilmont | 1:fdd22bb7aa52 | 5415 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ |
emilmont | 1:fdd22bb7aa52 | 5416 | *pIalpha = Id * cosVal - Iq * sinVal; |
emilmont | 1:fdd22bb7aa52 | 5417 | |
emilmont | 1:fdd22bb7aa52 | 5418 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ |
emilmont | 1:fdd22bb7aa52 | 5419 | *pIbeta = Id * sinVal + Iq * cosVal; |
emilmont | 1:fdd22bb7aa52 | 5420 | |
emilmont | 1:fdd22bb7aa52 | 5421 | } |
emilmont | 1:fdd22bb7aa52 | 5422 | |
emilmont | 1:fdd22bb7aa52 | 5423 | |
emilmont | 1:fdd22bb7aa52 | 5424 | /** |
mbed_official | 3:7a284390b0ce | 5425 | * @brief Inverse Park transform for Q31 version |
emilmont | 1:fdd22bb7aa52 | 5426 | * @param[in] Id input coordinate of rotor reference frame d |
emilmont | 1:fdd22bb7aa52 | 5427 | * @param[in] Iq input coordinate of rotor reference frame q |
emilmont | 1:fdd22bb7aa52 | 5428 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
emilmont | 1:fdd22bb7aa52 | 5429 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
emilmont | 1:fdd22bb7aa52 | 5430 | * @param[in] sinVal sine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5431 | * @param[in] cosVal cosine value of rotation angle theta |
emilmont | 1:fdd22bb7aa52 | 5432 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5433 | * |
emilmont | 1:fdd22bb7aa52 | 5434 | * <b>Scaling and Overflow Behavior:</b> |
emilmont | 1:fdd22bb7aa52 | 5435 | * \par |
emilmont | 1:fdd22bb7aa52 | 5436 | * The function is implemented using an internal 32-bit accumulator. |
emilmont | 1:fdd22bb7aa52 | 5437 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
emilmont | 1:fdd22bb7aa52 | 5438 | * There is saturation on the addition, hence there is no risk of overflow. |
emilmont | 1:fdd22bb7aa52 | 5439 | */ |
emilmont | 1:fdd22bb7aa52 | 5440 | |
emilmont | 1:fdd22bb7aa52 | 5441 | |
mbed_official | 3:7a284390b0ce | 5442 | static __INLINE void arm_inv_park_q31( |
emilmont | 1:fdd22bb7aa52 | 5443 | q31_t Id, |
emilmont | 1:fdd22bb7aa52 | 5444 | q31_t Iq, |
emilmont | 1:fdd22bb7aa52 | 5445 | q31_t * pIalpha, |
emilmont | 1:fdd22bb7aa52 | 5446 | q31_t * pIbeta, |
emilmont | 1:fdd22bb7aa52 | 5447 | q31_t sinVal, |
emilmont | 1:fdd22bb7aa52 | 5448 | q31_t cosVal) |
emilmont | 1:fdd22bb7aa52 | 5449 | { |
emilmont | 1:fdd22bb7aa52 | 5450 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
emilmont | 1:fdd22bb7aa52 | 5451 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
emilmont | 1:fdd22bb7aa52 | 5452 | |
emilmont | 1:fdd22bb7aa52 | 5453 | /* Intermediate product is calculated by (Id * cosVal) */ |
emilmont | 1:fdd22bb7aa52 | 5454 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5455 | |
emilmont | 1:fdd22bb7aa52 | 5456 | /* Intermediate product is calculated by (Iq * sinVal) */ |
emilmont | 1:fdd22bb7aa52 | 5457 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5458 | |
emilmont | 1:fdd22bb7aa52 | 5459 | |
emilmont | 1:fdd22bb7aa52 | 5460 | /* Intermediate product is calculated by (Id * sinVal) */ |
emilmont | 1:fdd22bb7aa52 | 5461 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5462 | |
emilmont | 1:fdd22bb7aa52 | 5463 | /* Intermediate product is calculated by (Iq * cosVal) */ |
emilmont | 1:fdd22bb7aa52 | 5464 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); |
emilmont | 1:fdd22bb7aa52 | 5465 | |
emilmont | 1:fdd22bb7aa52 | 5466 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */ |
emilmont | 1:fdd22bb7aa52 | 5467 | *pIalpha = __QSUB(product1, product2); |
emilmont | 1:fdd22bb7aa52 | 5468 | |
emilmont | 1:fdd22bb7aa52 | 5469 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */ |
emilmont | 1:fdd22bb7aa52 | 5470 | *pIbeta = __QADD(product4, product3); |
emilmont | 1:fdd22bb7aa52 | 5471 | |
emilmont | 1:fdd22bb7aa52 | 5472 | } |
emilmont | 1:fdd22bb7aa52 | 5473 | |
emilmont | 1:fdd22bb7aa52 | 5474 | /** |
emilmont | 1:fdd22bb7aa52 | 5475 | * @} end of Inverse park group |
emilmont | 1:fdd22bb7aa52 | 5476 | */ |
emilmont | 1:fdd22bb7aa52 | 5477 | |
emilmont | 1:fdd22bb7aa52 | 5478 | |
emilmont | 1:fdd22bb7aa52 | 5479 | /** |
emilmont | 1:fdd22bb7aa52 | 5480 | * @brief Converts the elements of the Q31 vector to floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 5481 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 5482 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 5483 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 5484 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 5485 | */ |
emilmont | 1:fdd22bb7aa52 | 5486 | void arm_q31_to_float( |
emilmont | 1:fdd22bb7aa52 | 5487 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 5488 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 5489 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 5490 | |
emilmont | 1:fdd22bb7aa52 | 5491 | /** |
emilmont | 1:fdd22bb7aa52 | 5492 | * @ingroup groupInterpolation |
emilmont | 1:fdd22bb7aa52 | 5493 | */ |
emilmont | 1:fdd22bb7aa52 | 5494 | |
emilmont | 1:fdd22bb7aa52 | 5495 | /** |
emilmont | 1:fdd22bb7aa52 | 5496 | * @defgroup LinearInterpolate Linear Interpolation |
emilmont | 1:fdd22bb7aa52 | 5497 | * |
emilmont | 1:fdd22bb7aa52 | 5498 | * Linear interpolation is a method of curve fitting using linear polynomials. |
emilmont | 1:fdd22bb7aa52 | 5499 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line |
emilmont | 1:fdd22bb7aa52 | 5500 | * |
mbed_official | 3:7a284390b0ce | 5501 | * \par |
emilmont | 1:fdd22bb7aa52 | 5502 | * \image html LinearInterp.gif "Linear interpolation" |
emilmont | 1:fdd22bb7aa52 | 5503 | * |
emilmont | 1:fdd22bb7aa52 | 5504 | * \par |
emilmont | 1:fdd22bb7aa52 | 5505 | * A Linear Interpolate function calculates an output value(y), for the input(x) |
emilmont | 1:fdd22bb7aa52 | 5506 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) |
emilmont | 1:fdd22bb7aa52 | 5507 | * |
emilmont | 1:fdd22bb7aa52 | 5508 | * \par Algorithm: |
emilmont | 1:fdd22bb7aa52 | 5509 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 5510 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0)) |
emilmont | 1:fdd22bb7aa52 | 5511 | * where x0, x1 are nearest values of input x |
emilmont | 1:fdd22bb7aa52 | 5512 | * y0, y1 are nearest values to output y |
emilmont | 1:fdd22bb7aa52 | 5513 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 5514 | * |
emilmont | 1:fdd22bb7aa52 | 5515 | * \par |
emilmont | 1:fdd22bb7aa52 | 5516 | * This set of functions implements Linear interpolation process |
emilmont | 1:fdd22bb7aa52 | 5517 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single |
emilmont | 1:fdd22bb7aa52 | 5518 | * sample of data and each call to the function returns a single processed value. |
emilmont | 1:fdd22bb7aa52 | 5519 | * <code>S</code> points to an instance of the Linear Interpolate function data structure. |
emilmont | 1:fdd22bb7aa52 | 5520 | * <code>x</code> is the input sample value. The functions returns the output value. |
mbed_official | 3:7a284390b0ce | 5521 | * |
emilmont | 1:fdd22bb7aa52 | 5522 | * \par |
mbed_official | 3:7a284390b0ce | 5523 | * if x is outside of the table boundary, Linear interpolation returns first value of the table |
mbed_official | 3:7a284390b0ce | 5524 | * if x is below input range and returns last value of table if x is above range. |
emilmont | 1:fdd22bb7aa52 | 5525 | */ |
emilmont | 1:fdd22bb7aa52 | 5526 | |
emilmont | 1:fdd22bb7aa52 | 5527 | /** |
emilmont | 1:fdd22bb7aa52 | 5528 | * @addtogroup LinearInterpolate |
emilmont | 1:fdd22bb7aa52 | 5529 | * @{ |
emilmont | 1:fdd22bb7aa52 | 5530 | */ |
emilmont | 1:fdd22bb7aa52 | 5531 | |
emilmont | 1:fdd22bb7aa52 | 5532 | /** |
emilmont | 1:fdd22bb7aa52 | 5533 | * @brief Process function for the floating-point Linear Interpolation Function. |
emilmont | 1:fdd22bb7aa52 | 5534 | * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure |
emilmont | 1:fdd22bb7aa52 | 5535 | * @param[in] x input sample to process |
emilmont | 1:fdd22bb7aa52 | 5536 | * @return y processed output sample. |
emilmont | 1:fdd22bb7aa52 | 5537 | * |
emilmont | 1:fdd22bb7aa52 | 5538 | */ |
emilmont | 1:fdd22bb7aa52 | 5539 | |
mbed_official | 3:7a284390b0ce | 5540 | static __INLINE float32_t arm_linear_interp_f32( |
emilmont | 1:fdd22bb7aa52 | 5541 | arm_linear_interp_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 5542 | float32_t x) |
emilmont | 1:fdd22bb7aa52 | 5543 | { |
emilmont | 1:fdd22bb7aa52 | 5544 | |
emilmont | 1:fdd22bb7aa52 | 5545 | float32_t y; |
emilmont | 1:fdd22bb7aa52 | 5546 | float32_t x0, x1; /* Nearest input values */ |
emilmont | 1:fdd22bb7aa52 | 5547 | float32_t y0, y1; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5548 | float32_t xSpacing = S->xSpacing; /* spacing between input values */ |
emilmont | 1:fdd22bb7aa52 | 5549 | int32_t i; /* Index variable */ |
emilmont | 1:fdd22bb7aa52 | 5550 | float32_t *pYData = S->pYData; /* pointer to output table */ |
emilmont | 1:fdd22bb7aa52 | 5551 | |
emilmont | 1:fdd22bb7aa52 | 5552 | /* Calculation of index */ |
mbed_official | 3:7a284390b0ce | 5553 | i = (int32_t) ((x - S->x1) / xSpacing); |
emilmont | 1:fdd22bb7aa52 | 5554 | |
emilmont | 1:fdd22bb7aa52 | 5555 | if(i < 0) |
emilmont | 1:fdd22bb7aa52 | 5556 | { |
emilmont | 1:fdd22bb7aa52 | 5557 | /* Iniatilize output for below specified range as least output value of table */ |
emilmont | 1:fdd22bb7aa52 | 5558 | y = pYData[0]; |
emilmont | 1:fdd22bb7aa52 | 5559 | } |
mbed_official | 3:7a284390b0ce | 5560 | else if((uint32_t)i >= S->nValues) |
emilmont | 1:fdd22bb7aa52 | 5561 | { |
emilmont | 1:fdd22bb7aa52 | 5562 | /* Iniatilize output for above specified range as last output value of table */ |
emilmont | 1:fdd22bb7aa52 | 5563 | y = pYData[S->nValues - 1]; |
emilmont | 1:fdd22bb7aa52 | 5564 | } |
emilmont | 1:fdd22bb7aa52 | 5565 | else |
emilmont | 1:fdd22bb7aa52 | 5566 | { |
emilmont | 1:fdd22bb7aa52 | 5567 | /* Calculation of nearest input values */ |
emilmont | 1:fdd22bb7aa52 | 5568 | x0 = S->x1 + i * xSpacing; |
emilmont | 1:fdd22bb7aa52 | 5569 | x1 = S->x1 + (i + 1) * xSpacing; |
emilmont | 1:fdd22bb7aa52 | 5570 | |
emilmont | 1:fdd22bb7aa52 | 5571 | /* Read of nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5572 | y0 = pYData[i]; |
emilmont | 1:fdd22bb7aa52 | 5573 | y1 = pYData[i + 1]; |
emilmont | 1:fdd22bb7aa52 | 5574 | |
emilmont | 1:fdd22bb7aa52 | 5575 | /* Calculation of output */ |
emilmont | 1:fdd22bb7aa52 | 5576 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); |
emilmont | 1:fdd22bb7aa52 | 5577 | |
emilmont | 1:fdd22bb7aa52 | 5578 | } |
emilmont | 1:fdd22bb7aa52 | 5579 | |
emilmont | 1:fdd22bb7aa52 | 5580 | /* returns output value */ |
emilmont | 1:fdd22bb7aa52 | 5581 | return (y); |
emilmont | 1:fdd22bb7aa52 | 5582 | } |
emilmont | 1:fdd22bb7aa52 | 5583 | |
emilmont | 1:fdd22bb7aa52 | 5584 | /** |
emilmont | 1:fdd22bb7aa52 | 5585 | * |
emilmont | 1:fdd22bb7aa52 | 5586 | * @brief Process function for the Q31 Linear Interpolation Function. |
emilmont | 1:fdd22bb7aa52 | 5587 | * @param[in] *pYData pointer to Q31 Linear Interpolation table |
emilmont | 1:fdd22bb7aa52 | 5588 | * @param[in] x input sample to process |
emilmont | 1:fdd22bb7aa52 | 5589 | * @param[in] nValues number of table values |
emilmont | 1:fdd22bb7aa52 | 5590 | * @return y processed output sample. |
emilmont | 1:fdd22bb7aa52 | 5591 | * |
emilmont | 1:fdd22bb7aa52 | 5592 | * \par |
emilmont | 1:fdd22bb7aa52 | 5593 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
emilmont | 1:fdd22bb7aa52 | 5594 | * This function can support maximum of table size 2^12. |
emilmont | 1:fdd22bb7aa52 | 5595 | * |
emilmont | 1:fdd22bb7aa52 | 5596 | */ |
emilmont | 1:fdd22bb7aa52 | 5597 | |
emilmont | 1:fdd22bb7aa52 | 5598 | |
mbed_official | 3:7a284390b0ce | 5599 | static __INLINE q31_t arm_linear_interp_q31( |
emilmont | 1:fdd22bb7aa52 | 5600 | q31_t * pYData, |
emilmont | 1:fdd22bb7aa52 | 5601 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 5602 | uint32_t nValues) |
emilmont | 1:fdd22bb7aa52 | 5603 | { |
emilmont | 1:fdd22bb7aa52 | 5604 | q31_t y; /* output */ |
emilmont | 1:fdd22bb7aa52 | 5605 | q31_t y0, y1; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5606 | q31_t fract; /* fractional part */ |
emilmont | 1:fdd22bb7aa52 | 5607 | int32_t index; /* Index to read nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5608 | |
emilmont | 1:fdd22bb7aa52 | 5609 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 5610 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 5611 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 5612 | index = ((x & 0xFFF00000) >> 20); |
emilmont | 1:fdd22bb7aa52 | 5613 | |
mbed_official | 3:7a284390b0ce | 5614 | if(index >= (int32_t)(nValues - 1)) |
emilmont | 1:fdd22bb7aa52 | 5615 | { |
emilmont | 1:fdd22bb7aa52 | 5616 | return (pYData[nValues - 1]); |
emilmont | 1:fdd22bb7aa52 | 5617 | } |
emilmont | 1:fdd22bb7aa52 | 5618 | else if(index < 0) |
emilmont | 1:fdd22bb7aa52 | 5619 | { |
emilmont | 1:fdd22bb7aa52 | 5620 | return (pYData[0]); |
emilmont | 1:fdd22bb7aa52 | 5621 | } |
emilmont | 1:fdd22bb7aa52 | 5622 | else |
emilmont | 1:fdd22bb7aa52 | 5623 | { |
emilmont | 1:fdd22bb7aa52 | 5624 | |
emilmont | 1:fdd22bb7aa52 | 5625 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 5626 | /* shift left by 11 to keep fract in 1.31 format */ |
emilmont | 1:fdd22bb7aa52 | 5627 | fract = (x & 0x000FFFFF) << 11; |
emilmont | 1:fdd22bb7aa52 | 5628 | |
emilmont | 1:fdd22bb7aa52 | 5629 | /* Read two nearest output values from the index in 1.31(q31) format */ |
emilmont | 1:fdd22bb7aa52 | 5630 | y0 = pYData[index]; |
emilmont | 1:fdd22bb7aa52 | 5631 | y1 = pYData[index + 1u]; |
emilmont | 1:fdd22bb7aa52 | 5632 | |
emilmont | 1:fdd22bb7aa52 | 5633 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */ |
emilmont | 1:fdd22bb7aa52 | 5634 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 5635 | |
emilmont | 1:fdd22bb7aa52 | 5636 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ |
emilmont | 1:fdd22bb7aa52 | 5637 | y += ((q31_t) (((q63_t) y1 * fract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 5638 | |
emilmont | 1:fdd22bb7aa52 | 5639 | /* Convert y to 1.31 format */ |
emilmont | 1:fdd22bb7aa52 | 5640 | return (y << 1u); |
emilmont | 1:fdd22bb7aa52 | 5641 | |
emilmont | 1:fdd22bb7aa52 | 5642 | } |
emilmont | 1:fdd22bb7aa52 | 5643 | |
emilmont | 1:fdd22bb7aa52 | 5644 | } |
emilmont | 1:fdd22bb7aa52 | 5645 | |
emilmont | 1:fdd22bb7aa52 | 5646 | /** |
emilmont | 1:fdd22bb7aa52 | 5647 | * |
emilmont | 1:fdd22bb7aa52 | 5648 | * @brief Process function for the Q15 Linear Interpolation Function. |
emilmont | 1:fdd22bb7aa52 | 5649 | * @param[in] *pYData pointer to Q15 Linear Interpolation table |
emilmont | 1:fdd22bb7aa52 | 5650 | * @param[in] x input sample to process |
emilmont | 1:fdd22bb7aa52 | 5651 | * @param[in] nValues number of table values |
emilmont | 1:fdd22bb7aa52 | 5652 | * @return y processed output sample. |
emilmont | 1:fdd22bb7aa52 | 5653 | * |
emilmont | 1:fdd22bb7aa52 | 5654 | * \par |
emilmont | 1:fdd22bb7aa52 | 5655 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
mbed_official | 3:7a284390b0ce | 5656 | * This function can support maximum of table size 2^12. |
emilmont | 1:fdd22bb7aa52 | 5657 | * |
emilmont | 1:fdd22bb7aa52 | 5658 | */ |
emilmont | 1:fdd22bb7aa52 | 5659 | |
emilmont | 1:fdd22bb7aa52 | 5660 | |
mbed_official | 3:7a284390b0ce | 5661 | static __INLINE q15_t arm_linear_interp_q15( |
emilmont | 1:fdd22bb7aa52 | 5662 | q15_t * pYData, |
emilmont | 1:fdd22bb7aa52 | 5663 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 5664 | uint32_t nValues) |
emilmont | 1:fdd22bb7aa52 | 5665 | { |
emilmont | 1:fdd22bb7aa52 | 5666 | q63_t y; /* output */ |
emilmont | 1:fdd22bb7aa52 | 5667 | q15_t y0, y1; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5668 | q31_t fract; /* fractional part */ |
emilmont | 1:fdd22bb7aa52 | 5669 | int32_t index; /* Index to read nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5670 | |
emilmont | 1:fdd22bb7aa52 | 5671 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 5672 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 5673 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 5674 | index = ((x & 0xFFF00000) >> 20u); |
emilmont | 1:fdd22bb7aa52 | 5675 | |
mbed_official | 3:7a284390b0ce | 5676 | if(index >= (int32_t)(nValues - 1)) |
emilmont | 1:fdd22bb7aa52 | 5677 | { |
emilmont | 1:fdd22bb7aa52 | 5678 | return (pYData[nValues - 1]); |
emilmont | 1:fdd22bb7aa52 | 5679 | } |
emilmont | 1:fdd22bb7aa52 | 5680 | else if(index < 0) |
emilmont | 1:fdd22bb7aa52 | 5681 | { |
emilmont | 1:fdd22bb7aa52 | 5682 | return (pYData[0]); |
emilmont | 1:fdd22bb7aa52 | 5683 | } |
emilmont | 1:fdd22bb7aa52 | 5684 | else |
emilmont | 1:fdd22bb7aa52 | 5685 | { |
emilmont | 1:fdd22bb7aa52 | 5686 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 5687 | /* fract is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 5688 | fract = (x & 0x000FFFFF); |
emilmont | 1:fdd22bb7aa52 | 5689 | |
emilmont | 1:fdd22bb7aa52 | 5690 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 5691 | y0 = pYData[index]; |
emilmont | 1:fdd22bb7aa52 | 5692 | y1 = pYData[index + 1u]; |
emilmont | 1:fdd22bb7aa52 | 5693 | |
emilmont | 1:fdd22bb7aa52 | 5694 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */ |
emilmont | 1:fdd22bb7aa52 | 5695 | y = ((q63_t) y0 * (0xFFFFF - fract)); |
emilmont | 1:fdd22bb7aa52 | 5696 | |
emilmont | 1:fdd22bb7aa52 | 5697 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ |
emilmont | 1:fdd22bb7aa52 | 5698 | y += ((q63_t) y1 * (fract)); |
emilmont | 1:fdd22bb7aa52 | 5699 | |
emilmont | 1:fdd22bb7aa52 | 5700 | /* convert y to 1.15 format */ |
emilmont | 1:fdd22bb7aa52 | 5701 | return (y >> 20); |
emilmont | 1:fdd22bb7aa52 | 5702 | } |
emilmont | 1:fdd22bb7aa52 | 5703 | |
emilmont | 1:fdd22bb7aa52 | 5704 | |
emilmont | 1:fdd22bb7aa52 | 5705 | } |
emilmont | 1:fdd22bb7aa52 | 5706 | |
emilmont | 1:fdd22bb7aa52 | 5707 | /** |
emilmont | 1:fdd22bb7aa52 | 5708 | * |
emilmont | 1:fdd22bb7aa52 | 5709 | * @brief Process function for the Q7 Linear Interpolation Function. |
emilmont | 1:fdd22bb7aa52 | 5710 | * @param[in] *pYData pointer to Q7 Linear Interpolation table |
emilmont | 1:fdd22bb7aa52 | 5711 | * @param[in] x input sample to process |
emilmont | 1:fdd22bb7aa52 | 5712 | * @param[in] nValues number of table values |
emilmont | 1:fdd22bb7aa52 | 5713 | * @return y processed output sample. |
emilmont | 1:fdd22bb7aa52 | 5714 | * |
emilmont | 1:fdd22bb7aa52 | 5715 | * \par |
emilmont | 1:fdd22bb7aa52 | 5716 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
emilmont | 1:fdd22bb7aa52 | 5717 | * This function can support maximum of table size 2^12. |
emilmont | 1:fdd22bb7aa52 | 5718 | */ |
emilmont | 1:fdd22bb7aa52 | 5719 | |
emilmont | 1:fdd22bb7aa52 | 5720 | |
mbed_official | 3:7a284390b0ce | 5721 | static __INLINE q7_t arm_linear_interp_q7( |
emilmont | 1:fdd22bb7aa52 | 5722 | q7_t * pYData, |
emilmont | 1:fdd22bb7aa52 | 5723 | q31_t x, |
emilmont | 1:fdd22bb7aa52 | 5724 | uint32_t nValues) |
emilmont | 1:fdd22bb7aa52 | 5725 | { |
emilmont | 1:fdd22bb7aa52 | 5726 | q31_t y; /* output */ |
emilmont | 1:fdd22bb7aa52 | 5727 | q7_t y0, y1; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5728 | q31_t fract; /* fractional part */ |
mbed_official | 3:7a284390b0ce | 5729 | uint32_t index; /* Index to read nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 5730 | |
emilmont | 1:fdd22bb7aa52 | 5731 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 5732 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 5733 | /* Index value calculation */ |
mbed_official | 3:7a284390b0ce | 5734 | if (x < 0) |
mbed_official | 3:7a284390b0ce | 5735 | { |
mbed_official | 3:7a284390b0ce | 5736 | return (pYData[0]); |
mbed_official | 3:7a284390b0ce | 5737 | } |
mbed_official | 3:7a284390b0ce | 5738 | index = (x >> 20) & 0xfff; |
emilmont | 1:fdd22bb7aa52 | 5739 | |
emilmont | 1:fdd22bb7aa52 | 5740 | |
emilmont | 1:fdd22bb7aa52 | 5741 | if(index >= (nValues - 1)) |
emilmont | 1:fdd22bb7aa52 | 5742 | { |
emilmont | 1:fdd22bb7aa52 | 5743 | return (pYData[nValues - 1]); |
emilmont | 1:fdd22bb7aa52 | 5744 | } |
emilmont | 1:fdd22bb7aa52 | 5745 | else |
emilmont | 1:fdd22bb7aa52 | 5746 | { |
emilmont | 1:fdd22bb7aa52 | 5747 | |
emilmont | 1:fdd22bb7aa52 | 5748 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 5749 | /* fract is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 5750 | fract = (x & 0x000FFFFF); |
emilmont | 1:fdd22bb7aa52 | 5751 | |
emilmont | 1:fdd22bb7aa52 | 5752 | /* Read two nearest output values from the index and are in 1.7(q7) format */ |
emilmont | 1:fdd22bb7aa52 | 5753 | y0 = pYData[index]; |
emilmont | 1:fdd22bb7aa52 | 5754 | y1 = pYData[index + 1u]; |
emilmont | 1:fdd22bb7aa52 | 5755 | |
emilmont | 1:fdd22bb7aa52 | 5756 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ |
emilmont | 1:fdd22bb7aa52 | 5757 | y = ((y0 * (0xFFFFF - fract))); |
emilmont | 1:fdd22bb7aa52 | 5758 | |
emilmont | 1:fdd22bb7aa52 | 5759 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ |
emilmont | 1:fdd22bb7aa52 | 5760 | y += (y1 * fract); |
emilmont | 1:fdd22bb7aa52 | 5761 | |
emilmont | 1:fdd22bb7aa52 | 5762 | /* convert y to 1.7(q7) format */ |
emilmont | 1:fdd22bb7aa52 | 5763 | return (y >> 20u); |
emilmont | 1:fdd22bb7aa52 | 5764 | |
emilmont | 1:fdd22bb7aa52 | 5765 | } |
emilmont | 1:fdd22bb7aa52 | 5766 | |
emilmont | 1:fdd22bb7aa52 | 5767 | } |
emilmont | 1:fdd22bb7aa52 | 5768 | /** |
emilmont | 1:fdd22bb7aa52 | 5769 | * @} end of LinearInterpolate group |
emilmont | 1:fdd22bb7aa52 | 5770 | */ |
emilmont | 1:fdd22bb7aa52 | 5771 | |
emilmont | 1:fdd22bb7aa52 | 5772 | /** |
emilmont | 1:fdd22bb7aa52 | 5773 | * @brief Fast approximation to the trigonometric sine function for floating-point data. |
emilmont | 1:fdd22bb7aa52 | 5774 | * @param[in] x input value in radians. |
emilmont | 1:fdd22bb7aa52 | 5775 | * @return sin(x). |
emilmont | 1:fdd22bb7aa52 | 5776 | */ |
emilmont | 1:fdd22bb7aa52 | 5777 | |
emilmont | 1:fdd22bb7aa52 | 5778 | float32_t arm_sin_f32( |
emilmont | 1:fdd22bb7aa52 | 5779 | float32_t x); |
emilmont | 1:fdd22bb7aa52 | 5780 | |
emilmont | 1:fdd22bb7aa52 | 5781 | /** |
emilmont | 1:fdd22bb7aa52 | 5782 | * @brief Fast approximation to the trigonometric sine function for Q31 data. |
emilmont | 1:fdd22bb7aa52 | 5783 | * @param[in] x Scaled input value in radians. |
emilmont | 1:fdd22bb7aa52 | 5784 | * @return sin(x). |
emilmont | 1:fdd22bb7aa52 | 5785 | */ |
emilmont | 1:fdd22bb7aa52 | 5786 | |
emilmont | 1:fdd22bb7aa52 | 5787 | q31_t arm_sin_q31( |
emilmont | 1:fdd22bb7aa52 | 5788 | q31_t x); |
emilmont | 1:fdd22bb7aa52 | 5789 | |
emilmont | 1:fdd22bb7aa52 | 5790 | /** |
emilmont | 1:fdd22bb7aa52 | 5791 | * @brief Fast approximation to the trigonometric sine function for Q15 data. |
emilmont | 1:fdd22bb7aa52 | 5792 | * @param[in] x Scaled input value in radians. |
emilmont | 1:fdd22bb7aa52 | 5793 | * @return sin(x). |
emilmont | 1:fdd22bb7aa52 | 5794 | */ |
emilmont | 1:fdd22bb7aa52 | 5795 | |
emilmont | 1:fdd22bb7aa52 | 5796 | q15_t arm_sin_q15( |
emilmont | 1:fdd22bb7aa52 | 5797 | q15_t x); |
emilmont | 1:fdd22bb7aa52 | 5798 | |
emilmont | 1:fdd22bb7aa52 | 5799 | /** |
emilmont | 1:fdd22bb7aa52 | 5800 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. |
emilmont | 1:fdd22bb7aa52 | 5801 | * @param[in] x input value in radians. |
emilmont | 1:fdd22bb7aa52 | 5802 | * @return cos(x). |
emilmont | 1:fdd22bb7aa52 | 5803 | */ |
emilmont | 1:fdd22bb7aa52 | 5804 | |
emilmont | 1:fdd22bb7aa52 | 5805 | float32_t arm_cos_f32( |
emilmont | 1:fdd22bb7aa52 | 5806 | float32_t x); |
emilmont | 1:fdd22bb7aa52 | 5807 | |
emilmont | 1:fdd22bb7aa52 | 5808 | /** |
emilmont | 1:fdd22bb7aa52 | 5809 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. |
emilmont | 1:fdd22bb7aa52 | 5810 | * @param[in] x Scaled input value in radians. |
emilmont | 1:fdd22bb7aa52 | 5811 | * @return cos(x). |
emilmont | 1:fdd22bb7aa52 | 5812 | */ |
emilmont | 1:fdd22bb7aa52 | 5813 | |
emilmont | 1:fdd22bb7aa52 | 5814 | q31_t arm_cos_q31( |
emilmont | 1:fdd22bb7aa52 | 5815 | q31_t x); |
emilmont | 1:fdd22bb7aa52 | 5816 | |
emilmont | 1:fdd22bb7aa52 | 5817 | /** |
emilmont | 1:fdd22bb7aa52 | 5818 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. |
emilmont | 1:fdd22bb7aa52 | 5819 | * @param[in] x Scaled input value in radians. |
emilmont | 1:fdd22bb7aa52 | 5820 | * @return cos(x). |
emilmont | 1:fdd22bb7aa52 | 5821 | */ |
emilmont | 1:fdd22bb7aa52 | 5822 | |
emilmont | 1:fdd22bb7aa52 | 5823 | q15_t arm_cos_q15( |
emilmont | 1:fdd22bb7aa52 | 5824 | q15_t x); |
emilmont | 1:fdd22bb7aa52 | 5825 | |
emilmont | 1:fdd22bb7aa52 | 5826 | |
emilmont | 1:fdd22bb7aa52 | 5827 | /** |
emilmont | 1:fdd22bb7aa52 | 5828 | * @ingroup groupFastMath |
emilmont | 1:fdd22bb7aa52 | 5829 | */ |
emilmont | 1:fdd22bb7aa52 | 5830 | |
emilmont | 1:fdd22bb7aa52 | 5831 | |
emilmont | 1:fdd22bb7aa52 | 5832 | /** |
emilmont | 1:fdd22bb7aa52 | 5833 | * @defgroup SQRT Square Root |
emilmont | 1:fdd22bb7aa52 | 5834 | * |
emilmont | 1:fdd22bb7aa52 | 5835 | * Computes the square root of a number. |
mbed_official | 3:7a284390b0ce | 5836 | * There are separate functions for Q15, Q31, and floating-point data types. |
emilmont | 1:fdd22bb7aa52 | 5837 | * The square root function is computed using the Newton-Raphson algorithm. |
emilmont | 1:fdd22bb7aa52 | 5838 | * This is an iterative algorithm of the form: |
emilmont | 1:fdd22bb7aa52 | 5839 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 5840 | * x1 = x0 - f(x0)/f'(x0) |
emilmont | 1:fdd22bb7aa52 | 5841 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 5842 | * where <code>x1</code> is the current estimate, |
mbed_official | 3:7a284390b0ce | 5843 | * <code>x0</code> is the previous estimate, and |
emilmont | 1:fdd22bb7aa52 | 5844 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>. |
emilmont | 1:fdd22bb7aa52 | 5845 | * For the square root function, the algorithm reduces to: |
emilmont | 1:fdd22bb7aa52 | 5846 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 5847 | * x0 = in/2 [initial guess] |
emilmont | 1:fdd22bb7aa52 | 5848 | * x1 = 1/2 * ( x0 + in / x0) [each iteration] |
emilmont | 1:fdd22bb7aa52 | 5849 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 5850 | */ |
emilmont | 1:fdd22bb7aa52 | 5851 | |
emilmont | 1:fdd22bb7aa52 | 5852 | |
emilmont | 1:fdd22bb7aa52 | 5853 | /** |
emilmont | 1:fdd22bb7aa52 | 5854 | * @addtogroup SQRT |
emilmont | 1:fdd22bb7aa52 | 5855 | * @{ |
emilmont | 1:fdd22bb7aa52 | 5856 | */ |
emilmont | 1:fdd22bb7aa52 | 5857 | |
emilmont | 1:fdd22bb7aa52 | 5858 | /** |
emilmont | 1:fdd22bb7aa52 | 5859 | * @brief Floating-point square root function. |
emilmont | 1:fdd22bb7aa52 | 5860 | * @param[in] in input value. |
emilmont | 1:fdd22bb7aa52 | 5861 | * @param[out] *pOut square root of input value. |
emilmont | 1:fdd22bb7aa52 | 5862 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
emilmont | 1:fdd22bb7aa52 | 5863 | * <code>in</code> is negative value and returns zero output for negative values. |
emilmont | 1:fdd22bb7aa52 | 5864 | */ |
emilmont | 1:fdd22bb7aa52 | 5865 | |
mbed_official | 3:7a284390b0ce | 5866 | static __INLINE arm_status arm_sqrt_f32( |
emilmont | 1:fdd22bb7aa52 | 5867 | float32_t in, |
emilmont | 1:fdd22bb7aa52 | 5868 | float32_t * pOut) |
emilmont | 1:fdd22bb7aa52 | 5869 | { |
emilmont | 1:fdd22bb7aa52 | 5870 | if(in > 0) |
emilmont | 1:fdd22bb7aa52 | 5871 | { |
emilmont | 1:fdd22bb7aa52 | 5872 | |
mbed_official | 3:7a284390b0ce | 5873 | // #if __FPU_USED |
mbed_official | 3:7a284390b0ce | 5874 | #if (__FPU_USED == 1) && defined ( __CC_ARM ) |
mbed_official | 3:7a284390b0ce | 5875 | *pOut = __sqrtf(in); |
mbed_official | 3:7a284390b0ce | 5876 | #else |
mbed_official | 3:7a284390b0ce | 5877 | *pOut = sqrtf(in); |
mbed_official | 3:7a284390b0ce | 5878 | #endif |
emilmont | 1:fdd22bb7aa52 | 5879 | |
emilmont | 1:fdd22bb7aa52 | 5880 | return (ARM_MATH_SUCCESS); |
emilmont | 1:fdd22bb7aa52 | 5881 | } |
emilmont | 1:fdd22bb7aa52 | 5882 | else |
emilmont | 1:fdd22bb7aa52 | 5883 | { |
emilmont | 1:fdd22bb7aa52 | 5884 | *pOut = 0.0f; |
emilmont | 1:fdd22bb7aa52 | 5885 | return (ARM_MATH_ARGUMENT_ERROR); |
emilmont | 1:fdd22bb7aa52 | 5886 | } |
emilmont | 1:fdd22bb7aa52 | 5887 | |
emilmont | 1:fdd22bb7aa52 | 5888 | } |
emilmont | 1:fdd22bb7aa52 | 5889 | |
emilmont | 1:fdd22bb7aa52 | 5890 | |
emilmont | 1:fdd22bb7aa52 | 5891 | /** |
emilmont | 1:fdd22bb7aa52 | 5892 | * @brief Q31 square root function. |
emilmont | 1:fdd22bb7aa52 | 5893 | * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. |
emilmont | 1:fdd22bb7aa52 | 5894 | * @param[out] *pOut square root of input value. |
emilmont | 1:fdd22bb7aa52 | 5895 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
emilmont | 1:fdd22bb7aa52 | 5896 | * <code>in</code> is negative value and returns zero output for negative values. |
emilmont | 1:fdd22bb7aa52 | 5897 | */ |
emilmont | 1:fdd22bb7aa52 | 5898 | arm_status arm_sqrt_q31( |
emilmont | 1:fdd22bb7aa52 | 5899 | q31_t in, |
emilmont | 1:fdd22bb7aa52 | 5900 | q31_t * pOut); |
emilmont | 1:fdd22bb7aa52 | 5901 | |
emilmont | 1:fdd22bb7aa52 | 5902 | /** |
emilmont | 1:fdd22bb7aa52 | 5903 | * @brief Q15 square root function. |
emilmont | 1:fdd22bb7aa52 | 5904 | * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. |
emilmont | 1:fdd22bb7aa52 | 5905 | * @param[out] *pOut square root of input value. |
emilmont | 1:fdd22bb7aa52 | 5906 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
emilmont | 1:fdd22bb7aa52 | 5907 | * <code>in</code> is negative value and returns zero output for negative values. |
emilmont | 1:fdd22bb7aa52 | 5908 | */ |
emilmont | 1:fdd22bb7aa52 | 5909 | arm_status arm_sqrt_q15( |
emilmont | 1:fdd22bb7aa52 | 5910 | q15_t in, |
emilmont | 1:fdd22bb7aa52 | 5911 | q15_t * pOut); |
emilmont | 1:fdd22bb7aa52 | 5912 | |
emilmont | 1:fdd22bb7aa52 | 5913 | /** |
emilmont | 1:fdd22bb7aa52 | 5914 | * @} end of SQRT group |
emilmont | 1:fdd22bb7aa52 | 5915 | */ |
emilmont | 1:fdd22bb7aa52 | 5916 | |
emilmont | 1:fdd22bb7aa52 | 5917 | |
emilmont | 1:fdd22bb7aa52 | 5918 | |
emilmont | 1:fdd22bb7aa52 | 5919 | |
emilmont | 1:fdd22bb7aa52 | 5920 | |
emilmont | 1:fdd22bb7aa52 | 5921 | |
emilmont | 1:fdd22bb7aa52 | 5922 | /** |
emilmont | 1:fdd22bb7aa52 | 5923 | * @brief floating-point Circular write function. |
emilmont | 1:fdd22bb7aa52 | 5924 | */ |
emilmont | 1:fdd22bb7aa52 | 5925 | |
mbed_official | 3:7a284390b0ce | 5926 | static __INLINE void arm_circularWrite_f32( |
emilmont | 1:fdd22bb7aa52 | 5927 | int32_t * circBuffer, |
emilmont | 1:fdd22bb7aa52 | 5928 | int32_t L, |
emilmont | 1:fdd22bb7aa52 | 5929 | uint16_t * writeOffset, |
emilmont | 1:fdd22bb7aa52 | 5930 | int32_t bufferInc, |
emilmont | 1:fdd22bb7aa52 | 5931 | const int32_t * src, |
emilmont | 1:fdd22bb7aa52 | 5932 | int32_t srcInc, |
emilmont | 1:fdd22bb7aa52 | 5933 | uint32_t blockSize) |
emilmont | 1:fdd22bb7aa52 | 5934 | { |
emilmont | 1:fdd22bb7aa52 | 5935 | uint32_t i = 0u; |
emilmont | 1:fdd22bb7aa52 | 5936 | int32_t wOffset; |
emilmont | 1:fdd22bb7aa52 | 5937 | |
emilmont | 1:fdd22bb7aa52 | 5938 | /* Copy the value of Index pointer that points |
emilmont | 1:fdd22bb7aa52 | 5939 | * to the current location where the input samples to be copied */ |
emilmont | 1:fdd22bb7aa52 | 5940 | wOffset = *writeOffset; |
emilmont | 1:fdd22bb7aa52 | 5941 | |
emilmont | 1:fdd22bb7aa52 | 5942 | /* Loop over the blockSize */ |
emilmont | 1:fdd22bb7aa52 | 5943 | i = blockSize; |
emilmont | 1:fdd22bb7aa52 | 5944 | |
emilmont | 1:fdd22bb7aa52 | 5945 | while(i > 0u) |
emilmont | 1:fdd22bb7aa52 | 5946 | { |
emilmont | 1:fdd22bb7aa52 | 5947 | /* copy the input sample to the circular buffer */ |
emilmont | 1:fdd22bb7aa52 | 5948 | circBuffer[wOffset] = *src; |
emilmont | 1:fdd22bb7aa52 | 5949 | |
emilmont | 1:fdd22bb7aa52 | 5950 | /* Update the input pointer */ |
emilmont | 1:fdd22bb7aa52 | 5951 | src += srcInc; |
emilmont | 1:fdd22bb7aa52 | 5952 | |
emilmont | 1:fdd22bb7aa52 | 5953 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emilmont | 1:fdd22bb7aa52 | 5954 | wOffset += bufferInc; |
emilmont | 1:fdd22bb7aa52 | 5955 | if(wOffset >= L) |
emilmont | 1:fdd22bb7aa52 | 5956 | wOffset -= L; |
emilmont | 1:fdd22bb7aa52 | 5957 | |
emilmont | 1:fdd22bb7aa52 | 5958 | /* Decrement the loop counter */ |
emilmont | 1:fdd22bb7aa52 | 5959 | i--; |
emilmont | 1:fdd22bb7aa52 | 5960 | } |
emilmont | 1:fdd22bb7aa52 | 5961 | |
emilmont | 1:fdd22bb7aa52 | 5962 | /* Update the index pointer */ |
emilmont | 1:fdd22bb7aa52 | 5963 | *writeOffset = wOffset; |
emilmont | 1:fdd22bb7aa52 | 5964 | } |
emilmont | 1:fdd22bb7aa52 | 5965 | |
emilmont | 1:fdd22bb7aa52 | 5966 | |
emilmont | 1:fdd22bb7aa52 | 5967 | |
emilmont | 1:fdd22bb7aa52 | 5968 | /** |
emilmont | 1:fdd22bb7aa52 | 5969 | * @brief floating-point Circular Read function. |
emilmont | 1:fdd22bb7aa52 | 5970 | */ |
mbed_official | 3:7a284390b0ce | 5971 | static __INLINE void arm_circularRead_f32( |
emilmont | 1:fdd22bb7aa52 | 5972 | int32_t * circBuffer, |
emilmont | 1:fdd22bb7aa52 | 5973 | int32_t L, |
emilmont | 1:fdd22bb7aa52 | 5974 | int32_t * readOffset, |
emilmont | 1:fdd22bb7aa52 | 5975 | int32_t bufferInc, |
emilmont | 1:fdd22bb7aa52 | 5976 | int32_t * dst, |
emilmont | 1:fdd22bb7aa52 | 5977 | int32_t * dst_base, |
emilmont | 1:fdd22bb7aa52 | 5978 | int32_t dst_length, |
emilmont | 1:fdd22bb7aa52 | 5979 | int32_t dstInc, |
emilmont | 1:fdd22bb7aa52 | 5980 | uint32_t blockSize) |
emilmont | 1:fdd22bb7aa52 | 5981 | { |
emilmont | 1:fdd22bb7aa52 | 5982 | uint32_t i = 0u; |
emilmont | 1:fdd22bb7aa52 | 5983 | int32_t rOffset, dst_end; |
emilmont | 1:fdd22bb7aa52 | 5984 | |
emilmont | 1:fdd22bb7aa52 | 5985 | /* Copy the value of Index pointer that points |
emilmont | 1:fdd22bb7aa52 | 5986 | * to the current location from where the input samples to be read */ |
emilmont | 1:fdd22bb7aa52 | 5987 | rOffset = *readOffset; |
emilmont | 1:fdd22bb7aa52 | 5988 | dst_end = (int32_t) (dst_base + dst_length); |
emilmont | 1:fdd22bb7aa52 | 5989 | |
emilmont | 1:fdd22bb7aa52 | 5990 | /* Loop over the blockSize */ |
emilmont | 1:fdd22bb7aa52 | 5991 | i = blockSize; |
emilmont | 1:fdd22bb7aa52 | 5992 | |
emilmont | 1:fdd22bb7aa52 | 5993 | while(i > 0u) |
emilmont | 1:fdd22bb7aa52 | 5994 | { |
emilmont | 1:fdd22bb7aa52 | 5995 | /* copy the sample from the circular buffer to the destination buffer */ |
emilmont | 1:fdd22bb7aa52 | 5996 | *dst = circBuffer[rOffset]; |
emilmont | 1:fdd22bb7aa52 | 5997 | |
emilmont | 1:fdd22bb7aa52 | 5998 | /* Update the input pointer */ |
emilmont | 1:fdd22bb7aa52 | 5999 | dst += dstInc; |
emilmont | 1:fdd22bb7aa52 | 6000 | |
emilmont | 1:fdd22bb7aa52 | 6001 | if(dst == (int32_t *) dst_end) |
emilmont | 1:fdd22bb7aa52 | 6002 | { |
emilmont | 1:fdd22bb7aa52 | 6003 | dst = dst_base; |
emilmont | 1:fdd22bb7aa52 | 6004 | } |
emilmont | 1:fdd22bb7aa52 | 6005 | |
emilmont | 1:fdd22bb7aa52 | 6006 | /* Circularly update rOffset. Watch out for positive and negative value */ |
emilmont | 1:fdd22bb7aa52 | 6007 | rOffset += bufferInc; |
emilmont | 1:fdd22bb7aa52 | 6008 | |
emilmont | 1:fdd22bb7aa52 | 6009 | if(rOffset >= L) |
emilmont | 1:fdd22bb7aa52 | 6010 | { |
emilmont | 1:fdd22bb7aa52 | 6011 | rOffset -= L; |
emilmont | 1:fdd22bb7aa52 | 6012 | } |
emilmont | 1:fdd22bb7aa52 | 6013 | |
emilmont | 1:fdd22bb7aa52 | 6014 | /* Decrement the loop counter */ |
emilmont | 1:fdd22bb7aa52 | 6015 | i--; |
emilmont | 1:fdd22bb7aa52 | 6016 | } |
emilmont | 1:fdd22bb7aa52 | 6017 | |
emilmont | 1:fdd22bb7aa52 | 6018 | /* Update the index pointer */ |
emilmont | 1:fdd22bb7aa52 | 6019 | *readOffset = rOffset; |
emilmont | 1:fdd22bb7aa52 | 6020 | } |
emilmont | 1:fdd22bb7aa52 | 6021 | |
emilmont | 1:fdd22bb7aa52 | 6022 | /** |
emilmont | 1:fdd22bb7aa52 | 6023 | * @brief Q15 Circular write function. |
emilmont | 1:fdd22bb7aa52 | 6024 | */ |
emilmont | 1:fdd22bb7aa52 | 6025 | |
mbed_official | 3:7a284390b0ce | 6026 | static __INLINE void arm_circularWrite_q15( |
emilmont | 1:fdd22bb7aa52 | 6027 | q15_t * circBuffer, |
emilmont | 1:fdd22bb7aa52 | 6028 | int32_t L, |
emilmont | 1:fdd22bb7aa52 | 6029 | uint16_t * writeOffset, |
emilmont | 1:fdd22bb7aa52 | 6030 | int32_t bufferInc, |
emilmont | 1:fdd22bb7aa52 | 6031 | const q15_t * src, |
emilmont | 1:fdd22bb7aa52 | 6032 | int32_t srcInc, |
emilmont | 1:fdd22bb7aa52 | 6033 | uint32_t blockSize) |
emilmont | 1:fdd22bb7aa52 | 6034 | { |
emilmont | 1:fdd22bb7aa52 | 6035 | uint32_t i = 0u; |
emilmont | 1:fdd22bb7aa52 | 6036 | int32_t wOffset; |
emilmont | 1:fdd22bb7aa52 | 6037 | |
emilmont | 1:fdd22bb7aa52 | 6038 | /* Copy the value of Index pointer that points |
emilmont | 1:fdd22bb7aa52 | 6039 | * to the current location where the input samples to be copied */ |
emilmont | 1:fdd22bb7aa52 | 6040 | wOffset = *writeOffset; |
emilmont | 1:fdd22bb7aa52 | 6041 | |
emilmont | 1:fdd22bb7aa52 | 6042 | /* Loop over the blockSize */ |
emilmont | 1:fdd22bb7aa52 | 6043 | i = blockSize; |
emilmont | 1:fdd22bb7aa52 | 6044 | |
emilmont | 1:fdd22bb7aa52 | 6045 | while(i > 0u) |
emilmont | 1:fdd22bb7aa52 | 6046 | { |
emilmont | 1:fdd22bb7aa52 | 6047 | /* copy the input sample to the circular buffer */ |
emilmont | 1:fdd22bb7aa52 | 6048 | circBuffer[wOffset] = *src; |
emilmont | 1:fdd22bb7aa52 | 6049 | |
emilmont | 1:fdd22bb7aa52 | 6050 | /* Update the input pointer */ |
emilmont | 1:fdd22bb7aa52 | 6051 | src += srcInc; |
emilmont | 1:fdd22bb7aa52 | 6052 | |
emilmont | 1:fdd22bb7aa52 | 6053 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emilmont | 1:fdd22bb7aa52 | 6054 | wOffset += bufferInc; |
emilmont | 1:fdd22bb7aa52 | 6055 | if(wOffset >= L) |
emilmont | 1:fdd22bb7aa52 | 6056 | wOffset -= L; |
emilmont | 1:fdd22bb7aa52 | 6057 | |
emilmont | 1:fdd22bb7aa52 | 6058 | /* Decrement the loop counter */ |
emilmont | 1:fdd22bb7aa52 | 6059 | i--; |
emilmont | 1:fdd22bb7aa52 | 6060 | } |
emilmont | 1:fdd22bb7aa52 | 6061 | |
emilmont | 1:fdd22bb7aa52 | 6062 | /* Update the index pointer */ |
emilmont | 1:fdd22bb7aa52 | 6063 | *writeOffset = wOffset; |
emilmont | 1:fdd22bb7aa52 | 6064 | } |
emilmont | 1:fdd22bb7aa52 | 6065 | |
emilmont | 1:fdd22bb7aa52 | 6066 | |
emilmont | 1:fdd22bb7aa52 | 6067 | |
emilmont | 1:fdd22bb7aa52 | 6068 | /** |
emilmont | 1:fdd22bb7aa52 | 6069 | * @brief Q15 Circular Read function. |
emilmont | 1:fdd22bb7aa52 | 6070 | */ |
mbed_official | 3:7a284390b0ce | 6071 | static __INLINE void arm_circularRead_q15( |
emilmont | 1:fdd22bb7aa52 | 6072 | q15_t * circBuffer, |
emilmont | 1:fdd22bb7aa52 | 6073 | int32_t L, |
emilmont | 1:fdd22bb7aa52 | 6074 | int32_t * readOffset, |
emilmont | 1:fdd22bb7aa52 | 6075 | int32_t bufferInc, |
emilmont | 1:fdd22bb7aa52 | 6076 | q15_t * dst, |
emilmont | 1:fdd22bb7aa52 | 6077 | q15_t * dst_base, |
emilmont | 1:fdd22bb7aa52 | 6078 | int32_t dst_length, |
emilmont | 1:fdd22bb7aa52 | 6079 | int32_t dstInc, |
emilmont | 1:fdd22bb7aa52 | 6080 | uint32_t blockSize) |
emilmont | 1:fdd22bb7aa52 | 6081 | { |
emilmont | 1:fdd22bb7aa52 | 6082 | uint32_t i = 0; |
emilmont | 1:fdd22bb7aa52 | 6083 | int32_t rOffset, dst_end; |
emilmont | 1:fdd22bb7aa52 | 6084 | |
emilmont | 1:fdd22bb7aa52 | 6085 | /* Copy the value of Index pointer that points |
emilmont | 1:fdd22bb7aa52 | 6086 | * to the current location from where the input samples to be read */ |
emilmont | 1:fdd22bb7aa52 | 6087 | rOffset = *readOffset; |
emilmont | 1:fdd22bb7aa52 | 6088 | |
emilmont | 1:fdd22bb7aa52 | 6089 | dst_end = (int32_t) (dst_base + dst_length); |
emilmont | 1:fdd22bb7aa52 | 6090 | |
emilmont | 1:fdd22bb7aa52 | 6091 | /* Loop over the blockSize */ |
emilmont | 1:fdd22bb7aa52 | 6092 | i = blockSize; |
emilmont | 1:fdd22bb7aa52 | 6093 | |
emilmont | 1:fdd22bb7aa52 | 6094 | while(i > 0u) |
emilmont | 1:fdd22bb7aa52 | 6095 | { |
emilmont | 1:fdd22bb7aa52 | 6096 | /* copy the sample from the circular buffer to the destination buffer */ |
emilmont | 1:fdd22bb7aa52 | 6097 | *dst = circBuffer[rOffset]; |
emilmont | 1:fdd22bb7aa52 | 6098 | |
emilmont | 1:fdd22bb7aa52 | 6099 | /* Update the input pointer */ |
emilmont | 1:fdd22bb7aa52 | 6100 | dst += dstInc; |
emilmont | 1:fdd22bb7aa52 | 6101 | |
emilmont | 1:fdd22bb7aa52 | 6102 | if(dst == (q15_t *) dst_end) |
emilmont | 1:fdd22bb7aa52 | 6103 | { |
emilmont | 1:fdd22bb7aa52 | 6104 | dst = dst_base; |
emilmont | 1:fdd22bb7aa52 | 6105 | } |
emilmont | 1:fdd22bb7aa52 | 6106 | |
emilmont | 1:fdd22bb7aa52 | 6107 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emilmont | 1:fdd22bb7aa52 | 6108 | rOffset += bufferInc; |
emilmont | 1:fdd22bb7aa52 | 6109 | |
emilmont | 1:fdd22bb7aa52 | 6110 | if(rOffset >= L) |
emilmont | 1:fdd22bb7aa52 | 6111 | { |
emilmont | 1:fdd22bb7aa52 | 6112 | rOffset -= L; |
emilmont | 1:fdd22bb7aa52 | 6113 | } |
emilmont | 1:fdd22bb7aa52 | 6114 | |
emilmont | 1:fdd22bb7aa52 | 6115 | /* Decrement the loop counter */ |
emilmont | 1:fdd22bb7aa52 | 6116 | i--; |
emilmont | 1:fdd22bb7aa52 | 6117 | } |
emilmont | 1:fdd22bb7aa52 | 6118 | |
emilmont | 1:fdd22bb7aa52 | 6119 | /* Update the index pointer */ |
emilmont | 1:fdd22bb7aa52 | 6120 | *readOffset = rOffset; |
emilmont | 1:fdd22bb7aa52 | 6121 | } |
emilmont | 1:fdd22bb7aa52 | 6122 | |
emilmont | 1:fdd22bb7aa52 | 6123 | |
emilmont | 1:fdd22bb7aa52 | 6124 | /** |
emilmont | 1:fdd22bb7aa52 | 6125 | * @brief Q7 Circular write function. |
emilmont | 1:fdd22bb7aa52 | 6126 | */ |
emilmont | 1:fdd22bb7aa52 | 6127 | |
mbed_official | 3:7a284390b0ce | 6128 | static __INLINE void arm_circularWrite_q7( |
emilmont | 1:fdd22bb7aa52 | 6129 | q7_t * circBuffer, |
emilmont | 1:fdd22bb7aa52 | 6130 | int32_t L, |
emilmont | 1:fdd22bb7aa52 | 6131 | uint16_t * writeOffset, |
emilmont | 1:fdd22bb7aa52 | 6132 | int32_t bufferInc, |
emilmont | 1:fdd22bb7aa52 | 6133 | const q7_t * src, |
emilmont | 1:fdd22bb7aa52 | 6134 | int32_t srcInc, |
emilmont | 1:fdd22bb7aa52 | 6135 | uint32_t blockSize) |
emilmont | 1:fdd22bb7aa52 | 6136 | { |
emilmont | 1:fdd22bb7aa52 | 6137 | uint32_t i = 0u; |
emilmont | 1:fdd22bb7aa52 | 6138 | int32_t wOffset; |
emilmont | 1:fdd22bb7aa52 | 6139 | |
emilmont | 1:fdd22bb7aa52 | 6140 | /* Copy the value of Index pointer that points |
emilmont | 1:fdd22bb7aa52 | 6141 | * to the current location where the input samples to be copied */ |
emilmont | 1:fdd22bb7aa52 | 6142 | wOffset = *writeOffset; |
emilmont | 1:fdd22bb7aa52 | 6143 | |
emilmont | 1:fdd22bb7aa52 | 6144 | /* Loop over the blockSize */ |
emilmont | 1:fdd22bb7aa52 | 6145 | i = blockSize; |
emilmont | 1:fdd22bb7aa52 | 6146 | |
emilmont | 1:fdd22bb7aa52 | 6147 | while(i > 0u) |
emilmont | 1:fdd22bb7aa52 | 6148 | { |
emilmont | 1:fdd22bb7aa52 | 6149 | /* copy the input sample to the circular buffer */ |
emilmont | 1:fdd22bb7aa52 | 6150 | circBuffer[wOffset] = *src; |
emilmont | 1:fdd22bb7aa52 | 6151 | |
emilmont | 1:fdd22bb7aa52 | 6152 | /* Update the input pointer */ |
emilmont | 1:fdd22bb7aa52 | 6153 | src += srcInc; |
emilmont | 1:fdd22bb7aa52 | 6154 | |
emilmont | 1:fdd22bb7aa52 | 6155 | /* Circularly update wOffset. Watch out for positive and negative value */ |
emilmont | 1:fdd22bb7aa52 | 6156 | wOffset += bufferInc; |
emilmont | 1:fdd22bb7aa52 | 6157 | if(wOffset >= L) |
emilmont | 1:fdd22bb7aa52 | 6158 | wOffset -= L; |
emilmont | 1:fdd22bb7aa52 | 6159 | |
emilmont | 1:fdd22bb7aa52 | 6160 | /* Decrement the loop counter */ |
emilmont | 1:fdd22bb7aa52 | 6161 | i--; |
emilmont | 1:fdd22bb7aa52 | 6162 | } |
emilmont | 1:fdd22bb7aa52 | 6163 | |
emilmont | 1:fdd22bb7aa52 | 6164 | /* Update the index pointer */ |
emilmont | 1:fdd22bb7aa52 | 6165 | *writeOffset = wOffset; |
emilmont | 1:fdd22bb7aa52 | 6166 | } |
emilmont | 1:fdd22bb7aa52 | 6167 | |
emilmont | 1:fdd22bb7aa52 | 6168 | |
emilmont | 1:fdd22bb7aa52 | 6169 | |
emilmont | 1:fdd22bb7aa52 | 6170 | /** |
emilmont | 1:fdd22bb7aa52 | 6171 | * @brief Q7 Circular Read function. |
emilmont | 1:fdd22bb7aa52 | 6172 | */ |
mbed_official | 3:7a284390b0ce | 6173 | static __INLINE void arm_circularRead_q7( |
emilmont | 1:fdd22bb7aa52 | 6174 | q7_t * circBuffer, |
emilmont | 1:fdd22bb7aa52 | 6175 | int32_t L, |
emilmont | 1:fdd22bb7aa52 | 6176 | int32_t * readOffset, |
emilmont | 1:fdd22bb7aa52 | 6177 | int32_t bufferInc, |
emilmont | 1:fdd22bb7aa52 | 6178 | q7_t * dst, |
emilmont | 1:fdd22bb7aa52 | 6179 | q7_t * dst_base, |
emilmont | 1:fdd22bb7aa52 | 6180 | int32_t dst_length, |
emilmont | 1:fdd22bb7aa52 | 6181 | int32_t dstInc, |
emilmont | 1:fdd22bb7aa52 | 6182 | uint32_t blockSize) |
emilmont | 1:fdd22bb7aa52 | 6183 | { |
emilmont | 1:fdd22bb7aa52 | 6184 | uint32_t i = 0; |
emilmont | 1:fdd22bb7aa52 | 6185 | int32_t rOffset, dst_end; |
emilmont | 1:fdd22bb7aa52 | 6186 | |
emilmont | 1:fdd22bb7aa52 | 6187 | /* Copy the value of Index pointer that points |
emilmont | 1:fdd22bb7aa52 | 6188 | * to the current location from where the input samples to be read */ |
emilmont | 1:fdd22bb7aa52 | 6189 | rOffset = *readOffset; |
emilmont | 1:fdd22bb7aa52 | 6190 | |
emilmont | 1:fdd22bb7aa52 | 6191 | dst_end = (int32_t) (dst_base + dst_length); |
emilmont | 1:fdd22bb7aa52 | 6192 | |
emilmont | 1:fdd22bb7aa52 | 6193 | /* Loop over the blockSize */ |
emilmont | 1:fdd22bb7aa52 | 6194 | i = blockSize; |
emilmont | 1:fdd22bb7aa52 | 6195 | |
emilmont | 1:fdd22bb7aa52 | 6196 | while(i > 0u) |
emilmont | 1:fdd22bb7aa52 | 6197 | { |
emilmont | 1:fdd22bb7aa52 | 6198 | /* copy the sample from the circular buffer to the destination buffer */ |
emilmont | 1:fdd22bb7aa52 | 6199 | *dst = circBuffer[rOffset]; |
emilmont | 1:fdd22bb7aa52 | 6200 | |
emilmont | 1:fdd22bb7aa52 | 6201 | /* Update the input pointer */ |
emilmont | 1:fdd22bb7aa52 | 6202 | dst += dstInc; |
emilmont | 1:fdd22bb7aa52 | 6203 | |
emilmont | 1:fdd22bb7aa52 | 6204 | if(dst == (q7_t *) dst_end) |
emilmont | 1:fdd22bb7aa52 | 6205 | { |
emilmont | 1:fdd22bb7aa52 | 6206 | dst = dst_base; |
emilmont | 1:fdd22bb7aa52 | 6207 | } |
emilmont | 1:fdd22bb7aa52 | 6208 | |
emilmont | 1:fdd22bb7aa52 | 6209 | /* Circularly update rOffset. Watch out for positive and negative value */ |
emilmont | 1:fdd22bb7aa52 | 6210 | rOffset += bufferInc; |
emilmont | 1:fdd22bb7aa52 | 6211 | |
emilmont | 1:fdd22bb7aa52 | 6212 | if(rOffset >= L) |
emilmont | 1:fdd22bb7aa52 | 6213 | { |
emilmont | 1:fdd22bb7aa52 | 6214 | rOffset -= L; |
emilmont | 1:fdd22bb7aa52 | 6215 | } |
emilmont | 1:fdd22bb7aa52 | 6216 | |
emilmont | 1:fdd22bb7aa52 | 6217 | /* Decrement the loop counter */ |
emilmont | 1:fdd22bb7aa52 | 6218 | i--; |
emilmont | 1:fdd22bb7aa52 | 6219 | } |
emilmont | 1:fdd22bb7aa52 | 6220 | |
emilmont | 1:fdd22bb7aa52 | 6221 | /* Update the index pointer */ |
emilmont | 1:fdd22bb7aa52 | 6222 | *readOffset = rOffset; |
emilmont | 1:fdd22bb7aa52 | 6223 | } |
emilmont | 1:fdd22bb7aa52 | 6224 | |
emilmont | 1:fdd22bb7aa52 | 6225 | |
emilmont | 1:fdd22bb7aa52 | 6226 | /** |
emilmont | 1:fdd22bb7aa52 | 6227 | * @brief Sum of the squares of the elements of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6228 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6229 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6230 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6231 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6232 | */ |
emilmont | 1:fdd22bb7aa52 | 6233 | |
emilmont | 1:fdd22bb7aa52 | 6234 | void arm_power_q31( |
emilmont | 1:fdd22bb7aa52 | 6235 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6236 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6237 | q63_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6238 | |
emilmont | 1:fdd22bb7aa52 | 6239 | /** |
emilmont | 1:fdd22bb7aa52 | 6240 | * @brief Sum of the squares of the elements of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6241 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6242 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6243 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6244 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6245 | */ |
emilmont | 1:fdd22bb7aa52 | 6246 | |
emilmont | 1:fdd22bb7aa52 | 6247 | void arm_power_f32( |
emilmont | 1:fdd22bb7aa52 | 6248 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6249 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6250 | float32_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6251 | |
emilmont | 1:fdd22bb7aa52 | 6252 | /** |
emilmont | 1:fdd22bb7aa52 | 6253 | * @brief Sum of the squares of the elements of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6254 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6255 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6256 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6257 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6258 | */ |
emilmont | 1:fdd22bb7aa52 | 6259 | |
emilmont | 1:fdd22bb7aa52 | 6260 | void arm_power_q15( |
emilmont | 1:fdd22bb7aa52 | 6261 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6262 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6263 | q63_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6264 | |
emilmont | 1:fdd22bb7aa52 | 6265 | /** |
emilmont | 1:fdd22bb7aa52 | 6266 | * @brief Sum of the squares of the elements of a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 6267 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6268 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6269 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6270 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6271 | */ |
emilmont | 1:fdd22bb7aa52 | 6272 | |
emilmont | 1:fdd22bb7aa52 | 6273 | void arm_power_q7( |
emilmont | 1:fdd22bb7aa52 | 6274 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6275 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6276 | q31_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6277 | |
emilmont | 1:fdd22bb7aa52 | 6278 | /** |
emilmont | 1:fdd22bb7aa52 | 6279 | * @brief Mean value of a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 6280 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6281 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6282 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6283 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6284 | */ |
emilmont | 1:fdd22bb7aa52 | 6285 | |
emilmont | 1:fdd22bb7aa52 | 6286 | void arm_mean_q7( |
emilmont | 1:fdd22bb7aa52 | 6287 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6288 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6289 | q7_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6290 | |
emilmont | 1:fdd22bb7aa52 | 6291 | /** |
emilmont | 1:fdd22bb7aa52 | 6292 | * @brief Mean value of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6293 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6294 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6295 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6296 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6297 | */ |
emilmont | 1:fdd22bb7aa52 | 6298 | void arm_mean_q15( |
emilmont | 1:fdd22bb7aa52 | 6299 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6300 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6301 | q15_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6302 | |
emilmont | 1:fdd22bb7aa52 | 6303 | /** |
emilmont | 1:fdd22bb7aa52 | 6304 | * @brief Mean value of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6305 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6306 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6307 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6308 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6309 | */ |
emilmont | 1:fdd22bb7aa52 | 6310 | void arm_mean_q31( |
emilmont | 1:fdd22bb7aa52 | 6311 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6312 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6313 | q31_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6314 | |
emilmont | 1:fdd22bb7aa52 | 6315 | /** |
emilmont | 1:fdd22bb7aa52 | 6316 | * @brief Mean value of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6317 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6318 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6319 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6320 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6321 | */ |
emilmont | 1:fdd22bb7aa52 | 6322 | void arm_mean_f32( |
emilmont | 1:fdd22bb7aa52 | 6323 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6324 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6325 | float32_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6326 | |
emilmont | 1:fdd22bb7aa52 | 6327 | /** |
emilmont | 1:fdd22bb7aa52 | 6328 | * @brief Variance of the elements of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6329 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6330 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6331 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6332 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6333 | */ |
emilmont | 1:fdd22bb7aa52 | 6334 | |
emilmont | 1:fdd22bb7aa52 | 6335 | void arm_var_f32( |
emilmont | 1:fdd22bb7aa52 | 6336 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6337 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6338 | float32_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6339 | |
emilmont | 1:fdd22bb7aa52 | 6340 | /** |
emilmont | 1:fdd22bb7aa52 | 6341 | * @brief Variance of the elements of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6342 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6343 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6344 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6345 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6346 | */ |
emilmont | 1:fdd22bb7aa52 | 6347 | |
emilmont | 1:fdd22bb7aa52 | 6348 | void arm_var_q31( |
emilmont | 1:fdd22bb7aa52 | 6349 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6350 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6351 | q63_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6352 | |
emilmont | 1:fdd22bb7aa52 | 6353 | /** |
emilmont | 1:fdd22bb7aa52 | 6354 | * @brief Variance of the elements of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6355 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6356 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6357 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6358 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6359 | */ |
emilmont | 1:fdd22bb7aa52 | 6360 | |
emilmont | 1:fdd22bb7aa52 | 6361 | void arm_var_q15( |
emilmont | 1:fdd22bb7aa52 | 6362 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6363 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6364 | q31_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6365 | |
emilmont | 1:fdd22bb7aa52 | 6366 | /** |
emilmont | 1:fdd22bb7aa52 | 6367 | * @brief Root Mean Square of the elements of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6368 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6369 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6370 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6371 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6372 | */ |
emilmont | 1:fdd22bb7aa52 | 6373 | |
emilmont | 1:fdd22bb7aa52 | 6374 | void arm_rms_f32( |
emilmont | 1:fdd22bb7aa52 | 6375 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6376 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6377 | float32_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6378 | |
emilmont | 1:fdd22bb7aa52 | 6379 | /** |
emilmont | 1:fdd22bb7aa52 | 6380 | * @brief Root Mean Square of the elements of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6381 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6382 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6383 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6384 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6385 | */ |
emilmont | 1:fdd22bb7aa52 | 6386 | |
emilmont | 1:fdd22bb7aa52 | 6387 | void arm_rms_q31( |
emilmont | 1:fdd22bb7aa52 | 6388 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6389 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6390 | q31_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6391 | |
emilmont | 1:fdd22bb7aa52 | 6392 | /** |
emilmont | 1:fdd22bb7aa52 | 6393 | * @brief Root Mean Square of the elements of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6394 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6395 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6396 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6397 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6398 | */ |
emilmont | 1:fdd22bb7aa52 | 6399 | |
emilmont | 1:fdd22bb7aa52 | 6400 | void arm_rms_q15( |
emilmont | 1:fdd22bb7aa52 | 6401 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6402 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6403 | q15_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6404 | |
emilmont | 1:fdd22bb7aa52 | 6405 | /** |
emilmont | 1:fdd22bb7aa52 | 6406 | * @brief Standard deviation of the elements of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6407 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6408 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6409 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6410 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6411 | */ |
emilmont | 1:fdd22bb7aa52 | 6412 | |
emilmont | 1:fdd22bb7aa52 | 6413 | void arm_std_f32( |
emilmont | 1:fdd22bb7aa52 | 6414 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6415 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6416 | float32_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6417 | |
emilmont | 1:fdd22bb7aa52 | 6418 | /** |
emilmont | 1:fdd22bb7aa52 | 6419 | * @brief Standard deviation of the elements of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6420 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6421 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6422 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6423 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6424 | */ |
emilmont | 1:fdd22bb7aa52 | 6425 | |
emilmont | 1:fdd22bb7aa52 | 6426 | void arm_std_q31( |
emilmont | 1:fdd22bb7aa52 | 6427 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6428 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6429 | q31_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6430 | |
emilmont | 1:fdd22bb7aa52 | 6431 | /** |
emilmont | 1:fdd22bb7aa52 | 6432 | * @brief Standard deviation of the elements of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6433 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6434 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6435 | * @param[out] *pResult is output value. |
emilmont | 1:fdd22bb7aa52 | 6436 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6437 | */ |
emilmont | 1:fdd22bb7aa52 | 6438 | |
emilmont | 1:fdd22bb7aa52 | 6439 | void arm_std_q15( |
emilmont | 1:fdd22bb7aa52 | 6440 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6441 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6442 | q15_t * pResult); |
emilmont | 1:fdd22bb7aa52 | 6443 | |
emilmont | 1:fdd22bb7aa52 | 6444 | /** |
emilmont | 1:fdd22bb7aa52 | 6445 | * @brief Floating-point complex magnitude |
emilmont | 1:fdd22bb7aa52 | 6446 | * @param[in] *pSrc points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 6447 | * @param[out] *pDst points to the real output vector |
emilmont | 1:fdd22bb7aa52 | 6448 | * @param[in] numSamples number of complex samples in the input vector |
emilmont | 1:fdd22bb7aa52 | 6449 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6450 | */ |
emilmont | 1:fdd22bb7aa52 | 6451 | |
emilmont | 1:fdd22bb7aa52 | 6452 | void arm_cmplx_mag_f32( |
emilmont | 1:fdd22bb7aa52 | 6453 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6454 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6455 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6456 | |
emilmont | 1:fdd22bb7aa52 | 6457 | /** |
emilmont | 1:fdd22bb7aa52 | 6458 | * @brief Q31 complex magnitude |
emilmont | 1:fdd22bb7aa52 | 6459 | * @param[in] *pSrc points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 6460 | * @param[out] *pDst points to the real output vector |
emilmont | 1:fdd22bb7aa52 | 6461 | * @param[in] numSamples number of complex samples in the input vector |
emilmont | 1:fdd22bb7aa52 | 6462 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6463 | */ |
emilmont | 1:fdd22bb7aa52 | 6464 | |
emilmont | 1:fdd22bb7aa52 | 6465 | void arm_cmplx_mag_q31( |
emilmont | 1:fdd22bb7aa52 | 6466 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6467 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6468 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6469 | |
emilmont | 1:fdd22bb7aa52 | 6470 | /** |
emilmont | 1:fdd22bb7aa52 | 6471 | * @brief Q15 complex magnitude |
emilmont | 1:fdd22bb7aa52 | 6472 | * @param[in] *pSrc points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 6473 | * @param[out] *pDst points to the real output vector |
emilmont | 1:fdd22bb7aa52 | 6474 | * @param[in] numSamples number of complex samples in the input vector |
emilmont | 1:fdd22bb7aa52 | 6475 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6476 | */ |
emilmont | 1:fdd22bb7aa52 | 6477 | |
emilmont | 1:fdd22bb7aa52 | 6478 | void arm_cmplx_mag_q15( |
emilmont | 1:fdd22bb7aa52 | 6479 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6480 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6481 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6482 | |
emilmont | 1:fdd22bb7aa52 | 6483 | /** |
emilmont | 1:fdd22bb7aa52 | 6484 | * @brief Q15 complex dot product |
emilmont | 1:fdd22bb7aa52 | 6485 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 6486 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 6487 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6488 | * @param[out] *realResult real part of the result returned here |
emilmont | 1:fdd22bb7aa52 | 6489 | * @param[out] *imagResult imaginary part of the result returned here |
emilmont | 1:fdd22bb7aa52 | 6490 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6491 | */ |
emilmont | 1:fdd22bb7aa52 | 6492 | |
emilmont | 1:fdd22bb7aa52 | 6493 | void arm_cmplx_dot_prod_q15( |
emilmont | 1:fdd22bb7aa52 | 6494 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 6495 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 6496 | uint32_t numSamples, |
emilmont | 1:fdd22bb7aa52 | 6497 | q31_t * realResult, |
emilmont | 1:fdd22bb7aa52 | 6498 | q31_t * imagResult); |
emilmont | 1:fdd22bb7aa52 | 6499 | |
emilmont | 1:fdd22bb7aa52 | 6500 | /** |
emilmont | 1:fdd22bb7aa52 | 6501 | * @brief Q31 complex dot product |
emilmont | 1:fdd22bb7aa52 | 6502 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 6503 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 6504 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6505 | * @param[out] *realResult real part of the result returned here |
emilmont | 1:fdd22bb7aa52 | 6506 | * @param[out] *imagResult imaginary part of the result returned here |
emilmont | 1:fdd22bb7aa52 | 6507 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6508 | */ |
emilmont | 1:fdd22bb7aa52 | 6509 | |
emilmont | 1:fdd22bb7aa52 | 6510 | void arm_cmplx_dot_prod_q31( |
emilmont | 1:fdd22bb7aa52 | 6511 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 6512 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 6513 | uint32_t numSamples, |
emilmont | 1:fdd22bb7aa52 | 6514 | q63_t * realResult, |
emilmont | 1:fdd22bb7aa52 | 6515 | q63_t * imagResult); |
emilmont | 1:fdd22bb7aa52 | 6516 | |
emilmont | 1:fdd22bb7aa52 | 6517 | /** |
emilmont | 1:fdd22bb7aa52 | 6518 | * @brief Floating-point complex dot product |
emilmont | 1:fdd22bb7aa52 | 6519 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 6520 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 6521 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6522 | * @param[out] *realResult real part of the result returned here |
emilmont | 1:fdd22bb7aa52 | 6523 | * @param[out] *imagResult imaginary part of the result returned here |
emilmont | 1:fdd22bb7aa52 | 6524 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6525 | */ |
emilmont | 1:fdd22bb7aa52 | 6526 | |
emilmont | 1:fdd22bb7aa52 | 6527 | void arm_cmplx_dot_prod_f32( |
emilmont | 1:fdd22bb7aa52 | 6528 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 6529 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 6530 | uint32_t numSamples, |
emilmont | 1:fdd22bb7aa52 | 6531 | float32_t * realResult, |
emilmont | 1:fdd22bb7aa52 | 6532 | float32_t * imagResult); |
emilmont | 1:fdd22bb7aa52 | 6533 | |
emilmont | 1:fdd22bb7aa52 | 6534 | /** |
emilmont | 1:fdd22bb7aa52 | 6535 | * @brief Q15 complex-by-real multiplication |
emilmont | 1:fdd22bb7aa52 | 6536 | * @param[in] *pSrcCmplx points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 6537 | * @param[in] *pSrcReal points to the real input vector |
emilmont | 1:fdd22bb7aa52 | 6538 | * @param[out] *pCmplxDst points to the complex output vector |
emilmont | 1:fdd22bb7aa52 | 6539 | * @param[in] numSamples number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6540 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6541 | */ |
emilmont | 1:fdd22bb7aa52 | 6542 | |
emilmont | 1:fdd22bb7aa52 | 6543 | void arm_cmplx_mult_real_q15( |
emilmont | 1:fdd22bb7aa52 | 6544 | q15_t * pSrcCmplx, |
emilmont | 1:fdd22bb7aa52 | 6545 | q15_t * pSrcReal, |
emilmont | 1:fdd22bb7aa52 | 6546 | q15_t * pCmplxDst, |
emilmont | 1:fdd22bb7aa52 | 6547 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6548 | |
emilmont | 1:fdd22bb7aa52 | 6549 | /** |
emilmont | 1:fdd22bb7aa52 | 6550 | * @brief Q31 complex-by-real multiplication |
emilmont | 1:fdd22bb7aa52 | 6551 | * @param[in] *pSrcCmplx points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 6552 | * @param[in] *pSrcReal points to the real input vector |
emilmont | 1:fdd22bb7aa52 | 6553 | * @param[out] *pCmplxDst points to the complex output vector |
emilmont | 1:fdd22bb7aa52 | 6554 | * @param[in] numSamples number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6555 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6556 | */ |
emilmont | 1:fdd22bb7aa52 | 6557 | |
emilmont | 1:fdd22bb7aa52 | 6558 | void arm_cmplx_mult_real_q31( |
emilmont | 1:fdd22bb7aa52 | 6559 | q31_t * pSrcCmplx, |
emilmont | 1:fdd22bb7aa52 | 6560 | q31_t * pSrcReal, |
emilmont | 1:fdd22bb7aa52 | 6561 | q31_t * pCmplxDst, |
emilmont | 1:fdd22bb7aa52 | 6562 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6563 | |
emilmont | 1:fdd22bb7aa52 | 6564 | /** |
emilmont | 1:fdd22bb7aa52 | 6565 | * @brief Floating-point complex-by-real multiplication |
emilmont | 1:fdd22bb7aa52 | 6566 | * @param[in] *pSrcCmplx points to the complex input vector |
emilmont | 1:fdd22bb7aa52 | 6567 | * @param[in] *pSrcReal points to the real input vector |
emilmont | 1:fdd22bb7aa52 | 6568 | * @param[out] *pCmplxDst points to the complex output vector |
emilmont | 1:fdd22bb7aa52 | 6569 | * @param[in] numSamples number of samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6570 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6571 | */ |
emilmont | 1:fdd22bb7aa52 | 6572 | |
emilmont | 1:fdd22bb7aa52 | 6573 | void arm_cmplx_mult_real_f32( |
emilmont | 1:fdd22bb7aa52 | 6574 | float32_t * pSrcCmplx, |
emilmont | 1:fdd22bb7aa52 | 6575 | float32_t * pSrcReal, |
emilmont | 1:fdd22bb7aa52 | 6576 | float32_t * pCmplxDst, |
emilmont | 1:fdd22bb7aa52 | 6577 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6578 | |
emilmont | 1:fdd22bb7aa52 | 6579 | /** |
emilmont | 1:fdd22bb7aa52 | 6580 | * @brief Minimum value of a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 6581 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6582 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6583 | * @param[out] *result is output pointer |
emilmont | 1:fdd22bb7aa52 | 6584 | * @param[in] index is the array index of the minimum value in the input buffer. |
emilmont | 1:fdd22bb7aa52 | 6585 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6586 | */ |
emilmont | 1:fdd22bb7aa52 | 6587 | |
emilmont | 1:fdd22bb7aa52 | 6588 | void arm_min_q7( |
emilmont | 1:fdd22bb7aa52 | 6589 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6590 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6591 | q7_t * result, |
emilmont | 1:fdd22bb7aa52 | 6592 | uint32_t * index); |
emilmont | 1:fdd22bb7aa52 | 6593 | |
emilmont | 1:fdd22bb7aa52 | 6594 | /** |
emilmont | 1:fdd22bb7aa52 | 6595 | * @brief Minimum value of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6596 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6597 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6598 | * @param[out] *pResult is output pointer |
emilmont | 1:fdd22bb7aa52 | 6599 | * @param[in] *pIndex is the array index of the minimum value in the input buffer. |
emilmont | 1:fdd22bb7aa52 | 6600 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6601 | */ |
emilmont | 1:fdd22bb7aa52 | 6602 | |
emilmont | 1:fdd22bb7aa52 | 6603 | void arm_min_q15( |
emilmont | 1:fdd22bb7aa52 | 6604 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6605 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6606 | q15_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6607 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6608 | |
emilmont | 1:fdd22bb7aa52 | 6609 | /** |
emilmont | 1:fdd22bb7aa52 | 6610 | * @brief Minimum value of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6611 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6612 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6613 | * @param[out] *pResult is output pointer |
emilmont | 1:fdd22bb7aa52 | 6614 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
emilmont | 1:fdd22bb7aa52 | 6615 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6616 | */ |
emilmont | 1:fdd22bb7aa52 | 6617 | void arm_min_q31( |
emilmont | 1:fdd22bb7aa52 | 6618 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6619 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6620 | q31_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6621 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6622 | |
emilmont | 1:fdd22bb7aa52 | 6623 | /** |
emilmont | 1:fdd22bb7aa52 | 6624 | * @brief Minimum value of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6625 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6626 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6627 | * @param[out] *pResult is output pointer |
emilmont | 1:fdd22bb7aa52 | 6628 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
emilmont | 1:fdd22bb7aa52 | 6629 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6630 | */ |
emilmont | 1:fdd22bb7aa52 | 6631 | |
emilmont | 1:fdd22bb7aa52 | 6632 | void arm_min_f32( |
emilmont | 1:fdd22bb7aa52 | 6633 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6634 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6635 | float32_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6636 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6637 | |
emilmont | 1:fdd22bb7aa52 | 6638 | /** |
emilmont | 1:fdd22bb7aa52 | 6639 | * @brief Maximum value of a Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 6640 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 6641 | * @param[in] blockSize length of the input vector |
emilmont | 1:fdd22bb7aa52 | 6642 | * @param[out] *pResult maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6643 | * @param[out] *pIndex index of maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6644 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6645 | */ |
emilmont | 1:fdd22bb7aa52 | 6646 | |
emilmont | 1:fdd22bb7aa52 | 6647 | void arm_max_q7( |
emilmont | 1:fdd22bb7aa52 | 6648 | q7_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6649 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6650 | q7_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6651 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6652 | |
emilmont | 1:fdd22bb7aa52 | 6653 | /** |
emilmont | 1:fdd22bb7aa52 | 6654 | * @brief Maximum value of a Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6655 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 6656 | * @param[in] blockSize length of the input vector |
emilmont | 1:fdd22bb7aa52 | 6657 | * @param[out] *pResult maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6658 | * @param[out] *pIndex index of maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6659 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6660 | */ |
emilmont | 1:fdd22bb7aa52 | 6661 | |
emilmont | 1:fdd22bb7aa52 | 6662 | void arm_max_q15( |
emilmont | 1:fdd22bb7aa52 | 6663 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6664 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6665 | q15_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6666 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6667 | |
emilmont | 1:fdd22bb7aa52 | 6668 | /** |
emilmont | 1:fdd22bb7aa52 | 6669 | * @brief Maximum value of a Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6670 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 6671 | * @param[in] blockSize length of the input vector |
emilmont | 1:fdd22bb7aa52 | 6672 | * @param[out] *pResult maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6673 | * @param[out] *pIndex index of maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6674 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6675 | */ |
emilmont | 1:fdd22bb7aa52 | 6676 | |
emilmont | 1:fdd22bb7aa52 | 6677 | void arm_max_q31( |
emilmont | 1:fdd22bb7aa52 | 6678 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6679 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6680 | q31_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6681 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6682 | |
emilmont | 1:fdd22bb7aa52 | 6683 | /** |
emilmont | 1:fdd22bb7aa52 | 6684 | * @brief Maximum value of a floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6685 | * @param[in] *pSrc points to the input buffer |
emilmont | 1:fdd22bb7aa52 | 6686 | * @param[in] blockSize length of the input vector |
emilmont | 1:fdd22bb7aa52 | 6687 | * @param[out] *pResult maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6688 | * @param[out] *pIndex index of maximum value returned here |
emilmont | 1:fdd22bb7aa52 | 6689 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6690 | */ |
emilmont | 1:fdd22bb7aa52 | 6691 | |
emilmont | 1:fdd22bb7aa52 | 6692 | void arm_max_f32( |
emilmont | 1:fdd22bb7aa52 | 6693 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6694 | uint32_t blockSize, |
emilmont | 1:fdd22bb7aa52 | 6695 | float32_t * pResult, |
emilmont | 1:fdd22bb7aa52 | 6696 | uint32_t * pIndex); |
emilmont | 1:fdd22bb7aa52 | 6697 | |
emilmont | 1:fdd22bb7aa52 | 6698 | /** |
emilmont | 1:fdd22bb7aa52 | 6699 | * @brief Q15 complex-by-complex multiplication |
emilmont | 1:fdd22bb7aa52 | 6700 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 6701 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 6702 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 6703 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6704 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6705 | */ |
emilmont | 1:fdd22bb7aa52 | 6706 | |
emilmont | 1:fdd22bb7aa52 | 6707 | void arm_cmplx_mult_cmplx_q15( |
emilmont | 1:fdd22bb7aa52 | 6708 | q15_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 6709 | q15_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 6710 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6711 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6712 | |
emilmont | 1:fdd22bb7aa52 | 6713 | /** |
emilmont | 1:fdd22bb7aa52 | 6714 | * @brief Q31 complex-by-complex multiplication |
emilmont | 1:fdd22bb7aa52 | 6715 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 6716 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 6717 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 6718 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6719 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6720 | */ |
emilmont | 1:fdd22bb7aa52 | 6721 | |
emilmont | 1:fdd22bb7aa52 | 6722 | void arm_cmplx_mult_cmplx_q31( |
emilmont | 1:fdd22bb7aa52 | 6723 | q31_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 6724 | q31_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 6725 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6726 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6727 | |
emilmont | 1:fdd22bb7aa52 | 6728 | /** |
emilmont | 1:fdd22bb7aa52 | 6729 | * @brief Floating-point complex-by-complex multiplication |
emilmont | 1:fdd22bb7aa52 | 6730 | * @param[in] *pSrcA points to the first input vector |
emilmont | 1:fdd22bb7aa52 | 6731 | * @param[in] *pSrcB points to the second input vector |
emilmont | 1:fdd22bb7aa52 | 6732 | * @param[out] *pDst points to the output vector |
emilmont | 1:fdd22bb7aa52 | 6733 | * @param[in] numSamples number of complex samples in each vector |
emilmont | 1:fdd22bb7aa52 | 6734 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6735 | */ |
emilmont | 1:fdd22bb7aa52 | 6736 | |
emilmont | 1:fdd22bb7aa52 | 6737 | void arm_cmplx_mult_cmplx_f32( |
emilmont | 1:fdd22bb7aa52 | 6738 | float32_t * pSrcA, |
emilmont | 1:fdd22bb7aa52 | 6739 | float32_t * pSrcB, |
emilmont | 1:fdd22bb7aa52 | 6740 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6741 | uint32_t numSamples); |
emilmont | 1:fdd22bb7aa52 | 6742 | |
emilmont | 1:fdd22bb7aa52 | 6743 | /** |
mbed_official | 3:7a284390b0ce | 6744 | * @brief Converts the elements of the floating-point vector to Q31 vector. |
mbed_official | 3:7a284390b0ce | 6745 | * @param[in] *pSrc points to the floating-point input vector |
emilmont | 1:fdd22bb7aa52 | 6746 | * @param[out] *pDst points to the Q31 output vector |
mbed_official | 3:7a284390b0ce | 6747 | * @param[in] blockSize length of the input vector |
mbed_official | 3:7a284390b0ce | 6748 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6749 | */ |
emilmont | 1:fdd22bb7aa52 | 6750 | void arm_float_to_q31( |
emilmont | 1:fdd22bb7aa52 | 6751 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6752 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6753 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6754 | |
emilmont | 1:fdd22bb7aa52 | 6755 | /** |
mbed_official | 3:7a284390b0ce | 6756 | * @brief Converts the elements of the floating-point vector to Q15 vector. |
mbed_official | 3:7a284390b0ce | 6757 | * @param[in] *pSrc points to the floating-point input vector |
emilmont | 1:fdd22bb7aa52 | 6758 | * @param[out] *pDst points to the Q15 output vector |
mbed_official | 3:7a284390b0ce | 6759 | * @param[in] blockSize length of the input vector |
emilmont | 1:fdd22bb7aa52 | 6760 | * @return none |
emilmont | 1:fdd22bb7aa52 | 6761 | */ |
emilmont | 1:fdd22bb7aa52 | 6762 | void arm_float_to_q15( |
emilmont | 1:fdd22bb7aa52 | 6763 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6764 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6765 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6766 | |
emilmont | 1:fdd22bb7aa52 | 6767 | /** |
mbed_official | 3:7a284390b0ce | 6768 | * @brief Converts the elements of the floating-point vector to Q7 vector. |
mbed_official | 3:7a284390b0ce | 6769 | * @param[in] *pSrc points to the floating-point input vector |
emilmont | 1:fdd22bb7aa52 | 6770 | * @param[out] *pDst points to the Q7 output vector |
mbed_official | 3:7a284390b0ce | 6771 | * @param[in] blockSize length of the input vector |
emilmont | 1:fdd22bb7aa52 | 6772 | * @return none |
emilmont | 1:fdd22bb7aa52 | 6773 | */ |
emilmont | 1:fdd22bb7aa52 | 6774 | void arm_float_to_q7( |
emilmont | 1:fdd22bb7aa52 | 6775 | float32_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6776 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6777 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6778 | |
emilmont | 1:fdd22bb7aa52 | 6779 | |
emilmont | 1:fdd22bb7aa52 | 6780 | /** |
emilmont | 1:fdd22bb7aa52 | 6781 | * @brief Converts the elements of the Q31 vector to Q15 vector. |
emilmont | 1:fdd22bb7aa52 | 6782 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6783 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 6784 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6785 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6786 | */ |
emilmont | 1:fdd22bb7aa52 | 6787 | void arm_q31_to_q15( |
emilmont | 1:fdd22bb7aa52 | 6788 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6789 | q15_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6790 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6791 | |
emilmont | 1:fdd22bb7aa52 | 6792 | /** |
emilmont | 1:fdd22bb7aa52 | 6793 | * @brief Converts the elements of the Q31 vector to Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 6794 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6795 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 6796 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6797 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6798 | */ |
emilmont | 1:fdd22bb7aa52 | 6799 | void arm_q31_to_q7( |
emilmont | 1:fdd22bb7aa52 | 6800 | q31_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6801 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6802 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6803 | |
emilmont | 1:fdd22bb7aa52 | 6804 | /** |
emilmont | 1:fdd22bb7aa52 | 6805 | * @brief Converts the elements of the Q15 vector to floating-point vector. |
emilmont | 1:fdd22bb7aa52 | 6806 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6807 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 6808 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6809 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6810 | */ |
emilmont | 1:fdd22bb7aa52 | 6811 | void arm_q15_to_float( |
emilmont | 1:fdd22bb7aa52 | 6812 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6813 | float32_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6814 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6815 | |
emilmont | 1:fdd22bb7aa52 | 6816 | |
emilmont | 1:fdd22bb7aa52 | 6817 | /** |
emilmont | 1:fdd22bb7aa52 | 6818 | * @brief Converts the elements of the Q15 vector to Q31 vector. |
emilmont | 1:fdd22bb7aa52 | 6819 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6820 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 6821 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6822 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6823 | */ |
emilmont | 1:fdd22bb7aa52 | 6824 | void arm_q15_to_q31( |
emilmont | 1:fdd22bb7aa52 | 6825 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6826 | q31_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6827 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6828 | |
emilmont | 1:fdd22bb7aa52 | 6829 | |
emilmont | 1:fdd22bb7aa52 | 6830 | /** |
emilmont | 1:fdd22bb7aa52 | 6831 | * @brief Converts the elements of the Q15 vector to Q7 vector. |
emilmont | 1:fdd22bb7aa52 | 6832 | * @param[in] *pSrc is input pointer |
emilmont | 1:fdd22bb7aa52 | 6833 | * @param[out] *pDst is output pointer |
emilmont | 1:fdd22bb7aa52 | 6834 | * @param[in] blockSize is the number of samples to process |
emilmont | 1:fdd22bb7aa52 | 6835 | * @return none. |
emilmont | 1:fdd22bb7aa52 | 6836 | */ |
emilmont | 1:fdd22bb7aa52 | 6837 | void arm_q15_to_q7( |
emilmont | 1:fdd22bb7aa52 | 6838 | q15_t * pSrc, |
emilmont | 1:fdd22bb7aa52 | 6839 | q7_t * pDst, |
emilmont | 1:fdd22bb7aa52 | 6840 | uint32_t blockSize); |
emilmont | 1:fdd22bb7aa52 | 6841 | |
emilmont | 1:fdd22bb7aa52 | 6842 | |
emilmont | 1:fdd22bb7aa52 | 6843 | /** |
emilmont | 1:fdd22bb7aa52 | 6844 | * @ingroup groupInterpolation |
emilmont | 1:fdd22bb7aa52 | 6845 | */ |
emilmont | 1:fdd22bb7aa52 | 6846 | |
emilmont | 1:fdd22bb7aa52 | 6847 | /** |
emilmont | 1:fdd22bb7aa52 | 6848 | * @defgroup BilinearInterpolate Bilinear Interpolation |
emilmont | 1:fdd22bb7aa52 | 6849 | * |
emilmont | 1:fdd22bb7aa52 | 6850 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. |
emilmont | 1:fdd22bb7aa52 | 6851 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process |
emilmont | 1:fdd22bb7aa52 | 6852 | * determines values between the grid points. |
emilmont | 1:fdd22bb7aa52 | 6853 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. |
emilmont | 1:fdd22bb7aa52 | 6854 | * Bilinear interpolation is often used in image processing to rescale images. |
emilmont | 1:fdd22bb7aa52 | 6855 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. |
emilmont | 1:fdd22bb7aa52 | 6856 | * |
emilmont | 1:fdd22bb7aa52 | 6857 | * <b>Algorithm</b> |
emilmont | 1:fdd22bb7aa52 | 6858 | * \par |
emilmont | 1:fdd22bb7aa52 | 6859 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. |
emilmont | 1:fdd22bb7aa52 | 6860 | * For floating-point, the instance structure is defined as: |
emilmont | 1:fdd22bb7aa52 | 6861 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 6862 | * typedef struct |
emilmont | 1:fdd22bb7aa52 | 6863 | * { |
emilmont | 1:fdd22bb7aa52 | 6864 | * uint16_t numRows; |
emilmont | 1:fdd22bb7aa52 | 6865 | * uint16_t numCols; |
emilmont | 1:fdd22bb7aa52 | 6866 | * float32_t *pData; |
emilmont | 1:fdd22bb7aa52 | 6867 | * } arm_bilinear_interp_instance_f32; |
emilmont | 1:fdd22bb7aa52 | 6868 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 6869 | * |
emilmont | 1:fdd22bb7aa52 | 6870 | * \par |
emilmont | 1:fdd22bb7aa52 | 6871 | * where <code>numRows</code> specifies the number of rows in the table; |
emilmont | 1:fdd22bb7aa52 | 6872 | * <code>numCols</code> specifies the number of columns in the table; |
emilmont | 1:fdd22bb7aa52 | 6873 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values. |
emilmont | 1:fdd22bb7aa52 | 6874 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes. |
emilmont | 1:fdd22bb7aa52 | 6875 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers. |
emilmont | 1:fdd22bb7aa52 | 6876 | * |
emilmont | 1:fdd22bb7aa52 | 6877 | * \par |
emilmont | 1:fdd22bb7aa52 | 6878 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define: |
emilmont | 1:fdd22bb7aa52 | 6879 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 6880 | * XF = floor(x) |
emilmont | 1:fdd22bb7aa52 | 6881 | * YF = floor(y) |
emilmont | 1:fdd22bb7aa52 | 6882 | * </pre> |
emilmont | 1:fdd22bb7aa52 | 6883 | * \par |
emilmont | 1:fdd22bb7aa52 | 6884 | * The interpolated output point is computed as: |
emilmont | 1:fdd22bb7aa52 | 6885 | * <pre> |
emilmont | 1:fdd22bb7aa52 | 6886 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF)) |
emilmont | 1:fdd22bb7aa52 | 6887 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF)) |
emilmont | 1:fdd22bb7aa52 | 6888 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF) |
emilmont | 1:fdd22bb7aa52 | 6889 | * + f(XF+1, YF+1) * (x-XF)*(y-YF) |
emilmont | 1:fdd22bb7aa52 | 6890 | * </pre> |
mbed_official | 3:7a284390b0ce | 6891 | * Note that the coordinates (x, y) contain integer and fractional components. |
emilmont | 1:fdd22bb7aa52 | 6892 | * The integer components specify which portion of the table to use while the |
emilmont | 1:fdd22bb7aa52 | 6893 | * fractional components control the interpolation processor. |
emilmont | 1:fdd22bb7aa52 | 6894 | * |
emilmont | 1:fdd22bb7aa52 | 6895 | * \par |
mbed_official | 3:7a284390b0ce | 6896 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. |
emilmont | 1:fdd22bb7aa52 | 6897 | */ |
emilmont | 1:fdd22bb7aa52 | 6898 | |
emilmont | 1:fdd22bb7aa52 | 6899 | /** |
emilmont | 1:fdd22bb7aa52 | 6900 | * @addtogroup BilinearInterpolate |
emilmont | 1:fdd22bb7aa52 | 6901 | * @{ |
emilmont | 1:fdd22bb7aa52 | 6902 | */ |
emilmont | 1:fdd22bb7aa52 | 6903 | |
emilmont | 1:fdd22bb7aa52 | 6904 | /** |
emilmont | 1:fdd22bb7aa52 | 6905 | * |
emilmont | 1:fdd22bb7aa52 | 6906 | * @brief Floating-point bilinear interpolation. |
emilmont | 1:fdd22bb7aa52 | 6907 | * @param[in,out] *S points to an instance of the interpolation structure. |
emilmont | 1:fdd22bb7aa52 | 6908 | * @param[in] X interpolation coordinate. |
emilmont | 1:fdd22bb7aa52 | 6909 | * @param[in] Y interpolation coordinate. |
emilmont | 1:fdd22bb7aa52 | 6910 | * @return out interpolated value. |
emilmont | 1:fdd22bb7aa52 | 6911 | */ |
emilmont | 1:fdd22bb7aa52 | 6912 | |
emilmont | 1:fdd22bb7aa52 | 6913 | |
mbed_official | 3:7a284390b0ce | 6914 | static __INLINE float32_t arm_bilinear_interp_f32( |
emilmont | 1:fdd22bb7aa52 | 6915 | const arm_bilinear_interp_instance_f32 * S, |
emilmont | 1:fdd22bb7aa52 | 6916 | float32_t X, |
emilmont | 1:fdd22bb7aa52 | 6917 | float32_t Y) |
emilmont | 1:fdd22bb7aa52 | 6918 | { |
emilmont | 1:fdd22bb7aa52 | 6919 | float32_t out; |
emilmont | 1:fdd22bb7aa52 | 6920 | float32_t f00, f01, f10, f11; |
emilmont | 1:fdd22bb7aa52 | 6921 | float32_t *pData = S->pData; |
emilmont | 1:fdd22bb7aa52 | 6922 | int32_t xIndex, yIndex, index; |
emilmont | 1:fdd22bb7aa52 | 6923 | float32_t xdiff, ydiff; |
emilmont | 1:fdd22bb7aa52 | 6924 | float32_t b1, b2, b3, b4; |
emilmont | 1:fdd22bb7aa52 | 6925 | |
emilmont | 1:fdd22bb7aa52 | 6926 | xIndex = (int32_t) X; |
emilmont | 1:fdd22bb7aa52 | 6927 | yIndex = (int32_t) Y; |
emilmont | 1:fdd22bb7aa52 | 6928 | |
emilmont | 1:fdd22bb7aa52 | 6929 | /* Care taken for table outside boundary */ |
emilmont | 1:fdd22bb7aa52 | 6930 | /* Returns zero output when values are outside table boundary */ |
emilmont | 1:fdd22bb7aa52 | 6931 | if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 |
emilmont | 1:fdd22bb7aa52 | 6932 | || yIndex > (S->numCols - 1)) |
emilmont | 1:fdd22bb7aa52 | 6933 | { |
emilmont | 1:fdd22bb7aa52 | 6934 | return (0); |
emilmont | 1:fdd22bb7aa52 | 6935 | } |
emilmont | 1:fdd22bb7aa52 | 6936 | |
emilmont | 1:fdd22bb7aa52 | 6937 | /* Calculation of index for two nearest points in X-direction */ |
emilmont | 1:fdd22bb7aa52 | 6938 | index = (xIndex - 1) + (yIndex - 1) * S->numCols; |
emilmont | 1:fdd22bb7aa52 | 6939 | |
emilmont | 1:fdd22bb7aa52 | 6940 | |
emilmont | 1:fdd22bb7aa52 | 6941 | /* Read two nearest points in X-direction */ |
emilmont | 1:fdd22bb7aa52 | 6942 | f00 = pData[index]; |
emilmont | 1:fdd22bb7aa52 | 6943 | f01 = pData[index + 1]; |
emilmont | 1:fdd22bb7aa52 | 6944 | |
emilmont | 1:fdd22bb7aa52 | 6945 | /* Calculation of index for two nearest points in Y-direction */ |
emilmont | 1:fdd22bb7aa52 | 6946 | index = (xIndex - 1) + (yIndex) * S->numCols; |
emilmont | 1:fdd22bb7aa52 | 6947 | |
emilmont | 1:fdd22bb7aa52 | 6948 | |
emilmont | 1:fdd22bb7aa52 | 6949 | /* Read two nearest points in Y-direction */ |
emilmont | 1:fdd22bb7aa52 | 6950 | f10 = pData[index]; |
emilmont | 1:fdd22bb7aa52 | 6951 | f11 = pData[index + 1]; |
emilmont | 1:fdd22bb7aa52 | 6952 | |
emilmont | 1:fdd22bb7aa52 | 6953 | /* Calculation of intermediate values */ |
emilmont | 1:fdd22bb7aa52 | 6954 | b1 = f00; |
emilmont | 1:fdd22bb7aa52 | 6955 | b2 = f01 - f00; |
emilmont | 1:fdd22bb7aa52 | 6956 | b3 = f10 - f00; |
emilmont | 1:fdd22bb7aa52 | 6957 | b4 = f00 - f01 - f10 + f11; |
emilmont | 1:fdd22bb7aa52 | 6958 | |
emilmont | 1:fdd22bb7aa52 | 6959 | /* Calculation of fractional part in X */ |
emilmont | 1:fdd22bb7aa52 | 6960 | xdiff = X - xIndex; |
emilmont | 1:fdd22bb7aa52 | 6961 | |
emilmont | 1:fdd22bb7aa52 | 6962 | /* Calculation of fractional part in Y */ |
emilmont | 1:fdd22bb7aa52 | 6963 | ydiff = Y - yIndex; |
emilmont | 1:fdd22bb7aa52 | 6964 | |
emilmont | 1:fdd22bb7aa52 | 6965 | /* Calculation of bi-linear interpolated output */ |
emilmont | 1:fdd22bb7aa52 | 6966 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; |
emilmont | 1:fdd22bb7aa52 | 6967 | |
emilmont | 1:fdd22bb7aa52 | 6968 | /* return to application */ |
emilmont | 1:fdd22bb7aa52 | 6969 | return (out); |
emilmont | 1:fdd22bb7aa52 | 6970 | |
emilmont | 1:fdd22bb7aa52 | 6971 | } |
emilmont | 1:fdd22bb7aa52 | 6972 | |
emilmont | 1:fdd22bb7aa52 | 6973 | /** |
emilmont | 1:fdd22bb7aa52 | 6974 | * |
emilmont | 1:fdd22bb7aa52 | 6975 | * @brief Q31 bilinear interpolation. |
emilmont | 1:fdd22bb7aa52 | 6976 | * @param[in,out] *S points to an instance of the interpolation structure. |
emilmont | 1:fdd22bb7aa52 | 6977 | * @param[in] X interpolation coordinate in 12.20 format. |
emilmont | 1:fdd22bb7aa52 | 6978 | * @param[in] Y interpolation coordinate in 12.20 format. |
emilmont | 1:fdd22bb7aa52 | 6979 | * @return out interpolated value. |
emilmont | 1:fdd22bb7aa52 | 6980 | */ |
emilmont | 1:fdd22bb7aa52 | 6981 | |
mbed_official | 3:7a284390b0ce | 6982 | static __INLINE q31_t arm_bilinear_interp_q31( |
emilmont | 1:fdd22bb7aa52 | 6983 | arm_bilinear_interp_instance_q31 * S, |
emilmont | 1:fdd22bb7aa52 | 6984 | q31_t X, |
emilmont | 1:fdd22bb7aa52 | 6985 | q31_t Y) |
emilmont | 1:fdd22bb7aa52 | 6986 | { |
emilmont | 1:fdd22bb7aa52 | 6987 | q31_t out; /* Temporary output */ |
emilmont | 1:fdd22bb7aa52 | 6988 | q31_t acc = 0; /* output */ |
emilmont | 1:fdd22bb7aa52 | 6989 | q31_t xfract, yfract; /* X, Y fractional parts */ |
emilmont | 1:fdd22bb7aa52 | 6990 | q31_t x1, x2, y1, y2; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 6991 | int32_t rI, cI; /* Row and column indices */ |
emilmont | 1:fdd22bb7aa52 | 6992 | q31_t *pYData = S->pData; /* pointer to output table values */ |
emilmont | 1:fdd22bb7aa52 | 6993 | uint32_t nCols = S->numCols; /* num of rows */ |
emilmont | 1:fdd22bb7aa52 | 6994 | |
emilmont | 1:fdd22bb7aa52 | 6995 | |
emilmont | 1:fdd22bb7aa52 | 6996 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 6997 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 6998 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 6999 | rI = ((X & 0xFFF00000) >> 20u); |
emilmont | 1:fdd22bb7aa52 | 7000 | |
emilmont | 1:fdd22bb7aa52 | 7001 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7002 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 7003 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 7004 | cI = ((Y & 0xFFF00000) >> 20u); |
emilmont | 1:fdd22bb7aa52 | 7005 | |
emilmont | 1:fdd22bb7aa52 | 7006 | /* Care taken for table outside boundary */ |
emilmont | 1:fdd22bb7aa52 | 7007 | /* Returns zero output when values are outside table boundary */ |
emilmont | 1:fdd22bb7aa52 | 7008 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
emilmont | 1:fdd22bb7aa52 | 7009 | { |
emilmont | 1:fdd22bb7aa52 | 7010 | return (0); |
emilmont | 1:fdd22bb7aa52 | 7011 | } |
emilmont | 1:fdd22bb7aa52 | 7012 | |
emilmont | 1:fdd22bb7aa52 | 7013 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 7014 | /* shift left xfract by 11 to keep 1.31 format */ |
emilmont | 1:fdd22bb7aa52 | 7015 | xfract = (X & 0x000FFFFF) << 11u; |
emilmont | 1:fdd22bb7aa52 | 7016 | |
emilmont | 1:fdd22bb7aa52 | 7017 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 7018 | x1 = pYData[(rI) + nCols * (cI)]; |
emilmont | 1:fdd22bb7aa52 | 7019 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
emilmont | 1:fdd22bb7aa52 | 7020 | |
emilmont | 1:fdd22bb7aa52 | 7021 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 7022 | /* shift left yfract by 11 to keep 1.31 format */ |
emilmont | 1:fdd22bb7aa52 | 7023 | yfract = (Y & 0x000FFFFF) << 11u; |
emilmont | 1:fdd22bb7aa52 | 7024 | |
emilmont | 1:fdd22bb7aa52 | 7025 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 7026 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
emilmont | 1:fdd22bb7aa52 | 7027 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
emilmont | 1:fdd22bb7aa52 | 7028 | |
emilmont | 1:fdd22bb7aa52 | 7029 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ |
emilmont | 1:fdd22bb7aa52 | 7030 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7031 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7032 | |
emilmont | 1:fdd22bb7aa52 | 7033 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7034 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7035 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7036 | |
emilmont | 1:fdd22bb7aa52 | 7037 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7038 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7039 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7040 | |
emilmont | 1:fdd22bb7aa52 | 7041 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7042 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7043 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
emilmont | 1:fdd22bb7aa52 | 7044 | |
emilmont | 1:fdd22bb7aa52 | 7045 | /* Convert acc to 1.31(q31) format */ |
emilmont | 1:fdd22bb7aa52 | 7046 | return (acc << 2u); |
emilmont | 1:fdd22bb7aa52 | 7047 | |
emilmont | 1:fdd22bb7aa52 | 7048 | } |
emilmont | 1:fdd22bb7aa52 | 7049 | |
emilmont | 1:fdd22bb7aa52 | 7050 | /** |
emilmont | 1:fdd22bb7aa52 | 7051 | * @brief Q15 bilinear interpolation. |
emilmont | 1:fdd22bb7aa52 | 7052 | * @param[in,out] *S points to an instance of the interpolation structure. |
emilmont | 1:fdd22bb7aa52 | 7053 | * @param[in] X interpolation coordinate in 12.20 format. |
emilmont | 1:fdd22bb7aa52 | 7054 | * @param[in] Y interpolation coordinate in 12.20 format. |
emilmont | 1:fdd22bb7aa52 | 7055 | * @return out interpolated value. |
emilmont | 1:fdd22bb7aa52 | 7056 | */ |
emilmont | 1:fdd22bb7aa52 | 7057 | |
mbed_official | 3:7a284390b0ce | 7058 | static __INLINE q15_t arm_bilinear_interp_q15( |
emilmont | 1:fdd22bb7aa52 | 7059 | arm_bilinear_interp_instance_q15 * S, |
emilmont | 1:fdd22bb7aa52 | 7060 | q31_t X, |
emilmont | 1:fdd22bb7aa52 | 7061 | q31_t Y) |
emilmont | 1:fdd22bb7aa52 | 7062 | { |
emilmont | 1:fdd22bb7aa52 | 7063 | q63_t acc = 0; /* output */ |
emilmont | 1:fdd22bb7aa52 | 7064 | q31_t out; /* Temporary output */ |
emilmont | 1:fdd22bb7aa52 | 7065 | q15_t x1, x2, y1, y2; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 7066 | q31_t xfract, yfract; /* X, Y fractional parts */ |
emilmont | 1:fdd22bb7aa52 | 7067 | int32_t rI, cI; /* Row and column indices */ |
emilmont | 1:fdd22bb7aa52 | 7068 | q15_t *pYData = S->pData; /* pointer to output table values */ |
emilmont | 1:fdd22bb7aa52 | 7069 | uint32_t nCols = S->numCols; /* num of rows */ |
emilmont | 1:fdd22bb7aa52 | 7070 | |
emilmont | 1:fdd22bb7aa52 | 7071 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7072 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 7073 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 7074 | rI = ((X & 0xFFF00000) >> 20); |
emilmont | 1:fdd22bb7aa52 | 7075 | |
emilmont | 1:fdd22bb7aa52 | 7076 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7077 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 7078 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 7079 | cI = ((Y & 0xFFF00000) >> 20); |
emilmont | 1:fdd22bb7aa52 | 7080 | |
emilmont | 1:fdd22bb7aa52 | 7081 | /* Care taken for table outside boundary */ |
emilmont | 1:fdd22bb7aa52 | 7082 | /* Returns zero output when values are outside table boundary */ |
emilmont | 1:fdd22bb7aa52 | 7083 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
emilmont | 1:fdd22bb7aa52 | 7084 | { |
emilmont | 1:fdd22bb7aa52 | 7085 | return (0); |
emilmont | 1:fdd22bb7aa52 | 7086 | } |
emilmont | 1:fdd22bb7aa52 | 7087 | |
emilmont | 1:fdd22bb7aa52 | 7088 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 7089 | /* xfract should be in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7090 | xfract = (X & 0x000FFFFF); |
emilmont | 1:fdd22bb7aa52 | 7091 | |
emilmont | 1:fdd22bb7aa52 | 7092 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 7093 | x1 = pYData[(rI) + nCols * (cI)]; |
emilmont | 1:fdd22bb7aa52 | 7094 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
emilmont | 1:fdd22bb7aa52 | 7095 | |
emilmont | 1:fdd22bb7aa52 | 7096 | |
emilmont | 1:fdd22bb7aa52 | 7097 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 7098 | /* yfract should be in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7099 | yfract = (Y & 0x000FFFFF); |
emilmont | 1:fdd22bb7aa52 | 7100 | |
emilmont | 1:fdd22bb7aa52 | 7101 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 7102 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
emilmont | 1:fdd22bb7aa52 | 7103 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
emilmont | 1:fdd22bb7aa52 | 7104 | |
emilmont | 1:fdd22bb7aa52 | 7105 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ |
emilmont | 1:fdd22bb7aa52 | 7106 | |
emilmont | 1:fdd22bb7aa52 | 7107 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ |
emilmont | 1:fdd22bb7aa52 | 7108 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ |
emilmont | 1:fdd22bb7aa52 | 7109 | out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); |
emilmont | 1:fdd22bb7aa52 | 7110 | acc = ((q63_t) out * (0xFFFFF - yfract)); |
emilmont | 1:fdd22bb7aa52 | 7111 | |
emilmont | 1:fdd22bb7aa52 | 7112 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7113 | out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); |
emilmont | 1:fdd22bb7aa52 | 7114 | acc += ((q63_t) out * (xfract)); |
emilmont | 1:fdd22bb7aa52 | 7115 | |
emilmont | 1:fdd22bb7aa52 | 7116 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7117 | out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); |
emilmont | 1:fdd22bb7aa52 | 7118 | acc += ((q63_t) out * (yfract)); |
emilmont | 1:fdd22bb7aa52 | 7119 | |
emilmont | 1:fdd22bb7aa52 | 7120 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7121 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); |
emilmont | 1:fdd22bb7aa52 | 7122 | acc += ((q63_t) out * (yfract)); |
emilmont | 1:fdd22bb7aa52 | 7123 | |
emilmont | 1:fdd22bb7aa52 | 7124 | /* acc is in 13.51 format and down shift acc by 36 times */ |
emilmont | 1:fdd22bb7aa52 | 7125 | /* Convert out to 1.15 format */ |
emilmont | 1:fdd22bb7aa52 | 7126 | return (acc >> 36); |
emilmont | 1:fdd22bb7aa52 | 7127 | |
emilmont | 1:fdd22bb7aa52 | 7128 | } |
emilmont | 1:fdd22bb7aa52 | 7129 | |
emilmont | 1:fdd22bb7aa52 | 7130 | /** |
emilmont | 1:fdd22bb7aa52 | 7131 | * @brief Q7 bilinear interpolation. |
emilmont | 1:fdd22bb7aa52 | 7132 | * @param[in,out] *S points to an instance of the interpolation structure. |
emilmont | 1:fdd22bb7aa52 | 7133 | * @param[in] X interpolation coordinate in 12.20 format. |
emilmont | 1:fdd22bb7aa52 | 7134 | * @param[in] Y interpolation coordinate in 12.20 format. |
emilmont | 1:fdd22bb7aa52 | 7135 | * @return out interpolated value. |
emilmont | 1:fdd22bb7aa52 | 7136 | */ |
emilmont | 1:fdd22bb7aa52 | 7137 | |
mbed_official | 3:7a284390b0ce | 7138 | static __INLINE q7_t arm_bilinear_interp_q7( |
emilmont | 1:fdd22bb7aa52 | 7139 | arm_bilinear_interp_instance_q7 * S, |
emilmont | 1:fdd22bb7aa52 | 7140 | q31_t X, |
emilmont | 1:fdd22bb7aa52 | 7141 | q31_t Y) |
emilmont | 1:fdd22bb7aa52 | 7142 | { |
emilmont | 1:fdd22bb7aa52 | 7143 | q63_t acc = 0; /* output */ |
emilmont | 1:fdd22bb7aa52 | 7144 | q31_t out; /* Temporary output */ |
emilmont | 1:fdd22bb7aa52 | 7145 | q31_t xfract, yfract; /* X, Y fractional parts */ |
emilmont | 1:fdd22bb7aa52 | 7146 | q7_t x1, x2, y1, y2; /* Nearest output values */ |
emilmont | 1:fdd22bb7aa52 | 7147 | int32_t rI, cI; /* Row and column indices */ |
emilmont | 1:fdd22bb7aa52 | 7148 | q7_t *pYData = S->pData; /* pointer to output table values */ |
emilmont | 1:fdd22bb7aa52 | 7149 | uint32_t nCols = S->numCols; /* num of rows */ |
emilmont | 1:fdd22bb7aa52 | 7150 | |
emilmont | 1:fdd22bb7aa52 | 7151 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7152 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 7153 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 7154 | rI = ((X & 0xFFF00000) >> 20); |
emilmont | 1:fdd22bb7aa52 | 7155 | |
emilmont | 1:fdd22bb7aa52 | 7156 | /* Input is in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7157 | /* 12 bits for the table index */ |
emilmont | 1:fdd22bb7aa52 | 7158 | /* Index value calculation */ |
emilmont | 1:fdd22bb7aa52 | 7159 | cI = ((Y & 0xFFF00000) >> 20); |
emilmont | 1:fdd22bb7aa52 | 7160 | |
emilmont | 1:fdd22bb7aa52 | 7161 | /* Care taken for table outside boundary */ |
emilmont | 1:fdd22bb7aa52 | 7162 | /* Returns zero output when values are outside table boundary */ |
emilmont | 1:fdd22bb7aa52 | 7163 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
emilmont | 1:fdd22bb7aa52 | 7164 | { |
emilmont | 1:fdd22bb7aa52 | 7165 | return (0); |
emilmont | 1:fdd22bb7aa52 | 7166 | } |
emilmont | 1:fdd22bb7aa52 | 7167 | |
emilmont | 1:fdd22bb7aa52 | 7168 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 7169 | /* xfract should be in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7170 | xfract = (X & 0x000FFFFF); |
emilmont | 1:fdd22bb7aa52 | 7171 | |
emilmont | 1:fdd22bb7aa52 | 7172 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 7173 | x1 = pYData[(rI) + nCols * (cI)]; |
emilmont | 1:fdd22bb7aa52 | 7174 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
emilmont | 1:fdd22bb7aa52 | 7175 | |
emilmont | 1:fdd22bb7aa52 | 7176 | |
emilmont | 1:fdd22bb7aa52 | 7177 | /* 20 bits for the fractional part */ |
emilmont | 1:fdd22bb7aa52 | 7178 | /* yfract should be in 12.20 format */ |
emilmont | 1:fdd22bb7aa52 | 7179 | yfract = (Y & 0x000FFFFF); |
emilmont | 1:fdd22bb7aa52 | 7180 | |
emilmont | 1:fdd22bb7aa52 | 7181 | /* Read two nearest output values from the index */ |
emilmont | 1:fdd22bb7aa52 | 7182 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
emilmont | 1:fdd22bb7aa52 | 7183 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
emilmont | 1:fdd22bb7aa52 | 7184 | |
emilmont | 1:fdd22bb7aa52 | 7185 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ |
emilmont | 1:fdd22bb7aa52 | 7186 | out = ((x1 * (0xFFFFF - xfract))); |
emilmont | 1:fdd22bb7aa52 | 7187 | acc = (((q63_t) out * (0xFFFFF - yfract))); |
emilmont | 1:fdd22bb7aa52 | 7188 | |
emilmont | 1:fdd22bb7aa52 | 7189 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7190 | out = ((x2 * (0xFFFFF - yfract))); |
emilmont | 1:fdd22bb7aa52 | 7191 | acc += (((q63_t) out * (xfract))); |
emilmont | 1:fdd22bb7aa52 | 7192 | |
emilmont | 1:fdd22bb7aa52 | 7193 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7194 | out = ((y1 * (0xFFFFF - xfract))); |
emilmont | 1:fdd22bb7aa52 | 7195 | acc += (((q63_t) out * (yfract))); |
emilmont | 1:fdd22bb7aa52 | 7196 | |
emilmont | 1:fdd22bb7aa52 | 7197 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ |
emilmont | 1:fdd22bb7aa52 | 7198 | out = ((y2 * (yfract))); |
emilmont | 1:fdd22bb7aa52 | 7199 | acc += (((q63_t) out * (xfract))); |
emilmont | 1:fdd22bb7aa52 | 7200 | |
emilmont | 1:fdd22bb7aa52 | 7201 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ |
emilmont | 1:fdd22bb7aa52 | 7202 | return (acc >> 40); |
emilmont | 1:fdd22bb7aa52 | 7203 | |
emilmont | 1:fdd22bb7aa52 | 7204 | } |
emilmont | 1:fdd22bb7aa52 | 7205 | |
emilmont | 1:fdd22bb7aa52 | 7206 | /** |
emilmont | 1:fdd22bb7aa52 | 7207 | * @} end of BilinearInterpolate group |
emilmont | 1:fdd22bb7aa52 | 7208 | */ |
emilmont | 1:fdd22bb7aa52 | 7209 | |
emilmont | 1:fdd22bb7aa52 | 7210 | |
mbed_official | 3:7a284390b0ce | 7211 | #if defined ( __CC_ARM ) //Keil |
mbed_official | 3:7a284390b0ce | 7212 | //SMMLAR |
mbed_official | 3:7a284390b0ce | 7213 | #define multAcc_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7214 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) |
mbed_official | 3:7a284390b0ce | 7215 | |
mbed_official | 3:7a284390b0ce | 7216 | //SMMLSR |
mbed_official | 3:7a284390b0ce | 7217 | #define multSub_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7218 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) |
mbed_official | 3:7a284390b0ce | 7219 | |
mbed_official | 3:7a284390b0ce | 7220 | //SMMULR |
mbed_official | 3:7a284390b0ce | 7221 | #define mult_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7222 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) |
mbed_official | 3:7a284390b0ce | 7223 | |
mbed_official | 3:7a284390b0ce | 7224 | //Enter low optimization region - place directly above function definition |
mbed_official | 3:7a284390b0ce | 7225 | #define LOW_OPTIMIZATION_ENTER \ |
mbed_official | 3:7a284390b0ce | 7226 | _Pragma ("push") \ |
mbed_official | 3:7a284390b0ce | 7227 | _Pragma ("O1") |
mbed_official | 3:7a284390b0ce | 7228 | |
mbed_official | 3:7a284390b0ce | 7229 | //Exit low optimization region - place directly after end of function definition |
mbed_official | 3:7a284390b0ce | 7230 | #define LOW_OPTIMIZATION_EXIT \ |
mbed_official | 3:7a284390b0ce | 7231 | _Pragma ("pop") |
mbed_official | 3:7a284390b0ce | 7232 | |
mbed_official | 3:7a284390b0ce | 7233 | //Enter low optimization region - place directly above function definition |
mbed_official | 3:7a284390b0ce | 7234 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mbed_official | 3:7a284390b0ce | 7235 | |
mbed_official | 3:7a284390b0ce | 7236 | //Exit low optimization region - place directly after end of function definition |
mbed_official | 3:7a284390b0ce | 7237 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mbed_official | 3:7a284390b0ce | 7238 | |
mbed_official | 3:7a284390b0ce | 7239 | #elif defined(__ICCARM__) //IAR |
mbed_official | 3:7a284390b0ce | 7240 | //SMMLA |
mbed_official | 3:7a284390b0ce | 7241 | #define multAcc_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7242 | a += (q31_t) (((q63_t) x * y) >> 32) |
mbed_official | 3:7a284390b0ce | 7243 | |
mbed_official | 3:7a284390b0ce | 7244 | //SMMLS |
mbed_official | 3:7a284390b0ce | 7245 | #define multSub_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7246 | a -= (q31_t) (((q63_t) x * y) >> 32) |
mbed_official | 3:7a284390b0ce | 7247 | |
mbed_official | 3:7a284390b0ce | 7248 | //SMMUL |
mbed_official | 3:7a284390b0ce | 7249 | #define mult_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7250 | a = (q31_t) (((q63_t) x * y ) >> 32) |
mbed_official | 3:7a284390b0ce | 7251 | |
mbed_official | 3:7a284390b0ce | 7252 | //Enter low optimization region - place directly above function definition |
mbed_official | 3:7a284390b0ce | 7253 | #define LOW_OPTIMIZATION_ENTER \ |
mbed_official | 3:7a284390b0ce | 7254 | _Pragma ("optimize=low") |
mbed_official | 3:7a284390b0ce | 7255 | |
mbed_official | 3:7a284390b0ce | 7256 | //Exit low optimization region - place directly after end of function definition |
mbed_official | 3:7a284390b0ce | 7257 | #define LOW_OPTIMIZATION_EXIT |
mbed_official | 3:7a284390b0ce | 7258 | |
mbed_official | 3:7a284390b0ce | 7259 | //Enter low optimization region - place directly above function definition |
mbed_official | 3:7a284390b0ce | 7260 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ |
mbed_official | 3:7a284390b0ce | 7261 | _Pragma ("optimize=low") |
mbed_official | 3:7a284390b0ce | 7262 | |
mbed_official | 3:7a284390b0ce | 7263 | //Exit low optimization region - place directly after end of function definition |
mbed_official | 3:7a284390b0ce | 7264 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mbed_official | 3:7a284390b0ce | 7265 | |
mbed_official | 3:7a284390b0ce | 7266 | #elif defined(__GNUC__) |
mbed_official | 3:7a284390b0ce | 7267 | //SMMLA |
mbed_official | 3:7a284390b0ce | 7268 | #define multAcc_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7269 | a += (q31_t) (((q63_t) x * y) >> 32) |
mbed_official | 3:7a284390b0ce | 7270 | |
mbed_official | 3:7a284390b0ce | 7271 | //SMMLS |
mbed_official | 3:7a284390b0ce | 7272 | #define multSub_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7273 | a -= (q31_t) (((q63_t) x * y) >> 32) |
mbed_official | 3:7a284390b0ce | 7274 | |
mbed_official | 3:7a284390b0ce | 7275 | //SMMUL |
mbed_official | 3:7a284390b0ce | 7276 | #define mult_32x32_keep32_R(a, x, y) \ |
mbed_official | 3:7a284390b0ce | 7277 | a = (q31_t) (((q63_t) x * y ) >> 32) |
mbed_official | 3:7a284390b0ce | 7278 | |
mbed_official | 3:7a284390b0ce | 7279 | #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) |
mbed_official | 3:7a284390b0ce | 7280 | |
mbed_official | 3:7a284390b0ce | 7281 | #define LOW_OPTIMIZATION_EXIT |
mbed_official | 3:7a284390b0ce | 7282 | |
mbed_official | 3:7a284390b0ce | 7283 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mbed_official | 3:7a284390b0ce | 7284 | |
mbed_official | 3:7a284390b0ce | 7285 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mbed_official | 3:7a284390b0ce | 7286 | |
mbed_official | 3:7a284390b0ce | 7287 | #endif |
mbed_official | 3:7a284390b0ce | 7288 | |
emilmont | 1:fdd22bb7aa52 | 7289 | |
emilmont | 1:fdd22bb7aa52 | 7290 | |
emilmont | 1:fdd22bb7aa52 | 7291 | |
emilmont | 1:fdd22bb7aa52 | 7292 | |
emilmont | 2:da51fb522205 | 7293 | #ifdef __cplusplus |
emilmont | 1:fdd22bb7aa52 | 7294 | } |
emilmont | 1:fdd22bb7aa52 | 7295 | #endif |
emilmont | 1:fdd22bb7aa52 | 7296 | |
emilmont | 1:fdd22bb7aa52 | 7297 | |
emilmont | 1:fdd22bb7aa52 | 7298 | #endif /* _ARM_MATH_H */ |
emilmont | 1:fdd22bb7aa52 | 7299 | |
emilmont | 1:fdd22bb7aa52 | 7300 | |
emilmont | 1:fdd22bb7aa52 | 7301 | /** |
emilmont | 1:fdd22bb7aa52 | 7302 | * |
emilmont | 1:fdd22bb7aa52 | 7303 | * End of file. |
emilmont | 1:fdd22bb7aa52 | 7304 | */ |