From a08c6620286729fb2fb4f68c5d9071fc714f01af Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Fri, 29 Dec 2017 00:23:53 +0100 Subject: [PATCH] Per-antenna SNR --- lib/include/srslte/phy/ch_estimation/chest_dl.h | 4 ---- lib/src/phy/ch_estimation/chest_dl.c | 14 ++++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/include/srslte/phy/ch_estimation/chest_dl.h b/lib/include/srslte/phy/ch_estimation/chest_dl.h index a7956fb10..0bd6e9afe 100644 --- a/lib/include/srslte/phy/ch_estimation/chest_dl.h +++ b/lib/include/srslte/phy/ch_estimation/chest_dl.h @@ -159,10 +159,6 @@ SRSLTE_API void srslte_chest_dl_average_subframe(srslte_chest_dl_t *q, SRSLTE_API float srslte_chest_dl_get_noise_estimate(srslte_chest_dl_t *q); -SRSLTE_API float srslte_chest_dl_get_noise_estimate_ant_port(srslte_chest_dl_t *q, - uint32_t ant_idx, - uint32_t port_idx); - SRSLTE_API float srslte_chest_dl_get_cfo(srslte_chest_dl_t *q); SRSLTE_API float srslte_chest_dl_get_snr(srslte_chest_dl_t *q); diff --git a/lib/src/phy/ch_estimation/chest_dl.c b/lib/src/phy/ch_estimation/chest_dl.c index 510f33a23..113870cc9 100644 --- a/lib/src/phy/ch_estimation/chest_dl.c +++ b/lib/src/phy/ch_estimation/chest_dl.c @@ -596,22 +596,24 @@ float srslte_chest_dl_get_noise_estimate(srslte_chest_dl_t *q) { return n/q->last_nof_antennas; } -float srslte_chest_dl_get_noise_estimate_ant_port(srslte_chest_dl_t *q, uint32_t ant_idx, uint32_t port_idx) { - return q->noise_estimate[ant_idx][port_idx]; -} - float srslte_chest_dl_get_snr(srslte_chest_dl_t *q) { #ifdef FREQ_SEL_SNR int nref=SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, 0); return srslte_vec_acc_ff(q->snr_vector, nref)/nref; #else - return srslte_chest_dl_get_rsrp(q)/srslte_chest_dl_get_noise_estimate(q); + float rsrp = 0; + for (int i=0;ilast_nof_antennas;i++) { + for (int j=0;jcell.nof_ports;j++) { + rsrp += q->rsrp[i][j]/q->cell.nof_ports; + } + } + return rsrp/srslte_chest_dl_get_noise_estimate(q); #endif } float srslte_chest_dl_get_snr_ant_port(srslte_chest_dl_t *q, uint32_t ant_idx, uint32_t port_idx) { - return srslte_chest_dl_get_rsrp_ant_port(q, ant_idx, port_idx)/srslte_chest_dl_get_noise_estimate_ant_port(q, ant_idx, port_idx); + return srslte_chest_dl_get_rsrp_ant_port(q, ant_idx, port_idx)/srslte_chest_dl_get_noise_estimate(q); } float srslte_chest_dl_get_rssi(srslte_chest_dl_t *q) {