From ecfd247f02c5a98ce8cc288111fd7b1e7c6d9560 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 31 Oct 2010 23:07:43 +0100 Subject: [PATCH] [MOVED FROM BAD 41/68] colorspace: Add support for A420 --- gst/colorspace/colorspace.c | 25 +++++++++++++++++++++++-- gst/colorspace/gstcolorspace.c | 2 +- gst/colorspace/gstcolorspaceorc.orc | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/gst/colorspace/colorspace.c b/gst/colorspace/colorspace.c index c3b1a6b..fabcafb 100644 --- a/gst/colorspace/colorspace.c +++ b/gst/colorspace/colorspace.c @@ -707,6 +707,27 @@ putline_UYVP (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, } } +static void +getline_A420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, + int j) +{ + cogorc_getline_A420 (dest, + FRAME_GET_LINE (src, 0, j), + FRAME_GET_LINE (src, 1, j >> 1), + FRAME_GET_LINE (src, 2, j >> 1), + FRAME_GET_LINE (src, 3, j), convert->width); +} + +static void +putline_A420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, + int j) +{ + cogorc_putline_A420 (FRAME_GET_LINE (dest, 0, j), + FRAME_GET_LINE (dest, 1, j >> 1), + FRAME_GET_LINE (dest, 2, j >> 1), + FRAME_GET_LINE (dest, 3, j), src, convert->width / 2); +} + typedef struct { GstVideoFormat format; @@ -749,8 +770,8 @@ static const ColorspaceLine lines[] = { //{GST_VIDEO_FORMAT_BGR16, getline_BGR16, putline_BGR16}, //{GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15}, //{GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15}, - {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP} - //{GST_VIDEO_FORMAT_A420, getline_A420, putline_A420} + {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP}, + {GST_VIDEO_FORMAT_A420, getline_A420, putline_A420} }; static void diff --git a/gst/colorspace/gstcolorspace.c b/gst/colorspace/gstcolorspace.c index 2fefd1c..6900135 100644 --- a/gst/colorspace/gstcolorspace.c +++ b/gst/colorspace/gstcolorspace.c @@ -47,7 +47,7 @@ GST_DEBUG_CATEGORY (colorspace_performance); #define CSP_VIDEO_CAPS \ "video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , " \ "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \ - "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, v210 } ;" \ + "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, v210, A420 } ;" \ GST_VIDEO_CAPS_RGB";" \ GST_VIDEO_CAPS_BGR";" \ GST_VIDEO_CAPS_RGBx";" \ diff --git a/gst/colorspace/gstcolorspaceorc.orc b/gst/colorspace/gstcolorspaceorc.orc index df6773b..a5dea5f 100644 --- a/gst/colorspace/gstcolorspaceorc.orc +++ b/gst/colorspace/gstcolorspaceorc.orc @@ -1488,6 +1488,22 @@ mergewl uvuv, uv, uv x2 mergebw ay, c255, y x2 mergewl d, ay, uvuv +.function cogorc_getline_A420 +.dest 4 d guint8 +.source 1 y guint8 +.source 1 u guint8 +.source 1 v guint8 +.source 1 a guint8 +.temp 2 uv +.temp 2 ay +.temp 1 tu +.temp 1 tv + +loadupdb tu, u +loadupdb tv, v +mergebw uv, tu, tv +mergebw ay, a, y +mergewl d, ay, uv .function cogorc_putline_I420 .dest 2 y guint8 @@ -1678,4 +1694,24 @@ splitlw uv1, uv2, uvuv x2 avgub uv, uv1, uv2 swapw vu, uv +.function cogorc_putline_A420 +.dest 2 y guint8 +.dest 1 u guint8 +.dest 1 v guint8 +.dest 2 a guint8 +.source 8 ayuv guint8 +.temp 4 ay +.temp 4 uv +.temp 2 uu +.temp 2 vv +.temp 1 t1 +.temp 1 t2 +x2 splitlw uv, ay, ayuv +x2 select1wb y, ay +x2 select0wb a, ay +x2 splitwb vv, uu, uv +splitwb t1, t2, uu +avgub u, t1, t2 +splitwb t1, t2, vv +avgub v, t1, t2 -- 2.7.4