mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
ext/mpeg2dec/gstmpeg2dec.*: libmpeg2 requires its output buffers to start at a 16byte aligned address or the altivec ...
Original commit message from CVS: Patch by: Sebastian Droege <slomo at ubuntu dot com> * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_finalize), (gst_mpeg2dec_alloc_buffer), (init_dummybuf), (handle_slice): * ext/mpeg2dec/gstmpeg2dec.h: libmpeg2 requires its output buffers to start at a 16byte aligned address or the altivec optimizations will explode.
This commit is contained in:
parent
2a3809fcc5
commit
520f74867f
3 changed files with 29 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2006-11-03 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
Patch by: Sebastian Droege <slomo at ubuntu dot com>
|
||||||
|
|
||||||
|
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_finalize),
|
||||||
|
(gst_mpeg2dec_alloc_buffer), (init_dummybuf), (handle_slice):
|
||||||
|
* ext/mpeg2dec/gstmpeg2dec.h:
|
||||||
|
libmpeg2 requires its output buffers to start at a 16byte aligned
|
||||||
|
address or the altivec optimizations will explode.
|
||||||
|
|
||||||
2006-10-19 Tim-Philipp Müller <tim at centricular dot net>
|
2006-10-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read):
|
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read):
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
|
|
||||||
#include "gstmpeg2dec.h"
|
#include "gstmpeg2dec.h"
|
||||||
|
|
||||||
|
/* libmpeg2 needs a 16-byte aligned buffer start address. This rounds the
|
||||||
|
* given pointer up to a multiply of 16 */
|
||||||
|
#define ALIGN_16(p) ((void *)(((uintptr_t)(p) + 15) & ~((uintptr_t)15)))
|
||||||
|
|
||||||
/* mpeg2dec changed a struct name after 0.3.1, here's a workaround */
|
/* mpeg2dec changed a struct name after 0.3.1, here's a workaround */
|
||||||
/* mpeg2dec also only defined MPEG2_RELEASE after 0.3.1
|
/* mpeg2dec also only defined MPEG2_RELEASE after 0.3.1
|
||||||
#if MPEG2_RELEASE < MPEG2_VERSION(0,3,2)
|
#if MPEG2_RELEASE < MPEG2_VERSION(0,3,2)
|
||||||
|
@ -258,8 +262,8 @@ gst_mpeg2dec_finalize (GObject * object)
|
||||||
mpeg2dec->decoder = NULL;
|
mpeg2dec->decoder = NULL;
|
||||||
}
|
}
|
||||||
clear_buffers (mpeg2dec);
|
clear_buffers (mpeg2dec);
|
||||||
g_free (mpeg2dec->dummybuf[0]);
|
g_free (mpeg2dec->dummybuf[3]);
|
||||||
mpeg2dec->dummybuf[0] = NULL;
|
mpeg2dec->dummybuf[3] = NULL;
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -468,10 +472,15 @@ gst_mpeg2dec_alloc_buffer (GstMpeg2dec * mpeg2dec, gint64 offset,
|
||||||
guint8 *buf[3];
|
guint8 *buf[3];
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
ret = gst_mpeg2dec_alloc_sized_buf (mpeg2dec, mpeg2dec->size, &outbuf);
|
ret = gst_mpeg2dec_alloc_sized_buf (mpeg2dec, mpeg2dec->size + 16, &outbuf);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto no_buffer;
|
goto no_buffer;
|
||||||
|
|
||||||
|
/* 16byte-align the buffer start address. As u_offs and v_offs are
|
||||||
|
* divideable by 16 without a rest it's only needed for the start */
|
||||||
|
GST_BUFFER_DATA (outbuf) = ALIGN_16 (GST_BUFFER_DATA (outbuf));
|
||||||
|
GST_BUFFER_SIZE (outbuf) = mpeg2dec->size;
|
||||||
|
|
||||||
buf[0] = GST_BUFFER_DATA (outbuf);
|
buf[0] = GST_BUFFER_DATA (outbuf);
|
||||||
buf[1] = buf[0] + mpeg2dec->u_offs;
|
buf[1] = buf[0] + mpeg2dec->u_offs;
|
||||||
buf[2] = buf[0] + mpeg2dec->v_offs;
|
buf[2] = buf[0] + mpeg2dec->v_offs;
|
||||||
|
@ -589,9 +598,13 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec * mpeg2dec)
|
||||||
static void
|
static void
|
||||||
init_dummybuf (GstMpeg2dec * mpeg2dec)
|
init_dummybuf (GstMpeg2dec * mpeg2dec)
|
||||||
{
|
{
|
||||||
g_free (mpeg2dec->dummybuf[0]);
|
g_free (mpeg2dec->dummybuf[3]);
|
||||||
|
|
||||||
mpeg2dec->dummybuf[0] = g_malloc (mpeg2dec->size);
|
/* 16byte-align the buffer start address. As u_offs and v_offs are
|
||||||
|
* divideable by 16 without a rest it's only needed for the start.
|
||||||
|
* dummybuf[3] contains the malloc'ed address for free'ing later */
|
||||||
|
mpeg2dec->dummybuf[3] = g_malloc0 (mpeg2dec->size + 15);
|
||||||
|
mpeg2dec->dummybuf[0] = ALIGN_16 (mpeg2dec->dummybuf[3]);
|
||||||
mpeg2dec->dummybuf[1] = mpeg2dec->dummybuf[0] + mpeg2dec->u_offs;
|
mpeg2dec->dummybuf[1] = mpeg2dec->dummybuf[0] + mpeg2dec->u_offs;
|
||||||
mpeg2dec->dummybuf[2] = mpeg2dec->dummybuf[0] + mpeg2dec->v_offs;
|
mpeg2dec->dummybuf[2] = mpeg2dec->dummybuf[0] + mpeg2dec->v_offs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ struct _GstMpeg2dec {
|
||||||
gint size;
|
gint size;
|
||||||
gint u_offs;
|
gint u_offs;
|
||||||
gint v_offs;
|
gint v_offs;
|
||||||
guint8 *dummybuf[3];
|
guint8 *dummybuf[4];
|
||||||
|
|
||||||
|
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
|
|
Loading…
Reference in a new issue