Commit 98c309ff authored by Robert Schmidt's avatar Robert Schmidt

Refactor nr_decode_pucch0() to not rely on uci_stats

the uci_stats variable (pointing to per-UE statistics for UCI) is used
in function nr_decode_pucch0() to store information which is important
beyond statistics, e.g., uci_stats->pucch0_thres as a threshold (which
comes from somewhere else)

This commit refactors to use original or intermediate variables to not
mix uci_stats usage with actual processing.

Also, group uci_stats a bit more.
parent 711518ba
......@@ -348,9 +348,14 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
#endif
index=maxpos;
uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]];
uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]];
LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01);
int pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]];
int pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]];
LOG_D(PHY, "n00[%d] = %d, n01[%d] = %d\n", prb_offset[0], pucch0_n00, prb_offset[1], pucch0_n01);
uci_stats->pucch0_n00 = pucch0_n00;
uci_stats->pucch0_n01 = pucch0_n01;
uci_stats->pucch0_thres = gNB->pucch0_thres;
// estimate CQI for MAC (from antenna port 0 only)
int max_n0 =
max(gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]], gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]);
......@@ -363,7 +368,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
else
cqi = (640 + SNRtimes10) / 5;
uci_stats->pucch0_thres = gNB->pucch0_thres; /* + (10*max_n0);*/
bool no_conf=false;
if (nr_sequences>1) {
if (/*xrtmag_dBtimes10 < (30+xrtmag_next_dBtimes10) ||*/ SNRtimes10 < gNB->pucch0_thres) {
......@@ -372,7 +376,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n",
frame,
slot,
uci_stats->pucch0_thres,
gNB->pucch0_thres,
SNRtimes10,
xrtmag_dBtimes10,
xrtmag_next_dBtimes10);
......@@ -388,7 +392,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->rssi = 1280 - (10 * dB_fixed(32767 * 32767)) - dB_fixed_times10(signal_energy_ant0);
if (pucch_pdu->bit_len_harq==0) {
uci_pdu->sr.sr_confidence_level = SNRtimes10 < uci_stats->pucch0_thres;
uci_pdu->sr.sr_confidence_level = SNRtimes10 < gNB->pucch0_thres;
uci_stats->pucch0_sr_trials++;
if (xrtmag_dBtimes10>(10*max_n0+100)) {
uci_pdu->sr.sr_indication = 1;
......@@ -415,9 +419,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
xrtmag_next_dBtimes10,
pucch_power_dBtimes10,
max_n0,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
uci_stats->pucch0_thres,
pucch0_n00,
pucch0_n01,
gNB->pucch0_thres,
cqi,
SNRtimes10,
10 * log10((double)signal_energy_ant0));
......@@ -450,9 +454,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
xrtmag_next_dBtimes10,
pucch_power_dBtimes10,
max_n0,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
uci_stats->pucch0_thres,
pucch0_n00,
pucch0_n01,
gNB->pucch0_thres,
cqi,
SNRtimes10);
if (pucch_pdu->sr_flag == 1) {
......
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