changeset 3144:ce34f5b40272

runtime cpu detection
author michael
date Mon, 26 Nov 2001 21:45:48 +0000
parents 86910f54c391
children 78e11396f431
files dec_video.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Mon Nov 26 21:17:23 2001 +0000
+++ b/dec_video.c	Mon Nov 26 21:45:48 2001 +0000
@@ -50,6 +50,8 @@
 
 #include "postproc/postprocess.h"
 
+#include "cpudetect.h"
+
 extern picture_t *picture;	// exported from libmpeg2/decode.c
 
 int divx_quality=0;
@@ -101,8 +103,6 @@
 extern tvi_handle_t *tv_handler;
 #endif
 
-#include "mmx_defs.h"
-
 void AVI_Decode_RLE8(char *image,char *delta,int tdsize,
     unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel);
 
@@ -808,11 +808,14 @@
 } // switch
 //------------------------ frame decoded. --------------------
 
-#ifdef HAVE_MMX
 	// some codecs is broken, and doesn't restore MMX state :(
 	// it happens usually with broken/damaged files.
-	__asm __volatile (EMMS:::"memory");
-#endif
+if(gCpuCaps.has3DNow){
+	__asm __volatile ("femms\n\t":::"memory");
+}
+else if(gCpuCaps.hasMMX){
+	__asm __volatile ("emms\n\t":::"memory");
+}
 
 t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f;