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).
master
Andre Puschmann 5 years ago
parent dca1be9157
commit 768ce745dc

@ -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<len;i++) {
if (fabs(symbols[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 */

Loading…
Cancel
Save