kopia lustrzana https://github.com/OpenRTX/OpenRTX
Clarification of naming: renamed DATA_SYNC_WORD to STREAM_SYNC_WORD and Audio_puncture to DATA_PUNCTURE
rodzic
25087b0e02
commit
82dd0a63f1
|
@ -34,7 +34,7 @@
|
||||||
/**
|
/**
|
||||||
* Puncture matrix for linx setup frame.
|
* Puncture matrix for linx setup frame.
|
||||||
*/
|
*/
|
||||||
static constexpr auto LSF_puncture = std::experimental::make_array< uint8_t >
|
static constexpr auto LSF_PUNCTURE = std::experimental::make_array< uint8_t >
|
||||||
(
|
(
|
||||||
1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1,
|
1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1,
|
||||||
0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1,
|
0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1,
|
||||||
|
@ -44,7 +44,7 @@ static constexpr auto LSF_puncture = std::experimental::make_array< uint8_t >
|
||||||
/**
|
/**
|
||||||
* Puncture matrix for audio frames.
|
* Puncture matrix for audio frames.
|
||||||
*/
|
*/
|
||||||
static constexpr auto Audio_puncture = std::experimental::make_array< uint8_t >
|
static constexpr auto DATA_PUNCTURE = std::experimental::make_array< uint8_t >
|
||||||
(
|
(
|
||||||
1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 0
|
1, 1, 1, 1, 1, 0
|
||||||
|
|
|
@ -35,10 +35,9 @@ using payload_t = std::array< uint8_t, 16 >; // Data type for frame payload fi
|
||||||
using lich_t = std::array< uint8_t, 12 >; // Data type for Golay(24,12) encoded LICH data
|
using lich_t = std::array< uint8_t, 12 >; // Data type for Golay(24,12) encoded LICH data
|
||||||
|
|
||||||
static constexpr std::array<uint8_t, 2> LSF_SYNC_WORD = {0x55, 0xF7}; // LSF sync word
|
static constexpr std::array<uint8_t, 2> LSF_SYNC_WORD = {0x55, 0xF7}; // LSF sync word
|
||||||
static constexpr std::array<uint8_t, 2> DATA_SYNC_WORD = {0xFF, 0x5D}; // Stream data sync word
|
static constexpr std::array<uint8_t, 2> STREAM_SYNC_WORD = {0xFF, 0x5D}; // Stream data sync word
|
||||||
static constexpr std::array<uint8_t, 2> PACKET_SYNC_WORD = {0x75, 0xFF}; // Packet data sync word
|
static constexpr std::array<uint8_t, 2> PACKET_SYNC_WORD = {0x75, 0xFF}; // Packet data sync word
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This structure provides bit field definitions for the "TYPE" field
|
* This structure provides bit field definitions for the "TYPE" field
|
||||||
* contained in an M17 Link Setup Frame.
|
* contained in an M17 Link Setup Frame.
|
||||||
|
|
|
@ -64,7 +64,7 @@ M17FrameType M17FrameDecoder::decodeFrame(const std::array< uint8_t, 48 >& frame
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stream data frame
|
// Stream data frame
|
||||||
if(syncWord == DATA_SYNC_WORD)
|
if(syncWord == STREAM_SYNC_WORD)
|
||||||
{
|
{
|
||||||
decodeStream(data);
|
decodeStream(data);
|
||||||
return M17FrameType::STREAM;
|
return M17FrameType::STREAM;
|
||||||
|
@ -78,7 +78,7 @@ void M17FrameDecoder::decodeLSF(const std::array< uint8_t, 46 >& data)
|
||||||
{
|
{
|
||||||
std::array< uint8_t, sizeof(M17LinkSetupFrame) > tmp;
|
std::array< uint8_t, sizeof(M17LinkSetupFrame) > tmp;
|
||||||
|
|
||||||
viterbi.decodePunctured(data, tmp, LSF_puncture);
|
viterbi.decodePunctured(data, tmp, LSF_PUNCTURE);
|
||||||
memcpy(&lsf.data, tmp.data(), tmp.size());
|
memcpy(&lsf.data, tmp.data(), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void M17FrameDecoder::decodeStream(const std::array< uint8_t, 46 >& data)
|
||||||
begin += lich.size();
|
begin += lich.size();
|
||||||
std::copy(begin, data.end(), punctured.begin());
|
std::copy(begin, data.end(), punctured.begin());
|
||||||
|
|
||||||
viterbi.decodePunctured(punctured, tmp, Audio_puncture);
|
viterbi.decodePunctured(punctured, tmp, DATA_PUNCTURE);
|
||||||
memcpy(&streamFrame.data, tmp.data(), tmp.size());
|
memcpy(&streamFrame.data, tmp.data(), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ void M17Transmitter::start(const std::string& src, const std::string& dst)
|
||||||
encoded[60] = encoder.flush();
|
encoded[60] = encoder.flush();
|
||||||
|
|
||||||
std::array<uint8_t, 46> punctured;
|
std::array<uint8_t, 46> punctured;
|
||||||
puncture(encoded, punctured, LSF_puncture);
|
puncture(encoded, punctured, LSF_PUNCTURE);
|
||||||
interleave(punctured);
|
interleave(punctured);
|
||||||
decorrelate(punctured);
|
decorrelate(punctured);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ void M17Transmitter::send(const payload_t& payload, const bool isLast)
|
||||||
encoded[36] = encoder.flush();
|
encoded[36] = encoder.flush();
|
||||||
|
|
||||||
std::array<uint8_t, 34> punctured;
|
std::array<uint8_t, 34> punctured;
|
||||||
puncture(encoded, punctured, Audio_puncture);
|
puncture(encoded, punctured, DATA_PUNCTURE);
|
||||||
|
|
||||||
// Add LICH segment to coded data and send
|
// Add LICH segment to coded data and send
|
||||||
std::array<uint8_t, 46> frame;
|
std::array<uint8_t, 46> frame;
|
||||||
|
@ -121,7 +121,7 @@ void M17Transmitter::send(const payload_t& payload, const bool isLast)
|
||||||
interleave(frame);
|
interleave(frame);
|
||||||
decorrelate(frame);
|
decorrelate(frame);
|
||||||
|
|
||||||
modulator.send(DATA_SYNC_WORD, frame, isLast);
|
modulator.send(STREAM_SYNC_WORD, frame, isLast);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* M17 */
|
} /* M17 */
|
||||||
|
|
|
@ -67,13 +67,13 @@ int main()
|
||||||
encoded[36] = encoder.flush();
|
encoded[36] = encoder.flush();
|
||||||
|
|
||||||
array<uint8_t, 34> punctured;
|
array<uint8_t, 34> punctured;
|
||||||
puncture(encoded, punctured, Audio_puncture);
|
puncture(encoded, punctured, DATA_PUNCTURE);
|
||||||
|
|
||||||
generateErrors(punctured);
|
generateErrors(punctured);
|
||||||
|
|
||||||
array< uint8_t, 18 > result;
|
array< uint8_t, 18 > result;
|
||||||
M17Viterbi decoder;
|
M17Viterbi decoder;
|
||||||
decoder.decodePunctured(punctured, result, Audio_puncture);
|
decoder.decodePunctured(punctured, result, DATA_PUNCTURE);
|
||||||
|
|
||||||
for(size_t i = 0; i < result.size(); i++)
|
for(size_t i = 0; i < result.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue