[vlc-commits] direct3d11: fix the size of 10 bits I420 planes

Steve Lhomme git at videolan.org
Wed Feb 10 11:07:10 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 10 12:05:02 2021 +0100| [65d4eb8c6bb752f92f2593ed46275759f5e7d7e1] | committer: Steve Lhomme

direct3d11: fix the size of 10 bits I420 planes

The pitch is for 16 bits data so we need to reduce the 16 bits texture width by
that much.

We we using twice too big textures and adjusting for the bug in the sampler.

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

 modules/video_chroma/d3d11_fmt.c                |  2 +-
 modules/video_output/win32/d3d_dynamic_shader.c | 14 +++-----------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 7a3efaa567..ec89837b78 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -807,7 +807,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
             ID3D11Texture2D_AddRef(slicedTexture);
         } else {
             texDesc.Height = planes[plane].i_lines;
-            texDesc.Width  = planes[plane].i_pitch;
+            texDesc.Width  = planes[plane].i_pitch / p_chroma_desc->pixel_size;
             hr = ID3D11Device_CreateTexture2D( d3d_dev->d3ddevice, &texDesc, NULL, &textures[plane] );
             if (FAILED(hr)) {
                 msg_Err(obj, "CreateTexture2D failed for plane %d. (hr=0x%lX)", plane, hr);
diff --git a/modules/video_output/win32/d3d_dynamic_shader.c b/modules/video_output/win32/d3d_dynamic_shader.c
index 35ec32d7f8..c5b03532cd 100644
--- a/modules/video_output/win32/d3d_dynamic_shader.c
+++ b/modules/video_output/win32/d3d_dynamic_shader.c
@@ -428,20 +428,12 @@ HRESULT (D3D_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *c
             {
             case VLC_CODEC_I420_10L:
                 psz_sampler[0] =
-                       "float3 coords_2 = float3(coords.x/2, coords.y, coords.z);\n"
-                       "sample.x  = shaderTexture[0].Sample(samplerState, coords_2).x * 64;\n"
-                       "sample.y  = shaderTexture[1].Sample(samplerState, coords_2).x * 64;\n"
-                       "sample.z  = shaderTexture[2].Sample(samplerState, coords_2).x * 64;\n"
+                       "sample.x  = shaderTexture[0].Sample(samplerState, coords).x * 64;\n"
+                       "sample.y  = shaderTexture[1].Sample(samplerState, coords).x * 64;\n"
+                       "sample.z  = shaderTexture[2].Sample(samplerState, coords).x * 64;\n"
                        "sample.a  = 1;";
                 break;
             case VLC_CODEC_I444_16L:
-                psz_sampler[0] =
-                       "float3 coords_2 = float3(coords.x/2, coords.y, coords.z);\n"
-                       "sample.x  = shaderTexture[0].Sample(samplerState, coords_2).x;\n"
-                       "sample.y  = shaderTexture[1].Sample(samplerState, coords_2).x;\n"
-                       "sample.z  = shaderTexture[2].Sample(samplerState, coords_2).x;\n"
-                       "sample.a  = 1;";
-                break;
             case VLC_CODEC_I420:
                 psz_sampler[0] =
                        "sample.x  = shaderTexture[0].Sample(samplerState, coords).x;\n"



More information about the vlc-commits mailing list