Ticket #12308: mcf-letter-pillar.patch

File mcf-letter-pillar.patch, 2.9 KB (added by faginbagin <mythtv@…>, 10 years ago)
  • mythtv/programs/mythcommflag/ClassicCommDetector.cpp

    diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
    index 93f280e..4d9ff23 100644
    a b enum frameAspects { 
    3131    COMM_ASPECT_WIDE
    3232} FrameAspects;
    3333
     34// letter-box and pillar-box are not mutually exclusive
     35// So 3 is a valid value = (COMM_FORMAT_LETTERBOX | COMM_FORMAT_PILLARBOX)
     36// And 4 = COMM_FORMAT_MAX is the number of valid values.
    3437enum frameFormats {
    35     COMM_FORMAT_NORMAL = 0,
    36     COMM_FORMAT_LETTERBOX,
    37     COMM_FORMAT_PILLARBOX,
    38     COMM_FORMAT_MAX
     38    COMM_FORMAT_NORMAL    = 0,
     39    COMM_FORMAT_LETTERBOX = 1,
     40    COMM_FORMAT_PILLARBOX = 2,
     41    COMM_FORMAT_MAX       = 4,
    3942} FrameFormats;
    4043
    4144static QString toStringFrameMaskValues(int mask, bool verbose)
    static QString toStringFrameFormats(int format, bool verbose) 
    8891    switch (format)
    8992    {
    9093        case COMM_FORMAT_NORMAL:
    91             return (verbose) ? "normal" : "N";
     94            return (verbose) ? "normal" : " N ";
    9295        case COMM_FORMAT_LETTERBOX:
    93             return (verbose) ? "letter" : "L";
     96            return (verbose) ? "letter" : " L ";
    9497        case COMM_FORMAT_PILLARBOX:
    95             return (verbose) ? "pillar" : "P";
     98            return (verbose) ? "pillar" : " P ";
     99        case COMM_FORMAT_LETTERBOX | COMM_FORMAT_PILLARBOX:
     100            return (verbose) ? "letter,pillar" : "L,P";
    96101        case COMM_FORMAT_MAX:
    97             return (verbose) ? " max  " : "M";
     102            return (verbose) ? " max  " : " M ";
    98103    }
    99104
    100     return (verbose) ? " null " : "n";
     105    return (verbose) ? "unknown" : " U ";
    101106}
    102107
    103108QString FrameInfoEntry::GetHeader(void)
    void ClassicCommDetector::ProcessFrame(VideoFrame *frame, 
    917922        delete[] colMax;
    918923        colMax = 0;
    919924
     925        frameInfo[curFrameNumber].format = COMM_FORMAT_NORMAL;
    920926        if ((topDarkRow > commDetectBorder) &&
    921927            (topDarkRow < (height * .20)) &&
    922928            (bottomDarkRow < (height - commDetectBorder)) &&
    923929            (bottomDarkRow > (height * .80)))
    924930        {
    925             frameInfo[curFrameNumber].format = COMM_FORMAT_LETTERBOX;
     931            frameInfo[curFrameNumber].format |= COMM_FORMAT_LETTERBOX;
    926932        }
    927         else if ((leftDarkCol > commDetectBorder) &&
     933        if ((leftDarkCol > commDetectBorder) &&
    928934                 (leftDarkCol < (width * .20)) &&
    929935                 (rightDarkCol < (width - commDetectBorder)) &&
    930936                 (rightDarkCol > (width * .80)))
    931937        {
    932             frameInfo[curFrameNumber].format = COMM_FORMAT_PILLARBOX;
    933         }
    934         else
    935         {
    936             frameInfo[curFrameNumber].format = COMM_FORMAT_NORMAL;
     938            frameInfo[curFrameNumber].format |= COMM_FORMAT_PILLARBOX;
    937939        }
    938940
    939941        avg = totBrightness / blankPixelsChecked;