mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
image: add support for raw YUY2/UYVY image copies.
Implement raw image copies for YUY2 format. Add support for UYVY format too, with the same copy function as for YUY2. Even though components ordering differs, copying line strides is essentially the same. https://bugzilla.gnome.org/show_bug.cgi?id=703939 https://bugzilla.gnome.org/show_bug.cgi?id=703940 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
ed1bec1e43
commit
89321cd3c4
1 changed files with 23 additions and 0 deletions
|
@ -869,6 +869,25 @@ copy_image_YV12(
|
|||
}
|
||||
}
|
||||
|
||||
/* Copy YUY2 images */
|
||||
static void
|
||||
copy_image_YUY2(
|
||||
GstVaapiImageRaw *dst_image,
|
||||
GstVaapiImageRaw *src_image,
|
||||
const GstVaapiRectangle *rect
|
||||
)
|
||||
{
|
||||
guchar *dst, *src;
|
||||
guint dst_stride, src_stride;
|
||||
|
||||
/* YUV 4:2:2, full vertical resolution */
|
||||
dst_stride = dst_image->stride[0];
|
||||
dst = dst_image->pixels[0] + rect->y * dst_stride + rect->x * 2;
|
||||
src_stride = src_image->stride[0];
|
||||
src = src_image->pixels[0] + rect->y * src_stride + rect->x * 2;
|
||||
memcpy_pic(dst, dst_stride, src, src_stride, rect->width * 2, rect->height);
|
||||
}
|
||||
|
||||
/* Copy RGBA images */
|
||||
static void
|
||||
copy_image_RGBA(
|
||||
|
@ -924,6 +943,10 @@ copy_image(
|
|||
case GST_VIDEO_FORMAT_I420:
|
||||
copy_image_YV12(dst_image, src_image, rect);
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
copy_image_YUY2(dst_image, src_image, rect);
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_ARGB:
|
||||
case GST_VIDEO_FORMAT_RGBA:
|
||||
case GST_VIDEO_FORMAT_ABGR:
|
||||
|
|
Loading…
Reference in a new issue