Commit 1176a561 authored by Seungha Yang's avatar Seungha Yang

compositor: Add support for VUYA format

Reversed order of AYUV format. Most of core methods are prepared
already.
parent 0bfb8623
Pipeline #57657 passed with stages
in 75 minutes and 28 seconds
......@@ -38,7 +38,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_compositor_blend_debug);
/* Below are the implementations of everything */
/* A32 is for AYUV, ARGB and BGRA */
/* A32 is for AYUV, VUYA, ARGB and BGRA */
#define BLEND_A32(name, method, LOOP) \
static void \
method##_ ##name (GstVideoFrame * srcframe, gint xpos, gint ypos, \
......@@ -194,6 +194,7 @@ fill_checker_##name##_c (GstVideoFrame * frame) \
A32_CHECKER_C (argb, TRUE, 0, 1, 2, 3);
A32_CHECKER_C (bgra, TRUE, 3, 2, 1, 0);
A32_CHECKER_C (ayuv, FALSE, 0, 1, 2, 3);
A32_CHECKER_C (vuya, FALSE, 3, 2, 1, 0);
#define YUV_TO_R(Y,U,V) (CLAMP (1.164 * (Y - 16) + 1.596 * (V - 128), 0, 255))
#define YUV_TO_G(Y,U,V) (CLAMP (1.164 * (Y - 16) - 0.813 * (V - 128) - 0.391 * (U - 128), 0, 255))
......@@ -231,6 +232,7 @@ A32_COLOR (bgra, TRUE, 0, 8, 16, 24);
A32_COLOR (abgr, TRUE, 24, 0, 8, 16);
A32_COLOR (rgba, TRUE, 0, 24, 16, 8);
A32_COLOR (ayuv, FALSE, 24, 16, 8, 0);
A32_COLOR (vuya, FALSE, 0, 8, 16, 24);
/* Y444, Y42B, I420, YV12, Y41B */
#define PLANAR_YUV_BLEND(format_name,format_enum,x_round,y_round,MEMCPY,BLENDLOOP) \
......@@ -1022,6 +1024,7 @@ FillCheckerFunction gst_compositor_fill_checker_argb;
FillCheckerFunction gst_compositor_fill_checker_bgra;
/* ABGR is equal to ARGB, RGBA is equal to BGRA */
FillCheckerFunction gst_compositor_fill_checker_ayuv;
FillCheckerFunction gst_compositor_fill_checker_vuya;
FillCheckerFunction gst_compositor_fill_checker_y444;
FillCheckerFunction gst_compositor_fill_checker_y42b;
FillCheckerFunction gst_compositor_fill_checker_i420;
......@@ -1042,6 +1045,7 @@ FillColorFunction gst_compositor_fill_color_bgra;
FillColorFunction gst_compositor_fill_color_abgr;
FillColorFunction gst_compositor_fill_color_rgba;
FillColorFunction gst_compositor_fill_color_ayuv;
FillColorFunction gst_compositor_fill_color_vuya;
FillColorFunction gst_compositor_fill_color_y444;
FillColorFunction gst_compositor_fill_color_y42b;
FillColorFunction gst_compositor_fill_color_i420;
......@@ -1082,6 +1086,7 @@ gst_compositor_init_blend (void)
gst_compositor_fill_checker_argb = GST_DEBUG_FUNCPTR (fill_checker_argb_c);
gst_compositor_fill_checker_bgra = GST_DEBUG_FUNCPTR (fill_checker_bgra_c);
gst_compositor_fill_checker_ayuv = GST_DEBUG_FUNCPTR (fill_checker_ayuv_c);
gst_compositor_fill_checker_vuya = GST_DEBUG_FUNCPTR (fill_checker_vuya_c);
gst_compositor_fill_checker_i420 = GST_DEBUG_FUNCPTR (fill_checker_i420);
gst_compositor_fill_checker_nv12 = GST_DEBUG_FUNCPTR (fill_checker_nv12);
gst_compositor_fill_checker_nv21 = GST_DEBUG_FUNCPTR (fill_checker_nv21);
......@@ -1098,6 +1103,7 @@ gst_compositor_init_blend (void)
gst_compositor_fill_color_abgr = GST_DEBUG_FUNCPTR (fill_color_abgr);
gst_compositor_fill_color_rgba = GST_DEBUG_FUNCPTR (fill_color_rgba);
gst_compositor_fill_color_ayuv = GST_DEBUG_FUNCPTR (fill_color_ayuv);
gst_compositor_fill_color_vuya = GST_DEBUG_FUNCPTR (fill_color_vuya);
gst_compositor_fill_color_i420 = GST_DEBUG_FUNCPTR (fill_color_i420);
gst_compositor_fill_color_yv12 = GST_DEBUG_FUNCPTR (fill_color_yv12);
gst_compositor_fill_color_nv12 = GST_DEBUG_FUNCPTR (fill_color_nv12);
......
......@@ -46,12 +46,14 @@ typedef void (*FillColorFunction) (GstVideoFrame * frame, gint c1, gint c2, gint
extern BlendFunction gst_compositor_blend_argb;
extern BlendFunction gst_compositor_blend_bgra;
#define gst_compositor_blend_ayuv gst_compositor_blend_argb
#define gst_compositor_blend_vuya gst_compositor_blend_bgra
#define gst_compositor_blend_abgr gst_compositor_blend_argb
#define gst_compositor_blend_rgba gst_compositor_blend_bgra
extern BlendFunction gst_compositor_overlay_argb;
extern BlendFunction gst_compositor_overlay_bgra;
#define gst_compositor_overlay_ayuv gst_compositor_overlay_argb
#define gst_compositor_overlay_vuya gst_compositor_overlay_bgra
#define gst_compositor_overlay_abgr gst_compositor_overlay_argb
#define gst_compositor_overlay_rgba gst_compositor_overlay_bgra
extern BlendFunction gst_compositor_blend_i420;
......@@ -76,6 +78,7 @@ extern FillCheckerFunction gst_compositor_fill_checker_argb;
extern FillCheckerFunction gst_compositor_fill_checker_bgra;
#define gst_compositor_fill_checker_rgba gst_compositor_fill_checker_bgra
extern FillCheckerFunction gst_compositor_fill_checker_ayuv;
extern FillCheckerFunction gst_compositor_fill_checker_vuya;
extern FillCheckerFunction gst_compositor_fill_checker_i420;
#define gst_compositor_fill_checker_yv12 gst_compositor_fill_checker_i420
extern FillCheckerFunction gst_compositor_fill_checker_nv12;
......@@ -98,6 +101,7 @@ extern FillColorFunction gst_compositor_fill_color_abgr;
extern FillColorFunction gst_compositor_fill_color_bgra;
extern FillColorFunction gst_compositor_fill_color_rgba;
extern FillColorFunction gst_compositor_fill_color_ayuv;
extern FillColorFunction gst_compositor_fill_color_vuya;
extern FillColorFunction gst_compositor_fill_color_i420;
extern FillColorFunction gst_compositor_fill_color_yv12;
extern FillColorFunction gst_compositor_fill_color_nv12;
......
......@@ -24,7 +24,7 @@
* SECTION:element-compositor
* @title: compositor
*
* Compositor can accept AYUV, ARGB and BGRA video streams. For each of the requested
* Compositor can accept AYUV, VUYA, ARGB and BGRA video streams. For each of the requested
* sink pads it will compare the incoming geometry and framerate to define the
* output parameters. Indeed output video frames will have the geometry of the
* biggest incoming video stream and the framerate of the fastest incoming one.
......@@ -103,7 +103,7 @@
GST_DEBUG_CATEGORY_STATIC (gst_compositor_debug);
#define GST_CAT_DEFAULT gst_compositor_debug
#define FORMATS " { AYUV, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, "\
#define FORMATS " { AYUV, VUYA, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, "\
" YVYU, I420, YV12, NV12, NV21, Y41B, RGB, BGR, xRGB, xBGR, "\
" RGBx, BGRx } "
......@@ -599,6 +599,13 @@ set_functions (GstCompositor * self, GstVideoInfo * info)
self->fill_color = gst_compositor_fill_color_ayuv;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_VUYA:
self->blend = gst_compositor_blend_vuya;
self->overlay = gst_compositor_overlay_vuya;
self->fill_checker = gst_compositor_fill_checker_vuya;
self->fill_color = gst_compositor_fill_color_vuya;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_ARGB:
self->blend = gst_compositor_blend_argb;
self->overlay = gst_compositor_overlay_argb;
......
......@@ -47,7 +47,7 @@ static GstCaps *
_compositor_get_all_supported_caps (void)
{
return gst_caps_from_string (GST_VIDEO_CAPS_MAKE
(" { AYUV, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, "
(" { AYUV, VUYA, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, "
" YVYU, I420, YV12, NV12, NV21, Y41B, RGB, BGR, xRGB, xBGR, "
" RGBx, BGRx } "));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment