video: Port video frame to the new tile size helper
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 12 Apr 2022 16:16:23 +0000 (12:16 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 2 May 2022 19:10:43 +0000 (19:10 +0000)
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>

subprojects/gst-plugins-base/gst-libs/gst/video/video-frame.c

index cbd6369..a86c70a 100644 (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);