fixed underflow in FrameLayoutDetector

This commit is contained in:
thrust26 2024-06-12 09:48:53 +02:00
parent 1c2dceab2b
commit 5c0856c7a4
1 changed files with 2 additions and 1 deletions

View File

@ -244,8 +244,9 @@ void FrameLayoutDetector::finalizeFrame()
// 1.0 (>=312) and added to PAL and (inverted) NTSC sums. // 1.0 (>=312) and added to PAL and (inverted) NTSC sums.
constexpr double ODD_PENALTY = 0.5; // guessed value :) constexpr double ODD_PENALTY = 0.5; // guessed value :)
const double palFrame = BSPF::clamp(((myCurrentFrameFinalLines % 2) ? ODD_PENALTY : 1.0) const double palFrame = BSPF::clamp(((myCurrentFrameFinalLines % 2) ? ODD_PENALTY : 1.0)
* static_cast<double>(myCurrentFrameFinalLines - frameLinesNTSC) * (static_cast<double>(myCurrentFrameFinalLines) - static_cast<double>(frameLinesNTSC))
/ static_cast<double>(frameLinesPAL - frameLinesNTSC), 0.0, 1.0); / static_cast<double>(frameLinesPAL - frameLinesNTSC), 0.0, 1.0);
myPalFrameSum += palFrame; myPalFrameSum += palFrame;
myNtscFrameSum += 1.0 - palFrame; myNtscFrameSum += 1.0 - palFrame;
//cerr << myCurrentFrameFinalLines << ", " << palFrame << ", " << myPalFrameSum << ", " << myNtscFrameSum << '\n'; //cerr << myCurrentFrameFinalLines << ", " << palFrame << ", " << myPalFrameSum << ", " << myNtscFrameSum << '\n';