gstBuffer data is 8-byte aligned. How to change to 16byte aligned without recompiling whole gstreamer framework?
tim at centricular.com
Fri Feb 21 09:52:09 PST 2014
On Fri, 2014-02-21 at 13:19 +0100, Chris Maes wrote:
> I'm developing custom plugins for gstreamer-1.0 framework. I am
> implementing SIMD operations on 16-byte words, yet the gstbufferdata
> is only 8byte aligned. Is there a way to enforce this on the gstreamer
> chain (or bufferpool or...) without having to recompile my own
> gstreamer (and all the plugin rpms etc)?
In your plugin you can answer the ALLOCATION query and advertise your
alignment requirements to upstream that way. If upstream does not use
that (as it might not if it's reading from a file or extracting data
from a muxed container stream), then you have to copy into a suitably
aligned buffer yourself (as upstream would have had to do too most
> I created my custom multifilesink in which I manage to align the data
> using posix_memalign. Yet immedeately after I use jpegdec which
> allocates its own memory which is not aligned. Yet jpegdec is not so
> easy to adapt since it doesn't just use "gst_buffer_new", but looks
> for a buffer in the gstbufferpool...
jpegdec should definitely take into account downstream's allocation
requirements. You can also provide your own buffer pool (check out
GstVideoPool, though it seems to be missing from the docs), or you can
proxy the allocation query downstream and check what downstream
provided, if anything, and then just configure that pool if there is
one, see GstVideoAlignment.
Only somewhat related, depending on the conetxt, you can also set the
public gst_memory_alignment variable to a suitable value after you
called gst_init(). One could argue it should've been declared as a const
if one isn't supposed to modify it ;)
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel