mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:17:09 +08:00
Fix trellis enocder/decoder bit order: invert bit order
This commit is contained in:
@@ -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
|
void CDMRTrellis::bitsToTribits(const unsigned char* payload, unsigned char* tribits) const
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0U; i < 48U; i++) {
|
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;
|
bool b1 = READ_BIT(payload, n) != 0x00U;
|
||||||
n--;
|
n++;
|
||||||
bool b2 = READ_BIT(payload, n) != 0x00U;
|
bool b2 = READ_BIT(payload, n) != 0x00U;
|
||||||
n--;
|
n++;
|
||||||
bool b3 = READ_BIT(payload, n) != 0x00U;
|
bool b3 = READ_BIT(payload, n) != 0x00U;
|
||||||
|
|
||||||
unsigned char tribit = 0U;
|
unsigned char tribit = 0U;
|
||||||
@@ -308,12 +308,12 @@ void CDMRTrellis::tribitsToBits(const unsigned char* tribits, unsigned char* pay
|
|||||||
bool b2 = (tribit & 0x02U) == 0x02U;
|
bool b2 = (tribit & 0x02U) == 0x02U;
|
||||||
bool b3 = (tribit & 0x01U) == 0x01U;
|
bool b3 = (tribit & 0x01U) == 0x01U;
|
||||||
|
|
||||||
unsigned int n = 143U - i * 3U;
|
unsigned int n = i * 3U;
|
||||||
|
|
||||||
WRITE_BIT(payload, n, b1);
|
WRITE_BIT(payload, n, b1);
|
||||||
n--;
|
n++;
|
||||||
WRITE_BIT(payload, n, b2);
|
WRITE_BIT(payload, n, b2);
|
||||||
n--;
|
n++;
|
||||||
WRITE_BIT(payload, n, b3);
|
WRITE_BIT(payload, n, b3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user