00001 /* 00002 * This file is part of FFmpeg. 00003 * 00004 * FFmpeg is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * FFmpeg is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with FFmpeg; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00019 #include "libavutil/cpu.h" 00020 #include "libavcodec/dsputil.h" 00021 #include "fft.h" 00022 00023 av_cold void ff_fft_init_mmx(FFTContext *s) 00024 { 00025 #if HAVE_YASM 00026 int has_vectors = av_get_cpu_flags(); 00027 if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { 00028 /* SSE for P3/P4/K8 */ 00029 s->imdct_calc = ff_imdct_calc_sse; 00030 s->imdct_half = ff_imdct_half_sse; 00031 s->fft_permute = ff_fft_permute_sse; 00032 s->fft_calc = ff_fft_calc_sse; 00033 s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; 00034 } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { 00035 /* 3DNowEx for K7 */ 00036 s->imdct_calc = ff_imdct_calc_3dn2; 00037 s->imdct_half = ff_imdct_half_3dn2; 00038 s->fft_calc = ff_fft_calc_3dn2; 00039 } else if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { 00040 /* 3DNow! for K6-2/3 */ 00041 s->imdct_calc = ff_imdct_calc_3dn; 00042 s->imdct_half = ff_imdct_half_3dn; 00043 s->fft_calc = ff_fft_calc_3dn; 00044 } 00045 #endif 00046 } 00047 00048 #if CONFIG_DCT 00049 av_cold void ff_dct_init_mmx(DCTContext *s) 00050 { 00051 int has_vectors = av_get_cpu_flags(); 00052 if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) 00053 s->dct32 = ff_dct32_float_sse; 00054 } 00055 #endif 00056