| 1 | /* |
| 2 | * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at> |
| 3 | * |
| 4 | * This file is part of FFmpeg. |
| 5 | * |
| 6 | * FFmpeg is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * FFmpeg 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 GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with FFmpeg; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include "libavutil/attributes.h" |
| 22 | #include "libavutil/cpu.h" |
| 23 | #include "libavutil/mem.h" |
| 24 | #include "libavutil/x86/asm.h" |
| 25 | #include "libavutil/x86/cpu.h" |
| 26 | #include "libavfilter/yadif.h" |
| 27 | |
| 28 | void ff_yadif_filter_line_mmxext(void *dst, void *prev, void *cur, |
| 29 | void *next, int w, int prefs, |
| 30 | int mrefs, int parity, int mode); |
| 31 | void ff_yadif_filter_line_sse2(void *dst, void *prev, void *cur, |
| 32 | void *next, int w, int prefs, |
| 33 | int mrefs, int parity, int mode); |
| 34 | void ff_yadif_filter_line_ssse3(void *dst, void *prev, void *cur, |
| 35 | void *next, int w, int prefs, |
| 36 | int mrefs, int parity, int mode); |
| 37 | |
| 38 | void ff_yadif_filter_line_16bit_mmxext(void *dst, void *prev, void *cur, |
| 39 | void *next, int w, int prefs, |
| 40 | int mrefs, int parity, int mode); |
| 41 | void ff_yadif_filter_line_16bit_sse2(void *dst, void *prev, void *cur, |
| 42 | void *next, int w, int prefs, |
| 43 | int mrefs, int parity, int mode); |
| 44 | void ff_yadif_filter_line_16bit_ssse3(void *dst, void *prev, void *cur, |
| 45 | void *next, int w, int prefs, |
| 46 | int mrefs, int parity, int mode); |
| 47 | void ff_yadif_filter_line_16bit_sse4(void *dst, void *prev, void *cur, |
| 48 | void *next, int w, int prefs, |
| 49 | int mrefs, int parity, int mode); |
| 50 | |
| 51 | void ff_yadif_filter_line_10bit_mmxext(void *dst, void *prev, void *cur, |
| 52 | void *next, int w, int prefs, |
| 53 | int mrefs, int parity, int mode); |
| 54 | void ff_yadif_filter_line_10bit_sse2(void *dst, void *prev, void *cur, |
| 55 | void *next, int w, int prefs, |
| 56 | int mrefs, int parity, int mode); |
| 57 | void ff_yadif_filter_line_10bit_ssse3(void *dst, void *prev, void *cur, |
| 58 | void *next, int w, int prefs, |
| 59 | int mrefs, int parity, int mode); |
| 60 | |
| 61 | av_cold void ff_yadif_init_x86(YADIFContext *yadif) |
| 62 | { |
| 63 | int cpu_flags = av_get_cpu_flags(); |
| 64 | int bit_depth = (!yadif->csp) ? 8 |
| 65 | : yadif->csp->comp[0].depth_minus1 + 1; |
| 66 | |
| 67 | if (bit_depth >= 15) { |
| 68 | #if ARCH_X86_32 |
| 69 | if (EXTERNAL_MMXEXT(cpu_flags)) |
| 70 | yadif->filter_line = ff_yadif_filter_line_16bit_mmxext; |
| 71 | #endif /* ARCH_X86_32 */ |
| 72 | if (EXTERNAL_SSE2(cpu_flags)) |
| 73 | yadif->filter_line = ff_yadif_filter_line_16bit_sse2; |
| 74 | if (EXTERNAL_SSSE3(cpu_flags)) |
| 75 | yadif->filter_line = ff_yadif_filter_line_16bit_ssse3; |
| 76 | if (EXTERNAL_SSE4(cpu_flags)) |
| 77 | yadif->filter_line = ff_yadif_filter_line_16bit_sse4; |
| 78 | } else if ( bit_depth >= 9 && bit_depth <= 14) { |
| 79 | #if ARCH_X86_32 |
| 80 | if (EXTERNAL_MMXEXT(cpu_flags)) |
| 81 | yadif->filter_line = ff_yadif_filter_line_10bit_mmxext; |
| 82 | #endif /* ARCH_X86_32 */ |
| 83 | if (EXTERNAL_SSE2(cpu_flags)) |
| 84 | yadif->filter_line = ff_yadif_filter_line_10bit_sse2; |
| 85 | if (EXTERNAL_SSSE3(cpu_flags)) |
| 86 | yadif->filter_line = ff_yadif_filter_line_10bit_ssse3; |
| 87 | } else { |
| 88 | #if ARCH_X86_32 |
| 89 | if (EXTERNAL_MMXEXT(cpu_flags)) |
| 90 | yadif->filter_line = ff_yadif_filter_line_mmxext; |
| 91 | #endif /* ARCH_X86_32 */ |
| 92 | if (EXTERNAL_SSE2(cpu_flags)) |
| 93 | yadif->filter_line = ff_yadif_filter_line_sse2; |
| 94 | if (EXTERNAL_SSSE3(cpu_flags)) |
| 95 | yadif->filter_line = ff_yadif_filter_line_ssse3; |
| 96 | } |
| 97 | } |