[Mplayer-cvslog] CVS: main/libmpcodecs vf_noise.c,1.7,1.8

Michael Niedermayer michael at mplayerhq.hu
Sun Aug 11 12:52:25 CEST 2002


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

Modified Files:
	vf_noise.c 
Log Message:
mmx optimized avg/film noise


Index: vf_noise.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_noise.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vf_noise.c	11 Aug 2002 10:12:15 -0000	1.7
+++ vf_noise.c	11 Aug 2002 10:52:22 -0000	1.8
@@ -192,6 +192,48 @@
 
 /***************************************************************************/
 
+#ifdef HAVE_MMX
+static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
+	int mmx_len= len&(~7);
+
+	asm volatile(
+		"movl %5, %%eax			\n\t"
+		".balign 16			\n\t"
+		"1:				\n\t"
+		"movq (%1, %%eax), %%mm1	\n\t"
+		"movq (%0, %%eax), %%mm0	\n\t"
+		"paddb (%2, %%eax), %%mm1	\n\t"
+		"paddb (%3, %%eax), %%mm1	\n\t"
+		"movq %%mm0, %%mm2		\n\t"
+		"movq %%mm1, %%mm3		\n\t"
+		"punpcklbw %%mm0, %%mm0		\n\t"
+		"punpckhbw %%mm2, %%mm2		\n\t"
+		"punpcklbw %%mm1, %%mm1		\n\t"
+		"punpckhbw %%mm3, %%mm3		\n\t"
+		"pmulhw %%mm0, %%mm1		\n\t"
+		"pmulhw %%mm2, %%mm3		\n\t"
+		"paddw %%mm1, %%mm1		\n\t"
+		"paddw %%mm3, %%mm3		\n\t"
+		"paddw %%mm0, %%mm1		\n\t"
+		"paddw %%mm2, %%mm3		\n\t"
+		"psrlw $8, %%mm1		\n\t"
+		"psrlw $8, %%mm3		\n\t"
+                "packuswb %%mm3, %%mm1		\n\t"
+		"movq %%mm1, (%4, %%eax)	\n\t"
+		"addl $8, %%eax			\n\t"
+		" js 1b				\n\t"
+		:: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len), 
+                   "r" (dst+mmx_len), "g" (-mmx_len)
+		: "%eax"
+	);
+
+	if(mmx_len!=len){
+		int8_t *shift2[3]={shift[0]+mmx_len, shift[1]+mmx_len, shift[2]+mmx_len};
+		lineNoiseAvg_C(dst+mmx_len, src+mmx_len, len-mmx_len, shift2);
+	}
+}
+#endif
+
 static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
 	int i;
         int8_t *src2= (int8_t*)src;
@@ -381,8 +423,10 @@
 
  
 #ifdef HAVE_MMX
-    if(gCpuCaps.hasMMX) lineNoise= lineNoise_MMX;
-//    if(gCpuCaps.hasMMX) lineNoiseAvg= lineNoiseAvg_MMX;
+    if(gCpuCaps.hasMMX){
+        lineNoise= lineNoise_MMX;
+        lineNoiseAvg= lineNoiseAvg_MMX;
+    }
 #endif
 #ifdef HAVE_MMX2
     if(gCpuCaps.hasMMX2) lineNoise= lineNoise_MMX2;




More information about the MPlayer-cvslog mailing list