[MPlayer-dev-eng] [PATCH] liba52/parse.c: avoid dirty hack on mingw32

Zuxy Meng zuxy.meng at gmail.com
Wed Oct 25 03:19:00 CEST 2006


Since libavutil is now mandatory, we need this hack no more when
MEMALIGN_HACK is defined.

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: liba52/parse.c
===================================================================
--- liba52/parse.c	???????? 20426??
+++ liba52/parse.c	????????????
@@ -37,6 +37,7 @@
 #include "bitstream.h"
 #include "tables.h"
 #include "mm_accel.h"
+#include "libavutil/avutil.h"
 
 #ifdef HAVE_MEMALIGN
 /* some systems have memalign() but no declaration for it */
@@ -63,8 +64,10 @@
     if (state == NULL)
 	return NULL;
 
-    state->samples = memalign (16, 256 * 12 * sizeof (sample_t));
 #if defined(__MINGW32__) && defined(HAVE_SSE) 
+#ifdef MEMALIGN_HACK
+    state->samples = av_malloc(256 * 12 * sizeof (sample_t));
+#else
     for(i=0;i<10;i++){
       if((int)state->samples%16){
         sample_t* samplestmp=malloc(256 * 12 * sizeof (sample_t));   
@@ -74,6 +77,9 @@
       else break;
     }
 #endif
+#else /* defined(__MINGW32__) && defined(HAVE_SSE) */
+    state->samples = memalign (16, 256 * 12 * sizeof (sample_t));
+#endif
     if(((int)state->samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){
       mm_accel &=~MM_ACCEL_X86_SSE;
       fprintf(stderr, "liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n");
@@ -915,6 +921,10 @@
 
 void a52_free (a52_state_t * state)
 {
+#if defined(__MINGW32__) && defined(HAVE_SSE) && defined(MEMALIGN_HACK)
+    av_free (state->samples);
+#else
     free (state->samples);
+#endif
     free (state);
 }


More information about the MPlayer-dev-eng mailing list