]> git.sesse.net Git - ffmpeg/blob - libavfilter/x86/vf_yadif_init.c
Merge commit '2df0776c2293efb0ac12c003843ce19332342e01'
[ffmpeg] / libavfilter / x86 / vf_yadif_init.c
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 }