x86: check for AV_CPU_FLAG_AVXSLOW where useful
[libav.git] / libavcodec / x86 / fft_init.c
CommitLineData
f4863213 1/*
2912e87a 2 * This file is part of Libav.
f4863213 3 *
2912e87a 4 * Libav is free software; you can redistribute it and/or
f4863213
MR
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
2912e87a 9 * Libav is distributed in the hope that it will be useful,
f4863213
MR
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
2912e87a 15 * License along with Libav; if not, write to the Free Software
f4863213
MR
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
e7b31844
DB
19#include "config.h"
20#include "libavutil/attributes.h"
c6c98d08 21#include "libavutil/cpu.h"
e0c6cce4 22#include "libavutil/x86/cpu.h"
f4863213
MR
23#include "fft.h"
24
f101eab1 25av_cold void ff_fft_init_x86(FFTContext *s)
f4863213 26{
3ac7fa81
DB
27 int cpu_flags = av_get_cpu_flags();
28
b6a3849a 29#if ARCH_X86_32
3ac7fa81 30 if (EXTERNAL_AMD3DNOW(cpu_flags)) {
fcc456b8 31 /* 3DNow! for K6-2/3 */
bac0729d
VS
32 s->imdct_calc = ff_imdct_calc_3dnow;
33 s->imdct_half = ff_imdct_half_3dnow;
34 s->fft_calc = ff_fft_calc_3dnow;
fcc456b8 35 }
3ac7fa81 36 if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) {
fcc456b8 37 /* 3DNowEx for K7 */
ca844b7b
DB
38 s->imdct_calc = ff_imdct_calc_3dnowext;
39 s->imdct_half = ff_imdct_half_3dnowext;
40 s->fft_calc = ff_fft_calc_3dnowext;
fcc456b8 41 }
b6a3849a 42#endif
3ac7fa81 43 if (EXTERNAL_SSE(cpu_flags)) {
f4863213
MR
44 /* SSE for P3/P4/K8 */
45 s->imdct_calc = ff_imdct_calc_sse;
46 s->imdct_half = ff_imdct_half_sse;
47 s->fft_permute = ff_fft_permute_sse;
48 s->fft_calc = ff_fft_calc_sse;
e6b1ed69 49 s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
fcc456b8 50 }
d68c0538 51 if (EXTERNAL_AVX_FAST(cpu_flags) && s->nbits >= 5) {
fcc456b8
VS
52 /* AVX for SB */
53 s->imdct_half = ff_imdct_half_avx;
54 s->fft_calc = ff_fft_calc_avx;
55 s->fft_permutation = FF_FFT_PERM_AVX;
f4863213 56 }
f4863213 57}