From e60a94c27d7fdca725b50ce37cf2f829265d8f33 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 16 Nov 2022 15:17:24 -0500 Subject: [PATCH] video-frame: Avoid using tile width The tile width in pixel is not always available. Notably for 8L128 10bit format, the tile is 8x128 bytes, and the pixel format is fully packed. That means that the tile contains at least 6 pixels per line, but it also hold some bits of the pixel from the same line on the previous or next tile. Part-of: --- .../gst-plugins-base/gst-libs/gst/video/video-frame.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/video-frame.c b/subprojects/gst-plugins-base/gst-libs/gst/video/video-frame.c index 0e7e49c332..bfb57e47e1 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/video-frame.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/video-frame.c @@ -349,12 +349,10 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src, if (GST_VIDEO_FORMAT_INFO_IS_TILED (finfo)) { gint tile_size; gint sx_tiles, sy_tiles, dx_tiles, dy_tiles; - guint i, j, tw, th; + guint i, j; GstVideoTileMode mode; tile_size = GST_VIDEO_FORMAT_INFO_TILE_SIZE (finfo, plane); - tw = GST_VIDEO_FORMAT_INFO_TILE_WIDTH (finfo, plane); - th = GST_VIDEO_FORMAT_INFO_TILE_HEIGHT (finfo, plane); mode = GST_VIDEO_FORMAT_INFO_TILE_MODE (finfo); @@ -365,8 +363,8 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src, dy_tiles = GST_VIDEO_TILE_Y_TILES (ds); /* this is the amount of tiles to copy */ - w = ((w - 1) / tw) + 1; - h = ((h - 1) / th) + 1; + w = MIN (sx_tiles, dx_tiles); + h = MIN (sy_tiles, dy_tiles); /* FIXME can possibly do better when no retiling is needed, it depends on * the stride and the tile_size */