aboutsummaryrefslogtreecommitdiff
path: root/system/shaders
diff options
context:
space:
mode:
authorAnton Fedchin <anightik@gmail.com>2018-02-15 14:56:39 +0300
committerAnton Fedchin <anightik@gmail.com>2018-02-15 14:56:39 +0300
commit1bdb80e9ef3454e19f02919a1441bc438c56f597 (patch)
treebace3842ac9fbd1b91ff1f0b92b3a510f6d6ccb0 /system/shaders
parent950de8ee3b02adf9cfd333b92c453c436e0ac7e5 (diff)
[VideoPlayer] WinRenderer: implement tone mapping.
Diffstat (limited to 'system/shaders')
-rw-r--r--system/shaders/output_d3d.fx15
1 files changed, 14 insertions, 1 deletions
diff --git a/system/shaders/output_d3d.fx b/system/shaders/output_d3d.fx
index 40d6252697..47297b7707 100644
--- a/system/shaders/output_d3d.fx
+++ b/system/shaders/output_d3d.fx
@@ -41,9 +41,22 @@ SamplerState DitherSampler : IMMUTABLE
Filter = MIN_MAG_MIP_POINT;
};
#endif
+#if defined(KODI_TONE_MAPPING)
+float g_toneP1;
+float3 g_coefsDst;
+
+float tonemap(float val)
+{
+ return val * (1 + val/(g_toneP1*g_toneP1))/(1 + val);
+}
+#endif
float4 output4(float4 color, float2 uv)
{
+#if defined(KODI_TONE_MAPPING)
+ float luma = dot(color.rgb, g_coefsDst);
+ color.rgb *= tonemap(luma) / luma;
+#endif
#if defined(KODI_3DLUT)
half3 scale = m_CLUTParams.x;
half3 offset = m_CLUTParams.y;
@@ -61,7 +74,7 @@ float4 output4(float4 color, float2 uv)
float4 output(float3 color, float2 uv)
{
- return output4(float4(color, 1.0), uv);
+ return output4(float4(color, 1.0), uv);
}
#if defined(KODI_OUTPUT_T)