mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
SDRdaemonFEC support: debug (6). Corrected meta data processing
This commit is contained in:
parent
3e388987c8
commit
278f085dbc
@ -67,6 +67,7 @@ void SDRdaemonFECBuffer::initDecodeAllSlots()
|
|||||||
m_decoderSlots[i].m_blockCount = 0;
|
m_decoderSlots[i].m_blockCount = 0;
|
||||||
m_decoderSlots[i].m_recoveryCount = 0;
|
m_decoderSlots[i].m_recoveryCount = 0;
|
||||||
m_decoderSlots[i].m_decoded = false;
|
m_decoderSlots[i].m_decoded = false;
|
||||||
|
m_decoderSlots[i].m_metaRetrieved = false;
|
||||||
m_decoderSlots[i].m_blockZero.m_metaData.init();
|
m_decoderSlots[i].m_blockZero.m_metaData.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,10 +83,10 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
|
|||||||
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
|
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
|
||||||
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
|
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
|
||||||
|
|
||||||
if (m_decoderSlots[slotIndex].m_blockZero.m_metaData.m_nbFECBlocks < 0) { // meta data invalid
|
if (m_decoderSlots[slotIndex].m_metaRetrieved) { // meta data was retrieved in the current slot
|
||||||
m_outputMeta = m_currentMeta; // use current meta
|
|
||||||
} else {
|
|
||||||
m_outputMeta = m_decoderSlots[slotIndex].m_blockZero.m_metaData;
|
m_outputMeta = m_decoderSlots[slotIndex].m_blockZero.m_metaData;
|
||||||
|
} else {
|
||||||
|
m_outputMeta = m_currentMeta; // use stored current meta
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect stats before voiding the slot
|
// collect stats before voiding the slot
|
||||||
@ -97,6 +98,7 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
|
|||||||
m_decoderSlots[slotIndex].m_blockCount = 0;
|
m_decoderSlots[slotIndex].m_blockCount = 0;
|
||||||
m_decoderSlots[slotIndex].m_recoveryCount = 0;
|
m_decoderSlots[slotIndex].m_recoveryCount = 0;
|
||||||
m_decoderSlots[slotIndex].m_decoded = false;
|
m_decoderSlots[slotIndex].m_decoded = false;
|
||||||
|
m_decoderSlots[slotIndex].m_metaRetrieved = false;
|
||||||
m_decoderSlots[slotIndex].m_blockZero.m_metaData.init();
|
m_decoderSlots[slotIndex].m_blockZero.m_metaData.init();
|
||||||
memset((void *) m_decoderSlots[slotIndex].m_blockZero.m_samples, 0, samplesPerBlockZero * sizeof(Sample));
|
memset((void *) m_decoderSlots[slotIndex].m_blockZero.m_samples, 0, samplesPerBlockZero * sizeof(Sample));
|
||||||
memset((void *) m_frames[slotIndex].m_blocks, 0, (m_nbOriginalBlocks - 1) * samplesPerBlock * sizeof(Sample));
|
memset((void *) m_frames[slotIndex].m_blocks, 0, (m_nbOriginalBlocks - 1) * samplesPerBlock * sizeof(Sample));
|
||||||
@ -171,6 +173,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
|||||||
{
|
{
|
||||||
SuperBlockZero *superBlockZero = (SuperBlockZero *) array;
|
SuperBlockZero *superBlockZero = (SuperBlockZero *) array;
|
||||||
m_decoderSlots[decoderIndex].m_blockZero = superBlockZero->protectedBlock;
|
m_decoderSlots[decoderIndex].m_blockZero = superBlockZero->protectedBlock;
|
||||||
|
m_decoderSlots[decoderIndex].m_metaRetrieved = true;
|
||||||
m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[blockHead].Block = (void *) &m_decoderSlots[decoderIndex].m_blockZero;
|
m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[blockHead].Block = (void *) &m_decoderSlots[decoderIndex].m_blockZero;
|
||||||
memcpy((void *) m_frames[decoderIndex].m_blockZero.m_samples,
|
memcpy((void *) m_frames[decoderIndex].m_blockZero.m_samples,
|
||||||
(const void *) m_decoderSlots[decoderIndex].m_blockZero.m_samples,
|
(const void *) m_decoderSlots[decoderIndex].m_blockZero.m_samples,
|
||||||
@ -192,13 +195,13 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
|||||||
}
|
}
|
||||||
else if (!m_decoderSlots[decoderIndex].m_decoded) // ready to decode
|
else if (!m_decoderSlots[decoderIndex].m_decoded) // ready to decode
|
||||||
{
|
{
|
||||||
if (m_decoderSlots[decoderIndex].m_blockZero.m_metaData.m_nbFECBlocks < 0) // block zero has not been received
|
if (m_decoderSlots[decoderIndex].m_metaRetrieved) // block zero with its meta data has been received
|
||||||
{
|
{
|
||||||
m_paramsCM256.RecoveryCount = m_currentMeta.m_nbFECBlocks; // take last value for number of FEC blocks
|
m_paramsCM256.RecoveryCount = m_decoderSlots[decoderIndex].m_blockZero.m_metaData.m_nbFECBlocks;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_paramsCM256.RecoveryCount = m_decoderSlots[decoderIndex].m_blockZero.m_metaData.m_nbFECBlocks;
|
m_paramsCM256.RecoveryCount = m_currentMeta.m_nbFECBlocks; // take last stored value for number of FEC blocks
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_decoderSlots[decoderIndex].m_recoveryCount > 0) // recovery data used
|
if (m_decoderSlots[decoderIndex].m_recoveryCount > 0) // recovery data used
|
||||||
@ -223,6 +226,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
|||||||
{
|
{
|
||||||
ProtectedBlockZero *recoveredBlockZero = (ProtectedBlockZero *) &m_decoderSlots[decoderIndex].m_recoveryBlocks[ir];
|
ProtectedBlockZero *recoveredBlockZero = (ProtectedBlockZero *) &m_decoderSlots[decoderIndex].m_recoveryBlocks[ir];
|
||||||
m_decoderSlots[decoderIndex].m_blockZero.m_metaData = recoveredBlockZero->m_metaData;
|
m_decoderSlots[decoderIndex].m_blockZero.m_metaData = recoveredBlockZero->m_metaData;
|
||||||
|
m_decoderSlots[decoderIndex].m_metaRetrieved = true;
|
||||||
memcpy((void *) m_frames[decoderIndex].m_blockZero.m_samples,
|
memcpy((void *) m_frames[decoderIndex].m_blockZero.m_samples,
|
||||||
(const void *) recoveredBlockZero->m_samples,
|
(const void *) recoveredBlockZero->m_samples,
|
||||||
samplesPerBlockZero * sizeof(Sample));
|
samplesPerBlockZero * sizeof(Sample));
|
||||||
@ -237,7 +241,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
|||||||
|
|
||||||
//printMeta("SDRdaemonFECBuffer::writeData", &m_decoderSlots[decoderIndex].m_blockZero.m_metaData);
|
//printMeta("SDRdaemonFECBuffer::writeData", &m_decoderSlots[decoderIndex].m_blockZero.m_metaData);
|
||||||
|
|
||||||
if (m_decoderSlots[decoderIndex].m_blockZero.m_metaData.m_nbFECBlocks >= 0) // meta data valid
|
if (m_decoderSlots[decoderIndex].m_metaRetrieved) // meta data has been retrieved (direct or recovery)
|
||||||
{
|
{
|
||||||
if (!(m_decoderSlots[decoderIndex].m_blockZero.m_metaData == m_currentMeta))
|
if (!(m_decoderSlots[decoderIndex].m_blockZero.m_metaData == m_currentMeta))
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define PLUGINS_SAMPLESOURCE_SDRDAEMONFEC_SDRDAEMONFECBUFFER_H_
|
#define PLUGINS_SAMPLESOURCE_SDRDAEMONFEC_SDRDAEMONFECBUFFER_H_
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "cm256.h"
|
#include "cm256.h"
|
||||||
#include "util/movingaverage.h"
|
#include "util/movingaverage.h"
|
||||||
@ -50,7 +51,6 @@ public:
|
|||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
memset((void *) this, 0, sizeof(MetaDataFEC));
|
memset((void *) this, 0, sizeof(MetaDataFEC));
|
||||||
m_nbFECBlocks = -1;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,8 +123,11 @@ public:
|
|||||||
if (m_framesNbBytes)
|
if (m_framesNbBytes)
|
||||||
{
|
{
|
||||||
int32_t val = (m_wrDeltaEstimate * 100) / (int32_t) m_framesNbBytes;
|
int32_t val = (m_wrDeltaEstimate * 100) / (int32_t) m_framesNbBytes;
|
||||||
|
int32_t ret = val < 0 ? -val - 50 : 50 -val;
|
||||||
|
int32_t rp = (m_readIndex * 100) / (int32_t) m_framesNbBytes;
|
||||||
|
//qDebug() << "getBufferLengthInSecs: " << val << ":" << ret << ":" << rp;
|
||||||
// conversion: [-100:-50[ : read leads (+) / [-50:0[ : read lags (-) / [0:50[ : read leads (+) / [50:100{ : read lags (-)
|
// conversion: [-100:-50[ : read leads (+) / [-50:0[ : read lags (-) / [0:50[ : read leads (+) / [50:100{ : read lags (-)
|
||||||
return val < 0 ? -val - 50 : 50 -val;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -162,6 +165,7 @@ private:
|
|||||||
int m_blockCount; //!< total number of blocks received for this frame
|
int m_blockCount; //!< total number of blocks received for this frame
|
||||||
int m_recoveryCount; //!< number of recovery blocks received
|
int m_recoveryCount; //!< number of recovery blocks received
|
||||||
bool m_decoded; //!< true if decoded
|
bool m_decoded; //!< true if decoded
|
||||||
|
bool m_metaRetrieved;
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaDataFEC m_currentMeta; //!< Stored current meta data
|
MetaDataFEC m_currentMeta; //!< Stored current meta data
|
||||||
|
Loading…
Reference in New Issue
Block a user