[Ffmpeg-devel] swscale and memalign

Wolfram Gloger wmglo
Mon Jul 24 09:41:47 CEST 2006


Hi,

> But looking at the issue, I am wondering if a more radical approach
> would be better... I mean, can we replace all the memalign() instances
> in swscale.c with av_malloc()? I tried this (see the attached
> remove_memalign.diff), and the result seems to be correctly working on
> linux/x86.

Ugh.  It probably works because (as I just discovered after only 3
years or so) av_malloc does 16byte alignment (via a call to
memalign(16,sz)), which is _sufficient_ for everything on x86 (but
probably not optimal -- some types may profit from 32byte or even
64byte alignment).

> But is this change valid? For example, I see that some of the replaced
> memalign() request a 64-bytes alignment, and I do not think av_malloc()
> provides it...

I think av_memalign should be created and used to clearly document the
exact alignment wanted in the places where it is needed/wanted.

Regards,
Wolfram.




More information about the ffmpeg-devel mailing list