mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-13 23:22:54 +00:00
opengl: Add NV12_4L4 conversion support
This format is produced notably by Hantro G1/G2 HW. Using a shader instead of the Hantro embedded converter helps reduce drastrictly the memory usage at a relatively small GPU overhead. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2190>
This commit is contained in:
parent
39615e4f3c
commit
79ea87f256
5 changed files with 18 additions and 3 deletions
|
@ -513,6 +513,7 @@ _drm_rgba_fourcc_from_info (const GstVideoInfo * info, int plane,
|
|||
case GST_VIDEO_FORMAT_NV16:
|
||||
case GST_VIDEO_FORMAT_NV61:
|
||||
case GST_VIDEO_FORMAT_NV12_16L32S:
|
||||
case GST_VIDEO_FORMAT_NV12_4L4:
|
||||
*out_format = plane == 0 ? GST_GL_RED : GST_GL_RG;
|
||||
return plane == 0 ? DRM_FORMAT_R8 : rg_fourcc;
|
||||
|
||||
|
|
|
@ -1129,7 +1129,8 @@ _init_supported_formats (GstGLContext * context, gboolean output,
|
|||
}
|
||||
|
||||
if (!context || USING_GLES3 (context) || USING_OPENGL30 (context)) {
|
||||
_append_value_string_list (supported_formats, "NV12_16L32S", NULL);
|
||||
_append_value_string_list (supported_formats, "NV12_16L32S", "NV12_4L4",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1763,6 +1764,7 @@ _get_n_textures (GstVideoFormat v_format)
|
|||
case GST_VIDEO_FORMAT_P016_LE:
|
||||
case GST_VIDEO_FORMAT_P016_BE:
|
||||
case GST_VIDEO_FORMAT_NV12_16L32S:
|
||||
case GST_VIDEO_FORMAT_NV12_4L4:
|
||||
return 2;
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
case GST_VIDEO_FORMAT_Y444:
|
||||
|
@ -2127,6 +2129,17 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
info->shader_tex_names[1] = "UVtex";
|
||||
break;
|
||||
}
|
||||
case GST_VIDEO_FORMAT_NV12_4L4:
|
||||
{
|
||||
char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_TILED_SEMI_PLANAR_to_RGB;
|
||||
info->frag_body = g_strdup_printf (templ_TILED_SEMI_PLANAR_to_RGB_BODY,
|
||||
4, 4, 2, 4, 'r', val2,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
info->shader_tex_names[1] = "UVtex";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ struct _GstGLColorConvertClass
|
|||
"xBGR, ARGB, ABGR, GBRA, GBR, RGBP, BGRP, Y444, I420, YV12, Y42B, " \
|
||||
"Y41B, NV12, NV21, NV16, NV61, YUY2, UYVY, Y210, AYUV, " \
|
||||
"VUYA, Y410, GRAY8, GRAY16_LE, GRAY16_BE, " \
|
||||
"RGB16, BGR16, ARGB64, A420, AV12, NV12_16L32S" \
|
||||
"RGB16, BGR16, ARGB64, A420, AV12, NV12_16L32S, NV12_4L4" \
|
||||
GST_GL_COLOR_CONVERT_EXT_FORMATS "}"
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,6 +193,7 @@ gst_gl_format_from_video_info (GstGLContext * context,
|
|||
case GST_VIDEO_FORMAT_NV16:
|
||||
case GST_VIDEO_FORMAT_NV61:
|
||||
case GST_VIDEO_FORMAT_NV12_16L32S:
|
||||
case GST_VIDEO_FORMAT_NV12_4L4:
|
||||
n_plane_components = plane == 0 ? 1 : 2;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_AV12:
|
||||
|
|
|
@ -64,7 +64,7 @@ GType gst_gl_memory_allocator_get_type(void);
|
|||
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
|
||||
"{ RGBA, BGRA, RGBx, BGRx, ARGB, ABGR, xRGB, xBGR, GBRA, GBR, RGBP, BGRP, RGB, BGR, RGB16, BGR16, " \
|
||||
"AYUV, VUYA, Y410, I420, YV12, NV12, NV21, NV16, NV61, YUY2, UYVY, Y210, Y41B, " \
|
||||
"Y42B, Y444, GRAY8, GRAY16_LE, GRAY16_BE, ARGB64, A420, AV12, NV12_16L32S" \
|
||||
"Y42B, Y444, GRAY8, GRAY16_LE, GRAY16_BE, ARGB64, A420, AV12, NV12_16L32S, NV12_4L4" \
|
||||
GST_GL_MEMORY_VIDEO_EXT_FORMATS "}"
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue