ffmpeg.git
5 months agofate/ffmpeg: Fix requirements of shortest tests
Andreas Rheinhardt [Thu, 2 Dec 2021 14:31:49 +0000 (15:31 +0100)]
fate/ffmpeg: Fix requirements of shortest tests

Fixes FATE failures if e.g. libavdevice is disabled.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agofate/ffmpeg: Fix shortest tests
Andreas Rheinhardt [Thu, 2 Dec 2021 09:24:59 +0000 (10:24 +0100)]
fate/ffmpeg: Fix shortest tests

The mpeg4 encoder is slice-threaded and its output depends upon
the number of threads used. Therefore all tests of this encoder
use a hardcoded number of threads (ENC_OPTS in fate-run.sh contains
"-threads 1"; only the vsynth%-mpeg4-thread tests override this
for the mpeg4 encoder, but they also use a hardcoded value to
be consistent across different systems); only the new shortest
and copy-shortest[12] (implicitly due to the sample used) tests
don't and this leads to FATE-failures.
Fix this by explicitly setting the thread count.

Also switch the shortest test to framecrc, because hashing side data
is itchy even though the side data used here (AV_PKT_DATA_QUALITY_STATS)
has a defined endianness.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoChangelog: update with recent Vulkan filter additions
Lynne [Thu, 2 Dec 2021 10:08:58 +0000 (11:08 +0100)]
Changelog: update with recent Vulkan filter additions

5 months agoavfilter: add a flip_vulkan filter
Wu Jianhua [Fri, 26 Nov 2021 09:10:57 +0000 (17:10 +0800)]
avfilter: add a flip_vulkan filter

This filter flips the input video both horizontally and vertically
in one compute pipeline, and it's no need to use two pipelines for
hflip_vulkan,vflip_vulkan anymore.

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
5 months agoavfilter: add audio dynamic smooth filter
Paul B Mahol [Thu, 25 Nov 2021 18:30:32 +0000 (19:30 +0100)]
avfilter: add audio dynamic smooth filter

5 months agoavfilter: add audio spectral stats filter
Paul B Mahol [Mon, 22 Nov 2021 10:44:24 +0000 (11:44 +0100)]
avfilter: add audio spectral stats filter

5 months agoavcodec/movtextenc: Simplify writing a single char
Andreas Rheinhardt [Tue, 30 Nov 2021 10:08:33 +0000 (11:08 +0100)]
avcodec/movtextenc: Simplify writing a single char

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/movtextenc: Remove redundant byte count
Andreas Rheinhardt [Tue, 30 Nov 2021 10:05:52 +0000 (11:05 +0100)]
avcodec/movtextenc: Remove redundant byte count

Use the AVBPrint's len instead.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/movtextenc: Fix encoding of subtitles with multiple rects
Andreas Rheinhardt [Tue, 30 Nov 2021 09:02:13 +0000 (10:02 +0100)]
avcodec/movtextenc: Fix encoding of subtitles with multiple rects

The format of a mov_text (3GPP Timed Text) sample is:

uint16_t text_length;
uint8_t  text[text_length];
TextSampleModifierBox text_modifier;

Yet in case our encoder receives an AVSubtitle with multiple
ASS AVSubtitleRects, it creates something like this:
uint16_t text_length;
uint8_t  text[text_length_1];
TextSampleModifierBox text_modifier_1;
uint8_t  text[text_length_2];
TextSampleModifierBox text_modifier_2;
...

where text_length is the sum of all the text_length_*.
This commit fixes this by writing the TextSampleModifierBoxes only
after all the rects have been written.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/movtextenc: Check for too long subtitles
Andreas Rheinhardt [Tue, 30 Nov 2021 08:21:35 +0000 (09:21 +0100)]
avcodec/movtextenc: Check for too long subtitles

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/movtextenc: Reset AVBPrint at the beginning, not end of encoding
Andreas Rheinhardt [Tue, 30 Nov 2021 08:24:51 +0000 (09:24 +0100)]
avcodec/movtextenc: Reset AVBPrint at the beginning, not end of encoding

This avoids abusing a variable called length for the return value
and ensures that the AVBPrint is always reset before using it;
previously this has been forgotten in some error paths.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/movtextenc: Fix infinite loop due to variable truncation
Andreas Rheinhardt [Mon, 29 Nov 2021 16:41:16 +0000 (17:41 +0100)]
avcodec/movtextenc: Fix infinite loop due to variable truncation

Regression since af043b839c38e850af1184fd6be691f8475c048e.
Fixes ticket #9409.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agofate/ffmpeg: add some more flags to the shortest tests
James Almer [Thu, 2 Dec 2021 01:02:45 +0000 (22:02 -0300)]
fate/ffmpeg: add some more flags to the shortest tests

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agofate/ffmpeg: add missing bitexact flags to the shortest tests
James Almer [Wed, 1 Dec 2021 23:30:06 +0000 (20:30 -0300)]
fate/ffmpeg: add missing bitexact flags to the shortest tests

Should fix fate failures on some targets.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agofate/ffmpeg: add tests for shortest option
James Almer [Wed, 1 Dec 2021 14:01:11 +0000 (11:01 -0300)]
fate/ffmpeg: add tests for shortest option

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoffmpeg: fix usage of -shortest in codec copy scenarios
James Almer [Thu, 25 Nov 2021 17:06:01 +0000 (14:06 -0300)]
ffmpeg: fix usage of -shortest in codec copy scenarios

Don't mark all streams as finished, instead make sync_opts keep track of the
stream's duration, and set recording_time to it, same as in transcoding paths.

Fixes tickets #9512 and #9513.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/vp3: Check version in all cases when VP4 code is not built
Michael Niedermayer [Tue, 30 Nov 2021 18:46:17 +0000 (19:46 +0100)]
avcodec/vp3: Check version in all cases when VP4 code is not built

Fixes: out of array read
Fixes: 40284/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4599568176644096

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>
5 months agotools/target_dec_fuzzer: Adjust DXA threshold
Michael Niedermayer [Tue, 30 Nov 2021 18:20:57 +0000 (19:20 +0100)]
tools/target_dec_fuzzer: Adjust DXA threshold

Fixes: Timeout
Fixes: 40203/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXA_fuzzer-4587923496894464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/gemdec: Check tag & planes before image allocation
Michael Niedermayer [Sat, 27 Nov 2021 20:00:07 +0000 (21:00 +0100)]
avcodec/gemdec: Check tag & planes before image allocation

Fixes: Timeout
Fixes: 41083/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GEM_fuzzer-5843826518917120

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>
5 months agoavcodec: [loongarch] Optimize decode_significance/_8x8_loongarch.
Hao Chen [Wed, 1 Dec 2021 03:52:21 +0000 (11:52 +0800)]
avcodec: [loongarch] Optimize decode_significance/_8x8_loongarch.

Decoding 1080P H264 from 168fps to 170fps.

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Reviewed-by: 陈昊 <chenhao@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec: [loongarch] optimize get_cabac.
Shiyou Yin [Wed, 1 Dec 2021 03:52:20 +0000 (11:52 +0800)]
avcodec: [loongarch] optimize get_cabac.

Decoding 1080P H264 on 2.5Ghz 3A5000: 165fps==>168fps.
Testing command: ffmpeg -i ***.mp4 -f rawvideo -y /dev/null -an

Reviewed-by: 陈昊 <chenhao@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoconfigure: Add support for loongarch.
Shiyou Yin [Wed, 1 Dec 2021 03:52:19 +0000 (11:52 +0800)]
configure: Add support for loongarch.

For la464 cpu: ./configure --cpu=la464

With cross-compiler:
./configure --cross-prefix=loongarch64-linux-gnu- \
            --enable-cross-compile --arch=loongarch64 \
            --target-os=linux --cpu=la464

Reviewed-by: 陈昊 <chenhao@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/scd: add demuxer
Zane van Iperen [Wed, 1 Dec 2021 15:41:55 +0000 (01:41 +1000)]
avformat/scd: add demuxer

Adds demuxer for Square Enux SCD files.

Based off [1] and personal investigation.

This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
(big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
this demuxer is marked as experimental until this can be confirmed.

[1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

Reviewed-by: Peter Ross <pross@xvid.org>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agoavcodec/vaapi_encode: Fix segfault upon closing uninitialized encoder
Andreas Rheinhardt [Mon, 29 Nov 2021 14:29:11 +0000 (15:29 +0100)]
avcodec/vaapi_encode: Fix segfault upon closing uninitialized encoder

Fixes ticket #9537.
Probably a regression since 2b3206891649f317c20993411efef4bee39ae784.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/matroskaenc: Sort cues entries by pts
Andreas Rheinhardt [Sat, 27 Nov 2021 13:15:45 +0000 (14:15 +0100)]
avformat/matroskaenc: Sort cues entries by pts

Currently they are ordered as-written (i.e. by increasing position);
in case av_interleaved_write_frame() is used, this is (mostly)
the same as ordered by increasing dts.
Yet the Matroska specification strongly recommends (SHOULD) that
the CuePoints be sorted by CueTime. mkvalidator warns when they are
not. Therefore this commit sorts them accordingly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/qsvenc: Properly flush the FIFO on close
Andreas Rheinhardt [Sat, 25 Sep 2021 12:28:10 +0000 (14:28 +0200)]
avcodec/qsvenc: Properly flush the FIFO on close

Freeing the new H.264 specific fields has been forgotten.
(This leak only appears in case the encoder has not been completely
drained.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/qsvenc: Fix leak of A53 data
Andreas Rheinhardt [Sat, 25 Sep 2021 12:05:45 +0000 (14:05 +0200)]
avcodec/qsvenc: Fix leak of A53 data

Up until now, it has only been freed when the QSVFrame is reused,
so that the last one contained in it leaked at the end.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CC
Andreas Rheinhardt [Sat, 25 Sep 2021 10:20:20 +0000 (12:20 +0200)]
avcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CC

Since commit 3bbe0c210b05fc6fbd7b1d4bbd8479db7f2cf957, the Payloads
array of every QSVFrame leaks as soon as the frame is reused;
the leak is small and not very noticeable, but if there is an attempt
to use said array the ensuing crash is much more noticeable.
This happens when encoding H.264 with A53 CC side data.

Furthermore, if said array can not be allocated at all, an AVFrame
leaks.

Fix all of this by not allocating the array separately at all; put it
in QSVFrame instead and restore the Payloads array upon reusing the
frame.

Finally, use av_freep() instead of av_free() to free the payload
entries.

Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agofftools/ffmpeg_opt: Don't set source_index redundantly
Andreas Rheinhardt [Sat, 27 Nov 2021 11:15:18 +0000 (12:15 +0100)]
fftools/ffmpeg_opt: Don't set source_index redundantly

It is already set in new_output_stream().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agofftools/ffmpeg_opt: Don't duplicate array unnecessarily
Andreas Rheinhardt [Fri, 26 Nov 2021 18:44:21 +0000 (19:44 +0100)]
fftools/ffmpeg_opt: Don't duplicate array unnecessarily

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/fifo: avoid repeated scaling of timestamps on failure and recovery
Ryoji Gyoda [Sun, 21 Nov 2021 17:06:20 +0000 (02:06 +0900)]
avformat/fifo: avoid repeated scaling of timestamps on failure and recovery

If fifo_thread_recover() succeeds immediately after
fifo_thread_dispatch_message() fails, the dts of the packet is scaled
twice, causing cur_dts to be abnormally large and "Application provided
invalid, non monotonically increasing dts to muxer in stream" to occur
repeatedly.

Steps to reproduce:
1. ffmpeg -f lavfi -i testsrc -c:v libx264 -map 0:v -flags +global_header -f fifo -fifo_format flv -attempt_recovery 1 -recover_any_error 1 rtmp://example.com/livekey
2. set a breakpoint on fifo_thread_recover
3. force disconnect from the rtmp server
4. wait for break
5. reconnect to the rtmp server
6. resume execution of ffmpeg

Signed-off-by: Ryoji Gyoda <gy.cft4@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agofftools/ffprobe: print size of attachment streams (extradata_size)
softworkz [Thu, 25 Nov 2021 03:01:23 +0000 (04:01 +0100)]
fftools/ffprobe: print size of attachment streams (extradata_size)

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavformat/flvenc: avoid 24bit timestamp truncation for FLV metadata
asilvestre [Fri, 26 Nov 2021 16:27:18 +0000 (17:27 +0100)]
avformat/flvenc: avoid 24bit timestamp truncation for FLV metadata

FLV AMF tags have a 24bit field for timestamps plus an 8bit for extended
timestamps.

All FLV AMF tags except when we write metadata handle this correctly
using the put_timestamp function.

Until now when writing metadata we were only using the first
24 bits and thus the timestamp value was wraping around 4 hours 40
minutes (16,800,000 ms, max 24 bit value 16,777,216) of playback.

This commit fixes this applying this same function put_timestamp
for the metadata FLV tag.

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavcodec/iff: limit written bytes to twice the output array size in decode_delta_l()
Michael Niedermayer [Sat, 2 Oct 2021 21:37:05 +0000 (23:37 +0200)]
avcodec/iff: limit written bytes to twice the output array size in  decode_delta_l()

Fixes: Timeout
Fixes: 39436/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6624915520880640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agotools/target_dec_fuzzer: Disable MB debug after a few iterations
Michael Niedermayer [Sat, 2 Oct 2021 21:08:14 +0000 (23:08 +0200)]
tools/target_dec_fuzzer: Disable MB debug after a few iterations

This debug code can be quite slow on constructed streams

Fixes: Timeout
Fixes: 38907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6334628852531200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/mov: Check channels for mov_parse_stsd_audio()
Michael Niedermayer [Sun, 7 Nov 2021 12:48:24 +0000 (13:48 +0100)]
avformat/mov: Check channels for mov_parse_stsd_audio()

Fixes: signed integer overflow: -776522110086937600 * 16 cannot be represented in type 'long'
Fixes: 40563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644829447127040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/vqavideo: Use GetByteContext and check for end
Michael Niedermayer [Sat, 13 Nov 2021 17:57:59 +0000 (18:57 +0100)]
avcodec/vqavideo: Use GetByteContext and check for end

Fixes: out of array access
Fixes: Timeout
Fixes: 40481/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-6502647583080448

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter/src_movie: add format_opts for the opened file
Limin Wang [Fri, 26 Nov 2021 12:47:20 +0000 (20:47 +0800)]
avfilter/src_movie: add format_opts for the opened file

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec/videotoolbox: silence some -Wimplicit-fallthrough warnings
James Almer [Sun, 28 Nov 2021 23:23:26 +0000 (20:23 -0300)]
avcodec/videotoolbox: silence some -Wimplicit-fallthrough warnings

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agolavc/videotoolbox: fix build on pre-10.14 SDKs
rcombs [Sun, 28 Nov 2021 23:15:34 +0000 (17:15 -0600)]
lavc/videotoolbox: fix build on pre-10.14 SDKs

Also fixes handling of future codec tags (needed to bswap)

5 months agolavc: bump minor version for new VT hwaccels
rcombs [Sat, 13 Nov 2021 23:46:31 +0000 (17:46 -0600)]
lavc: bump minor version for new VT hwaccels

5 months agolavc/proresdec: add videotoolbox hwaccel
rcombs [Sat, 13 Nov 2021 19:38:04 +0000 (13:38 -0600)]
lavc/proresdec: add videotoolbox hwaccel

5 months agolavc/proresdec: add scaffolding for hwdec support
rcombs [Sat, 13 Nov 2021 19:37:26 +0000 (13:37 -0600)]
lavc/proresdec: add scaffolding for hwdec support

5 months agovideotoolbox: add alpha support
rcombs [Sat, 13 Nov 2021 20:21:23 +0000 (14:21 -0600)]
videotoolbox: add alpha support

5 months agolavc/videotoolbox: add VP9 hardware acceleration
rcombs [Sat, 13 Nov 2021 08:43:06 +0000 (02:43 -0600)]
lavc/videotoolbox: add VP9 hardware acceleration

On M1 Max, this supports profiles 0 and 2, but not 1 and 3.

5 months agolavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailable
rcombs [Sat, 13 Nov 2021 08:33:08 +0000 (02:33 -0600)]
lavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailable

This is required for VP9 to work.

5 months agolavc/videotoolbox: expose some functions as lavc-internal
rcombs [Sat, 13 Nov 2021 08:31:52 +0000 (02:31 -0600)]
lavc/videotoolbox: expose some functions as lavc-internal

5 months agolavc/hevcdec: support all color formats in videotoolbox hwaccel
rcombs [Sat, 13 Nov 2021 07:06:29 +0000 (01:06 -0600)]
lavc/hevcdec: support all color formats in videotoolbox hwaccel

5 months agolavc/h264dec: support all color formats in videotoolbox hwaccel
rcombs [Sat, 13 Nov 2021 07:04:21 +0000 (01:04 -0600)]
lavc/h264dec: support all color formats in videotoolbox hwaccel

5 months agolavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable
rcombs [Sat, 13 Nov 2021 07:02:26 +0000 (01:02 -0600)]
lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable

5 months agolavc/videotoolbox: fix format computation
rcombs [Sat, 13 Nov 2021 07:00:08 +0000 (01:00 -0600)]
lavc/videotoolbox: fix format computation

Use sw_pix_fmt instead of pix_fmt (consistent with other hwaccels)

5 months agolavc/videotoolbox: escape 0x00000[0-3]s in avcC PSs
rcombs [Sat, 13 Nov 2021 06:56:33 +0000 (00:56 -0600)]
lavc/videotoolbox: escape 0x00000[0-3]s in avcC PSs

5 months agolavu/videotoolbox: add 422 and 444 pixel format mappings
rcombs [Sat, 13 Nov 2021 06:30:28 +0000 (00:30 -0600)]
lavu/videotoolbox: add 422 and 444 pixel format mappings

5 months agoswscale: add P210/P410/P216/P416 input
rcombs [Sat, 13 Nov 2021 19:34:21 +0000 (13:34 -0600)]
swscale: add P210/P410/P216/P416 input

5 months agolavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats
rcombs [Sat, 13 Nov 2021 05:50:17 +0000 (23:50 -0600)]
lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats

These are used by VideoToolbox hardware decoders.

5 months agoffmpeg: remove ffmpeg_videotoolbox
rcombs [Sat, 13 Nov 2021 21:39:44 +0000 (15:39 -0600)]
ffmpeg: remove ffmpeg_videotoolbox

This was almost completely redundant. The only functionality that's no longer
available after this removal is the videotoolbox_pixfmt arg, which has been
obsolete for several years.

5 months agoavcodec/vqavideo: Remove dead code
Andreas Rheinhardt [Fri, 26 Nov 2021 19:17:09 +0000 (20:17 +0100)]
avcodec/vqavideo: Remove dead code

Fixes Coverity issue #1493344.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/mobiclip: Rewrite code to make it clearer
Andreas Rheinhardt [Thu, 18 Nov 2021 07:22:38 +0000 (08:22 +0100)]
avcodec/mobiclip: Rewrite code to make it clearer

In order to know that the earlier code did not use uninitialized
values one needs to know that the lowest four bits of each used
value of pframe_block4x4_coefficients_tab do not vanish identically.
E.g. Coverity did not get this and warned about it in ticket #1466632.
Fix this by slightly rewriting the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavfilter/vf_paletteuse: Add missing parentheses
Andreas Rheinhardt [Sat, 27 Nov 2021 13:54:26 +0000 (14:54 +0100)]
avfilter/vf_paletteuse: Add missing parentheses

Fixes a mistake in dea673d0d548c864ec85f9260d8900d944ef7a2a.
GCC emitted a -Wint-in-bool-context warning because of that.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/img2dec: probe JFIF/Exif header
Alex Xu (Hello71) [Thu, 25 Nov 2021 19:36:46 +0000 (14:36 -0500)]
avformat/img2dec: probe JFIF/Exif header

Due to reasons, mpv doesn't pass filename when probing. mpv also sets
default probescore threshold to 26. Since the current jpeg_probe
implementation returns 25 until EOI, it means that the whole image needs
to be probed to succeed. Worse, the whole image is not passed at once;
increasingly large buffers are tried before that. Adding it up together,
if many demuxers are enabled, moderately large JPEG files (few MB) can
take several seconds to open, despite taking less than 1 second to
actually decode.

Therefore, adjust the heuristic to be more optimistic if proper JFIF or
Exif segments are found. While not strictly required, the vast majority
of JPEG-ish files have one or the other or both.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/mjpeg_parser: skip markers after EOI, not by size
Alex Xu (Hello71) [Thu, 25 Nov 2021 19:30:33 +0000 (14:30 -0500)]
avcodec/mjpeg_parser: skip markers after EOI, not by size

The check for m->size >= 0xF000 is intended to avoid skipping too much
garbage data between JPEG frames in test_roman (thus missing next SOI),
but it erroneously also skips valid markers between SOI and SOS. Instead
of this, we should simply skip parsing markers other than SOI after EOI.
That way, we will not accidentally skip over SOI due to some garbage
between frames. There is still a small risk of encountering FFD8 in the
garbage data, but the chance of this is fairly low.

Fixes: https://trac.ffmpeg.org/ticket/8967
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/mpegtsenc: Avoid allocation of AVPacket
Andreas Rheinhardt [Thu, 18 Nov 2021 22:16:12 +0000 (23:16 +0100)]
avformat/mpegtsenc: Avoid allocation of AVPacket

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/movenc: Avoid allocation of AVPacket
Andreas Rheinhardt [Thu, 18 Nov 2021 22:05:27 +0000 (23:05 +0100)]
avformat/movenc: Avoid allocation of AVPacket

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/dashenc: Don't use stack packet
Andreas Rheinhardt [Thu, 18 Nov 2021 21:12:40 +0000 (22:12 +0100)]
avformat/dashenc: Don't use stack packet

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/avformat: Add AVStream parameter to check_bitstream() sig
Andreas Rheinhardt [Thu, 18 Nov 2021 20:48:49 +0000 (21:48 +0100)]
avformat/avformat: Add AVStream parameter to check_bitstream() sig

For most check_bitstream() functions this just avoids having
to dereference s->streams[pkt->stream_index] themselves; but for
meta-muxers it will allow to forward the packet to stream with
a different stream_index (belonging to a different AVFormatContext)
without using a spare packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agohwcontext_vulkan: use correct return value for allocation failure
Lynne [Sat, 27 Nov 2021 03:38:27 +0000 (04:38 +0100)]
hwcontext_vulkan: use correct return value for allocation failure

5 months agoconfigure: fix test_pkg_config_cpp after 1e5acc1b5985c58e
Lynne [Sat, 27 Nov 2021 03:37:39 +0000 (04:37 +0100)]
configure: fix test_pkg_config_cpp after 1e5acc1b5985c58e

5 months agoavformat/rtp: add localaddr for network interface selection
Limin Wang [Fri, 26 Nov 2021 08:55:08 +0000 (16:55 +0800)]
avformat/rtp: add localaddr for network interface selection

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/avidec: Check read_odml_index() for failure
Michael Niedermayer [Sun, 14 Nov 2021 17:23:24 +0000 (18:23 +0100)]
avformat/avidec: Check read_odml_index() for failure

Fixes: Timeout
Fixes: 40950/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6478873068437504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/txd: Move input size checks before allocation
Michael Niedermayer [Sun, 14 Nov 2021 17:09:17 +0000 (18:09 +0100)]
avcodec/txd: Move input size checks before allocation

Fixes: Timeout
Fixes: 40882/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-4893364584054784

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/cafdec: Avoid unnecessary avio_tell() calls
Andreas Rheinhardt [Sat, 20 Nov 2021 12:46:21 +0000 (13:46 +0100)]
avformat/cafdec: Avoid unnecessary avio_tell() calls

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agofftools/ffmpeg: Take type limitations of AVFifo API into account
Andreas Rheinhardt [Sat, 20 Nov 2021 11:14:55 +0000 (12:14 +0100)]
fftools/ffmpeg: Take type limitations of AVFifo API into account

The types used by the AVFifo API are inconsistent:
av_fifo_(space|size)() returns an int; av_fifo_alloc() takes an
unsigned, other parts use size_t. This commit therefore ensures
that the size of the muxing_queue FIFO never exceeds INT_MAX.

While just at it, also make sure not to call av_fifo_size()
unnecessarily often.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoRevert "Disable warnings for casting pointers to integers, there is nothing wrong...
Andreas Rheinhardt [Sat, 20 Nov 2021 16:00:48 +0000 (17:00 +0100)]
Revert "Disable warnings for casting pointers to integers, there is nothing wrong with that."

This reverts commit 5258f64a14713499cf84840b3ab3a1ee7cdcaeb8.
The premise of said commit (that conversions from pointer to int
are ok) is wrong: C99/C11 6.3.2.3 5: "Any pointer type may be converted
to an integer type. [...] If the result cannot be represented in the
integer type, the behavior is undefined." (C90 6.3.4 contains a similar
restriction.) So don't disable -Wpointer-to-int-cast.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavcodec/h263: Fix global-buffer-overflow with noout flag2 set
Andreas Rheinhardt [Sun, 21 Nov 2021 00:57:41 +0000 (01:57 +0100)]
avcodec/h263: Fix global-buffer-overflow with noout flag2 set

h263_get_motion_length() forgot to take an absolute value;
as a consequence, a negative index was used to access an array.
This leads to potential crashes, but mostly it just accesses what
is to the left of ff_mvtab (unless one uses ASAN), thereby defeating
the purpose of the AV_CODEC_FLAG2_NO_OUTPUT because the sizes of
the returned packets differ from the sizes the encoder would actually
have produced.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 months agoavformat/udp: remove local localaddr array
Limin Wang [Wed, 24 Nov 2021 12:09:53 +0000 (20:09 +0800)]
avformat/udp: remove local localaddr array

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavutil/hwcontext_vulkan: fully support customizable validation layers
Wu Jianhua [Fri, 26 Nov 2021 09:10:56 +0000 (17:10 +0800)]
avutil/hwcontext_vulkan: fully support customizable validation layers

Validation layer is an indispensable part of developing on Vulkan.

The following commands is on how to enable validation layers:

ffmpeg -init_hw_device vulkan=0,debug=1,validation_layers=VK_LAYER_LUNARG_monitor+VK_LAYER_LUNARG_api_dump

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
5 months agoconfigure: do not include -lvulkan to cflags in vulkan's pkg-config check
Lynne [Wed, 24 Nov 2021 19:17:09 +0000 (20:17 +0100)]
configure: do not include -lvulkan to cflags in vulkan's pkg-config check

Also fixes the non-pkg-config check.

5 months agoavfilter/af_biquads: add svf transform type
Paul B Mahol [Thu, 25 Nov 2021 23:49:29 +0000 (00:49 +0100)]
avfilter/af_biquads: add svf transform type

5 months agoavformat/mpegts: fix stream index in verbose log message
Marton Balint [Sun, 21 Nov 2021 23:56:05 +0000 (00:56 +0100)]
avformat/mpegts: fix stream index in verbose log message

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavformat/libsrt: add missing version check for snddropdelay
Marton Balint [Fri, 19 Nov 2021 20:26:52 +0000 (21:26 +0100)]
avformat/libsrt: add missing version check for snddropdelay

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavformat/http: prevent truncation of sanitized_path
James Almer [Wed, 9 Jun 2021 20:01:02 +0000 (17:01 -0300)]
avformat/http: prevent truncation of sanitized_path

path1 and sanitized_path are both MAX_URL_SIZE bytes long, yet the latter is
copied from the former with the addition of one extra character.

Should fix a -Wformat-truncation warning.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavformat/rtp: support RGB/BGR for rfc4175
Limin Wang [Wed, 24 Nov 2021 11:14:17 +0000 (19:14 +0800)]
avformat/rtp: support RGB/BGR for rfc4175

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat: suppport YUV 4:2:2 10-bit for rfc4175
Limin Wang [Thu, 11 Nov 2021 14:39:14 +0000 (22:39 +0800)]
avformat: suppport YUV 4:2:2 10-bit for rfc4175

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec: suppport for bitpacked encode
Limin Wang [Thu, 25 Nov 2021 01:45:43 +0000 (09:45 +0800)]
avcodec: suppport for bitpacked encode

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec: rename bitpacked.c to bitpacked_dec.c
Limin Wang [Wed, 24 Nov 2021 08:50:06 +0000 (16:50 +0800)]
avcodec: rename bitpacked.c to bitpacked_dec.c

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtpenc: adds partial support for the RFC 4175
Limin Wang [Sat, 13 Nov 2021 10:06:02 +0000 (18:06 +0800)]
avformat/rtpenc: adds partial support for the RFC 4175

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtpdec_rfc4175: support for yuv420p format
Limin Wang [Wed, 24 Nov 2021 11:05:50 +0000 (19:05 +0800)]
avformat/rtpdec_rfc4175: support for yuv420p format

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtpdec_rfc4175: use rawvideo for uyvy422
Limin Wang [Wed, 10 Nov 2021 11:35:47 +0000 (19:35 +0800)]
avformat/rtpdec_rfc4175: use rawvideo for uyvy422

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agolibvpxdec: Correct linking against variables.
Matt Oliver [Tue, 19 Oct 2021 19:28:53 +0000 (06:28 +1100)]
libvpxdec: Correct linking against variables.

Instead link against the function that returns the correct variable. This fixes linking errors with dlls with msvc.

5 months agoavutil/hwcontext_vulkan: check if created before destroying the instance
Wu Jianhua [Wed, 24 Nov 2021 04:11:53 +0000 (12:11 +0800)]
avutil/hwcontext_vulkan: check if created before destroying the instance

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
5 months agoavutil/hwcontext_vulkan: check if created before destroying the device
Wu Jianhua [Wed, 24 Nov 2021 04:11:52 +0000 (12:11 +0800)]
avutil/hwcontext_vulkan: check if created before destroying the device

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
5 months agoffmpeg: drop obsolete rotation API remnants
Anton Khirnov [Mon, 15 Nov 2021 15:14:49 +0000 (16:14 +0100)]
ffmpeg: drop obsolete rotation API remnants

No demuxers export the "rotate" metadata tag anymore.

5 months agoffmpeg: drop -isync, which did nothing since 2012
Anton Khirnov [Fri, 12 Nov 2021 17:38:03 +0000 (18:38 +0100)]
ffmpeg: drop -isync, which did nothing since 2012

5 months agoffmpeg: drop -sameq/-samequant options
Anton Khirnov [Fri, 12 Nov 2021 17:35:54 +0000 (18:35 +0100)]
ffmpeg: drop -sameq/-samequant options

They did nothing but return an error since 2012.

5 months agoffmpeg: drop the -tvstd option
Anton Khirnov [Fri, 12 Nov 2021 17:34:37 +0000 (18:34 +0100)]
ffmpeg: drop the -tvstd option

It is undocumented and has been deprecated since 2012.

5 months agoffmpeg: drop the -vc option
Anton Khirnov [Fri, 12 Nov 2021 17:34:05 +0000 (18:34 +0100)]
ffmpeg: drop the -vc option

It is undocumented and has been deprecated since 2012.

5 months agoffmpeg: drop the -deinterlace option
Anton Khirnov [Fri, 12 Nov 2021 17:32:25 +0000 (18:32 +0100)]
ffmpeg: drop the -deinterlace option

It is undocumented and has been deprecated since 2013.

5 months agoffmpeg: drop the -intra option
Anton Khirnov [Fri, 12 Nov 2021 17:29:56 +0000 (18:29 +0100)]
ffmpeg: drop the -intra option

It is undocumented and has been marked as deprecated since 2012.

5 months agoffmpeg: do not copy chroma_sample_location from the input stream
Anton Khirnov [Fri, 12 Nov 2021 17:24:07 +0000 (18:24 +0100)]
ffmpeg: do not copy chroma_sample_location from the input stream

It will be set from the supplied AVFrame later on.

5 months agoavcodec/libaomenc: remove the redundant initialization
Limin Wang [Wed, 17 Nov 2021 15:10:58 +0000 (23:10 +0800)]
avcodec/libaomenc: remove the redundant initialization

For dst->have_sse will be assigned by ctx->have_sse soon(code line 23).

Reviewed-by: James Zern <jzern-at-google.com@ffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>