gl: add support for Y412_LE / Y412_BE format

Reuse Y410 code for Y412_LE / Y412_BE except gl format. The gl format is
RGBA16 for Y412_LE / Y412_BE.

Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y412_LE ! glimagesink
This commit is contained in:
Haihao Xiang 2020-04-01 13:55:50 +08:00
parent 5f859203ad
commit 77db5a0e21
4 changed files with 23 additions and 4 deletions

View file

@ -951,6 +951,14 @@ _init_supported_formats (GstGLContext * context, gboolean output,
_append_value_string_list (supported_formats, "Y212_LE", NULL);
#else
_append_value_string_list (supported_formats, "Y212_BE", NULL);
#endif
}
if (!context || gst_gl_format_is_supported (context, GST_GL_RGBA16)) {
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
_append_value_string_list (supported_formats, "Y412_LE", NULL);
#else
_append_value_string_list (supported_formats, "Y412_BE", NULL);
#endif
}
}
@ -1545,6 +1553,8 @@ _get_n_textures (GstVideoFormat v_format)
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_Y212_LE:
case GST_VIDEO_FORMAT_Y212_BE:
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y412_BE:
return 1;
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV21:
@ -1650,6 +1660,8 @@ _YUV_to_RGB (GstGLColorConvert * convert)
info->shader_tex_names[0] = "tex";
break;
case GST_VIDEO_FORMAT_Y410:
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y412_BE:
info->templ = &templ_AYUV_to_RGB;
info->frag_body = g_strdup_printf (templ_AYUV_to_RGB_BODY, "yxz", 'w',
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
@ -1801,6 +1813,8 @@ _RGB_to_YUV (GstGLColorConvert * convert)
info->out_n_textures = 1;
break;
case GST_VIDEO_FORMAT_Y410:
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y412_BE:
alpha = _is_RGBx (in_format) ? "1.0" : "texel.a";
info->templ = &templ_RGB_to_AYUV;
info->frag_body = g_strdup_printf (templ_RGB_to_AYUV_BODY, pixel_order[0],

View file

@ -89,9 +89,10 @@ struct _GstGLColorConvertClass
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define COLOR_CONVERT_EXT_FORMATS \
", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE"
", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE"
#else
#define COLOR_CONVERT_EXT_FORMATS ", P010_10BE, P012_BE, P016_BE, Y212_BE"
#define COLOR_CONVERT_EXT_FORMATS \
", P010_10BE, P012_BE, P016_BE, Y212_BE, Y412_BE"
#endif
#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \

View file

@ -217,6 +217,9 @@ gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
case GST_VIDEO_FORMAT_Y212_LE:
case GST_VIDEO_FORMAT_Y212_BE:
return GST_GL_RG16;
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y412_BE:
return GST_GL_RGBA16;
default:
n_plane_components = 4;
g_assert_not_reached ();

View file

@ -52,9 +52,10 @@ GType gst_gl_memory_allocator_get_type(void);
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define MEMORY_VIDEO_EXT_FORMATS \
", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE"
", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE"
#else
#define MEMORY_VIDEO_EXT_FORMATS ", P010_10BE, P012_BE, P016_BE, Y212_BE"
#define MEMORY_VIDEO_EXT_FORMATS \
", P010_10BE, P012_BE, P016_BE, Y212_BE, Y412_BE"
#endif
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \