MythTV  master
BorderDetector.h
Go to the documentation of this file.
1 /*
2  * BorderDetector
3  *
4  * Attempt to infer content boundaries of an image by looking for rows and
5  * columns of pixels whose values fall within some narrow range.
6  *
7  * Handle letterboxing, pillarboxing, and combinations of the two. Handle cases
8  * where letterboxing embedded inside of pillarboxing (or vice versa) uses a
9  * different filler color.
10  */
11 
12 #ifndef BORDERDETECTOR_H
13 #define BORDERDETECTOR_H
14 
15 using AVFrame = struct AVFrame;
16 class MythPlayer;
17 class TemplateFinder;
18 
20 {
21 public:
22  /* Ctor/dtor. */
23  BorderDetector(void);
24 
25  int MythPlayerInited(const MythPlayer *player);
26  void setLogoState(TemplateFinder *finder);
27 
28  static const long long kUncached = -1;
29  int getDimensions(const AVFrame *pgm, int pgmheight, long long frameno,
30  int *prow, int *pcol, int *pwidth, int *pheight);
31 
32  int reportTime(void);
33 
34 private:
36  const struct AVFrame *m_logo {nullptr};
37  int m_logoRow {-1};
38  int m_logoCol {-1};
39  int m_logoWidth {-1};
40  int m_logoHeight {-1};
41 
42  long long m_frameNo {-1}; /* frame number */
43  int m_row {-1}; /* content location */
44  int m_col {-1}; /* content location */
45  int m_width {-1}; /* content dimensions */
46  int m_height {-1}; /* content dimensions */
47  bool m_isMonochromatic {false};
48 
49  /* Debugging. */
50  int m_debugLevel {0};
51  std::chrono::microseconds m_analyzeTime {0us};
52  bool m_timeReported {false};
53 };
54 
55 #endif /* !BORDERDETECTOR_H */
56 
57 /* vim: set expandtab tabstop=4 shiftwidth=4: */
BorderDetector::m_row
int m_row
Definition: BorderDetector.h:43
BorderDetector::getDimensions
int getDimensions(const AVFrame *pgm, int pgmheight, long long frameno, int *prow, int *pcol, int *pwidth, int *pheight)
Definition: BorderDetector.cpp:57
BorderDetector::m_logoRow
int m_logoRow
Definition: BorderDetector.h:37
BorderDetector::m_analyzeTime
std::chrono::microseconds m_analyzeTime
Definition: BorderDetector.h:51
BorderDetector
Definition: BorderDetector.h:19
BorderDetector::m_isMonochromatic
bool m_isMonochromatic
Definition: BorderDetector.h:47
MythPlayer
Definition: mythplayer.h:83
BorderDetector::m_logo
const struct AVFrame * m_logo
Definition: BorderDetector.h:36
BorderDetector::m_logoCol
int m_logoCol
Definition: BorderDetector.h:38
BorderDetector::m_col
int m_col
Definition: BorderDetector.h:44
BorderDetector::m_logoFinder
TemplateFinder * m_logoFinder
Definition: BorderDetector.h:35
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
TemplateFinder
Definition: TemplateFinder.h:30
BorderDetector::m_width
int m_width
Definition: BorderDetector.h:45
BorderDetector::MythPlayerInited
int MythPlayerInited(const MythPlayer *player)
Definition: BorderDetector.cpp:34
BorderDetector::m_debugLevel
int m_debugLevel
Definition: BorderDetector.h:50
BorderDetector::m_frameNo
long long m_frameNo
Definition: BorderDetector.h:42
BorderDetector::m_height
int m_height
Definition: BorderDetector.h:46
BorderDetector::m_logoHeight
int m_logoHeight
Definition: BorderDetector.h:40
BorderDetector::setLogoState
void setLogoState(TemplateFinder *finder)
Definition: BorderDetector.cpp:42
BorderDetector::m_logoWidth
int m_logoWidth
Definition: BorderDetector.h:39
BorderDetector::BorderDetector
BorderDetector(void)
Definition: BorderDetector.cpp:24
BorderDetector::m_timeReported
bool m_timeReported
Definition: BorderDetector.h:52
BorderDetector::kUncached
static const long long kUncached
Definition: BorderDetector.h:28
BorderDetector::reportTime
int reportTime(void)
Definition: BorderDetector.cpp:371