1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

108498 Commits

Author SHA1 Message Date
James Almer
0922c6b01b x86/lpc: use fused negative multiply-add instructions where useful
Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 18:17:26 -03:00
James Almer
a1c6f4b653 tests/checkasm/lpc: randomize buffer length
Simplifies the test, while trying more values and preventing pointlessly
running benchmarks in a loop.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 18:17:26 -03:00
James Almer
0627e6d74c avcodec/lpc: zero the middle odd sample in the output
Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 18:17:26 -03:00
James Almer
c8c4a162fc avcodec/lpc: use ptrdiff_t for length parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 18:17:26 -03:00
Vignesh Venkatasubramanian
a2d95928c3 avformat/movenc: Write auxi box for animated AVIF with alpha
According to the HEIF specification (ISO/IEC 23008-12) Section
7.5.3.1, tracks with handler_type 'auxv' must contain a 'auxi' box
in its SampleEntry to notify the nature of the auxiliary track to the
decoder.

The content is the same as the 'auxC' box. So parameterize and re-use
the existing function.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Zern <jzern@google.com>
2022-09-22 14:10:22 -07:00
James Zern
bd7d69fe35 avcodec/libvpxenc: add -min-gf-interval
this maps to the vpxenc argument with the same name and the
VP9E_SET_MIN_GF_INTERVAL codec control

Signed-off-by: James Zern <jzern@google.com>
Reviewed-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-09-22 11:52:16 -07:00
James Almer
48615f0a78 x86/aacpsdsp: add ps_hybrid_analysis_fma3
This replace the sse3 version, which was not really faster than the sse one.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 13:27:43 -03:00
James Almer
2bcf86d53d x86/aacpsdsp: precompute constant factors
Inspired by the optimization done to the C version by Rémi Denis-Courmont.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 13:27:43 -03:00
Rémi Denis-Courmont
08edacc248 lavc/aacpsdsp: precompute constant factors
The input complex factors are constant for each iterations. This
substitudes 4 loads, 2 additions and 2 subtractions per iteration of
the inner-loop with another 4 loads. Thus effectively 4 arithmetic
operations per iteration of the inner loop are avoided, i.e. 24
operations per iteration of the outer loop, or 24 * (n - 1) operations
in total.

If the inner loop is not unrolled by the compiler, this also might
also save some pointer arithmetic as most instruction sets do not
have addressing modes with negated register offsets (12 - j). Unless
the compiler is optimising for code size, this is unlikely though.
2022-09-22 13:27:43 -03:00
Michael Niedermayer
db73ae0dc1
avformat/icodec: Check nb_pal
Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-22 17:44:05 +02:00
Michael Niedermayer
9303ba272e
avformat/aiffdec: Use 64bit for block_duration use
Fixes: signed integer overflow: 3 * -2147483648 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6668935979728896

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>
2022-09-22 17:44:05 +02:00
Michael Niedermayer
1c2b6265c8
avformat/aiffdec: Check block_duration
Fixes: signed integer overflow: 3 * -2147483648 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6668935979728896

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>
2022-09-22 17:44:04 +02:00
Michael Niedermayer
c5bd689655
avformat/mxfdec: Avoid some redundant writing to tables in mxf_compute_ptses_fake_index()
offsets suggested by Tomas Härdin
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-22 17:44:04 +02:00
Michael Niedermayer
1182bbb2c3
avformat/mxfdec: only probe max run in
Suggested-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-22 17:44:04 +02:00
Michael Niedermayer
7786097825
avformat/mxfdec: Check run_in is within 65536
Fixes: signed integer overflow: 9223372036854775807 - -2146905566 cannot be represented in type 'long'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6570996594769920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-22 17:44:03 +02:00
Michael Niedermayer
dd81cc22b3
avcodec/mjpegdec: Check for unsupported bayer case
Fixes: out of array access
Fixes: 51462/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-662559341582745

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-22 17:44:03 +02:00
Andreas Rheinhardt
8306074dc6 avformat/dashdec: Reindent after the previous commit
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 15:34:54 +02:00
Andreas Rheinhardt
14b3830b33 avformat/dashdec: Fix crash on invalid input/ENOMEM, fix leak
In case a SupplementalProperty node exists in an adaptationset,
it is searched for a "schemeIdUri" property via xmlGetProp().
Whatever xmlGetProp() returns is then compared via av_strcasecmp()
to a string literal. xmlGetProp() can return NULL, namely in case
no "schemeIdUri" exists and (given that this string is allocated)
presumably also on allocation failure. No check for NULL is done,
so this may crash.

Furthermore, the string returned by xmlGetProp() needs to be freed
with xmlFree(), but this is not done either.

This commit fixes both of these issues; they existed since this code
has been added in 10d008f0fd.

This has been found while investigating ticket #9697. The continuous
leaks might very well be the reason behind the observed slowdown.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 15:34:23 +02:00
James Almer
05cff214b9 avutil/channel_layout: mention how the API user should treat channel orders it does not understand
In case new orders are added in the future, existing library users can still
use the layout simply by ignoring everything but the channel count in it, so
make this explicit.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-22 10:22:19 -03:00
Zhao Zhili
af919cf780 fftools/ffmpeg: fix av_display_rotation_set() type cast
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-09-22 20:03:57 +08:00
Paul B Mahol
f55f817955 avcodec/exr: fix skipping too long metadata values 2022-09-22 10:31:03 +02:00
Martin Storsjö
c9aa6164d4 x86/lpc: Fix parameter sign extension, unbreaking checkasm-lpc on x86_64 windows
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-09-22 11:13:33 +03:00
Lynne
f2d75d7fb0
fate/checkasm: add LPC test to list 2022-09-22 04:27:20 +02:00
Lynne
b67776e12f
x86/lpc: fix even scalar loop overreads/writes
Passes checkasm with valgrind, tested to sizes of more than 4000 samples.
2022-09-22 04:27:19 +02:00
Lynne
dea944b838
x86/lpc: fix odd scalar loop overreads/writes 2022-09-22 03:07:41 +02:00
Andreas Rheinhardt
ce16d18307 avcodec/dcaenc: Simplify channel layout check
ff_encode_preinit() ensures that the channel layout is equivalent
to one of the channel layouts in AVCodec.ch_layout; given that
all of these channel layouts have distinct numbers of channels,
one can therefore uniquely determine the channel layout by
the number of channels.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:20:16 +02:00
Andreas Rheinhardt
66e297fc84 avcodec/dcaenc: Remove dead checks for unspec channel layouts
This encoder has AVCodec.ch_layouts set, so ff_encode_preinit()
ensures that the used channel layout is equivalent to one of
these.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:19:30 +02:00
Andreas Rheinhardt
65dbc83eec avcodec/mlpenc: Remove dead channel layout checks
ff_encode_preinit() has already checked that the channel layout
is equivalent to one of the layouts in AVCodec.ch_layouts.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:16:49 +02:00
Andreas Rheinhardt
a12338afe5 avcodec/mlpenc: Simplify channel layout comparisons
These encoders have AVCodec.ch_layouts set, so ff_encode_preinit()
has already checked that the used channel layout is equivalent
to one of these native layouts. Therefore one can simply
compare the channel masks (with the added complication
that one has to use av_channel_layout_subset() to get it,
because the channel layout is not guaranteed to have
AV_CHANNEL_ORDER_NATIVE).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:16:03 +02:00
Andreas Rheinhardt
03fb801cd9 avcodec/mlpenc: Fix channel layouts
The encoder actually creates files with side channels, not back
channels. See thd_layout in mlp_parse.h.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:14:26 +02:00
Andreas Rheinhardt
17366d6128 avcodec/mpegaudioenc_template: Remove dead channel count check
The encoders using this have AVCodec.ch_layouts set, so that
this is checked generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:14:15 +02:00
Andreas Rheinhardt
4668ff792a avcodec/libspeexenc: Remove dead channel count check
This encoder has AVCodec.ch_layouts set, so that this is checked
generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:14:15 +02:00
Andreas Rheinhardt
56f7b39456 avcodec/libshine: Remove dead channel count check
This encoder has AVCodec.ch_layouts set, so that this is checked
generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:14:15 +02:00
Andreas Rheinhardt
e6073665c4 avcodec/libcodec2: Remove dead channel count check
This encoder has AVCodec.ch_layouts set, so that this is checked
generically.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:07:49 +02:00
Andreas Rheinhardt
5c18934c6d avcodec/pcm: Remove always-false check
None of the decoders here have the AV_CODEC_CAP_CHANNEL_CONF set,
so that it is already checked generically that the number of channels
is positive.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:05:59 +02:00
Andreas Rheinhardt
ce6af2df61 avcodec/pcm-blurayenc: Don't presume every channel layout to be native
The pcm_bluray encoder has AVCodec.ch_layouts set, so that
ff_encode_preinit() checks that the channel layout in use
is equivalent to one of the layouts from AVCodec.ch_layouts.
Yet equivalent is not the same as identical; in particular,
custom layouts equivalent to native layouts are possible
(and necessary if one wants to use the name/opaque fields
with an ordinary channel layout), so one must not simply
use AVChannelLayout.u.mask. Use av_channel_layout_subset()
instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:05:59 +02:00
Andreas Rheinhardt
cd335de53f avcodec/dfpwmdec: Remove always-false check
This decoder does not have the AV_CODEC_CAP_CHANNEL_CONF set,
so that number of channels has to be set by the user before
avcodec_open2().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:05:59 +02:00
Andreas Rheinhardt
9ffd0c46b1 avcodec/encode: Remove deprecated always-false checks
Now that it is ensured that the old and new channel count/layout
values coincide if the old ones are set, the consistency of the
AVChannelLayout (which is checked before we reach this point)
implies the consistency of the old values, making these checks
here dead code. So remove them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:05:59 +02:00
Andreas Rheinhardt
90edbd3185 avcodec/avcodec: Always use old channel count/layout if set
This ensures that if AVCodecContext.channels or
AVCodecContext.channel_layout are set, AVCodecContext.ch_layout
has the equivalent values after this block.

(In case these values are set inconsistently, the consistency check
for ch_layout below will error out.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:05:59 +02:00
Andreas Rheinhardt
a06a2d8943 avcodec/avcodec: Check for more invalid channel layouts
In particular, check the provided channel layout for encoders
without AVCodec.ch_layouts set. This fixes an infinite loop
in the WavPack encoder (and maybe other issues in other encoders
as well) in case the channel count is zero.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:03:20 +02:00
Andreas Rheinhardt
859d9d70f9 avcodec/encode: Remove dead deprecated check
The wrapper for the legacy channel layout API already sets
AVCodecContext.channels based upon AVCodecContext.channel_layout
if the latter is set while the former is unset.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 00:30:32 +02:00
Andreas Rheinhardt
e2e3181519 avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it
Otherwise, there might be leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 00:30:32 +02:00
Andreas Rheinhardt
9beba05311 avcodec/fmtconvert: Remove unused AVCodecContext parameter
Unused since d74a8cb7e4.

Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-21 20:26:40 +02:00
Andreas Rheinhardt
fd72d8aea3 avcodec/blockdsp: Remove unused AVCodecContext parameter
Possible since be95df12bb.

Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-21 20:24:40 +02:00
Andreas Rheinhardt
57f3ca20dc avcodec/cavsdsp: Remove unused function parameter
Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-21 20:24:22 +02:00
Andreas Rheinhardt
6a288ada55 fate/lavf-*: Add missing dependency on pipe protocol
Forgotten in bf1337f99c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-21 15:43:52 +02:00
Paul B Mahol
b9d71cdb9e avcodec/mjpegbdec: use init_get_bits8() 2022-09-21 15:03:00 +02:00
Paul B Mahol
6a150fcdb9 avcodec/mlpenc: analyze only if there are samples 2022-09-21 14:32:07 +02:00
Thilo Borgmann
2ca2d46f0b lavc/videotoolboxenc: Fix crash by uninitialized value
If create_cv_pixel_buffer() fails, pixel_buffer_info might get into CFRelease() containing an arbitrary value.
2022-09-21 13:39:55 +02:00
Andreas Rheinhardt
5a7978a694 avfilter/avfilter: Make ff_command_queue_pop() static
Only used here.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-21 13:01:20 +02:00