From f8e3a2541506710607f8b7f8cd892c4b59ddb0ea Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 25 Dec 2013 10:45:11 +0100 Subject: [PATCH] video-frame: fix plane copy for index plane Move the code to handle the index plane in the _copy_plane. --- gst-libs/gst/video/video-frame.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c index ddfa90de4d..f7516d8c0a 100644 --- a/gst-libs/gst/video/video-frame.c +++ b/gst-libs/gst/video/video-frame.c @@ -235,14 +235,20 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src, sp = src->data[plane]; dp = dest->data[plane]; - ss = sinfo->stride[plane]; - ds = dinfo->stride[plane]; + if (plane == 1 && GST_VIDEO_FORMAT_INFO_HAS_PALETTE (sinfo->finfo)) { + ss = ds = 0; + w = 256 * 4; + h = 1; + } else { + ss = sinfo->stride[plane]; + ds = dinfo->stride[plane]; - /* FIXME. assumes subsampling of component N is the same as plane N, which is - * currently true for all formats we have but it might not be in the future. */ - w = GST_VIDEO_FRAME_COMP_WIDTH (dest, - plane) * GST_VIDEO_FRAME_COMP_PSTRIDE (dest, plane); - h = GST_VIDEO_FRAME_COMP_HEIGHT (dest, plane); + /* FIXME. assumes subsampling of component N is the same as plane N, which is + * currently true for all formats we have but it might not be in the future. */ + w = GST_VIDEO_FRAME_COMP_WIDTH (dest, + plane) * GST_VIDEO_FRAME_COMP_PSTRIDE (dest, plane); + h = GST_VIDEO_FRAME_COMP_HEIGHT (dest, plane); + } GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, h); @@ -281,10 +287,6 @@ gst_video_frame_copy (GstVideoFrame * dest, const GstVideoFrame * src) && dinfo->height == sinfo->height, FALSE); n_planes = dinfo->finfo->n_planes; - if (GST_VIDEO_FORMAT_INFO_HAS_PALETTE (sinfo->finfo)) { - memcpy (dest->data[1], src->data[1], 256 * 4); - n_planes = 1; - } for (i = 0; i < n_planes; i++) gst_video_frame_copy_plane (dest, src, i);