fixed normalization for int16 in viterbi

master
Ismael Gomez 8 years ago
parent 3c6c697ae8
commit 3d73e780af

@ -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);

@ -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<len;i++) {
if (abs(symbols[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);
}

@ -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<len;i++) {
tmp = (int16_t) (offset + in[i]/norm);
tmp = (int16_t) (offset + in[i]*gain);
if (tmp < 0)
tmp = 0;
if (tmp > clip)

Loading…
Cancel
Save