From 768ce745dc76e938427983475b3195e76bb41794 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 21 Nov 2019 09:42:51 +0100 Subject: [PATCH] fixing issue in Viterbi when decoding zero codeword it seems that when the input is only zero, the calculated max becomes zero too. This causes a div by zero later in the normalization (q->gain_quant/max). --- lib/src/phy/fec/viterbi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/src/phy/fec/viterbi.c b/lib/src/phy/fec/viterbi.c index 10fbb6e94..7e61e91ee 100644 --- a/lib/src/phy/fec/viterbi.c +++ b/lib/src/phy/fec/viterbi.c @@ -527,9 +527,8 @@ int srslte_viterbi_decode_f(srslte_viterbi_t *q, float *symbols, uint8_t *data, } else { len = 3 * (frame_length + q->K - 1); } - if (!q->decode_f) { - - float max = -9e9; + if (!q->decode_f) { + float max = 1e-9; for (int i=0;i max) { max = fabs(symbols[i]); @@ -544,7 +543,7 @@ int srslte_viterbi_decode_f(srslte_viterbi_t *q, float *symbols, uint8_t *data, #endif } else { return q->decode_f(q, symbols, data, frame_length); - } + } } /* symbols are int16 */