Clean up the FEC processing for M17.
This commit is contained in:
parent
b6ff701c05
commit
bf3dbdb55d
4 changed files with 24 additions and 16 deletions
|
@ -102,16 +102,16 @@ void CM17Convolution::encodeData(const unsigned char* in, unsigned char* out) co
|
||||||
assert(in != NULL);
|
assert(in != NULL);
|
||||||
assert(out != NULL);
|
assert(out != NULL);
|
||||||
|
|
||||||
unsigned char temp1[21U];
|
unsigned char temp1[19U];
|
||||||
::memset(temp1, 0x00U, 21U);
|
::memset(temp1, 0x00U, 19U);
|
||||||
::memcpy(temp1, in, 20U);
|
::memcpy(temp1, in, 18U);
|
||||||
|
|
||||||
unsigned char temp2[41U];
|
unsigned char temp2[37U];
|
||||||
encode(temp1, temp2, 164U);
|
encode(temp1, temp2, 148U);
|
||||||
|
|
||||||
unsigned int n = 0U;
|
unsigned int n = 0U;
|
||||||
unsigned int index = 0U;
|
unsigned int index = 0U;
|
||||||
for (unsigned int i = 0U; i < 328U; i++) {
|
for (unsigned int i = 0U; i < 296U; i++) {
|
||||||
if (i != PUNCTURE_LIST_DATA[index]) {
|
if (i != PUNCTURE_LIST_DATA[index]) {
|
||||||
bool b = READ_BIT1(temp2, i);
|
bool b = READ_BIT1(temp2, i);
|
||||||
WRITE_BIT1(out, n, b);
|
WRITE_BIT1(out, n, b);
|
||||||
|
@ -154,7 +154,7 @@ unsigned int CM17Convolution::decodeLinkSetup(const unsigned char* in, unsigned
|
||||||
decode(s0, s1);
|
decode(s0, s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return chainback(out, 240U) - PUNCTURE_LIST_LINK_SETUP_COUNT;
|
return chainback(out, 144U) - PUNCTURE_LIST_LINK_SETUP_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CM17Convolution::decodeData(const unsigned char* in, unsigned char* out)
|
unsigned int CM17Convolution::decodeData(const unsigned char* in, unsigned char* out)
|
||||||
|
|
|
@ -54,10 +54,6 @@ void CM17LSF::setNetwork(const unsigned char* data)
|
||||||
|
|
||||||
std::string CM17LSF::getSource() const
|
std::string CM17LSF::getSource() const
|
||||||
{
|
{
|
||||||
if (m_lsf[6U] == 0xFFU && m_lsf[7U] == 0xFFU && m_lsf[8U] == 0xFFU &&
|
|
||||||
m_lsf[9U] == 0xFFU && m_lsf[10U] == 0xFFU && m_lsf[11U] == 0xFFU)
|
|
||||||
return "******";
|
|
||||||
|
|
||||||
std::string callsign;
|
std::string callsign;
|
||||||
CM17Utils::decodeCallsign(m_lsf + 6U, callsign);
|
CM17Utils::decodeCallsign(m_lsf + 6U, callsign);
|
||||||
|
|
||||||
|
@ -71,10 +67,6 @@ void CM17LSF::setSource(const std::string& callsign)
|
||||||
|
|
||||||
std::string CM17LSF::getDest() const
|
std::string CM17LSF::getDest() const
|
||||||
{
|
{
|
||||||
if (m_lsf[0U] == 0xFFU && m_lsf[1U] == 0xFFU && m_lsf[2U] == 0xFFU &&
|
|
||||||
m_lsf[3U] == 0xFFU && m_lsf[4U] == 0xFFU && m_lsf[5U] == 0xFFU)
|
|
||||||
return "******";
|
|
||||||
|
|
||||||
std::string callsign;
|
std::string callsign;
|
||||||
CM17Utils::decodeCallsign(m_lsf + 0U, callsign);
|
CM17Utils::decodeCallsign(m_lsf + 0U, callsign);
|
||||||
|
|
||||||
|
|
16
M17Utils.cpp
16
M17Utils.cpp
|
@ -32,6 +32,16 @@ void CM17Utils::encodeCallsign(const std::string& callsign, unsigned char* encod
|
||||||
{
|
{
|
||||||
assert(encoded != NULL);
|
assert(encoded != NULL);
|
||||||
|
|
||||||
|
if (callsign == "ALL" || callsign == "ALL ") {
|
||||||
|
encoded[0U] = 0xFFU;
|
||||||
|
encoded[1U] = 0xFFU;
|
||||||
|
encoded[2U] = 0xFFU;
|
||||||
|
encoded[3U] = 0xFFU;
|
||||||
|
encoded[4U] = 0xFFU;
|
||||||
|
encoded[5U] = 0xFFU;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int len = callsign.size();
|
unsigned int len = callsign.size();
|
||||||
if (len > 9U)
|
if (len > 9U)
|
||||||
len = 9U;
|
len = 9U;
|
||||||
|
@ -60,6 +70,12 @@ void CM17Utils::decodeCallsign(const unsigned char* encoded, std::string& callsi
|
||||||
|
|
||||||
callsign.clear();
|
callsign.clear();
|
||||||
|
|
||||||
|
if (encoded[0U] == 0xFFU && encoded[1U] == 0xFFU && encoded[2U] == 0xFFU &&
|
||||||
|
encoded[3U] == 0xFFU && encoded[4U] == 0xFFU && encoded[5U] == 0xFFU) {
|
||||||
|
callsign = "ALL";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t enc =
|
uint64_t enc =
|
||||||
(uint64_t(encoded[0U]) << 40) +
|
(uint64_t(encoded[0U]) << 40) +
|
||||||
(uint64_t(encoded[1U]) << 32) +
|
(uint64_t(encoded[1U]) << 32) +
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
#if !defined(VERSION_H)
|
#if !defined(VERSION_H)
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
const char* VERSION = "20210701";
|
const char* VERSION = "20210708";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue