1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

107658 Commits

Author SHA1 Message Date
Michael Niedermayer
9b23eb8a10 tools/target_dec_fuzzer: Adjust threshold for MWSC
Fixes: Timeout
Fixes: 49172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MWSC_fuzzer-5213749102903296

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:27:38 +02:00
Michael Niedermayer
8ed78486fc avformat/asfdec_f: Use 64bit for packet start time
Fixes: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int'
Fixes: 49014/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6314973315334144

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-21 19:27:32 +02:00
Michael Niedermayer
614a4d1476 avcodec/exr: Check x/ysize
Fixes: OOM
Fixes: 48911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6352002510094336

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-21 19:27:27 +02:00
Michael Niedermayer
f7d510b33f avcodec/ffv1dec: Fix AC_GOLOMB_RICE min size check
Found-by: mkver

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 08:54:22 +02:00
Michael Niedermayer
15785e044e avcodec/ffv1dec: consider run increase in minimal golomb frame size
Fixes: Timeout
Fixes: 49160/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5672826144686080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-20 16:13:20 +02:00
Michael Niedermayer
3592b05c84 tools/target_dec_fuzzer: Adjust threshold for MMVIDEO
Fixes: Timeout
Fixes: 49003/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MMVIDEO_fuzzer-5550368423018496

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-07-20 16:13:20 +02:00
Michael Niedermayer
282589771a avcodec/mpeg4videoenc: fix encoding long frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-20 16:13:20 +02:00
Michael Niedermayer
3c43a7a354 avcodec/hdrdec: lines can be empty
Fixes: infinite loop
Fixes: 49223/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HDR_fuzzer-6603308596330496

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-20 16:12:08 +02:00
Wenbin Chen
636a629ff6 libavfilter/vf_overlay_qsv: Use format of first input to set output format for overlay_qsv
overlay_qsv hard coded to use nv12 as output format. Now use the format
of the first input to set output format.

For detailed information of supported format on different platform,
please see the "composition" rows in "Video Processing Features" at
below link:
https://www.intel.com/content/www/us/en/develop/documentation/media-capabilities-of-intel-hardware/top.html

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-07-20 12:35:23 +08:00
Wenbin Chen
52ad617af5 libavcodec/qsvenc: Use parameter from AVCodecContext to reset qsv codec
Using parameter from AVCodecContext to reset qsv codec is more suitable
for MFXVideoENCODE_Reset()'s usage. Per-frame metadata is more suitable
for the usage of mfxEncodeCtrl being passed to
MFXVideoENCODE_EncodeFrameAsync(). Now change it to use the value
from AVCodecContext.
Because q->param is passed to both "in" and "out" parameters when call
MFXVideoENCODE_Query(), the value in q->param may be changed. New
variables are added to store old configuration, so that we can detect
real parameter change.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-07-20 12:35:23 +08:00
Wenbin Chen
8b82c9cdc7 libavcodec/qsvenc: Change the parameter log to be thread safe
Dividing one line log into several av_log() call is not thread safe. Now
merge these strings into one av_log() call.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-07-20 12:35:23 +08:00
Timo Rothenpieler
926f355aff avfilter/vsrc_ddagrab: check for existence of DPI_AWARENESS_CONTEXT
Apparently some (broken?) Windows SDK versions define IDXGIOutput5
but not DPI_AWARENESS_CONTEXT. So we need to explicitly check for its
existence.
2022-07-19 13:57:38 +02:00
Anton Khirnov
ecd0a7c5bd lavfi/vf_showinfo: print frame durations 2022-07-19 12:27:18 +02:00
Anton Khirnov
9c0401bd59 tests/api: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:18 +02:00
Anton Khirnov
de3a135e0f ffmpeg: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:18 +02:00
Anton Khirnov
ccb94ec5cf ffprobe: print AVFrame.duration 2022-07-19 12:27:18 +02:00
Anton Khirnov
2d90fc89f2 lavd: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov
7d9ee6741c lavf: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov
357ba45a5c lavfi: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov
ac2cda4296 lavc: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov
4397f9a5a0 lavu/frame: add a duration field to AVFrame
The only duration field currently present in AVFrame is pkt_duration,
which is semantically restricted to those frames that are output by
decoders.

Add a new field that stores the frame's duration without regard for how
that frame was produced. Deprecate pkt_duration.
2022-07-19 12:27:17 +02:00
Matthieu Bouron
0a6bb7da55 swscale: add NV16 input/output
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-07-19 12:20:16 +02:00
Timo Rothenpieler
61c151a098 avfilter/vsrc_ddagrab: dynamically load SetThreadDpiAwarenessContext
It's a Windows 10 only function, and its presence alone prevents the
binary from loading on older Windows versions.
2022-07-19 01:29:00 +02:00
Andreas Rheinhardt
d72a671c60 avcodec/wrapped_avframe: Don't presume AVPacket to be writable
It need not be writable; in fact, it is often not writable even if
the packet sent to the decoder was writable, because the generic code
calls av_packet_ref() on it. It is never writable if a user
drains the decoder after every packet, because in this case the decode
callback is called from avcodec_send_packet().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 21:10:16 +02:00
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