gl/upload: switch the 'master' texture for YUY2, UYVY

From d4bcef3204 on, using a RGBA
texture to hold the data causes the glmemory to have half width
and a scaling of [2, 1].  Using a LA texture solves this problem
however cannot be attached to the framebuffer for copying into
a RGBA texture.  Which will be solved by moving to EXT_texture_rg.

https://bugzilla.gnome.org/show_bug.cgi?id=728890
This commit is contained in:
Matthew Waters 2014-05-21 10:26:21 +10:00 committed by Tim-Philipp Müller
parent 51fdeef98b
commit 313dfbb500
3 changed files with 10 additions and 15 deletions

View file

@ -727,12 +727,12 @@ _YUV_to_RGB (GstGLColorConvert * convert)
info->frag_prog = g_strdup_printf (frag_YUY2_UYVY_to_RGB, 'r', 'g', 'a',
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
info->in_n_textures = 1;
info->shader_tex_names[1] = "Ytex";
info->shader_tex_names[0] = "UVtex";
info->shader_tex_names[0] = "Ytex";
info->shader_tex_names[1] = "UVtex";
convert->priv->scratch =
(GstGLMemory *) gst_gl_memory_alloc (convert->context,
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA,
GST_VIDEO_INFO_WIDTH (&convert->in_info),
GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
GST_VIDEO_INFO_COMP_WIDTH (&convert->in_info, 1),
GST_VIDEO_INFO_HEIGHT (&convert->in_info),
GST_VIDEO_INFO_PLANE_STRIDE (&convert->in_info, 0));
break;
@ -754,12 +754,12 @@ _YUV_to_RGB (GstGLColorConvert * convert)
info->frag_prog = g_strdup_printf (frag_YUY2_UYVY_to_RGB, 'a', 'r', 'b',
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
info->in_n_textures = 1;
info->shader_tex_names[1] = "Ytex";
info->shader_tex_names[0] = "UVtex";
info->shader_tex_names[0] = "Ytex";
info->shader_tex_names[1] = "UVtex";
convert->priv->scratch =
(GstGLMemory *) gst_gl_memory_alloc (convert->context,
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA,
GST_VIDEO_INFO_WIDTH (&convert->in_info),
GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
GST_VIDEO_INFO_COMP_WIDTH (&convert->in_info, 1),
GST_VIDEO_INFO_HEIGHT (&convert->in_info),
GST_VIDEO_INFO_PLANE_STRIDE (&convert->in_info, 0));
break;

View file

@ -208,7 +208,7 @@ gst_gl_texture_type_from_format (GstVideoFormat v_format, guint plane)
break;
case GST_VIDEO_FORMAT_YUY2:
case GST_VIDEO_FORMAT_UYVY:
return GST_VIDEO_GL_TEXTURE_TYPE_RGBA;
return GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA;
break;
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV21:
@ -233,11 +233,6 @@ gst_gl_texture_type_from_format (GstVideoFormat v_format, guint plane)
static inline guint
_get_plane_width (GstVideoInfo * info, guint plane)
{
if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_YUY2
|| GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_UYVY) {
return GST_VIDEO_INFO_COMP_WIDTH (info, 1);
}
if (GST_VIDEO_INFO_IS_YUV (info))
/* For now component width and plane width are the same and the
* plane-component mapping matches

View file

@ -287,7 +287,7 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
upload->out_tex = (GstGLMemory *) gst_gl_memory_alloc (upload->context,
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),
GST_VIDEO_INFO_HEIGHT (&upload->in_info),
GST_VIDEO_INFO_PLANE_STRIDE (&upload->in_info, 0));
4 * GST_VIDEO_INFO_WIDTH (&upload->in_info));
GST_LOG_OBJECT (upload, "Attempting upload with GstGLMemory");
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->in_info); i++) {