Skip to content

Changes

Summary

  1. {de,en}code8_hr: fix totally broken functions (details)
Commit b1b2b12c4df0fcb9fc02324d892dee4f50ee7d2e by falcon
{de,en}code8_hr: fix totally broken functions

The functions decode8_hr() and encode8_hr() in trau_frame.c (encoding
and decoding HRv1 TRAU frames in 8 kbit/s format) are available via
osmo_trau_frame_decode_8k() and osmo_trau_frame_encode() public APIs,
but they are not currently used anywhere in Osmocom.  (OsmoMGW-E1 has
no working support for HR codec, and there is no support for HRv1-8k
in the TRAU<->RTP layer until next patch in this series.)  Study of
the code reveals that these functions were totally broken prior to
this change:

* The movement of Dn bits between trau_bits and fr->d_bits used wrong
  offsets for some of the bits (and even missed one group of bits
  entirely in the encoding direction), producing garbled codec frames.

* The filling of XCn bits in the encoding direction was likewise
  garbled by use of wrong offset.

* When encoding TRAU-UL frames in this format, bit C5 (odd parity)
  was set incorrectly.

* The order of bits in fr->crc_bits array (Osmocom internal) was
  opposite the order needed for osmo_crc8gen_check_bits() and
  osmo_crc8gen_set_bits() functions - contrast with HRv1-16k functions
  that use sensible bit order for this fr->crc_bits array.

Given that this HRv1-8k mode within TRAU frame encoding and decoding
API was totally broken and not used anywhere, there are no compatibility
concerns with changing aspects of this API such as CRC bit order.

Change-Id: I7cf0275f2ff212e001db38d7b090f222f292cdb0
The file was modified src/trau/trau_frame.c