Commit Graph

42832 Commits

Author SHA1 Message Date
Peter Ross 1b59f3f844 avcodec/mv30: use aandcttables 2020-04-17 19:34:02 +10:00
Peter Ross 06dab51e68 avcodec/mv30: remove unused table elements 2020-04-17 19:34:02 +10:00
Peter Ross 3e5f0cf271 avcodec/vp3: fix indentation 2020-04-17 19:33:43 +10:00
James Almer fccd6c2be0 avcodec: add a WebP parser
Based on code from the BMP parser.

Addresses ticket #8574

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-04-16 15:05:07 -03:00
Michael Niedermayer 8e30502abe avcodec/ac3dec_fixed: Fix several invalid left shifts in scale_coefs()
Fixes: left shift of negative value -14336
Fixes: 20298/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5675484201615360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-16 00:56:49 +02:00
Michael Niedermayer 55f9683cf6 avcodec/flac_parser: Do not lose header count in find_headers_search()
Fixes: Timeout
Fixes: out of array access
Fixes: 20274/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5649631988154368
Fixes: 19275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5757535722405888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-16 00:56:49 +02:00
Michael Niedermayer abb5762e98 avcodec/audiodsp: Fix integer overflow in scalarproduct_int16_c()
Fixes: signed integer overflow: 2145417478 + 76702564 cannot be represented in type 'int'
Fixes: 20313/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RA_144_fuzzer-5734487724130304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-16 00:56:49 +02:00
Philip Langdale 22b25b3ea5 avcodec: Add explicit capability flag for encoder flushing
Previously, there was no way to flush an encoder such that after
draining, the encoder could be used again. We generally suggested
that clients teardown and replace the encoder instance in these
situations. However, for at least some hardware encoders, the cost of
this tear down/replace cycle is very high, which can get in the way of
some use-cases - for example: segmented encoding with nvenc.

To help address that use case, we added support for calling
avcodec_flush_buffers() to nvenc and things worked in practice,
although it was not clearly documented as to whether this should work
or not. There was only one previous example of an encoder implementing
the flush callback (audiotoolboxenc) and it's unclear if that was
intentional or not. However, it was clear that calling
avocdec_flush_buffers() on any other encoder would leave the encoder in
an undefined state, and that's not great.

As part of cleaning this up, this change introduces a formal capability
flag for encoders that support flushing and ensures a flush call is a
no-op for any other encoder. This allows client code to check if it is
meaningful to call flush on an encoder before actually doing it.

I have not attempted to separate the steps taken inside
avcodec_flush_buffers() because it's not doing anything that's wrong
for an encoder. But I did add a sanity check to reject attempts to
flush a frame threaded encoder because I couldn't wrap my head around
whether that code path was actually safe or not. As this combination
doesn't exist today, we'll deal with it if it ever comes up.
2020-04-15 14:54:42 -07:00
Carl Eugen Hoyos d727fea4da lavc/jpeg2000dec: Cosmetics, re-indent after last commit. 2020-04-15 20:03:33 +02:00
Carl Eugen Hoyos cbe3f1b1fb lavc/jpeg2000dec: Allow to force a compatible pix_fmt.
This copies the behaviour of the libopenjpeg decoder.
Fixes ticket #5919.
2020-04-15 20:00:51 +02:00
Michael Niedermayer 18f5256c0d avcodec/cbs_jpeg_syntax_template: Check array index in huffman_table()
Fixes: index 224 out of bounds for type 'uint8_t [224]'
Fixes: 21534/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-6291612167831552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-15 18:48:23 +02:00
Michael Niedermayer d31862c2b1 avcodec/cbs_jpeg_syntax_template: Check table index before use in dht()
Fixes: out of array access
Fixes: 21515/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5766121576988672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-15 18:48:23 +02:00
Matthieu Bouron 5216edbc54 avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak
Fixes ticket #8607.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2020-04-15 09:43:16 +02:00
Ming Qian 8ac8e905e9 avcodec/v4l2_m2m: handle v4l2 end of stream event
When flushing the capture buffers, the driver may send a V4L2_EVENT_EOS
to notify that draining is completed. Currently, v4l2_m2m does not
subscribe to this event, which can cause some devices (i.e. imx8qm) to
hang at the end of encoding/decoding. Support for handling the event is
added in this commit.

Some devices may not signal V4L2_EVENT_EOS. This is logged as a warning
message during initialization and not treated as a fatal error.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-04-14 23:42:05 -04:00
Linjie Fu 798ab1d03e lavc/vaapi_decode: fix the build failure when hevc_vaapi is disabled
Verified with ./configure --enable-vaapi --disable-hwaccel=hevc_vaapi

Failure reported in:
http://fate.ffmpeg.org/report.cgi?time=20200401135031&slot=x86_64-archlinux-gcc-random

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-04-13 14:14:52 +01:00
Andreas Rheinhardt 14dd0a9057 avcodec/cbs: Avoid leaving the ... out in calls to variadic macros
According to C99, there has to be at least one argument for every ...
in a variadic function-like macro. In practice most (all?) compilers also
allow to leave it completely out, but it is nevertheless required: In a
variadic macro "there shall be more arguments in the invocation than there
are parameters in the macro definition (excluding the ...)." (C99,
6.10.3.4).

CBS (not the framework itself, but the macros used in the
cbs_*_syntax_template.c files) relies on the compiler allowing to leave
a variadic macro argument out. This leads to warnings when compiling in
-pedantic mode, e.g. "warning: must specify at least one argument for
'...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]"
from Clang.

Most of these warnings can be easily avoided: The syntax_templates
mostly contain helper macros that expand to more complex variadic macros
and these helper macros often omit an argument for the .... Modifying
them to always expand to complex macros with an empty argument for the
... at the end fixes most of these warnings: The number of warnings went
down from 400 to 0 for cbs_av1, from 1114 to 32 for cbs_h2645, from 38 to
0 for cbs_jpeg, from 166 to 0 for cbs_mpeg2 and from 110 to 8 for cbs_vp9.

These eight remaining warnings for cbs_vp9 have been fixed by switching
to another macro in cbs_vp9_syntax_template: The fixed values for the
sync bytes as well as the trailing bits for byte-alignment are now read
via the fixed() macro (this also adds a check to ensure that trailing
bits are indeed zero as they have to be).

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-12 23:23:49 +02:00
Rosen Penev 4fa4ab97f9 avcodec/mips: fix get_cabac_inline_mips function name
On other platforms, the functions are named get_cabac_inline_xxx but not
this one. There's also a define.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-12 16:36:47 +02:00
James Zern 0ece80559a avcodec/libaomenc,cosmetics: fix a typo
tradeof -> trade-off

Signed-off-by: James Zern <jzern@google.com>
2020-04-11 15:22:35 -07:00
Wang Cao bd3389e9f4 avcodec/libaomenc.c: Add a libaom command-line option 'tune'
Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
2020-04-11 15:12:34 -07:00
Michael Niedermayer 20ade59d96 avcodec/dpcm: clip exponent into supported range in XAN DPCM
Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 21200/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XAN_DPCM_fuzzer-5754704894361600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-11 18:15:58 +02:00
Gautam Ramakrishnan 995d937827 libavcodec/jpeg2000: fix precinct coordinate calculation
The calculation of precinct boundaries has been
fixed. The precinct boundaries were calculated
as an offset to the band boundary, but must
instead be calculated as an offset from the
reslevel. This patch fixes #4669 and #4679.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-11 18:15:58 +02:00
Gautam Ramakrishnan e8344f21e1 libavcodec/jpeg2000dec.c: fix error in cod marker
This patch fixes an error where the COC marker
overrides all data of the SPcod field of the
COD marker. It must override only one bit of
SPcod field. This now allows p0_08.j2k to be
decoded correctly (mentioned in #4679).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-11 18:15:58 +02:00
Andreas Rheinhardt 12a5e0409d avcodec/ac3_tab: Zero-terminate ff_ac3_sample_rate_tab
This is required to use it as an AVCodec.supported_samplerates array.
Adding the sentinel has been forgotten in 4679a474.
Without it e.g. the FATE-test ffmpeg-filter_complex_audio fails with ASAN.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-11 17:13:36 +02:00
Zane van Iperen 67c4405fac avcodec/adpcm: remove unused shift parameter from adpcm_ima_qt_expand_nibble()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-04-11 17:01:18 +02:00
Carl Eugen Hoyos 5325423437 lavc/amrwbdec: Add a comment about the missing muting technique. 2020-04-11 14:23:51 +02:00
Carl Eugen Hoyos e426f71c96 lavc/amrwbdec: Output silence for frames marked as corrupt.
Fixes ticket #7113.
2020-04-11 14:10:45 +02:00
Carl Eugen Hoyos 8f01fa378f lavc/amrwbdec: Remove a dead comparison.
Modes > MODE_SID are already filtered out at this point.
Simplifies the following change.
2020-04-11 14:08:49 +02:00
Rosen Penev 875ba23333 avcodec/aacdec: fix compilation under soft float MIPS
Place HAVE_MIPSFPU further up so that functions that use floating point
ASM are defined away. Otherwise compilation failures result when soft
float in enabled on the toolchain.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-11 14:00:32 +02:00
John Stebbins fa736a994c lavc/xsubenc: return meaningfull error codes
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
John Stebbins 5fcf620eee lavc/webvttenc: return more meaningful error codes
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
John Stebbins 9ac715a367 lavc/srtenc: return more meaninful error codes
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
John Stebbins 1d544e410e lavc/movtextenc: return more meaningful error codes
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
John Stebbins 9a0817baa4 lavc/assenc: return more meaningful error code
When the buffer is too small, return AVERROR_BUFFER_TOO_SMALL

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
John Stebbins 75a8458863 lavc/dvbsub: return meaningful error codes
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
John Stebbins eda8d48fea lavc/dvbsub: fix potential encode buffer overflow
encode buffer size was ignored

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 15:58:04 -07:00
Philip Langdale 7b0c22768e Changelog: Add entry for expanded styling support in movtext 2020-04-10 09:32:13 -07:00
John Stebbins ad3f6212ac lavc/movtextenc: handle changes to hilight alpha
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins eeef870851 lavc/movtextenc: add option to scale fontsize with height
If the video dimensions are different than the ASS play_res then the
font sizes need to be adjusted to get the same apparent render size.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 1f8278ee24 lavc/movtextenc: add font name handling
Initializes the mov text sample description from the ASS header and
creates an mov font table from the fonts available in the ASS Styles.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins dbdbcbf384 lavc/movtextenc: simplify initialization of new style record
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins bb8fd04665 lavc/movtextenc: handle cancel overrides callback
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 848792be60 lavc/movtextenc: add font size tag handling
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 2e79843e37 lavc/movtextenc: add alpha tag handling
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins b847bd9582 lavc/movtextenc: add color tag handling
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 37ab5e2e7b lavc/movtextenc: init style record from ASS dialog style
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins a129cc9e29 lavc/movtextenc: fix unclosed style records
The last record at the end of each dialog was never closed

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 1bf0df4c4f lavc/movtextenc: simplify style record updates
Makes style update code easier to extend for style types not yet handled

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 15b81f5e6b lavc/movtextenc: keep values in native byte order till written
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins 32cf264d8f lavc/movtextenc: use correct color component order
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins a52eef68d4 lavc/ass_split: fix parsing utf8 scripts
The [Script Info] section was skipped if starts with UTF8 BOM

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00