1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

ATV Demodulator: pass line time as float from GUI

This commit is contained in:
f4exb 2017-03-16 23:13:51 +01:00
parent 50da60af8e
commit df32ccef2f
3 changed files with 75 additions and 76 deletions

View File

@ -27,6 +27,8 @@
MESSAGE_CLASS_DEFINITION(ATVDemod::MsgConfigureATVDemod, Message)
const float ATVDemod::m_fltSecondToUs = 1000000.0f;
ATVDemod::ATVDemod() :
m_objSettingsMutex(QMutex::NonRecursive),
m_objRegisteredATVScreen(NULL),
@ -82,7 +84,7 @@ void ATVDemod::configure(MessageQueue* objMessageQueue, int intLineDurationUs, i
void ATVDemod::InitATVParameters(
int intMsps,
int intLineDurationUs,
float fltLineDurationUs,
int intTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
@ -92,33 +94,30 @@ void ATVDemod::InitATVParameters(
bool blnHSync,
bool blnVSync)
{
float fltSecondToUs = 1000000.0f;
float fltSampling=(float) intMsps;
float fltLineTimeUs=((float) intLineDurationUs)/10.0f;
float fltLineSynchroTop=(float) intTopDurationUs;
float fltImagesPerSeconds=(float) intFramePerS;
float fltLineSynchroTop = (float) intTopDurationUs;
float fltImagesPerSeconds = (float) intFramePerS;
int intNumberSamplePerLine;
int intNumberOfLines;
bool blnNewOpenGLScreen=false;
bool blnNewOpenGLScreen = false;
m_objSettingsMutex.lock();
m_fltVoltLevelSynchroTop = fltVoltLevelSynchroTop;
m_fltVoltLevelSynchroBlack = fltVoltLevelSynchroBlack;
intNumberSamplePerLine=(int)((fltLineTimeUs*fltSampling)/fltSecondToUs);
intNumberOfLines=(int)((fltSecondToUs/fltImagesPerSeconds)/round(fltLineTimeUs));
intNumberSamplePerLine = (int) ((fltLineDurationUs * intMsps) / m_fltSecondToUs);
intNumberOfLines = (int) ((m_fltSecondToUs/fltImagesPerSeconds) /round(fltLineDurationUs));
if((intNumberSamplePerLine!=m_intNumberSamplePerLine)
|| (intNumberOfLines!=m_intNumberOfLines))
if((intNumberSamplePerLine != m_intNumberSamplePerLine)
|| (intNumberOfLines != m_intNumberOfLines))
{
blnNewOpenGLScreen=true;
blnNewOpenGLScreen = true;
}
m_intNumberSamplePerLine= intNumberSamplePerLine;
m_intNumberSamplePerTop=(int)((fltLineSynchroTop*fltSampling)/fltSecondToUs);
m_intNumberSamplePerTop=(int)((fltLineSynchroTop * intMsps) / m_fltSecondToUs);
m_intNumberOfLines = intNumberOfLines;
m_intNumberOfRowsToDisplay = (int)((((float)intPercentOfRowsToDisplay)*fltLineTimeUs*fltSampling)/(fltSecondToUs*100.0f));
m_intNumberOfRowsToDisplay = (int)((((float)intPercentOfRowsToDisplay) * fltLineDurationUs * intMsps) / (m_fltSecondToUs*100.0f));
m_intRowsLimit = m_intNumberOfLines-1;
m_intImageIndex = 0;
@ -130,7 +129,7 @@ void ATVDemod::InitATVParameters(
if(blnNewOpenGLScreen)
{
m_objRegisteredATVScreen->resizeATVScreen(m_intNumberSamplePerLine,m_intNumberOfLines);
m_objRegisteredATVScreen->resizeATVScreen(m_intNumberSamplePerLine, m_intNumberOfLines);
}
//Mise à jour de la config
@ -138,7 +137,7 @@ void ATVDemod::InitATVParameters(
m_objRunning.m_fltVoltLevelSynchroBlack = m_fltVoltLevelSynchroBlack;
m_objRunning.m_fltVoltLevelSynchroTop = m_fltVoltLevelSynchroTop;
m_objRunning.m_intFramePerS = intFramePerS;
m_objRunning.m_intLineDurationUs = intLineDurationUs;
m_objRunning.m_fltLineDurationUs = fltLineDurationUs;
m_objRunning.m_intTopDurationUs = intTopDurationUs;
m_objRunning.m_intMsps = intMsps;
m_objRunning.m_intPercentOfRowsToDisplay = intPercentOfRowsToDisplay;
@ -149,7 +148,7 @@ void ATVDemod::InitATVParameters(
qDebug() << "ATVDemod::InitATVParameters:"
<< " - Msps: " << intMsps
<< " - Line us: " << intLineDurationUs
<< " - Line us: " << fltLineDurationUs
<< " - Top us: " << intTopDurationUs
<< " - Frame/s: " << intFramePerS
<< " <=> "
@ -550,7 +549,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
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_intLineDurationUs = objCfg.m_objMsgConfig.m_intLineDurationUs;
m_objConfig.m_fltLineDurationUs = objCfg.m_objMsgConfig.m_fltLineDurationUs;
m_objConfig.m_intPercentOfRowsToDisplay = objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay;
m_objConfig.m_intTopDurationUs = objCfg.m_objMsgConfig.m_intTopDurationUs;
m_objConfig.m_blnHSync = objCfg.m_objMsgConfig.m_blnHSync;
@ -560,7 +559,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
|| (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_intLineDurationUs != m_objRunning.m_intLineDurationUs)
|| (objCfg.m_objMsgConfig.m_fltLineDurationUs != m_objRunning.m_fltLineDurationUs)
|| (objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay != m_objRunning.m_intPercentOfRowsToDisplay)
|| (objCfg.m_objMsgConfig.m_intTopDurationUs != m_objRunning.m_intTopDurationUs)
|| (objCfg.m_objMsgConfig.m_blnHSync != m_objRunning.m_blnHSync)
@ -570,7 +569,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
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_intLineDurationUs = objCfg.m_objMsgConfig.m_intLineDurationUs;
m_objRunning.m_fltLineDurationUs = objCfg.m_objMsgConfig.m_fltLineDurationUs;
m_objRunning.m_intPercentOfRowsToDisplay = objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay;
m_objRunning.m_intTopDurationUs = objCfg.m_objMsgConfig.m_intTopDurationUs;
m_objRunning.m_blnHSync = objCfg.m_objMsgConfig.m_blnHSync;
@ -598,7 +597,7 @@ void ATVDemod::ApplySettings()
InitATVParameters(
m_objRunning.m_intMsps,
m_objRunning.m_intLineDurationUs,
m_objRunning.m_fltLineDurationUs,
m_objRunning.m_intTopDurationUs,
m_objRunning.m_intFramePerS,
m_objRunning.m_intPercentOfRowsToDisplay,

View File

@ -49,7 +49,7 @@ public:
struct ATVConfig
{
int m_intMsps;
int m_intLineDurationUs;
float m_fltLineDurationUs;
int m_intTopDurationUs;
int m_intFramePerS;
int m_intPercentOfRowsToDisplay;
@ -61,7 +61,7 @@ public:
ATVConfig() :
m_intMsps(0),
m_intLineDurationUs(0),
m_fltLineDurationUs(0.0f),
m_intTopDurationUs(0),
m_intFramePerS(0),
m_intPercentOfRowsToDisplay(0),
@ -95,7 +95,7 @@ public:
bool SetATVScreen(ATVScreen *objScreen);
void InitATVParameters(int intMsps,
int intLineDurationUs,
float fltLineDurationUs,
int intTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
@ -107,60 +107,14 @@ public:
int GetSampleRate();
double getMagSq() const { return m_objMagSqAverage.average(); } //!< Beware this is scaled to 2^30
private:
//*************** ATV PARAMETERS ***************
ATVScreen * m_objRegisteredATVScreen;
int m_intNumberSamplePerLine;
int m_intNumberSamplePerTop;
int m_intNumberOfLines;
int m_intNumberOfRowsToDisplay;
float m_fltVoltLevelSynchroTop;
float m_fltVoltLevelSynchroBlack;
ATVModulation m_enmModulation;
//*************** PROCESSING ***************
int m_intImageIndex;
int m_intRowsLimit;
int m_intSynchroPoints;
bool m_blnSynchroDetected;
bool m_blnLineSynchronized;
bool m_blnImageDetecting;
bool m_blnVerticalSynchroDetected;
float m_fltAmpLineAverage;
float m_fltEffMin;
float m_fltEffMax;
float m_fltAmpMin;
float m_fltAmpMax;
float m_fltAmpDelta;
float m_fltBufferI[6];
float m_fltBufferQ[6];
int m_intColIndex;
int m_intRowIndex;
//*************** RF ***************
MovingAverage<double> m_objMagSqAverage;
//QElapsedTimer m_objTimer;
private:
class MsgConfigureATVDemod : public Message
{
MESSAGE_CLASS_DECLARATION
MESSAGE_CLASS_DECLARATION
public:
static MsgConfigureATVDemod* create(int intLineDurationUs,
static MsgConfigureATVDemod* create(float fltLineDurationUs,
int intTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
@ -170,7 +124,7 @@ private:
bool blnHSync,
bool blnVSync)
{
return new MsgConfigureATVDemod(intLineDurationUs,
return new MsgConfigureATVDemod(fltLineDurationUs,
intTopDurationUs,
intFramePerS,
intPercentOfRowsToDisplay,
@ -184,7 +138,7 @@ private:
ATVConfig m_objMsgConfig;
private:
MsgConfigureATVDemod(int intLineDurationUs,
MsgConfigureATVDemod(float fltLineDurationUs,
int intTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
@ -199,7 +153,7 @@ private:
m_objMsgConfig.m_fltVoltLevelSynchroBlack = fltVoltLevelSynchroBlack;
m_objMsgConfig.m_fltVoltLevelSynchroTop = fltVoltLevelSynchroTop;
m_objMsgConfig.m_intFramePerS = intFramePerS;
m_objMsgConfig.m_intLineDurationUs = intLineDurationUs;
m_objMsgConfig.m_fltLineDurationUs = fltLineDurationUs;
m_objMsgConfig.m_intTopDurationUs = intTopDurationUs;
m_objMsgConfig.m_intPercentOfRowsToDisplay = intPercentOfRowsToDisplay;
m_objMsgConfig.m_blnHSync = blnHSync;
@ -207,12 +161,58 @@ private:
}
};
//*************** ATV PARAMETERS ***************
ATVScreen * m_objRegisteredATVScreen;
int m_intNumberSamplePerLine;
int m_intNumberSamplePerTop;
int m_intNumberOfLines;
int m_intNumberOfRowsToDisplay;
float m_fltVoltLevelSynchroTop;
float m_fltVoltLevelSynchroBlack;
ATVModulation m_enmModulation;
//*************** PROCESSING ***************
int m_intImageIndex;
int m_intRowsLimit;
int m_intSynchroPoints;
bool m_blnSynchroDetected;
bool m_blnLineSynchronized;
bool m_blnImageDetecting;
bool m_blnVerticalSynchroDetected;
float m_fltAmpLineAverage;
float m_fltEffMin;
float m_fltEffMax;
float m_fltAmpMin;
float m_fltAmpMax;
float m_fltAmpDelta;
float m_fltBufferI[6];
float m_fltBufferQ[6];
int m_intColIndex;
int m_intRowIndex;
//*************** RF ***************
MovingAverage<double> m_objMagSqAverage;
//QElapsedTimer m_objTimer;
ATVConfig m_objRunning;
ATVConfig m_objConfig;
QMutex m_objSettingsMutex;
static const float m_fltSecondToUs;
void ApplySettings();
};

View File

@ -277,7 +277,7 @@ void ATVDemodGUI::applySettings()
m_objChannelMarker.getCenterFrequency());
m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(),
ui->lineTime->value(),
ui->lineTime->value() / 10.0f,
ui->topTime->value(),
(ui->fps->currentIndex() == 0) ? 25 : 30,
(ui->halfImage->checkState() == Qt::Checked) ? 50 : 100,