[Mplayer-cvslog] CVS: main/libavcodec dsputil.c,1.5,1.6

Nick Kurshev nick at mplayer.dev.hu
Tue Jul 17 11:08:04 CEST 2001


Update of /cvsroot/mplayer/main/libavcodec
In directory mplayer:/var/tmp.root/cvs-serv23114/main/libavcodec

Modified Files:
	dsputil.c 
Log Message:
Minor improvements and 3dNow! - MMX2 support

Index: dsputil.c
===================================================================
RCS file: /cvsroot/mplayer/main/libavcodec/dsputil.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dsputil.c	16 Jul 2001 09:16:19 -0000	1.5
+++ dsputil.c	17 Jul 2001 09:07:56 -0000	1.6
@@ -27,8 +27,26 @@
 #endif
 UINT32 squareTbl[512];
 
-#ifdef ARCH_X86
-static void put_pixels_long(UINT8 *block, const UINT8 *pixels, int line_size, int h);
+#if defined ( ARCH_X86 ) && !defined( HAVE_MMX )
+/* Special solution for cpu whitout MMX unit */
+/*
+ * x86 CPUs can access unaligned 32-bit data, so we can speed up copying
+ * DCT blocks a bit by using 32-bit data moves instead of 8-bit moves
+ * (fewer instructions in the inner loop)
+ */
+static void put_pixels_long(UINT8 *block, const UINT8 *pixels, int line_size, int h)
+{
+    UINT32 *p;
+    const UINT32 *pix;
+    p   = (UINT32*)block;
+    pix = (UINT32*)pixels;
+    do {
+        p[0] = pix[0];
+        p[1] = pix[1];
+        pix = (UINT32*) ((char*)pix + line_size);
+        p =   (UINT32*) ((char*)p   + line_size);
+    } while (--h);
+}
 #endif
 
 void dsputil_init(void)
@@ -44,8 +62,7 @@
     for(i=0;i<512;i++) {
         squareTbl[i] = (i - 256) * (i - 256);
     }
-
-#ifdef ARCH_X86
+#if defined ( ARCH_X86 ) && !defined( HAVE_MMX )
     put_pixels_tab[0] = put_pixels_long;
     put_no_rnd_pixels_tab[0] = put_pixels_long;
 #endif
@@ -127,27 +144,8 @@
         p += 8;
     }
 }
-#ifdef ARCH_X86
-/*
- * x86 CPUs can access unaligned 32-bit data, so we can speed up copying
- * DCT blocks a bit by using 32-bit data moves instead of 8-bit moves
- * (fewer instructions in the inner loop)
- */
-static void put_pixels_long(UINT8 *block, const UINT8 *pixels, int line_size, int h)
-{
-    UINT32 *p;
-    const UINT32 *pix;
-    p   = (UINT32*)block;
-    pix = (UINT32*)pixels;
-    do {
-        p[0] = pix[0];
-        p[1] = pix[1];
-        pix = (UINT32*) ((char*)pix + line_size);
-        p =   (UINT32*) ((char*)p   + line_size);
-    } while (--h);
-}
-#endif
 #endif
+
 #define PIXOP(BTYPE, OPNAME, OP, INCR)                                                   \
                                                                                          \
 static void OPNAME ## _pixels(BTYPE *block, const UINT8 *pixels, int line_size, int h)    \
@@ -256,10 +254,11 @@
 #define op_avg(a, b) a = avg2(a, b)
 #define op_sub(a, b) a -= b
 
+#ifndef HAVE_MMX
 PIXOP(UINT8, put, op_put, line_size)
 PIXOP(UINT8, avg, op_avg, line_size)
-
 PIXOP(DCTELEM, sub, op_sub, 8)
+#endif
 
 /* not rounding primitives */
 #undef avg2
@@ -267,8 +266,10 @@
 #define avg2(a,b) ((a+b)>>1)
 #define avg4(a,b,c,d) ((a+b+c+d+1)>>2)
 
+#ifndef HAVE_MMX
 PIXOP(UINT8, put_no_rnd, op_put, line_size)
 PIXOP(UINT8, avg_no_rnd, op_avg, line_size)
+#endif
 
 /* motion estimation */
 




More information about the MPlayer-cvslog mailing list