Get the convolution BER directly from the decoder.
This commit is contained in:
parent
50337639b2
commit
8547a210bd
|
@ -257,7 +257,7 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len)
|
|||
#endif
|
||||
CM17Convolution conv;
|
||||
unsigned char frame[M17_FN_LENGTH_BYTES + M17_PAYLOAD_LENGTH_BYTES];
|
||||
conv.decodeData(data + 2U + M17_SYNC_LENGTH_BYTES + M17_LICH_FRAGMENT_FEC_LENGTH_BYTES, frame);
|
||||
unsigned int convBER = conv.decodeData(data + 2U + M17_SYNC_LENGTH_BYTES + M17_LICH_FRAGMENT_FEC_LENGTH_BYTES, frame);
|
||||
|
||||
unsigned int fn = ((frame[0U] << 8) + (frame[1U] << 0)) & 0x7FU;
|
||||
|
||||
|
@ -296,7 +296,7 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len)
|
|||
errors += CUtils::countBits(rfData[offset] ^ data[offset]);
|
||||
}
|
||||
|
||||
LogDebug("M17, FN: %u, errs: %u/144 (%.1f%%)", fn & 0x7FU, errors, float(errors) / 1.44F);
|
||||
LogDebug("M17, FN: %u, errs: %u/%u/144 (%.1f%%)", fn & 0x7FU, errors, convBER, float(errors) / 1.44F);
|
||||
|
||||
m_rfBits += M17_FN_LENGTH_BITS + M17_PAYLOAD_LENGTH_BITS;
|
||||
m_rfErrs += errors;
|
||||
|
|
|
@ -118,7 +118,7 @@ void CM17Convolution::encodeData(const unsigned char* in, unsigned char* out) co
|
|||
}
|
||||
}
|
||||
|
||||
void CM17Convolution::decodeLinkSetup(const unsigned char* in, unsigned char* out)
|
||||
unsigned int CM17Convolution::decodeLinkSetup(const unsigned char* in, unsigned char* out)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
|
@ -150,10 +150,10 @@ void CM17Convolution::decodeLinkSetup(const unsigned char* in, unsigned char* ou
|
|||
decode(s0, s1);
|
||||
}
|
||||
|
||||
chainback(out, 240U);
|
||||
return chainback(out, 240U);
|
||||
}
|
||||
|
||||
void CM17Convolution::decodeData(const unsigned char* in, unsigned char* out)
|
||||
unsigned int CM17Convolution::decodeData(const unsigned char* in, unsigned char* out)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
|
@ -185,7 +185,7 @@ void CM17Convolution::decodeData(const unsigned char* in, unsigned char* out)
|
|||
decode(s0, s1);
|
||||
}
|
||||
|
||||
chainback(out, 160U);
|
||||
return chainback(out, 160U);
|
||||
}
|
||||
|
||||
void CM17Convolution::start()
|
||||
|
@ -229,7 +229,7 @@ void CM17Convolution::decode(uint8_t s0, uint8_t s1)
|
|||
m_newMetrics = tmp;
|
||||
}
|
||||
|
||||
void CM17Convolution::chainback(unsigned char* out, unsigned int nBits)
|
||||
unsigned int CM17Convolution::chainback(unsigned char* out, unsigned int nBits)
|
||||
{
|
||||
assert(out != NULL);
|
||||
|
||||
|
@ -244,6 +244,15 @@ void CM17Convolution::chainback(unsigned char* out, unsigned int nBits)
|
|||
|
||||
WRITE_BIT1(out, nBits, bit != 0U);
|
||||
}
|
||||
|
||||
unsigned int minCost = m_oldMetrics[0];
|
||||
|
||||
for (unsigned int i = 0U; i < NUM_OF_STATES; i++) {
|
||||
if (m_oldMetrics[i] < minCost)
|
||||
minCost = m_oldMetrics[i];
|
||||
}
|
||||
|
||||
return minCost / (M >> 1);
|
||||
}
|
||||
|
||||
void CM17Convolution::encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2020,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,8 +26,8 @@ public:
|
|||
CM17Convolution();
|
||||
~CM17Convolution();
|
||||
|
||||
void decodeLinkSetup(const unsigned char* in, unsigned char* out);
|
||||
void decodeData(const unsigned char* in, unsigned char* out);
|
||||
unsigned int decodeLinkSetup(const unsigned char* in, unsigned char* out);
|
||||
unsigned int decodeData(const unsigned char* in, unsigned char* out);
|
||||
|
||||
void encodeLinkSetup(const unsigned char* in, unsigned char* out) const;
|
||||
void encodeData(const unsigned char* in, unsigned char* out) const;
|
||||
|
@ -42,7 +42,8 @@ private:
|
|||
|
||||
void start();
|
||||
void decode(uint8_t s0, uint8_t s1);
|
||||
void chainback(unsigned char* out, unsigned int nBits);
|
||||
|
||||
unsigned int chainback(unsigned char* out, unsigned int nBits);
|
||||
|
||||
void encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2016,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2016,2018,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -97,7 +97,7 @@ void CNXDNConvolution::decode(uint8_t s0, uint8_t s1)
|
|||
m_newMetrics = tmp;
|
||||
}
|
||||
|
||||
void CNXDNConvolution::chainback(unsigned char* out, unsigned int nBits)
|
||||
unsigned int CNXDNConvolution::chainback(unsigned char* out, unsigned int nBits)
|
||||
{
|
||||
assert(out != NULL);
|
||||
|
||||
|
@ -112,6 +112,15 @@ void CNXDNConvolution::chainback(unsigned char* out, unsigned int nBits)
|
|||
|
||||
WRITE_BIT1(out, nBits, bit != 0U);
|
||||
}
|
||||
|
||||
unsigned int minCost = m_oldMetrics[0];
|
||||
|
||||
for (unsigned int i = 0U; i < NUM_OF_STATES; i++) {
|
||||
if (m_oldMetrics[i] < minCost)
|
||||
minCost = m_oldMetrics[i];
|
||||
}
|
||||
|
||||
return minCost / (M >> 1);
|
||||
}
|
||||
|
||||
void CNXDNConvolution::encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2018,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,7 +28,8 @@ public:
|
|||
|
||||
void start();
|
||||
void decode(uint8_t s0, uint8_t s1);
|
||||
void chainback(unsigned char* out, unsigned int nBits);
|
||||
|
||||
unsigned int chainback(unsigned char* out, unsigned int nBits);
|
||||
|
||||
void encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const;
|
||||
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
#if !defined(VERSION_H)
|
||||
#define VERSION_H
|
||||
|
||||
const char* VERSION = "20210625";
|
||||
const char* VERSION = "20210627";
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2016,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -96,7 +96,7 @@ void CYSFConvolution::decode(uint8_t s0, uint8_t s1)
|
|||
m_newMetrics = tmp;
|
||||
}
|
||||
|
||||
void CYSFConvolution::chainback(unsigned char* out, unsigned int nBits)
|
||||
unsigned int CYSFConvolution::chainback(unsigned char* out, unsigned int nBits)
|
||||
{
|
||||
assert(out != NULL);
|
||||
|
||||
|
@ -111,6 +111,15 @@ void CYSFConvolution::chainback(unsigned char* out, unsigned int nBits)
|
|||
|
||||
WRITE_BIT1(out, nBits, bit != 0U);
|
||||
}
|
||||
|
||||
unsigned int minCost = m_oldMetrics[0];
|
||||
|
||||
for (unsigned int i = 0U; i < NUM_OF_STATES; i++) {
|
||||
if (m_oldMetrics[i] < minCost)
|
||||
minCost = m_oldMetrics[i];
|
||||
}
|
||||
|
||||
return minCost / (M >> 1);
|
||||
}
|
||||
|
||||
void CYSFConvolution::encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016.2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,7 +28,8 @@ public:
|
|||
|
||||
void start();
|
||||
void decode(uint8_t s0, uint8_t s1);
|
||||
void chainback(unsigned char* out, unsigned int nBits);
|
||||
|
||||
unsigned int chainback(unsigned char* out, unsigned int nBits);
|
||||
|
||||
void encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue