1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00
Commit Graph

93866 Commits

Author SHA1 Message Date
Lynne
b79b29ddb1 libavutil: add an FFT & MDCT implementation
This commit adds a new API to libavutil to allow for arbitrary transformations
on various types of data.
This is a partly new implementation, with the power of two transforms taken
from libavcodec/fft_template, the 5 and 15-point FFT taken from mdct15, while
the 3-point FFT was written from scratch.
The (i)mdct folding code is taken from mdct15 as well, as the mdct_template
code was somewhat old, messy and not easy to separate.

A notable feature of this implementation is that it allows for 3xM and 5xM
based transforms, where M is a power of two, e.g. 384, 640, 768, 1280, etc.
AC-4 uses 3xM transforms while Siren uses 5xM transforms, so the code will
allow for decoding of such streams.
A non-exaustive list of supported sizes:
4, 8, 12, 16, 20, 24, 32, 40, 48, 60, 64, 80, 96, 120, 128, 160, 192, 240,
256, 320, 384, 480, 512, 640, 768, 960, 1024, 1280, 1536, 1920, 2048, 2560...

The API was designed such that it allows for not only 1D transforms but also
2D transforms of certain block sizes. This was partly on accident as the stride
argument is required for Opus MDCTs, but can be used in the context of a 2D
transform as well.
Also, various data types would be implemented eventually as well, such as
"double" and "int32_t".

Some performance comparisons with libfftw3f (SIMD disabled for both):
120:
  22353 decicycles in     fftwf_execute,     1024 runs,      0 skips
  21836 decicycles in compound_fft_15x8,     1024 runs,      0 skips

128:
  22003 decicycles in       fftwf_execute,   1024 runs,      0 skips
  23132 decicycles in monolithic_fft_ptwo,   1024 runs,      0 skips

384:
  75939 decicycles in      fftwf_execute,    1024 runs,      0 skips
  73973 decicycles in compound_fft_3x128,    1024 runs,      0 skips

640:
 104354 decicycles in       fftwf_execute,   1024 runs,      0 skips
 149518 decicycles in compound_fft_5x128,    1024 runs,      0 skips

768:
 109323 decicycles in      fftwf_execute,    1024 runs,      0 skips
 164096 decicycles in compound_fft_3x256,    1024 runs,      0 skips

960:
 186210 decicycles in      fftwf_execute,    1024 runs,      0 skips
 215256 decicycles in compound_fft_15x64,    1024 runs,      0 skips

1024:
 163464 decicycles in       fftwf_execute,   1024 runs,      0 skips
 199686 decicycles in monolithic_fft_ptwo,   1024 runs,      0 skips

With SIMD we should be faster than fftw for 15xM transforms as our fft15 SIMD
is around 2x faster than theirs, even if our ptwo SIMD is slightly slower.

The goal is to remove the libavcodec/mdct15 code and deprecate the
libavcodec/avfft interface once aarch64 and x86 SIMD code has been ported.
New code throughout the project should use this API.

The implementation passes fate when used in Opus, AAC and Vorbis, and the output
is identical with ATRAC9 as well.
2019-05-15 17:39:59 +01:00
Lynne
f62ee527cb aarch64/asm-offsets: remove old CELT offsets
They're not used and they're incorrect.
2019-05-14 23:41:24 +01:00
James Almer
58d167bcd5 avcodec/Makefile: add missing pngdsp dependency to the lscr decoder
Signed-off-by: James Almer <jamrial@gmail.com>
2019-05-14 16:47:56 -03:00
Paul B Mahol
f49cec2ba8 avfilter: add asr filter 2019-05-14 15:17:14 +02:00
Andreas Rheinhardt
670251de56 avfilter/vf_stack: Don't modify const strings
b3b7ba62 introduced undefined behaviour: A (non-modifiable) string
literal has been assigned to a modifiable string; said string was indeed
modified later via av_strtok.
This of course caused compiler warnings because of the discarded
qualifier; these are in particular fixed by this commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-05-14 14:47:51 +02:00
Paul B Mahol
8ef163ba9e avfilter: add xmedian filter 2019-05-14 14:43:56 +02:00
Michael Niedermayer
87a54e150e avcodec/cinepak: Check available input against encoded buffer size
Fixes: Timeout (12sec -> 2sec)
Fixes: 14606/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5738687561728000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-14 12:06:26 +02:00
Andreas Rheinhardt
8b2140de63 avutil: Add missing reference files for pixdesc fate test
Commit cd48318035 added support for NV24 and NV42, including several
fate tests for these formats, but did not include the reference files
for the tests filter-pixdesc-nv24 and filter-pixdesc-nv42. As a result,
these two tests were broken.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-14 12:06:26 +02:00
Jun Zhao
bf6e0f709b lavf/dashdec: refactoring error handle logic for open_input
refactoring error handle logic for open_input.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-14 17:36:19 +08:00
Jun Zhao
c663046b41 lavf/dashdec: fix the coding logic after open_input fail
setting return status following goto will never be executed, so
adjust the location in the code.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-14 17:36:11 +08:00
Gyan Doshi
21832b93d5 doc/filters: add scale2ref example for proportional scaling 2019-05-13 21:58:19 +05:30
Michael Niedermayer
9d269301f0 swscale/tests/swscale: Lengthen pixfmt name buffer to 21 bytes
Some formats use longer names than 12.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-13 13:39:49 +02:00
Adam Richter
b8ed493061 libswcale: Fix possible string overflow in test.
In libswcale/tests/swcale.c, the function fileTest() calls sscanf in
an argument of "%12s" on character srcStr[] and dstStr[], which are
only 12 bytes.  So, if the input string is 12 characters, a
terminating null byte can be written past the end of these arrays.

This bug was found by cppcheck.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-13 13:39:40 +02:00
Paul B Mahol
f1c9d6fe70 avfilter/vf_chromahold: implement blend option 2019-05-13 12:15:32 +02:00
Gyan Doshi
dcc999819d doc/filters: mention drawtext command support 2019-05-13 12:22:05 +05:30
Gyan Doshi
87db1ca632 avfilter/drawtext: make command processing error-resilient
Prevents crash or interruption in text rendering
if new option string contains invalid values.
2019-05-13 10:34:32 +05:30
Rick Kern
98478c05ed lavc/videotoolboxenc: Add support for 10-bit HEVC encoding.
Hardware-accelerated encoding may not support 10-bit encoding. Use
'-require_sw 1' in this case.

Fixes: #7581

Signed-off-by: Rick Kern <kernrj@gmail.com>
2019-05-12 16:30:11 -04:00
Rick Kern
714c8b0766 lavc/videotoolboxenc: simplify frame creation logic between OS X and iOS.
Signed-off-by: Rick Kern <kernrj@gmail.com>
2019-05-12 16:22:51 -04:00
Rick Kern
247bda442f lavc/videotoolboxenc: add require_sw option to force software encoding.
Signed-off-by: Rick Kern <kernrj@gmail.com>
2019-05-12 16:22:51 -04:00
Paul B Mahol
bd6942b4c0 avfilter/af_astats: fix calculations involving last sample 2019-05-12 17:12:06 +02:00
Paul B Mahol
2a4a364f6a avfilter/af_astats: fix initial values of variables 2019-05-12 17:12:06 +02:00
Philip Langdale
4fa4f1d7a9 swscale: Add test for isSemiPlanarYUV to pixdesc_query
Lauri had asked me what the semi planar formats were and that reminded
me that we could add it to pixdesc_query so we know exactly what the
list is.
2019-05-12 07:51:02 -07:00
Philip Langdale
cd48318035 swscale: Add support for NV24 and NV42
The implementation is pretty straight-forward. Most of the existing
NV12 codepaths work regardless of subsampling and are re-used as is.
Where necessary I wrote the slightly different NV24 versions.

Finally, the one thing that confused me for a long time was the
asm specific x86 path that did an explicit exclusion check for NV12.
I replaced that with a semi-planar check and also updated the
equivalent PPC code, which Lauri kindly checked.
2019-05-12 07:51:02 -07:00
Philip Langdale
5de4f1d871 avutil: Add NV24 and NV42 pixel formats
These are the 4:4:4 variants of the semi-planar NV12/NV21 formats.

These formats are not used much, so we've never had a reason to add
them until now. VDPAU recently added support HEVC 4:4:4 content
and when you use the OpenGL interop, the returned surfaces are in
NV24 format, so we need the pixel format for media players, even
if there's no direct use within ffmpeg.

Separately, there are apparently webcams that use NV24, but I've
never seen one.
2019-05-12 07:51:02 -07:00
Michael Niedermayer
7c6f2bfdb2 avcodec/h264_ps: Check offset_for_non_ref_pic, offset_for_top_to_bottom_field and offset_for_ref_frame
Fixes: signed integer overflow: -2147483648 + -1 cannot be represented in type 'int'
Fixes: 14444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5675880333967360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-12 16:32:16 +02:00
Michael Niedermayer
407e7c34ca avcodec/hq_hqa: Check available space before reading slice offsets
Fixes: Timeout (43sec -> 18sec)
Fixes: 14556/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5673543024508928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-12 16:31:39 +02:00
Michael Niedermayer
e5ce105149 avcodec/wmv2dec: Check input bits vs. coded MBs
Fixes: Timeout (94sec ->8sec)
Fixes: 14387/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5723546887651328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-12 16:31:39 +02:00
Jun Zhao
1cc7e2630f lavc/pngenc: check malloc fail before using the pointer
Need to check malloc fail before using the pointer

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-12 14:18:25 +08:00
Jun Zhao
64e610b5f4 lavc/mlpenc: remove the redundant condition check
remove the redundant condition check for 'frame'

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-12 14:18:08 +08:00
Jun Zhao
f82a02aa89 lavc/libvpxenc: remove redundant condition check
Redundant condition: '!A || B' is equivalent to '!A || (A && B)' but
more clearly.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-12 14:17:52 +08:00
Jun Zhao
3af73f2c85 lavc/bink: Remove the dead code block
Remove the dead code block

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-12 14:17:35 +08:00
Jun Zhao
00555f4b8b lavc/avpacket: check NULL before using the pointer
Need to check NULL before using the pointer

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-12 14:17:22 +08:00
Jun Zhao
014b0e5092 lavc/aacenc_ltp: remove unnecessary condition check.
Condition 'sum==2' is always true, so remove the check logic to
make the code clean.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-12 14:17:10 +08:00
Carl Eugen Hoyos
010c0efada lavf/isom: Allow reading mp3-in-isom as written by vlc.
Reported-by: IRC user aiena
2019-05-12 01:35:47 +02:00
Paul B Mahol
59fb8cae5e avfilter: add colorhold filter
Fixes #7671.
2019-05-11 20:16:45 +02:00
Paul B Mahol
c81ec19817 avcodec/gif: remove flags from gifimage option
It does not belong there.
2019-05-11 16:42:13 +02:00
Jacob Graff
0158dd14a3 avcodec/gif: fix issues with transparent crop
Resolves issues with some transparent gifs.
2019-05-11 16:42:13 +02:00
Jun Zhao
68bac50604 lavc/libx265: Use avctx->framerate first for frame rate setting
perfer avctx->framerate first than use avctx->time_base when setting
the frame rate to encoder. 1/time_base is not the average frame rate
if the frame rate is not constant, so use avctx->framerate if the
value is not zero.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-11 00:10:55 +08:00
Jun Zhao
1e6338c2da lavc/libx264: Use avctx->framerate first for frame rate setting
perfer avctx->framerate first than use avctx->time_base when setting
the frame rate to encoder. 1/time_base is not the average frame rate
if the frame rate is not constant. In this case, we need to setting
avctx->framerate and avctx->time_base both, but avctx->framerate not
equal to 1/(avctx->time_base).

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-11 00:10:44 +08:00
Carl Eugen Hoyos
ab648f79c8 lavf/avidec: Do not test for bitrate <= INT_MAX.
AVCodecContext->bit_rate is int64_t since 7404f3bd

Unbreaks non-interleaved detection of v210 4k avi files, broken since 0eec40b7.
Reported-by: Xavier Càmara, Centre de Conservació i Restauració, Filmoteca de Catalunya
2019-05-10 10:57:54 +02:00
Jun Zhao
c967128952 lavf/cover_rect: Fix logic check issue
Fix logic check issue #6741

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-10 09:07:29 +08:00
Carl Eugen Hoyos
479a5f644f LICENSE: Clarify --enable-nonfree.
Using the configure option --enable-nonfree makes the resulting binary unredistributable.
2019-05-10 01:18:58 +02:00
Carl Eugen Hoyos
c8b50ff8f9 LICENSE: Remove nvenc from the non-free section.
The headers are auto-detected by current FFmpeg.
2019-05-10 01:15:44 +02:00
Carl Eugen Hoyos
9eea2e5daf LICENSE: Remove an incorrect statement.
Missed in bc4137d4
2019-05-10 00:57:49 +02:00
Michael Niedermayer
17f91c07ef avcodec/prosumer: Only memset(0) what is needed.
Fixes: Timeout (11sec -> 0.08sec)
Fixes: 14406/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5151210148986880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-09 22:07:26 +02:00
Michael Niedermayer
c7f95d2bd9 avcodec/fic: Check input size against minimal frame size
Fixes: Timeout (22sec ->54ms)
Fixes: 14439/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FIC_fuzzer-5660988231122944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-09 22:07:26 +02:00
Michael Niedermayer
8d77debf7d avcodec/pafvideo: Check input space for decode_0() before slow operations
Fixes: Timeout (11sec -> 2sec)
Fixes: 14403/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5697465698746368

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-09 22:04:14 +02:00
Michael Niedermayer
6dd8420290 avcodec/scpr: check remaining data after decode
Fixes Timeout (29sec -> 14sec)
Fixes: 13713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5756778069884928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-09 22:03:53 +02:00
Jun Zhao
a6cd3ad21f tools/crypto_bench: update the comment about build command
commit cd62f9d557 missing the comment about build

Reviewed-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-09 17:03:30 +08:00
Jun Zhao
153a6a67a9 tools/crypto_bench: check malloc fail before using it
Need to check malloc fail before using it, so adjust the location
in the code.

Reviewed-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-09 16:59:55 +08:00