From 02c10e5babc00d4e972992ad07c03a49ab14e450 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 14 Jul 2020 10:42:01 -0400 Subject: [PATCH] rawvideoparse: Fix tiling support When using tile format, the stride has a different meaning. It used the MSB and LSB 16bits to encode respectively the width and height in number of tiles. This issue was introduce with commit e5b70d384c which was fixing missing size recalculation when strides and offset is updated. Part-of: --- gst/rawparse/gstrawvideoparse.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gst/rawparse/gstrawvideoparse.c b/gst/rawparse/gstrawvideoparse.c index cb090af00f..2b77f055ba 100644 --- a/gst/rawparse/gstrawvideoparse.c +++ b/gst/rawparse/gstrawvideoparse.c @@ -1154,10 +1154,19 @@ gst_raw_video_parse_update_info (GstRawVideoParseConfig * config) } } - last_plane_size = - GST_VIDEO_INFO_PLANE_STRIDE (info, - last_plane) * GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info->finfo, - last_plane, config->height); + if (GST_VIDEO_FORMAT_INFO_IS_TILED (info->finfo)) { + gint stride = GST_VIDEO_INFO_PLANE_STRIDE (info, last_plane); + gint x_tiles = GST_VIDEO_TILE_X_TILES (stride); + gint y_tiles = GST_VIDEO_TILE_Y_TILES (stride); + gint tile_width = 1 << GST_VIDEO_FORMAT_INFO_TILE_WS (info->finfo); + gint tile_height = 1 << GST_VIDEO_FORMAT_INFO_TILE_HS (info->finfo); + last_plane_size = x_tiles * y_tiles * tile_width * tile_height; + } else { + last_plane_size = + GST_VIDEO_INFO_PLANE_STRIDE (info, + last_plane) * GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info->finfo, + last_plane, config->height); + } GST_VIDEO_INFO_SIZE (info) = last_plane_offset + last_plane_size;