[Ffmpeg-devel] Re: [Patch] aligned av_realloc

Luca Barbato lu_zero
Sun Aug 13 01:00:01 CEST 2006

Michael Niedermayer wrote:
> Hi
> On Sun, Aug 13, 2006 at 12:17:15AM +0200, Luca Barbato wrote:
>> Michael Niedermayer wrote:
>>> Hi
>>> On Sat, Aug 05, 2006 at 08:37:34PM +0200, Herv? W. wrote:
>>>> On 21/07/06, Herv? W. <H.O.W.aka.V+ffmpeg at gmail.com> wrote:
>>>>> Hi,
>>>> again :-)
>>>>> On 30/06/06, Herv? W. wrote:
>>>>>> The changes:
>>>>>> for the case memalign-hack:
>>>>>> *changed the type of 'diff' from int to long. In this patch diff gets
>>>>>> used in exactly the same way as in av_malloc and per r4911: "long is
>>>>>> better than int for pointer differences"
>>>>>> *ptr is reallocated. If the data isn't aligned, it gets moved in the
>>>>>> allocated space, and diff is updated.
>>>>>> with memalign:
>>>>>> *memalign is called, the original data is copied and the old ptr is
>>>>>> av_free'd.
>>>>> [...]
>>>>>> without hack or memalign:
>>>>>> *as regular realloc. The memalign hack isn't needed (or wanted), nor
>>>>>> is memalign, therefore malloc is aligned on 16 (or does not need to
>>>>>> be?) and, presumably, the same applies to realloc.
>>>>> The previous patch had some mistakes.
>>>> Less comments in this patch.
>>>> Any comment whatsoever on the patch would be appreciated.
>>> does this patch fix any bug?
>> Inconsistency between av_realloc and av_malloc
>>> does this patch improve speed?
>> SIMD code for audio could avoid some unaligned store.
> wheres that offending av_realloc() exactly?
> [...]


Maybe the assumption that decode should get an aligned buffer is wrong
and that's ok to have ffmpeg and ffplay feed unaligned memory for the
audio buffer.

This is inconsistent with the video since in this case the frame memory
is aligned.



Luca Barbato

Gentoo/linux Gentoo/PPC

More information about the ffmpeg-devel mailing list