From d20306b6997d13417acf5169f46e20c09550c731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 22 Apr 2010 15:54:21 +0200 Subject: [PATCH] videobox: Add support for YVYU and reorder template caps --- gst/videobox/gstvideobox.c | 55 +++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/gst/videobox/gstvideobox.c b/gst/videobox/gstvideobox.c index 058be5a2a6..1c94372687 100644 --- a/gst/videobox/gstvideobox.c +++ b/gst/videobox/gstvideobox.c @@ -1713,6 +1713,17 @@ fill_yuy2 (GstVideoBoxFill fill_type, guint b_alpha, GstVideoFormat format, dest[j * 2 + 3] = v; } + dest += stride; + } + } else if (format == GST_VIDEO_FORMAT_YVYU) { + for (i = 0; i < height; i++) { + for (j = 0; j < width; j += 2) { + dest[j * 2 + 0] = y; + dest[j * 2 + 1] = v; + dest[j * 2 + 2] = y; + dest[j * 2 + 3] = u; + } + dest += stride; } } else { @@ -1775,6 +1786,22 @@ copy_yuy2_yuy2 (guint i_alpha, GstVideoFormat dest_format, guint8 * dest, dest += dest_stride; src += src_stride; } + } else if (src_format == GST_VIDEO_FORMAT_YVYU) { + for (i = 0; i < h; i++) { + for (j = 0; j < w; j += 2) { + y1 = src[j * 2 + 0]; + y2 = src[j * 2 + 2]; + v1 = v2 = src[j * 2 + 1]; + u1 = u2 = src[j * 2 + 3]; + + dest[j * 2 + 0] = APPLY_MATRIX (matrix, 0, y1, u1, v1); + dest[j * 2 + 1] = APPLY_MATRIX (matrix, 2, y1, u1, v1); + dest[j * 2 + 2] = APPLY_MATRIX (matrix, 0, y1, u2, v2); + dest[j * 2 + 3] = APPLY_MATRIX (matrix, 1, y2, u2, v2); + } + dest += dest_stride; + src += src_stride; + } } else { for (i = 0; i < h; i++) { for (j = 0; j < w; j += 2) { @@ -1828,15 +1855,16 @@ static GstStaticPadTemplate gst_video_box_src_template = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") ";" - GST_VIDEO_CAPS_YUV ("I420") ";" - GST_VIDEO_CAPS_YUV ("YV12") ";" - GST_VIDEO_CAPS_YUV ("YUY2") ";" - GST_VIDEO_CAPS_YUV ("UYVY") ";" - GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_BGRx ";" - GST_VIDEO_CAPS_xBGR ";" GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_ARGB ";" GST_VIDEO_CAPS_BGRA ";" GST_VIDEO_CAPS_ABGR ";" GST_VIDEO_CAPS_RGBA ";" + GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_BGRx ";" + GST_VIDEO_CAPS_xBGR ";" GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_BGR ";" + GST_VIDEO_CAPS_YUV ("YUY2") ";" + GST_VIDEO_CAPS_YUV ("YVYU") ";" + GST_VIDEO_CAPS_YUV ("UYVY") ";" + GST_VIDEO_CAPS_YUV ("I420") ";" + GST_VIDEO_CAPS_YUV ("YV12") ";" GST_VIDEO_CAPS_GRAY8 ";" GST_VIDEO_CAPS_GRAY16 ("BIG_ENDIAN") ";" GST_VIDEO_CAPS_GRAY16 ("LITTLE_ENDIAN")) @@ -1847,15 +1875,16 @@ static GstStaticPadTemplate gst_video_box_sink_template = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") ";" - GST_VIDEO_CAPS_YUV ("I420") ";" - GST_VIDEO_CAPS_YUV ("YV12") ";" - GST_VIDEO_CAPS_YUV ("YUY2") ";" - GST_VIDEO_CAPS_YUV ("UYVY") ";" - GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_BGRx ";" - GST_VIDEO_CAPS_xBGR ";" GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_ARGB ";" GST_VIDEO_CAPS_BGRA ";" GST_VIDEO_CAPS_ABGR ";" GST_VIDEO_CAPS_RGBA ";" + GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_BGRx ";" + GST_VIDEO_CAPS_xBGR ";" GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_BGR ";" + GST_VIDEO_CAPS_YUV ("YUY2") ";" + GST_VIDEO_CAPS_YUV ("YVYU") ";" + GST_VIDEO_CAPS_YUV ("UYVY") ";" + GST_VIDEO_CAPS_YUV ("I420") ";" + GST_VIDEO_CAPS_YUV ("YV12") ";" GST_VIDEO_CAPS_GRAY8 ";" GST_VIDEO_CAPS_GRAY16 ("BIG_ENDIAN") ";" GST_VIDEO_CAPS_GRAY16 ("LITTLE_ENDIAN")) @@ -2542,10 +2571,12 @@ gst_video_box_select_processing_functions (GstVideoBox * video_box) } break; case GST_VIDEO_FORMAT_YUY2: + case GST_VIDEO_FORMAT_YVYU: case GST_VIDEO_FORMAT_UYVY: video_box->fill = fill_yuy2; switch (video_box->in_format) { case GST_VIDEO_FORMAT_YUY2: + case GST_VIDEO_FORMAT_YVYU: case GST_VIDEO_FORMAT_UYVY: video_box->copy = copy_yuy2_yuy2; break;