Cleaning up frame dedupe, decode debug, and decode buffer thresholds

This commit is contained in:
Jordan Sherer 2020-05-14 21:14:01 -04:00
parent 0869bc3f57
commit 97dfc7f52f
7 changed files with 31 additions and 14 deletions

View File

@ -13,6 +13,7 @@
#define JS8_DECODE_THREAD 1 // use a separate thread for decode process handling #define JS8_DECODE_THREAD 1 // use a separate thread for decode process handling
#define JS8_ALLOW_EXTENDED 1 // allow extended latin-1 capital charset #define JS8_ALLOW_EXTENDED 1 // allow extended latin-1 capital charset
#define JS8_SAVE_AUDIO 0 // enable the save menu #define JS8_SAVE_AUDIO 0 // enable the save menu
#define JS8_AUTO_SYNC 0 // enable the experimental auto sync feature
#ifdef QT_DEBUG #ifdef QT_DEBUG
#define JS8_DEBUG_DECODE 0 // emit debug statements for the decode pipeline #define JS8_DEBUG_DECODE 0 // emit debug statements for the decode pipeline

View File

@ -26,6 +26,7 @@ DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString
, isAlt_(false) , isAlt_(false)
, bits_{0} , bits_{0}
, submode_{ string_.mid(column_mode + padding_, 3).trimmed().at(0).cell() - 'A' } , submode_{ string_.mid(column_mode + padding_, 3).trimmed().at(0).cell() - 'A' }
, frame_ { string_.mid (column_qsoText + padding_, 12).trimmed () }
{ {
if(message_.length() >= 1) { if(message_.length() >= 1) {
message_ = message_.left (21).remove (QRegularExpression {"[<>]"}); message_ = message_.left (21).remove (QRegularExpression {"[<>]"});
@ -71,7 +72,8 @@ DecodedText::DecodedText (QString const& js8callmessage, int bits, int submode):
isHeartbeat_(false), isHeartbeat_(false),
isAlt_(false), isAlt_(false),
bits_(bits), bits_(bits),
submode_(submode) submode_(submode),
frame_(js8callmessage)
{ {
is_standard_ = QRegularExpression("^(CQ|DE|QRZ)\\s").match(message_).hasMatch(); is_standard_ = QRegularExpression("^(CQ|DE|QRZ)\\s").match(message_).hasMatch();

View File

@ -41,6 +41,7 @@ public:
bool tryUnpackFastData(); bool tryUnpackFastData();
quint8 frameType() const { return frameType_; } quint8 frameType() const { return frameType_; }
QString frame() const { return frame_; }
QString extra() const { return extra_; } QString extra() const { return extra_; }
QString compoundCall() const { return compound_; } QString compoundCall() const { return compound_; }
@ -113,6 +114,7 @@ private:
bool is_standard_; bool is_standard_;
int bits_; int bits_;
int submode_; int submode_;
QString frame_;
}; };
#endif // DECODEDTEXT_H #endif // DECODEDTEXT_H

View File

@ -91,7 +91,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
imax=int(NTMAX*12000) imax=int(NTMAX*12000)
if(params%syncStats) then if(params%syncStats) then
write(*,*) '<DecodeDebug> sync start', pos, sz write(*,*) '<DecodeSyncMeta> sync start', pos, sz
endif endif
if((imax-pos).lt.sz) then if((imax-pos).lt.sz) then
@ -129,7 +129,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
imax=int(NTMAX*12000) imax=int(NTMAX*12000)
if(params%syncStats) then if(params%syncStats) then
write(*,*) '<DecodeDebug> sync start', pos, sz write(*,*) '<DecodeSyncMeta> sync start', pos, sz
endif endif
if((imax-pos).lt.sz) then if((imax-pos).lt.sz) then
@ -167,7 +167,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
imax=int(NTMAX*12000) imax=int(NTMAX*12000)
if(params%syncStats) then if(params%syncStats) then
write(*,*) '<DecodeDebug> sync start', pos, sz write(*,*) '<DecodeSyncMeta> sync start', pos, sz
endif endif
if((imax-pos).lt.sz) then if((imax-pos).lt.sz) then
@ -205,7 +205,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
imax=int(NTMAX*12000) imax=int(NTMAX*12000)
if(params%syncStats) then if(params%syncStats) then
write(*,*) '<DecodeDebug> sync start', pos, sz write(*,*) '<DecodeSyncMeta> sync start', pos, sz
endif endif
if((imax-pos).lt.sz) then if((imax-pos).lt.sz) then
@ -243,7 +243,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
imax=int(NTMAX*12000) imax=int(NTMAX*12000)
if(params%syncStats) then if(params%syncStats) then
write(*,*) '<DecodeDebug> sync start', pos, sz write(*,*) '<DecodeSyncMeta> sync start', pos, sz
endif endif
if((imax-pos).lt.sz) then if((imax-pos).lt.sz) then

View File

@ -108,7 +108,7 @@ contains
xdt=candidate(2,icand) xdt=candidate(2,icand)
xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz
if(NWRITELOG.eq.0) then if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase write(*,*) '<DecodeDebug> candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase
flush(6) flush(6)
endif endif

View File

@ -1022,6 +1022,11 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
if(!JS8_ENABLE_JS8I){ if(!JS8_ENABLE_JS8I){
ui->actionModeJS8Ultra->setVisible(false); ui->actionModeJS8Ultra->setVisible(false);
} }
if(!JS8_AUTO_SYNC){
ui->actionModeAutoSync->setVisible(false);
ui->actionModeAutoSync->setEnabled(false);
ui->actionModeAutoSync->setChecked(false);
}
// prep // prep
prepareMonitorControls(); prepareMonitorControls();
@ -4284,6 +4289,11 @@ bool MainWindow::decode(qint32 k){
return false; return false;
} }
if(m_decoderBusyStartTime.isValid() && m_decoderBusyStartTime.msecsTo(QDateTime::currentDateTimeUtc()) < 1000){
if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused for 1000 ms after last decode start";
return false;
}
int threshold = m_nSubMode == Varicode::JS8CallSlow ? 4000 : 2000; // two seconds int threshold = m_nSubMode == Varicode::JS8CallSlow ? 4000 : 2000; // two seconds
if(isInDecodeDelayThreshold(threshold)){ if(isInDecodeDelayThreshold(threshold)){
if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused for" << threshold << "ms after transmit stop"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused for" << threshold << "ms after transmit stop";
@ -4491,7 +4501,7 @@ bool MainWindow::decodeEnqueueReadyExperiment(qint32 k, qint32 /*k0*/){
bool everySecond = ui->actionModeAutoSync->isChecked(); bool everySecond = ui->actionModeAutoSync->isChecked();
// do we need to process alternate positions? // do we need to process alternate positions?
bool skipAlt = true; bool skipAlt = false;
foreach(auto submode, submodes.keys()){ foreach(auto submode, submodes.keys()){
// skip if multi is disabled and this mode is not the current submode // skip if multi is disabled and this mode is not the current submode
@ -4542,7 +4552,10 @@ bool MainWindow::decodeEnqueueReadyExperiment(qint32 k, qint32 /*k0*/){
// keep track of last decode position // keep track of last decode position
m_lastDecodeStartMap[submode] = k; m_lastDecodeStartMap[submode] = k;
} }
else if(incrementedBy >= oneSecondSamples && (cycleFramesReady >= cycleFramesNeeded || cycleFramesReady < oneSecondSamples)){ else if(
(incrementedBy >= 2*oneSecondSamples && cycleFramesReady >= cycleFramesNeeded ) ||
(incrementedBy >= oneSecondSamples && cycleFramesReady < 1.25*oneSecondSamples)
){
DecodeParams d; DecodeParams d;
d.submode = submode; d.submode = submode;
d.start = cycle*cycleFrames; d.start = cycle*cycleFrames;
@ -5209,7 +5222,7 @@ void MainWindow::readFromStdout(QProcess * proc) //r
} }
void MainWindow::processDecodedLine(QByteArray t){ void MainWindow::processDecodedLine(QByteArray t){
qDebug() << "JS8: " << QString(t); if(JS8_DEBUG_DECODE) qDebug() << "JS8: " << QString(t);
bool bAvgMsg=false; bool bAvgMsg=false;
int navg=0; int navg=0;
@ -5217,7 +5230,7 @@ void MainWindow::processDecodedLine(QByteArray t){
static QList<int> driftQueue; static QList<int> driftQueue;
static qint32 syncStart = -1; static qint32 syncStart = -1;
if(t.indexOf("<DecodeDebug> sync start") >= 0){ if(t.indexOf("<DecodeSyncMeta> sync start") >= 0){
auto segs = QString(t.trimmed()).split(QRegExp("[\\s\\t]+"), QString::SkipEmptyParts); auto segs = QString(t.trimmed()).split(QRegExp("[\\s\\t]+"), QString::SkipEmptyParts);
if(segs.isEmpty()){ if(segs.isEmpty()){
return; return;
@ -5414,9 +5427,8 @@ void MainWindow::processDecodedLine(QByteArray t){
// frames are also valid if they pass our dupe check (haven't seen the same frame in the past 1/2 decode period) // frames are also valid if they pass our dupe check (haven't seen the same frame in the past 1/2 decode period)
auto frame = decodedtext.message();
auto frameOffset = decodedtext.frequencyOffset(); auto frameOffset = decodedtext.frequencyOffset();
auto frameDedupeKey = QString("%1:%2").arg(decodedtext.submode()).arg(frame); auto frameDedupeKey = QString("%1:%2").arg(decodedtext.submode()).arg(decodedtext.frame());
if(m_messageDupeCache.contains(frameDedupeKey)){ if(m_messageDupeCache.contains(frameDedupeKey)){
auto cached = m_messageDupeCache.value(frameDedupeKey); auto cached = m_messageDupeCache.value(frameDedupeKey);

View File

@ -616,7 +616,7 @@ private:
bool m_loopall; bool m_loopall;
bool m_decoderBusy; bool m_decoderBusy;
QString m_decoderBusyBand; QString m_decoderBusyBand;
QMap<qint32, qint32> m_lastDecodeStartMap; QMap<qint32, qint32> m_lastDecodeStartMap; // submode, decode k start position
Radio::Frequency m_decoderBusyFreq; Radio::Frequency m_decoderBusyFreq;
QDateTime m_decoderBusyStartTime; QDateTime m_decoderBusyStartTime;
bool m_auto; bool m_auto;