From 5cd0601dd57fc4530290bc2f3b6e53af4e412a20 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Thu, 10 Dec 2015 12:33:52 +1100 Subject: [PATCH] glmemory: take subsampling into account for rectangle textures Rectangle textures don't use normalized coordinates so subsampling needs to be factored in explicitly. Fixes YUV => RGB conversion for rectangle textures. --- gst-libs/gst/gl/gstglmemory.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index 4970c4017e..c8bd9179f5 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -632,6 +632,18 @@ _calculate_unpack_length (GstGLMemory * gl_mem, GstGLContext * context) } } } + + if (gl_mem->tex_target == GST_GL_TEXTURE_TARGET_RECTANGLE) { + guint w_sub = + GST_VIDEO_FORMAT_INFO_W_SUB (gl_mem->info.finfo, gl_mem->plane); + guint h_sub = + GST_VIDEO_FORMAT_INFO_H_SUB (gl_mem->info.finfo, gl_mem->plane); + + if (w_sub) + gl_mem->tex_scaling[0] /= (1 << w_sub); + if (h_sub) + gl_mem->tex_scaling[1] /= (1 << h_sub); + } } static guint