Commit d9d5a9fd authored by Thomas Schlichter's avatar Thomas Schlichter

gNB: small optimization in gNB_I0_measurements()

parent 5effd60a
......@@ -144,7 +144,8 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
NR_gNB_COMMON *common_vars = &gNB->common_vars;
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
int rb, nb_symb[275]={0};
int rb, nb_symb[frame_parms->N_RB_UL];
bzero(nb_symb, sizeof(nb_symb));
allocCast2D(n0_subband_power,
unsigned int,
......@@ -162,27 +163,35 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
for (int s=first_symb;s<(first_symb+num_symb);s++) {
int offset0 = ((slot&3)*frame_parms->symbols_per_slot + s) * frame_parms->ofdm_symbol_size;
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
if ((gNB->rb_mask_ul[s][rb >> 5] & (1U << (rb & 31))) == 0 && // check that rb was not used in this subframe
!(I0_SKIP_DC && rb == frame_parms->N_RB_UL>>1)) { // skip middle PRB because of artificial noise possibly created by FFT
int offset = offset0 + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
nb_symb[rb]++;
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
int32_t *ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset];
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
int32_t *ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset0 + frame_parms->first_carrier_offset];
for (rb = 0; rb < frame_parms->N_RB_UL; rb++) {
if ((gNB->rb_mask_ul[s][rb >> 5] & (1U << (rb & 31))) == 0 && // check that rb was not used in this subframe
!(I0_SKIP_DC
&& rb == frame_parms->N_RB_UL >> 1)) { // skip middle PRB because of artificial noise possibly created by FFT
if (aarx == 0)
nb_symb[rb]++;
int32_t signal_energy;
if (((frame_parms->N_RB_UL&1) == 1) &&
(rb==(frame_parms->N_RB_UL>>1))) {
signal_energy = signal_energy_nodc(ul_ch, 6);
ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset0];
signal_energy += signal_energy_nodc(ul_ch, 6);
if (rb == (frame_parms->N_RB_UL >> 1)) {
if ((frame_parms->N_RB_UL & 1) == 1) {
signal_energy = signal_energy_nodc(ul_ch, 6);
ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset0];
signal_energy += signal_energy_nodc(ul_ch, 6);
ul_ch += 6;
} else {
ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset0];
signal_energy = signal_energy_nodc(ul_ch, 12);
ul_ch += 12;
}
} else {
signal_energy = signal_energy_nodc(ul_ch, 12);
ul_ch += 12;
}
n0_subband_power[aarx][rb] += signal_energy;
LOG_D(PHY,"slot %d symbol %d RB %d aarx %d n0_subband_power %d\n", slot, s, rb, aarx, signal_energy);
} //antenna
}
} //rb
}
} // rb
} // antenna
} // symb
int nb_rb=0;
int32_t n0_subband_tot=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment