Ticket #12308: mcf-border.patch

File mcf-border.patch, 1.5 KB (added by faginbagin <mythtv@…>, 5 years ago)
  • mythtv/programs/mythcommflag/ClassicCommDetector.cpp

    diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
    index a66ff3e..0fbba02 100644
    a b ClassicCommDetector::ClassicCommDetector(SkipType commDetectMethod_in, 
    153153    fps(0.0),                                  framesProcessed(0),
    154154    preRoll(0),                                postRoll(0)
    155155{
    156     commDetectBorder =
    157         gCoreContext->GetNumSetting("CommDetectBorder", 20);
    158156    commDetectBlankFrameMaxDiff =
    159157        gCoreContext->GetNumSetting("CommDetectBlankFrameMaxDiff", 25);
    160158    commDetectDarkBrightness =
    void ClassicCommDetector::Init() 
    190188    postRoll = (long long)(
    191189        max(int64_t(0), int64_t(stopsAt.secsTo(recordingStopsAt))) * fps);
    192190
     191    // CommDetectBorder's default value of 20 predates the change to use
     192    // ffmpeg's lowres decoding capability by 5 years.
     193    // I believe it should be adjusted based on the height of the lowres video
     194    // CommDetectBorder * height / 720 seems to produce reasonable results.
     195    // source height =  480 gives border = 20 *  480 / 4 / 720 = 2
     196    // source height =  720 gives border = 20 *  720 / 4 / 720 = 5
     197    // source height = 1080 gives border = 20 * 1080 / 4 / 720 = 7
     198    commDetectBorder =
     199        gCoreContext->GetNumSetting("CommDetectBorder", 20) * height / 720;
     200
    193201#ifdef SHOW_DEBUG_WIN
    194202    comm_debug_init(width, height);
    195203#endif