mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
DSD demod: DMR integration debug (2). Added eye diagram capability by delaying Q signal by 20 samples (2400 baud)
This commit is contained in:
parent
f167241da7
commit
90a5b75e91
@ -123,10 +123,11 @@ void DSDDMRVoice::process()
|
||||
case 9:
|
||||
processSlot9(symbolIndex);
|
||||
break;
|
||||
case 10:
|
||||
case 10: // this is the post-process case
|
||||
postProcess(symbolIndex);
|
||||
break;
|
||||
default:
|
||||
m_dsdDecoder->m_fsmState = DSDDecoder::DSDLookForSync;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -172,10 +173,12 @@ void DSDDMRVoice::preProcess()
|
||||
|
||||
void DSDDMRVoice::postProcess(int symbolIndex)
|
||||
{
|
||||
//fprintf(stderr, "DSDDMRVoice::postProcess: m_symbolIndex: %d", m_symbolIndex);
|
||||
m_dsdDecoder->getDibit(); // get dibit from symbol but do nothing with it
|
||||
|
||||
if (symbolIndex == 54+12+54-1) // very last symbol -> go back to search sync state
|
||||
{
|
||||
fprintf(stderr, "\nDSDDMRVoice::postProcess: end of frame\n");
|
||||
m_dsdDecoder->m_fsmState = DSDDecoder::DSDLookForSync;
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,12 @@ public:
|
||||
private:
|
||||
int getSlotIndex(int symbolInMajorBlockIndex) //!< calculates current slot index and returns symbol index in the slot
|
||||
{
|
||||
if (m_majorBlock > 5) // this is the post-process case
|
||||
{
|
||||
m_slotIndex = 10;
|
||||
return symbolInMajorBlockIndex;
|
||||
}
|
||||
|
||||
if (symbolInMajorBlockIndex < 54)
|
||||
{
|
||||
m_slotIndex = 0;
|
||||
@ -109,11 +115,6 @@ private:
|
||||
m_slotIndex = 9;
|
||||
return symbolInMajorBlockIndex - 54+12+36+18+24+18+36+12+54;
|
||||
}
|
||||
else if (symbolInMajorBlockIndex < 54+12+36+18+24+18+36+12+54+24+54+12+54)
|
||||
{
|
||||
m_slotIndex = 10; // dummy slot for last skipped symbols
|
||||
return symbolInMajorBlockIndex - 54+12+36+18+24+18+36+12+54+24;
|
||||
}
|
||||
else // cannot go there if using this function in its valid context (input is a remainder of division by 288)
|
||||
{
|
||||
m_slotIndex = -1; // invalid slot
|
||||
|
@ -59,6 +59,9 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
|
||||
m_audioBuffer.resize(1<<14);
|
||||
m_audioBufferFill = 0;
|
||||
|
||||
m_sampleBuffer = new qint16[1<<17]; // 128 kS
|
||||
m_sampleBufferIndex = 0;
|
||||
|
||||
m_movingAverage.resize(16, 0);
|
||||
|
||||
DSPEngine::instance()->addAudioSink(&m_audioFifo);
|
||||
@ -66,6 +69,7 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
|
||||
|
||||
DSDDemod::~DSDDemod()
|
||||
{
|
||||
delete[] m_sampleBuffer;
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
}
|
||||
|
||||
@ -102,7 +106,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, c, &ci))
|
||||
{
|
||||
qint16 sample;
|
||||
qint16 sample, delayedSample;
|
||||
|
||||
m_magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag())) / (Real) (1<<30);
|
||||
m_movingAverage.feed(m_magsq);
|
||||
@ -135,40 +139,53 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
sample = 0;
|
||||
}
|
||||
|
||||
Sample s(sample, 0.0);
|
||||
if (m_sampleBufferIndex < (1<<17)) {
|
||||
m_sampleBufferIndex++;
|
||||
} else {
|
||||
m_sampleBufferIndex = 0;
|
||||
}
|
||||
|
||||
m_sampleBuffer[m_sampleBufferIndex] = sample;
|
||||
|
||||
if (m_sampleBufferIndex < 20) {
|
||||
delayedSample = m_sampleBuffer[(1<<17) - 20 + m_sampleBufferIndex];
|
||||
} else {
|
||||
delayedSample = m_sampleBuffer[m_sampleBufferIndex - 20];
|
||||
}
|
||||
|
||||
Sample s(sample, delayedSample); // I=signal, Q=signal delayed by 20 samples (2400 baud: lowest rate)
|
||||
m_scopeSampleBuffer.push_back(s);
|
||||
m_dsdDecoder.pushSample(sample);
|
||||
|
||||
// if (m_running.m_audioMute)
|
||||
// {
|
||||
// m_audioBuffer[m_audioBufferFill].l = 0;
|
||||
// m_audioBuffer[m_audioBufferFill].r = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_audioBuffer[m_audioBufferFill].l = sample;
|
||||
// m_audioBuffer[m_audioBufferFill].r = sample;
|
||||
// }
|
||||
// if (m_running.m_audioMute)
|
||||
// {
|
||||
// m_audioBuffer[m_audioBufferFill].l = 0;
|
||||
// m_audioBuffer[m_audioBufferFill].r = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_audioBuffer[m_audioBufferFill].l = (sample * m_running.m_volume) / 100;
|
||||
// m_audioBuffer[m_audioBufferFill].r = (sample * m_running.m_volume) / 100;
|
||||
// }
|
||||
//
|
||||
// ++m_audioBufferFill;
|
||||
// ++m_audioBufferFill;
|
||||
//
|
||||
// if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
// {
|
||||
// uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 10);
|
||||
// if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
// {
|
||||
// uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 10);
|
||||
//
|
||||
// if (res != m_audioBufferFill)
|
||||
// {
|
||||
// qDebug("DSDDemod::feed: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
// }
|
||||
// if (res != m_audioBufferFill)
|
||||
// {
|
||||
// qDebug("DSDDemod::feed: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
// }
|
||||
//
|
||||
// m_audioBufferFill = 0;
|
||||
// }
|
||||
// m_audioBufferFill = 0;
|
||||
// }
|
||||
|
||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (m_audioBufferFill > 0)
|
||||
// {
|
||||
// uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 10);
|
||||
@ -182,18 +199,23 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
// }
|
||||
|
||||
int nbAudioSamples;
|
||||
short *audio = m_dsdDecoder.getAudio(nbAudioSamples);
|
||||
short *dsdAudio = m_dsdDecoder.getAudio(nbAudioSamples);
|
||||
|
||||
if (nbAudioSamples > 0)
|
||||
{
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], nbAudioSamples, 10);
|
||||
|
||||
if (res != nbAudioSamples)
|
||||
{
|
||||
qDebug("NFMDemod::feed: %u/%u tail samples written", res, nbAudioSamples);
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*) dsdAudio, nbAudioSamples, 10);
|
||||
qDebug("DSDDemod::feed: written %d audio samples (%d)", res, nbAudioSamples);
|
||||
m_dsdDecoder.resetAudio();
|
||||
// qDebug("\nDSDDemod::feed: got %d audio samples (%lu)", nbAudioSamples, m_audioBuffer.size());
|
||||
}
|
||||
|
||||
// if (nbAudioSamples >= m_audioBuffer.size())
|
||||
// {
|
||||
// uint res = m_audioFifo.write((const quint8*) dsdAudio, nbAudioSamples, 10);
|
||||
// qDebug("DSDDemod::feed: written %d audio samples (%d)", res, nbAudioSamples);
|
||||
// m_dsdDecoder.resetAudio();
|
||||
// }
|
||||
|
||||
if ((m_scope != 0) && (m_scopeEnabled))
|
||||
{
|
||||
m_scope->feed(m_scopeSampleBuffer.begin(), m_scopeSampleBuffer.end(), true); // true = real samples for what it's worth
|
||||
|
@ -172,6 +172,8 @@ private:
|
||||
SampleVector m_scopeSampleBuffer;
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
qint16 *m_sampleBuffer; //!< samples ring buffer
|
||||
int m_sampleBufferIndex;
|
||||
|
||||
AudioFifo m_audioFifo;
|
||||
SampleSink* m_scope;
|
||||
|
@ -151,7 +151,7 @@ void FileSourceGui::handleSourceMessages()
|
||||
|
||||
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
|
||||
{
|
||||
qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
|
||||
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (handleMessage(*message))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user