mirror of https://gerrit.osmocom.org/osmo-tetra
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:
parent
2a7ed4e7ae
commit
1bc5434a99
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue