[Mplayer-cvslog] CVS: main/liba52 parse.c,1.6,1.7

Sascha Sommer CVS syncmail at mplayerhq.hu
Thu Apr 1 14:35:19 CEST 2004


CVS change done by Sascha Sommer CVS

Update of /cvsroot/mplayer/main/liba52
In directory mail:/var2/tmp/cvs-serv11579/liba52

Modified Files:
	parse.c 
Log Message:
prevent crash in case we are unable to get aligned buffer

Index: parse.c
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/parse.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- parse.c	1 Apr 2004 10:35:30 -0000	1.6
+++ parse.c	1 Apr 2004 12:35:17 -0000	1.7
@@ -31,6 +31,7 @@
 #include "a52_internal.h"
 #include "bitstream.h"
 #include "tables.h"
+#include "mm_accel.h"
 
 #ifdef HAVE_MEMALIGN
 /* some systems have memalign() but no declaration for it */
@@ -53,9 +54,6 @@
     sample_t * samples;
     int i;
 
-    imdct_init (mm_accel);
-    downmix_accel_init(mm_accel);
-
     samples = memalign (16, 256 * 12 * sizeof (sample_t));
 #if defined(__MINGW32__) && defined(HAVE_SSE) 
     for(i=0;i<10;i++){
@@ -66,13 +64,18 @@
       }
       else break;
     }
-    if((int)samples%16){
-      printf("unable to get 16 bit aligned memory => expect crashes when using SSE instructions\n");
-    }
 #endif
+    if(((int)samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){
+      mm_accel &=~MM_ACCEL_X86_SSE;
+      printf("liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n");
+    }   
+    
     if (samples == NULL)
-	return NULL;
-
+	return NULL;    
+    
+    imdct_init (mm_accel);
+    downmix_accel_init(mm_accel);
+    
     for (i = 0; i < 256 * 12; i++)
 	samples[i] = 0;
 




More information about the MPlayer-cvslog mailing list