mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
ATV Demod: sample rate reporting consistency fixes
This commit is contained in:
parent
d301bd9ebd
commit
b486f63cb5
@ -62,7 +62,7 @@ ATVDemod::ATVDemod(BasebandSampleSink* objScopeSink) :
|
|||||||
setObjectName("ATVDemod");
|
setObjectName("ATVDemod");
|
||||||
|
|
||||||
//*************** ATV PARAMETERS ***************
|
//*************** ATV PARAMETERS ***************
|
||||||
m_intNumberSamplePerLine=0;
|
//m_intNumberSamplePerLine=0;
|
||||||
m_intSynchroPoints=0;
|
m_intSynchroPoints=0;
|
||||||
m_intNumberOfLines=0;
|
m_intNumberOfLines=0;
|
||||||
m_interleaved = true;
|
m_interleaved = true;
|
||||||
@ -159,7 +159,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
|
|
||||||
bool blnComputeImage=false;
|
bool blnComputeImage=false;
|
||||||
|
|
||||||
int intSynchroTimeSamples= (3*m_intNumberSamplePerLine)/4;
|
int intSynchroTimeSamples= (3 * m_objRunningPrivate.m_intNumberSamplePerLine) / 4;
|
||||||
float fltSynchroTrameLevel = 0.5f*((float)intSynchroTimeSamples) * m_objRunning.m_fltVoltLevelSynchroBlack;
|
float fltSynchroTrameLevel = 0.5f*((float)intSynchroTimeSamples) * m_objRunning.m_fltVoltLevelSynchroBlack;
|
||||||
|
|
||||||
//********** Let's rock and roll buddy ! **********
|
//********** Let's rock and roll buddy ! **********
|
||||||
@ -524,6 +524,8 @@ void ATVDemod::applySettings()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool forwardSampleRateChange = false;
|
||||||
|
|
||||||
if((m_objRFConfig.m_intFrequencyOffset != m_objRFRunning.m_intFrequencyOffset)
|
if((m_objRFConfig.m_intFrequencyOffset != m_objRFRunning.m_intFrequencyOffset)
|
||||||
|| (m_objRFConfig.m_enmModulation != m_objRFRunning.m_enmModulation)
|
|| (m_objRFConfig.m_enmModulation != m_objRFRunning.m_enmModulation)
|
||||||
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate))
|
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate))
|
||||||
@ -570,19 +572,19 @@ void ATVDemod::applySettings()
|
|||||||
|
|
||||||
applyStandard();
|
applyStandard();
|
||||||
|
|
||||||
m_intNumberSamplePerLine = (int) (m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate);
|
m_objConfigPrivate.m_intNumberSamplePerLine = (int) (m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate);
|
||||||
m_intNumberSamplePerTop = (int) (m_objConfig.m_fltTopDuration * m_objConfig.m_intSampleRate);
|
m_intNumberSamplePerTop = (int) (m_objConfig.m_fltTopDuration * m_objConfig.m_intSampleRate);
|
||||||
|
|
||||||
m_objRegisteredATVScreen->setRenderImmediate(!(m_objConfig.m_fltFramePerS > 25.0f));
|
m_objRegisteredATVScreen->setRenderImmediate(!(m_objConfig.m_fltFramePerS > 25.0f));
|
||||||
m_objRegisteredATVScreen->resizeATVScreen(
|
m_objRegisteredATVScreen->resizeATVScreen(
|
||||||
m_intNumberSamplePerLine - m_intNumberSamplePerLineSignals,
|
m_objConfigPrivate.m_intNumberSamplePerLine - m_intNumberSamplePerLineSignals,
|
||||||
m_intNumberOfLines - m_intNumberOfBlackLines);
|
m_intNumberOfLines - m_intNumberOfBlackLines);
|
||||||
|
|
||||||
qDebug() << "ATVDemod::applySettings:"
|
qDebug() << "ATVDemod::applySettings:"
|
||||||
<< " m_fltLineDuration: " << m_objConfig.m_fltLineDuration
|
<< " m_fltLineDuration: " << m_objConfig.m_fltLineDuration
|
||||||
<< " m_fltFramePerS: " << m_objConfig.m_fltFramePerS
|
<< " m_fltFramePerS: " << m_objConfig.m_fltFramePerS
|
||||||
<< " m_intNumberOfLines: " << m_intNumberOfLines
|
<< " m_intNumberOfLines: " << m_intNumberOfLines
|
||||||
<< " m_intNumberSamplePerLine: " << m_intNumberSamplePerLine
|
<< " m_intNumberSamplePerLine: " << m_objConfigPrivate.m_intNumberSamplePerLine
|
||||||
<< " m_intNumberOfBlackLines: " << m_intNumberOfBlackLines;
|
<< " m_intNumberOfBlackLines: " << m_intNumberOfBlackLines;
|
||||||
|
|
||||||
m_intImageIndex = 0;
|
m_intImageIndex = 0;
|
||||||
@ -590,21 +592,14 @@ void ATVDemod::applySettings()
|
|||||||
m_intRowIndex=0;
|
m_intRowIndex=0;
|
||||||
|
|
||||||
m_objSettingsMutex.unlock();
|
m_objSettingsMutex.unlock();
|
||||||
|
|
||||||
int sampleRate = m_objRFConfig.m_blndecimatorEnable ? m_objConfigPrivate.m_intTVSampleRate : m_objConfig.m_intSampleRate;
|
|
||||||
MsgReportEffectiveSampleRate *report;
|
|
||||||
report = MsgReportEffectiveSampleRate::create(sampleRate, m_intNumberSamplePerLine);
|
|
||||||
getOutputMessageQueue()->push(report);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate)
|
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate)
|
||||||
|
|| (m_objConfigPrivate.m_intNumberSamplePerLine != m_objRunningPrivate.m_intNumberSamplePerLine)
|
||||||
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate)
|
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate)
|
||||||
|| (m_objRFConfig.m_blndecimatorEnable != m_objRFRunning.m_blndecimatorEnable))
|
|| (m_objRFConfig.m_blndecimatorEnable != m_objRFRunning.m_blndecimatorEnable))
|
||||||
{
|
{
|
||||||
int sampleRate = m_objRFConfig.m_blndecimatorEnable ? m_objConfigPrivate.m_intTVSampleRate : m_objConfig.m_intSampleRate;
|
forwardSampleRateChange = true;
|
||||||
MsgReportEffectiveSampleRate *report;
|
|
||||||
report = MsgReportEffectiveSampleRate::create(sampleRate, m_intNumberSamplePerLine);
|
|
||||||
getOutputMessageQueue()->push(report);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate)
|
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate)
|
||||||
@ -636,6 +631,14 @@ void ATVDemod::applySettings()
|
|||||||
m_objRunning = m_objConfig;
|
m_objRunning = m_objConfig;
|
||||||
m_objRFRunning = m_objRFConfig;
|
m_objRFRunning = m_objRFConfig;
|
||||||
m_objRunningPrivate = m_objConfigPrivate;
|
m_objRunningPrivate = m_objConfigPrivate;
|
||||||
|
|
||||||
|
if (forwardSampleRateChange)
|
||||||
|
{
|
||||||
|
int sampleRate = m_objRFRunning.m_blndecimatorEnable ? m_objRunningPrivate.m_intTVSampleRate : m_objRunning.m_intSampleRate;
|
||||||
|
MsgReportEffectiveSampleRate *report;
|
||||||
|
report = MsgReportEffectiveSampleRate::create(sampleRate, m_objRunningPrivate.m_intNumberSamplePerLine);
|
||||||
|
getOutputMessageQueue()->push(report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATVDemod::applyStandard()
|
void ATVDemod::applyStandard()
|
||||||
|
@ -187,9 +187,11 @@ private:
|
|||||||
struct ATVConfigPrivate
|
struct ATVConfigPrivate
|
||||||
{
|
{
|
||||||
int m_intTVSampleRate;
|
int m_intTVSampleRate;
|
||||||
|
int m_intNumberSamplePerLine;
|
||||||
|
|
||||||
ATVConfigPrivate() :
|
ATVConfigPrivate() :
|
||||||
m_intTVSampleRate(0)
|
m_intTVSampleRate(0),
|
||||||
|
m_intNumberSamplePerLine(0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -345,7 +347,7 @@ private:
|
|||||||
//*************** ATV PARAMETERS ***************
|
//*************** ATV PARAMETERS ***************
|
||||||
ATVScreen * m_objRegisteredATVScreen;
|
ATVScreen * m_objRegisteredATVScreen;
|
||||||
|
|
||||||
int m_intNumberSamplePerLine;
|
//int m_intNumberSamplePerLine;
|
||||||
int m_intNumberSamplePerTop;
|
int m_intNumberSamplePerTop;
|
||||||
int m_intNumberOfLines;
|
int m_intNumberOfLines;
|
||||||
int m_intNumberOfSyncLines; //!< this is the number of non displayable lines at the start of a frame. First displayable row comes next.
|
int m_intNumberOfSyncLines; //!< this is the number of non displayable lines at the start of a frame. First displayable row comes next.
|
||||||
@ -446,7 +448,7 @@ private:
|
|||||||
|
|
||||||
if (m_blnSynchroDetected)
|
if (m_blnSynchroDetected)
|
||||||
{
|
{
|
||||||
if (m_intSampleIndex >= (3*m_intNumberSamplePerLine)/2) // first after leap
|
if (m_intSampleIndex >= (3 * m_objRunningPrivate.m_intNumberSamplePerLine)/2) // first after leap
|
||||||
{
|
{
|
||||||
//qDebug("VSync: %d %d %d", m_intColIndex, m_intSampleIndex, m_intLineIndex);
|
//qDebug("VSync: %d %d %d", m_intColIndex, m_intSampleIndex, m_intLineIndex);
|
||||||
m_intAvgColIndex = m_intColIndex;
|
m_intAvgColIndex = m_intColIndex;
|
||||||
@ -464,7 +466,7 @@ private:
|
|||||||
m_intSampleIndex++;
|
m_intSampleIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_intColIndex < m_intNumberSamplePerLine + m_intNumberSamplePerTop - 1)
|
if (m_intColIndex < m_objRunningPrivate.m_intNumberSamplePerLine + m_intNumberSamplePerTop - 1)
|
||||||
{
|
{
|
||||||
m_intColIndex++;
|
m_intColIndex++;
|
||||||
}
|
}
|
||||||
@ -473,7 +475,7 @@ private:
|
|||||||
if (m_objRunning.m_blnHSync && (m_intLineIndex == 0))
|
if (m_objRunning.m_blnHSync && (m_intLineIndex == 0))
|
||||||
{
|
{
|
||||||
//qDebug("HCorr: %d", m_intAvgColIndex);
|
//qDebug("HCorr: %d", m_intAvgColIndex);
|
||||||
m_intColIndex = m_intNumberSamplePerTop + (m_intNumberSamplePerLine - m_intAvgColIndex)/2; // amortizing factor 1/2
|
m_intColIndex = m_intNumberSamplePerTop + (m_objRunningPrivate.m_intNumberSamplePerLine - m_intAvgColIndex)/2; // amortizing factor 1/2
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -506,7 +508,7 @@ private:
|
|||||||
|
|
||||||
inline void processClassic(float& fltVal, int& intVal)
|
inline void processClassic(float& fltVal, int& intVal)
|
||||||
{
|
{
|
||||||
int intSynchroTimeSamples= (3*m_intNumberSamplePerLine)/4;
|
int intSynchroTimeSamples= (3 * m_objRunningPrivate.m_intNumberSamplePerLine)/4;
|
||||||
float fltSynchroTrameLevel = 0.5f*((float)intSynchroTimeSamples) * m_objRunning.m_fltVoltLevelSynchroBlack;
|
float fltSynchroTrameLevel = 0.5f*((float)intSynchroTimeSamples) * m_objRunning.m_fltVoltLevelSynchroBlack;
|
||||||
|
|
||||||
// Horizontal Synchro detection
|
// Horizontal Synchro detection
|
||||||
@ -530,7 +532,7 @@ private:
|
|||||||
|
|
||||||
if (m_blnSynchroDetected)
|
if (m_blnSynchroDetected)
|
||||||
{
|
{
|
||||||
m_intAvgColIndex = m_intSampleIndex - m_intColIndex - (m_intColIndex < m_intNumberSamplePerLine/2 ? 150 : 0);
|
m_intAvgColIndex = m_intSampleIndex - m_intColIndex - (m_intColIndex < m_objRunningPrivate.m_intNumberSamplePerLine/2 ? 150 : 0);
|
||||||
//qDebug("HSync: %d %d %d", m_intSampleIndex, m_intColIndex, m_intAvgColIndex);
|
//qDebug("HSync: %d %d %d", m_intSampleIndex, m_intColIndex, m_intAvgColIndex);
|
||||||
m_intSampleIndex = 0;
|
m_intSampleIndex = 0;
|
||||||
}
|
}
|
||||||
@ -539,12 +541,12 @@ private:
|
|||||||
m_intSampleIndex++;
|
m_intSampleIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_objRunning.m_blnHSync && (m_intColIndex >= m_intNumberSamplePerLine)) // H Sync not active
|
if (!m_objRunning.m_blnHSync && (m_intColIndex >= m_objRunningPrivate.m_intNumberSamplePerLine)) // H Sync not active
|
||||||
{
|
{
|
||||||
m_intColIndex = 0;
|
m_intColIndex = 0;
|
||||||
blnNewLine = true;
|
blnNewLine = true;
|
||||||
}
|
}
|
||||||
else if (m_intColIndex >= m_intNumberSamplePerLine + m_intNumberSamplePerTop) // No valid H sync
|
else if (m_intColIndex >= m_objRunningPrivate.m_intNumberSamplePerLine + m_intNumberSamplePerTop) // No valid H sync
|
||||||
{
|
{
|
||||||
if (m_objRunning.m_blnHSync && (m_intLineIndex == 0))
|
if (m_objRunning.m_blnHSync && (m_intLineIndex == 0))
|
||||||
{
|
{
|
||||||
|
@ -211,6 +211,7 @@ bool ATVDemodGUI::handleMessage(const Message& objMessage)
|
|||||||
int nbPointsPerLine = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getNbPointsPerLine();
|
int nbPointsPerLine = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getNbPointsPerLine();
|
||||||
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0));
|
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0));
|
||||||
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
|
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
|
||||||
|
m_objScopeVis->setSampleRate(sampleRate);
|
||||||
setRFFiltersSlidersRange(sampleRate);
|
setRFFiltersSlidersRange(sampleRate);
|
||||||
lineTimeUpdate();
|
lineTimeUpdate();
|
||||||
topTimeUpdate();
|
topTimeUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user