[Mplayer-cvslog] CVS: main/libvo mga_common.c,1.15,1.16

Michael Niedermayer michael at mplayer.dev.hu
Fri Nov 2 04:18:09 CET 2001


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv7227

Modified Files:
	mga_common.c 
Log Message:
mmx opt ,untested, i have no mga


Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mga_common.c	22 Aug 2001 21:34:27 -0000	1.15
+++ mga_common.c	2 Nov 2001 03:17:33 -0000	1.16
@@ -1,5 +1,6 @@
 
 #include "fastmemcpy.h"
+#include "../mmx_defs.h"
 
 // mga_vid drawing functions
 
@@ -57,15 +58,55 @@
         src2 = image[2];
 	for(h=0; h < height; h++)
 	{
+#ifdef HAVE_MMX
+		asm(
+			"xorl %%eax, %%eax		\n\t"
+			"1:				\n\t"
+			PREFETCH" 64(%1, %%eax)		\n\t"
+			PREFETCH" 64(%2, %%eax)		\n\t"
+			"movq (%1, %%eax), %%mm0	\n\t"
+			"movq 8(%1, %%eax), %%mm2	\n\t"
+			"movq %%mm0, %%mm1		\n\t"
+			"movq %%mm2, %%mm3		\n\t"
+			"movq (%2, %%eax), %%mm4	\n\t"
+			"movq 8(%2, %%eax), %%mm5	\n\t"
+			"punpcklbw %%mm4, %%mm0		\n\t"
+			"punpckhbw %%mm4, %%mm1		\n\t"
+			"punpcklbw %%mm5, %%mm2		\n\t"
+			"punpckhbw %%mm5, %%mm3		\n\t"
+			MOVNTQ" %%mm0, (%0, %%eax, 2)	\n\t"
+			MOVNTQ" %%mm1, 8(%0, %%eax, 2)	\n\t"
+			MOVNTQ" %%mm2, 16(%0, %%eax, 2)	\n\t"
+			MOVNTQ" %%mm3, 24(%0, %%eax, 2)	\n\t"
+			"addl $16, %%eax			\n\t"
+			"cmpl %3, %%eax			\n\t"
+			" jb 1b				\n\t"
+			::"r"(dest), "r"(src), "r"(src2), "r" (width-15)
+			: "memory", "%eax"
+		);
+		for(w= (width&(~15)); w < width; w++)
+		{
+			dest[2*w+0] = src[w];
+			dest[2*w+1] = src2[w];
+		}
+#else
 		for(w=0; w < width; w++)
 		{
 			dest[2*w+0] = src[w];
 			dest[2*w+1] = src2[w];
 		}
+#endif
 		dest += bespitch;
                 src += stride[1];
                 src2+= stride[2];
 	}
+#ifdef HAVE_MMX
+	asm(
+		EMMS" \n\t"
+		SFENCE" \n\t"
+		::: "memory"
+		);
+#endif
 }
 
 static void




More information about the MPlayer-cvslog mailing list