From: Michael Niedermayer Date: Fri, 1 Nov 2013 09:26:49 +0000 (+0100) Subject: Merge commit 'ed1a11ed52bbd1f15bb9b0416d69b7924bee3191' X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=fc5fe4804fd2ee9a29de502e9431b12d027c0c89;p=ffmpeg Merge commit 'ed1a11ed52bbd1f15bb9b0416d69b7924bee3191' * commit 'ed1a11ed52bbd1f15bb9b0416d69b7924bee3191': gradfun: x86: Factor out common code for some gradfun_filter_line() variants Conflicts: libavfilter/x86/vf_gradfun_init.c Merged-by: Michael Niedermayer --- fc5fe4804fd2ee9a29de502e9431b12d027c0c89 diff --cc libavfilter/x86/vf_gradfun_init.c index c638a05e875,3f23bf67994..3f5b842fb92 --- a/libavfilter/x86/vf_gradfun_init.c +++ b/libavfilter/x86/vf_gradfun_init.c @@@ -34,21 -35,20 +34,20 @@@ void ff_gradfun_filter_line_ssse3(intpt const uint16_t *dithers); void ff_gradfun_blur_line_movdqa_sse2(intptr_t x, uint16_t *buf, - uint16_t *buf1, uint16_t *dc, - uint8_t *src1, uint8_t *src2); + const uint16_t *buf1, uint16_t *dc, + const uint8_t *src1, const uint8_t *src2); void ff_gradfun_blur_line_movdqu_sse2(intptr_t x, uint16_t *buf, - uint16_t *buf1, uint16_t *dc, - uint8_t *src1, uint8_t *src2); + const uint16_t *buf1, uint16_t *dc, + const uint8_t *src1, const uint8_t *src2); #if HAVE_YASM - static void gradfun_filter_line_mmxext(uint8_t *dst, const uint8_t *src, - const uint16_t *dc, - int width, int thresh, - const uint16_t *dithers) + static void gradfun_filter_line(uint8_t *dst, uint8_t *src, uint16_t *dc, + int width, int thresh, const uint16_t *dithers, + int alignment) { intptr_t x; - if (width & 3) { - x = width & ~3; + if (width & alignment) { + x = width & ~alignment; ff_gradfun_filter_line_c(dst + x, src + x, dc + x / 2, width - x, thresh, dithers); width = x; @@@ -58,25 -58,22 +57,23 @@@ thresh, dithers); } -static void gradfun_filter_line_mmxext(uint8_t *dst, uint8_t *src, uint16_t *dc, ++static void gradfun_filter_line_mmxext(uint8_t *dst, const uint8_t *src, ++ const uint16_t *dc, + int width, int thresh, + const uint16_t *dithers) + { + gradfun_filter_line(dst, src, dc, width, thresh, dithers, 3); + } + -static void gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, +static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) { - intptr_t x; - if (width & 7) { - // could be 10% faster if I somehow eliminated this - x = width & ~7; - ff_gradfun_filter_line_c(dst + x, src + x, dc + x / 2, - width - x, thresh, dithers); - width = x; - } - x = -width; - ff_gradfun_filter_line_ssse3(x, dst + width, src + width, dc + width / 2, - thresh, dithers); + gradfun_filter_line(dst, src, dc, width, thresh, dithers, 7); } -static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, - uint8_t *src, int src_linesize, int width) +static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, + const uint8_t *src, int src_linesize, int width) { intptr_t x = -2 * width; if (((intptr_t) src | src_linesize) & 15)