David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 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 | |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 21 | #include "config.h" |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 22 | |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 23 | #include <glib.h> |
| 24 | |
| 25 | #if HAVE_CPU_X86_64 |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 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 | |
Sebastian Dröge | 411cf48 | 2013-11-01 10:40:06 +0100 | [diff] [blame] | 35 | #if defined(__APPLE__) |
| 36 | # define EXTERN_PREFIX "_" |
| 37 | #else |
| 38 | # define EXTERN_PREFIX "" |
| 39 | #endif |
| 40 | |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 41 | #if defined(__PIC__) |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 42 | # define LOCAL_MANGLE(a) #a "(%%rip)" |
| 43 | #else |
| 44 | # define LOCAL_MANGLE(a) #a |
| 45 | #endif |
| 46 | |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 47 | #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a) |
| 48 | |
Sebastian Dröge | 010fd8a | 2013-11-01 10:41:16 +0100 | [diff] [blame] | 49 | DECLARE_ASM_CONST (16, xmm_reg, pb_1) = { |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 50 | 0x0101010101010101ULL, 0x0101010101010101ULL}; |
| 51 | |
Sebastian Dröge | 010fd8a | 2013-11-01 10:41:16 +0100 | [diff] [blame] | 52 | DECLARE_ASM_CONST (16, xmm_reg, pw_1) = { |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 53 | 0x0001000100010001ULL, 0x0001000100010001ULL}; |
| 54 | |
| 55 | |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 56 | #define HAVE_SSE2_INLINE 1 |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 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 | |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 67 | #if HAVE_SSE2_INLINE |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 68 | #undef RENAME |
| 69 | #define RENAME(a) a ## _sse2 |
| 70 | #include "yadif_template.c" |
| 71 | #undef COMPILE_TEMPLATE_SSE2 |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 72 | #endif |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 73 | |
| 74 | #if HAVE_MMXEXT_INLINE |
| 75 | #undef RENAME |
| 76 | #define RENAME(a) a ## _mmxext |
| 77 | #include "yadif_template.c" |
| 78 | #endif |
| 79 | |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 80 | |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 81 | void filter_line_x86_64 (guint8 * dst, |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 82 | guint8 * prev, guint8 * cur, guint8 * next, |
| 83 | int w, int prefs, int mrefs, int parity, int mode); |
| 84 | |
| 85 | void |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 86 | filter_line_x86_64 (guint8 * dst, |
David Schleef | b339812 | 2013-02-07 15:09:51 -0800 | [diff] [blame] | 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 | } |
David Schleef | e5e7fcc | 2013-02-12 11:47:50 -0800 | [diff] [blame] | 106 | |
| 107 | #endif |