file_path
stringlengths 20
207
| content
stringlengths 5
3.85M
| size
int64 5
3.85M
| lang
stringclasses 9
values | avg_line_length
float64 1.33
100
| max_line_length
int64 4
993
| alphanum_fraction
float64 0.26
0.93
|
---|---|---|---|---|---|---|
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_sin_cos_example/arm_sin_cos_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 12. March 2014
* $Revision: V1.4.3
*
* Project: CMSIS DSP Library
* Title: arm_sin_cos_example_f32.c
*
* Description: Example code demonstrating sin and cos calculation of input signal.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup SinCosExample SineCosine Example
*
* \par Description:
* \par
* Demonstrates the Pythagorean trignometric identity with the use of Cosine, Sine, Vector
* Multiplication, and Vector Addition functions.
*
* \par Algorithm:
* \par
* Mathematically, the Pythagorean trignometric identity is defined by the following equation:
* <pre>sin(x) * sin(x) + cos(x) * cos(x) = 1</pre>
* where \c x is the angle in radians.
*
* \par Block Diagram:
* \par
* \image html sinCos.gif
*
* \par Variables Description:
* \par
* \li \c testInput_f32 array of input angle in radians
* \li \c testOutput stores sum of the squares of sine and cosine values of input angle
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_cos_f32()
* - arm_sin_f32()
* - arm_mult_f32()
* - arm_add_f32()
*
* <b> Refer </b>
* \link arm_sin_cos_example_f32.c \endlink
*
*/
/** \example arm_sin_cos_example_f32.c
*/
#include <math.h>
#include "arm_math.h"
/* ----------------------------------------------------------------------
* Defines each of the tests performed
* ------------------------------------------------------------------- */
#define MAX_BLOCKSIZE 32
#define DELTA (0.0001f)
/* ----------------------------------------------------------------------
* Test input data for Floating point sin_cos example for 32-blockSize
* Generated by the MATLAB randn() function
* ------------------------------------------------------------------- */
const float32_t testInput_f32[MAX_BLOCKSIZE] =
{
-1.244916875853235400, -4.793533929171324800, 0.360705030233248850, 0.827929644170887320, -3.299532218312426900, 3.427441903227623800, 3.422401784294607700, -0.108308165334010680,
0.941943896490312180, 0.502609575000365850, -0.537345278736373500, 2.088817392965764500, -1.693168684143455700, 6.283185307179590700, -0.392545884746175080, 0.327893095115825040,
3.070147440456292300, 0.170611405884662230, -0.275275082396073010, -2.395492805446796300, 0.847311163536506600, -3.845517018083148800, 2.055818378415868300, 4.672594161978930800,
-1.990923030266425800, 2.469305197656249500, 3.609002606064021000, -4.586736582331667500, -4.147080139136136300, 1.643756718868359500, -1.150866392366494800, 1.985805026477433800
};
const float32_t testRefOutput_f32 = 1.000000000;
/* ----------------------------------------------------------------------
* Declare Global variables
* ------------------------------------------------------------------- */
uint32_t blockSize = 32;
float32_t testOutput;
float32_t cosOutput;
float32_t sinOutput;
float32_t cosSquareOutput;
float32_t sinSquareOutput;
/* ----------------------------------------------------------------------
* Max magnitude FFT Bin test
* ------------------------------------------------------------------- */
arm_status status;
int32_t main(void)
{
float32_t diff;
uint32_t i;
for(i=0; i< blockSize; i++)
{
cosOutput = arm_cos_f32(testInput_f32[i]);
sinOutput = arm_sin_f32(testInput_f32[i]);
arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);
arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);
/* absolute value of difference between ref and test */
diff = fabsf(testRefOutput_f32 - testOutput);
/* Comparison of sin_cos value with reference */
if (diff > DELTA)
{
status = ARM_MATH_TEST_FAILURE;
}
if ( status == ARM_MATH_TEST_FAILURE)
{
while (1);
}
}
while (1); /* main function does not return */
}
/** \endlink */
| 5,688 | C | 34.117284 | 192 | 0.620956 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_sin_cos_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_sin_cos_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_sin_cos_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_sin_cos_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/arm_fft_bin_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_fft_bin_example_f32.c
*
* Description: Example code demonstrating calculation of Max energy bin of
* frequency domain of input signal.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup FrequencyBin Frequency Bin Example
*
* \par Description
* \par
* Demonstrates the calculation of the maximum energy bin in the frequency
* domain of the input signal with the use of Complex FFT, Complex
* Magnitude, and Maximum functions.
*
* \par Algorithm:
* \par
* The input test signal contains a 10 kHz signal with uniformly distributed white noise.
* Calculating the FFT of the input signal will give us the maximum energy of the
* bin corresponding to the input frequency of 10 kHz.
*
* \par Block Diagram:
* \image html FFTBin.gif "Block Diagram"
* \par
* The figure below shows the time domain signal of 10 kHz signal with
* uniformly distributed white noise, and the next figure shows the input
* in the frequency domain. The bin with maximum energy corresponds to 10 kHz signal.
* \par
* \image html FFTBinInput.gif "Input signal in Time domain"
* \image html FFTBinOutput.gif "Input signal in Frequency domain"
*
* \par Variables Description:
* \par
* \li \c testInput_f32_10khz points to the input data
* \li \c testOutput points to the output data
* \li \c fftSize length of FFT
* \li \c ifftFlag flag for the selection of CFFT/CIFFT
* \li \c doBitReverse Flag for selection of normal order or bit reversed order
* \li \c refIndex reference index value at which maximum energy of bin ocuurs
* \li \c testIndex calculated index value at which maximum energy of bin ocuurs
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_cfft_f32()
* - arm_cmplx_mag_f32()
* - arm_max_f32()
*
* <b> Refer </b>
* \link arm_fft_bin_example_f32.c \endlink
*
*/
/** \example arm_fft_bin_example_f32.c
*/
#include "arm_math.h"
#include "arm_const_structs.h"
#define TEST_LENGTH_SAMPLES 2048
/* -------------------------------------------------------------------
* External Input and Output buffer Declarations for FFT Bin Example
* ------------------------------------------------------------------- */
extern float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES];
static float32_t testOutput[TEST_LENGTH_SAMPLES/2];
/* ------------------------------------------------------------------
* Global variables for FFT Bin Example
* ------------------------------------------------------------------- */
uint32_t fftSize = 1024;
uint32_t ifftFlag = 0;
uint32_t doBitReverse = 1;
/* Reference index at which max energy of bin ocuurs */
uint32_t refIndex = 213, testIndex = 0;
/* ----------------------------------------------------------------------
* Max magnitude FFT Bin test
* ------------------------------------------------------------------- */
int32_t main(void)
{
arm_status status;
float32_t maxValue;
status = ARM_MATH_SUCCESS;
/* Process the data through the CFFT/CIFFT module */
arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse);
/* Process the data through the Complex Magnitude Module for
calculating the magnitude at each bin */
arm_cmplx_mag_f32(testInput_f32_10khz, testOutput, fftSize);
/* Calculates maxValue and returns corresponding BIN value */
arm_max_f32(testOutput, fftSize, &maxValue, &testIndex);
if (testIndex != refIndex)
{
status = ARM_MATH_TEST_FAILURE;
}
/* ----------------------------------------------------------------------
** Loop here if the signals fail the PASS check.
** This denotes a test failure
** ------------------------------------------------------------------- */
if ( status != ARM_MATH_SUCCESS)
{
while (1);
}
while (1); /* main function does not return */
}
/** \endlink */
| 5,673 | C | 34.685534 | 89 | 0.629825 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/arm_fir_data.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_fir_data.c
*
* Description: Data file used for example code
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
#include "arm_math.h"
/* ----------------------------------------------------------------------
** Test input signal contains 1000Hz + 15000 Hz
** ------------------------------------------------------------------- */
float32_t testInput_f32_1kHz_15kHz[320] =
{
+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
};
float32_t refOutput[320] =
{
+0.0000000000f, -0.0010797829f, -0.0007681386f, -0.0001982932f, +0.0000644313f, +0.0020854271f, +0.0036891871f, +0.0015855941f,
-0.0026280805f, -0.0075907658f, -0.0119390538f, -0.0086665968f, +0.0088981202f, +0.0430539279f, +0.0974468742f, +0.1740405600f,
+0.2681416601f, +0.3747720089f, +0.4893362230f, +0.6024154672f, +0.7058740791f, +0.7968348987f, +0.8715901940f, +0.9277881093f,
+0.9682182661f, +0.9934674267f, +1.0012052245f, +0.9925859371f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, -0.0000000000f, +0.1309866321f,
+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f
};
| 12,581 | C | 92.199999 | 128 | 0.725618 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/arm_fir_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_fir_example_f32.c
*
* Description: Example code demonstrating how an FIR filter can be used
* as a low pass filter.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup FIRLPF FIR Lowpass Filter Example
*
* \par Description:
* \par
* Removes high frequency signal components from the input using an FIR lowpass filter.
* The example demonstrates how to configure an FIR filter and then pass data through
* it in a block-by-block fashion.
* \image html FIRLPF_signalflow.gif
*
* \par Algorithm:
* \par
* The input signal is a sum of two sine waves: 1 kHz and 15 kHz.
* This is processed by an FIR lowpass filter with cutoff frequency 6 kHz.
* The lowpass filter eliminates the 15 kHz signal leaving only the 1 kHz sine wave at the output.
* \par
* The lowpass filter was designed using MATLAB with a sample rate of 48 kHz and
* a length of 29 points.
* The MATLAB code to generate the filter coefficients is shown below:
* <pre>
* h = fir1(28, 6/24);
* </pre>
* The first argument is the "order" of the filter and is always one less than the desired length.
* The second argument is the normalized cutoff frequency. This is in the range 0 (DC) to 1.0 (Nyquist).
* A 6 kHz cutoff with a Nyquist frequency of 24 kHz lies at a normalized frequency of 6/24 = 0.25.
* The CMSIS FIR filter function requires the coefficients to be in time reversed order.
* <pre>
* fliplr(h)
* </pre>
* The resulting filter coefficients and are shown below.
* Note that the filter is symmetric (a property of linear phase FIR filters)
* and the point of symmetry is sample 14. Thus the filter will have a delay of
* 14 samples for all frequencies.
* \par
* \image html FIRLPF_coeffs.gif
* \par
* The frequency response of the filter is shown next.
* The passband gain of the filter is 1.0 and it reaches 0.5 at the cutoff frequency 6 kHz.
* \par
* \image html FIRLPF_response.gif
* \par
* The input signal is shown below.
* The left hand side shows the signal in the time domain while the right hand side is a frequency domain representation.
* The two sine wave components can be clearly seen.
* \par
* \image html FIRLPF_input.gif
* \par
* The output of the filter is shown below. The 15 kHz component has been eliminated.
* \par
* \image html FIRLPF_output.gif
*
* \par Variables Description:
* \par
* \li \c testInput_f32_1kHz_15kHz points to the input data
* \li \c refOutput points to the reference output data
* \li \c testOutput points to the test output data
* \li \c firStateF32 points to state buffer
* \li \c firCoeffs32 points to coefficient buffer
* \li \c blockSize number of samples processed at a time
* \li \c numBlocks number of frames
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_fir_init_f32()
* - arm_fir_f32()
*
* <b> Refer </b>
* \link arm_fir_example_f32.c \endlink
*
*/
/** \example arm_fir_example_f32.c
*/
/* ----------------------------------------------------------------------
** Include Files
** ------------------------------------------------------------------- */
#include "arm_math.h"
#include "math_helper.h"
/* ----------------------------------------------------------------------
** Macro Defines
** ------------------------------------------------------------------- */
#define TEST_LENGTH_SAMPLES 320
#define SNR_THRESHOLD_F32 140.0f
#define BLOCK_SIZE 32
#define NUM_TAPS 29
/* -------------------------------------------------------------------
* The input signal and reference output (computed with MATLAB)
* are defined externally in arm_fir_lpf_data.c.
* ------------------------------------------------------------------- */
extern float32_t testInput_f32_1kHz_15kHz[TEST_LENGTH_SAMPLES];
extern float32_t refOutput[TEST_LENGTH_SAMPLES];
/* -------------------------------------------------------------------
* Declare Test output buffer
* ------------------------------------------------------------------- */
static float32_t testOutput[TEST_LENGTH_SAMPLES];
/* -------------------------------------------------------------------
* Declare State buffer of size (numTaps + blockSize - 1)
* ------------------------------------------------------------------- */
static float32_t firStateF32[BLOCK_SIZE + NUM_TAPS - 1];
/* ----------------------------------------------------------------------
** FIR Coefficients buffer generated using fir1() MATLAB function.
** fir1(28, 6/24)
** ------------------------------------------------------------------- */
const float32_t firCoeffs32[NUM_TAPS] = {
-0.0018225230f, -0.0015879294f, +0.0000000000f, +0.0036977508f, +0.0080754303f, +0.0085302217f, -0.0000000000f, -0.0173976984f,
-0.0341458607f, -0.0333591565f, +0.0000000000f, +0.0676308395f, +0.1522061835f, +0.2229246956f, +0.2504960933f, +0.2229246956f,
+0.1522061835f, +0.0676308395f, +0.0000000000f, -0.0333591565f, -0.0341458607f, -0.0173976984f, -0.0000000000f, +0.0085302217f,
+0.0080754303f, +0.0036977508f, +0.0000000000f, -0.0015879294f, -0.0018225230f
};
/* ------------------------------------------------------------------
* Global variables for FIR LPF Example
* ------------------------------------------------------------------- */
uint32_t blockSize = BLOCK_SIZE;
uint32_t numBlocks = TEST_LENGTH_SAMPLES/BLOCK_SIZE;
float32_t snr;
/* ----------------------------------------------------------------------
* FIR LPF Example
* ------------------------------------------------------------------- */
int32_t main(void)
{
uint32_t i;
arm_fir_instance_f32 S;
arm_status status;
float32_t *inputF32, *outputF32;
/* Initialize input and output buffer pointers */
inputF32 = &testInput_f32_1kHz_15kHz[0];
outputF32 = &testOutput[0];
/* Call FIR init function to initialize the instance structure. */
arm_fir_init_f32(&S, NUM_TAPS, (float32_t *)&firCoeffs32[0], &firStateF32[0], blockSize);
/* ----------------------------------------------------------------------
** Call the FIR process function for every blockSize samples
** ------------------------------------------------------------------- */
for(i=0; i < numBlocks; i++)
{
arm_fir_f32(&S, inputF32 + (i * blockSize), outputF32 + (i * blockSize), blockSize);
}
/* ----------------------------------------------------------------------
** Compare the generated output against the reference output computed
** in MATLAB.
** ------------------------------------------------------------------- */
snr = arm_snr_f32(&refOutput[0], &testOutput[0], TEST_LENGTH_SAMPLES);
if (snr < SNR_THRESHOLD_F32)
{
status = ARM_MATH_TEST_FAILURE;
}
else
{
status = ARM_MATH_SUCCESS;
}
/* ----------------------------------------------------------------------
** Loop here if the signal does not match the reference output.
** ------------------------------------------------------------------- */
if ( status != ARM_MATH_SUCCESS)
{
while (1);
}
while (1); /* main function does not return */
}
/** \endlink */
| 8,951 | C | 37.25641 | 129 | 0.569769 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/math_helper.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0 b
*
* Project: CMSIS DSP Library
*
* Title: math_helper.c
*
* Description: Definition of all helper functions required.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
* Include standard header files
* -------------------------------------------------------------------- */
#include<math.h>
/* ----------------------------------------------------------------------
* Include project header files
* -------------------------------------------------------------------- */
#include "math_helper.h"
/**
* @brief Caluclation of SNR
* @param[in] pRef Pointer to the reference buffer
* @param[in] pTest Pointer to the test buffer
* @param[in] buffSize total number of samples
* @return SNR
* The function Caluclates signal to noise ratio for the reference output
* and test output
*/
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
{
float EnergySignal = 0.0, EnergyError = 0.0;
uint32_t i;
float SNR;
int temp;
int *test;
for (i = 0; i < buffSize; i++)
{
/* Checking for a NAN value in pRef array */
test = (int *)(&pRef[i]);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
/* Checking for a NAN value in pTest array */
test = (int *)(&pTest[i]);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
EnergySignal += pRef[i] * pRef[i];
EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
}
/* Checking for a NAN value in EnergyError */
test = (int *)(&EnergyError);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
SNR = 10 * log10 (EnergySignal / EnergyError);
return (SNR);
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q15 (q15_t * input_buf, uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Converts float to fixed in q12.20 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to outputbuffer
* @param[in] numSamples number of samples in the input buffer
* @return none
* The function converts floating point values to fixed point(q12.20) values
*/
void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1048576.0f corresponds to pow(2, 20) */
pOut[i] = (q31_t) (pIn[i] * 1048576.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 1.0)
{
pOut[i] = 0x000FFFFF;
}
}
}
/**
* @brief Compare MATLAB Reference Output and ARM Test output
* @param[in] pIn Pointer to Ref buffer
* @param[in] pOut Pointer to Test buffer
* @param[in] numSamples number of samples in the buffer
* @return maximum difference
*/
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{
uint32_t i;
int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
if (diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
}
/**
* @brief Compare MATLAB Reference Output and ARM Test output
* @param[in] pIn Pointer to Ref buffer
* @param[in] pOut Pointer to Test buffer
* @param[in] numSamples number of samples in the buffer
* @return maximum difference
*/
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
if (diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q31 (q31_t * input_buf,
uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q7 (q7_t * input_buf,
uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Caluclates number of guard bits
* @param[in] num_adds number of additions
* @return guard bits
* The function Caluclates the number of guard bits
* depending on the numtaps
*/
uint32_t arm_calc_guard_bits (uint32_t num_adds)
{
uint32_t i = 1, j = 0;
if (num_adds == 1)
{
return (0);
}
while (i < num_adds)
{
i = i * 2;
j++;
}
return (j);
}
/**
* @brief Apply guard bits to buffer
* @param[in,out] pIn pointer to input buffer
* @param[in] numSamples number of samples in the input buffer
* @param[in] guard_bits guard bits
* @return none
*/
void arm_apply_guard_bits (float32_t *pIn,
uint32_t numSamples,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
pIn[i] = pIn[i] * arm_calc_2pow(guard_bits);
}
}
/**
* @brief Calculates pow(2, numShifts)
* @param[in] numShifts number of shifts
* @return pow(2, numShifts)
*/
uint32_t arm_calc_2pow(uint32_t numShifts)
{
uint32_t i, val = 1;
for (i = 0; i < numShifts; i++)
{
val = val * 2;
}
return(val);
}
/**
* @brief Converts float to fixed q14
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 16384.0f corresponds to pow(2, 14) */
pOut[i] = (q15_t) (pIn[i] * 16384.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 2.0)
{
pOut[i] = 0x7FFF;
}
}
}
/**
* @brief Converts float to fixed q30 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q30 (float *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1073741824.0f corresponds to pow(2, 30) */
pOut[i] = (q31_t) (pIn[i] * 1073741824.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 2.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Converts float to fixed q30 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1073741824.0f corresponds to pow(2, 30) */
pOut[i] = (q31_t) (pIn[i] * 536870912.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 4.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Converts float to fixed q28 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 268435456.0f corresponds to pow(2, 28) */
pOut[i] = (q31_t) (pIn[i] * 268435456.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 8.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Clip the float values to +/- 1
* @param[in,out] pIn input buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_clip_f32 (float *pIn, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
if (pIn[i] > 1.0f)
{
pIn[i] = 1.0;
}
else if ( pIn[i] < -1.0f)
{
pIn[i] = -1.0;
}
}
}
| 11,228 | C | 23.044968 | 77 | 0.583363 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/math_helper.h | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
*
* Title: math_helper.h
*
* Description: Prototypes of all helper functions required.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
#include "arm_math.h"
#ifndef MATH_HELPER_H
#define MATH_HELPER_H
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize);
void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples);
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples);
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_clip_f32(float *pIn, uint32_t numSamples);
uint32_t arm_calc_guard_bits(uint32_t num_adds);
void arm_apply_guard_bits (float32_t * pIn, uint32_t numSamples, uint32_t guard_bits);
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples);
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples);
uint32_t arm_calc_2pow(uint32_t guard_bits);
#endif
| 3,022 | C | 46.234374 | 91 | 0.705824 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/arm_dotproduct_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_dotproduct_example_f32.c
*
* Description: Example code computing dot product of two vectors.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup DotproductExample Dot Product Example
*
* \par Description:
* \par
* Demonstrates the use of the Multiply and Add functions to perform the dot product.
* The dot product of two vectors is obtained by multiplying corresponding elements
* and summing the products.
* \par Algorithm:
* \par
* The two input vectors \c A and \c B with length \c n, are multiplied element-by-element
* and then added to obtain dot product.
* \par
* This is denoted by the following equation:
* <pre> dotProduct = A[0] * B[0] + A[1] * B[1] + ... + A[n-1] * B[n-1]</pre>
*
* \par Block Diagram:
* \par
* \image html dotProduct.gif
*
* \par Variables Description:
* \par
* \li \c srcA_buf_f32 points to first input vector
* \li \c srcB_buf_f32 points to second input vector
* \li \c testOutput stores dot product of the two input vectors.
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_mult_f32()
* - arm_add_f32()
*
* <b> Refer </b>
* \link arm_dotproduct_example_f32.c \endlink
*
*/
/** \example arm_dotproduct_example_f32.c
*/
#include <math.h>
#include "arm_math.h"
/* ----------------------------------------------------------------------
* Defines each of the tests performed
* ------------------------------------------------------------------- */
#define MAX_BLOCKSIZE 32
#define DELTA (0.000001f)
/* ----------------------------------------------------------------------
* Test input data for Floating point Dot Product example for 32-blockSize
* Generated by the MATLAB randn() function
* ------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
** Test input data of srcA for blockSize 32
** ------------------------------------------------------------------- */
float32_t srcA_buf_f32[MAX_BLOCKSIZE] =
{
-0.4325648115282207, -1.6655843782380970, 0.1253323064748307,
0.2876764203585489, -1.1464713506814637, 1.1909154656429988,
1.1891642016521031, -0.0376332765933176, 0.3272923614086541,
0.1746391428209245, -0.1867085776814394, 0.7257905482933027,
-0.5883165430141887, 2.1831858181971011, -0.1363958830865957,
0.1139313135208096, 1.0667682113591888, 0.0592814605236053,
-0.0956484054836690, -0.8323494636500225, 0.2944108163926404,
-1.3361818579378040, 0.7143245518189522, 1.6235620644462707,
-0.6917757017022868, 0.8579966728282626, 1.2540014216025324,
-1.5937295764474768, -1.4409644319010200, 0.5711476236581780,
-0.3998855777153632, 0.6899973754643451
};
/* ----------------------------------------------------------------------
** Test input data of srcB for blockSize 32
** ------------------------------------------------------------------- */
float32_t srcB_buf_f32[MAX_BLOCKSIZE] =
{
1.7491401329284098, 0.1325982188803279, 0.3252281811989881,
-0.7938091410349637, 0.3149236145048914, -0.5272704888029532,
0.9322666565031119, 1.1646643544607362, -2.0456694357357357,
-0.6443728590041911, 1.7410657940825480, 0.4867684246821860,
1.0488288293660140, 1.4885752747099299, 1.2705014969484090,
-1.8561241921210170, 2.1343209047321410, 1.4358467535865909,
-0.9173023332875400, -1.1060770780029008, 0.8105708062681296,
0.6985430696369063, -0.4015827425012831, 1.2687512030669628,
-0.7836083053674872, 0.2132664971465569, 0.7878984786088954,
0.8966819356782295, -0.1869172943544062, 1.0131816724341454,
0.2484350696132857, 0.0596083377937976
};
/* Reference dot product output */
float32_t refDotProdOut = 5.9273644806352142;
/* ----------------------------------------------------------------------
* Declare Global variables
* ------------------------------------------------------------------- */
float32_t multOutput[MAX_BLOCKSIZE]; /* Intermediate output */
float32_t testOutput; /* Final ouput */
arm_status status; /* Status of the example */
int32_t main(void)
{
uint32_t i; /* Loop counter */
float32_t diff; /* Difference between reference and test outputs */
/* Multiplication of two input buffers */
arm_mult_f32(srcA_buf_f32, srcB_buf_f32, multOutput, MAX_BLOCKSIZE);
/* Accumulate the multiplication output values to
get the dot product of the two inputs */
for(i=0; i< MAX_BLOCKSIZE; i++)
{
arm_add_f32(&testOutput, &multOutput[i], &testOutput, 1);
}
/* absolute value of difference between ref and test */
diff = fabsf(refDotProdOut - testOutput);
/* Comparison of dot product value with reference */
if (diff > DELTA)
{
status = ARM_MATH_TEST_FAILURE;
}
if ( status == ARM_MATH_TEST_FAILURE)
{
while (1);
}
while (1); /* main function does not return */
}
/** \endlink */
| 6,776 | C | 36.860335 | 90 | 0.623081 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/arm_signal_converge_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_signal_converge_example_f32.c
*
* Description: Example code demonstrating convergence of an adaptive
* filter.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup SignalConvergence Signal Convergence Example
*
* \par Description:
* \par
* Demonstrates the ability of an adaptive filter to "learn" the transfer function of
* a FIR lowpass filter using the Normalized LMS Filter, Finite Impulse
* Response (FIR) Filter, and Basic Math Functions.
*
* \par Algorithm:
* \par
* The figure below illustrates the signal flow in this example. Uniformly distributed white
* noise is passed through an FIR lowpass filter. The output of the FIR filter serves as the
* reference input of the adaptive filter (normalized LMS filter). The white noise is input
* to the adaptive filter. The adaptive filter learns the transfer function of the FIR filter.
* The filter outputs two signals: (1) the output of the internal adaptive FIR filter, and
* (2) the error signal which is the difference between the adaptive filter and the reference
* output of the FIR filter. Over time as the adaptive filter learns the transfer function
* of the FIR filter, the first output approaches the reference output of the FIR filter,
* and the error signal approaches zero.
* \par
* The adaptive filter converges properly even if the input signal has a large dynamic
* range (i.e., varies from small to large values). The coefficients of the adaptive filter
* are initially zero, and then converge over 1536 samples. The internal function test_signal_converge()
* implements the stopping condition. The function checks if all of the values of the error signal have a
* magnitude below a threshold DELTA.
*
* \par Block Diagram:
* \par
* \image html SignalFlow.gif
*
*
* \par Variables Description:
* \par
* \li \c testInput_f32 points to the input data
* \li \c firStateF32 points to FIR state buffer
* \li \c lmsStateF32 points to Normalised Least mean square FIR filter state buffer
* \li \c FIRCoeff_f32 points to coefficient buffer
* \li \c lmsNormCoeff_f32 points to Normalised Least mean square FIR filter coefficient buffer
* \li \c wire1, wir2, wire3 temporary buffers
* \li \c errOutput, err_signal temporary error buffers
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_lms_norm_init_f32()
* - arm_fir_init_f32()
* - arm_fir_f32()
* - arm_lms_norm_f32()
* - arm_scale_f32()
* - arm_abs_f32()
* - arm_sub_f32()
* - arm_min_f32()
* - arm_copy_f32()
*
* <b> Refer </b>
* \link arm_signal_converge_example_f32.c \endlink
*
*/
/** \example arm_signal_converge_example_f32.c
*/
#include "arm_math.h"
#include "math_helper.h"
/* ----------------------------------------------------------------------
** Global defines for the simulation
* ------------------------------------------------------------------- */
#define TEST_LENGTH_SAMPLES 1536
#define NUMTAPS 32
#define BLOCKSIZE 32
#define DELTA_ERROR 0.000001f
#define DELTA_COEFF 0.0001f
#define MU 0.5f
#define NUMFRAMES (TEST_LENGTH_SAMPLES / BLOCKSIZE)
/* ----------------------------------------------------------------------
* Declare FIR state buffers and structure
* ------------------------------------------------------------------- */
float32_t firStateF32[NUMTAPS + BLOCKSIZE];
arm_fir_instance_f32 LPF_instance;
/* ----------------------------------------------------------------------
* Declare LMSNorm state buffers and structure
* ------------------------------------------------------------------- */
float32_t lmsStateF32[NUMTAPS + BLOCKSIZE];
float32_t errOutput[TEST_LENGTH_SAMPLES];
arm_lms_norm_instance_f32 lmsNorm_instance;
/* ----------------------------------------------------------------------
* Function Declarations for Signal Convergence Example
* ------------------------------------------------------------------- */
arm_status test_signal_converge_example( void );
/* ----------------------------------------------------------------------
* Internal functions
* ------------------------------------------------------------------- */
arm_status test_signal_converge(float32_t* err_signal,
uint32_t blockSize);
void getinput(float32_t* input,
uint32_t fr_cnt,
uint32_t blockSize);
/* ----------------------------------------------------------------------
* External Declarations for FIR F32 module Test
* ------------------------------------------------------------------- */
extern float32_t testInput_f32[TEST_LENGTH_SAMPLES];
extern float32_t lmsNormCoeff_f32[32];
extern const float32_t FIRCoeff_f32[32];
extern arm_lms_norm_instance_f32 lmsNorm_instance;
/* ----------------------------------------------------------------------
* Declare I/O buffers
* ------------------------------------------------------------------- */
float32_t wire1[BLOCKSIZE];
float32_t wire2[BLOCKSIZE];
float32_t wire3[BLOCKSIZE];
float32_t err_signal[BLOCKSIZE];
/* ----------------------------------------------------------------------
* Signal converge test
* ------------------------------------------------------------------- */
int32_t main(void)
{
uint32_t i;
arm_status status;
uint32_t index;
float32_t minValue;
/* Initialize the LMSNorm data structure */
arm_lms_norm_init_f32(&lmsNorm_instance, NUMTAPS, lmsNormCoeff_f32, lmsStateF32, MU, BLOCKSIZE);
/* Initialize the FIR data structure */
arm_fir_init_f32(&LPF_instance, NUMTAPS, (float32_t *)FIRCoeff_f32, firStateF32, BLOCKSIZE);
/* ----------------------------------------------------------------------
* Loop over the frames of data and execute each of the processing
* functions in the system.
* ------------------------------------------------------------------- */
for(i=0; i < NUMFRAMES; i++)
{
/* Read the input data - uniformly distributed random noise - into wire1 */
arm_copy_f32(testInput_f32 + (i * BLOCKSIZE), wire1, BLOCKSIZE);
/* Execute the FIR processing function. Input wire1 and output wire2 */
arm_fir_f32(&LPF_instance, wire1, wire2, BLOCKSIZE);
/* Execute the LMS Norm processing function*/
arm_lms_norm_f32(&lmsNorm_instance, /* LMSNorm instance */
wire1, /* Input signal */
wire2, /* Reference Signal */
wire3, /* Converged Signal */
err_signal, /* Error Signal, this will become small as the signal converges */
BLOCKSIZE); /* BlockSize */
/* apply overall gain */
arm_scale_f32(wire3, 5, wire3, BLOCKSIZE); /* in-place buffer */
}
status = ARM_MATH_SUCCESS;
/* -------------------------------------------------------------------------------
* Test whether the error signal has reached towards 0.
* ----------------------------------------------------------------------------- */
arm_abs_f32(err_signal, err_signal, BLOCKSIZE);
arm_min_f32(err_signal, BLOCKSIZE, &minValue, &index);
if (minValue > DELTA_ERROR)
{
status = ARM_MATH_TEST_FAILURE;
}
/* ----------------------------------------------------------------------
* Test whether the filter coefficients have converged.
* ------------------------------------------------------------------- */
arm_sub_f32((float32_t *)FIRCoeff_f32, lmsNormCoeff_f32, lmsNormCoeff_f32, NUMTAPS);
arm_abs_f32(lmsNormCoeff_f32, lmsNormCoeff_f32, NUMTAPS);
arm_min_f32(lmsNormCoeff_f32, NUMTAPS, &minValue, &index);
if (minValue > DELTA_COEFF)
{
status = ARM_MATH_TEST_FAILURE;
}
/* ----------------------------------------------------------------------
* Loop here if the signals did not pass the convergence check.
* This denotes a test failure
* ------------------------------------------------------------------- */
if ( status != ARM_MATH_SUCCESS)
{
while (1);
}
while (1); /* main function does not return */
}
/** \endlink */
| 9,906 | C | 37.103846 | 106 | 0.564607 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/math_helper.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0 b
*
* Project: CMSIS DSP Library
*
* Title: math_helper.c
*
* Description: Definition of all helper functions required.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
* Include standard header files
* -------------------------------------------------------------------- */
#include<math.h>
/* ----------------------------------------------------------------------
* Include project header files
* -------------------------------------------------------------------- */
#include "math_helper.h"
/**
* @brief Caluclation of SNR
* @param[in] pRef Pointer to the reference buffer
* @param[in] pTest Pointer to the test buffer
* @param[in] buffSize total number of samples
* @return SNR
* The function Caluclates signal to noise ratio for the reference output
* and test output
*/
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
{
float EnergySignal = 0.0, EnergyError = 0.0;
uint32_t i;
float SNR;
int temp;
int *test;
for (i = 0; i < buffSize; i++)
{
/* Checking for a NAN value in pRef array */
test = (int *)(&pRef[i]);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
/* Checking for a NAN value in pTest array */
test = (int *)(&pTest[i]);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
EnergySignal += pRef[i] * pRef[i];
EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
}
/* Checking for a NAN value in EnergyError */
test = (int *)(&EnergyError);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
SNR = 10 * log10 (EnergySignal / EnergyError);
return (SNR);
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q15 (q15_t * input_buf, uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Converts float to fixed in q12.20 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to outputbuffer
* @param[in] numSamples number of samples in the input buffer
* @return none
* The function converts floating point values to fixed point(q12.20) values
*/
void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1048576.0f corresponds to pow(2, 20) */
pOut[i] = (q31_t) (pIn[i] * 1048576.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 1.0)
{
pOut[i] = 0x000FFFFF;
}
}
}
/**
* @brief Compare MATLAB Reference Output and ARM Test output
* @param[in] pIn Pointer to Ref buffer
* @param[in] pOut Pointer to Test buffer
* @param[in] numSamples number of samples in the buffer
* @return maximum difference
*/
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{
uint32_t i;
int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
if (diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
}
/**
* @brief Compare MATLAB Reference Output and ARM Test output
* @param[in] pIn Pointer to Ref buffer
* @param[in] pOut Pointer to Test buffer
* @param[in] numSamples number of samples in the buffer
* @return maximum difference
*/
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
if (diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q31 (q31_t * input_buf,
uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q7 (q7_t * input_buf,
uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Caluclates number of guard bits
* @param[in] num_adds number of additions
* @return guard bits
* The function Caluclates the number of guard bits
* depending on the numtaps
*/
uint32_t arm_calc_guard_bits (uint32_t num_adds)
{
uint32_t i = 1, j = 0;
if (num_adds == 1)
{
return (0);
}
while (i < num_adds)
{
i = i * 2;
j++;
}
return (j);
}
/**
* @brief Apply guard bits to buffer
* @param[in,out] pIn pointer to input buffer
* @param[in] numSamples number of samples in the input buffer
* @param[in] guard_bits guard bits
* @return none
*/
void arm_apply_guard_bits (float32_t *pIn,
uint32_t numSamples,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
pIn[i] = pIn[i] * arm_calc_2pow(guard_bits);
}
}
/**
* @brief Calculates pow(2, numShifts)
* @param[in] numShifts number of shifts
* @return pow(2, numShifts)
*/
uint32_t arm_calc_2pow(uint32_t numShifts)
{
uint32_t i, val = 1;
for (i = 0; i < numShifts; i++)
{
val = val * 2;
}
return(val);
}
/**
* @brief Converts float to fixed q14
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 16384.0f corresponds to pow(2, 14) */
pOut[i] = (q15_t) (pIn[i] * 16384.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 2.0)
{
pOut[i] = 0x7FFF;
}
}
}
/**
* @brief Converts float to fixed q30 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q30 (float *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1073741824.0f corresponds to pow(2, 30) */
pOut[i] = (q31_t) (pIn[i] * 1073741824.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 2.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Converts float to fixed q30 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1073741824.0f corresponds to pow(2, 30) */
pOut[i] = (q31_t) (pIn[i] * 536870912.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 4.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Converts float to fixed q28 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 268435456.0f corresponds to pow(2, 28) */
pOut[i] = (q31_t) (pIn[i] * 268435456.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 8.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Clip the float values to +/- 1
* @param[in,out] pIn input buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_clip_f32 (float *pIn, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
if (pIn[i] > 1.0f)
{
pIn[i] = 1.0;
}
else if ( pIn[i] < -1.0f)
{
pIn[i] = -1.0;
}
}
}
| 11,228 | C | 23.044968 | 77 | 0.583363 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/arm_signal_converge_data.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_signal_converge_data.c
*
* Description: Test input data for Floating point LMS Norm FIR filter
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
#include "arm_math.h"
/* ----------------------------------------------------------------------
** Test input data for Floating point LMS Norm FIR filter
** Generated by the MATLAB randn() function
** ------------------------------------------------------------------- */
float32_t testInput_f32[1536] =
{
-0.432565, -1.665584, 0.125332, 0.287676, -1.146471, 1.190915, 1.189164, -0.037633,
0.327292, 0.174639, -0.186709, 0.725791, -0.588317, 2.183186, -0.136396, 0.113931,
1.066768, 0.059281, -0.095648, -0.832349, 0.294411, -1.336182, 0.714325, 1.623562,
-0.691776, 0.857997, 1.254001, -1.593730, -1.440964, 0.571148, -0.399886, 0.689997,
0.815622, 0.711908, 1.290250, 0.668601, 1.190838, -1.202457, -0.019790, -0.156717,
-1.604086, 0.257304, -1.056473, 1.415141, -0.805090, 0.528743, 0.219321, -0.921902,
-2.170674, -0.059188, -1.010634, 0.614463, 0.507741, 1.692430, 0.591283, -0.643595,
0.380337, -1.009116, -0.019511, -0.048221, 0.000043, -0.317859, 1.095004, -1.873990,
0.428183, 0.895638, 0.730957, 0.577857, 0.040314, 0.677089, 0.568900, -0.255645,
-0.377469, -0.295887, -1.475135, -0.234004, 0.118445, 0.314809, 1.443508, -0.350975,
0.623234, 0.799049, 0.940890, -0.992092, 0.212035, 0.237882, -1.007763, -0.742045,
1.082295, -0.131500, 0.389880, 0.087987, -0.635465, -0.559573, 0.443653, -0.949904,
0.781182, 0.568961, -0.821714, -0.265607, -1.187777, -2.202321, 0.986337, -0.518635,
0.327368, 0.234057, 0.021466, -1.003944, -0.947146, -0.374429, -1.185886, -1.055903,
1.472480, 0.055744, -1.217317, -0.041227, -1.128344, -1.349278, -0.261102, 0.953465,
0.128644, 0.656468, -1.167819, -0.460605, -0.262440, -1.213152, -1.319437, 0.931218,
0.011245, -0.645146, 0.805729, 0.231626, -0.989760, 1.339586, 0.289502, 1.478917,
1.138028, -0.684139, -1.291936, -0.072926, -0.330599, -0.843628, 0.497770, 1.488490,
-0.546476, -0.846758, -0.246337, 0.663024, -0.854197, -1.201315, -0.119869, -0.065294,
0.485296, -0.595491, -0.149668, -0.434752, -0.079330, 1.535152, -0.606483, -1.347363,
0.469383, -0.903567, 0.035880, -0.627531, 0.535398, 0.552884, -0.203690, -2.054325,
0.132561, 1.592941, 1.018412, -1.580402, -0.078662, -0.681657, -1.024553, -1.234353,
0.288807, -0.429303, 0.055801, -0.367874, -0.464973, 0.370961, 0.728283, 2.112160,
-1.357298, -1.022610, 1.037834, -0.389800, -1.381266, 0.315543, 1.553243, 0.707894,
1.957385, 0.504542, 1.864529, -0.339812, -1.139779, -0.211123, 1.190245, -1.116209,
0.635274, -0.601412, 0.551185, -1.099840, 0.085991, -2.004563, -0.493088, 0.462048,
-0.321005, 1.236556, -0.631280, -2.325211, -1.231637, 1.055648, -0.113224, 0.379224,
0.944200, -2.120427, -0.644679, -0.704302, -1.018137, -0.182082, 1.521013, -0.038439,
1.227448, -0.696205, 0.007524, -0.782893, 0.586939, -0.251207, 0.480136, 0.668155,
-0.078321, 0.889173, 2.309287, 0.524639, -0.011787, 0.913141, 0.055941, -1.107070,
0.485498, -0.005005, -0.276218, 1.276452, 1.863401, -0.522559, 0.103424, -0.807649,
0.680439, -2.364590, 0.990115, 0.218899, 0.261662, 1.213444, -0.274667, -0.133134,
-1.270500, -1.663606, -0.703554, 0.280880, -0.541209, -1.333531, 1.072686, -0.712085,
-0.011286, -0.000817, -0.249436, 0.396575, -0.264013, -1.664011, -1.028975, 0.243095,
-1.256590, -0.347183, -0.941372, -1.174560, -1.021142, -0.401667, 0.173666, -0.116118,
1.064119, -0.245386, -1.517539, 0.009734, 0.071373, 0.316536, 0.499826, 1.278084,
-0.547816, 0.260808, -0.013177, -0.580264, 2.136308, -0.257617, -1.409528, 1.770101,
0.325546, -1.119040, 0.620350, 1.269782, -0.896043, 0.135175, -0.139040, -1.163395,
1.183720, -0.015430, 0.536219, -0.716429, -0.655559, 0.314363, 0.106814, 1.848216,
-0.275106, 2.212554, 1.508526, -1.945079, -1.680543, -0.573534, -0.185817, 0.008934,
0.836950, -0.722271, -0.721490, -0.201181, -0.020464, 0.278890, 1.058295, 0.621673,
-1.750615, 0.697348, 0.811486, 0.636345, 1.310080, 0.327098, -0.672993, -0.149327,
-2.449018, 0.473286, 0.116946, -0.591104, -0.654708, -1.080662, -0.047731, 0.379345,
-0.330361, -0.499898, -0.035979, -0.174760, -0.957265, 1.292548, 0.440910, 1.280941,
-0.497730, -1.118717, 0.807650, 0.041200, -0.756209, -0.089129, -2.008850, 1.083918,
-0.981191, -0.688489, 1.339479, -0.909243, -0.412858, -0.506163, 1.619748, 0.080901,
-1.081056, -1.124518, 1.735676, 1.937459, 1.635068, -1.255940, -0.213538, -0.198932,
0.307499, -0.572325, -0.977648, -0.446809, 1.082092, 2.372648, 0.229288, -0.266623,
0.701672, -0.487590, 1.862480, 1.106851, -1.227566, -0.669885, 1.340929, 0.388083,
0.393059, -1.707334, 0.227859, 0.685633, -0.636790, -1.002606, -0.185621, -1.054033,
-0.071539, 0.279198, 1.373275, 0.179841, -0.542017, 1.634191, 0.825215, 0.230761,
0.671634, -0.508078, 0.856352, 0.268503, 0.624975, -1.047338, 1.535670, 0.434426,
-1.917136, 0.469940, 1.274351, 0.638542, 1.380782, 1.319843, -0.909429, -2.305605,
1.788730, 0.390798, 0.020324, -0.405977, -1.534895, 0.221373, -1.374479, -0.839286,
-0.208643, 0.755913, 0.375734, -1.345413, 1.481876, 0.032736, 1.870453, -1.208991,
-0.782632, -0.767299, -0.107200, -0.977057, -0.963988, -2.379172, -0.838188, 0.257346,
-0.183834, -0.167615, -0.116989, 0.168488, -0.501206, -0.705076, 0.508165, -0.420922,
0.229133, -0.959497, -0.146043, 0.744538, -0.890496, 0.139062, -0.236144, -0.075459,
-0.358572, -2.077635, -0.143546, 1.393341, 0.651804, -0.377134, -0.661443, 0.248958,
-0.383516, -0.528480, 0.055388, 1.253769, -2.520004, 0.584856, -1.008064, 0.944285,
-2.423957, -0.223831, 0.058070, -0.424614, -0.202918, -1.513077, -1.126352, -0.815002,
0.366614, -0.586107, 1.537409, 0.140072, -1.862767, -0.454193, -0.652074, 0.103318,
-0.220632, -0.279043, -0.733662, -0.064534, -1.444004, 0.612340, -1.323503, -0.661577,
-0.146115, 0.248085, -0.076633, 1.738170, 1.621972, 0.626436, 0.091814, -0.807607,
-0.461337, -1.405969, -0.374530, -0.470911, 1.751296, 0.753225, 0.064989, -0.292764,
0.082823, 0.766191, 2.236850, 0.326887, 0.863304, 0.679387, 0.554758, 1.001630,
1.259365, 0.044151, -0.314138, 0.226708, 0.996692, 1.215912, -0.542702, 0.912228,
-0.172141, -0.335955, 0.541487, 0.932111, -0.570253, -1.498605, -0.050346, 0.553025,
0.083498, 1.577524, -0.330774, 0.795155, -0.784800, -1.263121, 0.666655, -1.392632,
-1.300562, -0.605022, -1.488565, 0.558543, -0.277354, -1.293685, -0.888435, -0.986520,
-0.071618, -2.414591, -0.694349, -1.391389, 0.329648, 0.598544, 0.147175, -0.101439,
-2.634981, 0.028053, -0.876310, -0.265477, -0.327578, -1.158247, 0.580053, 0.239756,
-0.350885, 0.892098, 1.578299, -1.108174, -0.025931, -1.110628, 0.750834, 0.500167,
-0.517261, -0.559209, -0.753371, 0.925813, -0.248520, -0.149835, -1.258415, 0.312620,
2.690277, 0.289696, -1.422803, 0.246786, -1.435773, 0.148573, -1.693073, 0.719188,
1.141773, 1.551936, 1.383630, -0.758092, 0.442663, 0.911098, -1.074086, 0.201762,
0.762863, -1.288187, -0.952962, 0.778175, -0.006331, 0.524487, 1.364272, 0.482039,
-0.787066, 0.751999, -0.166888, -0.816228, 2.094065, 0.080153, -0.937295, 0.635739,
1.682028, 0.593634, 0.790153, 0.105254, -0.158579, 0.870907, -0.194759, 0.075474,
-0.526635, -0.685484, -0.268388, -1.188346, 0.248579, 0.102452, -0.041007, -2.247582,
-0.510776, 0.249243, 0.369197, 0.179197, -0.037283, -1.603310, 0.339372, -0.131135,
0.485190, 0.598751, -0.086031, 0.325292, -0.335143, -0.322449, -0.382374, -0.953371,
0.233576, 1.235245, -0.578532, -0.501537, 0.722864, 0.039498, 1.541279, -1.701053,
-1.033741, -0.763708, 2.176426, 0.431612, -0.443765, 0.029996, -0.315671, 0.977846,
0.018295, 0.817963, 0.702341, -0.231271, -0.113690, 0.127941, -0.799410, -0.238612,
-0.089463, -1.023264, 0.937538, -1.131719, -0.710702, -1.169501, 1.065437, -0.680394,
-1.725773, 0.813200, 1.441867, 0.672272, 0.138665, -0.859534, -0.752251, 1.229615,
1.150754, -0.608025, 0.806158, 0.217133, -0.373461, -0.832030, 0.286866, -1.818892,
-1.573051, 2.015666, -0.071982, 2.628909, -0.243317, 0.173276, 0.923207, -0.178553,
-0.521705, 1.431962, -0.870117, 0.807542, -0.510635, 0.743514, 0.847898, -0.829901,
0.532994, 1.032848, -1.052024, 0.362114, -0.036787, -1.227636, -0.275099, -0.160435,
-1.083575, -1.954213, -0.909487, -0.005579, -1.723490, 1.263077, -0.600433, -2.063925,
0.110911, 1.487614, 0.053002, 0.161981, -0.026878, 0.173576, 0.882168, 0.182294,
0.755295, 0.508035, 0.131880, 0.280104, -0.982848, -0.944087, -0.013058, 0.354345,
-0.894709, 0.812111, 0.109537, 2.731644, 0.411079, -1.306862, 0.383806, 0.499504,
-0.510786, 0.234922, -0.597825, 0.020771, 0.419443, 1.191104, 0.771214, -2.644222,
0.285430, 0.826093, -0.008122, 0.858438, 0.774788, 1.305945, 1.231503, 0.958564,
-1.654548, -0.990396, 0.685236, -0.974870, -0.606726, 0.686794, 0.020049, 1.063801,
-1.341050, 0.479510, -1.633974, -1.442665, 0.293781, -0.140364, -1.130341, -0.292538,
-0.582536, -0.896348, 0.248601, -1.489663, 0.313509, -2.025084, 0.528990, 0.343471,
0.758193, -0.691940, 0.680179, -1.072541, 0.899772, -2.123092, 0.284712, -0.733323,
-0.773376, 0.151842, -0.336843, 0.970761, -0.107236, 1.013492, -0.475347, 0.068948,
0.398592, 1.116326, 0.620451, -0.287674, -1.371773, -0.685868, 0.331685, -0.997722,
0.291418, 1.107078, 0.244959, 0.164976, 0.406231, 1.215981, 1.448424, -1.025137,
0.205418, 0.588882, -0.264024, 2.495318, 0.855948, -0.850954, 0.811879, 0.700242,
0.759938, -1.712909, 1.537021, -1.609847, 1.109526, -1.109704, 0.385469, 0.965231,
0.818297, 0.037049, -0.926012, -0.111919, -0.803030, -1.665006, -0.901401, 0.588350,
0.554159, -0.415173, 0.061795, 0.457432, 0.199014, 0.257558, 2.080730, -2.277237,
0.339022, 0.289894, 0.662261, -0.580860, 0.887752, 0.171871, 0.848821, 0.963769,
1.321918, -0.064345, 1.317053, 0.228017, -1.429637, -0.149701, -0.504968, -1.729141,
-0.417472, -0.614969, 0.720777, 0.339364, 0.882845, 0.284245, -0.145541, -0.089646,
0.289161, 1.164831, 0.805729, -1.355643, 0.120893, -0.222178, 0.571732, -0.300140,
1.134277, -0.179356, -1.467067, 1.395346, 0.440836, 0.565384, -0.693623, 0.833869,
-2.237378, 1.097644, -0.001617, -1.614573, -1.228727, 0.207405, 0.220942, -1.006073,
-0.453067, 1.399453, -0.461964, 0.032716, 0.798783, 0.896816, 0.137892, -1.619146,
-1.646606, 0.428707, -0.737231, 0.564926, -1.384167, 0.460268, 0.629384, 0.379847,
-1.013330, -0.347243, 0.441912, -1.590240, -0.701417, -1.077601, 1.002220, 1.729481,
0.709032, -0.747897, 0.228862, -0.223497, -0.853275, 0.345627, 0.109764, -1.133039,
-0.683124, -0.277856, 0.654790, -1.248394, -0.597539, -0.481813, 0.983372, 1.762121,
1.427402, 0.911763, 0.326823, 0.069619, -1.499763, -0.418223, -0.021037, 0.228425,
-1.008196, -0.664622, 0.558177, -1.188542, -0.775481, 0.271042, 1.534976, -1.052283,
0.625559, -0.797626, -0.313522, -0.602210, 1.259060, 0.858484, -2.105292, -0.360937,
0.553557, -1.556384, -0.206666, -0.425568, 0.493778, -0.870908, 0.079828, -0.521619,
-1.413861, -0.384293, -0.457922, -0.291471, -0.301224, -1.588594, 1.094287, 1.324167,
-0.126480, -0.737164, 0.213719, -0.400529, 0.064938, -1.757996, 1.686748, 0.327400,
0.715967, 1.598648, -2.064741, -0.743632, 0.176185, 0.527839, -0.553153, 0.298280,
-1.226607, -0.189676, -0.301713, 0.956956, -0.533366, -0.901082, -0.892552, 0.278717,
-0.745807, 1.603464, 0.574270, 0.320655, -0.151383, 0.315762, 1.343703, -2.237832,
1.292906, -0.378459, 0.002521, 0.884641, 0.582450, -1.614244, -1.503666, 0.573586,
-0.910537, -1.631277, -0.359138, -0.397616, -1.161307, -1.109838, 0.290672, -1.910239,
1.314768, 0.665319, -0.275115, -0.023022, -0.907976, -1.043657, 0.373516, 0.901532,
1.278539, -0.128456, 0.612821, 1.956518, 2.266326, -0.373959, 2.238039, -0.159580,
-0.703281, 0.563477, -0.050296, 1.163593, 0.658808, -1.550089, -3.029118, 0.540578,
-1.008998, 0.908047, 1.582303, -0.979088, 1.007902, 0.158491, -0.586927, 1.574082,
-0.516649, 1.227800, 1.583876, -2.088950, 2.949545, 1.356125, 1.050068, -0.767170,
-0.257653, -1.371845, -1.267656, -0.894948, 0.589089, 1.842629, 1.347967, -0.491253,
-2.177568, 0.237000, -0.735411, -1.779419, 0.448030, 0.581214, 0.856607, -0.266263,
-0.417470, -0.205806, -0.174323, 0.217577, 1.684295, 0.119528, 0.650667, 2.080061,
-0.339225, 0.730113, 0.293969, -0.849109, -2.533858, -2.378941, -0.346276, -0.610937,
-0.408192, -1.415611, 0.227122, 0.207974, -0.719718, 0.757762, -1.643135, -1.056813,
-0.251662, -1.298441, 1.233255, 1.494625, 0.235938, -1.404359, 0.658791, -2.556613,
-0.534945, 3.202525, 0.439198, -1.149901, 0.886765, -0.283386, 1.035336, -0.364878,
1.341987, 1.008872, 0.213874, -0.299264, 0.255849, -0.190826, -0.079060, 0.699851,
-0.796540, -0.801284, -0.007599, -0.726810, -1.490902, 0.870335, -0.265675, -1.566695,
-0.394636, -0.143855, -2.334247, -1.357539, -1.815689, 1.108422, -0.142115, 1.112757,
0.559264, 0.478370, -0.679385, 0.284967, -1.332935, -0.723980, -0.663600, 0.198443,
-1.794868, -1.387673, 0.197768, 1.469328, 0.366493, -0.442775, -0.048563, 0.077709,
1.957910, -0.072848, 0.938810, -0.079608, -0.800959, 0.309424, 1.051826, -1.664211,
-1.090792, -0.191731, 0.463401, -0.924147, -0.649657, 0.622893, -1.335107, 1.047689,
0.863327, -0.642411, 0.660010, 1.294116, 0.314579, 0.859573, 0.128670, 0.016568,
-0.072801, -0.994310, -0.747358, -0.030814, 0.988355, -0.599017, 1.476644, -0.813801,
0.645040, -1.309919, -0.867425, -0.474233, 0.222417, 1.871323, 0.110001, -0.411341,
0.511242, -1.199117, -0.096361, 0.445817, -0.295825, -0.167996, 0.179543, 0.421118,
1.677678, 1.996949, 0.696964, -1.366382, 0.363045, -0.567044, -1.044154, 0.697139,
0.484026, -0.193751, -0.378095, -0.886374, -1.840197, -1.628195, -1.173789, -0.415411,
0.175088, 0.229433, -1.240889, 0.700004, 0.426877, 1.454803, -0.510186, -0.006657,
-0.525496, 0.717698, 1.088374, 0.500552, 2.771790, -0.160309, 0.429489, -1.966817,
-0.546019, -1.888395, -0.107952, -1.316144, -0.672632, -0.902365, -0.154798, 0.947242,
1.550375, 0.429040, -0.560795, 0.179304, -0.771509, -0.943390, -1.407569, -1.906131,
-0.065293, 0.672149, 0.206147, -0.008124, 0.020042, -0.558447, 1.886079, -0.219975,
-1.414395, -0.302811, -0.569574, -0.121495, -0.390171, -0.844287, -1.737757, -0.449520,
-1.547933, -0.095776, 0.907714, 2.369602, 0.519768, 0.410525, 1.052585, 0.428784,
1.295088, -0.186053, 0.130733, -0.657627, -0.759267, -0.595170, 0.812400, 0.069541,
-1.833687, 1.827363, 0.654075, -1.544769, -0.375109, 0.207688, -0.765615, -0.106355,
0.338769, 1.033461, -1.404822, -1.030570, -0.643372, 0.170787, 1.344839, 1.936273,
0.741336, 0.811980, -0.142808, -0.099858, -0.800131, 0.493249, 1.237574, 1.295951,
-0.278196, 0.217127, 0.630728, -0.548549, 0.229632, 0.355311, 0.521284, -0.615971,
1.345803, 0.974922, -2.377934, -1.092319, -0.325710, -2.012228, 1.567660, 0.233337,
0.646420, -1.129412, 0.197038, 1.696870, 0.726034, 0.792526, 0.603357, -0.058405,
-1.108666, 2.144229, -1.352821, 0.457021, 0.391175, 2.073013, -0.323318, 1.468132,
-0.502399, 0.209593, 0.754800, -0.948189, 0.613157, 1.760503, 0.088762, 2.595570,
-0.675470, 2.786804, -0.016827, 0.271651, -0.914102, -1.951371, -0.317418, 0.588333,
0.828996, -1.674851, -1.922293, -0.436662, 0.044974, 2.416609, -0.309892, 0.187583,
0.947699, -0.525703, -1.115605, -1.592320, 1.174844, 0.485144, 1.645480, -0.454233,
1.008768, 2.049403, 0.602020, 0.017860, -1.610426, 1.238752, 0.683587, -0.780716,
0.530979, 2.134498, 0.354361, 0.231700, 1.287980, -0.013488, -1.333345, -0.556343,
0.755597, -0.911854, 1.371684, 0.245580, 0.118845, 0.384690, -0.070152, -0.578309,
0.469308, 1.299687, 1.634798, -0.702809, 0.807253, -1.027451, 1.294496, 0.014930,
0.218705, 1.713188, -2.078805, 0.112917, -1.086491, -1.558311, 0.637406, -0.404576,
-0.403325, 0.084076, -0.435349, -0.562623, 0.878062, -0.814650, -0.258363, 0.493299,
-0.802694, -0.008329, 0.627571, 0.154382, 2.580735, -1.306246, 1.023526, 0.777795,
-0.833884, -0.586663, 0.065664, -0.012342, -0.076987, -1.558587, 1.702607, -0.468984,
0.094619, 0.287071, 0.919354, 0.510136, 0.245440, -1.400519, 0.969571, 1.593698,
-1.437917, -1.534230, -0.074710, 0.081459, -0.843240, -0.564640, -0.028207, -1.243702,
0.733039, 0.059580, 0.149144, 1.595857, -0.777250, 1.550277, 1.055002, -0.166654,
0.314484, 1.419571, 0.327348, 0.475653, 0.398754, -0.072770, 1.314784, 0.978279,
1.722114, -0.412302, 0.565133, 0.739851, 0.220138, 1.312807, 0.629152, -1.107987,
-0.447001, -0.725993, 0.354045, -0.506772, -2.103747, -0.664684, 1.450110, -0.329805,
2.701872, -1.634939, -0.536325, 0.547223, 1.492603, -0.455243, -0.496416, 1.235260,
0.040926, 0.748467, 1.230764, 0.304903, 1.077771, 0.765151, -1.319580, -0.509191,
0.555116, -1.957625, -0.760453, -2.443886, -0.659366, -0.114779, 0.300079, -0.583996,
-3.073745, 1.551042, -0.407369, 1.428095, -1.353242, 0.903970, 0.541671, -0.465020
};
/* ----------------------------------------------------------------------
** Coefficients for 32-tap filter for Floating point LMS FIR filter
* FIR high pass filter with cutoff freq 9.6kHz (transition 9.6KHz to 11.52KHz)
** ------------------------------------------------------------------- */
float32_t lmsNormCoeff_f32[32] = {
-0.004240, 0.002301, 0.008860, -0.000000, -0.019782, -0.010543, 0.032881, 0.034736,
-0.037374, -0.069586, 0.022397, 0.102169, 0.014185, -0.115908, -0.061648, 0.101018,
0.101018, -0.061648, -0.115908, 0.014185, 0.102169, 0.022397, -0.069586, -0.037374,
0.034736, 0.032881, -0.010543, -0.019782, -0.000000, 0.008860, 0.002301, -0.004240
};
/* ----------------------------------------------------------------------
** Coefficients for 32-tap filter for Floating point FIR filter
* FIR low pass filter with cutoff freq 24Hz (transition 24Hz to 240Hz)
** ------------------------------------------------------------------- */
const float32_t FIRCoeff_f32[32] = {
0.004502, 0.005074, 0.006707, 0.009356, 0.012933, 0.017303, 0.022298, 0.027717,
0.033338, 0.038930, 0.044258, 0.049098, 0.053243, 0.056519, 0.058784, 0.059941,
0.059941, 0.058784, 0.056519, 0.053243, 0.049098, 0.044258, 0.038930, 0.033338,
0.027717, 0.022298, 0.017303, 0.012933, 0.009356, 0.006707, 0.005074, 0.004502
};
| 19,965 | C | 72.948148 | 88 | 0.649336 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/math_helper.h | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
*
* Title: math_helper.h
*
* Description: Prototypes of all helper functions required.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
#include "arm_math.h"
#ifndef MATH_HELPER_H
#define MATH_HELPER_H
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize);
void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples);
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples);
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_clip_f32(float *pIn, uint32_t numSamples);
uint32_t arm_calc_guard_bits(uint32_t num_adds);
void arm_apply_guard_bits (float32_t * pIn, uint32_t numSamples, uint32_t guard_bits);
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples);
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples);
uint32_t arm_calc_2pow(uint32_t guard_bits);
#endif
| 3,022 | C | 46.234374 | 91 | 0.705824 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/arm_matrix_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_matrix_example_f32.c
*
* Description: Example code demonstrating least square fit to data
* using matrix functions
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup MatrixExample Matrix Example
*
* \par Description:
* \par
* Demonstrates the use of Matrix Transpose, Matrix Muliplication, and Matrix Inverse
* functions to apply least squares fitting to input data. Least squares fitting is
* the procedure for finding the best-fitting curve that minimizes the sum of the
* squares of the offsets (least square error) from a given set of data.
*
* \par Algorithm:
* \par
* The linear combination of parameters considered is as follows:
* \par
* <code>A * X = B</code>, where \c X is the unknown value and can be estimated
* from \c A & \c B.
* \par
* The least squares estimate \c X is given by the following equation:
* \par
* <code>X = Inverse(A<sup>T</sup> * A) * A<sup>T</sup> * B</code>
*
* \par Block Diagram:
* \par
* \image html matrixExample.gif
*
* \par Variables Description:
* \par
* \li \c A_f32 input matrix in the linear combination equation
* \li \c B_f32 output matrix in the linear combination equation
* \li \c X_f32 unknown matrix estimated using \c A_f32 & \c B_f32 matrices
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_mat_init_f32()
* - arm_mat_trans_f32()
* - arm_mat_mult_f32()
* - arm_mat_inverse_f32()
*
* <b> Refer </b>
* \link arm_matrix_example_f32.c \endlink
*
*/
/** \example arm_matrix_example_f32.c
*/
#include "arm_math.h"
#include "math_helper.h"
#define SNR_THRESHOLD 90
/* --------------------------------------------------------------------------------
* Test input data(Cycles) taken from FIR Q15 module for differant cases of blockSize
* and tapSize
* --------------------------------------------------------------------------------- */
const float32_t B_f32[4] =
{
782.0, 7577.0, 470.0, 4505.0
};
/* --------------------------------------------------------------------------------
* Formula to fit is C1 + C2 * numTaps + C3 * blockSize + C4 * numTaps * blockSize
* -------------------------------------------------------------------------------- */
const float32_t A_f32[16] =
{
/* Const, numTaps, blockSize, numTaps*blockSize */
1.0, 32.0, 4.0, 128.0,
1.0, 32.0, 64.0, 2048.0,
1.0, 16.0, 4.0, 64.0,
1.0, 16.0, 64.0, 1024.0,
};
/* ----------------------------------------------------------------------
* Temporary buffers for storing intermediate values
* ------------------------------------------------------------------- */
/* Transpose of A Buffer */
float32_t AT_f32[16];
/* (Transpose of A * A) Buffer */
float32_t ATMA_f32[16];
/* Inverse(Transpose of A * A) Buffer */
float32_t ATMAI_f32[16];
/* Test Output Buffer */
float32_t X_f32[4];
/* ----------------------------------------------------------------------
* Reference ouput buffer C1, C2, C3 and C4 taken from MATLAB
* ------------------------------------------------------------------- */
const float32_t xRef_f32[4] = {73.0, 8.0, 21.25, 2.875};
float32_t snr;
/* ----------------------------------------------------------------------
* Max magnitude FFT Bin test
* ------------------------------------------------------------------- */
int32_t main(void)
{
arm_matrix_instance_f32 A; /* Matrix A Instance */
arm_matrix_instance_f32 AT; /* Matrix AT(A transpose) instance */
arm_matrix_instance_f32 ATMA; /* Matrix ATMA( AT multiply with A) instance */
arm_matrix_instance_f32 ATMAI; /* Matrix ATMAI(Inverse of ATMA) instance */
arm_matrix_instance_f32 B; /* Matrix B instance */
arm_matrix_instance_f32 X; /* Matrix X(Unknown Matrix) instance */
uint32_t srcRows, srcColumns; /* Temporary variables */
arm_status status;
/* Initialise A Matrix Instance with numRows, numCols and data array(A_f32) */
srcRows = 4;
srcColumns = 4;
arm_mat_init_f32(&A, srcRows, srcColumns, (float32_t *)A_f32);
/* Initialise Matrix Instance AT with numRows, numCols and data array(AT_f32) */
srcRows = 4;
srcColumns = 4;
arm_mat_init_f32(&AT, srcRows, srcColumns, AT_f32);
/* calculation of A transpose */
status = arm_mat_trans_f32(&A, &AT);
/* Initialise ATMA Matrix Instance with numRows, numCols and data array(ATMA_f32) */
srcRows = 4;
srcColumns = 4;
arm_mat_init_f32(&ATMA, srcRows, srcColumns, ATMA_f32);
/* calculation of AT Multiply with A */
status = arm_mat_mult_f32(&AT, &A, &ATMA);
/* Initialise ATMAI Matrix Instance with numRows, numCols and data array(ATMAI_f32) */
srcRows = 4;
srcColumns = 4;
arm_mat_init_f32(&ATMAI, srcRows, srcColumns, ATMAI_f32);
/* calculation of Inverse((Transpose(A) * A) */
status = arm_mat_inverse_f32(&ATMA, &ATMAI);
/* calculation of (Inverse((Transpose(A) * A)) * Transpose(A)) */
status = arm_mat_mult_f32(&ATMAI, &AT, &ATMA);
/* Initialise B Matrix Instance with numRows, numCols and data array(B_f32) */
srcRows = 4;
srcColumns = 1;
arm_mat_init_f32(&B, srcRows, srcColumns, (float32_t *)B_f32);
/* Initialise X Matrix Instance with numRows, numCols and data array(X_f32) */
srcRows = 4;
srcColumns = 1;
arm_mat_init_f32(&X, srcRows, srcColumns, X_f32);
/* calculation ((Inverse((Transpose(A) * A)) * Transpose(A)) * B) */
status = arm_mat_mult_f32(&ATMA, &B, &X);
/* Comparison of reference with test output */
snr = arm_snr_f32((float32_t *)xRef_f32, X_f32, 4);
/*------------------------------------------------------------------------------
* Initialise status depending on SNR calculations
*------------------------------------------------------------------------------*/
if ( snr > SNR_THRESHOLD)
{
status = ARM_MATH_SUCCESS;
}
else
{
status = ARM_MATH_TEST_FAILURE;
}
/* ----------------------------------------------------------------------
** Loop here if the signals fail the PASS check.
** This denotes a test failure
** ------------------------------------------------------------------- */
if ( status != ARM_MATH_SUCCESS)
{
while (1);
}
while (1); /* main function does not return */
}
/** \endlink */
| 8,110 | C | 33.662393 | 88 | 0.56942 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/math_helper.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0 b
*
* Project: CMSIS DSP Library
*
* Title: math_helper.c
*
* Description: Definition of all helper functions required.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
* Include standard header files
* -------------------------------------------------------------------- */
#include<math.h>
/* ----------------------------------------------------------------------
* Include project header files
* -------------------------------------------------------------------- */
#include "math_helper.h"
/**
* @brief Caluclation of SNR
* @param[in] pRef Pointer to the reference buffer
* @param[in] pTest Pointer to the test buffer
* @param[in] buffSize total number of samples
* @return SNR
* The function Caluclates signal to noise ratio for the reference output
* and test output
*/
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
{
float EnergySignal = 0.0, EnergyError = 0.0;
uint32_t i;
float SNR;
int temp;
int *test;
for (i = 0; i < buffSize; i++)
{
/* Checking for a NAN value in pRef array */
test = (int *)(&pRef[i]);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
/* Checking for a NAN value in pTest array */
test = (int *)(&pTest[i]);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
EnergySignal += pRef[i] * pRef[i];
EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
}
/* Checking for a NAN value in EnergyError */
test = (int *)(&EnergyError);
temp = *test;
if (temp == 0x7FC00000)
{
return(0);
}
SNR = 10 * log10 (EnergySignal / EnergyError);
return (SNR);
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q15 (q15_t * input_buf, uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Converts float to fixed in q12.20 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to outputbuffer
* @param[in] numSamples number of samples in the input buffer
* @return none
* The function converts floating point values to fixed point(q12.20) values
*/
void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1048576.0f corresponds to pow(2, 20) */
pOut[i] = (q31_t) (pIn[i] * 1048576.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 1.0)
{
pOut[i] = 0x000FFFFF;
}
}
}
/**
* @brief Compare MATLAB Reference Output and ARM Test output
* @param[in] pIn Pointer to Ref buffer
* @param[in] pOut Pointer to Test buffer
* @param[in] numSamples number of samples in the buffer
* @return maximum difference
*/
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{
uint32_t i;
int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
if (diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
}
/**
* @brief Compare MATLAB Reference Output and ARM Test output
* @param[in] pIn Pointer to Ref buffer
* @param[in] pOut Pointer to Test buffer
* @param[in] numSamples number of samples in the buffer
* @return maximum difference
*/
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
if (diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q31 (q31_t * input_buf,
uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Provide guard bits for Input buffer
* @param[in,out] input_buf Pointer to input buffer
* @param[in] blockSize block Size
* @param[in] guard_bits guard bits
* @return none
* The function Provides the guard bits for the buffer
* to avoid overflow
*/
void arm_provide_guard_bits_q7 (q7_t * input_buf,
uint32_t blockSize,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < blockSize; i++)
{
input_buf[i] = input_buf[i] >> guard_bits;
}
}
/**
* @brief Caluclates number of guard bits
* @param[in] num_adds number of additions
* @return guard bits
* The function Caluclates the number of guard bits
* depending on the numtaps
*/
uint32_t arm_calc_guard_bits (uint32_t num_adds)
{
uint32_t i = 1, j = 0;
if (num_adds == 1)
{
return (0);
}
while (i < num_adds)
{
i = i * 2;
j++;
}
return (j);
}
/**
* @brief Apply guard bits to buffer
* @param[in,out] pIn pointer to input buffer
* @param[in] numSamples number of samples in the input buffer
* @param[in] guard_bits guard bits
* @return none
*/
void arm_apply_guard_bits (float32_t *pIn,
uint32_t numSamples,
uint32_t guard_bits)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
pIn[i] = pIn[i] * arm_calc_2pow(guard_bits);
}
}
/**
* @brief Calculates pow(2, numShifts)
* @param[in] numShifts number of shifts
* @return pow(2, numShifts)
*/
uint32_t arm_calc_2pow(uint32_t numShifts)
{
uint32_t i, val = 1;
for (i = 0; i < numShifts; i++)
{
val = val * 2;
}
return(val);
}
/**
* @brief Converts float to fixed q14
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 16384.0f corresponds to pow(2, 14) */
pOut[i] = (q15_t) (pIn[i] * 16384.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 2.0)
{
pOut[i] = 0x7FFF;
}
}
}
/**
* @brief Converts float to fixed q30 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q30 (float *pIn, q31_t * pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1073741824.0f corresponds to pow(2, 30) */
pOut[i] = (q31_t) (pIn[i] * 1073741824.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 2.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Converts float to fixed q30 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 1073741824.0f corresponds to pow(2, 30) */
pOut[i] = (q31_t) (pIn[i] * 536870912.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 4.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Converts float to fixed q28 format
* @param[in] pIn pointer to input buffer
* @param[out] pOut pointer to output buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
/* 268435456.0f corresponds to pow(2, 28) */
pOut[i] = (q31_t) (pIn[i] * 268435456.0f);
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
if (pIn[i] == (float) 8.0)
{
pOut[i] = 0x7FFFFFFF;
}
}
}
/**
* @brief Clip the float values to +/- 1
* @param[in,out] pIn input buffer
* @param[in] numSamples number of samples in the buffer
* @return none
* The function converts floating point values to fixed point values
*/
void arm_clip_f32 (float *pIn, uint32_t numSamples)
{
uint32_t i;
for (i = 0; i < numSamples; i++)
{
if (pIn[i] > 1.0f)
{
pIn[i] = 1.0;
}
else if ( pIn[i] < -1.0f)
{
pIn[i] = -1.0;
}
}
}
| 11,228 | C | 23.044968 | 77 | 0.583363 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/math_helper.h | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
*
* Title: math_helper.h
*
* Description: Prototypes of all helper functions required.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
#include "arm_math.h"
#ifndef MATH_HELPER_H
#define MATH_HELPER_H
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize);
void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples);
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples);
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples);
void arm_clip_f32(float *pIn, uint32_t numSamples);
uint32_t arm_calc_guard_bits(uint32_t num_adds);
void arm_apply_guard_bits (float32_t * pIn, uint32_t numSamples, uint32_t guard_bits);
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples);
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples);
uint32_t arm_calc_2pow(uint32_t guard_bits);
#endif
| 3,022 | C | 46.234374 | 91 | 0.705824 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_class_marks_example/arm_class_marks_example_f32.c | /* ----------------------------------------------------------------------
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.0
*
* Project: CMSIS DSP Library
* Title: arm_class_marks_example_f32.c
*
* Description: Example code to calculate Minimum, Maximum
* Mean, std and variance of marks obtained in a class
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* - Neither the name of ARM LIMITED nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* -------------------------------------------------------------------- */
/**
* @ingroup groupExamples
*/
/**
* @defgroup ClassMarks Class Marks Example
*
* \par Description:
* \par
* Demonstrates the use the Maximum, Minimum, Mean, Standard Deviation, Variance
* and Matrix functions to calculate statistical values of marks obtained in a class.
*
* \note This example also demonstrates the usage of static initialization.
*
* \par Variables Description:
* \par
* \li \c testMarks_f32 points to the marks scored by 20 students in 4 subjects
* \li \c max_marks Maximum of all marks
* \li \c min_marks Minimum of all marks
* \li \c mean Mean of all marks
* \li \c var Variance of the marks
* \li \c std Standard deviation of the marks
* \li \c numStudents Total number of students in the class
*
* \par CMSIS DSP Software Library Functions Used:
* \par
* - arm_mat_init_f32()
* - arm_mat_mult_f32()
* - arm_max_f32()
* - arm_min_f32()
* - arm_mean_f32()
* - arm_std_f32()
* - arm_var_f32()
*
* <b> Refer </b>
* \link arm_class_marks_example_f32.c \endlink
*
*/
/** \example arm_class_marks_example_f32.c
*/
#include "arm_math.h"
#define USE_STATIC_INIT
/* ----------------------------------------------------------------------
** Global defines
** ------------------------------------------------------------------- */
#define TEST_LENGTH_SAMPLES (20*4)
/* ----------------------------------------------------------------------
** List of Marks scored by 20 students for 4 subjects
** ------------------------------------------------------------------- */
const float32_t testMarks_f32[TEST_LENGTH_SAMPLES] =
{
42.000000, 37.000000, 81.000000, 28.000000,
83.000000, 72.000000, 36.000000, 38.000000,
32.000000, 51.000000, 63.000000, 64.000000,
97.000000, 82.000000, 95.000000, 90.000000,
66.000000, 51.000000, 54.000000, 42.000000,
67.000000, 56.000000, 45.000000, 57.000000,
67.000000, 69.000000, 35.000000, 52.000000,
29.000000, 81.000000, 58.000000, 47.000000,
38.000000, 76.000000, 100.000000, 29.000000,
33.000000, 47.000000, 29.000000, 50.000000,
34.000000, 41.000000, 61.000000, 46.000000,
52.000000, 50.000000, 48.000000, 36.000000,
47.000000, 55.000000, 44.000000, 40.000000,
100.000000, 94.000000, 84.000000, 37.000000,
32.000000, 71.000000, 47.000000, 77.000000,
31.000000, 50.000000, 49.000000, 35.000000,
63.000000, 67.000000, 40.000000, 31.000000,
29.000000, 68.000000, 61.000000, 38.000000,
31.000000, 28.000000, 28.000000, 76.000000,
55.000000, 33.000000, 29.000000, 39.000000
};
/* ----------------------------------------------------------------------
* Number of subjects X 1
* ------------------------------------------------------------------- */
const float32_t testUnity_f32[4] =
{
1.000, 1.000, 1.000, 1.000
};
/* ----------------------------------------------------------------------
** f32 Output buffer
** ------------------------------------------------------------------- */
static float32_t testOutput[TEST_LENGTH_SAMPLES];
/* ------------------------------------------------------------------
* Global defines
*------------------------------------------------------------------- */
#define NUMSTUDENTS 20
#define NUMSUBJECTS 4
/* ------------------------------------------------------------------
* Global variables
*------------------------------------------------------------------- */
uint32_t numStudents = 20;
uint32_t numSubjects = 4;
float32_t max_marks, min_marks, mean, std, var;
uint32_t student_num;
/* ----------------------------------------------------------------------------------
* Main f32 test function. It returns maximum marks secured and student number
* ------------------------------------------------------------------------------- */
int32_t main()
{
#ifndef USE_STATIC_INIT
arm_matrix_instance_f32 srcA;
arm_matrix_instance_f32 srcB;
arm_matrix_instance_f32 dstC;
/* Input and output matrices initializations */
arm_mat_init_f32(&srcA, numStudents, numSubjects, (float32_t *)testMarks_f32);
arm_mat_init_f32(&srcB, numSubjects, 1, (float32_t *)testUnity_f32);
arm_mat_init_f32(&dstC, numStudents, 1, testOutput);
#else
/* Static Initializations of Input and output matrix sizes and array */
arm_matrix_instance_f32 srcA = {NUMSTUDENTS, NUMSUBJECTS, (float32_t *)testMarks_f32};
arm_matrix_instance_f32 srcB = {NUMSUBJECTS, 1, (float32_t *)testUnity_f32};
arm_matrix_instance_f32 dstC = {NUMSTUDENTS, 1, testOutput};
#endif
/* ----------------------------------------------------------------------
*Call the Matrix multiplication process function
* ------------------------------------------------------------------- */
arm_mat_mult_f32(&srcA, &srcB, &dstC);
/* ----------------------------------------------------------------------
** Call the Max function to calculate max marks among numStudents
** ------------------------------------------------------------------- */
arm_max_f32(testOutput, numStudents, &max_marks, &student_num);
/* ----------------------------------------------------------------------
** Call the Min function to calculate min marks among numStudents
** ------------------------------------------------------------------- */
arm_min_f32(testOutput, numStudents, &min_marks, &student_num);
/* ----------------------------------------------------------------------
** Call the Mean function to calculate mean
** ------------------------------------------------------------------- */
arm_mean_f32(testOutput, numStudents, &mean);
/* ----------------------------------------------------------------------
** Call the std function to calculate standard deviation
** ------------------------------------------------------------------- */
arm_std_f32(testOutput, numStudents, &std);
/* ----------------------------------------------------------------------
** Call the var function to calculate variance
** ------------------------------------------------------------------- */
arm_var_f32(testOutput, numStudents, &var);
while (1); /* main function does not return */
}
| 8,230 | C | 37.825472 | 88 | 0.521021 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_class_marks_example/RTE/Device/ARMCM3/system_ARMCM3.c | /**************************************************************************//**
* @file system_ARMCM3.c
* @brief CMSIS Device System Source File for
* ARMCM3 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM3.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,428 | C | 34.202898 | 80 | 0.422158 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_class_marks_example/RTE/Device/ARMCM0/system_ARMCM0.c | /**************************************************************************//**
* @file system_ARMCM0.c
* @brief CMSIS Device System Source File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ARMCM0.h"
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,063 | C | 35.210526 | 80 | 0.435773 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_class_marks_example/RTE/Device/ARMCM4_FP/system_ARMCM4.c | /**************************************************************************//**
* @file system_ARMCM4.c
* @brief CMSIS Device System Source File for
* ARMCM4 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM4)
#include "ARMCM4.h"
#elif defined (ARMCM4_FP)
#include "ARMCM4_FP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,829 | C | 32.690476 | 80 | 0.444327 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Examples/ARM/arm_class_marks_example/RTE/Device/ARMCM7_SP/system_ARMCM7.c | /**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (50000000UL) /* Oscillator frequency */
#define SYSTEM_CLOCK (XTAL / 2U)
/*----------------------------------------------------------------------------
Externals
*----------------------------------------------------------------------------*/
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
extern uint32_t __Vectors;
#endif
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
/*----------------------------------------------------------------------------
System Core Clock update function
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = SYSTEM_CLOCK;
}
/*----------------------------------------------------------------------------
System initialization function
*----------------------------------------------------------------------------*/
void SystemInit (void)
{
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
SCB->VTOR = (uint32_t) &__Vectors;
#endif
#if defined (__FPU_USED) && (__FPU_USED == 1U)
SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
(3U << 11U*2U) ); /* enable CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = SYSTEM_CLOCK;
}
| 2,880 | C | 32.5 | 80 | 0.448611 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/PythonWrapper/cmsisdsp_pkg/src/cmsismodule.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Python Wrapper
* Title: cmsismodule.c
* Description: C code for the CMSIS-DSP Python wrapper
*
* $Date: 25. March 2019
* $Revision: V0.0.1
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define NPY_NO_DEPRECATED_API NPY_1_15_API_VERSION
#ifdef WIN
#pragma warning( disable : 4013 )
#pragma warning( disable : 4244 )
#endif
#include <Python.h>
#define MAX(A,B) (A) < (B) ? (B) : (A)
#define CAT1(A,B) A##B
#define CAT(A,B) CAT1(A,B)
#ifdef CMSISDSP
#include "arm_math.h"
#define MODNAME "cmsisdsp"
#define MODINITNAME cmsisdsp
#endif
#include <numpy/arrayobject.h>
#include <numpy/ndarraytypes.h>
#if PY_MAJOR_VERSION >= 3
#define IS_PY3K
#endif
struct module_state {
PyObject *error;
};
#if PY_MAJOR_VERSION >= 3
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
#else
#define GETSTATE(m) (&_state)
static struct module_state _state;
#endif
static PyObject *
error_out(PyObject *m) {
struct module_state *st = GETSTATE(m);
PyErr_SetString(st->error, "something bad happened");
return NULL;
}
#define MLTYPE(name,thenewfunc,deallocfunc,initfunc,methods)\
static PyTypeObject ml_##name##Type = { \
PyVarObject_HEAD_INIT(NULL, 0) \
.tp_name=MODNAME".##name", \
.tp_basicsize = sizeof(ml_##name##Object), \
.tp_itemsize = 0, \
.tp_dealloc = (destructor)deallocfunc, \
.tp_flags = Py_TPFLAGS_DEFAULT, \
.tp_doc = #name, \
.tp_init = (initproc)initfunc, \
.tp_new = (newfunc)thenewfunc, \
.tp_methods = methods \
};
#define MEMCPY(DST,SRC,NB,FORMAT) \
for(memCpyIndex = 0; memCpyIndex < (NB) ; memCpyIndex++)\
{ \
(DST)[memCpyIndex] = (FORMAT)(SRC)[memCpyIndex]; \
}
#define GETFIELD(NAME,FIELD,FORMAT) \
static PyObject * \
Method_##NAME##_##FIELD(ml_##NAME##Object *self, PyObject *ignored)\
{ \
return(Py_BuildValue(FORMAT,self->instance->FIELD)); \
}
#define GETFIELDARRAY(NAME,FIELD,FORMAT) \
static PyObject * \
Method_##NAME##_##FIELD(ml_##NAME##Object *self, PyObject *ignored)\
{ \
return(specific_##NAME##_##FIELD(self->instance)); \
}
#define INITARRAYFIELD(FIELD,FORMAT,SRCFORMAT,DSTFORMAT) \
if (FIELD) \
{ \
PyArray_Descr *desct=PyArray_DescrFromType(FORMAT); \
PyArrayObject *FIELD##c = (PyArrayObject *)PyArray_FromAny(FIELD,desct,\
1,0,NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_FORCECAST, \
NULL); \
if (FIELD##c) \
{ \
uint32_t memCpyIndex; \
SRCFORMAT *f=(SRCFORMAT*)PyArray_DATA(FIELD##c); \
uint32_t n = PyArray_SIZE(FIELD##c); \
self->instance->FIELD =PyMem_Malloc(sizeof(DSTFORMAT)*n); \
MEMCPY(self->instance->FIELD ,f,n,DSTFORMAT); \
Py_DECREF(FIELD##c); \
} \
}
#define GETCARRAY(PYVAR,CVAR,FORMAT,SRCFORMAT,DSTFORMAT) \
if (PYVAR) \
{ \
PyArray_Descr *desct=PyArray_DescrFromType(FORMAT); \
PyArrayObject *PYVAR##c = (PyArrayObject *)PyArray_FromAny(PYVAR,desct,\
1,0,NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_FORCECAST, \
NULL); \
if (PYVAR##c) \
{ \
uint32_t memCpyIndex; \
SRCFORMAT *f=(SRCFORMAT*)PyArray_DATA(PYVAR##c); \
uint32_t n = PyArray_SIZE(PYVAR##c); \
CVAR =PyMem_Malloc(sizeof(DSTFORMAT)*n); \
MEMCPY(CVAR ,f,n,DSTFORMAT); \
Py_DECREF(PYVAR##c); \
} \
}
#define GETARGUMENT(FIELD,FORMAT,SRCFORMAT,DSTFORMAT) \
uint32_t arraySize##FIELD=0; \
if (FIELD) \
{ \
PyArray_Descr *desct=PyArray_DescrFromType(FORMAT); \
PyArrayObject *FIELD##c = (PyArrayObject *)PyArray_FromAny(FIELD,desct, \
1,0,NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_FORCECAST, \
NULL); \
if (FIELD##c) \
{ \
uint32_t memCpyIndex; \
SRCFORMAT *f=(SRCFORMAT*)PyArray_DATA(FIELD##c); \
arraySize##FIELD = PyArray_SIZE(FIELD##c); \
FIELD##_converted =PyMem_Malloc(sizeof(DSTFORMAT)*arraySize##FIELD);\
MEMCPY(FIELD##_converted ,f,arraySize##FIELD,DSTFORMAT); \
Py_DECREF(FIELD##c); \
} \
}
#define FREEARGUMENT(FIELD) \
PyMem_Free(FIELD)
#ifdef IS_PY3K
#define ADDTYPE(name) \
if (PyType_Ready(&ml_##name##Type) < 0) \
return; \
\
Py_INCREF(&ml_##name##Type); \
PyModule_AddObject(module, #name, (PyObject *)&ml_##name##Type);
#else
#define ADDTYPE(name) \
if (PyType_Ready(&ml_##name##Type) < 0) \
return; \
\
Py_INCREF(&ml_##name##Type); \
PyModule_AddObject(module, #name, (PyObject *)&ml_##name##Type);
#endif
#define FLOATARRAY2(OBJ,NB1,NB2,DATA) \
npy_intp dims[2]; \
dims[0]=NB1; \
dims[1]=NB2; \
const int ND=2; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_FLOAT, DATA);
#define FLOATARRAY1(OBJ,NB1,DATA) \
npy_intp dims[1]; \
dims[0]=NB1; \
const int ND=1; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_FLOAT, DATA);
#define FLOAT64ARRAY1(OBJ,NB1,DATA) \
npy_intp dims[1]; \
dims[0]=NB1; \
const int ND=1; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_DOUBLE, DATA);
#define UINT32ARRAY1(OBJ,NB1,DATA) \
npy_intp dims[1]; \
dims[0]=NB1; \
const int ND=1; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_UINT32, DATA);
#define INT32ARRAY1(OBJ,NB1,DATA) \
npy_intp dims[1]; \
dims[0]=NB1; \
const int ND=1; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_INT32, DATA);
#define INT16ARRAY1(OBJ,NB1,DATA) \
npy_intp dims[1]; \
dims[0]=NB1; \
const int ND=1; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_INT16, DATA);
#define INT8ARRAY1(OBJ,NB1,DATA) \
npy_intp dims[1]; \
dims[0]=NB1; \
const int ND=1; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NPY_BYTE, DATA);
#define MATRIXFROMNUMPY(EXT,TYP,SRCTYPE,NUMPYTYPE) \
arm_matrix_instance_##EXT *EXT##MatrixFromNumpy(PyObject *o) \
{ \
arm_matrix_instance_##EXT *s; \
\
s=PyMem_Malloc(sizeof(arm_matrix_instance_##EXT)); \
s->pData=NULL; \
s->numRows=0; \
s->numCols=0; \
\
PyArray_Descr *desct=PyArray_DescrFromType(NUMPYTYPE); \
PyArrayObject *cdata = (PyArrayObject *)PyArray_FromAny(o,desct, \
1,0,NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_FORCECAST, \
NULL); \
if (cdata) \
{ \
uint32_t memCpyIndex; \
SRCTYPE *f=(SRCTYPE*)PyArray_DATA(cdata); \
s->numRows=PyArray_DIM(cdata,0); \
s->numCols=PyArray_DIM(cdata,1); \
uint32_t nb = PyArray_SIZE(cdata); \
s->pData = PyMem_Malloc(sizeof(TYP)*nb); \
MEMCPY(s->pData ,f,nb,TYP); \
Py_DECREF(cdata); \
} \
\
\
return(s); \
\
}
MATRIXFROMNUMPY(f32,float32_t,double,NPY_DOUBLE);
MATRIXFROMNUMPY(f64,float64_t,double,NPY_DOUBLE);
MATRIXFROMNUMPY(q31,q31_t,int32_t,NPY_INT32);
MATRIXFROMNUMPY(q15,q15_t,int16_t,NPY_INT16);
#define CREATEMATRIX(EXT,TYP) \
arm_matrix_instance_##EXT *create##EXT##Matrix(uint32_t r,uint32_t c)\
{ \
arm_matrix_instance_##EXT *s; \
\
s=PyMem_Malloc(sizeof(arm_matrix_instance_##EXT)); \
s->pData=PyMem_Malloc(sizeof(TYP)*r*c); \
s->numRows=r; \
s->numCols=c; \
return(s); \
}
CREATEMATRIX(f32,float32_t);
CREATEMATRIX(f64,float64_t);
CREATEMATRIX(q31,q31_t);
CREATEMATRIX(q15,q15_t);
#define NUMPYARRAYFROMMATRIX(EXT,NUMPYTYPE_FROMC) \
PyObject *NumpyArrayFrom##EXT##Matrix(arm_matrix_instance_##EXT *mat) \
{ \
npy_intp dims[2]; \
dims[0]=mat->numRows; \
dims[1]=mat->numCols; \
const int ND=2; \
PyObject *OBJ=PyArray_SimpleNewFromData(ND, dims, NUMPYTYPE_FROMC, mat->pData);\
return(OBJ); \
}
NUMPYARRAYFROMMATRIX(f32,NPY_FLOAT);
NUMPYARRAYFROMMATRIX(f64,NPY_DOUBLE);
NUMPYARRAYFROMMATRIX(q31,NPY_INT32);
NUMPYARRAYFROMMATRIX(q15,NPY_INT16);
//#include "specific.h"
#include "cmsismodule.h"
#if 0
static PyObject *cmsisml_test(PyObject *obj, PyObject *args)
{
ml_arm_svm_linear_instance_f32Object *self=NULL;
PyObject *svm, *vector=NULL;
if (!PyArg_ParseTuple(args, "OO", &svm,&vector))
return NULL;
self=(ml_arm_svm_linear_instance_f32Object*)svm;
if (self)
{
if (self->instance)
{
int result;
float32_t *input=NULL;
GETCARRAY(vector,input,NPY_DOUBLE,double,float32_t);
arm_svm_linear_predict_f32(self->instance,input,&result);
/*
printf("Dual\n");
for(int i = 0 ; i < self->instance->nbOfSupportVectors ; i++)
{
printf("%f\n",self->instance->dualCoefficients[i]);
}
printf("Vectors\n");
int k=0;
for(int i = 0 ; i < self->instance->nbOfSupportVectors ; i++)
{
printf("Vector %d\n",i);
for(int j = 0 ; j < self->instance->vectorDimension ; j++)
{
printf("%f\n",self->instance->supportVectors[k]);
k++;
}
}
printf("Classes\n");
for(int i = 0 ; i < 2 ; i++)
{
printf("%d\n",self->instance->classes[i]);
}
printf("Intercept %f\n",self->instance->intercept);
*/
PyMem_Free(input);
return(Py_BuildValue("i",result));
}
}
return(Py_BuildValue("i",-1));
}
#endif
#ifdef IS_PY3K
static int cmsisml_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(GETSTATE(m)->error);
return 0;
}
static int cmsisml_clear(PyObject *m) {
Py_CLEAR(GETSTATE(m)->error);
return 0;
}
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
MODNAME,
NULL,
sizeof(struct module_state),
CMSISMLMethods,
NULL,
cmsisml_traverse,
cmsisml_clear,
NULL
};
#define INITERROR return NULL
PyMODINIT_FUNC
CAT(PyInit_,MODINITNAME)(void)
#else
#define INITERROR return
void CAT(init,MODINITNAME)(void)
#endif
{
import_array();
#ifdef IS_PY3K
PyObject *module = PyModule_Create(&moduledef);
#else
PyObject *module = Py_InitModule(MODNAME, CMSISMLMethods);
#endif
if (module == NULL)
INITERROR;
struct module_state *st = GETSTATE(module);
st->error = PyErr_NewException(MODNAME".Error", NULL, NULL);
if (st->error == NULL) {
Py_DECREF(module);
INITERROR;
}
typeRegistration(module);
#ifdef IS_PY3K
return module;
#endif
} | 17,950 | C | 42.997549 | 89 | 0.383231 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/PythonWrapper/cmsisdsp_pkg/src/cmsismodule.h | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Python Wrapper
* Title: cmsismodule.h
* Description: Automatically generated C code for the CMSIS-DSP Python wrapper
*
* $Date: 25. March 2019
* $Revision: V0.0.1
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
typedef struct {
PyObject_HEAD
arm_fir_instance_q7 *instance;
} ml_arm_fir_instance_q7Object;
static void
arm_fir_instance_q7_dealloc(ml_arm_fir_instance_q7Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_instance_q7_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_instance_q7Object *self;
//printf("New called\n");
self = (ml_arm_fir_instance_q7Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_instance_q7));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_instance_q7_init(ml_arm_fir_instance_q7Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_instance_q7,numTaps,"h");
static PyMethodDef arm_fir_instance_q7_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_instance_q7_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_instance_q7,arm_fir_instance_q7_new,arm_fir_instance_q7_dealloc,arm_fir_instance_q7_init,arm_fir_instance_q7_methods);
typedef struct {
PyObject_HEAD
arm_fir_instance_q15 *instance;
} ml_arm_fir_instance_q15Object;
static void
arm_fir_instance_q15_dealloc(ml_arm_fir_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_fir_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_instance_q15));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_instance_q15_init(ml_arm_fir_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_instance_q15,numTaps,"h");
static PyMethodDef arm_fir_instance_q15_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_instance_q15_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_instance_q15,arm_fir_instance_q15_new,arm_fir_instance_q15_dealloc,arm_fir_instance_q15_init,arm_fir_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_instance_q31 *instance;
} ml_arm_fir_instance_q31Object;
static void
arm_fir_instance_q31_dealloc(ml_arm_fir_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_fir_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_instance_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_instance_q31_init(ml_arm_fir_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_instance_q31,numTaps,"h");
static PyMethodDef arm_fir_instance_q31_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_instance_q31_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_instance_q31,arm_fir_instance_q31_new,arm_fir_instance_q31_dealloc,arm_fir_instance_q31_init,arm_fir_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_fir_instance_f32 *instance;
} ml_arm_fir_instance_f32Object;
static void
arm_fir_instance_f32_dealloc(ml_arm_fir_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_fir_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_instance_f32_init(ml_arm_fir_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_instance_f32,numTaps,"h");
static PyMethodDef arm_fir_instance_f32_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_instance_f32_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_instance_f32,arm_fir_instance_f32_new,arm_fir_instance_f32_dealloc,arm_fir_instance_f32_init,arm_fir_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_biquad_casd_df1_inst_q15 *instance;
} ml_arm_biquad_casd_df1_inst_q15Object;
static void
arm_biquad_casd_df1_inst_q15_dealloc(ml_arm_biquad_casd_df1_inst_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_casd_df1_inst_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_casd_df1_inst_q15Object *self;
//printf("New called\n");
self = (ml_arm_biquad_casd_df1_inst_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_casd_df1_inst_q15));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_casd_df1_inst_q15_init(ml_arm_biquad_casd_df1_inst_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages","postShift",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwlist,&self->instance->numStages
,&self->instance->postShift
))
{
}
return 0;
}
GETFIELD(arm_biquad_casd_df1_inst_q15,numStages,"i");
GETFIELD(arm_biquad_casd_df1_inst_q15,postShift,"i");
static PyMethodDef arm_biquad_casd_df1_inst_q15_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_casd_df1_inst_q15_numStages,METH_NOARGS,"numStages"},
{"postShift", (PyCFunction) Method_arm_biquad_casd_df1_inst_q15_postShift,METH_NOARGS,"postShift"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_casd_df1_inst_q15,arm_biquad_casd_df1_inst_q15_new,arm_biquad_casd_df1_inst_q15_dealloc,arm_biquad_casd_df1_inst_q15_init,arm_biquad_casd_df1_inst_q15_methods);
typedef struct {
PyObject_HEAD
arm_biquad_casd_df1_inst_q31 *instance;
} ml_arm_biquad_casd_df1_inst_q31Object;
static void
arm_biquad_casd_df1_inst_q31_dealloc(ml_arm_biquad_casd_df1_inst_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_casd_df1_inst_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_casd_df1_inst_q31Object *self;
//printf("New called\n");
self = (ml_arm_biquad_casd_df1_inst_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_casd_df1_inst_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_casd_df1_inst_q31_init(ml_arm_biquad_casd_df1_inst_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages","postShift",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwlist,&self->instance->numStages
,&self->instance->postShift
))
{
}
return 0;
}
GETFIELD(arm_biquad_casd_df1_inst_q31,numStages,"i");
GETFIELD(arm_biquad_casd_df1_inst_q31,postShift,"i");
static PyMethodDef arm_biquad_casd_df1_inst_q31_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_casd_df1_inst_q31_numStages,METH_NOARGS,"numStages"},
{"postShift", (PyCFunction) Method_arm_biquad_casd_df1_inst_q31_postShift,METH_NOARGS,"postShift"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_casd_df1_inst_q31,arm_biquad_casd_df1_inst_q31_new,arm_biquad_casd_df1_inst_q31_dealloc,arm_biquad_casd_df1_inst_q31_init,arm_biquad_casd_df1_inst_q31_methods);
typedef struct {
PyObject_HEAD
arm_biquad_casd_df1_inst_f32 *instance;
} ml_arm_biquad_casd_df1_inst_f32Object;
static void
arm_biquad_casd_df1_inst_f32_dealloc(ml_arm_biquad_casd_df1_inst_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_casd_df1_inst_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_casd_df1_inst_f32Object *self;
//printf("New called\n");
self = (ml_arm_biquad_casd_df1_inst_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_casd_df1_inst_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_casd_df1_inst_f32_init(ml_arm_biquad_casd_df1_inst_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_biquad_casd_df1_inst_f32,numStages,"i");
static PyMethodDef arm_biquad_casd_df1_inst_f32_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_casd_df1_inst_f32_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_casd_df1_inst_f32,arm_biquad_casd_df1_inst_f32_new,arm_biquad_casd_df1_inst_f32_dealloc,arm_biquad_casd_df1_inst_f32_init,arm_biquad_casd_df1_inst_f32_methods);
typedef struct {
PyObject_HEAD
arm_matrix_instance_f32 *instance;
} ml_arm_matrix_instance_f32Object;
static void
arm_matrix_instance_f32_dealloc(ml_arm_matrix_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_matrix_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_matrix_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_matrix_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_matrix_instance_f32));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_matrix_instance_f32_init(ml_arm_matrix_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_DOUBLE,double,float32_t);
}
return 0;
}
GETFIELD(arm_matrix_instance_f32,numRows,"h");
GETFIELD(arm_matrix_instance_f32,numCols,"h");
static PyMethodDef arm_matrix_instance_f32_methods[] = {
{"numRows", (PyCFunction) Method_arm_matrix_instance_f32_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_matrix_instance_f32_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_matrix_instance_f32,arm_matrix_instance_f32_new,arm_matrix_instance_f32_dealloc,arm_matrix_instance_f32_init,arm_matrix_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_matrix_instance_f64 *instance;
} ml_arm_matrix_instance_f64Object;
static void
arm_matrix_instance_f64_dealloc(ml_arm_matrix_instance_f64Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_matrix_instance_f64_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_matrix_instance_f64Object *self;
//printf("New called\n");
self = (ml_arm_matrix_instance_f64Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_matrix_instance_f64));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_matrix_instance_f64_init(ml_arm_matrix_instance_f64Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_FLOAT64,float64_t,float64_t);
}
return 0;
}
GETFIELD(arm_matrix_instance_f64,numRows,"h");
GETFIELD(arm_matrix_instance_f64,numCols,"h");
static PyMethodDef arm_matrix_instance_f64_methods[] = {
{"numRows", (PyCFunction) Method_arm_matrix_instance_f64_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_matrix_instance_f64_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_matrix_instance_f64,arm_matrix_instance_f64_new,arm_matrix_instance_f64_dealloc,arm_matrix_instance_f64_init,arm_matrix_instance_f64_methods);
typedef struct {
PyObject_HEAD
arm_matrix_instance_q15 *instance;
} ml_arm_matrix_instance_q15Object;
static void
arm_matrix_instance_q15_dealloc(ml_arm_matrix_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_matrix_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_matrix_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_matrix_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_matrix_instance_q15));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_matrix_instance_q15_init(ml_arm_matrix_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_INT16,int16_t,int16_t);
}
return 0;
}
GETFIELD(arm_matrix_instance_q15,numRows,"h");
GETFIELD(arm_matrix_instance_q15,numCols,"h");
static PyMethodDef arm_matrix_instance_q15_methods[] = {
{"numRows", (PyCFunction) Method_arm_matrix_instance_q15_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_matrix_instance_q15_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_matrix_instance_q15,arm_matrix_instance_q15_new,arm_matrix_instance_q15_dealloc,arm_matrix_instance_q15_init,arm_matrix_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_matrix_instance_q31 *instance;
} ml_arm_matrix_instance_q31Object;
static void
arm_matrix_instance_q31_dealloc(ml_arm_matrix_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_matrix_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_matrix_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_matrix_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_matrix_instance_q31));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_matrix_instance_q31_init(ml_arm_matrix_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_matrix_instance_q31,numRows,"h");
GETFIELD(arm_matrix_instance_q31,numCols,"h");
static PyMethodDef arm_matrix_instance_q31_methods[] = {
{"numRows", (PyCFunction) Method_arm_matrix_instance_q31_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_matrix_instance_q31_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_matrix_instance_q31,arm_matrix_instance_q31_new,arm_matrix_instance_q31_dealloc,arm_matrix_instance_q31_init,arm_matrix_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_pid_instance_q15 *instance;
} ml_arm_pid_instance_q15Object;
static void
arm_pid_instance_q15_dealloc(ml_arm_pid_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_pid_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_pid_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_pid_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_pid_instance_q15));
}
return (PyObject *)self;
}
static int
arm_pid_instance_q15_init(ml_arm_pid_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
char *kwlist[] = {
"A0","A1","A2","state","Kp","Ki","Kd",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhhhhhh", kwlist,&self->instance->A0
,&self->instance->A1
,&self->instance->A2
,&self->instance->state
,&self->instance->Kp
,&self->instance->Ki
,&self->instance->Kd
))
{
}
return 0;
}
GETFIELD(arm_pid_instance_q15,A0,"h");
GETFIELD(arm_pid_instance_q15,A1,"h");
GETFIELD(arm_pid_instance_q15,A2,"h");
GETFIELD(arm_pid_instance_q15,state,"h");
GETFIELD(arm_pid_instance_q15,Kp,"h");
GETFIELD(arm_pid_instance_q15,Ki,"h");
GETFIELD(arm_pid_instance_q15,Kd,"h");
static PyMethodDef arm_pid_instance_q15_methods[] = {
{"A0", (PyCFunction) Method_arm_pid_instance_q15_A0,METH_NOARGS,"A0"},
{"A1", (PyCFunction) Method_arm_pid_instance_q15_A1,METH_NOARGS,"A1"},
{"A2", (PyCFunction) Method_arm_pid_instance_q15_A2,METH_NOARGS,"A2"},
{"state", (PyCFunction) Method_arm_pid_instance_q15_state,METH_NOARGS,"state"},
{"Kp", (PyCFunction) Method_arm_pid_instance_q15_Kp,METH_NOARGS,"Kp"},
{"Ki", (PyCFunction) Method_arm_pid_instance_q15_Ki,METH_NOARGS,"Ki"},
{"Kd", (PyCFunction) Method_arm_pid_instance_q15_Kd,METH_NOARGS,"Kd"},
{NULL} /* Sentinel */
};
MLTYPE(arm_pid_instance_q15,arm_pid_instance_q15_new,arm_pid_instance_q15_dealloc,arm_pid_instance_q15_init,arm_pid_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_pid_instance_q31 *instance;
} ml_arm_pid_instance_q31Object;
static void
arm_pid_instance_q31_dealloc(ml_arm_pid_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_pid_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_pid_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_pid_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_pid_instance_q31));
}
return (PyObject *)self;
}
static int
arm_pid_instance_q31_init(ml_arm_pid_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
char *kwlist[] = {
"A0","A1","A2","state","Kp","Ki","Kd",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|iiiiiii", kwlist,&self->instance->A0
,&self->instance->A1
,&self->instance->A2
,&self->instance->state
,&self->instance->Kp
,&self->instance->Ki
,&self->instance->Kd
))
{
}
return 0;
}
GETFIELD(arm_pid_instance_q31,A0,"i");
GETFIELD(arm_pid_instance_q31,A1,"i");
GETFIELD(arm_pid_instance_q31,A2,"i");
GETFIELD(arm_pid_instance_q31,state,"i");
GETFIELD(arm_pid_instance_q31,Kp,"i");
GETFIELD(arm_pid_instance_q31,Ki,"i");
GETFIELD(arm_pid_instance_q31,Kd,"i");
static PyMethodDef arm_pid_instance_q31_methods[] = {
{"A0", (PyCFunction) Method_arm_pid_instance_q31_A0,METH_NOARGS,"A0"},
{"A1", (PyCFunction) Method_arm_pid_instance_q31_A1,METH_NOARGS,"A1"},
{"A2", (PyCFunction) Method_arm_pid_instance_q31_A2,METH_NOARGS,"A2"},
{"state", (PyCFunction) Method_arm_pid_instance_q31_state,METH_NOARGS,"state"},
{"Kp", (PyCFunction) Method_arm_pid_instance_q31_Kp,METH_NOARGS,"Kp"},
{"Ki", (PyCFunction) Method_arm_pid_instance_q31_Ki,METH_NOARGS,"Ki"},
{"Kd", (PyCFunction) Method_arm_pid_instance_q31_Kd,METH_NOARGS,"Kd"},
{NULL} /* Sentinel */
};
MLTYPE(arm_pid_instance_q31,arm_pid_instance_q31_new,arm_pid_instance_q31_dealloc,arm_pid_instance_q31_init,arm_pid_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_pid_instance_f32 *instance;
} ml_arm_pid_instance_f32Object;
static void
arm_pid_instance_f32_dealloc(ml_arm_pid_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_pid_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_pid_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_pid_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_pid_instance_f32));
}
return (PyObject *)self;
}
static int
arm_pid_instance_f32_init(ml_arm_pid_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
char *kwlist[] = {
"A0","A1","A2","state","Kp","Ki","Kd",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|fffffff", kwlist,&self->instance->A0
,&self->instance->A1
,&self->instance->A2
,&self->instance->state
,&self->instance->Kp
,&self->instance->Ki
,&self->instance->Kd
))
{
}
return 0;
}
GETFIELD(arm_pid_instance_f32,A0,"f");
GETFIELD(arm_pid_instance_f32,A1,"f");
GETFIELD(arm_pid_instance_f32,A2,"f");
GETFIELD(arm_pid_instance_f32,state,"f");
GETFIELD(arm_pid_instance_f32,Kp,"f");
GETFIELD(arm_pid_instance_f32,Ki,"f");
GETFIELD(arm_pid_instance_f32,Kd,"f");
static PyMethodDef arm_pid_instance_f32_methods[] = {
{"A0", (PyCFunction) Method_arm_pid_instance_f32_A0,METH_NOARGS,"A0"},
{"A1", (PyCFunction) Method_arm_pid_instance_f32_A1,METH_NOARGS,"A1"},
{"A2", (PyCFunction) Method_arm_pid_instance_f32_A2,METH_NOARGS,"A2"},
{"state", (PyCFunction) Method_arm_pid_instance_f32_state,METH_NOARGS,"state"},
{"Kp", (PyCFunction) Method_arm_pid_instance_f32_Kp,METH_NOARGS,"Kp"},
{"Ki", (PyCFunction) Method_arm_pid_instance_f32_Ki,METH_NOARGS,"Ki"},
{"Kd", (PyCFunction) Method_arm_pid_instance_f32_Kd,METH_NOARGS,"Kd"},
{NULL} /* Sentinel */
};
MLTYPE(arm_pid_instance_f32,arm_pid_instance_f32_new,arm_pid_instance_f32_dealloc,arm_pid_instance_f32_init,arm_pid_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_linear_interp_instance_f32 *instance;
} ml_arm_linear_interp_instance_f32Object;
static void
arm_linear_interp_instance_f32_dealloc(ml_arm_linear_interp_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pYData)
{
PyMem_Free(self->instance->pYData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_linear_interp_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_linear_interp_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_linear_interp_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_linear_interp_instance_f32));
self->instance->pYData = NULL;
}
return (PyObject *)self;
}
static int
arm_linear_interp_instance_f32_init(ml_arm_linear_interp_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pYData=NULL;
char *kwlist[] = {
"nValues","x1","xSpacing","pYData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|iffO", kwlist,&self->instance->nValues
,&self->instance->x1
,&self->instance->xSpacing
,&pYData
))
{
INITARRAYFIELD(pYData,NPY_DOUBLE,double,float32_t);
}
return 0;
}
GETFIELD(arm_linear_interp_instance_f32,nValues,"i");
GETFIELD(arm_linear_interp_instance_f32,x1,"f");
GETFIELD(arm_linear_interp_instance_f32,xSpacing,"f");
static PyMethodDef arm_linear_interp_instance_f32_methods[] = {
{"nValues", (PyCFunction) Method_arm_linear_interp_instance_f32_nValues,METH_NOARGS,"nValues"},
{"x1", (PyCFunction) Method_arm_linear_interp_instance_f32_x1,METH_NOARGS,"x1"},
{"xSpacing", (PyCFunction) Method_arm_linear_interp_instance_f32_xSpacing,METH_NOARGS,"xSpacing"},
{NULL} /* Sentinel */
};
MLTYPE(arm_linear_interp_instance_f32,arm_linear_interp_instance_f32_new,arm_linear_interp_instance_f32_dealloc,arm_linear_interp_instance_f32_init,arm_linear_interp_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_bilinear_interp_instance_f32 *instance;
} ml_arm_bilinear_interp_instance_f32Object;
static void
arm_bilinear_interp_instance_f32_dealloc(ml_arm_bilinear_interp_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_bilinear_interp_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_bilinear_interp_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_bilinear_interp_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_bilinear_interp_instance_f32));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_bilinear_interp_instance_f32_init(ml_arm_bilinear_interp_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_DOUBLE,double,float32_t);
}
return 0;
}
GETFIELD(arm_bilinear_interp_instance_f32,numRows,"h");
GETFIELD(arm_bilinear_interp_instance_f32,numCols,"h");
static PyMethodDef arm_bilinear_interp_instance_f32_methods[] = {
{"numRows", (PyCFunction) Method_arm_bilinear_interp_instance_f32_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_bilinear_interp_instance_f32_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_bilinear_interp_instance_f32,arm_bilinear_interp_instance_f32_new,arm_bilinear_interp_instance_f32_dealloc,arm_bilinear_interp_instance_f32_init,arm_bilinear_interp_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_bilinear_interp_instance_q31 *instance;
} ml_arm_bilinear_interp_instance_q31Object;
static void
arm_bilinear_interp_instance_q31_dealloc(ml_arm_bilinear_interp_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_bilinear_interp_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_bilinear_interp_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_bilinear_interp_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_bilinear_interp_instance_q31));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_bilinear_interp_instance_q31_init(ml_arm_bilinear_interp_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_bilinear_interp_instance_q31,numRows,"h");
GETFIELD(arm_bilinear_interp_instance_q31,numCols,"h");
static PyMethodDef arm_bilinear_interp_instance_q31_methods[] = {
{"numRows", (PyCFunction) Method_arm_bilinear_interp_instance_q31_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_bilinear_interp_instance_q31_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_bilinear_interp_instance_q31,arm_bilinear_interp_instance_q31_new,arm_bilinear_interp_instance_q31_dealloc,arm_bilinear_interp_instance_q31_init,arm_bilinear_interp_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_bilinear_interp_instance_q15 *instance;
} ml_arm_bilinear_interp_instance_q15Object;
static void
arm_bilinear_interp_instance_q15_dealloc(ml_arm_bilinear_interp_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_bilinear_interp_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_bilinear_interp_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_bilinear_interp_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_bilinear_interp_instance_q15));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_bilinear_interp_instance_q15_init(ml_arm_bilinear_interp_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_INT16,int16_t,int16_t);
}
return 0;
}
GETFIELD(arm_bilinear_interp_instance_q15,numRows,"h");
GETFIELD(arm_bilinear_interp_instance_q15,numCols,"h");
static PyMethodDef arm_bilinear_interp_instance_q15_methods[] = {
{"numRows", (PyCFunction) Method_arm_bilinear_interp_instance_q15_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_bilinear_interp_instance_q15_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_bilinear_interp_instance_q15,arm_bilinear_interp_instance_q15_new,arm_bilinear_interp_instance_q15_dealloc,arm_bilinear_interp_instance_q15_init,arm_bilinear_interp_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_bilinear_interp_instance_q7 *instance;
} ml_arm_bilinear_interp_instance_q7Object;
static void
arm_bilinear_interp_instance_q7_dealloc(ml_arm_bilinear_interp_instance_q7Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pData)
{
PyMem_Free(self->instance->pData);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_bilinear_interp_instance_q7_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_bilinear_interp_instance_q7Object *self;
//printf("New called\n");
self = (ml_arm_bilinear_interp_instance_q7Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_bilinear_interp_instance_q7));
self->instance->pData = NULL;
}
return (PyObject *)self;
}
static int
arm_bilinear_interp_instance_q7_init(ml_arm_bilinear_interp_instance_q7Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pData=NULL;
char *kwlist[] = {
"numRows","numCols","pData",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhO", kwlist,&self->instance->numRows
,&self->instance->numCols
,&pData
))
{
INITARRAYFIELD(pData,NPY_BYTE,int8_t,q7_t);
}
return 0;
}
GETFIELD(arm_bilinear_interp_instance_q7,numRows,"h");
GETFIELD(arm_bilinear_interp_instance_q7,numCols,"h");
static PyMethodDef arm_bilinear_interp_instance_q7_methods[] = {
{"numRows", (PyCFunction) Method_arm_bilinear_interp_instance_q7_numRows,METH_NOARGS,"numRows"},
{"numCols", (PyCFunction) Method_arm_bilinear_interp_instance_q7_numCols,METH_NOARGS,"numCols"},
{NULL} /* Sentinel */
};
MLTYPE(arm_bilinear_interp_instance_q7,arm_bilinear_interp_instance_q7_new,arm_bilinear_interp_instance_q7_dealloc,arm_bilinear_interp_instance_q7_init,arm_bilinear_interp_instance_q7_methods);
typedef struct {
PyObject_HEAD
arm_cfft_radix2_instance_q15 *instance;
} ml_arm_cfft_radix2_instance_q15Object;
static void
arm_cfft_radix2_instance_q15_dealloc(ml_arm_cfft_radix2_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_radix2_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_radix2_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_cfft_radix2_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_radix2_instance_q15));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_radix2_instance_q15_init(ml_arm_cfft_radix2_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","ifftFlag","bitReverseFlag","twidCoefModifier","bitRevFactor",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiihh", kwlist,&self->instance->fftLen
,&self->instance->ifftFlag
,&self->instance->bitReverseFlag
,&self->instance->twidCoefModifier
,&self->instance->bitRevFactor
))
{
}
return 0;
}
GETFIELD(arm_cfft_radix2_instance_q15,fftLen,"h");
GETFIELD(arm_cfft_radix2_instance_q15,ifftFlag,"i");
GETFIELD(arm_cfft_radix2_instance_q15,bitReverseFlag,"i");
GETFIELD(arm_cfft_radix2_instance_q15,twidCoefModifier,"h");
GETFIELD(arm_cfft_radix2_instance_q15,bitRevFactor,"h");
static PyMethodDef arm_cfft_radix2_instance_q15_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_radix2_instance_q15_fftLen,METH_NOARGS,"fftLen"},
{"ifftFlag", (PyCFunction) Method_arm_cfft_radix2_instance_q15_ifftFlag,METH_NOARGS,"ifftFlag"},
{"bitReverseFlag", (PyCFunction) Method_arm_cfft_radix2_instance_q15_bitReverseFlag,METH_NOARGS,"bitReverseFlag"},
{"twidCoefModifier", (PyCFunction) Method_arm_cfft_radix2_instance_q15_twidCoefModifier,METH_NOARGS,"twidCoefModifier"},
{"bitRevFactor", (PyCFunction) Method_arm_cfft_radix2_instance_q15_bitRevFactor,METH_NOARGS,"bitRevFactor"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_radix2_instance_q15,arm_cfft_radix2_instance_q15_new,arm_cfft_radix2_instance_q15_dealloc,arm_cfft_radix2_instance_q15_init,arm_cfft_radix2_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_cfft_radix4_instance_q15 *instance;
} ml_arm_cfft_radix4_instance_q15Object;
static void
arm_cfft_radix4_instance_q15_dealloc(ml_arm_cfft_radix4_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_radix4_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_radix4_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_cfft_radix4_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_radix4_instance_q15));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_radix4_instance_q15_init(ml_arm_cfft_radix4_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","ifftFlag","bitReverseFlag","twidCoefModifier","bitRevFactor",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiihh", kwlist,&self->instance->fftLen
,&self->instance->ifftFlag
,&self->instance->bitReverseFlag
,&self->instance->twidCoefModifier
,&self->instance->bitRevFactor
))
{
}
return 0;
}
GETFIELD(arm_cfft_radix4_instance_q15,fftLen,"h");
GETFIELD(arm_cfft_radix4_instance_q15,ifftFlag,"i");
GETFIELD(arm_cfft_radix4_instance_q15,bitReverseFlag,"i");
GETFIELD(arm_cfft_radix4_instance_q15,twidCoefModifier,"h");
GETFIELD(arm_cfft_radix4_instance_q15,bitRevFactor,"h");
static PyMethodDef arm_cfft_radix4_instance_q15_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_radix4_instance_q15_fftLen,METH_NOARGS,"fftLen"},
{"ifftFlag", (PyCFunction) Method_arm_cfft_radix4_instance_q15_ifftFlag,METH_NOARGS,"ifftFlag"},
{"bitReverseFlag", (PyCFunction) Method_arm_cfft_radix4_instance_q15_bitReverseFlag,METH_NOARGS,"bitReverseFlag"},
{"twidCoefModifier", (PyCFunction) Method_arm_cfft_radix4_instance_q15_twidCoefModifier,METH_NOARGS,"twidCoefModifier"},
{"bitRevFactor", (PyCFunction) Method_arm_cfft_radix4_instance_q15_bitRevFactor,METH_NOARGS,"bitRevFactor"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_radix4_instance_q15,arm_cfft_radix4_instance_q15_new,arm_cfft_radix4_instance_q15_dealloc,arm_cfft_radix4_instance_q15_init,arm_cfft_radix4_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_cfft_radix2_instance_q31 *instance;
} ml_arm_cfft_radix2_instance_q31Object;
static void
arm_cfft_radix2_instance_q31_dealloc(ml_arm_cfft_radix2_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_radix2_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_radix2_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_cfft_radix2_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_radix2_instance_q31));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_radix2_instance_q31_init(ml_arm_cfft_radix2_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","ifftFlag","bitReverseFlag","twidCoefModifier","bitRevFactor",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiihh", kwlist,&self->instance->fftLen
,&self->instance->ifftFlag
,&self->instance->bitReverseFlag
,&self->instance->twidCoefModifier
,&self->instance->bitRevFactor
))
{
}
return 0;
}
GETFIELD(arm_cfft_radix2_instance_q31,fftLen,"h");
GETFIELD(arm_cfft_radix2_instance_q31,ifftFlag,"i");
GETFIELD(arm_cfft_radix2_instance_q31,bitReverseFlag,"i");
GETFIELD(arm_cfft_radix2_instance_q31,twidCoefModifier,"h");
GETFIELD(arm_cfft_radix2_instance_q31,bitRevFactor,"h");
static PyMethodDef arm_cfft_radix2_instance_q31_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_radix2_instance_q31_fftLen,METH_NOARGS,"fftLen"},
{"ifftFlag", (PyCFunction) Method_arm_cfft_radix2_instance_q31_ifftFlag,METH_NOARGS,"ifftFlag"},
{"bitReverseFlag", (PyCFunction) Method_arm_cfft_radix2_instance_q31_bitReverseFlag,METH_NOARGS,"bitReverseFlag"},
{"twidCoefModifier", (PyCFunction) Method_arm_cfft_radix2_instance_q31_twidCoefModifier,METH_NOARGS,"twidCoefModifier"},
{"bitRevFactor", (PyCFunction) Method_arm_cfft_radix2_instance_q31_bitRevFactor,METH_NOARGS,"bitRevFactor"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_radix2_instance_q31,arm_cfft_radix2_instance_q31_new,arm_cfft_radix2_instance_q31_dealloc,arm_cfft_radix2_instance_q31_init,arm_cfft_radix2_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_cfft_radix4_instance_q31 *instance;
} ml_arm_cfft_radix4_instance_q31Object;
static void
arm_cfft_radix4_instance_q31_dealloc(ml_arm_cfft_radix4_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_radix4_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_radix4_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_cfft_radix4_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_radix4_instance_q31));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_radix4_instance_q31_init(ml_arm_cfft_radix4_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","ifftFlag","bitReverseFlag","twidCoefModifier","bitRevFactor",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiihh", kwlist,&self->instance->fftLen
,&self->instance->ifftFlag
,&self->instance->bitReverseFlag
,&self->instance->twidCoefModifier
,&self->instance->bitRevFactor
))
{
}
return 0;
}
GETFIELD(arm_cfft_radix4_instance_q31,fftLen,"h");
GETFIELD(arm_cfft_radix4_instance_q31,ifftFlag,"i");
GETFIELD(arm_cfft_radix4_instance_q31,bitReverseFlag,"i");
GETFIELD(arm_cfft_radix4_instance_q31,twidCoefModifier,"h");
GETFIELD(arm_cfft_radix4_instance_q31,bitRevFactor,"h");
static PyMethodDef arm_cfft_radix4_instance_q31_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_radix4_instance_q31_fftLen,METH_NOARGS,"fftLen"},
{"ifftFlag", (PyCFunction) Method_arm_cfft_radix4_instance_q31_ifftFlag,METH_NOARGS,"ifftFlag"},
{"bitReverseFlag", (PyCFunction) Method_arm_cfft_radix4_instance_q31_bitReverseFlag,METH_NOARGS,"bitReverseFlag"},
{"twidCoefModifier", (PyCFunction) Method_arm_cfft_radix4_instance_q31_twidCoefModifier,METH_NOARGS,"twidCoefModifier"},
{"bitRevFactor", (PyCFunction) Method_arm_cfft_radix4_instance_q31_bitRevFactor,METH_NOARGS,"bitRevFactor"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_radix4_instance_q31,arm_cfft_radix4_instance_q31_new,arm_cfft_radix4_instance_q31_dealloc,arm_cfft_radix4_instance_q31_init,arm_cfft_radix4_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_cfft_radix2_instance_f32 *instance;
} ml_arm_cfft_radix2_instance_f32Object;
static void
arm_cfft_radix2_instance_f32_dealloc(ml_arm_cfft_radix2_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_radix2_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_radix2_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_cfft_radix2_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_radix2_instance_f32));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_radix2_instance_f32_init(ml_arm_cfft_radix2_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","ifftFlag","bitReverseFlag","twidCoefModifier","bitRevFactor","onebyfftLen",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiihhf", kwlist,&self->instance->fftLen
,&self->instance->ifftFlag
,&self->instance->bitReverseFlag
,&self->instance->twidCoefModifier
,&self->instance->bitRevFactor
,&self->instance->onebyfftLen
))
{
}
return 0;
}
GETFIELD(arm_cfft_radix2_instance_f32,fftLen,"h");
GETFIELD(arm_cfft_radix2_instance_f32,ifftFlag,"i");
GETFIELD(arm_cfft_radix2_instance_f32,bitReverseFlag,"i");
GETFIELD(arm_cfft_radix2_instance_f32,twidCoefModifier,"h");
GETFIELD(arm_cfft_radix2_instance_f32,bitRevFactor,"h");
GETFIELD(arm_cfft_radix2_instance_f32,onebyfftLen,"f");
static PyMethodDef arm_cfft_radix2_instance_f32_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_radix2_instance_f32_fftLen,METH_NOARGS,"fftLen"},
{"ifftFlag", (PyCFunction) Method_arm_cfft_radix2_instance_f32_ifftFlag,METH_NOARGS,"ifftFlag"},
{"bitReverseFlag", (PyCFunction) Method_arm_cfft_radix2_instance_f32_bitReverseFlag,METH_NOARGS,"bitReverseFlag"},
{"twidCoefModifier", (PyCFunction) Method_arm_cfft_radix2_instance_f32_twidCoefModifier,METH_NOARGS,"twidCoefModifier"},
{"bitRevFactor", (PyCFunction) Method_arm_cfft_radix2_instance_f32_bitRevFactor,METH_NOARGS,"bitRevFactor"},
{"onebyfftLen", (PyCFunction) Method_arm_cfft_radix2_instance_f32_onebyfftLen,METH_NOARGS,"onebyfftLen"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_radix2_instance_f32,arm_cfft_radix2_instance_f32_new,arm_cfft_radix2_instance_f32_dealloc,arm_cfft_radix2_instance_f32_init,arm_cfft_radix2_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_cfft_radix4_instance_f32 *instance;
} ml_arm_cfft_radix4_instance_f32Object;
static void
arm_cfft_radix4_instance_f32_dealloc(ml_arm_cfft_radix4_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_radix4_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_radix4_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_cfft_radix4_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_radix4_instance_f32));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_radix4_instance_f32_init(ml_arm_cfft_radix4_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","ifftFlag","bitReverseFlag","twidCoefModifier","bitRevFactor","onebyfftLen",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiihhf", kwlist,&self->instance->fftLen
,&self->instance->ifftFlag
,&self->instance->bitReverseFlag
,&self->instance->twidCoefModifier
,&self->instance->bitRevFactor
,&self->instance->onebyfftLen
))
{
}
return 0;
}
GETFIELD(arm_cfft_radix4_instance_f32,fftLen,"h");
GETFIELD(arm_cfft_radix4_instance_f32,ifftFlag,"i");
GETFIELD(arm_cfft_radix4_instance_f32,bitReverseFlag,"i");
GETFIELD(arm_cfft_radix4_instance_f32,twidCoefModifier,"h");
GETFIELD(arm_cfft_radix4_instance_f32,bitRevFactor,"h");
GETFIELD(arm_cfft_radix4_instance_f32,onebyfftLen,"f");
static PyMethodDef arm_cfft_radix4_instance_f32_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_radix4_instance_f32_fftLen,METH_NOARGS,"fftLen"},
{"ifftFlag", (PyCFunction) Method_arm_cfft_radix4_instance_f32_ifftFlag,METH_NOARGS,"ifftFlag"},
{"bitReverseFlag", (PyCFunction) Method_arm_cfft_radix4_instance_f32_bitReverseFlag,METH_NOARGS,"bitReverseFlag"},
{"twidCoefModifier", (PyCFunction) Method_arm_cfft_radix4_instance_f32_twidCoefModifier,METH_NOARGS,"twidCoefModifier"},
{"bitRevFactor", (PyCFunction) Method_arm_cfft_radix4_instance_f32_bitRevFactor,METH_NOARGS,"bitRevFactor"},
{"onebyfftLen", (PyCFunction) Method_arm_cfft_radix4_instance_f32_onebyfftLen,METH_NOARGS,"onebyfftLen"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_radix4_instance_f32,arm_cfft_radix4_instance_f32_new,arm_cfft_radix4_instance_f32_dealloc,arm_cfft_radix4_instance_f32_init,arm_cfft_radix4_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_cfft_instance_q15 *instance;
} ml_arm_cfft_instance_q15Object;
static void
arm_cfft_instance_q15_dealloc(ml_arm_cfft_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_cfft_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_instance_q15));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_instance_q15_init(ml_arm_cfft_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","bitRevLength",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hh", kwlist,&self->instance->fftLen
,&self->instance->bitRevLength
))
{
}
return 0;
}
GETFIELD(arm_cfft_instance_q15,fftLen,"h");
GETFIELD(arm_cfft_instance_q15,bitRevLength,"h");
static PyMethodDef arm_cfft_instance_q15_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_instance_q15_fftLen,METH_NOARGS,"fftLen"},
{"bitRevLength", (PyCFunction) Method_arm_cfft_instance_q15_bitRevLength,METH_NOARGS,"bitRevLength"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_instance_q15,arm_cfft_instance_q15_new,arm_cfft_instance_q15_dealloc,arm_cfft_instance_q15_init,arm_cfft_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_cfft_instance_q31 *instance;
} ml_arm_cfft_instance_q31Object;
static void
arm_cfft_instance_q31_dealloc(ml_arm_cfft_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_cfft_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_instance_q31));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_instance_q31_init(ml_arm_cfft_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","bitRevLength",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hh", kwlist,&self->instance->fftLen
,&self->instance->bitRevLength
))
{
}
return 0;
}
GETFIELD(arm_cfft_instance_q31,fftLen,"h");
GETFIELD(arm_cfft_instance_q31,bitRevLength,"h");
static PyMethodDef arm_cfft_instance_q31_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_instance_q31_fftLen,METH_NOARGS,"fftLen"},
{"bitRevLength", (PyCFunction) Method_arm_cfft_instance_q31_bitRevLength,METH_NOARGS,"bitRevLength"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_instance_q31,arm_cfft_instance_q31_new,arm_cfft_instance_q31_dealloc,arm_cfft_instance_q31_init,arm_cfft_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_cfft_instance_f32 *instance;
} ml_arm_cfft_instance_f32Object;
static void
arm_cfft_instance_f32_dealloc(ml_arm_cfft_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_cfft_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_cfft_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_cfft_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_cfft_instance_f32));
self->instance->pTwiddle = NULL;
self->instance->pBitRevTable = NULL;
}
return (PyObject *)self;
}
static int
arm_cfft_instance_f32_init(ml_arm_cfft_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pBitRevTable=NULL;
char *kwlist[] = {
"fftLen","bitRevLength",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hh", kwlist,&self->instance->fftLen
,&self->instance->bitRevLength
))
{
}
return 0;
}
GETFIELD(arm_cfft_instance_f32,fftLen,"h");
GETFIELD(arm_cfft_instance_f32,bitRevLength,"h");
static PyMethodDef arm_cfft_instance_f32_methods[] = {
{"fftLen", (PyCFunction) Method_arm_cfft_instance_f32_fftLen,METH_NOARGS,"fftLen"},
{"bitRevLength", (PyCFunction) Method_arm_cfft_instance_f32_bitRevLength,METH_NOARGS,"bitRevLength"},
{NULL} /* Sentinel */
};
MLTYPE(arm_cfft_instance_f32,arm_cfft_instance_f32_new,arm_cfft_instance_f32_dealloc,arm_cfft_instance_f32_init,arm_cfft_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_rfft_instance_q15 *instance;
} ml_arm_rfft_instance_q15Object;
static void
arm_rfft_instance_q15_dealloc(ml_arm_rfft_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_rfft_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_rfft_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_rfft_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_rfft_instance_q15));
self->instance->pTwiddleAReal = NULL;
self->instance->pTwiddleBReal = NULL;
self->instance->pCfft = NULL;
}
return (PyObject *)self;
}
static int
arm_rfft_instance_q15_init(ml_arm_rfft_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddleAReal=NULL;
PyObject *pTwiddleBReal=NULL;
PyObject *pCfft=NULL;
char *kwlist[] = {
"fftLenReal","ifftFlagR","bitReverseFlagR","twidCoefRModifier",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|iiii", kwlist,&self->instance->fftLenReal
,&self->instance->ifftFlagR
,&self->instance->bitReverseFlagR
,&self->instance->twidCoefRModifier
))
{
}
return 0;
}
GETFIELD(arm_rfft_instance_q15,fftLenReal,"i");
GETFIELD(arm_rfft_instance_q15,ifftFlagR,"i");
GETFIELD(arm_rfft_instance_q15,bitReverseFlagR,"i");
GETFIELD(arm_rfft_instance_q15,twidCoefRModifier,"i");
static PyMethodDef arm_rfft_instance_q15_methods[] = {
{"fftLenReal", (PyCFunction) Method_arm_rfft_instance_q15_fftLenReal,METH_NOARGS,"fftLenReal"},
{"ifftFlagR", (PyCFunction) Method_arm_rfft_instance_q15_ifftFlagR,METH_NOARGS,"ifftFlagR"},
{"bitReverseFlagR", (PyCFunction) Method_arm_rfft_instance_q15_bitReverseFlagR,METH_NOARGS,"bitReverseFlagR"},
{"twidCoefRModifier", (PyCFunction) Method_arm_rfft_instance_q15_twidCoefRModifier,METH_NOARGS,"twidCoefRModifier"},
{NULL} /* Sentinel */
};
MLTYPE(arm_rfft_instance_q15,arm_rfft_instance_q15_new,arm_rfft_instance_q15_dealloc,arm_rfft_instance_q15_init,arm_rfft_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_rfft_instance_q31 *instance;
} ml_arm_rfft_instance_q31Object;
static void
arm_rfft_instance_q31_dealloc(ml_arm_rfft_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_rfft_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_rfft_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_rfft_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_rfft_instance_q31));
self->instance->pTwiddleAReal = NULL;
self->instance->pTwiddleBReal = NULL;
self->instance->pCfft = NULL;
}
return (PyObject *)self;
}
static int
arm_rfft_instance_q31_init(ml_arm_rfft_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddleAReal=NULL;
PyObject *pTwiddleBReal=NULL;
PyObject *pCfft=NULL;
char *kwlist[] = {
"fftLenReal","ifftFlagR","bitReverseFlagR","twidCoefRModifier",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|iiii", kwlist,&self->instance->fftLenReal
,&self->instance->ifftFlagR
,&self->instance->bitReverseFlagR
,&self->instance->twidCoefRModifier
))
{
}
return 0;
}
GETFIELD(arm_rfft_instance_q31,fftLenReal,"i");
GETFIELD(arm_rfft_instance_q31,ifftFlagR,"i");
GETFIELD(arm_rfft_instance_q31,bitReverseFlagR,"i");
GETFIELD(arm_rfft_instance_q31,twidCoefRModifier,"i");
static PyMethodDef arm_rfft_instance_q31_methods[] = {
{"fftLenReal", (PyCFunction) Method_arm_rfft_instance_q31_fftLenReal,METH_NOARGS,"fftLenReal"},
{"ifftFlagR", (PyCFunction) Method_arm_rfft_instance_q31_ifftFlagR,METH_NOARGS,"ifftFlagR"},
{"bitReverseFlagR", (PyCFunction) Method_arm_rfft_instance_q31_bitReverseFlagR,METH_NOARGS,"bitReverseFlagR"},
{"twidCoefRModifier", (PyCFunction) Method_arm_rfft_instance_q31_twidCoefRModifier,METH_NOARGS,"twidCoefRModifier"},
{NULL} /* Sentinel */
};
MLTYPE(arm_rfft_instance_q31,arm_rfft_instance_q31_new,arm_rfft_instance_q31_dealloc,arm_rfft_instance_q31_init,arm_rfft_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_rfft_instance_f32 *instance;
} ml_arm_rfft_instance_f32Object;
static void
arm_rfft_instance_f32_dealloc(ml_arm_rfft_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_rfft_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_rfft_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_rfft_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_rfft_instance_f32));
self->instance->pTwiddleAReal = NULL;
self->instance->pTwiddleBReal = NULL;
self->instance->pCfft = NULL;
}
return (PyObject *)self;
}
static int
arm_rfft_instance_f32_init(ml_arm_rfft_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddleAReal=NULL;
PyObject *pTwiddleBReal=NULL;
PyObject *pCfft=NULL;
char *kwlist[] = {
"fftLenReal","fftLenBy2","ifftFlagR","bitReverseFlagR","twidCoefRModifier",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ihiii", kwlist,&self->instance->fftLenReal
,&self->instance->fftLenBy2
,&self->instance->ifftFlagR
,&self->instance->bitReverseFlagR
,&self->instance->twidCoefRModifier
))
{
}
return 0;
}
GETFIELD(arm_rfft_instance_f32,fftLenReal,"i");
GETFIELD(arm_rfft_instance_f32,fftLenBy2,"h");
GETFIELD(arm_rfft_instance_f32,ifftFlagR,"i");
GETFIELD(arm_rfft_instance_f32,bitReverseFlagR,"i");
GETFIELD(arm_rfft_instance_f32,twidCoefRModifier,"i");
static PyMethodDef arm_rfft_instance_f32_methods[] = {
{"fftLenReal", (PyCFunction) Method_arm_rfft_instance_f32_fftLenReal,METH_NOARGS,"fftLenReal"},
{"fftLenBy2", (PyCFunction) Method_arm_rfft_instance_f32_fftLenBy2,METH_NOARGS,"fftLenBy2"},
{"ifftFlagR", (PyCFunction) Method_arm_rfft_instance_f32_ifftFlagR,METH_NOARGS,"ifftFlagR"},
{"bitReverseFlagR", (PyCFunction) Method_arm_rfft_instance_f32_bitReverseFlagR,METH_NOARGS,"bitReverseFlagR"},
{"twidCoefRModifier", (PyCFunction) Method_arm_rfft_instance_f32_twidCoefRModifier,METH_NOARGS,"twidCoefRModifier"},
{NULL} /* Sentinel */
};
MLTYPE(arm_rfft_instance_f32,arm_rfft_instance_f32_new,arm_rfft_instance_f32_dealloc,arm_rfft_instance_f32_init,arm_rfft_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_rfft_fast_instance_f32 *instance;
} ml_arm_rfft_fast_instance_f32Object;
static void
arm_rfft_fast_instance_f32_dealloc(ml_arm_rfft_fast_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_rfft_fast_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_rfft_fast_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_rfft_fast_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_rfft_fast_instance_f32));
self->instance->pTwiddleRFFT = NULL;
}
return (PyObject *)self;
}
static int
arm_rfft_fast_instance_f32_init(ml_arm_rfft_fast_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddleRFFT=NULL;
char *kwlist[] = {
"Sint","fftLenRFFT",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|?h", kwlist,&self->instance->Sint
,&self->instance->fftLenRFFT
))
{
}
return 0;
}
GETFIELD(arm_rfft_fast_instance_f32,Sint,"?");
GETFIELD(arm_rfft_fast_instance_f32,fftLenRFFT,"h");
static PyMethodDef arm_rfft_fast_instance_f32_methods[] = {
{"Sint", (PyCFunction) Method_arm_rfft_fast_instance_f32_Sint,METH_NOARGS,"Sint"},
{"fftLenRFFT", (PyCFunction) Method_arm_rfft_fast_instance_f32_fftLenRFFT,METH_NOARGS,"fftLenRFFT"},
{NULL} /* Sentinel */
};
MLTYPE(arm_rfft_fast_instance_f32,arm_rfft_fast_instance_f32_new,arm_rfft_fast_instance_f32_dealloc,arm_rfft_fast_instance_f32_init,arm_rfft_fast_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_dct4_instance_f32 *instance;
} ml_arm_dct4_instance_f32Object;
static void
arm_dct4_instance_f32_dealloc(ml_arm_dct4_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_dct4_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_dct4_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_dct4_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_dct4_instance_f32));
self->instance->pTwiddle = NULL;
self->instance->pCosFactor = NULL;
self->instance->pRfft = NULL;
self->instance->pCfft = NULL;
}
return (PyObject *)self;
}
static int
arm_dct4_instance_f32_init(ml_arm_dct4_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pCosFactor=NULL;
PyObject *pRfft=NULL;
PyObject *pCfft=NULL;
char *kwlist[] = {
"N","Nby2","normalize",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhf", kwlist,&self->instance->N
,&self->instance->Nby2
,&self->instance->normalize
))
{
}
return 0;
}
GETFIELD(arm_dct4_instance_f32,N,"h");
GETFIELD(arm_dct4_instance_f32,Nby2,"h");
GETFIELD(arm_dct4_instance_f32,normalize,"f");
static PyMethodDef arm_dct4_instance_f32_methods[] = {
{"N", (PyCFunction) Method_arm_dct4_instance_f32_N,METH_NOARGS,"N"},
{"Nby2", (PyCFunction) Method_arm_dct4_instance_f32_Nby2,METH_NOARGS,"Nby2"},
{"normalize", (PyCFunction) Method_arm_dct4_instance_f32_normalize,METH_NOARGS,"normalize"},
{NULL} /* Sentinel */
};
MLTYPE(arm_dct4_instance_f32,arm_dct4_instance_f32_new,arm_dct4_instance_f32_dealloc,arm_dct4_instance_f32_init,arm_dct4_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_dct4_instance_q31 *instance;
} ml_arm_dct4_instance_q31Object;
static void
arm_dct4_instance_q31_dealloc(ml_arm_dct4_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_dct4_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_dct4_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_dct4_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_dct4_instance_q31));
self->instance->pTwiddle = NULL;
self->instance->pCosFactor = NULL;
self->instance->pRfft = NULL;
self->instance->pCfft = NULL;
}
return (PyObject *)self;
}
static int
arm_dct4_instance_q31_init(ml_arm_dct4_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pCosFactor=NULL;
PyObject *pRfft=NULL;
PyObject *pCfft=NULL;
char *kwlist[] = {
"N","Nby2","normalize",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhi", kwlist,&self->instance->N
,&self->instance->Nby2
,&self->instance->normalize
))
{
}
return 0;
}
GETFIELD(arm_dct4_instance_q31,N,"h");
GETFIELD(arm_dct4_instance_q31,Nby2,"h");
GETFIELD(arm_dct4_instance_q31,normalize,"i");
static PyMethodDef arm_dct4_instance_q31_methods[] = {
{"N", (PyCFunction) Method_arm_dct4_instance_q31_N,METH_NOARGS,"N"},
{"Nby2", (PyCFunction) Method_arm_dct4_instance_q31_Nby2,METH_NOARGS,"Nby2"},
{"normalize", (PyCFunction) Method_arm_dct4_instance_q31_normalize,METH_NOARGS,"normalize"},
{NULL} /* Sentinel */
};
MLTYPE(arm_dct4_instance_q31,arm_dct4_instance_q31_new,arm_dct4_instance_q31_dealloc,arm_dct4_instance_q31_init,arm_dct4_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_dct4_instance_q15 *instance;
} ml_arm_dct4_instance_q15Object;
static void
arm_dct4_instance_q15_dealloc(ml_arm_dct4_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_dct4_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_dct4_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_dct4_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_dct4_instance_q15));
self->instance->pTwiddle = NULL;
self->instance->pCosFactor = NULL;
self->instance->pRfft = NULL;
self->instance->pCfft = NULL;
}
return (PyObject *)self;
}
static int
arm_dct4_instance_q15_init(ml_arm_dct4_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pTwiddle=NULL;
PyObject *pCosFactor=NULL;
PyObject *pRfft=NULL;
PyObject *pCfft=NULL;
char *kwlist[] = {
"N","Nby2","normalize",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhh", kwlist,&self->instance->N
,&self->instance->Nby2
,&self->instance->normalize
))
{
}
return 0;
}
GETFIELD(arm_dct4_instance_q15,N,"h");
GETFIELD(arm_dct4_instance_q15,Nby2,"h");
GETFIELD(arm_dct4_instance_q15,normalize,"h");
static PyMethodDef arm_dct4_instance_q15_methods[] = {
{"N", (PyCFunction) Method_arm_dct4_instance_q15_N,METH_NOARGS,"N"},
{"Nby2", (PyCFunction) Method_arm_dct4_instance_q15_Nby2,METH_NOARGS,"Nby2"},
{"normalize", (PyCFunction) Method_arm_dct4_instance_q15_normalize,METH_NOARGS,"normalize"},
{NULL} /* Sentinel */
};
MLTYPE(arm_dct4_instance_q15,arm_dct4_instance_q15_new,arm_dct4_instance_q15_dealloc,arm_dct4_instance_q15_init,arm_dct4_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_decimate_instance_q15 *instance;
} ml_arm_fir_decimate_instance_q15Object;
static void
arm_fir_decimate_instance_q15_dealloc(ml_arm_fir_decimate_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_decimate_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_decimate_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_fir_decimate_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_decimate_instance_q15));
self->instance->pCoeffs = NULL;
self->instance->pState = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_decimate_instance_q15_init(ml_arm_fir_decimate_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pCoeffs=NULL;
PyObject *pState=NULL;
char *kwlist[] = {
"M","numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ih", kwlist,&self->instance->M
,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_decimate_instance_q15,M,"i");
GETFIELD(arm_fir_decimate_instance_q15,numTaps,"h");
static PyMethodDef arm_fir_decimate_instance_q15_methods[] = {
{"M", (PyCFunction) Method_arm_fir_decimate_instance_q15_M,METH_NOARGS,"M"},
{"numTaps", (PyCFunction) Method_arm_fir_decimate_instance_q15_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_decimate_instance_q15,arm_fir_decimate_instance_q15_new,arm_fir_decimate_instance_q15_dealloc,arm_fir_decimate_instance_q15_init,arm_fir_decimate_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_decimate_instance_q31 *instance;
} ml_arm_fir_decimate_instance_q31Object;
static void
arm_fir_decimate_instance_q31_dealloc(ml_arm_fir_decimate_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_decimate_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_decimate_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_fir_decimate_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_decimate_instance_q31));
self->instance->pCoeffs = NULL;
self->instance->pState = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_decimate_instance_q31_init(ml_arm_fir_decimate_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pCoeffs=NULL;
PyObject *pState=NULL;
char *kwlist[] = {
"M","numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ih", kwlist,&self->instance->M
,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_decimate_instance_q31,M,"i");
GETFIELD(arm_fir_decimate_instance_q31,numTaps,"h");
static PyMethodDef arm_fir_decimate_instance_q31_methods[] = {
{"M", (PyCFunction) Method_arm_fir_decimate_instance_q31_M,METH_NOARGS,"M"},
{"numTaps", (PyCFunction) Method_arm_fir_decimate_instance_q31_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_decimate_instance_q31,arm_fir_decimate_instance_q31_new,arm_fir_decimate_instance_q31_dealloc,arm_fir_decimate_instance_q31_init,arm_fir_decimate_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_fir_decimate_instance_f32 *instance;
} ml_arm_fir_decimate_instance_f32Object;
static void
arm_fir_decimate_instance_f32_dealloc(ml_arm_fir_decimate_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_decimate_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_decimate_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_fir_decimate_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_decimate_instance_f32));
self->instance->pCoeffs = NULL;
self->instance->pState = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_decimate_instance_f32_init(ml_arm_fir_decimate_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pCoeffs=NULL;
PyObject *pState=NULL;
char *kwlist[] = {
"M","numTaps",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ih", kwlist,&self->instance->M
,&self->instance->numTaps
))
{
}
return 0;
}
GETFIELD(arm_fir_decimate_instance_f32,M,"i");
GETFIELD(arm_fir_decimate_instance_f32,numTaps,"h");
static PyMethodDef arm_fir_decimate_instance_f32_methods[] = {
{"M", (PyCFunction) Method_arm_fir_decimate_instance_f32_M,METH_NOARGS,"M"},
{"numTaps", (PyCFunction) Method_arm_fir_decimate_instance_f32_numTaps,METH_NOARGS,"numTaps"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_decimate_instance_f32,arm_fir_decimate_instance_f32_new,arm_fir_decimate_instance_f32_dealloc,arm_fir_decimate_instance_f32_init,arm_fir_decimate_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_fir_interpolate_instance_q15 *instance;
} ml_arm_fir_interpolate_instance_q15Object;
static void
arm_fir_interpolate_instance_q15_dealloc(ml_arm_fir_interpolate_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_interpolate_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_interpolate_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_fir_interpolate_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_interpolate_instance_q15));
self->instance->pCoeffs = NULL;
self->instance->pState = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_interpolate_instance_q15_init(ml_arm_fir_interpolate_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pCoeffs=NULL;
PyObject *pState=NULL;
char *kwlist[] = {
"L","phaseLength",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ih", kwlist,&self->instance->L
,&self->instance->phaseLength
))
{
}
return 0;
}
GETFIELD(arm_fir_interpolate_instance_q15,L,"i");
GETFIELD(arm_fir_interpolate_instance_q15,phaseLength,"h");
static PyMethodDef arm_fir_interpolate_instance_q15_methods[] = {
{"L", (PyCFunction) Method_arm_fir_interpolate_instance_q15_L,METH_NOARGS,"L"},
{"phaseLength", (PyCFunction) Method_arm_fir_interpolate_instance_q15_phaseLength,METH_NOARGS,"phaseLength"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_interpolate_instance_q15,arm_fir_interpolate_instance_q15_new,arm_fir_interpolate_instance_q15_dealloc,arm_fir_interpolate_instance_q15_init,arm_fir_interpolate_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_interpolate_instance_q31 *instance;
} ml_arm_fir_interpolate_instance_q31Object;
static void
arm_fir_interpolate_instance_q31_dealloc(ml_arm_fir_interpolate_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_interpolate_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_interpolate_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_fir_interpolate_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_interpolate_instance_q31));
self->instance->pCoeffs = NULL;
self->instance->pState = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_interpolate_instance_q31_init(ml_arm_fir_interpolate_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pCoeffs=NULL;
PyObject *pState=NULL;
char *kwlist[] = {
"L","phaseLength",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ih", kwlist,&self->instance->L
,&self->instance->phaseLength
))
{
}
return 0;
}
GETFIELD(arm_fir_interpolate_instance_q31,L,"i");
GETFIELD(arm_fir_interpolate_instance_q31,phaseLength,"h");
static PyMethodDef arm_fir_interpolate_instance_q31_methods[] = {
{"L", (PyCFunction) Method_arm_fir_interpolate_instance_q31_L,METH_NOARGS,"L"},
{"phaseLength", (PyCFunction) Method_arm_fir_interpolate_instance_q31_phaseLength,METH_NOARGS,"phaseLength"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_interpolate_instance_q31,arm_fir_interpolate_instance_q31_new,arm_fir_interpolate_instance_q31_dealloc,arm_fir_interpolate_instance_q31_init,arm_fir_interpolate_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_fir_interpolate_instance_f32 *instance;
} ml_arm_fir_interpolate_instance_f32Object;
static void
arm_fir_interpolate_instance_f32_dealloc(ml_arm_fir_interpolate_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_interpolate_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_interpolate_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_fir_interpolate_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_interpolate_instance_f32));
self->instance->pCoeffs = NULL;
self->instance->pState = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_interpolate_instance_f32_init(ml_arm_fir_interpolate_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pCoeffs=NULL;
PyObject *pState=NULL;
char *kwlist[] = {
"L","phaseLength",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ih", kwlist,&self->instance->L
,&self->instance->phaseLength
))
{
}
return 0;
}
GETFIELD(arm_fir_interpolate_instance_f32,L,"i");
GETFIELD(arm_fir_interpolate_instance_f32,phaseLength,"h");
static PyMethodDef arm_fir_interpolate_instance_f32_methods[] = {
{"L", (PyCFunction) Method_arm_fir_interpolate_instance_f32_L,METH_NOARGS,"L"},
{"phaseLength", (PyCFunction) Method_arm_fir_interpolate_instance_f32_phaseLength,METH_NOARGS,"phaseLength"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_interpolate_instance_f32,arm_fir_interpolate_instance_f32_new,arm_fir_interpolate_instance_f32_dealloc,arm_fir_interpolate_instance_f32_init,arm_fir_interpolate_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_biquad_cas_df1_32x64_ins_q31 *instance;
} ml_arm_biquad_cas_df1_32x64_ins_q31Object;
static void
arm_biquad_cas_df1_32x64_ins_q31_dealloc(ml_arm_biquad_cas_df1_32x64_ins_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_cas_df1_32x64_ins_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_cas_df1_32x64_ins_q31Object *self;
//printf("New called\n");
self = (ml_arm_biquad_cas_df1_32x64_ins_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_cas_df1_32x64_ins_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_cas_df1_32x64_ins_q31_init(ml_arm_biquad_cas_df1_32x64_ins_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages","postShift",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwlist,&self->instance->numStages
,&self->instance->postShift
))
{
}
return 0;
}
GETFIELD(arm_biquad_cas_df1_32x64_ins_q31,numStages,"i");
GETFIELD(arm_biquad_cas_df1_32x64_ins_q31,postShift,"i");
static PyMethodDef arm_biquad_cas_df1_32x64_ins_q31_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_cas_df1_32x64_ins_q31_numStages,METH_NOARGS,"numStages"},
{"postShift", (PyCFunction) Method_arm_biquad_cas_df1_32x64_ins_q31_postShift,METH_NOARGS,"postShift"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_cas_df1_32x64_ins_q31,arm_biquad_cas_df1_32x64_ins_q31_new,arm_biquad_cas_df1_32x64_ins_q31_dealloc,arm_biquad_cas_df1_32x64_ins_q31_init,arm_biquad_cas_df1_32x64_ins_q31_methods);
typedef struct {
PyObject_HEAD
arm_biquad_cascade_df2T_instance_f32 *instance;
} ml_arm_biquad_cascade_df2T_instance_f32Object;
static void
arm_biquad_cascade_df2T_instance_f32_dealloc(ml_arm_biquad_cascade_df2T_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_cascade_df2T_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_cascade_df2T_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_biquad_cascade_df2T_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_cascade_df2T_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_cascade_df2T_instance_f32_init(ml_arm_biquad_cascade_df2T_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_biquad_cascade_df2T_instance_f32,numStages,"i");
static PyMethodDef arm_biquad_cascade_df2T_instance_f32_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_cascade_df2T_instance_f32_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_cascade_df2T_instance_f32,arm_biquad_cascade_df2T_instance_f32_new,arm_biquad_cascade_df2T_instance_f32_dealloc,arm_biquad_cascade_df2T_instance_f32_init,arm_biquad_cascade_df2T_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_biquad_cascade_stereo_df2T_instance_f32 *instance;
} ml_arm_biquad_cascade_stereo_df2T_instance_f32Object;
static void
arm_biquad_cascade_stereo_df2T_instance_f32_dealloc(ml_arm_biquad_cascade_stereo_df2T_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_cascade_stereo_df2T_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_cascade_stereo_df2T_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_cascade_stereo_df2T_instance_f32_init(ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_biquad_cascade_stereo_df2T_instance_f32,numStages,"i");
static PyMethodDef arm_biquad_cascade_stereo_df2T_instance_f32_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_cascade_stereo_df2T_instance_f32_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_cascade_stereo_df2T_instance_f32,arm_biquad_cascade_stereo_df2T_instance_f32_new,arm_biquad_cascade_stereo_df2T_instance_f32_dealloc,arm_biquad_cascade_stereo_df2T_instance_f32_init,arm_biquad_cascade_stereo_df2T_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_biquad_cascade_df2T_instance_f64 *instance;
} ml_arm_biquad_cascade_df2T_instance_f64Object;
static void
arm_biquad_cascade_df2T_instance_f64_dealloc(ml_arm_biquad_cascade_df2T_instance_f64Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_biquad_cascade_df2T_instance_f64_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_biquad_cascade_df2T_instance_f64Object *self;
//printf("New called\n");
self = (ml_arm_biquad_cascade_df2T_instance_f64Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_biquad_cascade_df2T_instance_f64));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_biquad_cascade_df2T_instance_f64_init(ml_arm_biquad_cascade_df2T_instance_f64Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_biquad_cascade_df2T_instance_f64,numStages,"i");
static PyMethodDef arm_biquad_cascade_df2T_instance_f64_methods[] = {
{"numStages", (PyCFunction) Method_arm_biquad_cascade_df2T_instance_f64_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_biquad_cascade_df2T_instance_f64,arm_biquad_cascade_df2T_instance_f64_new,arm_biquad_cascade_df2T_instance_f64_dealloc,arm_biquad_cascade_df2T_instance_f64_init,arm_biquad_cascade_df2T_instance_f64_methods);
typedef struct {
PyObject_HEAD
arm_fir_lattice_instance_q15 *instance;
} ml_arm_fir_lattice_instance_q15Object;
static void
arm_fir_lattice_instance_q15_dealloc(ml_arm_fir_lattice_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_lattice_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_lattice_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_fir_lattice_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_lattice_instance_q15));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_lattice_instance_q15_init(ml_arm_fir_lattice_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_fir_lattice_instance_q15,numStages,"h");
static PyMethodDef arm_fir_lattice_instance_q15_methods[] = {
{"numStages", (PyCFunction) Method_arm_fir_lattice_instance_q15_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_lattice_instance_q15,arm_fir_lattice_instance_q15_new,arm_fir_lattice_instance_q15_dealloc,arm_fir_lattice_instance_q15_init,arm_fir_lattice_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_lattice_instance_q31 *instance;
} ml_arm_fir_lattice_instance_q31Object;
static void
arm_fir_lattice_instance_q31_dealloc(ml_arm_fir_lattice_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_lattice_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_lattice_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_fir_lattice_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_lattice_instance_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_lattice_instance_q31_init(ml_arm_fir_lattice_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_fir_lattice_instance_q31,numStages,"h");
static PyMethodDef arm_fir_lattice_instance_q31_methods[] = {
{"numStages", (PyCFunction) Method_arm_fir_lattice_instance_q31_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_lattice_instance_q31,arm_fir_lattice_instance_q31_new,arm_fir_lattice_instance_q31_dealloc,arm_fir_lattice_instance_q31_init,arm_fir_lattice_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_fir_lattice_instance_f32 *instance;
} ml_arm_fir_lattice_instance_f32Object;
static void
arm_fir_lattice_instance_f32_dealloc(ml_arm_fir_lattice_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_lattice_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_lattice_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_fir_lattice_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_lattice_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_lattice_instance_f32_init(ml_arm_fir_lattice_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numStages",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|h", kwlist,&self->instance->numStages
))
{
}
return 0;
}
GETFIELD(arm_fir_lattice_instance_f32,numStages,"h");
static PyMethodDef arm_fir_lattice_instance_f32_methods[] = {
{"numStages", (PyCFunction) Method_arm_fir_lattice_instance_f32_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_lattice_instance_f32,arm_fir_lattice_instance_f32_new,arm_fir_lattice_instance_f32_dealloc,arm_fir_lattice_instance_f32_init,arm_fir_lattice_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_iir_lattice_instance_q15 *instance;
} ml_arm_iir_lattice_instance_q15Object;
static void
arm_iir_lattice_instance_q15_dealloc(ml_arm_iir_lattice_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pkCoeffs)
{
PyMem_Free(self->instance->pkCoeffs);
}
if (self->instance->pvCoeffs)
{
PyMem_Free(self->instance->pvCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_iir_lattice_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_iir_lattice_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_iir_lattice_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_iir_lattice_instance_q15));
self->instance->pState = NULL;
self->instance->pkCoeffs = NULL;
self->instance->pvCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_iir_lattice_instance_q15_init(ml_arm_iir_lattice_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pkCoeffs=NULL;
PyObject *pvCoeffs=NULL;
char *kwlist[] = {
"numStages","pkCoeffs","pvCoeffs",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hOO", kwlist,&self->instance->numStages
,&pkCoeffs
,&pvCoeffs
))
{
INITARRAYFIELD(pkCoeffs,NPY_INT16,int16_t,int16_t);
INITARRAYFIELD(pvCoeffs,NPY_INT16,int16_t,int16_t);
}
return 0;
}
GETFIELD(arm_iir_lattice_instance_q15,numStages,"h");
static PyMethodDef arm_iir_lattice_instance_q15_methods[] = {
{"numStages", (PyCFunction) Method_arm_iir_lattice_instance_q15_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_iir_lattice_instance_q15,arm_iir_lattice_instance_q15_new,arm_iir_lattice_instance_q15_dealloc,arm_iir_lattice_instance_q15_init,arm_iir_lattice_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_iir_lattice_instance_q31 *instance;
} ml_arm_iir_lattice_instance_q31Object;
static void
arm_iir_lattice_instance_q31_dealloc(ml_arm_iir_lattice_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pkCoeffs)
{
PyMem_Free(self->instance->pkCoeffs);
}
if (self->instance->pvCoeffs)
{
PyMem_Free(self->instance->pvCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_iir_lattice_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_iir_lattice_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_iir_lattice_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_iir_lattice_instance_q31));
self->instance->pState = NULL;
self->instance->pkCoeffs = NULL;
self->instance->pvCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_iir_lattice_instance_q31_init(ml_arm_iir_lattice_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pkCoeffs=NULL;
PyObject *pvCoeffs=NULL;
char *kwlist[] = {
"numStages","pkCoeffs","pvCoeffs",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hOO", kwlist,&self->instance->numStages
,&pkCoeffs
,&pvCoeffs
))
{
INITARRAYFIELD(pkCoeffs,NPY_INT32,int32_t,int32_t);
INITARRAYFIELD(pvCoeffs,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_iir_lattice_instance_q31,numStages,"h");
static PyMethodDef arm_iir_lattice_instance_q31_methods[] = {
{"numStages", (PyCFunction) Method_arm_iir_lattice_instance_q31_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_iir_lattice_instance_q31,arm_iir_lattice_instance_q31_new,arm_iir_lattice_instance_q31_dealloc,arm_iir_lattice_instance_q31_init,arm_iir_lattice_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_iir_lattice_instance_f32 *instance;
} ml_arm_iir_lattice_instance_f32Object;
static void
arm_iir_lattice_instance_f32_dealloc(ml_arm_iir_lattice_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pkCoeffs)
{
PyMem_Free(self->instance->pkCoeffs);
}
if (self->instance->pvCoeffs)
{
PyMem_Free(self->instance->pvCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_iir_lattice_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_iir_lattice_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_iir_lattice_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_iir_lattice_instance_f32));
self->instance->pState = NULL;
self->instance->pkCoeffs = NULL;
self->instance->pvCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_iir_lattice_instance_f32_init(ml_arm_iir_lattice_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pkCoeffs=NULL;
PyObject *pvCoeffs=NULL;
char *kwlist[] = {
"numStages","pkCoeffs","pvCoeffs",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hOO", kwlist,&self->instance->numStages
,&pkCoeffs
,&pvCoeffs
))
{
INITARRAYFIELD(pkCoeffs,NPY_DOUBLE,double,float32_t);
INITARRAYFIELD(pvCoeffs,NPY_DOUBLE,double,float32_t);
}
return 0;
}
GETFIELD(arm_iir_lattice_instance_f32,numStages,"h");
static PyMethodDef arm_iir_lattice_instance_f32_methods[] = {
{"numStages", (PyCFunction) Method_arm_iir_lattice_instance_f32_numStages,METH_NOARGS,"numStages"},
{NULL} /* Sentinel */
};
MLTYPE(arm_iir_lattice_instance_f32,arm_iir_lattice_instance_f32_new,arm_iir_lattice_instance_f32_dealloc,arm_iir_lattice_instance_f32_init,arm_iir_lattice_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_lms_instance_f32 *instance;
} ml_arm_lms_instance_f32Object;
static void
arm_lms_instance_f32_dealloc(ml_arm_lms_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_lms_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_lms_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_lms_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_lms_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_lms_instance_f32_init(ml_arm_lms_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps","mu",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hf", kwlist,&self->instance->numTaps
,&self->instance->mu
))
{
}
return 0;
}
GETFIELD(arm_lms_instance_f32,numTaps,"h");
GETFIELD(arm_lms_instance_f32,mu,"f");
static PyMethodDef arm_lms_instance_f32_methods[] = {
{"numTaps", (PyCFunction) Method_arm_lms_instance_f32_numTaps,METH_NOARGS,"numTaps"},
{"mu", (PyCFunction) Method_arm_lms_instance_f32_mu,METH_NOARGS,"mu"},
{NULL} /* Sentinel */
};
MLTYPE(arm_lms_instance_f32,arm_lms_instance_f32_new,arm_lms_instance_f32_dealloc,arm_lms_instance_f32_init,arm_lms_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_lms_instance_q15 *instance;
} ml_arm_lms_instance_q15Object;
static void
arm_lms_instance_q15_dealloc(ml_arm_lms_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_lms_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_lms_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_lms_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_lms_instance_q15));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_lms_instance_q15_init(ml_arm_lms_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps","mu","postShift",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhi", kwlist,&self->instance->numTaps
,&self->instance->mu
,&self->instance->postShift
))
{
}
return 0;
}
GETFIELD(arm_lms_instance_q15,numTaps,"h");
GETFIELD(arm_lms_instance_q15,mu,"h");
GETFIELD(arm_lms_instance_q15,postShift,"i");
static PyMethodDef arm_lms_instance_q15_methods[] = {
{"numTaps", (PyCFunction) Method_arm_lms_instance_q15_numTaps,METH_NOARGS,"numTaps"},
{"mu", (PyCFunction) Method_arm_lms_instance_q15_mu,METH_NOARGS,"mu"},
{"postShift", (PyCFunction) Method_arm_lms_instance_q15_postShift,METH_NOARGS,"postShift"},
{NULL} /* Sentinel */
};
MLTYPE(arm_lms_instance_q15,arm_lms_instance_q15_new,arm_lms_instance_q15_dealloc,arm_lms_instance_q15_init,arm_lms_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_lms_instance_q31 *instance;
} ml_arm_lms_instance_q31Object;
static void
arm_lms_instance_q31_dealloc(ml_arm_lms_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_lms_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_lms_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_lms_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_lms_instance_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_lms_instance_q31_init(ml_arm_lms_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps","mu","postShift",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hii", kwlist,&self->instance->numTaps
,&self->instance->mu
,&self->instance->postShift
))
{
}
return 0;
}
GETFIELD(arm_lms_instance_q31,numTaps,"h");
GETFIELD(arm_lms_instance_q31,mu,"i");
GETFIELD(arm_lms_instance_q31,postShift,"i");
static PyMethodDef arm_lms_instance_q31_methods[] = {
{"numTaps", (PyCFunction) Method_arm_lms_instance_q31_numTaps,METH_NOARGS,"numTaps"},
{"mu", (PyCFunction) Method_arm_lms_instance_q31_mu,METH_NOARGS,"mu"},
{"postShift", (PyCFunction) Method_arm_lms_instance_q31_postShift,METH_NOARGS,"postShift"},
{NULL} /* Sentinel */
};
MLTYPE(arm_lms_instance_q31,arm_lms_instance_q31_new,arm_lms_instance_q31_dealloc,arm_lms_instance_q31_init,arm_lms_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_lms_norm_instance_f32 *instance;
} ml_arm_lms_norm_instance_f32Object;
static void
arm_lms_norm_instance_f32_dealloc(ml_arm_lms_norm_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_lms_norm_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_lms_norm_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_lms_norm_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_lms_norm_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
}
return (PyObject *)self;
}
static int
arm_lms_norm_instance_f32_init(ml_arm_lms_norm_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
char *kwlist[] = {
"numTaps","mu","energy","x0",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hfff", kwlist,&self->instance->numTaps
,&self->instance->mu
,&self->instance->energy
,&self->instance->x0
))
{
}
return 0;
}
GETFIELD(arm_lms_norm_instance_f32,numTaps,"h");
GETFIELD(arm_lms_norm_instance_f32,mu,"f");
GETFIELD(arm_lms_norm_instance_f32,energy,"f");
GETFIELD(arm_lms_norm_instance_f32,x0,"f");
static PyMethodDef arm_lms_norm_instance_f32_methods[] = {
{"numTaps", (PyCFunction) Method_arm_lms_norm_instance_f32_numTaps,METH_NOARGS,"numTaps"},
{"mu", (PyCFunction) Method_arm_lms_norm_instance_f32_mu,METH_NOARGS,"mu"},
{"energy", (PyCFunction) Method_arm_lms_norm_instance_f32_energy,METH_NOARGS,"energy"},
{"x0", (PyCFunction) Method_arm_lms_norm_instance_f32_x0,METH_NOARGS,"x0"},
{NULL} /* Sentinel */
};
MLTYPE(arm_lms_norm_instance_f32,arm_lms_norm_instance_f32_new,arm_lms_norm_instance_f32_dealloc,arm_lms_norm_instance_f32_init,arm_lms_norm_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_lms_norm_instance_q31 *instance;
} ml_arm_lms_norm_instance_q31Object;
static void
arm_lms_norm_instance_q31_dealloc(ml_arm_lms_norm_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_lms_norm_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_lms_norm_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_lms_norm_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_lms_norm_instance_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
self->instance->recipTable = NULL;
}
return (PyObject *)self;
}
static int
arm_lms_norm_instance_q31_init(ml_arm_lms_norm_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
PyObject *recipTable=NULL;
char *kwlist[] = {
"numTaps","mu","postShift","energy","x0",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hiiii", kwlist,&self->instance->numTaps
,&self->instance->mu
,&self->instance->postShift
,&self->instance->energy
,&self->instance->x0
))
{
}
return 0;
}
GETFIELD(arm_lms_norm_instance_q31,numTaps,"h");
GETFIELD(arm_lms_norm_instance_q31,mu,"i");
GETFIELD(arm_lms_norm_instance_q31,postShift,"i");
GETFIELD(arm_lms_norm_instance_q31,energy,"i");
GETFIELD(arm_lms_norm_instance_q31,x0,"i");
static PyMethodDef arm_lms_norm_instance_q31_methods[] = {
{"numTaps", (PyCFunction) Method_arm_lms_norm_instance_q31_numTaps,METH_NOARGS,"numTaps"},
{"mu", (PyCFunction) Method_arm_lms_norm_instance_q31_mu,METH_NOARGS,"mu"},
{"postShift", (PyCFunction) Method_arm_lms_norm_instance_q31_postShift,METH_NOARGS,"postShift"},
{"energy", (PyCFunction) Method_arm_lms_norm_instance_q31_energy,METH_NOARGS,"energy"},
{"x0", (PyCFunction) Method_arm_lms_norm_instance_q31_x0,METH_NOARGS,"x0"},
{NULL} /* Sentinel */
};
MLTYPE(arm_lms_norm_instance_q31,arm_lms_norm_instance_q31_new,arm_lms_norm_instance_q31_dealloc,arm_lms_norm_instance_q31_init,arm_lms_norm_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_lms_norm_instance_q15 *instance;
} ml_arm_lms_norm_instance_q15Object;
static void
arm_lms_norm_instance_q15_dealloc(ml_arm_lms_norm_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_lms_norm_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_lms_norm_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_lms_norm_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_lms_norm_instance_q15));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
self->instance->recipTable = NULL;
}
return (PyObject *)self;
}
static int
arm_lms_norm_instance_q15_init(ml_arm_lms_norm_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
PyObject *recipTable=NULL;
char *kwlist[] = {
"numTaps","mu","postShift","energy","x0",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhihh", kwlist,&self->instance->numTaps
,&self->instance->mu
,&self->instance->postShift
,&self->instance->energy
,&self->instance->x0
))
{
}
return 0;
}
GETFIELD(arm_lms_norm_instance_q15,numTaps,"h");
GETFIELD(arm_lms_norm_instance_q15,mu,"h");
GETFIELD(arm_lms_norm_instance_q15,postShift,"i");
GETFIELD(arm_lms_norm_instance_q15,energy,"h");
GETFIELD(arm_lms_norm_instance_q15,x0,"h");
static PyMethodDef arm_lms_norm_instance_q15_methods[] = {
{"numTaps", (PyCFunction) Method_arm_lms_norm_instance_q15_numTaps,METH_NOARGS,"numTaps"},
{"mu", (PyCFunction) Method_arm_lms_norm_instance_q15_mu,METH_NOARGS,"mu"},
{"postShift", (PyCFunction) Method_arm_lms_norm_instance_q15_postShift,METH_NOARGS,"postShift"},
{"energy", (PyCFunction) Method_arm_lms_norm_instance_q15_energy,METH_NOARGS,"energy"},
{"x0", (PyCFunction) Method_arm_lms_norm_instance_q15_x0,METH_NOARGS,"x0"},
{NULL} /* Sentinel */
};
MLTYPE(arm_lms_norm_instance_q15,arm_lms_norm_instance_q15_new,arm_lms_norm_instance_q15_dealloc,arm_lms_norm_instance_q15_init,arm_lms_norm_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_sparse_instance_f32 *instance;
} ml_arm_fir_sparse_instance_f32Object;
static void
arm_fir_sparse_instance_f32_dealloc(ml_arm_fir_sparse_instance_f32Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pTapDelay)
{
PyMem_Free(self->instance->pTapDelay);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_sparse_instance_f32_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_sparse_instance_f32Object *self;
//printf("New called\n");
self = (ml_arm_fir_sparse_instance_f32Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_sparse_instance_f32));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
self->instance->pTapDelay = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_sparse_instance_f32_init(ml_arm_fir_sparse_instance_f32Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
PyObject *pTapDelay=NULL;
char *kwlist[] = {
"numTaps","stateIndex","maxDelay","pTapDelay",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhhO", kwlist,&self->instance->numTaps
,&self->instance->stateIndex
,&self->instance->maxDelay
,&pTapDelay
))
{
INITARRAYFIELD(pTapDelay,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_fir_sparse_instance_f32,numTaps,"h");
GETFIELD(arm_fir_sparse_instance_f32,stateIndex,"h");
GETFIELD(arm_fir_sparse_instance_f32,maxDelay,"h");
static PyMethodDef arm_fir_sparse_instance_f32_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_sparse_instance_f32_numTaps,METH_NOARGS,"numTaps"},
{"stateIndex", (PyCFunction) Method_arm_fir_sparse_instance_f32_stateIndex,METH_NOARGS,"stateIndex"},
{"maxDelay", (PyCFunction) Method_arm_fir_sparse_instance_f32_maxDelay,METH_NOARGS,"maxDelay"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_sparse_instance_f32,arm_fir_sparse_instance_f32_new,arm_fir_sparse_instance_f32_dealloc,arm_fir_sparse_instance_f32_init,arm_fir_sparse_instance_f32_methods);
typedef struct {
PyObject_HEAD
arm_fir_sparse_instance_q31 *instance;
} ml_arm_fir_sparse_instance_q31Object;
static void
arm_fir_sparse_instance_q31_dealloc(ml_arm_fir_sparse_instance_q31Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pTapDelay)
{
PyMem_Free(self->instance->pTapDelay);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_sparse_instance_q31_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_sparse_instance_q31Object *self;
//printf("New called\n");
self = (ml_arm_fir_sparse_instance_q31Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_sparse_instance_q31));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
self->instance->pTapDelay = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_sparse_instance_q31_init(ml_arm_fir_sparse_instance_q31Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
PyObject *pTapDelay=NULL;
char *kwlist[] = {
"numTaps","stateIndex","maxDelay","pTapDelay",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhhO", kwlist,&self->instance->numTaps
,&self->instance->stateIndex
,&self->instance->maxDelay
,&pTapDelay
))
{
INITARRAYFIELD(pTapDelay,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_fir_sparse_instance_q31,numTaps,"h");
GETFIELD(arm_fir_sparse_instance_q31,stateIndex,"h");
GETFIELD(arm_fir_sparse_instance_q31,maxDelay,"h");
static PyMethodDef arm_fir_sparse_instance_q31_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_sparse_instance_q31_numTaps,METH_NOARGS,"numTaps"},
{"stateIndex", (PyCFunction) Method_arm_fir_sparse_instance_q31_stateIndex,METH_NOARGS,"stateIndex"},
{"maxDelay", (PyCFunction) Method_arm_fir_sparse_instance_q31_maxDelay,METH_NOARGS,"maxDelay"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_sparse_instance_q31,arm_fir_sparse_instance_q31_new,arm_fir_sparse_instance_q31_dealloc,arm_fir_sparse_instance_q31_init,arm_fir_sparse_instance_q31_methods);
typedef struct {
PyObject_HEAD
arm_fir_sparse_instance_q15 *instance;
} ml_arm_fir_sparse_instance_q15Object;
static void
arm_fir_sparse_instance_q15_dealloc(ml_arm_fir_sparse_instance_q15Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pTapDelay)
{
PyMem_Free(self->instance->pTapDelay);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_sparse_instance_q15_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_sparse_instance_q15Object *self;
//printf("New called\n");
self = (ml_arm_fir_sparse_instance_q15Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_sparse_instance_q15));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
self->instance->pTapDelay = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_sparse_instance_q15_init(ml_arm_fir_sparse_instance_q15Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
PyObject *pTapDelay=NULL;
char *kwlist[] = {
"numTaps","stateIndex","maxDelay","pTapDelay",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhhO", kwlist,&self->instance->numTaps
,&self->instance->stateIndex
,&self->instance->maxDelay
,&pTapDelay
))
{
INITARRAYFIELD(pTapDelay,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_fir_sparse_instance_q15,numTaps,"h");
GETFIELD(arm_fir_sparse_instance_q15,stateIndex,"h");
GETFIELD(arm_fir_sparse_instance_q15,maxDelay,"h");
static PyMethodDef arm_fir_sparse_instance_q15_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_sparse_instance_q15_numTaps,METH_NOARGS,"numTaps"},
{"stateIndex", (PyCFunction) Method_arm_fir_sparse_instance_q15_stateIndex,METH_NOARGS,"stateIndex"},
{"maxDelay", (PyCFunction) Method_arm_fir_sparse_instance_q15_maxDelay,METH_NOARGS,"maxDelay"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_sparse_instance_q15,arm_fir_sparse_instance_q15_new,arm_fir_sparse_instance_q15_dealloc,arm_fir_sparse_instance_q15_init,arm_fir_sparse_instance_q15_methods);
typedef struct {
PyObject_HEAD
arm_fir_sparse_instance_q7 *instance;
} ml_arm_fir_sparse_instance_q7Object;
static void
arm_fir_sparse_instance_q7_dealloc(ml_arm_fir_sparse_instance_q7Object* self)
{
//printf("Dealloc called\n");
if (self->instance)
{
if (self->instance->pState)
{
PyMem_Free(self->instance->pState);
}
if (self->instance->pCoeffs)
{
PyMem_Free(self->instance->pCoeffs);
}
if (self->instance->pTapDelay)
{
PyMem_Free(self->instance->pTapDelay);
}
PyMem_Free(self->instance);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
arm_fir_sparse_instance_q7_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ml_arm_fir_sparse_instance_q7Object *self;
//printf("New called\n");
self = (ml_arm_fir_sparse_instance_q7Object *)type->tp_alloc(type, 0);
//printf("alloc called\n");
if (self != NULL) {
self->instance = PyMem_Malloc(sizeof(arm_fir_sparse_instance_q7));
self->instance->pState = NULL;
self->instance->pCoeffs = NULL;
self->instance->pTapDelay = NULL;
}
return (PyObject *)self;
}
static int
arm_fir_sparse_instance_q7_init(ml_arm_fir_sparse_instance_q7Object *self, PyObject *args, PyObject *kwds)
{
PyObject *pState=NULL;
PyObject *pCoeffs=NULL;
PyObject *pTapDelay=NULL;
char *kwlist[] = {
"numTaps","stateIndex","maxDelay","pTapDelay",NULL
};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|hhhO", kwlist,&self->instance->numTaps
,&self->instance->stateIndex
,&self->instance->maxDelay
,&pTapDelay
))
{
INITARRAYFIELD(pTapDelay,NPY_INT32,int32_t,int32_t);
}
return 0;
}
GETFIELD(arm_fir_sparse_instance_q7,numTaps,"h");
GETFIELD(arm_fir_sparse_instance_q7,stateIndex,"h");
GETFIELD(arm_fir_sparse_instance_q7,maxDelay,"h");
static PyMethodDef arm_fir_sparse_instance_q7_methods[] = {
{"numTaps", (PyCFunction) Method_arm_fir_sparse_instance_q7_numTaps,METH_NOARGS,"numTaps"},
{"stateIndex", (PyCFunction) Method_arm_fir_sparse_instance_q7_stateIndex,METH_NOARGS,"stateIndex"},
{"maxDelay", (PyCFunction) Method_arm_fir_sparse_instance_q7_maxDelay,METH_NOARGS,"maxDelay"},
{NULL} /* Sentinel */
};
MLTYPE(arm_fir_sparse_instance_q7,arm_fir_sparse_instance_q7_new,arm_fir_sparse_instance_q7_dealloc,arm_fir_sparse_instance_q7_init,arm_fir_sparse_instance_q7_methods);
void typeRegistration(PyObject *module) {
ADDTYPE(arm_fir_instance_q7);
ADDTYPE(arm_fir_instance_q15);
ADDTYPE(arm_fir_instance_q31);
ADDTYPE(arm_fir_instance_f32);
ADDTYPE(arm_biquad_casd_df1_inst_q15);
ADDTYPE(arm_biquad_casd_df1_inst_q31);
ADDTYPE(arm_biquad_casd_df1_inst_f32);
ADDTYPE(arm_matrix_instance_f32);
ADDTYPE(arm_matrix_instance_f64);
ADDTYPE(arm_matrix_instance_q15);
ADDTYPE(arm_matrix_instance_q31);
ADDTYPE(arm_pid_instance_q15);
ADDTYPE(arm_pid_instance_q31);
ADDTYPE(arm_pid_instance_f32);
ADDTYPE(arm_linear_interp_instance_f32);
ADDTYPE(arm_bilinear_interp_instance_f32);
ADDTYPE(arm_bilinear_interp_instance_q31);
ADDTYPE(arm_bilinear_interp_instance_q15);
ADDTYPE(arm_bilinear_interp_instance_q7);
ADDTYPE(arm_cfft_radix2_instance_q15);
ADDTYPE(arm_cfft_radix4_instance_q15);
ADDTYPE(arm_cfft_radix2_instance_q31);
ADDTYPE(arm_cfft_radix4_instance_q31);
ADDTYPE(arm_cfft_radix2_instance_f32);
ADDTYPE(arm_cfft_radix4_instance_f32);
ADDTYPE(arm_cfft_instance_q15);
ADDTYPE(arm_cfft_instance_q31);
ADDTYPE(arm_cfft_instance_f32);
ADDTYPE(arm_rfft_instance_q15);
ADDTYPE(arm_rfft_instance_q31);
ADDTYPE(arm_rfft_instance_f32);
ADDTYPE(arm_rfft_fast_instance_f32);
ADDTYPE(arm_dct4_instance_f32);
ADDTYPE(arm_dct4_instance_q31);
ADDTYPE(arm_dct4_instance_q15);
ADDTYPE(arm_fir_decimate_instance_q15);
ADDTYPE(arm_fir_decimate_instance_q31);
ADDTYPE(arm_fir_decimate_instance_f32);
ADDTYPE(arm_fir_interpolate_instance_q15);
ADDTYPE(arm_fir_interpolate_instance_q31);
ADDTYPE(arm_fir_interpolate_instance_f32);
ADDTYPE(arm_biquad_cas_df1_32x64_ins_q31);
ADDTYPE(arm_biquad_cascade_df2T_instance_f32);
ADDTYPE(arm_biquad_cascade_stereo_df2T_instance_f32);
ADDTYPE(arm_biquad_cascade_df2T_instance_f64);
ADDTYPE(arm_fir_lattice_instance_q15);
ADDTYPE(arm_fir_lattice_instance_q31);
ADDTYPE(arm_fir_lattice_instance_f32);
ADDTYPE(arm_iir_lattice_instance_q15);
ADDTYPE(arm_iir_lattice_instance_q31);
ADDTYPE(arm_iir_lattice_instance_f32);
ADDTYPE(arm_lms_instance_f32);
ADDTYPE(arm_lms_instance_q15);
ADDTYPE(arm_lms_instance_q31);
ADDTYPE(arm_lms_norm_instance_f32);
ADDTYPE(arm_lms_norm_instance_q31);
ADDTYPE(arm_lms_norm_instance_q15);
ADDTYPE(arm_fir_sparse_instance_f32);
ADDTYPE(arm_fir_sparse_instance_q31);
ADDTYPE(arm_fir_sparse_instance_q15);
ADDTYPE(arm_fir_sparse_instance_q7);
}
static PyObject *
cmsis_arm_recip_q31(PyObject *obj, PyObject *args)
{
q31_t in; // input
q31_t *dst=NULL; // output
PyObject *pRecipTable=NULL; // input
q31_t *pRecipTable_converted=NULL; // input
if (PyArg_ParseTuple(args,"iO",&in,&pRecipTable))
{
GETARGUMENT(pRecipTable,NPY_INT32,int32_t,int32_t);
dst=PyMem_Malloc(sizeof(q31_t)*1);
uint32_t returnValue = arm_recip_q31(in,dst,pRecipTable_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* dstOBJ=Py_BuildValue("i",*dst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,dstOBJ);
Py_DECREF(theReturnOBJ);
Py_DECREF(dstOBJ);
FREEARGUMENT(pRecipTable_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_recip_q15(PyObject *obj, PyObject *args)
{
q15_t in; // input
q15_t *dst=NULL; // output
PyObject *pRecipTable=NULL; // input
q15_t *pRecipTable_converted=NULL; // input
if (PyArg_ParseTuple(args,"hO",&in,&pRecipTable))
{
GETARGUMENT(pRecipTable,NPY_INT16,int16_t,int16_t);
dst=PyMem_Malloc(sizeof(q15_t)*1);
uint32_t returnValue = arm_recip_q15(in,dst,pRecipTable_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* dstOBJ=Py_BuildValue("h",*dst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,dstOBJ);
Py_DECREF(theReturnOBJ);
Py_DECREF(dstOBJ);
FREEARGUMENT(pRecipTable_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_q7(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_instance_q7Object *selfS = (ml_arm_fir_instance_q7Object *)S;
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_fir_q7(selfS->instance,pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_init_q7(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q7_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q7_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_instance_q7Object *selfS = (ml_arm_fir_instance_q7Object *)S;
GETARGUMENT(pCoeffs,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pState,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_init_q7(selfS->instance,numTaps,pCoeffs_converted,pState_converted,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_instance_q15Object *selfS = (ml_arm_fir_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_fir_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_instance_q15Object *selfS = (ml_arm_fir_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_fir_fast_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_instance_q15Object *selfS = (ml_arm_fir_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_init_q15(selfS->instance,numTaps,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_instance_q31Object *selfS = (ml_arm_fir_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_fir_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_instance_q31Object *selfS = (ml_arm_fir_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_fir_fast_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_instance_q31Object *selfS = (ml_arm_fir_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_init_q31(selfS->instance,numTaps,pCoeffs_converted,pState_converted,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_instance_f32Object *selfS = (ml_arm_fir_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_fir_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_instance_f32Object *selfS = (ml_arm_fir_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_init_f32(selfS->instance,numTaps,pCoeffs_converted,pState_converted,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_casd_df1_inst_q15Object *selfS = (ml_arm_biquad_casd_df1_inst_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_biquad_cascade_df1_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
int32_t postShift; // input
if (PyArg_ParseTuple(args,"OiOOi",&S,&numStages,&pCoeffs,&pState,&postShift))
{
ml_arm_biquad_casd_df1_inst_q15Object *selfS = (ml_arm_biquad_casd_df1_inst_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
arm_biquad_cascade_df1_init_q15(selfS->instance,(uint8_t)numStages,pCoeffs_converted,pState_converted,(int8_t)postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_casd_df1_inst_q15Object *selfS = (ml_arm_biquad_casd_df1_inst_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_biquad_cascade_df1_fast_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_casd_df1_inst_q31Object *selfS = (ml_arm_biquad_casd_df1_inst_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_biquad_cascade_df1_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_casd_df1_inst_q31Object *selfS = (ml_arm_biquad_casd_df1_inst_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_biquad_cascade_df1_fast_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
int32_t postShift; // input
if (PyArg_ParseTuple(args,"OiOOi",&S,&numStages,&pCoeffs,&pState,&postShift))
{
ml_arm_biquad_casd_df1_inst_q31Object *selfS = (ml_arm_biquad_casd_df1_inst_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
arm_biquad_cascade_df1_init_q31(selfS->instance,(uint8_t)numStages,pCoeffs_converted,pState_converted,(int8_t)postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_casd_df1_inst_f32Object *selfS = (ml_arm_biquad_casd_df1_inst_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_biquad_cascade_df1_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df1_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_biquad_casd_df1_inst_f32Object *selfS = (ml_arm_biquad_casd_df1_inst_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
arm_biquad_cascade_df1_init_f32(selfS->instance,(uint8_t)numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_add_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_f32 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_f32 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_f32 *pSrcA_converted = f32MatrixFromNumpy(pSrcA);
arm_matrix_instance_f32 *pSrcB_converted = f32MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_f32 *pDst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_add_f32(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromf32Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_add_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q15 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q15 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q15 *pSrcA_converted = q15MatrixFromNumpy(pSrcA);
arm_matrix_instance_q15 *pSrcB_converted = q15MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_add_q15(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_add_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q31 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q31 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q31 *pSrcA_converted = q31MatrixFromNumpy(pSrcA);
arm_matrix_instance_q31 *pSrcB_converted = q31MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_add_q31(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_cmplx_mult_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_f32 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_f32 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_f32 *pSrcA_converted = f32MatrixFromNumpy(pSrcA);
arm_matrix_instance_f32 *pSrcB_converted = f32MatrixFromNumpy(pSrcB);
pSrcA_converted->numCols = pSrcA_converted->numCols / 2;
pSrcB_converted->numCols = pSrcB_converted->numCols / 2;
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols * 2;
arm_matrix_instance_f32 *pDst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_cmplx_mult_f32(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromf32Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_cmplx_mult_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q15 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q15 *pSrcB_converted=NULL; // input
PyObject *pScratch=NULL; // input
q15_t *pScratch_converted=NULL; // input
if (PyArg_ParseTuple(args,"OOO",&pSrcA,&pSrcB,&pScratch))
{
arm_matrix_instance_q15 *pSrcA_converted = q15MatrixFromNumpy(pSrcA);
arm_matrix_instance_q15 *pSrcB_converted = q15MatrixFromNumpy(pSrcB);
GETARGUMENT(pScratch,NPY_INT16,int16_t,int16_t);
pSrcA_converted->numCols = pSrcA_converted->numCols / 2;
pSrcB_converted->numCols = pSrcB_converted->numCols / 2;
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols * 2;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_cmplx_mult_q15(pSrcA_converted,pSrcB_converted,pDst_converted,pScratch_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_cmplx_mult_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q31 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q31 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q31 *pSrcA_converted = q31MatrixFromNumpy(pSrcA);
arm_matrix_instance_q31 *pSrcB_converted = q31MatrixFromNumpy(pSrcB);
pSrcA_converted->numCols = pSrcA_converted->numCols / 2;
pSrcB_converted->numCols = pSrcB_converted->numCols / 2;
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols * 2;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_cmplx_mult_q31(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_trans_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
arm_matrix_instance_f32 *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
arm_matrix_instance_f32 *pSrc_converted = f32MatrixFromNumpy(pSrc);
uint32_t row = pSrc_converted->numCols ;
uint32_t column = pSrc_converted->numRows ;
arm_matrix_instance_f32 *pDst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_trans_f32(pSrc_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromf32Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_trans_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
arm_matrix_instance_q15 *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
arm_matrix_instance_q15 *pSrc_converted = q15MatrixFromNumpy(pSrc);
uint32_t row = pSrc_converted->numCols ;
uint32_t column = pSrc_converted->numRows ;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_trans_q15(pSrc_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_trans_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
arm_matrix_instance_q31 *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
arm_matrix_instance_q31 *pSrc_converted = q31MatrixFromNumpy(pSrc);
uint32_t row = pSrc_converted->numCols ;
uint32_t column = pSrc_converted->numRows ;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_trans_q31(pSrc_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_mult_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_f32 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_f32 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_f32 *pSrcA_converted = f32MatrixFromNumpy(pSrcA);
arm_matrix_instance_f32 *pSrcB_converted = f32MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_f32 *pDst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_mult_f32(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromf32Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_mult_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q15 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q15 *pSrcB_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OOO",&pSrcA,&pSrcB,&pState))
{
arm_matrix_instance_q15 *pSrcA_converted = q15MatrixFromNumpy(pSrcA);
arm_matrix_instance_q15 *pSrcB_converted = q15MatrixFromNumpy(pSrcB);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_mult_q15(pSrcA_converted,pSrcB_converted,pDst_converted,pState_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pState_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_mult_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q15 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q15 *pSrcB_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OOO",&pSrcA,&pSrcB,&pState))
{
arm_matrix_instance_q15 *pSrcA_converted = q15MatrixFromNumpy(pSrcA);
arm_matrix_instance_q15 *pSrcB_converted = q15MatrixFromNumpy(pSrcB);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_mult_fast_q15(pSrcA_converted,pSrcB_converted,pDst_converted,pState_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pState_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_mult_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q31 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q31 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q31 *pSrcA_converted = q31MatrixFromNumpy(pSrcA);
arm_matrix_instance_q31 *pSrcB_converted = q31MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_mult_q31(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_mult_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q31 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q31 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q31 *pSrcA_converted = q31MatrixFromNumpy(pSrcA);
arm_matrix_instance_q31 *pSrcB_converted = q31MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_mult_fast_q31(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_sub_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_f32 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_f32 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_f32 *pSrcA_converted = f32MatrixFromNumpy(pSrcA);
arm_matrix_instance_f32 *pSrcB_converted = f32MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_f32 *pDst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_sub_f32(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromf32Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_sub_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q15 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q15 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q15 *pSrcA_converted = q15MatrixFromNumpy(pSrcA);
arm_matrix_instance_q15 *pSrcB_converted = q15MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_sub_q15(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_sub_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
arm_matrix_instance_q31 *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
arm_matrix_instance_q31 *pSrcB_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
arm_matrix_instance_q31 *pSrcA_converted = q31MatrixFromNumpy(pSrcA);
arm_matrix_instance_q31 *pSrcB_converted = q31MatrixFromNumpy(pSrcB);
uint32_t row = pSrcA_converted->numRows ;
uint32_t column = pSrcB_converted->numCols ;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_sub_q31(pSrcA_converted,pSrcB_converted,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_scale_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
arm_matrix_instance_f32 *pSrc_converted=NULL; // input
float32_t scale; // input
if (PyArg_ParseTuple(args,"Of",&pSrc,&scale))
{
arm_matrix_instance_f32 *pSrc_converted = f32MatrixFromNumpy(pSrc);
uint32_t row = pSrc_converted->numRows ;
uint32_t column = pSrc_converted->numCols ;
arm_matrix_instance_f32 *pDst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_scale_f32(pSrc_converted,scale,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromf32Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_scale_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
arm_matrix_instance_q15 *pSrc_converted=NULL; // input
q15_t scaleFract; // input
int32_t shift; // input
if (PyArg_ParseTuple(args,"Ohi",&pSrc,&scaleFract,&shift))
{
arm_matrix_instance_q15 *pSrc_converted = q15MatrixFromNumpy(pSrc);
uint32_t row = pSrc_converted->numRows ;
uint32_t column = pSrc_converted->numCols ;
arm_matrix_instance_q15 *pDst_converted = createq15Matrix(row,column);
arm_status returnValue = arm_mat_scale_q15(pSrc_converted,scaleFract,shift,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq15Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_scale_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
arm_matrix_instance_q31 *pSrc_converted=NULL; // input
q31_t scaleFract; // input
int32_t shift; // input
if (PyArg_ParseTuple(args,"Oii",&pSrc,&scaleFract,&shift))
{
arm_matrix_instance_q31 *pSrc_converted = q31MatrixFromNumpy(pSrc);
uint32_t row = pSrc_converted->numRows ;
uint32_t column = pSrc_converted->numCols ;
arm_matrix_instance_q31 *pDst_converted = createq31Matrix(row,column);
arm_status returnValue = arm_mat_scale_q31(pSrc_converted,scaleFract,shift,pDst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pDstOBJ=NumpyArrayFromq31Matrix(pDst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
int32_t resetStateFlag; // input
if (PyArg_ParseTuple(args,"Oi",&S,&resetStateFlag))
{
ml_arm_pid_instance_f32Object *selfS = (ml_arm_pid_instance_f32Object *)S;
arm_pid_init_f32(selfS->instance,resetStateFlag);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_reset_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_pid_instance_f32Object *selfS = (ml_arm_pid_instance_f32Object *)S;
arm_pid_reset_f32(selfS->instance);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
int32_t resetStateFlag; // input
if (PyArg_ParseTuple(args,"Oi",&S,&resetStateFlag))
{
ml_arm_pid_instance_q31Object *selfS = (ml_arm_pid_instance_q31Object *)S;
arm_pid_init_q31(selfS->instance,resetStateFlag);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_reset_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_pid_instance_q31Object *selfS = (ml_arm_pid_instance_q31Object *)S;
arm_pid_reset_q31(selfS->instance);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
int32_t resetStateFlag; // input
if (PyArg_ParseTuple(args,"Oi",&S,&resetStateFlag))
{
ml_arm_pid_instance_q15Object *selfS = (ml_arm_pid_instance_q15Object *)S;
arm_pid_init_q15(selfS->instance,resetStateFlag);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_reset_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_pid_instance_q15Object *selfS = (ml_arm_pid_instance_q15Object *)S;
arm_pid_reset_q15(selfS->instance);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_mult_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_mult_q7(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mult_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_mult_q15(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mult_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_mult_q31(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mult_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_mult_f32(pSrcA_converted,pSrcB_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix2_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Ohii",&S,&fftLen,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_radix2_instance_q15Object *selfS = (ml_arm_cfft_radix2_instance_q15Object *)S;
arm_status returnValue = arm_cfft_radix2_init_q15(selfS->instance,fftLen,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix2_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_cfft_radix2_instance_q15Object *selfS = (ml_arm_cfft_radix2_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
arm_cfft_radix2_q15(selfS->instance,pSrc_converted);
FREEARGUMENT(pSrc_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix4_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Ohii",&S,&fftLen,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_radix4_instance_q15Object *selfS = (ml_arm_cfft_radix4_instance_q15Object *)S;
arm_status returnValue = arm_cfft_radix4_init_q15(selfS->instance,fftLen,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix4_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_cfft_radix4_instance_q15Object *selfS = (ml_arm_cfft_radix4_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
arm_cfft_radix4_q15(selfS->instance,pSrc_converted);
FREEARGUMENT(pSrc_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix2_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Ohii",&S,&fftLen,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_radix2_instance_q31Object *selfS = (ml_arm_cfft_radix2_instance_q31Object *)S;
arm_status returnValue = arm_cfft_radix2_init_q31(selfS->instance,fftLen,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix2_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_cfft_radix2_instance_q31Object *selfS = (ml_arm_cfft_radix2_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
arm_cfft_radix2_q31(selfS->instance,pSrc_converted);
FREEARGUMENT(pSrc_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix4_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_cfft_radix4_instance_q31Object *selfS = (ml_arm_cfft_radix4_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
arm_cfft_radix4_q31(selfS->instance,pSrc_converted);
FREEARGUMENT(pSrc_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix4_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Ohii",&S,&fftLen,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_radix4_instance_q31Object *selfS = (ml_arm_cfft_radix4_instance_q31Object *)S;
arm_status returnValue = arm_cfft_radix4_init_q31(selfS->instance,fftLen,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix2_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Ohii",&S,&fftLen,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_radix2_instance_f32Object *selfS = (ml_arm_cfft_radix2_instance_f32Object *)S;
arm_status returnValue = arm_cfft_radix2_init_f32(selfS->instance,fftLen,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix2_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_cfft_radix2_instance_f32Object *selfS = (ml_arm_cfft_radix2_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
arm_cfft_radix2_f32(selfS->instance,pSrc_converted);
FREEARGUMENT(pSrc_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix4_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Ohii",&S,&fftLen,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_radix4_instance_f32Object *selfS = (ml_arm_cfft_radix4_instance_f32Object *)S;
arm_status returnValue = arm_cfft_radix4_init_f32(selfS->instance,fftLen,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_radix4_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_cfft_radix4_instance_f32Object *selfS = (ml_arm_cfft_radix4_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
arm_cfft_radix4_f32(selfS->instance,pSrc_converted);
FREEARGUMENT(pSrc_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *p1=NULL; // input
q15_t *p1_converted=NULL; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"OOii",&S,&p1,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_instance_q15Object *selfS = (ml_arm_cfft_instance_q15Object *)S;
GETARGUMENT(p1,NPY_INT16,int16_t,int16_t);
arm_cfft_q15(selfS->instance,p1_converted,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
INT16ARRAY1(p1OBJ,2*selfS->instance->fftLen,p1_converted);
PyObject *pythonResult = Py_BuildValue("O",p1OBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *p1=NULL; // input
q31_t *p1_converted=NULL; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"OOii",&S,&p1,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_instance_q31Object *selfS = (ml_arm_cfft_instance_q31Object *)S;
GETARGUMENT(p1,NPY_INT32,int32_t,int32_t);
arm_cfft_q31(selfS->instance,p1_converted,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
INT32ARRAY1(p1OBJ,2*selfS->instance->fftLen,p1_converted);
PyObject *pythonResult = Py_BuildValue("O",p1OBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *p1=NULL; // input
float32_t *p1_converted=NULL; // input
uint32_t ifftFlag; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"OOii",&S,&p1,&ifftFlag,&bitReverseFlag))
{
ml_arm_cfft_instance_f32Object *selfS = (ml_arm_cfft_instance_f32Object *)S;
GETARGUMENT(p1,NPY_DOUBLE,double,float32_t);
arm_cfft_f32(selfS->instance,p1_converted,(uint8_t)ifftFlag,(uint8_t)bitReverseFlag);
FLOATARRAY1(p1OBJ,2*selfS->instance->fftLen,p1_converted);
PyObject *pythonResult = Py_BuildValue("O",p1OBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t fftLenReal; // input
uint32_t ifftFlagR; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Oiii",&S,&fftLenReal,&ifftFlagR,&bitReverseFlag))
{
ml_arm_rfft_instance_q15Object *selfS = (ml_arm_rfft_instance_q15Object *)S;
arm_status returnValue = arm_rfft_init_q15(selfS->instance,fftLenReal,ifftFlagR,bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_rfft_instance_q15Object *selfS = (ml_arm_rfft_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
pDst=PyMem_Malloc(sizeof(q15_t)*2*selfS->instance->fftLenReal);
arm_rfft_q15(selfS->instance,pSrc_converted,pDst);
INT16ARRAY1(pDstOBJ,2*selfS->instance->fftLenReal,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t fftLenReal; // input
uint32_t ifftFlagR; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"Oiii",&S,&fftLenReal,&ifftFlagR,&bitReverseFlag))
{
ml_arm_rfft_instance_q31Object *selfS = (ml_arm_rfft_instance_q31Object *)S;
arm_status returnValue = arm_rfft_init_q31(selfS->instance,fftLenReal,ifftFlagR,bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_rfft_instance_q31Object *selfS = (ml_arm_rfft_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
pDst=PyMem_Malloc(sizeof(q31_t)*2*selfS->instance->fftLenReal);
arm_rfft_q31(selfS->instance,pSrc_converted,pDst);
INT32ARRAY1(pDstOBJ,2*selfS->instance->fftLenReal,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *S_CFFT=NULL; // input
uint32_t fftLenReal; // input
uint32_t ifftFlagR; // input
uint32_t bitReverseFlag; // input
if (PyArg_ParseTuple(args,"OOiii",&S,&S_CFFT,&fftLenReal,&ifftFlagR,&bitReverseFlag))
{
ml_arm_rfft_instance_f32Object *selfS = (ml_arm_rfft_instance_f32Object *)S;
ml_arm_cfft_radix4_instance_f32Object *selfS_CFFT = (ml_arm_cfft_radix4_instance_f32Object *)S_CFFT;
arm_status returnValue = arm_rfft_init_f32(selfS->instance,selfS_CFFT->instance,fftLenReal,ifftFlagR,bitReverseFlag);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_rfft_instance_f32Object *selfS = (ml_arm_rfft_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
pDst=PyMem_Malloc(sizeof(float32_t)*2*selfS->instance->fftLenReal);
arm_rfft_f32(selfS->instance,pSrc_converted,pDst);
FLOATARRAY1(pDstOBJ,2*selfS->instance->fftLenReal,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
if (PyArg_ParseTuple(args,"Oh",&S,&fftLen))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_fast_init_f32(selfS->instance,fftLen);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_32_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_32_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_64_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_64_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_128_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_128_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_256_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_256_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_512_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_512_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_1024_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_1024_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_2048_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_2048_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_4096_fast_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
if (PyArg_ParseTuple(args,"O",&S))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
arm_status returnValue = arm_rfft_4096_fast_init_f32(selfS->instance);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rfft_fast_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *p=NULL; // input
float32_t *p_converted=NULL; // input
float32_t *pOut=NULL; // output
uint32_t ifftFlag; // input
if (PyArg_ParseTuple(args,"OOi",&S,&p,&ifftFlag))
{
ml_arm_rfft_fast_instance_f32Object *selfS = (ml_arm_rfft_fast_instance_f32Object *)S;
GETARGUMENT(p,NPY_DOUBLE,double,float32_t);
pOut=PyMem_Malloc(sizeof(float32_t)*2*selfS->instance->fftLenRFFT);
arm_rfft_fast_f32(selfS->instance,p_converted,pOut,(uint8_t)ifftFlag);
FLOATARRAY1(pOutOBJ,2*selfS->instance->fftLenRFFT,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(p_converted);
Py_DECREF(pOutOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dct4_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *S_RFFT=NULL; // input
PyObject *S_CFFT=NULL; // input
uint16_t N; // input
uint16_t Nby2; // input
float32_t normalize; // input
if (PyArg_ParseTuple(args,"OOOhhf",&S,&S_RFFT,&S_CFFT,&N,&Nby2,&normalize))
{
ml_arm_dct4_instance_f32Object *selfS = (ml_arm_dct4_instance_f32Object *)S;
ml_arm_rfft_instance_f32Object *selfS_RFFT = (ml_arm_rfft_instance_f32Object *)S_RFFT;
ml_arm_cfft_radix4_instance_f32Object *selfS_CFFT = (ml_arm_cfft_radix4_instance_f32Object *)S_CFFT;
uint32_t outputLength = selfS->instance->N ;
arm_status returnValue = arm_dct4_init_f32(selfS->instance,selfS_RFFT->instance,selfS_CFFT->instance,N,Nby2,normalize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dct4_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
PyObject *pInlineBuffer=NULL; // input
float32_t *pInlineBuffer_converted=NULL; // input
if (PyArg_ParseTuple(args,"OOO",&S,&pState,&pInlineBuffer))
{
ml_arm_dct4_instance_f32Object *selfS = (ml_arm_dct4_instance_f32Object *)S;
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pInlineBuffer,NPY_DOUBLE,double,float32_t);
uint32_t outputLength = selfS->instance->N ;
arm_dct4_f32(selfS->instance,pState_converted,pInlineBuffer_converted);
FLOATARRAY1(pInlineBufferOBJ,outputLength,pInlineBuffer_converted);
PyObject *pythonResult = Py_BuildValue("O",pInlineBufferOBJ);
FREEARGUMENT(pState_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dct4_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *S_RFFT=NULL; // input
PyObject *S_CFFT=NULL; // input
uint16_t N; // input
uint16_t Nby2; // input
q31_t normalize; // input
if (PyArg_ParseTuple(args,"OOOhhi",&S,&S_RFFT,&S_CFFT,&N,&Nby2,&normalize))
{
ml_arm_dct4_instance_q31Object *selfS = (ml_arm_dct4_instance_q31Object *)S;
ml_arm_rfft_instance_q31Object *selfS_RFFT = (ml_arm_rfft_instance_q31Object *)S_RFFT;
ml_arm_cfft_radix4_instance_q31Object *selfS_CFFT = (ml_arm_cfft_radix4_instance_q31Object *)S_CFFT;
uint32_t outputLength = selfS->instance->N ;
arm_status returnValue = arm_dct4_init_q31(selfS->instance,selfS_RFFT->instance,selfS_CFFT->instance,N,Nby2,normalize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dct4_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
PyObject *pInlineBuffer=NULL; // input
q31_t *pInlineBuffer_converted=NULL; // input
if (PyArg_ParseTuple(args,"OOO",&S,&pState,&pInlineBuffer))
{
ml_arm_dct4_instance_q31Object *selfS = (ml_arm_dct4_instance_q31Object *)S;
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pInlineBuffer,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = selfS->instance->N ;
arm_dct4_q31(selfS->instance,pState_converted,pInlineBuffer_converted);
INT32ARRAY1(pInlineBufferOBJ,outputLength,pInlineBuffer_converted);
PyObject *pythonResult = Py_BuildValue("O",pInlineBufferOBJ);
FREEARGUMENT(pState_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dct4_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *S_RFFT=NULL; // input
PyObject *S_CFFT=NULL; // input
uint16_t N; // input
uint16_t Nby2; // input
q15_t normalize; // input
if (PyArg_ParseTuple(args,"OOOhhh",&S,&S_RFFT,&S_CFFT,&N,&Nby2,&normalize))
{
ml_arm_dct4_instance_q15Object *selfS = (ml_arm_dct4_instance_q15Object *)S;
ml_arm_rfft_instance_q15Object *selfS_RFFT = (ml_arm_rfft_instance_q15Object *)S_RFFT;
ml_arm_cfft_radix4_instance_q15Object *selfS_CFFT = (ml_arm_cfft_radix4_instance_q15Object *)S_CFFT;
uint32_t outputLength = selfS->instance->N ;
arm_status returnValue = arm_dct4_init_q15(selfS->instance,selfS_RFFT->instance,selfS_CFFT->instance,N,Nby2,normalize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dct4_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
PyObject *pInlineBuffer=NULL; // input
q15_t *pInlineBuffer_converted=NULL; // input
if (PyArg_ParseTuple(args,"OOO",&S,&pState,&pInlineBuffer))
{
ml_arm_dct4_instance_q15Object *selfS = (ml_arm_dct4_instance_q15Object *)S;
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pInlineBuffer,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = selfS->instance->N ;
arm_dct4_q15(selfS->instance,pState_converted,pInlineBuffer_converted);
INT16ARRAY1(pInlineBufferOBJ,outputLength,pInlineBuffer_converted);
PyObject *pythonResult = Py_BuildValue("O",pInlineBufferOBJ);
FREEARGUMENT(pState_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_add_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_add_f32(pSrcA_converted,pSrcB_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_add_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_add_q7(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_add_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_add_q15(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_add_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_add_q31(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sub_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_sub_f32(pSrcA_converted,pSrcB_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sub_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_sub_q7(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sub_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_sub_q15(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sub_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrcA ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_sub_q31(pSrcA_converted,pSrcB_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_scale_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t scale; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Of",&pSrc,&scale))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_scale_f32(pSrc_converted,scale,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_scale_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
int32_t scaleFract; // input
int32_t shift; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oii",&pSrc,&scaleFract,&shift))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_scale_q7(pSrc_converted,(q7_t)scaleFract,(int8_t)shift,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_scale_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t scaleFract; // input
int32_t shift; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Ohi",&pSrc,&scaleFract,&shift))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_scale_q15(pSrc_converted,scaleFract,(int8_t)shift,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_scale_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t scaleFract; // input
int32_t shift; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oii",&pSrc,&scaleFract,&shift))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_scale_q31(pSrc_converted,scaleFract,(int8_t)shift,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_abs_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_abs_q7(pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_abs_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_abs_f32(pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_abs_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_abs_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_abs_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_abs_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dot_prod_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
uint32_t blockSize; // input
float32_t *result=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrcA ;
result=PyMem_Malloc(sizeof(float32_t)*1);
arm_dot_prod_f32(pSrcA_converted,pSrcB_converted,blockSize,result);
PyObject* resultOBJ=Py_BuildValue("f",*result);
PyObject *pythonResult = Py_BuildValue("O",resultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(resultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dot_prod_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t blockSize; // input
q31_t *result=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrcA ;
result=PyMem_Malloc(sizeof(q31_t)*1);
arm_dot_prod_q7(pSrcA_converted,pSrcB_converted,blockSize,result);
PyObject* resultOBJ=Py_BuildValue("i",*result);
PyObject *pythonResult = Py_BuildValue("O",resultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(resultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dot_prod_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t blockSize; // input
q63_t *result=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrcA ;
result=PyMem_Malloc(sizeof(q63_t)*1);
arm_dot_prod_q15(pSrcA_converted,pSrcB_converted,blockSize,result);
PyObject* resultOBJ=Py_BuildValue("L",*result);
PyObject *pythonResult = Py_BuildValue("O",resultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(resultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_dot_prod_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t blockSize; // input
q63_t *result=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrcA ;
result=PyMem_Malloc(sizeof(q63_t)*1);
arm_dot_prod_q31(pSrcA_converted,pSrcB_converted,blockSize,result);
PyObject* resultOBJ=Py_BuildValue("L",*result);
PyObject *pythonResult = Py_BuildValue("O",resultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(resultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_shift_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
int32_t shiftBits; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oi",&pSrc,&shiftBits))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_shift_q7(pSrc_converted,(int8_t)shiftBits,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_shift_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
int32_t shiftBits; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oi",&pSrc,&shiftBits))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_shift_q15(pSrc_converted,(int8_t)shiftBits,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_shift_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
int32_t shiftBits; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oi",&pSrc,&shiftBits))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_shift_q31(pSrc_converted,(int8_t)shiftBits,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_offset_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t offset; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Of",&pSrc,&offset))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_offset_f32(pSrc_converted,offset,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_offset_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
int32_t offset; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oi",&pSrc,&offset))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_offset_q7(pSrc_converted,(q7_t)offset,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_offset_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t offset; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oh",&pSrc,&offset))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_offset_q15(pSrc_converted,offset,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_offset_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t offset; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"Oi",&pSrc,&offset))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_offset_q31(pSrc_converted,offset,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_negate_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_negate_f32(pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_negate_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_negate_q7(pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_negate_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_negate_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_negate_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_negate_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_copy_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_copy_f32(pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_copy_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_copy_q7(pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_copy_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_copy_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_copy_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_copy_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
float32_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(float32_t)*outputLength);
arm_conv_f32(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
FLOATARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_opt_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_conv_opt_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,pScratch1_converted,pScratch2_converted);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_conv_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_conv_fast_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_fast_opt_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_conv_fast_opt_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,pScratch1_converted,pScratch2_converted);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q31_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q31_t)*outputLength);
arm_conv_q31(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT32ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q31_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q31_t)*outputLength);
arm_conv_fast_q31(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT32ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_opt_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q7_t *pDst=NULL; // output
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q7_t)*outputLength);
arm_conv_opt_q7(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,pScratch1_converted,pScratch2_converted);
INT8ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q7_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q7_t)*outputLength);
arm_conv_q7(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT8ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
float32_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
if (PyArg_ParseTuple(args,"OiOiii",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(float32_t)*outputLength);
arm_status returnValue = arm_conv_partial_f32(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
FLOATARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_opt_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiiiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_status returnValue = arm_conv_partial_opt_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints,pScratch1_converted,pScratch2_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
if (PyArg_ParseTuple(args,"OiOiii",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_status returnValue = arm_conv_partial_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
if (PyArg_ParseTuple(args,"OiOiii",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_status returnValue = arm_conv_partial_fast_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_fast_opt_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiiiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_status returnValue = arm_conv_partial_fast_opt_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints,pScratch1_converted,pScratch2_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q31_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
if (PyArg_ParseTuple(args,"OiOiii",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q31_t)*outputLength);
arm_status returnValue = arm_conv_partial_q31(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT32ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q31_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
if (PyArg_ParseTuple(args,"OiOiii",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q31_t)*outputLength);
arm_status returnValue = arm_conv_partial_fast_q31(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT32ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_opt_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q7_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiiiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q7_t)*outputLength);
arm_status returnValue = arm_conv_partial_opt_q7(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints,pScratch1_converted,pScratch2_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT8ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_conv_partial_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q7_t *pDst=NULL; // output
uint32_t firstIndex; // input
uint32_t numPoints; // input
if (PyArg_ParseTuple(args,"OiOiii",&pSrcA,&srcALen,&pSrcB,&srcBLen,&firstIndex,&numPoints))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
uint32_t outputLength = srcALen + srcBLen - 1 ;
pDst=PyMem_Malloc(sizeof(q7_t)*outputLength);
arm_status returnValue = arm_conv_partial_q7(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,firstIndex,numPoints);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
INT8ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pDstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_decimate_instance_f32Object *selfS = (ml_arm_fir_decimate_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_fir_decimate_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
uint32_t M; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhiOO",&S,&numTaps,&M,&pCoeffs,&pState))
{
ml_arm_fir_decimate_instance_f32Object *selfS = (ml_arm_fir_decimate_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_decimate_init_f32(selfS->instance,numTaps,(uint8_t)M,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_decimate_instance_q15Object *selfS = (ml_arm_fir_decimate_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_fir_decimate_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_decimate_instance_q15Object *selfS = (ml_arm_fir_decimate_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_fir_decimate_fast_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
uint32_t M; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhiOO",&S,&numTaps,&M,&pCoeffs,&pState))
{
ml_arm_fir_decimate_instance_q15Object *selfS = (ml_arm_fir_decimate_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_decimate_init_q15(selfS->instance,numTaps,(uint8_t)M,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_decimate_instance_q31Object *selfS = (ml_arm_fir_decimate_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_fir_decimate_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_decimate_instance_q31Object *selfS = (ml_arm_fir_decimate_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_fir_decimate_fast_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_decimate_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
uint32_t M; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhiOO",&S,&numTaps,&M,&pCoeffs,&pState))
{
ml_arm_fir_decimate_instance_q31Object *selfS = (ml_arm_fir_decimate_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_decimate_init_q31(selfS->instance,numTaps,(uint8_t)M,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_interpolate_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_interpolate_instance_q15Object *selfS = (ml_arm_fir_interpolate_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_fir_interpolate_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_interpolate_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t L; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OihOO",&S,&L,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_interpolate_instance_q15Object *selfS = (ml_arm_fir_interpolate_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_interpolate_init_q15(selfS->instance,(uint8_t)L,numTaps,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_interpolate_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_interpolate_instance_q31Object *selfS = (ml_arm_fir_interpolate_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_fir_interpolate_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_interpolate_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t L; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OihOO",&S,&L,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_interpolate_instance_q31Object *selfS = (ml_arm_fir_interpolate_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_interpolate_init_q31(selfS->instance,(uint8_t)L,numTaps,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_interpolate_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_interpolate_instance_f32Object *selfS = (ml_arm_fir_interpolate_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_fir_interpolate_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_interpolate_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t L; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OihOO",&S,&L,&numTaps,&pCoeffs,&pState))
{
ml_arm_fir_interpolate_instance_f32Object *selfS = (ml_arm_fir_interpolate_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_status returnValue = arm_fir_interpolate_init_f32(selfS->instance,(uint8_t)L,numTaps,pCoeffs_converted,pState_converted,blockSize);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cas_df1_32x64_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
arm_biquad_cas_df1_32x64_ins_q31 *S_converted=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_biquad_cas_df1_32x64_q31(S_converted,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cas_df1_32x64_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
arm_biquad_cas_df1_32x64_ins_q31 *S_converted=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q63_t *pState_converted=NULL; // input
uint32_t postShift; // input
if (PyArg_ParseTuple(args,"OiOOi",&S,&numStages,&pCoeffs,&pState,&postShift))
{
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT64,q63_t,q63_t);
arm_biquad_cas_df1_32x64_init_q31(S_converted,(uint8_t)numStages,pCoeffs_converted,pState_converted,(uint8_t)postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df2T_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_cascade_df2T_instance_f32Object *selfS = (ml_arm_biquad_cascade_df2T_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_biquad_cascade_df2T_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_stereo_df2T_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *selfS = (ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_biquad_cascade_stereo_df2T_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df2T_f64(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float64_t *pSrc_converted=NULL; // input
float64_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_biquad_cascade_df2T_instance_f64Object *selfS = (ml_arm_biquad_cascade_df2T_instance_f64Object *)S;
GETARGUMENT(pSrc,NPY_FLOAT64,float64_t,float64_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float64_t)*blockSize);
arm_biquad_cascade_df2T_f64(selfS->instance,pSrc_converted,pDst,blockSize);
FLOAT64ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df2T_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_biquad_cascade_df2T_instance_f32Object *selfS = (ml_arm_biquad_cascade_df2T_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
arm_biquad_cascade_df2T_init_f32(selfS->instance,(uint8_t)numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_stereo_df2T_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *selfS = (ml_arm_biquad_cascade_stereo_df2T_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
arm_biquad_cascade_stereo_df2T_init_f32(selfS->instance,(uint8_t)numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_biquad_cascade_df2T_init_f64(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint32_t numStages; // input
PyObject *pCoeffs=NULL; // input
float64_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float64_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_biquad_cascade_df2T_instance_f64Object *selfS = (ml_arm_biquad_cascade_df2T_instance_f64Object *)S;
GETARGUMENT(pCoeffs,NPY_FLOAT64,float64_t,float64_t);
GETARGUMENT(pState,NPY_FLOAT64,float64_t,float64_t);
arm_biquad_cascade_df2T_init_f64(selfS->instance,(uint8_t)numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_lattice_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numStages; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_fir_lattice_instance_q15Object *selfS = (ml_arm_fir_lattice_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
arm_fir_lattice_init_q15(selfS->instance,numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_lattice_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_lattice_instance_q15Object *selfS = (ml_arm_fir_lattice_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_fir_lattice_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_lattice_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numStages; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_fir_lattice_instance_q31Object *selfS = (ml_arm_fir_lattice_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
arm_fir_lattice_init_q31(selfS->instance,numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_lattice_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_lattice_instance_q31Object *selfS = (ml_arm_fir_lattice_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_fir_lattice_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_lattice_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numStages; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
if (PyArg_ParseTuple(args,"OhOO",&S,&numStages,&pCoeffs,&pState))
{
ml_arm_fir_lattice_instance_f32Object *selfS = (ml_arm_fir_lattice_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
arm_fir_lattice_init_f32(selfS->instance,numStages,pCoeffs_converted,pState_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_lattice_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_fir_lattice_instance_f32Object *selfS = (ml_arm_fir_lattice_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_fir_lattice_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_iir_lattice_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_iir_lattice_instance_f32Object *selfS = (ml_arm_iir_lattice_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_iir_lattice_f32(selfS->instance,pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_iir_lattice_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numStages; // input
PyObject *pkCoeffs=NULL; // input
float32_t *pkCoeffs_converted=NULL; // input
PyObject *pvCoeffs=NULL; // input
float32_t *pvCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOO",&S,&numStages,&pkCoeffs,&pvCoeffs,&pState))
{
ml_arm_iir_lattice_instance_f32Object *selfS = (ml_arm_iir_lattice_instance_f32Object *)S;
GETARGUMENT(pkCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pvCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepkCoeffs ;
arm_iir_lattice_init_f32(selfS->instance,numStages,pkCoeffs_converted,pvCoeffs_converted,pState_converted,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_iir_lattice_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_iir_lattice_instance_q31Object *selfS = (ml_arm_iir_lattice_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_iir_lattice_q31(selfS->instance,pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_iir_lattice_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numStages; // input
PyObject *pkCoeffs=NULL; // input
q31_t *pkCoeffs_converted=NULL; // input
PyObject *pvCoeffs=NULL; // input
q31_t *pvCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOO",&S,&numStages,&pkCoeffs,&pvCoeffs,&pState))
{
ml_arm_iir_lattice_instance_q31Object *selfS = (ml_arm_iir_lattice_instance_q31Object *)S;
GETARGUMENT(pkCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pvCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepkCoeffs ;
arm_iir_lattice_init_q31(selfS->instance,numStages,pkCoeffs_converted,pvCoeffs_converted,pState_converted,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_iir_lattice_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OO",&S,&pSrc))
{
ml_arm_iir_lattice_instance_q15Object *selfS = (ml_arm_iir_lattice_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_iir_lattice_q15(selfS->instance,pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_iir_lattice_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numStages; // input
PyObject *pkCoeffs=NULL; // input
q15_t *pkCoeffs_converted=NULL; // input
PyObject *pvCoeffs=NULL; // input
q15_t *pvCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOO",&S,&numStages,&pkCoeffs,&pvCoeffs,&pState))
{
ml_arm_iir_lattice_instance_q15Object *selfS = (ml_arm_iir_lattice_instance_q15Object *)S;
GETARGUMENT(pkCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pvCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepkCoeffs ;
arm_iir_lattice_init_q15(selfS->instance,numStages,pkCoeffs_converted,pvCoeffs_converted,pState_converted,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
if (PyArg_ParseTuple(args,"Oh",&S,&fftLen))
{
ml_arm_cfft_instance_f32Object *selfS = (ml_arm_cfft_instance_f32Object *)S;
arm_status returnValue = arm_cfft_init_f32(selfS->instance,fftLen);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
if (PyArg_ParseTuple(args,"Oh",&S,&fftLen))
{
ml_arm_cfft_instance_q31Object *selfS = (ml_arm_cfft_instance_q31Object *)S;
arm_status returnValue = arm_cfft_init_q31(selfS->instance,fftLen);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cfft_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t fftLen; // input
if (PyArg_ParseTuple(args,"Oh",&S,&fftLen))
{
ml_arm_cfft_instance_q15Object *selfS = (ml_arm_cfft_instance_q15Object *)S;
arm_status returnValue = arm_cfft_init_q15(selfS->instance,fftLen);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
PyObject *pRef=NULL; // input
float32_t *pRef_converted=NULL; // input
float32_t *pOut=NULL; // output
PyObject *pErr=NULL; // input
float32_t *pErr_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOOO",&S,&pSrc,&pRef,&pErr))
{
ml_arm_lms_instance_f32Object *selfS = (ml_arm_lms_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pRef,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pErr,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pOut=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_lms_f32(selfS->instance,pSrc_converted,pRef_converted,pOut,pErr_converted,blockSize);
FLOATARRAY1(pOutOBJ,blockSize,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(pSrc_converted);
FREEARGUMENT(pRef_converted);
Py_DECREF(pOutOBJ);
FREEARGUMENT(pErr_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
float32_t mu; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOf",&S,&numTaps,&pCoeffs,&pState,&mu))
{
ml_arm_lms_instance_f32Object *selfS = (ml_arm_lms_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1 ;
arm_lms_init_f32(selfS->instance,numTaps,pCoeffs_converted,pState_converted,mu,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
q15_t mu; // input
uint32_t blockSize; // input
uint32_t postShift; // input
if (PyArg_ParseTuple(args,"OhOOhi",&S,&numTaps,&pCoeffs,&pState,&mu,&postShift))
{
ml_arm_lms_instance_q15Object *selfS = (ml_arm_lms_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepState - arraySizepCoeffs + 1 ;
arm_lms_init_q15(selfS->instance,numTaps,pCoeffs_converted,pState_converted,mu,blockSize,postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
PyObject *pRef=NULL; // input
q15_t *pRef_converted=NULL; // input
q15_t *pOut=NULL; // output
PyObject *pErr=NULL; // input
q15_t *pErr_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOOO",&S,&pSrc,&pRef,&pErr))
{
ml_arm_lms_instance_q15Object *selfS = (ml_arm_lms_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pRef,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pErr,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pOut=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_lms_q15(selfS->instance,pSrc_converted,pRef_converted,pOut,pErr_converted,blockSize);
INT16ARRAY1(pOutOBJ,blockSize,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(pSrc_converted);
FREEARGUMENT(pRef_converted);
Py_DECREF(pOutOBJ);
FREEARGUMENT(pErr_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
PyObject *pRef=NULL; // input
q31_t *pRef_converted=NULL; // input
q31_t *pOut=NULL; // output
PyObject *pErr=NULL; // input
q31_t *pErr_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOOO",&S,&pSrc,&pRef,&pErr))
{
ml_arm_lms_instance_q31Object *selfS = (ml_arm_lms_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pRef,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pErr,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pOut=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_lms_q31(selfS->instance,pSrc_converted,pRef_converted,pOut,pErr_converted,blockSize);
INT32ARRAY1(pOutOBJ,blockSize,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(pSrc_converted);
FREEARGUMENT(pRef_converted);
Py_DECREF(pOutOBJ);
FREEARGUMENT(pErr_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
q31_t mu; // input
uint32_t blockSize; // input
uint32_t postShift; // input
if (PyArg_ParseTuple(args,"OhOOii",&S,&numTaps,&pCoeffs,&pState,&mu,&postShift))
{
ml_arm_lms_instance_q31Object *selfS = (ml_arm_lms_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1 ;
arm_lms_init_q31(selfS->instance,numTaps,pCoeffs_converted,pState_converted,mu,blockSize,postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_norm_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
PyObject *pRef=NULL; // input
float32_t *pRef_converted=NULL; // input
float32_t *pOut=NULL; // output
PyObject *pErr=NULL; // input
float32_t *pErr_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOOO",&S,&pSrc,&pRef,&pErr))
{
ml_arm_lms_norm_instance_f32Object *selfS = (ml_arm_lms_norm_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pRef,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pErr,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pOut=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_lms_norm_f32(selfS->instance,pSrc_converted,pRef_converted,pOut,pErr_converted,blockSize);
FLOATARRAY1(pOutOBJ,blockSize,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(pSrc_converted);
FREEARGUMENT(pRef_converted);
Py_DECREF(pOutOBJ);
FREEARGUMENT(pErr_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_norm_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
float32_t mu; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOf",&S,&numTaps,&pCoeffs,&pState,&mu))
{
ml_arm_lms_norm_instance_f32Object *selfS = (ml_arm_lms_norm_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1 ;
arm_lms_norm_init_f32(selfS->instance,numTaps,pCoeffs_converted,pState_converted,mu,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_norm_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
PyObject *pRef=NULL; // input
q31_t *pRef_converted=NULL; // input
q31_t *pOut=NULL; // output
PyObject *pErr=NULL; // input
q31_t *pErr_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOOO",&S,&pSrc,&pRef,&pErr))
{
ml_arm_lms_norm_instance_q31Object *selfS = (ml_arm_lms_norm_instance_q31Object *)S;
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pRef,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pErr,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pOut=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_lms_norm_q31(selfS->instance,pSrc_converted,pRef_converted,pOut,pErr_converted,blockSize);
INT32ARRAY1(pOutOBJ,blockSize,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(pSrc_converted);
FREEARGUMENT(pRef_converted);
Py_DECREF(pOutOBJ);
FREEARGUMENT(pErr_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_norm_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
q31_t mu; // input
uint32_t blockSize; // input
uint32_t postShift; // input
if (PyArg_ParseTuple(args,"OhOOii",&S,&numTaps,&pCoeffs,&pState,&mu,&postShift))
{
ml_arm_lms_norm_instance_q31Object *selfS = (ml_arm_lms_norm_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1 ;
arm_lms_norm_init_q31(selfS->instance,numTaps,pCoeffs_converted,pState_converted,mu,blockSize,(uint8_t)postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_norm_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
PyObject *pRef=NULL; // input
q15_t *pRef_converted=NULL; // input
q15_t *pOut=NULL; // output
PyObject *pErr=NULL; // input
q15_t *pErr_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOOO",&S,&pSrc,&pRef,&pErr))
{
ml_arm_lms_norm_instance_q15Object *selfS = (ml_arm_lms_norm_instance_q15Object *)S;
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pRef,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pErr,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pOut=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_lms_norm_q15(selfS->instance,pSrc_converted,pRef_converted,pOut,pErr_converted,blockSize);
INT16ARRAY1(pOutOBJ,blockSize,pOut);
PyObject *pythonResult = Py_BuildValue("O",pOutOBJ);
FREEARGUMENT(pSrc_converted);
FREEARGUMENT(pRef_converted);
Py_DECREF(pOutOBJ);
FREEARGUMENT(pErr_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_lms_norm_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
q15_t mu; // input
uint32_t blockSize; // input
uint32_t postShift; // input
if (PyArg_ParseTuple(args,"OhOOhi",&S,&numTaps,&pCoeffs,&pState,&mu,&postShift))
{
ml_arm_lms_norm_instance_q15Object *selfS = (ml_arm_lms_norm_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepState - arraySizepCoeffs + 1 ;
arm_lms_norm_init_q15(selfS->instance,numTaps,pCoeffs_converted,pState_converted,mu,blockSize,(uint8_t)postShift);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
float32_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(float32_t)*outputLength);
arm_correlate_f32(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
FLOATARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_opt_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
PyObject *pScratch=NULL; // input
q15_t *pScratch_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&pScratch))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_correlate_opt_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,pScratch_converted);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_correlate_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_fast_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_correlate_fast_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_fast_opt_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q15_t *pDst=NULL; // output
PyObject *pScratch=NULL; // input
q15_t *pScratch_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&pScratch))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q15_t)*outputLength);
arm_correlate_fast_opt_q15(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,pScratch_converted);
INT16ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q31_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q31_t)*outputLength);
arm_correlate_q31(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT32ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_fast_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q31_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q31_t)*outputLength);
arm_correlate_fast_q31(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT32ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_opt_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q7_t *pDst=NULL; // output
PyObject *pScratch1=NULL; // input
q15_t *pScratch1_converted=NULL; // input
PyObject *pScratch2=NULL; // input
q15_t *pScratch2_converted=NULL; // input
if (PyArg_ParseTuple(args,"OiOiOO",&pSrcA,&srcALen,&pSrcB,&srcBLen,&pScratch1,&pScratch2))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pScratch1,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pScratch2,NPY_INT16,int16_t,int16_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q7_t)*outputLength);
arm_correlate_opt_q7(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst,pScratch1_converted,pScratch2_converted);
INT8ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratch1_converted);
FREEARGUMENT(pScratch2_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_correlate_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q7_t *pSrcA_converted=NULL; // input
uint32_t srcALen; // input
PyObject *pSrcB=NULL; // input
q7_t *pSrcB_converted=NULL; // input
uint32_t srcBLen; // input
q7_t *pDst=NULL; // output
if (PyArg_ParseTuple(args,"OiOi",&pSrcA,&srcALen,&pSrcB,&srcBLen))
{
GETARGUMENT(pSrcA,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pSrcB,NPY_BYTE,int8_t,q7_t);
uint32_t outputLength = 2*MAX(srcALen,srcBLen) - 1 ;
pDst=PyMem_Malloc(sizeof(q7_t)*outputLength);
arm_correlate_q7(pSrcA_converted,srcALen,pSrcB_converted,srcBLen,pDst);
INT8ARRAY1(pDstOBJ,outputLength,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_sparse_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
PyObject *pScratchIn=NULL; // input
float32_t *pScratchIn_converted=NULL; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OOO",&S,&pSrc,&pScratchIn))
{
ml_arm_fir_sparse_instance_f32Object *selfS = (ml_arm_fir_sparse_instance_f32Object *)S;
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pScratchIn,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_fir_sparse_f32(selfS->instance,pSrc_converted,pDst,pScratchIn_converted,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
FREEARGUMENT(pScratchIn_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_sparse_init_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
float32_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
float32_t *pState_converted=NULL; // input
PyObject *pTapDelay=NULL; // input
int32_t *pTapDelay_converted=NULL; // input
uint16_t maxDelay; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOOh",&S,&numTaps,&pCoeffs,&pState,&pTapDelay,&maxDelay))
{
ml_arm_fir_sparse_instance_f32Object *selfS = (ml_arm_fir_sparse_instance_f32Object *)S;
GETARGUMENT(pCoeffs,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pState,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pTapDelay,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_sparse_init_f32(selfS->instance,numTaps,pCoeffs_converted,pState_converted,pTapDelay_converted,maxDelay,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_sparse_init_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q31_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q31_t *pState_converted=NULL; // input
PyObject *pTapDelay=NULL; // input
int32_t *pTapDelay_converted=NULL; // input
uint16_t maxDelay; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOOh",&S,&numTaps,&pCoeffs,&pState,&pTapDelay,&maxDelay))
{
ml_arm_fir_sparse_instance_q31Object *selfS = (ml_arm_fir_sparse_instance_q31Object *)S;
GETARGUMENT(pCoeffs,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pState,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pTapDelay,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_sparse_init_q31(selfS->instance,numTaps,pCoeffs_converted,pState_converted,pTapDelay_converted,maxDelay,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_sparse_init_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q15_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q15_t *pState_converted=NULL; // input
PyObject *pTapDelay=NULL; // input
int32_t *pTapDelay_converted=NULL; // input
uint16_t maxDelay; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOOh",&S,&numTaps,&pCoeffs,&pState,&pTapDelay,&maxDelay))
{
ml_arm_fir_sparse_instance_q15Object *selfS = (ml_arm_fir_sparse_instance_q15Object *)S;
GETARGUMENT(pCoeffs,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pState,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pTapDelay,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_sparse_init_q15(selfS->instance,numTaps,pCoeffs_converted,pState_converted,pTapDelay_converted,maxDelay,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_fir_sparse_init_q7(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
uint16_t numTaps; // input
PyObject *pCoeffs=NULL; // input
q7_t *pCoeffs_converted=NULL; // input
PyObject *pState=NULL; // input
q7_t *pState_converted=NULL; // input
PyObject *pTapDelay=NULL; // input
int32_t *pTapDelay_converted=NULL; // input
uint16_t maxDelay; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OhOOOh",&S,&numTaps,&pCoeffs,&pState,&pTapDelay,&maxDelay))
{
ml_arm_fir_sparse_instance_q7Object *selfS = (ml_arm_fir_sparse_instance_q7Object *)S;
GETARGUMENT(pCoeffs,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pState,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(pTapDelay,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepState - arraySizepCoeffs + 1;
arm_fir_sparse_init_q7(selfS->instance,numTaps,pCoeffs_converted,pState_converted,pTapDelay_converted,maxDelay,blockSize);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_sin_cos_f32(PyObject *obj, PyObject *args)
{
float32_t theta; // input
PyObject *pSinVal=NULL; // input
float32_t *pSinVal_converted=NULL; // input
PyObject *pCosVal=NULL; // input
float32_t *pCosVal_converted=NULL; // input
if (PyArg_ParseTuple(args,"fOO",&theta,&pSinVal,&pCosVal))
{
GETARGUMENT(pSinVal,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pCosVal,NPY_DOUBLE,double,float32_t);
arm_sin_cos_f32(theta,pSinVal_converted,pCosVal_converted);
FREEARGUMENT(pSinVal_converted);
FREEARGUMENT(pCosVal_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_sin_cos_q31(PyObject *obj, PyObject *args)
{
q31_t theta; // input
PyObject *pSinVal=NULL; // input
q31_t *pSinVal_converted=NULL; // input
PyObject *pCosVal=NULL; // input
q31_t *pCosVal_converted=NULL; // input
if (PyArg_ParseTuple(args,"iOO",&theta,&pSinVal,&pCosVal))
{
GETARGUMENT(pSinVal,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pCosVal,NPY_INT32,int32_t,int32_t);
arm_sin_cos_q31(theta,pSinVal_converted,pCosVal_converted);
FREEARGUMENT(pSinVal_converted);
FREEARGUMENT(pCosVal_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_conj_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(float32_t)*2*numSamples);
arm_cmplx_conj_f32(pSrc_converted,pDst,numSamples);
FLOATARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_conj_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q31_t)*2*numSamples);
arm_cmplx_conj_q31(pSrc_converted,pDst,numSamples);
INT32ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_conj_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q15_t)*2*numSamples);
arm_cmplx_conj_q15(pSrc_converted,pDst,numSamples);
INT16ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mag_squared_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(float32_t)*2*numSamples);
arm_cmplx_mag_squared_f32(pSrc_converted,pDst,numSamples);
FLOATARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mag_squared_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q31_t)*2*numSamples);
arm_cmplx_mag_squared_q31(pSrc_converted,pDst,numSamples);
INT32ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mag_squared_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q15_t)*2*numSamples);
arm_cmplx_mag_squared_q15(pSrc_converted,pDst,numSamples);
INT16ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
float32_t in; // input
if (PyArg_ParseTuple(args,"Of",&S,&in))
{
ml_arm_pid_instance_f32Object *selfS = (ml_arm_pid_instance_f32Object *)S;
float32_t returnValue = arm_pid_f32(selfS->instance,in);
PyObject* theReturnOBJ=Py_BuildValue("f",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
q31_t in; // input
if (PyArg_ParseTuple(args,"Oi",&S,&in))
{
ml_arm_pid_instance_q31Object *selfS = (ml_arm_pid_instance_q31Object *)S;
q31_t returnValue = arm_pid_q31(selfS->instance,in);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_pid_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
q15_t in; // input
if (PyArg_ParseTuple(args,"Oh",&S,&in))
{
ml_arm_pid_instance_q15Object *selfS = (ml_arm_pid_instance_q15Object *)S;
q15_t returnValue = arm_pid_q15(selfS->instance,in);
PyObject* theReturnOBJ=Py_BuildValue("h",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_inverse_f32(PyObject *obj, PyObject *args)
{
PyObject *src=NULL; // input
arm_matrix_instance_f32 *src_converted=NULL; // input
if (PyArg_ParseTuple(args,"O",&src))
{
arm_matrix_instance_f32 *src_converted = f32MatrixFromNumpy(src);
uint32_t row = src_converted->numCols ;
uint32_t column = src_converted->numRows ;
arm_matrix_instance_f32 *dst_converted = createf32Matrix(row,column);
arm_status returnValue = arm_mat_inverse_f32(src_converted,dst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* dstOBJ=NumpyArrayFromf32Matrix(dst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,dstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(src_converted);
Py_DECREF(dstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mat_inverse_f64(PyObject *obj, PyObject *args)
{
PyObject *src=NULL; // input
arm_matrix_instance_f64 *src_converted=NULL; // input
if (PyArg_ParseTuple(args,"O",&src))
{
arm_matrix_instance_f64 *src_converted = f64MatrixFromNumpy(src);
uint32_t row = src_converted->numCols ;
uint32_t column = src_converted->numRows ;
arm_matrix_instance_f64 *dst_converted = createf64Matrix(row,column);
arm_status returnValue = arm_mat_inverse_f64(src_converted,dst_converted);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* dstOBJ=NumpyArrayFromf64Matrix(dst_converted);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,dstOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(src_converted);
Py_DECREF(dstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_clarke_f32(PyObject *obj, PyObject *args)
{
float32_t Ia; // input
float32_t Ib; // input
PyObject *pIalpha=NULL; // input
float32_t *pIalpha_converted=NULL; // input
PyObject *pIbeta=NULL; // input
float32_t *pIbeta_converted=NULL; // input
if (PyArg_ParseTuple(args,"ffOO",&Ia,&Ib,&pIalpha,&pIbeta))
{
GETARGUMENT(pIalpha,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pIbeta,NPY_DOUBLE,double,float32_t);
arm_clarke_f32(Ia,Ib,pIalpha_converted,pIbeta_converted);
FREEARGUMENT(pIalpha_converted);
FREEARGUMENT(pIbeta_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_clarke_q31(PyObject *obj, PyObject *args)
{
q31_t Ia; // input
q31_t Ib; // input
PyObject *pIalpha=NULL; // input
q31_t *pIalpha_converted=NULL; // input
PyObject *pIbeta=NULL; // input
q31_t *pIbeta_converted=NULL; // input
if (PyArg_ParseTuple(args,"iiOO",&Ia,&Ib,&pIalpha,&pIbeta))
{
GETARGUMENT(pIalpha,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pIbeta,NPY_INT32,int32_t,int32_t);
arm_clarke_q31(Ia,Ib,pIalpha_converted,pIbeta_converted);
FREEARGUMENT(pIalpha_converted);
FREEARGUMENT(pIbeta_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_q7_to_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_q7_to_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_inv_clarke_f32(PyObject *obj, PyObject *args)
{
float32_t Ialpha; // input
float32_t Ibeta; // input
PyObject *pIa=NULL; // input
float32_t *pIa_converted=NULL; // input
PyObject *pIb=NULL; // input
float32_t *pIb_converted=NULL; // input
if (PyArg_ParseTuple(args,"ffOO",&Ialpha,&Ibeta,&pIa,&pIb))
{
GETARGUMENT(pIa,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pIb,NPY_DOUBLE,double,float32_t);
arm_inv_clarke_f32(Ialpha,Ibeta,pIa_converted,pIb_converted);
FREEARGUMENT(pIa_converted);
FREEARGUMENT(pIb_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_inv_clarke_q31(PyObject *obj, PyObject *args)
{
q31_t Ialpha; // input
q31_t Ibeta; // input
PyObject *pIa=NULL; // input
q31_t *pIa_converted=NULL; // input
PyObject *pIb=NULL; // input
q31_t *pIb_converted=NULL; // input
if (PyArg_ParseTuple(args,"iiOO",&Ialpha,&Ibeta,&pIa,&pIb))
{
GETARGUMENT(pIa,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pIb,NPY_INT32,int32_t,int32_t);
arm_inv_clarke_q31(Ialpha,Ibeta,pIa_converted,pIb_converted);
FREEARGUMENT(pIa_converted);
FREEARGUMENT(pIb_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_q7_to_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_q7_to_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_park_f32(PyObject *obj, PyObject *args)
{
float32_t Ialpha; // input
float32_t Ibeta; // input
PyObject *pId=NULL; // input
float32_t *pId_converted=NULL; // input
PyObject *pIq=NULL; // input
float32_t *pIq_converted=NULL; // input
float32_t sinVal; // input
float32_t cosVal; // input
if (PyArg_ParseTuple(args,"ffOOff",&Ialpha,&Ibeta,&pId,&pIq,&sinVal,&cosVal))
{
GETARGUMENT(pId,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pIq,NPY_DOUBLE,double,float32_t);
arm_park_f32(Ialpha,Ibeta,pId_converted,pIq_converted,sinVal,cosVal);
FREEARGUMENT(pId_converted);
FREEARGUMENT(pIq_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_park_q31(PyObject *obj, PyObject *args)
{
q31_t Ialpha; // input
q31_t Ibeta; // input
PyObject *pId=NULL; // input
q31_t *pId_converted=NULL; // input
PyObject *pIq=NULL; // input
q31_t *pIq_converted=NULL; // input
q31_t sinVal; // input
q31_t cosVal; // input
if (PyArg_ParseTuple(args,"iiOOii",&Ialpha,&Ibeta,&pId,&pIq,&sinVal,&cosVal))
{
GETARGUMENT(pId,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pIq,NPY_INT32,int32_t,int32_t);
arm_park_q31(Ialpha,Ibeta,pId_converted,pIq_converted,sinVal,cosVal);
FREEARGUMENT(pId_converted);
FREEARGUMENT(pIq_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_q7_to_float(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_q7_to_float(pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_inv_park_f32(PyObject *obj, PyObject *args)
{
float32_t Id; // input
float32_t Iq; // input
PyObject *pIalpha=NULL; // input
float32_t *pIalpha_converted=NULL; // input
PyObject *pIbeta=NULL; // input
float32_t *pIbeta_converted=NULL; // input
float32_t sinVal; // input
float32_t cosVal; // input
if (PyArg_ParseTuple(args,"ffOOff",&Id,&Iq,&pIalpha,&pIbeta,&sinVal,&cosVal))
{
GETARGUMENT(pIalpha,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pIbeta,NPY_DOUBLE,double,float32_t);
arm_inv_park_f32(Id,Iq,pIalpha_converted,pIbeta_converted,sinVal,cosVal);
FREEARGUMENT(pIalpha_converted);
FREEARGUMENT(pIbeta_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_inv_park_q31(PyObject *obj, PyObject *args)
{
q31_t Id; // input
q31_t Iq; // input
PyObject *pIalpha=NULL; // input
q31_t *pIalpha_converted=NULL; // input
PyObject *pIbeta=NULL; // input
q31_t *pIbeta_converted=NULL; // input
q31_t sinVal; // input
q31_t cosVal; // input
if (PyArg_ParseTuple(args,"iiOOii",&Id,&Iq,&pIalpha,&pIbeta,&sinVal,&cosVal))
{
GETARGUMENT(pIalpha,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pIbeta,NPY_INT32,int32_t,int32_t);
arm_inv_park_q31(Id,Iq,pIalpha_converted,pIbeta_converted,sinVal,cosVal);
FREEARGUMENT(pIalpha_converted);
FREEARGUMENT(pIbeta_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_q31_to_float(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_q31_to_float(pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_linear_interp_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
float32_t x; // input
if (PyArg_ParseTuple(args,"Of",&S,&x))
{
ml_arm_linear_interp_instance_f32Object *selfS = (ml_arm_linear_interp_instance_f32Object *)S;
float32_t returnValue = arm_linear_interp_f32(selfS->instance,x);
PyObject* theReturnOBJ=Py_BuildValue("f",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_linear_interp_q31(PyObject *obj, PyObject *args)
{
PyObject *pYData=NULL; // input
q31_t *pYData_converted=NULL; // input
q31_t x; // input
uint32_t nValues; // input
if (PyArg_ParseTuple(args,"Oii",&pYData,&x,&nValues))
{
GETARGUMENT(pYData,NPY_INT32,int32_t,int32_t);
q31_t returnValue = arm_linear_interp_q31(pYData_converted,x,nValues);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pYData_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_linear_interp_q15(PyObject *obj, PyObject *args)
{
PyObject *pYData=NULL; // input
q15_t *pYData_converted=NULL; // input
q31_t x; // input
uint32_t nValues; // input
if (PyArg_ParseTuple(args,"Oii",&pYData,&x,&nValues))
{
GETARGUMENT(pYData,NPY_INT16,int16_t,int16_t);
q15_t returnValue = arm_linear_interp_q15(pYData_converted,x,nValues);
PyObject* theReturnOBJ=Py_BuildValue("h",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pYData_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_linear_interp_q7(PyObject *obj, PyObject *args)
{
PyObject *pYData=NULL; // input
q7_t *pYData_converted=NULL; // input
q31_t x; // input
uint32_t nValues; // input
if (PyArg_ParseTuple(args,"Oii",&pYData,&x,&nValues))
{
GETARGUMENT(pYData,NPY_BYTE,int8_t,q7_t);
q7_t returnValue = arm_linear_interp_q7(pYData_converted,x,nValues);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
FREEARGUMENT(pYData_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sin_f32(PyObject *obj, PyObject *args)
{
float32_t x; // input
if (PyArg_ParseTuple(args,"f",&x))
{
float32_t returnValue = arm_sin_f32(x);
PyObject* theReturnOBJ=Py_BuildValue("f",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sin_q31(PyObject *obj, PyObject *args)
{
q31_t x; // input
if (PyArg_ParseTuple(args,"i",&x))
{
q31_t returnValue = arm_sin_q31(x);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sin_q15(PyObject *obj, PyObject *args)
{
q15_t x; // input
if (PyArg_ParseTuple(args,"h",&x))
{
q15_t returnValue = arm_sin_q15(x);
PyObject* theReturnOBJ=Py_BuildValue("h",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cos_f32(PyObject *obj, PyObject *args)
{
float32_t x; // input
if (PyArg_ParseTuple(args,"f",&x))
{
float32_t returnValue = arm_cos_f32(x);
PyObject* theReturnOBJ=Py_BuildValue("f",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cos_q31(PyObject *obj, PyObject *args)
{
q31_t x; // input
if (PyArg_ParseTuple(args,"i",&x))
{
q31_t returnValue = arm_cos_q31(x);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cos_q15(PyObject *obj, PyObject *args)
{
q15_t x; // input
if (PyArg_ParseTuple(args,"h",&x))
{
q15_t returnValue = arm_cos_q15(x);
PyObject* theReturnOBJ=Py_BuildValue("h",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sqrt_f32(PyObject *obj, PyObject *args)
{
float32_t in; // input
float32_t *pOut=NULL; // output
if (PyArg_ParseTuple(args,"f",&in))
{
pOut=PyMem_Malloc(sizeof(float32_t)*1);
arm_status returnValue = arm_sqrt_f32(in,pOut);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pOutOBJ=Py_BuildValue("f",*pOut);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pOutOBJ);
Py_DECREF(theReturnOBJ);
Py_DECREF(pOutOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sqrt_q31(PyObject *obj, PyObject *args)
{
q31_t in; // input
q31_t *pOut=NULL; // output
if (PyArg_ParseTuple(args,"i",&in))
{
pOut=PyMem_Malloc(sizeof(q31_t)*1);
arm_status returnValue = arm_sqrt_q31(in,pOut);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pOutOBJ=Py_BuildValue("i",*pOut);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pOutOBJ);
Py_DECREF(theReturnOBJ);
Py_DECREF(pOutOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_sqrt_q15(PyObject *obj, PyObject *args)
{
q15_t in; // input
q15_t *pOut=NULL; // output
if (PyArg_ParseTuple(args,"h",&in))
{
pOut=PyMem_Malloc(sizeof(q15_t)*1);
arm_status returnValue = arm_sqrt_q15(in,pOut);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pOutOBJ=Py_BuildValue("h",*pOut);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pOutOBJ);
Py_DECREF(theReturnOBJ);
Py_DECREF(pOutOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_circularWrite_f32(PyObject *obj, PyObject *args)
{
PyObject *circBuffer=NULL; // input
int32_t *circBuffer_converted=NULL; // input
int32_t L; // input
PyObject *writeOffset=NULL; // input
uint16_t *writeOffset_converted=NULL; // input
int32_t bufferInc; // input
PyObject *src=NULL; // input
int32_t *src_converted=NULL; // input
int32_t srcInc; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OiOiOi",&circBuffer,&L,&writeOffset,&bufferInc,&src,&srcInc))
{
GETARGUMENT(circBuffer,NPY_INT32,int32_t,int32_t);
GETARGUMENT(writeOffset,NPY_UINT16,uint16_t,uint16_t);
GETARGUMENT(src,NPY_INT32,int32_t,int32_t);
blockSize = arraySizecircBuffer ;
arm_circularWrite_f32(circBuffer_converted,L,writeOffset_converted,bufferInc,src_converted,srcInc,blockSize);
FREEARGUMENT(circBuffer_converted);
FREEARGUMENT(writeOffset_converted);
FREEARGUMENT(src_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_circularWrite_q15(PyObject *obj, PyObject *args)
{
PyObject *circBuffer=NULL; // input
q15_t *circBuffer_converted=NULL; // input
int32_t L; // input
PyObject *writeOffset=NULL; // input
uint16_t *writeOffset_converted=NULL; // input
int32_t bufferInc; // input
PyObject *src=NULL; // input
q15_t *src_converted=NULL; // input
int32_t srcInc; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OiOiOi",&circBuffer,&L,&writeOffset,&bufferInc,&src,&srcInc))
{
GETARGUMENT(circBuffer,NPY_INT16,int16_t,int16_t);
GETARGUMENT(writeOffset,NPY_UINT16,uint16_t,uint16_t);
GETARGUMENT(src,NPY_INT16,int16_t,int16_t);
blockSize = arraySizecircBuffer ;
arm_circularWrite_q15(circBuffer_converted,L,writeOffset_converted,bufferInc,src_converted,srcInc,blockSize);
FREEARGUMENT(circBuffer_converted);
FREEARGUMENT(writeOffset_converted);
FREEARGUMENT(src_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_circularWrite_q7(PyObject *obj, PyObject *args)
{
PyObject *circBuffer=NULL; // input
q7_t *circBuffer_converted=NULL; // input
int32_t L; // input
PyObject *writeOffset=NULL; // input
uint16_t *writeOffset_converted=NULL; // input
int32_t bufferInc; // input
PyObject *src=NULL; // input
q7_t *src_converted=NULL; // input
int32_t srcInc; // input
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"OiOiOi",&circBuffer,&L,&writeOffset,&bufferInc,&src,&srcInc))
{
GETARGUMENT(circBuffer,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(writeOffset,NPY_UINT16,uint16_t,uint16_t);
GETARGUMENT(src,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizecircBuffer ;
arm_circularWrite_q7(circBuffer_converted,L,writeOffset_converted,bufferInc,src_converted,srcInc,blockSize);
FREEARGUMENT(circBuffer_converted);
FREEARGUMENT(writeOffset_converted);
FREEARGUMENT(src_converted);
Py_RETURN_NONE;
}
return(NULL);
}
static PyObject *
cmsis_arm_power_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q63_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q63_t)*1);
arm_power_q31(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("L",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_power_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
arm_power_f32(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_power_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q63_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q63_t)*1);
arm_power_q15(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("L",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_power_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
arm_power_q7(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mean_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q7_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q7_t)*1);
arm_mean_q7(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mean_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q15_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q15_t)*1);
arm_mean_q15(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("h",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mean_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
arm_mean_q31(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_mean_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
arm_mean_f32(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_var_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
arm_var_f32(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_var_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
arm_var_q31(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_var_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q15_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q15_t)*1);
arm_var_q15(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("h",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rms_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
arm_rms_f32(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rms_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
arm_rms_q31(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_rms_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q15_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q15_t)*1);
arm_rms_q15(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("h",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_std_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
arm_std_f32(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_std_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
arm_std_q31(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_std_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q15_t *pResult=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q15_t)*1);
arm_std_q15(pSrc_converted,blockSize,pResult);
PyObject* pResultOBJ=Py_BuildValue("h",*pResult);
PyObject *pythonResult = Py_BuildValue("O",pResultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mag_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(float32_t)*2*numSamples);
arm_cmplx_mag_f32(pSrc_converted,pDst,numSamples);
FLOATARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mag_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q31_t)*2*numSamples);
arm_cmplx_mag_q31(pSrc_converted,pDst,numSamples);
INT32ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mag_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
numSamples = arraySizepSrc ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q15_t)*2*numSamples);
arm_cmplx_mag_q15(pSrc_converted,pDst,numSamples);
INT16ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_dot_prod_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
uint32_t numSamples; // input
q31_t *realResult=NULL; // output
q31_t *imagResult=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
numSamples = arraySizepSrcA ;
numSamples = numSamples / 2;
realResult=PyMem_Malloc(sizeof(q31_t)*1);
imagResult=PyMem_Malloc(sizeof(q31_t)*1);
arm_cmplx_dot_prod_q15(pSrcA_converted,pSrcB_converted,numSamples,realResult,imagResult);
PyObject* realResultOBJ=Py_BuildValue("i",*realResult);
PyObject* imagResultOBJ=Py_BuildValue("i",*imagResult);
PyObject *pythonResult = Py_BuildValue("OO",realResultOBJ,imagResultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(realResultOBJ);
Py_DECREF(imagResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_dot_prod_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
uint32_t numSamples; // input
q63_t *realResult=NULL; // output
q63_t *imagResult=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
numSamples = arraySizepSrcA ;
numSamples = numSamples / 2;
realResult=PyMem_Malloc(sizeof(q63_t)*1);
imagResult=PyMem_Malloc(sizeof(q63_t)*1);
arm_cmplx_dot_prod_q31(pSrcA_converted,pSrcB_converted,numSamples,realResult,imagResult);
PyObject* realResultOBJ=Py_BuildValue("L",*realResult);
PyObject* imagResultOBJ=Py_BuildValue("L",*imagResult);
PyObject *pythonResult = Py_BuildValue("OO",realResultOBJ,imagResultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(realResultOBJ);
Py_DECREF(imagResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_dot_prod_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
uint32_t numSamples; // input
float32_t *realResult=NULL; // output
float32_t *imagResult=NULL; // output
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
numSamples = arraySizepSrcA ;
numSamples = numSamples / 2;
realResult=PyMem_Malloc(sizeof(float32_t)*1);
imagResult=PyMem_Malloc(sizeof(float32_t)*1);
arm_cmplx_dot_prod_f32(pSrcA_converted,pSrcB_converted,numSamples,realResult,imagResult);
PyObject* realResultOBJ=Py_BuildValue("f",*realResult);
PyObject* imagResultOBJ=Py_BuildValue("f",*imagResult);
PyObject *pythonResult = Py_BuildValue("OO",realResultOBJ,imagResultOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(realResultOBJ);
Py_DECREF(imagResultOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mult_real_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcCmplx=NULL; // input
q15_t *pSrcCmplx_converted=NULL; // input
PyObject *pSrcReal=NULL; // input
q15_t *pSrcReal_converted=NULL; // input
q15_t *pCmplxDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"OO",&pSrcCmplx,&pSrcReal))
{
GETARGUMENT(pSrcCmplx,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcReal,NPY_INT16,int16_t,int16_t);
numSamples = arraySizepSrcCmplx ;
numSamples = numSamples / 2;
pCmplxDst=PyMem_Malloc(sizeof(q15_t)*2*numSamples);
arm_cmplx_mult_real_q15(pSrcCmplx_converted,pSrcReal_converted,pCmplxDst,numSamples);
INT16ARRAY1(pCmplxDstOBJ,2*numSamples,pCmplxDst);
PyObject *pythonResult = Py_BuildValue("O",pCmplxDstOBJ);
FREEARGUMENT(pSrcCmplx_converted);
FREEARGUMENT(pSrcReal_converted);
Py_DECREF(pCmplxDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mult_real_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcCmplx=NULL; // input
q31_t *pSrcCmplx_converted=NULL; // input
PyObject *pSrcReal=NULL; // input
q31_t *pSrcReal_converted=NULL; // input
q31_t *pCmplxDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"OO",&pSrcCmplx,&pSrcReal))
{
GETARGUMENT(pSrcCmplx,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcReal,NPY_INT32,int32_t,int32_t);
numSamples = arraySizepSrcCmplx ;
numSamples = numSamples / 2;
pCmplxDst=PyMem_Malloc(sizeof(q31_t)*2*numSamples);
arm_cmplx_mult_real_q31(pSrcCmplx_converted,pSrcReal_converted,pCmplxDst,numSamples);
INT32ARRAY1(pCmplxDstOBJ,2*numSamples,pCmplxDst);
PyObject *pythonResult = Py_BuildValue("O",pCmplxDstOBJ);
FREEARGUMENT(pSrcCmplx_converted);
FREEARGUMENT(pSrcReal_converted);
Py_DECREF(pCmplxDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mult_real_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcCmplx=NULL; // input
float32_t *pSrcCmplx_converted=NULL; // input
PyObject *pSrcReal=NULL; // input
float32_t *pSrcReal_converted=NULL; // input
float32_t *pCmplxDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"OO",&pSrcCmplx,&pSrcReal))
{
GETARGUMENT(pSrcCmplx,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcReal,NPY_DOUBLE,double,float32_t);
numSamples = arraySizepSrcCmplx ;
numSamples = numSamples / 2;
pCmplxDst=PyMem_Malloc(sizeof(float32_t)*2*numSamples);
arm_cmplx_mult_real_f32(pSrcCmplx_converted,pSrcReal_converted,pCmplxDst,numSamples);
FLOATARRAY1(pCmplxDstOBJ,2*numSamples,pCmplxDst);
PyObject *pythonResult = Py_BuildValue("O",pCmplxDstOBJ);
FREEARGUMENT(pSrcCmplx_converted);
FREEARGUMENT(pSrcReal_converted);
Py_DECREF(pCmplxDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_min_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q7_t *result=NULL; // output
PyObject *index=NULL; // input
uint32_t *index_converted=NULL; // input
if (PyArg_ParseTuple(args,"OO",&pSrc,&index))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
GETARGUMENT(index,NPY_UINT32,uint32_t,uint32_t);
blockSize = arraySizepSrc ;
result=PyMem_Malloc(sizeof(q7_t)*1);
arm_min_q7(pSrc_converted,blockSize,result,index_converted);
PyObject* resultOBJ=Py_BuildValue("i",*result);
PyObject *pythonResult = Py_BuildValue("O",resultOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(resultOBJ);
FREEARGUMENT(index_converted);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_min_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q15_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q15_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_min_q15(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("h",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_min_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_min_q31(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_min_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_min_f32(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_max_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q7_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q7_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_BYTE,int8_t,q7_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q7_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_max_q7(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_max_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q15_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q15_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_max_q15(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("h",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_max_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
q31_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(q31_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_max_q31(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("i",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_max_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
uint32_t blockSize; // input
float32_t *pResult=NULL; // output
uint32_t *pIndex=NULL; // output
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pResult=PyMem_Malloc(sizeof(float32_t)*1);
pIndex=PyMem_Malloc(sizeof(uint32_t)*1);
arm_max_f32(pSrc_converted,blockSize,pResult,pIndex);
PyObject* pResultOBJ=Py_BuildValue("f",*pResult);
PyObject* pIndexOBJ=Py_BuildValue("i",*pIndex);
PyObject *pythonResult = Py_BuildValue("OO",pResultOBJ,pIndexOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pResultOBJ);
Py_DECREF(pIndexOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mult_cmplx_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q15_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q15_t *pSrcB_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT16,int16_t,int16_t);
GETARGUMENT(pSrcB,NPY_INT16,int16_t,int16_t);
numSamples = arraySizepSrcA ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q15_t)*2*numSamples);
arm_cmplx_mult_cmplx_q15(pSrcA_converted,pSrcB_converted,pDst,numSamples);
INT16ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mult_cmplx_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
q31_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
q31_t *pSrcB_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pSrcB,NPY_INT32,int32_t,int32_t);
numSamples = arraySizepSrcA ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(q31_t)*2*numSamples);
arm_cmplx_mult_cmplx_q31(pSrcA_converted,pSrcB_converted,pDst,numSamples);
INT32ARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_cmplx_mult_cmplx_f32(PyObject *obj, PyObject *args)
{
PyObject *pSrcA=NULL; // input
float32_t *pSrcA_converted=NULL; // input
PyObject *pSrcB=NULL; // input
float32_t *pSrcB_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t numSamples; // input
if (PyArg_ParseTuple(args,"OO",&pSrcA,&pSrcB))
{
GETARGUMENT(pSrcA,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pSrcB,NPY_DOUBLE,double,float32_t);
numSamples = arraySizepSrcA ;
numSamples = numSamples / 2;
pDst=PyMem_Malloc(sizeof(float32_t)*2*numSamples);
arm_cmplx_mult_cmplx_f32(pSrcA_converted,pSrcB_converted,pDst,numSamples);
FLOATARRAY1(pDstOBJ,2*numSamples,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrcA_converted);
FREEARGUMENT(pSrcB_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_float_to_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_float_to_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_float_to_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_float_to_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_float_to_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
float32_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_DOUBLE,double,float32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_float_to_q7(pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_q31_to_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_q31_to_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_q31_to_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_q31_to_q7(pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_q15_to_float(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
float32_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(float32_t)*blockSize);
arm_q15_to_float(pSrc_converted,pDst,blockSize);
FLOATARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_q15_to_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_q15_to_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_q15_to_q7(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q7_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q7_t)*blockSize);
arm_q15_to_q7(pSrc_converted,pDst,blockSize);
INT8ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_bilinear_interp_f32(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
float32_t X; // input
float32_t Y; // input
if (PyArg_ParseTuple(args,"Off",&S,&X,&Y))
{
ml_arm_bilinear_interp_instance_f32Object *selfS = (ml_arm_bilinear_interp_instance_f32Object *)S;
float32_t returnValue = arm_bilinear_interp_f32(selfS->instance,X,Y);
PyObject* theReturnOBJ=Py_BuildValue("f",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_bilinear_interp_q31(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
q31_t X; // input
q31_t Y; // input
if (PyArg_ParseTuple(args,"Oii",&S,&X,&Y))
{
ml_arm_bilinear_interp_instance_q31Object *selfS = (ml_arm_bilinear_interp_instance_q31Object *)S;
q31_t returnValue = arm_bilinear_interp_q31(selfS->instance,X,Y);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_bilinear_interp_q15(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
q31_t X; // input
q31_t Y; // input
if (PyArg_ParseTuple(args,"Oii",&S,&X,&Y))
{
ml_arm_bilinear_interp_instance_q15Object *selfS = (ml_arm_bilinear_interp_instance_q15Object *)S;
q15_t returnValue = arm_bilinear_interp_q15(selfS->instance,X,Y);
PyObject* theReturnOBJ=Py_BuildValue("h",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_bilinear_interp_q7(PyObject *obj, PyObject *args)
{
PyObject *S=NULL; // input
q31_t X; // input
q31_t Y; // input
if (PyArg_ParseTuple(args,"Oii",&S,&X,&Y))
{
ml_arm_bilinear_interp_instance_q7Object *selfS = (ml_arm_bilinear_interp_instance_q7Object *)S;
q7_t returnValue = arm_bilinear_interp_q7(selfS->instance,X,Y);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject *pythonResult = Py_BuildValue("O",theReturnOBJ);
Py_DECREF(theReturnOBJ);
return(pythonResult);
}
return(NULL);
}
static PyMethodDef CMSISMLMethods[] = {
{"arm_recip_q31", cmsis_arm_recip_q31, METH_VARARGS,""},
{"arm_recip_q15", cmsis_arm_recip_q15, METH_VARARGS,""},
{"arm_fir_q7", cmsis_arm_fir_q7, METH_VARARGS,""},
{"arm_fir_init_q7", cmsis_arm_fir_init_q7, METH_VARARGS,""},
{"arm_fir_q15", cmsis_arm_fir_q15, METH_VARARGS,""},
{"arm_fir_fast_q15", cmsis_arm_fir_fast_q15, METH_VARARGS,""},
{"arm_fir_init_q15", cmsis_arm_fir_init_q15, METH_VARARGS,""},
{"arm_fir_q31", cmsis_arm_fir_q31, METH_VARARGS,""},
{"arm_fir_fast_q31", cmsis_arm_fir_fast_q31, METH_VARARGS,""},
{"arm_fir_init_q31", cmsis_arm_fir_init_q31, METH_VARARGS,""},
{"arm_fir_f32", cmsis_arm_fir_f32, METH_VARARGS,""},
{"arm_fir_init_f32", cmsis_arm_fir_init_f32, METH_VARARGS,""},
{"arm_biquad_cascade_df1_q15", cmsis_arm_biquad_cascade_df1_q15, METH_VARARGS,""},
{"arm_biquad_cascade_df1_init_q15", cmsis_arm_biquad_cascade_df1_init_q15, METH_VARARGS,""},
{"arm_biquad_cascade_df1_fast_q15", cmsis_arm_biquad_cascade_df1_fast_q15, METH_VARARGS,""},
{"arm_biquad_cascade_df1_q31", cmsis_arm_biquad_cascade_df1_q31, METH_VARARGS,""},
{"arm_biquad_cascade_df1_fast_q31", cmsis_arm_biquad_cascade_df1_fast_q31, METH_VARARGS,""},
{"arm_biquad_cascade_df1_init_q31", cmsis_arm_biquad_cascade_df1_init_q31, METH_VARARGS,""},
{"arm_biquad_cascade_df1_f32", cmsis_arm_biquad_cascade_df1_f32, METH_VARARGS,""},
{"arm_biquad_cascade_df1_init_f32", cmsis_arm_biquad_cascade_df1_init_f32, METH_VARARGS,""},
{"arm_mat_add_f32", cmsis_arm_mat_add_f32, METH_VARARGS,""},
{"arm_mat_add_q15", cmsis_arm_mat_add_q15, METH_VARARGS,""},
{"arm_mat_add_q31", cmsis_arm_mat_add_q31, METH_VARARGS,""},
{"arm_mat_cmplx_mult_f32", cmsis_arm_mat_cmplx_mult_f32, METH_VARARGS,""},
{"arm_mat_cmplx_mult_q15", cmsis_arm_mat_cmplx_mult_q15, METH_VARARGS,""},
{"arm_mat_cmplx_mult_q31", cmsis_arm_mat_cmplx_mult_q31, METH_VARARGS,""},
{"arm_mat_trans_f32", cmsis_arm_mat_trans_f32, METH_VARARGS,""},
{"arm_mat_trans_q15", cmsis_arm_mat_trans_q15, METH_VARARGS,""},
{"arm_mat_trans_q31", cmsis_arm_mat_trans_q31, METH_VARARGS,""},
{"arm_mat_mult_f32", cmsis_arm_mat_mult_f32, METH_VARARGS,""},
{"arm_mat_mult_q15", cmsis_arm_mat_mult_q15, METH_VARARGS,""},
{"arm_mat_mult_fast_q15", cmsis_arm_mat_mult_fast_q15, METH_VARARGS,""},
{"arm_mat_mult_q31", cmsis_arm_mat_mult_q31, METH_VARARGS,""},
{"arm_mat_mult_fast_q31", cmsis_arm_mat_mult_fast_q31, METH_VARARGS,""},
{"arm_mat_sub_f32", cmsis_arm_mat_sub_f32, METH_VARARGS,""},
{"arm_mat_sub_q15", cmsis_arm_mat_sub_q15, METH_VARARGS,""},
{"arm_mat_sub_q31", cmsis_arm_mat_sub_q31, METH_VARARGS,""},
{"arm_mat_scale_f32", cmsis_arm_mat_scale_f32, METH_VARARGS,""},
{"arm_mat_scale_q15", cmsis_arm_mat_scale_q15, METH_VARARGS,""},
{"arm_mat_scale_q31", cmsis_arm_mat_scale_q31, METH_VARARGS,""},
{"arm_pid_init_f32", cmsis_arm_pid_init_f32, METH_VARARGS,""},
{"arm_pid_reset_f32", cmsis_arm_pid_reset_f32, METH_VARARGS,""},
{"arm_pid_init_q31", cmsis_arm_pid_init_q31, METH_VARARGS,""},
{"arm_pid_reset_q31", cmsis_arm_pid_reset_q31, METH_VARARGS,""},
{"arm_pid_init_q15", cmsis_arm_pid_init_q15, METH_VARARGS,""},
{"arm_pid_reset_q15", cmsis_arm_pid_reset_q15, METH_VARARGS,""},
{"arm_mult_q7", cmsis_arm_mult_q7, METH_VARARGS,""},
{"arm_mult_q15", cmsis_arm_mult_q15, METH_VARARGS,""},
{"arm_mult_q31", cmsis_arm_mult_q31, METH_VARARGS,""},
{"arm_mult_f32", cmsis_arm_mult_f32, METH_VARARGS,""},
{"arm_cfft_radix2_init_q15", cmsis_arm_cfft_radix2_init_q15, METH_VARARGS,""},
{"arm_cfft_radix2_q15", cmsis_arm_cfft_radix2_q15, METH_VARARGS,""},
{"arm_cfft_radix4_init_q15", cmsis_arm_cfft_radix4_init_q15, METH_VARARGS,""},
{"arm_cfft_radix4_q15", cmsis_arm_cfft_radix4_q15, METH_VARARGS,""},
{"arm_cfft_radix2_init_q31", cmsis_arm_cfft_radix2_init_q31, METH_VARARGS,""},
{"arm_cfft_radix2_q31", cmsis_arm_cfft_radix2_q31, METH_VARARGS,""},
{"arm_cfft_radix4_q31", cmsis_arm_cfft_radix4_q31, METH_VARARGS,""},
{"arm_cfft_radix4_init_q31", cmsis_arm_cfft_radix4_init_q31, METH_VARARGS,""},
{"arm_cfft_radix2_init_f32", cmsis_arm_cfft_radix2_init_f32, METH_VARARGS,""},
{"arm_cfft_radix2_f32", cmsis_arm_cfft_radix2_f32, METH_VARARGS,""},
{"arm_cfft_radix4_init_f32", cmsis_arm_cfft_radix4_init_f32, METH_VARARGS,""},
{"arm_cfft_radix4_f32", cmsis_arm_cfft_radix4_f32, METH_VARARGS,""},
{"arm_cfft_q15", cmsis_arm_cfft_q15, METH_VARARGS,""},
{"arm_cfft_q31", cmsis_arm_cfft_q31, METH_VARARGS,""},
{"arm_cfft_f32", cmsis_arm_cfft_f32, METH_VARARGS,""},
{"arm_rfft_init_q15", cmsis_arm_rfft_init_q15, METH_VARARGS,""},
{"arm_rfft_q15", cmsis_arm_rfft_q15, METH_VARARGS,""},
{"arm_rfft_init_q31", cmsis_arm_rfft_init_q31, METH_VARARGS,""},
{"arm_rfft_q31", cmsis_arm_rfft_q31, METH_VARARGS,""},
{"arm_rfft_init_f32", cmsis_arm_rfft_init_f32, METH_VARARGS,""},
{"arm_rfft_f32", cmsis_arm_rfft_f32, METH_VARARGS,""},
{"arm_rfft_fast_init_f32", cmsis_arm_rfft_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_32_fast_init_f32", cmsis_arm_rfft_32_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_64_fast_init_f32", cmsis_arm_rfft_64_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_128_fast_init_f32", cmsis_arm_rfft_128_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_256_fast_init_f32", cmsis_arm_rfft_256_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_512_fast_init_f32", cmsis_arm_rfft_512_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_1024_fast_init_f32", cmsis_arm_rfft_1024_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_2048_fast_init_f32", cmsis_arm_rfft_2048_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_4096_fast_init_f32", cmsis_arm_rfft_4096_fast_init_f32, METH_VARARGS,""},
{"arm_rfft_fast_f32", cmsis_arm_rfft_fast_f32, METH_VARARGS,""},
{"arm_dct4_init_f32", cmsis_arm_dct4_init_f32, METH_VARARGS,""},
{"arm_dct4_f32", cmsis_arm_dct4_f32, METH_VARARGS,""},
{"arm_dct4_init_q31", cmsis_arm_dct4_init_q31, METH_VARARGS,""},
{"arm_dct4_q31", cmsis_arm_dct4_q31, METH_VARARGS,""},
{"arm_dct4_init_q15", cmsis_arm_dct4_init_q15, METH_VARARGS,""},
{"arm_dct4_q15", cmsis_arm_dct4_q15, METH_VARARGS,""},
{"arm_add_f32", cmsis_arm_add_f32, METH_VARARGS,""},
{"arm_add_q7", cmsis_arm_add_q7, METH_VARARGS,""},
{"arm_add_q15", cmsis_arm_add_q15, METH_VARARGS,""},
{"arm_add_q31", cmsis_arm_add_q31, METH_VARARGS,""},
{"arm_sub_f32", cmsis_arm_sub_f32, METH_VARARGS,""},
{"arm_sub_q7", cmsis_arm_sub_q7, METH_VARARGS,""},
{"arm_sub_q15", cmsis_arm_sub_q15, METH_VARARGS,""},
{"arm_sub_q31", cmsis_arm_sub_q31, METH_VARARGS,""},
{"arm_scale_f32", cmsis_arm_scale_f32, METH_VARARGS,""},
{"arm_scale_q7", cmsis_arm_scale_q7, METH_VARARGS,""},
{"arm_scale_q15", cmsis_arm_scale_q15, METH_VARARGS,""},
{"arm_scale_q31", cmsis_arm_scale_q31, METH_VARARGS,""},
{"arm_abs_q7", cmsis_arm_abs_q7, METH_VARARGS,""},
{"arm_abs_f32", cmsis_arm_abs_f32, METH_VARARGS,""},
{"arm_abs_q15", cmsis_arm_abs_q15, METH_VARARGS,""},
{"arm_abs_q31", cmsis_arm_abs_q31, METH_VARARGS,""},
{"arm_dot_prod_f32", cmsis_arm_dot_prod_f32, METH_VARARGS,""},
{"arm_dot_prod_q7", cmsis_arm_dot_prod_q7, METH_VARARGS,""},
{"arm_dot_prod_q15", cmsis_arm_dot_prod_q15, METH_VARARGS,""},
{"arm_dot_prod_q31", cmsis_arm_dot_prod_q31, METH_VARARGS,""},
{"arm_shift_q7", cmsis_arm_shift_q7, METH_VARARGS,""},
{"arm_shift_q15", cmsis_arm_shift_q15, METH_VARARGS,""},
{"arm_shift_q31", cmsis_arm_shift_q31, METH_VARARGS,""},
{"arm_offset_f32", cmsis_arm_offset_f32, METH_VARARGS,""},
{"arm_offset_q7", cmsis_arm_offset_q7, METH_VARARGS,""},
{"arm_offset_q15", cmsis_arm_offset_q15, METH_VARARGS,""},
{"arm_offset_q31", cmsis_arm_offset_q31, METH_VARARGS,""},
{"arm_negate_f32", cmsis_arm_negate_f32, METH_VARARGS,""},
{"arm_negate_q7", cmsis_arm_negate_q7, METH_VARARGS,""},
{"arm_negate_q15", cmsis_arm_negate_q15, METH_VARARGS,""},
{"arm_negate_q31", cmsis_arm_negate_q31, METH_VARARGS,""},
{"arm_copy_f32", cmsis_arm_copy_f32, METH_VARARGS,""},
{"arm_copy_q7", cmsis_arm_copy_q7, METH_VARARGS,""},
{"arm_copy_q15", cmsis_arm_copy_q15, METH_VARARGS,""},
{"arm_copy_q31", cmsis_arm_copy_q31, METH_VARARGS,""},
{"arm_conv_f32", cmsis_arm_conv_f32, METH_VARARGS,""},
{"arm_conv_opt_q15", cmsis_arm_conv_opt_q15, METH_VARARGS,""},
{"arm_conv_q15", cmsis_arm_conv_q15, METH_VARARGS,""},
{"arm_conv_fast_q15", cmsis_arm_conv_fast_q15, METH_VARARGS,""},
{"arm_conv_fast_opt_q15", cmsis_arm_conv_fast_opt_q15, METH_VARARGS,""},
{"arm_conv_q31", cmsis_arm_conv_q31, METH_VARARGS,""},
{"arm_conv_fast_q31", cmsis_arm_conv_fast_q31, METH_VARARGS,""},
{"arm_conv_opt_q7", cmsis_arm_conv_opt_q7, METH_VARARGS,""},
{"arm_conv_q7", cmsis_arm_conv_q7, METH_VARARGS,""},
{"arm_conv_partial_f32", cmsis_arm_conv_partial_f32, METH_VARARGS,""},
{"arm_conv_partial_opt_q15", cmsis_arm_conv_partial_opt_q15, METH_VARARGS,""},
{"arm_conv_partial_q15", cmsis_arm_conv_partial_q15, METH_VARARGS,""},
{"arm_conv_partial_fast_q15", cmsis_arm_conv_partial_fast_q15, METH_VARARGS,""},
{"arm_conv_partial_fast_opt_q15", cmsis_arm_conv_partial_fast_opt_q15, METH_VARARGS,""},
{"arm_conv_partial_q31", cmsis_arm_conv_partial_q31, METH_VARARGS,""},
{"arm_conv_partial_fast_q31", cmsis_arm_conv_partial_fast_q31, METH_VARARGS,""},
{"arm_conv_partial_opt_q7", cmsis_arm_conv_partial_opt_q7, METH_VARARGS,""},
{"arm_conv_partial_q7", cmsis_arm_conv_partial_q7, METH_VARARGS,""},
{"arm_fir_decimate_f32", cmsis_arm_fir_decimate_f32, METH_VARARGS,""},
{"arm_fir_decimate_init_f32", cmsis_arm_fir_decimate_init_f32, METH_VARARGS,""},
{"arm_fir_decimate_q15", cmsis_arm_fir_decimate_q15, METH_VARARGS,""},
{"arm_fir_decimate_fast_q15", cmsis_arm_fir_decimate_fast_q15, METH_VARARGS,""},
{"arm_fir_decimate_init_q15", cmsis_arm_fir_decimate_init_q15, METH_VARARGS,""},
{"arm_fir_decimate_q31", cmsis_arm_fir_decimate_q31, METH_VARARGS,""},
{"arm_fir_decimate_fast_q31", cmsis_arm_fir_decimate_fast_q31, METH_VARARGS,""},
{"arm_fir_decimate_init_q31", cmsis_arm_fir_decimate_init_q31, METH_VARARGS,""},
{"arm_fir_interpolate_q15", cmsis_arm_fir_interpolate_q15, METH_VARARGS,""},
{"arm_fir_interpolate_init_q15", cmsis_arm_fir_interpolate_init_q15, METH_VARARGS,""},
{"arm_fir_interpolate_q31", cmsis_arm_fir_interpolate_q31, METH_VARARGS,""},
{"arm_fir_interpolate_init_q31", cmsis_arm_fir_interpolate_init_q31, METH_VARARGS,""},
{"arm_fir_interpolate_f32", cmsis_arm_fir_interpolate_f32, METH_VARARGS,""},
{"arm_fir_interpolate_init_f32", cmsis_arm_fir_interpolate_init_f32, METH_VARARGS,""},
{"arm_biquad_cas_df1_32x64_q31", cmsis_arm_biquad_cas_df1_32x64_q31, METH_VARARGS,""},
{"arm_biquad_cas_df1_32x64_init_q31", cmsis_arm_biquad_cas_df1_32x64_init_q31, METH_VARARGS,""},
{"arm_biquad_cascade_df2T_f32", cmsis_arm_biquad_cascade_df2T_f32, METH_VARARGS,""},
{"arm_biquad_cascade_stereo_df2T_f32", cmsis_arm_biquad_cascade_stereo_df2T_f32, METH_VARARGS,""},
{"arm_biquad_cascade_df2T_f64", cmsis_arm_biquad_cascade_df2T_f64, METH_VARARGS,""},
{"arm_biquad_cascade_df2T_init_f32", cmsis_arm_biquad_cascade_df2T_init_f32, METH_VARARGS,""},
{"arm_biquad_cascade_stereo_df2T_init_f32", cmsis_arm_biquad_cascade_stereo_df2T_init_f32, METH_VARARGS,""},
{"arm_biquad_cascade_df2T_init_f64", cmsis_arm_biquad_cascade_df2T_init_f64, METH_VARARGS,""},
{"arm_fir_lattice_init_q15", cmsis_arm_fir_lattice_init_q15, METH_VARARGS,""},
{"arm_fir_lattice_q15", cmsis_arm_fir_lattice_q15, METH_VARARGS,""},
{"arm_fir_lattice_init_q31", cmsis_arm_fir_lattice_init_q31, METH_VARARGS,""},
{"arm_fir_lattice_q31", cmsis_arm_fir_lattice_q31, METH_VARARGS,""},
{"arm_fir_lattice_init_f32", cmsis_arm_fir_lattice_init_f32, METH_VARARGS,""},
{"arm_fir_lattice_f32", cmsis_arm_fir_lattice_f32, METH_VARARGS,""},
{"arm_iir_lattice_f32", cmsis_arm_iir_lattice_f32, METH_VARARGS,""},
{"arm_iir_lattice_init_f32", cmsis_arm_iir_lattice_init_f32, METH_VARARGS,""},
{"arm_iir_lattice_q31", cmsis_arm_iir_lattice_q31, METH_VARARGS,""},
{"arm_iir_lattice_init_q31", cmsis_arm_iir_lattice_init_q31, METH_VARARGS,""},
{"arm_iir_lattice_q15", cmsis_arm_iir_lattice_q15, METH_VARARGS,""},
{"arm_iir_lattice_init_q15", cmsis_arm_iir_lattice_init_q15, METH_VARARGS,""},
{"arm_cfft_init_f32", cmsis_arm_cfft_init_f32, METH_VARARGS,""},
{"arm_cfft_init_q31", cmsis_arm_cfft_init_q31, METH_VARARGS,""},
{"arm_cfft_init_q15", cmsis_arm_cfft_init_q15, METH_VARARGS,""},
{"arm_lms_f32", cmsis_arm_lms_f32, METH_VARARGS,""},
{"arm_lms_init_f32", cmsis_arm_lms_init_f32, METH_VARARGS,""},
{"arm_lms_init_q15", cmsis_arm_lms_init_q15, METH_VARARGS,""},
{"arm_lms_q15", cmsis_arm_lms_q15, METH_VARARGS,""},
{"arm_lms_q31", cmsis_arm_lms_q31, METH_VARARGS,""},
{"arm_lms_init_q31", cmsis_arm_lms_init_q31, METH_VARARGS,""},
{"arm_lms_norm_f32", cmsis_arm_lms_norm_f32, METH_VARARGS,""},
{"arm_lms_norm_init_f32", cmsis_arm_lms_norm_init_f32, METH_VARARGS,""},
{"arm_lms_norm_q31", cmsis_arm_lms_norm_q31, METH_VARARGS,""},
{"arm_lms_norm_init_q31", cmsis_arm_lms_norm_init_q31, METH_VARARGS,""},
{"arm_lms_norm_q15", cmsis_arm_lms_norm_q15, METH_VARARGS,""},
{"arm_lms_norm_init_q15", cmsis_arm_lms_norm_init_q15, METH_VARARGS,""},
{"arm_correlate_f32", cmsis_arm_correlate_f32, METH_VARARGS,""},
{"arm_correlate_opt_q15", cmsis_arm_correlate_opt_q15, METH_VARARGS,""},
{"arm_correlate_q15", cmsis_arm_correlate_q15, METH_VARARGS,""},
{"arm_correlate_fast_q15", cmsis_arm_correlate_fast_q15, METH_VARARGS,""},
{"arm_correlate_fast_opt_q15", cmsis_arm_correlate_fast_opt_q15, METH_VARARGS,""},
{"arm_correlate_q31", cmsis_arm_correlate_q31, METH_VARARGS,""},
{"arm_correlate_fast_q31", cmsis_arm_correlate_fast_q31, METH_VARARGS,""},
{"arm_correlate_opt_q7", cmsis_arm_correlate_opt_q7, METH_VARARGS,""},
{"arm_correlate_q7", cmsis_arm_correlate_q7, METH_VARARGS,""},
{"arm_fir_sparse_f32", cmsis_arm_fir_sparse_f32, METH_VARARGS,""},
{"arm_fir_sparse_init_f32", cmsis_arm_fir_sparse_init_f32, METH_VARARGS,""},
{"arm_fir_sparse_init_q31", cmsis_arm_fir_sparse_init_q31, METH_VARARGS,""},
{"arm_fir_sparse_init_q15", cmsis_arm_fir_sparse_init_q15, METH_VARARGS,""},
{"arm_fir_sparse_init_q7", cmsis_arm_fir_sparse_init_q7, METH_VARARGS,""},
{"arm_sin_cos_f32", cmsis_arm_sin_cos_f32, METH_VARARGS,""},
{"arm_sin_cos_q31", cmsis_arm_sin_cos_q31, METH_VARARGS,""},
{"arm_cmplx_conj_f32", cmsis_arm_cmplx_conj_f32, METH_VARARGS,""},
{"arm_cmplx_conj_q31", cmsis_arm_cmplx_conj_q31, METH_VARARGS,""},
{"arm_cmplx_conj_q15", cmsis_arm_cmplx_conj_q15, METH_VARARGS,""},
{"arm_cmplx_mag_squared_f32", cmsis_arm_cmplx_mag_squared_f32, METH_VARARGS,""},
{"arm_cmplx_mag_squared_q31", cmsis_arm_cmplx_mag_squared_q31, METH_VARARGS,""},
{"arm_cmplx_mag_squared_q15", cmsis_arm_cmplx_mag_squared_q15, METH_VARARGS,""},
{"arm_pid_f32", cmsis_arm_pid_f32, METH_VARARGS,""},
{"arm_pid_q31", cmsis_arm_pid_q31, METH_VARARGS,""},
{"arm_pid_q15", cmsis_arm_pid_q15, METH_VARARGS,""},
{"arm_mat_inverse_f32", cmsis_arm_mat_inverse_f32, METH_VARARGS,""},
{"arm_mat_inverse_f64", cmsis_arm_mat_inverse_f64, METH_VARARGS,""},
{"arm_clarke_f32", cmsis_arm_clarke_f32, METH_VARARGS,""},
{"arm_clarke_q31", cmsis_arm_clarke_q31, METH_VARARGS,""},
{"arm_q7_to_q31", cmsis_arm_q7_to_q31, METH_VARARGS,""},
{"arm_inv_clarke_f32", cmsis_arm_inv_clarke_f32, METH_VARARGS,""},
{"arm_inv_clarke_q31", cmsis_arm_inv_clarke_q31, METH_VARARGS,""},
{"arm_q7_to_q15", cmsis_arm_q7_to_q15, METH_VARARGS,""},
{"arm_park_f32", cmsis_arm_park_f32, METH_VARARGS,""},
{"arm_park_q31", cmsis_arm_park_q31, METH_VARARGS,""},
{"arm_q7_to_float", cmsis_arm_q7_to_float, METH_VARARGS,""},
{"arm_inv_park_f32", cmsis_arm_inv_park_f32, METH_VARARGS,""},
{"arm_inv_park_q31", cmsis_arm_inv_park_q31, METH_VARARGS,""},
{"arm_q31_to_float", cmsis_arm_q31_to_float, METH_VARARGS,""},
{"arm_linear_interp_f32", cmsis_arm_linear_interp_f32, METH_VARARGS,""},
{"arm_linear_interp_q31", cmsis_arm_linear_interp_q31, METH_VARARGS,""},
{"arm_linear_interp_q15", cmsis_arm_linear_interp_q15, METH_VARARGS,""},
{"arm_linear_interp_q7", cmsis_arm_linear_interp_q7, METH_VARARGS,""},
{"arm_sin_f32", cmsis_arm_sin_f32, METH_VARARGS,""},
{"arm_sin_q31", cmsis_arm_sin_q31, METH_VARARGS,""},
{"arm_sin_q15", cmsis_arm_sin_q15, METH_VARARGS,""},
{"arm_cos_f32", cmsis_arm_cos_f32, METH_VARARGS,""},
{"arm_cos_q31", cmsis_arm_cos_q31, METH_VARARGS,""},
{"arm_cos_q15", cmsis_arm_cos_q15, METH_VARARGS,""},
{"arm_sqrt_f32", cmsis_arm_sqrt_f32, METH_VARARGS,""},
{"arm_sqrt_q31", cmsis_arm_sqrt_q31, METH_VARARGS,""},
{"arm_sqrt_q15", cmsis_arm_sqrt_q15, METH_VARARGS,""},
{"arm_circularWrite_f32", cmsis_arm_circularWrite_f32, METH_VARARGS,""},
{"arm_circularWrite_q15", cmsis_arm_circularWrite_q15, METH_VARARGS,""},
{"arm_circularWrite_q7", cmsis_arm_circularWrite_q7, METH_VARARGS,""},
{"arm_power_q31", cmsis_arm_power_q31, METH_VARARGS,""},
{"arm_power_f32", cmsis_arm_power_f32, METH_VARARGS,""},
{"arm_power_q15", cmsis_arm_power_q15, METH_VARARGS,""},
{"arm_power_q7", cmsis_arm_power_q7, METH_VARARGS,""},
{"arm_mean_q7", cmsis_arm_mean_q7, METH_VARARGS,""},
{"arm_mean_q15", cmsis_arm_mean_q15, METH_VARARGS,""},
{"arm_mean_q31", cmsis_arm_mean_q31, METH_VARARGS,""},
{"arm_mean_f32", cmsis_arm_mean_f32, METH_VARARGS,""},
{"arm_var_f32", cmsis_arm_var_f32, METH_VARARGS,""},
{"arm_var_q31", cmsis_arm_var_q31, METH_VARARGS,""},
{"arm_var_q15", cmsis_arm_var_q15, METH_VARARGS,""},
{"arm_rms_f32", cmsis_arm_rms_f32, METH_VARARGS,""},
{"arm_rms_q31", cmsis_arm_rms_q31, METH_VARARGS,""},
{"arm_rms_q15", cmsis_arm_rms_q15, METH_VARARGS,""},
{"arm_std_f32", cmsis_arm_std_f32, METH_VARARGS,""},
{"arm_std_q31", cmsis_arm_std_q31, METH_VARARGS,""},
{"arm_std_q15", cmsis_arm_std_q15, METH_VARARGS,""},
{"arm_cmplx_mag_f32", cmsis_arm_cmplx_mag_f32, METH_VARARGS,""},
{"arm_cmplx_mag_q31", cmsis_arm_cmplx_mag_q31, METH_VARARGS,""},
{"arm_cmplx_mag_q15", cmsis_arm_cmplx_mag_q15, METH_VARARGS,""},
{"arm_cmplx_dot_prod_q15", cmsis_arm_cmplx_dot_prod_q15, METH_VARARGS,""},
{"arm_cmplx_dot_prod_q31", cmsis_arm_cmplx_dot_prod_q31, METH_VARARGS,""},
{"arm_cmplx_dot_prod_f32", cmsis_arm_cmplx_dot_prod_f32, METH_VARARGS,""},
{"arm_cmplx_mult_real_q15", cmsis_arm_cmplx_mult_real_q15, METH_VARARGS,""},
{"arm_cmplx_mult_real_q31", cmsis_arm_cmplx_mult_real_q31, METH_VARARGS,""},
{"arm_cmplx_mult_real_f32", cmsis_arm_cmplx_mult_real_f32, METH_VARARGS,""},
{"arm_min_q7", cmsis_arm_min_q7, METH_VARARGS,""},
{"arm_min_q15", cmsis_arm_min_q15, METH_VARARGS,""},
{"arm_min_q31", cmsis_arm_min_q31, METH_VARARGS,""},
{"arm_min_f32", cmsis_arm_min_f32, METH_VARARGS,""},
{"arm_max_q7", cmsis_arm_max_q7, METH_VARARGS,""},
{"arm_max_q15", cmsis_arm_max_q15, METH_VARARGS,""},
{"arm_max_q31", cmsis_arm_max_q31, METH_VARARGS,""},
{"arm_max_f32", cmsis_arm_max_f32, METH_VARARGS,""},
{"arm_cmplx_mult_cmplx_q15", cmsis_arm_cmplx_mult_cmplx_q15, METH_VARARGS,""},
{"arm_cmplx_mult_cmplx_q31", cmsis_arm_cmplx_mult_cmplx_q31, METH_VARARGS,""},
{"arm_cmplx_mult_cmplx_f32", cmsis_arm_cmplx_mult_cmplx_f32, METH_VARARGS,""},
{"arm_float_to_q31", cmsis_arm_float_to_q31, METH_VARARGS,""},
{"arm_float_to_q15", cmsis_arm_float_to_q15, METH_VARARGS,""},
{"arm_float_to_q7", cmsis_arm_float_to_q7, METH_VARARGS,""},
{"arm_q31_to_q15", cmsis_arm_q31_to_q15, METH_VARARGS,""},
{"arm_q31_to_q7", cmsis_arm_q31_to_q7, METH_VARARGS,""},
{"arm_q15_to_float", cmsis_arm_q15_to_float, METH_VARARGS,""},
{"arm_q15_to_q31", cmsis_arm_q15_to_q31, METH_VARARGS,""},
{"arm_q15_to_q7", cmsis_arm_q15_to_q7, METH_VARARGS,""},
{"arm_bilinear_interp_f32", cmsis_arm_bilinear_interp_f32, METH_VARARGS,""},
{"arm_bilinear_interp_q31", cmsis_arm_bilinear_interp_q31, METH_VARARGS,""},
{"arm_bilinear_interp_q15", cmsis_arm_bilinear_interp_q15, METH_VARARGS,""},
{"arm_bilinear_interp_q7", cmsis_arm_bilinear_interp_q7, METH_VARARGS,""},
{"error_out", (PyCFunction)error_out, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL} /* Sentinel */
};
| 386,493 | C | 24.160732 | 253 | 0.684206 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix2_q15.c
* Description: Radix-2 Decimation in Frequency CFFT & CIFFT Fixed point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
void arm_radix2_butterfly_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef,
uint16_t twidCoefModifier);
void arm_radix2_butterfly_inverse_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef,
uint16_t twidCoefModifier);
void arm_bitreversal_q15(
q15_t * pSrc,
uint32_t fftLen,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the fixed-point CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q15 and will be removed in the future.
@param[in] S points to an instance of the fixed-point CFFT/CIFFT structure
@param[in,out] pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@return none
*/
void arm_cfft_radix2_q15(
const arm_cfft_radix2_instance_q15 * S,
q15_t * pSrc)
{
if (S->ifftFlag == 1U)
{
arm_radix2_butterfly_inverse_q15 (pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
else
{
arm_radix2_butterfly_q15 (pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
arm_bitreversal_q15(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
}
/**
@} end of ComplexFFT group
*/
void arm_radix2_butterfly_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef,
uint16_t twidCoefModifier)
{
#if defined (ARM_MATH_DSP)
uint32_t i, j, k, l;
uint32_t n1, n2, ia;
q15_t in;
q31_t T, S, R;
q31_t coeff, out1, out2;
//N = fftLen;
n2 = fftLen;
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
for (i = 0; i < n2; i++)
{
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
in = ((int16_t) (T & 0xFFFF)) >> 1;
T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
S = read_q15x2 (pSrc + (2 * l));
in = ((int16_t) (S & 0xFFFF)) >> 1;
S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUAD(coeff, R) >> 16;
out2 = __SMUSDX(coeff, R);
#else
out1 = __SMUSDX(R, coeff) >> 16U;
out2 = __SMUAD(coeff, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
/* loop for butterfly */
i++;
l++;
T = read_q15x2 (pSrc + (2 * i));
in = ((int16_t) (T & 0xFFFF)) >> 1;
T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
S = read_q15x2 (pSrc + (2 * l));
in = ((int16_t) (S & 0xFFFF)) >> 1;
S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUAD(coeff, R) >> 16;
out2 = __SMUSDX(coeff, R);
#else
out1 = __SMUSDX(R, coeff) >> 16U;
out2 = __SMUAD(coeff, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
/* loop for stage */
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUAD(coeff, R) >> 16;
out2 = __SMUSDX(coeff, R);
#else
out1 = __SMUSDX(R, coeff) >> 16U;
out2 = __SMUAD(coeff, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
i += n1;
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUAD(coeff, R) >> 16;
out2 = __SMUSDX(coeff, R);
#else
out1 = __SMUSDX(R, coeff) >> 16U;
out2 = __SMUAD(coeff, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2U * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
} /* stages loop end */
n1 = n2;
n2 = n2 >> 1;
ia = 0;
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = 0; i < fftLen; i += n1)
{
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __QADD16(T, S));
write_q15x2 (pSrc + (2 * l), R);
i += n1;
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __QADD16(T, S));
write_q15x2 (pSrc + (2 * l), R);
} /* groups loop end */
#else /* #if defined (ARM_MATH_DSP) */
uint32_t i, j, k, l;
uint32_t n1, n2, ia;
q15_t xt, yt, cosVal, sinVal;
// N = fftLen;
n2 = fftLen;
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
cosVal = pCoef[(ia * 2)];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
pSrc[2 * i + 1] = ((pSrc[2 * l + 1] >> 1U) +
(pSrc[2 * i + 1] >> 1U) ) >> 1U;
pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) +
((int16_t) (((q31_t) yt * sinVal) >> 16)));
pSrc[2U * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) -
((int16_t) (((q31_t) xt * sinVal) >> 16)));
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
/* loop for stage */
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U;
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U;
pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) +
((int16_t) (((q31_t) yt * sinVal) >> 16)));
pSrc[2U * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) -
((int16_t) (((q31_t) xt * sinVal) >> 16)));
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
} /* stages loop end */
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
pSrc[2 * l] = xt;
pSrc[2 * l + 1] = yt;
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
#endif /* #if defined (ARM_MATH_DSP) */
}
void arm_radix2_butterfly_inverse_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef,
uint16_t twidCoefModifier)
{
#if defined (ARM_MATH_DSP)
uint32_t i, j, k, l;
uint32_t n1, n2, ia;
q15_t in;
q31_t T, S, R;
q31_t coeff, out1, out2;
// N = fftLen;
n2 = fftLen;
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (i = 0; i < n2; i++)
{
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
in = ((int16_t) (T & 0xFFFF)) >> 1;
T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
S = read_q15x2 (pSrc + (2 * l));
in = ((int16_t) (S & 0xFFFF)) >> 1;
S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUSD(coeff, R) >> 16;
out2 = __SMUADX(coeff, R);
#else
out1 = __SMUADX(R, coeff) >> 16U;
out2 = __SMUSD(__QSUB(0, coeff), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
/* loop for butterfly */
i++;
l++;
T = read_q15x2 (pSrc + (2 * i));
in = ((int16_t) (T & 0xFFFF)) >> 1;
T = ((T >> 1) & 0xFFFF0000) | (in & 0xFFFF);
S = read_q15x2 (pSrc + (2 * l));
in = ((int16_t) (S & 0xFFFF)) >> 1;
S = ((S >> 1) & 0xFFFF0000) | (in & 0xFFFF);
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUSD(coeff, R) >> 16;
out2 = __SMUADX(coeff, R);
#else
out1 = __SMUADX(R, coeff) >> 16U;
out2 = __SMUSD(__QSUB(0, coeff), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
/* loop for stage */
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUSD(coeff, R) >> 16;
out2 = __SMUADX(coeff, R);
#else
out1 = __SMUADX(R, coeff) >> 16U;
out2 = __SMUSD(__QSUB(0, coeff), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
i += n1;
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUSD(coeff, R) >> 16;
out2 = __SMUADX(coeff, R);
#else
out1 = __SMUADX(R, coeff) >> 16U;
out2 = __SMUSD(__QSUB(0, coeff), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2 (pSrc + (2 * l), (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
} /* stages loop end */
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
coeff = read_q15x2 ((q15_t *)pCoef + (ia * 2U));
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
T = read_q15x2 (pSrc + (2 * i));
S = read_q15x2 (pSrc + (2 * l));
R = __QSUB16(T, S);
write_q15x2 (pSrc + (2 * i), __QADD16(T, S));
write_q15x2 (pSrc + (2 * l), R);
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
#else /* #if defined (ARM_MATH_DSP) */
uint32_t i, j, k, l;
uint32_t n1, n2, ia;
q15_t xt, yt, cosVal, sinVal;
// N = fftLen;
n2 = fftLen;
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
cosVal = pCoef[(ia * 2)];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
pSrc[2 * i + 1] = ((pSrc[2 * l + 1] >> 1U) +
(pSrc[2 * i + 1] >> 1U) ) >> 1U;
pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) -
((int16_t) (((q31_t) yt * sinVal) >> 16)));
pSrc[2 * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) +
((int16_t) (((q31_t) xt * sinVal) >> 16)));
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
/* loop for stage */
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
/* loop for groups */
for (j = 0; j < n2; j++)
{
cosVal = pCoef[(ia * 2)];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U;
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U;
pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16)) -
((int16_t) (((q31_t) yt * sinVal) >> 16)) );
pSrc[2 * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16)) +
((int16_t) (((q31_t) xt * sinVal) >> 16)) );
} /* butterfly loop end */
} /* groups loop end */
twidCoefModifier = twidCoefModifier << 1U;
} /* stages loop end */
n1 = n2;
n2 = n2 >> 1;
ia = 0;
cosVal = pCoef[(ia * 2)];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
/* loop for butterfly */
for (i = 0; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
pSrc[2 * l] = xt;
pSrc[2 * l + 1] = yt;
} /* groups loop end */
#endif /* #if defined (ARM_MATH_DSP) */
}
| 16,171 | C | 22.437681 | 121 | 0.473626 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix2_f32.c
* Description: Radix-2 Decimation in Frequency CFFT & CIFFT Floating point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
void arm_radix2_butterfly_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier);
void arm_radix2_butterfly_inverse_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier,
float32_t onebyfftLen);
extern void arm_bitreversal_f32(
float32_t * pSrc,
uint16_t fftSize,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Radix-2 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_f32 and will be removed in the future
@param[in] S points to an instance of the floating-point Radix-2 CFFT/CIFFT structure
@param[in,out] pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@return none
*/
void arm_cfft_radix2_f32(
const arm_cfft_radix2_instance_f32 * S,
float32_t * pSrc)
{
if (S->ifftFlag == 1U)
{
/* Complex IFFT radix-2 */
arm_radix2_butterfly_inverse_f32(pSrc, S->fftLen, S->pTwiddle,
S->twidCoefModifier, S->onebyfftLen);
}
else
{
/* Complex FFT radix-2 */
arm_radix2_butterfly_f32(pSrc, S->fftLen, S->pTwiddle,
S->twidCoefModifier);
}
if (S->bitReverseFlag == 1U)
{
/* Bit Reversal */
arm_bitreversal_f32(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
}
}
/**
@} end of ComplexFFT group
*/
/* ----------------------------------------------------------------------
** Internal helper function used by the FFTs
** ------------------------------------------------------------------- */
/**
brief Core function for the floating-point CFFT butterfly process.
param[in,out] pSrc points to in-place buffer of floating-point data type
param[in] fftLen length of the FFT
param[in] pCoef points to twiddle coefficient buffer
param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
return none
*/
void arm_radix2_butterfly_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier)
{
uint32_t i, j, k, l;
uint32_t n1, n2, ia;
float32_t xt, yt, cosVal, sinVal;
float32_t p0, p1, p2, p3;
float32_t a0, a1;
#if defined (ARM_MATH_DSP)
/* Initializations for the first stage */
n2 = fftLen >> 1;
ia = 0;
i = 0;
// loop for groups
for (k = n2; k > 0; k--)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
/* Twiddle coefficients index modifier */
ia += twidCoefModifier;
/* index calculation for the input as, */
/* pSrc[i + 0], pSrc[i + fftLen/1] */
l = i + n2;
/* Butterfly implementation */
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
p0 = xt * cosVal;
p1 = yt * sinVal;
p2 = yt * cosVal;
p3 = xt * sinVal;
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * l] = p0 + p1;
pSrc[2 * l + 1] = p2 - p3;
i++;
} // groups loop end
twidCoefModifier <<= 1U;
// loop for stage
for (k = n2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
j = 0;
do
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia += twidCoefModifier;
// loop for butterfly
i = j;
do
{
l = i + n2;
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
p0 = xt * cosVal;
p1 = yt * sinVal;
p2 = yt * cosVal;
p3 = xt * sinVal;
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * l] = p0 + p1;
pSrc[2 * l + 1] = p2 - p3;
i += n1;
} while ( i < fftLen ); // butterfly loop end
j++;
} while ( j < n2); // groups loop end
twidCoefModifier <<= 1U;
} // stages loop end
// loop for butterfly
for (i = 0; i < fftLen; i += 2)
{
a0 = pSrc[2 * i] + pSrc[2 * i + 2];
xt = pSrc[2 * i] - pSrc[2 * i + 2];
yt = pSrc[2 * i + 1] - pSrc[2 * i + 3];
a1 = pSrc[2 * i + 3] + pSrc[2 * i + 1];
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * i + 2] = xt;
pSrc[2 * i + 3] = yt;
} // groups loop end
#else /* #if defined (ARM_MATH_DSP) */
n2 = fftLen;
// loop for stage
for (k = fftLen; k > 1; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
j = 0;
do
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia += twidCoefModifier;
// loop for butterfly
i = j;
do
{
l = i + n2;
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
p0 = xt * cosVal;
p1 = yt * sinVal;
p2 = yt * cosVal;
p3 = xt * sinVal;
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * l] = p0 + p1;
pSrc[2 * l + 1] = p2 - p3;
i += n1;
} while (i < fftLen);
j++;
} while (j < n2);
twidCoefModifier <<= 1U;
}
#endif /* #if defined (ARM_MATH_DSP) */
}
void arm_radix2_butterfly_inverse_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier,
float32_t onebyfftLen)
{
uint32_t i, j, k, l;
uint32_t n1, n2, ia;
float32_t xt, yt, cosVal, sinVal;
float32_t p0, p1, p2, p3;
float32_t a0, a1;
#if defined (ARM_MATH_DSP)
n2 = fftLen >> 1;
ia = 0;
// loop for groups
for (i = 0; i < n2; i++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia += twidCoefModifier;
l = i + n2;
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
p0 = xt * cosVal;
p1 = yt * sinVal;
p2 = yt * cosVal;
p3 = xt * sinVal;
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * l] = p0 - p1;
pSrc[2 * l + 1] = p2 + p3;
} // groups loop end
twidCoefModifier <<= 1U;
// loop for stage
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
j = 0;
do
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia += twidCoefModifier;
// loop for butterfly
i = j;
do
{
l = i + n2;
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
p0 = xt * cosVal;
p1 = yt * sinVal;
p2 = yt * cosVal;
p3 = xt * sinVal;
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * l] = p0 - p1;
pSrc[2 * l + 1] = p2 + p3;
i += n1;
} while ( i < fftLen ); // butterfly loop end
j++;
} while (j < n2); // groups loop end
twidCoefModifier <<= 1U;
} // stages loop end
// loop for butterfly
for (i = 0; i < fftLen; i += 2)
{
a0 = pSrc[2 * i] + pSrc[2 * i + 2];
xt = pSrc[2 * i] - pSrc[2 * i + 2];
a1 = pSrc[2 * i + 3] + pSrc[2 * i + 1];
yt = pSrc[2 * i + 1] - pSrc[2 * i + 3];
p0 = a0 * onebyfftLen;
p2 = xt * onebyfftLen;
p1 = a1 * onebyfftLen;
p3 = yt * onebyfftLen;
pSrc[2 * i] = p0;
pSrc[2 * i + 1] = p1;
pSrc[2 * i + 2] = p2;
pSrc[2 * i + 3] = p3;
} // butterfly loop end
#else /* #if defined (ARM_MATH_DSP) */
n2 = fftLen;
// loop for stage
for (k = fftLen; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
j = 0;
do
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
// loop for butterfly
i = j;
do
{
l = i + n2;
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
p0 = xt * cosVal;
p1 = yt * sinVal;
p2 = yt * cosVal;
p3 = xt * sinVal;
pSrc[2 * i] = a0;
pSrc[2 * i + 1] = a1;
pSrc[2 * l] = p0 - p1;
pSrc[2 * l + 1] = p2 + p3;
i += n1;
} while ( i < fftLen ); // butterfly loop end
j++;
} while ( j < n2 ); // groups loop end
twidCoefModifier = twidCoefModifier << 1U;
} // stages loop end
n1 = n2;
n2 = n2 >> 1;
// loop for butterfly
for (i = 0; i < fftLen; i += n1)
{
l = i + n2;
a0 = pSrc[2 * i] + pSrc[2 * l];
xt = pSrc[2 * i] - pSrc[2 * l];
a1 = pSrc[2 * l + 1] + pSrc[2 * i + 1];
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
p0 = a0 * onebyfftLen;
p2 = xt * onebyfftLen;
p1 = a1 * onebyfftLen;
p3 = yt * onebyfftLen;
pSrc[2 * i] = p0;
pSrc[2 * l] = p2;
pSrc[2 * i + 1] = p1;
pSrc[2 * l + 1] = p3;
} // butterfly loop end
#endif /* #if defined (ARM_MATH_DSP) */
}
| 11,553 | C | 23.530786 | 130 | 0.439453 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_f32.c
* Description: RFFT & RIFFT Floating point process function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/* ----------------------------------------------------------------------
* Internal functions prototypes
* -------------------------------------------------------------------- */
extern void arm_radix4_butterfly_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier);
extern void arm_radix4_butterfly_inverse_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier,
float32_t onebyfftLen);
extern void arm_bitreversal_f32(
float32_t * pSrc,
uint16_t fftSize,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
void arm_split_rfft_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pATable,
const float32_t * pBTable,
float32_t * pDst,
uint32_t modifier);
void arm_split_rifft_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pATable,
const float32_t * pBTable,
float32_t * pDst,
uint32_t modifier);
/**
@ingroup groupTransforms
*/
/**
@addtogroup RealFFT
@{
*/
/**
@brief Processing function for the floating-point RFFT/RIFFT.
@deprecated Do not use this function. It has been superceded by \ref arm_rfft_fast_f32 and will be removed in the future.
@param[in] S points to an instance of the floating-point RFFT/RIFFT structure
@param[in] pSrc points to the input buffer
@param[out] pDst points to the output buffer
@return none
*/
void arm_rfft_f32(
const arm_rfft_instance_f32 * S,
float32_t * pSrc,
float32_t * pDst)
{
const arm_cfft_radix4_instance_f32 *S_CFFT = S->pCfft;
/* Calculation of Real IFFT of input */
if (S->ifftFlagR == 1U)
{
/* Real IFFT core process */
arm_split_rifft_f32 (pSrc, S->fftLenBy2, S->pTwiddleAReal, S->pTwiddleBReal, pDst, S->twidCoefRModifier);
/* Complex radix-4 IFFT process */
arm_radix4_butterfly_inverse_f32 (pDst, S_CFFT->fftLen, S_CFFT->pTwiddle, S_CFFT->twidCoefModifier, S_CFFT->onebyfftLen);
/* Bit reversal process */
if (S->bitReverseFlagR == 1U)
{
arm_bitreversal_f32 (pDst, S_CFFT->fftLen, S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
}
}
else
{
/* Calculation of RFFT of input */
/* Complex radix-4 FFT process */
arm_radix4_butterfly_f32 (pSrc, S_CFFT->fftLen, S_CFFT->pTwiddle, S_CFFT->twidCoefModifier);
/* Bit reversal process */
if (S->bitReverseFlagR == 1U)
{
arm_bitreversal_f32 (pSrc, S_CFFT->fftLen, S_CFFT->bitRevFactor, S_CFFT->pBitRevTable);
}
/* Real FFT core process */
arm_split_rfft_f32 (pSrc, S->fftLenBy2, S->pTwiddleAReal, S->pTwiddleBReal, pDst, S->twidCoefRModifier);
}
}
/**
@} end of RealFFT group
*/
/**
@brief Core Real FFT process
@param[in] pSrc points to input buffer
@param[in] fftLen length of FFT
@param[in] pATable points to twiddle Coef A buffer
@param[in] pBTable points to twiddle Coef B buffer
@param[out] pDst points to output buffer
@param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
*/
void arm_split_rfft_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pATable,
const float32_t * pBTable,
float32_t * pDst,
uint32_t modifier)
{
uint32_t i; /* Loop Counter */
float32_t outR, outI; /* Temporary variables for output */
const float32_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
float32_t CoefA1, CoefA2, CoefB1; /* Temporary variables for twiddle coefficients */
float32_t *pDst1 = &pDst[2], *pDst2 = &pDst[(4U * fftLen) - 1U]; /* temp pointers for output buffer */
float32_t *pSrc1 = &pSrc[2], *pSrc2 = &pSrc[(2U * fftLen) - 1U]; /* temp pointers for input buffer */
/* Init coefficient pointers */
pCoefA = &pATable[modifier * 2];
pCoefB = &pBTable[modifier * 2];
i = fftLen - 1U;
while (i > 0U)
{
/*
outR = ( pSrc[2 * i] * pATable[2 * i]
- pSrc[2 * i + 1] * pATable[2 * i + 1]
+ pSrc[2 * n - 2 * i] * pBTable[2 * i]
+ pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
outI = ( pIn[2 * i + 1] * pATable[2 * i]
+ pIn[2 * i] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
*/
/* read pATable[2 * i] */
CoefA1 = *pCoefA++;
/* pATable[2 * i + 1] */
CoefA2 = *pCoefA;
/* pSrc[2 * i] * pATable[2 * i] */
outR = *pSrc1 * CoefA1;
/* pSrc[2 * i] * CoefA2 */
outI = *pSrc1++ * CoefA2;
/* (pSrc[2 * i + 1] + pSrc[2 * fftLen - 2 * i + 1]) * CoefA2 */
outR -= (*pSrc1 + *pSrc2) * CoefA2;
/* pSrc[2 * i + 1] * CoefA1 */
outI += *pSrc1++ * CoefA1;
CoefB1 = *pCoefB;
/* pSrc[2 * fftLen - 2 * i + 1] * CoefB1 */
outI -= *pSrc2-- * CoefB1;
/* pSrc[2 * fftLen - 2 * i] * CoefA2 */
outI -= *pSrc2 * CoefA2;
/* pSrc[2 * fftLen - 2 * i] * CoefB1 */
outR += *pSrc2-- * CoefB1;
/* write output */
*pDst1++ = outR;
*pDst1++ = outI;
/* write complex conjugate output */
*pDst2-- = -outI;
*pDst2-- = outR;
/* update coefficient pointer */
pCoefB = pCoefB + (modifier * 2U);
pCoefA = pCoefA + ((modifier * 2U) - 1U);
i--;
}
pDst[2U * fftLen] = pSrc[0] - pSrc[1];
pDst[(2U * fftLen) + 1U] = 0.0f;
pDst[0] = pSrc[0] + pSrc[1];
pDst[1] = 0.0f;
}
/**
@brief Core Real IFFT process
@param[in] pSrc points to input buffer
@param[in] fftLen length of FFT
@param[in] pATable points to twiddle Coef A buffer
@param[in] pBTable points to twiddle Coef B buffer
@param[out] pDst points to output buffer
@param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
*/
void arm_split_rifft_f32(
float32_t * pSrc,
uint32_t fftLen,
const float32_t * pATable,
const float32_t * pBTable,
float32_t * pDst,
uint32_t modifier)
{
float32_t outR, outI; /* Temporary variables for output */
const float32_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
float32_t CoefA1, CoefA2, CoefB1; /* Temporary variables for twiddle coefficients */
float32_t *pSrc1 = &pSrc[0], *pSrc2 = &pSrc[(2U * fftLen) + 1U];
pCoefA = &pATable[0];
pCoefB = &pBTable[0];
while (fftLen > 0U)
{
/*
outR = ( pIn[2 * i] * pATable[2 * i]
+ pIn[2 * i + 1] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
outI = ( pIn[2 * i + 1] * pATable[2 * i]
- pIn[2 * i] * pATable[2 * i + 1]
- pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
*/
CoefA1 = *pCoefA++;
CoefA2 = *pCoefA;
/* outR = (pSrc[2 * i] * CoefA1 */
outR = *pSrc1 * CoefA1;
/* - pSrc[2 * i] * CoefA2 */
outI = -(*pSrc1++) * CoefA2;
/* (pSrc[2 * i + 1] + pSrc[2 * fftLen - 2 * i + 1]) * CoefA2 */
outR += (*pSrc1 + *pSrc2) * CoefA2;
/* pSrc[2 * i + 1] * CoefA1 */
outI += (*pSrc1++) * CoefA1;
CoefB1 = *pCoefB;
/* - pSrc[2 * fftLen - 2 * i + 1] * CoefB1 */
outI -= *pSrc2-- * CoefB1;
/* pSrc[2 * fftLen - 2 * i] * CoefB1 */
outR += *pSrc2 * CoefB1;
/* pSrc[2 * fftLen - 2 * i] * CoefA2 */
outI += *pSrc2-- * CoefA2;
/* write output */
*pDst++ = outR;
*pDst++ = outI;
/* update coefficient pointer */
pCoefB = pCoefB + (modifier * 2);
pCoefA = pCoefA + (modifier * 2 - 1);
/* Decrement loop count */
fftLen--;
}
}
| 9,326 | C | 29.087097 | 127 | 0.533884 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix4_f32.c
* Description: Radix-4 Decimation in Frequency CFFT & CIFFT Floating point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
extern void arm_bitreversal_f32(
float32_t * pSrc,
uint16_t fftSize,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
void arm_radix4_butterfly_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier);
void arm_radix4_butterfly_inverse_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier,
float32_t onebyfftLen);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the floating-point Radix-4 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_f32 and will be removed in the future.
@param[in] S points to an instance of the floating-point Radix-4 CFFT/CIFFT structure
@param[in,out] pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@return none
*/
void arm_cfft_radix4_f32(
const arm_cfft_radix4_instance_f32 * S,
float32_t * pSrc)
{
if (S->ifftFlag == 1U)
{
/* Complex IFFT radix-4 */
arm_radix4_butterfly_inverse_f32(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier, S->onebyfftLen);
}
else
{
/* Complex FFT radix-4 */
arm_radix4_butterfly_f32(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
if (S->bitReverseFlag == 1U)
{
/* Bit Reversal */
arm_bitreversal_f32(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
}
}
/**
@} end of ComplexFFT group
*/
/* ----------------------------------------------------------------------
* Internal helper function used by the FFTs
* ---------------------------------------------------------------------- */
/**
brief Core function for the floating-point CFFT butterfly process.
param[in,out] pSrc points to the in-place buffer of floating-point data type
param[in] fftLen length of the FFT
param[in] pCoef points to the twiddle coefficient buffer
param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
return none
*/
void arm_radix4_butterfly_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier)
{
float32_t co1, co2, co3, si1, si2, si3;
uint32_t ia1, ia2, ia3;
uint32_t i0, i1, i2, i3;
uint32_t n1, n2, j, k;
#if defined (ARM_MATH_LOOPUNROLL)
float32_t xaIn, yaIn, xbIn, ybIn, xcIn, ycIn, xdIn, ydIn;
float32_t Xaplusc, Xbplusd, Yaplusc, Ybplusd, Xaminusc, Xbminusd, Yaminusc,
Ybminusd;
float32_t Xb12C_out, Yb12C_out, Xc12C_out, Yc12C_out, Xd12C_out, Yd12C_out;
float32_t Xb12_out, Yb12_out, Xc12_out, Yc12_out, Xd12_out, Yd12_out;
float32_t *ptr1;
float32_t p0,p1,p2,p3,p4,p5;
float32_t a0,a1,a2,a3,a4,a5,a6,a7;
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
i0 = 0U;
ia1 = 0U;
j = n2;
/* Calculation of first stage */
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
xaIn = pSrc[(2U * i0)];
yaIn = pSrc[(2U * i0) + 1U];
xbIn = pSrc[(2U * i1)];
ybIn = pSrc[(2U * i1) + 1U];
xcIn = pSrc[(2U * i2)];
ycIn = pSrc[(2U * i2) + 1U];
xdIn = pSrc[(2U * i3)];
ydIn = pSrc[(2U * i3) + 1U];
/* xa + xc */
Xaplusc = xaIn + xcIn;
/* xb + xd */
Xbplusd = xbIn + xdIn;
/* ya + yc */
Yaplusc = yaIn + ycIn;
/* yb + yd */
Ybplusd = ybIn + ydIn;
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
co2 = pCoef[ia2 * 2U];
si2 = pCoef[(ia2 * 2U) + 1U];
/* xa - xc */
Xaminusc = xaIn - xcIn;
/* xb - xd */
Xbminusd = xbIn - xdIn;
/* ya - yc */
Yaminusc = yaIn - ycIn;
/* yb - yd */
Ybminusd = ybIn - ydIn;
/* xa' = xa + xb + xc + xd */
pSrc[(2U * i0)] = Xaplusc + Xbplusd;
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
/* (xa - xc) + (yb - yd) */
Xb12C_out = (Xaminusc + Ybminusd);
/* (ya - yc) + (xb - xd) */
Yb12C_out = (Yaminusc - Xbminusd);
/* (xa + xc) - (xb + xd) */
Xc12C_out = (Xaplusc - Xbplusd);
/* (ya + yc) - (yb + yd) */
Yc12C_out = (Yaplusc - Ybplusd);
/* (xa - xc) - (yb - yd) */
Xd12C_out = (Xaminusc - Ybminusd);
/* (ya - yc) + (xb - xd) */
Yd12C_out = (Xbminusd + Yaminusc);
co1 = pCoef[ia1 * 2U];
si1 = pCoef[(ia1 * 2U) + 1U];
/* index calculation for the coefficients */
ia3 = ia2 + ia1;
co3 = pCoef[ia3 * 2U];
si3 = pCoef[(ia3 * 2U) + 1U];
Xb12_out = Xb12C_out * co1;
Yb12_out = Yb12C_out * co1;
Xc12_out = Xc12C_out * co2;
Yc12_out = Yc12C_out * co2;
Xd12_out = Xd12C_out * co3;
Yd12_out = Yd12C_out * co3;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
//Xb12_out -= Yb12C_out * si1;
p0 = Yb12C_out * si1;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
//Yb12_out += Xb12C_out * si1;
p1 = Xb12C_out * si1;
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
//Xc12_out -= Yc12C_out * si2;
p2 = Yc12C_out * si2;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
//Yc12_out += Xc12C_out * si2;
p3 = Xc12C_out * si2;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
//Xd12_out -= Yd12C_out * si3;
p4 = Yd12C_out * si3;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
//Yd12_out += Xd12C_out * si3;
p5 = Xd12C_out * si3;
Xb12_out += p0;
Yb12_out -= p1;
Xc12_out += p2;
Yc12_out -= p3;
Xd12_out += p4;
Yd12_out -= p5;
/* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = Xc12_out;
/* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = Yc12_out;
/* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = Xb12_out;
/* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = Yb12_out;
/* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = Xd12_out;
/* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = Yd12_out;
/* Twiddle coefficients index modifier */
ia1 += twidCoefModifier;
/* Updating input index */
i0++;
}
while (--j);
twidCoefModifier <<= 2U;
/* Calculation of second stage to excluding last stage */
for (k = fftLen >> 2U; k > 4U; k >>= 2U)
{
/* Initializations for the first stage */
n1 = n2;
n2 >>= 2U;
ia1 = 0U;
/* Calculation of first stage */
j = 0;
do
{
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
ia3 = ia2 + ia1;
co1 = pCoef[(ia1 * 2U)];
si1 = pCoef[(ia1 * 2U) + 1U];
co2 = pCoef[(ia2 * 2U)];
si2 = pCoef[(ia2 * 2U) + 1U];
co3 = pCoef[(ia3 * 2U)];
si3 = pCoef[(ia3 * 2U) + 1U];
/* Twiddle coefficients index modifier */
ia1 += twidCoefModifier;
i0 = j;
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
xaIn = pSrc[(2U * i0)];
yaIn = pSrc[(2U * i0) + 1U];
xbIn = pSrc[(2U * i1)];
ybIn = pSrc[(2U * i1) + 1U];
xcIn = pSrc[(2U * i2)];
ycIn = pSrc[(2U * i2) + 1U];
xdIn = pSrc[(2U * i3)];
ydIn = pSrc[(2U * i3) + 1U];
/* xa - xc */
Xaminusc = xaIn - xcIn;
/* (xb - xd) */
Xbminusd = xbIn - xdIn;
/* ya - yc */
Yaminusc = yaIn - ycIn;
/* (yb - yd) */
Ybminusd = ybIn - ydIn;
/* xa + xc */
Xaplusc = xaIn + xcIn;
/* xb + xd */
Xbplusd = xbIn + xdIn;
/* ya + yc */
Yaplusc = yaIn + ycIn;
/* yb + yd */
Ybplusd = ybIn + ydIn;
/* (xa - xc) + (yb - yd) */
Xb12C_out = (Xaminusc + Ybminusd);
/* (ya - yc) - (xb - xd) */
Yb12C_out = (Yaminusc - Xbminusd);
/* xa + xc -(xb + xd) */
Xc12C_out = (Xaplusc - Xbplusd);
/* (ya + yc) - (yb + yd) */
Yc12C_out = (Yaplusc - Ybplusd);
/* (xa - xc) - (yb - yd) */
Xd12C_out = (Xaminusc - Ybminusd);
/* (ya - yc) + (xb - xd) */
Yd12C_out = (Xbminusd + Yaminusc);
pSrc[(2U * i0)] = Xaplusc + Xbplusd;
pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
Xb12_out = Xb12C_out * co1;
Yb12_out = Yb12C_out * co1;
Xc12_out = Xc12C_out * co2;
Yc12_out = Yc12C_out * co2;
Xd12_out = Xd12C_out * co3;
Yd12_out = Yd12C_out * co3;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
//Xb12_out -= Yb12C_out * si1;
p0 = Yb12C_out * si1;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
//Yb12_out += Xb12C_out * si1;
p1 = Xb12C_out * si1;
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
//Xc12_out -= Yc12C_out * si2;
p2 = Yc12C_out * si2;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
//Yc12_out += Xc12C_out * si2;
p3 = Xc12C_out * si2;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
//Xd12_out -= Yd12C_out * si3;
p4 = Yd12C_out * si3;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
//Yd12_out += Xd12C_out * si3;
p5 = Xd12C_out * si3;
Xb12_out += p0;
Yb12_out -= p1;
Xc12_out += p2;
Yc12_out -= p3;
Xd12_out += p4;
Yd12_out -= p5;
/* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = Xc12_out;
/* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = Yc12_out;
/* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = Xb12_out;
/* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = Yb12_out;
/* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = Xd12_out;
/* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = Yd12_out;
i0 += n1;
} while (i0 < fftLen);
j++;
} while (j <= (n2 - 1U));
twidCoefModifier <<= 2U;
}
j = fftLen >> 2;
ptr1 = &pSrc[0];
/* Calculations of last stage */
do
{
xaIn = ptr1[0];
yaIn = ptr1[1];
xbIn = ptr1[2];
ybIn = ptr1[3];
xcIn = ptr1[4];
ycIn = ptr1[5];
xdIn = ptr1[6];
ydIn = ptr1[7];
/* xa + xc */
Xaplusc = xaIn + xcIn;
/* xa - xc */
Xaminusc = xaIn - xcIn;
/* ya + yc */
Yaplusc = yaIn + ycIn;
/* ya - yc */
Yaminusc = yaIn - ycIn;
/* xb + xd */
Xbplusd = xbIn + xdIn;
/* yb + yd */
Ybplusd = ybIn + ydIn;
/* (xb-xd) */
Xbminusd = xbIn - xdIn;
/* (yb-yd) */
Ybminusd = ybIn - ydIn;
/* xa' = xa + xb + xc + xd */
a0 = (Xaplusc + Xbplusd);
/* ya' = ya + yb + yc + yd */
a1 = (Yaplusc + Ybplusd);
/* xc' = (xa-xb+xc-xd) */
a2 = (Xaplusc - Xbplusd);
/* yc' = (ya-yb+yc-yd) */
a3 = (Yaplusc - Ybplusd);
/* xb' = (xa+yb-xc-yd) */
a4 = (Xaminusc + Ybminusd);
/* yb' = (ya-xb-yc+xd) */
a5 = (Yaminusc - Xbminusd);
/* xd' = (xa-yb-xc+yd)) */
a6 = (Xaminusc - Ybminusd);
/* yd' = (ya+xb-yc-xd) */
a7 = (Xbminusd + Yaminusc);
ptr1[0] = a0;
ptr1[1] = a1;
ptr1[2] = a2;
ptr1[3] = a3;
ptr1[4] = a4;
ptr1[5] = a5;
ptr1[6] = a6;
ptr1[7] = a7;
/* increment pointer by 8 */
ptr1 += 8U;
} while (--j);
#else
float32_t t1, t2, r1, r2, s1, s2;
/* Initializations for the fft calculation */
n2 = fftLen;
n1 = n2;
for (k = fftLen; k > 1U; k >>= 2U)
{
/* Initializations for the fft calculation */
n1 = n2;
n2 >>= 2U;
ia1 = 0U;
/* FFT Calculation */
j = 0;
do
{
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
ia3 = ia2 + ia1;
co1 = pCoef[ia1 * 2U];
si1 = pCoef[(ia1 * 2U) + 1U];
co2 = pCoef[ia2 * 2U];
si2 = pCoef[(ia2 * 2U) + 1U];
co3 = pCoef[ia3 * 2U];
si3 = pCoef[(ia3 * 2U) + 1U];
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
i0 = j;
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* xa + xc */
r1 = pSrc[(2U * i0)] + pSrc[(2U * i2)];
/* xa - xc */
r2 = pSrc[(2U * i0)] - pSrc[(2U * i2)];
/* ya + yc */
s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
/* ya - yc */
s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
/* xb + xd */
t1 = pSrc[2U * i1] + pSrc[2U * i3];
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = r1 + t1;
/* xa + xc -(xb + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = s1 + t2;
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* (yb - yd) */
t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
/* (xb - xd) */
t2 = pSrc[2U * i1] - pSrc[2U * i3];
/* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = (r1 * co2) + (s1 * si2);
/* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = (s1 * co2) - (r1 * si2);
/* (xa - xc) + (yb - yd) */
r1 = r2 + t1;
/* (xa - xc) - (yb - yd) */
r2 = r2 - t1;
/* (ya - yc) - (xb - xd) */
s1 = s2 - t2;
/* (ya - yc) + (xb - xd) */
s2 = s2 + t2;
/* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = (r1 * co1) + (s1 * si1);
/* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = (s1 * co1) - (r1 * si1);
/* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = (r2 * co3) + (s2 * si3);
/* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = (s2 * co3) - (r2 * si3);
i0 += n1;
} while ( i0 < fftLen);
j++;
} while (j <= (n2 - 1U));
twidCoefModifier <<= 2U;
}
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
}
/**
brief Core function for the floating-point CIFFT butterfly process.
param[in,out] pSrc points to the in-place buffer of floating-point data type
param[in] fftLen length of the FFT
param[in] pCoef points to twiddle coefficient buffer
param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
param[in] onebyfftLen value of 1/fftLen
return none
*/
void arm_radix4_butterfly_inverse_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier,
float32_t onebyfftLen)
{
float32_t co1, co2, co3, si1, si2, si3;
uint32_t ia1, ia2, ia3;
uint32_t i0, i1, i2, i3;
uint32_t n1, n2, j, k;
#if defined (ARM_MATH_LOOPUNROLL)
float32_t xaIn, yaIn, xbIn, ybIn, xcIn, ycIn, xdIn, ydIn;
float32_t Xaplusc, Xbplusd, Yaplusc, Ybplusd, Xaminusc, Xbminusd, Yaminusc,
Ybminusd;
float32_t Xb12C_out, Yb12C_out, Xc12C_out, Yc12C_out, Xd12C_out, Yd12C_out;
float32_t Xb12_out, Yb12_out, Xc12_out, Yc12_out, Xd12_out, Yd12_out;
float32_t *ptr1;
float32_t p0,p1,p2,p3,p4,p5,p6,p7;
float32_t a0,a1,a2,a3,a4,a5,a6,a7;
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
i0 = 0U;
ia1 = 0U;
j = n2;
/* Calculation of first stage */
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Butterfly implementation */
xaIn = pSrc[(2U * i0)];
yaIn = pSrc[(2U * i0) + 1U];
xcIn = pSrc[(2U * i2)];
ycIn = pSrc[(2U * i2) + 1U];
xbIn = pSrc[(2U * i1)];
ybIn = pSrc[(2U * i1) + 1U];
xdIn = pSrc[(2U * i3)];
ydIn = pSrc[(2U * i3) + 1U];
/* xa + xc */
Xaplusc = xaIn + xcIn;
/* xb + xd */
Xbplusd = xbIn + xdIn;
/* ya + yc */
Yaplusc = yaIn + ycIn;
/* yb + yd */
Ybplusd = ybIn + ydIn;
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
co2 = pCoef[ia2 * 2U];
si2 = pCoef[(ia2 * 2U) + 1U];
/* xa - xc */
Xaminusc = xaIn - xcIn;
/* xb - xd */
Xbminusd = xbIn - xdIn;
/* ya - yc */
Yaminusc = yaIn - ycIn;
/* yb - yd */
Ybminusd = ybIn - ydIn;
/* xa' = xa + xb + xc + xd */
pSrc[(2U * i0)] = Xaplusc + Xbplusd;
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
/* (xa - xc) - (yb - yd) */
Xb12C_out = (Xaminusc - Ybminusd);
/* (ya - yc) + (xb - xd) */
Yb12C_out = (Yaminusc + Xbminusd);
/* (xa + xc) - (xb + xd) */
Xc12C_out = (Xaplusc - Xbplusd);
/* (ya + yc) - (yb + yd) */
Yc12C_out = (Yaplusc - Ybplusd);
/* (xa - xc) + (yb - yd) */
Xd12C_out = (Xaminusc + Ybminusd);
/* (ya - yc) - (xb - xd) */
Yd12C_out = (Yaminusc - Xbminusd);
co1 = pCoef[ia1 * 2U];
si1 = pCoef[(ia1 * 2U) + 1U];
/* index calculation for the coefficients */
ia3 = ia2 + ia1;
co3 = pCoef[ia3 * 2U];
si3 = pCoef[(ia3 * 2U) + 1U];
Xb12_out = Xb12C_out * co1;
Yb12_out = Yb12C_out * co1;
Xc12_out = Xc12C_out * co2;
Yc12_out = Yc12C_out * co2;
Xd12_out = Xd12C_out * co3;
Yd12_out = Yd12C_out * co3;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
//Xb12_out -= Yb12C_out * si1;
p0 = Yb12C_out * si1;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
//Yb12_out += Xb12C_out * si1;
p1 = Xb12C_out * si1;
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
//Xc12_out -= Yc12C_out * si2;
p2 = Yc12C_out * si2;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
//Yc12_out += Xc12C_out * si2;
p3 = Xc12C_out * si2;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
//Xd12_out -= Yd12C_out * si3;
p4 = Yd12C_out * si3;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
//Yd12_out += Xd12C_out * si3;
p5 = Xd12C_out * si3;
Xb12_out -= p0;
Yb12_out += p1;
Xc12_out -= p2;
Yc12_out += p3;
Xd12_out -= p4;
Yd12_out += p5;
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = Xc12_out;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = Yc12_out;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = Xb12_out;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = Yb12_out;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = Xd12_out;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = Yd12_out;
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
/* Updating input index */
i0 = i0 + 1U;
} while (--j);
twidCoefModifier <<= 2U;
/* Calculation of second stage to excluding last stage */
for (k = fftLen >> 2U; k > 4U; k >>= 2U)
{
/* Initializations for the first stage */
n1 = n2;
n2 >>= 2U;
ia1 = 0U;
/* Calculation of first stage */
j = 0;
do
{
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
ia3 = ia2 + ia1;
co1 = pCoef[ia1 * 2U];
si1 = pCoef[(ia1 * 2U) + 1U];
co2 = pCoef[ia2 * 2U];
si2 = pCoef[(ia2 * 2U) + 1U];
co3 = pCoef[ia3 * 2U];
si3 = pCoef[(ia3 * 2U) + 1U];
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
i0 = j;
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
xaIn = pSrc[(2U * i0)];
yaIn = pSrc[(2U * i0) + 1U];
xbIn = pSrc[(2U * i1)];
ybIn = pSrc[(2U * i1) + 1U];
xcIn = pSrc[(2U * i2)];
ycIn = pSrc[(2U * i2) + 1U];
xdIn = pSrc[(2U * i3)];
ydIn = pSrc[(2U * i3) + 1U];
/* xa - xc */
Xaminusc = xaIn - xcIn;
/* (xb - xd) */
Xbminusd = xbIn - xdIn;
/* ya - yc */
Yaminusc = yaIn - ycIn;
/* (yb - yd) */
Ybminusd = ybIn - ydIn;
/* xa + xc */
Xaplusc = xaIn + xcIn;
/* xb + xd */
Xbplusd = xbIn + xdIn;
/* ya + yc */
Yaplusc = yaIn + ycIn;
/* yb + yd */
Ybplusd = ybIn + ydIn;
/* (xa - xc) - (yb - yd) */
Xb12C_out = (Xaminusc - Ybminusd);
/* (ya - yc) + (xb - xd) */
Yb12C_out = (Yaminusc + Xbminusd);
/* xa + xc -(xb + xd) */
Xc12C_out = (Xaplusc - Xbplusd);
/* (ya + yc) - (yb + yd) */
Yc12C_out = (Yaplusc - Ybplusd);
/* (xa - xc) + (yb - yd) */
Xd12C_out = (Xaminusc + Ybminusd);
/* (ya - yc) - (xb - xd) */
Yd12C_out = (Yaminusc - Xbminusd);
pSrc[(2U * i0)] = Xaplusc + Xbplusd;
pSrc[(2U * i0) + 1U] = Yaplusc + Ybplusd;
Xb12_out = Xb12C_out * co1;
Yb12_out = Yb12C_out * co1;
Xc12_out = Xc12C_out * co2;
Yc12_out = Yc12C_out * co2;
Xd12_out = Xd12C_out * co3;
Yd12_out = Yd12C_out * co3;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
//Xb12_out -= Yb12C_out * si1;
p0 = Yb12C_out * si1;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
//Yb12_out += Xb12C_out * si1;
p1 = Xb12C_out * si1;
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
//Xc12_out -= Yc12C_out * si2;
p2 = Yc12C_out * si2;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
//Yc12_out += Xc12C_out * si2;
p3 = Xc12C_out * si2;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
//Xd12_out -= Yd12C_out * si3;
p4 = Yd12C_out * si3;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
//Yd12_out += Xd12C_out * si3;
p5 = Xd12C_out * si3;
Xb12_out -= p0;
Yb12_out += p1;
Xc12_out -= p2;
Yc12_out += p3;
Xd12_out -= p4;
Yd12_out += p5;
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = Xc12_out;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = Yc12_out;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = Xb12_out;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = Yb12_out;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = Xd12_out;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = Yd12_out;
i0 += n1;
} while (i0 < fftLen);
j++;
} while (j <= (n2 - 1U));
twidCoefModifier <<= 2U;
}
/* Initializations of last stage */
j = fftLen >> 2;
ptr1 = &pSrc[0];
/* Calculations of last stage */
do
{
xaIn = ptr1[0];
yaIn = ptr1[1];
xbIn = ptr1[2];
ybIn = ptr1[3];
xcIn = ptr1[4];
ycIn = ptr1[5];
xdIn = ptr1[6];
ydIn = ptr1[7];
/* Butterfly implementation */
/* xa + xc */
Xaplusc = xaIn + xcIn;
/* xa - xc */
Xaminusc = xaIn - xcIn;
/* ya + yc */
Yaplusc = yaIn + ycIn;
/* ya - yc */
Yaminusc = yaIn - ycIn;
/* xb + xd */
Xbplusd = xbIn + xdIn;
/* yb + yd */
Ybplusd = ybIn + ydIn;
/* (xb-xd) */
Xbminusd = xbIn - xdIn;
/* (yb-yd) */
Ybminusd = ybIn - ydIn;
/* xa' = (xa+xb+xc+xd) * onebyfftLen */
a0 = (Xaplusc + Xbplusd);
/* ya' = (ya+yb+yc+yd) * onebyfftLen */
a1 = (Yaplusc + Ybplusd);
/* xc' = (xa-xb+xc-xd) * onebyfftLen */
a2 = (Xaplusc - Xbplusd);
/* yc' = (ya-yb+yc-yd) * onebyfftLen */
a3 = (Yaplusc - Ybplusd);
/* xb' = (xa-yb-xc+yd) * onebyfftLen */
a4 = (Xaminusc - Ybminusd);
/* yb' = (ya+xb-yc-xd) * onebyfftLen */
a5 = (Yaminusc + Xbminusd);
/* xd' = (xa-yb-xc+yd) * onebyfftLen */
a6 = (Xaminusc + Ybminusd);
/* yd' = (ya-xb-yc+xd) * onebyfftLen */
a7 = (Yaminusc - Xbminusd);
p0 = a0 * onebyfftLen;
p1 = a1 * onebyfftLen;
p2 = a2 * onebyfftLen;
p3 = a3 * onebyfftLen;
p4 = a4 * onebyfftLen;
p5 = a5 * onebyfftLen;
p6 = a6 * onebyfftLen;
p7 = a7 * onebyfftLen;
/* xa' = (xa+xb+xc+xd) * onebyfftLen */
ptr1[0] = p0;
/* ya' = (ya+yb+yc+yd) * onebyfftLen */
ptr1[1] = p1;
/* xc' = (xa-xb+xc-xd) * onebyfftLen */
ptr1[2] = p2;
/* yc' = (ya-yb+yc-yd) * onebyfftLen */
ptr1[3] = p3;
/* xb' = (xa-yb-xc+yd) * onebyfftLen */
ptr1[4] = p4;
/* yb' = (ya+xb-yc-xd) * onebyfftLen */
ptr1[5] = p5;
/* xd' = (xa-yb-xc+yd) * onebyfftLen */
ptr1[6] = p6;
/* yd' = (ya-xb-yc+xd) * onebyfftLen */
ptr1[7] = p7;
/* increment source pointer by 8 for next calculations */
ptr1 = ptr1 + 8U;
} while (--j);
#else
float32_t t1, t2, r1, r2, s1, s2;
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* Calculation of first stage */
for (k = fftLen; k > 4U; k >>= 2U)
{
/* Initializations for the first stage */
n1 = n2;
n2 >>= 2U;
ia1 = 0U;
/* Calculation of first stage */
j = 0;
do
{
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
ia3 = ia2 + ia1;
co1 = pCoef[ia1 * 2U];
si1 = pCoef[(ia1 * 2U) + 1U];
co2 = pCoef[ia2 * 2U];
si2 = pCoef[(ia2 * 2U) + 1U];
co3 = pCoef[ia3 * 2U];
si3 = pCoef[(ia3 * 2U) + 1U];
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
i0 = j;
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* xa + xc */
r1 = pSrc[(2U * i0)] + pSrc[(2U * i2)];
/* xa - xc */
r2 = pSrc[(2U * i0)] - pSrc[(2U * i2)];
/* ya + yc */
s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
/* ya - yc */
s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
/* xb + xd */
t1 = pSrc[2U * i1] + pSrc[2U * i3];
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = r1 + t1;
/* xa + xc -(xb + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = s1 + t2;
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* (yb - yd) */
t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
/* (xb - xd) */
t2 = pSrc[2U * i1] - pSrc[2U * i3];
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = (r1 * co2) - (s1 * si2);
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = (s1 * co2) + (r1 * si2);
/* (xa - xc) - (yb - yd) */
r1 = r2 - t1;
/* (xa - xc) + (yb - yd) */
r2 = r2 + t1;
/* (ya - yc) + (xb - xd) */
s1 = s2 + t2;
/* (ya - yc) - (xb - xd) */
s2 = s2 - t2;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = (r1 * co1) - (s1 * si1);
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = (s1 * co1) + (r1 * si1);
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = (r2 * co3) - (s2 * si3);
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = (s2 * co3) + (r2 * si3);
i0 += n1;
} while ( i0 < fftLen);
j++;
} while (j <= (n2 - 1U));
twidCoefModifier <<= 2U;
}
/* Initializations of last stage */
n1 = n2;
n2 >>= 2U;
/* Calculations of last stage */
for (i0 = 0U; i0 <= (fftLen - n1); i0 += n1)
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Butterfly implementation */
/* xa + xc */
r1 = pSrc[2U * i0] + pSrc[2U * i2];
/* xa - xc */
r2 = pSrc[2U * i0] - pSrc[2U * i2];
/* ya + yc */
s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
/* ya - yc */
s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
/* xc + xd */
t1 = pSrc[2U * i1] + pSrc[2U * i3];
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = (r1 + t1) * onebyfftLen;
/* (xa + xb) - (xc + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = (s1 + t2) * onebyfftLen;
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* (yb-yd) */
t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
/* (xb-xd) */
t2 = pSrc[2U * i1] - pSrc[2U * i3];
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = r1 * onebyfftLen;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = s1 * onebyfftLen;
/* (xa - xc) - (yb-yd) */
r1 = r2 - t1;
/* (xa - xc) + (yb-yd) */
r2 = r2 + t1;
/* (ya - yc) + (xb-xd) */
s1 = s2 + t2;
/* (ya - yc) - (xb-xd) */
s2 = s2 - t2;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = r1 * onebyfftLen;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = s1 * onebyfftLen;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = r2 * onebyfftLen;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = s2 * onebyfftLen;
}
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
}
| 34,024 | C | 27.330558 | 131 | 0.434164 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_init_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix2_init_f32.c
* Description: Radix-2 Decimation in Frequency Floating-point CFFT & CIFFT Initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Initialization function for the floating-point CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_f32 and will be removed in the future.
@param[in,out] S points to an instance of the floating-point CFFT/CIFFT structure
@param[in] fftLen length of the FFT
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Details
The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_cfft_radix2_init_f32(
arm_cfft_radix2_instance_f32 * S,
uint16_t fftLen,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialise the FFT length */
S->fftLen = fftLen;
/* Initialise the Twiddle coefficient pointer */
S->pTwiddle = (float32_t *) twiddleCoef;
/* Initialise the Flag for selection of CFFT or CIFFT */
S->ifftFlag = ifftFlag;
/* Initialise the Flag for calculation Bit reversal or not */
S->bitReverseFlag = bitReverseFlag;
/* Initializations of structure parameters depending on the FFT length */
switch (S->fftLen)
{
case 4096U:
/* Initializations of structure parameters for 4096 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 1U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 1U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) armBitRevTable;
/* Initialise the 1/fftLen Value */
S->onebyfftLen = 0.000244140625;
break;
case 2048U:
/* Initializations of structure parameters for 2048 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 2U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 2U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[1];
/* Initialise the 1/fftLen Value */
S->onebyfftLen = 0.00048828125;
break;
case 1024U:
/* Initializations of structure parameters for 1024 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 4U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 4U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
/* Initialise the 1/fftLen Value */
S->onebyfftLen = 0.0009765625f;
break;
case 512U:
/* Initializations of structure parameters for 512 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 8U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 8U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[7];
/* Initialise the 1/fftLen Value */
S->onebyfftLen = 0.001953125;
break;
case 256U:
/* Initializations of structure parameters for 256 point FFT */
S->twidCoefModifier = 16U;
S->bitRevFactor = 16U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
S->onebyfftLen = 0.00390625f;
break;
case 128U:
/* Initializations of structure parameters for 128 point FFT */
S->twidCoefModifier = 32U;
S->bitRevFactor = 32U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[31];
S->onebyfftLen = 0.0078125;
break;
case 64U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 64U;
S->bitRevFactor = 64U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
S->onebyfftLen = 0.015625f;
break;
case 32U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 128U;
S->bitRevFactor = 128U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[127];
S->onebyfftLen = 0.03125;
break;
case 16U:
/* Initializations of structure parameters for 16 point FFT */
S->twidCoefModifier = 256U;
S->bitRevFactor = 256U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
S->onebyfftLen = 0.0625f;
break;
default:
/* Reporting argument error if fftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
return (status);
}
/**
@} end of ComplexFFT group
*/
| 6,761 | C | 33.151515 | 137 | 0.644135 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_q31.c
* Description: Combined Radix Decimation in Frequency CFFT fixed point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
extern void arm_radix4_butterfly_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint32_t twidCoefModifier);
extern void arm_radix4_butterfly_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint32_t twidCoefModifier);
extern void arm_bitreversal_32(
uint32_t * pSrc,
const uint16_t bitRevLen,
const uint16_t * pBitRevTable);
void arm_cfft_radix4by2_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef);
void arm_cfft_radix4by2_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the Q31 complex FFT.
@param[in] S points to an instance of the fixed-point CFFT structure
@param[in,out] p1 points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return none
*/
void arm_cfft_q31(
const arm_cfft_instance_q31 * S,
q31_t * p1,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
uint32_t L = S->fftLen;
if (ifftFlag == 1U)
{
switch (L)
{
case 16:
case 64:
case 256:
case 1024:
case 4096:
arm_radix4_butterfly_inverse_q31 ( p1, L, (q31_t*)S->pTwiddle, 1 );
break;
case 32:
case 128:
case 512:
case 2048:
arm_cfft_radix4by2_inverse_q31 ( p1, L, S->pTwiddle );
break;
}
}
else
{
switch (L)
{
case 16:
case 64:
case 256:
case 1024:
case 4096:
arm_radix4_butterfly_q31 ( p1, L, (q31_t*)S->pTwiddle, 1 );
break;
case 32:
case 128:
case 512:
case 2048:
arm_cfft_radix4by2_q31 ( p1, L, S->pTwiddle );
break;
}
}
if ( bitReverseFlag )
arm_bitreversal_32 ((uint32_t*) p1, S->bitRevLength, S->pBitRevTable);
}
/**
@} end of ComplexFFT group
*/
void arm_cfft_radix4by2_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef)
{
uint32_t i, l;
uint32_t n2;
q31_t xt, yt, cosVal, sinVal;
q31_t p0, p1;
n2 = fftLen >> 1U;
for (i = 0; i < n2; i++)
{
cosVal = pCoef[2 * i];
sinVal = pCoef[2 * i + 1];
l = i + n2;
xt = (pSrc[2 * i] >> 2U) - (pSrc[2 * l] >> 2U);
pSrc[2 * i] = (pSrc[2 * i] >> 2U) + (pSrc[2 * l] >> 2U);
yt = (pSrc[2 * i + 1] >> 2U) - (pSrc[2 * l + 1] >> 2U);
pSrc[2 * i + 1] = (pSrc[2 * l + 1] >> 2U) + (pSrc[2 * i + 1] >> 2U);
mult_32x32_keep32_R(p0, xt, cosVal);
mult_32x32_keep32_R(p1, yt, cosVal);
multAcc_32x32_keep32_R(p0, yt, sinVal);
multSub_32x32_keep32_R(p1, xt, sinVal);
pSrc[2 * l] = p0 << 1;
pSrc[2 * l + 1] = p1 << 1;
}
/* first col */
arm_radix4_butterfly_q31 (pSrc, n2, (q31_t*)pCoef, 2U);
/* second col */
arm_radix4_butterfly_q31 (pSrc + fftLen, n2, (q31_t*)pCoef, 2U);
n2 = fftLen >> 1U;
for (i = 0; i < n2; i++)
{
p0 = pSrc[4 * i + 0];
p1 = pSrc[4 * i + 1];
xt = pSrc[4 * i + 2];
yt = pSrc[4 * i + 3];
p0 <<= 1U;
p1 <<= 1U;
xt <<= 1U;
yt <<= 1U;
pSrc[4 * i + 0] = p0;
pSrc[4 * i + 1] = p1;
pSrc[4 * i + 2] = xt;
pSrc[4 * i + 3] = yt;
}
}
void arm_cfft_radix4by2_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef)
{
uint32_t i, l;
uint32_t n2;
q31_t xt, yt, cosVal, sinVal;
q31_t p0, p1;
n2 = fftLen >> 1U;
for (i = 0; i < n2; i++)
{
cosVal = pCoef[2 * i];
sinVal = pCoef[2 * i + 1];
l = i + n2;
xt = (pSrc[2 * i] >> 2U) - (pSrc[2 * l] >> 2U);
pSrc[2 * i] = (pSrc[2 * i] >> 2U) + (pSrc[2 * l] >> 2U);
yt = (pSrc[2 * i + 1] >> 2U) - (pSrc[2 * l + 1] >> 2U);
pSrc[2 * i + 1] = (pSrc[2 * l + 1] >> 2U) + (pSrc[2 * i + 1] >> 2U);
mult_32x32_keep32_R(p0, xt, cosVal);
mult_32x32_keep32_R(p1, yt, cosVal);
multSub_32x32_keep32_R(p0, yt, sinVal);
multAcc_32x32_keep32_R(p1, xt, sinVal);
pSrc[2 * l] = p0 << 1U;
pSrc[2 * l + 1] = p1 << 1U;
}
/* first col */
arm_radix4_butterfly_inverse_q31( pSrc, n2, (q31_t*)pCoef, 2U);
/* second col */
arm_radix4_butterfly_inverse_q31( pSrc + fftLen, n2, (q31_t*)pCoef, 2U);
n2 = fftLen >> 1U;
for (i = 0; i < n2; i++)
{
p0 = pSrc[4 * i + 0];
p1 = pSrc[4 * i + 1];
xt = pSrc[4 * i + 2];
yt = pSrc[4 * i + 3];
p0 <<= 1U;
p1 <<= 1U;
xt <<= 1U;
yt <<= 1U;
pSrc[4 * i + 0] = p0;
pSrc[4 * i + 1] = p1;
pSrc[4 * i + 2] = xt;
pSrc[4 * i + 3] = yt;
}
}
| 6,226 | C | 23.419608 | 124 | 0.514937 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix4_q31.c
* Description: This file has function definition of Radix-4 FFT & IFFT function and
* In-place bit reversal using bit reversal table
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
void arm_radix4_butterfly_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint32_t twidCoefModifier);
void arm_radix4_butterfly_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint32_t twidCoefModifier);
void arm_bitreversal_q31(
q31_t * pSrc,
uint32_t fftLen,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the Q31 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q31 and will be removed in the future.
@param[in] S points to an instance of the Q31 CFFT/CIFFT structure
@param[in,out] pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@return none
@par Input and output formats:
Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process.
Hence the output format is different for different FFT sizes.
The input and output formats for different FFT sizes and number of bits to upscale are mentioned in the tables below for CFFT and CIFFT:
@par
\image html CFFTQ31.gif "Input and Output Formats for Q31 CFFT"
\image html CIFFTQ31.gif "Input and Output Formats for Q31 CIFFT"
*/
void arm_cfft_radix4_q31(
const arm_cfft_radix4_instance_q31 * S,
q31_t * pSrc)
{
if (S->ifftFlag == 1U)
{
/* Complex IFFT radix-4 */
arm_radix4_butterfly_inverse_q31(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
else
{
/* Complex FFT radix-4 */
arm_radix4_butterfly_q31(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
if (S->bitReverseFlag == 1U)
{
/* Bit Reversal */
arm_bitreversal_q31(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
}
}
/**
@} end of ComplexFFT group
*/
/*
* Radix-4 FFT algorithm used is :
*
* Input real and imaginary data:
* x(n) = xa + j * ya
* x(n+N/4 ) = xb + j * yb
* x(n+N/2 ) = xc + j * yc
* x(n+3N 4) = xd + j * yd
*
*
* Output real and imaginary data:
* x(4r) = xa'+ j * ya'
* x(4r+1) = xb'+ j * yb'
* x(4r+2) = xc'+ j * yc'
* x(4r+3) = xd'+ j * yd'
*
*
* Twiddle factors for radix-4 FFT:
* Wn = co1 + j * (- si1)
* W2n = co2 + j * (- si2)
* W3n = co3 + j * (- si3)
*
* Butterfly implementation:
* xa' = xa + xb + xc + xd
* ya' = ya + yb + yc + yd
* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1)
* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1)
* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2)
* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2)
* xd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3)
* yd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3)
*
*/
/**
@brief Core function for the Q31 CFFT butterfly process.
@param[in,out] pSrc points to the in-place buffer of Q31 data type.
@param[in] fftLen length of the FFT.
@param[in] pCoef points to twiddle coefficient buffer.
@param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
@return none
*/
void arm_radix4_butterfly_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint32_t twidCoefModifier)
{
uint32_t n1, n2, ia1, ia2, ia3, i0, i1, i2, i3, j, k;
q31_t t1, t2, r1, r2, s1, s2, co1, co2, co3, si1, si2, si3;
q31_t xa, xb, xc, xd;
q31_t ya, yb, yc, yd;
q31_t xa_out, xb_out, xc_out, xd_out;
q31_t ya_out, yb_out, yc_out, yd_out;
q31_t *ptr1;
/* Total process is divided into three stages */
/* process first stage, middle stages, & last stage */
/* start of first stage process */
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
i0 = 0U;
ia1 = 0U;
j = n2;
/* Calculation of first stage */
do
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2U], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* input is in 1.31(q31) format and provide 4 guard bits for the input */
/* Butterfly implementation */
/* xa + xc */
r1 = (pSrc[(2U * i0)] >> 4U) + (pSrc[(2U * i2)] >> 4U);
/* xa - xc */
r2 = (pSrc[(2U * i0)] >> 4U) - (pSrc[(2U * i2)] >> 4U);
/* xb + xd */
t1 = (pSrc[(2U * i1)] >> 4U) + (pSrc[(2U * i3)] >> 4U);
/* ya + yc */
s1 = (pSrc[(2U * i0) + 1U] >> 4U) + (pSrc[(2U * i2) + 1U] >> 4U);
/* ya - yc */
s2 = (pSrc[(2U * i0) + 1U] >> 4U) - (pSrc[(2U * i2) + 1U] >> 4U);
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = (r1 + t1);
/* (xa + xc) - (xb + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = (pSrc[(2U * i1) + 1U] >> 4U) + (pSrc[(2U * i3) + 1U] >> 4U);
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = (s1 + t2);
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* yb - yd */
t1 = (pSrc[(2U * i1) + 1U] >> 4U) - (pSrc[(2U * i3) + 1U] >> 4U);
/* xb - xd */
t2 = (pSrc[(2U * i1)] >> 4U) - (pSrc[(2U * i3)] >> 4U);
/* index calculation for the coefficients */
ia2 = 2U * ia1;
co2 = pCoef[(ia2 * 2U)];
si2 = pCoef[(ia2 * 2U) + 1U];
/* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = (((int32_t) (((q63_t) r1 * co2) >> 32)) +
((int32_t) (((q63_t) s1 * si2) >> 32))) << 1U;
/* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = (((int32_t) (((q63_t) s1 * co2) >> 32)) -
((int32_t) (((q63_t) r1 * si2) >> 32))) << 1U;
/* (xa - xc) + (yb - yd) */
r1 = r2 + t1;
/* (xa - xc) - (yb - yd) */
r2 = r2 - t1;
/* (ya - yc) - (xb - xd) */
s1 = s2 - t2;
/* (ya - yc) + (xb - xd) */
s2 = s2 + t2;
co1 = pCoef[(ia1 * 2U)];
si1 = pCoef[(ia1 * 2U) + 1U];
/* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = (((int32_t) (((q63_t) r1 * co1) >> 32)) +
((int32_t) (((q63_t) s1 * si1) >> 32))) << 1U;
/* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = (((int32_t) (((q63_t) s1 * co1) >> 32)) -
((int32_t) (((q63_t) r1 * si1) >> 32))) << 1U;
/* index calculation for the coefficients */
ia3 = 3U * ia1;
co3 = pCoef[(ia3 * 2U)];
si3 = pCoef[(ia3 * 2U) + 1U];
/* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = (((int32_t) (((q63_t) r2 * co3) >> 32)) +
((int32_t) (((q63_t) s2 * si3) >> 32))) << 1U;
/* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = (((int32_t) (((q63_t) s2 * co3) >> 32)) -
((int32_t) (((q63_t) r2 * si3) >> 32))) << 1U;
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
/* Updating input index */
i0 = i0 + 1U;
} while (--j);
/* end of first stage process */
/* data is in 5.27(q27) format */
/* start of Middle stages process */
/* each stage in middle stages provides two down scaling of the input */
twidCoefModifier <<= 2U;
for (k = fftLen / 4U; k > 4U; k >>= 2U)
{
/* Initializations for the first stage */
n1 = n2;
n2 >>= 2U;
ia1 = 0U;
/* Calculation of first stage */
for (j = 0U; j <= (n2 - 1U); j++)
{
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
ia3 = ia2 + ia1;
co1 = pCoef[(ia1 * 2U)];
si1 = pCoef[(ia1 * 2U) + 1U];
co2 = pCoef[(ia2 * 2U)];
si2 = pCoef[(ia2 * 2U) + 1U];
co3 = pCoef[(ia3 * 2U)];
si3 = pCoef[(ia3 * 2U) + 1U];
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
for (i0 = j; i0 < fftLen; i0 += n1)
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2U], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Butterfly implementation */
/* xa + xc */
r1 = pSrc[2U * i0] + pSrc[2U * i2];
/* xa - xc */
r2 = pSrc[2U * i0] - pSrc[2U * i2];
/* ya + yc */
s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
/* ya - yc */
s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
/* xb + xd */
t1 = pSrc[2U * i1] + pSrc[2U * i3];
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = (r1 + t1) >> 2U;
/* xa + xc -(xb + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = (s1 + t2) >> 2U;
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* (yb - yd) */
t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
/* (xb - xd) */
t2 = pSrc[2U * i1] - pSrc[2U * i3];
/* xc' = (xa-xb+xc-xd)co2 + (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = (((int32_t) (((q63_t) r1 * co2) >> 32)) +
((int32_t) (((q63_t) s1 * si2) >> 32))) >> 1U;
/* yc' = (ya-yb+yc-yd)co2 - (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = (((int32_t) (((q63_t) s1 * co2) >> 32)) -
((int32_t) (((q63_t) r1 * si2) >> 32))) >> 1U;
/* (xa - xc) + (yb - yd) */
r1 = r2 + t1;
/* (xa - xc) - (yb - yd) */
r2 = r2 - t1;
/* (ya - yc) - (xb - xd) */
s1 = s2 - t2;
/* (ya - yc) + (xb - xd) */
s2 = s2 + t2;
/* xb' = (xa+yb-xc-yd)co1 + (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = (((int32_t) (((q63_t) r1 * co1) >> 32)) +
((int32_t) (((q63_t) s1 * si1) >> 32))) >> 1U;
/* yb' = (ya-xb-yc+xd)co1 - (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = (((int32_t) (((q63_t) s1 * co1) >> 32)) -
((int32_t) (((q63_t) r1 * si1) >> 32))) >> 1U;
/* xd' = (xa-yb-xc+yd)co3 + (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = (((int32_t) (((q63_t) r2 * co3) >> 32)) +
((int32_t) (((q63_t) s2 * si3) >> 32))) >> 1U;
/* yd' = (ya+xb-yc-xd)co3 - (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = (((int32_t) (((q63_t) s2 * co3) >> 32)) -
((int32_t) (((q63_t) r2 * si3) >> 32))) >> 1U;
}
}
twidCoefModifier <<= 2U;
}
/* End of Middle stages process */
/* data is in 11.21(q21) format for the 1024 point as there are 3 middle stages */
/* data is in 9.23(q23) format for the 256 point as there are 2 middle stages */
/* data is in 7.25(q25) format for the 64 point as there are 1 middle stage */
/* data is in 5.27(q27) format for the 16 point as there are no middle stages */
/* start of Last stage process */
/* Initializations for the last stage */
j = fftLen >> 2;
ptr1 = &pSrc[0];
/* Calculations of last stage */
do
{
/* Read xa (real), ya(imag) input */
xa = *ptr1++;
ya = *ptr1++;
/* Read xb (real), yb(imag) input */
xb = *ptr1++;
yb = *ptr1++;
/* Read xc (real), yc(imag) input */
xc = *ptr1++;
yc = *ptr1++;
/* Read xc (real), yc(imag) input */
xd = *ptr1++;
yd = *ptr1++;
/* xa' = xa + xb + xc + xd */
xa_out = xa + xb + xc + xd;
/* ya' = ya + yb + yc + yd */
ya_out = ya + yb + yc + yd;
/* pointer updation for writing */
ptr1 = ptr1 - 8U;
/* writing xa' and ya' */
*ptr1++ = xa_out;
*ptr1++ = ya_out;
xc_out = (xa - xb + xc - xd);
yc_out = (ya - yb + yc - yd);
/* writing xc' and yc' */
*ptr1++ = xc_out;
*ptr1++ = yc_out;
xb_out = (xa + yb - xc - yd);
yb_out = (ya - xb - yc + xd);
/* writing xb' and yb' */
*ptr1++ = xb_out;
*ptr1++ = yb_out;
xd_out = (xa - yb - xc + yd);
yd_out = (ya + xb - yc - xd);
/* writing xd' and yd' */
*ptr1++ = xd_out;
*ptr1++ = yd_out;
} while (--j);
/* output is in 11.21(q21) format for the 1024 point */
/* output is in 9.23(q23) format for the 256 point */
/* output is in 7.25(q25) format for the 64 point */
/* output is in 5.27(q27) format for the 16 point */
/* End of last stage process */
}
/**
@brief Core function for the Q31 CIFFT butterfly process.
@param[in,out] pSrc points to the in-place buffer of Q31 data type.
@param[in] fftLen length of the FFT.
@param[in] pCoef points to twiddle coefficient buffer.
@param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
@return none
*/
/*
* Radix-4 IFFT algorithm used is :
*
* CIFFT uses same twiddle coefficients as CFFT Function
* x[k] = x[n] + (j)k * x[n + fftLen/4] + (-1)k * x[n+fftLen/2] + (-j)k * x[n+3*fftLen/4]
*
*
* IFFT is implemented with following changes in equations from FFT
*
* Input real and imaginary data:
* x(n) = xa + j * ya
* x(n+N/4 ) = xb + j * yb
* x(n+N/2 ) = xc + j * yc
* x(n+3N 4) = xd + j * yd
*
*
* Output real and imaginary data:
* x(4r) = xa'+ j * ya'
* x(4r+1) = xb'+ j * yb'
* x(4r+2) = xc'+ j * yc'
* x(4r+3) = xd'+ j * yd'
*
*
* Twiddle factors for radix-4 IFFT:
* Wn = co1 + j * (si1)
* W2n = co2 + j * (si2)
* W3n = co3 + j * (si3)
* The real and imaginary output values for the radix-4 butterfly are
* xa' = xa + xb + xc + xd
* ya' = ya + yb + yc + yd
* xb' = (xa-yb-xc+yd)* co1 - (ya+xb-yc-xd)* (si1)
* yb' = (ya+xb-yc-xd)* co1 + (xa-yb-xc+yd)* (si1)
* xc' = (xa-xb+xc-xd)* co2 - (ya-yb+yc-yd)* (si2)
* yc' = (ya-yb+yc-yd)* co2 + (xa-xb+xc-xd)* (si2)
* xd' = (xa+yb-xc-yd)* co3 - (ya-xb-yc+xd)* (si3)
* yd' = (ya-xb-yc+xd)* co3 + (xa+yb-xc-yd)* (si3)
*
*/
void arm_radix4_butterfly_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint32_t twidCoefModifier)
{
uint32_t n1, n2, ia1, ia2, ia3, i0, i1, i2, i3, j, k;
q31_t t1, t2, r1, r2, s1, s2, co1, co2, co3, si1, si2, si3;
q31_t xa, xb, xc, xd;
q31_t ya, yb, yc, yd;
q31_t xa_out, xb_out, xc_out, xd_out;
q31_t ya_out, yb_out, yc_out, yd_out;
q31_t *ptr1;
/* input is be 1.31(q31) format for all FFT sizes */
/* Total process is divided into three stages */
/* process first stage, middle stages, & last stage */
/* Start of first stage process */
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
i0 = 0U;
ia1 = 0U;
j = n2;
do
{
/* input is in 1.31(q31) format and provide 4 guard bits for the input */
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2U], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Butterfly implementation */
/* xa + xc */
r1 = (pSrc[2U * i0] >> 4U) + (pSrc[2U * i2] >> 4U);
/* xa - xc */
r2 = (pSrc[2U * i0] >> 4U) - (pSrc[2U * i2] >> 4U);
/* xb + xd */
t1 = (pSrc[2U * i1] >> 4U) + (pSrc[2U * i3] >> 4U);
/* ya + yc */
s1 = (pSrc[(2U * i0) + 1U] >> 4U) + (pSrc[(2U * i2) + 1U] >> 4U);
/* ya - yc */
s2 = (pSrc[(2U * i0) + 1U] >> 4U) - (pSrc[(2U * i2) + 1U] >> 4U);
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = (r1 + t1);
/* (xa + xc) - (xb + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = (pSrc[(2U * i1) + 1U] >> 4U) + (pSrc[(2U * i3) + 1U] >> 4U);
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = (s1 + t2);
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* yb - yd */
t1 = (pSrc[(2U * i1) + 1U] >> 4U) - (pSrc[(2U * i3) + 1U] >> 4U);
/* xb - xd */
t2 = (pSrc[2U * i1] >> 4U) - (pSrc[2U * i3] >> 4U);
/* index calculation for the coefficients */
ia2 = 2U * ia1;
co2 = pCoef[ia2 * 2U];
si2 = pCoef[(ia2 * 2U) + 1U];
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = (((int32_t) (((q63_t) r1 * co2) >> 32)) -
((int32_t) (((q63_t) s1 * si2) >> 32))) << 1U;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
pSrc[2U * i1 + 1U] = (((int32_t) (((q63_t) s1 * co2) >> 32)) +
((int32_t) (((q63_t) r1 * si2) >> 32))) << 1U;
/* (xa - xc) - (yb - yd) */
r1 = r2 - t1;
/* (xa - xc) + (yb - yd) */
r2 = r2 + t1;
/* (ya - yc) + (xb - xd) */
s1 = s2 + t2;
/* (ya - yc) - (xb - xd) */
s2 = s2 - t2;
co1 = pCoef[ia1 * 2U];
si1 = pCoef[(ia1 * 2U) + 1U];
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = (((int32_t) (((q63_t) r1 * co1) >> 32)) -
((int32_t) (((q63_t) s1 * si1) >> 32))) << 1U;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = (((int32_t) (((q63_t) s1 * co1) >> 32)) +
((int32_t) (((q63_t) r1 * si1) >> 32))) << 1U;
/* index calculation for the coefficients */
ia3 = 3U * ia1;
co3 = pCoef[ia3 * 2U];
si3 = pCoef[(ia3 * 2U) + 1U];
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
pSrc[2U * i3] = (((int32_t) (((q63_t) r2 * co3) >> 32)) -
((int32_t) (((q63_t) s2 * si3) >> 32))) << 1U;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = (((int32_t) (((q63_t) s2 * co3) >> 32)) +
((int32_t) (((q63_t) r2 * si3) >> 32))) << 1U;
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
/* Updating input index */
i0 = i0 + 1U;
} while (--j);
/* data is in 5.27(q27) format */
/* each stage provides two down scaling of the input */
/* Start of Middle stages process */
twidCoefModifier <<= 2U;
/* Calculation of second stage to excluding last stage */
for (k = fftLen / 4U; k > 4U; k >>= 2U)
{
/* Initializations for the first stage */
n1 = n2;
n2 >>= 2U;
ia1 = 0U;
for (j = 0; j <= (n2 - 1U); j++)
{
/* index calculation for the coefficients */
ia2 = ia1 + ia1;
ia3 = ia2 + ia1;
co1 = pCoef[(ia1 * 2U)];
si1 = pCoef[(ia1 * 2U) + 1U];
co2 = pCoef[(ia2 * 2U)];
si2 = pCoef[(ia2 * 2U) + 1U];
co3 = pCoef[(ia3 * 2U)];
si3 = pCoef[(ia3 * 2U) + 1U];
/* Twiddle coefficients index modifier */
ia1 = ia1 + twidCoefModifier;
for (i0 = j; i0 < fftLen; i0 += n1)
{
/* index calculation for the input as, */
/* pSrc[i0 + 0], pSrc[i0 + fftLen/4], pSrc[i0 + fftLen/2U], pSrc[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Butterfly implementation */
/* xa + xc */
r1 = pSrc[2U * i0] + pSrc[2U * i2];
/* xa - xc */
r2 = pSrc[2U * i0] - pSrc[2U * i2];
/* ya + yc */
s1 = pSrc[(2U * i0) + 1U] + pSrc[(2U * i2) + 1U];
/* ya - yc */
s2 = pSrc[(2U * i0) + 1U] - pSrc[(2U * i2) + 1U];
/* xb + xd */
t1 = pSrc[2U * i1] + pSrc[2U * i3];
/* xa' = xa + xb + xc + xd */
pSrc[2U * i0] = (r1 + t1) >> 2U;
/* xa + xc -(xb + xd) */
r1 = r1 - t1;
/* yb + yd */
t2 = pSrc[(2U * i1) + 1U] + pSrc[(2U * i3) + 1U];
/* ya' = ya + yb + yc + yd */
pSrc[(2U * i0) + 1U] = (s1 + t2) >> 2U;
/* (ya + yc) - (yb + yd) */
s1 = s1 - t2;
/* (yb - yd) */
t1 = pSrc[(2U * i1) + 1U] - pSrc[(2U * i3) + 1U];
/* (xb - xd) */
t2 = pSrc[2U * i1] - pSrc[2U * i3];
/* xc' = (xa-xb+xc-xd)co2 - (ya-yb+yc-yd)(si2) */
pSrc[2U * i1] = (((int32_t) (((q63_t) r1 * co2) >> 32U)) -
((int32_t) (((q63_t) s1 * si2) >> 32U))) >> 1U;
/* yc' = (ya-yb+yc-yd)co2 + (xa-xb+xc-xd)(si2) */
pSrc[(2U * i1) + 1U] = (((int32_t) (((q63_t) s1 * co2) >> 32U)) +
((int32_t) (((q63_t) r1 * si2) >> 32U))) >> 1U;
/* (xa - xc) - (yb - yd) */
r1 = r2 - t1;
/* (xa - xc) + (yb - yd) */
r2 = r2 + t1;
/* (ya - yc) + (xb - xd) */
s1 = s2 + t2;
/* (ya - yc) - (xb - xd) */
s2 = s2 - t2;
/* xb' = (xa+yb-xc-yd)co1 - (ya-xb-yc+xd)(si1) */
pSrc[2U * i2] = (((int32_t) (((q63_t) r1 * co1) >> 32)) -
((int32_t) (((q63_t) s1 * si1) >> 32))) >> 1U;
/* yb' = (ya-xb-yc+xd)co1 + (xa+yb-xc-yd)(si1) */
pSrc[(2U * i2) + 1U] = (((int32_t) (((q63_t) s1 * co1) >> 32)) +
((int32_t) (((q63_t) r1 * si1) >> 32))) >> 1U;
/* xd' = (xa-yb-xc+yd)co3 - (ya+xb-yc-xd)(si3) */
pSrc[(2U * i3)] = (((int32_t) (((q63_t) r2 * co3) >> 32)) -
((int32_t) (((q63_t) s2 * si3) >> 32))) >> 1U;
/* yd' = (ya+xb-yc-xd)co3 + (xa-yb-xc+yd)(si3) */
pSrc[(2U * i3) + 1U] = (((int32_t) (((q63_t) s2 * co3) >> 32)) +
((int32_t) (((q63_t) r2 * si3) >> 32))) >> 1U;
}
}
twidCoefModifier <<= 2U;
}
/* End of Middle stages process */
/* data is in 11.21(q21) format for the 1024 point as there are 3 middle stages */
/* data is in 9.23(q23) format for the 256 point as there are 2 middle stages */
/* data is in 7.25(q25) format for the 64 point as there are 1 middle stage */
/* data is in 5.27(q27) format for the 16 point as there are no middle stages */
/* Start of last stage process */
/* Initializations for the last stage */
j = fftLen >> 2;
ptr1 = &pSrc[0];
/* Calculations of last stage */
do
{
/* Read xa (real), ya(imag) input */
xa = *ptr1++;
ya = *ptr1++;
/* Read xb (real), yb(imag) input */
xb = *ptr1++;
yb = *ptr1++;
/* Read xc (real), yc(imag) input */
xc = *ptr1++;
yc = *ptr1++;
/* Read xc (real), yc(imag) input */
xd = *ptr1++;
yd = *ptr1++;
/* xa' = xa + xb + xc + xd */
xa_out = xa + xb + xc + xd;
/* ya' = ya + yb + yc + yd */
ya_out = ya + yb + yc + yd;
/* pointer updation for writing */
ptr1 = ptr1 - 8U;
/* writing xa' and ya' */
*ptr1++ = xa_out;
*ptr1++ = ya_out;
xc_out = (xa - xb + xc - xd);
yc_out = (ya - yb + yc - yd);
/* writing xc' and yc' */
*ptr1++ = xc_out;
*ptr1++ = yc_out;
xb_out = (xa - yb - xc + yd);
yb_out = (ya + xb - yc - xd);
/* writing xb' and yb' */
*ptr1++ = xb_out;
*ptr1++ = yb_out;
xd_out = (xa + yb - xc - yd);
yd_out = (ya - xb - yc + xd);
/* writing xd' and yd' */
*ptr1++ = xd_out;
*ptr1++ = yd_out;
} while (--j);
/* output is in 11.21(q21) format for the 1024 point */
/* output is in 9.23(q23) format for the 256 point */
/* output is in 7.25(q25) format for the 64 point */
/* output is in 5.27(q27) format for the 16 point */
/* End of last stage process */
}
| 24,328 | C | 28.38285 | 153 | 0.463047 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_q15.c
* Description: Combined Radix Decimation in Q15 Frequency CFFT processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
extern void arm_radix4_butterfly_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef,
uint32_t twidCoefModifier);
extern void arm_radix4_butterfly_inverse_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef,
uint32_t twidCoefModifier);
extern void arm_bitreversal_16(
uint16_t * pSrc,
const uint16_t bitRevLen,
const uint16_t * pBitRevTable);
void arm_cfft_radix4by2_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef);
void arm_cfft_radix4by2_inverse_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for Q15 complex FFT.
@param[in] S points to an instance of Q15 CFFT structure
@param[in,out] p1 points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return none
*/
void arm_cfft_q15(
const arm_cfft_instance_q15 * S,
q15_t * p1,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
uint32_t L = S->fftLen;
if (ifftFlag == 1U)
{
switch (L)
{
case 16:
case 64:
case 256:
case 1024:
case 4096:
arm_radix4_butterfly_inverse_q15 ( p1, L, (q15_t*)S->pTwiddle, 1 );
break;
case 32:
case 128:
case 512:
case 2048:
arm_cfft_radix4by2_inverse_q15 ( p1, L, S->pTwiddle );
break;
}
}
else
{
switch (L)
{
case 16:
case 64:
case 256:
case 1024:
case 4096:
arm_radix4_butterfly_q15 ( p1, L, (q15_t*)S->pTwiddle, 1 );
break;
case 32:
case 128:
case 512:
case 2048:
arm_cfft_radix4by2_q15 ( p1, L, S->pTwiddle );
break;
}
}
if ( bitReverseFlag )
arm_bitreversal_16 ((uint16_t*) p1, S->bitRevLength, S->pBitRevTable);
}
/**
@} end of ComplexFFT group
*/
void arm_cfft_radix4by2_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef)
{
uint32_t i;
uint32_t n2;
q15_t p0, p1, p2, p3;
#if defined (ARM_MATH_DSP)
q31_t T, S, R;
q31_t coeff, out1, out2;
const q15_t *pC = pCoef;
q15_t *pSi = pSrc;
q15_t *pSl = pSrc + fftLen;
#else
uint32_t l;
q15_t xt, yt, cosVal, sinVal;
#endif
n2 = fftLen >> 1U;
#if defined (ARM_MATH_DSP)
for (i = n2; i > 0; i--)
{
coeff = read_q15x2_ia ((q15_t **) &pC);
T = read_q15x2 (pSi);
T = __SHADD16(T, 0); /* this is just a SIMD arithmetic shift right by 1 */
S = read_q15x2 (pSl);
S = __SHADD16(S, 0); /* this is just a SIMD arithmetic shift right by 1 */
R = __QSUB16(T, S);
write_q15x2_ia (&pSi, __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUAD(coeff, R) >> 16U;
out2 = __SMUSDX(coeff, R);
#else
out1 = __SMUSDX(R, coeff) >> 16U;
out2 = __SMUAD(coeff, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2_ia (&pSl, (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
}
#else /* #if defined (ARM_MATH_DSP) */
for (i = 0; i < n2; i++)
{
cosVal = pCoef[2 * i];
sinVal = pCoef[2 * i + 1];
l = i + n2;
xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
pSrc[2 * i + 1] = ((pSrc[2 * l + 1] >> 1U) + (pSrc[2 * i + 1] >> 1U)) >> 1U;
pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16U)) +
((int16_t) (((q31_t) yt * sinVal) >> 16U)) );
pSrc[2 * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16U)) -
((int16_t) (((q31_t) xt * sinVal) >> 16U)) );
}
#endif /* #if defined (ARM_MATH_DSP) */
/* first col */
arm_radix4_butterfly_q15( pSrc, n2, (q15_t*)pCoef, 2U);
/* second col */
arm_radix4_butterfly_q15( pSrc + fftLen, n2, (q15_t*)pCoef, 2U);
n2 = fftLen >> 1U;
for (i = 0; i < n2; i++)
{
p0 = pSrc[4 * i + 0];
p1 = pSrc[4 * i + 1];
p2 = pSrc[4 * i + 2];
p3 = pSrc[4 * i + 3];
p0 <<= 1U;
p1 <<= 1U;
p2 <<= 1U;
p3 <<= 1U;
pSrc[4 * i + 0] = p0;
pSrc[4 * i + 1] = p1;
pSrc[4 * i + 2] = p2;
pSrc[4 * i + 3] = p3;
}
}
void arm_cfft_radix4by2_inverse_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pCoef)
{
uint32_t i;
uint32_t n2;
q15_t p0, p1, p2, p3;
#if defined (ARM_MATH_DSP)
q31_t T, S, R;
q31_t coeff, out1, out2;
const q15_t *pC = pCoef;
q15_t *pSi = pSrc;
q15_t *pSl = pSrc + fftLen;
#else
uint32_t l;
q15_t xt, yt, cosVal, sinVal;
#endif
n2 = fftLen >> 1U;
#if defined (ARM_MATH_DSP)
for (i = n2; i > 0; i--)
{
coeff = read_q15x2_ia ((q15_t **) &pC);
T = read_q15x2 (pSi);
T = __SHADD16(T, 0); /* this is just a SIMD arithmetic shift right by 1 */
S = read_q15x2 (pSl);
S = __SHADD16(S, 0); /* this is just a SIMD arithmetic shift right by 1 */
R = __QSUB16(T, S);
write_q15x2_ia (&pSi, __SHADD16(T, S));
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUSD(coeff, R) >> 16U;
out2 = __SMUADX(coeff, R);
#else
out1 = __SMUADX(R, coeff) >> 16U;
out2 = __SMUSD(__QSUB(0, coeff), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
write_q15x2_ia (&pSl, (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
}
#else /* #if defined (ARM_MATH_DSP) */
for (i = 0; i < n2; i++)
{
cosVal = pCoef[2 * i];
sinVal = pCoef[2 * i + 1];
l = i + n2;
xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
pSrc[2 * i + 1] = ((pSrc[2 * l + 1] >> 1U) + (pSrc[2 * i + 1] >> 1U)) >> 1U;
pSrc[2 * l] = (((int16_t) (((q31_t) xt * cosVal) >> 16U)) -
((int16_t) (((q31_t) yt * sinVal) >> 16U)) );
pSrc[2 * l + 1] = (((int16_t) (((q31_t) yt * cosVal) >> 16U)) +
((int16_t) (((q31_t) xt * sinVal) >> 16U)) );
}
#endif /* #if defined (ARM_MATH_DSP) */
/* first col */
arm_radix4_butterfly_inverse_q15( pSrc, n2, (q15_t*)pCoef, 2U);
/* second col */
arm_radix4_butterfly_inverse_q15( pSrc + fftLen, n2, (q15_t*)pCoef, 2U);
n2 = fftLen >> 1U;
for (i = 0; i < n2; i++)
{
p0 = pSrc[4 * i + 0];
p1 = pSrc[4 * i + 1];
p2 = pSrc[4 * i + 2];
p3 = pSrc[4 * i + 3];
p0 <<= 1U;
p1 <<= 1U;
p2 <<= 1U;
p3 <<= 1U;
pSrc[4 * i + 0] = p0;
pSrc[4 * i + 1] = p1;
pSrc[4 * i + 2] = p2;
pSrc[4 * i + 3] = p3;
}
}
| 8,348 | C | 24.072072 | 124 | 0.501557 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_bitreversal.c
* Description: Bitreversal functions
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@brief In-place floating-point bit reversal function.
@param[in,out] pSrc points to in-place floating-point data buffer
@param[in] fftSize length of FFT
@param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
@param[in] pBitRevTab points to bit reversal table
@return none
*/
void arm_bitreversal_f32(
float32_t * pSrc,
uint16_t fftSize,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab)
{
uint16_t fftLenBy2, fftLenBy2p1;
uint16_t i, j;
float32_t in;
/* Initializations */
j = 0U;
fftLenBy2 = fftSize >> 1U;
fftLenBy2p1 = (fftSize >> 1U) + 1U;
/* Bit Reversal Implementation */
for (i = 0U; i <= (fftLenBy2 - 2U); i += 2U)
{
if (i < j)
{
/* pSrc[i] <-> pSrc[j]; */
in = pSrc[2U * i];
pSrc[2U * i] = pSrc[2U * j];
pSrc[2U * j] = in;
/* pSrc[i+1U] <-> pSrc[j+1U] */
in = pSrc[(2U * i) + 1U];
pSrc[(2U * i) + 1U] = pSrc[(2U * j) + 1U];
pSrc[(2U * j) + 1U] = in;
/* pSrc[i+fftLenBy2p1] <-> pSrc[j+fftLenBy2p1] */
in = pSrc[2U * (i + fftLenBy2p1)];
pSrc[2U * (i + fftLenBy2p1)] = pSrc[2U * (j + fftLenBy2p1)];
pSrc[2U * (j + fftLenBy2p1)] = in;
/* pSrc[i+fftLenBy2p1+1U] <-> pSrc[j+fftLenBy2p1+1U] */
in = pSrc[(2U * (i + fftLenBy2p1)) + 1U];
pSrc[(2U * (i + fftLenBy2p1)) + 1U] =
pSrc[(2U * (j + fftLenBy2p1)) + 1U];
pSrc[(2U * (j + fftLenBy2p1)) + 1U] = in;
}
/* pSrc[i+1U] <-> pSrc[j+1U] */
in = pSrc[2U * (i + 1U)];
pSrc[2U * (i + 1U)] = pSrc[2U * (j + fftLenBy2)];
pSrc[2U * (j + fftLenBy2)] = in;
/* pSrc[i+2U] <-> pSrc[j+2U] */
in = pSrc[(2U * (i + 1U)) + 1U];
pSrc[(2U * (i + 1U)) + 1U] = pSrc[(2U * (j + fftLenBy2)) + 1U];
pSrc[(2U * (j + fftLenBy2)) + 1U] = in;
/* Reading the index for the bit reversal */
j = *pBitRevTab;
/* Updating the bit reversal index depending on the fft length */
pBitRevTab += bitRevFactor;
}
}
/**
@brief In-place Q31 bit reversal function.
@param[in,out] pSrc points to in-place Q31 data buffer.
@param[in] fftLen length of FFT.
@param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
@param[in] pBitRevTab points to bit reversal table
@return none
*/
void arm_bitreversal_q31(
q31_t * pSrc,
uint32_t fftLen,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab)
{
uint32_t fftLenBy2, fftLenBy2p1, i, j;
q31_t in;
/* Initializations */
j = 0U;
fftLenBy2 = fftLen / 2U;
fftLenBy2p1 = (fftLen / 2U) + 1U;
/* Bit Reversal Implementation */
for (i = 0U; i <= (fftLenBy2 - 2U); i += 2U)
{
if (i < j)
{
/* pSrc[i] <-> pSrc[j]; */
in = pSrc[2U * i];
pSrc[2U * i] = pSrc[2U * j];
pSrc[2U * j] = in;
/* pSrc[i+1U] <-> pSrc[j+1U] */
in = pSrc[(2U * i) + 1U];
pSrc[(2U * i) + 1U] = pSrc[(2U * j) + 1U];
pSrc[(2U * j) + 1U] = in;
/* pSrc[i+fftLenBy2p1] <-> pSrc[j+fftLenBy2p1] */
in = pSrc[2U * (i + fftLenBy2p1)];
pSrc[2U * (i + fftLenBy2p1)] = pSrc[2U * (j + fftLenBy2p1)];
pSrc[2U * (j + fftLenBy2p1)] = in;
/* pSrc[i+fftLenBy2p1+1U] <-> pSrc[j+fftLenBy2p1+1U] */
in = pSrc[(2U * (i + fftLenBy2p1)) + 1U];
pSrc[(2U * (i + fftLenBy2p1)) + 1U] =
pSrc[(2U * (j + fftLenBy2p1)) + 1U];
pSrc[(2U * (j + fftLenBy2p1)) + 1U] = in;
}
/* pSrc[i+1U] <-> pSrc[j+1U] */
in = pSrc[2U * (i + 1U)];
pSrc[2U * (i + 1U)] = pSrc[2U * (j + fftLenBy2)];
pSrc[2U * (j + fftLenBy2)] = in;
/* pSrc[i+2U] <-> pSrc[j+2U] */
in = pSrc[(2U * (i + 1U)) + 1U];
pSrc[(2U * (i + 1U)) + 1U] = pSrc[(2U * (j + fftLenBy2)) + 1U];
pSrc[(2U * (j + fftLenBy2)) + 1U] = in;
/* Reading the index for the bit reversal */
j = *pBitRevTab;
/* Updating the bit reversal index depending on the fft length */
pBitRevTab += bitRevFactor;
}
}
/**
@brief In-place Q15 bit reversal function.
@param[in,out] pSrc16 points to in-place Q15 data buffer
@param[in] fftLen length of FFT
@param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
@param[in] pBitRevTab points to bit reversal table
@return none
*/
void arm_bitreversal_q15(
q15_t * pSrc16,
uint32_t fftLen,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab)
{
q31_t *pSrc = (q31_t *) pSrc16;
q31_t in;
uint32_t fftLenBy2, fftLenBy2p1;
uint32_t i, j;
/* Initializations */
j = 0U;
fftLenBy2 = fftLen / 2U;
fftLenBy2p1 = (fftLen / 2U) + 1U;
/* Bit Reversal Implementation */
for (i = 0U; i <= (fftLenBy2 - 2U); i += 2U)
{
if (i < j)
{
/* pSrc[i] <-> pSrc[j]; */
/* pSrc[i+1U] <-> pSrc[j+1U] */
in = pSrc[i];
pSrc[i] = pSrc[j];
pSrc[j] = in;
/* pSrc[i + fftLenBy2p1] <-> pSrc[j + fftLenBy2p1]; */
/* pSrc[i + fftLenBy2p1+1U] <-> pSrc[j + fftLenBy2p1+1U] */
in = pSrc[i + fftLenBy2p1];
pSrc[i + fftLenBy2p1] = pSrc[j + fftLenBy2p1];
pSrc[j + fftLenBy2p1] = in;
}
/* pSrc[i+1U] <-> pSrc[j+fftLenBy2]; */
/* pSrc[i+2] <-> pSrc[j+fftLenBy2+1U] */
in = pSrc[i + 1U];
pSrc[i + 1U] = pSrc[j + fftLenBy2];
pSrc[j + fftLenBy2] = in;
/* Reading the index for the bit reversal */
j = *pBitRevTab;
/* Updating the bit reversal index depending on the fft length */
pBitRevTab += bitRevFactor;
}
}
| 7,037 | C | 29.6 | 118 | 0.525082 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/TransformFunctions.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: TransformFunctions.c
* Description: Combination of all transform function source files.
*
* $Date: 18. March 2019
* $Revision: V1.0.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_bitreversal.c"
#include "arm_bitreversal2.c"
#include "arm_cfft_f32.c"
#include "arm_cfft_q15.c"
#include "arm_cfft_q31.c"
#include "arm_cfft_radix2_f32.c"
#include "arm_cfft_radix2_init_f32.c"
#include "arm_cfft_radix2_init_q15.c"
#include "arm_cfft_radix2_init_q31.c"
#include "arm_cfft_radix2_q15.c"
#include "arm_cfft_radix2_q31.c"
#include "arm_cfft_radix4_f32.c"
#include "arm_cfft_radix4_init_f32.c"
#include "arm_cfft_radix4_init_q15.c"
#include "arm_cfft_radix4_init_q31.c"
#include "arm_cfft_radix4_q15.c"
#include "arm_cfft_radix4_q31.c"
#include "arm_cfft_radix8_f32.c"
#include "arm_dct4_f32.c"
#include "arm_dct4_init_f32.c"
#include "arm_dct4_init_q15.c"
#include "arm_dct4_init_q31.c"
#include "arm_dct4_q15.c"
#include "arm_dct4_q31.c"
#include "arm_rfft_f32.c"
#include "arm_rfft_fast_f32.c"
#include "arm_rfft_fast_init_f32.c"
#include "arm_rfft_init_f32.c"
#include "arm_rfft_init_q15.c"
#include "arm_rfft_init_q31.c"
#include "arm_rfft_q15.c"
#include "arm_rfft_q31.c"
| 2,061 | C | 32.803278 | 74 | 0.667152 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_init_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix4_init_q15.c
* Description: Radix-4 Decimation in Frequency Q15 FFT & IFFT initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Initialization function for the Q15 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q15 and will be removed in the future.
@param[in,out] S points to an instance of the Q15 CFFT/CIFFT structure
@param[in] fftLen length of the FFT
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Details
The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_cfft_radix4_init_q15(
arm_cfft_radix4_instance_q15 * S,
uint16_t fftLen,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialise the FFT length */
S->fftLen = fftLen;
/* Initialise the Twiddle coefficient pointer */
S->pTwiddle = (q15_t *) twiddleCoef_4096_q15;
/* Initialise the Flag for selection of CFFT or CIFFT */
S->ifftFlag = ifftFlag;
/* Initialise the Flag for calculation Bit reversal or not */
S->bitReverseFlag = bitReverseFlag;
/* Initializations of structure parameters depending on the FFT length */
switch (S->fftLen)
{
case 4096U:
/* Initializations of structure parameters for 4096 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 1U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 1U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) armBitRevTable;
break;
case 1024U:
/* Initializations of structure parameters for 1024 point FFT */
S->twidCoefModifier = 4U;
S->bitRevFactor = 4U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
break;
case 256U:
/* Initializations of structure parameters for 256 point FFT */
S->twidCoefModifier = 16U;
S->bitRevFactor = 16U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
break;
case 64U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 64U;
S->bitRevFactor = 64U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
break;
case 16U:
/* Initializations of structure parameters for 16 point FFT */
S->twidCoefModifier = 256U;
S->bitRevFactor = 256U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
break;
default:
/* Reporting argument error if fftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
return (status);
}
/**
@} end of ComplexFFT group
*/
| 4,941 | C | 32.849315 | 137 | 0.640761 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_dct4_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_dct4_q15.c
* Description: Processing function of DCT4 & IDCT4 Q15
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@addtogroup DCT4_IDCT4
@{
*/
/**
@brief Processing function for the Q15 DCT4/IDCT4.
@param[in] S points to an instance of the Q15 DCT4 structure.
@param[in] pState points to state buffer.
@param[in,out] pInlineBuffer points to the in-place input and output buffer.
@return none
@par Input an output formats
Internally inputs are downscaled in the RFFT process function to avoid overflows.
Number of bits downscaled, depends on the size of the transform. The input and output
formats for different DCT sizes and number of bits to upscale are mentioned in the table below:
\image html dct4FormatsQ15Table.gif
*/
void arm_dct4_q15(
const arm_dct4_instance_q15 * S,
q15_t * pState,
q15_t * pInlineBuffer)
{
const q15_t *weights = S->pTwiddle; /* Pointer to the Weights table */
const q15_t *cosFact = S->pCosFactor; /* Pointer to the cos factors table */
q15_t *pS1, *pS2, *pbuff; /* Temporary pointers for input buffer and pState buffer */
q15_t in; /* Temporary variable */
uint32_t i; /* Loop counter */
/* DCT4 computation involves DCT2 (which is calculated using RFFT)
* along with some pre-processing and post-processing.
* Computational procedure is explained as follows:
* (a) Pre-processing involves multiplying input with cos factor,
* r(n) = 2 * u(n) * cos(pi*(2*n+1)/(4*n))
* where,
* r(n) -- output of preprocessing
* u(n) -- input to preprocessing(actual Source buffer)
* (b) Calculation of DCT2 using FFT is divided into three steps:
* Step1: Re-ordering of even and odd elements of input.
* Step2: Calculating FFT of the re-ordered input.
* Step3: Taking the real part of the product of FFT output and weights.
* (c) Post-processing - DCT4 can be obtained from DCT2 output using the following equation:
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* where,
* Y4 -- DCT4 output, Y2 -- DCT2 output
* (d) Multiplying the output with the normalizing factor sqrt(2/N).
*/
/*-------- Pre-processing ------------*/
/* Multiplying input with cos factor i.e. r(n) = 2 * x(n) * cos(pi*(2*n+1)/(4*n)) */
arm_mult_q15 (pInlineBuffer, cosFact, pInlineBuffer, S->N);
arm_shift_q15 (pInlineBuffer, 1, pInlineBuffer, S->N);
/* ----------------------------------------------------------------
* Step1: Re-ordering of even and odd elements as
* pState[i] = pInlineBuffer[2*i] and
* pState[N-i-1] = pInlineBuffer[2*i+1] where i = 0 to N/2
---------------------------------------------------------------------*/
/* pS1 initialized to pState */
pS1 = pState;
/* pS2 initialized to pState+N-1, so that it points to the end of the state buffer */
pS2 = pState + (S->N - 1U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
#if defined (ARM_MATH_LOOPUNROLL)
/* Initializing the loop counter to N/2 >> 2 for loop unrolling by 4 */
i = S->Nby2 >> 2U;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
do
{
/* Re-ordering of even and odd elements */
/* pState[i] = pInlineBuffer[2*i] */
*pS1++ = *pbuff++;
/* pState[N-i-1] = pInlineBuffer[2*i+1] */
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
/* Decrement loop counter */
i--;
} while (i > 0U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Initializing the loop counter to N/4 instead of N for loop unrolling */
i = S->N >> 2U;
/* Processing with loop unrolling 4 times as N is always multiple of 4.
* Compute 4 outputs at a time */
do
{
/* Writing the re-ordered output back to inplace input buffer */
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* ---------------------------------------------------------
* Step2: Calculate RFFT for N-point input
* ---------------------------------------------------------- */
/* pInlineBuffer is real input of length N , pState is the complex output of length 2N */
arm_rfft_q15 (S->pRfft, pInlineBuffer, pState);
/*----------------------------------------------------------------------
* Step3: Multiply the FFT output with the weights.
*----------------------------------------------------------------------*/
arm_cmplx_mult_cmplx_q15 (pState, weights, pState, S->N);
/* The output of complex multiplication is in 3.13 format.
* Hence changing the format of N (i.e. 2*N elements) complex numbers to 1.15 format by shifting left by 2 bits. */
arm_shift_q15 (pState, 2, pState, S->N * 2);
/* ----------- Post-processing ---------- */
/* DCT-IV can be obtained from DCT-II by the equation,
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* Hence, Y4(0) = Y2(0)/2 */
/* Getting only real part from the output and Converting to DCT-IV */
/* Initializing the loop counter to N >> 2 for loop unrolling by 4 */
i = (S->N - 1U) >> 2U;
/* pbuff initialized to input buffer. */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Calculating Y4(0) from Y2(0) using Y4(0) = Y2(0)/2 */
in = *pS1++ >> 1U;
/* input buffer acts as inplace, so output values are stored in the input itself. */
*pbuff++ = in;
/* pState pointer is incremented twice as the real values are located alternatively in the array */
pS1++;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
do
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
i = (S->N - 1U) % 0x4U;
while (i > 0U)
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
/* Decrement loop counter */
i--;
}
/*------------ Normalizing the output by multiplying with the normalizing factor ----------*/
/* Initializing the loop counter to N/4 instead of N for loop unrolling */
i = S->N >> 2U;
/* pbuff initialized to the pInlineBuffer(now contains the output values) */
pbuff = pInlineBuffer;
/* Processing with loop unrolling 4 times as N is always multiple of 4. Compute 4 outputs at a time */
do
{
/* Multiplying pInlineBuffer with the normalizing factor sqrt(2/N) */
in = *pbuff;
*pbuff++ = ((q15_t) (((q31_t) in * S->normalize) >> 15));
in = *pbuff;
*pbuff++ = ((q15_t) (((q31_t) in * S->normalize) >> 15));
in = *pbuff;
*pbuff++ = ((q15_t) (((q31_t) in * S->normalize) >> 15));
in = *pbuff;
*pbuff++ = ((q15_t) (((q31_t) in * S->normalize) >> 15));
/* Decrement loop counter */
i--;
} while (i > 0U);
#else
/* Initializing the loop counter to N/2 */
i = S->Nby2;
do
{
/* Re-ordering of even and odd elements */
/* pState[i] = pInlineBuffer[2*i] */
*pS1++ = *pbuff++;
/* pState[N-i-1] = pInlineBuffer[2*i+1] */
*pS2-- = *pbuff++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Initializing the loop counter */
i = S->N;
do
{
/* Writing the re-ordered output back to inplace input buffer */
*pbuff++ = *pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* ---------------------------------------------------------
* Step2: Calculate RFFT for N-point input
* ---------------------------------------------------------- */
/* pInlineBuffer is real input of length N , pState is the complex output of length 2N */
arm_rfft_q15 (S->pRfft, pInlineBuffer, pState);
/*----------------------------------------------------------------------
* Step3: Multiply the FFT output with the weights.
*----------------------------------------------------------------------*/
arm_cmplx_mult_cmplx_q15 (pState, weights, pState, S->N);
/* The output of complex multiplication is in 3.13 format.
* Hence changing the format of N (i.e. 2*N elements) complex numbers to 1.15 format by shifting left by 2 bits. */
arm_shift_q15 (pState, 2, pState, S->N * 2);
/* ----------- Post-processing ---------- */
/* DCT-IV can be obtained from DCT-II by the equation,
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* Hence, Y4(0) = Y2(0)/2 */
/* Getting only real part from the output and Converting to DCT-IV */
/* pbuff initialized to input buffer. */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Calculating Y4(0) from Y2(0) using Y4(0) = Y2(0)/2 */
in = *pS1++ >> 1U;
/* input buffer acts as inplace, so output values are stored in the input itself. */
*pbuff++ = in;
/* pState pointer is incremented twice as the real values are located alternatively in the array */
pS1++;
/* Initializing the loop counter */
i = (S->N - 1U);
do
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
/* Decrement loop counter */
i--;
} while (i > 0U);
/*------------ Normalizing the output by multiplying with the normalizing factor ----------*/
/* Initializing loop counter */
i = S->N;
/* pbuff initialized to the pInlineBuffer (now contains the output values) */
pbuff = pInlineBuffer;
do
{
/* Multiplying pInlineBuffer with the normalizing factor sqrt(2/N) */
in = *pbuff;
*pbuff++ = ((q15_t) (((q31_t) in * S->normalize) >> 15));
/* Decrement loop counter */
i--;
} while (i > 0U);
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
}
/**
@} end of DCT4_IDCT4 group
*/
| 12,368 | C | 31.379581 | 117 | 0.5511 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_f32.c
* Description: RFFT & RIFFT Floating point process function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
void stage_rfft_f32(
const arm_rfft_fast_instance_f32 * S,
float32_t * p,
float32_t * pOut)
{
uint32_t k; /* Loop Counter */
float32_t twR, twI; /* RFFT Twiddle coefficients */
const float32_t * pCoeff = S->pTwiddleRFFT; /* Points to RFFT Twiddle factors */
float32_t *pA = p; /* increasing pointer */
float32_t *pB = p; /* decreasing pointer */
float32_t xAR, xAI, xBR, xBI; /* temporary variables */
float32_t t1a, t1b; /* temporary variables */
float32_t p0, p1, p2, p3; /* temporary variables */
k = (S->Sint).fftLen - 1;
/* Pack first and last sample of the frequency domain together */
xBR = pB[0];
xBI = pB[1];
xAR = pA[0];
xAI = pA[1];
twR = *pCoeff++ ;
twI = *pCoeff++ ;
// U1 = XA(1) + XB(1); % It is real
t1a = xBR + xAR ;
// U2 = XB(1) - XA(1); % It is imaginary
t1b = xBI + xAI ;
// real(tw * (xB - xA)) = twR * (xBR - xAR) - twI * (xBI - xAI);
// imag(tw * (xB - xA)) = twI * (xBR - xAR) + twR * (xBI - xAI);
*pOut++ = 0.5f * ( t1a + t1b );
*pOut++ = 0.5f * ( t1a - t1b );
// XA(1) = 1/2*( U1 - imag(U2) + i*( U1 +imag(U2) ));
pB = p + 2*k;
pA += 2;
do
{
/*
function X = my_split_rfft(X, ifftFlag)
% X is a series of real numbers
L = length(X);
XC = X(1:2:end) +i*X(2:2:end);
XA = fft(XC);
XB = conj(XA([1 end:-1:2]));
TW = i*exp(-2*pi*i*[0:L/2-1]/L).';
for l = 2:L/2
XA(l) = 1/2 * (XA(l) + XB(l) + TW(l) * (XB(l) - XA(l)));
end
XA(1) = 1/2* (XA(1) + XB(1) + TW(1) * (XB(1) - XA(1))) + i*( 1/2*( XA(1) + XB(1) + i*( XA(1) - XB(1))));
X = XA;
*/
xBI = pB[1];
xBR = pB[0];
xAR = pA[0];
xAI = pA[1];
twR = *pCoeff++;
twI = *pCoeff++;
t1a = xBR - xAR ;
t1b = xBI + xAI ;
// real(tw * (xB - xA)) = twR * (xBR - xAR) - twI * (xBI - xAI);
// imag(tw * (xB - xA)) = twI * (xBR - xAR) + twR * (xBI - xAI);
p0 = twR * t1a;
p1 = twI * t1a;
p2 = twR * t1b;
p3 = twI * t1b;
*pOut++ = 0.5f * (xAR + xBR + p0 + p3 ); //xAR
*pOut++ = 0.5f * (xAI - xBI + p1 - p2 ); //xAI
pA += 2;
pB -= 2;
k--;
} while (k > 0U);
}
/* Prepares data for inverse cfft */
void merge_rfft_f32(
const arm_rfft_fast_instance_f32 * S,
float32_t * p,
float32_t * pOut)
{
uint32_t k; /* Loop Counter */
float32_t twR, twI; /* RFFT Twiddle coefficients */
const float32_t *pCoeff = S->pTwiddleRFFT; /* Points to RFFT Twiddle factors */
float32_t *pA = p; /* increasing pointer */
float32_t *pB = p; /* decreasing pointer */
float32_t xAR, xAI, xBR, xBI; /* temporary variables */
float32_t t1a, t1b, r, s, t, u; /* temporary variables */
k = (S->Sint).fftLen - 1;
xAR = pA[0];
xAI = pA[1];
pCoeff += 2 ;
*pOut++ = 0.5f * ( xAR + xAI );
*pOut++ = 0.5f * ( xAR - xAI );
pB = p + 2*k ;
pA += 2 ;
while (k > 0U)
{
/* G is half of the frequency complex spectrum */
//for k = 2:N
// Xk(k) = 1/2 * (G(k) + conj(G(N-k+2)) + Tw(k)*( G(k) - conj(G(N-k+2))));
xBI = pB[1] ;
xBR = pB[0] ;
xAR = pA[0];
xAI = pA[1];
twR = *pCoeff++;
twI = *pCoeff++;
t1a = xAR - xBR ;
t1b = xAI + xBI ;
r = twR * t1a;
s = twI * t1b;
t = twI * t1a;
u = twR * t1b;
// real(tw * (xA - xB)) = twR * (xAR - xBR) - twI * (xAI - xBI);
// imag(tw * (xA - xB)) = twI * (xAR - xBR) + twR * (xAI - xBI);
*pOut++ = 0.5f * (xAR + xBR - r - s ); //xAR
*pOut++ = 0.5f * (xAI - xBI + t - u ); //xAI
pA += 2;
pB -= 2;
k--;
}
}
/**
@ingroup groupTransforms
*/
/**
@defgroup RealFFT Real FFT Functions
@par
The CMSIS DSP library includes specialized algorithms for computing the
FFT of real data sequences. The FFT is defined over complex data but
in many applications the input is real. Real FFT algorithms take advantage
of the symmetry properties of the FFT and have a speed advantage over complex
algorithms of the same length.
@par
The Fast RFFT algorith relays on the mixed radix CFFT that save processor usage.
@par
The real length N forward FFT of a sequence is computed using the steps shown below.
@par
\image html RFFT.gif "Real Fast Fourier Transform"
@par
The real sequence is initially treated as if it were complex to perform a CFFT.
Later, a processing stage reshapes the data to obtain half of the frequency spectrum
in complex format. Except the first complex number that contains the two real numbers
X[0] and X[N/2] all the data is complex. In other words, the first complex sample
contains two real values packed.
@par
The input for the inverse RFFT should keep the same format as the output of the
forward RFFT. A first processing stage pre-process the data to later perform an
inverse CFFT.
@par
\image html RIFFT.gif "Real Inverse Fast Fourier Transform"
@par
The algorithms for floating-point, Q15, and Q31 data are slightly different
and we describe each algorithm in turn.
@par Floating-point
The main functions are \ref arm_rfft_fast_f32() and \ref arm_rfft_fast_init_f32().
The older functions \ref arm_rfft_f32() and \ref arm_rfft_init_f32() have been deprecated
but are still documented.
@par
The FFT of a real N-point sequence has even symmetry in the frequency domain.
The second half of the data equals the conjugate of the first half flipped in frequency.
Looking at the data, we see that we can uniquely represent the FFT using only N/2 complex numbers.
These are packed into the output array in alternating real and imaginary components:
@par
X = { real[0], imag[0], real[1], imag[1], real[2], imag[2] ...
real[(N/2)-1], imag[(N/2)-1 }
@par
It happens that the first complex number (real[0], imag[0]) is actually
all real. real[0] represents the DC offset, and imag[0] should be 0.
(real[1], imag[1]) is the fundamental frequency, (real[2], imag[2]) is
the first harmonic and so on.
@par
The real FFT functions pack the frequency domain data in this fashion.
The forward transform outputs the data in this form and the inverse
transform expects input data in this form. The function always performs
the needed bitreversal so that the input and output data is always in
normal order. The functions support lengths of [32, 64, 128, ..., 4096]
samples.
@par Q15 and Q31
The real algorithms are defined in a similar manner and utilize N/2 complex
transforms behind the scenes.
@par
The complex transforms used internally include scaling to prevent fixed-point
overflows. The overall scaling equals 1/(fftLen/2).
@par
A separate instance structure must be defined for each transform used but
twiddle factor and bit reversal tables can be reused.
@par
There is also an associated initialization function for each data type.
The initialization function performs the following operations:
- Sets the values of the internal structure fields.
- Initializes twiddle factor table and bit reversal table pointers.
- Initializes the internal complex FFT data structure.
@par
Use of the initialization function is optional.
However, if the initialization function is used, then the instance structure
cannot be placed into a const data section. To place an instance structure
into a const data section, the instance structure should be manually
initialized as follows:
<pre>
arm_rfft_instance_q31 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
arm_rfft_instance_q15 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
</pre>
where <code>fftLenReal</code> is the length of the real transform;
<code>fftLenBy2</code> length of the internal complex transform.
<code>ifftFlagR</code> Selects forward (=0) or inverse (=1) transform.
<code>bitReverseFlagR</code> Selects bit reversed output (=0) or normal order
output (=1).
<code>twidCoefRModifier</code> stride modifier for the twiddle factor table.
The value is based on the FFT length;
<code>pTwiddleAReal</code>points to the A array of twiddle coefficients;
<code>pTwiddleBReal</code>points to the B array of twiddle coefficients;
<code>pCfft</code> points to the CFFT Instance structure. The CFFT structure
must also be initialized. Refer to arm_cfft_radix4_f32() for details regarding
static initialization of the complex FFT instance structure.
*/
/**
@addtogroup RealFFT
@{
*/
/**
@brief Processing function for the floating-point real FFT.
@param[in] S points to an arm_rfft_fast_instance_f32 structure
@param[in] p points to input buffer
@param[in] pOut points to output buffer
@param[in] ifftFlag
- value = 0: RFFT
- value = 1: RIFFT
@return none
*/
void arm_rfft_fast_f32(
arm_rfft_fast_instance_f32 * S,
float32_t * p,
float32_t * pOut,
uint8_t ifftFlag)
{
arm_cfft_instance_f32 * Sint = &(S->Sint);
Sint->fftLen = S->fftLenRFFT / 2;
/* Calculation of Real FFT */
if (ifftFlag)
{
/* Real FFT compression */
merge_rfft_f32(S, p, pOut);
/* Complex radix-4 IFFT process */
arm_cfft_f32( Sint, pOut, ifftFlag, 1);
}
else
{
/* Calculation of RFFT of input */
arm_cfft_f32( Sint, p, ifftFlag, 1);
/* Real FFT extraction */
stage_rfft_f32(S, p, pOut);
}
}
/**
* @} end of RealFFT group
*/
| 12,298 | C | 37.314642 | 140 | 0.536754 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_dct4_init_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_dct4_init_f32.c
* Description: Initialization function of DCT-4 & IDCT4 F32
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup DCT4_IDCT4
*/
/**
@addtogroup DCT4_IDCT4
@{
*/
/**
@brief Initialization function for the floating-point DCT4/IDCT4.
@param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure
@param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure
@param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure
@param[in] N length of the DCT4
@param[in] Nby2 half of the length of the DCT4
@param[in] normalize normalizing factor.
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>N</code> is not a supported transform length
@par Normalizing factor
The normalizing factor is <code>sqrt(2/N)</code>, which depends on the size of transform <code>N</code>.
Floating-point normalizing factors are mentioned in the table below for different DCT sizes:
\image html dct4NormalizingF32Table.gif
*/
arm_status arm_dct4_init_f32(
arm_dct4_instance_f32 * S,
arm_rfft_instance_f32 * S_RFFT,
arm_cfft_radix4_instance_f32 * S_CFFT,
uint16_t N,
uint16_t Nby2,
float32_t normalize)
{
/* Initialize the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialize the DCT4 length */
S->N = N;
/* Initialize the half of DCT4 length */
S->Nby2 = Nby2;
/* Initialize the DCT4 Normalizing factor */
S->normalize = normalize;
/* Initialize Real FFT Instance */
S->pRfft = S_RFFT;
/* Initialize Complex FFT Instance */
S->pCfft = S_CFFT;
switch (N)
{
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_8192)
/* Initialize the table modifier values */
case 8192U:
S->pTwiddle = Weights_8192;
S->pCosFactor = cos_factors_8192;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_2048)
case 2048U:
S->pTwiddle = Weights_2048;
S->pCosFactor = cos_factors_2048;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_512)
case 512U:
S->pTwiddle = Weights_512;
S->pCosFactor = cos_factors_512;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_128)
case 128U:
S->pTwiddle = Weights_128;
S->pCosFactor = cos_factors_128;
break;
#endif
default:
status = ARM_MATH_ARGUMENT_ERROR;
}
/* Initialize the RFFT/RIFFT Function */
arm_rfft_init_f32(S->pRfft, S->pCfft, S->N, 0U, 1U);
/* return the status of DCT4 Init function */
return (status);
}
/**
@} end of DCT4_IDCT4 group
*/
| 3,956 | C | 28.977273 | 123 | 0.633468 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix4_q15.c
* Description: This file has function definition of Radix-4 FFT & IFFT function and
* In-place bit reversal using bit reversal table
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
void arm_radix4_butterfly_q15(
q15_t * pSrc16,
uint32_t fftLen,
const q15_t * pCoef16,
uint32_t twidCoefModifier);
void arm_radix4_butterfly_inverse_q15(
q15_t * pSrc16,
uint32_t fftLen,
const q15_t * pCoef16,
uint32_t twidCoefModifier);
void arm_bitreversal_q15(
q15_t * pSrc,
uint32_t fftLen,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the Q15 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q15 and will be removed in the future.
@param[in] S points to an instance of the Q15 CFFT/CIFFT structure.
@param[in,out] pSrc points to the complex data buffer. Processing occurs in-place.
@return none
@par Input and output formats:
Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process.
Hence the output format is different for different FFT sizes.
The input and output formats for different FFT sizes and number of bits to upscale are mentioned in the tables below for CFFT and CIFFT:
@par
\image html CFFTQ15.gif "Input and Output Formats for Q15 CFFT"
\image html CIFFTQ15.gif "Input and Output Formats for Q15 CIFFT"
*/
void arm_cfft_radix4_q15(
const arm_cfft_radix4_instance_q15 * S,
q15_t * pSrc)
{
if (S->ifftFlag == 1U)
{
/* Complex IFFT radix-4 */
arm_radix4_butterfly_inverse_q15(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
else
{
/* Complex FFT radix-4 */
arm_radix4_butterfly_q15(pSrc, S->fftLen, S->pTwiddle, S->twidCoefModifier);
}
if (S->bitReverseFlag == 1U)
{
/* Bit Reversal */
arm_bitreversal_q15(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
}
}
/**
@} end of ComplexFFT group
*/
/*
* Radix-4 FFT algorithm used is :
*
* Input real and imaginary data:
* x(n) = xa + j * ya
* x(n+N/4 ) = xb + j * yb
* x(n+N/2 ) = xc + j * yc
* x(n+3N 4) = xd + j * yd
*
*
* Output real and imaginary data:
* x(4r) = xa'+ j * ya'
* x(4r+1) = xb'+ j * yb'
* x(4r+2) = xc'+ j * yc'
* x(4r+3) = xd'+ j * yd'
*
*
* Twiddle factors for radix-4 FFT:
* Wn = co1 + j * (- si1)
* W2n = co2 + j * (- si2)
* W3n = co3 + j * (- si3)
* The real and imaginary output values for the radix-4 butterfly are
* xa' = xa + xb + xc + xd
* ya' = ya + yb + yc + yd
* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1)
* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1)
* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2)
* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2)
* xd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3)
* yd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3)
*
*/
/**
@brief Core function for the Q15 CFFT butterfly process.
@param[in,out] pSrc16 points to the in-place buffer of Q15 data type
@param[in] fftLen length of the FFT
@param[in] pCoef16 points to twiddle coefficient buffer
@param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
*/
void arm_radix4_butterfly_q15(
q15_t * pSrc16,
uint32_t fftLen,
const q15_t * pCoef16,
uint32_t twidCoefModifier)
{
#if defined (ARM_MATH_DSP)
q31_t R, S, T, U;
q31_t C1, C2, C3, out1, out2;
uint32_t n1, n2, ic, i0, j, k;
q15_t *ptr1;
q15_t *pSi0;
q15_t *pSi1;
q15_t *pSi2;
q15_t *pSi3;
q31_t xaya, xbyb, xcyc, xdyd;
/* Total process is divided into three stages */
/* process first stage, middle stages, & last stage */
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
/* Index for twiddle coefficient */
ic = 0U;
/* Index for input read and output write */
j = n2;
pSi0 = pSrc16;
pSi1 = pSi0 + 2 * n2;
pSi2 = pSi1 + 2 * n2;
pSi3 = pSi2 + 2 * n2;
/* Input is in 1.15(q15) format */
/* start of first stage process */
do
{
/* Butterfly implementation */
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T = read_q15x2 (pSi0);
T = __SHADD16(T, 0); /* this is just a SIMD arithmetic shift right by 1 */
T = __SHADD16(T, 0); /* it turns out doing this twice is 2 cycles, the alternative takes 3 cycles */
/*
in = ((int16_t) (T & 0xFFFF)) >> 2; // alternative code that takes 3 cycles
T = ((T >> 2) & 0xFFFF0000) | (in & 0xFFFF);
*/
/* Read yc (real), xc(imag) input */
S = read_q15x2 (pSi2);
S = __SHADD16(S, 0);
S = __SHADD16(S, 0);
/* R = packed((ya + yc), (xa + xc) ) */
R = __QADD16(T, S);
/* S = packed((ya - yc), (xa - xc) ) */
S = __QSUB16(T, S);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T = read_q15x2 (pSi1);
T = __SHADD16(T, 0);
T = __SHADD16(T, 0);
/* Read yd (real), xd(imag) input */
U = read_q15x2 (pSi3);
U = __SHADD16(U, 0);
U = __SHADD16(U, 0);
/* T = packed((yb + yd), (xb + xd) ) */
T = __QADD16(T, U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
write_q15x2_ia (&pSi0, __SHADD16(R, T));
/* R = packed((ya + yc) - (yb + yd), (xa + xc)- (xb + xd)) */
R = __QSUB16(R, T);
/* co2 & si2 are read from SIMD Coefficient pointer */
C2 = read_q15x2 ((q15_t *) pCoef16 + (4U * ic));
#ifndef ARM_MATH_BIG_ENDIAN
/* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
out1 = __SMUAD(C2, R) >> 16U;
/* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out2 = __SMUSDX(C2, R);
#else
/* xc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out1 = __SMUSDX(R, C2) >> 16U;
/* yc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
out2 = __SMUAD(C2, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* Reading i0+fftLen/4 */
/* T = packed(yb, xb) */
T = read_q15x2 (pSi1);
T = __SHADD16(T, 0);
T = __SHADD16(T, 0);
/* writing the butterfly processed i0 + fftLen/4 sample */
/* writing output(xc', yc') in little endian format */
write_q15x2_ia (&pSi1, (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
/* Butterfly calculations */
/* U = packed(yd, xd) */
U = read_q15x2 (pSi3);
U = __SHADD16(U, 0);
U = __SHADD16(U, 0);
/* T = packed(yb-yd, xb-xd) */
T = __QSUB16(T, U);
#ifndef ARM_MATH_BIG_ENDIAN
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __QASX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __QSAX(S, T);
#else
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __QSAX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __QASX(S, T);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* co1 & si1 are read from SIMD Coefficient pointer */
C1 = read_q15x2 ((q15_t *) pCoef16 + (2U * ic));
/* Butterfly process for the i0+fftLen/2 sample */
#ifndef ARM_MATH_BIG_ENDIAN
/* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
out1 = __SMUAD(C1, S) >> 16U;
/* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
out2 = __SMUSDX(C1, S);
#else
/* xb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
out1 = __SMUSDX(S, C1) >> 16U;
/* yb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
out2 = __SMUAD(C1, S);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* writing output(xb', yb') in little endian format */
write_q15x2_ia (&pSi2, ((out2) & 0xFFFF0000) | ((out1) & 0x0000FFFF));
/* co3 & si3 are read from SIMD Coefficient pointer */
C3 = read_q15x2 ((q15_t *) pCoef16 + (6U * ic));
/* Butterfly process for the i0+3fftLen/4 sample */
#ifndef ARM_MATH_BIG_ENDIAN
/* xd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3) */
out1 = __SMUAD(C3, R) >> 16U;
/* yd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3) */
out2 = __SMUSDX(C3, R);
#else
/* xd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3) */
out1 = __SMUSDX(R, C3) >> 16U;
/* yd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3) */
out2 = __SMUAD(C3, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* writing output(xd', yd') in little endian format */
write_q15x2_ia (&pSi3, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
} while (--j);
/* data is in 4.11(q11) format */
/* end of first stage process */
/* start of middle stage process */
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
/* Calculation of Middle stage */
for (k = fftLen / 4U; k > 4U; k >>= 2U)
{
/* Initializations for the middle stage */
n1 = n2;
n2 >>= 2U;
ic = 0U;
for (j = 0U; j <= (n2 - 1U); j++)
{
/* index calculation for the coefficients */
C1 = read_q15x2 ((q15_t *) pCoef16 + (2U * ic));
C2 = read_q15x2 ((q15_t *) pCoef16 + (4U * ic));
C3 = read_q15x2 ((q15_t *) pCoef16 + (6U * ic));
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
pSi0 = pSrc16 + 2 * j;
pSi1 = pSi0 + 2 * n2;
pSi2 = pSi1 + 2 * n2;
pSi3 = pSi2 + 2 * n2;
/* Butterfly implementation */
for (i0 = j; i0 < fftLen; i0 += n1)
{
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T = read_q15x2 (pSi0);
/* Read yc (real), xc(imag) input */
S = read_q15x2 (pSi2);
/* R = packed( (ya + yc), (xa + xc)) */
R = __QADD16(T, S);
/* S = packed((ya - yc), (xa - xc)) */
S = __QSUB16(T, S);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T = read_q15x2 (pSi1);
/* Read yd (real), xd(imag) input */
U = read_q15x2 (pSi3);
/* T = packed( (yb + yd), (xb + xd)) */
T = __QADD16(T, U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
out1 = __SHADD16(R, T);
out1 = __SHADD16(out1, 0);
write_q15x2 (pSi0, out1);
pSi0 += 2 * n1;
/* R = packed( (ya + yc) - (yb + yd), (xa + xc) - (xb + xd)) */
R = __SHSUB16(R, T);
#ifndef ARM_MATH_BIG_ENDIAN
/* (ya-yb+yc-yd)* (si2) + (xa-xb+xc-xd)* co2 */
out1 = __SMUAD(C2, R) >> 16U;
/* (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out2 = __SMUSDX(C2, R);
#else
/* (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out1 = __SMUSDX(R, C2) >> 16U;
/* (ya-yb+yc-yd)* (si2) + (xa-xb+xc-xd)* co2 */
out2 = __SMUAD(C2, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* Reading i0+3fftLen/4 */
/* Read yb (real), xb(imag) input */
T = read_q15x2 (pSi1);
/* writing the butterfly processed i0 + fftLen/4 sample */
/* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
/* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
write_q15x2 (pSi1, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
pSi1 += 2 * n1;
/* Butterfly calculations */
/* Read yd (real), xd(imag) input */
U = read_q15x2 (pSi3);
/* T = packed(yb-yd, xb-xd) */
T = __QSUB16(T, U);
#ifndef ARM_MATH_BIG_ENDIAN
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __SHASX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __SHSAX(S, T);
/* Butterfly process for the i0+fftLen/2 sample */
out1 = __SMUAD(C1, S) >> 16U;
out2 = __SMUSDX(C1, S);
#else
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __SHSAX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __SHASX(S, T);
/* Butterfly process for the i0+fftLen/2 sample */
out1 = __SMUSDX(S, C1) >> 16U;
out2 = __SMUAD(C1, S);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
/* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
write_q15x2 (pSi2, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
pSi2 += 2 * n1;
/* Butterfly process for the i0+3fftLen/4 sample */
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUAD(C3, R) >> 16U;
out2 = __SMUSDX(C3, R);
#else
out1 = __SMUSDX(R, C3) >> 16U;
out2 = __SMUAD(C3, R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* xd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3) */
/* yd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3) */
write_q15x2 (pSi3, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
pSi3 += 2 * n1;
}
}
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
}
/* end of middle stage process */
/* data is in 10.6(q6) format for the 1024 point */
/* data is in 8.8(q8) format for the 256 point */
/* data is in 6.10(q10) format for the 64 point */
/* data is in 4.12(q12) format for the 16 point */
/* Initializations for the last stage */
j = fftLen >> 2;
ptr1 = &pSrc16[0];
/* start of last stage process */
/* Butterfly implementation */
do
{
/* Read xa (real), ya(imag) input */
xaya = read_q15x2_ia ((q15_t **) &ptr1);
/* Read xb (real), yb(imag) input */
xbyb = read_q15x2_ia ((q15_t **) &ptr1);
/* Read xc (real), yc(imag) input */
xcyc = read_q15x2_ia ((q15_t **) &ptr1);
/* Read xd (real), yd(imag) input */
xdyd = read_q15x2_ia ((q15_t **) &ptr1);
/* R = packed((ya + yc), (xa + xc)) */
R = __QADD16(xaya, xcyc);
/* T = packed((yb + yd), (xb + xd)) */
T = __QADD16(xbyb, xdyd);
/* pointer updation for writing */
ptr1 = ptr1 - 8U;
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
write_q15x2_ia (&ptr1, __SHADD16(R, T));
/* T = packed((yb + yd), (xb + xd)) */
T = __QADD16(xbyb, xdyd);
/* xc' = (xa-xb+xc-xd) */
/* yc' = (ya-yb+yc-yd) */
write_q15x2_ia (&ptr1, __SHSUB16(R, T));
/* S = packed((ya - yc), (xa - xc)) */
S = __QSUB16(xaya, xcyc);
/* Read yd (real), xd(imag) input */
/* T = packed( (yb - yd), (xb - xd)) */
U = __QSUB16(xbyb, xdyd);
#ifndef ARM_MATH_BIG_ENDIAN
/* xb' = (xa+yb-xc-yd) */
/* yb' = (ya-xb-yc+xd) */
write_q15x2_ia (&ptr1, __SHSAX(S, U));
/* xd' = (xa-yb-xc+yd) */
/* yd' = (ya+xb-yc-xd) */
write_q15x2_ia (&ptr1, __SHASX(S, U));
#else
/* xb' = (xa+yb-xc-yd) */
/* yb' = (ya-xb-yc+xd) */
write_q15x2_ia (&ptr1, __SHASX(S, U));
/* xd' = (xa-yb-xc+yd) */
/* yd' = (ya+xb-yc-xd) */
write_q15x2_ia (&ptr1, __SHSAX(S, U));
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
} while (--j);
/* end of last stage process */
/* output is in 11.5(q5) format for the 1024 point */
/* output is in 9.7(q7) format for the 256 point */
/* output is in 7.9(q9) format for the 64 point */
/* output is in 5.11(q11) format for the 16 point */
#else /* #if defined (ARM_MATH_DSP) */
q15_t R0, R1, S0, S1, T0, T1, U0, U1;
q15_t Co1, Si1, Co2, Si2, Co3, Si3, out1, out2;
uint32_t n1, n2, ic, i0, i1, i2, i3, j, k;
/* Total process is divided into three stages */
/* process first stage, middle stages, & last stage */
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
/* Index for twiddle coefficient */
ic = 0U;
/* Index for input read and output write */
i0 = 0U;
j = n2;
/* Input is in 1.15(q15) format */
/* start of first stage process */
do
{
/* Butterfly implementation */
/* index calculation for the input as, */
/* pSrc16[i0 + 0], pSrc16[i0 + fftLen/4], pSrc16[i0 + fftLen/2], pSrc16[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Reading i0, i0+fftLen/2 inputs */
/* input is down scale by 4 to avoid overflow */
/* Read ya (real), xa(imag) input */
T0 = pSrc16[i0 * 2U] >> 2U;
T1 = pSrc16[(i0 * 2U) + 1U] >> 2U;
/* input is down scale by 4 to avoid overflow */
/* Read yc (real), xc(imag) input */
S0 = pSrc16[i2 * 2U] >> 2U;
S1 = pSrc16[(i2 * 2U) + 1U] >> 2U;
/* R0 = (ya + yc) */
R0 = __SSAT(T0 + S0, 16U);
/* R1 = (xa + xc) */
R1 = __SSAT(T1 + S1, 16U);
/* S0 = (ya - yc) */
S0 = __SSAT(T0 - S0, 16);
/* S1 = (xa - xc) */
S1 = __SSAT(T1 - S1, 16);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* input is down scale by 4 to avoid overflow */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U] >> 2U;
T1 = pSrc16[(i1 * 2U) + 1U] >> 2U;
/* input is down scale by 4 to avoid overflow */
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U] >> 2U;
U1 = pSrc16[(i3 * 2U) + 1] >> 2U;
/* T0 = (yb + yd) */
T0 = __SSAT(T0 + U0, 16U);
/* T1 = (xb + xd) */
T1 = __SSAT(T1 + U1, 16U);
/* writing the butterfly processed i0 sample */
/* ya' = ya + yb + yc + yd */
/* xa' = xa + xb + xc + xd */
pSrc16[i0 * 2U] = (R0 >> 1U) + (T0 >> 1U);
pSrc16[(i0 * 2U) + 1U] = (R1 >> 1U) + (T1 >> 1U);
/* R0 = (ya + yc) - (yb + yd) */
/* R1 = (xa + xc) - (xb + xd) */
R0 = __SSAT(R0 - T0, 16U);
R1 = __SSAT(R1 - T1, 16U);
/* co2 & si2 are read from Coefficient pointer */
Co2 = pCoef16[2U * ic * 2U];
Si2 = pCoef16[(2U * ic * 2U) + 1];
/* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
out1 = (q15_t) ((Co2 * R0 + Si2 * R1) >> 16U);
/* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out2 = (q15_t) ((-Si2 * R0 + Co2 * R1) >> 16U);
/* Reading i0+fftLen/4 */
/* input is down scale by 4 to avoid overflow */
/* T0 = yb, T1 = xb */
T0 = pSrc16[i1 * 2U] >> 2;
T1 = pSrc16[(i1 * 2U) + 1] >> 2;
/* writing the butterfly processed i0 + fftLen/4 sample */
/* writing output(xc', yc') in little endian format */
pSrc16[i1 * 2U] = out1;
pSrc16[(i1 * 2U) + 1] = out2;
/* Butterfly calculations */
/* input is down scale by 4 to avoid overflow */
/* U0 = yd, U1 = xd */
U0 = pSrc16[i3 * 2U] >> 2;
U1 = pSrc16[(i3 * 2U) + 1] >> 2;
/* T0 = yb-yd */
T0 = __SSAT(T0 - U0, 16);
/* T1 = xb-xd */
T1 = __SSAT(T1 - U1, 16);
/* R1 = (ya-yc) + (xb- xd), R0 = (xa-xc) - (yb-yd)) */
R0 = (q15_t) __SSAT((q31_t) (S0 - T1), 16);
R1 = (q15_t) __SSAT((q31_t) (S1 + T0), 16);
/* S1 = (ya-yc) - (xb- xd), S0 = (xa-xc) + (yb-yd)) */
S0 = (q15_t) __SSAT(((q31_t) S0 + T1), 16U);
S1 = (q15_t) __SSAT(((q31_t) S1 - T0), 16U);
/* co1 & si1 are read from Coefficient pointer */
Co1 = pCoef16[ic * 2U];
Si1 = pCoef16[(ic * 2U) + 1];
/* Butterfly process for the i0+fftLen/2 sample */
/* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
out1 = (q15_t) ((Si1 * S1 + Co1 * S0) >> 16);
/* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
out2 = (q15_t) ((-Si1 * S0 + Co1 * S1) >> 16);
/* writing output(xb', yb') in little endian format */
pSrc16[i2 * 2U] = out1;
pSrc16[(i2 * 2U) + 1] = out2;
/* Co3 & si3 are read from Coefficient pointer */
Co3 = pCoef16[3U * (ic * 2U)];
Si3 = pCoef16[(3U * (ic * 2U)) + 1];
/* Butterfly process for the i0+3fftLen/4 sample */
/* xd' = (xa-yb-xc+yd)* Co3 + (ya+xb-yc-xd)* (si3) */
out1 = (q15_t) ((Si3 * R1 + Co3 * R0) >> 16U);
/* yd' = (ya+xb-yc-xd)* Co3 - (xa-yb-xc+yd)* (si3) */
out2 = (q15_t) ((-Si3 * R0 + Co3 * R1) >> 16U);
/* writing output(xd', yd') in little endian format */
pSrc16[i3 * 2U] = out1;
pSrc16[(i3 * 2U) + 1] = out2;
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
/* Updating input index */
i0 = i0 + 1U;
} while (--j);
/* data is in 4.11(q11) format */
/* end of first stage process */
/* start of middle stage process */
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
/* Calculation of Middle stage */
for (k = fftLen / 4U; k > 4U; k >>= 2U)
{
/* Initializations for the middle stage */
n1 = n2;
n2 >>= 2U;
ic = 0U;
for (j = 0U; j <= (n2 - 1U); j++)
{
/* index calculation for the coefficients */
Co1 = pCoef16[ic * 2U];
Si1 = pCoef16[(ic * 2U) + 1U];
Co2 = pCoef16[2U * (ic * 2U)];
Si2 = pCoef16[(2U * (ic * 2U)) + 1U];
Co3 = pCoef16[3U * (ic * 2U)];
Si3 = pCoef16[(3U * (ic * 2U)) + 1U];
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
/* Butterfly implementation */
for (i0 = j; i0 < fftLen; i0 += n1)
{
/* index calculation for the input as, */
/* pSrc16[i0 + 0], pSrc16[i0 + fftLen/4], pSrc16[i0 + fftLen/2], pSrc16[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T0 = pSrc16[i0 * 2U];
T1 = pSrc16[(i0 * 2U) + 1U];
/* Read yc (real), xc(imag) input */
S0 = pSrc16[i2 * 2U];
S1 = pSrc16[(i2 * 2U) + 1U];
/* R0 = (ya + yc), R1 = (xa + xc) */
R0 = __SSAT(T0 + S0, 16);
R1 = __SSAT(T1 + S1, 16);
/* S0 = (ya - yc), S1 =(xa - xc) */
S0 = __SSAT(T0 - S0, 16);
S1 = __SSAT(T1 - S1, 16);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = (yb + yd), T1 = (xb + xd) */
T0 = __SSAT(T0 + U0, 16);
T1 = __SSAT(T1 + U1, 16);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
out1 = ((R0 >> 1U) + (T0 >> 1U)) >> 1U;
out2 = ((R1 >> 1U) + (T1 >> 1U)) >> 1U;
pSrc16[i0 * 2U] = out1;
pSrc16[(2U * i0) + 1U] = out2;
/* R0 = (ya + yc) - (yb + yd), R1 = (xa + xc) - (xb + xd) */
R0 = (R0 >> 1U) - (T0 >> 1U);
R1 = (R1 >> 1U) - (T1 >> 1U);
/* (ya-yb+yc-yd)* (si2) + (xa-xb+xc-xd)* co2 */
out1 = (q15_t) ((Co2 * R0 + Si2 * R1) >> 16U);
/* (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out2 = (q15_t) ((-Si2 * R0 + Co2 * R1) >> 16U);
/* Reading i0+3fftLen/4 */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* writing the butterfly processed i0 + fftLen/4 sample */
/* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
/* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
pSrc16[i1 * 2U] = out1;
pSrc16[(i1 * 2U) + 1U] = out2;
/* Butterfly calculations */
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = yb-yd, T1 = xb-xd */
T0 = __SSAT(T0 - U0, 16);
T1 = __SSAT(T1 - U1, 16);
/* R0 = (ya-yc) + (xb- xd), R1 = (xa-xc) - (yb-yd)) */
R0 = (S0 >> 1U) - (T1 >> 1U);
R1 = (S1 >> 1U) + (T0 >> 1U);
/* S0 = (ya-yc) - (xb- xd), S1 = (xa-xc) + (yb-yd)) */
S0 = (S0 >> 1U) + (T1 >> 1U);
S1 = (S1 >> 1U) - (T0 >> 1U);
/* Butterfly process for the i0+fftLen/2 sample */
out1 = (q15_t) ((Co1 * S0 + Si1 * S1) >> 16U);
out2 = (q15_t) ((-Si1 * S0 + Co1 * S1) >> 16U);
/* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
/* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
pSrc16[i2 * 2U] = out1;
pSrc16[(i2 * 2U) + 1U] = out2;
/* Butterfly process for the i0+3fftLen/4 sample */
out1 = (q15_t) ((Si3 * R1 + Co3 * R0) >> 16U);
out2 = (q15_t) ((-Si3 * R0 + Co3 * R1) >> 16U);
/* xd' = (xa-yb-xc+yd)* Co3 + (ya+xb-yc-xd)* (si3) */
/* yd' = (ya+xb-yc-xd)* Co3 - (xa-yb-xc+yd)* (si3) */
pSrc16[i3 * 2U] = out1;
pSrc16[(i3 * 2U) + 1U] = out2;
}
}
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
}
/* end of middle stage process */
/* data is in 10.6(q6) format for the 1024 point */
/* data is in 8.8(q8) format for the 256 point */
/* data is in 6.10(q10) format for the 64 point */
/* data is in 4.12(q12) format for the 16 point */
/* Initializations for the last stage */
n1 = n2;
n2 >>= 2U;
/* start of last stage process */
/* Butterfly implementation */
for (i0 = 0U; i0 <= (fftLen - n1); i0 += n1)
{
/* index calculation for the input as, */
/* pSrc16[i0 + 0], pSrc16[i0 + fftLen/4], pSrc16[i0 + fftLen/2], pSrc16[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T0 = pSrc16[i0 * 2U];
T1 = pSrc16[(i0 * 2U) + 1U];
/* Read yc (real), xc(imag) input */
S0 = pSrc16[i2 * 2U];
S1 = pSrc16[(i2 * 2U) + 1U];
/* R0 = (ya + yc), R1 = (xa + xc) */
R0 = __SSAT(T0 + S0, 16U);
R1 = __SSAT(T1 + S1, 16U);
/* S0 = (ya - yc), S1 = (xa - xc) */
S0 = __SSAT(T0 - S0, 16U);
S1 = __SSAT(T1 - S1, 16U);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = (yb + yd), T1 = (xb + xd)) */
T0 = __SSAT(T0 + U0, 16U);
T1 = __SSAT(T1 + U1, 16U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
pSrc16[i0 * 2U] = (R0 >> 1U) + (T0 >> 1U);
pSrc16[(i0 * 2U) + 1U] = (R1 >> 1U) + (T1 >> 1U);
/* R0 = (ya + yc) - (yb + yd), R1 = (xa + xc) - (xb + xd) */
R0 = (R0 >> 1U) - (T0 >> 1U);
R1 = (R1 >> 1U) - (T1 >> 1U);
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* writing the butterfly processed i0 + fftLen/4 sample */
/* xc' = (xa-xb+xc-xd) */
/* yc' = (ya-yb+yc-yd) */
pSrc16[i1 * 2U] = R0;
pSrc16[(i1 * 2U) + 1U] = R1;
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = (yb - yd), T1 = (xb - xd) */
T0 = __SSAT(T0 - U0, 16U);
T1 = __SSAT(T1 - U1, 16U);
/* writing the butterfly processed i0 + fftLen/2 sample */
/* xb' = (xa+yb-xc-yd) */
/* yb' = (ya-xb-yc+xd) */
pSrc16[i2 * 2U] = (S0 >> 1U) + (T1 >> 1U);
pSrc16[(i2 * 2U) + 1U] = (S1 >> 1U) - (T0 >> 1U);
/* writing the butterfly processed i0 + 3fftLen/4 sample */
/* xd' = (xa-yb-xc+yd) */
/* yd' = (ya+xb-yc-xd) */
pSrc16[i3 * 2U] = (S0 >> 1U) - (T1 >> 1U);
pSrc16[(i3 * 2U) + 1U] = (S1 >> 1U) + (T0 >> 1U);
}
/* end of last stage process */
/* output is in 11.5(q5) format for the 1024 point */
/* output is in 9.7(q7) format for the 256 point */
/* output is in 7.9(q9) format for the 64 point */
/* output is in 5.11(q11) format for the 16 point */
#endif /* #if defined (ARM_MATH_DSP) */
}
/**
@brief Core function for the Q15 CIFFT butterfly process.
@param[in,out] pSrc16 points to the in-place buffer of Q15 data type
@param[in] fftLen length of the FFT
@param[in] pCoef16 points to twiddle coefficient buffer
@param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
@return none
*/
/*
* Radix-4 IFFT algorithm used is :
*
* CIFFT uses same twiddle coefficients as CFFT function
* x[k] = x[n] + (j)k * x[n + fftLen/4] + (-1)k * x[n+fftLen/2] + (-j)k * x[n+3*fftLen/4]
*
*
* IFFT is implemented with following changes in equations from FFT
*
* Input real and imaginary data:
* x(n) = xa + j * ya
* x(n+N/4 ) = xb + j * yb
* x(n+N/2 ) = xc + j * yc
* x(n+3N 4) = xd + j * yd
*
*
* Output real and imaginary data:
* x(4r) = xa'+ j * ya'
* x(4r+1) = xb'+ j * yb'
* x(4r+2) = xc'+ j * yc'
* x(4r+3) = xd'+ j * yd'
*
*
* Twiddle factors for radix-4 IFFT:
* Wn = co1 + j * (si1)
* W2n = co2 + j * (si2)
* W3n = co3 + j * (si3)
* The real and imaginary output values for the radix-4 butterfly are
* xa' = xa + xb + xc + xd
* ya' = ya + yb + yc + yd
* xb' = (xa-yb-xc+yd)* co1 - (ya+xb-yc-xd)* (si1)
* yb' = (ya+xb-yc-xd)* co1 + (xa-yb-xc+yd)* (si1)
* xc' = (xa-xb+xc-xd)* co2 - (ya-yb+yc-yd)* (si2)
* yc' = (ya-yb+yc-yd)* co2 + (xa-xb+xc-xd)* (si2)
* xd' = (xa+yb-xc-yd)* co3 - (ya-xb-yc+xd)* (si3)
* yd' = (ya-xb-yc+xd)* co3 + (xa+yb-xc-yd)* (si3)
*
*/
void arm_radix4_butterfly_inverse_q15(
q15_t * pSrc16,
uint32_t fftLen,
const q15_t * pCoef16,
uint32_t twidCoefModifier)
{
#if defined (ARM_MATH_DSP)
q31_t R, S, T, U;
q31_t C1, C2, C3, out1, out2;
uint32_t n1, n2, ic, i0, j, k;
q15_t *ptr1;
q15_t *pSi0;
q15_t *pSi1;
q15_t *pSi2;
q15_t *pSi3;
q31_t xaya, xbyb, xcyc, xdyd;
/* Total process is divided into three stages */
/* process first stage, middle stages, & last stage */
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
/* Index for twiddle coefficient */
ic = 0U;
/* Index for input read and output write */
j = n2;
pSi0 = pSrc16;
pSi1 = pSi0 + 2 * n2;
pSi2 = pSi1 + 2 * n2;
pSi3 = pSi2 + 2 * n2;
/* Input is in 1.15(q15) format */
/* start of first stage process */
do
{
/* Butterfly implementation */
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T = read_q15x2 (pSi0);
T = __SHADD16(T, 0);
T = __SHADD16(T, 0);
/* Read yc (real), xc(imag) input */
S = read_q15x2 (pSi2);
S = __SHADD16(S, 0);
S = __SHADD16(S, 0);
/* R = packed((ya + yc), (xa + xc) ) */
R = __QADD16(T, S);
/* S = packed((ya - yc), (xa - xc) ) */
S = __QSUB16(T, S);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T = read_q15x2 (pSi1);
T = __SHADD16(T, 0);
T = __SHADD16(T, 0);
/* Read yd (real), xd(imag) input */
U = read_q15x2 (pSi3);
U = __SHADD16(U, 0);
U = __SHADD16(U, 0);
/* T = packed((yb + yd), (xb + xd) ) */
T = __QADD16(T, U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
write_q15x2_ia (&pSi0, __SHADD16(R, T));
/* R = packed((ya + yc) - (yb + yd), (xa + xc)- (xb + xd)) */
R = __QSUB16(R, T);
/* co2 & si2 are read from SIMD Coefficient pointer */
C2 = read_q15x2 ((q15_t *) pCoef16 + (4U * ic));
#ifndef ARM_MATH_BIG_ENDIAN
/* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
out1 = __SMUSD(C2, R) >> 16U;
/* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out2 = __SMUADX(C2, R);
#else
/* xc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out1 = __SMUADX(C2, R) >> 16U;
/* yc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
out2 = __SMUSD(__QSUB16(0, C2), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* Reading i0+fftLen/4 */
/* T = packed(yb, xb) */
T = read_q15x2 (pSi1);
T = __SHADD16(T, 0);
T = __SHADD16(T, 0);
/* writing the butterfly processed i0 + fftLen/4 sample */
/* writing output(xc', yc') in little endian format */
write_q15x2_ia (&pSi1, (q31_t) ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
/* Butterfly calculations */
/* U = packed(yd, xd) */
U = read_q15x2 (pSi3);
U = __SHADD16(U, 0);
U = __SHADD16(U, 0);
/* T = packed(yb-yd, xb-xd) */
T = __QSUB16(T, U);
#ifndef ARM_MATH_BIG_ENDIAN
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __QSAX(S, T);
/* S = packed((ya-yc) + (xb- xd), (xa-xc) - (yb-yd)) */
S = __QASX(S, T);
#else
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __QASX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __QSAX(S, T);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* co1 & si1 are read from SIMD Coefficient pointer */
C1 = read_q15x2 ((q15_t *) pCoef16 + (2U * ic));
/* Butterfly process for the i0+fftLen/2 sample */
#ifndef ARM_MATH_BIG_ENDIAN
/* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
out1 = __SMUSD(C1, S) >> 16U;
/* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
out2 = __SMUADX(C1, S);
#else
/* xb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
out1 = __SMUADX(C1, S) >> 16U;
/* yb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
out2 = __SMUSD(__QSUB16(0, C1), S);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* writing output(xb', yb') in little endian format */
write_q15x2_ia (&pSi2, ((out2) & 0xFFFF0000) | ((out1) & 0x0000FFFF));
/* co3 & si3 are read from SIMD Coefficient pointer */
C3 = read_q15x2 ((q15_t *) pCoef16 + (6U * ic));
/* Butterfly process for the i0+3fftLen/4 sample */
#ifndef ARM_MATH_BIG_ENDIAN
/* xd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3) */
out1 = __SMUSD(C3, R) >> 16U;
/* yd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3) */
out2 = __SMUADX(C3, R);
#else
/* xd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3) */
out1 = __SMUADX(C3, R) >> 16U;
/* yd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3) */
out2 = __SMUSD(__QSUB16(0, C3), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* writing output(xd', yd') in little endian format */
write_q15x2_ia (&pSi3, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
} while (--j);
/* data is in 4.11(q11) format */
/* end of first stage process */
/* start of middle stage process */
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
/* Calculation of Middle stage */
for (k = fftLen / 4U; k > 4U; k >>= 2U)
{
/* Initializations for the middle stage */
n1 = n2;
n2 >>= 2U;
ic = 0U;
for (j = 0U; j <= (n2 - 1U); j++)
{
/* index calculation for the coefficients */
C1 = read_q15x2 ((q15_t *) pCoef16 + (2U * ic));
C2 = read_q15x2 ((q15_t *) pCoef16 + (4U * ic));
C3 = read_q15x2 ((q15_t *) pCoef16 + (6U * ic));
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
pSi0 = pSrc16 + 2 * j;
pSi1 = pSi0 + 2 * n2;
pSi2 = pSi1 + 2 * n2;
pSi3 = pSi2 + 2 * n2;
/* Butterfly implementation */
for (i0 = j; i0 < fftLen; i0 += n1)
{
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T = read_q15x2 (pSi0);
/* Read yc (real), xc(imag) input */
S = read_q15x2 (pSi2);
/* R = packed( (ya + yc), (xa + xc)) */
R = __QADD16(T, S);
/* S = packed((ya - yc), (xa - xc)) */
S = __QSUB16(T, S);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T = read_q15x2 (pSi1);
/* Read yd (real), xd(imag) input */
U = read_q15x2 (pSi3);
/* T = packed( (yb + yd), (xb + xd)) */
T = __QADD16(T, U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
out1 = __SHADD16(R, T);
out1 = __SHADD16(out1, 0);
write_q15x2 (pSi0, out1);
pSi0 += 2 * n1;
/* R = packed( (ya + yc) - (yb + yd), (xa + xc) - (xb + xd)) */
R = __SHSUB16(R, T);
#ifndef ARM_MATH_BIG_ENDIAN
/* (ya-yb+yc-yd)* (si2) + (xa-xb+xc-xd)* co2 */
out1 = __SMUSD(C2, R) >> 16U;
/* (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out2 = __SMUADX(C2, R);
#else
/* (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
out1 = __SMUADX(R, C2) >> 16U;
/* (ya-yb+yc-yd)* (si2) + (xa-xb+xc-xd)* co2 */
out2 = __SMUSD(__QSUB16(0, C2), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* Reading i0+3fftLen/4 */
/* Read yb (real), xb(imag) input */
T = read_q15x2 (pSi1);
/* writing the butterfly processed i0 + fftLen/4 sample */
/* xc' = (xa-xb+xc-xd)* co2 + (ya-yb+yc-yd)* (si2) */
/* yc' = (ya-yb+yc-yd)* co2 - (xa-xb+xc-xd)* (si2) */
write_q15x2 (pSi1, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
pSi1 += 2 * n1;
/* Butterfly calculations */
/* Read yd (real), xd(imag) input */
U = read_q15x2 (pSi3);
/* T = packed(yb-yd, xb-xd) */
T = __QSUB16(T, U);
#ifndef ARM_MATH_BIG_ENDIAN
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __SHSAX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __SHASX(S, T);
/* Butterfly process for the i0+fftLen/2 sample */
out1 = __SMUSD(C1, S) >> 16U;
out2 = __SMUADX(C1, S);
#else
/* R = packed((ya-yc) + (xb- xd) , (xa-xc) - (yb-yd)) */
R = __SHASX(S, T);
/* S = packed((ya-yc) - (xb- xd), (xa-xc) + (yb-yd)) */
S = __SHSAX(S, T);
/* Butterfly process for the i0+fftLen/2 sample */
out1 = __SMUADX(S, C1) >> 16U;
out2 = __SMUSD(__QSUB16(0, C1), S);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* xb' = (xa+yb-xc-yd)* co1 + (ya-xb-yc+xd)* (si1) */
/* yb' = (ya-xb-yc+xd)* co1 - (xa+yb-xc-yd)* (si1) */
write_q15x2 (pSi2, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
pSi2 += 2 * n1;
/* Butterfly process for the i0+3fftLen/4 sample */
#ifndef ARM_MATH_BIG_ENDIAN
out1 = __SMUSD(C3, R) >> 16U;
out2 = __SMUADX(C3, R);
#else
out1 = __SMUADX(C3, R) >> 16U;
out2 = __SMUSD(__QSUB16(0, C3), R);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* xd' = (xa-yb-xc+yd)* co3 + (ya+xb-yc-xd)* (si3) */
/* yd' = (ya+xb-yc-xd)* co3 - (xa-yb-xc+yd)* (si3) */
write_q15x2 (pSi3, ((out2) & 0xFFFF0000) | (out1 & 0x0000FFFF));
pSi3 += 2 * n1;
}
}
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
}
/* end of middle stage process */
/* data is in 10.6(q6) format for the 1024 point */
/* data is in 8.8(q8) format for the 256 point */
/* data is in 6.10(q10) format for the 64 point */
/* data is in 4.12(q12) format for the 16 point */
/* Initializations for the last stage */
j = fftLen >> 2;
ptr1 = &pSrc16[0];
/* start of last stage process */
/* Butterfly implementation */
do
{
/* Read xa (real), ya(imag) input */
xaya = read_q15x2_ia ((q15_t **) &ptr1);
/* Read xb (real), yb(imag) input */
xbyb = read_q15x2_ia ((q15_t **) &ptr1);
/* Read xc (real), yc(imag) input */
xcyc = read_q15x2_ia ((q15_t **) &ptr1);
/* Read xd (real), yd(imag) input */
xdyd = read_q15x2_ia ((q15_t **) &ptr1);
/* R = packed((ya + yc), (xa + xc)) */
R = __QADD16(xaya, xcyc);
/* T = packed((yb + yd), (xb + xd)) */
T = __QADD16(xbyb, xdyd);
/* pointer updation for writing */
ptr1 = ptr1 - 8U;
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
write_q15x2_ia (&ptr1, __SHADD16(R, T));
/* T = packed((yb + yd), (xb + xd)) */
T = __QADD16(xbyb, xdyd);
/* xc' = (xa-xb+xc-xd) */
/* yc' = (ya-yb+yc-yd) */
write_q15x2_ia (&ptr1, __SHSUB16(R, T));
/* S = packed((ya - yc), (xa - xc)) */
S = __QSUB16(xaya, xcyc);
/* Read yd (real), xd(imag) input */
/* T = packed( (yb - yd), (xb - xd)) */
U = __QSUB16(xbyb, xdyd);
#ifndef ARM_MATH_BIG_ENDIAN
/* xb' = (xa+yb-xc-yd) */
/* yb' = (ya-xb-yc+xd) */
write_q15x2_ia (&ptr1, __SHASX(S, U));
/* xd' = (xa-yb-xc+yd) */
/* yd' = (ya+xb-yc-xd) */
write_q15x2_ia (&ptr1, __SHSAX(S, U));
#else
/* xb' = (xa+yb-xc-yd) */
/* yb' = (ya-xb-yc+xd) */
write_q15x2_ia (&ptr1, __SHSAX(S, U));
/* xd' = (xa-yb-xc+yd) */
/* yd' = (ya+xb-yc-xd) */
write_q15x2_ia (&ptr1, __SHASX(S, U));
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
} while (--j);
/* end of last stage process */
/* output is in 11.5(q5) format for the 1024 point */
/* output is in 9.7(q7) format for the 256 point */
/* output is in 7.9(q9) format for the 64 point */
/* output is in 5.11(q11) format for the 16 point */
#else /* arm_radix4_butterfly_inverse_q15 */
q15_t R0, R1, S0, S1, T0, T1, U0, U1;
q15_t Co1, Si1, Co2, Si2, Co3, Si3, out1, out2;
uint32_t n1, n2, ic, i0, i1, i2, i3, j, k;
/* Total process is divided into three stages */
/* process first stage, middle stages, & last stage */
/* Initializations for the first stage */
n2 = fftLen;
n1 = n2;
/* n2 = fftLen/4 */
n2 >>= 2U;
/* Index for twiddle coefficient */
ic = 0U;
/* Index for input read and output write */
i0 = 0U;
j = n2;
/* Input is in 1.15(q15) format */
/* Start of first stage process */
do
{
/* Butterfly implementation */
/* index calculation for the input as, */
/* pSrc16[i0 + 0], pSrc16[i0 + fftLen/4], pSrc16[i0 + fftLen/2], pSrc16[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Reading i0, i0+fftLen/2 inputs */
/* input is down scale by 4 to avoid overflow */
/* Read ya (real), xa(imag) input */
T0 = pSrc16[i0 * 2U] >> 2U;
T1 = pSrc16[(i0 * 2U) + 1U] >> 2U;
/* input is down scale by 4 to avoid overflow */
/* Read yc (real), xc(imag) input */
S0 = pSrc16[i2 * 2U] >> 2U;
S1 = pSrc16[(i2 * 2U) + 1U] >> 2U;
/* R0 = (ya + yc), R1 = (xa + xc) */
R0 = __SSAT(T0 + S0, 16U);
R1 = __SSAT(T1 + S1, 16U);
/* S0 = (ya - yc), S1 = (xa - xc) */
S0 = __SSAT(T0 - S0, 16U);
S1 = __SSAT(T1 - S1, 16U);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* input is down scale by 4 to avoid overflow */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U] >> 2U;
T1 = pSrc16[(i1 * 2U) + 1U] >> 2U;
/* Read yd (real), xd(imag) input */
/* input is down scale by 4 to avoid overflow */
U0 = pSrc16[i3 * 2U] >> 2U;
U1 = pSrc16[(i3 * 2U) + 1U] >> 2U;
/* T0 = (yb + yd), T1 = (xb + xd) */
T0 = __SSAT(T0 + U0, 16U);
T1 = __SSAT(T1 + U1, 16U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
pSrc16[i0 * 2U] = (R0 >> 1U) + (T0 >> 1U);
pSrc16[(i0 * 2U) + 1U] = (R1 >> 1U) + (T1 >> 1U);
/* R0 = (ya + yc) - (yb + yd), R1 = (xa + xc)- (xb + xd) */
R0 = __SSAT(R0 - T0, 16U);
R1 = __SSAT(R1 - T1, 16U);
/* co2 & si2 are read from Coefficient pointer */
Co2 = pCoef16[2U * ic * 2U];
Si2 = pCoef16[(2U * ic * 2U) + 1U];
/* xc' = (xa-xb+xc-xd)* co2 - (ya-yb+yc-yd)* (si2) */
out1 = (q15_t) ((Co2 * R0 - Si2 * R1) >> 16U);
/* yc' = (ya-yb+yc-yd)* co2 + (xa-xb+xc-xd)* (si2) */
out2 = (q15_t) ((Si2 * R0 + Co2 * R1) >> 16U);
/* Reading i0+fftLen/4 */
/* input is down scale by 4 to avoid overflow */
/* T0 = yb, T1 = xb */
T0 = pSrc16[i1 * 2U] >> 2U;
T1 = pSrc16[(i1 * 2U) + 1U] >> 2U;
/* writing the butterfly processed i0 + fftLen/4 sample */
/* writing output(xc', yc') in little endian format */
pSrc16[i1 * 2U] = out1;
pSrc16[(i1 * 2U) + 1U] = out2;
/* Butterfly calculations */
/* input is down scale by 4 to avoid overflow */
/* U0 = yd, U1 = xd) */
U0 = pSrc16[i3 * 2U] >> 2U;
U1 = pSrc16[(i3 * 2U) + 1U] >> 2U;
/* T0 = yb-yd, T1 = xb-xd) */
T0 = __SSAT(T0 - U0, 16U);
T1 = __SSAT(T1 - U1, 16U);
/* R0 = (ya-yc) - (xb- xd) , R1 = (xa-xc) + (yb-yd) */
R0 = (q15_t) __SSAT((q31_t) (S0 + T1), 16);
R1 = (q15_t) __SSAT((q31_t) (S1 - T0), 16);
/* S = (ya-yc) + (xb- xd), S1 = (xa-xc) - (yb-yd) */
S0 = (q15_t) __SSAT((q31_t) (S0 - T1), 16);
S1 = (q15_t) __SSAT((q31_t) (S1 + T0), 16);
/* co1 & si1 are read from Coefficient pointer */
Co1 = pCoef16[ic * 2U];
Si1 = pCoef16[(ic * 2U) + 1U];
/* Butterfly process for the i0+fftLen/2 sample */
/* xb' = (xa-yb-xc+yd)* co1 - (ya+xb-yc-xd)* (si1) */
out1 = (q15_t) ((Co1 * S0 - Si1 * S1) >> 16U);
/* yb' = (ya+xb-yc-xd)* co1 + (xa-yb-xc+yd)* (si1) */
out2 = (q15_t) ((Si1 * S0 + Co1 * S1) >> 16U);
/* writing output(xb', yb') in little endian format */
pSrc16[i2 * 2U] = out1;
pSrc16[(i2 * 2U) + 1U] = out2;
/* Co3 & si3 are read from Coefficient pointer */
Co3 = pCoef16[3U * ic * 2U];
Si3 = pCoef16[(3U * ic * 2U) + 1U];
/* Butterfly process for the i0+3fftLen/4 sample */
/* xd' = (xa+yb-xc-yd)* Co3 - (ya-xb-yc+xd)* (si3) */
out1 = (q15_t) ((Co3 * R0 - Si3 * R1) >> 16U);
/* yd' = (ya-xb-yc+xd)* Co3 + (xa+yb-xc-yd)* (si3) */
out2 = (q15_t) ((Si3 * R0 + Co3 * R1) >> 16U);
/* writing output(xd', yd') in little endian format */
pSrc16[i3 * 2U] = out1;
pSrc16[(i3 * 2U) + 1U] = out2;
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
/* Updating input index */
i0 = i0 + 1U;
} while (--j);
/* End of first stage process */
/* data is in 4.11(q11) format */
/* Start of Middle stage process */
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
/* Calculation of Middle stage */
for (k = fftLen / 4U; k > 4U; k >>= 2U)
{
/* Initializations for the middle stage */
n1 = n2;
n2 >>= 2U;
ic = 0U;
for (j = 0U; j <= (n2 - 1U); j++)
{
/* index calculation for the coefficients */
Co1 = pCoef16[ic * 2U];
Si1 = pCoef16[(ic * 2U) + 1U];
Co2 = pCoef16[2U * ic * 2U];
Si2 = pCoef16[2U * ic * 2U + 1U];
Co3 = pCoef16[3U * ic * 2U];
Si3 = pCoef16[(3U * ic * 2U) + 1U];
/* Twiddle coefficients index modifier */
ic = ic + twidCoefModifier;
/* Butterfly implementation */
for (i0 = j; i0 < fftLen; i0 += n1)
{
/* index calculation for the input as, */
/* pSrc16[i0 + 0], pSrc16[i0 + fftLen/4], pSrc16[i0 + fftLen/2], pSrc16[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T0 = pSrc16[i0 * 2U];
T1 = pSrc16[(i0 * 2U) + 1U];
/* Read yc (real), xc(imag) input */
S0 = pSrc16[i2 * 2U];
S1 = pSrc16[(i2 * 2U) + 1U];
/* R0 = (ya + yc), R1 = (xa + xc) */
R0 = __SSAT(T0 + S0, 16U);
R1 = __SSAT(T1 + S1, 16U);
/* S0 = (ya - yc), S1 = (xa - xc) */
S0 = __SSAT(T0 - S0, 16U);
S1 = __SSAT(T1 - S1, 16U);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = (yb + yd), T1 = (xb + xd) */
T0 = __SSAT(T0 + U0, 16U);
T1 = __SSAT(T1 + U1, 16U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
pSrc16[i0 * 2U] = ((R0 >> 1U) + (T0 >> 1U)) >> 1U;
pSrc16[(i0 * 2U) + 1U] = ((R1 >> 1U) + (T1 >> 1U)) >> 1U;
/* R0 = (ya + yc) - (yb + yd), R1 = (xa + xc) - (xb + xd) */
R0 = (R0 >> 1U) - (T0 >> 1U);
R1 = (R1 >> 1U) - (T1 >> 1U);
/* (ya-yb+yc-yd)* (si2) - (xa-xb+xc-xd)* co2 */
out1 = (q15_t) ((Co2 * R0 - Si2 * R1) >> 16);
/* (ya-yb+yc-yd)* co2 + (xa-xb+xc-xd)* (si2) */
out2 = (q15_t) ((Si2 * R0 + Co2 * R1) >> 16);
/* Reading i0+3fftLen/4 */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* writing the butterfly processed i0 + fftLen/4 sample */
/* xc' = (xa-xb+xc-xd)* co2 - (ya-yb+yc-yd)* (si2) */
/* yc' = (ya-yb+yc-yd)* co2 + (xa-xb+xc-xd)* (si2) */
pSrc16[i1 * 2U] = out1;
pSrc16[(i1 * 2U) + 1U] = out2;
/* Butterfly calculations */
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = yb-yd, T1 = xb-xd) */
T0 = __SSAT(T0 - U0, 16U);
T1 = __SSAT(T1 - U1, 16U);
/* R0 = (ya-yc) - (xb- xd) , R1 = (xa-xc) + (yb-yd) */
R0 = (S0 >> 1U) + (T1 >> 1U);
R1 = (S1 >> 1U) - (T0 >> 1U);
/* S1 = (ya-yc) + (xb- xd), S1 = (xa-xc) - (yb-yd) */
S0 = (S0 >> 1U) - (T1 >> 1U);
S1 = (S1 >> 1U) + (T0 >> 1U);
/* Butterfly process for the i0+fftLen/2 sample */
out1 = (q15_t) ((Co1 * S0 - Si1 * S1) >> 16U);
out2 = (q15_t) ((Si1 * S0 + Co1 * S1) >> 16U);
/* xb' = (xa-yb-xc+yd)* co1 - (ya+xb-yc-xd)* (si1) */
/* yb' = (ya+xb-yc-xd)* co1 + (xa-yb-xc+yd)* (si1) */
pSrc16[i2 * 2U] = out1;
pSrc16[(i2 * 2U) + 1U] = out2;
/* Butterfly process for the i0+3fftLen/4 sample */
out1 = (q15_t) ((Co3 * R0 - Si3 * R1) >> 16U);
out2 = (q15_t) ((Si3 * R0 + Co3 * R1) >> 16U);
/* xd' = (xa+yb-xc-yd)* Co3 - (ya-xb-yc+xd)* (si3) */
/* yd' = (ya-xb-yc+xd)* Co3 + (xa+yb-xc-yd)* (si3) */
pSrc16[i3 * 2U] = out1;
pSrc16[(i3 * 2U) + 1U] = out2;
}
}
/* Twiddle coefficients index modifier */
twidCoefModifier <<= 2U;
}
/* End of Middle stages process */
/* data is in 10.6(q6) format for the 1024 point */
/* data is in 8.8(q8) format for the 256 point */
/* data is in 6.10(q10) format for the 64 point */
/* data is in 4.12(q12) format for the 16 point */
/* start of last stage process */
/* Initializations for the last stage */
n1 = n2;
n2 >>= 2U;
/* Butterfly implementation */
for (i0 = 0U; i0 <= (fftLen - n1); i0 += n1)
{
/* index calculation for the input as, */
/* pSrc16[i0 + 0], pSrc16[i0 + fftLen/4], pSrc16[i0 + fftLen/2], pSrc16[i0 + 3fftLen/4] */
i1 = i0 + n2;
i2 = i1 + n2;
i3 = i2 + n2;
/* Reading i0, i0+fftLen/2 inputs */
/* Read ya (real), xa(imag) input */
T0 = pSrc16[i0 * 2U];
T1 = pSrc16[(i0 * 2U) + 1U];
/* Read yc (real), xc(imag) input */
S0 = pSrc16[i2 * 2U];
S1 = pSrc16[(i2 * 2U) + 1U];
/* R0 = (ya + yc), R1 = (xa + xc) */
R0 = __SSAT(T0 + S0, 16U);
R1 = __SSAT(T1 + S1, 16U);
/* S0 = (ya - yc), S1 = (xa - xc) */
S0 = __SSAT(T0 - S0, 16U);
S1 = __SSAT(T1 - S1, 16U);
/* Reading i0+fftLen/4 , i0+3fftLen/4 inputs */
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = (yb + yd), T1 = (xb + xd) */
T0 = __SSAT(T0 + U0, 16U);
T1 = __SSAT(T1 + U1, 16U);
/* writing the butterfly processed i0 sample */
/* xa' = xa + xb + xc + xd */
/* ya' = ya + yb + yc + yd */
pSrc16[i0 * 2U] = (R0 >> 1U) + (T0 >> 1U);
pSrc16[(i0 * 2U) + 1U] = (R1 >> 1U) + (T1 >> 1U);
/* R0 = (ya + yc) - (yb + yd), R1 = (xa + xc) - (xb + xd) */
R0 = (R0 >> 1U) - (T0 >> 1U);
R1 = (R1 >> 1U) - (T1 >> 1U);
/* Read yb (real), xb(imag) input */
T0 = pSrc16[i1 * 2U];
T1 = pSrc16[(i1 * 2U) + 1U];
/* writing the butterfly processed i0 + fftLen/4 sample */
/* xc' = (xa-xb+xc-xd) */
/* yc' = (ya-yb+yc-yd) */
pSrc16[i1 * 2U] = R0;
pSrc16[(i1 * 2U) + 1U] = R1;
/* Read yd (real), xd(imag) input */
U0 = pSrc16[i3 * 2U];
U1 = pSrc16[(i3 * 2U) + 1U];
/* T0 = (yb - yd), T1 = (xb - xd) */
T0 = __SSAT(T0 - U0, 16U);
T1 = __SSAT(T1 - U1, 16U);
/* writing the butterfly processed i0 + fftLen/2 sample */
/* xb' = (xa-yb-xc+yd) */
/* yb' = (ya+xb-yc-xd) */
pSrc16[i2 * 2U] = (S0 >> 1U) - (T1 >> 1U);
pSrc16[(i2 * 2U) + 1U] = (S1 >> 1U) + (T0 >> 1U);
/* writing the butterfly processed i0 + 3fftLen/4 sample */
/* xd' = (xa+yb-xc-yd) */
/* yd' = (ya-xb-yc+xd) */
pSrc16[i3 * 2U] = (S0 >> 1U) + (T1 >> 1U);
pSrc16[(i3 * 2U) + 1U] = (S1 >> 1U) - (T0 >> 1U);
}
/* end of last stage process */
/* output is in 11.5(q5) format for the 1024 point */
/* output is in 9.7(q7) format for the 256 point */
/* output is in 7.9(q9) format for the 64 point */
/* output is in 5.11(q11) format for the 16 point */
#endif /* #if defined (ARM_MATH_DSP) */
}
| 54,403 | C | 29.057459 | 153 | 0.486095 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_init_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix2_init_q15.c
* Description: Radix-2 Decimation in Frequency Q15 FFT & IFFT initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Initialization function for the Q15 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q15 and will be removed
@param[in,out] S points to an instance of the Q15 CFFT/CIFFT structure.
@param[in] fftLen length of the FFT.
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Details
The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_cfft_radix2_init_q15(
arm_cfft_radix2_instance_q15 * S,
uint16_t fftLen,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialise the FFT length */
S->fftLen = fftLen;
/* Initialise the Twiddle coefficient pointer */
S->pTwiddle = (q15_t *) twiddleCoef_4096_q15;
/* Initialise the Flag for selection of CFFT or CIFFT */
S->ifftFlag = ifftFlag;
/* Initialise the Flag for calculation Bit reversal or not */
S->bitReverseFlag = bitReverseFlag;
/* Initializations of structure parameters depending on the FFT length */
switch (S->fftLen)
{
case 4096U:
/* Initializations of structure parameters for 4096 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 1U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 1U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) armBitRevTable;
break;
case 2048U:
/* Initializations of structure parameters for 2048 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 2U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 2U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[1];
break;
case 1024U:
/* Initializations of structure parameters for 1024 point FFT */
S->twidCoefModifier = 4U;
S->bitRevFactor = 4U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
break;
case 512U:
/* Initializations of structure parameters for 512 point FFT */
S->twidCoefModifier = 8U;
S->bitRevFactor = 8U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[7];
break;
case 256U:
/* Initializations of structure parameters for 256 point FFT */
S->twidCoefModifier = 16U;
S->bitRevFactor = 16U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
break;
case 128U:
/* Initializations of structure parameters for 128 point FFT */
S->twidCoefModifier = 32U;
S->bitRevFactor = 32U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[31];
break;
case 64U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 64U;
S->bitRevFactor = 64U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
break;
case 32U:
/* Initializations of structure parameters for 32 point FFT */
S->twidCoefModifier = 128U;
S->bitRevFactor = 128U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[127];
break;
case 16U:
/* Initializations of structure parameters for 16 point FFT */
S->twidCoefModifier = 256U;
S->bitRevFactor = 256U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
break;
default:
/* Reporting argument error if fftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
return (status);
}
/**
@} end of ComplexFFT group
*/
| 5,965 | C | 31.601093 | 137 | 0.637385 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_init_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_init_q31.c
* Description: RFFT & RIFFT Q31 initialisation function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
#include "arm_const_structs.h"
/**
@addtogroup RealFFT
@{
*/
/**
@brief Initialization function for the Q31 RFFT/RIFFT.
@param[in,out] S points to an instance of the Q31 RFFT/RIFFT structure
@param[in] fftLenReal length of the FFT
@param[in] ifftFlagR flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLenReal</code> is not a supported length
@par Details
The parameter <code>fftLenReal</code> specifies length of RFFT/RIFFT Process.
Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.
@par
The parameter <code>ifftFlagR</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlagR to calculate RIFFT, otherwise RFFT is calculated.
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
This function also initializes Twiddle factor table.
*/
arm_status arm_rfft_init_q31(
arm_rfft_instance_q31 * S,
uint32_t fftLenReal,
uint32_t ifftFlagR,
uint32_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialize the Real FFT length */
S->fftLenReal = (uint16_t) fftLenReal;
/* Initialize the Twiddle coefficientA pointer */
S->pTwiddleAReal = (q31_t *) realCoefAQ31;
/* Initialize the Twiddle coefficientB pointer */
S->pTwiddleBReal = (q31_t *) realCoefBQ31;
/* Initialize the Flag for selection of RFFT or RIFFT */
S->ifftFlagR = (uint8_t) ifftFlagR;
/* Initialize the Flag for calculation Bit reversal or not */
S->bitReverseFlagR = (uint8_t) bitReverseFlag;
/* Initialization of coef modifier depending on the FFT length */
switch (S->fftLenReal)
{
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_4096) && defined(ARM_TABLE_BITREVIDX_FXT_4096))
case 8192U:
S->twidCoefRModifier = 1U;
S->pCfft = &arm_cfft_sR_q31_len4096;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_2048) && defined(ARM_TABLE_BITREVIDX_FXT_2048))
case 4096U:
S->twidCoefRModifier = 2U;
S->pCfft = &arm_cfft_sR_q31_len2048;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_1024) && defined(ARM_TABLE_BITREVIDX_FXT_1024))
case 2048U:
S->twidCoefRModifier = 4U;
S->pCfft = &arm_cfft_sR_q31_len1024;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_512) && defined(ARM_TABLE_BITREVIDX_FXT_512))
case 1024U:
S->twidCoefRModifier = 8U;
S->pCfft = &arm_cfft_sR_q31_len512;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_256) && defined(ARM_TABLE_BITREVIDX_FXT_256))
case 512U:
S->twidCoefRModifier = 16U;
S->pCfft = &arm_cfft_sR_q31_len256;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_128) && defined(ARM_TABLE_BITREVIDX_FXT_128))
case 256U:
S->twidCoefRModifier = 32U;
S->pCfft = &arm_cfft_sR_q31_len128;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_64) && defined(ARM_TABLE_BITREVIDX_FXT_64))
case 128U:
S->twidCoefRModifier = 64U;
S->pCfft = &arm_cfft_sR_q31_len64;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_32) && defined(ARM_TABLE_BITREVIDX_FXT_32))
case 64U:
S->twidCoefRModifier = 128U;
S->pCfft = &arm_cfft_sR_q31_len32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q31_16) && defined(ARM_TABLE_BITREVIDX_FXT_16))
case 32U:
S->twidCoefRModifier = 256U;
S->pCfft = &arm_cfft_sR_q31_len16;
break;
#endif
default:
/* Reporting argument error if rfftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
/* return the status of RFFT Init function */
return (status);
}
/**
@} end of RealFFT group
*/
| 6,246 | C | 37.801242 | 152 | 0.631924 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_init_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_init_f32.c
* Description: RFFT & RIFFT Floating point initialisation function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@addtogroup RealFFT
@{
*/
/**
@brief Initialization function for the floating-point RFFT/RIFFT.
@deprecated Do not use this function. It has been superceded by \ref arm_rfft_fast_init_f32 and will be removed in the future.
@param[in,out] S points to an instance of the floating-point RFFT/RIFFT structure
@param[in,out] S_CFFT points to an instance of the floating-point CFFT/CIFFT structure
@param[in] fftLenReal length of the FFT.
@param[in] ifftFlagR flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLenReal</code> is not a supported length
@par Description
The parameter <code>fftLenReal</code>specifies length of RFFT/RIFFT Process.
Supported FFT Lengths are 128, 512, 2048.
@par
The parameter <code>ifftFlagR</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlagR to calculate RIFFT, otherwise RFFT is calculated.
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
This function also initializes Twiddle factor table.
*/
arm_status arm_rfft_init_f32(
arm_rfft_instance_f32 * S,
arm_cfft_radix4_instance_f32 * S_CFFT,
uint32_t fftLenReal,
uint32_t ifftFlagR,
uint32_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialize the Real FFT length */
S->fftLenReal = (uint16_t) fftLenReal;
/* Initialize the Complex FFT length */
S->fftLenBy2 = (uint16_t) fftLenReal / 2U;
/* Initialize the Twiddle coefficientA pointer */
S->pTwiddleAReal = (float32_t *) realCoefA;
/* Initialize the Twiddle coefficientB pointer */
S->pTwiddleBReal = (float32_t *) realCoefB;
/* Initialize the Flag for selection of RFFT or RIFFT */
S->ifftFlagR = (uint8_t) ifftFlagR;
/* Initialize the Flag for calculation Bit reversal or not */
S->bitReverseFlagR = (uint8_t) bitReverseFlag;
/* Initializations of structure parameters depending on the FFT length */
switch (S->fftLenReal)
{
/* Init table modifier value */
case 8192U:
S->twidCoefRModifier = 1U;
break;
case 2048U:
S->twidCoefRModifier = 4U;
break;
case 512U:
S->twidCoefRModifier = 16U;
break;
case 128U:
S->twidCoefRModifier = 64U;
break;
default:
/* Reporting argument error if rfftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
/* Init Complex FFT Instance */
S->pCfft = S_CFFT;
if (S->ifftFlagR)
{
/* Initializes the CIFFT Module for fftLenreal/2 length */
arm_cfft_radix4_init_f32(S->pCfft, S->fftLenBy2, 1U, 0U);
}
else
{
/* Initializes the CFFT Module for fftLenreal/2 length */
arm_cfft_radix4_init_f32(S->pCfft, S->fftLenBy2, 0U, 0U);
}
/* return the status of RFFT Init function */
return (status);
}
/**
@} end of RealFFT group
*/
| 4,716 | C | 32.692857 | 131 | 0.639101 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix2_q31.c
* Description: Radix-2 Decimation in Frequency CFFT & CIFFT Fixed point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
void arm_radix2_butterfly_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint16_t twidCoefModifier);
void arm_radix2_butterfly_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint16_t twidCoefModifier);
void arm_bitreversal_q31(
q31_t * pSrc,
uint32_t fftLen,
uint16_t bitRevFactor,
const uint16_t * pBitRevTab);
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the fixed-point CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q31 and will be removed in the future.
@param[in] S points to an instance of the fixed-point CFFT/CIFFT structure
@param[in,out] pSrc points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@return none
*/
void arm_cfft_radix2_q31(
const arm_cfft_radix2_instance_q31 * S,
q31_t * pSrc)
{
if (S->ifftFlag == 1U)
{
arm_radix2_butterfly_inverse_q31(pSrc, S->fftLen,
S->pTwiddle, S->twidCoefModifier);
}
else
{
arm_radix2_butterfly_q31(pSrc, S->fftLen,
S->pTwiddle, S->twidCoefModifier);
}
arm_bitreversal_q31(pSrc, S->fftLen, S->bitRevFactor, S->pBitRevTable);
}
/**
@} end of ComplexFFT group
*/
void arm_radix2_butterfly_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint16_t twidCoefModifier)
{
unsigned i, j, k, l, m;
unsigned n1, n2, ia;
q31_t xt, yt, cosVal, sinVal;
q31_t p0, p1;
//N = fftLen;
n2 = fftLen;
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
for (i = 0; i < n2; i++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
l = i + n2;
xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
pSrc[2 * i + 1] =
((pSrc[2 * l + 1] >> 1U) + (pSrc[2 * i + 1] >> 1U)) >> 1U;
mult_32x32_keep32_R(p0, xt, cosVal);
mult_32x32_keep32_R(p1, yt, cosVal);
multAcc_32x32_keep32_R(p0, yt, sinVal);
multSub_32x32_keep32_R(p1, xt, sinVal);
pSrc[2U * l] = p0;
pSrc[2U * l + 1U] = p1;
} // groups loop end
twidCoefModifier <<= 1U;
// loop for stage
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
for (j = 0; j < n2; j++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
// loop for butterfly
i = j;
m = fftLen / n1;
do
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U;
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U;
mult_32x32_keep32_R(p0, xt, cosVal);
mult_32x32_keep32_R(p1, yt, cosVal);
multAcc_32x32_keep32_R(p0, yt, sinVal);
multSub_32x32_keep32_R(p1, xt, sinVal);
pSrc[2U * l] = p0;
pSrc[2U * l + 1U] = p1;
i += n1;
m--;
} while ( m > 0); // butterfly loop end
} // groups loop end
twidCoefModifier <<= 1U;
} // stages loop end
n1 = n2;
n2 = n2 >> 1;
ia = 0;
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
// loop for butterfly
for (i = 0; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
pSrc[2U * l] = xt;
pSrc[2U * l + 1U] = yt;
i += n1;
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
pSrc[2U * l] = xt;
pSrc[2U * l + 1U] = yt;
} // butterfly loop end
}
void arm_radix2_butterfly_inverse_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pCoef,
uint16_t twidCoefModifier)
{
unsigned i, j, k, l;
unsigned n1, n2, ia;
q31_t xt, yt, cosVal, sinVal;
q31_t p0, p1;
//N = fftLen;
n2 = fftLen;
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
for (i = 0; i < n2; i++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
l = i + n2;
xt = (pSrc[2 * i] >> 1U) - (pSrc[2 * l] >> 1U);
pSrc[2 * i] = ((pSrc[2 * i] >> 1U) + (pSrc[2 * l] >> 1U)) >> 1U;
yt = (pSrc[2 * i + 1] >> 1U) - (pSrc[2 * l + 1] >> 1U);
pSrc[2 * i + 1] =
((pSrc[2 * l + 1] >> 1U) + (pSrc[2 * i + 1] >> 1U)) >> 1U;
mult_32x32_keep32_R(p0, xt, cosVal);
mult_32x32_keep32_R(p1, yt, cosVal);
multSub_32x32_keep32_R(p0, yt, sinVal);
multAcc_32x32_keep32_R(p1, xt, sinVal);
pSrc[2U * l] = p0;
pSrc[2U * l + 1U] = p1;
} // groups loop end
twidCoefModifier = twidCoefModifier << 1U;
// loop for stage
for (k = fftLen / 2; k > 2; k = k >> 1)
{
n1 = n2;
n2 = n2 >> 1;
ia = 0;
// loop for groups
for (j = 0; j < n2; j++)
{
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
// loop for butterfly
for (i = j; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]) >> 1U;
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]) >> 1U;
mult_32x32_keep32_R(p0, xt, cosVal);
mult_32x32_keep32_R(p1, yt, cosVal);
multSub_32x32_keep32_R(p0, yt, sinVal);
multAcc_32x32_keep32_R(p1, xt, sinVal);
pSrc[2U * l] = p0;
pSrc[2U * l + 1U] = p1;
} // butterfly loop end
} // groups loop end
twidCoefModifier = twidCoefModifier << 1U;
} // stages loop end
n1 = n2;
n2 = n2 >> 1;
ia = 0;
cosVal = pCoef[ia * 2];
sinVal = pCoef[(ia * 2) + 1];
ia = ia + twidCoefModifier;
// loop for butterfly
for (i = 0; i < fftLen; i += n1)
{
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
pSrc[2U * l] = xt;
pSrc[2U * l + 1U] = yt;
i += n1;
l = i + n2;
xt = pSrc[2 * i] - pSrc[2 * l];
pSrc[2 * i] = (pSrc[2 * i] + pSrc[2 * l]);
yt = pSrc[2 * i + 1] - pSrc[2 * l + 1];
pSrc[2 * i + 1] = (pSrc[2 * l + 1] + pSrc[2 * i + 1]);
pSrc[2U * l] = xt;
pSrc[2U * l + 1U] = yt;
} // butterfly loop end
}
| 8,580 | C | 24.387574 | 121 | 0.465268 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_init_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix2_init_q31.c
* Description: Radix-2 Decimation in Frequency Fixed-point CFFT & CIFFT Initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Initialization function for the Q31 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q31 and will be removed in the future.
@param[in,out] S points to an instance of the Q31 CFFT/CIFFT structure
@param[in] fftLen length of the FFT
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Details
The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_cfft_radix2_init_q31(
arm_cfft_radix2_instance_q31 * S,
uint16_t fftLen,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialise the FFT length */
S->fftLen = fftLen;
/* Initialise the Twiddle coefficient pointer */
S->pTwiddle = (q31_t *) twiddleCoef_4096_q31;
/* Initialise the Flag for selection of CFFT or CIFFT */
S->ifftFlag = ifftFlag;
/* Initialise the Flag for calculation Bit reversal or not */
S->bitReverseFlag = bitReverseFlag;
/* Initializations of Instance structure depending on the FFT length */
switch (S->fftLen)
{
/* Initializations of structure parameters for 4096 point FFT */
case 4096U:
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 1U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 1U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) armBitRevTable;
break;
/* Initializations of structure parameters for 2048 point FFT */
case 2048U:
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 2U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 2U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[1];
break;
/* Initializations of structure parameters for 1024 point FFT */
case 1024U:
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 4U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 4U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
break;
/* Initializations of structure parameters for 512 point FFT */
case 512U:
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 8U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 8U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[7];
break;
case 256U:
/* Initializations of structure parameters for 256 point FFT */
S->twidCoefModifier = 16U;
S->bitRevFactor = 16U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
break;
case 128U:
/* Initializations of structure parameters for 128 point FFT */
S->twidCoefModifier = 32U;
S->bitRevFactor = 32U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[31];
break;
case 64U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 64U;
S->bitRevFactor = 64U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
break;
case 32U:
/* Initializations of structure parameters for 32 point FFT */
S->twidCoefModifier = 128U;
S->bitRevFactor = 128U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[127];
break;
case 16U:
/* Initializations of structure parameters for 16 point FFT */
S->twidCoefModifier = 256U;
S->bitRevFactor = 256U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
break;
default:
/* Reporting argument error if fftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
return (status);
}
/**
@} end of ComplexFFT group
*/
| 6,268 | C | 33.827778 | 137 | 0.644544 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_dct4_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_dct4_q31.c
* Description: Processing function of DCT4 & IDCT4 Q31
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@addtogroup DCT4_IDCT4
@{
*/
/**
@brief Processing function for the Q31 DCT4/IDCT4.
@param[in] S points to an instance of the Q31 DCT4 structure.
@param[in] pState points to state buffer.
@param[in,out] pInlineBuffer points to the in-place input and output buffer.
@return none
@par Input an output formats
Input samples need to be downscaled by 1 bit to avoid saturations in the Q31 DCT process,
as the conversion from DCT2 to DCT4 involves one subtraction.
Internally inputs are downscaled in the RFFT process function to avoid overflows.
Number of bits downscaled, depends on the size of the transform.
The input and output formats for different DCT sizes and number of bits to upscale are
mentioned in the table below:
\image html dct4FormatsQ31Table.gif
*/
void arm_dct4_q31(
const arm_dct4_instance_q31 * S,
q31_t * pState,
q31_t * pInlineBuffer)
{
const q31_t *weights = S->pTwiddle; /* Pointer to the Weights table */
const q31_t *cosFact = S->pCosFactor; /* Pointer to the cos factors table */
q31_t *pS1, *pS2, *pbuff; /* Temporary pointers for input buffer and pState buffer */
q31_t in; /* Temporary variable */
uint32_t i; /* Loop counter */
/* DCT4 computation involves DCT2 (which is calculated using RFFT)
* along with some pre-processing and post-processing.
* Computational procedure is explained as follows:
* (a) Pre-processing involves multiplying input with cos factor,
* r(n) = 2 * u(n) * cos(pi*(2*n+1)/(4*n))
* where,
* r(n) -- output of preprocessing
* u(n) -- input to preprocessing(actual Source buffer)
* (b) Calculation of DCT2 using FFT is divided into three steps:
* Step1: Re-ordering of even and odd elements of input.
* Step2: Calculating FFT of the re-ordered input.
* Step3: Taking the real part of the product of FFT output and weights.
* (c) Post-processing - DCT4 can be obtained from DCT2 output using the following equation:
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* where,
* Y4 -- DCT4 output, Y2 -- DCT2 output
* (d) Multiplying the output with the normalizing factor sqrt(2/N).
*/
/*-------- Pre-processing ------------*/
/* Multiplying input with cos factor i.e. r(n) = 2 * x(n) * cos(pi*(2*n+1)/(4*n)) */
arm_mult_q31 (pInlineBuffer, cosFact, pInlineBuffer, S->N);
arm_shift_q31 (pInlineBuffer, 1, pInlineBuffer, S->N);
/* ----------------------------------------------------------------
* Step1: Re-ordering of even and odd elements as
* pState[i] = pInlineBuffer[2*i] and
* pState[N-i-1] = pInlineBuffer[2*i+1] where i = 0 to N/2
---------------------------------------------------------------------*/
/* pS1 initialized to pState */
pS1 = pState;
/* pS2 initialized to pState+N-1, so that it points to the end of the state buffer */
pS2 = pState + (S->N - 1U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
#if defined (ARM_MATH_LOOPUNROLL)
/* Initializing the loop counter to N/2 >> 2 for loop unrolling by 4 */
i = S->Nby2 >> 2U;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
do
{
/* Re-ordering of even and odd elements */
/* pState[i] = pInlineBuffer[2*i] */
*pS1++ = *pbuff++;
/* pState[N-i-1] = pInlineBuffer[2*i+1] */
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
/* Decrement loop counter */
i--;
} while (i > 0U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Initializing the loop counter to N/4 instead of N for loop unrolling */
i = S->N >> 2U;
/* Processing with loop unrolling 4 times as N is always multiple of 4.
* Compute 4 outputs at a time */
do
{
/* Writing the re-ordered output back to inplace input buffer */
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* ---------------------------------------------------------
* Step2: Calculate RFFT for N-point input
* ---------------------------------------------------------- */
/* pInlineBuffer is real input of length N , pState is the complex output of length 2N */
arm_rfft_q31 (S->pRfft, pInlineBuffer, pState);
/*----------------------------------------------------------------------
* Step3: Multiply the FFT output with the weights.
*----------------------------------------------------------------------*/
arm_cmplx_mult_cmplx_q31 (pState, weights, pState, S->N);
/* The output of complex multiplication is in 3.29 format.
* Hence changing the format of N (i.e. 2*N elements) complex numbers to 1.31 format by shifting left by 2 bits. */
arm_shift_q31 (pState, 2, pState, S->N * 2);
/* ----------- Post-processing ---------- */
/* DCT-IV can be obtained from DCT-II by the equation,
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* Hence, Y4(0) = Y2(0)/2 */
/* Getting only real part from the output and Converting to DCT-IV */
/* Initializing the loop counter to N >> 2 for loop unrolling by 4 */
i = (S->N - 1U) >> 2U;
/* pbuff initialized to input buffer. */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Calculating Y4(0) from Y2(0) using Y4(0) = Y2(0)/2 */
in = *pS1++ >> 1U;
/* input buffer acts as inplace, so output values are stored in the input itself. */
*pbuff++ = in;
/* pState pointer is incremented twice as the real values are located alternatively in the array */
pS1++;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
do
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
i = (S->N - 1U) % 0x4U;
while (i > 0U)
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
/* Decrement loop counter */
i--;
}
/*------------ Normalizing the output by multiplying with the normalizing factor ----------*/
/* Initializing the loop counter to N/4 instead of N for loop unrolling */
i = S->N >> 2U;
/* pbuff initialized to the pInlineBuffer(now contains the output values) */
pbuff = pInlineBuffer;
/* Processing with loop unrolling 4 times as N is always multiple of 4. Compute 4 outputs at a time */
do
{
/* Multiplying pInlineBuffer with the normalizing factor sqrt(2/N) */
in = *pbuff;
*pbuff++ = ((q31_t) (((q63_t) in * S->normalize) >> 31));
in = *pbuff;
*pbuff++ = ((q31_t) (((q63_t) in * S->normalize) >> 31));
in = *pbuff;
*pbuff++ = ((q31_t) (((q63_t) in * S->normalize) >> 31));
in = *pbuff;
*pbuff++ = ((q31_t) (((q63_t) in * S->normalize) >> 31));
/* Decrement loop counter */
i--;
} while (i > 0U);
#else
/* Initializing the loop counter to N/2 */
i = S->Nby2;
do
{
/* Re-ordering of even and odd elements */
/* pState[i] = pInlineBuffer[2*i] */
*pS1++ = *pbuff++;
/* pState[N-i-1] = pInlineBuffer[2*i+1] */
*pS2-- = *pbuff++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Initializing the loop counter */
i = S->N;
do
{
/* Writing the re-ordered output back to inplace input buffer */
*pbuff++ = *pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* ---------------------------------------------------------
* Step2: Calculate RFFT for N-point input
* ---------------------------------------------------------- */
/* pInlineBuffer is real input of length N , pState is the complex output of length 2N */
arm_rfft_q31 (S->pRfft, pInlineBuffer, pState);
/*----------------------------------------------------------------------
* Step3: Multiply the FFT output with the weights.
*----------------------------------------------------------------------*/
arm_cmplx_mult_cmplx_q31 (pState, weights, pState, S->N);
/* The output of complex multiplication is in 3.29 format.
* Hence changing the format of N (i.e. 2*N elements) complex numbers to 1.31 format by shifting left by 2 bits. */
arm_shift_q31(pState, 2, pState, S->N * 2);
/* ----------- Post-processing ---------- */
/* DCT-IV can be obtained from DCT-II by the equation,
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* Hence, Y4(0) = Y2(0)/2 */
/* Getting only real part from the output and Converting to DCT-IV */
/* pbuff initialized to input buffer. */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Calculating Y4(0) from Y2(0) using Y4(0) = Y2(0)/2 */
in = *pS1++ >> 1U;
/* input buffer acts as inplace, so output values are stored in the input itself. */
*pbuff++ = in;
/* pState pointer is incremented twice as the real values are located alternatively in the array */
pS1++;
/* Initializing the loop counter */
i = (S->N - 1U);
while (i > 0U)
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
/* Decrement loop counter */
i--;
}
/*------------ Normalizing the output by multiplying with the normalizing factor ----------*/
/* Initializing loop counter */
i = S->N;
/* pbuff initialized to the pInlineBuffer (now contains the output values) */
pbuff = pInlineBuffer;
do
{
/* Multiplying pInlineBuffer with the normalizing factor sqrt(2/N) */
in = *pbuff;
*pbuff++ = ((q31_t) (((q63_t) in * S->normalize) >> 31));
/* Decrement loop counter */
i--;
} while (i > 0U);
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
}
/**
@} end of DCT4_IDCT4 group
*/
| 12,570 | C | 31.736979 | 117 | 0.55187 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_dct4_init_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_dct4_init_q15.c
* Description: Initialization function of DCT-4 & IDCT4 Q15
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup DCT4_IDCT4
*/
/**
@addtogroup DCT4_IDCT4
@{
*/
/**
@brief Initialization function for the Q15 DCT4/IDCT4.
@param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure
@param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure
@param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure
@param[in] N length of the DCT4
@param[in] Nby2 half of the length of the DCT4
@param[in] normalize normalizing factor
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>N</code> is not a supported transform length
@par Normalizing factor
The normalizing factor is <code>sqrt(2/N)</code>, which depends on the size of transform <code>N</code>.
Normalizing factors in 1.15 format are mentioned in the table below for different DCT sizes:
\image html dct4NormalizingQ15Table.gif
*/
arm_status arm_dct4_init_q15(
arm_dct4_instance_q15 * S,
arm_rfft_instance_q15 * S_RFFT,
arm_cfft_radix4_instance_q15 * S_CFFT,
uint16_t N,
uint16_t Nby2,
q15_t normalize)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialize the DCT4 length */
S->N = N;
/* Initialize the half of DCT4 length */
S->Nby2 = Nby2;
/* Initialize the DCT4 Normalizing factor */
S->normalize = normalize;
/* Initialize Real FFT Instance */
S->pRfft = S_RFFT;
/* Initialize Complex FFT Instance */
S->pCfft = S_CFFT;
switch (N)
{
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_8192)
/* Initialize the table modifier values */
case 8192U:
S->pTwiddle = WeightsQ15_8192;
S->pCosFactor = cos_factorsQ15_8192;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_2048)
case 2048U:
S->pTwiddle = WeightsQ15_2048;
S->pCosFactor = cos_factorsQ15_2048;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_512)
case 512U:
S->pTwiddle = WeightsQ15_512;
S->pCosFactor = cos_factorsQ15_512;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_128)
case 128U:
S->pTwiddle = WeightsQ15_128;
S->pCosFactor = cos_factorsQ15_128;
break;
#endif
default:
status = ARM_MATH_ARGUMENT_ERROR;
}
/* Initialize the RFFT/RIFFT */
arm_rfft_init_q15(S->pRfft, S->N, 0U, 1U);
/* return the status of DCT4 Init function */
return (status);
}
/**
@} end of DCT4_IDCT4 group
*/
| 3,918 | C | 28.91603 | 123 | 0.630424 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_init_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix4_init_f32.c
* Description: Radix-4 Decimation in Frequency Floating-point CFFT & CIFFT Initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Initialization function for the floating-point CFFT/CIFFT.
@deprecated Do not use this function. It has been superceded by \ref arm_cfft_f32 and will be removed in the future.
@param[in,out] S points to an instance of the floating-point CFFT/CIFFT structure
@param[in] fftLen length of the FFT
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Details
The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_cfft_radix4_init_f32(
arm_cfft_radix4_instance_f32 * S,
uint16_t fftLen,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialise the FFT length */
S->fftLen = fftLen;
/* Initialise the Twiddle coefficient pointer */
S->pTwiddle = (float32_t *) twiddleCoef;
/* Initialise the Flag for selection of CFFT or CIFFT */
S->ifftFlag = ifftFlag;
/* Initialise the Flag for calculation Bit reversal or not */
S->bitReverseFlag = bitReverseFlag;
/* Initializations of structure parameters depending on the FFT length */
switch (S->fftLen)
{
case 4096U:
/* Initializations of structure parameters for 4096 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 1U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 1U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) armBitRevTable;
/* Initialise the 1/fftLen Value */
S->onebyfftLen = 0.000244140625;
break;
case 1024U:
/* Initializations of structure parameters for 1024 point FFT */
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 4U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 4U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
/* Initialise the 1/fftLen Value */
S->onebyfftLen = 0.0009765625f;
break;
case 256U:
/* Initializations of structure parameters for 256 point FFT */
S->twidCoefModifier = 16U;
S->bitRevFactor = 16U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
S->onebyfftLen = 0.00390625f;
break;
case 64U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 64U;
S->bitRevFactor = 64U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
S->onebyfftLen = 0.015625f;
break;
case 16U:
/* Initializations of structure parameters for 16 point FFT */
S->twidCoefModifier = 256U;
S->bitRevFactor = 256U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
S->onebyfftLen = 0.0625f;
break;
default:
/* Reporting argument error if fftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
return (status);
}
/**
@} end of ComplexFFT group
*/
| 5,392 | C | 33.350318 | 137 | 0.642433 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_dct4_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_dct4_f32.c
* Description: Processing function of DCT4 & IDCT4 F32
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupTransforms
*/
/**
@defgroup DCT4_IDCT4 DCT Type IV Functions
Representation of signals by minimum number of values is important for storage and transmission.
The possibility of large discontinuity between the beginning and end of a period of a signal
in DFT can be avoided by extending the signal so that it is even-symmetric.
Discrete Cosine Transform (DCT) is constructed such that its energy is heavily concentrated in the lower part of the
spectrum and is very widely used in signal and image coding applications.
The family of DCTs (DCT type- 1,2,3,4) is the outcome of different combinations of homogeneous boundary conditions.
DCT has an excellent energy-packing capability, hence has many applications and in data compression in particular.
DCT is essentially the Discrete Fourier Transform(DFT) of an even-extended real signal.
Reordering of the input data makes the computation of DCT just a problem of
computing the DFT of a real signal with a few additional operations.
This approach provides regular, simple, and very efficient DCT algorithms for practical hardware and software implementations.
DCT type-II can be implemented using Fast fourier transform (FFT) internally, as the transform is applied on real values, Real FFT can be used.
DCT4 is implemented using DCT2 as their implementations are similar except with some added pre-processing and post-processing.
DCT2 implementation can be described in the following steps:
- Re-ordering input
- Calculating Real FFT
- Multiplication of weights and Real FFT output and getting real part from the product.
This process is explained by the block diagram below:
\image html DCT4.gif "Discrete Cosine Transform - type-IV"
@par Algorithm
The N-point type-IV DCT is defined as a real, linear transformation by the formula:
\image html DCT4Equation.gif
where <code>k = 0, 1, 2, ..., N-1</code>
@par
Its inverse is defined as follows:
\image html IDCT4Equation.gif
where <code>n = 0, 1, 2, ..., N-1</code>
@par
The DCT4 matrices become involutory (i.e. they are self-inverse) by multiplying with an overall scale factor of sqrt(2/N).
The symmetry of the transform matrix indicates that the fast algorithms for the forward
and inverse transform computation are identical.
Note that the implementation of Inverse DCT4 and DCT4 is same, hence same process function can be used for both.
@par Lengths supported by the transform:
As DCT4 internally uses Real FFT, it supports all the lengths 128, 512, 2048 and 8192.
The library provides separate functions for Q15, Q31, and floating-point data types.
@par Instance Structure
The instances for Real FFT and FFT, cosine values table and twiddle factor table are stored in an instance data structure.
A separate instance structure must be defined for each transform.
There are separate instance structure declarations for each of the 3 supported data types.
@par Initialization Functions
There is also an associated initialization function for each data type.
The initialization function performs the following operations:
- Sets the values of the internal structure fields.
- Initializes Real FFT as its process function is used internally in DCT4, by calling \ref arm_rfft_init_f32().
@par
Use of the initialization function is optional.
However, if the initialization function is used, then the instance structure cannot be placed into a const data section.
To place an instance structure into a const data section, the instance structure must be manually initialized.
Manually initialize the instance structure as follows:
<pre>
arm_dct4_instance_f32 S = {N, Nby2, normalize, pTwiddle, pCosFactor, pRfft, pCfft};
arm_dct4_instance_q31 S = {N, Nby2, normalize, pTwiddle, pCosFactor, pRfft, pCfft};
arm_dct4_instance_q15 S = {N, Nby2, normalize, pTwiddle, pCosFactor, pRfft, pCfft};
</pre>
where \c N is the length of the DCT4; \c Nby2 is half of the length of the DCT4;
\c normalize is normalizing factor used and is equal to <code>sqrt(2/N)</code>;
\c pTwiddle points to the twiddle factor table;
\c pCosFactor points to the cosFactor table;
\c pRfft points to the real FFT instance;
\c pCfft points to the complex FFT instance;
The CFFT and RFFT structures also needs to be initialized, refer to arm_cfft_radix4_f32()
and arm_rfft_f32() respectively for details regarding static initialization.
@par Fixed-Point Behavior
Care must be taken when using the fixed-point versions of the DCT4 transform functions.
In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
Refer to the function specific documentation below for usage guidelines.
*/
/**
@addtogroup DCT4_IDCT4
@{
*/
/**
@brief Processing function for the floating-point DCT4/IDCT4.
@param[in] S points to an instance of the floating-point DCT4/IDCT4 structure
@param[in] pState points to state buffer
@param[in,out] pInlineBuffer points to the in-place input and output buffer
@return none
*/
void arm_dct4_f32(
const arm_dct4_instance_f32 * S,
float32_t * pState,
float32_t * pInlineBuffer)
{
const float32_t *weights = S->pTwiddle; /* Pointer to the Weights table */
const float32_t *cosFact = S->pCosFactor; /* Pointer to the cos factors table */
float32_t *pS1, *pS2, *pbuff; /* Temporary pointers for input buffer and pState buffer */
float32_t in; /* Temporary variable */
uint32_t i; /* Loop counter */
/* DCT4 computation involves DCT2 (which is calculated using RFFT)
* along with some pre-processing and post-processing.
* Computational procedure is explained as follows:
* (a) Pre-processing involves multiplying input with cos factor,
* r(n) = 2 * u(n) * cos(pi*(2*n+1)/(4*n))
* where,
* r(n) -- output of preprocessing
* u(n) -- input to preprocessing(actual Source buffer)
* (b) Calculation of DCT2 using FFT is divided into three steps:
* Step1: Re-ordering of even and odd elements of input.
* Step2: Calculating FFT of the re-ordered input.
* Step3: Taking the real part of the product of FFT output and weights.
* (c) Post-processing - DCT4 can be obtained from DCT2 output using the following equation:
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* where,
* Y4 -- DCT4 output, Y2 -- DCT2 output
* (d) Multiplying the output with the normalizing factor sqrt(2/N).
*/
/*-------- Pre-processing ------------*/
/* Multiplying input with cos factor i.e. r(n) = 2 * x(n) * cos(pi*(2*n+1)/(4*n)) */
arm_scale_f32(pInlineBuffer, 2.0f, pInlineBuffer, S->N);
arm_mult_f32(pInlineBuffer, cosFact, pInlineBuffer, S->N);
/* ----------------------------------------------------------------
* Step1: Re-ordering of even and odd elements as
* pState[i] = pInlineBuffer[2*i] and
* pState[N-i-1] = pInlineBuffer[2*i+1] where i = 0 to N/2
---------------------------------------------------------------------*/
/* pS1 initialized to pState */
pS1 = pState;
/* pS2 initialized to pState+N-1, so that it points to the end of the state buffer */
pS2 = pState + (S->N - 1U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
#if defined (ARM_MATH_LOOPUNROLL)
/* Initializing the loop counter to N/2 >> 2 for loop unrolling by 4 */
i = S->Nby2 >> 2U;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
do
{
/* Re-ordering of even and odd elements */
/* pState[i] = pInlineBuffer[2*i] */
*pS1++ = *pbuff++;
/* pState[N-i-1] = pInlineBuffer[2*i+1] */
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
*pS1++ = *pbuff++;
*pS2-- = *pbuff++;
/* Decrement loop counter */
i--;
} while (i > 0U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Initializing the loop counter to N/4 instead of N for loop unrolling */
i = S->N >> 2U;
/* Processing with loop unrolling 4 times as N is always multiple of 4.
* Compute 4 outputs at a time */
do
{
/* Writing the re-ordered output back to inplace input buffer */
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
*pbuff++ = *pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* ---------------------------------------------------------
* Step2: Calculate RFFT for N-point input
* ---------------------------------------------------------- */
/* pInlineBuffer is real input of length N , pState is the complex output of length 2N */
arm_rfft_f32 (S->pRfft, pInlineBuffer, pState);
/*----------------------------------------------------------------------
* Step3: Multiply the FFT output with the weights.
*----------------------------------------------------------------------*/
arm_cmplx_mult_cmplx_f32 (pState, weights, pState, S->N);
/* ----------- Post-processing ---------- */
/* DCT-IV can be obtained from DCT-II by the equation,
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* Hence, Y4(0) = Y2(0)/2 */
/* Getting only real part from the output and Converting to DCT-IV */
/* Initializing the loop counter to N >> 2 for loop unrolling by 4 */
i = (S->N - 1U) >> 2U;
/* pbuff initialized to input buffer. */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Calculating Y4(0) from Y2(0) using Y4(0) = Y2(0)/2 */
in = *pS1++ * (float32_t) 0.5;
/* input buffer acts as inplace, so output values are stored in the input itself. */
*pbuff++ = in;
/* pState pointer is incremented twice as the real values are located alternatively in the array */
pS1++;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
do
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
in = *pS1++ - in;
*pbuff++ = in;
pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
i = (S->N - 1U) % 0x4U;
while (i > 0U)
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
/* Decrement the loop counter */
i--;
}
/*------------ Normalizing the output by multiplying with the normalizing factor ----------*/
/* Initializing the loop counter to N/4 instead of N for loop unrolling */
i = S->N >> 2U;
/* pbuff initialized to the pInlineBuffer(now contains the output values) */
pbuff = pInlineBuffer;
/* Processing with loop unrolling 4 times as N is always multiple of 4. Compute 4 outputs at a time */
do
{
/* Multiplying pInlineBuffer with the normalizing factor sqrt(2/N) */
in = *pbuff;
*pbuff++ = in * S->normalize;
in = *pbuff;
*pbuff++ = in * S->normalize;
in = *pbuff;
*pbuff++ = in * S->normalize;
in = *pbuff;
*pbuff++ = in * S->normalize;
/* Decrement the loop counter */
i--;
} while (i > 0U);
#else
/* Initializing the loop counter to N/2 */
i = S->Nby2;
do
{
/* Re-ordering of even and odd elements */
/* pState[i] = pInlineBuffer[2*i] */
*pS1++ = *pbuff++;
/* pState[N-i-1] = pInlineBuffer[2*i+1] */
*pS2-- = *pbuff++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* pbuff initialized to input buffer */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Initializing the loop counter */
i = S->N;
do
{
/* Writing the re-ordered output back to inplace input buffer */
*pbuff++ = *pS1++;
/* Decrement the loop counter */
i--;
} while (i > 0U);
/* ---------------------------------------------------------
* Step2: Calculate RFFT for N-point input
* ---------------------------------------------------------- */
/* pInlineBuffer is real input of length N , pState is the complex output of length 2N */
arm_rfft_f32 (S->pRfft, pInlineBuffer, pState);
/*----------------------------------------------------------------------
* Step3: Multiply the FFT output with the weights.
*----------------------------------------------------------------------*/
arm_cmplx_mult_cmplx_f32 (pState, weights, pState, S->N);
/* ----------- Post-processing ---------- */
/* DCT-IV can be obtained from DCT-II by the equation,
* Y4(k) = Y2(k) - Y4(k-1) and Y4(-1) = Y4(0)
* Hence, Y4(0) = Y2(0)/2 */
/* Getting only real part from the output and Converting to DCT-IV */
/* pbuff initialized to input buffer. */
pbuff = pInlineBuffer;
/* pS1 initialized to pState */
pS1 = pState;
/* Calculating Y4(0) from Y2(0) using Y4(0) = Y2(0)/2 */
in = *pS1++ * (float32_t) 0.5;
/* input buffer acts as inplace, so output values are stored in the input itself. */
*pbuff++ = in;
/* pState pointer is incremented twice as the real values are located alternatively in the array */
pS1++;
/* Initializing the loop counter */
i = (S->N - 1U);
do
{
/* Calculating Y4(1) to Y4(N-1) from Y2 using equation Y4(k) = Y2(k) - Y4(k-1) */
/* pState pointer (pS1) is incremented twice as the real values are located alternatively in the array */
in = *pS1++ - in;
*pbuff++ = in;
/* points to the next real value */
pS1++;
/* Decrement loop counter */
i--;
} while (i > 0U);
/*------------ Normalizing the output by multiplying with the normalizing factor ----------*/
/* Initializing loop counter */
i = S->N;
/* pbuff initialized to the pInlineBuffer (now contains the output values) */
pbuff = pInlineBuffer;
do
{
/* Multiplying pInlineBuffer with the normalizing factor sqrt(2/N) */
in = *pbuff;
*pbuff++ = in * S->normalize;
/* Decrement loop counter */
i--;
} while (i > 0U);
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
}
/**
@} end of DCT4_IDCT4 group
*/
| 16,858 | C | 36.547884 | 145 | 0.589928 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_q15.c
* Description: RFFT & RIFFT Q15 process function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/* ----------------------------------------------------------------------
* Internal functions prototypes
* -------------------------------------------------------------------- */
void arm_split_rfft_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pATable,
const q15_t * pBTable,
q15_t * pDst,
uint32_t modifier);
void arm_split_rifft_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pATable,
const q15_t * pBTable,
q15_t * pDst,
uint32_t modifier);
/**
@addtogroup RealFFT
@{
*/
/**
@brief Processing function for the Q15 RFFT/RIFFT.
@param[in] S points to an instance of the Q15 RFFT/RIFFT structure
@param[in] pSrc points to input buffer
@param[out] pDst points to output buffer
@return none
@par Input an output formats
Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process.
Hence the output format is different for different RFFT sizes.
The input and output formats for different RFFT sizes and number of bits to upscale are mentioned in the tables below for RFFT and RIFFT:
@par
\image html RFFTQ15.gif "Input and Output Formats for Q15 RFFT"
@par
\image html RIFFTQ15.gif "Input and Output Formats for Q15 RIFFT"
*/
void arm_rfft_q15(
const arm_rfft_instance_q15 * S,
q15_t * pSrc,
q15_t * pDst)
{
const arm_cfft_instance_q15 *S_CFFT = S->pCfft;
uint32_t L2 = S->fftLenReal >> 1U;
uint32_t i;
/* Calculation of RIFFT of input */
if (S->ifftFlagR == 1U)
{
/* Real IFFT core process */
arm_split_rifft_q15 (pSrc, L2, S->pTwiddleAReal, S->pTwiddleBReal, pDst, S->twidCoefRModifier);
/* Complex IFFT process */
arm_cfft_q15 (S_CFFT, pDst, S->ifftFlagR, S->bitReverseFlagR);
for(i = 0; i < S->fftLenReal; i++)
{
pDst[i] = pDst[i] << 1U;
}
}
else
{
/* Calculation of RFFT of input */
/* Complex FFT process */
arm_cfft_q15 (S_CFFT, pSrc, S->ifftFlagR, S->bitReverseFlagR);
/* Real FFT core process */
arm_split_rfft_q15 (pSrc, L2, S->pTwiddleAReal, S->pTwiddleBReal, pDst, S->twidCoefRModifier);
}
}
/**
@} end of RealFFT group
*/
/**
@brief Core Real FFT process
@param[in] pSrc points to input buffer
@param[in] fftLen length of FFT
@param[in] pATable points to twiddle Coef A buffer
@param[in] pBTable points to twiddle Coef B buffer
@param[out] pDst points to output buffer
@param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
@par
The function implements a Real FFT
*/
void arm_split_rfft_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pATable,
const q15_t * pBTable,
q15_t * pDst,
uint32_t modifier)
{
uint32_t i; /* Loop Counter */
q31_t outR, outI; /* Temporary variables for output */
const q15_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
q15_t *pSrc1, *pSrc2;
#if defined (ARM_MATH_DSP)
q15_t *pD1, *pD2;
#endif
/* Init coefficient pointers */
pCoefA = &pATable[modifier * 2];
pCoefB = &pBTable[modifier * 2];
pSrc1 = &pSrc[2];
pSrc2 = &pSrc[(2U * fftLen) - 2U];
#if defined (ARM_MATH_DSP)
i = 1U;
pD1 = pDst + 2;
pD2 = pDst + (4U * fftLen) - 2;
for (i = fftLen - 1; i > 0; i--)
{
/*
outR = ( pSrc[2 * i] * pATable[2 * i]
- pSrc[2 * i + 1] * pATable[2 * i + 1]
+ pSrc[2 * n - 2 * i] * pBTable[2 * i]
+ pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
outI = ( pIn[2 * i + 1] * pATable[2 * i]
+ pIn[2 * i] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i])
*/
#ifndef ARM_MATH_BIG_ENDIAN
/* pSrc[2 * i] * pATable[2 * i] - pSrc[2 * i + 1] * pATable[2 * i + 1] */
outR = __SMUSD(read_q15x2 (pSrc1), read_q15x2((q15_t *) pCoefA));
#else
/* -(pSrc[2 * i + 1] * pATable[2 * i + 1] - pSrc[2 * i] * pATable[2 * i]) */
outR = -(__SMUSD(read_q15x2 (pSrc1), read_q15x2((q15_t *) pCoefA)));
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* pSrc[2 * n - 2 * i] * pBTable[2 * i] + pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1]) */
outR = __SMLAD(read_q15x2 (pSrc2), read_q15x2((q15_t *) pCoefB), outR) >> 16U;
/* pIn[2 * n - 2 * i] * pBTable[2 * i + 1] - pIn[2 * n - 2 * i + 1] * pBTable[2 * i] */
#ifndef ARM_MATH_BIG_ENDIAN
outI = __SMUSDX(read_q15x2_da (&pSrc2), read_q15x2((q15_t *) pCoefB));
#else
outI = __SMUSDX(read_q15x2 ((q15_t *) pCoefB), read_q15x2_da (&pSrc2));
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* (pIn[2 * i + 1] * pATable[2 * i] + pIn[2 * i] * pATable[2 * i + 1] */
outI = __SMLADX(read_q15x2_ia (&pSrc1), read_q15x2 ((q15_t *) pCoefA), outI);
/* write output */
*pD1++ = (q15_t) outR;
*pD1++ = outI >> 16U;
/* write complex conjugate output */
pD2[0] = (q15_t) outR;
pD2[1] = -(outI >> 16U);
pD2 -= 2;
/* update coefficient pointer */
pCoefB = pCoefB + (2U * modifier);
pCoefA = pCoefA + (2U * modifier);
}
pDst[2U * fftLen] = (pSrc[0] - pSrc[1]) >> 1U;
pDst[2U * fftLen + 1U] = 0;
pDst[0] = (pSrc[0] + pSrc[1]) >> 1U;
pDst[1] = 0;
#else
i = 1U;
while (i < fftLen)
{
/*
outR = ( pSrc[2 * i] * pATable[2 * i]
- pSrc[2 * i + 1] * pATable[2 * i + 1]
+ pSrc[2 * n - 2 * i] * pBTable[2 * i]
+ pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
*/
outR = *pSrc1 * *pCoefA;
outR = outR - (*(pSrc1 + 1) * *(pCoefA + 1));
outR = outR + (*pSrc2 * *pCoefB);
outR = (outR + (*(pSrc2 + 1) * *(pCoefB + 1))) >> 16;
/*
outI = ( pIn[2 * i + 1] * pATable[2 * i]
+ pIn[2 * i] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
*/
outI = *pSrc2 * *(pCoefB + 1);
outI = outI - (*(pSrc2 + 1) * *pCoefB);
outI = outI + (*(pSrc1 + 1) * *pCoefA);
outI = outI + (*pSrc1 * *(pCoefA + 1));
/* update input pointers */
pSrc1 += 2U;
pSrc2 -= 2U;
/* write output */
pDst[2U * i] = (q15_t) outR;
pDst[2U * i + 1U] = outI >> 16U;
/* write complex conjugate output */
pDst[(4U * fftLen) - (2U * i)] = (q15_t) outR;
pDst[((4U * fftLen) - (2U * i)) + 1U] = -(outI >> 16U);
/* update coefficient pointer */
pCoefB = pCoefB + (2U * modifier);
pCoefA = pCoefA + (2U * modifier);
i++;
}
pDst[2U * fftLen] = (pSrc[0] - pSrc[1]) >> 1;
pDst[2U * fftLen + 1U] = 0;
pDst[0] = (pSrc[0] + pSrc[1]) >> 1;
pDst[1] = 0;
#endif /* #if defined (ARM_MATH_DSP) */
}
/**
@brief Core Real IFFT process
@param[in] pSrc points to input buffer
@param[in] fftLen length of FFT
@param[in] pATable points to twiddle Coef A buffer
@param[in] pBTable points to twiddle Coef B buffer
@param[out] pDst points to output buffer
@param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
@par
The function implements a Real IFFT
*/
void arm_split_rifft_q15(
q15_t * pSrc,
uint32_t fftLen,
const q15_t * pATable,
const q15_t * pBTable,
q15_t * pDst,
uint32_t modifier)
{
uint32_t i; /* Loop Counter */
q31_t outR, outI; /* Temporary variables for output */
const q15_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
q15_t *pSrc1, *pSrc2;
q15_t *pDst1 = &pDst[0];
pCoefA = &pATable[0];
pCoefB = &pBTable[0];
pSrc1 = &pSrc[0];
pSrc2 = &pSrc[2 * fftLen];
i = fftLen;
while (i > 0U)
{
/*
outR = ( pIn[2 * i] * pATable[2 * i]
+ pIn[2 * i + 1] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
outI = ( pIn[2 * i + 1] * pATable[2 * i]
- pIn[2 * i] * pATable[2 * i + 1]
- pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
*/
#if defined (ARM_MATH_DSP)
#ifndef ARM_MATH_BIG_ENDIAN
/* pIn[2 * n - 2 * i] * pBTable[2 * i] - pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1]) */
outR = __SMUSD(read_q15x2(pSrc2), read_q15x2((q15_t *) pCoefB));
#else
/* -(-pIn[2 * n - 2 * i] * pBTable[2 * i] + pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1])) */
outR = -(__SMUSD(read_q15x2(pSrc2), read_q15x2((q15_t *) pCoefB)));
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* pIn[2 * i] * pATable[2 * i] + pIn[2 * i + 1] * pATable[2 * i + 1] + pIn[2 * n - 2 * i] * pBTable[2 * i] */
outR = __SMLAD(read_q15x2(pSrc1), read_q15x2 ((q15_t *) pCoefA), outR) >> 16U;
/* -pIn[2 * n - 2 * i] * pBTable[2 * i + 1] + pIn[2 * n - 2 * i + 1] * pBTable[2 * i] */
outI = __SMUADX(read_q15x2_da (&pSrc2), read_q15x2((q15_t *) pCoefB));
/* pIn[2 * i + 1] * pATable[2 * i] - pIn[2 * i] * pATable[2 * i + 1] */
#ifndef ARM_MATH_BIG_ENDIAN
outI = __SMLSDX(read_q15x2 ((q15_t *) pCoefA), read_q15x2_ia (&pSrc1), -outI);
#else
outI = __SMLSDX(read_q15x2_ia (&pSrc1), read_q15x2 ((q15_t *) pCoefA), -outI);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* write output */
#ifndef ARM_MATH_BIG_ENDIAN
write_q15x2_ia (&pDst1, __PKHBT(outR, (outI >> 16U), 16));
#else
write_q15x2_ia (&pDst1, __PKHBT((outI >> 16U), outR, 16));
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
#else /* #if defined (ARM_MATH_DSP) */
outR = *pSrc2 * *pCoefB;
outR = outR - (*(pSrc2 + 1) * *(pCoefB + 1));
outR = outR + (*pSrc1 * *pCoefA);
outR = (outR + (*(pSrc1 + 1) * *(pCoefA + 1))) >> 16;
outI = *(pSrc1 + 1) * *pCoefA;
outI = outI - (*pSrc1 * *(pCoefA + 1));
outI = outI - (*pSrc2 * *(pCoefB + 1));
outI = outI - (*(pSrc2 + 1) * *(pCoefB));
/* update input pointers */
pSrc1 += 2U;
pSrc2 -= 2U;
/* write output */
*pDst1++ = (q15_t) outR;
*pDst1++ = (q15_t) (outI >> 16);
#endif /* #if defined (ARM_MATH_DSP) */
/* update coefficient pointer */
pCoefB = pCoefB + (2 * modifier);
pCoefA = pCoefA + (2 * modifier);
i--;
}
}
| 12,320 | C | 31.338583 | 156 | 0.490503 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal2.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_bitreversal2.c
* Description: Bitreversal functions
*
* $Date: 18. March 2019
* $Revision: V1.0.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@brief In-place 32 bit reversal function.
@param[in,out] pSrc points to in-place buffer of unknown 32-bit data type
@param[in] bitRevLen bit reversal table length
@param[in] pBitRevTab points to bit reversal table
@return none
*/
void arm_bitreversal_32(
uint32_t *pSrc,
const uint16_t bitRevLen,
const uint16_t *pBitRevTab)
{
uint32_t a, b, i, tmp;
for (i = 0; i < bitRevLen; )
{
a = pBitRevTab[i ] >> 2;
b = pBitRevTab[i + 1] >> 2;
//real
tmp = pSrc[a];
pSrc[a] = pSrc[b];
pSrc[b] = tmp;
//complex
tmp = pSrc[a+1];
pSrc[a+1] = pSrc[b+1];
pSrc[b+1] = tmp;
i += 2;
}
}
/**
@brief In-place 16 bit reversal function.
@param[in,out] pSrc points to in-place buffer of unknown 16-bit data type
@param[in] bitRevLen bit reversal table length
@param[in] pBitRevTab points to bit reversal table
@return none
*/
void arm_bitreversal_16(
uint16_t *pSrc,
const uint16_t bitRevLen,
const uint16_t *pBitRevTab)
{
uint16_t a, b, i, tmp;
for (i = 0; i < bitRevLen; )
{
a = pBitRevTab[i ] >> 2;
b = pBitRevTab[i + 1] >> 2;
//real
tmp = pSrc[a];
pSrc[a] = pSrc[b];
pSrc[b] = tmp;
//complex
tmp = pSrc[a+1];
pSrc[a+1] = pSrc[b+1];
pSrc[b+1] = tmp;
i += 2;
}
}
| 2,480 | C | 23.81 | 82 | 0.571371 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_q31.c
* Description: FFT & RIFFT Q31 process function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/* ----------------------------------------------------------------------
* Internal functions prototypes
* -------------------------------------------------------------------- */
void arm_split_rfft_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pATable,
const q31_t * pBTable,
q31_t * pDst,
uint32_t modifier);
void arm_split_rifft_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pATable,
const q31_t * pBTable,
q31_t * pDst,
uint32_t modifier);
/**
@addtogroup RealFFT
@{
*/
/**
@brief Processing function for the Q31 RFFT/RIFFT.
@param[in] S points to an instance of the Q31 RFFT/RIFFT structure
@param[in] pSrc points to input buffer
@param[out] pDst points to output buffer
@return none
@par Input an output formats
Internally input is downscaled by 2 for every stage to avoid saturations inside CFFT/CIFFT process.
Hence the output format is different for different RFFT sizes.
The input and output formats for different RFFT sizes and number of bits to upscale are mentioned in the tables below for RFFT and RIFFT:
@par
\image html RFFTQ31.gif "Input and Output Formats for Q31 RFFT"
@par
\image html RIFFTQ31.gif "Input and Output Formats for Q31 RIFFT"
*/
void arm_rfft_q31(
const arm_rfft_instance_q31 * S,
q31_t * pSrc,
q31_t * pDst)
{
const arm_cfft_instance_q31 *S_CFFT = S->pCfft;
uint32_t L2 = S->fftLenReal >> 1U;
uint32_t i;
/* Calculation of RIFFT of input */
if (S->ifftFlagR == 1U)
{
/* Real IFFT core process */
arm_split_rifft_q31 (pSrc, L2, S->pTwiddleAReal, S->pTwiddleBReal, pDst, S->twidCoefRModifier);
/* Complex IFFT process */
arm_cfft_q31 (S_CFFT, pDst, S->ifftFlagR, S->bitReverseFlagR);
for(i = 0; i < S->fftLenReal; i++)
{
pDst[i] = pDst[i] << 1U;
}
}
else
{
/* Calculation of RFFT of input */
/* Complex FFT process */
arm_cfft_q31 (S_CFFT, pSrc, S->ifftFlagR, S->bitReverseFlagR);
/* Real FFT core process */
arm_split_rfft_q31 (pSrc, L2, S->pTwiddleAReal, S->pTwiddleBReal, pDst, S->twidCoefRModifier);
}
}
/**
@} end of RealFFT group
*/
/**
@brief Core Real FFT process
@param[in] pSrc points to input buffer
@param[in] fftLen length of FFT
@param[in] pATable points to twiddle Coef A buffer
@param[in] pBTable points to twiddle Coef B buffer
@param[out] pDst points to output buffer
@param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
*/
void arm_split_rfft_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pATable,
const q31_t * pBTable,
q31_t * pDst,
uint32_t modifier)
{
uint32_t i; /* Loop Counter */
q31_t outR, outI; /* Temporary variables for output */
const q31_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
q31_t CoefA1, CoefA2, CoefB1; /* Temporary variables for twiddle coefficients */
q31_t *pOut1 = &pDst[2], *pOut2 = &pDst[4 * fftLen - 1];
q31_t *pIn1 = &pSrc[2], *pIn2 = &pSrc[2 * fftLen - 1];
/* Init coefficient pointers */
pCoefA = &pATable[modifier * 2];
pCoefB = &pBTable[modifier * 2];
i = fftLen - 1U;
while (i > 0U)
{
/*
outR = ( pSrc[2 * i] * pATable[2 * i]
- pSrc[2 * i + 1] * pATable[2 * i + 1]
+ pSrc[2 * n - 2 * i] * pBTable[2 * i]
+ pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
outI = ( pIn[2 * i + 1] * pATable[2 * i]
+ pIn[2 * i] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
*/
CoefA1 = *pCoefA++;
CoefA2 = *pCoefA;
/* outR = (pSrc[2 * i] * pATable[2 * i] */
mult_32x32_keep32_R (outR, *pIn1, CoefA1);
/* outI = pIn[2 * i] * pATable[2 * i + 1] */
mult_32x32_keep32_R (outI, *pIn1++, CoefA2);
/* - pSrc[2 * i + 1] * pATable[2 * i + 1] */
multSub_32x32_keep32_R (outR, *pIn1, CoefA2);
/* (pIn[2 * i + 1] * pATable[2 * i] */
multAcc_32x32_keep32_R (outI, *pIn1++, CoefA1);
/* pSrc[2 * n - 2 * i] * pBTable[2 * i] */
multSub_32x32_keep32_R (outR, *pIn2, CoefA2);
CoefB1 = *pCoefB;
/* pIn[2 * n - 2 * i] * pBTable[2 * i + 1] */
multSub_32x32_keep32_R (outI, *pIn2--, CoefB1);
/* pSrc[2 * n - 2 * i + 1] * pBTable[2 * i + 1] */
multAcc_32x32_keep32_R (outR, *pIn2, CoefB1);
/* pIn[2 * n - 2 * i + 1] * pBTable[2 * i] */
multSub_32x32_keep32_R (outI, *pIn2--, CoefA2);
/* write output */
*pOut1++ = outR;
*pOut1++ = outI;
/* write complex conjugate output */
*pOut2-- = -outI;
*pOut2-- = outR;
/* update coefficient pointer */
pCoefB = pCoefB + (2 * modifier);
pCoefA = pCoefA + (2 * modifier - 1);
/* Decrement loop count */
i--;
}
pDst[2 * fftLen] = (pSrc[0] - pSrc[1]) >> 1U;
pDst[2 * fftLen + 1] = 0;
pDst[0] = (pSrc[0] + pSrc[1]) >> 1U;
pDst[1] = 0;
}
/**
@brief Core Real IFFT process
@param[in] pSrc points to input buffer
@param[in] fftLen length of FFT
@param[in] pATable points to twiddle Coef A buffer
@param[in] pBTable points to twiddle Coef B buffer
@param[out] pDst points to output buffer
@param[in] modifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table
@return none
*/
void arm_split_rifft_q31(
q31_t * pSrc,
uint32_t fftLen,
const q31_t * pATable,
const q31_t * pBTable,
q31_t * pDst,
uint32_t modifier)
{
q31_t outR, outI; /* Temporary variables for output */
const q31_t *pCoefA, *pCoefB; /* Temporary pointers for twiddle factors */
q31_t CoefA1, CoefA2, CoefB1; /* Temporary variables for twiddle coefficients */
q31_t *pIn1 = &pSrc[0], *pIn2 = &pSrc[2 * fftLen + 1];
pCoefA = &pATable[0];
pCoefB = &pBTable[0];
while (fftLen > 0U)
{
/*
outR = ( pIn[2 * i] * pATable[2 * i]
+ pIn[2 * i + 1] * pATable[2 * i + 1]
+ pIn[2 * n - 2 * i] * pBTable[2 * i]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1]);
outI = ( pIn[2 * i + 1] * pATable[2 * i]
- pIn[2 * i] * pATable[2 * i + 1]
- pIn[2 * n - 2 * i] * pBTable[2 * i + 1]
- pIn[2 * n - 2 * i + 1] * pBTable[2 * i]);
*/
CoefA1 = *pCoefA++;
CoefA2 = *pCoefA;
/* outR = (pIn[2 * i] * pATable[2 * i] */
mult_32x32_keep32_R (outR, *pIn1, CoefA1);
/* - pIn[2 * i] * pATable[2 * i + 1] */
mult_32x32_keep32_R (outI, *pIn1++, -CoefA2);
/* pIn[2 * i + 1] * pATable[2 * i + 1] */
multAcc_32x32_keep32_R (outR, *pIn1, CoefA2);
/* pIn[2 * i + 1] * pATable[2 * i] */
multAcc_32x32_keep32_R (outI, *pIn1++, CoefA1);
/* pIn[2 * n - 2 * i] * pBTable[2 * i] */
multAcc_32x32_keep32_R (outR, *pIn2, CoefA2);
CoefB1 = *pCoefB;
/* pIn[2 * n - 2 * i] * pBTable[2 * i + 1] */
multSub_32x32_keep32_R (outI, *pIn2--, CoefB1);
/* pIn[2 * n - 2 * i + 1] * pBTable[2 * i + 1] */
multAcc_32x32_keep32_R (outR, *pIn2, CoefB1);
/* pIn[2 * n - 2 * i + 1] * pBTable[2 * i] */
multAcc_32x32_keep32_R (outI, *pIn2--, CoefA2);
/* write output */
*pDst++ = outR;
*pDst++ = outI;
/* update coefficient pointer */
pCoefB = pCoefB + (modifier * 2);
pCoefA = pCoefA + (modifier * 2 - 1);
/* Decrement loop count */
fftLen--;
}
}
| 9,226 | C | 30.491467 | 156 | 0.516584 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_init_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_init_f32.c
* Description: Split Radix Decimation in Frequency CFFT Floating point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup RealFFT
@{
*/
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_BITREVIDX_FLT_16) && defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_32))
/**
@brief Initialization function for the 32pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_32_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 16U;
S->fftLenRFFT = 32U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_16_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable16;
Sint->pTwiddle = (float32_t *) twiddleCoef_16;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_32;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_BITREVIDX_FLT_32) && defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_64))
/**
@brief Initialization function for the 64pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_64_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 32U;
S->fftLenRFFT = 64U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_32_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable32;
Sint->pTwiddle = (float32_t *) twiddleCoef_32;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_64;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_BITREVIDX_FLT_64) && defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_128))
/**
@brief Initialization function for the 128pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_128_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 64U;
S->fftLenRFFT = 128U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_64_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable64;
Sint->pTwiddle = (float32_t *) twiddleCoef_64;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_128;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_BITREVIDX_FLT_128) && defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_256))
/**
@brief Initialization function for the 256pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_256_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 128U;
S->fftLenRFFT = 256U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_128_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable128;
Sint->pTwiddle = (float32_t *) twiddleCoef_128;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_256;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_BITREVIDX_FLT_256) && defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_512))
/**
@brief Initialization function for the 512pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_512_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 256U;
S->fftLenRFFT = 512U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_256_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable256;
Sint->pTwiddle = (float32_t *) twiddleCoef_256;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_512;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_BITREVIDX_FLT_512) && defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_1024))
/**
@brief Initialization function for the 1024pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_1024_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 512U;
S->fftLenRFFT = 1024U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_512_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable512;
Sint->pTwiddle = (float32_t *) twiddleCoef_512;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_1024;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_BITREVIDX_FLT_1024) && defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_2048))
/**
@brief Initialization function for the 2048pt floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_2048_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 1024U;
S->fftLenRFFT = 2048U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_1024_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable1024;
Sint->pTwiddle = (float32_t *) twiddleCoef_1024;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_2048;
return ARM_MATH_SUCCESS;
}
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_BITREVIDX_FLT_2048) && defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_4096))
/**
* @brief Initialization function for the 4096pt floating-point real FFT.
* @param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : an error is detected
*/
arm_status arm_rfft_4096_fast_init_f32( arm_rfft_fast_instance_f32 * S ) {
arm_cfft_instance_f32 * Sint;
if( !S ) return ARM_MATH_ARGUMENT_ERROR;
Sint = &(S->Sint);
Sint->fftLen = 2048U;
S->fftLenRFFT = 4096U;
Sint->bitRevLength = ARMBITREVINDEXTABLE_2048_TABLE_LENGTH;
Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable2048;
Sint->pTwiddle = (float32_t *) twiddleCoef_2048;
S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_4096;
return ARM_MATH_SUCCESS;
}
#endif
/**
@brief Initialization function for the floating-point real FFT.
@param[in,out] S points to an arm_rfft_fast_instance_f32 structure
@param[in] fftLen length of the Real Sequence
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Description
The parameter <code>fftLen</code> specifies the length of RFFT/CIFFT process.
Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_rfft_fast_init_f32(
arm_rfft_fast_instance_f32 * S,
uint16_t fftLen)
{
typedef arm_status(*fft_init_ptr)( arm_rfft_fast_instance_f32 *);
fft_init_ptr fptr = 0x0;
switch (fftLen)
{
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_BITREVIDX_FLT_2048) && defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_4096))
case 4096U:
fptr = arm_rfft_4096_fast_init_f32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_BITREVIDX_FLT_1024) && defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_2048))
case 2048U:
fptr = arm_rfft_2048_fast_init_f32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_BITREVIDX_FLT_512) && defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_1024))
case 1024U:
fptr = arm_rfft_1024_fast_init_f32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_BITREVIDX_FLT_256) && defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_512))
case 512U:
fptr = arm_rfft_512_fast_init_f32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_BITREVIDX_FLT_128) && defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_256))
case 256U:
fptr = arm_rfft_256_fast_init_f32;
break;
#endif
#if (defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_BITREVIDX_FLT_64) && defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_128))
case 128U:
fptr = arm_rfft_128_fast_init_f32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_BITREVIDX_FLT_32) && defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_64))
case 64U:
fptr = arm_rfft_64_fast_init_f32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_BITREVIDX_FLT_16) && defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_32))
case 32U:
fptr = arm_rfft_32_fast_init_f32;
break;
#endif
default:
return ARM_MATH_ARGUMENT_ERROR;
}
if( ! fptr ) return ARM_MATH_ARGUMENT_ERROR;
return fptr( S );
}
/**
@} end of RealFFT group
*/
| 13,311 | C | 37.585507 | 243 | 0.670949 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_dct4_init_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_dct4_init_q31.c
* Description: Initialization function of DCT-4 & IDCT4 Q31
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup DCT4_IDCT4
*/
/**
@addtogroup DCT4_IDCT4
@{
*/
/**
@brief Initialization function for the Q31 DCT4/IDCT4.
@param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
@param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
@param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
@param[in] N length of the DCT4.
@param[in] Nby2 half of the length of the DCT4.
@param[in] normalize normalizing factor.
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>N</code> is not a supported transform length
@par Normalizing factor:
The normalizing factor is <code>sqrt(2/N)</code>, which depends on the size of transform <code>N</code>.
Normalizing factors in 1.31 format are mentioned in the table below for different DCT sizes:
\image html dct4NormalizingQ31Table.gif
*/
arm_status arm_dct4_init_q31(
arm_dct4_instance_q31 * S,
arm_rfft_instance_q31 * S_RFFT,
arm_cfft_radix4_instance_q31 * S_CFFT,
uint16_t N,
uint16_t Nby2,
q31_t normalize)
{
/* Initialize the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialize the DCT4 length */
S->N = N;
/* Initialize the half of DCT4 length */
S->Nby2 = Nby2;
/* Initialize the DCT4 Normalizing factor */
S->normalize = normalize;
/* Initialize Real FFT Instance */
S->pRfft = S_RFFT;
/* Initialize Complex FFT Instance */
S->pCfft = S_CFFT;
switch (N)
{
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_8192)
/* Initialize the table modifier values */
case 8192U:
S->pTwiddle = WeightsQ31_8192;
S->pCosFactor = cos_factorsQ31_8192;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_2048)
case 2048U:
S->pTwiddle = WeightsQ31_2048;
S->pCosFactor = cos_factorsQ31_2048;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_512)
case 512U:
S->pTwiddle = WeightsQ31_512;
S->pCosFactor = cos_factorsQ31_512;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_128)
case 128U:
S->pTwiddle = WeightsQ31_128;
S->pCosFactor = cos_factorsQ31_128;
break;
#endif
default:
status = ARM_MATH_ARGUMENT_ERROR;
}
/* Initialize the RFFT/RIFFT Function */
arm_rfft_init_q31(S->pRfft, S->N, 0U, 1U);
/* return the status of DCT4 Init function */
return (status);
}
/**
@} end of DCT4_IDCT4 group
*/
| 3,928 | C | 28.992366 | 123 | 0.630855 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_f32.c
* Description: Combined Radix Decimation in Frequency CFFT Floating point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
extern void arm_radix8_butterfly_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier);
extern void arm_bitreversal_32(
uint32_t * pSrc,
const uint16_t bitRevLen,
const uint16_t * pBitRevTable);
/**
@ingroup groupTransforms
*/
/**
@defgroup ComplexFFT Complex FFT Functions
@par
The Fast Fourier Transform (FFT) is an efficient algorithm for computing the
Discrete Fourier Transform (DFT). The FFT can be orders of magnitude faster
than the DFT, especially for long lengths.
The algorithms described in this section
operate on complex data. A separate set of functions is devoted to handling
of real sequences.
@par
There are separate algorithms for handling floating-point, Q15, and Q31 data
types. The algorithms available for each data type are described next.
@par
The FFT functions operate in-place. That is, the array holding the input data
will also be used to hold the corresponding result. The input data is complex
and contains <code>2*fftLen</code> interleaved values as shown below.
<pre>{real[0], imag[0], real[1], imag[1], ...} </pre>
The FFT result will be contained in the same array and the frequency domain
values will have the same interleaving.
@par Floating-point
The floating-point complex FFT uses a mixed-radix algorithm. Multiple radix-8
stages are performed along with a single radix-2 or radix-4 stage, as needed.
The algorithm supports lengths of [16, 32, 64, ..., 4096] and each length uses
a different twiddle factor table.
@par
The function uses the standard FFT definition and output values may grow by a
factor of <code>fftLen</code> when computing the forward transform. The
inverse transform includes a scale of <code>1/fftLen</code> as part of the
calculation and this matches the textbook definition of the inverse FFT.
@par
Pre-initialized data structures containing twiddle factors and bit reversal
tables are provided and defined in <code>arm_const_structs.h</code>. Include
this header in your function and then pass one of the constant structures as
an argument to arm_cfft_f32. For example:
@par
<code>arm_cfft_f32(arm_cfft_sR_f32_len64, pSrc, 1, 1)</code>
@par
computes a 64-point inverse complex FFT including bit reversal.
The data structures are treated as constant data and not modified during the
calculation. The same data structure can be reused for multiple transforms
including mixing forward and inverse transforms.
@par
Earlier releases of the library provided separate radix-2 and radix-4
algorithms that operated on floating-point data. These functions are still
provided but are deprecated. The older functions are slower and less general
than the new functions.
@par
An example of initialization of the constants for the arm_cfft_f32 function follows:
@code
const static arm_cfft_instance_f32 *S;
...
switch (length) {
case 16:
S = &arm_cfft_sR_f32_len16;
break;
case 32:
S = &arm_cfft_sR_f32_len32;
break;
case 64:
S = &arm_cfft_sR_f32_len64;
break;
case 128:
S = &arm_cfft_sR_f32_len128;
break;
case 256:
S = &arm_cfft_sR_f32_len256;
break;
case 512:
S = &arm_cfft_sR_f32_len512;
break;
case 1024:
S = &arm_cfft_sR_f32_len1024;
break;
case 2048:
S = &arm_cfft_sR_f32_len2048;
break;
case 4096:
S = &arm_cfft_sR_f32_len4096;
break;
}
@endcode
@par Q15 and Q31
The floating-point complex FFT uses a mixed-radix algorithm. Multiple radix-4
stages are performed along with a single radix-2 stage, as needed.
The algorithm supports lengths of [16, 32, 64, ..., 4096] and each length uses
a different twiddle factor table.
@par
The function uses the standard FFT definition and output values may grow by a
factor of <code>fftLen</code> when computing the forward transform. The
inverse transform includes a scale of <code>1/fftLen</code> as part of the
calculation and this matches the textbook definition of the inverse FFT.
@par
Pre-initialized data structures containing twiddle factors and bit reversal
tables are provided and defined in <code>arm_const_structs.h</code>. Include
this header in your function and then pass one of the constant structures as
an argument to arm_cfft_q31. For example:
@par
<code>arm_cfft_q31(arm_cfft_sR_q31_len64, pSrc, 1, 1)</code>
@par
computes a 64-point inverse complex FFT including bit reversal.
The data structures are treated as constant data and not modified during the
calculation. The same data structure can be reused for multiple transforms
including mixing forward and inverse transforms.
@par
Earlier releases of the library provided separate radix-2 and radix-4
algorithms that operated on floating-point data. These functions are still
provided but are deprecated. The older functions are slower and less general
than the new functions.
@par
An example of initialization of the constants for the arm_cfft_q31 function follows:
@code
const static arm_cfft_instance_q31 *S;
...
switch (length) {
case 16:
S = &arm_cfft_sR_q31_len16;
break;
case 32:
S = &arm_cfft_sR_q31_len32;
break;
case 64:
S = &arm_cfft_sR_q31_len64;
break;
case 128:
S = &arm_cfft_sR_q31_len128;
break;
case 256:
S = &arm_cfft_sR_q31_len256;
break;
case 512:
S = &arm_cfft_sR_q31_len512;
break;
case 1024:
S = &arm_cfft_sR_q31_len1024;
break;
case 2048:
S = &arm_cfft_sR_q31_len2048;
break;
case 4096:
S = &arm_cfft_sR_q31_len4096;
break;
}
@endcode
*/
void arm_cfft_radix8by2_f32 (arm_cfft_instance_f32 * S, float32_t * p1)
{
uint32_t L = S->fftLen;
float32_t * pCol1, * pCol2, * pMid1, * pMid2;
float32_t * p2 = p1 + L;
const float32_t * tw = (float32_t *) S->pTwiddle;
float32_t t1[4], t2[4], t3[4], t4[4], twR, twI;
float32_t m0, m1, m2, m3;
uint32_t l;
pCol1 = p1;
pCol2 = p2;
/* Define new length */
L >>= 1;
/* Initialize mid pointers */
pMid1 = p1 + L;
pMid2 = p2 + L;
/* do two dot Fourier transform */
for (l = L >> 2; l > 0; l-- )
{
t1[0] = p1[0];
t1[1] = p1[1];
t1[2] = p1[2];
t1[3] = p1[3];
t2[0] = p2[0];
t2[1] = p2[1];
t2[2] = p2[2];
t2[3] = p2[3];
t3[0] = pMid1[0];
t3[1] = pMid1[1];
t3[2] = pMid1[2];
t3[3] = pMid1[3];
t4[0] = pMid2[0];
t4[1] = pMid2[1];
t4[2] = pMid2[2];
t4[3] = pMid2[3];
*p1++ = t1[0] + t2[0];
*p1++ = t1[1] + t2[1];
*p1++ = t1[2] + t2[2];
*p1++ = t1[3] + t2[3]; /* col 1 */
t2[0] = t1[0] - t2[0];
t2[1] = t1[1] - t2[1];
t2[2] = t1[2] - t2[2];
t2[3] = t1[3] - t2[3]; /* for col 2 */
*pMid1++ = t3[0] + t4[0];
*pMid1++ = t3[1] + t4[1];
*pMid1++ = t3[2] + t4[2];
*pMid1++ = t3[3] + t4[3]; /* col 1 */
t4[0] = t4[0] - t3[0];
t4[1] = t4[1] - t3[1];
t4[2] = t4[2] - t3[2];
t4[3] = t4[3] - t3[3]; /* for col 2 */
twR = *tw++;
twI = *tw++;
/* multiply by twiddle factors */
m0 = t2[0] * twR;
m1 = t2[1] * twI;
m2 = t2[1] * twR;
m3 = t2[0] * twI;
/* R = R * Tr - I * Ti */
*p2++ = m0 + m1;
/* I = I * Tr + R * Ti */
*p2++ = m2 - m3;
/* use vertical symmetry */
/* 0.9988 - 0.0491i <==> -0.0491 - 0.9988i */
m0 = t4[0] * twI;
m1 = t4[1] * twR;
m2 = t4[1] * twI;
m3 = t4[0] * twR;
*pMid2++ = m0 - m1;
*pMid2++ = m2 + m3;
twR = *tw++;
twI = *tw++;
m0 = t2[2] * twR;
m1 = t2[3] * twI;
m2 = t2[3] * twR;
m3 = t2[2] * twI;
*p2++ = m0 + m1;
*p2++ = m2 - m3;
m0 = t4[2] * twI;
m1 = t4[3] * twR;
m2 = t4[3] * twI;
m3 = t4[2] * twR;
*pMid2++ = m0 - m1;
*pMid2++ = m2 + m3;
}
/* first col */
arm_radix8_butterfly_f32 (pCol1, L, (float32_t *) S->pTwiddle, 2U);
/* second col */
arm_radix8_butterfly_f32 (pCol2, L, (float32_t *) S->pTwiddle, 2U);
}
void arm_cfft_radix8by4_f32 (arm_cfft_instance_f32 * S, float32_t * p1)
{
uint32_t L = S->fftLen >> 1;
float32_t * pCol1, *pCol2, *pCol3, *pCol4, *pEnd1, *pEnd2, *pEnd3, *pEnd4;
const float32_t *tw2, *tw3, *tw4;
float32_t * p2 = p1 + L;
float32_t * p3 = p2 + L;
float32_t * p4 = p3 + L;
float32_t t2[4], t3[4], t4[4], twR, twI;
float32_t p1ap3_0, p1sp3_0, p1ap3_1, p1sp3_1;
float32_t m0, m1, m2, m3;
uint32_t l, twMod2, twMod3, twMod4;
pCol1 = p1; /* points to real values by default */
pCol2 = p2;
pCol3 = p3;
pCol4 = p4;
pEnd1 = p2 - 1; /* points to imaginary values by default */
pEnd2 = p3 - 1;
pEnd3 = p4 - 1;
pEnd4 = pEnd3 + L;
tw2 = tw3 = tw4 = (float32_t *) S->pTwiddle;
L >>= 1;
/* do four dot Fourier transform */
twMod2 = 2;
twMod3 = 4;
twMod4 = 6;
/* TOP */
p1ap3_0 = p1[0] + p3[0];
p1sp3_0 = p1[0] - p3[0];
p1ap3_1 = p1[1] + p3[1];
p1sp3_1 = p1[1] - p3[1];
/* col 2 */
t2[0] = p1sp3_0 + p2[1] - p4[1];
t2[1] = p1sp3_1 - p2[0] + p4[0];
/* col 3 */
t3[0] = p1ap3_0 - p2[0] - p4[0];
t3[1] = p1ap3_1 - p2[1] - p4[1];
/* col 4 */
t4[0] = p1sp3_0 - p2[1] + p4[1];
t4[1] = p1sp3_1 + p2[0] - p4[0];
/* col 1 */
*p1++ = p1ap3_0 + p2[0] + p4[0];
*p1++ = p1ap3_1 + p2[1] + p4[1];
/* Twiddle factors are ones */
*p2++ = t2[0];
*p2++ = t2[1];
*p3++ = t3[0];
*p3++ = t3[1];
*p4++ = t4[0];
*p4++ = t4[1];
tw2 += twMod2;
tw3 += twMod3;
tw4 += twMod4;
for (l = (L - 2) >> 1; l > 0; l-- )
{
/* TOP */
p1ap3_0 = p1[0] + p3[0];
p1sp3_0 = p1[0] - p3[0];
p1ap3_1 = p1[1] + p3[1];
p1sp3_1 = p1[1] - p3[1];
/* col 2 */
t2[0] = p1sp3_0 + p2[1] - p4[1];
t2[1] = p1sp3_1 - p2[0] + p4[0];
/* col 3 */
t3[0] = p1ap3_0 - p2[0] - p4[0];
t3[1] = p1ap3_1 - p2[1] - p4[1];
/* col 4 */
t4[0] = p1sp3_0 - p2[1] + p4[1];
t4[1] = p1sp3_1 + p2[0] - p4[0];
/* col 1 - top */
*p1++ = p1ap3_0 + p2[0] + p4[0];
*p1++ = p1ap3_1 + p2[1] + p4[1];
/* BOTTOM */
p1ap3_1 = pEnd1[-1] + pEnd3[-1];
p1sp3_1 = pEnd1[-1] - pEnd3[-1];
p1ap3_0 = pEnd1[ 0] + pEnd3[0];
p1sp3_0 = pEnd1[ 0] - pEnd3[0];
/* col 2 */
t2[2] = pEnd2[0] - pEnd4[0] + p1sp3_1;
t2[3] = pEnd1[0] - pEnd3[0] - pEnd2[-1] + pEnd4[-1];
/* col 3 */
t3[2] = p1ap3_1 - pEnd2[-1] - pEnd4[-1];
t3[3] = p1ap3_0 - pEnd2[ 0] - pEnd4[ 0];
/* col 4 */
t4[2] = pEnd2[ 0] - pEnd4[ 0] - p1sp3_1;
t4[3] = pEnd4[-1] - pEnd2[-1] - p1sp3_0;
/* col 1 - Bottom */
*pEnd1-- = p1ap3_0 + pEnd2[ 0] + pEnd4[ 0];
*pEnd1-- = p1ap3_1 + pEnd2[-1] + pEnd4[-1];
/* COL 2 */
/* read twiddle factors */
twR = *tw2++;
twI = *tw2++;
/* multiply by twiddle factors */
/* let Z1 = a + i(b), Z2 = c + i(d) */
/* => Z1 * Z2 = (a*c - b*d) + i(b*c + a*d) */
/* Top */
m0 = t2[0] * twR;
m1 = t2[1] * twI;
m2 = t2[1] * twR;
m3 = t2[0] * twI;
*p2++ = m0 + m1;
*p2++ = m2 - m3;
/* use vertical symmetry col 2 */
/* 0.9997 - 0.0245i <==> 0.0245 - 0.9997i */
/* Bottom */
m0 = t2[3] * twI;
m1 = t2[2] * twR;
m2 = t2[2] * twI;
m3 = t2[3] * twR;
*pEnd2-- = m0 - m1;
*pEnd2-- = m2 + m3;
/* COL 3 */
twR = tw3[0];
twI = tw3[1];
tw3 += twMod3;
/* Top */
m0 = t3[0] * twR;
m1 = t3[1] * twI;
m2 = t3[1] * twR;
m3 = t3[0] * twI;
*p3++ = m0 + m1;
*p3++ = m2 - m3;
/* use vertical symmetry col 3 */
/* 0.9988 - 0.0491i <==> -0.9988 - 0.0491i */
/* Bottom */
m0 = -t3[3] * twR;
m1 = t3[2] * twI;
m2 = t3[2] * twR;
m3 = t3[3] * twI;
*pEnd3-- = m0 - m1;
*pEnd3-- = m3 - m2;
/* COL 4 */
twR = tw4[0];
twI = tw4[1];
tw4 += twMod4;
/* Top */
m0 = t4[0] * twR;
m1 = t4[1] * twI;
m2 = t4[1] * twR;
m3 = t4[0] * twI;
*p4++ = m0 + m1;
*p4++ = m2 - m3;
/* use vertical symmetry col 4 */
/* 0.9973 - 0.0736i <==> -0.0736 + 0.9973i */
/* Bottom */
m0 = t4[3] * twI;
m1 = t4[2] * twR;
m2 = t4[2] * twI;
m3 = t4[3] * twR;
*pEnd4-- = m0 - m1;
*pEnd4-- = m2 + m3;
}
/* MIDDLE */
/* Twiddle factors are */
/* 1.0000 0.7071-0.7071i -1.0000i -0.7071-0.7071i */
p1ap3_0 = p1[0] + p3[0];
p1sp3_0 = p1[0] - p3[0];
p1ap3_1 = p1[1] + p3[1];
p1sp3_1 = p1[1] - p3[1];
/* col 2 */
t2[0] = p1sp3_0 + p2[1] - p4[1];
t2[1] = p1sp3_1 - p2[0] + p4[0];
/* col 3 */
t3[0] = p1ap3_0 - p2[0] - p4[0];
t3[1] = p1ap3_1 - p2[1] - p4[1];
/* col 4 */
t4[0] = p1sp3_0 - p2[1] + p4[1];
t4[1] = p1sp3_1 + p2[0] - p4[0];
/* col 1 - Top */
*p1++ = p1ap3_0 + p2[0] + p4[0];
*p1++ = p1ap3_1 + p2[1] + p4[1];
/* COL 2 */
twR = tw2[0];
twI = tw2[1];
m0 = t2[0] * twR;
m1 = t2[1] * twI;
m2 = t2[1] * twR;
m3 = t2[0] * twI;
*p2++ = m0 + m1;
*p2++ = m2 - m3;
/* COL 3 */
twR = tw3[0];
twI = tw3[1];
m0 = t3[0] * twR;
m1 = t3[1] * twI;
m2 = t3[1] * twR;
m3 = t3[0] * twI;
*p3++ = m0 + m1;
*p3++ = m2 - m3;
/* COL 4 */
twR = tw4[0];
twI = tw4[1];
m0 = t4[0] * twR;
m1 = t4[1] * twI;
m2 = t4[1] * twR;
m3 = t4[0] * twI;
*p4++ = m0 + m1;
*p4++ = m2 - m3;
/* first col */
arm_radix8_butterfly_f32 (pCol1, L, (float32_t *) S->pTwiddle, 4U);
/* second col */
arm_radix8_butterfly_f32 (pCol2, L, (float32_t *) S->pTwiddle, 4U);
/* third col */
arm_radix8_butterfly_f32 (pCol3, L, (float32_t *) S->pTwiddle, 4U);
/* fourth col */
arm_radix8_butterfly_f32 (pCol4, L, (float32_t *) S->pTwiddle, 4U);
}
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Processing function for the floating-point complex FFT.
@param[in] S points to an instance of the floating-point CFFT structure
@param[in,out] p1 points to the complex data buffer of size <code>2*fftLen</code>. Processing occurs in-place
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return none
*/
void arm_cfft_f32(
const arm_cfft_instance_f32 * S,
float32_t * p1,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
uint32_t L = S->fftLen, l;
float32_t invL, * pSrc;
if (ifftFlag == 1U)
{
/* Conjugate input data */
pSrc = p1 + 1;
for (l = 0; l < L; l++)
{
*pSrc = -*pSrc;
pSrc += 2;
}
}
switch (L)
{
case 16:
case 128:
case 1024:
arm_cfft_radix8by2_f32 ( (arm_cfft_instance_f32 *) S, p1);
break;
case 32:
case 256:
case 2048:
arm_cfft_radix8by4_f32 ( (arm_cfft_instance_f32 *) S, p1);
break;
case 64:
case 512:
case 4096:
arm_radix8_butterfly_f32 ( p1, L, (float32_t *) S->pTwiddle, 1);
break;
}
if ( bitReverseFlag )
arm_bitreversal_32 ((uint32_t*) p1, S->bitRevLength, S->pBitRevTable);
if (ifftFlag == 1U)
{
invL = 1.0f / (float32_t)L;
/* Conjugate and scale output data */
pSrc = p1;
for (l= 0; l < L; l++)
{
*pSrc++ *= invL ;
*pSrc = -(*pSrc) * invL;
pSrc++;
}
}
}
/**
@} end of ComplexFFT group
*/
| 19,277 | C | 29.6 | 123 | 0.477201 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_init_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix4_init_q31.c
* Description: Radix-4 Decimation in Frequency Q31 FFT & IFFT initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
/**
@ingroup groupTransforms
*/
/**
@addtogroup ComplexFFT
@{
*/
/**
@brief Initialization function for the Q31 CFFT/CIFFT.
@deprecated Do not use this function. It has been superseded by \ref arm_cfft_q31 and will be removed in the future.
@param[in,out] S points to an instance of the Q31 CFFT/CIFFT structure.
@param[in] fftLen length of the FFT.
@param[in] ifftFlag flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLen</code> is not a supported length
@par Details
The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
@par
This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
*/
arm_status arm_cfft_radix4_init_q31(
arm_cfft_radix4_instance_q31 * S,
uint16_t fftLen,
uint8_t ifftFlag,
uint8_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialise the FFT length */
S->fftLen = fftLen;
/* Initialise the Twiddle coefficient pointer */
S->pTwiddle = (q31_t *) twiddleCoef_4096_q31;
/* Initialise the Flag for selection of CFFT or CIFFT */
S->ifftFlag = ifftFlag;
/* Initialise the Flag for calculation Bit reversal or not */
S->bitReverseFlag = bitReverseFlag;
/* Initializations of Instance structure depending on the FFT length */
switch (S->fftLen)
{
/* Initializations of structure parameters for 4096 point FFT */
case 4096U:
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 1U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 1U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) armBitRevTable;
break;
/* Initializations of structure parameters for 1024 point FFT */
case 1024U:
/* Initialise the twiddle coef modifier value */
S->twidCoefModifier = 4U;
/* Initialise the bit reversal table modifier */
S->bitRevFactor = 4U;
/* Initialise the bit reversal table pointer */
S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
break;
case 256U:
/* Initializations of structure parameters for 256 point FFT */
S->twidCoefModifier = 16U;
S->bitRevFactor = 16U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
break;
case 64U:
/* Initializations of structure parameters for 64 point FFT */
S->twidCoefModifier = 64U;
S->bitRevFactor = 64U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
break;
case 16U:
/* Initializations of structure parameters for 16 point FFT */
S->twidCoefModifier = 256U;
S->bitRevFactor = 256U;
S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
break;
default:
/* Reporting argument error if fftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
return (status);
}
/**
@} end of ComplexFFT group
*/
| 5,102 | C | 34.936619 | 137 | 0.641709 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_rfft_init_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_rfft_init_q15.c
* Description: RFFT & RIFFT Q15 initialisation function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
#include "arm_common_tables.h"
#include "arm_const_structs.h"
/**
@addtogroup RealFFT
@{
*/
/**
@brief Initialization function for the Q15 RFFT/RIFFT.
@param[in,out] S points to an instance of the Q15 RFFT/RIFFT structure
@param[in] fftLenReal length of the FFT
@param[in] ifftFlagR flag that selects transform direction
- value = 0: forward transform
- value = 1: inverse transform
@param[in] bitReverseFlag flag that enables / disables bit reversal of output
- value = 0: disables bit reversal of output
- value = 1: enables bit reversal of output
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_ARGUMENT_ERROR : <code>fftLenReal</code> is not a supported length
@par Details
The parameter <code>fftLenReal</code> specifies length of RFFT/RIFFT Process.
Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.
@par
The parameter <code>ifftFlagR</code> controls whether a forward or inverse transform is computed.
Set(=1) ifftFlagR to calculate RIFFT, otherwise RFFT is calculated.
@par
The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
@par
This function also initializes Twiddle factor table.
*/
arm_status arm_rfft_init_q15(
arm_rfft_instance_q15 * S,
uint32_t fftLenReal,
uint32_t ifftFlagR,
uint32_t bitReverseFlag)
{
/* Initialise the default arm status */
arm_status status = ARM_MATH_SUCCESS;
/* Initialize the Real FFT length */
S->fftLenReal = (uint16_t) fftLenReal;
/* Initialize the Twiddle coefficientA pointer */
S->pTwiddleAReal = (q15_t *) realCoefAQ15;
/* Initialize the Twiddle coefficientB pointer */
S->pTwiddleBReal = (q15_t *) realCoefBQ15;
/* Initialize the Flag for selection of RFFT or RIFFT */
S->ifftFlagR = (uint8_t) ifftFlagR;
/* Initialize the Flag for calculation Bit reversal or not */
S->bitReverseFlagR = (uint8_t) bitReverseFlag;
/* Initialization of coef modifier depending on the FFT length */
switch (S->fftLenReal)
{
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_4096) && defined(ARM_TABLE_BITREVIDX_FXT_4096))
case 8192U:
S->twidCoefRModifier = 1U;
S->pCfft = &arm_cfft_sR_q15_len4096;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_2048) && defined(ARM_TABLE_BITREVIDX_FXT_2048))
case 4096U:
S->twidCoefRModifier = 2U;
S->pCfft = &arm_cfft_sR_q15_len2048;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_1024) && defined(ARM_TABLE_BITREVIDX_FXT_1024))
case 2048U:
S->twidCoefRModifier = 4U;
S->pCfft = &arm_cfft_sR_q15_len1024;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_512) && defined(ARM_TABLE_BITREVIDX_FXT_512))
case 1024U:
S->twidCoefRModifier = 8U;
S->pCfft = &arm_cfft_sR_q15_len512;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_256) && defined(ARM_TABLE_BITREVIDX_FXT_256))
case 512U:
S->twidCoefRModifier = 16U;
S->pCfft = &arm_cfft_sR_q15_len256;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_128) && defined(ARM_TABLE_BITREVIDX_FXT_128))
case 256U:
S->twidCoefRModifier = 32U;
S->pCfft = &arm_cfft_sR_q15_len128;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_64) && defined(ARM_TABLE_BITREVIDX_FXT_64))
case 128U:
S->twidCoefRModifier = 64U;
S->pCfft = &arm_cfft_sR_q15_len64;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_32) && defined(ARM_TABLE_BITREVIDX_FXT_32))
case 64U:
S->twidCoefRModifier = 128U;
S->pCfft = &arm_cfft_sR_q15_len32;
break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_Q15_16) && defined(ARM_TABLE_BITREVIDX_FXT_16))
case 32U:
S->twidCoefRModifier = 256U;
S->pCfft = &arm_cfft_sR_q15_len16;
break;
#endif
default:
/* Reporting argument error if rfftSize is not valid value */
status = ARM_MATH_ARGUMENT_ERROR;
break;
}
/* return the status of RFFT Init function */
return (status);
}
/**
@} end of RealFFT group
*/
| 6,246 | C | 38.289308 | 152 | 0.631924 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix8_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cfft_radix8_f32.c
* Description: Radix-8 Decimation in Frequency CFFT & CIFFT Floating point processing function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/* ----------------------------------------------------------------------
* Internal helper function used by the FFTs
* -------------------------------------------------------------------- */
/**
brief Core function for the floating-point CFFT butterfly process.
param[in,out] pSrc points to the in-place buffer of floating-point data type.
param[in] fftLen length of the FFT.
param[in] pCoef points to the twiddle coefficient buffer.
param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
return none
*/
void arm_radix8_butterfly_f32(
float32_t * pSrc,
uint16_t fftLen,
const float32_t * pCoef,
uint16_t twidCoefModifier)
{
uint32_t ia1, ia2, ia3, ia4, ia5, ia6, ia7;
uint32_t i1, i2, i3, i4, i5, i6, i7, i8;
uint32_t id;
uint32_t n1, n2, j;
float32_t r1, r2, r3, r4, r5, r6, r7, r8;
float32_t t1, t2;
float32_t s1, s2, s3, s4, s5, s6, s7, s8;
float32_t p1, p2, p3, p4;
float32_t co2, co3, co4, co5, co6, co7, co8;
float32_t si2, si3, si4, si5, si6, si7, si8;
const float32_t C81 = 0.70710678118f;
n2 = fftLen;
do
{
n1 = n2;
n2 = n2 >> 3;
i1 = 0;
do
{
i2 = i1 + n2;
i3 = i2 + n2;
i4 = i3 + n2;
i5 = i4 + n2;
i6 = i5 + n2;
i7 = i6 + n2;
i8 = i7 + n2;
r1 = pSrc[2 * i1] + pSrc[2 * i5];
r5 = pSrc[2 * i1] - pSrc[2 * i5];
r2 = pSrc[2 * i2] + pSrc[2 * i6];
r6 = pSrc[2 * i2] - pSrc[2 * i6];
r3 = pSrc[2 * i3] + pSrc[2 * i7];
r7 = pSrc[2 * i3] - pSrc[2 * i7];
r4 = pSrc[2 * i4] + pSrc[2 * i8];
r8 = pSrc[2 * i4] - pSrc[2 * i8];
t1 = r1 - r3;
r1 = r1 + r3;
r3 = r2 - r4;
r2 = r2 + r4;
pSrc[2 * i1] = r1 + r2;
pSrc[2 * i5] = r1 - r2;
r1 = pSrc[2 * i1 + 1] + pSrc[2 * i5 + 1];
s5 = pSrc[2 * i1 + 1] - pSrc[2 * i5 + 1];
r2 = pSrc[2 * i2 + 1] + pSrc[2 * i6 + 1];
s6 = pSrc[2 * i2 + 1] - pSrc[2 * i6 + 1];
s3 = pSrc[2 * i3 + 1] + pSrc[2 * i7 + 1];
s7 = pSrc[2 * i3 + 1] - pSrc[2 * i7 + 1];
r4 = pSrc[2 * i4 + 1] + pSrc[2 * i8 + 1];
s8 = pSrc[2 * i4 + 1] - pSrc[2 * i8 + 1];
t2 = r1 - s3;
r1 = r1 + s3;
s3 = r2 - r4;
r2 = r2 + r4;
pSrc[2 * i1 + 1] = r1 + r2;
pSrc[2 * i5 + 1] = r1 - r2;
pSrc[2 * i3] = t1 + s3;
pSrc[2 * i7] = t1 - s3;
pSrc[2 * i3 + 1] = t2 - r3;
pSrc[2 * i7 + 1] = t2 + r3;
r1 = (r6 - r8) * C81;
r6 = (r6 + r8) * C81;
r2 = (s6 - s8) * C81;
s6 = (s6 + s8) * C81;
t1 = r5 - r1;
r5 = r5 + r1;
r8 = r7 - r6;
r7 = r7 + r6;
t2 = s5 - r2;
s5 = s5 + r2;
s8 = s7 - s6;
s7 = s7 + s6;
pSrc[2 * i2] = r5 + s7;
pSrc[2 * i8] = r5 - s7;
pSrc[2 * i6] = t1 + s8;
pSrc[2 * i4] = t1 - s8;
pSrc[2 * i2 + 1] = s5 - r7;
pSrc[2 * i8 + 1] = s5 + r7;
pSrc[2 * i6 + 1] = t2 - r8;
pSrc[2 * i4 + 1] = t2 + r8;
i1 += n1;
} while (i1 < fftLen);
if (n2 < 8)
break;
ia1 = 0;
j = 1;
do
{
/* index calculation for the coefficients */
id = ia1 + twidCoefModifier;
ia1 = id;
ia2 = ia1 + id;
ia3 = ia2 + id;
ia4 = ia3 + id;
ia5 = ia4 + id;
ia6 = ia5 + id;
ia7 = ia6 + id;
co2 = pCoef[2 * ia1];
co3 = pCoef[2 * ia2];
co4 = pCoef[2 * ia3];
co5 = pCoef[2 * ia4];
co6 = pCoef[2 * ia5];
co7 = pCoef[2 * ia6];
co8 = pCoef[2 * ia7];
si2 = pCoef[2 * ia1 + 1];
si3 = pCoef[2 * ia2 + 1];
si4 = pCoef[2 * ia3 + 1];
si5 = pCoef[2 * ia4 + 1];
si6 = pCoef[2 * ia5 + 1];
si7 = pCoef[2 * ia6 + 1];
si8 = pCoef[2 * ia7 + 1];
i1 = j;
do
{
/* index calculation for the input */
i2 = i1 + n2;
i3 = i2 + n2;
i4 = i3 + n2;
i5 = i4 + n2;
i6 = i5 + n2;
i7 = i6 + n2;
i8 = i7 + n2;
r1 = pSrc[2 * i1] + pSrc[2 * i5];
r5 = pSrc[2 * i1] - pSrc[2 * i5];
r2 = pSrc[2 * i2] + pSrc[2 * i6];
r6 = pSrc[2 * i2] - pSrc[2 * i6];
r3 = pSrc[2 * i3] + pSrc[2 * i7];
r7 = pSrc[2 * i3] - pSrc[2 * i7];
r4 = pSrc[2 * i4] + pSrc[2 * i8];
r8 = pSrc[2 * i4] - pSrc[2 * i8];
t1 = r1 - r3;
r1 = r1 + r3;
r3 = r2 - r4;
r2 = r2 + r4;
pSrc[2 * i1] = r1 + r2;
r2 = r1 - r2;
s1 = pSrc[2 * i1 + 1] + pSrc[2 * i5 + 1];
s5 = pSrc[2 * i1 + 1] - pSrc[2 * i5 + 1];
s2 = pSrc[2 * i2 + 1] + pSrc[2 * i6 + 1];
s6 = pSrc[2 * i2 + 1] - pSrc[2 * i6 + 1];
s3 = pSrc[2 * i3 + 1] + pSrc[2 * i7 + 1];
s7 = pSrc[2 * i3 + 1] - pSrc[2 * i7 + 1];
s4 = pSrc[2 * i4 + 1] + pSrc[2 * i8 + 1];
s8 = pSrc[2 * i4 + 1] - pSrc[2 * i8 + 1];
t2 = s1 - s3;
s1 = s1 + s3;
s3 = s2 - s4;
s2 = s2 + s4;
r1 = t1 + s3;
t1 = t1 - s3;
pSrc[2 * i1 + 1] = s1 + s2;
s2 = s1 - s2;
s1 = t2 - r3;
t2 = t2 + r3;
p1 = co5 * r2;
p2 = si5 * s2;
p3 = co5 * s2;
p4 = si5 * r2;
pSrc[2 * i5] = p1 + p2;
pSrc[2 * i5 + 1] = p3 - p4;
p1 = co3 * r1;
p2 = si3 * s1;
p3 = co3 * s1;
p4 = si3 * r1;
pSrc[2 * i3] = p1 + p2;
pSrc[2 * i3 + 1] = p3 - p4;
p1 = co7 * t1;
p2 = si7 * t2;
p3 = co7 * t2;
p4 = si7 * t1;
pSrc[2 * i7] = p1 + p2;
pSrc[2 * i7 + 1] = p3 - p4;
r1 = (r6 - r8) * C81;
r6 = (r6 + r8) * C81;
s1 = (s6 - s8) * C81;
s6 = (s6 + s8) * C81;
t1 = r5 - r1;
r5 = r5 + r1;
r8 = r7 - r6;
r7 = r7 + r6;
t2 = s5 - s1;
s5 = s5 + s1;
s8 = s7 - s6;
s7 = s7 + s6;
r1 = r5 + s7;
r5 = r5 - s7;
r6 = t1 + s8;
t1 = t1 - s8;
s1 = s5 - r7;
s5 = s5 + r7;
s6 = t2 - r8;
t2 = t2 + r8;
p1 = co2 * r1;
p2 = si2 * s1;
p3 = co2 * s1;
p4 = si2 * r1;
pSrc[2 * i2] = p1 + p2;
pSrc[2 * i2 + 1] = p3 - p4;
p1 = co8 * r5;
p2 = si8 * s5;
p3 = co8 * s5;
p4 = si8 * r5;
pSrc[2 * i8] = p1 + p2;
pSrc[2 * i8 + 1] = p3 - p4;
p1 = co6 * r6;
p2 = si6 * s6;
p3 = co6 * s6;
p4 = si6 * r6;
pSrc[2 * i6] = p1 + p2;
pSrc[2 * i6 + 1] = p3 - p4;
p1 = co4 * t1;
p2 = si4 * t2;
p3 = co4 * t2;
p4 = si4 * t1;
pSrc[2 * i4] = p1 + p2;
pSrc[2 * i4 + 1] = p3 - p4;
i1 += n1;
} while (i1 < fftLen);
j++;
} while (j < n2);
twidCoefModifier <<= 3;
} while (n2 > 7);
}
| 8,775 | C | 29.685315 | 131 | 0.379031 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_conj_q31.c
* Description: Q31 complex conjugate
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_conj
@{
*/
/**
@brief Q31 complex conjugate.
@param[in] pSrc points to the input vector
@param[out] pDst points to the output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function uses saturating arithmetic.
The Q31 value -1 (0x80000000) is saturated to the maximum allowable positive value 0x7FFFFFFF.
*/
void arm_cmplx_conj_q31(
const q31_t * pSrc,
q31_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q31_t in; /* Temporary input variable */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] + jC[1] = A[0]+ j(-1)A[1] */
/* Calculate Complex Conjugate and store result in destination buffer. */
*pDst++ = *pSrc++;
in = *pSrc++;
#if defined (ARM_MATH_DSP)
*pDst++ = __QSUB(0, in);
#else
*pDst++ = (in == INT32_MIN) ? INT32_MAX : -in;
#endif
*pDst++ = *pSrc++;
in = *pSrc++;
#if defined (ARM_MATH_DSP)
*pDst++ = __QSUB(0, in);
#else
*pDst++ = (in == INT32_MIN) ? INT32_MAX : -in;
#endif
*pDst++ = *pSrc++;
in = *pSrc++;
#if defined (ARM_MATH_DSP)
*pDst++ = __QSUB(0, in);
#else
*pDst++ = (in == INT32_MIN) ? INT32_MAX : -in;
#endif
*pDst++ = *pSrc++;
in = *pSrc++;
#if defined (ARM_MATH_DSP)
*pDst++ = __QSUB(0, in);
#else
*pDst++ = (in == INT32_MIN) ? INT32_MAX : -in;
#endif
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[0] + jC[1] = A[0]+ j(-1)A[1] */
/* Calculate Complex Conjugate and store result in destination buffer. */
*pDst++ = *pSrc++;
in = *pSrc++;
#if defined (ARM_MATH_DSP)
*pDst++ = __QSUB(0, in);
#else
*pDst++ = (in == INT32_MIN) ? INT32_MAX : -in;
#endif
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_conj group
*/
| 3,435 | C | 23.898551 | 113 | 0.558952 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_conj_q15.c
* Description: Q15 complex conjugate
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_conj
@{
*/
/**
@brief Q15 complex conjugate.
@param[in] pSrc points to the input vector
@param[out] pDst points to the output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function uses saturating arithmetic.
The Q15 value -1 (0x8000) is saturated to the maximum allowable positive value 0x7FFF.
*/
void arm_cmplx_conj_q15(
const q15_t * pSrc,
q15_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q31_t in1; /* Temporary input variable */
#if defined (ARM_MATH_LOOPUNROLL) && defined (ARM_MATH_DSP)
q31_t in2, in3, in4; /* Temporary input variables */
#endif
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] + jC[1] = A[0]+ j(-1)A[1] */
/* Calculate Complex Conjugate and store result in destination buffer. */
#if defined (ARM_MATH_DSP)
in1 = read_q15x2_ia ((q15_t **) &pSrc);
in2 = read_q15x2_ia ((q15_t **) &pSrc);
in3 = read_q15x2_ia ((q15_t **) &pSrc);
in4 = read_q15x2_ia ((q15_t **) &pSrc);
#ifndef ARM_MATH_BIG_ENDIAN
in1 = __QASX(0, in1);
in2 = __QASX(0, in2);
in3 = __QASX(0, in3);
in4 = __QASX(0, in4);
#else
in1 = __QSAX(0, in1);
in2 = __QSAX(0, in2);
in3 = __QSAX(0, in3);
in4 = __QSAX(0, in4);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
in1 = ((uint32_t) in1 >> 16) | ((uint32_t) in1 << 16);
in2 = ((uint32_t) in2 >> 16) | ((uint32_t) in2 << 16);
in3 = ((uint32_t) in3 >> 16) | ((uint32_t) in3 << 16);
in4 = ((uint32_t) in4 >> 16) | ((uint32_t) in4 << 16);
write_q15x2_ia (&pDst, in1);
write_q15x2_ia (&pDst, in2);
write_q15x2_ia (&pDst, in3);
write_q15x2_ia (&pDst, in4);
#else
*pDst++ = *pSrc++;
in1 = *pSrc++;
*pDst++ = (in1 == (q15_t) 0x8000) ? (q15_t) 0x7fff : -in1;
*pDst++ = *pSrc++;
in1 = *pSrc++;
*pDst++ = (in1 == (q15_t) 0x8000) ? (q15_t) 0x7fff : -in1;
*pDst++ = *pSrc++;
in1 = *pSrc++;
*pDst++ = (in1 == (q15_t) 0x8000) ? (q15_t) 0x7fff : -in1;
*pDst++ = *pSrc++;
in1 = *pSrc++;
*pDst++ = (in1 == (q15_t) 0x8000) ? (q15_t) 0x7fff : -in1;
#endif /* #if defined (ARM_MATH_DSP) */
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[0] + jC[1] = A[0]+ j(-1)A[1] */
/* Calculate Complex Conjugate and store result in destination buffer. */
*pDst++ = *pSrc++;
in1 = *pSrc++;
#if defined (ARM_MATH_DSP)
*pDst++ = __SSAT(-in1, 16);
#else
*pDst++ = (in1 == (q15_t) 0x8000) ? (q15_t) 0x7fff : -in1;
#endif
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_conj group
*/
| 4,283 | C | 26.113924 | 105 | 0.545879 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mag_q15.c
* Description: Q15 complex magnitude
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_mag
@{
*/
/**
@brief Q15 complex magnitude.
@param[in] pSrc points to input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function implements 1.15 by 1.15 multiplications and finally output is converted into 2.14 format.
*/
void arm_cmplx_mag_q15(
const q15_t * pSrc,
q15_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
#if defined (ARM_MATH_DSP)
q31_t in;
q31_t acc0; /* Accumulators */
#else
q15_t real, imag; /* Temporary input variables */
q31_t acc0, acc1; /* Accumulators */
#endif
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
#if defined (ARM_MATH_DSP)
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
/* store result in 2.14 format in destination buffer. */
arm_sqrt_q15((q15_t) (acc0 >> 17), pDst++);
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
arm_sqrt_q15((q15_t) (acc0 >> 17), pDst++);
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
arm_sqrt_q15((q15_t) (acc0 >> 17), pDst++);
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
arm_sqrt_q15((q15_t) (acc0 >> 17), pDst++);
#else
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
/* store result in 2.14 format in destination buffer. */
arm_sqrt_q15((q15_t) (((q63_t) acc0 + acc1) >> 17), pDst++);
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
arm_sqrt_q15((q15_t) (((q63_t) acc0 + acc1) >> 17), pDst++);
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
arm_sqrt_q15((q15_t) (((q63_t) acc0 + acc1) >> 17), pDst++);
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
arm_sqrt_q15((q15_t) (((q63_t) acc0 + acc1) >> 17), pDst++);
#endif /* #if defined (ARM_MATH_DSP) */
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
#if defined (ARM_MATH_DSP)
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
/* store result in 2.14 format in destination buffer. */
arm_sqrt_q15((q15_t) (acc0 >> 17), pDst++);
#else
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
/* store result in 2.14 format in destination buffer. */
arm_sqrt_q15((q15_t) (((q63_t) acc0 + acc1) >> 17), pDst++);
#endif
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_mag group
*/
| 4,449 | C | 26.300613 | 121 | 0.539672 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mult_real_f32.c
* Description: Floating-point complex by real multiplication
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@defgroup CmplxByRealMult Complex-by-Real Multiplication
Multiplies a complex vector by a real vector and generates a complex result.
The data in the complex arrays is stored in an interleaved fashion
(real, imag, real, imag, ...).
The parameter <code>numSamples</code> represents the number of complex
samples processed. The complex arrays have a total of <code>2*numSamples</code>
real values while the real array has a total of <code>numSamples</code>
real values.
The underlying algorithm is used:
<pre>
for (n = 0; n < numSamples; n++) {
pCmplxDst[(2*n)+0] = pSrcCmplx[(2*n)+0] * pSrcReal[n];
pCmplxDst[(2*n)+1] = pSrcCmplx[(2*n)+1] * pSrcReal[n];
}
</pre>
There are separate functions for floating-point, Q15, and Q31 data types.
*/
/**
@addtogroup CmplxByRealMult
@{
*/
/**
@brief Floating-point complex-by-real multiplication.
@param[in] pSrcCmplx points to complex input vector
@param[in] pSrcReal points to real input vector
@param[out] pCmplxDst points to complex output vector
@param[in] numSamples number of samples in each vector
@return none
*/
void arm_cmplx_mult_real_f32(
const float32_t * pSrcCmplx,
const float32_t * pSrcReal,
float32_t * pCmplxDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
float32_t in; /* Temporary variable */
#if defined(ARM_MATH_NEON)
float32x4_t r;
float32x4x2_t ab,outCplx;
/* Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
ab = vld2q_f32(pSrcCmplx); // load & separate real/imag pSrcA (de-interleave 2)
r = vld1q_f32(pSrcReal); // load & separate real/imag pSrcB
/* Increment pointers */
pSrcCmplx += 8;
pSrcReal += 4;
outCplx.val[0] = vmulq_f32(ab.val[0], r);
outCplx.val[1] = vmulq_f32(ab.val[1], r);
vst2q_f32(pCmplxDst, outCplx);
pCmplxDst += 8;
blkCnt--;
}
/* Tail */
blkCnt = numSamples & 3;
#else
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i ] * B[i]. */
/* C[2 * i + 1] = A[2 * i + 1] * B[i]. */
in = *pSrcReal++;
/* store result in destination buffer. */
*pCmplxDst++ = *pSrcCmplx++ * in;
*pCmplxDst++ = *pSrcCmplx++ * in;
in = *pSrcReal++;
*pCmplxDst++ = *pSrcCmplx++ * in;
*pCmplxDst++ = *pSrcCmplx++ * in;
in = *pSrcReal++;
*pCmplxDst++ = *pSrcCmplx++ * in;
*pCmplxDst++ = *pSrcCmplx++ * in;
in = *pSrcReal++;
*pCmplxDst++ = *pSrcCmplx++* in;
*pCmplxDst++ = *pSrcCmplx++ * in;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined(ARM_MATH_NEON) */
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i ] * B[i]. */
/* C[2 * i + 1] = A[2 * i + 1] * B[i]. */
in = *pSrcReal++;
/* store result in destination buffer. */
*pCmplxDst++ = *pSrcCmplx++ * in;
*pCmplxDst++ = *pSrcCmplx++ * in;
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of CmplxByRealMult group
*/
| 4,584 | C | 25.970588 | 88 | 0.586169 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mag_squared_q31.c
* Description: Q31 complex magnitude squared
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_mag_squared
@{
*/
/**
@brief Q31 complex magnitude squared.
@param[in] pSrc points to input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function implements 1.31 by 1.31 multiplications and finally output is converted into 3.29 format.
Input down scaling is not required.
*/
void arm_cmplx_mag_squared_q31(
const q31_t * pSrc,
q31_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q31_t real, imag; /* Temporary input variables */
q31_t acc0, acc1; /* Accumulators */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] = (A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
/* store the result in 3.29 format in the destination buffer. */
*pDst++ = acc0 + acc1;
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
*pDst++ = acc0 + acc1;
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
*pDst++ = acc0 + acc1;
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
*pDst++ = acc0 + acc1;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[0] = (A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
/* store result in 3.29 format in destination buffer. */
*pDst++ = acc0 + acc1;
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_mag_squared group
*/
| 3,556 | C | 26.361538 | 121 | 0.542463 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_dot_prod_q15.c
* Description: Processing function for the Q15 Complex Dot product
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_dot_prod
@{
*/
/**
@brief Q15 complex dot product.
@param[in] pSrcA points to the first input vector
@param[in] pSrcB points to the second input vector
@param[in] numSamples number of samples in each vector
@param[out] realResult real part of the result returned here
@param[out] imagResult imaginary part of the result returned her
@return none
@par Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator.
The intermediate 1.15 by 1.15 multiplications are performed with full precision and yield a 2.30 result.
These are accumulated in a 64-bit accumulator with 34.30 precision.
As a final step, the accumulators are converted to 8.24 format.
The return results <code>realResult</code> and <code>imagResult</code> are in 8.24 format.
*/
void arm_cmplx_dot_prod_q15(
const q15_t * pSrcA,
const q15_t * pSrcB,
uint32_t numSamples,
q31_t * realResult,
q31_t * imagResult)
{
uint32_t blkCnt; /* Loop counter */
q63_t real_sum = 0, imag_sum = 0; /* Temporary result variables */
q15_t a0,b0,c0,d0;
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
/* Decrement loop counter */
blkCnt--;
}
/* Store real and imaginary result in 8.24 format */
/* Convert real data in 34.30 to 8.24 by 6 right shifts */
*realResult = (q31_t) (real_sum >> 6);
/* Convert imaginary data in 34.30 to 8.24 by 6 right shifts */
*imagResult = (q31_t) (imag_sum >> 6);
}
/**
@} end of cmplx_dot_prod group
*/
| 4,274 | C | 26.580645 | 123 | 0.566214 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mult_real_q15.c
* Description: Q15 complex by real multiplication
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup CmplxByRealMult
@{
*/
/**
@brief Q15 complex-by-real multiplication.
@param[in] pSrcCmplx points to complex input vector
@param[in] pSrcReal points to real input vector
@param[out] pCmplxDst points to complex output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function uses saturating arithmetic.
Results outside of the allowable Q15 range [0x8000 0x7FFF] are saturated.
*/
void arm_cmplx_mult_real_q15(
const q15_t * pSrcCmplx,
const q15_t * pSrcReal,
q15_t * pCmplxDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q15_t in; /* Temporary variable */
#if defined (ARM_MATH_LOOPUNROLL)
#if defined (ARM_MATH_DSP)
q31_t inA1, inA2; /* Temporary variables to hold input data */
q31_t inB1; /* Temporary variables to hold input data */
q15_t out1, out2, out3, out4; /* Temporary variables to hold output data */
q31_t mul1, mul2, mul3, mul4; /* Temporary variables to hold intermediate data */
#endif
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i ] * B[i]. */
/* C[2 * i + 1] = A[2 * i + 1] * B[i]. */
#if defined (ARM_MATH_DSP)
/* read 2 complex numbers both real and imaginary from complex input buffer */
inA1 = read_q15x2_ia ((q15_t **) &pSrcCmplx);
inA2 = read_q15x2_ia ((q15_t **) &pSrcCmplx);
/* read 2 real values at a time from real input buffer */
inB1 = read_q15x2_ia ((q15_t **) &pSrcReal);
/* multiply complex number with real numbers */
#ifndef ARM_MATH_BIG_ENDIAN
mul1 = (q31_t) ((q15_t) (inA1) * (q15_t) (inB1));
mul2 = (q31_t) ((q15_t) (inA1 >> 16) * (q15_t) (inB1));
mul3 = (q31_t) ((q15_t) (inA2) * (q15_t) (inB1 >> 16));
mul4 = (q31_t) ((q15_t) (inA2 >> 16) * (q15_t) (inB1 >> 16));
#else
mul2 = (q31_t) ((q15_t) (inA1 >> 16) * (q15_t) (inB1 >> 16));
mul1 = (q31_t) ((q15_t) inA1 * (q15_t) (inB1 >> 16));
mul4 = (q31_t) ((q15_t) (inA2 >> 16) * (q15_t) inB1);
mul3 = (q31_t) ((q15_t) inA2 * (q15_t) inB1);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
/* saturate the result */
out1 = (q15_t) __SSAT(mul1 >> 15U, 16);
out2 = (q15_t) __SSAT(mul2 >> 15U, 16);
out3 = (q15_t) __SSAT(mul3 >> 15U, 16);
out4 = (q15_t) __SSAT(mul4 >> 15U, 16);
/* pack real and imaginary outputs and store them to destination */
write_q15x2_ia (&pCmplxDst, __PKHBT(out1, out2, 16));
write_q15x2_ia (&pCmplxDst, __PKHBT(out3, out4, 16));
inA1 = read_q15x2_ia ((q15_t **) &pSrcCmplx);
inA2 = read_q15x2_ia ((q15_t **) &pSrcCmplx);
inB1 = read_q15x2_ia ((q15_t **) &pSrcReal);
#ifndef ARM_MATH_BIG_ENDIAN
mul1 = (q31_t) ((q15_t) (inA1) * (q15_t) (inB1));
mul2 = (q31_t) ((q15_t) (inA1 >> 16) * (q15_t) (inB1));
mul3 = (q31_t) ((q15_t) (inA2) * (q15_t) (inB1 >> 16));
mul4 = (q31_t) ((q15_t) (inA2 >> 16) * (q15_t) (inB1 >> 16));
#else
mul2 = (q31_t) ((q15_t) (inA1 >> 16) * (q15_t) (inB1 >> 16));
mul1 = (q31_t) ((q15_t) inA1 * (q15_t) (inB1 >> 16));
mul4 = (q31_t) ((q15_t) (inA2 >> 16) * (q15_t) inB1);
mul3 = (q31_t) ((q15_t) inA2 * (q15_t) inB1);
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
out1 = (q15_t) __SSAT(mul1 >> 15U, 16);
out2 = (q15_t) __SSAT(mul2 >> 15U, 16);
out3 = (q15_t) __SSAT(mul3 >> 15U, 16);
out4 = (q15_t) __SSAT(mul4 >> 15U, 16);
write_q15x2_ia (&pCmplxDst, __PKHBT(out1, out2, 16));
write_q15x2_ia (&pCmplxDst, __PKHBT(out3, out4, 16));
#else
in = *pSrcReal++;
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
in = *pSrcReal++;
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
in = *pSrcReal++;
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
in = *pSrcReal++;
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
#endif
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i ] * B[i]. */
/* C[2 * i + 1] = A[2 * i + 1] * B[i]. */
in = *pSrcReal++;
/* store the result in the destination buffer. */
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
*pCmplxDst++ = (q15_t) __SSAT((((q31_t) *pSrcCmplx++ * in) >> 15), 16);
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of CmplxByRealMult group
*/
| 6,427 | C | 34.125683 | 106 | 0.535398 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mult_real_q31.c
* Description: Q31 complex by real multiplication
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup CmplxByRealMult
@{
*/
/**
@brief Q31 complex-by-real multiplication.
@param[in] pSrcCmplx points to complex input vector
@param[in] pSrcReal points to real input vector
@param[out] pCmplxDst points to complex output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function uses saturating arithmetic.
Results outside of the allowable Q31 range[0x80000000 0x7FFFFFFF] are saturated.
*/
void arm_cmplx_mult_real_q31(
const q31_t * pSrcCmplx,
const q31_t * pSrcReal,
q31_t * pCmplxDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q31_t in; /* Temporary variable */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i ] * B[i]. */
/* C[2 * i + 1] = A[2 * i + 1] * B[i]. */
in = *pSrcReal++;
#if defined (ARM_MATH_DSP)
/* store saturated result in 1.31 format to destination buffer */
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
#else
/* store result in destination buffer. */
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
#endif
in = *pSrcReal++;
#if defined (ARM_MATH_DSP)
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
#else
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
#endif
in = *pSrcReal++;
#if defined (ARM_MATH_DSP)
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
#else
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
#endif
in = *pSrcReal++;
#if defined (ARM_MATH_DSP)
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
#else
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
#endif
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i ] * B[i]. */
/* C[2 * i + 1] = A[2 * i + 1] * B[i]. */
in = *pSrcReal++;
#if defined (ARM_MATH_DSP)
/* store saturated result in 1.31 format to destination buffer */
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
*pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1);
#else
/* store result in destination buffer. */
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
*pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31);
#endif
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of CmplxByRealMult group
*/
| 4,859 | C | 31.617449 | 99 | 0.552377 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_dot_prod_f32.c
* Description: Floating-point complex dot product
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@defgroup cmplx_dot_prod Complex Dot Product
Computes the dot product of two complex vectors.
The vectors are multiplied element-by-element and then summed.
The <code>pSrcA</code> points to the first complex input vector and
<code>pSrcB</code> points to the second complex input vector.
<code>numSamples</code> specifies the number of complex samples
and the data in each array is stored in an interleaved fashion
(real, imag, real, imag, ...).
Each array has a total of <code>2*numSamples</code> values.
The underlying algorithm is used:
<pre>
realResult = 0;
imagResult = 0;
for (n = 0; n < numSamples; n++) {
realResult += pSrcA[(2*n)+0] * pSrcB[(2*n)+0] - pSrcA[(2*n)+1] * pSrcB[(2*n)+1];
imagResult += pSrcA[(2*n)+0] * pSrcB[(2*n)+1] + pSrcA[(2*n)+1] * pSrcB[(2*n)+0];
}
</pre>
There are separate functions for floating-point, Q15, and Q31 data types.
*/
/**
@addtogroup cmplx_dot_prod
@{
*/
/**
@brief Floating-point complex dot product.
@param[in] pSrcA points to the first input vector
@param[in] pSrcB points to the second input vector
@param[in] numSamples number of samples in each vector
@param[out] realResult real part of the result returned here
@param[out] imagResult imaginary part of the result returned here
@return none
*/
void arm_cmplx_dot_prod_f32(
const float32_t * pSrcA,
const float32_t * pSrcB,
uint32_t numSamples,
float32_t * realResult,
float32_t * imagResult)
{
uint32_t blkCnt; /* Loop counter */
float32_t real_sum = 0.0f, imag_sum = 0.0f; /* Temporary result variables */
float32_t a0,b0,c0,d0;
#if defined(ARM_MATH_NEON)
float32x4x2_t vec1,vec2,vec3,vec4;
float32x4_t accR,accI;
float32x2_t accum = vdup_n_f32(0);
accR = vdupq_n_f32(0.0);
accI = vdupq_n_f32(0.0);
/* Loop unrolling: Compute 8 outputs at a time */
blkCnt = numSamples >> 3U;
while (blkCnt > 0U)
{
/* C = (A[0]+jA[1])*(B[0]+jB[1]) + ... */
/* Calculate dot product and then store the result in a temporary buffer. */
vec1 = vld2q_f32(pSrcA);
vec2 = vld2q_f32(pSrcB);
/* Increment pointers */
pSrcA += 8;
pSrcB += 8;
/* Re{C} = Re{A}*Re{B} - Im{A}*Im{B} */
accR = vmlaq_f32(accR,vec1.val[0],vec2.val[0]);
accR = vmlsq_f32(accR,vec1.val[1],vec2.val[1]);
/* Im{C} = Re{A}*Im{B} + Im{A}*Re{B} */
accI = vmlaq_f32(accI,vec1.val[1],vec2.val[0]);
accI = vmlaq_f32(accI,vec1.val[0],vec2.val[1]);
vec3 = vld2q_f32(pSrcA);
vec4 = vld2q_f32(pSrcB);
/* Increment pointers */
pSrcA += 8;
pSrcB += 8;
/* Re{C} = Re{A}*Re{B} - Im{A}*Im{B} */
accR = vmlaq_f32(accR,vec3.val[0],vec4.val[0]);
accR = vmlsq_f32(accR,vec3.val[1],vec4.val[1]);
/* Im{C} = Re{A}*Im{B} + Im{A}*Re{B} */
accI = vmlaq_f32(accI,vec3.val[1],vec4.val[0]);
accI = vmlaq_f32(accI,vec3.val[0],vec4.val[1]);
/* Decrement the loop counter */
blkCnt--;
}
accum = vpadd_f32(vget_low_f32(accR), vget_high_f32(accR));
real_sum += accum[0] + accum[1];
accum = vpadd_f32(vget_low_f32(accI), vget_high_f32(accI));
imag_sum += accum[0] + accum[1];
/* Tail */
blkCnt = numSamples & 0x7;
#else
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += a0 * c0;
imag_sum += a0 * d0;
real_sum -= b0 * d0;
imag_sum += b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += a0 * c0;
imag_sum += a0 * d0;
real_sum -= b0 * d0;
imag_sum += b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += a0 * c0;
imag_sum += a0 * d0;
real_sum -= b0 * d0;
imag_sum += b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += a0 * c0;
imag_sum += a0 * d0;
real_sum -= b0 * d0;
imag_sum += b0 * c0;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined(ARM_MATH_NEON) */
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += a0 * c0;
imag_sum += a0 * d0;
real_sum -= b0 * d0;
imag_sum += b0 * c0;
/* Decrement loop counter */
blkCnt--;
}
/* Store real and imaginary result in destination buffer. */
*realResult = real_sum;
*imagResult = imag_sum;
}
/**
@} end of cmplx_dot_prod group
*/
| 6,058 | C | 24.893162 | 87 | 0.56867 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_conj_f32.c
* Description: Floating-point complex conjugate
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@defgroup cmplx_conj Complex Conjugate
Conjugates the elements of a complex data vector.
The <code>pSrc</code> points to the source data and
<code>pDst</code> points to the destination data where the result should be written.
<code>numSamples</code> specifies the number of complex samples
and the data in each array is stored in an interleaved fashion
(real, imag, real, imag, ...).
Each array has a total of <code>2*numSamples</code> values.
The underlying algorithm is used:
<pre>
for (n = 0; n < numSamples; n++) {
pDst[(2*n) ] = pSrc[(2*n) ]; // real part
pDst[(2*n)+1] = -pSrc[(2*n)+1]; // imag part
}
</pre>
There are separate functions for floating-point, Q15, and Q31 data types.
*/
/**
@addtogroup cmplx_conj
@{
*/
/**
@brief Floating-point complex conjugate.
@param[in] pSrc points to the input vector
@param[out] pDst points to the output vector
@param[in] numSamples number of samples in each vector
@return none
*/
void arm_cmplx_conj_f32(
const float32_t * pSrc,
float32_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
#if defined(ARM_MATH_NEON)
float32x4_t zero;
float32x4x2_t vec;
zero = vdupq_n_f32(0.0);
/* Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0]+jC[1] = A[0]+(-1)*jA[1] */
/* Calculate Complex Conjugate and then store the results in the destination buffer. */
vec = vld2q_f32(pSrc);
vec.val[1] = vsubq_f32(zero,vec.val[1]);
vst2q_f32(pDst,vec);
/* Increment pointers */
pSrc += 8;
pDst += 8;
/* Decrement the loop counter */
blkCnt--;
}
/* Tail */
blkCnt = numSamples & 0x3;
#else
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] + jC[1] = A[0]+ j(-1)A[1] */
/* Calculate Complex Conjugate and store result in destination buffer. */
*pDst++ = *pSrc++;
*pDst++ = -*pSrc++;
*pDst++ = *pSrc++;
*pDst++ = -*pSrc++;
*pDst++ = *pSrc++;
*pDst++ = -*pSrc++;
*pDst++ = *pSrc++;
*pDst++ = -*pSrc++;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined (ARM_MATH_NEON) */
while (blkCnt > 0U)
{
/* C[0] + jC[1] = A[0]+ j(-1)A[1] */
/* Calculate Complex Conjugate and store result in destination buffer. */
*pDst++ = *pSrc++;
*pDst++ = -*pSrc++;
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_conj group
*/
| 3,990 | C | 23.635802 | 92 | 0.584211 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mult_cmplx_f32.c
* Description: Floating-point complex-by-complex multiplication
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@defgroup CmplxByCmplxMult Complex-by-Complex Multiplication
Multiplies a complex vector by another complex vector and generates a complex result.
The data in the complex arrays is stored in an interleaved fashion
(real, imag, real, imag, ...).
The parameter <code>numSamples</code> represents the number of complex
samples processed. The complex arrays have a total of <code>2*numSamples</code>
real values.
The underlying algorithm is used:
<pre>
for (n = 0; n < numSamples; n++) {
pDst[(2*n)+0] = pSrcA[(2*n)+0] * pSrcB[(2*n)+0] - pSrcA[(2*n)+1] * pSrcB[(2*n)+1];
pDst[(2*n)+1] = pSrcA[(2*n)+0] * pSrcB[(2*n)+1] + pSrcA[(2*n)+1] * pSrcB[(2*n)+0];
}
</pre>
There are separate functions for floating-point, Q15, and Q31 data types.
*/
/**
@addtogroup CmplxByCmplxMult
@{
*/
/**
@brief Floating-point complex-by-complex multiplication.
@param[in] pSrcA points to first input vector
@param[in] pSrcB points to second input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
*/
void arm_cmplx_mult_cmplx_f32(
const float32_t * pSrcA,
const float32_t * pSrcB,
float32_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
float32_t a, b, c, d; /* Temporary variables to store real and imaginary values */
#if defined(ARM_MATH_NEON)
float32x4x2_t va, vb;
float32x4_t real, imag;
float32x4x2_t outCplx;
/* Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
va = vld2q_f32(pSrcA); // load & separate real/imag pSrcA (de-interleave 2)
vb = vld2q_f32(pSrcB); // load & separate real/imag pSrcB
/* Increment pointers */
pSrcA += 8;
pSrcB += 8;
/* Re{C} = Re{A}*Re{B} - Im{A}*Im{B} */
outCplx.val[0] = vmulq_f32(va.val[0], vb.val[0]);
outCplx.val[0] = vmlsq_f32(outCplx.val[0], va.val[1], vb.val[1]);
/* Im{C} = Re{A}*Im{B} + Im{A}*Re{B} */
outCplx.val[1] = vmulq_f32(va.val[0], vb.val[1]);
outCplx.val[1] = vmlaq_f32(outCplx.val[1], va.val[1], vb.val[0]);
vst2q_f32(pDst, outCplx);
/* Increment pointer */
pDst += 8;
/* Decrement the loop counter */
blkCnt--;
}
/* Tail */
blkCnt = numSamples & 3;
#else
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i] * B[2 * i ] - A[2 * i + 1] * B[2 * i + 1]. */
/* C[2 * i + 1] = A[2 * i] * B[2 * i + 1] + A[2 * i + 1] * B[2 * i ]. */
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
/* store result in destination buffer. */
*pDst++ = (a * c) - (b * d);
*pDst++ = (a * d) + (b * c);
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (a * c) - (b * d);
*pDst++ = (a * d) + (b * c);
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (a * c) - (b * d);
*pDst++ = (a * d) + (b * c);
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (a * c) - (b * d);
*pDst++ = (a * d) + (b * c);
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined(ARM_MATH_NEON) */
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i] * B[2 * i ] - A[2 * i + 1] * B[2 * i + 1]. */
/* C[2 * i + 1] = A[2 * i] * B[2 * i + 1] + A[2 * i + 1] * B[2 * i ]. */
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
/* store result in destination buffer. */
*pDst++ = (a * c) - (b * d);
*pDst++ = (a * d) + (b * c);
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of CmplxByCmplxMult group
*/
| 5,229 | C | 25.820513 | 88 | 0.53777 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mag_squared_q15.c
* Description: Q15 complex magnitude squared
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_mag_squared
@{
*/
/**
@brief Q15 complex magnitude squared.
@param[in] pSrc points to input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function implements 1.15 by 1.15 multiplications and finally output is converted into 3.13 format.
*/
void arm_cmplx_mag_squared_q15(
const q15_t * pSrc,
q15_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
#if defined (ARM_MATH_DSP)
q31_t in;
q31_t acc0; /* Accumulators */
#else
q15_t real, imag; /* Temporary input variables */
q31_t acc0, acc1; /* Accumulators */
#endif
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] = (A[0] * A[0] + A[1] * A[1]) */
#if defined (ARM_MATH_DSP)
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
/* store result in 3.13 format in destination buffer. */
*pDst++ = (q15_t) (acc0 >> 17);
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
*pDst++ = (q15_t) (acc0 >> 17);
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
*pDst++ = (q15_t) (acc0 >> 17);
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
*pDst++ = (q15_t) (acc0 >> 17);
#else
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
/* store result in 3.13 format in destination buffer. */
*pDst++ = (q15_t) (((q63_t) acc0 + acc1) >> 17);
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
*pDst++ = (q15_t) (((q63_t) acc0 + acc1) >> 17);
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
*pDst++ = (q15_t) (((q63_t) acc0 + acc1) >> 17);
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
*pDst++ = (q15_t) (((q63_t) acc0 + acc1) >> 17);
#endif /* #if defined (ARM_MATH_DSP) */
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[0] = (A[0] * A[0] + A[1] * A[1]) */
#if defined (ARM_MATH_DSP)
in = read_q15x2_ia ((q15_t **) &pSrc);
acc0 = __SMUAD(in, in);
/* store result in 3.13 format in destination buffer. */
*pDst++ = (q15_t) (acc0 >> 17);
#else
real = *pSrc++;
imag = *pSrc++;
acc0 = ((q31_t) real * real);
acc1 = ((q31_t) imag * imag);
/* store result in 3.13 format in destination buffer. */
*pDst++ = (q15_t) (((q63_t) acc0 + acc1) >> 17);
#endif
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_mag_squared group
*/
| 4,370 | C | 25.981481 | 121 | 0.534325 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mult_cmplx_q15.c
* Description: Q15 complex-by-complex multiplication
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup CmplxByCmplxMult
@{
*/
/**
@brief Q15 complex-by-complex multiplication.
@param[in] pSrcA points to first input vector
@param[in] pSrcB points to second input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function implements 1.15 by 1.15 multiplications and finally output is converted into 3.13 format.
*/
void arm_cmplx_mult_cmplx_q15(
const q15_t * pSrcA,
const q15_t * pSrcB,
q15_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q15_t a, b, c, d; /* Temporary variables */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i] * B[2 * i ] - A[2 * i + 1] * B[2 * i + 1]. */
/* C[2 * i + 1] = A[2 * i] * B[2 * i + 1] + A[2 * i + 1] * B[2 * i ]. */
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
/* store result in 3.13 format in destination buffer. */
*pDst++ = (q15_t) ( (((q31_t) a * c) >> 17) - (((q31_t) b * d) >> 17) );
*pDst++ = (q15_t) ( (((q31_t) a * d) >> 17) + (((q31_t) b * c) >> 17) );
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (q15_t) ( (((q31_t) a * c) >> 17) - (((q31_t) b * d) >> 17) );
*pDst++ = (q15_t) ( (((q31_t) a * d) >> 17) + (((q31_t) b * c) >> 17) );
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (q15_t) ( (((q31_t) a * c) >> 17) - (((q31_t) b * d) >> 17) );
*pDst++ = (q15_t) ( (((q31_t) a * d) >> 17) + (((q31_t) b * c) >> 17) );
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (q15_t) ( (((q31_t) a * c) >> 17) - (((q31_t) b * d) >> 17) );
*pDst++ = (q15_t) ( (((q31_t) a * d) >> 17) + (((q31_t) b * c) >> 17) );
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i] * B[2 * i ] - A[2 * i + 1] * B[2 * i + 1]. */
/* C[2 * i + 1] = A[2 * i] * B[2 * i + 1] + A[2 * i + 1] * B[2 * i ]. */
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
/* store result in 3.13 format in destination buffer. */
*pDst++ = (q15_t) ( (((q31_t) a * c) >> 17) - (((q31_t) b * d) >> 17) );
*pDst++ = (q15_t) ( (((q31_t) a * d) >> 17) + (((q31_t) b * c) >> 17) );
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of CmplxByCmplxMult group
*/
| 4,039 | C | 28.489051 | 121 | 0.490963 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mag_squared_f32.c
* Description: Floating-point complex magnitude squared
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@defgroup cmplx_mag_squared Complex Magnitude Squared
Computes the magnitude squared of the elements of a complex data vector.
The <code>pSrc</code> points to the source data and
<code>pDst</code> points to the where the result should be written.
<code>numSamples</code> specifies the number of complex samples
in the input array and the data is stored in an interleaved fashion
(real, imag, real, imag, ...).
The input array has a total of <code>2*numSamples</code> values;
the output array has a total of <code>numSamples</code> values.
The underlying algorithm is used:
<pre>
for (n = 0; n < numSamples; n++) {
pDst[n] = pSrc[(2*n)+0]^2 + pSrc[(2*n)+1]^2;
}
</pre>
There are separate functions for floating-point, Q15, and Q31 data types.
*/
/**
@addtogroup cmplx_mag_squared
@{
*/
/**
@brief Floating-point complex magnitude squared.
@param[in] pSrc points to input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
*/
void arm_cmplx_mag_squared_f32(
const float32_t * pSrc,
float32_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
float32_t real, imag; /* Temporary input variables */
#if defined(ARM_MATH_NEON)
float32x4x2_t vecA;
float32x4_t vRealA;
float32x4_t vImagA;
float32x4_t vMagSqA;
float32x4x2_t vecB;
float32x4_t vRealB;
float32x4_t vImagB;
float32x4_t vMagSqB;
/* Loop unrolling: Compute 8 outputs at a time */
blkCnt = numSamples >> 3;
while (blkCnt > 0U)
{
/* out = sqrt((real * real) + (imag * imag)) */
vecA = vld2q_f32(pSrc);
pSrc += 8;
vRealA = vmulq_f32(vecA.val[0], vecA.val[0]);
vImagA = vmulq_f32(vecA.val[1], vecA.val[1]);
vMagSqA = vaddq_f32(vRealA, vImagA);
vecB = vld2q_f32(pSrc);
pSrc += 8;
vRealB = vmulq_f32(vecB.val[0], vecB.val[0]);
vImagB = vmulq_f32(vecB.val[1], vecB.val[1]);
vMagSqB = vaddq_f32(vRealB, vImagB);
/* Store the result in the destination buffer. */
vst1q_f32(pDst, vMagSqA);
pDst += 4;
vst1q_f32(pDst, vMagSqB);
pDst += 4;
/* Decrement the loop counter */
blkCnt--;
}
blkCnt = numSamples & 7;
#else
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] = (A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
*pDst++ = (real * real) + (imag * imag);
real = *pSrc++;
imag = *pSrc++;
*pDst++ = (real * real) + (imag * imag);
real = *pSrc++;
imag = *pSrc++;
*pDst++ = (real * real) + (imag * imag);
real = *pSrc++;
imag = *pSrc++;
*pDst++ = (real * real) + (imag * imag);
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined(ARM_MATH_NEON) */
while (blkCnt > 0U)
{
/* C[0] = (A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
/* store result in destination buffer. */
*pDst++ = (real * real) + (imag * imag);
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_mag_squared group
*/
| 4,600 | C | 23.87027 | 86 | 0.591087 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/ComplexMathFunctions.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: CompexMathFunctions.c
* Description: Combination of all comlex math function source files.
*
* $Date: 18. March 2019
* $Revision: V1.0.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_cmplx_conj_f32.c"
#include "arm_cmplx_conj_q15.c"
#include "arm_cmplx_conj_q31.c"
#include "arm_cmplx_dot_prod_f32.c"
#include "arm_cmplx_dot_prod_q15.c"
#include "arm_cmplx_dot_prod_q31.c"
#include "arm_cmplx_mag_f32.c"
#include "arm_cmplx_mag_q15.c"
#include "arm_cmplx_mag_q31.c"
#include "arm_cmplx_mag_squared_f32.c"
#include "arm_cmplx_mag_squared_q15.c"
#include "arm_cmplx_mag_squared_q31.c"
#include "arm_cmplx_mult_cmplx_f32.c"
#include "arm_cmplx_mult_cmplx_q15.c"
#include "arm_cmplx_mult_cmplx_q31.c"
#include "arm_cmplx_mult_real_f32.c"
#include "arm_cmplx_mult_real_q15.c"
#include "arm_cmplx_mult_real_q31.c"
| 1,698 | C | 35.148935 | 74 | 0.659011 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mag_f32.c
* Description: Floating-point complex magnitude
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@defgroup cmplx_mag Complex Magnitude
Computes the magnitude of the elements of a complex data vector.
The <code>pSrc</code> points to the source data and
<code>pDst</code> points to the where the result should be written.
<code>numSamples</code> specifies the number of complex samples
in the input array and the data is stored in an interleaved fashion
(real, imag, real, imag, ...).
The input array has a total of <code>2*numSamples</code> values;
the output array has a total of <code>numSamples</code> values.
The underlying algorithm is used:
<pre>
for (n = 0; n < numSamples; n++) {
pDst[n] = sqrt(pSrc[(2*n)+0]^2 + pSrc[(2*n)+1]^2);
}
</pre>
There are separate functions for floating-point, Q15, and Q31 data types.
*/
/**
@addtogroup cmplx_mag
@{
*/
/**
@brief Floating-point complex magnitude.
@param[in] pSrc points to input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
*/
void arm_cmplx_mag_f32(
const float32_t * pSrc,
float32_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* loop counter */
float32_t real, imag; /* Temporary variables to hold input values */
#if defined(ARM_MATH_NEON)
float32x4x2_t vecA;
float32x4_t vRealA;
float32x4_t vImagA;
float32x4_t vMagSqA;
float32x4x2_t vecB;
float32x4_t vRealB;
float32x4_t vImagB;
float32x4_t vMagSqB;
/* Loop unrolling: Compute 8 outputs at a time */
blkCnt = numSamples >> 3;
while (blkCnt > 0U)
{
/* out = sqrt((real * real) + (imag * imag)) */
vecA = vld2q_f32(pSrc);
pSrc += 8;
vecB = vld2q_f32(pSrc);
pSrc += 8;
vRealA = vmulq_f32(vecA.val[0], vecA.val[0]);
vImagA = vmulq_f32(vecA.val[1], vecA.val[1]);
vMagSqA = vaddq_f32(vRealA, vImagA);
vRealB = vmulq_f32(vecB.val[0], vecB.val[0]);
vImagB = vmulq_f32(vecB.val[1], vecB.val[1]);
vMagSqB = vaddq_f32(vRealB, vImagB);
/* Store the result in the destination buffer. */
vst1q_f32(pDst, __arm_vec_sqrt_f32_neon(vMagSqA));
pDst += 4;
vst1q_f32(pDst, __arm_vec_sqrt_f32_neon(vMagSqB));
pDst += 4;
/* Decrement the loop counter */
blkCnt--;
}
blkCnt = numSamples & 7;
#else
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
/* store result in destination buffer. */
arm_sqrt_f32((real * real) + (imag * imag), pDst++);
real = *pSrc++;
imag = *pSrc++;
arm_sqrt_f32((real * real) + (imag * imag), pDst++);
real = *pSrc++;
imag = *pSrc++;
arm_sqrt_f32((real * real) + (imag * imag), pDst++);
real = *pSrc++;
imag = *pSrc++;
arm_sqrt_f32((real * real) + (imag * imag), pDst++);
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined(ARM_MATH_NEON) */
while (blkCnt > 0U)
{
/* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
/* store result in destination buffer. */
arm_sqrt_f32((real * real) + (imag * imag), pDst++);
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_mag group
*/
| 4,700 | C | 23.873016 | 91 | 0.594468 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mult_cmplx_q31.c
* Description: Q31 complex-by-complex multiplication
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup CmplxByCmplxMult
@{
*/
/**
@brief Q31 complex-by-complex multiplication.
@param[in] pSrcA points to first input vector
@param[in] pSrcB points to second input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function implements 1.31 by 1.31 multiplications and finally output is converted into 3.29 format.
Input down scaling is not required.
*/
void arm_cmplx_mult_cmplx_q31(
const q31_t * pSrcA,
const q31_t * pSrcB,
q31_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q31_t a, b, c, d; /* Temporary variables */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i] * B[2 * i ] - A[2 * i + 1] * B[2 * i + 1]. */
/* C[2 * i + 1] = A[2 * i] * B[2 * i + 1] + A[2 * i + 1] * B[2 * i ]. */
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
/* store result in 3.29 format in destination buffer. */
*pDst++ = (q31_t) ( (((q63_t) a * c) >> 33) - (((q63_t) b * d) >> 33) );
*pDst++ = (q31_t) ( (((q63_t) a * d) >> 33) + (((q63_t) b * c) >> 33) );
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (q31_t) ( (((q63_t) a * c) >> 33) - (((q63_t) b * d) >> 33) );
*pDst++ = (q31_t) ( (((q63_t) a * d) >> 33) + (((q63_t) b * c) >> 33) );
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (q31_t) ( (((q63_t) a * c) >> 33) - (((q63_t) b * d) >> 33) );
*pDst++ = (q31_t) ( (((q63_t) a * d) >> 33) + (((q63_t) b * c) >> 33) );
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
*pDst++ = (q31_t) ( (((q63_t) a * c) >> 33) - (((q63_t) b * d) >> 33) );
*pDst++ = (q31_t) ( (((q63_t) a * d) >> 33) + (((q63_t) b * c) >> 33) );
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[2 * i ] = A[2 * i] * B[2 * i ] - A[2 * i + 1] * B[2 * i + 1]. */
/* C[2 * i + 1] = A[2 * i] * B[2 * i + 1] + A[2 * i + 1] * B[2 * i ]. */
a = *pSrcA++;
b = *pSrcA++;
c = *pSrcB++;
d = *pSrcB++;
/* store result in 3.29 format in destination buffer. */
*pDst++ = (q31_t) ( (((q63_t) a * c) >> 33) - (((q63_t) b * d) >> 33) );
*pDst++ = (q31_t) ( (((q63_t) a * d) >> 33) + (((q63_t) b * c) >> 33) );
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of CmplxByCmplxMult group
*/
| 4,094 | C | 28.673913 | 121 | 0.491451 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_dot_prod_q31.c
* Description: Q31 complex dot product
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_dot_prod
@{
*/
/**
@brief Q31 complex dot product.
@param[in] pSrcA points to the first input vector
@param[in] pSrcB points to the second input vector
@param[in] numSamples number of samples in each vector
@param[out] realResult real part of the result returned here
@param[out] imagResult imaginary part of the result returned here
@return none
@par Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator.
The intermediate 1.31 by 1.31 multiplications are performed with 64-bit precision and then shifted to 16.48 format.
The internal real and imaginary accumulators are in 16.48 format and provide 15 guard bits.
Additions are nonsaturating and no overflow will occur as long as <code>numSamples</code> is less than 32768.
The return results <code>realResult</code> and <code>imagResult</code> are in 16.48 format.
Input down scaling is not required.
*/
void arm_cmplx_dot_prod_q31(
const q31_t * pSrcA,
const q31_t * pSrcB,
uint32_t numSamples,
q63_t * realResult,
q63_t * imagResult)
{
uint32_t blkCnt; /* Loop counter */
q63_t real_sum = 0, imag_sum = 0; /* Temporary result variables */
q31_t a0,b0,c0,d0;
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += ((q63_t)a0 * c0) >> 14;
imag_sum += ((q63_t)a0 * d0) >> 14;
real_sum -= ((q63_t)b0 * d0) >> 14;
imag_sum += ((q63_t)b0 * c0) >> 14;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += ((q63_t)a0 * c0) >> 14;
imag_sum += ((q63_t)a0 * d0) >> 14;
real_sum -= ((q63_t)b0 * d0) >> 14;
imag_sum += ((q63_t)b0 * c0) >> 14;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += ((q63_t)a0 * c0) >> 14;
imag_sum += ((q63_t)a0 * d0) >> 14;
real_sum -= ((q63_t)b0 * d0) >> 14;
imag_sum += ((q63_t)b0 * c0) >> 14;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += ((q63_t)a0 * c0) >> 14;
imag_sum += ((q63_t)a0 * d0) >> 14;
real_sum -= ((q63_t)b0 * d0) >> 14;
imag_sum += ((q63_t)b0 * c0) >> 14;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += ((q63_t)a0 * c0) >> 14;
imag_sum += ((q63_t)a0 * d0) >> 14;
real_sum -= ((q63_t)b0 * d0) >> 14;
imag_sum += ((q63_t)b0 * c0) >> 14;
/* Decrement loop counter */
blkCnt--;
}
/* Store real and imaginary result in 16.48 format */
*realResult = real_sum;
*imagResult = imag_sum;
}
/**
@} end of cmplx_dot_prod group
*/
| 4,388 | C | 27.5 | 134 | 0.556062 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_mag_q31.c
* Description: Q31 complex magnitude
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_mag
@{
*/
/**
@brief Q31 complex magnitude.
@param[in] pSrc points to input vector
@param[out] pDst points to output vector
@param[in] numSamples number of samples in each vector
@return none
@par Scaling and Overflow Behavior
The function implements 1.31 by 1.31 multiplications and finally output is converted into 2.30 format.
Input down scaling is not required.
*/
void arm_cmplx_mag_q31(
const q31_t * pSrc,
q31_t * pDst,
uint32_t numSamples)
{
uint32_t blkCnt; /* Loop counter */
q31_t real, imag; /* Temporary input variables */
q31_t acc0, acc1; /* Accumulators */
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
/* store result in 2.30 format in destination buffer. */
arm_sqrt_q31(acc0 + acc1, pDst++);
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
arm_sqrt_q31(acc0 + acc1, pDst++);
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
arm_sqrt_q31(acc0 + acc1, pDst++);
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
arm_sqrt_q31(acc0 + acc1, pDst++);
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
real = *pSrc++;
imag = *pSrc++;
acc0 = (q31_t) (((q63_t) real * real) >> 33);
acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
/* store result in 2.30 format in destination buffer. */
arm_sqrt_q31(acc0 + acc1, pDst++);
/* Decrement loop counter */
blkCnt--;
}
}
/**
@} end of cmplx_mag group
*/
| 3,569 | C | 26.251908 | 121 | 0.543289 |
Tbarkin121/GuardDog/stm32/MotorDrive/LegDay/Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_f32.c | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_pid_init_f32.c
* Description: Floating-point PID Control initialization function
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@addtogroup PID
@{
*/
/**
@brief Initialization function for the floating-point PID Control.
@param[in,out] S points to an instance of the PID structure
@param[in] resetStateFlag
- value = 0: no change in state
- value = 1: reset state
@return none
@par Details
The <code>resetStateFlag</code> specifies whether to set state to zero or not. \n
The function computes the structure fields: <code>A0</code>, <code>A1</code> <code>A2</code>
using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd)
also sets the state variables to all zeros.
*/
void arm_pid_init_f32(
arm_pid_instance_f32 * S,
int32_t resetStateFlag)
{
/* Derived coefficient A0 */
S->A0 = S->Kp + S->Ki + S->Kd;
/* Derived coefficient A1 */
S->A1 = (-S->Kp) - ((float32_t) 2.0 * S->Kd);
/* Derived coefficient A2 */
S->A2 = S->Kd;
/* Check whether state needs reset or not */
if (resetStateFlag)
{
/* Reset state to zero, The size will be always 3 samples */
memset(S->state, 0, 3U * sizeof(float32_t));
}
}
/**
@} end of PID group
*/
| 2,330 | C | 29.671052 | 111 | 0.588841 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.