1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * This file is part of FFmpeg.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12cabdff1aSopenharmony_ci * Lesser General Public License for more details.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17cabdff1aSopenharmony_ci */
18cabdff1aSopenharmony_ci
19cabdff1aSopenharmony_ci#define TX_FLOAT
20cabdff1aSopenharmony_ci#include "libavutil/tx_priv.h"
21cabdff1aSopenharmony_ci#include "libavutil/attributes.h"
22cabdff1aSopenharmony_ci#include "libavutil/x86/cpu.h"
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#include "config.h"
25cabdff1aSopenharmony_ci
26cabdff1aSopenharmony_ciTX_DECL_FN(fft2,      sse3)
27cabdff1aSopenharmony_ciTX_DECL_FN(fft4_fwd,  sse2)
28cabdff1aSopenharmony_ciTX_DECL_FN(fft4_inv,  sse2)
29cabdff1aSopenharmony_ciTX_DECL_FN(fft8,      sse3)
30cabdff1aSopenharmony_ciTX_DECL_FN(fft8_ns,   sse3)
31cabdff1aSopenharmony_ciTX_DECL_FN(fft8,      avx)
32cabdff1aSopenharmony_ciTX_DECL_FN(fft8_ns,   avx)
33cabdff1aSopenharmony_ciTX_DECL_FN(fft16,     avx)
34cabdff1aSopenharmony_ciTX_DECL_FN(fft16_ns,  avx)
35cabdff1aSopenharmony_ciTX_DECL_FN(fft16,     fma3)
36cabdff1aSopenharmony_ciTX_DECL_FN(fft16_ns,  fma3)
37cabdff1aSopenharmony_ciTX_DECL_FN(fft32,     avx)
38cabdff1aSopenharmony_ciTX_DECL_FN(fft32_ns,  avx)
39cabdff1aSopenharmony_ciTX_DECL_FN(fft32,     fma3)
40cabdff1aSopenharmony_ciTX_DECL_FN(fft32_ns,  fma3)
41cabdff1aSopenharmony_ciTX_DECL_FN(fft_sr,    fma3)
42cabdff1aSopenharmony_ciTX_DECL_FN(fft_sr_ns, fma3)
43cabdff1aSopenharmony_ciTX_DECL_FN(fft_sr,    avx2)
44cabdff1aSopenharmony_ciTX_DECL_FN(fft_sr_ns, avx2)
45cabdff1aSopenharmony_ci
46cabdff1aSopenharmony_ci#define DECL_INIT_FN(basis, interleave)                                        \
47cabdff1aSopenharmony_cistatic av_cold int b ##basis## _i ##interleave(AVTXContext *s,                 \
48cabdff1aSopenharmony_ci                                               const FFTXCodelet *cd,          \
49cabdff1aSopenharmony_ci                                               uint64_t flags,                 \
50cabdff1aSopenharmony_ci                                               FFTXCodeletOptions *opts,       \
51cabdff1aSopenharmony_ci                                               int len, int inv,               \
52cabdff1aSopenharmony_ci                                               const void *scale)              \
53cabdff1aSopenharmony_ci{                                                                              \
54cabdff1aSopenharmony_ci    const int inv_lookup = opts ? opts->invert_lookup : 1;                     \
55cabdff1aSopenharmony_ci    ff_tx_init_tabs_float(len);                                                \
56cabdff1aSopenharmony_ci    if (cd->max_len == 2)                                                      \
57cabdff1aSopenharmony_ci        return ff_tx_gen_ptwo_revtab(s, inv_lookup);                           \
58cabdff1aSopenharmony_ci    else                                                                       \
59cabdff1aSopenharmony_ci        return ff_tx_gen_split_radix_parity_revtab(s, inv_lookup,              \
60cabdff1aSopenharmony_ci                                                   basis, interleave);         \
61cabdff1aSopenharmony_ci}
62cabdff1aSopenharmony_ci
63cabdff1aSopenharmony_ciDECL_INIT_FN(8, 0)
64cabdff1aSopenharmony_ciDECL_INIT_FN(8, 2)
65cabdff1aSopenharmony_ci
66cabdff1aSopenharmony_ciconst FFTXCodelet * const ff_tx_codelet_list_float_x86[] = {
67cabdff1aSopenharmony_ci    TX_DEF(fft2,     FFT,  2,  2, 2, 0, 128, NULL,  sse3, SSE3, AV_TX_INPLACE, 0),
68cabdff1aSopenharmony_ci    TX_DEF(fft2,     FFT,  2,  2, 2, 0, 192, b8_i0, sse3, SSE3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, 0),
69cabdff1aSopenharmony_ci    TX_DEF(fft4_fwd, FFT,  4,  4, 2, 0, 128, NULL,  sse2, SSE2, AV_TX_INPLACE | FF_TX_FORWARD_ONLY, 0),
70cabdff1aSopenharmony_ci    TX_DEF(fft4_fwd, FFT,  4,  4, 2, 0, 192, b8_i0, sse2, SSE2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, 0),
71cabdff1aSopenharmony_ci    TX_DEF(fft4_inv, FFT,  4,  4, 2, 0, 128, NULL,  sse2, SSE2, AV_TX_INPLACE | FF_TX_INVERSE_ONLY, 0),
72cabdff1aSopenharmony_ci    TX_DEF(fft8,     FFT,  8,  8, 2, 0, 128, b8_i0, sse3, SSE3, AV_TX_INPLACE, 0),
73cabdff1aSopenharmony_ci    TX_DEF(fft8_ns,  FFT,  8,  8, 2, 0, 192, b8_i0, sse3, SSE3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, 0),
74cabdff1aSopenharmony_ci    TX_DEF(fft8,     FFT,  8,  8, 2, 0, 256, b8_i0, avx,  AVX,  AV_TX_INPLACE, AV_CPU_FLAG_AVXSLOW),
75cabdff1aSopenharmony_ci    TX_DEF(fft8_ns,  FFT,  8,  8, 2, 0, 320, b8_i0, avx,  AVX,  AV_TX_INPLACE | FF_TX_PRESHUFFLE,
76cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW),
77cabdff1aSopenharmony_ci    TX_DEF(fft16,    FFT, 16, 16, 2, 0, 256, b8_i2, avx,  AVX,  AV_TX_INPLACE, AV_CPU_FLAG_AVXSLOW),
78cabdff1aSopenharmony_ci    TX_DEF(fft16_ns, FFT, 16, 16, 2, 0, 320, b8_i2, avx,  AVX,  AV_TX_INPLACE | FF_TX_PRESHUFFLE,
79cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW),
80cabdff1aSopenharmony_ci    TX_DEF(fft16,    FFT, 16, 16, 2, 0, 288, b8_i2, fma3, FMA3, AV_TX_INPLACE, AV_CPU_FLAG_AVXSLOW),
81cabdff1aSopenharmony_ci    TX_DEF(fft16_ns, FFT, 16, 16, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE,
82cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW),
83cabdff1aSopenharmony_ci
84cabdff1aSopenharmony_ci#if ARCH_X86_64
85cabdff1aSopenharmony_ci    TX_DEF(fft32,    FFT, 32, 32, 2, 0, 256, b8_i2, avx,  AVX,  AV_TX_INPLACE, AV_CPU_FLAG_AVXSLOW),
86cabdff1aSopenharmony_ci    TX_DEF(fft32_ns, FFT, 32, 32, 2, 0, 320, b8_i2, avx,  AVX,  AV_TX_INPLACE | FF_TX_PRESHUFFLE,
87cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW),
88cabdff1aSopenharmony_ci    TX_DEF(fft32,    FFT, 32, 32, 2, 0, 288, b8_i2, fma3, FMA3, AV_TX_INPLACE, AV_CPU_FLAG_AVXSLOW),
89cabdff1aSopenharmony_ci    TX_DEF(fft32_ns, FFT, 32, 32, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE,
90cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW),
91cabdff1aSopenharmony_ci    TX_DEF(fft_sr,    FFT, 64, 131072, 2, 0, 288, b8_i2, fma3,  FMA3,  0, AV_CPU_FLAG_AVXSLOW),
92cabdff1aSopenharmony_ci    TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 352, b8_i2, fma3,  FMA3,  AV_TX_INPLACE | FF_TX_PRESHUFFLE,
93cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW),
94cabdff1aSopenharmony_ci#if HAVE_AVX2_EXTERNAL
95cabdff1aSopenharmony_ci    TX_DEF(fft_sr,    FFT, 64, 131072, 2, 0, 320, b8_i2, avx2, AVX2, 0,
96cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER),
97cabdff1aSopenharmony_ci    TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE,
98cabdff1aSopenharmony_ci           AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER),
99cabdff1aSopenharmony_ci#endif
100cabdff1aSopenharmony_ci#endif
101cabdff1aSopenharmony_ci
102cabdff1aSopenharmony_ci    NULL,
103cabdff1aSopenharmony_ci};
104