Commit Graph

109735 Commits

Author SHA1 Message Date
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
Anton Khirnov 476ec77870 lavc/libwebpenc_animencoder: stop setting dts unnecessarily
WebP does not have reordering, so dts=pts is set by the generic code.
2023-01-29 09:23:17 +01:00
Anton Khirnov fbdba9a1a6 lavc/vaapi_encode*: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
Except for the mjpeg_vaapi encoder, which is already handled
generically.
2023-01-29 09:23:17 +01:00
Anton Khirnov c44a3dba9e lavc/mpegvideo_enc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
For delay-capable encoders, i.e. mpeg12 and mpeg4video. Generic code in
encode.c already handles this for all other mpegvideo encoders.
2023-01-29 09:23:17 +01:00
Anton Khirnov 8a60a9c74c lavc/libtheoraenc: stop setting dts unnecessarily
Theora is not marked as supporting reordering, so dts will be set from
pts by the generic code.
2023-01-29 09:23:17 +01:00
Anton Khirnov 2bb20e98ba lavc/libtheoraenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-01-29 09:23:17 +01:00
Anton Khirnov b7f0c8889e lavc/pngenc: stop setting dts unnecessarily for APNG
APNG is not marked as supporting reordering, so dts will be set from pts
by the generic code.
2023-01-29 09:23:17 +01:00
Anton Khirnov bbbafab0ee lavc/pngenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-01-29 09:23:17 +01:00
Anton Khirnov 3553809703 lavc/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-01-29 09:23:17 +01:00
Anton Khirnov 1b25eb65cd lavc/librav1e: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-01-29 09:23:16 +01:00
Anton Khirnov a1a80f2e64 lavc/encode: pass through frame durations to encoded packets
The generic code can only handle the no-delay case. Encoders with delay
need to be handled individually, which will be done in the following
commits.
2023-01-29 09:23:15 +01:00
Anton Khirnov 8d73f3ce56 lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encoders
Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
2023-01-29 09:22:57 +01:00
Anton Khirnov 5c0348f3d6 lavc: add a codec flag for propagating opaque from frames to packets
This is intended to be a more convenient replacement for
reordered_opaque.

Add support for it in the two encoders that offer
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE: libx264 and libx265. Other
encoders will be supported in future commits.
2023-01-29 09:18:14 +01:00
Anton Khirnov d0c8ca961d lavc: add a private cap for fake-delay encoders
Some encoders (ffv1, flac, adx) are marked with AV_CODEC_CAP_DELAY onky
in order to be flushed at the end, otherwise they behave as no-delay
encoders.

Add a capability to mark these encoders. Use it for setting pts
generically.
2023-01-29 09:14:13 +01:00
Anton Khirnov e5e29eda5a lavc/avcodec: improve AV_CODEC_FLAG_RECON_FRAME doxy
Do not break a sentence on a period after "i.e.".

Link to the definition of AV_CODEC_CAP_ENCODER_RECON_FRAME.
2023-01-29 09:14:13 +01:00
Anton Khirnov 1f9828bb8c lavc/avcodec: improve enc/dec API doxy
Change return value descriptions into lists of @retval
2023-01-29 09:14:13 +01:00
Anton Khirnov 935964bd41 doc/ffmpeg: drop non-existent -dc option 2023-01-29 09:12:40 +01:00
Anton Khirnov 9b5036fabd fftools/ffmpeg: add an AVClass to MuxStream/OutputStream
Use it for logging. This makes log messages related to this output
stream more consistent.
2023-01-29 09:12:22 +01:00
Anton Khirnov d2c983c213 fftools/ffmpeg: add an AVClass to Muxer/OutputFile
Use it for logging. This makes log messages related to this output file
more consistent.
2023-01-29 09:10:57 +01:00
Anton Khirnov 425b2c4a56 fftools/ffmpeg: add options for writing encoding stats
Similar to -vstats, but more flexible:
- works for audio as well as video
- frame and/or packet information
- user-specifiable format
2023-01-29 09:09:59 +01:00
Michael Niedermayer b95b2c8492
avcodec/utils: use 32pixel alignment for bink
bink supports 16x16 blocks in chroma planes thus we need to allocate enough.
Fixes: out of array access
Fixes: 55026/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-6013915371012096
Reviewed-by: Peter Ross <pross@xvid.org>

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-01-28 20:50:01 +01:00
Andreas Rheinhardt 35f837710c avfilter/vf_ssim360: Constify AVFilter
This brings ff_vf_ssim360 in line with its declaration in allfilters.c;
this discrepancy is actually undefined behaviour.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:19:53 +01:00
Andreas Rheinhardt 5fd4d3faf1 avfilter/vf_ssim360: Don't initialize twice
The FILTER_INPUTS and FILTER_OUTPUTS macros already set
AVFilter.(inputs|outputs); Clang therefore emits a warning for
this: "initializer overrides prior initialization of this subobject
[-Winitializer-overrides]"

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:19:24 +01:00
Andreas Rheinhardt 54659e329e avfilter/vf_ssim360: Fix left-shift of negative value
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:18:57 +01:00
Martin Storsjö c0cf2c4786 lavfi/vf_ssim360: Fix compilation with MSVC
Don't use "static const" for compile time float constants, but use
defines. This fixes the following error:

src/libavfilter/vf_ssim360.c(549): error C2099: initializer is not a constant

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-28 18:20:19 +02:00
Shannon Chen ed519a3690 lavfi: Add vf_ssim360 filter
Customized SSIM for various projections (and stereo formats) of 360 images and videos.

Further contributions by:
Ashok Mathew Kuruvilla
Matthieu Patou
Yu-Hui Wu
Anton Khirnov

Suggested-By: ffmpeg@fb.com
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-01-28 12:00:27 +01:00
Paul B Mahol ac37b2c2b1 avfilter/f_reverse: set output frame duration 2023-01-27 23:53:26 +01:00