[Mplayer-cvslog] CVS: main/postproc rgb2rgb_template.c,1.66,1.67

Michael Niedermayer CVS michael at mplayerhq.hu
Fri Oct 10 02:19:38 CEST 2003


Update of /cvsroot/mplayer/main/postproc
In directory mail:/var/tmp.root/cvs-serv1481

Modified Files:
	rgb2rgb_template.c 
Log Message:
yv12->uyvy MMX


Index: rgb2rgb_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb_template.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- rgb2rgb_template.c	9 Oct 2003 22:25:53 -0000	1.66
+++ rgb2rgb_template.c	10 Oct 2003 00:19:16 -0000	1.67
@@ -1576,6 +1576,44 @@
 	const unsigned chromWidth= width>>1;
 	for(y=0; y<height; y++)
 	{
+#ifdef HAVE_MMX
+//FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
+		asm volatile(
+			"xorl %%eax, %%eax		\n\t"
+			".balign 16			\n\t"
+			"1:				\n\t"
+			PREFETCH" 32(%1, %%eax, 2)	\n\t"
+			PREFETCH" 32(%2, %%eax)		\n\t"
+			PREFETCH" 32(%3, %%eax)		\n\t"
+			"movq (%2, %%eax), %%mm0	\n\t" // U(0)
+			"movq %%mm0, %%mm2		\n\t" // U(0)
+			"movq (%3, %%eax), %%mm1	\n\t" // V(0)
+			"punpcklbw %%mm1, %%mm0		\n\t" // UVUV UVUV(0)
+			"punpckhbw %%mm1, %%mm2		\n\t" // UVUV UVUV(8)
+
+			"movq (%1, %%eax,2), %%mm3	\n\t" // Y(0)
+			"movq 8(%1, %%eax,2), %%mm5	\n\t" // Y(8)
+			"movq %%mm0, %%mm4		\n\t" // Y(0)
+			"movq %%mm2, %%mm6		\n\t" // Y(8)
+			"punpcklbw %%mm3, %%mm0		\n\t" // YUYV YUYV(0)
+			"punpckhbw %%mm3, %%mm4		\n\t" // YUYV YUYV(4)
+			"punpcklbw %%mm5, %%mm2		\n\t" // YUYV YUYV(8)
+			"punpckhbw %%mm5, %%mm6		\n\t" // YUYV YUYV(12)
+
+			MOVNTQ" %%mm0, (%0, %%eax, 4)	\n\t"
+			MOVNTQ" %%mm4, 8(%0, %%eax, 4)	\n\t"
+			MOVNTQ" %%mm2, 16(%0, %%eax, 4)	\n\t"
+			MOVNTQ" %%mm6, 24(%0, %%eax, 4)	\n\t"
+
+			"addl $8, %%eax			\n\t"
+			"cmpl %4, %%eax			\n\t"
+			" jb 1b				\n\t"
+			::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
+			: "%eax"
+		);
+#else
+//FIXME adapt the alpha asm code from yv12->yuy2
+
 #if __WORDSIZE >= 64
 		int i;
 		uint64_t *ldst = (uint64_t *) dst;
@@ -1603,6 +1641,7 @@
 			vc++;
 		}
 #endif
+#endif
 		if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
 		{
 			usrc += chromStride;
@@ -1611,6 +1650,11 @@
 		ysrc += lumStride;
 		dst += dstStride;
 	}
+#ifdef HAVE_MMX
+asm(    EMMS" \n\t"
+        SFENCE" \n\t"
+        :::"memory");
+#endif
 }
 
 /**



More information about the MPlayer-cvslog mailing list