set correct parameter type, and fuse funcions that do same real/complex vector operations, doing this, fix a lot of unitary multiplications (else there would be numerous cast operations

This commit is contained in:
Laurent THOMAS
2025-04-25 14:47:59 +02:00
parent 95ae7772bf
commit 7982a9da41
21 changed files with 766 additions and 1465 deletions
@@ -287,9 +287,9 @@ void init_fde() {
}
void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
c16_t **rxdataF_comp,
c16_t **ul_ch_mag,
c16_t **ul_ch_magb,
uint8_t symbol,
uint16_t Msc_RS,
uint8_t Qm)
@@ -41,12 +41,10 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
int8_t uespec_nushift, uespec_poffset=0, pil_offset=0;
uint8_t pilot0,pilot1,pilot2,pilot3;
short ch[2], *pil, *rxF, *dl_bf_ch, *dl_bf_ch_prev;
short *fl=NULL, *fm=NULL, *fr=NULL, *fl_dc=NULL, *fm_dc=NULL, *fr_dc=NULL, *f1, *f2l=NULL, *f2r=NULL;
int16_t *fl = NULL, *fm = NULL, *fr = NULL, *fl_dc = NULL, *fm_dc = NULL, *fr_dc = NULL, *f1, *f2l = NULL, *f2r = NULL;
unsigned int *rballoc;
unsigned int *rballoc;
int **rxdataF;
int32_t **dl_bf_ch_estimates;
int uespec_pilot[300];
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
@@ -64,7 +62,8 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
rxdataF = phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[Ns>>1]].rxdataF;
dl_bf_ch_estimates = phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[Ns>>1]][eNB_id]->dl_bf_ch_estimates;
c16_t **dl_bf_ch_estimates =
(c16_t **)phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[Ns >> 1]][eNB_id]->dl_bf_ch_estimates;
beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0;
if (phy_vars_ue->high_speed_flag == 0) // use second channel estimate position for temporary storage
@@ -177,10 +176,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
rxF = (short *)&rxdataF[aarx][pil_offset + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size];
pil = (short *)uespec_pilot;
dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset];
c16_t *rxF = (c16_t *)&rxdataF[aarx][pil_offset + frame_parms->first_carrier_offset + symbol * frame_parms->ofdm_symbol_size];
c16_t *pil = (c16_t *)uespec_pilot;
c16_t *dl_bf_ch = &dl_bf_ch_estimates[aarx][ch_offset];
memset(dl_bf_ch,0,4*(frame_parms->ofdm_symbol_size));
//memset(dl_bf_ch,0,2*(frame_parms->ofdm_symbol_size));
@@ -188,9 +186,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
if (phy_vars_ue->high_speed_flag==0) {
// multiply previous channel estimate by ch_est_alpha
if (frame_parms->Ncp==0){
mult_complex_vector_real_scalar(dl_bf_ch - (frame_parms->ofdm_symbol_size << 1),
mult_complex_vector_real_scalar(dl_bf_ch - frame_parms->ofdm_symbol_size,
phy_vars_ue->ch_est_alpha,
dl_bf_ch - (frame_parms->ofdm_symbol_size << 1),
dl_bf_ch - frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
} else {
LOG_E(PHY,"lte_dl_bf_channel_estimation: beamforming channel estimation not supported for TM7 Extended CP.\n"); // phy_vars_ue->ch_est_beta should be defined equaling 1/3
@@ -214,25 +212,16 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
// For second half of RBs skip DC carrier
if (rb==(frame_parms->N_RB_DL>>1)) {
rxF = (short *)&rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))];
rxF = (c16_t *)&rxdataF[aarx][1 + symbol * frame_parms->ofdm_symbol_size];
}
if (rb_alloc_ind==1) {
if (uespec_pilots==1) {
if (beamforming_mode==7) {
if (frame_parms->Ncp==0) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16);
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16);
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16);
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil, rxF[0], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fm, c16mulShift(*pil, rxF[4], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil, rxF[8], 15), dl_bf_ch, 16);
} else {
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n");
exit(-1);
@@ -243,8 +232,8 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
}
}
rxF+=24;
dl_bf_ch+=24;
rxF += 12;
dl_bf_ch += 12;
}
} else { // Odd number of RBs
for (rb=0; rb<frame_parms->N_RB_DL>>1; rb++) {
@@ -320,71 +309,22 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
if (frame_parms->Ncp==0) {
if (skip_half==1) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f2l, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(f2r, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f1, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
}
} else if (skip_half==2) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f1, c16mulShift(*pil++, rxF[8], 15), dl_bf_ch, 16);
} else {
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f2l, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(f2r, c16mulShift(*pil++, rxF[8], 15), dl_bf_ch, 16);
}
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
printf("symbol=%d,rxF[4]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
printf("symbol=%d,rxF[8]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fm, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, rxF[8], 15), dl_bf_ch, 16);
}
} else {
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n");
@@ -395,10 +335,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n");
}
}
}
rxF+=24;
dl_bf_ch+=24;
}
rxF += 12;
dl_bf_ch += 12;
} // first half loop
// Do middle RB (around DC)
@@ -440,65 +379,25 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
//printf("DC rb %d (%p)\n",rb,rxF);
if (rb_alloc_ind==1) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
//printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
//printf("symbol=%d,rxF[4]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;;
multadd_real_vector_complex_scalar(fl_dc, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fm_dc, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)];
ch[0] = (short)(((int)pil[0]*rxF[6] - (int)pil[1]*rxF[7])>>15);
ch[1] = (short)(((int)pil[0]*rxF[7] + (int)pil[1]*rxF[6])>>15);
multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
//printf("symbol=%d,rxF[3]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[6],rxF[7],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;;
rxF = (c16_t *)&rxdataF[aarx][symbol * (frame_parms->ofdm_symbol_size)];
multadd_real_vector_complex_scalar(fr_dc, c16mulShift(*pil++, rxF[3], 15), dl_bf_ch, 16);
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
//printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;;
rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)];
multadd_real_vector_complex_scalar(fl_dc, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
ch[0] = (short)(((int)pil[0]*rxF[2] - (int)pil[1]*rxF[3])>>15);
ch[1] = (short)(((int)pil[0]*rxF[3] + (int)pil[1]*rxF[2])>>15);
multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
//printf("symbol=%d,rxF[1]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[2],rxF[3],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;;
ch[0] = (short)(((int)pil[0]*rxF[10] - (int)pil[1]*rxF[11])>>15);
ch[1] = (short)(((int)pil[0]*rxF[11] + (int)pil[1]*rxF[10])>>15);
multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
//printf("symbol=%d,rxF[5]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[10],rxF[11],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;;
rxF = (c16_t *)&rxdataF[aarx][symbol * (frame_parms->ofdm_symbol_size)];
multadd_real_vector_complex_scalar(fm_dc, c16mulShift(*pil++, rxF[1], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fr_dc, c16mulShift(*pil++, rxF[5], 15), dl_bf_ch, 16);
}
} // rballoc==1
else {
rxF = (short *)&rxdataF[aarx][pil_offset+((symbol*(frame_parms->ofdm_symbol_size)))];
rxF = (c16_t *)&rxdataF[aarx][pil_offset + symbol * frame_parms->ofdm_symbol_size];
}
rxF+=14+2*pil_offset;
dl_bf_ch+=24;
rxF += 7 + pil_offset;
dl_bf_ch += 12;
rb++;
for (; rb<frame_parms->N_RB_DL; rb++) {
@@ -567,72 +466,22 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
if (frame_parms->Ncp==0) {
if (skip_half==1) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f2l, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(f2r, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f1, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
}
} else if (skip_half==2) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f1, c16mulShift(*pil++, rxF[8], 15), dl_bf_ch, 16);
} else {
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
multadd_real_vector_complex_scalar(f2l, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(f2r, c16mulShift(*pil++, rxF[8], 15), dl_bf_ch, 16);
}
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
printf("symbol=%d,rxF[4]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16);
#ifdef DEBUG_BF_CH
printf("symbol=%d,rxF[8]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]);
#endif
pil+=2;
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, rxF[0], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fm, c16mulShift(*pil++, rxF[4], 15), dl_bf_ch, 16);
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, rxF[8], 15), dl_bf_ch, 16);
}
} else {
LOG_E(PHY,"lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n");
@@ -645,15 +494,14 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
}
}
rxF+=24;
dl_bf_ch+=24;
rxF += 12;
dl_bf_ch += 12;
} // second half of RBs
} // odd number of RBs
// Temporal Interpolation
if (phy_vars_ue->perfect_ce == 0) {
dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset];
dl_bf_ch = &dl_bf_ch_estimates[aarx][ch_offset];
#ifdef DEBUG_BF_CH
printf("[dlsch_bf_ch_est.c]:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]);
#endif
@@ -661,7 +509,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
if (phy_vars_ue->high_speed_flag == 0) {
multadd_complex_vector_real_scalar(dl_bf_ch,
32767 - phy_vars_ue->ch_est_alpha,
dl_bf_ch - (frame_parms->ofdm_symbol_size << 1),
dl_bf_ch - frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
//printf("dlsch_bf_ch_est.c:symbol %d,dl_bf_ch (%d,%d)\n",symbol,*(dl_bf_ch-512*2),*(dl_bf_ch-512*2+1));
} else { // high_speed_flag == 1
@@ -670,48 +518,48 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
if (symbol == pilot0) {
// printf("Interpolating %d->0\n",4-phy_vars_ue->lte_frame_parms.Ncp);
// dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][(4-phy_vars_ue->lte_frame_parms.Ncp)*(frame_parms->ofdm_symbol_size)];
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot3*(frame_parms->ofdm_symbol_size)];
c16_t *dl_bf_ch_prev = (c16_t *)&dl_bf_ch_estimates[aarx][pilot3 * (frame_parms->ofdm_symbol_size)];
#ifdef DEBUG_BF_CH
printf("[dlsch_bf_ch_est.c] symbol=%d, dl_bf_ch_prev=(%d,%d), dl_bf_ch=(%d,%d)\n", symbol, dl_bf_ch_prev[0], dl_bf_ch_prev[1], dl_bf_ch[0], dl_bf_ch[1]);
#endif
// pilot spacing 5 symbols (1/5,2/5,3/5,4/5 combination)
mult_complex_vector_real_scalar(dl_bf_ch_prev,
26214,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
6554,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
mult_complex_vector_real_scalar(dl_bf_ch_prev,
19661,
dl_bf_ch - (3 * 2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch - 3 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
13107,
dl_bf_ch - (3 * 2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch - 3 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
mult_complex_vector_real_scalar(dl_bf_ch_prev,
13107,
dl_bf_ch - (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch - 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
19661,
dl_bf_ch - (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch - 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
mult_complex_vector_real_scalar(dl_bf_ch_prev,
6554,
dl_bf_ch - (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch - frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
26214,
dl_bf_ch - (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch - frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
} else if (symbol == pilot1) {
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot0*(frame_parms->ofdm_symbol_size)];
c16_t *dl_bf_ch_prev = &dl_bf_ch_estimates[aarx][pilot0 * (frame_parms->ofdm_symbol_size)];
#ifdef DEBUG_BF_CH
printf("[dlsch_bf_ch_est.c] symbol=%d, dl_bf_ch_prev=(%d,%d), dl_bf_ch=(%d,%d)\n", symbol, dl_bf_ch_prev[0], dl_bf_ch_prev[1], dl_bf_ch[0], dl_bf_ch[1]);
#endif
@@ -719,66 +567,66 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
// pilot spacing 3 symbols (1/3,2/3 combination)
mult_complex_vector_real_scalar(dl_bf_ch_prev,
21845,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
10923,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
mult_complex_vector_real_scalar(dl_bf_ch_prev,
10923,
dl_bf_ch_prev + (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch_prev + 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
21845,
dl_bf_ch_prev + (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch_prev + 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
} else if (symbol == pilot2) {
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot1*(frame_parms->ofdm_symbol_size)];
c16_t *dl_bf_ch_prev = &dl_bf_ch_estimates[aarx][pilot1 * frame_parms->ofdm_symbol_size];
#ifdef DEBUG_BF_CH
printf("[dlsch_bf_ch_est.c] symbol=%d, dl_bf_ch_prev=(%d,%d), dl_bf_ch=(%d,%d)\n", symbol, dl_bf_ch_prev[0], dl_bf_ch_prev[1], dl_bf_ch[0], dl_bf_ch[1]);
#endif
mult_complex_vector_real_scalar(dl_bf_ch_prev,
21845,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
10923,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
mult_complex_vector_real_scalar(dl_bf_ch_prev,
10923,
dl_bf_ch_prev + (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch_prev + 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
21845,
dl_bf_ch_prev + (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch_prev + 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
} else { // symbol == pilot3
// printf("Interpolating 0->%d\n",4-phy_vars_ue->lte_frame_parms.Ncp);
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot2*(frame_parms->ofdm_symbol_size)];
c16_t *dl_bf_ch_prev = &dl_bf_ch_estimates[aarx][pilot2 * frame_parms->ofdm_symbol_size];
// pilot spacing 3 symbols (1/3,2/3 combination)
mult_complex_vector_real_scalar(dl_bf_ch_prev,
21845,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
10923,
dl_bf_ch_prev + (2 * (frame_parms->ofdm_symbol_size)),
dl_bf_ch_prev + frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
mult_complex_vector_real_scalar(dl_bf_ch_prev,
10923,
dl_bf_ch_prev + (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch_prev + 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,
21845,
dl_bf_ch_prev + (2 * ((frame_parms->ofdm_symbol_size) << 1)),
dl_bf_ch_prev + 2 * frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size);
}
@@ -790,12 +638,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
}
}
}
} //aarx
#ifdef DEBUG_BF_CH
printf("[dlsch_bf_ch_est.c]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]);
#endif
} // aarx
return(0);
}
@@ -39,7 +39,7 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
unsigned char nu,aarx;
unsigned short k;
unsigned int rb,pilot_cnt;
int16_t ch[2],*pil,*rxF,*dl_ch,*dl_ch_prev,*f,*f2,*fl,*f2l2,*fr,*f2r2,*f2_dc,*f_dc;
int16_t *f, *f2, *fl, *f2l2, *fr, *f2r2, *f2_dc, *f_dc;
int ch_offset,symbol_offset;
// unsigned int n;
// int i;
@@ -177,16 +177,16 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
p);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
pil = (int16_t *)&pilot[p][0];
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+k+ue->frame_parms.first_carrier_offset))];
dl_ch = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset];
c16_t *pil = (c16_t *)&pilot[p][0];
c16_t *rxF = (c16_t *)&rxdataF[aarx][symbol_offset + k + ue->frame_parms.first_carrier_offset];
c16_t *dl_ch = (c16_t *)&dl_ch_estimates[(p << 1) + aarx][ch_offset];
// if (eNb_id==0)
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size));
memset(dl_ch, 0, sizeof(c16_t) * ue->frame_parms.ofdm_symbol_size);
if (ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha
mult_complex_vector_real_scalar(dl_ch - (ue->frame_parms.ofdm_symbol_size << 1),
mult_complex_vector_real_scalar(dl_ch - ue->frame_parms.ofdm_symbol_size,
ue->ch_est_alpha,
dl_ch - (ue->frame_parms.ofdm_symbol_size << 1),
dl_ch - ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.ofdm_symbol_size);
#ifdef DEBUG_CH
@@ -196,352 +196,97 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
if ((ue->frame_parms.N_RB_DL==6) ||
(ue->frame_parms.N_RB_DL==50) ||
(ue->frame_parms.N_RB_DL==100)) {
//First half of pilots
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 0 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fl,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(f2l2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
// First half of pilots
// Treat first 2 pilots specially (left edge)
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2l2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
for (pilot_cnt=2; pilot_cnt<((ue->frame_parms.N_RB_DL)-1); pilot_cnt+=2) {
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); //Re
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); //Im
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (pilot_cnt = 2; pilot_cnt < ((ue->frame_parms.N_RB_DL) - 1); pilot_cnt += 2) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
// printf("Second half\n");
// Second half of RBs
k = (nu + nushift)%6;
if (k > 6)
k -=6;
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
#ifdef DEBUG_CH
printf("second half k %d\n",k);
#endif
for (pilot_cnt=0; pilot_cnt<((ue->frame_parms.N_RB_DL)-3); pilot_cnt+=2) {
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
rxF = (c16_t *)&rxdataF[aarx][symbol_offset + 1 + k];
for (pilot_cnt = 0; pilot_cnt < ((ue->frame_parms.N_RB_DL) - 3); pilot_cnt += 2) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2r2, c16mulShift(*pil, rxF[0], 15), dl_ch, 24);
} else if (ue->frame_parms.N_RB_DL == 25) {
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2l2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fr,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(f2r2,
ch,
dl_ch,
24);
} else if (ue->frame_parms.N_RB_DL==25) {
//printf("Channel estimation\n");
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 0 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(fl,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f2l2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (pilot_cnt=2; pilot_cnt<24; pilot_cnt+=2) {
// printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
// printf("rx[%d][%d] -> (%d,%d)\n",p,ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),rxF[0],rxF[1]);
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (pilot_cnt = 2; pilot_cnt < 24; pilot_cnt += 2) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 24: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f_dc,
ch,
dl_ch,
24);
pil+=2; // Re Im
dl_ch+=8;
// printf("Second half\n");
multadd_real_vector_complex_scalar(f_dc, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
dl_ch += 4;
// Second half of RBs
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 25: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f2_dc,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (pilot_cnt=0; pilot_cnt<22; pilot_cnt+=2) {
// printf("* pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
// printf("rx[%d][%d] -> (%d,%d)\n",p,ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),rxF[0],rxF[1]);
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",26+pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot %u : rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",27+pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
rxF = (c16_t *)&rxdataF[aarx][symbol_offset + 1 + k];
multadd_real_vector_complex_scalar(f2_dc, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
for (pilot_cnt = 0; pilot_cnt < 22; pilot_cnt += 2) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 49: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(fr,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
#ifdef DEBUG_CH
printf("pilot 50: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
// ch[0] = 1024;
// ch[1] = -128;
#endif
multadd_real_vector_complex_scalar(f2r2,
ch,
dl_ch,
24);
} else if (ue->frame_parms.N_RB_DL==15) {
//printf("First Half\n");
for (rb=0; rb<28; rb+=4) {
//printf("aarx=%d\n",aarx);
//printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
//printf("rx[%d][%d] -> (%d,%d)\n",p,
// ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),
// rxF[0],
// rxF[1]);
ch[0] = (int16_t)(((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);
//printf("ch -> (%d,%d)\n",ch[0],ch[1]);
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
//printf("ch -> (%d,%d)\n",ch[0],ch[1]);
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2r2, c16mulShift(*pil, rxF[0], 15), dl_ch, 24);
} else if (ue->frame_parms.N_RB_DL == 15) {
for (rb = 0; rb < 28; rb += 4) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
ch[0] = (int16_t)(((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);
// printf("ch -> (%d,%d)\n",ch[0],ch[1]);
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2; // Re Im
dl_ch+=8;
//printf("Second half\n");
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
dl_ch += 4;
//Second half of RBs
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+nushift + (3*p)))];
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
rxF = (c16_t *)&rxdataF[aarx][((symbol_offset + 1 + nushift + (3 * p)))];
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
for (rb=0; rb<28; rb+=4) {
//printf("aarx=%d\n",aarx);
//printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
//printf("rx[%d][%d] -> (%d,%d)\n",p,
// ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),
// rxF[0],
// rxF[1]);
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (rb = 0; rb < 28; rb += 4) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, rxF[0], 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
} else {
LOG_E(PHY,"channel estimation not implemented for ue->frame_parms.N_RB_DL = %d\n",ue->frame_parms.N_RB_DL);
@@ -550,27 +295,27 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
if (ue->perfect_ce == 0) {
// Temporal Interpolation
// printf("ch_offset %d\n",ch_offset);
dl_ch = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset];
dl_ch = (c16_t *)&dl_ch_estimates[(p << 1) + aarx][ch_offset];
if (ue->high_speed_flag == 0) {
multadd_complex_vector_real_scalar(dl_ch, 32767 - ue->ch_est_alpha, dl_ch - (symb_sz << 1), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32767 - ue->ch_est_alpha, dl_ch - symb_sz, symb_sz);
} else { // high_speed_flag == 1
if (symbol == 0) {
// printf("Interpolating %d->0\n",4-ue->frame_parms.Ncp);
// dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][(4-ue->frame_parms.Ncp)*(symb_sz)];
if(((Ns>>1)!=0) || ( ((Ns>>1)==0) && interpolateS11S12)) {
//LOG_I(PHY,"Interpolate s11-->s0 to get s12 and s13 Ns %d \n", Ns);
dl_ch_prev = (int16_t *)&dl_ch_estimates_previous[(p << 1) + aarx][pilot3 * (symb_sz)];
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 10923, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
c16_t *dl_ch_prev = (c16_t *)&dl_ch_estimates_previous[(p << 1) + aarx][pilot3 * (symb_sz)];
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 10923, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + 2 * symb_sz, symb_sz);
}
interpolateS11S12 = 1;
} // this is 1/3,2/3 combination for pilots spaced by 3 symbols
else if (symbol == pilot1) {
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][0];
c16_t *dl_ch_prev = (c16_t *)&dl_ch_estimates[(p << 1) + aarx][0];
//LOG_I(PHY,"Interpolate s0-->s4 to get s1 s2 and s3 Ns %d \n", Ns);
if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination)
@@ -582,56 +327,56 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
previous_subframe = ((Ns>>1) - 1 )%9;
if((subframe_select(&ue->frame_parms,previous_subframe) == SF_UL)) {
mult_complex_vector_real_scalar(dl_ch_prev, 328, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32440, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 328, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32440, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 8192, dl_ch_prev + (3 * 2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32440, dl_ch_prev + (3 * 2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 328, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32440, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 328, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32440, dl_ch_prev + 2 * symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 8192, dl_ch_prev + 3 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 32440, dl_ch_prev + 3 * symb_sz, symb_sz);
} else {
mult_complex_vector_real_scalar(dl_ch_prev, 24576, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 8192, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 16384, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 16384, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 8192, dl_ch_prev + (3 * 2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 24576, dl_ch_prev + (3 * 2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 24576, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 8192, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 16384, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 16384, dl_ch_prev + 2 * symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 8192, dl_ch_prev + 3 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 24576, dl_ch_prev + 3 * symb_sz, symb_sz);
}
} else {
mult_complex_vector_real_scalar(dl_ch_prev, 328, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + (2 * (symb_sz) << 1), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 328, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + 2 * symb_sz, symb_sz);
} // pilot spacing 3 symbols (1/3,2/3 combination)
} else if (symbol == pilot2) {
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot1 * (symb_sz)];
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 10923, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
c16_t *dl_ch_prev = (c16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot1 * symb_sz];
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 10923, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + 2 * symb_sz, symb_sz);
} else { // symbol == pilot3
// printf("Interpolating 0->%d\n",4-ue->frame_parms.Ncp);
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot2 * (symb_sz)];
c16_t *dl_ch_prev = (c16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot2 * symb_sz];
if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination)
mult_complex_vector_real_scalar(dl_ch_prev, 24576, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 8192, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 16384, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 16384, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 8192, dl_ch_prev + (3 * 2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 24576, dl_ch_prev + (3 * 2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 24576, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 8192, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 16384, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 16384, dl_ch_prev + 2 * symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 8192, dl_ch_prev + 3 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 24576, dl_ch_prev + 3 * symb_sz, symb_sz);
} else {
mult_complex_vector_real_scalar(dl_ch_prev, 10923, dl_ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + (2 * (symb_sz) << 1), symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + (2 * ((symb_sz) << 1)), symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 10923, dl_ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 21845, dl_ch_prev + symb_sz, symb_sz);
mult_complex_vector_real_scalar(dl_ch_prev, 21845, dl_ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar(dl_ch, 10923, dl_ch_prev + 2 * symb_sz, symb_sz);
} // pilot spacing 3 symbols (1/3,2/3 combination)
if((ue->rx_offset_diff !=0) && ((Ns>>1) == 9)) {
//LOG_I(PHY,"Extrapolate s7-->s11 to get s12 and s13 Ns %d\n", Ns);
interpolateS11S12 = 0;
//LOG_E(PHY,"Interpolate s7--s11 s12 s13 pilot 3 Ns %d l %d symbol %d \n", Ns, l, symbol);
int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot3 * (symb_sz)];
int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot2 * (symb_sz)];
int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot3 * symb_sz];
int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][pilot2 * symb_sz];
// interpolate ofdm s12: 5/4*ofdms11 + -1/4*ofdms7 5/4 q1.15 40960 -1/4 q1.15 8192
int16_t *dlChEst_ofdm12 = (int16_t *)&dl_ch_estimates[(p << 1) + aarx][12 * symb_sz];
@@ -46,7 +46,7 @@ int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue,
int pilot[600] __attribute__((aligned(16)));
unsigned char aarx,aa;
unsigned int rb;
short *pil,*rxF,*ch,*ch0,*ch1,*ch11,*chp,*ch_prev;
short *pil, *rxF, *ch, *ch0, *ch1, *ch11, *chp;
int ch_offset,symbol_offset;
// unsigned int n;
// int i;
@@ -684,37 +684,37 @@ int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue,
if (l==6) {
ch = (short *)&dl_ch_estimates[aarx][ch_offset];
// printf("Interpolating ch 2,6 => %d\n",ch_offset);
ch_prev = (short *)&dl_ch_estimates[aarx][2 * (symb_sz)];
c16_t *ch_prev = (c16_t *)&dl_ch_estimates[aarx][2 * symb_sz];
ch0 = (short *)&dl_ch_estimates[aarx][0 * (symb_sz)];
memcpy(ch0, ch_prev, 4 * symb_sz);
ch1 = (short *)&dl_ch_estimates[aarx][1 * (symb_sz)];
memcpy(ch1, ch_prev, 4 * symb_sz);
// 3/4 ch2 + 1/4 ch6 => ch3
mult_complex_vector_real_scalar(ch_prev, 24576, ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(ch, 8192, ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(ch_prev, 24576, ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar((c16_t *)ch, 8192, ch_prev + symb_sz, symb_sz);
// 1/2 ch2 + 1/2 ch6 => ch4
mult_complex_vector_real_scalar(ch_prev, 16384, ch_prev + (4 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(ch, 16384, ch_prev + (4 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(ch_prev, 16384, ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar((c16_t *)ch, 16384, ch_prev + 2 * symb_sz, symb_sz);
// 1/4 ch2 + 3/4 ch6 => ch5
mult_complex_vector_real_scalar(ch_prev, 8192, ch_prev + (6 * ((symb_sz))), symb_sz);
multadd_complex_vector_real_scalar(ch, 24576, ch_prev + (6 * ((symb_sz))), symb_sz);
mult_complex_vector_real_scalar(ch_prev, 8192, ch_prev + 3 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar((c16_t *)ch, 24576, ch_prev + 3 * symb_sz, symb_sz);
}
if (l==10) {
ch = (short *)&dl_ch_estimates[aarx][ch_offset];
ch_prev = (short *)&dl_ch_estimates[aarx][6 * (symb_sz)];
c16_t *ch_prev = (c16_t *)&dl_ch_estimates[aarx][6 * symb_sz];
// 3/4 ch6 + 1/4 ch10 => ch7
mult_complex_vector_real_scalar(ch_prev, 24576, ch_prev + (2 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(ch, 8192, ch_prev + (2 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(ch_prev, 24576, ch_prev + symb_sz, symb_sz);
multadd_complex_vector_real_scalar((c16_t *)ch, 8192, ch_prev + symb_sz, symb_sz);
// 1/2 ch6 + 1/2 ch10 => ch8
mult_complex_vector_real_scalar(ch_prev, 16384, ch_prev + (4 * (symb_sz)), symb_sz);
multadd_complex_vector_real_scalar(ch, 16384, ch_prev + (4 * (symb_sz)), symb_sz);
mult_complex_vector_real_scalar(ch_prev, 16384, ch_prev + 2 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar((c16_t *)ch, 16384, ch_prev + 2 * symb_sz, symb_sz);
// 1/4 ch6 + 3/4 ch10 => ch9
mult_complex_vector_real_scalar(ch_prev, 8192, ch_prev + (6 * ((symb_sz))), symb_sz);
multadd_complex_vector_real_scalar(ch, 24576, ch_prev + (6 * ((symb_sz))), symb_sz);
mult_complex_vector_real_scalar(ch_prev, 8192, ch_prev + 3 * symb_sz, symb_sz);
multadd_complex_vector_real_scalar((c16_t *)ch, 24576, ch_prev + 3 * symb_sz, symb_sz);
// 5/4 ch10 - 1/4 ch6 => ch11
// Ch11
ch_prev = (short *)&dl_ch_estimates[aarx][10 * (symb_sz)];
ch_prev = (c16_t *)&dl_ch_estimates[aarx][10 * (symb_sz)];
ch11 = (short *)&dl_ch_estimates[aarx][11 * (symb_sz)];
memcpy(ch11, ch_prev, 4 * symb_sz);
}
@@ -764,13 +764,10 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
int subframe) {
int pilot_khz_1dot25[2*2*600] __attribute__((aligned(16)));
unsigned char aarx,aa;
//unsigned int rb;
int16_t ch[2];
short *pil,*rxF,*dl_ch/*,*ch0,*ch1,*ch11,*chp,*ch_prev*/;
// unsigned int rb;
int ch_offset,symbol_offset;
int pilot_cnt;
int16_t *f,*f2,*fl,*f2l2,*fr,*f2r2/*,*f2_dc,*f_dc*/;
unsigned int k;
int16_t *f, *f2, *fl, *f2l2, *fr, *f2r2 /*,*f2_dc,*f_dc*/;
// unsigned int n;
// int i;
int **dl_ch_estimates=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0];
@@ -801,101 +798,46 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue,
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
// generate pilot
lte_dl_mbsfn_khz_1dot25_rx(ue,
&pilot_khz_1dot25[0],
subframe);
pil = (short *)&pilot_khz_1dot25[0];
rxF = (short *)&rxdataF[aarx][((ue->frame_parms.first_carrier_offset_khz_1dot25))];
dl_ch = (short *)&dl_ch_estimates[aarx][ch_offset];
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size_khz_1dot25));
lte_dl_mbsfn_khz_1dot25_rx(ue, pilot_khz_1dot25, subframe);
c16_t *pil = (c16_t *)pilot_khz_1dot25;
c16_t *dl_ch = (c16_t *)&dl_ch_estimates[aarx][ch_offset];
memset(dl_ch, 0, sizeof(c16_t) * ue->frame_parms.ofdm_symbol_size_khz_1dot25);
if( (subframe&0x1) == 0) {
rxF+=0;
k=0;
} else {
rxF+=6;//2*3;
k=3;
}
unsigned int k = (subframe & 0x1) == 0 ? 0 : 3;
c16_t *rxF = (c16_t *)&rxdataF[aarx][ue->frame_parms.first_carrier_offset_khz_1dot25 + k];
if(1/*ue->frame_parms.N_RB_DL==25*/) {
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(fl,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f2l2,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=16;
if (1 /*ue->frame_parms.N_RB_DL==25*/) {
multadd_real_vector_complex_scalar(fl, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2l2, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
for(pilot_cnt=2; pilot_cnt<ue->frame_parms.N_RB_DL*12-1/*299*/; pilot_cnt+=2) {
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (pilot_cnt = 2; pilot_cnt < ue->frame_parms.N_RB_DL * 12 - 1 /*299*/; pilot_cnt += 2) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))]; //Skip DC offset
rxF = (c16_t *)&rxdataF[aarx][symbol_offset + 1 + k]; // Skip DC offset
for(pilot_cnt=0; pilot_cnt<ue->frame_parms.N_RB_DL*12-3/*297*/; pilot_cnt+=2) {
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f2,
ch,
dl_ch,
24);
pil+=2;
rxF+=12;
dl_ch+=16;
for (pilot_cnt = 0; pilot_cnt < ue->frame_parms.N_RB_DL * 12 - 3 /*297*/; pilot_cnt += 2) {
multadd_real_vector_complex_scalar(f, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 8;
}
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(fr,
ch,
dl_ch,
24);
pil+=2; // Re Im
rxF+=12;
dl_ch+=8;
ch[0] = (int16_t)(((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);
multadd_real_vector_complex_scalar(f2r2,
ch,
dl_ch,
24);
multadd_real_vector_complex_scalar(fr, c16mulShift(*pil++, *rxF, 15), dl_ch, 24);
rxF += 6;
dl_ch += 4;
multadd_real_vector_complex_scalar(f2r2, c16mulShift(*pil, *rxF, 15), dl_ch, 24);
}
}
+17 -23
View File
@@ -53,9 +53,7 @@ The algorithm uses a time domain correlation with a downsampled version of the r
\param eNB_id return value with the eNb_id
\return sync_pos Position of the sync within the frame (downsampled) if successfull and -1 if there was an error or no peak was detected.
*/
int lte_sync_time(int **rxdata,
LTE_DL_FRAME_PARMS *frame_parms,
int *eNB_id);
int lte_sync_time(c16_t **rxdata, LTE_DL_FRAME_PARMS *frame_parms, int *eNB_id);
/*!
\brief This function performs the coarse frequency and PSS synchronization.
@@ -194,19 +192,19 @@ void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
unsigned char eNB_id);
int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
L1_rxtx_proc_t *proc,
LTE_eNB_ULSCH_t * ulsch,
int32_t **ul_ch_estimates,
int32_t **ul_ch_estimates_time,
int32_t **rxdataF_ext,
module_id_t UE_id,
uint8_t l,
uint8_t Ns);
L1_rxtx_proc_t *proc,
LTE_eNB_ULSCH_t *ulsch,
c16_t **ul_ch_estimates,
c16_t **ul_ch_estimates_time,
c16_t **rxdataF_ext,
module_id_t UE_id,
uint8_t l,
uint8_t Ns);
int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **ul_ch_estimates,
int32_t **ul_ch_estimates_time,
int32_t **rxdataF_ext,
c16_t **ul_ch_estimates,
c16_t **ul_ch_estimates_time,
c16_t **rxdataF_ext,
int N_rb_alloc,
int frame_rx,
int subframe_rx,
@@ -217,9 +215,7 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
int interpolate,
uint16_t rnti);
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
int32_t *ul_ch_estimates,
uint16_t nb_rb);
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, c16_t *ul_ch_estimates, uint16_t nb_rb);
int lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
LTE_eNB_COMMON *eNB_common_vars,
@@ -235,8 +231,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char number_of_cards,
short coef);
int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **ul_ch_estimates_time);
int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms, c16_t **ul_ch_estimates_time);
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNB,
int subframe,
@@ -252,11 +247,10 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *phy_vars_eNBy,
module_id_t UE_id,
unsigned char init_averaging);
void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
int **ul_ch_mag,
int **ul_ch_mag_b,
c16_t **rxdataF_comp,
c16_t **ul_ch_mag,
c16_t **ul_ch_mag_b,
unsigned char symbol,
unsigned short Msc_RS,
unsigned char Qm);
+4 -6
View File
@@ -114,7 +114,7 @@ void lte_sync_time_free(void) {
#define SHIFT 17
int lte_sync_time(int **rxdata, LTE_DL_FRAME_PARMS *frame_parms, int *eNB_id)
int lte_sync_time(c16_t **rxdata, LTE_DL_FRAME_PARMS *frame_parms, int *eNB_id)
{
// perform a time domain correlation using the oversampled sync sequence
unsigned int n, ar, s, peak_pos, peak_val, sync_source;
@@ -135,8 +135,8 @@ int lte_sync_time(int **rxdata, LTE_DL_FRAME_PARMS *frame_parms, int *eNB_id)
//calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n];
for (int i = 0; i < sizeofArray(primary_synch_time); i++)
for (ar = 0; ar < frame_parms->nb_antennas_rx; ar++) {
c32_t result = dot_product(primary_synch_time[i], (c16_t *)&(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
c32_t result2 = dot_product(primary_synch_time[i], (c16_t *)&(rxdata[ar][n + length]), frame_parms->ofdm_symbol_size, SHIFT);
c32_t result = dot_product(primary_synch_time[i], rxdata[ar] + n, frame_parms->ofdm_symbol_size, SHIFT);
c32_t result2 = dot_product(primary_synch_time[i], rxdata[ar] + n + length, frame_parms->ofdm_symbol_size, SHIFT);
sync_out[i].r += result.r;
sync_out[i].i += result.i;
sync_out2[i].r += result2.r;
@@ -228,9 +228,7 @@ int ru_sync_time(RU_t *ru,
// circular copy of beginning to end of rxdata buffer. Note: buffer should be big enough upon calling this function
for (int ar=0; ar<ru->nb_rx; ar++)
memcpy((void *)&ru->common.rxdata[ar][2*length],
(void *)&ru->common.rxdata[ar][0],
frame_parms->ofdm_symbol_size);
memcpy(ru->common.rxdata[ar] + 2 * length, ru->common.rxdata[ar], frame_parms->ofdm_symbol_size);
int32_t maxlev0=0;
int maxpos0=0;
@@ -27,6 +27,7 @@
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
#include "lte_estimation.h"
#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
#include "openair1/PHY/LTE_TRANSPORT/pucch_extern.h"
// round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15))
static const int16_t ru_90[2 * 128] = {
@@ -68,28 +69,26 @@ static const int16_t ru_90c[2 * 128] = {
int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
L1_rxtx_proc_t *proc,
LTE_eNB_ULSCH_t * ulsch,
int32_t **ul_ch_estimates,
int32_t **ul_ch_estimates_time,
int32_t **rxdataF_ext,
LTE_eNB_ULSCH_t *ulsch,
c16_t **ul_ch_estimates,
c16_t **ul_ch_estimates_time,
c16_t **rxdataF_ext,
module_id_t UE_id,
unsigned char l,
unsigned char Ns) {
unsigned char Ns)
{
AssertFatal(ul_ch_estimates != NULL, "ul_ch_estimates is null ");
AssertFatal(ul_ch_estimates_time != NULL, "ul_ch_estimates_time is null\n");
int subframe = proc->subframe_rx;
uint8_t harq_pid;
uint8_t harq_pid;
int16_t delta_phase = 0;
const int16_t *ru1 = ru_90;
const int16_t *ru2 = ru_90;
int16_t current_phase1,current_phase2;
uint16_t aa,Msc_RS,Msc_RS_idx;
uint16_t *Msc_idx_ptr;
int k,pilot_pos1 = 3 - frame_parms->Ncp, pilot_pos2 = 10 - 2*frame_parms->Ncp;
int32_t *ul_ch1=NULL, *ul_ch2=NULL;
int16_t ul_ch_estimates_re,ul_ch_estimates_im;
c16_t *ul_ch1 = NULL, *ul_ch2 = NULL;
//uint8_t nb_antennas_rx = frame_parms->nb_antenna_ports_eNB;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint8_t cyclic_shift;
@@ -97,11 +96,9 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t u=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[Ns+(subframe<<1)];
uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[Ns+(subframe<<1)];
int symbol_offset,i;
//debug_msg("lte_ul_channel_estimation: cyclic shift %d\n",cyclicShift);
const int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
const int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16384, -28378, -32768, -28378, -16384};
// debug_msg("lte_ul_channel_estimation: cyclic shift %d\n",cyclicShift);
simde__m128i *rxdataF128, *ul_ref128, *ul_ch128;
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
c16_t temp_in_ifft_0[2048 * 2] __attribute__((aligned(32)));
if (ulsch->ue_type > 0) harq_pid = 0;
else {
@@ -109,7 +106,7 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
}
uint16_t N_rb_alloc = ulsch->harq_processes[harq_pid]->nb_rb;
int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(32)));
c16_t tmp_estimates[N_rb_alloc * 12] __attribute__((aligned(32)));
Msc_RS = N_rb_alloc*12;
cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
ulsch->harq_processes[harq_pid]->n_DMRS2 +
@@ -154,16 +151,8 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
#endif
for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) {
ul_ch_estimates_re = ((int16_t *) ul_ch_estimates[aa])[i<<1];
ul_ch_estimates_im = ((int16_t *) ul_ch_estimates[aa])[(i<<1)+1];
// ((int16_t*) ul_ch_estimates[aa])[i<<1] = (i%2 == 1? 1:-1) * ul_ch_estimates_re;
((int16_t *) ul_ch_estimates[aa])[i<<1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_re) +
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_im))>>15);
//((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = (i%2 == 1? 1:-1) * ul_ch_estimates_im;
((int16_t *) ul_ch_estimates[aa])[(i<<1)+1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_im) -
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_re))>>15);
c16_t alpha = (c16_t){alphaTBL_re[alpha_ind], alphaTBL_im[alpha_ind]};
ul_ch_estimates[aa][i] = c16MulConjShift(alpha, ul_ch_estimates[aa][i], 15);
alpha_ind+=cyclic_shift;
if (alpha_ind>11)
@@ -179,7 +168,7 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
for(i=0; i<Msc_RS; i++)
((int32_t *)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i];
temp_in_ifft_0[i] = ul_ch_estimates[aa][symbol_offset + i];
int len;
switch(frame_parms->N_RB_DL) {
case 6:
@@ -254,32 +243,20 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
current_phase2 = (delta_phase/7)*(k-pilot_pos2);
// msg("sym: %d, current_phase1: %d, current_phase2: %d\n",k,current_phase1,current_phase2);
// set the right quadrant
(current_phase1 > 0) ? (ru1 = ru_90) : (ru1 = ru_90c);
(current_phase2 > 0) ? (ru2 = ru_90) : (ru2 = ru_90c);
c16_t *ru1 = (c16_t *)(current_phase1 > 0 ? ru_90 : ru_90c);
c16_t *ru2 = (c16_t *)(current_phase2 > 0 ? ru_90 : ru_90c);
// take absolute value and clip
current_phase1 = cmin(abs(current_phase1),127);
current_phase2 = cmin(abs(current_phase2),127);
// msg("sym: %d, current_phase1: %d, ru: %d + j%d, current_phase2: %d, ru: %d + j%d\n",k,current_phase1,ru1[2*current_phase1],ru1[2*current_phase1+1],current_phase2,ru2[2*current_phase2],ru2[2*current_phase2+1]);
current_phase2 = cmin(abs(current_phase2), 127);
// rotate channel estimates by estimated phase
rotate_cpx_vector((c16_t *) ul_ch1,
(c16_t *) &ru1[2*current_phase1],
(c16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
Msc_RS,
15);
rotate_cpx_vector((c16_t *) ul_ch2,
(c16_t *) &ru2[2*current_phase2],
(c16_t *) tmp_estimates,
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);
// Combine the two rotated estimates
mult_complex_vector_real_scalar((int16_t *)&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,
(int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
Msc_RS);
multadd_complex_vector_real_scalar((int16_t *)&tmp_estimates[0],
SCALE,
(int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
Msc_RS);
multadd_complex_vector_real_scalar(tmp_estimates, SCALE, &ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], Msc_RS);
/*
if ((k<pilot_pos1) || ((k>pilot_pos2))) {
@@ -314,9 +291,9 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
}
int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **ul_ch_estimates,
int32_t **ul_ch_estimates_time,
int32_t **rxdataF_ext,
c16_t **ul_ch_estimates,
c16_t **ul_ch_estimates_time,
c16_t **rxdataF_ext,
int N_rb_alloc,
int frame_rx,
int subframe_rx,
@@ -325,25 +302,21 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t cyclic_shift,
unsigned char l,
int interpolate,
uint16_t rnti) {
uint16_t rnti)
{
int16_t delta_phase = 0;
const int16_t *ru1 = ru_90;
const int16_t *ru2 = ru_90;
int16_t current_phase1,current_phase2;
uint16_t aa,Msc_RS,Msc_RS_idx;
uint16_t *Msc_idx_ptr;
int k,pilot_pos1 = 3 - frame_parms->Ncp, pilot_pos2 = 10 - 2*frame_parms->Ncp;
int32_t *ul_ch1=NULL, *ul_ch2=NULL;
int16_t ul_ch_estimates_re,ul_ch_estimates_im;
c16_t *ul_ch1 = NULL, *ul_ch2 = NULL;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint32_t alpha_ind;
int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16)));
c16_t tmp_estimates[N_rb_alloc * 12] __attribute__((aligned(16)));
int symbol_offset,i;
//debug_msg("lte_ul_channel_estimation_RRU: cyclic shift %d\n",cyclicShift);
const int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
const int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16384, -28378, -32768, -28378, -16384};
// debug_msg("lte_ul_channel_estimation_RRU: cyclic shift %d\n",cyclicShift);
simde__m128i *rxdataF128, *ul_ref128, *ul_ch128;
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
c16_t temp_in_ifft_0[2048 * 2] __attribute__((aligned(32)));
AssertFatal(l==pilot_pos1 || l==pilot_pos2,"%d is not a valid symbol for DMRS, should be %d or %d\n",
l,pilot_pos1,pilot_pos2);
Msc_RS = N_rb_alloc*12;
@@ -388,16 +361,8 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
#endif
for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) {
ul_ch_estimates_re = ((int16_t *) ul_ch_estimates[aa])[i<<1];
ul_ch_estimates_im = ((int16_t *) ul_ch_estimates[aa])[(i<<1)+1];
// ((int16_t*) ul_ch_estimates[aa])[i<<1] = (i%2 == 1? 1:-1) * ul_ch_estimates_re;
((int16_t *) ul_ch_estimates[aa])[i<<1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_re) +
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_im))>>15);
//((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = (i%2 == 1? 1:-1) * ul_ch_estimates_im;
((int16_t *) ul_ch_estimates[aa])[(i<<1)+1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_im) -
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_re))>>15);
c16_t alpha = (c16_t){alphaTBL_re[alpha_ind], alphaTBL_im[alpha_ind]};
ul_ch_estimates[aa][i] = c16MulConjShift(alpha, ul_ch_estimates[aa][i], 15);
alpha_ind+=cyclic_shift;
if (alpha_ind>11)
@@ -414,7 +379,7 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
for(i=0; i<Msc_RS; i++)
((int32_t *)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i];
temp_in_ifft_0[i] = ul_ch_estimates[aa][symbol_offset + i];
int len;
switch(frame_parms->N_RB_DL) {
case 6:
@@ -483,32 +448,20 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
current_phase2 = (delta_phase/7)*(k-pilot_pos2);
// msg("sym: %d, current_phase1: %d, current_phase2: %d\n",k,current_phase1,current_phase2);
// set the right quadrant
(current_phase1 > 0) ? (ru1 = ru_90) : (ru1 = ru_90c);
(current_phase2 > 0) ? (ru2 = ru_90) : (ru2 = ru_90c);
c16_t *ru1 = (c16_t *)(current_phase1 > 0 ? ru_90 : ru_90c);
c16_t *ru2 = (c16_t *)(current_phase2 > 0 ? ru_90 : ru_90c);
// take absolute value and clip
current_phase1 = cmin(abs(current_phase1),127);
current_phase2 = cmin(abs(current_phase2),127);
// msg("sym: %d, current_phase1: %d, ru: %d + j%d, current_phase2: %d, ru: %d + j%d\n",k,current_phase1,ru1[2*current_phase1],ru1[2*current_phase1+1],current_phase2,ru2[2*current_phase2],ru2[2*current_phase2+1]);
current_phase2 = cmin(abs(current_phase2), 127);
// rotate channel estimates by estimated phase
rotate_cpx_vector((c16_t *) ul_ch1,
(c16_t *) &ru1[2*current_phase1],
(c16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
Msc_RS,
15);
rotate_cpx_vector((c16_t *) ul_ch2,
(c16_t *) &ru2[2*current_phase2],
(c16_t *) &tmp_estimates[0],
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);
// Combine the two rotated estimates
mult_complex_vector_real_scalar((int16_t *)&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,
(int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
Msc_RS);
multadd_complex_vector_real_scalar((int16_t *)&tmp_estimates[0],
SCALE,
(int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
Msc_RS);
multadd_complex_vector_real_scalar(tmp_estimates, SCALE, &ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k], Msc_RS);
}
} //for(k=...
@@ -520,16 +473,16 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
for (k=0; k<frame_parms->symbols_per_tti>>1; k++) {
if (k==pilot_pos1) k++;
memcpy((void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
(void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1],
frame_parms->N_RB_UL*12*sizeof(int));
memcpy((void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * k],
(void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * pilot_pos1],
frame_parms->N_RB_UL * 12 * sizeof(int));
} else if (interpolate == 0 && l == pilot_pos2) {
for (k=0; k<frame_parms->symbols_per_tti>>1; k++) {
if (k==pilot_pos2) k++;
memcpy((void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*(k+(frame_parms->symbols_per_tti>>1))],
(void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2],
frame_parms->N_RB_UL*12*sizeof(int));
memcpy((void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * (k + (frame_parms->symbols_per_tti >> 1))],
(void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL * 12 * pilot_pos2],
frame_parms->N_RB_UL * 12 * sizeof(int));
}
delta_phase = lte_ul_freq_offset_estimation(frame_parms,
@@ -612,7 +565,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
return(0);
}
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, int32_t *ul_ch_estimates, uint16_t nb_rb)
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, c16_t *ul_ch_estimates, uint16_t nb_rb)
{
int a_idx = 64;
uint8_t conj_flag = 0;