Commit b9fc7cc5 authored by Laurent THOMAS's avatar Laurent THOMAS Committed by Robert Schmidt

replace a useless and inefficient pointer argument to a const direct value passing

Signed-off-by: default avatarLaurent THOMAS <laurent.thomas@open-cells.com>
parent f1e5d1fb
...@@ -231,8 +231,8 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -231,8 +231,8 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
current_phase1 = cmin(abs(current_phase1),127); current_phase1 = cmin(abs(current_phase1),127);
current_phase2 = cmin(abs(current_phase2), 127); current_phase2 = cmin(abs(current_phase2), 127);
// rotate channel estimates by estimated phase // rotate channel estimates by estimated phase
rotate_cpx_vector(ul_ch1, &ru1[current_phase1], &ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], Msc_RS, 15); rotate_cpx_vector(ul_ch1, ru1[current_phase1], &ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], Msc_RS, 15);
rotate_cpx_vector(ul_ch2, &ru2[current_phase2], tmp_estimates, Msc_RS, 15); rotate_cpx_vector(ul_ch2, ru2[current_phase2], tmp_estimates, Msc_RS, 15);
// Combine the two rotated estimates // Combine the two rotated estimates
mult_complex_vector_real_scalar(&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], mult_complex_vector_real_scalar(&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
SCALE, SCALE,
...@@ -436,8 +436,8 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -436,8 +436,8 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
current_phase1 = cmin(abs(current_phase1),127); current_phase1 = cmin(abs(current_phase1),127);
current_phase2 = cmin(abs(current_phase2), 127); current_phase2 = cmin(abs(current_phase2), 127);
// rotate channel estimates by estimated phase // rotate channel estimates by estimated phase
rotate_cpx_vector(ul_ch1, &ru1[current_phase1], &ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], Msc_RS, 15); rotate_cpx_vector(ul_ch1, ru1[current_phase1], &ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], Msc_RS, 15);
rotate_cpx_vector(ul_ch2, &ru2[current_phase2], tmp_estimates, Msc_RS, 15); rotate_cpx_vector(ul_ch2, ru2[current_phase2], tmp_estimates, Msc_RS, 15);
// Combine the two rotated estimates // Combine the two rotated estimates
mult_complex_vector_real_scalar(&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], mult_complex_vector_real_scalar(&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
SCALE, SCALE,
......
...@@ -283,15 +283,15 @@ void apply_nr_rotation_TX(const NR_DL_FRAME_PARMS *fp, ...@@ -283,15 +283,15 @@ void apply_nr_rotation_TX(const NR_DL_FRAME_PARMS *fp,
symbol_rotation += symb_offset; symbol_rotation += symb_offset;
for (int sidx = first_symbol; sidx < first_symbol + nsymb; sidx++) { for (int sidx = first_symbol; sidx < first_symbol + nsymb; sidx++) {
const c16_t *this_rotation = symbol_rotation + sidx; const c16_t this_rotation = symbol_rotation[sidx];
c16_t *this_symbol = (txdataF) + sidx * fp->ofdm_symbol_size; c16_t *this_symbol = txdataF + sidx * fp->ofdm_symbol_size;
LOG_D(PHY,"Rotating symbol %d, slot %d, symbol_subframe_index %d (%d,%d)\n", LOG_D(PHY,"Rotating symbol %d, slot %d, symbol_subframe_index %d (%d,%d)\n",
sidx, sidx,
slot, slot,
sidx + symb_offset, sidx + symb_offset,
this_rotation->r, this_rotation.r,
this_rotation->i); this_rotation.i);
if (is_flat_buff) if (is_flat_buff)
rotate_cpx_vector(this_symbol, this_rotation, this_symbol, nb_rb * NR_NB_SC_PER_RB, 15); rotate_cpx_vector(this_symbol, this_rotation, this_symbol, nb_rb * NR_NB_SC_PER_RB, 15);
......
...@@ -180,8 +180,8 @@ void apply_nr_rotation_symbol_RX(const int symbols_per_slot, ...@@ -180,8 +180,8 @@ void apply_nr_rotation_symbol_RX(const int symbols_per_slot,
c16_t *this_symbol = rxdataF; c16_t *this_symbol = rxdataF;
if (nb_rb & 1) { if (nb_rb & 1) {
rotate_cpx_vector(this_symbol, &rot2, this_symbol, (nb_rb + 1) * 6, 15); rotate_cpx_vector(this_symbol, rot2, this_symbol, (nb_rb + 1) * 6, 15);
rotate_cpx_vector(this_symbol + first_carrier_offset - 6, &rot2, this_symbol + first_carrier_offset - 6, (nb_rb + 1) * 6, 15); rotate_cpx_vector(this_symbol + first_carrier_offset - 6, rot2, this_symbol + first_carrier_offset - 6, (nb_rb + 1) * 6, 15);
mult_cpx_vector(this_symbol, shift_rot, this_symbol, (nb_rb + 1) * 6, 15); mult_cpx_vector(this_symbol, shift_rot, this_symbol, (nb_rb + 1) * 6, 15);
mult_cpx_vector(this_symbol + first_carrier_offset - 6, mult_cpx_vector(this_symbol + first_carrier_offset - 6,
shift_rot + first_carrier_offset - 6, shift_rot + first_carrier_offset - 6,
...@@ -189,8 +189,8 @@ void apply_nr_rotation_symbol_RX(const int symbols_per_slot, ...@@ -189,8 +189,8 @@ void apply_nr_rotation_symbol_RX(const int symbols_per_slot,
(nb_rb + 1) * 6, (nb_rb + 1) * 6,
15); 15);
} else { } else {
rotate_cpx_vector(this_symbol, &rot2, this_symbol, nb_rb * 6, 15); rotate_cpx_vector(this_symbol, rot2, this_symbol, nb_rb * 6, 15);
rotate_cpx_vector(this_symbol + first_carrier_offset, &rot2, this_symbol + first_carrier_offset, nb_rb * 6, 15); rotate_cpx_vector(this_symbol + first_carrier_offset, rot2, this_symbol + first_carrier_offset, nb_rb * 6, 15);
mult_cpx_vector(this_symbol, shift_rot, this_symbol, nb_rb * 6, 15); mult_cpx_vector(this_symbol, shift_rot, this_symbol, nb_rb * 6, 15);
mult_cpx_vector(this_symbol + first_carrier_offset, mult_cpx_vector(this_symbol + first_carrier_offset,
shift_rot + first_carrier_offset, shift_rot + first_carrier_offset,
......
...@@ -734,7 +734,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -734,7 +734,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
printf("[PHY][UL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r, phase_per_symbol[i].i); printf("[PHY][UL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r, phase_per_symbol[i].i);
#endif #endif
rotate_cpx_vector(&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch], rotate_cpx_vector(&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch],
&phase_per_symbol[i], phase_per_symbol[i],
&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch], &pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch],
(nb_rb * NR_NB_SC_PER_RB), (nb_rb * NR_NB_SC_PER_RB),
15); 15);
......
...@@ -1436,7 +1436,7 @@ void nr_pdsch_ptrs_processing(int nbRx, ...@@ -1436,7 +1436,7 @@ void nr_pdsch_ptrs_processing(int nbRx,
#ifdef DEBUG_DL_PTRS #ifdef DEBUG_DL_PTRS
printf("[PHY][DL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r, phase_per_symbol[i].i); printf("[PHY][DL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r, phase_per_symbol[i].i);
#endif #endif
rotate_cpx_vector(rxdataF_comp[i][0][aarx], &phase_per_symbol[i], rxdataF_comp[i][0][aarx], nb_rb * NR_NB_SC_PER_RB, 15); rotate_cpx_vector(rxdataF_comp[i][0][aarx], phase_per_symbol[i], rxdataF_comp[i][0][aarx], nb_rb * NR_NB_SC_PER_RB, 15);
}// if not DMRS Symbol }// if not DMRS Symbol
}// symbol loop }// symbol loop
}// last symbol check }// last symbol check
......
...@@ -262,7 +262,7 @@ bool nr_search_ssb_common(nr_ssb_search_params_t *params) ...@@ -262,7 +262,7 @@ bool nr_search_ssb_common(nr_ssb_search_params_t *params)
return true; return true;
} }
void nr_scan_ssb(void *arg) static void nr_scan_ssb(void *arg)
{ {
/* Initial synchronisation /* Initial synchronisation
* *
......
...@@ -33,7 +33,7 @@ static void BM_rotate_cpx_vector(benchmark::State &state) ...@@ -33,7 +33,7 @@ static void BM_rotate_cpx_vector(benchmark::State &state)
output.resize(vector_size); output.resize(vector_size);
int shift = 2; int shift = 2;
for (auto _ : state) { for (auto _ : state) {
rotate_cpx_vector(input_complex_16.data(), input_alpha.data(), output.data(), vector_size, shift); rotate_cpx_vector(input_complex_16.data(), input_alpha.data()[0], output.data(), vector_size, shift);
} }
} }
......
...@@ -702,18 +702,18 @@ static inline idft_size_idx_t get_idft(int size) ...@@ -702,18 +702,18 @@ static inline idft_size_idx_t get_idft(int size)
return IDFT_SIZE_IDXTABLESIZE; // never reached and will trigger assertion in idft function return IDFT_SIZE_IDXTABLESIZE; // never reached and will trigger assertion in idft function
} }
/*!\fn int32_t rotate_cpx_vector(c16_t *x,c16_t alpha,c16_t *y,uint32_t N,uint16_t output_shift)
/*!\fn int32_t rotate_cpx_vector(c16_t *x,c16_t *alpha,c16_t *y,uint32_t N,uint16_t output_shift)
This function performs componentwise multiplication of a vector with a complex scalar. This function performs componentwise multiplication of a vector with a complex scalar.
@param x Vector input (Q1.15) in the format |Re0 Im0|,......,|Re(N-1) Im(N-1)| @param x Vector input (Q1.15) in the format |Re0 Im0|,......,|Re(N-1) Im(N-1)|
@param alpha Scalar input (Q1.15) in the format |Re0 Im0| @param alpha Scalar input (Q1.15) in the format |Re0 Im0|
@param y Output (Q1.15) in the format |Re0 Im0|,......,|Re(N-1) Im(N-1)| @param y Output (Q1.15) in the format |Re0 Im0|,......,|Re(N-1) Im(N-1)|
@param N Length of x WARNING: N>=4 @param N Length of x WARNING: N>=4
@param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!! @param output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause
overflow!!
The function implemented is : \f$\mathbf{y} = \alpha\mathbf{x}\f$ The function implemented is : \f$\mathbf{y} = \alpha\mathbf{x}\f$
*/ */
static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const alpha, c16_t *y, uint32_t N, uint16_t output_shift) static inline void rotate_cpx_vector(const c16_t *const x, const c16_t alpha, c16_t *y, uint32_t N, uint16_t output_shift)
{ {
// multiply a complex vector with a complex value (alpha) // multiply a complex vector with a complex value (alpha)
// stores result in y // stores result in y
...@@ -723,9 +723,9 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al ...@@ -723,9 +723,9 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al
if (__builtin_cpu_supports("avx2")) { if (__builtin_cpu_supports("avx2")) {
// output is 32 bytes aligned, but not the input // output is 32 bytes aligned, but not the input
const c16_t for_re = {alpha->r, (int16_t)-alpha->i}; const c16_t for_re = {alpha.r, (int16_t)-alpha.i};
const simde__m256i alpha_for_real = simde_mm256_set1_epi32(*(uint32_t *)&for_re); const simde__m256i alpha_for_real = simde_mm256_set1_epi32(*(uint32_t *)&for_re);
const c16_t for_im = {alpha->i, alpha->r}; const c16_t for_im = {alpha.i, alpha.r};
const simde__m256i alpha_for_im = simde_mm256_set1_epi32(*(uint32_t *)&for_im); const simde__m256i alpha_for_im = simde_mm256_set1_epi32(*(uint32_t *)&for_im);
const simde__m256i perm_mask = simde_mm256_set_epi8(31, const simde__m256i perm_mask = simde_mm256_set_epi8(31,
30, 30,
...@@ -769,10 +769,10 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al ...@@ -769,10 +769,10 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al
const simde__m256i tmp = simde_mm256_packs_epi32(xre, xim); const simde__m256i tmp = simde_mm256_packs_epi32(xre, xim);
simde_mm256_storeu_si256(yd, simde_mm256_shuffle_epi8(tmp, perm_mask)); simde_mm256_storeu_si256(yd, simde_mm256_shuffle_epi8(tmp, perm_mask));
} }
c16_t *alpha16 = (c16_t *)alpha, *yLast; c16_t *yLast;
yLast = ((c16_t *)y) + (N / 8) * 8; yLast = ((c16_t *)y) + (N / 8) * 8;
for (c16_t *xTail = (c16_t *)end; xTail < ((c16_t *)x) + N; xTail++, yLast++) { for (c16_t *xTail = (c16_t *)end; xTail < ((c16_t *)x) + N; xTail++, yLast++) {
*yLast = c16mulShift(*xTail, *alpha16, output_shift); *yLast = c16mulShift(*xTail, alpha, output_shift);
} }
} else { } else {
#endif #endif
...@@ -794,8 +794,8 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al ...@@ -794,8 +794,8 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al
#ifdef __aarch64__ #ifdef __aarch64__
if (output_shift == 15) { // allows specific NEON instruction if (output_shift == 15) { // allows specific NEON instruction
int16x8_t ar = (int16x8_t)vdupq_n_s16(alpha->r); int16x8_t ar = (int16x8_t)vdupq_n_s16(alpha.r);
int16x8_t ai = (int16x8_t)vdupq_n_s16(alpha->i); int16x8_t ai = (int16x8_t)vdupq_n_s16(alpha.i);
int16x8_t *y_128 = (int16x8_t *)y; int16x8_t *y_128 = (int16x8_t *)y;
int16x8_t *x_128 = (int16x8_t *)x; int16x8_t *x_128 = (int16x8_t *)x;
for (uint32_t i = 0; i < (N >> 2); i++) { for (uint32_t i = 0; i < (N >> 2); i++) {
...@@ -853,14 +853,14 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al ...@@ -853,14 +853,14 @@ static inline void rotate_cpx_vector(const c16_t *const x, const c16_t *const al
simde__m128i shift = simde_mm_cvtsi32_si128(output_shift); simde__m128i shift = simde_mm_cvtsi32_si128(output_shift);
((int16_t *)&alpha_128)[0] = alpha->r; ((int16_t *)&alpha_128)[0] = alpha.r;
((int16_t *)&alpha_128)[1] = -alpha->i; ((int16_t *)&alpha_128)[1] = (int16_t)-alpha.i;
((int16_t *)&alpha_128)[2] = alpha->i; ((int16_t *)&alpha_128)[2] = alpha.i;
((int16_t *)&alpha_128)[3] = alpha->r; ((int16_t *)&alpha_128)[3] = alpha.r;
((int16_t *)&alpha_128)[4] = alpha->r; ((int16_t *)&alpha_128)[4] = alpha.r;
((int16_t *)&alpha_128)[5] = -alpha->i; ((int16_t *)&alpha_128)[5] = (int16_t)-alpha.i;
((int16_t *)&alpha_128)[6] = alpha->i; ((int16_t *)&alpha_128)[6] = alpha.i;
((int16_t *)&alpha_128)[7] = alpha->r; ((int16_t *)&alpha_128)[7] = alpha.r;
y_128 = (simd_q15_t *)y; y_128 = (simd_q15_t *)y;
for (i = 0; i < N >> 2; i++) { for (i = 0; i < N >> 2; i++) {
......
...@@ -448,7 +448,7 @@ void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, con ...@@ -448,7 +448,7 @@ void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, con
const c16_t rot_vec = get_sin_cos(CHUNK * phase_inc); const c16_t rot_vec = get_sin_cos(CHUNK * phase_inc);
while (size > CHUNK) { while (size > CHUNK) {
mult_complex_vectors(rxdata_in, rot, rxdata_out, CHUNK, 14); mult_complex_vectors(rxdata_in, rot, rxdata_out, CHUNK, 14);
rotate_cpx_vector(rot, &rot_vec, rot, CHUNK, 14); rotate_cpx_vector(rot, rot_vec, rot, CHUNK, 14);
rxdata_in += CHUNK; rxdata_in += CHUNK;
rxdata_out += CHUNK; rxdata_out += CHUNK;
size -= CHUNK; size -= CHUNK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment