From d46be09663def81aaf05f9eefb5a8aa23c5bd12b Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 3 Jun 2021 16:50:48 +0200 Subject: [PATCH] Increase viterbi default number of iterations --- lib/src/phy/fec/convolutional/viterbi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/src/phy/fec/convolutional/viterbi.c b/lib/src/phy/fec/convolutional/viterbi.c index a346ebc7e..f89e9c3fb 100644 --- a/lib/src/phy/fec/convolutional/viterbi.c +++ b/lib/src/phy/fec/convolutional/viterbi.c @@ -25,11 +25,11 @@ #define DEB 0 -#define TB_ITER 3 +#define TB_ITER 5 #define DEFAULT_GAIN 100 -#define DEFAULT_GAIN_16 1000 +#define DEFAULT_GAIN_16 500 #define VITERBI_16 #ifndef LV_HAVE_AVX2 @@ -549,11 +549,10 @@ int srsran_viterbi_decode_f(srsran_viterbi_t* q, float* symbols, uint8_t* data, len = 3 * (frame_length + q->K - 1); } if (!q->decode_f) { - float max = 1e-9; - for (int i = 0; i < len; i++) { - if (fabs(symbols[i]) > max) { - max = fabs(symbols[i]); - } + float max = 1e-9; + uint32_t max_i = srsran_vec_max_abs_fi(symbols, len); + if (max_i < len && isnormal(symbols[max_i])) { + max = fabsf(symbols[max_i]); } #ifdef VITERBI_16 srsran_vec_quant_fus(symbols, q->symbols_us, q->gain_quant / max, 32767.5, 65535, len);