[gst-devel] aligned(16) GstBuffer Payload ?
Stefan Kost
ensonic at hora-obscura.de
Sat Oct 13 16:16:42 CEST 2007
hi,
David Schleef wrote:
> On Fri, Oct 12, 2007 at 05:05:58PM +0200, SP GLE wrote:
>> is there a way to get a GstBuffer with a configurable memaligned
>> payload (aligned(16)), in order to use payload with SSE2 and other
>> liboil methods (even if liboil can work on not aligned data, using
>> aligned could speed up some processing).
>
> There are very few situations where allocating aligned buffers to
> use with liboil will result in faster performance. Liboil was designed
> to allow you to use it without thinking of such things.
>
> In any case, you can create aligned buffers by allocating a normal
> buffer with extra padding, and creating an appropriate subbuffer.
> Alternately, you could create a subclass of GstBuffer similar to
> the efence element in -good. Or you could patch gstbuffer.c and
> add a function similar to gst_buffer_new_and_alloc() that allocates
> memory using posix_memalign() instead of mallc().
>
I was recently looking at it. Unfortunately gst_buffer_new_and_malloc uses
g_malloc and g_free (we need to fix the docs regarding this). data allocated
using posix_memalign() should be free'ed with free(). It could confuse glib if
its free'ed with g_free(). So a subclass shoudl override the
GstMiniObjectFinalizeFunction and properly release the memory. On the other hand
I wonder if we should perhaps switch GstBuffer to use posix_memalign() and free().
Stefan
>
>
> dave...
>
More information about the gstreamer-devel
mailing list