added check which ignores invalid frames (too many scanlines) during frame detection (fixes Tarzan)

This commit is contained in:
thrust26 2024-06-04 09:51:47 +02:00
parent 2a09855224
commit b246dcb2cf
1 changed files with 8 additions and 3 deletions

View File

@ -181,12 +181,14 @@ void FrameLayoutDetector::onNextLine()
if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0)
++myLinesWaitingForVsyncToStart;
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd);
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync)
setState(State::waitForVsyncEnd);
break;
case State::waitForVsyncEnd:
if (++myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncStart);
if (++myLinesWaitingForVsyncToStart > Metrics::waitForVsync)
setState(State::waitForVsyncStart);
break;
@ -232,7 +234,10 @@ void FrameLayoutDetector::finalizeFrame()
{
notifyFrameComplete();
if (myTotalFrames <= Metrics::initialGarbageFrames) return;
if (myTotalFrames <= Metrics::initialGarbageFrames)
return;
if (myCurrentFrameFinalLines > Metrics::frameLinesPAL + Metrics::waitForVsync)
return;
// Calculate how close a frame is to PAL and NTSC based on scanlines. An odd scanline count
// results into a penalty of 0.5 for PAL. The result is between 0.0 (<=262 scanlines) and