From 64861797a86f1351b0bb0c24600479876ce9fb8c Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Sun, 19 Feb 2023 19:31:47 +0100 Subject: [Windows] Improve formula for GUI SDR peak luminance setting Better adjust and more coherent with Windows HDR/SDR balance setting: 0% --> 80 nits 100% --> 1000 nits new default 40% (~220 nits) --- system/settings/settings.xml | 4 ++-- xbmc/settings/Settings.h | 2 +- xbmc/windowing/win10/WinSystemWin10.cpp | 5 +++-- xbmc/windowing/windows/WinSystemWin32.cpp | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/system/settings/settings.xml b/system/settings/settings.xml index 4cb005acb6..8bd06b3a46 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2824,7 +2824,7 @@ </dependencies> <control type="toggle" /> </setting> - <setting id="videoscreen.guisdrpeakluminance" type="integer" label="36097" help="36547"> + <setting id="videoscreen.guipeakluminance" type="integer" label="36097" help="36547"> <requirement>HAS_DX</requirement> <dependencies> <dependency type="visible" on="property" name="ishdrdisplay"/> @@ -2836,7 +2836,7 @@ </dependency> </dependencies> <level>2</level> - <default>60</default> + <default>40</default> <control type="slider" format="percentage" range="0,100" /> </setting> </group> diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index f710d0fd2f..e74c56d837 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -367,7 +367,7 @@ public: static constexpr auto SETTING_VIDEOSCREEN_10BITSURFACES = "videoscreen.10bitsurfaces"; static constexpr auto SETTING_VIDEOSCREEN_USESYSTEMSDRPEAKLUMINANCE = "videoscreen.usesystemsdrpeakluminance"; - static constexpr auto SETTING_VIDEOSCREEN_GUISDRPEAKLUMINANCE = "videoscreen.guisdrpeakluminance"; + static constexpr auto SETTING_VIDEOSCREEN_GUISDRPEAKLUMINANCE = "videoscreen.guipeakluminance"; static constexpr auto SETTING_AUDIOOUTPUT_AUDIODEVICE = "audiooutput.audiodevice"; static constexpr auto SETTING_AUDIOOUTPUT_CHANNELS = "audiooutput.channels"; static constexpr auto SETTING_AUDIOOUTPUT_CONFIG = "audiooutput.config"; diff --git a/xbmc/windowing/win10/WinSystemWin10.cpp b/xbmc/windowing/win10/WinSystemWin10.cpp index 14e539a385..056b66d705 100644 --- a/xbmc/windowing/win10/WinSystemWin10.cpp +++ b/xbmc/windowing/win10/WinSystemWin10.cpp @@ -29,6 +29,7 @@ #include "platform/win10/AsyncHelpers.h" #include "platform/win32/CharsetConverter.h" +#include <cmath> #include <mutex> #pragma pack(push,8) @@ -665,8 +666,8 @@ float CWinSystemWin10::GetGuiSdrPeakLuminance() const return m_systemSdrPeakLuminance; // Max nits for 100% UI setting = 1000 nits, < 10000 nits, min 80 nits for 0% - int guiSdrPeak = settings->GetInt(CSettings::SETTING_VIDEOSCREEN_GUISDRPEAKLUMINANCE); - return 10000.0f / ((100 - guiSdrPeak) * 1.15f + 10); + const int guiSdrPeak = settings->GetInt(CSettings::SETTING_VIDEOSCREEN_GUISDRPEAKLUMINANCE); + return (80.0f * std::pow(std::exp(1.0f), 0.025257f * guiSdrPeak)); } /*! diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp index cb7dcfe257..c5b4de29d3 100644 --- a/xbmc/windowing/windows/WinSystemWin32.cpp +++ b/xbmc/windowing/windows/WinSystemWin32.cpp @@ -36,6 +36,7 @@ #include "platform/win32/input/IRServerSuite.h" #include <algorithm> +#include <cmath> #include <mutex> #include <tpcshrd.h> @@ -1318,8 +1319,8 @@ float CWinSystemWin32::GetGuiSdrPeakLuminance() const return m_systemSdrPeakLuminance; // Max nits for 100% UI setting = 1000 nits, < 10000 nits, min 80 nits for 0% - int guiSdrPeak = settings->GetInt(CSettings::SETTING_VIDEOSCREEN_GUISDRPEAKLUMINANCE); - return 10000.0f / ((100 - guiSdrPeak) * 1.15f + 10); + const int guiSdrPeak = settings->GetInt(CSettings::SETTING_VIDEOSCREEN_GUISDRPEAKLUMINANCE); + return (80.0f * std::pow(std::exp(1.0f), 0.025257f * guiSdrPeak)); } /*! -- cgit v1.2.3