lower_mac/viterbi: Use the high level API of conv.h from libosmocore

It's more stable ... here we just need a flexible length, which we
can 'fake' by creating a local copy of the 'code' definition on the
stack.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2011-11-25 20:13:51 +01:00
parent 2a7ed4e7ae
commit 1bc5434a99
2 changed files with 8 additions and 22 deletions

View File

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

View File

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