[x264-devel] Qusestion : x264_malloc()

Ikseong Bae iambaeba1 at yahoo.com
Thu Jun 30 10:16:30 CEST 2005


Why not x264 use to malloc() ?
I don't understand the x264_malloc() code.
For speed, Is below-code used  ?
I want to know the meaning of the x264_malloc() code.
 
void *x264_malloc( int i_size )
{
#ifdef SYS_MACOSX
    /* Mac OS X always returns 16 bytes aligned memory */
    return malloc( i_size );
#elif defined( HAVE_MALLOC_H )
    return memalign( 16, i_size );
#else
    uint8_t * buf;
    uint8_t * align_buf;
    buf = (uint8_t *) malloc( i_size + 15 + sizeof( void ** ) +
              sizeof( int ) );
    align_buf = buf + 15 + sizeof( void ** ) + sizeof( int );
    align_buf -= (long) align_buf & 15;
    *( (void **) ( align_buf - sizeof( void ** ) ) ) = buf;
    *( (int *) ( align_buf - sizeof( void ** ) - sizeof( int ) ) ) = i_size;
    return align_buf;
#endif
}
 
Thanks..
 
Best regards
 
Bae

		
---------------------------------
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.videolan.org/pipermail/x264-devel/attachments/20050630/dfd0135a/attachment.htm 


More information about the x264-devel mailing list