[vlc-commits] direct3d11: fill the padding area with black on CPU mapped textures
Steve Lhomme
git at videolan.org
Wed Dec 13 11:15:39 CET 2017
vlc/vlc-3.0 | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Dec 12 18:22:57 2017 +0100| [578a1a16cbf0fbda8e598d0bff99ce267ac177c3] | committer: Hugo Beauzée-Luyssen
direct3d11: fill the padding area with black on CPU mapped textures
This will ease the artefacts on the bottom/right sides of the texture when
linear interpolation is used.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 3e869dd4e5beb6a8d4e4f24cd8148e28c695406b)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=578a1a16cbf0fbda8e598d0bff99ce267ac177c3
---
modules/video_output/win32/direct3d11.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 41644264a1..bf230fa23f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -403,9 +403,33 @@ static int Direct3D11MapPoolTexture(picture_t *picture)
return CommonUpdatePicture(picture, NULL, mappedResource.pData, mappedResource.RowPitch);
}
+/* add black pixels in the padding to ease the interpolation artefacts */
+static void EraseYUVBorders(int i_planes, plane_t planes[PICTURE_PLANE_MAX])
+{
+ for (int i = 0; i < i_planes; i++)
+ {
+ uint8_t val = (i == 0) ? 0x00 : 0x80;
+ if (planes[i].i_visible_lines < planes[i].i_lines)
+ {
+ memset(planes[i].p_pixels + (planes[i].i_visible_lines * planes[i].i_pitch), val, planes[i].i_visible_pitch);
+ }
+
+ if (planes[i].i_visible_pitch < planes[i].i_pitch)
+ {
+ for (int j=0; j<planes[i].i_visible_lines; j++)
+ {
+ planes[i].p_pixels[j * planes[i].i_pitch + (planes[i].i_visible_pitch + 0) ] = val;
+ if (i_planes == 2)
+ planes[i].p_pixels[j * planes[i].i_pitch + (planes[i].i_visible_pitch + 1) ] = val;
+ }
+ }
+ }
+}
+
static void Direct3D11UnmapPoolTexture(picture_t *picture)
{
picture_sys_t *p_sys = picture->p_sys;
+ EraseYUVBorders(picture->i_planes, picture->p);
ID3D11DeviceContext_Unmap(p_sys->context, p_sys->resource[KNOWN_DXGI_INDEX], 0);
}
@@ -1088,6 +1112,8 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
for (i = 0; i < picture->i_planes; i++)
plane_CopyPixels(&planes[i], &picture->p[i]);
+ EraseYUVBorders(picture->i_planes, planes);
+
for (i = 0; i < picture->i_planes; i++)
ID3D11DeviceContext_Unmap(sys->d3d_dev.d3dcontext, sys->stagingSys.resource[i], 0);
}
More information about the vlc-commits
mailing list