Commit Graph

114278 Commits

Author SHA1 Message Date
Andreas Rheinhardt
a7ad5d4d10 avformat/iamfenc: Remove always-false check
This muxer does not have the AVFMT_NOSTREAMS flag; therefore
it is checked generically that there is at least a stream.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-20 10:17:37 +01:00
Mark Thompson
7f4b8d2f5e ffmpeg: set extra_hw_frames to account for frames held in queues
Since e0da916b8f the ffmpeg utility has
held multiple frames output by the decoder in internal queues without
telling the decoder that it is going to do so.  When the decoder has a
fixed-size pool of frames (common in some hardware APIs where the output
frames must be stored as an array texture) this could lead to the pool
being exhausted and the decoder getting stuck.  Fix this by telling the
decoder to allocate additional frames according to the queue size.
2024-03-19 22:56:56 +00:00
Marton Balint
7251f90972 fftools/ffplay: use correct buffersink channel layout parameters
Regression since 0995e1f1b3.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-19 20:48:22 +01:00
Stefano Sabatini
0cd13ad674 doc/muxers/gif: apply consistency fixes 2024-03-19 17:23:20 +01:00
Stefano Sabatini
f7d560e919 doc/muxers/flv: apply misc consistency fixes 2024-03-19 17:23:20 +01:00
Stefano Sabatini
9afd9bb5c5 doc/muxers: add flac 2024-03-19 17:23:05 +01:00
Marth64
0b342a2f15 avcodec/mpeg12dec: extract only one type of CC substream
In MPEG-2 user data, there can be different types of Closed Captions
formats embedded (A53, SCTE-20, or DVD). The current behavior of the
CC extraction code in the MPEG-2 decoder is to not be aware of
multiple formats if multiple exist, therefore allowing one format
to overwrite the other during the extraction process since the CC
extraction shares one output buffer for the normalized bytes.

This causes sources that have two CC formats to produce flawed output.
There exist real-world samples which contain both A53 and SCTE-20 captions
in the same MPEG-2 stream, and that manifest this problem. Example of symptom:
THANK YOU (expected) --> THTHANANK K YOYOUU (actual)

The solution is to pick only the first CC substream observed with valid bytes,
and ignore the other types. Additionally, provide an option for users
to manually "force" a type in the event that this matters for a particular
source.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-19 15:52:05 +01:00
James Almer
53dd31497b avformat/matroska: use named constants for ITU-T T.35 metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-19 10:49:20 -03:00
James Almer
61519cc654 avcodec/libdav1d: use named constants for ITU-T T.35 metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-19 09:44:59 -03:00
James Almer
a1f714d197 avcodec/h2645_sei: use named constants for ITU-T T.35 metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-19 09:44:59 -03:00
James Almer
4ca5d45193 avcodec/av1dec: use named constants for ITU-T T.35 metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-19 09:44:59 -03:00
Wenbin Chen
f4e0664fd1 libavfi/dnn: add LibTorch as one of DNN backend
PyTorch is an open source machine learning framework that accelerates
the path from research prototyping to production deployment. Official
website: https://pytorch.org/. We call the C++ library of PyTorch as
LibTorch, the same below.

To build FFmpeg with LibTorch, please take following steps as
reference:
1. download LibTorch C++ library in
 https://pytorch.org/get-started/locally/,
please select C++/Java for language, and other options as your need.
Please download cxx11 ABI version:
 (libtorch-cxx11-abi-shared-with-deps-*.zip).
2. unzip the file to your own dir, with command
unzip libtorch-shared-with-deps-latest.zip -d your_dir
3. export libtorch_root/libtorch/include and
libtorch_root/libtorch/include/torch/csrc/api/include to $PATH
export libtorch_root/libtorch/lib/ to $LD_LIBRARY_PATH
4. config FFmpeg with ../configure --enable-libtorch \
 --extra-cflag=-I/libtorch_root/libtorch/include \
 --extra-cflag=-I/libtorch_root/libtorch/include/torch/csrc/api/include \
 --extra-ldflags=-L/libtorch_root/libtorch/lib/
5. make

To run FFmpeg DNN inference with LibTorch backend:
./ffmpeg -i input.jpg -vf \
dnn_processing=dnn_backend=torch:model=LibTorch_model.pt -y output.jpg

The LibTorch_model.pt can be generated by Python with torch.jit.script()
api. https://pytorch.org/tutorials/advanced/cpp_export.html. This is
pytorch official guide about how to convert and load torchscript model.
Please note, torch.jit.trace() is not recommanded, since it does
not support ambiguous input size.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-03-19 14:48:58 +08:00
Michael Niedermayer
d24b136f53
tools/target_dec_fuzzer: adjust threshold for AV_CODEC_ID_IFF_ILBM
Fixes: timeout
Fixes: 66444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-4812862400823296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-19 04:10:48 +01:00
Michael Niedermayer
af91b1b366
tools/target_dem_fuzzer: add libavformat/demux.h
needed for FFInputFormat

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-19 04:10:48 +01:00
Nicolas Gaullier
b96571df3a
doc/fate: advise on --assert-level=2
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-19 04:10:48 +01:00
Andreas Rheinhardt
d1e446f2e1 fate/atrac: Add atrac->aea, atrac->matroska remux tests
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-19 03:17:12 +01:00
Andreas Rheinhardt
7e41a658f5 avformat/aeadec: Use sample rate as time base
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-19 02:54:24 +01:00
Andreas Rheinhardt
103965053b avformat/aeadec: Export title
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-19 02:54:13 +01:00
Haihao Xiang
d296c8689d lavu/hwcontext_vulkan: check PCI ID if possible
Otherwise the derived device and the source device might have different
PCI ID in a multiple-device system.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-19 09:37:39 +08:00
Stefano Sabatini
39087e739c doc/muxers: add fits 2024-03-18 17:59:45 +01:00
Stefano Sabatini
9754e1f532 doc/muxers: add filmstrip 2024-03-18 17:59:32 +01:00
Stefano Sabatini
38c18dca63 doc/muxers: add film_cpk 2024-03-18 17:59:26 +01:00
Stefano Sabatini
be37ce70fe doc/muxers: add ffmetadata 2024-03-18 17:59:19 +01:00
Timo Rothenpieler
030f4925b8 avutil/hwcontext_d3d11va: add logging to dxgi debug interfaces 2024-03-18 13:28:30 +01:00
Timo Rothenpieler
6e78d92399 avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
A lot of modern stuff straight up fails on the old 1.0 factory, which is
masked by the fact that it's only used when an explicit adapter is
specified.
2024-03-18 13:28:30 +01:00
Timo Rothenpieler
ae5453503d avutil/hwcontext_d3d11va: remove check for d3d11 debug layer dll
At least on latest Win 11 and Visual Studio 2022, that DLL does not
exist anymore and can't be installed via any of the usual means.
However, debugging works just fine regardless, so this check makes
debugging impossible.

D3D11CreateDevice will fail anyway if debugging is not supported, so
let's rely on that instead.
2024-03-18 13:28:30 +01:00
Andreas Rheinhardt
efcb539f47 tests/ref/lavf-fate/hevc.flv: Fix ref file
Unbreaks the lavf-fate-hevc.flv FATE test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 12:10:04 +01:00
Gyan Doshi
a32f75d6e2 fate/lavf-container: correct operator; unbreak build 2024-03-18 16:14:43 +05:30
Steven Liu
7c9e7665e1 Changelog: Add Support PacketTypeMetadata of PacketType in enhanced flv
Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 18:38:48 +08:00
Zhu Pengfei
aeebcd2f73 fate/flvenc: support enhanced flv PacketTypeMetadata
Signed-off-by: Zhu Pengfei <411294962@qq.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 17:06:46 +08:00
Zhu Pengfei
85e047e7cd avformat/flvenc: support enhanced flv PacketTypeMetadata
Signed-off-by: Zhu Pengfei <411294962@qq.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 15:41:54 +08:00
Zhu Pengfei
4e5b1882d6 avformat/flvdec: support enhanced flv PacketTypeMetadata
Signed-off-by: Zhu Pengfei <411294962@qq.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 15:41:48 +08:00
Fei Wang
8962e2b1aa lavc/vaapi_decode: Don't update buffer number if allocataion fail
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-03-18 12:00:14 +08:00
Fei Wang
a8d9fab06b lavc/vaapi_encode: Enable block level bitrate control
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-03-18 12:00:14 +08:00
Haihao Xiang
74a8e080d0 lavu/hwcontext_qsv: Join the download/upload session to the main session
This may reduce the number of internal threads when using hwupload or
hwdownload filter.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-18 12:00:14 +08:00
Haihao Xiang
697251bb0c lavc/qsvdec: Do not print warning when draining cached frames
When all cached frames are drained, the output mfxSyncPoint pointer is
NULL and  MFX_ERR_MORE_DATA is returned, hence needn't print warning for
this expected behavior, otherwise the user might think the output from
qsv decoders are wrong.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-18 12:00:14 +08:00
Andreas Rheinhardt
6e63295d41 avformat/crypto: Avoid cast, use proper printf specifier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:53:32 +01:00
Andreas Rheinhardt
7b48cc61be avformat/aeaenc: Fix printf-specifier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:53:26 +01:00
Andreas Rheinhardt
2a0194bafa avcodec/ccaption_dec: Use static_assert instead of _Static_assert
The latter is not supported by MSVC 19.27.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:49:38 +01:00
Andreas Rheinhardt
f1b08b8a65 avcodec/mips/aaccoder_mips: Remove MIPS-specific aaccoder
ff_aac_coder_init_mips() modifies a static const structure of
function pointers. This will crash if the binary uses relro
and is a data race in any case.

Furthermore it points to a maintainability issue: The
AACCoefficientsEncoder structures have been constified
in commit fd9212f2ed,
a Libav commit merged in 318778de9e.
Libav did not have the MIPS-specific AAC code and so this was
fine for them; yet FFmpeg had them, but this was not recognized.

Commit 75a099fc73 points to another
maintainability issue: Contrary to ordinary DSP code, this code
here is way more complex and needs to be constantly kept in sync
with the ordinary code which it mimicks and replaces. Said commit
is the only commit actually changing aaccoder.c in the last few
years and the same change has not been performed for the MIPS
clone; before that, it even happened several times that the mips
code was broken due to changes of the generic code (see commits
97437bd17a and
de262d018d or
860dbe0275 or
933309a6ca or
b65ffa316e). This might even lead
to scenarios where someone changing non-dsp aacenc code would
have to modify mips inline asm in order to keep them in sync.
This is obviously a significant burden (if the AAC encoder were
actively developed).

Finally, the code does not even compile here due to errors like
"Error: float register should be even, was 1".

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:49:38 +01:00
Andreas Rheinhardt
e6c7a88b34 avutil/hash: Avoid relocations for hash names
These strings are so short (longest takes 11B) that using
pointers is wasteful. Avoiding them also moves hashdesc
into .rodata (from .data.rel.ro).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:48:46 +01:00
Andreas Rheinhardt
95a6788314 avformat/aiffenc: Usw avio_wb32() where possible
AIFF is a big-endian format, so this is more natural.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 16:09:15 +01:00
Andreas Rheinhardt
0230792bc8 avformat/aiffenc: Simplify padding tag
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 16:09:15 +01:00
Andreas Rheinhardt
f088b28950 fate/lavf-audio: Test writing AIFF-native tags
In particular, test writing tags with odd strlen.
(These tags are zero-padded to even size.)

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 16:08:13 +01:00
Andreas Rheinhardt
3f7ee34efe avcodec/mpegaudio(data|dsp): Mark symbols as hidden
Avoids .got entries for ff_mpa_bitrate_tab, ff_mpa_synth_window_fixed,
ff_band_size_long, ff_mpa_pretab, ff_band_size_short,
ff_mpa_synth_window_float and ff_band_index_long here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt
333ff3e98d avcodec/vorbis_data: Mark symbols as hidden
Avoids .got entries for ff_vorbis_ch_layouts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt
6ffdf2f370 avcodec/dirac_arith: Only include x86/asm.h for ARCH_X86
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt
b6301dc658 avdevice/alldevices: Mark iterators as av_cold
Because they are.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt
7cf4c9037c avdevice/alldevices: Mark devices as hidden
Both GCC and Clang create code that inlines the loops in
next_input() and next_output() at high optimization
levels (presumably when there are not too many devices)
and this code leads to the creation of .got entries:
  e7:	48 3b 3d 00 00 00 00 	cmp    0x0(%rip),%rdi        # ee <av_input_video_device_next+0xe>
			ea: R_X86_64_REX_GOTPCRELX	ff_alsa_demuxer-0x4
  ee:	74 43                	je     133 <av_input_video_device_next+0x53>
  f0:	48 3b 3d 00 00 00 00 	cmp    0x0(%rip),%rdi        # f7 <av_input_video_device_next+0x17>
			f3: R_X86_64_REX_GOTPCRELX	ff_fbdev_demuxer-0x4
  f7:	74 41                	je     13a <av_input_video_device_next+0x5a>

These relocations can't be fixed up lateron when it is known
that the symbols exist in the same DSO.

This commit therefore marks these symbols as hidden, leading
to code like this:
  f7:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # fe <av_input_video_device_next+0xe>
			fa: R_X86_64_PC32	ff_alsa_demuxer-0x4
  fe:	48 39 c7             	cmp    %rax,%rdi
 101:	74 55                	je     158 <av_input_video_device_next+0x68>
 103:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # 10a <av_input_video_device_next+0x1a>
			106: R_X86_64_PC32	ff_fbdev_demuxer-0x4
 10a:	48 39 c7             	cmp    %rax,%rdi
 10d:	74 50                	je     15f <av_input_video_device_next+0x6f>

(Note: It is actually strange that the compiler creates code
that tries to read the addresses from the .got given that the
addresses can be read directly from indev_list/outdev_list.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt
ff15edf15a avcodec/ac3tab: Remove enum CustomChannelMapLocation
Forgotten in 4c8d9b1d09.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00