Ticket #10793: 20141111-27-comm-detector-fixes.patch

File 20141111-27-comm-detector-fixes.patch, 4.8 KB (added by Mark Spieth, 4 years ago)
  • mythtv/programs/mythcommflag/ClassicCommDetector.cpp

    Stride fix for comm detector
    
    From: Mark Spieth <mspieth@digivation.com.au>
    
    Fixes framing issue with comm detector with some sources where width is not
    real width of image data.
    ---
     .../programs/mythcommflag/ClassicCommDetector.cpp  |    4 ++--
     .../mythcommflag/ClassicSceneChangeDetector.cpp    |    8 +++++---
     .../mythcommflag/ClassicSceneChangeDetector.h      |    1 -
     mythtv/programs/mythcommflag/CommDetectorBase.h    |    5 +++++
     mythtv/programs/mythcommflag/main.cpp              |    9 +++++++++
     5 files changed, 21 insertions(+), 6 deletions(-)
    
    diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
    index d3f67c8..9d0d4d7 100644
    a b using namespace std; 
    2525#include "ClassicLogoDetector.h"
    2626#include "ClassicSceneChangeDetector.h"
    2727
    28 enum frameAspects {
     28typedef enum frameAspects {
    2929    COMM_ASPECT_NORMAL = 0,
    3030    COMM_ASPECT_WIDE
    3131} FrameAspects;
    3232
    33 enum frameFormats {
     33typedef enum frameFormats {
    3434    COMM_FORMAT_NORMAL = 0,
    3535    COMM_FORMAT_LETTERBOX,
    3636    COMM_FORMAT_PILLARBOX,
  • mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp

    diff --git a/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp b/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp
    index ca96f93..ab89fd7 100644
    a b  
    11#include <algorithm>
    22using namespace std;
    33
     4// MythTV headers
     5#include "mythframe.h"
     6
    47#include "ClassicSceneChangeDetector.h"
    58#include "Histogram.h"
    69
    ClassicSceneChangeDetector::ClassicSceneChangeDetector(unsigned int width, 
    811        unsigned int height, unsigned int commdetectborder_in,
    912        unsigned int xspacing_in, unsigned int yspacing_in):
    1013    SceneChangeDetectorBase(width,height),
    11     frameNumber(0),
    1214    previousFrameWasSceneChange(false),
    1315    xspacing(xspacing_in),
    1416    yspacing(yspacing_in),
    void ClassicSceneChangeDetector::deleteLater(void) 
    2729
    2830void ClassicSceneChangeDetector::processFrame(VideoFrame* frame)
    2931{
     32    width = frame->pitches[0];
    3033    histogram->generateFromImage(frame, width, height, commdetectborder,
    3134                                 width-commdetectborder, commdetectborder,
    3235                                 height-commdetectborder, xspacing, yspacing);
    void ClassicSceneChangeDetector::processFrame(VideoFrame* frame) 
    3437
    3538    bool isSceneChange = (similar < .85 && !previousFrameWasSceneChange);
    3639
    37     emit(haveNewInformation(frameNumber,isSceneChange,similar));
     40    emit(haveNewInformation(frame->frameNumber,isSceneChange,similar));
    3841    previousFrameWasSceneChange = isSceneChange;
    3942
    4043    std::swap(histogram,previousHistogram);
    41     frameNumber++;
    4244}
    4345
    4446/* vim: set expandtab tabstop=4 shiftwidth=4: */
  • mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h

    diff --git a/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h b/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h
    index a8fd53b..07e281e 100644
    a b class ClassicSceneChangeDetector : public SceneChangeDetectorBase 
    2121  private:
    2222    Histogram* histogram;
    2323    Histogram* previousHistogram;
    24     unsigned int frameNumber;
    2524    bool previousFrameWasSceneChange;
    2625    unsigned int xspacing, yspacing;
    2726    unsigned int commdetectborder;
  • mythtv/programs/mythcommflag/CommDetectorBase.h

    diff --git a/mythtv/programs/mythcommflag/CommDetectorBase.h b/mythtv/programs/mythcommflag/CommDetectorBase.h
    index 7fee51b..7faefa1 100644
    a b using namespace std; 
    1111
    1212#define MAX_BLANK_FRAMES 180
    1313
     14#define COMM_DETECT_NG 0x400
     15#define COMM_DETECT_AUDIO 0x08
     16#define COMM_DETECT_SUBTITLES 0x10
     17#define COMM_DETECT_NG_OLD 0x80
     18
    1419typedef enum commMapValues {
    1520    MARK_START   = 0,
    1621    MARK_END     = 1,
  • mythtv/programs/mythcommflag/main.cpp

    diff --git a/mythtv/programs/mythcommflag/main.cpp b/mythtv/programs/mythcommflag/main.cpp
    index 6db5887..c539f12 100644
    a b static int FlagCommercials( uint chanid, const QDateTime &starttime, 
    981981    }
    982982
    983983
     984    if (pginfo.GetSubtitle().isEmpty())
     985        LOG(VB_GENERAL, LOG_INFO,
     986            QString("MythTV Commercial Flagger, flagging commercials for: %1")
     987                .arg(pginfo.GetTitle()));
     988    else
     989        LOG(VB_GENERAL, LOG_INFO,
     990            QString("MythTV Commercial Flagger, flagging commercials for: %1 - %2")
     991                .arg(pginfo.GetTitle())
     992                .arg(pginfo.GetSubtitle()));
    984993    if (progress)
    985994    {
    986995        cerr << "MythTV Commercial Flagger, flagging commercials for:" << endl;