diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 433a1ac3d1..9c3736ac2a 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -151,7 +151,7 @@ populates UL_INFO.uci_ind, actual uci data is in gNB->pucch {: .func4} * nr_ulsch_extract_rbs_single() {: .func4} - * nr_ulsch_scale_channel() + * nr_scale_channel() {: .func4} * nr_ulsch_channel_level() {: .func4} diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index bd4ee92284..28f3e2cc67 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -159,42 +159,6 @@ static void nr_ulsch_extract_rbs(c16_t* const rxdataF, } } -static void nr_ulsch_scale_channel(int size_est, - int ul_ch_estimates_ext[][size_est], - NR_DL_FRAME_PARMS *frame_parms, - uint8_t symbol, - uint8_t is_dmrs_symbol, - uint32_t len, - uint8_t nrOfLayers, - unsigned short nb_rb, - int shift_ch_ext) -{ - // Determine scaling amplitude based the symbol - int b = 3; - short ch_amp = 1024 * 8; - if (shift_ch_ext > 3) { - b = 0; - ch_amp >>= (shift_ch_ext - 3); - if (ch_amp == 0) { - ch_amp = 1; - } - } else { - b -= shift_ch_ext; - } - simde__m128i ch_amp128 = simde_mm_set1_epi16(ch_amp); // Q3.13 - LOG_D(PHY, "Scaling PUSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", symbol, ch_amp, is_dmrs_symbol, nb_rb, frame_parms->Ncp, symbol); - - for (int aatx = 0; aatx < nrOfLayers; aatx++) { - for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { - simde__m128i *ul_ch128 = (simde__m128i *)&ul_ch_estimates_ext[aatx * frame_parms->nb_antennas_rx + aarx][symbol * len]; - for (int i = 0; i < len >> 2; i++) { - ul_ch128[i] = simde_mm_mulhi_epi16(ul_ch128[i], ch_amp128); - ul_ch128[i] = simde_mm_slli_epi16(ul_ch128[i], b); - } - } - } -} - static int get_nb_re_pusch (NR_DL_FRAME_PARMS *frame_parms, nfapi_nr_pusch_pdu_t *rel15_ul,int symbol) { uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01; @@ -1375,15 +1339,13 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, //---------------------------------------------------------- //--------------------- Channel Scaling -------------------- //---------------------------------------------------------- - nr_ulsch_scale_channel(size_est, - ul_ch_estimates_ext, - frame_parms, - meas_symbol, - (rel15_ul->ul_dmrs_symb_pos >> meas_symbol) & 0x01, - nb_re_pusch, - rel15_ul->nrOfLayers, - rel15_ul->rb_size, - shift_ch_ext); + nr_scale_channel(size_est, + ul_ch_estimates_ext, + meas_symbol, + nb_re_pusch, + rel15_ul->nrOfLayers, + frame_parms->nb_antennas_rx, + shift_ch_ext); int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers]; nr_channel_level(meas_symbol, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 7eff76e91f..5e677b542b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -193,15 +193,6 @@ static void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, unsigned char output_shift, PHY_NR_MEASUREMENTS *measurements); -void nr_dlsch_scale_channel(uint32_t rx_size_symbol, - int32_t dl_ch_estimates_ext[][rx_size_symbol], - NR_DL_FRAME_PARMS *frame_parms, - uint8_t n_tx, - uint8_t n_rx, - uint8_t symbol, - uint8_t pilots, - uint32_t len, - unsigned short nb_rb); static void nr_dlsch_detection_mrc(uint32_t rx_size_symbol, short nl, short n_rx, @@ -508,7 +499,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //--------------------- Channel Scaling -------------------- //---------------------------------------------------------- start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_SCALE_STATS); - nr_dlsch_scale_channel(rx_size_symbol, dl_ch_estimates_ext, fp, nl, n_rx, symbol, pilots, nb_re_pdsch, nb_rb_pdsch); + nr_scale_channel(rx_size_symbol, dl_ch_estimates_ext, 0, nb_re_pdsch, nl, n_rx, 0); stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_SCALE_STATS); if (meas_enabled) { LOG_D(PHY, @@ -921,53 +912,6 @@ static void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, } } -void nr_dlsch_scale_channel(uint32_t rx_size_symbol, - int32_t dl_ch_estimates_ext[][rx_size_symbol], - NR_DL_FRAME_PARMS *fp, - uint8_t n_tx, - uint8_t n_rx, - uint8_t symbol, - uint8_t pilots, - uint32_t len, - unsigned short nb_rb) - -{ - short rb, ch_amp; - unsigned char aatx,aarx; - simde__m128i *dl_ch128, ch_amp128; - uint32_t nb_rb_0 = len/12 + ((len%12)?1:0); - - // Determine scaling amplitude based the symbol - ch_amp = 1024 * 8; //((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a)); - LOG_D(PHY, - "Scaling PDSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", - symbol, - ch_amp, - pilots, - nb_rb, - fp->Ncp, - symbol); - // printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); - - ch_amp128 = simde_mm_set1_epi16(ch_amp); // Q3.13 - for (aatx=0; aatx> 2; + for (int i = 0; i < loop_end; i++) { + ul_ch128[i] = simde_mm_srai_epi16(ul_ch128[i], shift_ch_ext); + } + // loop for the remaining elements + int start_index = loop_end * 4; + for (int j = start_index; j < len; j++) { + c16_t *temp = ((c16_t *)ul_ch128) + j; + *temp = c16Shift(*temp, shift_ch_ext); + } + } + } +} void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, const c16_t *rxdata_in, c16_t *rxdata_out, int size) {