]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoavfilter/af_headphone: Avoid allocating array
Andreas Rheinhardt [Wed, 26 Aug 2020 04:51:18 +0000 (06:51 +0200)]
avfilter/af_headphone: Avoid allocating array

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Don't allocate unused element in array
Andreas Rheinhardt [Wed, 26 Aug 2020 04:24:51 +0000 (06:24 +0200)]
avfilter/af_headphone: Don't allocate unused element in array

The headphone filter uses an array with as many elements as the
filter has inputs to store some per-input information; yet actually it
only stores information for all inputs except the very first one (which
is special for this filter). Therefore this commit modifies the code to
remove this unused element.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Only keep one AVFrame at a time
Andreas Rheinhardt [Wed, 26 Aug 2020 04:10:47 +0000 (06:10 +0200)]
avfilter/af_headphone: Only keep one AVFrame at a time

Despite the headphone filter only using one AVFrame at a time, it kept
an array each of whose entries contained a pointer to an AVFrame at all
times; the pointers were mostly NULL. This commit instead replaces them
by using a single pointer to an AVFrame on the stack of the only
function that actually uses them.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Avoid intermediate buffer III
Andreas Rheinhardt [Tue, 25 Aug 2020 13:08:31 +0000 (15:08 +0200)]
avfilter/af_headphone: Avoid intermediate buffer III

The headphone filter allocates a pair of buffers to be used as
intermediate buffers lateron: Before every use they are zeroed, then
some elements of the buffer are set and lateron the complete buffers are
copied into another, bigger buffer. These intermediate buffers are
unnecessary as the data can be directly written into the bigger buffer.
Furthermore, the whole buffer has been zeroed initially and because no
piece of this buffer is set twice (due to the fact that duplicate
channel map entries are skipped), it is unnecessary to rezero the part
of the big buffer that is about to be written to.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Simplify finding channel index
Andreas Rheinhardt [Thu, 27 Aug 2020 05:28:55 +0000 (07:28 +0200)]
avfilter/af_headphone: Simplify finding channel index

Before this commit, the headphone filter called
av_channel_layout_extract_channel() in a loop in order to find out
the index of a channel (given via its AV_CH_* value) in a channel layout.
This commit changes this to av_get_channel_layout_channel_index()
instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Fix channel assignment
Andreas Rheinhardt [Wed, 26 Aug 2020 02:24:26 +0000 (04:24 +0200)]
avfilter/af_headphone: Fix channel assignment

The documentation of the map argument of the headphone filter states:

"Set mapping of input streams for convolution. The argument is a
’|’-separated list of channel names in order as they are given as
additional stream inputs for filter."

Yet this has not been honoured at all. Instead for the kth given HRIR
channel pair it was checked whether there was a kth mapping and if the
channel position so given was present in the channel layout of the main
input; if so, then the given HRIR channel pair was matched to the kth
channel of the main input. It should actually have been matched to the
channel given by the kth mapping. A consequence of the current algorithm
is that if N additional HRIR channel pairs are given, a permutation of
the first N entries of the mapping does not affect the output at all.

The old code might even set arrays belonging to streams that don't exist
(i.e. whose index is >= the number of channels of the main input
stream); these parts were not read lateron at all. The new code doesn't
do this any longer and therefore the number of elements of some of the
allocated arrays has been reduced (in case the number of mappings was
bigger than the number of channels of the first input stream).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Avoid intermediate buffers II
Andreas Rheinhardt [Tue, 25 Aug 2020 13:35:23 +0000 (15:35 +0200)]
avfilter/af_headphone: Avoid intermediate buffers II

When the headphone filter is configured to perform its processing in the
frequency domain, it allocates (among other things) two pairs of
buffers, all of the same size. One pair is used to store data in it
during the initialization of the filter; the other pair is only
allocated lateron. It is zero-initialized and yet its data is
immediately overwritten by the content of the other pair of buffers
mentioned above; the latter pair is then freed.

This commit eliminates the pair of intermediate buffers.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Avoid intermediate buffers I
Andreas Rheinhardt [Tue, 25 Aug 2020 13:31:04 +0000 (15:31 +0200)]
avfilter/af_headphone: Avoid intermediate buffers I

The headphone filter has two modes; in one of them (say A), it needs
certain buffers to store data. But it allocated them in both modes.
Furthermore when in mode A it also allocated intermediate buffers of the
same size, initialized them, copied their contents into the permanent
buffers and freed them.

This commit changes this: The permanent buffer is only allocated when
needed; the temporary buffer has been completely avoided.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Remove delay fields
Andreas Rheinhardt [Tue, 25 Aug 2020 12:57:31 +0000 (14:57 +0200)]
avfilter/af_headphone: Remove delay fields

They seem to exist for an option that was never implemented.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Remove unused arrays
Andreas Rheinhardt [Tue, 25 Aug 2020 12:47:09 +0000 (14:47 +0200)]
avfilter/af_headphone: Remove unused arrays

The delay arrays were never properly initialized, only zero-initialized;
furthermore these arrays duplicate fields in the headphone_inputs
struct. So remove them.
(Btw: The allocations for them have not been checked.)

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Avoid duplicating string needlessly
Andreas Rheinhardt [Mon, 24 Aug 2020 21:03:45 +0000 (23:03 +0200)]
avfilter/af_headphone: Avoid duplicating string needlessly

The string given by an AVOption that contains the channel assignment
is used only once; ergo it doesn't matter that parsing the string via
av_strtok() is destructive. There is no need to make a copy.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Simplify parsing channel mapping string
Andreas Rheinhardt [Thu, 27 Aug 2020 01:14:02 +0000 (03:14 +0200)]
avfilter/af_headphone: Simplify parsing channel mapping string

When parsing the channel mapping string (a string containing '|'
delimited tokens each of which is supposed to contain a channel name
like "FR"), the old code would at each step read up to seven uppercase
characters from the input string and give this to
av_get_channel_layout() to parse. The returned layout is then checked
for being a layout with a single channel set by computing its logarithm.

Besides being overtly complicated this also has the drawback of relying
on the assumption that every channel name consists of at most seven
uppercase letters only; but said assumption is wrong: The abbreviation
of the second low frequency channel is LFE2. Furthermore it treats
garbage like "FRfoo" as valid channel.

This commit changes this by using av_get_channel_layout() directly;
furthermore, av_get_channel_layout_nb_channels() (which uses popcount)
is used to find out the number of channels instead of the custom code
to calculate the logarithm.

(As a consequence, certain other formats to specify the channel layouts
are now accepted (like the hex versions of av_get_channel_layout()); but
this is actually not bad at all.)

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Use uint64_t for channel mapping
Andreas Rheinhardt [Mon, 24 Aug 2020 20:17:02 +0000 (22:17 +0200)]
avfilter/af_headphone: Use uint64_t for channel mapping

The headphone filter has an option for the user to specify an assignment
of inputs to channels (or from pairs of channels of the second input to
channels). Up until now, these channels were stored in an int containing
the logarithm of the channel layout. Yet it is not the logarithm that is
used lateron and so a retransformation was necessary. Therefore this
commit simply stores the uint64_t as is, avoiding the retransformation.

This also has the advantage that unset channels (whose corresponding
entry is zero) can't be mistaken for valid channels any more; the old
code had to initialize the channels to -1 to solve this problem and had
to check for whether a channel is set before the retransformation
(because 1 << -1 is UB).

The only downside of this approach is that the size of the context
increases (by 256 bytes); but this is not exceedingly much.

Finally, the array has been moved to the end of the context; it is only
used a few times during the initialization process and moving it
decreased the offsets of lots of other entries, reducing codesize.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Only attempt once to init coeffs
Andreas Rheinhardt [Tue, 25 Aug 2020 13:00:52 +0000 (15:00 +0200)]
avfilter/af_headphone: Only attempt once to init coeffs

The headphone filter does most of its initialization after its init
function, because it can perform certain tasks only after all but its
first input streams have reached eof. When this happens, it allocates
certain buffers and errors out if an allocation fails.

Yet the filter didn't check whether some of these buffers already exist
(which may happen if an earlier attempt has been interrupted in the
middle (due to an allocation error)) in which case the old buffers leak.

This commit makes sure that initializing the buffers is only attempted
once; if not successfull at the first attempt, future calls to the
filter will error out. Trying to support resuming initialization doesn't
seem worthwhile.

Notice that some allocations were freed before a new allocation was
performed; yet this effort was incomplete. Said code has been removed.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Combine several loops when checking for EOF
Andreas Rheinhardt [Fri, 28 Aug 2020 12:49:49 +0000 (14:49 +0200)]
avfilter/af_headphone: Combine several loops when checking for EOF

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Fix stack buffer overflow
Andreas Rheinhardt [Wed, 26 Aug 2020 08:11:38 +0000 (10:11 +0200)]
avfilter/af_headphone: Fix stack buffer overflow

The number of channels can be up to 64, not only 16.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Don't overrun array
Andreas Rheinhardt [Mon, 24 Aug 2020 04:34:17 +0000 (06:34 +0200)]
avfilter/af_headphone: Don't overrun array

The headphone filter stores the channel position of the ith HRIR stream
in the ith element of an array of 64 elements; but because there is no
check for duplicate channels, it is easy to write beyond the end of the
array by simply repeating channels.

This commit adds a check for duplicate channels to rule this out.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Fix segfault when using very short streams
Andreas Rheinhardt [Fri, 28 Aug 2020 08:56:20 +0000 (10:56 +0200)]
avfilter/af_headphone: Fix segfault when using very short streams

When the headphone filter does its processing in the time domain,
the lengths of the buffers involved are determined by three parameters,
only two of which are relevant here: ir_len and air_len. The former is
the length (in samples) of the longest HRIR input stream and the latter
is the smallest power-of-two bigger than ir_len.

Using optimized functions to calculate the convolution places
restrictions on the alignment of the length of the vectors whose scalar
product is calculated. Therefore said length, namely ir_len, is aligned
on 32; but the number of elements of the buffers used is given by air_len
and for ir_len < 16 a buffer overflow happens.

This commit fixes this by ensuring that air_len is always >= 32 if
processing happens in the time domain.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Check for the existence of samples
Andreas Rheinhardt [Fri, 28 Aug 2020 08:37:46 +0000 (10:37 +0200)]
avfilter/af_headphone: Check for the existence of samples

Not providing any samples makes no sense at all. And if no samples
were provided for one of the HRIR streams, one would either run into
an av_assert1 in ff_inlink_consume_samples() or into a segfault in
take_samples() in avfilter.c.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Remove always true check
Andreas Rheinhardt [Fri, 28 Aug 2020 12:22:43 +0000 (14:22 +0200)]
avfilter/af_headphone: Remove always true check

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/af_headphone: Don't use uninitialized buffer in log message
Andreas Rheinhardt [Mon, 24 Aug 2020 04:08:56 +0000 (06:08 +0200)]
avfilter/af_headphone: Don't use uninitialized buffer in log message

This buffer was supposed to be initialized by sscanf(input, "%7[A-Z]%n",
buf, &len), yet if the first input character is not in the A-Z range,
buf is not touched (in particular it needn't be zero-terminated if the
failure happened when parsing the first channel and it still contains
the last channel name if the failure happened when one channel name
could be successfully parsed). This is treated as error in which case
buf is used directly in the log message. This commit fixes this by
actually using the string that could not be matched in the log message
instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agodnn_backend_native_layer_conv2d.c:Add mutithread function
Xu Jun [Sun, 6 Sep 2020 12:28:53 +0000 (20:28 +0800)]
dnn_backend_native_layer_conv2d.c:Add mutithread function

Use pthread to multithread dnn_execute_layer_conv2d.
Can be tested with command "./ffmpeg_g -i input.png -vf \
format=yuvj420p,dnn_processing=dnn_backend=native:model= \
espcn.model:input=x:output=y:options=conv2d_threads=23 \
 -y sr_native.jpg -benchmark"

before patch: utime=11.238s stime=0.005s rtime=11.248s
after patch:  utime=20.817s stime=0.047s rtime=1.051s
on my 3900X 12c24t @4.2GHz

About the increase of utime, it's because that CPU HyperThreading
technology makes logical cores twice of physical cores while cpu's
counting performance improves less than double. And utime sums
all cpu's logical cores' runtime. As a result, using threads num
near cpu's logical core's number will double utime, while reduce
rtime less than half for HyperThreading CPUs.

Signed-off-by: Xu Jun <xujunzz@sjtu.edu.cn>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agodnn_backend_native.c: parse options in native backend
Xu Jun [Sun, 6 Sep 2020 12:28:51 +0000 (20:28 +0800)]
dnn_backend_native.c: parse options in native backend

Signed-off-by: Xu Jun <xujunzz@sjtu.edu.cn>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agoavcodec/libopusenc: add option to set inband FEC
Gyan Doshi [Sun, 6 Sep 2020 06:54:46 +0000 (12:24 +0530)]
avcodec/libopusenc: add option to set inband FEC

4 years agoffplay: fix autoexit doesn't work in the case of pb->error
Zhao Zhili [Wed, 26 Aug 2020 16:44:56 +0000 (00:44 +0800)]
ffplay: fix autoexit doesn't work in the case of pb->error

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoRevert "avfilter/src_movie: switch to activate"
Nicolas George [Tue, 8 Sep 2020 12:57:53 +0000 (14:57 +0200)]
Revert "avfilter/src_movie: switch to activate"

This reverts commit abc884bcc005c450a34e56cd1f4b8b6fa17ea768.

This patch was pushed without actual review.
An actual review would have revealed that the switch to activate
was not done correctly because the logic between request_frame()
and frame_wanted is not as direct with filters with multiple
outputs than with a single output.

4 years agolavfi/vsrc_testsrc: switch to activate.
Nicolas George [Thu, 25 Jun 2020 18:45:53 +0000 (20:45 +0200)]
lavfi/vsrc_testsrc: switch to activate.

Allow to set the EOF timestamp.

Also: doc/filters/testsrc*: specify the rounding of the duration option.

The changes in the ref files are right.

For filter-fps-down, the graph is testsrc2=r=7:d=3.5,fps=3.
3.5=24.5/7, so the EOF of testsrc2 will have PTS 25/7.
25/7=(10+5/7)/3, so the EOF PTS for fps should be 11/7,
and the output should contain a frame at PTS 10.

For filter-fps-up, the graph is testsrc2=r=3:d=2,fps=7,
for filter-fps-up-round-down and filter-fps-up-round-up
it is the same with explicit rounding options.
But there is no rounding: testsrc2 produces exactly 6 frames
and 2 seconds, fps converts it into exactly 14 frames.

The tests should probably be adjusted to restore them to
a useful coverage.

4 years agodoc: include general in *-all pages.
Nicolas George [Sat, 22 Aug 2020 10:41:15 +0000 (12:41 +0200)]
doc: include general in *-all pages.

4 years agodoc/general: move contents into a separate file.
Nicolas George [Sat, 22 Aug 2020 10:25:42 +0000 (12:25 +0200)]
doc/general: move contents into a separate file.

It will allow to include it.

4 years agodoc/texi2pod: support @float.
Nicolas George [Sat, 22 Aug 2020 10:40:56 +0000 (12:40 +0200)]
doc/texi2pod: support @float.

4 years agolavfi/formats: more logical testing of inputs and outputs.
Nicolas George [Sun, 23 Aug 2020 09:52:16 +0000 (11:52 +0200)]
lavfi/formats: more logical testing of inputs and outputs.

ff_set_common_formats() is currently only called after
graph_check_validity(), guaranteeing that inputs and outputs
are connected.
If we want to support configuring partially-connected graphs,
we will have a lot of redesign to do anyway.

Fix CID 1466262 / 1466263.

4 years agofate: disable automatic conversions on many tests.
Nicolas George [Fri, 14 Aug 2020 16:58:27 +0000 (18:58 +0200)]
fate: disable automatic conversions on many tests.

Explicitly insert the scale or aresample filter where it would
have been inserted by the negotiation.
Re-enable conversions if it cannot be done easily.

If a conversion is needed in a test, we want to know about it.
If the negotiation changes and makes new conversion necessary,
we want to know about it even more.

4 years agoffmpeg: add auto_conversion_filters option.
Nicolas George [Fri, 14 Aug 2020 11:06:34 +0000 (13:06 +0200)]
ffmpeg: add auto_conversion_filters option.

4 years agolavfi/buffersink: remove redundant channel layouts.
Nicolas George [Fri, 14 Aug 2020 08:53:38 +0000 (10:53 +0200)]
lavfi/buffersink: remove redundant channel layouts.

The channel_layouts and channel_counts options set what buffersink
is supposed to accept. If channel_counts contains 2, then stereo is
already accepted, there is no point in having it in channel_layouts
too. This was not properly documented until now, so only print a
warning.

4 years agolavfi: check the validity of formats lists.
Nicolas George [Thu, 13 Aug 2020 11:18:15 +0000 (13:18 +0200)]
lavfi: check the validity of formats lists.

Part of the code expects valid lists, in particular no duplicates.
These tests allow to catch bugs in filters (unlikely but possible)
and to give a clear message when the error comes from the user
((a)formats) or the application (buffersink).

If we decide to switch to a more efficient merging algorithm,
possibly sorting the lists, these functions will be the preferred
place for pre-processing, and can be renamed accordingly.

4 years agolavfi/formats: simplify a macro parameters.
Nicolas George [Thu, 13 Aug 2020 09:59:19 +0000 (11:59 +0200)]
lavfi/formats: simplify a macro parameters.

4 years agolavfi: regroup formats lists in a single structure.
Nicolas George [Mon, 24 Aug 2020 10:16:34 +0000 (12:16 +0200)]
lavfi: regroup formats lists in a single structure.

It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)

4 years agoavformat/electronicarts: change non failure return of read_header() to 0
Michael Niedermayer [Mon, 7 Sep 2020 22:06:53 +0000 (00:06 +0200)]
avformat/electronicarts: change non failure return of read_header() to 0

This matches the documentation, but makes no functional difference

Found-by: James Almer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/electronicarts: Check if there are any streams
Michael Niedermayer [Sun, 6 Sep 2020 22:09:33 +0000 (00:09 +0200)]
avformat/electronicarts: Check if there are any streams

Fixes: Assertion failure (invalid stream index)
Fixes: 25120/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6565251898933248
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 agotools/target_dec_fuzzer: Adjust threshold for WMV3IMAGE
Michael Niedermayer [Sat, 5 Sep 2020 21:20:09 +0000 (23:20 +0200)]
tools/target_dec_fuzzer: Adjust threshold for WMV3IMAGE

Fixes: Timeout (1131sec -> 1sec)
Fixes: 24727/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5754167793287168
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/ffwavesynth: Fix integer overflow in wavesynth_synth_sample / WS_SINE
Michael Niedermayer [Sat, 5 Sep 2020 15:58:53 +0000 (17:58 +0200)]
avcodec/ffwavesynth: Fix integer overflow in wavesynth_synth_sample / WS_SINE

Fixes: signed integer overflow: -1429092 * -32596 cannot be represented in type 'int'
Fixes: 24419/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5157849974702080
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoconfigure: Add additional glslang libraries to make linking work
Philip Langdale [Mon, 17 Aug 2020 23:19:39 +0000 (16:19 -0700)]
configure: Add additional glslang libraries to make linking work

The latest builds of glslang introduce new libraries that need to be
linked for all symbols to be fully resolved.

This change will break building against older installations of glslang
and it's very hard to tell them apart as the library change upstream
was not accompanied by any version bump and no official release has
been made with this change it - just lots of people packaging up git
snapshots. So, apologies in advance.

4 years agoavfilter/vf_nnedi: use av_fopen_utf8()
Paul B Mahol [Mon, 7 Sep 2020 17:11:55 +0000 (19:11 +0200)]
avfilter/vf_nnedi: use av_fopen_utf8()

4 years agoavfilter/vf_lut3d: support remaping negative values in the prelut
Mark Reid [Sat, 5 Sep 2020 21:13:01 +0000 (14:13 -0700)]
avfilter/vf_lut3d: support remaping negative values in the prelut

4 years agofate: add wav chapters test
Paul B Mahol [Fri, 4 Sep 2020 18:45:53 +0000 (20:45 +0200)]
fate: add wav chapters test

4 years agoavcodec/jpegls: Remove unused structure
Andreas Rheinhardt [Fri, 4 Sep 2020 14:17:36 +0000 (16:17 +0200)]
avcodec/jpegls: Remove unused structure

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/argo_asf: fix handling of v1.1 files
Zane van Iperen [Sat, 5 Sep 2020 11:30:12 +0000 (21:30 +1000)]
avformat/argo_asf: fix handling of v1.1 files

Version 1.1 (FX Fighter) files all have a sample rate of 44100
in the header, but only play back correctly at 22050.

Force the sample rate to 22050 when reading, and restrict it
when muxing.

4 years agoavdevice/lavfi: Remove redundant av_packet_unref()
Andreas Rheinhardt [Sun, 30 Aug 2020 05:12:47 +0000 (07:12 +0200)]
avdevice/lavfi: Remove redundant av_packet_unref()

Since bae8844e35147f92e612a9e0b44e939a293e5bc9, the AVPacket that is
intended to be used to return the demuxed packet is automatically
unreferenced when the demuxer returns an error. This makes an
av_packet_unref() in the lavfi demuxer redundant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavdevice/lavfi: Use av_packet_pack_dictionary() to pack dictionary
Andreas Rheinhardt [Sun, 30 Aug 2020 05:02:16 +0000 (07:02 +0200)]
avdevice/lavfi: Use av_packet_pack_dictionary() to pack dictionary

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agotiff: remove tiff type check for ICC profiles
Lynne [Sat, 5 Sep 2020 19:07:33 +0000 (20:07 +0100)]
tiff: remove tiff type check for ICC profiles

Although the ICC specifications say to check for this, libtiff doesn't
and neither does any other TIFF implementation, and the TIFF specs
say that Photoshop has a different way to encapsulate ICC profiles,
and are asking for advice on how to deal with it.

So basically, photoshop puts a different type than what's specified,
no other implementation checks for this, we do because we tried to
follow the specs although its harmless to not, and ran into this bug
because we didn't know about it.

4 years agoavcodec/pixlet: postprocess luma using precalculated lut
Paul B Mahol [Sun, 6 Sep 2020 11:44:52 +0000 (13:44 +0200)]
avcodec/pixlet: postprocess luma using precalculated lut

Realtime decoding speed raises from 1.08 to 1.84 for
1504x846, 25391 kb/s, 24 fps video.

4 years agoavcodec/vp9dsp_template: Fix integer overflow in iadst8_1d()
Michael Niedermayer [Sun, 21 Jun 2020 22:24:55 +0000 (00:24 +0200)]
avcodec/vp9dsp_template: Fix integer overflow in iadst8_1d()

Fixes: signed integer overflow: 998938090 + 1169275991 cannot be represented in type 'int'
Fixes: 23411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-4644692330545152
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/avidec: Fix io_fsize overflow
Michael Niedermayer [Sun, 21 Jun 2020 22:09:05 +0000 (00:09 +0200)]
avformat/avidec: Fix io_fsize overflow

Fixes: signed integer overflow: 7958120835074169528 * 9 cannot be represented in type 'long long'
Fixes: 23382/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6230683226996736
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/tdsc: Only reallocate deflatebuffer if its size changed
Michael Niedermayer [Thu, 18 Jun 2020 10:26:08 +0000 (12:26 +0200)]
avcodec/tdsc: Only reallocate deflatebuffer if its size changed

Fixes: Timeout (47sec -> 35msec)
Fixes: 23375/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-5633949497032704
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/jpeglsenc: Remove redundant av_packet_unref()
Andreas Rheinhardt [Thu, 3 Sep 2020 17:44:44 +0000 (19:44 +0200)]
avcodec/jpeglsenc: Remove redundant av_packet_unref()

If encoding fails, the AVPacket that ought to contain the encoded packet
is already unreferenced generically.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/notchlc: simplify reading le16 in lz4_decompress
Paul B Mahol [Sat, 5 Sep 2020 11:00:43 +0000 (13:00 +0200)]
avcodec/notchlc: simplify reading le16 in lz4_decompress

4 years agoavformat/dashdec: drop arbitrary DASH manifest size limit
Jan Ekström [Thu, 3 Sep 2020 16:50:08 +0000 (19:50 +0300)]
avformat/dashdec: drop arbitrary DASH manifest size limit

Currently the utilized AVBPrint API is internally limited to unsigned
integers, so if we limit the file size as well as the amount to read
to UINT_MAX - 1, we do not require additional limiting to be performed
on the values.

This change is based on the fact that initially the 8*1024 value added
in 96d70694aea64616c68db8be306c159c73fb3980 was only for the case where
the file size was not known. It was not a maximum file size limit.

In 29121188983932f79aef8501652630d322a9974c this was reworked to be
a maximum manifest file size limit, while its commit message appears
to only note that it added support for larger manifest file sizes.

This should enable various unfortunately large MPEG-DASH manifests,
such as Youtube's multi-megabyte live stream archives to load up
as well as bring back the original intent of the logic.

4 years agolavf/img2dec: Auto-detect Kodak Photo CD image files.
Carl Eugen Hoyos [Sat, 5 Sep 2020 08:45:52 +0000 (10:45 +0200)]
lavf/img2dec: Auto-detect Kodak Photo CD image files.

4 years agoavcodec/dxtory: add frame threads support
Paul B Mahol [Sat, 5 Sep 2020 08:31:03 +0000 (10:31 +0200)]
avcodec/dxtory: add frame threads support

4 years agoavcodec/dxtory: add missed rgb555/rgb565 formats for vflip case
Paul B Mahol [Thu, 3 Sep 2020 22:29:08 +0000 (00:29 +0200)]
avcodec/dxtory: add missed rgb555/rgb565 formats for vflip case

4 years agoavcodec/dxtory: support subsampled formats with non-aligned size
Paul B Mahol [Thu, 3 Sep 2020 16:59:13 +0000 (18:59 +0200)]
avcodec/dxtory: support subsampled formats with non-aligned size

Also unbreak decoding after 6e1a167c556

4 years agoavcodec/photocd: Remove set-but-unused variables
Andreas Rheinhardt [Fri, 4 Sep 2020 19:46:09 +0000 (21:46 +0200)]
avcodec/photocd: Remove set-but-unused variables

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/mobiclip: Fix mixed declarations and code
Andreas Rheinhardt [Fri, 4 Sep 2020 19:31:58 +0000 (21:31 +0200)]
avcodec/mobiclip: Fix mixed declarations and code

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/binkaudio: Avoid allocation for array
Andreas Rheinhardt [Fri, 4 Sep 2020 14:52:49 +0000 (16:52 +0200)]
avcodec/binkaudio: Avoid allocation for array

The array in question can not be too large (only 26 elements), so it can
simply be put on the context.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/binkaudio: Remove unused array from context
Andreas Rheinhardt [Fri, 4 Sep 2020 14:42:28 +0000 (16:42 +0200)]
avcodec/binkaudio: Remove unused array from context

Unused since 7bfd1766d1c18f07b0a2dd042418a874d49ea60d.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/binkaudio: Don't use static storage for context-dependent data
Andreas Rheinhardt [Fri, 4 Sep 2020 14:16:15 +0000 (16:16 +0200)]
avcodec/binkaudio: Don't use static storage for context-dependent data

Move it to the context instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/bink: Only keep what is used from HpelDSPContext
Andreas Rheinhardt [Fri, 4 Sep 2020 15:29:28 +0000 (17:29 +0200)]
avcodec/bink: Only keep what is used from HpelDSPContext

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/bink: Combine allocations of arrays into one
Andreas Rheinhardt [Fri, 4 Sep 2020 16:30:22 +0000 (18:30 +0200)]
avcodec/bink: Combine allocations of arrays into one

Saves allocations, checks for the allocations as well as frees.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/bink: Fix memleak upon init failure
Andreas Rheinhardt [Fri, 4 Sep 2020 15:49:16 +0000 (17:49 +0200)]
avcodec/bink: Fix memleak upon init failure

The init function first allocates an AVFrame and then some buffers; if
one of the buffers couldn't be allocated, the AVFrame leaks. Solve this
by setting the FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/asrc_anullsrc: remove not useful function
Paul B Mahol [Fri, 4 Sep 2020 17:16:57 +0000 (19:16 +0200)]
avfilter/asrc_anullsrc: remove not useful function

4 years agoavfilter/vsrc_gradients: switch to activate
Paul B Mahol [Fri, 4 Sep 2020 16:50:57 +0000 (18:50 +0200)]
avfilter/vsrc_gradients: switch to activate

Allow to set the EOF timestamp.

4 years agoavfilter/asrc_anullsrc: switch to activate
Paul B Mahol [Fri, 4 Sep 2020 16:39:27 +0000 (18:39 +0200)]
avfilter/asrc_anullsrc: switch to activate

Allow to set the EOF timestamp.

4 years agoavfilter/asrc_anullsrc: add support to set output duration
Paul B Mahol [Fri, 4 Sep 2020 16:30:46 +0000 (18:30 +0200)]
avfilter/asrc_anullsrc: add support to set output duration

4 years agoavfilter/vf_alphamerge: use framesync
Paul B Mahol [Sun, 30 Aug 2020 21:07:17 +0000 (23:07 +0200)]
avfilter/vf_alphamerge: use framesync

4 years agoavfilter/src_movie: switch to activate
Paul B Mahol [Mon, 31 Aug 2020 17:10:43 +0000 (19:10 +0200)]
avfilter/src_movie: switch to activate

Allow to set the EOF timestamp.

4 years agoavfilter/af_arnndn: reduce size of second_check[] table
Paul B Mahol [Fri, 4 Sep 2020 15:39:18 +0000 (17:39 +0200)]
avfilter/af_arnndn: reduce size of second_check[] table

4 years agoavformat/yuv4mpegenc: Add const where appropriate
Andreas Rheinhardt [Fri, 4 Sep 2020 10:46:09 +0000 (12:46 +0200)]
avformat/yuv4mpegenc: Add const where appropriate

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/yuv4mpegenc: Simplify writing global and packet headers
Andreas Rheinhardt [Fri, 4 Sep 2020 10:36:41 +0000 (12:36 +0200)]
avformat/yuv4mpegenc: Simplify writing global and packet headers

YUV4MPEG writes a string as header for both the file itself as well as
for every frame; these strings contain magic strings and these were up
until now included in the string to write via %s. Yet they are compile
time constants, so one can use the compile-time string concatentation
instead of inserting these strings at runtime.
Furthermore, the global header has been written via snprintf() to
a local buffer first before writing it. This can be simplified by using
avio_printf().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec: add PhotoCD decoder
Paul B Mahol [Sat, 29 Aug 2020 15:03:20 +0000 (17:03 +0200)]
avcodec: add PhotoCD decoder

4 years agoavformat/yuv4mpegenc: simplify writing the header
James Almer [Thu, 3 Sep 2020 18:39:32 +0000 (15:39 -0300)]
avformat/yuv4mpegenc: simplify writing the header

Actually write it in yuv4_write_header() instead of with the first
packet.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/mov: Stash mfra size if we're reading it anyway
Derek Buitenhuis [Tue, 1 Sep 2020 14:42:17 +0000 (15:42 +0100)]
avformat/mov: Stash mfra size if we're reading it anyway

This also changes a check for mfra_size from < 0 to == 0, since
it was always wrong, as avio_rb32 returns an unsigned integer.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agoavformat/mov: Only read the mfra size once during sidx parsing
Derek Buitenhuis [Tue, 1 Sep 2020 14:33:47 +0000 (15:33 +0100)]
avformat/mov: Only read the mfra size once during sidx parsing

On files with more than one sidx box, like live fragmented MP4
files, it was previously re-reading and seeking on every singl
sidx box, leading to extremely poor performance on larger files,
especially over the network.

Only do it on the first one, and stash its result.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agoavformat/mov: Do not try and seek to an mfra if the reader can't seek
Derek Buitenhuis [Tue, 1 Sep 2020 14:21:52 +0000 (15:21 +0100)]
avformat/mov: Do not try and seek to an mfra if the reader can't seek

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agoavformat/mov: Fix return type used for av_seek in mfra code
Derek Buitenhuis [Tue, 1 Sep 2020 14:15:28 +0000 (15:15 +0100)]
avformat/mov: Fix return type used for av_seek in mfra code

It should be a 64-bit integer, otherwise it overflows and fails
on files greater than 2GB on some systems like x86_64 Linux.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agoavformat: add MODS demuxer
Paul B Mahol [Tue, 1 Sep 2020 09:12:53 +0000 (11:12 +0200)]
avformat: add MODS demuxer

4 years agoavformat: add moflex demuxer
Paul B Mahol [Sun, 23 Aug 2020 20:24:29 +0000 (22:24 +0200)]
avformat: add moflex demuxer

4 years agoavcodec: add MobiClip video decoder
Paul B Mahol [Tue, 25 Aug 2020 10:34:32 +0000 (12:34 +0200)]
avcodec: add MobiClip video decoder

4 years agoavcodec: add FastAudio decoder
Paul B Mahol [Mon, 24 Aug 2020 17:11:41 +0000 (19:11 +0200)]
avcodec: add FastAudio decoder

4 years agoavcodec: add ADPCM IMA MOFLEX decoder
Paul B Mahol [Mon, 24 Aug 2020 22:51:11 +0000 (00:51 +0200)]
avcodec: add ADPCM IMA MOFLEX decoder

4 years agoavcodec/dxtory: add support for vertically flipped frames
Paul B Mahol [Wed, 2 Sep 2020 15:38:26 +0000 (17:38 +0200)]
avcodec/dxtory: add support for vertically flipped frames

4 years agoavformat/musx: improve probing
Paul B Mahol [Thu, 3 Sep 2020 15:50:45 +0000 (17:50 +0200)]
avformat/musx: improve probing

4 years agoavcodec/nvenc_hevc: add ff_nvenc_encode_flush() for .flush
Limin Wang [Fri, 21 Aug 2020 11:22:32 +0000 (19:22 +0800)]
avcodec/nvenc_hevc: add ff_nvenc_encode_flush() for .flush

for the .capabilities have AV_CODEC_CAP_ENCODER_FLUSH, so it's better to add it.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agodoc/filters: add example for drawtext fontsize expr
Andrei Rybak [Wed, 2 Sep 2020 22:57:17 +0000 (00:57 +0200)]
doc/filters: add example for drawtext fontsize expr

Expressions for option fontsize of video filter drawtext have been
supported since commit 6442e4ab3c.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Revised-by: Gyan Doshi <ffmpeg@gyani.pro>
4 years agoavcodec/proresdec2: let long name match one from codec_desc.c
Paul B Mahol [Wed, 2 Sep 2020 16:59:19 +0000 (18:59 +0200)]
avcodec/proresdec2: let long name match one from codec_desc.c

4 years agoavcodec/cbs_av1: add missing frame restoration type enum values
Fei Wang [Wed, 2 Sep 2020 07:31:28 +0000 (15:31 +0800)]
avcodec/cbs_av1: add missing frame restoration type enum values

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agocbs_av1: Fill tile width/height values when uniform_tile_spacing_flag is set
Mark Thompson [Mon, 31 Aug 2020 21:00:57 +0000 (22:00 +0100)]
cbs_av1: Fill tile width/height values when uniform_tile_spacing_flag is set

They are not explicitly in the bitstream in this case, but it is helpful
to be able to use these values without always needing to check the flag
beforehand.

4 years agocbs_mpeg2: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:27 +0000 (17:32 +0100)]
cbs_mpeg2: Use table-based alloc/free

4 years agocbs_av1: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:26 +0000 (17:32 +0100)]
cbs_av1: Use table-based alloc/free

4 years agocbs_vp9: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:25 +0000 (17:32 +0100)]
cbs_vp9: Use table-based alloc/free

4 years agocbs_h265: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:24 +0000 (17:32 +0100)]
cbs_h265: Use table-based alloc/free