Initial wiener filter integradion in DL channel estimator

This commit is contained in:
Xavier Arteaga 2019-09-10 09:37:46 +02:00 committed by Xavier Arteaga
parent 5199aaa94e
commit 3ab5f3a7e8
2 changed files with 41 additions and 0 deletions

View File

@ -45,6 +45,7 @@
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/resampling/interp.h"
#include "srslte/phy/sync/pss.h"
#include "wiener_dl.h"
typedef struct SRSLTE_API {
cf_t* ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
@ -79,6 +80,8 @@ typedef struct SRSLTE_API {
srslte_refsignal_t csr_refs;
srslte_refsignal_t** mbsfn_refs;
srslte_wiener_dl_t* wiener_dl;
cf_t* pilot_estimates;
cf_t* pilot_estimates_average;
cf_t* pilot_recv_signal;

View File

@ -142,6 +142,14 @@ int srslte_chest_dl_init(srslte_chest_dl_t* q, uint32_t max_prb, uint32_t nof_rx
goto clean_exit;
}
q->wiener_dl = calloc(sizeof(srslte_wiener_dl_t), 1);
if (q->wiener_dl) {
srslte_wiener_dl_init(q->wiener_dl, max_prb, 2, nof_rx_antennas);
} else {
ERROR("Error allocating wiener filter\n");
goto clean_exit;
}
q->nof_rx_antennas = nof_rx_antennas;
}
@ -191,6 +199,10 @@ void srslte_chest_dl_free(srslte_chest_dl_t* q)
if (q->pilot_recv_signal) {
free(q->pilot_recv_signal);
}
if (q->wiener_dl) {
srslte_wiener_dl_free(q->wiener_dl);
free(q->wiener_dl);
}
bzero(q, sizeof(srslte_chest_dl_t));
}
@ -294,6 +306,11 @@ int srslte_chest_dl_set_cell(srslte_chest_dl_t* q, srslte_cell_t cell)
fprintf(stderr, "Error initializing interpolator\n");
return SRSLTE_ERROR;
}
if (srslte_wiener_dl_set_cell(q->wiener_dl, cell)) {
fprintf(stderr, "Error initializing interpolator\n");
return SRSLTE_ERROR;
}
}
ret = SRSLTE_SUCCESS;
}
@ -628,6 +645,27 @@ static void chest_interpolate_noise_est(srslte_chest_dl_t* q,
q->noise_estimate[rxant_id][port_id] = estimate_noise_pilots(q, sf, port_id);
}
if (q->wiener_dl && ch_mode == SRSLTE_SF_NORM) {
uint32_t nre = q->cell.nof_prb * SRSLTE_NRE;
uint32_t nref = q->cell.nof_prb * 2;
uint32_t shift = srslte_refsignal_cs_fidx(q->cell, 0, port_id, 0);
for (uint32_t m = 0, l = 0; m < 2 * SRSLTE_CP_NORM_NSYMB; m++) {
uint32_t k = srslte_refsignal_cs_nsymbol(l, q->cell.cp, 0);
srslte_wiener_dl_run(q->wiener_dl,
port_id,
rxant_id,
m,
shift,
&input[nref * l],
&ce[nre * m],
q->noise_estimate[rxant_id][port_id]);
if (l == k) {
l++;
}
}
}
if (ce != NULL) {
switch (cfg->filter_type) {