Fix minor compile warnings in clang.

This commit is contained in:
Stephen Anthony 2022-06-05 11:02:25 -02:30
parent 3beb5599e2
commit b1dfa60def
2 changed files with 17 additions and 16 deletions

View File

@ -15,6 +15,8 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include <cmath>
#include "JitterEmulation.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -35,24 +37,24 @@ void JitterEmulation::setSensitivity(Int32 sensitivity)
myLastFrameScanlines = myLastFrameVsyncCycles = myUnstableCount = myJitter = 0;
mySensitivity = BSPF::clamp(sensitivity, MIN_SENSITIVITY, MAX_SENSITIVITY);
const float factor = pow(static_cast<float>(mySensitivity - MIN_SENSITIVITY) / (MAX_SENSITIVITY - MIN_SENSITIVITY), 1.5);
const float factor = std::pow(static_cast<float>(mySensitivity - MIN_SENSITIVITY) / (MAX_SENSITIVITY - MIN_SENSITIVITY), 1.5);
myScanlineDelta = round(MAX_SCANLINE_DELTA - (MAX_SCANLINE_DELTA - MIN_SCANLINE_DELTA) * factor);
myVsyncCycles = round(MIN_VSYNC_CYCLES + (MAX_VSYNC_CYCLES - MIN_VSYNC_CYCLES) * factor);
myVsyncDelta1 = round(MAX_VSYNC_DELTA_1 - (MAX_VSYNC_DELTA_1 - MIN_VSYNC_DELTA_1) * factor);
myScanlineDelta = std::round(MAX_SCANLINE_DELTA - (MAX_SCANLINE_DELTA - MIN_SCANLINE_DELTA) * factor);
myVsyncCycles = std::round(MIN_VSYNC_CYCLES + (MAX_VSYNC_CYCLES - MIN_VSYNC_CYCLES) * factor);
myVsyncDelta1 = std::round(MAX_VSYNC_DELTA_1 - (MAX_VSYNC_DELTA_1 - MIN_VSYNC_DELTA_1) * factor);
#ifdef VSYNC_LINE_JITTER
myVsyncDelta2 = round(MIN_VSYNC_DELTA_2 + (MAX_VSYNC_DELTA_2 - MIN_VSYNC_DELTA_2) * factor);
myVsyncDelta2 = std::round(MIN_VSYNC_DELTA_2 + (MAX_VSYNC_DELTA_2 - MIN_VSYNC_DELTA_2) * factor);
#endif
myUnstableFrames = round(MAX_UNSTABLE_FRAMES - (MAX_UNSTABLE_FRAMES - MIN_UNSTABLE_FRAMES) * factor);
myJitterLines = round(MIN_JITTER_LINES + (MAX_JITTER_LINES - MIN_JITTER_LINES) * factor);
myVsyncLines = round(MIN_VSYNC_LINES + (MAX_VSYNC_LINES - MIN_VSYNC_LINES) * factor);
myUnstableFrames = std::round(MAX_UNSTABLE_FRAMES - (MAX_UNSTABLE_FRAMES - MIN_UNSTABLE_FRAMES) * factor);
myJitterLines = std::round(MIN_JITTER_LINES + (MAX_JITTER_LINES - MIN_JITTER_LINES) * factor);
myVsyncLines = std::round(MIN_VSYNC_LINES + (MAX_VSYNC_LINES - MIN_VSYNC_LINES) * factor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles)
{
#ifdef DEBUG_BUILD
const int vsyncLines = round((vsyncCycles - 2) / 76.0);
const int vsyncLines = std::round((vsyncCycles - 2) / 76.0);
cerr << "TV jitter " << myJitter << " - " << scanlineCount << ", " << vsyncCycles << ", " << vsyncLines << endl;
#endif
@ -61,11 +63,11 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles)
const bool vsyncCyclesStable = vsyncCycles >= myVsyncCycles;
// Handle inconsistency of vsync cycles and around half lines
#ifdef VSYNC_LINE_JITTER
const Int32 minLines = round((vsyncCycles - 2 - myVsyncDelta2) / 76.0);
const Int32 maxLines = round((vsyncCycles - 2 + myVsyncDelta2) / 76.0);
const Int32 minLastLines = round((myLastFrameVsyncCycles - 2 - myVsyncDelta2) / 76.0);
const Int32 maxLastLines = round((myLastFrameVsyncCycles - 2 + myVsyncDelta2) / 76.0);
const bool vsyncLinesStable = abs(vsyncCycles - myLastFrameVsyncCycles) < myVsyncDelta1
const Int32 minLines = std::round((vsyncCycles - 2 - myVsyncDelta2) / 76.0);
const Int32 maxLines = std::round((vsyncCycles - 2 + myVsyncDelta2) / 76.0);
const Int32 minLastLines = std::round((myLastFrameVsyncCycles - 2 - myVsyncDelta2) / 76.0);
const Int32 maxLastLines = std::round((myLastFrameVsyncCycles - 2 + myVsyncDelta2) / 76.0);
const bool vsyncLinesStable = std::abs(vsyncCycles - myLastFrameVsyncCycles) < myVsyncDelta1
&& minLines == maxLastLines && maxLines == minLastLines;
#else
const bool vsyncLinesStable = abs(vsyncCycles - myLastFrameVsyncCycles) < myVsyncDelta1;
@ -90,7 +92,7 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles)
{
// If VSYNC length is too low, the frame rolls permanently down, speed depending on missing cycles
const Int32 jitter = std::max(
std::min<Int32>(round(scanlineCount * (1 - static_cast<float>(vsyncCycles) / myVsyncCycles)),
std::min<Int32>(std::round(scanlineCount * (1 - static_cast<float>(vsyncCycles) / myVsyncCycles)),
myJitterLines),
myJitterRecovery + 1); // Roll at least one scanline

View File

@ -123,7 +123,6 @@ class DeveloperDialog : public Dialog, DevSettingsHandler
RadioButtonGroup* mySettingsGroupVideo{nullptr};
CheckboxWidget* myTVJitterWidget{nullptr};
SliderWidget* myTVJitterRecWidget{nullptr};
StaticTextWidget* myTVJitterRecLabelWidget{nullptr};
SliderWidget* myTVJitterSenseWidget{nullptr};
CheckboxWidget* myColorLossWidget{nullptr};
CheckboxWidget* myDebugColorsWidget{nullptr};