Small change to DME AMBE FEC.
This commit is contained in:
parent
1d93f72b52
commit
e0e1844aa5
18
AMBEFEC.cpp
18
AMBEFEC.cpp
|
@ -511,9 +511,9 @@ unsigned int CAMBEFEC::regenerateDMR(unsigned char* bytes) const
|
||||||
MASK >>= 1;
|
MASK >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int errors = regenerate(a1, b1, c1);
|
unsigned int errors = regenerate(a1, b1, c1, true);
|
||||||
errors += regenerate(a2, b2, c2);
|
errors += regenerate(a2, b2, c2, true);
|
||||||
errors += regenerate(a3, b3, c3);
|
errors += regenerate(a3, b3, c3, true);
|
||||||
|
|
||||||
MASK = 0x800000U;
|
MASK = 0x800000U;
|
||||||
for (unsigned int i = 0U; i < 24U; i++) {
|
for (unsigned int i = 0U; i < 24U; i++) {
|
||||||
|
@ -570,7 +570,7 @@ unsigned int CAMBEFEC::regenerateDStar(unsigned char* bytes) const
|
||||||
MASK >>= 1;
|
MASK >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int errors = regenerate(a, b, c);
|
unsigned int errors = regenerate(a, b, c, false);
|
||||||
|
|
||||||
MASK = 0x800000U;
|
MASK = 0x800000U;
|
||||||
for (unsigned int i = 0U; i < 24U; i++) {
|
for (unsigned int i = 0U; i < 24U; i++) {
|
||||||
|
@ -583,11 +583,14 @@ unsigned int CAMBEFEC::regenerateDStar(unsigned char* bytes) const
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CAMBEFEC::regenerate(unsigned int& a, unsigned int& b, unsigned int& c) const
|
unsigned int CAMBEFEC::regenerate(unsigned int& a, unsigned int& b, unsigned int& c, bool b23) const
|
||||||
{
|
{
|
||||||
unsigned int old_a = a;
|
unsigned int old_a = a;
|
||||||
unsigned int old_b = b;
|
unsigned int old_b = b;
|
||||||
|
|
||||||
|
// For the b23 bypass
|
||||||
|
bool b24 = (b & 0x01U) == 0x01U;
|
||||||
|
|
||||||
unsigned int data = CGolay24128::decode24128(a);
|
unsigned int data = CGolay24128::decode24128(a);
|
||||||
|
|
||||||
unsigned int new_a = CGolay24128::encode24128(data);
|
unsigned int new_a = CGolay24128::encode24128(data);
|
||||||
|
@ -603,6 +606,11 @@ unsigned int CAMBEFEC::regenerate(unsigned int& a, unsigned int& b, unsigned int
|
||||||
|
|
||||||
new_b ^= p;
|
new_b ^= p;
|
||||||
|
|
||||||
|
if (b23) {
|
||||||
|
new_b &= 0xFFFFFEU;
|
||||||
|
new_b |= b24 ? 0x01U : 0x00U;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int errors = 0U;
|
unsigned int errors = 0U;
|
||||||
|
|
||||||
unsigned int v = new_a ^ old_a;
|
unsigned int v = new_a ^ old_a;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
unsigned int regenerateDStar(unsigned char* bytes) const;
|
unsigned int regenerateDStar(unsigned char* bytes) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int regenerate(unsigned int& a, unsigned int& b, unsigned int& c) const;
|
unsigned int regenerate(unsigned int& a, unsigned int& b, unsigned int& c, bool b23) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
32
DMRSlot.cpp
32
DMRSlot.cpp
|
@ -330,11 +330,11 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
unsigned char fid = m_lc->getFID();
|
unsigned char fid = m_lc->getFID();
|
||||||
if (fid == FID_ETSI || fid == FID_DMRA) {
|
if (fid == FID_ETSI || fid == FID_DMRA) {
|
||||||
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
||||||
LogDebug("DMR Slot %u, audio sequence no. 0, errs: %u/144", m_slotNo, errors);
|
LogDebug("DMR Slot %u, audio sequence no. 0, errs: %u/141", m_slotNo, errors);
|
||||||
m_errs += errors;
|
m_errs += errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bits += 144U;
|
m_bits += 141U;
|
||||||
|
|
||||||
data[0U] = TAG_DATA;
|
data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
@ -389,11 +389,11 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
if (fid == FID_ETSI || fid == FID_DMRA) {
|
if (fid == FID_ETSI || fid == FID_DMRA) {
|
||||||
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
||||||
unsigned char n = data[1U] & 0x0FU;
|
unsigned char n = data[1U] & 0x0FU;
|
||||||
LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/144", m_slotNo, n, errors);
|
LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/141", m_slotNo, n, errors);
|
||||||
m_errs += errors;
|
m_errs += errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bits += 144U;
|
m_bits += 141U;
|
||||||
|
|
||||||
data[0U] = TAG_DATA;
|
data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
@ -456,11 +456,11 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
if (fid == FID_ETSI || fid == FID_DMRA) {
|
if (fid == FID_ETSI || fid == FID_DMRA) {
|
||||||
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
||||||
unsigned char n = data[1U] & 0x0FU;
|
unsigned char n = data[1U] & 0x0FU;
|
||||||
LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/144", m_slotNo, n, errors);
|
LogDebug("DMR Slot %u, audio sequence no. %u, errs: %u/141", m_slotNo, n, errors);
|
||||||
m_errs += errors;
|
m_errs += errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bits += 144U;
|
m_bits += 141U;
|
||||||
|
|
||||||
data[0U] = TAG_DATA;
|
data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
@ -742,9 +742,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
if (m_state == RS_RELAYING_NETWORK_AUDIO) {
|
if (m_state == RS_RELAYING_NETWORK_AUDIO) {
|
||||||
unsigned char fid = m_lc->getFID();
|
unsigned char fid = m_lc->getFID();
|
||||||
if (fid == FID_ETSI || fid == FID_DMRA)
|
if (fid == FID_ETSI || fid == FID_DMRA) {
|
||||||
m_errs += m_fec.regenerateDMR(data + 2U);
|
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
||||||
m_bits += 144U;
|
LogDebug("DMR Slot %u, audio, errs: %u/141", m_slotNo, errors);
|
||||||
|
m_errs += errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bits += 141U;
|
||||||
|
|
||||||
data[0U] = TAG_DATA;
|
data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
@ -781,9 +785,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned char fid = m_lc->getFID();
|
unsigned char fid = m_lc->getFID();
|
||||||
if (fid == FID_ETSI || fid == FID_DMRA)
|
if (fid == FID_ETSI || fid == FID_DMRA) {
|
||||||
m_errs += m_fec.regenerateDMR(data + 2U);
|
unsigned int errors = m_fec.regenerateDMR(data + 2U);
|
||||||
m_bits += 144U;
|
LogDebug("DMR Slot %u, audio, errs: %u/141", m_slotNo, errors);
|
||||||
|
m_errs += errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bits += 141U;
|
||||||
|
|
||||||
// Change the color code in the EMB
|
// Change the color code in the EMB
|
||||||
m_lastEMB.putData(data + 2U);
|
m_lastEMB.putData(data + 2U);
|
||||||
|
|
Loading…
Reference in a new issue