From efcc10645525e7b5c2f3d7d46ecf6b5d267867f5 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 26 Jan 2011 22:37:50 -0500 Subject: [PATCH] Optimize C version of ff_emulated_edge_mc(). From ~780 cycles to 551 cycles, mostly just by using libc memcpy() instead of manually shuffling individual bytes around. (cherry picked from commit e5262ec44a30a9132f0361f775c5b63d20e4e4d5) --- libavcodec/dsputil.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 84f91fc135..fafe5f52d7 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -355,38 +355,45 @@ void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, int blo start_x= FFMAX(0, -src_x); end_y= FFMIN(block_h, h-src_y); end_x= FFMIN(block_w, w-src_x); + assert(start_y < end_y && block_h); + assert(start_x < end_x && block_w); - // copy existing part - for(y=start_y; y