diff options
Diffstat (limited to 'system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag')
-rw-r--r-- | system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag index 2d242eb6b2..609f51d774 100644 --- a/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag +++ b/system/shaders/GLES/2.0/gles_yuv2rgb_bob.frag @@ -35,10 +35,12 @@ uniform int m_field; uniform mat3 m_primMat; uniform float m_gammaDstInv; uniform float m_gammaSrc; +uniform float m_toneP1; +uniform vec3 m_coefsDst; void main() { - vec4 yuv, rgb; + vec4 rgb; vec2 offsetY; vec2 offsetU; @@ -65,25 +67,32 @@ void main() belowV.x = offsetV.x; belowV.y = offsetV.y + (m_stepY*bstep); - vec4 yuvBelow, rgbBelow; + vec4 rgbAbove; + vec4 rgbBelow; + vec4 yuvAbove; + vec4 yuvBelow; - yuv.rgba = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).g, texture2D(m_sampV, offsetV).a, 1.0); - rgb = m_yuvmat * yuv; - rgb.a = m_alpha; + yuvAbove.rgba = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).g, texture2D(m_sampV, offsetV).a, 1.0); + rgbAbove = m_yuvmat * yuvAbove; + rgbAbove.a = m_alpha; yuvBelow.rgba = vec4(texture2D(m_sampY, belowY).r, texture2D(m_sampU, belowU).g, texture2D(m_sampV, belowV).a, 1.0); - rgbBelow = m_yuvmat * yuvBelow; + rgbBelow = m_yuvmat * yuvBelow; rgbBelow.a = m_alpha; + rgb = mix(rgb, rgbBelow, 0.5); + #if defined(XBMC_COL_CONVERSION) - rgb.rgb = pow(rgb.rgb, vec3(m_gammaSrc)); - rgb.rgb = m_primMat * rgb.rgb; + rgb.rgb = pow(max(vec3(0), rgb.rgb), vec3(m_gammaSrc)); + rgb.rgb = max(vec3(0), m_primMat * rgb.rgb); rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv)); - rgbBelow.rgb = pow(rgbBelow.rgb, vec3(m_gammaSrc)); - rgbBelow.rgb = m_primMat * rgbBelow.rgb; - rgbBelow.rgb = pow(rgbBelow.rgb, vec3(m_gammaDstInv)); +#if defined(XBMC_TONE_MAPPING) + float luma = dot(rgb.rgb, m_coefsDst); + rgb.rgb *= tonemap(luma) / luma; +#endif + #endif - gl_FragColor.rgba = mix(rgb, rgbBelow, 0.5); + gl_FragColor.rgba = rgb; } |