[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.29,1.30

Nick Kurshev nick at mplayer.dev.hu
Tue Nov 6 14:53:45 CET 2001


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

Modified Files:
	rgb2rgb.c 
Log Message:
rgb24to32 now is faster

Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- rgb2rgb.c	6 Nov 2001 11:20:00 -0000	1.29
+++ rgb2rgb.c	6 Nov 2001 13:53:43 -0000	1.30
@@ -40,20 +40,26 @@
     __asm __volatile(
 	PREFETCH"	32%1\n\t"
 	"movd	%1, %%mm0\n\t"
-	"movd	3%1, %%mm1\n\t"
-	"movd	6%1, %%mm2\n\t"
-	"movd	9%1, %%mm3\n\t"
-	"punpckldq %%mm1, %%mm0\n\t"
-	"punpckldq %%mm3, %%mm2\n\t"
+	"punpckldq 3%1, %%mm0\n\t"
+	"movd	6%1, %%mm1\n\t"
+	"punpckldq 9%1, %%mm1\n\t"
+	"movd	12%1, %%mm2\n\t"
+	"punpckldq 15%1, %%mm2\n\t"
+	"movd	18%1, %%mm3\n\t"
+	"punpckldq 21%1, %%mm3\n\t"
 	"pand	%%mm7, %%mm0\n\t"
+	"pand	%%mm7, %%mm1\n\t"
 	"pand	%%mm7, %%mm2\n\t"
+	"pand	%%mm7, %%mm3\n\t"
 	MOVNTQ"	%%mm0, %0\n\t"
-	MOVNTQ"	%%mm2, 8%0"
+	MOVNTQ"	%%mm1, 8%0\n\t"
+	MOVNTQ"	%%mm2, 16%0\n\t"
+	MOVNTQ"	%%mm3, 24%0"
 	:"=m"(*dest)
 	:"m"(*s)
 	:"memory");
-    dest += 16;
-    s += 12;
+    dest += 32;
+    s += 24;
   }
   __asm __volatile(SFENCE:::"memory");
   __asm __volatile(EMMS:::"memory");
@@ -249,6 +255,48 @@
 {
 	unsigned j,i,num_pixels=src_size/3;
 	uint16_t *d = (uint16_t *)dst;
+#if 0/*def HAVE_MMX*/
+	unsigned mm_npix;
+	const uint64_t mm_fc = 0xFCFCFCFCFCFCFCFCULL, mm_f8 = 0xF8F8F8F8F8F8F8F8ULL;
+	mm_npix = ((num_pixels)/(MMREG_SIZE*2))*(MMREG_SIZE*2);
+	num_pixels -= mm_npix;
+	__asm __volatile(PREFETCH"	%0"::"m"(*src):"memory");
+	__asm __volatile(
+	    "movq	%0, %%mm7\n\t"
+	    "movq	%1, %%mm6\n\t"
+	    ::"m"(mm_fc),"m"(mm_f8));
+
+	for(j=0,i=0;j<mm_npix;j+=4,i+=12)
+	{
+	    __asm __volatile(
+		PREFETCH" 32%1\n\t"
+		"movd	%1, %%mm0\n\t"
+		"punpckldq 3%1, %%mm0\n\t"
+		"movd	6%1, %%mm3\n\t"
+		"punpckldq 9%1, %%mm3\n\t"
+		"movq	%%mm0, %%mm1\n\t"
+		"movq	%%mm0, %%mm2\n\t"
+		"movq	%%mm3, %%mm4\n\t"
+		"movq	%%mm3, %%mm5\n\t"
+		"psrlq	$3, %%mm0\n\t"
+		"psrlq	$3, %%mm3\n\t"
+		"pand	%%mm7, %%mm1\n\t"
+		"pand	%%mm7, %%mm4\n\t"
+		"psllq	$3, %%mm1\n\t"
+		"psllq	$3, %%mm4\n\t"
+		"pand	%%mm6, %%mm2\n\t"
+		"pand	%%mm6, %%mm5\n\t"
+		"psllq	$8, %%mm2\n\t"
+		"psllq	$8, %%mm5\n\t"
+		"por	%%mm1, %%mm0\n\t"
+		"por	%%mm2, %%mm0\n\t"
+		"por	%%mm4, %%mm3\n\t"
+		"por	%%mm5, %%mm3\n\t"
+		"punpcklwd %%mm3, %%mm0\n\t"
+		MOVNTQ"	%%mm0, %0\n\t"
+		:"=m"(d[j]):"m"(src[i]):"memory");
+	}
+#endif
 	for(i=0,j=0; j<num_pixels; i+=3,j++)
 	{
 		const int b= src[i+0];




More information about the MPlayer-cvslog mailing list