gl: Add support for P016 format

All implementation for P010_10LE/BE can be reused.
This commit is contained in:
Seungha Yang 2019-08-08 11:43:03 +09:00
parent c28721d89f
commit fe9c38244f
5 changed files with 14 additions and 6 deletions

View file

@ -530,10 +530,12 @@ _drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane,
return DRM_FORMAT_RGBA1010102;
case GST_VIDEO_FORMAT_P010_10LE:
case GST_VIDEO_FORMAT_P016_LE:
*out_format = plane == 0 ? GST_GL_R16 : GST_GL_RG16;
return plane == 0 ? DRM_FORMAT_R16 : DRM_FORMAT_GR1616;
case GST_VIDEO_FORMAT_P010_10BE:
case GST_VIDEO_FORMAT_P016_BE:
*out_format = plane == 0 ? GST_GL_R16 : GST_GL_RG16;
return plane == 0 ? DRM_FORMAT_R16 : DRM_FORMAT_RG1616;

View file

@ -960,9 +960,9 @@ _init_supported_formats (GstGLContext * context, gboolean output,
if (!context || (gst_gl_format_is_supported (context, GST_GL_R16) &&
gst_gl_format_is_supported (context, GST_GL_RG16)))
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
_append_value_string_list (supported_formats, "P010_10LE", NULL);
_append_value_string_list (supported_formats, "P010_10LE", "P016_LE", NULL);
#else
_append_value_string_list (supported_formats, "P010_10BE", NULL);
_append_value_string_list (supported_formats, "P010_10BE", "P016_BE", NULL);
#endif
}
@ -1557,6 +1557,8 @@ _get_n_textures (GstVideoFormat v_format)
case GST_VIDEO_FORMAT_NV21:
case GST_VIDEO_FORMAT_P010_10LE:
case GST_VIDEO_FORMAT_P010_10BE:
case GST_VIDEO_FORMAT_P016_LE:
case GST_VIDEO_FORMAT_P016_BE:
return 2;
case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_Y444:
@ -1717,6 +1719,8 @@ _YUV_to_RGB (GstGLColorConvert * convert)
}
case GST_VIDEO_FORMAT_P010_10LE:
case GST_VIDEO_FORMAT_P010_10BE:
case GST_VIDEO_FORMAT_P016_LE:
case GST_VIDEO_FORMAT_P016_BE:
{
info->templ = &templ_SEMI_PLANAR_to_RGB;
info->frag_body =

View file

@ -88,9 +88,9 @@ struct _GstGLColorConvertClass
* The currently supported formats that can be converted
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define COLOR_CONVERT_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE"
#define COLOR_CONVERT_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE, P016_LE"
#else
#define COLOR_CONVERT_EXT_FORMATS ", P010_10BE"
#define COLOR_CONVERT_EXT_FORMATS ", P010_10BE, P016_BE"
#endif
#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \

View file

@ -205,6 +205,8 @@ gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
return GST_GL_RGB10_A2;
case GST_VIDEO_FORMAT_P010_10LE:
case GST_VIDEO_FORMAT_P010_10BE:
case GST_VIDEO_FORMAT_P016_LE:
case GST_VIDEO_FORMAT_P016_BE:
return plane == 0 ? GST_GL_R16 : GST_GL_RG16;
default:
n_plane_components = 4;

View file

@ -51,9 +51,9 @@ GType gst_gl_memory_allocator_get_type(void);
* List of video formats that are supported by #GstGLMemory
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define MEMORY_VIDEO_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE"
#define MEMORY_VIDEO_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE, P016_LE"
#else
#define MEMORY_VIDEO_EXT_FORMATS ", P010_10BE"
#define MEMORY_VIDEO_EXT_FORMATS ", P010_10BE, P016_BE"
#endif
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \