diff --git a/src/lower_mac/viterbi_cch.c b/src/lower_mac/viterbi_cch.c index 5cbc476..18fe0e5 100644 --- a/src/lower_mac/viterbi_cch.c +++ b/src/lower_mac/viterbi_cch.c @@ -57,17 +57,10 @@ static const struct osmo_conv_code conv_cch = { int conv_cch_decode(int8_t *input, uint8_t *output, int n) { - struct osmo_conv_decoder decoder; - int rv, l; + struct osmo_conv_code code; - osmo_conv_decode_init(&decoder, &conv_cch, n); + memcpy(&code, &conv_cch, sizeof(struct osmo_conv_code)); + code.len = n; - l = osmo_conv_decode_scan(&decoder, input, n); - l = osmo_conv_decode_finish(&decoder, &input[l]); - - rv = osmo_conv_decode_get_output(&decoder, output, 1); - - osmo_conv_decode_deinit(&decoder); - - return rv; + return osmo_conv_decode(&code, input, output); } diff --git a/src/lower_mac/viterbi_tch.c b/src/lower_mac/viterbi_tch.c index 428279a..5b92b8b 100644 --- a/src/lower_mac/viterbi_tch.c +++ b/src/lower_mac/viterbi_tch.c @@ -55,17 +55,10 @@ static const struct osmo_conv_code conv_tch = { int conv_tch_decode(int8_t *input, uint8_t *output, int n) { - struct osmo_conv_decoder decoder; - int rv, l; + struct osmo_conv_code code; - osmo_conv_decode_init(&decoder, &conv_tch, n); + memcpy(&code, &conv_tch, sizeof(struct osmo_conv_code)); + code.len = n; - l = osmo_conv_decode_scan(&decoder, input, n); - l = osmo_conv_decode_finish(&decoder, &input[l]); - - rv = osmo_conv_decode_get_output(&decoder, output, 1); - - osmo_conv_decode_deinit(&decoder); - - return rv; + return osmo_conv_decode(&code, input, output); }