X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Ffft_template.c;h=3012372a74be92b98b794502cea8188a560a68d2;hb=7825cc392a2febbe91a1321a522dbdaa49048ae7;hp=20a62e429055d62bff5e57b471bff81f65ebca8c;hpb=ebdc5c419aef0d9eed8c1ec57b30238194c1db0a;p=ffmpeg diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c index 20a62e42905..3012372a74b 100644 --- a/libavcodec/fft_template.c +++ b/libavcodec/fft_template.c @@ -35,13 +35,6 @@ #if FFT_FIXED_32 #include "fft_table.h" - -static void av_cold fft_lut_init(void) -{ - int n = 0; - ff_fft_lut_init(ff_fft_offsets_lut, 0, 1 << 17, &n); -} - #else /* FFT_FIXED_32 */ /* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */ @@ -120,6 +113,10 @@ static CosTabsInitOnce cos_tabs_init_once[] = { { init_ff_cos_tabs_131072, AV_ONCE_INIT }, }; +av_cold void ff_init_ff_cos_tabs(int index) +{ + ff_thread_once(&cos_tabs_init_once[index].control, cos_tabs_init_once[index].func); +} #endif COSTABLE_CONST FFTSample * const FFT_NAME(ff_cos_tabs)[] = { NULL, NULL, NULL, NULL, @@ -155,12 +152,6 @@ static int split_radix_permutation(int i, int n, int inverse) else return split_radix_permutation(i, m, inverse)*4 - 1; } -av_cold void ff_init_ff_cos_tabs(int index) -{ -#if (!CONFIG_HARDCODED_TABLES) && (!FFT_FIXED_32) - ff_thread_once(&cos_tabs_init_once[index].control, cos_tabs_init_once[index].func); -#endif -} static const int avx_tab[] = { 0, 4, 1, 5, 8, 12, 9, 13, 2, 6, 3, 7, 10, 14, 11, 15 @@ -236,21 +227,14 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) #endif #if FFT_FIXED_32 - { - static AVOnce control = AV_ONCE_INIT; - ff_thread_once(&control, fft_lut_init); - } + ff_fft_lut_init(); #else /* FFT_FIXED_32 */ #if FFT_FLOAT if (ARCH_AARCH64) ff_fft_init_aarch64(s); if (ARCH_ARM) ff_fft_init_arm(s); if (ARCH_PPC) ff_fft_init_ppc(s); if (ARCH_X86) ff_fft_init_x86(s); - if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc; if (HAVE_MIPSFPU) ff_fft_init_mips(s); -#else - if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c; - if (ARCH_ARM) ff_fft_fixed_init_arm(s); #endif for(j=4; j<=nbits; j++) { ff_init_ff_cos_tabs(j); @@ -258,7 +242,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) #endif /* FFT_FIXED_32 */ - if (s->fft_permutation == FF_FFT_PERM_AVX) { + if (ARCH_X86 && FFT_FLOAT && s->fft_permutation == FF_FFT_PERM_AVX) { fft_perm_avx(s); } else { #define PROCESS_FFT_PERM_SWAP_LSBS(num) do {\