29 int freqdiff = sc2->frequency - sc1->frequency;
30 return freqdiff ? freqdiff : sc1->color - sc2->color;
37 unsigned int ncolors = hh->size();
39 for (
unsigned int ii = 0; ii < ncolors; ii++)
41 (*scdata)[ii].color = ii;
42 (*scdata)[ii].frequency = (*hh)[ii];
57 for (
size_t ii = 0; ii <
sizeof(*sc1)/
sizeof((*sc1)[0]); ii++)
58 diff += abs((*sc1)[ii].frequency - (*sc2)[ii].frequency) +
59 abs((*sc1)[ii].color - (*sc2)[ii].color);
66 QByteArray fname =
filename.toLocal8Bit();
67 FILE *fp = fopen(fname.constData(),
"w");
70 for (
auto value : scdiff)
71 (void)fprintf(fp,
"%5u\n", value);
73 LOG(VB_COMMFLAG, LOG_ERR, QString(
"Error closing %1: %2")
80 const std::vector<uint16_t>& scdiff,
uint16_t mindiff)
86 for (
size_t frameno = 0; frameno < scdiff.size(); frameno++)
88 if (scdiff[frameno] > mindiff)
89 changeMap->insert(frameno, 0);
96 const QString& debugdir)
98 ,
m_debugData(debugdir +
"/SceneChangeDetector.txt")
100 LOG(VB_COMMFLAG, LOG_INFO,
"SceneChangeDetector");
112 QString(
"SceneChangeDetector debugLevel %1").arg(
m_debugLevel));
132 LOG(VB_COMMFLAG, LOG_INFO,
133 QString(
"SceneChangeDetector::MythPlayerInited %1x%2")
134 .arg(video_disp_dim.width())
135 .arg(video_disp_dim.height()));
142 long long *pNextFrame)
150 LOG(VB_COMMFLAG, LOG_ERR,
151 QString(
"SceneChangeDetector::analyzeFrame error at frame %1")
162 LOG(VB_COMMFLAG, LOG_INFO, QString(
"SceneChangeDetector::finished(%1)")
167 for (
long long frameno = 0; frameno < nframes; frameno++)
170 for (
long long frameno = 1; frameno < nframes; frameno++)
178 LOG(VB_COMMFLAG, LOG_INFO,
179 QString(
"SceneChangeDetector::finished wrote %1")
186 std::vector<uint16_t> scdiffsort =
m_scDiff;
188 (
int)(0.979472 * nframes));
189 LOG(VB_COMMFLAG, LOG_INFO,
190 QString(
"SceneChangeDetector::finished applying threshold value %1")