19 #ifndef INCLUDE_ATVDEMOD_H 20 #define INCLUDE_ATVDEMOD_H 23 #include <QElapsedTimer> 92 m_intNumberOfLines(625),
93 m_fltLineDuration(0.0f),
94 m_fltTopDuration(0.0f),
95 m_fltFramePerS(25.0f),
96 m_fltRatioOfRowsToDisplay(0.0f),
97 m_fltVoltLevelSynchroTop(0.0f),
98 m_fltVoltLevelSynchroBlack(1.0f),
101 m_blnInvertVideo(false),
102 m_intVideoTabIndex(0)
119 m_intFrequencyOffset(0),
122 m_fltRFOppBandwidth(0),
123 m_blnFFTFiltering(false),
124 m_blndecimatorEnable(false),
125 m_fltBFOFrequency(0.0f),
147 m_centerFrequency(centerFrequency)
170 m_sampleRate(sampleRate),
171 m_nbPointsPerLine(nbPointsPerLine)
191 m_sampleRate(sampleRate)
201 float fltLineDurationUs,
202 float fltTopDurationUs,
205 int intNumberOfLines,
206 float fltRatioOfRowsToDisplay,
207 float fltVoltLevelSynchroTop,
208 float fltVoltLevelSynchroBlack,
212 int intVideoTabIndex);
217 float fltRFBandwidth,
218 float fltRFOppBandwidth,
219 bool blnFFTFiltering,
220 bool blndecimatorEnable,
221 float fltBFOFrequency,
224 virtual void feed(
const SampleVector::const_iterator& begin,
const SampleVector::const_iterator& end,
bool po);
225 virtual void start();
230 virtual void getTitle(QString& title) { title = objectName(); }
233 virtual QByteArray
serialize()
const {
return QByteArray(); }
234 virtual bool deserialize(
const QByteArray& data) { (void) data;
return false; }
242 (void) sinkElseSource;
265 m_intTVSampleRate(0),
266 m_intNumberSamplePerLine(0)
276 float fltLineDurationUs,
277 float fltTopDurationUs,
280 int intNumberOfLines,
281 float fltRatioOfRowsToDisplay,
282 float fltVoltLevelSynchroTop,
283 float fltVoltLevelSynchroBlack,
287 int intVideoTabIndex)
295 fltRatioOfRowsToDisplay,
296 fltVoltLevelSynchroTop,
297 fltVoltLevelSynchroBlack,
308 float fltLineDurationUs,
309 float fltTopDurationUs,
312 int intNumberOfLines,
313 float flatRatioOfRowsToDisplay,
314 float fltVoltLevelSynchroTop,
315 float fltVoltLevelSynchroBlack,
319 int intVideoTabIndex) :
345 float fltRFBandwidth,
346 float fltRFOppBandwidth,
347 bool blnFFTFiltering,
348 bool blndecimatorEnable,
369 float fltRFBandwidth,
370 float fltRFOppBandwidth,
371 bool blnFFTFiltering,
372 bool blndecimatorEnable,
373 float fltBFOFrequency,
394 AvgExpInt(
int log2Alpha) : m_log2Alpha(log2Alpha), m_m1(0), m_start(true) {}
407 m_m1 = m0 + m_m1 - (m_m1>>m_log2Alpha);
408 return m_m1>>m_log2Alpha;
512 m_registeredTVScreen->
setDataColor(m_intColIndex - m_intNumberSaplesPerHSync + m_intNumberSamplePerTop, intVal, intVal, intVal);
519 m_intSynchroPoints++;
524 m_intSynchroPoints = 0;
531 if (m_blnSynchroDetected)
544 m_intSampleIndex = 0;
557 if (m_running.
m_blnHSync && (m_intLineIndex == 0))
575 if(m_fltAmpDelta<=0.0)
581 m_fltEffMin = 2000000.0f;
582 m_fltEffMax = -2000000.0f;
585 m_registeredTVScreen->
selectRow(m_intRowIndex);
601 m_intSynchroPoints++;
606 m_intSynchroPoints = 0;
613 bool blnNewLine =
false;
615 if (m_blnSynchroDetected)
617 m_intAvgColIndex = m_intSampleIndex - m_intColIndex - (m_intColIndex < m_runningPrivate.
m_intNumberSamplePerLine/2 ? 150 : 0);
619 m_intSampleIndex = 0;
633 if (m_running.
m_blnHSync && (m_intLineIndex == 0))
636 m_intColIndex = m_intNumberSamplePerTop + m_intAvgColIndex/4;
656 if(m_fltAmpDelta<=0.0)
662 m_fltEffMin = 2000000.0f;
663 m_fltEffMax = -2000000.0f;
666 m_fltAmpLineAverage=0.0f;
669 m_intRowIndex += m_interleaved ? 2 : 1;
671 if (m_intRowIndex < m_intNumberOfLines)
673 m_registeredTVScreen->
selectRow(m_intRowIndex - m_intNumberOfSyncLines);
682 m_registeredTVScreen->
setDataColor(m_intColIndex - m_intNumberSaplesPerHSync + m_intNumberSamplePerTop + 4, intVal, intVal, intVal);
687 if ((m_running.
m_blnVSync) && (m_intLineIndex < m_intNumberOfLines))
689 if (m_intColIndex >= intSynchroTimeSamples)
691 if (m_fltAmpLineAverage <= fltSynchroTrameLevel)
693 m_fltAmpLineAverage = 0.0f;
695 if (!m_blnVerticalSynchroDetected)
697 m_blnVerticalSynchroDetected =
true;
699 if ((m_intLineIndex % 2 == 0) || !m_interleaved)
709 m_registeredTVScreen->
selectRow(m_intRowIndex - m_intNumberOfSyncLines);
716 m_blnVerticalSynchroDetected =
false;
722 if (m_intLineIndex >= m_intNumberOfLines/2)
724 if (m_intImageIndex % 2 == 1)
734 if(m_fltAmpDelta<=0.0)
740 m_fltEffMin = 2000000.0f;
741 m_fltEffMax = -2000000.0f;
751 m_registeredTVScreen->
selectRow(m_intRowIndex - m_intNumberOfSyncLines);
759 #endif // INCLUDE_ATVDEMOD_H virtual int getNbSourceStreams() const
bool setDataColor(int intCol, int intRed, int intGreen, int intBlue)
virtual qint64 getCenterFrequency() const
Applies to a default stream.
ATVConfigPrivate m_runningPrivate
std::vector< Sample > SampleVector
void processClassic(float &fltVal, int &intVal)
AM with vestigial lower side band (main signal is in the upper side)
Classical frequency modulation with discriminator #2.
SampleVector m_sampleBuffer
No modulation just produces zeros.
int64_t m_intFrequencyOffset
MovingAverageUtil< double, double, 32 > m_objMagSqAverage
void renderImage(unsigned char *objData)
static const QString m_channelIdURI
void configure(MessageQueue *objMessageQueue, float fltLineDurationUs, float fltTopDurationUs, float fltFramePerS, ATVStd enmATVStandard, int intNumberOfLines, float fltRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, bool blnHSync, bool blnVSync, bool blnInvertVideo, int intVideoTabIndex)
int getSampleRate() const
void configureRF(MessageQueue *objMessageQueue, int64_t frequencyOffset, ATVModulation enmModulation, float fltRFBandwidth, float fltRFOppBandwidth, bool blnFFTFiltering, bool blndecimatorEnable, float fltBFOFrequency, float fmDeviation)
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool po)
int m_intNumberSamplePerTop
int getEffectiveSampleRate()
int m_intNumberOfEqLines
number of equalizing lines both whole and partial
static MsgReportEffectiveSampleRate * create(int sampleRate, int nbPointsPerLine)
int getSampleRate() const
int m_intNumberSamplePerLine
int getNbPointsPerLine() const
AvgExpInt m_objAvgColIndex
int m_intNumberOfBlackLines
this is the total number of lines not part of the image and is used for vertical screen size ...
MsgReportEffectiveSampleRate(int sampleRate, int nbPointsPerLine)
static MsgReportChannelSampleRateChanged * create(int sampleRate)
float m_fltRatioOfRowsToDisplay
virtual void getIdentifier(QString &id)
SampleVector m_scopeSampleBuffer
Interpolator m_interpolator
int m_DSBFilterBufferIndex
Classical frequency modulation with phase derivative discriminator.
virtual bool handleMessage(const Message &cmd)
Processing of a message. Returns true if message has actually been processed.
QMutex m_objSettingsMutex
virtual void getTitle(QString &title)
static const QString m_channelId
#define MESSAGE_CLASS_DECLARATION
int m_intNumberSamplePerLineSignals
number of samples in the non image part of the line (signals)
ATVDemod(DeviceAPI *deviceAPI)
static const int m_ssbFftLen
static float getRFBandwidthDivisor(ATVModulation modulation)
ATVConfigPrivate m_configPrivate
int m_intNumberSaplesPerHSync
number of samples per horizontal synchronization pattern (pulse + back porch)
ThreadedBasebandSampleSink * m_threadedChannelizer
bool m_blndecimatorEnable
float m_fltRFOppBandwidth
ATVModulation m_enmModulation
TVScreen * m_registeredTVScreen
BasebandSampleSink * m_scopeSink
MsgReportChannelSampleRateChanged(int sampleRate)
Classical amplitude modulation.
PhaseDiscriminators m_objPhaseDiscri
void channelSampleRateChanged()
Complex * m_DSBFilterBuffer
bool m_blnVerticalSynchroDetected
void setScopeSink(BasebandSampleSink *scopeSink)
bool m_interleaved
interleaved image
float m_fltVoltLevelSynchroTop
bool m_blnSynchroDetected
virtual bool deserialize(const QByteArray &data)
void setTVScreen(TVScreen *objScreen)
set by the GUI
SecondOrderRecursiveFilter m_bfoFilter
float m_fltVoltLevelSynchroBlack
float m_fltAmpLineAverage
double getMagSq() const
Beware this is scaled to 2^30.
virtual QByteArray serialize() const
Real m_interpolatorDistanceRemain
std::complex< Real > Complex
int m_intNumberOfSyncLines
this is the number of non displayable lines at the start of a frame. First displayable row comes next...
void processHSkip(float &fltVal, int &intVal)
Real m_interpolatorDistance
DownChannelizer * m_channelizer
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
bool selectRow(int intLine)
AM with vestigial upper side band (main signal is in the lower side)
Classical frequency modulation with discriminator #1.
virtual int getNbSinkStreams() const