[vlc-devel] [PATCH] direct3d11: remove dead I420/YV12 code

Steve Lhomme robux4 at videolabs.io
Wed May 11 17:40:48 CEST 2016


---
 modules/video_output/win32/direct3d11.c | 111 ++------------------------------
 1 file changed, 6 insertions(+), 105 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index cfbbee1..5161e19 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -203,90 +203,6 @@ static const char* globPixelShaderDefault = "\
   }\
 ";
 
-static const char *globPixelShaderBiplanarI420_BT601_2RGB = "\
-  Texture2D shaderTextureY;\
-  Texture2D shaderTextureUV;\
-  SamplerState SampleType;\
-  \
-  struct PS_INPUT\
-  {\
-    float4 Position   : SV_POSITION;\
-    float2 Texture    : TEXCOORD0;\
-    float  Opacity    : OPACITY;\
-  };\
-  \
-  float4 PS( PS_INPUT In ) : SV_TARGET\
-  {\
-    float Y;\
-    float UCb;\
-    float VCr;\
-    float2 UCbPos;\
-    float2 VCrPos;\
-    float4 rgba;\
-    \
-    Y  = shaderTextureY.Sample(SampleType, In.Texture).x;\
-    \
-    VCrPos = In.Texture / 2;\
-    VCr = shaderTextureUV.Sample(SampleType, VCrPos).x;\
-    \
-    UCbPos = In.Texture / 2;\
-    UCbPos.y = UCbPos.y + 0.5;\
-    UCb = shaderTextureUV.Sample(SampleType, UCbPos).x;\
-    \
-    Y = 1.164383561643836 * (Y - 0.0625);\
-    UCb = UCb - 0.5;\
-    VCr = VCr - 0.5;\
-    \
-    rgba.x = saturate(Y + 1.596026785714286 * VCr);\
-    rgba.y = saturate(Y - 0.812967647237771 * VCr - 0.391762290094914 * UCb);\
-    rgba.z = saturate(Y + 2.017232142857142 * UCb);\
-    rgba.a = In.Opacity;\
-    return rgba;\
-  }\
-";
-
-static const char *globPixelShaderBiplanarI420_BT709_2RGB = "\
-  Texture2D shaderTextureY;\
-  Texture2D shaderTextureUV;\
-  SamplerState SampleType;\
-  \
-  struct PS_INPUT\
-  {\
-    float4 Position   : SV_POSITION;\
-    float2 Texture    : TEXCOORD0;\
-    float  Opacity    : OPACITY;\
-  };\
-  \
-  float4 PS( PS_INPUT In ) : SV_TARGET\
-  {\
-    float Y;\
-    float UCb;\
-    float VCr;\
-    float2 UCbPos;\
-    float2 VCrPos;\
-    float4 rgba;\
-    \
-    Y  = shaderTextureY.Sample(SampleType, In.Texture).x;\
-    \
-    VCrPos = In.Texture / 2;\
-    VCr = shaderTextureUV.Sample(SampleType, VCrPos).x;\
-    \
-    UCbPos = In.Texture / 2;\
-    UCbPos.y = UCbPos.y + 0.5;\
-    UCb = shaderTextureUV.Sample(SampleType, UCbPos).x;\
-    \
-    Y = 1.164383561643836 * (Y - 0.0625);\
-    UCb = UCb - 0.5;\
-    VCr = VCr - 0.5;\
-    \
-    rgba.x = saturate(Y + 1.792741071428571 * VCr);\
-    rgba.y = saturate(Y - 0.532909328559444 * VCr - 0.21324861427373 * UCb);\
-    rgba.z = saturate(Y + 2.112401785714286 * UCb);\
-    rgba.a = In.Opacity;\
-    return rgba;\
-  }\
-";
-
 static const char *globPixelShaderBiplanarYUV_BT601_2RGB = "\
   Texture2D shaderTextureY;\
   Texture2D shaderTextureUV;\
@@ -1108,30 +1024,15 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
         sys->d3dregion_format = DXGI_FORMAT_UNKNOWN;
     }
 
-    sys->d3dPxShader = globPixelShaderDefault;
     if (sys->picQuadConfig.resourceFormatYRGB == DXGI_FORMAT_R8_UNORM)
     {
-        switch (fmt->i_chroma)
-        {
-        case VLC_CODEC_NV12:
-        case VLC_CODEC_D3D11_OPAQUE:
-            if( fmt->i_height > 576 )
-                sys->d3dPxShader = globPixelShaderBiplanarYUV_BT709_2RGB;
-            else
-                sys->d3dPxShader = globPixelShaderBiplanarYUV_BT601_2RGB;
-            break;
-        case VLC_CODEC_YV12:
-        case VLC_CODEC_I420:
-            if( fmt->i_height > 576 )
-                sys->d3dPxShader = globPixelShaderBiplanarI420_BT709_2RGB;
-            else
-                sys->d3dPxShader = globPixelShaderBiplanarI420_BT601_2RGB;
-            break;
-        default:
-            vlc_assert_unreachable();
-            break;
-        }
+        if( fmt->i_height > 576 )
+            sys->d3dPxShader = globPixelShaderBiplanarYUV_BT709_2RGB;
+        else
+            sys->d3dPxShader = globPixelShaderBiplanarYUV_BT601_2RGB;
     }
+    else
+        sys->d3dPxShader = globPixelShaderDefault;
 
     if (sys->d3dregion_format != DXGI_FORMAT_UNKNOWN)
         sys->psz_rgbaPxShader = globPixelShaderDefault;
-- 
2.8.1



More information about the vlc-devel mailing list