[FFmpeg-cvslog] r8984 - trunk/libavcodec/i386/motion_est_mmx.c

lorenm subversion
Fri May 11 00:24:19 CEST 2007


Author: lorenm
Date: Fri May 11 00:24:19 2007
New Revision: 8984

Log:
6% faster mmx2 sad


Modified:
   trunk/libavcodec/i386/motion_est_mmx.c

Modified: trunk/libavcodec/i386/motion_est_mmx.c
==============================================================================
--- trunk/libavcodec/i386/motion_est_mmx.c	(original)
+++ trunk/libavcodec/i386/motion_est_mmx.c	Fri May 11 00:24:19 2007
@@ -75,13 +75,11 @@ static inline void sad8_1_mmx2(uint8_t *
         ASMALIGN(4)
         "1:                             \n\t"
         "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "movq (%2, %%"REG_a"), %%mm2    \n\t"
-        "psadbw %%mm2, %%mm0            \n\t"
+        "psadbw (%2, %%"REG_a"), %%mm0  \n\t"
         "add %3, %%"REG_a"              \n\t"
         "movq (%1, %%"REG_a"), %%mm1    \n\t"
-        "movq (%2, %%"REG_a"), %%mm3    \n\t"
-        "psadbw %%mm1, %%mm3            \n\t"
-        "paddw %%mm3, %%mm0             \n\t"
+        "psadbw (%2, %%"REG_a"), %%mm1  \n\t"
+        "paddw %%mm1, %%mm0             \n\t"
         "paddw %%mm0, %%mm6             \n\t"
         "add %3, %%"REG_a"              \n\t"
         " js 1b                         \n\t"
@@ -97,17 +95,13 @@ static inline void sad8_2_mmx2(uint8_t *
         ASMALIGN(4)
         "1:                             \n\t"
         "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "movq (%2, %%"REG_a"), %%mm2    \n\t"
-        "pavgb %%mm2, %%mm0             \n\t"
-        "movq (%3, %%"REG_a"), %%mm2    \n\t"
-        "psadbw %%mm2, %%mm0            \n\t"
+        "pavgb (%2, %%"REG_a"), %%mm0   \n\t"
+        "psadbw (%3, %%"REG_a"), %%mm0  \n\t"
         "add %4, %%"REG_a"              \n\t"
         "movq (%1, %%"REG_a"), %%mm1    \n\t"
-        "movq (%2, %%"REG_a"), %%mm3    \n\t"
-        "pavgb %%mm1, %%mm3             \n\t"
-        "movq (%3, %%"REG_a"), %%mm1    \n\t"
-        "psadbw %%mm1, %%mm3            \n\t"
-        "paddw %%mm3, %%mm0             \n\t"
+        "pavgb (%2, %%"REG_a"), %%mm1   \n\t"
+        "psadbw (%3, %%"REG_a"), %%mm1  \n\t"
+        "paddw %%mm1, %%mm0             \n\t"
         "paddw %%mm0, %%mm6             \n\t"
         "add %4, %%"REG_a"              \n\t"
         " js 1b                         \n\t"
@@ -120,30 +114,24 @@ static inline void sad8_4_mmx2(uint8_t *
 { //FIXME reuse src
     long len= -(stride*h);
     asm volatile(
-        ASMALIGN(4)
         "movq "MANGLE(bone)", %%mm5     \n\t"
+        ASMALIGN(4)
         "1:                             \n\t"
         "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "movq (%2, %%"REG_a"), %%mm2    \n\t"
         "movq 1(%1, %%"REG_a"), %%mm1   \n\t"
-        "movq 1(%2, %%"REG_a"), %%mm3   \n\t"
-        "pavgb %%mm2, %%mm0             \n\t"
-        "pavgb %%mm1, %%mm3             \n\t"
-        "psubusb %%mm5, %%mm3           \n\t"
-        "pavgb %%mm3, %%mm0             \n\t"
-        "movq (%3, %%"REG_a"), %%mm2    \n\t"
-        "psadbw %%mm2, %%mm0            \n\t"
+        "pavgb (%2, %%"REG_a"), %%mm0   \n\t"
+        "pavgb 1(%2, %%"REG_a"), %%mm1  \n\t"
+        "psubusb %%mm5, %%mm1           \n\t"
+        "pavgb %%mm1, %%mm0             \n\t"
+        "psadbw (%3, %%"REG_a"), %%mm0  \n\t"
         "add %4, %%"REG_a"              \n\t"
-        "movq (%1, %%"REG_a"), %%mm1    \n\t"
-        "movq (%2, %%"REG_a"), %%mm3    \n\t"
-        "movq 1(%1, %%"REG_a"), %%mm2   \n\t"
-        "movq 1(%2, %%"REG_a"), %%mm4   \n\t"
-        "pavgb %%mm3, %%mm1             \n\t"
-        "pavgb %%mm4, %%mm2             \n\t"
-        "psubusb %%mm5, %%mm2           \n\t"
-        "pavgb %%mm1, %%mm2             \n\t"
-        "movq (%3, %%"REG_a"), %%mm1    \n\t"
-        "psadbw %%mm1, %%mm2            \n\t"
+        "movq (%1, %%"REG_a"), %%mm2    \n\t"
+        "movq 1(%1, %%"REG_a"), %%mm3   \n\t"
+        "pavgb (%2, %%"REG_a"), %%mm2   \n\t"
+        "pavgb 1(%2, %%"REG_a"), %%mm3  \n\t"
+        "psubusb %%mm5, %%mm3           \n\t"
+        "pavgb %%mm3, %%mm2             \n\t"
+        "psadbw (%3, %%"REG_a"), %%mm2  \n\t"
         "paddw %%mm2, %%mm0             \n\t"
         "paddw %%mm0, %%mm6             \n\t"
         "add %4, %%"REG_a"              \n\t"




More information about the ffmpeg-cvslog mailing list