1 /*
2 * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of Libav.
5 *
6 * Libav 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 * Libav 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 Libav; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include "config.h"
22
23 #include <glib.h>
24
25 #if HAVE_CPU_X86_64
26
27 typedef struct xmm_reg
28 {
29 guint64 a, b;
30 } xmm_reg;
31 typedef gint64 x86_reg;
32 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
33 #define DECLARE_ASM_CONST(n,t,v) static const t __attribute__((used)) __attribute__ ((aligned (n))) v
34
35 #if defined(__APPLE__)
36 # define EXTERN_PREFIX "_"
37 #else
38 # define EXTERN_PREFIX ""
39 #endif
40
41 #if defined(__PIC__)
42 # define LOCAL_MANGLE(a) #a "(%%rip)"
43 #else
44 # define LOCAL_MANGLE(a) #a
45 #endif
46
47 #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
48
49 DECLARE_ASM_CONST (16, xmm_reg, pb_1) = {
50 0x0101010101010101ULL, 0x0101010101010101ULL};
51
52 DECLARE_ASM_CONST (16, xmm_reg, pw_1) = {
53 0x0001000100010001ULL, 0x0001000100010001ULL};
54
55
56 #define HAVE_SSE2_INLINE 1
57
58 #if HAVE_SSSE3_INLINE
59 #define COMPILE_TEMPLATE_SSE2 1
60 #define COMPILE_TEMPLATE_SSSE3 1
61 #undef RENAME
62 #define RENAME(a) a ## _ssse3
63 #include "yadif_template.c"
64 #undef COMPILE_TEMPLATE_SSSE3
65 #endif
66
67 #if HAVE_SSE2_INLINE
68 #undef RENAME
69 #define RENAME(a) a ## _sse2
70 #include "yadif_template.c"
71 #undef COMPILE_TEMPLATE_SSE2
72 #endif
73
74 #if HAVE_MMXEXT_INLINE
75 #undef RENAME
76 #define RENAME(a) a ## _mmxext
77 #include "yadif_template.c"
78 #endif
79
80
81 void filter_line_x86_64 (guint8 * dst,
82 guint8 * prev, guint8 * cur, guint8 * next,
83 int w, int prefs, int mrefs, int parity, int mode);
84
85 void
filter_line_x86_64(guint8 * dst,guint8 * prev,guint8 * cur,guint8 * next,int w,int prefs,int mrefs,int parity,int mode)86 filter_line_x86_64 (guint8 * dst,
87 guint8 * prev, guint8 * cur, guint8 * next,
88 int w, int prefs, int mrefs, int parity, int mode)
89 {
90 #if 0
91 #if HAVE_MMXEXT_INLINE
92 if (cpu_flags & AV_CPU_FLAG_MMXEXT)
93 yadif->filter_line = yadif_filter_line_mmxext;
94 #endif
95 #if HAVE_SSE2_INLINE
96 if (cpu_flags & AV_CPU_FLAG_SSE2)
97 yadif->filter_line = yadif_filter_line_sse2;
98 #endif
99 #if HAVE_SSSE3_INLINE
100 if (cpu_flags & AV_CPU_FLAG_SSSE3)
101 yadif->filter_line = yadif_filter_line_ssse3;
102 #endif
103 #endif
104 yadif_filter_line_sse2 (dst, prev, cur, next, w, prefs, mrefs, parity, mode);
105 }
106
107 #endif
108