61 #ifndef VOLK_KERNELS_VOLK_VOLK_32F_8U_POLARBUTTERFLY_32F_H_
62 #define VOLK_KERNELS_VOLK_VOLK_32F_8U_POLARBUTTERFLY_32F_H_
66 static inline float llr_odd(
const float la,
const float lb)
68 const float ala = fabsf(la);
69 const float alb = fabsf(lb);
70 return copysignf(1.0f, la) * copysignf(1.0f, lb) * (ala > alb ? alb : ala);
74 float* llrs,
int min_stage,
const int depth,
const int frame_size,
const int row)
76 int loop_stage = depth - 1;
79 int stage_size = 0x01 << loop_stage;
82 while (min_stage <= loop_stage) {
83 dst_llr_ptr = llrs + loop_stage * frame_size + row;
84 src_llr_ptr = dst_llr_ptr + frame_size;
85 for (el = 0; el < stage_size; el++) {
86 *dst_llr_ptr++ =
llr_odd(*src_llr_ptr, *(src_llr_ptr + 1));
95 static inline float llr_even(
const float la,
const float lb,
const unsigned char f)
106 even_u_values(
unsigned char* u_even,
const unsigned char* u,
const int u_num)
110 for (
i = 1;
i < u_num;
i += 2) {
120 for (
i = 1;
i < u_num;
i += 2) {
121 *u_xor++ = *u ^ *(u + 1);
128 int max_stage_depth = 0;
129 int half_stage_size = 0x01;
130 int stage_size = half_stage_size << 1;
131 while (max_stage_depth < (frame_exp - 1)) {
132 if (!(row % stage_size < half_stage_size)) {
135 half_stage_size <<= 1;
139 return max_stage_depth;
142 #ifdef LV_HAVE_GENERIC
151 const int frame_size = 0x01 << frame_exp;
152 const int next_stage = stage + 1;
154 const int half_stage_size = 0x01 << stage;
155 const int stage_size = half_stage_size << 1;
157 const bool is_upper_stage_half = row % stage_size < half_stage_size;
160 float* next_llrs = llrs + frame_size;
161 float* call_row_llr = llrs + row;
163 const int section = row - (row % stage_size);
164 const int jump_size = ((row % half_stage_size) << 1) % stage_size;
166 const int next_upper_row = section + jump_size;
167 const int next_lower_row = next_upper_row + 1;
169 const float* upper_right_llr_ptr = next_llrs + next_upper_row;
170 const float* lower_right_llr_ptr = next_llrs + next_lower_row;
172 if (!is_upper_stage_half) {
173 const int u_pos = u_num >> stage;
174 const unsigned char f = u[u_pos - 1];
175 *call_row_llr =
llr_even(*upper_right_llr_ptr, *lower_right_llr_ptr, f);
179 if (frame_exp > next_stage) {
180 unsigned char* u_half = u + frame_size;
183 next_llrs, u_half, frame_exp, next_stage, u_num, next_upper_row);
187 next_llrs, u_half, frame_exp, next_stage, u_num, next_lower_row);
190 *call_row_llr =
llr_odd(*upper_right_llr_ptr, *lower_right_llr_ptr);
197 #include <immintrin.h>
207 const int frame_size = 0x01 << frame_exp;
209 const float* next_llrs = llrs + frame_size + row;
210 *(llrs + row) =
llr_even(*(next_llrs - 1), *next_llrs, u[u_num - 1]);
215 if (max_stage_depth < 3) {
220 int loop_stage = max_stage_depth;
221 int stage_size = 0x01 << loop_stage;
226 __m256 src0, src1, dst;
231 unsigned char* u_target = u + frame_size;
232 unsigned char* u_temp = u + 2 * frame_size;
233 memcpy(u_temp, u + u_num - stage_size,
sizeof(
unsigned char) * stage_size);
235 if (stage_size > 15) {
241 src_llr_ptr = llrs + (max_stage_depth + 1) * frame_size + row - stage_size;
242 dst_llr_ptr = llrs + max_stage_depth * frame_size + row;
247 for (p = 0; p < stage_size; p += 8) {
251 src0 = _mm256_loadu_ps(src_llr_ptr);
252 src1 = _mm256_loadu_ps(src_llr_ptr + 8);
257 _mm256_storeu_ps(dst_llr_ptr, dst);
265 const int min_stage = stage > 2 ? stage : 2;
270 while (min_stage < loop_stage) {
271 dst_llr_ptr = llrs + loop_stage * frame_size + row;
272 src_llr_ptr = dst_llr_ptr + frame_size;
273 for (el = 0; el < stage_size; el += 8) {
274 src0 = _mm256_loadu_ps(src_llr_ptr);
276 src1 = _mm256_loadu_ps(src_llr_ptr);
281 _mm256_storeu_ps(dst_llr_ptr, dst);
296 #include <immintrin.h>
299 static inline void volk_32f_8u_polarbutterfly_32f_u_avx2(
float* llrs,
306 const int frame_size = 0x01 << frame_exp;
308 const float* next_llrs = llrs + frame_size + row;
309 *(llrs + row) =
llr_even(*(next_llrs - 1), *next_llrs, u[u_num - 1]);
314 if (max_stage_depth < 3) {
319 int loop_stage = max_stage_depth;
320 int stage_size = 0x01 << loop_stage;
325 __m256 src0, src1, dst;
330 unsigned char* u_target = u + frame_size;
331 unsigned char* u_temp = u + 2 * frame_size;
332 memcpy(u_temp, u + u_num - stage_size,
sizeof(
unsigned char) * stage_size);
334 if (stage_size > 15) {
340 src_llr_ptr = llrs + (max_stage_depth + 1) * frame_size + row - stage_size;
341 dst_llr_ptr = llrs + max_stage_depth * frame_size + row;
346 for (p = 0; p < stage_size; p += 8) {
350 src0 = _mm256_loadu_ps(src_llr_ptr);
351 src1 = _mm256_loadu_ps(src_llr_ptr + 8);
356 _mm256_storeu_ps(dst_llr_ptr, dst);
364 const int min_stage = stage > 2 ? stage : 2;
369 while (min_stage < loop_stage) {
370 dst_llr_ptr = llrs + loop_stage * frame_size + row;
371 src_llr_ptr = dst_llr_ptr + frame_size;
372 for (el = 0; el < stage_size; el += 8) {
373 src0 = _mm256_loadu_ps(src_llr_ptr);
375 src1 = _mm256_loadu_ps(src_llr_ptr);
380 _mm256_storeu_ps(dst_llr_ptr, dst);
FORCE_INLINE __m128i _mm_loadu_si128(const __m128i *p)
Definition: sse2neon.h:4570
int64x2_t __m128i
Definition: sse2neon.h:244
static float llr_even(const float la, const float lb, const unsigned char f)
Definition: volk_32f_8u_polarbutterfly_32f.h:95
static void llr_odd_stages(float *llrs, int min_stage, const int depth, const int frame_size, const int row)
Definition: volk_32f_8u_polarbutterfly_32f.h:73
static void odd_xor_even_values(unsigned char *u_xor, const unsigned char *u, const int u_num)
Definition: volk_32f_8u_polarbutterfly_32f.h:117
static void volk_32f_8u_polarbutterfly_32f_generic(float *llrs, unsigned char *u, const int frame_exp, const int stage, const int u_num, const int row)
Definition: volk_32f_8u_polarbutterfly_32f.h:144
static void volk_32f_8u_polarbutterfly_32f_u_avx(float *llrs, unsigned char *u, const int frame_exp, const int stage, const int u_num, const int row)
Definition: volk_32f_8u_polarbutterfly_32f.h:200
static void even_u_values(unsigned char *u_even, const unsigned char *u, const int u_num)
Definition: volk_32f_8u_polarbutterfly_32f.h:106
static int calculate_max_stage_depth_for_row(const int frame_exp, const int row)
Definition: volk_32f_8u_polarbutterfly_32f.h:126
static float llr_odd(const float la, const float lb)
Definition: volk_32f_8u_polarbutterfly_32f.h:66
static void volk_8u_x2_encodeframepolar_8u_generic(unsigned char *frame, unsigned char *temp, unsigned int frame_size)
Definition: volk_8u_x2_encodeframepolar_8u.h:52
static void volk_8u_x2_encodeframepolar_8u_u_ssse3(unsigned char *frame, unsigned char *temp, unsigned int frame_size)
Definition: volk_8u_x2_encodeframepolar_8u.h:76
static __m256 _mm256_polar_fsign_add_llrs_avx2(__m256 src0, __m256 src1, __m128i fbits)
Definition: volk_avx2_intrinsics.h:68
static __m256 _mm256_polar_minsum_llrs(__m256 src0, __m256 src1)
Definition: volk_avx_intrinsics.h:154
static __m256 _mm256_polar_fsign_add_llrs(__m256 src0, __m256 src1, __m128i fbits)
Definition: volk_avx_intrinsics.h:171
for i
Definition: volk_config_fixed.tmpl.h:13