The mmx memory copy code is not nearly as efficient as memcpy(), which would make draw_edges_mmx much slower than draw_edges_8_c.
Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz: before after draw_edges_8_1724_4_mmx: 8697.2 8739.6 ( 1.00x) draw_edges_8_1724_8_mmx: 10439.0 10548.4 ( 0.99x) draw_edges_8_1724_16_mmx: 10687.5 10876.1 ( 0.98x) draw_edges_128_407_4_mmx: 4252.5 3562.4 ( 1.19x) draw_edges_128_407_8_mmx: 4561.7 3868.1 ( 1.18x) draw_edges_128_407_16_mmx: 5505.7 4533.4 ( 1.21x) draw_edges_1080_31_4_mmx: 1667.7 560.4 ( 2.98x) draw_edges_1080_31_8_mmx: 2804.5 1232.1 ( 2.28x) draw_edges_1080_31_16_mmx: 12478.5 3829.6 ( 3.26x) draw_edges_1920_4_4_mmx: 2596.2 812.4 ( 3.20x) draw_edges_1920_4_8_mmx: 8056.0 2964.4 ( 2.72x) draw_edges_1920_4_16_mmx: 24628.7 6387.9 ( 3.86x) --- libavcodec/x86/mpegvideoencdsp_init.c | 51 ++++++--------------------- 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/libavcodec/x86/mpegvideoencdsp_init.c b/libavcodec/x86/mpegvideoencdsp_init.c index 503548e668..c30fa91175 100644 --- a/libavcodec/x86/mpegvideoencdsp_init.c +++ b/libavcodec/x86/mpegvideoencdsp_init.c @@ -166,46 +166,17 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, "r" (ptr + wrap * height)); } - /* top and bottom (and hopefully also the corners) */ - if (sides & EDGE_TOP) { - for (i = 0; i < h; i += 4) { - ptr = buf - (i + 1) * wrap - w; - __asm__ volatile ( - "1: \n\t" - "movq (%1, %0), %%mm0 \n\t" - "movq %%mm0, (%0) \n\t" - "movq %%mm0, (%0, %2) \n\t" - "movq %%mm0, (%0, %2, 2) \n\t" - "movq %%mm0, (%0, %3) \n\t" - "add $8, %0 \n\t" - "cmp %4, %0 \n\t" - "jb 1b \n\t" - : "+r" (ptr) - : "r" ((x86_reg) buf - (x86_reg) ptr - w), - "r" ((x86_reg) - wrap), "r" ((x86_reg) - wrap * 3), - "r" (ptr + width + 2 * w)); - } - } - - if (sides & EDGE_BOTTOM) { - for (i = 0; i < h; i += 4) { - ptr = last_line + (i + 1) * wrap - w; - __asm__ volatile ( - "1: \n\t" - "movq (%1, %0), %%mm0 \n\t" - "movq %%mm0, (%0) \n\t" - "movq %%mm0, (%0, %2) \n\t" - "movq %%mm0, (%0, %2, 2) \n\t" - "movq %%mm0, (%0, %3) \n\t" - "add $8, %0 \n\t" - "cmp %4, %0 \n\t" - "jb 1b \n\t" - : "+r" (ptr) - : "r" ((x86_reg) last_line - (x86_reg) ptr - w), - "r" ((x86_reg) wrap), "r" ((x86_reg) wrap * 3), - "r" (ptr + width + 2 * w)); - } - } + /* top and bottom + corners */ + buf -= w; + last_line = buf + (height - 1) * wrap; + if (sides & EDGE_TOP) + for (i = 0; i < h; i++) + // top + memcpy(buf - (i + 1) * wrap, buf, width + w + w); + if (sides & EDGE_BOTTOM) + for (i = 0; i < h; i++) + // bottom + memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); } #endif /* HAVE_INLINE_ASM */ -- 2.30.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".