58 #ifndef INCLUDED_volk_32f_index_min_16u_a_H
59 #define INCLUDED_volk_32f_index_min_16u_a_H
67 #include <immintrin.h>
72 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
73 const uint32_t eighthPoints = num_points / 8;
75 float* inputPtr = (
float*)source;
77 __m256 indexIncrementValues = _mm256_set1_ps(8);
78 __m256 currentIndexes = _mm256_set_ps(-1, -2, -3, -4, -5, -6, -7, -8);
80 float min = source[0];
82 __m256 minValues = _mm256_set1_ps(min);
83 __m256 minValuesIndex = _mm256_setzero_ps();
84 __m256 compareResults;
90 for (uint32_t number = 0; number < eighthPoints; number++) {
92 currentValues = _mm256_load_ps(inputPtr);
94 currentIndexes = _mm256_add_ps(currentIndexes, indexIncrementValues);
96 compareResults = _mm256_cmp_ps(currentValues, minValues, _CMP_LT_OS);
98 minValuesIndex = _mm256_blendv_ps(minValuesIndex, currentIndexes, compareResults);
99 minValues = _mm256_blendv_ps(minValues, currentValues, compareResults);
103 _mm256_store_ps(minValuesBuffer, minValues);
104 _mm256_store_ps(minIndexesBuffer, minValuesIndex);
106 for (uint32_t number = 0; number < 8; number++) {
107 if (minValuesBuffer[number] < min) {
108 index = minIndexesBuffer[number];
109 min = minValuesBuffer[number];
110 }
else if (minValuesBuffer[number] == min) {
111 if (index > minIndexesBuffer[number])
112 index = minIndexesBuffer[number];
116 for (uint32_t number = eighthPoints * 8; number < num_points; number++) {
117 if (source[number] < min) {
119 min = source[number];
122 target[0] = (uint16_t)index;
127 #ifdef LV_HAVE_SSE4_1
128 #include <smmintrin.h>
130 static inline void volk_32f_index_min_16u_a_sse4_1(uint16_t* target,
134 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
135 const uint32_t quarterPoints = num_points / 4;
137 float* inputPtr = (
float*)source;
142 float min = source[0];
152 for (uint32_t number = 0; number < quarterPoints; number++) {
156 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
158 compareResults =
_mm_cmplt_ps(currentValues, minValues);
160 minValuesIndex =
_mm_blendv_ps(minValuesIndex, currentIndexes, compareResults);
161 minValues =
_mm_blendv_ps(minValues, currentValues, compareResults);
168 for (uint32_t number = 0; number < 4; number++) {
169 if (minValuesBuffer[number] < min) {
170 index = minIndexesBuffer[number];
171 min = minValuesBuffer[number];
172 }
else if (minValuesBuffer[number] == min) {
173 if (index > minIndexesBuffer[number])
174 index = minIndexesBuffer[number];
178 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
179 if (source[number] < min) {
181 min = source[number];
184 target[0] = (uint16_t)index;
192 #include <xmmintrin.h>
197 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
198 const uint32_t quarterPoints = num_points / 4;
200 float* inputPtr = (
float*)source;
205 float min = source[0];
215 for (uint32_t number = 0; number < quarterPoints; number++) {
219 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
221 compareResults =
_mm_cmplt_ps(currentValues, minValues);
233 for (uint32_t number = 0; number < 4; number++) {
234 if (minValuesBuffer[number] < min) {
235 index = minIndexesBuffer[number];
236 min = minValuesBuffer[number];
237 }
else if (minValuesBuffer[number] == min) {
238 if (index > minIndexesBuffer[number])
239 index = minIndexesBuffer[number];
243 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
244 if (source[number] < min) {
246 min = source[number];
249 target[0] = (uint16_t)index;
255 #ifdef LV_HAVE_GENERIC
260 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
262 float min = source[0];
265 for (uint32_t
i = 1;
i < num_points; ++
i) {
266 if (source[
i] < min) {
280 #ifndef INCLUDED_volk_32f_index_min_16u_u_H
281 #define INCLUDED_volk_32f_index_min_16u_u_H
283 #include <inttypes.h>
289 #include <immintrin.h>
294 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
295 const uint32_t eighthPoints = num_points / 8;
297 float* inputPtr = (
float*)source;
299 __m256 indexIncrementValues = _mm256_set1_ps(8);
300 __m256 currentIndexes = _mm256_set_ps(-1, -2, -3, -4, -5, -6, -7, -8);
302 float min = source[0];
304 __m256 minValues = _mm256_set1_ps(min);
305 __m256 minValuesIndex = _mm256_setzero_ps();
306 __m256 compareResults;
307 __m256 currentValues;
312 for (uint32_t number = 0; number < eighthPoints; number++) {
314 currentValues = _mm256_loadu_ps(inputPtr);
316 currentIndexes = _mm256_add_ps(currentIndexes, indexIncrementValues);
318 compareResults = _mm256_cmp_ps(currentValues, minValues, _CMP_LT_OS);
320 minValuesIndex = _mm256_blendv_ps(minValuesIndex, currentIndexes, compareResults);
321 minValues = _mm256_blendv_ps(minValues, currentValues, compareResults);
325 _mm256_storeu_ps(minValuesBuffer, minValues);
326 _mm256_storeu_ps(minIndexesBuffer, minValuesIndex);
328 for (uint32_t number = 0; number < 8; number++) {
329 if (minValuesBuffer[number] < min) {
330 index = minIndexesBuffer[number];
331 min = minValuesBuffer[number];
332 }
else if (minValuesBuffer[number] == min) {
333 if (index > minIndexesBuffer[number])
334 index = minIndexesBuffer[number];
338 for (uint32_t number = eighthPoints * 8; number < num_points; number++) {
339 if (source[number] < min) {
341 min = source[number];
344 target[0] = (uint16_t)index;
float32x4_t __m128
Definition: sse2neon.h:235
FORCE_INLINE __m128 _mm_set_ps(float w, float z, float y, float x)
Definition: sse2neon.h:2429
FORCE_INLINE __m128 _mm_set1_ps(float _w)
Definition: sse2neon.h:2503
FORCE_INLINE __m128 _mm_andnot_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1079
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_blendv_ps(__m128 _a, __m128 _b, __m128 _mask)
Definition: sse2neon.h:7458
FORCE_INLINE __m128 _mm_add_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1039
FORCE_INLINE __m128 _mm_cmplt_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1190
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
FORCE_INLINE __m128 _mm_or_ps(__m128, __m128)
Definition: sse2neon.h:2237
static void volk_32f_index_min_16u_a_avx(uint16_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_16u.h:70
static void volk_32f_index_min_16u_generic(uint16_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_16u.h:258
static void volk_32f_index_min_16u_a_sse(uint16_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_16u.h:195
static void volk_32f_index_min_16u_u_avx(uint16_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_16u.h:292
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:65
for i
Definition: volk_config_fixed.tmpl.h:13