[Mplayer-cvslog] CVS: main/liba52 imdct.c,1.17,1.18 test.c,1.5,1.6 resample.c,1.12,1.13

Michael Niedermayer michael at mplayer.dev.hu
Sun Dec 30 22:38:56 CET 2001


Update of /cvsroot/mplayer/main/liba52
In directory mplayer:/var/tmp.root/cvs-serv21913

Modified Files:
	imdct.c test.c resample.c 
Log Message:
runtime cpudetect in liba52 way


Index: imdct.c
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/imdct.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- imdct.c	30 Dec 2001 01:47:27 -0000	1.17
+++ imdct.c	30 Dec 2001 21:38:53 -0000	1.18
@@ -26,7 +26,6 @@
  */
 
 #include "config.h"
-#include "../cpudetect.h"
 
 #include <math.h>
 #include <stdio.h>
@@ -1107,9 +1106,9 @@
     {
 	int i, j, k;
 
-	if(gCpuCaps.hasSSE) 		fprintf (stderr, "Using SSE optimized IMDCT transform\n");
-	else if(gCpuCaps.has3DNow) 	fprintf (stderr, "Using experimental 3DNow optimized IMDCT transform\n");
-	else		    		fprintf (stderr, "No accelerated IMDCT transform found\n");
+	if(mm_accel & MM_ACCEL_X86_SSE) 	fprintf (stderr, "Using SSE optimized IMDCT transform\n");
+	else if(mm_accel & MM_ACCEL_X86_3DNOW) 	fprintf (stderr, "Using 3DNow optimized IMDCT transform\n");
+	else		    			fprintf (stderr, "No accelerated IMDCT transform found\n");
 
 	/* Twiddle factors to turn IFFT into IMDCT */
 	for (i = 0; i < 128; i++) {
@@ -1185,8 +1184,8 @@
 
 	imdct_512 = imdct_do_512;
 #ifdef ARCH_X86
-	if(gCpuCaps.hasSSE)		imdct_512 = imdct_do_512_sse;
-	else if(gCpuCaps.has3DNow)	imdct_512 = imdct_do_512_3dnow;
+	if(mm_accel & MM_ACCEL_X86_SSE)		imdct_512 = imdct_do_512_sse;
+	else if(mm_accel & MM_ACCEL_X86_3DNOW)	imdct_512 = imdct_do_512_3dnow;
 #endif // arch_x86
 	imdct_256 = imdct_do_256;
     }

Index: test.c
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- test.c	18 Dec 2001 04:00:29 -0000	1.5
+++ test.c	30 Dec 2001 21:38:53 -0000	1.6
@@ -11,6 +11,7 @@
 #include <inttypes.h>
 
 #include "a52.h"
+#include "mm_accel.h"
 #include "../cpudetect.h"
 
 static sample_t * samples;
@@ -51,6 +52,13 @@
     stdout= stderr; //EVIL HACK FIXME
     GetCpuCaps(&gCpuCaps);
     stdout= temp;
+//    gCpuCaps.hasMMX=0;
+//    gCpuCaps.hasSSE=0;
+    if(gCpuCaps.hasMMX) 	accel |= MM_ACCEL_X86_MMX;
+    if(gCpuCaps.hasMMX2) 	accel |= MM_ACCEL_X86_MMXEXT;
+    if(gCpuCaps.hasSSE) 	accel |= MM_ACCEL_X86_SSE;
+    if(gCpuCaps.has3DNow) 	accel |= MM_ACCEL_X86_3DNOW;
+//    if(gCpuCaps.has3DNowExt) 	accel |= MM_ACCEL_X86_3DNOWEXT;
     
     samples = a52_init (accel);
     if (samples == NULL) {
@@ -87,7 +95,7 @@
     buf_size=0;
 
     // decode:
-    flags=A52_STEREO; //A52_STEREO; // A52_DOLBY // A52_2F2R // A52_3F2R | A52_LFE
+    flags=A52_STEREO; //A52_STEREO; //A52_DOLBY; //A52_STEREO; // A52_DOLBY // A52_2F2R // A52_3F2R | A52_LFE
     channels=2;
     
     flags |= A52_ADJUST_LEVEL;
@@ -99,7 +107,7 @@
     // a52_dynrng (&state, NULL, NULL); // disable dynamic range compensation
 
 STARTTIMING
-    a52_resample_init(flags,channels);
+    a52_resample_init(accel,flags,channels);
     s16 = out_buf;
     for (i = 0; i < 6; i++) {
 	if (a52_block (&state, samples))
@@ -112,7 +120,7 @@
 if(sum<min) min=sum;
 sum=0;
 #endif
-    fwrite(out_buf,6*256*2*2,1,stdout);
+    fwrite(out_buf,6*256*2*channels,1,stdout);
 
 }
 

Index: resample.c
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/resample.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- resample.c	30 Dec 2001 20:42:40 -0000	1.12
+++ resample.c	30 Dec 2001 21:38:53 -0000	1.13
@@ -18,8 +18,8 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include "a52.h"
+#include "mm_accel.h"
 #include "../config.h"
-#include "../cpudetect.h"
 
 int (* a52_resample) (float * _f, int16_t * s16)=NULL;
 
@@ -592,12 +592,12 @@
 
     if(a52_resample==NULL) // only once please ;)
     {
-	    if(gCpuCaps.hasMMX) fprintf(stderr, "Using MMX optimized resampler\n");
-	    else		fprintf(stderr, "No accelerated resampler found\n");
+	    if(mm_accel & MM_ACCEL_X86_MMX) 	fprintf(stderr, "Using MMX optimized resampler\n");
+	    else				fprintf(stderr, "No accelerated resampler found\n");
     }
     
 #ifdef ARCH_X86
-    if(gCpuCaps.hasMMX) a52_resample= a52_resample_MMX;
+    if(mm_accel & MM_ACCEL_X86_MMX) a52_resample= a52_resample_MMX;
 #else
     if(0);
 #endif




More information about the MPlayer-cvslog mailing list