]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoavcodec/bsf: support shorthand options for av_bsf_list_parse_str
Marton Balint [Fri, 17 Apr 2020 22:58:18 +0000 (00:58 +0200)]
avcodec/bsf: support shorthand options for av_bsf_list_parse_str

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/decode: use a single list bsf for codec decode bsfs
Marton Balint [Sat, 25 Apr 2020 21:48:21 +0000 (23:48 +0200)]
avcodec/decode: use a single list bsf for codec decode bsfs

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agofftools/ffprobe: show closed caption info in the stream dump
vectronic [Wed, 29 Apr 2020 16:14:33 +0000 (17:14 +0100)]
fftools/ffprobe: show closed caption info in the stream dump

Signed-off-by: vectronic <hello.vectronic@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/vp9dsp_template: Fix integer overflows in idct32_1d()
Michael Niedermayer [Tue, 11 Feb 2020 21:58:08 +0000 (22:58 +0100)]
avcodec/vp9dsp_template: Fix integer overflows in idct32_1d()

Fixes: signed integer overflow: -193177 * 11585 cannot be represented in type 'int'
Fixes: 20557/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5704852816789504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/alacdsp: Fix invalid shift in append_extra_bits()
Michael Niedermayer [Sun, 26 Apr 2020 17:29:39 +0000 (19:29 +0200)]
avcodec/alacdsp: Fix invalid shift in append_extra_bits()

Fixes: left shift of negative value -1
Fixes: 21390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-6242539519868928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/wmalosslessdec: prevent sum of positive numbers from becoming negative
Michael Niedermayer [Sun, 9 Feb 2020 17:09:24 +0000 (18:09 +0100)]
libavcodec/wmalosslessdec: prevent sum of positive numbers from becoming negative

Fixes: left shift of negative value -8321365
Fixes: 20506/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-4798062906310656
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/dstdec: Fix integer overflow in read_table()
Michael Niedermayer [Sat, 8 Feb 2020 23:23:14 +0000 (00:23 +0100)]
avcodec/dstdec: Fix integer overflow in read_table()

Fixes: signed integer overflow: -16 * 134217879 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5639509530378240
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodoc/mailing-list-faq: Mention current problem with GMX
Michael Niedermayer [Sat, 2 May 2020 09:50:18 +0000 (11:50 +0200)]
doc/mailing-list-faq: Mention current problem with GMX

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavc/opus: Reset alloc_trim when doing decoder bit-allocation.
Carl Eugen Hoyos [Sat, 2 May 2020 08:09:01 +0000 (10:09 +0200)]
lavc/opus: Reset alloc_trim when doing decoder bit-allocation.

Fixes ticket #8649.
Reported-by: irc user Xogium
4 years agos->target_i and global are in dB but s->target_tp and true_peak are
Sebastian Dröge [Sat, 2 May 2020 03:52:00 +0000 (20:52 -0700)]
s->target_i and global are in dB but s->target_tp and true_peak are
linear. Instead of mixing these in the calculations, convert the former
first to have all following calculations in the same unit.

Signed-off-by: Kyle Swanson <k@ylo.ph>
4 years agoavcodec/nvenc: refactor dts calculation logic
Timo Rothenpieler [Fri, 1 May 2020 21:42:56 +0000 (23:42 +0200)]
avcodec/nvenc: refactor dts calculation logic

The old approach used some highly complex delta computation math and
output-delaying.
I do not remember what the initial reasoning behind that was, but given
that we can just offset the dts by the amount of bframes, it seems wholy
unnecessary.

This leaves open an issue with VFR content, for which some more complex
logic might be needed.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 years agoac3enc: fix AC3 downmix metadata issue
Piotr Oleszczyk [Thu, 30 Apr 2020 16:17:36 +0000 (18:17 +0200)]
ac3enc: fix AC3 downmix metadata issue

Due to a typo, it was impossible to write 0.595 / -4.5 dB
of ltrt_cmixlev, ltrt_surmixlev, loro_cmixlev, loro_surmixlev.
Without any error 0.841 / -1.5 dB was written to file.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/oggdec: Reallocate buffer before writing into it
Michael Niedermayer [Fri, 1 May 2020 12:34:18 +0000 (14:34 +0200)]
avformat/oggdec: Reallocate buffer before writing into it

Fixes: out of array write
Fixes: Regression since f619e1ec66b89215582eff4404b681b760540b4f
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/oggdec: Factor buffer reallocation out
Michael Niedermayer [Fri, 1 May 2020 12:33:46 +0000 (14:33 +0200)]
avformat/oggdec: Factor buffer reallocation out

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/librav1e: Use the framerate when available for ratecontrol
Derek Buitenhuis [Thu, 30 Apr 2020 19:06:43 +0000 (20:06 +0100)]
avcodec/librav1e: Use the framerate when available for ratecontrol

Rav1e currently uses the time base given to it only for ratecontrol... where
the inverse is taken and used as a framerate. So, do what we do in other wrappers
and use the framerate if we can.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agoavcodec/nvenc: offset dts to account for b-frame reordering
Timo Rothenpieler [Fri, 1 May 2020 18:51:26 +0000 (20:51 +0200)]
avcodec/nvenc: offset dts to account for b-frame reordering

Fixes ticket #7303

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 years agoavformat/hlsenc: add support for microseconds since epoch based sequence number
Marton Balint [Sat, 18 Apr 2020 20:15:39 +0000 (22:15 +0200)]
avformat/hlsenc: add support for microseconds since epoch based sequence number

Sequence numbers of segments should be unique, if an encoder is using shorter
than 1 second segments and it is restarted, then future segments will be using
already used sequence numbers if initial sequence number is based on the number
of seconds since epoch and not microseconds.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavutil/opt: only skip evaluation for rational options
Marton Balint [Sat, 18 Apr 2020 19:37:45 +0000 (21:37 +0200)]
avutil/opt: only skip evaluation for rational options

Fixes problems when non-rational options were set using rational expressions,
causing rounding errors and the option range limits not to be enforced
properly.

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agodoc/utils: add more examples for valid time duration
Limin Wang [Wed, 8 Apr 2020 02:10:44 +0000 (10:10 +0800)]
doc/utils: add more examples for valid time duration

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/concat: priv_data should be freed internally
Limin Wang [Fri, 3 Apr 2020 13:03:06 +0000 (21:03 +0800)]
avformat/concat: priv_data should be freed internally

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/dashenc: remove the arbitrary restrictions for filename
Limin Wang [Wed, 8 Apr 2020 01:34:28 +0000 (09:34 +0800)]
avformat/dashenc: remove the arbitrary restrictions for filename

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/mpeg12enc: Use FF_PROFILE_MPEG2_xxx macros
Limin Wang [Fri, 3 Apr 2020 13:04:53 +0000 (21:04 +0800)]
avcodec/mpeg12enc: Use FF_PROFILE_MPEG2_xxx macros

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/matroskadec: Cosmetics
Andreas Rheinhardt [Fri, 6 Dec 2019 23:11:01 +0000 (00:11 +0100)]
avformat/matroskadec: Cosmetics

Reindentation as well as marking several variables used for demuxing
RealAudio as const to clearly see that they don't change during
demuxing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Support ContentCompression for all codecs
Andreas Rheinhardt [Fri, 6 Dec 2019 08:53:34 +0000 (09:53 +0100)]
avformat/matroskadec: Support ContentCompression for all codecs

The Matroska demuxer has three functions for creating packets out of
the data read: One for certain RealAudio codecs (ATRAC3, cook, sipr,
RealAudio 28.8), one for WebVTT (actually, the WebM flavour of it) and
one for all the others. Only the last function supported Matroska's
ContentCompression (e.g. it reversed zlib compression or added the
removed headers to the packets). But in Matroska, all tracks are allowed
to be compressed. This commit adds support for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Cache whether a track needs to be decoded
Andreas Rheinhardt [Wed, 4 Dec 2019 16:54:45 +0000 (17:54 +0100)]
avformat/matroskadec: Cache whether a track needs to be decoded

There is no need to recheck this for every frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Improve forward compability
Andreas Rheinhardt [Wed, 25 Mar 2020 05:52:09 +0000 (06:52 +0100)]
avformat/matroskadec: Improve forward compability

Matroska is built around the principle that a reader does not need to
understand everything in a file in order to be able to make use of it;
it just needs to ignore the data it doesn't know about.

Our demuxer typically follows this principle, but there is one important
instance where it does not: A Block belonging to a TrackEntry with no
associated stream is treated as invalid data (i.e. the demuxer will try
to resync to the next level 1 element because it takes this as a sign
that it has lost sync). Given that we do not create streams if we don't
know or don't support the type of the TrackEntry, this impairs this
demuxer's forward compability.

Furthermore, ignoring Blocks belonging to a TrackEntry without
corresponding stream can (in future commits) also be used to ignore
TrackEntries with obviously bogus entries without affecting the other
TrackEntries (by not creating a stream for said TrackEntry).

Finally, given that matroska_find_track_by_num() already emits its own
error message in case there is no TrackEntry with a given TrackNumber,
the error message (with level AV_LOG_INFO) for this can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Don't discard valid packets
Andreas Rheinhardt [Wed, 25 Mar 2020 05:00:53 +0000 (06:00 +0100)]
avformat/matroskadec: Don't discard valid packets

A Block (meaning both a Block in a BlockGroup as well as a SimpleBlock)
must have at least three bytes after the field containing the encoded
TrackNumber. So if there are <= 3 bytes, the Matroska demuxer would
skip this block, believing it to be an empty, but valid Block.

This might discard valid nonempty Blocks, namely if the track uses header
stripping. And certain definitely spec-incompliant Blocks don't raise
errors: Those with two or less bytes left after the encoded TrackNumber
and those with three bytes left, but with flags indicating that the Block
uses lacing as then there has to be further data describing the lacing.

Furthermore, zero-sized packets were still possible because only the
size of the last entry of a lace was checked.

This commit fixes this. All spec-compliant Blocks that contain data
(even if side data only) are now returned to the caller; spec-compliant
Blocks that don't contain anything are not returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Simplify checks for cook and ATRAC3
Andreas Rheinhardt [Mon, 20 Apr 2020 06:54:23 +0000 (08:54 +0200)]
avformat/matroskadec: Simplify checks for cook and ATRAC3

Some conditions which don't change and which can therefore be checked
in read_header() were instead rechecked upon parsing each block. This
has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Don't output uninitialized data for RealAudio 28.8
Andreas Rheinhardt [Wed, 22 Apr 2020 13:17:41 +0000 (15:17 +0200)]
avformat/matroskadec: Don't output uninitialized data for RealAudio 28.8

The Matroska demuxer splits every sequence of h Matroska Blocks into
h * w / cfs packets of size cfs; here h (sub_packet_h), w (frame_size)
and cfs (coded_framesize) are parameters from the track's CodecPrivate.

It does this by splitting the Block's data in h/2 pieces of size cfs each
and putting them into a buffer at offset m * 2 * w + n * cfs where
m (range 0..(h/2 - 1)) indicates the index of the current piece in the
current Block and n (range 0..(h - 1)) is the index of the current Block
in the current sequence of Blocks. The data in this buffer is then used
for the output packets.

The problem is that there is currently no check to actually guarantee
that no uninitialized data will be output. One instance where this is
trivially so is if h == 1; another is if cfs * h is so small that the
input pieces do not cover everything that is output. In order to
preclude this, rmdec.c checks for h * cfs == 2 * w and h >= 2. The
former requirement certainly makes much sense, as it means that for
every given m the input pieces (corresponding to the h different values
of n) form a nonoverlapping partition of the two adjacent frames of size w
corresponding to m. But precluding h == 1 is not enough, other odd
values can cause problems, too. That is because the assumption behind
the code is that h frames of size w contain data to be output, although
the real number is h/2 * 2. E.g. for h = 3, cfs = 2 and w = 3 the
current code would output four (== h * w / cfs) packets. although only
data for three (== h/2 * h) packets has been read.

(Notice that if h * cfs == 2 * w, h being even is equivalent to
cfs dividing w; the latter condition also seems very reasonable:
It means that the subframes are a partition of the frames.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Fix buffer overflow when demuxing RealAudio 28.8
Andreas Rheinhardt [Tue, 21 Apr 2020 22:15:54 +0000 (00:15 +0200)]
avformat/matroskadec: Fix buffer overflow when demuxing RealAudio 28.8

RealAudio 28.8 (like other RealAudio codecs) uses a special demuxing
mode in which the data of the existing Matroska Blocks is not simply
forwarded as-is. Instead data from several Blocks is recombined
together to output several packets. The parameters governing this
process are parsed from the CodecPrivate: Coded framesize (cfs), frame
size (w) and sub_packet_h (h).

During demuxing, h/2 pieces of data of size cfs each are read from every
Matroska (Simple)Block and put at offset m * 2 * w + n * cfs of a buffer
of size h * w, where m ranges from 0 to h/2 - 1 for each Block while n
is initially zero and incremented after a Block has been parsed until it
is h, at which poin the assembled packets are output and n reset.

The highest offset is given by (h/2 - 1) * 2 * w + (h - 1) * cfs + cfs
while the destination buffer's size is given by h * w. For even h, this
leads to a buffer overflow (and potential segfault) if h * cfs > 2 * w;
for odd h, the condition is h * cfs > 3 * w.

This commit adds a check to rule this out.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Fix demuxing RealAudio 28.8
Andreas Rheinhardt [Mon, 20 Apr 2020 05:47:06 +0000 (07:47 +0200)]
avformat/matroskadec: Fix demuxing RealAudio 28.8

RealAudio 28.8 does not need or use sub_packet_size for its demuxing
and this field is therefore commonly set to zero. But since 18ca491b
the Real Audio specific demuxing is no longer applied if sub_packet_size
is zero because the codepath for cook and ATRAC3 divide by it; this made
these files undecodable.

Furthermore, since 569d18aa (merged in 2c8d876d) sub_packet_size being
zero is used as an indicator for invalid data, so that a file containing
such a track was completely skipped.

This commit fixes this by not checking sub_packet_size for RealAudio
28.8 at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Simplify check for RealAudio
Andreas Rheinhardt [Mon, 2 Dec 2019 10:04:55 +0000 (11:04 +0100)]
avformat/matroskadec: Simplify check for RealAudio

They need a special parsing mode and in order to find out whether this
mode is in use, several checks have to be performed. They can all be
combined into one: If the buffer that is only used to assemble their
packets has been allocated, use the RealAudio parsing mode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Reject sipr flavor > 3
Andreas Rheinhardt [Mon, 2 Dec 2019 09:41:12 +0000 (10:41 +0100)]
avformat/matroskadec: Reject sipr flavor > 3

Only flavors 0..3 seem to exist. E.g. rmdec.c treats any flavor > 3
as invalid data. Furthermore, we do not know how big the packets to
create ought to be given that for sipr these values are not read from
the bitstream, but from a table.

Furthermore, flavor is only used for sipr, so only check it for sipr;
rmdec.c does the same. (The old check for flavor being < 0 was
always wrong given that flavor is an int that is read via avio_rb16(),
so it has been removed completely.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mpegts: fix av_freep for dovi pointer
Limin Wang [Thu, 30 Apr 2020 13:20:28 +0000 (21:20 +0800)]
avformat/mpegts: fix av_freep for dovi pointer

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/mov: fix av_freep for dovi pointer
Limin Wang [Thu, 30 Apr 2020 13:19:11 +0000 (21:19 +0800)]
avformat/mov: fix av_freep for dovi pointer

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agofate/oggopus-demux: fix fate failure
Lynne [Fri, 1 May 2020 00:36:43 +0000 (01:36 +0100)]
fate/oggopus-demux: fix fate failure

Failure was due to the extra comment printed by libavcodec/utils.c since
side data is used to signal the skipped samples.

4 years agoavfilter/af_adelay: Check sscanf() return value
Limin Wang [Sun, 29 Mar 2020 00:08:05 +0000 (08:08 +0800)]
avfilter/af_adelay: Check sscanf() return value

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_mix: Check sscanf() return value
Limin Wang [Sun, 29 Mar 2020 01:08:13 +0000 (09:08 +0800)]
avfilter/vf_mix: Check sscanf() return value

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agooggdec: add support for proper demuxing of chained Opus files and streams
Lynne [Tue, 28 Apr 2020 11:25:46 +0000 (12:25 +0100)]
oggdec: add support for proper demuxing of chained Opus files and streams

Part of this patch is based on Paul B Mahol's patch from last year.

This also allows for single-stream parameter/codec changes.

4 years agooggdec: use ffio_ensure_seekback() to seek back on incorrect data
Lynne [Tue, 28 Apr 2020 11:55:17 +0000 (12:55 +0100)]
oggdec: use ffio_ensure_seekback() to seek back on incorrect data

This cleans up the code and simplifies it.
It also speeds up parsing since the old pb position was incorrect.

4 years agooggdec: verify page checksum
Lynne [Tue, 28 Apr 2020 11:52:11 +0000 (12:52 +0100)]
oggdec: verify page checksum

This makes decoding far more robust, since OggS, the ogg magic,
can be commonly found randomly in streams, which previously made
the demuxer think there's a new stream or a change in such.

4 years agooggdec: eliminate copies and extra buffers
Lynne [Tue, 28 Apr 2020 11:41:34 +0000 (12:41 +0100)]
oggdec: eliminate copies and extra buffers

This also makes implementing CRC checking far simpler and more robust.

4 years agoavformat/utils: change the duration to int64_t for update_initial_durations
Limin Wang [Tue, 28 Apr 2020 23:49:24 +0000 (07:49 +0800)]
avformat/utils: change the duration to int64_t for update_initial_durations

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/cbs_h265: fix writing extension_data bits
James Almer [Mon, 20 Apr 2020 18:25:58 +0000 (15:25 -0300)]
avcodec/cbs_h265: fix writing extension_data bits

We only care about the right most bit.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/v4l2_context: Log warning when all capture buffers are in userspace
Andriy Gelman [Thu, 30 Apr 2020 14:58:37 +0000 (10:58 -0400)]
avcodec/v4l2_context: Log warning when all capture buffers are in userspace

v4l2_m2m uses device memory mapped buffers to store dequeued
frames/packets (reference counted by AVBufferRef). When the reference
count drops to zero, the buffer ownership is returned back to the
device, so that they can re-filled with frames/packets.

There are some cases when all the capture buffers are in userspace
(i.e. due to internal buffering in ffmpeg). On the s5p-mfc this causes
an infinite wait when polling to dequeue the buffers, which can be
prevented by increasing the total number of buffers. This commit adds a
warning when all the capture buffers are dequeued.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavfoundation: Fix building on iOS
Martin Storsjö [Thu, 30 Apr 2020 10:34:13 +0000 (13:34 +0300)]
avfoundation: Fix building on iOS

Apparently the changes from 3c9185bf3a83395d12a987f626dbdb985eac4320
aren't enough; even with that in place, I got errors like this
when trying to build for iOS:

src/libavdevice/avfoundation.m:135:5: error:
      'AVCaptureDeviceTransportControlsPlaybackMode' is unavailable: not
      available on iOS
    AVCaptureDeviceTransportControlsPlaybackMode observed_mode;
    ^

4 years agoavfilter/af_crossfeed: make options runtime configurable
Paul B Mahol [Thu, 30 Apr 2020 10:04:27 +0000 (12:04 +0200)]
avfilter/af_crossfeed: make options runtime configurable

4 years agoavfilter/af_crossfeed: make slope configurable
Paul B Mahol [Thu, 30 Apr 2020 09:58:04 +0000 (11:58 +0200)]
avfilter/af_crossfeed: make slope configurable

4 years agoavfilter/af_crossfeed: fix calculation of alpha parameter
Paul B Mahol [Thu, 30 Apr 2020 09:44:48 +0000 (11:44 +0200)]
avfilter/af_crossfeed: fix calculation of alpha parameter

Use A in calculation.

4 years agoavfilter: add asubboost filter
Paul B Mahol [Wed, 22 Apr 2020 13:29:16 +0000 (15:29 +0200)]
avfilter: add asubboost filter

4 years agotools: fix const specifier for AVInputFormat
Josh de Kock [Wed, 29 Apr 2020 10:45:49 +0000 (11:45 +0100)]
tools: fix const specifier for AVInputFormat

Signed-off-by: Josh de Kock <josh@itanimul.li>
4 years agoavcodec/avpacket: Don't write into non-writable buffer
Andreas Rheinhardt [Wed, 12 Feb 2020 12:27:17 +0000 (13:27 +0100)]
avcodec/avpacket: Don't write into non-writable buffer

The data of an AVPacket may be a part of the data of an AVBufferRef;
Therefore av_grow_packet() doesn't reallocate if the available space in
the actual buffer is sufficient for the enlargement. But given that it
also zeroes the padding it also needs to make sure that the buffer is
actually writable; this commit implements this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hdsenc: Add explicit deinit function
Andreas Rheinhardt [Wed, 23 Oct 2019 11:46:46 +0000 (13:46 +0200)]
avformat/hdsenc: Add explicit deinit function

hdsenc already had an explicit function to free all allocations in case
of an error, but it was not marked as deinit function, so that it was
not called automatically when the AVFormatContext for muxing gets freed.

Using an explicit deinit function also makes the code cleaner by
allowing to return immediately without "goto fail".

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver
Ming Qian [Mon, 16 Mar 2020 02:02:08 +0000 (10:02 +0800)]
avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

Enqueue/dequeue of the capture buffers should continue while draining.

Reference: linux/Documentation/media/uapi/v4l/dev-decoder.rst

    "The client must continue to handle both queues independently,
     similarly to normal decode operation. This includes:
     ...
     - queuing and dequeuing CAPTURE buffers, until a buffer marked with
       the V4L2_BUF_FLAG_LAST flag is dequeued"

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/tiff: assert that raw tiff dng blit does not write over the end of a line
Michael Niedermayer [Sat, 15 Feb 2020 16:12:38 +0000 (17:12 +0100)]
avcodec/tiff: assert that raw tiff dng blit does not write over the end of a line

Found-by: 黄宁 <tsukimurarin@163.com>
Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/tiff: Check for planar DNG images
Michael Niedermayer [Sat, 15 Feb 2020 16:10:47 +0000 (17:10 +0100)]
avcodec/tiff: Check for planar DNG images

The DNG code hardcodes plane 0 at some places, so its better to disallow cases
that have more planes.

Fixes: eg_crash
Found-by: 黄宁 <tsukimurarin@163.com>
Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/tiff: Replace width overriding for bayer by assert
Michael Niedermayer [Sat, 15 Feb 2020 15:42:07 +0000 (16:42 +0100)]
avcodec/tiff: Replace width overriding for bayer by assert

This is less confusing

Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/tiff: Some checks on bpp for DNG
Michael Niedermayer [Sat, 15 Feb 2020 15:19:08 +0000 (16:19 +0100)]
avcodec/tiff: Some checks on bpp for DNG

dng spec 1.5.0.0
"BitsPerSample
Supported values are from 8 to 32 bits/sample. The depth must be the same for each sample if
SamplesPerPixel is not equal to 1."

Fixes: eg_crash
Found-by: 黄宁 <tsukimurarin@163.com>
Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/txd: Check for input size against the header size.
Michael Niedermayer [Tue, 18 Feb 2020 22:14:16 +0000 (23:14 +0100)]
avcodec/txd: Check for input size against the header size.

Fixes: Timeout (21sec -> 80ms)
Fixes: 20673/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-5177453863763968
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/svq1dec: Check that there is data left after the header
Michael Niedermayer [Tue, 18 Feb 2020 22:28:33 +0000 (23:28 +0100)]
avcodec/svq1dec: Check that there is data left after the header

Fixes: Timeout (21sec -> 255ms)
Fixes: 20709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ1_fuzzer-5085075089915904
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavc/libopenh264enc: set slice_mode option to deprecated
Linjie Fu [Wed, 29 Apr 2020 03:00:50 +0000 (11:00 +0800)]
lavc/libopenh264enc: set slice_mode option to deprecated

"slice mode" option seems to be unnecessary since it could be
determined by -slices/max_nal_size.

default:        SM_FIXEDSLCNUM_SLICE mode with cpu-number slices.
-slices N:      SM_FIXEDSLCNUM_SLICE mode with N slices.
-max_nal_size:  SM_SIZELIMITED_SLICE mode with limited size slices.

Add FF_API_OPENH264_SLICE_MODE macro to remove this option after
LIBAVCODEC_VERSION_MAJOR = 59.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolavc/libopenh264enc: prompt slice number changing inside libopenh264
Linjie Fu [Wed, 29 Apr 2020 03:00:49 +0000 (11:00 +0800)]
lavc/libopenh264enc: prompt slice number changing inside libopenh264

Libopenh264enc would set the slice according to the number of cpu cores
if uiSliceNum equals to 0 (auto) in SM_FIXEDSLCNUM_SLICE mode.

Prompt a warning for user to catch this.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolavc/libopenh264enc: add bit rate control select support
Linjie Fu [Wed, 29 Apr 2020 03:00:48 +0000 (11:00 +0800)]
lavc/libopenh264enc: add bit rate control select support

RC_BITRATE_MODE:
    set BITS_EXCEEDED to iCurrentBitsLevel and allows QP adjust
    in RcCalculatePictureQp().

RC_BUFFERBASED_MODE:
    use buffer status to adjust the video quality.

RC_TIMESTAMP_MODE:
    bit rate control based on timestamp, introduced in release 1.4.

Default to use RC_QUALITY_MODE.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolavc/libopenh264enc: add default gop size and bit rate
Linjie Fu [Wed, 29 Apr 2020 03:00:47 +0000 (11:00 +0800)]
lavc/libopenh264enc: add default gop size and bit rate

It would be 200kbps bitrate with gop size = 12 by default
which generated too many IDR frames in rather low bit rate.
The quality would be poor.

Set these default values to -1 to check whether it's specified
by user explicitly.

Use 2Mbps bitrate as nvenc sugguested, and leave gop size
untouched in libopenh264.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolavc/libopenh264enc: Add qmin/qmax support
Linjie Fu [Wed, 29 Apr 2020 03:00:46 +0000 (11:00 +0800)]
lavc/libopenh264enc: Add qmin/qmax support

Clip iMinQp/iMaxQp to (1, 51) for user specified qp range.

If not set, leave iMinQp/iMaxQp untouched and use the values (0, 51)
initialized in FillDefault(), and the QP range would be adjusted to the
defaults inside libopenh264 library according to the iUsageType, (12, 42)
for iUsageType == CAMERA_VIDEO_REAL_TIME which is default.

<https://github.com/cisco/openh264/blob/master/codec/encoder/core/src/encoder_ext.cpp#L375>

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavfilter/vf_v360: make FOV adjusted for dual fisheye too
Paul B Mahol [Wed, 29 Apr 2020 17:16:12 +0000 (19:16 +0200)]
avfilter/vf_v360: make FOV adjusted for dual fisheye too

Remove any usage of padding for this format.

4 years agoavfilter/af_amix: make weights option runtime configured
Paul B Mahol [Tue, 28 Apr 2020 10:01:04 +0000 (12:01 +0200)]
avfilter/af_amix: make weights option runtime configured

4 years agoMAINTAINERS: add myself to the general developers list
Limin Wang [Sun, 26 Apr 2020 10:50:09 +0000 (18:50 +0800)]
MAINTAINERS: add myself to the general developers list

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_v360: adjustment out_pad and in_pad maximum value to 1/10
Steven Liu [Tue, 21 Apr 2020 14:54:39 +0000 (22:54 +0800)]
avfilter/vf_v360: adjustment out_pad and in_pad maximum value to 1/10

Because not every user know about in_pad and out_pad reasonable value range
so maybe try to set 1.0, but setting 1.0 is so hugh to get an fatal error.

Suggested-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agotests/api/api-h264-slice-test: remove unused bool header
Linjie Fu [Wed, 1 Apr 2020 04:52:24 +0000 (12:52 +0800)]
tests/api/api-h264-slice-test: remove unused bool header

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Josh de Kock <josh@itanimul.li>
4 years agolibavcodec/libx264: fix reference frame computation based on level
Josh Brewster [Thu, 16 Apr 2020 20:50:29 +0000 (22:50 +0200)]
libavcodec/libx264: fix reference frame computation based on level

The current implementation allows passing levels to libavcodec as
integers (such as "31" instead of "3.1").

However, in this case, the maximum reference frame value per level was
ignored because libavcodec converted the string to 310 instead of 31.

Since libx264 has correctly parsed the level to int
(x4->params.i_level_idc), we should rely on this value instead of
attempting to parse the level string on our own.

Signed-off-by: Josh Brewster <josh.brewster@protonmail.com>
Signed-off-by: Josh de Kock <josh@itanimul.li>
4 years agolavf/mp3enc: fix ID3v1 year metadata setting issue
Jun Zhao [Mon, 20 Apr 2020 07:59:39 +0000 (15:59 +0800)]
lavf/mp3enc: fix ID3v1 year metadata setting issue

Follow the http://id3.org/ID3v1, setting the year metadata
for ID3v1.

fix #8623

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agoavformat/dashenc: use av_reallocp_array()
Limin Wang [Sun, 26 Apr 2020 09:49:20 +0000 (17:49 +0800)]
avformat/dashenc: use av_reallocp_array()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/dashenc: use local variable and avoid calculate duration multiple times
Limin Wang [Sun, 26 Apr 2020 09:49:19 +0000 (17:49 +0800)]
avformat/dashenc: use local variable and avoid calculate duration multiple times

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/dashenc: cosmetics
Limin Wang [Sun, 26 Apr 2020 09:49:18 +0000 (17:49 +0800)]
avformat/dashenc: cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/v4l2_m2m_enc: Enable frame level rate control by default
Andriy Gelman [Tue, 28 Apr 2020 16:39:39 +0000 (12:39 -0400)]
avcodec/v4l2_m2m_enc: Enable frame level rate control by default

Without this setting, bitrate and qmin/qmax options have no
effect on the s5p-mfc hardware encoder.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/v4l2_m2m_enc: Reduce log verbosity for some params
Andriy Gelman [Tue, 28 Apr 2020 16:39:19 +0000 (12:39 -0400)]
avcodec/v4l2_m2m_enc: Reduce log verbosity for some params

Currently the user gets unhelpful warnings when some default parameters
are not supported by the device. The verbosity of these log messages has
been changed to AV_LOG_DEBUG.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoswscale/vscale: Increase type strictness
Andreas Rheinhardt [Sun, 26 Apr 2020 06:52:29 +0000 (08:52 +0200)]
swscale/vscale: Increase type strictness

libswscale/vscale.c makes extensive use of function pointers and in
doing so it converts these function pointers to and from a pointer to
void. Yet this is actually against the C standard:
C90 only guarantees that one can convert a pointer to any incomplete
type or object type to void* and back with the result comparing equal
to the original which makes pointers to void generic pointers to
incomplete or object type. Yet C90 lacks a generic function pointer
type.
C99 additionally guarantees that a pointer to a function of one type may
be converted to a pointer to a function of another type with the result
and the original comparing equal when converting back.
This makes any function pointer type a generic function pointer type.
Yet even this does not make pointers to void generic function pointers.

Both GCC and Clang emit warnings for this when in pedantic mode.

This commit fixes this by using a union that can hold one member of any
of the required function pointer types to store the function pointer.
This works even for C90.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/nvenc: add hardware config metadata
Mark Thompson [Mon, 13 Apr 2020 15:33:18 +0000 (16:33 +0100)]
avcodec/nvenc: add hardware config metadata

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 years agoavformat: only allow a single bitstream filter when muxing
Marton Balint [Sat, 18 Apr 2020 08:49:54 +0000 (10:49 +0200)]
avformat: only allow a single bitstream filter when muxing

Current muxers only use a single bitstream filter, so there is no need to
maintain code which operates on a list of bitstream filters. When multiple
bitstream filters are needed muxers can simply use a list bitstream filter.

If there is a use case in the future when different bitstream filters should be
added at subsequent packets then a new API possibly involving reconfiguring the
list bitstream filter can be added knowing the exact requirements.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agofate: hevc: Skip a few large testcases if large tests are disabled
Martin Storsjö [Thu, 23 Apr 2020 07:15:03 +0000 (10:15 +0300)]
fate: hevc: Skip a few large testcases if large tests are disabled

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agofate: Skip the dnxhd-uhd-hr-sq tests of large tests are disabled
Martin Storsjö [Thu, 23 Apr 2020 07:13:06 +0000 (10:13 +0300)]
fate: Skip the dnxhd-uhd-hr-sq tests of large tests are disabled

These tests are also in the same size range as the previously
skipped 2k and 4k tests.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoffmpeg: Remove the hw_device_ctx global
Mark Thompson [Mon, 13 Apr 2020 15:33:21 +0000 (16:33 +0100)]
ffmpeg: Remove the hw_device_ctx global

The ad-hoc libmfx setup code is the only place its still used, so move it
into that file.

4 years agoffmpeg: Use hardware config metadata with encoders
Mark Thompson [Mon, 13 Apr 2020 15:33:20 +0000 (16:33 +0100)]
ffmpeg: Use hardware config metadata with encoders

This can support encoders which want frames and/or device contexts.  For
the device case, it currently picks the first initialised device of the
desired type to give to the encoder - a new option would be needed if it
were necessary to choose between multiple devices of the same type.

4 years agoffmpeg: Make filter hardware device selection clearer
Mark Thompson [Mon, 13 Apr 2020 15:33:19 +0000 (16:33 +0100)]
ffmpeg: Make filter hardware device selection clearer

Also move it into a dedicated function in the hardware file.

4 years agolavc/vaapi_encode: Add hardware config metadata
Mark Thompson [Mon, 13 Apr 2020 15:33:17 +0000 (16:33 +0100)]
lavc/vaapi_encode: Add hardware config metadata

These encoders all accept VAAPI surfaces in a hardware frames context.

4 years agolavc/qsvenc: Add hardware config metadata
Mark Thompson [Mon, 13 Apr 2020 15:33:16 +0000 (16:33 +0100)]
lavc/qsvenc: Add hardware config metadata

All of these encoders can accept libmfx surfaces directly in a hardware
frames context, or they can accept software frames if a suitable device
is supplied to use.

4 years agolavc: Extend hardware config metadata to encoders
Mark Thompson [Mon, 13 Apr 2020 15:33:15 +0000 (16:33 +0100)]
lavc: Extend hardware config metadata to encoders

4 years agolavc: Rename hwaccel.h to hwconfig.h
Mark Thompson [Mon, 13 Apr 2020 15:33:14 +0000 (16:33 +0100)]
lavc: Rename hwaccel.h to hwconfig.h

This already applied to decoders as well as hwaccels, and adding encoder
support was going to make the name even more inaccurate.

4 years agoavcodec/cbs_h265_syntax_template: Check num_negative/positive_pics when inter_ref_pic...
Michael Niedermayer [Sat, 4 Apr 2020 22:11:15 +0000 (00:11 +0200)]
avcodec/cbs_h265_syntax_template: Check num_negative/positive_pics when inter_ref_pic_set_prediction_flag is set

Fixes: out of array access
Fixes: 20446/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5707770718584832
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/intrax8: Check for end of bitstream in ff_intrax8_decode_picture()
Michael Niedermayer [Wed, 5 Feb 2020 23:33:40 +0000 (00:33 +0100)]
avcodec/intrax8: Check for end of bitstream in ff_intrax8_decode_picture()

Fixes: Timeout (105sec -> 1sec)
Fixes: 20479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5769846937878528
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/movenc: cosmetics
Limin Wang [Sat, 25 Apr 2020 14:29:03 +0000 (22:29 +0800)]
avformat/movenc: cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_pixscope: also show standard deviation of zoomed area
Paul B Mahol [Sun, 26 Apr 2020 10:15:12 +0000 (12:15 +0200)]
avfilter/vf_pixscope: also show standard deviation of zoomed area

4 years agoavcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()
Michael Niedermayer [Fri, 24 Apr 2020 20:55:55 +0000 (22:55 +0200)]
avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()

Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int32_t' (aka 'int')
Fixes: 21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248
Change to int16_t suggested by Lynne

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/bsf: simplify the code
Limin Wang [Sat, 18 Apr 2020 04:17:16 +0000 (12:17 +0800)]
avcodec/bsf: simplify the code

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavfilter/f_interleave: no need to check for inlink eof if non-empty queue
Paul B Mahol [Sat, 25 Apr 2020 11:35:22 +0000 (13:35 +0200)]
avfilter/f_interleave: no need to check for inlink eof if non-empty queue

Also set state to ready if there is any inlink with queued frame.

4 years agoavfilter/f_interleave: make sure that all frames in inlink queue are used
Paul B Mahol [Sat, 25 Apr 2020 11:07:13 +0000 (13:07 +0200)]
avfilter/f_interleave: make sure that all frames in inlink queue are used

4 years agoavfilter/f_interleave: add duration option
Paul B Mahol [Sat, 25 Apr 2020 10:35:22 +0000 (12:35 +0200)]
avfilter/f_interleave: add duration option

4 years agoffplay: set stream_index to -1 earlier to prevent segfault
Peter Ross [Sat, 25 Apr 2020 01:25:15 +0000 (11:25 +1000)]
ffplay: set stream_index to -1 earlier to prevent segfault

Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/vp9: prevent null pointer use on init_frames() failure
Peter Ross [Sat, 25 Apr 2020 01:25:15 +0000 (11:25 +1000)]
avcodec/vp9: prevent null pointer use on init_frames() failure

Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: James Almer <jamrial@gmail.com>