Skip to content

Commit

Permalink
VideoPlayer: move limited/full range conversion to matrix for single …
Browse files Browse the repository at this point in the history
…pass
  • Loading branch information
FernetMenta authored and Kwiboo committed Nov 17, 2016
1 parent f36738a commit e05d946
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions system/shaders/output.glsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if (XBMC_DITHER)
#if defined(XBMC_DITHER)
uniform sampler2D m_dither;
uniform float m_ditherquant;
uniform vec2 m_dithersize;
Expand All @@ -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?
Expand Down
3 changes: 2 additions & 1 deletion xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
6 changes: 3 additions & 3 deletions xbmc/cores/VideoRenderers/VideoShaders/GLSLOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e05d946

Please sign in to comment.