44 m_deviceAPI(deviceAPI),
46 m_registeredTVScreen(0),
47 m_intNumberSamplePerTop(0),
49 m_intSynchroPoints(0),
50 m_blnSynchroDetected(false),
51 m_blnVerticalSynchroDetected(false),
52 m_fltAmpLineAverage(0.0f),
53 m_fltEffMin(2000000000.0f),
54 m_fltEffMax(-2000000000.0f),
55 m_fltAmpMin(-2000000000.0f),
56 m_fltAmpMax(2000000000.0f),
63 m_bfoPLL(200/1000000, 100/1000000, 0.01),
64 m_bfoFilter(200.0, 1000000.0, 0.9),
65 m_interpolatorDistance(1.0f),
66 m_interpolatorDistanceRemain(0.0f),
69 m_DSBFilterBufferIndex(0),
70 m_objSettingsMutex(QMutex::Recursive)
116 float fltLineDurationUs,
117 float fltTopDurationUs,
120 int intNumberOfLines,
121 float fltRatioOfRowsToDisplay,
122 float fltVoltLevelSynchroTop,
123 float fltVoltLevelSynchroBlack,
127 int intVideoTabIndex)
135 fltRatioOfRowsToDisplay,
136 fltVoltLevelSynchroTop,
137 fltVoltLevelSynchroBlack,
142 objMessageQueue->
push(msgCmd);
149 float fltRFBandwidth,
150 float fltRFOppBandwidth,
151 bool blnFFTFiltering,
152 bool blnDecimatorEnable,
153 float fltBFOFrequency,
165 objMessageQueue->
push(msgCmd);
168 void ATVDemod::feed(
const SampleVector::const_iterator& begin,
const SampleVector::const_iterator& end,
bool firstOfBurst)
181 #ifdef EXTENDED_DIRECT_SAMPLE 183 qint16 * ptrBufferToRelease = 0;
189 SampleVector::const_iterator it = begin;
191 ptrBuffer = it->ptrBuffer;
192 ptrBufferToRelease = ptrBuffer;
195 for(qint32 intInd=0; intInd<intLen-1; intInd +=2)
198 fltI= ((qint32) (*ptrBuffer)) << 4;
200 fltQ= ((qint32) (*ptrBuffer)) << 4;
205 for (SampleVector::const_iterator it = begin; it != end; ++it )
238 #ifdef EXTENDED_DIRECT_SAMPLE 239 if (ptrBufferToRelease != 0)
241 delete ptrBufferToRelease;
284 magSq = fltI*fltI + fltQ*fltQ;
286 fltNorm =
sqrt(magSq);
287 fltNormI= fltI/fltNorm;
288 fltNormQ= fltQ/fltNorm;
339 magSq = fltI*fltI + fltQ*fltQ;
341 fltNorm =
sqrt(magSq);
362 magSq = fltI*fltI + fltQ*fltQ;
364 fltNorm =
sqrt(magSq);
372 float mixI = fltI * bfoValues[0] - fltQ * bfoValues[1];
373 float mixQ = fltI * bfoValues[1] + fltQ * bfoValues[0];
376 fltVal = (mixI + mixQ);
378 fltVal = (mixI - mixQ);
403 fltNorm =
sqrt(magSq);
407 magSq = fltI*fltI + fltQ*fltQ;
409 fltNorm =
sqrt(magSq);
414 fltVal = (fltVal < -1.0f) ? -1.0f : (fltVal > 1.0f) ? 1.0f : fltVal;
459 qDebug() <<
"ATVDemod::handleMessage";
467 qDebug() <<
"ATVDemod::handleMessage: MsgChannelizerNotification:" 494 qDebug() <<
"ATVDemod::handleMessage: MsgConfigureATVDemod:" 514 qDebug() <<
"ATVDemod::handleMessage: MsgConfigureRFATVDemod:" 549 bool forwardSampleRateChange =
false;
572 if ((i * linesPerSecond) % 10 == 0)
576 int nbPointsPerRateUnit = i == 0 ? maxPoints :
i;
622 qDebug() <<
"ATVDemod::applySettings:" 641 forwardSampleRateChange =
true;
776 qDebug(
"ATVDemod::channelSampleRateChanged");
ATVConfigPrivate m_runningPrivate
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.
Complex nextIQ()
Return next complex sample.
bool decimate(Real *distance, const Complex &next, Complex *result)
void configure(MessageQueue *messageQueue, int sampleRate, int centerFrequency)
void push(Message *message, bool emitSignal=true)
Push message onto queue.
int64_t m_intFrequencyOffset
void removeChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
void addChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
MovingAverageUtil< double, double, 32 > m_objMagSqAverage
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
void setFMScaling(Real fmScaling)
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)
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
void configure(Real freq, Real bandwidth, Real minsignal)
int getEffectiveSampleRate()
int m_intNumberOfEqLines
number of equalizing lines both whole and partial
int getSampleRate() const
static MsgReportEffectiveSampleRate * create(int sampleRate, int nbPointsPerLine)
int m_intNumberSamplePerLine
int m_intNumberOfBlackLines
this is the total number of lines not part of the image and is used for vertical screen size ...
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool positiveOnly)=0
static MsgReportChannelSampleRateChanged * create(int sampleRate)
float m_fltRatioOfRowsToDisplay
void resizeTVScreen(int intCols, int intRows)
std::complex< float > cmplx
SampleVector m_scopeSampleBuffer
Interpolator m_interpolator
int m_DSBFilterBufferIndex
void setFrequencies(float samplingFrequency, float centerFrequency)
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 bool handleMessage(const Message &cmd)=0
Processing of a message. Returns true if message has actually been processed.
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
static const QString m_channelId
int m_intNumberSamplePerLineSignals
number of samples in the non image part of the line (signals)
void process(const std::vector< Real > &samples_in, std::vector< Real > &samples_out)
ATVDemod(DeviceAPI *deviceAPI)
static const int m_ssbFftLen
static bool match(const Message *message)
static float getRFBandwidthDivisor(ATVModulation modulation)
int getInputSampleRate() const
void setFreq(Real freq, Real sampleRate)
void removeChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Remove a channel sink (Rx)
ATVConfigPrivate m_configPrivate
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
int m_intNumberSaplesPerHSync
number of samples per horizontal synchronization pattern (pulse + back porch)
ThreadedBasebandSampleSink * m_threadedChannelizer
MessageQueue * getMessageQueueToGUI()
bool m_blndecimatorEnable
float m_fltRFOppBandwidth
ATVModulation m_enmModulation
TVScreen * m_registeredTVScreen
BasebandSampleSink * m_scopeSink
Classical amplitude modulation.
PhaseDiscriminators m_objPhaseDiscri
void addChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Add a channel sink (Rx)
void channelSampleRateChanged()
Complex * m_DSBFilterBuffer
bool m_interleaved
interleaved image
float m_fltVoltLevelSynchroTop
void setTVScreen(TVScreen *objScreen)
set by the GUI
SecondOrderRecursiveFilter m_bfoFilter
void create_asym_filter(float fopp, float fin)
two different filters for in band and opposite band
float m_fltVoltLevelSynchroBlack
float m_fltAmpLineAverage
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)
qint64 getFrequencyOffset() const
Real phaseDiscriminatorDelta(const Complex &sample, double &magsq, Real &fmDev)
Real m_interpolatorDistance
DownChannelizer * m_channelizer
AM with vestigial upper side band (main signal is in the lower side)
Classical frequency modulation with discriminator #1.
int runAsym(const cmplx &in, cmplx **out, bool usb)
Asymmetrical fitering can be used for vestigial sideband.