[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.4,1.5

Nick Kurshev nick at mplayer.dev.hu
Sun Oct 28 12:48:52 CET 2001


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

Modified Files:
	rgb2rgb.c 
Log Message:
mmx optimized 24to32

Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- rgb2rgb.c	28 Oct 2001 11:00:40 -0000	1.4
+++ rgb2rgb.c	28 Oct 2001 11:48:50 -0000	1.5
@@ -3,14 +3,39 @@
 #include "rgb2rgb.h"
 #include "mmx.h"
 
-/* TODO: MMX optimization */
-
 void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size)
 {
   uint8_t *dest = dst;
   uint8_t *s = src;
   uint8_t *end;
+#ifdef HAVE_MMX
+  const uint64_t mask32 = 0x00FFFFFF00FFFFFFULL;
+  uint8_t *mm_end;
+#endif
   end = s + src_size;
+#ifdef HAVE_MMX
+  mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
+  __asm __volatile("movq %0, %%mm7"::"m"(mask32):"memory");
+  while(s < mm_end)
+  {
+    __asm __volatile(
+	"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"
+	"pand	%%mm7, %%mm0\n\t"
+	"pand	%%mm7, %%mm2\n\t"
+	"movq	%%mm0, %0\n\t"
+	"movq	%%mm2, 8%0"
+	:"=m"(*dest)
+	:"m"(*s)
+	:"memory");
+    dest += 16;
+    s += 12;
+  }
+#endif
   while(s < end)
   {
     *dest++ = *s++;
@@ -20,6 +45,7 @@
   }
 }
 
+/* TODO: MMX optimization */
 void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size)
 {
   uint8_t *dest = dst;




More information about the MPlayer-cvslog mailing list