ATV Modulator: implemented video inversion

This commit is contained in:
f4exb 2017-03-19 10:49:02 +01:00
parent 303fd3ccc7
commit 71181c94fb
5 changed files with 49 additions and 11 deletions

View File

@ -106,7 +106,8 @@ void ATVMod::configure(MessageQueue* messageQueue,
bool videoPlayLoop, bool videoPlayLoop,
bool videoPlay, bool videoPlay,
bool cameraPlay, bool cameraPlay,
bool channelMute) bool channelMute,
bool invertedVideo)
{ {
Message* cmd = MsgConfigureATVMod::create( Message* cmd = MsgConfigureATVMod::create(
rfBandwidth, rfBandwidth,
@ -118,7 +119,8 @@ void ATVMod::configure(MessageQueue* messageQueue,
videoPlayLoop, videoPlayLoop,
videoPlay, videoPlay,
cameraPlay, cameraPlay,
channelMute); channelMute,
invertedVideo);
messageQueue->push(cmd); messageQueue->push(cmd);
} }
@ -189,6 +191,8 @@ void ATVMod::modulateSample()
pullVideo(t); pullVideo(t);
calculateLevel(t); calculateLevel(t);
t = m_running.m_invertedVideo ? 1.0f - t : t;
switch (m_running.m_atvModulation) switch (m_running.m_atvModulation)
{ {
case ATVModulationFM: // FM half bandwidth deviation case ATVModulationFM: // FM half bandwidth deviation
@ -521,6 +525,7 @@ bool ATVMod::handleMessage(const Message& cmd)
m_config.m_videoPlay = cfg.getVideoPlay(); m_config.m_videoPlay = cfg.getVideoPlay();
m_config.m_cameraPlay = cfg.getCameraPlay(); m_config.m_cameraPlay = cfg.getCameraPlay();
m_config.m_channelMute = cfg.getChannelMute(); m_config.m_channelMute = cfg.getChannelMute();
m_config.m_invertedVideo = cfg.getInvertedVideo();
apply(); apply();
@ -534,7 +539,8 @@ bool ATVMod::handleMessage(const Message& cmd)
<< " m_videoPlayLoop: " << m_config.m_videoPlayLoop << " m_videoPlayLoop: " << m_config.m_videoPlayLoop
<< " m_videoPlay: " << m_config.m_videoPlay << " m_videoPlay: " << m_config.m_videoPlay
<< " m_cameraPlay: " << m_config.m_cameraPlay << " m_cameraPlay: " << m_config.m_cameraPlay
<< " m_channelMute: " << m_config.m_channelMute; << " m_channelMute: " << m_config.m_channelMute
<< " m_invertedVideo: " << m_config.m_invertedVideo;
return true; return true;
} }
@ -692,6 +698,7 @@ void ATVMod::apply(bool force)
m_running.m_videoPlay = m_config.m_videoPlay; m_running.m_videoPlay = m_config.m_videoPlay;
m_running.m_cameraPlay = m_config.m_cameraPlay; m_running.m_cameraPlay = m_config.m_cameraPlay;
m_running.m_channelMute = m_config.m_channelMute; m_running.m_channelMute = m_config.m_channelMute;
m_running.m_invertedVideo = m_config.m_invertedVideo;
} }
int ATVMod::getSampleRateUnits(ATVStd std) int ATVMod::getSampleRateUnits(ATVStd std)

View File

@ -316,7 +316,8 @@ public:
bool videoPlayLoop, bool videoPlayLoop,
bool videoPlay, bool videoPlay,
bool cameraPLay, bool cameraPLay,
bool channelMute); bool channelMute,
bool invertedVideo);
virtual void pull(Sample& sample); virtual void pull(Sample& sample);
virtual void pullAudio(int nbSamples); // this is used for video signal actually virtual void pullAudio(int nbSamples); // this is used for video signal actually
@ -355,6 +356,7 @@ private:
bool getVideoPlay() const { return m_videoPlay; } bool getVideoPlay() const { return m_videoPlay; }
bool getCameraPlay() const { return m_cameraPlay; } bool getCameraPlay() const { return m_cameraPlay; }
bool getChannelMute() const { return m_channelMute; } bool getChannelMute() const { return m_channelMute; }
bool getInvertedVideo() const { return m_invertedVideo; }
static MsgConfigureATVMod* create( static MsgConfigureATVMod* create(
Real rfBandwidth, Real rfBandwidth,
@ -366,7 +368,8 @@ private:
bool videoPlayLoop, bool videoPlayLoop,
bool videoPlay, bool videoPlay,
bool cameraPlay, bool cameraPlay,
bool channelMute) bool channelMute,
bool invertedVideo)
{ {
return new MsgConfigureATVMod( return new MsgConfigureATVMod(
rfBandwidth, rfBandwidth,
@ -378,7 +381,8 @@ private:
videoPlayLoop, videoPlayLoop,
videoPlay, videoPlay,
cameraPlay, cameraPlay,
channelMute); channelMute,
invertedVideo);
} }
private: private:
@ -392,6 +396,7 @@ private:
bool m_videoPlay; bool m_videoPlay;
bool m_cameraPlay; bool m_cameraPlay;
bool m_channelMute; bool m_channelMute;
bool m_invertedVideo;
MsgConfigureATVMod( MsgConfigureATVMod(
Real rfBandwidth, Real rfBandwidth,
@ -403,7 +408,8 @@ private:
bool videoPlayLoop, bool videoPlayLoop,
bool videoPlay, bool videoPlay,
bool cameraPlay, bool cameraPlay,
bool channelMute) : bool channelMute,
bool invertedVideo) :
Message(), Message(),
m_rfBandwidth(rfBandwidth), m_rfBandwidth(rfBandwidth),
m_rfOppBandwidth(rfOppBandwidth), m_rfOppBandwidth(rfOppBandwidth),
@ -414,7 +420,8 @@ private:
m_videoPlayLoop(videoPlayLoop), m_videoPlayLoop(videoPlayLoop),
m_videoPlay(videoPlay), m_videoPlay(videoPlay),
m_cameraPlay(cameraPlay), m_cameraPlay(cameraPlay),
m_channelMute(channelMute) m_channelMute(channelMute),
m_invertedVideo(invertedVideo)
{ } { }
}; };
@ -460,7 +467,7 @@ private:
bool m_videoPlay; //!< True to play video and false to pause bool m_videoPlay; //!< True to play video and false to pause
bool m_cameraPlay; //!< True to play camera video and false to pause bool m_cameraPlay; //!< True to play camera video and false to pause
bool m_channelMute; //!< Mute channel baseband output bool m_channelMute; //!< Mute channel baseband output
Real m_vestigialRatio; //!< Vestigial sideband ratio to half bandwidth bool m_invertedVideo; //!< True if video signal is inverted before modulation
Config() : Config() :
m_outputSampleRate(-1), m_outputSampleRate(-1),
@ -475,7 +482,7 @@ private:
m_videoPlay(false), m_videoPlay(false),
m_cameraPlay(false), m_cameraPlay(false),
m_channelMute(false), m_channelMute(false),
m_vestigialRatio(0.1f) m_invertedVideo(false)
{ } { }
}; };

View File

@ -93,6 +93,7 @@ QByteArray ATVModGUI::serialize() const
s.writeU32(6, m_channelMarker.getColor().rgb()); s.writeU32(6, m_channelMarker.getColor().rgb());
s.writeS32(7, ui->rfOppBW->value()); s.writeS32(7, ui->rfOppBW->value());
s.writeS32(8, ui->modulation->currentIndex()); s.writeS32(8, ui->modulation->currentIndex());
s.writeBool(9, ui->invertVideo->isChecked());
return s.final(); return s.final();
} }
@ -112,6 +113,7 @@ bool ATVModGUI::deserialize(const QByteArray& data)
QByteArray bytetmp; QByteArray bytetmp;
quint32 u32tmp; quint32 u32tmp;
qint32 tmp; qint32 tmp;
bool booltmp;
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
@ -136,6 +138,8 @@ bool ATVModGUI::deserialize(const QByteArray& data)
ui->rfOppBW->setValue(tmp); ui->rfOppBW->setValue(tmp);
d.readS32(8, &tmp, 0); d.readS32(8, &tmp, 0);
ui->modulation->setCurrentIndex(tmp); ui->modulation->setCurrentIndex(tmp);
d.readBool(9, &booltmp, false);
ui->invertVideo->setChecked(booltmp);
blockApplySettings(false); blockApplySettings(false);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
@ -354,6 +358,11 @@ void ATVModGUI::on_uniformLevel_valueChanged(int value)
applySettings(); applySettings();
} }
void ATVModGUI::on_invertVideo_clicked()
{
applySettings();
}
void ATVModGUI::on_inputSelect_currentIndexChanged(int index) void ATVModGUI::on_inputSelect_currentIndexChanged(int index)
{ {
applySettings(); applySettings();
@ -558,7 +567,8 @@ void ATVModGUI::applySettings()
ui->playLoop->isChecked(), ui->playLoop->isChecked(),
ui->playVideo->isChecked(), ui->playVideo->isChecked(),
ui->playCamera->isChecked(), ui->playCamera->isChecked(),
ui->channelMute->isChecked()); ui->channelMute->isChecked(),
ui->invertVideo->isChecked());
} }
} }

View File

@ -67,6 +67,7 @@ private slots:
void on_rfBW_valueChanged(int value); void on_rfBW_valueChanged(int value);
void on_rfOppBW_valueChanged(int value); void on_rfOppBW_valueChanged(int value);
void on_standard_currentIndexChanged(int index); void on_standard_currentIndexChanged(int index);
void on_invertVideo_clicked();
void on_uniformLevel_valueChanged(int value); void on_uniformLevel_valueChanged(int value);
void on_inputSelect_currentIndexChanged(int index); void on_inputSelect_currentIndexChanged(int index);
void on_imageFileDialog_clicked(bool checked); void on_imageFileDialog_clicked(bool checked);

View File

@ -427,6 +427,19 @@
</item> </item>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="invertVideo">
<property name="toolTip">
<string>Toggle invert video signal</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Inv</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QDial" name="uniformLevel"> <widget class="QDial" name="uniformLevel">
<property name="maximumSize"> <property name="maximumSize">