From 5864f6500fe11a2fba7e347c98a71998ce965b2c Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Sun, 8 Nov 2020 13:52:03 +0100 Subject: Tone mapping: Extend default video settings to store tone map method --- .../VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.h | 2 +- xbmc/cores/VideoSettings.cpp | 4 ++++ xbmc/cores/VideoSettings.h | 12 ++++++------ xbmc/settings/MediaSettings.cpp | 9 ++++++--- xbmc/video/VideoDatabase.cpp | 6 ------ 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.h index 2864d8310f..647f5ffbe6 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.h @@ -96,7 +96,7 @@ private: unsigned m_sourceHeight = 0; int m_lutSize = 0; int m_ditherDepth = 0; - int m_toneMappingMethod = VS_TONEMAPMETHOD_REINHARD; + int m_toneMappingMethod = 0; float m_toneMappingParam = 1.0f; CRect m_sourceRect = {}; diff --git a/xbmc/cores/VideoSettings.cpp b/xbmc/cores/VideoSettings.cpp index 9f18508c31..20b287a5c6 100644 --- a/xbmc/cores/VideoSettings.cpp +++ b/xbmc/cores/VideoSettings.cpp @@ -36,6 +36,10 @@ CVideoSettings::CVideoSettings() m_StereoMode = 0; m_StereoInvert = false; m_VideoStream = -1; + m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD; + m_ToneMapParam = 1.0f; + m_Orientation = 0; + m_CenterMixLevel = 0; } bool CVideoSettings::operator!=(const CVideoSettings &right) const diff --git a/xbmc/cores/VideoSettings.h b/xbmc/cores/VideoSettings.h index ba7efeb797..4e2007a8a6 100644 --- a/xbmc/cores/VideoSettings.h +++ b/xbmc/cores/VideoSettings.h @@ -90,8 +90,8 @@ public: bool operator!=(const CVideoSettings &right) const; EINTERLACEMETHOD m_InterlaceMethod; - ESCALINGMETHOD m_ScalingMethod; - int m_ViewMode; // current view mode + ESCALINGMETHOD m_ScalingMethod; + int m_ViewMode; // current view mode float m_CustomZoomAmount; // custom setting zoom amount float m_CustomPixelRatio; // custom setting pixel ratio float m_CustomVerticalShift; // custom setting vertical shift @@ -113,10 +113,10 @@ public: int m_StereoMode; bool m_StereoInvert; int m_VideoStream; - int m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD; - float m_ToneMapParam = 1.0; - int m_Orientation = 0; - int m_CenterMixLevel = 0; // relative to metadata or default + int m_ToneMapMethod; + float m_ToneMapParam; + int m_Orientation; + int m_CenterMixLevel; // relative to metadata or default }; class CCriticalSection; diff --git a/xbmc/settings/MediaSettings.cpp b/xbmc/settings/MediaSettings.cpp index 27c5ac7bea..37d653e999 100644 --- a/xbmc/settings/MediaSettings.cpp +++ b/xbmc/settings/MediaSettings.cpp @@ -114,10 +114,11 @@ bool CMediaSettings::Load(const TiXmlNode *settings) m_defaultVideoSettings.m_StereoMode = 0; if (!XMLUtils::GetInt(pElement, "centermixlevel", m_defaultVideoSettings.m_CenterMixLevel)) m_defaultVideoSettings.m_CenterMixLevel = 0; - - m_defaultVideoSettings.m_ToneMapMethod = 1; - m_defaultVideoSettings.m_ToneMapParam = 1.0f; m_defaultVideoSettings.m_SubtitleCached = false; + if (!XMLUtils::GetInt(pElement, "tonemapmethod", m_defaultVideoSettings.m_ToneMapMethod)) + m_defaultVideoSettings.m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD; + if (!XMLUtils::GetFloat(pElement, "tonemapparam", m_defaultVideoSettings.m_ToneMapParam, 0.1f, 5.0f)) + m_defaultVideoSettings.m_ToneMapParam = 1.0f; } m_defaultGameSettings.Reset(); @@ -220,6 +221,8 @@ bool CMediaSettings::Save(TiXmlNode *settings) const XMLUtils::SetBoolean(pNode, "nonlinstretch", m_defaultVideoSettings.m_CustomNonLinStretch); XMLUtils::SetInt(pNode, "stereomode", m_defaultVideoSettings.m_StereoMode); XMLUtils::SetInt(pNode, "centermixlevel", m_defaultVideoSettings.m_CenterMixLevel); + XMLUtils::SetInt(pNode, "tonemapmethod", m_defaultVideoSettings.m_ToneMapMethod); + XMLUtils::SetFloat(pNode, "tonemapparam", m_defaultVideoSettings.m_ToneMapParam); // default audio settings for dsp addons TiXmlElement audioSettingsNode("defaultaudiosettings"); diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index bed0426c1d..862b4874e2 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -4469,12 +4469,6 @@ bool CVideoDatabase::GetVideoSettings(int idFile, CVideoSettings &settings) settings.m_Orientation = m_pDS->fv("Orientation").get_asInt(); settings.m_CenterMixLevel = m_pDS->fv("CenterMixLevel").get_asInt(); m_pDS->close(); - - if (settings.m_ToneMapParam == 0.0) - { - settings.m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD; - settings.m_ToneMapParam = 1.0; - } return true; } m_pDS->close(); -- cgit v1.2.3