Fix trellis enocder/decoder bit order: invert bit order

This commit is contained in:
Alex Ernst
2023-09-17 22:16:41 +02:00
parent b02560ccbc
commit 10ec9bd544

View File

@@ -280,12 +280,12 @@ void CDMRTrellis::pointsToDibits(const unsigned char* points, signed char* dibit
void CDMRTrellis::bitsToTribits(const unsigned char* payload, unsigned char* tribits) const
{
for (unsigned int i = 0U; i < 48U; i++) {
unsigned int n = 143U - i * 3U;
unsigned int n = i * 3U;
bool b1 = READ_BIT(payload, n) != 0x00U;
n--;
n++;
bool b2 = READ_BIT(payload, n) != 0x00U;
n--;
n++;
bool b3 = READ_BIT(payload, n) != 0x00U;
unsigned char tribit = 0U;
@@ -308,12 +308,12 @@ void CDMRTrellis::tribitsToBits(const unsigned char* tribits, unsigned char* pay
bool b2 = (tribit & 0x02U) == 0x02U;
bool b3 = (tribit & 0x01U) == 0x01U;
unsigned int n = 143U - i * 3U;
unsigned int n = i * 3U;
WRITE_BIT(payload, n, b1);
n--;
n++;
WRITE_BIT(payload, n, b2);
n--;
n++;
WRITE_BIT(payload, n, b3);
}
}