2 * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
4 * This file is part of Libav.
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.
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.
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.
26 /* The inline asm is not MSVC compatible */
27 #if defined(__GNUC__) || defined(__clang__)
29 typedef struct xmm_reg
33 typedef gint64 x86_reg;
36 #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
37 #define DECLARE_ASM_CONST(n,t,v) static const __declspec(align(n)) t v
39 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
40 #define DECLARE_ASM_CONST(n,t,v) static const t __attribute__((used)) __attribute__ ((aligned (n))) v
43 #if defined(__APPLE__)
44 # define EXTERN_PREFIX "_"
46 # define EXTERN_PREFIX ""
50 # define LOCAL_MANGLE(a) #a "(%%rip)"
52 # define LOCAL_MANGLE(a) #a
55 #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
57 DECLARE_ASM_CONST (16, xmm_reg, pb_1) = {
58 0x0101010101010101ULL, 0x0101010101010101ULL};
60 DECLARE_ASM_CONST (16, xmm_reg, pw_1) = {
61 0x0001000100010001ULL, 0x0001000100010001ULL};
64 #define HAVE_SSE2_INLINE 1
67 #define COMPILE_TEMPLATE_SSE2 1
68 #define COMPILE_TEMPLATE_SSSE3 1
70 #define RENAME(a) a ## _ssse3
71 #include "yadif_template.c"
72 #undef COMPILE_TEMPLATE_SSSE3
77 #define RENAME(a) a ## _sse2
78 #include "yadif_template.c"
79 #undef COMPILE_TEMPLATE_SSE2
82 #if HAVE_MMXEXT_INLINE
84 #define RENAME(a) a ## _mmxext
85 #include "yadif_template.c"
89 void filter_line_x86_64 (guint8 * dst,
90 guint8 * prev, guint8 * cur, guint8 * next,
91 int w, int prefs, int mrefs, int parity, int mode);
94 filter_line_x86_64 (guint8 * dst,
95 guint8 * prev, guint8 * cur, guint8 * next,
96 int w, int prefs, int mrefs, int parity, int mode)
99 #if HAVE_MMXEXT_INLINE
100 if (cpu_flags & AV_CPU_FLAG_MMXEXT)
101 yadif->filter_line = yadif_filter_line_mmxext;
104 if (cpu_flags & AV_CPU_FLAG_SSE2)
105 yadif->filter_line = yadif_filter_line_sse2;
107 #if HAVE_SSSE3_INLINE
108 if (cpu_flags & AV_CPU_FLAG_SSSE3)
109 yadif->filter_line = yadif_filter_line_ssse3;
112 yadif_filter_line_sse2 (dst, prev, cur, next, w, prefs, mrefs, parity, mode);