00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __TEMPLATEMATCHER_H__
00019 #define __TEMPLATEMATCHER_H__
00020
00021 extern "C" {
00022 #include "libavcodec/avcodec.h"
00023 }
00024 #include "FrameAnalyzer.h"
00025
00026 typedef struct AVPicture AVPicture;
00027 class PGMConverter;
00028 class EdgeDetector;
00029 class TemplateFinder;
00030
00031 class TemplateMatcher : public FrameAnalyzer
00032 {
00033 public:
00034
00035 TemplateMatcher(PGMConverter *pgmc, EdgeDetector *ed, TemplateFinder *tf,
00036 QString debugdir);
00037 ~TemplateMatcher(void);
00038
00039
00040 const char *name(void) const { return "TemplateMatcher"; }
00041 enum analyzeFrameResult MythPlayerInited(MythPlayer *player,
00042 long long nframes);
00043 enum analyzeFrameResult analyzeFrame(const VideoFrame *frame,
00044 long long frameno, long long *pNextFrame);
00045 int finished(long long nframes, bool final);
00046 int reportTime(void) const;
00047 FrameMap GetMap(unsigned int) const { return breakMap; }
00048
00049
00050 int templateCoverage(long long nframes, bool final) const;
00051 const FrameAnalyzer::FrameMap *getBreaks(void) const { return &breakMap; }
00052 int adjustForBlanks(const BlankFrameDetector *bf, long long nframes);
00053 int computeBreaks(FrameMap *breaks);
00054
00055 private:
00056 PGMConverter *pgmConverter;
00057 EdgeDetector *edgeDetector;
00058 TemplateFinder *templateFinder;
00059 const struct AVPicture *tmpl;
00060 int tmplrow, tmplcol;
00061 int tmplwidth, tmplheight;
00062
00063
00064 unsigned short *matches;
00065 unsigned char *match;
00066
00067 float fps;
00068 AVPicture cropped;
00069 FrameAnalyzer::FrameMap breakMap;
00070
00071
00072 int debugLevel;
00073 QString debugdir;
00074 QString debugdata;
00075 MythPlayer *player;
00076 bool debug_matches;
00077 bool debug_removerunts;
00078 bool matches_done;
00079 struct timeval analyze_time;
00080 };
00081
00082 #endif
00083
00084
00085