diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-01 17:42:07 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-01 20:26:26 +0100 |
commit | 975110a85ef8e794fdc041455ff41b0ad30bc01e (patch) | |
tree | bcc04dfe57b2c30191fd6b8eaaa72f44a18e3247 /libavfilter/vf_yadif.c | |
parent | ab00800cde1af1f252731118062dd5149f1a7ed7 (diff) |
Revert "vf_yadif: move x86 init code to x86/yadif.c"
This reverts commit a87b17f3283aada762820f1b797eeb7a2dff6c61.
This reduces the amount of non LGPL code, making a relicensing to LGPL
easier
Conflicts:
libavfilter/vf_yadif.c
libavfilter/x86/yadif.c
libavfilter/x86/yadif_template.c
libavfilter/yadif.h
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_yadif.c')
-rw-r--r-- | libavfilter/vf_yadif.c | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 933534d551..40383a4d06 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -23,12 +23,15 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" +#include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "avfilter.h" #include "formats.h" #include "internal.h" #include "video.h" #include "yadif.h" + typedef struct ThreadData { AVFrame *frame; int plane; @@ -37,6 +40,35 @@ typedef struct ThreadData { int tff; } ThreadData; +typedef struct YADIFContext { + const AVClass *class; + + enum YADIFMode mode; + enum YADIFParity parity; + enum YADIFDeint deint; + + int frame_pending; + + AVFrame *cur; + AVFrame *next; + AVFrame *prev; + AVFrame *out; + + /** + * Required alignment for filter_line + */ + void (*filter_line)(void *dst, + void *prev, void *cur, void *next, + int w, int prefs, int mrefs, int parity, int mode); + void (*filter_edges)(void *dst, void *prev, void *cur, void *next, + int w, int prefs, int mrefs, int parity, int mode); + + const AVPixFmtDescriptor *csp; + int eof; + uint8_t *temp_line; + int temp_line_size; +} YADIFContext; + #define CHECK(j)\ { int score = FFABS(cur[mrefs - 1 + j] - cur[prefs - 1 - j])\ + FFABS(cur[mrefs + j] - cur[prefs - j])\ @@ -461,6 +493,9 @@ static int config_props(AVFilterLink *link) { AVFilterContext *ctx = link->src; YADIFContext *s = link->src->priv; + int cpu_flags = av_get_cpu_flags(); + int bit_depth = (!s->csp) ? 8 + : s->csp->comp[0].depth_minus1 + 1; link->time_base.num = link->src->inputs[0]->time_base.num; link->time_base.den = link->src->inputs[0]->time_base.den * 2; @@ -484,9 +519,38 @@ static int config_props(AVFilterLink *link) s->filter_edges = filter_edges; } - if (ARCH_X86) - ff_yadif_init_x86(s); - +#if HAVE_YASM + if (bit_depth >= 15) { + if (EXTERNAL_SSE4(cpu_flags)) + s->filter_line = ff_yadif_filter_line_16bit_sse4; + else if (EXTERNAL_SSSE3(cpu_flags)) + s->filter_line = ff_yadif_filter_line_16bit_ssse3; + else if (EXTERNAL_SSE2(cpu_flags)) + s->filter_line = ff_yadif_filter_line_16bit_sse2; +#if ARCH_X86_32 + else if (EXTERNAL_MMXEXT(cpu_flags)) + s->filter_line = ff_yadif_filter_line_16bit_mmxext; +#endif /* ARCH_X86_32 */ + } else if ( bit_depth >= 9 && bit_depth <= 14) { + if (EXTERNAL_SSSE3(cpu_flags)) + s->filter_line = ff_yadif_filter_line_10bit_ssse3; + else if (EXTERNAL_SSE2(cpu_flags)) + s->filter_line = ff_yadif_filter_line_10bit_sse2; +#if ARCH_X86_32 + else if (EXTERNAL_MMXEXT(cpu_flags)) + s->filter_line = ff_yadif_filter_line_10bit_mmxext; +#endif /* ARCH_X86_32 */ + } else { + if (EXTERNAL_SSSE3(cpu_flags)) + s->filter_line = ff_yadif_filter_line_ssse3; + else if (EXTERNAL_SSE2(cpu_flags)) + s->filter_line = ff_yadif_filter_line_sse2; +#if ARCH_X86_32 + else if (EXTERNAL_MMXEXT(cpu_flags)) + s->filter_line = ff_yadif_filter_line_mmxext; +#endif /* ARCH_X86_32 */ + } +#endif /* HAVE_YASM */ return 0; } |