1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

107434 Commits

Author SHA1 Message Date
Andreas Rheinhardt
425b309fa4 avcodec/wrapped_avframe: Don't leak frame metadata, side-data
wrapped_avframe_decode() uses an AVFrame as dst in av_frame_move_ref()
after having called ff_decode_frame_props() to attach side-date
to this very frame. This leaks all the side-data and metadata
that ff_decode_frame_props() has attached.

This happens in various fate-filter-metadata tests since
6ca43a9675.

These particular leaks (which affect metadata-only)
could be fixed by not adding metadata side-data to AVPackets
in libavdevice if they are also available from the AVFrames.
Yet this would break users that extract the metadata from
AVPackets.

The changes to FATE happen because of the way av_dict_set()
works when it overwrites an already existing entry:
It overwrites the entry to be overwritten with the last entry
and adds the new entry at the end. The end result is that
the first entry of the dict is the second-to-last-entry of
the original dict, the last entry of the dict is the last
entry of the old dict and the first count - 2 entries
of the original dict are at positions 1..count - 2 in their
original order.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 21:09:44 +02:00
Andreas Rheinhardt
21b23ceab3 avcodec: Make init-threadsafety the default
and remove FF_CODEC_CAP_INIT_THREADSAFE
All our native codecs are already init-threadsafe
(only wrappers for external libraries and hwaccels
are typically not marked as init-threadsafe yet),
so it is only natural for this to also be the default state.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 20:04:59 +02:00
Andreas Rheinhardt
6aad1204cc avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFE
This is in preparation of switching the default init-thread-safety
to a codec being init-thread-safe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 19:58:56 +02:00
Andreas Rheinhardt
c597510434 avcodec/pnmdec: Mark PHM decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 19:57:01 +02:00
Timo Rothenpieler
90810bb37c Changelog: move ddagrab addition to correct version 2022-07-18 13:52:48 +02:00
Timo Rothenpieler
cb22d5ea3c avfilter/vsrc_ddagrab: fix checkheaders error 2022-07-18 13:08:39 +02:00
Zhao Zhili
811f2f91da avformat/mov: discard data streams with all zero sample_delta
Streams with all zero sample_delta in 'stts' have all zero dts.
They have higher chance be chose by mov_find_next_sample(), which
leads to seek again and again.

For example, GoPro created a 'GoPro SOS' stream:
  Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2022-06-21T08:49:19.000000Z
      handler_name    : GoPro SOS

With 'ffprobe -show_frames http://example.com/gopro.mp4', ffprobe
blocks until all samples in 'GoPro SOS' stream are consumed first.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-07-18 11:06:17 +08:00
Timo Rothenpieler
f611255480 avfilter: add vsrc_ddagrab 2022-07-18 02:08:27 +02:00
Timo Rothenpieler
2f0d45571b avdevice/lavfi: pass forward video framerate 2022-07-18 00:32:57 +02:00
Timo Rothenpieler
6ca43a9675 avdevice/lavfi: output wrapped AVFrames
This avoids an extra copy of potentially quite big video frames.
Instead of copying the entire frames data into a rawvideo packet it
packs the frame into a wrapped avframe packet and passes it through
as-is.
Unfortunately, wrapped avframes are set up to be video frames, so the
audio frames continue to be copied.

Additionally, this enabled passing through video frames that previously
were impossible to process, like hardware frames or other special
formats that couldn't be packed into a rawvideo packet.
2022-07-18 00:32:55 +02:00
Timo Rothenpieler
63ce42019c avutil/hwcontext_d3d11va: add BGRA/RGBA10 formats support
Desktop duplication outputs those
2022-07-18 00:32:14 +02:00
Timo Rothenpieler
6cbb7d673d avutil/hwcontext_d3d11va: update hwctx flags from input texture
At least QSV relies on those being set correctly when deriving a hwctx.
2022-07-18 00:32:14 +02:00
Timo Rothenpieler
30bbc0a624 avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size pools 2022-07-18 00:32:14 +02:00
Timo Rothenpieler
e18c575474 avutil/hwcontext_d3d11va: fix mixed declaration and code 2022-07-18 00:32:14 +02:00
Timo Rothenpieler
91a95e19c9 fftools/ffmpeg: make debug_ts print raw filter output 2022-07-18 00:32:14 +02:00
Marton Balint
64f04df379 avdevice/avdevice: fix return value of avdevice_list_devices()
According to API docs avdevice_list_devices(), avdevice_list_input_sources()
and avdevice_list_input_sinks() should return the number of autodetected
devices on success. This is redundant with AVDeviceInfoList->nb_devices so it
was not noticed earlier that none of the underlying device list functions work
like that.

Let's fix it in generic code to make it in line with the API docs.

Fixes ticket #9820.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-17 22:03:41 +02:00
Leo Izen
940169b8aa avcodec/libjxlenc: avoid hard failure with unspecified primaries
This patch prevents the libjxl encoder wrapper from failing to
encode images when the input video has untagged primaries. It will
instead assume BT.709/sRGB primaries and print a warning.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-07-17 01:46:48 +02:00
Paul B Mahol
a26a2f38e1 avformat/img2dec: fix build 2022-07-16 22:40:44 +02:00
Paul B Mahol
307ab7fe8a avcodec: add Radiance HDR image format support 2022-07-16 21:43:54 +02:00
Martin Storsjö
4136405c86 aarch64: me_cmp: Don't do uaddlv once per iteration
The max height is currently documented as 16; the max difference per
pixel is 255, and a .8h element can easily contain 16*255, thus keep
accumulating in two .8h vectors, and just do the final accumulationat the
end. This should work for heights up to 256.

This requires a minor register renumbering in ff_pix_abs16_xy2_neon.

Before:       Cortex A53    A72    A73   Graviton 3
pix_abs_0_0_neon:   97.7   47.0   37.5   22.7
pix_abs_0_1_neon:  154.0   59.0   52.0   25.0
pix_abs_0_3_neon:  179.7   96.7   87.5   41.2
After:
pix_abs_0_0_neon:   96.0   39.2   31.2   22.0
pix_abs_0_1_neon:  150.7   59.7   46.2   23.7
pix_abs_0_3_neon:  175.7   83.7   81.7   38.2

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-07-16 17:26:17 +03:00
Martin Storsjö
68a03f6424 aarch64: me_cmp: Switch from uabd to uabal in ff_pix_abs16_xy2_neon
Using absolute-difference-accumulate does use twice the amount of
absolute-difference instructions, but avoids the need for the
uaddl and add instructions, reducing the total number of instructions
by 3.

These can be interleaved in the rest of the calculation, to avoid
tight dependencies at the end. Unfortunately, this is marginally
slower on Cortex A53, but faster on A72 and A73.

Before:       Cortex A53    A72    A73   Graviton 3
pix_abs_0_3_neon:  175.7  109.2   92.0   41.2
After:
pix_abs_0_3_neon:  179.7   96.7   87.5   41.2

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-07-16 17:25:54 +03:00
Martin Storsjö
b46de9aba4 aarch64: me_cmp: Interleave some of the loads in ff_pix_abs16_xy2_neon
Before:       Cortex A53    A72    A73   Graviton 3
pix_abs_0_3_neon:  183.7  112.7   97.5   41.2
After:
pix_abs_0_3_neon:  175.7  109.2   92.0   41.2

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-07-16 17:25:44 +03:00
Martin Storsjö
237730f0e0 checkasm: motion: Make the benchmarks more stable
Don't use the last random offset, but a static one.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-07-16 17:25:35 +03:00
Martin Storsjö
02e7853fd9 libavcodec: aarch64: Don't clobber v8 in the h%4 case in ff_pix_abs16_xy2_neon
Checkasm doesn't currently test this codepath.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-07-16 17:25:11 +03:00
Michael Niedermayer
9450f75974 avcodec/lagarith: Check dst/src in zero run code
Fixes: out of array access
Fixes: 48799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-4764457825337344

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-07-14 20:10:59 +02:00
Gyan Doshi
882aac99d2 ffmpeg: add option -isync
This is a per-file input option that adjusts an input's timestamps
with reference to another input, so that emitted packet timestamps
account for the difference between the start times of the two inputs.

Typical use case is to sync two or more live inputs such as from capture
devices. Both the target and reference input source timestamps should be
based on the same clock source.

If either input lacks starting timestamps, then no sync adjustment is made.
2022-07-14 15:48:24 +05:30
Hubert Mazur
01e190dc99 lavc/aarch64: Add pix_abs16_x2 neon implementation
Provide neon implementation for pix_abs16_x2 function.

Performance tests of implementation are below.
 - pix_abs_0_1_c: 283.5
 - pix_abs_0_1_neon: 39.0

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

Signed-off-by: Hubert Mazur <hum@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-07-13 23:25:22 +03:00
Michael Niedermayer
a0994440e8 RELEASE: update after 5.1 branch 2022-07-13 00:31:42 +02:00
Michael Niedermayer
5cd041f463 Changelog: Add version <next>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-13 00:29:57 +02:00
Michael Niedermayer
fd26b07e8b Bump versions after 5.1 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-13 00:29:05 +02:00
Michael Niedermayer
6f1b144358 Bump Versions for 5.1 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-13 00:27:37 +02:00
Michael Niedermayer
3421476eb5 doc/APIchanges: Add 5.1 branch cutpoint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-13 00:04:15 +02:00
Michael Niedermayer
510cd7d11b doc/APIchanges: Fill in missing things
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 23:58:55 +02:00
Michael Niedermayer
eafe641d13 doc/APIchanges: Extend hash which has become ambiguous
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 23:58:31 +02:00
Michael Niedermayer
f7dd408d64 avcodec/h264dec: Skip late SEI
Fixes: Race condition
Fixes: clusterfuzz-testcase-minimized-mediasource_MP2T_AVC_pipeline_integration_fuzzer-6282675434094592

Found-by: google ClusterFuzz
Tested-by: Dan Sanders <sandersd@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
1537f40516 avcodec/sbrdsp_fixed: Fix integer overflows in sbr_qmf_deint_neg_c()
Fixes: signed integer overflow: 2147483645 + 16 cannot be represented in type 'int'
Fixes: 46993/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-4759025234870272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
4f9ee4bf43 avcodec/pixlet: consider minimum plane header in the minimal packet size
Fixes: Timeout
Fixes: 46956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5698161106092032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
dd6040675e avfilter/vf_signature: Fix integer overflow in filter_frame()
Fixes: CID1403233

The second of the 2 changes may be unneeded but will help coverity

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
73c0fd27c5 avformat/rtsp: break on unknown protocols
This function needs more cleanup and it lacks error handling

Fixes: use of uninitialized memory
Fixes: CID700776

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
9c5250a561 avcodec/hevcdsp_template: stay within tables in sao_band_filter()
Fixes: out of array read
Fixes: 47875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5719393113341952

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
a5625fecd7 tools/target_dec_fuzzer: adjust threshold for flic
Fixes: Timeout
Fixes: 48017/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5920256150863872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
f20295cd81 tools/target_dec_fuzzer: Adjust threshold for AASC
Fixes: Timeout
Fixes: 47919/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AASC_fuzzer-5176435830030336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
75f3d1b822 avcodec/tiff: Check pixel format types for dng
Fixes: out of array access
Fixes: 48271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6149705769287680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
675e18e0fb tools/target_dec_fuzzer: adjust threshold for cinepak
Fixes: Timeout
Fixes: 48158/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5986526573494272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
e690d4edf5 avcodec/qpeldsp: copy less for the mc0x cases
Fixes: out of array access
Fixes: 47936/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5745039940124672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
db31b3ea86 avformat/aaxdec: Check for empty segments
Fixes: Timeout
Fixes: 48154/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5149094353436672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
78b95530f0 avcodec/ffv1dec: Check for min packet size
Fixes: Timeout
Fixes: 48619/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5793597923917824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
ba0c3d1db4 avformat/avienc: Check video dimensions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
b4431399ec avcodec/ffv1dec: Limit golomb rice coded slices to width 8M
This limit is possibly not reachable due to other restrictions on buffers but
the decoder run table is too small beyond this, so explicitly check for it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00
Michael Niedermayer
248d981071 tools/target_dec_fuzzer: Adjust threshold for LOCO
Fixes: Timeout
Fixes: 48584/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5741269015461888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 21:55:22 +02:00