1 #ifndef INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H
2 #define INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H
11 #ifdef LV_HAVE_LIB_SIMDMATH
22 static inline void volk_32fc_s32f_power_spectrum_32f_a_sse3(
float* logPowerOutput,
const lv_32fc_t* complexFFTInput,
const float normalizationFactor,
unsigned int num_points){
23 const float* inputPtr = (
const float*)complexFFTInput;
24 float* destPtr = logPowerOutput;
26 const float iNormalizationFactor = 1.0 / normalizationFactor;
27 #ifdef LV_HAVE_LIB_SIMDMATH
28 __m128 magScalar = _mm_set_ps1(10.0);
29 magScalar = _mm_div_ps(magScalar, logf4(magScalar));
31 __m128 invNormalizationFactor = _mm_set_ps1(iNormalizationFactor);
34 __m128 input1, input2;
35 const uint64_t quarterPoints = num_points / 4;
36 for(;number < quarterPoints; number++){
38 input1 =_mm_load_ps(inputPtr);
40 input2 =_mm_load_ps(inputPtr);
44 input1 = _mm_mul_ps(input1, invNormalizationFactor);
45 input2 = _mm_mul_ps(input2, invNormalizationFactor);
49 input1 = _mm_mul_ps(input1, input1);
51 input2 = _mm_mul_ps(input2, input2);
55 power = _mm_hadd_ps(input1, input2);
61 power = _mm_mul_ps(power, magScalar);
64 _mm_store_ps(destPtr, power);
69 number = quarterPoints*4;
73 for(; number < num_points; number++){
80 const float real = *inputPtr++ * iNormalizationFactor;
81 const float imag = *inputPtr++ * iNormalizationFactor;
83 *destPtr = 10.0*log10f(((real * real) + (imag * imag)) + 1e-20);
91 #ifdef LV_HAVE_GENERIC
99 static inline void volk_32fc_s32f_power_spectrum_32f_generic(
float* logPowerOutput,
const lv_32fc_t* complexFFTInput,
const float normalizationFactor,
unsigned int num_points){
101 const float* inputPtr = (
float*)complexFFTInput;
102 float* realFFTDataPointsPtr = logPowerOutput;
103 const float iNormalizationFactor = 1.0 / normalizationFactor;
105 for(point = 0; point < num_points; point++){
112 const float real = *inputPtr++ * iNormalizationFactor;
113 const float imag = *inputPtr++ * iNormalizationFactor;
115 *realFFTDataPointsPtr = 10.0*log10f(((real * real) + (imag * imag)) + 1e-20);
118 realFFTDataPointsPtr++;
unsigned __int64 uint64_t
Definition: stdint.h:90
float complex lv_32fc_t
Definition: volk_complex.h:56