• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/x86/fft.c

Go to the documentation of this file.
00001 /*
00002  * This file is part of Libav.
00003  *
00004  * Libav 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  * Libav 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 Libav; 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 "libavcodec/dct.h"
00022 #include "fft.h"
00023 
00024 av_cold void ff_fft_init_mmx(FFTContext *s)
00025 {
00026 #if HAVE_YASM
00027     int has_vectors = av_get_cpu_flags();
00028     if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
00029         /* AVX for SB */
00030         s->imdct_calc      = ff_imdct_calc_sse;
00031         s->imdct_half      = ff_imdct_half_avx;
00032         s->fft_permute     = ff_fft_permute_sse;
00033         s->fft_calc        = ff_fft_calc_avx;
00034         s->fft_permutation = FF_FFT_PERM_AVX;
00035     } else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
00036         /* SSE for P3/P4/K8 */
00037         s->imdct_calc  = ff_imdct_calc_sse;
00038         s->imdct_half  = ff_imdct_half_sse;
00039         s->fft_permute = ff_fft_permute_sse;
00040         s->fft_calc    = ff_fft_calc_sse;
00041         s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
00042     } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
00043         /* 3DNowEx for K7 */
00044         s->imdct_calc = ff_imdct_calc_3dn2;
00045         s->imdct_half = ff_imdct_half_3dn2;
00046         s->fft_calc   = ff_fft_calc_3dn2;
00047     } else if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
00048         /* 3DNow! for K6-2/3 */
00049         s->imdct_calc = ff_imdct_calc_3dn;
00050         s->imdct_half = ff_imdct_half_3dn;
00051         s->fft_calc   = ff_fft_calc_3dn;
00052     }
00053 #endif
00054 }
00055 
00056 #if CONFIG_DCT
00057 av_cold void ff_dct_init_mmx(DCTContext *s)
00058 {
00059 #if HAVE_YASM
00060     int has_vectors = av_get_cpu_flags();
00061     if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX)
00062         s->dct32 = ff_dct32_float_avx;
00063     else if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE)
00064         s->dct32 = ff_dct32_float_sse2;
00065     else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
00066         s->dct32 = ff_dct32_float_sse;
00067 #endif
00068 }
00069 #endif
00070 
Generated on Sat Mar 17 2012 12:57:44 for Libav by doxygen 1.7.1