video: Port video frame to the new tile size helper

This is now moved to the library, so it can be used in multiple
places.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2190>
This commit is contained in:
Nicolas Dufresne 2022-04-12 12:16:23 -04:00 committed by GStreamer Marge Bot
parent 8fcfc44c15
commit 6a6c3687f1

View file

@ -278,27 +278,6 @@ gst_video_frame_unmap (GstVideoFrame * frame)
gst_buffer_unref (frame->buffer);
}
static void
scale_tile_shifts (const GstVideoFormatInfo * finfo, gint plane, guint * ws,
guint * hs)
{
gint comp[GST_VIDEO_MAX_COMPONENTS];
gint i;
gst_video_format_info_component (finfo, plane, comp);
/* scale the tile size according to the subsampling */
*ws -= finfo->w_sub[comp[0]];
*hs -= finfo->h_sub[comp[0]];
/* for each additional component in the same plane, double the tile width,
* this should provide the appropriate tile size when the tile size varies
* base on the subsampling. */
for (i = 1; i < GST_VIDEO_MAX_COMPONENTS && comp[i] >= 0; i++)
*ws += 1;
}
/**
* gst_video_frame_copy_plane:
* @dest: a #GstVideoFrame
@ -367,16 +346,9 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
guint i, j, ws, hs, ts;
GstVideoTileMode mode;
ws = GST_VIDEO_FORMAT_INFO_TILE_WS (finfo);
hs = GST_VIDEO_FORMAT_INFO_TILE_HS (finfo);
if (GST_VIDEO_FORMAT_INFO_HAS_SUBTILES (finfo))
scale_tile_shifts (finfo, plane, &ws, &hs);
tile_size = gst_video_format_info_get_tile_sizes (finfo, plane, &ws, &hs);
ts = ws + hs;
tile_size = 1 << ts;
mode = GST_VIDEO_FORMAT_INFO_TILE_MODE (finfo);
sx_tiles = GST_VIDEO_TILE_X_TILES (ss);