SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <remoteinputbuffer.h>
Classes | |
struct | BufferFrame |
struct | DecoderSlot |
Public Member Functions | |
RemoteInputBuffer () | |
~RemoteInputBuffer () | |
void | writeData (char *array) |
Write data into buffer. More... | |
uint8_t * | readData (int32_t length) |
Read data from buffer. More... | |
const RemoteMetaDataFEC & | getCurrentMeta () const |
uint32_t | getTVOutSec () const |
uint32_t | getTVOutUsec () const |
uint64_t | getTVOutMSec () const |
int | getCurNbBlocks () const |
int | getCurOriginalBlocks () const |
int | getCurNbRecovery () const |
float | getAvgNbBlocks () const |
float | getAvgOriginalBlocks () const |
float | getAvgNbRecovery () const |
int | getMinNbBlocks () |
int | getMinOriginalBlocks () |
int | getMaxNbRecovery () |
bool | allFramesDecoded () |
float | getBufferLengthInSecs () const |
int32_t | getRWBalanceCorrection () const |
int32_t | getBufferGauge () const |
Static Public Attributes | |
static const int | framesSize = REMOTEINPUT_NBDECODERSLOTS * (RemoteNbOrginalBlocks - 1) * RemoteNbBytesPerBlock |
Private Member Functions | |
RemoteProtectedBlock * | storeOriginalBlock (int slotIndex, int blockIndex, const RemoteProtectedBlock &protectedBlock) |
RemoteProtectedBlock & | getOriginalBlock (int slotIndex, int blockIndex) |
RemoteMetaDataFEC * | getMetaData (int slotIndex) |
void | resetOriginalBlocks (int slotIndex) |
void | initDecodeAllSlots () |
void | initReadIndex () |
void | rwCorrectionEstimate (int slotIndex) |
void | checkSlotData (int slotIndex) |
void | initDecodeSlot (int slotIndex) |
Static Private Member Functions | |
static void | printMeta (const QString &header, RemoteMetaDataFEC *metaData) |
Private Attributes | |
RemoteMetaDataFEC | m_currentMeta |
Stored current meta data. More... | |
CM256::cm256_encoder_params | m_paramsCM256 |
CM256 decoder parameters block. More... | |
DecoderSlot | m_decoderSlots [nbDecoderSlots] |
CM256 decoding control/buffer slots. More... | |
BufferFrame | m_frames [nbDecoderSlots] |
Samples buffer. More... | |
int | m_framesNbBytes |
Number of bytes in samples buffer. More... | |
int | m_decoderIndexHead |
index of the current head frame slot in decoding slots More... | |
int | m_frameHead |
index of the current head frame sent More... | |
int | m_curNbBlocks |
(stats) instantaneous number of blocks received More... | |
int | m_minNbBlocks |
(stats) minimum number of blocks received since last poll More... | |
int | m_curOriginalBlocks |
(stats) instantanous number of original blocks received More... | |
int | m_minOriginalBlocks |
(stats) minimum number of original blocks received since last poll More... | |
int | m_curNbRecovery |
(stats) instantaneous number of recovery blocks used More... | |
int | m_maxNbRecovery |
(stats) maximum number of recovery blocks used since last poll More... | |
MovingAverageUtil< int, int, 10 > | m_avgNbBlocks |
(stats) average number of blocks received More... | |
MovingAverageUtil< int, int, 10 > | m_avgOrigBlocks |
(stats) average number of original blocks received More... | |
MovingAverageUtil< int, int, 10 > | m_avgNbRecovery |
(stats) average number of recovery blocks used More... | |
bool | m_framesDecoded |
[stats] true if all frames were decoded since last poll More... | |
int | m_readIndex |
current byte read index in frames buffer More... | |
int | m_wrDeltaEstimate |
Sampled estimate of write to read indexes difference. More... | |
uint32_t | m_tvOut_sec |
Estimated returned samples timestamp (seconds) More... | |
uint32_t | m_tvOut_usec |
Estimated returned samples timestamp (microseconds) More... | |
int | m_readNbBytes |
Nominal number of bytes per read (50ms) More... | |
uint8_t * | m_readBuffer |
Read buffer to hold samples when looping back to beginning of raw buffer. More... | |
int | m_readSize |
Read buffer size. More... | |
float | m_bufferLenSec |
int | m_nbReads |
Number of buffer reads since start of auto R/W balance correction period. More... | |
int | m_nbWrites |
Number of buffer writes since start of auto R/W balance correction period. More... | |
int | m_balCorrection |
R/W balance correction in number of samples. More... | |
int | m_balCorrLimit |
Correction absolute value limit in number of samples. More... | |
CM256 | m_cm256 |
CM256 library. More... | |
bool | m_cm256_OK |
CM256 library initialized OK. More... | |
Static Private Attributes | |
static const int | nbDecoderSlots = REMOTEINPUT_NBDECODERSLOTS |
Definition at line 33 of file remoteinputbuffer.h.
RemoteInputBuffer::RemoteInputBuffer | ( | ) |
Definition at line 29 of file remoteinputbuffer.cpp.
References RemoteMetaDataFEC::init(), m_currentMeta, m_framesNbBytes, m_paramsCM256, m_readNbBytes, m_tvOut_sec, m_tvOut_usec, m_wrDeltaEstimate, and nbDecoderSlots.
RemoteInputBuffer::~RemoteInputBuffer | ( | ) |
Definition at line 68 of file remoteinputbuffer.cpp.
References m_readBuffer.
|
inline |
Definition at line 81 of file remoteinputbuffer.h.
References m_framesDecoded.
|
private |
Definition at line 170 of file remoteinputbuffer.cpp.
References RemoteInputBuffer::DecoderSlot::m_blockCount, m_currentMeta, m_decoderSlots, m_readIndex, RemoteInputBuffer::DecoderSlot::m_recoveryCount, RemoteMetaDataFEC::m_sampleBytes, RemoteMetaDataFEC::m_sampleRate, RemoteMetaDataFEC::m_tv_sec, RemoteMetaDataFEC::m_tv_usec, m_tvOut_sec, m_tvOut_usec, m_wrDeltaEstimate, and nbDecoderSlots.
Referenced by writeData().
|
inline |
Definition at line 56 of file remoteinputbuffer.h.
References m_avgNbBlocks.
Referenced by RemoteInputUDPHandler::tick().
|
inline |
Definition at line 58 of file remoteinputbuffer.h.
References m_avgNbRecovery.
Referenced by RemoteInputUDPHandler::tick().
|
inline |
Definition at line 57 of file remoteinputbuffer.h.
References m_avgOrigBlocks.
Referenced by RemoteInputUDPHandler::tick().
|
inline |
Get buffer gauge value in % of buffer size ([-50:50]) [-50:0] : write leads or read lags [0:50] : read leads or write lags
Definition at line 95 of file remoteinputbuffer.h.
References m_framesNbBytes, and m_wrDeltaEstimate.
Referenced by RemoteInputUDPHandler::getBufferGauge(), and RemoteInputUDPHandler::tick().
|
inline |
Definition at line 88 of file remoteinputbuffer.h.
References m_bufferLenSec.
Referenced by RemoteInputUDPHandler::tick().
|
inline |
Definition at line 53 of file remoteinputbuffer.h.
References m_curNbBlocks.
|
inline |
Definition at line 55 of file remoteinputbuffer.h.
References m_curNbRecovery.
|
inline |
Definition at line 54 of file remoteinputbuffer.h.
References m_curOriginalBlocks.
|
inline |
Definition at line 44 of file remoteinputbuffer.h.
References m_currentMeta.
Referenced by RemoteInputUDPHandler::processData(), and RemoteInputUDPHandler::tick().
|
inline |
Definition at line 74 of file remoteinputbuffer.h.
References m_maxNbRecovery.
Referenced by RemoteInputUDPHandler::getMaxNbRecovery(), and RemoteInputUDPHandler::tick().
|
inlineprivate |
Definition at line 195 of file remoteinputbuffer.h.
References RemoteInputBuffer::DecoderSlot::m_blockZero.
|
inline |
Definition at line 60 of file remoteinputbuffer.h.
References m_minNbBlocks.
Referenced by RemoteInputUDPHandler::getMinNbBlocks(), and RemoteInputUDPHandler::tick().
|
inline |
Definition at line 67 of file remoteinputbuffer.h.
References m_minOriginalBlocks.
Referenced by RemoteInputUDPHandler::tick().
|
inlineprivate |
Definition at line 184 of file remoteinputbuffer.h.
References RemoteInputBuffer::BufferFrame::m_blocks, and RemoteInputBuffer::DecoderSlot::m_blockZero.
|
inline |
Definition at line 89 of file remoteinputbuffer.h.
References m_balCorrection.
Referenced by RemoteInputUDPHandler::tick().
|
inline |
Definition at line 49 of file remoteinputbuffer.h.
References m_tvOut_sec, and m_tvOut_usec.
Referenced by RemoteInputUDPHandler::processData().
|
inline |
Definition at line 47 of file remoteinputbuffer.h.
References m_tvOut_sec.
|
inline |
Definition at line 48 of file remoteinputbuffer.h.
References m_tvOut_usec.
|
private |
Definition at line 75 of file remoteinputbuffer.cpp.
References i, RemoteInputBuffer::DecoderSlot::m_blockCount, RemoteInputBuffer::DecoderSlot::m_decoded, m_decoderSlots, RemoteInputBuffer::DecoderSlot::m_metaRetrieved, RemoteInputBuffer::DecoderSlot::m_originalCount, RemoteInputBuffer::DecoderSlot::m_recoveryCount, nbDecoderSlots, and resetOriginalBlocks().
Referenced by writeData().
|
private |
Definition at line 89 of file remoteinputbuffer.cpp.
References m_avgNbBlocks, m_avgNbRecovery, m_avgOrigBlocks, RemoteInputBuffer::DecoderSlot::m_blockCount, m_curNbBlocks, m_curNbRecovery, m_curOriginalBlocks, RemoteInputBuffer::DecoderSlot::m_decoded, m_decoderSlots, m_framesDecoded, m_maxNbRecovery, RemoteInputBuffer::DecoderSlot::m_metaRetrieved, m_minNbBlocks, m_minOriginalBlocks, RemoteInputBuffer::DecoderSlot::m_originalCount, RemoteInputBuffer::DecoderSlot::m_recoveryCount, and resetOriginalBlocks().
Referenced by writeData().
|
private |
Definition at line 125 of file remoteinputbuffer.cpp.
References m_decoderIndexHead, m_framesNbBytes, m_nbReads, m_nbWrites, m_readIndex, m_wrDeltaEstimate, and nbDecoderSlots.
Referenced by writeData().
|
staticprivate |
Definition at line 375 of file remoteinputbuffer.cpp.
References RemoteMetaDataFEC::m_centerFrequency, RemoteMetaDataFEC::m_nbFECBlocks, RemoteMetaDataFEC::m_nbOriginalBlocks, RemoteMetaDataFEC::m_sampleBits, RemoteMetaDataFEC::m_sampleBytes, RemoteMetaDataFEC::m_sampleRate, RemoteMetaDataFEC::m_tv_sec, and RemoteMetaDataFEC::m_tv_usec.
Read data from buffer.
Definition at line 333 of file remoteinputbuffer.cpp.
References framesSize, m_frames, m_framesNbBytes, m_nbReads, m_readBuffer, m_readIndex, and m_readSize.
Referenced by RemoteInputUDPHandler::tick().
|
inlineprivate |
Definition at line 201 of file remoteinputbuffer.h.
References RemoteInputBuffer::BufferFrame::m_blocks.
Referenced by initDecodeAllSlots(), and initDecodeSlot().
|
private |
Definition at line 133 of file remoteinputbuffer.cpp.
References m_balCorrection, m_balCorrLimit, m_currentMeta, m_nbReads, m_nbWrites, m_readIndex, m_readNbBytes, RemoteMetaDataFEC::m_sampleBytes, and nbDecoderSlots.
Referenced by writeData().
|
inlineprivate |
Definition at line 169 of file remoteinputbuffer.h.
References RemoteInputBuffer::BufferFrame::m_blocks, and RemoteInputBuffer::DecoderSlot::m_blockZero.
void RemoteInputBuffer::writeData | ( | char * | array | ) |
Write data into buffer.
Definition at line 194 of file remoteinputbuffer.cpp.
References checkSlotData(), initDecodeAllSlots(), initDecodeSlot(), initReadIndex(), m_decoderIndexHead, m_decoderSlots, m_frameHead, RemoteHeader::m_frameIndex, RemoteSuperBlock::m_header, m_nbWrites, nbDecoderSlots, and rwCorrectionEstimate().
Referenced by RemoteInputUDPHandler::processData().
|
static |
Definition at line 109 of file remoteinputbuffer.h.
Referenced by readData().
|
private |
(stats) average number of blocks received
Definition at line 147 of file remoteinputbuffer.h.
Referenced by getAvgNbBlocks(), and initDecodeSlot().
|
private |
(stats) average number of recovery blocks used
Definition at line 149 of file remoteinputbuffer.h.
Referenced by getAvgNbRecovery(), and initDecodeSlot().
|
private |
(stats) average number of original blocks received
Definition at line 148 of file remoteinputbuffer.h.
Referenced by getAvgOriginalBlocks(), and initDecodeSlot().
|
private |
R/W balance correction in number of samples.
Definition at line 164 of file remoteinputbuffer.h.
Referenced by getRWBalanceCorrection(), and rwCorrectionEstimate().
|
private |
Correction absolute value limit in number of samples.
Definition at line 165 of file remoteinputbuffer.h.
Referenced by rwCorrectionEstimate().
|
private |
Definition at line 160 of file remoteinputbuffer.h.
Referenced by getBufferLengthInSecs().
|
private |
CM256 library.
Definition at line 166 of file remoteinputbuffer.h.
|
private |
CM256 library initialized OK.
Definition at line 167 of file remoteinputbuffer.h.
|
private |
(stats) instantaneous number of blocks received
Definition at line 141 of file remoteinputbuffer.h.
Referenced by getCurNbBlocks(), and initDecodeSlot().
|
private |
(stats) instantaneous number of recovery blocks used
Definition at line 145 of file remoteinputbuffer.h.
Referenced by getCurNbRecovery(), and initDecodeSlot().
|
private |
(stats) instantanous number of original blocks received
Definition at line 143 of file remoteinputbuffer.h.
Referenced by getCurOriginalBlocks(), and initDecodeSlot().
|
private |
Stored current meta data.
Definition at line 134 of file remoteinputbuffer.h.
Referenced by checkSlotData(), getCurrentMeta(), RemoteInputBuffer(), and rwCorrectionEstimate().
|
private |
index of the current head frame slot in decoding slots
Definition at line 139 of file remoteinputbuffer.h.
Referenced by initReadIndex(), and writeData().
|
private |
CM256 decoding control/buffer slots.
Definition at line 136 of file remoteinputbuffer.h.
Referenced by checkSlotData(), initDecodeAllSlots(), initDecodeSlot(), and writeData().
|
private |
index of the current head frame sent
Definition at line 140 of file remoteinputbuffer.h.
Referenced by writeData().
|
private |
|
private |
[stats] true if all frames were decoded since last poll
Definition at line 150 of file remoteinputbuffer.h.
Referenced by allFramesDecoded(), and initDecodeSlot().
|
private |
Number of bytes in samples buffer.
Definition at line 138 of file remoteinputbuffer.h.
Referenced by getBufferGauge(), initReadIndex(), readData(), and RemoteInputBuffer().
|
private |
(stats) maximum number of recovery blocks used since last poll
Definition at line 146 of file remoteinputbuffer.h.
Referenced by getMaxNbRecovery(), and initDecodeSlot().
|
private |
(stats) minimum number of blocks received since last poll
Definition at line 142 of file remoteinputbuffer.h.
Referenced by getMinNbBlocks(), and initDecodeSlot().
|
private |
(stats) minimum number of original blocks received since last poll
Definition at line 144 of file remoteinputbuffer.h.
Referenced by getMinOriginalBlocks(), and initDecodeSlot().
|
private |
Number of buffer reads since start of auto R/W balance correction period.
Definition at line 162 of file remoteinputbuffer.h.
Referenced by initReadIndex(), readData(), and rwCorrectionEstimate().
|
private |
Number of buffer writes since start of auto R/W balance correction period.
Definition at line 163 of file remoteinputbuffer.h.
Referenced by initReadIndex(), rwCorrectionEstimate(), and writeData().
|
private |
CM256 decoder parameters block.
Definition at line 135 of file remoteinputbuffer.h.
Referenced by RemoteInputBuffer().
|
private |
Read buffer to hold samples when looping back to beginning of raw buffer.
Definition at line 157 of file remoteinputbuffer.h.
Referenced by readData(), and ~RemoteInputBuffer().
|
private |
current byte read index in frames buffer
Definition at line 151 of file remoteinputbuffer.h.
Referenced by checkSlotData(), initReadIndex(), readData(), and rwCorrectionEstimate().
|
private |
Nominal number of bytes per read (50ms)
Definition at line 155 of file remoteinputbuffer.h.
Referenced by RemoteInputBuffer(), and rwCorrectionEstimate().
|
private |
|
private |
Estimated returned samples timestamp (seconds)
Definition at line 153 of file remoteinputbuffer.h.
Referenced by checkSlotData(), getTVOutMSec(), getTVOutSec(), and RemoteInputBuffer().
|
private |
Estimated returned samples timestamp (microseconds)
Definition at line 154 of file remoteinputbuffer.h.
Referenced by checkSlotData(), getTVOutMSec(), getTVOutUsec(), and RemoteInputBuffer().
|
private |
Sampled estimate of write to read indexes difference.
Definition at line 152 of file remoteinputbuffer.h.
Referenced by checkSlotData(), getBufferGauge(), initReadIndex(), and RemoteInputBuffer().
|
staticprivate |
Definition at line 112 of file remoteinputbuffer.h.
Referenced by checkSlotData(), initDecodeAllSlots(), initReadIndex(), RemoteInputBuffer(), rwCorrectionEstimate(), and writeData().