From 93acc2e70893a462e9288f75af0f7540e2260f31 Mon Sep 17 00:00:00 2001 From: yagoda Date: Thu, 4 May 2017 11:56:48 +0100 Subject: [PATCH] small update to decimation logic --- srslte/examples/pdsch_ue.c | 13 +++++++++++-- srslte/lib/sync/pss.c | 3 ++- srslte/lib/sync/sync.c | 1 - srslte/lib/ue/ue_sync.c | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/srslte/examples/pdsch_ue.c b/srslte/examples/pdsch_ue.c index 1c2b55976..521755691 100644 --- a/srslte/examples/pdsch_ue.c +++ b/srslte/examples/pdsch_ue.c @@ -417,8 +417,17 @@ int main(int argc, char **argv) { } else { #ifndef DISABLE_RF - if(!prog_args.decimate) - ue_sync.decimate = prog_args.decimate; + if(prog_args.decimate) + { + if(prog_args.decimate > 4 || prog_args.decimate < 0) + { + printf("Invalid decimation factor, setting to 1 \n"); + } + else + { + ue_sync.decimate = prog_args.decimate; + } + } if (srslte_ue_sync_init_multi(&ue_sync, cell, srslte_rf_recv_wrapper, prog_args.rf_nof_rx_ant, (void*) &rf)) { fprintf(stderr, "Error initiating ue_sync\n"); exit(-1); diff --git a/srslte/lib/sync/pss.c b/srslte/lib/sync/pss.c index c470c89ad..661dd94a7 100644 --- a/srslte/lib/sync/pss.c +++ b/srslte/lib/sync/pss.c @@ -119,10 +119,11 @@ int srslte_pss_synch_init_fft_offset(srslte_pss_synch_t *q, uint32_t frame_size, srslte_filt_decim_cc_init(&q->filter,q->decimate,filter_order); q->filter.filter_output = srslte_vec_malloc((buffer_size) * sizeof(cf_t)); q->filter.downsampled_input = srslte_vec_malloc((buffer_size + filter_order) * sizeof(cf_t)); + printf("decimation for the PSS search is %d \n",q->decimate); } - printf("decimation in the PSS is %d \n",q->decimate); + if (srslte_dft_plan(&q->dftp_input, fft_size, SRSLTE_DFT_FORWARD, SRSLTE_DFT_COMPLEX)) { diff --git a/srslte/lib/sync/sync.c b/srslte/lib/sync/sync.c index 00c914276..bed3fc128 100644 --- a/srslte/lib/sync/sync.c +++ b/srslte/lib/sync/sync.c @@ -106,7 +106,6 @@ int srslte_sync_init(srslte_sync_t *q, uint32_t frame_size, uint32_t max_offset, } srslte_sync_set_cp(q, SRSLTE_CP_NORM); - if(!decimate) decimate = 1; diff --git a/srslte/lib/ue/ue_sync.c b/srslte/lib/ue/ue_sync.c index 22cfc09f0..cae9000c3 100644 --- a/srslte/lib/ue/ue_sync.c +++ b/srslte/lib/ue/ue_sync.c @@ -170,7 +170,7 @@ int srslte_ue_sync_init_multi(srslte_ue_sync_t *q, q->frame_len = q->nof_recv_sf*q->sf_len; - if(q->fft_size > 1000 && q->decimate) + if(q->fft_size > 700 && q->decimate) { q->sfind.decimate = q->decimate; }