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

108926 Commits

Author SHA1 Message Date
Rémi Denis-Courmont
3ba5579e55 riscv: remove unnecessary #include's
Pointed out by Andreas Rheinhardt.
2022-10-05 06:54:56 +02:00
Rémi Denis-Courmont
f0d1637c11 lavc/alacdsp: RISC-V V append_extra_bits[1] 2022-10-05 06:51:11 +02:00
Rémi Denis-Courmont
55bde97f29 lavc/alacdsp: RISC-V V append_extra_bits[0] 2022-10-05 06:51:11 +02:00
Rémi Denis-Courmont
64ab577954 lavc/alacdsp: RISC-V V decorrelate_stereo
To avoid data dependencies, this does the following unroll, which
requires one extra but probably free addition:

    coeff = (b * left_weight) >> decorr_shift;
    b += a;
    a -= coeff;
    b -= coeff;
    swap(a, b);
2022-10-05 06:51:11 +02:00
Andreas Rheinhardt
23411e6dcd avcodec/sbcdec: Remove always-false check
We never guard against a user freeing/stealing the private context;
and returning AVERROR(EIO) is inappropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:59 +02:00
Andreas Rheinhardt
91e192c3a0 avcodec/opus: Move Silk declarations to a new header, opus_silk.h
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:43 +02:00
Andreas Rheinhardt
c095358289 avcodec/opus: Move defines to better places
Move ROUND_MUL* macros to their only users and the Celt
macros to opus_celt.h. Also improve the other headers
a bit while at it.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:43 +02:00
Andreas Rheinhardt
81b927a53b avcodec/opus: Move remaining celt declarations to opus_celt.h
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:04 +02:00
Andreas Rheinhardt
542c334eb5 avcodec/opus_celt, opus_pvq: Move CeltPVQ typedef to opus_pvq.h
It is more natural that way.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:08:39 +02:00
Andreas Rheinhardt
a622f4451f avcodec/opus_celt: Break cyclic inlusion of opus_celt.h<->opus_pvq.h
Simply don't include opus_pvq.h in opus_celt.h: The latter only
uses pointers to CeltPVQ.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:08:16 +02:00
Andreas Rheinhardt
4fc2531fff avcodec/opus: Move stuff shared by decoder and parser to a new file
opus.h (which is used by all the Opus code) currently includes
several structures only used by the parser and the decoder;
several elements of OpusContext are even only used by the decoder.

This commit therefore moves the part of OpusContext that is shared
between these two components (and used by ff_opus_parse_extradata())
out into a new structure and moves all the other accompanying
structures and functions to a new header, opus_parse.h; the
functions itself are also moved to a new file, opus_parse.c.
(This also allows to remove several spurious dependencies
of the Opus parser and encoder.)

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:04:41 +02:00
Andreas Rheinhardt
6658028482 avcodec/opus: Move OpusStreamContext to its only user
Namely opusdec.c.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:02:41 +02:00
Michael Niedermayer
f1f78e3cf4
avcodec/mlpdec: add max channels check
Fixes: out of array access
Fixes: 51648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-4644322217164800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-10-04 23:47:54 +02:00
Michael Niedermayer
77164b2344
avcodec/speexdec: Check channels > 2
More than 2 channels seems unsupported, the code seems to just output empty extra channels

Fixes: Timeout
Fixes: 51569/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-5511509165342720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-10-04 23:47:54 +02:00
Michael Niedermayer
5f44489cc5
avformat/vividas: Check packet size
Fixes: signed integer overflow: 119760682 - -2084600173 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6745781167587328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-10-04 23:47:54 +02:00
Michael Niedermayer
c5f61c99f9
tests/fate/truehd: Add test for shortened Ticket1726 testcase
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-10-04 23:47:53 +02:00
Andreas Rheinhardt
042c1966da avcodec/pngdec: Don't use unsigned for width, height
Otherwise p->linesize[0] * y will be evaluated as an unsigned
which leads to segfaults in case linesize is negative.
This happens in the apng-dispose-previous FATE-test in case
one makes get_buffer return pictures with negative linesizes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:03 +02:00
Andreas Rheinhardt
04196852a2 avcodec/mpegvideo_dec: Fix UB NULL + 0
Affected the mpeg2-field-enc FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:03 +02:00
Andreas Rheinhardt
63b3156558 avformat/aviobuf: Don't use NULL as src for memcpy
This might happen in avio_write() if size == 0
when the direct codepath is taken. It is undefined behaviour
according to the spec although it happens to work in practice.
Fixes the webm-webvtt-remux FATE-test under UBSan.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
e95fdf7660 avcodec/g723_1enc: Fix undefined left-shifts of negative numbers
Affected the acodec-g723_1 FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
e47f3e366b avcodec/g723_1enc: Remove unnecessary av_clipl_int32()
partial_corr is an int16_t and so the av_clipl_int32()
never clips and can be removed. This also avoids
undefined left-shifts of negative numbers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
1e1ddbb70d avcodec/zerocodec: Avoid undefined NULL - 0
Fixes the zerocodec FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
bf8e40ae0d avcodec/wmalosslessdec: Simplify flushing, avoid NULL + 0
Return immediately if not enough leftover bits are available
when flushing. This is simpler and also avoids an
init_get_bits(gb, NULL, 0) (which currently leads to NULL + 0,
which is UB; this affects the lossless-wma(|-1|-2|-rawtile)
FATE tests).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
44bdb4efd0 avcodec/wmavoice: Check init_get_bits8()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
d5eb74b58d avcodec/wmavoice: Don't initialize GetBitContext with buf == NULL
Happens when flushing. This triggers NULL + 0 (which is UB) in
init_get_bits_xe (which previously errored out, but the return value
has not been checked) and in copy_bits().

This fixes the wmavoice-(7|11|19)k FATE-tests with UBSan.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
8a61f66381 avocdec/cavsdsp: Fix undefined pointer arithmetic
src2 is used in CAVS_SUBPIX_HV iff FULL is true (it is exactly
for the egpr functions); otherwise it might be NULL. So check
for FULL before doing pointer arithmetic.
Fixes a "src/libavcodec/cavsdsp.c:524:1: runtime error: applying
non-zero offset 8 to null pointer" from UBSan.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
22e7e4e19d avcodec/vc2enc_dwt: Fix left shifts of negative numbers
Fixes the vsynth(1|2|_lena)-vc2-(thaar|t5_3) FATE tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:01:01 +02:00
Andreas Rheinhardt
3b09e8f5e9 avcodec/jpeg2000dsp: Use unsigned to avoid overflow
Affected the jpeg2000dsp checkasm test.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 18:00:43 +02:00
Andreas Rheinhardt
2fd99aa208 avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header
It allows to avoid including mpegvideo.h when including mpeg12.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 17:41:34 +02:00
Andreas Rheinhardt
ef285d59ac configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies
As long as ff_mpeg12_common_init() existed in mpeg12.c,
it added a dependency of mpeg12.o on mpegvideodata.o
(which provides ff_mpeg2_dc_scale_table, which is used
in ff_mpeg12_common_init()). mpegvideodata.o is normally
provided by the mpegvideo subsystem and therefore several
codecs and the MPEG-1/2 parser added a configure dependency
on said subsystem (additionally, the eatqi decoder just
added a Makefile dependency on mpegvideodata.o).

Given that ff_mpeg12_common_init() is no more, these dependencies
can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 17:41:34 +02:00
Andreas Rheinhardt
7cea36f183 avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 17:41:34 +02:00
Andreas Rheinhardt
b0c1473f6e avcodec/mpeg12dec: Don't call ff_mpeg12_common_init()
It only sets [yc]_dc_scale_table and these tables are only
read in ff_set_qscale(); but the MPEG-1/2 decoders don't call
ff_set_qscale() at all.
(Furthermore, given that intra_dc_precision is always zero
for a decoder at this point, ff_mpeg12_common_init()
actually set these pointers to what ff_mpv_common_defaults()
already set them.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 17:41:34 +02:00
Andreas Rheinhardt
fccb23b7dd avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it
It is better place for these declarations than
mpeg12data.h as RL VLC are just a variant of VLCs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 17:41:34 +02:00
James Almer
b92e14147f avcodec: add a bsf to reorder DTS into PTS
Starting with an h264 implementation. Can be extended to support other codecs.

A few caveats:
- OpenGOP streams are currently not supported. The firt packet must be an IDR
  frame.
- In some streams, a few frames at the end may not get a reordered PTS when
  they reference frames past EOS. The code added to derive timestamps from
  previous frames needs to extended.

Addresses ticket #502.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-04 08:40:16 -03:00
Grzegorz Bernacki
8f4b000c37 lavc/aarch64: Add neon implementation for vsse_intra8
Provide optimized implementation for vsse_intra8 for arm64.

Performance tests are shown below.
- vsse_5_c: 87.7
- vsse_5_neon: 26.2

Benchmarks and tests are run with checkasm tool on AWS Graviton 3.

Co-authored-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-04 13:24:20 +03:00
Grzegorz Bernacki
bad67cb9fd lavc/aarch64: Provide optimized implementation of vsse8 for arm64.
Provide optimized implementation of vsse8 for arm64.

Performance comparison tests are shown below.
- vsse_1_c: 141.5
- vsse_1_neon: 32.5

Benchmarks and tests are run with checkasm tool on AWS Graviton 3.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-04 13:24:20 +03:00
Grzegorz Bernacki
faea56c9c7 lavc/aarch64: Provide neon implementation of nsse8
Add vectorized implementation of nsse8 function.

Performance comparison tests are shown below.
- nsse_1_c: 256.0
- nsse_1_neon: 82.7

Benchmarks and tests run with checkasm tool on AWS Graviton 3.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-04 13:24:20 +03:00
Grzegorz Bernacki
f401a2af21 lavc/aarch64: Add neon implementation for pix_abs8 functions.
Provide optimized implementation of pix_abs8 function for arm64.

Performance comparison tests are shown below:
pix_abs_1_1_c: 162.5
pix_abs_1_1_neon: 27.0
pix_abs_1_2_c: 174.0
pix_abs_1_2_neon: 23.5
pix_abs_1_3_c: 203.2
pix_abs_1_3_neon: 34.7

Benchmarks and tests are run with checkasm tool on AWS Graviton 3.

Co-authored-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-04 13:24:04 +03:00
Anton Khirnov
a6bf4d47a9 lavfi/avf_showspatial: add framerate option
Apparently this option was intended (the context contains a
currently-unused frame_rate field), but was never added. This results in
the output timebase being unset after config_output(), so the input
audio timebase ends up being used for video output, which is clearly
wrong.

Add an option for setting output video framerate. Also set output frame
durations.
2022-10-04 11:55:03 +02:00
Anton Khirnov
06758370aa lavfi/avf_showfreqs: set frame durations
The filter is supposed to produce CFR output.
2022-10-04 11:55:03 +02:00
Anton Khirnov
dc686a0c22 lavfi/avf_showcqt: set frame durations
The filter is supposed to produce CFR output.
2022-10-04 11:55:03 +02:00
Anton Khirnov
7d13c5dff0 lavfi/avf_avectorscope: set frame durations
The filter is supposed to produce CFR output.
2022-10-04 11:55:03 +02:00
Anton Khirnov
ae84484c78 lavfi/avf_aphasemeter: set frame durations
The filter is supposed to produce CFR output.
2022-10-04 11:55:03 +02:00
Anton Khirnov
ed48d00861 lavfi/avf_ahistogram: set frame durations
The filter is supposed to produce CFR output.
2022-10-04 11:55:03 +02:00
Anton Khirnov
502892d706 lavfi/vf_fps: set frame duration 2022-10-04 11:55:03 +02:00
Anton Khirnov
044d70736e fftools/ffmpeg: move some code from init_output_stream() to init_output_stream_encode()
The code is subtitle-encoding-specific, so this is a more appropriate
place for it.
2022-10-04 11:55:03 +02:00
Anton Khirnov
29188f9c62 fftools/ffmpeg: rename OutputStream.sync_opts to next_pts
The current name is confusing.
2022-10-04 11:55:03 +02:00
Anton Khirnov
3c0f532cbc fftools/ffmpeg: pass the timestamp to check_recording_time()
Stop setting OutputStream.sync_opts for subtitle encoding, as it is now
unused.
2022-10-04 11:55:03 +02:00
Anton Khirnov
69f770f77c fftools/ffmpeg: stop setting OutputStream.sync_opts for streamcopy
It is not used for anything.
2022-10-04 11:55:03 +02:00
Anton Khirnov
76678b7137 fftools/ffmpeg: drop never-set OutputStream.first_pts 2022-10-04 11:55:03 +02:00