wasapi2: Fallback to IAudioClient interface if IAudioClient3 API is unavailable
[platform/upstream/gstreamer.git] / gst / yadif / yadif.c
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 /* The inline asm is not MSVC compatible */
27 #if defined(__GNUC__) || defined(__clang__)
28
29 typedef struct xmm_reg
30 {
31   guint64 a, b;
32 } xmm_reg;
33 typedef gint64 x86_reg;
34
35 #if defined(_MSC_VER)
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
38 #else
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
41 #endif
42
43 #if defined(__APPLE__)
44 #    define EXTERN_PREFIX "_"
45 #else
46 #    define EXTERN_PREFIX ""
47 #endif
48
49 #if defined(__PIC__)
50 #    define LOCAL_MANGLE(a) #a "(%%rip)"
51 #else
52 #    define LOCAL_MANGLE(a) #a
53 #endif
54
55 #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
56
57 DECLARE_ASM_CONST (16, xmm_reg, pb_1) = {
58 0x0101010101010101ULL, 0x0101010101010101ULL};
59
60 DECLARE_ASM_CONST (16, xmm_reg, pw_1) = {
61 0x0001000100010001ULL, 0x0001000100010001ULL};
62
63
64 #define HAVE_SSE2_INLINE 1
65
66 #if HAVE_SSSE3_INLINE
67 #define COMPILE_TEMPLATE_SSE2 1
68 #define COMPILE_TEMPLATE_SSSE3 1
69 #undef RENAME
70 #define RENAME(a) a ## _ssse3
71 #include "yadif_template.c"
72 #undef COMPILE_TEMPLATE_SSSE3
73 #endif
74
75 #if HAVE_SSE2_INLINE
76 #undef RENAME
77 #define RENAME(a) a ## _sse2
78 #include "yadif_template.c"
79 #undef COMPILE_TEMPLATE_SSE2
80 #endif
81
82 #if HAVE_MMXEXT_INLINE
83 #undef RENAME
84 #define RENAME(a) a ## _mmxext
85 #include "yadif_template.c"
86 #endif
87
88
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);
92
93 void
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)
97 {
98 #if 0
99 #if HAVE_MMXEXT_INLINE
100   if (cpu_flags & AV_CPU_FLAG_MMXEXT)
101     yadif->filter_line = yadif_filter_line_mmxext;
102 #endif
103 #if HAVE_SSE2_INLINE
104   if (cpu_flags & AV_CPU_FLAG_SSE2)
105     yadif->filter_line = yadif_filter_line_sse2;
106 #endif
107 #if HAVE_SSSE3_INLINE
108   if (cpu_flags & AV_CPU_FLAG_SSSE3)
109     yadif->filter_line = yadif_filter_line_ssse3;
110 #endif
111 #endif
112   yadif_filter_line_sse2 (dst, prev, cur, next, w, prefs, mrefs, parity, mode);
113 }
114
115 #endif
116 #endif