[FFmpeg-devel] [PATCH] SSE2 version of vf_idet's filter_line()
James Almer
jamrial at gmail.com
Wed Sep 3 19:14:46 CEST 2014
> diff --git a/libavfilter/x86/vf_idet_init.c b/libavfilter/x86/vf_idet_init.c
> new file mode 100644
> index 0000000..402d504
> --- /dev/null
> +++ b/libavfilter/x86/vf_idet_init.c
> @@ -0,0 +1,70 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "libavutil/attributes.h"
> +#include "libavutil/cpu.h"
> +#include "libavutil/mem.h"
> +#include "libavutil/x86/asm.h"
> +#include "libavutil/x86/cpu.h"
> +#include "libavfilter/vf_idet.h"
> +
> +/* declares main callable idet_filter_line_{mmx,mmxext,sse2}() */
> +#define FUNC_MAIN_DECL(KIND, SPAN) \
> +int ff_idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b, \
> + const uint8_t *c, int w); \
> +static int idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b, \
> + const uint8_t *c, int w) { \
> + int sum = 0; \
> + const int left_over = w % SPAN; \
Can w ever be < 0? If not then w & SPAN-1 should be faster.
You could also make SPAN be 15 and 7 to avoid that -1.
> + w -= left_over; \
> + if (w > 0) \
> + sum += ff_idet_filter_line_##KIND(a, b, c, w); \
> + if (left_over > 0) \
> + sum += ff_idet_filter_line_c(a + w, b + w, c + w, left_over); \
> + return sum; \
> +}
More information about the ffmpeg-devel
mailing list