diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index 1af5d8500..5d5d5823f 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -76,9 +76,28 @@ bool ATVDemod::SetATVScreen(ATVScreen *objScreen) m_objRegisteredATVScreen = objScreen; } -void ATVDemod::configure(MessageQueue* objMessageQueue, int intLineDurationUs, int intTopDurationUs, int intFramePerS, int intPercentOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, ATVModulation enmModulation, bool blnHSync, bool blnVSync) +void ATVDemod::configure( + MessageQueue* objMessageQueue, + float fltLineDurationUs, + float fltTopDurationUs, + float fltFramePerS, + float fltRatioOfRowsToDisplay, + float fltVoltLevelSynchroTop, + float fltVoltLevelSynchroBlack, + ATVModulation enmModulation, + bool blnHSync, + bool blnVSync) { - Message* msgCmd = MsgConfigureATVDemod::create(intLineDurationUs, intTopDurationUs, intFramePerS, intPercentOfRowsToDisplay, fltVoltLevelSynchroTop, fltVoltLevelSynchroBlack, enmModulation,blnHSync,blnVSync); + Message* msgCmd = MsgConfigureATVDemod::create( + fltLineDurationUs, + fltTopDurationUs, + fltFramePerS, + fltRatioOfRowsToDisplay, + fltVoltLevelSynchroTop, + fltVoltLevelSynchroBlack, + enmModulation, + blnHSync, + blnVSync); objMessageQueue->push(msgCmd); } @@ -86,15 +105,15 @@ void ATVDemod::InitATVParameters( int intSampleRate, float fltLineDurationUs, float fltTopDurationUs, - int intFramePerS, - int intPercentOfRowsToDisplay, + float fltFramePerS, + float fltRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, ATVModulation enmModulation, bool blnHSync, bool blnVSync) { - float fltImagesPerSeconds = (float) intFramePerS; +// float fltImagesPerSeconds = (float) intFramePerS; int intNumberSamplePerLine; int intNumberOfLines; bool blnNewOpenGLScreen = false; @@ -105,7 +124,7 @@ void ATVDemod::InitATVParameters( m_fltVoltLevelSynchroBlack = fltVoltLevelSynchroBlack; intNumberSamplePerLine = (int) ((fltLineDurationUs * intSampleRate) / m_fltSecondToUs); - intNumberOfLines = (int) ((m_fltSecondToUs/fltImagesPerSeconds) /round(fltLineDurationUs)); + intNumberOfLines = (int) ((m_fltSecondToUs/fltFramePerS) /round(fltLineDurationUs)); if((intNumberSamplePerLine != m_intNumberSamplePerLine) || (intNumberOfLines != m_intNumberOfLines)) @@ -116,7 +135,7 @@ void ATVDemod::InitATVParameters( m_intNumberSamplePerLine= intNumberSamplePerLine; m_intNumberSamplePerTop=(int)((fltTopDurationUs * intSampleRate) / m_fltSecondToUs); m_intNumberOfLines = intNumberOfLines; - m_intNumberOfRowsToDisplay = (int)((((float)intPercentOfRowsToDisplay) * fltLineDurationUs * intSampleRate) / (m_fltSecondToUs*100.0f)); + m_intNumberOfRowsToDisplay = (int) ((fltRatioOfRowsToDisplay * fltLineDurationUs * intSampleRate) / m_fltSecondToUs); m_intRowsLimit = m_intNumberOfLines-1; m_intImageIndex = 0; @@ -135,11 +154,11 @@ void ATVDemod::InitATVParameters( m_objRunning.m_enmModulation = m_enmModulation; m_objRunning.m_fltVoltLevelSynchroBlack = m_fltVoltLevelSynchroBlack; m_objRunning.m_fltVoltLevelSynchroTop = m_fltVoltLevelSynchroTop; - m_objRunning.m_intFramePerS = intFramePerS; + m_objRunning.m_fltFramePerS = fltFramePerS; m_objRunning.m_fltLineDurationUs = fltLineDurationUs; m_objRunning.m_fltTopDurationUs = fltTopDurationUs; m_objRunning.m_intSampleRate = intSampleRate; - m_objRunning.m_intPercentOfRowsToDisplay = intPercentOfRowsToDisplay; + m_objRunning.m_fltRatioOfRowsToDisplay = fltRatioOfRowsToDisplay; m_objRunning.m_blnHSync = blnHSync; m_objRunning.m_blnVSync = blnVSync; @@ -149,7 +168,8 @@ void ATVDemod::InitATVParameters( << " - Sample rate S/s: " << intSampleRate << " - Line us: " << fltLineDurationUs << " - Top us: " << fltTopDurationUs - << " - Frame/s: " << intFramePerS + << " - Frame/s: " << fltFramePerS + << " - Frame display ratio: " << fltRatioOfRowsToDisplay << " <=> " << " - Samples per Line: " << m_intNumberSamplePerLine << " - Samples per Top: " << m_intNumberSamplePerTop @@ -327,11 +347,11 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto //********** Filling pixels ********** - blnComputeImage=(m_objRunning.m_intPercentOfRowsToDisplay!=50); + blnComputeImage = (m_objRunning.m_fltRatioOfRowsToDisplay != 0.5f); if (!blnComputeImage) { - blnComputeImage=((m_intImageIndex/2)%2==0); + blnComputeImage = ((m_intImageIndex/2) % 2 == 0); } if (blnComputeImage) @@ -547,9 +567,9 @@ bool ATVDemod::handleMessage(const Message& cmd) m_objConfig.m_enmModulation = objCfg.m_objMsgConfig.m_enmModulation; m_objConfig.m_fltVoltLevelSynchroBlack = objCfg.m_objMsgConfig.m_fltVoltLevelSynchroBlack; m_objConfig.m_fltVoltLevelSynchroTop = objCfg.m_objMsgConfig.m_fltVoltLevelSynchroTop; - m_objConfig.m_intFramePerS = objCfg.m_objMsgConfig.m_intFramePerS; + m_objConfig.m_fltFramePerS = objCfg.m_objMsgConfig.m_fltFramePerS; m_objConfig.m_fltLineDurationUs = objCfg.m_objMsgConfig.m_fltLineDurationUs; - m_objConfig.m_intPercentOfRowsToDisplay = objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay; + m_objConfig.m_fltRatioOfRowsToDisplay = objCfg.m_objMsgConfig.m_fltRatioOfRowsToDisplay; m_objConfig.m_fltTopDurationUs = objCfg.m_objMsgConfig.m_fltTopDurationUs; m_objConfig.m_blnHSync = objCfg.m_objMsgConfig.m_blnHSync; m_objConfig.m_blnVSync = objCfg.m_objMsgConfig.m_blnVSync; @@ -557,9 +577,9 @@ bool ATVDemod::handleMessage(const Message& cmd) if((objCfg.m_objMsgConfig.m_enmModulation != m_objRunning.m_enmModulation) || (objCfg.m_objMsgConfig.m_fltVoltLevelSynchroBlack != m_objRunning.m_fltVoltLevelSynchroBlack) || (objCfg.m_objMsgConfig.m_fltVoltLevelSynchroTop != m_objRunning.m_fltVoltLevelSynchroTop) - || (objCfg.m_objMsgConfig.m_intFramePerS != m_objRunning.m_intFramePerS) + || (objCfg.m_objMsgConfig.m_fltFramePerS != m_objRunning.m_fltFramePerS) || (objCfg.m_objMsgConfig.m_fltLineDurationUs != m_objRunning.m_fltLineDurationUs) - || (objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay != m_objRunning.m_intPercentOfRowsToDisplay) + || (objCfg.m_objMsgConfig.m_fltRatioOfRowsToDisplay != m_objRunning.m_fltRatioOfRowsToDisplay) || (objCfg.m_objMsgConfig.m_fltTopDurationUs != m_objRunning.m_fltTopDurationUs) || (objCfg.m_objMsgConfig.m_blnHSync != m_objRunning.m_blnHSync) || (objCfg.m_objMsgConfig.m_blnVSync != m_objRunning.m_blnVSync)) @@ -567,9 +587,9 @@ bool ATVDemod::handleMessage(const Message& cmd) m_objRunning.m_enmModulation = objCfg.m_objMsgConfig.m_enmModulation; m_objRunning.m_fltVoltLevelSynchroBlack = objCfg.m_objMsgConfig.m_fltVoltLevelSynchroBlack; m_objRunning.m_fltVoltLevelSynchroTop = objCfg.m_objMsgConfig.m_fltVoltLevelSynchroTop; - m_objRunning.m_intFramePerS = objCfg.m_objMsgConfig.m_intFramePerS; + m_objRunning.m_fltFramePerS = objCfg.m_objMsgConfig.m_fltFramePerS; m_objRunning.m_fltLineDurationUs = objCfg.m_objMsgConfig.m_fltLineDurationUs; - m_objRunning.m_intPercentOfRowsToDisplay = objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay; + m_objRunning.m_fltRatioOfRowsToDisplay = objCfg.m_objMsgConfig.m_fltRatioOfRowsToDisplay; m_objRunning.m_fltTopDurationUs = objCfg.m_objMsgConfig.m_fltTopDurationUs; m_objRunning.m_blnHSync = objCfg.m_objMsgConfig.m_blnHSync; m_objRunning.m_blnVSync = objCfg.m_objMsgConfig.m_blnVSync; @@ -598,8 +618,8 @@ void ATVDemod::ApplySettings() m_objRunning.m_intSampleRate, m_objRunning.m_fltLineDurationUs, m_objRunning.m_fltTopDurationUs, - m_objRunning.m_intFramePerS, - m_objRunning.m_intPercentOfRowsToDisplay, + m_objRunning.m_fltFramePerS, + m_objRunning.m_fltRatioOfRowsToDisplay, m_objRunning.m_fltVoltLevelSynchroTop, m_objRunning.m_fltVoltLevelSynchroBlack, m_objRunning.m_enmModulation, diff --git a/plugins/channelrx/demodatv/atvdemod.h b/plugins/channelrx/demodatv/atvdemod.h index c6586f89b..a8d0852dd 100644 --- a/plugins/channelrx/demodatv/atvdemod.h +++ b/plugins/channelrx/demodatv/atvdemod.h @@ -51,8 +51,8 @@ public: int m_intSampleRate; float m_fltLineDurationUs; float m_fltTopDurationUs; - int m_intFramePerS; - int m_intPercentOfRowsToDisplay; + float m_fltFramePerS; + float m_fltRatioOfRowsToDisplay; float m_fltVoltLevelSynchroTop; float m_fltVoltLevelSynchroBlack; ATVModulation m_enmModulation; @@ -63,8 +63,8 @@ public: m_intSampleRate(0), m_fltLineDurationUs(0.0f), m_fltTopDurationUs(0.0f), - m_intFramePerS(0), - m_intPercentOfRowsToDisplay(0), + m_fltFramePerS(0.0f), + m_fltRatioOfRowsToDisplay(0.0f), m_fltVoltLevelSynchroTop(0), m_fltVoltLevelSynchroBlack(0), m_enmModulation(ATV_FM1), @@ -78,10 +78,10 @@ public: ~ATVDemod(); void configure(MessageQueue* objMessageQueue, - int intLineDurationUs, - int intTopDurationUs, - int intFramePerS, - int intPercentOfRowsToDisplay, + float fltLineDurationUs, + float fltTopDurationUs, + float fltFramePerS, + float fltRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, ATVModulation enmModulation, @@ -97,8 +97,8 @@ public: void InitATVParameters(int intMsps, float fltLineDurationUs, float fltTopDurationUs, - int intFramePerS, - int intPercentOfRowsToDisplay, + float fltFramePerS, + float fltRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, ATVModulation enmModulation, @@ -116,8 +116,8 @@ private: public: static MsgConfigureATVDemod* create(float fltLineDurationUs, float fltTopDurationUs, - int intFramePerS, - int intPercentOfRowsToDisplay, + float fltFramePerS, + float fltRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, ATVModulation enmModulation, @@ -126,8 +126,8 @@ private: { return new MsgConfigureATVDemod(fltLineDurationUs, fltTopDurationUs, - intFramePerS, - intPercentOfRowsToDisplay, + fltFramePerS, + fltRatioOfRowsToDisplay, fltVoltLevelSynchroTop, fltVoltLevelSynchroBlack, enmModulation, @@ -138,10 +138,11 @@ private: ATVConfig m_objMsgConfig; private: - MsgConfigureATVDemod(float fltLineDurationUs, + MsgConfigureATVDemod( + float fltLineDurationUs, float fltTopDurationUs, - int intFramePerS, - int intPercentOfRowsToDisplay, + float fltFramePerS, + float flatRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, ATVModulation enmModulation, @@ -152,10 +153,10 @@ private: m_objMsgConfig.m_enmModulation = enmModulation; m_objMsgConfig.m_fltVoltLevelSynchroBlack = fltVoltLevelSynchroBlack; m_objMsgConfig.m_fltVoltLevelSynchroTop = fltVoltLevelSynchroTop; - m_objMsgConfig.m_intFramePerS = intFramePerS; + m_objMsgConfig.m_fltFramePerS = fltFramePerS; m_objMsgConfig.m_fltLineDurationUs = fltLineDurationUs; m_objMsgConfig.m_fltTopDurationUs = fltTopDurationUs; - m_objMsgConfig.m_intPercentOfRowsToDisplay = intPercentOfRowsToDisplay; + m_objMsgConfig.m_fltRatioOfRowsToDisplay = flatRatioOfRowsToDisplay; m_objMsgConfig.m_blnHSync = blnHSync; m_objMsgConfig.m_blnVSync = blnVSync; } diff --git a/plugins/channelrx/demodatv/atvdemodgui.cpp b/plugins/channelrx/demodatv/atvdemodgui.cpp index 9cc02555e..a837f2551 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.cpp +++ b/plugins/channelrx/demodatv/atvdemodgui.cpp @@ -279,10 +279,10 @@ void ATVDemodGUI::applySettings() m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(), ui->lineTime->value() / 10.0f, ui->topTime->value() * 1.0f, - (ui->fps->currentIndex() == 0) ? 25 : 30, - (ui->halfImage->checkState() == Qt::Checked) ? 50 : 100, - ((float) (ui->synchLevel->value())) / 1000.0f, - ((float) (ui->blackLevel->value())) / 1000.0f, + (ui->fps->currentIndex() == 0) ? 25.0f : 30.0f, + (ui->halfImage->checkState() == Qt::Checked) ? 0.5f : 1.0f, + ui->synchLevel->value() / 1000.0f, + ui->blackLevel->value() / 1000.0f, (ATVDemod::ATVModulation) ui->modulation->currentIndex(), ui->hSync->isChecked(), ui->vSync->isChecked());