diff --git a/srslte/include/srslte/utils/vector.h b/srslte/include/srslte/utils/vector.h index 7d6c04cba..74cd60172 100644 --- a/srslte/include/srslte/utils/vector.h +++ b/srslte/include/srslte/utils/vector.h @@ -163,7 +163,7 @@ SRSLTE_API void srslte_vec_max_fff(float *x, float *y, float *z, uint32_t len); /* quantify vector of floats or int16 and convert to uint8_t */ SRSLTE_API void srslte_vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, float clip, uint32_t len); -SRSLTE_API void srslte_vec_quant_suc(int16_t *in, uint8_t *out, int16_t norm, int16_t offset, int16_t clip, uint32_t len); +SRSLTE_API void srslte_vec_quant_suc(int16_t *in, uint8_t *out, float gain, int16_t offset, int16_t clip, uint32_t len); /* magnitude of each vector element */ SRSLTE_API void srslte_vec_abs_cf(cf_t *x, float *abs, uint32_t len); diff --git a/srslte/lib/fec/viterbi.c b/srslte/lib/fec/viterbi.c index 0e15de2a9..0eb2e6d0a 100644 --- a/srslte/lib/fec/viterbi.c +++ b/srslte/lib/fec/viterbi.c @@ -287,11 +287,10 @@ int srslte_viterbi_decode_s(srslte_viterbi_t *q, int16_t *symbols, uint8_t *data int16_t max = -INT16_MAX; for (int i=0;i max) { - max = symbols[i]; + max = abs(symbols[i]); } } - - srslte_vec_quant_suc(symbols, q->symbols_uc, q->gain_quant/max, 127, 255, len); + srslte_vec_quant_suc(symbols, q->symbols_uc, (float) q->gain_quant/max, 127, 255, len); return srslte_viterbi_decode_uc(q, q->symbols_uc, data, frame_length); } diff --git a/srslte/lib/utils/vector.c b/srslte/lib/utils/vector.c index f42c75b0e..f33c84ab1 100644 --- a/srslte/lib/utils/vector.c +++ b/srslte/lib/utils/vector.c @@ -797,12 +797,12 @@ void srslte_vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, flo } } -void srslte_vec_quant_suc(int16_t *in, uint8_t *out, int16_t norm, int16_t offset, int16_t clip, uint32_t len) { +void srslte_vec_quant_suc(int16_t *in, uint8_t *out, float gain, int16_t offset, int16_t clip, uint32_t len) { int i; int16_t tmp; for (i=0;i clip)