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

Steve Lhomme git at videolan.org
Wed Oct 17 16:07:52 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 12 16:21:53 2018 +0200| [7427107d9c77a12673c1eb6869e03887fa63f3aa] | committer: Steve Lhomme

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

(cherry picked from commit 9bffed4c4d27b641bb035732348bf55dd2d3b835)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7427107d9c77a12673c1eb6869e03887fa63f3aa
---

 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 306a9fe01d..f8df5fb291 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\
@@ -414,7 +414,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