x86/dsputil_mmx: support 4 sample edges
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Jun 2012 14:12:54 +0000 (16:12 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Jun 2012 15:23:09 +0000 (17:23 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/x86/dsputil_mmx.c

index a4e3239fb8e5b1bfd7bbf2bdce65bbe27c8cdd97..31277d547b03811966fa360c2aa9f18ebc2e1564 100644 (file)
@@ -807,7 +807,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height,
             : "+r"(ptr)
             : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
             );
-    } else {
+    } else if(w==16){
         __asm__ volatile (
             "1:                                 \n\t"
             "movd            (%0), %%mm0        \n\t"
@@ -828,6 +828,25 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height,
             : "+r"(ptr)
             : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
             );
+    } else {
+        av_assert1(w == 4);
+        __asm__ volatile (
+            "1:                             \n\t"
+            "movd            (%0), %%mm0    \n\t"
+            "punpcklbw      %%mm0, %%mm0    \n\t"
+            "punpcklwd      %%mm0, %%mm0    \n\t"
+            "movd           %%mm0, -4(%0)   \n\t"
+            "movd      -4(%0, %2), %%mm1    \n\t"
+            "punpcklbw      %%mm1, %%mm1    \n\t"
+            "punpckhwd      %%mm1, %%mm1    \n\t"
+            "punpckhdq      %%mm1, %%mm1    \n\t"
+            "movd           %%mm1, (%0, %2) \n\t"
+            "add               %1, %0       \n\t"
+            "cmp               %3, %0       \n\t"
+            "jb                1b           \n\t"
+            : "+r"(ptr)
+            : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
+            );
     }
 
     /* top and bottom (and hopefully also the corners) */