48 #ifndef INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H
49 #define INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H
56 #include <immintrin.h>
60 const float* realDataPoints,
61 const float spectralExclusionValue,
62 const unsigned int num_points)
64 unsigned int number = 0;
65 const unsigned int eighthPoints = num_points / 8;
67 const float* dataPointsPtr = realDataPoints;
71 __m256 avgPointsVal = _mm256_setzero_ps();
73 for (; number < eighthPoints; number++) {
75 dataPointsVal = _mm256_load_ps(dataPointsPtr);
79 avgPointsVal = _mm256_add_ps(avgPointsVal, dataPointsVal);
82 _mm256_store_ps(avgPointsVector, avgPointsVal);
85 sumMean += avgPointsVector[0];
86 sumMean += avgPointsVector[1];
87 sumMean += avgPointsVector[2];
88 sumMean += avgPointsVector[3];
89 sumMean += avgPointsVector[4];
90 sumMean += avgPointsVector[5];
91 sumMean += avgPointsVector[6];
92 sumMean += avgPointsVector[7];
94 number = eighthPoints * 8;
95 for (; number < num_points; number++) {
96 sumMean += realDataPoints[number];
102 const float meanAmplitude = (sumMean / ((float)num_points)) + spectralExclusionValue;
104 dataPointsPtr = realDataPoints;
105 __m256 vMeanAmplitudeVector = _mm256_set1_ps(meanAmplitude);
106 __m256 vOnesVector = _mm256_set1_ps(1.0);
107 __m256 vValidBinCount = _mm256_setzero_ps();
108 avgPointsVal = _mm256_setzero_ps();
112 for (; number < eighthPoints; number++) {
114 dataPointsVal = _mm256_load_ps(dataPointsPtr);
119 compareMask = _mm256_cmp_ps(dataPointsVal, vMeanAmplitudeVector, _CMP_LE_OQ);
124 _mm256_add_ps(avgPointsVal, _mm256_and_ps(compareMask, dataPointsVal));
128 _mm256_add_ps(vValidBinCount, _mm256_and_ps(compareMask, vOnesVector));
132 _mm256_store_ps(avgPointsVector, avgPointsVal);
135 sumMean += avgPointsVector[0];
136 sumMean += avgPointsVector[1];
137 sumMean += avgPointsVector[2];
138 sumMean += avgPointsVector[3];
139 sumMean += avgPointsVector[4];
140 sumMean += avgPointsVector[5];
141 sumMean += avgPointsVector[6];
142 sumMean += avgPointsVector[7];
146 _mm256_store_ps(validBinCountVector, vValidBinCount);
148 float validBinCount = 0;
149 validBinCount += validBinCountVector[0];
150 validBinCount += validBinCountVector[1];
151 validBinCount += validBinCountVector[2];
152 validBinCount += validBinCountVector[3];
153 validBinCount += validBinCountVector[4];
154 validBinCount += validBinCountVector[5];
155 validBinCount += validBinCountVector[6];
156 validBinCount += validBinCountVector[7];
158 number = eighthPoints * 8;
159 for (; number < num_points; number++) {
160 if (realDataPoints[number] <= meanAmplitude) {
161 sumMean += realDataPoints[number];
162 validBinCount += 1.0;
166 float localNoiseFloorAmplitude = 0;
167 if (validBinCount > 0.0) {
168 localNoiseFloorAmplitude = sumMean / validBinCount;
170 localNoiseFloorAmplitude =
174 *noiseFloorAmplitude = localNoiseFloorAmplitude;
179 #include <xmmintrin.h>
183 const float* realDataPoints,
184 const float spectralExclusionValue,
185 const unsigned int num_points)
187 unsigned int number = 0;
188 const unsigned int quarterPoints = num_points / 4;
190 const float* dataPointsPtr = realDataPoints;
196 for (; number < quarterPoints; number++) {
202 avgPointsVal =
_mm_add_ps(avgPointsVal, dataPointsVal);
208 sumMean += avgPointsVector[0];
209 sumMean += avgPointsVector[1];
210 sumMean += avgPointsVector[2];
211 sumMean += avgPointsVector[3];
213 number = quarterPoints * 4;
214 for (; number < num_points; number++) {
215 sumMean += realDataPoints[number];
221 const float meanAmplitude = (sumMean / ((float)num_points)) + spectralExclusionValue;
223 dataPointsPtr = realDataPoints;
231 for (; number < quarterPoints; number++) {
238 compareMask =
_mm_cmple_ps(dataPointsVal, vMeanAmplitudeVector);
252 sumMean += avgPointsVector[0];
253 sumMean += avgPointsVector[1];
254 sumMean += avgPointsVector[2];
255 sumMean += avgPointsVector[3];
261 float validBinCount = 0;
262 validBinCount += validBinCountVector[0];
263 validBinCount += validBinCountVector[1];
264 validBinCount += validBinCountVector[2];
265 validBinCount += validBinCountVector[3];
267 number = quarterPoints * 4;
268 for (; number < num_points; number++) {
269 if (realDataPoints[number] <= meanAmplitude) {
270 sumMean += realDataPoints[number];
271 validBinCount += 1.0;
275 float localNoiseFloorAmplitude = 0;
276 if (validBinCount > 0.0) {
277 localNoiseFloorAmplitude = sumMean / validBinCount;
279 localNoiseFloorAmplitude =
283 *noiseFloorAmplitude = localNoiseFloorAmplitude;
288 #ifdef LV_HAVE_GENERIC
292 const float* realDataPoints,
293 const float spectralExclusionValue,
294 const unsigned int num_points)
299 for (number = 0; number < num_points; number++) {
301 sumMean += realDataPoints[number];
307 const float meanAmplitude = (sumMean / num_points) + spectralExclusionValue;
311 unsigned int newNumDataPoints = num_points;
312 for (number = 0; number < num_points; number++) {
313 if (realDataPoints[number] <= meanAmplitude)
314 sumMean += realDataPoints[number];
319 float localNoiseFloorAmplitude = 0.0;
320 if (newNumDataPoints == 0)
321 localNoiseFloorAmplitude = meanAmplitude;
323 localNoiseFloorAmplitude = sumMean / ((float)newNumDataPoints);
325 *noiseFloorAmplitude = localNoiseFloorAmplitude;
332 #ifndef INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_u_H
333 #define INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_u_H
335 #include <inttypes.h>
340 #include <immintrin.h>
344 const float* realDataPoints,
345 const float spectralExclusionValue,
346 const unsigned int num_points)
348 unsigned int number = 0;
349 const unsigned int eighthPoints = num_points / 8;
351 const float* dataPointsPtr = realDataPoints;
354 __m256 dataPointsVal;
355 __m256 avgPointsVal = _mm256_setzero_ps();
357 for (; number < eighthPoints; number++) {
359 dataPointsVal = _mm256_loadu_ps(dataPointsPtr);
363 avgPointsVal = _mm256_add_ps(avgPointsVal, dataPointsVal);
366 _mm256_storeu_ps(avgPointsVector, avgPointsVal);
369 sumMean += avgPointsVector[0];
370 sumMean += avgPointsVector[1];
371 sumMean += avgPointsVector[2];
372 sumMean += avgPointsVector[3];
373 sumMean += avgPointsVector[4];
374 sumMean += avgPointsVector[5];
375 sumMean += avgPointsVector[6];
376 sumMean += avgPointsVector[7];
378 number = eighthPoints * 8;
379 for (; number < num_points; number++) {
380 sumMean += realDataPoints[number];
386 const float meanAmplitude = (sumMean / ((float)num_points)) + spectralExclusionValue;
388 dataPointsPtr = realDataPoints;
389 __m256 vMeanAmplitudeVector = _mm256_set1_ps(meanAmplitude);
390 __m256 vOnesVector = _mm256_set1_ps(1.0);
391 __m256 vValidBinCount = _mm256_setzero_ps();
392 avgPointsVal = _mm256_setzero_ps();
396 for (; number < eighthPoints; number++) {
398 dataPointsVal = _mm256_loadu_ps(dataPointsPtr);
403 compareMask = _mm256_cmp_ps(dataPointsVal, vMeanAmplitudeVector, _CMP_LE_OQ);
408 _mm256_add_ps(avgPointsVal, _mm256_and_ps(compareMask, dataPointsVal));
412 _mm256_add_ps(vValidBinCount, _mm256_and_ps(compareMask, vOnesVector));
416 _mm256_storeu_ps(avgPointsVector, avgPointsVal);
419 sumMean += avgPointsVector[0];
420 sumMean += avgPointsVector[1];
421 sumMean += avgPointsVector[2];
422 sumMean += avgPointsVector[3];
423 sumMean += avgPointsVector[4];
424 sumMean += avgPointsVector[5];
425 sumMean += avgPointsVector[6];
426 sumMean += avgPointsVector[7];
430 _mm256_storeu_ps(validBinCountVector, vValidBinCount);
432 float validBinCount = 0;
433 validBinCount += validBinCountVector[0];
434 validBinCount += validBinCountVector[1];
435 validBinCount += validBinCountVector[2];
436 validBinCount += validBinCountVector[3];
437 validBinCount += validBinCountVector[4];
438 validBinCount += validBinCountVector[5];
439 validBinCount += validBinCountVector[6];
440 validBinCount += validBinCountVector[7];
442 number = eighthPoints * 8;
443 for (; number < num_points; number++) {
444 if (realDataPoints[number] <= meanAmplitude) {
445 sumMean += realDataPoints[number];
446 validBinCount += 1.0;
450 float localNoiseFloorAmplitude = 0;
451 if (validBinCount > 0.0) {
452 localNoiseFloorAmplitude = sumMean / validBinCount;
454 localNoiseFloorAmplitude =
458 *noiseFloorAmplitude = localNoiseFloorAmplitude;
float32x4_t __m128
Definition: sse2neon.h:235
FORCE_INLINE __m128 _mm_cmple_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1175
FORCE_INLINE __m128 _mm_set_ps1(float)
Definition: sse2neon.h:2437
FORCE_INLINE __m128 _mm_setzero_ps(void)
Definition: sse2neon.h:2531
FORCE_INLINE __m128 _mm_and_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1064
FORCE_INLINE __m128 _mm_add_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1039
FORCE_INLINE __m128 _mm_load_ps(const float *p)
Definition: sse2neon.h:1858
FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
Definition: sse2neon.h:2704
static void volk_32f_s32f_calc_spectral_noise_floor_32f_u_avx(float *noiseFloorAmplitude, const float *realDataPoints, const float spectralExclusionValue, const unsigned int num_points)
Definition: volk_32f_s32f_calc_spectral_noise_floor_32f.h:343
static void volk_32f_s32f_calc_spectral_noise_floor_32f_generic(float *noiseFloorAmplitude, const float *realDataPoints, const float spectralExclusionValue, const unsigned int num_points)
Definition: volk_32f_s32f_calc_spectral_noise_floor_32f.h:291
static void volk_32f_s32f_calc_spectral_noise_floor_32f_a_sse(float *noiseFloorAmplitude, const float *realDataPoints, const float spectralExclusionValue, const unsigned int num_points)
Definition: volk_32f_s32f_calc_spectral_noise_floor_32f.h:182
static void volk_32f_s32f_calc_spectral_noise_floor_32f_a_avx(float *noiseFloorAmplitude, const float *realDataPoints, const float spectralExclusionValue, const unsigned int num_points)
Definition: volk_32f_s32f_calc_spectral_noise_floor_32f.h:59
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:65