diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index a1684309374aafe5d158da4abb097c4b6229ab9f..109bfbb812913b0d7bfaabb98e7048d86c2233aa 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -1107,7 +1107,6 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB, uint16_t noise_real[frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length]; uint16_t noise_imag[frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length]; - int16_t prev_ls_estimated[2]; int16_t ls_estimated[2]; for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++) { @@ -1131,27 +1130,25 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB, ls_estimated[1] = (int16_t)(((int32_t)generated_real*received_imag - (int32_t)generated_imag*received_real)>>nr_srs_info->srs_generated_signal_bits); srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]] = ls_estimated[0] + (((int32_t)ls_estimated[1] << 16) & 0xFFFF0000); - if(sc_idx>0 && nr_srs_info->sc_list[sc_idx] > nr_srs_info->sc_list[sc_idx - 1]) { - ls_estimated[0] = (ls_estimated[0] + prev_ls_estimated[0])>>1; - ls_estimated[1] = (ls_estimated[1] + prev_ls_estimated[1])>>1; - } - prev_ls_estimated[0] = (int16_t)(((int32_t)generated_real*received_real + (int32_t)generated_imag*received_imag)>>nr_srs_info->srs_generated_signal_bits); - prev_ls_estimated[1] = (int16_t)(((int32_t)generated_real*received_imag - (int32_t)generated_imag*received_real)>>nr_srs_info->srs_generated_signal_bits); - // Channel interpolation if(srs_pdu->comb_size == 0) { - if(sc_idx == 0) { - multadd_real_vector_complex_scalar(filt8_l0, ls_estimated, srs_estimated_channel16, 8); - } else if(nr_srs_info->sc_list[sc_idx] < nr_srs_info->sc_list[sc_idx - 1]) { + if(sc_idx == 0) { // First subcarrier case + // filt8_start is {12288,8192,4096,0,0,0,0,0} + multadd_real_vector_complex_scalar(filt8_start, ls_estimated, srs_estimated_channel16, 8); + } else if(nr_srs_info->sc_list[sc_idx] < nr_srs_info->sc_list[sc_idx - 1]) { // Start of OFDM symbol case + // filt8_start is {12288,8192,4096,0,0,0,0,0} srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx + 2]] - 8; - multadd_real_vector_complex_scalar(filt8_l0, ls_estimated, srs_estimated_channel16, 8); - } else if((sc_idx < (nr_srs_info->sc_list_length - 1) && nr_srs_info->sc_list[sc_idx + 1] < nr_srs_info->sc_list[sc_idx]) || (sc_idx == (nr_srs_info->sc_list_length - 1))) { - multadd_real_vector_complex_scalar(filt8_m0, ls_estimated, srs_estimated_channel16, 8); - srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx] + 1] = srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]; - } else if(sc_idx%2 == 1) { - multadd_real_vector_complex_scalar(filt8_m0, ls_estimated, srs_estimated_channel16, 8); - } else if(sc_idx%2 == 0) { - multadd_real_vector_complex_scalar(filt8_mm0, ls_estimated, srs_estimated_channel16, 8); + multadd_real_vector_complex_scalar(filt8_start, ls_estimated, srs_estimated_channel16, 8); + } else if((sc_idx < (nr_srs_info->sc_list_length - 1) && nr_srs_info->sc_list[sc_idx + 1] < nr_srs_info->sc_list[sc_idx]) + || (sc_idx == (nr_srs_info->sc_list_length - 1))) { // End of OFDM symbol or last subcarrier cases + // filt8_end is {4096,8192,12288,16384,0,0,0,0} + multadd_real_vector_complex_scalar(filt8_end, ls_estimated, srs_estimated_channel16, 8); + } else if(sc_idx%2 == 1) { // 1st middle case + // filt8_middle2 is {4096,8192,8192,8192,4096,0,0,0} + multadd_real_vector_complex_scalar(filt8_middle2, ls_estimated, srs_estimated_channel16, 8); + } else if(sc_idx%2 == 0) { // 2nd middle case + // filt8_middle4 is {0,0,4096,8192,8192,8192,4096,0} + multadd_real_vector_complex_scalar(filt8_middle4, ls_estimated, srs_estimated_channel16, 8); srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]; } } else { @@ -1173,9 +1170,6 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB, } } - noise_real[ant*nr_srs_info->sc_list_length + sc_idx] = abs(prev_ls_estimated[0] - (int16_t)(srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]] & 0xFFFF)); - noise_imag[ant*nr_srs_info->sc_list_length + sc_idx] = abs(prev_ls_estimated[1] - (int16_t)((srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]] >> 16) & 0xFFFF)); - #ifdef SRS_DEBUG uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_pdu->bwp_start*12; int subcarrier_log = nr_srs_info->sc_list[sc_idx]-subcarrier_offset; @@ -1193,10 +1187,16 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB, subcarrier_log, generated_real, generated_imag, received_real, received_imag, - prev_ls_estimated[0], prev_ls_estimated[1]); + ls_estimated[0], ls_estimated[1]); #endif } + // Compute noise + for(int sc_idx = 0; sc_idx < nr_srs_info->sc_list_length; sc_idx++) { + noise_real[ant*nr_srs_info->sc_list_length + sc_idx] = abs((int16_t)((srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]]-srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]) & 0xFFFF)); + noise_imag[ant*nr_srs_info->sc_list_length + sc_idx] = abs((int16_t)(((srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]]-srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]) >> 16) & 0xFFFF)); + } + // Convert to time domain freq2time(gNB->frame_parms.ofdm_symbol_size, (int16_t*) srs_estimated_channel_freq[ant], diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c index 65ae28825201321ced5139d9bc785e2284f1f076..5152f6eb65fc5b077a19f159ee0380882fa40906 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c @@ -260,3 +260,16 @@ short filt8_avlip5[8] = { short filt8_avlip6[8] = { 13653,15019,16384,16384,16384,16384,16384,16384}; + +// Comb size 2 +short filt8_start[8] = { + 12288,8192,4096,0,0,0,0,0}; + +short filt8_middle2[8] = { + 4096,8192,8192,8192,4096,0,0,0}; + +short filt8_middle4[8] = { + 0,0,4096,8192,8192,8192,4096,0}; + +short filt8_end[8] = { + 4096,8192,12288,16384,0,0,0,0}; \ No newline at end of file diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h index e28736b51daf45dc7c133f1f210d46c89abfd571..6ddc03ecd9d331f6da7078ef4222f07aae20c0f5 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h @@ -182,4 +182,10 @@ extern short filt8_avlip4[8]; extern short filt8_avlip5[8]; extern short filt8_avlip6[8]; + +/*Comb size 2*/ +extern short filt8_start[8]; +extern short filt8_middle2[8]; +extern short filt8_middle4[8]; +extern short filt8_end[8]; #endif