diff options
author | mglae <mglmail@arcor.de> | 2020-11-14 19:58:41 +0100 |
---|---|---|
committer | mglae <mglmail@arcor.de> | 2020-11-17 19:50:53 +0100 |
commit | 1a3296d65a5d45090651548a2ec48ef47eaea8ee (patch) | |
tree | 6513478072e7cfb838da2619781393fed7b51696 /system | |
parent | 59c36762b99d5e97db6605348362e0f3479672ae (diff) |
gl_yuv2rgb_filter4.glsl: add ACES and Hable tone mapping
Diffstat (limited to 'system')
-rw-r--r-- | system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl b/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl index 84e480c5ec..8a4658cd7b 100644 --- a/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl +++ b/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl @@ -17,6 +17,7 @@ uniform mat3 m_primMat; uniform float m_gammaDstInv; uniform float m_gammaSrc; uniform float m_toneP1; +uniform float m_luminance; uniform vec3 m_coefsDst; in vec2 m_cordY; in vec2 m_cordU; @@ -115,9 +116,23 @@ vec4 process() rgb.rgb = max(vec3(0), m_primMat * rgb.rgb); rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv)); -#if defined(XBMC_TONE_MAPPING) +#if defined(KODI_TONE_MAPPING_REINHARD) float luma = dot(rgb.rgb, m_coefsDst); - rgb.rgb *= tonemap(luma) / luma; + rgb.rgb *= reinhard(luma) / luma; + +#elif defined(KODI_TONE_MAPPING_ACES) + rgb.rgb = inversePQ(rgb.rgb); + rgb.rgb *= (10000.0 / m_luminance) * (2.0 / m_toneP1); + rgb.rgb = aces(rgb.rgb); + rgb.rgb *= (1.24 / m_toneP1); + rgb.rgb = pow(rgb.rgb, vec3(0.27)); + +#elif defined(KODI_TONE_MAPPING_HABLE) + rgb.rgb = inversePQ(rgb.rgb); + rgb.rgb *= m_toneP1; + float wp = m_luminance / 100.0; + rgb.rgb = hable(rgb.rgb * wp) / hable(vec3(wp)); + rgb.rgb = pow(rgb.rgb, vec3(1.0 / 2.2)); #endif #endif |