1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-26 06:01:30 +02:00
Commit Graph

21 Commits

Author SHA1 Message Date
Andreas Rheinhardt
211619ad7f avcodec: Remove the FFT_FIXED_32 define
Since the removal of the 16-bit FFT said define is unnecessary as
FFT_FIXED_32 is always !FFT_FLOAT. But one wouldn't believe it when
looking at the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-05 19:46:33 +02:00
Andreas Rheinhardt
b91b04473a avcodec/fft_template: Avoid useless function
ff_init_ff_cos_tabs is only used for the floating point FFT and only
if hardcoded tables are disabled.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-29 15:38:31 +01:00
Lynne
151b41c8cc
fft: remove 16-bit FFT and MDCT code
No longer used by anything.
Unfortunately the old FFT_FLOAT/FFT_FIXED_32 is left as-is. It's
simply too much work for code meant to be all removed anyway.
2021-01-14 01:44:21 +01:00
Andreas Rheinhardt
a454a0c14f avcodec/fft_template: Only check for FF_FFT_PERM_AVX on ARCH_X86
Also do it for FFT_FLOAT only, as this is the only combination for which
it can be set.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 06:52:51 +01:00
Andreas Rheinhardt
b9c1ab8907 avcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe
Commit 1af615683e put initializing
the ff_fft_offsets_lut (which is typically used if FFT_FIXED_32)
behind an ff_thread_once() to make ff_fft_init() thread-safe; yet
there is a second place where said table may be initialized which
is not guarded by this AVOnce: ff_fft_init_mips(). MIPS uses this LUT
even for ordinary floating point FFTs, so that ff_fft_init() is not
thread-safe (on MIPS) for both 32bit fixed-point as well as
floating-point FFTs; e.g. ff_mdct_init() inherits this flaw and
therefore initializing e.g. the AAC decoders is not thread-safe (on
MIPS) despite them having FF_CODEC_CAP_INIT_CLEANUP set.

This commit fixes this by moving the AVOnce to fft_init_table.c and
using it to guard all initializations of ff_fft_offsets_lut.

(It is not that bad in practice, because every entry of
ff_fft_offsets_lut is never read during initialization and is only once
ever written to (namely to its final value); but even these are
conflicting actions which are (by definition) data races and lead to
undefined behaviour.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Steven Liu
eb81fd792f avcodec/fft_template: improve performance of the ff_fft_init in fft_template
Before patch:
init nbits = 17, get 10000 samples, average cost: 16175 us
After patch:
init nbits = 17, get 10000 samples, average cost: 14989 us

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-04 11:21:02 +08:00
Carl Eugen Hoyos
9617178800 lavc/fft_template: Do not define unneded functions with --enable-small.
Fixes the following warnings:
In file included from libavcodec/fft_fixed.c:21:0:
libavcodec/fft_template.c:528:6: warning: ‘pass_big’ defined but not used [-Wunused-function]
 PASS(pass_big)
      ^
libavcodec/fft_template.c:505:13: note: in definition of macro ‘PASS’
 static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\
             ^~~~
CC      libavcodec/ffv1.o
In file included from libavcodec/fft_float.c:21:0:
libavcodec/fft_template.c:528:6: warning: ‘pass_big’ defined but not used [-Wunused-function]
 PASS(pass_big)
      ^
libavcodec/fft_template.c:505:13: note: in definition of macro ‘PASS’
 static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\
             ^~~~
2018-07-21 14:05:41 +02:00
Muhammad Faiz
1af615683e avcodec/fft_template: use ff_thread_once on costable initialization
Make it thread-safe and avoid redundant initialization.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-07-07 09:41:52 +07:00
Michael Niedermayer
1197c04896 avcodec/fft_template: Fix multiple runtime error: signed integer overflow: -1943918714 - 1935113003 cannot be represented in type 'int'
Fixes: 1735/clusterfuzz-testcase-minimized-5350472347025408

This uses unsigned instead of SUINT because the later was rejected by multiple developers
See: [FFmpeg-devel] [PATCH] avcodec/fft_template: Fix multiple runtime error: signed integer overflow: -1943918714 - 1935113003 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-11 00:56:33 +02:00
Michael Niedermayer
305344d89e avcodec/fft: Add revtab32 for FFTs with more than 65536 samples
x86 optimizations are used only for the cases they support (<=65536 samples)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-04 16:05:47 +01:00
Michael Niedermayer
ae76b84221 avcodec: Extend fft to size 2^17
Asked-for-by: durandal_1707

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-04 13:51:42 +01:00
Reimar Döffinger
2bb66cc8be fft_template: Move variables to where they are used.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-08-31 10:25:36 +02:00
Reimar Döffinger
1654514ab0 fft: add ff_ prefix to some global arrays.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-08-31 10:25:36 +02:00
Reimar Döffinger
e2cd28c926 fft: add missing const.
This table was the largest object in FFmpeg's .data,
and really should be in .rodata.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-08-30 16:33:00 +02:00
Michael Niedermayer
13f4428915 Merge commit '650c4300d94aa9398ff1dd4f454bf39eaa285f62'
* commit '650c4300d94aa9398ff1dd4f454bf39eaa285f62':
  aarch64: NEON float FFT

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-22 23:06:24 +02:00
Janne Grunau
650c4300d9 aarch64: NEON float FFT
Approximately as fast as the ARM NEON version on Apple's A7.
2014-04-22 19:35:40 +02:00
Michael Niedermayer
99b6357f37 rename CONFIG_FFT_FIXED_32 -> FFT_FIXED_32
This matches FFT_FLOAT

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-07 13:11:06 +01:00
Michael Niedermayer
7778979f6f Merge commit '794fcf79a89eca2d4e889803b2c804a0b1defbb3'
* commit '794fcf79a89eca2d4e889803b2c804a0b1defbb3':
  Rename CONFIG_FFT_FLOAT ---> FFT_FLOAT

Conflicts:
	libavcodec/fft-internal.h
	libavcodec/fft-test.c
	libavcodec/fft_fixed.c
	libavcodec/fft_float.c
	libavcodec/fft_template.c
	libavcodec/mdct_fixed.c
	libavcodec/mdct_float.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-07 13:10:56 +01:00
Diego Biurrun
794fcf79a8 Rename CONFIG_FFT_FLOAT ---> FFT_FLOAT
The define does not originate from configure, so it should not
have a name that is CONFIG_-prefixed.
2014-01-06 19:12:48 +01:00
Michael Niedermayer
6a7980e2cd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dct/fft: Give consistent names to fixed/float template files

Conflicts:
	libavcodec/fft_fixed.c
	libavcodec/fft_float.c
	libavcodec/mdct_fixed.c
	libavcodec/mdct_float.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-21 19:26:01 +01:00
Diego Biurrun
ac0e03bab0 dct/fft: Give consistent names to fixed/float template files 2013-11-21 15:59:46 +01:00