1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

103938 Commits

Author SHA1 Message Date
Paul B Mahol
d7408a786f avfilter/vf_blend: refactor similar code 2021-09-27 19:12:48 +02:00
NoHalfBits
b786bc7433 avcodec/videotoolboxenc: Fixes non-B-Frame encoding
Sets vtctx->has_b_frames to 0 if the VideoToolbox compression
session will not emit B-frames (and, in consequence, no valid
DTSs). Required for the handling of invalid DTSs in
'vtenc_cm_to_avpacket' (line 2018ff) to work correctly and not
abort encoding with "DTS is invalid." when no B-frames are
generated.

Signed-off-by: NoHalfBits <ffmpeg-devel@fluthaus.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2021-09-27 07:06:06 -04:00
Andreas Rheinhardt
90546c6ca7 avfilter/preserve_color: Add necessary headers
Fixes checkheaders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 10:17:53 +02:00
Andreas Rheinhardt
c3222931ab avformat/mxfenc: Simplfy writing padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
9fab059eab avformat/gxfenc: Simplify writing padding/reserved elements
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
5eafbf0b08 avformat/avienc: Simplify writing padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
c8e75076f1 avformat/omaenc: Simplify writing padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
ffe9867bc2 fate/oma: Add remux tests for ATRAC3 and ATRAC3P
They already uncovered an uninitialized-value bug in the ATRAC3 code
in the demuxer; and provide coverage for ID3v2.3.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
fc439f776d fate/demux: Move Sony OpenMG audio (oma) test into a new file
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
b98e397252 avformat/asfenc: Simplify writing error correction data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
dbc76e4e70 avformat/mpegenc: Simplify writing padding/stuffing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
62c8b96a13 avformat/matroskaenc: Simplify writing qt-compatibility header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
2c47a94911 avformat/movenc: Simplify reserving space for tfrf tags
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
1cf3c59b58 avformat/movenc: Limit ism_lookahead to a sane value
There can only be a maximum of 255 entries in a tfrf tag, so using
more makes no sense; moreover, several size computations can overflow
in this case. Fix this by limiting it to 255.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
63a5e83de8 avformat/icoenc: Use avcodec_get_name() instead of codec descriptor
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
7d5e27b473 avformat/icoenc: Simplify writing bitmask
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:59 +02:00
Andreas Rheinhardt
d94b641b4a avformat/cafenc: Fix memleak when trailer is never written
Do this by using the AVStream's priv_data for the buffer holding
the packet size data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:58 +02:00
Andreas Rheinhardt
19a6b51fe6 avformat/cafenc: Don't segfault upon allocation error
If an array for the packet sizes could not be successfully reallocated
when writing a packet, the CAF muxer frees said array, but does not
reset the number of valid bytes. As a result, when the trailer is
written later, avio_write tries to read that many bytes from NULL,
which segfaults.

Fix this by not freeing the array in case of error; also, postpone
writing the packet data after having successfully (re)allocated the
array, so that even on allocation error the file can be correctly
finalized.

Also remove an unnecessary resetting of the number of size entries
used at the end.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:58 +02:00
Andreas Rheinhardt
42fe438482 avformat/cafenc: Fix potential integer overflow
(As long as avio_write() only accepts an int, it makes no sense
to try to support sizes that don't fit into an int.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:58 +02:00
Andreas Rheinhardt
3a47e87d55 fate/caf: Add remux tests
These test both the muxer as well as the demuxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 07:08:53 +02:00
Andreas Rheinhardt
e02447e41e fate/demux: Move caf test to its own file
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 06:12:54 +02:00
Andreas Rheinhardt
f7d59ca364 avfilter/audio, video: Remove references to avfilter_unref_buffer()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 06:10:57 +02:00
Andreas Rheinhardt
3042e71776 avformat/filmstripenc: Simplify writing reserved elements
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 06:06:08 +02:00
Andreas Rheinhardt
aeee5e3967 avformat/chromaprint: Improve returned error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 06:05:46 +02:00
Andreas Rheinhardt
dd1975b0bb avformat/chromaprint: Add deinit function
Fixes memleaks in case the trailer is never written.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 06:04:39 +02:00
Andreas Rheinhardt
4e135347a7 avutil/tests/opt: Set AVClass.version
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 05:51:44 +02:00
Andreas Rheinhardt
386a4989df avutil/opt: Remove outdated version check
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-27 05:42:48 +02:00
Paul B Mahol
e2d40cd1d5 avfilter/vf_blend: add softdifference blend mode 2021-09-26 23:34:47 +02:00
Paul B Mahol
53f8a03123 avfilter/vf_colorchannelmixer: add extended preserve color support 2021-09-26 20:27:24 +02:00
Paul B Mahol
e4327f97b1 avfilter/vf_colorchannelmixer: simplify code a little 2021-09-26 20:27:24 +02:00
Paul B Mahol
34102f8c07 avfilter/vf_colorlevels: add preserve color option 2021-09-26 20:27:23 +02:00
Paul B Mahol
4727e30ec3 avfilter/vf_colorlevels: refactor code so all components are processed in same loop
This is also faster.
2021-09-26 20:27:23 +02:00
Soft Works
8983c3d7e4 avfilter/elbg: Extend filter to include alpha values in the quantization procedure
Usage example:

ffmpeg -y -loglevel verbose -i "..\fate-suite\apng\o_sample.png" -filter_complex "elbg=pal8=1:use_alpha=1" -frames:v 1 out.png

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:34:08 +02:00
Michael Niedermayer
0e45886e6e avcodec/apedec: Fix integer overflow in filter_fast_3320()
Fixes: signed integer overflow: 2145649668 + 3956526 cannot be represented in type 'int'
Fixes: 38351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4647077926273024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:42 +02:00
Michael Niedermayer
8e67cfe15b tools/target_dec_fuzzer: Adjust threshold for WMV2
Fixes: Timeout
Fixes: 37737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-4923012999151616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:22 +02:00
Michael Niedermayer
451ceb5131 avformat/mov: Fix last mfra check
Fixes: signed integer overflow: 9223372036854775360 + 536870912 cannot be represented in type 'long'
Fixes: 37940/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6095637855207424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:18 +02:00
Michael Niedermayer
20afd3a63a avcodec/mxpegdec: Check for AVDISCARD_ALL
Fixes: Fixes NULL pointer dereference
Fixes: 36610/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-6052641783283712
Fixes: 37907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-4725170850365440
Fixes: 37904/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-6367889262247936
Fixes: 38085/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-5175270823297024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:08 +02:00
Michael Niedermayer
991b3deea9 avcodec/h274: fix bad left shifts
Fixes: left shift of negative value -3
Fixes: 37788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6024714540154880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:21:59 +02:00
Michael Niedermayer
5f835efbca avcodec/flicvideo: Check remaining bytes in FLI*COPY
Fixes: Timeout
Fixes: 37795/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-4846536543043584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:21:55 +02:00
Michael Niedermayer
018b611b4b avcodec/utils: ARGO writes 4x4 blocks without regard to the image dimensions
Fixes: out of array access
Fixes: 37197/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-5877046382297088

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:21:40 +02:00
Manuel Stoeckl
32329397e2 swscale: add input/output support for X2BGR10LE
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 16:26:10 +02:00
Manuel Stoeckl
0760d9153c lavu/pix_fmt: add pixel format for x2bgr10
The new format (given in big/little endian forms) matches the
existing X2RGB10 format, except with B and R channels switched.

AV_PIX_FMT_X2BGR10 data often is created by OpenGL programs
whose buffers use the GL_RGB10 internal format.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 16:26:10 +02:00
Manuel Stoeckl
ca594df622 swscale/yuv2rgb: fix conversion to X2RGB10
This resolves a problem where conversions from YUV to X2RGB10LE
would produce color values a factor 4 too small, because an 8-bit
value was placed in a 10-bit channel.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 16:26:10 +02:00
Andreas Rheinhardt
78ec2f3bd7 avcodec/internal: Update AVCodecInternal.is_copy documentation
Forgotten in 1f4cf92cfb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:29 +02:00
Andreas Rheinhardt
b9fd9bce73 avcodec/avcodec: Simplify check for flushing of bsf
Just check for the existence of the bsf. This is equivalent to
the old criterion of the AVCodecContext being a decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:29 +02:00
Andreas Rheinhardt
29e23ac71d avcodec/avcodec: Remove redundant assert
It is now checked by FATE that no encoder capable of flushing
uses frame threads, so this now redundant runtime check can
be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:29 +02:00
Andreas Rheinhardt
d6176eeeec avcodec/tests/avcodec: Check codec caps for consistency
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:19 +02:00
Andreas Rheinhardt
482850992c avcodec/avcodec: Make sanity check stricter
If an AVCodec has a private class, its priv_data_size must be > 0
and at the end of a successful call to avcodec_open2()
the AVCodecContext's priv_data must exist and its first element
must be a pointer to said AVClass. This should not be conditional
on priv_data_size being > 0 (which is tested by FATE) or
on the private context having been successfully allocated
(which has to have happened at that point). So remove these
preconditions to make the test stricter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:19 +02:00
Andreas Rheinhardt
2b0f29507f avcodec/tests/avcodec: Sanity check AVCodec.priv_data_size
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:18 +02:00
Andreas Rheinhardt
5aac4b669a avcodec/j2kenc: Fix AV_OPT_TYPE_CONST offsets
They are supposed to be zero.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:18 +02:00