From 962164277ad90b4c2f70dfab3b0571d6c8311926 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 6 Mar 2018 17:09:59 +0100 Subject: [PATCH] Normalize CSI to maximum. --- lib/src/phy/phch/pdsch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/phy/phch/pdsch.c b/lib/src/phy/phch/pdsch.c index 4cfa5c75c..c59956a71 100644 --- a/lib/src/phy/phch/pdsch.c +++ b/lib/src/phy/phch/pdsch.c @@ -659,8 +659,13 @@ static int srslte_pdsch_codeword_decode(srslte_pdsch_t *q, srslte_pdsch_cfg_t *c int16_t *e = q->e[codeword_idx]; if (q->csi_enabled) { + const uint32_t csi_max_idx = srslte_vec_max_fi(q->csi[codeword_idx], nbits->nof_bits / qm); + float csi_max = 1.0f; + if (csi_max_idx < nbits->nof_bits / qm) { + csi_max = q->csi[codeword_idx][csi_max_idx]; + } for (int i = 0; i < nbits->nof_bits / qm; i++) { - float csi = q->csi[codeword_idx][i]; + const float csi = q->csi[codeword_idx][i] / csi_max; for (int k = 0; k < qm; k++) { e[qm * i + k] = (int16_t) ((float) e[qm * i + k] * csi); }