summaryrefslogtreecommitdiff
path: root/libavfilter/x86
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2013-10-24 02:24:05 +0200
committerDiego Biurrun <diego@biurrun.de>2013-10-31 16:34:18 +0100
commited1a11ed52bbd1f15bb9b0416d69b7924bee3191 (patch)
tree91ec61c30aeb8e68c00a6f27b541d6e85d7bc266 /libavfilter/x86
parentee80cf741a44115758e62399b7bde08d33161151 (diff)
gradfun: x86: Factor out common code for some gradfun_filter_line() variants
Diffstat (limited to 'libavfilter/x86')
-rw-r--r--libavfilter/x86/vf_gradfun_init.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/libavfilter/x86/vf_gradfun_init.c b/libavfilter/x86/vf_gradfun_init.c
index d45fb9906c..3f23bf6799 100644
--- a/libavfilter/x86/vf_gradfun_init.c
+++ b/libavfilter/x86/vf_gradfun_init.c
@@ -42,13 +42,13 @@ void ff_gradfun_blur_line_movdqu_sse2(intptr_t x, uint16_t *buf,
uint8_t *src1, uint8_t *src2);
#if HAVE_YASM
-static void gradfun_filter_line_mmxext(uint8_t *dst, uint8_t *src, 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,21 +58,18 @@ static void gradfun_filter_line_mmxext(uint8_t *dst, uint8_t *src, uint16_t *dc,
thresh, dithers);
}
+static void gradfun_filter_line_mmxext(uint8_t *dst, uint8_t *src, 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,
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,