SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
atvdemod.cpp
Go to the documentation of this file.
1 // Copyright (C) 2017 F4HKW //
3 // for F4EXB / SDRAngel //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #include <QTime>
20 #include <QDebug>
21 #include <stdio.h>
22 #include <complex.h>
23 
24 #include "audio/audiooutput.h"
25 #include "dsp/dspengine.h"
26 #include "dsp/downchannelizer.h"
28 #include "device/deviceapi.h"
29 
30 #include "atvdemod.h"
31 
37 
38 const QString ATVDemod::m_channelIdURI = "sdrangel.channel.demodatv";
39 const QString ATVDemod::m_channelId = "ATVDemod";
40 const int ATVDemod::m_ssbFftLen = 1024;
41 
43  ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
44  m_deviceAPI(deviceAPI),
45  m_scopeSink(0),
46  m_registeredTVScreen(0),
47  m_intNumberSamplePerTop(0),
48  m_intImageIndex(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),
57  m_fltAmpDelta(1.0),
58  m_intColIndex(0),
59  m_intSampleIndex(0),
60  m_intRowIndex(0),
61  m_intLineIndex(0),
62  m_objAvgColIndex(3),
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),
67  m_DSBFilter(0),
68  m_DSBFilterBuffer(0),
69  m_DSBFilterBufferIndex(0),
70  m_objSettingsMutex(QMutex::Recursive)
71 {
72  setObjectName(m_channelId);
73 
74  //*************** ATV PARAMETERS ***************
75  //m_intNumberSamplePerLine=0;
78  m_interleaved = true;
79 
80  m_DSBFilter = new fftfilt((2.0f * m_rfConfig.m_fltRFBandwidth) / 1000000, 2 * m_ssbFftLen); // arbitrary 1 MS/s sample rate
82  memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
83 
84  memset((void*)m_fltBufferI,0,6*sizeof(float));
85  memset((void*)m_fltBufferQ,0,6*sizeof(float));
86 
88 
89  applyStandard();
90 
91  m_channelizer = new DownChannelizer(this);
95 
96  connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
97 }
98 
100 {
103  delete m_threadedChannelizer;
104  delete m_channelizer;
105  delete m_DSBFilter;
106  delete m_DSBFilterBuffer;
107 }
108 
110 {
111  m_registeredTVScreen = objScreen;
112 }
113 
115  MessageQueue* objMessageQueue,
116  float fltLineDurationUs,
117  float fltTopDurationUs,
118  float fltFramePerS,
119  ATVStd enmATVStandard,
120  int intNumberOfLines,
121  float fltRatioOfRowsToDisplay,
122  float fltVoltLevelSynchroTop,
123  float fltVoltLevelSynchroBlack,
124  bool blnHSync,
125  bool blnVSync,
126  bool blnInvertVideo,
127  int intVideoTabIndex)
128 {
130  fltLineDurationUs,
131  fltTopDurationUs,
132  fltFramePerS,
133  enmATVStandard,
134  intNumberOfLines,
135  fltRatioOfRowsToDisplay,
136  fltVoltLevelSynchroTop,
137  fltVoltLevelSynchroBlack,
138  blnHSync,
139  blnVSync,
140  blnInvertVideo,
141  intVideoTabIndex);
142  objMessageQueue->push(msgCmd);
143 }
144 
146  MessageQueue* objMessageQueue,
147  int64_t frequencyOffset,
148  ATVModulation enmModulation,
149  float fltRFBandwidth,
150  float fltRFOppBandwidth,
151  bool blnFFTFiltering,
152  bool blnDecimatorEnable,
153  float fltBFOFrequency,
154  float fmDeviation)
155 {
157  frequencyOffset,
158  enmModulation,
159  fltRFBandwidth,
160  fltRFOppBandwidth,
161  blnFFTFiltering,
162  blnDecimatorEnable,
163  fltBFOFrequency,
164  fmDeviation);
165  objMessageQueue->push(msgCmd);
166 }
167 
168 void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
169 {
170  (void) firstOfBurst;
171  float fltI;
172  float fltQ;
173  Complex ci;
174 
175  //********** Let's rock and roll buddy ! **********
176 
177  m_objSettingsMutex.lock();
178 
179  //********** Accessing ATV Screen context **********
180 
181 #ifdef EXTENDED_DIRECT_SAMPLE
182 
183  qint16 * ptrBufferToRelease = 0;
184  qint16 * ptrBuffer;
185  qint32 intLen;
186 
187  //********** Reading direct samples **********
188 
189  SampleVector::const_iterator it = begin;
190  intLen = it->intLen;
191  ptrBuffer = it->ptrBuffer;
192  ptrBufferToRelease = ptrBuffer;
193  ++it;
194 
195  for(qint32 intInd=0; intInd<intLen-1; intInd +=2)
196  {
197 
198  fltI= ((qint32) (*ptrBuffer)) << 4;
199  ptrBuffer ++;
200  fltQ= ((qint32) (*ptrBuffer)) << 4;
201  ptrBuffer ++;
202 
203 #else
204 
205  for (SampleVector::const_iterator it = begin; it != end; ++it /* ++it **/)
206  {
207 
208  fltI = it->real();
209  fltQ = it->imag();
210 #endif
211  Complex c(fltI, fltQ);
212 
214  {
215  c *= m_nco.nextIQ();
216  }
217 
219  {
221  {
222  demod(ci);
224  }
225  }
226  else
227  {
228  demod(c);
229  }
230  }
231 
232  if ((m_running.m_intVideoTabIndex == 1) && (m_scopeSink != 0)) // do only if scope tab is selected and scope is available
233  {
234  m_scopeSink->feed(m_scopeSampleBuffer.begin(), m_scopeSampleBuffer.end(), false); // m_ssb = positive only
235  m_scopeSampleBuffer.clear();
236  }
237 
238 #ifdef EXTENDED_DIRECT_SAMPLE
239  if (ptrBufferToRelease != 0)
240  {
241  delete ptrBufferToRelease;
242  }
243 #endif
244 
245  m_objSettingsMutex.unlock();
246 }
247 
249 {
250  float fltDivSynchroBlack = 1.0f - m_running.m_fltVoltLevelSynchroBlack;
251  float fltNormI;
252  float fltNormQ;
253  float fltNorm;
254  float fltVal;
255  int intVal;
256 
257  //********** FFT filtering **********
258 
260  {
261  int n_out;
262  fftfilt::cmplx *filtered;
263 
264  n_out = m_DSBFilter->runAsym(c, &filtered, m_rfRunning.m_enmModulation != ATV_LSB); // all usb except explicitely lsb
265 
266  if (n_out > 0)
267  {
268  memcpy((void *) m_DSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
270  }
271 
273  }
274 
275  //********** demodulation **********
276 
277  const float& fltI = m_rfRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].real() : c.real();
278  const float& fltQ = m_rfRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].imag() : c.imag();
279  double magSq;
280 
282  {
283  //Amplitude FM
284  magSq = fltI*fltI + fltQ*fltQ;
285  m_objMagSqAverage(magSq);
286  fltNorm = sqrt(magSq);
287  fltNormI= fltI/fltNorm;
288  fltNormQ= fltQ/fltNorm;
289 
290  //-2 > 2 : 0 -> 1 volt
291  //0->0.3 synchro 0.3->1 image
292 
294  {
295  //YDiff Cd
296  fltVal = m_fltBufferI[0]*(fltNormQ - m_fltBufferQ[1]);
297  fltVal -= m_fltBufferQ[0]*(fltNormI - m_fltBufferI[1]);
298 
299  fltVal += 2.0f;
300  fltVal /= 4.0f;
301 
302  }
303  else
304  {
305  //YDiff Folded
306  fltVal = m_fltBufferI[2]*((m_fltBufferQ[5]-fltNormQ)/16.0f + m_fltBufferQ[1] - m_fltBufferQ[3]);
307  fltVal -= m_fltBufferQ[2]*((m_fltBufferI[5]-fltNormI)/16.0f + m_fltBufferI[1] - m_fltBufferI[3]);
308 
309  fltVal += 2.125f;
310  fltVal /= 4.25f;
311 
314 
317 
320 
323  }
324 
327 
328  m_fltBufferI[0]=fltNormI;
329  m_fltBufferQ[0]=fltNormQ;
330 
331  if (m_rfRunning.m_fmDeviation != 1.0f)
332  {
333  fltVal = ((fltVal - 0.5f) / m_rfRunning.m_fmDeviation) + 0.5f;
334  }
335  }
336  else if (m_rfRunning.m_enmModulation == ATV_AM)
337  {
338  //Amplitude AM
339  magSq = fltI*fltI + fltQ*fltQ;
340  m_objMagSqAverage(magSq);
341  fltNorm = sqrt(magSq);
342  fltVal = fltNorm / SDR_RX_SCALEF;
343 
344  //********** Mini and Maxi Amplitude tracking **********
345 
346  if(fltVal<m_fltEffMin)
347  {
348  m_fltEffMin=fltVal;
349  }
350 
351  if(fltVal>m_fltEffMax)
352  {
353  m_fltEffMax=fltVal;
354  }
355 
356  //Normalisation
357  fltVal -= m_fltAmpMin;
358  fltVal /=m_fltAmpDelta;
359  }
361  {
362  magSq = fltI*fltI + fltQ*fltQ;
363  m_objMagSqAverage(magSq);
364  fltNorm = sqrt(magSq);
365 
366  Real bfoValues[2];
367  float fltFiltered = m_bfoFilter.run(fltI);
368  m_bfoPLL.process(fltFiltered, bfoValues);
369 
370  // do the mix
371 
372  float mixI = fltI * bfoValues[0] - fltQ * bfoValues[1];
373  float mixQ = fltI * bfoValues[1] + fltQ * bfoValues[0];
374 
376  fltVal = (mixI + mixQ);
377  } else {
378  fltVal = (mixI - mixQ);
379  }
380 
381  //********** Mini and Maxi Amplitude tracking **********
382 
383  if(fltVal<m_fltEffMin)
384  {
385  m_fltEffMin=fltVal;
386  }
387 
388  if(fltVal>m_fltEffMax)
389  {
390  m_fltEffMax=fltVal;
391  }
392 
393  //Normalisation
394  fltVal -= m_fltAmpMin;
395  fltVal /=m_fltAmpDelta;
396  }
397  else if (m_rfRunning.m_enmModulation == ATV_FM3)
398  {
399  float rawDeviation;
400  fltVal = m_objPhaseDiscri.phaseDiscriminatorDelta(c, magSq, rawDeviation) + 0.5f;
401  //fltVal = fltVal < 0.0f ? 0.0f : fltVal > 1.0f ? 1.0f : fltVal;
402  m_objMagSqAverage(magSq);
403  fltNorm = sqrt(magSq);
404  }
405  else
406  {
407  magSq = fltI*fltI + fltQ*fltQ;
408  m_objMagSqAverage(magSq);
409  fltNorm = sqrt(magSq);
410  fltVal = 0.0f;
411  }
412 
413  fltVal = m_running.m_blnInvertVideo ? 1.0f - fltVal : fltVal;
414  fltVal = (fltVal < -1.0f) ? -1.0f : (fltVal > 1.0f) ? 1.0f : fltVal;
415 
416  if ((m_running.m_intVideoTabIndex == 1) && (m_scopeSink != 0)) { // feed scope buffer only if scope is present and visible
417  m_scopeSampleBuffer.push_back(Sample(fltVal*SDR_RX_SCALEF, 0.0f));
418  }
419 
420  m_fltAmpLineAverage += fltVal;
421 
422  //********** gray level **********
423  //-0.3 -> 0.7
424  intVal = (int) 255.0*(fltVal - m_running.m_fltVoltLevelSynchroBlack) / fltDivSynchroBlack;
425 
426  //0 -> 255
427  if(intVal<0)
428  {
429  intVal=0;
430  }
431  else if(intVal>255)
432  {
433  intVal=255;
434  }
435 
436  //********** process video sample **********
437 
438  if (m_registeredTVScreen) // can process only if the screen is available (set via the GUI)
439  {
441  processHSkip(fltVal, intVal);
442  } else {
443  processClassic(fltVal, intVal);
444  }
445  }
446 }
447 
449 {
450  //m_objTimer.start();
451 }
452 
454 {
455 }
456 
458 {
459  qDebug() << "ATVDemod::handleMessage";
460 
462  {
466 
467  qDebug() << "ATVDemod::handleMessage: MsgChannelizerNotification:"
468  << " m_intSampleRate: " << m_config.m_intSampleRate
469  << " m_intFrequencyOffset: " << m_rfConfig.m_intFrequencyOffset;
470 
471  applySettings();
472 
473  return true;
474  }
475  else if (MsgConfigureChannelizer::match(cmd))
476  {
478 
481  cfg.getCenterFrequency());
482 
483  qDebug() << "ATVDemod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getInputSampleRate()
484  << " centerFrequency: " << cfg.getCenterFrequency();
485 
486  return true;
487  }
488  else if (MsgConfigureATVDemod::match(cmd))
489  {
491 
492  m_config = objCfg.m_objMsgConfig;
493 
494  qDebug() << "ATVDemod::handleMessage: MsgConfigureATVDemod:"
495  << " m_fltVoltLevelSynchroBlack:" << m_config.m_fltVoltLevelSynchroBlack
496  << " m_fltVoltLevelSynchroTop:" << m_config.m_fltVoltLevelSynchroTop
497  << " m_fltFramePerS:" << m_config.m_fltFramePerS
498  << " m_fltLineDurationUs:" << m_config.m_fltLineDuration
499  << " m_fltRatioOfRowsToDisplay:" << m_config.m_fltRatioOfRowsToDisplay
500  << " m_fltTopDurationUs:" << m_config.m_fltTopDuration
501  << " m_blnHSync:" << m_config.m_blnHSync
502  << " m_blnVSync:" << m_config.m_blnVSync;
503 
504  applySettings();
505 
506  return true;
507  }
508  else if (MsgConfigureRFATVDemod::match(cmd))
509  {
511 
512  m_rfConfig = objCfg.m_objMsgConfig;
513 
514  qDebug() << "ATVDemod::handleMessage: MsgConfigureRFATVDemod:"
515  << " m_intFrequencyOffset:" << m_rfConfig.m_intFrequencyOffset
516  << " m_enmModulation:" << m_rfConfig.m_enmModulation
517  << " m_fltRFBandwidth:" << m_rfConfig.m_fltRFBandwidth
518  << " m_fltRFOppBandwidth:" << m_rfConfig.m_fltRFOppBandwidth
519  << " m_blnFFTFiltering:" << m_rfConfig.m_blnFFTFiltering
520  << " m_blnDecimatorEnable:" << m_rfConfig.m_blndecimatorEnable
521  << " m_fltBFOFrequency:" << m_rfConfig.m_fltBFOFrequency
522  << " m_fmDeviation:" << m_rfConfig.m_fmDeviation;
523 
524  applySettings();
525 
526  return true;
527  }
528  else
529  {
530  if (m_scopeSink != 0)
531  {
532  return m_scopeSink->handleMessage(cmd);
533  }
534  else
535  {
536  return false;
537  }
538  }
539 }
540 
542 {
543 
544  if (m_config.m_intSampleRate == 0)
545  {
546  return;
547  }
548 
549  bool forwardSampleRateChange = false;
550 
554  {
556  }
557 
562  {
563  m_objSettingsMutex.lock();
564 
565  int linesPerSecond = m_config.m_intNumberOfLines * m_config.m_fltFramePerS;
566 
567  int maxPoints = m_config.m_intSampleRate / linesPerSecond;
568  int i = maxPoints;
569 
570  for (; i > 0; i--)
571  {
572  if ((i * linesPerSecond) % 10 == 0)
573  break;
574  }
575 
576  int nbPointsPerRateUnit = i == 0 ? maxPoints : i;
577  m_configPrivate.m_intTVSampleRate = nbPointsPerRateUnit * linesPerSecond;
578 
580  {
582  }
583  else
584  {
586  m_interpolatorDistance = 1.0f;
587  }
588 
593  3.0);
594  m_objSettingsMutex.unlock();
595  }
596 
604  {
605  m_objSettingsMutex.lock();
606 
608 
609  applyStandard();
610 
613 
615  {
616  //m_registeredTVScreen->setRenderImmediate(!(m_config.m_fltFramePerS > 25.0f));
620  }
621 
622  qDebug() << "ATVDemod::applySettings:"
623  << " m_fltLineDuration: " << m_config.m_fltLineDuration
624  << " m_fltFramePerS: " << m_config.m_fltFramePerS
625  << " m_intNumberOfLines: " << m_intNumberOfLines
626  << " m_intNumberSamplePerLine: " << m_configPrivate.m_intNumberSamplePerLine
627  << " m_intNumberOfBlackLines: " << m_intNumberOfBlackLines;
628 
629  m_intImageIndex = 0;
630  m_intColIndex=0;
631  m_intRowIndex=0;
632 
633  m_objSettingsMutex.unlock();
634  }
635 
640  {
641  forwardSampleRateChange = true;
642  }
643 
647  {
648  m_objSettingsMutex.lock();
651  memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
653  m_objSettingsMutex.unlock();
654  }
655 
658  {
661  0.01);
663  }
664 
666  {
668  }
669 
673 
674  if (forwardSampleRateChange && getMessageQueueToGUI())
675  {
679  getMessageQueueToGUI()->push(report);
680  }
681 }
682 
684 {
685  switch(m_config.m_enmATVStandard)
686  {
687  case ATVStdHSkip:
688  // what is left in a line for the image
691  m_intNumberOfEqLines = 0; // not applicable
692  m_interleaved = false;
693  break;
694  case ATVStdShort:
695  // what is left in a line for the image
699  m_interleaved = false;
700  break;
702  // what is left in a line for the image
706  m_interleaved = true;
707  break;
708  case ATVStd405: // Follows loosely the 405 lines standard
709  // what is left in a ine for the image
710  m_intNumberOfSyncLines = 24; // (15+7)*2 - 20
711  m_intNumberOfBlackLines = 28; // above + 4
713  m_interleaved = true;
714  break;
715  case ATVStdPAL525: // Follows PAL-M standard
716  // what is left in a 64/1.008 us line for the image
717  m_intNumberOfSyncLines = 40; // (15+15)*2 - 20
718  m_intNumberOfBlackLines = 44; // above + 4
720  m_interleaved = true;
721  break;
722  case ATVStdPAL625: // Follows PAL-B/G/H standard
723  default:
724  // what is left in a 64 us line for the image
725  m_intNumberOfSyncLines = 44; // (15+17)*2 - 20
726  m_intNumberOfBlackLines = 48; // above + 4
728  m_interleaved = true;
729  }
730 
731  // for now all standards apply this
732  m_intNumberSamplePerLineSignals = (int) ((12.0f/64.0f)*m_config.m_fltLineDuration * m_config.m_intSampleRate); // 12.0 = 7.3 + 4.7
733  m_intNumberSaplesPerHSync = (int) ((9.6f/64.0f)*m_config.m_fltLineDuration * m_config.m_intSampleRate); // 9.4 = 4.7 + 4.7
734 }
735 
737 {
738  return m_running.m_intSampleRate;
739 }
740 
742 {
744 }
745 
747 {
749  {
750  return m_bfoPLL.locked();
751  }
752  else
753  {
754  return false;
755  }
756 }
757 
759 {
760  switch(modulation)
761  {
762  case ATV_USB:
763  case ATV_LSB:
764  return 1.05f;
765  break;
766  case ATV_FM1:
767  case ATV_FM2:
768  case ATV_AM:
769  default:
770  return 2.2f;
771  }
772 }
773 
775 {
776  qDebug("ATVDemod::channelSampleRateChanged");
777  if (getMessageQueueToGUI())
778  {
780  getMessageQueueToGUI()->push(msg);
781  }
782 }
783 
bool locked() const
Definition: phaselock.h:80
virtual void stop()
Definition: atvdemod.cpp:453
ATVConfigPrivate m_runningPrivate
Definition: atvdemod.h:500
void processClassic(float &fltVal, int &intVal)
Definition: atvdemod.h:591
AM with vestigial lower side band (main signal is in the upper side)
Definition: atvdemod.h:68
Classical frequency modulation with discriminator #2.
Definition: atvdemod.h:65
Complex nextIQ()
Return next complex sample.
Definition: nco.cpp:61
void demod(Complex &c)
Definition: atvdemod.cpp:248
bool decimate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:38
void configure(MessageQueue *messageQueue, int sampleRate, int centerFrequency)
ATVRFConfig m_rfRunning
Definition: atvdemod.h:497
void push(Message *message, bool emitSignal=true)
Push message onto queue.
ATVStd m_enmATVStandard
Definition: atvdemod.h:76
int64_t m_intFrequencyOffset
Definition: atvdemod.h:109
void removeChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:163
void addChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:156
MovingAverageUtil< double, double, 32 > m_objMagSqAverage
Definition: atvdemod.h:472
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)
Definition: phasediscri.h:42
static const QString m_channelIdURI
Definition: atvdemod.h:252
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)
Definition: atvdemod.cpp:114
void configureRF(MessageQueue *objMessageQueue, int64_t frequencyOffset, ATVModulation enmModulation, float fltRFBandwidth, float fltRFOppBandwidth, bool blnFFTFiltering, bool blndecimatorEnable, float fltBFOFrequency, float fmDeviation)
Definition: atvdemod.cpp:145
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool po)
Definition: atvdemod.cpp:168
int m_intNumberSamplePerTop
Definition: atvdemod.h:431
float m_fltAmpDelta
Definition: atvdemod.h:455
void configure(Real freq, Real bandwidth, Real minsignal)
Definition: phaselock.cpp:87
int getEffectiveSampleRate()
Definition: atvdemod.cpp:741
int m_intNumberOfEqLines
number of equalizing lines both whole and partial
Definition: atvdemod.h:435
static MsgReportEffectiveSampleRate * create(int sampleRate, int nbPointsPerLine)
Definition: atvdemod.h:159
ATVModulation
Definition: atvdemod.h:63
bool getBFOLocked()
Definition: atvdemod.cpp:746
int m_intNumberOfBlackLines
this is the total number of lines not part of the image and is used for vertical screen size ...
Definition: atvdemod.h:434
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool positiveOnly)=0
float m_fltBufferI[6]
Definition: atvdemod.h:457
static MsgReportChannelSampleRateChanged * create(int sampleRate)
Definition: atvdemod.h:181
float m_fltRatioOfRowsToDisplay
Definition: atvdemod.h:81
__int64 int64_t
Definition: rtptypes_win.h:47
void resizeTVScreen(int intCols, int intRows)
Definition: tvscreen.cpp:86
std::complex< float > cmplx
Definition: fftfilt.h:21
SampleVector m_scopeSampleBuffer
Definition: atvdemod.h:425
Interpolator m_interpolator
Definition: atvdemod.h:479
float m_fltTopDuration
Definition: atvdemod.h:79
int m_DSBFilterBufferIndex
Definition: atvdemod.h:486
void setFrequencies(float samplingFrequency, float centerFrequency)
#define SDR_RX_SCALEF
Definition: dsptypes.h:33
Classical frequency modulation with phase derivative discriminator.
Definition: atvdemod.h:66
virtual bool handleMessage(const Message &cmd)
Processing of a message. Returns true if message has actually been processed.
Definition: atvdemod.cpp:457
QMutex m_objSettingsMutex
Definition: atvdemod.h:503
float m_fltFramePerS
Definition: atvdemod.h:80
int getSampleRate()
Definition: atvdemod.cpp:736
~ATVDemod()
Definition: atvdemod.cpp:99
virtual bool handleMessage(const Message &cmd)=0
Processing of a message. Returns true if message has actually been processed.
ATVConfig m_running
Definition: atvdemod.h:494
float m_fltBufferQ[6]
Definition: atvdemod.h:458
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
Definition: message.h:52
virtual void start()
Definition: atvdemod.cpp:448
NCO m_nco
Definition: atvdemod.h:474
static MsgConfigureATVDemod * create(float fltLineDurationUs, float fltTopDurationUs, float fltFramePerS, ATVStd enmATVStandard, int intNumberOfLines, float fltRatioOfRowsToDisplay, float fltVoltLevelSynchroTop, float fltVoltLevelSynchroBlack, bool blnHSync, bool blnVSync, bool blnInvertVideo, int intVideoTabIndex)
Definition: atvdemod.h:275
static const QString m_channelId
Definition: atvdemod.h:253
int m_intNumberSamplePerLineSignals
number of samples in the non image part of the line (signals)
Definition: atvdemod.h:436
void process(const std::vector< Real > &samples_in, std::vector< Real > &samples_out)
Definition: phaselock.cpp:148
ATVDemod(DeviceAPI *deviceAPI)
Definition: atvdemod.cpp:42
int32_t i
Definition: decimators.h:244
int m_intImageIndex
Definition: atvdemod.h:442
void applyStandard()
Definition: atvdemod.cpp:683
static const int m_ssbFftLen
Definition: atvdemod.h:487
void applySettings()
Definition: atvdemod.cpp:541
static bool match(const Message *message)
Definition: message.cpp:45
static float getRFBandwidthDivisor(ATVModulation modulation)
Definition: atvdemod.cpp:758
int getInputSampleRate() const
void setFreq(Real freq, Real sampleRate)
Definition: nco.cpp:49
ATVRFConfig m_rfConfig
Definition: atvdemod.h:498
void removeChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Remove a channel sink (Rx)
Definition: deviceapi.cpp:127
ATVConfigPrivate m_configPrivate
Definition: atvdemod.h:501
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2283
int m_intNumberSaplesPerHSync
number of samples per horizontal synchronization pattern (pulse + back porch)
Definition: atvdemod.h:437
ThreadedBasebandSampleSink * m_threadedChannelizer
Definition: atvdemod.h:419
SimplePhaseLock m_bfoPLL
Definition: atvdemod.h:475
MessageQueue * getMessageQueueToGUI()
ATVConfig m_config
Definition: atvdemod.h:495
ATVModulation m_enmModulation
Definition: atvdemod.h:110
TVScreen * m_registeredTVScreen
Definition: atvdemod.h:428
BasebandSampleSink * m_scopeSink
Definition: atvdemod.h:424
int m_intRowIndex
Definition: atvdemod.h:462
Classical amplitude modulation.
Definition: atvdemod.h:67
PhaseDiscriminators m_objPhaseDiscri
Definition: atvdemod.h:490
void addChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Add a channel sink (Rx)
Definition: deviceapi.cpp:118
int m_intSynchroPoints
Definition: atvdemod.h:443
float m_fltLineDuration
Definition: atvdemod.h:78
void channelSampleRateChanged()
Definition: atvdemod.cpp:774
Complex * m_DSBFilterBuffer
Definition: atvdemod.h:485
float m_fltEffMax
Definition: atvdemod.h:451
bool m_interleaved
interleaved image
Definition: atvdemod.h:438
float m_fltVoltLevelSynchroTop
Definition: atvdemod.h:82
int m_intColIndex
Definition: atvdemod.h:460
void setTVScreen(TVScreen *objScreen)
set by the GUI
Definition: atvdemod.cpp:109
float m_fltAmpMin
Definition: atvdemod.h:453
SecondOrderRecursiveFilter m_bfoFilter
Definition: atvdemod.h:476
void create_asym_filter(float fopp, float fin)
two different filters for in band and opposite band
Definition: fftfilt.cpp:174
float m_fltVoltLevelSynchroBlack
Definition: atvdemod.h:83
float m_fltAmpLineAverage
Definition: atvdemod.h:448
Real m_interpolatorDistanceRemain
Definition: atvdemod.h:481
static MsgConfigureRFATVDemod * create(int64_t frequencyOffset, ATVModulation enmModulation, float fltRFBandwidth, float fltRFOppBandwidth, bool blnFFTFiltering, bool blndecimatorEnable, int intBFOFrequency, float fmDeviation)
Definition: atvdemod.h:342
int m_intNumberOfLines
Definition: atvdemod.h:432
fftfilt * m_DSBFilter
Definition: atvdemod.h:484
std::complex< Real > Complex
Definition: dsptypes.h:43
int m_intNumberOfSyncLines
this is the number of non displayable lines at the start of a frame. First displayable row comes next...
Definition: atvdemod.h:433
void processHSkip(float &fltVal, int &intVal)
Definition: atvdemod.h:510
Real phaseDiscriminatorDelta(const Complex &sample, double &magsq, Real &fmDev)
Definition: phasediscri.h:62
float Real
Definition: dsptypes.h:42
Real m_interpolatorDistance
Definition: atvdemod.h:480
DeviceAPI * m_deviceAPI
Definition: atvdemod.h:418
DownChannelizer * m_channelizer
Definition: atvdemod.h:420
float m_fltEffMin
Definition: atvdemod.h:450
AM with vestigial upper side band (main signal is in the lower side)
Definition: atvdemod.h:69
Classical frequency modulation with discriminator #1.
Definition: atvdemod.h:64
int runAsym(const cmplx &in, cmplx **out, bool usb)
Asymmetrical fitering can be used for vestigial sideband.
Definition: fftfilt.cpp:360