Skip to content

Commit

Permalink
New ckass dedicated to frame synchronization with mismatch tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
f4exb committed Jul 25, 2020
1 parent 565a6c7 commit 5895037
Show file tree
Hide file tree
Showing 9 changed files with 287 additions and 106 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ set(dsdcc_SOURCES
dsd_opts.cpp
dsd_state.cpp
dsd_symbol.cpp
dsd_sync.cpp
dstar.cpp
ysf.cpp
dpmr.cpp
Expand Down Expand Up @@ -106,6 +107,7 @@ set(dsdcc_HEADERS
dsd_opts.h
dsd_state.h
dsd_symbol.h
dsd_sync.h
dstar.h
ysf.h
dpmr.h
Expand Down
12 changes: 8 additions & 4 deletions dmr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <string.h>
#include "dmr.h"
#include "dsd_decoder.h"
#include "dsd_sync.h"

namespace DSDcc
{
Expand Down Expand Up @@ -399,18 +400,21 @@ void DSDDMR::processVoice()
void DSDDMR::processSyncOrSkip()
{
const int sync_db_size = IN_DIBITS(DMR_SYNC_LEN);
const DSDSync::SyncPattern patterns[2] = { DSDSync::SyncDMRDataBS, DSDSync::SyncDMRVoiceBS };

if (m_symbolIndex > sync_db_size) // accumulate enough symbols to look for a sync
{
if (memcmp(m_dsdDecoder->m_dsdSymbol.getSyncDibitBack(sync_db_size),
DSDDecoder::m_syncDMRDataBS, sync_db_size) == 0)
DSDSync syncEngine;
syncEngine.matchSome(m_dsdDecoder->m_dsdSymbol.getSyncDibitBack(sync_db_size), sync_db_size, patterns, 2);

if (syncEngine.isMatching(DSDSync::SyncDMRDataBS))
{
// std::cerr << "DSDDMR::processSyncOrSkip: data sync" << std::endl;
processDataFirstHalf(90);
m_dsdDecoder->m_fsmState = DSDDecoder::DSDprocessDMRdata;
return;
}
else if (memcmp(m_dsdDecoder->m_dsdSymbol.getSyncDibitBack(sync_db_size),
DSDDecoder::m_syncDMRVoiceBS, sync_db_size) == 0)
else if (syncEngine.isMatching(DSDSync::SyncDMRVoiceBS))
{
// std::cerr << "DSDDMR::processSyncOrSkip: voice sync" << std::endl;
processVoiceFirstHalf(90);
Expand Down
22 changes: 17 additions & 5 deletions dpmr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <iostream>
#include "dpmr.h"
#include "dsd_decoder.h"
#include "dsd_sync.h"

namespace DSDcc
{
Expand Down Expand Up @@ -281,13 +282,16 @@ void DSDdPMR::processPostFrame()
if (m_symbolIndex == 12) // sync complete
{
m_dsdDecoder->getLogger().log("DSDdPMR::processPostFrame\n"); // DEBUG
DSDSync syncEngine;
const DSDSync::SyncPattern patterns[2] = { DSDSync::SyncDPMRFS2, DSDSync::SyncDPMRFS3 };
syncEngine.matchSome(m_syncDoubleBuffer, 12, patterns, 2);

if (memcmp((const void *) m_syncDoubleBuffer, (const void *) DSDDecoder::m_syncDPMRFS2, 12) == 0) // start of superframes
if (syncEngine.isMatching(DSDSync::SyncDPMRFS2)) // start of superframes
{
m_state = DPMRSuperFrame;
m_symbolIndex = 0;
}
else if (memcmp((const void *) m_syncDoubleBuffer, (const void *) DSDDecoder::m_syncDPMRFS3, 12) == 0) // end frame
else if (syncEngine.isMatching(DSDSync::SyncDPMRFS3)) // end frame
{
m_state = DPMREnd;
m_symbolIndex = 0;
Expand Down Expand Up @@ -346,7 +350,11 @@ void DSDdPMR::processExtSearch()
// compare around expected spot
if ((m_syncCycle < 1) || (m_syncCycle > 14))
{
if (memcmp((const void *) &m_syncDoubleBuffer[m_symbolIndex], (const void *) DSDDecoder::m_syncDPMRFS2, 12) == 0)
DSDSync syncEngine;
const DSDSync::SyncPattern patterns[1] = { DSDSync::SyncDPMRFS2 };
syncEngine.matchSome(m_syncDoubleBuffer, 12, patterns, 1);

if (syncEngine.isMatching(DSDSync::SyncDPMRFS2))
{
m_dsdDecoder->getLogger().log("DSDdPMR::processExtSearch: stop extensive sync search (sync found)\n"); // DEBUG
m_state = DPMRSuperFrame;
Expand Down Expand Up @@ -509,12 +517,16 @@ void DSDdPMR::processFS2(int symbolIndex, int dibit)

if (symbolIndex == 11) // last symbol
{
if (memcmp((const void *) m_syncDoubleBuffer, (const void *) DSDDecoder::m_syncDPMRFS2, 12) == 0) // start of superframes
DSDSync syncEngine;
const DSDSync::SyncPattern patterns[2] = { DSDSync::SyncDPMRFS2, DSDSync::SyncDPMRFS3 };
syncEngine.matchSome(m_syncDoubleBuffer, 12, patterns, 2);

if (syncEngine.isMatching(DSDSync::SyncDPMRFS2)) // start of superframes
{
// nothing
m_frameType = DPMRPayloadFrame;
}
else if (memcmp((const void *) m_syncDoubleBuffer, (const void *) DSDDecoder::m_syncDPMRFS3, 12) == 0) // end frame
else if (syncEngine.isMatching(DSDSync::SyncDPMRFS3)) // end frame
{
m_state = DPMREnd;
m_symbolIndex = 0;
Expand Down
89 changes: 26 additions & 63 deletions dsd_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,14 @@
#include <stdlib.h>
#include <assert.h>
#include <algorithm>

#include "timeutil.h"
#include "dsd_sync.h"
#include "dsd_decoder.h"

namespace DSDcc
{

// Sync wods - Symbol mapping: 01(1):+3, 00(0):+1, 10(2):-1, 11(3):-3
const unsigned char DSDDecoder::m_syncDMRDataBS[24] = {3, 1, 3, 3, 3, 3, 1, 1, 1, 3, 3, 1, 1, 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, 1}; // DF F5 7D 75 DF 5D
const unsigned char DSDDecoder::m_syncDMRVoiceBS[24] = {1, 3, 1, 1, 1, 1, 3, 3, 3, 1, 1, 3, 3, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 3}; // 75 5F D7 DF 75 F7
const unsigned char DSDDecoder::m_syncDMRDataMS[24] = {3, 1, 1, 1, 3, 1, 1, 3, 3, 3, 1, 3, 1, 3, 3, 3, 3, 1, 1, 3, 1, 1, 1, 3}; // D5 D7 F7 7F D7 57
const unsigned char DSDDecoder::m_syncDMRVoiceMS[24] = {1, 3, 3, 3, 1, 3, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 3, 3, 1, 3, 3, 3, 1}; // 7F 7D 5D D5 7D FD
const unsigned char DSDDecoder::m_syncDPMRFS1[24] = {1, 1, 1, 3, 3, 3, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 3, 1, 1, 1, 1, 3, 1, 3}; // 57 FF 5F 75 D5 77 - non packet data header
const unsigned char DSDDecoder::m_syncDPMRFS4[24] = {3, 3, 3, 1, 1, 1, 1, 1, 3, 3, 1, 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 1}; // FD 55 F5 DF 7F DD - packet data header
const unsigned char DSDDecoder::m_syncDPMRFS2[12] = {1, 1, 3, 3, 3, 3, 1, 3, 1, 3, 3, 1}; // 5F F7 7D - superframe sync (each 2 384 bit frames)
const unsigned char DSDDecoder::m_syncDPMRFS3[12] = {1, 3, 3, 1, 3, 1, 3, 3, 3, 3, 1, 1}; // 7D DF F5 end frame sync
const unsigned char DSDDecoder::m_syncNXDNRDCHFull[19] = {3, 1, 3, 1, 1, 3, 3, 3, 1, 3, 1, 3, 1, 3, 3, 1, 1, 3, 1};
const unsigned char DSDDecoder::m_syncNXDNRDCHFullInv[19] = {1, 3, 1, 3, 3, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 3, 3, 1, 3};
//const unsigned char DSDDecoder::m_syncNXDNRDCHFull[20] = {1, 3, 1, 3, 1, 1, 3, 3, 3, 1, 3, 1, 3, 1, 3, 3, 1, 1, 3, 1};
//const unsigned char DSDDecoder::m_syncNXDNRDCHFullInv[20] = {3, 1, 3, 1, 3, 3, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 3, 3, 1, 3};
const unsigned char DSDDecoder::m_syncNXDNRDCHFSW[10] = {3, 1, 3, 1, 3, 3, 1, 1, 3, 1};
const unsigned char DSDDecoder::m_syncNXDNRDCHFSWInv[10] = {1, 3, 1, 3, 1, 1, 3, 3, 1, 3};
const unsigned char DSDDecoder::m_syncDStarHeader[24] = {1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 1, 3, 3, 1, 1, 3, 1, 3, 1, 1, 1, 1};
const unsigned char DSDDecoder::m_syncDStarHeaderInv[24] = {3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 1, 3, 1, 1, 3, 3, 1, 3, 1, 3, 3, 3, 3};
const unsigned char DSDDecoder::m_syncDStar[24] = {3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, 3, 1, 1, 1, 3, 3, 1, 3, 1, 1, 1};
const unsigned char DSDDecoder::m_syncDStarInv[24] = {1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 3, 3, 1, 1, 3, 1, 3, 3, 3};
const unsigned char DSDDecoder::m_syncYSF[20] = {3, 1, 1, 1, 1, 3, 1, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 1, 3, 1}; // D4 71 C9 63 4D => D5 75 DD 77 5D
const unsigned char DSDDecoder::m_syncP25P1[24] = {1, 1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 3, 3, 3, 3, 1, 3, 1, 3, 3, 3, 3, 3};
const unsigned char DSDDecoder::m_syncP25P1Inv[24] = {3, 3, 3, 3, 3, 1, 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1};
const unsigned char DSDDecoder::m_syncX2TDMADataBS[24] = {3, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 3, 3, 3, 1, 1, 3, 3};
const unsigned char DSDDecoder::m_syncX2TDMAVoiceBS[24] = {1, 1, 3, 1, 3, 1, 3, 3, 3, 3, 3, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 3, 1, 1};
const unsigned char DSDDecoder::m_syncX2TDMADataMS[24] = {3, 1, 3, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3 ,3 ,3 ,1 ,3};
const unsigned char DSDDecoder::m_syncX2TDMAVoiceMS[24] = {1, 3, 1, 3, 3, 1, 1, 1, 1, 3 ,3, 3, 3, 3, 3, 3, 1, 1, 1, 1 ,1 ,1 ,3 ,1};
const unsigned char DSDDecoder::m_syncProVoice[32] = {1, 3, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3};
const unsigned char DSDDecoder::m_syncProVoiceInv[32] = {3, 1, 3, 1, 3, 1, 1, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1};
const unsigned char DSDDecoder::m_syncProVoiceEA[32] = {3, 1, 1, 3, 1, 3, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 1, 1, 3, 3, 1, 3, 1, 3, 1, 1, 3 ,1 ,1 ,1, 3 ,3};
const unsigned char DSDDecoder::m_syncProVoiceEAInv[32] = {1, 3, 3, 1, 3, 1, 3, 3, 1, 1, 3, 1, 1 ,3 ,3, 3, 3 ,3, 1, 1 ,3, 1, 3, 1, 3, 3, 1, 3, 3, 3, 1, 1};


DSDDecoder::DSDDecoder() :
m_fsmState(DSDLookForSync),
m_dsdSymbol(this),
Expand Down Expand Up @@ -666,12 +636,13 @@ int DSDDecoder::getFrameSync()
}
else // Sync identification starts here
{
DSDSync syncEngine;
m_dmrBurstType = DSDDMR::DSDDMRBurstNone;
unsigned char tmp[64];
syncEngine.matchAll(m_dsdSymbol.getSyncDibitBack(DSDSync::m_history));

if (m_opts.frame_p25p1 == 1)
{
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncP25P1, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncP25P1))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -687,7 +658,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2450;
return (int) DSDSyncP25p1P;
}
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncP25P1Inv, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncP25P1Inv))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4, true);
Expand All @@ -706,7 +677,7 @@ int DSDDecoder::getFrameSync()
}
if (m_opts.frame_x2tdma == 1)
{
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncX2TDMADataBS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncX2TDMADataBS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -724,7 +695,7 @@ int DSDDecoder::getFrameSync()
return (int) DSDSyncX2TDMADataP; // done
}

if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncX2TDMADataMS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncX2TDMADataMS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -742,7 +713,7 @@ int DSDDecoder::getFrameSync()
return (int) DSDSyncX2TDMADataP; // done
}

if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncX2TDMAVoiceBS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncX2TDMAVoiceBS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -760,7 +731,7 @@ int DSDDecoder::getFrameSync()
return (int) DSDSyncX2TDMAVoiceP; // done
}

if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncX2TDMAVoiceMS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncX2TDMAVoiceMS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -780,7 +751,7 @@ int DSDDecoder::getFrameSync()
}
if (m_opts.frame_ysf == 1)
{
if (memcmp(m_dsdSymbol.getSyncDibitBack(20), m_syncYSF, 20) == 0)
if (syncEngine.isMatching(DSDSync::SyncYSF))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -799,7 +770,7 @@ int DSDDecoder::getFrameSync()
}
if (m_opts.frame_dmr == 1)
{
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDMRDataBS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDMRDataBS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -820,7 +791,7 @@ int DSDDecoder::getFrameSync()
return (int) DSDSyncDMRDataP; // done
}

if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDMRDataMS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDMRDataMS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -841,7 +812,7 @@ int DSDDecoder::getFrameSync()
return (int) DSDSyncDMRDataMS; // done
}

if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDMRVoiceBS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDMRVoiceBS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -862,7 +833,7 @@ int DSDDecoder::getFrameSync()
return (int) DSDSyncDMRVoiceP; // done
}

if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDMRVoiceMS, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDMRVoiceMS))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -885,8 +856,7 @@ int DSDDecoder::getFrameSync()
}
if (m_opts.frame_provoice == 1)
{
if ((memcmp(m_dsdSymbol.getSyncDibitBack(32), m_syncProVoice, 32) == 0)
|| (memcmp(m_dsdSymbol.getSyncDibitBack(32), m_syncProVoiceEA, 32) == 0))
if (syncEngine.isMatching(DSDSync::SyncProVoice) || syncEngine.isMatching(DSDSync::SyncProVoiceEA))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -902,8 +872,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2450;
return (int) DSDSyncProVoiceP; // done
}
else if ((memcmp(m_dsdSymbol.getSyncDibitBack(32), m_syncProVoiceInv, 32) == 0)
|| (memcmp(m_dsdSymbol.getSyncDibitBack(32), m_syncProVoiceEAInv, 32) == 0))
else if (syncEngine.isMatching(DSDSync::SyncProVoiceInv) || syncEngine.isMatching(DSDSync::SyncProVoiceEAInv))
{
m_state.carrier = 1;
m_state.offset = m_synctest_pos;
Expand All @@ -924,7 +893,7 @@ int DSDDecoder::getFrameSync()
}
if ((m_opts.frame_nxdn96 == 1) || (m_opts.frame_nxdn48 == 1))
{
if (countDiff(m_dsdSymbol.getSyncDibitBack(19), m_syncNXDNRDCHFull, tmp, 19) <= 1) // long sync (with preamble)
if (syncEngine.isMatching(DSDSync::SyncNXDNRDCHFull)) // long sync (with preamble)
{
m_nxdnInterSyncCount = 0;
m_state.carrier = 1;
Expand Down Expand Up @@ -953,7 +922,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2450;
return (int) DSDSyncNXDNP; // done
}
else if (countDiff(m_dsdSymbol.getSyncDibitBack(19), m_syncNXDNRDCHFullInv, tmp, 19) <= 1) // long sync (with preamble) inverted
else if (syncEngine.isMatching(DSDSync::SyncNXDNRDCHFullInv)) // long sync (with preamble) inverted
{
m_nxdnInterSyncCount = 0;
m_state.carrier = 1;
Expand Down Expand Up @@ -982,7 +951,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2450;
return (int) DSDSyncNXDNN; // done
}
else if (countDiff(m_dsdSymbol.getSyncDibitBack(10), m_syncNXDNRDCHFSW, tmp, 10) <= 1) // short sync
else if (syncEngine.isMatching(DSDSync::SyncNXDNRDCHFSW)) // short sync
{
if ((m_nxdnInterSyncCount > 0) && (m_nxdnInterSyncCount % 192 == 0))
{
Expand Down Expand Up @@ -1016,7 +985,7 @@ int DSDDecoder::getFrameSync()
m_nxdnInterSyncCount = 0;
}
}
else if (countDiff(m_dsdSymbol.getSyncDibitBack(10), m_syncNXDNRDCHFSWInv, tmp, 10) <= 1) // short sync inverted
else if (syncEngine.isMatching(DSDSync::SyncNXDNRDCHFSWInv)) // short sync inverted
{
if ((m_nxdnInterSyncCount > 0) && (m_nxdnInterSyncCount % 192 == 0))
{
Expand Down Expand Up @@ -1053,7 +1022,7 @@ int DSDDecoder::getFrameSync()
}
if (m_opts.frame_dpmr == 1)
{
if(memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDPMRFS1, 24) == 0) // dPMR classic (not packet)
if (syncEngine.isMatching(DSDSync::SyncDPMRFS1)) // dPMR classic (not packet)
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(4);
Expand All @@ -1072,7 +1041,7 @@ int DSDDecoder::getFrameSync()
}
if (m_opts.frame_dstar == 1)
{
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDStar, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDStar))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(2);
Expand All @@ -1088,7 +1057,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2400;
return (int) DSDSyncDStarP;
}
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDStarInv, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDStarInv))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(2, true);
Expand All @@ -1104,7 +1073,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2400;
return (int) DSDSyncDStarN; // done
}
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDStarHeader, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDStarHeader))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(2);
Expand All @@ -1120,7 +1089,7 @@ int DSDDecoder::getFrameSync()
m_mbeRate = DSDMBERate3600x2400;
return (int) DSDSyncDStarHeaderP; // done
}
if (memcmp(m_dsdSymbol.getSyncDibitBack(24), m_syncDStarHeaderInv, 24) == 0)
if (syncEngine.isMatching(DSDSync::SyncDStarHeaderInv))
{
m_state.carrier = 1;
m_dsdSymbol.setFSK(2, true);
Expand Down Expand Up @@ -1470,10 +1439,4 @@ int DSDDecoder::comp(const void *a, const void *b)
return 1;
}

int DSDDecoder::countDiff(const unsigned char *a, const unsigned char *b, unsigned char *t, unsigned int len)
{
std::transform(a, a + len, b, t, std::bit_xor<unsigned char>());
return std::count_if(t, t + len, [](unsigned char& c) { return c != 0; });
}

} // namespace dsdcc
Loading

0 comments on commit 5895037

Please sign in to comment.