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

109811 Commits

Author SHA1 Message Date
Paul B Mahol
64b242d030 avcodec/wavarc: fix 8bit decoding 2023-02-06 18:09:11 +01:00
Paul B Mahol
d7c2da1f8d avcodec/wavarc: check that nb_samples is valid 2023-02-06 16:37:20 +01:00
Anton Khirnov
bdc76f467f lavu/frame: deprecate reordered_opaque
It is only used in libavcodec, where it's been superseded by
AV_CODEC_CAP_COPY_OPAQUE.
2023-02-04 13:40:20 +01:00
Anton Khirnov
d02340b9e3 lavc/decode: allow using AV_CODEC_FLAG_COPY_OPAQUE for decoding
Use it to propagate AVPacket.opaque[_ref] to corresponding AVFrame
fields. This is a more convenient alternative to reordered_opaque.
2023-02-04 13:14:20 +01:00
Anton Khirnov
82da22066c lavc: deprecate CrystalHD decoders
The hardware is old and not relevant today. The decoders also have many
special quirks and are effectively unmaintained.
2023-02-04 13:12:28 +01:00
Paul B Mahol
4b922218e9 avformat/lafdec: check for not supported bpp 2023-02-04 09:40:34 +01:00
Paul B Mahol
332a4d798d avformat/lafdec: error out on partial packet header read 2023-02-04 09:40:34 +01:00
Paul B Mahol
4e3e70c19d avformat: add WavArc demuxer 2023-02-04 09:37:19 +01:00
Paul B Mahol
651da91915 avcodec: add WavArc decoder 2023-02-04 09:36:01 +01:00
Jan Ekström
9a820ec8b1 ffmpeg: add video heartbeat capability to fix_sub_duration
Splits the currently handled subtitle at random access point
packets that can be configured to follow a specific output stream.
Currently only subtitle streams which are directly mapped into the
same output in which the heartbeat stream resides are affected.

This way the subtitle - which is known to be shown at this time
can be split and passed to muxer before its full duration is
yet known. This is also a drawback, as this essentially outputs
multiple subtitles from a single input subtitle that continues
over multiple random access points. Thus this feature should not
be utilized in cases where subtitle output latency does not matter.

Co-authored-by: Andrzej Nadachowski <andrzej.nadachowski@24i.com>
Co-authored-by: Bernard Boulay <bernard.boulay@24i.com>

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-02-03 16:17:29 +02:00
Jan Ekström
746d27455b ffmpeg: move decoded frame counter from after post-processing to decode
This way we can call process_subtitles without causing the decoded
frame counter to get bumped.

Additionally, this now takes into mention all of the decoded
subtitle frames without fix_sub_duration latency/buffering, or filtering
out decoded reset/end subtitles without any rendered rectangles, which
matches the original intent in 4754345027
.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-02-03 12:21:02 +02:00
Jan Ekström
fcc50674de ffmpeg: refactor post-decoding steps for subtitles into a function
This enables us to later call this when generating additional
subtitles for splitting purposes.

Co-authored-by: Andrzej Nadachowski <andrzej.nadachowski@24i.com>

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-02-03 12:21:02 +02:00
Haihao Xiang
b92028346c lavfi/deinterlace_qsv: re-use VPPContext for deinterlace_qsv filter
QSVDeintContext and VPPContext have the same base context, and all
features in deinterlace_qsv are implemented in vpp_qsv filter,  so
deinterlace_qsv can be taken as a special case of vpp_qsv filter, and we
may use VPPContext with a different option array, preinit callback and
support pixel formats to implement deinterlace_qsv, then remove
QSVDeintContext.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Haihao Xiang
a48c95d3c9 lavfi/deinterlace_qsv: simplify deinterlace_qsv filter
Like what we did for scale_qsv filter, we use QSVVPPContext as a base
context to manage MFX session for deinterlace_qsv filter.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Haihao Xiang
077e634965 lavfi/vpp_qsv: add rate option
This is used to control the output at frame rate or field rate when
deinterlace is expected and framerate is not specified.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:57 +08:00
Anton Khirnov
7d49fef8b4 lavc/vaapi_encode: fix propagating durations and opaques
input_image is freed by the time the output packet is constructed, so we
need to store copies in VAAPIEncodePicture.
2023-02-02 10:42:39 +08:00
Michael Niedermayer
f4b4e16641
libavformat/lafdec: free data
Fixes: memleak

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-01 20:23:37 +01:00
Michael Niedermayer
ad95d9c855
avformat/lafdec: Check if all data was read
Fixes: OOM
Fixes: 54572/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-4974038870523904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-01 20:23:37 +01:00
Michael Niedermayer
35871c26d2
tools/target_dec_fuzzer: Adjust threshold for BONK
The decoder is quite slow with max n taps
Fixes: Timeout
Fixes: 54063/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5087362407596032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-01 20:23:36 +01:00
Lynne
bbe95f7353
x86: replace explicit REP_RETs with RETs
From x86inc:
> On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
> a branch or a branch target. So switch to a 2-byte form of ret in that case.
> We can automatically detect "follows a branch", but not a branch target.
> (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)

x86inc can automatically determine whether to use REP_RET rather than
REP in most of these cases, so impact is minimal. Additionally, a few
REP_RETs were used unnecessary, despite the return being nowhere near a
branch.

The only CPUs affected were AMD K10s, made between 2007 and 2011, 16
years ago and 12 years ago, respectively.

In the future, everyone involved with x86inc should consider dropping
REP_RETs altogether.
2023-02-01 04:23:55 +01:00
Paul B Mahol
fc9a3b584d avcodec/mlpdec: parse and use substream info bits 2023-01-31 18:45:22 +01:00
Paul B Mahol
00994e8be1 avcodec: add media100_to_mjpegb bitstream filter and use it 2023-01-31 17:06:29 +01:00
Leo Izen
fb823161a8
avcodec/libjxl: respect AVCodecContext->bits_per_raw_sample
libjxl only accepts 16-bit buffers with its API, but it can
accept 9-bit to 15-bit input via a 16-bit buffer, provided the flag
is set declaring the buffer to be of the respective significant depth.

Likewise, it can only provide pixel data on decode as a 16-bit buffer
(if higher than 8) but does provide the metadata tagging the actual bit
depth.

This commit causes libjxlenc.c and libjxldec.c to respect this metadata
and tag/read it accordingly from AVCodecContext->bits_per_raw_sample.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-01-31 10:39:48 -05:00
Cameron Gutman
669ff26bc2 avcodec/mfenc: fix double-free on init failure
mfenc sets FF_CODEC_CAP_INIT_CLEANUP, so calling mf_close() on
failure inside mf_init() results in a double-free.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-31 14:39:25 +02:00
Martin Storsjö
431f6260ac mov: Reduce the verbosity of the warning about fragmented MP4 vs advanced edit lists
Only warn if the advanced_editlist option is enabled (it is enabled
by default though) so we don't print one warning for each track, and
demote the warning to AV_LOG_LEVEL_VERBOSE; this message does get
generated whenever parsing a fragmented MP4 file, regardless of
whether the file actually uses multiple edits or not.

Later when parsing the mov structures, the demuxer does warn if
the file did contain multiple edits which would require the
advanced_editlist option enabled for decoding correctly.

Adjust the warning message for the case when the file seemed like it
actually would have needed handling of advanced edit lists, to
reflect the fact that it doesn't help to try set the option as
it has been automatically disabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-31 14:29:08 +02:00
Martin Storsjö
01f58f3646 lavu/video_enc_params: Avoid relying on an undefined C construct
The construct of using offsetof on a (potentially anonymous) struct
defined within the offsetof expression, while supported by all
current compilers, has been declared explicitly undefined by the
C standards committee [1].

Clang recently got a change to identify this as an issue [2];
initially it was treated as a hard error, but it was soon after
softened into a warning under the -Wgnu-offsetof-extensions option
(not enabled automatically as part of -Wall though).

Nevertheless - in this particular case, it's trivial to fix the
code not to rely on the construct that the standards committee has
explicitly called out as undefined.

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
[2] https://reviews.llvm.org/D133574

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-31 14:22:54 +02:00
Anton Khirnov
806ecace91 fftools/ffmpeg: support input frame params in encoding stats 2023-01-31 09:09:23 +01:00
Anton Khirnov
61afbc2376 fftools/ffmpeg: use correct IO context for -enc_stats_post 2023-01-31 09:09:11 +01:00
Anton Khirnov
5c36f4ef84 lavu/opt: use AV_DICT_MULTIKEY in av_opt_set_dict2()
If the dictionary provided on input contains multiple entries for an
option (relevant for flags modifying the previous value with '+' or
'-') and the option is not found in the target object, only the last
entry would be returned to the caller.

Pass AV_DICT_MULTIKEY to av_dict_set() to make sure all such entries are
returned.
2023-01-31 09:08:03 +01:00
Anton Khirnov
e3a99041b8 lavc: add null codecs
They discard all input without ever returning any output. Useful for
development.
2023-01-31 09:00:56 +01:00
Paul B Mahol
229f3259f8 doc/general_contents: sync with available decoders and demuxers 2023-01-30 21:42:39 +01:00
Paul B Mahol
fa42575ffa avformat: add XMD demuxer 2023-01-30 21:02:48 +01:00
Paul B Mahol
280e6e93fc avcodec: add ADPCM XMD decoder 2023-01-30 20:57:37 +01:00
Niklas Haas
9bfdd8524e avfilter/vf_libplacebo: suppress cast warning
This warning was introduced when ee65039 removed the cast.
2023-01-30 20:34:55 +01:00
Paul B Mahol
5508e04c7b avfilter/vf_colorlevels: add support for gbrpf32 format 2023-01-30 18:42:49 +01:00
Haihao Xiang
2d202985b7 lavfi/vpp_qsv: factor out the code for filter definition
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 09:08:04 +08:00
Haihao Xiang
9c09fb232b lavfi/scale_qsv: re-use VPPContext for scale_qsv filter
QSVScaleContext and VPPContext have the same base context, and all
features in scale_qsv are implemented in vpp_qsv filter,  so scale_qsv
can be taken as a special case of vpp_qsv filter, and we may use
VPPContext with a different option array, preinit callback and supported
pixel formats to implement scale_qsv then remove QSVScaleContext

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
Haihao Xiang
d66312cf27 lavfi/scale_qsv: simplify scale_qsv filter
Use QSVVPPContext as a base context of QSVScaleContext, hence we may
re-use functions defined for QSVVPPContext to manage MFX session for
scale_qsv filter.

In addition, system memory has been taken into account in
QSVVVPPContext, we may add support for non-QSV pixel formats in the
future.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
galinart
5002829416 libavcodec/qsvenc: enable Hyper Encode
Hyper Encode uses Intel integrated and discrete graphics on one system
to accelerate encoding of a single video stream.
Depending on the selected parameters and codecs, performance gain on AlderLake iGPU + ARC Gfx up to 1.6x.

More information: https://www.intel.co.uk/content/www/uk/en/architecture-and-technology/adaptix/deep-link.html
Developer guide: https://github.com/oneapi-src/oneVPL-intel-gpu/blob/main/doc/HyperEncode_FeatureDeveloperGuide.md

Hyper Encode is supported only on Windows and requires D3D11 and oneVPL.

To enable Hyper Encode need to specify:
-Hyper Encode mode (-dual_gfx on or dual_gfx adaptive)
-Encoder: h264_qsv or hevc_qsv
-BRC: VBR, CQP or ICQ
-Lowpower mode (-low_power 1)
-Closed GOP for AVC or strict GOP for HEVC -idr_interval = 0 used by default

Depending on the encoding parameters, the following parameters may need
to be adjusted:
-g recommended >= 30 for better performance
-async_depth recommended >= 30 for better performance
-extra_hw_frames recommended equal to async_depth value
-bf recommended = 0 for better performance

In the cases with fast encoding (-preset veryfast) there may be no
performance gain due to the fact that the decode is slower than the encode.

Command line examples:

ffmpeg.exe -init_hw_device qsv:hw,child_device_type=d3d11va,child_device=0 -v verbose -y -hwaccel qsv -extra_hw_frames 60 -async_depth 60 -c:v h264_qsv -i bbb_sunflower_2160p_60fps_normal.mp4
-async_depth 60 -c:v h264_qsv -preset medium -g 60 -low_power 1 -bf 0 -dual_gfx on output.h265

Signed-off-by: galinart <artem.galin@intel.com>
2023-01-30 08:48:58 +08:00
Haihao Xiang
aecfec6f80 avfilter: add VA-API variants of the stack filters
Include hstack_vaapi, vstack_vaapi and xstack_vaapi. They may accept
input streams with different sizes.  libva2 (VA-API 1.0+) is required.

Example:
$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.h265 -filter_complex
"[0:v][0:v]hstack_vaapi" -c:v h264_vaapi out.h264

$ ffmpeg \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-filter_complex "[0:v][1:v][2:v][3:v]xstack_vaapi=inputs=4:fill=0x000000:layout=0_0_1920x1080|w0_0_1920x1080|0_h0_1920x1080|w0_h0_1920x1080" \
-c:v hevc_vaapi out.h265

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
David Rosca
4e3b6270c6 vaapi_encode_h264: Only set pic_order_cnt_type to 0 with B-frames
v3: pic_order_cnt steps by 2
2023-01-30 08:48:32 +08:00
Marton Balint
af606c232a avformat/mxfdec: check number of index table entires more strictly
Let's ignore the index table if the number of index entries does not match the
index duration (or the special AVID index entry counts).

Fixes: OOM
Fixes: 50551/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6607795234930688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-29 18:58:30 +01:00
Marton Balint
41dfa629d7 avformat/mxfdec: support Avid files with an extra index entry
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-29 18:58:30 +01:00
Marton Balint
6aff3c5e43 avformat/mxfdec: check index entry array size
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-29 18:58:30 +01:00
Paul B Mahol
757218564d avcodec/dvdsubenc: remove duplicated ; 2023-01-29 13:10:20 +01:00
Paul B Mahol
65c0b16961 avcodec/ftr: use more portable return error code 2023-01-29 13:09:17 +01:00
Anton Khirnov
7cf161abe5 lavc/libaomenc: pass through frame durations to encoded packets 2023-01-29 09:23:17 +01:00
Anton Khirnov
d87055107d lavc/libx265: pass through frame durations to encoded packets 2023-01-29 09:23:17 +01:00
Anton Khirnov
a172b33ebf lavc/libx264: pass through frame durations to encoded packets 2023-01-29 09:23:17 +01:00
Anton Khirnov
782127d876 lavc/libwebpenc_animencoder: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-01-29 09:23:17 +01:00