blob: 4bbf6c5a79ac3ac272b149eb42db1ebfb4eaf8ee [file] [log] [blame]
David Schleefb3398122013-02-07 15:09:51 -08001/*
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
David Schleefe5e7fcc2013-02-12 11:47:50 -080021#include "config.h"
David Schleefb3398122013-02-07 15:09:51 -080022
David Schleefe5e7fcc2013-02-12 11:47:50 -080023#include <glib.h>
24
25#if HAVE_CPU_X86_64
David Schleefb3398122013-02-07 15:09:51 -080026
27typedef struct xmm_reg
28{
29 guint64 a, b;
30} xmm_reg;
31typedef 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
Sebastian Dröge411cf482013-11-01 10:40:06 +010035#if defined(__APPLE__)
36# define EXTERN_PREFIX "_"
37#else
38# define EXTERN_PREFIX ""
39#endif
40
David Schleefe5e7fcc2013-02-12 11:47:50 -080041#if defined(__PIC__)
David Schleefb3398122013-02-07 15:09:51 -080042# define LOCAL_MANGLE(a) #a "(%%rip)"
43#else
44# define LOCAL_MANGLE(a) #a
45#endif
46
David Schleefb3398122013-02-07 15:09:51 -080047#define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
48
Sebastian Dröge010fd8a2013-11-01 10:41:16 +010049DECLARE_ASM_CONST (16, xmm_reg, pb_1) = {
David Schleefb3398122013-02-07 15:09:51 -0800500x0101010101010101ULL, 0x0101010101010101ULL};
51
Sebastian Dröge010fd8a2013-11-01 10:41:16 +010052DECLARE_ASM_CONST (16, xmm_reg, pw_1) = {
David Schleefb3398122013-02-07 15:09:51 -0800530x0001000100010001ULL, 0x0001000100010001ULL};
54
55
David Schleefe5e7fcc2013-02-12 11:47:50 -080056#define HAVE_SSE2_INLINE 1
David Schleefb3398122013-02-07 15:09:51 -080057
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
David Schleefe5e7fcc2013-02-12 11:47:50 -080067#if HAVE_SSE2_INLINE
David Schleefb3398122013-02-07 15:09:51 -080068#undef RENAME
69#define RENAME(a) a ## _sse2
70#include "yadif_template.c"
71#undef COMPILE_TEMPLATE_SSE2
David Schleefe5e7fcc2013-02-12 11:47:50 -080072#endif
David Schleefb3398122013-02-07 15:09:51 -080073
74#if HAVE_MMXEXT_INLINE
75#undef RENAME
76#define RENAME(a) a ## _mmxext
77#include "yadif_template.c"
78#endif
79
David Schleefb3398122013-02-07 15:09:51 -080080
David Schleefe5e7fcc2013-02-12 11:47:50 -080081void filter_line_x86_64 (guint8 * dst,
David Schleefb3398122013-02-07 15:09:51 -080082 guint8 * prev, guint8 * cur, guint8 * next,
83 int w, int prefs, int mrefs, int parity, int mode);
84
85void
David Schleefe5e7fcc2013-02-12 11:47:50 -080086filter_line_x86_64 (guint8 * dst,
David Schleefb3398122013-02-07 15:09:51 -080087 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}
David Schleefe5e7fcc2013-02-12 11:47:50 -0800106
107#endif