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>
... | ... |
@@ -23,12 +23,15 @@ |
23 | 23 |
#include "libavutil/opt.h" |
24 | 24 |
#include "libavutil/pixdesc.h" |
25 | 25 |
#include "libavutil/imgutils.h" |
26 |
+#include "libavutil/x86/asm.h" |
|
27 |
+#include "libavutil/x86/cpu.h" |
|
26 | 28 |
#include "avfilter.h" |
27 | 29 |
#include "formats.h" |
28 | 30 |
#include "internal.h" |
29 | 31 |
#include "video.h" |
30 | 32 |
#include "yadif.h" |
31 | 33 |
|
34 |
+ |
|
32 | 35 |
typedef struct ThreadData { |
33 | 36 |
AVFrame *frame; |
34 | 37 |
int plane; |
... | ... |
@@ -37,6 +40,35 @@ typedef struct ThreadData { |
37 | 37 |
int tff; |
38 | 38 |
} ThreadData; |
39 | 39 |
|
40 |
+typedef struct YADIFContext { |
|
41 |
+ const AVClass *class; |
|
42 |
+ |
|
43 |
+ enum YADIFMode mode; |
|
44 |
+ enum YADIFParity parity; |
|
45 |
+ enum YADIFDeint deint; |
|
46 |
+ |
|
47 |
+ int frame_pending; |
|
48 |
+ |
|
49 |
+ AVFrame *cur; |
|
50 |
+ AVFrame *next; |
|
51 |
+ AVFrame *prev; |
|
52 |
+ AVFrame *out; |
|
53 |
+ |
|
54 |
+ /** |
|
55 |
+ * Required alignment for filter_line |
|
56 |
+ */ |
|
57 |
+ void (*filter_line)(void *dst, |
|
58 |
+ void *prev, void *cur, void *next, |
|
59 |
+ int w, int prefs, int mrefs, int parity, int mode); |
|
60 |
+ void (*filter_edges)(void *dst, void *prev, void *cur, void *next, |
|
61 |
+ int w, int prefs, int mrefs, int parity, int mode); |
|
62 |
+ |
|
63 |
+ const AVPixFmtDescriptor *csp; |
|
64 |
+ int eof; |
|
65 |
+ uint8_t *temp_line; |
|
66 |
+ int temp_line_size; |
|
67 |
+} YADIFContext; |
|
68 |
+ |
|
40 | 69 |
#define CHECK(j)\ |
41 | 70 |
{ int score = FFABS(cur[mrefs - 1 + j] - cur[prefs - 1 - j])\ |
42 | 71 |
+ FFABS(cur[mrefs + j] - cur[prefs - j])\ |
... | ... |
@@ -461,6 +493,9 @@ static int config_props(AVFilterLink *link) |
461 | 461 |
{ |
462 | 462 |
AVFilterContext *ctx = link->src; |
463 | 463 |
YADIFContext *s = link->src->priv; |
464 |
+ int cpu_flags = av_get_cpu_flags(); |
|
465 |
+ int bit_depth = (!s->csp) ? 8 |
|
466 |
+ : s->csp->comp[0].depth_minus1 + 1; |
|
464 | 467 |
|
465 | 468 |
link->time_base.num = link->src->inputs[0]->time_base.num; |
466 | 469 |
link->time_base.den = link->src->inputs[0]->time_base.den * 2; |
... | ... |
@@ -484,9 +519,38 @@ static int config_props(AVFilterLink *link) |
484 | 484 |
s->filter_edges = filter_edges; |
485 | 485 |
} |
486 | 486 |
|
487 |
- if (ARCH_X86) |
|
488 |
- ff_yadif_init_x86(s); |
|
489 |
- |
|
487 |
+#if HAVE_YASM |
|
488 |
+ if (bit_depth >= 15) { |
|
489 |
+ if (EXTERNAL_SSE4(cpu_flags)) |
|
490 |
+ s->filter_line = ff_yadif_filter_line_16bit_sse4; |
|
491 |
+ else if (EXTERNAL_SSSE3(cpu_flags)) |
|
492 |
+ s->filter_line = ff_yadif_filter_line_16bit_ssse3; |
|
493 |
+ else if (EXTERNAL_SSE2(cpu_flags)) |
|
494 |
+ s->filter_line = ff_yadif_filter_line_16bit_sse2; |
|
495 |
+#if ARCH_X86_32 |
|
496 |
+ else if (EXTERNAL_MMXEXT(cpu_flags)) |
|
497 |
+ s->filter_line = ff_yadif_filter_line_16bit_mmxext; |
|
498 |
+#endif /* ARCH_X86_32 */ |
|
499 |
+ } else if ( bit_depth >= 9 && bit_depth <= 14) { |
|
500 |
+ if (EXTERNAL_SSSE3(cpu_flags)) |
|
501 |
+ s->filter_line = ff_yadif_filter_line_10bit_ssse3; |
|
502 |
+ else if (EXTERNAL_SSE2(cpu_flags)) |
|
503 |
+ s->filter_line = ff_yadif_filter_line_10bit_sse2; |
|
504 |
+#if ARCH_X86_32 |
|
505 |
+ else if (EXTERNAL_MMXEXT(cpu_flags)) |
|
506 |
+ s->filter_line = ff_yadif_filter_line_10bit_mmxext; |
|
507 |
+#endif /* ARCH_X86_32 */ |
|
508 |
+ } else { |
|
509 |
+ if (EXTERNAL_SSSE3(cpu_flags)) |
|
510 |
+ s->filter_line = ff_yadif_filter_line_ssse3; |
|
511 |
+ else if (EXTERNAL_SSE2(cpu_flags)) |
|
512 |
+ s->filter_line = ff_yadif_filter_line_sse2; |
|
513 |
+#if ARCH_X86_32 |
|
514 |
+ else if (EXTERNAL_MMXEXT(cpu_flags)) |
|
515 |
+ s->filter_line = ff_yadif_filter_line_mmxext; |
|
516 |
+#endif /* ARCH_X86_32 */ |
|
517 |
+ } |
|
518 |
+#endif /* HAVE_YASM */ |
|
490 | 519 |
return 0; |
491 | 520 |
} |
492 | 521 |
|
... | ... |
@@ -3,7 +3,6 @@ OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o |
3 | 3 |
OBJS-$(CONFIG_PULLUP_FILTER) += x86/vf_pullup_init.o |
4 | 4 |
OBJS-$(CONFIG_SPP_FILTER) += x86/vf_spp.o |
5 | 5 |
OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume_init.o |
6 |
-OBJS-$(CONFIG_YADIF_FILTER) += x86/vf_yadif_init.o |
|
7 | 6 |
|
8 | 7 |
YASM-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun.o |
9 | 8 |
YASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d.o |
10 | 9 |
deleted file mode 100644 |
... | ... |
@@ -1,99 +0,0 @@ |
1 |
-/* |
|
2 |
- * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at> |
|
3 |
- * |
|
4 |
- * This file is part of FFmpeg. |
|
5 |
- * |
|
6 |
- * FFmpeg is free software; you can redistribute it and/or modify |
|
7 |
- * it under the terms of the GNU General Public License as published by |
|
8 |
- * the Free Software Foundation; either version 2 of the License, or |
|
9 |
- * (at your option) any later version. |
|
10 |
- * |
|
11 |
- * FFmpeg is distributed in the hope that it will be useful, |
|
12 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
- * GNU General Public License for more details. |
|
15 |
- * |
|
16 |
- * You should have received a copy of the GNU General Public License along |
|
17 |
- * with FFmpeg; if not, write to the Free Software Foundation, Inc., |
|
18 |
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
- */ |
|
20 |
- |
|
21 |
-#include "libavutil/attributes.h" |
|
22 |
-#include "libavutil/cpu.h" |
|
23 |
-#include "libavutil/mem.h" |
|
24 |
-#include "libavutil/x86/asm.h" |
|
25 |
-#include "libavutil/x86/cpu.h" |
|
26 |
-#include "libavfilter/yadif.h" |
|
27 |
- |
|
28 |
-void ff_yadif_filter_line_mmxext(void *dst, void *prev, void *cur, |
|
29 |
- void *next, int w, int prefs, |
|
30 |
- int mrefs, int parity, int mode); |
|
31 |
-void ff_yadif_filter_line_sse2(void *dst, void *prev, void *cur, |
|
32 |
- void *next, int w, int prefs, |
|
33 |
- int mrefs, int parity, int mode); |
|
34 |
-void ff_yadif_filter_line_ssse3(void *dst, void *prev, void *cur, |
|
35 |
- void *next, int w, int prefs, |
|
36 |
- int mrefs, int parity, int mode); |
|
37 |
- |
|
38 |
-void ff_yadif_filter_line_16bit_mmxext(void *dst, void *prev, void *cur, |
|
39 |
- void *next, int w, int prefs, |
|
40 |
- int mrefs, int parity, int mode); |
|
41 |
-void ff_yadif_filter_line_16bit_sse2(void *dst, void *prev, void *cur, |
|
42 |
- void *next, int w, int prefs, |
|
43 |
- int mrefs, int parity, int mode); |
|
44 |
-void ff_yadif_filter_line_16bit_ssse3(void *dst, void *prev, void *cur, |
|
45 |
- void *next, int w, int prefs, |
|
46 |
- int mrefs, int parity, int mode); |
|
47 |
-void ff_yadif_filter_line_16bit_sse4(void *dst, void *prev, void *cur, |
|
48 |
- void *next, int w, int prefs, |
|
49 |
- int mrefs, int parity, int mode); |
|
50 |
- |
|
51 |
-void ff_yadif_filter_line_10bit_mmxext(void *dst, void *prev, void *cur, |
|
52 |
- void *next, int w, int prefs, |
|
53 |
- int mrefs, int parity, int mode); |
|
54 |
-void ff_yadif_filter_line_10bit_sse2(void *dst, void *prev, void *cur, |
|
55 |
- void *next, int w, int prefs, |
|
56 |
- int mrefs, int parity, int mode); |
|
57 |
-void ff_yadif_filter_line_10bit_ssse3(void *dst, void *prev, void *cur, |
|
58 |
- void *next, int w, int prefs, |
|
59 |
- int mrefs, int parity, int mode); |
|
60 |
- |
|
61 |
-av_cold void ff_yadif_init_x86(YADIFContext *yadif) |
|
62 |
-{ |
|
63 |
-#if HAVE_YASM |
|
64 |
- int cpu_flags = av_get_cpu_flags(); |
|
65 |
- int bit_depth = (!yadif->csp) ? 8 |
|
66 |
- : yadif->csp->comp[0].depth_minus1 + 1; |
|
67 |
- |
|
68 |
- if (bit_depth >= 15) { |
|
69 |
-#if ARCH_X86_32 |
|
70 |
- if (EXTERNAL_MMXEXT(cpu_flags)) |
|
71 |
- yadif->filter_line = ff_yadif_filter_line_16bit_mmxext; |
|
72 |
-#endif /* ARCH_X86_32 */ |
|
73 |
- if (EXTERNAL_SSE2(cpu_flags)) |
|
74 |
- yadif->filter_line = ff_yadif_filter_line_16bit_sse2; |
|
75 |
- if (EXTERNAL_SSSE3(cpu_flags)) |
|
76 |
- yadif->filter_line = ff_yadif_filter_line_16bit_ssse3; |
|
77 |
- if (EXTERNAL_SSE4(cpu_flags)) |
|
78 |
- yadif->filter_line = ff_yadif_filter_line_16bit_sse4; |
|
79 |
- } else if ( bit_depth >= 9 && bit_depth <= 14) { |
|
80 |
-#if ARCH_X86_32 |
|
81 |
- if (EXTERNAL_MMXEXT(cpu_flags)) |
|
82 |
- yadif->filter_line = ff_yadif_filter_line_10bit_mmxext; |
|
83 |
-#endif /* ARCH_X86_32 */ |
|
84 |
- if (EXTERNAL_SSE2(cpu_flags)) |
|
85 |
- yadif->filter_line = ff_yadif_filter_line_10bit_sse2; |
|
86 |
- if (EXTERNAL_SSSE3(cpu_flags)) |
|
87 |
- yadif->filter_line = ff_yadif_filter_line_10bit_ssse3; |
|
88 |
- } else { |
|
89 |
-#if ARCH_X86_32 |
|
90 |
- if (EXTERNAL_MMXEXT(cpu_flags)) |
|
91 |
- yadif->filter_line = ff_yadif_filter_line_mmxext; |
|
92 |
-#endif /* ARCH_X86_32 */ |
|
93 |
- if (EXTERNAL_SSE2(cpu_flags)) |
|
94 |
- yadif->filter_line = ff_yadif_filter_line_sse2; |
|
95 |
- if (EXTERNAL_SSSE3(cpu_flags)) |
|
96 |
- yadif->filter_line = ff_yadif_filter_line_ssse3; |
|
97 |
- } |
|
98 |
-#endif /* HAVE_YASM */ |
|
99 |
-} |
... | ... |
@@ -19,7 +19,6 @@ |
19 | 19 |
#ifndef AVFILTER_YADIF_H |
20 | 20 |
#define AVFILTER_YADIF_H |
21 | 21 |
|
22 |
-#include "libavutil/pixdesc.h" |
|
23 | 22 |
#include "avfilter.h" |
24 | 23 |
|
25 | 24 |
enum YADIFMode { |
... | ... |
@@ -40,35 +39,37 @@ enum YADIFDeint { |
40 | 40 |
YADIF_DEINT_INTERLACED = 1, ///< only deinterlace frames marked as interlaced |
41 | 41 |
}; |
42 | 42 |
|
43 |
-typedef struct YADIFContext { |
|
44 |
- const AVClass *class; |
|
43 |
+void ff_yadif_filter_line_mmxext(void *dst, void *prev, void *cur, |
|
44 |
+ void *next, int w, int prefs, |
|
45 |
+ int mrefs, int parity, int mode); |
|
46 |
+void ff_yadif_filter_line_sse2(void *dst, void *prev, void *cur, |
|
47 |
+ void *next, int w, int prefs, |
|
48 |
+ int mrefs, int parity, int mode); |
|
49 |
+void ff_yadif_filter_line_ssse3(void *dst, void *prev, void *cur, |
|
50 |
+ void *next, int w, int prefs, |
|
51 |
+ int mrefs, int parity, int mode); |
|
45 | 52 |
|
46 |
- enum YADIFMode mode; |
|
47 |
- enum YADIFParity parity; |
|
48 |
- enum YADIFDeint deint; |
|
53 |
+void ff_yadif_filter_line_16bit_mmxext(void *dst, void *prev, void *cur, |
|
54 |
+ void *next, int w, int prefs, |
|
55 |
+ int mrefs, int parity, int mode); |
|
56 |
+void ff_yadif_filter_line_16bit_sse2(void *dst, void *prev, void *cur, |
|
57 |
+ void *next, int w, int prefs, |
|
58 |
+ int mrefs, int parity, int mode); |
|
59 |
+void ff_yadif_filter_line_16bit_ssse3(void *dst, void *prev, void *cur, |
|
60 |
+ void *next, int w, int prefs, |
|
61 |
+ int mrefs, int parity, int mode); |
|
62 |
+void ff_yadif_filter_line_16bit_sse4(void *dst, void *prev, void *cur, |
|
63 |
+ void *next, int w, int prefs, |
|
64 |
+ int mrefs, int parity, int mode); |
|
49 | 65 |
|
50 |
- int frame_pending; |
|
51 |
- |
|
52 |
- AVFrame *cur; |
|
53 |
- AVFrame *next; |
|
54 |
- AVFrame *prev; |
|
55 |
- AVFrame *out; |
|
56 |
- |
|
57 |
- /** |
|
58 |
- * Required alignment for filter_line |
|
59 |
- */ |
|
60 |
- void (*filter_line)(void *dst, |
|
61 |
- void *prev, void *cur, void *next, |
|
62 |
- int w, int prefs, int mrefs, int parity, int mode); |
|
63 |
- void (*filter_edges)(void *dst, void *prev, void *cur, void *next, |
|
64 |
- int w, int prefs, int mrefs, int parity, int mode); |
|
65 |
- |
|
66 |
- const AVPixFmtDescriptor *csp; |
|
67 |
- int eof; |
|
68 |
- uint8_t *temp_line; |
|
69 |
- int temp_line_size; |
|
70 |
-} YADIFContext; |
|
71 |
- |
|
72 |
-void ff_yadif_init_x86(YADIFContext *yadif); |
|
66 |
+void ff_yadif_filter_line_10bit_mmxext(void *dst, void *prev, void *cur, |
|
67 |
+ void *next, int w, int prefs, |
|
68 |
+ int mrefs, int parity, int mode); |
|
69 |
+void ff_yadif_filter_line_10bit_sse2(void *dst, void *prev, void *cur, |
|
70 |
+ void *next, int w, int prefs, |
|
71 |
+ int mrefs, int parity, int mode); |
|
72 |
+void ff_yadif_filter_line_10bit_ssse3(void *dst, void *prev, void *cur, |
|
73 |
+ void *next, int w, int prefs, |
|
74 |
+ int mrefs, int parity, int mode); |
|
73 | 75 |
|
74 | 76 |
#endif /* AVFILTER_YADIF_H */ |