1 #include "ADM_default.h" 2 #include "ADM_coreVideoFilter.h" 3 #include "ADM_videoFilterCache.h" 4 #include "DIA_factory.h" 5 6 #include "dec.h" 7 8 #define PROGRESSIVE 0x00000001 9 #define MAGIC_NUMBER (0xdeadbeef) 10 #define IN_PATTERN 0x00000002 11 12 #define MAX_CYCLE_SIZE 25 13 #define MAX_BLOCKS 50 14 15 #define BLKSIZE 32 16 17 #define DrawString drawString 18 19 #define GETFRAME(g, fp) \ 20 { \ 21 int GETFRAMEf=g; \ 22 if (GETFRAMEf < 0) GETFRAMEf = 0; \ 23 (fp) = vidCache->getImage(GETFRAMEf); \ 24 } 25 #if 1 26 #define aprintf(...) {} 27 #else 28 #define aprintf ADM_info 29 #endif 30 #define OutputDebugString aprintf 31 32 /** 33 \class Telecide 34 35 */ 36 class Decimate:public ADM_coreVideoFilterCached 37 { 38 protected: 39 deciMate configuration; 40 protected: 41 int last_request, last_result; 42 bool last_forced; 43 double last_metric; 44 double metrics[MAX_CYCLE_SIZE]; 45 double showmetrics[MAX_CYCLE_SIZE]; 46 int Dprev[MAX_CYCLE_SIZE]; 47 int Dcurr[MAX_CYCLE_SIZE]; 48 int Dnext[MAX_CYCLE_SIZE]; 49 int Dshow[MAX_CYCLE_SIZE]; 50 unsigned int hints[MAX_CYCLE_SIZE]; 51 bool hints_invalid; 52 bool all_video_cycle; 53 bool firsttime; 54 int xblocks, yblocks; 55 unsigned int *sum, div; 56 57 58 public: 59 Decimate(ADM_coreVideoFilter *previous,CONFcouple *conf); 60 ~Decimate(); 61 bool goToTime(uint64_t usSeek); 62 virtual const char *getConfiguration(void); /// Return current configuration as a human readable string 63 virtual bool getNextFrame(uint32_t *fn,ADMImage *image); /// Return the next image 64 virtual bool getCoupledConf(CONFcouple **couples) ; /// Return the current filter configuration 65 virtual void setCoupledConf(CONFcouple *couples); 66 virtual bool configure(void) ; /// Start graphical user interface 67 68 protected: 69 void DrawShow(ADMImage *src, int useframe, bool forced, int dropframe, 70 double metric, int inframe ); 71 void FindDuplicate(int frame, int *chosen, double *metric, bool *forced ); 72 void FindDuplicate2(int frame, int *chosen, bool *forced ); 73 void updateInfo(void); 74 uint32_t computeDiff(ADMImage *current,ADMImage *previous); 75 void reset(void); 76 bool get0(uint32_t *fn,ADMImage *data); 77 bool get1(uint32_t *fn,ADMImage *data); 78 bool get2(uint32_t *fn,ADMImage *data); 79 bool get3(uint32_t *fn,ADMImage *data); 80 }; 81