From e05d946f1581ee3c0be6c7ff1ef7d0685671d8a2 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 28 Apr 2016 08:45:08 +0200 Subject: [PATCH] VideoPlayer: move limited/full range conversion to matrix for single pass --- system/shaders/output.glsl | 6 +++--- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 3 ++- xbmc/cores/VideoRenderers/VideoShaders/GLSLOutput.cpp | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/system/shaders/output.glsl b/system/shaders/output.glsl index 83f77b04c..ecaa30d9d 100644 --- a/system/shaders/output.glsl +++ b/system/shaders/output.glsl @@ -1,4 +1,4 @@ -#if (XBMC_DITHER) +#if defined(XBMC_DITHER) uniform sampler2D m_dither; uniform float m_ditherquant; uniform vec2 m_dithersize; @@ -8,11 +8,11 @@ void main() { vec4 rgb = process(); -#if (XBMC_FULLRANGE) +#if defined(XBMC_FULLRANGE) rgb = clamp((rgb-(16.0/255.0)) * 255.0/219.0, 0, 1); #endif -#if (XBMC_DITHER) +#if defined(XBMC_DITHER) vec2 ditherpos = gl_FragCoord.xy / m_dithersize; // ditherval is multiplied by 65536/(dither_size^2) to make it [0,1[ // FIXME: scale dither values before uploading? diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp index c771c135a..6b1156f90 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -909,10 +909,11 @@ void CLinuxRendererGL::LoadShaders(int field) // if single pass, create GLSLOutput helper and pass it to YUV2RGB shader GLSLOutput *out = nullptr; if (m_renderQuality == RQ_SINGLEPASS) - out = new GLSLOutput(3, m_useDithering, m_ditherDepth, m_fullRange); + out = new GLSLOutput(3, m_useDithering, m_ditherDepth, false); m_pYUVShader = new YUV2RGBProgressiveShader(m_textureTarget==GL_TEXTURE_RECTANGLE_ARB, m_iFlags, m_format, m_nonLinStretch && m_renderQuality == RQ_SINGLEPASS, out); + m_pYUVShader->SetForceLimitedColorRange(false); CLog::Log(LOGNOTICE, "GL: Selecting Single Pass YUV 2 RGB shader"); diff --git a/xbmc/cores/VideoRenderers/VideoShaders/GLSLOutput.cpp b/xbmc/cores/VideoRenderers/VideoShaders/GLSLOutput.cpp index 182a893e3..b6cd2e2f5 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/GLSLOutput.cpp +++ b/xbmc/cores/VideoRenderers/VideoShaders/GLSLOutput.cpp @@ -49,11 +49,11 @@ GLSLOutput::GLSLOutput(int texunit, bool useDithering, unsigned int ditherDepth, std::string GLSLOutput::GetDefines() { - std::string defines = "#define XBMC_OUTPUT 1\n"; + std::string defines; if (m_dither) - defines += "#define XBMC_DITHER 1\n"; + defines += "#define XBMC_DITHER\n"; if (m_fullRange) - defines += "#define XBMC_FULLRANGE 1\n"; + defines += "#define XBMC_FULLRANGE\n"; return defines; }