[vlc-devel] [PATCH] Mac: Add a detection for posix_memalign and a work-around

Rémi Denis-Courmont remi at remlab.net
Wed Sep 21 13:16:04 CEST 2011


Le mercredi 21 septembre 2011 12:34:39 Sebastien Zwickert, vous avez écrit :
> On Sep 20, 2011, at 6:21 PM, Jean-Baptiste Kempf wrote:
> > This should fix compilation on MacOS X sdk-10.5
> 
> Unfortunately, it does not fix the compilation on MacOS 10.5 SDK.
> MacOS SDKs lack of memalign function probably because allocated memory is
> always aligned.

malloc() must align memory in accordance with ABI requirements, notably as 
regard alignment of integer, float and structure types. For instance, on a y-
bits platform, malloc(x) will typically be aligned implicitly to a boundary of 
GCD(x,y/8) bytes, or simply y/8 bytes.

But the whole point of posix_memalign() is to obtain larger alignment with 
finer granularity than the whole page size. In particular, VLC aligns picture 
planes for SIMD optimizations.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list