[gst-devel] RE : Re: aligned(16) GstBuffer Payload ?

Stefan Kost ensonic at hora-obscura.de
Wed Oct 17 19:36:16 CEST 2007


hi,

Ole André Vadla Ravnås schrieb:
> Hi,
> 
> Just one small comment:
> 
> On Sun, 2007-10-14 at 17:32 +0200, SP GLE wrote:
> (...)
>> But switching GstBuffer to posix_memalign is not a good thing (IMHO), :
>> - GstBuffers are often allocated for a limited time, there are groups
>> of GstBuffers with the same size (eg before decoding, before encoding,
>> after...etc), so relying on g_slice dramatticaly improves performances
>> over malloc and posix_memalign. 
> 
> gst_buffer_new_and_alloc uses g_malloc, which calls the standard malloc
> unless g_mem_set_vtable has been called. And as far as I can tell
> GStreamer doesn't call this, so it should be fine. (Unless there are
> other issues.)
>
I does not, but you cannot rely on that it does not ...
A subclass would be better.

Stefan


> 
> Cheers,
> Ole André
> 
> 
>> --- Stefan Kost <ensonic at hora-obscura.de> a écrit :
>>
>>> 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...
>>>>
>>
>>
>>       ____________________________________________________________________________________________
>> Découvrez le blog Yahoo! Mail : dernières nouveautés, astuces, conseils.. et vos réactions !
>> http://blog.mail.yahoo.fr
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems?  Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel





More information about the gstreamer-devel mailing list