MythTV  master
SceneChangeDetector.h
Go to the documentation of this file.
1 /*
2  * SceneChangeDetector
3  *
4  * Detect scene changes based on histogram analysis.
5  */
6 
7 #ifndef __SCENECHANGEDETECTOR_H__
8 #define __SCENECHANGEDETECTOR_H__
9 
10 #include <QString>
11 
12 #include "FrameAnalyzer.h"
13 
14 typedef struct AVFrame AVFrame;
15 class HistogramAnalyzer;
16 
18 {
19 public:
20  SceneChangeDetector(HistogramAnalyzer *ha, const QString& debugdir);
21  virtual void deleteLater(void);
22 
23  /* FrameAnalyzer interface. */
24  const char *name(void) const override // FrameAnalyzer
25  { return "SceneChangeDetector"; }
27  long long nframes) override; // FrameAnalyzer
28  enum analyzeFrameResult analyzeFrame(const VideoFrame *frame,
29  long long frameno, long long *pNextFrame) override; // FrameAnalyzer
30  int finished(long long nframes, bool final) override; // FrameAnalyzer
31  int reportTime(void) const override; // FrameAnalyzer
32  FrameMap GetMap(unsigned int) const override // FrameAnalyzer
33  { return m_changeMap; }
34 
35  /* SceneChangeDetector interface. */
36  const FrameAnalyzer::FrameMap *getChanges(void) const { return &m_changeMap; }
37 
38  typedef struct scenechange_data {
39  unsigned char color;
40  unsigned char frequency;
41  } SceneChangeData[UCHAR_MAX + 1];
42 
43  protected:
44  virtual ~SceneChangeDetector(void) = default;
45 
46  private:
48  float m_fps {0.0F};
49 
50  /* per-frame info */
52  unsigned short *m_scdiff {nullptr};
53 
55 
56  /* Debugging */
57  int m_debugLevel {0};
58  QString m_debugdata; /* filename */
59  bool m_debug_scenechange {false};
60  bool m_scenechange_done {false};
61 };
62 
63 #endif /* !__SCENECHANGEDETECTOR_H__ */
64 
65 /* vim: set expandtab tabstop=4 shiftwidth=4: */
66 
SceneChangeDetector(HistogramAnalyzer *ha, const QString &debugdir)
HistogramAnalyzer * m_histogramAnalyzer
unsigned short * m_scdiff
virtual void deleteLater(void)
struct AVFrame AVFrame
int reportTime(void) const override
FrameMap GetMap(unsigned int) const override
enum analyzeFrameResult analyzeFrame(const VideoFrame *frame, long long frameno, long long *pNextFrame) override
enum analyzeFrameResult MythPlayerInited(MythPlayer *player, long long nframes) override
const char * name(void) const override
const FrameAnalyzer::FrameMap * getChanges(void) const
struct SceneChangeDetector::scenechange_data SceneChangeData[UCHAR_MAX+1]
SceneChangeData * m_scdata
int finished(long long nframes, bool final) override
FrameAnalyzer::FrameMap m_changeMap
QMap< long long, long long > FrameMap
Definition: FrameAnalyzer.h:44
virtual ~SceneChangeDetector(void)=default