1 #ifndef SSTVRX_H
2 #define SSTVRX_H
3 
4 #include <QObject>
5 #include "appdefs.h"
6 #include "buffermanag.h"
7 #include "syncprocessor.h"
8 
9 
10 
11 extern int minCompletion;
12 
13 
14 
15 class modeBase;
16 
17 class syncFilter;
18 class videoFilter;
19 class rectConvolution;
20 class integrator;
21 
22 class sstvRx : public QObject
23 {
24 
25   Q_OBJECT
26 public:
27   enum eSSTVState {HUNTING,PROCESSING,WAITFORSYNC,SLANTADJUST,RESTART,SYNCLOST,WAIT,END};
28   explicit sstvRx(QObject *parent = 0);
29   ~sstvRx();
30   void init();
31   void setFilters();
32   void run(DSPFLOAT *dataPtr, DSPFLOAT *volumePtr);
33   void eraseImage();
34   syncProcessor syncNarrowProc;
35   syncProcessor   syncWideProc;
isBusy()36   bool isBusy()
37   {
38     return((SSTVState!=HUNTING) && (SSTVState!=END));
39   }
40 #ifndef QT_NO_DEBUG
41   unsigned int setOffset(unsigned int offset,bool ask);
42 #endif
43 
44 signals:
45   void resetCall();
46 private:
47   //  void getData();
48   void process();
49   void switchState(eSSTVState  newState);
50   void resetParams(bool bufferReset);
51   void saveImage();
52   void advanceBuffers();
53   void rewindBuffers(uint rlen);
54 
55 
56   //  DSPFLOAT rxHoldingBuffer[RXSTRIPE];
57   buffer<quint16,22> bufferVideoDemod;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
58   //  buffer<quint16,22> bufferSyncDemod;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
59   buffer<DSPFLOAT,22> bufferSync1200Vol;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
60   buffer<DSPFLOAT,22> bufferSync1900Vol;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
61   buffer<DSPFLOAT,22> bufferTest;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
62   buffer<DSPFLOAT,22> bufferInputVol;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
63 //  buffer<unsigned int,22> bufferInputVol;  // 2^22= 4194304, divided by samplingrate 12000 gives 349 seconds buffering
64   //  buffer<quint16,22> bufferInputVolume;
65 
66   syncFilter *syncFilterPtr;
67   videoFilter *videoFilterPtr;
68   DSPFLOAT tempBuffer[RXSTRIPE];
69   rectConvolution *syncConvolvePtr;
70   integrator *volumeIntergratorPtr;
71   eSSTVState SSTVState;
72   unsigned int bufferCounter;
73   QString lastUsedModeStr;
74   unsigned int bufferIdx;
75   unsigned int currentIdx;
76   bool usingWide;
77   syncProcessor *syncProcPtr;
78   DSPFLOAT agcVolume;
79 };
80 
81 #endif // SSTVRX_H
82