Attention is currently required from: fixeria.
falconia has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/37287?usp=email )
Change subject: trau_rtp_conv: add support for HRv1 in 8k format ......................................................................
Patch Set 2:
(2 comments)
File src/trau/trau_rtp_conv.c:
https://gerrit.osmocom.org/c/libosmo-abis/+/37287/comment/0892ab9b_6b4aea97 PS2, Line 258: if (xc_bits[i]) : sum++;
Can we do `sum += xc_bits[i]` here? Theoretically, this should be better in terms of performance. […]
Given that the input bits come from other Osmocom library layers (osmo_i460 demux followed by trau_sync module), I would say that requiring each ubit_t to be strictly either 0 or 1 (for performance benefit) is fine. I'll change the code to do direct summation like you suggested.
https://gerrit.osmocom.org/c/libosmo-abis/+/37287/comment/9ae58d6e_fe0a6172 PS2, Line 669: tf->xc_bits[0] = 0;
cosmetic: maybe use designated initializers to make it shorter / more readable? […]
Shorter != more readable in this case, I would argue. The way I have each bit explicitly broken out, with a comment on xc_bits[5] saying that it is odd parity, makes it much easier IMO to visually verify correctness against the official word of the spec.
However, I just thought of another way to make the code shorter, yet retain direct correspondence (perhaps even more direct) to how the table appears in the TS 48.061 spec - see the next patchset iteration.