mirror of
https://github.com/brmlab/osmo-tetra.git
synced 2025-06-09 10:24:20 +02:00
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
2 changed files with 8 additions and 22 deletions
|
@ -57,17 +57,10 @@ static const struct osmo_conv_code conv_cch = {
|
||||||
|
|
||||||
int conv_cch_decode(int8_t *input, uint8_t *output, int n)
|
int conv_cch_decode(int8_t *input, uint8_t *output, int n)
|
||||||
{
|
{
|
||||||
struct osmo_conv_decoder decoder;
|
struct osmo_conv_code code;
|
||||||
int rv, l;
|
|
||||||
|
|
||||||
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);
|
return osmo_conv_decode(&code, input, output);
|
||||||
l = osmo_conv_decode_finish(&decoder, &input[l]);
|
|
||||||
|
|
||||||
rv = osmo_conv_decode_get_output(&decoder, output, 1);
|
|
||||||
|
|
||||||
osmo_conv_decode_deinit(&decoder);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,17 +55,10 @@ static const struct osmo_conv_code conv_tch = {
|
||||||
|
|
||||||
int conv_tch_decode(int8_t *input, uint8_t *output, int n)
|
int conv_tch_decode(int8_t *input, uint8_t *output, int n)
|
||||||
{
|
{
|
||||||
struct osmo_conv_decoder decoder;
|
struct osmo_conv_code code;
|
||||||
int rv, l;
|
|
||||||
|
|
||||||
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);
|
return osmo_conv_decode(&code, input, output);
|
||||||
l = osmo_conv_decode_finish(&decoder, &input[l]);
|
|
||||||
|
|
||||||
rv = osmo_conv_decode_get_output(&decoder, output, 1);
|
|
||||||
|
|
||||||
osmo_conv_decode_deinit(&decoder);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue