From 2bf288ff59b2afefc9f7b03bd7ad6d466f5fa67a Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 16 Aug 2017 17:39:49 +0200 Subject: [PATCH] Solved infinite loop and/or segmentation fault in the SCH decoder for non-SSE compilation. --- lib/include/srslte/phy/fec/turbodecoder_simd.h | 4 ++-- lib/src/phy/fec/turbodecoder_gen.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/include/srslte/phy/fec/turbodecoder_simd.h b/lib/include/srslte/phy/fec/turbodecoder_simd.h index 7ca3914ca..d7bc284d2 100644 --- a/lib/include/srslte/phy/fec/turbodecoder_simd.h +++ b/lib/include/srslte/phy/fec/turbodecoder_simd.h @@ -48,13 +48,13 @@ // The constant SRSLTE_TDEC_NPAR defines the maximum number of parallel CB supported by all SIMD decoders #ifdef ENABLE_SIMD_INTER #include "srslte/phy/fec/turbodecoder_simd_inter.h" - #if LV_HAVE_AVX2 + #ifdef LV_HAVE_AVX2 #define SRSLTE_TDEC_NPAR_INTRA 2 #else #define SRSLTE_TDEC_NPAR_INTRA 1 #endif #else - #if LV_HAVE_AVX2 + #ifdef LV_HAVE_AVX2 #define SRSLTE_TDEC_NPAR 2 #else #define SRSLTE_TDEC_NPAR 1 diff --git a/lib/src/phy/fec/turbodecoder_gen.c b/lib/src/phy/fec/turbodecoder_gen.c index 396d94caa..649c3363a 100644 --- a/lib/src/phy/fec/turbodecoder_gen.c +++ b/lib/src/phy/fec/turbodecoder_gen.c @@ -328,6 +328,9 @@ void srslte_tdec_gen_iteration(srslte_tdec_gen_t * h, float * input, uint32_t lo } else { fprintf(stderr, "Error CB index not set (call srslte_tdec_gen_reset() first\n"); } + + // Increase number of iterations + h->n_iter++; } int srslte_tdec_gen_reset(srslte_tdec_gen_t * h, uint32_t long_cb) @@ -339,6 +342,7 @@ int srslte_tdec_gen_reset(srslte_tdec_gen_t * h, uint32_t long_cb) } memset(h->w, 0, sizeof(float) * long_cb); h->current_cbidx = srslte_cbsegm_cbindex(long_cb); + h->current_cb_len = long_cb; if (h->current_cbidx < 0) { fprintf(stderr, "Invalid CB length %d\n", long_cb); return -1;