[vlc-commits] d3d11_shaders: use clamp() instead of min(max())

Steve Lhomme git at videolan.org
Fri Oct 12 16:25:01 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 12 16:21:53 2018 +0200| [9bffed4c4d27b641bb035732348bf55dd2d3b835] | committer: Steve Lhomme

d3d11_shaders: use clamp() instead of min(max())

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bffed4c4d27b641bb035732348bf55dd2d3b835
---

 modules/video_output/win32/d3d11_shaders.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index e04250e1ac..9ad845eb41 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -98,7 +98,7 @@ static const char* globPixelShaderDefault = "\
   }\n\
   \n\
   inline float3 linearToDisplay(float3 rgb) {\n\
-     rgb = max(min(rgb, 1), 0);\n\
+     rgb = clamp(rgb, 0, 1);\n\
       %s;\n\
   }\n\
   \n\
@@ -573,7 +573,7 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *o, d3d11_handle_t *hd3d, bool leg
                     black_level -= itu_black_level;
                     range_factor /= itu_range_factor;
                 }
-                sprintf(psz_range, "return max(0,min(1,(rgb + %f) * %f))",
+                sprintf(psz_range, "return clamp((rgb + %f) * %f, 0, 1)",
                         black_level, range_factor);
             }
             else



More information about the vlc-commits mailing list