SDRdaemonFEC support: debug (8). fixed CM256 descriptors addressing of recovery blocks. Debug message when frames are incomplete.

This commit is contained in:
f4exb 2016-07-06 02:54:01 +02:00
parent dddf872d56
commit c7751062c3
2 changed files with 20 additions and 3 deletions

View File

@ -80,6 +80,16 @@ void SDRdaemonFECBuffer::initReadIndex()
m_wrDeltaEstimate = m_framesNbBytes / 2; m_wrDeltaEstimate = m_framesNbBytes / 2;
} }
void SDRdaemonFECBuffer::checkSlotData(int slotIndex)
{
if (!m_decoderSlots[slotIndex].m_decoded)
{
qDebug() << "SDRdaemonFECBuffer::checkSlotData: incomplete frame:"
<< " m_blockCount: " << m_decoderSlots[slotIndex].m_blockCount
<< " m_recoveryCount: " << m_decoderSlots[slotIndex].m_recoveryCount;
}
}
void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
{ {
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame); int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
@ -138,6 +148,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
//qDebug() << "SDRdaemonFECBuffer::writeData: new frame head (1): " << frameIndex << ":" << frameDelta << ":" << decoderIndex; //qDebug() << "SDRdaemonFECBuffer::writeData: new frame head (1): " << frameIndex << ":" << frameDelta << ":" << decoderIndex;
m_decoderIndexHead = decoderIndex; // new decoder slot head m_decoderIndexHead = decoderIndex; // new decoder slot head
m_frameHead = frameIndex; m_frameHead = frameIndex;
checkSlotData(decoderIndex);
dataAvailable = true; dataAvailable = true;
initDecodeSlot(decoderIndex); // collect stats and re-initialize current slot initDecodeSlot(decoderIndex); // collect stats and re-initialize current slot
} }
@ -157,6 +168,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
//qDebug() << "SDRdaemonFECBuffer::writeData: new frame head (2): " << frameIndex << ":" << frameDelta << ":" << decoderIndex; //qDebug() << "SDRdaemonFECBuffer::writeData: new frame head (2): " << frameIndex << ":" << frameDelta << ":" << decoderIndex;
m_decoderIndexHead = decoderIndex; // new decoder slot head m_decoderIndexHead = decoderIndex; // new decoder slot head
m_frameHead = frameIndex; m_frameHead = frameIndex;
checkSlotData(decoderIndex);
dataAvailable = true; dataAvailable = true;
initDecodeSlot(decoderIndex); // collect stats and re-initialize current slot initDecodeSlot(decoderIndex); // collect stats and re-initialize current slot
} }
@ -174,6 +186,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
// decoderIndex should now be correctly set // decoderIndex should now be correctly set
int blockHead = m_decoderSlots[decoderIndex].m_blockCount; int blockHead = m_decoderSlots[decoderIndex].m_blockCount;
int recoveryHead = m_decoderSlots[decoderIndex].m_recoveryCount;
if (blockHead < m_nbOriginalBlocks) // not enough blocks to decode -> store data if (blockHead < m_nbOriginalBlocks) // not enough blocks to decode -> store data
{ {
@ -191,7 +204,8 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
} }
else // redundancy block else // redundancy block
{ {
m_decoderSlots[decoderIndex].m_recoveryBlocks[m_decoderSlots[decoderIndex].m_recoveryCount] = superBlock->protectedBlock; m_decoderSlots[decoderIndex].m_recoveryBlocks[recoveryHead] = superBlock->protectedBlock;
m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[blockHead].Block = (void *) &m_decoderSlots[decoderIndex].m_recoveryBlocks[recoveryHead];
m_decoderSlots[decoderIndex].m_recoveryCount++; m_decoderSlots[decoderIndex].m_recoveryCount++;
} }
@ -235,8 +249,10 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
if (blockIndex == 0) if (blockIndex == 0)
{ {
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; printMeta("SDRdaemonFECBuffer::writeData: recovered meta", &recoveredBlockZero->m_metaData);
m_decoderSlots[decoderIndex].m_metaRetrieved = true; // FEC does not work
// m_decoderSlots[decoderIndex].m_blockZero.m_metaData = recoveredBlockZero->m_metaData;
// m_decoderSlots[decoderIndex].m_metaRetrieved = true;
} }
else else
{ {

View File

@ -179,6 +179,7 @@ private:
void initDecoderSlotsAddresses(); void initDecoderSlotsAddresses();
void initDecodeAllSlots(); void initDecodeAllSlots();
void initReadIndex(); void initReadIndex();
void checkSlotData(int slotIndex);
void initDecodeSlot(int slotIndex); void initDecodeSlot(int slotIndex);
static void printMeta(const QString& header, MetaDataFEC *metaData); static void printMeta(const QString& header, MetaDataFEC *metaData);