changeset 7155:83e7ee1790a8 libavcodec

Make code independent/less dependent on dsputil. This also makes the mmx parts work again ...
author michael
date Sat, 28 Jun 2008 10:42:31 +0000
parents a9ed669e8cd1
children 30e3a8465436
files dct-test.c
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dct-test.c	Fri Jun 27 21:36:01 2008 +0000
+++ b/dct-test.c	Sat Jun 28 10:42:31 2008 +0000
@@ -33,7 +33,6 @@
 #include <math.h>
 
 #include "libavutil/common.h"
-#include "dsputil.h"
 
 #include "simple_idct.h"
 #include "faandct.h"
@@ -79,6 +78,8 @@
 #define FAAN_SCALE NO_PERM
 #endif
 
+static int cpu_flags;
+
 struct algo algos[] = {
   {"REF-DBL",         0, fdct,               fdct, NO_PERM},
   {"FAAN",            0, ff_faandct,         fdct, FAAN_SCALE},
@@ -172,6 +173,14 @@
 static DCTELEM block1[64] __attribute__ ((aligned (8)));
 static DCTELEM block_org[64] __attribute__ ((aligned (8)));
 
+static inline void mmx_emms(void)
+{
+#ifdef HAVE_MMX
+    if (cpu_flags & MM_MMX)
+        asm volatile ("emms\n\t");
+#endif
+}
+
 void dct_error(const char *name, int is_idct,
                void (*fdct_func)(DCTELEM *block),
                void (*fdct_ref)(DCTELEM *block), int form, int test)
@@ -249,7 +258,7 @@
 #endif
 
         fdct_func(block);
-        emms_c(); /* for ff_mmx_idct */
+        mmx_emms();
 
         if (form == SCALE_PERM) {
             for(i=0; i<64; i++) {
@@ -346,7 +355,7 @@
         it1 += NB_ITS_SPEED;
         ti1 = gettime() - ti;
     } while (ti1 < 1000000);
-    emms_c();
+    mmx_emms();
 
     printf("%s %s: %0.1f kdct/s\n",
            is_idct ? "IDCT" : "DCT",
@@ -506,7 +515,7 @@
         it1 += NB_ITS_SPEED;
         ti1 = gettime() - ti;
     } while (ti1 < 1000000);
-    emms_c();
+    mmx_emms();
 
     printf("%s %s: %0.1f kdct/s\n",
            1 ? "IDCT248" : "DCT248",
@@ -528,7 +537,7 @@
     int test_idct = 0, test_248_dct = 0;
     int c,i;
     int test=1;
-    int cpu_flags = mm_support();
+    cpu_flags = mm_support();
 
     init_fdct();
     idct_mmx_init();