1 #ifndef INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H
2 #define INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H
11 #ifdef LV_HAVE_LIB_SIMDMATH
23 static inline void volk_32fc_s32f_x2_power_spectral_density_32f_a_sse3(
float* logPowerOutput,
const lv_32fc_t* complexFFTInput,
const float normalizationFactor,
const float rbw,
unsigned int num_points){
24 const float* inputPtr = (
const float*)complexFFTInput;
25 float* destPtr = logPowerOutput;
27 const float iRBW = 1.0 / rbw;
28 const float iNormalizationFactor = 1.0 / normalizationFactor;
30 #ifdef LV_HAVE_LIB_SIMDMATH
31 __m128 magScalar = _mm_set_ps1(10.0);
32 magScalar = _mm_div_ps(magScalar, logf4(magScalar));
34 __m128 invRBW = _mm_set_ps1(iRBW);
36 __m128 invNormalizationFactor = _mm_set_ps1(iNormalizationFactor);
39 __m128 input1, input2;
40 const uint64_t quarterPoints = num_points / 4;
41 for(;number < quarterPoints; number++){
43 input1 =_mm_load_ps(inputPtr);
45 input2 =_mm_load_ps(inputPtr);
49 input1 = _mm_mul_ps(input1, invNormalizationFactor);
50 input2 = _mm_mul_ps(input2, invNormalizationFactor);
54 input1 = _mm_mul_ps(input1, input1);
56 input2 = _mm_mul_ps(input2, input2);
60 power = _mm_hadd_ps(input1, input2);
63 power = _mm_mul_ps(power, invRBW);
69 power = _mm_mul_ps(power, magScalar);
72 _mm_store_ps(destPtr, power);
77 number = quarterPoints*4;
80 for(; number < num_points; number++){
87 const float real = *inputPtr++ * iNormalizationFactor;
88 const float imag = *inputPtr++ * iNormalizationFactor;
90 *destPtr = 10.0*log10f((((real * real) + (imag * imag)) + 1e-20) * iRBW);
97 #ifdef LV_HAVE_GENERIC
106 static inline void volk_32fc_s32f_x2_power_spectral_density_32f_generic(
float* logPowerOutput,
const lv_32fc_t* complexFFTInput,
const float normalizationFactor,
const float rbw,
unsigned int num_points){
108 const float* inputPtr = (
float*)complexFFTInput;
109 float* realFFTDataPointsPtr = logPowerOutput;
111 const float invRBW = 1.0 / rbw;
112 const float iNormalizationFactor = 1.0 / normalizationFactor;
114 for(point = 0; point < num_points; point++){
121 const float real = *inputPtr++ * iNormalizationFactor;
122 const float imag = *inputPtr++ * iNormalizationFactor;
124 *realFFTDataPointsPtr = 10.0*log10f((((real * real) + (imag * imag)) + 1e-20) * invRBW);
126 realFFTDataPointsPtr++;
unsigned __int64 uint64_t
Definition: stdint.h:90
float complex lv_32fc_t
Definition: volk_complex.h:56