Conditional debug statements for the decoder

This commit is contained in:
Jordan Sherer 2019-11-12 20:12:16 -05:00
parent 5d7ef702ab
commit 6181928c6c
2 changed files with 45 additions and 44 deletions

View File

@ -10,6 +10,7 @@
#define JS8_USE_IHSYM 0 // compute ihsym manually instead of from symspec #define JS8_USE_IHSYM 0 // compute ihsym manually instead of from symspec
#define JS8_RING_BUFFER 1 // use a ring buffer instead of clearing the decode frames #define JS8_RING_BUFFER 1 // use a ring buffer instead of clearing the decode frames
#define JS8_SINGLE_DECODE 0 // single submode decode per instantiation of the decoder #define JS8_SINGLE_DECODE 0 // single submode decode per instantiation of the decoder
#define JS8_DEBUG_DECODE 0 // emit debug statements for the decode pipeline
#define JS8_NUM_SYMBOLS 79 #define JS8_NUM_SYMBOLS 79
#define JS8_ENABLE_JS8A 1 #define JS8_ENABLE_JS8A 1

View File

@ -2638,7 +2638,7 @@ void MainWindow::dataSink(qint64 frames)
static int lastCycle = -1; static int lastCycle = -1;
int cycle = computeCycleForDecode(m_nSubMode, k); int cycle = computeCycleForDecode(m_nSubMode, k);
if(cycle != lastCycle){ if(cycle != lastCycle){
qDebug() << "period loop, resetting ssum"; if(JS8_DEBUG_DECODE) qDebug() << "period loop, resetting ssum";
memset(ssum, 0, sizeof(ssum)); memset(ssum, 0, sizeof(ssum));
} }
lastCycle = cycle; lastCycle = cycle;
@ -3954,7 +3954,7 @@ bool MainWindow::isDecodeReady(int submode, qint32 k, qint32 k0, qint32 *pCurren
qint32 delta = qAbs(k-k0); qint32 delta = qAbs(k-k0);
if(delta > cycleFrames){ if(delta > cycleFrames){
qDebug() << "-->" << submodeName(submode) << "buffer advance delta" << delta; if(JS8_DEBUG_DECODE) qDebug() << "-->" << submodeName(submode) << "buffer advance delta" << delta;
} }
// on buffer loop, prepare proper next decode start // on buffer loop, prepare proper next decode start
@ -3966,7 +3966,7 @@ bool MainWindow::isDecodeReady(int submode, qint32 k, qint32 k0, qint32 *pCurren
bool ready = *pCurrentDecodeStart + framesNeeded <= k; bool ready = *pCurrentDecodeStart + framesNeeded <= k;
if(ready){ if(ready){
qDebug() << "-->" << submodeName(submode) << "from" << *pCurrentDecodeStart << "to" << *pCurrentDecodeStart+framesNeeded << "k" << k << "k0" << k0; if(JS8_DEBUG_DECODE) qDebug() << "-->" << submodeName(submode) << "from" << *pCurrentDecodeStart << "to" << *pCurrentDecodeStart+framesNeeded << "k" << k << "k0" << k0;
if(pCycle) *pCycle = currentCycle; if(pCycle) *pCycle = currentCycle;
if(pStart) *pStart = *pCurrentDecodeStart; if(pStart) *pStart = *pCurrentDecodeStart;
@ -3991,22 +3991,22 @@ bool MainWindow::decode(){
int kZero = k0; int kZero = k0;
k0 = k; k0 = k;
qDebug() << "decoder checking if ready..." << "k" << k << "k0" << kZero; if(JS8_DEBUG_DECODE) qDebug() << "decoder checking if ready..." << "k" << k << "k0" << kZero;
if(isMessageQueuedForTransmit()){ if(isMessageQueuedForTransmit()){
qDebug() << "--> decoder paused during transmit"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused during transmit";
return false; return false;
} }
int threshold = 1000; // one second int threshold = 1000; // one second
if(isInTransmitDecodeThreshold(threshold)){ if(isInTransmitDecodeThreshold(threshold)){
qDebug() << "--> decoder paused for" << threshold << "ms after transmit stop"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused for" << threshold << "ms after transmit stop";
return false; return false;
} }
bool ready = decodeEnqueueReady(k, kZero); bool ready = decodeEnqueueReady(k, kZero);
if(ready || !m_decoderQueue.isEmpty()){ if(ready || !m_decoderQueue.isEmpty()){
qDebug() << "--> decoder is ready to be run with" << m_decoderQueue.count() << "decode periods"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder is ready to be run with" << m_decoderQueue.count() << "decode periods";
} }
// TODO: this can be pulled out to an async process // TODO: this can be pulled out to an async process
@ -4139,12 +4139,12 @@ bool MainWindow::decodeEnqueueReady(qint32 k, qint32 k0){
*/ */
bool MainWindow::decodeProcessQueue(qint32 *pSubmode){ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
if(m_decoderBusy){ if(m_decoderBusy){
qDebug() << "--> decoder is busy!"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder is busy!";
return false; return false;
} }
if(m_decoderQueue.isEmpty()){ if(m_decoderQueue.isEmpty()){
qDebug() << "--> decoder has nothing to process!"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder has nothing to process!";
return false; return false;
} }
@ -4158,7 +4158,7 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
int count = m_decoderQueue.count(); int count = m_decoderQueue.count();
if(count > maxDecodes){ if(count > maxDecodes){
qDebug() << "--> decoder skipping at least 1 decode cycle" << "count" << count << "max" << maxDecodes; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder skipping at least 1 decode cycle" << "count" << count << "max" << maxDecodes;
} }
dec_data.params.nsubmodes = 0; dec_data.params.nsubmodes = 0;
@ -4206,7 +4206,7 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
} }
if(submode == -1){ if(submode == -1){
qDebug() << "--> decoder has no segments to decode!"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder has no segments to decode!";
return false; return false;
} }
@ -4330,21 +4330,21 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
*/ */
void MainWindow::decodeStart(){ void MainWindow::decodeStart(){
if(m_decoderBusy){ if(m_decoderBusy){
qDebug() << "--> decoder cannot start...busy"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder cannot start...busy";
return; return;
} }
// mark the decoder busy early while we prep the memory copy // mark the decoder busy early while we prep the memory copy
decodeBusy(true); decodeBusy(true);
{ {
qDebug() << "--> decoder starting"; if(JS8_DEBUG_DECODE) qDebug() << "--> decoder starting";
qDebug() << " --> kin:" << dec_data.params.kin; if(JS8_DEBUG_DECODE) qDebug() << " --> kin:" << dec_data.params.kin;
qDebug() << " --> newdat:" << dec_data.params.newdat; if(JS8_DEBUG_DECODE) qDebug() << " --> newdat:" << dec_data.params.newdat;
qDebug() << " --> nsubmodes:" << dec_data.params.nsubmodes; if(JS8_DEBUG_DECODE) qDebug() << " --> nsubmodes:" << dec_data.params.nsubmodes;
qDebug() << " --> A:" << dec_data.params.kposA << dec_data.params.kposA + dec_data.params.kszA << QString("(%1)").arg(dec_data.params.kszA); if(JS8_DEBUG_DECODE) qDebug() << " --> A:" << dec_data.params.kposA << dec_data.params.kposA + dec_data.params.kszA << QString("(%1)").arg(dec_data.params.kszA);
qDebug() << " --> B:" << dec_data.params.kposB << dec_data.params.kposB + dec_data.params.kszB << QString("(%1)").arg(dec_data.params.kszB); if(JS8_DEBUG_DECODE) qDebug() << " --> B:" << dec_data.params.kposB << dec_data.params.kposB + dec_data.params.kszB << QString("(%1)").arg(dec_data.params.kszB);
qDebug() << " --> C:" << dec_data.params.kposC << dec_data.params.kposC + dec_data.params.kszC << QString("(%1)").arg(dec_data.params.kszC); if(JS8_DEBUG_DECODE) qDebug() << " --> C:" << dec_data.params.kposC << dec_data.params.kposC + dec_data.params.kszC << QString("(%1)").arg(dec_data.params.kszC);
qDebug() << " --> E:" << dec_data.params.kposE << dec_data.params.kposE + dec_data.params.kszE << QString("(%1)").arg(dec_data.params.kszE); if(JS8_DEBUG_DECODE) qDebug() << " --> E:" << dec_data.params.kposE << dec_data.params.kposE + dec_data.params.kszE << QString("(%1)").arg(dec_data.params.kszE);
//newdat=1 ==> this is new data, must do the big FFT //newdat=1 ==> this is new data, must do the big FFT
//nagain=1 ==> decode only at fQSO +/- Tol //nagain=1 ==> decode only at fQSO +/- Tol