mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
glmemory: use the plane offsets to compute the size of the data pointer
Certain elements expect that there be a certain number of lines that they can write into. e.g. for odd heights, I420, YV12, NV12, NV21 (and others) Y lines are expected to have exactly twice the number of U/UV lines. https://bugzilla.gnome.org/show_bug.cgi?id=733717
This commit is contained in:
parent
c216799b20
commit
9426c0793e
1 changed files with 14 additions and 5 deletions
|
@ -345,6 +345,15 @@ _get_plane_height (GstVideoInfo * info, guint plane)
|
||||||
return GST_VIDEO_INFO_HEIGHT (info);
|
return GST_VIDEO_INFO_HEIGHT (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline gsize
|
||||||
|
_get_plane_data_size (GstVideoInfo * info, guint plane)
|
||||||
|
{
|
||||||
|
if (GST_VIDEO_INFO_N_PLANES (info) == plane + 1)
|
||||||
|
return info->offset[0] + info->size - info->offset[plane];
|
||||||
|
|
||||||
|
return info->offset[plane + 1] - info->offset[plane];
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct _GenTexture
|
typedef struct _GenTexture
|
||||||
{
|
{
|
||||||
guint width, height;
|
guint width, height;
|
||||||
|
@ -566,9 +575,9 @@ _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
|
||||||
{
|
{
|
||||||
gsize maxsize;
|
gsize maxsize;
|
||||||
|
|
||||||
maxsize =
|
g_return_if_fail (plane < GST_VIDEO_INFO_N_PLANES (info));
|
||||||
GST_VIDEO_INFO_PLANE_STRIDE (info, plane) * _get_plane_height (info,
|
|
||||||
plane);
|
maxsize = _get_plane_data_size (info, plane);
|
||||||
|
|
||||||
gst_memory_init (GST_MEMORY_CAST (mem), GST_MEMORY_FLAG_NO_SHARE,
|
gst_memory_init (GST_MEMORY_CAST (mem), GST_MEMORY_FLAG_NO_SHARE,
|
||||||
allocator, parent, maxsize, 0, 0, maxsize);
|
allocator, parent, maxsize, 0, 0, maxsize);
|
||||||
|
@ -587,8 +596,8 @@ _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
|
||||||
_calculate_unpack_length (mem);
|
_calculate_unpack_length (mem);
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture memory:%p format:%u "
|
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture memory:%p format:%u "
|
||||||
"dimensions:%ux%u", mem, mem->tex_type, mem->tex_width,
|
"dimensions:%ux%u size:%" G_GSIZE_FORMAT, mem, mem->tex_type,
|
||||||
GL_MEM_HEIGHT (mem));
|
mem->tex_width, GL_MEM_HEIGHT (mem), maxsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstGLMemory *
|
static GstGLMemory *
|
||||||
|
|
Loading…
Reference in a new issue