From aa68c907fa93663667b71a69107f450c17972176 Mon Sep 17 00:00:00 2001 From: Edouard Griffiths Date: Wed, 27 Jul 2016 18:49:17 +0200 Subject: [PATCH] SDRdaemonFEC plugin: improve stats on GUI --- .../sdrdaemonfec/sdrdaemonfecbuffer.cpp | 7 ++ .../sdrdaemonfec/sdrdaemonfecbuffer.h | 12 ++++ .../sdrdaemonfec/sdrdaemonfecgui.cpp | 10 ++- .../sdrdaemonfec/sdrdaemonfecgui.h | 2 + .../sdrdaemonfec/sdrdaemonfecgui.ui | 70 ++++++++++++++----- .../sdrdaemonfec/sdrdaemonfecinput.h | 30 +++++--- .../sdrdaemonfec/sdrdaemonfecudphandler.cpp | 9 +-- 7 files changed, 108 insertions(+), 32 deletions(-) diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp index 2827fbcce..143cc74e4 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp @@ -33,6 +33,7 @@ SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) : m_decoderIndexHead(nbDecoderSlots/2), m_curNbBlocks(0), m_minNbBlocks(256), + m_minOriginalBlocks(128), m_curNbRecovery(0), m_maxNbRecovery(0), m_framesDecoded(true), @@ -89,8 +90,10 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) // collect stats before voiding the slot m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount; + m_curOriginalBlocks = m_decoderSlots[slotIndex].m_originalCount; m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount; m_avgNbBlocks(m_curNbBlocks); + m_avgOrigBlocks(m_curOriginalBlocks); m_avgNbRecovery(m_curNbRecovery); m_framesDecoded = m_framesDecoded && m_decoderSlots[slotIndex].m_decoded; @@ -98,6 +101,10 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) m_minNbBlocks = m_curNbBlocks; } + if (m_curOriginalBlocks < m_minOriginalBlocks) { + m_minOriginalBlocks = m_curOriginalBlocks; + } + if (m_curNbRecovery > m_maxNbRecovery) { m_maxNbRecovery = m_curNbRecovery; } diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h index c4c9b0b2b..5b0353b21 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h @@ -100,8 +100,10 @@ public: // stats int getCurNbBlocks() const { return m_curNbBlocks; } + int getCurOriginalBlocks() const { return m_curOriginalBlocks; } int getCurNbRecovery() const { return m_curNbRecovery; } float getAvgNbBlocks() const { return m_avgNbBlocks; } + float getAvgOriginalBlocks() const { return m_avgOrigBlocks; } float getAvgNbRecovery() const { return m_avgNbRecovery; } int getMinNbBlocks() @@ -111,6 +113,13 @@ public: return minNbBlocks; } + int getMinOriginalBlocks() + { + int minOriginalBlocks = m_minOriginalBlocks; + m_minOriginalBlocks = 128; + return minOriginalBlocks; + } + int getMaxNbRecovery() { int maxNbRecovery = m_maxNbRecovery; @@ -183,9 +192,12 @@ private: int m_frameHead; //!< index of the current head frame sent int m_curNbBlocks; //!< (stats) instantaneous number of blocks received int m_minNbBlocks; //!< (stats) minimum number of blocks received since last poll + int m_curOriginalBlocks; //!< (stats) instantanous number of original blocks received + int m_minOriginalBlocks; //!< (stats) minimum number of original blocks received since last poll int m_curNbRecovery; //!< (stats) instantaneous number of recovery blocks used int m_maxNbRecovery; //!< (stats) maximum number of recovery blocks used since last poll MovingAverage m_avgNbBlocks; //!< (stats) average number of blocks received + MovingAverage m_avgOrigBlocks; //!< (stats) average number of original blocks received MovingAverage m_avgNbRecovery; //!< (stats) average number of recovery blocks used bool m_framesDecoded; //!< [stats] true if all frames were decoded since last poll int m_readIndex; //!< current byte read index in frames buffer diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp index 4cd50a62c..4bc0eee50 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp @@ -291,8 +291,10 @@ bool SDRdaemonFECGui::handleMessage(const Message& message) m_bufferLengthInSecs = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferLengthInSecs(); m_bufferGauge = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferGauge(); m_minNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbBlocks(); - m_maxNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getmAXNbRecovery(); + m_minNbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbOriginalBlocks(); + m_maxNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMaxNbRecovery(); m_avgNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbBlocks(); + m_avgNbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbOriginalBlocks(); m_avgNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbRecovery(); m_nbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbOriginalBlocksPerFrame(); m_nbFECBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbFECBlocksPerFrame(); @@ -625,8 +627,11 @@ void SDRdaemonFECGui::updateWithStreamTime() s = QString::number(m_avgNbBlocks, 'f', 1); ui->avgNbBlocksText->setText(tr("%1").arg(s)); + s = QString::number(m_minNbOriginalBlocks, 'f', 0); + ui->minNbOriginalText->setText(tr("%1").arg(s)); + s = QString::number(m_maxNbRecovery, 'f', 0); - ui->curNbRecoveryText->setText(tr("%1").arg(s)); + ui->maxNbRecoveryText->setText(tr("%1").arg(s)); s = QString::number(m_avgNbRecovery, 'f', 1); ui->avgNbRecoveryText->setText(tr("%1").arg(s)); @@ -672,4 +677,3 @@ void SDRdaemonFECGui::tick() m_sampleSource->getInputMessageQueue()->push(message); } } - diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h index 0ab9b5f8d..198e4f8e8 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h @@ -68,8 +68,10 @@ private: float m_bufferLengthInSecs; int32_t m_bufferGauge; int m_minNbBlocks; + int m_minNbOriginalBlocks; int m_maxNbRecovery; float m_avgNbBlocks; + float m_avgNbOriginalBlocks; float m_avgNbRecovery; int m_nbOriginalBlocks; int m_nbFECBlocks; diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui index dfd22b3cc..7e227d245 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui @@ -29,7 +29,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -339,13 +348,6 @@ - - - - Qt::Vertical - - - @@ -373,7 +375,33 @@ - + + + + 24 + 0 + + + + Minimum number of original blocks retrieved per frame + + + 000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + + + + 24 @@ -391,13 +419,6 @@ - - - - Qt::Vertical - - - @@ -906,6 +927,23 @@ + + + + + + + + + + + + + + + + + diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h index 68e37ccbc..45c0ad296 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h @@ -170,8 +170,10 @@ public: float getBufferLengthInSecs() const { return m_bufferLenSec; } int32_t getBufferGauge() const { return m_bufferGauge; } int getMinNbBlocks() const { return m_minNbBlocks; } - int getmAXNbRecovery() const { return m_maxNbRecovery; } + int getMinNbOriginalBlocks() const { return m_minNbOriginalBlocks; } + int getMaxNbRecovery() const { return m_maxNbRecovery; } float getAvgNbBlocks() const { return m_avgNbBlocks; } + float getAvgNbOriginalBlocks() const { return m_avgNbOriginalBlocks; } float getAvgNbRecovery() const { return m_avgNbRecovery; } int getNbOriginalBlocksPerFrame() const { return m_nbOriginalBlocksPerFrame; } int getNbFECBlocksPerFrame() const { return m_nbFECBlocksPerFrame; } @@ -181,9 +183,11 @@ public: float bufferLenSec, int32_t bufferGauge, int framesDecodingStatus, - int curNbBlocks, - int curNbRecovery, + int minNbBlocks, + int minNbOriginalBlocks, + int maxNbRecovery, float avgNbBlocks, + float avgNbOriginalBlocks, float avgNbRecovery, int nbOriginalBlocksPerFrame, int nbFECBlocksPerFrame) @@ -193,9 +197,11 @@ public: bufferLenSec, bufferGauge, framesDecodingStatus, - curNbBlocks, - curNbRecovery, + minNbBlocks, + minNbOriginalBlocks, + maxNbRecovery, avgNbBlocks, + avgNbOriginalBlocks, avgNbRecovery, nbOriginalBlocksPerFrame, nbFECBlocksPerFrame); @@ -208,8 +214,10 @@ public: float m_bufferLenSec; int32_t m_bufferGauge; int m_minNbBlocks; + int m_minNbOriginalBlocks; int m_maxNbRecovery; float m_avgNbBlocks; + float m_avgNbOriginalBlocks; float m_avgNbRecovery; int m_nbOriginalBlocksPerFrame; int m_nbFECBlocksPerFrame; @@ -219,9 +227,11 @@ public: float bufferLenSec, int32_t bufferGauge, int framesDecodingStatus, - int curNbBlocks, - int curNbRecovery, + int minNbBlocks, + int minNbOriginalBlocks, + int maxNbRecovery, float avgNbBlocks, + float avgNbOriginalBlocks, float avgNbRecovery, int nbOriginalBlocksPerFrame, int nbFECBlocksPerFrame) : @@ -231,9 +241,11 @@ public: m_framesDecodingStatus(framesDecodingStatus), m_bufferLenSec(bufferLenSec), m_bufferGauge(bufferGauge), - m_minNbBlocks(curNbBlocks), - m_maxNbRecovery(curNbRecovery), + m_minNbBlocks(minNbBlocks), + m_minNbOriginalBlocks(minNbOriginalBlocks), + m_maxNbRecovery(maxNbRecovery), m_avgNbBlocks(avgNbBlocks), + m_avgNbOriginalBlocks(avgNbOriginalBlocks), m_avgNbRecovery(avgNbRecovery), m_nbOriginalBlocksPerFrame(nbOriginalBlocksPerFrame), m_nbFECBlocksPerFrame(nbFECBlocksPerFrame) diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp index 760081afb..33d245109 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp @@ -224,12 +224,13 @@ void SDRdaemonFECUDPHandler::tick() else { int framesDecodingStatus; - int minNbBlocks = m_sdrDaemonBuffer.getMinNbBlocks(); + int minNbBlocks = m_sdrDaemonBuffer.getMinNbBlocks(); + int minNbOriginalBlocks = m_sdrDaemonBuffer.getMinOriginalBlocks(); int nbOriginalBlocks = m_sdrDaemonBuffer.getCurrentMeta().m_nbOriginalBlocks; int nbFECblocks = m_sdrDaemonBuffer.getCurrentMeta().m_nbFECBlocks; m_tickCount = 0; - framesDecodingStatus = (minNbBlocks < nbOriginalBlocks ? 0 : (minNbBlocks < nbOriginalBlocks + nbFECblocks ? 1 : 2)); + framesDecodingStatus = (minNbOriginalBlocks == nbOriginalBlocks ? 2 : (minNbOriginalBlocks < nbOriginalBlocks - nbFECblocks ? 0 : 1)); SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming *report = SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming::create( m_tv_sec, @@ -238,13 +239,13 @@ void SDRdaemonFECUDPHandler::tick() m_sdrDaemonBuffer.getBufferGauge(), framesDecodingStatus, minNbBlocks, + minNbOriginalBlocks, m_sdrDaemonBuffer.getMaxNbRecovery(), m_sdrDaemonBuffer.getAvgNbBlocks(), + m_sdrDaemonBuffer.getAvgOriginalBlocks(), m_sdrDaemonBuffer.getAvgNbRecovery(), nbOriginalBlocks, nbFECblocks); m_outputMessageQueueToGUI->push(report); } } - -