00001 /* 00002 * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at> 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * FFmpeg is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with FFmpeg; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #include "libavutil/attributes.h" 00022 #include "libavutil/cpu.h" 00023 #include "libavutil/mem.h" 00024 #include "libavutil/x86/asm.h" 00025 #include "libavcodec/x86/dsputil_mmx.h" 00026 #include "libavfilter/yadif.h" 00027 00028 #if HAVE_INLINE_ASM 00029 00030 DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL}; 00031 DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL}; 00032 00033 #if HAVE_SSSE3_INLINE 00034 #define COMPILE_TEMPLATE_SSE2 1 00035 #define COMPILE_TEMPLATE_SSSE3 1 00036 #undef RENAME 00037 #define RENAME(a) a ## _ssse3 00038 #include "yadif_template.c" 00039 #undef COMPILE_TEMPLATE_SSSE3 00040 #endif 00041 00042 #if HAVE_SSE2_INLINE 00043 #undef RENAME 00044 #define RENAME(a) a ## _sse2 00045 #include "yadif_template.c" 00046 #undef COMPILE_TEMPLATE_SSE2 00047 #endif 00048 00049 #if HAVE_MMXEXT_INLINE 00050 #undef RENAME 00051 #define RENAME(a) a ## _mmx2 00052 #include "yadif_template.c" 00053 #endif 00054 00055 #endif /* HAVE_INLINE_ASM */ 00056 00057 av_cold void ff_yadif_init_x86(YADIFContext *yadif) 00058 { 00059 int cpu_flags = av_get_cpu_flags(); 00060 00061 #if HAVE_MMXEXT_INLINE 00062 if (cpu_flags & AV_CPU_FLAG_MMXEXT) 00063 yadif->filter_line = yadif_filter_line_mmx2; 00064 #endif 00065 #if HAVE_SSE2_INLINE 00066 if (cpu_flags & AV_CPU_FLAG_SSE2) 00067 yadif->filter_line = yadif_filter_line_sse2; 00068 #endif 00069 #if HAVE_SSSE3_INLINE 00070 if (cpu_flags & AV_CPU_FLAG_SSSE3) 00071 yadif->filter_line = yadif_filter_line_ssse3; 00072 #endif 00073 }