[vlc-commits] d3d11_shaders: support custom YUVA/I420 output

Steve Lhomme git at videolan.org
Mon May 28 13:25:49 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jan 10 15:40:52 2018 +0100| [682b46f30bce41484313797c844fae3e6e013881] | committer: Steve Lhomme

d3d11_shaders: support custom YUVA/I420 output

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

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

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 40ceb667f7..682199c053 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -266,6 +266,27 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *o, d3d11_handle_t *hd3d, bool leg
                      sample.z = 0.0;\
                      sample.a = 1;";
             break;
+        case DXGI_FORMAT_UNKNOWN:
+            switch (format->fourcc)
+            {
+            case VLC_CODEC_YUVA:
+                /* Y */
+                psz_sampler[0] =
+                        "sample.x = shaderTexture[0].Sample(samplerState, coords).x;\
+                         sample.y = 0.0;\
+                         sample.z = 0.0;\
+                         sample.a = shaderTexture[3].Sample(samplerState, coords).x;";
+                /* UV */
+                psz_sampler[1] =
+                        "sample.x = shaderTexture[1].Sample(samplerState, coords).x;\
+                         sample.y = shaderTexture[2].Sample(samplerState, coords).x;\
+                         sample.z = 0.0;\
+                         sample.a = shaderTexture[3].Sample(samplerState, coords).x;";
+                break;
+            default:
+                vlc_assert_unreachable();
+            }
+            break;
         default:
             vlc_assert_unreachable();
         }
@@ -304,18 +325,32 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *o, d3d11_handle_t *hd3d, bool leg
                     "sample = shaderTexture[0].Sample(samplerState, coords);";
             break;
         case DXGI_FORMAT_UNKNOWN:
-            if (format->fourcc == VLC_CODEC_I420_10L)
+            switch (format->fourcc)
+            {
+            case VLC_CODEC_I420_10L:
                 psz_sampler[0] =
                        "sample.x  = shaderTexture[0].Sample(samplerState, coords).x * 64;\
                         sample.y  = shaderTexture[1].Sample(samplerState, coords).x * 64;\
                         sample.z  = shaderTexture[2].Sample(samplerState, coords).x * 64;\
                         sample.a  = 1;";
-            else
+                break;
+            case VLC_CODEC_I420:
                 psz_sampler[0] =
                        "sample.x  = shaderTexture[0].Sample(samplerState, coords).x;\
                         sample.y  = shaderTexture[1].Sample(samplerState, coords).x;\
                         sample.z  = shaderTexture[2].Sample(samplerState, coords).x;\
                         sample.a  = 1;";
+                break;
+            case VLC_CODEC_YUVA:
+                psz_sampler[0] =
+                       "sample.x  = shaderTexture[0].Sample(samplerState, coords).x;\
+                        sample.y  = shaderTexture[1].Sample(samplerState, coords).x;\
+                        sample.z  = shaderTexture[2].Sample(samplerState, coords).x;\
+                        sample.a  = shaderTexture[3].Sample(samplerState, coords).x;";
+                break;
+            default:
+                vlc_assert_unreachable();
+            }
             break;
         default:
             vlc_assert_unreachable();



More information about the vlc-commits mailing list