[x264-devel] commit: Exempt Win x86_64 from memalign hack (Steven Walters )

git at videolan.org git at videolan.org
Tue Jun 15 10:48:26 CEST 2010


x264 | branch: stable | Steven Walters <kemuri9 at gmail.com> | Sat May 22 20:54:35 2010 -0400| [609f7ab0af169d2515ad66a1c77cb558eb5f1b49] | committer: Jason Garrett-Glaser 

Exempt Win x86_64 from memalign hack
The API mandates all mallocs are 16 byte aligned.
Remove unused int that stores sizeof malloc in memalign hack.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=609f7ab0af169d2515ad66a1c77cb558eb5f1b49
---

 common/common.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/common/common.c b/common/common.c
index 2c52e40..a5bc746 100644
--- a/common/common.c
+++ b/common/common.c
@@ -1040,19 +1040,18 @@ void x264_picture_clean( x264_picture_t *pic )
 void *x264_malloc( int i_size )
 {
     uint8_t *align_buf = NULL;
-#if SYS_MACOSX
-    /* Mac OS X always returns 16 bytes aligned memory */
+#if SYS_MACOSX || (SYS_MINGW && ARCH_X86_64)
+    /* Mac OS X and Win x64 always returns 16 byte aligned memory */
     align_buf = malloc( i_size );
 #elif HAVE_MALLOC_H
     align_buf = memalign( 16, i_size );
 #else
-    uint8_t *buf = malloc( i_size + 15 + sizeof(void **) + sizeof(int) );
+    uint8_t *buf = malloc( i_size + 15 + sizeof(void **) );
     if( buf )
     {
-        align_buf = buf + 15 + sizeof(void **) + sizeof(int);
+        align_buf = buf + 15 + sizeof(void **);
         align_buf -= (intptr_t) align_buf & 15;
         *( (void **) ( align_buf - sizeof(void **) ) ) = buf;
-        *( (int *) ( align_buf - sizeof(void **) - sizeof(int) ) ) = i_size;
     }
 #endif
     if( !align_buf )
@@ -1067,7 +1066,7 @@ void x264_free( void *p )
 {
     if( p )
     {
-#if HAVE_MALLOC_H || SYS_MACOSX
+#if HAVE_MALLOC_H || SYS_MACOSX || (SYS_MINGW && ARCH_X86_64)
         free( p );
 #else
         free( *( ( ( void **) p ) - 1 ) );



More information about the x264-devel mailing list