Ticket #12308: mcf-logo-pixInMask.patch

File mcf-logo-pixInMask.patch, 1.9 KB (added by faginbagin <mythtv@…>, 9 years ago)
  • mythtv/programs/mythcommflag/ClassicLogoDetector.cpp

    diff --git a/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp b/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp
    index dbe6b4a..287f610 100644
    a b bool ClassicLogoDetector::searchForLogo(MythPlayer* player) 
    101101
    102102    edgeCounts = new EdgeMaskEntry[width * height];
    103103
     104    // Back in 2005, a threshold of 50 minimum pixelsInMask was established.
     105    // I don't know whether that was tested against SD or HD resolutions.
     106    // I do know that in 2010, mythcommflag was changed to use ffmpeg's
     107    // lowres support, effectively dividing the video area by 16.
     108    // But the 50 pixel minimum was not adjusted accordingly.
     109    // I believe the minimum threshold should vary with the video's area.
     110    // I am using 1280x720 (for 720p) video as the baseline.
     111    // This should improve logo detection for SD video.
     112    int minPixelsInMask = 50 * (width*height) / (1280*720 / 16);
     113
    104114    for (i = 0; edgeDiffs[i] != 0 && !logoInfoAvailable; i++)
    105115    {
    106116        int pixelsInMask = 0;
    107117
    108         LOG(VB_COMMFLAG, LOG_INFO, QString("Trying with edgeDiff == %1")
    109                 .arg(edgeDiffs[i]));
     118        LOG(VB_COMMFLAG, LOG_INFO, QString("Trying with edgeDiff == %1, minPixelsInMask=%2")
     119                .arg(edgeDiffs[i]).arg(minPixelsInMask));
    110120
    111121        memset(edgeCounts, 0, sizeof(EdgeMaskEntry) * width * height);
    112122        memset(edgeMask, 0, sizeof(EdgeMaskEntry) * width * height);
    bool ClassicLogoDetector::searchForLogo(MythPlayer* player) 
    238248#endif
    239249        if (((logoMaxX - logoMinX) < (width / 4)) &&
    240250            ((logoMaxY - logoMinY) < (height / 4)) &&
    241             (pixelsInMask > 50))
     251            (pixelsInMask > minPixelsInMask))
    242252        {
    243253            logoInfoAvailable = true;
    244254            logoEdgeDiff = edgeDiffs[i];