Commit Graph

100612 Commits

Author SHA1 Message Date
Paul B Mahol
32586a42da avfilter/vf_limiter: add support for commands 2020-12-15 20:35:01 +01:00
James Almer
cd821c18dc avcodec/cuviddec: unref output frame on failure
Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-13 15:50:42 -03:00
James Almer
eadf7e3a59 avcodec/cuviddec: check for av_buffer_ref() failure
Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-13 15:50:42 -03:00
James Almer
081a17990b avcodec/libdav1d: stop setting AVFrame->best_effort_timestamp
It's now set by the generic decode code.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-13 12:14:57 -03:00
James Almer
94febdaec6 avcodec/mjpegdec: stop setting AVFrame->best_effort_timestamp
It's now set by the generic decode code.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-13 12:14:57 -03:00
James Almer
4bff800dc9 avcodec/decode: set best_effort_timestamp on output frames for all decoders
Fixes a decoding regression introduced by e9a2a87773, and as a side effect also
fixes bogus values set to certain audio frames that had some samples discarded,
where the offsets added to pts, pkt_dts and pkt_duration were not reflected in
best_effort_timestamp.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-13 12:14:57 -03:00
Paul B Mahol
bf4b9e933f avfilter/af_afreqshift: add fltp sample format support 2020-12-13 11:16:31 +01:00
Andriy Gelman
5148740e79 fate: fix fate-filter-hqx on big-endian arches
One of the inputs to the fate test has an rgba pixel format which needs
to be converted to rgb32 (argb on big-endian) for the hqx filter. Because auto
scaling in the fate test is disabled, this needs a separate scale
filter.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-12-12 23:14:45 -05:00
Andriy Gelman
1200264fc4 swscale/rgb2rgb_template: use shuffle macro on big-endian arches
Fixes fate-qtrle-32bit on big-endian.

The macro does a simple byte swap on uint8 array without any casts, so
it's valid on big-endian arches.

The mentioned test was failing because the byteswap function
shuffle_bytes_3210_c() is used in the pixel format conversion
(argb->bgra).

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-12-12 23:07:22 -05:00
Jun Zhao
0320dab265 lavfi/dnn: check the return value from sws_getContext
sws_getContext may be return NULL, and it's will be dereferenced,
so add the check.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-12-12 13:34:30 +08:00
Jun Zhao
ae2075265b lavfi/dnn: used the format name in debug message
Used the format name in debug message.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-12-12 13:34:24 +08:00
Michael Niedermayer
001bc594d8 avformat/iff: Check data_size
Fixes: infinite loop
Fixes: 27834/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5694930919620608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-12 00:13:58 +01:00
Paul B Mahol
adf72718a4 avfilter/vf_fade: add timeline support 2020-12-11 23:02:03 +01:00
Paul B Mahol
fc50a8de55 avfilter/af_afade: add support for commands to afade filter 2020-12-11 23:02:03 +01:00
Paul B Mahol
d76469378d avfilter/vf_convolution: add support for commands 2020-12-11 18:33:48 +01:00
Paul B Mahol
7adb747fd7 avfilter/vf_chromanr: add options for finer controls of filtering 2020-12-11 13:39:50 +01:00
Paul B Mahol
b607f19374 avfilter: add asuperpass and asuperstop filter 2020-12-11 12:07:06 +01:00
Andreas Rheinhardt
628d02a611 avcodec/speedhqenc: Call correct function
Up until now, the SpeedHQ encoder called a wrong function for init:
void ff_init_uni_ac_vlc(const uint8_t huff_size_ac[256],
                        uint8_t *uni_ac_vlc_len);
Yet the first argument actually used is of type RLTable; the size of
said struct is less than 256 if the size of a pointer is four, leading
to an access beyond the end of the RLTable.

This commit fixes this by calling the actually intended function:
init_uni_ac_vlc() from mpeg12enc.c. It was intended to use this
function [1], yet doing so was forgotten when the patch was actually
applied.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/266187.html

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-11 02:20:05 +01:00
Andreas Rheinhardt
43b4c66e6b avformat/utils: Improve ffio_limit logic
The earlier code would not complain if the remaining size was one byte
short of the desired size; and the way it performed the check could run
into signed integer overflow.

Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Fixes: Timeout
Fixes: 26434/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5752845451919360
Fixes: 26444/clusterfuzz-testcase-minimized-ffmpeg_dem_BINK_fuzzer-4697773380993024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-11 01:46:15 +01:00
Carl Eugen Hoyos
7ab5192260 lavf/rawdec: Return a low score if the mjpeg probe function detected one frame.
Fixes ticket #9026.
2020-12-11 00:23:41 +01:00
Paul B Mahol
072835898d avfilter/af_earwax: fix check that was left in previous commit
Makes output exact with smaller number of samples per frame than taps.
2020-12-10 23:43:49 +01:00
Andreas Rheinhardt
e0e9c94c2b avformat/hashenc: Reuse hash_free() for framehash muxers
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 20:28:07 +01:00
Hendrik Leppkes
494f868e93 avcodec: set AV_CODEC_CAP_CHANNEL_CONF on decoders which set their own channels
The decoders in this set either have a fixed channel count, or read it
from the bitstream, and thus do not require the channel count as
external information.

Fixes various regressions since
81503ac58a, which requires a valid channel
count for decoders which do not set this capability.

Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2020-12-10 13:28:35 +01:00
Jun Zhao
412c3b37a4 tests/audiomatch: add free to make static analysis tools happy
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-12-10 19:38:32 +08:00
Zhao Zhili
345d04e870 avformat/mov: remove an always true condition 2020-12-10 19:38:00 +08:00
Anton Khirnov
19ce064239 smvjpegdec: merge into mjpegdec
SMVJPEG stores frames as slices of a big JPEG image. The decoder is
implemented as a wrapper that instantiates a full internal MJPEG
decoder, then forwards the decoded frames with offset data pointers.
This is unnecessarily complex and fragile, not supporting useful decoder
capabilities like direct rendering.

Re-implement the decoder inside the MJPEG decoder, which is accomplished
by returning each decoded frame multiple times, setting cropping
information appropriately on each instance.

One peculiar aspect of the previous design is that since
- the smvjpeg decoder returns one frame per input packet
- there are multiple frames in each packets (the aformentioned slices)
the demuxer needs to return each packet multiple times.
This is now also eliminated - the demuxer now returns each packet
exactly once, with the duration set to the number of frames it decodes
to.

This also removes one of the last remaining internal uses of the old
video decoding API.
2020-12-10 10:07:09 +01:00
Anton Khirnov
e9a2a87773 mjpegdec: convert to receive_frame()
This will be useful in the following commit.
2020-12-10 10:03:58 +01:00
Anton Khirnov
36237ac4ee tests: stop using -vsync drop
It depends on the muxer generating the timestamps, which is deprecated
and scheduled for removal on next bump.

A bunch of tests change timestamps, because of ffmpeg.c is not
generating them correctly. This should be fixed later.
2020-12-10 09:53:52 +01:00
Anton Khirnov
50b49f833a ffmpeg: stop accessing deprecated stream-embedded codec context 2020-12-10 09:53:35 +01:00
Anton Khirnov
1c0885334d lavf/mux: rewrite guessing the packet duration
Factor out the code into a separate muxing-specific function.
Stop accessing the deprecated AVStream-embedded codec context, use the
average framerate (if specified) instead.
2020-12-10 09:50:18 +01:00
Anton Khirnov
fe7f0d366f tests: drop api-codec-param test
It fundamentally depends on deprecated lavf internals.
2020-12-10 09:46:30 +01:00
Anton Khirnov
fcf7ef0a81 lavd/caca: do not access deprecated codec context
Use the stream timebase instead.
2020-12-10 09:45:19 +01:00
Anton Khirnov
5471b8944c codec_desc: add SMVJPEG flags
Same flags as MJPEG, as it's essentially the same codec.
2020-12-10 09:45:04 +01:00
Anton Khirnov
63c2e500d2 img2dec: export avg_frame_rate 2020-12-10 09:44:40 +01:00
Nuo Mi
d4751d8c63 avcodec/hevcdec: dynamic allocate sList and HEVClcList
following comandline will crash the ffmpeg
ffmpeg -threads 17 -thread_type slice -i WPP_A_ericsson_MAIN_2.bit out.yuv -y

the HEVCContext->sList size is MAX_NB_THREADS(16), any > 16 thread number will crash the application

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-12-10 09:44:11 +01:00
Andreas Rheinhardt
6a94afbd5b avcodec/snow: Use ff_thread_once() in ff_snow_common_init()
ff_snow_common_init() currently initializes static data every time it is
invoked; given that both the Snow encoder and decoder have the
FF_CODEC_CAP_INIT_THREADSAFE flag set, this can lead to data races (and
therefore undefined behaviour) even though all threads write the same
values. This commit fixes this by using ff_thread_once() for the
initializations.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:36:16 +01:00
Andreas Rheinhardt
bdfe51b44f avcodec/idcinvideo: Mark decoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:34:55 +01:00
Andreas Rheinhardt
41519b29fa avcodec/cinepak: Mark decoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:34:08 +01:00
Andreas Rheinhardt
f79927990d avcodec/cinepakenc: Mark encoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:15:03 +01:00
Michael Niedermayer
7b88dd8f0c avformat/matroskadec: Sanity check codec_id/track type
Fixes: memleak
Fixes: 27766/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5198300814508032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-09 21:41:15 +01:00
Michael Niedermayer
0677bdb1f5 avformat/rpl: Check the number of streams
Fixes: out of memory access
Fixes: 27787/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-4743666463408128.fuzz

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>
2020-12-09 21:41:15 +01:00
Michael Niedermayer
b1bced5433 avformat/vividas: Check sample_rate
Fixes: Assertion c > 0 failed at libavutil/mathematics.c
Fixes: 27001/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5726041328582656
Fixes: 27453/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5716060384526336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-09 21:41:15 +01:00
Michael Niedermayer
b29d351f97 avformat/vividas: Make len signed
Fixes: out of array access
Fixes: 27424/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5682070692823040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-09 21:41:15 +01:00
James Almer
0e62efad7c avcodec/vaapi_av1: fill the remaining VAFilmGrainStructAV1 fields
Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-09 14:42:20 -03:00
Mark Reid
8d19b3c4a5 avcodec/exr: preserve half-float NaN bits and add fate test
Handles NaNs more like the official implementation handles them, preserving
the original bits.
2020-12-09 12:31:09 +01:00
Gyan Doshi
7777e5119a avfilter/cropdetect: add option for initial skip
The cropdetect filter, at present, skips the first two frames. This
behaviour is hardcoded.

New option 'skip' allows users to change this. Convenient for when
input is a single image or a trimmed video stream.

Default is kept at 2 to preserve current behaviour.
2020-12-09 12:52:09 +05:30
Gyan Doshi
b9b719fedc avcodec/mpegvideo_enc: check for SpeedHQ encoder
Avoids build failure when mpegvideo_enc is built but SpeedHQ encoder
isn't.
2020-12-09 12:50:05 +05:30
Philip Langdale
40135829b6 avcodec/libaom: Support monochrome encoding with libaom >= 2.0.1
Monochrome encoding with libaom was buggy for a long time, but this was
finally sorted out in libaom 2.0.1 (2.0.0 is almost there but was still
buggy in realtime mode).

We'll keep support for libaom 1.x around until the LTS distros that
include it are EOL (which is still a long time from now).

Fixes: https://trac.ffmpeg.org/ticket/7599
2020-12-08 15:31:39 -08:00
Andreas Rheinhardt
0dac317ba3 avformat/framecrcenc: Make side-data checksums endian-independent
Do this by converting big-endian side data to little endian for
checksumming.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 18:54:20 +01:00
Andreas Rheinhardt
b8fe417c19 avformat/framecrcenc: Don't read after the end of side-data
Nothing guarantees that the size of side data containing a palette
is actually divisible by four (although it should be); but for
big-endian systems, an algorithm is used that presupposed this.
So switch to an algorithm that does not overread: It processes
four bytes at a time, but only if all of them are contained in
the side data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 18:54:20 +01:00