mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-10 21:50:10 -04:00
ATV plugins: used fixed pattern for sync and use sample time for top time adjust granularity
This commit is contained in:
parent
e48587af6b
commit
b57b8f0a9a
@ -29,7 +29,6 @@ MESSAGE_CLASS_DEFINITION(ATVDemod::MsgConfigureATVDemod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ATVDemod::MsgConfigureRFATVDemod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ATVDemod::MsgReportEffectiveSampleRate, Message)
|
||||
|
||||
const float ATVDemod::m_fltSecondToUs = 1000000.0f;
|
||||
const int ATVDemod::m_ssbFftLen = 1024;
|
||||
|
||||
ATVDemod::ATVDemod(BasebandSampleSink* objScopeSink) :
|
||||
@ -647,7 +646,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
|
||||
<< " m_fltFramePerS:" << m_objConfig.m_fltFramePerS
|
||||
<< " m_fltLineDurationUs:" << m_objConfig.m_fltLineDuration
|
||||
<< " m_fltRatioOfRowsToDisplay:" << m_objConfig.m_fltRatioOfRowsToDisplay
|
||||
<< " m_fltTopDurationUs:" << m_objConfig.m_fltTopDurationUs
|
||||
<< " m_fltTopDurationUs:" << m_objConfig.m_fltTopDuration
|
||||
<< " m_blnHSync:" << m_objConfig.m_blnHSync
|
||||
<< " m_blnVSync:" << m_objConfig.m_blnVSync;
|
||||
|
||||
@ -730,7 +729,7 @@ void ATVDemod::applySettings()
|
||||
if((m_objConfig.m_fltFramePerS != m_objRunning.m_fltFramePerS)
|
||||
|| (m_objConfig.m_fltLineDuration != m_objRunning.m_fltLineDuration)
|
||||
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate)
|
||||
|| (m_objConfig.m_fltTopDurationUs != m_objRunning.m_fltTopDurationUs)
|
||||
|| (m_objConfig.m_fltTopDuration != m_objRunning.m_fltTopDuration)
|
||||
|| (m_objConfig.m_fltRatioOfRowsToDisplay != m_objRunning.m_fltRatioOfRowsToDisplay))
|
||||
{
|
||||
m_objSettingsMutex.lock();
|
||||
@ -746,7 +745,7 @@ void ATVDemod::applySettings()
|
||||
<< " m_intNumberSamplePerLine: " << m_intNumberSamplePerLine
|
||||
<< " m_intNumberOfRowsToDisplay: " << m_intNumberOfRowsToDisplay;
|
||||
|
||||
m_intNumberSamplePerTop = (int) ((m_objConfig.m_fltTopDurationUs * m_objConfig.m_intSampleRate) / m_fltSecondToUs);
|
||||
m_intNumberSamplePerTop = (int) (m_objConfig.m_fltTopDuration * m_objConfig.m_intSampleRate);
|
||||
m_objRegisteredATVScreen->resizeATVScreen(m_intNumberSamplePerLine, m_intNumberOfLines);
|
||||
|
||||
m_intRowsLimit = m_intNumberOfLines-1;
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
{
|
||||
int m_intSampleRate;
|
||||
float m_fltLineDuration;
|
||||
float m_fltTopDurationUs;
|
||||
float m_fltTopDuration;
|
||||
float m_fltFramePerS;
|
||||
float m_fltRatioOfRowsToDisplay;
|
||||
float m_fltVoltLevelSynchroTop;
|
||||
@ -71,7 +71,7 @@ public:
|
||||
ATVConfig() :
|
||||
m_intSampleRate(0),
|
||||
m_fltLineDuration(0.0f),
|
||||
m_fltTopDurationUs(0.0f),
|
||||
m_fltTopDuration(0.0f),
|
||||
m_fltFramePerS(0.0f),
|
||||
m_fltRatioOfRowsToDisplay(0.0f),
|
||||
m_fltVoltLevelSynchroTop(0.0f),
|
||||
@ -227,7 +227,7 @@ private:
|
||||
m_objMsgConfig.m_fltVoltLevelSynchroTop = fltVoltLevelSynchroTop;
|
||||
m_objMsgConfig.m_fltFramePerS = fltFramePerS;
|
||||
m_objMsgConfig.m_fltLineDuration = fltLineDurationUs;
|
||||
m_objMsgConfig.m_fltTopDurationUs = fltTopDurationUs;
|
||||
m_objMsgConfig.m_fltTopDuration = fltTopDurationUs;
|
||||
m_objMsgConfig.m_fltRatioOfRowsToDisplay = flatRatioOfRowsToDisplay;
|
||||
m_objMsgConfig.m_blnHSync = blnHSync;
|
||||
m_objMsgConfig.m_blnVSync = blnVSync;
|
||||
@ -357,8 +357,6 @@ private:
|
||||
|
||||
QMutex m_objSettingsMutex;
|
||||
|
||||
static const float m_fltSecondToUs;
|
||||
|
||||
void applySettings();
|
||||
void demod(Complex& c);
|
||||
static float getRFBandwidthDivisor(ATVModulation modulation);
|
||||
|
@ -96,6 +96,7 @@ void ATVDemodGUI::resetToDefaults()
|
||||
|
||||
blockApplySettings(false);
|
||||
lineTimeUpdate();
|
||||
topTimeUpdate();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -188,6 +189,7 @@ bool ATVDemodGUI::deserialize(const QByteArray& arrData)
|
||||
m_objChannelMarker.blockSignals(false);
|
||||
|
||||
lineTimeUpdate();
|
||||
topTimeUpdate();
|
||||
applySettings();
|
||||
return true;
|
||||
}
|
||||
@ -208,6 +210,7 @@ bool ATVDemodGUI::handleMessage(const Message& objMessage)
|
||||
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
|
||||
setRFFiltersSlidersRange(sampleRate);
|
||||
lineTimeUpdate();
|
||||
topTimeUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -363,7 +366,7 @@ void ATVDemodGUI::applySettings()
|
||||
|
||||
m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(),
|
||||
getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) + ui->lineTime->value() * m_fltLineTimeMultiplier,
|
||||
ui->topTime->value() * 1.0f,
|
||||
getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f) + ui->topTime->value() * m_fltTopTimeMultiplier,
|
||||
getFps(ui->fps->currentIndex()),
|
||||
(ui->halfImage->checkState() == Qt::Checked) ? 0.5f : 1.0f,
|
||||
ui->synchLevel->value() / 1000.0f,
|
||||
@ -511,7 +514,7 @@ void ATVDemodGUI::on_lineTime_valueChanged(int value)
|
||||
|
||||
void ATVDemodGUI::on_topTime_valueChanged(int value)
|
||||
{
|
||||
ui->topTimeText->setText(QString("%1 µS").arg(value));
|
||||
topTimeUpdate();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -538,12 +541,14 @@ void ATVDemodGUI::on_halfImage_clicked()
|
||||
void ATVDemodGUI::on_nbLines_currentIndexChanged(int index)
|
||||
{
|
||||
lineTimeUpdate();
|
||||
topTimeUpdate();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void ATVDemodGUI::on_fps_currentIndexChanged(int index)
|
||||
{
|
||||
lineTimeUpdate();
|
||||
topTimeUpdate();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -637,13 +642,36 @@ void ATVDemodGUI::lineTimeUpdate()
|
||||
float lineTime = nominalLineTime + m_fltLineTimeMultiplier * ui->lineTime->value();
|
||||
|
||||
if(lineTime < 0.000001)
|
||||
ui->lineTimeText->setText(tr("%1 ns").arg(lineTime * 1000000000.0, 0, 'f', 1));
|
||||
ui->lineTimeText->setText(tr("%1 ns").arg(lineTime * 1000000000.0, 0, 'f', 2));
|
||||
else if(lineTime < 0.001)
|
||||
ui->lineTimeText->setText(tr("%1 µs").arg(lineTime * 1000000.0, 0, 'f', 1));
|
||||
ui->lineTimeText->setText(tr("%1 µs").arg(lineTime * 1000000.0, 0, 'f', 2));
|
||||
else if(lineTime < 1.0)
|
||||
ui->lineTimeText->setText(tr("%1 ms").arg(lineTime * 1000.0, 0, 'f', 1));
|
||||
ui->lineTimeText->setText(tr("%1 ms").arg(lineTime * 1000.0, 0, 'f', 2));
|
||||
else
|
||||
ui->lineTimeText->setText(tr("%1 s").arg(lineTime * 1.0, 0, 'f', 1));
|
||||
ui->lineTimeText->setText(tr("%1 s").arg(lineTime * 1.0, 0, 'f', 2));
|
||||
}
|
||||
|
||||
void ATVDemodGUI::topTimeUpdate()
|
||||
{
|
||||
float nominalTopTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f);
|
||||
int topTimeScaleFactor = (int) std::log10(nominalTopTime);
|
||||
|
||||
if (m_objATVDemod->getEffectiveSampleRate() == 0) {
|
||||
m_fltTopTimeMultiplier = std::pow(10.0, topTimeScaleFactor-3);
|
||||
} else {
|
||||
m_fltTopTimeMultiplier = 1.0f / m_objATVDemod->getEffectiveSampleRate();
|
||||
}
|
||||
|
||||
float topTime = nominalTopTime + m_fltTopTimeMultiplier * ui->topTime->value();
|
||||
|
||||
if(topTime < 0.000001)
|
||||
ui->topTimeText->setText(tr("%1 ns").arg(topTime * 1000000000.0, 0, 'f', 2));
|
||||
else if(topTime < 0.001)
|
||||
ui->topTimeText->setText(tr("%1 µs").arg(topTime * 1000000.0, 0, 'f', 2));
|
||||
else if(topTime < 1.0)
|
||||
ui->topTimeText->setText(tr("%1 ms").arg(topTime * 1000.0, 0, 'f', 2));
|
||||
else
|
||||
ui->topTimeText->setText(tr("%1 s").arg(topTime * 1.0, 0, 'f', 2));
|
||||
}
|
||||
|
||||
float ATVDemodGUI::getFps(int fpsIndex)
|
||||
@ -684,4 +712,3 @@ float ATVDemodGUI::getNominalLineTime(int nbLinesIndex, int fpsIndex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ private:
|
||||
ScopeVisNG* m_objScopeVis;
|
||||
|
||||
float m_fltLineTimeMultiplier;
|
||||
float m_fltTopTimeMultiplier;
|
||||
int m_rfSliderDivisor;
|
||||
|
||||
explicit ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, QWidget* objParent = NULL);
|
||||
@ -115,6 +116,7 @@ private:
|
||||
void setChannelMarkerBandwidth();
|
||||
void setRFFiltersSlidersRange(int sampleRate);
|
||||
void lineTimeUpdate();
|
||||
void topTimeUpdate();
|
||||
static float getFps(int fpsIndex);
|
||||
static float getNominalLineTime(int nbLinesIndex, int fpsIndex);
|
||||
|
||||
|
@ -737,25 +737,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="lineTimeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Effective line length value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="topTimeLabel">
|
||||
<property name="text">
|
||||
@ -769,7 +750,7 @@
|
||||
<string>Horizontal top length adjustment</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>-30</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>30</number>
|
||||
@ -781,7 +762,7 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -792,7 +773,7 @@
|
||||
<widget class="QLabel" name="topTimeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<width>62</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -820,6 +801,25 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="lineTimeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>62</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Effective line length value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="right">&mu;S</p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -688,10 +688,7 @@ void ATVMod::apply(bool force)
|
||||
|| (m_config.m_rfBandwidth != m_running.m_rfBandwidth)
|
||||
|| (m_config.m_atvModulation != m_running.m_atvModulation) || force)
|
||||
{
|
||||
int rateUnits, nbPointsPerRateUnit;
|
||||
getBaseValues(m_config.m_outputSampleRate, m_config.m_nbLines * m_config.m_fps, rateUnits, nbPointsPerRateUnit);
|
||||
m_tvSampleRate = (m_config.m_outputSampleRate / rateUnits) * rateUnits; // make sure working sample rate is a multiple of rate units
|
||||
m_pointsPerLine = (m_tvSampleRate / rateUnits) * nbPointsPerRateUnit;
|
||||
getBaseValues(m_config.m_outputSampleRate, m_config.m_nbLines * m_config.m_fps, m_tvSampleRate, m_pointsPerLine);
|
||||
|
||||
// qDebug() << "ATVMod::apply: "
|
||||
// << " m_nbLines: " << m_config.m_nbLines
|
||||
@ -722,7 +719,7 @@ void ATVMod::apply(bool force)
|
||||
memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
|
||||
m_SSBFilterBufferIndex = 0;
|
||||
|
||||
applyStandard(rateUnits, nbPointsPerRateUnit); // set all timings
|
||||
applyStandard(m_tvSampleRate, m_pointsPerLine); // set all timings
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
MsgReportEffectiveSampleRate *report;
|
||||
@ -774,7 +771,7 @@ void ATVMod::apply(bool force)
|
||||
m_running.m_forceDecimator = m_config.m_forceDecimator;
|
||||
}
|
||||
|
||||
void ATVMod::getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit)
|
||||
void ATVMod::getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, uint32_t& nbPointsPerRateUnit)
|
||||
{
|
||||
int maxPoints = outputSampleRate / linesPerSecond;
|
||||
int i = maxPoints;
|
||||
@ -808,14 +805,14 @@ float ATVMod::getRFBandwidthDivisor(ATVModulation modulation)
|
||||
|
||||
void ATVMod::applyStandard(int rateUnits, int nbPointsPerRateUnit)
|
||||
{
|
||||
m_pointsPerTU = m_tvSampleRate / rateUnits; // TV sample rate is already set at a multiple of rate units
|
||||
m_pointsPerSync = (uint32_t) ((4.7f / 64.0f) * m_pointsPerLine);
|
||||
m_pointsPerBP = (uint32_t) ((4.7f / 64.0f) * m_pointsPerLine);
|
||||
m_pointsPerFP = (uint32_t) ((2.6f / 64.0f) * m_pointsPerLine);
|
||||
m_pointsPerFSync = (uint32_t) ((2.3f / 64.0f) * m_pointsPerLine);
|
||||
|
||||
m_pointsPerImgLine = m_pointsPerLine - m_pointsPerSync - m_pointsPerBP - m_pointsPerFP;
|
||||
m_nbHorizPoints = m_pointsPerLine;
|
||||
|
||||
m_pointsPerSync = (uint32_t) roundf(4.7f * m_pointsPerTU); // normal sync pulse (4.7 us / rateUnits)
|
||||
m_pointsPerBP = (uint32_t) roundf(4.7f * m_pointsPerTU); // back porch (4.7 us / rateUnits)
|
||||
m_pointsPerFP = (uint32_t) roundf(1.5f * m_pointsPerTU); // front porch (1.5 us / rateUnits)
|
||||
m_pointsPerFSync = (uint32_t) roundf(2.3f * m_pointsPerTU); // equalizing pulse (2.3 us / rateUnits)
|
||||
m_pointsPerImgLine = nbPointsPerRateUnit * m_pointsPerTU - m_pointsPerSync - m_pointsPerBP - m_pointsPerFP;
|
||||
m_nbHorizPoints = nbPointsPerRateUnit * m_pointsPerTU; // full line
|
||||
m_pointsPerHBar = m_pointsPerImgLine / m_nbBars;
|
||||
m_linesPerVBar = m_nbImageLines2 / m_nbBars;
|
||||
m_hBarIncrement = m_spanLevel / (float) m_nbBars;
|
||||
|
@ -404,7 +404,7 @@ public:
|
||||
Real getMagSq() const { return m_movingAverage.average(); }
|
||||
void getCameraNumbers(std::vector<int>& numbers);
|
||||
|
||||
static void getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit);
|
||||
static void getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, uint32_t& nbPointsPerRateUnit);
|
||||
static float getRFBandwidthDivisor(ATVModulation modulation);
|
||||
|
||||
signals:
|
||||
|
Loading…
Reference in New Issue
Block a user