00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __TEMPLATEFINDER_H__
00019 #define __TEMPLATEFINDER_H__
00020
00021 extern "C" {
00022 #include "avcodec.h"
00023 }
00024 #include "FrameAnalyzer.h"
00025
00026 class PGMConverter;
00027 class BorderDetector;
00028 class EdgeDetector;
00029
00030 class TemplateFinder : public FrameAnalyzer
00031 {
00032 public:
00033
00034 TemplateFinder(PGMConverter *pgmc, BorderDetector *bd, EdgeDetector *ed,
00035 NuppelVideoPlayer *nvp, int proglen, QString debugdir);
00036 ~TemplateFinder(void);
00037
00038
00039 const char *name(void) const { return "TemplateFinder"; }
00040 enum analyzeFrameResult nuppelVideoPlayerInited(NuppelVideoPlayer *nvp,
00041 long long nframes);
00042 enum analyzeFrameResult analyzeFrame(const VideoFrame *frame,
00043 long long frameno, long long *pNextFrame);
00044 int finished(long long nframes, bool final);
00045 int reportTime(void) const;
00046
00047
00048 const struct AVPicture *getTemplate(int *prow, int *pcol,
00049 int *pwidth, int *pheight) const;
00050
00051 private:
00052 int resetBuffers(int newcwidth, int newcheight);
00053
00054 PGMConverter *pgmConverter;
00055 BorderDetector *borderDetector;
00056 EdgeDetector *edgeDetector;
00057
00058 unsigned int sampleTime;
00059 unsigned int sampleSpacing;
00060 int frameInterval;
00061 long long endFrame;
00062 long long nextFrame;
00063
00064 int width, height;
00065 unsigned int *scores;
00066
00067 int mincontentrow;
00068 int mincontentcol;
00069 int maxcontentrow1;
00070 int maxcontentcol1;
00071
00072 AVPicture tmpl;
00073 int tmplrow, tmplcol;
00074 int tmplwidth, tmplheight;
00075
00076 AVPicture cropped;
00077 int cwidth, cheight;
00078
00079
00080 int debugLevel;
00081 QString debugdir;
00082 QString debugdata;
00083 QString debugtmpl;
00084 bool debug_template;
00085 bool debug_edgecounts;
00086 bool debug_frames;
00087 bool tmpl_valid;
00088 bool tmpl_done;
00089 struct timeval analyze_time;
00090 };
00091
00092 #endif
00093
00094