NR_UE: fix possible overflow in PRB based PDSCH channel estimation
This commit is contained in:
@@ -1200,49 +1200,52 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
else if (config_type == pdsch_dmrs_type1) { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 6 DMRS REs and use a common value for the whole PRB
|
else if (config_type == pdsch_dmrs_type1) { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 6 DMRS REs and use a common value for the whole PRB
|
||||||
|
|
||||||
for (pilot_cnt=0; pilot_cnt<6*nb_rb_pdsch; pilot_cnt += 6) {
|
for (pilot_cnt=0; pilot_cnt<6*nb_rb_pdsch; pilot_cnt += 6) {
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
int32_t ch_0, ch_1;
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
|
||||||
|
ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
|
ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
ch[0]/=6;
|
|
||||||
ch[1]/=6;
|
ch[0] = ch_0 / 6;
|
||||||
|
ch[1] = ch_1 / 6;
|
||||||
((__m128i*)dl_ch)[0]=_mm_set1_epi32(*(int32_t*)ch);
|
((__m128i*)dl_ch)[0]=_mm_set1_epi32(*(int32_t*)ch);
|
||||||
((__m128i*)dl_ch)[1]=((__m128i*)dl_ch)[0];
|
((__m128i*)dl_ch)[1]=((__m128i*)dl_ch)[0];
|
||||||
((__m128i*)dl_ch)[2]=((__m128i*)dl_ch)[0];
|
((__m128i*)dl_ch)[2]=((__m128i*)dl_ch)[0];
|
||||||
@@ -1251,36 +1254,38 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
else { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 4 DMRS REs and use a common value for the whole PRB
|
else { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 4 DMRS REs and use a common value for the whole PRB
|
||||||
for (pilot_cnt=0; pilot_cnt<4*nb_rb_pdsch; pilot_cnt += 4) {
|
for (pilot_cnt=0; pilot_cnt<4*nb_rb_pdsch; pilot_cnt += 4) {
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
int32_t ch_0, ch_1;
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
|
||||||
|
ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
|
ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
|
|
||||||
ch[0] += (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
|
||||||
ch[1] += (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
|
||||||
|
|
||||||
|
|
||||||
pil += 2;
|
pil += 2;
|
||||||
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||||
ch[0] /=4 ;
|
|
||||||
ch[1] /=4 ;
|
ch[0] = ch_0 / 4;
|
||||||
|
ch[1] = ch_1 / 4;
|
||||||
((__m128i*)dl_ch)[0]=_mm_set1_epi32(*(int32_t*)ch);
|
((__m128i*)dl_ch)[0]=_mm_set1_epi32(*(int32_t*)ch);
|
||||||
((__m128i*)dl_ch)[1]=((__m128i*)dl_ch)[0];
|
((__m128i*)dl_ch)[1]=((__m128i*)dl_ch)[0];
|
||||||
((__m128i*)dl_ch)[2]=((__m128i*)dl_ch)[0];
|
((__m128i*)dl_ch)[2]=((__m128i*)dl_ch)[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user