|
|
|
@ -39,8 +39,6 @@
|
|
|
|
|
#include "srslte/utils/vector.h"
|
|
|
|
|
#include "srslte/utils/convolution.h"
|
|
|
|
|
|
|
|
|
|
#define ESTIMATE_NOISE_LS_PSS
|
|
|
|
|
|
|
|
|
|
//#define DEFAULT_FILTER_LEN 3
|
|
|
|
|
|
|
|
|
|
#ifdef DEFAULT_FILTER_LEN
|
|
|
|
@ -125,6 +123,8 @@ int srslte_chest_dl_init(srslte_chest_dl_t *q, srslte_cell_t cell)
|
|
|
|
|
goto clean_exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
q->noise_alg = SRSLTE_NOISE_ALG_PSS;
|
|
|
|
|
|
|
|
|
|
q->smooth_filter_len = 3;
|
|
|
|
|
srslte_chest_dl_set_smooth_filter3_coeff(q, 0.1);
|
|
|
|
|
|
|
|
|
@ -189,7 +189,6 @@ static float estimate_noise_pilots(srslte_chest_dl_t *q, uint32_t port_id)
|
|
|
|
|
return power;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef ESTIMATE_NOISE_LS_PSS
|
|
|
|
|
static float estimate_noise_pss(srslte_chest_dl_t *q, cf_t *input, cf_t *ce)
|
|
|
|
|
{
|
|
|
|
|
/* Get PSS from received signal */
|
|
|
|
@ -209,9 +208,6 @@ static float estimate_noise_pss(srslte_chest_dl_t *q, cf_t *input, cf_t *ce)
|
|
|
|
|
return power;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
/* Uses the 5 empty transmitted SC before and after the SSS and PSS sequences for noise estimation */
|
|
|
|
|
static float estimate_noise_empty_sc(srslte_chest_dl_t *q, cf_t *input) {
|
|
|
|
|
int k_sss = (SRSLTE_CP_NSYMB(q->cell.cp) - 2) * q->cell.nof_prb * SRSLTE_NRE + q->cell.nof_prb * SRSLTE_NRE / 2 - 31;
|
|
|
|
@ -224,8 +220,6 @@ static float estimate_noise_empty_sc(srslte_chest_dl_t *q, cf_t *input) {
|
|
|
|
|
|
|
|
|
|
return noise_power;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define cesymb(i) ce[SRSLTE_RE_IDX(q->cell.nof_prb,i,0)]
|
|
|
|
|
|
|
|
|
@ -283,6 +277,10 @@ void srslte_chest_dl_set_smooth_filter(srslte_chest_dl_t *q, float *filter, uint
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void srslte_chest_dl_set_noise_alg(srslte_chest_dl_t *q, srslte_chest_dl_noise_alg_t noise_estimation_alg) {
|
|
|
|
|
q->noise_alg = noise_estimation_alg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void srslte_chest_dl_set_smooth_filter3_coeff(srslte_chest_dl_t* q, float w)
|
|
|
|
|
{
|
|
|
|
|
q->smooth_filter_len = 3;
|
|
|
|
@ -321,24 +319,28 @@ int srslte_chest_dl_estimate_port(srslte_chest_dl_t *q, cf_t *input, cf_t *ce, u
|
|
|
|
|
srslte_vec_prod_conj_ccc(q->pilot_recv_signal, q->csr_signal.pilots[port_id/2][sf_idx],
|
|
|
|
|
q->pilot_estimates, SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id));
|
|
|
|
|
if (ce != NULL) {
|
|
|
|
|
if (q->smooth_filter_len > 0) {
|
|
|
|
|
average_pilots(q, q->pilot_estimates, q->pilot_estimates_average, port_id);
|
|
|
|
|
interpolate_pilots(q, q->pilot_estimates_average, ce, port_id);
|
|
|
|
|
|
|
|
|
|
/* If averaging, compute noise from difference between received and averaged estimates */
|
|
|
|
|
q->noise_estimate[port_id] = estimate_noise_pilots(q, port_id);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
/* Smooth estimates (if applicable) and interpolate */
|
|
|
|
|
if (q->smooth_filter_len == 0 || (q->smooth_filter_len == 3 && q->smooth_filter[0] == 0)) {
|
|
|
|
|
interpolate_pilots(q, q->pilot_estimates, ce, port_id);
|
|
|
|
|
|
|
|
|
|
/* If not averaging, compute noise from empty subcarriers */
|
|
|
|
|
#ifdef ESTIMATE_NOISE_LS_PSS
|
|
|
|
|
} else {
|
|
|
|
|
average_pilots(q, q->pilot_estimates, q->pilot_estimates_average, port_id);
|
|
|
|
|
interpolate_pilots(q, q->pilot_estimates_average, ce, port_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Estimate noise power */
|
|
|
|
|
if (q->noise_alg == SRSLTE_NOISE_ALG_REFS && q->smooth_filter_len > 0) {
|
|
|
|
|
q->noise_estimate[port_id] = estimate_noise_pilots(q, port_id);
|
|
|
|
|
} else if (q->noise_alg == SRSLTE_NOISE_ALG_PSS) {
|
|
|
|
|
if (sf_idx == 0 || sf_idx == 5) {
|
|
|
|
|
q->noise_estimate[port_id] = estimate_noise_pss(q, input, ce);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
q->noise_estimate[port_id] = estimate_noise_empty_sc(q, input);
|
|
|
|
|
#endif
|
|
|
|
|
} else {
|
|
|
|
|
if (sf_idx == 0 || sf_idx == 5) {
|
|
|
|
|
q->noise_estimate[port_id] = estimate_noise_empty_sc(q, input);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute RSRP for the channel estimates in this port */
|
|
|
|
|